@canofold/markdown 0.3.0 → 0.3.2
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/ImageGallery-Bcpjlfh9.js +569 -0
- package/dist/Markdown-607_slPB.js +117 -0
- package/dist/assets-CqlggKr8.js +77 -0
- package/dist/base.css +1 -1
- package/dist/client/bundler.js +308 -0
- package/dist/client/chunks/{client-kVNIqHQd.js → client-CHUUETWE.js} +3 -3
- package/dist/client/chunks/{gallery-BTg1qJjd.js → gallery-Cr0TgC1h.js} +2 -2
- package/dist/client/chunks/{image-BuMCsr5L.js → image-6_o7fPkU.js} +3 -3
- package/dist/client/chunks/provider-k1N-5njv.js +1037 -0
- package/dist/client/chunks/react-runtime-DRPMrVPX.js +12062 -0
- package/dist/client/chunks/{serialized-T1PzI4rG.js → serialized-Chn9ydGA.js} +270 -220
- package/dist/client/chunks/{table-JOSJsHgy.js → table-D99-Zhc8.js} +3 -3
- package/dist/client/index.js +1 -1
- package/dist/compiler/fenceMetadata.d.ts +7 -0
- package/dist/compiler/normalizeOptions.d.ts +2 -1
- package/dist/compiler/plugins/code.d.ts +1 -1
- package/dist/compiler/prepareMarkdown.d.ts +1 -1
- package/dist/compiler/types.d.ts +3 -0
- package/dist/componentMap-CKSUGzQH.js +1483 -0
- package/dist/components/blocks/MarkdownCodeBlock.d.ts +3 -1
- package/dist/copyText-C0ZgrMnH.js +18 -0
- package/dist/{directiveValidation-BdVbgcY_.js → directiveValidation-B7LY-R5p.js} +187 -248
- package/dist/fileKinds-BPzIxbaS.js +170 -0
- package/dist/gallery-BqQ-i0TC.js +42 -0
- package/dist/image-CiPni6Az.js +38 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/plugins-CXYBB-oH.js +130 -0
- package/dist/{prepareMarkdown-D-bFl1_V.js → prepareMarkdown-CS6sALIb.js} +344 -329
- package/dist/provider-BJDHf4Z_.js +8 -0
- package/dist/serialized-DFiNQYA5.js +39 -0
- package/dist/server/analyze.js +11 -11
- package/dist/server.js +30 -28
- package/dist/table-DQSeLjVL.js +32 -0
- package/package.json +14 -9
- package/dist/Markdown-C7O01MRv.js +0 -2116
- package/dist/client/chunks/provider-DNSHvvN7.js +0 -841
- package/dist/client/chunks/react-runtime-Dzgdzn6D.js +0 -10571
- package/dist/plugins-StkCS2su.js +0 -298
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ export function Article({ source }: { source: string }) {
|
|
|
29
29
|
- `@canofold/markdown/theme` provides the shared theme contract.
|
|
30
30
|
- `@canofold/markdown/base.css` and `@canofold/markdown/theme.css` provide the public style layers.
|
|
31
31
|
|
|
32
|
+
When `@canofold/markdown/client` is imported by Vite or another bundler, React and React DOM remain host-provided peer dependencies instead of hiding another bundled React copy. When the Canofold CLI emits a standalone static site that has no host bundler, it automatically selects a self-contained local browser asset. Both modes use the same public entry and require no user-managed alias, import map, or runtime path.
|
|
33
|
+
|
|
32
34
|
Optional syntax such as formulas is supplied by `@canofold/plugins`:
|
|
33
35
|
|
|
34
36
|
```bash
|
package/README.zh-CN.md
CHANGED
|
@@ -29,6 +29,8 @@ export function Article({ source }: { source: string }) {
|
|
|
29
29
|
- `@canofold/markdown/theme` 提供共享主题契约。
|
|
30
30
|
- `@canofold/markdown/base.css` 和 `@canofold/markdown/theme.css` 是公开样式入口。
|
|
31
31
|
|
|
32
|
+
在 Vite 等 bundler 中导入 `@canofold/markdown/client` 时,React 与 React DOM 继续由宿主应用的 peer dependency 提供,不会隐藏内置另一份 React。Canofold CLI 生成不依赖 bundler 的独立静态站点时,会自动选择自包含的本地浏览器资源;两种消费方式使用同一个公开入口,不需要用户配置 alias、import map 或运行时路径。
|
|
33
|
+
|
|
32
34
|
数学公式等可选语法由 `@canofold/plugins` 提供:
|
|
33
35
|
|
|
34
36
|
```bash
|
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import { jsx as s, jsxs as u, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as j, createElement as A, useContext as G, isValidElement as I, Children as v, useEffect as F, useMemo as Y, useState as H, useRef as M } from "react";
|
|
3
|
+
import { ChevronRight as Q, ChevronLeft as ee, X as te, Link2 as re, Workflow as oe, FileText as ne, Folder as ae, Table2 as le, ChevronsUpDown as ie, RotateCcw as se, Plus as ce, Minus as de, Maximize2 as fe, Code2 as pe, Download as ue, Copy as ge } from "lucide-react";
|
|
4
|
+
import { createPortal as me } from "react-dom";
|
|
5
|
+
const b = {
|
|
6
|
+
copyCode: "Copy code",
|
|
7
|
+
copyFailed: "Copy failed",
|
|
8
|
+
copySnippet: "Copy snippet",
|
|
9
|
+
copyTerminal: "Copy terminal output",
|
|
10
|
+
terminalTitle: "Terminal",
|
|
11
|
+
tabsTitle: "Tabs",
|
|
12
|
+
tabItem: "Tab {index}",
|
|
13
|
+
codeGroupTitle: "Code group",
|
|
14
|
+
codeGroupItem: "Code {index}",
|
|
15
|
+
taskCompleted: "Completed task",
|
|
16
|
+
taskIncomplete: "Incomplete task",
|
|
17
|
+
copySectionLink: "Copy section link",
|
|
18
|
+
tableTitle: "table",
|
|
19
|
+
copyTableCsv: "Copy table as CSV",
|
|
20
|
+
downloadTableCsv: "Download table as CSV",
|
|
21
|
+
zoomTable: "Zoom table",
|
|
22
|
+
closeTablePreview: "Close table preview",
|
|
23
|
+
sortTableColumn: "Sort table by column {column}",
|
|
24
|
+
zoomImage: "Zoom image",
|
|
25
|
+
closeImagePreview: "Close image preview",
|
|
26
|
+
imageGallery: "Image gallery",
|
|
27
|
+
closeImageGallery: "Close gallery",
|
|
28
|
+
previousGalleryImage: "Previous image",
|
|
29
|
+
nextGalleryImage: "Next image",
|
|
30
|
+
galleryThumbnails: "Gallery thumbnails",
|
|
31
|
+
galleryImage: "image"
|
|
32
|
+
}, he = {
|
|
33
|
+
copy: "CopyIcon",
|
|
34
|
+
download: "DownloadIcon",
|
|
35
|
+
code: "CodeIcon",
|
|
36
|
+
maximize: "MaximizeIcon",
|
|
37
|
+
minus: "MinusIcon",
|
|
38
|
+
plus: "PlusIcon",
|
|
39
|
+
reset: "ResetIcon",
|
|
40
|
+
sort: "SortIcon",
|
|
41
|
+
table: "TableIcon",
|
|
42
|
+
folder: "FolderIcon",
|
|
43
|
+
file: "FileIcon",
|
|
44
|
+
workflow: "WorkflowIcon",
|
|
45
|
+
link: "LinkIcon",
|
|
46
|
+
close: "CloseIcon",
|
|
47
|
+
previous: "PreviousIcon",
|
|
48
|
+
next: "NextIcon"
|
|
49
|
+
}, R = Object.freeze({}), W = j(R);
|
|
50
|
+
function Fe({ slots: e, children: o }) {
|
|
51
|
+
return A(W.Provider, { value: e ?? R }, o);
|
|
52
|
+
}
|
|
53
|
+
function ye() {
|
|
54
|
+
return G(W);
|
|
55
|
+
}
|
|
56
|
+
function be(e, o) {
|
|
57
|
+
const t = e?.[he[o]];
|
|
58
|
+
return t ? (r) => A(t, { ...r, name: o }) : void 0;
|
|
59
|
+
}
|
|
60
|
+
function Re(e) {
|
|
61
|
+
return e?.ImageCaption;
|
|
62
|
+
}
|
|
63
|
+
const we = {
|
|
64
|
+
copy: ge,
|
|
65
|
+
download: ue,
|
|
66
|
+
code: pe,
|
|
67
|
+
maximize: fe,
|
|
68
|
+
minus: de,
|
|
69
|
+
plus: ce,
|
|
70
|
+
reset: se,
|
|
71
|
+
sort: ie,
|
|
72
|
+
table: le,
|
|
73
|
+
folder: ae,
|
|
74
|
+
file: ne,
|
|
75
|
+
workflow: oe,
|
|
76
|
+
link: re,
|
|
77
|
+
close: te,
|
|
78
|
+
previous: ee,
|
|
79
|
+
next: Q
|
|
80
|
+
};
|
|
81
|
+
function T({
|
|
82
|
+
name: e,
|
|
83
|
+
size: o = 16,
|
|
84
|
+
className: t
|
|
85
|
+
}) {
|
|
86
|
+
const r = be(ye(), e);
|
|
87
|
+
if (r) return /* @__PURE__ */ s(r, { size: o, className: t, "aria-hidden": "true" });
|
|
88
|
+
const n = we[e];
|
|
89
|
+
return /* @__PURE__ */ s(n, { className: t, size: o, strokeWidth: 2, "aria-hidden": "true" });
|
|
90
|
+
}
|
|
91
|
+
function S(e) {
|
|
92
|
+
return typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(S).join("") : I(e) ? S(e.props.children) : !e || typeof e != "object" ? "" : e.type === "text" ? String(e.value ?? "") : S(e.children);
|
|
93
|
+
}
|
|
94
|
+
function We(e) {
|
|
95
|
+
return v.toArray(e).filter((o) => I(o));
|
|
96
|
+
}
|
|
97
|
+
function $e(e) {
|
|
98
|
+
if (typeof e.type == "string") return e.type;
|
|
99
|
+
const t = e.type.displayName;
|
|
100
|
+
return t?.startsWith("Markdown") ? t.slice(8).toLowerCase() : "";
|
|
101
|
+
}
|
|
102
|
+
function Ce(e, ...o) {
|
|
103
|
+
const t = e;
|
|
104
|
+
for (const r of o)
|
|
105
|
+
if (t[r] !== void 0 && t[r] !== null) return t[r];
|
|
106
|
+
}
|
|
107
|
+
function w(e, ...o) {
|
|
108
|
+
const t = Ce(e, ...o);
|
|
109
|
+
return typeof t == "string" ? t : "";
|
|
110
|
+
}
|
|
111
|
+
const Se = /* @__PURE__ */ new Set([
|
|
112
|
+
"id",
|
|
113
|
+
"className",
|
|
114
|
+
"style",
|
|
115
|
+
"title",
|
|
116
|
+
"role",
|
|
117
|
+
"tabIndex",
|
|
118
|
+
"hidden",
|
|
119
|
+
"dir",
|
|
120
|
+
"lang",
|
|
121
|
+
"slot",
|
|
122
|
+
"draggable",
|
|
123
|
+
"contentEditable",
|
|
124
|
+
"spellCheck",
|
|
125
|
+
"open",
|
|
126
|
+
"href",
|
|
127
|
+
"target",
|
|
128
|
+
"rel",
|
|
129
|
+
"download",
|
|
130
|
+
"src",
|
|
131
|
+
"alt",
|
|
132
|
+
"width",
|
|
133
|
+
"height",
|
|
134
|
+
"loading",
|
|
135
|
+
"srcSet",
|
|
136
|
+
"sizes",
|
|
137
|
+
"type",
|
|
138
|
+
"name",
|
|
139
|
+
"value",
|
|
140
|
+
"checked",
|
|
141
|
+
"disabled",
|
|
142
|
+
"controls",
|
|
143
|
+
"loop",
|
|
144
|
+
"muted",
|
|
145
|
+
"autoPlay",
|
|
146
|
+
"poster",
|
|
147
|
+
"preload",
|
|
148
|
+
"colSpan",
|
|
149
|
+
"rowSpan",
|
|
150
|
+
"scope",
|
|
151
|
+
"dateTime"
|
|
152
|
+
]);
|
|
153
|
+
function Ie(e, o = []) {
|
|
154
|
+
const t = /* @__PURE__ */ new Set(["node", ...o]);
|
|
155
|
+
return Object.fromEntries(
|
|
156
|
+
Object.entries(e).filter(
|
|
157
|
+
([r]) => !t.has(r) && !r.startsWith("dataCf") && !r.startsWith("data-cf-") && (Se.has(r) || r.startsWith("aria-") || r.startsWith("data-") && !r.startsWith("data-cf-") || /^on[A-Z]/.test(r))
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function Ue(e, o) {
|
|
162
|
+
const t = typeof o == "string" ? o.split(/\s+/) : [];
|
|
163
|
+
return [...new Set([...e.split(/\s+/), ...t].filter(Boolean))].join(" ");
|
|
164
|
+
}
|
|
165
|
+
const ve = [
|
|
166
|
+
"a[href]",
|
|
167
|
+
"button:not([disabled])",
|
|
168
|
+
"input:not([disabled])",
|
|
169
|
+
"select:not([disabled])",
|
|
170
|
+
"textarea:not([disabled])",
|
|
171
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
172
|
+
].join(",");
|
|
173
|
+
function ke({ children: e }) {
|
|
174
|
+
return typeof document > "u" ? null : me(e, document.body);
|
|
175
|
+
}
|
|
176
|
+
function xe({
|
|
177
|
+
open: e,
|
|
178
|
+
close: o,
|
|
179
|
+
dialogRef: t,
|
|
180
|
+
initialFocusRef: r,
|
|
181
|
+
triggerRef: n
|
|
182
|
+
}) {
|
|
183
|
+
return F(() => {
|
|
184
|
+
if (!e) return;
|
|
185
|
+
const l = document.body.style.overflow;
|
|
186
|
+
return document.body.style.overflow = "hidden", r.current?.focus(), () => {
|
|
187
|
+
document.body.style.overflow = l, n.current?.focus();
|
|
188
|
+
};
|
|
189
|
+
}, [r, e, n]), (l) => {
|
|
190
|
+
if (l.key === "Escape") {
|
|
191
|
+
l.preventDefault(), o();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (l.key !== "Tab") return;
|
|
195
|
+
const i = Array.from(
|
|
196
|
+
t.current?.querySelectorAll(ve) ?? []
|
|
197
|
+
).filter(
|
|
198
|
+
(g) => !g.hidden && !g.closest("[hidden], [inert]") && g.getAttribute("aria-hidden") !== "true"
|
|
199
|
+
);
|
|
200
|
+
if (!i.length) {
|
|
201
|
+
l.preventDefault(), t.current?.focus();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const h = i[0], y = i.at(-1);
|
|
205
|
+
!h || !y || (l.shiftKey && document.activeElement === h ? (l.preventDefault(), y.focus()) : !l.shiftKey && document.activeElement === y && (l.preventDefault(), h.focus()));
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const $ = j(void 0), Me = /^(?:https?|ircs?|mailto|tel|xmpp)$/i;
|
|
209
|
+
function Te(e) {
|
|
210
|
+
const o = e.indexOf(":"), t = e.indexOf("/"), r = e.indexOf("?"), n = e.indexOf("#");
|
|
211
|
+
if (o === -1 || t !== -1 && o > t || r !== -1 && o > r || n !== -1 && o > n)
|
|
212
|
+
return e;
|
|
213
|
+
const l = e.slice(0, o).replace(/[\u0000-\u0020]/g, "");
|
|
214
|
+
return Me.test(l) ? e : void 0;
|
|
215
|
+
}
|
|
216
|
+
function P(e, o, t) {
|
|
217
|
+
return Te(t ? t(e, o) : e);
|
|
218
|
+
}
|
|
219
|
+
function _e({
|
|
220
|
+
transform: e,
|
|
221
|
+
children: o
|
|
222
|
+
}) {
|
|
223
|
+
const t = Y(
|
|
224
|
+
() => (r, n) => P(r, n, e) ?? "",
|
|
225
|
+
[e]
|
|
226
|
+
);
|
|
227
|
+
return A($.Provider, { value: t, children: o });
|
|
228
|
+
}
|
|
229
|
+
function Ne() {
|
|
230
|
+
return G($);
|
|
231
|
+
}
|
|
232
|
+
function Ae(e) {
|
|
233
|
+
const o = [];
|
|
234
|
+
let t = 0;
|
|
235
|
+
for (; t < e.length; ) {
|
|
236
|
+
for (; t < e.length && /[\t\n\f\r ,]/.test(e[t] ?? ""); ) t += 1;
|
|
237
|
+
if (t >= e.length) break;
|
|
238
|
+
const r = t;
|
|
239
|
+
for (; t < e.length && !/[\t\n\f\r ]/.test(e[t] ?? ""); ) t += 1;
|
|
240
|
+
let n = e.slice(r, t), l = 0;
|
|
241
|
+
for (; n.endsWith(","); )
|
|
242
|
+
n = n.slice(0, -1), l += 1;
|
|
243
|
+
if (l > 0) {
|
|
244
|
+
o.push({ url: n, descriptor: "" });
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
for (; t < e.length && /[\t\n\f\r ]/.test(e[t] ?? ""); ) t += 1;
|
|
248
|
+
const i = t;
|
|
249
|
+
for (; t < e.length && e[t] !== ","; ) t += 1;
|
|
250
|
+
const h = e.slice(i, t).trim();
|
|
251
|
+
e[t] === "," && (t += 1), o.push({ url: n, descriptor: h });
|
|
252
|
+
}
|
|
253
|
+
return o;
|
|
254
|
+
}
|
|
255
|
+
function U(e, o) {
|
|
256
|
+
return Ae(e).flatMap(({ url: t, descriptor: r }) => {
|
|
257
|
+
const n = P(t, "srcSet", o);
|
|
258
|
+
return n ? [`${n}${r ? ` ${r}` : ""}`] : [];
|
|
259
|
+
}).join(", ");
|
|
260
|
+
}
|
|
261
|
+
function Ke(e, o) {
|
|
262
|
+
let t = e;
|
|
263
|
+
const r = () => (t === e && (t = { ...e }), t);
|
|
264
|
+
for (const n of ["href", "src", "poster"]) {
|
|
265
|
+
const l = e[n];
|
|
266
|
+
if (typeof l != "string") continue;
|
|
267
|
+
const i = P(l, n, o);
|
|
268
|
+
i === void 0 ? delete r()[n] : i !== l && (r()[n] = i);
|
|
269
|
+
}
|
|
270
|
+
for (const n of ["srcSet", "srcset"]) {
|
|
271
|
+
const l = e[n];
|
|
272
|
+
if (typeof l != "string") continue;
|
|
273
|
+
const i = U(l, o);
|
|
274
|
+
i ? i !== l && (r()[n] = i) : delete r()[n];
|
|
275
|
+
}
|
|
276
|
+
return t;
|
|
277
|
+
}
|
|
278
|
+
function N(e, o) {
|
|
279
|
+
return v.toArray(e).find((t) => I(t) ? t.type === o : !1);
|
|
280
|
+
}
|
|
281
|
+
function Pe(e) {
|
|
282
|
+
return v.toArray(e).flatMap((o) => {
|
|
283
|
+
if (!I(o) || o.type !== "figure") return [];
|
|
284
|
+
const t = o.props, r = N(t.children, "img");
|
|
285
|
+
if (!r || typeof r.props.src != "string") return [];
|
|
286
|
+
const n = N(t.children, "figcaption");
|
|
287
|
+
return [
|
|
288
|
+
{
|
|
289
|
+
src: r.props.src,
|
|
290
|
+
alt: typeof r.props.alt == "string" ? r.props.alt : "",
|
|
291
|
+
caption: n ? S(n.props.children) : void 0,
|
|
292
|
+
title: typeof r.props.title == "string" ? r.props.title : void 0,
|
|
293
|
+
srcSet: typeof r.props.srcSet == "string" ? r.props.srcSet : void 0,
|
|
294
|
+
sizes: typeof r.props.sizes == "string" ? r.props.sizes : void 0,
|
|
295
|
+
width: typeof r.props.width == "number" || typeof r.props.width == "string" ? r.props.width : void 0,
|
|
296
|
+
height: typeof r.props.height == "number" || typeof r.props.height == "string" ? r.props.height : void 0
|
|
297
|
+
}
|
|
298
|
+
];
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function ze(e) {
|
|
302
|
+
return v.toArray(e).filter((o) => {
|
|
303
|
+
if (!I(o)) return !0;
|
|
304
|
+
const t = o.props;
|
|
305
|
+
if (o.type === "figure") {
|
|
306
|
+
const r = N(t.children, "img");
|
|
307
|
+
return !r || typeof r.props.src != "string";
|
|
308
|
+
}
|
|
309
|
+
return z({ children: [t.node] }).length === 0;
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function z(e) {
|
|
313
|
+
return !e || typeof e != "object" ? [] : (Array.isArray(e.children) ? e.children : []).flatMap((t) => {
|
|
314
|
+
if (!t || typeof t != "object" || t.tagName !== "figure")
|
|
315
|
+
return [];
|
|
316
|
+
const r = Array.isArray(t.children) ? t.children : [], n = r.find(
|
|
317
|
+
(i) => i && typeof i == "object" && i.tagName === "img"
|
|
318
|
+
);
|
|
319
|
+
if (!n?.properties || typeof n.properties.src != "string") return [];
|
|
320
|
+
const l = r.find(
|
|
321
|
+
(i) => i && typeof i == "object" && i.tagName === "figcaption"
|
|
322
|
+
);
|
|
323
|
+
return [
|
|
324
|
+
{
|
|
325
|
+
src: n.properties.src,
|
|
326
|
+
alt: typeof n.properties.alt == "string" ? n.properties.alt : "",
|
|
327
|
+
caption: l ? S(l) : void 0,
|
|
328
|
+
title: typeof n.properties.title == "string" ? n.properties.title : void 0,
|
|
329
|
+
srcSet: typeof n.properties.srcSet == "string" ? n.properties.srcSet : void 0,
|
|
330
|
+
sizes: typeof n.properties.sizes == "string" ? n.properties.sizes : void 0,
|
|
331
|
+
width: typeof n.properties.width == "number" || typeof n.properties.width == "string" ? n.properties.width : void 0,
|
|
332
|
+
height: typeof n.properties.height == "number" || typeof n.properties.height == "string" ? n.properties.height : void 0
|
|
333
|
+
}
|
|
334
|
+
];
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function De(e, o, t) {
|
|
338
|
+
if (e?.length) return e;
|
|
339
|
+
const r = z(o);
|
|
340
|
+
return r.length ? r : Pe(t);
|
|
341
|
+
}
|
|
342
|
+
function Le(e, o) {
|
|
343
|
+
return {
|
|
344
|
+
gallery: e?.gallery ?? (w(o, "data-cf-gallery-label", "dataCfGalleryLabel") || b.imageGallery),
|
|
345
|
+
close: e?.close ?? (w(o, "data-cf-close-label", "dataCfCloseLabel") || b.closeImageGallery),
|
|
346
|
+
previous: e?.previous ?? (w(o, "data-cf-previous-label", "dataCfPreviousLabel") || b.previousGalleryImage),
|
|
347
|
+
next: e?.next ?? (w(o, "data-cf-next-label", "dataCfNextLabel") || b.nextGalleryImage),
|
|
348
|
+
thumbnails: e?.thumbnails ?? (w(o, "data-cf-thumbnails-label", "dataCfThumbnailsLabel") || b.galleryThumbnails),
|
|
349
|
+
image: e?.image ?? (w(o, "data-cf-image-label", "dataCfImageLabel") || b.galleryImage)
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function Be({
|
|
353
|
+
children: e,
|
|
354
|
+
items: o,
|
|
355
|
+
className: t,
|
|
356
|
+
role: r = "group",
|
|
357
|
+
labels: n,
|
|
358
|
+
node: l,
|
|
359
|
+
inner: i = !1,
|
|
360
|
+
...h
|
|
361
|
+
}) {
|
|
362
|
+
const y = h, g = Ne(), _ = z(l), f = De(o, l, e).map((a) => ({
|
|
363
|
+
...a,
|
|
364
|
+
src: g ? g(a.src, "src") : a.src,
|
|
365
|
+
srcSet: a.srcSet && g ? U(a.srcSet, g) : a.srcSet
|
|
366
|
+
})), K = JSON.stringify(f), B = f.length && _.length === 0 ? ze(e) : [], [m, C] = H(null), p = m === null ? void 0 : f[m], D = M(null), L = M(null), O = M(null), c = Le(n, y), V = (a, d) => {
|
|
367
|
+
D.current = d, C(a);
|
|
368
|
+
}, k = () => C(null), Z = xe({
|
|
369
|
+
open: !!p,
|
|
370
|
+
close: k,
|
|
371
|
+
dialogRef: O,
|
|
372
|
+
initialFocusRef: L,
|
|
373
|
+
triggerRef: D
|
|
374
|
+
});
|
|
375
|
+
F(() => {
|
|
376
|
+
m !== null && !p && C(null);
|
|
377
|
+
}, [m, p]);
|
|
378
|
+
const x = (a) => {
|
|
379
|
+
f.length && C(
|
|
380
|
+
(d) => d === null ? 0 : (d + a + f.length) % f.length
|
|
381
|
+
);
|
|
382
|
+
}, q = (a) => {
|
|
383
|
+
Z(a), !a.defaultPrevented && (a.key === "ArrowLeft" || a.key === "ArrowRight") && (a.preventDefault(), x(a.key === "ArrowLeft" ? -1 : 1));
|
|
384
|
+
}, E = /* @__PURE__ */ u(X, { children: [
|
|
385
|
+
f.length ? f.map((a, d) => /* @__PURE__ */ u("figure", { "data-cf-slot": "item", children: [
|
|
386
|
+
/* @__PURE__ */ s(
|
|
387
|
+
"button",
|
|
388
|
+
{
|
|
389
|
+
className: "cf-gallery-trigger",
|
|
390
|
+
type: "button",
|
|
391
|
+
"data-cf-action": "open-gallery",
|
|
392
|
+
"aria-label": `${a.alt || c.image} ${d + 1}`,
|
|
393
|
+
"aria-haspopup": "dialog",
|
|
394
|
+
onClick: (J) => V(d, J.currentTarget),
|
|
395
|
+
children: /* @__PURE__ */ s(
|
|
396
|
+
"img",
|
|
397
|
+
{
|
|
398
|
+
src: a.src,
|
|
399
|
+
alt: a.alt,
|
|
400
|
+
title: a.title,
|
|
401
|
+
srcSet: a.srcSet,
|
|
402
|
+
sizes: a.sizes,
|
|
403
|
+
width: a.width,
|
|
404
|
+
height: a.height,
|
|
405
|
+
loading: "lazy"
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
),
|
|
410
|
+
a.caption ? /* @__PURE__ */ s("figcaption", { children: a.caption }) : null
|
|
411
|
+
] }, `${a.src}-${d}`)) : e,
|
|
412
|
+
B,
|
|
413
|
+
m !== null && p ? /* @__PURE__ */ s(ke, { children: /* @__PURE__ */ u(
|
|
414
|
+
"div",
|
|
415
|
+
{
|
|
416
|
+
ref: O,
|
|
417
|
+
className: "cf-gallery-lightbox",
|
|
418
|
+
"data-cf-slot": "lightbox",
|
|
419
|
+
role: "dialog",
|
|
420
|
+
"aria-modal": "true",
|
|
421
|
+
"aria-label": c.gallery,
|
|
422
|
+
tabIndex: -1,
|
|
423
|
+
onKeyDown: q,
|
|
424
|
+
children: [
|
|
425
|
+
/* @__PURE__ */ s(
|
|
426
|
+
"div",
|
|
427
|
+
{
|
|
428
|
+
className: "cf-gallery-backdrop",
|
|
429
|
+
"data-cf-action": "close-gallery",
|
|
430
|
+
"aria-hidden": "true",
|
|
431
|
+
onClick: k
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ u("div", { className: "cf-gallery-dialog", children: [
|
|
435
|
+
/* @__PURE__ */ u("div", { className: "cf-gallery-dialog-head", children: [
|
|
436
|
+
/* @__PURE__ */ s("span", { children: c.gallery }),
|
|
437
|
+
/* @__PURE__ */ s(
|
|
438
|
+
"button",
|
|
439
|
+
{
|
|
440
|
+
ref: L,
|
|
441
|
+
className: "cf-icon-button",
|
|
442
|
+
type: "button",
|
|
443
|
+
"data-cf-action": "close-gallery",
|
|
444
|
+
"aria-label": c.close,
|
|
445
|
+
title: c.close,
|
|
446
|
+
onClick: k,
|
|
447
|
+
children: /* @__PURE__ */ s(T, { name: "close", size: 20 })
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ u("div", { className: "cf-gallery-stage", children: [
|
|
452
|
+
f.length > 1 ? /* @__PURE__ */ s(
|
|
453
|
+
"button",
|
|
454
|
+
{
|
|
455
|
+
className: "cf-gallery-nav cf-gallery-prev",
|
|
456
|
+
type: "button",
|
|
457
|
+
"data-cf-action": "previous-gallery-image",
|
|
458
|
+
"aria-label": c.previous,
|
|
459
|
+
title: c.previous,
|
|
460
|
+
onClick: () => x(-1),
|
|
461
|
+
children: /* @__PURE__ */ s(T, { name: "previous", size: 20 })
|
|
462
|
+
}
|
|
463
|
+
) : null,
|
|
464
|
+
/* @__PURE__ */ u("figure", { children: [
|
|
465
|
+
/* @__PURE__ */ s(
|
|
466
|
+
"img",
|
|
467
|
+
{
|
|
468
|
+
src: p.src,
|
|
469
|
+
alt: p.alt,
|
|
470
|
+
title: p.title,
|
|
471
|
+
srcSet: p.srcSet,
|
|
472
|
+
sizes: p.sizes,
|
|
473
|
+
width: p.width,
|
|
474
|
+
height: p.height
|
|
475
|
+
}
|
|
476
|
+
),
|
|
477
|
+
/* @__PURE__ */ u("figcaption", { children: [
|
|
478
|
+
/* @__PURE__ */ s("span", { className: "cf-gallery-caption", children: p.caption || p.alt }),
|
|
479
|
+
/* @__PURE__ */ u(
|
|
480
|
+
"small",
|
|
481
|
+
{
|
|
482
|
+
className: "cf-gallery-count",
|
|
483
|
+
"data-cf-gallery-count": "",
|
|
484
|
+
"aria-live": "polite",
|
|
485
|
+
"aria-atomic": "true",
|
|
486
|
+
children: [
|
|
487
|
+
m + 1,
|
|
488
|
+
" / ",
|
|
489
|
+
f.length
|
|
490
|
+
]
|
|
491
|
+
}
|
|
492
|
+
)
|
|
493
|
+
] })
|
|
494
|
+
] }),
|
|
495
|
+
f.length > 1 ? /* @__PURE__ */ s(
|
|
496
|
+
"button",
|
|
497
|
+
{
|
|
498
|
+
className: "cf-gallery-nav cf-gallery-next",
|
|
499
|
+
type: "button",
|
|
500
|
+
"data-cf-action": "next-gallery-image",
|
|
501
|
+
"aria-label": c.next,
|
|
502
|
+
title: c.next,
|
|
503
|
+
onClick: () => x(1),
|
|
504
|
+
children: /* @__PURE__ */ s(T, { name: "next", size: 20 })
|
|
505
|
+
}
|
|
506
|
+
) : null
|
|
507
|
+
] }),
|
|
508
|
+
f.length > 1 ? /* @__PURE__ */ s("div", { className: "cf-gallery-thumbs", role: "group", "aria-label": c.thumbnails, children: f.map((a, d) => /* @__PURE__ */ s(
|
|
509
|
+
"button",
|
|
510
|
+
{
|
|
511
|
+
className: d === m ? "is-current" : void 0,
|
|
512
|
+
type: "button",
|
|
513
|
+
"data-cf-action": "select-gallery-image",
|
|
514
|
+
"aria-current": d === m ? "true" : void 0,
|
|
515
|
+
"aria-label": `${a.alt || c.image} ${d + 1}`,
|
|
516
|
+
onClick: () => C(d),
|
|
517
|
+
children: /* @__PURE__ */ s("img", { src: a.src, alt: "", loading: "lazy" })
|
|
518
|
+
},
|
|
519
|
+
`${a.src}-thumb-${d}`
|
|
520
|
+
)) }) : null
|
|
521
|
+
] })
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
) }) : null
|
|
525
|
+
] });
|
|
526
|
+
return i ? E : /* @__PURE__ */ s(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
...Ie(y),
|
|
530
|
+
className: ["cf-image-gallery", t].filter(Boolean).join(" "),
|
|
531
|
+
"data-cf-component": "gallery",
|
|
532
|
+
"data-cf-slot": "root",
|
|
533
|
+
"data-cf-island": "gallery",
|
|
534
|
+
"data-cf-gallery-items": K,
|
|
535
|
+
"data-cf-gallery-label": c.gallery,
|
|
536
|
+
"data-cf-close-label": c.close,
|
|
537
|
+
"data-cf-previous-label": c.previous,
|
|
538
|
+
"data-cf-next-label": c.next,
|
|
539
|
+
"data-cf-thumbnails-label": c.thumbnails,
|
|
540
|
+
"data-cf-image-label": c.image,
|
|
541
|
+
role: r,
|
|
542
|
+
"aria-label": c.gallery,
|
|
543
|
+
children: E
|
|
544
|
+
}
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
export {
|
|
548
|
+
b as D,
|
|
549
|
+
Be as I,
|
|
550
|
+
_e as M,
|
|
551
|
+
Fe as a,
|
|
552
|
+
T as b,
|
|
553
|
+
Ie as c,
|
|
554
|
+
$e as d,
|
|
555
|
+
We as e,
|
|
556
|
+
ye as f,
|
|
557
|
+
Re as g,
|
|
558
|
+
xe as h,
|
|
559
|
+
ke as i,
|
|
560
|
+
Ce as j,
|
|
561
|
+
De as k,
|
|
562
|
+
be as l,
|
|
563
|
+
Ue as m,
|
|
564
|
+
Ke as n,
|
|
565
|
+
S as r,
|
|
566
|
+
w as s,
|
|
567
|
+
U as t,
|
|
568
|
+
Ne as u
|
|
569
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx as s, jsxs as g, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { toJsxRuntime as y } from "hast-util-to-jsx-runtime";
|
|
3
|
+
import { useMemo as w, useRef as C, useState as R, useEffect as v, createElement as M } from "react";
|
|
4
|
+
import { c as b } from "./componentMap-CKSUGzQH.js";
|
|
5
|
+
import { s as E } from "./plugins-CXYBB-oH.js";
|
|
6
|
+
import { M as S, a as $ } from "./ImageGallery-Bcpjlfh9.js";
|
|
7
|
+
function z(...t) {
|
|
8
|
+
return t.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
function B({
|
|
11
|
+
as: t = "div",
|
|
12
|
+
className: e,
|
|
13
|
+
classNames: i,
|
|
14
|
+
slots: a,
|
|
15
|
+
urlTransform: n,
|
|
16
|
+
children: o,
|
|
17
|
+
"data-cf-root": c = "markdown",
|
|
18
|
+
...r
|
|
19
|
+
}) {
|
|
20
|
+
return M(S, {
|
|
21
|
+
transform: n,
|
|
22
|
+
children: M($, {
|
|
23
|
+
slots: a,
|
|
24
|
+
children: M(
|
|
25
|
+
t,
|
|
26
|
+
{
|
|
27
|
+
...r,
|
|
28
|
+
className: z("cf-content", i?.root, e),
|
|
29
|
+
"data-cf-root": c,
|
|
30
|
+
"data-cf-runtime": r["data-cf-runtime"] ?? "react",
|
|
31
|
+
"data-cf-component": "markdown"
|
|
32
|
+
},
|
|
33
|
+
o
|
|
34
|
+
)
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function I({
|
|
39
|
+
document: t,
|
|
40
|
+
classNames: e,
|
|
41
|
+
components: i,
|
|
42
|
+
slots: a,
|
|
43
|
+
urlTransform: n,
|
|
44
|
+
...o
|
|
45
|
+
}) {
|
|
46
|
+
const c = w(
|
|
47
|
+
() => b(e, a, i, n),
|
|
48
|
+
[e, i, a, n]
|
|
49
|
+
), r = w(
|
|
50
|
+
() => y(t, {
|
|
51
|
+
Fragment: j,
|
|
52
|
+
jsx: s,
|
|
53
|
+
jsxs: g,
|
|
54
|
+
components: c,
|
|
55
|
+
passNode: !0
|
|
56
|
+
}),
|
|
57
|
+
[c, t]
|
|
58
|
+
);
|
|
59
|
+
return /* @__PURE__ */ s(B, { ...o, classNames: e, slots: a, urlTransform: n, children: r });
|
|
60
|
+
}
|
|
61
|
+
function F(t) {
|
|
62
|
+
return E(t ?? {});
|
|
63
|
+
}
|
|
64
|
+
const d = /* @__PURE__ */ new Map(), J = 32;
|
|
65
|
+
function L(t, e) {
|
|
66
|
+
return e === void 0 ? void 0 : `${e.length}:${e}\0${t}`;
|
|
67
|
+
}
|
|
68
|
+
async function O(t, e, i) {
|
|
69
|
+
const a = () => import("./prepareMarkdown-CS6sALIb.js").then((r) => r.b).then(({ prepareMarkdown: r }) => r(t, e)), n = L(t, i);
|
|
70
|
+
if (n === void 0) return a();
|
|
71
|
+
const o = d.get(n);
|
|
72
|
+
if (o)
|
|
73
|
+
return d.delete(n), d.set(n, o), o;
|
|
74
|
+
const c = a().catch((r) => {
|
|
75
|
+
throw d.get(n) === c && d.delete(n), r;
|
|
76
|
+
});
|
|
77
|
+
for (d.set(n, c); d.size > J; ) {
|
|
78
|
+
const r = d.keys().next().value;
|
|
79
|
+
if (r === void 0) break;
|
|
80
|
+
d.delete(r);
|
|
81
|
+
}
|
|
82
|
+
return c;
|
|
83
|
+
}
|
|
84
|
+
function T({
|
|
85
|
+
source: t,
|
|
86
|
+
options: e,
|
|
87
|
+
onError: i,
|
|
88
|
+
onReady: a,
|
|
89
|
+
fallback: n = null,
|
|
90
|
+
retainPrevious: o = !1,
|
|
91
|
+
...c
|
|
92
|
+
}) {
|
|
93
|
+
const r = w(() => F(e), [e]), u = r ?? e ?? null, k = C(i);
|
|
94
|
+
k.current = i;
|
|
95
|
+
const x = C(a);
|
|
96
|
+
x.current = a;
|
|
97
|
+
const [f, m] = R({});
|
|
98
|
+
v(() => {
|
|
99
|
+
let l = !0;
|
|
100
|
+
return o || m({ source: t, optionsIdentity: u }), O(t, e, r).then((h) => {
|
|
101
|
+
l && m({ source: t, optionsIdentity: u, prepared: h });
|
|
102
|
+
}).catch((h) => {
|
|
103
|
+
l && (k.current?.(h), o || m({ source: t, optionsIdentity: u }));
|
|
104
|
+
}), () => {
|
|
105
|
+
l = !1;
|
|
106
|
+
};
|
|
107
|
+
}, [t, u, o]);
|
|
108
|
+
const p = f.source === t && Object.is(f.optionsIdentity, u) && !!f.prepared;
|
|
109
|
+
return v(() => {
|
|
110
|
+
p && x.current?.();
|
|
111
|
+
}, [p, f.prepared]), p ? f.prepared ? /* @__PURE__ */ s(I, { document: f.prepared.document, "data-cf-runtime": "react", ...c }) : n : o && f.prepared ? /* @__PURE__ */ s(I, { document: f.prepared.document, "data-cf-runtime": "react", ...c }) : n;
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
T as M,
|
|
115
|
+
B as a,
|
|
116
|
+
I as b
|
|
117
|
+
};
|