@snowui-design-system/components 0.3.0-alpha.6 → 0.3.0-alpha.8

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 (281) hide show
  1. package/AGENTS.md +10 -0
  2. package/LICENSE +31 -14
  3. package/README.md +21 -3
  4. package/THIRD_PARTY_NOTICES.md +27 -0
  5. package/component-catalog.json +26 -0
  6. package/dist/client/blocks/Sidebar.js +108 -95
  7. package/dist/client/blocks/SidebarItem.js +26 -12
  8. package/dist/client/blocks/SidebarSection.js +3 -1
  9. package/dist/client/blocks/index.js +1 -1
  10. package/dist/client/compat.js +1 -1
  11. package/dist/client/components/BarChart.js +9 -2
  12. package/dist/client/components/Breadcrumb.js +10 -6
  13. package/dist/client/components/ChartGroup.js +23 -10
  14. package/dist/client/components/CircularChart.js +8 -1
  15. package/dist/client/components/DataTable.d.ts +8 -2
  16. package/dist/client/components/DataTable.js +9 -3
  17. package/dist/client/components/GaugeChart.js +8 -1
  18. package/dist/client/components/Image.d.ts +2 -0
  19. package/dist/client/components/Image.js +14 -2
  20. package/dist/client/components/Input.js +2 -2
  21. package/dist/client/components/LineChart.js +9 -2
  22. package/dist/client/components/Listbox.js +43 -15
  23. package/dist/client/components/MenuItem.js +7 -1
  24. package/dist/client/components/OTPInput.d.ts +32 -0
  25. package/dist/client/components/OTPInput.js +556 -0
  26. package/dist/client/components/OverflowActions.d.ts +5 -1
  27. package/dist/client/components/OverflowActions.js +36 -11
  28. package/dist/client/components/Pagination.js +9 -8
  29. package/dist/client/components/ScrollArea.js +11 -5
  30. package/dist/client/components/SearchBox.js +12 -3
  31. package/dist/client/components/Select.js +3 -1
  32. package/dist/client/components/SidePanel.js +4 -3
  33. package/dist/client/components/Slider.js +7 -3
  34. package/dist/client/components/Spinner.js +9 -2
  35. package/dist/client/components/Table.js +14 -7
  36. package/dist/client/components/TableCell.js +33 -11
  37. package/dist/client/components/Tag.js +8 -1
  38. package/dist/client/context.js +1 -1
  39. package/dist/client/dev.js +1 -1
  40. package/dist/client/i18n/messages.d.ts +1 -1
  41. package/dist/client/i18n/messages.js +55 -1
  42. package/dist/client/index.d.ts +3 -0
  43. package/dist/client/index.js +3 -1
  44. package/dist/client/internal/code-block/prettier-svelte.d.ts +1 -1
  45. package/dist/client/internal/component-icon/index.js +1 -1
  46. package/dist/client/internal/snow-ui-logo/emoji-metrics.js +1 -1
  47. package/dist/client/keys.d.ts +1 -0
  48. package/dist/client/keys.js +2 -1
  49. package/dist/client/lib/adaptive-contrast-renderer.js +1 -1
  50. package/dist/client/lib/chart/appearance-timeline.js +1 -1
  51. package/dist/client/lib/chart/arc-path.js +1 -1
  52. package/dist/client/lib/chart/colors.js +1 -1
  53. package/dist/client/lib/chart/size.js +1 -1
  54. package/dist/client/lib/clipboard.js +1 -1
  55. package/dist/client/lib/color.js +1 -1
  56. package/dist/client/lib/date-format.js +1 -1
  57. package/dist/client/lib/edge-fade.js +1 -1
  58. package/dist/client/lib/media-loading.d.ts +7 -0
  59. package/dist/client/lib/media-loading.js +12 -0
  60. package/dist/client/lib/number-format.js +1 -1
  61. package/dist/client/lib/overflow-actions-motion.js +1 -1
  62. package/dist/client/lib/overlay-trigger-timing.js +1 -1
  63. package/dist/client/lib/responsive-exit.js +1 -1
  64. package/dist/client/lib/search-filter.js +1 -1
  65. package/dist/client/lib/side-panel.js +1 -1
  66. package/dist/client/lib/split-pane.js +1 -1
  67. package/dist/client/lib/table-column-motion.js +1 -1
  68. package/dist/client/lib/table-context.d.ts +5 -0
  69. package/dist/client/lib/table-context.js +4 -1
  70. package/dist/client/lib/table-responsive.d.ts +1 -1
  71. package/dist/client/lib/table-responsive.js +40 -8
  72. package/dist/client/lib/table-selection-fade.js +1 -1
  73. package/dist/client/lib/table-truncation.js +1 -1
  74. package/dist/client/lib/text-motion/animation.js +1 -1
  75. package/dist/client/lib/text-motion/character.js +1 -1
  76. package/dist/client/lib/text-motion/color.js +1 -1
  77. package/dist/client/lib/text-motion/layout.js +1 -1
  78. package/dist/client/lib/text-motion/preference.js +1 -1
  79. package/dist/client/lib/text-motion/sequence.js +1 -1
  80. package/dist/client/lib/text-motion/typography.js +1 -1
  81. package/dist/client/lib/tooltip-delay.js +1 -1
  82. package/dist/client/lib/tooltip-motion-dismiss.js +1 -1
  83. package/dist/client/lib/tooltip-pointer-speed.js +1 -1
  84. package/dist/client/lib/truncate.js +1 -1
  85. package/dist/client/logic/frame-field-control.js +1 -1
  86. package/dist/client/logic/frame-motion-defaults.js +1 -1
  87. package/dist/client/logic/frame-prop-filter.js +1 -1
  88. package/dist/client/logic/geometry-cache.js +1 -1
  89. package/dist/client/logic/layout-flip.js +1 -1
  90. package/dist/client/logic/morph.js +1 -1
  91. package/dist/client/logic/motion-engine.js +1 -1
  92. package/dist/client/logic/motion-orchestration.js +1 -1
  93. package/dist/client/logic/motion-types.js +1 -1
  94. package/dist/client/logic/overflow-actions.d.ts +8 -0
  95. package/dist/client/logic/overflow-actions.js +5 -0
  96. package/dist/client/logic/wc-adapter.js +1 -1
  97. package/dist/client/motion/bridge.js +1 -1
  98. package/dist/client/motion/content-crossfade.js +1 -1
  99. package/dist/client/motion/expand.js +1 -1
  100. package/dist/client/motion/fade-in.js +1 -1
  101. package/dist/client/motion/fade-out.js +1 -1
  102. package/dist/client/motion/morph.js +1 -1
  103. package/dist/client/motion/move.js +1 -1
  104. package/dist/client/motion/number.js +1 -1
  105. package/dist/client/motion/replace.js +1 -1
  106. package/dist/client/motion/rotate.css +1 -1
  107. package/dist/client/motion/rotate.js +1 -1
  108. package/dist/client/motion/scale-in.js +1 -1
  109. package/dist/client/motion/tokens.js +1 -1
  110. package/dist/client/motion/while-2xl.js +1 -1
  111. package/dist/client/motion/while-active.js +1 -1
  112. package/dist/client/motion/while-appear.js +1 -1
  113. package/dist/client/motion/while-click.js +1 -1
  114. package/dist/client/motion/while-collapsed.js +1 -1
  115. package/dist/client/motion/while-disabled.js +1 -1
  116. package/dist/client/motion/while-disappear.js +1 -1
  117. package/dist/client/motion/while-drag.js +1 -1
  118. package/dist/client/motion/while-editing.js +1 -1
  119. package/dist/client/motion/while-expanded.js +1 -1
  120. package/dist/client/motion/while-focus.js +1 -1
  121. package/dist/client/motion/while-hover.js +1 -1
  122. package/dist/client/motion/while-idle.js +1 -1
  123. package/dist/client/motion/while-key.js +1 -1
  124. package/dist/client/motion/while-lg.js +1 -1
  125. package/dist/client/motion/while-load.js +1 -1
  126. package/dist/client/motion/while-md.js +1 -1
  127. package/dist/client/motion/while-reload.js +1 -1
  128. package/dist/client/motion/while-scroll.js +1 -1
  129. package/dist/client/motion/while-sm.js +1 -1
  130. package/dist/client/motion/while-uploading.js +1 -1
  131. package/dist/client/motion/while-validating.js +1 -1
  132. package/dist/client/motion/while-xl.js +1 -1
  133. package/dist/client/motion/while-xs.js +1 -1
  134. package/dist/client/styles/auto-layout.css +1 -1
  135. package/dist/client/styles/backdrop.css +1 -1
  136. package/dist/client/styles/components.css +7 -1
  137. package/dist/client/styles/index.css +1 -1
  138. package/dist/client/styles/layout.css +13 -3
  139. package/dist/client/styles/scale.css +1 -1
  140. package/dist/client/styles/scrollbar.css +1 -1
  141. package/dist/client/styles/tokens.css +1 -1
  142. package/dist/client/vite-env.d.ts +1 -1
  143. package/dist/server/blocks/Sidebar.js +5 -5
  144. package/dist/server/blocks/SidebarItem.js +4 -2
  145. package/dist/server/blocks/SidebarSection.js +3 -1
  146. package/dist/server/blocks/index.js +1 -1
  147. package/dist/server/compat.js +1 -1
  148. package/dist/server/components/BarChart.js +5 -2
  149. package/dist/server/components/Breadcrumb.js +5 -2
  150. package/dist/server/components/ChartGroup.js +6 -3
  151. package/dist/server/components/CircularChart.js +4 -1
  152. package/dist/server/components/DataTable.d.ts +8 -2
  153. package/dist/server/components/DataTable.js +9 -3
  154. package/dist/server/components/GaugeChart.js +4 -1
  155. package/dist/server/components/Image.d.ts +2 -0
  156. package/dist/server/components/Image.js +11 -4
  157. package/dist/server/components/Input.js +2 -2
  158. package/dist/server/components/LineChart.js +5 -2
  159. package/dist/server/components/Listbox.js +32 -14
  160. package/dist/server/components/MenuItem.js +4 -1
  161. package/dist/server/components/OTPInput.d.ts +32 -0
  162. package/dist/server/components/OTPInput.js +401 -0
  163. package/dist/server/components/OverflowActions.d.ts +5 -1
  164. package/dist/server/components/OverflowActions.js +41 -18
  165. package/dist/server/components/Pagination.js +2 -2
  166. package/dist/server/components/ScrollArea.js +5 -2
  167. package/dist/server/components/SearchBox.js +9 -3
  168. package/dist/server/components/Select.js +3 -1
  169. package/dist/server/components/SidePanel.js +4 -3
  170. package/dist/server/components/Slider.js +7 -3
  171. package/dist/server/components/Spinner.js +4 -2
  172. package/dist/server/components/Table.js +8 -3
  173. package/dist/server/components/TableCell.js +31 -11
  174. package/dist/server/components/Tag.js +4 -1
  175. package/dist/server/context.js +1 -1
  176. package/dist/server/dev.js +1 -1
  177. package/dist/server/i18n/messages.d.ts +1 -1
  178. package/dist/server/i18n/messages.js +55 -1
  179. package/dist/server/index.d.ts +3 -0
  180. package/dist/server/index.js +3 -1
  181. package/dist/server/internal/code-block/prettier-svelte.d.ts +1 -1
  182. package/dist/server/internal/component-icon/index.js +1 -1
  183. package/dist/server/internal/snow-ui-logo/emoji-metrics.js +1 -1
  184. package/dist/server/keys.d.ts +1 -0
  185. package/dist/server/keys.js +2 -1
  186. package/dist/server/lib/adaptive-contrast-renderer.js +1 -1
  187. package/dist/server/lib/chart/appearance-timeline.js +1 -1
  188. package/dist/server/lib/chart/arc-path.js +1 -1
  189. package/dist/server/lib/chart/colors.js +1 -1
  190. package/dist/server/lib/chart/size.js +1 -1
  191. package/dist/server/lib/clipboard.js +1 -1
  192. package/dist/server/lib/color.js +1 -1
  193. package/dist/server/lib/date-format.js +1 -1
  194. package/dist/server/lib/edge-fade.js +1 -1
  195. package/dist/server/lib/media-loading.d.ts +7 -0
  196. package/dist/server/lib/media-loading.js +12 -0
  197. package/dist/server/lib/number-format.js +1 -1
  198. package/dist/server/lib/overflow-actions-motion.js +1 -1
  199. package/dist/server/lib/overlay-trigger-timing.js +1 -1
  200. package/dist/server/lib/responsive-exit.js +1 -1
  201. package/dist/server/lib/search-filter.js +1 -1
  202. package/dist/server/lib/side-panel.js +1 -1
  203. package/dist/server/lib/split-pane.js +1 -1
  204. package/dist/server/lib/table-column-motion.js +1 -1
  205. package/dist/server/lib/table-context.d.ts +5 -0
  206. package/dist/server/lib/table-context.js +4 -1
  207. package/dist/server/lib/table-responsive.d.ts +1 -1
  208. package/dist/server/lib/table-responsive.js +40 -8
  209. package/dist/server/lib/table-selection-fade.js +1 -1
  210. package/dist/server/lib/table-truncation.js +1 -1
  211. package/dist/server/lib/text-motion/animation.js +1 -1
  212. package/dist/server/lib/text-motion/character.js +1 -1
  213. package/dist/server/lib/text-motion/color.js +1 -1
  214. package/dist/server/lib/text-motion/layout.js +1 -1
  215. package/dist/server/lib/text-motion/preference.js +1 -1
  216. package/dist/server/lib/text-motion/sequence.js +1 -1
  217. package/dist/server/lib/text-motion/typography.js +1 -1
  218. package/dist/server/lib/tooltip-delay.js +1 -1
  219. package/dist/server/lib/tooltip-motion-dismiss.js +1 -1
  220. package/dist/server/lib/tooltip-pointer-speed.js +1 -1
  221. package/dist/server/lib/truncate.js +1 -1
  222. package/dist/server/logic/frame-field-control.js +1 -1
  223. package/dist/server/logic/frame-motion-defaults.js +1 -1
  224. package/dist/server/logic/frame-prop-filter.js +1 -1
  225. package/dist/server/logic/geometry-cache.js +1 -1
  226. package/dist/server/logic/layout-flip.js +1 -1
  227. package/dist/server/logic/morph.js +1 -1
  228. package/dist/server/logic/motion-engine.js +1 -1
  229. package/dist/server/logic/motion-orchestration.js +1 -1
  230. package/dist/server/logic/motion-types.js +1 -1
  231. package/dist/server/logic/overflow-actions.d.ts +8 -0
  232. package/dist/server/logic/overflow-actions.js +5 -0
  233. package/dist/server/logic/wc-adapter.js +1 -1
  234. package/dist/server/motion/bridge.js +1 -1
  235. package/dist/server/motion/content-crossfade.js +1 -1
  236. package/dist/server/motion/expand.js +1 -1
  237. package/dist/server/motion/fade-in.js +1 -1
  238. package/dist/server/motion/fade-out.js +1 -1
  239. package/dist/server/motion/morph.js +1 -1
  240. package/dist/server/motion/move.js +1 -1
  241. package/dist/server/motion/number.js +1 -1
  242. package/dist/server/motion/replace.js +1 -1
  243. package/dist/server/motion/rotate.css +1 -1
  244. package/dist/server/motion/rotate.js +1 -1
  245. package/dist/server/motion/scale-in.js +1 -1
  246. package/dist/server/motion/tokens.js +1 -1
  247. package/dist/server/motion/while-2xl.js +1 -1
  248. package/dist/server/motion/while-active.js +1 -1
  249. package/dist/server/motion/while-appear.js +1 -1
  250. package/dist/server/motion/while-click.js +1 -1
  251. package/dist/server/motion/while-collapsed.js +1 -1
  252. package/dist/server/motion/while-disabled.js +1 -1
  253. package/dist/server/motion/while-disappear.js +1 -1
  254. package/dist/server/motion/while-drag.js +1 -1
  255. package/dist/server/motion/while-editing.js +1 -1
  256. package/dist/server/motion/while-expanded.js +1 -1
  257. package/dist/server/motion/while-focus.js +1 -1
  258. package/dist/server/motion/while-hover.js +1 -1
  259. package/dist/server/motion/while-idle.js +1 -1
  260. package/dist/server/motion/while-key.js +1 -1
  261. package/dist/server/motion/while-lg.js +1 -1
  262. package/dist/server/motion/while-load.js +1 -1
  263. package/dist/server/motion/while-md.js +1 -1
  264. package/dist/server/motion/while-reload.js +1 -1
  265. package/dist/server/motion/while-scroll.js +1 -1
  266. package/dist/server/motion/while-sm.js +1 -1
  267. package/dist/server/motion/while-uploading.js +1 -1
  268. package/dist/server/motion/while-validating.js +1 -1
  269. package/dist/server/motion/while-xl.js +1 -1
  270. package/dist/server/motion/while-xs.js +1 -1
  271. package/dist/server/styles/auto-layout.css +1 -1
  272. package/dist/server/styles/backdrop.css +1 -1
  273. package/dist/server/styles/components.css +7 -1
  274. package/dist/server/styles/index.css +1 -1
  275. package/dist/server/styles/layout.css +13 -3
  276. package/dist/server/styles/scale.css +1 -1
  277. package/dist/server/styles/scrollbar.css +1 -1
  278. package/dist/server/styles/tokens.css +1 -1
  279. package/dist/server/vite-env.d.ts +1 -1
  280. package/llms.txt +3 -0
  281. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import 'svelte/internal/disclose-version';
2
2
  import * as $ from 'svelte/internal/client';
3
+ import { useLocale } from "../i18n/locale.js";
3
4
  import Button from "./Button.js";
4
5
  import { ComponentIcon } from "../internal/component-icon/index.js";
5
6
  import { resizeManager } from "../logic/observer.js";
@@ -33,6 +34,8 @@ export default function Tag($$anchor, $$props) {
33
34
  $.append_styles($$anchor, $$css);
34
35
 
35
36
  // SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
37
+ const localeContext = useLocale();
38
+
36
39
  /** 内置图标按钮配置;事件与角色由所属组件控制。 */
37
40
  let variant = $.prop($$props, 'variant', 3, "default"),
38
41
  toggle = $.prop($$props, 'toggle', 3, false),
@@ -331,13 +334,17 @@ export default function Tag($$anchor, $$props) {
331
334
  var consequent_1 = ($$anchor) => {
332
335
  {
333
336
  let $0 = $.derived(() => `snowui-clear-icon-btn snowui-tag-close${parts()?.Button?.class ? ` ${parts().Button.class}` : ""}`);
337
+ let $1 = $.derived(() => localeContext.t("tag.close"));
334
338
 
335
339
  Button($$anchor, $.spread_props({ bare: true, emphasis: 'muted', size: 'sm' }, () => parts()?.Button, {
336
340
  type: 'button',
337
341
  get class() {
338
342
  return $.get($0);
339
343
  },
340
- 'aria-label': 'Close tag',
344
+
345
+ get 'aria-label'() {
346
+ return $.get($1);
347
+ },
341
348
  onclick: handleCloseClick,
342
349
  children: ($$anchor, $$slotProps) => {
343
350
  ComponentIcon($$anchor, { name: 'close', 'aria-hidden': 'true' });
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /**
4
4
  * 全局上下文定义 (Global Context Definitions)
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* SnowUI source notice | LICENSE 2.2.0: ../LICENSE
2
+ /* SnowUI source notice | LICENSE 2.3.0: ../LICENSE
3
3
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
4
4
  // Dev entry — use `playground/` for component development
5
5
  // Run: cd ../playground && pnpm dev
@@ -1,6 +1,6 @@
1
1
  /** SnowUI 组件内置 UI 文案 catalog。文档: ../../../specs/maintainers/LocalizationSpec.md */
2
2
  export declare const DEFAULT_LOCALE = "zh-CN";
3
- export type SnowUIMessageKey = "copyButton.copy" | "copyButton.copied" | "codeBlock.copyCode" | "codeBlock.fullscreen" | "codeBlock.exitFullscreen" | "codeBlock.resize" | "codeBlock.fullscreenDialog" | "expandButton.expand" | "expandButton.collapse" | "sidebar.resize" | "pagination.pageSize" | "pagination.previous" | "pagination.next" | "pagination.page" | "input.clear" | "input.increment" | "input.decrement" | "input.openTime" | "input.openDate" | "input.year" | "input.month" | "input.day" | "input.week" | "input.hour" | "input.minute" | "input.second" | "input.yearPlaceholder" | "input.monthPlaceholder" | "input.dayPlaceholder" | "input.weekPlaceholder" | "imageViewer.previous" | "imageViewer.next" | "imageViewer.close" | "toast.close" | "table.scrollRegion" | "table.scrollRegionNamed" | "tableHead.selectAll" | "tableHead.resizeColumn" | "tableHead.resizeColumnGeneric" | "tableCell.selectRow" | "text.expand" | "textarea.resize" | "indicator.resizeWidth" | "indicator.resizeHeight" | "indicator.resizeBoth" | "colorSchemeButton.toLight" | "colorSchemeButton.toDark" | "styleButton.toSnowUI" | "styleButton.toApple" | "sidePanel.placement.toInline" | "sidePanel.placement.toFloating" | "sidePanel.previous" | "sidePanel.next" | "sidePanel.copy" | "sidePanel.delete" | "sidePanel.cancel" | "sidePanel.save" | "sidePanel.close" | "sidePanel.resize" | "tableToolbar.name" | "tableToolbar.search" | "tableToolbar.sort" | "tableToolbar.filter" | "tableToolbar.clear" | "tableToolbar.copy" | "tableToolbar.delete" | "tableToolbar.selected" | "tableToolbar.deleting" | "tableToolbar.defaultSort" | "tableToolbar.ascending" | "tableToolbar.descending" | "tableToolbar.defaultFilter" | "overflowActions.more" | "dialog.close";
3
+ export type SnowUIMessageKey = "copyButton.copy" | "copyButton.copied" | "codeBlock.copyCode" | "codeBlock.fullscreen" | "codeBlock.exitFullscreen" | "codeBlock.resize" | "codeBlock.fullscreenDialog" | "expandButton.expand" | "expandButton.collapse" | "sidebarSection.expand" | "sidebarSection.collapse" | "breadcrumb.navigation" | "pagination.navigation" | "spinner.loading" | "scrollArea.content" | "barChart.name" | "barChart.cells" | "lineChart.name" | "lineChart.cells" | "circularChart.name" | "gaugeChart.name" | "chartGroup.name" | "chartGroup.cells" | "chartGroup.cell" | "searchBox.placeholder" | "searchBox.clear" | "sidePanel.title" | "slider.title" | "menuItem.deleteCustom" | "listbox.search" | "tag.close" | "sidebar.navigation" | "sidebar.expand" | "sidebar.collapse" | "sidebarItem.updated" | "sidebar.resize" | "pagination.pageSize" | "pagination.previous" | "pagination.next" | "pagination.page" | "otpInput.invalidCode" | "input.clear" | "input.increment" | "input.decrement" | "input.openTime" | "input.openDate" | "input.year" | "input.month" | "input.day" | "input.week" | "input.hour" | "input.minute" | "input.second" | "input.yearPlaceholder" | "input.monthPlaceholder" | "input.dayPlaceholder" | "input.weekPlaceholder" | "imageViewer.previous" | "imageViewer.next" | "imageViewer.close" | "toast.close" | "table.scrollRegion" | "table.scrollRegionNamed" | "tableHead.selectAll" | "tableHead.resizeColumn" | "tableHead.resizeColumnGeneric" | "tableCell.selectRow" | "text.expand" | "textarea.resize" | "indicator.resizeWidth" | "indicator.resizeHeight" | "indicator.resizeBoth" | "colorSchemeButton.toLight" | "colorSchemeButton.toDark" | "styleButton.toSnowUI" | "styleButton.toApple" | "sidePanel.placement.toInline" | "sidePanel.placement.toFloating" | "sidePanel.previous" | "sidePanel.next" | "sidePanel.copy" | "sidePanel.delete" | "sidePanel.cancel" | "sidePanel.save" | "sidePanel.close" | "sidePanel.resize" | "tableToolbar.name" | "tableToolbar.search" | "tableToolbar.sort" | "tableToolbar.filter" | "tableToolbar.clear" | "tableToolbar.copy" | "tableToolbar.delete" | "tableToolbar.selected" | "tableToolbar.deleting" | "tableToolbar.defaultSort" | "tableToolbar.ascending" | "tableToolbar.descending" | "tableToolbar.defaultFilter" | "overflowActions.more" | "dialog.close";
4
4
  export type SnowUIMessageValues = Record<string, string | number>;
5
5
  export type SnowUIMessageOverrides = Partial<Record<SnowUIMessageKey, string>>;
6
6
  export declare const SNOWUI_MESSAGES: Record<string, Record<SnowUIMessageKey, string>>;
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /** SnowUI 组件内置 UI 文案 catalog。文档: ../../../specs/maintainers/LocalizationSpec.md */
4
4
  export const DEFAULT_LOCALE = "zh-CN";
@@ -13,11 +13,38 @@ export const SNOWUI_MESSAGES = {
13
13
  "codeBlock.fullscreenDialog": "全屏代码查看",
14
14
  "expandButton.expand": "展开",
15
15
  "expandButton.collapse": "收起",
16
+ "sidebarSection.expand": "展开{{title}}",
17
+ "sidebarSection.collapse": "收起{{title}}",
18
+ "breadcrumb.navigation": "面包屑导航",
19
+ "pagination.navigation": "分页导航",
20
+ "spinner.loading": "加载中",
21
+ "scrollArea.content": "可滚动内容",
22
+ "barChart.name": "柱状图",
23
+ "barChart.cells": "柱状图数据单元格",
24
+ "lineChart.name": "折线图",
25
+ "lineChart.cells": "折线图数据单元格",
26
+ "circularChart.name": "圆形图表",
27
+ "gaugeChart.name": "仪表图",
28
+ "chartGroup.name": "组合图表",
29
+ "chartGroup.cells": "组合图表数据单元格",
30
+ "chartGroup.cell": "单元格 {{index}}",
31
+ "searchBox.placeholder": "搜索",
32
+ "searchBox.clear": "清除搜索内容",
33
+ "sidePanel.title": "详情",
34
+ "slider.title": "文本",
35
+ "menuItem.deleteCustom": "删除自定义选项",
36
+ "listbox.search": "搜索",
37
+ "tag.close": "关闭标签",
38
+ "sidebar.navigation": "主导航",
39
+ "sidebar.expand": "展开侧边栏",
40
+ "sidebar.collapse": "收起侧边栏",
41
+ "sidebarItem.updated": "已更新",
16
42
  "sidebar.resize": "调整侧边栏宽度",
17
43
  "pagination.pageSize": "每页条数",
18
44
  "pagination.previous": "上一页",
19
45
  "pagination.next": "下一页",
20
46
  "pagination.page": "第 {{page}} 页",
47
+ "otpInput.invalidCode": "请输入 {{length}} 位数字验证码",
21
48
  "input.clear": "清除输入",
22
49
  "input.increment": "增加数值",
23
50
  "input.decrement": "减少数值",
@@ -89,11 +116,38 @@ export const SNOWUI_MESSAGES = {
89
116
  "codeBlock.fullscreenDialog": "Fullscreen code view",
90
117
  "expandButton.expand": "Expand",
91
118
  "expandButton.collapse": "Collapse",
119
+ "sidebarSection.expand": "Expand {{title}}",
120
+ "sidebarSection.collapse": "Collapse {{title}}",
121
+ "breadcrumb.navigation": "Breadcrumb",
122
+ "pagination.navigation": "Pagination",
123
+ "spinner.loading": "Loading",
124
+ "scrollArea.content": "Scrollable content",
125
+ "barChart.name": "Bar chart",
126
+ "barChart.cells": "Bar chart data cells",
127
+ "lineChart.name": "Line chart",
128
+ "lineChart.cells": "Line chart data cells",
129
+ "circularChart.name": "Circular chart",
130
+ "gaugeChart.name": "Gauge chart",
131
+ "chartGroup.name": "Chart group",
132
+ "chartGroup.cells": "Chart group data cells",
133
+ "chartGroup.cell": "Cell {{index}}",
134
+ "searchBox.placeholder": "Search",
135
+ "searchBox.clear": "Clear search",
136
+ "sidePanel.title": "Details",
137
+ "slider.title": "Text",
138
+ "menuItem.deleteCustom": "Delete custom option",
139
+ "listbox.search": "Search",
140
+ "tag.close": "Close tag",
141
+ "sidebar.navigation": "Primary navigation",
142
+ "sidebar.expand": "Expand sidebar",
143
+ "sidebar.collapse": "Collapse sidebar",
144
+ "sidebarItem.updated": "Updated",
92
145
  "sidebar.resize": "Resize sidebar width",
93
146
  "pagination.pageSize": "Items per page",
94
147
  "pagination.previous": "Previous page",
95
148
  "pagination.next": "Next page",
96
149
  "pagination.page": "Page {{page}}",
150
+ "otpInput.invalidCode": "Enter a {{length}}-digit verification code",
97
151
  "input.clear": "Clear input",
98
152
  "input.increment": "Increase value",
99
153
  "input.decrement": "Decrease value",
@@ -39,6 +39,8 @@ export { default as Separator } from "./components/Separator.js";
39
39
  export { default as Progress } from "./components/Progress.js";
40
40
  export { default as Slider } from "./components/Slider.js";
41
41
  export { default as Input } from './components/Input.js';
42
+ export { default as OTPInput } from "./components/OTPInput.js";
43
+ export type { OTPLength } from "./components/OTPInput.js";
42
44
  export { default as SearchInput } from "./components/SearchInput.js";
43
45
  export { default as Textarea } from "./components/Textarea.js";
44
46
  export { default as Select } from "./components/Select.js";
@@ -66,6 +68,7 @@ export { default as Avatar } from "./components/Avatar.js";
66
68
  export { default as AvatarGroup } from "./components/AvatarGroup.js";
67
69
  export { default as Gradient } from "./components/Gradient.js";
68
70
  export { default as SnowUILogo } from "./components/SnowUILogo.js";
71
+ export { provideMediaLoading, type MediaLoading } from "./lib/media-loading";
69
72
  export { default as Image } from "./components/Image.js";
70
73
  export { default as ImageGroup } from "./components/ImageGroup.js";
71
74
  export { default as Icon } from './components/Icon.js';
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  // SnowUI 许可入口:阅读或使用本公开入口前先读 ../LICENSE;同任务同许可版本去重,源码修改与框架移植须有相应权限。
4
4
  export { default as Accordion } from "./components/Accordion.js";
@@ -30,6 +30,7 @@ export { default as Separator } from "./components/Separator.js";
30
30
  export { default as Progress } from "./components/Progress.js";
31
31
  export { default as Slider } from "./components/Slider.js";
32
32
  export { default as Input } from './components/Input.js';
33
+ export { default as OTPInput } from "./components/OTPInput.js";
33
34
  export { default as SearchInput } from "./components/SearchInput.js";
34
35
  export { default as Textarea } from "./components/Textarea.js";
35
36
  export { default as Select } from "./components/Select.js";
@@ -55,6 +56,7 @@ export { default as Avatar } from "./components/Avatar.js";
55
56
  export { default as AvatarGroup } from "./components/AvatarGroup.js";
56
57
  export { default as Gradient } from "./components/Gradient.js";
57
58
  export { default as SnowUILogo } from "./components/SnowUILogo.js";
59
+ export { provideMediaLoading } from "./lib/media-loading.js";
58
60
  export { default as Image } from "./components/Image.js";
59
61
  export { default as ImageGroup } from "./components/ImageGroup.js";
60
62
  export { default as Icon } from './components/Icon.js';
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  // 插件 browser 子路径尚未声明类型,沿用 Prettier 官方 Plugin 接口。
4
4
  declare module "prettier-plugin-svelte/browser" {
@@ -1,3 +1,3 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export { default as ComponentIcon } from "./ComponentIcon.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  // 品牌专用:以系统 emoji 的实际着色像素边界匹配 32×32 图标,保持原始比例。
4
4
  export const LOGO_EMOJI_FONT = '"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif';
@@ -11,6 +11,7 @@ export declare const SCROLL_CONTEXT_KEY: unique symbol;
11
11
  export declare const TEXT_CONTEXT_KEY: unique symbol;
12
12
  export declare const ICON_CONTEXT_KEY: unique symbol;
13
13
  export declare const AVATAR_CONTEXT_KEY: unique symbol;
14
+ export declare const MEDIA_LOADING_CONTEXT_KEY: unique symbol;
14
15
  export declare const IMAGE_CONTEXT_KEY: unique symbol;
15
16
  export declare const IMAGE_GROUP_CONTEXT_KEY: unique symbol;
16
17
  export declare const IMAGE_VIEWER_CONTEXT_KEY: unique symbol;
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /**
4
4
  * Context Keys
@@ -13,6 +13,7 @@ export const SCROLL_CONTEXT_KEY = Symbol("SCROLL_CONTEXT");
13
13
  export const TEXT_CONTEXT_KEY = Symbol("TEXT_CONTEXT");
14
14
  export const ICON_CONTEXT_KEY = Symbol("ICON_CONTEXT");
15
15
  export const AVATAR_CONTEXT_KEY = Symbol("AVATAR_CONTEXT");
16
+ export const MEDIA_LOADING_CONTEXT_KEY = Symbol("MEDIA_LOADING_CONTEXT");
16
17
  export const IMAGE_CONTEXT_KEY = Symbol("IMAGE_CONTEXT");
17
18
  export const IMAGE_GROUP_CONTEXT_KEY = Symbol("IMAGE_GROUP_CONTEXT");
18
19
  export const IMAGE_VIEWER_CONTEXT_KEY = Symbol("IMAGE_VIEWER_CONTEXT");
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /** 按需导入的 SVG 渲染入口;不注入 Frame,也不在模块顶层访问 DOM。 */
4
4
  export { default as AdaptiveContrastMask } from "./AdaptiveContrastMask.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { clamp } from "./geometry.js";
4
4
  export const SEGMENT_APPEARANCE_FILL_DURATION = 500;
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { arc } from "d3-shape";
4
4
  import { clamp, formatPoint, normalizePositiveAngle } from "./geometry.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { resolveSnowUIColor, } from "../../index.js";
4
4
  export const DEFAULT_CHART_COLORS = [
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { resizeManager } from "../../index.js";
4
4
  import { toNumber } from "./geometry.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export async function writeClipboardText(text) {
4
4
  if (typeof navigator === "undefined" ||
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export const SNOWUI_COLOR_TOKENS = {
4
4
  StaticBlack100: "--static-black-100",
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export const DEFAULT_DATE_LOCALE = "en-US";
4
4
  export const DEFAULT_DATE_EMPTY_VALUE = "—";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  // 内容边缘渐隐遮罩(Edge Fade Mask)共享能力。
4
4
  //
@@ -0,0 +1,7 @@
1
+ export type MediaLoading = "lazy" | "eager";
2
+ type MediaLoadingGetter = () => MediaLoading;
3
+ /** 在组件初始化时为后代 Image 设置默认策略;传 getter 可响应状态变化。 */
4
+ export declare function provideMediaLoading(value: MediaLoading | MediaLoadingGetter): void;
5
+ /** 仅供组件内部消费;没有 Provider 时保留原生懒加载默认值。 */
6
+ export declare function useMediaLoading(): MediaLoadingGetter;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
+ 复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
+ import { getContext, setContext } from "svelte";
4
+ import { MEDIA_LOADING_CONTEXT_KEY } from "../keys.js";
5
+ /** 在组件初始化时为后代 Image 设置默认策略;传 getter 可响应状态变化。 */
6
+ export function provideMediaLoading(value) {
7
+ setContext(MEDIA_LOADING_CONTEXT_KEY, typeof value === "function" ? value : () => value);
8
+ }
9
+ /** 仅供组件内部消费;没有 Provider 时保留原生懒加载默认值。 */
10
+ export function useMediaLoading() {
11
+ return getContext(MEDIA_LOADING_CONTEXT_KEY) ?? (() => "lazy");
12
+ }
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export const DEFAULT_NUMBER_VALUE_LABEL_FRACTION_DIGITS = 2;
4
4
  export const DEFAULT_NUMBER_PERCENT_FRACTION_DIGITS = 1;
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { RESIZE_MOTION } from '../motion/presets/resize.js';
4
4
  /** 操作组私有布局适配;Flex 决定终点,独立视觉壳只做平移,不缩放 Button。 */
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /**
4
4
  * overlay-trigger-timing.ts
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { RESIZE_MOTION } from "../motion/presets/resize.js";
4
4
  /** 宽度驱动的退出进度;requiredWidth 是宿主下一次收起项目的宽度阈值。 */
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /**
4
4
  * 搜索过滤工具 (Search Filter Utilities)
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { SIDE_PANEL_APPEAR_MOTION, SIDE_PANEL_DISAPPEAR_MOTION, } from "../motion/presets/effects.js";
4
4
  import { resolveMotionCssTiming } from "../motion/spring.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /**
4
4
  * 分割面板 Action (Split Pane Action)
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { RESIZE_MOTION } from '../motion/presets/resize.js';
4
4
  const contentSelector = ':scope > .snowui-table-cell-content, :scope > .snowui-table-head-content, :scope > .snowui-table-sort';
@@ -2,6 +2,8 @@ import type { ResourceSize } from "../context";
2
2
  import type { MotionConfig } from "../logic/motion-config";
3
3
  import type { TableTruncationResult } from "./table-truncation";
4
4
  import type { OverflowActionsItem } from "../components/OverflowActions.js";
5
+ import type { ComponentProps } from "svelte";
6
+ import type OverflowActions from "../components/OverflowActions.js";
5
7
  export type TableSortDirection = "ascending" | "descending";
6
8
  export type TableRoleLayout = "auto" | "column" | "overlay";
7
9
  export type TableRoleOverlayBlurMode = "progressive" | "uniform";
@@ -49,6 +51,9 @@ export interface TableContext {
49
51
  getActionsCompact: () => "auto" | "none";
50
52
  getActionsOverflow: () => "all" | "progressive";
51
53
  getActionsOverflowFrom: () => "start" | "end";
54
+ getActionsMaxVisible: () => number;
55
+ getActionsProps: () => Pick<ComponentProps<typeof OverflowActions>, "buttonProps" | "parts" | "moreLabel">;
56
+ getActionsContentWidth: () => number | undefined;
52
57
  getActionsColumnWidth: () => number;
53
58
  getActionsMinWidth: () => number;
54
59
  getActionsMaxWidth: () => number;
@@ -22,8 +22,11 @@ const fallback = {
22
22
  getRowActions: () => [],
23
23
  runRowAction: () => {},
24
24
  getActionsCompact: () => "auto",
25
- getActionsOverflow: () => "all",
25
+ getActionsOverflow: () => "progressive",
26
26
  getActionsOverflowFrom: () => "end",
27
+ getActionsMaxVisible: () => 3,
28
+ getActionsProps: () => ({}),
29
+ getActionsContentWidth: () => undefined,
27
30
  getActionsColumnWidth: () => 160,
28
31
  getActionsMinWidth: () => 40,
29
32
  getActionsMaxWidth: () => 320,
@@ -3,7 +3,7 @@ interface Options {
3
3
  horizontalScroll: boolean;
4
4
  roleLayout: TableRoleLayout;
5
5
  actionsWidth: number;
6
- onLayout: (layout: "column" | "overlay", actionsWidth: number) => void;
6
+ onLayout: (layout: "column" | "overlay", actionsWidth: number, actionsContentWidth: number) => void;
7
7
  }
8
8
  /** 表格私有响应式控制器;每表统一测量,不为各 Cell 创建 Observer。 */
9
9
  export declare function observeTableResponsive(table: HTMLTableElement, viewport: HTMLElement, initial: Options): {
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { createResponsiveExit } from "./responsive-exit.js";
4
4
  import { createTableColumnMotion } from "./table-column-motion.js";
@@ -24,6 +24,8 @@ export function observeTableResponsive(table, viewport, initial) {
24
24
  }
25
25
  });
26
26
  let measuredActionsWidth = 0;
27
+ let cachedActionsPadding = 0;
28
+ let cachedMoreWidth = 0;
27
29
  let complexGrid = false;
28
30
  const originalSpans = new WeakMap();
29
31
  const renderedSpans = new WeakMap();
@@ -91,20 +93,50 @@ export function observeTableResponsive(table, viewport, initial) {
91
93
  const hideable = !complexGrid && !role && !firstData && head.dataset.responsiveHide !== 'false' && head.colSpan === 1;
92
94
  if (!role)
93
95
  firstData = false;
94
- return { role, hideable, preferred: preferred[index], minimum: minimum[index] };
96
+ return { role, actions: head.dataset.as === 'actions', hideable, preferred: preferred[index], minimum: minimum[index] };
95
97
  });
98
+ measureActionChrome();
96
99
  copy.remove();
97
100
  }
101
+ function measureActionChrome() {
102
+ const actionCells = Array.from(table.querySelectorAll('.snowui-table-cell[data-as="actions"]'));
103
+ let padding = preferredPadding * 2;
104
+ let moreWidth = 0;
105
+ for (const cell of actionCells) {
106
+ const style = getComputedStyle(cell);
107
+ const content = cell.querySelector('.snowui-table-cell-content[data-actions="true"]');
108
+ const contentStyle = content ? getComputedStyle(content) : undefined;
109
+ padding = Math.max(padding, parseFloat(style.paddingLeft) + parseFloat(style.paddingRight), contentStyle ? parseFloat(contentStyle.paddingLeft) + parseFloat(contentStyle.paddingRight) : 0);
110
+ for (const more of cell.querySelectorAll('.snowui-overflow-actions-more-measure')) {
111
+ moreWidth = Math.max(moreWidth, more.getBoundingClientRect().width);
112
+ }
113
+ }
114
+ cachedActionsPadding = padding;
115
+ cachedMoreWidth = moreWidth;
116
+ }
98
117
  function flush() {
99
118
  frame = 0;
100
119
  if (disposed || !table.isConnected || viewport.clientWidth <= 0)
101
120
  return;
121
+ // 菜单存在时保留触发器几何;关闭属性变更会重新进入同一求解入口。
122
+ if (table.querySelector('.snowui-select-button-trigger[aria-expanded="true"]'))
123
+ return;
102
124
  if (!columns)
103
125
  measureColumns();
104
126
  const measured = columns;
105
127
  // clientWidth 会取整;慢速拖动时会让 padding 与渐隐每隔 1px 才跳一次。
106
128
  // 内部 viewport 无边框及 padding,计算样式保留未受 transform 影响的 CSS 小数宽度。
107
129
  const available = parseFloat(getComputedStyle(viewport).width) || viewport.clientWidth;
130
+ const padding = cachedActionsPadding;
131
+ const moreWidth = cachedMoreWidth;
132
+ const protectedWidth = measured.filter(column => !column.role && !column.hideable).reduce((sum, column) => sum + column.minimum, 0);
133
+ const selectionWidth = measured.filter(column => column.role && !column.actions).reduce((sum, column) => sum + column.minimum, 0);
134
+ const floor = moreWidth + padding + fadeDistance;
135
+ const budget = Math.max(floor, Math.min(available * .2, 14 * (parseFloat(getComputedStyle(document.documentElement).fontSize) || 16), options.actionsWidth, Math.max(0, available - protectedWidth - selectionWidth)));
136
+ measuredActionsWidth = budget;
137
+ for (const column of measured)
138
+ if (column.actions)
139
+ column.preferred = column.minimum = budget;
108
140
  const full = measured.reduce((sum, column) => sum + column.preferred, 0);
109
141
  const layout = options.roleLayout === 'auto' ? (full <= available + 0.5 ? 'column' : 'overlay') : options.roleLayout;
110
142
  const included = measured.filter(column => layout === 'column' || !column.role);
@@ -162,14 +194,14 @@ export function observeTableResponsive(table, viewport, initial) {
162
194
  table.classList.toggle('snowui-table-responsive-text-fit', textFit);
163
195
  // 容器改变时由同一次 CSS 布局同步调整 padding,不能等尺寸回调再补一次位移。
164
196
  // 显式固定列宽可能使首选与最小宽度相等,此时保留原来的边界选择。
165
- const padding = preferred > minimum
197
+ const responsivePadding = preferred > minimum
166
198
  ? `clamp(${minimumPadding}px, calc(${minimumPadding}px + (100cqw - ${minimum}px) * ${(preferredPadding - minimumPadding) / (preferred - minimum)}), ${preferredPadding}px)`
167
199
  : `${minimumPadding + (preferredPadding - minimumPadding) * ratio}px`;
168
200
  const paddingProperty = '--snowui-table-responsive-cell-padding-inline';
169
- if (table.style.getPropertyValue(paddingProperty) !== padding)
170
- table.style.setProperty(paddingProperty, padding);
201
+ if (table.style.getPropertyValue(paddingProperty) !== responsivePadding)
202
+ table.style.setProperty(paddingProperty, responsivePadding);
171
203
  table.dataset.responsiveLayout = layout;
172
- options.onLayout(layout, measuredActionsWidth);
204
+ options.onLayout(layout, measuredActionsWidth, Math.max(moreWidth, budget - padding - fadeDistance));
173
205
  for (const row of rows()) {
174
206
  let index = 0;
175
207
  const visible = [];
@@ -242,11 +274,11 @@ export function observeTableResponsive(table, viewport, initial) {
242
274
  originalSpans.set(record.target, record.target.colSpan);
243
275
  return true;
244
276
  }
245
- return record.type !== 'attributes' || record.attributeName !== 'style' || (record.target instanceof Element && record.target.matches('th, td'));
277
+ return record.type !== 'attributes' || record.attributeName !== 'style' || (record.target instanceof Element && (record.target.matches('th, td') || record.target.closest('.snowui-overflow-actions-more-measure')));
246
278
  }))
247
279
  refresh();
248
280
  });
249
- observer.observe(table, { childList: true, characterData: true, subtree: true, attributes: true, attributeOldValue: true, attributeFilter: ['data-responsive-hide', 'data-column-id', 'style', 'colspan', 'rowspan', 'class'] });
281
+ observer.observe(table, { childList: true, characterData: true, subtree: true, attributes: true, attributeOldValue: true, attributeFilter: ['data-responsive-hide', 'data-column-id', 'style', 'colspan', 'rowspan', 'class', 'aria-expanded'] });
250
282
  window.addEventListener('resize', refresh);
251
283
  table.addEventListener('load', refresh, true);
252
284
  document.fonts?.addEventListener('loadingdone', refresh);
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { createEdgeFadeMaskImage } from "./edge-fade.js";
4
4
  import { resizeManager } from "../logic/observer.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { resizeManager } from "../logic/observer.js";
4
4
  /**
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /** 内部连续重定向:逻辑终点与仍在播放的差值分离。 */
4
4
  export function animateTextMotionDelta(element, property, from, to, timing) {
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { animateSettledTextMotionColor, animateTextMotionColorSequence, cancelTextMotionColor, } from "./color.js";
4
4
  import { cancelTextMotionLayout, flipTextMotionElement, splitTextMotionGraphemes, TEXT_MOTION_LAYOUT_TRANSITION, } from "./layout.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { getTextMotionStagger } from "./sequence.js";
4
4
  import { resolveTextMotionColor } from "./typography.js";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { TEXT_MOTION_SPACE } from "./sequence.js";
4
4
  export const TEXT_MOTION_LAYOUT_TRANSITION = {
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export function shouldReduceTextMotion(respectMotionPreference) {
4
4
  return (respectMotionPreference &&
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  export const TEXT_MOTION_STAGGER_MS = 25;
4
4
  export const TEXT_MOTION_SPACE = "\u00A0";
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  import { resolveSnowUIColor } from "../color.js";
4
4
  function resolveCssValue(value, numberUnit = "unitless") {
@@ -1,4 +1,4 @@
1
- /* SnowUI source notice | LICENSE 2.2.0: ../../../LICENSE
1
+ /* SnowUI source notice | LICENSE 2.3.0: ../../../LICENSE
2
2
  复制或移植时随附该版本完整 LICENSE 与第三方声明;同任务、同版本、同已确认用途不逐组件重复检查。 */
3
3
  /**
4
4
  * Tooltip hover 延迟协调器。