@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,3 +1,3 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./property-panel-B32ZBQdf.js";
2
- import { i as f, r as p } from "./uploadFile-D1RY-ji0.js";
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./property-panel-DJQJzioT.js";
2
+ import { i as f, r as p } from "./uploadFile-mXJVPEzm.js";
3
3
  export { l as CANVAS_FIELD_SECTIONS, t as FIELD_SECTIONS_BY_TYPE, p as FONT_PICKER_KEY, e as IMAGE_UPLOAD_KEY, o as PropertyField, u as PropertyPanel, i as controlRegistry, a as fieldSectionsForPath, d as fieldSectionsForType, f as injectFontPicker, s as injectImageUpload, n as layerRoleAt, r as readField, c as usePropertyPanel };
@@ -0,0 +1,33 @@
1
+ import { f as e } from "./ExpressionPathPicker-DchGsK70.js";
2
+ //#region ../canvas-editor/src/shared/resourcePath.ts
3
+ function t(e, t) {
4
+ return {
5
+ kind: t,
6
+ start: 0,
7
+ end: e.length,
8
+ at: {
9
+ start: 0,
10
+ end: e.length
11
+ }
12
+ };
13
+ }
14
+ function n(n) {
15
+ let r = n.endsWith("\n") ? n.slice(0, -1) : n, i = /^\{\{([^{}]*)\}\}$/.exec(r);
16
+ if (i === null) return [t(n, "resource_not_single_ref")];
17
+ let a = e(i[1] ?? "");
18
+ return a === "" ? [t(n, "empty_fragment")] : a.includes("(") ? [t(n, "resource_function_call")] : [];
19
+ }
20
+ //#endregion
21
+ //#region src/shared/resourceTemplate.ts
22
+ function r(t) {
23
+ if (n(t).length > 0) return null;
24
+ let r = t.endsWith("\n") ? t.slice(0, -1) : t, i = /^\{\{([^{}]*)\}\}$/.exec(r)?.[1];
25
+ if (i === void 0) return null;
26
+ let a = e(i);
27
+ return a === "" ? null : a;
28
+ }
29
+ function i(e) {
30
+ return `{{${e}}}`;
31
+ }
32
+ //#endregion
33
+ export { r as n, n as r, i as t };
@@ -1,4 +1,5 @@
1
1
  import { CompletionSource } from './completion';
2
+ import { PathPickerMode } from './pathPickerModel';
2
3
  type __VLS_Props = {
3
4
  /** 裸点路径原文(壳已拆 `{{}}`;存量违例拆不动时壳原样透传,只读回显) */
4
5
  modelValue: string;
@@ -10,13 +11,19 @@ type __VLS_Props = {
10
11
  ariaLabel?: string;
11
12
  /** 空值占位文案 */
12
13
  placeholder?: string;
14
+ /**
15
+ * 终点形态(rows-path-picker 工单 02,spec D3):'resource' = 叶子终点
16
+ * (缺省,资源面既有调用零改动);'rowsPath' = 数组终点(仅数组可选、
17
+ * 对象只下钻、空态提示行)。判定矩阵归 pathPickerModel,壳全共享。
18
+ */
19
+ mode?: PathPickerMode;
13
20
  };
14
21
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
15
- change: (path: string) => any;
16
22
  "update:modelValue": (path: string) => any;
23
+ change: (path: string) => any;
17
24
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
18
- onChange?: ((path: string) => any) | undefined;
19
25
  "onUpdate:modelValue"?: ((path: string) => any) | undefined;
26
+ onChange?: ((path: string) => any) | undefined;
20
27
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
21
28
  rootRef: HTMLDivElement;
22
29
  toggleButton: HTMLButtonElement;
@@ -8,14 +8,18 @@
8
8
  * (呈现件 + 开合逻辑 composable;工具栏三下拉内建触发钮直用,状态栏缩放菜单/
9
9
  * 面板+经 #trigger/#body 受控插槽迁移消费——issues/05)与表达式补全五件(数据
10
10
  * 契约/锚点测量/浮层控件/上下文判定与候选源适配——属性面板与画布文本
11
- * 编辑两域共用)及裸路径补全控件 usePathCompletion(rows-path-completion 工单
12
- * 02:复用同门 Popup/Anchor/applyCompletion,触发语义分轨——裸路径输入即弹)、
13
- * rowsPath 候选源组装 rowsPathCompletionSource(工单 03/04:「行数组」文案置入
14
- * 的公共合流点)与 schema 声明切片桥 useDataSourceSchema(工单 04 自 status-bar
15
- * 收口——状态栏读数段与建表表单两域共用)与字体清单注入缝 fontPicker(
11
+ * 编辑两域共用;rows-path-completion 的裸路径补全控件 usePathCompletion 与
12
+ * rowsPathCompletionSource 手输源随 rowsPath 作者面纯点选化零消费方,已于
13
+ * rows-path-picker 工单 05 整体退役)与点选器候选源组装
14
+ * rowsPathPickerSource(rows-path-picker 工单 02:剪枝枚举件适配,供选择器
15
+ * mode='rowsPath' 消费——工单 04 起建表表单与右键轻表单两入口同源)与 schema
16
+ * 声明切片桥 useDataSourceSchema(工单 04 自 status-bar
17
+ * 收口——状态栏读数段、建表表单与右键菜单门态多域共用)与字体清单注入缝 fontPicker(
16
18
  * edit-overlay-toolbar 工单 04 自属性面板域迁入——面板字体控件与编辑浮层工具条
17
19
  * 字体段两域共用)与字段权威写 mergeKey 约定 mergeKey(面板与工具条双入口同键
18
- * 合并的格式单点)与资源表达式级联路径选择器 ExpressionPathPicker + `{{}}` 拆装
20
+ * 合并的格式单点)与资源表达式级联路径选择器 ExpressionPathPicker + 候选模型
21
+ * pathPickerModel(rows-path-picker 工单 02 起带终点形态分叉 mode:resource
22
+ * 叶子终点缺省 / rowsPath 数组终点,可激活/可下钻判定矩阵归模型)+ `{{}}` 拆装
19
23
  * 纯函数 resourceTemplate + 弹层视口定位纯函数 popupPosition(resource-expression-
20
24
  * single-ref 工单 05/06:资源内容字段的作者面 = 纯菜单点选,垂直翻转/钳制定位
21
25
  * 两浮层与选择器菜单共用)。
@@ -39,14 +43,13 @@ export { measureCursorAnchor, type CompletionAnchor } from './completionAnchor';
39
43
  export { expressionCompletionSource, expressionFieldContext, type ExpressionFieldContext, } from './expressionContext';
40
44
  export { useExpressionCompletion, type ExpressionCompletionState } from './useExpressionCompletion';
41
45
  export { expressionDiagnosticHint, useExpressionDiagnostics } from './useExpressionDiagnostics';
42
- export { usePathCompletion } from './usePathCompletion';
43
- export { rowsPathCompletionSource } from './rowsPathCompletionSource';
46
+ export { rowsPathPickerSource, rowsPathValueDrifts } from './rowsPathPickerSource';
44
47
  export { attachResourceTemplate, stripResourceTemplate } from './resourceTemplate';
45
- export { pathPickerEntries, type PathPickerEntry } from './pathPickerModel';
48
+ export { pathPickerEntries, type PathPickerEntry, type PathPickerMode } from './pathPickerModel';
46
49
  export { placePopupInViewport, POPUP_GAP, POPUP_MARGIN, type PopupAnchorBox, type PopupViewportPosition, } from './popupPosition';
47
50
  export { useHistory, type HistoryAvailability } from './useHistory';
48
51
  export { useSelection } from './useSelection';
49
- export { useDataSourceSchema } from './useDataSourceSchema';
52
+ export { DATA_SOURCE_GATE_HINT, useDataSourceSchema, useDataSourceSchemaRejection } from './useDataSourceSchema';
50
53
  export { useShortcuts } from './useShortcuts';
51
54
  export { useShortcutsHelp, type ShortcutsHelp } from './useShortcutsHelp';
52
55
  export { useTransientFeedback, type TransientFeedback } from './useTransientFeedback';
@@ -1,11 +1,24 @@
1
1
  import { CompletionItem, CompletionSource } from './completion';
2
- /** 一条菜单条目:完整点路径 + 候选元信息 + 可下钻判定(drillable = 点选进入下一层,否则点选提交) */
2
+ /** 选择器终点形态(rows-path-picker 工单 02):'resource' = 叶子终点(缺省),'rowsPath' = 数组终点 */
3
+ export type PathPickerMode = 'resource' | 'rowsPath';
4
+ /** 一条菜单条目:完整点路径 + 候选元信息 + 终点形态判定(两 mode 矩阵见模块头) */
3
5
  export interface PathPickerEntry {
4
6
  /** 提交/下钻的完整点路径(缺 path 的候选不构成条目——选择器的 v-model 面就是它) */
5
7
  readonly path: string;
6
8
  /** 候选元信息(segment/type/description/title,展示回落归组件) */
7
9
  readonly item: CompletionItem;
10
+ /** 点选下钻进入下一层(resource = 探层非空;rowsPath = 对象中间站) */
8
11
  readonly drillable: boolean;
12
+ /** 点选提交(resource = 叶子即 !drillable;rowsPath = 数组终点,D3 唯一可点终点) */
13
+ readonly activatable: boolean;
9
14
  }
10
- /** 取一层候选(kind 过滤后);候选源 null 态(语法错/降级)= 空层 */
11
- export declare function pathPickerEntries(source: CompletionSource, prefix: string): readonly PathPickerEntry[];
15
+ /** 取一层候选(kind 过滤后,mode 定可激活/可下钻判定矩阵);候选源 null 态(语法错/降级)= 空层 */
16
+ export declare function pathPickerEntries(source: CompletionSource, prefix: string, mode?: PathPickerMode): readonly PathPickerEntry[];
17
+ /** 菜单行面包屑分隔符(工单 06 展示词汇单点):前缀与现段名之间的连接符 */
18
+ export declare const PATH_PICKER_BREADCRUMB_SEPARATOR = "\u203A";
19
+ /**
20
+ * 菜单行面包屑前缀(工单 06):path 去尾段——下钻行在段名前弱化显示已积累
21
+ * 路径(点选途中完整落点随时可见),根层行(无父段)空串(组件不渲染前缀,
22
+ * 呈现维持纯段名不变)。纯派生 Node 可测,拆分呈现归组件模板。
23
+ */
24
+ export declare function pathPickerParentPrefix(path: string): string;
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * 实测缺陷(工单 06 背景,example 开发轨 2026-10-14):浮层恒锚光标下方无翻转
9
9
  * 钳制,资源字段居面板底部——候选大半截出屏鼠标不可点。两控件(useExpression
10
- * Completion / usePathCompletion)的私有 clampToViewport 与本函数合并为单点,
11
- * 路径选择器菜单(工单 05)同函数消费。
10
+ * Completion / 已退役的 usePathCompletion,rows-path-picker 工单 05)的私有
11
+ * clampToViewport 与本函数合并为单点,路径选择器菜单(工单 05)同函数消费。
12
12
  *
13
13
  * 高/宽度量不到(0——首帧未渲染/降级):按「放得下/原锚放」处理,不误翻转不
14
14
  * 误收口(首开路径由调用方延一拍补量)。纯几何、零 DOM、Node 可测。
@@ -0,0 +1,15 @@
1
+ import { ExpressionSchemaNode } from '@hankchen/canvas-editor';
2
+ import { CompletionSource } from './completion';
3
+ /** 「行数组」徽标展示文案(rowsPath 面的展示词汇单点):点选器组件徽标映射共用 */
4
+ export declare const ROWS_PATH_ARRAY_BADGE = "\u884C\u6570\u7EC4";
5
+ export declare function rowsPathPickerSource(startSchema: ExpressionSchemaNode | null): CompletionSource | null;
6
+ /**
7
+ * 已提交 rowsPath 的漂移判定(rows-path-picker 工单 03,spec D2):属性面板把
8
+ * 「schema 变更后已选路径枚举不出」呈现为回显标红(菜单照常可开可重选),判定
9
+ * 收口此纯函数(Node 可测)。语义按 spec 钉定面复用补全枚举器——
10
+ * `enumerateRowsPathCandidates === null`(途经漂移/数组内下钻/畸形)或终点非数组
11
+ * (标量/对象落点、空值、尾点残形——枚举候选里寻不到该路径的数组终点条目)。
12
+ * 作用于已提交值,无输入期概念;起点 null(未绑声明/判别降级)= 门态不判漂移
13
+ * (弱提示替代标红,D1)。
14
+ */
15
+ export declare function rowsPathValueDrifts(startSchema: ExpressionSchemaNode | null, value: string): boolean;
@@ -1,3 +1,11 @@
1
1
  import { ComputedRef } from 'vue';
2
- import { EditorSession, ExpressionSchemaNode } from '@hankchen/canvas-editor';
2
+ import { DataSourceSchemaRejection, EditorSession, ExpressionSchemaNode } from '@hankchen/canvas-editor';
3
+ /**
4
+ * 数据源声明门提示(rows-path-picker 工单 04,spec D1):未绑 schema 时建表面
5
+ * 菜单项的置灰悬停文案——面板「+」菜单模板表项与右键「转为模板表」项两处门态
6
+ * 共用的展示词汇单点(「行数组」徽标同门先例,文案不进数据契约)。
7
+ */
8
+ export declare const DATA_SOURCE_GATE_HINT = "\u5148\u7ED1\u5B9A\u6570\u636E\u6E90";
3
9
  export declare function useDataSourceSchema(editor: EditorSession): ComputedRef<ExpressionSchemaNode | null>;
10
+ /** 声明拒绝详情桥(声明被拒呈现面,2b):null = 未注入/已编译/已清除 */
11
+ export declare function useDataSourceSchemaRejection(editor: EditorSession): ComputedRef<DataSourceSchemaRejection | null>;
@@ -2,6 +2,17 @@ import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
2
2
  import { ExpressionFragmentDiagnostic } from '@hankchen/canvas-editor';
3
3
  /** 诊断汇总文案:多处取首条 kind 带计数;无诊断返回空串 */
4
4
  export declare function expressionDiagnosticHint(diagnostics: readonly ExpressionFragmentDiagnostic[]): string;
5
+ /**
6
+ * 资源字段绑定门引导(resource-expression-single-ref 呈现面):资源字段表达式态
7
+ * 未注入数据源声明 → 选择器无菜单(引用以声明为门)——弱提示行说明缺席原因。
8
+ */
9
+ export declare const RESOURCE_BINDING_HINT = "\u7ED1\u5B9A\u6570\u636E\u6E90\u540E\u53EF\u9009\u62E9\u5B57\u6BB5";
10
+ /**
11
+ * 资源单值门的提示文案(ADR 0020 呈现面):门是内容引用约束,不是语法错——
12
+ * 不走「表达式语法错误」框架,按修复通道在场与否给动作指引(菜单点选是资源面
13
+ * 唯一写入口);违例 kind(拼接/函数/字面残留)只进诊断面,呈现统一按通道分流。
14
+ */
15
+ export declare function resourceDiagnosticHint(hasSource: boolean): string;
5
16
  export declare function useExpressionDiagnostics(options: {
6
17
  /** 宿主输入元素(textarea/input),模板 ref 传入 */
7
18
  target: Ref<HTMLTextAreaElement | HTMLInputElement | null>;
@@ -1,4 +1,4 @@
1
- import { a as e, d as t, f as n, i as r, l as i, n as a, o, p as s, s as c, t as l, u } from "./useTransientFeedback-CTjmMmFF.js";
1
+ import { c as e, f as t, g as n, h as r, l as i, m as a, n as o, p as s, s as c, t as l, u } from "./useTransientFeedback-BN_O7V2w.js";
2
2
  import { t as d } from "./useShortcutsHelp-CsyarO2P.js";
3
3
  import { Fragment as f, Teleport as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, defineComponent as y, onBeforeUnmount as b, onScopeDispose as x, openBlock as S, renderList as C, shallowRef as w, toDisplayString as T, unref as E, watch as D, withModifiers as O } from "vue";
4
4
  //#region src/shared/HelpDialog.vue?vue&type=script&setup=true&lang.ts
@@ -11,18 +11,18 @@ var k = {
11
11
  }, A = { class: "cn-help__header" }, j = { class: "cn-help__body" }, M = ["data-help-group"], N = { class: "cn-help__section-title" }, P = { class: "cn-help__list" }, F = { class: "cn-help__label" }, I = { class: "cn-help__keys" }, L = {
12
12
  class: "cn-help__section",
13
13
  "data-help-interactions": ""
14
- }, R = { class: "cn-help__list" }, z = { class: "cn-help__label" }, B = { class: "cn-help__keys" }, V = /*#__PURE__*/ u(/* @__PURE__ */ y({
14
+ }, R = { class: "cn-help__list" }, z = { class: "cn-help__label" }, B = { class: "cn-help__keys" }, V = /*#__PURE__*/ s(/* @__PURE__ */ y({
15
15
  __name: "HelpDialog",
16
16
  props: {
17
- bindings: { default: () => n },
17
+ bindings: { default: () => r },
18
18
  platform: {}
19
19
  },
20
- setup(t) {
21
- let n = t, { open: r, close: a } = d(), s = m(() => n.platform ?? c()), l = m(() => o.map((t) => ({
20
+ setup(n) {
21
+ let r = n, { open: a, close: o } = d(), s = m(() => r.platform ?? u()), c = m(() => i.map((t) => ({
22
22
  group: t,
23
23
  label: e[t],
24
- bindings: n.bindings.filter((e) => e.group === t)
25
- })).filter((e) => e.bindings.length > 0)), u = [
24
+ bindings: r.bindings.filter((e) => e.group === t)
25
+ })).filter((e) => e.bindings.length > 0)), l = [
26
26
  {
27
27
  gesture: "Ctrl/⌘ + 滚轮",
28
28
  text: "缩放画布(以指针为中心,5%–800%)"
@@ -53,22 +53,22 @@ var k = {
53
53
  }
54
54
  ];
55
55
  function y(e) {
56
- e.key === "Escape" && a();
56
+ e.key === "Escape" && o();
57
57
  }
58
- return D(r, (e) => {
58
+ return D(a, (e) => {
59
59
  e ? window.addEventListener("keydown", y) : window.removeEventListener("keydown", y);
60
- }), b(() => window.removeEventListener("keydown", y)), (e, t) => (S(), h(p, { to: "body" }, [E(r) ? (S(), _("div", {
60
+ }), b(() => window.removeEventListener("keydown", y)), (e, n) => (S(), h(p, { to: "body" }, [E(a) ? (S(), _("div", {
61
61
  key: 0,
62
62
  class: "cn-help",
63
63
  "data-help-overlay": "",
64
- onPointerdown: t[1] ||= O((...e) => E(a) && E(a)(...e), ["self"])
65
- }, [v("div", k, [v("header", A, [t[2] ||= v("h2", { class: "cn-help__title" }, "快捷键", -1), v("button", {
64
+ onPointerdown: n[1] ||= O((...e) => E(o) && E(o)(...e), ["self"])
65
+ }, [v("div", k, [v("header", A, [n[2] ||= v("h2", { class: "cn-help__title" }, "快捷键", -1), v("button", {
66
66
  type: "button",
67
67
  class: "cn-help__close",
68
68
  "data-help-close": "",
69
69
  "aria-label": "关闭快捷键帮助",
70
- onClick: t[0] ||= (...e) => E(a) && E(a)(...e)
71
- }, " ✕ ")]), v("div", j, [(S(!0), _(f, null, C(l.value, (e) => (S(), _("section", {
70
+ onClick: n[0] ||= (...e) => E(o) && E(o)(...e)
71
+ }, " ✕ ")]), v("div", j, [(S(!0), _(f, null, C(c.value, (e) => (S(), _("section", {
72
72
  key: e.group,
73
73
  class: "cn-help__section",
74
74
  "data-help-group": e.group
@@ -76,7 +76,7 @@ var k = {
76
76
  key: `${e.action}:${e.combo.key}`,
77
77
  class: "cn-help__row",
78
78
  "data-help-shortcut": ""
79
- }, [v("span", F, T(e.label), 1), v("kbd", I, T(E(i)(e.combo, s.value)), 1)]))), 128))])], 8, M))), 128)), v("section", L, [t[3] ||= v("h3", { class: "cn-help__section-title" }, "内置交互", -1), v("ul", R, [(S(), _(f, null, C(u, (e) => v("li", {
79
+ }, [v("span", F, T(e.label), 1), v("kbd", I, T(E(t)(e.combo, s.value)), 1)]))), 128))])], 8, M))), 128)), v("section", L, [n[3] ||= v("h3", { class: "cn-help__section-title" }, "内置交互", -1), v("ul", R, [(S(), _(f, null, C(l, (e) => v("li", {
80
80
  key: e.gesture,
81
81
  class: "cn-help__row",
82
82
  "data-help-interaction": ""
@@ -96,10 +96,10 @@ function H(e) {
96
96
  }
97
97
  //#endregion
98
98
  //#region src/shared/useShortcuts.ts
99
- var U = new Set(Object.keys(t));
99
+ var U = new Set(Object.keys(a));
100
100
  function W(e) {
101
- let t = d(), n = l(), i = (i) => {
102
- let o = s({
101
+ let t = d(), r = l(), i = (i) => {
102
+ let a = n({
103
103
  key: i.key,
104
104
  mod: i.ctrlKey || i.metaKey,
105
105
  shift: i.shiftKey,
@@ -107,14 +107,14 @@ function W(e) {
107
107
  code: i.code,
108
108
  composing: i.isComposing || i.keyCode === 229,
109
109
  editing: e.store.ui.editing !== null,
110
- editableTarget: a(i.target)
110
+ editableTarget: o(i.target)
111
111
  });
112
- if (o !== null) {
113
- if (i.preventDefault(), o === "helpShortcuts") {
112
+ if (a !== null) {
113
+ if (i.preventDefault(), a === "helpShortcuts") {
114
114
  t.toggle();
115
115
  return;
116
116
  }
117
- e.executeShortcut(o), U.has(o) && n.show(r);
117
+ e.executeShortcut(a), U.has(a) && r.show(c);
118
118
  }
119
119
  };
120
120
  window.addEventListener("keydown", i), x(() => window.removeEventListener("keydown", i), !0);
package/dist/shared.js CHANGED
@@ -1,10 +1,9 @@
1
- import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./popupPosition-Ck5Gsvjy.js";
2
- import { c as s, i as c, n as l, s as u, t as d } from "./useTransientFeedback-CTjmMmFF.js";
3
- import { a as f, c as p, i as m, l as h, n as g, o as _, r as v, s as y, t as b } from "./uploadFile-D1RY-ji0.js";
4
- import { i as x, n as S, r as C, t as w } from "./resourceTemplate-cdcQtp9a.js";
5
- import { n as T, t as E } from "./usePathCompletion-Do17CQ6l.js";
6
- import { n as D, t as O } from "./useViewport-D9Ipevzs.js";
7
- import { n as k, r as A, t as j } from "./useDataSourceSchema-YV8g-lo0.js";
8
- import { t as M } from "./useShortcutsHelp-CsyarO2P.js";
9
- import { n as N, r as P, t as F } from "./shared-wuupBoZg.js";
10
- export { c as ARM_LAYER_CREATE_HINT, k as DropdownMenu, r as ExpressionCompletionPopup, C as ExpressionPathPicker, v as FONT_PICKER_KEY, P as HelpDialog, o as POPUP_GAP, n as POPUP_MARGIN, a as PanelIcon, e as applyCompletion, w as attachResourceTemplate, u as detectShortcutPlatform, p as expressionCompletionSource, f as expressionDiagnosticHint, h as expressionFieldContext, m as injectFontPicker, l as isEditableEventTarget, t as measureCursorAnchor, x as pathPickerEntries, i as placePopupInViewport, T as rowsPathCompletionSource, g as selectionFieldMergeKey, s as shortcutActionLabel, S as stripResourceTemplate, b as uploadFileFromDom, j as useDataSourceSchema, A as useDropdownMenu, y as useExpressionCompletion, _ as useExpressionDiagnostics, N as useHistory, E as usePathCompletion, D as useSelection, F as useShortcuts, M as useShortcutsHelp, d as useTransientFeedback, O as useViewport };
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./ExpressionPathPicker-DchGsK70.js";
2
+ import { n as c, t as l } from "./resourceTemplate-D-DKEo7Z.js";
3
+ import { a as u, d, i as f, n as p, o as m, s as h, t as g, u as _ } from "./useTransientFeedback-BN_O7V2w.js";
4
+ import { c as v, d as y, f as b, i as x, l as S, m as C, n as w, o as T, p as E, r as D, t as O, u as k } from "./uploadFile-mXJVPEzm.js";
5
+ import { n as A, t as j } from "./useViewport-D9Ipevzs.js";
6
+ import { n as M, t as N } from "./DropdownMenu-CeUNKMDQ.js";
7
+ import { t as P } from "./useShortcutsHelp-CsyarO2P.js";
8
+ import { n as F, r as I, t as L } from "./shared-CRDKDSpa.js";
9
+ export { h as ARM_LAYER_CREATE_HINT, f as DATA_SOURCE_GATE_HINT, N as DropdownMenu, C as ExpressionCompletionPopup, s as ExpressionPathPicker, D as FONT_PICKER_KEY, I as HelpDialog, r as POPUP_GAP, a as POPUP_MARGIN, t as PanelIcon, y as applyCompletion, l as attachResourceTemplate, _ as detectShortcutPlatform, b as expressionCompletionSource, T as expressionDiagnosticHint, E as expressionFieldContext, x as injectFontPicker, p as isEditableEventTarget, k as measureCursorAnchor, e as pathPickerEntries, n as placePopupInViewport, i as rowsPathPickerSource, o as rowsPathValueDrifts, w as selectionFieldMergeKey, d as shortcutActionLabel, c as stripResourceTemplate, O as uploadFileFromDom, u as useDataSourceSchema, m as useDataSourceSchemaRejection, M as useDropdownMenu, S as useExpressionCompletion, v as useExpressionDiagnostics, F as useHistory, A as useSelection, L as useShortcuts, P as useShortcutsHelp, g as useTransientFeedback, j as useViewport };
@@ -1,11 +1,11 @@
1
1
  import { a as e } from "./layerPath-uy2ywyld.js";
2
- import { c as t, s as n, t as r, u as i } from "./useTransientFeedback-CTjmMmFF.js";
3
- import { n as a, t as o } from "./useViewport-D9Ipevzs.js";
4
- import { n as s, t as c } from "./useDataSourceSchema-YV8g-lo0.js";
5
- import { t as l } from "./useShortcutsHelp-CsyarO2P.js";
6
- import { Fragment as u, computed as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, onScopeDispose as _, openBlock as v, shallowRef as y, toDisplayString as b, unref as x, withCtx as S } from "vue";
2
+ import { a as t, d as n, o as r, p as i, t as a, u as o } from "./useTransientFeedback-BN_O7V2w.js";
3
+ import { n as s, t as c } from "./useViewport-D9Ipevzs.js";
4
+ import { t as l } from "./DropdownMenu-CeUNKMDQ.js";
5
+ import { t as u } from "./useShortcutsHelp-CsyarO2P.js";
6
+ import { Fragment as d, computed as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createVNode as g, defineComponent as _, onScopeDispose as v, openBlock as y, shallowRef as b, toDisplayString as x, unref as S, withCtx as C } from "vue";
7
7
  //#region src/status-bar/layerPathLabel.ts
8
- function C(e) {
8
+ function w(e) {
9
9
  let t = `图层 ${String(e[1])}`;
10
10
  for (let n = 2; n < e.length; n += 1) {
11
11
  let r = e[n];
@@ -19,7 +19,7 @@ function C(e) {
19
19
  }
20
20
  //#endregion
21
21
  //#region src/status-bar/layerGeometryLabel.ts
22
- var w = {
22
+ var T = {
23
23
  "top-left": "左上",
24
24
  top: "中上",
25
25
  "top-right": "右上",
@@ -30,49 +30,49 @@ var w = {
30
30
  bottom: "中下",
31
31
  "bottom-right": "右下"
32
32
  };
33
- function T(e, t) {
34
- return `x=${Math.round(e.x)} y=${Math.round(e.y)} · ${Math.round(t.width)}×${Math.round(t.height)} · ${w[e.anchor]}锚`;
33
+ function E(e, t) {
34
+ return `x=${Math.round(e.x)} y=${Math.round(e.y)} · ${Math.round(t.width)}×${Math.round(t.height)} · ${T[e.anchor]}锚`;
35
35
  }
36
36
  //#endregion
37
37
  //#region src/status-bar/useDoc.ts
38
- function E(e) {
39
- let t = y(e.store.doc), n = e.subscribe((n) => {
38
+ function D(e) {
39
+ let t = b(e.store.doc), n = e.subscribe((n) => {
40
40
  n.scope === "doc" && (t.value = e.store.doc);
41
41
  });
42
- return _(n, !0), d(() => t.value);
42
+ return v(n, !0), f(() => t.value);
43
43
  }
44
44
  //#endregion
45
45
  //#region src/status-bar/StatusBar.vue?vue&type=script&setup=true&lang.ts
46
- var D = {
46
+ var O = {
47
47
  class: "cn-statusbar",
48
48
  role: "status",
49
49
  "aria-label": "编辑器状态栏"
50
- }, O = [
50
+ }, k = [
51
51
  "aria-expanded",
52
52
  "onClick",
53
53
  "onKeydown"
54
- ], k = {
54
+ ], A = {
55
55
  class: "cn-statusbar__segment",
56
56
  "data-selection": ""
57
- }, A = {
57
+ }, j = {
58
58
  class: "cn-statusbar__segment cn-statusbar__segment--pending",
59
59
  "data-pending": ""
60
- }, j = {
60
+ }, M = {
61
61
  class: "cn-statusbar__segment",
62
62
  "data-geometry": ""
63
- }, M = {
63
+ }, N = {
64
64
  class: "cn-statusbar__segment",
65
65
  "data-resource": ""
66
- }, N = {
66
+ }, P = {
67
67
  class: "cn-statusbar__segment",
68
68
  "data-save": ""
69
- }, P = {
69
+ }, F = {
70
70
  class: "cn-statusbar__segment",
71
71
  "data-schema": ""
72
- }, F = {
72
+ }, I = {
73
73
  class: "cn-statusbar__segment",
74
74
  "data-feedback": ""
75
- }, I = /*#__PURE__*/ i(/* @__PURE__ */ g({
75
+ }, L = /*#__PURE__*/ i(/* @__PURE__ */ _({
76
76
  __name: "StatusBar",
77
77
  props: {
78
78
  editor: {},
@@ -82,58 +82,60 @@ var D = {
82
82
  feedback: { default: "" }
83
83
  },
84
84
  setup(i) {
85
- let g = i, _ = o(g.editor), y = a(g.editor), w = E(g.editor), I = c(g.editor), L = d(() => Math.round(_.value.zoom * 100)), R = d(() => {
86
- let e = y.value;
87
- return e === null ? "未选中图层" : C(e);
88
- }), z = d(() => {
89
- let t = y.value, n = w.value;
85
+ let _ = i, v = c(_.editor), b = s(_.editor), T = D(_.editor), L = t(_.editor), R = r(_.editor), z = f(() => Math.round(v.value.zoom * 100)), B = f(() => {
86
+ let e = b.value;
87
+ return e === null ? "未选中图层" : w(e);
88
+ }), V = f(() => {
89
+ let t = b.value, n = T.value;
90
90
  if (t === null || n === null) return null;
91
- let r = e(n, t), i = g.editor.layerBoxAt(t);
92
- return !r || !i ? null : T(r.position, i);
93
- }), B = d(() => {
94
- let e = I.value;
95
- return e === null ? "schema 无候选" : `schema 已注入顶层 ${e.properties?.size ?? 0} 键`;
96
- }), { toggle: V } = l(), H = `快捷键帮助(${t("helpShortcuts", n())})`, U = r(), W = d(() => g.feedback === "" ? U.message.value : g.feedback);
97
- function G(e) {
98
- let { width: t, height: n } = g.editor.getSurfaceSize();
99
- g.editor.zoomAt(t / 2, n / 2, _.value.zoom * e);
91
+ let r = e(n, t), i = _.editor.layerBoxAt(t);
92
+ return !r || !i ? null : E(r.position, i);
93
+ }), H = f(() => {
94
+ let e = L.value;
95
+ if (e !== null) return `schema 已注入顶层 ${e.properties?.size ?? 0} 键`;
96
+ let t = R.value;
97
+ return t === null ? "schema 未注入" : `schema 声明被拒:${t.detail}`;
98
+ }), { toggle: U } = u(), W = `快捷键帮助(${n("helpShortcuts", o())})`, G = a(), K = f(() => _.feedback === "" ? G.message.value : _.feedback);
99
+ function q(e) {
100
+ let { width: t, height: n } = _.editor.getSurfaceSize();
101
+ _.editor.zoomAt(t / 2, n / 2, v.value.zoom * e);
100
102
  }
101
- let K = d(() => [
103
+ let J = f(() => [
102
104
  {
103
105
  label: "100%",
104
106
  dataAttrs: { "data-zoom-100": "" },
105
- run: () => g.editor.resetZoom()
107
+ run: () => _.editor.resetZoom()
106
108
  },
107
109
  {
108
110
  label: "适应画布",
109
111
  dataAttrs: { "data-zoom-fit": "" },
110
- run: () => g.editor.fitToSurface()
112
+ run: () => _.editor.fitToSurface()
111
113
  },
112
114
  {
113
115
  label: "适应选区",
114
116
  dataAttrs: { "data-zoom-fit-selection": "" },
115
- run: () => g.editor.fitToSelection()
117
+ run: () => _.editor.fitToSelection()
116
118
  },
117
119
  {
118
120
  label: "放大",
119
121
  title: "放大(以视口中心为锚)",
120
122
  dataAttrs: { "data-zoom-in": "" },
121
- run: () => G(1.25)
123
+ run: () => q(1.25)
122
124
  },
123
125
  {
124
126
  label: "缩小",
125
127
  title: "缩小(以视口中心为锚)",
126
128
  dataAttrs: { "data-zoom-out": "" },
127
- run: () => G(1 / 1.25)
129
+ run: () => q(1 / 1.25)
128
130
  }
129
131
  ]);
130
- return (e, t) => (v(), p("footer", D, [
131
- h(s, {
132
+ return (e, t) => (y(), m("footer", O, [
133
+ g(l, {
132
134
  label: "缩放",
133
135
  direction: "up",
134
- items: K.value
136
+ items: J.value
135
137
  }, {
136
- trigger: S(({ open: e, toggle: t, triggerRef: n, onKeydown: r }) => [m("button", {
138
+ trigger: C(({ open: e, toggle: t, triggerRef: n, onKeydown: r }) => [h("button", {
137
139
  ref: n,
138
140
  type: "button",
139
141
  class: "cn-statusbar__segment cn-statusbar__zoom-trigger",
@@ -143,53 +145,53 @@ var D = {
143
145
  title: "缩放",
144
146
  onClick: t,
145
147
  onKeydown: r
146
- }, b(L.value) + "% ", 41, O)]),
148
+ }, x(z.value) + "% ", 41, k)]),
147
149
  _: 1
148
150
  }, 8, ["items"]),
149
- t[6] ||= m("span", {
151
+ t[6] ||= h("span", {
150
152
  class: "cn-statusbar__divider",
151
153
  "aria-hidden": "true"
152
154
  }, null, -1),
153
- m("span", k, b(R.value), 1),
154
- g.pendingCount > 0 ? (v(), p(u, { key: 0 }, [t[1] ||= m("span", {
155
+ h("span", A, x(B.value), 1),
156
+ _.pendingCount > 0 ? (y(), m(d, { key: 0 }, [t[1] ||= h("span", {
155
157
  class: "cn-statusbar__divider",
156
158
  "aria-hidden": "true"
157
- }, null, -1), m("span", A, " 物化中 " + b(g.pendingCount), 1)], 64)) : f("", !0),
158
- z.value === null ? f("", !0) : (v(), p(u, { key: 1 }, [t[2] ||= m("span", {
159
+ }, null, -1), h("span", j, " 物化中 " + x(_.pendingCount), 1)], 64)) : p("", !0),
160
+ V.value === null ? p("", !0) : (y(), m(d, { key: 1 }, [t[2] ||= h("span", {
159
161
  class: "cn-statusbar__divider",
160
162
  "aria-hidden": "true"
161
- }, null, -1), m("span", j, b(z.value), 1)], 64)),
162
- g.resourceNote === "" ? f("", !0) : (v(), p(u, { key: 2 }, [t[3] ||= m("span", {
163
+ }, null, -1), h("span", M, x(V.value), 1)], 64)),
164
+ _.resourceNote === "" ? p("", !0) : (y(), m(d, { key: 2 }, [t[3] ||= h("span", {
163
165
  class: "cn-statusbar__divider",
164
166
  "aria-hidden": "true"
165
- }, null, -1), m("span", M, b(g.resourceNote), 1)], 64)),
166
- g.saveState === void 0 ? f("", !0) : (v(), p(u, { key: 3 }, [t[4] ||= m("span", {
167
+ }, null, -1), h("span", N, x(_.resourceNote), 1)], 64)),
168
+ _.saveState === void 0 ? p("", !0) : (y(), m(d, { key: 3 }, [t[4] ||= h("span", {
167
169
  class: "cn-statusbar__divider",
168
170
  "aria-hidden": "true"
169
- }, null, -1), m("span", N, b(g.saveState === "dirty" ? "● 未保存" : "○ 已保存"), 1)], 64)),
170
- t[7] ||= m("span", {
171
+ }, null, -1), h("span", P, x(_.saveState === "dirty" ? "● 未保存" : "○ 已保存"), 1)], 64)),
172
+ t[7] ||= h("span", {
171
173
  class: "cn-statusbar__divider",
172
174
  "aria-hidden": "true"
173
175
  }, null, -1),
174
- m("span", P, b(B.value), 1),
175
- W.value === "" ? f("", !0) : (v(), p(u, { key: 4 }, [t[5] ||= m("span", {
176
+ h("span", F, x(H.value), 1),
177
+ K.value === "" ? p("", !0) : (y(), m(d, { key: 4 }, [t[5] ||= h("span", {
176
178
  class: "cn-statusbar__divider",
177
179
  "aria-hidden": "true"
178
- }, null, -1), m("span", F, b(W.value), 1)], 64)),
179
- t[8] ||= m("span", {
180
+ }, null, -1), h("span", I, x(K.value), 1)], 64)),
181
+ t[8] ||= h("span", {
180
182
  class: "cn-statusbar__divider",
181
183
  "aria-hidden": "true"
182
184
  }, null, -1),
183
- m("button", {
185
+ h("button", {
184
186
  type: "button",
185
187
  class: "cn-statusbar__segment cn-statusbar__help",
186
188
  "data-help": "",
187
189
  "aria-haspopup": "dialog",
188
- title: H,
189
- onClick: t[0] ||= (...e) => x(V) && x(V)(...e)
190
+ title: W,
191
+ onClick: t[0] ||= (...e) => S(U) && S(U)(...e)
190
192
  }, " 快捷键 ")
191
193
  ]));
192
194
  }
193
- }), [["__scopeId", "data-v-040479fb"]]);
195
+ }), [["__scopeId", "data-v-ea2a5856"]]);
194
196
  //#endregion
195
- export { T as n, C as r, I as t };
197
+ export { E as n, w as r, L as t };
@@ -1,2 +1,2 @@
1
- import { n as e, r as t, t as n } from "./status-bar-XMVbRLY9.js";
1
+ import { n as e, r as t, t as n } from "./status-bar-DBf5kIXY.js";
2
2
  export { n as StatusBar, e as formatLayerGeometry, t as formatLayerPath };