@snowui-design-system/components 0.3.0-alpha.2 → 0.3.0-alpha.4
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/THIRD_PARTY_NOTICES.md +14 -0
- package/dist/client/blocks/Sidebar.js +56 -41
- package/dist/client/blocks/SidebarSection.js +3 -1
- package/dist/client/components/BarChart.js +1 -1
- package/dist/client/components/Breadcrumb.js +17 -11
- package/dist/client/components/CircularChart.js +2 -2
- package/dist/client/components/CodeBlock.js +278 -225
- package/dist/client/components/CopyButton.js +5 -2
- package/dist/client/components/ExpandButton.js +10 -3
- package/dist/client/components/Frame.js +15 -9
- package/dist/client/components/GaugeChart.js +2 -2
- package/dist/client/components/ImageViewer.js +51 -27
- package/dist/client/components/Indicator.js +5 -3
- package/dist/client/components/Input.js +27 -17
- package/dist/client/components/LineChart.js +1 -1
- package/dist/client/components/Link.d.ts +1 -1
- package/dist/client/components/Link.js +43 -22
- package/dist/client/components/Listbox.js +26 -15
- package/dist/client/components/OverflowAction.d.ts +2 -0
- package/dist/client/components/OverflowAction.js +146 -65
- package/dist/client/components/OverflowActions.d.ts +2 -0
- package/dist/client/components/OverflowActions.js +67 -16
- package/dist/client/components/Pagination.js +71 -48
- package/dist/client/components/Select.js +29 -18
- package/dist/client/components/SidePanel.js +76 -50
- package/dist/client/components/Tab.js +30 -31
- package/dist/client/components/TableBody.js +10 -4
- package/dist/client/components/TableCell.js +57 -32
- package/dist/client/components/TableHead.js +69 -38
- package/dist/client/components/TableToolbar.js +112 -79
- package/dist/client/components/Text.js +99 -59
- package/dist/client/components/Textarea.js +7 -1
- package/dist/client/components/Toast.js +8 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +114 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/lib/number-format.js +6 -0
- package/dist/client/lib/progressive-blur.d.ts +13 -0
- package/dist/client/lib/progressive-blur.js +54 -0
- package/dist/client/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/client/logic/ComponentPartsBoundary.js +15 -0
- package/dist/client/logic/overflow-actions.d.ts +3 -2
- package/dist/client/styles/layout.css +12 -2
- package/dist/server/blocks/Sidebar.js +19 -5
- package/dist/server/blocks/SidebarSection.js +3 -1
- package/dist/server/components/BarChart.js +1 -1
- package/dist/server/components/Breadcrumb.js +9 -2
- package/dist/server/components/CircularChart.js +2 -2
- package/dist/server/components/CodeBlock.js +25 -13
- package/dist/server/components/CopyButton.js +6 -2
- package/dist/server/components/ExpandButton.js +7 -3
- package/dist/server/components/Frame.js +10 -3
- package/dist/server/components/GaugeChart.js +2 -2
- package/dist/server/components/ImageViewer.js +6 -3
- package/dist/server/components/Indicator.js +5 -3
- package/dist/server/components/Input.js +14 -17
- package/dist/server/components/LineChart.js +1 -1
- package/dist/server/components/Link.d.ts +1 -1
- package/dist/server/components/Link.js +20 -3
- package/dist/server/components/Listbox.js +17 -4
- package/dist/server/components/OverflowAction.d.ts +2 -0
- package/dist/server/components/OverflowAction.js +70 -26
- package/dist/server/components/OverflowActions.d.ts +2 -0
- package/dist/server/components/OverflowActions.js +49 -14
- package/dist/server/components/Pagination.js +21 -10
- package/dist/server/components/Select.js +23 -11
- package/dist/server/components/SidePanel.js +28 -8
- package/dist/server/components/Tab.js +61 -52
- package/dist/server/components/TableBody.js +9 -2
- package/dist/server/components/TableCell.js +28 -7
- package/dist/server/components/TableHead.js +31 -7
- package/dist/server/components/TableToolbar.js +57 -30
- package/dist/server/components/Text.js +46 -10
- package/dist/server/components/Textarea.js +4 -1
- package/dist/server/components/Toast.js +4 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +114 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/lib/number-format.js +6 -0
- package/dist/server/lib/progressive-blur.d.ts +13 -0
- package/dist/server/lib/progressive-blur.js +54 -0
- package/dist/server/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/server/logic/ComponentPartsBoundary.js +12 -0
- package/dist/server/logic/overflow-actions.d.ts +3 -2
- package/dist/server/styles/layout.css +12 -2
- package/package.json +4 -3
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
/** Four layers match the established 80px Site edge treatment. */
|
|
2
|
+
const EDGE_BLUR_LAYERS = [
|
|
3
|
+
{ blur: "2px", solid: "20%", fade: "100%" },
|
|
4
|
+
{ blur: "6px", solid: "16%", fade: "72%" },
|
|
5
|
+
{ blur: "12px", solid: "10%", fade: "48%" },
|
|
6
|
+
{ blur: "24px", solid: "4%", fade: "28%" },
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* Decorative full-edge blur. The host supplies aria-hidden and owns its stacking context.
|
|
10
|
+
* Unsupported backdrop-filter leaves transparent layers and readable content.
|
|
11
|
+
*/
|
|
12
|
+
export function createEdgeProgressiveBlurStyles(options = {}) {
|
|
13
|
+
const direction = options.direction ?? "top-to-bottom";
|
|
14
|
+
const vertical = direction === "top-to-bottom" || direction === "bottom-to-top";
|
|
15
|
+
const edge = {
|
|
16
|
+
"top-to-bottom": "top: 0; left: 0; right: 0",
|
|
17
|
+
"bottom-to-top": "bottom: 0; left: 0; right: 0",
|
|
18
|
+
"left-to-right": "left: 0; top: 0; bottom: 0",
|
|
19
|
+
"right-to-left": "right: 0; top: 0; bottom: 0",
|
|
20
|
+
}[direction];
|
|
21
|
+
const gradient = {
|
|
22
|
+
"top-to-bottom": "to bottom",
|
|
23
|
+
"bottom-to-top": "to top",
|
|
24
|
+
"left-to-right": "to right",
|
|
25
|
+
"right-to-left": "to left",
|
|
26
|
+
}[direction];
|
|
27
|
+
const extent = options.extent ?? "80px";
|
|
28
|
+
const size = vertical ? `height: ${extent}` : `width: ${extent}`;
|
|
29
|
+
return {
|
|
30
|
+
containerStyle: [
|
|
31
|
+
`position: ${options.position ?? "absolute"}`,
|
|
32
|
+
edge,
|
|
33
|
+
size,
|
|
34
|
+
options.zIndex === undefined ? "" : `z-index: ${options.zIndex}`,
|
|
35
|
+
"pointer-events: none",
|
|
36
|
+
].filter(Boolean).join("; "),
|
|
37
|
+
layers: EDGE_BLUR_LAYERS.map((layer, index) => {
|
|
38
|
+
const mask = `linear-gradient(${gradient}, #000 0%, #000 ${layer.solid}, transparent ${layer.fade})`;
|
|
39
|
+
return {
|
|
40
|
+
index,
|
|
41
|
+
style: [
|
|
42
|
+
"position: absolute",
|
|
43
|
+
"inset: 0",
|
|
44
|
+
"pointer-events: none",
|
|
45
|
+
"background-image: linear-gradient(transparent, transparent)",
|
|
46
|
+
`-webkit-backdrop-filter: blur(${layer.blur})`,
|
|
47
|
+
`backdrop-filter: blur(${layer.blur})`,
|
|
48
|
+
`-webkit-mask-image: ${mask}`,
|
|
49
|
+
`mask-image: ${mask}`,
|
|
50
|
+
].join("; "),
|
|
51
|
+
};
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
1
55
|
export const DEFAULT_PROGRESSIVE_BLUR_LAYER_COUNT = 16;
|
|
2
56
|
export const DEFAULT_PROGRESSIVE_BLUR_WIDTH = "calc((var(--size-12, 3rem) + var(--size-14, 3.5rem)) / 3)";
|
|
3
57
|
const DEFAULT_OPTIONS = {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
children?: Snippet;
|
|
4
|
+
};
|
|
5
|
+
declare const ComponentPartsBoundary: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type ComponentPartsBoundary = ReturnType<typeof ComponentPartsBoundary>;
|
|
7
|
+
export default ComponentPartsBoundary;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as $ from 'svelte/internal/server';
|
|
2
|
+
import { provideComponentParts } from "./component-parts.js";
|
|
3
|
+
|
|
4
|
+
export default function ComponentPartsBoundary($$renderer, $$props) {
|
|
5
|
+
$$renderer.component(($$renderer) => {
|
|
6
|
+
let { children } = $$props;
|
|
7
|
+
|
|
8
|
+
provideComponentParts(() => undefined);
|
|
9
|
+
children?.($$renderer);
|
|
10
|
+
$$renderer.push(`<!---->`);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -7,10 +7,11 @@ export interface OverflowActionRegistration {
|
|
|
7
7
|
icon?: OverflowActionIcon;
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
href?: string;
|
|
10
|
+
target?: string;
|
|
11
|
+
rel?: string;
|
|
10
12
|
execute: (event?: MouseEvent) => void;
|
|
11
13
|
getElement: () => HTMLElement | undefined;
|
|
12
|
-
|
|
13
|
-
getCompactMeasureElement: () => HTMLElement | undefined;
|
|
14
|
+
getWidth: (mode: "full" | "compact") => number;
|
|
14
15
|
}
|
|
15
16
|
export interface OverflowActionsContext {
|
|
16
17
|
register: (action: OverflowActionRegistration) => () => void;
|
|
@@ -103,6 +103,16 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
@media (prefers-reduced-motion: reduce) {
|
|
107
|
+
:where([data-snowui-frame]) {
|
|
108
|
+
animation: none !important;
|
|
109
|
+
transition: none !important;
|
|
110
|
+
}
|
|
111
|
+
:where(.snowui-frame-state-content-layer) {
|
|
112
|
+
transition: none !important;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
/* === Hoverable 工具类 (hover 叠加反馈 + 交互态手形指针) ===
|
|
107
117
|
语义:hoverable 表示该元素响应 hover、属于可交互元素。
|
|
108
118
|
消费方(Avatar / Image / Button 等)只需条件加 .snowui-hoverable,
|
|
@@ -130,13 +140,13 @@
|
|
|
130
140
|
transition: var(--snowui-frame-shared-transition);
|
|
131
141
|
}
|
|
132
142
|
|
|
133
|
-
:where(.snowui-hoverable:hover:not(.snowui-disabled):not([data-disabled="true"]):not(:disabled)) {
|
|
143
|
+
:where(.snowui-hoverable:hover:not(.snowui-disabled):not([data-disabled="true"]):not([aria-disabled="true"]):not(:disabled)) {
|
|
134
144
|
/* 仅更新 overlay 透明度变量;background-image 引用它自动更新,无需重新声明 background-image */
|
|
135
145
|
--snowui-hover-overlay-opacity: var(--snowui-hover-opacity, var(--snowui-frame-hover-opacity, 4%));
|
|
136
146
|
}
|
|
137
147
|
|
|
138
148
|
/* Dark Mode 补偿 */
|
|
139
|
-
:where([theme="dark"] .snowui-hoverable:hover:not(.snowui-disabled):not([data-disabled="true"]):not(:disabled)) {
|
|
149
|
+
:where([theme="dark"] .snowui-hoverable:hover:not(.snowui-disabled):not([data-disabled="true"]):not([aria-disabled="true"]):not(:disabled)) {
|
|
140
150
|
--snowui-frame-hover-opacity: 10%;
|
|
141
151
|
}
|
|
142
152
|
}
|
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.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -128,13 +128,14 @@
|
|
|
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": "svelte-check --workspace .",
|
|
131
|
+
"check": "pnpm test:number-format && 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",
|
|
135
135
|
"source:notice:check": "node scripts/source-notices.mjs --check",
|
|
136
136
|
"source:notice:sync": "node scripts/source-notices.mjs --write",
|
|
137
137
|
"source:copy": "node scripts/copy-source.mjs",
|
|
138
|
-
"source:test": "node --test scripts/source-retention.test.mjs"
|
|
138
|
+
"source:test": "node --test scripts/source-retention.test.mjs",
|
|
139
|
+
"test:number-format": "node --test scripts/number-format.test.mjs"
|
|
139
140
|
}
|
|
140
141
|
}
|