@sia.soul/sia-react-ui 0.1.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 (46) hide show
  1. package/README.md +37 -0
  2. package/THIRD_PARTY_NOTICES.md +12 -0
  3. package/dist/Select-CJJ5LQap.d.cts +44 -0
  4. package/dist/Select-CJJ5LQap.d.ts +44 -0
  5. package/dist/chart.cjs +7523 -0
  6. package/dist/chart.css +1036 -0
  7. package/dist/chart.d.cts +2061 -0
  8. package/dist/chart.d.ts +2061 -0
  9. package/dist/chart.js +120 -0
  10. package/dist/chunk-34TTF4Y7.js +812 -0
  11. package/dist/chunk-6VXOLMKZ.js +381 -0
  12. package/dist/chunk-DZ45HRVP.js +583 -0
  13. package/dist/chunk-I342FGQY.js +7344 -0
  14. package/dist/chunk-JKZGAZMB.js +318 -0
  15. package/dist/chunk-MBS2HXLZ.js +59 -0
  16. package/dist/chunk-NZAT2RUM.js +60 -0
  17. package/dist/chunk-OMA75YLM.js +298 -0
  18. package/dist/chunk-ULEGTKXR.js +2138 -0
  19. package/dist/chunk-YCVXUMGP.js +945 -0
  20. package/dist/core-BeiAQiDY.d.ts +1076 -0
  21. package/dist/core-DRICIs2n.d.cts +1076 -0
  22. package/dist/core.cjs +3353 -0
  23. package/dist/core.css +8734 -0
  24. package/dist/core.d.cts +3 -0
  25. package/dist/core.d.ts +3 -0
  26. package/dist/core.js +45 -0
  27. package/dist/index.cjs +19658 -0
  28. package/dist/index.css +9762 -0
  29. package/dist/index.d.cts +1222 -0
  30. package/dist/index.d.ts +1222 -0
  31. package/dist/index.js +6843 -0
  32. package/dist/markdown-editor.cjs +417 -0
  33. package/dist/markdown-editor.d.cts +28 -0
  34. package/dist/markdown-editor.d.ts +28 -0
  35. package/dist/markdown-editor.js +6 -0
  36. package/dist/rich-text-editor.cjs +1853 -0
  37. package/dist/rich-text-editor.d.cts +27 -0
  38. package/dist/rich-text-editor.d.ts +27 -0
  39. package/dist/rich-text-editor.js +11 -0
  40. package/dist/select-date-range-BDWdo7qt.d.ts +84 -0
  41. package/dist/select-date-range-DWik3ADr.d.cts +84 -0
  42. package/dist/select-date-range.cjs +2074 -0
  43. package/dist/select-date-range.d.cts +3 -0
  44. package/dist/select-date-range.d.ts +3 -0
  45. package/dist/select-date-range.js +8 -0
  46. package/package.json +129 -0
@@ -0,0 +1,417 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/markdown-editor.ts
31
+ var markdown_editor_exports = {};
32
+ __export(markdown_editor_exports, {
33
+ MarkdownEditor: () => MarkdownEditor
34
+ });
35
+ module.exports = __toCommonJS(markdown_editor_exports);
36
+
37
+ // src/components/MarkdownEditor.tsx
38
+ var import_react = require("react");
39
+ var import_dist = require("vditor/dist/index.css");
40
+
41
+ // src/components/markdownPaste.ts
42
+ function isLikelyMarkdown(value) {
43
+ const text = value.trim();
44
+ if (!text) return false;
45
+ const blockMarkdown = [
46
+ /(^|\n)[ \t]{0,3}#{1,6}[ \t]+\S/,
47
+ /(^|\n)[ \t]{0,3}(?:[-+*]|\d+[.)])[ \t]+\S/,
48
+ /(^|\n)[ \t]{0,3}>[ \t]+\S/,
49
+ /(^|\n)[ \t]{0,3}(?:```|~~~)/,
50
+ /(^|\n)[ \t]{0,3}[-+*][ \t]+\[[ xX]\][ \t]+\S/,
51
+ /(^|\n)[ \t]{0,3}(?:[-*_][ \t]*){3,}(?:\n|$)/,
52
+ /(^|\n)[^\n]*\|[^\n]*\n[ \t]*\|?[ \t]*:?-{3,}/
53
+ ];
54
+ if (blockMarkdown.some((pattern) => pattern.test(text))) return true;
55
+ return /!\[[^\]]*\]\([^\n)]+\)|\[[^\]]+\]\([^\n)]+\)|\*\*[^\n*]+\*\*|__[^\n_]+__|~~[^\n~]+~~/.test(text);
56
+ }
57
+
58
+ // src/components/vditorZhCn.ts
59
+ var VDITOR_ZH_CN = {
60
+ alignCenter: "\u5C45\u4E2D",
61
+ alignLeft: "\u5C45\u5DE6",
62
+ alignRight: "\u5C45\u53F3",
63
+ alternateText: "\u66FF\u4EE3\u6587\u672C",
64
+ bold: "\u7C97\u4F53",
65
+ both: "\u7F16\u8F91 & \u9884\u89C8",
66
+ cancelUpload: "\u53D6\u6D88\u4E0A\u4F20",
67
+ check: "\u4EFB\u52A1\u5217\u8868",
68
+ close: "\u5173\u95ED",
69
+ code: "\u4EE3\u7801\u5757",
70
+ "code-theme": "\u4EE3\u7801\u5757\u4E3B\u9898\u9884\u89C8",
71
+ column: "\u5217",
72
+ comment: "\u8BC4\u8BBA",
73
+ confirm: "\u786E\u5B9A",
74
+ "content-theme": "\u5185\u5BB9\u4E3B\u9898\u9884\u89C8",
75
+ copied: "\u5DF2\u590D\u5236",
76
+ copy: "\u590D\u5236",
77
+ "delete-column": "\u5220\u9664\u5217",
78
+ "delete-row": "\u5220\u9664\u884C",
79
+ devtools: "\u5F00\u53D1\u8005\u5DE5\u5177",
80
+ down: "\u4E0B",
81
+ downloadTip: "\u8BE5\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u4E0B\u8F7D\u529F\u80FD",
82
+ edit: "\u7F16\u8F91",
83
+ "edit-mode": "\u5207\u6362\u7F16\u8F91\u6A21\u5F0F",
84
+ emoji: "\u8868\u60C5",
85
+ export: "\u5BFC\u51FA",
86
+ fileTypeError: "\u6587\u4EF6\u7C7B\u578B\u4E0D\u5141\u8BB8\u4E0A\u4F20\uFF0C\u8BF7\u538B\u7F29\u540E\u518D\u8BD5",
87
+ footnoteRef: "\u811A\u6CE8\u6807\u8BC6",
88
+ fullscreen: "\u5168\u5C4F\u5207\u6362",
89
+ generate: "\u751F\u6210\u4E2D",
90
+ headings: "\u6807\u9898",
91
+ heading1: "\u4E00\u7EA7\u6807\u9898",
92
+ heading2: "\u4E8C\u7EA7\u6807\u9898",
93
+ heading3: "\u4E09\u7EA7\u6807\u9898",
94
+ heading4: "\u56DB\u7EA7\u6807\u9898",
95
+ heading5: "\u4E94\u7EA7\u6807\u9898",
96
+ heading6: "\u516D\u7EA7\u6807\u9898",
97
+ help: "\u5E2E\u52A9",
98
+ imageURL: "\u56FE\u7247\u5730\u5740",
99
+ indent: "\u5217\u8868\u7F29\u8FDB",
100
+ info: "\u5173\u4E8E",
101
+ "inline-code": "\u884C\u5185\u4EE3\u7801",
102
+ "insert-after": "\u672B\u5C3E\u63D2\u5165\u884C",
103
+ "insert-before": "\u8D77\u59CB\u63D2\u5165\u884C",
104
+ insertColumnLeft: "\u5728\u5DE6\u8FB9\u63D2\u5165\u4E00\u5217",
105
+ insertColumnRight: "\u5728\u53F3\u8FB9\u63D2\u5165\u4E00\u5217",
106
+ insertRowAbove: "\u5728\u4E0A\u65B9\u63D2\u5165\u4E00\u884C",
107
+ insertRowBelow: "\u5728\u4E0B\u65B9\u63D2\u5165\u4E00\u884C",
108
+ instantRendering: "\u5373\u65F6\u6E32\u67D3",
109
+ italic: "\u659C\u4F53",
110
+ language: "\u8BED\u8A00",
111
+ line: "\u5206\u9694\u7EBF",
112
+ link: "\u94FE\u63A5",
113
+ linkRef: "\u5F15\u7528\u6807\u8BC6",
114
+ list: "\u65E0\u5E8F\u5217\u8868",
115
+ more: "\u66F4\u591A",
116
+ nameEmpty: "\u6587\u4EF6\u540D\u4E0D\u80FD\u4E3A\u7A7A",
117
+ "ordered-list": "\u6709\u5E8F\u5217\u8868",
118
+ outdent: "\u5217\u8868\u53CD\u5411\u7F29\u8FDB",
119
+ outline: "\u5927\u7EB2",
120
+ over: "\u8D85\u8FC7",
121
+ performanceTip: "\u5B9E\u65F6\u9884\u89C8\u9700 ${x}ms\uFF0C\u53EF\u70B9\u51FB\u7F16\u8F91 & \u9884\u89C8\u6309\u94AE\u8FDB\u884C\u5173\u95ED",
122
+ preview: "\u9884\u89C8",
123
+ quote: "\u5F15\u7528",
124
+ record: "\u5F00\u59CB\u5F55\u97F3/\u7ED3\u675F\u5F55\u97F3",
125
+ "record-tip": "\u8BE5\u8BBE\u5907\u4E0D\u652F\u6301\u5F55\u97F3\u529F\u80FD",
126
+ recording: "\u5F55\u97F3\u4E2D...",
127
+ redo: "\u91CD\u505A",
128
+ remove: "\u5220\u9664",
129
+ row: "\u884C",
130
+ spin: "\u65CB\u8F6C",
131
+ splitView: "\u5206\u5C4F\u9884\u89C8",
132
+ strike: "\u5220\u9664\u7EBF",
133
+ table: "\u8868\u683C",
134
+ textIsNotEmpty: "\u6587\u672C\uFF08\u4E0D\u80FD\u4E3A\u7A7A\uFF09",
135
+ title: "\u6807\u9898",
136
+ tooltipText: "\u63D0\u793A\u6587\u672C",
137
+ undo: "\u64A4\u9500",
138
+ up: "\u4E0A",
139
+ update: "\u66F4\u65B0",
140
+ upload: "\u4E0A\u4F20\u56FE\u7247\u6216\u6587\u4EF6",
141
+ uploadError: "\u4E0A\u4F20\u9519\u8BEF",
142
+ uploading: "\u4E0A\u4F20\u4E2D...",
143
+ wysiwyg: "\u6240\u89C1\u5373\u6240\u5F97"
144
+ };
145
+
146
+ // src/components/MarkdownEditor.tsx
147
+ var import_jsx_runtime = require("react/jsx-runtime");
148
+ var vditorLoaders = /* @__PURE__ */ new Map();
149
+ var BASE_TOOLBAR = [
150
+ "headings",
151
+ "bold",
152
+ "italic",
153
+ "strike",
154
+ "link",
155
+ "|",
156
+ "list",
157
+ "ordered-list",
158
+ "check",
159
+ "outdent",
160
+ "indent",
161
+ "|",
162
+ "quote",
163
+ "line",
164
+ "code",
165
+ "inline-code",
166
+ "table",
167
+ "|",
168
+ "undo",
169
+ "redo",
170
+ "|",
171
+ "edit-mode",
172
+ "both",
173
+ "preview",
174
+ "outline",
175
+ "fullscreen"
176
+ ];
177
+ function escapeMarkdownAlt(value) {
178
+ return value.replace(/[\[\]\\]/g, "\\$&");
179
+ }
180
+ function applyEditorAriaLabel(element, label) {
181
+ element.querySelectorAll(".vditor-wysiwyg, .vditor-ir, .vditor-sv").forEach((editor) => {
182
+ editor.setAttribute("aria-label", label);
183
+ editor.setAttribute("role", "textbox");
184
+ editor.setAttribute("aria-multiline", "true");
185
+ });
186
+ }
187
+ function loadVditor(assetBaseUrl) {
188
+ if (typeof window === "undefined") {
189
+ return Promise.reject(new Error("Vditor \u53EA\u80FD\u5728\u6D4F\u89C8\u5668\u4E2D\u52A0\u8F7D"));
190
+ }
191
+ if (window.Vditor) return Promise.resolve(window.Vditor);
192
+ if (!assetBaseUrl) {
193
+ const bundledKey = "__sia_bundled_vditor__";
194
+ const bundledPending = vditorLoaders.get(bundledKey);
195
+ if (bundledPending) return bundledPending;
196
+ const bundledLoader = Promise.all([
197
+ // Vditor normally requests its Markdown engine from a CDN at runtime.
198
+ // @ts-ignore The bundled script installs window.Lute as a side effect.
199
+ import("vditor/dist/js/lute/lute.min.js"),
200
+ // Vditor also loads its SVG sprite from the CDN unless it already exists.
201
+ // @ts-ignore The side-effect module injects the Ant Design icon sprite.
202
+ import("vditor/dist/js/icons/ant.js"),
203
+ import("vditor")
204
+ ]).then(([, , { default: Vditor }]) => {
205
+ if (!document.getElementById("vditorLuteScript")) {
206
+ const bundledLuteMarker = document.createElement("script");
207
+ bundledLuteMarker.id = "vditorLuteScript";
208
+ bundledLuteMarker.dataset.siaBundled = "true";
209
+ document.head.append(bundledLuteMarker);
210
+ }
211
+ if (!document.getElementById("vditorIconScript")) {
212
+ const bundledIconMarker = document.createElement("script");
213
+ bundledIconMarker.id = "vditorIconScript";
214
+ bundledIconMarker.dataset.siaBundled = "true";
215
+ document.head.append(bundledIconMarker);
216
+ }
217
+ window.Vditor = Vditor;
218
+ return Vditor;
219
+ });
220
+ vditorLoaders.set(bundledKey, bundledLoader);
221
+ return bundledLoader;
222
+ }
223
+ const baseUrl = assetBaseUrl.replace(/\/$/, "");
224
+ const scriptUrl = `${baseUrl}/dist/index.min.js`;
225
+ const pending = vditorLoaders.get(scriptUrl);
226
+ if (pending) return pending;
227
+ const loader = new Promise((resolve, reject) => {
228
+ const existing = document.querySelector(`script[data-sia-vditor="${scriptUrl}"]`);
229
+ const script = existing ?? document.createElement("script");
230
+ const handleLoad = () => {
231
+ if (window.Vditor) resolve(window.Vditor);
232
+ else reject(new Error("Vditor \u811A\u672C\u5DF2\u52A0\u8F7D\uFF0C\u4F46\u672A\u627E\u5230\u5168\u5C40\u6784\u9020\u5668"));
233
+ };
234
+ const handleError = () => reject(new Error(`Vditor \u811A\u672C\u52A0\u8F7D\u5931\u8D25\uFF1A${scriptUrl}`));
235
+ script.addEventListener("load", handleLoad, { once: true });
236
+ script.addEventListener("error", handleError, { once: true });
237
+ if (!existing) {
238
+ script.src = scriptUrl;
239
+ script.async = true;
240
+ script.dataset.siaVditor = scriptUrl;
241
+ document.head.append(script);
242
+ }
243
+ });
244
+ vditorLoaders.set(scriptUrl, loader);
245
+ return loader;
246
+ }
247
+ function MarkdownEditor({
248
+ value,
249
+ defaultValue = "",
250
+ onChange,
251
+ mode = "wysiwyg",
252
+ placeholder = "\u8BF7\u8F93\u5165 Markdown \u6B63\u6587",
253
+ minHeight = 320,
254
+ disabled = false,
255
+ ariaLabel = "Markdown \u7F16\u8F91\u5668",
256
+ assetBaseUrl,
257
+ saveShortcut,
258
+ onUploadImage,
259
+ smartMarkdownPaste = true,
260
+ className,
261
+ style,
262
+ ...props
263
+ }) {
264
+ const mountRef = (0, import_react.useRef)(null);
265
+ const editorRef = (0, import_react.useRef)(null);
266
+ const onChangeRef = (0, import_react.useRef)(onChange);
267
+ const saveShortcutRef = (0, import_react.useRef)(saveShortcut);
268
+ const uploadImageRef = (0, import_react.useRef)(onUploadImage);
269
+ const disabledRef = (0, import_react.useRef)(disabled);
270
+ const smartMarkdownPasteRef = (0, import_react.useRef)(smartMarkdownPaste);
271
+ const valueRef = (0, import_react.useRef)(value ?? defaultValue);
272
+ const lastEmittedValueRef = (0, import_react.useRef)(value ?? defaultValue);
273
+ const [ready, setReady] = (0, import_react.useState)(false);
274
+ const [loadError, setLoadError] = (0, import_react.useState)("");
275
+ const hasImageUpload = Boolean(onUploadImage);
276
+ onChangeRef.current = onChange;
277
+ saveShortcutRef.current = saveShortcut;
278
+ uploadImageRef.current = onUploadImage;
279
+ disabledRef.current = disabled;
280
+ smartMarkdownPasteRef.current = smartMarkdownPaste;
281
+ valueRef.current = value ?? valueRef.current;
282
+ (0, import_react.useEffect)(() => {
283
+ const mount = mountRef.current;
284
+ if (!mount) return;
285
+ let disposed = false;
286
+ let createdEditor = null;
287
+ let editorInitialized = false;
288
+ let removeSmartMarkdownPaste = () => {
289
+ };
290
+ setLoadError("");
291
+ void loadVditor(assetBaseUrl).then((Vditor) => {
292
+ if (disposed) return;
293
+ const toolbar = hasImageUpload ? [...BASE_TOOLBAR.slice(0, 17), "upload", ...BASE_TOOLBAR.slice(17)] : [...BASE_TOOLBAR];
294
+ createdEditor = new Vditor(mount, {
295
+ value: valueRef.current,
296
+ mode,
297
+ lang: "zh_CN",
298
+ i18n: VDITOR_ZH_CN,
299
+ icon: "ant",
300
+ width: "100%",
301
+ height: "100%",
302
+ minHeight: typeof minHeight === "number" ? minHeight : void 0,
303
+ placeholder,
304
+ cdn: assetBaseUrl,
305
+ cache: { enable: false },
306
+ toolbar,
307
+ toolbarConfig: { pin: true },
308
+ counter: { enable: true, type: "text" },
309
+ outline: { enable: false, position: "right" },
310
+ preview: {
311
+ mode: "both",
312
+ delay: 180,
313
+ actions: []
314
+ },
315
+ ...hasImageUpload ? { upload: {
316
+ accept: "image/*",
317
+ handler: async (files) => {
318
+ const imageFiles = Array.from(files).filter(
319
+ (file) => file.type.startsWith("image/")
320
+ );
321
+ if (imageFiles.length === 0 || !uploadImageRef.current) return null;
322
+ const images = await Promise.all(
323
+ imageFiles.map(async (file) => ({
324
+ name: file.name,
325
+ url: await uploadImageRef.current(file)
326
+ }))
327
+ );
328
+ editorRef.current?.insertValue(
329
+ images.map(({ name, url }) => `![${escapeMarkdownAlt(name)}](${url})`).join("\n")
330
+ );
331
+ return null;
332
+ }
333
+ } } : {},
334
+ input: (markdown) => {
335
+ lastEmittedValueRef.current = markdown;
336
+ onChangeRef.current?.(markdown);
337
+ },
338
+ keydown: (event) => {
339
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "s") {
340
+ event.preventDefault();
341
+ event.stopPropagation();
342
+ saveShortcutRef.current?.();
343
+ }
344
+ },
345
+ after: () => {
346
+ editorInitialized = true;
347
+ if (disposed || !createdEditor) {
348
+ createdEditor?.destroy();
349
+ return;
350
+ }
351
+ editorRef.current = createdEditor;
352
+ applyEditorAriaLabel(mount, ariaLabel);
353
+ const handleSmartMarkdownPaste = (event) => {
354
+ if (!smartMarkdownPasteRef.current || disabledRef.current) return;
355
+ const target = event.target;
356
+ if (!(target instanceof Element) || !target.closest(".vditor-wysiwyg, .vditor-ir")) return;
357
+ const clipboard = event.clipboardData;
358
+ const explicitMarkdown = clipboard?.getData("text/markdown") ?? "";
359
+ const markdown = explicitMarkdown || clipboard?.getData("text/plain") || "";
360
+ if (!clipboard || !explicitMarkdown && !isLikelyMarkdown(markdown)) return;
361
+ event.preventDefault();
362
+ event.stopPropagation();
363
+ editorRef.current?.insertMD(markdown);
364
+ };
365
+ mount.addEventListener("paste", handleSmartMarkdownPaste, true);
366
+ removeSmartMarkdownPaste = () => mount.removeEventListener("paste", handleSmartMarkdownPaste, true);
367
+ if (disabledRef.current) createdEditor.disabled();
368
+ setReady(true);
369
+ }
370
+ });
371
+ }).catch((error) => {
372
+ if (disposed) return;
373
+ setLoadError(error instanceof Error ? error.message : "\u7F16\u8F91\u5668\u52A0\u8F7D\u5931\u8D25");
374
+ });
375
+ return () => {
376
+ disposed = true;
377
+ setReady(false);
378
+ removeSmartMarkdownPaste();
379
+ if (editorRef.current === createdEditor) editorRef.current = null;
380
+ if (editorInitialized) createdEditor?.destroy();
381
+ };
382
+ }, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder]);
383
+ (0, import_react.useEffect)(() => {
384
+ const editor = editorRef.current;
385
+ if (!editor || value === void 0) return;
386
+ if (value === lastEmittedValueRef.current || editor.getValue() === value) return;
387
+ lastEmittedValueRef.current = value;
388
+ editor.setValue(value, true);
389
+ }, [ready, value]);
390
+ (0, import_react.useEffect)(() => {
391
+ const editor = editorRef.current;
392
+ if (!editor) return;
393
+ if (disabled) editor.disabled();
394
+ else editor.enable();
395
+ }, [disabled, ready]);
396
+ const editorStyle = {
397
+ ...style,
398
+ "--sia-markdown-editor-min-height": typeof minHeight === "number" ? `${minHeight}px` : minHeight
399
+ };
400
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
401
+ "div",
402
+ {
403
+ className: ["sia-markdown-editor", className].filter(Boolean).join(" "),
404
+ style: editorStyle,
405
+ "data-ready": ready ? "true" : "false",
406
+ ...props,
407
+ children: [
408
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: mountRef, className: "sia-markdown-editor__mount" }),
409
+ !ready ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sia-markdown-editor__loading", "aria-live": "polite", children: loadError || "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026" }) : null
410
+ ]
411
+ }
412
+ );
413
+ }
414
+ // Annotate the CommonJS export names for ESM import in node:
415
+ 0 && (module.exports = {
416
+ MarkdownEditor
417
+ });
@@ -0,0 +1,28 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes } from 'react';
3
+ import * as vditor from 'vditor';
4
+
5
+ type VditorConstructor = typeof vditor["default"];
6
+ declare global {
7
+ interface Window {
8
+ Vditor?: VditorConstructor;
9
+ }
10
+ }
11
+ type MarkdownEditorMode = "wysiwyg" | "ir" | "sv";
12
+ interface MarkdownEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
13
+ value?: string;
14
+ defaultValue?: string;
15
+ onChange?: (markdown: string) => void;
16
+ mode?: MarkdownEditorMode;
17
+ placeholder?: string;
18
+ minHeight?: number | string;
19
+ disabled?: boolean;
20
+ ariaLabel?: string;
21
+ assetBaseUrl?: string;
22
+ saveShortcut?: () => void;
23
+ onUploadImage?: (file: File) => Promise<string> | string;
24
+ smartMarkdownPaste?: boolean;
25
+ }
26
+ declare function MarkdownEditor({ value, defaultValue, onChange, mode, placeholder, minHeight, disabled, ariaLabel, assetBaseUrl, saveShortcut, onUploadImage, smartMarkdownPaste, className, style, ...props }: MarkdownEditorProps): react.JSX.Element;
27
+
28
+ export { MarkdownEditor, type MarkdownEditorMode, type MarkdownEditorProps };
@@ -0,0 +1,28 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes } from 'react';
3
+ import * as vditor from 'vditor';
4
+
5
+ type VditorConstructor = typeof vditor["default"];
6
+ declare global {
7
+ interface Window {
8
+ Vditor?: VditorConstructor;
9
+ }
10
+ }
11
+ type MarkdownEditorMode = "wysiwyg" | "ir" | "sv";
12
+ interface MarkdownEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
13
+ value?: string;
14
+ defaultValue?: string;
15
+ onChange?: (markdown: string) => void;
16
+ mode?: MarkdownEditorMode;
17
+ placeholder?: string;
18
+ minHeight?: number | string;
19
+ disabled?: boolean;
20
+ ariaLabel?: string;
21
+ assetBaseUrl?: string;
22
+ saveShortcut?: () => void;
23
+ onUploadImage?: (file: File) => Promise<string> | string;
24
+ smartMarkdownPaste?: boolean;
25
+ }
26
+ declare function MarkdownEditor({ value, defaultValue, onChange, mode, placeholder, minHeight, disabled, ariaLabel, assetBaseUrl, saveShortcut, onUploadImage, smartMarkdownPaste, className, style, ...props }: MarkdownEditorProps): react.JSX.Element;
27
+
28
+ export { MarkdownEditor, type MarkdownEditorMode, type MarkdownEditorProps };
@@ -0,0 +1,6 @@
1
+ import {
2
+ MarkdownEditor
3
+ } from "./chunk-6VXOLMKZ.js";
4
+ export {
5
+ MarkdownEditor
6
+ };