@snowui-design-system/components 0.3.0-alpha.0 → 0.3.0-alpha.2

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 (270) hide show
  1. package/AGENTS.md +21 -0
  2. package/LICENSE +133 -89
  3. package/README.md +32 -11
  4. package/component-catalog.json +506 -106
  5. package/dist/client/blocks/Sidebar.js +21 -7
  6. package/dist/client/blocks/SidebarItem.js +2 -2
  7. package/dist/client/blocks/SidebarSection.js +2 -2
  8. package/dist/client/blocks/index.js +2 -0
  9. package/dist/client/compat.d.ts +1 -1
  10. package/dist/client/compat.js +3 -1
  11. package/dist/client/components/BlurText.js +2 -2
  12. package/dist/client/components/DataTable.js +2 -2
  13. package/dist/client/components/FlowText.js +2 -2
  14. package/dist/client/components/Frame.d.ts +9 -0
  15. package/dist/client/components/Frame.js +82 -24
  16. package/dist/client/components/GradientMotion.d.ts +1 -1
  17. package/dist/client/components/GradientMotion.js +2 -2
  18. package/dist/client/components/NumberFlow.js +4 -4
  19. package/dist/client/components/NumericText.js +2 -2
  20. package/dist/client/components/ScrambleText.js +2 -2
  21. package/dist/client/components/SidePanel.js +3 -3
  22. package/dist/client/components/SlotText.js +2 -2
  23. package/dist/client/components/TableCell.js +1 -1
  24. package/dist/client/components/Text.js +36 -20
  25. package/dist/client/components/Toaster.js +1 -1
  26. package/dist/client/components/Tooltip.js +200 -195
  27. package/dist/client/context.js +2 -0
  28. package/dist/client/dev.js +2 -0
  29. package/dist/client/i18n/messages.d.ts +1 -1
  30. package/dist/client/i18n/messages.js +3 -1
  31. package/dist/client/index.d.ts +0 -1
  32. package/dist/client/index.js +5 -5
  33. package/dist/client/internal/code-block/prettier-svelte.d.ts +2 -0
  34. package/dist/client/internal/component-icon/index.js +2 -0
  35. package/dist/client/internal/snow-ui-logo/Wordmark.js +1 -1
  36. package/dist/client/internal/snow-ui-logo/emoji-metrics.js +2 -0
  37. package/dist/client/keys.js +2 -0
  38. package/dist/client/lib/adaptive-contrast-renderer.js +2 -0
  39. package/dist/client/lib/chart/appearance-timeline.js +2 -0
  40. package/dist/client/lib/chart/arc-path.js +2 -0
  41. package/dist/client/lib/chart/colors.js +2 -0
  42. package/dist/client/lib/chart/size.js +2 -0
  43. package/dist/client/lib/clipboard.js +2 -0
  44. package/dist/client/lib/color.js +2 -0
  45. package/dist/client/lib/date-format.js +2 -0
  46. package/dist/client/lib/edge-fade.js +3 -1
  47. package/dist/client/lib/number-format.js +2 -0
  48. package/dist/client/lib/overflow-actions-motion.js +2 -0
  49. package/dist/client/lib/overlay-trigger-timing.js +2 -0
  50. package/dist/client/lib/resizable.d.ts +1 -1
  51. package/dist/client/lib/responsive-exit.js +2 -0
  52. package/dist/client/lib/search-filter.js +2 -0
  53. package/dist/client/lib/side-panel.js +2 -0
  54. package/dist/client/lib/split-pane.js +2 -0
  55. package/dist/client/lib/table-column-motion.js +2 -0
  56. package/dist/client/lib/table-responsive.js +2 -0
  57. package/dist/client/lib/table-selection-fade.js +2 -0
  58. package/dist/client/lib/table-truncation.js +2 -0
  59. package/dist/client/lib/text-motion/animation.js +2 -0
  60. package/dist/client/lib/text-motion/character.js +2 -0
  61. package/dist/client/lib/text-motion/color.js +2 -0
  62. package/dist/client/lib/text-motion/layout.js +2 -0
  63. package/dist/client/lib/text-motion/preference.js +2 -0
  64. package/dist/client/lib/text-motion/sequence.js +2 -0
  65. package/dist/client/lib/text-motion/typography.js +2 -0
  66. package/dist/client/lib/tooltip-delay.js +2 -0
  67. package/dist/client/lib/tooltip-motion-dismiss.js +2 -0
  68. package/dist/client/lib/tooltip-pointer-speed.js +2 -0
  69. package/dist/client/lib/truncate.js +2 -0
  70. package/dist/client/logic/frame-field-control.js +2 -0
  71. package/dist/client/logic/frame-motion-defaults.js +2 -0
  72. package/dist/client/logic/frame-motion.d.ts +15 -23
  73. package/dist/client/logic/frame-motion.js +196 -30
  74. package/dist/client/logic/frame-prop-filter.js +2 -0
  75. package/dist/client/logic/frame-state.d.ts +2 -14
  76. package/dist/client/logic/frame-state.js +60 -9
  77. package/dist/client/logic/geometry-cache.js +2 -0
  78. package/dist/client/logic/layout-flip.js +2 -0
  79. package/dist/client/logic/morph.js +2 -0
  80. package/dist/client/logic/motion-engine.js +2 -0
  81. package/dist/client/logic/motion-orchestration.js +2 -0
  82. package/dist/client/logic/motion-types.js +2 -0
  83. package/dist/client/logic/wc-adapter.js +2 -0
  84. package/dist/client/motion/bridge.js +2 -0
  85. package/dist/client/motion/content-crossfade.js +2 -0
  86. package/dist/client/motion/expand.js +2 -0
  87. package/dist/client/motion/fade-in.js +2 -0
  88. package/dist/client/motion/fade-out.js +2 -0
  89. package/dist/client/motion/morph.js +2 -0
  90. package/dist/client/motion/move.js +2 -0
  91. package/dist/client/motion/number.d.ts +3 -3
  92. package/dist/client/motion/number.js +5 -3
  93. package/dist/client/motion/replace.js +2 -0
  94. package/dist/client/motion/rotate.css +2 -0
  95. package/dist/client/motion/rotate.js +2 -0
  96. package/dist/client/motion/scale-in.js +2 -0
  97. package/dist/client/motion/tokens.js +2 -0
  98. package/dist/client/motion/while-2xl.js +2 -0
  99. package/dist/client/motion/while-active.js +2 -0
  100. package/dist/client/motion/while-appear.js +2 -0
  101. package/dist/client/motion/while-click.js +2 -0
  102. package/dist/client/motion/while-collapsed.js +2 -0
  103. package/dist/client/motion/while-disabled.js +2 -0
  104. package/dist/client/motion/while-disappear.js +2 -0
  105. package/dist/client/motion/while-drag.js +2 -0
  106. package/dist/client/motion/while-editing.js +2 -0
  107. package/dist/client/motion/while-expanded.js +2 -0
  108. package/dist/client/motion/while-focus.js +2 -0
  109. package/dist/client/motion/while-hover.js +2 -0
  110. package/dist/client/motion/while-idle.js +2 -0
  111. package/dist/client/motion/while-key.js +2 -0
  112. package/dist/client/motion/while-lg.js +2 -0
  113. package/dist/client/motion/while-load.js +2 -0
  114. package/dist/client/motion/while-md.js +2 -0
  115. package/dist/client/motion/while-reload.js +2 -0
  116. package/dist/client/motion/while-scroll.js +2 -0
  117. package/dist/client/motion/while-sm.js +2 -0
  118. package/dist/client/motion/while-uploading.js +2 -0
  119. package/dist/client/motion/while-validating.js +2 -0
  120. package/dist/client/motion/while-xl.js +2 -0
  121. package/dist/client/motion/while-xs.js +2 -0
  122. package/dist/client/styles/auto-layout.css +3 -1
  123. package/dist/client/styles/backdrop.css +2 -0
  124. package/dist/client/styles/components.css +20 -18
  125. package/dist/client/styles/index.css +2 -0
  126. package/dist/client/styles/layout.css +9 -3
  127. package/dist/client/styles/scale.css +2 -0
  128. package/dist/client/styles/scrollbar.css +3 -1
  129. package/dist/client/styles/tokens.css +2 -0
  130. package/dist/client/vite-env.d.ts +2 -0
  131. package/dist/server/blocks/Sidebar.js +24 -18
  132. package/dist/server/blocks/SidebarItem.js +2 -2
  133. package/dist/server/blocks/SidebarSection.js +2 -2
  134. package/dist/server/blocks/index.js +2 -0
  135. package/dist/server/compat.d.ts +1 -1
  136. package/dist/server/compat.js +3 -1
  137. package/dist/server/components/BlurText.js +2 -2
  138. package/dist/server/components/DataTable.js +2 -2
  139. package/dist/server/components/FlowText.js +2 -2
  140. package/dist/server/components/Frame.d.ts +9 -0
  141. package/dist/server/components/Frame.js +52 -24
  142. package/dist/server/components/GradientMotion.d.ts +1 -1
  143. package/dist/server/components/GradientMotion.js +2 -2
  144. package/dist/server/components/NumberFlow.js +4 -4
  145. package/dist/server/components/NumericText.js +2 -2
  146. package/dist/server/components/ScrambleText.js +2 -2
  147. package/dist/server/components/SidePanel.js +3 -3
  148. package/dist/server/components/SlotText.js +2 -2
  149. package/dist/server/components/TableCell.js +1 -1
  150. package/dist/server/components/Text.js +15 -11
  151. package/dist/server/components/Toaster.js +1 -1
  152. package/dist/server/components/Tooltip.js +10 -10
  153. package/dist/server/context.js +2 -0
  154. package/dist/server/dev.js +2 -0
  155. package/dist/server/i18n/messages.d.ts +1 -1
  156. package/dist/server/i18n/messages.js +3 -1
  157. package/dist/server/index.d.ts +0 -1
  158. package/dist/server/index.js +5 -5
  159. package/dist/server/internal/code-block/prettier-svelte.d.ts +2 -0
  160. package/dist/server/internal/component-icon/index.js +2 -0
  161. package/dist/server/internal/snow-ui-logo/Wordmark.js +1 -1
  162. package/dist/server/internal/snow-ui-logo/emoji-metrics.js +2 -0
  163. package/dist/server/keys.js +2 -0
  164. package/dist/server/lib/adaptive-contrast-renderer.js +2 -0
  165. package/dist/server/lib/chart/appearance-timeline.js +2 -0
  166. package/dist/server/lib/chart/arc-path.js +2 -0
  167. package/dist/server/lib/chart/colors.js +2 -0
  168. package/dist/server/lib/chart/size.js +2 -0
  169. package/dist/server/lib/clipboard.js +2 -0
  170. package/dist/server/lib/color.js +2 -0
  171. package/dist/server/lib/date-format.js +2 -0
  172. package/dist/server/lib/edge-fade.js +3 -1
  173. package/dist/server/lib/number-format.js +2 -0
  174. package/dist/server/lib/overflow-actions-motion.js +2 -0
  175. package/dist/server/lib/overlay-trigger-timing.js +2 -0
  176. package/dist/server/lib/resizable.d.ts +1 -1
  177. package/dist/server/lib/responsive-exit.js +2 -0
  178. package/dist/server/lib/search-filter.js +2 -0
  179. package/dist/server/lib/side-panel.js +2 -0
  180. package/dist/server/lib/split-pane.js +2 -0
  181. package/dist/server/lib/table-column-motion.js +2 -0
  182. package/dist/server/lib/table-responsive.js +2 -0
  183. package/dist/server/lib/table-selection-fade.js +2 -0
  184. package/dist/server/lib/table-truncation.js +2 -0
  185. package/dist/server/lib/text-motion/animation.js +2 -0
  186. package/dist/server/lib/text-motion/character.js +2 -0
  187. package/dist/server/lib/text-motion/color.js +2 -0
  188. package/dist/server/lib/text-motion/layout.js +2 -0
  189. package/dist/server/lib/text-motion/preference.js +2 -0
  190. package/dist/server/lib/text-motion/sequence.js +2 -0
  191. package/dist/server/lib/text-motion/typography.js +2 -0
  192. package/dist/server/lib/tooltip-delay.js +2 -0
  193. package/dist/server/lib/tooltip-motion-dismiss.js +2 -0
  194. package/dist/server/lib/tooltip-pointer-speed.js +2 -0
  195. package/dist/server/lib/truncate.js +2 -0
  196. package/dist/server/logic/frame-field-control.js +2 -0
  197. package/dist/server/logic/frame-motion-defaults.js +2 -0
  198. package/dist/server/logic/frame-motion.d.ts +15 -23
  199. package/dist/server/logic/frame-motion.js +75 -29
  200. package/dist/server/logic/frame-prop-filter.js +2 -0
  201. package/dist/server/logic/frame-state.d.ts +2 -14
  202. package/dist/server/logic/frame-state.js +60 -9
  203. package/dist/server/logic/geometry-cache.js +2 -0
  204. package/dist/server/logic/layout-flip.js +2 -0
  205. package/dist/server/logic/morph.js +2 -0
  206. package/dist/server/logic/motion-engine.js +2 -0
  207. package/dist/server/logic/motion-orchestration.js +2 -0
  208. package/dist/server/logic/motion-types.js +2 -0
  209. package/dist/server/logic/wc-adapter.js +2 -0
  210. package/dist/server/motion/bridge.js +2 -0
  211. package/dist/server/motion/content-crossfade.js +2 -0
  212. package/dist/server/motion/expand.js +2 -0
  213. package/dist/server/motion/fade-in.js +2 -0
  214. package/dist/server/motion/fade-out.js +2 -0
  215. package/dist/server/motion/morph.js +2 -0
  216. package/dist/server/motion/move.js +2 -0
  217. package/dist/server/motion/number.d.ts +3 -3
  218. package/dist/server/motion/number.js +5 -3
  219. package/dist/server/motion/replace.js +2 -0
  220. package/dist/server/motion/rotate.css +2 -0
  221. package/dist/server/motion/rotate.js +2 -0
  222. package/dist/server/motion/scale-in.js +2 -0
  223. package/dist/server/motion/tokens.js +2 -0
  224. package/dist/server/motion/while-2xl.js +2 -0
  225. package/dist/server/motion/while-active.js +2 -0
  226. package/dist/server/motion/while-appear.js +2 -0
  227. package/dist/server/motion/while-click.js +2 -0
  228. package/dist/server/motion/while-collapsed.js +2 -0
  229. package/dist/server/motion/while-disabled.js +2 -0
  230. package/dist/server/motion/while-disappear.js +2 -0
  231. package/dist/server/motion/while-drag.js +2 -0
  232. package/dist/server/motion/while-editing.js +2 -0
  233. package/dist/server/motion/while-expanded.js +2 -0
  234. package/dist/server/motion/while-focus.js +2 -0
  235. package/dist/server/motion/while-hover.js +2 -0
  236. package/dist/server/motion/while-idle.js +2 -0
  237. package/dist/server/motion/while-key.js +2 -0
  238. package/dist/server/motion/while-lg.js +2 -0
  239. package/dist/server/motion/while-load.js +2 -0
  240. package/dist/server/motion/while-md.js +2 -0
  241. package/dist/server/motion/while-reload.js +2 -0
  242. package/dist/server/motion/while-scroll.js +2 -0
  243. package/dist/server/motion/while-sm.js +2 -0
  244. package/dist/server/motion/while-uploading.js +2 -0
  245. package/dist/server/motion/while-validating.js +2 -0
  246. package/dist/server/motion/while-xl.js +2 -0
  247. package/dist/server/motion/while-xs.js +2 -0
  248. package/dist/server/styles/auto-layout.css +3 -1
  249. package/dist/server/styles/backdrop.css +2 -0
  250. package/dist/server/styles/components.css +20 -18
  251. package/dist/server/styles/index.css +2 -0
  252. package/dist/server/styles/layout.css +9 -3
  253. package/dist/server/styles/scale.css +2 -0
  254. package/dist/server/styles/scrollbar.css +3 -1
  255. package/dist/server/styles/tokens.css +2 -0
  256. package/dist/server/vite-env.d.ts +2 -0
  257. package/llms.txt +5 -0
  258. package/package.json +13 -6
  259. package/dist/client/components/FramePro.d.ts +0 -23
  260. package/dist/client/components/FramePro.js +0 -412
  261. package/dist/client/logic/frame-pro-motion.d.ts +0 -26
  262. package/dist/client/logic/frame-pro-motion.js +0 -310
  263. package/dist/client/logic/frame-pro-state.d.ts +0 -39
  264. package/dist/client/logic/frame-pro-state.js +0 -538
  265. package/dist/server/components/FramePro.d.ts +0 -23
  266. package/dist/server/components/FramePro.js +0 -301
  267. package/dist/server/logic/frame-pro-motion.d.ts +0 -26
  268. package/dist/server/logic/frame-pro-motion.js +0 -176
  269. package/dist/server/logic/frame-pro-state.d.ts +0 -39
  270. package/dist/server/logic/frame-pro-state.js +0 -445
@@ -1,445 +0,0 @@
1
- /* frame-pro-state.svelte.js generated by Svelte v5.56.4 */
2
- import * as $ from 'svelte/internal/server';
3
- import { resolveFrameWhileMotionConfig } from "./frame-motion-defaults.js";
4
-
5
- export class FrameState {
6
- #props;
7
- #motion;
8
-
9
- // === 交互状态 (Internal Interaction States) ===
10
- hovered = false;
11
-
12
- pressed = false;
13
- focused = false;
14
- isDragging = false;
15
- isScrolling = false;
16
- isKeyActive = false;
17
-
18
- // === 核心状态 (Core State) ===
19
- currentState = "Idle";
20
-
21
- constructor(props, motion) {
22
- this.#props = props;
23
- this.#motion = motion;
24
- // 状态变化时处理链式转变
25
- // 执行回调
26
- // Reload 状态时调用 onReload 回调
27
- }
28
-
29
- // === 综合状态 (Derived Interaction State) ===
30
- get interactionState() {
31
- // 优先使用声明式状态机状态
32
- if (this.currentState !== "Idle") return this.currentState;
33
-
34
- // 回退到传统状态判断
35
- if (this.#props.whileDisabled) return "Disabled";
36
-
37
- if (this.#props.loading) return "Load";
38
- if (this.pressed) return "Click";
39
- if (this.hovered) return "Hover";
40
- if (this.focused) return "Focus";
41
- if (this.isDragging) return "Drag";
42
- if (this.isScrolling) return "Scroll";
43
-
44
- return "Idle";
45
- }
46
-
47
- // 是否有任何触发器激活 (用于 whileIdle)
48
- get isAnyTriggerActive() {
49
- return this.hovered || this.pressed || this.focused || this.isDragging || this.isScrolling || !!this.#props.loading || !!this.#props.whileActive || !!this.#props.whileDisabled || this.#props.collapsed || this.#props.expanded;
50
- }
51
-
52
- // === Helpers ===
53
- #parseTransition(config) {
54
- if (!config) return { nextState: null, auto: false };
55
-
56
- // 1. 数组形式: [State, 'auto']
57
- if (Array.isArray(config)) {
58
- return { nextState: config[0], auto: config[1] === "auto" };
59
- }
60
-
61
- // 2. 函数形式: () => void
62
- if (typeof config === "function") {
63
- return { nextState: null, auto: false, run: config };
64
- }
65
-
66
- // 3. 对象形式: { next, auto, run }
67
- if (typeof config === "object" && ("next" in config || "run" in config)) {
68
- return { nextState: config.next, auto: !!config.auto, run: config.run };
69
- }
70
-
71
- // 4. 字符串形式: State
72
- return { nextState: config, auto: false };
73
- }
74
-
75
- #getWhileConfig(state) {
76
- // 标准状态优先走统一默认动效解析,保证 auto 时长与默认/覆写配置一致
77
- const configMap = {
78
- StartLoad: resolveFrameWhileMotionConfig(this.#props, "whileLoad"),
79
- Load: resolveFrameWhileMotionConfig(this.#props, "whileLoad"),
80
- Reload: resolveFrameWhileMotionConfig(this.#props, "whileReload"),
81
- Appear: resolveFrameWhileMotionConfig(this.#props, "whileAppear"),
82
- Disappear: resolveFrameWhileMotionConfig(this.#props, "whileDisappear"),
83
- Idle: resolveFrameWhileMotionConfig(this.#props, "whileIdle"),
84
- Active: resolveFrameWhileMotionConfig(this.#props, "whileActive"),
85
- Disabled: resolveFrameWhileMotionConfig(this.#props, "whileDisabled"),
86
- Validating: resolveFrameWhileMotionConfig(this.#props, "whileValidating"),
87
- Uploading: resolveFrameWhileMotionConfig(this.#props, "whileUploading"),
88
- Editing: resolveFrameWhileMotionConfig(this.#props, "whileEditing")
89
- };
90
-
91
- // 标准状态直接返回(可为 undefined)
92
- if (state in configMap) return configMap[state];
93
-
94
- // 尝试获取动态属性 (Custom States): while[State]
95
- const dynamicKey = `while${state}`;
96
-
97
- return this.#props[dynamicKey];
98
- }
99
-
100
- #getDuration(state) {
101
- const config = this.#getWhileConfig(state);
102
-
103
- if (config && typeof config === "object" && "duration" in config) {
104
- return config.duration;
105
- }
106
-
107
- return 300; // 默认 300ms
108
- }
109
-
110
- #getTransitionConfig(state) {
111
- const transitionMap = {
112
- StartLoad: this.#props.StartLoad,
113
- Load: this.#props.Load,
114
- Reload: this.#props.Reload,
115
- Appear: this.#props.Appear,
116
- Disappear: this.#props.Disappear,
117
- Idle: this.#props.Idle,
118
- Active: this.#props.Active,
119
- Disabled: this.#props.Disabled
120
- };
121
-
122
- // 如果是标准状态且有配置,直接返回
123
- if (transitionMap[state]) return transitionMap[state];
124
-
125
- // 尝试获取动态属性 (Custom States): [State]
126
- return this.#props[state];
127
- }
128
-
129
- // === Event Handlers ===
130
- #handleModifiers(e, config) {
131
- if (config && typeof config === 'object') {
132
- if (config.stop) e.stopPropagation();
133
- if (config.prevent) e.preventDefault();
134
- }
135
- }
136
-
137
- #isStateMapTrigger(config) {
138
- if (!config || typeof config !== "object" || Array.isArray(config)) {
139
- return false;
140
- }
141
-
142
- // 这些字段属于普通 Trigger/Linkage 配置,不视为“按状态映射”
143
- const reservedKeys = [
144
- "run",
145
- "target",
146
- "action",
147
- "reverse",
148
- "state",
149
- "key",
150
- "next",
151
- "auto",
152
- "stop",
153
- "prevent"
154
- ];
155
-
156
- if (reservedKeys.some((key) => key in config)) return false;
157
-
158
- return Object.keys(config).length > 0;
159
- }
160
-
161
- #resolveStateMapTrigger(config) {
162
- return config[this.currentState] ?? config.Idle;
163
- }
164
-
165
- #applyEventTrigger(config, e) {
166
- if (!config) return;
167
-
168
- this.#handleModifiers(e, config);
169
-
170
- if (typeof config === "function") {
171
- config(e);
172
-
173
- return;
174
- }
175
-
176
- if (typeof config === "string") {
177
- this.currentState = config;
178
-
179
- return;
180
- }
181
-
182
- if (Array.isArray(config)) {
183
- if (typeof config[0] === "string") {
184
- this.currentState = config[0];
185
- }
186
-
187
- return;
188
- }
189
-
190
- if (typeof config === "object") {
191
- if ("run" in config && typeof config.run === "function") {
192
- config.run(e);
193
- }
194
-
195
- if ("state" in config && typeof config.state === "string") {
196
- this.currentState = config.state;
197
- } else if ("next" in config && typeof config.next === "string") {
198
- this.currentState = config.next;
199
- }
200
-
201
- if ("target" in config) {
202
- this.#handleLinkageControl(config);
203
- }
204
- }
205
- }
206
-
207
- // --- Mouse Events ---
208
- handleClick = (e) => {
209
- const { Click } = this.#props;
210
-
211
- if (!Click) return;
212
-
213
- // 支持按当前状态分发点击触发器:
214
- // Click={{ Idle: "Load", Active: "Idle" }}
215
- if (this.#isStateMapTrigger(Click)) {
216
- const mapped = this.#resolveStateMapTrigger(Click);
217
-
218
- this.#applyEventTrigger(mapped, e);
219
-
220
- return;
221
- }
222
-
223
- // 兼容旧行为:非映射模式仅在 Idle 状态响应 Click
224
- if (this.currentState !== "Idle") return;
225
-
226
- this.#applyEventTrigger(Click, e);
227
- };
228
-
229
- handleDblClick = (_e) => {
230
- // Reserved for future DblClick prop
231
- };
232
-
233
- handleContextMenu = (_e) => {
234
- // Reserved for future ContextMenu prop
235
- };
236
-
237
- handleMouseEnter = (e) => {
238
- this.hovered = true;
239
-
240
- const { Hover } = this.#props;
241
-
242
- if (Hover) {
243
- this.#handleModifiers(e, Hover);
244
-
245
- if (typeof Hover === "function") {
246
- Hover(e);
247
- } else if (typeof Hover === "string") {
248
- this.currentState = Hover;
249
- } else if (typeof Hover === "object") {
250
- if ("run" in Hover && typeof Hover.run === "function") {
251
- Hover.run(e);
252
- }
253
-
254
- if ("target" in Hover) {
255
- this.#handleLinkageControl(Hover);
256
- }
257
- }
258
- }
259
- };
260
-
261
- handleMouseLeave = () => {
262
- this.hovered = false;
263
- this.pressed = false;
264
- };
265
-
266
- handleMouseDown = () => {
267
- this.pressed = true;
268
- };
269
-
270
- handleMouseUp = (_e) => {
271
- this.pressed = false;
272
-
273
- // Click logic moved to handleClick
274
- };
275
-
276
- handleMouseMove = (_e) => {
277
- // Reserved
278
- };
279
-
280
- // --- Touch Events ---
281
- handleTouchStart = (_e) => {
282
- this.pressed = true;
283
- };
284
-
285
- handleTouchEnd = (_e) => {
286
- this.pressed = false;
287
- };
288
-
289
- handleTouchMove = (_e) => {
290
- // Reserved
291
- };
292
-
293
- handleTouchCancel = (_e) => {
294
- this.pressed = false;
295
- };
296
-
297
- // --- Focus Events ---
298
- handleFocus = (e) => {
299
- this.focused = true;
300
-
301
- const { Focus } = this.#props;
302
-
303
- if (Focus) {
304
- this.#handleModifiers(e, Focus);
305
-
306
- if (typeof Focus === "function") {
307
- Focus(e);
308
- } else if (typeof Focus === "string") {
309
- this.currentState = Focus;
310
- } else if (typeof Focus === "object") {
311
- if ("run" in Focus && typeof Focus.run === "function") {
312
- Focus.run(e);
313
- }
314
-
315
- if ("target" in Focus) {
316
- this.#handleLinkageControl(Focus);
317
- }
318
- }
319
- }
320
- };
321
-
322
- handleBlur = () => {
323
- this.focused = false;
324
- };
325
-
326
- // --- Keyboard Events ---
327
- handleKeyDown = (e) => {
328
- this.isKeyActive = true;
329
-
330
- const { Key } = this.#props;
331
-
332
- if (Key && e.key === Key.key) {
333
- this.#handleModifiers(e, Key);
334
-
335
- if ("run" in Key && typeof Key.run === "function") {
336
- Key.run(e);
337
- } else if ("state" in Key) {
338
- this.currentState = Key.state;
339
- } else if ("target" in Key) {
340
- this.#handleLinkageControl(Key);
341
- }
342
- }
343
- };
344
-
345
- handleKeyUp = () => {
346
- this.isKeyActive = false;
347
- };
348
-
349
- handleKeyPress = (_e) => {
350
- // Reserved
351
- };
352
-
353
- // --- Form Events ---
354
- handleInput = (_e) => {
355
- // Reserved
356
- };
357
-
358
- handleChange = (_e) => {
359
- // Reserved
360
- };
361
-
362
- handleSubmit = (_e) => {
363
- // Reserved
364
- };
365
-
366
- // --- Drag Events ---
367
- handleDragStart = (e) => {
368
- this.isDragging = true;
369
-
370
- const { Drag } = this.#props;
371
-
372
- if (Drag) {
373
- this.#handleModifiers(e, Drag);
374
-
375
- if (typeof Drag === "function") {
376
- Drag(e);
377
- } else if (typeof Drag === "string") {
378
- this.currentState = Drag;
379
- } else if (typeof Drag === "object") {
380
- if ("run" in Drag && typeof Drag.run === "function") {
381
- Drag.run(e);
382
- }
383
-
384
- if ("target" in Drag) {
385
- this.#handleLinkageControl(Drag);
386
- }
387
- }
388
- }
389
- };
390
-
391
- handleDrag = (_e) => {
392
- // Reserved for future Drag move handling
393
- };
394
-
395
- handleDragEnd = (_e) => {
396
- this.isDragging = false;
397
- };
398
-
399
- // --- UI Events ---
400
- handleScroll = (_e) => {
401
- // Reserved
402
- };
403
-
404
- #handleLinkageControl(config) {
405
- if (config.target) {
406
- // 1. Resolve Target Controller
407
- let controller;
408
-
409
- if (typeof config.target === 'string') {
410
- // String ID -> Use internal motion instance
411
- // No controller object for string IDs, handled in step 2 directly via this.#motion
412
- } else if (typeof config.target === 'object') {
413
- // Object Ref -> Try to get controller
414
- // Case A: Svelte 5 bind:this instance with exported getController
415
- if ('getController' in config.target && typeof config.target.getController === 'function') {
416
- controller = config.target.getController();
417
- } else // Case B: Maybe it IS the controller?
418
- {
419
- controller = config.target;
420
- }
421
- }
422
-
423
- // 2. Execute Action
424
- if (typeof config.target === 'string' && this.#motion) {
425
- // Legacy String ID Logic
426
- if (config.action === "play") {
427
- this.#motion.Play(config.target, { reverse: config.reverse });
428
- } else if (config.action === "reset") {
429
- this.#motion.Reset(config.target);
430
- } else if (config.action === "pause") {
431
- this.#motion.pause(config.target);
432
- }
433
- } else if (controller) {
434
- // Object Controller Logic
435
- if (config.action === "play" && controller.play) {
436
- controller.play({ reverse: config.reverse });
437
- } else if (config.action === "reset" && controller.reset) {
438
- controller.reset();
439
- } else if (config.action === "pause" && controller.pause) {
440
- controller.pause();
441
- }
442
- }
443
- }
444
- }
445
- }