You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8527296
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: frontend/purestack.studio/guides/extending/regor/regor.mdx
+29-47Lines changed: 29 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,13 @@ highlights:
17
17
18
18
# Regor
19
19
20
-
<ahref="https://github.com/PureStackStudio/Regor"target="_blank"rel="noopener">Regor</a> is the component framework PureStack is built on. It runs in two places:
20
+
<a
21
+
href="https://github.com/PureStackStudio/Regor"
22
+
target="_blank"
23
+
rel="noopener"
24
+
>Regor</a
25
+
>
26
+
is the component framework PureStack is built on. It runs in two places:
21
27
22
28
<Gridcolumns="1"columnsSm="2"class="gap-3 mb-4">
23
29
<Paneltone="neutral"bodyClass="p-3">
@@ -153,7 +159,7 @@ Every page goes through the same four steps:
153
159
| Where it runs | Your build, once per page | The visitor's browser |
154
160
| What it produces | Static HTML | A live, interactive interface |
155
161
| Event handlers, `r-model`, timers | Not kept | Run normally |
156
-
| Page data (`tsSsgContext`) | Available | Not available |
162
+
| Page data (`pageContext`) | Available | Not available |
157
163
| Components | All built-in and registered components | The component families you register |
158
164
159
165
## Regor at build time
@@ -185,45 +191,22 @@ A plain attribute passes a string. An attribute that starts with a colon is a Re
<lir-for="item in tsSsgContext.pageInfo.frontmatter.highlights">{{ item }}</li>
224
-
</ul>
225
-
</Panel>
226
-
```
207
+
<import-contentsrc="./_regor-frontmatter.mdx"/>
208
+
209
+
<import-codeblocksrc="./_regor-frontmatter.mdx"/>
227
210
228
211
`r-if`, `r-else-if`, and `r-else` choose what to render. `r-for` repeats an element for each item. Loop over data from frontmatter, the page context, or component state.
finds components through their exported interfaces. Without the export, it
282
+
can't complete the component's props or jump from a tag in your markup to the
283
+
component's source.
300
284
</AlertBox>
301
285
302
286
Then use it in any page. Content between the tags fills the `<slot>`:
@@ -307,19 +291,17 @@ Then use it in any page. Content between the tags fills the `<slot>`:
307
291
</ReleaseNote>
308
292
```
309
293
310
-
Tag names match registered keys regardless of case, so `<ReleaseNote>` finds `releaseNote`. The kebab-case form `<release-note>` works too. Components can also read page data. Pass the component head to `resolveTsSsgContext` from `@purestack/ts-common`, as the built-in navigation and page-link components do.
294
+
Tag names match registered keys regardless of case, so `<ReleaseNote>` finds `releaseNote`. The kebab-case form `<release-note>` works too. Components can also read page data. Pass the component head to `resolvePageContext` from `@purestack/ts-common`, as the built-in navigation and page-link components do.
311
295
312
296
## Regor in the browser
313
297
314
298
### Mount an app
315
299
316
300
Place a `RegorApp` in a page and point it at a TypeScript file next to the page. It renders an `app` element with the `id` you give it and loads the script. The script calls `createApp` with the matching selector:
@@ -483,7 +465,7 @@ These patterns scale from a single widget to a multi-page admin tool with tables
483
465
484
466
## Use other libraries
485
467
486
-
A [PageScript](/components/runtime/page-script/) loads a browser entry point. Use it to enhance existing HTML or mount a browser-compatible library. PureStack bundles local TypeScript and its imports with esbuild; framework-specific source formats may need an additional compilation step. Start with a plain TypeScript module, as shown in [runtime scripts](../../components/runtime).
468
+
A [PageScript](/components/runtime/page-script/) loads a browser entry point. Use it to enhance existing HTML or mount a browser-compatible library. PureStack bundles local TypeScript and its imports with esbuild; framework-specific source formats may need an additional compilation step. Start with a plain TypeScript module, as shown in [runtime scripts](../../../components/runtime).
487
469
488
470
<AlertBoxtone="warning"icon="tabler:alert-triangle"title="What you give up">
489
471
Other frameworks can't use the built-in components, and they don't inherit the
0 commit comments