@humuchen/mac-ui 0.0.1
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 +940 -0
- package/dist/favicon.svg +1 -0
- package/dist/mac-ui.cjs.js +12367 -0
- package/dist/mac-ui.cjs.js.map +1 -0
- package/dist/mac-ui.es.js +18444 -0
- package/dist/mac-ui.es.js.map +1 -0
- package/dist/mac-ui.umd.js +12367 -0
- package/dist/mac-ui.umd.js.map +1 -0
- package/dist/types/components/alert/index.d.ts +1 -0
- package/dist/types/components/alert/mac-alert.d.ts +38 -0
- package/dist/types/components/alert/mac-alert.stories.d.ts +15 -0
- package/dist/types/components/animation/animations.d.ts +97 -0
- package/dist/types/components/animation/index.d.ts +3 -0
- package/dist/types/components/animation/mac-animation.d.ts +67 -0
- package/dist/types/components/animation/mac-animation.stories.d.ts +9 -0
- package/dist/types/components/button/index.d.ts +1 -0
- package/dist/types/components/button/mac-button.d.ts +37 -0
- package/dist/types/components/button/mac-button.stories.d.ts +14 -0
- package/dist/types/components/card/index.d.ts +1 -0
- package/dist/types/components/card/mac-card.d.ts +38 -0
- package/dist/types/components/card/mac-card.stories.d.ts +14 -0
- package/dist/types/components/carousel/index.d.ts +1 -0
- package/dist/types/components/carousel/mac-carousel.d.ts +105 -0
- package/dist/types/components/carousel/mac-carousel.stories.d.ts +18 -0
- package/dist/types/components/checkbox/index.d.ts +2 -0
- package/dist/types/components/checkbox/mac-checkbox.d.ts +94 -0
- package/dist/types/components/checkbox/mac-checkbox.stories.d.ts +17 -0
- package/dist/types/components/config-provider/index.d.ts +1 -0
- package/dist/types/components/config-provider/mac-config-provider.d.ts +23 -0
- package/dist/types/components/config-provider/mac-config-provider.stories.d.ts +12 -0
- package/dist/types/components/confirm/index.d.ts +2 -0
- package/dist/types/components/confirm/mac-confirm.d.ts +86 -0
- package/dist/types/components/confirm/mac-confirm.stories.d.ts +15 -0
- package/dist/types/components/data-table/index.d.ts +2 -0
- package/dist/types/components/data-table/mac-data-table.d.ts +212 -0
- package/dist/types/components/data-table/mac-data-table.stories.d.ts +18 -0
- package/dist/types/components/date-picker/date-picker-utils.d.ts +13 -0
- package/dist/types/components/date-picker/index.d.ts +3 -0
- package/dist/types/components/date-picker/mac-date-picker.d.ts +72 -0
- package/dist/types/components/date-picker/mac-date-picker.stories.d.ts +28 -0
- package/dist/types/components/date-picker/mac-date-range-picker.d.ts +58 -0
- package/dist/types/components/date-picker/mac-date-range-picker.stories.d.ts +13 -0
- package/dist/types/components/descriptions/mac-descriptions.d.ts +99 -0
- package/dist/types/components/descriptions/mac-descriptions.stories.d.ts +21 -0
- package/dist/types/components/desktop/index.d.ts +2 -0
- package/dist/types/components/desktop/mac-desktop.d.ts +88 -0
- package/dist/types/components/desktop/mac-desktop.stories.d.ts +17 -0
- package/dist/types/components/desktop-icon/index.d.ts +1 -0
- package/dist/types/components/desktop-icon/mac-desktop-icon.d.ts +46 -0
- package/dist/types/components/desktop-icon/mac-desktop-icon.stories.d.ts +8 -0
- package/dist/types/components/dock/index.d.ts +2 -0
- package/dist/types/components/dock/mac-dock-item.d.ts +37 -0
- package/dist/types/components/dock/mac-dock.d.ts +74 -0
- package/dist/types/components/dock/mac-dock.stories.d.ts +13 -0
- package/dist/types/components/drawer/mac-drawer.d.ts +87 -0
- package/dist/types/components/drawer/mac-drawer.stories.d.ts +15 -0
- package/dist/types/components/dropdown/index.d.ts +2 -0
- package/dist/types/components/dropdown/mac-dropdown.d.ts +77 -0
- package/dist/types/components/dropdown/mac-dropdown.stories.d.ts +13 -0
- package/dist/types/components/dynamic-tags/index.d.ts +1 -0
- package/dist/types/components/dynamic-tags/mac-dynamic-tags.d.ts +64 -0
- package/dist/types/components/dynamic-tags/mac-dynamic-tags.stories.d.ts +16 -0
- package/dist/types/components/form/index.d.ts +3 -0
- package/dist/types/components/form/mac-form-item.d.ts +67 -0
- package/dist/types/components/form/mac-form.d.ts +64 -0
- package/dist/types/components/form/mac-form.stories.d.ts +18 -0
- package/dist/types/components/group-button/index.d.ts +2 -0
- package/dist/types/components/group-button/mac-group-button.d.ts +50 -0
- package/dist/types/components/group-button/mac-group-button.stories.d.ts +13 -0
- package/dist/types/components/infinite-scroll/index.d.ts +1 -0
- package/dist/types/components/infinite-scroll/mac-infinite-scroll.d.ts +57 -0
- package/dist/types/components/infinite-scroll/mac-infinite-scroll.stories.d.ts +11 -0
- package/dist/types/components/input/index.d.ts +1 -0
- package/dist/types/components/input/mac-input.d.ts +73 -0
- package/dist/types/components/input/mac-input.stories.d.ts +19 -0
- package/dist/types/components/input-number/index.d.ts +1 -0
- package/dist/types/components/input-number/mac-input-number.d.ts +81 -0
- package/dist/types/components/input-number/mac-input-number.stories.d.ts +18 -0
- package/dist/types/components/lazy-image/index.d.ts +1 -0
- package/dist/types/components/lazy-image/mac-lazy-image.d.ts +86 -0
- package/dist/types/components/lazy-image/mac-lazy-image.stories.d.ts +15 -0
- package/dist/types/components/menu/index.d.ts +2 -0
- package/dist/types/components/menu/mac-menu.d.ts +63 -0
- package/dist/types/components/menu/mac-menu.stories.d.ts +11 -0
- package/dist/types/components/modal/index.d.ts +1 -0
- package/dist/types/components/modal/mac-modal.d.ts +96 -0
- package/dist/types/components/modal/mac-modal.stories.d.ts +12 -0
- package/dist/types/components/number-animation/mac-number-animation.d.ts +64 -0
- package/dist/types/components/number-animation/mac-number-animation.stories.d.ts +15 -0
- package/dist/types/components/popconfirm/mac-popconfirm.d.ts +77 -0
- package/dist/types/components/popconfirm/mac-popconfirm.stories.d.ts +14 -0
- package/dist/types/components/progress/index.d.ts +1 -0
- package/dist/types/components/progress/mac-progress.d.ts +76 -0
- package/dist/types/components/progress/mac-progress.stories.d.ts +25 -0
- package/dist/types/components/radio/index.d.ts +2 -0
- package/dist/types/components/radio/mac-radio.d.ts +90 -0
- package/dist/types/components/radio/mac-radio.stories.d.ts +17 -0
- package/dist/types/components/rating/mac-rating.d.ts +56 -0
- package/dist/types/components/rating/mac-rating.stories.d.ts +15 -0
- package/dist/types/components/select/index.d.ts +1 -0
- package/dist/types/components/select/mac-select.d.ts +97 -0
- package/dist/types/components/select/mac-select.stories.d.ts +18 -0
- package/dist/types/components/split/index.d.ts +1 -0
- package/dist/types/components/split/mac-split.d.ts +69 -0
- package/dist/types/components/split/mac-split.stories.d.ts +13 -0
- package/dist/types/components/tabs/mac-tabs.d.ts +119 -0
- package/dist/types/components/tabs/mac-tabs.stories.d.ts +15 -0
- package/dist/types/components/tag/index.d.ts +1 -0
- package/dist/types/components/tag/mac-tag.d.ts +40 -0
- package/dist/types/components/tag/mac-tag.stories.d.ts +20 -0
- package/dist/types/components/text-ellipsis/mac-text-ellipsis.d.ts +47 -0
- package/dist/types/components/text-ellipsis/mac-text-ellipsis.stories.d.ts +15 -0
- package/dist/types/components/tree/index.d.ts +2 -0
- package/dist/types/components/tree/mac-tree.d.ts +79 -0
- package/dist/types/components/tree/mac-tree.stories.d.ts +12 -0
- package/dist/types/components/tree-select/index.d.ts +2 -0
- package/dist/types/components/tree-select/mac-tree-select.d.ts +59 -0
- package/dist/types/components/tree-select/mac-tree-select.stories.d.ts +19 -0
- package/dist/types/internal/base-element.d.ts +18 -0
- package/dist/types/internal/property-converters.d.ts +7 -0
- package/dist/types/mac-ui.d.ts +60 -0
- package/dist/types/styles/shared-styles.d.ts +2 -0
- package/dist/types/styles/theme.d.ts +11 -0
- package/dist/types/test/setup.d.ts +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MacAlert } from './mac-alert';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseElement } from '../../internal/base-element';
|
|
2
|
+
/**
|
|
3
|
+
* @tag mac-alert
|
|
4
|
+
* @summary 用于显示警告消息的提示组件。
|
|
5
|
+
*
|
|
6
|
+
* @slot - 提示的描述内容。
|
|
7
|
+
* @slot icon - 自定义图标内容。
|
|
8
|
+
* @slot action - 显示在右侧的操作内容。
|
|
9
|
+
*
|
|
10
|
+
* @csspart base - 提示的基础容器。
|
|
11
|
+
* @csspart icon - 图标容器。
|
|
12
|
+
* @csspart title - 标题文本。
|
|
13
|
+
* @csspart content - 描述内容。
|
|
14
|
+
* @csspart close - 关闭按钮。
|
|
15
|
+
*
|
|
16
|
+
* @event mac-close - 点击关闭按钮时触发。
|
|
17
|
+
*/
|
|
18
|
+
export declare class MacAlert extends BaseElement {
|
|
19
|
+
static styles: import("lit").CSSResult[];
|
|
20
|
+
/** 提示的类型样式。 */
|
|
21
|
+
type: 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
22
|
+
/** 提示的标题。 */
|
|
23
|
+
title: string;
|
|
24
|
+
/** 提示是否有边框。 */
|
|
25
|
+
bordered: boolean;
|
|
26
|
+
/** 是否显示图标。 */
|
|
27
|
+
showIcon: boolean;
|
|
28
|
+
/** 提示是否可以关闭。 */
|
|
29
|
+
closable: boolean;
|
|
30
|
+
private get _defaultIcon();
|
|
31
|
+
private _handleClose;
|
|
32
|
+
render(): import("lit").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
'mac-alert': MacAlert;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-alert';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithTitle: Story;
|
|
8
|
+
export declare const WithoutTitle: Story;
|
|
9
|
+
export declare const AllTypes: Story;
|
|
10
|
+
export declare const BorderedVsBorderless: Story;
|
|
11
|
+
export declare const WithoutIcon: Story;
|
|
12
|
+
export declare const Closable: Story;
|
|
13
|
+
export declare const WithAction: Story;
|
|
14
|
+
export declare const CustomIcon: Story;
|
|
15
|
+
export declare const LongContent: Story;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* 动画分类
|
|
4
|
+
*/
|
|
5
|
+
export type AnimationCategory = 'fade' | 'scale' | 'rotate' | 'slide' | 'bounce' | 'special';
|
|
6
|
+
/**
|
|
7
|
+
* 单个动画定义
|
|
8
|
+
*/
|
|
9
|
+
export interface AnimationDefinition {
|
|
10
|
+
/** 动画名称(用于 type 属性匹配) */
|
|
11
|
+
name: string;
|
|
12
|
+
/** 效果描述 */
|
|
13
|
+
description: string;
|
|
14
|
+
/** 所属分类 */
|
|
15
|
+
category: AnimationCategory;
|
|
16
|
+
/** @keyframes 规则的纯 CSS 文本(不含 @keyframes 包裹层之外的任何选择器) */
|
|
17
|
+
keyframes: string;
|
|
18
|
+
/** 是否为退场动画(to 隐藏) */
|
|
19
|
+
exit?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const BUILT_IN: AnimationDefinition[];
|
|
22
|
+
/** 内置动画名称集合(用于判断是否需要动态注入 keyframes) */
|
|
23
|
+
export declare const BUILT_IN_ANIMATION_NAMES: ReadonlySet<string>;
|
|
24
|
+
/**
|
|
25
|
+
* 注册自定义动画(可扩展性入口)
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* registerAnimation({
|
|
30
|
+
* name: 'myFade',
|
|
31
|
+
* description: '自定义淡入',
|
|
32
|
+
* category: 'fade',
|
|
33
|
+
* keyframes: '@keyframes mac-myFade { from { opacity: 0; } to { opacity: 1; } }',
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
* 注册后即可通过 `<mac-animation type="myFade">` 使用。
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerAnimation(def: AnimationDefinition): void;
|
|
39
|
+
/**
|
|
40
|
+
* 根据名称获取动画定义,未找到时返回 undefined
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAnimation(name: string): AnimationDefinition | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* 判断动画是否已注册
|
|
45
|
+
*/
|
|
46
|
+
export declare function hasAnimation(name: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 获取所有已注册动画名称列表
|
|
49
|
+
*/
|
|
50
|
+
export declare function getAnimationNames(): string[];
|
|
51
|
+
/**
|
|
52
|
+
* 获取所有已注册动画定义
|
|
53
|
+
*/
|
|
54
|
+
export declare function getAllAnimations(): AnimationDefinition[];
|
|
55
|
+
/**
|
|
56
|
+
* 所有内置动画的 @keyframes(供 HOC 组件注入 Shadow DOM)。
|
|
57
|
+
*/
|
|
58
|
+
export declare const builtInKeyframes: CSSResult;
|
|
59
|
+
export declare const animationStyleSheet: CSSResult;
|
|
60
|
+
/**
|
|
61
|
+
* 动画参数接口
|
|
62
|
+
*/
|
|
63
|
+
export interface AnimationOptions {
|
|
64
|
+
/** 动画时长,如 '1s' / '500ms' */
|
|
65
|
+
duration?: string;
|
|
66
|
+
/** 延迟时间 */
|
|
67
|
+
delay?: string;
|
|
68
|
+
/** 重复次数,数字或 'infinite' */
|
|
69
|
+
iterationCount?: number | 'infinite';
|
|
70
|
+
/** 方向 */
|
|
71
|
+
direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
|
72
|
+
/** 填充模式 */
|
|
73
|
+
fillMode?: 'none' | 'forwards' | 'backwards' | 'both';
|
|
74
|
+
/** 缓动函数 */
|
|
75
|
+
timingFunction?: string;
|
|
76
|
+
/** 是否暂停 */
|
|
77
|
+
paused?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 根据动画名称与参数生成 inline `animation` 简写字符串。
|
|
81
|
+
* 用于「样式类模式」下动态控制单个元素。
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* el.style.animation = buildAnimationShorthand('fadeIn', { duration: '0.5s' })
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildAnimationShorthand(name: string, options?: AnimationOptions): string;
|
|
89
|
+
/**
|
|
90
|
+
* 生成可直接用于 `style` 属性的对象形式(camelCase)。
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* html`<div style=${styleMap(getAnimationStyleObject('bounce', { duration: '0.8s' }))}></div>`
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function getAnimationStyleObject(name: string, options?: AnimationOptions): Record<string, string>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { MacAnimation } from './mac-animation';
|
|
2
|
+
export { registerAnimation, getAnimation, hasAnimation, getAnimationNames, getAllAnimations, builtInKeyframes, animationStyleSheet, buildAnimationShorthand, getAnimationStyleObject, BUILT_IN, BUILT_IN_ANIMATION_NAMES, } from './animations';
|
|
3
|
+
export type { AnimationCategory, AnimationDefinition, AnimationOptions } from './animations';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { BaseElement } from '../../internal/base-element';
|
|
3
|
+
/**
|
|
4
|
+
* @tag mac-animation
|
|
5
|
+
* @summary 动画容器组件(高阶组件模式)。
|
|
6
|
+
*
|
|
7
|
+
* 将需要应用动画的目标元素放在 `<mac-animation>` 内部,被包裹内容将自动应用指定动画。
|
|
8
|
+
* 同时支持「样式类模式」—— 导出 `animationStyleSheet` / `buildAnimationShorthand` / `getAnimationStyleObject`。
|
|
9
|
+
*
|
|
10
|
+
* @slot - 需要应用动画的目标内容
|
|
11
|
+
*
|
|
12
|
+
* @event mac-animation-start - 动画开始时触发
|
|
13
|
+
* @event mac-animation-end - 动画结束时触发
|
|
14
|
+
* @event mac-animation-iteration - 动画每次重复时触发
|
|
15
|
+
*
|
|
16
|
+
* @csspart wrapper - 包裹动画内容的容器
|
|
17
|
+
*/
|
|
18
|
+
export declare class MacAnimation extends BaseElement {
|
|
19
|
+
static styles: import("lit").CSSResult[];
|
|
20
|
+
/** 动画类型名称(内置 27 种,或通过 registerAnimation 注册的自定义动画) */
|
|
21
|
+
type: string;
|
|
22
|
+
/** 动画时长,如 '1s' / '500ms' */
|
|
23
|
+
duration: string;
|
|
24
|
+
/** 延迟时间 */
|
|
25
|
+
delay: string;
|
|
26
|
+
/** 重复次数:数字或 'infinite' */
|
|
27
|
+
iterationCount: number | 'infinite';
|
|
28
|
+
/** 动画方向 */
|
|
29
|
+
direction: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
|
30
|
+
/** 填充模式 */
|
|
31
|
+
fillMode: 'none' | 'forwards' | 'backwards' | 'both';
|
|
32
|
+
/** 缓动函数 */
|
|
33
|
+
timingFunction: string;
|
|
34
|
+
/** 是否暂停(暂停 / 继续控制) */
|
|
35
|
+
paused: boolean;
|
|
36
|
+
/** 是否以块级元素渲染(默认 inline-block) */
|
|
37
|
+
block: boolean;
|
|
38
|
+
/** 动画结束后是否自动移除动画样式(便于反复触发) */
|
|
39
|
+
autoClear: boolean;
|
|
40
|
+
private _wrapper;
|
|
41
|
+
/** 用于强制重启动画的内部计数 */
|
|
42
|
+
private _runToken;
|
|
43
|
+
updated(changed: PropertyValues): void;
|
|
44
|
+
/** 当前动画是否可用 */
|
|
45
|
+
private _resolveAnimation;
|
|
46
|
+
/** 计算并应用 inline animation 样式 */
|
|
47
|
+
private _applyAnimation;
|
|
48
|
+
/** 渲染自定义(非内置)动画的 keyframes 到 Shadow DOM */
|
|
49
|
+
private _renderCustomKeyframes;
|
|
50
|
+
render(): import("lit").TemplateResult<1>;
|
|
51
|
+
private _onAnimationStart;
|
|
52
|
+
private _onAnimationIteration;
|
|
53
|
+
private _onAnimationEnd;
|
|
54
|
+
/** 暂停动画 */
|
|
55
|
+
pause(): void;
|
|
56
|
+
/** 继续动画 */
|
|
57
|
+
resume(): void;
|
|
58
|
+
/** 重启动画(从头开始播放一次) */
|
|
59
|
+
restart(): void;
|
|
60
|
+
/** 停止动画并清除样式 */
|
|
61
|
+
stop(): void;
|
|
62
|
+
}
|
|
63
|
+
declare global {
|
|
64
|
+
interface HTMLElementTagNameMap {
|
|
65
|
+
'mac-animation': MacAnimation;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-animation';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const AllAnimations: Story;
|
|
7
|
+
export declare const HOCMode: Story;
|
|
8
|
+
export declare const StyleClassMode: Story;
|
|
9
|
+
export declare const CustomAnimation: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MacButton } from './mac-button';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseElement } from '../../internal/base-element';
|
|
2
|
+
/**
|
|
3
|
+
* @tag mac-button
|
|
4
|
+
* @summary 一个多功能的按钮组件。
|
|
5
|
+
*
|
|
6
|
+
* @slot - 按钮的文本标签。
|
|
7
|
+
* @slot prefix - 标签前的内容。
|
|
8
|
+
* @slot suffix - 标签后的内容。
|
|
9
|
+
*
|
|
10
|
+
* @csspart base - 按钮的基础容器。
|
|
11
|
+
* @csspart label - 按钮的标签。
|
|
12
|
+
* @csspart prefix - 前缀容器。
|
|
13
|
+
* @csspart suffix - 后缀容器。
|
|
14
|
+
*
|
|
15
|
+
* @event mac-click - 点击按钮时触发。
|
|
16
|
+
*/
|
|
17
|
+
export declare class MacButton extends BaseElement {
|
|
18
|
+
static styles: import("lit").CSSResult[];
|
|
19
|
+
/** 按钮的变体样式。 */
|
|
20
|
+
variant: 'primary' | 'secondary' | 'text';
|
|
21
|
+
/** 按钮的尺寸。 */
|
|
22
|
+
size?: 'sm' | 'md' | 'lg';
|
|
23
|
+
/** 禁用按钮。 */
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
/** 显示加载动画。 */
|
|
26
|
+
loading: boolean;
|
|
27
|
+
/** 按钮的类型(表单行为)。 */
|
|
28
|
+
type: 'button' | 'submit' | 'reset';
|
|
29
|
+
willUpdate(): void;
|
|
30
|
+
render(): import("lit").TemplateResult<1>;
|
|
31
|
+
private _handleClick;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
'mac-button': MacButton;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-button';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const Secondary: Story;
|
|
8
|
+
export declare const Text: Story;
|
|
9
|
+
export declare const Small: Story;
|
|
10
|
+
export declare const Large: Story;
|
|
11
|
+
export declare const Disabled: Story;
|
|
12
|
+
export declare const Loading: Story;
|
|
13
|
+
export declare const WithSlots: Story;
|
|
14
|
+
export declare const AllVariants: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MacCard } from './mac-card';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseElement } from '../../internal/base-element';
|
|
2
|
+
/**
|
|
3
|
+
* @tag mac-card
|
|
4
|
+
* @summary macOS 风格的卡片容器组件。
|
|
5
|
+
*
|
|
6
|
+
* @slot - 卡片的主体内容。
|
|
7
|
+
* @slot header - 卡片的头部。
|
|
8
|
+
* @slot footer - 卡片的底部。
|
|
9
|
+
* @slot media - 卡片的媒体区域(顶部)。
|
|
10
|
+
*
|
|
11
|
+
* @csspart base - 卡片的基础容器。
|
|
12
|
+
* @csspart header - 头部容器。
|
|
13
|
+
* @csspart body - 主体容器。
|
|
14
|
+
* @csspart footer - 底部容器。
|
|
15
|
+
* @csspart media - 媒体容器。
|
|
16
|
+
*/
|
|
17
|
+
export declare class MacCard extends BaseElement {
|
|
18
|
+
static styles: import("lit").CSSResult[];
|
|
19
|
+
/** 卡片的视觉变体。 */
|
|
20
|
+
variant: 'default' | 'elevated' | 'glass' | 'outlined' | 'gradient';
|
|
21
|
+
/** 卡片是否有悬停效果。 */
|
|
22
|
+
hoverable: boolean;
|
|
23
|
+
/** 卡片是否可点击。 */
|
|
24
|
+
clickable: boolean;
|
|
25
|
+
/** 显示加载状态。 */
|
|
26
|
+
loading: boolean;
|
|
27
|
+
/** 添加强调边框。 */
|
|
28
|
+
accent?: 'top' | 'left';
|
|
29
|
+
/** 媒体宽高比。 */
|
|
30
|
+
mediaRatio?: '16-9' | '4-3' | '1-1';
|
|
31
|
+
willUpdate(): void;
|
|
32
|
+
render(): import("lit").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
'mac-card': MacCard;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-card';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Variants: Story;
|
|
8
|
+
export declare const WithMedia: Story;
|
|
9
|
+
export declare const HoverableCards: Story;
|
|
10
|
+
export declare const ClickableCards: Story;
|
|
11
|
+
export declare const AccentBorders: Story;
|
|
12
|
+
export declare const LoadingState: Story;
|
|
13
|
+
export declare const CompleteCard: Story;
|
|
14
|
+
export declare const DashboardCards: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MacCarousel, MacCarouselItem } from './mac-carousel';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { BaseElement } from '../../internal/base-element';
|
|
2
|
+
/**
|
|
3
|
+
* @tag mac-carousel-item
|
|
4
|
+
* @summary mac-carousel 的幻灯片项。
|
|
5
|
+
*
|
|
6
|
+
* @slot - 幻灯片内容。
|
|
7
|
+
*/
|
|
8
|
+
export declare class MacCarouselItem extends BaseElement {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
render(): import("lit").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @tag mac-carousel
|
|
14
|
+
* @summary 用于循环展示内容的轮播组件。
|
|
15
|
+
*
|
|
16
|
+
* @slot - 用于放置 mac-carousel-item 元素的默认插槽。
|
|
17
|
+
*
|
|
18
|
+
* @csspart base - 轮播的基础容器。
|
|
19
|
+
* @csspart track - 滑动轨道容器。
|
|
20
|
+
* @csspart arrow - 导航箭头。
|
|
21
|
+
* @csspart dots - 指示器圆点容器。
|
|
22
|
+
* @csspart dot - 单个指示器圆点。
|
|
23
|
+
*
|
|
24
|
+
* @event mac-carousel-change - 当前幻灯片变化时触发。`detail: { index: number, fromIndex: number }`
|
|
25
|
+
*/
|
|
26
|
+
export declare class MacCarousel extends BaseElement {
|
|
27
|
+
static styles: import("lit").CSSResult[];
|
|
28
|
+
/** 当前激活的幻灯片索引(受控模式)。 */
|
|
29
|
+
currentIndex: number;
|
|
30
|
+
/** 默认激活的幻灯片索引(非受控模式)。 */
|
|
31
|
+
defaultIndex: number;
|
|
32
|
+
/** 是否自动播放。 */
|
|
33
|
+
autoplay: boolean;
|
|
34
|
+
/** 自动播放间隔,单位为毫秒。 */
|
|
35
|
+
interval: number;
|
|
36
|
+
/** 是否循环播放。 */
|
|
37
|
+
loop: boolean;
|
|
38
|
+
/** 滑动方向。 */
|
|
39
|
+
direction: 'horizontal' | 'vertical';
|
|
40
|
+
/** 过渡效果。 */
|
|
41
|
+
effect: 'slide' | 'fade' | 'custom';
|
|
42
|
+
/** 每次显示的幻灯片数量。 */
|
|
43
|
+
slidesPerView: number;
|
|
44
|
+
/** 是否显示导航箭头。 */
|
|
45
|
+
showArrow: boolean;
|
|
46
|
+
/** 是否显示指示器圆点。 */
|
|
47
|
+
showDots: boolean;
|
|
48
|
+
/** 指示器圆点样式。 */
|
|
49
|
+
dotType: 'dot' | 'line';
|
|
50
|
+
/** 指示器圆点的位置。 */
|
|
51
|
+
dotPosition: 'top' | 'bottom' | 'left' | 'right';
|
|
52
|
+
/** 轮播是否可拖拽。 */
|
|
53
|
+
draggable: boolean;
|
|
54
|
+
/** 是否支持键盘导航。 */
|
|
55
|
+
keyboard: boolean;
|
|
56
|
+
/** 是否支持鼠标滚轮导航。 */
|
|
57
|
+
wheel: boolean;
|
|
58
|
+
/** 幻灯片过渡时长,单位为毫秒。 */
|
|
59
|
+
transitionDuration: number;
|
|
60
|
+
private _activeIndex;
|
|
61
|
+
private _slideCount;
|
|
62
|
+
private _isDragging;
|
|
63
|
+
private _dragOffset;
|
|
64
|
+
private _track;
|
|
65
|
+
private _autoplayTimer;
|
|
66
|
+
private _dragStartPos;
|
|
67
|
+
private _dragStartIndex;
|
|
68
|
+
private _isWheeling;
|
|
69
|
+
private get _isControlled();
|
|
70
|
+
get _resolvedIndex(): number;
|
|
71
|
+
connectedCallback(): void;
|
|
72
|
+
disconnectedCallback(): void;
|
|
73
|
+
willUpdate(changed: Map<string, unknown>): void;
|
|
74
|
+
updated(changed: Map<string, unknown>): void;
|
|
75
|
+
private _getItems;
|
|
76
|
+
private _updateSlideCount;
|
|
77
|
+
private _initActiveIndex;
|
|
78
|
+
private _handleSlotChange;
|
|
79
|
+
private _applyTransform;
|
|
80
|
+
private _syncFadeActiveClass;
|
|
81
|
+
private _goTo;
|
|
82
|
+
private _prev;
|
|
83
|
+
private _next;
|
|
84
|
+
private _startAutoplay;
|
|
85
|
+
private _stopAutoplay;
|
|
86
|
+
private _handleMouseEnter;
|
|
87
|
+
private _handleMouseLeave;
|
|
88
|
+
private _startDrag;
|
|
89
|
+
private _moveDrag;
|
|
90
|
+
private _endDrag;
|
|
91
|
+
private _onPointerDown;
|
|
92
|
+
private _onPointerMove;
|
|
93
|
+
private _onPointerUp;
|
|
94
|
+
private _handleKeydown;
|
|
95
|
+
private _handleWheel;
|
|
96
|
+
private _renderArrow;
|
|
97
|
+
private _renderDots;
|
|
98
|
+
render(): import("lit").TemplateResult<1>;
|
|
99
|
+
}
|
|
100
|
+
declare global {
|
|
101
|
+
interface HTMLElementTagNameMap {
|
|
102
|
+
'mac-carousel': MacCarousel;
|
|
103
|
+
'mac-carousel-item': MacCarouselItem;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-carousel';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Autoplay: Story;
|
|
8
|
+
export declare const Vertical: Story;
|
|
9
|
+
export declare const FadeEffect: Story;
|
|
10
|
+
export declare const SlidesPerView: Story;
|
|
11
|
+
export declare const DotPositionLeft: Story;
|
|
12
|
+
export declare const NoLoop: Story;
|
|
13
|
+
export declare const NoArrows: Story;
|
|
14
|
+
export declare const NoDots: Story;
|
|
15
|
+
export declare const LineDots: Story;
|
|
16
|
+
export declare const Draggable: Story;
|
|
17
|
+
export declare const Keyboard: Story;
|
|
18
|
+
export declare const Wheel: Story;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { BaseElement } from '../../internal/base-element';
|
|
2
|
+
/**
|
|
3
|
+
* @tag mac-checkbox
|
|
4
|
+
* @summary macOS 风格的复选框组件。
|
|
5
|
+
*
|
|
6
|
+
* @slot - 复选框的标签。
|
|
7
|
+
*
|
|
8
|
+
* @csspart base - 复选框的基础容器。
|
|
9
|
+
* @csspart control - 复选框的控制框。
|
|
10
|
+
* @csspart label - 标签元素。
|
|
11
|
+
*/
|
|
12
|
+
export declare class MacCheckbox extends BaseElement {
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
/** 复选框的值。 */
|
|
15
|
+
value: string;
|
|
16
|
+
/** 复选框是否被选中(受控模式)。 */
|
|
17
|
+
checked: boolean;
|
|
18
|
+
/** 复选框默认是否被选中(非受控模式)。 */
|
|
19
|
+
defaultChecked: boolean;
|
|
20
|
+
/** 复选框是否处于半选状态。 */
|
|
21
|
+
indeterminate: boolean;
|
|
22
|
+
/** 禁用复选框。 */
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
/** 复选框的标签文本。 */
|
|
25
|
+
label: string;
|
|
26
|
+
/** 复选框的尺寸。 */
|
|
27
|
+
size?: 'sm' | 'md' | 'lg';
|
|
28
|
+
private _groupValue?;
|
|
29
|
+
private get _isControlled();
|
|
30
|
+
private get _isChecked();
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
disconnectedCallback(): void;
|
|
33
|
+
private _registerToGroup;
|
|
34
|
+
private _unregisterFromGroup;
|
|
35
|
+
private _findGroup;
|
|
36
|
+
/** 由父组调用以同步值。 */
|
|
37
|
+
_setGroupValue(value: string[] | undefined): void;
|
|
38
|
+
private _handleClick;
|
|
39
|
+
private _handleKeydown;
|
|
40
|
+
render(): import("lit").TemplateResult<1>;
|
|
41
|
+
}
|
|
42
|
+
export interface CheckboxOption {
|
|
43
|
+
value: string;
|
|
44
|
+
label: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @tag mac-checkbox-group
|
|
49
|
+
* @summary macOS 风格的复选框组组件。
|
|
50
|
+
*
|
|
51
|
+
* @slot - 用于放置 mac-checkbox 元素的默认插槽。
|
|
52
|
+
*
|
|
53
|
+
* @csspart base - 组的基础容器。
|
|
54
|
+
*
|
|
55
|
+
* @event mac-change - 选中值变化时触发。
|
|
56
|
+
*/
|
|
57
|
+
export declare class MacCheckboxGroup extends BaseElement {
|
|
58
|
+
static styles: import("lit").CSSResult[];
|
|
59
|
+
/** 组的值(受控模式)。 */
|
|
60
|
+
value: string[];
|
|
61
|
+
/** 默认值(非受控模式)。 */
|
|
62
|
+
defaultValue: string[];
|
|
63
|
+
/** 复选框的 name 属性。 */
|
|
64
|
+
name: string;
|
|
65
|
+
/** 组的尺寸。 */
|
|
66
|
+
size?: 'sm' | 'md' | 'lg';
|
|
67
|
+
/** 禁用组内所有复选框。 */
|
|
68
|
+
disabled: boolean;
|
|
69
|
+
/** 布局方向。 */
|
|
70
|
+
direction: 'horizontal' | 'vertical';
|
|
71
|
+
/** 简化用法时的选项数组。 */
|
|
72
|
+
options?: CheckboxOption[];
|
|
73
|
+
/** 最大可选数量。 */
|
|
74
|
+
max?: number;
|
|
75
|
+
private _checkboxes;
|
|
76
|
+
private get _isControlled();
|
|
77
|
+
private get _resolvedValue();
|
|
78
|
+
connectedCallback(): void;
|
|
79
|
+
updated(): void;
|
|
80
|
+
_registerCheckbox(checkbox: MacCheckbox): void;
|
|
81
|
+
private _applyGroupProps;
|
|
82
|
+
private _applyPropsToCheckbox;
|
|
83
|
+
_unregisterCheckbox(checkbox: MacCheckbox): void;
|
|
84
|
+
_toggleValue(value: string, checked: boolean): void;
|
|
85
|
+
private _syncCheckboxes;
|
|
86
|
+
private _handleSlotChange;
|
|
87
|
+
render(): import("lit").TemplateResult<1>;
|
|
88
|
+
}
|
|
89
|
+
declare global {
|
|
90
|
+
interface HTMLElementTagNameMap {
|
|
91
|
+
'mac-checkbox': MacCheckbox;
|
|
92
|
+
'mac-checkbox-group': MacCheckboxGroup;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-checkbox';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Checked: Story;
|
|
8
|
+
export declare const Indeterminate: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
export declare const Sizes: Story;
|
|
11
|
+
export declare const LabelProp: Story;
|
|
12
|
+
export declare const GroupDefault: Story;
|
|
13
|
+
export declare const GroupVertical: Story;
|
|
14
|
+
export declare const GroupWithOptions: Story;
|
|
15
|
+
export declare const GroupSizes: Story;
|
|
16
|
+
export declare const GroupMax: Story;
|
|
17
|
+
export declare const Controlled: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MacConfigProvider } from './mac-config-provider';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseElement } from '../../internal/base-element';
|
|
2
|
+
/**
|
|
3
|
+
* @tag mac-config-provider
|
|
4
|
+
* @summary 将主题和尺寸设置传递给子组件的配置提供者。
|
|
5
|
+
*
|
|
6
|
+
* @slot - 将继承配置的子组件。
|
|
7
|
+
*/
|
|
8
|
+
export declare class MacConfigProvider extends BaseElement {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
/** 全局主题:'light'、'dark' 或 'auto'(跟随系统偏好)。 */
|
|
11
|
+
theme: 'light' | 'dark';
|
|
12
|
+
/** 全局尺寸:'sm'、'md' 或 'lg'。 */
|
|
13
|
+
size: 'sm' | 'md' | 'lg';
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
updated(changed: Map<string, unknown>): void;
|
|
16
|
+
private _updateDataAttributes;
|
|
17
|
+
render(): import("lit").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
'mac-config-provider': MacConfigProvider;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
import './mac-config-provider';
|
|
3
|
+
import '../button/mac-button';
|
|
4
|
+
import '../input/mac-input';
|
|
5
|
+
import '../select/mac-select';
|
|
6
|
+
import '../number-animation/mac-number-animation';
|
|
7
|
+
declare const meta: Meta;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj;
|
|
10
|
+
export declare const Default: Story;
|
|
11
|
+
export declare const LargeSize: Story;
|
|
12
|
+
export declare const DarkTheme: Story;
|