@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.
Files changed (79) hide show
  1. package/README.md +1 -1
  2. package/dist/{InPlaceView-DVX9qV68.js → InPlaceView-CRb5AkfX.js} +781 -743
  3. package/dist/InPlaceView-CRb5AkfX.js.map +1 -0
  4. package/dist/Preview-5lm2uUVj.js +319 -0
  5. package/dist/Preview-5lm2uUVj.js.map +1 -0
  6. package/dist/SplitView.d.ts +4 -1
  7. package/dist/SplitView.d.ts.map +1 -1
  8. package/dist/Stylo.d.ts.map +1 -1
  9. package/dist/editor/SourceView.d.ts +4 -1
  10. package/dist/editor/SourceView.d.ts.map +1 -1
  11. package/dist/editor/theme.d.ts.map +1 -1
  12. package/dist/editor/useCodeMirror.d.ts +7 -1
  13. package/dist/editor/useCodeMirror.d.ts.map +1 -1
  14. package/dist/embed-DKKeCE1Y.js +109 -0
  15. package/dist/embed-DKKeCE1Y.js.map +1 -0
  16. package/dist/{highlight-BLdNzTxQ.js → embed-cache-CcBfVrc9.js} +47 -4
  17. package/dist/embed-cache-CcBfVrc9.js.map +1 -0
  18. package/dist/inplace/InPlaceView.d.ts +4 -1
  19. package/dist/inplace/InPlaceView.d.ts.map +1 -1
  20. package/dist/inplace/context-menu-helpers.d.ts +3 -4
  21. package/dist/inplace/context-menu-helpers.d.ts.map +1 -1
  22. package/dist/inplace/decorate.d.ts.map +1 -1
  23. package/dist/inplace/edit-line-prefix.d.ts.map +1 -1
  24. package/dist/inplace/embed.d.ts.map +1 -1
  25. package/dist/inplace/extension.d.ts.map +1 -1
  26. package/dist/inplace/inline-md.d.ts.map +1 -1
  27. package/dist/inplace/link-row.d.ts +14 -13
  28. package/dist/inplace/link-row.d.ts.map +1 -1
  29. package/dist/inplace/list-guides.d.ts.map +1 -1
  30. package/dist/inplace/math.d.ts +18 -3
  31. package/dist/inplace/math.d.ts.map +1 -1
  32. package/dist/inplace/table-widget-keys.d.ts +46 -0
  33. package/dist/inplace/table-widget-keys.d.ts.map +1 -0
  34. package/dist/inplace/table-widget.d.ts +1 -2
  35. package/dist/inplace/table-widget.d.ts.map +1 -1
  36. package/dist/inplace/tables.d.ts.map +1 -1
  37. package/dist/inplace/wikilinks.d.ts +1 -1
  38. package/dist/inplace/wikilinks.d.ts.map +1 -1
  39. package/dist/render/Embed.d.ts.map +1 -1
  40. package/dist/render/Preview.d.ts.map +1 -1
  41. package/dist/render/embed-cache.d.ts +13 -0
  42. package/dist/render/embed-cache.d.ts.map +1 -1
  43. package/dist/render/preview-components.d.ts +22 -0
  44. package/dist/render/preview-components.d.ts.map +1 -0
  45. package/dist/render/remark-wikilink.d.ts.map +1 -1
  46. package/dist/render/taskCheckbox.d.ts +30 -0
  47. package/dist/render/taskCheckbox.d.ts.map +1 -1
  48. package/dist/stylo.js +213 -196
  49. package/dist/stylo.js.map +1 -1
  50. package/dist/toolbar/Toolbar.d.ts.map +1 -1
  51. package/dist/toolbar/command-helpers.d.ts +27 -0
  52. package/dist/toolbar/command-helpers.d.ts.map +1 -1
  53. package/dist/toolbar/heading.d.ts +3 -0
  54. package/dist/toolbar/heading.d.ts.map +1 -1
  55. package/dist/toolbar/inline-ops.d.ts +6 -0
  56. package/dist/toolbar/inline-ops.d.ts.map +1 -1
  57. package/dist/toolbar/table.d.ts.map +1 -1
  58. package/dist/types/core.d.ts +209 -0
  59. package/dist/types/core.d.ts.map +1 -0
  60. package/dist/types/inplace.d.ts +91 -0
  61. package/dist/types/inplace.d.ts.map +1 -0
  62. package/dist/types/sources.d.ts +66 -0
  63. package/dist/types/sources.d.ts.map +1 -0
  64. package/dist/types/toolbar.d.ts +72 -0
  65. package/dist/types/toolbar.d.ts.map +1 -0
  66. package/dist/types.d.ts +11 -406
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/{useCodeMirror-CXtuBlLf.js → useCodeMirror-B07wRexo.js} +317 -268
  69. package/dist/useCodeMirror-B07wRexo.js.map +1 -0
  70. package/package.json +4 -4
  71. package/dist/InPlaceView-DVX9qV68.js.map +0 -1
  72. package/dist/Preview-BcdSr09-.js +0 -304
  73. package/dist/Preview-BcdSr09-.js.map +0 -1
  74. package/dist/embed-Dsu6b-MV.js +0 -131
  75. package/dist/embed-Dsu6b-MV.js.map +0 -1
  76. package/dist/highlight-BLdNzTxQ.js.map +0 -1
  77. package/dist/inplace/table-widget-caret.d.ts +0 -11
  78. package/dist/inplace/table-widget-caret.d.ts.map +0 -1
  79. package/dist/useCodeMirror-CXtuBlLf.js.map +0 -1
package/dist/stylo.js CHANGED
@@ -1,94 +1,96 @@
1
- import { i as e, o as t } from "./highlight-BLdNzTxQ.js";
2
- import { S as n, n as r, t as i } from "./useCodeMirror-CXtuBlLf.js";
3
- import { n as a, r as o } from "./config-DTBxVhtH.js";
4
- import { Suspense as s, forwardRef as c, lazy as l, useEffect as u, useImperativeHandle as d, useReducer as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
5
- import { EditorView as g, showPanel as _ } from "@codemirror/view";
6
- import { createPortal as v } from "react-dom";
7
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
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-B07wRexo.js";
3
+ import { n as c, r as l } from "./config-DTBxVhtH.js";
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
+ import { EditorView as y, showPanel as b } from "@codemirror/view";
6
+ import { createPortal as x } from "react-dom";
7
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
8
  //#region src/editor/SourceView.tsx
9
- var x = () => () => {}, S = () => null;
10
- function C({ value: e, onChange: r, readOnly: a, placeholder: o, codeLanguages: s, wikiLinkSource: c, tagSource: l, onResolveError: u, onSave: d, onViewChange: f, canvasHeader: g }) {
11
- let [b, C] = m(null), w = p(f);
12
- w.current = f;
13
- let T = p((e) => {
14
- C(e), w.current?.(e);
15
- }).current, E = p(g);
16
- E.current = g;
17
- let [D] = m(() => g ? new n() : null), O = h(D?.subscribe ?? x, D?.getSnapshot ?? S), [k] = m(() => D ? [_.of(D.panel)] : []), A = i({
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, 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
- onChange: r,
20
- readOnly: a,
21
- placeholder: o,
22
- codeLanguages: s,
19
+ onChange: t,
20
+ readOnly: r,
21
+ placeholder: a,
22
+ codeLanguages: o,
23
23
  wikiLinkSource: c,
24
24
  tagSource: l,
25
25
  onResolveError: u,
26
26
  onSave: d,
27
- onViewChange: T,
28
- extensions: k
27
+ onViewChange: E,
28
+ hostExtensions: m,
29
+ extensions: A
29
30
  });
30
- return /* @__PURE__ */ y("div", {
31
- className: t.source,
32
- ref: A,
33
- children: O && E.current && v(E.current({ view: b }), O)
31
+ return /* @__PURE__ */ S("div", {
32
+ className: n.source,
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 w = l(async () => ({ default: (await import("./InPlaceView-DVX9qV68.js")).InPlaceView })), T = l(async () => ({ default: (await import("./Preview-BcdSr09-.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 E({ value: e, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: o, wikiLinkSource: c, tagSource: l, embedSource: d, onResolveError: f, frontmatter: h, softBreaks: g, onTaskToggle: _, onSave: v, onViewChange: x, canvasHeader: S }) {
42
- let [w, E] = m(null), D = p(null), O = p(!1);
43
- return u(() => {
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);
44
+ return p(() => {
44
45
  let e = w?.scrollDOM, t = D.current;
45
46
  if (!e || !t) return;
46
47
  let n = (e, t) => {
47
- if (O.current) return;
48
+ if (k.current) return;
48
49
  let n = e.scrollHeight - e.clientHeight;
49
- n <= 0 || (O.current = !0, t.scrollTop = e.scrollTop / n * (t.scrollHeight - t.clientHeight), requestAnimationFrame(() => {
50
- O.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
- }, [w]), /* @__PURE__ */ b("div", {
57
- className: t.split,
58
- children: [/* @__PURE__ */ y("div", {
59
- className: t.splitPane,
60
- children: /* @__PURE__ */ y(C, {
57
+ }, [w]), /* @__PURE__ */ C("div", {
58
+ className: n.split,
59
+ children: [/* @__PURE__ */ S("div", {
60
+ className: n.splitPane,
61
+ children: /* @__PURE__ */ S(E, {
61
62
  value: e,
62
- onChange: n,
63
+ onChange: t,
63
64
  readOnly: i,
64
65
  placeholder: a,
65
66
  codeLanguages: o,
66
- wikiLinkSource: c,
67
- tagSource: l,
68
- onResolveError: f,
67
+ wikiLinkSource: s,
68
+ tagSource: c,
69
+ onResolveError: d,
69
70
  onSave: v,
70
71
  onViewChange: (e) => {
71
- E(e), x?.(e);
72
+ T(e), y?.(e);
72
73
  },
73
- canvasHeader: S
74
+ canvasHeader: b,
75
+ hostExtensions: x
74
76
  })
75
- }), /* @__PURE__ */ y("div", {
76
- className: t.splitPane,
77
+ }), /* @__PURE__ */ S("div", {
78
+ className: n.splitPane,
77
79
  ref: D,
78
- children: /* @__PURE__ */ y(s, {
79
- fallback: /* @__PURE__ */ y("div", {
80
- className: t.preview,
80
+ children: /* @__PURE__ */ S(u, {
81
+ fallback: /* @__PURE__ */ S("div", {
82
+ className: n.preview,
81
83
  "aria-busy": "true"
82
84
  }),
83
- children: /* @__PURE__ */ y(T, {
85
+ children: /* @__PURE__ */ S(O, {
84
86
  value: e,
85
87
  onWikiLinkClick: r,
86
- embedSource: d,
87
- onResolveError: f,
88
- frontmatter: h,
88
+ embedSource: l,
89
+ onResolveError: d,
90
+ frontmatter: f,
89
91
  codeLanguages: o,
90
- softBreaks: g,
91
- onTaskToggle: _
92
+ softBreaks: m,
93
+ onTaskToggle: h
92
94
  })
93
95
  })
94
96
  })]
@@ -96,8 +98,8 @@ function E({ value: e, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder
96
98
  }
97
99
  //#endregion
98
100
  //#region src/toolbar/floating-watchdog.ts
99
- function D(e, t) {
100
- u(() => {
101
+ function A(e, t) {
102
+ p(() => {
101
103
  if (!t) return;
102
104
  let n = 0, r = !1, i = () => {
103
105
  let t = e.current;
@@ -108,9 +110,9 @@ function D(e, t) {
108
110
  }
109
111
  //#endregion
110
112
  //#region src/toolbar/keyboard-inset.ts
111
- function O(e) {
112
- let [t, n] = m(0);
113
- return u(() => {
113
+ function j(e) {
114
+ let [t, n] = _(0);
115
+ return p(() => {
114
116
  let t = typeof window > "u" ? null : window.visualViewport;
115
117
  if (!e || !t) {
116
118
  n(0);
@@ -124,7 +126,7 @@ function O(e) {
124
126
  }
125
127
  //#endregion
126
128
  //#region src/toolbar/Toolbar.tsx
127
- function k(e) {
129
+ function M(e) {
128
130
  let t = [], n = [];
129
131
  for (let r of e) {
130
132
  if (r !== "|") {
@@ -135,7 +137,7 @@ function k(e) {
135
137
  }
136
138
  return n.length && t.push(n), t;
137
139
  }
138
- function A(e, t) {
140
+ function N(e, t) {
139
141
  if (typeof e != "string") {
140
142
  let { id: t, icon: n, title: r, run: i, isActive: a, disabled: o } = e;
141
143
  return {
@@ -147,208 +149,223 @@ function A(e, t) {
147
149
  disabled: o
148
150
  };
149
151
  }
150
- let n = r[e];
152
+ let n = o[e];
151
153
  return n ? {
152
154
  key: e,
153
- icon: t?.[e] ?? o[e],
155
+ icon: t?.[e] ?? l[e],
154
156
  title: n.title,
155
157
  run: n.run,
156
158
  isActive: n.isActive,
157
159
  disabled: n.disabled
158
160
  } : null;
159
161
  }
160
- function j({ view: e, items: n, icons: r, disabled: i, sticky: a, stickyVisibility: o }) {
161
- let [, s] = f((e) => e + 1, 0), [c, l] = m(!1), d = O(a === "bottom"), h = p(null);
162
- D(h, a === "top"), u(() => {
162
+ function P({ view: e, items: t, icons: i, disabled: s, sticky: c, stickyVisibility: l }) {
163
+ let [, u] = h((e) => e + 1, 0), [d, f] = _(!1), m = j(c === "bottom"), v = g(null);
164
+ A(v, c === "top"), p(() => {
163
165
  if (!e) return;
164
166
  let t = e.contentDOM;
165
- l(e.hasFocus);
167
+ f(e.hasFocus);
166
168
  let n = () => {
167
- l(!0), s();
169
+ f(!0), u();
168
170
  }, r = () => {
169
- l(!1), s();
171
+ f(!1), u();
170
172
  }, i = [
171
173
  "keyup",
172
174
  "mouseup",
173
175
  "input"
174
176
  ];
175
- for (let e of i) t.addEventListener(e, s);
177
+ for (let e of i) t.addEventListener(e, u);
176
178
  return t.addEventListener("focus", n), t.addEventListener("blur", r), () => {
177
- for (let e of i) t.removeEventListener(e, s);
179
+ for (let e of i) t.removeEventListener(e, u);
178
180
  t.removeEventListener("focus", n), t.removeEventListener("blur", r);
179
181
  };
180
182
  }, [e]);
181
- let g = !!a && o === "dynamic" && !c, _ = [
182
- t.toolbar,
183
- a && t.toolbarSticky,
184
- a === "top" && t.toolbarStickyTop,
185
- a === "bottom" && t.toolbarStickyBottom,
186
- g && t.toolbarStickyHidden
187
- ].filter(Boolean).join(" "), v = a === "bottom" ? { transform: `translateY(-${d}px)` } : void 0;
188
- return /* @__PURE__ */ y("div", {
189
- ref: h,
190
- className: _,
183
+ let y = !!c && l === "dynamic" && !d, b = e ? !!r(e) : !1, x = [
184
+ n.toolbar,
185
+ c && n.toolbarSticky,
186
+ c === "top" && n.toolbarStickyTop,
187
+ c === "bottom" && n.toolbarStickyBottom,
188
+ y && n.toolbarStickyHidden
189
+ ].filter(Boolean).join(" "), C = c === "bottom" ? { transform: `translateY(-${m}px)` } : void 0;
190
+ return /* @__PURE__ */ S("div", {
191
+ ref: v,
192
+ className: x,
191
193
  role: "toolbar",
192
194
  "aria-label": "Formatting",
193
- "aria-hidden": g || void 0,
194
- style: v,
195
- children: k(n).map((n, a) => n === "|" ? /* @__PURE__ */ y("span", {
196
- className: t.toolbarSep,
195
+ "aria-hidden": y || void 0,
196
+ style: C,
197
+ children: M(t).map((t, r) => t === "|" ? /* @__PURE__ */ S("span", {
198
+ className: n.toolbarSep,
197
199
  "aria-hidden": "true"
198
- }, `sep-${a}`) : /* @__PURE__ */ y("div", {
199
- className: t.toolbarGroup,
200
- children: n.map((n) => {
201
- let a = A(n, r);
202
- if (!a) return null;
203
- let o = i || !e || !!a.disabled?.(e.state), c = !!(!o && e && a.isActive?.(e.state));
204
- return /* @__PURE__ */ y("button", {
200
+ }, `sep-${r}`) : /* @__PURE__ */ S("div", {
201
+ className: n.toolbarGroup,
202
+ children: t.map((t) => {
203
+ let r = N(t, i);
204
+ if (!r) return null;
205
+ let c = typeof t == "string" ? o[t] : void 0, l = e ? c ? a(e.state, c, b) : {
206
+ disabled: !!r.disabled?.(e.state),
207
+ active: !!r.isActive?.(e.state)
208
+ } : {
209
+ disabled: !0,
210
+ active: !1
211
+ }, d = s || !e || l.disabled, f = !d && l.active;
212
+ return /* @__PURE__ */ S("button", {
205
213
  type: "button",
206
- className: t.toolbarButton,
207
- "data-command": a.key,
208
- title: a.title,
209
- "aria-label": a.title,
210
- "aria-pressed": a.isActive ? c : void 0,
211
- "data-active": c ? "" : void 0,
212
- disabled: o,
214
+ className: n.toolbarButton,
215
+ "data-command": r.key,
216
+ title: r.title,
217
+ "aria-label": r.title,
218
+ "aria-pressed": r.isActive ? f : void 0,
219
+ "data-active": f ? "" : void 0,
220
+ disabled: d,
213
221
  onMouseDown: (e) => e.preventDefault(),
214
222
  onClick: () => {
215
- e && (a.run(e), s());
223
+ e && (r.run(e), u());
216
224
  },
217
- children: a.icon
218
- }, a.key);
225
+ children: r.icon
226
+ }, r.key);
219
227
  })
220
- }, `group-${a}`))
228
+ }, `group-${r}`))
221
229
  });
222
230
  }
223
231
  //#endregion
224
232
  //#region src/Stylo.tsx
225
- var M = c(function({ value: n, onChange: r, mode: i = "in-place", onSave: o, onFrontmatter: c, onWikiLinkClick: l, onLinkClick: f, readOnly: h, placeholder: _, className: v, inPlace: x, codeLanguages: S, wikiLinkSource: D, tagSource: O, embedSource: k, onResolveError: A, toolbar: M, icons: N, frontmatter: P, softBreaks: F, onTaskToggle: I, canvasHeader: L }, R) {
226
- let z = i === "preview" || i === "split" || i === "in-place" ? i : "source", [B, V] = m(null), H = z === "preview" ? null : a(M), U = M && typeof M == "object" ? M.render : void 0, W = M && typeof M == "object" ? M.sticky : void 0, G = W === "top" ? "top" : W ? "bottom" : !1, K = M && typeof M == "object" ? M.stickyVisibility : void 0, q = p(c);
227
- q.current = c;
228
- let J = p(A);
229
- J.current = A;
230
- let Y = p((e, t) => {
231
- J.current?.(e, t);
232
- }).current, X = p(void 0);
233
- u(() => {
234
- let t = e(n)?.frontmatter ?? null;
235
- t !== X.current && (X.current = t, q.current?.(t));
236
- }, [n]), d(R, () => ({
237
- focus: () => B?.focus(),
238
- getView: () => B,
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);
243
+ p(() => {
244
+ let t = e(r)?.frontmatter ?? null;
245
+ t !== $.current && ($.current = t, Y.current?.(t));
246
+ }, [r]), m(B, () => ({
247
+ focus: () => H?.focus(),
248
+ getView: () => H,
239
249
  insertAtCursor: (e) => {
240
- B && (B.dispatch(B.state.replaceSelection(e)), B.focus());
250
+ H && (H.dispatch(H.state.replaceSelection(e)), H.focus());
241
251
  },
242
252
  scrollToHeading: (e) => {
243
- if (!B) return !1;
244
- let t = e.trim().toLowerCase(), { doc: n } = B.state;
253
+ if (!H) return !1;
254
+ let t = e.trim().toLowerCase(), { doc: n } = H.state;
245
255
  for (let e = 1; e <= n.lines; e++) {
246
256
  let r = n.line(e), i = /^ {0,3}#{1,6}[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(r.text);
247
- if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return B.dispatch({
257
+ if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return H.dispatch({
248
258
  selection: { anchor: r.from },
249
- effects: g.scrollIntoView(r.from, { y: "start" })
250
- }), B.focus(), !0;
259
+ effects: y.scrollIntoView(r.from, { y: "start" })
260
+ }), H.focus(), !0;
251
261
  }
252
262
  return !1;
263
+ },
264
+ invalidateEmbed: (e) => {
265
+ let n = Q.current;
266
+ n && t(n, e);
253
267
  }
254
- }), [B]);
255
- let Z = [
256
- t.root,
257
- G === "bottom" && t.stickyToolbarRootBottom,
258
- G === "top" && t.stickyToolbarRootTop,
268
+ }), [H]);
269
+ let ee = [
270
+ n.root,
271
+ q === "bottom" && n.stickyToolbarRootBottom,
272
+ q === "top" && n.stickyToolbarRootTop,
259
273
  "stylo",
260
274
  v
261
275
  ].filter(Boolean).join(" ");
262
- return /* @__PURE__ */ b("div", {
263
- className: Z,
264
- "data-stylo-mode": z,
276
+ return /* @__PURE__ */ C("div", {
277
+ className: ee,
278
+ "data-stylo-mode": V,
265
279
  children: [
266
- H && (() => {
267
- let e = /* @__PURE__ */ y(j, {
268
- view: B,
269
- items: H,
280
+ W && (() => {
281
+ let e = /* @__PURE__ */ S(P, {
282
+ view: H,
283
+ items: W,
270
284
  icons: N,
271
- disabled: h,
272
- sticky: G,
273
- stickyVisibility: K
285
+ disabled: f,
286
+ sticky: q,
287
+ stickyVisibility: J
274
288
  });
275
- return U ? U(e, { view: B }) : e;
289
+ return K ? K(e, { view: H }) : e;
276
290
  })(),
277
- z === "source" && /* @__PURE__ */ y(C, {
278
- value: n,
279
- onChange: r,
280
- readOnly: h,
281
- placeholder: _,
282
- codeLanguages: S,
283
- wikiLinkSource: D,
284
- tagSource: O,
285
- onResolveError: Y,
291
+ V === "source" && /* @__PURE__ */ S(E, {
292
+ value: r,
293
+ onChange: i,
294
+ readOnly: f,
295
+ placeholder: h,
296
+ codeLanguages: x,
297
+ wikiLinkSource: w,
298
+ tagSource: T,
299
+ onResolveError: Z,
286
300
  onSave: o,
287
- onViewChange: V,
288
- canvasHeader: L
301
+ onViewChange: U,
302
+ canvasHeader: R,
303
+ hostExtensions: z
289
304
  }),
290
- z === "preview" && /* @__PURE__ */ y(s, {
291
- fallback: /* @__PURE__ */ y("div", {
292
- className: t.preview,
305
+ V === "preview" && /* @__PURE__ */ S(u, {
306
+ fallback: /* @__PURE__ */ S("div", {
307
+ className: n.preview,
293
308
  "aria-busy": "true"
294
309
  }),
295
- children: /* @__PURE__ */ y(T, {
296
- value: n,
310
+ children: /* @__PURE__ */ S(O, {
311
+ value: r,
297
312
  onWikiLinkClick: l,
298
- embedSource: k,
299
- onResolveError: Y,
300
- frontmatter: P,
301
- codeLanguages: S,
302
- softBreaks: F,
303
- onTaskToggle: I
313
+ embedSource: A,
314
+ onResolveError: Z,
315
+ frontmatter: F,
316
+ codeLanguages: x,
317
+ softBreaks: I,
318
+ onTaskToggle: L
304
319
  })
305
320
  }),
306
- z === "split" && /* @__PURE__ */ y(E, {
307
- value: n,
308
- onChange: r,
321
+ V === "split" && /* @__PURE__ */ S(k, {
322
+ value: r,
323
+ onChange: i,
309
324
  onWikiLinkClick: l,
310
- readOnly: h,
311
- placeholder: _,
312
- codeLanguages: S,
313
- wikiLinkSource: D,
314
- tagSource: O,
315
- embedSource: k,
316
- onResolveError: Y,
317
- frontmatter: P,
318
- softBreaks: F,
319
- onTaskToggle: I,
325
+ readOnly: f,
326
+ placeholder: h,
327
+ codeLanguages: x,
328
+ wikiLinkSource: w,
329
+ tagSource: T,
330
+ embedSource: A,
331
+ onResolveError: Z,
332
+ frontmatter: F,
333
+ softBreaks: I,
334
+ onTaskToggle: L,
320
335
  onSave: o,
321
- onViewChange: V,
322
- canvasHeader: L
336
+ onViewChange: U,
337
+ canvasHeader: R,
338
+ hostExtensions: z
323
339
  }),
324
- z === "in-place" && /* @__PURE__ */ y(s, {
325
- fallback: /* @__PURE__ */ y("div", {
326
- className: t.inplace,
340
+ V === "in-place" && /* @__PURE__ */ S(u, {
341
+ fallback: /* @__PURE__ */ S("div", {
342
+ className: n.inplace,
327
343
  "aria-busy": "true"
328
344
  }),
329
- children: /* @__PURE__ */ y(w, {
330
- value: n,
331
- onChange: r,
332
- readOnly: h,
333
- placeholder: _,
345
+ children: /* @__PURE__ */ S(D, {
346
+ value: r,
347
+ onChange: i,
348
+ readOnly: f,
349
+ placeholder: h,
334
350
  onWikiLinkClick: l,
335
- onLinkClick: f,
336
- inPlace: x,
337
- codeLanguages: S,
338
- wikiLinkSource: D,
339
- tagSource: O,
340
- embedSource: k,
341
- onResolveError: Y,
351
+ onLinkClick: d,
352
+ inPlace: b,
353
+ codeLanguages: x,
354
+ wikiLinkSource: w,
355
+ tagSource: T,
356
+ embedSource: A,
357
+ onResolveError: Z,
342
358
  onSave: o,
343
- onViewChange: V,
344
- canvasHeader: L
359
+ onViewChange: U,
360
+ canvasHeader: R,
361
+ hostExtensions: z
345
362
  })
346
363
  })
347
364
  ]
348
365
  });
349
366
  });
350
- M.displayName = "Stylo";
367
+ F.displayName = "Stylo";
351
368
  //#endregion
352
- export { M as Stylo, e as splitFrontmatter };
369
+ export { F as Stylo, e as splitFrontmatter };
353
370
 
354
371
  //# sourceMappingURL=stylo.js.map