@tinyvolt/pie 0.8.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +18 -1
  2. package/dist/components/SplitPane.d.ts +21 -0
  3. package/dist/components/SplitPane.jsx +113 -0
  4. package/dist/components/icons.d.ts +12 -0
  5. package/dist/components/icons.jsx +45 -0
  6. package/dist/lib/autodiff/index.d.ts +28 -0
  7. package/dist/lib/autodiff/index.js +39 -0
  8. package/dist/lib/customModules.d.ts +13 -0
  9. package/dist/lib/customModules.js +17 -0
  10. package/dist/lib/markdown/compile.d.ts +27 -0
  11. package/dist/lib/markdown/compile.js +26 -0
  12. package/dist/lib/markdown/components/CanvasPage.d.ts +9 -0
  13. package/dist/lib/markdown/components/CanvasPage.jsx +16 -0
  14. package/dist/lib/markdown/components/MarkdownBody.d.ts +11 -0
  15. package/dist/lib/markdown/components/MarkdownBody.jsx +37 -0
  16. package/dist/lib/markdown/components/PiePage.d.ts +14 -0
  17. package/dist/lib/markdown/components/PiePage.jsx +41 -0
  18. package/dist/lib/markdown/components/PythonEditor.d.ts +10 -0
  19. package/dist/lib/markdown/components/PythonEditor.jsx +209 -0
  20. package/dist/lib/markdown/features/build.d.ts +60 -0
  21. package/dist/lib/markdown/features/build.js +36 -0
  22. package/dist/lib/markdown/features/glossary/View.d.ts +9 -0
  23. package/dist/lib/markdown/features/glossary/View.jsx +62 -0
  24. package/dist/lib/markdown/features/glossary/build.d.ts +6 -0
  25. package/dist/lib/markdown/features/glossary/build.js +81 -0
  26. package/dist/lib/markdown/features/sidebar/View.d.ts +11 -0
  27. package/dist/lib/markdown/features/sidebar/View.jsx +45 -0
  28. package/dist/lib/markdown/features/sidebar/build.d.ts +3 -0
  29. package/dist/lib/markdown/features/sidebar/build.js +7 -0
  30. package/dist/lib/markdown/features/tags/build.d.ts +7 -0
  31. package/dist/lib/markdown/features/tags/build.js +22 -0
  32. package/dist/lib/markdown/features/tags/url.d.ts +6 -0
  33. package/dist/lib/markdown/features/tags/url.js +10 -0
  34. package/dist/lib/markdown/features/toc/build.d.ts +7 -0
  35. package/dist/lib/markdown/features/toc/build.js +62 -0
  36. package/dist/lib/markdown/features/views.d.ts +4 -0
  37. package/dist/lib/markdown/features/views.jsx +11 -0
  38. package/dist/lib/markdown/frontmatter.d.ts +44 -0
  39. package/dist/lib/markdown/frontmatter.js +109 -0
  40. package/dist/lib/markdown/render.d.ts +6 -0
  41. package/dist/lib/markdown/render.js +95 -0
  42. package/dist/lib/nodes/animation.d.ts +14 -0
  43. package/dist/lib/nodes/animation.js +34 -0
  44. package/dist/lib/nodes/components/CenteredGrid.d.ts +20 -0
  45. package/dist/lib/nodes/components/CenteredGrid.jsx +44 -0
  46. package/dist/lib/nodes/components/NodeCanvas.d.ts +7 -0
  47. package/dist/lib/nodes/components/NodeCanvas.jsx +50 -0
  48. package/dist/lib/nodes/execute.d.ts +27 -0
  49. package/dist/lib/nodes/execute.js +159 -0
  50. package/dist/lib/nodes/functions/Node2NodeFunc.d.ts +70 -0
  51. package/dist/lib/nodes/functions/Node2NodeFunc.js +223 -0
  52. package/dist/lib/nodes/functions/array.d.ts +12 -0
  53. package/dist/lib/nodes/functions/array.js +31 -0
  54. package/dist/lib/nodes/functions/autodiff.d.ts +12 -0
  55. package/dist/lib/nodes/functions/autodiff.js +60 -0
  56. package/dist/lib/nodes/functions/basic.d.ts +111 -0
  57. package/dist/lib/nodes/functions/basic.js +275 -0
  58. package/dist/lib/nodes/functions/registry.d.ts +9 -0
  59. package/dist/lib/nodes/functions/registry.js +45 -0
  60. package/dist/lib/nodes/functions/sideEffects.d.ts +78 -0
  61. package/dist/lib/nodes/functions/sideEffects.js +201 -0
  62. package/dist/lib/nodes/hooks/useCanvasGestures.d.ts +9 -0
  63. package/dist/lib/nodes/hooks/useCanvasGestures.js +120 -0
  64. package/dist/lib/nodes/hooks/useCanvasResize.d.ts +2 -0
  65. package/dist/lib/nodes/hooks/useCanvasResize.js +33 -0
  66. package/dist/lib/nodes/jax.d.ts +46 -0
  67. package/dist/lib/nodes/jax.js +120 -0
  68. package/dist/lib/nodes/render/renderLogic.d.ts +13 -0
  69. package/dist/lib/nodes/render/renderLogic.jsx +234 -0
  70. package/dist/lib/nodes/state/NameGenerator.d.ts +10 -0
  71. package/dist/lib/nodes/state/NameGenerator.js +29 -0
  72. package/dist/lib/nodes/state/Node.d.ts +134 -0
  73. package/dist/lib/nodes/state/Node.js +57 -0
  74. package/dist/lib/nodes/state/NodeStore.d.ts +49 -0
  75. package/dist/lib/nodes/state/NodeStore.js +138 -0
  76. package/dist/lib/nodes/tensors/broadcast.d.ts +18 -0
  77. package/dist/lib/nodes/tensors/broadcast.js +92 -0
  78. package/dist/lib/nodes/tensors/tensor.d.ts +13 -0
  79. package/dist/lib/nodes/tensors/tensor.js +34 -0
  80. package/dist/lib/python/lift.d.ts +51 -0
  81. package/dist/lib/python/lift.js +155 -0
  82. package/dist/lib/python/py/pie.py +303 -0
  83. package/dist/lib/python/py/pie_mpl.py +15 -0
  84. package/dist/lib/python/py/show_figures.py +5 -0
  85. package/dist/lib/python/runner.d.ts +36 -0
  86. package/dist/lib/python/runner.js +221 -0
  87. package/dist/lib/python/worker.d.ts +1 -0
  88. package/dist/lib/python/worker.js +111 -0
  89. package/dist/lib/ui/UiLayer.d.ts +2 -0
  90. package/dist/lib/ui/UiLayer.jsx +15 -0
  91. package/dist/lib/ui/UiView.d.ts +23 -0
  92. package/dist/lib/ui/UiView.jsx +56 -0
  93. package/dist/lib/ui/components/checkboxes.d.ts +10 -0
  94. package/dist/lib/ui/components/checkboxes.jsx +30 -0
  95. package/dist/lib/ui/components/latex.d.ts +8 -0
  96. package/dist/lib/ui/components/latex.jsx +41 -0
  97. package/dist/lib/ui/components/radio.d.ts +6 -0
  98. package/dist/lib/ui/components/radio.jsx +19 -0
  99. package/dist/lib/ui/components/slider.d.ts +8 -0
  100. package/dist/lib/ui/components/slider.jsx +7 -0
  101. package/dist/lib/ui/components/textbox.d.ts +5 -0
  102. package/dist/lib/ui/components/textbox.jsx +21 -0
  103. package/dist/lib/ui/dragUi.d.ts +10 -0
  104. package/dist/lib/ui/dragUi.js +129 -0
  105. package/dist/lib/ui/nodeHandle.d.ts +15 -0
  106. package/dist/lib/ui/nodeHandle.js +37 -0
  107. package/dist/lib/ui/registry.d.ts +10 -0
  108. package/dist/lib/ui/registry.js +42 -0
  109. package/dist/runtime.css +696 -0
  110. package/dist/runtime.d.ts +9 -0
  111. package/dist/runtime.jsx +6 -0
  112. package/init/index.js +2 -2
  113. package/init/site-agents.md +7 -3
  114. package/package.json +15 -6
  115. package/pages/about.md +4 -0
  116. package/runtime-agents.md +146 -0
  117. package/src/app.css +7 -665
  118. package/src/components/SplitPane.tsx +11 -9
  119. package/src/lib/customModules.ts +30 -0
  120. package/src/lib/markdown/compile.ts +49 -0
  121. package/src/lib/markdown/components/CanvasPage.tsx +9 -4
  122. package/src/lib/markdown/components/PiePage.tsx +48 -0
  123. package/src/lib/markdown/features/build.ts +15 -6
  124. package/src/lib/markdown/features/sidebar/View.tsx +4 -2
  125. package/src/lib/markdown/features/tags/build.ts +6 -3
  126. package/src/lib/markdown/pages.ts +1 -9
  127. package/src/lib/markdown/vitePlugin.ts +4 -8
  128. package/src/lib/nodes/functions/registry.ts +30 -21
  129. package/src/lib/nodes/functions/sideEffects.ts +48 -8
  130. package/src/lib/nodes/functions/vitePlugin.ts +8 -10
  131. package/src/lib/nodes/state/Node.ts +27 -19
  132. package/src/lib/nodes/state/NodeStore.ts +12 -1
  133. package/src/lib/siteModules.ts +13 -0
  134. package/src/lib/ui/dragUi.ts +4 -2
  135. package/src/lib/ui/registry.ts +35 -14
  136. package/src/page.css +664 -0
  137. package/src/routes/[...slug].tsx +2 -3
  138. package/src/runtime.css +29 -0
  139. package/src/runtime.tsx +15 -0
@@ -52,7 +52,7 @@ canvas: left
52
52
 
53
53
  - `title`: the tab title. Empty means the tab shows the site title alone.
54
54
  - `description`: shown in search results and link previews. Empty means `site.yml`'s `description`.
55
- - `canvas`: `left`, `right`, `top`, `bottom` or `none` (default). Adds a canvas on that side of the page.
55
+ - `canvas`: `left`, `right`, `top`, `bottom` or `none` (default). Every page has a canvas, on that side of the page. `none`: it starts collapsed on the right, and the button on the divider opens it. Every `pie.*` call works either way. Python can show, hide or move it: see `pie.show_canvas` under "Side effects".
56
56
  - `sidebar`: a `.md` file shown in a collapsible sidebar on the left, e.g. `sidebar: _topics.md`. The path is relative to the page's file. `none`: no sidebar, even when `site.yml` sets one. Left out: `site.yml`'s `sidebar`.
57
57
  - It starts collapsed. A button opens it, and the rest of the page shrinks to make room. A new page starts with it collapsed.
58
58
  - On screens narrower than `--sidebar-drawer-below` (768px by default), it opens over the page instead. Tapping outside it or on one of its links closes it.
@@ -141,7 +141,7 @@ Arguments can be nodes or plain numbers. Passing an array where one item is expe
141
141
 
142
142
  ### Side effects
143
143
 
144
- These change existing nodes instead of making a new one. They run once, when called.
144
+ These change existing nodes, or the canvas, instead of making a new one. They run once, when called.
145
145
 
146
146
  | Call | Does |
147
147
  | --- | --- |
@@ -155,8 +155,11 @@ These change existing nodes instead of making a new one. They run once, when cal
155
155
  | `pie.hide(node)` | stops drawing `node` |
156
156
  | `pie.show(node)` | draws a hidden `node` again |
157
157
  | `pie.remove(node)` | removes `node`; nodes built from it are removed too |
158
+ | `pie.show_canvas(side)` | shows the canvas. `side` is optional: `left`, `right`, `top` or `bottom` also moves it there. Any other value raises an error |
159
+ | `pie.hide_canvas()` | collapses the canvas; its nodes stay |
158
160
 
159
161
  - `p`, `s` or `node` can be an array: every item changes.
162
+ - `pie.clear()` doesn't change whether the canvas is shown, or its side.
160
163
  - A moved node stops following the nodes it was built from. Nodes built from it follow the move. A moved point keeps its colors.
161
164
  - The four `translate_*` calls take `animate=True`: the value moves to its new value over half a second instead of jumping. The call returns when the move ends, so a loop of animated calls plays one after another. An array's items move together. Other calls raise an error if passed `animate`.
162
165
 
@@ -327,7 +330,7 @@ export function Stepper(props: { args: UiArg[]; step?: number }) {
327
330
  - A UI that throws shows `pie.ui.<name>: <message>` in red in its place.
328
331
  - Don't add a grip or a label: every UI gets both. `args` and `label` are reserved prop names.
329
332
  - The built-in UIs are in `node_modules/@tinyvolt/pie/src/lib/ui/components/`.
330
- - A name used twice, by two of your files or by yours and a built-in, raises an error when a page with a Python editor loads. It doesn't fail the build.
333
+ - A name used twice, by two of your files or by yours and a built-in, fails the build.
331
334
 
332
335
  ## Layouts: `layouts/`
333
336
 
@@ -362,6 +365,7 @@ Change the CSS variables in `styles/theme.css` (colors, fonts, text width), or a
362
365
  - a page's URL matches a route in `node_modules/@tinyvolt/pie/src/routes/`
363
366
  - a `functions/` keyword is used twice
364
367
  - a `nodes/` type name is used twice
368
+ - a `ui/` name is used twice
365
369
  - a `layouts/` file has no default export
366
370
 
367
371
  Run `npm run build` after a change to confirm it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinyvolt/pie",
3
- "version": "0.8.2",
3
+ "version": "0.10.0",
4
4
  "description": "A Markdown-based SSG for interactive science explainers. Create a site with: npx @tinyvolt/pie init my-site",
5
5
  "type": "module",
6
6
  "homepage": "https://pie.tinyvolt.com/",
@@ -9,7 +9,12 @@
9
9
  "url": "git+https://github.com/TinyVolt/pie-ssg.git"
10
10
  },
11
11
  "exports": {
12
- "./vite": "./vite.ts"
12
+ "./vite": "./vite.ts",
13
+ "./runtime": {
14
+ "types": "./dist/runtime.d.ts",
15
+ "solid": "./dist/runtime.jsx"
16
+ },
17
+ "./runtime.css": "./dist/runtime.css"
13
18
  },
14
19
  "bin": {
15
20
  "pie": "init/index.js"
@@ -26,13 +31,17 @@
26
31
  "layouts",
27
32
  "public",
28
33
  "site.yml",
29
- ".nvmrc"
34
+ ".nvmrc",
35
+ "dist",
36
+ "runtime-agents.md"
30
37
  ],
31
38
  "scripts": {
32
39
  "dev": "vite dev",
33
40
  "build": "vite build",
34
41
  "start": "node .output/server/index.mjs",
35
- "preview": "vite preview"
42
+ "preview": "vite preview",
43
+ "build:runtime": "node scripts/build-runtime.js",
44
+ "prepack": "node scripts/build-runtime.js"
36
45
  },
37
46
  "dependencies": {
38
47
  "@codemirror/lang-python": "6.2.1",
@@ -48,8 +57,8 @@
48
57
  "nitro": "3.0.260610-beta"
49
58
  },
50
59
  "peerDependencies": {
51
- "solid-js": "1.9.14",
52
- "vite": "8.1.4"
60
+ "solid-js": "^1.9.14",
61
+ "vite": "^8.1.4"
53
62
  },
54
63
  "publishConfig": {
55
64
  "access": "public"
package/pages/about.md CHANGED
@@ -5,3 +5,7 @@ tags: #math
5
5
  ---
6
6
 
7
7
  # About
8
+
9
+ ```python-editor
10
+ # write your code here
11
+ ```
@@ -0,0 +1,146 @@
1
+ # pie inside another app: `@tinyvolt/pie/runtime`
2
+
3
+ [pie-ssg](https://github.com/TinyVolt/pie-ssg) builds sites from Markdown pages. Readers can run Python in a page and draw on a canvas. `@tinyvolt/pie/runtime` shows the same pages inside another app (the "host"), e.g. as a Markdown preview: the host turns pie markdown into a page with `compilePie` and shows it with `<PiePage>`.
4
+
5
+ The markdown format is the one a site uses. It is described in `node_modules/@tinyvolt/pie/init/site-agents.md`, the guide for sites. This guide covers only what differs in a host.
6
+
7
+ ## Requirements
8
+
9
+ - A Solid app built with Vite and Solid's Vite plugin (`vite-plugin-solid`; SolidStart includes it). pie ships its components with their JSX, under the `solid` export condition, and the host's Solid plugin compiles them for the browser and the server.
10
+ - `solid-js` ^1.9.14 and `vite` ^8.1.4, as the host's own dependencies. pie uses the host's copy of Solid: two copies on one page break reactivity.
11
+ - No other setup: no aliases, `optimizeDeps` or `ssr.noExternal` settings for pie.
12
+
13
+ ```sh
14
+ npm install @tinyvolt/pie
15
+ ```
16
+
17
+ Installing changes none of the host's files.
18
+
19
+ ## A preview
20
+
21
+ ```tsx
22
+ import { createSignal, ErrorBoundary, Show } from 'solid-js';
23
+ import { compilePie, PiePage, type Page } from '@tinyvolt/pie/runtime';
24
+ import '@tinyvolt/pie/runtime.css';
25
+
26
+ export default function Preview() {
27
+ const [text, setText] = createSignal('# Hello\n\n$x^2$');
28
+ const [page, setPage] = createSignal<Page>();
29
+ const [error, setError] = createSignal('');
30
+
31
+ const preview = () => {
32
+ try {
33
+ setPage(compilePie(text()));
34
+ setError('');
35
+ } catch (e) {
36
+ setError((e as Error).message);
37
+ }
38
+ };
39
+
40
+ return (
41
+ <>
42
+ <textarea value={text()} onInput={e => setText(e.currentTarget.value)} />
43
+ <button onClick={preview}>Preview</button>
44
+ <p>{error()}</p>
45
+ <div style={{ height: '80vh' }}>
46
+ <Show when={page()}>
47
+ {page => (
48
+ <ErrorBoundary fallback={err => <p>{err.message}</p>}>
49
+ <PiePage page={page()} />
50
+ </ErrorBoundary>
51
+ )}
52
+ </Show>
53
+ </div>
54
+ </>
55
+ );
56
+ }
57
+ ```
58
+
59
+ ## `compilePie(markdown, options?)`
60
+
61
+ Turns pie markdown into a `Page`, as a site build would: `{ frontmatter, html, features }`. Runs in the browser or on a server.
62
+
63
+ - It throws an `Error` with the message a site build gives, e.g. ``page.md: `canvas` must be one of left, right, top, bottom, none, got "middle"``.
64
+ - `options.file`: the page's name in those messages. Default `page.md`.
65
+ - `options.site`: what a site's `site.yml` gives: the value of `sidebar`, `toc` and `glossary` for a page that leaves the key out, e.g. `{ toc: true }`. An error about one of these values names `site.yml`.
66
+ - `options.readFile(path)`: returns the text of another `.md` file, for `sidebar: _topics.md` and `glossary: _terms.md`. `path` is exactly as the page or `site` wrote it. Its frontmatter is ignored. Without `readFile`, such a page throws `file _topics.md does not exist`.
67
+ - Tags show as plain text, not links: a host has no tag pages.
68
+
69
+ ## `<PiePage page modules? css? />`
70
+
71
+ Shows a `Page` as a pie site shows it: the text, the canvas on the side `canvas:` names, and the toc, sidebar, glossary and tags. It shows only the page: not a site's header, and it doesn't set the browser tab's title.
72
+
73
+ - It renders a `<div class="pie-page">` that fills its parent. Give the parent a height. The text and the canvas scroll inside it.
74
+ - A new `page`, `modules` or `css` starts a fresh canvas and fresh Python variables, as opening another page in a site does.
75
+ - `modules`: the host's own functions, node types and UIs. See below.
76
+ - `css`: CSS like a site's `styles/*.css`, limited to the page. E.g. `h1 { color: crimson; }` styles only the page's headings. It is removed with the page, or when `css` changes.
77
+ - Only one `PiePage` can be mounted at a time, because custom code is global. Mounting a second throws `Only one PiePage can be mounted at a time`.
78
+ - It renders on the server too. Python, the canvas's drawing and the UIs need the browser, and `modules` is used only there.
79
+ - Python runs in a web worker with Pyodide, loaded from `https://cdn.jsdelivr.net/pyodide/`. A host with a Content-Security-Policy must allow `cdn.jsdelivr.net` in `script-src` and `connect-src`, and `'wasm-unsafe-eval'` in `script-src`.
80
+
81
+ ## Your own functions, node types and UIs: `modules`
82
+
83
+ A site keeps these in its `functions/`, `nodes/` and `ui/` folders. A host keeps them in its own files and passes them in:
84
+
85
+ ```tsx
86
+ import * as squareFns from './pie/square';
87
+ import * as squareNodes from './pie/squareNode';
88
+ import * as stepperUi from './pie/stepper';
89
+
90
+ <PiePage
91
+ page={page()}
92
+ modules={{
93
+ functions: [{ file: 'pie/square.ts', exports: squareFns }],
94
+ nodes: [{ file: 'pie/squareNode.tsx', exports: squareNodes }],
95
+ ui: [{ file: 'pie/stepper.tsx', exports: stepperUi }],
96
+ }}
97
+ />
98
+ ```
99
+
100
+ - `exports`: a module's exports, what `import * as m from '...'` gives. `file`: its name in error messages.
101
+ - Each kind takes the exports a site's folder takes: `Node2NodeFunc`s and `SideEffectFunc`s for `functions`, `NodeDefinition`s for `nodes`, and PascalCase components for `ui` (`MatrixProduct` is `pie.ui.matrix_product`). Other exports are ignored.
102
+ - The built-in functions, node types and UIs are always there. A name used twice, by two modules or by a module and a built-in, makes `PiePage` throw, e.g. `Duplicate function keyword 'square': pie/a.ts and pie/b.ts`. Wrap it in an `<ErrorBoundary>` to show the message.
103
+ - After the page goes, its modules' names are gone: `pie.square(...)` raises `Unknown function: square`.
104
+
105
+ Write them as `init/site-agents.md` describes, under "Your own functions", "Your own node types" and "Your own UIs", with one change: import from `@tinyvolt/pie/runtime` instead of `~/lib/...`. A site's file moves into a host by changing only those import lines.
106
+
107
+ ```ts
108
+ import { add, div, ref, scalar, type AnyNode, type Node2NodeFunc, type PointNode } from '@tinyvolt/pie/runtime';
109
+ ```
110
+
111
+ `@tinyvolt/pie/runtime` exports:
112
+
113
+ - Math on node values: everything in a site's `~/lib/nodes/jax` (`num`, `scalar`, `ref`, `add`, `sub`, `mul`, `div`, `sqrt`, `sin`, `cos`, `atan2`, …).
114
+ - Node types: `Node`, `AnyNode`, `NodeType`, `NodeTypeMap`, `NodeDefinition`, and each built-in node: `TextNode`, `PointNode`, `ScalarNode`, `TriangleNode`, `LineNode`, `CircleNode`, `EllipseNode`, `BezierQuadraticNode`, `BezierCubicNode`, `ArcNode`, `PointGradNode`, `ArrayNode`, `DummyNode`.
115
+ - Functions: `Node2NodeFunc`, `SideEffectFunc`, `ParameterDefinition`, `NodeStore` (what a `SideEffectFunc`'s `run` gets) and `Track` (what an animated one returns).
116
+ - UIs: `expectNode`, `useSetNode`, `UiArg`, `NodeHandle`.
117
+
118
+ A node type adds itself to `NodeTypeMap` on `@tinyvolt/pie/runtime`, not on `~/lib/nodes/state/Node`:
119
+
120
+ ```ts
121
+ declare module '@tinyvolt/pie/runtime' {
122
+ interface NodeTypeMap {
123
+ Square: SquareNode;
124
+ }
125
+ }
126
+ ```
127
+
128
+ ## Styles: `@tinyvolt/pie/runtime.css`
129
+
130
+ Import it once: `import '@tinyvolt/pie/runtime.css'`. It also needs KaTeX's CSS, which `PiePage` imports itself.
131
+
132
+ - Every rule is limited to `.pie-page`, so it styles nothing else in the host.
133
+ - The host's rules for bare elements, like `main` or a `* { margin: 0; padding: 0 }` reset, lose to pie's rules for the same properties. pie also sets the list padding and heading margins a reset removes.
134
+ - A property pie doesn't set, or a host rule with a class or id, can still reach into the page, e.g. `button { text-transform: uppercase }`.
135
+ - To restyle the page, set the variables of a site's `styles/theme.css` on `.pie-page`, e.g. `.pie-page { --color-text: #222; --content-width: 50rem; }`: colors (`--color-text`, `--color-bg`, `--color-muted`, `--color-subtle`, `--color-hover`, `--color-border`, `--color-border-hover`, `--color-code-bg`, `--color-error`, `--color-backdrop`), fonts (`--font-ui`, `--font-body`, `--font-mono`, `--font-size-body`, `--line-height`) and layout (`--content-width`, `--sidebar-width`, `--sidebar-drawer-below`).
136
+ - Or add rules that start with `.pie-page`, in CSS loaded after `runtime.css`, e.g. `.pie-page main h1 { color: crimson; }`, or pass them as `css`. The class names are under "Styles" in `init/site-agents.md`.
137
+
138
+ ## What differs from a site
139
+
140
+ - There is no `pages/` folder and no URLs: the host passes the markdown to `compilePie`.
141
+ - `site.yml` is `compilePie`'s `site` option. Its `title`, `url` and `description` don't apply.
142
+ - `sidebar` and `glossary` files come from `readFile`.
143
+ - Tags are plain text, and there are no `/_tags` pages.
144
+ - Links in a page or its sidebar are ordinary links in the host, e.g. `[Home](/)` opens the host's `/`.
145
+ - A site's build checks are errors instead: bad frontmatter, a missing `sidebar` or `glossary` file and an unknown `[[term]]` from `compilePie`; a name used twice from `PiePage`.
146
+ - `layouts/`, `public/` and the site's header don't apply.