@qw-ui/core 0.1.0 → 0.2.0-next.0

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.
Files changed (57) hide show
  1. package/dist/avatar/avatar.d.ts +145 -0
  2. package/dist/avatar/index.d.ts +1 -0
  3. package/dist/avatar/index.js +150 -0
  4. package/dist/avatar/index.js.map +1 -0
  5. package/dist/button/button.d.ts +84 -0
  6. package/dist/button/index.d.ts +1 -0
  7. package/dist/button/index.js +104 -0
  8. package/dist/button/index.js.map +1 -0
  9. package/dist/dialog/dialog.d.ts +59 -0
  10. package/dist/dialog/index.d.ts +1 -56
  11. package/dist/dialog/index.js +31 -30
  12. package/dist/dialog/index.js.map +1 -1
  13. package/dist/divider/divider.d.ts +23 -0
  14. package/dist/divider/index.d.ts +1 -0
  15. package/dist/divider/index.js +18 -0
  16. package/dist/divider/index.js.map +1 -0
  17. package/dist/empty/empty.d.ts +12 -0
  18. package/dist/empty/index.d.ts +1 -0
  19. package/dist/empty/index.js +21 -0
  20. package/dist/empty/index.js.map +1 -0
  21. package/dist/icon/icon.d.ts +11 -0
  22. package/dist/icon/index.d.ts +1 -0
  23. package/dist/icon/index.js +20 -0
  24. package/dist/icon/index.js.map +1 -0
  25. package/dist/image/image.d.ts +88 -0
  26. package/dist/image/index.d.ts +1 -0
  27. package/dist/image/index.js +84 -0
  28. package/dist/image/index.js.map +1 -0
  29. package/dist/index.d.ts +22 -4
  30. package/dist/index.js +12 -50
  31. package/dist/loading/index.d.ts +1 -0
  32. package/dist/loading/index.js +19 -0
  33. package/dist/loading/index.js.map +1 -0
  34. package/dist/loading/loading.d.ts +26 -0
  35. package/dist/search-bar/index.d.ts +1 -0
  36. package/dist/search-bar/index.js +252 -0
  37. package/dist/search-bar/index.js.map +1 -0
  38. package/dist/search-bar/search-bar.d.ts +146 -0
  39. package/dist/skeleton/index.d.ts +1 -0
  40. package/dist/skeleton/index.js +28 -0
  41. package/dist/skeleton/index.js.map +1 -0
  42. package/dist/skeleton/skeleton.d.ts +38 -0
  43. package/dist/tabs/index.d.ts +1 -36
  44. package/dist/tabs/index.js +34 -18
  45. package/dist/tabs/index.js.map +1 -1
  46. package/dist/tabs/tabs.d.ts +61 -0
  47. package/dist/toast/index.d.ts +1 -0
  48. package/dist/toast/index.js +44 -0
  49. package/dist/toast/index.js.map +1 -0
  50. package/dist/toast/toast.d.ts +52 -0
  51. package/dist/top-bar/index.d.ts +1 -0
  52. package/dist/top-bar/index.js +43 -0
  53. package/dist/top-bar/index.js.map +1 -0
  54. package/dist/top-bar/top-bar.d.ts +86 -0
  55. package/dist/visual-manifest.d.ts +142 -0
  56. package/package.json +61 -4
  57. package/dist/index.js.map +0 -1
@@ -1,34 +1,35 @@
1
- export { connect, machine as dialogMachine } from '@zag-js/dialog';
2
-
3
- // src/dialog/index.ts
1
+ import { connect, machine as dialogMachine } from "@zag-js/dialog";
2
+ //#region src/dialog/dialog.ts
3
+ /**
4
+ * 把 QwDialogProps 转成 zag dialog machine 的 context (默认值收口 + 命名 rebrand)。
5
+ * 用法:`useMachine(dialogMachine, createDialogProps(props))`。
6
+ */
4
7
  function createDialogProps(props = {}) {
5
- const ctx = {
6
- id: props.id,
7
- open: props.open,
8
- defaultOpen: props.defaultOpen,
9
- role: props.role,
10
- closeOnEscape: props.closeOnEsc !== false,
11
- closeOnInteractOutside: props.closeOnOutside !== false,
12
- preventScroll: props.scrollLock !== false
13
- };
14
- if (props.modal !== void 0) ctx.modal = props.modal;
15
- if (props.onOpenChange) {
16
- const cb = props.onOpenChange;
17
- ctx.onOpenChange = (d) => cb({ open: d.open });
18
- }
19
- if (typeof props.initialFocus === "object") {
20
- const sel = props.initialFocus.selector;
21
- ctx.initialFocusEl = () => document.querySelector(sel);
22
- }
23
- if (typeof props.returnFocus === "object") {
24
- const sel = props.returnFocus.selector;
25
- ctx.finalFocusEl = () => document.querySelector(sel);
26
- } else if (props.returnFocus === "none") {
27
- ctx.restoreFocus = false;
28
- }
29
- return ctx;
8
+ const ctx = {
9
+ id: props.id,
10
+ open: props.open,
11
+ defaultOpen: props.defaultOpen,
12
+ role: props.role,
13
+ closeOnEscape: props.closeOnEsc !== false,
14
+ closeOnInteractOutside: props.closeOnOutside !== false,
15
+ preventScroll: props.scrollLock !== false
16
+ };
17
+ if (props.modal !== void 0) ctx.modal = props.modal;
18
+ if (props.onOpenChange) {
19
+ const cb = props.onOpenChange;
20
+ ctx.onOpenChange = (d) => cb({ open: d.open });
21
+ }
22
+ if (typeof props.initialFocus === "object") {
23
+ const sel = props.initialFocus.selector;
24
+ ctx.initialFocusEl = () => document.querySelector(sel);
25
+ }
26
+ if (typeof props.returnFocus === "object") {
27
+ const sel = props.returnFocus.selector;
28
+ ctx.finalFocusEl = () => document.querySelector(sel);
29
+ } else if (props.returnFocus === "none") ctx.restoreFocus = false;
30
+ return ctx;
30
31
  }
32
+ //#endregion
33
+ export { connect, createDialogProps, dialogMachine };
31
34
 
32
- export { createDialogProps };
33
- //# sourceMappingURL=index.js.map
34
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/dialog/index.ts"],"names":[],"mappings":";;;AAwDO,SAAS,iBAAA,CAAkB,KAAA,GAAuB,EAAC,EAA4B;AACpF,EAAA,MAAM,GAAA,GAA+B;AAAA,IACnC,IAAI,KAAA,CAAM,EAAA;AAAA,IACV,MAAM,KAAA,CAAM,IAAA;AAAA,IACZ,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,MAAM,KAAA,CAAM,IAAA;AAAA,IACZ,aAAA,EAAe,MAAM,UAAA,KAAe,KAAA;AAAA,IACpC,sBAAA,EAAwB,MAAM,cAAA,KAAmB,KAAA;AAAA,IACjD,aAAA,EAAe,MAAM,UAAA,KAAe;AAAA,GACtC;AAEA,EAAA,IAAI,KAAA,CAAM,KAAA,KAAU,MAAA,EAAW,GAAA,CAAI,QAAQ,KAAA,CAAM,KAAA;AAEjD,EAAA,IAAI,MAAM,YAAA,EAAc;AACtB,IAAA,MAAM,KAAK,KAAA,CAAM,YAAA;AACjB,IAAA,GAAA,CAAI,YAAA,GAAe,CAAC,CAAA,KAAyB,EAAA,CAAG,EAAE,IAAA,EAAM,CAAA,CAAE,MAAM,CAAA;AAAA,EAClE;AAGA,EAAA,IAAI,OAAO,KAAA,CAAM,YAAA,KAAiB,QAAA,EAAU;AAC1C,IAAA,MAAM,GAAA,GAAM,MAAM,YAAA,CAAa,QAAA;AAC/B,IAAA,GAAA,CAAI,cAAA,GAAiB,MAAM,QAAA,CAAS,aAAA,CAA2B,GAAG,CAAA;AAAA,EACpE;AAGA,EAAA,IAAI,OAAO,KAAA,CAAM,WAAA,KAAgB,QAAA,EAAU;AACzC,IAAA,MAAM,GAAA,GAAM,MAAM,WAAA,CAAY,QAAA;AAC9B,IAAA,GAAA,CAAI,YAAA,GAAe,MAAM,QAAA,CAAS,aAAA,CAA2B,GAAG,CAAA;AAAA,EAClE,CAAA,MAAA,IAAW,KAAA,CAAM,WAAA,KAAgB,MAAA,EAAQ;AACvC,IAAA,GAAA,CAAI,YAAA,GAAe,KAAA;AAAA,EACrB;AAEA,EAAA,OAAO,GAAA;AACT","file":"index.js","sourcesContent":["import type { Props as ZagDialogProps, OpenChangeDetails } from \"@zag-js/dialog\";\n\n/**\n * QwDialogProps — Dialog 的用户输入。\n *\n * 对 zag.js 输入做两件事 (§06):\n * 1. 默认值收口:closeOnEsc / closeOnOutside / scrollLock 默认全 true;\n * 2. 命名 rebrand:把 zag 的 closeOnInteractOutside / preventScroll 改成业务易懂命名;\n * 3. 业务 props 透出:onOpenChange / initialFocus / returnFocus 在 React/Vue 同名。\n *\n * 业务方只需 import 本类型,不需要直接 import `@zag-js/*`。\n */\nexport interface QwDialogProps {\n /** 唯一 id 前缀;不传时由 zag 安全生成 (SSR/CSR 一致)。 */\n id?: string;\n /** 受控开关。 */\n open?: boolean;\n /** 非受控初值。 */\n defaultOpen?: boolean;\n /** ESC 关闭,默认 true (zag 原名 closeOnEscape)。 */\n closeOnEsc?: boolean;\n /** 点击 backdrop 关闭,默认 true (zag 原名 closeOnInteractOutside)。 */\n closeOnOutside?: boolean;\n /** 滚动锁,默认 true (zag 原名 preventScroll)。 */\n scrollLock?: boolean;\n /** 模态遮蔽,默认 true。 */\n modal?: boolean;\n /** 角色,默认 dialog。 */\n role?: \"dialog\" | \"alertdialog\";\n /** 初始焦点策略;对象形式提供 selector,由 core 翻译成 zag 的 initialFocusEl。 */\n initialFocus?: \"autofocus\" | \"first\" | \"none\" | { selector: string };\n /** 关闭回焦策略;对应 zag 的 restoreFocus + finalFocusEl。 */\n returnFocus?: \"previous\" | \"none\" | { selector: string };\n /** 状态变化回调;zag 原生 onOpenChange。 */\n onOpenChange?: (e: { open: boolean }) => void;\n /**\n * 禁用 trigger:禁用后点击/键盘都不打开。\n * adapter 层声明式属性(落到原生 button[disabled])——zag dialog 无此 context,不进 machine。\n */\n disabled?: boolean;\n}\n\n/**\n * 直接 re-export zag 的 dialog machine 与 connect —— 不再包一层。\n * machine 由各框架 useMachine 消费;connect 把 service 接成 prop-getter。\n * 用 re-export 而非 `const x = dialog.x` 以保留原始可移植类型 (避免 TS2742)。\n */\nexport { machine as dialogMachine, connect } from \"@zag-js/dialog\";\n\n/** rebrand zag 的 DialogApi 类型对外。 */\nexport type { Api as QwDialogApi } from \"@zag-js/dialog\";\n\n/**\n * 把 QwDialogProps 转成 zag dialog machine 的 context (默认值收口 + 命名 rebrand)。\n * 用法:`useMachine(dialogMachine, createDialogProps(props))`。\n */\nexport function createDialogProps(props: QwDialogProps = {}): Partial<ZagDialogProps> {\n const ctx: Partial<ZagDialogProps> = {\n id: props.id,\n open: props.open,\n defaultOpen: props.defaultOpen,\n role: props.role,\n closeOnEscape: props.closeOnEsc !== false,\n closeOnInteractOutside: props.closeOnOutside !== false,\n preventScroll: props.scrollLock !== false,\n };\n\n if (props.modal !== undefined) ctx.modal = props.modal;\n\n if (props.onOpenChange) {\n const cb = props.onOpenChange;\n ctx.onOpenChange = (d: OpenChangeDetails) => cb({ open: d.open });\n }\n\n // initialFocus: { selector } → initialFocusEl 回调;'none' 关闭自动聚焦\n if (typeof props.initialFocus === \"object\") {\n const sel = props.initialFocus.selector;\n ctx.initialFocusEl = () => document.querySelector<HTMLElement>(sel);\n }\n\n // returnFocus: { selector } → finalFocusEl;'none' → restoreFocus=false\n if (typeof props.returnFocus === \"object\") {\n const sel = props.returnFocus.selector;\n ctx.finalFocusEl = () => document.querySelector<HTMLElement>(sel);\n } else if (props.returnFocus === \"none\") {\n ctx.restoreFocus = false;\n }\n\n return ctx;\n}\n"]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/dialog/dialog.ts"],"sourcesContent":["import type { Props as ZagDialogProps, OpenChangeDetails } from \"@zag-js/dialog\";\n\n/**\n * QwDialogProps — Dialog 的用户输入。\n *\n * 对 zag.js 输入做两件事 (§06):\n * 1. 默认值收口:closeOnEsc / closeOnOutside / scrollLock 默认全 true;\n * 2. 命名 rebrand:把 zag 的 closeOnInteractOutside / preventScroll 改成业务易懂命名;\n * 3. 业务 props 透出:onOpenChange / initialFocus / returnFocus 在 React/Vue 同名。\n *\n * 业务方只需 import 本类型,不需要直接 import `@zag-js/*`。\n */\nexport interface QwDialogProps {\n /** 唯一 id 前缀;不传时由 zag 安全生成 (SSR/CSR 一致)。 */\n id?: string;\n /** 受控开关。 */\n open?: boolean;\n /** 非受控初值。 */\n defaultOpen?: boolean;\n /** ESC 关闭,默认 true (zag 原名 closeOnEscape)。 */\n closeOnEsc?: boolean;\n /** 点击 backdrop 关闭,默认 true (zag 原名 closeOnInteractOutside)。 */\n closeOnOutside?: boolean;\n /** 滚动锁,默认 true (zag 原名 preventScroll)。 */\n scrollLock?: boolean;\n /** 模态遮蔽,默认 true。 */\n modal?: boolean;\n /** 角色,默认 dialog。 */\n role?: \"dialog\" | \"alertdialog\";\n /** 初始焦点策略;对象形式提供 selector,由 core 翻译成 zag 的 initialFocusEl。 */\n initialFocus?: \"autofocus\" | \"first\" | \"none\" | { selector: string };\n /** 关闭回焦策略;对应 zag 的 restoreFocus + finalFocusEl。 */\n returnFocus?: \"previous\" | \"none\" | { selector: string };\n /** 状态变化回调;zag 原生 onOpenChange。 */\n onOpenChange?: (e: { open: boolean }) => void;\n /**\n * 禁用 trigger:禁用后点击/键盘都不打开。\n * adapter 层声明式属性(落到原生 button[disabled])——zag dialog 无此 context,不进 machine。\n */\n disabled?: boolean;\n}\n\n/**\n * 直接 re-export zag 的 dialog machine 与 connect —— 不再包一层。\n * machine 由各框架 useMachine 消费;connect 把 service 接成 prop-getter。\n * 用 re-export 而非 `const x = dialog.x` 以保留原始可移植类型 (避免 TS2742)。\n */\nexport { machine as dialogMachine, connect } from \"@zag-js/dialog\";\n\n/** rebrand zag 的 DialogApi 类型对外。 */\nexport type { Api as QwDialogApi } from \"@zag-js/dialog\";\n\n/**\n * 把 QwDialogProps 转成 zag dialog machine 的 context (默认值收口 + 命名 rebrand)。\n * 用法:`useMachine(dialogMachine, createDialogProps(props))`。\n */\nexport function createDialogProps(props: QwDialogProps = {}): Partial<ZagDialogProps> {\n const ctx: Partial<ZagDialogProps> = {\n id: props.id,\n open: props.open,\n defaultOpen: props.defaultOpen,\n role: props.role,\n closeOnEscape: props.closeOnEsc !== false,\n closeOnInteractOutside: props.closeOnOutside !== false,\n preventScroll: props.scrollLock !== false,\n };\n\n if (props.modal !== undefined) ctx.modal = props.modal;\n\n if (props.onOpenChange) {\n const cb = props.onOpenChange;\n ctx.onOpenChange = (d: OpenChangeDetails) => cb({ open: d.open });\n }\n\n // initialFocus: { selector } → initialFocusEl 回调;'none' 关闭自动聚焦\n if (typeof props.initialFocus === \"object\") {\n const sel = props.initialFocus.selector;\n ctx.initialFocusEl = () => document.querySelector<HTMLElement>(sel);\n }\n\n // returnFocus: { selector } → finalFocusEl;'none' → restoreFocus=false\n if (typeof props.returnFocus === \"object\") {\n const sel = props.returnFocus.selector;\n ctx.finalFocusEl = () => document.querySelector<HTMLElement>(sel);\n } else if (props.returnFocus === \"none\") {\n ctx.restoreFocus = false;\n }\n\n return ctx;\n}\n"],"mappings":";;;;;;AAwDA,SAAgB,kBAAkB,QAAuB,CAAC,GAA4B;CACpF,MAAM,MAA+B;EACnC,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,aAAa,MAAM;EACnB,MAAM,MAAM;EACZ,eAAe,MAAM,eAAe;EACpC,wBAAwB,MAAM,mBAAmB;EACjD,eAAe,MAAM,eAAe;CACtC;CAEA,IAAI,MAAM,UAAU,KAAA,GAAW,IAAI,QAAQ,MAAM;CAEjD,IAAI,MAAM,cAAc;EACtB,MAAM,KAAK,MAAM;EACjB,IAAI,gBAAgB,MAAyB,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC;CAClE;CAGA,IAAI,OAAO,MAAM,iBAAiB,UAAU;EAC1C,MAAM,MAAM,MAAM,aAAa;EAC/B,IAAI,uBAAuB,SAAS,cAA2B,GAAG;CACpE;CAGA,IAAI,OAAO,MAAM,gBAAgB,UAAU;EACzC,MAAM,MAAM,MAAM,YAAY;EAC9B,IAAI,qBAAqB,SAAS,cAA2B,GAAG;CAClE,OAAO,IAAI,MAAM,gBAAgB,QAC/B,IAAI,eAAe;CAGrB,OAAO;AACT"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Divider 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。
3
+ * 渲染契约:`role="separator"`,`data-scope="divider"`,`data-part="root"`;
4
+ * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。
5
+ *
6
+ * 方向 / 粗细词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
7
+ */
8
+ /** 方向全集:horizontal 水平(默认)/ vertical 垂直。 */
9
+ export declare const DIVIDER_ORIENTATIONS: readonly ["horizontal", "vertical"];
10
+ /** 粗细全集:thin 细 1px(默认)/ thick 粗 2px。 */
11
+ export declare const DIVIDER_WEIGHTS: readonly ["thin", "thick"];
12
+ /** Divider 各渲染部位全集(data-part 取值)。 */
13
+ export declare const DIVIDER_PARTS: readonly ["root"];
14
+ export type DividerOrientation = (typeof DIVIDER_ORIENTATIONS)[number];
15
+ export type DividerWeight = (typeof DIVIDER_WEIGHTS)[number];
16
+ export type DividerPart = (typeof DIVIDER_PARTS)[number];
17
+ /** QwDividerProps — 双栈共享的行为契约(全字段可选)。 */
18
+ export interface QwDividerProps {
19
+ /** 方向,默认 horizontal。 */
20
+ orientation?: DividerOrientation;
21
+ /** 粗细,默认 thin(细,1px)。 */
22
+ weight?: DividerWeight;
23
+ }
@@ -0,0 +1 @@
1
+ export * from "./divider.js";
@@ -0,0 +1,18 @@
1
+ //#region src/divider/divider.ts
2
+ /**
3
+ * Divider 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。
4
+ * 渲染契约:`role="separator"`,`data-scope="divider"`,`data-part="root"`;
5
+ * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。
6
+ *
7
+ * 方向 / 粗细词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
8
+ */
9
+ /** 方向全集:horizontal 水平(默认)/ vertical 垂直。 */
10
+ const DIVIDER_ORIENTATIONS = ["horizontal", "vertical"];
11
+ /** 粗细全集:thin 细 1px(默认)/ thick 粗 2px。 */
12
+ const DIVIDER_WEIGHTS = ["thin", "thick"];
13
+ /** Divider 各渲染部位全集(data-part 取值)。 */
14
+ const DIVIDER_PARTS = ["root"];
15
+ //#endregion
16
+ export { DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS };
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/divider/divider.ts"],"sourcesContent":["/**\n * Divider 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。\n * 渲染契约:`role=\"separator\"`,`data-scope=\"divider\"`,`data-part=\"root\"`;\n * `data-orientation` / `data-weight` 摊平枚举,`vertical` 额外输出 `aria-orientation`。\n *\n * 方向 / 粗细词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。\n */\n\n/** 方向全集:horizontal 水平(默认)/ vertical 垂直。 */\nexport const DIVIDER_ORIENTATIONS = [\"horizontal\", \"vertical\"] as const;\n\n/** 粗细全集:thin 细 1px(默认)/ thick 粗 2px。 */\nexport const DIVIDER_WEIGHTS = [\"thin\", \"thick\"] as const;\n\n/** Divider 各渲染部位全集(data-part 取值)。 */\nexport const DIVIDER_PARTS = [\"root\"] as const;\n\nexport type DividerOrientation = (typeof DIVIDER_ORIENTATIONS)[number];\nexport type DividerWeight = (typeof DIVIDER_WEIGHTS)[number];\nexport type DividerPart = (typeof DIVIDER_PARTS)[number];\n\n/** QwDividerProps — 双栈共享的行为契约(全字段可选)。 */\nexport interface QwDividerProps {\n /** 方向,默认 horizontal。 */\n orientation?: DividerOrientation;\n /** 粗细,默认 thin(细,1px)。 */\n weight?: DividerWeight;\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,uBAAuB,CAAC,cAAc,UAAU;;AAG7D,MAAa,kBAAkB,CAAC,QAAQ,OAAO;;AAG/C,MAAa,gBAAgB,CAAC,MAAM"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Empty 契约 — 原型 A(无状态),core 无 machine 也无共享枚举。
3
+ * 本目录是 Empty 的"源头锚点":契约文档与 demo 清单在 ./docs/ 下维护,
4
+ * 双栈实现(React props / Vue props+slots)必须与 docs 清单严格对齐。
5
+ * 渲染契约:`data-scope="empty"`,data-part 为 root / icon / title / description / actions。
6
+ *
7
+ * data-part 词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
8
+ */
9
+ /** Empty 各渲染部位全集(data-part 取值),双栈与 styles-core 共用。 */
10
+ export declare const EMPTY_PARTS: readonly ["root", "icon", "title", "description", "actions"];
11
+ /** Empty 各渲染部位(data-part 取值)。 */
12
+ export type EmptyPart = (typeof EMPTY_PARTS)[number];
@@ -0,0 +1 @@
1
+ export * from "./empty.js";
@@ -0,0 +1,21 @@
1
+ //#region src/empty/empty.ts
2
+ /**
3
+ * Empty 契约 — 原型 A(无状态),core 无 machine 也无共享枚举。
4
+ * 本目录是 Empty 的"源头锚点":契约文档与 demo 清单在 ./docs/ 下维护,
5
+ * 双栈实现(React props / Vue props+slots)必须与 docs 清单严格对齐。
6
+ * 渲染契约:`data-scope="empty"`,data-part 为 root / icon / title / description / actions。
7
+ *
8
+ * data-part 词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
9
+ */
10
+ /** Empty 各渲染部位全集(data-part 取值),双栈与 styles-core 共用。 */
11
+ const EMPTY_PARTS = [
12
+ "root",
13
+ "icon",
14
+ "title",
15
+ "description",
16
+ "actions"
17
+ ];
18
+ //#endregion
19
+ export { EMPTY_PARTS };
20
+
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/empty/empty.ts"],"sourcesContent":["/**\n * Empty 契约 — 原型 A(无状态),core 无 machine 也无共享枚举。\n * 本目录是 Empty 的\"源头锚点\":契约文档与 demo 清单在 ./docs/ 下维护,\n * 双栈实现(React props / Vue props+slots)必须与 docs 清单严格对齐。\n * 渲染契约:`data-scope=\"empty\"`,data-part 为 root / icon / title / description / actions。\n *\n * data-part 词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。\n */\n\n/** Empty 各渲染部位全集(data-part 取值),双栈与 styles-core 共用。 */\nexport const EMPTY_PARTS = [\"root\", \"icon\", \"title\", \"description\", \"actions\"] as const;\n\n/** Empty 各渲染部位(data-part 取值)。 */\nexport type EmptyPart = (typeof EMPTY_PARTS)[number];\n"],"mappings":";;;;;;;;;;AAUA,MAAa,cAAc;CAAC;CAAQ;CAAQ;CAAS;CAAe;AAAS"}
@@ -0,0 +1,11 @@
1
+ import { ICON_FALLBACK_NAME, type IconName, type IconNameInput } from "@qw-ui/icons/runtime";
2
+ /** Icon 根部件的共享 data-part 词表。 */
3
+ export declare const ICON_PARTS: readonly ["root"];
4
+ export type IconPart = (typeof ICON_PARTS)[number];
5
+ export type { IconName, IconNameInput };
6
+ export { ICON_FALLBACK_NAME };
7
+ /**
8
+ * 把动态输入收敛为系统内的稳定名称。未知值始终回退到 component,
9
+ * 只在开发环境记录诊断,避免远端配置错误中断渲染。
10
+ */
11
+ export declare function resolveIconName(name: IconNameInput): IconName;
@@ -0,0 +1 @@
1
+ export * from "./icon.js";
@@ -0,0 +1,20 @@
1
+ import { ICON_FALLBACK_NAME, ICON_NAME_SET } from "@qw-ui/icons/runtime";
2
+ //#region src/icon/icon.ts
3
+ /** Icon 根部件的共享 data-part 词表。 */
4
+ const ICON_PARTS = ["root"];
5
+ function isProductionBuild() {
6
+ return globalThis.process?.env?.NODE_ENV === "production";
7
+ }
8
+ /**
9
+ * 把动态输入收敛为系统内的稳定名称。未知值始终回退到 component,
10
+ * 只在开发环境记录诊断,避免远端配置错误中断渲染。
11
+ */
12
+ function resolveIconName(name) {
13
+ if (ICON_NAME_SET.has(name)) return name;
14
+ if (!isProductionBuild()) console.warn(`[qw-ui] Unknown icon name "${name}". Falling back to "${ICON_FALLBACK_NAME}".`);
15
+ return ICON_FALLBACK_NAME;
16
+ }
17
+ //#endregion
18
+ export { ICON_FALLBACK_NAME, ICON_PARTS, resolveIconName };
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["runtime"],"sources":["../../src/icon/icon.ts"],"sourcesContent":["import {\n ICON_FALLBACK_NAME,\n ICON_NAME_SET,\n type IconName,\n type IconNameInput,\n} from \"@qw-ui/icons/runtime\";\n\n/** Icon 根部件的共享 data-part 词表。 */\nexport const ICON_PARTS = [\"root\"] as const;\nexport type IconPart = (typeof ICON_PARTS)[number];\n\nexport type { IconName, IconNameInput };\nexport { ICON_FALLBACK_NAME };\n\nfunction isProductionBuild(): boolean {\n const runtime = globalThis as typeof globalThis & {\n process?: { env?: Record<string, string | undefined> };\n };\n return runtime.process?.env?.NODE_ENV === \"production\";\n}\n\n/**\n * 把动态输入收敛为系统内的稳定名称。未知值始终回退到 component,\n * 只在开发环境记录诊断,避免远端配置错误中断渲染。\n */\nexport function resolveIconName(name: IconNameInput): IconName {\n if (ICON_NAME_SET.has(name as IconName)) return name as IconName;\n if (!isProductionBuild()) {\n console.warn(`[qw-ui] Unknown icon name \"${name}\". Falling back to \"${ICON_FALLBACK_NAME}\".`);\n }\n return ICON_FALLBACK_NAME;\n}\n"],"mappings":";;;AAQA,MAAa,aAAa,CAAC,MAAM;AAMjC,SAAS,oBAA6B;CAIpC,OAAOA,WAAQ,SAAS,KAAK,aAAa;AAC5C;;;;;AAMA,SAAgB,gBAAgB,MAA+B;CAC7D,IAAI,cAAc,IAAI,IAAgB,GAAG,OAAO;CAChD,IAAI,CAAC,kBAAkB,GACrB,QAAQ,KAAK,8BAA8B,KAAK,sBAAsB,mBAAmB,GAAG;CAE9F,OAAO;AACT"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Image 的跨框架行为契约。
3
+ *
4
+ * Image 是无状态的 Prototype A:Core 归一化 props、推导降级模式,
5
+ * 生成 root/placeholder/image/fallback 的 data 属性。React/Vue 适配器只投影
6
+ * 内容通道并渲染固定 DOM。图片加载状态通过 `data-load-status` 属性由 CSS
7
+ * 声明式管理,不参与 Core 状态归一化。与 Avatar 的 `data-load-status` 模式一致。
8
+ */
9
+ export declare const IMAGE_FITS: readonly ["cover", "contain", "fill", "none", "scale-down"];
10
+ export declare const IMAGE_PARTS: readonly ["root", "image", "placeholder", "fallback"];
11
+ export declare const IMAGE_LOAD_STATUS: readonly ["loading", "loaded", "error"];
12
+ export type ImageFit = (typeof IMAGE_FITS)[number];
13
+ export type ImagePart = (typeof IMAGE_PARTS)[number];
14
+ export type ImageLoadStatus = (typeof IMAGE_LOAD_STATUS)[number];
15
+ /** 双栈共享的标量 props;框架特有的内容通道不进入 Core。 */
16
+ export interface QwImageProps {
17
+ /** 图片源地址。空字符串或 undefined 时不渲染 img,直接进入降级。 */
18
+ src?: string;
19
+ /** 替代文本。传入时作为 img alt 属性;未传入时默认空字符串(装饰性图片)。 */
20
+ alt?: string;
21
+ /** object-fit 模式,默认 `cover`。 */
22
+ fit?: ImageFit;
23
+ /** 是否启用原生懒加载,默认 `false`。 */
24
+ lazy?: boolean;
25
+ /** 容器宽度(string | number)。 */
26
+ width?: string | number;
27
+ /** 容器高度(string | number)。 */
28
+ height?: string | number;
29
+ /** 图片加载成功回调。 */
30
+ onLoad?: () => void;
31
+ /** 图片加载失败回调。 */
32
+ onError?: () => void;
33
+ }
34
+ /** 由各框架的内容通道存在性计算;不检查 DOM 或 VNode 内容。 */
35
+ export interface ImageContentPresence {
36
+ /** 是否提供有效 `src`(非空字符串)。 */
37
+ hasSrc: boolean;
38
+ /** 是否提供自定义 placeholder。 */
39
+ hasPlaceholder: boolean;
40
+ /** 是否提供自定义 fallback。 */
41
+ hasFallback: boolean;
42
+ /** 是否提供子元素(覆盖层)。 */
43
+ hasChildren: boolean;
44
+ }
45
+ /** 适配器唯一可消费的归一化结果。 */
46
+ export interface ResolvedImageState {
47
+ fit: ImageFit;
48
+ hasSrc: boolean;
49
+ hasPlaceholder: boolean;
50
+ hasFallback: boolean;
51
+ hasChildren: boolean;
52
+ lazy: boolean;
53
+ /** 初始加载状态(有 src 时 `loading`,无 src 时 `error`)。 */
54
+ initialLoadStatus: ImageLoadStatus;
55
+ }
56
+ /** Core 生成、由适配器覆盖到根元素的属性。 */
57
+ export interface ImageRootProps {
58
+ "data-scope": "image";
59
+ "data-part": "root";
60
+ "data-fit": ImageFit;
61
+ "data-load-status": ImageLoadStatus;
62
+ }
63
+ /** Core 生成、由适配器覆盖到 placeholder 元素的属性。 */
64
+ export interface ImagePlaceholderProps {
65
+ "data-scope": "image";
66
+ "data-part": "placeholder";
67
+ }
68
+ /** Core 生成、由适配器覆盖到图片包装元素的属性。 */
69
+ export interface ImageImageProps {
70
+ "data-scope": "image";
71
+ "data-part": "image";
72
+ }
73
+ /** Core 生成、由适配器覆盖到降级内容元素的属性。 */
74
+ export interface ImageFallbackProps {
75
+ "data-scope": "image";
76
+ "data-part": "fallback";
77
+ "data-fallback": "default" | "custom";
78
+ }
79
+ /** 将公开输入和内容通道归一化为唯一的跨框架状态。 */
80
+ export declare function resolveImageState(props?: QwImageProps, presence?: ImageContentPresence): ResolvedImageState;
81
+ /** 将归一化结果转成 root 属性。 */
82
+ export declare function getImageRootProps(state: ResolvedImageState): ImageRootProps;
83
+ /** 将归一化结果转成 placeholder 元素的属性。 */
84
+ export declare function getImagePlaceholderProps(): ImagePlaceholderProps;
85
+ /** 将归一化结果转成图片包装元素的属性。 */
86
+ export declare function getImageImageProps(_state: ResolvedImageState): ImageImageProps;
87
+ /** 将归一化结果转成降级内容元素的属性。 */
88
+ export declare function getImageFallbackProps(state: ResolvedImageState): ImageFallbackProps;
@@ -0,0 +1 @@
1
+ export * from "./image.js";
@@ -0,0 +1,84 @@
1
+ //#region src/image/image.ts
2
+ /**
3
+ * Image 的跨框架行为契约。
4
+ *
5
+ * Image 是无状态的 Prototype A:Core 归一化 props、推导降级模式,
6
+ * 生成 root/placeholder/image/fallback 的 data 属性。React/Vue 适配器只投影
7
+ * 内容通道并渲染固定 DOM。图片加载状态通过 `data-load-status` 属性由 CSS
8
+ * 声明式管理,不参与 Core 状态归一化。与 Avatar 的 `data-load-status` 模式一致。
9
+ */
10
+ const IMAGE_FITS = [
11
+ "cover",
12
+ "contain",
13
+ "fill",
14
+ "none",
15
+ "scale-down"
16
+ ];
17
+ const IMAGE_PARTS = [
18
+ "root",
19
+ "image",
20
+ "placeholder",
21
+ "fallback"
22
+ ];
23
+ const IMAGE_LOAD_STATUS = [
24
+ "loading",
25
+ "loaded",
26
+ "error"
27
+ ];
28
+ const EMPTY_PRESENCE = {
29
+ hasSrc: false,
30
+ hasPlaceholder: false,
31
+ hasFallback: false,
32
+ hasChildren: false
33
+ };
34
+ /** 将公开输入和内容通道归一化为唯一的跨框架状态。 */
35
+ function resolveImageState(props = {}, presence = EMPTY_PRESENCE) {
36
+ const hasSrc = presence.hasSrc;
37
+ const hasPlaceholder = presence.hasPlaceholder;
38
+ const hasFallback = presence.hasFallback;
39
+ const hasChildren = presence.hasChildren;
40
+ return {
41
+ fit: props.fit ?? "cover",
42
+ hasSrc,
43
+ hasPlaceholder,
44
+ hasFallback,
45
+ hasChildren,
46
+ lazy: props.lazy ?? false,
47
+ initialLoadStatus: hasSrc ? "loading" : "error"
48
+ };
49
+ }
50
+ /** 将归一化结果转成 root 属性。 */
51
+ function getImageRootProps(state) {
52
+ return {
53
+ "data-scope": "image",
54
+ "data-part": "root",
55
+ "data-fit": state.fit,
56
+ "data-load-status": state.initialLoadStatus
57
+ };
58
+ }
59
+ /** 将归一化结果转成 placeholder 元素的属性。 */
60
+ function getImagePlaceholderProps() {
61
+ return {
62
+ "data-scope": "image",
63
+ "data-part": "placeholder"
64
+ };
65
+ }
66
+ /** 将归一化结果转成图片包装元素的属性。 */
67
+ function getImageImageProps(_state) {
68
+ return {
69
+ "data-scope": "image",
70
+ "data-part": "image"
71
+ };
72
+ }
73
+ /** 将归一化结果转成降级内容元素的属性。 */
74
+ function getImageFallbackProps(state) {
75
+ return {
76
+ "data-scope": "image",
77
+ "data-part": "fallback",
78
+ "data-fallback": state.hasFallback ? "custom" : "default"
79
+ };
80
+ }
81
+ //#endregion
82
+ export { IMAGE_FITS, IMAGE_LOAD_STATUS, IMAGE_PARTS, getImageFallbackProps, getImageImageProps, getImagePlaceholderProps, getImageRootProps, resolveImageState };
83
+
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/image/image.ts"],"sourcesContent":["/**\n * Image 的跨框架行为契约。\n *\n * Image 是无状态的 Prototype A:Core 归一化 props、推导降级模式,\n * 生成 root/placeholder/image/fallback 的 data 属性。React/Vue 适配器只投影\n * 内容通道并渲染固定 DOM。图片加载状态通过 `data-load-status` 属性由 CSS\n * 声明式管理,不参与 Core 状态归一化。与 Avatar 的 `data-load-status` 模式一致。\n */\n\nexport const IMAGE_FITS = [\"cover\", \"contain\", \"fill\", \"none\", \"scale-down\"] as const;\nexport const IMAGE_PARTS = [\"root\", \"image\", \"placeholder\", \"fallback\"] as const;\nexport const IMAGE_LOAD_STATUS = [\"loading\", \"loaded\", \"error\"] as const;\n\nexport type ImageFit = (typeof IMAGE_FITS)[number];\nexport type ImagePart = (typeof IMAGE_PARTS)[number];\nexport type ImageLoadStatus = (typeof IMAGE_LOAD_STATUS)[number];\n\n/** 双栈共享的标量 props;框架特有的内容通道不进入 Core。 */\nexport interface QwImageProps {\n /** 图片源地址。空字符串或 undefined 时不渲染 img,直接进入降级。 */\n src?: string;\n /** 替代文本。传入时作为 img alt 属性;未传入时默认空字符串(装饰性图片)。 */\n alt?: string;\n /** object-fit 模式,默认 `cover`。 */\n fit?: ImageFit;\n /** 是否启用原生懒加载,默认 `false`。 */\n lazy?: boolean;\n /** 容器宽度(string | number)。 */\n width?: string | number;\n /** 容器高度(string | number)。 */\n height?: string | number;\n /** 图片加载成功回调。 */\n onLoad?: () => void;\n /** 图片加载失败回调。 */\n onError?: () => void;\n}\n\n/** 由各框架的内容通道存在性计算;不检查 DOM 或 VNode 内容。 */\nexport interface ImageContentPresence {\n /** 是否提供有效 `src`(非空字符串)。 */\n hasSrc: boolean;\n /** 是否提供自定义 placeholder。 */\n hasPlaceholder: boolean;\n /** 是否提供自定义 fallback。 */\n hasFallback: boolean;\n /** 是否提供子元素(覆盖层)。 */\n hasChildren: boolean;\n}\n\n/** 适配器唯一可消费的归一化结果。 */\nexport interface ResolvedImageState {\n fit: ImageFit;\n hasSrc: boolean;\n hasPlaceholder: boolean;\n hasFallback: boolean;\n hasChildren: boolean;\n lazy: boolean;\n /** 初始加载状态(有 src 时 `loading`,无 src 时 `error`)。 */\n initialLoadStatus: ImageLoadStatus;\n}\n\n/** Core 生成、由适配器覆盖到根元素的属性。 */\nexport interface ImageRootProps {\n \"data-scope\": \"image\";\n \"data-part\": \"root\";\n \"data-fit\": ImageFit;\n \"data-load-status\": ImageLoadStatus;\n}\n\n/** Core 生成、由适配器覆盖到 placeholder 元素的属性。 */\nexport interface ImagePlaceholderProps {\n \"data-scope\": \"image\";\n \"data-part\": \"placeholder\";\n}\n\n/** Core 生成、由适配器覆盖到图片包装元素的属性。 */\nexport interface ImageImageProps {\n \"data-scope\": \"image\";\n \"data-part\": \"image\";\n}\n\n/** Core 生成、由适配器覆盖到降级内容元素的属性。 */\nexport interface ImageFallbackProps {\n \"data-scope\": \"image\";\n \"data-part\": \"fallback\";\n \"data-fallback\": \"default\" | \"custom\";\n}\n\nconst EMPTY_PRESENCE: ImageContentPresence = {\n hasSrc: false,\n hasPlaceholder: false,\n hasFallback: false,\n hasChildren: false,\n};\n\n/** 将公开输入和内容通道归一化为唯一的跨框架状态。 */\nexport function resolveImageState(\n props: QwImageProps = {},\n presence: ImageContentPresence = EMPTY_PRESENCE,\n): ResolvedImageState {\n const hasSrc = presence.hasSrc;\n const hasPlaceholder = presence.hasPlaceholder;\n const hasFallback = presence.hasFallback;\n const hasChildren = presence.hasChildren;\n\n return {\n fit: props.fit ?? \"cover\",\n hasSrc,\n hasPlaceholder,\n hasFallback,\n hasChildren,\n lazy: props.lazy ?? false,\n initialLoadStatus: hasSrc ? \"loading\" : \"error\",\n };\n}\n\n/** 将归一化结果转成 root 属性。 */\nexport function getImageRootProps(state: ResolvedImageState): ImageRootProps {\n return {\n \"data-scope\": \"image\",\n \"data-part\": \"root\",\n \"data-fit\": state.fit,\n \"data-load-status\": state.initialLoadStatus,\n };\n}\n\n/** 将归一化结果转成 placeholder 元素的属性。 */\nexport function getImagePlaceholderProps(): ImagePlaceholderProps {\n return {\n \"data-scope\": \"image\",\n \"data-part\": \"placeholder\",\n };\n}\n\n/** 将归一化结果转成图片包装元素的属性。 */\nexport function getImageImageProps(_state: ResolvedImageState): ImageImageProps {\n return {\n \"data-scope\": \"image\",\n \"data-part\": \"image\",\n };\n}\n\n/** 将归一化结果转成降级内容元素的属性。 */\nexport function getImageFallbackProps(state: ResolvedImageState): ImageFallbackProps {\n return {\n \"data-scope\": \"image\",\n \"data-part\": \"fallback\",\n \"data-fallback\": state.hasFallback ? \"custom\" : \"default\",\n };\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,aAAa;CAAC;CAAS;CAAW;CAAQ;CAAQ;AAAY;AAC3E,MAAa,cAAc;CAAC;CAAQ;CAAS;CAAe;AAAU;AACtE,MAAa,oBAAoB;CAAC;CAAW;CAAU;AAAO;AA6E9D,MAAM,iBAAuC;CAC3C,QAAQ;CACR,gBAAgB;CAChB,aAAa;CACb,aAAa;AACf;;AAGA,SAAgB,kBACd,QAAsB,CAAC,GACvB,WAAiC,gBACb;CACpB,MAAM,SAAS,SAAS;CACxB,MAAM,iBAAiB,SAAS;CAChC,MAAM,cAAc,SAAS;CAC7B,MAAM,cAAc,SAAS;CAE7B,OAAO;EACL,KAAK,MAAM,OAAO;EAClB;EACA;EACA;EACA;EACA,MAAM,MAAM,QAAQ;EACpB,mBAAmB,SAAS,YAAY;CAC1C;AACF;;AAGA,SAAgB,kBAAkB,OAA2C;CAC3E,OAAO;EACL,cAAc;EACd,aAAa;EACb,YAAY,MAAM;EAClB,oBAAoB,MAAM;CAC5B;AACF;;AAGA,SAAgB,2BAAkD;CAChE,OAAO;EACL,cAAc;EACd,aAAa;CACf;AACF;;AAGA,SAAgB,mBAAmB,QAA6C;CAC9E,OAAO;EACL,cAAc;EACd,aAAa;CACf;AACF;;AAGA,SAAgB,sBAAsB,OAA+C;CACnF,OAAO;EACL,cAAc;EACd,aAAa;EACb,iBAAiB,MAAM,cAAc,WAAW;CAClD;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,22 @@
1
- export { QwDialogProps, createDialogProps } from './dialog/index.js';
2
- export { QwTabsProps, createTabsProps } from './tabs/index.js';
3
- export { Api as QwDialogApi, connect, machine as dialogMachine } from '@zag-js/dialog';
4
- export { Api as QwTabsApi, machine as tabsMachine } from '@zag-js/tabs';
1
+ export { dialogMachine, connect, createDialogProps, } from "./dialog/index.js";
2
+ export type { QwDialogProps, QwDialogApi } from "./dialog/index.js";
3
+ export { tabsMachine, createTabsProps } from "./tabs/index.js";
4
+ export type { QwTabsProps, QwTabsApi } from "./tabs/index.js";
5
+ export { TOAST_POSITIONS, TOAST_ICON_TYPES, TOAST_PARTS, DEFAULT_TOAST_DURATION, DEFAULT_TOAST_POSITION, isToastIconType, resolveToastDuration, } from "./toast/index.js";
6
+ export type { QwToastOptions, QwToast, QwToastPosition, QwToastIconType, QwToastPart, } from "./toast/index.js";
7
+ export { BUTTON_ICON_POSITIONS, BUTTON_PARTS, BUTTON_SHAPES, BUTTON_SIZES, BUTTON_TONES, BUTTON_VARIANTS, getButtonRootProps, resolveButtonState, } from "./button/index.js";
8
+ export type { ButtonContentPresence, ButtonIconPosition, ButtonPart, ButtonRootProps, ButtonShape, ResolvedButtonState, ButtonVariant, ButtonTone, ButtonSize, QwButtonProps, } from "./button/index.js";
9
+ export { LOADING_SIZES } from "./loading/index.js";
10
+ export type { LoadingSize, QwLoadingProps } from "./loading/index.js";
11
+ export { SKELETON_VARIANTS, SKELETON_ANIMATIONS, SKELETON_RADII, SKELETON_PARTS, } from "./skeleton/index.js";
12
+ export type { SkeletonVariant, SkeletonAnimation, SkeletonRadius, SkeletonPart, QwSkeletonProps, } from "./skeleton/index.js";
13
+ export { DIVIDER_ORIENTATIONS, DIVIDER_WEIGHTS, DIVIDER_PARTS, } from "./divider/index.js";
14
+ export type { DividerOrientation, DividerWeight, DividerPart, QwDividerProps, } from "./divider/index.js";
15
+ export { EMPTY_PARTS } from "./empty/index.js";
16
+ export type { EmptyPart } from "./empty/index.js";
17
+ export { createTopBarProps, TOPBAR_VARIANTS, } from "./top-bar/index.js";
18
+ export type { TopBarVariant, TopBarItem, QwTopBarProps, ResolvedTopBarProps, } from "./top-bar/index.js";
19
+ export { ICON_FALLBACK_NAME, ICON_PARTS, resolveIconName } from "./icon/index.js";
20
+ export type { IconName, IconNameInput, IconPart } from "./icon/index.js";
21
+ export { AVATAR_BADGE_TYPES, AVATAR_LOAD_STATUS, AVATAR_PARTS, AVATAR_SHAPES, AVATAR_SIZES, BADGE_COUNT_MAX, extractInitials, getAvatarBadgeProps, getAvatarFallbackProps, getAvatarImageElementProps, getAvatarImageProps, getAvatarRootProps, resolveAvatarState, } from "./avatar/index.js";
22
+ export type { AvatarBadgeProps, AvatarContentPresence, AvatarFallbackProps, AvatarImageElementProps, AvatarImageProps, AvatarLoadStatus, AvatarPart, AvatarRootProps, AvatarShape, AvatarSize, BadgeConfig, BadgeType, FallbackMode, QwAvatarProps, ResolvedAvatarState, } from "./avatar/index.js";
package/dist/index.js CHANGED
@@ -1,50 +1,12 @@
1
- export { connect, machine as dialogMachine } from '@zag-js/dialog';
2
- export { machine as tabsMachine } from '@zag-js/tabs';
3
-
4
- // src/dialog/index.ts
5
- function createDialogProps(props = {}) {
6
- const ctx = {
7
- id: props.id,
8
- open: props.open,
9
- defaultOpen: props.defaultOpen,
10
- role: props.role,
11
- closeOnEscape: props.closeOnEsc !== false,
12
- closeOnInteractOutside: props.closeOnOutside !== false,
13
- preventScroll: props.scrollLock !== false
14
- };
15
- if (props.modal !== void 0) ctx.modal = props.modal;
16
- if (props.onOpenChange) {
17
- const cb = props.onOpenChange;
18
- ctx.onOpenChange = (d) => cb({ open: d.open });
19
- }
20
- if (typeof props.initialFocus === "object") {
21
- const sel = props.initialFocus.selector;
22
- ctx.initialFocusEl = () => document.querySelector(sel);
23
- }
24
- if (typeof props.returnFocus === "object") {
25
- const sel = props.returnFocus.selector;
26
- ctx.finalFocusEl = () => document.querySelector(sel);
27
- } else if (props.returnFocus === "none") {
28
- ctx.restoreFocus = false;
29
- }
30
- return ctx;
31
- }
32
- function createTabsProps(props = {}) {
33
- const ctx = {
34
- id: props.id,
35
- value: props.value,
36
- defaultValue: props.defaultValue,
37
- orientation: props.orientation,
38
- activationMode: props.activationMode,
39
- loopFocus: props.loop !== false
40
- };
41
- if (props.onValueChange) {
42
- const cb = props.onValueChange;
43
- ctx.onValueChange = (d) => cb({ value: d.value });
44
- }
45
- return ctx;
46
- }
47
-
48
- export { createDialogProps, createTabsProps };
49
- //# sourceMappingURL=index.js.map
50
- //# sourceMappingURL=index.js.map
1
+ import { connect, createDialogProps, dialogMachine } from "./dialog/index.js";
2
+ import { createTabsProps, tabsMachine } from "./tabs/index.js";
3
+ import { DEFAULT_TOAST_DURATION, DEFAULT_TOAST_POSITION, TOAST_ICON_TYPES, TOAST_PARTS, TOAST_POSITIONS, isToastIconType, resolveToastDuration } from "./toast/index.js";
4
+ import { BUTTON_ICON_POSITIONS, BUTTON_PARTS, BUTTON_SHAPES, BUTTON_SIZES, BUTTON_TONES, BUTTON_VARIANTS, getButtonRootProps, resolveButtonState } from "./button/index.js";
5
+ import { LOADING_SIZES } from "./loading/index.js";
6
+ import { SKELETON_ANIMATIONS, SKELETON_PARTS, SKELETON_RADII, SKELETON_VARIANTS } from "./skeleton/index.js";
7
+ import { DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS } from "./divider/index.js";
8
+ import { EMPTY_PARTS } from "./empty/index.js";
9
+ import { TOPBAR_VARIANTS, createTopBarProps } from "./top-bar/index.js";
10
+ import { ICON_FALLBACK_NAME, ICON_PARTS, resolveIconName } from "./icon/index.js";
11
+ import { AVATAR_BADGE_TYPES, AVATAR_LOAD_STATUS, AVATAR_PARTS, AVATAR_SHAPES, AVATAR_SIZES, BADGE_COUNT_MAX, extractInitials, getAvatarBadgeProps, getAvatarFallbackProps, getAvatarImageElementProps, getAvatarImageProps, getAvatarRootProps, resolveAvatarState } from "./avatar/index.js";
12
+ export { AVATAR_BADGE_TYPES, AVATAR_LOAD_STATUS, AVATAR_PARTS, AVATAR_SHAPES, AVATAR_SIZES, BADGE_COUNT_MAX, BUTTON_ICON_POSITIONS, BUTTON_PARTS, BUTTON_SHAPES, BUTTON_SIZES, BUTTON_TONES, BUTTON_VARIANTS, DEFAULT_TOAST_DURATION, DEFAULT_TOAST_POSITION, DIVIDER_ORIENTATIONS, DIVIDER_PARTS, DIVIDER_WEIGHTS, EMPTY_PARTS, ICON_FALLBACK_NAME, ICON_PARTS, LOADING_SIZES, SKELETON_ANIMATIONS, SKELETON_PARTS, SKELETON_RADII, SKELETON_VARIANTS, TOAST_ICON_TYPES, TOAST_PARTS, TOAST_POSITIONS, TOPBAR_VARIANTS, connect, createDialogProps, createTabsProps, createTopBarProps, dialogMachine, extractInitials, getAvatarBadgeProps, getAvatarFallbackProps, getAvatarImageElementProps, getAvatarImageProps, getAvatarRootProps, getButtonRootProps, isToastIconType, resolveAvatarState, resolveButtonState, resolveIconName, resolveToastDuration, tabsMachine };
@@ -0,0 +1 @@
1
+ export * from "./loading.js";
@@ -0,0 +1,19 @@
1
+ //#region src/loading/loading.ts
2
+ /**
3
+ * Loading 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。
4
+ * 可访问性契约:`role="status"` + `aria-live="polite"`;无文案时兜底
5
+ * `aria-label="Loading"` 保证可访问名;spinner 纯 CSS 动画并尊重
6
+ * `prefers-reduced-motion`。
7
+ *
8
+ * 尺寸词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
9
+ */
10
+ /** spinner 尺寸全集:sm / md(默认)/ lg。 */
11
+ const LOADING_SIZES = [
12
+ "sm",
13
+ "md",
14
+ "lg"
15
+ ];
16
+ //#endregion
17
+ export { LOADING_SIZES };
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/loading/loading.ts"],"sourcesContent":["/**\n * Loading 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。\n * 可访问性契约:`role=\"status\"` + `aria-live=\"polite\"`;无文案时兜底\n * `aria-label=\"Loading\"` 保证可访问名;spinner 纯 CSS 动画并尊重\n * `prefers-reduced-motion`。\n *\n * 尺寸词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。\n */\n\n/** spinner 尺寸全集:sm / md(默认)/ lg。 */\nexport const LOADING_SIZES = [\"sm\", \"md\", \"lg\"] as const;\n\n/** spinner 尺寸。 */\nexport type LoadingSize = (typeof LOADING_SIZES)[number];\n\n/**\n * QwLoadingProps — 双栈共享的行为契约。`label` 的富内容形式是框架特有\n * (React 收 `ReactNode`,Vue 走 default slot),此处以基础文案 `string` 收口契约。\n */\nexport interface QwLoadingProps {\n /** spinner 尺寸,默认 md。 */\n size?: LoadingSize;\n /** 块级居中占位(整页/区域加载)。 */\n block?: boolean;\n /** 加载文案(显示于 logo 下方,并作为可访问名)。 */\n label?: string;\n /** 带白底浮层卡片(内边距 + 圆角 + 阴影)。 */\n surface?: boolean;\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,gBAAgB;CAAC;CAAM;CAAM;AAAI"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Loading 契约 — 原型 A(无状态),core 无 machine,只承载双栈共享的类型契约。
3
+ * 可访问性契约:`role="status"` + `aria-live="polite"`;无文案时兜底
4
+ * `aria-label="Loading"` 保证可访问名;spinner 纯 CSS 动画并尊重
5
+ * `prefers-reduced-motion`。
6
+ *
7
+ * 尺寸词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
8
+ */
9
+ /** spinner 尺寸全集:sm / md(默认)/ lg。 */
10
+ export declare const LOADING_SIZES: readonly ["sm", "md", "lg"];
11
+ /** spinner 尺寸。 */
12
+ export type LoadingSize = (typeof LOADING_SIZES)[number];
13
+ /**
14
+ * QwLoadingProps — 双栈共享的行为契约。`label` 的富内容形式是框架特有
15
+ * (React 收 `ReactNode`,Vue 走 default slot),此处以基础文案 `string` 收口契约。
16
+ */
17
+ export interface QwLoadingProps {
18
+ /** spinner 尺寸,默认 md。 */
19
+ size?: LoadingSize;
20
+ /** 块级居中占位(整页/区域加载)。 */
21
+ block?: boolean;
22
+ /** 加载文案(显示于 logo 下方,并作为可访问名)。 */
23
+ label?: string;
24
+ /** 带白底浮层卡片(内边距 + 圆角 + 阴影)。 */
25
+ surface?: boolean;
26
+ }
@@ -0,0 +1 @@
1
+ export * from "./search-bar.js";