@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.
- package/dist/canvas/CanvasSurface.d.ts +28 -1
- package/dist/canvas/{ContentTypePill.d.ts → EditOverlayToolbar.d.ts} +19 -0
- package/dist/canvas/TextEditingOverlay.d.ts +31 -3
- package/dist/canvas/index.d.ts +1 -1
- package/dist/canvas/useTextEditing.d.ts +30 -8
- package/dist/{canvas-ZMyaouKe.js → canvas-DqQislJ_.js} +813 -434
- package/dist/canvas.js +2 -2
- package/dist/index.js +15 -14
- package/dist/{layer-panel-CEyB57XM.js → layer-panel-DskyCgF5.js} +7 -7
- package/dist/layer-panel.js +1 -1
- package/dist/panel-theme.css +24 -0
- package/dist/{completionAnchor-Da8VhzMQ.js → popupPosition-Ck5Gsvjy.js} +163 -107
- package/dist/property-panel/PropertyField.d.ts +6 -0
- package/dist/property-panel/fieldSchema.d.ts +7 -1
- package/dist/property-panel/fields/ImageSrcField.d.ts +5 -1
- package/dist/property-panel/fields/ResourceValueField.d.ts +19 -0
- package/dist/property-panel/fields/TextareaField.d.ts +1 -0
- package/dist/property-panel/fields/ValueTypeSegmented.d.ts +3 -1
- package/dist/property-panel/index.d.ts +5 -3
- package/dist/property-panel/usePropertyPanel.d.ts +16 -4
- package/dist/{property-panel-DmSf_GPu.js → property-panel-B32ZBQdf.js} +472 -376
- package/dist/property-panel.js +3 -2
- package/dist/resourceTemplate-cdcQtp9a.js +246 -0
- package/dist/shared/ExpressionPathPicker.d.ts +25 -0
- package/dist/shared/completion.d.ts +14 -10
- package/dist/shared/expressionContext.d.ts +2 -2
- package/dist/shared/index.d.ts +14 -1
- package/dist/shared/mergeKey.d.ts +2 -0
- package/dist/shared/pathPickerModel.d.ts +11 -0
- package/dist/shared/popupPosition.d.ts +41 -0
- package/dist/shared/resourceTemplate.d.ts +7 -0
- package/dist/shared/useExpressionCompletion.d.ts +0 -7
- package/dist/shared/useExpressionDiagnostics.d.ts +15 -0
- package/dist/shared.js +10 -9
- package/dist/style.css +1 -1
- package/dist/uploadFile-D1RY-ji0.js +516 -0
- package/dist/usePathCompletion-Do17CQ6l.js +220 -0
- package/package.json +2 -2
- package/dist/uploadFile-DXAEX9kG.js +0 -455
- package/dist/usePathCompletion-C52F4phW.js +0 -229
- /package/dist/{property-panel → shared}/fontPicker.d.ts +0 -0
package/dist/canvas.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-
|
|
2
|
-
export { e as AlignFloatBar, n as CanvasSurface,
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-DqQislJ_.js";
|
|
2
|
+
export { e as AlignFloatBar, n as CanvasSurface, a as ContextMenu, f as EditOverlayToolbar, l as FindBar, m as GuidesOverlay, d as Ruler, c as TextEditingOverlay, u as createGizmoOverlayPainter, h as createRafScheduler, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, r as useDpr, o as useFindSession, g as useTextEditing, i as watchDprChanges };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-
|
|
2
|
-
import { a as _, i as v, n as y, o as b, r as x, s as S, t as C } from "./layer-panel-
|
|
3
|
-
import { a as w, c as T, d as E, f as D, i as O, l as k,
|
|
4
|
-
import { i as
|
|
5
|
-
import { c as
|
|
6
|
-
import { i as
|
|
7
|
-
import { n as
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import { n as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./canvas-DqQislJ_.js";
|
|
2
|
+
import { a as _, i as v, n as y, o as b, r as x, s as S, t as C } from "./layer-panel-DskyCgF5.js";
|
|
3
|
+
import { a as w, c as T, d as E, f as D, i as O, l as k, n as A, o as j, r as M, s as N, t as P, u as F } from "./property-panel-B32ZBQdf.js";
|
|
4
|
+
import { a as I, i as L, n as R, o as z, r as B, s as V, t as H } from "./popupPosition-Ck5Gsvjy.js";
|
|
5
|
+
import { c as U, i as W, n as G, s as K, t as q } from "./useTransientFeedback-CTjmMmFF.js";
|
|
6
|
+
import { a as J, c as Y, i as X, l as Z, n as Q, o as $, r as ee, s as te, t as ne } from "./uploadFile-D1RY-ji0.js";
|
|
7
|
+
import { i as re, n as ie, r as ae, t as oe } from "./resourceTemplate-cdcQtp9a.js";
|
|
8
|
+
import { n as se, t as ce } from "./usePathCompletion-Do17CQ6l.js";
|
|
9
|
+
import { n as le, t as ue } from "./useViewport-D9Ipevzs.js";
|
|
10
|
+
import { n as de, r as fe, t as pe } from "./useDataSourceSchema-CGbldbUj.js";
|
|
11
|
+
import { n as me, r as he, t as ge } from "./status-bar-_PvEXyq8.js";
|
|
12
|
+
import { t as _e } from "./useShortcutsHelp-CsyarO2P.js";
|
|
13
|
+
import { n as ve, r as ye, t as be } from "./shared-wuupBoZg.js";
|
|
13
14
|
//#region src/index.ts
|
|
14
|
-
var
|
|
15
|
+
var xe = "@hankchen/canvas-editor-vue";
|
|
15
16
|
//#endregion
|
|
16
|
-
export { v as ADD_LAYER_MENU, _ as ADD_MENU, b as ADD_TEXT_PRESET_MENU,
|
|
17
|
+
export { v as ADD_LAYER_MENU, _ as ADD_MENU, b as ADD_TEXT_PRESET_MENU, W as ARM_LAYER_CREATE_HINT, e as AlignFloatBar, N as CANVAS_FIELD_SECTIONS, n as CanvasSurface, a as ContextMenu, de as DropdownMenu, f as EditOverlayToolbar, z as ExpressionCompletionPopup, ae as ExpressionPathPicker, T as FIELD_SECTIONS_BY_TYPE, ee as FONT_PICKER_KEY, l as FindBar, m as GuidesOverlay, ye as HelpDialog, w as IMAGE_UPLOAD_KEY, C as LayerPanel, xe as PACKAGE_NAME, S as PANEL_ADD_MENU, H as POPUP_GAP, R as POPUP_MARGIN, V as PanelIcon, A as PropertyField, P as PropertyPanel, d as Ruler, ge as StatusBar, c as TextEditingOverlay, I as applyCompletion, oe as attachResourceTemplate, O as controlRegistry, u as createGizmoOverlayPainter, h as createRafScheduler, K as detectShortcutPlatform, t as drawCreateRubberBand, s as drawFindMatches, p as drawSelectionGizmo, Y as expressionCompletionSource, J as expressionDiagnosticHint, Z as expressionFieldContext, k as fieldSectionsForPath, F as fieldSectionsForType, me as formatLayerGeometry, he as formatLayerPath, X as injectFontPicker, j as injectImageUpload, G as isEditableEventTarget, y as isUpperHalf, E as layerRoleAt, L as measureCursorAnchor, re as pathPickerEntries, B as placePopupInViewport, D as readField, se as rowsPathCompletionSource, Q as selectionFieldMergeKey, U as shortcutActionLabel, ie as stripResourceTemplate, ne as uploadFileFromDom, pe as useDataSourceSchema, r as useDpr, fe as useDropdownMenu, te as useExpressionCompletion, $ as useExpressionDiagnostics, o as useFindSession, ve as useHistory, x as useLayerPanel, ce as usePathCompletion, M as usePropertyPanel, le as useSelection, be as useShortcuts, _e as useShortcutsHelp, g as useTextEditing, q as useTransientFeedback, ue as useViewport, i as watchDprChanges };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./createLucideIcon-SCvtEGVf.js";
|
|
2
2
|
import { i as t, r as n, t as r } from "./layerPath-uy2ywyld.js";
|
|
3
|
-
import { i,
|
|
3
|
+
import { o as i, s as a, u as o } from "./popupPosition-Ck5Gsvjy.js";
|
|
4
4
|
import { c as s, i as c, s as l, t as u } from "./useTransientFeedback-CTjmMmFF.js";
|
|
5
|
-
import { n as ee, t as te } from "./usePathCompletion-
|
|
5
|
+
import { n as ee, t as te } from "./usePathCompletion-Do17CQ6l.js";
|
|
6
6
|
import { n as ne, t as re } from "./useDataSourceSchema-CGbldbUj.js";
|
|
7
7
|
import { Fragment as d, computed as f, createBlock as ie, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createVNode as g, defineComponent as _, nextTick as ae, normalizeClass as v, normalizeStyle as oe, onScopeDispose as y, openBlock as b, ref as x, renderList as se, shallowRef as S, toDisplayString as ce, unref as C, vModelText as w, watch as le, withCtx as T, withDirectives as E, withKeys as D, withModifiers as O } from "vue";
|
|
8
8
|
var ue = e({
|
|
@@ -546,7 +546,7 @@ var ge = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
546
546
|
}, " 取消 ", 8, we)])
|
|
547
547
|
], 64)) : p("", !0)]),
|
|
548
548
|
_: 1
|
|
549
|
-
}, 8, ["items"]), S.value ? (b(), ie(
|
|
549
|
+
}, 8, ["items"]), S.value ? (b(), ie(i, {
|
|
550
550
|
key: 0,
|
|
551
551
|
ref_key: "pathPopupRef",
|
|
552
552
|
ref: B,
|
|
@@ -585,7 +585,7 @@ var ge = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
585
585
|
title: "拖动排序",
|
|
586
586
|
class: "cn-layers__handle shrink-0",
|
|
587
587
|
onDragstart: (t) => X(e, t)
|
|
588
|
-
}, [g(
|
|
588
|
+
}, [g(a, {
|
|
589
589
|
icon: C(fe),
|
|
590
590
|
size: 12,
|
|
591
591
|
"stroke-width": 2.5
|
|
@@ -620,7 +620,7 @@ var ge = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
620
620
|
title: e.node.visible ? "隐藏图层(最终输出不含该层)" : "显示图层",
|
|
621
621
|
"aria-pressed": !e.node.visible,
|
|
622
622
|
onClick: O((t) => Ke(e), ["stop"])
|
|
623
|
-
}, [g(
|
|
623
|
+
}, [g(a, {
|
|
624
624
|
icon: e.node.visible ? C(de) : C(ue),
|
|
625
625
|
size: 11,
|
|
626
626
|
"stroke-width": 2
|
|
@@ -633,7 +633,7 @@ var ge = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
633
633
|
title: e.node.locked ? o : "锁定图层(画布不可点选/拖动/删除,渲染照常)",
|
|
634
634
|
"aria-pressed": e.node.locked,
|
|
635
635
|
onClick: O((t) => qe(e), ["stop"])
|
|
636
|
-
}, [g(
|
|
636
|
+
}, [g(a, {
|
|
637
637
|
icon: e.node.locked ? C(me) : C(pe),
|
|
638
638
|
size: 11,
|
|
639
639
|
"stroke-width": 2
|
|
@@ -645,7 +645,7 @@ var ge = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
645
645
|
class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
646
646
|
title: "重命名(双击名称或 F2)",
|
|
647
647
|
onClick: O((t) => rt(e), ["stop"])
|
|
648
|
-
}, [g(
|
|
648
|
+
}, [g(a, {
|
|
649
649
|
icon: C(he),
|
|
650
650
|
size: 11,
|
|
651
651
|
"stroke-width": 2
|
package/dist/layer-panel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./layer-panel-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./layer-panel-DskyCgF5.js";
|
|
2
2
|
export { t as ADD_LAYER_MENU, e as ADD_MENU, r as ADD_TEXT_PRESET_MENU, o as LayerPanel, a as PANEL_ADD_MENU, n as isUpperHalf, i as useLayerPanel };
|
package/dist/panel-theme.css
CHANGED
|
@@ -252,3 +252,27 @@
|
|
|
252
252
|
background-color: var(--cn-accent-soft);
|
|
253
253
|
color: var(--cn-accent);
|
|
254
254
|
}
|
|
255
|
+
|
|
256
|
+
/* ---- 资源路径选择器浮层(resource-expression-single-ref 工单 05)----
|
|
257
|
+
portal 到 body 后脱离面板 DOM 子树,根元素自带 .cn-props 重建令牌命名空间;
|
|
258
|
+
抬升底色/投影与高亮态与补全浮层同语言(option 几何以 tailwind utility 留在
|
|
259
|
+
组件模板)。只读展示框的盒子视觉(bg/border/圆角)同 cn-field 输入框族。 */
|
|
260
|
+
.cn-props.cn-pathpicker__menu {
|
|
261
|
+
background-color: var(--cn-bg-elevated);
|
|
262
|
+
box-shadow: 0 16px 40px -12px rgba(2, 6, 23, 0.55);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.cn-props .cn-pathpicker__option--active {
|
|
266
|
+
background-color: var(--cn-accent-soft);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* 选择器的状态描边(工单 05):PropertyField 的状态类(cn-field--expression/
|
|
270
|
+
cn-field--invalid)经 fallthrough 落在选择器根盒(flex 容器无边框),描边经
|
|
271
|
+
后代选择器落到只读展示框——与 cn-field--invalid 单类规则同值的定向版 */
|
|
272
|
+
.cn-props .cn-field--expression .cn-pathpicker__value {
|
|
273
|
+
border-color: var(--cn-accent);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.cn-props .cn-field--invalid .cn-pathpicker__value {
|
|
277
|
+
border-color: var(--cn-danger);
|
|
278
|
+
}
|
|
@@ -18,15 +18,10 @@ function y(e, t) {
|
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
20
|
function b(e) {
|
|
21
|
-
|
|
22
|
-
let t = e.properties === void 0 ? [] : [...e.properties].map(([e, t]) => ({
|
|
21
|
+
return e.type === "array" || e.items !== void 0 ? { entries: [] } : { entries: e.properties === void 0 ? [] : [...e.properties].map(([e, t]) => ({
|
|
23
22
|
key: e,
|
|
24
23
|
node: t
|
|
25
|
-
}));
|
|
26
|
-
return e.open === !0 ? {
|
|
27
|
-
entries: t,
|
|
28
|
-
open: !0
|
|
29
|
-
} : { entries: t };
|
|
24
|
+
})) };
|
|
30
25
|
}
|
|
31
26
|
function x(e, t) {
|
|
32
27
|
let n = t.split(".");
|
|
@@ -75,7 +70,18 @@ function D(e, t) {
|
|
|
75
70
|
for (; t < e.length && w.includes(e[t]);) t += 1;
|
|
76
71
|
return t;
|
|
77
72
|
}
|
|
78
|
-
function O(e) {
|
|
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) {
|
|
79
85
|
let t = 0;
|
|
80
86
|
for (; t < e.length && !T.includes(e[t]);) t += 1;
|
|
81
87
|
if (t === 0) return !1;
|
|
@@ -83,92 +89,86 @@ function O(e) {
|
|
|
83
89
|
for (; n < e.length && C.includes(e[n]);) n += 1;
|
|
84
90
|
return e[n] === "(";
|
|
85
91
|
}
|
|
86
|
-
function
|
|
92
|
+
function A(e) {
|
|
87
93
|
let t = 0;
|
|
88
94
|
for (; t < e.length && !T.includes(e[t]);) t += 1;
|
|
89
|
-
if (t === 0) return
|
|
90
|
-
ok: !1,
|
|
91
|
-
error: "expression_syntax_error"
|
|
92
|
-
};
|
|
95
|
+
if (t === 0) return O("invalid_path", 0, e.length);
|
|
93
96
|
let n = e.slice(0, t), r = D(e, t);
|
|
94
|
-
if (r >= e.length || e[r] !== "(") return
|
|
95
|
-
|
|
96
|
-
error: "expression_syntax_error"
|
|
97
|
-
};
|
|
97
|
+
if (r >= e.length || e[r] !== "(") return O("missing_open_paren", t, e.length);
|
|
98
|
+
let i = r;
|
|
98
99
|
r = D(e, r + 1);
|
|
99
|
-
let
|
|
100
|
+
let a = [], o = [];
|
|
100
101
|
if (r < e.length && e[r] === ")") r += 1;
|
|
101
102
|
else for (;;) {
|
|
102
|
-
if (r >= e.length) return
|
|
103
|
-
|
|
104
|
-
error: "expression_syntax_error"
|
|
105
|
-
};
|
|
106
|
-
let t = A(e, r);
|
|
103
|
+
if (r >= e.length) return O("unbalanced_paren", i, e.length);
|
|
104
|
+
let t = j(e, r);
|
|
107
105
|
if (!t.ok) return t;
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
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);
|
|
112
110
|
if (e[r] === ",") {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
error: "expression_syntax_error"
|
|
116
|
-
};
|
|
111
|
+
let t = r;
|
|
112
|
+
if (r = D(e, r + 1), r < e.length && e[r] === ")") return O("empty_arg_slot", t + 1, r);
|
|
117
113
|
continue;
|
|
118
114
|
}
|
|
119
115
|
if (e[r] === ")") {
|
|
120
116
|
r += 1;
|
|
121
117
|
break;
|
|
122
118
|
}
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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);
|
|
127
129
|
}
|
|
128
|
-
if (D(e, r) !== e.length || i[0] !== void 0 && i[0].type !== "path") return {
|
|
129
|
-
ok: !1,
|
|
130
|
-
error: "expression_syntax_error"
|
|
131
|
-
};
|
|
132
|
-
for (let e of i) if (e.type === "path" && !S(e.value).ok) return {
|
|
133
|
-
ok: !1,
|
|
134
|
-
error: "expression_syntax_error"
|
|
135
|
-
};
|
|
136
130
|
return {
|
|
137
131
|
ok: !0,
|
|
138
132
|
name: n,
|
|
139
|
-
args:
|
|
133
|
+
args: a
|
|
140
134
|
};
|
|
141
135
|
}
|
|
142
|
-
function
|
|
143
|
-
let n = e.length, r = e[t];
|
|
144
|
-
if (
|
|
145
|
-
let
|
|
136
|
+
function j(e, t) {
|
|
137
|
+
let n = e.length, r = t, i = e[t];
|
|
138
|
+
if (i === "'") {
|
|
139
|
+
let i = t + 1, a = "";
|
|
146
140
|
for (;;) {
|
|
147
|
-
if (
|
|
141
|
+
if (i >= n) return {
|
|
148
142
|
ok: !1,
|
|
149
|
-
error: "expression_syntax_error"
|
|
143
|
+
error: "expression_syntax_error",
|
|
144
|
+
kind: "unterminated_string",
|
|
145
|
+
at: {
|
|
146
|
+
start: r,
|
|
147
|
+
end: n
|
|
148
|
+
}
|
|
150
149
|
};
|
|
151
|
-
if (e[
|
|
152
|
-
if (
|
|
153
|
-
|
|
150
|
+
if (e[i] === "'") {
|
|
151
|
+
if (i + 1 < n && e[i + 1] === "'") {
|
|
152
|
+
a += "'", i += 2;
|
|
154
153
|
continue;
|
|
155
154
|
}
|
|
156
|
-
|
|
155
|
+
i += 1;
|
|
157
156
|
break;
|
|
158
157
|
}
|
|
159
|
-
|
|
158
|
+
a += e[i], i += 1;
|
|
160
159
|
}
|
|
161
160
|
return {
|
|
162
161
|
ok: !0,
|
|
163
162
|
value: {
|
|
164
163
|
type: "string",
|
|
165
|
-
value:
|
|
164
|
+
value: a
|
|
166
165
|
},
|
|
167
|
-
|
|
166
|
+
start: r,
|
|
167
|
+
end: i
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
if (
|
|
171
|
-
let
|
|
170
|
+
if (i >= "0" && i <= "9") {
|
|
171
|
+
let i = (t) => {
|
|
172
172
|
let n = e[t];
|
|
173
173
|
return n !== void 0 && n >= "0" && n <= "9";
|
|
174
174
|
};
|
|
@@ -180,25 +180,31 @@ function A(e, t) {
|
|
|
180
180
|
type: "number",
|
|
181
181
|
value: e.slice(r, t)
|
|
182
182
|
},
|
|
183
|
+
start: r,
|
|
183
184
|
end: t
|
|
184
185
|
};
|
|
185
186
|
}
|
|
186
|
-
let i = t;
|
|
187
187
|
for (; t < n && e[t] !== "," && e[t] !== ")";) t += 1;
|
|
188
|
-
let a = E(e.slice(
|
|
188
|
+
let a = E(e.slice(r, t));
|
|
189
189
|
return a === "" ? {
|
|
190
190
|
ok: !1,
|
|
191
|
-
error: "expression_syntax_error"
|
|
191
|
+
error: "expression_syntax_error",
|
|
192
|
+
kind: "empty_arg_slot",
|
|
193
|
+
at: {
|
|
194
|
+
start: r,
|
|
195
|
+
end: t
|
|
196
|
+
}
|
|
192
197
|
} : {
|
|
193
198
|
ok: !0,
|
|
194
199
|
value: {
|
|
195
200
|
type: "path",
|
|
196
201
|
value: a
|
|
197
202
|
},
|
|
203
|
+
start: r,
|
|
198
204
|
end: t
|
|
199
205
|
};
|
|
200
206
|
}
|
|
201
|
-
function
|
|
207
|
+
function M(e) {
|
|
202
208
|
let t = 0;
|
|
203
209
|
for (; t < e.length && !T.includes(e[t]);) t += 1;
|
|
204
210
|
if (t === 0) return null;
|
|
@@ -254,16 +260,41 @@ function j(e) {
|
|
|
254
260
|
r += 1, n = D(e, n + 1);
|
|
255
261
|
}
|
|
256
262
|
}
|
|
257
|
-
function
|
|
263
|
+
function N(e) {
|
|
258
264
|
let t = 0, n = e.length;
|
|
259
265
|
for (; t < n && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
260
266
|
for (; n > t && " \n\r\0\v".includes(e[n - 1]);) --n;
|
|
261
267
|
return e.slice(t, n);
|
|
262
268
|
}
|
|
263
|
-
function N(e) {
|
|
264
|
-
return e === "" ? "expression_syntax_error" : O(e) ? k(e).ok ? null : "expression_syntax_error" : S(e).ok ? null : "expression_syntax_error";
|
|
265
|
-
}
|
|
266
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) {
|
|
267
298
|
let t = [], n = 0, r = e.indexOf("{{");
|
|
268
299
|
for (; r !== -1;) {
|
|
269
300
|
let i = e.indexOf("}}", r + 2);
|
|
@@ -280,7 +311,7 @@ function P(e) {
|
|
|
280
311
|
start: r,
|
|
281
312
|
end: e.length,
|
|
282
313
|
text: i,
|
|
283
|
-
expr:
|
|
314
|
+
expr: N(i.slice(2))
|
|
284
315
|
}), {
|
|
285
316
|
template: e,
|
|
286
317
|
parts: t
|
|
@@ -292,14 +323,27 @@ function P(e) {
|
|
|
292
323
|
end: r,
|
|
293
324
|
text: e.slice(n, r)
|
|
294
325
|
});
|
|
295
|
-
let a = e.slice(r + 2, i), o =
|
|
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
|
+
}
|
|
296
339
|
t.push({
|
|
297
340
|
kind: "fragment",
|
|
298
341
|
start: r,
|
|
299
342
|
end: i + 2,
|
|
300
343
|
raw: a,
|
|
301
344
|
expr: o,
|
|
302
|
-
error: s
|
|
345
|
+
error: s === null ? null : "expression_syntax_error",
|
|
346
|
+
diagnostic: s
|
|
303
347
|
}), n = i + 2, r = e.indexOf("{{", n);
|
|
304
348
|
}
|
|
305
349
|
return n < e.length && t.push({
|
|
@@ -312,13 +356,13 @@ function P(e) {
|
|
|
312
356
|
parts: t
|
|
313
357
|
};
|
|
314
358
|
}
|
|
315
|
-
function
|
|
359
|
+
function L(e, t) {
|
|
316
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;
|
|
317
361
|
return null;
|
|
318
362
|
}
|
|
319
363
|
//#endregion
|
|
320
364
|
//#region src/shared/PanelIcon.vue
|
|
321
|
-
var
|
|
365
|
+
var R = /* @__PURE__ */ o({
|
|
322
366
|
inheritAttrs: !1,
|
|
323
367
|
__name: "PanelIcon",
|
|
324
368
|
props: {
|
|
@@ -332,23 +376,20 @@ var I = /* @__PURE__ */ o({
|
|
|
332
376
|
"stroke-width": e.strokeWidth
|
|
333
377
|
}, t.$attrs), null, 16, ["size", "stroke-width"]));
|
|
334
378
|
}
|
|
335
|
-
}),
|
|
379
|
+
}), z = {
|
|
336
380
|
role: "listbox",
|
|
337
381
|
"aria-label": "表达式路径候选"
|
|
338
|
-
},
|
|
382
|
+
}, B = [
|
|
339
383
|
"aria-selected",
|
|
340
384
|
"title",
|
|
341
385
|
"onClick"
|
|
342
|
-
],
|
|
386
|
+
], V = { class: "cn-completion__segment font-mono text-cn-fg" }, H = {
|
|
343
387
|
key: 0,
|
|
344
388
|
class: "shrink-0 rounded-sm bg-cn-field px-1 py-0.5 text-[9px] leading-none text-cn-muted"
|
|
345
|
-
},
|
|
389
|
+
}, U = {
|
|
346
390
|
key: 1,
|
|
347
391
|
class: "truncate text-[10px] leading-none text-cn-muted"
|
|
348
|
-
},
|
|
349
|
-
key: 0,
|
|
350
|
-
class: "cn-completion__hint px-2 py-1.5 text-[10px] leading-none text-cn-muted"
|
|
351
|
-
}, U = /* @__PURE__ */ o({
|
|
392
|
+
}, W = /* @__PURE__ */ o({
|
|
352
393
|
__name: "ExpressionCompletionPopup",
|
|
353
394
|
props: { state: {} },
|
|
354
395
|
emits: ["select"],
|
|
@@ -367,7 +408,7 @@ var I = /* @__PURE__ */ o({
|
|
|
367
408
|
}),
|
|
368
409
|
onMousedown: c[0] ||= _(() => {}, ["prevent", "stop"]),
|
|
369
410
|
onPointerdown: c[1] ||= _(() => {}, ["stop"])
|
|
370
|
-
}, [a("div",
|
|
411
|
+
}, [a("div", z, [(d(!0), i(e, null, p(o.state.items, (e, t) => (d(), i("button", {
|
|
371
412
|
key: `${t}:${e.segment}`,
|
|
372
413
|
type: "button",
|
|
373
414
|
role: "option",
|
|
@@ -376,15 +417,15 @@ var I = /* @__PURE__ */ o({
|
|
|
376
417
|
title: e.path ?? e.segment,
|
|
377
418
|
onClick: (e) => y("select", t)
|
|
378
419
|
}, [
|
|
379
|
-
a("span",
|
|
380
|
-
e.type ? (d(), i("span",
|
|
381
|
-
e.description ?? e.title ? (d(), i("span",
|
|
382
|
-
], 10,
|
|
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)]));
|
|
383
424
|
}
|
|
384
425
|
});
|
|
385
426
|
//#endregion
|
|
386
427
|
//#region src/shared/completion.ts
|
|
387
|
-
function
|
|
428
|
+
function G(e, t, n, r, i) {
|
|
388
429
|
let a = t.start + 2, o = t.kind === "open" ? t.end : t.end - 2, s = Math.min(n, o), c = 0;
|
|
389
430
|
for (; s - c > a && " \n\r\0\v".includes(e[s - 1 - c]);) c += 1;
|
|
390
431
|
let l = s - c, u = l - (i.replaceLen ?? r.length);
|
|
@@ -397,16 +438,16 @@ function W(e, t, n, r, i) {
|
|
|
397
438
|
}
|
|
398
439
|
//#endregion
|
|
399
440
|
//#region src/shared/completionAnchor.ts
|
|
400
|
-
function
|
|
441
|
+
function K(e, t) {
|
|
401
442
|
return parseFloat(e.getPropertyValue(t)) || 0;
|
|
402
443
|
}
|
|
403
|
-
function
|
|
444
|
+
function q(e, t, n) {
|
|
404
445
|
for (let r of n) {
|
|
405
446
|
let n = e.getPropertyValue(r);
|
|
406
447
|
n && t.setProperty(r, n);
|
|
407
448
|
}
|
|
408
449
|
}
|
|
409
|
-
var
|
|
450
|
+
var J = [
|
|
410
451
|
"font-family",
|
|
411
452
|
"font-size",
|
|
412
453
|
"font-weight",
|
|
@@ -419,52 +460,67 @@ var q = [
|
|
|
419
460
|
"text-indent",
|
|
420
461
|
"tab-size"
|
|
421
462
|
];
|
|
422
|
-
function J(e) {
|
|
423
|
-
return G(e, "line-height") || G(e, "font-size") * 1.4;
|
|
424
|
-
}
|
|
425
463
|
function Y(e) {
|
|
464
|
+
return K(e, "line-height") || K(e, "font-size") * 1.4;
|
|
465
|
+
}
|
|
466
|
+
function X(e) {
|
|
426
467
|
let t = document.createElement("div"), n = t.style;
|
|
427
468
|
return n.position = "fixed", n.top = "0", n.left = "0", n.visibility = "hidden", e(t, n), document.body.appendChild(t), t;
|
|
428
469
|
}
|
|
429
|
-
function
|
|
430
|
-
let n = e.selectionStart ?? e.value.length, r = e.getBoundingClientRect(), i = getComputedStyle(e), a =
|
|
431
|
-
r.whiteSpace = i.whiteSpace || "pre-wrap", r.boxSizing = "content-box", r.width = `${Math.max(0, e.clientWidth - a -
|
|
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, [
|
|
432
473
|
"padding-left",
|
|
433
474
|
"padding-right",
|
|
434
475
|
"padding-top",
|
|
435
476
|
"padding-bottom",
|
|
436
477
|
"word-break",
|
|
437
478
|
"overflow-wrap"
|
|
438
|
-
]),
|
|
479
|
+
]), q(i, r, J), s = document.createElement("span"), s.textContent = "", t.append(document.createTextNode(e.value.slice(0, n)), s);
|
|
439
480
|
});
|
|
440
481
|
try {
|
|
441
|
-
let n = r.left +
|
|
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;
|
|
442
483
|
return {
|
|
443
484
|
left: n,
|
|
444
485
|
top: c,
|
|
445
|
-
bottom: c +
|
|
486
|
+
bottom: c + Y(i) * t
|
|
446
487
|
};
|
|
447
488
|
} finally {
|
|
448
489
|
c.remove();
|
|
449
490
|
}
|
|
450
491
|
}
|
|
451
|
-
function
|
|
452
|
-
let n = e.selectionStart ?? e.value.length, r = e.getBoundingClientRect(), i = getComputedStyle(e), a =
|
|
453
|
-
r.display = "inline-block", r.whiteSpace = "pre",
|
|
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);
|
|
454
495
|
});
|
|
455
496
|
try {
|
|
456
497
|
let n = a.getBoundingClientRect().width || a.offsetWidth;
|
|
457
498
|
return {
|
|
458
|
-
left: r.left +
|
|
459
|
-
top: r.top +
|
|
460
|
-
bottom: r.bottom -
|
|
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")
|
|
461
502
|
};
|
|
462
503
|
} finally {
|
|
463
504
|
a.remove();
|
|
464
505
|
}
|
|
465
506
|
}
|
|
466
|
-
function
|
|
467
|
-
return e instanceof HTMLTextAreaElement ?
|
|
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
|
+
};
|
|
468
524
|
}
|
|
469
525
|
//#endregion
|
|
470
|
-
export {
|
|
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 };
|
|
@@ -7,6 +7,12 @@ type __VLS_Props = {
|
|
|
7
7
|
value: unknown;
|
|
8
8
|
/** 数据字段取值方式;undefined = 非 data 字段(无切换钮) */
|
|
9
9
|
dataMode?: 'static' | 'expression';
|
|
10
|
+
/**
|
|
11
|
+
* 会话内容锁定(edit-overlay-toolbar 工单 02,ADR 0019 门面):编辑会话期
|
|
12
|
+
* data 字段的输入控件与模式段 disabled——编辑框草稿是内容唯一写入门,面板
|
|
13
|
+
* 只显示(文档现值 + 随会话活标志的模式段)。undefined/false = 照常可编辑。
|
|
14
|
+
*/
|
|
15
|
+
locked?: boolean;
|
|
10
16
|
/**
|
|
11
17
|
* 补全候选源(面板按字段分发:data 门字段 = 表达式源,rowsPath 标记字段 =
|
|
12
18
|
* 行相对源,工单 03);null = 未注入/无接线/降级(浮层恒闭)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Layer, LayerPath, LayerType, ResourceStatusMap } from '@hankchen/canvas-editor';
|
|
2
2
|
/** 控件种类(与 controls.ts 的组件注册表一一对应) */
|
|
3
|
-
export type FieldControl = 'number' | 'text' | 'textarea' | 'color' | 'select' | 'boolean' | 'pair' | 'anchor' | 'align' | 'padding' | 'border' | 'font' | 'imageSrc';
|
|
3
|
+
export type FieldControl = 'number' | 'text' | 'textarea' | 'color' | 'select' | 'boolean' | 'pair' | 'anchor' | 'align' | 'padding' | 'border' | 'font' | 'imageSrc' | 'resourceValue';
|
|
4
4
|
/**
|
|
5
5
|
* 自适应 prefix 钮描述(pair 子字段用):key 相对 pair 值对象上的布尔键;
|
|
6
6
|
* 开启 → 本输入禁用。placeholder 是禁用态兜底占位(盒未解析时;正常路径面板
|
|
@@ -33,6 +33,12 @@ export interface FieldDef {
|
|
|
33
33
|
readonly auto?: FieldAutoToggle;
|
|
34
34
|
/** 数据字段:提交走 updateData(按 type 分派到 text/src/value),其余走 updateSpec */
|
|
35
35
|
readonly data?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 资源类内容字段(resource-expression-single-ref 工单 03,ADR 0020):表达式态
|
|
38
|
+
* 诊断走内核资源单值门(resourcePathDiagnostics——恰一闭合片段 + 裸点路径,
|
|
39
|
+
* 禁拼接/函数),不走片段级扫描诊断。图片地址/二维码值两类声明。
|
|
40
|
+
*/
|
|
41
|
+
readonly resource?: true;
|
|
36
42
|
/**
|
|
37
43
|
* 补全标记门(rows-path-completion 工单 03,D6):'rowsPath' = 裸路径补全
|
|
38
44
|
* (usePathCompletion,候选源 = 面板 rowsPathSource)——不走 data 门
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ResourceStatus } from '@hankchen/canvas-editor';
|
|
2
|
+
import { CompletionSource } from '../../shared/completion';
|
|
2
3
|
import { FieldDef } from '../fieldSchema';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
field: FieldDef;
|
|
5
6
|
modelValue: string | null;
|
|
6
|
-
/** 取值方式(面板按 expression
|
|
7
|
+
/** 取值方式(面板按 expression 标记派生):表达式态走选择器,静态态走上传形态 */
|
|
7
8
|
dataMode?: 'static' | 'expression';
|
|
8
9
|
/** 当前 src 的物化态(面板从 ui.resourceStatuses 切片解析下发):角标与画布失败标识同源 */
|
|
9
10
|
resourceStatus?: ResourceStatus;
|
|
11
|
+
/** 候选源(面板同款注入缝,PropertyField 经 resource 门下发);null = 未绑声明只读 */
|
|
12
|
+
source?: CompletionSource | null;
|
|
13
|
+
disabled?: boolean;
|
|
10
14
|
};
|
|
11
15
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
12
16
|
input: (value: string) => any;
|