@damiro/stylo 0.16.0 → 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.
@@ -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, FrontmatterDisplay, ResolveErrorInfo, TagSource, TaskToggleInfo, WikiLinkSource } from "./types";
4
5
  export interface SplitViewProps {
@@ -19,6 +20,8 @@ export interface SplitViewProps {
19
20
  onSave?: (value: string) => void;
20
21
  /** Forwarded the source pane's `EditorView` for the shared toolbar. */
21
22
  onViewChange?: (view: EditorView | null) => void;
23
+ /** Host CodeMirror extensions for the source pane. */
24
+ hostExtensions?: readonly Extension[];
22
25
  /** Host content docked in the source pane, after its search panel. Read once. */
23
26
  canvasHeader?: (ctx: {
24
27
  view: EditorView | null;
@@ -30,5 +33,5 @@ export interface SplitViewProps {
30
33
  * Stylo root to have a bounded height — otherwise both panes grow and the page
31
34
  * scrolls instead.
32
35
  */
33
- export declare function SplitView({ value, onChange, onWikiLinkClick, readOnly, placeholder, codeLanguages, wikiLinkSource, tagSource, embedSource, onResolveError, frontmatter, softBreaks, onTaskToggle, onSave, onViewChange, canvasHeader, }: SplitViewProps): import("react").JSX.Element;
36
+ export declare function SplitView({ value, onChange, onWikiLinkClick, readOnly, placeholder, codeLanguages, wikiLinkSource, tagSource, embedSource, onResolveError, frontmatter, softBreaks, onTaskToggle, onSave, onViewChange, canvasHeader, hostExtensions, }: SplitViewProps): import("react").JSX.Element;
34
37
  //# sourceMappingURL=SplitView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SplitView.d.ts","sourceRoot":"","sources":["../src/SplitView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;A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GAAG,IAAI,KAAK,IAAI,CAAA;IAChD,sDAAsD;IACtD,cAAc,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;IACrC,iFAAiF;IACjF,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;KAAE,KAAK,SAAS,CAAA;CAC/D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE,cAAc,+BAsEhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Stylo.d.ts","sourceRoot":"","sources":["../src/Stylo.tsx"],"names":[],"mappings":"AAWA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAoB,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAExE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,oGAwMhB,CAAA"}
1
+ {"version":3,"file":"Stylo.d.ts","sourceRoot":"","sources":["../src/Stylo.tsx"],"names":[],"mappings":"AAWA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAoB,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAExE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,oGA4MhB,CAAA"}
@@ -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, ResolveErrorInfo, TagSource, WikiLinkSource } from "../types";
4
5
  export interface SourceViewProps {
@@ -18,11 +19,13 @@ export interface SourceViewProps {
18
19
  onSave?: (value: string) => void;
19
20
  /** Called with the `EditorView` once created, and with `null` on teardown. */
20
21
  onViewChange?: (view: EditorView | null) => void;
22
+ /** Host CodeMirror extensions, reconfigured in place when the array changes. */
23
+ hostExtensions?: readonly Extension[];
21
24
  /** Host content docked after the search panel, before the document. Read once. */
22
25
  canvasHeader?: (ctx: {
23
26
  view: EditorView | null;
24
27
  }) => ReactNode;
25
28
  }
26
29
  /** Raw CodeMirror 6 Markdown surface bound to the canonical string. */
27
- export declare function SourceView({ value, onChange, readOnly, placeholder, codeLanguages, wikiLinkSource, tagSource, onResolveError, onSave, onViewChange, canvasHeader, }: SourceViewProps): import("react").JSX.Element;
30
+ export declare function SourceView({ value, onChange, readOnly, placeholder, codeLanguages, wikiLinkSource, tagSource, onResolveError, onSave, onViewChange, canvasHeader, hostExtensions, }: SourceViewProps): import("react").JSX.Element;
28
31
  //# sourceMappingURL=SourceView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SourceView.d.ts","sourceRoot":"","sources":["../../src/editor/SourceView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAO1F,MAAM,WAAW,eAAe;IAC9B,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,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,6DAA6D;IAC7D,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EA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D,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,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,EACd,SAAS,EACT,cAAc,EACd,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,EAAE,eAAe,+BA0CjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/editor/theme.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,eAAO,MAAM,UAAU,uCAoIrB,CAAA"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/editor/theme.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,eAAO,MAAM,UAAU,uCAwIrB,CAAA"}
@@ -15,6 +15,12 @@ export interface UseCodeMirrorOptions {
15
15
  * layer). Captured once — pass a stable, module-level array.
16
16
  */
17
17
  extensions?: Extension[];
18
+ /**
19
+ * Host-supplied extensions, appended after everything else. Unlike
20
+ * `extensions`, reactive: a changed array (compared shallowly) reconfigures
21
+ * the live view without a remount.
22
+ */
23
+ hostExtensions?: readonly Extension[];
18
24
  /** Fenced-code grammars, forwarded to the Markdown language. Read once. */
19
25
  codeLanguages?: CodeLanguages;
20
26
  /** `[[wikilink]]` autocomplete source. Read once. */
@@ -31,5 +37,5 @@ export interface UseCodeMirrorOptions {
31
37
  * Owns a CodeMirror `EditorView` for the lifetime of the host element and keeps
32
38
  * it in sync with a controlled Markdown string. Returns a ref for the container.
33
39
  */
34
- export declare function useCodeMirror({ value, onChange, readOnly, placeholder, onSave, onViewChange, extensions, codeLanguages, wikiLinkSource, tagSource, onResolveError, }: UseCodeMirrorOptions): import("react").RefObject<HTMLDivElement | null>;
40
+ export declare function useCodeMirror({ value, onChange, readOnly, placeholder, onSave, onViewChange, extensions, hostExtensions, codeLanguages, wikiLinkSource, tagSource, onResolveError, }: UseCodeMirrorOptions): import("react").RefObject<HTMLDivElement | null>;
35
41
  //# sourceMappingURL=useCodeMirror.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCodeMirror.d.ts","sourceRoot":"","sources":["../../src/editor/useCodeMirror.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,KAAK,SAAS,EAAQ,MAAM,mBAAmB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAO1F,MAAM,WAAW,oBAAoB;IACnC,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,qFAAqF;IACrF,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,oFAAoF;IACpF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;IAChD;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;IACxB,2EAA2E;IAC3E,aAAa,CAAC,EA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AAE,aAAa,CAAA;IAC7B,qDAAqD;IACrD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAClE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,WAAW,EACX,MAAM,EACN,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,SAAS,EACT,cAAc,GACf,EAAE,oBAAoB,oDAsHtB"}
@@ -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,KAA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O,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"}
package/dist/stylo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as e, t, u as n } from "./embed-cache-CcBfVrc9.js";
2
- import { g as r, k as i, l as a, n as o, t as s } from "./useCodeMirror-TAWSJQiZ.js";
2
+ import { g as r, k as i, l as a, n as o, t as s } from "./useCodeMirror-B07wRexo.js";
3
3
  import { n as c, r as l } from "./config-DTBxVhtH.js";
4
4
  import { Suspense as u, forwardRef as d, lazy as f, useEffect as p, useImperativeHandle as m, useReducer as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
5
5
  import { EditorView as y, showPanel as b } from "@codemirror/view";
@@ -7,14 +7,14 @@ import { createPortal as x } from "react-dom";
7
7
  import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
8
  //#region src/editor/SourceView.tsx
9
9
  var w = () => () => {}, T = () => null;
10
- function E({ value: e, onChange: t, readOnly: r, placeholder: a, codeLanguages: o, wikiLinkSource: c, tagSource: l, onResolveError: u, onSave: d, onViewChange: f, canvasHeader: p }) {
11
- let [m, h] = _(null), y = g(f);
12
- y.current = f;
13
- let C = g((e) => {
14
- h(e), y.current?.(e);
15
- }).current, E = g(p);
16
- E.current = p;
17
- let [D] = _(() => p ? new i() : null), O = v(D?.subscribe ?? w, D?.getSnapshot ?? T), [k] = _(() => D ? [b.of(D.panel)] : []), A = s({
10
+ function E({ value: e, onChange: t, readOnly: r, placeholder: a, codeLanguages: o, wikiLinkSource: c, tagSource: l, onResolveError: u, onSave: d, onViewChange: f, canvasHeader: p, hostExtensions: m }) {
11
+ let [h, y] = _(null), C = g(f);
12
+ C.current = f;
13
+ let E = g((e) => {
14
+ y(e), C.current?.(e);
15
+ }).current, D = g(p);
16
+ D.current = p;
17
+ let [O] = _(() => p ? new i() : null), k = v(O?.subscribe ?? w, O?.getSnapshot ?? T), [A] = _(() => O ? [b.of(O.panel)] : []), j = s({
18
18
  value: e,
19
19
  onChange: t,
20
20
  readOnly: r,
@@ -24,36 +24,37 @@ function E({ value: e, onChange: t, readOnly: r, placeholder: a, codeLanguages:
24
24
  tagSource: l,
25
25
  onResolveError: u,
26
26
  onSave: d,
27
- onViewChange: C,
28
- extensions: k
27
+ onViewChange: E,
28
+ hostExtensions: m,
29
+ extensions: A
29
30
  });
30
31
  return /* @__PURE__ */ S("div", {
31
32
  className: n.source,
32
- ref: A,
33
- children: O && E.current && x(E.current({ view: m }), O)
33
+ ref: j,
34
+ children: k && D.current && x(D.current({ view: h }), k)
34
35
  });
35
36
  }
36
37
  //#endregion
37
38
  //#region src/inplace/lazyInPlace.ts
38
- var D = f(async () => ({ default: (await import("./InPlaceView-CC5hZCcI.js")).InPlaceView })), O = f(async () => ({ default: (await import("./Preview-5lm2uUVj.js")).Preview }));
39
+ var D = f(async () => ({ default: (await import("./InPlaceView-CRb5AkfX.js")).InPlaceView })), O = f(async () => ({ default: (await import("./Preview-5lm2uUVj.js")).Preview }));
39
40
  //#endregion
40
41
  //#region src/SplitView.tsx
41
- function k({ value: e, onChange: t, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: o, wikiLinkSource: s, tagSource: c, embedSource: l, onResolveError: d, frontmatter: f, softBreaks: m, onTaskToggle: h, onSave: v, onViewChange: y, canvasHeader: b }) {
42
- let [x, w] = _(null), T = g(null), D = g(!1);
42
+ function k({ value: e, onChange: t, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: o, wikiLinkSource: s, tagSource: c, embedSource: l, onResolveError: d, frontmatter: f, softBreaks: m, onTaskToggle: h, onSave: v, onViewChange: y, canvasHeader: b, hostExtensions: x }) {
43
+ let [w, T] = _(null), D = g(null), k = g(!1);
43
44
  return p(() => {
44
- let e = x?.scrollDOM, t = T.current;
45
+ let e = w?.scrollDOM, t = D.current;
45
46
  if (!e || !t) return;
46
47
  let n = (e, t) => {
47
- if (D.current) return;
48
+ if (k.current) return;
48
49
  let n = e.scrollHeight - e.clientHeight;
49
- n <= 0 || (D.current = !0, t.scrollTop = e.scrollTop / n * (t.scrollHeight - t.clientHeight), requestAnimationFrame(() => {
50
- D.current = !1;
50
+ n <= 0 || (k.current = !0, t.scrollTop = e.scrollTop / n * (t.scrollHeight - t.clientHeight), requestAnimationFrame(() => {
51
+ k.current = !1;
51
52
  }));
52
53
  }, r = () => n(e, t), i = () => n(t, e);
53
54
  return e.addEventListener("scroll", r, { passive: !0 }), t.addEventListener("scroll", i, { passive: !0 }), () => {
54
55
  e.removeEventListener("scroll", r), t.removeEventListener("scroll", i);
55
56
  };
56
- }, [x]), /* @__PURE__ */ C("div", {
57
+ }, [w]), /* @__PURE__ */ C("div", {
57
58
  className: n.split,
58
59
  children: [/* @__PURE__ */ S("div", {
59
60
  className: n.splitPane,
@@ -68,13 +69,14 @@ function k({ value: e, onChange: t, onWikiLinkClick: r, readOnly: i, placeholder
68
69
  onResolveError: d,
69
70
  onSave: v,
70
71
  onViewChange: (e) => {
71
- w(e), y?.(e);
72
+ T(e), y?.(e);
72
73
  },
73
- canvasHeader: b
74
+ canvasHeader: b,
75
+ hostExtensions: x
74
76
  })
75
77
  }), /* @__PURE__ */ S("div", {
76
78
  className: n.splitPane,
77
- ref: T,
79
+ ref: D,
78
80
  children: /* @__PURE__ */ S(u, {
79
81
  fallback: /* @__PURE__ */ S("div", {
80
82
  className: n.preview,
@@ -228,65 +230,65 @@ function P({ view: e, items: t, icons: i, disabled: s, sticky: c, stickyVisibili
228
230
  }
229
231
  //#endregion
230
232
  //#region src/Stylo.tsx
231
- var F = d(function({ value: r, onChange: i, mode: a = "in-place", onSave: o, onFrontmatter: s, onWikiLinkClick: l, onLinkClick: d, readOnly: f, placeholder: h, className: v, inPlace: b, codeLanguages: x, wikiLinkSource: w, tagSource: T, embedSource: A, onResolveError: j, toolbar: M, icons: N, frontmatter: F, softBreaks: I, onTaskToggle: L, canvasHeader: R }, z) {
232
- let B = a === "preview" || a === "split" || a === "in-place" ? a : "source", [V, H] = _(null), U = B === "preview" ? null : c(M), W = M && typeof M == "object" ? M : void 0, G = W?.render, K = W?.sticky === "top" ? "top" : W?.sticky ? "bottom" : !1, q = W?.stickyVisibility, J = g(s);
233
- J.current = s;
234
- let Y = g(j);
235
- Y.current = j;
236
- let X = g((e, t) => {
237
- Y.current?.(e, t);
238
- }).current, Z = g(A);
239
- Z.current = A;
240
- let Q = g(void 0);
233
+ var F = d(function({ value: r, onChange: i, mode: a = "in-place", onSave: o, onFrontmatter: s, onWikiLinkClick: l, onLinkClick: d, readOnly: f, placeholder: h, className: v, inPlace: b, codeLanguages: x, wikiLinkSource: w, tagSource: T, embedSource: A, onResolveError: j, toolbar: M, icons: N, frontmatter: F, softBreaks: I, onTaskToggle: L, canvasHeader: R, extensions: z }, B) {
234
+ let V = a === "preview" || a === "split" || a === "in-place" ? a : "source", [H, U] = _(null), W = V === "preview" ? null : c(M), G = M && typeof M == "object" ? M : void 0, K = G?.render, q = G?.sticky === "top" ? "top" : G?.sticky ? "bottom" : !1, J = G?.stickyVisibility, Y = g(s);
235
+ Y.current = s;
236
+ let X = g(j);
237
+ X.current = j;
238
+ let Z = g((e, t) => {
239
+ X.current?.(e, t);
240
+ }).current, Q = g(A);
241
+ Q.current = A;
242
+ let $ = g(void 0);
241
243
  p(() => {
242
244
  let t = e(r)?.frontmatter ?? null;
243
- t !== Q.current && (Q.current = t, J.current?.(t));
244
- }, [r]), m(z, () => ({
245
- focus: () => V?.focus(),
246
- getView: () => V,
245
+ t !== $.current && ($.current = t, Y.current?.(t));
246
+ }, [r]), m(B, () => ({
247
+ focus: () => H?.focus(),
248
+ getView: () => H,
247
249
  insertAtCursor: (e) => {
248
- V && (V.dispatch(V.state.replaceSelection(e)), V.focus());
250
+ H && (H.dispatch(H.state.replaceSelection(e)), H.focus());
249
251
  },
250
252
  scrollToHeading: (e) => {
251
- if (!V) return !1;
252
- let t = e.trim().toLowerCase(), { doc: n } = V.state;
253
+ if (!H) return !1;
254
+ let t = e.trim().toLowerCase(), { doc: n } = H.state;
253
255
  for (let e = 1; e <= n.lines; e++) {
254
256
  let r = n.line(e), i = /^ {0,3}#{1,6}[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(r.text);
255
- if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return V.dispatch({
257
+ if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return H.dispatch({
256
258
  selection: { anchor: r.from },
257
259
  effects: y.scrollIntoView(r.from, { y: "start" })
258
- }), V.focus(), !0;
260
+ }), H.focus(), !0;
259
261
  }
260
262
  return !1;
261
263
  },
262
264
  invalidateEmbed: (e) => {
263
- let n = Z.current;
265
+ let n = Q.current;
264
266
  n && t(n, e);
265
267
  }
266
- }), [V]);
267
- let $ = [
268
+ }), [H]);
269
+ let ee = [
268
270
  n.root,
269
- K === "bottom" && n.stickyToolbarRootBottom,
270
- K === "top" && n.stickyToolbarRootTop,
271
+ q === "bottom" && n.stickyToolbarRootBottom,
272
+ q === "top" && n.stickyToolbarRootTop,
271
273
  "stylo",
272
274
  v
273
275
  ].filter(Boolean).join(" ");
274
276
  return /* @__PURE__ */ C("div", {
275
- className: $,
276
- "data-stylo-mode": B,
277
+ className: ee,
278
+ "data-stylo-mode": V,
277
279
  children: [
278
- U && (() => {
280
+ W && (() => {
279
281
  let e = /* @__PURE__ */ S(P, {
280
- view: V,
281
- items: U,
282
+ view: H,
283
+ items: W,
282
284
  icons: N,
283
285
  disabled: f,
284
- sticky: K,
285
- stickyVisibility: q
286
+ sticky: q,
287
+ stickyVisibility: J
286
288
  });
287
- return G ? G(e, { view: V }) : e;
289
+ return K ? K(e, { view: H }) : e;
288
290
  })(),
289
- B === "source" && /* @__PURE__ */ S(E, {
291
+ V === "source" && /* @__PURE__ */ S(E, {
290
292
  value: r,
291
293
  onChange: i,
292
294
  readOnly: f,
@@ -294,12 +296,13 @@ var F = d(function({ value: r, onChange: i, mode: a = "in-place", onSave: o, onF
294
296
  codeLanguages: x,
295
297
  wikiLinkSource: w,
296
298
  tagSource: T,
297
- onResolveError: X,
299
+ onResolveError: Z,
298
300
  onSave: o,
299
- onViewChange: H,
300
- canvasHeader: R
301
+ onViewChange: U,
302
+ canvasHeader: R,
303
+ hostExtensions: z
301
304
  }),
302
- B === "preview" && /* @__PURE__ */ S(u, {
305
+ V === "preview" && /* @__PURE__ */ S(u, {
303
306
  fallback: /* @__PURE__ */ S("div", {
304
307
  className: n.preview,
305
308
  "aria-busy": "true"
@@ -308,14 +311,14 @@ var F = d(function({ value: r, onChange: i, mode: a = "in-place", onSave: o, onF
308
311
  value: r,
309
312
  onWikiLinkClick: l,
310
313
  embedSource: A,
311
- onResolveError: X,
314
+ onResolveError: Z,
312
315
  frontmatter: F,
313
316
  codeLanguages: x,
314
317
  softBreaks: I,
315
318
  onTaskToggle: L
316
319
  })
317
320
  }),
318
- B === "split" && /* @__PURE__ */ S(k, {
321
+ V === "split" && /* @__PURE__ */ S(k, {
319
322
  value: r,
320
323
  onChange: i,
321
324
  onWikiLinkClick: l,
@@ -325,15 +328,16 @@ var F = d(function({ value: r, onChange: i, mode: a = "in-place", onSave: o, onF
325
328
  wikiLinkSource: w,
326
329
  tagSource: T,
327
330
  embedSource: A,
328
- onResolveError: X,
331
+ onResolveError: Z,
329
332
  frontmatter: F,
330
333
  softBreaks: I,
331
334
  onTaskToggle: L,
332
335
  onSave: o,
333
- onViewChange: H,
334
- canvasHeader: R
336
+ onViewChange: U,
337
+ canvasHeader: R,
338
+ hostExtensions: z
335
339
  }),
336
- B === "in-place" && /* @__PURE__ */ S(u, {
340
+ V === "in-place" && /* @__PURE__ */ S(u, {
337
341
  fallback: /* @__PURE__ */ S("div", {
338
342
  className: n.inplace,
339
343
  "aria-busy": "true"
@@ -350,10 +354,11 @@ var F = d(function({ value: r, onChange: i, mode: a = "in-place", onSave: o, onF
350
354
  wikiLinkSource: w,
351
355
  tagSource: T,
352
356
  embedSource: A,
353
- onResolveError: X,
357
+ onResolveError: Z,
354
358
  onSave: o,
355
- onViewChange: H,
356
- canvasHeader: R
359
+ onViewChange: U,
360
+ canvasHeader: R,
361
+ hostExtensions: z
357
362
  })
358
363
  })
359
364
  ]
package/dist/stylo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stylo.js","names":[],"sources":["../src/editor/SourceView.tsx","../src/inplace/lazyInPlace.ts","../src/render/lazyPreview.ts","../src/SplitView.tsx","../src/toolbar/floating-watchdog.ts","../src/toolbar/keyboard-inset.ts","../src/toolbar/Toolbar.tsx","../src/Stylo.tsx"],"sourcesContent":["import { useRef, useState, useSyncExternalStore } from \"react\"\nimport type { ReactNode } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { showPanel } from \"@codemirror/view\"\nimport type { EditorView } from \"@codemirror/view\"\nimport styles from \"../styles/stylo.module.css\"\nimport type { CodeLanguages, ResolveErrorInfo, TagSource, WikiLinkSource } from \"../types\"\nimport { CanvasHeaderHost } from \"./canvas-header-panel\"\nimport { useCodeMirror } from \"./useCodeMirror\"\n\nconst noopSubscribe = () => () => {}\nconst noopSnapshot = () => null\n\nexport interface SourceViewProps {\n value: string\n onChange: (next: string) => void\n readOnly?: boolean\n placeholder?: string\n /** Fenced-code grammars, forwarded to the Markdown language. Read once. */\n codeLanguages?: CodeLanguages\n /** `[[wikilink]]` autocomplete source. Read once. */\n wikiLinkSource?: WikiLinkSource\n /** `#tag` autocomplete source. Read once. */\n tagSource?: TagSource\n /** Notified when `wikiLinkSource` or `tagSource` rejects. */\n onResolveError?: (error: unknown, info: ResolveErrorInfo) => void\n /** Called with the doc string on `Mod-s`. */\n onSave?: (value: string) => void\n /** Called with the `EditorView` once created, and with `null` on teardown. */\n onViewChange?: (view: EditorView | null) => void\n /** Host content docked after the search panel, before the document. Read once. */\n canvasHeader?: (ctx: { view: EditorView | null }) => ReactNode\n}\n\n/** Raw CodeMirror 6 Markdown surface bound to the canonical string. */\nexport function SourceView({\n value,\n onChange,\n readOnly,\n placeholder,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n onResolveError,\n onSave,\n onViewChange,\n canvasHeader,\n}: SourceViewProps) {\n const [editorView, setEditorView] = useState<EditorView | null>(null)\n const onViewChangeRef = useRef(onViewChange)\n onViewChangeRef.current = onViewChange\n const handleViewChange = useRef((view: EditorView | null) => {\n setEditorView(view)\n onViewChangeRef.current?.(view)\n }).current\n\n // `canvasHeader` itself is read through a ref (a changed render prop needs\n // no editor rebuild); whether it was passed at all is read once, at mount,\n // to decide whether the panel extension exists at all.\n const canvasHeaderRef = useRef(canvasHeader)\n canvasHeaderRef.current = canvasHeader\n const [headerHost] = useState(() => (canvasHeader ? new CanvasHeaderHost() : null))\n const headerDom = useSyncExternalStore(\n headerHost?.subscribe ?? noopSubscribe,\n headerHost?.getSnapshot ?? noopSnapshot,\n )\n const [extensions] = useState(() => (headerHost ? [showPanel.of(headerHost.panel)] : []))\n\n const ref = useCodeMirror({\n value,\n onChange,\n readOnly,\n placeholder,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n onResolveError,\n onSave,\n onViewChange: handleViewChange,\n extensions,\n })\n return (\n <div className={styles.source} ref={ref}>\n {headerDom &&\n canvasHeaderRef.current &&\n createPortal(canvasHeaderRef.current({ view: editorView }), headerDom)}\n </div>\n )\n}\n","import { lazy } from \"react\"\n\n/**\n * The in-place canvas carries the decoration plugin (and, in later increments,\n * its KaTeX widgets). It loads only when `mode` resolves to `in-place`, so\n * `source` consumers never fetch it.\n */\nexport const LazyInPlaceView = lazy(async () => ({\n default: (await import(\"./InPlaceView\")).InPlaceView,\n}))\n","import { lazy } from \"react\"\n\n/**\n * Preview pulls in react-markdown + remark/rehype + KaTeX. It is loaded only\n * when a rendered mode (`preview`, `split`) is actually used, so `mode=\"source\"`\n * consumers never pay for it. Both callers share this one wrapper, so the render\n * pipeline stays a single lazy chunk.\n */\nexport const LazyPreview = lazy(async () => ({\n default: (await import(\"./Preview\")).Preview,\n}))\n","import { Suspense, useEffect, useRef, useState } from \"react\"\nimport type { ReactNode } from \"react\"\nimport type { EditorView } from \"@codemirror/view\"\nimport { SourceView } from \"./editor/SourceView\"\nimport { LazyPreview } from \"./render/lazyPreview\"\nimport styles from \"./styles/stylo.module.css\"\nimport type {\n CodeLanguages,\n EmbedSource,\n FrontmatterDisplay,\n ResolveErrorInfo,\n TagSource,\n TaskToggleInfo,\n WikiLinkSource,\n} from \"./types\"\n\nexport interface SplitViewProps {\n value: string\n onChange: (next: string) => void\n onWikiLinkClick?: (target: string) => void\n readOnly?: boolean\n placeholder?: string\n codeLanguages?: CodeLanguages\n wikiLinkSource?: WikiLinkSource\n tagSource?: TagSource\n embedSource?: EmbedSource\n onResolveError?: (error: unknown, info: ResolveErrorInfo) => void\n frontmatter?: FrontmatterDisplay\n softBreaks?: boolean\n onTaskToggle?: (info: TaskToggleInfo) => void\n /** Called with the doc string on `Mod-s`. */\n onSave?: (value: string) => void\n /** Forwarded the source pane's `EditorView` for the shared toolbar. */\n onViewChange?: (view: EditorView | null) => void\n /** Host content docked in the source pane, after its search panel. Read once. */\n canvasHeader?: (ctx: { view: EditorView | null }) => ReactNode\n}\n\n/**\n * Source and preview side by side. Both panes are a pure function of the same\n * string; the only link between them is a proportional scroll sync. Expects the\n * Stylo root to have a bounded height — otherwise both panes grow and the page\n * scrolls instead.\n */\nexport function SplitView({\n value,\n onChange,\n onWikiLinkClick,\n readOnly,\n placeholder,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n embedSource,\n onResolveError,\n frontmatter,\n softBreaks,\n onTaskToggle,\n onSave,\n onViewChange,\n canvasHeader,\n}: SplitViewProps) {\n const [view, setView] = useState<EditorView | null>(null)\n const previewPane = useRef<HTMLDivElement | null>(null)\n const syncing = useRef(false)\n\n const handleView = (next: EditorView | null) => {\n setView(next)\n onViewChange?.(next)\n }\n\n useEffect(() => {\n const source = view?.scrollDOM\n const preview = previewPane.current\n if (!source || !preview) return\n\n const sync = (from: HTMLElement, to: HTMLElement) => {\n if (syncing.current) return\n const range = from.scrollHeight - from.clientHeight\n if (range <= 0) return\n syncing.current = true\n to.scrollTop = (from.scrollTop / range) * (to.scrollHeight - to.clientHeight)\n requestAnimationFrame(() => {\n syncing.current = false\n })\n }\n\n const fromSource = () => sync(source, preview)\n const fromPreview = () => sync(preview, source)\n source.addEventListener(\"scroll\", fromSource, { passive: true })\n preview.addEventListener(\"scroll\", fromPreview, { passive: true })\n return () => {\n source.removeEventListener(\"scroll\", fromSource)\n preview.removeEventListener(\"scroll\", fromPreview)\n }\n }, [view])\n\n return (\n <div className={styles.split}>\n <div className={styles.splitPane}>\n <SourceView\n value={value}\n onChange={onChange}\n readOnly={readOnly}\n placeholder={placeholder}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n onResolveError={onResolveError}\n onSave={onSave}\n onViewChange={handleView}\n canvasHeader={canvasHeader}\n />\n </div>\n <div className={styles.splitPane} ref={previewPane}>\n <Suspense fallback={<div className={styles.preview} aria-busy=\"true\" />}>\n <LazyPreview\n value={value}\n onWikiLinkClick={onWikiLinkClick}\n embedSource={embedSource}\n onResolveError={onResolveError}\n frontmatter={frontmatter}\n codeLanguages={codeLanguages}\n softBreaks={softBreaks}\n onTaskToggle={onTaskToggle}\n />\n </Suspense>\n </div>\n </div>\n )\n}\n","import { useEffect, type RefObject } from \"react\"\n\n/**\n * Continuously re-asserts a `transform` on a `position: fixed` element,\n * alternating an imperceptible sub-pixel jitter every animation frame,\n * instead of trusting the browser to keep it correctly composited on its\n * own. Several rounds of on-device testing found iOS Safari losing track of\n * this exact kind of element — across its own address-bar animation, and in\n * at least one report tied to the keyboard opening — in ways a one-time\n * static fix (a plain `translateZ(0)`) did not reliably prevent. A value\n * that never changes gives the browser nothing to recompute; alternating it\n * every frame forces a fresh compositor pass regardless of what triggered\n * the drift, so it can't stay wrong for more than one frame (~16ms).\n *\n * Writes to the DOM directly rather than through React state, so this never\n * causes a re-render — the transform is the only thing touched.\n */\nexport function useFloatingWatchdog(ref: RefObject<HTMLElement | null>, enabled: boolean): void {\n useEffect(() => {\n if (!enabled) return\n let raf = 0\n let jitter = false\n const tick = () => {\n const el = ref.current\n if (el) {\n jitter = !jitter\n el.style.transform = jitter ? \"translate3d(0, 0.01px, 0)\" : \"translate3d(0, 0, 0)\"\n }\n raf = requestAnimationFrame(tick)\n }\n raf = requestAnimationFrame(tick)\n return () => cancelAnimationFrame(raf)\n }, [ref, enabled])\n}\n","import { useEffect, useState } from \"react\"\n\n/**\n * How far the on-screen keyboard eats into the window, tracked through the\n * `visualViewport` API. 0 when `enabled` is false or the browser has no\n * `visualViewport` (older Safari, SSR, most desktop browsers). A mobile\n * keyboard shrinks the *visual* viewport, not the layout viewport a plain\n * `position: fixed` bottom offset is computed against — this is what lets the\n * sticky toolbar ride up above the keyboard instead of hiding behind it.\n */\nexport function useKeyboardInset(enabled: boolean): number {\n const [inset, setInset] = useState(0)\n\n useEffect(() => {\n const vv = typeof window === \"undefined\" ? null : window.visualViewport\n if (!enabled || !vv) {\n setInset(0)\n return\n }\n const update = () => setInset(Math.max(0, window.innerHeight - vv.height - vv.offsetTop))\n update()\n vv.addEventListener(\"resize\", update)\n vv.addEventListener(\"scroll\", update)\n return () => {\n vv.removeEventListener(\"resize\", update)\n vv.removeEventListener(\"scroll\", update)\n }\n }, [enabled])\n\n return inset\n}\n","import { useEffect, useReducer, useRef, useState } from \"react\"\nimport type { ReactNode } from \"react\"\nimport type { EditorState } from \"@codemirror/state\"\nimport type { EditorView } from \"@codemirror/view\"\nimport styles from \"../styles/stylo.module.css\"\nimport type { ToolbarCommandId } from \"../types\"\nimport { activeTableCell } from \"./cell-inline\"\nimport { resolveForCell } from \"./command-helpers\"\nimport { BUILTIN_BY_ID } from \"./commands\"\nimport type { ToolbarItem } from \"./config\"\nimport { useFloatingWatchdog } from \"./floating-watchdog\"\nimport { DEFAULT_ICONS } from \"./icons\"\nimport { useKeyboardInset } from \"./keyboard-inset\"\n\nexport interface ToolbarProps {\n /** The surface the commands act on. `null` while a lazy view is mounting. */\n view: EditorView | null\n /** Ordered items to render; `\"|\"` is a separator. */\n items: ToolbarItem[]\n /** Per-id glyph overrides; any id left out keeps its built-in icon. */\n icons?: Partial<Record<ToolbarCommandId, ReactNode>>\n /** Render every button inert (e.g. a read-only surface). */\n disabled?: boolean\n /** Fix the bar to a window edge (normalised from `ToolbarConfig.sticky`; the\n * caller resolves `true` to `\"bottom\"`). */\n sticky?: \"top\" | \"bottom\" | false\n /** Fade the bar out while the editing surface is unfocused (`ToolbarConfig.stickyVisibility`). */\n stickyVisibility?: \"consistent\" | \"dynamic\"\n}\n\n/** A button to render, normalised from a built-in id or a custom item. */\ninterface Btn {\n key: string\n icon: ReactNode\n title: string\n run: (view: EditorView) => unknown\n isActive?: (state: EditorState) => boolean\n disabled?: (state: EditorState) => boolean\n}\n\n/**\n * Splits `items` into the runs a `\"|\"` already delimits, keeping each\n * separator as its own entry. A run renders as one flex child so wrapping\n * (on narrow hosts) breaks between groups, never in the middle of one — the\n * default bar's `undo, redo | h1, h2, h3 | ...` shape becomes the wrap unit\n * for free, no separate grouping config needed.\n */\nfunction groupItems(items: ToolbarItem[]): (Exclude<ToolbarItem, \"|\">[] | \"|\")[] {\n const groups: (Exclude<ToolbarItem, \"|\">[] | \"|\")[] = []\n let run: Exclude<ToolbarItem, \"|\">[] = []\n for (const item of items) {\n if (item !== \"|\") {\n run.push(item)\n continue\n }\n if (run.length) groups.push(run)\n run = []\n groups.push(\"|\")\n }\n if (run.length) groups.push(run)\n return groups\n}\n\n/** Resolve one non-separator item to a renderable button, or `null` to skip it. */\nfunction toButton(item: Exclude<ToolbarItem, \"|\">, icons: ToolbarProps[\"icons\"]): Btn | null {\n if (typeof item !== \"string\") {\n const { id, icon, title, run, isActive, disabled } = item\n return { key: id, icon, title, run, isActive, disabled }\n }\n const cmd = BUILTIN_BY_ID[item]\n if (!cmd) return null\n return {\n key: item,\n icon: icons?.[item] ?? DEFAULT_ICONS[item],\n title: cmd.title,\n run: cmd.run,\n isActive: cmd.isActive,\n disabled: cmd.disabled,\n }\n}\n\n/**\n * Formatting bar above the editing surface. It holds no document state — each\n * button runs a command against the live `EditorView`. Pressed states are read\n * back from the view whenever the selection, keys, or pointer move. Built-in\n * ids and consumer-supplied {@link ToolbarCustomItem}s render through the same\n * button path.\n */\nexport function Toolbar({ view, items, icons, disabled, sticky, stickyVisibility }: ToolbarProps) {\n const [, refresh] = useReducer((n: number) => n + 1, 0)\n const [focused, setFocused] = useState(false)\n // Only \"bottom\" needs keyboard tracking — nothing eats into the top of the\n // screen the way a keyboard eats the bottom.\n const keyboardInset = useKeyboardInset(sticky === \"bottom\")\n const barRef = useRef<HTMLDivElement>(null)\n useFloatingWatchdog(barRef, sticky === \"top\")\n\n useEffect(() => {\n if (!view) return\n const el = view.contentDOM\n setFocused(view.hasFocus)\n const onFocus = () => {\n setFocused(true)\n refresh()\n }\n const onBlur = () => {\n setFocused(false)\n refresh()\n }\n const events = [\"keyup\", \"mouseup\", \"input\"] as const\n for (const ev of events) el.addEventListener(ev, refresh)\n el.addEventListener(\"focus\", onFocus)\n el.addEventListener(\"blur\", onBlur)\n return () => {\n for (const ev of events) el.removeEventListener(ev, refresh)\n el.removeEventListener(\"focus\", onFocus)\n el.removeEventListener(\"blur\", onBlur)\n }\n }, [view])\n\n // \"dynamic\" fades the bar out while nothing is focused, so it doesn't sit\n // over the content while the caret is elsewhere (e.g. scrolling to read).\n const dynamicHidden = Boolean(sticky) && stickyVisibility === \"dynamic\" && !focused\n\n // `state.selection` never follows the caret into an editable table cell's\n // `contentEditable` DOM (see `extension.ts`'s mousedown handler), so a\n // built-in command's own `disabled` / `isActive` would otherwise read a\n // selection that may point anywhere else in the document while the user is\n // actually typing in a cell. `resolveForCell` below re-derives both from the\n // real DOM focus in that case instead.\n const inCell = view ? Boolean(activeTableCell(view)) : false\n\n const className = [\n styles.toolbar,\n sticky && styles.toolbarSticky,\n sticky === \"top\" && styles.toolbarStickyTop,\n sticky === \"bottom\" && styles.toolbarStickyBottom,\n dynamicHidden && styles.toolbarStickyHidden,\n ]\n .filter(Boolean)\n .join(\" \")\n // `transform`, not `bottom` — a `position: fixed` element repositioned via\n // `bottom` doesn't reliably repaint in step with the keyboard animation on\n // iOS Safari; `translateY` forces a compositor update on every\n // `visualViewport` event instead. The bar's resting position (keyboard\n // closed) is `bottom: 0` in CSS; this only nudges it up. `\"top\"` needs no\n // offset at all.\n const stickyStyle =\n sticky === \"bottom\" ? { transform: `translateY(-${keyboardInset}px)` } : undefined\n\n return (\n <div\n ref={barRef}\n className={className}\n role=\"toolbar\"\n aria-label=\"Formatting\"\n aria-hidden={dynamicHidden || undefined}\n style={stickyStyle}\n >\n {groupItems(items).map((group, i) => {\n if (group === \"|\") {\n return <span key={`sep-${i}`} className={styles.toolbarSep} aria-hidden=\"true\" />\n }\n return (\n <div key={`group-${i}`} className={styles.toolbarGroup}>\n {group.map((item) => {\n const btn = toButton(item, icons)\n if (!btn) return null\n // Only a built-in command is cell-aware — a host's own\n // `ToolbarCustomItem` keeps reading `state` exactly as before;\n // it has no notion of a table cell to degrade into.\n const builtin = typeof item === \"string\" ? BUILTIN_BY_ID[item] : undefined\n const resolved = view\n ? builtin\n ? resolveForCell(view.state, builtin, inCell)\n : {\n disabled: Boolean(btn.disabled?.(view.state)),\n active: Boolean(btn.isActive?.(view.state)),\n }\n : { disabled: true, active: false }\n const off = disabled || !view || resolved.disabled\n const active = !off && resolved.active\n return (\n <button\n key={btn.key}\n type=\"button\"\n className={styles.toolbarButton}\n data-command={btn.key}\n title={btn.title}\n aria-label={btn.title}\n aria-pressed={btn.isActive ? active : undefined}\n data-active={active ? \"\" : undefined}\n disabled={off}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n if (!view) return\n btn.run(view)\n refresh()\n }}\n >\n {btn.icon}\n </button>\n )\n })}\n </div>\n )\n })}\n </div>\n )\n}\n","import { forwardRef, Suspense, useEffect, useImperativeHandle, useRef, useState } from \"react\"\nimport { EditorView } from \"@codemirror/view\"\nimport { SourceView } from \"./editor/SourceView\"\nimport { LazyInPlaceView } from \"./inplace/lazyInPlace\"\nimport { LazyPreview } from \"./render/lazyPreview\"\nimport { SplitView } from \"./SplitView\"\nimport styles from \"./styles/stylo.module.css\"\nimport { Toolbar } from \"./toolbar/Toolbar\"\nimport { resolveToolbarItems } from \"./toolbar/config\"\nimport { splitFrontmatter } from \"./frontmatter\"\nimport { invalidateEmbed } from \"./render/embed-cache\"\nimport \"./styles/tokens.css\"\nimport type { ResolveErrorInfo, StyloHandle, StyloProps } from \"./types\"\n\n/**\n * Plain-text-first Markdown editor. `value` is the canonical Markdown string;\n * every view is a pure function of it.\n *\n * The default `mode` is `in-place`, the live decoration canvas (ADR-002 §1,\n * ADR-004). Pass `mode=\"source\"` for the plain surface with no lazy render\n * chunk. `preview` and `split` are also available.\n *\n * A formatting `toolbar` sits above every editing surface (all modes but\n * `preview`); pass `toolbar={false}` to drop it or a `ToolbarConfig` to trim it.\n */\nexport const Stylo = forwardRef<StyloHandle, StyloProps>(function Stylo(\n {\n value,\n onChange,\n mode = \"in-place\",\n onSave,\n onFrontmatter,\n onWikiLinkClick,\n onLinkClick,\n readOnly,\n placeholder,\n className,\n inPlace,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n embedSource,\n onResolveError,\n toolbar,\n icons,\n frontmatter,\n softBreaks,\n onTaskToggle,\n canvasHeader,\n },\n ref,\n) {\n const resolved = mode === \"preview\" || mode === \"split\" || mode === \"in-place\" ? mode : \"source\"\n\n const [view, setView] = useState<EditorView | null>(null)\n const toolbarItems = resolved === \"preview\" ? null : resolveToolbarItems(toolbar)\n const toolbarConfig = toolbar && typeof toolbar === \"object\" ? toolbar : undefined\n const toolbarRender = toolbarConfig?.render\n const stickyToolbar: \"top\" | \"bottom\" | false =\n toolbarConfig?.sticky === \"top\" ? \"top\" : toolbarConfig?.sticky ? \"bottom\" : false\n const stickyVisibility = toolbarConfig?.stickyVisibility\n\n // Report the raw frontmatter block on mount and whenever it changes. Stylo\n // does not parse it — the host passes `raw` to its own YAML parser.\n const onFrontmatterRef = useRef(onFrontmatter)\n onFrontmatterRef.current = onFrontmatter\n\n // Stable wrapper so a changed `onResolveError` needs no editor rebuild and\n // does not thrash the embed effect. Passed to every surface.\n const onResolveErrorRef = useRef(onResolveError)\n onResolveErrorRef.current = onResolveError\n const resolveError = useRef((error: unknown, info: ResolveErrorInfo) => {\n onResolveErrorRef.current?.(error, info)\n }).current\n\n // Read by `invalidateEmbed` below — kept current without needing the\n // imperative handle itself to be rebuilt when `embedSource` changes.\n const embedSourceRef = useRef(embedSource)\n embedSourceRef.current = embedSource\n const lastFrontmatter = useRef<string | null | undefined>(undefined)\n useEffect(() => {\n const raw = splitFrontmatter(value)?.frontmatter ?? null\n if (raw === lastFrontmatter.current) return\n lastFrontmatter.current = raw\n onFrontmatterRef.current?.(raw)\n }, [value])\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => view?.focus(),\n getView: () => view,\n insertAtCursor: (md) => {\n if (!view) return\n view.dispatch(view.state.replaceSelection(md))\n view.focus()\n },\n scrollToHeading: (text) => {\n if (!view) return false\n const target = text.trim().toLowerCase()\n const { doc } = view.state\n for (let n = 1; n <= doc.lines; n++) {\n const line = doc.line(n)\n const m = /^ {0,3}#{1,6}[ \\t]+(.*?)(?:[ \\t]+#+)?[ \\t]*$/.exec(line.text)\n if (!m || m[1] === undefined) continue\n if (m[1].trim().toLowerCase() !== target) continue\n view.dispatch({\n selection: { anchor: line.from },\n effects: EditorView.scrollIntoView(line.from, { y: \"start\" }),\n })\n view.focus()\n return true\n }\n return false\n },\n invalidateEmbed: (ref) => {\n const source = embedSourceRef.current\n if (source) invalidateEmbed(source, ref)\n },\n }),\n [view],\n )\n\n const rootClass = [\n styles.root,\n stickyToolbar === \"bottom\" && styles.stickyToolbarRootBottom,\n stickyToolbar === \"top\" && styles.stickyToolbarRootTop,\n \"stylo\",\n className,\n ]\n .filter(Boolean)\n .join(\" \")\n\n return (\n <div className={rootClass} data-stylo-mode={resolved}>\n {toolbarItems &&\n (() => {\n const bar = (\n <Toolbar\n view={view}\n items={toolbarItems}\n icons={icons}\n disabled={readOnly}\n sticky={stickyToolbar}\n stickyVisibility={stickyVisibility}\n />\n )\n return toolbarRender ? toolbarRender(bar, { view }) : bar\n })()}\n\n {resolved === \"source\" && (\n <SourceView\n value={value}\n onChange={onChange}\n readOnly={readOnly}\n placeholder={placeholder}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n onResolveError={resolveError}\n onSave={onSave}\n onViewChange={setView}\n canvasHeader={canvasHeader}\n />\n )}\n\n {resolved === \"preview\" && (\n <Suspense fallback={<div className={styles.preview} aria-busy=\"true\" />}>\n <LazyPreview\n value={value}\n onWikiLinkClick={onWikiLinkClick}\n embedSource={embedSource}\n onResolveError={resolveError}\n frontmatter={frontmatter}\n codeLanguages={codeLanguages}\n softBreaks={softBreaks}\n onTaskToggle={onTaskToggle}\n />\n </Suspense>\n )}\n\n {resolved === \"split\" && (\n <SplitView\n value={value}\n onChange={onChange}\n onWikiLinkClick={onWikiLinkClick}\n readOnly={readOnly}\n placeholder={placeholder}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n embedSource={embedSource}\n onResolveError={resolveError}\n frontmatter={frontmatter}\n softBreaks={softBreaks}\n onTaskToggle={onTaskToggle}\n onSave={onSave}\n onViewChange={setView}\n canvasHeader={canvasHeader}\n />\n )}\n\n {resolved === \"in-place\" && (\n <Suspense fallback={<div className={styles.inplace} aria-busy=\"true\" />}>\n <LazyInPlaceView\n value={value}\n onChange={onChange}\n readOnly={readOnly}\n placeholder={placeholder}\n onWikiLinkClick={onWikiLinkClick}\n onLinkClick={onLinkClick}\n inPlace={inPlace}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n embedSource={embedSource}\n onResolveError={resolveError}\n onSave={onSave}\n onViewChange={setView}\n canvasHeader={canvasHeader}\n />\n </Suspense>\n )}\n </div>\n )\n})\n\nStylo.displayName = \"Stylo\"\n"],"mappings":";;;;;;;;AAUA,IAAM,gBAA4B,CAAC,GAC7B,UAAqB;AAwB3B,SAAgB,EAAW,EACzB,UACA,aACA,aACA,gBACA,kBACA,mBACA,cACA,mBACA,WACA,iBACA,mBACkB;CAClB,IAAM,CAAC,GAAY,KAAiB,EAA4B,IAAI,GAC9D,IAAkB,EAAO,CAAY;CAC3C,EAAgB,UAAU;CAC1B,IAAM,IAAmB,GAAQ,MAA4B;EAE3D,AADA,EAAc,CAAI,GAClB,EAAg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C,CAAI,CACP;CAEA,IAAM,IAAY;EAChB,EAAO;EACP,MAAkB,YAAY,EAAO;EACrC,MAAkB,SAAS,EAAO;EAClC;EACA;CACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACE,kBAAC,OAAD;EAAK,WAAW;EAAW,mBAAiB;EAA5C,UAAA;GACG,YACQ;IACL,IAAM,IACJ,kBAAC,GAAD;KACQ;KACN,OAAO;KACA;KACP,UAAU;KACV,QAAQ;KACU;IACnB,CAAA;IAEH,OAAO,IAAgB,EAAc,GAAK,EAAE,QAAK,CAAC,IAAI;GACxD,EAAA,CAAG;GAEJ,MAAa,YACZ,kBAAC,GAAD;IACS;IACG;IACA;IACG;IACE;IACC;IACL;IACX,gBAAgB;IACR;IACR,cAAc;IACA;GACf,CAAA;GAGF,MAAa,aACZ,kBAAC,GAAD;IAAU,UAAU,kBAAC,OAAD;KAAK,WAAW,EAAO;KAAS,aAAU;IAAQ,CAAA;IACpE,UAAA,kBAAC,GAAD;KACS;KACU;KACJ;KACb,gBAAgB;KACH;KACE;KACH;KACE;IACf,CAAA;GACO,CAAA;GAGX,MAAa,WACZ,kBAAC,GAAD;IACS;IACG;IACO;IACP;IACG;IACE;IACC;IACL;IACE;IACb,gBAAgB;IACH;IACD;IACE;IACN;IACR,cAAc;IACA;GACf,CAAA;GAGF,MAAa,cACZ,kBAAC,GAAD;IAAU,UAAU,kBAAC,OAAD;KAAK,WAAW,EAAO;KAAS,aAAU;IAAQ,CAAA;IACpE,UAAA,kBAAC,GAAD;KACS;KACG;KACA;KACG;KACI;KACJ;KACJ;KACM;KACC;KACL;KACE;KACb,gBAAgB;KACR;KACR,cAAc;KACA;IACf,CAAA;GACO,CAAA;EAET;;AAET,CAAC;AAED,EAAM,cAAc"}
1
+ {"version":3,"file":"stylo.js","names":[],"sources":["../src/editor/SourceView.tsx","../src/inplace/lazyInPlace.ts","../src/render/lazyPreview.ts","../src/SplitView.tsx","../src/toolbar/floating-watchdog.ts","../src/toolbar/keyboard-inset.ts","../src/toolbar/Toolbar.tsx","../src/Stylo.tsx"],"sourcesContent":["import { useRef, useState, useSyncExternalStore } from \"react\"\nimport type { ReactNode } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { showPanel } from \"@codemirror/view\"\nimport type { Extension } from \"@codemirror/state\"\nimport type { EditorView } from \"@codemirror/view\"\nimport styles from \"../styles/stylo.module.css\"\nimport type { CodeLanguages, ResolveErrorInfo, TagSource, WikiLinkSource } from \"../types\"\nimport { CanvasHeaderHost } from \"./canvas-header-panel\"\nimport { useCodeMirror } from \"./useCodeMirror\"\n\nconst noopSubscribe = () => () => {}\nconst noopSnapshot = () => null\n\nexport interface SourceViewProps {\n value: string\n onChange: (next: string) => void\n readOnly?: boolean\n placeholder?: string\n /** Fenced-code grammars, forwarded to the Markdown language. Read once. */\n codeLanguages?: CodeLanguages\n /** `[[wikilink]]` autocomplete source. Read once. */\n wikiLinkSource?: WikiLinkSource\n /** `#tag` autocomplete source. Read once. */\n tagSource?: TagSource\n /** Notified when `wikiLinkSource` or `tagSource` rejects. */\n onResolveError?: (error: unknown, info: ResolveErrorInfo) => void\n /** Called with the doc string on `Mod-s`. */\n onSave?: (value: string) => void\n /** Called with the `EditorView` once created, and with `null` on teardown. */\n onViewChange?: (view: EditorView | null) => void\n /** Host CodeMirror extensions, reconfigured in place when the array changes. */\n hostExtensions?: readonly Extension[]\n /** Host content docked after the search panel, before the document. Read once. */\n canvasHeader?: (ctx: { view: EditorView | null }) => ReactNode\n}\n\n/** Raw CodeMirror 6 Markdown surface bound to the canonical string. */\nexport function SourceView({\n value,\n onChange,\n readOnly,\n placeholder,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n onResolveError,\n onSave,\n onViewChange,\n canvasHeader,\n hostExtensions,\n}: SourceViewProps) {\n const [editorView, setEditorView] = useState<EditorView | null>(null)\n const onViewChangeRef = useRef(onViewChange)\n onViewChangeRef.current = onViewChange\n const handleViewChange = useRef((view: EditorView | null) => {\n setEditorView(view)\n onViewChangeRef.current?.(view)\n }).current\n\n // `canvasHeader` itself is read through a ref (a changed render prop needs\n // no editor rebuild); whether it was passed at all is read once, at mount,\n // to decide whether the panel extension exists at all.\n const canvasHeaderRef = useRef(canvasHeader)\n canvasHeaderRef.current = canvasHeader\n const [headerHost] = useState(() => (canvasHeader ? new CanvasHeaderHost() : null))\n const headerDom = useSyncExternalStore(\n headerHost?.subscribe ?? noopSubscribe,\n headerHost?.getSnapshot ?? noopSnapshot,\n )\n const [extensions] = useState(() => (headerHost ? [showPanel.of(headerHost.panel)] : []))\n\n const ref = useCodeMirror({\n value,\n onChange,\n readOnly,\n placeholder,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n onResolveError,\n onSave,\n onViewChange: handleViewChange,\n hostExtensions,\n extensions,\n })\n return (\n <div className={styles.source} ref={ref}>\n {headerDom &&\n canvasHeaderRef.current &&\n createPortal(canvasHeaderRef.current({ view: editorView }), headerDom)}\n </div>\n )\n}\n","import { lazy } from \"react\"\n\n/**\n * The in-place canvas carries the decoration plugin (and, in later increments,\n * its KaTeX widgets). It loads only when `mode` resolves to `in-place`, so\n * `source` consumers never fetch it.\n */\nexport const LazyInPlaceView = lazy(async () => ({\n default: (await import(\"./InPlaceView\")).InPlaceView,\n}))\n","import { lazy } from \"react\"\n\n/**\n * Preview pulls in react-markdown + remark/rehype + KaTeX. It is loaded only\n * when a rendered mode (`preview`, `split`) is actually used, so `mode=\"source\"`\n * consumers never pay for it. Both callers share this one wrapper, so the render\n * pipeline stays a single lazy chunk.\n */\nexport const LazyPreview = lazy(async () => ({\n default: (await import(\"./Preview\")).Preview,\n}))\n","import { Suspense, useEffect, useRef, useState } from \"react\"\nimport type { ReactNode } from \"react\"\nimport type { Extension } from \"@codemirror/state\"\nimport type { EditorView } from \"@codemirror/view\"\nimport { SourceView } from \"./editor/SourceView\"\nimport { LazyPreview } from \"./render/lazyPreview\"\nimport styles from \"./styles/stylo.module.css\"\nimport type {\n CodeLanguages,\n EmbedSource,\n FrontmatterDisplay,\n ResolveErrorInfo,\n TagSource,\n TaskToggleInfo,\n WikiLinkSource,\n} from \"./types\"\n\nexport interface SplitViewProps {\n value: string\n onChange: (next: string) => void\n onWikiLinkClick?: (target: string) => void\n readOnly?: boolean\n placeholder?: string\n codeLanguages?: CodeLanguages\n wikiLinkSource?: WikiLinkSource\n tagSource?: TagSource\n embedSource?: EmbedSource\n onResolveError?: (error: unknown, info: ResolveErrorInfo) => void\n frontmatter?: FrontmatterDisplay\n softBreaks?: boolean\n onTaskToggle?: (info: TaskToggleInfo) => void\n /** Called with the doc string on `Mod-s`. */\n onSave?: (value: string) => void\n /** Forwarded the source pane's `EditorView` for the shared toolbar. */\n onViewChange?: (view: EditorView | null) => void\n /** Host CodeMirror extensions for the source pane. */\n hostExtensions?: readonly Extension[]\n /** Host content docked in the source pane, after its search panel. Read once. */\n canvasHeader?: (ctx: { view: EditorView | null }) => ReactNode\n}\n\n/**\n * Source and preview side by side. Both panes are a pure function of the same\n * string; the only link between them is a proportional scroll sync. Expects the\n * Stylo root to have a bounded height — otherwise both panes grow and the page\n * scrolls instead.\n */\nexport function SplitView({\n value,\n onChange,\n onWikiLinkClick,\n readOnly,\n placeholder,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n embedSource,\n onResolveError,\n frontmatter,\n softBreaks,\n onTaskToggle,\n onSave,\n onViewChange,\n canvasHeader,\n hostExtensions,\n}: SplitViewProps) {\n const [view, setView] = useState<EditorView | null>(null)\n const previewPane = useRef<HTMLDivElement | null>(null)\n const syncing = useRef(false)\n\n const handleView = (next: EditorView | null) => {\n setView(next)\n onViewChange?.(next)\n }\n\n useEffect(() => {\n const source = view?.scrollDOM\n const preview = previewPane.current\n if (!source || !preview) return\n\n const sync = (from: HTMLElement, to: HTMLElement) => {\n if (syncing.current) return\n const range = from.scrollHeight - from.clientHeight\n if (range <= 0) return\n syncing.current = true\n to.scrollTop = (from.scrollTop / range) * (to.scrollHeight - to.clientHeight)\n requestAnimationFrame(() => {\n syncing.current = false\n })\n }\n\n const fromSource = () => sync(source, preview)\n const fromPreview = () => sync(preview, source)\n source.addEventListener(\"scroll\", fromSource, { passive: true })\n preview.addEventListener(\"scroll\", fromPreview, { passive: true })\n return () => {\n source.removeEventListener(\"scroll\", fromSource)\n preview.removeEventListener(\"scroll\", fromPreview)\n }\n }, [view])\n\n return (\n <div className={styles.split}>\n <div className={styles.splitPane}>\n <SourceView\n value={value}\n onChange={onChange}\n readOnly={readOnly}\n placeholder={placeholder}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n onResolveError={onResolveError}\n onSave={onSave}\n onViewChange={handleView}\n canvasHeader={canvasHeader}\n hostExtensions={hostExtensions}\n />\n </div>\n <div className={styles.splitPane} ref={previewPane}>\n <Suspense fallback={<div className={styles.preview} aria-busy=\"true\" />}>\n <LazyPreview\n value={value}\n onWikiLinkClick={onWikiLinkClick}\n embedSource={embedSource}\n onResolveError={onResolveError}\n frontmatter={frontmatter}\n codeLanguages={codeLanguages}\n softBreaks={softBreaks}\n onTaskToggle={onTaskToggle}\n />\n </Suspense>\n </div>\n </div>\n )\n}\n","import { useEffect, type RefObject } from \"react\"\n\n/**\n * Continuously re-asserts a `transform` on a `position: fixed` element,\n * alternating an imperceptible sub-pixel jitter every animation frame,\n * instead of trusting the browser to keep it correctly composited on its\n * own. Several rounds of on-device testing found iOS Safari losing track of\n * this exact kind of element — across its own address-bar animation, and in\n * at least one report tied to the keyboard opening — in ways a one-time\n * static fix (a plain `translateZ(0)`) did not reliably prevent. A value\n * that never changes gives the browser nothing to recompute; alternating it\n * every frame forces a fresh compositor pass regardless of what triggered\n * the drift, so it can't stay wrong for more than one frame (~16ms).\n *\n * Writes to the DOM directly rather than through React state, so this never\n * causes a re-render — the transform is the only thing touched.\n */\nexport function useFloatingWatchdog(ref: RefObject<HTMLElement | null>, enabled: boolean): void {\n useEffect(() => {\n if (!enabled) return\n let raf = 0\n let jitter = false\n const tick = () => {\n const el = ref.current\n if (el) {\n jitter = !jitter\n el.style.transform = jitter ? \"translate3d(0, 0.01px, 0)\" : \"translate3d(0, 0, 0)\"\n }\n raf = requestAnimationFrame(tick)\n }\n raf = requestAnimationFrame(tick)\n return () => cancelAnimationFrame(raf)\n }, [ref, enabled])\n}\n","import { useEffect, useState } from \"react\"\n\n/**\n * How far the on-screen keyboard eats into the window, tracked through the\n * `visualViewport` API. 0 when `enabled` is false or the browser has no\n * `visualViewport` (older Safari, SSR, most desktop browsers). A mobile\n * keyboard shrinks the *visual* viewport, not the layout viewport a plain\n * `position: fixed` bottom offset is computed against — this is what lets the\n * sticky toolbar ride up above the keyboard instead of hiding behind it.\n */\nexport function useKeyboardInset(enabled: boolean): number {\n const [inset, setInset] = useState(0)\n\n useEffect(() => {\n const vv = typeof window === \"undefined\" ? null : window.visualViewport\n if (!enabled || !vv) {\n setInset(0)\n return\n }\n const update = () => setInset(Math.max(0, window.innerHeight - vv.height - vv.offsetTop))\n update()\n vv.addEventListener(\"resize\", update)\n vv.addEventListener(\"scroll\", update)\n return () => {\n vv.removeEventListener(\"resize\", update)\n vv.removeEventListener(\"scroll\", update)\n }\n }, [enabled])\n\n return inset\n}\n","import { useEffect, useReducer, useRef, useState } from \"react\"\nimport type { ReactNode } from \"react\"\nimport type { EditorState } from \"@codemirror/state\"\nimport type { EditorView } from \"@codemirror/view\"\nimport styles from \"../styles/stylo.module.css\"\nimport type { ToolbarCommandId } from \"../types\"\nimport { activeTableCell } from \"./cell-inline\"\nimport { resolveForCell } from \"./command-helpers\"\nimport { BUILTIN_BY_ID } from \"./commands\"\nimport type { ToolbarItem } from \"./config\"\nimport { useFloatingWatchdog } from \"./floating-watchdog\"\nimport { DEFAULT_ICONS } from \"./icons\"\nimport { useKeyboardInset } from \"./keyboard-inset\"\n\nexport interface ToolbarProps {\n /** The surface the commands act on. `null` while a lazy view is mounting. */\n view: EditorView | null\n /** Ordered items to render; `\"|\"` is a separator. */\n items: ToolbarItem[]\n /** Per-id glyph overrides; any id left out keeps its built-in icon. */\n icons?: Partial<Record<ToolbarCommandId, ReactNode>>\n /** Render every button inert (e.g. a read-only surface). */\n disabled?: boolean\n /** Fix the bar to a window edge (normalised from `ToolbarConfig.sticky`; the\n * caller resolves `true` to `\"bottom\"`). */\n sticky?: \"top\" | \"bottom\" | false\n /** Fade the bar out while the editing surface is unfocused (`ToolbarConfig.stickyVisibility`). */\n stickyVisibility?: \"consistent\" | \"dynamic\"\n}\n\n/** A button to render, normalised from a built-in id or a custom item. */\ninterface Btn {\n key: string\n icon: ReactNode\n title: string\n run: (view: EditorView) => unknown\n isActive?: (state: EditorState) => boolean\n disabled?: (state: EditorState) => boolean\n}\n\n/**\n * Splits `items` into the runs a `\"|\"` already delimits, keeping each\n * separator as its own entry. A run renders as one flex child so wrapping\n * (on narrow hosts) breaks between groups, never in the middle of one — the\n * default bar's `undo, redo | h1, h2, h3 | ...` shape becomes the wrap unit\n * for free, no separate grouping config needed.\n */\nfunction groupItems(items: ToolbarItem[]): (Exclude<ToolbarItem, \"|\">[] | \"|\")[] {\n const groups: (Exclude<ToolbarItem, \"|\">[] | \"|\")[] = []\n let run: Exclude<ToolbarItem, \"|\">[] = []\n for (const item of items) {\n if (item !== \"|\") {\n run.push(item)\n continue\n }\n if (run.length) groups.push(run)\n run = []\n groups.push(\"|\")\n }\n if (run.length) groups.push(run)\n return groups\n}\n\n/** Resolve one non-separator item to a renderable button, or `null` to skip it. */\nfunction toButton(item: Exclude<ToolbarItem, \"|\">, icons: ToolbarProps[\"icons\"]): Btn | null {\n if (typeof item !== \"string\") {\n const { id, icon, title, run, isActive, disabled } = item\n return { key: id, icon, title, run, isActive, disabled }\n }\n const cmd = BUILTIN_BY_ID[item]\n if (!cmd) return null\n return {\n key: item,\n icon: icons?.[item] ?? DEFAULT_ICONS[item],\n title: cmd.title,\n run: cmd.run,\n isActive: cmd.isActive,\n disabled: cmd.disabled,\n }\n}\n\n/**\n * Formatting bar above the editing surface. It holds no document state — each\n * button runs a command against the live `EditorView`. Pressed states are read\n * back from the view whenever the selection, keys, or pointer move. Built-in\n * ids and consumer-supplied {@link ToolbarCustomItem}s render through the same\n * button path.\n */\nexport function Toolbar({ view, items, icons, disabled, sticky, stickyVisibility }: ToolbarProps) {\n const [, refresh] = useReducer((n: number) => n + 1, 0)\n const [focused, setFocused] = useState(false)\n // Only \"bottom\" needs keyboard tracking — nothing eats into the top of the\n // screen the way a keyboard eats the bottom.\n const keyboardInset = useKeyboardInset(sticky === \"bottom\")\n const barRef = useRef<HTMLDivElement>(null)\n useFloatingWatchdog(barRef, sticky === \"top\")\n\n useEffect(() => {\n if (!view) return\n const el = view.contentDOM\n setFocused(view.hasFocus)\n const onFocus = () => {\n setFocused(true)\n refresh()\n }\n const onBlur = () => {\n setFocused(false)\n refresh()\n }\n const events = [\"keyup\", \"mouseup\", \"input\"] as const\n for (const ev of events) el.addEventListener(ev, refresh)\n el.addEventListener(\"focus\", onFocus)\n el.addEventListener(\"blur\", onBlur)\n return () => {\n for (const ev of events) el.removeEventListener(ev, refresh)\n el.removeEventListener(\"focus\", onFocus)\n el.removeEventListener(\"blur\", onBlur)\n }\n }, [view])\n\n // \"dynamic\" fades the bar out while nothing is focused, so it doesn't sit\n // over the content while the caret is elsewhere (e.g. scrolling to read).\n const dynamicHidden = Boolean(sticky) && stickyVisibility === \"dynamic\" && !focused\n\n // `state.selection` never follows the caret into an editable table cell's\n // `contentEditable` DOM (see `extension.ts`'s mousedown handler), so a\n // built-in command's own `disabled` / `isActive` would otherwise read a\n // selection that may point anywhere else in the document while the user is\n // actually typing in a cell. `resolveForCell` below re-derives both from the\n // real DOM focus in that case instead.\n const inCell = view ? Boolean(activeTableCell(view)) : false\n\n const className = [\n styles.toolbar,\n sticky && styles.toolbarSticky,\n sticky === \"top\" && styles.toolbarStickyTop,\n sticky === \"bottom\" && styles.toolbarStickyBottom,\n dynamicHidden && styles.toolbarStickyHidden,\n ]\n .filter(Boolean)\n .join(\" \")\n // `transform`, not `bottom` — a `position: fixed` element repositioned via\n // `bottom` doesn't reliably repaint in step with the keyboard animation on\n // iOS Safari; `translateY` forces a compositor update on every\n // `visualViewport` event instead. The bar's resting position (keyboard\n // closed) is `bottom: 0` in CSS; this only nudges it up. `\"top\"` needs no\n // offset at all.\n const stickyStyle =\n sticky === \"bottom\" ? { transform: `translateY(-${keyboardInset}px)` } : undefined\n\n return (\n <div\n ref={barRef}\n className={className}\n role=\"toolbar\"\n aria-label=\"Formatting\"\n aria-hidden={dynamicHidden || undefined}\n style={stickyStyle}\n >\n {groupItems(items).map((group, i) => {\n if (group === \"|\") {\n return <span key={`sep-${i}`} className={styles.toolbarSep} aria-hidden=\"true\" />\n }\n return (\n <div key={`group-${i}`} className={styles.toolbarGroup}>\n {group.map((item) => {\n const btn = toButton(item, icons)\n if (!btn) return null\n // Only a built-in command is cell-aware — a host's own\n // `ToolbarCustomItem` keeps reading `state` exactly as before;\n // it has no notion of a table cell to degrade into.\n const builtin = typeof item === \"string\" ? BUILTIN_BY_ID[item] : undefined\n const resolved = view\n ? builtin\n ? resolveForCell(view.state, builtin, inCell)\n : {\n disabled: Boolean(btn.disabled?.(view.state)),\n active: Boolean(btn.isActive?.(view.state)),\n }\n : { disabled: true, active: false }\n const off = disabled || !view || resolved.disabled\n const active = !off && resolved.active\n return (\n <button\n key={btn.key}\n type=\"button\"\n className={styles.toolbarButton}\n data-command={btn.key}\n title={btn.title}\n aria-label={btn.title}\n aria-pressed={btn.isActive ? active : undefined}\n data-active={active ? \"\" : undefined}\n disabled={off}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n if (!view) return\n btn.run(view)\n refresh()\n }}\n >\n {btn.icon}\n </button>\n )\n })}\n </div>\n )\n })}\n </div>\n )\n}\n","import { forwardRef, Suspense, useEffect, useImperativeHandle, useRef, useState } from \"react\"\nimport { EditorView } from \"@codemirror/view\"\nimport { SourceView } from \"./editor/SourceView\"\nimport { LazyInPlaceView } from \"./inplace/lazyInPlace\"\nimport { LazyPreview } from \"./render/lazyPreview\"\nimport { SplitView } from \"./SplitView\"\nimport styles from \"./styles/stylo.module.css\"\nimport { Toolbar } from \"./toolbar/Toolbar\"\nimport { resolveToolbarItems } from \"./toolbar/config\"\nimport { splitFrontmatter } from \"./frontmatter\"\nimport { invalidateEmbed } from \"./render/embed-cache\"\nimport \"./styles/tokens.css\"\nimport type { ResolveErrorInfo, StyloHandle, StyloProps } from \"./types\"\n\n/**\n * Plain-text-first Markdown editor. `value` is the canonical Markdown string;\n * every view is a pure function of it.\n *\n * The default `mode` is `in-place`, the live decoration canvas (ADR-002 §1,\n * ADR-004). Pass `mode=\"source\"` for the plain surface with no lazy render\n * chunk. `preview` and `split` are also available.\n *\n * A formatting `toolbar` sits above every editing surface (all modes but\n * `preview`); pass `toolbar={false}` to drop it or a `ToolbarConfig` to trim it.\n */\nexport const Stylo = forwardRef<StyloHandle, StyloProps>(function Stylo(\n {\n value,\n onChange,\n mode = \"in-place\",\n onSave,\n onFrontmatter,\n onWikiLinkClick,\n onLinkClick,\n readOnly,\n placeholder,\n className,\n inPlace,\n codeLanguages,\n wikiLinkSource,\n tagSource,\n embedSource,\n onResolveError,\n toolbar,\n icons,\n frontmatter,\n softBreaks,\n onTaskToggle,\n canvasHeader,\n extensions,\n },\n ref,\n) {\n const resolved = mode === \"preview\" || mode === \"split\" || mode === \"in-place\" ? mode : \"source\"\n\n const [view, setView] = useState<EditorView | null>(null)\n const toolbarItems = resolved === \"preview\" ? null : resolveToolbarItems(toolbar)\n const toolbarConfig = toolbar && typeof toolbar === \"object\" ? toolbar : undefined\n const toolbarRender = toolbarConfig?.render\n const stickyToolbar: \"top\" | \"bottom\" | false =\n toolbarConfig?.sticky === \"top\" ? \"top\" : toolbarConfig?.sticky ? \"bottom\" : false\n const stickyVisibility = toolbarConfig?.stickyVisibility\n\n // Report the raw frontmatter block on mount and whenever it changes. Stylo\n // does not parse it — the host passes `raw` to its own YAML parser.\n const onFrontmatterRef = useRef(onFrontmatter)\n onFrontmatterRef.current = onFrontmatter\n\n // Stable wrapper so a changed `onResolveError` needs no editor rebuild and\n // does not thrash the embed effect. Passed to every surface.\n const onResolveErrorRef = useRef(onResolveError)\n onResolveErrorRef.current = onResolveError\n const resolveError = useRef((error: unknown, info: ResolveErrorInfo) => {\n onResolveErrorRef.current?.(error, info)\n }).current\n\n // Read by `invalidateEmbed` below — kept current without needing the\n // imperative handle itself to be rebuilt when `embedSource` changes.\n const embedSourceRef = useRef(embedSource)\n embedSourceRef.current = embedSource\n const lastFrontmatter = useRef<string | null | undefined>(undefined)\n useEffect(() => {\n const raw = splitFrontmatter(value)?.frontmatter ?? null\n if (raw === lastFrontmatter.current) return\n lastFrontmatter.current = raw\n onFrontmatterRef.current?.(raw)\n }, [value])\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => view?.focus(),\n getView: () => view,\n insertAtCursor: (md) => {\n if (!view) return\n view.dispatch(view.state.replaceSelection(md))\n view.focus()\n },\n scrollToHeading: (text) => {\n if (!view) return false\n const target = text.trim().toLowerCase()\n const { doc } = view.state\n for (let n = 1; n <= doc.lines; n++) {\n const line = doc.line(n)\n const m = /^ {0,3}#{1,6}[ \\t]+(.*?)(?:[ \\t]+#+)?[ \\t]*$/.exec(line.text)\n if (!m || m[1] === undefined) continue\n if (m[1].trim().toLowerCase() !== target) continue\n view.dispatch({\n selection: { anchor: line.from },\n effects: EditorView.scrollIntoView(line.from, { y: \"start\" }),\n })\n view.focus()\n return true\n }\n return false\n },\n invalidateEmbed: (ref) => {\n const source = embedSourceRef.current\n if (source) invalidateEmbed(source, ref)\n },\n }),\n [view],\n )\n\n const rootClass = [\n styles.root,\n stickyToolbar === \"bottom\" && styles.stickyToolbarRootBottom,\n stickyToolbar === \"top\" && styles.stickyToolbarRootTop,\n \"stylo\",\n className,\n ]\n .filter(Boolean)\n .join(\" \")\n\n return (\n <div className={rootClass} data-stylo-mode={resolved}>\n {toolbarItems &&\n (() => {\n const bar = (\n <Toolbar\n view={view}\n items={toolbarItems}\n icons={icons}\n disabled={readOnly}\n sticky={stickyToolbar}\n stickyVisibility={stickyVisibility}\n />\n )\n return toolbarRender ? toolbarRender(bar, { view }) : bar\n })()}\n\n {resolved === \"source\" && (\n <SourceView\n value={value}\n onChange={onChange}\n readOnly={readOnly}\n placeholder={placeholder}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n onResolveError={resolveError}\n onSave={onSave}\n onViewChange={setView}\n canvasHeader={canvasHeader}\n hostExtensions={extensions}\n />\n )}\n\n {resolved === \"preview\" && (\n <Suspense fallback={<div className={styles.preview} aria-busy=\"true\" />}>\n <LazyPreview\n value={value}\n onWikiLinkClick={onWikiLinkClick}\n embedSource={embedSource}\n onResolveError={resolveError}\n frontmatter={frontmatter}\n codeLanguages={codeLanguages}\n softBreaks={softBreaks}\n onTaskToggle={onTaskToggle}\n />\n </Suspense>\n )}\n\n {resolved === \"split\" && (\n <SplitView\n value={value}\n onChange={onChange}\n onWikiLinkClick={onWikiLinkClick}\n readOnly={readOnly}\n placeholder={placeholder}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n embedSource={embedSource}\n onResolveError={resolveError}\n frontmatter={frontmatter}\n softBreaks={softBreaks}\n onTaskToggle={onTaskToggle}\n onSave={onSave}\n onViewChange={setView}\n canvasHeader={canvasHeader}\n hostExtensions={extensions}\n />\n )}\n\n {resolved === \"in-place\" && (\n <Suspense fallback={<div className={styles.inplace} aria-busy=\"true\" />}>\n <LazyInPlaceView\n value={value}\n onChange={onChange}\n readOnly={readOnly}\n placeholder={placeholder}\n onWikiLinkClick={onWikiLinkClick}\n onLinkClick={onLinkClick}\n inPlace={inPlace}\n codeLanguages={codeLanguages}\n wikiLinkSource={wikiLinkSource}\n tagSource={tagSource}\n embedSource={embedSource}\n onResolveError={resolveError}\n onSave={onSave}\n onViewChange={setView}\n canvasHeader={canvasHeader}\n hostExtensions={extensions}\n />\n </Suspense>\n )}\n </div>\n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AGF,MAAa,cACZ,kBAAC,GAAD;IAAU,UAAU,kBAAC,OAAD;KAAK,WAAW,EAAO;KAAS,aAAU;IAAQ,CAAA;IACpE,UAAA,kBAAC,GAAD;KACS;KACG;KACA;KACG;KACI;KACJ;KACJ;KACM;KACC;KACL;KACE;KACb,gBAAgB;KACR;KACR,cAAc;KACA;KACd,gBAAgB;IACjB,CAAA;GACO,CAAA;EAET;;AAET,CAAC;AAED,EAAM,cAAc"}
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { Language, LanguageDescription } from "@codemirror/language";
3
+ import type { Extension } from "@codemirror/state";
3
4
  import type { EditorView } from "@codemirror/view";
4
5
  import type { EmbedSource, ResolveErrorInfo, TagSource, WikiLinkSource } from "./sources";
5
6
  import type { InPlaceConfig } from "./inplace";
@@ -148,6 +149,14 @@ export interface StyloProps {
148
149
  placeholder?: string;
149
150
  /** Extra class on the root element, alongside the internal classes. */
150
151
  className?: string;
152
+ /**
153
+ * CodeMirror extensions appended after Stylo's own, on every editing surface
154
+ * (`source`, `in-place`, and `split`'s source pane). Reactive: a changed array
155
+ * reconfigures the live view with no remount, so the cursor, undo history and
156
+ * scroll position survive. Compared shallowly — pass a stable identity
157
+ * (`useMemo`) when nothing changed. Ignored in `preview`, which has no editor.
158
+ */
159
+ extensions?: readonly Extension[];
151
160
  /**
152
161
  * Host content docked inside the editing surface (`source`, `in-place`,
153
162
  * `split`'s source pane; never `preview`) — after the find/replace panel,
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,SA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