@qw-ui/core 0.3.0-next.19 → 0.3.0-next.20

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/dist/index.d.ts CHANGED
@@ -34,3 +34,5 @@ export { STEPPER_SIZES, STEPPER_PARTS, clampStepperValue, getStepperRootProps, g
34
34
  export type { StepperPart, StepperSize, QwStepperProps, ResolvedStepperState, StepperRootProps, StepperDecrementProps, StepperIncrementProps, StepperValueProps, } from "./stepper/index.js";
35
35
  export { BADGE_KINDS, BADGE_PARTS, BADGE_VARIANTS, DEFAULT_BADGE_MAX_COUNT, getBadgeRootProps, resolveBadgeState, } from "./badge/index.js";
36
36
  export type { BadgeAriaTexts, BadgeKind, BadgePart, BadgeRootProps, BadgeVariant, QwBadgeProps, ResolvedBadgeState, } from "./badge/index.js";
37
+ export { TABBAR_ITEM_TONES, TABBAR_ITEM_VARIANTS, TABBAR_PARTS, getTabBarItemButtonProps, getTabBarRootProps, resolveTabBarState, } from "./tabbar/index.js";
38
+ export type { QwTabBarItemProps, QwTabBarProps, ResolvedTabBarItemState, ResolvedTabBarState, TabBarItemButtonProps, TabBarItemTone, TabBarItemVariant, TabBarPart, TabBarRootProps, } from "./tabbar/index.js";
package/dist/index.js CHANGED
@@ -16,4 +16,5 @@ import { createInputProps } from "./input/index.js";
16
16
  import { SWITCH_PARTS, getSwitchRootProps, getSwitchThumbProps, resolveSwitchState } from "./switch/index.js";
17
17
  import { STEPPER_PARTS, STEPPER_SIZES, clampStepperValue, getStepperDecrementProps, getStepperDecrementValue, getStepperIncrementProps, getStepperIncrementValue, getStepperRootProps, getStepperValueProps, resolveStepperState } from "./stepper/index.js";
18
18
  import { BADGE_KINDS, BADGE_PARTS, BADGE_VARIANTS, DEFAULT_BADGE_MAX_COUNT, getBadgeRootProps, resolveBadgeState } from "./badge/index.js";
19
- export { AVATAR_BADGE_TYPES, AVATAR_LOAD_STATUS, AVATAR_PARTS, AVATAR_SHAPES, AVATAR_SIZES, BADGE_COUNT_MAX, BADGE_KINDS, BADGE_PARTS, BADGE_VARIANTS, BUTTON_ICON_POSITIONS, BUTTON_PARTS, BUTTON_SHAPES, BUTTON_SIZES, BUTTON_TONES, BUTTON_VARIANTS, DEFAULT_BADGE_MAX_COUNT, DEFAULT_OVERLAY_PANEL_HEADER_HEIGHT, DEFAULT_TOAST_DURATION, DEFAULT_TOAST_POSITION, DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS, EMPTY_PARTS, ICON_FALLBACK_NAME, ICON_PARTS, LOADING_SIZES, OVERLAY_PANEL_PARTS, SKELETON_ANIMATIONS, SKELETON_PARTS, SKELETON_RADII, SKELETON_VARIANTS, STEPPER_PARTS, STEPPER_SIZES, SWITCH_PARTS, TAG_PARTS, TAG_SIZES, TAG_VARIANTS, TOAST_ICON_TYPES, TOAST_PARTS, TOAST_POSITIONS, TOPBAR_VARIANTS, clampStepperValue, connect, createDialogProps, createInputProps, createTabsProps, createTextAreaProps, createTopBarProps, dialogMachine, extractInitials, getAvatarBadgeProps, getAvatarFallbackProps, getAvatarImageElementProps, getAvatarImageProps, getAvatarRootProps, getBadgeRootProps, getButtonRootProps, getStepperDecrementProps, getStepperDecrementValue, getStepperIncrementProps, getStepperIncrementValue, getStepperRootProps, getStepperValueProps, getSwitchRootProps, getSwitchThumbProps, isToastIconType, resolveAvatarState, resolveBadgeState, resolveButtonState, resolveIconName, resolveOverlayPanelHeight, resolveStepperState, resolveSwitchState, resolveToastDuration, tabsMachine, connect$1 as textAreaConnect, machine as textAreaMachine };
19
+ import { TABBAR_ITEM_TONES, TABBAR_ITEM_VARIANTS, TABBAR_PARTS, getTabBarItemButtonProps, getTabBarRootProps, resolveTabBarState } from "./tabbar/index.js";
20
+ export { AVATAR_BADGE_TYPES, AVATAR_LOAD_STATUS, AVATAR_PARTS, AVATAR_SHAPES, AVATAR_SIZES, BADGE_COUNT_MAX, BADGE_KINDS, BADGE_PARTS, BADGE_VARIANTS, BUTTON_ICON_POSITIONS, BUTTON_PARTS, BUTTON_SHAPES, BUTTON_SIZES, BUTTON_TONES, BUTTON_VARIANTS, DEFAULT_BADGE_MAX_COUNT, DEFAULT_OVERLAY_PANEL_HEADER_HEIGHT, DEFAULT_TOAST_DURATION, DEFAULT_TOAST_POSITION, DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS, EMPTY_PARTS, ICON_FALLBACK_NAME, ICON_PARTS, LOADING_SIZES, OVERLAY_PANEL_PARTS, SKELETON_ANIMATIONS, SKELETON_PARTS, SKELETON_RADII, SKELETON_VARIANTS, STEPPER_PARTS, STEPPER_SIZES, SWITCH_PARTS, TABBAR_ITEM_TONES, TABBAR_ITEM_VARIANTS, TABBAR_PARTS, TAG_PARTS, TAG_SIZES, TAG_VARIANTS, TOAST_ICON_TYPES, TOAST_PARTS, TOAST_POSITIONS, TOPBAR_VARIANTS, clampStepperValue, connect, createDialogProps, createInputProps, createTabsProps, createTextAreaProps, createTopBarProps, dialogMachine, extractInitials, getAvatarBadgeProps, getAvatarFallbackProps, getAvatarImageElementProps, getAvatarImageProps, getAvatarRootProps, getBadgeRootProps, getButtonRootProps, getStepperDecrementProps, getStepperDecrementValue, getStepperIncrementProps, getStepperIncrementValue, getStepperRootProps, getStepperValueProps, getSwitchRootProps, getSwitchThumbProps, getTabBarItemButtonProps, getTabBarRootProps, isToastIconType, resolveAvatarState, resolveBadgeState, resolveButtonState, resolveIconName, resolveOverlayPanelHeight, resolveStepperState, resolveSwitchState, resolveTabBarState, resolveToastDuration, tabsMachine, connect$1 as textAreaConnect, machine as textAreaMachine };
@@ -0,0 +1 @@
1
+ export * from "./tabbar.js";
@@ -0,0 +1,50 @@
1
+ //#region src/tabbar/tabbar.ts
2
+ /**
3
+ * TabBar 的跨框架行为契约。
4
+ *
5
+ * TabBar 是无状态的 Prototype A 底部操作栏:白底容器 + 顶部 1px 分割线 +
6
+ * 1–N 个等宽 L 号按钮(组合已交付的 Button)。这里仅归一化公开 props 与
7
+ * item → Button 的档位映射,React/Vue 适配器不得复制可见性、默认档位或
8
+ * 映射规则。
9
+ */
10
+ const TABBAR_ITEM_VARIANTS = ["primary", "secondary"];
11
+ const TABBAR_ITEM_TONES = ["brand", "neutral"];
12
+ const TABBAR_PARTS = ["root"];
13
+ /** 将公开输入归一化为唯一的跨框架状态;items 缺省/空 → 不可见。 */
14
+ function resolveTabBarState(props = {}) {
15
+ const items = (props.items ?? []).map((item) => ({
16
+ text: item.text,
17
+ variant: item.variant ?? "primary",
18
+ tone: item.tone ?? "brand",
19
+ disabled: item.disabled ?? false,
20
+ loading: item.loading ?? false,
21
+ ...item.onClick ? { onClick: item.onClick } : {}
22
+ }));
23
+ return {
24
+ visible: items.length > 0,
25
+ count: items.length,
26
+ items
27
+ };
28
+ }
29
+ /** 将归一化结果转成 root 属性。 */
30
+ function getTabBarRootProps(state) {
31
+ return {
32
+ "data-scope": "tabbar",
33
+ "data-part": "root",
34
+ "data-count": String(state.count)
35
+ };
36
+ }
37
+ /** 将单个操作项映射为 Button props(档位收口,适配器不得覆盖)。 */
38
+ function getTabBarItemButtonProps(item) {
39
+ return {
40
+ variant: item.variant === "primary" ? "solid" : "soft",
41
+ tone: item.tone,
42
+ size: "l",
43
+ disabled: item.disabled,
44
+ loading: item.loading
45
+ };
46
+ }
47
+ //#endregion
48
+ export { TABBAR_ITEM_TONES, TABBAR_ITEM_VARIANTS, TABBAR_PARTS, getTabBarItemButtonProps, getTabBarRootProps, resolveTabBarState };
49
+
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/tabbar/tabbar.ts"],"sourcesContent":["/**\n * TabBar 的跨框架行为契约。\n *\n * TabBar 是无状态的 Prototype A 底部操作栏:白底容器 + 顶部 1px 分割线 +\n * 1–N 个等宽 L 号按钮(组合已交付的 Button)。这里仅归一化公开 props 与\n * item → Button 的档位映射,React/Vue 适配器不得复制可见性、默认档位或\n * 映射规则。\n */\n\nexport const TABBAR_ITEM_VARIANTS = [\"primary\", \"secondary\"] as const;\nexport const TABBAR_ITEM_TONES = [\"brand\", \"neutral\"] as const;\nexport const TABBAR_PARTS = [\"root\"] as const;\n\nexport type TabBarItemVariant = (typeof TABBAR_ITEM_VARIANTS)[number];\nexport type TabBarItemTone = (typeof TABBAR_ITEM_TONES)[number];\nexport type TabBarPart = (typeof TABBAR_PARTS)[number];\n\n/** 单个操作项声明;双栈共享,框架特有的事件通道不进入 Core。 */\nexport interface QwTabBarItemProps {\n /** 按钮文案,同时作为可访问名。 */\n text: string;\n /** 视觉档位,默认 `primary`。primary→Button solid;secondary→Button soft。 */\n variant?: TabBarItemVariant;\n /** 语气,默认 `brand`。 */\n tone?: TabBarItemTone;\n /** 原生禁用状态。 */\n disabled?: boolean;\n /** 忙碌态,沿用 Button loading 契约。 */\n loading?: boolean;\n /** 点击(含键盘激活)回调。 */\n onClick?: () => void;\n}\n\n/** 双栈共享的标量 props。 */\nexport interface QwTabBarProps {\n /** 操作项列表;缺省或空数组时组件不渲染。 */\n items?: readonly QwTabBarItemProps[];\n}\n\n/** 逐项归一化结果。 */\nexport interface ResolvedTabBarItemState {\n text: string;\n variant: TabBarItemVariant;\n tone: TabBarItemTone;\n disabled: boolean;\n loading: boolean;\n onClick?: () => void;\n}\n\n/** 适配器唯一可消费的归一化结果。 */\nexport interface ResolvedTabBarState {\n visible: boolean;\n count: number;\n items: ResolvedTabBarItemState[];\n}\n\n/** Core 生成、由适配器摊到根元素的属性。 */\nexport interface TabBarRootProps {\n \"data-scope\": \"tabbar\";\n \"data-part\": \"root\";\n \"data-count\": string;\n}\n\n/** item → Button 的档位映射结果(size 固定 l)。 */\nexport interface TabBarItemButtonProps {\n variant: \"solid\" | \"soft\";\n tone: \"brand\" | \"neutral\";\n size: \"l\";\n disabled: boolean;\n loading: boolean;\n}\n\n/** 将公开输入归一化为唯一的跨框架状态;items 缺省/空 → 不可见。 */\nexport function resolveTabBarState(props: QwTabBarProps = {}): ResolvedTabBarState {\n const items = (props.items ?? []).map((item) => ({\n text: item.text,\n variant: item.variant ?? \"primary\",\n tone: item.tone ?? \"brand\",\n disabled: item.disabled ?? false,\n loading: item.loading ?? false,\n ...(item.onClick ? { onClick: item.onClick } : {}),\n }));\n return {\n visible: items.length > 0,\n count: items.length,\n items,\n };\n}\n\n/** 将归一化结果转成 root 属性。 */\nexport function getTabBarRootProps(state: ResolvedTabBarState): TabBarRootProps {\n return {\n \"data-scope\": \"tabbar\",\n \"data-part\": \"root\",\n \"data-count\": String(state.count),\n };\n}\n\n/** 将单个操作项映射为 Button props(档位收口,适配器不得覆盖)。 */\nexport function getTabBarItemButtonProps(item: ResolvedTabBarItemState): TabBarItemButtonProps {\n return {\n variant: item.variant === \"primary\" ? \"solid\" : \"soft\",\n tone: item.tone,\n size: \"l\",\n disabled: item.disabled,\n loading: item.loading,\n };\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,uBAAuB,CAAC,WAAW,WAAW;AAC3D,MAAa,oBAAoB,CAAC,SAAS,SAAS;AACpD,MAAa,eAAe,CAAC,MAAM;;AA8DnC,SAAgB,mBAAmB,QAAuB,CAAC,GAAwB;CACjF,MAAM,SAAS,MAAM,SAAS,CAAC,EAAA,CAAG,KAAK,UAAU;EAC/C,MAAM,KAAK;EACX,SAAS,KAAK,WAAW;EACzB,MAAM,KAAK,QAAQ;EACnB,UAAU,KAAK,YAAY;EAC3B,SAAS,KAAK,WAAW;EACzB,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC;CAClD,EAAE;CACF,OAAO;EACL,SAAS,MAAM,SAAS;EACxB,OAAO,MAAM;EACb;CACF;AACF;;AAGA,SAAgB,mBAAmB,OAA6C;CAC9E,OAAO;EACL,cAAc;EACd,aAAa;EACb,cAAc,OAAO,MAAM,KAAK;CAClC;AACF;;AAGA,SAAgB,yBAAyB,MAAsD;CAC7F,OAAO;EACL,SAAS,KAAK,YAAY,YAAY,UAAU;EAChD,MAAM,KAAK;EACX,MAAM;EACN,UAAU,KAAK;EACf,SAAS,KAAK;CAChB;AACF"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * TabBar 的跨框架行为契约。
3
+ *
4
+ * TabBar 是无状态的 Prototype A 底部操作栏:白底容器 + 顶部 1px 分割线 +
5
+ * 1–N 个等宽 L 号按钮(组合已交付的 Button)。这里仅归一化公开 props 与
6
+ * item → Button 的档位映射,React/Vue 适配器不得复制可见性、默认档位或
7
+ * 映射规则。
8
+ */
9
+ export declare const TABBAR_ITEM_VARIANTS: readonly ["primary", "secondary"];
10
+ export declare const TABBAR_ITEM_TONES: readonly ["brand", "neutral"];
11
+ export declare const TABBAR_PARTS: readonly ["root"];
12
+ export type TabBarItemVariant = (typeof TABBAR_ITEM_VARIANTS)[number];
13
+ export type TabBarItemTone = (typeof TABBAR_ITEM_TONES)[number];
14
+ export type TabBarPart = (typeof TABBAR_PARTS)[number];
15
+ /** 单个操作项声明;双栈共享,框架特有的事件通道不进入 Core。 */
16
+ export interface QwTabBarItemProps {
17
+ /** 按钮文案,同时作为可访问名。 */
18
+ text: string;
19
+ /** 视觉档位,默认 `primary`。primary→Button solid;secondary→Button soft。 */
20
+ variant?: TabBarItemVariant;
21
+ /** 语气,默认 `brand`。 */
22
+ tone?: TabBarItemTone;
23
+ /** 原生禁用状态。 */
24
+ disabled?: boolean;
25
+ /** 忙碌态,沿用 Button loading 契约。 */
26
+ loading?: boolean;
27
+ /** 点击(含键盘激活)回调。 */
28
+ onClick?: () => void;
29
+ }
30
+ /** 双栈共享的标量 props。 */
31
+ export interface QwTabBarProps {
32
+ /** 操作项列表;缺省或空数组时组件不渲染。 */
33
+ items?: readonly QwTabBarItemProps[];
34
+ }
35
+ /** 逐项归一化结果。 */
36
+ export interface ResolvedTabBarItemState {
37
+ text: string;
38
+ variant: TabBarItemVariant;
39
+ tone: TabBarItemTone;
40
+ disabled: boolean;
41
+ loading: boolean;
42
+ onClick?: () => void;
43
+ }
44
+ /** 适配器唯一可消费的归一化结果。 */
45
+ export interface ResolvedTabBarState {
46
+ visible: boolean;
47
+ count: number;
48
+ items: ResolvedTabBarItemState[];
49
+ }
50
+ /** Core 生成、由适配器摊到根元素的属性。 */
51
+ export interface TabBarRootProps {
52
+ "data-scope": "tabbar";
53
+ "data-part": "root";
54
+ "data-count": string;
55
+ }
56
+ /** item → Button 的档位映射结果(size 固定 l)。 */
57
+ export interface TabBarItemButtonProps {
58
+ variant: "solid" | "soft";
59
+ tone: "brand" | "neutral";
60
+ size: "l";
61
+ disabled: boolean;
62
+ loading: boolean;
63
+ }
64
+ /** 将公开输入归一化为唯一的跨框架状态;items 缺省/空 → 不可见。 */
65
+ export declare function resolveTabBarState(props?: QwTabBarProps): ResolvedTabBarState;
66
+ /** 将归一化结果转成 root 属性。 */
67
+ export declare function getTabBarRootProps(state: ResolvedTabBarState): TabBarRootProps;
68
+ /** 将单个操作项映射为 Button props(档位收口,适配器不得覆盖)。 */
69
+ export declare function getTabBarItemButtonProps(item: ResolvedTabBarItemState): TabBarItemButtonProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qw-ui/core",
3
- "version": "0.3.0-next.19",
3
+ "version": "0.3.0-next.20",
4
4
  "description": "L2 · Headless Core — zag.js machine 薄包装,纯 TS / SSR-safe,零样式。",
5
5
  "license": "MIT",
6
6
  "author": "qw-ui contributors",
@@ -107,6 +107,10 @@
107
107
  "./badge": {
108
108
  "types": "./dist/badge/index.d.ts",
109
109
  "import": "./dist/badge/index.js"
110
+ },
111
+ "./tabbar": {
112
+ "types": "./dist/tabbar/index.d.ts",
113
+ "import": "./dist/tabbar/index.js"
110
114
  }
111
115
  },
112
116
  "sideEffects": false,
@@ -115,7 +119,7 @@
115
119
  "@zag-js/dialog": "^1.42.0",
116
120
  "@zag-js/tabs": "^1.42.0",
117
121
  "@zag-js/utils": "1.42.0",
118
- "@qw-ui/icons": "^0.3.0-next.19"
122
+ "@qw-ui/icons": "^0.3.0-next.20"
119
123
  },
120
124
  "devDependencies": {
121
125
  "@microsoft/api-extractor": "^7.58.9",