@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,6 +1,6 @@
1
1
  /**
2
2
  * 通用尺寸拖动 action。
3
- * TableHead、普通容器和 PRO 分栏均可复用同一套 pointer / keyboard / clamp 协议。
3
+ * TableHead、普通容器和 分栏均可复用同一套 pointer / keyboard / clamp 协议。
4
4
  */
5
5
  export type ResizeAxis = "horizontal" | "vertical";
6
6
  export type ResizeEdge = "start" | "end" | "top" | "bottom";
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { RESIZE_MOTION } from "../motion/presets/resize.js";
2
4
  /** 宽度驱动的退出进度;requiredWidth 是宿主下一次收起项目的宽度阈值。 */
3
5
  export function getResponsiveExitOpacity(availableWidth, requiredWidth, fadeDistance) {
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * 搜索过滤工具 (Search Filter Utilities)
3
5
  * v1.0.0
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { SIDE_PANEL_APPEAR_MOTION, SIDE_PANEL_DISAPPEAR_MOTION, } from "../motion/presets/effects.js";
2
4
  import { resolveMotionCssTiming } from "../motion/spring.js";
3
5
  export const SIDE_PANEL_INLINE_GAP_PX = 16;
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * 分割面板 Action (Split Pane Action)
3
5
  *
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { RESIZE_MOTION } from '../motion/presets/resize.js';
2
4
  const contentSelector = ':scope > .snowui-table-cell-content, :scope > .snowui-table-head-content, :scope > .snowui-table-sort';
3
5
  /** 原生网格始终保持自然布局,只有内容层做 FLIP 位移和宽度揭示。 */
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { createResponsiveExit } from "./responsive-exit.js";
2
4
  import { createTableColumnMotion } from "./table-column-motion.js";
3
5
  import { resizeManager } from "../logic/observer.js";
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { createEdgeFadeMaskImage } from "./edge-fade.js";
2
4
  import { resizeManager } from "../logic/observer.js";
3
5
  /** Table 私有布局适配:遮住实际 Checkbox,向内容侧保留固定 Token 长度的过渡。 */
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { resizeManager } from "../logic/observer.js";
2
4
  /**
3
5
  * Batches single-line cell overflow reads for one semantic table.
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /** 内部连续重定向:逻辑终点与仍在播放的差值分离。 */
2
4
  export function animateTextMotionDelta(element, property, from, to, timing) {
3
5
  const previous = Number.parseFloat(element.style.getPropertyValue(property));
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { animateSettledTextMotionColor, animateTextMotionColorSequence, cancelTextMotionColor, } from "./color.js";
2
4
  import { cancelTextMotionLayout, flipTextMotionElement, splitTextMotionGraphemes, TEXT_MOTION_LAYOUT_TRANSITION, } from "./layout.js";
3
5
  import { extractTextMotionNumber, getTextMotionNumberSign, resolveTextMotionTrend, } from "./numeric.js";
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { getTextMotionStagger } from "./sequence.js";
2
4
  import { resolveTextMotionColor } from "./typography.js";
3
5
  const colorAnimations = new WeakMap();
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { TEXT_MOTION_SPACE } from "./sequence.js";
2
4
  export const TEXT_MOTION_LAYOUT_TRANSITION = {
3
5
  duration: 550,
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  export function shouldReduceTextMotion(respectMotionPreference) {
2
4
  return (respectMotionPreference &&
3
5
  typeof window !== "undefined" &&
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  export const TEXT_MOTION_STAGGER_MS = 25;
2
4
  export const TEXT_MOTION_SPACE = "\u00A0";
3
5
  export const TEXT_MOTION_STAGGER_RATIO = 0.3;
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  import { resolveSnowUIColor } from "../color.js";
2
4
  function resolveCssValue(value, numberUnit = "unitless") {
3
5
  if (value === undefined || value === null || value === "")
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * Tooltip hover 延迟协调器。
3
5
  *
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * Tooltip 动效感知关闭协调器。
3
5
  *
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /** 仅由可见的共享 Tooltip 宿主持有;事件只更新数值,不读布局或驱动渲染。 */
2
4
  export function trackTooltipPointerSpeed(document) {
3
5
  const clock = () => document.defaultView.performance.now();
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * 文本截断 Action (Truncate Action)
3
5
  *
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * Frame Field Control
3
5
  * v1.0.0
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * frame-motion-defaults.ts
3
5
  * v1.8.0
@@ -1,34 +1,26 @@
1
- /**
2
- * OSS Frame 动效控制器(v1.0.0 起在 OSS)
3
- *
4
- * 与 PRO 版本(components/src/logic/frame-pro-motion.svelte.ts)的差异:
5
- * - 不依赖 Motion 编排器(PRO `motion.svelte.ts`)
6
- * - 不向 Motion 注册自身(无 `register` / `notify` 调用)
7
- * - 不实现 `orchestrate*` 编排触发(4 处 $effect 已剥离)
8
- * - controller 仅暴露 FLIP 自身转场方法(`captureFlip` / `playFlipTo`),不暴露 `play` / `reset` / `captureLayout` / `playLayoutTo` 等需要 Motion 上下文的方法
9
- *
10
- * OSS 支持的能力:
11
- * - layoutId / itemId 自身 FLIP 进场(自动从 layout-flip 模块注册表读取起点)
12
- * - whileScroll 自身滚动联动
13
- * - whileAppear / whileHover / whileActive 等通过 CSS bridge 变量(由 frame-motion-defaults.ts 注入)由浏览器原生 transition 执行
14
- *
15
- * 作用半径:1 个 Frame
16
- *
17
- * PRO 版本独立维护一份完整实现,FramePro 使用 PRO 版本。
18
- * 详见 ../components/Frame.md §1 切割原则与 /Frame-Refactor-Plan.md §3.4。
19
- */
20
1
  import type { FrameProps } from "./frame-types";
2
+ import type { LayoutTransitionOptions } from "./motion-types";
3
+ import type { Motion } from "./motion.js";
21
4
  import type { FrameState } from "./frame-state.js";
5
+ import type { FrameResponsive } from "./frame-responsive.js";
22
6
  import { type FlipTransitionOptions } from "./layout-flip";
23
7
  export declare class FrameMotion {
24
8
  #private;
25
- constructor(props: FrameProps, state: FrameState, getId: () => string | undefined, getElement: () => HTMLElement | undefined);
26
- /** OSS 不需要 shouldRegister 概念,但保留 getter 以兼容旧调用方(始终返回 false) */
9
+ constructor(props: FrameProps, motion: Motion | undefined, state: FrameState, responsive: FrameResponsive | null, getId: () => string | undefined, getElement: () => HTMLElement | undefined);
27
10
  get shouldRegister(): boolean;
28
11
  get controller(): {
29
- /** 捕获当前 Frame 位置写入模块级 FLIP 注册表,无需 Motion 上下文。 */
12
+ play: (options?: {
13
+ reverse?: boolean;
14
+ }) => void;
15
+ captureLayout: (layoutId?: string) => void;
16
+ playLayoutTo: (target?: HTMLElement | DOMRect, options?: LayoutTransitionOptions & {
17
+ layoutId?: string;
18
+ }) => void;
19
+ /** 捕获当前 Frame 位置写入模块级 FLIP 注册表,无需 initMotion 上下文。 */
30
20
  captureFlip: (layoutId?: string) => void;
31
- /** 将当前 Frame 以 FLIP 方式过渡到目标位置,无需 Motion 上下文。 */
21
+ /** 将当前 Frame 以 FLIP 方式过渡到目标位置,无需 initMotion 上下文。 */
32
22
  playFlipTo: (target?: HTMLElement | DOMRect, options?: FlipTransitionOptions) => void;
23
+ reset: () => void;
24
+ pause: () => void;
33
25
  };
34
26
  }
@@ -1,63 +1,216 @@
1
1
  /* frame-motion.svelte.js generated by Svelte v5.56.4 */
2
2
  import * as $ from 'svelte/internal/client';
3
+ import { hasMotionConfig } from "./frame-utils.js";
3
4
  import { captureFlipRect, beginFlipEnter, applyFlipExit } from "./layout-flip.js";
4
5
 
5
6
  export class FrameMotion {
6
7
  #props;
8
+ #motion;
7
9
  #state;
10
+ #responsive;
8
11
  #getId;
9
12
  #getElement;
10
13
 
11
- constructor(props, state, getId, getElement) {
14
+ constructor(props, motion, state, responsive, getId, getElement) {
12
15
  this.#props = props;
16
+ this.#motion = motion;
13
17
  this.#state = state;
18
+ this.#responsive = responsive;
14
19
  this.#getId = getId;
15
20
  this.#getElement = getElement;
16
21
 
17
- // 注:OSS 不接受 FrameResponsive 参数(PRO 用它做 whileXs/Sm/... 断点 notify,
18
- // OSS 不向编排器 notify,断点动效由 frame-motion-defaults 写入 CSS bridge 完成)
19
- // === 独立 FLIP 进场 ===
20
- // layoutId/itemId 存在时尝试从模块注册表(layout-flip.ts)读取起点并播放进场动效。
21
- // 与 PRO 不同:OSS 不向 Motion 编排器注册,所以这是唯一的 FLIP 进场路径。
22
+ // 注册到编排器,并触发独立 FLIP 进场(无需 Motion 上下文)
22
23
  $.user_effect(() => {
24
+ const id = this.#getId();
23
25
  const element = this.#getElement();
26
+
27
+ // 独立 FLIP 进场:layoutId/itemId 存在时尝试从模块注册表读取起点
24
28
  const flipId = this.#props.itemId ?? this.#props.layoutId;
25
29
 
26
30
  if (flipId && element) {
27
31
  beginFlipEnter(flipId, element);
28
32
  }
33
+
34
+ if (!this.#motion || !this.shouldRegister || !element || !id) return;
35
+
36
+ return this.#motion.register({
37
+ id,
38
+ element,
39
+ timeline: this.#props.timeline,
40
+ scroll: this.#props.scroll,
41
+ layoutId: this.#props.itemId ?? this.#props.layoutId,
42
+ scope: this.#props.scope
43
+ });
44
+ });
45
+
46
+ // === 状态变化 -> 动效通知 (合并优化) ===
47
+ // 使用单一 effect 替代多个独立 effect,减少响应式订阅开销
48
+ // 缓存上一次的触发器状态,用于差量更新
49
+ let prevTriggerStates = {};
50
+
51
+ $.user_effect(() => {
52
+ if (!this.#motion) return;
53
+
54
+ // 收集所有触发器状态
55
+ const currentStates = {
56
+ whileHover: this.#state.hovered,
57
+ whileClick: this.#state.pressed,
58
+ whileFocus: this.#state.focused,
59
+ whileDrag: this.#state.isDragging,
60
+ whileScroll: this.#state.isScrolling,
61
+ whileKey: this.#state.isKeyActive,
62
+ whileLoad: this.#state.currentState === "StartLoad" || this.#state.currentState === "Load" || !!this.#props.loading,
63
+ whileReload: this.#state.currentState === "Reload" || !!this.#props.whileReload,
64
+ whileActive: this.#state.currentState === "Active" || !!this.#props.whileActive,
65
+ whileDisabled: this.#state.currentState === "Disabled" || !!this.#props.whileDisabled,
66
+ whileValidating: this.#state.currentState === "Validating" || !!this.#props.whileValidating,
67
+ whileUploading: this.#state.currentState === "Uploading" || !!this.#props.whileUploading,
68
+ whileEditing: this.#state.currentState === "Editing" || !!this.#props.whileEditing,
69
+ whileCollapsed: !!this.#props.collapsed,
70
+ whileExpanded: !!this.#props.expanded,
71
+ whileIdle: !this.#state.isAnyTriggerActive
72
+ };
73
+
74
+ // 仅通知发生变化的触发器
75
+ for (const [event, active] of Object.entries(currentStates)) {
76
+ if (prevTriggerStates[event] !== active) {
77
+ this.#notify(event, { active });
78
+ }
79
+ }
80
+
81
+ prevTriggerStates = currentStates;
82
+ });
83
+
84
+ // 生命周期通知 (单独保留,因为需要 cleanup)
85
+ $.user_effect(() => {
86
+ this.#notify("whileAppear", { active: true });
87
+
88
+ // === 编排触发逻辑 ===
89
+ // 根据 orchestrateTrigger 决定何时触发编排
90
+ const trigger = this.#props.orchestrateTrigger ?? "appear";
91
+
92
+ if (this.#props.orchestrate && trigger === "appear") {
93
+ const id = this.#getId();
94
+
95
+ if (id && this.#motion) {
96
+ // 使用微任务或下一帧确保子组件已挂载并注册
97
+ requestAnimationFrame(() => {
98
+ this.#motion?.Play(id);
99
+ });
100
+ }
101
+ }
102
+
103
+ return () => this.#notify("whileDisappear", { active: true });
104
+ });
105
+
106
+ // === orchestrateTrigger: hover ===
107
+ $.user_effect(() => {
108
+ const trigger = this.#props.orchestrateTrigger;
109
+
110
+ if (this.#props.orchestrate && trigger === "hover" && this.#state.hovered) {
111
+ const id = this.#getId();
112
+
113
+ if (id && this.#motion) {
114
+ this.#motion.Play(id);
115
+ }
116
+ }
117
+ });
118
+
119
+ // === orchestrateTrigger: click ===
120
+ $.user_effect(() => {
121
+ const trigger = this.#props.orchestrateTrigger;
122
+
123
+ if (this.#props.orchestrate && trigger === "click" && this.#state.pressed) {
124
+ const id = this.#getId();
125
+
126
+ if (id && this.#motion) {
127
+ this.#motion.Play(id);
128
+ }
129
+ }
130
+ });
131
+
132
+ // === orchestrateTrigger: scroll ===
133
+ $.user_effect(() => {
134
+ const trigger = this.#props.orchestrateTrigger;
135
+
136
+ if (this.#props.orchestrate && trigger === "scroll" && this.#state.isScrolling) {
137
+ const id = this.#getId();
138
+
139
+ if (id && this.#motion) {
140
+ this.#motion.Play(id);
141
+ }
142
+ }
29
143
  });
30
144
 
31
- // === whileScroll 触发器 ===
145
+ // 响应式断点通知
146
+ let prevBreakpoint;
147
+
148
+ $.user_effect(() => {
149
+ if (!this.#motion || !this.#responsive) return;
150
+
151
+ const breakpoint = this.#responsive.breakpoint;
152
+
153
+ if (!breakpoint || breakpoint === prevBreakpoint) return;
154
+
155
+ const eventMap = {
156
+ xs: "whileXs",
157
+ sm: "whileSm",
158
+ md: "whileMd",
159
+ lg: "whileLg",
160
+ xl: "whileXl",
161
+ "2xl": "while2xl"
162
+ };
163
+
164
+ const eventName = eventMap[breakpoint];
165
+
166
+ if (eventName) this.#notify(eventName, { active: true });
167
+
168
+ prevBreakpoint = breakpoint;
169
+ });
170
+
171
+ // Setup whileScroll trigger
32
172
  $.user_effect(() => {
33
173
  if (this.#props.whileScroll) {
34
174
  return this.#setupWhileScroll();
35
175
  }
36
176
  });
37
-
38
- // 注:OSS 不实现 PRO 的以下能力
39
- // - 注册到 Motion 编排器(PRO line 49-58)
40
- // - 状态→Motion notify 差量更新(PRO line 67-111)
41
- // - 生命周期 whileAppear/whileDisappear notify(PRO line 114-132)
42
- // - orchestrateTrigger: appear/hover/click/scroll(PRO line 121-165)
43
- // - 响应式断点 whileXs/Sm/Md/Lg/Xl/2xl notify(PRO line 168-185)
44
- //
45
- // 在 OSS 中:
46
- // - 状态驱动的视觉变化(hover/focus/active 等)通过 frame-inline-style 注入的 CSS bridge
47
- // 变量配合组件 CSS 的 transition 实现,由浏览器原生执行
48
- // - whileAppear 生命周期进入组合动效通过 frame-motion-defaults 写入 CSS 变量后
49
- // 组件 CSS / Frame 默认 CSS 完成
50
- // - 跨组件编排(orchestrate*)属 PRO,OSS 静默忽略相关 props
51
177
  }
52
178
 
53
- /** OSS 不需要 shouldRegister 概念,但保留 getter 以兼容旧调用方(始终返回 false) */
54
179
  get shouldRegister() {
55
- return false;
180
+ const id = this.#getId();
181
+
182
+ return !!id || hasMotionConfig(this.#props);
56
183
  }
57
184
 
58
185
  get controller() {
59
186
  return {
60
- /** 捕获当前 Frame 位置写入模块级 FLIP 注册表,无需 Motion 上下文。 */
187
+ play: (options) => {
188
+ const id = this.#getId();
189
+
190
+ if (id && this.#motion) this.#motion.Play(id, options);
191
+ },
192
+
193
+ captureLayout: (layoutId) => {
194
+ const id = layoutId ?? this.#props.itemId ?? this.#props.layoutId ?? this.#getId();
195
+ const element = this.#getElement();
196
+
197
+ if (id && element && this.#motion) {
198
+ this.#motion.captureLayout(id, element);
199
+ }
200
+ },
201
+
202
+ playLayoutTo: (target, options) => {
203
+ const id = options?.layoutId ?? this.#props.itemId ?? this.#props.layoutId ?? this.#getId();
204
+ const element = this.#getElement();
205
+
206
+ if (id && element && this.#motion) {
207
+ this.#motion.playLayoutTo(id, element, target, options);
208
+ } else {
209
+ options?.onComplete?.();
210
+ }
211
+ },
212
+
213
+ /** 捕获当前 Frame 位置写入模块级 FLIP 注册表,无需 initMotion 上下文。 */
61
214
  captureFlip: (layoutId) => {
62
215
  const id = layoutId ?? this.#props.itemId ?? this.#props.layoutId ?? this.#getId();
63
216
  const element = this.#getElement();
@@ -65,7 +218,7 @@ export class FrameMotion {
65
218
  if (id && element) captureFlipRect(id, element);
66
219
  },
67
220
 
68
- /** 将当前 Frame 以 FLIP 方式过渡到目标位置,无需 Motion 上下文。 */
221
+ /** 将当前 Frame 以 FLIP 方式过渡到目标位置,无需 initMotion 上下文。 */
69
222
  playFlipTo: (target, options) => {
70
223
  const element = this.#getElement();
71
224
 
@@ -74,15 +227,28 @@ export class FrameMotion {
74
227
  } else {
75
228
  options?.onComplete?.();
76
229
  }
77
- }
230
+ },
231
+
232
+ reset: () => {
233
+ const id = this.#getId();
234
+
235
+ if (id && this.#motion) this.#motion.Reset(id);
236
+ },
78
237
 
79
- // 以下方法在 OSS 中不可用(需要 Motion 编排器):
80
- // - play / reset / pause(需要 Motion.Play/Reset/pause)
81
- // - captureLayout / playLayoutTo(需要 Motion.captureLayout/playLayoutTo)
82
- // 如需以上能力请使用 FramePro。
238
+ pause: () => {
239
+ // TODO
240
+ }
83
241
  };
84
242
  }
85
243
 
244
+ #notify(event, detail) {
245
+ const id = this.#getId();
246
+
247
+ if (!this.#motion || !this.shouldRegister || !id) return;
248
+
249
+ this.#motion.notify(id, event, detail);
250
+ }
251
+
86
252
  #setupWhileScroll() {
87
253
  const element = this.#getElement();
88
254
 
@@ -1,3 +1,5 @@
1
+ /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
1
3
  /**
2
4
  * Frame 属性过滤器
3
5
  * - 分离原生事件处理器
@@ -1,17 +1,5 @@
1
- /**
2
- * OSS Frame 状态机(v1.0.0 起在 OSS)
3
- *
4
- * 与 PRO 版本(components/src/logic/frame-pro-state.svelte.ts)的差异:
5
- * - 不含 §8 联动控制(linkageControl / Motion 依赖)
6
- * - 构造函数不接收 motion 参数
7
- * - 事件处理器中的 `if ("target" in config) { ... }` 分支被剥离
8
- *
9
- * 作用半径:1 个 Frame(仅修改自身 currentState 与交互状态)
10
- *
11
- * PRO 版本独立维护一份完整实现,FramePro 使用 PRO 版本。
12
- * 详见 ../components/Frame.md §1 切割原则与 /Frame-Refactor-Plan.md §3.4。
13
- */
14
1
  import type { FrameProps, CoreState } from "./frame-types";
2
+ import type { Motion } from "./motion.js";
15
3
  export declare class FrameState {
16
4
  #private;
17
5
  hovered: boolean;
@@ -21,7 +9,7 @@ export declare class FrameState {
21
9
  isScrolling: boolean;
22
10
  isKeyActive: boolean;
23
11
  currentState: CoreState;
24
- constructor(props: FrameProps);
12
+ constructor(props: FrameProps, motion?: Motion | undefined);
25
13
  get interactionState(): (string & {}) | "StartLoad" | "Load" | "Reload" | "Appear" | "Disappear" | "Idle" | "Active" | "Disabled" | "Validating" | "Uploading" | "Editing" | "Click" | "Hover" | "Focus" | "Drag" | "Scroll";
26
14
  get isAnyTriggerActive(): boolean | undefined;
27
15
  handleClick: (e: MouseEvent) => void;
@@ -4,6 +4,7 @@ import { resolveFrameWhileMotionConfig } from "./frame-motion-defaults.js";
4
4
 
5
5
  export class FrameState {
6
6
  #props;
7
+ #motion;
7
8
 
8
9
  #hovered = // === 交互状态 (Internal Interaction States) ===
9
10
  $.state(false);
@@ -76,8 +77,9 @@ export class FrameState {
76
77
  $.set(this.#currentState, value, true);
77
78
  }
78
79
 
79
- constructor(props) {
80
+ constructor(props, motion = undefined) {
80
81
  this.#props = props;
82
+ this.#motion = motion;
81
83
 
82
84
  $.user_effect(() => {
83
85
  const controlledState = this.#props.currentState;
@@ -230,7 +232,7 @@ export class FrameState {
230
232
  return false;
231
233
  }
232
234
 
233
- // 这些字段属于普通 Trigger/Linkage 配置,不视为"按状态映射"
235
+ // 这些字段属于普通 Trigger/Linkage 配置,不视为“按状态映射”
234
236
  const reservedKeys = [
235
237
  "run",
236
238
  "target",
@@ -289,8 +291,9 @@ export class FrameState {
289
291
  this.currentState = config.next;
290
292
  }
291
293
 
292
- // OSS Frame 不支持 §8 联动控制 (Click={{target, action}})。
293
- // 配置中带 target 字段时,OSS 会忽略;如需联动控制请使用 FramePro。
294
+ if ("target" in config) {
295
+ this.#handleLinkageControl(config);
296
+ }
294
297
  }
295
298
  }
296
299
 
@@ -341,7 +344,9 @@ export class FrameState {
341
344
  Hover.run(e);
342
345
  }
343
346
 
344
- // OSS 忽略 target/action(§8 联动控制属 PRO)
347
+ if ("target" in Hover) {
348
+ this.#handleLinkageControl(Hover);
349
+ }
345
350
  }
346
351
  }
347
352
  };
@@ -400,7 +405,9 @@ export class FrameState {
400
405
  Focus.run(e);
401
406
  }
402
407
 
403
- // OSS 忽略 target/action(§8 联动控制属 PRO)
408
+ if ("target" in Focus) {
409
+ this.#handleLinkageControl(Focus);
410
+ }
404
411
  }
405
412
  }
406
413
  };
@@ -422,9 +429,9 @@ export class FrameState {
422
429
  Key.run(e);
423
430
  } else if ("state" in Key) {
424
431
  this.currentState = Key.state;
432
+ } else if ("target" in Key) {
433
+ this.#handleLinkageControl(Key);
425
434
  }
426
-
427
- // OSS 忽略 target/action(§8 联动控制属 PRO)
428
435
  }
429
436
  };
430
437
 
@@ -467,7 +474,9 @@ export class FrameState {
467
474
  Drag.run(e);
468
475
  }
469
476
 
470
- // OSS 忽略 target/action(§8 联动控制属 PRO)
477
+ if ("target" in Drag) {
478
+ this.#handleLinkageControl(Drag);
479
+ }
471
480
  }
472
481
  }
473
482
  };
@@ -484,4 +493,46 @@ export class FrameState {
484
493
  handleScroll = (_e) => {
485
494
  // Reserved
486
495
  };
496
+
497
+ #handleLinkageControl(config) {
498
+ if (config.target) {
499
+ // 1. Resolve Target Controller
500
+ let controller;
501
+
502
+ if (typeof config.target === 'string') {
503
+ // String ID -> Use internal motion instance
504
+ // No controller object for string IDs, handled in step 2 directly via this.#motion
505
+ } else if (typeof config.target === 'object') {
506
+ // Object Ref -> Try to get controller
507
+ // Case A: Svelte 5 bind:this instance with exported getController
508
+ if ('getController' in config.target && typeof config.target.getController === 'function') {
509
+ controller = config.target.getController();
510
+ } else // Case B: Maybe it IS the controller?
511
+ {
512
+ controller = config.target;
513
+ }
514
+ }
515
+
516
+ // 2. Execute Action
517
+ if (typeof config.target === 'string' && this.#motion) {
518
+ // Legacy String ID Logic
519
+ if (config.action === "play") {
520
+ this.#motion.Play(config.target, { reverse: config.reverse });
521
+ } else if (config.action === "reset") {
522
+ this.#motion.Reset(config.target);
523
+ } else if (config.action === "pause") {
524
+ this.#motion.pause(config.target);
525
+ }
526
+ } else if (controller) {
527
+ // Object Controller Logic
528
+ if (config.action === "play" && controller.play) {
529
+ controller.play({ reverse: config.reverse });
530
+ } else if (config.action === "reset" && controller.reset) {
531
+ controller.reset();
532
+ } else if (config.action === "pause" && controller.pause) {
533
+ controller.pause();
534
+ }
535
+ }
536
+ }
537
+ }
487
538
  }