@hankchen/canvas-editor 0.4.0 → 0.6.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/index.d.ts +447 -152
- package/dist/index.js +415 -112
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -295,6 +295,31 @@ declare function resizeBox(start: ResizeBoxGeometry, handle: ResizeHandle, dx: n
|
|
|
295
295
|
* 缩放期跟随动缘即可)。
|
|
296
296
|
*/
|
|
297
297
|
declare function resizeSnapPoints(start: ResizeBoxGeometry, handle: ResizeHandle, dx: number, dy: number): SnapPoints;
|
|
298
|
+
/** 等比缩放的驱动轴(image-ratio-preset 工单 01):角柄取位移较大轴(|Δx| ≥
|
|
299
|
+
* |Δy| 宽驱动,画拉比例钳同门)、边中柄恒取被拖轴。几何求位与吸附位点消费
|
|
300
|
+
* 同一判定(resizeBoxProportional 与 resizeProportionalSnapPoints 共读)。 */
|
|
301
|
+
type ProportionalDrivingAxis = 'width' | 'height';
|
|
302
|
+
declare function proportionalDrivingAxis(handle: ResizeHandle, dx: number, dy: number): ProportionalDrivingAxis;
|
|
303
|
+
/**
|
|
304
|
+
* Shift 等比缩放求位(image-ratio-preset 工单 01,spec 决策 5):参照 reference
|
|
305
|
+
* (手势起始盒的声明宽高比)保持宽高比——驱动维随指针(对缘/对角固定语义与
|
|
306
|
+
* resizeBox 同款),钳到 minSize 后派生维随动 = round(驱动维 × 短比)(Math.round
|
|
307
|
+
* 对正数 half-up);派生维同样钳 minSize(极扁/极窄盒派生维可 round 到 0,不钳
|
|
308
|
+
* 会产出零尺寸不可见层)。仅接受双轴皆可写的柄(beginResize 的角色过滤已保证,
|
|
309
|
+
* 派生轴写不出去的面不该进等比模式)。driving 由调用方经 proportionalDrivingAxis
|
|
310
|
+
* 判定一次传入——与吸附位点(resizeProportionalSnapPoints)消费同一判定,吸附
|
|
311
|
+
* 修正并入位移后驱动轴不随修正值翻转(单一事实源)。
|
|
312
|
+
*/
|
|
313
|
+
declare function resizeBoxProportional(start: ResizeBoxGeometry, handle: ResizeHandle, reference: {
|
|
314
|
+
w: number;
|
|
315
|
+
h: number;
|
|
316
|
+
}, driving: ProportionalDrivingAxis, dx: number, dy: number, minSize?: number): ResizeBoxResult;
|
|
317
|
+
/**
|
|
318
|
+
* 等比缩放的吸附位点:只收驱动轴的移动缘——派生维是算术产物,不独立吸附
|
|
319
|
+
* (钳先于吸附同门:吸附修正施加在驱动轴位移上,进 resizeBoxProportional 后
|
|
320
|
+
* 派生维按比例跟随,吸附不破比例)。
|
|
321
|
+
*/
|
|
322
|
+
declare function resizeProportionalSnapPoints(start: ResizeBoxGeometry, handle: ResizeHandle, driving: ProportionalDrivingAxis, dx: number, dy: number): SnapPoints;
|
|
298
323
|
/** 可缩放轴(width = 横向宽字段可写、height = 纵向高字段可写) */
|
|
299
324
|
interface ResizeAxes {
|
|
300
325
|
readonly width: boolean;
|
|
@@ -491,6 +516,46 @@ declare const TEXT_PRESETS: readonly {
|
|
|
491
516
|
}[];
|
|
492
517
|
/** 新层样式槽初值:自工厂 TextLayer 形态派生(工厂缺省是单一事实源,槽跟着走) */
|
|
493
518
|
declare function defaultNextTextStyle(): NextTextStyle;
|
|
519
|
+
/**
|
|
520
|
+
* 建层比例档位(spec 决策 1/2):'free' = 自由钳(工厂行为兜底),其余五个具名
|
|
521
|
+
* 有理数比。v1 固定清单、无自定义输入。
|
|
522
|
+
*/
|
|
523
|
+
type RatioPresetId = 'free' | '1:1' | '4:3' | '3:4' | '16:9' | '9:16';
|
|
524
|
+
/** 比例预设档位:具名 id + 有理数宽高比(free 档 ratio = null,即不钳) */
|
|
525
|
+
interface RatioPreset {
|
|
526
|
+
readonly id: RatioPresetId;
|
|
527
|
+
readonly ratio: Readonly<{
|
|
528
|
+
w: number;
|
|
529
|
+
h: number;
|
|
530
|
+
}> | null;
|
|
531
|
+
}
|
|
532
|
+
/** 比例预设常量六档(顺序即面板平铺序:自由在前,其余按惯例短比在前) */
|
|
533
|
+
declare const RATIO_PRESETS: readonly RatioPreset[];
|
|
534
|
+
/** 建层比例槽初值:自由(工厂画拉行为兜底) */
|
|
535
|
+
declare function defaultNextLayerRatio(): RatioPresetId;
|
|
536
|
+
/** 档位 → 钳制用有理数比:'free' → null(不钳),具名档 → {w, h} 副本 */
|
|
537
|
+
declare function ratioValue(id: RatioPresetId): {
|
|
538
|
+
w: number;
|
|
539
|
+
h: number;
|
|
540
|
+
} | null;
|
|
541
|
+
/**
|
|
542
|
+
* 建层比例槽的宽容读(prefs 恢复唯一入口):六档枚举值原样收,其余(旧快照
|
|
543
|
+
* 缺字段/存储端脏值)回落 'free'。载荷来自宿主 JSON 快照,类型层的形状信任
|
|
544
|
+
* 不了,运行时验;未知 prefs 键由调用方整体忽略(不进本函数视野)。
|
|
545
|
+
*/
|
|
546
|
+
declare function pickNextLayerRatio(raw: unknown): RatioPresetId;
|
|
547
|
+
/**
|
|
548
|
+
* 死区点击缺省盒的比例派生(spec 决策 3):长边 200 定短边——短边 = round(长边
|
|
549
|
+
* × 短比)(Math.round 对正数 half-up:16:9 → 200×113)。自由档不进本函数
|
|
550
|
+
* (调用方以 ratioValue 为 null 分流到工厂缺省 200×150)。
|
|
551
|
+
*/
|
|
552
|
+
declare function defaultSizeForRatio(ratio: {
|
|
553
|
+
w: number;
|
|
554
|
+
h: number;
|
|
555
|
+
}): {
|
|
556
|
+
width: number;
|
|
557
|
+
height: number;
|
|
558
|
+
};
|
|
494
559
|
/**
|
|
495
560
|
* 新层样式字段的宽容读逐字段收口(text-defaults 工单 01;评审合流——捕获与
|
|
496
561
|
* prefs 恢复共用同一谓词,不再双写):合法字段进合并集,缺字/类型不符忽略
|
|
@@ -514,10 +579,16 @@ declare function createDefaultLayer(type: LayerType, textDefaults?: Partial<Next
|
|
|
514
579
|
* 高按解码归一为 0、宽 := 表宽关 autoWidth)+ 满宽 60 高缺省格带缺省文本内容
|
|
515
580
|
* (内容宽度同步、零高度耦合,ADR 0006)。rowsPath 由调用方必填(解码
|
|
516
581
|
* rows_path_missing 硬约束,创建表单校验前置);缺省格 60 高保证空态预览行可见
|
|
517
|
-
* 可点(合成高 = 最高格,03 票 E1 机制)。
|
|
582
|
+
* 可点(合成高 = 最高格,03 票 E1 机制)。shape(template-table-drag-create 工单
|
|
583
|
+
* 01):画拉建层的手势矩形尺寸参数化——表壳宽高照落,行模板/格/内容宽 := 表宽
|
|
584
|
+
* 的既有耦合自然生效;缺省 400×120 不变。
|
|
518
585
|
*/
|
|
519
586
|
declare function createTemplateTable(options: {
|
|
520
587
|
rowsPath: string;
|
|
588
|
+
shape?: {
|
|
589
|
+
width: number;
|
|
590
|
+
height: number;
|
|
591
|
+
};
|
|
521
592
|
}): TableLayer;
|
|
522
593
|
/**
|
|
523
594
|
* 「insert-before 原始序号 to」移动的公共守卫与落点折算:from/to 须为安全整数、
|
|
@@ -594,7 +665,7 @@ declare function deleteLayerInDraft(draft: Draft<Canvas>, path: LayerPath): Dele
|
|
|
594
665
|
* D6 钉定:注入边界一次性转译为内部形状树(不在查询期惰性解析原始 schema,
|
|
595
666
|
* 行业惯例见 schema-completion-research.md)。方言子集 = JSON Schema draft-07 的
|
|
596
667
|
* 结构关键词(`properties` / `items` / `type`)+ 注解关键词(`description` /
|
|
597
|
-
* `title` /
|
|
668
|
+
* `title` / 白名单 `format`,见下)+ 引用关键词
|
|
598
669
|
* (`$ref` 内部 JSON Pointer、`definitions`/`$defs` 命名池);其余关键词
|
|
599
670
|
* (`required`/`enum`/`const`/`allOf` 族/`patternProperties`/`$schema`/`$id` 及
|
|
600
671
|
* 一切未识别键)宽松忽略,节点按已识别字段归一(可能变叶子)。
|
|
@@ -609,10 +680,14 @@ declare function deleteLayerInDraft(draft: Draft<Canvas>, path: LayerPath): Dele
|
|
|
609
680
|
* 注解只影响建议面(date() 建议分桶),求值器/graph/wire 三端零感知。
|
|
610
681
|
*
|
|
611
682
|
* 降级分级(D7):
|
|
612
|
-
* -
|
|
683
|
+
* - **整份拒绝**保留根级结构性问题(在原始文档上判定,拒绝面与 walker 时代
|
|
613
684
|
* 全等):根非对象 / 根缺 properties 层级(含根级 `$ref`——根不解引用)/
|
|
614
685
|
* `reserved_root_key`(根级键 `row` 或 `$` 前缀,前移填充期硬错误,对应
|
|
615
|
-
* `CanvasHydrator::assertReservedRootKeys
|
|
686
|
+
* `CanvasHydrator::assertReservedRootKeys`;仅根级保留,嵌套层同名键合法)+
|
|
687
|
+
* 开放映射契约废除(ADR 0020,resource-expression-single-ref 工单 04):文档
|
|
688
|
+
* 任意层 `additionalProperties: true` 显式拒绝(`open_map_unsupported`,deref
|
|
689
|
+
* 前对原始文档扫描,$ref 目标与宽松忽略关键词容器内同不留活口)——错误信息
|
|
690
|
+
* 教学宿主:动态键由宿主组装成具体 properties 后注入。
|
|
616
691
|
* - **局部故障**(`$ref` 断链 / 外部指针 / 环引用(活跃路径 seen-set 判定)/
|
|
617
692
|
* 目标形态不符)→ 该节点降级为叶子(保留本地 type/description/title 注解)+
|
|
618
693
|
* diagnostics 逐条记录,树其余部分照常服务;注入期由
|
|
@@ -636,9 +711,9 @@ declare function deleteLayerInDraft(draft: Draft<Canvas>, path: LayerPath): Dele
|
|
|
636
711
|
* (type 声明为 array 或声明了 items)收敛为叶子、不沿 items 链穿透:具名段下钻
|
|
637
712
|
* 数组在求值器(InterpolationEvaluator::navigateValue)是静默空串(缺字段信号),
|
|
638
713
|
* 补全不得怂恿写渲染为空白的表达式;类型徽标仍显示 array 本身,不特供「供表格
|
|
639
|
-
* rowsPath 使用」文案(为表达式内置函数留前瞻口,spec D9
|
|
640
|
-
* (
|
|
641
|
-
*
|
|
714
|
+
* rowsPath 使用」文案(为表达式内置函数留前瞻口,spec D9)。开放映射信号面
|
|
715
|
+
* (D10)已随契约废除整体移除(ADR 0020,resource-expression-single-ref 工单
|
|
716
|
+
* 04)——schema 解析边界显式拒绝后,树内不存在动态键节点。
|
|
642
717
|
*
|
|
643
718
|
* 全模块零 DOM、零内部依赖(editor-shared-isolation);除
|
|
644
719
|
* normalizeExpressionSchemaSource 的 console 警告收口(注入期汇总一次)外均为纯函数。
|
|
@@ -650,8 +725,6 @@ interface ExpressionSchemaNode {
|
|
|
650
725
|
/** 展示回落注解(D8):浮层取 description ?? title */
|
|
651
726
|
title?: string;
|
|
652
727
|
description?: string;
|
|
653
|
-
/** 开放映射标记(D10):`additionalProperties: true`;动态字段实际键由宿主合入 properties */
|
|
654
|
-
open?: boolean;
|
|
655
728
|
/**
|
|
656
729
|
* 日期标记注解(工单 11,D13):`format: "date" | "date-time"` 白名单两值、
|
|
657
730
|
* 仅 type 归一为 string 的节点挂;只影响 date() 建议分桶,永不触发诊断
|
|
@@ -665,8 +738,12 @@ interface ExpressionSchemaChildEntry {
|
|
|
665
738
|
key: string;
|
|
666
739
|
node: ExpressionSchemaNode;
|
|
667
740
|
}
|
|
668
|
-
/**
|
|
669
|
-
|
|
741
|
+
/**
|
|
742
|
+
* 声明期拒绝原因:reserved_root_key = 前移的填充期硬错误;invalid_schema = 形态
|
|
743
|
+
* 非法;open_map_unsupported = 开放映射契约废除(ADR 0020:additionalProperties:
|
|
744
|
+
* true 显式拒绝,动态键归宿主组装成具体 properties 后注入)
|
|
745
|
+
*/
|
|
746
|
+
type ExpressionSchemaRejectReason = 'reserved_root_key' | 'invalid_schema' | 'open_map_unsupported';
|
|
670
747
|
/** 局部故障诊断码(D7 四类,全部 $ref 解析面;节点降叶子 + 树其余照常服务) */
|
|
671
748
|
type ExpressionSchemaDiagnosticCode = 'broken_ref' | 'external_ref' | 'circular_ref' | 'target_shape_mismatch';
|
|
672
749
|
/** 一条局部故障诊断:path = 降级节点在原始 schema 文档中的声明路径(JSON Pointer 风格) */
|
|
@@ -686,7 +763,8 @@ type ExpressionSchemaParse = {
|
|
|
686
763
|
};
|
|
687
764
|
/**
|
|
688
765
|
* 声明期编译(D6 注入边界一次性转译):合法 → 节点树 + diagnostics(局部故障
|
|
689
|
-
* 逐条,可为空);根级保留键 → reserved_root_key;根级结构非法 → invalid_schema
|
|
766
|
+
* 逐条,可为空);根级保留键 → reserved_root_key;根级结构非法 → invalid_schema;
|
|
767
|
+
* 开放映射(文档任意层 additionalProperties: true)→ open_map_unsupported。
|
|
690
768
|
* 根级判定在原始文档上进行(根级 `$ref` 不解引用,拒绝面与 walker 时代全等)。
|
|
691
769
|
*/
|
|
692
770
|
declare function parseExpressionSchema(raw: unknown): ExpressionSchemaParse;
|
|
@@ -703,14 +781,12 @@ declare function normalizeExpressionSchemaSource(raw: unknown): ExpressionSchema
|
|
|
703
781
|
*/
|
|
704
782
|
declare function schemaNodeAtPath(node: ExpressionSchemaNode, segments: readonly string[]): ExpressionSchemaNode | null;
|
|
705
783
|
/**
|
|
706
|
-
* 一层子候选枚举结果(D9
|
|
707
|
-
*
|
|
784
|
+
* 一层子候选枚举结果(D9 候选视图的返回面)。开放映射信号(D10)已随契约废除
|
|
785
|
+
* 移除(ADR 0020)——schema 解析边界显式拒绝后,视图只承载候选条目。
|
|
708
786
|
*/
|
|
709
787
|
interface ExpressionSchemaChildView {
|
|
710
788
|
/** 一层子候选(按声明序);数组节点收敛为叶子 = 空(D9) */
|
|
711
789
|
entries: readonly ExpressionSchemaChildEntry[];
|
|
712
|
-
/** 开放映射信号(D10):节点标 open(additionalProperties: true)时为 true;非 open 恒缺省 */
|
|
713
|
-
open?: boolean;
|
|
714
790
|
}
|
|
715
791
|
/**
|
|
716
792
|
* 一层子候选枚举(枚举层候选视图,D9 分叉点):数组节点(type 声明为 array 或
|
|
@@ -718,7 +794,7 @@ interface ExpressionSchemaChildView {
|
|
|
718
794
|
* (navigateValue 缺字段信号),补全不得怂恿写渲染为空白的表达式(spec §2 D9,
|
|
719
795
|
* 2026-09-30 修订 D3);声明自相矛盾(type array 而又带 properties/items)时从疑
|
|
720
796
|
* 同样收敛,对齐 D7 疑点降叶哲学。其余节点取**自身** properties(按声明序),
|
|
721
|
-
* 不沿 items 链穿透。
|
|
797
|
+
* 不沿 items 链穿透。
|
|
722
798
|
* 下钻层(schemaNodeAtPath/resolveRowSchema)机制不动,rowsPath/`row.*`/`$index`
|
|
723
799
|
* 零影响(数组的数组穿透不回归)。
|
|
724
800
|
*/
|
|
@@ -812,6 +888,13 @@ interface ResizeGesture {
|
|
|
812
888
|
interface CreateGesture {
|
|
813
889
|
/** 本次画拉的层型(beginLayerCreate 时从 armedCreate 捕获,会话内定死) */
|
|
814
890
|
type: LayerType;
|
|
891
|
+
/**
|
|
892
|
+
* 模板表风味的行路径载荷(canvas-web-template-table-drag-create 工单 01):
|
|
893
|
+
* beginLayerCreate 时从 ui.armedCreateRowsPath 捕获(会话内定死),非空串 =
|
|
894
|
+
* 模板表风味(endCreate 分派 createTemplateTable);undefined = 普通武装
|
|
895
|
+
* (G 快捷键 V1 空表语义原样)。
|
|
896
|
+
*/
|
|
897
|
+
templateRowsPath?: string;
|
|
815
898
|
/** 起点场景坐标(两点正规化与死区判定基准) */
|
|
816
899
|
startScene: Point;
|
|
817
900
|
/** 当前指针场景坐标 */
|
|
@@ -824,16 +907,26 @@ interface CreateGesture {
|
|
|
824
907
|
* textarea(非受控),提交经 commitTextEdit 一次性落文档——「每个拼音音节一个
|
|
825
908
|
* undo」被会话缓冲天然避免(impl 研究 §2.4)。
|
|
826
909
|
*
|
|
827
|
-
* expression
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
*
|
|
910
|
+
* expression 是内容模式**活标志**(canvas-web-expression-editing 工单 01 锚定;
|
|
911
|
+
* canvas-web-edit-overlay-toolbar 工单 02 + ADR 0019 改造为活标志,取代旧「进入
|
|
912
|
+
* 时快照冻结」):初值按进入瞬间 `layer.expression !== null` 取定,此后不再冻结
|
|
913
|
+
* ——画布 pill 切换与内核 toggleDataMode 在会话期被调用都只翻本标志(零文档变更
|
|
914
|
+
* 零历史步,防御性路由),旁门内容写(updateData/updateDataExpression 命中编辑层)
|
|
915
|
+
* **不**翻标志、走草稿接管。会话在场时内容模式显示以本标志为单一事实源(pill、
|
|
916
|
+
* 属性面板锁定段、textEditLayout.expressionMode 同源),提交去向由退出时现态
|
|
917
|
+
* 裁决。住 ui 分支不进历史。
|
|
833
918
|
*/
|
|
834
919
|
interface TextEditingSession {
|
|
835
920
|
path: LayerPath;
|
|
836
921
|
expression: boolean;
|
|
922
|
+
/**
|
|
923
|
+
* 草稿接管序号(工单 02,会话内容独占的内核底线面):旁门内容写(查找替换等
|
|
924
|
+
* 程序化写)命中编辑层且文档确实变更时递增——绑定层监听该序号全量替换
|
|
925
|
+
* textarea 草稿为新文档值并刷新表达式诊断(「替换结果出现在正在编辑的框里」,
|
|
926
|
+
* 退出提交仍以草稿为准、任何方向不丢字)。进入编辑时缺省(undefined),首次
|
|
927
|
+
* 接管起计数;标志翻转(pill/toggleDataMode)与零变更事务不递增。
|
|
928
|
+
*/
|
|
929
|
+
draftSeq?: number;
|
|
837
930
|
}
|
|
838
931
|
/**
|
|
839
932
|
* 查找替换会话(canvas-web-find-replace 工单 01,CONTEXT「查找替换」词条):
|
|
@@ -864,6 +957,14 @@ interface EditorUi {
|
|
|
864
957
|
* 解除。无粘性工具态(spec 决策 2);openDocument 重置。
|
|
865
958
|
*/
|
|
866
959
|
armedCreate: LayerType | null;
|
|
960
|
+
/**
|
|
961
|
+
* 武装 token 的模板表风味载荷(canvas-web-template-table-drag-create 工单 01):
|
|
962
|
+
* 行路径表单确认即武装(spec 决策 3)——armedCreate === 'TableLayer' 且本载荷
|
|
963
|
+
* 非空串 = 模板表风味(endCreate 按风味分派 createTemplateTable);空串 = 普通
|
|
964
|
+
* 表武装(G 快捷键语义不受染指)。rowsPath 是 ui 瞬态载荷——不进 graph、
|
|
965
|
+
* 不进 wire(红线 3 延伸),beginLayerCreate 捕获进建层会话;openDocument 重置。
|
|
966
|
+
*/
|
|
967
|
+
armedCreateRowsPath: string;
|
|
867
968
|
/** 进行中的画拉建层橡皮筋会话(拖拽期纯视觉,文档零变更);null = 无 */
|
|
868
969
|
create: CreateGesture | null;
|
|
869
970
|
/** 进行中的文本编辑会话;null = 非编辑态 */
|
|
@@ -887,6 +988,16 @@ interface EditorUi {
|
|
|
887
988
|
* 置,永不进历史;随工程数据 prefs 桶跨会话持久(宿主通道,内核零 localStorage)。
|
|
888
989
|
*/
|
|
889
990
|
nextTextStyle: NextTextStyle;
|
|
991
|
+
/**
|
|
992
|
+
* 建层比例槽(image-ratio-preset 工单 01,CONTEXT「建层比例」词条):记忆
|
|
993
|
+
* 「下一个新建图片层用什么宽高比」的编辑器级偏好——六档、缺省自由,仅
|
|
994
|
+
* ImageLayer 消费(QR 恒方是层型硬钳,其余层型无此槽)。比例预设的应用 =
|
|
995
|
+
* 写槽再武装画拉(armLayerCreate),普通图片层项/快捷键 I 不带 preset、武装
|
|
996
|
+
* 后按槽值钳制——槽是唯一偏好源。与锚点折叠同款的面板偏好——openDocument
|
|
997
|
+
* 换文档不重置,永不进历史;随工程数据 prefs 桶跨会话持久(宿主通道,内核
|
|
998
|
+
* 零 localStorage)。
|
|
999
|
+
*/
|
|
1000
|
+
nextLayerRatio: RatioPresetId;
|
|
890
1001
|
/**
|
|
891
1002
|
* 数据源 schema 声明(content-completion 工单 03/08,D2 宿主随会话注入):
|
|
892
1003
|
* 编译产物形状树或降级 null(根级结构性拒绝,注入期经
|
|
@@ -984,7 +1095,7 @@ declare class EditorStore {
|
|
|
984
1095
|
get canRedo(): boolean;
|
|
985
1096
|
/** 打开/替换文档:ui 选择/编辑/重命名会话与双向历史一并重置(新文档不继承旧路径/旧事务);
|
|
986
1097
|
* 参考线/锁定集合/查找会话/建层武装与画拉会话随当次会话清空(对位轴/文档内容防护/
|
|
987
|
-
*
|
|
1098
|
+
* 查询词/待命层型不跨文档),标尺显隐/锚点折叠/新层样式/建层比例作为偏好保留 */
|
|
988
1099
|
openDocument(canvas: Canvas): void;
|
|
989
1100
|
/**
|
|
990
1101
|
* 文档事务唯一入口:produceWithPatches 求新树,无变化即空转(不进历史不通知);
|
|
@@ -1014,8 +1125,13 @@ declare class EditorStore {
|
|
|
1014
1125
|
setDrag(gesture: DragGesture | null): void;
|
|
1015
1126
|
/** 缩放会话开始/结束(null,工单 07);会话对象住 ui 分支,文档只收缩放事务 */
|
|
1016
1127
|
setResize(gesture: ResizeGesture | null): void;
|
|
1017
|
-
/**
|
|
1018
|
-
|
|
1128
|
+
/**
|
|
1129
|
+
* 建层武装置/解除(null,drag-create 工单 01);标量值等短路(重复武装同型
|
|
1130
|
+
* 不通知)。rowsPath(template-table-drag-create 工单 01):模板表风味载荷
|
|
1131
|
+
* 与层型一体写——同层型同载荷才短路(重复武装同型换载荷要更新),解除
|
|
1132
|
+
* (null)一律清载荷。
|
|
1133
|
+
*/
|
|
1134
|
+
setArmedCreate(type: LayerType | null, rowsPath?: string): void;
|
|
1019
1135
|
/** 画拉橡皮筋会话开始/更新/结束(null);会话对象住 ui 分支,落库在 endCreate 单事务 */
|
|
1020
1136
|
setCreate(gesture: CreateGesture | null): void;
|
|
1021
1137
|
/** 文本编辑会话开始/结束(null);会话住 ui 分支,文本经 commitTextEdit 一次性落文档 */
|
|
@@ -1029,6 +1145,11 @@ declare class EditorStore {
|
|
|
1029
1145
|
* 写入口):patch 并入现值,五字段值等短路(重复写同值零通知),不进历史。
|
|
1030
1146
|
*/
|
|
1031
1147
|
setNextTextStyle(patch: Partial<NextTextStyle>): void;
|
|
1148
|
+
/**
|
|
1149
|
+
* 建层比例槽写入(image-ratio-preset 工单 01:比例预设应用 / prefs 恢复的
|
|
1150
|
+
* 统一写入口):值等短路(重复写同档零通知),仅 ui 通知、不进历史。
|
|
1151
|
+
*/
|
|
1152
|
+
setNextLayerRatio(id: RatioPresetId): void;
|
|
1032
1153
|
/**
|
|
1033
1154
|
* 数据源 schema 声明替换(归一产物或降级 null,校验收口在注入缝不在这里):
|
|
1034
1155
|
* 同引用短路(重复注入同一归一产物不惊动订阅方);仅 ui 通知,不参与重绘
|
|
@@ -1169,6 +1290,12 @@ interface EditorPrefsState {
|
|
|
1169
1290
|
* 由 applyEditorPrefs 宽容读兜底为现值(会话内即工厂缺省)。
|
|
1170
1291
|
*/
|
|
1171
1292
|
nextTextStyle: NextTextStyle;
|
|
1293
|
+
/**
|
|
1294
|
+
* 建层比例槽(image-ratio-preset 工单 01,CONTEXT「建层比例」词条):随 prefs
|
|
1295
|
+
* 桶跨会话持久(per-模板记忆,「自由」即显式重置档)。schemaVersion 不升——
|
|
1296
|
+
* 加法演进,旧快照缺字段或脏值由 applyEditorPrefs 宽容读回落 'free'。
|
|
1297
|
+
*/
|
|
1298
|
+
nextLayerRatio: RatioPresetId;
|
|
1172
1299
|
}
|
|
1173
1300
|
|
|
1174
1301
|
/**
|
|
@@ -1279,7 +1406,7 @@ type InvalidateTarget = 'content' | 'overlay' | 'both';
|
|
|
1279
1406
|
interface TextEditLayout {
|
|
1280
1407
|
/** 编辑中图层的绝对盒(场景坐标;textarea 覆盖整盒,文字按 padding 内缩) */
|
|
1281
1408
|
box: LayerBox;
|
|
1282
|
-
/**
|
|
1409
|
+
/** 当前文档文本(textarea 初值消费;live 键入只住草稿不落文档) */
|
|
1283
1410
|
text: string;
|
|
1284
1411
|
/** 原始字体引用(空串/纯数字 = 内置默认字体;URL 由绑定层解析注册族名) */
|
|
1285
1412
|
font: string;
|
|
@@ -1301,10 +1428,9 @@ interface TextEditLayout {
|
|
|
1301
1428
|
/** autowrap = textarea pre-wrap 软换行,否则 pre 单行(断行允许与预览不同,决策 A) */
|
|
1302
1429
|
autowrap: boolean;
|
|
1303
1430
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
* 无活动会话时按层标记态回落(进入编辑即锚定同值)。
|
|
1431
|
+
* 内容模式活标志(ADR 0019):true = 表达式——绑定层 pill 激活态与补全
|
|
1432
|
+
* enabled 的消费面。取会话活标志(pill 切换与内核 toggleDataMode 会话期实时
|
|
1433
|
+
* 翻转,面板锁定段同源随动);路径无活动会话时按层标记态回落。
|
|
1308
1434
|
*/
|
|
1309
1435
|
expressionMode: boolean;
|
|
1310
1436
|
}
|
|
@@ -1569,8 +1695,17 @@ declare class EditorSession {
|
|
|
1569
1695
|
*
|
|
1570
1696
|
* 拖不动写不动的同门守卫:无会话、目标层被结构编辑移除(悬空路径)整体
|
|
1571
1697
|
* 空转(不发事务、不发布命中轴)。
|
|
1698
|
+
*
|
|
1699
|
+
* Shift 等比(image-ratio-preset 工单 01,spec 决策 5):仅 ImageLayer 生效
|
|
1700
|
+
* (其余层型 shift 空转走现状——自适应与尺寸耦合面不被触碰),且须双轴皆在
|
|
1701
|
+
* 可缩放面(格内容等强同步面派生轴写不出去,不进等比模式)、起始盒零维空转
|
|
1702
|
+
* (无比例可参照,回落自由)。参照手势起始盒实际宽高比;驱动轴 = 角柄取位
|
|
1703
|
+
* 移较大轴、边中柄取被拖轴;派生维 = round(驱动维 × 短比)(钳后驱动维跟随,
|
|
1704
|
+
* 最小钳位随动);对缘/对角固定照旧;吸附只在驱动轴移动缘候选(派生轴是算
|
|
1705
|
+
* 术产物不独立吸附,钳先于吸附同门)。等比模式双轴都落声明值(派生轴写算
|
|
1706
|
+
* 术积并清 auto 标志),canonicalize 以驱动轴键收口。
|
|
1572
1707
|
*/
|
|
1573
|
-
resizeTo(sceneX: number, sceneY: number): void;
|
|
1708
|
+
resizeTo(sceneX: number, sceneY: number, shift?: boolean): void;
|
|
1574
1709
|
/**
|
|
1575
1710
|
* 结束缩放:闭合合并事务(下一步历史定格),会话态与命中轴回显清空。
|
|
1576
1711
|
* 无会话空转(幂等,pointercancel 与 pointerup 双路同达)。
|
|
@@ -1581,14 +1716,27 @@ declare class EditorSession {
|
|
|
1581
1716
|
* 分支待命层型,下一次画布按下即开画拉;建层提交或 Esc 即解除——一次性
|
|
1582
1717
|
* 待命态,无粘性工具(spec 决策 2)。重复武装同型值等短路零通知。
|
|
1583
1718
|
*
|
|
1584
|
-
* preset(text-defaults 工单 01
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1719
|
+
* preset(text-defaults 工单 01 + image-ratio-preset 工单 01):层型相关预设 =
|
|
1720
|
+
* 写槽的快捷方式——命中档位先把档位值并入对应偏好槽再武装;未知 id = 跳过
|
|
1721
|
+
* 写槽、武装照常(评审口径统一:「空转」只指写槽,武装层型本身仍合法)。
|
|
1722
|
+
* - TextLayer + 文本预设档:写新层样式槽(v1 只 fontSize);
|
|
1723
|
+
* - ImageLayer + 比例预设档:写建层比例槽('free' 即显式重置档);QR 恒方
|
|
1724
|
+
* 是层型硬钳、无比例槽(spec 豁免面);
|
|
1725
|
+
* - 交叉类型(文本层带比例档/图片层带文本档)各在对方清单查无此档、天然
|
|
1726
|
+
* 跳写槽。
|
|
1727
|
+
*/
|
|
1728
|
+
armLayerCreate(type: LayerType, preset?: TextPresetId | RatioPresetId): void;
|
|
1729
|
+
/** 解除建层武装(取消入口):仅清待命态(含模板表风味载荷),零副作用。 */
|
|
1591
1730
|
cancelArmLayerCreate(): void;
|
|
1731
|
+
/**
|
|
1732
|
+
* 武装模板表建层(canvas-web-template-table-drag-create 工单 01,spec 决策 3):
|
|
1733
|
+
* 行路径表单确认即武装——rowsPath 随武装进 ui 瞬态载荷(armedCreate 仍为
|
|
1734
|
+
* 'TableLayer'、不新增 LayerType、不进 graph),下一次画拉或死区点击落模板表。
|
|
1735
|
+
* 空串 no-op(内核防御,表单层已拦);重复武装同 rowsPath 值等短路,换
|
|
1736
|
+
* rowsPath 更新载荷。TableLayer 的 G 武装语义(V1 普通表,armLayerCreate 走
|
|
1737
|
+
* 空载荷)不受染指。
|
|
1738
|
+
*/
|
|
1739
|
+
armTemplateTableCreate(rowsPath: string): void;
|
|
1592
1740
|
/**
|
|
1593
1741
|
* 开始画拉会话:须已武装(未武装空转防御——画布手势态机的分派前置,此守卫
|
|
1594
1742
|
* 兜其余调用来源),与拖动/缩放会话互斥(手势起点一次性定死,beginDrag/
|
|
@@ -1599,24 +1747,37 @@ declare class EditorSession {
|
|
|
1599
1747
|
beginLayerCreate(sceneX: number, sceneY: number): boolean;
|
|
1600
1748
|
/**
|
|
1601
1749
|
* 画拉进行中:橡皮筋求位(spatial/create.createRubberBandRect——两点正规化
|
|
1602
|
-
* + QR 钳 height := width + 左右/上下缘各两点进
|
|
1603
|
-
*
|
|
1604
|
-
* ui.snapAxes 走 GuidesOverlay
|
|
1605
|
-
* (snapAxesForGesture(null)
|
|
1606
|
-
*
|
|
1750
|
+
* + QR 钳 height := width / 比例钳长轴驱动 + 左右/上下缘各两点进
|
|
1751
|
+
* resolveSnapPoints,吸附数学零新增)写回会话 rect 供 overlay 直读(虚线
|
|
1752
|
+
* 矩形 + W×H 气泡),命中轴回写 ui.snapAxes 走 GuidesOverlay 既有通道回显
|
|
1753
|
+
* (dragTo 同门)。吸附排除面为空(snapAxesForGesture(null)——新层尚未入库,
|
|
1754
|
+
* 全部可见根层供轴,copyMode 首移同门)。零文档事务:修正只进会话几何,
|
|
1755
|
+
* 落库在 endCreate。
|
|
1756
|
+
*
|
|
1757
|
+
* 建层比例槽(image-ratio-preset 工单 01,spec 决策 3/4):仅 ImageLayer 按槽
|
|
1758
|
+
* 钳制(QR 层不传 ratio、恒方语义不动,两钳互斥;其余层型无槽);Shift 瞬时
|
|
1759
|
+
* 反转槽态——槽非自由按 Shift = 临时自由、槽自由按 Shift = 临时钳 1:1,按住
|
|
1760
|
+
* 生效松开还原(逐帧求位、不写槽、不改武装态,Figma 惯例的手势瞬时语义)。
|
|
1607
1761
|
*/
|
|
1608
|
-
createTo(sceneX: number, sceneY: number): void;
|
|
1762
|
+
createTo(sceneX: number, sceneY: number, shift?: boolean): void;
|
|
1609
1763
|
/**
|
|
1610
1764
|
* 结束画拉:按死区分流落库(一次手势 = 一步历史,undo 整体回退落位 + 尺寸
|
|
1611
1765
|
* + priority)。先清会话再落文档(commitTextEdit 同门——退出路径级联时幂等):
|
|
1612
1766
|
* - 死区外:单事务写入「createDefaultLayer 缺省形态 + position 左上角对准
|
|
1613
1767
|
* 橡皮筋矩形(含吸附修正)+ shape.width/height」并 insertRootLayerInDraft
|
|
1614
|
-
* 置顶(priority min−1、push
|
|
1768
|
+
* 置顶(priority min−1、push 数组尾)——尺寸取手势末态钳制结果(含 Shift
|
|
1769
|
+
* 反转末态,image-ratio-preset 工单 01 spec 决策 4);
|
|
1615
1770
|
* - 死区内(点击兜底,位移按 CREATE_DEAD_ZONE_SCREEN_PX 屏幕 px 随 zoom 折算,
|
|
1616
|
-
* ALT_DRAG_DEAD_ZONE_SCREEN_PX
|
|
1771
|
+
* ALT_DRAG_DEAD_ZONE_SCREEN_PX 同门):左上角对准点击点;尺寸按槽派生缺省
|
|
1772
|
+
* 盒(image-ratio-preset 工单 01:ImageLayer 长边 200 定短边,自由 = 工厂
|
|
1773
|
+
* 200×150 现状;忽略 shift——无位移可供等比约束;其余层型保持工厂缺省)。
|
|
1617
1774
|
* 落库后自动选中新层并解除武装;返回新层路径(绑定层消费:文本层据此自动
|
|
1618
1775
|
* 进文本编辑,spec 决策 6)。无会话/无文档空转返回 null。点击兜底不产生
|
|
1619
1776
|
* 零尺寸层(缺省形态自带可见尺寸)。
|
|
1777
|
+
*
|
|
1778
|
+
* 模板表风味(template-table-drag-create 工单 01):会话载荷 templateRowsPath
|
|
1779
|
+
* 非空即分派 createTemplateTable 工厂(死区外 shape = 手势正规化矩形,死区内
|
|
1780
|
+
* 缺省壳 400×120、左上角对准点击点);模板层不自动进文本编辑(文本层专属)。
|
|
1620
1781
|
*/
|
|
1621
1782
|
endCreate(): LayerPath | null;
|
|
1622
1783
|
/**
|
|
@@ -1715,7 +1876,9 @@ declare class EditorSession {
|
|
|
1715
1876
|
* 应用偏好(会话建立时一次性,跨会话恢复 prefs 的写入口):整体替换
|
|
1716
1877
|
* rulersVisible/anchorExpanded,不进历史;值等写入经 store 短路零通知。
|
|
1717
1878
|
* 新层样式(text-defaults 工单 01)走宽容读逐字段合并(pickNextTextStylePatch
|
|
1718
|
-
*
|
|
1879
|
+
* 共享谓词——与捕获同门,缺字/类型不符保留现值);建层比例(image-ratio-preset
|
|
1880
|
+
* 工单 01)走宽容读枚举收口(pickNextLayerRatio——非六档枚举值/旧快照缺字段
|
|
1881
|
+
* 回落 'free')。
|
|
1719
1882
|
*/
|
|
1720
1883
|
applyEditorPrefs(prefs: EditorPrefsState): void;
|
|
1721
1884
|
/**
|
|
@@ -1736,11 +1899,10 @@ declare class EditorSession {
|
|
|
1736
1899
|
* 进入文本编辑:路径必须解析到 TextLayer。会话只进 ui 分支(不进历史),
|
|
1737
1900
|
* live 文本住在绑定层的 textarea,内容层随即跳绘该层文本(防重影)。
|
|
1738
1901
|
*
|
|
1739
|
-
*
|
|
1740
|
-
*
|
|
1741
|
-
*
|
|
1742
|
-
*
|
|
1743
|
-
* 不重锚);换层进入按新层现状重锚。
|
|
1902
|
+
* 内容模式活标志(ADR 0019)初值按进入瞬间 `layer.expression !== null` 取定
|
|
1903
|
+
* (与文档现态一致),此后不再冻结——pill 切换与内核 toggleDataMode 会话期
|
|
1904
|
+
* 都只翻标志,提交去向由退出时现态裁决(见 commitTextEdit)。同路径重复进入
|
|
1905
|
+
* 短路(会话不重建,接管序号延续);换层进入按新层现状取初值。
|
|
1744
1906
|
*/
|
|
1745
1907
|
beginTextEdit(path: LayerPath): boolean;
|
|
1746
1908
|
/**
|
|
@@ -1749,22 +1911,24 @@ declare class EditorSession {
|
|
|
1749
1911
|
* 提交与随后 blur 竞态),会话清空后后续调用幂等,保证一次退出恰一步历史。
|
|
1750
1912
|
*
|
|
1751
1913
|
* 提交矩阵(canvas-web-expression-editing 工单 01,spec 决策 3,空串判定先于
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
1914
|
+
* 片段判定;对比对象与去向裁决按会话标志**退出时现态**——活标志语义,ADR
|
|
1915
|
+
* 0019,取代旧「进入时快照」):
|
|
1916
|
+
* - 串与文档一致:不进历史(进出编辑零噪声),返回 false——对比对象随退出时
|
|
1917
|
+
* 会话标志取:表达式现态对比 `layer.expression`、静态现态对比 `layer.text`;
|
|
1756
1918
|
* - 空串:删除该图层(复用 deleteLayer 的 splice/重映射语义),任何模式同语义;
|
|
1757
|
-
* -
|
|
1919
|
+
* - 表达式现态且串含 ≥1 语法有效闭合片段(hasValidExpressionFragment):
|
|
1758
1920
|
* updateDataExpression 标记写(保持标记、text 自动重镜像);
|
|
1759
|
-
* -
|
|
1921
|
+
* - 其余(静态现态恒走此支;表达式现态无合法片段回落):updateData 字面写、
|
|
1760
1922
|
* 字面接管解标——含 `{{...}}` 按字面保留,杜绝无片段标记层。
|
|
1761
1923
|
*/
|
|
1762
1924
|
commitTextEdit(text: string): boolean;
|
|
1763
1925
|
/**
|
|
1764
1926
|
* 编辑 overlay 的布局描述:与绘制/命中同一套布局策略求出的盒几何与排版字段
|
|
1765
1927
|
* (textarea 以盒左上对位、盒尺寸占位,字号/行高/内边距按场景像素交给 CSS
|
|
1766
|
-
* transform
|
|
1767
|
-
*
|
|
1928
|
+
* transform 缩放)。对当前文档现算(canvas-web-edit-overlay-toolbar 工单 01,
|
|
1929
|
+
* ADR 0019 布局现算):会话期样式/几何权威写实时反映到查询值;verticalAnchorY
|
|
1930
|
+
* 按当前文档文本计算——live 键入只住 textarea 草稿不落文档,键入不触发文档
|
|
1931
|
+
* 变更,锚点天然稳定不跳。非文本层/路径失效返回 null。
|
|
1768
1932
|
*/
|
|
1769
1933
|
textEditLayout(path: LayerPath): TextEditLayout | null;
|
|
1770
1934
|
/** 编辑会话的目标图层查询:路径须解析到 TextLayer,其余(含无文档)返回 null */
|
|
@@ -1796,14 +1960,16 @@ declare class EditorSession {
|
|
|
1796
1960
|
* 原地不动——事务后派生列表在被替换处缩一位,原下标即「下一处」(「替换后
|
|
1797
1961
|
* 自动跳下一处」靠派生天然成立,末处替换则钳位停在尾)。写值经 replaceHitsInDraft
|
|
1798
1962
|
* 与文本编辑提交同门(text 直写 + expression 保持 null)。无文档/空 query/
|
|
1799
|
-
* 无命中空转返回 false
|
|
1963
|
+
* 无命中空转返回 false。命中编辑层时草稿接管(会话内容独占,工单 02——
|
|
1964
|
+
* 替换结果出现在正在编辑的框里)。
|
|
1800
1965
|
*/
|
|
1801
1966
|
replaceOne(): boolean;
|
|
1802
1967
|
/**
|
|
1803
1968
|
* 全部替换(查找条「全部替换」按钮):命中(path + 偏移对)在事务前按原文
|
|
1804
1969
|
* 快照一次算定,单事务内按同字段偏移降序应用、替换产物不重扫(replacement
|
|
1805
1970
|
* 含查询串不死循环)——一次调用 = 一步历史,undo 一次全回。返回应用处数
|
|
1806
|
-
* (计数反馈「已替换 N 处」);无文档/空 query 空转返回 0
|
|
1971
|
+
* (计数反馈「已替换 N 处」);无文档/空 query 空转返回 0。命中编辑层时
|
|
1972
|
+
* 草稿接管(会话内容独占,工单 02)。
|
|
1807
1973
|
*/
|
|
1808
1974
|
replaceAll(): number;
|
|
1809
1975
|
/**
|
|
@@ -1834,6 +2000,10 @@ declare class EditorSession {
|
|
|
1834
2000
|
* null,值与标记的镜像关系随之解除——标记态文档经字面编辑退化为字面态,
|
|
1835
2001
|
* 不可自动恢复属预期(spec §3.7 兼容面)。
|
|
1836
2002
|
* 表/行/格无数据字段,空转。
|
|
2003
|
+
*
|
|
2004
|
+
* 会话内容独占(工单 02,ADR 0019 内核底线面):命中编辑层的写落文档的同时
|
|
2005
|
+
* 草稿接管(draftSeq 递增,绑定层全量替换 textarea 草稿)——旁门程序化写的
|
|
2006
|
+
* 结果进编辑框草稿而非被退出提交覆盖,任何方向不丢字。
|
|
1837
2007
|
*/
|
|
1838
2008
|
updateData(path: LayerPath, value: string | null, options?: TransactOptions): void;
|
|
1839
2009
|
/**
|
|
@@ -1846,20 +2016,48 @@ declare class EditorSession {
|
|
|
1846
2016
|
* 字面态空值归一交给 updateData/decode 分支(这里不清值,字面接管语义)。
|
|
1847
2017
|
* - 仅三内容层生效,表/行/格/行模板空转(与 updateData 同门)。
|
|
1848
2018
|
* - updateData 语义不变:字面写解除标记仍成立(spec §1 明示两者并排)。
|
|
2019
|
+
* - 命中编辑层的旁门打标同走草稿接管(draftSeq 递增;会话标志不随动——
|
|
2020
|
+
* 活标志只归 pill/toggleDataMode 翻,见 toggleDataMode)。
|
|
1849
2021
|
*/
|
|
1850
2022
|
updateDataExpression(path: LayerPath, expression: string | null, options?: TransactOptions): void;
|
|
2023
|
+
/**
|
|
2024
|
+
* 数据字段取值方式切换(静态 ⇆ 表达式,工单 02 自面板收编内核):表达式现态
|
|
2025
|
+
* → 字面接管(updateData,值保持现镜像);静态现态 → 打标(updateDataExpression,
|
|
2026
|
+
* 初值 = 值字段原文)。各为独立一步历史(无 mergeKey)。三内容层分派各取值
|
|
2027
|
+
* 字段,表/行/格/悬空路径空转。
|
|
2028
|
+
*
|
|
2029
|
+
* 活标志防御路由(ADR 0019):路径即编辑中的层时只翻会话活标志(零文档变更
|
|
2030
|
+
* 零历史步)——会话期内容模式切换的唯一写入口是会话标志,文档面锁定归编辑框
|
|
2031
|
+
* 草稿;面板锁定段/pill 显式调用与宿主旁路调用都安全收敛到同一语义。
|
|
2032
|
+
*/
|
|
2033
|
+
toggleDataMode(path: LayerPath): void;
|
|
2034
|
+
/**
|
|
2035
|
+
* 内容写事务的统一形(会话内容独占工单 02):transact 落库 + 命中编辑层的
|
|
2036
|
+
* 草稿接管收口——updateData/updateDataExpression/replaceOne/replaceAll 四个
|
|
2037
|
+
* 旁门写入口同门(接管判定见 takeoverDraftIfNeeded;零变更事务天然短路)。
|
|
2038
|
+
*/
|
|
2039
|
+
private transactContent;
|
|
2040
|
+
/**
|
|
2041
|
+
* 草稿接管收口(工单 02):paths 中有编辑层且文档确实变更(引用比较——零变更
|
|
2042
|
+
* 事务 transact 空转不通知,接管序号也不动)时递增会话 draftSeq 并广播
|
|
2043
|
+
* ui.editing。绑定层据此全量替换 textarea 草稿为文档新值并刷新表达式诊断。
|
|
2044
|
+
* commitTextEdit 先清会话再落库,天然不复入接管。
|
|
2045
|
+
*/
|
|
2046
|
+
private takeoverDraftIfNeeded;
|
|
1851
2047
|
/** 更新画布级字段(未选中图层时面板的宽/高写入口);键由类型收窄为 width/height */
|
|
1852
2048
|
updateCanvasProp(key: 'width' | 'height', value: number, options?: TransactOptions): void;
|
|
1853
2049
|
/**
|
|
1854
2050
|
* 注入数据源 schema 声明(载荷形态,D1 钉定:声明即 compile(canvas, dataset)
|
|
1855
2051
|
* 收到的 data 载荷形状,根上下文候选 = 载荷顶层键)。声明经
|
|
1856
2052
|
* normalizeExpressionSchemaSource 一次性编译收口——根级结构性问题(保留键
|
|
1857
|
-
* row/$ 前缀,前移填充期 reserved_root_key;根非对象/缺 properties
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
1860
|
-
*
|
|
1861
|
-
*
|
|
1862
|
-
*
|
|
2053
|
+
* row/$ 前缀,前移填充期 reserved_root_key;根非对象/缺 properties 层级)
|
|
2054
|
+
* 与开放映射契约废除(open_map_unsupported,ADR 0020:文档任意层
|
|
2055
|
+
* additionalProperties: true 显式拒绝,动态键归宿主组装成具体 properties 后
|
|
2056
|
+
* 注入)降级为无候选 + console 警告,局部故障($ref 断链/外部指针/环引用/
|
|
2057
|
+
* 目标形态不符)不拒绝:该节点降叶子 + 注入期汇总告警一次,树其余部分照常
|
|
2058
|
+
* 服务,不抛错不弹错(辅助声明不作权威);null/undefined = 清除声明。声明只
|
|
2059
|
+
* 住 store ui 分支:不进 graph、不落 localStorage、不进 wire;openDocument
|
|
2060
|
+
* 换文档不重置,重注入/清除走同一入口。签名与「注入即整体替换」语义不变(D6)。
|
|
1863
2061
|
*/
|
|
1864
2062
|
setDataSourceSchema(raw: unknown): void;
|
|
1865
2063
|
/** 上传可用性:未注入 uploadHandler 时为 false(宿主据此隐藏/禁用上传入口) */
|
|
@@ -2084,12 +2282,6 @@ declare class EditorSession {
|
|
|
2084
2282
|
* 一次调用 = 一步历史。
|
|
2085
2283
|
*/
|
|
2086
2284
|
addTableCell(rowPath: LayerPath): void;
|
|
2087
|
-
/**
|
|
2088
|
-
* 新增模板表(「+」选择器入口,spec §2.1):createTemplateTable 缺省形态 +
|
|
2089
|
-
* 置顶 + 自动选中;一次调用 = 一步历史。rowsPath 必填(解码 rows_path_missing
|
|
2090
|
-
* 硬约束的对齐兜底,表单校验前置),空串 no-op。
|
|
2091
|
-
*/
|
|
2092
|
-
addTemplateTable(rowsPath: string): void;
|
|
2093
2285
|
/**
|
|
2094
2286
|
* 模板行加格(spec §3.1):addTemplateCellInDraft 重建路径(末格宽/首格行宽、
|
|
2095
2287
|
* 零高度耦合),自动选中新格;一次调用 = 一步历史。非模板态 no-op。
|
|
@@ -2217,10 +2409,11 @@ declare function hitTest(canvas: Canvas, sceneX: number, sceneY: number, policie
|
|
|
2217
2409
|
*
|
|
2218
2410
|
* 拖拽期两点正规化出橡皮筋矩形(x = min、width = |dx|,y 同,反向拖不翻转);
|
|
2219
2411
|
* QrCodeLayer 钳 height := width(高随宽从动保持方形,八柄缩放「QR 从动轴不
|
|
2220
|
-
*
|
|
2221
|
-
*
|
|
2222
|
-
*
|
|
2223
|
-
*
|
|
2412
|
+
* 采纳」同门);可选 ratio(image-ratio-preset 工单 01)长轴驱动钳制橡皮筋到
|
|
2413
|
+
* 目标宽高比;橡皮筋左右/上下缘各两点进 resolveSnapPoints——吸附数学零新增,
|
|
2414
|
+
* 命中修正整矩形平移并入几何(两点正规化、QR 方形与比例钳在修正后原样保持)。
|
|
2415
|
+
* 死区常量屏幕像素口径同 SNAP_THRESHOLD_SCREEN_PX(场景阈值 = 阈值 / zoom,缩放
|
|
2416
|
+
* 无关)。全模块纯函数、无 DOM;会话编排(武装/落库/解除)在会话门面。
|
|
2224
2417
|
*/
|
|
2225
2418
|
|
|
2226
2419
|
/** 画拉死区阈值(css 像素,缩放无关;场景阈值 = 阈值 / zoom):位移不越过即视作
|
|
@@ -2233,11 +2426,20 @@ interface CreateRectResult {
|
|
|
2233
2426
|
}
|
|
2234
2427
|
/**
|
|
2235
2428
|
* 画拉橡皮筋求位:两点正规化(起点场景坐标 + 当前点 → 左上角原点矩形)→
|
|
2236
|
-
* QR 钳 height := width
|
|
2237
|
-
*
|
|
2238
|
-
*
|
|
2239
|
-
|
|
2240
|
-
|
|
2429
|
+
* QR 钳 height := width / ratio 长轴驱动钳(两者互斥:QR 层忽略 ratio,恒方
|
|
2430
|
+
* 语义不动——调用缝只对 ImageLayer 传 ratio)→ 左右/上下缘各两点对轴集合求位
|
|
2431
|
+
* (已有已对齐 delta=0 也回显命中轴的语义,dragTo/resizeTo 同门)→ 修正整矩形
|
|
2432
|
+
* 平移并入。钳先于吸附——QR 的方边与比例钳的派生边才是真实的吸附位点。
|
|
2433
|
+
*
|
|
2434
|
+
* ratio 钳(image-ratio-preset 工单 01,spec 决策 3)长轴驱动:|Δx| ≥ |Δy| 时
|
|
2435
|
+
* 宽驱动(height = round(width × h ÷ w),Math.round 对正数 half-up),否则高
|
|
2436
|
+
* 驱动(width = round(height × w ÷ h));钳制在正规化后,反向拖取绝对值镜像
|
|
2437
|
+
* 天然覆盖。
|
|
2438
|
+
*/
|
|
2439
|
+
declare function createRubberBandRect(type: LayerType, start: Point, current: Point, axes: readonly SnapAxis[], threshold: number, ratio?: {
|
|
2440
|
+
w: number;
|
|
2441
|
+
h: number;
|
|
2442
|
+
} | null): CreateRectResult;
|
|
2241
2443
|
|
|
2242
2444
|
/**
|
|
2243
2445
|
* 滚轮意图分类(工单 05,三态)。纯函数:输入只取事件修饰键快照,
|
|
@@ -2555,57 +2757,6 @@ type ExpressionPathParse = {
|
|
|
2555
2757
|
/** 解析点路径:head 分类 + 余段;语法不合法(空片段/空段)返回错误信号 */
|
|
2556
2758
|
declare function parseExpressionPath(expr: string): ExpressionPathParse;
|
|
2557
2759
|
|
|
2558
|
-
/** 字面直通段(不含任何 `{{`) */
|
|
2559
|
-
interface ExpressionScanLiteral {
|
|
2560
|
-
kind: 'literal';
|
|
2561
|
-
start: number;
|
|
2562
|
-
end: number;
|
|
2563
|
-
text: string;
|
|
2564
|
-
}
|
|
2565
|
-
/** 闭合片段(含 `{{ }}` 外壳区域;raw 为外壳内原文,expr 为 trim 后路径) */
|
|
2566
|
-
interface ExpressionScanFragment {
|
|
2567
|
-
kind: 'fragment';
|
|
2568
|
-
start: number;
|
|
2569
|
-
end: number;
|
|
2570
|
-
raw: string;
|
|
2571
|
-
expr: string;
|
|
2572
|
-
/** 空片段/路径空段信号(与求值器 expression_syntax_error 同码);合法为 null */
|
|
2573
|
-
error: ExpressionSyntaxError | null;
|
|
2574
|
-
}
|
|
2575
|
-
/** 未闭合 `{{` 起的输入中片段(求值期按字面;编辑器侧补全触发态) */
|
|
2576
|
-
interface ExpressionScanOpen {
|
|
2577
|
-
kind: 'open';
|
|
2578
|
-
start: number;
|
|
2579
|
-
end: number;
|
|
2580
|
-
/** 含 `{{` 外壳的原文(到串尾) */
|
|
2581
|
-
text: string;
|
|
2582
|
-
/** `{{` 之后内容的 trim 结果(待输入路径,可能为空串) */
|
|
2583
|
-
expr: string;
|
|
2584
|
-
}
|
|
2585
|
-
type ExpressionScanPart = ExpressionScanLiteral | ExpressionScanFragment | ExpressionScanOpen;
|
|
2586
|
-
interface ExpressionScan {
|
|
2587
|
-
template: string;
|
|
2588
|
-
/** 有序切分;parts 拼回恒等于 template(空字面一律省略) */
|
|
2589
|
-
parts: readonly ExpressionScanPart[];
|
|
2590
|
-
}
|
|
2591
|
-
/** PHP trim() 默认字符集(JS String.trim 的 Unicode 空白集与之不同,勿用);
|
|
2592
|
-
* 编辑器侧补全的接受手术同用此集(导出防按值复刻漂移,工单 04) */
|
|
2593
|
-
declare const PHP_TRIM_CHARS = " \t\n\r\0\v";
|
|
2594
|
-
/**
|
|
2595
|
-
* PHP trim() 语义(六字符集):片段 trim 与 vue 侧补全的 expr 前缀截取同用此集
|
|
2596
|
-
* (光标定位参数位,expression-type-methods 工单 12——单一事实源,勿按值复刻;
|
|
2597
|
-
* JS `String.trim()` 含全角空格等 Unicode 空白,会造成与 PHP 的双端漂移)。
|
|
2598
|
-
*/
|
|
2599
|
-
declare function phpTrim(value: string): string;
|
|
2600
|
-
/** 扫描模板串的片段切分:闭合/未闭合/多片段/错误信号,语义对齐求值器扫描循环 */
|
|
2601
|
-
declare function scanExpressionFragments(template: string): ExpressionScan;
|
|
2602
|
-
/**
|
|
2603
|
-
* 光标所在片段判定(编辑器侧语义,PHP 无光标概念故不入跨端 fixture):
|
|
2604
|
-
* closed 片段含光标 ⟺ start < cursor < end(`}}` 之后即离开——输入 `}}` 关闭浮层);
|
|
2605
|
-
* open 片段含光标 ⟺ start < cursor <= end(串尾输入位恒在内)。
|
|
2606
|
-
*/
|
|
2607
|
-
declare function expressionFragmentAtCursor(scan: ExpressionScan, cursor: number): ExpressionScanFragment | ExpressionScanOpen | null;
|
|
2608
|
-
|
|
2609
2760
|
/**
|
|
2610
2761
|
* 最小调用形解析纯函数(expression-type-methods 工单 12,spec §1.1/§1.2 ⑦⑨)。
|
|
2611
2762
|
*
|
|
@@ -2640,7 +2791,21 @@ type ExpressionCallParse = {
|
|
|
2640
2791
|
} | {
|
|
2641
2792
|
ok: false;
|
|
2642
2793
|
error: ExpressionSyntaxError;
|
|
2794
|
+
kind: ExpressionCallErrorKind;
|
|
2795
|
+
at: ExpressionErrorRange;
|
|
2643
2796
|
};
|
|
2797
|
+
/**
|
|
2798
|
+
* 结构错子类(编辑器诊断面,expression-syntax-diagnostics 工单 01):呈现轴,
|
|
2799
|
+
* 不入跨端 fixture(位置本就由本端派生并由单测锁死);中文措辞映射在 vue 层
|
|
2800
|
+
* useExpressionDiagnostics。分类对齐权威端 InterpolationEvaluator 的消息面
|
|
2801
|
+
* (spec §5.2),缺左括号从「括号不平衡」单列便于提示。
|
|
2802
|
+
*/
|
|
2803
|
+
type ExpressionCallErrorKind = 'missing_open_paren' | 'unbalanced_paren' | 'unterminated_string' | 'empty_arg_slot' | 'bad_arg_syntax' | 'trailing_after_call' | 'first_arg_not_path' | 'invalid_path_arg' | 'invalid_path';
|
|
2804
|
+
/** 出错子范围(expr 内坐标,end 独占) */
|
|
2805
|
+
interface ExpressionErrorRange {
|
|
2806
|
+
start: number;
|
|
2807
|
+
end: number;
|
|
2808
|
+
}
|
|
2644
2809
|
/**
|
|
2645
2810
|
* ⑦ 片段分类:首 token 后紧跟可选空白与 `(` 即调用。expr 须已 trim(片段扫描
|
|
2646
2811
|
* 职责,与 parseExpressionPath 契约一致)。
|
|
@@ -2669,6 +2834,140 @@ interface ExpressionCallSlotContext {
|
|
|
2669
2834
|
*/
|
|
2670
2835
|
declare function expressionCallSlotAtEnd(expr: string): ExpressionCallSlotContext | null;
|
|
2671
2836
|
|
|
2837
|
+
/**
|
|
2838
|
+
* 片段扫描纯函数(content-completion 工单 01,spec §4 纯函数 ①)。
|
|
2839
|
+
*
|
|
2840
|
+
* 语义逐条对齐 php-canvas-next `InterpolationEvaluator::evaluate` 扫描循环(只读
|
|
2841
|
+
* 对齐,不改求值器):首个未闭合 `{{` 起剩余全字面、片段内容 trim、`{{}}` 不嵌套
|
|
2842
|
+
* (首个 `}}` 收口,内容含 `{{`)、片段外字面直通;空片段/路径空段 =
|
|
2843
|
+
* `expression_syntax_error` 信号(与求值器同码)。切片语义对调用片段零改动
|
|
2844
|
+
* (spec §1.2 ⑤:首个 `}}` 收口、扫描器引号不感知——片段内禁 `}}` 字面);闭合
|
|
2845
|
+
* 片段的错误信号按 ⑦ 分类分流(路径/调用,expression-type-methods 工单 12)。
|
|
2846
|
+
*
|
|
2847
|
+
* 与求值器的一处表示分叉(编辑器侧补全所需):未闭合 `{{` 在求值期按字面直通,
|
|
2848
|
+
* 在扫描结果里另立 **open 片段**(kind: 'open')——这正是「输入 `{{` 自动弹出」的
|
|
2849
|
+
* 触发态(spec §3),其 expr 是待输入路径;closed 片段仍按求值语义带错误信号。
|
|
2850
|
+
*
|
|
2851
|
+
* 位置字段是 JS 码元索引(end 独占)——与 PHP 字节索引不同空间,跨端共享 fixture
|
|
2852
|
+
* (expression-scan v1)只钉切分内容不钉位置,位置由本端派生并由单测锁死。
|
|
2853
|
+
* trim 字符集对齐 PHP `trim()` 默认六字符(" \t\n\r\0\x0B"),**不是** JS 的
|
|
2854
|
+
* `String.trim()`(后者含全角空格等 Unicode 空白,会造成双端漂移)。
|
|
2855
|
+
*
|
|
2856
|
+
* 全模块纯函数、无 DOM(editor-shared-isolation)。
|
|
2857
|
+
*/
|
|
2858
|
+
|
|
2859
|
+
/** 字面直通段(不含任何 `{{`) */
|
|
2860
|
+
interface ExpressionScanLiteral {
|
|
2861
|
+
kind: 'literal';
|
|
2862
|
+
start: number;
|
|
2863
|
+
end: number;
|
|
2864
|
+
text: string;
|
|
2865
|
+
}
|
|
2866
|
+
/** 闭合片段(含 `{{ }}` 外壳区域;raw 为外壳内原文,expr 为 trim 后路径) */
|
|
2867
|
+
interface ExpressionScanFragment {
|
|
2868
|
+
kind: 'fragment';
|
|
2869
|
+
start: number;
|
|
2870
|
+
end: number;
|
|
2871
|
+
raw: string;
|
|
2872
|
+
expr: string;
|
|
2873
|
+
/** 空片段/路径空段信号(与求值器 expression_syntax_error 同码);合法为 null */
|
|
2874
|
+
error: ExpressionSyntaxError | null;
|
|
2875
|
+
/**
|
|
2876
|
+
* 结构错诊断(expression-syntax-diagnostics 工单 01):kind + 出错子范围,
|
|
2877
|
+
* 模板坐标(expr 坐标平移),at 供选中/定位;合法为 null。error 非空 ⟺
|
|
2878
|
+
* diagnostic 非空(同一判定的两投影,error 供 fixture/既有消费面不动)。
|
|
2879
|
+
*/
|
|
2880
|
+
diagnostic: ExpressionFragmentDiagnostic | null;
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* 片段诊断 kind(结构面呈现轴,spec §1.2 ⑨ JS 本端;= 调用面子类 + 空片段 +
|
|
2884
|
+
* 资源门子类)。resource_* 两 kind 不由扫描面产出——资源单值门(resourcePath,
|
|
2885
|
+
* ADR 0020)是整串判定,诊断沿本形态面出(kind 供 vue 措辞映射,复用空片段同款)。
|
|
2886
|
+
*/
|
|
2887
|
+
type ExpressionFragmentErrorKind = ExpressionCallErrorKind | 'empty_fragment' | 'resource_not_single_ref' | 'resource_function_call';
|
|
2888
|
+
/** 闭合片段的结构错诊断:位置由本端派生(不入跨端 fixture),措辞映射在 vue 层 */
|
|
2889
|
+
interface ExpressionFragmentDiagnostic {
|
|
2890
|
+
kind: ExpressionFragmentErrorKind;
|
|
2891
|
+
/** 片段外壳范围(模板坐标:start 含 {{,end 含 }}) */
|
|
2892
|
+
start: number;
|
|
2893
|
+
end: number;
|
|
2894
|
+
/** 出错子范围(模板坐标,end 独占)——选中/定位用 */
|
|
2895
|
+
at: ExpressionErrorRange;
|
|
2896
|
+
}
|
|
2897
|
+
/** 未闭合 `{{` 起的输入中片段(求值期按字面;编辑器侧补全触发态) */
|
|
2898
|
+
interface ExpressionScanOpen {
|
|
2899
|
+
kind: 'open';
|
|
2900
|
+
start: number;
|
|
2901
|
+
end: number;
|
|
2902
|
+
/** 含 `{{` 外壳的原文(到串尾) */
|
|
2903
|
+
text: string;
|
|
2904
|
+
/** `{{` 之后内容的 trim 结果(待输入路径,可能为空串) */
|
|
2905
|
+
expr: string;
|
|
2906
|
+
}
|
|
2907
|
+
type ExpressionScanPart = ExpressionScanLiteral | ExpressionScanFragment | ExpressionScanOpen;
|
|
2908
|
+
interface ExpressionScan {
|
|
2909
|
+
template: string;
|
|
2910
|
+
/** 有序切分;parts 拼回恒等于 template(空字面一律省略) */
|
|
2911
|
+
parts: readonly ExpressionScanPart[];
|
|
2912
|
+
}
|
|
2913
|
+
/** PHP trim() 默认字符集(JS String.trim 的 Unicode 空白集与之不同,勿用);
|
|
2914
|
+
* 编辑器侧补全的接受手术同用此集(导出防按值复刻漂移,工单 04) */
|
|
2915
|
+
declare const PHP_TRIM_CHARS = " \t\n\r\0\v";
|
|
2916
|
+
/**
|
|
2917
|
+
* PHP trim() 语义(六字符集):片段 trim 与 vue 侧补全的 expr 前缀截取同用此集
|
|
2918
|
+
* (光标定位参数位,expression-type-methods 工单 12——单一事实源,勿按值复刻;
|
|
2919
|
+
* JS `String.trim()` 含全角空格等 Unicode 空白,会造成与 PHP 的双端漂移)。
|
|
2920
|
+
*/
|
|
2921
|
+
declare function phpTrim(value: string): string;
|
|
2922
|
+
/** 扫描模板串的片段切分:闭合/未闭合/多片段/错误信号,语义对齐求值器扫描循环 */
|
|
2923
|
+
declare function scanExpressionFragments(template: string): ExpressionScan;
|
|
2924
|
+
/**
|
|
2925
|
+
* 光标所在片段判定(编辑器侧语义,PHP 无光标概念故不入跨端 fixture):
|
|
2926
|
+
* closed 片段含光标 ⟺ start < cursor < end(`}}` 之后即离开——输入 `}}` 关闭浮层);
|
|
2927
|
+
* open 片段含光标 ⟺ start < cursor <= end(串尾输入位恒在内)。
|
|
2928
|
+
*/
|
|
2929
|
+
declare function expressionFragmentAtCursor(scan: ExpressionScan, cursor: number): ExpressionScanFragment | ExpressionScanOpen | null;
|
|
2930
|
+
|
|
2931
|
+
/**
|
|
2932
|
+
* 模板级表达式语法诊断汇总(expression-syntax-diagnostics 工单 01):
|
|
2933
|
+
* 编辑器「输入期标错」的统一取数口——扫描 + 收集全部闭合片段的结构错诊断
|
|
2934
|
+
* (kind + 模板坐标出错子范围),供面板/画布提示消费。open 片段不算错(求值期
|
|
2935
|
+
* 字面直通,spec §1.2 ⑤);结构面 only、名单面不校验(§1.2 ⑨,防名单漂移假红)。
|
|
2936
|
+
* 全模块纯函数、无 DOM。
|
|
2937
|
+
*/
|
|
2938
|
+
|
|
2939
|
+
/** 汇总模板中全部片段的结构错诊断(按片段出现顺序) */
|
|
2940
|
+
declare function expressionDiagnostics(template: string): readonly ExpressionFragmentDiagnostic[];
|
|
2941
|
+
|
|
2942
|
+
/**
|
|
2943
|
+
* 资源表达式单值门诊断(resource-expression-single-ref 工单 03,ADR 0020):
|
|
2944
|
+
* 已标记的图片地址/二维码值表达式必须**恰为一个裸点路径片段**——禁多片段拼接、
|
|
2945
|
+
* 禁片段外字面、禁内建函数(格式化标量不是数据端备好的资源引用)、禁空片段。
|
|
2946
|
+
*
|
|
2947
|
+
* 规则与求值端同源同语义(「约束是语法级的」):逐条对齐 php-canvas-next
|
|
2948
|
+
* `CanvasHydrator::assertSingleResourceRef`(权威端,只读对齐)——整串锚定
|
|
2949
|
+
* `^\{\{([^{}]*)\}\}$` + 片段内容 PHP trim 后非空 + 无 `(`。诊断消费面与
|
|
2950
|
+
* expressionDiagnostics 同构(ExpressionFragmentDiagnostic:kind + 模板坐标),
|
|
2951
|
+
* 资源字段(QR/imageSrc)的面板标错据此路由(PropertyField 接线,工单 03 ③)。
|
|
2952
|
+
*
|
|
2953
|
+
* PCRE `$` 尾换行 parity(go-canvas 02 钉定的边角):PCRE `$` 锚(无 `D` 修饰符)
|
|
2954
|
+
* 容忍串尾恰一 `\n`,LF LF / CRLF 仍拦;JS 正则 `$` 只认串尾——锚定前显式剥
|
|
2955
|
+
* 同款单尾 LF 对齐(求值端对 `{{x}}\n` 放行且尾换行按字面直通,编辑器标红即假红)。
|
|
2956
|
+
*
|
|
2957
|
+
* 与文本面扫描诊断(expressionScan)的分野:门是**整串判定**,不是片段级扫描——
|
|
2958
|
+
* 违例的是「整个值」(多片段/字面残留/无片段时无片段外壳可指),诊断 span 恒为
|
|
2959
|
+
* 整个模板串;空片段沿片段面 empty_fragment 同 kind(同一措辞复用)。
|
|
2960
|
+
*
|
|
2961
|
+
* 全模块纯函数、无 DOM;层内依赖仅 expressionScan(phpTrim + 诊断形态)。
|
|
2962
|
+
*/
|
|
2963
|
+
|
|
2964
|
+
/**
|
|
2965
|
+
* 资源表达式单值门(ADR 0020):违例恰 1 条诊断、合法零诊断。门只做语法判定,
|
|
2966
|
+
* 与数据集/schema 在场无关;`$index`/`$root.` 前缀同为裸点路径放行,片段内
|
|
2967
|
+
* 空白属于键名不校验(trim 后非空 + 无 `(` 即过)。
|
|
2968
|
+
*/
|
|
2969
|
+
declare function resourcePathDiagnostics(template: string): readonly ExpressionFragmentDiagnostic[];
|
|
2970
|
+
|
|
2672
2971
|
/**
|
|
2673
2972
|
* 内建函数已知名单与格式建议表(expression-type-methods 工单 12,spec §1.2 ⑨/§2/§3.4)。
|
|
2674
2973
|
*
|
|
@@ -2732,6 +3031,15 @@ interface ExpressionCandidate {
|
|
|
2732
3031
|
* 一起被浮层按 partial 过滤(segment 是整段调用文本,直接过滤永不匹配)
|
|
2733
3032
|
*/
|
|
2734
3033
|
filterKey?: string;
|
|
3034
|
+
/**
|
|
3035
|
+
* 显式分桶判别(resource-expression-single-ref 工单 03,ADR 0020):'path' =
|
|
3036
|
+
* 字段/结构头路径候选,'function' = 函数名建议 + 形状分桶调用插入——资源面
|
|
3037
|
+
* 选择器(工单 05)按 `kind === 'path'` 过滤函数桶,不用 filterKey/含 ( 启发
|
|
3038
|
+
* 式(工单 12 内部约定不作契约)。缺省 = 两桶之外的建议面(date 格式快捷项
|
|
3039
|
+
* ——资源面天然不出现);rowsPath 候选面(RowsPathCandidate 同型别名)不产
|
|
3040
|
+
* 此字段。
|
|
3041
|
+
*/
|
|
3042
|
+
kind?: 'path' | 'function';
|
|
2735
3043
|
}
|
|
2736
3044
|
interface ExpressionCandidateQuery {
|
|
2737
3045
|
context: ExpressionContextKind;
|
|
@@ -2751,12 +3059,6 @@ type ExpressionCandidateResult = {
|
|
|
2751
3059
|
/** 正在输入的未完整段('' = 尾点/空表达式态);恒为 expr 的后缀 */
|
|
2752
3060
|
partial: string;
|
|
2753
3061
|
candidates: readonly ExpressionCandidate[];
|
|
2754
|
-
/**
|
|
2755
|
-
* 开放映射信号(D10):候选来源节点(头部层 = 根 schema,下钻层 = 前缀
|
|
2756
|
-
* 节点)标 open 时为 true,非 open 恒缺省——供浮层渲染「动态字段,键由
|
|
2757
|
-
* 模板定义」占位提示(工单 10),不污染候选条目契约。
|
|
2758
|
-
*/
|
|
2759
|
-
open?: boolean;
|
|
2760
3062
|
} | {
|
|
2761
3063
|
ok: false;
|
|
2762
3064
|
reason: ExpressionSyntaxError;
|
|
@@ -2776,9 +3078,8 @@ declare function enumerateExpressionCandidates(schema: ExpressionSchemaNode | nu
|
|
|
2776
3078
|
* - 数组内不下钻:具名段穿数组在水合端无意义(navigateRows 对列表键不命中),
|
|
2777
3079
|
* 完成段任一落点为数组/标量 → null——数组之下不再产出任何候选(「枚举为空」
|
|
2778
3080
|
* 以走不通同款收口:无补全态、浮层关闭、手输不受阻不阻断),与声明漂移/缺失
|
|
2779
|
-
*
|
|
2780
|
-
*
|
|
2781
|
-
* 空否无关,对齐 schemaChildEntries 的 D10 面),供浮层渲染占位提示行。
|
|
3081
|
+
* 同款,全程不抛错。开放映射信号面(D10)已随契约废除移除(ADR 0020)——
|
|
3082
|
+
* schema 解析边界显式拒绝后,无 properties 的对象节点按标量判别(不可导航)。
|
|
2782
3083
|
* - 候选给当前层全量合法子项、不按 partial 预过滤(前缀过滤归工单 02 浮层面,与
|
|
2783
3084
|
* 表达式枚举器分工同款);单尾点 = 剥点列全量子段;partial 恒为输入串后缀。
|
|
2784
3085
|
* - 元信息:path(起点相对完整点路径)+ description/title 两字段分离透传(展示
|
|
@@ -2806,18 +3107,12 @@ declare function enumerateExpressionCandidates(schema: ExpressionSchemaNode | nu
|
|
|
2806
3107
|
* CompletionItem,浮层零改动复用)。
|
|
2807
3108
|
*/
|
|
2808
3109
|
type RowsPathCandidate = ExpressionCandidate;
|
|
2809
|
-
/** 一次枚举结果(partial/candidates
|
|
3110
|
+
/** 一次枚举结果(partial/candidates 契约同表达式面);null = 无补全态 */
|
|
2810
3111
|
interface RowsPathCandidateResult {
|
|
2811
3112
|
/** 正在输入的未完整段('' = 空输入/单尾点态);恒为输入串后缀 */
|
|
2812
3113
|
partial: string;
|
|
2813
3114
|
/** 当前层全量合法子项(不按 partial 预过滤——前缀过滤归浮层) */
|
|
2814
3115
|
candidates: readonly RowsPathCandidate[];
|
|
2815
|
-
/**
|
|
2816
|
-
* 开放映射信号(D10 同款):枚举落点标 open(additionalProperties: true)时为
|
|
2817
|
-
* true,非 open 恒缺省——浮层渲染「动态字段,键由模板定义」占位提示行,信号
|
|
2818
|
-
* 在场时候选空也不关浮层。
|
|
2819
|
-
*/
|
|
2820
|
-
open?: boolean;
|
|
2821
3116
|
}
|
|
2822
3117
|
/**
|
|
2823
3118
|
* 枚举当前输入串的合法 rowsPath 候选。起点 schema null(判别件降级态)直接无
|
|
@@ -2880,4 +3175,4 @@ declare function memoizeTextPolicies(policies?: TextLayoutPolicies, options?: Me
|
|
|
2880
3175
|
*/
|
|
2881
3176
|
declare const PACKAGE_NAME: "@hankchen/canvas-editor";
|
|
2882
3177
|
|
|
2883
|
-
export { ALIGN_CORNER_MARGIN_PX, ALT_DRAG_DEAD_ZONE_SCREEN_PX, ARM_CREATE_LAYER_TYPES, type AlignBoxGeometry, type AlignToCanvasMode, type AlignToCanvasOptions, type ArmCreateShortcutAction, CREATE_DEAD_ZONE_SCREEN_PX, type CanvasEditorState, type CreateGesture, type CreateRectResult, DATE_FORMAT_SUGGESTIONS, DEFAULT_EDITOR_SHORTCUTS, DEFAULT_ZOOM_BOUNDS, type DeletedLayerRef, type DocRecipe, type DragGesture, EDITOR_STATE_SCHEMA_VERSION, EXPRESSION_FUNCTIONS, type EditorChange, type EditorPrefsState, EditorSession, type EditorSessionOptions, type EditorShortcutAction, type EditorShortcutBinding, type EditorShortcutGroup, type EditorShortcutInput, EditorStore, type EditorUi, type ExpressionCallArg, type ExpressionCallParse, type ExpressionCallSlotContext, type ExpressionCandidate, type ExpressionCandidateQuery, type ExpressionCandidateResult, type ExpressionContextKind, type ExpressionFormatSuggestion, type ExpressionFunctionMeta, type ExpressionPathHead, type ExpressionPathParse, type ExpressionScan, type ExpressionScanFragment, type ExpressionScanLiteral, type ExpressionScanOpen, type ExpressionScanPart, type ExpressionSchemaChildEntry, type ExpressionSchemaChildView, type ExpressionSchemaDiagnostic, type ExpressionSchemaDiagnosticCode, type ExpressionSchemaNode, type ExpressionSchemaParse, type ExpressionSchemaRejectReason, type ExpressionSyntaxError, type FindSession, type FindTextHit, FontCatalog, type FontCatalogEntry, type FrameScheduler, type Guide, type GuideOrientation, type HistoryStep, type HitTestOptions, type InvalidateTarget, type LayerOutlineNode, type LayerOutlineRole, type LayerPath, MAX_HISTORY_STEPS, type MemoTextPoliciesOptions, type MovedSubtreeRef, NUMBER_FUNCTION_SUGGESTIONS, type NextTextStyle, type OverlayPaintArgs, type OverlayPainter, PACKAGE_NAME, PAN_TO_BOX_MARGIN_PX, PASTE_OFFSET_PX, PHP_TRIM_CHARS, type Point, RESIZE_HANDLES, RESIZE_HANDLE_HIT_PX, RESIZE_MIN_SIZE_PX, type Rect, type ResizeAxes, type ResizeBoxGeometry, type ResizeBoxResult, type ResizeHandle, type ResourceStatus, type ResourceStatusMap, type RowsPathCandidate, type RowsPathCandidateResult, SNAP_THRESHOLD_SCREEN_PX, STYLE_FIELD_KEYS_BY_TYPE, type ShortcutCombo, type Size, type SnapAxis, type SnapAxisSource, type SnapBoxGeometry, type SnapPoints, type SnapResolution, type StyleSnapshot, TEXT_PRESETS, type TextEditLayout, type TextEditingSession, type TextPresetId, type TransactOptions, type UploadFile, type UploadHandler, UploadHandlerMissingError, type UploadImagePlacement, type Viewport, WHEEL_ZOOM_STEP, type WheelInput, type WheelIntent, type ZoomBounds, addRootLayerInDraft, addTableCellInDraft, addTableRowInDraft, addTemplateCellInDraft, alignToCanvasTarget, applyStyleFieldsInDraft, buildLayerOutline, canCopyLayerAt, canonicalizeTableSyncInDraft, captureStyleSnapshot, clampZoom, classifyEditorShortcut, classifyWheel, cloneLayerSubtree, convertTableToRowsInDraft, convertTableToTemplateInDraft, createDefaultLayer, createRubberBandRect, createTemplateTable, defaultNextTextStyle, deleteLayerInDraft, enumerateExpressionCandidates, enumerateRowsPathCandidates, expressionCallSlotAtEnd, expressionFragmentAtCursor, fitRect, fitViewport, growRowToCellInDraft, handleResizesHeight, handleResizesWidth, hitTest, insertRootLayerAdjacentInDraft, insertRootLayerInDraft, isCallFragment, isImageContentUndrawn, isLayerPath, isLockedPath, isRootLayerPath, isRootPasteableType, isTemplateSubtreePath, layerBoxByPath, memoizeTextPolicies, moveGuard, moveRootLayerInDraft, moveTableCellInDraft, moveTableCellToRowInDraft, moveTableRowInDraft, moveTableRowToTableInDraft, nextZoomByWheel, normalizeExpressionSchemaSource, panBy, panToBox, parseExpressionCall, parseExpressionPath, parseExpressionSchema, pastePosition, pathStartsWith, pathsEqual, phpTrim, pickNextTextStylePatch, prepareRootPaste, readSpecField, remapPathAfterSplice, replaceHitsInDraft, resizableAxesAt, resizeBox, resizeHandleAt, resizeHandlePoint, resizeHandlesAt, resizeSnapPoints, resolveLayer, resolveRowSchema, resolveRowsPathStartSchema, resolveSnap, resolveSnapPoints, rootLayerOf, scanExpressionFragments, scanTextMatches, sceneToScreen, schemaChildEntries, schemaNodeAtPath, screenToScene, selectionParentPath, setCellAutoHeightInDraft, snapAxesFromBoxes, snapThresholdScene, snapViewportToPhysicalPixels, syncContentIntoCellInDraft, syncRowWidthInDraft, uploadDisplayName, visibleRootBoxes, writeSpecField, zoomAtPoint };
|
|
3178
|
+
export { ALIGN_CORNER_MARGIN_PX, ALT_DRAG_DEAD_ZONE_SCREEN_PX, ARM_CREATE_LAYER_TYPES, type AlignBoxGeometry, type AlignToCanvasMode, type AlignToCanvasOptions, type ArmCreateShortcutAction, CREATE_DEAD_ZONE_SCREEN_PX, type CanvasEditorState, type CreateGesture, type CreateRectResult, DATE_FORMAT_SUGGESTIONS, DEFAULT_EDITOR_SHORTCUTS, DEFAULT_ZOOM_BOUNDS, type DeletedLayerRef, type DocRecipe, type DragGesture, EDITOR_STATE_SCHEMA_VERSION, EXPRESSION_FUNCTIONS, type EditorChange, type EditorPrefsState, EditorSession, type EditorSessionOptions, type EditorShortcutAction, type EditorShortcutBinding, type EditorShortcutGroup, type EditorShortcutInput, EditorStore, type EditorUi, type ExpressionCallArg, type ExpressionCallErrorKind, type ExpressionCallParse, type ExpressionCallSlotContext, type ExpressionCandidate, type ExpressionCandidateQuery, type ExpressionCandidateResult, type ExpressionContextKind, type ExpressionErrorRange, type ExpressionFormatSuggestion, type ExpressionFragmentDiagnostic, type ExpressionFragmentErrorKind, type ExpressionFunctionMeta, type ExpressionPathHead, type ExpressionPathParse, type ExpressionScan, type ExpressionScanFragment, type ExpressionScanLiteral, type ExpressionScanOpen, type ExpressionScanPart, type ExpressionSchemaChildEntry, type ExpressionSchemaChildView, type ExpressionSchemaDiagnostic, type ExpressionSchemaDiagnosticCode, type ExpressionSchemaNode, type ExpressionSchemaParse, type ExpressionSchemaRejectReason, type ExpressionSyntaxError, type FindSession, type FindTextHit, FontCatalog, type FontCatalogEntry, type FrameScheduler, type Guide, type GuideOrientation, type HistoryStep, type HitTestOptions, type InvalidateTarget, type LayerOutlineNode, type LayerOutlineRole, type LayerPath, MAX_HISTORY_STEPS, type MemoTextPoliciesOptions, type MovedSubtreeRef, NUMBER_FUNCTION_SUGGESTIONS, type NextTextStyle, type OverlayPaintArgs, type OverlayPainter, PACKAGE_NAME, PAN_TO_BOX_MARGIN_PX, PASTE_OFFSET_PX, PHP_TRIM_CHARS, type Point, type ProportionalDrivingAxis, RATIO_PRESETS, RESIZE_HANDLES, RESIZE_HANDLE_HIT_PX, RESIZE_MIN_SIZE_PX, type RatioPreset, type RatioPresetId, type Rect, type ResizeAxes, type ResizeBoxGeometry, type ResizeBoxResult, type ResizeHandle, type ResourceStatus, type ResourceStatusMap, type RowsPathCandidate, type RowsPathCandidateResult, SNAP_THRESHOLD_SCREEN_PX, STYLE_FIELD_KEYS_BY_TYPE, type ShortcutCombo, type Size, type SnapAxis, type SnapAxisSource, type SnapBoxGeometry, type SnapPoints, type SnapResolution, type StyleSnapshot, TEXT_PRESETS, type TextEditLayout, type TextEditingSession, type TextPresetId, type TransactOptions, type UploadFile, type UploadHandler, UploadHandlerMissingError, type UploadImagePlacement, type Viewport, WHEEL_ZOOM_STEP, type WheelInput, type WheelIntent, type ZoomBounds, addRootLayerInDraft, addTableCellInDraft, addTableRowInDraft, addTemplateCellInDraft, alignToCanvasTarget, applyStyleFieldsInDraft, buildLayerOutline, canCopyLayerAt, canonicalizeTableSyncInDraft, captureStyleSnapshot, clampZoom, classifyEditorShortcut, classifyWheel, cloneLayerSubtree, convertTableToRowsInDraft, convertTableToTemplateInDraft, createDefaultLayer, createRubberBandRect, createTemplateTable, defaultNextLayerRatio, defaultNextTextStyle, defaultSizeForRatio, deleteLayerInDraft, enumerateExpressionCandidates, enumerateRowsPathCandidates, expressionCallSlotAtEnd, expressionDiagnostics, expressionFragmentAtCursor, fitRect, fitViewport, growRowToCellInDraft, handleResizesHeight, handleResizesWidth, hitTest, insertRootLayerAdjacentInDraft, insertRootLayerInDraft, isCallFragment, isImageContentUndrawn, isLayerPath, isLockedPath, isRootLayerPath, isRootPasteableType, isTemplateSubtreePath, layerBoxByPath, memoizeTextPolicies, moveGuard, moveRootLayerInDraft, moveTableCellInDraft, moveTableCellToRowInDraft, moveTableRowInDraft, moveTableRowToTableInDraft, nextZoomByWheel, normalizeExpressionSchemaSource, panBy, panToBox, parseExpressionCall, parseExpressionPath, parseExpressionSchema, pastePosition, pathStartsWith, pathsEqual, phpTrim, pickNextLayerRatio, pickNextTextStylePatch, prepareRootPaste, proportionalDrivingAxis, ratioValue, readSpecField, remapPathAfterSplice, replaceHitsInDraft, resizableAxesAt, resizeBox, resizeBoxProportional, resizeHandleAt, resizeHandlePoint, resizeHandlesAt, resizeProportionalSnapPoints, resizeSnapPoints, resolveLayer, resolveRowSchema, resolveRowsPathStartSchema, resolveSnap, resolveSnapPoints, resourcePathDiagnostics, rootLayerOf, scanExpressionFragments, scanTextMatches, sceneToScreen, schemaChildEntries, schemaNodeAtPath, screenToScene, selectionParentPath, setCellAutoHeightInDraft, snapAxesFromBoxes, snapThresholdScene, snapViewportToPhysicalPixels, syncContentIntoCellInDraft, syncRowWidthInDraft, uploadDisplayName, visibleRootBoxes, writeSpecField, zoomAtPoint };
|