@damiro/stylo 0.15.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{InPlaceView-DVX9qV68.js → InPlaceView-CRb5AkfX.js} +781 -743
- package/dist/InPlaceView-CRb5AkfX.js.map +1 -0
- package/dist/Preview-5lm2uUVj.js +319 -0
- package/dist/Preview-5lm2uUVj.js.map +1 -0
- package/dist/SplitView.d.ts +4 -1
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +4 -1
- package/dist/editor/SourceView.d.ts.map +1 -1
- package/dist/editor/theme.d.ts.map +1 -1
- package/dist/editor/useCodeMirror.d.ts +7 -1
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/embed-DKKeCE1Y.js +109 -0
- package/dist/embed-DKKeCE1Y.js.map +1 -0
- package/dist/{highlight-BLdNzTxQ.js → embed-cache-CcBfVrc9.js} +47 -4
- package/dist/embed-cache-CcBfVrc9.js.map +1 -0
- package/dist/inplace/InPlaceView.d.ts +4 -1
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/context-menu-helpers.d.ts +3 -4
- package/dist/inplace/context-menu-helpers.d.ts.map +1 -1
- package/dist/inplace/decorate.d.ts.map +1 -1
- package/dist/inplace/edit-line-prefix.d.ts.map +1 -1
- package/dist/inplace/embed.d.ts.map +1 -1
- package/dist/inplace/extension.d.ts.map +1 -1
- package/dist/inplace/inline-md.d.ts.map +1 -1
- package/dist/inplace/link-row.d.ts +14 -13
- package/dist/inplace/link-row.d.ts.map +1 -1
- package/dist/inplace/list-guides.d.ts.map +1 -1
- package/dist/inplace/math.d.ts +18 -3
- package/dist/inplace/math.d.ts.map +1 -1
- package/dist/inplace/table-widget-keys.d.ts +46 -0
- package/dist/inplace/table-widget-keys.d.ts.map +1 -0
- package/dist/inplace/table-widget.d.ts +1 -2
- package/dist/inplace/table-widget.d.ts.map +1 -1
- package/dist/inplace/tables.d.ts.map +1 -1
- package/dist/inplace/wikilinks.d.ts +1 -1
- package/dist/inplace/wikilinks.d.ts.map +1 -1
- package/dist/render/Embed.d.ts.map +1 -1
- package/dist/render/Preview.d.ts.map +1 -1
- package/dist/render/embed-cache.d.ts +13 -0
- package/dist/render/embed-cache.d.ts.map +1 -1
- package/dist/render/preview-components.d.ts +22 -0
- package/dist/render/preview-components.d.ts.map +1 -0
- package/dist/render/remark-wikilink.d.ts.map +1 -1
- package/dist/render/taskCheckbox.d.ts +30 -0
- package/dist/render/taskCheckbox.d.ts.map +1 -1
- package/dist/stylo.js +213 -196
- package/dist/stylo.js.map +1 -1
- package/dist/toolbar/Toolbar.d.ts.map +1 -1
- package/dist/toolbar/command-helpers.d.ts +27 -0
- package/dist/toolbar/command-helpers.d.ts.map +1 -1
- package/dist/toolbar/heading.d.ts +3 -0
- package/dist/toolbar/heading.d.ts.map +1 -1
- package/dist/toolbar/inline-ops.d.ts +6 -0
- package/dist/toolbar/inline-ops.d.ts.map +1 -1
- package/dist/toolbar/table.d.ts.map +1 -1
- package/dist/types/core.d.ts +209 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/inplace.d.ts +91 -0
- package/dist/types/inplace.d.ts.map +1 -0
- package/dist/types/sources.d.ts +66 -0
- package/dist/types/sources.d.ts.map +1 -0
- package/dist/types/toolbar.d.ts +72 -0
- package/dist/types/toolbar.d.ts.map +1 -0
- package/dist/types.d.ts +11 -406
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-CXtuBlLf.js → useCodeMirror-B07wRexo.js} +317 -268
- package/dist/useCodeMirror-B07wRexo.js.map +1 -0
- package/package.json +4 -4
- package/dist/InPlaceView-DVX9qV68.js.map +0 -1
- package/dist/Preview-BcdSr09-.js +0 -304
- package/dist/Preview-BcdSr09-.js.map +0 -1
- package/dist/embed-Dsu6b-MV.js +0 -131
- package/dist/embed-Dsu6b-MV.js.map +0 -1
- package/dist/highlight-BLdNzTxQ.js.map +0 -1
- package/dist/inplace/table-widget-caret.d.ts +0 -11
- package/dist/inplace/table-widget-caret.d.ts.map +0 -1
- package/dist/useCodeMirror-CXtuBlLf.js.map +0 -1
package/dist/stylo.js
CHANGED
|
@@ -1,94 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import { Suspense as
|
|
5
|
-
import { EditorView as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { jsx as
|
|
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
|
|
10
|
-
function
|
|
11
|
-
let [
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
}).current,
|
|
16
|
-
|
|
17
|
-
let [
|
|
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:
|
|
20
|
-
readOnly:
|
|
21
|
-
placeholder:
|
|
22
|
-
codeLanguages:
|
|
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:
|
|
28
|
-
|
|
27
|
+
onViewChange: E,
|
|
28
|
+
hostExtensions: m,
|
|
29
|
+
extensions: A
|
|
29
30
|
});
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
className:
|
|
32
|
-
ref:
|
|
33
|
-
children:
|
|
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
|
|
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
|
|
42
|
-
let [w,
|
|
43
|
-
return
|
|
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 (
|
|
48
|
+
if (k.current) return;
|
|
48
49
|
let n = e.scrollHeight - e.clientHeight;
|
|
49
|
-
n <= 0 || (
|
|
50
|
-
|
|
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__ */
|
|
57
|
-
className:
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
-
className:
|
|
60
|
-
children: /* @__PURE__ */
|
|
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:
|
|
63
|
+
onChange: t,
|
|
63
64
|
readOnly: i,
|
|
64
65
|
placeholder: a,
|
|
65
66
|
codeLanguages: o,
|
|
66
|
-
wikiLinkSource:
|
|
67
|
-
tagSource:
|
|
68
|
-
onResolveError:
|
|
67
|
+
wikiLinkSource: s,
|
|
68
|
+
tagSource: c,
|
|
69
|
+
onResolveError: d,
|
|
69
70
|
onSave: v,
|
|
70
71
|
onViewChange: (e) => {
|
|
71
|
-
|
|
72
|
+
T(e), y?.(e);
|
|
72
73
|
},
|
|
73
|
-
canvasHeader:
|
|
74
|
+
canvasHeader: b,
|
|
75
|
+
hostExtensions: x
|
|
74
76
|
})
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
-
className:
|
|
77
|
+
}), /* @__PURE__ */ S("div", {
|
|
78
|
+
className: n.splitPane,
|
|
77
79
|
ref: D,
|
|
78
|
-
children: /* @__PURE__ */
|
|
79
|
-
fallback: /* @__PURE__ */
|
|
80
|
-
className:
|
|
80
|
+
children: /* @__PURE__ */ S(u, {
|
|
81
|
+
fallback: /* @__PURE__ */ S("div", {
|
|
82
|
+
className: n.preview,
|
|
81
83
|
"aria-busy": "true"
|
|
82
84
|
}),
|
|
83
|
-
children: /* @__PURE__ */
|
|
85
|
+
children: /* @__PURE__ */ S(O, {
|
|
84
86
|
value: e,
|
|
85
87
|
onWikiLinkClick: r,
|
|
86
|
-
embedSource:
|
|
87
|
-
onResolveError:
|
|
88
|
-
frontmatter:
|
|
88
|
+
embedSource: l,
|
|
89
|
+
onResolveError: d,
|
|
90
|
+
frontmatter: f,
|
|
89
91
|
codeLanguages: o,
|
|
90
|
-
softBreaks:
|
|
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
|
|
100
|
-
|
|
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
|
|
112
|
-
let [t, n] =
|
|
113
|
-
return
|
|
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
|
|
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
|
|
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 =
|
|
152
|
+
let n = o[e];
|
|
151
153
|
return n ? {
|
|
152
154
|
key: e,
|
|
153
|
-
icon: t?.[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
|
|
161
|
-
let [,
|
|
162
|
-
|
|
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
|
-
|
|
167
|
+
f(e.hasFocus);
|
|
166
168
|
let n = () => {
|
|
167
|
-
|
|
169
|
+
f(!0), u();
|
|
168
170
|
}, r = () => {
|
|
169
|
-
|
|
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,
|
|
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,
|
|
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
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
].filter(Boolean).join(" "),
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
ref:
|
|
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":
|
|
194
|
-
style:
|
|
195
|
-
children:
|
|
196
|
-
className:
|
|
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-${
|
|
199
|
-
className:
|
|
200
|
-
children:
|
|
201
|
-
let
|
|
202
|
-
if (!
|
|
203
|
-
let
|
|
204
|
-
|
|
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:
|
|
207
|
-
"data-command":
|
|
208
|
-
title:
|
|
209
|
-
"aria-label":
|
|
210
|
-
"aria-pressed":
|
|
211
|
-
"data-active":
|
|
212
|
-
disabled:
|
|
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 && (
|
|
223
|
+
e && (r.run(e), u());
|
|
216
224
|
},
|
|
217
|
-
children:
|
|
218
|
-
},
|
|
225
|
+
children: r.icon
|
|
226
|
+
}, r.key);
|
|
219
227
|
})
|
|
220
|
-
}, `group-${
|
|
228
|
+
}, `group-${r}`))
|
|
221
229
|
});
|
|
222
230
|
}
|
|
223
231
|
//#endregion
|
|
224
232
|
//#region src/Stylo.tsx
|
|
225
|
-
var
|
|
226
|
-
let
|
|
227
|
-
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
let
|
|
231
|
-
|
|
232
|
-
}).current,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
250
|
+
H && (H.dispatch(H.state.replaceSelection(e)), H.focus());
|
|
241
251
|
},
|
|
242
252
|
scrollToHeading: (e) => {
|
|
243
|
-
if (!
|
|
244
|
-
let t = e.trim().toLowerCase(), { doc: n } =
|
|
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
|
|
257
|
+
if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return H.dispatch({
|
|
248
258
|
selection: { anchor: r.from },
|
|
249
|
-
effects:
|
|
250
|
-
}),
|
|
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
|
-
}), [
|
|
255
|
-
let
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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__ */
|
|
263
|
-
className:
|
|
264
|
-
"data-stylo-mode":
|
|
276
|
+
return /* @__PURE__ */ C("div", {
|
|
277
|
+
className: ee,
|
|
278
|
+
"data-stylo-mode": V,
|
|
265
279
|
children: [
|
|
266
|
-
|
|
267
|
-
let e = /* @__PURE__ */
|
|
268
|
-
view:
|
|
269
|
-
items:
|
|
280
|
+
W && (() => {
|
|
281
|
+
let e = /* @__PURE__ */ S(P, {
|
|
282
|
+
view: H,
|
|
283
|
+
items: W,
|
|
270
284
|
icons: N,
|
|
271
|
-
disabled:
|
|
272
|
-
sticky:
|
|
273
|
-
stickyVisibility:
|
|
285
|
+
disabled: f,
|
|
286
|
+
sticky: q,
|
|
287
|
+
stickyVisibility: J
|
|
274
288
|
});
|
|
275
|
-
return
|
|
289
|
+
return K ? K(e, { view: H }) : e;
|
|
276
290
|
})(),
|
|
277
|
-
|
|
278
|
-
value:
|
|
279
|
-
onChange:
|
|
280
|
-
readOnly:
|
|
281
|
-
placeholder:
|
|
282
|
-
codeLanguages:
|
|
283
|
-
wikiLinkSource:
|
|
284
|
-
tagSource:
|
|
285
|
-
onResolveError:
|
|
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:
|
|
288
|
-
canvasHeader:
|
|
301
|
+
onViewChange: U,
|
|
302
|
+
canvasHeader: R,
|
|
303
|
+
hostExtensions: z
|
|
289
304
|
}),
|
|
290
|
-
|
|
291
|
-
fallback: /* @__PURE__ */
|
|
292
|
-
className:
|
|
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__ */
|
|
296
|
-
value:
|
|
310
|
+
children: /* @__PURE__ */ S(O, {
|
|
311
|
+
value: r,
|
|
297
312
|
onWikiLinkClick: l,
|
|
298
|
-
embedSource:
|
|
299
|
-
onResolveError:
|
|
300
|
-
frontmatter:
|
|
301
|
-
codeLanguages:
|
|
302
|
-
softBreaks:
|
|
303
|
-
onTaskToggle:
|
|
313
|
+
embedSource: A,
|
|
314
|
+
onResolveError: Z,
|
|
315
|
+
frontmatter: F,
|
|
316
|
+
codeLanguages: x,
|
|
317
|
+
softBreaks: I,
|
|
318
|
+
onTaskToggle: L
|
|
304
319
|
})
|
|
305
320
|
}),
|
|
306
|
-
|
|
307
|
-
value:
|
|
308
|
-
onChange:
|
|
321
|
+
V === "split" && /* @__PURE__ */ S(k, {
|
|
322
|
+
value: r,
|
|
323
|
+
onChange: i,
|
|
309
324
|
onWikiLinkClick: l,
|
|
310
|
-
readOnly:
|
|
311
|
-
placeholder:
|
|
312
|
-
codeLanguages:
|
|
313
|
-
wikiLinkSource:
|
|
314
|
-
tagSource:
|
|
315
|
-
embedSource:
|
|
316
|
-
onResolveError:
|
|
317
|
-
frontmatter:
|
|
318
|
-
softBreaks:
|
|
319
|
-
onTaskToggle:
|
|
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:
|
|
322
|
-
canvasHeader:
|
|
336
|
+
onViewChange: U,
|
|
337
|
+
canvasHeader: R,
|
|
338
|
+
hostExtensions: z
|
|
323
339
|
}),
|
|
324
|
-
|
|
325
|
-
fallback: /* @__PURE__ */
|
|
326
|
-
className:
|
|
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__ */
|
|
330
|
-
value:
|
|
331
|
-
onChange:
|
|
332
|
-
readOnly:
|
|
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:
|
|
336
|
-
inPlace:
|
|
337
|
-
codeLanguages:
|
|
338
|
-
wikiLinkSource:
|
|
339
|
-
tagSource:
|
|
340
|
-
embedSource:
|
|
341
|
-
onResolveError:
|
|
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:
|
|
344
|
-
canvasHeader:
|
|
359
|
+
onViewChange: U,
|
|
360
|
+
canvasHeader: R,
|
|
361
|
+
hostExtensions: z
|
|
345
362
|
})
|
|
346
363
|
})
|
|
347
364
|
]
|
|
348
365
|
});
|
|
349
366
|
});
|
|
350
|
-
|
|
367
|
+
F.displayName = "Stylo";
|
|
351
368
|
//#endregion
|
|
352
|
-
export {
|
|
369
|
+
export { F as Stylo, e as splitFrontmatter };
|
|
353
370
|
|
|
354
371
|
//# sourceMappingURL=stylo.js.map
|