@hebium-ui/preact 0.1.0-alpha.2 → 0.1.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.
Files changed (75) hide show
  1. package/dist/components/alert/alert.d.ts +3 -6
  2. package/dist/components/alert/alert.js +7 -15
  3. package/dist/components/alert/alert.js.map +1 -1
  4. package/dist/components/anchor/anchor.d.ts +1 -4
  5. package/dist/components/anchor/anchor.js +5 -6
  6. package/dist/components/anchor/anchor.js.map +1 -1
  7. package/dist/components/avatar/avatar.d.ts +7 -6
  8. package/dist/components/avatar/avatar.js +16 -19
  9. package/dist/components/avatar/avatar.js.map +1 -1
  10. package/dist/components/blockquote/blockquote.d.ts +2 -5
  11. package/dist/components/blockquote/blockquote.js +5 -6
  12. package/dist/components/blockquote/blockquote.js.map +1 -1
  13. package/dist/components/button/button.d.ts +12 -4
  14. package/dist/components/button/button.js +31 -12
  15. package/dist/components/button/button.js.map +1 -1
  16. package/dist/components/checkbox/checkbox.d.ts +31 -0
  17. package/dist/components/checkbox/checkbox.js +84 -0
  18. package/dist/components/checkbox/checkbox.js.map +1 -0
  19. package/dist/components/checkbox/index.d.ts +2 -0
  20. package/dist/components/code/code.d.ts +8 -0
  21. package/dist/components/code/code.js +20 -0
  22. package/dist/components/code/code.js.map +1 -0
  23. package/dist/components/code/index.d.ts +2 -0
  24. package/dist/components/details/details.d.ts +19 -0
  25. package/dist/components/details/details.js +27 -0
  26. package/dist/components/details/details.js.map +1 -0
  27. package/dist/components/details/index.d.ts +2 -0
  28. package/dist/components/dialog/dialog.context.js +15 -0
  29. package/dist/components/dialog/dialog.context.js.map +1 -0
  30. package/dist/components/dialog/dialog.d.ts +64 -0
  31. package/dist/components/dialog/dialog.js +144 -0
  32. package/dist/components/dialog/dialog.js.map +1 -0
  33. package/dist/components/dialog/index.d.ts +2 -0
  34. package/dist/components/dl/dl.d.ts +15 -0
  35. package/dist/components/dl/dl.js +47 -0
  36. package/dist/components/dl/dl.js.map +1 -0
  37. package/dist/components/dl/index.d.ts +2 -0
  38. package/dist/components/drawer/drawer.context.js +15 -0
  39. package/dist/components/drawer/drawer.context.js.map +1 -0
  40. package/dist/components/drawer/drawer.d.ts +64 -0
  41. package/dist/components/drawer/drawer.js +124 -0
  42. package/dist/components/drawer/drawer.js.map +1 -0
  43. package/dist/components/drawer/index.d.ts +2 -0
  44. package/dist/components/heading/heading.d.ts +21 -0
  45. package/dist/components/heading/heading.js +23 -0
  46. package/dist/components/heading/heading.js.map +1 -0
  47. package/dist/components/heading/index.d.ts +2 -0
  48. package/dist/components/index.d.ts +17 -1
  49. package/dist/components/progress/progress.d.ts +1 -4
  50. package/dist/components/progress/progress.js +5 -6
  51. package/dist/components/progress/progress.js.map +1 -1
  52. package/dist/components/status-icon/index.d.ts +2 -0
  53. package/dist/components/status-icon/status-icon.d.ts +19 -0
  54. package/dist/components/status-icon/status-icon.js +22 -0
  55. package/dist/components/status-icon/status-icon.js.map +1 -0
  56. package/dist/components/tabs/tabs.context.d.ts +1 -4
  57. package/dist/components/tabs/tabs.context.js +1 -2
  58. package/dist/components/tabs/tabs.d.ts +2 -5
  59. package/dist/components/tabs/tabs.js +18 -18
  60. package/dist/components/tabs/tabs.js.map +1 -1
  61. package/dist/index.d.ts +10 -2
  62. package/dist/index.js +10 -2
  63. package/dist/provider/hui-provider.context.d.ts +42 -9
  64. package/dist/provider/hui-provider.context.js +31 -18
  65. package/dist/provider/hui-provider.context.js.map +1 -1
  66. package/dist/provider/hui-provider.d.ts +1 -4
  67. package/dist/provider/hui-provider.js +1 -2
  68. package/dist/provider/index.d.ts +2 -2
  69. package/dist/provider/merge-props.js +1 -2
  70. package/dist/types/hui-component.d.ts +15 -9
  71. package/dist/types/index.d.ts +2 -2
  72. package/dist/types/polymorphic.d.ts +7 -11
  73. package/dist/utils/unwrap-signalish.js +10 -0
  74. package/dist/utils/unwrap-signalish.js.map +1 -0
  75. package/package.json +12 -11
@@ -1 +1 @@
1
- {"version":3,"file":"hui-provider.context.js","names":[],"sources":["../../src/provider/hui-provider.context.ts"],"sourcesContent":["import { ccAll, msAll } from \"@hebium-ui/core\";\nimport { createContext, type CSSProperties } from \"preact\";\nimport { useContext, useMemo } from \"preact/hooks\";\nimport type {\n AlertProps,\n AnchorProps,\n AvatarProps,\n BlockquoteProps,\n ButtonProps,\n ProgressProps,\n TabsListProps,\n TabsPanelProps,\n TabsProps,\n TabsTabProps,\n} from \"~/components\";\nimport { mergeProps } from \"./merge-props\";\n\nexport interface HuiComponentPropsMap {\n Alert: Partial<AlertProps>;\n Anchor: Partial<AnchorProps>;\n Avatar: Partial<AvatarProps>;\n Blockquote: Partial<BlockquoteProps>;\n Button: Partial<ButtonProps>;\n Progress: Partial<ProgressProps>;\n Tabs: Partial<TabsProps<string>>;\n TabsList: Partial<TabsListProps>;\n TabsTab: Partial<TabsTabProps>;\n TabsPanel: Partial<TabsPanelProps>;\n}\n\ntype HuiComponentName = keyof HuiComponentPropsMap;\ntype HuiDefaultProps = Partial<HuiComponentPropsMap>;\n\nexport interface HuiProviderContextValue {\n defaultProps: HuiDefaultProps;\n}\n\nexport const HuiProviderContext = createContext<HuiProviderContextValue | null>(null);\n\nexport function useHuiProviderContext(): HuiProviderContextValue {\n const context = useContext(HuiProviderContext);\n return context ?? { defaultProps: {} };\n}\n\nfunction useHuiDefaultProps<K extends HuiComponentName>(key: K): HuiDefaultProps[K] {\n const ctx = useHuiProviderContext();\n return ctx.defaultProps[key];\n}\n\nexport function useHuiProps<K extends HuiComponentName, P extends object>(\n key: K,\n rawProps: P,\n): P {\n const defaultProps = useHuiDefaultProps(key);\n const props = useMemo(() => {\n if (typeof defaultProps === \"undefined\") {\n return rawProps;\n }\n\n return mergeProps(defaultProps as Partial<P>, rawProps);\n }, [defaultProps, rawProps]);\n return props as P;\n}\n\nexport function useHuiClassNames<K extends HuiComponentName, S extends string>(\n key: K,\n recipe: Record<S, string>,\n rawClassNames: Partial<Record<S, string | undefined>> = {},\n): Record<S, string> {\n const defaultProps = useHuiDefaultProps(key);\n if (!defaultProps) return ccAll(recipe, rawClassNames);\n\n if (\"classNames\" in defaultProps && defaultProps.classNames) {\n return ccAll(recipe, defaultProps.classNames as Record<S, string>, rawClassNames);\n } else if (\"className\" in defaultProps && defaultProps.className) {\n return ccAll(recipe, { root: defaultProps.className } as Record<S, string>, rawClassNames);\n } else {\n return ccAll(recipe, rawClassNames);\n }\n}\n\nexport function useHuiStyles<K extends HuiComponentName, S extends string>(\n key: K,\n rawStyles: Partial<Record<S, CSSProperties | undefined>> = {},\n): Partial<Record<S, CSSProperties>> {\n const defaultProps = useHuiDefaultProps(key);\n if (!defaultProps) return rawStyles ?? {};\n\n if (\"styles\" in defaultProps && defaultProps.styles) {\n return msAll(defaultProps.styles as Partial<Record<S, CSSProperties>>, rawStyles);\n } else if (\"style\" in defaultProps && defaultProps.style) {\n return msAll({ root: defaultProps.style } as Partial<Record<S, CSSProperties>>, rawStyles);\n } else {\n return rawStyles ?? {};\n }\n}\n"],"mappings":";;;;;AAqCA,MAAa,qBAAqB,cAA8C,IAAI;AAEpF,SAAgB,wBAAiD;CAE/D,OADgB,WAAW,kBACd,KAAK,EAAE,cAAc,CAAC,EAAE;AACvC;AAEA,SAAS,mBAA+C,KAA4B;CAElF,OADY,sBACH,CAAC,CAAC,aAAa;AAC1B;AAEA,SAAgB,YACd,KACA,UACG;CACH,MAAM,eAAe,mBAAmB,GAAG;CAQ3C,OAPc,cAAc;EAC1B,IAAI,OAAO,iBAAiB,aAC1B,OAAO;EAGT,OAAO,WAAW,cAA4B,QAAQ;CACxD,GAAG,CAAC,cAAc,QAAQ,CACf;AACb;AAEA,SAAgB,iBACd,KACA,QACA,gBAAwD,CAAC,GACtC;CACnB,MAAM,eAAe,mBAAmB,GAAG;CAC3C,IAAI,CAAC,cAAc,OAAO,MAAM,QAAQ,aAAa;CAErD,IAAI,gBAAgB,gBAAgB,aAAa,YAC/C,OAAO,MAAM,QAAQ,aAAa,YAAiC,aAAa;MAC3E,IAAI,eAAe,gBAAgB,aAAa,WACrD,OAAO,MAAM,QAAQ,EAAE,MAAM,aAAa,UAAU,GAAwB,aAAa;MAEzF,OAAO,MAAM,QAAQ,aAAa;AAEtC;AAEA,SAAgB,aACd,KACA,YAA2D,CAAC,GACzB;CACnC,MAAM,eAAe,mBAAmB,GAAG;CAC3C,IAAI,CAAC,cAAc,OAAO,aAAa,CAAC;CAExC,IAAI,YAAY,gBAAgB,aAAa,QAC3C,OAAO,MAAM,aAAa,QAA6C,SAAS;MAC3E,IAAI,WAAW,gBAAgB,aAAa,OACjD,OAAO,MAAM,EAAE,MAAM,aAAa,MAAM,GAAwC,SAAS;MAEzF,OAAO,aAAa,CAAC;AAEzB"}
1
+ {"version":3,"file":"hui-provider.context.js","names":[],"sources":["../../src/provider/hui-provider.context.ts"],"sourcesContent":["import { cc, ccAll, msAll } from \"@hebium-ui/core\";\nimport { createContext, type CSSProperties, type JSX, type Signalish } from \"preact\";\nimport { useContext, useMemo } from \"preact/hooks\";\nimport type {\n AlertProps,\n AnchorProps,\n AvatarProps,\n BlockquoteProps,\n ButtonProps,\n CheckboxProps,\n CodeProps,\n DdProps,\n DetailsProps,\n DialogCloseProps,\n DialogContentProps,\n DialogProps,\n DialogTriggerProps,\n DlProps,\n DrawerCloseProps,\n DrawerContentProps,\n DrawerProps,\n DrawerTriggerProps,\n DtProps,\n HeadingProps,\n ProgressProps,\n StatusIconProps,\n TabsListProps,\n TabsPanelProps,\n TabsProps,\n TabsTabProps,\n} from \"~/components\";\nimport type { HuiStyleProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\nimport { mergeProps } from \"./merge-props\";\n\nexport interface HuiComponentPropsMap {\n Alert: Partial<AlertProps>;\n Anchor: Partial<AnchorProps>;\n Avatar: Partial<AvatarProps>;\n Blockquote: Partial<BlockquoteProps>;\n Button: Partial<ButtonProps>;\n Checkbox: Partial<CheckboxProps>;\n Code: Partial<CodeProps>;\n Details: Partial<DetailsProps>;\n Dialog: Partial<DialogProps>;\n DialogTrigger: Partial<DialogTriggerProps>;\n DialogContent: Partial<DialogContentProps>;\n DialogClose: Partial<DialogCloseProps>;\n Dl: Partial<DlProps>;\n DlDt: Partial<DtProps>;\n DlDd: Partial<DdProps>;\n Drawer: Partial<DrawerProps>;\n DrawerTrigger: Partial<DrawerTriggerProps>;\n DrawerContent: Partial<DrawerContentProps>;\n DrawerClose: Partial<DrawerCloseProps>;\n Heading: Partial<HeadingProps>;\n Progress: Partial<ProgressProps>;\n StatusIcon: Partial<StatusIconProps>;\n Tabs: Partial<TabsProps<string>>;\n TabsList: Partial<TabsListProps>;\n TabsTab: Partial<TabsTabProps>;\n TabsPanel: Partial<TabsPanelProps>;\n}\n\ntype HuiComponentName = keyof HuiComponentPropsMap;\ntype HuiDefaultProps = Partial<HuiComponentPropsMap>;\n\ntype HuiComponentSlots<K extends HuiComponentName> = {\n [P in HuiComponentName]: HuiComponentPropsMap[P] extends { classes?: infer C } ? Extract<keyof NonNullable<C>, string>\n : never;\n}[K];\n\ntype HuiStyledComponentName = {\n [K in HuiComponentName]: [HuiComponentSlots<K>] extends [never] ? never : K;\n}[HuiComponentName];\n\nexport interface HuiProviderContextValue {\n defaultProps: HuiDefaultProps;\n}\n\nexport const HuiProviderContext = createContext<HuiProviderContextValue | null>(null);\n\nexport function useHuiProviderContext(): HuiProviderContextValue {\n const context = useContext(HuiProviderContext);\n return context ?? { defaultProps: {} };\n}\n\nfunction useHuiDefaultProps<K extends HuiComponentName>(key: K): HuiDefaultProps[K] {\n const ctx = useHuiProviderContext();\n return ctx.defaultProps[key];\n}\n\nfunction useHuiStyleDefaultProps<K extends HuiStyledComponentName>(\n key: K,\n): HuiStyleProps<HuiComponentSlots<K>> | undefined {\n return useHuiDefaultProps(key);\n}\n\nconst STYLING_PROPS = [\"class\", \"className\", \"style\", \"classes\", \"styles\"] as const;\n\n// Keep `as` explicit so JSX element inference survives omission of generic props.\ntype HuiProps<P extends object, E extends JSX.ElementType> =\n & Omit<P, typeof STYLING_PROPS[number] | \"as\">\n & Pick<{ as?: E | undefined }, \"as\" & keyof P>;\n\nexport function useHuiProps<\n K extends HuiComponentName,\n P extends object,\n E extends JSX.ElementType = Extract<P[\"as\" & keyof P], JSX.ElementType>,\n>(\n key: K,\n rawProps: P & { as?: E | undefined },\n): HuiProps<P, E> {\n const defaultProps = useHuiDefaultProps(key);\n return useMemo(() => {\n const props = mergeProps((defaultProps ?? {}) as Partial<P>, rawProps);\n // Styling helpers resolve Provider and local values separately from rawProps.\n for (const prop of STYLING_PROPS) {\n delete props[prop as keyof P];\n }\n return props as HuiProps<P, E>;\n }, [defaultProps, rawProps]);\n}\n\nfunction resolveSlotValues<S extends string, T>(\n values: Partial<Record<S, Signalish<T>>> = {},\n): Partial<Record<S, T>> {\n const resolved: Partial<Record<S, T>> = {};\n for (const slot in values) {\n resolved[slot] = unwrapSignalish<T | undefined>(values[slot]);\n }\n return resolved;\n}\n\nexport function useHuiClasses<K extends HuiStyledComponentName>(\n key: K,\n recipe: Record<HuiComponentSlots<NoInfer<K>>, string>,\n rawProps: Pick<HuiStyleProps<HuiComponentSlots<NoInfer<K>>>, \"class\" | \"className\" | \"classes\"> = {},\n): Record<HuiComponentSlots<K>, string> {\n const defaultProps = useHuiStyleDefaultProps(key);\n return ccAll<HuiComponentSlots<K>>(\n recipe,\n {\n root: cc(unwrapSignalish(defaultProps?.class), unwrapSignalish(defaultProps?.className)),\n } as Record<HuiComponentSlots<K>, string>,\n resolveSlotValues(defaultProps?.classes),\n {\n root: cc(unwrapSignalish(rawProps.class), unwrapSignalish(rawProps.className)),\n } as Record<HuiComponentSlots<K>, string>,\n resolveSlotValues(rawProps.classes),\n );\n}\n\nfunction resolveStyles<S extends string>(\n props: Pick<HuiStyleProps<S>, \"style\" | \"styles\"> = {},\n): Partial<Record<S, CSSProperties>> {\n return msAll(\n { root: unwrapSignalish(props.style) } as Partial<Record<S, CSSProperties | undefined>>,\n resolveSlotValues(props.styles),\n );\n}\n\nexport function useHuiStyles<K extends HuiStyledComponentName>(\n key: K,\n rawProps: Pick<HuiStyleProps<HuiComponentSlots<NoInfer<K>>>, \"style\" | \"styles\"> = {},\n): Partial<Record<HuiComponentSlots<K>, CSSProperties>> {\n const defaultProps = useHuiStyleDefaultProps(key);\n return msAll(resolveStyles<HuiComponentSlots<K>>(defaultProps), resolveStyles<HuiComponentSlots<K>>(rawProps));\n}\n"],"mappings":";;;;;;AAgFA,MAAa,qBAAqB,cAA8C,IAAI;AAEpF,SAAgB,wBAAiD;CAE/D,OADgB,WAAW,kBACd,KAAK,EAAE,cAAc,CAAC,EAAE;AACvC;AAEA,SAAS,mBAA+C,KAA4B;CAElF,OADY,sBACH,CAAC,CAAC,aAAa;AAC1B;AAEA,SAAS,wBACP,KACiD;CACjD,OAAO,mBAAmB,GAAG;AAC/B;AAEA,MAAM,gBAAgB;CAAC;CAAS;CAAa;CAAS;CAAW;AAAQ;AAOzE,SAAgB,YAKd,KACA,UACgB;CAChB,MAAM,eAAe,mBAAmB,GAAG;CAC3C,OAAO,cAAc;EACnB,MAAM,QAAQ,WAAY,gBAAgB,CAAC,GAAkB,QAAQ;EAErE,KAAK,MAAM,QAAQ,eACjB,OAAO,MAAM;EAEf,OAAO;CACT,GAAG,CAAC,cAAc,QAAQ,CAAC;AAC7B;AAEA,SAAS,kBACP,SAA2C,CAAC,GACrB;CACvB,MAAM,WAAkC,CAAC;CACzC,KAAK,MAAM,QAAQ,QACjB,SAAS,QAAQ,gBAA+B,OAAO,KAAK;CAE9D,OAAO;AACT;AAEA,SAAgB,cACd,KACA,QACA,WAAkG,CAAC,GAC7D;CACtC,MAAM,eAAe,wBAAwB,GAAG;CAChD,OAAO,MACL,QACA,EACE,MAAM,GAAG,gBAAgB,cAAc,KAAK,GAAG,gBAAgB,cAAc,SAAS,CAAC,EACzF,GACA,kBAAkB,cAAc,OAAO,GACvC,EACE,MAAM,GAAG,gBAAgB,SAAS,KAAK,GAAG,gBAAgB,SAAS,SAAS,CAAC,EAC/E,GACA,kBAAkB,SAAS,OAAO,CACpC;AACF;AAEA,SAAS,cACP,QAAoD,CAAC,GAClB;CACnC,OAAO,MACL,EAAE,MAAM,gBAAgB,MAAM,KAAK,EAAE,GACrC,kBAAkB,MAAM,MAAM,CAChC;AACF;AAEA,SAAgB,aACd,KACA,WAAmF,CAAC,GAC9B;CACtD,MAAM,eAAe,wBAAwB,GAAG;CAChD,OAAO,MAAM,cAAoC,YAAY,GAAG,cAAoC,QAAQ,CAAC;AAC/G"}
@@ -1,10 +1,7 @@
1
1
  import { HuiProviderContextValue } from "./hui-provider.context.js";
2
2
  import { ComponentChildren, VNode } from "preact";
3
- //#region src/provider/hui-provider.d.ts
4
3
  interface HuiProviderProps extends Partial<HuiProviderContextValue> {
5
4
  children: ComponentChildren;
6
5
  }
7
6
  export declare function HuiProvider({ defaultProps, children }: HuiProviderProps): VNode;
8
- //#endregion
9
- export {};
10
- //# sourceMappingURL=hui-provider.d.ts.map
7
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { HuiProviderContext } from "./hui-provider.context.js";
2
2
  import { useMemo } from "preact/hooks";
3
3
  import { jsx } from "preact/jsx-runtime";
4
- //#region src/provider/hui-provider.tsx
4
+ // src/provider/hui-provider.tsx
5
5
  function HuiProvider({ defaultProps, children }) {
6
6
  const context = useMemo(() => {
7
7
  return { defaultProps: defaultProps ?? {} };
@@ -11,7 +11,6 @@ function HuiProvider({ defaultProps, children }) {
11
11
  children
12
12
  });
13
13
  }
14
- //#endregion
15
14
  export { HuiProvider };
16
15
 
17
16
  //# sourceMappingURL=hui-provider.js.map
@@ -1,3 +1,3 @@
1
- import { HuiComponentPropsMap, HuiProviderContext, HuiProviderContextValue, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles } from "./hui-provider.context.js";
2
1
  import { HuiProvider } from "./hui-provider.js";
3
- export { HuiComponentPropsMap, HuiProvider, HuiProviderContext, HuiProviderContextValue, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles };
2
+ import { HuiComponentPropsMap, HuiProviderContext, HuiProviderContextValue, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles } from "./hui-provider.context.js";
3
+ export { HuiComponentPropsMap, HuiProvider, HuiProviderContext, HuiProviderContextValue, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles };
@@ -1,4 +1,4 @@
1
- //#region src/provider/merge-props.ts
1
+ // src/provider/merge-props.ts
2
2
  function mergeProps(defaultProps, rawProps) {
3
3
  const filteredProps = {};
4
4
  for (const key of Object.keys(rawProps)) {
@@ -10,7 +10,6 @@ function mergeProps(defaultProps, rawProps) {
10
10
  ...filteredProps
11
11
  };
12
12
  }
13
- //#endregion
14
13
  export { mergeProps };
15
14
 
16
15
  //# sourceMappingURL=merge-props.js.map
@@ -1,10 +1,16 @@
1
- import { CSSProperties } from "preact";
2
- //#region src/types/hui-component.d.ts
1
+ import { CSSProperties, Signalish } from "preact";
3
2
  type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
4
- export type HuiComponentProps<Props extends object, Slots extends string> = [Slots] extends ["root"] ? Props : DistributiveOmit<Props, "className" | "style"> & {
5
- classNames?: Partial<Record<Slots, string>> | undefined;
6
- styles?: Partial<Record<Slots, CSSProperties>> | undefined;
7
- };
8
- //#endregion
9
- export {};
10
- //# sourceMappingURL=hui-component.d.ts.map
3
+ export interface HuiRootStyleProps {
4
+ class?: Signalish<string | undefined>;
5
+ className?: Signalish<string | undefined>;
6
+ style?: Signalish<CSSProperties | undefined>;
7
+ }
8
+ export type HuiClassNames<Slots extends string> = Partial<Record<Slots, Signalish<string | undefined>>>;
9
+ export type HuiStyles<Slots extends string> = Partial<Record<Slots, Signalish<CSSProperties | undefined>>>;
10
+ export interface HuiSlotStyleProps<Slots extends string> {
11
+ classes?: HuiClassNames<Slots> | undefined;
12
+ styles?: HuiStyles<Slots> | undefined;
13
+ }
14
+ export type HuiStyleProps<Slots extends string> = HuiRootStyleProps & HuiSlotStyleProps<Slots>;
15
+ export type HuiComponentProps<Props extends object, Slots extends string> = DistributiveOmit<Props, keyof HuiStyleProps<Slots>> & HuiStyleProps<Slots>;
16
+ export {};
@@ -1,3 +1,3 @@
1
- import { HuiComponentProps } from "./hui-component.js";
1
+ import { HuiClassNames, HuiComponentProps, HuiRootStyleProps, HuiSlotStyleProps, HuiStyleProps, HuiStyles } from "./hui-component.js";
2
2
  import { HuiPolymorphicProps, PolymorphicComponentProps } from "./polymorphic.js";
3
- export { HuiComponentProps, HuiPolymorphicProps, PolymorphicComponentProps };
3
+ export { HuiClassNames, HuiComponentProps, HuiPolymorphicProps, HuiRootStyleProps, HuiSlotStyleProps, HuiStyleProps, HuiStyles, PolymorphicComponentProps };
@@ -1,13 +1,9 @@
1
- import { CSSProperties, ComponentProps, JSX } from "preact";
2
- //#region src/types/polymorphic.d.ts
1
+ import { HuiComponentProps, HuiStyleProps } from "./hui-component.js";
2
+ import { ComponentType, JSX } from "preact";
3
+ type NativePropsMap = { [E in keyof JSX.IntrinsicElements]: Omit<JSX.IntrinsicElements[E], never>; };
4
+ type ElementProps<E extends JSX.ElementType> = E extends keyof NativePropsMap ? NativePropsMap[E] : E extends ComponentType<infer P> ? P : {};
3
5
  export type PolymorphicComponentProps<E extends JSX.ElementType, OwnProps extends object> = OwnProps & {
4
6
  as?: E | undefined;
5
- } & Omit<ComponentProps<E>, keyof OwnProps | "as" | "className" | "style">;
6
- export type HuiPolymorphicProps<E extends JSX.ElementType, OwnProps extends object, Slots extends string> = [Slots] extends ["root"] ? OwnProps & {
7
- as?: E | undefined;
8
- } & Omit<ComponentProps<E>, keyof OwnProps | "as"> : PolymorphicComponentProps<E, OwnProps & {
9
- classNames?: Partial<Record<Slots, string | undefined>> | undefined;
10
- styles?: Partial<Record<Slots, CSSProperties | undefined>> | undefined;
11
- }>;
12
- //#endregion
13
- //# sourceMappingURL=polymorphic.d.ts.map
7
+ } & Omit<ElementProps<E>, keyof OwnProps | "as" | keyof HuiStyleProps<string>>;
8
+ export type HuiPolymorphicProps<E extends JSX.ElementType, OwnProps extends object, Slots extends string> = PolymorphicComponentProps<E, HuiComponentProps<OwnProps, Slots>>;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ // src/utils/unwrap-signalish.ts
2
+ function isSignalLike(value) {
3
+ return typeof value === "object" && value !== null && "value" in value && "peek" in value && typeof value.peek === "function" && "subscribe" in value && typeof value.subscribe === "function";
4
+ }
5
+ function unwrapSignalish(value) {
6
+ return isSignalLike(value) ? value.value : value;
7
+ }
8
+ export { unwrapSignalish };
9
+
10
+ //# sourceMappingURL=unwrap-signalish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrap-signalish.js","names":[],"sources":["../../src/utils/unwrap-signalish.ts"],"sourcesContent":["import { type Signalish, type SignalLike } from \"preact\";\n\nfunction isSignalLike<T>(value: Signalish<T>): value is SignalLike<T> {\n return typeof value === \"object\" && value !== null\n && \"value\" in value\n && \"peek\" in value && typeof value.peek === \"function\"\n && \"subscribe\" in value && typeof value.subscribe === \"function\";\n}\n\nexport function unwrapSignalish<T>(value: Signalish<T>): T {\n return isSignalLike(value) ? value.value : value;\n}\n"],"mappings":";AAEA,SAAS,aAAgB,OAA6C;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QACzC,WAAW,SACX,UAAU,SAAS,OAAO,MAAM,SAAS,cACzC,eAAe,SAAS,OAAO,MAAM,cAAc;AAC1D;AAEA,SAAgB,gBAAmB,OAAwB;CACzD,OAAO,aAAa,KAAK,IAAI,MAAM,QAAQ;AAC7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebium-ui/preact",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.4",
4
4
  "description": "Experimental Preact bindings for the Hebium UI core components.",
5
5
  "type": "module",
6
6
  "files": [
@@ -26,19 +26,20 @@
26
26
  "access": "public"
27
27
  },
28
28
  "devDependencies": {
29
- "@vitest/browser-playwright": "5.0.5",
30
- "axe-core": "4.14.0",
31
- "oxlint": "1.88.0",
32
- "playwright": "1.64.1",
33
- "preact": "11.0.1",
34
- "tsdown": "0.23.1",
29
+ "@preact/signals": "2.11.4",
30
+ "@vitest/browser-playwright": "5.1.1",
31
+ "axe-core": "4.14.1",
32
+ "oxlint": "1.94.0",
33
+ "playwright": "1.65.1",
34
+ "preact": "11.2.0",
35
+ "tsdown": "0.23.7",
35
36
  "typescript": "6.0.3",
36
- "vite": "8.3.4",
37
- "vitest": "5.0.5",
38
- "vitest-browser-preact": "1.1.0"
37
+ "vite": "8.3.8",
38
+ "vitest": "5.1.1",
39
+ "vitest-browser-preact": "2.0.0"
39
40
  },
40
41
  "peerDependencies": {
41
- "@hebium-ui/core": "0.1.0-alpha.2",
42
+ "@hebium-ui/core": "0.1.0-alpha.4",
42
43
  "preact": "^11.0.0"
43
44
  },
44
45
  "scripts": {