ice-render 1.0.4 → 1.0.6

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 (145) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +229 -141
  3. package/dist/THIRD-PARTY-NOTICES.txt +32 -0
  4. package/dist/index.cjs +30 -0
  5. package/dist/index.mjs +30 -0
  6. package/dist/index.umd.js +6 -1
  7. package/dist/types/FrameManager.d.mts +26 -0
  8. package/dist/types/FrameManager.d.ts +26 -26
  9. package/dist/types/ICE.d.mts +369 -0
  10. package/dist/types/ICE.d.ts +369 -107
  11. package/dist/types/a11y/accessibility.d.mts +46 -0
  12. package/dist/types/a11y/accessibility.d.ts +46 -0
  13. package/dist/types/animation/AnimationManager.d.mts +96 -0
  14. package/dist/types/animation/AnimationManager.d.ts +96 -25
  15. package/dist/types/animation/Easing.d.mts +33 -0
  16. package/dist/types/animation/Easing.d.ts +33 -32
  17. package/dist/types/consts/BIG_ZINDEX_NUMBER.d.mts +14 -0
  18. package/dist/types/consts/BIG_ZINDEX_NUMBER.d.ts +14 -14
  19. package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.mts +45 -0
  20. package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.ts +45 -36
  21. package/dist/types/consts/DOM_EVENT_MAPPING_CONSTS.d.mts +37 -0
  22. package/dist/types/consts/DOM_EVENT_MAPPING_CONSTS.d.ts +37 -19
  23. package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.mts +27 -0
  24. package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.ts +27 -20
  25. package/dist/types/control-panel/AlignmentGuideManager.d.mts +92 -0
  26. package/dist/types/control-panel/AlignmentGuideManager.d.ts +92 -0
  27. package/dist/types/control-panel/ICEControlPanel.d.mts +37 -0
  28. package/dist/types/control-panel/ICEControlPanel.d.ts +37 -37
  29. package/dist/types/control-panel/ICEControlPanelManager.d.mts +25 -0
  30. package/dist/types/control-panel/ICEControlPanelManager.d.ts +25 -23
  31. package/dist/types/control-panel/link-controls/LineControlPanel.d.mts +39 -0
  32. package/dist/types/control-panel/link-controls/LineControlPanel.d.ts +39 -39
  33. package/dist/types/control-panel/transform-controls/ResizeControl.d.mts +38 -0
  34. package/dist/types/control-panel/transform-controls/ResizeControl.d.ts +38 -38
  35. package/dist/types/control-panel/transform-controls/RotateControl.d.mts +12 -0
  36. package/dist/types/control-panel/transform-controls/RotateControl.d.ts +12 -12
  37. package/dist/types/control-panel/transform-controls/TransformControlPanel.d.mts +83 -0
  38. package/dist/types/control-panel/transform-controls/TransformControlPanel.d.ts +83 -74
  39. package/dist/types/control-panel/transform-controls/constraints.d.mts +24 -0
  40. package/dist/types/control-panel/transform-controls/constraints.d.ts +24 -0
  41. package/dist/types/cross-platform/PolyfillPath2D.d.mts +31 -0
  42. package/dist/types/cross-platform/PolyfillPath2D.d.ts +31 -0
  43. package/dist/types/cross-platform/root.d.mts +7 -0
  44. package/dist/types/cross-platform/root.d.ts +7 -2
  45. package/dist/types/event/DOMEventDispatcher.d.mts +68 -0
  46. package/dist/types/event/DOMEventDispatcher.d.ts +68 -29
  47. package/dist/types/event/DOMEventInterceptor.d.mts +36 -0
  48. package/dist/types/event/DOMEventInterceptor.d.ts +36 -7
  49. package/dist/types/event/EventBus.d.mts +27 -0
  50. package/dist/types/event/EventBus.d.ts +27 -27
  51. package/dist/types/event/ICEEvent.d.mts +46 -0
  52. package/dist/types/event/ICEEvent.d.ts +46 -46
  53. package/dist/types/event/ICEEventTarget.d.mts +106 -0
  54. package/dist/types/event/ICEEventTarget.d.ts +106 -106
  55. package/dist/types/event/input-normalize.d.mts +75 -0
  56. package/dist/types/event/input-normalize.d.ts +75 -0
  57. package/dist/types/geometry/GeoLine.d.mts +24 -0
  58. package/dist/types/geometry/GeoLine.d.ts +24 -23
  59. package/dist/types/geometry/GeoPoint.d.mts +53 -0
  60. package/dist/types/geometry/GeoPoint.d.ts +53 -66
  61. package/dist/types/geometry/GeoUtil.d.mts +73 -0
  62. package/dist/types/geometry/GeoUtil.d.ts +73 -37
  63. package/dist/types/geometry/ICEBoundingBox.d.mts +81 -0
  64. package/dist/types/geometry/ICEBoundingBox.d.ts +81 -81
  65. package/dist/types/graphic/ICEComponent.d.mts +436 -0
  66. package/dist/types/graphic/ICEComponent.d.ts +436 -264
  67. package/dist/types/graphic/ICEDotPath.d.mts +99 -0
  68. package/dist/types/graphic/ICEDotPath.d.ts +99 -63
  69. package/dist/types/graphic/ICEImage.d.mts +17 -0
  70. package/dist/types/graphic/ICEImage.d.ts +17 -17
  71. package/dist/types/graphic/ICEPath.d.mts +39 -0
  72. package/dist/types/graphic/ICEPath.d.ts +39 -36
  73. package/dist/types/graphic/container/ICEGroup.d.mts +101 -0
  74. package/dist/types/graphic/container/ICEGroup.d.ts +101 -53
  75. package/dist/types/graphic/link/ICEBezier.d.mts +23 -0
  76. package/dist/types/graphic/link/ICEBezier.d.ts +23 -15
  77. package/dist/types/graphic/link/ICELinkHook.d.mts +52 -0
  78. package/dist/types/graphic/link/ICELinkHook.d.ts +52 -52
  79. package/dist/types/graphic/link/ICELinkSlot.d.mts +54 -0
  80. package/dist/types/graphic/link/ICELinkSlot.d.ts +54 -46
  81. package/dist/types/graphic/link/ICELinkSlotManager.d.mts +28 -0
  82. package/dist/types/graphic/link/ICELinkSlotManager.d.ts +28 -28
  83. package/dist/types/graphic/link/ICEPolyLine.d.mts +292 -0
  84. package/dist/types/graphic/link/ICEPolyLine.d.ts +292 -219
  85. package/dist/types/graphic/link/ICEVisioLink.d.mts +163 -0
  86. package/dist/types/graphic/link/ICEVisioLink.d.ts +163 -129
  87. package/dist/types/graphic/shape/ICECircle.d.mts +19 -0
  88. package/dist/types/graphic/shape/ICECircle.d.ts +19 -19
  89. package/dist/types/graphic/shape/ICEEllipse.d.mts +29 -0
  90. package/dist/types/graphic/shape/ICEEllipse.d.ts +29 -23
  91. package/dist/types/graphic/shape/ICEIsogon.d.mts +52 -0
  92. package/dist/types/graphic/shape/ICEIsogon.d.ts +52 -52
  93. package/dist/types/graphic/shape/ICERect.d.mts +10 -0
  94. package/dist/types/graphic/shape/ICERect.d.ts +10 -17
  95. package/dist/types/graphic/shape/ICERose.d.mts +41 -0
  96. package/dist/types/graphic/shape/ICERose.d.ts +41 -41
  97. package/dist/types/graphic/shape/ICEStar.d.mts +45 -0
  98. package/dist/types/graphic/shape/ICEStar.d.ts +45 -45
  99. package/dist/types/graphic/text/ICEText.d.mts +137 -0
  100. package/dist/types/graphic/text/ICEText.d.ts +137 -65
  101. package/dist/types/index.d.mts +55 -0
  102. package/dist/types/index.d.ts +55 -41
  103. package/dist/types/layout/ICEBorderLayout.d.mts +34 -0
  104. package/dist/types/layout/ICEBorderLayout.d.ts +34 -0
  105. package/dist/types/layout/ICEBoxLayout.d.mts +30 -0
  106. package/dist/types/layout/ICEBoxLayout.d.ts +30 -0
  107. package/dist/types/layout/ICECardLayout.d.mts +36 -0
  108. package/dist/types/layout/ICECardLayout.d.ts +36 -0
  109. package/dist/types/layout/ICEFlowLayout.d.mts +31 -0
  110. package/dist/types/layout/ICEFlowLayout.d.ts +31 -0
  111. package/dist/types/layout/ICEGridLayout.d.mts +33 -0
  112. package/dist/types/layout/ICEGridLayout.d.ts +33 -0
  113. package/dist/types/layout/ICELayeredLayout.d.mts +49 -0
  114. package/dist/types/layout/ICELayeredLayout.d.ts +49 -0
  115. package/dist/types/layout/ICELayoutManager.d.mts +33 -0
  116. package/dist/types/layout/ICELayoutManager.d.ts +33 -0
  117. package/dist/types/layout/ICEOverlayLayout.d.mts +25 -0
  118. package/dist/types/layout/ICEOverlayLayout.d.ts +25 -0
  119. package/dist/types/persistence/Deserializer.d.mts +43 -0
  120. package/dist/types/persistence/Deserializer.d.ts +43 -14
  121. package/dist/types/persistence/Serializer.d.mts +35 -0
  122. package/dist/types/persistence/Serializer.d.ts +35 -26
  123. package/dist/types/plugin/PluginHost.d.mts +86 -0
  124. package/dist/types/plugin/PluginHost.d.ts +86 -0
  125. package/dist/types/renderer/CanvasRenderer.d.mts +150 -0
  126. package/dist/types/renderer/CanvasRenderer.d.ts +150 -22
  127. package/dist/types/renderer/ObjectCache.d.mts +79 -0
  128. package/dist/types/renderer/ObjectCache.d.ts +79 -0
  129. package/dist/types/renderer/dirty-rect-util.d.mts +86 -0
  130. package/dist/types/renderer/dirty-rect-util.d.ts +86 -0
  131. package/dist/types/theme/ICETheme.d.mts +382 -0
  132. package/dist/types/theme/ICETheme.d.ts +382 -0
  133. package/dist/types/util/ImageCache.d.mts +19 -0
  134. package/dist/types/util/ImageCache.d.ts +19 -19
  135. package/dist/types/util/data-util.d.mts +43 -0
  136. package/dist/types/util/data-util.d.ts +43 -19
  137. package/dist/types/util/gl-matrix-skew.d.mts +14 -0
  138. package/dist/types/util/gl-matrix-skew.d.ts +14 -14
  139. package/dist/types/util/lang.d.mts +28 -0
  140. package/dist/types/util/lang.d.ts +28 -0
  141. package/dist/types/util/uuid.d.mts +1 -0
  142. package/dist/types/util/uuid.d.ts +1 -1
  143. package/package.json +118 -81
  144. package/dist/index.cjs.js +0 -25
  145. package/dist/index.js +0 -25
@@ -1,25 +1,96 @@
1
- import ICEComponent from '../graphic/ICEComponent';
2
- import ICE from '../ICE';
3
- /**
4
- * @class AnimationManager
5
- *
6
- * 动画管理器
7
- *
8
- * - 全局单例,一个 ICE 实例上只能有一个 AnimationManager 的实例。
9
- *
10
- * @singleton
11
- * @see ICE
12
- * @author 大漠穷秋<damoqiongqiu@126.com>
13
- */
14
- declare class AnimationManager {
15
- private animationMap;
16
- private ice;
17
- constructor(ice: ICE);
18
- start(): this;
19
- stop(): this;
20
- private frameEventHandler;
21
- private tween;
22
- add(component: ICEComponent): void;
23
- remove(el: any): void;
24
- }
25
- export default AnimationManager;
1
+ import ICEComponent from '../graphic/ICEComponent';
2
+ import ICE from '../ICE';
3
+ /**
4
+ * @class AnimationManager
5
+ *
6
+ * 动画管理器
7
+ *
8
+ * - 全局单例,一个 ICE 实例上只能有一个 AnimationManager 的实例。
9
+ *
10
+ * @singleton
11
+ * @see ICE
12
+ * @author 大漠穷秋<damoqiongqiu@126.com>
13
+ */
14
+ declare class AnimationManager {
15
+ private animationMap;
16
+ private ice;
17
+ private paused;
18
+ private pausedAt;
19
+ private warned;
20
+ constructor(ice: ICE);
21
+ start(): this;
22
+ stop(): this;
23
+ private frameEventHandler;
24
+ /**
25
+ * 把值按点路径写入目标对象(支持 `transform.rotate` / `style.globalAlpha` 这类嵌套字段)。
26
+ *
27
+ * 旧实现直接 `newState[key] = value`,键里的点会被当成**字面量键名**,
28
+ * 于是 `animations: { 'transform.rotate': ... }` 静默失效(既不报错也不生效)。
29
+ * 多段路径共用同一父级时会逐段合并(`transform.rotate` 与 `transform.scale` 不互相覆盖)。
30
+ */
31
+ private __writeValue;
32
+ /**
33
+ * 每一帧推进动画:计算各属性的取值。
34
+ *
35
+ * 支持三种配置形态(同一组件上可混用):
36
+ * 1. 单段补间:`{ from, to, duration }`
37
+ * 2. 关键帧时间轴:`{ keyframes: [{ offset, value, easing? }], duration }`
38
+ * - `offset` 为 0~1 的时间占比,缺省时按数组顺序均分,超出 [0,1] 会被夹紧;
39
+ * - `easing` 写在**段起始关键帧**上,作用于「该帧 → 下一帧」这一段;未写则用动画级 `easing`;
40
+ * - 时间轴之外的取值分别是首帧 / 末帧的值(保持,不外推)。
41
+ * 3. 缓动可用主题 motion token 语义名(`duration: 'normal'` / `easing: 'out'`)或 EasingProgress 方法名。
42
+ *
43
+ * 取值可以是**数值**,也可以是**等长的数字数组**(`transform.scale` / `transform.translate` /
44
+ * `transform.skew` 等逐元素补间)。
45
+ *
46
+ * 结束判定按**已流逝时间**而非「值是否越过 to」:弹簧类缓动中途会过冲(越过 to 再回落),
47
+ * 若按值判定,第一帧过冲就会被误判成结束、动画提前停在过冲点上。
48
+ */
49
+ private tween;
50
+ /** 取进度 p 处的值:单段在 from→to 之间插值;关键帧按段插值(段内进度再经该段缓动)。 */
51
+ private __sampleValue;
52
+ /** 按进度 p 在 from/to 之间插值:数值直接线性,等长数字数组逐元素。 */
53
+ private __interpolate;
54
+ /** 补间取值是否合法:都是数字,或都是**等长**的数字数组。 */
55
+ private __isTweenable;
56
+ /** 取值种类:number | array(非空且全为数字) | null(不支持)。 */
57
+ private __valueKind;
58
+ /** 归一化关键帧到 animation.__frames(只做一次):夹紧 offset、排序、校验各帧取值同型。 */
59
+ private __normalizeKeyframes;
60
+ /** 解析缓动名 → 归一化进度函数;未知名称回退 linear 并只提示一次。 */
61
+ private __easingFn;
62
+ /** round: true 时对补间结果取整(数组逐元素)。 */
63
+ private __roundIfNeeded;
64
+ /** 供告警信息使用的取值描述。 */
65
+ private __describe;
66
+ /** 拒绝一个非法的动画配置:标记结束(不再每帧重试)并只提示一次。 */
67
+ private __reject;
68
+ /** 同一个动画配置只告警一次,避免非法配置每帧刷屏。 */
69
+ private __warnOnce;
70
+ /**
71
+ * 把动画配置里的 motion token 语义名解析成实际值(首次触发时执行,结果写回 animation 对象缓存):
72
+ * - duration: 'fast' | 'normal' | 'slow' | 'slower' → 主题 motion.duration 里的 ms。
73
+ * - easing: 'linear' | 'out' | 'inOut' | 'outQuart' | 'spring' | 'springSoft' | 'springSnappy'
74
+ * → 主题 motion.easing 里的缓动方法名。
75
+ * 若传的是数字/已存在的 Easing 方法名,则原样保留(向后兼容)。
76
+ */
77
+ private __resolveMotion;
78
+ /**
79
+ * 判断动画到达终点后是否重复播放:
80
+ * - loop === true:无限循环;
81
+ * - iterationCount > 1:剩余次数递减,直到 1 次后结束。
82
+ */
83
+ private shouldRepeat;
84
+ /**
85
+ * 暂停所有动画(冻结进度,恢复时从暂停处继续)。
86
+ */
87
+ pause(): void;
88
+ /**
89
+ * 恢复所有动画:把每个动画的 startTime 往后移,抵消暂停期间的流逝。
90
+ */
91
+ resume(): void;
92
+ isPaused(): boolean;
93
+ add(component: ICEComponent): void;
94
+ remove(el: any): void;
95
+ }
96
+ export default AnimationManager;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * 一组缓动工具函数
10
+ *
11
+ * 本文件有两层:
12
+ *
13
+ * ① `EasingProgress`:**归一化进度函数**,定义域 [0,1](时间占比),值域通常为 [0,1],
14
+ * 弹簧这类缓动会短暂越过 1(过冲)。纯函数、不读时钟 —— 关键帧的**段内缓动**
15
+ * 需要一个可按任意局部进度求值的函数,用它才能避免「合成 startTime」式的硬凑。
16
+ *
17
+ * ② `Easing`:对外保持历史上的**值**语义签名 `(from, to, duration, startTime)`,
18
+ * 内部自读 `Date.now()`。其中 9 个函数是与既有实现逐字一致的转写(刻意不改),
19
+ * `tests/animation/easing-progress.test.ts` 在网格上锁定它们与 `EasingProgress`
20
+ * 的等价关系(实测最大偏差 < 1e-12),防止两层实现漂移。
21
+ *
22
+ * 原始来源:https://github.com/AndrewRayCode/easing-utils/blob/master/src/easing.js
23
+ * @author 大漠穷秋<damoqiongqiu@126.com>
24
+ */
25
+ /** 归一化进度函数:t 为时间占比(0 → 起点,1 → 终点),返回进度(弹簧类可 > 1 表示过冲)。 */
26
+ export type EasingProgress = (t: number) => number;
27
+ export declare const EasingProgress: {
28
+ [name: string]: EasingProgress;
29
+ };
30
+ declare const Easing: {
31
+ [name: string]: (from: number, to: number, duration: number, startTime: number) => number;
32
+ };
33
+ export default Easing;
@@ -1,32 +1,33 @@
1
- /**
2
- * Copyright (c) 2022 大漠穷秋.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- /**
9
- * 来源:https://github.com/AndrewRayCode/easing-utils/blob/master/src/easing.js
10
- * 一组缓动工具函数
11
- * @author 大漠穷秋<damoqiongqiu@126.com>
12
- */
13
- declare const Easing: {
14
- /**
15
- * 线性变化
16
- * @param from 起始值
17
- * @param to 终止值
18
- * @param duration 持续时间,ms
19
- * @param startTime 动画开始时间
20
- */
21
- linear: (from: number, to: number, duration: number, startTime: number) => number;
22
- easeInQuad: (from: number, to: number, duration: number, startTime: number) => number;
23
- easeOutQuad: (from: number, to: number, duration: number, startTime: number) => number;
24
- easeInOutQuad: (from: number, to: number, duration: number, startTime: number) => number;
25
- easeInQuart: (from: number, to: number, duration: number, startTime: number) => number;
26
- easeOutQuart: (from: number, to: number, duration: number, startTime: number) => number;
27
- easeInOutQuart: (from: number, to: number, duration: number, startTime: number) => number;
28
- easeInCubic: (from: number, to: number, duration: number, startTime: number) => number;
29
- easeOutCubic: (from: number, to: number, duration: number, startTime: number) => number;
30
- easeInOutCubic: (from: number, to: number, duration: number, startTime: number) => number;
31
- };
32
- export default Easing;
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * 一组缓动工具函数
10
+ *
11
+ * 本文件有两层:
12
+ *
13
+ * `EasingProgress`:**归一化进度函数**,定义域 [0,1](时间占比),值域通常为 [0,1],
14
+ * 弹簧这类缓动会短暂越过 1(过冲)。纯函数、不读时钟 —— 关键帧的**段内缓动**
15
+ * 需要一个可按任意局部进度求值的函数,用它才能避免「合成 startTime」式的硬凑。
16
+ *
17
+ * `Easing`:对外保持历史上的**值**语义签名 `(from, to, duration, startTime)`,
18
+ * 内部自读 `Date.now()`。其中 9 个函数是与既有实现逐字一致的转写(刻意不改),
19
+ * `tests/animation/easing-progress.test.ts` 在网格上锁定它们与 `EasingProgress`
20
+ * 的等价关系(实测最大偏差 < 1e-12),防止两层实现漂移。
21
+ *
22
+ * 原始来源:https://github.com/AndrewRayCode/easing-utils/blob/master/src/easing.js
23
+ * @author 大漠穷秋<damoqiongqiu@126.com>
24
+ */
25
+ /** 归一化进度函数:t 为时间占比(0 起点,1 终点),返回进度(弹簧类可 > 1 表示过冲)。 */
26
+ export type EasingProgress = (t: number) => number;
27
+ export declare const EasingProgress: {
28
+ [name: string]: EasingProgress;
29
+ };
30
+ declare const Easing: {
31
+ [name: string]: (from: number, to: number, duration: number, startTime: number) => number;
32
+ };
33
+ export default Easing;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * zIndex 最大值,这里使用一千万是安全的,在一张画布上渲染一千万个图形的可能性很小
10
+ * zIndex 用来控制组件在画布中的堆叠次序
11
+ * @see ICEComponent.state.zIndex
12
+ */
13
+ declare const bigZIndexNum: number;
14
+ export default bigZIndexNum;
@@ -1,14 +1,14 @@
1
- /**
2
- * Copyright (c) 2022 大漠穷秋.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- /**
9
- * zIndex 最大值,这里使用一千万是安全的,在一张画布上渲染一千万个图形的可能性很小
10
- * zIndex 用来控制组件在画布中的堆叠次序
11
- * @see ICEComponent.state.zIndex
12
- */
13
- declare const bigZIndexNum: number;
14
- export default bigZIndexNum;
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * zIndex 最大值,这里使用一千万是安全的,在一张画布上渲染一千万个图形的可能性很小
10
+ * zIndex 用来控制组件在画布中的堆叠次序
11
+ * @see ICEComponent.state.zIndex
12
+ */
13
+ declare const bigZIndexNum: number;
14
+ export default bigZIndexNum;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import ICEGroup from '../graphic/container/ICEGroup.mjs';
9
+ import ICEImage from '../graphic/ICEImage.mjs';
10
+ import ICEBezier from '../graphic/link/ICEBezier.mjs';
11
+ import ICEPolyLine from '../graphic/link/ICEPolyLine.mjs';
12
+ import ICEVisioLink from '../graphic/link/ICEVisioLink.mjs';
13
+ import ICECircle from '../graphic/shape/ICECircle.mjs';
14
+ import ICEEllipse from '../graphic/shape/ICEEllipse.mjs';
15
+ import ICEIsogon from '../graphic/shape/ICEIsogon.mjs';
16
+ import ICERect from '../graphic/shape/ICERect.mjs';
17
+ import ICERose from '../graphic/shape/ICERose.mjs';
18
+ import ICEStar from '../graphic/shape/ICEStar.mjs';
19
+ import ICEText from '../graphic/text/ICEText.mjs';
20
+ /**
21
+ * 组件名称和构造函数引用之间的映射关系,把序列化之后的 JSON 字符串重新解析成图形时需要用到此映射关系。
22
+ *
23
+ * key 是**稳定的类型名(typeId)**,与类的 JS 名解耦:序列化时由构造函数反查这张表得到 typeId,
24
+ * 因此压缩/改名(terser mangle)不会破坏已存数据;只有**未注册**的类型才回退到 `constructor.name`。
25
+ * 表里的 key 同时充当反序列化的查找键,所以旧数据里写类名的历史格式仍然能加载。
26
+ *
27
+ * 注意:工具层组件(ICELinkSlot / ICELinkHook / 各类 ControlPanel)不进这张表,它们不被序列化。
28
+ *
29
+ * @author 大漠穷秋<damoqiongqiu@126.com>
30
+ */
31
+ declare const componentTypeMap: {
32
+ ICERect: typeof ICERect;
33
+ ICECircle: typeof ICECircle;
34
+ ICEEllipse: typeof ICEEllipse;
35
+ ICEStar: typeof ICEStar;
36
+ ICEIsogon: typeof ICEIsogon;
37
+ ICERose: typeof ICERose;
38
+ ICEText: typeof ICEText;
39
+ ICEImage: typeof ICEImage;
40
+ ICEGroup: typeof ICEGroup;
41
+ ICEVisioLink: typeof ICEVisioLink;
42
+ ICEPolyLine: typeof ICEPolyLine;
43
+ ICEBezier: typeof ICEBezier;
44
+ };
45
+ export default componentTypeMap;
@@ -1,36 +1,45 @@
1
- /**
2
- * Copyright (c) 2022 大漠穷秋.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import ICEGroup from '../graphic/container/ICEGroup';
9
- import ICEImage from '../graphic/ICEImage';
10
- import ICEPolyLine from '../graphic/link/ICEPolyLine';
11
- import ICEVisioLink from '../graphic/link/ICEVisioLink';
12
- import ICECircle from '../graphic/shape/ICECircle';
13
- import ICEEllipse from '../graphic/shape/ICEEllipse';
14
- import ICEIsogon from '../graphic/shape/ICEIsogon';
15
- import ICERect from '../graphic/shape/ICERect';
16
- import ICEStar from '../graphic/shape/ICEStar';
17
- import ICEText from '../graphic/text/ICEText';
18
- /**
19
- * 组件名称和构造函数引用之间的映射关系,把序列化之后的 JSON 字符串重新解析成图形时需要用到此映射关系。
20
- * 默认采用 Class.constructor.name 作为 key 。
21
- *
22
- * @author 大漠穷秋<damoqiongqiu@126.com>
23
- */
24
- declare const componentTypeMap: {
25
- ICERect: typeof ICERect;
26
- ICECircle: typeof ICECircle;
27
- ICEEllipse: typeof ICEEllipse;
28
- ICEStar: typeof ICEStar;
29
- ICEIsogon: typeof ICEIsogon;
30
- ICEText: typeof ICEText;
31
- ICEImage: typeof ICEImage;
32
- ICEGroup: typeof ICEGroup;
33
- ICEVisioLink: typeof ICEVisioLink;
34
- ICEPolyLine: typeof ICEPolyLine;
35
- };
36
- export default componentTypeMap;
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import ICEGroup from '../graphic/container/ICEGroup';
9
+ import ICEImage from '../graphic/ICEImage';
10
+ import ICEBezier from '../graphic/link/ICEBezier';
11
+ import ICEPolyLine from '../graphic/link/ICEPolyLine';
12
+ import ICEVisioLink from '../graphic/link/ICEVisioLink';
13
+ import ICECircle from '../graphic/shape/ICECircle';
14
+ import ICEEllipse from '../graphic/shape/ICEEllipse';
15
+ import ICEIsogon from '../graphic/shape/ICEIsogon';
16
+ import ICERect from '../graphic/shape/ICERect';
17
+ import ICERose from '../graphic/shape/ICERose';
18
+ import ICEStar from '../graphic/shape/ICEStar';
19
+ import ICEText from '../graphic/text/ICEText';
20
+ /**
21
+ * 组件名称和构造函数引用之间的映射关系,把序列化之后的 JSON 字符串重新解析成图形时需要用到此映射关系。
22
+ *
23
+ * key 是**稳定的类型名(typeId)**,与类的 JS 名解耦:序列化时由构造函数反查这张表得到 typeId,
24
+ * 因此压缩/改名(terser mangle)不会破坏已存数据;只有**未注册**的类型才回退到 `constructor.name`。
25
+ * 表里的 key 同时充当反序列化的查找键,所以旧数据里写类名的历史格式仍然能加载。
26
+ *
27
+ * 注意:工具层组件(ICELinkSlot / ICELinkHook / 各类 ControlPanel)不进这张表,它们不被序列化。
28
+ *
29
+ * @author 大漠穷秋<damoqiongqiu@126.com>
30
+ */
31
+ declare const componentTypeMap: {
32
+ ICERect: typeof ICERect;
33
+ ICECircle: typeof ICECircle;
34
+ ICEEllipse: typeof ICEEllipse;
35
+ ICEStar: typeof ICEStar;
36
+ ICEIsogon: typeof ICEIsogon;
37
+ ICERose: typeof ICERose;
38
+ ICEText: typeof ICEText;
39
+ ICEImage: typeof ICEImage;
40
+ ICEGroup: typeof ICEGroup;
41
+ ICEVisioLink: typeof ICEVisioLink;
42
+ ICEPolyLine: typeof ICEPolyLine;
43
+ ICEBezier: typeof ICEBezier;
44
+ };
45
+ export default componentTypeMap;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 原生 DOM 事件与 ICE 内部转发事件之间的对应关系。
3
+ * 原生 DOM 事件的名称在 ICE 中不变,ICE 自定义事件名仅仅用来在事件总线中进行转发。
4
+ *
5
+ * 输入通道策略(见 docs/architecture/05-event-system.md):
6
+ * - 运行时支持 PointerEvent → 只监听 pointer*(统一覆盖鼠标 / 触控笔 / 触摸),
7
+ * 并额外监听没有 pointer 对应事件的 click / dblclick / contextmenu。
8
+ * - 否则(老浏览器 / 小程序)→ 监听 mouse* + touch*,touch 通道由派发器
9
+ * 归一化后以鼠标语义名转发,上层组件无需区分。
10
+ *
11
+ * @author 大漠穷秋<damoqiongqiu@126.com>
12
+ */
13
+ /** 指针输入通道(鼠标 / 触控笔 / 触摸统一) */
14
+ export declare const pointerEvents: Array<[string, string]>;
15
+ /**
16
+ * 鼠标输入通道。在支持 PointerEvent 的运行时只保留「没有 pointer 对应事件」的那几个,
17
+ * 避免 pointer 与 mouse 兼容事件双重触发。
18
+ */
19
+ export declare const mouseEvents: Array<[string, string]>;
20
+ /** PointerEvent 世界下仍需单独监听的鼠标事件(无 pointer 等价物)。 */
21
+ export declare const nonPointerMouseEvents: Array<[string, string]>;
22
+ /** 触摸输入通道(无 PointerEvent 的运行时使用,如小程序)。 */
23
+ export declare const touchEvents: Array<[string, string]>;
24
+ /** 滚轮通道(视口缩放等,由应用层消费)。 */
25
+ export declare const wheelEvents: Array<[string, string]>;
26
+ /**
27
+ * 原生 DOM 键盘事件与 ICE 内部转发事件之间的对应关系。
28
+ * @author 大漠穷秋<damoqiongqiu@126.com>
29
+ */
30
+ export declare const keyboardEvents: Array<[string, string]>;
31
+ /** 高频「移动」类 ICE 事件名:派发器对其跳过命中检测(避免每次移动都全量扫描组件树)。 */
32
+ export declare const MOVE_ICE_EVENTS: string[];
33
+ /**
34
+ * 按运行时能力构建待监听的 DOM 事件表。
35
+ * @param hasPointerEvent 运行时是否存在 PointerEvent 构造器
36
+ */
37
+ export declare function buildDomEventList(hasPointerEvent: boolean): Array<[string, string]>;
@@ -1,19 +1,37 @@
1
- /**
2
- * Copyright (c) 2022 大漠穷秋.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- /**
9
- * 原生 DOM 鼠标事件与 ICE 内部转发事件之间的对应关系。
10
- * 原生 DOM 事件的名称在 ICE 中不变,ICE 自定义事件名仅仅用来在事件总线中进行转发。
11
- * @author 大漠穷秋<damoqiongqiu@126.com>
12
- */
13
- export const mouseEvents: string[][];
14
- /**
15
- * 原生 DOM 键盘事件与 ICE 内部转发事件之间的对应关系。
16
- * 原生 DOM 事件的名称在 ICE 中不变,ICE 自定义事件名仅仅用来在事件总线中进行转发。
17
- * @author 大漠穷秋<damoqiongqiu@126.com>
18
- */
19
- export const keyboardEvents: string[][];
1
+ /**
2
+ * 原生 DOM 事件与 ICE 内部转发事件之间的对应关系。
3
+ * 原生 DOM 事件的名称在 ICE 中不变,ICE 自定义事件名仅仅用来在事件总线中进行转发。
4
+ *
5
+ * 输入通道策略(见 docs/architecture/05-event-system.md):
6
+ * - 运行时支持 PointerEvent → 只监听 pointer*(统一覆盖鼠标 / 触控笔 / 触摸),
7
+ * 并额外监听没有 pointer 对应事件的 click / dblclick / contextmenu。
8
+ * - 否则(老浏览器 / 小程序)→ 监听 mouse* + touch*,touch 通道由派发器
9
+ * 归一化后以鼠标语义名转发,上层组件无需区分。
10
+ *
11
+ * @author 大漠穷秋<damoqiongqiu@126.com>
12
+ */
13
+ /** 指针输入通道(鼠标 / 触控笔 / 触摸统一) */
14
+ export declare const pointerEvents: Array<[string, string]>;
15
+ /**
16
+ * 鼠标输入通道。在支持 PointerEvent 的运行时只保留「没有 pointer 对应事件」的那几个,
17
+ * 避免 pointer 与 mouse 兼容事件双重触发。
18
+ */
19
+ export declare const mouseEvents: Array<[string, string]>;
20
+ /** PointerEvent 世界下仍需单独监听的鼠标事件(无 pointer 等价物)。 */
21
+ export declare const nonPointerMouseEvents: Array<[string, string]>;
22
+ /** 触摸输入通道(无 PointerEvent 的运行时使用,如小程序)。 */
23
+ export declare const touchEvents: Array<[string, string]>;
24
+ /** 滚轮通道(视口缩放等,由应用层消费)。 */
25
+ export declare const wheelEvents: Array<[string, string]>;
26
+ /**
27
+ * 原生 DOM 键盘事件与 ICE 内部转发事件之间的对应关系。
28
+ * @author 大漠穷秋<damoqiongqiu@126.com>
29
+ */
30
+ export declare const keyboardEvents: Array<[string, string]>;
31
+ /** 高频「移动」类 ICE 事件名:派发器对其跳过命中检测(避免每次移动都全量扫描组件树)。 */
32
+ export declare const MOVE_ICE_EVENTS: string[];
33
+ /**
34
+ * 按运行时能力构建待监听的 DOM 事件表。
35
+ * @param hasPointerEvent 运行时是否存在 PointerEvent 构造器
36
+ */
37
+ export declare function buildDomEventList(hasPointerEvent: boolean): Array<[string, string]>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ declare const ICE_EVENT_NAME_CONSTS: {
9
+ ICE_FRAME_EVENT: string;
10
+ BEFORE_RENDER: string;
11
+ AFTER_RENDER: string;
12
+ BEFORE_ADD: string;
13
+ AFTER_ADD: string;
14
+ BEFORE_REMOVE: string;
15
+ AFTER_REMOVE: string;
16
+ ROUND_FINISH: string;
17
+ HOOK_MOUSEDOWN: string;
18
+ HOOK_MOUSEMOVE: string;
19
+ HOOK_MOUSEUP: string;
20
+ BEFORE_RESIZE: string;
21
+ AFTER_RESIZE: string;
22
+ BEFORE_ROTATE: string;
23
+ AFTER_ROTATE: string;
24
+ BEFORE_MOVE: string;
25
+ AFTER_MOVE: string;
26
+ };
27
+ export default ICE_EVENT_NAME_CONSTS;
@@ -1,20 +1,27 @@
1
- export default ICE_EVENT_NAME_CONSTS;
2
- declare namespace ICE_EVENT_NAME_CONSTS {
3
- const ICE_FRAME_EVENT: string;
4
- const BEFORE_RENDER: string;
5
- const AFTER_RENDER: string;
6
- const BEFORE_ADD: string;
7
- const AFTER_ADD: string;
8
- const BEFORE_REMOVE: string;
9
- const AFTER_REMOVE: string;
10
- const ROUND_FINISH: string;
11
- const HOOK_MOUSEDOWN: string;
12
- const HOOK_MOUSEMOVE: string;
13
- const HOOK_MOUSEUP: string;
14
- const BEFORE_RESIZE: string;
15
- const AFTER_RESIZE: string;
16
- const BEFORE_ROTATE: string;
17
- const AFTER_ROTATE: string;
18
- const BEFORE_MOVE: string;
19
- const AFTER_MOVE: string;
20
- }
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ declare const ICE_EVENT_NAME_CONSTS: {
9
+ ICE_FRAME_EVENT: string;
10
+ BEFORE_RENDER: string;
11
+ AFTER_RENDER: string;
12
+ BEFORE_ADD: string;
13
+ AFTER_ADD: string;
14
+ BEFORE_REMOVE: string;
15
+ AFTER_REMOVE: string;
16
+ ROUND_FINISH: string;
17
+ HOOK_MOUSEDOWN: string;
18
+ HOOK_MOUSEMOVE: string;
19
+ HOOK_MOUSEUP: string;
20
+ BEFORE_RESIZE: string;
21
+ AFTER_RESIZE: string;
22
+ BEFORE_ROTATE: string;
23
+ AFTER_ROTATE: string;
24
+ BEFORE_MOVE: string;
25
+ AFTER_MOVE: string;
26
+ };
27
+ export default ICE_EVENT_NAME_CONSTS;