@sia.soul/sia-react-ui 0.1.34 → 0.1.36

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/dist/index.cjs CHANGED
@@ -1131,6 +1131,17 @@ var coreIconPaths = {
1131
1131
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "10.8", cy: "10.8", r: "6.8" }),
1132
1132
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "m15.8 15.8 5.2 5.2M7.8 10.8h6" })
1133
1133
  ] }),
1134
+ // 图片变换工具使用独立图标,便于在预览及其他编辑界面复用。
1135
+ "flip-horizontal": /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 3v18M3 6h5v12H3zM16 6h5v12h-5z" }) }),
1136
+ "flip-vertical": /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M6 3h12v5H6zM6 16h12v5H6z" }) }),
1137
+ "rotate-left": /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1138
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M4 9a8 8 0 1 1 0 6M4 3v6h6" }),
1139
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "9", y: "9", width: "6", height: "6", rx: "1" })
1140
+ ] }),
1141
+ "rotate-right": /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1142
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M20 9a8 8 0 1 0 0 6M20 3v6h-6" }),
1143
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "9", y: "9", width: "6", height: "6", rx: "1" })
1144
+ ] }),
1134
1145
  download: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 3v12M7 10l5 5 5-5M4 20h16" }) }),
1135
1146
  upload: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 16V4M7 9l5-5 5 5M4 20h16" }) }),
1136
1147
  refresh: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
@@ -4578,11 +4589,98 @@ function Collapse({ items, activeKey, defaultActiveKey = [], accordion = false,
4578
4589
  }
4579
4590
  function ImagePreview({ open, src, alt = "", onOpenChange }) {
4580
4591
  const previewRef = (0, import_react22.useRef)(null);
4592
+ const stageRef = (0, import_react22.useRef)(null);
4593
+ const [natural, setNatural] = (0, import_react22.useState)({ src: "", width: 0, height: 0 });
4594
+ const [area, setArea] = (0, import_react22.useState)({ width: 0, height: 0 });
4595
+ const [zoom, setZoom] = (0, import_react22.useState)(1);
4596
+ const [rotation, setRotation] = (0, import_react22.useState)(0);
4597
+ const [flip, setFlip] = (0, import_react22.useState)({ x: 1, y: 1 });
4598
+ const [pan, setPan] = (0, import_react22.useState)({ x: 0, y: 0 });
4599
+ const [failed, setFailed] = (0, import_react22.useState)(false);
4600
+ const drag = (0, import_react22.useRef)();
4581
4601
  useOverlayLifecycle(open, previewRef, () => onOpenChange(false));
4602
+ const reset = () => {
4603
+ setZoom(1);
4604
+ setRotation(0);
4605
+ setFlip({ x: 1, y: 1 });
4606
+ setPan({ x: 0, y: 0 });
4607
+ drag.current = void 0;
4608
+ };
4609
+ (0, import_react22.useEffect)(() => {
4610
+ reset();
4611
+ setFailed(false);
4612
+ }, [open, src]);
4613
+ (0, import_react22.useEffect)(() => {
4614
+ const stage = stageRef.current;
4615
+ if (!open || !stage) return;
4616
+ const measure = () => {
4617
+ setArea({ width: stage.clientWidth, height: stage.clientHeight });
4618
+ setPan({ x: 0, y: 0 });
4619
+ };
4620
+ measure();
4621
+ const observer = new ResizeObserver(measure);
4622
+ observer.observe(stage);
4623
+ return () => observer.disconnect();
4624
+ }, [open, src]);
4625
+ const ready = natural.src === src && natural.width > 0 && area.width > 0 && area.height > 0 && !failed;
4626
+ const sideways = Math.abs(rotation % 180) === 90;
4627
+ const fit = ready ? Math.min(1, area.width / (sideways ? natural.height : natural.width), area.height / (sideways ? natural.width : natural.height)) : 0;
4628
+ const changeZoom = (factor) => setZoom((value) => Math.max(0.25, Math.min(8, value * factor)));
4582
4629
  if (!open || !src || typeof document === "undefined") return null;
4583
4630
  return (0, import_react_dom4.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref: previewRef, className: "sia-image-preview", role: "dialog", "aria-modal": "true", "aria-label": "\u56FE\u7247\u9884\u89C8", tabIndex: -1, onClick: () => onOpenChange(false), children: [
4584
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", "aria-label": "\u5173\u95ED\u9884\u89C8", onClick: () => onOpenChange(false), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "close" }) }),
4585
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src, alt, onClick: (event) => event.stopPropagation() })
4631
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", className: "sia-image-preview__close", "aria-label": "\u5173\u95ED\u9884\u89C8", onClick: (event) => {
4632
+ event.stopPropagation();
4633
+ onOpenChange(false);
4634
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "close" }) }),
4635
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref: stageRef, className: "sia-image-preview__stage", children: failed ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "sia-image-preview__error", children: "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4636
+ "img",
4637
+ {
4638
+ src,
4639
+ alt,
4640
+ draggable: false,
4641
+ style: { width: natural.width * fit, height: natural.height * fit, visibility: ready ? "visible" : "hidden", transform: `translate(${pan.x}px, ${pan.y}px) rotate(${rotation}deg) scale(${zoom * flip.x}, ${zoom * flip.y})` },
4642
+ onLoad: (event) => setNatural({ src, width: event.currentTarget.naturalWidth, height: event.currentTarget.naturalHeight }),
4643
+ onError: () => setFailed(true),
4644
+ onClick: (event) => event.stopPropagation(),
4645
+ onPointerDown: (event) => {
4646
+ if (event.button !== 0) return;
4647
+ event.preventDefault();
4648
+ event.stopPropagation();
4649
+ event.currentTarget.setPointerCapture(event.pointerId);
4650
+ drag.current = { id: event.pointerId, x: event.clientX, y: event.clientY, left: pan.x, top: pan.y };
4651
+ },
4652
+ onPointerMove: (event) => {
4653
+ const start = drag.current;
4654
+ if (start?.id === event.pointerId) setPan({ x: start.left + event.clientX - start.x, y: start.top + event.clientY - start.y });
4655
+ },
4656
+ onPointerUp: () => {
4657
+ drag.current = void 0;
4658
+ },
4659
+ onPointerCancel: () => {
4660
+ drag.current = void 0;
4661
+ },
4662
+ onLostPointerCapture: () => {
4663
+ drag.current = void 0;
4664
+ }
4665
+ },
4666
+ src
4667
+ ) }),
4668
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "sia-image-preview__toolbar", role: "toolbar", "aria-label": "\u56FE\u7247\u64CD\u4F5C", onClick: (event) => event.stopPropagation(), children: [
4669
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u6C34\u5E73\u7FFB\u8F6C", "aria-label": "\u6C34\u5E73\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, x: -value.x })), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "flip-horizontal", size: 20 }) }),
4670
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u5782\u76F4\u7FFB\u8F6C", "aria-label": "\u5782\u76F4\u7FFB\u8F6C", disabled: !ready, onClick: () => setFlip((value) => ({ ...value, y: -value.y })), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "flip-vertical", size: 20 }) }),
4671
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u5411\u5DE6\u65CB\u8F6C", "aria-label": "\u5411\u5DE6\u65CB\u8F6C", disabled: !ready, onClick: () => {
4672
+ setRotation((value) => value - 90);
4673
+ setPan({ x: 0, y: 0 });
4674
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "rotate-left", size: 20 }) }),
4675
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u5411\u53F3\u65CB\u8F6C", "aria-label": "\u5411\u53F3\u65CB\u8F6C", disabled: !ready, onClick: () => {
4676
+ setRotation((value) => value + 90);
4677
+ setPan({ x: 0, y: 0 });
4678
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "rotate-right", size: 20 }) }),
4679
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u7F29\u5C0F", "aria-label": "\u7F29\u5C0F", disabled: !ready || zoom <= 0.25, onClick: () => changeZoom(1 / 1.25), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "zoom-out", size: 20 }) }),
4680
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("output", { className: "sia-image-preview__scale", "aria-label": "\u5F53\u524D\u7F29\u653E\u6BD4\u4F8B", "aria-live": "polite", children: ready ? `${Math.round(fit * zoom * 100)}%` : "\u2014" }),
4681
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u653E\u5927", "aria-label": "\u653E\u5927", disabled: !ready || zoom >= 8, onClick: () => changeZoom(1.25), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "zoom-in", size: 20 }) }),
4682
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "text", title: "\u9002\u5E94\u7A97\u53E3", "aria-label": "\u9002\u5E94\u7A97\u53E3", disabled: !ready, onClick: reset, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: "refresh", size: 20 }) })
4683
+ ] })
4586
4684
  ] }), document.body);
4587
4685
  }
4588
4686
  function Image2({ fallback, placeholder, preview = true, rootClassName = "", className = "", src, alt = "", onError, style, ...props }) {
@@ -6183,7 +6281,7 @@ function FormItem({
6183
6281
  const hasError = status === "error" && Boolean(helpContent);
6184
6282
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: itemRef, className: `sia-form-item${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
6185
6283
  label ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { id: labelId, className: "sia-form-item__label", children: [
6186
- ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": "true", children: "*" }) : null,
6284
+ ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
6187
6285
  label
6188
6286
  ] }) : null,
6189
6287
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "sia-form-item__control", children: [
@@ -6237,7 +6335,7 @@ function FormErrorList({ errors = [] }) {
6237
6335
  return errors.length ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "sia-form-error-list", children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: error }, index)) }) : null;
6238
6336
  }
6239
6337
  var Form = Object.assign(FormRoot, {
6240
- /** 表单字段,负责字段值绑定、校验和标签布局;默认下外边距为 6px。 */
6338
+ /** 表单字段,负责字段值绑定、校验和标签布局。 */
6241
6339
  Item: FormItem,
6242
6340
  /** 动态表单列表,提供字段索引以及新增、删除、移动操作。 */
6243
6341
  List: FormList,
@@ -8215,8 +8313,138 @@ function sendUploadRequest(config, options) {
8215
8313
  return { abort };
8216
8314
  }
8217
8315
 
8218
- // src/components/Upload.tsx
8316
+ // src/components/uploadDownload.ts
8317
+ async function downloadUploadFile(file, request) {
8318
+ let blob;
8319
+ if (request) blob = await request(file);
8320
+ else if (file.url) {
8321
+ const response = await fetch(file.url);
8322
+ if (!response.ok) throw new Error(`\u4E0B\u8F7D\u5931\u8D25\uFF08HTTP ${response.status}\uFF09`);
8323
+ blob = await response.blob();
8324
+ } else if (file.originFileObj) blob = file.originFileObj;
8325
+ else throw new Error("\u6587\u4EF6\u7F3A\u5C11\u4E0B\u8F7D\u5730\u5740\u6216\u539F\u59CB\u5185\u5BB9");
8326
+ if (!(blob instanceof Blob)) throw new Error("\u4E0B\u8F7D\u8BF7\u6C42\u5FC5\u987B\u8FD4\u56DE Blob \u6587\u4EF6\u5185\u5BB9");
8327
+ const url = URL.createObjectURL(blob);
8328
+ const anchor = document.createElement("a");
8329
+ anchor.href = url;
8330
+ anchor.download = file.name;
8331
+ anchor.hidden = true;
8332
+ document.body.append(anchor);
8333
+ try {
8334
+ anchor.click();
8335
+ } finally {
8336
+ anchor.remove();
8337
+ window.setTimeout(() => URL.revokeObjectURL(url), 6e4);
8338
+ }
8339
+ }
8340
+
8341
+ // src/components/Message.tsx
8342
+ var import_client5 = require("react-dom/client");
8219
8343
  var import_jsx_runtime37 = require("react/jsx-runtime");
8344
+ var messageSeed = 0;
8345
+ var messageRoot = null;
8346
+ var messageContainer = null;
8347
+ var messageItems = [];
8348
+ var defaultDuration = 3;
8349
+ var maxCount = 5;
8350
+ var messageTimers = /* @__PURE__ */ new Map();
8351
+ var messageIcons = {
8352
+ info: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "info", size: 18 }),
8353
+ success: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "circle-check", size: 18 }),
8354
+ warning: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "warning", size: 18 }),
8355
+ error: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "circle-close", size: 18 }),
8356
+ loading: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "loader", size: 18, spin: true })
8357
+ };
8358
+ function ensureMessageRoot() {
8359
+ if (typeof document === "undefined") return false;
8360
+ if (!messageContainer) {
8361
+ messageContainer = document.createElement("div");
8362
+ messageContainer.className = "sia-message-root";
8363
+ document.body.appendChild(messageContainer);
8364
+ messageRoot = (0, import_client5.createRoot)(messageContainer);
8365
+ }
8366
+ return true;
8367
+ }
8368
+ function renderMessages() {
8369
+ if (!ensureMessageRoot()) return;
8370
+ messageRoot.render(/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "sia-message-list", "aria-live": "polite", children: messageItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `sia-message sia-message--${item.type}`, role: item.type === "loading" ? "status" : "alert", children: [
8371
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-message__icon", "aria-hidden": "true", children: messageIcons[item.type] }),
8372
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-message__content", children: item.content }),
8373
+ item.closable ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: "sia-message__close", "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: () => closeMessage(item.key), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "close", size: 14 }) }) : null
8374
+ ] }, item.key)) }));
8375
+ }
8376
+ function closeMessage(key) {
8377
+ const item = messageItems.find((candidate) => candidate.key === key);
8378
+ const timer = messageTimers.get(key);
8379
+ if (timer !== void 0) window.clearTimeout(timer);
8380
+ messageTimers.delete(key);
8381
+ messageItems = messageItems.filter((candidate) => candidate.key !== key);
8382
+ item?.onClose?.();
8383
+ renderMessages();
8384
+ }
8385
+ function scheduleMessage(item) {
8386
+ const existingTimer = messageTimers.get(item.key);
8387
+ if (existingTimer !== void 0) window.clearTimeout(existingTimer);
8388
+ const duration = item.duration ?? (item.type === "loading" ? 0 : defaultDuration);
8389
+ if (duration > 0) {
8390
+ messageTimers.set(item.key, window.setTimeout(() => closeMessage(item.key), duration * 1e3));
8391
+ }
8392
+ }
8393
+ function openMessage(input) {
8394
+ const config = typeof input === "object" && input !== null && "content" in input ? input : { content: input };
8395
+ const key = config.key ?? `sia-message-${++messageSeed}`;
8396
+ const item = { ...config, key, type: config.type ?? "info" };
8397
+ const existingIndex = messageItems.findIndex((candidate) => candidate.key === key);
8398
+ if (existingIndex >= 0) messageItems = messageItems.map((candidate, index) => index === existingIndex ? item : candidate);
8399
+ else messageItems = [...messageItems, item];
8400
+ while (messageItems.length > maxCount) closeMessage(messageItems[0].key);
8401
+ renderMessages();
8402
+ scheduleMessage(item);
8403
+ return {
8404
+ close: () => closeMessage(key),
8405
+ update(next) {
8406
+ const current = messageItems.find((candidate) => candidate.key === key);
8407
+ if (!current) return;
8408
+ const updated = { ...current, ...next, key, type: next.type ?? current.type };
8409
+ messageItems = messageItems.map((candidate) => candidate.key === key ? updated : candidate);
8410
+ renderMessages();
8411
+ scheduleMessage(updated);
8412
+ }
8413
+ };
8414
+ }
8415
+ function shortcut(type) {
8416
+ return (content, duration) => openMessage({ content, duration, type });
8417
+ }
8418
+ var message = {
8419
+ /** 直接打开实例,返回可用于更新或关闭的操作句柄。 */
8420
+ open: openMessage,
8421
+ /** 显示普通信息提示。 */
8422
+ info: shortcut("info"),
8423
+ /** 显示成功提示。 */
8424
+ success: shortcut("success"),
8425
+ /** 显示警告提示。 */
8426
+ warning: shortcut("warning"),
8427
+ /** 显示错误提示。 */
8428
+ error: shortcut("error"),
8429
+ /** 显示持续加载提示。 */
8430
+ loading: shortcut("loading"),
8431
+ /** 关闭指定实例;未指定标识时关闭所有实例。 */
8432
+ destroy(key) {
8433
+ if (key !== void 0) {
8434
+ closeMessage(key);
8435
+ return;
8436
+ }
8437
+ [...messageItems].forEach((item) => closeMessage(item.key));
8438
+ },
8439
+ /** 配置消息默认持续时间和最大同时显示数量。 */
8440
+ config(config) {
8441
+ if (config.duration !== void 0) defaultDuration = config.duration;
8442
+ if (config.maxCount !== void 0) maxCount = Math.max(1, config.maxCount);
8443
+ }
8444
+ };
8445
+
8446
+ // src/components/Upload.tsx
8447
+ var import_jsx_runtime38 = require("react/jsx-runtime");
8220
8448
  var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
8221
8449
  function useThumbnail(file) {
8222
8450
  const [local, setLocal] = (0, import_react37.useState)();
@@ -8233,22 +8461,43 @@ function useThumbnail(file) {
8233
8461
  function UploadItem({ file, files, props, actions }) {
8234
8462
  const source = useThumbnail(file);
8235
8463
  const [failed, setFailed] = (0, import_react37.useState)(false);
8464
+ const [downloading, setDownloading] = (0, import_react37.useState)(false);
8465
+ const downloadingRef = (0, import_react37.useRef)(false);
8466
+ const canPreview = !!(source || file.url || file.originFileObj || props.onPreview);
8467
+ const canDownload = !!(file.url || file.originFileObj || props.downloadRequest);
8468
+ async function download() {
8469
+ if (downloadingRef.current) return;
8470
+ downloadingRef.current = true;
8471
+ setDownloading(true);
8472
+ try {
8473
+ await actions.download();
8474
+ } catch {
8475
+ message.error("\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u5730\u5740\u3001\u8BBF\u95EE\u6743\u9650\u6216\u8DE8\u57DF\u914D\u7F6E");
8476
+ } finally {
8477
+ downloadingRef.current = false;
8478
+ setDownloading(false);
8479
+ }
8480
+ }
8236
8481
  (0, import_react37.useEffect)(() => setFailed(false), [source]);
8237
- const node = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
8238
- props.listType !== "text" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { variant: "text", className: "sia-upload__thumbnail", "aria-label": `\u9884\u89C8 ${file.name}`, onClick: actions.preview, disabled: !source && !props.onPreview, children: source && !failed ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("img", { src: source, alt: file.name, onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: file.type?.startsWith("image/") ? "image" : "file", size: 28 }) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 16 }),
8239
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.relativePath || file.name }), children: file.url ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("a", { href: file.url, target: "_blank", rel: "noreferrer", children: file.name }) : file.name }),
8240
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { variant: "text", className: "sia-upload__remove", disabled: props.disabled, "aria-label": `\u79FB\u9664 ${file.name}`, onClick: () => void actions.remove(), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "close", size: 14 }) }),
8241
- file.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "sia-upload__uploading", children: [
8242
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { children: [
8482
+ const node = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
8483
+ props.listType !== "text" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button, { variant: "text", className: "sia-upload__thumbnail", "aria-label": `\u9884\u89C8\u7F29\u7565\u56FE ${file.name}`, onClick: actions.preview, disabled: !canPreview, children: source && !failed ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { src: source, alt: file.name, onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: file.type?.startsWith("image/") ? "image" : "file", size: 28 }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 16 }),
8484
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.relativePath || file.name }), children: file.url ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("a", { href: file.url, target: "_blank", rel: "noreferrer", children: file.name }) : file.name }),
8485
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "sia-upload__actions", children: [
8486
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button, { variant: "text", title: "\u9884\u89C8", "aria-label": `\u9884\u89C8 ${file.name}`, disabled: !canPreview, onClick: actions.preview, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "eye", size: 14 }) }),
8487
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button, { variant: "text", title: "\u4E0B\u8F7D", "aria-label": `\u4E0B\u8F7D ${file.name}`, disabled: !canDownload, loading: downloading, onClick: () => void download(), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "download", size: 14 }) }),
8488
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button, { variant: "text", title: "\u79FB\u9664", className: "sia-upload__remove", disabled: props.disabled, "aria-label": `\u79FB\u9664 ${file.name}`, onClick: () => void actions.remove(), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "close", size: 14 }) })
8489
+ ] }),
8490
+ file.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "sia-upload__uploading", children: [
8491
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
8243
8492
  "\u4E0A\u4F20\u4E2D ",
8244
8493
  Math.round(file.percent ?? 0),
8245
8494
  "%"
8246
8495
  ] }),
8247
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-upload__progress", role: "progressbar", "aria-label": `${file.name} \u4E0A\u4F20\u8FDB\u5EA6`, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": file.percent ?? 0, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { style: { width: `${file.percent ?? 0}%` } }) })
8496
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "sia-upload__progress", role: "progressbar", "aria-label": `${file.name} \u4E0A\u4F20\u8FDB\u5EA6`, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": file.percent ?? 0, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { style: { width: `${file.percent ?? 0}%` } }) })
8248
8497
  ] }),
8249
- file.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-upload__error", children: "\u4E0A\u4F20\u5931\u8D25" })
8498
+ file.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "sia-upload__error", children: "\u4E0A\u4F20\u5931\u8D25" })
8250
8499
  ] });
8251
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
8500
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
8252
8501
  }
8253
8502
  var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8254
8503
  accept,
@@ -8262,6 +8511,7 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8262
8511
  fileList,
8263
8512
  defaultFileList = [],
8264
8513
  listType = "text",
8514
+ cardSize,
8265
8515
  showUploadList = true,
8266
8516
  beforeUpload,
8267
8517
  request,
@@ -8271,9 +8521,11 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8271
8521
  onReject,
8272
8522
  onReadError,
8273
8523
  onPreview,
8524
+ downloadRequest,
8274
8525
  itemRender,
8275
8526
  children,
8276
8527
  className = "",
8528
+ style,
8277
8529
  onDragOver,
8278
8530
  onDragLeave,
8279
8531
  onDrop,
@@ -8281,6 +8533,10 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8281
8533
  tabIndex,
8282
8534
  ...props
8283
8535
  }, ref) {
8536
+ const cardDimension = (value) => value !== void 0 && Number.isFinite(value) ? Math.max(48, value) : 112;
8537
+ const cardWidth = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.width);
8538
+ const cardHeight = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.height);
8539
+ const compactCard = listType === "picture-card" && (cardWidth < 88 || cardHeight < 88);
8284
8540
  const inputRef = (0, import_react37.useRef)(null);
8285
8541
  const [internalFiles, setInternalFiles] = (0, import_react37.useState)(defaultFileList);
8286
8542
  const files = fileList ?? internalFiles;
@@ -8470,18 +8726,19 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8470
8726
  event.preventDefault();
8471
8727
  ingest(selected.map((file) => ({ file, path: file.name })));
8472
8728
  }
8473
- const trigger = !(listType === "picture-card" && full) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "sia-upload__trigger", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { className: "sia-upload__choose", disabled: disabled || full, onClick: () => inputRef.current?.click(), children: children ?? (listType === "picture-card" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
8474
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "plus", size: 24 }),
8475
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u4E0A\u4F20\u56FE\u7247" })
8476
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
8477
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "upload", size: 16 }),
8729
+ const trigger = !(listType === "picture-card" && full) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "sia-upload__trigger", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button, { className: "sia-upload__choose", "aria-label": compactCard ? directory ? "\u9009\u62E9\u6587\u4EF6\u5939" : "\u9009\u62E9\u6587\u4EF6" : void 0, disabled: disabled || full, onClick: () => inputRef.current?.click(), children: children ?? (listType === "picture-card" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
8730
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "plus", size: 24 }),
8731
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "\u4E0A\u4F20\u56FE\u7247" })
8732
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
8733
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "upload", size: 16 }),
8478
8734
  directory ? "\u9009\u62E9\u6587\u4EF6\u5939" : "\u9009\u62E9\u6587\u4EF6"
8479
8735
  ] })) }) });
8480
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
8736
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8481
8737
  "div",
8482
8738
  {
8483
8739
  ...withTitleTooltip(props),
8484
- className: `sia-upload sia-upload--${listType}${dragging ? " is-dragging" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
8740
+ className: `sia-upload sia-upload--${listType}${compactCard ? " sia-upload--compact-card" : ""}${dragging ? " is-dragging" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(),
8741
+ style: listType === "picture-card" ? { "--sia-upload-card-width": `${cardWidth}px`, "--sia-upload-card-height": `${cardHeight}px`, ...style } : style,
8485
8742
  tabIndex: tabIndex ?? (pastable && !disabled ? 0 : void 0),
8486
8743
  onPaste: handlePaste,
8487
8744
  onDragOver: (event) => {
@@ -8497,7 +8754,7 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8497
8754
  },
8498
8755
  onDrop: (event) => void handleDrop(event),
8499
8756
  children: [
8500
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8757
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8501
8758
  "input",
8502
8759
  {
8503
8760
  ref: inputRef,
@@ -8514,19 +8771,25 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8514
8771
  }
8515
8772
  ),
8516
8773
  listType !== "picture-card" && trigger,
8517
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "sia-upload__list", children: [
8518
- showUploadList && files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview }, actions: {
8774
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "sia-upload__list", children: [
8775
+ showUploadList && files.map((file) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UploadItem, { file, files, props: { listType, disabled, itemRender, onPreview, downloadRequest }, actions: {
8519
8776
  upload: () => start(file),
8520
8777
  abort: () => abort(file.uid),
8521
8778
  remove: () => remove(file.uid),
8779
+ download: () => downloadUploadFile(file, downloadRequest),
8522
8780
  preview: () => {
8523
8781
  if (onPreview) onPreview(file);
8524
- else setPreview(file);
8782
+ else if ((file.type || file.originFileObj?.type)?.startsWith("image/") || /\.(png|jpe?g|gif|webp|avif|svg)$/i.test(file.name)) setPreview(file);
8783
+ else if (file.url || file.originFileObj) {
8784
+ const url = file.url || URL.createObjectURL(file.originFileObj);
8785
+ window.open(url, "_blank", "noopener,noreferrer");
8786
+ if (!file.url) window.setTimeout(() => URL.revokeObjectURL(url), 6e4);
8787
+ } else if (file.thumbUrl) setPreview(file);
8525
8788
  }
8526
8789
  } }, file.uid)),
8527
8790
  listType === "picture-card" && trigger
8528
8791
  ] }),
8529
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ImagePreview, { open: !!preview && !!(preview.url || previewSource), src: preview?.url || previewSource, alt: preview?.name, onOpenChange: (open) => {
8792
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImagePreview, { open: !!preview && !!(preview.url || previewSource), src: preview?.url || previewSource, alt: preview?.name, onOpenChange: (open) => {
8530
8793
  if (!open) setPreview(void 0);
8531
8794
  } })
8532
8795
  ]
@@ -8534,15 +8797,15 @@ var UploadRoot = (0, import_react37.forwardRef)(function UploadRoot2({
8534
8797
  );
8535
8798
  });
8536
8799
  var UploadDragger = (0, import_react37.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
8537
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(UploadRoot, { ...props, ref, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "sia-upload-dragger__content", children: [
8538
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { name: "upload", size: 32 }),
8539
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("strong", { children: [
8800
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UploadRoot, { ...props, ref, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "sia-upload-dragger__content", children: [
8801
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { name: "upload", size: 32 }),
8802
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("strong", { children: [
8540
8803
  "\u70B9\u51FB\u6216\u62D6\u62FD",
8541
8804
  props.directory ? "\u6587\u4EF6\u5939" : "\u6587\u4EF6",
8542
8805
  "\u5230\u6B64\u533A\u57DF\u4E0A\u4F20"
8543
8806
  ] }),
8544
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: hint }),
8545
- props.pastable && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: "\u805A\u7126\u6B64\u533A\u57DF\u540E\u6309 Ctrl / \u2318 + V \u7C98\u8D34\u6587\u4EF6\u6216\u622A\u56FE" })
8807
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: hint }),
8808
+ props.pastable && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "\u805A\u7126\u6B64\u533A\u57DF\u540E\u6309 Ctrl / \u2318 + V \u7C98\u8D34\u6587\u4EF6\u6216\u622A\u56FE" })
8546
8809
  ] }) });
8547
8810
  });
8548
8811
  var Upload = Object.assign(UploadRoot, {
@@ -8554,7 +8817,7 @@ var Upload = Object.assign(UploadRoot, {
8554
8817
 
8555
8818
  // src/components/TextArea.tsx
8556
8819
  var import_react38 = require("react");
8557
- var import_jsx_runtime38 = require("react/jsx-runtime");
8820
+ var import_jsx_runtime39 = require("react/jsx-runtime");
8558
8821
  var TextArea = (0, import_react38.forwardRef)(function TextArea2({
8559
8822
  label,
8560
8823
  hint,
@@ -8584,8 +8847,8 @@ var TextArea = (0, import_react38.forwardRef)(function TextArea2({
8584
8847
  setUncontrolledValue(event.target.value);
8585
8848
  onChange?.(event);
8586
8849
  }
8587
- const control = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
8588
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8850
+ const control = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
8851
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8589
8852
  "textarea",
8590
8853
  {
8591
8854
  ...withTitleTooltip(props),
@@ -8603,16 +8866,16 @@ var TextArea = (0, import_react38.forwardRef)(function TextArea2({
8603
8866
  }
8604
8867
  ),
8605
8868
  floating.label,
8606
- showCount ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: `sia-textarea-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
8869
+ showCount ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: `sia-textarea-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
8607
8870
  currentText.length,
8608
8871
  maxLength !== void 0 ? `/${maxLength}` : null
8609
8872
  ] }) : null
8610
8873
  ] });
8611
- if (!label && !hint) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: `sia-field ${className}`.trim(), children: control });
8612
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: `sia-field ${className}`.trim(), children: [
8613
- label ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { className: "sia-field__label", htmlFor: textAreaId, children: label }) : null,
8874
+ if (!label && !hint) return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: `sia-field ${className}`.trim(), children: control });
8875
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: `sia-field ${className}`.trim(), children: [
8876
+ label ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { className: "sia-field__label", htmlFor: textAreaId, children: label }) : null,
8614
8877
  control,
8615
- hint ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
8878
+ hint ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
8616
8879
  ] });
8617
8880
  });
8618
8881
 
@@ -8630,7 +8893,7 @@ var import_extension_table_cell = __toESM(require("@tiptap/extension-table-cell"
8630
8893
  var import_extension_task_list = __toESM(require("@tiptap/extension-task-list"), 1);
8631
8894
  var import_extension_task_item = __toESM(require("@tiptap/extension-task-item"), 1);
8632
8895
  var import_markdown = require("@tiptap/markdown");
8633
- var import_jsx_runtime39 = require("react/jsx-runtime");
8896
+ var import_jsx_runtime40 = require("react/jsx-runtime");
8634
8897
  function escapeHtml(value) {
8635
8898
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#039;");
8636
8899
  }
@@ -8647,8 +8910,8 @@ function sanitizeContent(value) {
8647
8910
  }
8648
8911
  function RichTextContent({ content, emptyText = "\u6682\u65E0\u5185\u5BB9", className = "", ...props }) {
8649
8912
  const html = (0, import_react39.useMemo)(() => sanitizeContent(content), [content]);
8650
- if (!html.trim()) return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: `sia-rich-text-content sia-rich-text-content--empty ${className}`.trim(), children: emptyText });
8651
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("article", { className: `sia-rich-text-content ${className}`.trim(), dangerouslySetInnerHTML: { __html: html }, ...withTitleTooltip(props) });
8913
+ if (!html.trim()) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `sia-rich-text-content sia-rich-text-content--empty ${className}`.trim(), children: emptyText });
8914
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("article", { className: `sia-rich-text-content ${className}`.trim(), dangerouslySetInnerHTML: { __html: html }, ...withTitleTooltip(props) });
8652
8915
  }
8653
8916
  function RichTextEditor({
8654
8917
  value,
@@ -8790,7 +9053,7 @@ function RichTextEditor({
8790
9053
  setLinkEditorOpen(false);
8791
9054
  }
8792
9055
  function formatButton(label, action, active = false, disabledByState = false, content) {
8793
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
9056
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8794
9057
  Button,
8795
9058
  {
8796
9059
  type: "button",
@@ -8828,27 +9091,27 @@ function RichTextEditor({
8828
9091
  }
8829
9092
  };
8830
9093
  const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: editor ? !editor.isEmpty : Boolean(value ?? defaultValue) });
8831
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { ...withTitleTooltip(props), id, style: mergedStyle, className: `sia-rich-text-editor${floating.className}${disabled ? " is-disabled" : ""} sia-rich-text-editor--${toolbar} ${className}`.trim(), children: [
9094
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { ...withTitleTooltip(props), id, style: mergedStyle, className: `sia-rich-text-editor${floating.className}${disabled ? " is-disabled" : ""} sia-rich-text-editor--${toolbar} ${className}`.trim(), children: [
8832
9095
  floating.label,
8833
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "sia-rich-text-editor__toolbar", "aria-label": "\u6587\u672C\u683C\u5F0F\u5DE5\u5177\u680F", children: [
8834
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "sia-rich-text-editor__toolbar-main", children: [
8835
- toolbar === "full" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8836
- formatButton("\u64A4\u9500", () => editor?.chain().focus().undo().run(), false, !editor?.can().undo(), /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "undo" })),
8837
- formatButton("\u91CD\u505A", () => editor?.chain().focus().redo().run(), false, !editor?.can().redo(), /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "redo" })),
8838
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "sia-rich-text-editor__divider" }),
8839
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Dropdown, { menu: blockTypeMenu, trigger: ["click"], placement: "bottomLeft", disabled: disabled || !editor, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Button, { type: "button", variant: "text", size: "small", className: "sia-rich-text-editor__block-type", disabled: disabled || !editor, "aria-label": "\u6BB5\u843D\u683C\u5F0F", title: "\u6BB5\u843D\u683C\u5F0F", onMouseDown: (event) => event.preventDefault(), children: [
9096
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "sia-rich-text-editor__toolbar", "aria-label": "\u6587\u672C\u683C\u5F0F\u5DE5\u5177\u680F", children: [
9097
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "sia-rich-text-editor__toolbar-main", children: [
9098
+ toolbar === "full" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
9099
+ formatButton("\u64A4\u9500", () => editor?.chain().focus().undo().run(), false, !editor?.can().undo(), /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "undo" })),
9100
+ formatButton("\u91CD\u505A", () => editor?.chain().focus().redo().run(), false, !editor?.can().redo(), /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "redo" })),
9101
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sia-rich-text-editor__divider" }),
9102
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Dropdown, { menu: blockTypeMenu, trigger: ["click"], placement: "bottomLeft", disabled: disabled || !editor, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Button, { type: "button", variant: "text", size: "small", className: "sia-rich-text-editor__block-type", disabled: disabled || !editor, "aria-label": "\u6BB5\u843D\u683C\u5F0F", title: "\u6BB5\u843D\u683C\u5F0F", onMouseDown: (event) => event.preventDefault(), children: [
8840
9103
  currentBlockLabel,
8841
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "chevron-down", size: 13 })
9104
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "chevron-down", size: 13 })
8842
9105
  ] }) }),
8843
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "sia-rich-text-editor__divider" })
9106
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sia-rich-text-editor__divider" })
8844
9107
  ] }) : null,
8845
- formatButton("\u52A0\u7C97", () => editor?.chain().focus().toggleBold().run(), Boolean(editor?.isActive("bold")), false, /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("strong", { children: "B" })),
8846
- formatButton("\u659C\u4F53", () => editor?.chain().focus().toggleItalic().run(), Boolean(editor?.isActive("italic")), false, /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("em", { children: "I" })),
8847
- toolbar === "full" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8848
- formatButton("\u4E0B\u5212\u7EBF", () => editor?.chain().focus().toggleUnderline().run(), Boolean(editor?.isActive("underline")), false, /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("u", { children: "U" })),
8849
- formatButton("\u5220\u9664\u7EBF", () => editor?.chain().focus().toggleStrike().run(), Boolean(editor?.isActive("strike")), false, /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("s", { children: "S" })),
9108
+ formatButton("\u52A0\u7C97", () => editor?.chain().focus().toggleBold().run(), Boolean(editor?.isActive("bold")), false, /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("strong", { children: "B" })),
9109
+ formatButton("\u659C\u4F53", () => editor?.chain().focus().toggleItalic().run(), Boolean(editor?.isActive("italic")), false, /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("em", { children: "I" })),
9110
+ toolbar === "full" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
9111
+ formatButton("\u4E0B\u5212\u7EBF", () => editor?.chain().focus().toggleUnderline().run(), Boolean(editor?.isActive("underline")), false, /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("u", { children: "U" })),
9112
+ formatButton("\u5220\u9664\u7EBF", () => editor?.chain().focus().toggleStrike().run(), Boolean(editor?.isActive("strike")), false, /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("s", { children: "S" })),
8850
9113
  formatButton("\u884C\u5185\u4EE3\u7801", () => editor?.chain().focus().toggleCode().run(), Boolean(editor?.isActive("code")), false, "</>"),
8851
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
9114
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8852
9115
  Dropdown,
8853
9116
  {
8854
9117
  menu: { items: [] },
@@ -8858,48 +9121,48 @@ function RichTextEditor({
8858
9121
  disabled: disabled || !editor,
8859
9122
  onOpenChange: openLinkEditor,
8860
9123
  popupClassName: "sia-rich-text-editor__link-popup",
8861
- popupRender: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("form", { className: "sia-rich-text-editor__link-form", onSubmit: submitLink, children: [
8862
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Input, { autoFocus: true, "aria-label": "\u94FE\u63A5\u5730\u5740", value: linkHref, onChange: (event) => setLinkHref(event.target.value), placeholder: "https://example.com" }),
8863
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "submit", variant: "primary", size: "small", children: "\u5E94\u7528" }),
8864
- editor?.isActive("link") ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", size: "small", onClick: () => {
9124
+ popupRender: () => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("form", { className: "sia-rich-text-editor__link-form", onSubmit: submitLink, children: [
9125
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Input, { autoFocus: true, "aria-label": "\u94FE\u63A5\u5730\u5740", value: linkHref, onChange: (event) => setLinkHref(event.target.value), placeholder: "https://example.com" }),
9126
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "submit", variant: "primary", size: "small", children: "\u5E94\u7528" }),
9127
+ editor?.isActive("link") ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "button", size: "small", onClick: () => {
8865
9128
  setLinkHref("");
8866
9129
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
8867
9130
  setLinkEditorOpen(false);
8868
9131
  }, children: "\u79FB\u9664" }) : null
8869
9132
  ] }),
8870
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", variant: "text", size: "small", className: `sia-rich-text-editor__tool${editor?.isActive("link") ? " is-active" : ""}`, disabled: disabled || !editor, "aria-label": "\u94FE\u63A5", "aria-pressed": editor?.isActive("link") || void 0, title: "\u94FE\u63A5", onMouseDown: (event) => event.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "link" }) })
9133
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "button", variant: "text", size: "small", className: `sia-rich-text-editor__tool${editor?.isActive("link") ? " is-active" : ""}`, disabled: disabled || !editor, "aria-label": "\u94FE\u63A5", "aria-pressed": editor?.isActive("link") || void 0, title: "\u94FE\u63A5", onMouseDown: (event) => event.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "link" }) })
8871
9134
  }
8872
9135
  ),
8873
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "sia-rich-text-editor__divider" })
9136
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sia-rich-text-editor__divider" })
8874
9137
  ] }) : null,
8875
9138
  formatButton("\u65E0\u5E8F\u5217\u8868", () => editor?.chain().focus().toggleBulletList().run(), Boolean(editor?.isActive("bulletList")), false, "\u2022 \u5217\u8868"),
8876
9139
  formatButton("\u6709\u5E8F\u5217\u8868", () => editor?.chain().focus().toggleOrderedList().run(), Boolean(editor?.isActive("orderedList")), false, "1. \u5217\u8868"),
8877
- toolbar === "full" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
9140
+ toolbar === "full" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
8878
9141
  formatButton("\u4EFB\u52A1\u5217\u8868", () => editor?.chain().focus().toggleTaskList().run(), Boolean(editor?.isActive("taskList")), false, "\u2611 \u4EFB\u52A1"),
8879
9142
  formatButton("\u5F15\u7528", () => editor?.chain().focus().toggleBlockquote().run(), Boolean(editor?.isActive("blockquote")), false, "\u275D \u5F15\u7528"),
8880
9143
  formatButton("\u4EE3\u7801\u5757", () => editor?.chain().focus().toggleCodeBlock().run(), Boolean(editor?.isActive("codeBlock")), false, "\u4EE3\u7801\u5757"),
8881
9144
  formatButton("\u63D2\u5165\u8868\u683C", () => editor?.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(), Boolean(editor?.isActive("table")), false, "\u8868\u683C"),
8882
- formatButton("\u5206\u5272\u7EBF", () => editor?.chain().focus().setHorizontalRule().run(), false, false, /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "minus" }))
9145
+ formatButton("\u5206\u5272\u7EBF", () => editor?.chain().focus().setHorizontalRule().run(), false, false, /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "minus" }))
8883
9146
  ] }) : null
8884
9147
  ] }),
8885
- onPasteImage ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("small", { children: [
8886
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "image", size: 14 }),
9148
+ onPasteImage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("small", { children: [
9149
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "image", size: 14 }),
8887
9150
  pasteImageHint
8888
9151
  ] }) : null
8889
9152
  ] }),
8890
- toolbar === "full" && editor?.isActive("table") ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "sia-rich-text-editor__table-toolbar", "aria-label": "\u8868\u683C\u5DE5\u5177\u680F", children: [
8891
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "\u8868\u683C" }),
9153
+ toolbar === "full" && editor?.isActive("table") ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "sia-rich-text-editor__table-toolbar", "aria-label": "\u8868\u683C\u5DE5\u5177\u680F", children: [
9154
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "\u8868\u683C" }),
8892
9155
  formatButton("\u524D\u65B9\u63D2\u5165\u5217", () => editor.chain().focus().addColumnBefore().run(), false, !editor.can().addColumnBefore(), "\u524D\u63D2\u5217"),
8893
9156
  formatButton("\u540E\u65B9\u63D2\u5165\u5217", () => editor.chain().focus().addColumnAfter().run(), false, !editor.can().addColumnAfter(), "\u540E\u63D2\u5217"),
8894
9157
  formatButton("\u5220\u9664\u5F53\u524D\u5217", () => editor.chain().focus().deleteColumn().run(), false, !editor.can().deleteColumn(), "\u5220\u5217"),
8895
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "sia-rich-text-editor__divider" }),
9158
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sia-rich-text-editor__divider" }),
8896
9159
  formatButton("\u4E0A\u65B9\u63D2\u5165\u884C", () => editor.chain().focus().addRowBefore().run(), false, !editor.can().addRowBefore(), "\u4E0A\u63D2\u884C"),
8897
9160
  formatButton("\u4E0B\u65B9\u63D2\u5165\u884C", () => editor.chain().focus().addRowAfter().run(), false, !editor.can().addRowAfter(), "\u4E0B\u63D2\u884C"),
8898
9161
  formatButton("\u5220\u9664\u5F53\u524D\u884C", () => editor.chain().focus().deleteRow().run(), false, !editor.can().deleteRow(), "\u5220\u884C"),
8899
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "sia-rich-text-editor__divider" }),
9162
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sia-rich-text-editor__divider" }),
8900
9163
  formatButton("\u5220\u9664\u8868\u683C", () => editor.chain().focus().deleteTable().run(), false, !editor.can().deleteTable(), "\u5220\u9664\u8868\u683C")
8901
9164
  ] }) : null,
8902
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref: editorElementRef, className: "sia-rich-text-editor__content" })
9165
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref: editorElementRef, className: "sia-rich-text-editor__content" })
8903
9166
  ] });
8904
9167
  }
8905
9168
 
@@ -9013,7 +9276,7 @@ var VDITOR_ZH_CN = {
9013
9276
  };
9014
9277
 
9015
9278
  // src/components/MarkdownEditor.tsx
9016
- var import_jsx_runtime40 = require("react/jsx-runtime");
9279
+ var import_jsx_runtime41 = require("react/jsx-runtime");
9017
9280
  var vditorLoaders = /* @__PURE__ */ new Map();
9018
9281
  var BASE_TOOLBAR = [
9019
9282
  "headings",
@@ -9273,7 +9536,7 @@ function MarkdownEditor({
9273
9536
  ...style,
9274
9537
  "--sia-markdown-editor-min-height": typeof minHeight === "number" ? `${minHeight}px` : minHeight
9275
9538
  };
9276
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9539
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
9277
9540
  "div",
9278
9541
  {
9279
9542
  className: ["sia-markdown-editor", floating.className, disabled ? "is-disabled" : "", className].filter(Boolean).join(" "),
@@ -9287,8 +9550,8 @@ function MarkdownEditor({
9287
9550
  },
9288
9551
  children: [
9289
9552
  floating.label,
9290
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { ref: mountRef, className: "sia-markdown-editor__mount" }),
9291
- !ready ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "sia-markdown-editor__loading", "aria-live": "polite", children: loadError || "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026" }) : null
9553
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { ref: mountRef, className: "sia-markdown-editor__mount" }),
9554
+ !ready ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "sia-markdown-editor__loading", "aria-live": "polite", children: loadError || "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026" }) : null
9292
9555
  ]
9293
9556
  }
9294
9557
  );
@@ -9689,7 +9952,7 @@ function registerSqlLanguages(monaco) {
9689
9952
  }
9690
9953
 
9691
9954
  // src/components/Editor.tsx
9692
- var import_jsx_runtime41 = require("react/jsx-runtime");
9955
+ var import_jsx_runtime42 = require("react/jsx-runtime");
9693
9956
  var EDITOR_COMMAND_SHORTCUTS = {
9694
9957
  cut: "Ctrl+X",
9695
9958
  copy: "Ctrl+C",
@@ -10292,11 +10555,11 @@ function Editor({
10292
10555
  })));
10293
10556
  });
10294
10557
  }, [generatedId, loading, markers]);
10295
- const editorNode = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `sia-editor-control ${className}`.trim(), "data-loading": loading || void 0, children: [
10296
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "sia-editor-control__surface", ref: containerRef, "aria-label": ariaLabel }),
10297
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { ref: rangeHighlightRef, className: "sia-editor-control__range-highlight", "aria-hidden": "true" }),
10298
- loading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "sia-editor-control__loading", role: "status", children: [
10299
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", {}),
10558
+ const editorNode = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `sia-editor-control ${className}`.trim(), "data-loading": loading || void 0, children: [
10559
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "sia-editor-control__surface", ref: containerRef, "aria-label": ariaLabel }),
10560
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { ref: rangeHighlightRef, className: "sia-editor-control__range-highlight", "aria-hidden": "true" }),
10561
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "sia-editor-control__loading", role: "status", children: [
10562
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", {}),
10300
10563
  loadingText
10301
10564
  ] }) : null
10302
10565
  ] });
@@ -10325,7 +10588,7 @@ function Editor({
10325
10588
  item.onClick?.(api);
10326
10589
  }
10327
10590
  }
10328
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10591
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10329
10592
  Dropdown,
10330
10593
  {
10331
10594
  className: "sia-editor-control__context-menu",
@@ -10345,7 +10608,7 @@ function Editor({
10345
10608
  var import_react42 = require("react");
10346
10609
  var import_dompurify2 = __toESM(require("dompurify"), 1);
10347
10610
  var import_marked = require("marked");
10348
- var import_jsx_runtime42 = require("react/jsx-runtime");
10611
+ var import_jsx_runtime43 = require("react/jsx-runtime");
10349
10612
  function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
10350
10613
  const rootRef = (0, import_react42.useRef)(null);
10351
10614
  const [previewImage, setPreviewImage] = (0, import_react42.useState)(null);
@@ -10411,11 +10674,11 @@ function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9",
10411
10674
  onKeyDown?.(event);
10412
10675
  }
10413
10676
  if (!content.trim()) {
10414
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
10677
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `sia-markdown sia-markdown--empty ${className}`.trim(), children: emptyText });
10415
10678
  }
10416
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
10417
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
10418
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
10679
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
10680
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("article", { ...withTitleTooltip(props), ref: rootRef, className: `sia-markdown ${className}`.trim(), onClick: handleClick, onKeyDown: handleKeyDown, dangerouslySetInnerHTML: { __html: html } }),
10681
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ImagePreview, { open: Boolean(previewImage), src: previewImage?.src, alt: previewImage?.alt, onOpenChange: (open) => {
10419
10682
  if (!open) setPreviewImage(null);
10420
10683
  } })
10421
10684
  ] });
@@ -10423,7 +10686,7 @@ function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9",
10423
10686
 
10424
10687
  // src/components/InputNumber.tsx
10425
10688
  var import_react43 = require("react");
10426
- var import_jsx_runtime43 = require("react/jsx-runtime");
10689
+ var import_jsx_runtime44 = require("react/jsx-runtime");
10427
10690
  function formatValue(value, precision) {
10428
10691
  if (value === null || !Number.isFinite(value)) return "";
10429
10692
  return precision === void 0 ? String(value) : value.toFixed(precision);
@@ -10512,7 +10775,7 @@ var InputNumber = (0, import_react43.forwardRef)(function InputNumber2({
10512
10775
  const increaseDisabled = disabled || readOnly || max !== void 0 && currentValue !== null && currentValue >= max;
10513
10776
  const decreaseDisabled = disabled || readOnly || min !== void 0 && currentValue !== null && currentValue <= min;
10514
10777
  const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
10515
- const input = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10778
+ const input = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
10516
10779
  "input",
10517
10780
  {
10518
10781
  ...withTitleTooltip(props),
@@ -10534,23 +10797,23 @@ var InputNumber = (0, import_react43.forwardRef)(function InputNumber2({
10534
10797
  onKeyDown: handleKeyDown
10535
10798
  }
10536
10799
  );
10537
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: `sia-input-number sia-input-number--${size} sia-input-number--${status}${floatingPlaceholder ? " sia-input-number--floating" : ""}${floatingPlaceholder && text.length > 0 ? " is-filled" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
10538
- prefix ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "sia-input-number__affix", children: prefix }) : null,
10539
- floatingPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "sia-input-number__input-wrap", children: [
10800
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: `sia-input-number sia-input-number--${size} sia-input-number--${status}${floatingPlaceholder ? " sia-input-number--floating" : ""}${floatingPlaceholder && text.length > 0 ? " is-filled" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
10801
+ prefix ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "sia-input-number__affix", children: prefix }) : null,
10802
+ floatingPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "sia-input-number__input-wrap", children: [
10540
10803
  input,
10541
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
10804
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "sia-input-number__floating-placeholder", "aria-hidden": "true", children: placeholder })
10542
10805
  ] }) : input,
10543
- suffix ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "sia-input-number__affix", children: suffix }) : null,
10544
- controls ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "sia-input-number__controls", children: [
10545
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", tabIndex: -1, "aria-label": "\u589E\u52A0\u6570\u503C", disabled: increaseDisabled, onClick: () => changeBy(1), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-up", size: 12 }) }),
10546
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", tabIndex: -1, "aria-label": "\u51CF\u5C11\u6570\u503C", disabled: decreaseDisabled, onClick: () => changeBy(-1), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-down", size: 12 }) })
10806
+ suffix ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "sia-input-number__affix", children: suffix }) : null,
10807
+ controls ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "sia-input-number__controls", children: [
10808
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", tabIndex: -1, "aria-label": "\u589E\u52A0\u6570\u503C", disabled: increaseDisabled, onClick: () => changeBy(1), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "chevron-up", size: 12 }) }),
10809
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { type: "button", tabIndex: -1, "aria-label": "\u51CF\u5C11\u6570\u503C", disabled: decreaseDisabled, onClick: () => changeBy(-1), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "chevron-down", size: 12 }) })
10547
10810
  ] }) : null
10548
10811
  ] });
10549
10812
  });
10550
10813
 
10551
10814
  // src/components/SelectModal.tsx
10552
10815
  var import_react44 = require("react");
10553
- var import_jsx_runtime44 = require("react/jsx-runtime");
10816
+ var import_jsx_runtime45 = require("react/jsx-runtime");
10554
10817
  function SelectModalBody({ config, values, disabled, onChange }) {
10555
10818
  const [query, setQuery] = (0, import_react44.useState)("");
10556
10819
  const [selectedOnly, setSelectedOnly] = (0, import_react44.useState)(false);
@@ -10567,23 +10830,23 @@ function SelectModalBody({ config, values, disabled, onChange }) {
10567
10830
  });
10568
10831
  onChange([...next]);
10569
10832
  };
10570
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
10571
- config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
10572
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "sia-select-modal__heading", children: [
10573
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
10574
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
10575
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
10833
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
10834
+ config.headerExtra != null && config.headerExtra !== false ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "sia-select-modal__header-extra", children: config.headerExtra }) : null,
10835
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "sia-select-modal__heading", children: [
10836
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { role: "tablist", "aria-label": "\u9009\u9879\u8303\u56F4", children: [
10837
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { role: "tab", "aria-selected": !selectedOnly, variant: "link", onClick: () => setSelectedOnly(false), children: "\u5168\u90E8" }),
10838
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Button, { role: "tab", "aria-selected": selectedOnly, variant: "link", onClick: () => setSelectedOnly(true), children: [
10576
10839
  "\u5DF2\u9009\u9879(",
10577
10840
  values.length,
10578
10841
  ")"
10579
10842
  ] })
10580
10843
  ] }),
10581
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
10844
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10582
10845
  Input,
10583
10846
  {
10584
10847
  "aria-label": config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
10585
10848
  placeholder: config.searchPlaceholder ?? "\u641C\u7D22\u9009\u9879",
10586
- prefix: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "search", size: 14 }),
10849
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "search", size: 14 }),
10587
10850
  value: query,
10588
10851
  allowClear: true,
10589
10852
  disabled,
@@ -10594,8 +10857,8 @@ function SelectModalBody({ config, values, disabled, onChange }) {
10594
10857
  }
10595
10858
  )
10596
10859
  ] }),
10597
- multiple ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "sia-select-modal__actions", children: [
10598
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
10860
+ multiple ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "sia-select-modal__actions", children: [
10861
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10599
10862
  Checkbox2,
10600
10863
  {
10601
10864
  checked: all,
@@ -10605,10 +10868,10 @@ function SelectModalBody({ config, values, disabled, onChange }) {
10605
10868
  children: "\u5168\u9009"
10606
10869
  }
10607
10870
  ),
10608
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
10609
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
10871
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { variant: "link", size: "small", disabled: disabled || !enabled.length, onClick: () => batch("invert"), children: "\u53CD\u9009" }),
10872
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { variant: "link", size: "small", danger: true, disabled: disabled || !values.length, onClick: () => onChange([]), children: "\u6E05\u7A7A" })
10610
10873
  ] }) : null,
10611
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
10874
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10612
10875
  SelectionPanel,
10613
10876
  {
10614
10877
  options: filtered,
@@ -10634,7 +10897,7 @@ function openSelectModal(config) {
10634
10897
  if (config.mode !== "multiple") values = values.slice(0, 1);
10635
10898
  let submitting = false;
10636
10899
  function body() {
10637
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
10900
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectModalBody, { config: current, values, disabled: submitting || Boolean(current.confirmLoading), onChange: (next) => {
10638
10901
  values = next;
10639
10902
  handle.update({ children: body() });
10640
10903
  } });
@@ -10676,111 +10939,6 @@ function openSelectModal(config) {
10676
10939
  };
10677
10940
  }
10678
10941
 
10679
- // src/components/Message.tsx
10680
- var import_client5 = require("react-dom/client");
10681
- var import_jsx_runtime45 = require("react/jsx-runtime");
10682
- var messageSeed = 0;
10683
- var messageRoot = null;
10684
- var messageContainer = null;
10685
- var messageItems = [];
10686
- var defaultDuration = 3;
10687
- var maxCount = 5;
10688
- var messageTimers = /* @__PURE__ */ new Map();
10689
- var messageIcons = {
10690
- info: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "info", size: 18 }),
10691
- success: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "circle-check", size: 18 }),
10692
- warning: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "warning", size: 18 }),
10693
- error: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "circle-close", size: 18 }),
10694
- loading: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "loader", size: 18, spin: true })
10695
- };
10696
- function ensureMessageRoot() {
10697
- if (typeof document === "undefined") return false;
10698
- if (!messageContainer) {
10699
- messageContainer = document.createElement("div");
10700
- messageContainer.className = "sia-message-root";
10701
- document.body.appendChild(messageContainer);
10702
- messageRoot = (0, import_client5.createRoot)(messageContainer);
10703
- }
10704
- return true;
10705
- }
10706
- function renderMessages() {
10707
- if (!ensureMessageRoot()) return;
10708
- messageRoot.render(/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "sia-message-list", "aria-live": "polite", children: messageItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: `sia-message sia-message--${item.type}`, role: item.type === "loading" ? "status" : "alert", children: [
10709
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "sia-message__icon", "aria-hidden": "true", children: messageIcons[item.type] }),
10710
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "sia-message__content", children: item.content }),
10711
- item.closable ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", className: "sia-message__close", "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: () => closeMessage(item.key), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "close", size: 14 }) }) : null
10712
- ] }, item.key)) }));
10713
- }
10714
- function closeMessage(key) {
10715
- const item = messageItems.find((candidate) => candidate.key === key);
10716
- const timer = messageTimers.get(key);
10717
- if (timer !== void 0) window.clearTimeout(timer);
10718
- messageTimers.delete(key);
10719
- messageItems = messageItems.filter((candidate) => candidate.key !== key);
10720
- item?.onClose?.();
10721
- renderMessages();
10722
- }
10723
- function scheduleMessage(item) {
10724
- const existingTimer = messageTimers.get(item.key);
10725
- if (existingTimer !== void 0) window.clearTimeout(existingTimer);
10726
- const duration = item.duration ?? (item.type === "loading" ? 0 : defaultDuration);
10727
- if (duration > 0) {
10728
- messageTimers.set(item.key, window.setTimeout(() => closeMessage(item.key), duration * 1e3));
10729
- }
10730
- }
10731
- function openMessage(input) {
10732
- const config = typeof input === "object" && input !== null && "content" in input ? input : { content: input };
10733
- const key = config.key ?? `sia-message-${++messageSeed}`;
10734
- const item = { ...config, key, type: config.type ?? "info" };
10735
- const existingIndex = messageItems.findIndex((candidate) => candidate.key === key);
10736
- if (existingIndex >= 0) messageItems = messageItems.map((candidate, index) => index === existingIndex ? item : candidate);
10737
- else messageItems = [...messageItems, item];
10738
- while (messageItems.length > maxCount) closeMessage(messageItems[0].key);
10739
- renderMessages();
10740
- scheduleMessage(item);
10741
- return {
10742
- close: () => closeMessage(key),
10743
- update(next) {
10744
- const current = messageItems.find((candidate) => candidate.key === key);
10745
- if (!current) return;
10746
- const updated = { ...current, ...next, key, type: next.type ?? current.type };
10747
- messageItems = messageItems.map((candidate) => candidate.key === key ? updated : candidate);
10748
- renderMessages();
10749
- scheduleMessage(updated);
10750
- }
10751
- };
10752
- }
10753
- function shortcut(type) {
10754
- return (content, duration) => openMessage({ content, duration, type });
10755
- }
10756
- var message = {
10757
- /** 直接打开实例,返回可用于更新或关闭的操作句柄。 */
10758
- open: openMessage,
10759
- /** 显示普通信息提示。 */
10760
- info: shortcut("info"),
10761
- /** 显示成功提示。 */
10762
- success: shortcut("success"),
10763
- /** 显示警告提示。 */
10764
- warning: shortcut("warning"),
10765
- /** 显示错误提示。 */
10766
- error: shortcut("error"),
10767
- /** 显示持续加载提示。 */
10768
- loading: shortcut("loading"),
10769
- /** 关闭指定实例;未指定标识时关闭所有实例。 */
10770
- destroy(key) {
10771
- if (key !== void 0) {
10772
- closeMessage(key);
10773
- return;
10774
- }
10775
- [...messageItems].forEach((item) => closeMessage(item.key));
10776
- },
10777
- /** 配置消息默认持续时间和最大同时显示数量。 */
10778
- config(config) {
10779
- if (config.duration !== void 0) defaultDuration = config.duration;
10780
- if (config.maxCount !== void 0) maxCount = Math.max(1, config.maxCount);
10781
- }
10782
- };
10783
-
10784
10942
  // src/components/Tag.tsx
10785
10943
  var import_jsx_runtime46 = require("react/jsx-runtime");
10786
10944
  function Tag({