@snowui-design-system/components 0.1.0 → 0.2.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/README.md +1 -2
- package/package.json +9 -3
- package/src/components/Accordion.md +218 -0
- package/src/components/Accordion.svelte +301 -0
- package/src/components/Accordion.test.ts +126 -0
- package/src/components/AccordionItem.md +114 -0
- package/src/components/AccordionItem.svelte +389 -0
- package/src/components/AccordionItem.test.ts +52 -0
- package/src/components/Avatar.md +54 -36
- package/src/components/Avatar.svelte +73 -126
- package/src/components/AvatarGroup.md +17 -14
- package/src/components/AvatarGroup.svelte +12 -50
- package/src/components/AvatarGroup.test.ts +69 -68
- package/src/components/Badge.md +53 -8
- package/src/components/Badge.svelte +303 -79
- package/src/components/Badge.test.ts +47 -0
- package/src/components/Breadcrumb.md +164 -0
- package/src/components/Breadcrumb.svelte +330 -0
- package/src/components/Breadcrumb.test.ts +154 -0
- package/src/components/Button.md +243 -57
- package/src/components/Button.svelte +278 -177
- package/src/components/Button.test.ts +175 -86
- package/src/components/ButtonGroup.md +140 -0
- package/src/components/ButtonGroup.svelte +491 -0
- package/src/components/ButtonGroup.test.ts +58 -0
- package/src/components/Card.md +186 -0
- package/src/components/Card.svelte +408 -0
- package/src/components/Card.test.ts +193 -0
- package/src/components/Checkbox.md +14 -10
- package/src/components/Checkbox.svelte +39 -99
- package/src/components/Chip.md +185 -0
- package/src/components/Chip.svelte +241 -0
- package/src/components/Chip.test.ts +117 -0
- package/src/components/CodeBlock.md +29 -16
- package/src/components/CodeBlock.svelte +132 -352
- package/src/components/CodeBlock.test.ts +15 -1
- package/src/components/CopyButton.md +41 -0
- package/src/components/CopyButton.svelte +164 -0
- package/src/components/CopyButton.test.ts +26 -0
- package/src/components/Dialog.md +95 -0
- package/src/components/Dialog.svelte +416 -0
- package/src/components/Dialog.test.ts +145 -0
- package/src/components/ExpandButton.md +41 -0
- package/src/components/ExpandButton.svelte +103 -0
- package/src/components/ExpandButton.test.ts +18 -0
- package/src/components/Form.md +4 -3
- package/src/components/Form.test.ts +72 -73
- package/src/components/Frame.md +243 -0
- package/src/components/Frame.svelte +208 -87
- package/src/components/Frame.test.ts +121 -0
- package/src/components/Icon.md +34 -6
- package/src/components/Icon.svelte +46 -95
- package/src/components/Image.md +24 -13
- package/src/components/Image.svelte +42 -128
- package/src/components/ImageGroup.md +6 -7
- package/src/components/ImageGroup.svelte +1 -28
- package/src/components/Indicator.md +92 -0
- package/src/components/Indicator.svelte +490 -0
- package/src/components/Indicator.test.ts +57 -0
- package/src/components/Input.md +81 -28
- package/src/components/Input.svelte +291 -178
- package/src/components/Input.test.ts +85 -48
- package/src/components/Kbd.md +0 -3
- package/src/components/Kbd.svelte +0 -1
- package/src/components/Link.md +192 -0
- package/src/components/Link.svelte +464 -0
- package/src/components/Link.test.ts +110 -0
- package/src/components/Listbox.md +52 -10
- package/src/components/Listbox.svelte +204 -50
- package/src/components/Listbox.test.ts +76 -33
- package/src/components/LocaleProvider.md +52 -0
- package/src/components/LocaleProvider.svelte +30 -0
- package/src/components/LocaleProvider.test.ts +32 -0
- package/src/components/MenuItem.md +23 -9
- package/src/components/MenuItem.svelte +57 -47
- package/src/components/MenuItem.test.ts +72 -65
- package/src/components/Pagination.md +504 -0
- package/src/components/Pagination.svelte +958 -0
- package/src/components/Pagination.test.ts +316 -0
- package/src/components/Popover.md +245 -42
- package/src/components/Popover.svelte +558 -127
- package/src/components/Popover.test.ts +361 -44
- package/src/components/Progress.md +91 -0
- package/src/components/Progress.svelte +374 -0
- package/src/components/Progress.test.ts +56 -0
- package/src/components/Radio.md +4 -6
- package/src/components/Radio.svelte +25 -117
- package/src/components/ScrollArea.md +116 -0
- package/src/components/ScrollArea.svelte +180 -0
- package/src/components/ScrollArea.test.ts +84 -0
- package/src/components/SearchInput.md +135 -0
- package/src/components/SearchInput.svelte +153 -0
- package/src/components/SearchInput.test.ts +61 -0
- package/src/components/Select.md +39 -8
- package/src/components/Select.svelte +196 -45
- package/src/components/Select.test.ts +79 -41
- package/src/components/SelectButton.md +50 -0
- package/src/components/SelectButton.svelte +186 -0
- package/src/components/SelectButton.test.ts +142 -0
- package/src/components/Separator.md +89 -0
- package/src/components/Separator.svelte +143 -0
- package/src/components/Separator.test.ts +35 -0
- package/src/components/Skeleton.md +2 -5
- package/src/components/Skeleton.svelte +202 -7
- package/src/components/Skeleton.test.ts +10 -10
- package/src/components/Slider.md +101 -0
- package/src/components/Slider.svelte +566 -0
- package/src/components/Slider.test.ts +51 -0
- package/src/components/Spinner.md +3 -4
- package/src/components/Spinner.svelte +11 -23
- package/src/components/{Toggle.md → Switch.md} +20 -21
- package/src/components/Switch.svelte +314 -0
- package/src/components/Switch.test.ts +57 -0
- package/src/components/Table.md +249 -0
- package/src/components/Table.svelte +139 -0
- package/src/components/Table.test.ts +64 -0
- package/src/components/TableBody.md +63 -0
- package/src/components/TableBody.svelte +78 -0
- package/src/components/TableBody.test.ts +13 -0
- package/src/components/TableCell.md +89 -0
- package/src/components/TableCell.svelte +368 -0
- package/src/components/TableCell.test.ts +51 -0
- package/src/components/TableHead.md +129 -0
- package/src/components/TableHead.svelte +281 -0
- package/src/components/TableHead.test.ts +44 -0
- package/src/components/TableHeader.md +26 -0
- package/src/components/TableHeader.svelte +10 -0
- package/src/components/TableHeader.test.ts +3 -0
- package/src/components/TableRow.md +36 -0
- package/src/components/TableRow.svelte +64 -0
- package/src/components/TableRow.test.ts +2 -0
- package/src/components/TableToolbar.svelte +260 -0
- package/src/components/Tag.md +270 -0
- package/src/components/Tag.svelte +462 -0
- package/src/components/Tag.test.ts +91 -0
- package/src/components/Text.md +87 -25
- package/src/components/Text.svelte +467 -93
- package/src/components/Text.test.ts +21 -36
- package/src/components/Textarea.md +22 -7
- package/src/components/Textarea.svelte +76 -155
- package/src/components/Textarea.test.ts +12 -5
- package/src/components/Tooltip.md +101 -12
- package/src/components/Tooltip.svelte +581 -108
- package/src/components/Tooltip.test.ts +63 -1
- package/src/context.ts +93 -5
- package/src/dev.ts +6 -10
- package/src/i18n/locale.svelte.ts +60 -0
- package/src/i18n/messages.ts +45 -0
- package/src/index.ts +177 -2
- package/src/keys.ts +7 -0
- package/src/lib/clipboard.ts +10 -0
- package/src/lib/color.md +36 -0
- package/src/lib/color.ts +57 -0
- package/src/lib/date-format.md +37 -0
- package/src/lib/date-format.ts +130 -0
- package/src/lib/edge-fade.md +101 -0
- package/src/lib/edge-fade.ts +55 -0
- package/src/lib/floating-position.md +20 -0
- package/src/lib/floating-position.ts +107 -0
- package/src/lib/number-format.md +40 -0
- package/src/lib/number-format.ts +132 -0
- package/src/lib/overlay-scrollbar.md +36 -0
- package/src/lib/overlay-scrollbar.svelte.ts +221 -0
- package/src/lib/overlay-trigger-timing.md +15 -0
- package/src/lib/overlay-trigger-timing.ts +8 -0
- package/src/lib/progressive-blur.md +95 -0
- package/src/lib/progressive-blur.ts +266 -0
- package/src/lib/resizable.md +41 -0
- package/src/lib/resizable.ts +211 -0
- package/src/lib/table-context.svelte.ts +129 -0
- package/src/lib/table-row-context.svelte.ts +16 -0
- package/src/lib/tooltip-behavior.ts +39 -0
- package/src/lib/tooltip-delay.md +33 -0
- package/src/lib/tooltip-delay.ts +49 -0
- package/src/lib/tooltip-overlay.md +30 -0
- package/src/lib/tooltip-overlay.ts +64 -0
- package/src/lib/truncate.md +7 -2
- package/src/lib/truncate.ts +105 -10
- package/src/logic/README.md +17 -7
- package/src/logic/component-parts.md +32 -0
- package/src/logic/component-parts.svelte.ts +130 -0
- package/src/logic/dialog.md +30 -0
- package/src/logic/dialog.svelte.ts +88 -0
- package/src/logic/frame-actions.md +28 -0
- package/src/logic/frame-actions.svelte.ts +49 -0
- package/src/logic/frame-class-state.md +21 -0
- package/src/logic/frame-class-state.svelte.ts +163 -0
- package/src/logic/frame-dom-runtime.svelte.ts +51 -0
- package/src/logic/frame-inline-style.md +56 -0
- package/src/logic/frame-inline-style.svelte.ts +623 -0
- package/src/logic/frame-motion-defaults.md +90 -9
- package/src/logic/frame-motion-defaults.ts +55 -49
- package/src/logic/frame-motion.svelte.ts +173 -0
- package/src/logic/frame-perception.md +83 -0
- package/src/logic/frame-perception.svelte.ts +273 -0
- package/src/logic/frame-prop-filter.ts +7 -1
- package/src/logic/frame-scale-observer.md +153 -0
- package/src/logic/frame-scale-observer.svelte.ts +98 -0
- package/src/logic/frame-scale-resolver.md +25 -0
- package/src/logic/frame-scale-resolver.svelte.ts +56 -0
- package/src/logic/frame-state-value.md +74 -0
- package/src/logic/frame-state-value.ts +30 -0
- package/src/logic/frame-state.svelte.ts +426 -0
- package/src/logic/frame-truncation.md +17 -3
- package/src/logic/frame-truncation.svelte.ts +23 -43
- package/src/logic/frame-types.md +2 -1
- package/src/logic/frame-types.ts +41 -7
- package/src/logic/frame-utils.md +4 -0
- package/src/logic/frame-utils.ts +54 -26
- package/src/logic/image-preview.md +9 -2
- package/src/logic/image-preview.ts +33 -7
- package/src/logic/morph.md +19 -0
- package/src/logic/morph.ts +7 -0
- package/src/logic/motion-config.ts +49 -3
- package/src/logic/motion-engine.md +43 -0
- package/src/logic/motion-engine.ts +272 -0
- package/src/logic/overlay-presence.svelte.ts +71 -0
- package/src/logic/popover.md +89 -0
- package/src/logic/popover.svelte.ts +236 -0
- package/src/logic/resource-size.md +21 -0
- package/src/logic/resource-size.ts +53 -0
- package/src/logic/text-collapse.md +2 -1
- package/src/logic/text-collapse.svelte.ts +1 -1
- package/src/logic/wc-adapter.ts +1 -1
- package/src/motion/README.md +97 -37
- package/src/motion/{defaults/bridge.md → bridge.md} +24 -4
- package/src/motion/{defaults/bridge.ts → bridge.ts} +16 -5
- package/src/motion/{defaults/content-crossfade.ts → content-crossfade.ts} +1 -1
- package/src/motion/{defaults/expand.md → expand.md} +2 -2
- package/src/motion/{defaults/expand.ts → expand.ts} +4 -3
- package/src/motion/fade-in.md +40 -0
- package/src/motion/fade-in.ts +14 -0
- package/src/motion/{defaults/fade-out.md → fade-out.md} +2 -2
- package/src/motion/fade-out.ts +14 -0
- package/src/motion/{defaults/morph.md → morph.md} +1 -1
- package/src/motion/{defaults/morph.ts → morph.ts} +3 -3
- package/src/motion/move.md +179 -0
- package/src/motion/move.ts +74 -0
- package/src/motion/number.md +50 -0
- package/src/motion/number.ts +30 -0
- package/src/motion/presets/README.md +50 -0
- package/src/motion/presets/dialog.md +20 -0
- package/src/motion/presets/dialog.ts +47 -0
- package/src/motion/presets/effects.md +32 -0
- package/src/motion/presets/effects.ts +111 -0
- package/src/motion/presets/generic.md +27 -0
- package/src/motion/presets/generic.ts +32 -0
- package/src/motion/presets/overlay.md +21 -0
- package/src/motion/presets/overlay.ts +18 -0
- package/src/motion/presets/replacement.md +19 -0
- package/src/motion/presets/replacement.ts +6 -0
- package/src/motion/presets/resize.md +23 -0
- package/src/motion/presets/resize.ts +16 -0
- package/src/motion/presets/tab.md +21 -0
- package/src/motion/presets/tab.ts +19 -0
- package/src/motion/presets/tooltip.md +20 -0
- package/src/motion/presets/tooltip.ts +37 -0
- package/src/motion/presets/utils.md +15 -0
- package/src/motion/presets/utils.ts +11 -0
- package/src/motion/primitives.md +22 -0
- package/src/motion/primitives.ts +46 -0
- package/src/motion/{defaults/replace.md → replace.md} +2 -2
- package/src/motion/{defaults/replace.ts → replace.ts} +4 -4
- package/src/motion/{defaults/rotate.md → rotate.md} +4 -4
- package/src/motion/{defaults/rotate.ts → rotate.ts} +4 -3
- package/src/motion/scale-in.md +40 -0
- package/src/motion/scale-in.ts +19 -0
- package/src/motion/spring.md +19 -0
- package/src/motion/spring.ts +96 -0
- package/src/motion/tokens.md +45 -0
- package/src/motion/tokens.ts +80 -0
- package/src/motion/{defaults/while-2xl.ts → while-2xl.ts} +1 -1
- package/src/motion/{defaults/while-active.ts → while-active.ts} +1 -1
- package/src/motion/while-appear.ts +10 -0
- package/src/motion/{defaults/while-click.ts → while-click.ts} +1 -1
- package/src/motion/{defaults/while-collapsed.ts → while-collapsed.ts} +1 -1
- package/src/motion/{defaults/while-disabled.ts → while-disabled.ts} +3 -2
- package/src/motion/while-disappear.ts +10 -0
- package/src/motion/{defaults/while-drag.ts → while-drag.ts} +1 -1
- package/src/motion/{defaults/while-editing.ts → while-editing.ts} +1 -1
- package/src/motion/{defaults/while-expanded.ts → while-expanded.ts} +1 -1
- package/src/motion/{defaults/while-focus.ts → while-focus.ts} +1 -1
- package/src/motion/{defaults/while-hover.ts → while-hover.ts} +1 -1
- package/src/motion/{defaults/while-idle.ts → while-idle.ts} +1 -1
- package/src/motion/{defaults/while-key.ts → while-key.ts} +1 -1
- package/src/motion/{defaults/while-lg.ts → while-lg.ts} +1 -1
- package/src/motion/{defaults/while-load.ts → while-load.ts} +3 -2
- package/src/motion/{defaults/while-md.ts → while-md.ts} +1 -1
- package/src/motion/{defaults/while-reload.ts → while-reload.ts} +1 -1
- package/src/motion/{defaults/while-scroll.ts → while-scroll.ts} +1 -1
- package/src/motion/{defaults/while-sm.ts → while-sm.ts} +1 -1
- package/src/motion/{defaults/while-uploading.ts → while-uploading.ts} +1 -1
- package/src/motion/{defaults/while-validating.ts → while-validating.ts} +1 -1
- package/src/motion/{defaults/while-xl.ts → while-xl.ts} +1 -1
- package/src/motion/{defaults/while-xs.ts → while-xs.ts} +1 -1
- package/src/styles/auto-layout.css +92 -10
- package/src/styles/layout.css +370 -30
- package/src/styles/scrollbar.css +72 -7
- package/src/App.svelte +0 -103
- package/src/components/QuickAction.md +0 -146
- package/src/components/QuickAction.svelte +0 -161
- package/src/components/QuickAction.test.ts +0 -299
- package/src/components/Test.md +0 -72
- package/src/components/Test.svelte +0 -106
- package/src/components/Test.test.ts +0 -27
- package/src/components/Toggle.svelte +0 -384
- package/src/components/Toggle.test.ts +0 -57
- package/src/logic/frame-profile.md +0 -156
- package/src/logic/frame-profile.ts +0 -130
- package/src/motion/NumberFlow.md +0 -16
- package/src/motion/defaults/fade-out.ts +0 -14
- package/src/motion/defaults/move.md +0 -81
- package/src/motion/defaults/move.ts +0 -31
- package/src/motion/defaults/number.md +0 -41
- package/src/motion/defaults/number.ts +0 -17
- package/src/motion/defaults/while-appear.ts +0 -12
- package/src/motion/defaults/while-disappear.ts +0 -12
- package/src//344/273/243/347/240/201.txt +0 -61
- /package/src/motion/{defaults/rotate.css → rotate.css} +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import type { FrameProps, FrameProfile } from './frame-types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Profile 配置存储
|
|
5
|
-
* 使用 Map 支持动态注册自定义 Profile
|
|
6
|
-
*/
|
|
7
|
-
const profileConfigs = new Map<string, Partial<FrameProps>>([
|
|
8
|
-
['Surface', {
|
|
9
|
-
class: 'snowui-profile-surface',
|
|
10
|
-
whileClick: {}
|
|
11
|
-
}],
|
|
12
|
-
['Field', {
|
|
13
|
-
class: 'snowui-profile-field',
|
|
14
|
-
// TODO: 样式待提供 (输入型交互: Input, Textarea, Select)
|
|
15
|
-
}],
|
|
16
|
-
['Container', {
|
|
17
|
-
class: 'snowui-profile-container',
|
|
18
|
-
// 纯净状态,无默认行为
|
|
19
|
-
}],
|
|
20
|
-
['Anchor', {
|
|
21
|
-
class: 'snowui-profile-anchor',
|
|
22
|
-
// 预留,目前无默认行为
|
|
23
|
-
}]
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 定义自定义 Profile
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* defineProfile('Card', {
|
|
32
|
-
* class: 'my-card',
|
|
33
|
-
* whileHover: { scale: 1.02 },
|
|
34
|
-
* profile: 'Surface' // 可选:继承自 Surface
|
|
35
|
-
* });
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @param name - Profile 名称
|
|
39
|
-
* @param config - Profile 配置
|
|
40
|
-
*/
|
|
41
|
-
export function defineProfile(name: string, config: Partial<FrameProps>): void {
|
|
42
|
-
profileConfigs.set(name, config);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 扩展现有 Profile(继承)
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* extendProfile('Surface', 'InteractiveCard', {
|
|
51
|
-
* whileHover: { scale: 1.05 },
|
|
52
|
-
* whileClick: { scale: 0.98 }
|
|
53
|
-
* });
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @param base - 基础 Profile 名称
|
|
57
|
-
* @param name - 新 Profile 名称
|
|
58
|
-
* @param overrides - 覆盖/扩展的配置
|
|
59
|
-
*/
|
|
60
|
-
export function extendProfile(
|
|
61
|
-
base: FrameProfile | string,
|
|
62
|
-
name: string,
|
|
63
|
-
overrides: Partial<FrameProps>
|
|
64
|
-
): void {
|
|
65
|
-
const baseConfig = profileConfigs.get(base) || {};
|
|
66
|
-
|
|
67
|
-
// 合并配置,class 和 style 追加,其他属性覆盖
|
|
68
|
-
const merged: Partial<FrameProps> = { ...baseConfig };
|
|
69
|
-
|
|
70
|
-
for (const key in overrides) {
|
|
71
|
-
const propKey = key as keyof FrameProps;
|
|
72
|
-
if (propKey === 'class' && baseConfig.class && overrides.class) {
|
|
73
|
-
merged.class = `${baseConfig.class} ${overrides.class}`;
|
|
74
|
-
} else if (propKey === 'style' && baseConfig.style && overrides.style) {
|
|
75
|
-
merged.style = `${baseConfig.style}; ${overrides.style}`;
|
|
76
|
-
} else {
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
merged[propKey] = overrides[propKey];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
profileConfigs.set(name, merged);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 获取 Profile 配置(内部使用)
|
|
87
|
-
*/
|
|
88
|
-
export function getProfileConfig(profile: string): Partial<FrameProps> | undefined {
|
|
89
|
-
return profileConfigs.get(profile);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 解析 Profile 属性,合并默认配置
|
|
94
|
-
* 用户显式传入的 props 优先级高于 Profile 默认值
|
|
95
|
-
*
|
|
96
|
-
* @param profile - 组件的 Profile(支持内置和自定义)
|
|
97
|
-
* @param userProps - 用户传入的原始 Props
|
|
98
|
-
* @returns 合并后的 Props
|
|
99
|
-
*/
|
|
100
|
-
export function resolveProfileProps(
|
|
101
|
-
profile: FrameProfile | string | undefined,
|
|
102
|
-
userProps: FrameProps
|
|
103
|
-
): FrameProps {
|
|
104
|
-
if (!profile || !profileConfigs.has(profile)) {
|
|
105
|
-
return userProps;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const defaults = profileConfigs.get(profile)!;
|
|
109
|
-
const merged: FrameProps = { ...userProps };
|
|
110
|
-
|
|
111
|
-
// 遍历默认配置进行合并
|
|
112
|
-
for (const key in defaults) {
|
|
113
|
-
const propKey = key as keyof FrameProps;
|
|
114
|
-
|
|
115
|
-
// 只有当用户未显式定义该属性时,才使用 Profile 默认值
|
|
116
|
-
if (merged[propKey] === undefined) {
|
|
117
|
-
// @ts-ignore - 这里的类型比较复杂,暂时忽略
|
|
118
|
-
merged[propKey] = defaults[propKey];
|
|
119
|
-
} else if (propKey === 'class' && defaults.class) {
|
|
120
|
-
// 特殊处理 class:追加而非覆盖
|
|
121
|
-
merged.class = `${defaults.class} ${merged.class}`;
|
|
122
|
-
} else if (propKey === 'style' && defaults.style) {
|
|
123
|
-
// 特殊处理 style:追加而非覆盖
|
|
124
|
-
merged.style = `${defaults.style} ${merged.style}`;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return merged;
|
|
129
|
-
}
|
|
130
|
-
|
package/src/motion/NumberFlow.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# NumberFlow.svelte(迁移说明)
|
|
2
|
-
|
|
3
|
-
> **版本**: v1.3.1
|
|
4
|
-
> **路径**: `src/components/NumberFlow.svelte`
|
|
5
|
-
> **职责**: `motion/NumberFlow.svelte` 兼容层已删除,统一使用组件目录主实现。
|
|
6
|
-
|
|
7
|
-
## 说明
|
|
8
|
-
|
|
9
|
-
- 请直接使用 `src/components/NumberFlow.svelte`。
|
|
10
|
-
- 建议新代码直接从 `components` 目录导入:
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
import NumberFlow from "../components/NumberFlow.svelte";
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
- 旧路径 `src/motion/NumberFlow.svelte` 已移除。
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# move.ts 文档
|
|
2
|
-
|
|
3
|
-
> **版本**: v1.1.0
|
|
4
|
-
> **职责**: 提供默认位移动效配置。
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 导出
|
|
9
|
-
|
|
10
|
-
| 名称 | 类型 | 描述 |
|
|
11
|
-
| :--- | :--- | :--- |
|
|
12
|
-
| `MOVE_MOTION` | `MotionConfig` | 轻微位移后归位的默认移动动效 |
|
|
13
|
-
| `MOVE_RIGHT_MOTION` | `MotionConfig` | 从左向右移动 |
|
|
14
|
-
| `MOVE_LEFT_MOTION` | `MotionConfig` | 从右向左移动 |
|
|
15
|
-
| `MOVE_DOWN_MOTION` | `MotionConfig` | 从上向下移动 |
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 默认参数
|
|
20
|
-
|
|
21
|
-
### MOVE_MOTION
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
{
|
|
25
|
-
y: [8, 0],
|
|
26
|
-
duration: 240,
|
|
27
|
-
easing: "easeOut"
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### MOVE_RIGHT_MOTION
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
{
|
|
35
|
-
x: [0, 160],
|
|
36
|
-
duration: 420,
|
|
37
|
-
easing: "easeOut"
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### MOVE_LEFT_MOTION
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
{
|
|
45
|
-
x: [0, -160],
|
|
46
|
-
duration: 420,
|
|
47
|
-
easing: "easeOut"
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### MOVE_DOWN_MOTION
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
{
|
|
55
|
-
y: [0, 100],
|
|
56
|
-
duration: 420,
|
|
57
|
-
easing: "easeOut"
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## 典型用途
|
|
64
|
-
|
|
65
|
-
- `whileScroll`
|
|
66
|
-
- `whileValidating` / `whileUploading`
|
|
67
|
-
- 调试示例中的方向位移动效
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 更新日志 (Changelog)
|
|
72
|
-
|
|
73
|
-
### v1.1.0 (2026-02-27)
|
|
74
|
-
|
|
75
|
-
#### 新功能
|
|
76
|
-
- 新增方向位移默认动效:右移/左移/下移。
|
|
77
|
-
|
|
78
|
-
### v1.0.0 (2026-02-26)
|
|
79
|
-
|
|
80
|
-
#### 新功能
|
|
81
|
-
- 新增默认位移动效常量。
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* move.ts
|
|
3
|
-
* v1.1.0
|
|
4
|
-
* 默认位移动效:轻微位移后回到目标位置。
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { MotionConfig } from "../../logic/motion-config";
|
|
8
|
-
|
|
9
|
-
export const MOVE_MOTION: MotionConfig = {
|
|
10
|
-
y: [8, 0],
|
|
11
|
-
duration: 300,
|
|
12
|
-
easing: "easeOut",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const MOVE_RIGHT_MOTION: MotionConfig = {
|
|
16
|
-
x: [0, 160],
|
|
17
|
-
duration: 300,
|
|
18
|
-
easing: "easeOut",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const MOVE_LEFT_MOTION: MotionConfig = {
|
|
22
|
-
x: [0, -160],
|
|
23
|
-
duration: 300,
|
|
24
|
-
easing: "easeOut",
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const MOVE_DOWN_MOTION: MotionConfig = {
|
|
28
|
-
y: [0, 100],
|
|
29
|
-
duration: 300,
|
|
30
|
-
easing: "easeOut",
|
|
31
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# number.ts 文档
|
|
2
|
-
|
|
3
|
-
> **版本**: v1.0.0
|
|
4
|
-
> **职责**: 提供默认数字变化动效配置,并暴露默认数字动效组件引用。
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## 导出
|
|
9
|
-
|
|
10
|
-
| 名称 | 类型 | 描述 |
|
|
11
|
-
| :--- | :--- | :--- |
|
|
12
|
-
| `NUMBER_MOTION` | `MotionConfig` | 默认数字变化动效配置 |
|
|
13
|
-
| `NUMBER_MOTION_COMPONENT` | `Component` | 默认数字动效组件(`NumberFlow`) |
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## 默认参数
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
{
|
|
21
|
-
duration: 320,
|
|
22
|
-
easing: "easeOut",
|
|
23
|
-
component: NumberFlow
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## 使用说明
|
|
30
|
-
|
|
31
|
-
- 该模块用于 Frame 默认动效系统中的数字场景默认值。
|
|
32
|
-
- 若业务需要自定义数字动效,可在 `while*` 中覆写 `component`/`duration`。
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 更新日志 (Changelog)
|
|
37
|
-
|
|
38
|
-
### v1.0.0 (2026-02-26)
|
|
39
|
-
|
|
40
|
-
#### 新功能
|
|
41
|
-
- 新增默认数字动效配置与组件导出(基于 `NumberFlow`)。
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* number.ts
|
|
3
|
-
* v1.1.0
|
|
4
|
-
* 默认数字变化动效配置(OSS 版)。
|
|
5
|
-
* OSS 不捆绑 NumberFlow 组件;PRO 包会在运行时注入 component 字段。
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { MotionConfig } from "../../logic/motion-config";
|
|
9
|
-
|
|
10
|
-
export const NUMBER_MOTION: MotionConfig = {
|
|
11
|
-
duration: 300,
|
|
12
|
-
easing: "easeOut",
|
|
13
|
-
component: undefined,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** PRO 包会将此替换为实际的 NumberFlow 组件引用 */
|
|
17
|
-
export let NUMBER_MOTION_COMPONENT: unknown = undefined;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* while-appear.ts
|
|
3
|
-
* v1.0.0
|
|
4
|
-
* whileAppear 默认动效:复用 replaceIn(渐现 + 缩放)。
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { MotionConfig } from "../../logic/motion-config";
|
|
8
|
-
import { REPLACE_IN_MOTION } from "./replace";
|
|
9
|
-
|
|
10
|
-
export const WHILE_APPEAR_DEFAULT_MOTION: MotionConfig = {
|
|
11
|
-
...REPLACE_IN_MOTION,
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* while-disappear.ts
|
|
3
|
-
* v1.0.0
|
|
4
|
-
* whileDisappear 默认动效:复用 fadeOut(渐隐)。
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { MotionConfig } from "../../logic/motion-config";
|
|
8
|
-
import { FADE_OUT_MOTION } from "./fade-out";
|
|
9
|
-
|
|
10
|
-
export const WHILE_DISAPPEAR_DEFAULT_MOTION: MotionConfig = {
|
|
11
|
-
...FADE_OUT_MOTION,
|
|
12
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
代码
|
|
2
|
-
|
|
3
|
-
顶部引入
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
import { Text, Icon } from "./index";
|
|
6
|
-
import { FourLeafClover } from "../../resource-svelte/src/index";
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
引用图标
|
|
10
|
-
<FourLeafClover size={32} weight="duotone" class="text-blue" />
|
|
11
|
-
|
|
12
|
-
引用头像
|
|
13
|
-
<AvatarByewind size={64} class="rounded-full" />
|
|
14
|
-
|
|
15
|
-
引用图片
|
|
16
|
-
<Image01 width={200} />
|
|
17
|
-
<Geometric01 width={200} height={120} />
|
|
18
|
-
|
|
19
|
-
-----------------------------------------------
|
|
20
|
-
Badge
|
|
21
|
-
<Badge />
|
|
22
|
-
<Badge count={100} max={99} />
|
|
23
|
-
<Badge count={0} max={99} showZero />
|
|
24
|
-
|
|
25
|
-
文字
|
|
26
|
-
<Text class="text-blue" style="width: 200px;" tag="div" interactive={true} lines={1} fullText="文字">
|
|
27
|
-
这是一段非常非常长的文字,如果它被截断了,鼠标放上去会显示纯 CSS 的Tooltip。
|
|
28
|
-
</Text>
|
|
29
|
-
|
|
30
|
-
按钮
|
|
31
|
-
<Button variant="primary">Primary</Button>
|
|
32
|
-
<Button variant="secondary">Secondary</Button>
|
|
33
|
-
<Button variant="outline">Outline</Button>
|
|
34
|
-
<Button variant="ghost">Ghost</Button>
|
|
35
|
-
<Button variant="primary" size="sm">Small</Button>
|
|
36
|
-
<Button variant="primary" size="md">Medium</Button>
|
|
37
|
-
<Button variant="primary" size="lg">Large</Button>
|
|
38
|
-
<Button variant="primary" disabled>Disabled</Button>
|
|
39
|
-
|
|
40
|
-
Icon组件
|
|
41
|
-
<Icon icon={Bell} size={32} badge={DotCircle} />
|
|
42
|
-
<Icon icon={FourLeafClover} size={32} />
|
|
43
|
-
<Icon icon={Heart} size={32} background badge />
|
|
44
|
-
<Icon icon={Heart} size={32} badge={5} />
|
|
45
|
-
<Icon icon={Heart} size={32} badge={100} />
|
|
46
|
-
<Icon icon={Heart} size={32} badge="New" />
|
|
47
|
-
<Icon icon={Star} size={32} hover="tooltip" hoverContent="This is a tooltip"/>
|
|
48
|
-
|
|
49
|
-
Icon组件组
|
|
50
|
-
<div
|
|
51
|
-
style="display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;"
|
|
52
|
-
>
|
|
53
|
-
{#each sizes as size}
|
|
54
|
-
<div
|
|
55
|
-
style="display: flex; flex-direction: column; align-items: center; gap: 0.5rem;"
|
|
56
|
-
>
|
|
57
|
-
<Icon icon={Bell} {size} badge={99} />
|
|
58
|
-
<span style="font-size: 12px;">{size}</span>
|
|
59
|
-
</div>
|
|
60
|
-
{/each}
|
|
61
|
-
</div>
|
|
File without changes
|