@winm/vue-workbench-ui 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +55 -2
  2. package/dist/Toggle-Dcjn5G6M.js +387 -0
  3. package/dist/code-editor.css +189 -0
  4. package/dist/code-editor.d.ts +5 -0
  5. package/dist/code-editor.js +1272 -0
  6. package/dist/components/Badge.vue.d.ts +34 -0
  7. package/dist/components/BrandMark.vue.d.ts +6 -0
  8. package/dist/components/CodeEditor.vue.d.ts +32 -0
  9. package/dist/components/ConfirmationDialog.vue.d.ts +27 -0
  10. package/dist/components/ContextMenu.vue.d.ts +66 -0
  11. package/dist/components/CopyButton.vue.d.ts +35 -0
  12. package/dist/components/DataTable.vue.d.ts +87 -0
  13. package/dist/components/DatePicker.vue.d.ts +33 -0
  14. package/dist/components/DropdownMenu.vue.d.ts +88 -0
  15. package/dist/components/EmptyState.vue.d.ts +38 -0
  16. package/dist/components/ErrorBanner.vue.d.ts +30 -0
  17. package/dist/components/ExpandableCodeEditor.vue.d.ts +72 -0
  18. package/dist/components/Expander.vue.d.ts +75 -0
  19. package/dist/components/FilePicker.vue.d.ts +111 -0
  20. package/dist/components/Icon.vue.d.ts +8 -0
  21. package/dist/components/Ipv4Input.vue.d.ts +95 -0
  22. package/dist/components/KeyValueTable.vue.d.ts +96 -0
  23. package/dist/components/ModalDialog.vue.d.ts +75 -0
  24. package/dist/components/NumberInput.vue.d.ts +69 -0
  25. package/dist/components/Pagination.vue.d.ts +49 -0
  26. package/dist/components/PasswordInput.vue.d.ts +48 -0
  27. package/dist/components/PlaceholderInput.vue.d.ts +36 -0
  28. package/dist/components/PluginIcon.vue.d.ts +20 -0
  29. package/dist/components/Popover.vue.d.ts +91 -0
  30. package/dist/components/ProgressBar.vue.d.ts +46 -0
  31. package/dist/components/SearchInput.vue.d.ts +72 -0
  32. package/dist/components/SegmentedControl.vue.d.ts +45 -0
  33. package/dist/components/SliderInput.vue.d.ts +59 -0
  34. package/dist/components/StatusBadge.vue.d.ts +18 -0
  35. package/dist/components/SwitchField.vue.d.ts +38 -0
  36. package/dist/components/Tabs.vue.d.ts +51 -0
  37. package/dist/components/TextInput.vue.d.ts +120 -0
  38. package/dist/components/Toast.vue.d.ts +47 -0
  39. package/dist/components/Toggle.vue.d.ts +16 -0
  40. package/dist/components/Tooltip.vue.d.ts +32 -0
  41. package/dist/components/WorkbenchTabs.vue.d.ts +52 -0
  42. package/dist/components/flow/PanelResizer.vue.d.ts +23 -0
  43. package/dist/components/http/HttpJsonTree.vue.d.ts +6 -0
  44. package/dist/components/http/HttpJsonTreeNode.vue.d.ts +22 -0
  45. package/dist/composables/useClipboard.d.ts +23 -0
  46. package/dist/date-picker-range.d.ts +54 -0
  47. package/dist/date-picker.d.ts +31 -0
  48. package/dist/directives/tooltip.d.ts +32 -0
  49. package/dist/editors/languages.d.ts +10 -0
  50. package/dist/editors/script-completions.d.ts +23 -0
  51. package/dist/editors/script-linter.d.ts +7 -0
  52. package/dist/editors/theme.d.ts +3 -0
  53. package/dist/file-picker.d.ts +68 -0
  54. package/dist/index.d.ts +69 -0
  55. package/dist/index.js +6116 -0
  56. package/dist/media-icon.d.ts +5 -0
  57. package/dist/modal-enhancer.d.ts +28 -0
  58. package/dist/overlay-host.d.ts +2 -0
  59. package/dist/plugin.d.ts +22 -0
  60. package/dist/select-popup.d.ts +14 -0
  61. package/dist/style.css +2 -0
  62. package/dist/template-placeholders.d.ts +64 -0
  63. package/dist/ui-context.d.ts +18 -0
  64. package/package.json +71 -3
package/README.md CHANGED
@@ -1,3 +1,56 @@
1
- # Temporary Holding Version
1
+ # @winm/vue-workbench-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 面向工业数据集成与桌面工作台的通用 Vue 3.5+ 组件库(零第三方 UI 框架依赖,内置浅色/深色语义令牌与全局 DOM 增强器)。
4
+
5
+ [在线文档](https://winm-tech.cn/winm-vue-workbench-ui/) · [快速接入指南](https://winm-tech.cn/winm-vue-workbench-ui/guide/quick-start.html) · [组件交互示例](https://winm-tech.cn/winm-vue-workbench-ui/components/data-table.html)
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ pnpm add @winm/vue-workbench-ui@0.1.2
11
+ ```
12
+
13
+ 同一 pnpm 工作区内可声明 `"@winm/vue-workbench-ui": "workspace:*"`。
14
+
15
+ 仅当使用代码编辑子入口(`@winm/vue-workbench-ui/code-editor`)时,才需要安装 CodeMirror 6 可选 peerDependencies。
16
+
17
+ ## 快速接入
18
+
19
+ ### 1. 挂载样式作用域与主题
20
+
21
+ 所有样式均收敛在 `:where([data-winm-ui])` 作用域内,不会污染作用域外的宿主元素。在应用根元素(推荐 `<html>` 或应用挂载容器)添加 `data-winm-ui`,深色主题设置 `data-theme="dark"`:
22
+
23
+ ```html
24
+ <html lang="zh-CN" data-winm-ui>
25
+ ```
26
+
27
+ ### 2. 引入样式与插件初始化
28
+
29
+ ```ts
30
+ import { createApp } from "vue";
31
+ import "@winm/vue-workbench-ui/style.css";
32
+ // 仅在使用 CodeEditor / ExpandableCodeEditor 时额外引入:
33
+ // import "@winm/vue-workbench-ui/code-editor.css";
34
+ import { createWinmUi } from "@winm/vue-workbench-ui";
35
+ import App from "./App.vue";
36
+
37
+ const app = createApp(App);
38
+ app.use(
39
+ createWinmUi({
40
+ scope: document.documentElement,
41
+ context: {
42
+ statusLabels: { succeeded: "成功", failed: "失败", running: "执行中" },
43
+ },
44
+ }),
45
+ );
46
+ app.mount("#app");
47
+ ```
48
+
49
+ 基础控件可直接从包入口导入。需要指令、原生控件增强或共享设置时,使用 `createWinmUi()`,也可分别调用所需的初始化函数。维护文档时,在仓库根目录运行 `pnpm docs:dev`,然后访问 <http://127.0.0.1:5179> 本地预览。
50
+
51
+ ## 导出入口
52
+
53
+ - `@winm/vue-workbench-ui`:全部基础组件(`Badge`、`BrandMark`、`ConfirmationDialog`、`ContextMenu`、`CopyButton`、`DataTable`、`DatePicker`、`DropdownMenu`、`EmptyState`、`ErrorBanner`、`Expander`、`FilePicker`、`Icon`、`Ipv4Input`、`KeyValueTable`、`ModalDialog`、`NumberInput`、`Pagination`、`PasswordInput`、`PlaceholderInput`、`PluginIcon` / `MediaIcon`、`Popover`、`ProgressBar`、`SearchInput`、`SegmentedControl`、`SliderInput`、`StatusBadge`、`SwitchField`、`Tabs`、`TextInput`、`Toast`、`Toggle`、`Tooltip`、`WorkbenchTabs`、`PanelResizer`、`HttpJsonTree` / `JsonTreeViewer`)与组合式工具、指令、增强器。
54
+ - `@winm/vue-workbench-ui/style.css`:语义令牌(`tokens.css`)与全部基础控件样式。
55
+ - `@winm/vue-workbench-ui/code-editor`:`CodeEditor`、`ExpandableCodeEditor` 与 CodeMirror 6 补全/检查工具。
56
+ - `@winm/vue-workbench-ui/code-editor.css`:代码编辑器专用样式。
@@ -0,0 +1,387 @@
1
+ import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, inject as s, normalizeClass as c, onMounted as l, openBlock as u, provide as d, ref as f, renderSlot as p, resolveDynamicComponent as m, toDisplayString as h, toValue as g, unref as _, watch as v, withCtx as y, withDirectives as b, withModifiers as x } from "vue";
2
+ // src/media-icon.ts
3
+ function S(e) {
4
+ if (typeof e != "string" || !e.startsWith("data:image/png;base64,") || e.length > 87406) return;
5
+ let t = e.slice(22);
6
+ if (/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)) try {
7
+ let n = atob(t);
8
+ if (n.length < 33 || n.length > 65536 || !n.startsWith("‰PNG\r\n\n\0\0\0\rIHDR")) return;
9
+ let r = (e) => n.charCodeAt(e) * 16777216 + n.charCodeAt(e + 1) * 65536 + n.charCodeAt(e + 2) * 256 + n.charCodeAt(e + 3), i = r(16), a = r(20);
10
+ return i > 0 && i <= 512 && a > 0 && a <= 512 ? e : void 0;
11
+ } catch {
12
+ return;
13
+ }
14
+ }
15
+ // src/components/Icon.vue?vue&type=script&setup=true&lang.ts
16
+ var C = [
17
+ "src",
18
+ "width",
19
+ "height"
20
+ ], w = ["width", "height"], T = ["d"], E = /*@__PURE__*/ o({
21
+ __name: "Icon",
22
+ props: {
23
+ name: {},
24
+ size: {},
25
+ src: {}
26
+ },
27
+ setup(t) {
28
+ let n = t, a = f(!1), o = e(() => a.value ? void 0 : S(n.src));
29
+ v(() => n.src, () => {
30
+ a.value = !1;
31
+ });
32
+ let s = {
33
+ home: "m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1Z",
34
+ file: "M6 3h9l4 4v14H6ZM14 3v5h5M9 12h7M9 16h7",
35
+ link: "m10 13 4-4M8 15l-2 2a3.5 3.5 0 0 1-5-5l5-5a3.5 3.5 0 0 1 5 0M16 9l2-2a3.5 3.5 0 0 1 5 5l-5 5a3.5 3.5 0 0 1-5 0",
36
+ clock: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 7v5l3 2",
37
+ box: "m12 3 9 5-9 5-9-5Zm-9 5v9l9 5 9-5V8M12 13v9",
38
+ settings: "M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8M10 2h4l1 3 3 1 3 3-1 3 1 3-3 3-3 1-1 3h-4l-1-3-3-1-3-3 1-3-1-3 3-3 3-1Z",
39
+ database: "M4 6c0-4 16-4 16 0s-16 4-16 0M4 6v6c0 4 16 4 16 0V6M4 12v6c0 4 16 4 16 0v-6",
40
+ search: "M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14m5 12 6 6",
41
+ plus: "M12 5v14M5 12h14",
42
+ close: "m6 6 12 12M6 18 18 6",
43
+ edit: "m16 3 5 5-12 12-6 1 1-6ZM14 5l5 5",
44
+ trash: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7",
45
+ chevron: "m9 5 7 7-7 7",
46
+ up: "m18 15-6-6-6 6",
47
+ down: "m6 9 6 6 6-6",
48
+ back: "m14 5-7 7 7 7",
49
+ expand: "M8 3H3v5M16 3h5v5M3 16v5h5M21 16v5h-5",
50
+ expandAll: "m6 9 6-6 6 6M6 15l6 6 6-6",
51
+ collapseAll: "m6 4 6 6 6-6M6 20l6-6 6 6",
52
+ panel: "M3 4h18v16H3ZM3 9h18",
53
+ sidebar: "M3 4h18v16H3ZM9 4v16",
54
+ copy: "M8 8h12v12H8ZM4 16H3V4h12v1",
55
+ cursor: "m4 3 15 9-7 1-3 7Z",
56
+ hand: "M8 12V5a2 2 0 0 1 4 0v6-7a2 2 0 0 1 4 0v7-5a2 2 0 0 1 4 0v8c0 5-3 8-7 8h-1c-2 0-4-1-5-3l-4-6a2 2 0 0 1 3-2l2 2",
57
+ info: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 11v5M12 8h.01",
58
+ help: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M9.1 9a3 3 0 0 1 5.9 1c0 2-3 2.5-3 4m0 3h.01",
59
+ folder: "M3 6h6l2 2h10v11H3Z",
60
+ globe: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M3.6 9h16.8M3.6 15h16.8M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18",
61
+ sun: "M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M5 19l1.5-1.5M17.5 6.5 19 5",
62
+ moon: "M20 15.5A9 9 0 0 1 8.5 4 9 9 0 1 0 20 15.5Z",
63
+ bell: "M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9M9 21h6",
64
+ chart: "M4 13h3v8H4ZM10.5 8h3v13h-3ZM17 3h3v18h-3Z",
65
+ list: "M4 5h2M9 5h11M4 12h2M9 12h11M4 19h2M9 19h11",
66
+ shield: "m12 2 9 4v6c0 6-9 10-9 10S3 18 3 12V6Zm-4 9 3 3 5-5",
67
+ activity: "M2 12h5l3-9 4 18 3-9h5",
68
+ users: "M9 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8M2 21v-3a7 7 0 0 1 14 0v3M17 3a4 4 0 0 1 0 8M19 14a6 6 0 0 1 3 5v2",
69
+ user: "M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8M4 21v-3a8 8 0 0 1 16 0v3",
70
+ check: "m5 12 4 4L19 6",
71
+ checkCircle: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18m-4 9 3 3 5-6",
72
+ alert: "M12 3 2 21h20ZM12 9v5M12 17v.5",
73
+ loader: "M20 12a8 8 0 1 1-8-8",
74
+ pause: "M8 5v14M16 5v14",
75
+ play: "m8 4 13 8-13 8Z",
76
+ more: "M5 12h.01M12 12h.01M19 12h.01",
77
+ send: "m3 10 18-7-7 18-3-8Zm8 3L21 3",
78
+ sliders: "M4 5h16M4 12h16M4 19h16M8 2v6M16 9v6M10 16v6",
79
+ table: "M3 4h18v16H3ZM3 9h18M9 9v11",
80
+ code: "m8 6-6 6 6 6M16 6l6 6-6 6M14 3l-4 18",
81
+ minus: "M5 12h14",
82
+ maximize: "M5 5h14v14H5Z",
83
+ restore: "M8 5h11v11M5 8h11v11H5Z",
84
+ save: "M4 3h13l4 4v14H3V3ZM7 3v6h9V3M7 21v-7h10v7",
85
+ menu: "M4 6h16M4 12h16M4 18h16",
86
+ refresh: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5",
87
+ sync: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M8 16H3v5",
88
+ filter: "M3 5h18l-7 8v7l-4-2v-5Z",
89
+ arrow: "M4 12h16m-6-6 6 6-6 6",
90
+ download: "M12 3v12M7 10l5 5 5-5M4 21h16",
91
+ upload: "M12 16V4M7 9l5-5 5 5M4 21h16",
92
+ lock: "M5 11h14v10H5ZM8 11V7a4 4 0 0 1 8 0v4",
93
+ logout: "M15 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4M10 8l4 4-4 4M14 12H3",
94
+ unlock: "M5 11h14v10H5ZM8 11V7a4 4 0 0 1 8 0",
95
+ eye: "M2 12s3.6-6 10-6 10 6 10 6-3.6 6-10 6-10-6-10-6ZM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z",
96
+ eyeOff: "M9.9 5.2A11 11 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-2.3 3.1M6.5 6.8A16.8 16.8 0 0 0 2 12s3.6 7 10 7a10.6 10.6 0 0 0 5.2-1.4M14.1 14.1a3 3 0 0 1-4.2-4.2M3 3l18 18",
97
+ splitV: "M3 4h18v16H3ZM3 12h18",
98
+ splitH: "M3 4h18v16H3ZM12 4v16",
99
+ terminal: "m4 17 6-5-6-5M12 19h8"
100
+ };
101
+ return (e, n) => o.value ? (u(), r("img", {
102
+ key: o.value,
103
+ src: o.value,
104
+ width: t.size ?? 18,
105
+ height: t.size ?? 18,
106
+ class: "image-icon",
107
+ alt: "",
108
+ "aria-hidden": "true",
109
+ draggable: !1,
110
+ onError: n[0] ||= (e) => a.value = !0
111
+ }, null, 40, C)) : (u(), r("svg", {
112
+ key: 1,
113
+ width: t.size ?? 18,
114
+ height: t.size ?? 18,
115
+ viewBox: "0 0 24 24",
116
+ fill: "none",
117
+ stroke: "currentColor",
118
+ "stroke-width": "1.7",
119
+ "stroke-linecap": "round",
120
+ "stroke-linejoin": "round",
121
+ "aria-hidden": "true"
122
+ }, [i("path", { d: s[t.name] ?? s.file }, null, 8, T)], 8, w));
123
+ }
124
+ }), D = (e, t) => {
125
+ let n = e.__vccOpts || e;
126
+ for (let [e, r] of t) n[e] = r;
127
+ return n;
128
+ }, O = /*#__PURE__*/ D(E, [["__scopeId", "data-v-cadf9f32"]]), k = "[data-winm-ui]";
129
+ function A(e, t) {
130
+ let n = e.closest("dialog[open]");
131
+ if (t && (!n || n.contains(t))) return t;
132
+ let r = e.closest(k);
133
+ if (n) return r && n.contains(r) ? r : n;
134
+ let i = e.ownerDocument;
135
+ return r && r !== i.documentElement ? r : i.body;
136
+ }
137
+ function j(e, t, n) {
138
+ let r = A(e, n), i = e.closest(k), a = e.isConnected && i && i !== e.ownerDocument.documentElement && typeof t.showPopover == "function";
139
+ a ? t.setAttribute("popover", "manual") : t.removeAttribute("popover"), t.parentElement !== r && r.append(t), a && t.showPopover();
140
+ }
141
+ // src/directives/tooltip.ts
142
+ var M = null, N = null, P = null;
143
+ function F() {
144
+ return !M && typeof document < "u" && (M = document.createElement("div"), M.className = "winm-tooltip", M.setAttribute("role", "tooltip"), M.setAttribute("aria-hidden", "true")), M;
145
+ }
146
+ function I(e, t) {
147
+ let n = t.shortcut?.trim();
148
+ if (!n) {
149
+ e.textContent = t.text;
150
+ return;
151
+ }
152
+ e.textContent = "";
153
+ let r = document.createElement("span");
154
+ r.className = "winm-tooltip-text", r.textContent = t.text;
155
+ let i = document.createElement("kbd");
156
+ i.className = "ui-kbd", i.textContent = n, e.append(r, i);
157
+ }
158
+ function L(e) {
159
+ return typeof e.value == "string" ? {
160
+ text: e.value,
161
+ placement: e.arg || "top"
162
+ } : e.value && typeof e.value == "object" ? {
163
+ text: String(e.value.text || ""),
164
+ placement: e.value.placement || e.arg || "top",
165
+ delay: e.value.delay,
166
+ shortcut: typeof e.value.shortcut == "string" ? e.value.shortcut : void 0
167
+ } : { text: "" };
168
+ }
169
+ function R(e, t = "top") {
170
+ let n = F(), r = e.getBoundingClientRect(), i = n.style.transform;
171
+ n.style.transform = "none", n.style.top = "0px", n.style.left = "0px";
172
+ let a = n.getBoundingClientRect(), o = getComputedStyle(n).transform, s = o && o !== "none" && typeof DOMMatrixReadOnly == "function" ? new DOMMatrixReadOnly(o) : null, c = a.left - (s?.m41 ?? 0), l = a.top - (s?.m42 ?? 0);
173
+ n.style.transform = i;
174
+ let u = 0, d = 0, f = t;
175
+ f === "top" ? (u = r.top - a.height - 6, d = r.left + (r.width - a.width) / 2, u < 8 && (u = r.bottom + 6, f = "bottom")) : f === "bottom" ? (u = r.bottom + 6, d = r.left + (r.width - a.width) / 2, u + a.height > window.innerHeight - 8 && (u = r.top - a.height - 6, f = "top")) : f === "left" ? (u = r.top + (r.height - a.height) / 2, d = r.left - a.width - 6, d < 8 && (d = r.right + 6, f = "right")) : f === "right" && (u = r.top + (r.height - a.height) / 2, d = r.right + 6, d + a.width > window.innerWidth - 8 && (d = r.left - a.width - 6, f = "left")), d = Math.max(8, Math.min(window.innerWidth - a.width - 8, d)), u = Math.max(8, Math.min(window.innerHeight - a.height - 8, u)), n.style.top = `${Math.round(u - l)}px`, n.style.left = `${Math.round(d - c)}px`, n.setAttribute("data-placement", f);
176
+ }
177
+ function z(e, t, n) {
178
+ if (!t.text || !t.text.trim()) return;
179
+ B(), P = e;
180
+ let r = t.delay ?? 150;
181
+ N = setTimeout(() => {
182
+ if (P !== e) return;
183
+ let r = e.closest("dialog");
184
+ if (r && !r.open) {
185
+ B();
186
+ return;
187
+ }
188
+ let i = F();
189
+ I(i, t), i.style.display = "inline-flex", i.style.visibility = "hidden", i.classList.remove("visible"), j(e, i, n), requestAnimationFrame(() => {
190
+ P === e && (R(e, t.placement), i.style.visibility = "visible", i.classList.add("visible"), i.setAttribute("aria-hidden", "false"));
191
+ });
192
+ }, r);
193
+ }
194
+ function B() {
195
+ N &&= (clearTimeout(N), null), M && (M.hasAttribute("popover") && M.matches(":popover-open") && M.hidePopover(), M.classList.remove("visible"), M.setAttribute("aria-hidden", "true"), M.style.display = "none"), P = null;
196
+ }
197
+ var V = {
198
+ mounted(e, t) {
199
+ let n = L(t);
200
+ if (e._tooltipOptions = n, e.hasAttribute("title")) {
201
+ let t = e.getAttribute("title");
202
+ !n.text && t && (n.text = t), e.removeAttribute("title");
203
+ }
204
+ let r = () => {
205
+ e._tooltipOptions?.text && z(e, e._tooltipOptions);
206
+ }, i = () => B(), a = () => B();
207
+ e.addEventListener("pointerenter", r), e.addEventListener("pointerleave", i), e.addEventListener("pointerdown", a), e.addEventListener("focusin", r), e.addEventListener("focusout", i), e._tooltipHandlers = {
208
+ enter: r,
209
+ leave: i,
210
+ down: a
211
+ };
212
+ },
213
+ updated(e, t) {
214
+ if (e._tooltipOptions = L(t), e.hasAttribute("title")) {
215
+ let t = e.getAttribute("title");
216
+ !e._tooltipOptions.text && t && (e._tooltipOptions.text = t), e.removeAttribute("title");
217
+ }
218
+ P === e && M && M.classList.contains("visible") && (e._tooltipOptions.text ? (I(M, e._tooltipOptions), R(e, e._tooltipOptions.placement)) : B());
219
+ },
220
+ unmounted(e) {
221
+ P === e && B(), e._tooltipHandlers && (e.removeEventListener("pointerenter", e._tooltipHandlers.enter), e.removeEventListener("pointerleave", e._tooltipHandlers.leave), e.removeEventListener("pointerdown", e._tooltipHandlers.down), e.removeEventListener("focusin", e._tooltipHandlers.enter), e.removeEventListener("focusout", e._tooltipHandlers.leave), delete e._tooltipHandlers), delete e._tooltipOptions;
222
+ }
223
+ }, H = Symbol("winm-ui-context");
224
+ function U(e) {
225
+ d(H, e);
226
+ }
227
+ function W() {
228
+ return s(H, null);
229
+ }
230
+ function G(e, t, n = !1) {
231
+ return e ?? (t === void 0 ? n : !!g(t));
232
+ }
233
+ // src/components/ModalDialog.vue?vue&type=script&setup=true&lang.ts
234
+ var K = ["aria-label", "aria-labelledby"], q = ["id"], J = {
235
+ key: 0,
236
+ class: "ui-modal-header-actions"
237
+ }, Y = ["disabled", "aria-label"], X = /* @__PURE__ */ o({
238
+ __name: "ModalDialog",
239
+ props: {
240
+ open: {
241
+ type: Boolean,
242
+ default: void 0
243
+ },
244
+ title: { default: "" },
245
+ ariaLabel: { default: void 0 },
246
+ ariaLabelledby: { default: void 0 },
247
+ modalClass: { default: void 0 },
248
+ headerClass: { default: void 0 },
249
+ bodyClass: { default: void 0 },
250
+ footerClass: { default: void 0 },
251
+ closeLabel: { default: "关闭" },
252
+ closable: {
253
+ type: Boolean,
254
+ default: !0
255
+ },
256
+ closeDisabled: {
257
+ type: Boolean,
258
+ default: !1
259
+ },
260
+ dismissible: {
261
+ type: Boolean,
262
+ default: !0
263
+ },
264
+ beforeClose: {
265
+ type: Function,
266
+ default: void 0
267
+ },
268
+ useForm: {
269
+ type: Boolean,
270
+ default: !1
271
+ },
272
+ hideHeader: {
273
+ type: Boolean,
274
+ default: !1
275
+ },
276
+ hideFooter: {
277
+ type: Boolean,
278
+ default: !1
279
+ }
280
+ },
281
+ emits: [
282
+ "update:open",
283
+ "close",
284
+ "cancel",
285
+ "submit"
286
+ ],
287
+ setup(o, { expose: s, emit: d }) {
288
+ let g = o, S = d, C = f(), w = e(() => g.ariaLabel ?? (g.ariaLabelledby ? void 0 : g.title || void 0));
289
+ function T() {
290
+ let e = C.value;
291
+ e && !e.open && (typeof e.showModal == "function" ? e.showModal() : e.setAttribute("open", ""));
292
+ }
293
+ function E() {
294
+ let e = C.value;
295
+ e && (typeof e.close == "function" ? e.close() : e.open && (e.removeAttribute("open"), A()));
296
+ }
297
+ async function D() {
298
+ !g.closeDisabled && g.dismissible && (!g.beforeClose || await g.beforeClose()) && E();
299
+ }
300
+ function k(e) {
301
+ S("cancel", e), (e.defaultPrevented || !g.dismissible || g.beforeClose) && (e.preventDefault(), g.dismissible && g.beforeClose && !e.defaultPrevented && D());
302
+ }
303
+ function A() {
304
+ S("update:open", !1), S("close");
305
+ }
306
+ return v(() => g.open, (e) => {
307
+ e !== void 0 && (e ? T() : E());
308
+ }, { flush: "post" }), l(() => {
309
+ g.open && T();
310
+ }), s({
311
+ openModal: T,
312
+ closeModal: E,
313
+ dialogEl: C
314
+ }), (e, s) => (u(), r("dialog", {
315
+ ref_key: "dialogEl",
316
+ ref: C,
317
+ class: c(["modal", o.modalClass]),
318
+ "aria-label": w.value,
319
+ "aria-labelledby": o.ariaLabelledby,
320
+ onCancel: k,
321
+ onClose: A
322
+ }, [(u(), t(m(o.useForm ? "form" : "div"), {
323
+ class: "ui-modal-frame",
324
+ style: { display: "contents" },
325
+ onSubmit: s[0] ||= x((e) => o.useForm ? S("submit", e) : void 0, ["prevent"])
326
+ }, {
327
+ default: y(() => [
328
+ o.hideHeader ? n("", !0) : (u(), r("header", {
329
+ key: 0,
330
+ class: c(o.headerClass)
331
+ }, [p(e.$slots, "header", {}, () => [i("h2", { id: o.ariaLabelledby }, h(o.title), 9, q)]), o.closable || e.$slots["header-actions"] ? (u(), r("div", J, [p(e.$slots, "header-actions"), o.closable ? b((u(), r("button", {
332
+ key: 0,
333
+ type: "button",
334
+ class: "icon-button",
335
+ disabled: o.closeDisabled || !o.dismissible,
336
+ "aria-label": o.closeLabel,
337
+ onClick: D
338
+ }, [a(O, { name: "close" })], 8, Y)), [[_(V), o.closeLabel]]) : n("", !0)])) : n("", !0)], 2)),
339
+ p(e.$slots, "subheader"),
340
+ i("div", { class: c(["modal-body", o.bodyClass]) }, [p(e.$slots, "default")], 2),
341
+ p(e.$slots, "before-footer"),
342
+ !o.hideFooter && e.$slots.footer ? (u(), r("footer", {
343
+ key: 1,
344
+ class: c(o.footerClass)
345
+ }, [p(e.$slots, "footer")], 2)) : n("", !0)
346
+ ]),
347
+ _: 3
348
+ }, 32))], 42, K));
349
+ }
350
+ }), Z = [
351
+ "id",
352
+ "aria-checked",
353
+ "aria-label",
354
+ "aria-busy",
355
+ "disabled"
356
+ ], Q = /* @__PURE__ */ o({
357
+ __name: "Toggle",
358
+ props: {
359
+ id: {},
360
+ enabled: { type: Boolean },
361
+ label: {},
362
+ disabled: { type: Boolean },
363
+ tooltip: {},
364
+ busy: { type: Boolean },
365
+ compact: { type: Boolean }
366
+ },
367
+ emits: ["change"],
368
+ setup(e) {
369
+ let t = e;
370
+ return (n, a) => b((u(), r("button", {
371
+ id: e.id,
372
+ type: "button",
373
+ class: c(["toggle", {
374
+ on: e.enabled,
375
+ busy: t.busy,
376
+ compact: e.compact
377
+ }]),
378
+ role: "switch",
379
+ "aria-checked": e.enabled,
380
+ "aria-label": e.label,
381
+ "aria-busy": t.busy ? "true" : void 0,
382
+ disabled: e.disabled || t.busy,
383
+ onClick: a[0] ||= x((e) => n.$emit("change"), ["stop"])
384
+ }, [...a[1] ||= [i("span", null, null, -1)]], 10, Z)), [[_(V), t.tooltip === void 0 ? e.enabled ? "停用任务" : "启用任务" : t.tooltip]]);
385
+ }
386
+ });
387
+ export { G as a, z as c, A as d, O as f, U as i, V as l, S as m, X as n, W as o, D as p, H as r, B as s, Q as t, j as u };
@@ -0,0 +1,189 @@
1
+ :where([data-winm-ui]) {
2
+ --winm-code-selection: color-mix(in srgb, var(--ui-accent) 22%, transparent);
3
+ }
4
+ :where([data-winm-ui][data-theme="dark"]) {
5
+ --winm-code-selection: color-mix(in srgb, var(--ui-accent) 34%, transparent);
6
+ }
7
+
8
+ /* 编辑器自身负责滚动,提示浮层可越过编辑区域边界。 */
9
+ :where([data-winm-ui]) .code-editor {
10
+ height: 200px;
11
+ border: 1px solid var(--ui-border);
12
+ border-radius: 8px;
13
+ min-width: 0;
14
+ position: relative;
15
+ font-size: 13px;
16
+ user-select: text;
17
+ -webkit-user-select: text;
18
+ transition: border-color var(--ui-duration-fast, 140ms) var(--ui-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
19
+ }
20
+ :where([data-winm-ui]) .code-editor .cm-editor,
21
+ :where([data-winm-ui]) .code-editor .cm-scroller,
22
+ :where([data-winm-ui]) .code-editor .cm-content,
23
+ :where([data-winm-ui]) .code-editor .cm-line {
24
+ user-select: text;
25
+ -webkit-user-select: text;
26
+ }
27
+ :where([data-winm-ui]) .code-editor .cm-gutters,
28
+ :where([data-winm-ui]) .code-editor .cm-gutter,
29
+ :where([data-winm-ui]) .code-editor .cm-gutterElement {
30
+ user-select: none;
31
+ -webkit-user-select: none;
32
+ }
33
+ :where([data-winm-ui]) .code-editor ::selection {
34
+ background-color: var(--winm-code-selection);
35
+ }
36
+ :where([data-winm-ui]) .code-editor .cm-editor {
37
+ border-radius: 8px;
38
+ }
39
+ :where([data-winm-ui]) .code-editor .cm-scroller {
40
+ border-radius: 8px;
41
+ }
42
+ /* 与普通 input / textarea 共用单层聚焦描边,高对比度模式使用系统高亮色 */
43
+ :where([data-winm-ui]) .code-editor:focus-within {
44
+ outline: none;
45
+ border-color: var(--ui-accent);
46
+ }
47
+ @media (forced-colors: active) {
48
+ :where([data-winm-ui]) .code-editor:focus-within {
49
+ outline: 1px solid Highlight;
50
+ outline-offset: 1px;
51
+ }
52
+ }
53
+ :where([data-winm-ui]) .code-field-heading {
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: space-between;
57
+ margin-bottom: 6px;
58
+ font-size: 13px;
59
+ color: var(--ui-text-secondary);
60
+ }
61
+ :where([data-winm-ui]) .code-field-heading.only-actions {
62
+ justify-content: flex-end;
63
+ margin-bottom: 4px;
64
+ }
65
+ :where([data-winm-ui]) .code-field-heading-actions {
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 8px;
69
+ }
70
+ :where([data-winm-ui]) .code-field-heading .icon-button {
71
+ height: 28px;
72
+ width: 28px;
73
+ }
74
+ :where([data-winm-ui]) .code-hint {
75
+ font-size: 12px;
76
+ color: var(--ui-text-muted);
77
+ margin-top: 8px;
78
+ }
79
+ :where([data-winm-ui]) .code-field-footer {
80
+ display: flex;
81
+ align-items: center;
82
+ justify-content: space-between;
83
+ margin-top: 8px;
84
+ gap: 12px;
85
+ }
86
+ :where([data-winm-ui]) .code-field-footer .code-hint {
87
+ margin-top: 0;
88
+ }
89
+ :where([data-winm-ui]) .code-wrap-toggle {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ gap: 6px;
93
+ font-size: 12px;
94
+ color: var(--ui-text-secondary);
95
+ cursor: pointer;
96
+ user-select: none;
97
+ -webkit-user-select: none;
98
+ }
99
+ :where([data-winm-ui]) .code-wrap-toggle:hover {
100
+ color: var(--ui-text);
101
+ }
102
+ :where([data-winm-ui]) .code-dialog-footer-actions {
103
+ display: flex;
104
+ align-items: center;
105
+ gap: 16px;
106
+ }
107
+ :where([data-winm-ui]) .code-editor-field {
108
+ margin-bottom: 20px;
109
+ }
110
+ :where([data-winm-ui]) .field-label .code-editor-field {
111
+ margin-bottom: 0;
112
+ }
113
+ :where([data-winm-ui]) .code-editor-field .code-field-footer + .code-hint {
114
+ margin-top: 6px;
115
+ }
116
+ :where([data-winm-ui]) .code-dialog {
117
+ width: 960px;
118
+ height: min(720px, 80dvh);
119
+ overflow: visible;
120
+ }
121
+ :where([data-winm-ui]) .code-dialog.has-side {
122
+ width: min(1140px, 94vw);
123
+ }
124
+ :where([data-winm-ui]) .code-dialog[open] {
125
+ display: flex;
126
+ flex-direction: column;
127
+ }
128
+ :where([data-winm-ui]) .code-dialog .modal-body.code-dialog-body {
129
+ padding: 0;
130
+ display: flex;
131
+ flex-direction: column;
132
+ overflow: visible;
133
+ }
134
+ :where([data-winm-ui]) .code-dialog header {
135
+ border-radius: 12px 12px 0 0;
136
+ }
137
+ :where([data-winm-ui]) .code-dialog-workspace {
138
+ flex: 1;
139
+ min-height: 0;
140
+ display: flex;
141
+ gap: 14px;
142
+ margin: 0 20px 14px;
143
+ }
144
+ :where([data-winm-ui]) .code-dialog-workspace > .code-editor {
145
+ flex: 1;
146
+ height: auto;
147
+ min-height: 0;
148
+ }
149
+ :where([data-winm-ui]) .code-dialog-side {
150
+ width: 288px;
151
+ flex-shrink: 0;
152
+ overflow-y: auto;
153
+ border: 1px solid var(--ui-border);
154
+ border-radius: 8px;
155
+ padding: 12px;
156
+ background: var(--ui-surface);
157
+ display: flex;
158
+ flex-direction: column;
159
+ gap: 14px;
160
+ }
161
+ :where([data-winm-ui]) .code-dialog footer {
162
+ border-radius: 0 0 12px 12px;
163
+ align-items: center;
164
+ justify-content: space-between;
165
+ gap: 12px;
166
+ }
167
+ :where([data-winm-ui]) .code-dialog .code-hint {
168
+ margin: 0;
169
+ }
170
+ @media (max-width: 900px) {
171
+ :where([data-winm-ui]) .code-dialog-workspace {
172
+ flex-direction: column;
173
+ }
174
+ :where([data-winm-ui]) .code-dialog-side {
175
+ width: auto;
176
+ max-height: 180px;
177
+ }
178
+ }
179
+ @media (max-width: 700px) {
180
+ :where([data-winm-ui]) .code-dialog {
181
+ height: 85dvh;
182
+ }
183
+ :where([data-winm-ui]) .code-dialog-workspace {
184
+ margin: 0 12px 12px;
185
+ }
186
+ :where([data-winm-ui]) .code-dialog footer .code-hint {
187
+ display: none;
188
+ }
189
+ }
@@ -0,0 +1,5 @@
1
+ export { default as CodeEditor } from "./components/CodeEditor.vue";
2
+ export { default as ExpandableCodeEditor } from "./components/ExpandableCodeEditor.vue";
3
+ export { languageExtensions, type CodeHints, type CodeLanguage, type SQLHints } from "./editors/languages";
4
+ export { formatFieldAccess, scriptCompletionSource } from "./editors/script-completions";
5
+ export { analyzeScript } from "./editors/script-linter";