@damiro/stylo 0.4.0 → 0.7.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 +94 -10
- package/dist/{InPlaceView-Ba7JCZ2Y.js → InPlaceView-CS1qy-Ba.js} +277 -265
- package/dist/InPlaceView-CS1qy-Ba.js.map +1 -0
- package/dist/{Preview-Dxb9zPVv.js → Preview-Bw0k3Mev.js} +2 -2
- package/dist/{Preview-Dxb9zPVv.js.map → Preview-Bw0k3Mev.js.map} +1 -1
- package/dist/SplitView.d.ts +3 -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/theme.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 +15 -0
- package/dist/editor/wikilink-complete.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inplace/InPlaceView.d.ts +4 -2
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/context-menu.d.ts +1 -1
- package/dist/inplace/context-menu.d.ts.map +1 -1
- package/dist/inplace/extension.d.ts.map +1 -1
- package/dist/inplace/menu-open.d.ts +11 -0
- package/dist/inplace/menu-open.d.ts.map +1 -0
- package/dist/inplace/menu-plugin.d.ts +1 -0
- package/dist/inplace/menu-plugin.d.ts.map +1 -1
- package/dist/inplace/selection-bar.d.ts.map +1 -1
- package/dist/inplace/theme.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/stylo.js +58 -53
- package/dist/stylo.js.map +1 -1
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-YnIFkvKn.js → useCodeMirror-GPSkaYW6.js} +204 -168
- package/dist/useCodeMirror-GPSkaYW6.js.map +1 -0
- package/dist/wikilink-CTR8IFKc.js +42 -0
- package/dist/wikilink-CTR8IFKc.js.map +1 -0
- package/package.json +4 -1
- package/dist/InPlaceView-Ba7JCZ2Y.js.map +0 -1
- package/dist/useCodeMirror-YnIFkvKn.js.map +0 -1
- package/dist/wikilink-BFpTehto.js +0 -42
- package/dist/wikilink-BFpTehto.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ with Obsidian and any other Markdown tool. CodeMirror 6 handles editing;
|
|
|
8
8
|
`remark` / `rehype` + KaTeX handle rendering; `[[wikilinks]]` and `$…$` math are
|
|
9
9
|
built in.
|
|
10
10
|
|
|
11
|
+

|
|
12
|
+
|
|
11
13
|
> **Status:** working library, pre-1.0. The in-place canvas, `source` / `preview`
|
|
12
14
|
> / `split` modes, the formatting toolbar, `[[wikilinks]]`, and KaTeX math all
|
|
13
15
|
> ship and are covered by an integration test suite (`npm run test`). The public
|
|
@@ -15,15 +17,50 @@ built in.
|
|
|
15
17
|
|
|
16
18
|
---
|
|
17
19
|
|
|
18
|
-
##
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- **In-place canvas** — a live Obsidian-style surface: Markdown markers stay
|
|
23
|
+
hidden until the caret reaches the line, and headings, emphasis, links, and
|
|
24
|
+
math render inline without leaving the text. Plus `source`, `preview`, and
|
|
25
|
+
`split` modes.
|
|
26
|
+
- **First-class math** — `$…$` and `$$…$$` rendered with KaTeX, live in the
|
|
27
|
+
canvas and in preview.
|
|
28
|
+
- **`[[wikilinks]]`** — recognised, styled, and clickable, with an
|
|
29
|
+
`onWikiLinkClick` callback and opt-in `[[` autocomplete from an index you
|
|
30
|
+
supply (`wikiLinkSource`).
|
|
31
|
+
- **Interactive tables** — edit a rendered table cell by cell in the in-place
|
|
32
|
+
canvas, with row / column controls; or keep plain source pipes.
|
|
33
|
+
- **Callouts** — `> [!note]` blockquotes render as tinted admonition blocks
|
|
34
|
+
(`note` / `tip` / `warning` / `danger` / `example`).
|
|
35
|
+
- **Declarative toolbar** — trim, reorder, or extend the command set, supply
|
|
36
|
+
your own buttons, swap the icons.
|
|
37
|
+
[Reference](./docs/wiki/reference/toolbar.md).
|
|
38
|
+
- **End-user toolbar customizer** — an optional `<StyloToolbarSettings>`
|
|
39
|
+
component: drag- and keyboard-reorderable.
|
|
40
|
+
[Reference](./docs/wiki/reference/toolbar-settings.md).
|
|
41
|
+
- **Find / replace** — `Mod-f` on every editing surface.
|
|
42
|
+
- **Frontmatter-aware** — YAML frontmatter round-trips untouched; `onFrontmatter`
|
|
43
|
+
hands you the raw block to parse.
|
|
44
|
+
- **Opt-in code highlighting** — fenced code is coloured through a
|
|
45
|
+
`--stylo-syntax-*` token palette once you pass the grammars you want.
|
|
46
|
+
[Reference](./docs/wiki/reference/code-languages.md).
|
|
47
|
+
- **Themeable** — structural CSS only; a `--stylo-*` custom-property palette with
|
|
48
|
+
a built-in dark mode.
|
|
49
|
+
- **Imperative handle** — `focus()`, `scrollToHeading()`, `insertAtCursor()`, and
|
|
50
|
+
`getView()` for the raw CodeMirror `EditorView`.
|
|
19
51
|
|
|
20
|
-
|
|
21
|
-
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Install
|
|
22
55
|
|
|
23
56
|
```bash
|
|
24
|
-
npm install
|
|
57
|
+
npm install @damiro/stylo
|
|
25
58
|
```
|
|
26
59
|
|
|
60
|
+
To track an unreleased commit, install from git instead
|
|
61
|
+
(`npm install github:studiodamiro/stylo`) — the `prepare` script builds the
|
|
62
|
+
bundle during install, so there is nothing else to wire up.
|
|
63
|
+
|
|
27
64
|
CodeMirror, Lezer, and React are **peer dependencies** — Stylo shares the host's
|
|
28
65
|
copy rather than bundling its own, so editor state, facets, and the syntax tree
|
|
29
66
|
have a single identity (see [ADR-008](docs/journal/2026-09/2026-09-04_adr-008-codemirror-peer-dependency.md)).
|
|
@@ -113,11 +150,15 @@ function Editor() {
|
|
|
113
150
|
your own `ToolbarCustomItem` buttons, and a `render` slot to wrap it. See the
|
|
114
151
|
[toolbar reference](./docs/wiki/reference/toolbar.md).
|
|
115
152
|
|
|
116
|
-
`inPlace` and `
|
|
117
|
-
give `<Stylo>` a `key` derived from the config to apply a
|
|
118
|
-
prop is fully reactive. See
|
|
153
|
+
`inPlace`, `codeLanguages`, and `wikiLinkSource` are read once, when the editing
|
|
154
|
+
surface mounts — give `<Stylo>` a `key` derived from the config to apply a
|
|
155
|
+
change. Every other prop is fully reactive. See
|
|
119
156
|
[props · applied at mount](./docs/wiki/reference/props.md#config-applied-at-mount).
|
|
120
157
|
|
|
158
|
+
Pass `wikiLinkSource` — `(query) => { target, label? }[]`, sync or async — to
|
|
159
|
+
turn on `[[wikilink]]` autocomplete backed by your own index. See
|
|
160
|
+
[Wikilink autocomplete](./docs/wiki/reference/props.md#wikilink-autocomplete).
|
|
161
|
+
|
|
121
162
|
Fenced code blocks render in plain monospace — no token colours — until you pass
|
|
122
163
|
`codeLanguages` with the grammars you want. Stylo bundles none by design (the
|
|
123
164
|
full grammar set is ~110 lazy chunks). See
|
|
@@ -128,17 +169,60 @@ full grammar set is ~110 lazy chunks). See
|
|
|
128
169
|
Every colour is a `--stylo-*` custom property; override any of them on `.stylo`
|
|
129
170
|
or an ancestor. A dark palette ships built in and activates under a `.dark` or
|
|
130
171
|
`[data-theme="dark"]` ancestor — the `next-themes` / shadcn convention.
|
|
172
|
+
`--stylo-font-size` (default `0.9375rem`) sets the base editor size and
|
|
173
|
+
everything inside scales from it; `--stylo-font-family` and
|
|
174
|
+
`--stylo-font-family-mono` set the prose and code fonts.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
Full documentation lives in the [wiki](./docs/wiki/index.md).
|
|
181
|
+
|
|
182
|
+
**Architecture**
|
|
183
|
+
|
|
184
|
+
- [System overview](./docs/wiki/architecture/overview.md) — the plain-text-first
|
|
185
|
+
model, the composed stack, and the render pipeline.
|
|
186
|
+
|
|
187
|
+
**Guides**
|
|
188
|
+
|
|
189
|
+
- [Integrating Stylo](./docs/wiki/guides/integration.md) — live vs. mount-time
|
|
190
|
+
props, persistence, stylesheet and peer-dependency setup, the theming
|
|
191
|
+
contract.
|
|
192
|
+
- [Auto-save](./docs/wiki/guides/autosave.md) — why it is not a prop, and a
|
|
193
|
+
`useAutosave` hook to copy.
|
|
194
|
+
- [Layout and touch](./docs/wiki/guides/layout-and-touch.md) — the page layouts,
|
|
195
|
+
the full-height recipe that pins a toolbar for free, and touch behaviour.
|
|
196
|
+
|
|
197
|
+
**Reference**
|
|
198
|
+
|
|
199
|
+
- [`<Stylo>` props](./docs/wiki/reference/props.md) — the prop surface, styling
|
|
200
|
+
tokens, and math setup.
|
|
201
|
+
- [Formatting toolbar](./docs/wiki/reference/toolbar.md) — the `toolbar` prop,
|
|
202
|
+
command ids, keyboard shortcuts, and the `icons` override.
|
|
203
|
+
- [`<StyloToolbarSettings />`](./docs/wiki/reference/toolbar-settings.md) — the
|
|
204
|
+
opt-in end-user customizer for the formatting bar.
|
|
205
|
+
- [In-place canvas configuration](./docs/wiki/reference/in-place-config.md) — the
|
|
206
|
+
`inPlace` prop and its decoration toggles.
|
|
207
|
+
- [Fenced-code highlighting](./docs/wiki/reference/code-languages.md) — the
|
|
208
|
+
`codeLanguages` prop and how to opt into language grammars.
|
|
209
|
+
|
|
210
|
+
Engineering journal and Architectural Decision Records:
|
|
211
|
+
[`docs/PROJECT_JOURNAL.md`](./docs/PROJECT_JOURNAL.md).
|
|
131
212
|
|
|
132
213
|
## Development
|
|
133
214
|
|
|
134
215
|
```bash
|
|
135
216
|
npm install
|
|
136
|
-
npm run dev
|
|
217
|
+
npm run dev # playground
|
|
137
218
|
npm run typecheck
|
|
138
|
-
npm run test
|
|
139
|
-
npm run
|
|
219
|
+
npm run test # unit suite (Vitest + jsdom)
|
|
220
|
+
npm run test:browser # in-place canvas in real Chromium (Playwright)
|
|
221
|
+
npm run build # library bundle
|
|
140
222
|
```
|
|
141
223
|
|
|
224
|
+
`npm run test:browser` needs the browser once: `npx playwright install chromium`.
|
|
225
|
+
|
|
142
226
|
## License
|
|
143
227
|
|
|
144
228
|
MIT © damiro
|