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.
- package/dist/components/Input/index.js +52 -62
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/LayoutSuite/index.d.ts +10 -0
- package/dist/components/LayoutSuite/index.js +27 -18
- package/dist/components/LayoutSuite/index.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js +1 -0
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Markdown/useMarkdownSource.js +46 -31
- package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
- package/dist/components/Markdown/useMarkmapRenderer.js +44 -31
- package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
- package/dist/components/Markdown/useMermaidRenderer.js +49 -31
- package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
- package/dist/components/ProtectedRoute/index.d.ts +2 -1
- package/dist/components/ProtectedRoute/index.js +16 -6
- package/dist/components/ProtectedRoute/index.js.map +1 -1
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.js +166 -136
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +12 -1
- package/dist/components/Tabs/index.js +42 -17
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js +7 -7
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js +200 -189
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/types.d.ts +3 -0
- package/dist/components/pro/DataTable/DataTable.d.ts +1 -1
- package/dist/components/pro/DataTable/DataTable.js +98 -240
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.js +14 -16
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.d.ts +3 -9
- package/dist/components/pro/DataTable/components/TablePagination.js +29 -25
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.d.ts +2 -2
- package/dist/components/pro/DataTable/tanstack-table.js +29 -21
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/DataTable/treeDataUtils.d.ts +2 -0
- package/dist/components/pro/DataTable/treeDataUtils.js +18 -19
- package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
- package/dist/components/pro/DataTable/types.d.ts +24 -0
- package/dist/components/pro/DataTable/useDataTableModel.d.ts +16 -0
- package/dist/components/pro/DataTable/useDataTableModel.js +148 -0
- package/dist/components/pro/DataTable/useDataTableModel.js.map +1 -0
- package/dist/components/pro/FileExplorer/Breadcrumb.js +12 -12
- package/dist/components/pro/Flow/nodes/DataNodeView.js +87 -82
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js +69 -63
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.d.ts +14 -0
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.js +76 -0
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.js.map +1 -0
- package/dist/components/pro/Flow/nodes/demandRender.d.ts +11 -0
- package/dist/components/pro/Flow/nodes/demandRender.js +26 -0
- package/dist/components/pro/Flow/nodes/demandRender.js.map +1 -0
- package/dist/components/pro/RichTextEditor/SlashMenu.js +68 -58
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/contexts/AppContext.d.ts +1 -0
- package/dist/contexts/AppContext.js +144 -145
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/contexts/authentication.d.ts +7 -0
- package/dist/contexts/authentication.js +22 -0
- package/dist/contexts/authentication.js.map +1 -0
- package/dist/dishui.css +1 -1
- package/dist/hooks/useControllableState.d.ts +6 -14
- package/dist/hooks/useControllableState.js +21 -15
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/useTableColumns.d.ts +3 -3
- package/dist/hooks/useTableColumns.js +2 -2
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/hooks/useTableData.d.ts +11 -4
- package/dist/hooks/useTableData.js +44 -26
- package/dist/hooks/useTableData.js.map +1 -1
- package/dist/index-nostyled.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +97 -97
- package/dist/utils/i18n.js +1 -1
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/routerBuilder.d.ts +7 -5
- package/dist/utils/routerBuilder.js +11 -15
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/safeStorage.d.ts +8 -0
- package/dist/utils/safeStorage.js +45 -0
- package/dist/utils/safeStorage.js.map +1 -0
- 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
|
|
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
|
|
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
|
|
13
|
-
let
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
27
|
-
}),
|
|
28
|
-
},
|
|
51
|
+
children: t.icon
|
|
52
|
+
}), t.label]
|
|
53
|
+
}, t.key))
|
|
29
54
|
});
|
|
30
55
|
}
|
|
31
56
|
//#endregion
|
|
32
|
-
export {
|
|
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":";;;;
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 =
|
|
12
|
-
|
|
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
|
|
35
|
-
e.action(
|
|
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
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { EditorView as
|
|
8
|
-
import { Compartment as
|
|
9
|
-
import { defaultKeymap as
|
|
10
|
-
import { bracketMatching as
|
|
11
|
-
import { closeBrackets as
|
|
12
|
-
import { lintKeymap as
|
|
13
|
-
import { searchKeymap as
|
|
14
|
-
import { javascript as
|
|
15
|
-
import { python as
|
|
16
|
-
import { html as
|
|
17
|
-
import { css as
|
|
18
|
-
import { json as
|
|
19
|
-
import { markdown as
|
|
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
|
|
22
|
-
javascript: () =>
|
|
23
|
-
jsx: () =>
|
|
24
|
-
typescript: () =>
|
|
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: () =>
|
|
28
|
+
tsx: () => v({
|
|
29
29
|
jsx: !0,
|
|
30
30
|
typescript: !0
|
|
31
31
|
}),
|
|
32
|
-
python:
|
|
33
|
-
html:
|
|
34
|
-
css:
|
|
35
|
-
json:
|
|
36
|
-
markdown:
|
|
37
|
-
})[e]?.() ||
|
|
38
|
-
let
|
|
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
|
-
}), [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
}),
|
|
67
|
+
}), j.current.focus();
|
|
56
68
|
} catch (e) {
|
|
57
69
|
console.error("Failed to jump to line:", e);
|
|
58
70
|
}
|
|
59
|
-
}, []),
|
|
60
|
-
if (!
|
|
61
|
-
let n = Date.now(), r =
|
|
62
|
-
if (!(n -
|
|
63
|
-
|
|
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 ===
|
|
67
|
-
|
|
78
|
+
if (e === U.current && !t) {
|
|
79
|
+
H.current = !1;
|
|
68
80
|
return;
|
|
69
81
|
}
|
|
70
|
-
|
|
71
|
-
let i =
|
|
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 >
|
|
89
|
+
o.length > D && o.shift();
|
|
78
90
|
let s = o.length - 1;
|
|
79
|
-
return
|
|
80
|
-
|
|
91
|
+
return L(s), setTimeout(() => {
|
|
92
|
+
k && k(o, s);
|
|
81
93
|
}, 0), o;
|
|
82
94
|
});
|
|
83
95
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
]),
|
|
90
|
-
|
|
91
|
-
W.current =
|
|
92
|
-
|
|
93
|
-
|
|
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:
|
|
115
|
+
to: j.current.state.doc.length,
|
|
96
116
|
insert: t.content
|
|
97
117
|
} });
|
|
98
|
-
let n =
|
|
99
|
-
|
|
118
|
+
let n = P.slice(0, e + 1);
|
|
119
|
+
F(n);
|
|
100
120
|
let r = n.length - 1;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, 0),
|
|
104
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
P,
|
|
128
|
+
v,
|
|
129
|
+
k
|
|
110
130
|
]);
|
|
111
|
-
|
|
112
|
-
jumpToLine:
|
|
113
|
-
getView: () =>
|
|
114
|
-
getValue: () =>
|
|
131
|
+
te(Ne, () => ({
|
|
132
|
+
jumpToLine: Z,
|
|
133
|
+
getView: () => j.current,
|
|
134
|
+
getValue: () => j.current?.state.doc.toString() || "",
|
|
115
135
|
setValue: (e) => {
|
|
116
|
-
|
|
136
|
+
j.current && j.current.dispatch({ changes: {
|
|
117
137
|
from: 0,
|
|
118
|
-
to:
|
|
138
|
+
to: j.current.state.doc.length,
|
|
119
139
|
insert: e
|
|
120
140
|
} });
|
|
121
141
|
},
|
|
122
|
-
focus: () =>
|
|
123
|
-
getHistory: () =>
|
|
124
|
-
restoreHistory:
|
|
142
|
+
focus: () => j.current?.focus(),
|
|
143
|
+
getHistory: () => P,
|
|
144
|
+
restoreHistory: Ve,
|
|
125
145
|
clearHistory: () => {
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
]),
|
|
136
|
-
if (!
|
|
137
|
-
let e =
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
]),
|
|
146
|
-
if (!
|
|
147
|
-
let
|
|
148
|
-
if (e.docChanged
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
te(),
|
|
176
|
+
J.current.onChange?.(t);
|
|
177
|
+
}), c = [
|
|
163
178
|
ue(),
|
|
164
|
-
|
|
179
|
+
ie(),
|
|
165
180
|
pe(),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
...
|
|
177
|
-
...
|
|
178
|
-
...
|
|
179
|
-
|
|
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 (
|
|
186
|
-
let e = typeof
|
|
187
|
-
|
|
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 (
|
|
190
|
-
let e = typeof
|
|
191
|
-
|
|
206
|
+
if (C) {
|
|
207
|
+
let e = typeof C == "object" ? C : {};
|
|
208
|
+
c.push(n(Z, e));
|
|
192
209
|
}
|
|
193
|
-
|
|
194
|
-
let
|
|
195
|
-
doc:
|
|
196
|
-
extensions:
|
|
197
|
-
}),
|
|
198
|
-
state:
|
|
199
|
-
parent:
|
|
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
|
|
202
|
-
|
|
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
|
-
}, []),
|
|
207
|
-
|
|
221
|
+
}, []), d(() => {
|
|
222
|
+
j.current && l !== G.current && (B.current = !0, j.current.dispatch({ changes: {
|
|
208
223
|
from: 0,
|
|
209
|
-
to:
|
|
210
|
-
insert:
|
|
224
|
+
to: j.current.state.doc.length,
|
|
225
|
+
insert: l
|
|
211
226
|
} }));
|
|
212
|
-
}, [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
}, []), $ =
|
|
236
|
-
|
|
246
|
+
}, []), $ = u(() => {
|
|
247
|
+
N({
|
|
237
248
|
visible: !1,
|
|
238
249
|
x: 0,
|
|
239
250
|
y: 0
|
|
240
251
|
});
|
|
241
|
-
}, []),
|
|
242
|
-
|
|
252
|
+
}, []), Ue = u((e) => {
|
|
253
|
+
j.current && !e.disabled && e.action(j.current), $();
|
|
243
254
|
}, [$]);
|
|
244
|
-
|
|
245
|
-
if (
|
|
255
|
+
d(() => {
|
|
256
|
+
if (M.visible) {
|
|
246
257
|
let e = () => $();
|
|
247
258
|
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
248
259
|
}
|
|
249
|
-
}, [
|
|
250
|
-
let
|
|
251
|
-
height:
|
|
252
|
-
minHeight:
|
|
253
|
-
maxHeight:
|
|
260
|
+
}, [M.visible, $]);
|
|
261
|
+
let We = {
|
|
262
|
+
height: Oe,
|
|
263
|
+
minHeight: ke,
|
|
264
|
+
maxHeight: Ae,
|
|
254
265
|
overflow: "auto"
|
|
255
|
-
},
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
className: `code-editor-wrapper ${
|
|
266
|
+
}, Ge = Ee || ee;
|
|
267
|
+
return /* @__PURE__ */ re("div", {
|
|
268
|
+
className: `code-editor-wrapper ${De}`,
|
|
258
269
|
children: [
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
ref:
|
|
261
|
-
onContextMenu:
|
|
262
|
-
style:
|
|
270
|
+
/* @__PURE__ */ m("div", {
|
|
271
|
+
ref: A,
|
|
272
|
+
onContextMenu: He,
|
|
273
|
+
style: We,
|
|
263
274
|
className: "code-editor"
|
|
264
275
|
}),
|
|
265
|
-
|
|
276
|
+
M.visible && /* @__PURE__ */ m("div", {
|
|
266
277
|
className: "context-menu",
|
|
267
278
|
style: {
|
|
268
279
|
position: "fixed",
|
|
269
|
-
top:
|
|
270
|
-
left:
|
|
280
|
+
top: M.y,
|
|
281
|
+
left: M.x,
|
|
271
282
|
zIndex: 1e3
|
|
272
283
|
},
|
|
273
|
-
children: /* @__PURE__ */
|
|
284
|
+
children: /* @__PURE__ */ m("ul", {
|
|
274
285
|
className: "menu bg-base-200 rounded-box shadow-lg",
|
|
275
|
-
children:
|
|
276
|
-
onClick: () =>
|
|
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__ */
|
|
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
|
-
|
|
297
|
+
S.displayName = "CodeEditor";
|
|
287
298
|
//#endregion
|
|
288
|
-
export {
|
|
299
|
+
export { S as default };
|
|
289
300
|
|
|
290
301
|
//# sourceMappingURL=CodeEditor.js.map
|