@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.
- package/AGENTS.md +10 -0
- package/LICENSE +31 -14
- package/README.md +21 -3
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/component-catalog.json +26 -0
- package/dist/client/blocks/Sidebar.js +108 -95
- package/dist/client/blocks/SidebarItem.js +26 -12
- package/dist/client/blocks/SidebarSection.js +3 -1
- package/dist/client/blocks/index.js +1 -1
- package/dist/client/compat.js +1 -1
- package/dist/client/components/BarChart.js +9 -2
- package/dist/client/components/Breadcrumb.js +10 -6
- package/dist/client/components/ChartGroup.js +23 -10
- package/dist/client/components/CircularChart.js +8 -1
- package/dist/client/components/DataTable.d.ts +8 -2
- package/dist/client/components/DataTable.js +9 -3
- package/dist/client/components/GaugeChart.js +8 -1
- package/dist/client/components/Image.d.ts +2 -0
- package/dist/client/components/Image.js +14 -2
- package/dist/client/components/Input.js +2 -2
- package/dist/client/components/LineChart.js +9 -2
- package/dist/client/components/Listbox.js +43 -15
- package/dist/client/components/MenuItem.js +7 -1
- package/dist/client/components/OTPInput.d.ts +32 -0
- package/dist/client/components/OTPInput.js +556 -0
- package/dist/client/components/OverflowActions.d.ts +5 -1
- package/dist/client/components/OverflowActions.js +36 -11
- package/dist/client/components/Pagination.js +9 -8
- package/dist/client/components/ScrollArea.js +11 -5
- package/dist/client/components/SearchBox.js +12 -3
- package/dist/client/components/Select.js +3 -1
- package/dist/client/components/SidePanel.js +4 -3
- package/dist/client/components/Slider.js +7 -3
- package/dist/client/components/Spinner.js +9 -2
- package/dist/client/components/Table.js +14 -7
- package/dist/client/components/TableCell.js +33 -11
- package/dist/client/components/Tag.js +8 -1
- package/dist/client/context.js +1 -1
- package/dist/client/dev.js +1 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +55 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +3 -1
- package/dist/client/internal/code-block/prettier-svelte.d.ts +1 -1
- package/dist/client/internal/component-icon/index.js +1 -1
- package/dist/client/internal/snow-ui-logo/emoji-metrics.js +1 -1
- package/dist/client/keys.d.ts +1 -0
- package/dist/client/keys.js +2 -1
- package/dist/client/lib/adaptive-contrast-renderer.js +1 -1
- package/dist/client/lib/chart/appearance-timeline.js +1 -1
- package/dist/client/lib/chart/arc-path.js +1 -1
- package/dist/client/lib/chart/colors.js +1 -1
- package/dist/client/lib/chart/size.js +1 -1
- package/dist/client/lib/clipboard.js +1 -1
- package/dist/client/lib/color.js +1 -1
- package/dist/client/lib/date-format.js +1 -1
- package/dist/client/lib/edge-fade.js +1 -1
- package/dist/client/lib/media-loading.d.ts +7 -0
- package/dist/client/lib/media-loading.js +12 -0
- package/dist/client/lib/number-format.js +1 -1
- package/dist/client/lib/overflow-actions-motion.js +1 -1
- package/dist/client/lib/overlay-trigger-timing.js +1 -1
- package/dist/client/lib/responsive-exit.js +1 -1
- package/dist/client/lib/search-filter.js +1 -1
- package/dist/client/lib/side-panel.js +1 -1
- package/dist/client/lib/split-pane.js +1 -1
- package/dist/client/lib/table-column-motion.js +1 -1
- package/dist/client/lib/table-context.d.ts +5 -0
- package/dist/client/lib/table-context.js +4 -1
- package/dist/client/lib/table-responsive.d.ts +1 -1
- package/dist/client/lib/table-responsive.js +40 -8
- package/dist/client/lib/table-selection-fade.js +1 -1
- package/dist/client/lib/table-truncation.js +1 -1
- package/dist/client/lib/text-motion/animation.js +1 -1
- package/dist/client/lib/text-motion/character.js +1 -1
- package/dist/client/lib/text-motion/color.js +1 -1
- package/dist/client/lib/text-motion/layout.js +1 -1
- package/dist/client/lib/text-motion/preference.js +1 -1
- package/dist/client/lib/text-motion/sequence.js +1 -1
- package/dist/client/lib/text-motion/typography.js +1 -1
- package/dist/client/lib/tooltip-delay.js +1 -1
- package/dist/client/lib/tooltip-motion-dismiss.js +1 -1
- package/dist/client/lib/tooltip-pointer-speed.js +1 -1
- package/dist/client/lib/truncate.js +1 -1
- package/dist/client/logic/frame-field-control.js +1 -1
- package/dist/client/logic/frame-motion-defaults.js +1 -1
- package/dist/client/logic/frame-prop-filter.js +1 -1
- package/dist/client/logic/geometry-cache.js +1 -1
- package/dist/client/logic/layout-flip.js +1 -1
- package/dist/client/logic/morph.js +1 -1
- package/dist/client/logic/motion-engine.js +1 -1
- package/dist/client/logic/motion-orchestration.js +1 -1
- package/dist/client/logic/motion-types.js +1 -1
- package/dist/client/logic/overflow-actions.d.ts +8 -0
- package/dist/client/logic/overflow-actions.js +5 -0
- package/dist/client/logic/wc-adapter.js +1 -1
- package/dist/client/motion/bridge.js +1 -1
- package/dist/client/motion/content-crossfade.js +1 -1
- package/dist/client/motion/expand.js +1 -1
- package/dist/client/motion/fade-in.js +1 -1
- package/dist/client/motion/fade-out.js +1 -1
- package/dist/client/motion/morph.js +1 -1
- package/dist/client/motion/move.js +1 -1
- package/dist/client/motion/number.js +1 -1
- package/dist/client/motion/replace.js +1 -1
- package/dist/client/motion/rotate.css +1 -1
- package/dist/client/motion/rotate.js +1 -1
- package/dist/client/motion/scale-in.js +1 -1
- package/dist/client/motion/tokens.js +1 -1
- package/dist/client/motion/while-2xl.js +1 -1
- package/dist/client/motion/while-active.js +1 -1
- package/dist/client/motion/while-appear.js +1 -1
- package/dist/client/motion/while-click.js +1 -1
- package/dist/client/motion/while-collapsed.js +1 -1
- package/dist/client/motion/while-disabled.js +1 -1
- package/dist/client/motion/while-disappear.js +1 -1
- package/dist/client/motion/while-drag.js +1 -1
- package/dist/client/motion/while-editing.js +1 -1
- package/dist/client/motion/while-expanded.js +1 -1
- package/dist/client/motion/while-focus.js +1 -1
- package/dist/client/motion/while-hover.js +1 -1
- package/dist/client/motion/while-idle.js +1 -1
- package/dist/client/motion/while-key.js +1 -1
- package/dist/client/motion/while-lg.js +1 -1
- package/dist/client/motion/while-load.js +1 -1
- package/dist/client/motion/while-md.js +1 -1
- package/dist/client/motion/while-reload.js +1 -1
- package/dist/client/motion/while-scroll.js +1 -1
- package/dist/client/motion/while-sm.js +1 -1
- package/dist/client/motion/while-uploading.js +1 -1
- package/dist/client/motion/while-validating.js +1 -1
- package/dist/client/motion/while-xl.js +1 -1
- package/dist/client/motion/while-xs.js +1 -1
- package/dist/client/styles/auto-layout.css +1 -1
- package/dist/client/styles/backdrop.css +1 -1
- package/dist/client/styles/components.css +7 -1
- package/dist/client/styles/index.css +1 -1
- package/dist/client/styles/layout.css +13 -3
- package/dist/client/styles/scale.css +1 -1
- package/dist/client/styles/scrollbar.css +1 -1
- package/dist/client/styles/tokens.css +1 -1
- package/dist/client/vite-env.d.ts +1 -1
- package/dist/server/blocks/Sidebar.js +5 -5
- package/dist/server/blocks/SidebarItem.js +4 -2
- package/dist/server/blocks/SidebarSection.js +3 -1
- package/dist/server/blocks/index.js +1 -1
- package/dist/server/compat.js +1 -1
- package/dist/server/components/BarChart.js +5 -2
- package/dist/server/components/Breadcrumb.js +5 -2
- package/dist/server/components/ChartGroup.js +6 -3
- package/dist/server/components/CircularChart.js +4 -1
- package/dist/server/components/DataTable.d.ts +8 -2
- package/dist/server/components/DataTable.js +9 -3
- package/dist/server/components/GaugeChart.js +4 -1
- package/dist/server/components/Image.d.ts +2 -0
- package/dist/server/components/Image.js +11 -4
- package/dist/server/components/Input.js +2 -2
- package/dist/server/components/LineChart.js +5 -2
- package/dist/server/components/Listbox.js +32 -14
- package/dist/server/components/MenuItem.js +4 -1
- package/dist/server/components/OTPInput.d.ts +32 -0
- package/dist/server/components/OTPInput.js +401 -0
- package/dist/server/components/OverflowActions.d.ts +5 -1
- package/dist/server/components/OverflowActions.js +41 -18
- package/dist/server/components/Pagination.js +2 -2
- package/dist/server/components/ScrollArea.js +5 -2
- package/dist/server/components/SearchBox.js +9 -3
- package/dist/server/components/Select.js +3 -1
- package/dist/server/components/SidePanel.js +4 -3
- package/dist/server/components/Slider.js +7 -3
- package/dist/server/components/Spinner.js +4 -2
- package/dist/server/components/Table.js +8 -3
- package/dist/server/components/TableCell.js +31 -11
- package/dist/server/components/Tag.js +4 -1
- package/dist/server/context.js +1 -1
- package/dist/server/dev.js +1 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +55 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -1
- package/dist/server/internal/code-block/prettier-svelte.d.ts +1 -1
- package/dist/server/internal/component-icon/index.js +1 -1
- package/dist/server/internal/snow-ui-logo/emoji-metrics.js +1 -1
- package/dist/server/keys.d.ts +1 -0
- package/dist/server/keys.js +2 -1
- package/dist/server/lib/adaptive-contrast-renderer.js +1 -1
- package/dist/server/lib/chart/appearance-timeline.js +1 -1
- package/dist/server/lib/chart/arc-path.js +1 -1
- package/dist/server/lib/chart/colors.js +1 -1
- package/dist/server/lib/chart/size.js +1 -1
- package/dist/server/lib/clipboard.js +1 -1
- package/dist/server/lib/color.js +1 -1
- package/dist/server/lib/date-format.js +1 -1
- package/dist/server/lib/edge-fade.js +1 -1
- package/dist/server/lib/media-loading.d.ts +7 -0
- package/dist/server/lib/media-loading.js +12 -0
- package/dist/server/lib/number-format.js +1 -1
- package/dist/server/lib/overflow-actions-motion.js +1 -1
- package/dist/server/lib/overlay-trigger-timing.js +1 -1
- package/dist/server/lib/responsive-exit.js +1 -1
- package/dist/server/lib/search-filter.js +1 -1
- package/dist/server/lib/side-panel.js +1 -1
- package/dist/server/lib/split-pane.js +1 -1
- package/dist/server/lib/table-column-motion.js +1 -1
- package/dist/server/lib/table-context.d.ts +5 -0
- package/dist/server/lib/table-context.js +4 -1
- package/dist/server/lib/table-responsive.d.ts +1 -1
- package/dist/server/lib/table-responsive.js +40 -8
- package/dist/server/lib/table-selection-fade.js +1 -1
- package/dist/server/lib/table-truncation.js +1 -1
- package/dist/server/lib/text-motion/animation.js +1 -1
- package/dist/server/lib/text-motion/character.js +1 -1
- package/dist/server/lib/text-motion/color.js +1 -1
- package/dist/server/lib/text-motion/layout.js +1 -1
- package/dist/server/lib/text-motion/preference.js +1 -1
- package/dist/server/lib/text-motion/sequence.js +1 -1
- package/dist/server/lib/text-motion/typography.js +1 -1
- package/dist/server/lib/tooltip-delay.js +1 -1
- package/dist/server/lib/tooltip-motion-dismiss.js +1 -1
- package/dist/server/lib/tooltip-pointer-speed.js +1 -1
- package/dist/server/lib/truncate.js +1 -1
- package/dist/server/logic/frame-field-control.js +1 -1
- package/dist/server/logic/frame-motion-defaults.js +1 -1
- package/dist/server/logic/frame-prop-filter.js +1 -1
- package/dist/server/logic/geometry-cache.js +1 -1
- package/dist/server/logic/layout-flip.js +1 -1
- package/dist/server/logic/morph.js +1 -1
- package/dist/server/logic/motion-engine.js +1 -1
- package/dist/server/logic/motion-orchestration.js +1 -1
- package/dist/server/logic/motion-types.js +1 -1
- package/dist/server/logic/overflow-actions.d.ts +8 -0
- package/dist/server/logic/overflow-actions.js +5 -0
- package/dist/server/logic/wc-adapter.js +1 -1
- package/dist/server/motion/bridge.js +1 -1
- package/dist/server/motion/content-crossfade.js +1 -1
- package/dist/server/motion/expand.js +1 -1
- package/dist/server/motion/fade-in.js +1 -1
- package/dist/server/motion/fade-out.js +1 -1
- package/dist/server/motion/morph.js +1 -1
- package/dist/server/motion/move.js +1 -1
- package/dist/server/motion/number.js +1 -1
- package/dist/server/motion/replace.js +1 -1
- package/dist/server/motion/rotate.css +1 -1
- package/dist/server/motion/rotate.js +1 -1
- package/dist/server/motion/scale-in.js +1 -1
- package/dist/server/motion/tokens.js +1 -1
- package/dist/server/motion/while-2xl.js +1 -1
- package/dist/server/motion/while-active.js +1 -1
- package/dist/server/motion/while-appear.js +1 -1
- package/dist/server/motion/while-click.js +1 -1
- package/dist/server/motion/while-collapsed.js +1 -1
- package/dist/server/motion/while-disabled.js +1 -1
- package/dist/server/motion/while-disappear.js +1 -1
- package/dist/server/motion/while-drag.js +1 -1
- package/dist/server/motion/while-editing.js +1 -1
- package/dist/server/motion/while-expanded.js +1 -1
- package/dist/server/motion/while-focus.js +1 -1
- package/dist/server/motion/while-hover.js +1 -1
- package/dist/server/motion/while-idle.js +1 -1
- package/dist/server/motion/while-key.js +1 -1
- package/dist/server/motion/while-lg.js +1 -1
- package/dist/server/motion/while-load.js +1 -1
- package/dist/server/motion/while-md.js +1 -1
- package/dist/server/motion/while-reload.js +1 -1
- package/dist/server/motion/while-scroll.js +1 -1
- package/dist/server/motion/while-sm.js +1 -1
- package/dist/server/motion/while-uploading.js +1 -1
- package/dist/server/motion/while-validating.js +1 -1
- package/dist/server/motion/while-xl.js +1 -1
- package/dist/server/motion/while-xs.js +1 -1
- package/dist/server/styles/auto-layout.css +1 -1
- package/dist/server/styles/backdrop.css +1 -1
- package/dist/server/styles/components.css +7 -1
- package/dist/server/styles/index.css +1 -1
- package/dist/server/styles/layout.css +13 -3
- package/dist/server/styles/scale.css +1 -1
- package/dist/server/styles/scrollbar.css +1 -1
- package/dist/server/styles/tokens.css +1 -1
- package/dist/server/vite-env.d.ts +1 -1
- package/llms.txt +3 -0
- 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
|
-
|
|
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' });
|
package/dist/client/context.js
CHANGED
package/dist/client/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* SnowUI source notice | LICENSE 2.
|
|
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.
|
|
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",
|
package/dist/client/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
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.
|
|
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,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
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';
|
package/dist/client/keys.d.ts
CHANGED
|
@@ -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;
|
package/dist/client/keys.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* SnowUI source notice | LICENSE 2.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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";
|
package/dist/client/lib/color.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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: () => "
|
|
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.
|
|
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
|
|
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) !==
|
|
170
|
-
table.style.setProperty(paddingProperty,
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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") {
|