@snowui-design-system/components 0.3.0-alpha.5 → 0.3.0-alpha.7

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 (80) hide show
  1. package/AGENTS.md +8 -0
  2. package/README.md +19 -3
  3. package/THIRD_PARTY_NOTICES.md +27 -0
  4. package/component-catalog.json +26 -0
  5. package/dist/client/blocks/Sidebar.js +108 -95
  6. package/dist/client/blocks/SidebarItem.js +26 -12
  7. package/dist/client/blocks/SidebarSection.js +3 -1
  8. package/dist/client/components/BarChart.js +9 -2
  9. package/dist/client/components/Breadcrumb.js +10 -6
  10. package/dist/client/components/ChartGroup.js +23 -10
  11. package/dist/client/components/CircularChart.js +8 -1
  12. package/dist/client/components/Frame.js +9 -7
  13. package/dist/client/components/GaugeChart.js +8 -1
  14. package/dist/client/components/Image.d.ts +2 -0
  15. package/dist/client/components/Image.js +14 -2
  16. package/dist/client/components/Input.js +2 -2
  17. package/dist/client/components/LineChart.js +9 -2
  18. package/dist/client/components/Listbox.js +43 -15
  19. package/dist/client/components/MenuItem.js +7 -1
  20. package/dist/client/components/OTPInput.d.ts +32 -0
  21. package/dist/client/components/OTPInput.js +556 -0
  22. package/dist/client/components/Pagination.js +9 -8
  23. package/dist/client/components/ScrollArea.js +11 -5
  24. package/dist/client/components/SearchBox.js +12 -3
  25. package/dist/client/components/Select.js +18 -6
  26. package/dist/client/components/SidePanel.js +4 -3
  27. package/dist/client/components/Slider.js +7 -3
  28. package/dist/client/components/Spinner.js +9 -2
  29. package/dist/client/components/Tag.js +8 -1
  30. package/dist/client/i18n/messages.d.ts +1 -1
  31. package/dist/client/i18n/messages.js +54 -0
  32. package/dist/client/index.d.ts +3 -0
  33. package/dist/client/index.js +2 -0
  34. package/dist/client/keys.d.ts +1 -0
  35. package/dist/client/keys.js +1 -0
  36. package/dist/client/lib/media-loading.d.ts +7 -0
  37. package/dist/client/lib/media-loading.js +12 -0
  38. package/dist/client/logic/frame-dom-runtime.d.ts +2 -1
  39. package/dist/client/logic/frame-dom-runtime.js +1 -1
  40. package/dist/client/styles/components.css +6 -0
  41. package/dist/client/styles/layout.css +12 -2
  42. package/dist/server/blocks/Sidebar.js +5 -5
  43. package/dist/server/blocks/SidebarItem.js +4 -2
  44. package/dist/server/blocks/SidebarSection.js +3 -1
  45. package/dist/server/components/BarChart.js +5 -2
  46. package/dist/server/components/Breadcrumb.js +5 -2
  47. package/dist/server/components/ChartGroup.js +6 -3
  48. package/dist/server/components/CircularChart.js +4 -1
  49. package/dist/server/components/Frame.js +9 -7
  50. package/dist/server/components/GaugeChart.js +4 -1
  51. package/dist/server/components/Image.d.ts +2 -0
  52. package/dist/server/components/Image.js +11 -4
  53. package/dist/server/components/Input.js +2 -2
  54. package/dist/server/components/LineChart.js +5 -2
  55. package/dist/server/components/Listbox.js +32 -14
  56. package/dist/server/components/MenuItem.js +4 -1
  57. package/dist/server/components/OTPInput.d.ts +32 -0
  58. package/dist/server/components/OTPInput.js +401 -0
  59. package/dist/server/components/Pagination.js +2 -2
  60. package/dist/server/components/ScrollArea.js +5 -2
  61. package/dist/server/components/SearchBox.js +9 -3
  62. package/dist/server/components/Select.js +18 -6
  63. package/dist/server/components/SidePanel.js +4 -3
  64. package/dist/server/components/Slider.js +7 -3
  65. package/dist/server/components/Spinner.js +4 -2
  66. package/dist/server/components/Tag.js +4 -1
  67. package/dist/server/i18n/messages.d.ts +1 -1
  68. package/dist/server/i18n/messages.js +54 -0
  69. package/dist/server/index.d.ts +3 -0
  70. package/dist/server/index.js +2 -0
  71. package/dist/server/keys.d.ts +1 -0
  72. package/dist/server/keys.js +1 -0
  73. package/dist/server/lib/media-loading.d.ts +7 -0
  74. package/dist/server/lib/media-loading.js +12 -0
  75. package/dist/server/logic/frame-dom-runtime.d.ts +2 -1
  76. package/dist/server/logic/frame-dom-runtime.js +1 -1
  77. package/dist/server/styles/components.css +6 -0
  78. package/dist/server/styles/layout.css +12 -2
  79. package/llms.txt +1 -0
  80. package/package.json +1 -1
@@ -154,6 +154,16 @@ export default function Select($$anchor, $$props) {
154
154
  // 通过 MenuItem 注册收集的选项
155
155
  let registeredOptions = $.state($.proxy([]));
156
156
 
157
+ // options 模式以调用方当前数据为准;MenuItem 的注册只发生在挂载时,
158
+ // 同一 value 的标签随语言或业务状态更新时不能继续使用旧注册快照。
159
+ const availableOptions = $.derived(() => $.get(children)
160
+ ? $.get(registeredOptions)
161
+ : $.get(options).map((option) => ({
162
+ value: option.value,
163
+ label: option.label,
164
+ disabled: option.disabled ?? false
165
+ })));
166
+
157
167
  // 搜索过滤状态
158
168
  let filterText = $.state("");
159
169
 
@@ -166,15 +176,15 @@ export default function Select($$anchor, $$props) {
166
176
  // 自定义项始终显示(不参与过滤,由 MenuItem 自身判断)
167
177
  // 匹配策略由 src/lib/search-filter.ts 的 matchesSearch 统一处理
168
178
  const filteredOptions = $.derived(() => {
169
- if (!$.get(filterText)) return $.get(registeredOptions);
179
+ if (!$.get(filterText)) return $.get(availableOptions);
170
180
 
171
- return $.get(registeredOptions).filter((o) => matchesSearch(o.label, $.get(filterText)));
181
+ return $.get(availableOptions).filter((o) => matchesSearch(o.label, $.get(filterText)));
172
182
  });
173
183
 
174
184
  // 派生显示值
175
185
  const hasValue = $.derived(() => $.get(resolvedValueStr) !== undefined && $.get(resolvedValueStr) !== "");
176
186
 
177
- const selectedOption = $.derived(() => $.get(registeredOptions).find((o) => o.value === $.get(resolvedValueStr)) ?? $.get(customOptions).find((o) => o.value === $.get(resolvedValueStr)));
187
+ const selectedOption = $.derived(() => $.get(availableOptions).find((o) => o.value === $.get(resolvedValueStr)) ?? $.get(customOptions).find((o) => o.value === $.get(resolvedValueStr)));
178
188
  const selectedLabel = $.derived(() => $.get(selectedOption)?.label ?? ($.get(hasValue) ? $.get(resolvedValueStr) : undefined));
179
189
  const isPlaceholderVisible = $.derived(() => !$.get(hasValue));
180
190
 
@@ -234,7 +244,9 @@ export default function Select($$anchor, $$props) {
234
244
  },
235
245
 
236
246
  get triggerEl() {
237
- return $.get(buttonTrigger) ? $.get(selectEl) ?? null : $.get(triggerEl) ?? null;
247
+ return $.get(buttonTrigger)
248
+ ? $.get(selectEl)?.querySelector("button") ?? null
249
+ : $.get(triggerEl) ?? null;
238
250
  },
239
251
 
240
252
  get anchorEl() {
@@ -299,7 +311,7 @@ export default function Select($$anchor, $$props) {
299
311
  if (!trimmed) return;
300
312
 
301
313
  // 不与已有静态项或自定义项重复
302
- if ($.get(registeredOptions).some((o) => o.value === trimmed)) return;
314
+ if ($.get(availableOptions).some((o) => o.value === trimmed)) return;
303
315
 
304
316
  if ($.get(customOptions).some((o) => o.value === trimmed)) return;
305
317
 
@@ -334,7 +346,7 @@ export default function Select($$anchor, $$props) {
334
346
 
335
347
  // 打开 Listbox
336
348
  function openListbox() {
337
- const allOptions = [...$.get(registeredOptions), ...$.get(customOptions)];
349
+ const allOptions = [...$.get(availableOptions), ...$.get(customOptions)];
338
350
  const idx = allOptions.findIndex((o) => o.value === $.get(resolvedValueStr));
339
351
 
340
352
  $.set(activeIndex, idx >= 0 ? idx : 0, true);
@@ -265,7 +265,7 @@ export default function SidePanel($$anchor, $$props) {
265
265
  },
266
266
 
267
267
  get 'aria-label'() {
268
- return title();
268
+ return $.get(resolvedTitle);
269
269
  },
270
270
  tabindex: '-1',
271
271
  get 'data-placement'() {
@@ -358,7 +358,7 @@ export default function SidePanel($$anchor, $$props) {
358
358
  var text_2 = $.child(span_1, true);
359
359
 
360
360
  $.reset(span_1);
361
- $.template_effect(() => $.set_text(text_2, title()));
361
+ $.template_effect(() => $.set_text(text_2, $.get(resolvedTitle)));
362
362
  $.append($$anchor, span_1);
363
363
  };
364
364
 
@@ -609,7 +609,7 @@ export default function SidePanel($$anchor, $$props) {
609
609
  bottomTrailing = $.prop($$props, 'bottomTrailing', 3, undefined),
610
610
  bottomLeadingActions = $.prop($$props, 'bottomLeadingActions', 3, undefined),
611
611
  bottomTrailingActions = $.prop($$props, 'bottomTrailingActions', 3, undefined),
612
- title = $.prop($$props, 'title', 3, "Details"),
612
+ title = $.prop($$props, 'title', 3, undefined),
613
613
  showTitle = $.prop($$props, 'showTitle', 3, false),
614
614
  backdrop = $.prop($$props, 'backdrop', 3, false),
615
615
  closeOnEscape = $.prop($$props, 'closeOnEscape', 3, true),
@@ -633,6 +633,7 @@ export default function SidePanel($$anchor, $$props) {
633
633
  provideComponentParts(() => parts());
634
634
 
635
635
  const locale = useLocale();
636
+ const resolvedTitle = $.derived(() => title() ?? locale.t("sidePanel.title"));
636
637
  let panelEl = $.state(void 0);
637
638
  let viewportEl = $.state(void 0);
638
639
  let scrollbarEl = $.state(void 0);
@@ -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 Frame from "./Frame.js";
4
5
  import Text from "./Text.js";
5
6
  import { resolveSnowUIColor } from "../lib/color.js";
@@ -62,13 +63,15 @@ export default function Slider($$anchor, $$props) {
62
63
  $.append_styles($$anchor, $$css);
63
64
 
64
65
  // SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
66
+ const localeContext = useLocale();
67
+
65
68
  let value = $.prop($$props, 'value', 15, 0),
66
69
  minValue = $.prop($$props, 'minValue', 3, 0),
67
70
  maxValue = $.prop($$props, 'maxValue', 3, 100),
68
71
  step = $.prop($$props, 'step', 3, 1),
69
72
  orientation = $.prop($$props, 'orientation', 3, "horizontal"),
70
73
  variant = $.prop($$props, 'variant', 3, "default"),
71
- title = $.prop($$props, 'title', 3, "Text"),
74
+ title = $.prop($$props, 'title', 3, undefined),
72
75
  showSteps = $.prop($$props, 'showSteps', 3, false),
73
76
  showLabel = $.prop($$props, 'showLabel', 3, false),
74
77
  thickness = $.prop($$props, 'thickness', 3, undefined),
@@ -90,6 +93,7 @@ export default function Slider($$anchor, $$props) {
90
93
  parts = $.prop($$props, 'parts', 3, undefined),
91
94
  rest = $.rest_props($$props, rest_excludes);
92
95
 
96
+ const resolvedTitle = $.derived(() => title() ?? localeContext.t("slider.title"));
93
97
  let controlRef = $.state(void 0);
94
98
  let labelsRef = $.state(void 0);
95
99
  let activeIndex = $.state(0);
@@ -380,7 +384,7 @@ export default function Slider($$anchor, $$props) {
380
384
 
381
385
  var text = $.text();
382
386
 
383
- $.template_effect(() => $.set_text(text, title()));
387
+ $.template_effect(() => $.set_text(text, $.get(resolvedTitle)));
384
388
  $.append($$anchor, text);
385
389
  },
386
390
  $$slots: { default: true }
@@ -388,7 +392,7 @@ export default function Slider($$anchor, $$props) {
388
392
  };
389
393
 
390
394
  $.if(node, ($$render) => {
391
- if ($.get(isBarVariant) && title()) $$render(consequent);
395
+ if ($.get(isBarVariant) && $.get(resolvedTitle)) $$render(consequent);
392
396
  });
393
397
  }
394
398
 
@@ -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 Frame from "./Frame.js";
4
5
  import { getSizeContext, getSize } from "../context.js";
5
6
  import { resolveResourceSizeToken } from "../logic/resource-size.js";
@@ -20,8 +21,9 @@ export default function Spinner($$anchor, $$props) {
20
21
  $.append_styles($$anchor, $$css);
21
22
 
22
23
  // SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
23
- const inheritedSpinnerPart = useComponentPart("Spinner");
24
+ const localeContext = useLocale();
24
25
 
26
+ const inheritedSpinnerPart = useComponentPart("Spinner");
25
27
  let explicitProps = $.rest_props($$props, rest_excludes);
26
28
 
27
29
  let $$d = $.derived(() => mergeComponentPartProps(inheritedSpinnerPart.current, explicitProps)),
@@ -111,6 +113,8 @@ export default function Spinner($$anchor, $$props) {
111
113
  $.get(style)
112
114
  ].filter(Boolean).join("; "));
113
115
 
116
+ let $2 = $.derived(() => localeContext.t("spinner.loading"));
117
+
114
118
  Frame($$anchor, $.spread_props(
115
119
  {
116
120
  enableResponsive: false,
@@ -132,7 +136,10 @@ export default function Spinner($$anchor, $$props) {
132
136
  return $.get(responsive);
133
137
  },
134
138
  role: 'status',
135
- 'aria-label': 'Loading',
139
+ get 'aria-label'() {
140
+ return $.get($2);
141
+ },
142
+
136
143
  get renderHints() {
137
144
  return $.get(spinnerRenderHints);
138
145
  }
@@ -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,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>>;
@@ -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';
@@ -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';
@@ -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;
@@ -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");
@@ -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.2.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,9 +1,10 @@
1
1
  /**
2
2
  * frame-dom-runtime.svelte.ts
3
- * v1.0.0
3
+ * v1.0.1
4
4
  * 职责:统一拼装 Frame 根节点的 DOM props、事件包装器与运行时 data 属性。
5
5
  *
6
6
  * Log:
7
+ * - [2026-10-18] Fix: 事件包装器改读稳定源状态,避免同步卸载后读取已销毁派生状态,并保留同一事件中的实时禁用/加载语义。
7
8
  * - [2026-03-09] Init: 从 Frame.svelte 抽离 DOM 透传过滤、disabled/aria 补齐、readonly capture、原生事件包装与 data-* 运行时属性组装。
8
9
  */
9
10
  import type { FrameProps } from "./frame-types";
@@ -93,7 +93,7 @@ export function createFrameDomRuntime(options) {
93
93
 
94
94
  function wrap(handler, internal) {
95
95
  return (e) => {
96
- if ($.get(filteredProps).disabled || options.frameState.currentState === "Disabled" || options.getEffectiveLoading()) {
96
+ if (!!options.getFrameProps().disabled || options.frameState.currentState === "Disabled" || options.getEffectiveLoading()) {
97
97
  e.preventDefault();
98
98
  e.stopPropagation();
99
99
 
@@ -24,6 +24,12 @@
24
24
  */
25
25
 
26
26
  :root {
27
+ /* OTPInput */
28
+ /* --snowui-otp-input-gap-override: ; */ /* default: var(--gap-2) */
29
+ /* --snowui-otp-input-size-override: ; */ /* default: var(--size-10) */
30
+ /* --snowui-otp-input-radius-override: ; */ /* default: var(--radius-3) */
31
+ /* --snowui-otp-input-font-size-override: ; */ /* default: var(--text-16) */
32
+ /* --snowui-otp-input-line-height-override: ; */ /* default: var(--leading-14) */
27
33
 
28
34
  /* ─────────────────────────────────────────
29
35
  Accordion
@@ -225,11 +225,11 @@
225
225
  transition: box-shadow 0.2s;
226
226
  }
227
227
 
228
- :where(.snowui-field-bordered:hover) {
228
+ :where(.snowui-field-bordered:hover, .snowui-field-bordered[data-field-hover="true"]) {
229
229
  box-shadow: inset 0 0 0 var(--snowui-field-border-width, 0.03125rem) var(--snowui-field-hover-border-color, var(--black-20, #00000033));
230
230
  }
231
231
 
232
- :where(.snowui-field-bordered:focus-within) {
232
+ :where(.snowui-field-bordered:focus-within, .snowui-field-bordered[data-field-focus="true"]) {
233
233
  box-shadow:
234
234
  inset 0 0 0 var(--snowui-field-border-width, 0.03125rem) var(--snowui-field-focus-border-color, var(--black-40, #00000066)),
235
235
  0 0 0 var(--snowui-field-focus-ring-width, 0.25rem) var(--snowui-field-focus-ring-color, var(--black-4, #0000000a));
@@ -761,3 +761,13 @@
761
761
  padding: var(--snowui-control-inset);
762
762
  box-sizing: border-box;
763
763
  }
764
+
765
+ /* Input and segmented fields share the same error text typography. */
766
+ :where(.snowui-field-error-message) {
767
+ width: 100%;
768
+ padding: 0;
769
+ color: var(--secondary-red, #ff4747ff);
770
+ font-size: var(--text-12);
771
+ line-height: var(--leading-12);
772
+ box-sizing: border-box;
773
+ }
@@ -50,7 +50,7 @@ export default function Sidebar($$renderer, $$props) {
50
50
  activeItemId = undefined,
51
51
  persistence = true,
52
52
  persistenceKey = "default",
53
- ariaLabel = "Primary navigation",
53
+ ariaLabel = undefined,
54
54
  continuousHover = true,
55
55
  onCollapsedChange = undefined,
56
56
  onWidthChange = undefined,
@@ -503,7 +503,7 @@ export default function Sidebar($$renderer, $$props) {
503
503
  iconOnly: true,
504
504
  size: 'sm',
505
505
  class: 'snowui-sidebar-collapse-button',
506
- 'aria-label': isCollapsed ? "Expand sidebar" : "Collapse sidebar",
506
+ 'aria-label': localeContext.t(isCollapsed ? "sidebar.expand" : "sidebar.collapse"),
507
507
  onclick: toggleCollapsed,
508
508
  children: ($$renderer) => {
509
509
  ComponentIcon($$renderer, { name: 'rightbar', 'aria-hidden': 'true' });
@@ -515,7 +515,7 @@ export default function Sidebar($$renderer, $$props) {
515
515
 
516
516
  ScrollArea($$renderer, {
517
517
  class: 'snowui-sidebar-body',
518
- ariaLabel,
518
+ ariaLabel: ariaLabel ?? localeContext.t("sidebar.navigation"),
519
519
  onscroll: syncBodyScrollMask,
520
520
  get viewport() {
521
521
  return bodyViewport;
@@ -527,7 +527,7 @@ export default function Sidebar($$renderer, $$props) {
527
527
  },
528
528
 
529
529
  children: ($$renderer) => {
530
- $$renderer.push(`<nav class="snowui-sidebar-navigation"${$.attr_style(CONTINUOUS_HOVER_MOTION_STYLE)}${$.attr('aria-label', ariaLabel)}><!--[-->`);
530
+ $$renderer.push(`<nav class="snowui-sidebar-navigation"${$.attr_style(CONTINUOUS_HOVER_MOTION_STYLE)}${$.attr('aria-label', ariaLabel ?? localeContext.t("sidebar.navigation"))}><!--[-->`);
531
531
 
532
532
  const each_array = $.ensure_array_like(sections);
533
533
 
@@ -627,7 +627,7 @@ export default function Sidebar($$renderer, $$props) {
627
627
  Button($$renderer, {
628
628
  iconOnly: true,
629
629
  size: 'sm',
630
- 'aria-label': 'Expand sidebar',
630
+ 'aria-label': localeContext.t("sidebar.expand"),
631
631
  onclick: toggleCollapsed,
632
632
  children: ($$renderer) => {
633
633
  ComponentIcon($$renderer, { name: 'rightbar', 'aria-hidden': 'true' });
@@ -2,6 +2,7 @@ import * as $ from 'svelte/internal/server';
2
2
  import { Badge, Button, Link, Tooltip } from "../index.js";
3
3
  import { ComponentIcon } from "../internal/component-icon/index.js";
4
4
  import Frame from "../components/Frame.js";
5
+ import { useLocale } from "../i18n/locale.js";
5
6
  import { getSidebarContext } from "./sidebar-context.js";
6
7
 
7
8
  const $$css = {
@@ -33,6 +34,7 @@ export default function SidebarItem($$renderer, $$props) {
33
34
  ...rest
34
35
  } = $$props;
35
36
 
37
+ const localeContext = useLocale();
36
38
  const sidebar = getSidebarContext();
37
39
  const collapsed = $.derived(() => sidebar?.collapsed ?? false);
38
40
  const active = $.derived(() => sidebar?.activeItemId === id);
@@ -93,7 +95,7 @@ export default function SidebarItem($$renderer, $$props) {
93
95
  as: 'badge',
94
96
  dot: true,
95
97
  class: 'snowui-sidebar-item-badge-collapsed',
96
- 'aria-label': 'Updated'
98
+ 'aria-label': localeContext.t("sidebarItem.updated")
97
99
  }
98
100
  ]));
99
101
  } else {
@@ -118,7 +120,7 @@ export default function SidebarItem($$renderer, $$props) {
118
120
  as: 'badge',
119
121
  dot: true,
120
122
  class: 'snowui-sidebar-item-badge',
121
- 'aria-label': 'Updated'
123
+ 'aria-label': localeContext.t("sidebarItem.updated")
122
124
  }
123
125
  ]));
124
126
  } else {
@@ -3,6 +3,7 @@ import { untrack } from "svelte";
3
3
  import { Button, Separator, Text, Tooltip } from "../index.js";
4
4
  import { ComponentIcon } from "../internal/component-icon/index.js";
5
5
  import Frame from "../components/Frame.js";
6
+ import { useLocale } from "../i18n/locale.js";
6
7
  import { getSidebarContext } from "./sidebar-context.js";
7
8
 
8
9
  const $$css = {
@@ -31,6 +32,7 @@ export default function SidebarSection($$renderer, $$props) {
31
32
  ...rest
32
33
  } = $$props;
33
34
 
35
+ const localeContext = useLocale();
34
36
  const sidebar = getSidebarContext();
35
37
  let internalCollapsed = untrack(() => defaultCollapsed);
36
38
  const persistedCollapsed = $.derived(() => sidebar?.getSectionCollapsed(id));
@@ -78,7 +80,7 @@ export default function SidebarSection($$renderer, $$props) {
78
80
  emphasis: parts?.Button?.emphasis ?? "muted",
79
81
  size: 'sm',
80
82
  class: 'snowui-sidebar-section-toggle',
81
- 'aria-label': isCollapsed() ? `Expand ${title}` : `Collapse ${title}`,
83
+ 'aria-label': localeContext.t(isCollapsed() ? "sidebarSection.expand" : "sidebarSection.collapse", { title }),
82
84
  'aria-expanded': !isCollapsed(),
83
85
  'aria-controls': contentId(),
84
86
  onclick: toggle,
@@ -1,4 +1,5 @@
1
1
  import * as $ from 'svelte/internal/server';
2
+ import { useLocale } from "../i18n/locale.js";
2
3
  import { AdaptiveContrastMask } from "../lib/adaptive-contrast-renderer.js";
3
4
  import { getAdaptiveContrastColor } from "../lib/adaptive-contrast.js";
4
5
  import { getContext, onDestroy, onMount, tick } from "svelte";
@@ -79,6 +80,8 @@ export default function BarChart($$renderer, $$props) {
79
80
  $$renderer.global.css.add($$css);
80
81
 
81
82
  $$renderer.component(($$renderer) => {
83
+ const localeContext = useLocale();
84
+
82
85
  // SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
83
86
  const DEFAULT_DATA = [
84
87
  { name: "Mon", value: 42 },
@@ -1434,7 +1437,7 @@ export default function BarChart($$renderer, $$props) {
1434
1437
  class: ["snowui-bar-chart", userClass].filter(Boolean).join(" "),
1435
1438
  style: rootStyle(),
1436
1439
  role: 'group',
1437
- 'aria-label': '柱状图'
1440
+ 'aria-label': localeContext.t("barChart.name")
1438
1441
  },
1439
1442
  rest,
1440
1443
  {
@@ -1698,7 +1701,7 @@ export default function BarChart($$renderer, $$props) {
1698
1701
 
1699
1702
  if (effectiveHoverMode() === "cell") {
1700
1703
  $$renderer.push('<!--[0-->');
1701
- $$renderer.push(`<g class="snowui-bar-chart-cell-hit-layer" role="group" aria-label="柱状图数据单元格"><!--[-->`);
1704
+ $$renderer.push(`<g class="snowui-bar-chart-cell-hit-layer" role="group"${$.attr('aria-label', localeContext.t("barChart.cells"))}><!--[-->`);
1702
1705
 
1703
1706
  const each_array_9 = $.ensure_array_like(categoryLabels());
1704
1707
 
@@ -1,4 +1,5 @@
1
1
  import * as $ from 'svelte/internal/server';
2
+ import { useLocale } from "../i18n/locale.js";
2
3
  import { setContext } from "svelte";
3
4
  import Frame from "./Frame.js";
4
5
  import Button from "./Button.js";
@@ -16,8 +17,10 @@ export default function Breadcrumb($$renderer, $$props) {
16
17
 
17
18
  $$renderer.component(($$renderer) => {
18
19
  // SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
20
+ const localeContext = useLocale();
21
+
19
22
  let {
20
- ariaLabel = "Breadcrumb",
23
+ ariaLabel = undefined,
21
24
  variant = "borderless",
22
25
  children,
23
26
  items = [],
@@ -230,7 +233,7 @@ export default function Breadcrumb($$renderer, $$props) {
230
233
  enableContext,
231
234
  enableScaleObserver,
232
235
  enableAutoLayout: false,
233
- 'aria-label': ariaLabel,
236
+ 'aria-label': ariaLabel ?? localeContext.t("breadcrumb.navigation"),
234
237
  class: ["snowui-breadcrumb", userClass].filter(Boolean).join(" "),
235
238
  use: finalUse(),
236
239
  componentParts: parts