@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.
- package/dist/{useDataSourceSchema-YV8g-lo0.js → DropdownMenu-CeUNKMDQ.js} +70 -78
- package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
- package/dist/{canvas-CX1RdlFC.js → canvas-D3fFnBqG.js} +526 -527
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -15
- package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
- package/dist/{layer-panel-Cd1e8xNB.js → layer-panel-BouAYiDq.js} +231 -257
- package/dist/layer-panel.js +1 -1
- package/dist/property-panel/PropertyField.d.ts +9 -2
- package/dist/property-panel/fieldSchema.d.ts +16 -10
- package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
- package/dist/property-panel/fields/index.d.ts +1 -0
- package/dist/property-panel/usePropertyPanel.d.ts +11 -2
- package/dist/{property-panel-B32ZBQdf.js → property-panel-DJQJzioT.js} +403 -341
- package/dist/property-panel.js +2 -2
- package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
- package/dist/shared/ExpressionPathPicker.d.ts +9 -2
- package/dist/shared/index.d.ts +13 -10
- package/dist/shared/pathPickerModel.d.ts +16 -3
- package/dist/shared/popupPosition.d.ts +2 -2
- package/dist/shared/rowsPathPickerSource.d.ts +15 -0
- package/dist/shared/useDataSourceSchema.d.ts +9 -1
- package/dist/shared/useExpressionDiagnostics.d.ts +11 -0
- package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
- package/dist/shared.js +9 -10
- package/dist/{status-bar-XMVbRLY9.js → status-bar-DBf5kIXY.js} +69 -67
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/uploadFile-mXJVPEzm.js +653 -0
- package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
- package/package.json +2 -2
- package/dist/popupPosition-Ck5Gsvjy.js +0 -526
- package/dist/resourceTemplate-cdcQtp9a.js +0 -246
- package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
- package/dist/shared/usePathCompletion.d.ts +0 -18
- package/dist/uploadFile-D1RY-ji0.js +0 -516
- package/dist/usePathCompletion-Do17CQ6l.js +0 -220
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed as e, onScopeDispose as t, ref as n, shallowRef as r } from "vue";
|
|
2
2
|
//#region ../canvas-editor/src/session/shortcuts.ts
|
|
3
|
-
var
|
|
3
|
+
var i = {
|
|
4
4
|
armCreateText: "TextLayer",
|
|
5
5
|
armCreateTable: "TableLayer",
|
|
6
6
|
armCreateQrCode: "QrCodeLayer",
|
|
7
7
|
armCreateImage: "ImageLayer"
|
|
8
|
-
},
|
|
8
|
+
}, a = [
|
|
9
9
|
{
|
|
10
10
|
combo: {
|
|
11
11
|
key: "z",
|
|
@@ -391,33 +391,33 @@ var t = {
|
|
|
391
391
|
group: "help"
|
|
392
392
|
}
|
|
393
393
|
];
|
|
394
|
-
function
|
|
394
|
+
function o(e, t = a) {
|
|
395
395
|
if (e.composing || e.editing || e.editableTarget) return null;
|
|
396
|
-
let
|
|
397
|
-
for (let
|
|
396
|
+
let n = e.key.toLowerCase(), r = e.alt ?? !1;
|
|
397
|
+
for (let i of t) if ((i.combo.code === void 0 ? i.combo.key === n : i.combo.code === e.code) && i.combo.mod === e.mod && i.combo.shift === e.shift && (i.combo.alt ?? !1) === r) return i.action;
|
|
398
398
|
return null;
|
|
399
399
|
}
|
|
400
400
|
//#endregion
|
|
401
401
|
//#region \0plugin-vue:export-helper
|
|
402
|
-
var
|
|
402
|
+
var s = (e, t) => {
|
|
403
403
|
let n = e.__vccOpts || e;
|
|
404
404
|
for (let [e, r] of t) n[e] = r;
|
|
405
405
|
return n;
|
|
406
|
-
},
|
|
406
|
+
}, c = [
|
|
407
407
|
"history",
|
|
408
408
|
"clipboard",
|
|
409
409
|
"layer",
|
|
410
410
|
"text",
|
|
411
411
|
"view",
|
|
412
412
|
"help"
|
|
413
|
-
],
|
|
413
|
+
], l = {
|
|
414
414
|
history: "历史",
|
|
415
415
|
clipboard: "剪贴板",
|
|
416
416
|
layer: "图层",
|
|
417
417
|
text: "文本",
|
|
418
418
|
view: "视图",
|
|
419
419
|
help: "帮助"
|
|
420
|
-
},
|
|
420
|
+
}, u = {
|
|
421
421
|
arrowup: "↑",
|
|
422
422
|
arrowdown: "↓",
|
|
423
423
|
arrowleft: "←",
|
|
@@ -428,8 +428,8 @@ var i = (e, t) => {
|
|
|
428
428
|
tab: "Tab",
|
|
429
429
|
f2: "F2"
|
|
430
430
|
};
|
|
431
|
-
function
|
|
432
|
-
let n = e.key, r = /^[a-z]$/.test(n) ? n.toUpperCase() :
|
|
431
|
+
function d(e, t) {
|
|
432
|
+
let n = e.key, r = /^[a-z]$/.test(n) ? n.toUpperCase() : u[n] ?? n;
|
|
433
433
|
if (t === "mac") {
|
|
434
434
|
let t = "";
|
|
435
435
|
return e.alt && (t += "⌥"), e.shift && (t += "⇧"), e.mod && (t += "⌘"), t + r;
|
|
@@ -437,24 +437,39 @@ function c(e, t) {
|
|
|
437
437
|
let i = [];
|
|
438
438
|
return e.mod && i.push("Ctrl"), e.shift && i.push("Shift"), e.alt && i.push("Alt"), i.push(r), i.join("+");
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
let
|
|
442
|
-
return
|
|
440
|
+
function f(e, t) {
|
|
441
|
+
let n = a.find((t) => t.action === e);
|
|
442
|
+
return n ? d(n.combo, t) : "";
|
|
443
443
|
}
|
|
444
|
-
var
|
|
445
|
-
function
|
|
444
|
+
var p = "画拉或点击落层,Esc 取消";
|
|
445
|
+
function m() {
|
|
446
446
|
let e = globalThis.navigator;
|
|
447
447
|
return /mac/i.test(`${e?.userAgentData?.platform ?? ""} ${e?.platform ?? ""} ${e?.userAgent ?? ""}`) ? "mac" : "win";
|
|
448
448
|
}
|
|
449
449
|
//#endregion
|
|
450
|
+
//#region src/shared/useDataSourceSchema.ts
|
|
451
|
+
var h = "先绑定数据源";
|
|
452
|
+
function g(n) {
|
|
453
|
+
let i = r(n.store.ui.dataSourceSchema), a = n.subscribe((e) => {
|
|
454
|
+
e.scope === "ui" && e.branch === "dataSourceSchema" && (i.value = n.store.ui.dataSourceSchema);
|
|
455
|
+
});
|
|
456
|
+
return t(a, !0), e(() => i.value);
|
|
457
|
+
}
|
|
458
|
+
function _(n) {
|
|
459
|
+
let i = r(n.store.ui.dataSourceSchemaRejection), a = n.subscribe((e) => {
|
|
460
|
+
e.scope === "ui" && e.branch === "dataSourceSchema" && (i.value = n.store.ui.dataSourceSchemaRejection);
|
|
461
|
+
});
|
|
462
|
+
return t(a, !0), e(() => i.value);
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
450
465
|
//#region src/shared/editableTarget.ts
|
|
451
|
-
function
|
|
466
|
+
function v(e) {
|
|
452
467
|
if (!(e instanceof HTMLElement)) return !1;
|
|
453
468
|
if (e.isContentEditable) return !0;
|
|
454
469
|
let t = e.tagName;
|
|
455
470
|
return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || t === "BUTTON";
|
|
456
471
|
}
|
|
457
|
-
function
|
|
472
|
+
function y(e) {
|
|
458
473
|
if (!(e instanceof HTMLElement)) return !1;
|
|
459
474
|
if (e.isContentEditable) return !0;
|
|
460
475
|
let t = e.tagName;
|
|
@@ -462,22 +477,22 @@ function p(e) {
|
|
|
462
477
|
}
|
|
463
478
|
//#endregion
|
|
464
479
|
//#region src/shared/useTransientFeedback.ts
|
|
465
|
-
var
|
|
466
|
-
function
|
|
480
|
+
var b = 4e3, x = n(""), S = null;
|
|
481
|
+
function C() {
|
|
467
482
|
let e = () => {
|
|
468
|
-
|
|
483
|
+
S !== null && (clearTimeout(S), S = null);
|
|
469
484
|
};
|
|
470
485
|
return {
|
|
471
|
-
message:
|
|
486
|
+
message: x,
|
|
472
487
|
show: (t) => {
|
|
473
|
-
e(),
|
|
474
|
-
|
|
475
|
-
},
|
|
488
|
+
e(), x.value = t, S = setTimeout(() => {
|
|
489
|
+
x.value = "", S = null;
|
|
490
|
+
}, b);
|
|
476
491
|
},
|
|
477
492
|
clear: () => {
|
|
478
|
-
e(),
|
|
493
|
+
e(), x.value = "";
|
|
479
494
|
}
|
|
480
495
|
};
|
|
481
496
|
}
|
|
482
497
|
//#endregion
|
|
483
|
-
export {
|
|
498
|
+
export { g as a, l as c, f as d, d as f, o as g, a as h, h as i, c as l, i as m, v as n, _ as o, s as p, y as r, p as s, C as t, m as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hankchen/canvas-editor-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue 3 薄绑定:响应式桥、composables、画布表面组件、textarea 文本编辑 overlay、schema 驱动属性面板注册表",
|
|
6
6
|
"type": "module",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@lucide/vue": "^1.48.0",
|
|
61
|
-
"@hankchen/canvas-editor": "0.
|
|
61
|
+
"@hankchen/canvas-editor": "0.8.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"vue": "^3.5.0"
|
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeProps as s, nextTick as c, normalizeClass as l, normalizeStyle as u, openBlock as d, ref as f, renderList as p, resolveDynamicComponent as m, toDisplayString as h, watch as g, withModifiers as _ } from "vue";
|
|
2
|
-
//#region ../canvas-editor/src/shared/expressionSchema.ts
|
|
3
|
-
function v(e) {
|
|
4
|
-
let t = e;
|
|
5
|
-
for (; t !== void 0;) {
|
|
6
|
-
if (t.properties !== void 0) return t.properties;
|
|
7
|
-
t = t.items;
|
|
8
|
-
}
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
function y(e, t) {
|
|
12
|
-
let n = e;
|
|
13
|
-
for (let e of t) {
|
|
14
|
-
let t = v(n)?.get(e);
|
|
15
|
-
if (t === void 0) return null;
|
|
16
|
-
n = t;
|
|
17
|
-
}
|
|
18
|
-
return n;
|
|
19
|
-
}
|
|
20
|
-
function b(e) {
|
|
21
|
-
return e.type === "array" || e.items !== void 0 ? { entries: [] } : { entries: e.properties === void 0 ? [] : [...e.properties].map(([e, t]) => ({
|
|
22
|
-
key: e,
|
|
23
|
-
node: t
|
|
24
|
-
})) };
|
|
25
|
-
}
|
|
26
|
-
function x(e, t) {
|
|
27
|
-
let n = t.split(".");
|
|
28
|
-
return t === "" || n.includes("") ? null : y(e, n)?.items ?? null;
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../canvas-editor/src/shared/expressionPath.ts
|
|
32
|
-
function S(e) {
|
|
33
|
-
if (e === "") return {
|
|
34
|
-
ok: !1,
|
|
35
|
-
error: "expression_syntax_error"
|
|
36
|
-
};
|
|
37
|
-
let t = e.split(".");
|
|
38
|
-
if (t.includes("")) return {
|
|
39
|
-
ok: !1,
|
|
40
|
-
error: "expression_syntax_error"
|
|
41
|
-
};
|
|
42
|
-
let n = t[0], r = t.slice(1);
|
|
43
|
-
return n === "row" ? {
|
|
44
|
-
ok: !0,
|
|
45
|
-
head: { kind: "row" },
|
|
46
|
-
rest: r
|
|
47
|
-
} : n === "$root" ? {
|
|
48
|
-
ok: !0,
|
|
49
|
-
head: { kind: "root" },
|
|
50
|
-
rest: r
|
|
51
|
-
} : {
|
|
52
|
-
ok: !0,
|
|
53
|
-
head: {
|
|
54
|
-
kind: "bare",
|
|
55
|
-
name: n
|
|
56
|
-
},
|
|
57
|
-
rest: r
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region ../canvas-editor/src/shared/expressionCall.ts
|
|
62
|
-
var C = " \n\r\0\v", w = " \n\r", T = `()',.${C}`;
|
|
63
|
-
function E(e) {
|
|
64
|
-
let t = 0, n = e.length;
|
|
65
|
-
for (; t < n && C.includes(e[t]);) t += 1;
|
|
66
|
-
for (; n > t && C.includes(e[n - 1]);) --n;
|
|
67
|
-
return e.slice(t, n);
|
|
68
|
-
}
|
|
69
|
-
function D(e, t) {
|
|
70
|
-
for (; t < e.length && w.includes(e[t]);) t += 1;
|
|
71
|
-
return t;
|
|
72
|
-
}
|
|
73
|
-
function O(e, t, n) {
|
|
74
|
-
return {
|
|
75
|
-
ok: !1,
|
|
76
|
-
error: "expression_syntax_error",
|
|
77
|
-
kind: e,
|
|
78
|
-
at: {
|
|
79
|
-
start: t,
|
|
80
|
-
end: n
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function k(e) {
|
|
85
|
-
let t = 0;
|
|
86
|
-
for (; t < e.length && !T.includes(e[t]);) t += 1;
|
|
87
|
-
if (t === 0) return !1;
|
|
88
|
-
let n = t;
|
|
89
|
-
for (; n < e.length && C.includes(e[n]);) n += 1;
|
|
90
|
-
return e[n] === "(";
|
|
91
|
-
}
|
|
92
|
-
function A(e) {
|
|
93
|
-
let t = 0;
|
|
94
|
-
for (; t < e.length && !T.includes(e[t]);) t += 1;
|
|
95
|
-
if (t === 0) return O("invalid_path", 0, e.length);
|
|
96
|
-
let n = e.slice(0, t), r = D(e, t);
|
|
97
|
-
if (r >= e.length || e[r] !== "(") return O("missing_open_paren", t, e.length);
|
|
98
|
-
let i = r;
|
|
99
|
-
r = D(e, r + 1);
|
|
100
|
-
let a = [], o = [];
|
|
101
|
-
if (r < e.length && e[r] === ")") r += 1;
|
|
102
|
-
else for (;;) {
|
|
103
|
-
if (r >= e.length) return O("unbalanced_paren", i, e.length);
|
|
104
|
-
let t = j(e, r);
|
|
105
|
-
if (!t.ok) return t;
|
|
106
|
-
if (a.push(t.value), o.push({
|
|
107
|
-
start: t.start,
|
|
108
|
-
end: t.end
|
|
109
|
-
}), r = D(e, t.end), r >= e.length) return O("unbalanced_paren", i, e.length);
|
|
110
|
-
if (e[r] === ",") {
|
|
111
|
-
let t = r;
|
|
112
|
-
if (r = D(e, r + 1), r < e.length && e[r] === ")") return O("empty_arg_slot", t + 1, r);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (e[r] === ")") {
|
|
116
|
-
r += 1;
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
return O("bad_arg_syntax", r, r + 1);
|
|
120
|
-
}
|
|
121
|
-
if (r = D(e, r), r !== e.length) return O("trailing_after_call", r, e.length);
|
|
122
|
-
if (a[0] !== void 0 && a[0].type !== "path") {
|
|
123
|
-
let e = o[0];
|
|
124
|
-
return O("first_arg_not_path", e.start, e.end);
|
|
125
|
-
}
|
|
126
|
-
for (let e = 0; e < a.length; e += 1) {
|
|
127
|
-
let t = a[e], n = o[e];
|
|
128
|
-
if (t.type === "path" && !S(t.value).ok) return O("invalid_path_arg", n.start, n.end);
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
ok: !0,
|
|
132
|
-
name: n,
|
|
133
|
-
args: a
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function j(e, t) {
|
|
137
|
-
let n = e.length, r = t, i = e[t];
|
|
138
|
-
if (i === "'") {
|
|
139
|
-
let i = t + 1, a = "";
|
|
140
|
-
for (;;) {
|
|
141
|
-
if (i >= n) return {
|
|
142
|
-
ok: !1,
|
|
143
|
-
error: "expression_syntax_error",
|
|
144
|
-
kind: "unterminated_string",
|
|
145
|
-
at: {
|
|
146
|
-
start: r,
|
|
147
|
-
end: n
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
if (e[i] === "'") {
|
|
151
|
-
if (i + 1 < n && e[i + 1] === "'") {
|
|
152
|
-
a += "'", i += 2;
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
i += 1;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
a += e[i], i += 1;
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
ok: !0,
|
|
162
|
-
value: {
|
|
163
|
-
type: "string",
|
|
164
|
-
value: a
|
|
165
|
-
},
|
|
166
|
-
start: r,
|
|
167
|
-
end: i
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
if (i >= "0" && i <= "9") {
|
|
171
|
-
let i = (t) => {
|
|
172
|
-
let n = e[t];
|
|
173
|
-
return n !== void 0 && n >= "0" && n <= "9";
|
|
174
|
-
};
|
|
175
|
-
for (; i(t);) t += 1;
|
|
176
|
-
if (t < n && e[t] === "." && i(t + 1)) for (t += 1; i(t);) t += 1;
|
|
177
|
-
return {
|
|
178
|
-
ok: !0,
|
|
179
|
-
value: {
|
|
180
|
-
type: "number",
|
|
181
|
-
value: e.slice(r, t)
|
|
182
|
-
},
|
|
183
|
-
start: r,
|
|
184
|
-
end: t
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
for (; t < n && e[t] !== "," && e[t] !== ")";) t += 1;
|
|
188
|
-
let a = E(e.slice(r, t));
|
|
189
|
-
return a === "" ? {
|
|
190
|
-
ok: !1,
|
|
191
|
-
error: "expression_syntax_error",
|
|
192
|
-
kind: "empty_arg_slot",
|
|
193
|
-
at: {
|
|
194
|
-
start: r,
|
|
195
|
-
end: t
|
|
196
|
-
}
|
|
197
|
-
} : {
|
|
198
|
-
ok: !0,
|
|
199
|
-
value: {
|
|
200
|
-
type: "path",
|
|
201
|
-
value: a
|
|
202
|
-
},
|
|
203
|
-
start: r,
|
|
204
|
-
end: t
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function M(e) {
|
|
208
|
-
let t = 0;
|
|
209
|
-
for (; t < e.length && !T.includes(e[t]);) t += 1;
|
|
210
|
-
if (t === 0) return null;
|
|
211
|
-
let n = D(e, t);
|
|
212
|
-
if (n >= e.length || e[n] !== "(") return null;
|
|
213
|
-
n = D(e, n + 1);
|
|
214
|
-
let r = 0;
|
|
215
|
-
for (;;) {
|
|
216
|
-
if (n >= e.length) return {
|
|
217
|
-
name: e.slice(0, t),
|
|
218
|
-
index: r,
|
|
219
|
-
text: "",
|
|
220
|
-
stringSlot: !1
|
|
221
|
-
};
|
|
222
|
-
let i = e[n];
|
|
223
|
-
if (i === "'") {
|
|
224
|
-
let i = n + 1;
|
|
225
|
-
for (;;) {
|
|
226
|
-
if (i >= e.length) return {
|
|
227
|
-
name: e.slice(0, t),
|
|
228
|
-
index: r,
|
|
229
|
-
text: e.slice(n + 1),
|
|
230
|
-
stringSlot: !0
|
|
231
|
-
};
|
|
232
|
-
if (e[i] === "'") {
|
|
233
|
-
if (i + 1 < e.length && e[i + 1] === "'") {
|
|
234
|
-
i += 2;
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
i += 1;
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
i += 1;
|
|
241
|
-
}
|
|
242
|
-
n = i;
|
|
243
|
-
} else if (i !== "," && i !== ")") {
|
|
244
|
-
let i = n;
|
|
245
|
-
for (; n < e.length && e[n] !== "," && e[n] !== ")";) n += 1;
|
|
246
|
-
if (n >= e.length) return {
|
|
247
|
-
name: e.slice(0, t),
|
|
248
|
-
index: r,
|
|
249
|
-
text: E(e.slice(i)),
|
|
250
|
-
stringSlot: !1
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
if (n >= e.length) return {
|
|
254
|
-
name: e.slice(0, t),
|
|
255
|
-
index: r + 1,
|
|
256
|
-
text: "",
|
|
257
|
-
stringSlot: !1
|
|
258
|
-
};
|
|
259
|
-
if (e[n] === ")") return null;
|
|
260
|
-
r += 1, n = D(e, n + 1);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
function N(e) {
|
|
264
|
-
let t = 0, n = e.length;
|
|
265
|
-
for (; t < n && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
266
|
-
for (; n > t && " \n\r\0\v".includes(e[n - 1]);) --n;
|
|
267
|
-
return e.slice(t, n);
|
|
268
|
-
}
|
|
269
|
-
function P(e) {
|
|
270
|
-
if (e === "") return {
|
|
271
|
-
kind: "empty_fragment",
|
|
272
|
-
at: {
|
|
273
|
-
start: 0,
|
|
274
|
-
end: 0
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
if (k(e)) {
|
|
278
|
-
let t = A(e);
|
|
279
|
-
return t.ok ? null : {
|
|
280
|
-
kind: t.kind,
|
|
281
|
-
at: t.at
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
return S(e).ok ? null : {
|
|
285
|
-
kind: "invalid_path",
|
|
286
|
-
at: {
|
|
287
|
-
start: 0,
|
|
288
|
-
end: e.length
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
function F(e) {
|
|
293
|
-
let t = 0;
|
|
294
|
-
for (; t < e.length && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
295
|
-
return t;
|
|
296
|
-
}
|
|
297
|
-
function I(e) {
|
|
298
|
-
let t = [], n = 0, r = e.indexOf("{{");
|
|
299
|
-
for (; r !== -1;) {
|
|
300
|
-
let i = e.indexOf("}}", r + 2);
|
|
301
|
-
if (i === -1) {
|
|
302
|
-
r > n && t.push({
|
|
303
|
-
kind: "literal",
|
|
304
|
-
start: n,
|
|
305
|
-
end: r,
|
|
306
|
-
text: e.slice(n, r)
|
|
307
|
-
});
|
|
308
|
-
let i = e.slice(r);
|
|
309
|
-
return t.push({
|
|
310
|
-
kind: "open",
|
|
311
|
-
start: r,
|
|
312
|
-
end: e.length,
|
|
313
|
-
text: i,
|
|
314
|
-
expr: N(i.slice(2))
|
|
315
|
-
}), {
|
|
316
|
-
template: e,
|
|
317
|
-
parts: t
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
r > n && t.push({
|
|
321
|
-
kind: "literal",
|
|
322
|
-
start: n,
|
|
323
|
-
end: r,
|
|
324
|
-
text: e.slice(n, r)
|
|
325
|
-
});
|
|
326
|
-
let a = e.slice(r + 2, i), o = N(a), s = null, c = P(o);
|
|
327
|
-
if (c) {
|
|
328
|
-
let e = r + 2 + F(a);
|
|
329
|
-
s = {
|
|
330
|
-
kind: c.kind,
|
|
331
|
-
start: r,
|
|
332
|
-
end: i + 2,
|
|
333
|
-
at: {
|
|
334
|
-
start: e + c.at.start,
|
|
335
|
-
end: e + c.at.end
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
t.push({
|
|
340
|
-
kind: "fragment",
|
|
341
|
-
start: r,
|
|
342
|
-
end: i + 2,
|
|
343
|
-
raw: a,
|
|
344
|
-
expr: o,
|
|
345
|
-
error: s === null ? null : "expression_syntax_error",
|
|
346
|
-
diagnostic: s
|
|
347
|
-
}), n = i + 2, r = e.indexOf("{{", n);
|
|
348
|
-
}
|
|
349
|
-
return n < e.length && t.push({
|
|
350
|
-
kind: "literal",
|
|
351
|
-
start: n,
|
|
352
|
-
end: e.length,
|
|
353
|
-
text: e.slice(n)
|
|
354
|
-
}), {
|
|
355
|
-
template: e,
|
|
356
|
-
parts: t
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
function L(e, t) {
|
|
360
|
-
for (let n of e.parts) if (n.kind !== "literal" && (n.kind === "open" ? t > n.start && t <= n.end : t > n.start && t < n.end)) return n;
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region src/shared/PanelIcon.vue
|
|
365
|
-
var R = /* @__PURE__ */ o({
|
|
366
|
-
inheritAttrs: !1,
|
|
367
|
-
__name: "PanelIcon",
|
|
368
|
-
props: {
|
|
369
|
-
icon: {},
|
|
370
|
-
size: { default: 14 },
|
|
371
|
-
strokeWidth: { default: 2 }
|
|
372
|
-
},
|
|
373
|
-
setup(e) {
|
|
374
|
-
return (t, r) => (d(), n(m(e.icon), s({
|
|
375
|
-
size: e.size,
|
|
376
|
-
"stroke-width": e.strokeWidth
|
|
377
|
-
}, t.$attrs), null, 16, ["size", "stroke-width"]));
|
|
378
|
-
}
|
|
379
|
-
}), z = {
|
|
380
|
-
role: "listbox",
|
|
381
|
-
"aria-label": "表达式路径候选"
|
|
382
|
-
}, B = [
|
|
383
|
-
"aria-selected",
|
|
384
|
-
"title",
|
|
385
|
-
"onClick"
|
|
386
|
-
], V = { class: "cn-completion__segment font-mono text-cn-fg" }, H = {
|
|
387
|
-
key: 0,
|
|
388
|
-
class: "shrink-0 rounded-sm bg-cn-field px-1 py-0.5 text-[9px] leading-none text-cn-muted"
|
|
389
|
-
}, U = {
|
|
390
|
-
key: 1,
|
|
391
|
-
class: "truncate text-[10px] leading-none text-cn-muted"
|
|
392
|
-
}, W = /* @__PURE__ */ o({
|
|
393
|
-
__name: "ExpressionCompletionPopup",
|
|
394
|
-
props: { state: {} },
|
|
395
|
-
emits: ["select"],
|
|
396
|
-
setup(o, { expose: s, emit: m }) {
|
|
397
|
-
let v = o, y = m, b = f(null);
|
|
398
|
-
return s({ rootEl: b }), g(() => v.state.activeIndex, async () => {
|
|
399
|
-
await c(), b.value?.querySelector(".cn-completion__option--active")?.scrollIntoView?.({ block: "nearest" });
|
|
400
|
-
}), (s, c) => (d(), n(t, { to: "body" }, [o.state.open ? (d(), i("div", {
|
|
401
|
-
key: 0,
|
|
402
|
-
ref_key: "rootRef",
|
|
403
|
-
ref: b,
|
|
404
|
-
class: "cn-props cn-completion fixed z-50 max-h-[200px] min-w-[140px] max-w-[280px] overflow-y-auto rounded-md border border-cn-field-line py-1 text-[11px] leading-none",
|
|
405
|
-
style: u({
|
|
406
|
-
top: `${o.state.top}px`,
|
|
407
|
-
left: `${o.state.left}px`
|
|
408
|
-
}),
|
|
409
|
-
onMousedown: c[0] ||= _(() => {}, ["prevent", "stop"]),
|
|
410
|
-
onPointerdown: c[1] ||= _(() => {}, ["stop"])
|
|
411
|
-
}, [a("div", z, [(d(!0), i(e, null, p(o.state.items, (e, t) => (d(), i("button", {
|
|
412
|
-
key: `${t}:${e.segment}`,
|
|
413
|
-
type: "button",
|
|
414
|
-
role: "option",
|
|
415
|
-
class: l(["cn-completion__option flex w-full items-center gap-1.5 px-2 py-1.5 text-left", t === o.state.activeIndex ? "cn-completion__option--active" : ""]),
|
|
416
|
-
"aria-selected": t === o.state.activeIndex,
|
|
417
|
-
title: e.path ?? e.segment,
|
|
418
|
-
onClick: (e) => y("select", t)
|
|
419
|
-
}, [
|
|
420
|
-
a("span", V, h(e.segment), 1),
|
|
421
|
-
e.type ? (d(), i("span", H, h(e.type), 1)) : r("", !0),
|
|
422
|
-
e.description ?? e.title ? (d(), i("span", U, h(e.description ?? e.title), 1)) : r("", !0)
|
|
423
|
-
], 10, B))), 128))])], 36)) : r("", !0)]));
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region src/shared/completion.ts
|
|
428
|
-
function G(e, t, n, r, i) {
|
|
429
|
-
let a = t.start + 2, o = t.kind === "open" ? t.end : t.end - 2, s = Math.min(n, o), c = 0;
|
|
430
|
-
for (; s - c > a && " \n\r\0\v".includes(e[s - 1 - c]);) c += 1;
|
|
431
|
-
let l = s - c, u = l - (i.replaceLen ?? r.length);
|
|
432
|
-
if (u < a || i.replaceLen === void 0 && e.slice(u, l) !== r) return null;
|
|
433
|
-
let d = i.cursorBack ?? 0;
|
|
434
|
-
return d > i.segment.length ? null : {
|
|
435
|
-
value: e.slice(0, u) + i.segment + e.slice(l),
|
|
436
|
-
cursor: u + i.segment.length - d
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
//#endregion
|
|
440
|
-
//#region src/shared/completionAnchor.ts
|
|
441
|
-
function K(e, t) {
|
|
442
|
-
return parseFloat(e.getPropertyValue(t)) || 0;
|
|
443
|
-
}
|
|
444
|
-
function q(e, t, n) {
|
|
445
|
-
for (let r of n) {
|
|
446
|
-
let n = e.getPropertyValue(r);
|
|
447
|
-
n && t.setProperty(r, n);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
var J = [
|
|
451
|
-
"font-family",
|
|
452
|
-
"font-size",
|
|
453
|
-
"font-weight",
|
|
454
|
-
"font-style",
|
|
455
|
-
"font-stretch",
|
|
456
|
-
"letter-spacing",
|
|
457
|
-
"word-spacing",
|
|
458
|
-
"line-height",
|
|
459
|
-
"text-transform",
|
|
460
|
-
"text-indent",
|
|
461
|
-
"tab-size"
|
|
462
|
-
];
|
|
463
|
-
function Y(e) {
|
|
464
|
-
return K(e, "line-height") || K(e, "font-size") * 1.4;
|
|
465
|
-
}
|
|
466
|
-
function X(e) {
|
|
467
|
-
let t = document.createElement("div"), n = t.style;
|
|
468
|
-
return n.position = "fixed", n.top = "0", n.left = "0", n.visibility = "hidden", e(t, n), document.body.appendChild(t), t;
|
|
469
|
-
}
|
|
470
|
-
function Z(e, t) {
|
|
471
|
-
let n = e.selectionStart ?? e.value.length, r = e.getBoundingClientRect(), i = getComputedStyle(e), a = K(i, "padding-left"), o = K(i, "padding-top"), s = null, c = X((t, r) => {
|
|
472
|
-
r.whiteSpace = i.whiteSpace || "pre-wrap", r.boxSizing = "content-box", r.width = `${Math.max(0, e.clientWidth - a - K(i, "padding-right"))}px`, q(i, r, [
|
|
473
|
-
"padding-left",
|
|
474
|
-
"padding-right",
|
|
475
|
-
"padding-top",
|
|
476
|
-
"padding-bottom",
|
|
477
|
-
"word-break",
|
|
478
|
-
"overflow-wrap"
|
|
479
|
-
]), q(i, r, J), s = document.createElement("span"), s.textContent = "", t.append(document.createTextNode(e.value.slice(0, n)), s);
|
|
480
|
-
});
|
|
481
|
-
try {
|
|
482
|
-
let n = r.left + K(i, "border-left-width") + a + s.offsetLeft * t - e.scrollLeft, c = r.top + K(i, "border-top-width") + o + s.offsetTop * t - e.scrollTop;
|
|
483
|
-
return {
|
|
484
|
-
left: n,
|
|
485
|
-
top: c,
|
|
486
|
-
bottom: c + Y(i) * t
|
|
487
|
-
};
|
|
488
|
-
} finally {
|
|
489
|
-
c.remove();
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
function Q(e, t) {
|
|
493
|
-
let n = e.selectionStart ?? e.value.length, r = e.getBoundingClientRect(), i = getComputedStyle(e), a = X((t, r) => {
|
|
494
|
-
r.display = "inline-block", r.whiteSpace = "pre", q(i, r, J), t.textContent = e.value.slice(0, n);
|
|
495
|
-
});
|
|
496
|
-
try {
|
|
497
|
-
let n = a.getBoundingClientRect().width || a.offsetWidth;
|
|
498
|
-
return {
|
|
499
|
-
left: r.left + K(i, "border-left-width") + K(i, "padding-left") + n * t - e.scrollLeft,
|
|
500
|
-
top: r.top + K(i, "border-top-width"),
|
|
501
|
-
bottom: r.bottom - K(i, "border-bottom-width")
|
|
502
|
-
};
|
|
503
|
-
} finally {
|
|
504
|
-
a.remove();
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
function $(e, t = 1) {
|
|
508
|
-
return e instanceof HTMLTextAreaElement ? Z(e, t) : Q(e, t);
|
|
509
|
-
}
|
|
510
|
-
//#endregion
|
|
511
|
-
//#region src/shared/popupPosition.ts
|
|
512
|
-
var ee = 4, te = 4;
|
|
513
|
-
function ne(e) {
|
|
514
|
-
let { anchor: t, popupWidth: n, popupHeight: r, viewportWidth: i, viewportHeight: a } = e, o = e.gap ?? 4, s = e.margin ?? 4, c = t.bottom + o;
|
|
515
|
-
if (r > 0 && c + r > a - s) {
|
|
516
|
-
let e = t.top - o - r;
|
|
517
|
-
c = e >= s ? e : Math.max(s, Math.min(c, a - s - r));
|
|
518
|
-
}
|
|
519
|
-
let l = t.left;
|
|
520
|
-
return n > 0 && (l = Math.max(s, Math.min(l, i - s - n))), {
|
|
521
|
-
top: c,
|
|
522
|
-
left: l
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
//#endregion
|
|
526
|
-
export { G as a, L as c, M as d, k as f, y as g, b as h, $ as i, N as l, x as m, te as n, W as o, S as p, ne as r, R as s, ee as t, I as u };
|