@damiro/stylo 0.15.2 → 0.17.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 +1 -1
- package/dist/{InPlaceView-DVX9qV68.js → InPlaceView-CRb5AkfX.js} +781 -743
- package/dist/InPlaceView-CRb5AkfX.js.map +1 -0
- package/dist/Preview-5lm2uUVj.js +319 -0
- package/dist/Preview-5lm2uUVj.js.map +1 -0
- package/dist/SplitView.d.ts +4 -1
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +4 -1
- package/dist/editor/SourceView.d.ts.map +1 -1
- package/dist/editor/theme.d.ts.map +1 -1
- package/dist/editor/useCodeMirror.d.ts +7 -1
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/embed-DKKeCE1Y.js +109 -0
- package/dist/embed-DKKeCE1Y.js.map +1 -0
- package/dist/{highlight-BLdNzTxQ.js → embed-cache-CcBfVrc9.js} +47 -4
- package/dist/embed-cache-CcBfVrc9.js.map +1 -0
- package/dist/inplace/InPlaceView.d.ts +4 -1
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/context-menu-helpers.d.ts +3 -4
- package/dist/inplace/context-menu-helpers.d.ts.map +1 -1
- package/dist/inplace/decorate.d.ts.map +1 -1
- package/dist/inplace/edit-line-prefix.d.ts.map +1 -1
- package/dist/inplace/embed.d.ts.map +1 -1
- package/dist/inplace/extension.d.ts.map +1 -1
- package/dist/inplace/inline-md.d.ts.map +1 -1
- package/dist/inplace/link-row.d.ts +14 -13
- package/dist/inplace/link-row.d.ts.map +1 -1
- package/dist/inplace/list-guides.d.ts.map +1 -1
- package/dist/inplace/math.d.ts +18 -3
- package/dist/inplace/math.d.ts.map +1 -1
- package/dist/inplace/table-widget-keys.d.ts +46 -0
- package/dist/inplace/table-widget-keys.d.ts.map +1 -0
- package/dist/inplace/table-widget.d.ts +1 -2
- package/dist/inplace/table-widget.d.ts.map +1 -1
- package/dist/inplace/tables.d.ts.map +1 -1
- package/dist/inplace/wikilinks.d.ts +1 -1
- package/dist/inplace/wikilinks.d.ts.map +1 -1
- package/dist/render/Embed.d.ts.map +1 -1
- package/dist/render/Preview.d.ts.map +1 -1
- package/dist/render/embed-cache.d.ts +13 -0
- package/dist/render/embed-cache.d.ts.map +1 -1
- package/dist/render/preview-components.d.ts +22 -0
- package/dist/render/preview-components.d.ts.map +1 -0
- package/dist/render/remark-wikilink.d.ts.map +1 -1
- package/dist/render/taskCheckbox.d.ts +30 -0
- package/dist/render/taskCheckbox.d.ts.map +1 -1
- package/dist/stylo.js +213 -196
- package/dist/stylo.js.map +1 -1
- package/dist/toolbar/Toolbar.d.ts.map +1 -1
- package/dist/toolbar/command-helpers.d.ts +27 -0
- package/dist/toolbar/command-helpers.d.ts.map +1 -1
- package/dist/toolbar/heading.d.ts +3 -0
- package/dist/toolbar/heading.d.ts.map +1 -1
- package/dist/toolbar/inline-ops.d.ts +6 -0
- package/dist/toolbar/inline-ops.d.ts.map +1 -1
- package/dist/toolbar/table.d.ts.map +1 -1
- package/dist/types/core.d.ts +209 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/inplace.d.ts +91 -0
- package/dist/types/inplace.d.ts.map +1 -0
- package/dist/types/sources.d.ts +66 -0
- package/dist/types/sources.d.ts.map +1 -0
- package/dist/types/toolbar.d.ts +72 -0
- package/dist/types/toolbar.d.ts.map +1 -0
- package/dist/types.d.ts +11 -406
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-CXtuBlLf.js → useCodeMirror-B07wRexo.js} +317 -268
- package/dist/useCodeMirror-B07wRexo.js.map +1 -0
- package/package.json +4 -4
- package/dist/InPlaceView-DVX9qV68.js.map +0 -1
- package/dist/Preview-BcdSr09-.js +0 -304
- package/dist/Preview-BcdSr09-.js.map +0 -1
- package/dist/embed-Dsu6b-MV.js +0 -131
- package/dist/embed-Dsu6b-MV.js.map +0 -1
- package/dist/highlight-BLdNzTxQ.js.map +0 -1
- package/dist/inplace/table-widget-caret.d.ts +0 -11
- package/dist/inplace/table-widget-caret.d.ts.map +0 -1
- package/dist/useCodeMirror-CXtuBlLf.js.map +0 -1
|
@@ -28,7 +28,7 @@ function a(e) {
|
|
|
28
28
|
};
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
var o =
|
|
31
|
+
var o = /^[ \t]*---[ \t]*\r?\n(?:([\s\S]*?)\r?\n)?[ \t]*---[ \t]*(?:\r?\n|$)/;
|
|
32
32
|
function s(e) {
|
|
33
33
|
let t = o.exec(e);
|
|
34
34
|
return t ? {
|
|
@@ -126,8 +126,51 @@ var c = [
|
|
|
126
126
|
tag: e,
|
|
127
127
|
color: `var(--stylo-syntax-${t === "meta" ? "comment" : t})`,
|
|
128
128
|
...n ? { fontStyle: "italic" } : {}
|
|
129
|
-
}))), u = t(l);
|
|
129
|
+
}))), u = t(l), d = 64, f = /* @__PURE__ */ new WeakMap();
|
|
130
|
+
function p(e) {
|
|
131
|
+
let t = f.get(e);
|
|
132
|
+
return t || (t = /* @__PURE__ */ new Map(), f.set(e, t)), t;
|
|
133
|
+
}
|
|
134
|
+
var m = /* @__PURE__ */ new WeakMap();
|
|
135
|
+
function h(e, t) {
|
|
136
|
+
let n = m.get(e);
|
|
137
|
+
n || (n = /* @__PURE__ */ new Map(), m.set(e, n));
|
|
138
|
+
let r = n.get(t);
|
|
139
|
+
return r || (r = /* @__PURE__ */ new Set(), n.set(t, r)), r;
|
|
140
|
+
}
|
|
141
|
+
function g(e, t, n) {
|
|
142
|
+
let r = h(e, t);
|
|
143
|
+
return r.add(n), () => r.delete(n);
|
|
144
|
+
}
|
|
145
|
+
function _(e, t) {
|
|
146
|
+
let n = f.get(e);
|
|
147
|
+
if (!n) return;
|
|
148
|
+
let r = t === void 0 ? [...n.keys()] : [t], i = m.get(e);
|
|
149
|
+
for (let e of r) n.delete(e), i?.get(e)?.forEach((e) => e());
|
|
150
|
+
}
|
|
151
|
+
function v(e, t) {
|
|
152
|
+
let n = p(e).get(t);
|
|
153
|
+
return n?.settled ? { node: n.node } : void 0;
|
|
154
|
+
}
|
|
155
|
+
function y(e, t) {
|
|
156
|
+
let n = p(e), r = n.get(t);
|
|
157
|
+
if (r) return r.promise;
|
|
158
|
+
let i = Promise.resolve(e(t)).then((e) => {
|
|
159
|
+
let r = n.get(t);
|
|
160
|
+
return r && (r.node = e, r.settled = !0), e;
|
|
161
|
+
}, (e) => {
|
|
162
|
+
throw n.delete(t), e;
|
|
163
|
+
});
|
|
164
|
+
if (n.set(t, {
|
|
165
|
+
promise: i,
|
|
166
|
+
settled: !1
|
|
167
|
+
}), n.size > d) {
|
|
168
|
+
let e = n.keys().next().value;
|
|
169
|
+
e !== void 0 && e !== t && n.delete(e);
|
|
170
|
+
}
|
|
171
|
+
return i;
|
|
172
|
+
}
|
|
130
173
|
//#endregion
|
|
131
|
-
export {
|
|
174
|
+
export { c as a, s as c, y as i, i as l, g as n, u as o, v as r, a as s, _ as t, r as u };
|
|
132
175
|
|
|
133
|
-
//# sourceMappingURL=
|
|
176
|
+
//# sourceMappingURL=embed-cache-CcBfVrc9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-cache-CcBfVrc9.js","names":[],"sources":["../src/styles/stylo.module.css","../src/wikilink.ts","../src/frontmatter.ts","../src/editor/highlight.ts","../src/render/embed-cache.ts"],"sourcesContent":[".root {\n display: flex;\n flex-direction: column;\n min-height: 0;\n color: var(--stylo-text);\n background: var(--stylo-bg);\n border: 1px solid var(--stylo-border);\n border-radius: var(--stylo-radius);\n overflow: hidden;\n}\n\n/* The editing surface's own scroll container (source, in-place, and the source\n pane of split all resolve to `.cm-scroller`). Thin, token-tinted bars so the\n editor doesn't fall back to a heavier native scrollbar than the app chrome\n around it. A host's own `.cm-scroller` rules load after and win. */\n.root :global(.cm-scroller) {\n scrollbar-width: thin;\n scrollbar-color: color-mix(in srgb, var(--stylo-border) 90%, transparent) transparent;\n}\n\n.root :global(.cm-scroller)::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n}\n\n.root :global(.cm-scroller)::-webkit-scrollbar-thumb {\n border: 3px solid transparent;\n border-radius: 6px;\n background: color-mix(in srgb, var(--stylo-border) 90%, transparent);\n background-clip: padding-box;\n}\n\n.root :global(.cm-scroller)::-webkit-scrollbar-thumb:hover {\n background: color-mix(in srgb, var(--stylo-text-muted) 55%, transparent);\n background-clip: padding-box;\n}\n\n.root :global(.cm-scroller)::-webkit-scrollbar-corner {\n background: transparent;\n}\n\n.source {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n}\n\n.source :global(.cm-editor) {\n height: 100%;\n}\n\n.source :global(.cm-editor.cm-focused) {\n outline: 2px solid var(--stylo-ring);\n outline-offset: -2px;\n}\n\n.inplace {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n}\n\n.toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 2px;\n padding: 4px 6px;\n background: var(--stylo-bg);\n border-bottom: 1px solid var(--stylo-border);\n}\n\n/* One flex child per `\"|\"`-delimited run of items, so `.toolbar`'s wrap\n breaks between groups instead of inside one. */\n.toolbarGroup {\n display: flex;\n align-items: center;\n gap: 2px;\n}\n\n.toolbarButton {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 28px;\n height: 28px;\n padding: 0 5px;\n border: 0;\n border-radius: calc(var(--stylo-radius) - 3px);\n background: none;\n color: var(--stylo-text-muted);\n font: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n}\n\n.toolbarButton:hover:not(:disabled) {\n background: color-mix(in srgb, var(--stylo-border) 45%, transparent);\n color: var(--stylo-text);\n}\n\n.toolbarButton[data-active] {\n background: color-mix(in srgb, var(--stylo-accent) 12%, transparent);\n color: var(--stylo-text);\n}\n\n.toolbarButton:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n.toolbarButton:focus-visible {\n outline: 2px solid var(--stylo-ring);\n outline-offset: -2px;\n}\n\n.toolbarButton svg {\n display: block;\n width: 16px;\n height: 16px;\n}\n\n/* Text glyphs that stand in for an icon (e.g. `fm`) — monospace to read as syntax. */\n.toolbarButton code {\n font-family: var(\n --stylo-font-family-mono,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace\n );\n font-size: 0.8125rem;\n font-weight: 500;\n}\n\n.toolbarSep {\n align-self: stretch;\n width: 1px;\n margin: 4px 3px;\n background: var(--stylo-border);\n}\n\n/* `toolbar={{ sticky: \"top\" | \"bottom\" | true }}` — pins the bar to an edge\n instead of wherever `<Stylo>` sits on the page. One row, no wrapping: it\n scrolls horizontally instead, and its buttons grow to a comfortable touch\n size. Shared by both edges; `.toolbarStickyTop` / `.toolbarStickyBottom`\n below pick the positioning mechanism and the edge itself. */\n.toolbarSticky {\n z-index: 50;\n flex-wrap: nowrap;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: none;\n transition: opacity 0.15s ease;\n /* The base `.toolbar` deliberately leaves font-family to inherit from\n wherever the host mounts `<Stylo>`. Both sticky edges are\n `position: fixed` against the window, so neither can safely lean on\n that — the prose-font token (or its default stack) instead of the\n browser's serif default. */\n font-family: var(\n --stylo-font-family,\n -apple-system,\n BlinkMacSystemFont,\n \"Segoe UI\",\n Roboto,\n Helvetica,\n Arial,\n sans-serif\n );\n}\n\n.toolbarSticky::-webkit-scrollbar {\n display: none;\n}\n\n.toolbarSticky .toolbarButton {\n min-width: 40px;\n height: 40px;\n flex: 0 0 auto;\n}\n\n/* `\"bottom\"` (or `true`) — has to be `position: fixed`: nothing about a\n mobile keyboard opening is a \"scroll\", so `position: sticky` has nothing to\n react to. Toolbar.tsx nudges it up from `bottom: 0` with\n `transform: translateY()`, tracking `useKeyboardInset`. */\n.toolbarStickyBottom {\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: none;\n border-top: 1px solid var(--stylo-border);\n box-shadow: 0 -2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);\n}\n\n/* `\"top\"` — `position: fixed`, always pinned rather than waiting for a scroll\n threshold like `\"bottom\"`. Nothing ever eats into the top of the screen, so\n there's no keyboard to react to and no accessory bar to collide with — the\n two problems `\"bottom\"` has. `Toolbar.tsx`'s `useFloatingWatchdog` (a\n `requestAnimationFrame` loop, not CSS) is what actually keeps it visible on\n iOS Safari: earlier rounds tried a static `translateZ(0)`, then real\n `position: sticky`, and the disappear-on-scroll bug outlived both — a value\n that's set once and never re-touched gives the browser's compositor nothing\n to recompute if it drifts, so the watchdog re-asserts a `transform` every\n frame instead of trusting a one-time fix to hold. */\n.toolbarStickyTop {\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n box-shadow: 0 2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);\n}\n\n/* `stickyVisibility: \"dynamic\"` — faded out while nothing is focused. */\n.toolbarStickyHidden {\n opacity: 0;\n pointer-events: none;\n}\n\n/* `\"bottom\"` is `position: fixed`, out of flow entirely — reserve its resting\n height so it doesn't sit over the document's last line. Static, not\n keyboard-aware: while the keyboard is open the bar rides up to meet it (see\n `useKeyboardInset`), but the browser's own scroll-into-view around the\n caret is what keeps typing visible above both — this padding only covers\n the keyboard-closed resting state. */\n.stickyToolbarRootBottom .source,\n.stickyToolbarRootBottom .inplace {\n padding-bottom: 52px;\n}\n\n.stickyToolbarRootTop .source,\n.stickyToolbarRootTop .inplace {\n padding-top: 52px;\n}\n\n.inplace :global(.cm-editor) {\n height: 100%;\n}\n\n.inplace :global(.cm-editor.cm-focused) {\n outline: 2px solid var(--stylo-ring);\n outline-offset: -2px;\n}\n\n.split {\n display: grid;\n grid-template-columns: 1fr 1fr;\n flex: 1;\n min-height: 0;\n}\n\n.splitPane {\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow: auto;\n box-sizing: border-box;\n}\n\n.splitPane + .splitPane {\n border-left: 1px solid var(--stylo-border);\n}\n\n.splitPane > .source {\n flex: 1;\n min-height: 0;\n}\n\n/* Vertical rhythm follows Tailwind's `prose` (@tailwindcss/typography) as a\n visual reference — the em-based scale only, no plugin bundled. Consumer CSS\n wins: `.stylo p`, `.stylo h2`, … load after and match our specificity.\n `font-size` is the one base every descendant rule below sizes itself off of\n in `em`, so deriving it from `--stylo-font-size` (the same token the\n in-place canvas uses, ADR-002 §3) cascades the whole scale — no other rule\n needs touching. `padding` is `em`, not a fixed `rem`, for the same reason:\n it tracks the base font size instead of going visually oversized against a\n host-set smaller one. */\n.preview {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n padding: 0.8em 1.0666667em;\n font-size: var(--stylo-font-size, 0.9375rem);\n line-height: 1.75;\n overflow-wrap: break-word;\n}\n\n.preview > :first-child {\n margin-top: 0;\n}\n\n.preview > :last-child {\n margin-bottom: 0;\n}\n\n.preview :is(h1, h2, h3, h4, h5, h6) {\n font-weight: 600;\n}\n\n.preview h1 {\n margin: 0 0 0.8888889em;\n font-size: var(--stylo-rhythm-h1-size, 2.25em);\n line-height: var(--stylo-rhythm-h1-line, 1.1111111);\n}\n\n.preview h2 {\n margin: 2em 0 1em;\n font-size: var(--stylo-rhythm-h2-size, 1.5em);\n line-height: var(--stylo-rhythm-h2-line, 1.3333333);\n}\n\n.preview h3 {\n margin: 1.6em 0 0.6em;\n font-size: var(--stylo-rhythm-h3-size, 1.25em);\n line-height: var(--stylo-rhythm-h3-line, 1.6);\n}\n\n/* h4/h5/h6 share a margin and line-height, but each needs its own font-size —\n previously unset here, so h5/h6 silently fell back to the browser's UA\n default instead of matching the in-place canvas (2026-09-13). */\n.preview :is(h4, h5, h6) {\n margin: 1.5em 0 0.5em;\n line-height: var(--stylo-rhythm-h4-line, 1.5);\n}\n\n.preview h4 {\n font-size: var(--stylo-rhythm-h4-size, 1em);\n}\n\n.preview h5 {\n font-size: var(--stylo-rhythm-h5-size, 0.9em);\n}\n\n.preview h6 {\n font-size: var(--stylo-rhythm-h6-size, 0.9em);\n}\n\n.preview p {\n margin: 1.25em 0;\n}\n\n.preview :is(ul, ol) {\n margin: 1.25em 0;\n padding-left: 1.625em;\n}\n\n.preview li {\n margin: var(--stylo-rhythm-list-item-gap, 0.5em) 0;\n}\n\n.preview li > :is(ul, ol) {\n margin: var(--stylo-rhythm-list-item-gap-nested, 0.75em) 0;\n}\n\n.preview a {\n color: var(--stylo-link);\n text-decoration: none;\n}\n\n.preview code {\n font-family: var(\n --stylo-font-family-mono,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace\n );\n font-size: 0.9em;\n padding: 0.1em 0.35em;\n border-radius: calc(var(--stylo-radius) - 3px);\n background: color-mix(in srgb, var(--stylo-border) 45%, transparent);\n}\n\n.preview pre {\n margin: 1.7142857em 0;\n padding: 0.75rem 0.9rem;\n border-radius: var(--stylo-radius);\n background: color-mix(in srgb, var(--stylo-border) 35%, transparent);\n overflow-x: auto;\n white-space: var(--stylo-preview-code-white-space, pre-wrap);\n overflow-wrap: break-word;\n}\n\n.preview pre code {\n padding: 0;\n font-size: 0.85em;\n background: none;\n}\n\n/* Fenced-code token colours — the `preview` counterpart to `src/editor/highlight.ts`'s\n `styloHighlightStyle`. Both read the same `SYNTAX_TAG_GROUPS` list and the same\n `--stylo-syntax-*` tokens; these are plain global classes (rather than a mounted\n CodeMirror `StyleModule`) because `highlightCode.ts` walks a Lezer tree outside of\n any `EditorView`. Keep this list in sync with `SYNTAX_TAG_GROUPS` in `highlight.ts`. */\n:global(.stylo-tok-keyword) {\n color: var(--stylo-syntax-keyword);\n}\n:global(.stylo-tok-string) {\n color: var(--stylo-syntax-string);\n}\n:global(.stylo-tok-escape) {\n color: var(--stylo-syntax-escape);\n}\n:global(.stylo-tok-comment) {\n color: var(--stylo-syntax-comment);\n font-style: italic;\n}\n:global(.stylo-tok-number) {\n color: var(--stylo-syntax-number);\n}\n:global(.stylo-tok-constant) {\n color: var(--stylo-syntax-constant);\n}\n:global(.stylo-tok-function) {\n color: var(--stylo-syntax-function);\n}\n:global(.stylo-tok-type) {\n color: var(--stylo-syntax-type);\n}\n:global(.stylo-tok-property) {\n color: var(--stylo-syntax-property);\n}\n:global(.stylo-tok-tag) {\n color: var(--stylo-syntax-tag);\n}\n:global(.stylo-tok-meta) {\n color: var(--stylo-syntax-comment);\n}\n:global(.stylo-tok-invalid) {\n color: var(--stylo-syntax-invalid);\n}\n\n/* frontmatter=\"code\": the raw `---` block, recessed. `.stylo-frontmatter` is a\n plain (unscoped) class so a consumer's own CSS overrides it at equal\n specificity — restyle the block, or rename / remove the label:\n .stylo-frontmatter::before { content: \"Meta\" }\n .stylo-frontmatter::before { content: none } */\n:global(.stylo-frontmatter) {\n margin: 0 0 1.2em;\n padding: 0.7rem 0.9rem;\n border-left: 3px solid var(--stylo-border);\n border-radius: calc(var(--stylo-radius) - 3px);\n background: color-mix(in srgb, var(--stylo-border) 22%, transparent);\n color: var(--stylo-text-muted);\n font-family: var(\n --stylo-font-family-mono,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Consolas,\n monospace\n );\n font-size: 0.8125rem;\n line-height: 1.5;\n white-space: pre-wrap;\n overflow-x: auto;\n}\n\n:global(.stylo-frontmatter)::before {\n content: \"Frontmatter\";\n display: block;\n margin-bottom: 0.5em;\n font-family: var(\n --stylo-font-family,\n -apple-system,\n BlinkMacSystemFont,\n \"Segoe UI\",\n Roboto,\n Helvetica,\n Arial,\n sans-serif\n );\n font-size: 0.7rem;\n font-weight: 600;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n}\n\n.preview blockquote {\n margin: 1.6em 0;\n padding-left: 1em;\n border-left: 0.25rem solid var(--stylo-border);\n color: var(--stylo-text-muted);\n}\n\n/* Obsidian callouts (`> [!note]`) — mirrors the in-place canvas. `remark-callout`\n adds `stylo-callout stylo-callout-<bucket>` + `data-callout`. Override\n `--stylo-callout-<bucket>` (or `--stylo-callout-accent` per type) to reskin. */\n.preview :global(.stylo-callout) {\n margin: 1.6em 0;\n padding: var(--stylo-rhythm-callout-padding-y, 0.7em) var(--stylo-rhythm-callout-padding-x, 1rem);\n border-left: 0.25rem solid var(--stylo-callout-accent, var(--stylo-border));\n /* Right corners only, matching the in-place canvas: its callout is built\n from several stacked lines carrying their own border-left, so its left\n edge can't be rounded either — round preview's the same way rather than\n the two surfaces drawing a different shape (2026-09-13). */\n border-top-right-radius: var(--stylo-radius);\n border-bottom-right-radius: var(--stylo-radius);\n background: color-mix(in srgb, var(--stylo-callout-accent, var(--stylo-border)) 10%, transparent);\n color: var(--stylo-text);\n}\n.preview :global(.stylo-callout)::before {\n content: attr(data-callout);\n display: block;\n margin-bottom: 0.2em;\n font-size: 0.8em;\n font-weight: 700;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--stylo-callout-accent, var(--stylo-text-muted));\n}\n.preview :global(.stylo-callout-note) {\n --stylo-callout-accent: var(--stylo-callout-note, #3b82f6);\n}\n.preview :global(.stylo-callout-tip) {\n --stylo-callout-accent: var(--stylo-callout-tip, #22c55e);\n}\n.preview :global(.stylo-callout-warn) {\n --stylo-callout-accent: var(--stylo-callout-warn, #f59e0b);\n}\n.preview :global(.stylo-callout-danger) {\n --stylo-callout-accent: var(--stylo-callout-danger, #ef4444);\n}\n.preview :global(.stylo-callout-example) {\n --stylo-callout-accent: var(--stylo-callout-example, #a855f7);\n}\n\n/* `![[embed]]` transclusion. `remark-embed` swaps a lone-`![[ref]]` paragraph\n for `<div class=\"stylo-embed\">`, and `Embed` nests the host-rendered content\n in `.stylo-embed-content`. Both classes are stable override points; set\n `--stylo-embed-accent` to reskin the rail, or zero the padding / border to\n opt out of the frame entirely. */\n.preview :global(.stylo-embed) {\n margin: 1.6em 0;\n padding-left: 1em;\n border-left: 0.25rem solid var(--stylo-embed-accent, var(--stylo-border));\n}\n.preview :global(.stylo-embed-content) > :first-child {\n margin-top: 0;\n}\n.preview :global(.stylo-embed-content) > :last-child {\n margin-bottom: 0;\n}\n\n/* A GFM table renders wrapped in `<div class=\"stylo-table-wrap\">`, which\n carries the block/scroll behaviour a table wider than its column needs —\n `display: block` directly on `<table>` disables its own table-layout\n algorithm entirely (the rendered grid then sizes to its content,\n independent of the outer box's width), so a host's `width: 100%` on the\n table itself would only ever stretch a box disconnected from the grid it's\n trying to resize. `.stylo-table-wrap` is a stable override point, matching\n `.cm-inplace-table-wrap` on the in-place canvas. */\n.preview :global(.stylo-table-wrap) {\n display: block;\n margin: 2em 0;\n overflow-x: auto;\n}\n\n.preview table {\n border-collapse: collapse;\n}\n\n.preview :is(th, td) {\n padding: 0.35em 0.6em;\n border: 1px solid var(--stylo-table-border);\n text-align: left;\n}\n\n.preview thead th {\n background: var(--stylo-table-header-bg);\n font-weight: 600;\n}\n\n/* Opt-in zebra striping — no-op until the host sets `--stylo-table-stripe-bg`. */\n.preview tbody tr:nth-child(even) td {\n background: var(--stylo-table-stripe-bg);\n}\n\n/* prose sets `hr { margin: 3em 0 }`, which reads as a page break, not a rule.\n GitHub / VS Code render it tight; `1em` each side matches that. */\n.preview hr {\n margin: 1em 0;\n border: none;\n border-top: 1px solid var(--stylo-border);\n}\n\n.preview :global(.katex-display) {\n padding: 0.25em 0;\n overflow-x: auto;\n overflow-y: hidden;\n}\n","/**\n * `[[target]]` or `[[target|label]]`. Capture group 1 is the target, group 2 the\n * optional display label. The `g` flag is set for `matchAll` / `exec` loops;\n * callers that keep the regex across calls must reset `lastIndex` (or use\n * `matchAll`, which is stateless).\n *\n * Single source of truth for both the render-side plugin (`remark-wikilink`) and\n * the in-place decoration scanner, so the two never drift.\n */\nexport const WIKILINK_PATTERN = /\\[\\[([^\\]|\\n]+?)(?:\\|([^\\]\\n]+?))?\\]\\]/g\n","import type { Text } from \"@codemirror/state\"\n\n/**\n * The leading `---` … `---` YAML block, if present. The CodeMirror Markdown\n * grammar has no frontmatter node — it parses the fences as two thematic breaks\n * — so the region is located by hand. Shared by the in-place decoration layer\n * and the toolbar's frontmatter command.\n */\nexport function frontmatterRange(doc: Text): { from: number; to: number } | null {\n if (doc.lines < 2 || doc.line(1).text.trim() !== \"---\") return null\n for (let n = 2; n <= doc.lines; n++) {\n if (doc.line(n).text.trim() === \"---\") return { from: 0, to: doc.line(n).to }\n }\n return null\n}\n\nconst FRONTMATTER_BLOCK = /^[ \\t]*---[ \\t]*\\r?\\n(?:([\\s\\S]*?)\\r?\\n)?[ \\t]*---[ \\t]*(?:\\r?\\n|$)/\n\n/**\n * Split a leading `---` … `---` block off a Markdown string. `frontmatter` is\n * the inner text (`\"\"` for an empty block); `body` is everything after the\n * closing fence. Used by `preview` to render the block instead of dropping it.\n */\nexport function splitFrontmatter(md: string): { frontmatter: string; body: string } | null {\n const m = FRONTMATTER_BLOCK.exec(md)\n return m ? { frontmatter: m[1] ?? \"\", body: md.slice(m[0].length) } : null\n}\n","import { HighlightStyle, syntaxHighlighting } from \"@codemirror/language\"\nimport { tags as t, type Tag } from \"@lezer/highlight\"\n\n/**\n * One row per `--stylo-syntax-*` token: which Lezer tags map to it, and\n * whether it reads italic. This is the single source of truth for fenced-code\n * colour — `styloHighlightStyle` below builds the live CodeMirror extension\n * from it, and `src/render/highlightCode.ts` builds `preview`'s tree-walking\n * highlighter (a `tagHighlighter` emitting `stylo-tok-<token>` classes,\n * styled in `stylo.module.css`) from the same list, so both surfaces agree by\n * construction rather than by two hand-kept mappings staying in sync.\n *\n * `token` doubles as the `--stylo-syntax-<token>` suffix and the\n * `stylo-tok-<token>` class suffix. `meta` shares its colour with `comment`\n * but isn't italic, so it gets its own row rather than merging into it.\n */\nexport interface SyntaxTagGroup {\n token: string\n tags: Tag[]\n italic?: boolean\n}\n\nexport const SYNTAX_TAG_GROUPS: SyntaxTagGroup[] = [\n {\n token: \"keyword\",\n tags: [\n t.keyword,\n t.modifier,\n t.controlKeyword,\n t.operatorKeyword,\n t.definitionKeyword,\n t.moduleKeyword,\n ],\n },\n { token: \"string\", tags: [t.string, t.special(t.string), t.regexp, t.attributeValue] },\n { token: \"escape\", tags: [t.escape, t.character] },\n {\n token: \"comment\",\n tags: [t.comment, t.lineComment, t.blockComment, t.docComment],\n italic: true,\n },\n { token: \"number\", tags: [t.number, t.integer, t.float] },\n { token: \"constant\", tags: [t.bool, t.null, t.atom, t.constant(t.name)] },\n {\n token: \"function\",\n tags: [t.function(t.variableName), t.function(t.propertyName), t.macroName],\n },\n { token: \"type\", tags: [t.typeName, t.className, t.namespace] },\n { token: \"property\", tags: [t.propertyName, t.attributeName] },\n { token: \"tag\", tags: [t.tagName] },\n { token: \"meta\", tags: [t.meta, t.annotation] },\n { token: \"invalid\", tags: [t.invalid] },\n]\n\n/**\n * Token colours for fenced code and any other embedded-language grammar.\n *\n * Every colour resolves to a `--stylo-syntax-*` custom property, so the host\n * restyles code the same way as the rest of the `--stylo-*` palette; the values\n * in `tokens.css` are the defaults. Both `@codemirror/language` and\n * `@lezer/highlight` are already transitive dependencies of\n * `@codemirror/lang-markdown`, so this adds no package weight.\n *\n * Markdown's own structural tokens (heading marks, emphasis markers, link\n * brackets) are deliberately left undefined: the in-place canvas styles those\n * with decorations, and `source` mode keeps its plain, un-tinted look. Only\n * tokens that come from a real programming-language parser get a colour.\n */\nexport const styloHighlightStyle = HighlightStyle.define(\n SYNTAX_TAG_GROUPS.map(({ tags, token, italic }) => ({\n tag: tags,\n color: `var(--stylo-syntax-${token === \"meta\" ? \"comment\" : token})`,\n ...(italic ? { fontStyle: \"italic\" } : {}),\n })),\n)\n\n/** The highlight style wrapped as an editor extension. */\nexport const styloHighlighting = syntaxHighlighting(styloHighlightStyle)\n","import type { ReactNode } from \"react\"\nimport type { EmbedSource } from \"../types\"\n\n/**\n * A process-wide resolution cache for `![[ref]]` embeds, shared by `preview` and\n * the in-place canvas (both render through `Embed`). Without it, an embed\n * scrolled out of the canvas viewport and back — or a `preview` re-render that\n * remounts the subtree — re-invokes `embedSource`, which for a network-backed\n * source is a refetch each time.\n *\n * Keyed first by the `embedSource` identity (a `WeakMap`, so two editors with\n * different resolvers never collide and a changed `embedSource` drops its cache\n * for free — the type doc already asks consumers to keep the reference stable),\n * then by the raw `ref` string.\n *\n * In-flight promises are shared, so two embeds of the same `ref` mounting\n * together call `embedSource` once. A rejection is **not** cached — the next\n * mount retries. `null` (the host chose to keep the reference literal) is a\n * valid cached value; `settled` tells it apart from an absent entry.\n *\n * The cache has no TTL and never re-checks a settled entry on its own — see\n * {@link invalidateEmbed} for the host-triggered way to drop one when the\n * content behind a reference actually changes, exposed publicly as\n * `StyloHandle.invalidateEmbed`.\n */\n\ninterface Entry {\n promise: Promise<ReactNode>\n node?: ReactNode\n settled: boolean\n}\n\n/** Distinct `ref`s kept per resolver. Eviction only costs a re-resolve. */\nconst MAX_ENTRIES = 64\n\nconst caches = new WeakMap<EmbedSource, Map<string, Entry>>()\n\nfunction bucket(source: EmbedSource): Map<string, Entry> {\n let m = caches.get(source)\n if (!m) {\n m = new Map()\n caches.set(source, m)\n }\n return m\n}\n\n/** Mounted `Embed`s waiting to hear that their own `(source, ref)` was\n * invalidated, so they can re-resolve without waiting for a remount. */\nconst listeners = new WeakMap<EmbedSource, Map<string, Set<() => void>>>()\n\nfunction listenerSet(source: EmbedSource, ref: string): Set<() => void> {\n let bySource = listeners.get(source)\n if (!bySource) {\n bySource = new Map()\n listeners.set(source, bySource)\n }\n let set = bySource.get(ref)\n if (!set) {\n set = new Set()\n bySource.set(ref, set)\n }\n return set\n}\n\n/** Notified whenever `ref` is invalidated for `source` (see {@link invalidateEmbed}).\n * Returns an unsubscribe function. */\nexport function onEmbedInvalidated(source: EmbedSource, ref: string, listener: () => void) {\n const set = listenerSet(source, ref)\n set.add(listener)\n return () => set.delete(listener)\n}\n\n/**\n * Drops the cached result for `ref` — or, with no `ref`, every entry for\n * `source` — so the next resolution re-invokes `embedSource` instead of\n * serving the stale answer. This is the escape hatch for the one case the\n * cache can't know about on its own: the content behind a reference changing\n * while the editor is open. Any `Embed` currently mounted for a dropped ref\n * re-resolves immediately via {@link onEmbedInvalidated}, rather than only on\n * its next mount.\n */\nexport function invalidateEmbed(source: EmbedSource, ref?: string): void {\n const m = caches.get(source)\n if (!m) return\n const refs = ref !== undefined ? [ref] : [...m.keys()]\n const bySource = listeners.get(source)\n for (const r of refs) {\n m.delete(r)\n bySource?.get(r)?.forEach((fn) => fn())\n }\n}\n\n/** A settled result for `ref`, or `undefined` while it is unresolved or absent. */\nexport function peekEmbed(source: EmbedSource, ref: string): { node: ReactNode } | undefined {\n const entry = bucket(source).get(ref)\n return entry?.settled ? { node: entry.node } : undefined\n}\n\n/** Resolve `ref` through the cache — reusing an in-flight or settled entry, or\n * calling `source` on a miss. */\nexport function resolveEmbed(source: EmbedSource, ref: string): Promise<ReactNode> {\n const m = bucket(source)\n const existing = m.get(ref)\n if (existing) return existing.promise\n\n const promise = Promise.resolve(source(ref)).then(\n (node) => {\n const entry = m.get(ref)\n if (entry) {\n entry.node = node\n entry.settled = true\n }\n return node\n },\n (err) => {\n m.delete(ref) // never cache a failure\n throw err\n },\n )\n m.set(ref, { promise, settled: false })\n\n // Insertion-order cap: drop the oldest distinct ref once over the limit.\n if (m.size > MAX_ENTRIES) {\n const oldest = m.keys().next().value\n if (oldest !== undefined && oldest !== ref) m.delete(oldest)\n }\n return promise\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { Extension } from "@codemirror/state";
|
|
2
3
|
import type { EditorView } from "@codemirror/view";
|
|
3
4
|
import type { CodeLanguages, EmbedSource, InPlaceConfig, ResolveErrorInfo, TagSource, WikiLinkSource } from "../types";
|
|
4
5
|
export interface InPlaceViewProps {
|
|
@@ -25,6 +26,8 @@ export interface InPlaceViewProps {
|
|
|
25
26
|
onSave?: (value: string) => void;
|
|
26
27
|
/** Called with the `EditorView` once created, and with `null` on teardown. */
|
|
27
28
|
onViewChange?: (view: EditorView | null) => void;
|
|
29
|
+
/** Host CodeMirror extensions, reconfigured in place when the array changes. */
|
|
30
|
+
hostExtensions?: readonly Extension[];
|
|
28
31
|
/** Host content docked after the search panel, before the document. Read once. */
|
|
29
32
|
canvasHeader?: (ctx: {
|
|
30
33
|
view: EditorView | null;
|
|
@@ -44,5 +47,5 @@ export interface InPlaceViewProps {
|
|
|
44
47
|
* `EmbedRegistry` and portals a host `<Embed>` into every live slot, so one
|
|
45
48
|
* React tree — reusing `Embed` verbatim — serves the canvas and `preview` alike.
|
|
46
49
|
*/
|
|
47
|
-
export declare function InPlaceView({ value, onChange, readOnly, placeholder, onWikiLinkClick, onLinkClick, inPlace, codeLanguages, wikiLinkSource, tagSource, embedSource, onResolveError, onSave, onViewChange, canvasHeader, }: InPlaceViewProps): import("react").JSX.Element;
|
|
50
|
+
export declare function InPlaceView({ value, onChange, readOnly, placeholder, onWikiLinkClick, onLinkClick, inPlace, codeLanguages, wikiLinkSource, tagSource, embedSource, onResolveError, onSave, onViewChange, canvasHeader, hostExtensions, }: InPlaceViewProps): import("react").JSX.Element;
|
|
48
51
|
//# sourceMappingURL=InPlaceView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InPlaceView.d.ts","sourceRoot":"","sources":["../../src/inplace/InPlaceView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,cAAc,EACf,MAAM,UAAU,CAAA;AAOjB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,qEAAqE;IACrE,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACjE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;IAChD,kFAAkF;IAClF,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;KAAE,KAAK,SAAS,CAAA;CAC/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EACX,cAAc,EACd,MAAM,EACN,YAAY,EACZ,YAAY,
|
|
1
|
+
{"version":3,"file":"InPlaceView.d.ts","sourceRoot":"","sources":["../../src/inplace/InPlaceView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,cAAc,EACf,MAAM,UAAU,CAAA;AAOjB,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,qEAAqE;IACrE,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACjE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;IAChD,gFAAgF;IAChF,cAAc,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;IACrC,kFAAkF;IAClF,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;KAAE,KAAK,SAAS,CAAA;CAC/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,OAAO,EACP,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EACX,cAAc,EACd,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE,gBAAgB,+BAsElB"}
|
|
@@ -16,10 +16,9 @@ export declare const PARA_HEADING_IDS: ToolbarCommandId[];
|
|
|
16
16
|
export declare const INSERT_INLINE_IDS: ToolbarCommandId[];
|
|
17
17
|
export declare const INSERT_BLOCK_IDS: ToolbarCommandId[];
|
|
18
18
|
/**
|
|
19
|
-
* `inCell`: the selection is a table cell's DOM range, not `state.selection
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* regardless, so force them live — same call the floating selection bar makes.
|
|
19
|
+
* `inCell`: the selection is a table cell's DOM range, not `state.selection`
|
|
20
|
+
* (collapsed here) — `resolveForCell` reads the real DOM focus instead, same
|
|
21
|
+
* as the toolbar does.
|
|
23
22
|
*/
|
|
24
23
|
export declare const toAction: (view: EditorView, id: ToolbarCommandId, inCell?: boolean) => MenuAction | null;
|
|
25
24
|
export declare const actions: (view: EditorView, ids: ToolbarCommandId[], dropDisabled?: boolean, inCell?: boolean) => MenuAction[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu-helpers.d.ts","sourceRoot":"","sources":["../../src/inplace/context-menu-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"context-menu-helpers.d.ts","sourceRoot":"","sources":["../../src/inplace/context-menu-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAKhD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEtE,4EAA4E;AAC5E,eAAO,MAAM,OAAO,OAAQ,gBAAgB,KAAG,MAAM,GAAG,SACyB,CAAA;AAEjF,4EAA4E;AAC5E,eAAO,MAAM,eAAe,EAAE,gBAAgB,EAAiC,CAAA;AAC/E,eAAO,MAAM,eAAe,EAAE,gBAAgB,EAAqB,CAAA;AACnE,eAAO,MAAM,aAAa,EAAE,gBAAgB,EAA0C,CAAA;AACtF,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAAuB,CAAA;AACtE,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAAoB,CAAA;AACpE,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAA8C,CAAA;AAE7F;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SACb,UAAU,MACZ,gBAAgB,uBAEnB,UAAU,GAAG,IAcf,CAAA;AAED,eAAO,MAAM,OAAO,SACZ,UAAU,OACX,gBAAgB,EAAE,+CAGtB,UAAU,EAOZ,CAAA;AAED,eAAO,MAAM,aAAa,SAAU,UAAU,KAAG,OAAO,EAgDvD,CAAA;AAED,eAAO,MAAM,OAAO,UACX,MAAM,QACP,MAAM,GAAG,SAAS,QAClB,OAAO,EAAE,yBAEd,WAAgD,CAAA;AAEnD,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,CAI/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../src/inplace/decorate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAelF,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,aAAa,CAAA;IAC1B,qFAAqF;IACrF,MAAM,EAAE,aAAa,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../src/inplace/decorate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAelF,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,aAAa,CAAA;IAC1B,qFAAqF;IACrF,MAAM,EAAE,aAAa,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,CAsErE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-line-prefix.d.ts","sourceRoot":"","sources":["../../src/inplace/edit-line-prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"edit-line-prefix.d.ts","sourceRoot":"","sources":["../../src/inplace/edit-line-prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,KAAK,OAAO,EAA2B,MAAM,kBAAkB,CAAA;AAwExE,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,EAAE,OAwB9B,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,SAEnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/inplace/embed.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAc,KAAK,aAAa,EAA0B,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/inplace/embed.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAc,KAAK,aAAa,EAA0B,MAAM,kBAAkB,CAAA;AAoHzF;;;GAGG;AACH,eAAO,MAAM,UAAU,2BAiBrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/inplace/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/inplace/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAyB7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAWrD,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,0EAA0E;IAC1E,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAWD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,cAAmB,GAAG,SAAS,CAyErE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-md.d.ts","sourceRoot":"","sources":["../../src/inplace/inline-md.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inline-md.d.ts","sourceRoot":"","sources":["../../src/inplace/inline-md.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,gBAAgB,CAI3E"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The right-click menu's link fields: `linkRow` (`[text](url)`) and
|
|
3
|
-
* `wikiLinkRow` (`[[target|label]]`).
|
|
3
|
+
* `wikiLinkRow` (`[[target|label]]`). Structurally identical — extract parts
|
|
4
|
+
* at the caret, return an Edit/Remove field if found, else fall back to an
|
|
5
|
+
* Add field — so both route through `linkFieldRow`, parameterized on exactly
|
|
6
|
+
* what differs (the extractor, labels, and insert syntax). Keeping this in
|
|
7
|
+
* one place means a fix (like the "swap the whole construct rather than
|
|
8
|
+
* nesting" change both once needed) can't land in only one of the two again.
|
|
4
9
|
*/
|
|
5
10
|
import type { EditorView } from "@codemirror/view";
|
|
6
11
|
import type { MenuField } from "./context-menu";
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* (or the word the menu just selected) on submit.
|
|
12
|
-
*/
|
|
12
|
+
/** The "Add external link" row — an editable `[text](url)` URL field. Prefilled,
|
|
13
|
+
* with Open / Remove and the label "Edit external link", when the caret sits in
|
|
14
|
+
* an existing `[text](url)`; otherwise an empty field that wraps the selection
|
|
15
|
+
* (or the word the menu just selected) on submit. */
|
|
13
16
|
export declare function linkRow(view: EditorView): MenuField;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* selection (or the word the menu just selected) on submit.
|
|
19
|
-
*/
|
|
17
|
+
/** The "Add link" row — an editable `[[target]]` field for an internal link.
|
|
18
|
+
* Prefilled, with Remove and the label "Edit link", when the caret sits in an
|
|
19
|
+
* existing `[[target|label]]`; otherwise an empty field that wraps the
|
|
20
|
+
* selection (or the word the menu just selected) on submit. */
|
|
20
21
|
export declare function wikiLinkRow(view: EditorView): MenuField;
|
|
21
22
|
//# sourceMappingURL=link-row.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-row.d.ts","sourceRoot":"","sources":["../../src/inplace/link-row.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"link-row.d.ts","sourceRoot":"","sources":["../../src/inplace/link-row.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAiK3D;;;sDAGsD;AACtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAEnD;AAED;;;gEAGgE;AAChE,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-guides.d.ts","sourceRoot":"","sources":["../../src/inplace/list-guides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAWlC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,
|
|
1
|
+
{"version":3,"file":"list-guides.d.ts","sourceRoot":"","sources":["../../src/inplace/list-guides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAWlC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,CAiDN"}
|
package/dist/inplace/math.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Range, StateField } from "@codemirror/state";
|
|
2
2
|
import { Decoration, type DecorationSet, EditorView } from "@codemirror/view";
|
|
3
3
|
import { type Tree } from "./scan";
|
|
4
|
+
export declare const INLINE_MATH: RegExp;
|
|
4
5
|
export interface MathAt {
|
|
5
6
|
from: number;
|
|
6
7
|
to: number;
|
|
@@ -18,11 +19,25 @@ export declare function mathAtIn(text: string, head: number): MathAt | null;
|
|
|
18
19
|
* no math node. Off-caret matches become KaTeX widgets. Multi-line `$$` blocks
|
|
19
20
|
* are handled by `blockMathField` instead (a plugin may not replace line breaks).
|
|
20
21
|
*/
|
|
21
|
-
export declare function scanInlineMath(view: EditorView, from: number, to: number, revealed: Set<number>, tree: Tree, out: Range<Decoration>[]): void;
|
|
22
|
+
export declare function scanInlineMath(view: EditorView, from: number, to: number, text: string, revealed: Set<number>, tree: Tree, out: Range<Decoration>[]): void;
|
|
23
|
+
interface BlockMathState {
|
|
24
|
+
decorations: DecorationSet;
|
|
25
|
+
/** Every `$$…$$` block's `[from, to)`, whether or not it's currently
|
|
26
|
+
* revealed — a revealed block has no decoration to check against, so this
|
|
27
|
+
* is what lets a selection-only transaction tell whether the caret just
|
|
28
|
+
* entered or left one without re-scanning the whole document to find out. */
|
|
29
|
+
ranges: {
|
|
30
|
+
from: number;
|
|
31
|
+
to: number;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
22
34
|
/**
|
|
23
35
|
* Multi-line `$$…$$` blocks, whose delimiters sit alone on their own lines.
|
|
24
36
|
* A state field (not a plugin) because the replacement spans line breaks. Not
|
|
25
|
-
* viewport-scoped — the whole document is scanned
|
|
37
|
+
* viewport-scoped — the whole document is scanned on a doc change, but `$$`
|
|
38
|
+
* blocks are few and a pure caret move reuses the last build's `ranges`
|
|
39
|
+
* instead of rescanning.
|
|
26
40
|
*/
|
|
27
|
-
export declare const blockMathField: StateField<
|
|
41
|
+
export declare const blockMathField: StateField<BlockMathState>;
|
|
42
|
+
export {};
|
|
28
43
|
//# sourceMappingURL=math.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/inplace/math.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,UAAU,EAAc,MAAM,kBAAkB,CAAA;AAIzF,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/inplace/math.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,UAAU,EAAc,MAAM,kBAAkB,CAAA;AAIzF,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;AAGhE,eAAO,MAAM,WAAW,QAAoD,CAAA;AAI5E,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYlE;AA8BD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,CAwBN;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,aAAa,CAAA;IAC1B;;;kFAG8E;IAC9E,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CACvC;AAsBD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4BAczB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { EditorView } from "@codemirror/view";
|
|
2
|
+
/** What {@link handleTableKey} needs from `EditableTableWidget`, decoupled the
|
|
3
|
+
* same way `table-gizmos.ts` is — a small callback interface rather than a
|
|
4
|
+
* direct dependency on the widget class. */
|
|
5
|
+
export interface TableKeysHost {
|
|
6
|
+
/** Row/col of `cell`, from its dataset. */
|
|
7
|
+
coords: (cell: HTMLTableCellElement) => {
|
|
8
|
+
r: number;
|
|
9
|
+
c: number;
|
|
10
|
+
};
|
|
11
|
+
rows: () => number;
|
|
12
|
+
cols: () => number;
|
|
13
|
+
/** The cell at (r, c), or `null` when out of range or not mounted. */
|
|
14
|
+
cellAt: (r: number, c: number) => HTMLTableCellElement | null;
|
|
15
|
+
/** Raw source text of the cell at (r, c) — its length lands the caret at
|
|
16
|
+
* the far edge when arrowing into a cell from the right. */
|
|
17
|
+
cellText: (r: number, c: number) => string;
|
|
18
|
+
/** Append a blank row at the bottom and re-render. */
|
|
19
|
+
appendRow: () => void;
|
|
20
|
+
/** Serialize the current grid into the document. */
|
|
21
|
+
sync: (view: EditorView) => void;
|
|
22
|
+
/** The table's current `[from, to)` in the document. */
|
|
23
|
+
bounds: (view: EditorView) => {
|
|
24
|
+
from: number;
|
|
25
|
+
to: number;
|
|
26
|
+
};
|
|
27
|
+
/** The selection within the currently-editing cell, if any. */
|
|
28
|
+
readCaret: () => {
|
|
29
|
+
offset: number;
|
|
30
|
+
head: number;
|
|
31
|
+
} | null;
|
|
32
|
+
/** Bring `cell` into edit, with the caret at `offset` (from a keyboard move). */
|
|
33
|
+
enterCell: (cell: HTMLTableCellElement, offset: number) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Tab / Enter / Arrow handling for an editable table's cells: Tab and
|
|
37
|
+
* Shift-Tab walk the grid (Tab past the end adds a row); Enter drops to the
|
|
38
|
+
* cell below (adding a row at the bottom past the last one); the vertical
|
|
39
|
+
* arrows walk the column, carrying the caret's text offset along so a press
|
|
40
|
+
* feels continuous, and leave the table at the first/last row; the
|
|
41
|
+
* horizontal arrows cross into the neighbouring cell only from the text edge
|
|
42
|
+
* (mid-text, or with a range selected, the browser moves within the cell),
|
|
43
|
+
* and likewise leave the table at the first/last cell.
|
|
44
|
+
*/
|
|
45
|
+
export declare function handleTableKey(event: KeyboardEvent, view: EditorView, host: TableKeysHost): void;
|
|
46
|
+
//# sourceMappingURL=table-widget-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-widget-keys.d.ts","sourceRoot":"","sources":["../../src/inplace/table-widget-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;6CAE6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,MAAM,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAChE,IAAI,EAAE,MAAM,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,MAAM,CAAA;IAClB,sEAAsE;IACtE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,oBAAoB,GAAG,IAAI,CAAA;IAC7D;iEAC6D;IAC7D,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC1C,sDAAsD;IACtD,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,oDAAoD;IACpD,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IAChC,wDAAwD;IACxD,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1D,+DAA+D;IAC/D,SAAS,EAAE,MAAM;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACxD,iFAAiF;IACjF,SAAS,EAAE,CAAC,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAChE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CA+FhG"}
|
|
@@ -30,7 +30,6 @@ export declare class EditableTableWidget extends WidgetType {
|
|
|
30
30
|
private syncing;
|
|
31
31
|
/** Rendered-text offset from the mousedown that is bringing a cell into edit. */
|
|
32
32
|
private pendingOffset;
|
|
33
|
-
private current;
|
|
34
33
|
private gizmos;
|
|
35
34
|
private longPress;
|
|
36
35
|
/** When a long-press last opened the structural menu; a `contextmenu` the
|
|
@@ -68,7 +67,7 @@ export declare class EditableTableWidget extends WidgetType {
|
|
|
68
67
|
private finish;
|
|
69
68
|
private onFocusIn;
|
|
70
69
|
private onFocusOut;
|
|
71
|
-
/** The selection as (row, col,
|
|
70
|
+
/** The selection as (row, col, offset, head) within the editing cell. */
|
|
72
71
|
private readCaret;
|
|
73
72
|
private writeCaret;
|
|
74
73
|
/** Serialize `rows` into the document. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-widget.d.ts","sourceRoot":"","sources":["../../src/inplace/table-widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"table-widget.d.ts","sourceRoot":"","sources":["../../src/inplace/table-widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,KAAK,KAAK,EAAiB,MAAM,uBAAuB,CAAA;AAyBjE,6EAA6E;AAC7E,eAAO,MAAM,eAAe,qDAA+B,CAAA;AAE3D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;IAChB,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IAe/C,QAAQ,CAAC,IAAI,EAAE,WAAW;IAC1B,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM;IAhBzB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,OAAO,CAAQ;IACvB,iFAAiF;IACjF,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,SAAS,CAA+B;IAChD;;+CAE2C;IAC3C,OAAO,CAAC,WAAW,CAAI;IAEvB,YACW,IAAI,EAAE,WAAW;IAC1B,6EAA6E;IAC5D,MAAM,UAAQ,EAIhC;IAEQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,WAQrC;IAEQ,WAAW,YAEnB;IAED,OAAO,CAAC,IAAI;IAIZ;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,MAAM;IAId,+EAA+E;IAC/E,OAAO,CAAC,KAAK;IAIb,iEAAiE;IACjE,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,KAAK;IAIb,iFAAiF;IACjF,OAAO,CAAC,KAAK;IAsBb,wFAAwF;IACxF,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,UAAU;IAQlB,yEAAyE;IACzE,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,UAAU;IAKlB,0CAA0C;IAC1C,OAAO,CAAC,IAAI;IAyBZ,OAAO,CAAC,KAAK;IAmBb;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CASzC;IAED;2BACuB;IACvB,OAAO,CAAC,cAAc;IAetB,KAAK,CAAC,IAAI,EAAE,UAAU,kBA2ErB;IAEQ,OAAO,SAOf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/inplace/tables.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,UAAU,EAAa,MAAM,mBAAmB,CAAA;AACvF,OAAO,EAAc,KAAK,aAAa,EAA0B,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/inplace/tables.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,UAAU,EAAa,MAAM,mBAAmB,CAAA;AACvF,OAAO,EAAc,KAAK,aAAa,EAA0B,MAAM,kBAAkB,CAAA;AAkJzF;;;GAGG;AACH,eAAO,MAAM,UAAU,2BAqCrB,CAAA"}
|
|
@@ -6,5 +6,5 @@ import { type Tree } from "./scan";
|
|
|
6
6
|
* Collapses each match to its label and tags it with `data-stylo-wikilink`
|
|
7
7
|
* (the delegated click handler in `inPlaceExtension` reads that attribute).
|
|
8
8
|
*/
|
|
9
|
-
export declare function scanWikilinks(view: EditorView, from: number, to: number, revealed: Set<number>, tree: Tree, out: Range<Decoration>[]): void;
|
|
9
|
+
export declare function scanWikilinks(view: EditorView, from: number, to: number, text: string, revealed: Set<number>, tree: Tree, out: Range<Decoration>[]): void;
|
|
10
10
|
//# sourceMappingURL=wikilinks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wikilinks.d.ts","sourceRoot":"","sources":["../../src/inplace/wikilinks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG9D,OAAO,EAAiB,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;AAEjD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,
|
|
1
|
+
{"version":3,"file":"wikilinks.d.ts","sourceRoot":"","sources":["../../src/inplace/wikilinks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG9D,OAAO,EAAiB,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;AAEjD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GACvB,IAAI,CA6BN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Embed.d.ts","sourceRoot":"","sources":["../../src/render/Embed.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG7D,UAAU,UAAU;IAClB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,WAAW,CAAA;IACnB,wEAAwE;IACxE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAID;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,+
|
|
1
|
+
{"version":3,"file":"Embed.d.ts","sourceRoot":"","sources":["../../src/render/Embed.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG7D,UAAU,UAAU;IAClB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,WAAW,CAAA;IACnB,wEAAwE;IACxE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC1D;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAID;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,UAAU,+BA4DvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/render/Preview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/render/Preview.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACf,MAAM,UAAU,CAAA;AAQjB,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,mEAAmE;IACnE,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACjE,2FAA2F;IAC3F,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;CAC9C;AAED,qEAAqE;AACrE,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,eAAe,EACf,WAAW,EACX,cAAc,EACd,WAAsB,EACtB,aAAa,EACb,UAAU,EACV,YAAY,GACb,EAAE,YAAY,+BAqDd"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { EmbedSource } from "../types";
|
|
3
|
+
/** Notified whenever `ref` is invalidated for `source` (see {@link invalidateEmbed}).
|
|
4
|
+
* Returns an unsubscribe function. */
|
|
5
|
+
export declare function onEmbedInvalidated(source: EmbedSource, ref: string, listener: () => void): () => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Drops the cached result for `ref` — or, with no `ref`, every entry for
|
|
8
|
+
* `source` — so the next resolution re-invokes `embedSource` instead of
|
|
9
|
+
* serving the stale answer. This is the escape hatch for the one case the
|
|
10
|
+
* cache can't know about on its own: the content behind a reference changing
|
|
11
|
+
* while the editor is open. Any `Embed` currently mounted for a dropped ref
|
|
12
|
+
* re-resolves immediately via {@link onEmbedInvalidated}, rather than only on
|
|
13
|
+
* its next mount.
|
|
14
|
+
*/
|
|
15
|
+
export declare function invalidateEmbed(source: EmbedSource, ref?: string): void;
|
|
3
16
|
/** A settled result for `ref`, or `undefined` while it is unresolved or absent. */
|
|
4
17
|
export declare function peekEmbed(source: EmbedSource, ref: string): {
|
|
5
18
|
node: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-cache.d.ts","sourceRoot":"","sources":["../../src/render/embed-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"embed-cache.d.ts","sourceRoot":"","sources":["../../src/render/embed-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AA+D3C;uCACuC;AACvC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,iBAIxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CASvE;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAG3F;AAED;kCACkC;AAClC,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CA2BjF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Components } from "react-markdown";
|
|
2
|
+
import type { CodeLanguages, EmbedSource, ResolveErrorInfo, TaskToggleInfo } from "../types";
|
|
3
|
+
export interface PreviewComponentsOptions {
|
|
4
|
+
/** Read at click time, not baked into the closure — kept fresh across
|
|
5
|
+
* re-renders without forcing `buildPreviewComponents` itself to depend on
|
|
6
|
+
* `value` (which changes every keystroke and would defeat memoizing it). */
|
|
7
|
+
valueRef: {
|
|
8
|
+
current: string;
|
|
9
|
+
};
|
|
10
|
+
onWikiLinkClick?: (target: string) => void;
|
|
11
|
+
embedSource?: EmbedSource;
|
|
12
|
+
onResolveError?: (error: unknown, info: ResolveErrorInfo) => void;
|
|
13
|
+
codeLanguages?: CodeLanguages;
|
|
14
|
+
onTaskToggle?: (info: TaskToggleInfo) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Builds `react-markdown`'s `components` map for `Preview`: the wikilink
|
|
18
|
+
* click handler on `a`, the embed slots on `div` / `span`, the task-checkbox
|
|
19
|
+
* wiring on `li`, the table wrapper, and fenced-code highlighting.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildPreviewComponents({ valueRef, onWikiLinkClick, embedSource, onResolveError, codeLanguages, onTaskToggle, }: PreviewComponentsOptions): Components;
|
|
22
|
+
//# sourceMappingURL=preview-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-components.d.ts","sourceRoot":"","sources":["../../src/render/preview-components.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAK5F,MAAM,WAAW,wBAAwB;IACvC;;iFAE6E;IAC7E,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7B,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACjE,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;CAC9C;AAsBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,GACb,EAAE,wBAAwB,GAAG,UAAU,CAiGvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-wikilink.d.ts","sourceRoot":"","sources":["../../src/render/remark-wikilink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAQ,MAAM,OAAO,CAAA;AAI7C;;;;GAIG;AACH,wBAAgB,cAAc,WACd,IAAI,
|
|
1
|
+
{"version":3,"file":"remark-wikilink.d.ts","sourceRoot":"","sources":["../../src/render/remark-wikilink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAQ,MAAM,OAAO,CAAA;AAI7C;;;;GAIG;AACH,wBAAgB,cAAc,WACd,IAAI,UAqCnB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ChangeEvent, type ReactNode } from "react";
|
|
2
|
+
import type { TaskToggleInfo } from "../types";
|
|
1
3
|
/**
|
|
2
4
|
* Locates the exact `[ ]` / `[x]` substring of a task-list item within
|
|
3
5
|
* `value`, given the raw offset where the item itself starts (a GFM
|
|
@@ -10,4 +12,32 @@ export declare function findCheckboxOffsets(value: string, itemStart: number): {
|
|
|
10
12
|
start: number;
|
|
11
13
|
end: number;
|
|
12
14
|
} | null;
|
|
15
|
+
/**
|
|
16
|
+
* Builds the checkbox's `onChange` handler for a rendered `<li>`, or `null`
|
|
17
|
+
* when it isn't an eligible task item — not a task list item at all,
|
|
18
|
+
* `onTaskToggle` unset, no position data, or (a raw-edit race, effectively
|
|
19
|
+
* never) a marker `findCheckboxOffsets` can't locate.
|
|
20
|
+
*/
|
|
21
|
+
export declare function makeToggleHandler(node: {
|
|
22
|
+
position?: {
|
|
23
|
+
start: {
|
|
24
|
+
offset?: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
} | undefined, className: string | undefined, value: string, onTaskToggle: ((info: TaskToggleInfo) => void) | undefined): ((event: ChangeEvent<HTMLInputElement>) => void) | null;
|
|
28
|
+
/**
|
|
29
|
+
* A task item's checkbox `<input>` is always the leftmost leaf of its `<li>`
|
|
30
|
+
* — `mdast-util-to-hast` unshifts it onto the first paragraph, itself the
|
|
31
|
+
* first result, whether or not GFM kept that paragraph wrapped (a "loose"
|
|
32
|
+
* list, blank lines between items) or unwrapped it (a "tight" one). Walking
|
|
33
|
+
* only the first-child spine finds it either way without ever wandering into
|
|
34
|
+
* a nested sub-list's own checkbox, which lives as a later sibling, not a
|
|
35
|
+
* descendant of the first child.
|
|
36
|
+
*/
|
|
37
|
+
export declare function enableLeadingCheckbox(node: ReactNode, onChange: (event: ChangeEvent<HTMLInputElement>) => void): {
|
|
38
|
+
done: true;
|
|
39
|
+
node: ReactNode;
|
|
40
|
+
} | {
|
|
41
|
+
done: false;
|
|
42
|
+
};
|
|
13
43
|
//# sourceMappingURL=taskCheckbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskCheckbox.d.ts","sourceRoot":"","sources":["../../src/render/taskCheckbox.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taskCheckbox.d.ts","sourceRoot":"","sources":["../../src/render/taskCheckbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAW9C;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOvC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,GAAG,SAAS,EAC/D,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG,SAAS,GACzD,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CASzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,GACvD;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAsBnD"}
|