@hankchen/canvas-editor-vue 0.5.0 → 0.6.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/dist/{canvas-CX1RdlFC.js → canvas-CptBzpwT.js} +7 -7
- package/dist/canvas.js +1 -1
- package/dist/index.js +12 -12
- package/dist/layer-panel/addMenu.d.ts +46 -14
- package/dist/layer-panel/index.d.ts +3 -2
- package/dist/{layer-panel-kOceTf8H.js → layer-panel-Cz-tmbJJ.js} +192 -192
- package/dist/layer-panel.js +1 -1
- package/dist/{property-panel-B32ZBQdf.js → property-panel-OBqd6D8W.js} +326 -322
- package/dist/property-panel.js +2 -2
- package/dist/shared/index.d.ts +10 -3
- package/dist/shared/shortcutsHelp.d.ts +4 -1
- package/dist/shared/useDataSourceSchema.d.ts +3 -1
- package/dist/shared/useDropdownMenu.d.ts +107 -2
- package/dist/shared/useExpressionDiagnostics.d.ts +11 -0
- package/dist/shared.js +7 -7
- package/dist/{status-bar-_PvEXyq8.js → status-bar-DCuK2R88.js} +67 -65
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{uploadFile-D1RY-ji0.js → uploadFile-DbB-KhII.js} +11 -7
- package/dist/useDataSourceSchema-CG9EGzwc.js +464 -0
- package/package.json +2 -2
- package/dist/useDataSourceSchema-CGbldbUj.js +0 -237
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { n as e, u as t } from "./useTransientFeedback-CTjmMmFF.js";
|
|
2
|
-
import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeProps as l, nextTick as u, normalizeStyle as d, onScopeDispose as f, openBlock as p, ref as m, renderList as h, renderSlot as g, shallowRef as _, toDisplayString as v, unref as y, watch as b, withModifiers as x } from "vue";
|
|
3
|
-
//#region src/shared/useDropdownMenu.ts
|
|
4
|
-
function S(e) {
|
|
5
|
-
let t = m(!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 b(t, (e) => {
|
|
17
|
-
e ? (window.addEventListener("pointerdown", n), window.addEventListener("keydown", r)) : i();
|
|
18
|
-
}), f(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__*/ t(/* @__PURE__ */ c({
|
|
61
|
-
__name: "DropdownMenu",
|
|
62
|
-
props: {
|
|
63
|
-
label: {},
|
|
64
|
-
items: {},
|
|
65
|
-
title: {},
|
|
66
|
-
direction: { default: "down" }
|
|
67
|
-
},
|
|
68
|
-
emits: ["closed"],
|
|
69
|
-
setup(t, { emit: r }) {
|
|
70
|
-
let c = t, f = r, _ = m(null), M = m(null), N = m(null), { open: P, toggle: F, closeMenu: I } = S({ container: _ });
|
|
71
|
-
b(P, (e) => {
|
|
72
|
-
e || f("closed");
|
|
73
|
-
});
|
|
74
|
-
let L = m({
|
|
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 u(), !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 c.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(t) {
|
|
114
|
-
let n = t.key;
|
|
115
|
-
if (n === "Escape" || n === "Tab") {
|
|
116
|
-
if (n === "Tab") {
|
|
117
|
-
let n = t.target;
|
|
118
|
-
if (n instanceof HTMLElement && !n.matches("[data-dropdown-item]") && e(n)) return;
|
|
119
|
-
}
|
|
120
|
-
I(), R();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (n === "Enter" || n === " ") {
|
|
124
|
-
let e = t.target;
|
|
125
|
-
e instanceof HTMLElement && e.matches("[data-dropdown-item]") && (t.preventDefault(), G(e));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (n === "ArrowDown" || n === "ArrowUp" || n === "Home" || n === "End") {
|
|
129
|
-
let r = t.target;
|
|
130
|
-
if (r instanceof HTMLElement && !r.matches("[data-dropdown-item]") && e(r)) return;
|
|
131
|
-
t.preventDefault(), W(n);
|
|
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 = c.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 u();
|
|
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 (e, r) => (p(), a("div", {
|
|
171
|
-
ref_key: "container",
|
|
172
|
-
ref: _,
|
|
173
|
-
class: "cn-dropdown"
|
|
174
|
-
}, [g(e.$slots, "trigger", {
|
|
175
|
-
open: y(P),
|
|
176
|
-
toggle: J,
|
|
177
|
-
closeMenu: y(I),
|
|
178
|
-
triggerRef: z,
|
|
179
|
-
onKeydown: q
|
|
180
|
-
}, () => [o("button", {
|
|
181
|
-
ref: z,
|
|
182
|
-
type: "button",
|
|
183
|
-
class: "cn-dropdown__trigger",
|
|
184
|
-
"data-dropdown-trigger": "",
|
|
185
|
-
"aria-haspopup": "menu",
|
|
186
|
-
"aria-expanded": y(P),
|
|
187
|
-
title: t.title ?? t.label,
|
|
188
|
-
onClick: r[0] ||= (e) => J(),
|
|
189
|
-
onKeydown: q
|
|
190
|
-
}, [s(v(t.label) + " ", 1), r[2] ||= o("span", {
|
|
191
|
-
class: "cn-dropdown__caret",
|
|
192
|
-
"aria-hidden": "true"
|
|
193
|
-
}, "▾", -1)], 40, w)], !0), y(P) ? (p(), a("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: d(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: r[1] ||= x((e) => K(e), ["stop"])
|
|
210
|
-
}, [(p(!0), a(n, null, h(t.items, (e, t) => (p(), a(n, { key: t }, [e === "separator" ? (p(), a("div", E)) : (p(), a("button", l({
|
|
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) }), [o("span", O, v(e.label), 1), e.shortcut ? (p(), a("span", k, v(e.shortcut), 1)) : i("", !0)], 16, D))], 64))), 128)), g(e.$slots, "body", {
|
|
220
|
-
open: y(P),
|
|
221
|
-
toggle: J,
|
|
222
|
-
closeMenu: y(I),
|
|
223
|
-
triggerRef: z,
|
|
224
|
-
onKeydown: q
|
|
225
|
-
}, void 0, !0)], 44, T)) : i("", !0)], 512));
|
|
226
|
-
}
|
|
227
|
-
}), [["__scopeId", "data-v-ec8a19c1"]]);
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/shared/useDataSourceSchema.ts
|
|
230
|
-
function N(e) {
|
|
231
|
-
let t = _(e.store.ui.dataSourceSchema), n = e.subscribe((n) => {
|
|
232
|
-
n.scope === "ui" && n.branch === "dataSourceSchema" && (t.value = e.store.ui.dataSourceSchema);
|
|
233
|
-
});
|
|
234
|
-
return f(n, !0), r(() => t.value);
|
|
235
|
-
}
|
|
236
|
-
//#endregion
|
|
237
|
-
export { M as n, S as r, N as t };
|