@hankchen/canvas-editor-vue 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +22 -2
- package/dist/canvas/AlignFloatBar.d.ts +6 -0
- package/dist/canvas/CanvasSurface.d.ts +131 -0
- package/dist/canvas/ContentTypePill.d.ts +14 -0
- package/dist/canvas/ContextMenu.d.ts +14 -0
- package/dist/canvas/FindBar.d.ts +13 -0
- package/dist/canvas/GuidesOverlay.d.ts +18 -0
- package/dist/canvas/Ruler.d.ts +24 -0
- package/dist/canvas/TextEditingOverlay.d.ts +70 -0
- package/dist/canvas/createBand.d.ts +6 -0
- package/dist/canvas/findHighlight.d.ts +12 -0
- package/dist/canvas/gizmo.d.ts +24 -0
- package/dist/canvas/guideSnap.d.ts +3 -0
- package/dist/canvas/index.d.ts +20 -0
- package/dist/canvas/resizeHandles.d.ts +3 -0
- package/dist/canvas/scheduler.d.ts +2 -0
- package/dist/canvas/useDpr.d.ts +10 -0
- package/dist/canvas/useFindSession.d.ts +13 -0
- package/dist/canvas/useTextEditing.d.ts +53 -0
- package/dist/canvas-CS4SmrIO.js +1649 -0
- package/dist/canvas.js +2 -0
- package/dist/completionAnchor-4lhR2kJz.js +273 -0
- package/dist/createLucideIcon-CMq8ZKo2.js +96 -0
- package/dist/dist-DuXLYZZ9.js +341 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +16 -0
- package/dist/layer-panel/LayerPanel.d.ts +32 -0
- package/dist/layer-panel/addMenu.d.ts +18 -0
- package/dist/layer-panel/index.d.ts +7 -0
- package/dist/layer-panel/useLayerPanel.d.ts +12 -0
- package/dist/layer-panel-ArP66_vZ.js +652 -0
- package/dist/layer-panel.js +2 -0
- package/dist/layerPath-BRZK9ka1.js +2160 -0
- package/dist/panel-theme.css +254 -0
- package/dist/property-panel/PropertyField.d.ts +65 -0
- package/dist/property-panel/PropertyPanel.d.ts +6 -0
- package/dist/property-panel/controlStyles.d.ts +17 -0
- package/dist/property-panel/controls.d.ts +3 -0
- package/dist/property-panel/fieldSchema.d.ts +116 -0
- package/dist/property-panel/fields/AlignField.d.ts +11 -0
- package/dist/property-panel/fields/AnchorDisclosureField.d.ts +16 -0
- package/dist/property-panel/fields/BooleanField.d.ts +13 -0
- package/dist/property-panel/fields/BorderField.d.ts +14 -0
- package/dist/property-panel/fields/BorderWidthInput.d.ts +14 -0
- package/dist/property-panel/fields/ColorField.d.ts +13 -0
- package/dist/property-panel/fields/FontField.d.ts +15 -0
- package/dist/property-panel/fields/ImageSrcField.d.ts +20 -0
- package/dist/property-panel/fields/NumberField.d.ts +13 -0
- package/dist/property-panel/fields/PaddingField.d.ts +14 -0
- package/dist/property-panel/fields/PairField.d.ts +19 -0
- package/dist/property-panel/fields/SelectField.d.ts +11 -0
- package/dist/property-panel/fields/ShorthandModeButton.d.ts +13 -0
- package/dist/property-panel/fields/TextField.d.ts +13 -0
- package/dist/property-panel/fields/TextareaField.d.ts +13 -0
- package/dist/property-panel/fields/ValueTypeSegmented.d.ts +10 -0
- package/dist/property-panel/fields/index.d.ts +16 -0
- package/dist/property-panel/fontPicker.d.ts +13 -0
- package/dist/property-panel/imageUpload.d.ts +11 -0
- package/dist/property-panel/index.d.ts +13 -0
- package/dist/property-panel/shorthand.d.ts +28 -0
- package/dist/property-panel/usePropertyPanel.d.ts +51 -0
- package/dist/property-panel/useShorthandMode.d.ts +18 -0
- package/dist/property-panel-jt_rsTVW.js +1719 -0
- package/dist/property-panel.js +2 -0
- package/dist/shared/DropdownMenu.d.ts +47 -0
- package/dist/shared/ExpressionCompletionPopup.d.ts +14 -0
- package/dist/shared/HelpDialog.d.ts +12 -0
- package/dist/shared/PanelIcon.d.ts +14 -0
- package/dist/shared/completion.d.ts +49 -0
- package/dist/shared/completionAnchor.d.ts +28 -0
- package/dist/shared/editableTarget.d.ts +5 -0
- package/dist/shared/expressionContext.d.ts +22 -0
- package/dist/shared/index.d.ts +37 -0
- package/dist/shared/rowsPathCompletionSource.d.ts +3 -0
- package/dist/shared/shortcutsHelp.d.ts +30 -0
- package/dist/shared/uploadFile.d.ts +2 -0
- package/dist/shared/useDataSourceSchema.d.ts +3 -0
- package/dist/shared/useDropdownMenu.d.ts +51 -0
- package/dist/shared/useExpressionCompletion.d.ts +45 -0
- package/dist/shared/useHistory.d.ts +7 -0
- package/dist/shared/usePathCompletion.d.ts +18 -0
- package/dist/shared/useSelection.d.ts +3 -0
- package/dist/shared/useShortcuts.d.ts +2 -0
- package/dist/shared/useShortcutsHelp.d.ts +9 -0
- package/dist/shared/useTransientFeedback.d.ts +10 -0
- package/dist/shared/useViewport.d.ts +3 -0
- package/dist/shared-D9zYUQaw.js +123 -0
- package/dist/shared.js +9 -0
- package/dist/status-bar/StatusBar.d.ts +17 -0
- package/dist/status-bar/index.d.ts +9 -0
- package/dist/status-bar/layerGeometryLabel.d.ts +13 -0
- package/dist/status-bar/layerPathLabel.d.ts +2 -0
- package/dist/status-bar/useDoc.d.ts +3 -0
- package/dist/status-bar-BhhrVoBZ.js +194 -0
- package/dist/status-bar.js +2 -0
- package/dist/style.css +2 -0
- package/dist/uploadFile-CutE_xI-.js +330 -0
- package/dist/useDataSourceSchema-C924m8fc.js +237 -0
- package/dist/usePathCompletion-DkHoGla4.js +228 -0
- package/dist/useShortcutsHelp-DTC3yRil.js +19 -0
- package/dist/useTransientFeedback-gS9Xa9GY.js +477 -0
- package/dist/useViewport-BLe2ise1.js +18 -0
- package/package.json +77 -3
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { B as e, D as t, G as n, H as r, L as i, P as a, _ as o, a as s, b as c, d as l, g as u, m as d, p as f, y as p } from "./layerPath-BRZK9ka1.js";
|
|
2
|
+
import { l as m, o as h, s as g, t as _ } from "./useTransientFeedback-gS9Xa9GY.js";
|
|
3
|
+
import { n as v, t as y } from "./useViewport-BLe2ise1.js";
|
|
4
|
+
import { n as b, t as x } from "./useDataSourceSchema-C924m8fc.js";
|
|
5
|
+
import { t as S } from "./useShortcutsHelp-DTC3yRil.js";
|
|
6
|
+
//#region src/status-bar/layerPathLabel.ts
|
|
7
|
+
function C(e) {
|
|
8
|
+
let t = `图层 ${String(e[1])}`;
|
|
9
|
+
for (let n = 2; n < e.length; n += 1) {
|
|
10
|
+
let r = e[n];
|
|
11
|
+
if (r === "template") {
|
|
12
|
+
t += " · 行模板";
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
r === "rows" ? (t += ` · 行 ${String(e[n + 1])}`, n += 1) : r === "cells" ? (t += ` · 格 ${String(e[n + 1])}`, n += 1) : r === "content" && (t += " · 格内容");
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/status-bar/layerGeometryLabel.ts
|
|
21
|
+
var w = {
|
|
22
|
+
"top-left": "左上",
|
|
23
|
+
top: "中上",
|
|
24
|
+
"top-right": "右上",
|
|
25
|
+
left: "左中",
|
|
26
|
+
center: "正中",
|
|
27
|
+
right: "右中",
|
|
28
|
+
"bottom-left": "左下",
|
|
29
|
+
bottom: "中下",
|
|
30
|
+
"bottom-right": "右下"
|
|
31
|
+
};
|
|
32
|
+
function T(e, t) {
|
|
33
|
+
return `x=${Math.round(e.x)} y=${Math.round(e.y)} · ${Math.round(t.width)}×${Math.round(t.height)} · ${w[e.anchor]}锚`;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/status-bar/useDoc.ts
|
|
37
|
+
function E(t) {
|
|
38
|
+
let n = e(t.store.doc), r = t.subscribe((e) => {
|
|
39
|
+
e.scope === "doc" && (n.value = t.store.doc);
|
|
40
|
+
});
|
|
41
|
+
return i(r, !0), f(() => n.value);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/status-bar/StatusBar.vue?vue&type=script&setup=true&lang.ts
|
|
45
|
+
var D = {
|
|
46
|
+
class: "cn-statusbar",
|
|
47
|
+
role: "status",
|
|
48
|
+
"aria-label": "编辑器状态栏"
|
|
49
|
+
}, O = [
|
|
50
|
+
"aria-expanded",
|
|
51
|
+
"onClick",
|
|
52
|
+
"onKeydown"
|
|
53
|
+
], k = {
|
|
54
|
+
class: "cn-statusbar__segment",
|
|
55
|
+
"data-selection": ""
|
|
56
|
+
}, A = {
|
|
57
|
+
class: "cn-statusbar__segment cn-statusbar__segment--pending",
|
|
58
|
+
"data-pending": ""
|
|
59
|
+
}, j = {
|
|
60
|
+
class: "cn-statusbar__segment",
|
|
61
|
+
"data-geometry": ""
|
|
62
|
+
}, M = {
|
|
63
|
+
class: "cn-statusbar__segment",
|
|
64
|
+
"data-resource": ""
|
|
65
|
+
}, N = {
|
|
66
|
+
class: "cn-statusbar__segment",
|
|
67
|
+
"data-save": ""
|
|
68
|
+
}, P = {
|
|
69
|
+
class: "cn-statusbar__segment",
|
|
70
|
+
"data-schema": ""
|
|
71
|
+
}, F = {
|
|
72
|
+
class: "cn-statusbar__segment",
|
|
73
|
+
"data-feedback": ""
|
|
74
|
+
}, I = /*#__PURE__*/ m(/* @__PURE__ */ c({
|
|
75
|
+
__name: "StatusBar",
|
|
76
|
+
props: {
|
|
77
|
+
editor: {},
|
|
78
|
+
pendingCount: { default: 0 },
|
|
79
|
+
resourceNote: { default: "" },
|
|
80
|
+
saveState: {},
|
|
81
|
+
feedback: { default: "" }
|
|
82
|
+
},
|
|
83
|
+
setup(e) {
|
|
84
|
+
let i = e, c = y(i.editor), m = v(i.editor), w = E(i.editor), I = x(i.editor), L = f(() => Math.round(c.value.zoom * 100)), R = f(() => {
|
|
85
|
+
let e = m.value;
|
|
86
|
+
return e === null ? "未选中图层" : C(e);
|
|
87
|
+
}), z = f(() => {
|
|
88
|
+
let e = m.value, t = w.value;
|
|
89
|
+
if (e === null || t === null) return null;
|
|
90
|
+
let n = s(t, e), r = i.editor.layerBoxAt(e);
|
|
91
|
+
return !n || !r ? null : T(n.position, r);
|
|
92
|
+
}), B = f(() => {
|
|
93
|
+
let e = I.value;
|
|
94
|
+
return e === null ? "schema 无候选" : `schema 已注入顶层 ${e.properties?.size ?? 0} 键`;
|
|
95
|
+
}), { toggle: V } = S(), H = `快捷键帮助(${g("helpShortcuts", h())})`, U = _(), W = f(() => i.feedback === "" ? U.message.value : i.feedback);
|
|
96
|
+
function G(e) {
|
|
97
|
+
let { width: t, height: n } = i.editor.getSurfaceSize();
|
|
98
|
+
i.editor.zoomAt(t / 2, n / 2, c.value.zoom * e);
|
|
99
|
+
}
|
|
100
|
+
let K = f(() => [
|
|
101
|
+
{
|
|
102
|
+
label: "100%",
|
|
103
|
+
dataAttrs: { "data-zoom-100": "" },
|
|
104
|
+
run: () => i.editor.resetZoom()
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
label: "适应画布",
|
|
108
|
+
dataAttrs: { "data-zoom-fit": "" },
|
|
109
|
+
run: () => i.editor.fitToSurface()
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "适应选区",
|
|
113
|
+
dataAttrs: { "data-zoom-fit-selection": "" },
|
|
114
|
+
run: () => i.editor.fitToSelection()
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: "放大",
|
|
118
|
+
title: "放大(以视口中心为锚)",
|
|
119
|
+
dataAttrs: { "data-zoom-in": "" },
|
|
120
|
+
run: () => G(1.25)
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: "缩小",
|
|
124
|
+
title: "缩小(以视口中心为锚)",
|
|
125
|
+
dataAttrs: { "data-zoom-out": "" },
|
|
126
|
+
run: () => G(1 / 1.25)
|
|
127
|
+
}
|
|
128
|
+
]);
|
|
129
|
+
return (e, s) => (t(), o("footer", D, [
|
|
130
|
+
p(b, {
|
|
131
|
+
label: "缩放",
|
|
132
|
+
direction: "up",
|
|
133
|
+
items: K.value
|
|
134
|
+
}, {
|
|
135
|
+
trigger: a(({ open: e, toggle: t, triggerRef: r, onKeydown: i }) => [d("button", {
|
|
136
|
+
ref: r,
|
|
137
|
+
type: "button",
|
|
138
|
+
class: "cn-statusbar__segment cn-statusbar__zoom-trigger",
|
|
139
|
+
"data-zoom": "",
|
|
140
|
+
"aria-haspopup": "menu",
|
|
141
|
+
"aria-expanded": e,
|
|
142
|
+
title: "缩放",
|
|
143
|
+
onClick: t,
|
|
144
|
+
onKeydown: i
|
|
145
|
+
}, n(L.value) + "% ", 41, O)]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["items"]),
|
|
148
|
+
s[6] ||= d("span", {
|
|
149
|
+
class: "cn-statusbar__divider",
|
|
150
|
+
"aria-hidden": "true"
|
|
151
|
+
}, null, -1),
|
|
152
|
+
d("span", k, n(R.value), 1),
|
|
153
|
+
i.pendingCount > 0 ? (t(), o(l, { key: 0 }, [s[1] ||= d("span", {
|
|
154
|
+
class: "cn-statusbar__divider",
|
|
155
|
+
"aria-hidden": "true"
|
|
156
|
+
}, null, -1), d("span", A, " 物化中 " + n(i.pendingCount), 1)], 64)) : u("", !0),
|
|
157
|
+
z.value === null ? u("", !0) : (t(), o(l, { key: 1 }, [s[2] ||= d("span", {
|
|
158
|
+
class: "cn-statusbar__divider",
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}, null, -1), d("span", j, n(z.value), 1)], 64)),
|
|
161
|
+
i.resourceNote === "" ? u("", !0) : (t(), o(l, { key: 2 }, [s[3] ||= d("span", {
|
|
162
|
+
class: "cn-statusbar__divider",
|
|
163
|
+
"aria-hidden": "true"
|
|
164
|
+
}, null, -1), d("span", M, n(i.resourceNote), 1)], 64)),
|
|
165
|
+
i.saveState === void 0 ? u("", !0) : (t(), o(l, { key: 3 }, [s[4] ||= d("span", {
|
|
166
|
+
class: "cn-statusbar__divider",
|
|
167
|
+
"aria-hidden": "true"
|
|
168
|
+
}, null, -1), d("span", N, n(i.saveState === "dirty" ? "● 未保存" : "○ 已保存"), 1)], 64)),
|
|
169
|
+
s[7] ||= d("span", {
|
|
170
|
+
class: "cn-statusbar__divider",
|
|
171
|
+
"aria-hidden": "true"
|
|
172
|
+
}, null, -1),
|
|
173
|
+
d("span", P, n(B.value), 1),
|
|
174
|
+
W.value === "" ? u("", !0) : (t(), o(l, { key: 4 }, [s[5] ||= d("span", {
|
|
175
|
+
class: "cn-statusbar__divider",
|
|
176
|
+
"aria-hidden": "true"
|
|
177
|
+
}, null, -1), d("span", F, n(W.value), 1)], 64)),
|
|
178
|
+
s[8] ||= d("span", {
|
|
179
|
+
class: "cn-statusbar__divider",
|
|
180
|
+
"aria-hidden": "true"
|
|
181
|
+
}, null, -1),
|
|
182
|
+
d("button", {
|
|
183
|
+
type: "button",
|
|
184
|
+
class: "cn-statusbar__segment cn-statusbar__help",
|
|
185
|
+
"data-help": "",
|
|
186
|
+
"aria-haspopup": "dialog",
|
|
187
|
+
title: H,
|
|
188
|
+
onClick: s[0] ||= (...e) => r(V) && r(V)(...e)
|
|
189
|
+
}, " 快捷键 ")
|
|
190
|
+
]));
|
|
191
|
+
}
|
|
192
|
+
}), [["__scopeId", "data-v-040479fb"]]);
|
|
193
|
+
//#endregion
|
|
194
|
+
export { T as n, C as r, I as t };
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.cn-align-float[data-v-9a761d37]{--cn-fg:#e6edf7;--cn-muted:#7c8ca5;--cn-field-line:#2a3a57;--cn-accent:#38bdf8;--cn-hover:#16223a;border:1px solid var(--cn-field-line);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);color:var(--cn-fg);-webkit-user-select:none;user-select:none;background:#0b1220eb;border-radius:9px;align-items:center;gap:4px;padding:5px 8px;display:inline-flex;box-shadow:0 10px 26px #00000073}.cn-align-float__group[data-v-9a761d37]{align-items:center;gap:2px;display:flex}.cn-align-float__divider[data-v-9a761d37]{background:var(--cn-field-line);width:1px;height:16px}.cn-align-float__key[data-v-9a761d37]{width:24px;height:24px;color:var(--cn-fg);cursor:pointer;background:0 0;border:none;border-radius:6px;place-content:center;padding:0;display:grid}.cn-align-float__key[data-v-9a761d37]:hover:not(:disabled){background:var(--cn-hover);color:var(--cn-accent)}.cn-align-float--disabled[data-v-9a761d37]{color:var(--cn-muted)}.cn-align-float--disabled .cn-align-float__key[data-v-9a761d37]{color:var(--cn-muted);cursor:not-allowed}.cn-context-menu[data-v-e554ef38]{--cn-bg:#0b1220;--cn-bg-elevated:#101a2e;--cn-fg:#e6edf7;--cn-muted:#7c8ca5;--cn-line:#1e2a40;--cn-field:#94a3b812;--cn-accent:#38bdf8;--cn-accent-soft:#38bdf81f;--cn-danger:#f87171;z-index:30;background:var(--cn-bg-elevated);border:1px solid var(--cn-line);border-radius:10px;flex-direction:column;gap:2px;min-width:120px;padding:4px;display:flex;position:absolute;box-shadow:0 12px 32px #0206178c}.cn-context-menu__item[data-v-e554ef38]{color:var(--cn-fg);text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:6px 12px;font-size:13px;line-height:1.4}.cn-context-menu__item[data-v-e554ef38]:hover:not(:disabled){background:var(--cn-accent-soft);color:var(--cn-accent)}.cn-context-menu__item[data-v-e554ef38]:disabled{color:var(--cn-muted);cursor:not-allowed}.cn-context-menu__item--delete[data-v-e554ef38]:hover:not(:disabled){color:var(--cn-danger);background:#f871711f}.cn-context-menu__form[data-v-e554ef38]{flex-direction:column;gap:6px;min-width:180px;padding:4px;display:flex}.cn-context-menu__hint[data-v-e554ef38]{color:var(--cn-muted);margin:0;padding:0 4px;font-size:11px;line-height:1.5}.cn-context-menu__hint--error[data-v-e554ef38]{color:var(--cn-danger)}.cn-context-menu__input[data-v-e554ef38]{border:1px solid var(--cn-line);background:var(--cn-field);color:var(--cn-fg);border-radius:6px;outline:none;padding:5px 8px;font-size:12px;line-height:1.4}.cn-context-menu__input[data-v-e554ef38]:focus{border-color:var(--cn-accent)}.cn-context-menu__input--invalid[data-v-e554ef38]{border-color:var(--cn-danger)}.cn-context-menu__form-actions[data-v-e554ef38]{gap:4px;display:flex}.cn-context-menu__form-actions .cn-context-menu__item[data-v-e554ef38]{text-align:center;flex:1}.cn-context-menu__item--confirm[data-v-e554ef38]{background:var(--cn-accent-soft);color:var(--cn-accent)}.cn-find-bar[data-v-e9f0e575]{--cn-fg:#e6edf7;--cn-muted:#7c8ca5;--cn-field-line:#2a3a57;--cn-accent:#38bdf8;--cn-hover:#16223a;z-index:25;border:1px solid var(--cn-field-line);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);color:var(--cn-fg);-webkit-user-select:none;user-select:none;background:#0b1220eb;border-radius:9px;align-items:center;gap:6px;padding:6px 8px;display:inline-flex;position:absolute;top:12px;left:50%;transform:translate(-50%);box-shadow:0 10px 26px #00000073}.cn-find-bar__input[data-v-e9f0e575]{border:1px solid var(--cn-field-line);width:132px;color:var(--cn-fg);background:#0b1220e6;border-radius:6px;padding:4px 8px;font-size:13px;line-height:1.4}.cn-find-bar__input[data-v-e9f0e575]::placeholder{color:var(--cn-muted)}.cn-find-bar__input[data-v-e9f0e575]:focus{border-color:var(--cn-accent);outline:none}.cn-find-bar__count[data-v-e9f0e575]{text-align:center;min-width:56px;color:var(--cn-muted);white-space:nowrap;font-size:12px}.cn-find-bar__note[data-v-e9f0e575]{color:var(--cn-accent);white-space:nowrap;font-size:12px}.cn-find-bar__key[data-v-e9f0e575]{width:24px;height:24px;color:var(--cn-fg);cursor:pointer;background:0 0;border:none;border-radius:6px;place-content:center;padding:0;display:grid}.cn-find-bar__action[data-v-e9f0e575]{color:var(--cn-fg);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:4px 10px;font-size:12px;line-height:1.4}.cn-find-bar__key[data-v-e9f0e575]:hover:not(:disabled),.cn-find-bar__action[data-v-e9f0e575]:hover:not(:disabled){background:var(--cn-hover);color:var(--cn-accent)}.cn-find-bar__key[data-v-e9f0e575]:disabled,.cn-find-bar__action[data-v-e9f0e575]:disabled{color:var(--cn-muted);cursor:not-allowed}.cn-content-pill[data-v-d99d2c13]{--cn-bg-elevated:#101a2e;--cn-fg:#e6edf7;--cn-muted:#7c8ca5;--cn-line:#1e2a40;--cn-accent:#38bdf8;--cn-accent-soft:#38bdf81f;z-index:30;background:var(--cn-bg-elevated);border:1px solid var(--cn-line);pointer-events:auto;-webkit-user-select:none;user-select:none;border-radius:7px;align-items:stretch;display:inline-flex;position:absolute;top:0;left:0;overflow:hidden;box-shadow:0 8px 20px #02061773}.cn-content-pill__item[data-v-d99d2c13]{color:var(--cn-muted);white-space:nowrap;cursor:pointer;background:0 0;border:0;padding:3px 10px;font-size:11px;line-height:1.4}.cn-content-pill__item+.cn-content-pill__item[data-v-d99d2c13]{border-left:1px solid var(--cn-line)}.cn-content-pill__item[data-v-d99d2c13]:hover{color:var(--cn-fg)}.cn-content-pill__item--active[data-v-d99d2c13]{background:var(--cn-accent-soft);color:var(--cn-accent);cursor:default}.cn-text-overlay[data-v-bc9281f8]{pointer-events:none;position:absolute;inset:0}.cn-text-overlay__textarea[data-v-bc9281f8]{resize:none;-webkit-user-select:text;user-select:text;pointer-events:auto;letter-spacing:normal;text-transform:none;background:0 0;border:0;outline:none;margin:0;padding:0;font-style:normal;font-weight:400;position:absolute;top:0;left:0;overflow:hidden}.cn-surface[data-v-6e21095e]{touch-action:none;-webkit-user-select:none;user-select:none;position:relative;overflow:hidden}.cn-surface__canvas[data-v-6e21095e]{width:100%;height:100%;display:block;position:absolute;inset:0}.cn-surface__canvas--overlay[data-v-6e21095e]{pointer-events:none}.cn-surface--pannable[data-v-6e21095e]{cursor:grab}.cn-surface--panning[data-v-6e21095e]{cursor:grabbing}.cn-surface__drop-hint[data-v-6e21095e]{z-index:20;pointer-events:none;background:#38bdf814;border:2px dashed #38bdf899;border-radius:12px;justify-content:center;align-items:center;display:flex;position:absolute;inset:8px}.cn-surface__drop-hint-text[data-v-6e21095e]{color:#38bdf8;background:#0b1220;border-radius:8px;padding:6px 14px;font-size:13px;line-height:1.4}.cn-guides[data-v-51fd929c]{--cn-guide-line:#38bdf8;--cn-guide-glow:#38bdf866;--cn-guide-will-delete:#f87171;--cn-guide-will-delete-glow:#f8717173;--cn-snap-line:#fb7185;--cn-snap-glow:#fb718573;--cn-snap-dash:4px;--cn-guide-hit:9px;--cn-guide-clip-radius:12px;border-radius:var(--cn-guide-clip-radius);pointer-events:none;-webkit-user-select:none;user-select:none;position:absolute;inset:0;overflow:hidden}.cn-guides__guide[data-v-51fd929c]{pointer-events:auto;touch-action:none;position:absolute}.cn-guides__guide--vertical[data-v-51fd929c]{width:var(--cn-guide-hit);cursor:ew-resize;transform:translate(-50%)}.cn-guides__guide--horizontal[data-v-51fd929c]{height:var(--cn-guide-hit);cursor:ns-resize;transform:translateY(-50%)}.cn-guides__guide--vertical[data-v-51fd929c]:after,.cn-guides__guide--horizontal[data-v-51fd929c]:after{content:"";background:var(--cn-guide-line);box-shadow:0 0 6px var(--cn-guide-glow);position:absolute}.cn-guides__guide--vertical[data-v-51fd929c]:after{width:1px;top:0;bottom:0;left:calc(50% - .5px)}.cn-guides__guide--horizontal[data-v-51fd929c]:after{height:1px;top:calc(50% - .5px);left:0;right:0}.cn-guides__guide--preview[data-v-51fd929c]{pointer-events:none}.cn-guides__guide--preview[data-v-51fd929c]:after{opacity:.85}.cn-guides__guide--grabbed[data-v-51fd929c]:after{opacity:.75}.cn-guides__guide--will-delete[data-v-51fd929c]:after{background:var(--cn-guide-will-delete);box-shadow:0 0 6px var(--cn-guide-will-delete-glow)}.cn-guides__snap[data-v-51fd929c]{pointer-events:none;filter:drop-shadow(0 0 3px var(--cn-snap-glow));position:absolute}.cn-guides__snap--vertical[data-v-51fd929c]{background-image:repeating-linear-gradient(to bottom, var(--cn-snap-line) 0 var(--cn-snap-dash), transparent var(--cn-snap-dash) calc(var(--cn-snap-dash) * 2));width:1px}.cn-guides__snap--horizontal[data-v-51fd929c]{background-image:repeating-linear-gradient(to right, var(--cn-snap-line) 0 var(--cn-snap-dash), transparent var(--cn-snap-dash) calc(var(--cn-snap-dash) * 2));height:1px}.cn-ruler[data-v-5bd7248c]{--cn-ruler-thickness:20px;--cn-ruler-bg:#0b1220eb;--cn-ruler-line:#1e2a40;--cn-ruler-tick:#7c8ca5;--cn-ruler-label:#aab6c8;--cn-ruler-font:"SF Mono", Menlo, Consolas, monospace;pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;font-family:var(--cn-ruler-font);position:relative}.cn-ruler__bar[data-v-5bd7248c]{pointer-events:auto;touch-action:none;background:var(--cn-ruler-bg);position:absolute;top:0;left:0;overflow:hidden}.cn-ruler__bar--top[data-v-5bd7248c]{height:var(--cn-ruler-thickness);border-bottom:1px solid var(--cn-ruler-line);right:0}.cn-ruler__bar--left[data-v-5bd7248c]{width:var(--cn-ruler-thickness);border-right:1px solid var(--cn-ruler-line);bottom:0}.cn-ruler__corner[data-v-5bd7248c]{z-index:1;width:var(--cn-ruler-thickness);height:var(--cn-ruler-thickness);background:var(--cn-ruler-bg);border-right:1px solid var(--cn-ruler-line);border-bottom:1px solid var(--cn-ruler-line);position:absolute;top:0;left:0}.cn-ruler__tick[data-v-5bd7248c]{background:var(--cn-ruler-tick);position:absolute}.cn-ruler__bar--top .cn-ruler__tick[data-v-5bd7248c]{width:1px;height:4px;bottom:0}.cn-ruler__bar--top .cn-ruler__tick--major[data-v-5bd7248c]{height:8px}.cn-ruler__bar--left .cn-ruler__tick[data-v-5bd7248c]{width:4px;height:1px;right:0}.cn-ruler__bar--left .cn-ruler__tick--major[data-v-5bd7248c]{width:8px}.cn-ruler__label[data-v-5bd7248c]{white-space:nowrap;color:var(--cn-ruler-label);font-size:9px;line-height:1;position:absolute}.cn-ruler__bar--top .cn-ruler__label[data-v-5bd7248c]{bottom:9px;left:3px}.cn-ruler__bar--left .cn-ruler__label[data-v-5bd7248c]{writing-mode:vertical-rl;top:2px;right:10px}.cn-dropdown[data-v-ec8a19c1]{--cn-fg:#e6edf7;--cn-fg-2:#c3cddd;--cn-muted:#7c8ca5;--cn-line:#1e2a40;--cn-bg-elevated:#101a2e;--cn-hover:#16223a;--cn-accent:#38bdf8;--cn-accent-soft:#38bdf81f;display:inline-flex;position:relative}.cn-dropdown__trigger[data-v-ec8a19c1]{white-space:nowrap;color:var(--cn-fg-2);cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:3px;padding:5px 9px;font-size:13px;display:inline-flex}.cn-dropdown__trigger[data-v-ec8a19c1]:hover{background:var(--cn-hover);color:var(--cn-fg)}.cn-dropdown__caret[data-v-ec8a19c1]{color:var(--cn-muted);font-size:10px;line-height:1}.cn-dropdown__menu[data-v-ec8a19c1]{z-index:40;background:var(--cn-bg-elevated);border:1px solid var(--cn-line);border-radius:10px;flex-direction:column;gap:2px;min-width:148px;padding:4px;display:flex;position:fixed;box-shadow:0 12px 32px #0206178c}.cn-dropdown__item[data-v-ec8a19c1]{color:var(--cn-fg);text-align:left;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;justify-content:space-between;align-items:center;gap:14px;padding:6px 12px;font-size:12px;line-height:1.4;display:flex}.cn-dropdown__item[data-v-ec8a19c1]:hover:not(:disabled){background:var(--cn-accent-soft);color:var(--cn-accent)}.cn-dropdown__item[data-v-ec8a19c1]:disabled{color:var(--cn-muted);cursor:not-allowed}.cn-dropdown__shortcut[data-v-ec8a19c1]{color:var(--cn-muted);font-variant-numeric:tabular-nums;flex:none;font-size:11px;line-height:1.4}.cn-dropdown__separator[data-v-ec8a19c1]{background:var(--cn-line);flex:none;height:1px;margin:3px 6px}.cn-statusbar[data-v-040479fb]{--cn-bg:#0b1220;--cn-bg-elevated:#101a2e;--cn-fg:#e6edf7;--cn-muted:#7c8ca5;--cn-line:#1e2a40;--cn-accent:#38bdf8;background-color:var(--cn-bg);color:var(--cn-muted);font-variant-numeric:tabular-nums;-webkit-user-select:none;user-select:none;align-items:center;gap:10px;padding:6px 12px;font-size:12px;line-height:1.4;display:flex}.cn-statusbar__segment[data-v-040479fb]{white-space:nowrap}.cn-statusbar__zoom-trigger[data-v-040479fb]{font:inherit;color:inherit;font-variant-numeric:tabular-nums;cursor:pointer;background:0 0;border:0;padding:0}.cn-statusbar__zoom-trigger[data-v-040479fb]:hover{color:var(--cn-accent)}.cn-statusbar__help[data-v-040479fb]{font:inherit;color:inherit;cursor:pointer;background:0 0;border:0;padding:0}.cn-statusbar__help[data-v-040479fb]:hover,.cn-statusbar__segment--pending[data-v-040479fb]{color:var(--cn-accent)}.cn-statusbar__divider[data-v-040479fb]{background:var(--cn-line);width:1px;height:12px}.cn-help[data-v-486e5be3]{--cn-bg:#0b1220;--cn-bg-elevated:#101a2e;--cn-fg:#e6edf7;--cn-muted:#7c8ca5;--cn-line:#1e2a40;--cn-accent:#38bdf8;z-index:50;background:#0206178c;justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}.cn-help__panel[data-v-486e5be3]{background:var(--cn-bg-elevated);border:1px solid var(--cn-line);border-radius:12px;flex-direction:column;min-width:320px;max-width:480px;max-height:100%;display:flex;box-shadow:0 24px 64px #02061799}.cn-help__header[data-v-486e5be3]{border-bottom:1px solid var(--cn-line);justify-content:space-between;align-items:center;padding:12px 16px;display:flex}.cn-help__title[data-v-486e5be3]{color:var(--cn-fg);margin:0;font-size:14px;font-weight:600;line-height:1.4}.cn-help__close[data-v-486e5be3]{color:var(--cn-muted);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:2px 8px;font-size:13px;line-height:1.4}.cn-help__close[data-v-486e5be3]:hover{color:var(--cn-fg);background:#94a3b812}.cn-help__body[data-v-486e5be3]{padding:8px 16px 16px;overflow-y:auto}.cn-help__section[data-v-486e5be3]{margin-top:12px}.cn-help__section[data-v-486e5be3]:first-child{margin-top:8px}.cn-help__section-title[data-v-486e5be3]{color:var(--cn-accent);margin:0 0 4px;font-size:11px;font-weight:600;line-height:1.4}.cn-help__list[data-v-486e5be3]{margin:0;padding:0;list-style:none}.cn-help__row[data-v-486e5be3]{justify-content:space-between;align-items:baseline;gap:16px;padding:3px 0;display:flex}.cn-help__label[data-v-486e5be3]{color:var(--cn-fg);font-size:12px;line-height:1.5}.cn-help__keys[data-v-486e5be3]{border:1px solid var(--cn-line);color:var(--cn-muted);white-space:nowrap;background:#94a3b812;border-radius:5px;flex-shrink:0;padding:1px 6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.4}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { E as e, L as t, M as n, R as r, V as i, a, r as o, w as s } from "./layerPath-BRZK9ka1.js";
|
|
2
|
+
import { a as c, c as l, l as u, n as d, o as f, s as p, t as m, u as h } from "./completionAnchor-4lhR2kJz.js";
|
|
3
|
+
//#region ../canvas-editor/src/shared/expressionCandidates.ts
|
|
4
|
+
function g(e) {
|
|
5
|
+
return e.kind === "row" ? "row" : e.kind === "root" ? "$root" : e.name;
|
|
6
|
+
}
|
|
7
|
+
function _(e) {
|
|
8
|
+
let t = {};
|
|
9
|
+
return e.description !== void 0 && (t.description = e.description), e.title !== void 0 && (t.title = e.title), e.type !== void 0 && (t.type = e.type), t;
|
|
10
|
+
}
|
|
11
|
+
function v(e, t) {
|
|
12
|
+
return {
|
|
13
|
+
path: t === "" ? e.key : `${t}.${e.key}`,
|
|
14
|
+
segment: e.key,
|
|
15
|
+
..._(e.node)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function y(e, t, n) {
|
|
19
|
+
let r = u(e), i = r.entries.map((e) => v(e, ""));
|
|
20
|
+
return i.push({
|
|
21
|
+
path: "$root",
|
|
22
|
+
segment: "$root"
|
|
23
|
+
}), t === "row" && (i.push(n ? {
|
|
24
|
+
path: "row",
|
|
25
|
+
segment: "row",
|
|
26
|
+
..._(n)
|
|
27
|
+
} : {
|
|
28
|
+
path: "row",
|
|
29
|
+
segment: "row"
|
|
30
|
+
}), i.push({
|
|
31
|
+
path: "$index",
|
|
32
|
+
segment: "$index"
|
|
33
|
+
})), r.open === !0 ? {
|
|
34
|
+
candidates: i,
|
|
35
|
+
open: !0
|
|
36
|
+
} : { candidates: i };
|
|
37
|
+
}
|
|
38
|
+
function b(e, t) {
|
|
39
|
+
if (e === null) return {
|
|
40
|
+
ok: !0,
|
|
41
|
+
prefix: "",
|
|
42
|
+
partial: "",
|
|
43
|
+
candidates: []
|
|
44
|
+
};
|
|
45
|
+
let n = t.expr.endsWith("."), r = n ? t.expr.slice(0, -1) : t.expr;
|
|
46
|
+
if (r === "") return t.expr === "" ? {
|
|
47
|
+
ok: !0,
|
|
48
|
+
prefix: "",
|
|
49
|
+
partial: "",
|
|
50
|
+
...y(e, t.context, t.rowSchema)
|
|
51
|
+
} : {
|
|
52
|
+
ok: !1,
|
|
53
|
+
reason: "expression_syntax_error"
|
|
54
|
+
};
|
|
55
|
+
let i = p(r);
|
|
56
|
+
if (!i.ok) return {
|
|
57
|
+
ok: !1,
|
|
58
|
+
reason: "expression_syntax_error"
|
|
59
|
+
};
|
|
60
|
+
let { head: a, rest: o } = i, s, c;
|
|
61
|
+
if (n ? (s = [g(a), ...o], c = "") : o.length > 0 ? (s = [g(a), ...o.slice(0, -1)], c = o[o.length - 1]) : (s = [], c = g(a)), s.length === 0) return {
|
|
62
|
+
ok: !0,
|
|
63
|
+
prefix: "",
|
|
64
|
+
partial: c,
|
|
65
|
+
...y(e, t.context, t.rowSchema)
|
|
66
|
+
};
|
|
67
|
+
let l, d;
|
|
68
|
+
if (a.kind === "row") {
|
|
69
|
+
if (t.context !== "row") return {
|
|
70
|
+
ok: !0,
|
|
71
|
+
prefix: s.join("."),
|
|
72
|
+
partial: c,
|
|
73
|
+
candidates: []
|
|
74
|
+
};
|
|
75
|
+
l = t.rowSchema ?? null, d = s.slice(1);
|
|
76
|
+
} else if (a.kind === "root") l = e, d = s.slice(1);
|
|
77
|
+
else if (a.name === "$index") return {
|
|
78
|
+
ok: !0,
|
|
79
|
+
prefix: s.join("."),
|
|
80
|
+
partial: c,
|
|
81
|
+
candidates: []
|
|
82
|
+
};
|
|
83
|
+
else l = e, d = s;
|
|
84
|
+
let f = l === null ? null : h(l, d), m = s.join(".");
|
|
85
|
+
if (f === null) return {
|
|
86
|
+
ok: !0,
|
|
87
|
+
prefix: m,
|
|
88
|
+
partial: c,
|
|
89
|
+
candidates: []
|
|
90
|
+
};
|
|
91
|
+
let _ = u(f);
|
|
92
|
+
return {
|
|
93
|
+
ok: !0,
|
|
94
|
+
prefix: m,
|
|
95
|
+
partial: c,
|
|
96
|
+
candidates: _.entries.map((e) => v(e, m)),
|
|
97
|
+
..._.open === !0 ? { open: !0 } : {}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/shared/expressionContext.ts
|
|
102
|
+
function x(e, t, n) {
|
|
103
|
+
let r = null;
|
|
104
|
+
for (let i = 0; i < t.length; i += 1) {
|
|
105
|
+
if (t[i] !== "template") continue;
|
|
106
|
+
let o = a(e, t.slice(0, i));
|
|
107
|
+
if (o === null || o.type !== "TableLayer" || (r = l(r ?? n, o.rowsPath), r === null)) return null;
|
|
108
|
+
}
|
|
109
|
+
return r;
|
|
110
|
+
}
|
|
111
|
+
function S(e) {
|
|
112
|
+
return e[e.length - 1] === "content" && o(e);
|
|
113
|
+
}
|
|
114
|
+
function C(e, t, n) {
|
|
115
|
+
return e === null || t === null || n === null || !S(n) ? {
|
|
116
|
+
kind: "root",
|
|
117
|
+
rowSchema: null
|
|
118
|
+
} : {
|
|
119
|
+
kind: "row",
|
|
120
|
+
rowSchema: x(t, n, e)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function w(e, t) {
|
|
124
|
+
return e === null ? null : (n) => {
|
|
125
|
+
let r = b(e, {
|
|
126
|
+
context: t.kind,
|
|
127
|
+
expr: n,
|
|
128
|
+
rowSchema: t.rowSchema
|
|
129
|
+
});
|
|
130
|
+
return r.ok ? {
|
|
131
|
+
partial: r.partial,
|
|
132
|
+
candidates: r.candidates,
|
|
133
|
+
...r.open === !0 ? { open: !0 } : {}
|
|
134
|
+
} : null;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/shared/useExpressionCompletion.ts
|
|
139
|
+
var T = 4, E = [
|
|
140
|
+
"ArrowLeft",
|
|
141
|
+
"ArrowRight",
|
|
142
|
+
"Home",
|
|
143
|
+
"End",
|
|
144
|
+
"PageUp",
|
|
145
|
+
"PageDown"
|
|
146
|
+
];
|
|
147
|
+
function D(a) {
|
|
148
|
+
let o = r({
|
|
149
|
+
open: !1,
|
|
150
|
+
items: [],
|
|
151
|
+
activeIndex: 0,
|
|
152
|
+
top: 0,
|
|
153
|
+
left: 0,
|
|
154
|
+
openMapping: !1
|
|
155
|
+
}), l = null, u = !1, p = null;
|
|
156
|
+
function h() {
|
|
157
|
+
o.open = !1, o.items = [], o.activeIndex = 0, o.openMapping = !1, p = null;
|
|
158
|
+
}
|
|
159
|
+
function g() {
|
|
160
|
+
if (!o.open || !l) return;
|
|
161
|
+
let e = m(l, i(a.scale ?? 1));
|
|
162
|
+
o.top = e.bottom + T, o.left = _(e.left);
|
|
163
|
+
}
|
|
164
|
+
function _(e) {
|
|
165
|
+
let t = (a.popupEl ? i(a.popupEl) : null)?.offsetWidth ?? 0;
|
|
166
|
+
return t <= 0 ? e : Math.max(0, Math.min(e, window.innerWidth - 4 - t));
|
|
167
|
+
}
|
|
168
|
+
function v(e, t = !1) {
|
|
169
|
+
if (!i(a.enabled)) {
|
|
170
|
+
h();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let n = l;
|
|
174
|
+
if (!n) {
|
|
175
|
+
h();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
let r = n.value, u = n.selectionStart ?? r.length, d = c(f(r), u);
|
|
179
|
+
if (!d) {
|
|
180
|
+
h();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
let m = a.resolve(d.expr);
|
|
184
|
+
if (!m) {
|
|
185
|
+
h();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
let _ = t ? m.candidates : m.candidates.filter((e) => e.segment.startsWith(m.partial));
|
|
189
|
+
if (_.length === 0 && m.open !== !0) {
|
|
190
|
+
h();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
p = {
|
|
194
|
+
fragment: d,
|
|
195
|
+
partial: m.partial
|
|
196
|
+
}, (o.open || e) && (o.items = _, o.activeIndex = 0, o.openMapping = m.open === !0, o.open = !0, g(), s(g));
|
|
197
|
+
}
|
|
198
|
+
function y(e) {
|
|
199
|
+
let t = l;
|
|
200
|
+
if (!o.open || u || !t || !p) return;
|
|
201
|
+
let n = o.items[e ?? o.activeIndex];
|
|
202
|
+
if (!n) return;
|
|
203
|
+
let r = d(t.value, p.fragment, p.partial, n.segment);
|
|
204
|
+
if (!r) {
|
|
205
|
+
h();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
t.value = r.value, t.setSelectionRange(r.cursor, r.cursor), t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 })), h();
|
|
209
|
+
}
|
|
210
|
+
function b() {
|
|
211
|
+
return i(a.pairing ?? a.enabled);
|
|
212
|
+
}
|
|
213
|
+
function x(e) {
|
|
214
|
+
let t = e.selectionStart;
|
|
215
|
+
return t === null || t !== e.selectionEnd ? null : t;
|
|
216
|
+
}
|
|
217
|
+
let S = !1;
|
|
218
|
+
function C(e) {
|
|
219
|
+
if (S || !b()) return;
|
|
220
|
+
let t = l;
|
|
221
|
+
if (!t) return;
|
|
222
|
+
let n = e.inputType;
|
|
223
|
+
if (n !== void 0 && n !== "" && n !== "insertText") return;
|
|
224
|
+
let r = x(t);
|
|
225
|
+
if (r === null || r < 2) return;
|
|
226
|
+
let i = t.value;
|
|
227
|
+
i.startsWith("{{", r - 2) && (i.includes("}}", r) || (S = !0, t.value = `${i.slice(0, r)}}}${i.slice(r)}`, t.setSelectionRange(r, r), t.dispatchEvent(new Event("input", { bubbles: !0 })), S = !1));
|
|
228
|
+
}
|
|
229
|
+
function w(e) {
|
|
230
|
+
if (!b()) return !1;
|
|
231
|
+
let t = l;
|
|
232
|
+
if (!t) return !1;
|
|
233
|
+
let n = x(t);
|
|
234
|
+
if (n === null || n < 2) return !1;
|
|
235
|
+
let r = t.value;
|
|
236
|
+
return !r.startsWith("{{", n - 2) || !r.startsWith("}}", n) ? !1 : (e.preventDefault(), S = !0, t.value = r.slice(0, n - 2) + r.slice(n + 2), t.setSelectionRange(n - 2, n - 2), t.dispatchEvent(new Event("input", { bubbles: !0 })), S = !1, !0);
|
|
237
|
+
}
|
|
238
|
+
function D(e) {
|
|
239
|
+
if (!b()) return !1;
|
|
240
|
+
let t = l;
|
|
241
|
+
if (!t) return !1;
|
|
242
|
+
let n = x(t);
|
|
243
|
+
return n === null || t.value[n] !== "}" ? !1 : (e.preventDefault(), t.setSelectionRange(n + 1, n + 1), v(!1), !0);
|
|
244
|
+
}
|
|
245
|
+
function O(e) {
|
|
246
|
+
u || e.isComposing || (C(e), v(!0));
|
|
247
|
+
}
|
|
248
|
+
function k() {
|
|
249
|
+
u = !0;
|
|
250
|
+
}
|
|
251
|
+
function A() {
|
|
252
|
+
u = !1, v(!0);
|
|
253
|
+
}
|
|
254
|
+
function j(e) {
|
|
255
|
+
return u || e.isComposing || e.keyCode === 229;
|
|
256
|
+
}
|
|
257
|
+
function M(e) {
|
|
258
|
+
if (!j(e)) {
|
|
259
|
+
if (e.key === " " && (e.ctrlKey || e.metaKey)) {
|
|
260
|
+
e.preventDefault(), v(!0, !0);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (!(e.key === "Backspace" && w(e)) && !(e.key === "}" && D(e)) && o.open) {
|
|
264
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
let t = o.items.length;
|
|
267
|
+
t > 0 && (o.activeIndex = (o.activeIndex + (e.key === "ArrowDown" ? 1 : t - 1)) % t);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (e.key === "Enter" || e.key === "Tab") {
|
|
271
|
+
e.preventDefault(), y();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
e.key === "Escape" && (e.preventDefault(), h());
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function N(e) {
|
|
279
|
+
o.open && !j(e) && E.includes(e.key) && v(!1);
|
|
280
|
+
}
|
|
281
|
+
function P() {
|
|
282
|
+
u || v(!1);
|
|
283
|
+
}
|
|
284
|
+
function F() {
|
|
285
|
+
h();
|
|
286
|
+
}
|
|
287
|
+
function I(e) {
|
|
288
|
+
o.open && e.target !== l && h();
|
|
289
|
+
}
|
|
290
|
+
function L() {
|
|
291
|
+
g();
|
|
292
|
+
}
|
|
293
|
+
let R = [
|
|
294
|
+
["input", O],
|
|
295
|
+
["keydown", M],
|
|
296
|
+
["keyup", N],
|
|
297
|
+
["click", P],
|
|
298
|
+
["blur", F],
|
|
299
|
+
["compositionstart", k],
|
|
300
|
+
["compositionend", A]
|
|
301
|
+
];
|
|
302
|
+
function z(e) {
|
|
303
|
+
for (let [t, n] of R) e.addEventListener(t, n);
|
|
304
|
+
}
|
|
305
|
+
function B(e) {
|
|
306
|
+
for (let [t, n] of R) e.removeEventListener(t, n);
|
|
307
|
+
}
|
|
308
|
+
function V(e) {
|
|
309
|
+
l !== e && (l && B(l), l = e, e && z(e));
|
|
310
|
+
}
|
|
311
|
+
return e(() => V(a.target.value)), n(a.target, (e) => V(e)), n(() => i(a.enabled), (e) => {
|
|
312
|
+
e || h();
|
|
313
|
+
}), document.addEventListener("mousedown", I), window.addEventListener("scroll", L, !0), window.addEventListener("resize", L), t(() => {
|
|
314
|
+
l && B(l), document.removeEventListener("mousedown", I), window.removeEventListener("scroll", L, !0), window.removeEventListener("resize", L);
|
|
315
|
+
}), {
|
|
316
|
+
popup: o,
|
|
317
|
+
accept: y
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/shared/uploadFile.ts
|
|
322
|
+
async function O(e) {
|
|
323
|
+
return {
|
|
324
|
+
name: e.name,
|
|
325
|
+
mime: e.type,
|
|
326
|
+
bytes: new Uint8Array(await e.arrayBuffer())
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
330
|
+
export { C as i, D as n, w as r, O as t };
|