@hankchen/canvas-editor-vue 0.3.0 → 0.4.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 (41) hide show
  1. package/dist/canvas/CanvasSurface.d.ts +28 -1
  2. package/dist/canvas/{ContentTypePill.d.ts → EditOverlayToolbar.d.ts} +19 -0
  3. package/dist/canvas/TextEditingOverlay.d.ts +31 -3
  4. package/dist/canvas/index.d.ts +1 -1
  5. package/dist/canvas/useTextEditing.d.ts +30 -8
  6. package/dist/{canvas-ZMyaouKe.js → canvas-DqQislJ_.js} +813 -434
  7. package/dist/canvas.js +2 -2
  8. package/dist/index.js +15 -14
  9. package/dist/{layer-panel-CEyB57XM.js → layer-panel-DskyCgF5.js} +7 -7
  10. package/dist/layer-panel.js +1 -1
  11. package/dist/panel-theme.css +24 -0
  12. package/dist/{completionAnchor-Da8VhzMQ.js → popupPosition-Ck5Gsvjy.js} +163 -107
  13. package/dist/property-panel/PropertyField.d.ts +6 -0
  14. package/dist/property-panel/fieldSchema.d.ts +7 -1
  15. package/dist/property-panel/fields/ImageSrcField.d.ts +5 -1
  16. package/dist/property-panel/fields/ResourceValueField.d.ts +19 -0
  17. package/dist/property-panel/fields/TextareaField.d.ts +1 -0
  18. package/dist/property-panel/fields/ValueTypeSegmented.d.ts +3 -1
  19. package/dist/property-panel/index.d.ts +5 -3
  20. package/dist/property-panel/usePropertyPanel.d.ts +16 -4
  21. package/dist/{property-panel-DmSf_GPu.js → property-panel-B32ZBQdf.js} +472 -376
  22. package/dist/property-panel.js +3 -2
  23. package/dist/resourceTemplate-cdcQtp9a.js +246 -0
  24. package/dist/shared/ExpressionPathPicker.d.ts +25 -0
  25. package/dist/shared/completion.d.ts +14 -10
  26. package/dist/shared/expressionContext.d.ts +2 -2
  27. package/dist/shared/index.d.ts +14 -1
  28. package/dist/shared/mergeKey.d.ts +2 -0
  29. package/dist/shared/pathPickerModel.d.ts +11 -0
  30. package/dist/shared/popupPosition.d.ts +41 -0
  31. package/dist/shared/resourceTemplate.d.ts +7 -0
  32. package/dist/shared/useExpressionCompletion.d.ts +0 -7
  33. package/dist/shared/useExpressionDiagnostics.d.ts +15 -0
  34. package/dist/shared.js +10 -9
  35. package/dist/style.css +1 -1
  36. package/dist/uploadFile-D1RY-ji0.js +516 -0
  37. package/dist/usePathCompletion-Do17CQ6l.js +220 -0
  38. package/package.json +2 -2
  39. package/dist/uploadFile-DXAEX9kG.js +0 -455
  40. package/dist/usePathCompletion-C52F4phW.js +0 -229
  41. /package/dist/{property-panel → shared}/fontPicker.d.ts +0 -0
@@ -1,229 +0,0 @@
1
- import { a as e } from "./layerPath-uy2ywyld.js";
2
- import { d as t, n, p as r, t as i } from "./completionAnchor-Da8VhzMQ.js";
3
- import { nextTick as a, onMounted as o, onScopeDispose as s, reactive as c, toValue as l, watch as u } from "vue";
4
- //#region ../canvas-editor/src/shared/rowsPathCandidates.ts
5
- function d(e) {
6
- return e.type === "array" || e.items !== void 0;
7
- }
8
- function f(e) {
9
- return !d(e) && e.properties === void 0 && e.open !== !0;
10
- }
11
- function p(e, t, n) {
12
- let r = {
13
- path: n === "" ? e : `${n}.${e}`,
14
- segment: e
15
- };
16
- return t.description !== void 0 && (r.description = t.description), t.title !== void 0 && (r.title = t.title), d(t) && (r.type = "array"), r;
17
- }
18
- function m(e, t) {
19
- let n = [];
20
- if (e.properties !== void 0) for (let [r, i] of e.properties) f(i) || n.push(p(r, i, t));
21
- return e.open === !0 ? {
22
- candidates: n,
23
- open: !0
24
- } : { candidates: n };
25
- }
26
- function h(e, t) {
27
- if (e === null) return null;
28
- let n = t.split("."), i = t.endsWith(".") ? "" : n[n.length - 1], a = n.slice(0, -1), o = e;
29
- for (let e of a) {
30
- if (d(o)) return null;
31
- let t = r(o, [e]);
32
- if (t === null) return null;
33
- o = t;
34
- }
35
- if (d(o) || f(o)) return null;
36
- let s = m(o, a.join("."));
37
- return {
38
- partial: i,
39
- candidates: s.candidates,
40
- ...s.open === !0 ? { open: !0 } : {}
41
- };
42
- }
43
- function g(n, r, i) {
44
- if (i === null) return null;
45
- if (n === null || r === null) return i;
46
- let a = null;
47
- for (let o = 0; o < r.length; o += 1) {
48
- if (r[o] !== "template") continue;
49
- let s = e(n, r.slice(0, o));
50
- if (s === null || s.type !== "TableLayer" || (a = t(a ?? i, s.rowsPath), a === null)) return null;
51
- }
52
- return a ?? i;
53
- }
54
- //#endregion
55
- //#region src/shared/rowsPathCompletionSource.ts
56
- function _(e) {
57
- return e === null ? null : (t) => {
58
- let n = h(e, t);
59
- return n === null ? null : {
60
- partial: n.partial,
61
- candidates: n.candidates.map((e) => e.type === "array" ? {
62
- ...e,
63
- type: "行数组"
64
- } : e),
65
- ...n.open === !0 ? { open: !0 } : {}
66
- };
67
- };
68
- }
69
- //#endregion
70
- //#region src/shared/usePathCompletion.ts
71
- var v = 4, y = 4, b = [
72
- "ArrowLeft",
73
- "ArrowRight",
74
- "Home",
75
- "End",
76
- "PageUp",
77
- "PageDown"
78
- ];
79
- function x(e) {
80
- return {
81
- kind: "fragment",
82
- start: -2,
83
- end: e.length + 2,
84
- raw: "",
85
- expr: e,
86
- error: null
87
- };
88
- }
89
- function S(e) {
90
- let t = c({
91
- open: !1,
92
- items: [],
93
- activeIndex: 0,
94
- top: 0,
95
- left: 0,
96
- openMapping: !1
97
- }), r = null, d = !1, f = "";
98
- function p() {
99
- t.open = !1, t.items = [], t.activeIndex = 0, t.openMapping = !1, f = "";
100
- }
101
- function m() {
102
- if (!t.open || !r) return;
103
- let e = i(r);
104
- t.top = e.bottom + v, t.left = h(e.left);
105
- }
106
- function h(t) {
107
- let n = (e.popupEl ? l(e.popupEl) : null)?.offsetWidth ?? 0;
108
- return n <= 0 ? t : Math.max(0, Math.min(t, window.innerWidth - y - n));
109
- }
110
- function g(n, i = !1) {
111
- if (!l(e.enabled)) {
112
- p();
113
- return;
114
- }
115
- let o = r;
116
- if (!o) {
117
- p();
118
- return;
119
- }
120
- let s = o.value.slice(0, o.selectionStart ?? o.value.length);
121
- if (s === "" && !i) {
122
- p();
123
- return;
124
- }
125
- let c = e.resolve(s);
126
- if (!c) {
127
- p();
128
- return;
129
- }
130
- let u = i ? c.candidates : c.candidates.filter((e) => e.segment.startsWith(c.partial));
131
- if (u.length === 0 && c.open !== !0) {
132
- p();
133
- return;
134
- }
135
- f = c.partial, (t.open || n) && (t.items = u, t.activeIndex = 0, t.openMapping = c.open === !0, t.open = !0, m(), a(m));
136
- }
137
- function _(e) {
138
- let i = r;
139
- if (!t.open || d || !i) return;
140
- let a = t.items[e ?? t.activeIndex];
141
- if (!a) return;
142
- let o = i.value.slice(0, i.selectionStart ?? i.value.length), s = n(i.value, x(o), o.length, f, a);
143
- if (!s) {
144
- p();
145
- return;
146
- }
147
- i.value = s.value, i.setSelectionRange(s.cursor, s.cursor), i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 })), p();
148
- }
149
- function S(e) {
150
- d || e.isComposing || g(!0);
151
- }
152
- function C() {
153
- d = !0;
154
- }
155
- function w() {
156
- d = !1, g(!0);
157
- }
158
- function T(e) {
159
- return d || e.isComposing || e.keyCode === 229;
160
- }
161
- function E(e) {
162
- if (!T(e)) {
163
- if (e.key === " " && (e.ctrlKey || e.metaKey)) {
164
- e.preventDefault(), g(!0, !0);
165
- return;
166
- }
167
- if (t.open) {
168
- if (t.items.length === 0) {
169
- e.key === "Escape" && (e.preventDefault(), p());
170
- return;
171
- }
172
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
173
- e.preventDefault();
174
- let n = t.items.length;
175
- n > 0 && (t.activeIndex = (t.activeIndex + (e.key === "ArrowDown" ? 1 : n - 1)) % n);
176
- return;
177
- }
178
- if (e.key === "Enter" || e.key === "Tab") {
179
- e.preventDefault(), _();
180
- return;
181
- }
182
- e.key === "Escape" && (e.preventDefault(), p());
183
- }
184
- }
185
- }
186
- function D(e) {
187
- t.open && !T(e) && b.includes(e.key) && g(!1);
188
- }
189
- function O() {
190
- d || g(!1);
191
- }
192
- function k() {
193
- p();
194
- }
195
- function A(e) {
196
- t.open && e.target !== r && p();
197
- }
198
- function j() {
199
- m();
200
- }
201
- let M = [
202
- ["input", S],
203
- ["keydown", E],
204
- ["keyup", D],
205
- ["click", O],
206
- ["blur", k],
207
- ["compositionstart", C],
208
- ["compositionend", w]
209
- ];
210
- function N(e) {
211
- for (let [t, n] of M) e.addEventListener(t, n);
212
- }
213
- function P(e) {
214
- for (let [t, n] of M) e.removeEventListener(t, n);
215
- }
216
- function F(e) {
217
- r !== e && (r && P(r), r = e, e && N(e));
218
- }
219
- return o(() => F(e.target.value)), u(e.target, (e) => F(e)), u(() => l(e.enabled), (e) => {
220
- e || p();
221
- }), document.addEventListener("mousedown", A), window.addEventListener("scroll", j, !0), window.addEventListener("resize", j), s(() => {
222
- r && P(r), document.removeEventListener("mousedown", A), window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j);
223
- }), {
224
- popup: t,
225
- accept: _
226
- };
227
- }
228
- //#endregion
229
- export { _ as n, g as r, S as t };
File without changes