@snowui-design-system/components 0.3.0-alpha.4 → 0.3.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +8 -0
- package/README.md +2 -0
- package/dist/client/components/Frame.js +9 -7
- package/dist/client/components/Select.js +15 -5
- package/dist/client/components/Table.js +13 -7
- package/dist/client/components/TableHead.js +3 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +6 -0
- package/dist/client/logic/frame-dom-runtime.d.ts +2 -1
- package/dist/client/logic/frame-dom-runtime.js +1 -1
- package/dist/server/components/Frame.js +9 -7
- package/dist/server/components/Select.js +15 -5
- package/dist/server/components/Table.js +5 -1
- package/dist/server/components/TableHead.js +4 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +6 -0
- package/dist/server/logic/frame-dom-runtime.d.ts +2 -1
- package/dist/server/logic/frame-dom-runtime.js +1 -1
- package/package.json +4 -3
package/AGENTS.md
CHANGED
|
@@ -19,3 +19,11 @@ Figma Make、Lovable 或本地 AI 均按实际使用者及独立产品计数,
|
|
|
19
19
|
可选 `.snowui/usage.json` 随同一产品迁移,保留稳定编号及事实声明;独立产品另编号,换账号或删除文件不重置额度。没有声明文件仍可人工按 LICENSE 核对,免费使用不强制工具、公钥或注册。不要在本包内保存消费者声明、账户秘密或许可。
|
|
20
20
|
|
|
21
21
|
同任务、同许可、同用途与同目标复用阅读及检查,不逐组件重复;用途/人数改变和每次发布或交付重新核对。匿名结论只能写“依据声明符合 Free,未验证全局额度”;不能写成中心签名 pass。可执行工具需确认其来源与可用性;宿主无法运行时如实记录人工核对,不能伪造执行记录。当前并未接管任何在线平台发布按钮,指令文件也不保证平台自动读取。
|
|
22
|
+
|
|
23
|
+
## 工具读取与用户知情
|
|
24
|
+
|
|
25
|
+
先确认本入口、目标版本完整 LICENSE 和组件来源确实已被当前 AI 宿主读取。若宿主只支持公开 HTTPS,可请使用者提供相应文档链接;复制过的 Prompt 不会随许可、账户权益或用途变化自动更新。先核对宿主的项目框架和实际文件/命令能力;本包面向 Svelte 5,允许项目内移植不表示已提供其他框架的现成运行包。
|
|
26
|
+
|
|
27
|
+
官方工作区已有可选匿名 Free 检查及付费上线复核的本地工具候选,但工具及依赖**不包含在此 npm 包或源码归档中,正式核验服务亦未启用**。不能从本入口推断可执行命令或官方服务地址。只有用户提供并同意使用已核对来源的工具,且宿主确实能运行时,才先读工具随附说明、告知将读取的项目范围、写入位置与会话保留位置,再执行并向用户报告实际结果、目标和记录位置。Free 范围内不以工具可用为前提;不能运行时按 LICENSE 人工核对,写明“人工复核,未运行工具”。
|
|
28
|
+
|
|
29
|
+
以后工具可用时,匿名声明只基于使用者确认的用途、人数和全部活跃实际产品等事实;它不是中心配额证明。工具返回 `unknown` 或证据缺失时说明待核对,不推断用户未购买;`declared-free` 只代表声明下的 Free 判断,`pass` 只适用于实际核验的主体、产品、目标和有效期。用户未同意时不保存额外 AI 记忆;不要把许可文件、激活码、会话或完整回执粘贴进聊天、公开仓库或在线提示词。
|
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
公开 npm 与源码后续版本均可持续免费获取,已购项目和席位权益持续有效;订单列明的 Figma 资源及其后续更新永久有效,不设领取期限。AI 已确认缺少权益时,按完整 LICENSE 的官方入口与提醒条款说明缺口和最低适用方案;资料不明先核对,普通购买不能解除所有方案均禁止的用途。正式入口尚未配置时说明事实,不编造链接。Free 范围内只需阅读并遵守 LICENSE,不要求公钥、账户、签名许可、激活码或中心登记。AI 阅读入口为 [AGENTS.md](./AGENTS.md) 与 [llms.txt](./llms.txt),两者均指向本包完整许可,不替代正文。付费签名许可文件与可选免费登记机制见 LICENSE 第 7.3 条;服务尚未上线,不要求使用者访问不存在的入口。方案采用消费者项目根的许可文件与稳定产品 ID,不向 node_modules 写付费标记;组件运行不依赖 key 或联网验证。
|
|
14
14
|
|
|
15
|
+
AI 或使用者采用组件时,先核对目标版本的完整许可,再按实际用途、独立产品、开发者人数和预览/发布受众判断范围;同任务同版本同范围的阅读可复用。在线工具若只能读取公开 HTTPS,应由使用者显式提供适用许可与 [AI 使用入口](./AGENTS.md),并确认工具实际读取了什么。可选的匿名 Free 检查及付费上线复核工具目前只有官方工作区的本地候选实现,**不随此 npm 包或源码归档交付,也未作为正式服务启用**。宿主没有可信工具时可按许可人工核对,并明确记录“未运行工具”;不要把安装成功、AI 记忆或人工声明写成中心签名核验通过。
|
|
16
|
+
|
|
15
17
|
npm 继续交付预编译运行包:`dist/client`、`dist/server`、公开类型与样式;原始源码通过独立版本归档交付。免费源码准备、实际公开下载和运行包发布是不同状态,不能以本地文件推定远端已更新。交付规则在 SnowUI 工作区 [商业策略](../specs/commercial/CommercialStrategy.md) 维护;单独下载或安装本包的用户以随版本交付的完整 LICENSE 为准,历史版本权利不追溯变更。
|
|
16
18
|
|
|
17
19
|
## 单独复制组件与许可保留
|
|
@@ -111,19 +111,21 @@ export default function Frame($$anchor, $$props) {
|
|
|
111
111
|
// === 6. 感知 (Perception) ===
|
|
112
112
|
// 根据开关决定是否提供 Context
|
|
113
113
|
// svelte-ignore state_referenced_locally
|
|
114
|
-
const inheritedLoading = $.derived(() => parentSkeletonContext?.loading ?? false);
|
|
115
|
-
|
|
116
114
|
const inheritedSkeleton = $.derived(() => parentSkeletonContext?.skeleton ?? true);
|
|
117
|
-
|
|
115
|
+
|
|
118
116
|
const explicitSkeleton = $.derived(() => $.get(frameProps).skeleton);
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
|
|
118
|
+
function resolveEffectiveLoading() {
|
|
119
|
+
return (parentSkeletonContext?.loading ?? false) || $$props.loading === true || frameState.currentState === "StartLoad" || frameState.currentState === "Load";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const effectiveLoading = $.derived(resolveEffectiveLoading);
|
|
121
123
|
const effectiveSkeleton = $.derived(() => $.get(explicitSkeleton) ?? $.get(inheritedSkeleton));
|
|
122
124
|
|
|
123
125
|
// svelte-ignore state_referenced_locally
|
|
124
126
|
if ($.get(enableContext)) {
|
|
125
127
|
// svelte-ignore state_referenced_locally
|
|
126
|
-
new FramePerception($.get(frameProps), frameState, layout, responsive,
|
|
128
|
+
new FramePerception($.get(frameProps), frameState, layout, responsive, resolveEffectiveLoading, () => $.get(effectiveSkeleton));
|
|
127
129
|
|
|
128
130
|
// 提供尺寸上下文给子组件(如资源组件选择正确分辨率)
|
|
129
131
|
// svelte-ignore state_referenced_locally
|
|
@@ -232,7 +234,7 @@ export default function Frame($$anchor, $$props) {
|
|
|
232
234
|
const domRuntime = createFrameDomRuntime({
|
|
233
235
|
getFrameProps: () => $.get(frameProps),
|
|
234
236
|
frameState,
|
|
235
|
-
getEffectiveLoading:
|
|
237
|
+
getEffectiveLoading: resolveEffectiveLoading,
|
|
236
238
|
getHasScaleApplyConfig: () => $.get(hasScaleApplyConfig)
|
|
237
239
|
});
|
|
238
240
|
|
|
@@ -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(
|
|
179
|
+
if (!$.get(filterText)) return $.get(availableOptions);
|
|
170
180
|
|
|
171
|
-
return $.get(
|
|
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(
|
|
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
|
|
|
@@ -299,7 +309,7 @@ export default function Select($$anchor, $$props) {
|
|
|
299
309
|
if (!trimmed) return;
|
|
300
310
|
|
|
301
311
|
// 不与已有静态项或自定义项重复
|
|
302
|
-
if ($.get(
|
|
312
|
+
if ($.get(availableOptions).some((o) => o.value === trimmed)) return;
|
|
303
313
|
|
|
304
314
|
if ($.get(customOptions).some((o) => o.value === trimmed)) return;
|
|
305
315
|
|
|
@@ -334,7 +344,7 @@ export default function Select($$anchor, $$props) {
|
|
|
334
344
|
|
|
335
345
|
// 打开 Listbox
|
|
336
346
|
function openListbox() {
|
|
337
|
-
const allOptions = [...$.get(
|
|
347
|
+
const allOptions = [...$.get(availableOptions), ...$.get(customOptions)];
|
|
338
348
|
const idx = allOptions.findIndex((o) => o.value === $.get(resolvedValueStr));
|
|
339
349
|
|
|
340
350
|
$.set(activeIndex, idx >= 0 ? idx : 0, true);
|
|
@@ -6,6 +6,7 @@ import { getTableContext, provideTableContext } from "../lib/table-context.js";
|
|
|
6
6
|
import { useOverlayScrollbar } from "../lib/overlay-scrollbar.js";
|
|
7
7
|
import { TableTruncationManager } from "../lib/table-truncation.js";
|
|
8
8
|
import { observeTableResponsive } from "../lib/table-responsive.js";
|
|
9
|
+
import { useLocale } from "../i18n/locale.js";
|
|
9
10
|
|
|
10
11
|
var rest_excludes = new Set([
|
|
11
12
|
'$$slots',
|
|
@@ -62,6 +63,7 @@ export default function Table($$anchor, $$props) {
|
|
|
62
63
|
let autoLockedColumnWidths = $.state($.proxy({}));
|
|
63
64
|
let hasAutoLockedColumnWidths = $.state(false);
|
|
64
65
|
const parentTable = getTableContext();
|
|
66
|
+
const localeContext = useLocale();
|
|
65
67
|
let measuredActionsWidth = $.state(0);
|
|
66
68
|
let resolvedRoleLayout = $.state("overlay");
|
|
67
69
|
const requestedRoleLayout = $.derived(() => roleLayout() ?? parentTable.getRoleLayout());
|
|
@@ -347,13 +349,17 @@ export default function Table($$anchor, $$props) {
|
|
|
347
349
|
$.reset(div_1);
|
|
348
350
|
$.bind_this(div_1, ($$value) => $.set(horizontalTrackElement, $$value), () => $.get(horizontalTrackElement));
|
|
349
351
|
|
|
350
|
-
$.template_effect(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
352
|
+
$.template_effect(
|
|
353
|
+
($0) => {
|
|
354
|
+
$.set_attribute(div, 'aria-label', $0);
|
|
355
|
+
$.set_attribute(div_1, 'data-visible', horizontalScrollbar.hasOverflow ? "true" : undefined);
|
|
356
|
+
},
|
|
357
|
+
[
|
|
358
|
+
() => ariaLabel()
|
|
359
|
+
? localeContext.t("table.scrollRegionNamed", { name: ariaLabel() })
|
|
360
|
+
: localeContext.t("table.scrollRegion")
|
|
361
|
+
]
|
|
362
|
+
);
|
|
357
363
|
|
|
358
364
|
$.append($$anchor, fragment_1);
|
|
359
365
|
},
|
|
@@ -533,7 +533,9 @@ export default function TableHead($$anchor, $$props) {
|
|
|
533
533
|
{
|
|
534
534
|
var consequent_11 = ($$anchor) => {
|
|
535
535
|
{
|
|
536
|
-
let $0 = $.derived(() =>
|
|
536
|
+
let $0 = $.derived(() => label()?.trim()
|
|
537
|
+
? localeContext.t("tableHead.resizeColumn", { column: label() })
|
|
538
|
+
: localeContext.t("tableHead.resizeColumnGeneric"));
|
|
537
539
|
|
|
538
540
|
Indicator($$anchor, {
|
|
539
541
|
class: 'snowui-table-head-indicator',
|
|
@@ -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" | "tableHead.selectAll" | "tableHead.resizeColumn" | "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" | "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";
|
|
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>>;
|
|
@@ -38,8 +38,11 @@ export const SNOWUI_MESSAGES = {
|
|
|
38
38
|
"imageViewer.next": "下一张",
|
|
39
39
|
"imageViewer.close": "关闭图片预览",
|
|
40
40
|
"toast.close": "关闭通知",
|
|
41
|
+
"table.scrollRegion": "可横向滚动的表格",
|
|
42
|
+
"table.scrollRegionNamed": "{{name}},可横向滚动",
|
|
41
43
|
"tableHead.selectAll": "选择全部当前行",
|
|
42
44
|
"tableHead.resizeColumn": "调整 {{column}} 列宽",
|
|
45
|
+
"tableHead.resizeColumnGeneric": "调整列宽",
|
|
43
46
|
"tableCell.selectRow": "选择当前行",
|
|
44
47
|
"text.expand": "展开",
|
|
45
48
|
"textarea.resize": "调整文本域大小",
|
|
@@ -111,8 +114,11 @@ export const SNOWUI_MESSAGES = {
|
|
|
111
114
|
"imageViewer.next": "Next image",
|
|
112
115
|
"imageViewer.close": "Close image viewer",
|
|
113
116
|
"toast.close": "Close notification",
|
|
117
|
+
"table.scrollRegion": "Scrollable table",
|
|
118
|
+
"table.scrollRegionNamed": "{{name}}, horizontally scrollable",
|
|
114
119
|
"tableHead.selectAll": "Select all current rows",
|
|
115
120
|
"tableHead.resizeColumn": "Resize {{column}} column",
|
|
121
|
+
"tableHead.resizeColumnGeneric": "Resize column width",
|
|
116
122
|
"tableCell.selectRow": "Select current row",
|
|
117
123
|
"text.expand": "Expand",
|
|
118
124
|
"textarea.resize": "Resize text area",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* frame-dom-runtime.svelte.ts
|
|
3
|
-
* v1.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 (
|
|
96
|
+
if (!!options.getFrameProps().disabled || options.frameState.currentState === "Disabled" || options.getEffectiveLoading()) {
|
|
97
97
|
e.preventDefault();
|
|
98
98
|
e.stopPropagation();
|
|
99
99
|
|
|
@@ -97,19 +97,21 @@ export default function Frame($$renderer, $$props) {
|
|
|
97
97
|
// === 6. 感知 (Perception) ===
|
|
98
98
|
// 根据开关决定是否提供 Context
|
|
99
99
|
// svelte-ignore state_referenced_locally
|
|
100
|
-
const inheritedLoading = $.derived(() => parentSkeletonContext?.loading ?? false);
|
|
101
|
-
|
|
102
100
|
const inheritedSkeleton = $.derived(() => parentSkeletonContext?.skeleton ?? true);
|
|
103
|
-
|
|
101
|
+
|
|
104
102
|
const explicitSkeleton = $.derived(() => frameProps().skeleton);
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
|
|
104
|
+
function resolveEffectiveLoading() {
|
|
105
|
+
return (parentSkeletonContext?.loading ?? false) || rawProps.loading === true || frameState.currentState === "StartLoad" || frameState.currentState === "Load";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const effectiveLoading = $.derived(resolveEffectiveLoading);
|
|
107
109
|
const effectiveSkeleton = $.derived(() => explicitSkeleton() ?? inheritedSkeleton());
|
|
108
110
|
|
|
109
111
|
// svelte-ignore state_referenced_locally
|
|
110
112
|
if (enableContext()) {
|
|
111
113
|
// svelte-ignore state_referenced_locally
|
|
112
|
-
new FramePerception(frameProps(), frameState, layout, responsive,
|
|
114
|
+
new FramePerception(frameProps(), frameState, layout, responsive, resolveEffectiveLoading, () => effectiveSkeleton());
|
|
113
115
|
|
|
114
116
|
// 提供尺寸上下文给子组件(如资源组件选择正确分辨率)
|
|
115
117
|
// svelte-ignore state_referenced_locally
|
|
@@ -192,7 +194,7 @@ export default function Frame($$renderer, $$props) {
|
|
|
192
194
|
const domRuntime = createFrameDomRuntime({
|
|
193
195
|
getFrameProps: () => frameProps(),
|
|
194
196
|
frameState,
|
|
195
|
-
getEffectiveLoading:
|
|
197
|
+
getEffectiveLoading: resolveEffectiveLoading,
|
|
196
198
|
getHasScaleApplyConfig: () => hasScaleApplyConfig()
|
|
197
199
|
});
|
|
198
200
|
|
|
@@ -147,6 +147,16 @@ export default function Select($$renderer, $$props) {
|
|
|
147
147
|
// 通过 MenuItem 注册收集的选项
|
|
148
148
|
let registeredOptions = [];
|
|
149
149
|
|
|
150
|
+
// options 模式以调用方当前数据为准;MenuItem 的注册只发生在挂载时,
|
|
151
|
+
// 同一 value 的标签随语言或业务状态更新时不能继续使用旧注册快照。
|
|
152
|
+
const availableOptions = $.derived(() => children()
|
|
153
|
+
? registeredOptions
|
|
154
|
+
: options().map((option) => ({
|
|
155
|
+
value: option.value,
|
|
156
|
+
label: option.label,
|
|
157
|
+
disabled: option.disabled ?? false
|
|
158
|
+
})));
|
|
159
|
+
|
|
150
160
|
// 搜索过滤状态
|
|
151
161
|
let filterText = "";
|
|
152
162
|
|
|
@@ -159,15 +169,15 @@ export default function Select($$renderer, $$props) {
|
|
|
159
169
|
// 自定义项始终显示(不参与过滤,由 MenuItem 自身判断)
|
|
160
170
|
// 匹配策略由 src/lib/search-filter.ts 的 matchesSearch 统一处理
|
|
161
171
|
const filteredOptions = $.derived(() => {
|
|
162
|
-
if (!filterText) return
|
|
172
|
+
if (!filterText) return availableOptions();
|
|
163
173
|
|
|
164
|
-
return
|
|
174
|
+
return availableOptions().filter((o) => matchesSearch(o.label, filterText));
|
|
165
175
|
});
|
|
166
176
|
|
|
167
177
|
// 派生显示值
|
|
168
178
|
const hasValue = $.derived(() => resolvedValueStr() !== undefined && resolvedValueStr() !== "");
|
|
169
179
|
|
|
170
|
-
const selectedOption = $.derived(() =>
|
|
180
|
+
const selectedOption = $.derived(() => availableOptions().find((o) => o.value === resolvedValueStr()) ?? customOptions.find((o) => o.value === resolvedValueStr()));
|
|
171
181
|
const selectedLabel = $.derived(() => selectedOption()?.label ?? (hasValue() ? resolvedValueStr() : undefined));
|
|
172
182
|
const isPlaceholderVisible = $.derived(() => !hasValue());
|
|
173
183
|
|
|
@@ -260,7 +270,7 @@ export default function Select($$renderer, $$props) {
|
|
|
260
270
|
if (!trimmed) return;
|
|
261
271
|
|
|
262
272
|
// 不与已有静态项或自定义项重复
|
|
263
|
-
if (
|
|
273
|
+
if (availableOptions().some((o) => o.value === trimmed)) return;
|
|
264
274
|
|
|
265
275
|
if (customOptions.some((o) => o.value === trimmed)) return;
|
|
266
276
|
|
|
@@ -285,7 +295,7 @@ export default function Select($$renderer, $$props) {
|
|
|
285
295
|
// 关闭时清空搜索文本
|
|
286
296
|
// 打开 Listbox
|
|
287
297
|
function openListbox() {
|
|
288
|
-
const allOptions = [...
|
|
298
|
+
const allOptions = [...availableOptions(), ...customOptions];
|
|
289
299
|
const idx = allOptions.findIndex((o) => o.value === resolvedValueStr());
|
|
290
300
|
|
|
291
301
|
activeIndex = idx >= 0 ? idx : 0;
|
|
@@ -5,6 +5,7 @@ import { getTableContext, provideTableContext } from "../lib/table-context.js";
|
|
|
5
5
|
import { useOverlayScrollbar } from "../lib/overlay-scrollbar.js";
|
|
6
6
|
import { TableTruncationManager } from "../lib/table-truncation.js";
|
|
7
7
|
import { observeTableResponsive } from "../lib/table-responsive.js";
|
|
8
|
+
import { useLocale } from "../i18n/locale.js";
|
|
8
9
|
|
|
9
10
|
const $$css = {
|
|
10
11
|
hash: 'svelte-qusz4c',
|
|
@@ -46,6 +47,7 @@ export default function Table($$renderer, $$props) {
|
|
|
46
47
|
let autoLockedColumnWidths = {};
|
|
47
48
|
let hasAutoLockedColumnWidths = false;
|
|
48
49
|
const parentTable = getTableContext();
|
|
50
|
+
const localeContext = useLocale();
|
|
49
51
|
let measuredActionsWidth = 0;
|
|
50
52
|
let resolvedRoleLayout = "overlay";
|
|
51
53
|
const requestedRoleLayout = $.derived(() => roleLayout ?? parentTable.getRoleLayout());
|
|
@@ -176,7 +178,9 @@ export default function Table($$renderer, $$props) {
|
|
|
176
178
|
rest,
|
|
177
179
|
{
|
|
178
180
|
children: ($$renderer) => {
|
|
179
|
-
$$renderer.push(`<div class="snowui-table-scroll-viewport snowui-overlay-scrollbar-viewport" data-scroll-axis="horizontal" role="region"${$.attr('aria-label', ariaLabel
|
|
181
|
+
$$renderer.push(`<div class="snowui-table-scroll-viewport snowui-overlay-scrollbar-viewport" data-scroll-axis="horizontal" role="region"${$.attr('aria-label', ariaLabel
|
|
182
|
+
? localeContext.t("table.scrollRegionNamed", { name: ariaLabel })
|
|
183
|
+
: localeContext.t("table.scrollRegion"))} tabindex="0">`);
|
|
180
184
|
|
|
181
185
|
Frame($$renderer, {
|
|
182
186
|
tag: 'table',
|
|
@@ -355,7 +355,10 @@ export default function TableHead($$renderer, $$props) {
|
|
|
355
355
|
event.stopPropagation();
|
|
356
356
|
table.fitColumnWidth(resolvedColumnId(), resolvedMinWidth(), resolvedMaxWidth());
|
|
357
357
|
},
|
|
358
|
-
|
|
358
|
+
|
|
359
|
+
ariaLabel: label?.trim()
|
|
360
|
+
? localeContext.t("tableHead.resizeColumn", { column: label })
|
|
361
|
+
: localeContext.t("tableHead.resizeColumnGeneric"),
|
|
359
362
|
onSizeChange: (next) => table.setColumnWidth(resolvedColumnId(), next)
|
|
360
363
|
});
|
|
361
364
|
} else {
|
|
@@ -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" | "tableHead.selectAll" | "tableHead.resizeColumn" | "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" | "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";
|
|
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>>;
|
|
@@ -38,8 +38,11 @@ export const SNOWUI_MESSAGES = {
|
|
|
38
38
|
"imageViewer.next": "下一张",
|
|
39
39
|
"imageViewer.close": "关闭图片预览",
|
|
40
40
|
"toast.close": "关闭通知",
|
|
41
|
+
"table.scrollRegion": "可横向滚动的表格",
|
|
42
|
+
"table.scrollRegionNamed": "{{name}},可横向滚动",
|
|
41
43
|
"tableHead.selectAll": "选择全部当前行",
|
|
42
44
|
"tableHead.resizeColumn": "调整 {{column}} 列宽",
|
|
45
|
+
"tableHead.resizeColumnGeneric": "调整列宽",
|
|
43
46
|
"tableCell.selectRow": "选择当前行",
|
|
44
47
|
"text.expand": "展开",
|
|
45
48
|
"textarea.resize": "调整文本域大小",
|
|
@@ -111,8 +114,11 @@ export const SNOWUI_MESSAGES = {
|
|
|
111
114
|
"imageViewer.next": "Next image",
|
|
112
115
|
"imageViewer.close": "Close image viewer",
|
|
113
116
|
"toast.close": "Close notification",
|
|
117
|
+
"table.scrollRegion": "Scrollable table",
|
|
118
|
+
"table.scrollRegionNamed": "{{name}}, horizontally scrollable",
|
|
114
119
|
"tableHead.selectAll": "Select all current rows",
|
|
115
120
|
"tableHead.resizeColumn": "Resize {{column}} column",
|
|
121
|
+
"tableHead.resizeColumnGeneric": "Resize column width",
|
|
116
122
|
"tableCell.selectRow": "Select current row",
|
|
117
123
|
"text.expand": "Expand",
|
|
118
124
|
"textarea.resize": "Resize text area",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* frame-dom-runtime.svelte.ts
|
|
3
|
-
* v1.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 (
|
|
96
|
+
if (!!options.getFrameProps().disabled || options.frameState.currentState === "Disabled" || options.getEffectiveLoading()) {
|
|
97
97
|
e.preventDefault();
|
|
98
98
|
e.stopPropagation();
|
|
99
99
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "SEE LICENSE IN LICENSE",
|
|
3
3
|
"name": "@snowui-design-system/components",
|
|
4
|
-
"version": "0.3.0-alpha.
|
|
4
|
+
"version": "0.3.0-alpha.6",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"catalog:generate": "node scripts/generate-component-catalog.mjs",
|
|
129
129
|
"catalog:check": "node scripts/generate-component-catalog.mjs --check",
|
|
130
130
|
"verify:styles": "node scripts/verify-styles.mjs",
|
|
131
|
-
"check": "pnpm test:number-format && svelte-check --workspace .",
|
|
131
|
+
"check": "pnpm test:number-format && pnpm test:table-accessible-names && svelte-check --workspace .",
|
|
132
132
|
"pack:check": "node scripts/check-runtime-package.mjs",
|
|
133
133
|
"source:archive": "node scripts/archive-source.mjs",
|
|
134
134
|
"test:runtime": "node scripts/test-runtime-consumer.mjs",
|
|
@@ -136,6 +136,7 @@
|
|
|
136
136
|
"source:notice:sync": "node scripts/source-notices.mjs --write",
|
|
137
137
|
"source:copy": "node scripts/copy-source.mjs",
|
|
138
138
|
"source:test": "node --test scripts/source-retention.test.mjs",
|
|
139
|
-
"test:number-format": "node --test scripts/number-format.test.mjs"
|
|
139
|
+
"test:number-format": "node --test scripts/number-format.test.mjs",
|
|
140
|
+
"test:table-accessible-names": "node --test scripts/table-accessible-names.test.mjs"
|
|
140
141
|
}
|
|
141
142
|
}
|