@damiro/stylo 0.5.0 → 0.9.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.
- package/README.md +42 -19
- package/dist/{InPlaceView-B1GXXnoz.js → InPlaceView-Bu91_3Ig.js} +1200 -855
- package/dist/InPlaceView-Bu91_3Ig.js.map +1 -0
- package/dist/Preview-AaGGwLQP.js +170 -0
- package/dist/Preview-AaGGwLQP.js.map +1 -0
- package/dist/SplitView.d.ts +5 -2
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +6 -2
- package/dist/editor/SourceView.d.ts.map +1 -1
- package/dist/editor/extensions.d.ts +2 -2
- package/dist/editor/extensions.d.ts.map +1 -1
- package/dist/editor/theme.d.ts.map +1 -1
- package/dist/editor/useCodeMirror.d.ts +6 -2
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/editor/wikilink-complete.d.ts +17 -0
- package/dist/editor/wikilink-complete.d.ts.map +1 -0
- package/dist/embed-B2Dfkpd_.js +124 -0
- package/dist/embed-B2Dfkpd_.js.map +1 -0
- package/dist/embed.d.ts +14 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/frontmatter-DGUkb9z-.js +39 -0
- package/dist/frontmatter-DGUkb9z-.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inplace/InPlaceView.d.ts +13 -2
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/config.d.ts +8 -0
- package/dist/inplace/config.d.ts.map +1 -1
- package/dist/inplace/context-menu-actions.d.ts +5 -14
- package/dist/inplace/context-menu-actions.d.ts.map +1 -1
- package/dist/inplace/context-menu-helpers.d.ts +30 -0
- package/dist/inplace/context-menu-helpers.d.ts.map +1 -0
- package/dist/inplace/context-menu-shell.d.ts +23 -0
- package/dist/inplace/context-menu-shell.d.ts.map +1 -0
- package/dist/inplace/context-menu-types.d.ts +46 -0
- package/dist/inplace/context-menu-types.d.ts.map +1 -0
- package/dist/inplace/context-menu.d.ts +2 -42
- package/dist/inplace/context-menu.d.ts.map +1 -1
- package/dist/inplace/decorate.d.ts.map +1 -1
- package/dist/inplace/edit-boundaries.d.ts +1 -25
- package/dist/inplace/edit-boundaries.d.ts.map +1 -1
- package/dist/inplace/edit-divider.d.ts +27 -0
- package/dist/inplace/edit-divider.d.ts.map +1 -0
- package/dist/inplace/embed-registry.d.ts +39 -0
- package/dist/inplace/embed-registry.d.ts.map +1 -0
- package/dist/inplace/embed.d.ts +8 -0
- package/dist/inplace/embed.d.ts.map +1 -0
- package/dist/inplace/extension.d.ts +6 -0
- package/dist/inplace/extension.d.ts.map +1 -1
- package/dist/inplace/inline-md.d.ts +6 -1
- package/dist/inplace/inline-md.d.ts.map +1 -1
- package/dist/inplace/link-row.d.ts +21 -0
- package/dist/inplace/link-row.d.ts.map +1 -0
- package/dist/inplace/math-edit.d.ts +36 -0
- package/dist/inplace/math-edit.d.ts.map +1 -0
- package/dist/inplace/math.d.ts +12 -0
- package/dist/inplace/math.d.ts.map +1 -1
- package/dist/inplace/menu-plugin.d.ts.map +1 -1
- package/dist/inplace/nodes-blocks.d.ts +14 -0
- package/dist/inplace/nodes-blocks.d.ts.map +1 -0
- package/dist/inplace/nodes-inline.d.ts +16 -0
- package/dist/inplace/nodes-inline.d.ts.map +1 -0
- package/dist/inplace/nodes.d.ts +3 -2
- package/dist/inplace/nodes.d.ts.map +1 -1
- package/dist/inplace/scan.d.ts +6 -0
- package/dist/inplace/scan.d.ts.map +1 -1
- package/dist/inplace/selection-bar-position.d.ts +31 -0
- package/dist/inplace/selection-bar-position.d.ts.map +1 -0
- package/dist/inplace/selection-bar.d.ts +0 -2
- package/dist/inplace/selection-bar.d.ts.map +1 -1
- package/dist/inplace/table-widget-caret.d.ts +11 -0
- package/dist/inplace/table-widget-caret.d.ts.map +1 -0
- package/dist/inplace/table-widget-render.d.ts +18 -0
- package/dist/inplace/table-widget-render.d.ts.map +1 -0
- package/dist/inplace/table-widget.d.ts +5 -2
- package/dist/inplace/table-widget.d.ts.map +1 -1
- package/dist/inplace/tables.d.ts.map +1 -1
- package/dist/inplace/theme-callout.d.ts +50 -0
- package/dist/inplace/theme-callout.d.ts.map +1 -0
- package/dist/inplace/theme-canvas.d.ts +166 -0
- package/dist/inplace/theme-canvas.d.ts.map +1 -0
- package/dist/inplace/theme-fonts.d.ts +4 -0
- package/dist/inplace/theme-fonts.d.ts.map +1 -0
- package/dist/inplace/theme-menu.d.ts +87 -0
- package/dist/inplace/theme-menu.d.ts.map +1 -0
- package/dist/inplace/theme-popups.d.ts +94 -0
- package/dist/inplace/theme-popups.d.ts.map +1 -0
- package/dist/inplace/theme-table-gizmos.d.ts +57 -0
- package/dist/inplace/theme-table-gizmos.d.ts.map +1 -0
- package/dist/inplace/theme-table.d.ts +30 -0
- package/dist/inplace/theme-table.d.ts.map +1 -0
- package/dist/inplace/theme.d.ts +5 -0
- package/dist/inplace/theme.d.ts.map +1 -1
- package/dist/inplace/wikilinks.d.ts.map +1 -1
- package/dist/inplace/wrap-at.d.ts +32 -0
- package/dist/inplace/wrap-at.d.ts.map +1 -0
- package/dist/{markdown-N3lRmU2n.js → markdown-BYXs9Tj8.js} +2 -2
- package/dist/{markdown-N3lRmU2n.js.map → markdown-BYXs9Tj8.js.map} +1 -1
- package/dist/render/Embed.d.ts +24 -0
- package/dist/render/Embed.d.ts.map +1 -0
- package/dist/render/Preview.d.ts +6 -2
- package/dist/render/Preview.d.ts.map +1 -1
- package/dist/render/embed-cache.d.ts +10 -0
- package/dist/render/embed-cache.d.ts.map +1 -0
- package/dist/render/remark-embed.d.ts +19 -0
- package/dist/render/remark-embed.d.ts.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/stylo.js +75 -54
- package/dist/stylo.js.map +1 -1
- package/dist/toolbar/block.d.ts +0 -26
- package/dist/toolbar/block.d.ts.map +1 -1
- package/dist/toolbar/command-helpers.d.ts +57 -0
- package/dist/toolbar/command-helpers.d.ts.map +1 -0
- package/dist/toolbar/commands.d.ts +1 -21
- package/dist/toolbar/commands.d.ts.map +1 -1
- package/dist/toolbar/frontmatter-toggle.d.ts +13 -0
- package/dist/toolbar/frontmatter-toggle.d.ts.map +1 -0
- package/dist/toolbar/heading.d.ts +10 -0
- package/dist/toolbar/heading.d.ts.map +1 -0
- package/dist/toolbar/inline-ops.d.ts +3 -53
- package/dist/toolbar/inline-ops.d.ts.map +1 -1
- package/dist/toolbar/link-ops.d.ts +22 -0
- package/dist/toolbar/link-ops.d.ts.map +1 -0
- package/dist/toolbar/rule.d.ts +11 -0
- package/dist/toolbar/rule.d.ts.map +1 -0
- package/dist/toolbar/table-position.d.ts +32 -0
- package/dist/toolbar/table-position.d.ts.map +1 -0
- package/dist/toolbar/table.d.ts +1 -16
- package/dist/toolbar/table.d.ts.map +1 -1
- package/dist/toolbar/underline-ops.d.ts +15 -0
- package/dist/toolbar/underline-ops.d.ts.map +1 -0
- package/dist/toolbar/wikilink-ops.d.ts +22 -0
- package/dist/toolbar/wikilink-ops.d.ts.map +1 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-hLeJQw6e.js → useCodeMirror-DtwupFgc.js} +590 -526
- package/dist/useCodeMirror-DtwupFgc.js.map +1 -0
- package/package.json +5 -1
- package/dist/InPlaceView-B1GXXnoz.js.map +0 -1
- package/dist/Preview-Dxb9zPVv.js +0 -93
- package/dist/Preview-Dxb9zPVv.js.map +0 -1
- package/dist/callout-oLE630ZP.js +0 -37
- package/dist/callout-oLE630ZP.js.map +0 -1
- package/dist/useCodeMirror-hLeJQw6e.js.map +0 -1
- package/dist/wikilink-BFpTehto.js +0 -42
- package/dist/wikilink-BFpTehto.js.map +0 -1
package/README.md
CHANGED
|
@@ -26,7 +26,11 @@ built in.
|
|
|
26
26
|
- **First-class math** — `$…$` and `$$…$$` rendered with KaTeX, live in the
|
|
27
27
|
canvas and in preview.
|
|
28
28
|
- **`[[wikilinks]]`** — recognised, styled, and clickable, with an
|
|
29
|
-
`onWikiLinkClick` callback
|
|
29
|
+
`onWikiLinkClick` callback and opt-in `[[` autocomplete from an index you
|
|
30
|
+
supply (`wikiLinkSource`).
|
|
31
|
+
- **`![[embed]]` transclusion** — opt-in on every rendered surface (`preview`,
|
|
32
|
+
`split`, and the in-place canvas): pass `embedSource` and Stylo hands you the
|
|
33
|
+
reference, you return the node to render in its place.
|
|
30
34
|
- **Interactive tables** — edit a rendered table cell by cell in the in-place
|
|
31
35
|
canvas, with row / column controls; or keep plain source pipes.
|
|
32
36
|
- **Callouts** — `> [!note]` blockquotes render as tinted admonition blocks
|
|
@@ -70,7 +74,11 @@ npm install @codemirror/state @codemirror/view @codemirror/commands \
|
|
|
70
74
|
@codemirror/language @codemirror/lang-markdown @lezer/common @lezer/highlight
|
|
71
75
|
```
|
|
72
76
|
|
|
73
|
-
React 18
|
|
77
|
+
React 18 or 19 is also a peer dependency (`react` + `react-dom`). Stylo ships
|
|
78
|
+
**ES modules only** — there is no CommonJS build — so it needs a bundler (Vite,
|
|
79
|
+
Next.js, …) or a native-ESM runtime. Stylesheet imports are in [Usage](#usage);
|
|
80
|
+
the full setup checklist is in the
|
|
81
|
+
[integration guide](./docs/wiki/guides/integration.md#requirements).
|
|
74
82
|
|
|
75
83
|
The optional `@damiro/stylo/toolbar-settings` component (an end-user toolbar
|
|
76
84
|
customizer) additionally needs `@dnd-kit/core @dnd-kit/sortable
|
|
@@ -102,15 +110,16 @@ truth.** The editor is a thin, composable surface over it.
|
|
|
102
110
|
|
|
103
111
|
## Stack
|
|
104
112
|
|
|
105
|
-
| Concern | Library
|
|
106
|
-
| ---------------- |
|
|
107
|
-
| Editing surface | CodeMirror 6 (`@codemirror/lang-markdown`)
|
|
108
|
-
| Find / replace | `@codemirror/search` — `Mod-f` on every editing surface
|
|
109
|
-
| Render / preview | `react-markdown` + `remark-gfm` + `remark-math` + `rehype-katex` + `katex`
|
|
110
|
-
| `[[wikilinks]]` | small custom `remark` plugin
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
113
|
+
| Concern | Library |
|
|
114
|
+
| ---------------- | -------------------------------------------------------------------------------------------- |
|
|
115
|
+
| Editing surface | CodeMirror 6 (`@codemirror/lang-markdown`) |
|
|
116
|
+
| Find / replace | `@codemirror/search` — `Mod-f` on every editing surface |
|
|
117
|
+
| Render / preview | `react-markdown` + `remark-gfm` + `remark-math` + `rehype-katex` + `katex` |
|
|
118
|
+
| `[[wikilinks]]` | small custom `remark` plugin |
|
|
119
|
+
| `![[embeds]]` | `remark` plugin (preview) + `EmbedWidget` portal registry (in-place), one host `embedSource` |
|
|
120
|
+
| Frontmatter | `remark-frontmatter` — fences recognised; key/value parsing deferred |
|
|
121
|
+
| Styling | CSS Modules + `--stylo-*` CSS custom properties — no Tailwind, no CSS-in-JS |
|
|
122
|
+
| Icons | inline SVG, swappable via the `icons` prop — no icon-package dependency |
|
|
114
123
|
|
|
115
124
|
Styling and icon decisions are recorded in
|
|
116
125
|
[ADR-002](./docs/journal/2026-09/2026-09-01_adr-002-editor-ux-and-customization.md);
|
|
@@ -149,11 +158,21 @@ function Editor() {
|
|
|
149
158
|
your own `ToolbarCustomItem` buttons, and a `render` slot to wrap it. See the
|
|
150
159
|
[toolbar reference](./docs/wiki/reference/toolbar.md).
|
|
151
160
|
|
|
152
|
-
`inPlace` and `
|
|
153
|
-
give `<Stylo>` a `key` derived from the config to apply a
|
|
154
|
-
prop is fully reactive. See
|
|
161
|
+
`inPlace`, `codeLanguages`, and `wikiLinkSource` are read once, when the editing
|
|
162
|
+
surface mounts — give `<Stylo>` a `key` derived from the config to apply a
|
|
163
|
+
change. Every other prop is fully reactive. See
|
|
155
164
|
[props · applied at mount](./docs/wiki/reference/props.md#config-applied-at-mount).
|
|
156
165
|
|
|
166
|
+
Pass `wikiLinkSource` — `(query) => { target, label? }[]`, sync or async — to
|
|
167
|
+
turn on `[[wikilink]]` autocomplete backed by your own index. See
|
|
168
|
+
[Wikilink autocomplete](./docs/wiki/reference/props.md#wikilink-autocomplete).
|
|
169
|
+
|
|
170
|
+
Pass `embedSource` — `(ref) => ReactNode`, sync or async — to resolve
|
|
171
|
+
`![[embed]]` transclusion on every rendered surface, the in-place canvas
|
|
172
|
+
included. Stylo detects the `![[…]]` (when it is alone on its line) and renders
|
|
173
|
+
whatever you return; on the canvas the caret reveals the raw source. See
|
|
174
|
+
[Embeds](./docs/wiki/reference/props.md#embeds).
|
|
175
|
+
|
|
157
176
|
Fenced code blocks render in plain monospace — no token colours — until you pass
|
|
158
177
|
`codeLanguages` with the grammars you want. Stylo bundles none by design (the
|
|
159
178
|
full grammar set is ~110 lazy chunks). See
|
|
@@ -164,8 +183,9 @@ full grammar set is ~110 lazy chunks). See
|
|
|
164
183
|
Every colour is a `--stylo-*` custom property; override any of them on `.stylo`
|
|
165
184
|
or an ancestor. A dark palette ships built in and activates under a `.dark` or
|
|
166
185
|
`[data-theme="dark"]` ancestor — the `next-themes` / shadcn convention.
|
|
167
|
-
`--stylo-font-size` (default `0.9375rem`) sets the base editor size
|
|
168
|
-
inside scales from it
|
|
186
|
+
`--stylo-font-size` (default `0.9375rem`) sets the base editor size and
|
|
187
|
+
everything inside scales from it; `--stylo-font-family` and
|
|
188
|
+
`--stylo-font-family-mono` set the prose and code fonts.
|
|
169
189
|
|
|
170
190
|
---
|
|
171
191
|
|
|
@@ -208,12 +228,15 @@ Engineering journal and Architectural Decision Records:
|
|
|
208
228
|
|
|
209
229
|
```bash
|
|
210
230
|
npm install
|
|
211
|
-
npm run dev
|
|
231
|
+
npm run dev # playground
|
|
212
232
|
npm run typecheck
|
|
213
|
-
npm run test
|
|
214
|
-
npm run
|
|
233
|
+
npm run test # unit suite (Vitest + jsdom)
|
|
234
|
+
npm run test:browser # in-place canvas in real Chromium (Playwright)
|
|
235
|
+
npm run build # library bundle
|
|
215
236
|
```
|
|
216
237
|
|
|
238
|
+
`npm run test:browser` needs the browser once: `npx playwright install chromium`.
|
|
239
|
+
|
|
217
240
|
## License
|
|
218
241
|
|
|
219
242
|
MIT © damiro
|