@damiro/stylo 0.7.0 → 0.9.1
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 +41 -14
- package/dist/{InPlaceView-CS1qy-Ba.js → InPlaceView-Bu91_3Ig.js} +1199 -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 +4 -2
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +4 -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/useCodeMirror.d.ts +4 -2
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/editor/wikilink-complete.d.ts +5 -3
- package/dist/editor/wikilink-complete.d.ts.map +1 -1
- 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 +11 -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 +70 -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 +48 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-GPSkaYW6.js → useCodeMirror-DtwupFgc.js} +559 -531
- package/dist/useCodeMirror-DtwupFgc.js.map +1 -0
- package/package.json +2 -1
- package/dist/InPlaceView-CS1qy-Ba.js.map +0 -1
- package/dist/Preview-Bw0k3Mev.js +0 -93
- package/dist/Preview-Bw0k3Mev.js.map +0 -1
- package/dist/callout-oLE630ZP.js +0 -37
- package/dist/callout-oLE630ZP.js.map +0 -1
- package/dist/useCodeMirror-GPSkaYW6.js.map +0 -1
- package/dist/wikilink-CTR8IFKc.js +0 -42
- package/dist/wikilink-CTR8IFKc.js.map +0 -1
package/README.md
CHANGED
|
@@ -28,6 +28,9 @@ built in.
|
|
|
28
28
|
- **`[[wikilinks]]`** — recognised, styled, and clickable, with an
|
|
29
29
|
`onWikiLinkClick` callback and opt-in `[[` autocomplete from an index you
|
|
30
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.
|
|
31
34
|
- **Interactive tables** — edit a rendered table cell by cell in the in-place
|
|
32
35
|
canvas, with row / column controls; or keep plain source pipes.
|
|
33
36
|
- **Callouts** — `> [!note]` blockquotes render as tinted admonition blocks
|
|
@@ -71,7 +74,11 @@ npm install @codemirror/state @codemirror/view @codemirror/commands \
|
|
|
71
74
|
@codemirror/language @codemirror/lang-markdown @lezer/common @lezer/highlight
|
|
72
75
|
```
|
|
73
76
|
|
|
74
|
-
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).
|
|
75
82
|
|
|
76
83
|
The optional `@damiro/stylo/toolbar-settings` component (an end-user toolbar
|
|
77
84
|
customizer) additionally needs `@dnd-kit/core @dnd-kit/sortable
|
|
@@ -82,10 +89,23 @@ customizer) additionally needs `@dnd-kit/core @dnd-kit/sortable
|
|
|
82
89
|
|
|
83
90
|
## Why
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
Round-trip fidelity — plain Markdown in, the same plain Markdown out — rules out
|
|
93
|
+
most of the field before features even enter it:
|
|
94
|
+
|
|
95
|
+
- **TipTap, Milkdown, BlockNote** (all ProseMirror) and **Lexical** keep their
|
|
96
|
+
own document tree as the source of truth and serialize to Markdown on save —
|
|
97
|
+
exactly where frontmatter, `[[wikilinks]]` (not standard Markdown; needs a
|
|
98
|
+
custom node type), and math risk silently mangling on a round-trip.
|
|
99
|
+
**Toast UI Editor** is the same shape under different branding, and
|
|
100
|
+
considerably less themeable.
|
|
101
|
+
- **EasyMDE / SimpleMDE** get the one axis that matters most right — genuinely
|
|
102
|
+
canonical Markdown in and out — but on CodeMirror 5, with no in-place live
|
|
103
|
+
rendering (raw source or a separate preview pane, not an Obsidian-style
|
|
104
|
+
live-preview feel), no wikilinks, no embeds, no frontmatter handling.
|
|
105
|
+
Adopting one means rebuilding most of what Stylo already does.
|
|
106
|
+
- **Raw CodeMirror 6, no wrapper** is what's left after ruling those out — and
|
|
107
|
+
building the decoration canvas, the wikilink/embed/frontmatter layer, and a
|
|
108
|
+
theming contract from scratch is the reinvention Stylo exists to avoid.
|
|
89
109
|
|
|
90
110
|
Stylo takes the Obsidian stance instead: **the Markdown string is the source of
|
|
91
111
|
truth.** The editor is a thin, composable surface over it.
|
|
@@ -103,15 +123,16 @@ truth.** The editor is a thin, composable surface over it.
|
|
|
103
123
|
|
|
104
124
|
## Stack
|
|
105
125
|
|
|
106
|
-
| Concern | Library
|
|
107
|
-
| ---------------- |
|
|
108
|
-
| Editing surface | CodeMirror 6 (`@codemirror/lang-markdown`)
|
|
109
|
-
| Find / replace | `@codemirror/search` — `Mod-f` on every editing surface
|
|
110
|
-
| Render / preview | `react-markdown` + `remark-gfm` + `remark-math` + `rehype-katex` + `katex`
|
|
111
|
-
| `[[wikilinks]]` | small custom `remark` plugin
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
126
|
+
| Concern | Library |
|
|
127
|
+
| ---------------- | -------------------------------------------------------------------------------------------- |
|
|
128
|
+
| Editing surface | CodeMirror 6 (`@codemirror/lang-markdown`) |
|
|
129
|
+
| Find / replace | `@codemirror/search` — `Mod-f` on every editing surface |
|
|
130
|
+
| Render / preview | `react-markdown` + `remark-gfm` + `remark-math` + `rehype-katex` + `katex` |
|
|
131
|
+
| `[[wikilinks]]` | small custom `remark` plugin |
|
|
132
|
+
| `![[embeds]]` | `remark` plugin (preview) + `EmbedWidget` portal registry (in-place), one host `embedSource` |
|
|
133
|
+
| Frontmatter | `remark-frontmatter` — fences recognised; key/value parsing deferred |
|
|
134
|
+
| Styling | CSS Modules + `--stylo-*` CSS custom properties — no Tailwind, no CSS-in-JS |
|
|
135
|
+
| Icons | inline SVG, swappable via the `icons` prop — no icon-package dependency |
|
|
115
136
|
|
|
116
137
|
Styling and icon decisions are recorded in
|
|
117
138
|
[ADR-002](./docs/journal/2026-09/2026-09-01_adr-002-editor-ux-and-customization.md);
|
|
@@ -159,6 +180,12 @@ Pass `wikiLinkSource` — `(query) => { target, label? }[]`, sync or async — t
|
|
|
159
180
|
turn on `[[wikilink]]` autocomplete backed by your own index. See
|
|
160
181
|
[Wikilink autocomplete](./docs/wiki/reference/props.md#wikilink-autocomplete).
|
|
161
182
|
|
|
183
|
+
Pass `embedSource` — `(ref) => ReactNode`, sync or async — to resolve
|
|
184
|
+
`![[embed]]` transclusion on every rendered surface, the in-place canvas
|
|
185
|
+
included. Stylo detects the `![[…]]` (when it is alone on its line) and renders
|
|
186
|
+
whatever you return; on the canvas the caret reveals the raw source. See
|
|
187
|
+
[Embeds](./docs/wiki/reference/props.md#embeds).
|
|
188
|
+
|
|
162
189
|
Fenced code blocks render in plain monospace — no token colours — until you pass
|
|
163
190
|
`codeLanguages` with the grammars you want. Stylo bundles none by design (the
|
|
164
191
|
full grammar set is ~110 lazy chunks). See
|