@snowui-design-system/components 0.3.0-alpha.7 → 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 +2 -0
- package/LICENSE +31 -14
- package/README.md +2 -0
- package/dist/client/blocks/index.js +1 -1
- package/dist/client/compat.js +1 -1
- package/dist/client/components/DataTable.d.ts +8 -2
- package/dist/client/components/DataTable.js +9 -3
- package/dist/client/components/OverflowActions.d.ts +5 -1
- package/dist/client/components/OverflowActions.js +36 -11
- package/dist/client/components/Table.js +14 -7
- package/dist/client/components/TableCell.js +33 -11
- package/dist/client/context.js +1 -1
- package/dist/client/dev.js +1 -1
- package/dist/client/i18n/messages.js +1 -1
- package/dist/client/index.js +1 -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.js +1 -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.js +1 -1
- 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 +1 -1
- package/dist/client/styles/index.css +1 -1
- package/dist/client/styles/layout.css +1 -1
- 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/index.js +1 -1
- package/dist/server/compat.js +1 -1
- package/dist/server/components/DataTable.d.ts +8 -2
- package/dist/server/components/DataTable.js +9 -3
- package/dist/server/components/OverflowActions.d.ts +5 -1
- package/dist/server/components/OverflowActions.js +41 -18
- package/dist/server/components/Table.js +8 -3
- package/dist/server/components/TableCell.js +31 -11
- package/dist/server/context.js +1 -1
- package/dist/server/dev.js +1 -1
- package/dist/server/i18n/messages.js +1 -1
- package/dist/server/index.js +1 -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.js +1 -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.js +1 -1
- 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 +1 -1
- package/dist/server/styles/index.css +1 -1
- package/dist/server/styles/layout.css +1 -1
- 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 +2 -0
- package/package.json +1 -1
|
@@ -22,4 +22,12 @@ export interface OverflowActionsContext {
|
|
|
22
22
|
buttonProps?: Record<string, any>;
|
|
23
23
|
}
|
|
24
24
|
export declare const OVERFLOW_ACTIONS_CONTEXT_KEY: unique symbol;
|
|
25
|
+
/** 宿主只提供布局约束,不接管显式子项的按钮视觉。 */
|
|
26
|
+
export interface OverflowActionsLayoutContext {
|
|
27
|
+
readonly availableWidth: number | undefined;
|
|
28
|
+
readonly maxVisible: number | undefined;
|
|
29
|
+
readonly overflow: "all" | "progressive" | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare const OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY: unique symbol;
|
|
32
|
+
export declare function getOverflowActionsLayoutContext(): OverflowActionsLayoutContext | undefined;
|
|
25
33
|
export declare function getOverflowActionsContext(): OverflowActionsContext | undefined;
|
|
@@ -3,6 +3,11 @@ import * as $ from 'svelte/internal/client';
|
|
|
3
3
|
import { getContext } from "svelte";
|
|
4
4
|
|
|
5
5
|
export const OVERFLOW_ACTIONS_CONTEXT_KEY = Symbol("snowui-overflow-actions");
|
|
6
|
+
export const OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY = Symbol("snowui-overflow-actions-layout");
|
|
7
|
+
|
|
8
|
+
export function getOverflowActionsLayoutContext() {
|
|
9
|
+
return getContext(OVERFLOW_ACTIONS_LAYOUT_CONTEXT_KEY);
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
export function getOverflowActionsContext() {
|
|
8
13
|
return getContext(OVERFLOW_ACTIONS_CONTEXT_KEY);
|
|
@@ -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 Sidebar, } from "./Sidebar.js";
|
package/dist/server/compat.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type Snippet } from "svelte";
|
|
1
|
+
import { type Snippet, type ComponentProps } from "svelte";
|
|
2
|
+
import type OverflowActions from "./OverflowActions.js";
|
|
3
|
+
import type { OverflowActionsActionItem } from "./OverflowActions.js";
|
|
2
4
|
import { type TableRoleLayout, type TableRoleOverlayBlurMode, type TableSortState } from "../lib/table-context.js";
|
|
3
5
|
import type { FrameProps } from "../logic/frame-types";
|
|
4
6
|
export type DataTableMode = "client" | "server";
|
|
@@ -33,7 +35,7 @@ type Searcher<T> = (row: T, query: string) => boolean;
|
|
|
33
35
|
type Filterer<T> = (row: T, filters: Record<string, unknown>) => boolean;
|
|
34
36
|
export type DataTableLoadMoreMode = "manual" | "auto";
|
|
35
37
|
export type DataTableVariant = "striped" | "divided";
|
|
36
|
-
export interface DataTableActionItem {
|
|
38
|
+
export interface DataTableActionItem extends OverflowActionsActionItem {
|
|
37
39
|
type?: "action";
|
|
38
40
|
id: string;
|
|
39
41
|
label: string;
|
|
@@ -64,6 +66,10 @@ export interface DataTableActionsConfig<T> {
|
|
|
64
66
|
minWidth?: number;
|
|
65
67
|
maxWidth?: number;
|
|
66
68
|
resizable?: boolean;
|
|
69
|
+
maxVisible?: number;
|
|
70
|
+
buttonProps?: ComponentProps<typeof OverflowActions>["buttonProps"];
|
|
71
|
+
parts?: ComponentProps<typeof OverflowActions>["parts"];
|
|
72
|
+
moreLabel?: string;
|
|
67
73
|
}
|
|
68
74
|
interface Props<T = any> extends Omit<FrameProps, "children" | "variant"> {
|
|
69
75
|
rows?: T[];
|
|
@@ -97,7 +97,7 @@ export default function DataTable($$renderer, $$props) {
|
|
|
97
97
|
|
|
98
98
|
const actionsColumnWidth = $.derived(() => actionsConfig()
|
|
99
99
|
? Math.max(40, Number(actionsConfig().width) || 160)
|
|
100
|
-
:
|
|
100
|
+
: 160);
|
|
101
101
|
|
|
102
102
|
function scheduleRowRegistrationCommit() {
|
|
103
103
|
if (rowRegistrationCommitQueued) return;
|
|
@@ -396,11 +396,17 @@ export default function DataTable($$renderer, $$props) {
|
|
|
396
396
|
actionsConfig().onAction({ row, rowId, actionId, item, state: renderState() });
|
|
397
397
|
},
|
|
398
398
|
getActionsCompact: () => actionsConfig()?.compact ?? "auto",
|
|
399
|
-
getActionsOverflow: () => actionsConfig()?.overflow ?? "
|
|
399
|
+
getActionsOverflow: () => actionsConfig()?.overflow ?? "progressive",
|
|
400
400
|
getActionsOverflowFrom: () => actionsConfig()?.overflowFrom ?? "end",
|
|
401
|
+
getActionsMaxVisible: () => actionsConfig()?.maxVisible ?? 3,
|
|
402
|
+
getActionsProps: () => ({
|
|
403
|
+
buttonProps: actionsConfig()?.buttonProps,
|
|
404
|
+
parts: actionsConfig()?.parts,
|
|
405
|
+
moreLabel: actionsConfig()?.moreLabel
|
|
406
|
+
}),
|
|
401
407
|
getActionsColumnWidth: () => actionsColumnWidth(),
|
|
402
408
|
getActionsMinWidth: () => Math.max(40, Number(actionsConfig()?.minWidth) || 40),
|
|
403
|
-
getActionsMaxWidth: () => Math.max(
|
|
409
|
+
getActionsMaxWidth: () => Math.max(40, Number(actionsConfig()?.maxWidth) || Math.max(actionsColumnWidth(), 320)),
|
|
404
410
|
isActionsResizable: () => actionsConfig()?.resizable === true,
|
|
405
411
|
getVariant: () => variant,
|
|
406
412
|
getLoading: () => loading && visibleRows().length === 0,
|
|
@@ -5,11 +5,12 @@ import SelectButton from "./SelectButton.js";
|
|
|
5
5
|
import Listbox from "./Listbox.js";
|
|
6
6
|
import MenuItem from "./MenuItem.js";
|
|
7
7
|
import Separator from "./Separator.js";
|
|
8
|
+
import OverflowAction from "./OverflowAction.js";
|
|
8
9
|
import { type OverflowActionIcon } from "../logic/overflow-actions.js";
|
|
9
10
|
import { type ComponentPartsOf } from "../logic/component-parts.js";
|
|
10
11
|
type ButtonProps = ComponentProps<typeof Button>;
|
|
11
12
|
type ControlledGlobalButtonKeys = "children" | "as" | "iconOnly" | "disabled" | "href" | "onclick" | "aria-label" | "title";
|
|
12
|
-
type GlobalButtonProps = Omit<ButtonProps, ControlledGlobalButtonKeys>;
|
|
13
|
+
export type GlobalButtonProps = Omit<ButtonProps, ControlledGlobalButtonKeys>;
|
|
13
14
|
export interface OverflowActionsActionItem {
|
|
14
15
|
type?: "action";
|
|
15
16
|
id: string;
|
|
@@ -20,6 +21,8 @@ export interface OverflowActionsActionItem {
|
|
|
20
21
|
target?: string;
|
|
21
22
|
rel?: string;
|
|
22
23
|
onAction?: () => void;
|
|
24
|
+
buttonProps?: GlobalButtonProps;
|
|
25
|
+
parts?: ComponentProps<typeof OverflowAction>["parts"];
|
|
23
26
|
}
|
|
24
27
|
export interface OverflowActionsSeparatorItem {
|
|
25
28
|
type: "separator";
|
|
@@ -45,6 +48,7 @@ interface Props extends Omit<FrameProps, "children"> {
|
|
|
45
48
|
overflow?: "all" | "progressive";
|
|
46
49
|
overflowFrom?: "start" | "end";
|
|
47
50
|
availableWidth?: number;
|
|
51
|
+
maxVisible?: number;
|
|
48
52
|
moreLabel?: string;
|
|
49
53
|
align?: "start" | "end";
|
|
50
54
|
disabled?: boolean;
|