@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,237 @@
|
|
|
1
|
+
import { A as e, B as t, C as n, D as r, G as i, H as a, L as o, M as s, W as c, _ as l, b as u, d, g as f, k as p, m, p as h, u as g, v as _, w as v, z as y } from "./layerPath-BRZK9ka1.js";
|
|
2
|
+
import { l as b, n as x } from "./useTransientFeedback-gS9Xa9GY.js";
|
|
3
|
+
//#region src/shared/useDropdownMenu.ts
|
|
4
|
+
function S(e) {
|
|
5
|
+
let t = y(!1);
|
|
6
|
+
function n(n) {
|
|
7
|
+
let r = e.container.value, i = n.target;
|
|
8
|
+
r !== null && i instanceof Node && r.contains(i) || (t.value = !1);
|
|
9
|
+
}
|
|
10
|
+
function r(e) {
|
|
11
|
+
e.key === "Escape" && (t.value = !1);
|
|
12
|
+
}
|
|
13
|
+
function i() {
|
|
14
|
+
window.removeEventListener("pointerdown", n), window.removeEventListener("keydown", r);
|
|
15
|
+
}
|
|
16
|
+
return s(t, (e) => {
|
|
17
|
+
e ? (window.addEventListener("pointerdown", n), window.addEventListener("keydown", r)) : i();
|
|
18
|
+
}), o(i, !0), {
|
|
19
|
+
open: t,
|
|
20
|
+
toggle: () => {
|
|
21
|
+
t.value = !t.value;
|
|
22
|
+
},
|
|
23
|
+
openMenu: () => {
|
|
24
|
+
t.value = !0;
|
|
25
|
+
},
|
|
26
|
+
closeMenu: () => {
|
|
27
|
+
t.value = !1;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function C(e, t, n) {
|
|
32
|
+
let r = e.length;
|
|
33
|
+
if (r === 0) return -1;
|
|
34
|
+
if (n === "Home" || n === "End") {
|
|
35
|
+
for (let t = 0; t < r; t++) {
|
|
36
|
+
let i = n === "Home" ? t : r - 1 - t;
|
|
37
|
+
if (e[i]) return i;
|
|
38
|
+
}
|
|
39
|
+
return -1;
|
|
40
|
+
}
|
|
41
|
+
let i = n === "ArrowDown" ? 1 : -1, a = t === -1 ? i === 1 ? -1 : r : t;
|
|
42
|
+
for (let t = 0; t < r; t++) if (a = (a + i + r) % r, e[a]) return a;
|
|
43
|
+
return -1;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/shared/DropdownMenu.vue?vue&type=script&setup=true&lang.ts
|
|
47
|
+
var w = ["aria-expanded", "title"], T = ["aria-label"], E = {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "cn-dropdown__separator",
|
|
50
|
+
role: "separator",
|
|
51
|
+
"data-dropdown-separator": "",
|
|
52
|
+
"aria-hidden": "true"
|
|
53
|
+
}, D = [
|
|
54
|
+
"disabled",
|
|
55
|
+
"title",
|
|
56
|
+
"onClick"
|
|
57
|
+
], O = { class: "cn-dropdown__item-label" }, k = {
|
|
58
|
+
key: 0,
|
|
59
|
+
class: "cn-dropdown__shortcut"
|
|
60
|
+
}, A = 6, j = 2, M = /*#__PURE__*/ b(/* @__PURE__ */ u({
|
|
61
|
+
__name: "DropdownMenu",
|
|
62
|
+
props: {
|
|
63
|
+
label: {},
|
|
64
|
+
items: {},
|
|
65
|
+
title: {},
|
|
66
|
+
direction: { default: "down" }
|
|
67
|
+
},
|
|
68
|
+
emits: ["closed"],
|
|
69
|
+
setup(t, { emit: o }) {
|
|
70
|
+
let u = t, h = o, b = y(null), M = y(null), N = y(null), { open: P, toggle: F, closeMenu: I } = S({ container: b });
|
|
71
|
+
s(P, (e) => {
|
|
72
|
+
e || h("closed");
|
|
73
|
+
});
|
|
74
|
+
let L = y({
|
|
75
|
+
left: 0,
|
|
76
|
+
edge: "top",
|
|
77
|
+
offset: 0
|
|
78
|
+
});
|
|
79
|
+
function R() {
|
|
80
|
+
M.value?.focus();
|
|
81
|
+
}
|
|
82
|
+
function z(e) {
|
|
83
|
+
M.value = e instanceof HTMLElement ? e : null;
|
|
84
|
+
}
|
|
85
|
+
async function B() {
|
|
86
|
+
if (await v(), !P.value) return;
|
|
87
|
+
let e = N.value;
|
|
88
|
+
e !== null && (e.querySelector("[data-dropdown-item]:not([disabled])") ?? e).focus();
|
|
89
|
+
}
|
|
90
|
+
function V() {
|
|
91
|
+
return u.items.filter((e) => e !== "separator");
|
|
92
|
+
}
|
|
93
|
+
function H() {
|
|
94
|
+
return Array.from(N.value?.querySelectorAll("[data-dropdown-item]") ?? []);
|
|
95
|
+
}
|
|
96
|
+
function U(e) {
|
|
97
|
+
e.run(), e.keepsOpen !== !0 && (I(), R());
|
|
98
|
+
}
|
|
99
|
+
function W(e) {
|
|
100
|
+
let t = N.value;
|
|
101
|
+
if (t === null) return;
|
|
102
|
+
let n = H(), r = C(n.map((e) => !e.hasAttribute("disabled")), document.activeElement instanceof HTMLElement ? n.indexOf(document.activeElement) : -1, e);
|
|
103
|
+
if (r === -1) {
|
|
104
|
+
t.focus();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
n[r]?.focus();
|
|
108
|
+
}
|
|
109
|
+
function G(e) {
|
|
110
|
+
let t = V()[H().indexOf(e)];
|
|
111
|
+
t !== void 0 && !t.disabled && U(t);
|
|
112
|
+
}
|
|
113
|
+
function K(e) {
|
|
114
|
+
let t = e.key;
|
|
115
|
+
if (t === "Escape" || t === "Tab") {
|
|
116
|
+
if (t === "Tab") {
|
|
117
|
+
let t = e.target;
|
|
118
|
+
if (t instanceof HTMLElement && !t.matches("[data-dropdown-item]") && x(t)) return;
|
|
119
|
+
}
|
|
120
|
+
I(), R();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (t === "Enter" || t === " ") {
|
|
124
|
+
let t = e.target;
|
|
125
|
+
t instanceof HTMLElement && t.matches("[data-dropdown-item]") && (e.preventDefault(), G(t));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (t === "ArrowDown" || t === "ArrowUp" || t === "Home" || t === "End") {
|
|
129
|
+
let n = e.target;
|
|
130
|
+
if (n instanceof HTMLElement && !n.matches("[data-dropdown-item]") && x(n)) return;
|
|
131
|
+
e.preventDefault(), W(t);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function q(e) {
|
|
135
|
+
if (e.key === "ArrowDown") {
|
|
136
|
+
if (e.preventDefault(), !P.value) {
|
|
137
|
+
J();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
B();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function J() {
|
|
144
|
+
if (!P.value) {
|
|
145
|
+
let e = M.value?.getBoundingClientRect();
|
|
146
|
+
e && (L.value = u.direction === "up" ? {
|
|
147
|
+
left: e.left,
|
|
148
|
+
edge: "bottom",
|
|
149
|
+
offset: window.innerHeight - e.top + A
|
|
150
|
+
} : {
|
|
151
|
+
left: e.left,
|
|
152
|
+
edge: "top",
|
|
153
|
+
offset: e.bottom + A
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (F(), !P.value) {
|
|
157
|
+
R();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
await v();
|
|
161
|
+
let e = N.value?.getBoundingClientRect();
|
|
162
|
+
if (!e) return;
|
|
163
|
+
let t = L.value;
|
|
164
|
+
L.value = {
|
|
165
|
+
left: Math.max(j, Math.min(t.left, window.innerWidth - e.width - j)),
|
|
166
|
+
edge: t.edge,
|
|
167
|
+
offset: Math.max(j, Math.min(t.offset, window.innerHeight - e.height - j))
|
|
168
|
+
}, B();
|
|
169
|
+
}
|
|
170
|
+
return (o, s) => (r(), l("div", {
|
|
171
|
+
ref_key: "container",
|
|
172
|
+
ref: b,
|
|
173
|
+
class: "cn-dropdown"
|
|
174
|
+
}, [e(o.$slots, "trigger", {
|
|
175
|
+
open: a(P),
|
|
176
|
+
toggle: J,
|
|
177
|
+
closeMenu: a(I),
|
|
178
|
+
triggerRef: z,
|
|
179
|
+
onKeydown: q
|
|
180
|
+
}, () => [m("button", {
|
|
181
|
+
ref: z,
|
|
182
|
+
type: "button",
|
|
183
|
+
class: "cn-dropdown__trigger",
|
|
184
|
+
"data-dropdown-trigger": "",
|
|
185
|
+
"aria-haspopup": "menu",
|
|
186
|
+
"aria-expanded": a(P),
|
|
187
|
+
title: t.title ?? t.label,
|
|
188
|
+
onClick: s[0] ||= (e) => J(),
|
|
189
|
+
onKeydown: q
|
|
190
|
+
}, [_(i(t.label) + " ", 1), s[2] ||= m("span", {
|
|
191
|
+
class: "cn-dropdown__caret",
|
|
192
|
+
"aria-hidden": "true"
|
|
193
|
+
}, "▾", -1)], 40, w)], !0), a(P) ? (r(), l("div", {
|
|
194
|
+
key: 0,
|
|
195
|
+
ref_key: "menuEl",
|
|
196
|
+
ref: N,
|
|
197
|
+
class: "cn-dropdown__menu",
|
|
198
|
+
role: "menu",
|
|
199
|
+
"aria-label": t.label,
|
|
200
|
+
"data-dropdown-menu": "",
|
|
201
|
+
tabindex: "-1",
|
|
202
|
+
style: c(L.value.edge === "top" ? {
|
|
203
|
+
left: `${L.value.left}px`,
|
|
204
|
+
top: `${L.value.offset}px`
|
|
205
|
+
} : {
|
|
206
|
+
left: `${L.value.left}px`,
|
|
207
|
+
bottom: `${L.value.offset}px`
|
|
208
|
+
}),
|
|
209
|
+
onKeydown: s[1] ||= g((e) => K(e), ["stop"])
|
|
210
|
+
}, [(r(!0), l(d, null, p(t.items, (e, t) => (r(), l(d, { key: t }, [e === "separator" ? (r(), l("div", E)) : (r(), l("button", n({
|
|
211
|
+
key: 1,
|
|
212
|
+
type: "button",
|
|
213
|
+
role: "menuitem",
|
|
214
|
+
class: "cn-dropdown__item",
|
|
215
|
+
"data-dropdown-item": "",
|
|
216
|
+
tabindex: "-1",
|
|
217
|
+
disabled: e.disabled,
|
|
218
|
+
title: e.title
|
|
219
|
+
}, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => U(e) }), [m("span", O, i(e.label), 1), e.shortcut ? (r(), l("span", k, i(e.shortcut), 1)) : f("", !0)], 16, D))], 64))), 128)), e(o.$slots, "body", {
|
|
220
|
+
open: a(P),
|
|
221
|
+
toggle: J,
|
|
222
|
+
closeMenu: a(I),
|
|
223
|
+
triggerRef: z,
|
|
224
|
+
onKeydown: q
|
|
225
|
+
}, void 0, !0)], 44, T)) : f("", !0)], 512));
|
|
226
|
+
}
|
|
227
|
+
}), [["__scopeId", "data-v-ec8a19c1"]]);
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/shared/useDataSourceSchema.ts
|
|
230
|
+
function N(e) {
|
|
231
|
+
let n = t(e.store.ui.dataSourceSchema), r = e.subscribe((t) => {
|
|
232
|
+
t.scope === "ui" && t.branch === "dataSourceSchema" && (n.value = e.store.ui.dataSourceSchema);
|
|
233
|
+
});
|
|
234
|
+
return o(r, !0), h(() => n.value);
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
export { M as n, S as r, N as t };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { E as e, L as t, M as n, R as r, V as i, a, w as o } from "./layerPath-BRZK9ka1.js";
|
|
2
|
+
import { c as s, n as c, t as l, u } from "./completionAnchor-4lhR2kJz.js";
|
|
3
|
+
//#region ../canvas-editor/src/shared/rowsPathCandidates.ts
|
|
4
|
+
function d(e) {
|
|
5
|
+
return e.type === "array" || e.items !== void 0;
|
|
6
|
+
}
|
|
7
|
+
function f(e) {
|
|
8
|
+
return !d(e) && e.properties === void 0 && e.open !== !0;
|
|
9
|
+
}
|
|
10
|
+
function p(e, t, n) {
|
|
11
|
+
let r = {
|
|
12
|
+
path: n === "" ? e : `${n}.${e}`,
|
|
13
|
+
segment: e
|
|
14
|
+
};
|
|
15
|
+
return t.description !== void 0 && (r.description = t.description), t.title !== void 0 && (r.title = t.title), d(t) && (r.type = "array"), r;
|
|
16
|
+
}
|
|
17
|
+
function m(e, t) {
|
|
18
|
+
let n = [];
|
|
19
|
+
if (e.properties !== void 0) for (let [r, i] of e.properties) f(i) || n.push(p(r, i, t));
|
|
20
|
+
return e.open === !0 ? {
|
|
21
|
+
candidates: n,
|
|
22
|
+
open: !0
|
|
23
|
+
} : { candidates: n };
|
|
24
|
+
}
|
|
25
|
+
function h(e, t) {
|
|
26
|
+
if (e === null) return null;
|
|
27
|
+
let n = t.split("."), r = t.endsWith(".") ? "" : n[n.length - 1], i = n.slice(0, -1), a = e;
|
|
28
|
+
for (let e of i) {
|
|
29
|
+
if (d(a)) return null;
|
|
30
|
+
let t = u(a, [e]);
|
|
31
|
+
if (t === null) return null;
|
|
32
|
+
a = t;
|
|
33
|
+
}
|
|
34
|
+
if (d(a) || f(a)) return null;
|
|
35
|
+
let o = m(a, i.join("."));
|
|
36
|
+
return {
|
|
37
|
+
partial: r,
|
|
38
|
+
candidates: o.candidates,
|
|
39
|
+
...o.open === !0 ? { open: !0 } : {}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function g(e, t, n) {
|
|
43
|
+
if (n === null) return null;
|
|
44
|
+
if (e === null || t === null) return n;
|
|
45
|
+
let r = null;
|
|
46
|
+
for (let i = 0; i < t.length; i += 1) {
|
|
47
|
+
if (t[i] !== "template") continue;
|
|
48
|
+
let o = a(e, t.slice(0, i));
|
|
49
|
+
if (o === null || o.type !== "TableLayer" || (r = s(r ?? n, o.rowsPath), r === null)) return null;
|
|
50
|
+
}
|
|
51
|
+
return r ?? n;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/shared/rowsPathCompletionSource.ts
|
|
55
|
+
function _(e) {
|
|
56
|
+
return e === null ? null : (t) => {
|
|
57
|
+
let n = h(e, t);
|
|
58
|
+
return n === null ? null : {
|
|
59
|
+
partial: n.partial,
|
|
60
|
+
candidates: n.candidates.map((e) => e.type === "array" ? {
|
|
61
|
+
...e,
|
|
62
|
+
type: "行数组"
|
|
63
|
+
} : e),
|
|
64
|
+
...n.open === !0 ? { open: !0 } : {}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/shared/usePathCompletion.ts
|
|
70
|
+
var v = 4, y = 4, b = [
|
|
71
|
+
"ArrowLeft",
|
|
72
|
+
"ArrowRight",
|
|
73
|
+
"Home",
|
|
74
|
+
"End",
|
|
75
|
+
"PageUp",
|
|
76
|
+
"PageDown"
|
|
77
|
+
];
|
|
78
|
+
function x(e) {
|
|
79
|
+
return {
|
|
80
|
+
kind: "fragment",
|
|
81
|
+
start: -2,
|
|
82
|
+
end: e.length + 2,
|
|
83
|
+
raw: "",
|
|
84
|
+
expr: e,
|
|
85
|
+
error: null
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function S(a) {
|
|
89
|
+
let s = r({
|
|
90
|
+
open: !1,
|
|
91
|
+
items: [],
|
|
92
|
+
activeIndex: 0,
|
|
93
|
+
top: 0,
|
|
94
|
+
left: 0,
|
|
95
|
+
openMapping: !1
|
|
96
|
+
}), u = null, d = !1, f = "";
|
|
97
|
+
function p() {
|
|
98
|
+
s.open = !1, s.items = [], s.activeIndex = 0, s.openMapping = !1, f = "";
|
|
99
|
+
}
|
|
100
|
+
function m() {
|
|
101
|
+
if (!s.open || !u) return;
|
|
102
|
+
let e = l(u);
|
|
103
|
+
s.top = e.bottom + v, s.left = h(e.left);
|
|
104
|
+
}
|
|
105
|
+
function h(e) {
|
|
106
|
+
let t = (a.popupEl ? i(a.popupEl) : null)?.offsetWidth ?? 0;
|
|
107
|
+
return t <= 0 ? e : Math.max(0, Math.min(e, window.innerWidth - y - t));
|
|
108
|
+
}
|
|
109
|
+
function g(e, t = !1) {
|
|
110
|
+
if (!i(a.enabled)) {
|
|
111
|
+
p();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
let n = u;
|
|
115
|
+
if (!n) {
|
|
116
|
+
p();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let r = n.value.slice(0, n.selectionStart ?? n.value.length);
|
|
120
|
+
if (r === "" && !t) {
|
|
121
|
+
p();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
let c = a.resolve(r);
|
|
125
|
+
if (!c) {
|
|
126
|
+
p();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
let l = t ? c.candidates : c.candidates.filter((e) => e.segment.startsWith(c.partial));
|
|
130
|
+
if (l.length === 0 && c.open !== !0) {
|
|
131
|
+
p();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
f = c.partial, (s.open || e) && (s.items = l, s.activeIndex = 0, s.openMapping = c.open === !0, s.open = !0, m(), o(m));
|
|
135
|
+
}
|
|
136
|
+
function _(e) {
|
|
137
|
+
let t = u;
|
|
138
|
+
if (!s.open || d || !t) return;
|
|
139
|
+
let n = s.items[e ?? s.activeIndex];
|
|
140
|
+
if (!n) return;
|
|
141
|
+
let r = t.value.slice(0, t.selectionStart ?? t.value.length), i = c(t.value, x(r), f, n.segment);
|
|
142
|
+
if (!i) {
|
|
143
|
+
p();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
t.value = i.value, t.setSelectionRange(i.cursor, i.cursor), t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 })), p();
|
|
147
|
+
}
|
|
148
|
+
function S(e) {
|
|
149
|
+
d || e.isComposing || g(!0);
|
|
150
|
+
}
|
|
151
|
+
function C() {
|
|
152
|
+
d = !0;
|
|
153
|
+
}
|
|
154
|
+
function w() {
|
|
155
|
+
d = !1, g(!0);
|
|
156
|
+
}
|
|
157
|
+
function T(e) {
|
|
158
|
+
return d || e.isComposing || e.keyCode === 229;
|
|
159
|
+
}
|
|
160
|
+
function E(e) {
|
|
161
|
+
if (!T(e)) {
|
|
162
|
+
if (e.key === " " && (e.ctrlKey || e.metaKey)) {
|
|
163
|
+
e.preventDefault(), g(!0, !0);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (s.open) {
|
|
167
|
+
if (s.items.length === 0) {
|
|
168
|
+
e.key === "Escape" && (e.preventDefault(), p());
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
let t = s.items.length;
|
|
174
|
+
t > 0 && (s.activeIndex = (s.activeIndex + (e.key === "ArrowDown" ? 1 : t - 1)) % t);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (e.key === "Enter" || e.key === "Tab") {
|
|
178
|
+
e.preventDefault(), _();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
e.key === "Escape" && (e.preventDefault(), p());
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function D(e) {
|
|
186
|
+
s.open && !T(e) && b.includes(e.key) && g(!1);
|
|
187
|
+
}
|
|
188
|
+
function O() {
|
|
189
|
+
d || g(!1);
|
|
190
|
+
}
|
|
191
|
+
function k() {
|
|
192
|
+
p();
|
|
193
|
+
}
|
|
194
|
+
function A(e) {
|
|
195
|
+
s.open && e.target !== u && p();
|
|
196
|
+
}
|
|
197
|
+
function j() {
|
|
198
|
+
m();
|
|
199
|
+
}
|
|
200
|
+
let M = [
|
|
201
|
+
["input", S],
|
|
202
|
+
["keydown", E],
|
|
203
|
+
["keyup", D],
|
|
204
|
+
["click", O],
|
|
205
|
+
["blur", k],
|
|
206
|
+
["compositionstart", C],
|
|
207
|
+
["compositionend", w]
|
|
208
|
+
];
|
|
209
|
+
function N(e) {
|
|
210
|
+
for (let [t, n] of M) e.addEventListener(t, n);
|
|
211
|
+
}
|
|
212
|
+
function P(e) {
|
|
213
|
+
for (let [t, n] of M) e.removeEventListener(t, n);
|
|
214
|
+
}
|
|
215
|
+
function F(e) {
|
|
216
|
+
u !== e && (u && P(u), u = e, e && N(e));
|
|
217
|
+
}
|
|
218
|
+
return e(() => F(a.target.value)), n(a.target, (e) => F(e)), n(() => i(a.enabled), (e) => {
|
|
219
|
+
e || p();
|
|
220
|
+
}), document.addEventListener("mousedown", A), window.addEventListener("scroll", j, !0), window.addEventListener("resize", j), t(() => {
|
|
221
|
+
u && P(u), document.removeEventListener("mousedown", A), window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j);
|
|
222
|
+
}), {
|
|
223
|
+
popup: s,
|
|
224
|
+
accept: _
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
export { _ as n, g as r, S as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z as e } from "./layerPath-BRZK9ka1.js";
|
|
2
|
+
//#region src/shared/useShortcutsHelp.ts
|
|
3
|
+
var t = e(!1);
|
|
4
|
+
function n() {
|
|
5
|
+
return {
|
|
6
|
+
open: t,
|
|
7
|
+
show: () => {
|
|
8
|
+
t.value = !0;
|
|
9
|
+
},
|
|
10
|
+
close: () => {
|
|
11
|
+
t.value = !1;
|
|
12
|
+
},
|
|
13
|
+
toggle: () => {
|
|
14
|
+
t.value = !t.value;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as t };
|