dishui 0.0.84 → 0.0.89

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 (89) hide show
  1. package/dist/components/Input/index.js +52 -62
  2. package/dist/components/Input/index.js.map +1 -1
  3. package/dist/components/LayoutSuite/index.d.ts +10 -0
  4. package/dist/components/LayoutSuite/index.js +27 -18
  5. package/dist/components/LayoutSuite/index.js.map +1 -1
  6. package/dist/components/Markdown/markdownComponents.js +1 -0
  7. package/dist/components/Markdown/markdownComponents.js.map +1 -1
  8. package/dist/components/Markdown/useMarkdownSource.js +46 -31
  9. package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
  10. package/dist/components/Markdown/useMarkmapRenderer.js +44 -31
  11. package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
  12. package/dist/components/Markdown/useMermaidRenderer.js +49 -31
  13. package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
  14. package/dist/components/ProtectedRoute/index.d.ts +2 -1
  15. package/dist/components/ProtectedRoute/index.js +16 -6
  16. package/dist/components/ProtectedRoute/index.js.map +1 -1
  17. package/dist/components/Select/index.d.ts +6 -0
  18. package/dist/components/Select/index.js +166 -136
  19. package/dist/components/Select/index.js.map +1 -1
  20. package/dist/components/Tabs/index.d.ts +12 -1
  21. package/dist/components/Tabs/index.js +42 -17
  22. package/dist/components/Tabs/index.js.map +1 -1
  23. package/dist/components/pro/ArticleContextMenu/index.js +7 -7
  24. package/dist/components/pro/CodeEditor/editors/CodeEditor.js +200 -189
  25. package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
  26. package/dist/components/pro/CodeEditor/types.d.ts +3 -0
  27. package/dist/components/pro/DataTable/DataTable.d.ts +1 -1
  28. package/dist/components/pro/DataTable/DataTable.js +98 -240
  29. package/dist/components/pro/DataTable/DataTable.js.map +1 -1
  30. package/dist/components/pro/DataTable/components/TableBody.js +14 -16
  31. package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
  32. package/dist/components/pro/DataTable/components/TablePagination.d.ts +3 -9
  33. package/dist/components/pro/DataTable/components/TablePagination.js +29 -25
  34. package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
  35. package/dist/components/pro/DataTable/tanstack-table.d.ts +2 -2
  36. package/dist/components/pro/DataTable/tanstack-table.js +29 -21
  37. package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
  38. package/dist/components/pro/DataTable/treeDataUtils.d.ts +2 -0
  39. package/dist/components/pro/DataTable/treeDataUtils.js +18 -19
  40. package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
  41. package/dist/components/pro/DataTable/types.d.ts +24 -0
  42. package/dist/components/pro/DataTable/useDataTableModel.d.ts +16 -0
  43. package/dist/components/pro/DataTable/useDataTableModel.js +148 -0
  44. package/dist/components/pro/DataTable/useDataTableModel.js.map +1 -0
  45. package/dist/components/pro/FileExplorer/Breadcrumb.js +12 -12
  46. package/dist/components/pro/Flow/nodes/DataNodeView.js +87 -82
  47. package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
  48. package/dist/components/pro/Flow/nodes/MediaContent.js +1 -1
  49. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  50. package/dist/components/pro/Flow/nodes/MediaOverlay.js +1 -1
  51. package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
  52. package/dist/components/pro/Flow/nodes/Model3DView.js +69 -63
  53. package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
  54. package/dist/components/pro/Flow/nodes/chartGeometryBudget.d.ts +14 -0
  55. package/dist/components/pro/Flow/nodes/chartGeometryBudget.js +76 -0
  56. package/dist/components/pro/Flow/nodes/chartGeometryBudget.js.map +1 -0
  57. package/dist/components/pro/Flow/nodes/demandRender.d.ts +11 -0
  58. package/dist/components/pro/Flow/nodes/demandRender.js +26 -0
  59. package/dist/components/pro/Flow/nodes/demandRender.js.map +1 -0
  60. package/dist/components/pro/RichTextEditor/SlashMenu.js +68 -58
  61. package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
  62. package/dist/contexts/AppContext.d.ts +1 -0
  63. package/dist/contexts/AppContext.js +144 -145
  64. package/dist/contexts/AppContext.js.map +1 -1
  65. package/dist/contexts/authentication.d.ts +7 -0
  66. package/dist/contexts/authentication.js +22 -0
  67. package/dist/contexts/authentication.js.map +1 -0
  68. package/dist/dishui.css +1 -1
  69. package/dist/hooks/useControllableState.d.ts +6 -14
  70. package/dist/hooks/useControllableState.js +21 -15
  71. package/dist/hooks/useControllableState.js.map +1 -1
  72. package/dist/hooks/useTableColumns.d.ts +3 -3
  73. package/dist/hooks/useTableColumns.js +2 -2
  74. package/dist/hooks/useTableColumns.js.map +1 -1
  75. package/dist/hooks/useTableData.d.ts +11 -4
  76. package/dist/hooks/useTableData.js +44 -26
  77. package/dist/hooks/useTableData.js.map +1 -1
  78. package/dist/index-nostyled.d.ts +2 -2
  79. package/dist/index.d.ts +2 -2
  80. package/dist/index.js +97 -97
  81. package/dist/utils/i18n.js +1 -1
  82. package/dist/utils/i18n.js.map +1 -1
  83. package/dist/utils/routerBuilder.d.ts +7 -5
  84. package/dist/utils/routerBuilder.js +11 -15
  85. package/dist/utils/routerBuilder.js.map +1 -1
  86. package/dist/utils/safeStorage.d.ts +8 -0
  87. package/dist/utils/safeStorage.js +45 -0
  88. package/dist/utils/safeStorage.js.map +1 -0
  89. package/package.json +22 -5
@@ -1,34 +1,59 @@
1
1
  import { cn as e } from "../../utils/cn.js";
2
- import "react";
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
+ import { useId as t, useRef as n, useState as r } from "react";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
4
  //#region src/components/Tabs/index.tsx
5
- var r = {
5
+ var o = {
6
6
  xs: "tabs-xs",
7
7
  sm: "tabs-sm",
8
8
  md: "tabs-md",
9
9
  lg: "tabs-lg",
10
10
  xl: "tabs-xl"
11
11
  };
12
- function i({ items: i, value: a, onChange: o, variant: s = "box", size: c = "sm", block: l = !1, className: u = "" }) {
13
- let d = s === "border" ? "tabs-border" : s === "lift" ? "tabs-lift" : s === "pill" ? "tabs-box dishui-tabs-pill" : "tabs-box";
14
- return /* @__PURE__ */ t("div", {
12
+ function s({ items: s, value: c, onChange: l, variant: u = "box", size: d = "sm", block: f = !1, id: p, "aria-label": m, "aria-labelledby": h, orientation: g = "horizontal", activationMode: _ = "manual", className: v = "" }) {
13
+ let y = t(), b = p ?? `tabs-${y}`, x = n(/* @__PURE__ */ new Map()), [S, C] = r(null), w = s.filter((e) => !e.disabled), T = w.find((e) => e.key === S)?.key ?? w.find((e) => e.key === c)?.key ?? w[0]?.key, E = (e, t) => {
14
+ if (e.target !== e.currentTarget || e.defaultPrevented || e.nativeEvent.isComposing || e.altKey || e.ctrlKey || e.metaKey) return;
15
+ let n = g === "vertical" ? "ArrowUp" : "ArrowLeft", r = g === "vertical" ? "ArrowDown" : "ArrowRight", i = w.findIndex((e) => e.key === t), a;
16
+ if (e.key === "Home") a = w[0];
17
+ else if (e.key === "End") a = w[w.length - 1];
18
+ else if (e.key === n || e.key === r) {
19
+ let t = e.key === r ? 1 : -1;
20
+ a = w[(i + t + w.length) % w.length];
21
+ } else return;
22
+ e.preventDefault(), e.stopPropagation(), a && (x.current.get(a.key)?.focus(), _ === "automatic" && a.key !== c && l(a.key));
23
+ }, D = u === "border" ? "tabs-border" : u === "lift" ? "tabs-lift" : u === "pill" ? "tabs-box dishui-tabs-pill" : "tabs-box";
24
+ return /* @__PURE__ */ i("div", {
25
+ id: b,
15
26
  role: "tablist",
16
- className: e("tabs h-auto min-h-0", r[c], d, l && "w-full", u),
17
- children: i.map((r) => /* @__PURE__ */ n("button", {
27
+ "aria-label": m,
28
+ "aria-labelledby": h,
29
+ "aria-orientation": g,
30
+ onBlur: (e) => {
31
+ e.currentTarget.contains(e.relatedTarget) || C(null);
32
+ },
33
+ className: e("tabs h-auto min-h-0", o[d], D, f && "w-full", g === "vertical" && "flex flex-col", v),
34
+ children: s.map((t) => /* @__PURE__ */ a("button", {
35
+ ref: (e) => {
36
+ e ? x.current.set(t.key, e) : x.current.delete(t.key);
37
+ },
38
+ id: t.id ?? `${b}-tab-${encodeURIComponent(t.key)}`,
18
39
  role: "tab",
19
40
  type: "button",
20
- "aria-selected": a === r.key,
21
- disabled: r.disabled,
22
- onClick: () => o(r.key),
23
- className: e("tab min-h-0 gap-1.5", l && "flex-1", a === r.key && "tab-active", r.disabled && "tab-disabled"),
24
- children: [r.icon && /* @__PURE__ */ t("span", {
41
+ "aria-selected": c === t.key,
42
+ "aria-controls": t.panelId,
43
+ tabIndex: !t.disabled && t.key === T ? 0 : -1,
44
+ disabled: t.disabled,
45
+ onFocus: () => C(t.key),
46
+ onKeyDown: (e) => E(e, t.key),
47
+ onClick: () => l(t.key),
48
+ className: e("tab min-h-0 gap-1.5", f && "flex-1", c === t.key && "tab-active", t.disabled && "tab-disabled"),
49
+ children: [t.icon && /* @__PURE__ */ i("span", {
25
50
  className: "[&>svg]:h-[1.1em] [&>svg]:w-[1.1em]",
26
- children: r.icon
27
- }), r.label]
28
- }, r.key))
51
+ children: t.icon
52
+ }), t.label]
53
+ }, t.key))
29
54
  });
30
55
  }
31
56
  //#endregion
32
- export { i as default };
57
+ export { s as default };
33
58
 
34
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tabs/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type TabItem<T extends string = string> = {\n key: T;\n label: React.ReactNode;\n /** 可选:标签前的图标 */\n icon?: React.ReactNode;\n /** 禁用该标签 */\n disabled?: boolean;\n};\n\nexport type TabsProps<T extends string = string> = {\n items: readonly TabItem<T>[];\n /** 当前激活的 tab key */\n value: T;\n /** 切换回调 */\n onChange: (key: T) => void;\n /**\n * 外观(基于 daisyUI 5 的 tabs 修饰类):\n * - `box` 实心分段(tabs-box)\n * - `border` 底部下划线(tabs-border)\n * - `lift` 抬升的文件夹页签(tabs-lift)\n * - `pill` 胶囊/圆角实心(DishUI 扩展)\n */\n variant?: 'box' | 'border' | 'lift' | 'pill';\n /** 尺寸:xs / sm / md / lg / xl */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** 占满可用宽度,各标签平分 */\n block?: boolean;\n className?: string;\n};\n\nconst SIZE_CLASS: Record<NonNullable<TabsProps['size']>, string> = {\n xs: 'tabs-xs',\n sm: 'tabs-sm',\n md: 'tabs-md',\n lg: 'tabs-lg',\n xl: 'tabs-xl',\n};\n\n/**\n * 标签页切换条。基于 daisyUI 5 的 `tabs` 系列修饰类,\n * 支持 box / border / lift / pill 四种外观、五档尺寸与等宽(block)模式。\n */\nfunction Tabs<T extends string = string>({\n items,\n value,\n onChange,\n variant = 'box',\n size = 'sm',\n block = false,\n className = '',\n}: TabsProps<T>) {\n // pill 是 DishUI 扩展:在 tabs-box 基础上追加胶囊圆角类(见 components.css)\n const variantClass =\n variant === 'border' ? 'tabs-border'\n : variant === 'lift' ? 'tabs-lift'\n : variant === 'pill' ? 'tabs-box dishui-tabs-pill'\n : 'tabs-box';\n\n return (\n <div\n role=\"tablist\"\n className={cn(\n 'tabs h-auto min-h-0',\n SIZE_CLASS[size],\n variantClass,\n block && 'w-full',\n className,\n )}\n >\n {items.map((item) => (\n <button\n key={item.key}\n role=\"tab\"\n type=\"button\"\n aria-selected={value === item.key}\n disabled={item.disabled}\n onClick={() => onChange(item.key)}\n className={cn(\n 'tab min-h-0 gap-1.5',\n block && 'flex-1',\n value === item.key && 'tab-active',\n item.disabled && 'tab-disabled',\n )}\n >\n {item.icon && <span className=\"[&>svg]:h-[1.1em] [&>svg]:w-[1.1em]\">{item.icon}</span>}\n {item.label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default Tabs;\n"],"mappings":";;;;AAiCA,IAAM,IAA6D;CAC/D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACR;AAMA,SAAS,EAAgC,EACrC,UACA,UACA,aACA,aAAU,OACV,UAAO,MACP,WAAQ,IACR,eAAY,MACC;CAEb,IAAM,IACF,MAAY,WAAW,gBACrB,MAAY,SAAS,cACrB,MAAY,SAAS,8BACrB;CAEN,OACI,kBAAC,OAAD;EACI,MAAK;EACL,WAAW,EACP,uBACA,EAAW,IACX,GACA,KAAS,UACT,CACJ;EAEC,UAAA,EAAM,KAAK,MACR,kBAAC,UAAD;GAEI,MAAK;GACL,MAAK;GACL,iBAAe,MAAU,EAAK;GAC9B,UAAU,EAAK;GACf,eAAe,EAAS,EAAK,GAAG;GAChC,WAAW,EACP,uBACA,KAAS,UACT,MAAU,EAAK,OAAO,cACtB,EAAK,YAAY,cACrB;GAZJ,UAAA,CAcK,EAAK,QAAQ,kBAAC,QAAD;IAAM,WAAU;IAAuC,UAAA,EAAK;GAAW,CAAA,GACpF,EAAK,KACF;EAfC,GAAA,EAAK,GAeN,CACX;CACA,CAAA;AAEb"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tabs/index.tsx"],"sourcesContent":["import React, { useId, useRef, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type TabItem<T extends string = string> = {\n key: T;\n label: React.ReactNode;\n /** 可选:标签前的图标 */\n icon?: React.ReactNode;\n /** 禁用该标签 */\n disabled?: boolean;\n /** Stable tab ID; use as the external panel's aria-labelledby. Generated when omitted. */\n id?: string;\n /** ID of a caller-rendered role=\"tabpanel\". Omit when used only as a filter. */\n panelId?: string;\n};\n\nexport type TabsProps<T extends string = string> = {\n items: readonly TabItem<T>[];\n /** 当前激活的 tab key */\n value: T;\n /** 切换回调 */\n onChange: (key: T) => void;\n /**\n * 外观(基于 daisyUI 5 的 tabs 修饰类):\n * - `box` 实心分段(tabs-box)\n * - `border` 底部下划线(tabs-border)\n * - `lift` 抬升的文件夹页签(tabs-lift)\n * - `pill` 胶囊/圆角实心(DishUI 扩展)\n */\n variant?: 'box' | 'border' | 'lift' | 'pill';\n /** 尺寸:xs / sm / md / lg / xl */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** 占满可用宽度,各标签平分 */\n block?: boolean;\n /** Tablist ID and prefix for generated tab IDs. */\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n orientation?: 'horizontal' | 'vertical';\n /** Manual (default): arrows move focus; Enter/Space activate. Automatic: arrows also activate. */\n activationMode?: 'manual' | 'automatic';\n className?: string;\n};\n\nconst SIZE_CLASS: Record<NonNullable<TabsProps['size']>, string> = {\n xs: 'tabs-xs',\n sm: 'tabs-sm',\n md: 'tabs-md',\n lg: 'tabs-lg',\n xl: 'tabs-xl',\n};\n\n/**\n * 标签页切换条。基于 daisyUI 5 的 `tabs` 系列修饰类,\n * 支持 box / border / lift / pill 四种外观、五档尺寸与等宽(block)模式。\n */\nfunction Tabs<T extends string = string>({\n items,\n value,\n onChange,\n variant = 'box',\n size = 'sm',\n block = false,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n orientation = 'horizontal',\n activationMode = 'manual',\n className = '',\n}: TabsProps<T>) {\n const generatedId = useId();\n const listId = id ?? `tabs-${generatedId}`;\n const buttons = useRef(new Map<T, HTMLButtonElement>());\n const [focusedKey, setFocusedKey] = useState<T | null>(null);\n const enabledItems = items.filter(item => !item.disabled);\n const tabStop = enabledItems.find(item => item.key === focusedKey)?.key\n ?? enabledItems.find(item => item.key === value)?.key\n ?? enabledItems[0]?.key;\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, key: T) => {\n if (event.target !== event.currentTarget || event.defaultPrevented || event.nativeEvent.isComposing || event.altKey || event.ctrlKey || event.metaKey) return;\n const previous = orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft';\n const next = orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight';\n const index = enabledItems.findIndex(item => item.key === key);\n let target: TabItem<T> | undefined;\n if (event.key === 'Home') target = enabledItems[0];\n else if (event.key === 'End') target = enabledItems[enabledItems.length - 1];\n else if (event.key === previous || event.key === next) {\n const step = event.key === next ? 1 : -1;\n target = enabledItems[(index + step + enabledItems.length) % enabledItems.length];\n } else return; // Native button Enter/Space activation goes through onClick once.\n event.preventDefault();\n event.stopPropagation();\n if (!target) return;\n buttons.current.get(target.key)?.focus();\n if (activationMode === 'automatic' && target.key !== value) onChange(target.key);\n };\n // pill 是 DishUI 扩展:在 tabs-box 基础上追加胶囊圆角类(见 components.css)\n const variantClass =\n variant === 'border' ? 'tabs-border'\n : variant === 'lift' ? 'tabs-lift'\n : variant === 'pill' ? 'tabs-box dishui-tabs-pill'\n : 'tabs-box';\n\n return (\n <div\n id={listId}\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-orientation={orientation}\n onBlur={event => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setFocusedKey(null);\n }}\n className={cn(\n 'tabs h-auto min-h-0',\n SIZE_CLASS[size],\n variantClass,\n block && 'w-full',\n orientation === 'vertical' && 'flex flex-col',\n className,\n )}\n >\n {items.map((item) => (\n <button\n key={item.key}\n ref={element => {\n if (element) buttons.current.set(item.key, element);\n else buttons.current.delete(item.key);\n }}\n id={item.id ?? `${listId}-tab-${encodeURIComponent(item.key)}`}\n role=\"tab\"\n type=\"button\"\n aria-selected={value === item.key}\n aria-controls={item.panelId}\n tabIndex={!item.disabled && item.key === tabStop ? 0 : -1}\n disabled={item.disabled}\n onFocus={() => setFocusedKey(item.key)}\n onKeyDown={event => handleKeyDown(event, item.key)}\n onClick={() => onChange(item.key)}\n className={cn(\n 'tab min-h-0 gap-1.5',\n block && 'flex-1',\n value === item.key && 'tab-active',\n item.disabled && 'tab-disabled',\n )}\n >\n {item.icon && <span className=\"[&>svg]:h-[1.1em] [&>svg]:w-[1.1em]\">{item.icon}</span>}\n {item.label}\n </button>\n ))}\n </div>\n );\n}\n\nexport default Tabs;\n"],"mappings":";;;;AA4CA,IAAM,IAA6D;CAC/D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACR;AAMA,SAAS,EAAgC,EACrC,UACA,UACA,aACA,aAAU,OACV,UAAO,MACP,WAAQ,IACR,OACA,cAAc,GACd,mBAAmB,GACnB,iBAAc,cACd,oBAAiB,UACjB,eAAY,MACC;CACb,IAAM,IAAc,EAAM,GACpB,IAAS,KAAM,QAAQ,KACvB,IAAU,kBAAO,IAAI,IAA0B,CAAC,GAChD,CAAC,GAAY,KAAiB,EAAmB,IAAI,GACrD,IAAe,EAAM,QAAO,MAAQ,CAAC,EAAK,QAAQ,GAClD,IAAU,EAAa,MAAK,MAAQ,EAAK,QAAQ,CAAU,CAAC,EAAE,OAC7D,EAAa,MAAK,MAAQ,EAAK,QAAQ,CAAK,CAAC,EAAE,OAC/C,EAAa,EAAE,EAAE,KAElB,KAAiB,GAA+C,MAAW;EAC7E,IAAI,EAAM,WAAW,EAAM,iBAAiB,EAAM,oBAAoB,EAAM,YAAY,eAAe,EAAM,UAAU,EAAM,WAAW,EAAM,SAAS;EACvJ,IAAM,IAAW,MAAgB,aAAa,YAAY,aACpD,IAAO,MAAgB,aAAa,cAAc,cAClD,IAAQ,EAAa,WAAU,MAAQ,EAAK,QAAQ,CAAG,GACzD;EACJ,IAAI,EAAM,QAAQ,QAAQ,IAAS,EAAa;OAC3C,IAAI,EAAM,QAAQ,OAAO,IAAS,EAAa,EAAa,SAAS;OACrE,IAAI,EAAM,QAAQ,KAAY,EAAM,QAAQ,GAAM;GACnD,IAAM,IAAO,EAAM,QAAQ,IAAO,IAAI;GACtC,IAAS,GAAc,IAAQ,IAAO,EAAa,UAAU,EAAa;EAC9E,OAAO;EACP,EAAM,eAAe,GACrB,EAAM,gBAAgB,GACjB,MACL,EAAQ,QAAQ,IAAI,EAAO,GAAG,CAAC,EAAE,MAAM,GACnC,MAAmB,eAAe,EAAO,QAAQ,KAAO,EAAS,EAAO,GAAG;CACnF,GAEM,IACF,MAAY,WAAW,gBACrB,MAAY,SAAS,cACrB,MAAY,SAAS,8BACrB;CAEN,OACI,kBAAC,OAAD;EACI,IAAI;EACJ,MAAK;EACL,cAAY;EACZ,mBAAiB;EACjB,oBAAkB;EAClB,SAAQ,MAAS;GACb,AAAK,EAAM,cAAc,SAAS,EAAM,aAA4B,KAAG,EAAc,IAAI;EAC7F;EACA,WAAW,EACP,uBACA,EAAW,IACX,GACA,KAAS,UACT,MAAgB,cAAc,iBAC9B,CACJ;EAEC,UAAA,EAAM,KAAK,MACR,kBAAC,UAAD;GAEI,MAAK,MAAW;IACZ,AAAI,IAAS,EAAQ,QAAQ,IAAI,EAAK,KAAK,CAAO,IAC7C,EAAQ,QAAQ,OAAO,EAAK,GAAG;GACxC;GACA,IAAI,EAAK,MAAM,GAAG,EAAO,OAAO,mBAAmB,EAAK,GAAG;GAC3D,MAAK;GACL,MAAK;GACL,iBAAe,MAAU,EAAK;GAC9B,iBAAe,EAAK;GACpB,UAAU,CAAC,EAAK,YAAY,EAAK,QAAQ,IAAU,IAAI;GACvD,UAAU,EAAK;GACf,eAAe,EAAc,EAAK,GAAG;GACrC,YAAW,MAAS,EAAc,GAAO,EAAK,GAAG;GACjD,eAAe,EAAS,EAAK,GAAG;GAChC,WAAW,EACP,uBACA,KAAS,UACT,MAAU,EAAK,OAAO,cACtB,EAAK,YAAY,cACrB;GArBJ,UAAA,CAuBK,EAAK,QAAQ,kBAAC,QAAD;IAAM,WAAU;IAAuC,UAAA,EAAK;GAAW,CAAA,GACpF,EAAK,KACF;EAxBC,GAAA,EAAK,GAwBN,CACX;CACA,CAAA;AAEb"}
@@ -1,6 +1,6 @@
1
- import { useClickOutside as e } from "../../../hooks/useClickOutside.js";
2
- import { useContainerElement as t } from "../../../hooks/useContainerElement.js";
3
- import { getMarkdownContent as n, getSelectionInfo as r } from "../../../utils/selection.js";
1
+ import { useContainerElement as e } from "../../../hooks/useContainerElement.js";
2
+ import { getMarkdownContent as t, getSelectionInfo as n } from "../../../utils/selection.js";
3
+ import { useClickOutside as r } from "../../../hooks/useClickOutside.js";
4
4
  import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
5
5
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
6
  //#region src/components/pro/ArticleContextMenu/index.tsx
@@ -8,8 +8,8 @@ var u = ({ targetId: u, targetRef: d, menuItems: f, className: p = "", enabled:
8
8
  let [h, g] = s(!1), [_, v] = s({
9
9
  x: 0,
10
10
  y: 0
11
- }), [y, b] = s(!1), x = o(null), S = t(u, d);
12
- e(x, i(() => g(!1), []), h);
11
+ }), [y, b] = s(!1), x = o(null), S = e(u, d);
12
+ r(x, i(() => g(!1), []), h);
13
13
  let C = i((e) => {
14
14
  if (!m || !S) return;
15
15
  let t = e.target, n = !1;
@@ -31,8 +31,8 @@ var u = ({ targetId: u, targetRef: d, menuItems: f, className: p = "", enabled:
31
31
  }), g(!0);
32
32
  }, [m, S]), w = i((e) => {
33
33
  if (e.disabled) return;
34
- let t = n(S), i = r(S);
35
- e.action(t, i), g(!1);
34
+ let r = t(S), i = n(S);
35
+ e.action(r, i), g(!1);
36
36
  }, [S]);
37
37
  return a(() => {
38
38
  if (!h) return;
@@ -1,290 +1,301 @@
1
1
  import { bracketMatchingStyle as e, jumpTargetHighlight as t, jumpToDefinition as n, lineHighlightStyle as r, smartAutocompletion as i } from "../extensions/index.js";
2
2
  import { createHighlightExtension as a, createThemeExtension as o } from "../themes.js";
3
3
  import { collectVariables as s, generateOutline as c } from "../utils.js";
4
- import { defaultContextMenu as l } from "../extensions/contextMenu.js";
5
- import { forwardRef as u, useCallback as d, useEffect as f, useImperativeHandle as p, useRef as m, useState as h } from "react";
6
- import { jsx as g, jsxs as ee } from "react/jsx-runtime";
7
- import { EditorView as _, drawSelection as te, highlightActiveLine as ne, highlightActiveLineGutter as re, keymap as ie, lineNumbers as ae } from "@codemirror/view";
8
- import { Compartment as v, EditorState as y } from "@codemirror/state";
9
- import { defaultKeymap as oe, history as se, historyKeymap as ce, indentWithTab as le } from "@codemirror/commands";
10
- import { bracketMatching as ue, defaultHighlightStyle as de, foldGutter as fe, indentOnInput as pe, syntaxHighlighting as me } from "@codemirror/language";
11
- import { closeBrackets as he, closeBracketsKeymap as ge, completionKeymap as _e } from "@codemirror/autocomplete";
12
- import { lintKeymap as ve } from "@codemirror/lint";
13
- import { searchKeymap as ye } from "@codemirror/search";
14
- import { javascript as b } from "@codemirror/lang-javascript";
15
- import { python as x } from "@codemirror/lang-python";
16
- import { html as S } from "@codemirror/lang-html";
17
- import { css as C } from "@codemirror/lang-css";
18
- import { json as w } from "@codemirror/lang-json";
19
- import { markdown as T } from "@codemirror/lang-markdown";
4
+ import { defaultContextMenu as ee } from "../extensions/contextMenu.js";
5
+ import { forwardRef as l, useCallback as u, useEffect as d, useImperativeHandle as te, useLayoutEffect as ne, useRef as f, useState as p } from "react";
6
+ import { jsx as m, jsxs as re } from "react/jsx-runtime";
7
+ import { EditorView as h, drawSelection as ie, highlightActiveLine as ae, highlightActiveLineGutter as oe, keymap as se, lineNumbers as ce } from "@codemirror/view";
8
+ import { Compartment as g, EditorState as _ } from "@codemirror/state";
9
+ import { defaultKeymap as le, history as ue, historyKeymap as de, indentWithTab as fe } from "@codemirror/commands";
10
+ import { bracketMatching as pe, defaultHighlightStyle as me, foldGutter as he, indentOnInput as ge, syntaxHighlighting as _e } from "@codemirror/language";
11
+ import { closeBrackets as ve, closeBracketsKeymap as ye, completionKeymap as be } from "@codemirror/autocomplete";
12
+ import { lintKeymap as xe } from "@codemirror/lint";
13
+ import { searchKeymap as Se } from "@codemirror/search";
14
+ import { javascript as v } from "@codemirror/lang-javascript";
15
+ import { python as y } from "@codemirror/lang-python";
16
+ import { html as b } from "@codemirror/lang-html";
17
+ import { css as x } from "@codemirror/lang-css";
18
+ import { json as Ce } from "@codemirror/lang-json";
19
+ import { markdown as we } from "@codemirror/lang-markdown";
20
20
  //#region src/components/pro/CodeEditor/editors/CodeEditor.tsx
21
- var E = (e) => ({
22
- javascript: () => b({ jsx: !1 }),
23
- jsx: () => b({ jsx: !0 }),
24
- typescript: () => b({
21
+ var Te = (e) => ({
22
+ javascript: () => v({ jsx: !1 }),
23
+ jsx: () => v({ jsx: !0 }),
24
+ typescript: () => v({
25
25
  jsx: !1,
26
26
  typescript: !0
27
27
  }),
28
- tsx: () => b({
28
+ tsx: () => v({
29
29
  jsx: !0,
30
30
  typescript: !0
31
31
  }),
32
- python: x,
33
- html: S,
34
- css: C,
35
- json: w,
36
- markdown: T
37
- })[e]?.() || b(), D = u(({ value: u = "", onChange: b, language: x = "javascript", theme: S = "light", readOnly: C = !1, lineNumbers: w = !0, highlightActiveLine: T = !0, autocompletion: D = !0, jumpToDefinition: O = !0, contextMenu: be, onVariablesCollected: k, onOutlineGenerated: A, enableHistory: j = !1, historyLimit: M = 50, historySaveInterval: N = 3, onHistoryChange: P, className: xe = "", height: Se = "400px", minHeight: Ce, maxHeight: we, placeholder: F, extensions: Te = [] }, Ee) => {
38
- let I = m(null), L = m(null), [R, De] = h({
32
+ python: y,
33
+ html: b,
34
+ css: x,
35
+ json: Ce,
36
+ markdown: we
37
+ })[e]?.() || v(), S = l(({ value: l = "", onChange: v, language: y = "javascript", theme: b = "light", readOnly: x = !1, lineNumbers: Ce = !0, highlightActiveLine: we = !0, autocompletion: S = !0, jumpToDefinition: C = !0, contextMenu: Ee, onVariablesCollected: w, onOutlineGenerated: T, enableHistory: E = !1, historyLimit: D = 50, historySaveInterval: O = 3, onHistoryChange: k, className: De = "", height: Oe = "400px", minHeight: ke, maxHeight: Ae, placeholder: je, extensions: Me = [] }, Ne) => {
38
+ let A = f(null), j = f(null), [M, N] = p({
39
39
  visible: !1,
40
40
  x: 0,
41
41
  y: 0
42
- }), [z, B] = h([]), [V, H] = h(-1), U = m(0), W = m(!1), G = m(!1), K = m(""), q = m(!1), J = m(""), Oe = m(new v()), ke = m(new v()), Ae = m(new v()), je = m(new v()), Y = m(x);
43
- f(() => {
44
- Y.current = x;
45
- }, [x]);
46
- let X = d((e) => {
47
- if (L.current) try {
48
- let t = L.current.state.doc.line(e);
49
- L.current.dispatch({
42
+ }), [P, F] = p([]), [I, L] = p(-1), R = f(0), z = f(!1), B = f(!1), V = f(""), H = f(!1), U = f(""), Pe = f(new g()), Fe = f(new g()), Ie = f(new g()), Le = f(new g()), W = f(y), G = f(l), K = f(null), q = f(0), J = f({
43
+ onChange: v,
44
+ onVariablesCollected: w,
45
+ onOutlineGenerated: T
46
+ }), Re = !!w, ze = !!T, Y = u(() => {
47
+ q.current += 1, K.current !== null && (clearTimeout(K.current), K.current = null);
48
+ }, []), X = u((e, t = 150) => {
49
+ Y();
50
+ let n = j.current;
51
+ if (!n || !J.current.onVariablesCollected && !J.current.onOutlineGenerated) return;
52
+ let r = q.current, i = n.state.doc, a = W.current, o = () => r === q.current && j.current === n && n.state.doc === i && W.current === a;
53
+ K.current = setTimeout(() => {
54
+ if (K.current = null, !o()) return;
55
+ let t = J.current.onVariablesCollected ? s(e, a) : void 0, n = J.current.onOutlineGenerated ? c(e, a) : void 0;
56
+ t && o() && J.current.onVariablesCollected?.(t), n && o() && J.current.onOutlineGenerated?.(n);
57
+ }, t);
58
+ }, [Y]), Z = u((e) => {
59
+ if (j.current) try {
60
+ let t = j.current.state.doc.line(e);
61
+ j.current.dispatch({
50
62
  selection: {
51
63
  anchor: t.from,
52
64
  head: t.to
53
65
  },
54
66
  scrollIntoView: !0
55
- }), L.current.focus();
67
+ }), j.current.focus();
56
68
  } catch (e) {
57
69
  console.error("Failed to jump to line:", e);
58
70
  }
59
- }, []), Z = d((e, t) => {
60
- if (!j || W.current || G.current) return;
61
- let n = Date.now(), r = N * 1e4;
62
- if (!(n - U.current >= r)) {
63
- q.current = !0, K.current = e;
71
+ }, []), Q = u((e, t) => {
72
+ if (!E || z.current || B.current) return;
73
+ let n = Date.now(), r = O * 1e4;
74
+ if (!(n - R.current >= r)) {
75
+ H.current = !0, V.current = e;
64
76
  return;
65
77
  }
66
- if (e === J.current && !t) {
67
- q.current = !1;
78
+ if (e === U.current && !t) {
79
+ H.current = !1;
68
80
  return;
69
81
  }
70
- U.current = n, q.current = !1, J.current = e, B((r) => {
71
- let i = V >= 0 ? r.slice(0, V + 1) : r, a = {
82
+ R.current = n, H.current = !1, U.current = e, F((r) => {
83
+ let i = I >= 0 ? r.slice(0, I + 1) : r, a = {
72
84
  id: `${n}-${Math.random()}`,
73
85
  timestamp: new Date(n),
74
86
  content: e,
75
87
  description: t
76
88
  }, o = [...i, a];
77
- o.length > M && o.shift();
89
+ o.length > D && o.shift();
78
90
  let s = o.length - 1;
79
- return H(s), setTimeout(() => {
80
- P && P(o, s);
91
+ return L(s), setTimeout(() => {
92
+ k && k(o, s);
81
93
  }, 0), o;
82
94
  });
83
95
  }, [
84
- j,
85
- M,
86
- N,
87
- V,
88
- P
89
- ]), Q = d((e) => {
90
- if (e < 0 || e >= z.length) return;
91
- W.current = !0;
92
- let t = z[e];
93
- L.current && L.current.dispatch({ changes: {
96
+ E,
97
+ D,
98
+ O,
99
+ I,
100
+ k
101
+ ]), Be = f(Q);
102
+ ne(() => {
103
+ W.current = y, J.current = {
104
+ onChange: v,
105
+ onVariablesCollected: w,
106
+ onOutlineGenerated: T
107
+ }, Be.current = Q;
108
+ });
109
+ let Ve = u((e) => {
110
+ if (e < 0 || e >= P.length) return;
111
+ z.current = !0;
112
+ let t = P[e];
113
+ j.current && j.current.dispatch({ changes: {
94
114
  from: 0,
95
- to: L.current.state.doc.length,
115
+ to: j.current.state.doc.length,
96
116
  insert: t.content
97
117
  } });
98
- let n = z.slice(0, e + 1);
99
- B(n);
118
+ let n = P.slice(0, e + 1);
119
+ F(n);
100
120
  let r = n.length - 1;
101
- H(r), setTimeout(() => {
102
- P && P(n, r);
103
- }, 0), b && b(t.content), setTimeout(() => {
104
- W.current = !1;
121
+ L(r), setTimeout(() => {
122
+ k && k(n, r);
123
+ }, 0), v && v(t.content), setTimeout(() => {
124
+ z.current = !1;
105
125
  }, 100);
106
126
  }, [
107
- z,
108
- b,
109
- P
127
+ P,
128
+ v,
129
+ k
110
130
  ]);
111
- p(Ee, () => ({
112
- jumpToLine: X,
113
- getView: () => L.current,
114
- getValue: () => L.current?.state.doc.toString() || "",
131
+ te(Ne, () => ({
132
+ jumpToLine: Z,
133
+ getView: () => j.current,
134
+ getValue: () => j.current?.state.doc.toString() || "",
115
135
  setValue: (e) => {
116
- L.current && L.current.dispatch({ changes: {
136
+ j.current && j.current.dispatch({ changes: {
117
137
  from: 0,
118
- to: L.current.state.doc.length,
138
+ to: j.current.state.doc.length,
119
139
  insert: e
120
140
  } });
121
141
  },
122
- focus: () => L.current?.focus(),
123
- getHistory: () => z,
124
- restoreHistory: Q,
142
+ focus: () => j.current?.focus(),
143
+ getHistory: () => P,
144
+ restoreHistory: Ve,
125
145
  clearHistory: () => {
126
- B([]), H(-1), U.current = 0, q.current = !1, K.current = "", J.current = "", setTimeout(() => {
127
- P && P([], -1);
146
+ F([]), L(-1), R.current = 0, H.current = !1, V.current = "", U.current = "", setTimeout(() => {
147
+ k && k([], -1);
128
148
  }, 0);
129
149
  }
130
150
  }), [
131
- X,
132
- z,
133
- Q,
134
- P
135
- ]), f(() => {
136
- if (!j) return;
137
- let e = N * 1e4, t = setInterval(() => {
138
- q.current && K.current && Z(K.current);
151
+ Z,
152
+ P,
153
+ Ve,
154
+ k
155
+ ]), d(() => {
156
+ if (!E) return;
157
+ let e = O * 1e4, t = setInterval(() => {
158
+ H.current && V.current && Q(V.current);
139
159
  }, e);
140
160
  return () => clearInterval(t);
141
161
  }, [
142
- j,
143
- N,
144
- Z
145
- ]), f(() => {
146
- if (!I.current) return;
147
- let l = _.updateListener.of((e) => {
148
- if (e.docChanged && b) {
149
- let t = e.state.doc.toString();
150
- b(t), j && !G.current && Z(t), G.current &&= !1;
151
- }
152
- if (e.docChanged && k) {
153
- let t = e.state.doc.toString();
154
- k(s(t, Y.current));
155
- }
156
- if (e.docChanged && A) {
157
- let t = e.state.doc.toString();
158
- A(c(t, Y.current));
162
+ E,
163
+ O,
164
+ Q
165
+ ]), d(() => {
166
+ if (!A.current) return;
167
+ let s = h.updateListener.of((e) => {
168
+ if (!e.docChanged) return;
169
+ let t = e.state.doc.toString();
170
+ G.current = t, X(t);
171
+ try {
172
+ B.current || Be.current(t);
173
+ } finally {
174
+ B.current = !1;
159
175
  }
160
- }), d = [
161
- se(),
162
- te(),
176
+ J.current.onChange?.(t);
177
+ }), c = [
163
178
  ue(),
164
- he(),
179
+ ie(),
165
180
  pe(),
166
- me(de, { fallback: !0 }),
167
- Oe.current.of(E(x)),
168
- ke.current.of(o(S)),
169
- Ae.current.of(a(S)),
170
- je.current.of(y.readOnly.of(C)),
171
- l,
172
- ie.of([
173
- ...ge,
174
- ...oe,
181
+ ve(),
182
+ ge(),
183
+ _e(me, { fallback: !0 }),
184
+ Pe.current.of(Te(y)),
185
+ Fe.current.of(o(b)),
186
+ Ie.current.of(a(b)),
187
+ Le.current.of(_.readOnly.of(x)),
188
+ s,
189
+ se.of([
175
190
  ...ye,
176
- ...ce,
177
- ..._e,
178
- ...ve,
179
- le
191
+ ...le,
192
+ ...Se,
193
+ ...de,
194
+ ...be,
195
+ ...xe,
196
+ fe
180
197
  ]),
181
198
  e,
182
199
  r,
183
200
  t
184
201
  ];
185
- if (w && d.push(ae(), fe(), re()), T && d.push(ne()), D) {
186
- let e = typeof D == "object" ? D : {};
187
- d.push(i(x, e));
202
+ if (Ce && c.push(ce(), he(), oe()), we && c.push(ae()), S) {
203
+ let e = typeof S == "object" ? S : {};
204
+ c.push(i(y, e));
188
205
  }
189
- if (O) {
190
- let e = typeof O == "object" ? O : {};
191
- d.push(n(X, e));
206
+ if (C) {
207
+ let e = typeof C == "object" ? C : {};
208
+ c.push(n(Z, e));
192
209
  }
193
- F && d.push(_.contentAttributes.of({ "data-placeholder": F })), Te.length > 0 && d.push(...Te);
194
- let f = y.create({
195
- doc: u,
196
- extensions: d
197
- }), p = new _({
198
- state: f,
199
- parent: I.current
210
+ je && c.push(h.contentAttributes.of({ "data-placeholder": je })), Me.length > 0 && c.push(...Me);
211
+ let ee = _.create({
212
+ doc: l,
213
+ extensions: c
214
+ }), u = new h({
215
+ state: ee,
216
+ parent: A.current
200
217
  });
201
- return L.current = p, setTimeout(() => {
202
- k && k(s(u, x)), A && A(c(u, x));
203
- }, 0), j && u && Z(u, "Initial content"), () => {
204
- p.destroy();
218
+ return j.current = u, G.current = u.state.doc.toString(), E && l && Q(l, "Initial content"), () => {
219
+ Y(), j.current = null, u.destroy();
205
220
  };
206
- }, []), f(() => {
207
- L.current && u !== L.current.state.doc.toString() && (G.current = !0, L.current.dispatch({ changes: {
221
+ }, []), d(() => {
222
+ j.current && l !== G.current && (B.current = !0, j.current.dispatch({ changes: {
208
223
  from: 0,
209
- to: L.current.state.doc.length,
210
- insert: u
224
+ to: j.current.state.doc.length,
225
+ insert: l
211
226
  } }));
212
- }, [u]), f(() => {
213
- if (L.current) {
214
- L.current.dispatch({ effects: Oe.current.reconfigure(E(x)) });
215
- let e = L.current.state.doc.toString();
216
- setTimeout(() => {
217
- k && k(s(e, x)), A && A(c(e, x));
218
- }, 0);
219
- }
220
- }, [
221
- x,
222
- k,
223
- A
224
- ]), f(() => {
225
- L.current && L.current.dispatch({ effects: [ke.current.reconfigure(o(S)), Ae.current.reconfigure(a(S))] });
226
- }, [S]), f(() => {
227
- L.current && L.current.dispatch({ effects: je.current.reconfigure(y.readOnly.of(C)) });
228
- }, [C]);
229
- let Me = d((e) => {
230
- e.preventDefault(), De({
227
+ }, [l]), d(() => {
228
+ j.current && j.current.dispatch({ effects: Pe.current.reconfigure(Te(y)) });
229
+ }, [y]), d(() => (X(G.current, 0), Y), [
230
+ y,
231
+ Re,
232
+ ze,
233
+ X,
234
+ Y
235
+ ]), d(() => {
236
+ j.current && j.current.dispatch({ effects: [Fe.current.reconfigure(o(b)), Ie.current.reconfigure(a(b))] });
237
+ }, [b]), d(() => {
238
+ j.current && j.current.dispatch({ effects: Le.current.reconfigure(_.readOnly.of(x)) });
239
+ }, [x]);
240
+ let He = u((e) => {
241
+ e.preventDefault(), N({
231
242
  visible: !0,
232
243
  x: e.clientX,
233
244
  y: e.clientY
234
245
  });
235
- }, []), $ = d(() => {
236
- De({
246
+ }, []), $ = u(() => {
247
+ N({
237
248
  visible: !1,
238
249
  x: 0,
239
250
  y: 0
240
251
  });
241
- }, []), Ne = d((e) => {
242
- L.current && !e.disabled && e.action(L.current), $();
252
+ }, []), Ue = u((e) => {
253
+ j.current && !e.disabled && e.action(j.current), $();
243
254
  }, [$]);
244
- f(() => {
245
- if (R.visible) {
255
+ d(() => {
256
+ if (M.visible) {
246
257
  let e = () => $();
247
258
  return document.addEventListener("click", e), () => document.removeEventListener("click", e);
248
259
  }
249
- }, [R.visible, $]);
250
- let Pe = {
251
- height: Se,
252
- minHeight: Ce,
253
- maxHeight: we,
260
+ }, [M.visible, $]);
261
+ let We = {
262
+ height: Oe,
263
+ minHeight: ke,
264
+ maxHeight: Ae,
254
265
  overflow: "auto"
255
- }, Fe = be || l;
256
- return /* @__PURE__ */ ee("div", {
257
- className: `code-editor-wrapper ${xe}`,
266
+ }, Ge = Ee || ee;
267
+ return /* @__PURE__ */ re("div", {
268
+ className: `code-editor-wrapper ${De}`,
258
269
  children: [
259
- /* @__PURE__ */ g("div", {
260
- ref: I,
261
- onContextMenu: Me,
262
- style: Pe,
270
+ /* @__PURE__ */ m("div", {
271
+ ref: A,
272
+ onContextMenu: He,
273
+ style: We,
263
274
  className: "code-editor"
264
275
  }),
265
- R.visible && /* @__PURE__ */ g("div", {
276
+ M.visible && /* @__PURE__ */ m("div", {
266
277
  className: "context-menu",
267
278
  style: {
268
279
  position: "fixed",
269
- top: R.y,
270
- left: R.x,
280
+ top: M.y,
281
+ left: M.x,
271
282
  zIndex: 1e3
272
283
  },
273
- children: /* @__PURE__ */ g("ul", {
284
+ children: /* @__PURE__ */ m("ul", {
274
285
  className: "menu bg-base-200 rounded-box shadow-lg",
275
- children: Fe.map((e, t) => e.separator ? /* @__PURE__ */ g("li", { className: "menu-separator" }, t) : /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g("a", {
276
- onClick: () => Ne(e),
286
+ children: Ge.map((e, t) => e.separator ? /* @__PURE__ */ m("li", { className: "menu-separator" }, t) : /* @__PURE__ */ m("li", { children: /* @__PURE__ */ m("a", {
287
+ onClick: () => Ue(e),
277
288
  className: e.disabled ? "disabled" : "",
278
289
  children: e.label
279
290
  }) }, t))
280
291
  })
281
292
  }),
282
- /* @__PURE__ */ g("style", { children: "\n .code-editor-wrapper {\n position: relative;\n border: 1px solid var(--fallback-bc, oklch(var(--bc) / 0.2));\n border-radius: 0.5rem;\n overflow: hidden;\n }\n\n .code-editor .cm-editor {\n height: 100%;\n }\n\n .code-editor .cm-scroller {\n overflow: auto;\n font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;\n font-size: 14px;\n line-height: 1.5;\n }\n\n .code-editor .cm-content[data-placeholder]::before {\n content: attr(data-placeholder);\n color: var(--fallback-bc, oklch(var(--bc) / 0.4));\n position: absolute;\n pointer-events: none;\n }\n\n .context-menu {\n min-width: 150px;\n }\n\n .context-menu .menu-separator {\n height: 1px;\n background: var(--fallback-bc, oklch(var(--bc) / 0.2));\n margin: 0.25rem 0;\n }\n\n .context-menu .disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n " })
293
+ /* @__PURE__ */ m("style", { children: "\n .code-editor-wrapper {\n position: relative;\n border: 1px solid var(--fallback-bc, oklch(var(--bc) / 0.2));\n border-radius: 0.5rem;\n overflow: hidden;\n }\n\n .code-editor .cm-editor {\n height: 100%;\n }\n\n .code-editor .cm-scroller {\n overflow: auto;\n font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;\n font-size: 14px;\n line-height: 1.5;\n }\n\n .code-editor .cm-content[data-placeholder]::before {\n content: attr(data-placeholder);\n color: var(--fallback-bc, oklch(var(--bc) / 0.4));\n position: absolute;\n pointer-events: none;\n }\n\n .context-menu {\n min-width: 150px;\n }\n\n .context-menu .menu-separator {\n height: 1px;\n background: var(--fallback-bc, oklch(var(--bc) / 0.2));\n margin: 0.25rem 0;\n }\n\n .context-menu .disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n " })
283
294
  ]
284
295
  });
285
296
  });
286
- D.displayName = "CodeEditor";
297
+ S.displayName = "CodeEditor";
287
298
  //#endregion
288
- export { D as default };
299
+ export { S as default };
289
300
 
290
301
  //# sourceMappingURL=CodeEditor.js.map