@hankchen/canvas-editor-vue 0.6.0 → 0.7.0

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 (37) hide show
  1. package/dist/{useDataSourceSchema-YV8g-lo0.js → DropdownMenu-CeUNKMDQ.js} +70 -78
  2. package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
  3. package/dist/{canvas-CX1RdlFC.js → canvas-D3fFnBqG.js} +526 -527
  4. package/dist/canvas.js +1 -1
  5. package/dist/index.js +14 -15
  6. package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
  7. package/dist/{layer-panel-Cd1e8xNB.js → layer-panel-BouAYiDq.js} +231 -257
  8. package/dist/layer-panel.js +1 -1
  9. package/dist/property-panel/PropertyField.d.ts +9 -2
  10. package/dist/property-panel/fieldSchema.d.ts +16 -10
  11. package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
  12. package/dist/property-panel/fields/index.d.ts +1 -0
  13. package/dist/property-panel/usePropertyPanel.d.ts +11 -2
  14. package/dist/{property-panel-B32ZBQdf.js → property-panel-DJQJzioT.js} +403 -341
  15. package/dist/property-panel.js +2 -2
  16. package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
  17. package/dist/shared/ExpressionPathPicker.d.ts +9 -2
  18. package/dist/shared/index.d.ts +13 -10
  19. package/dist/shared/pathPickerModel.d.ts +16 -3
  20. package/dist/shared/popupPosition.d.ts +2 -2
  21. package/dist/shared/rowsPathPickerSource.d.ts +15 -0
  22. package/dist/shared/useDataSourceSchema.d.ts +9 -1
  23. package/dist/shared/useExpressionDiagnostics.d.ts +11 -0
  24. package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
  25. package/dist/shared.js +9 -10
  26. package/dist/{status-bar-XMVbRLY9.js → status-bar-DBf5kIXY.js} +69 -67
  27. package/dist/status-bar.js +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/uploadFile-mXJVPEzm.js +653 -0
  30. package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
  31. package/package.json +2 -2
  32. package/dist/popupPosition-Ck5Gsvjy.js +0 -526
  33. package/dist/resourceTemplate-cdcQtp9a.js +0 -246
  34. package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
  35. package/dist/shared/usePathCompletion.d.ts +0 -18
  36. package/dist/uploadFile-D1RY-ji0.js +0 -516
  37. package/dist/usePathCompletion-Do17CQ6l.js +0 -220
@@ -1,11 +1,11 @@
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, normalizeClass as d, normalizeStyle as f, onScopeDispose as p, openBlock as m, ref as h, renderList as g, renderSlot as _, shallowRef as v, toDisplayString as y, unref as b, watch as x, withModifiers as ee } from "vue";
1
+ import { n as e, p as t } from "./useTransientFeedback-BN_O7V2w.js";
2
+ import { Fragment as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, mergeProps as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onScopeDispose as f, openBlock as p, ref as m, renderList as h, renderSlot as g, shallowRef as ee, toDisplayString as _, unref as v, watch as y, withModifiers as te } from "vue";
3
3
  //#region src/shared/useDropdownMenu.ts
4
- function S(e) {
4
+ function b(e) {
5
5
  return e !== "separator" && "kind" in e && e.kind === "submenu";
6
6
  }
7
- function C(e) {
8
- let t = h(!1);
7
+ function x(e) {
8
+ let t = m(!1);
9
9
  function n(n) {
10
10
  let r = e.container.value, i = n.target;
11
11
  r !== null && i instanceof Node && r.contains(i) || (t.value = !1);
@@ -16,9 +16,9 @@ function C(e) {
16
16
  function i() {
17
17
  window.removeEventListener("pointerdown", n), window.removeEventListener("keydown", r);
18
18
  }
19
- return x(t, (e) => {
19
+ return y(t, (e) => {
20
20
  e ? (window.addEventListener("pointerdown", n), window.addEventListener("keydown", r)) : i();
21
- }), p(i, !0), {
21
+ }), f(i, !0), {
22
22
  open: t,
23
23
  toggle: () => {
24
24
  t.value = !t.value;
@@ -31,7 +31,7 @@ function C(e) {
31
31
  }
32
32
  };
33
33
  }
34
- function w(e, t, n) {
34
+ function S(e, t, n) {
35
35
  let r = e.length;
36
36
  if (r === 0) return -1;
37
37
  if (n === "Home" || n === "End") {
@@ -45,10 +45,10 @@ function w(e, t, n) {
45
45
  for (let t = 0; t < r; t++) if (a = (a + i + r) % r, e[a]) return a;
46
46
  return -1;
47
47
  }
48
- function T(e, t) {
48
+ function C(e, t) {
49
49
  return t.type === "close" || t.target === void 0 ? null : t.type === "open" ? t.target : e === t.target ? null : t.target;
50
50
  }
51
- function te(e) {
51
+ function ne(e) {
52
52
  let { anchor: t, flyoutWidth: n, flyoutHeight: r, viewportWidth: i, viewportHeight: a } = e, o = e.gap ?? 6, s = e.margin ?? 2, c = n > 0 && t.right + o + n > i - s ? "left" : "right", l = c === "right" ? t.right + o : t.left - o - n;
53
53
  n > 0 && (l = Math.max(s, Math.min(l, i - s - n)));
54
54
  let u = t.top;
@@ -58,24 +58,24 @@ function te(e) {
58
58
  side: c
59
59
  };
60
60
  }
61
- function ne(e) {
61
+ function re(e) {
62
62
  return e === "ArrowDown" || e === "ArrowUp" || e === "Home" || e === "End" ? {
63
63
  type: "move",
64
64
  key: e
65
65
  } : e === "ArrowLeft" || e === "Escape" ? { type: "close" } : e === "Enter" || e === " " ? { type: "activate" } : e === "Tab" ? { type: "close-menu" } : { type: "none" };
66
66
  }
67
- function E(e, t) {
67
+ function w(e, t) {
68
68
  return e.find((e) => !e.hasAttribute("disabled")) ?? t;
69
69
  }
70
- function D(e) {
70
+ function T(e) {
71
71
  return e?.closest("[data-dropdown-submenu-host]")?.querySelector("[data-dropdown-submenu-arrow]") ?? null;
72
72
  }
73
- function O(e) {
73
+ function E(e) {
74
74
  return e;
75
75
  }
76
76
  //#endregion
77
77
  //#region src/shared/DropdownMenu.vue?vue&type=script&setup=true&lang.ts
78
- var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
78
+ var D = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
79
79
  key: 0,
80
80
  class: "cn-dropdown__separator",
81
81
  role: "separator",
@@ -118,7 +118,7 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
118
118
  ], _e = { class: "cn-dropdown__item-label" }, ve = {
119
119
  key: 0,
120
120
  class: "cn-dropdown__shortcut"
121
- }, k = 6, A = 2, j = /*#__PURE__*/ t(/* @__PURE__ */ c({
121
+ }, O = 6, k = 2, A = /*#__PURE__*/ t(/* @__PURE__ */ s({
122
122
  __name: "DropdownMenu",
123
123
  props: {
124
124
  label: {},
@@ -127,36 +127,36 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
127
127
  direction: { default: "down" }
128
128
  },
129
129
  emits: ["closed"],
130
- setup(t, { emit: r }) {
131
- let c = t, p = r, j = h(null), M = h(null), N = h(null), { open: P, toggle: F, closeMenu: I } = C({ container: j }), L = v(null), R = h({
130
+ setup(t, { emit: s }) {
131
+ let f = t, A = s, j = m(null), M = m(null), N = m(null), { open: P, toggle: F, closeMenu: I } = x({ container: j }), L = ee(null), R = m({
132
132
  left: 0,
133
133
  top: 0,
134
134
  side: "right"
135
135
  });
136
- x(P, (e) => {
137
- e || (L.value = null, p("closed"));
136
+ y(P, (e) => {
137
+ e || (L.value = null, A("closed"));
138
138
  });
139
- let z = h({
139
+ let z = m({
140
140
  left: 0,
141
141
  edge: "top",
142
142
  offset: 0
143
143
  });
144
144
  function B() {
145
- O(M.value)?.focus();
145
+ E(M.value)?.focus();
146
146
  }
147
147
  function V(e) {
148
148
  M.value = e instanceof HTMLElement ? e : null;
149
149
  }
150
150
  async function H() {
151
- if (await u(), !P.value) return;
151
+ if (await l(), !P.value) return;
152
152
  let e = N.value;
153
- e !== null && E(K(), e).focus();
153
+ e !== null && w(K(), e).focus();
154
154
  }
155
155
  function U() {
156
- return c.items.filter((e) => e !== "separator");
156
+ return f.items.filter((e) => e !== "separator");
157
157
  }
158
158
  function ye() {
159
- return U().filter(S);
159
+ return U().filter(b);
160
160
  }
161
161
  function be() {
162
162
  return Array.from(N.value?.querySelectorAll("[data-dropdown-submenu-host]") ?? []);
@@ -171,12 +171,12 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
171
171
  return Array.from(N.value?.querySelectorAll("[data-dropdown-item]") ?? []);
172
172
  }
173
173
  function q(e) {
174
- e.run(), (S(e) || e.keepsOpen !== !0) && (I(), B());
174
+ e.run(), (b(e) || e.keepsOpen !== !0) && (I(), B());
175
175
  }
176
176
  function xe(e) {
177
177
  let t = N.value;
178
178
  if (t === null) return;
179
- let n = K(), r = w(n.map((e) => !e.hasAttribute("disabled")), document.activeElement instanceof HTMLElement ? n.indexOf(document.activeElement) : -1, e);
179
+ let n = K(), r = S(n.map((e) => !e.hasAttribute("disabled")), document.activeElement instanceof HTMLElement ? n.indexOf(document.activeElement) : -1, e);
180
180
  if (r === -1) {
181
181
  t.focus();
182
182
  return;
@@ -190,7 +190,7 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
190
190
  function Ce(t) {
191
191
  let n = t.key, r = t.target;
192
192
  if (r instanceof HTMLElement && r.matches("[data-dropdown-submenu-item]")) {
193
- let e = ne(n);
193
+ let e = re(n);
194
194
  if (e.type === "move") {
195
195
  t.preventDefault(), Y(e.key);
196
196
  return;
@@ -240,21 +240,21 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
240
240
  }
241
241
  }
242
242
  async function we(e, t) {
243
- if (e.disabled === !0 || (L.value = T(L.value, {
243
+ if (e.disabled === !0 || (L.value = C(L.value, {
244
244
  type: "open",
245
245
  target: e
246
246
  }), await $(t.querySelector("[data-dropdown-submenu-arrow]")), L.value !== e || !P.value)) return;
247
247
  let n = W();
248
- n !== null && E(G(), n).focus();
248
+ n !== null && w(G(), n).focus();
249
249
  }
250
250
  function J() {
251
- let e = D(document.activeElement instanceof HTMLElement ? document.activeElement : null);
251
+ let e = T(document.activeElement instanceof HTMLElement ? document.activeElement : null);
252
252
  L.value = null, e?.focus();
253
253
  }
254
254
  function Y(e) {
255
255
  let t = W();
256
256
  if (t === null) return;
257
- let n = G(), r = w(n.map((e) => !e.hasAttribute("disabled")), document.activeElement instanceof HTMLElement ? n.indexOf(document.activeElement) : -1, e);
257
+ let n = G(), r = S(n.map((e) => !e.hasAttribute("disabled")), document.activeElement instanceof HTMLElement ? n.indexOf(document.activeElement) : -1, e);
258
258
  if (r === -1) {
259
259
  t.focus();
260
260
  return;
@@ -279,28 +279,28 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
279
279
  async function Z() {
280
280
  if (!P.value) {
281
281
  let e = M.value?.getBoundingClientRect();
282
- e && (z.value = c.direction === "up" ? {
282
+ e && (z.value = f.direction === "up" ? {
283
283
  left: e.left,
284
284
  edge: "bottom",
285
- offset: window.innerHeight - e.top + k
285
+ offset: window.innerHeight - e.top + O
286
286
  } : {
287
287
  left: e.left,
288
288
  edge: "top",
289
- offset: e.bottom + k
289
+ offset: e.bottom + O
290
290
  });
291
291
  }
292
292
  if (F(), !P.value) {
293
293
  B();
294
294
  return;
295
295
  }
296
- await u();
296
+ await l();
297
297
  let e = N.value?.getBoundingClientRect();
298
298
  if (!e) return;
299
299
  let t = z.value;
300
300
  z.value = {
301
- left: Math.max(A, Math.min(t.left, window.innerWidth - e.width - A)),
301
+ left: Math.max(k, Math.min(t.left, window.innerWidth - e.width - k)),
302
302
  edge: t.edge,
303
- offset: Math.max(A, Math.min(t.offset, window.innerHeight - e.height - A))
303
+ offset: Math.max(k, Math.min(t.offset, window.innerHeight - e.height - k))
304
304
  }, H();
305
305
  }
306
306
  function Q(e) {
@@ -314,9 +314,9 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
314
314
  left: n.right + 6,
315
315
  top: n.top,
316
316
  side: "right"
317
- }, await u(), L.value !== t) return;
317
+ }, await l(), L.value !== t) return;
318
318
  let r = W(), i = r?.getBoundingClientRect();
319
- r !== null && i !== void 0 && i.width !== 0 && (R.value = te({
319
+ r !== null && i !== void 0 && i.width !== 0 && (R.value = ne({
320
320
  anchor: {
321
321
  top: n.top,
322
322
  bottom: n.bottom,
@@ -330,13 +330,13 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
330
330
  }));
331
331
  }
332
332
  function Ee(e, t) {
333
- t.disabled !== !0 && (L.value = T(L.value, {
333
+ t.disabled !== !0 && (L.value = C(L.value, {
334
334
  type: "open",
335
335
  target: t
336
336
  }), $(Q(e)));
337
337
  }
338
338
  function De(e, t) {
339
- t.disabled !== !0 && (L.value = T(L.value, {
339
+ t.disabled !== !0 && (L.value = C(L.value, {
340
340
  type: "toggle",
341
341
  target: t
342
342
  }), $(Q(e)));
@@ -344,31 +344,31 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
344
344
  function Oe() {
345
345
  L.value = null;
346
346
  }
347
- return (e, r) => (m(), a("div", {
347
+ return (e, s) => (p(), i("div", {
348
348
  ref_key: "container",
349
349
  ref: j,
350
350
  class: "cn-dropdown",
351
351
  onMouseleave: Oe
352
- }, [_(e.$slots, "trigger", {
353
- open: b(P),
352
+ }, [g(e.$slots, "trigger", {
353
+ open: v(P),
354
354
  toggle: Z,
355
- closeMenu: b(I),
355
+ closeMenu: v(I),
356
356
  triggerRef: V,
357
357
  onKeydown: X
358
- }, () => [o("button", {
358
+ }, () => [a("button", {
359
359
  ref: V,
360
360
  type: "button",
361
361
  class: "cn-dropdown__trigger",
362
362
  "data-dropdown-trigger": "",
363
363
  "aria-haspopup": "menu",
364
- "aria-expanded": b(P),
364
+ "aria-expanded": v(P),
365
365
  title: t.title ?? t.label,
366
- onClick: r[0] ||= (e) => Z(),
366
+ onClick: s[0] ||= (e) => Z(),
367
367
  onKeydown: X
368
- }, [s(y(t.label) + " ", 1), r[2] ||= o("span", {
368
+ }, [o(_(t.label) + " ", 1), s[2] ||= a("span", {
369
369
  class: "cn-dropdown__caret",
370
370
  "aria-hidden": "true"
371
- }, "▾", -1)], 40, re)], !0), b(P) ? (m(), a("div", {
371
+ }, "▾", -1)], 40, D)], !0), v(P) ? (p(), i("div", {
372
372
  key: 0,
373
373
  ref_key: "menuEl",
374
374
  ref: N,
@@ -377,16 +377,16 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
377
377
  "aria-label": t.label,
378
378
  "data-dropdown-menu": "",
379
379
  tabindex: "-1",
380
- style: f(z.value.edge === "top" ? {
380
+ style: d(z.value.edge === "top" ? {
381
381
  left: `${z.value.left}px`,
382
382
  top: `${z.value.offset}px`
383
383
  } : {
384
384
  left: `${z.value.left}px`,
385
385
  bottom: `${z.value.offset}px`
386
386
  }),
387
- onKeydown: r[1] ||= ee((e) => Ce(e), ["stop"])
388
- }, [(m(!0), a(n, null, g(t.items, (e, t) => (m(), a(n, { key: t }, [e === "separator" ? (m(), a("div", ae)) : b(S)(e) ? (m(), a("div", oe, [
389
- o("button", l({
387
+ onKeydown: s[1] ||= te((e) => Ce(e), ["stop"])
388
+ }, [(p(!0), i(n, null, h(t.items, (e, t) => (p(), i(n, { key: t }, [e === "separator" ? (p(), i("div", ae)) : v(b)(e) ? (p(), i("div", oe, [
389
+ a("button", c({
390
390
  type: "button",
391
391
  role: "menuitem",
392
392
  class: "cn-dropdown__item cn-dropdown__submenu-main",
@@ -394,8 +394,8 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
394
394
  tabindex: "-1",
395
395
  disabled: e.disabled,
396
396
  title: e.title
397
- }, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => q(e) }), [o("span", ce, y(e.label), 1), e.shortcut ? (m(), a("span", le, y(e.shortcut), 1)) : i("", !0)], 16, se),
398
- o("button", {
397
+ }, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => q(e) }), [a("span", ce, _(e.label), 1), e.shortcut ? (p(), i("span", le, _(e.shortcut), 1)) : r("", !0)], 16, se),
398
+ a("button", {
399
399
  type: "button",
400
400
  class: "cn-dropdown__submenu-arrow",
401
401
  "data-dropdown-submenu-arrow": "",
@@ -406,19 +406,19 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
406
406
  "aria-expanded": L.value === e,
407
407
  onClick: (t) => De(t, e),
408
408
  onMouseenter: (t) => Ee(t, e)
409
- }, [...r[3] ||= [o("span", { "aria-hidden": "true" }, "▸", -1)]], 40, ue),
410
- L.value === e ? (m(), a("div", {
409
+ }, [...s[3] ||= [a("span", { "aria-hidden": "true" }, "▸", -1)]], 40, ue),
410
+ L.value === e ? (p(), i("div", {
411
411
  key: 0,
412
- class: d(["cn-dropdown__submenu", { "cn-dropdown__submenu--left": R.value.side === "left" }]),
412
+ class: u(["cn-dropdown__submenu", { "cn-dropdown__submenu--left": R.value.side === "left" }]),
413
413
  role: "menu",
414
414
  "aria-label": e.label,
415
415
  "data-dropdown-submenu": "",
416
416
  tabindex: "-1",
417
- style: f({
417
+ style: d({
418
418
  left: `${R.value.left}px`,
419
419
  top: `${R.value.top}px`
420
420
  })
421
- }, [(m(!0), a(n, null, g(e.children, (e, t) => (m(), a(n, { key: t }, [e === "separator" ? (m(), a("div", fe)) : (m(), a("button", l({
421
+ }, [(p(!0), i(n, null, h(e.children, (e, t) => (p(), i(n, { key: t }, [e === "separator" ? (p(), i("div", fe)) : (p(), i("button", c({
422
422
  key: 1,
423
423
  type: "button",
424
424
  role: "menuitem",
@@ -427,8 +427,8 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
427
427
  tabindex: "-1",
428
428
  disabled: e.disabled,
429
429
  title: e.title
430
- }, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => q(e) }), [o("span", me, y(e.label), 1), e.shortcut ? (m(), a("span", he, y(e.shortcut), 1)) : i("", !0)], 16, pe))], 64))), 128))], 14, de)) : i("", !0)
431
- ])) : (m(), a("button", l({
430
+ }, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => q(e) }), [a("span", me, _(e.label), 1), e.shortcut ? (p(), i("span", he, _(e.shortcut), 1)) : r("", !0)], 16, pe))], 64))), 128))], 14, de)) : r("", !0)
431
+ ])) : (p(), i("button", c({
432
432
  key: 2,
433
433
  type: "button",
434
434
  role: "menuitem",
@@ -437,22 +437,14 @@ var re = ["aria-expanded", "title"], ie = ["aria-label"], ae = {
437
437
  tabindex: "-1",
438
438
  disabled: e.disabled,
439
439
  title: e.title
440
- }, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => q(e) }), [o("span", _e, y(e.label), 1), e.shortcut ? (m(), a("span", ve, y(e.shortcut), 1)) : i("", !0)], 16, ge))], 64))), 128)), _(e.$slots, "body", {
441
- open: b(P),
440
+ }, { ref_for: !0 }, e.dataAttrs, { onClick: (t) => q(e) }), [a("span", _e, _(e.label), 1), e.shortcut ? (p(), i("span", ve, _(e.shortcut), 1)) : r("", !0)], 16, ge))], 64))), 128)), g(e.$slots, "body", {
441
+ open: v(P),
442
442
  toggle: Z,
443
- closeMenu: b(I),
443
+ closeMenu: v(I),
444
444
  triggerRef: V,
445
445
  onKeydown: X
446
- }, void 0, !0)], 44, ie)) : i("", !0)], 544));
446
+ }, void 0, !0)], 44, ie)) : r("", !0)], 544));
447
447
  }
448
448
  }), [["__scopeId", "data-v-f39579b0"]]);
449
449
  //#endregion
450
- //#region src/shared/useDataSourceSchema.ts
451
- function M(e) {
452
- let t = v(e.store.ui.dataSourceSchema), n = e.subscribe((n) => {
453
- n.scope === "ui" && n.branch === "dataSourceSchema" && (t.value = e.store.ui.dataSourceSchema);
454
- });
455
- return p(n, !0), r(() => t.value);
456
- }
457
- //#endregion
458
- export { j as n, C as r, M as t };
450
+ export { x as n, A as t };