@askrjs/themes 0.0.22 → 0.0.24

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 (56) hide show
  1. package/README.md +4 -0
  2. package/capabilities.json +36 -0
  3. package/dist/components/_internal/jsx.js +7 -2
  4. package/dist/components/_internal/jsx.js.map +1 -1
  5. package/dist/components/_internal/style.js.map +1 -1
  6. package/dist/components/alert/alert.js.map +1 -1
  7. package/dist/components/brand/brand.js +12 -10
  8. package/dist/components/brand/brand.js.map +1 -1
  9. package/dist/components/card/card.js +43 -36
  10. package/dist/components/card/card.js.map +1 -1
  11. package/dist/components/catalog.js +18 -14
  12. package/dist/components/catalog.js.map +1 -1
  13. package/dist/components/close/close.js.map +1 -1
  14. package/dist/components/command-palette/command-palette.d.ts +11 -0
  15. package/dist/components/command-palette/command-palette.js +153 -0
  16. package/dist/components/command-palette/command-palette.js.map +1 -0
  17. package/dist/components/command-palette/command-palette.types.d.ts +30 -0
  18. package/dist/components/command-palette/index.d.ts +3 -0
  19. package/dist/components/empty-state/empty-state.js.map +1 -1
  20. package/dist/components/field/field.js +20 -17
  21. package/dist/components/field/field.js.map +1 -1
  22. package/dist/components/footer/footer.js +36 -30
  23. package/dist/components/footer/footer.js.map +1 -1
  24. package/dist/components/grid/grid.js +2 -1
  25. package/dist/components/grid/grid.js.map +1 -1
  26. package/dist/components/nav/nav.js.map +1 -1
  27. package/dist/components/nav/nav.types.d.ts +1 -1
  28. package/dist/components/navbar/navbar.js.map +1 -1
  29. package/dist/components/overlays/dropdown-content.js.map +1 -1
  30. package/dist/components/page/page.js.map +1 -1
  31. package/dist/components/page-header/page-header.js.map +1 -1
  32. package/dist/components/sidebar/sidebar.js +6 -6
  33. package/dist/components/sidebar/sidebar.js.map +1 -1
  34. package/dist/components/skeleton/skeleton.js +2 -1
  35. package/dist/components/skeleton/skeleton.js.map +1 -1
  36. package/dist/components/spinner/spinner.js.map +1 -1
  37. package/dist/components/stat/stat.js +24 -20
  38. package/dist/components/stat/stat.js.map +1 -1
  39. package/dist/components/theme/theme.js.map +1 -1
  40. package/dist/components/toolbar/toolbar.js.map +1 -1
  41. package/dist/components.d.ts +4 -1
  42. package/dist/components.js +3 -2
  43. package/dist/entries/command.d.ts +4 -1
  44. package/dist/entries/command.js +2 -1
  45. package/dist/entries/tabs.js +1 -1
  46. package/dist/themes/default/index.css +38 -0
  47. package/package.json +18 -14
  48. package/src/components/_internal/jsx.ts +11 -1
  49. package/src/components/command-palette/command-palette.tsx +242 -0
  50. package/src/components/command-palette/command-palette.types.ts +40 -0
  51. package/src/components/command-palette/index.ts +15 -0
  52. package/src/components/sidebar/sidebar.tsx +6 -6
  53. package/src/components.ts +8 -0
  54. package/src/entries/command.ts +15 -0
  55. package/src/parity.ts +1 -0
  56. package/src/themes/default/styles/display/catalog.css +38 -0
@@ -1 +1 @@
1
- {"version":3,"file":"footer.js","names":[],"sources":["../../../src/components/footer/footer.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type {\n FooterContentProps,\n FooterDescriptionProps,\n FooterLinkProps,\n FooterLinksProps,\n FooterProps,\n FooterSectionProps,\n FooterTitleProps,\n} from \"./footer.types\";\n\nexport function Footer(props: FooterProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <Block as=\"footer\" background=\"muted\" borderTop {...rest} data-slot=\"footer\">\n {children}\n </Block>\n );\n}\n\nexport function FooterContent(props: FooterContentProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-content\", className),\n \"data-slot\": \"footer-content\",\n });\n\n return <div {...finalProps}>{children}</div>;\n}\n\nexport function FooterSection(props: FooterSectionProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-section\", className),\n \"data-slot\": \"footer-section\",\n });\n\n return <div {...finalProps}>{children}</div>;\n}\n\nexport function FooterTitle(props: FooterTitleProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-title\", className),\n \"data-slot\": \"footer-title\",\n });\n\n return <h2 {...finalProps}>{children}</h2>;\n}\n\nexport function FooterDescription(props: FooterDescriptionProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-description\", className),\n \"data-slot\": \"footer-description\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n\nexport function FooterLinks(props: FooterLinksProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-links\", className),\n \"data-slot\": \"footer-links\",\n });\n\n return <nav {...finalProps}>{children}</nav>;\n}\n\nexport function FooterLink(props: FooterLinkProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-link\", className),\n \"data-slot\": \"footer-link\",\n });\n\n return <a {...finalProps}>{children}</a>;\n}\n"],"mappings":";;;;;AAcA,SAAgB,OAAO,OAAiC;CACtD,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAAC,OAAD;EAAO,IAAG;EAAS,YAAW;EAAQ,WAAA;EAAU,GAAI;EAAM,aAAU;EACjE;CACI,CAAA;AAEX;AAEA,SAAgB,cAAc,OAAwC;CACpE,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,OAAD;EAAK,GANO,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,kBAAkB,SAAS;GAC1C,aAAa;EACf,CAEyB;EAAI;CAAc,CAAA;AAC7C;AAEA,SAAgB,cAAc,OAAwC;CACpE,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,OAAD;EAAK,GANO,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,kBAAkB,SAAS;GAC1C,aAAa;EACf,CAEyB;EAAI;CAAc,CAAA;AAC7C;AAEA,SAAgB,YAAY,OAAsC;CAChE,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,MAAD;EAAI,GANQ,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,gBAAgB,SAAS;GACxC,aAAa;EACf,CAEwB;EAAI;CAAa,CAAA;AAC3C;AAEA,SAAgB,kBAAkB,OAA4C;CAC5E,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,KAAD;EAAG,GANS,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,sBAAsB,SAAS;GAC9C,aAAa;EACf,CAEuB;EAAI;CAAY,CAAA;AACzC;AAEA,SAAgB,YAAY,OAAsC;CAChE,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,OAAD;EAAK,GANO,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,gBAAgB,SAAS;GACxC,aAAa;EACf,CAEyB;EAAI;CAAc,CAAA;AAC7C;AAEA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,KAAD;EAAG,GANS,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,eAAe,SAAS;GACvC,aAAa;EACf,CAEuB;EAAI;CAAY,CAAA;AACzC"}
1
+ {"version":3,"file":"footer.js","names":[],"sources":["../../../src/components/footer/footer.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type {\n FooterContentProps,\n FooterDescriptionProps,\n FooterLinkProps,\n FooterLinksProps,\n FooterProps,\n FooterSectionProps,\n FooterTitleProps,\n} from \"./footer.types\";\n\nexport function Footer(props: FooterProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <Block as=\"footer\" background=\"muted\" borderTop {...rest} data-slot=\"footer\">\n {children}\n </Block>\n );\n}\n\nexport function FooterContent(props: FooterContentProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-content\", className),\n \"data-slot\": \"footer-content\",\n });\n\n return <div {...finalProps}>{children}</div>;\n}\n\nexport function FooterSection(props: FooterSectionProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-section\", className),\n \"data-slot\": \"footer-section\",\n });\n\n return <div {...finalProps}>{children}</div>;\n}\n\nexport function FooterTitle(props: FooterTitleProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-title\", className),\n \"data-slot\": \"footer-title\",\n });\n\n return <h2 {...finalProps}>{children}</h2>;\n}\n\nexport function FooterDescription(props: FooterDescriptionProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-description\", className),\n \"data-slot\": \"footer-description\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n\nexport function FooterLinks(props: FooterLinksProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-links\", className),\n \"data-slot\": \"footer-links\",\n });\n\n return <nav {...finalProps}>{children}</nav>;\n}\n\nexport function FooterLink(props: FooterLinkProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"footer-link\", className),\n \"data-slot\": \"footer-link\",\n });\n\n return <a {...finalProps}>{children}</a>;\n}\n"],"mappings":";;;;;AAcA,SAAgB,OAAO,OAAiC;CACt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ACxC,aAAa;CACf,CAAC;CAED,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAa;CAAc,CAAA;AAC7C;AAEA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CACrD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,eAAe,SAAS;EACvC,aAAa;CACf,CAAC;CAED,OAAO,oBAAC,KAAD;EAAG,GAAI;EAAa;CAAY,CAAA;AACzC"}
@@ -23,9 +23,10 @@ function Grid(props) {
23
23
  setResponsiveVar(styles, "grid-columns", columns, resolveColumns);
24
24
  setResponsiveVar(styles, "grid-gap", gap, resolveGap);
25
25
  setResponsiveVar(styles, "grid-align", align, resolveAlign);
26
+ const generatedClass = styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));
26
27
  const finalProps = mergeProps(rest, {
27
28
  ref,
28
- class: classes("grid", classProp, className, styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle))),
29
+ class: classes("grid", classProp, className, generatedClass),
29
30
  "data-slot": "grid"
30
31
  });
31
32
  return intrinsicElement(as ?? DEFAULT_ELEMENT, finalProps, children);
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","names":[],"sources":["../../../src/components/grid/grid.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeLayoutStyles, resolveSpaceValue, setResponsiveVar } from \"../_internal/block-layout\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport { styleDeclarationsToClass } from \"../_internal/style\";\nimport type { BlockSpace } from \"../_internal/block-layout\";\nimport type { GridAlign, GridColumns, GridElement, GridProps } from \"./grid.types\";\n\nconst DEFAULT_ELEMENT = \"div\";\nfunction resolveColumns(value: GridColumns): string {\n if (typeof value === \"number\") {\n return `repeat(${value}, minmax(0, 1fr))`;\n }\n\n const trimmed = value.trim();\n return trimmed || \"minmax(0, 1fr)\";\n}\n\nfunction resolveGap(value: BlockSpace): string {\n return String(resolveSpaceValue(value));\n}\n\nfunction resolveAlign(value: GridAlign): string {\n if (value === \"start\") return \"start\";\n if (value === \"end\") return \"end\";\n return value;\n}\n\nexport function Grid<TElement extends GridElement = \"div\">(\n props: GridProps<TElement>,\n): JSX.Element {\n const {\n as,\n columns,\n gap,\n align,\n children,\n class: classProp,\n className,\n ref,\n style: userStyle,\n ...rest\n } = props as GridProps<GridElement> & {\n class?: unknown;\n className?: unknown;\n style?: unknown;\n };\n\n const styles: Record<string, string | number> = {};\n setResponsiveVar(styles, \"grid-columns\", columns, resolveColumns);\n setResponsiveVar(styles, \"grid-gap\", gap, resolveGap);\n setResponsiveVar(styles, \"grid-align\", align, resolveAlign);\n\n const generatedClass = styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"grid\", classProp, className, generatedClass),\n \"data-slot\": \"grid\",\n });\n\n return intrinsicElement(as ?? DEFAULT_ELEMENT, finalProps, children);\n}\n"],"mappings":";;;;;;AASA,MAAM,kBAAkB;AACxB,SAAS,eAAe,OAA4B;CAClD,IAAI,OAAO,UAAU,UACnB,OAAO,UAAU,MAAM;CAIzB,OADgB,MAAM,KACT,KAAK;AACpB;AAEA,SAAS,WAAW,OAA2B;CAC7C,OAAO,OAAO,kBAAkB,KAAK,CAAC;AACxC;AAEA,SAAS,aAAa,OAA0B;CAC9C,IAAI,UAAU,SAAS,OAAO;CAC9B,IAAI,UAAU,OAAO,OAAO;CAC5B,OAAO;AACT;AAEA,SAAgB,KACd,OACa;CACb,MAAM,EACJ,IACA,SACA,KACA,OACA,UACA,OAAO,WACP,WACA,KACA,OAAO,WACP,GAAG,SACD;CAMJ,MAAM,SAA0C,CAAC;CACjD,iBAAiB,QAAQ,gBAAgB,SAAS,cAAc;CAChE,iBAAiB,QAAQ,YAAY,KAAK,UAAU;CACpD,iBAAiB,QAAQ,cAAc,OAAO,YAAY;CAG1D,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,QAAQ,WAAW,WAHb,yBAAyB,kBAAkB,QAAQ,SAAS,CAGvB,CAAC;EAC3D,aAAa;CACf,CAAC;CAED,OAAO,iBAAiB,MAAM,iBAAiB,YAAY,QAAQ;AACrE"}
1
+ {"version":3,"file":"grid.js","names":[],"sources":["../../../src/components/grid/grid.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeLayoutStyles, resolveSpaceValue, setResponsiveVar } from \"../_internal/block-layout\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport { styleDeclarationsToClass } from \"../_internal/style\";\nimport type { BlockSpace } from \"../_internal/block-layout\";\nimport type { GridAlign, GridColumns, GridElement, GridProps } from \"./grid.types\";\n\nconst DEFAULT_ELEMENT = \"div\";\nfunction resolveColumns(value: GridColumns): string {\n if (typeof value === \"number\") {\n return `repeat(${value}, minmax(0, 1fr))`;\n }\n\n const trimmed = value.trim();\n return trimmed || \"minmax(0, 1fr)\";\n}\n\nfunction resolveGap(value: BlockSpace): string {\n return String(resolveSpaceValue(value));\n}\n\nfunction resolveAlign(value: GridAlign): string {\n if (value === \"start\") return \"start\";\n if (value === \"end\") return \"end\";\n return value;\n}\n\nexport function Grid<TElement extends GridElement = \"div\">(\n props: GridProps<TElement>,\n): JSX.Element {\n const {\n as,\n columns,\n gap,\n align,\n children,\n class: classProp,\n className,\n ref,\n style: userStyle,\n ...rest\n } = props as GridProps<GridElement> & {\n class?: unknown;\n className?: unknown;\n style?: unknown;\n };\n\n const styles: Record<string, string | number> = {};\n setResponsiveVar(styles, \"grid-columns\", columns, resolveColumns);\n setResponsiveVar(styles, \"grid-gap\", gap, resolveGap);\n setResponsiveVar(styles, \"grid-align\", align, resolveAlign);\n\n const generatedClass = styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"grid\", classProp, className, generatedClass),\n \"data-slot\": \"grid\",\n });\n\n return intrinsicElement(as ?? DEFAULT_ELEMENT, finalProps, children);\n}\n"],"mappings":";;;;;;AASA,MAAM,kBAAkB;AACxB,SAAS,eAAe,OAA4B;CAClD,IAAI,OAAO,UAAU,UACnB,OAAO,UAAU,MAAM;CAIzB,OADgB,MAAM,KACT,KAAK;AACpB;AAEA,SAAS,WAAW,OAA2B;CAC7C,OAAO,OAAO,kBAAkB,KAAK,CAAC;AACxC;AAEA,SAAS,aAAa,OAA0B;CAC9C,IAAI,UAAU,SAAS,OAAO;CAC9B,IAAI,UAAU,OAAO,OAAO;CAC5B,OAAO;AACT;AAEA,SAAgB,KACd,OACa;CACb,MAAM,EACJ,IACA,SACA,KACA,OACA,UACA,OAAO,WACP,WACA,KACA,OAAO,WACP,GAAG,SACD;CAMJ,MAAM,SAA0C,CAAC;CACjD,iBAAiB,QAAQ,gBAAgB,SAAS,cAAc;CAChE,iBAAiB,QAAQ,YAAY,KAAK,UAAU;CACpD,iBAAiB,QAAQ,cAAc,OAAO,YAAY;CAE1D,MAAM,iBAAiB,yBAAyB,kBAAkB,QAAQ,SAAS,CAAC;CACpF,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,QAAQ,WAAW,WAAW,cAAc;EAC3D,aAAa;CACf,CAAC;CAED,OAAO,iBAAiB,MAAM,iBAAiB,YAAY,QAAQ;AACrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"nav.js","names":[],"sources":["../../../src/components/nav/nav.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { currentRoute, Link, navigate } from \"@askrjs/askr/router\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport { assertSafeNavigationHref, resolvePathname } from \"../_internal/pathname\";\nimport type {\n NavItemAsChildProps,\n NavItemProps,\n NavLinkProps,\n PillProps,\n PillsAsChildProps,\n PillsProps,\n TabProps,\n TabsAsChildProps,\n TabsProps,\n} from \"./nav.types\";\n\nconst LayoutBlock = Block as (props: Record<string, unknown>) => JSX.Element;\n\nfunction normalizePathname(pathname: string): string {\n return pathname.endsWith(\"/\") && pathname !== \"/\" ? pathname.slice(0, -1) : pathname;\n}\n\nfunction getCurrentPathname(): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n return normalizePathname(window.location.pathname || \"/\");\n}\n\nfunction getReactiveCurrentPathname(): string | null {\n try {\n return normalizePathname(currentRoute().path || \"/\");\n } catch {\n return getCurrentPathname();\n }\n}\n\nfunction isActiveNavLink(\n currentPathname: string,\n targetPathname: string,\n match: NavLinkProps[\"match\"] = \"prefix\",\n): boolean {\n if (targetPathname === \"/\") {\n return currentPathname === \"/\";\n }\n\n if (match === \"exact\") {\n return currentPathname === targetPathname;\n }\n\n return currentPathname === targetPathname || currentPathname.startsWith(`${targetPathname}/`);\n}\n\nfunction shouldHandleClientNavigation(\n event: MouseEvent,\n target: string | undefined,\n targetPathname: string | null,\n): boolean {\n if (targetPathname === null || target) {\n return false;\n }\n\n return (\n !event.defaultPrevented &&\n (event.button ?? 0) === 0 &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.shiftKey\n );\n}\n\nfunction renderNavSet(\n props: TabsProps | TabsAsChildProps | PillsProps | PillsAsChildProps,\n slot: \"tabs\" | \"pills\",\n): JSX.Element {\n const className = \"class\" in props ? props.class : undefined;\n const { asChild, children, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(slot, className),\n \"data-slot\": slot,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return intrinsicElement(\"nav\", finalProps, children);\n}\n\nfunction renderRoutedLink(\n props: NavLinkProps | TabProps | PillProps,\n slot: \"nav-item\" | \"tab\" | \"pill\",\n options: { activeBackground?: boolean; className?: string; inheritSlot?: boolean } = {},\n): JSX.Element {\n const {\n active,\n children,\n href: suppliedHref,\n to,\n onPress,\n onClick,\n ref,\n class: className,\n match = \"prefix\",\n target,\n ...rest\n } = props as NavLinkProps & {\n onPress?: (event: Event) => void;\n onClick?: (event: MouseEvent) => void;\n };\n const href = to?.href ?? suppliedHref;\n if (!href) {\n throw new Error(\"Nav link requires href or to.\");\n }\n assertSafeNavigationHref(href);\n const inheritedSlot =\n options.inheritSlot && typeof (rest as Record<string, unknown>)[\"data-slot\"] === \"string\"\n ? String((rest as Record<string, unknown>)[\"data-slot\"])\n : undefined;\n const resolvedSlot = (inheritedSlot ?? slot) as \"nav-item\" | \"tab\" | \"pill\";\n const inheritedNavClass =\n slot === \"nav-item\" && resolvedSlot !== \"nav-item\" ? \"nav-item\" : undefined;\n const { \"data-slot\": _dataSlot, ...childRest } = rest as Record<string, unknown>;\n void _dataSlot;\n const hasDownload = (rest as Record<string, unknown>).download !== undefined;\n const currentPathname = getReactiveCurrentPathname();\n const targetPathname = resolvePathname(href);\n const routeActive =\n currentPathname !== null &&\n targetPathname !== null &&\n isActiveNavLink(currentPathname, targetPathname, match);\n const isActive = active ?? routeActive;\n const activeProps = isActive\n ? {\n \"aria-current\": \"page\" as const,\n \"data-active\": \"true\" as const,\n }\n : {\n \"data-active\": undefined,\n };\n const rendersRouterLink =\n targetPathname !== null &&\n !target &&\n !hasDownload &&\n typeof onClick !== \"function\" &&\n typeof onPress !== \"function\";\n const childProps: NavLinkProps = to\n ? ({ ...childRest, to, target } as NavLinkProps)\n : ({ ...childRest, href, target } as NavLinkProps);\n const handleClick = (event: MouseEvent) => {\n onPress?.(event);\n if (event.defaultPrevented) return;\n onClick?.(event);\n if (hasDownload) return;\n\n if (!shouldHandleClientNavigation(event, target, targetPathname)) {\n return;\n }\n\n event.preventDefault();\n navigate(href);\n };\n\n return (\n <LayoutBlock\n asChild\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius={resolvedSlot === \"pill\" ? \"round\" : \"md\"}\n background={isActive && options.activeBackground ? \"selected\" : undefined}\n ref={ref}\n className={classes(options.className, inheritedNavClass, className)}\n data-slot={resolvedSlot}\n {...activeProps}\n >\n {rendersRouterLink ? (\n <Link {...childProps}>{children}</Link>\n ) : (\n <a {...childRest} href={href} target={target} onClick={handleClick}>\n {children}\n </a>\n )}\n </LayoutBlock>\n );\n}\n\nexport function Tabs(props: TabsProps): JSX.Element;\nexport function Tabs(props: TabsAsChildProps): JSX.Element;\nexport function Tabs(props: TabsProps | TabsAsChildProps): JSX.Element {\n return renderNavSet(props, \"tabs\");\n}\n\nexport function Pills(props: PillsProps): JSX.Element;\nexport function Pills(props: PillsAsChildProps): JSX.Element;\nexport function Pills(props: PillsProps | PillsAsChildProps): JSX.Element {\n return renderNavSet(props, \"pills\");\n}\n\nexport function Tab(props: TabProps): JSX.Element {\n return renderRoutedLink(props, \"tab\", { className: \"tab\" });\n}\n\nexport function Pill(props: PillProps): JSX.Element {\n return renderRoutedLink(props, \"pill\", { activeBackground: true, className: \"pill\" });\n}\n\nexport function NavItem(props: NavItemProps): JSX.Element;\nexport function NavItem(props: NavItemAsChildProps): JSX.Element;\nexport function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element {\n const {\n asChild,\n active = false,\n children,\n ref,\n class: className,\n match: _match,\n ...rest\n } = props as (NavItemProps | NavItemAsChildProps) & { match?: unknown };\n void _match;\n\n if (asChild) {\n return (\n <LayoutBlock\n asChild\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius=\"md\"\n background={active ? \"selected\" : undefined}\n {...rest}\n ref={ref}\n className={className}\n data-active={active ? \"true\" : undefined}\n data-slot=\"nav-item\"\n >\n {children}\n </LayoutBlock>\n );\n }\n\n return (\n <LayoutBlock\n as=\"a\"\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius=\"md\"\n background={active ? \"selected\" : undefined}\n {...rest}\n ref={ref}\n className={className}\n data-active={active ? \"true\" : undefined}\n data-slot=\"nav-item\"\n >\n {children}\n </LayoutBlock>\n );\n}\n\nexport function NavLink(props: NavLinkProps): JSX.Element {\n return renderRoutedLink(props, \"nav-item\", { activeBackground: true, inheritSlot: true });\n}\n"],"mappings":";;;;;;;;;AAoBA,MAAM,cAAc;AAEpB,SAAS,kBAAkB,UAA0B;CACnD,OAAO,SAAS,SAAS,GAAG,KAAK,aAAa,MAAM,SAAS,MAAM,GAAG,EAAE,IAAI;AAC9E;AAEA,SAAS,qBAAoC;CAC3C,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,OAAO,kBAAkB,OAAO,SAAS,YAAY,GAAG;AAC1D;AAEA,SAAS,6BAA4C;CACnD,IAAI;EACF,OAAO,kBAAkB,aAAa,CAAC,CAAC,QAAQ,GAAG;CACrD,QAAQ;EACN,OAAO,mBAAmB;CAC5B;AACF;AAEA,SAAS,gBACP,iBACA,gBACA,QAA+B,UACtB;CACT,IAAI,mBAAmB,KACrB,OAAO,oBAAoB;CAG7B,IAAI,UAAU,SACZ,OAAO,oBAAoB;CAG7B,OAAO,oBAAoB,kBAAkB,gBAAgB,WAAW,GAAG,eAAe,EAAE;AAC9F;AAEA,SAAS,6BACP,OACA,QACA,gBACS;CACT,IAAI,mBAAmB,QAAQ,QAC7B,OAAO;CAGT,OACE,CAAC,MAAM,qBACN,MAAM,UAAU,OAAO,KACxB,CAAC,MAAM,UACP,CAAC,MAAM,WACP,CAAC,MAAM,WACP,CAAC,MAAM;AAEX;AAEA,SAAS,aACP,OACA,MACa;CACb,MAAM,YAAY,WAAW,QAAQ,MAAM,QAAQ,KAAA;CACnD,MAAM,EAAE,SAAS,UAAU,KAAK,GAAG,SAAS;CAC5C,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,MAAM,SAAS;EAC9B,aAAa;CACf,CAAC;CAED,IAAI,SACF,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAA0B,CAAA;CAG3E,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components/nav/nav.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { currentRoute, Link, navigate } from \"@askrjs/askr/router\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport { assertSafeNavigationHref, resolvePathname } from \"../_internal/pathname\";\nimport type {\n NavItemAsChildProps,\n NavItemProps,\n NavLinkProps,\n PillProps,\n PillsAsChildProps,\n PillsProps,\n TabProps,\n TabsAsChildProps,\n TabsProps,\n} from \"./nav.types\";\n\nconst LayoutBlock = Block as (props: Record<string, unknown>) => JSX.Element;\n\nfunction normalizePathname(pathname: string): string {\n return pathname.endsWith(\"/\") && pathname !== \"/\" ? pathname.slice(0, -1) : pathname;\n}\n\nfunction getCurrentPathname(): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n return normalizePathname(window.location.pathname || \"/\");\n}\n\nfunction getReactiveCurrentPathname(): string | null {\n try {\n return normalizePathname(currentRoute().path || \"/\");\n } catch {\n return getCurrentPathname();\n }\n}\n\nfunction isActiveNavLink(\n currentPathname: string,\n targetPathname: string,\n match: NavLinkProps[\"match\"] = \"prefix\",\n): boolean {\n if (targetPathname === \"/\") {\n return currentPathname === \"/\";\n }\n\n if (match === \"exact\") {\n return currentPathname === targetPathname;\n }\n\n return currentPathname === targetPathname || currentPathname.startsWith(`${targetPathname}/`);\n}\n\nfunction shouldHandleClientNavigation(\n event: MouseEvent,\n target: string | undefined,\n targetPathname: string | null,\n): boolean {\n if (targetPathname === null || target) {\n return false;\n }\n\n return (\n !event.defaultPrevented &&\n (event.button ?? 0) === 0 &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.shiftKey\n );\n}\n\nfunction renderNavSet(\n props: TabsProps | TabsAsChildProps | PillsProps | PillsAsChildProps,\n slot: \"tabs\" | \"pills\",\n): JSX.Element {\n const className = \"class\" in props ? props.class : undefined;\n const { asChild, children, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(slot, className),\n \"data-slot\": slot,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return intrinsicElement(\"nav\", finalProps, children);\n}\n\nfunction renderRoutedLink(\n props: NavLinkProps | TabProps | PillProps,\n slot: \"nav-item\" | \"tab\" | \"pill\",\n options: { activeBackground?: boolean; className?: string; inheritSlot?: boolean } = {},\n): JSX.Element {\n const {\n active,\n children,\n href: suppliedHref,\n to,\n onPress,\n onClick,\n ref,\n class: className,\n match = \"prefix\",\n target,\n ...rest\n } = props as NavLinkProps & {\n onPress?: (event: Event) => void;\n onClick?: (event: MouseEvent) => void;\n };\n const href = to?.href ?? suppliedHref;\n if (!href) {\n throw new Error(\"Nav link requires href or to.\");\n }\n assertSafeNavigationHref(href);\n const inheritedSlot =\n options.inheritSlot && typeof (rest as Record<string, unknown>)[\"data-slot\"] === \"string\"\n ? String((rest as Record<string, unknown>)[\"data-slot\"])\n : undefined;\n const resolvedSlot = (inheritedSlot ?? slot) as \"nav-item\" | \"tab\" | \"pill\";\n const inheritedNavClass =\n slot === \"nav-item\" && resolvedSlot !== \"nav-item\" ? \"nav-item\" : undefined;\n const { \"data-slot\": _dataSlot, ...childRest } = rest as Record<string, unknown>;\n void _dataSlot;\n const hasDownload = (rest as Record<string, unknown>).download !== undefined;\n const currentPathname = getReactiveCurrentPathname();\n const targetPathname = resolvePathname(href);\n const routeActive =\n currentPathname !== null &&\n targetPathname !== null &&\n isActiveNavLink(currentPathname, targetPathname, match);\n const isActive = active ?? routeActive;\n const activeProps = isActive\n ? {\n \"aria-current\": \"page\" as const,\n \"data-active\": \"true\" as const,\n }\n : {\n \"data-active\": undefined,\n };\n const rendersRouterLink =\n targetPathname !== null &&\n !target &&\n !hasDownload &&\n typeof onClick !== \"function\" &&\n typeof onPress !== \"function\";\n const childProps: NavLinkProps = to\n ? ({ ...childRest, to, target } as NavLinkProps)\n : ({ ...childRest, href, target } as NavLinkProps);\n const handleClick = (event: MouseEvent) => {\n onPress?.(event);\n if (event.defaultPrevented) return;\n onClick?.(event);\n if (hasDownload) return;\n\n if (!shouldHandleClientNavigation(event, target, targetPathname)) {\n return;\n }\n\n event.preventDefault();\n navigate(href);\n };\n\n return (\n <LayoutBlock\n asChild\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius={resolvedSlot === \"pill\" ? \"round\" : \"md\"}\n background={isActive && options.activeBackground ? \"selected\" : undefined}\n ref={ref}\n className={classes(options.className, inheritedNavClass, className)}\n data-slot={resolvedSlot}\n {...activeProps}\n >\n {rendersRouterLink ? (\n <Link {...childProps}>{children}</Link>\n ) : (\n <a {...childRest} href={href} target={target} onClick={handleClick}>\n {children}\n </a>\n )}\n </LayoutBlock>\n );\n}\n\nexport function Tabs(props: TabsProps): JSX.Element;\nexport function Tabs(props: TabsAsChildProps): JSX.Element;\nexport function Tabs(props: TabsProps | TabsAsChildProps): JSX.Element {\n return renderNavSet(props, \"tabs\");\n}\n\nexport function Pills(props: PillsProps): JSX.Element;\nexport function Pills(props: PillsAsChildProps): JSX.Element;\nexport function Pills(props: PillsProps | PillsAsChildProps): JSX.Element {\n return renderNavSet(props, \"pills\");\n}\n\nexport function Tab(props: TabProps): JSX.Element {\n return renderRoutedLink(props, \"tab\", { className: \"tab\" });\n}\n\nexport function Pill(props: PillProps): JSX.Element {\n return renderRoutedLink(props, \"pill\", { activeBackground: true, className: \"pill\" });\n}\n\nexport function NavItem(props: NavItemProps): JSX.Element;\nexport function NavItem(props: NavItemAsChildProps): JSX.Element;\nexport function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element {\n const {\n asChild,\n active = false,\n children,\n ref,\n class: className,\n match: _match,\n ...rest\n } = props as (NavItemProps | NavItemAsChildProps) & { match?: unknown };\n void _match;\n\n if (asChild) {\n return (\n <LayoutBlock\n asChild\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius=\"md\"\n background={active ? \"selected\" : undefined}\n {...rest}\n ref={ref}\n className={className}\n data-active={active ? \"true\" : undefined}\n data-slot=\"nav-item\"\n >\n {children}\n </LayoutBlock>\n );\n }\n\n return (\n <LayoutBlock\n as=\"a\"\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius=\"md\"\n background={active ? \"selected\" : undefined}\n {...rest}\n ref={ref}\n className={className}\n data-active={active ? \"true\" : undefined}\n data-slot=\"nav-item\"\n >\n {children}\n </LayoutBlock>\n );\n}\n\nexport function NavLink(props: NavLinkProps): JSX.Element {\n return renderRoutedLink(props, \"nav-item\", { activeBackground: true, inheritSlot: true });\n}\n"],"mappings":";;;;;;;;;AAoBA,MAAM,cAAc;AAEpB,SAAS,kBAAkB,UAA0B;CACnD,OAAO,SAAS,SAAS,GAAG,KAAK,aAAa,MAAM,SAAS,MAAM,GAAG,EAAE,IAAI;AAC9E;AAEA,SAAS,qBAAoC;CAC3C,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,OAAO,kBAAkB,OAAO,SAAS,YAAY,GAAG;AAC1D;AAEA,SAAS,6BAA4C;CACnD,IAAI;EACF,OAAO,kBAAkB,aAAa,CAAC,CAAC,QAAQ,GAAG;CACrD,QAAQ;EACN,OAAO,mBAAmB;CAC5B;AACF;AAEA,SAAS,gBACP,iBACA,gBACA,QAA+B,UACtB;CACT,IAAI,mBAAmB,KACrB,OAAO,oBAAoB;CAG7B,IAAI,UAAU,SACZ,OAAO,oBAAoB;CAG7B,OAAO,oBAAoB,kBAAkB,gBAAgB,WAAW,GAAG,eAAe,EAAE;AAC9F;AAEA,SAAS,6BACP,OACA,QACA,gBACS;CACT,IAAI,mBAAmB,QAAQ,QAC7B,OAAO;CAGT,OACE,CAAC,MAAM,qBACN,MAAM,UAAU,OAAO,KACxB,CAAC,MAAM,UACP,CAAC,MAAM,WACP,CAAC,MAAM,WACP,CAAC,MAAM;AAEX;AAEA,SAAS,aACP,OACA,MACa;CACb,MAAM,YAAY,W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;EACP,YAAY,SAAS,aAAa,KAAA;EAClC,GAAI;EACC;EACM;EACX,eAAa,SAAS,SAAS,KAAA;EAC/B,aAAU;EAET;CACU,CAAA;AAEjB;AAEA,SAAgB,QAAQ,OAAkC;CACxD,OAAO,iBAAiB,OAAO,YAAY;EAAE,kBAAkB;EAAM,aAAa;CAAK,CAAC;AAC1F"}
@@ -1,7 +1,7 @@
1
1
  import { JSX } from "@askrjs/askr/jsx-runtime";
2
2
  import { JSXElement } from "@askrjs/askr/foundations";
3
- import { Ref } from "@askrjs/askr/foundations/utilities";
4
3
  import { LinkProps } from "@askrjs/askr/router";
4
+ import { Ref } from "@askrjs/askr/foundations/utilities";
5
5
  //#region src/components/nav/nav.types.d.ts
6
6
  type NavLinkMatch = "prefix" | "exact";
7
7
  type TabsOwnProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"navbar.js","names":["DropdownContent"],"sources":["../../../src/components/navbar/navbar.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n Dropdown,\n DropdownTrigger,\n} from \"@askrjs/ui\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { isJsxElement, toChildArray } from \"../_internal/jsx\";\nimport { DropdownContent } from \"../overlays/dropdown-content\";\nimport type { NavBrandProps, NavDropdownProps, NavGroupProps, NavbarProps } from \"./navbar.types\";\n\nconst ASKR_FRAGMENT = Symbol.for(\"askr.fragment\");\nconst LayoutBlock = Block as (props: Record<string, unknown>) => JSX.Element;\n\nfunction flattenNavbarChildren(children: unknown): unknown[] {\n return toChildArray(children).flatMap((child) => {\n if (isJsxElement(child) && child.type === ASKR_FRAGMENT) {\n return flattenNavbarChildren(child.props?.children);\n }\n\n return [child];\n });\n}\n\nfunction isNavBrandChild(child: unknown): boolean {\n return (\n isJsxElement(child) && (child.type === NavBrand || child.props?.[\"data-slot\"] === \"nav-brand\")\n );\n}\n\nfunction hasRenderableChildren(children: readonly unknown[]): boolean {\n return children.some((child) => {\n if (Array.isArray(child)) {\n return hasRenderableChildren(child);\n }\n\n return child !== undefined && child !== null && typeof child !== \"boolean\";\n });\n}\n\nexport function Navbar(props: NavbarProps): JSX.Element {\n const {\n breakpoint,\n children,\n collapseAt = breakpoint ?? false,\n collapseIcon,\n collapseLabel = \"Menu\",\n ...rest\n } = props;\n\n if (!collapseAt) {\n return (\n <LayoutBlock\n as=\"nav\"\n direction=\"row\"\n align=\"center\"\n gap=\"md\"\n width=\"full\"\n {...rest}\n data-slot=\"navbar\"\n >\n {children}\n </LayoutBlock>\n );\n }\n\n const navbarChildren = flattenNavbarChildren(children);\n const brandChildren = navbarChildren.filter(isNavBrandChild);\n const navChildren = navbarChildren.filter((child) => !isNavBrandChild(child));\n const hasNavContent = hasRenderableChildren(navChildren);\n const content = (\n <LayoutBlock direction=\"row\" align=\"center\" gap=\"md\" width=\"full\" data-slot=\"navbar-content\">\n {navChildren}\n </LayoutBlock>\n );\n const collapse = hasNavContent ? (\n <div data-slot=\"navbar-collapse\">\n <Collapsible>\n <CollapsibleTrigger aria-label={collapseLabel} data-slot=\"navbar-toggle\">\n {collapseIcon}\n <span data-slot=\"navbar-toggle-label\">{collapseLabel}</span>\n </CollapsibleTrigger>\n <CollapsibleContent forceMount asChild data-slot=\"navbar-content\">\n {content}\n </CollapsibleContent>\n </Collapsible>\n </div>\n ) : null;\n\n return (\n <LayoutBlock\n as=\"nav\"\n direction=\"row\"\n align=\"center\"\n gap=\"md\"\n width=\"full\"\n {...rest}\n data-collapse-at={collapseAt}\n data-slot=\"navbar\"\n >\n {[...brandChildren, collapse]}\n </LayoutBlock>\n );\n}\n\nexport function NavBrand(props: NavBrandProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <LayoutBlock\n direction=\"row\"\n align=\"center\"\n gap=\"sm\"\n shrink={false}\n {...rest}\n data-slot=\"nav-brand\"\n >\n {children}\n </LayoutBlock>\n );\n}\n\nexport function NavGroup(props: NavGroupProps): JSX.Element {\n const { align, children, label, title = label, ...rest } = props;\n\n return (\n <LayoutBlock align={align} gap=\"sm\" {...rest} data-align={align} data-slot=\"nav-group\">\n {title !== undefined ? <div data-slot=\"nav-group-label\">{title}</div> : null}\n <LayoutBlock gap=\"xs\" data-slot=\"nav-group-body\">\n {children}\n </LayoutBlock>\n </LayoutBlock>\n );\n}\n\nexport function NavDropdown(props: NavDropdownProps): JSX.Element {\n const { align = \"end\", children, label, side = \"bottom\", sideOffset = 6, ...rest } = props;\n\n return (\n <LayoutBlock direction=\"row\" align=\"center\" data-slot=\"nav-dropdown\">\n <Dropdown {...rest}>\n <DropdownTrigger class={classes(\"nav-item\")} data-slot=\"nav-dropdown-trigger\">\n {label}\n </DropdownTrigger>\n <DropdownContent\n align={align}\n class={classes(\"dropdown-content\")}\n data-slot=\"nav-dropdown-content\"\n side={side}\n sideOffset={sideOffset}\n >\n {children}\n </DropdownContent>\n </Dropdown>\n </LayoutBlock>\n );\n}\n"],"mappings":";;;;;;;AAcA,MAAM,gBAAgB,OAAO,IAAI,eAAe;AAChD,MAAM,cAAc;AAEpB,SAAS,sBAAsB,UAA8B;CAC3D,OAAO,aAAa,QAAQ,CAAC,CAAC,SAAS,UAAU;EAC/C,IAAI,aAAa,KAAK,KAAK,MAAM,SAAS,eACxC,OAAO,sBAAsB,MAAM,OAAO,QAAQ;EAGpD,OAAO,CAAC,KAAK;CACf,CAAC;AACH;AAEA,SAAS,gBAAgB,OAAyB;CAChD,OACE,aAAa,KAAK,MAAM,MAAM,SAAS,YAAY,MAAM,QAAQ,iBAAiB;AAEtF;AAEA,SAAS,sBAAsB,UAAuC;CACpE,OAAO,SAAS,MAAM,UAAU;EAC9B,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,sBAAsB,KAAK;EAGpC,OAAO,UAAU,KAAA,KAAa,UAAU,QAAQ,OAAO,UAAU;CACnE,CAAC;AACH;AAEA,SAAgB,OAAO,OAAiC;CACtD,MAAM,EACJ,YACA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I;EAAM,cAAY;EAAO,aAAU;YAA3E,CACG,UAAU,KAAA,IAAY,oBAAC,OAAD;GAAK,aAAU;aAAmB;EAAW,CAAA,IAAI,MACxE,oBAAC,aAAD;GAAa,KAAI;GAAK,aAAU;GAC7B;EACU,CAAA,CACF;;AAEjB;AAEA,SAAgB,YAAY,OAAsC;CAChE,MAAM,EAAE,QAAQ,OAAO,UAAU,OAAO,OAAO,UAAU,aAAa,GAAG,GAAG,SAAS;CAErF,OACE,oBAAC,aAAD;EAAa,WAAU;EAAM,OAAM;EAAS,aAAU;YACpD,qBAAC,UAAD;GAAU,GAAI;aAAd,CACE,oBAAC,iBAAD;IAAiB,OAAO,QAAQ,UAAU;IAAG,aAAU;cACpD;GACc,CAAA,GACjB,oBAACA,mBAAD;IACS;IACP,OAAO,QAAQ,kBAAkB;IACjC,aAAU;IACJ;IACM;IAEX;GACc,CAAA,CACT;;CACC,CAAA;AAEjB"}
1
+ {"version":3,"file":"navbar.js","names":["DropdownContent"],"sources":["../../../src/components/navbar/navbar.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n Dropdown,\n DropdownTrigger,\n} from \"@askrjs/ui\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { isJsxElement, toChildArray } from \"../_internal/jsx\";\nimport { DropdownContent } from \"../overlays/dropdown-content\";\nimport type { NavBrandProps, NavDropdownProps, NavGroupProps, NavbarProps } from \"./navbar.types\";\n\nconst ASKR_FRAGMENT = Symbol.for(\"askr.fragment\");\nconst LayoutBlock = Block as (props: Record<string, unknown>) => JSX.Element;\n\nfunction flattenNavbarChildren(children: unknown): unknown[] {\n return toChildArray(children).flatMap((child) => {\n if (isJsxElement(child) && child.type === ASKR_FRAGMENT) {\n return flattenNavbarChildren(child.props?.children);\n }\n\n return [child];\n });\n}\n\nfunction isNavBrandChild(child: unknown): boolean {\n return (\n isJsxElement(child) && (child.type === NavBrand || child.props?.[\"data-slot\"] === \"nav-brand\")\n );\n}\n\nfunction hasRenderableChildren(children: readonly unknown[]): boolean {\n return children.some((child) => {\n if (Array.isArray(child)) {\n return hasRenderableChildren(child);\n }\n\n return child !== undefined && child !== null && typeof child !== \"boolean\";\n });\n}\n\nexport function Navbar(props: NavbarProps): JSX.Element {\n const {\n breakpoint,\n children,\n collapseAt = breakpoint ?? false,\n collapseIcon,\n collapseLabel = \"Menu\",\n ...rest\n } = props;\n\n if (!collapseAt) {\n return (\n <LayoutBlock\n as=\"nav\"\n direction=\"row\"\n align=\"center\"\n gap=\"md\"\n width=\"full\"\n {...rest}\n data-slot=\"navbar\"\n >\n {children}\n </LayoutBlock>\n );\n }\n\n const navbarChildren = flattenNavbarChildren(children);\n const brandChildren = navbarChildren.filter(isNavBrandChild);\n const navChildren = navbarChildren.filter((child) => !isNavBrandChild(child));\n const hasNavContent = hasRenderableChildren(navChildren);\n const content = (\n <LayoutBlock direction=\"row\" align=\"center\" gap=\"md\" width=\"full\" data-slot=\"navbar-content\">\n {navChildren}\n </LayoutBlock>\n );\n const collapse = hasNavContent ? (\n <div data-slot=\"navbar-collapse\">\n <Collapsible>\n <CollapsibleTrigger aria-label={collapseLabel} data-slot=\"navbar-toggle\">\n {collapseIcon}\n <span data-slot=\"navbar-toggle-label\">{collapseLabel}</span>\n </CollapsibleTrigger>\n <CollapsibleContent forceMount asChild data-slot=\"navbar-content\">\n {content}\n </CollapsibleContent>\n </Collapsible>\n </div>\n ) : null;\n\n return (\n <LayoutBlock\n as=\"nav\"\n direction=\"row\"\n align=\"center\"\n gap=\"md\"\n width=\"full\"\n {...rest}\n data-collapse-at={collapseAt}\n data-slot=\"navbar\"\n >\n {[...brandChildren, collapse]}\n </LayoutBlock>\n );\n}\n\nexport function NavBrand(props: NavBrandProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <LayoutBlock\n direction=\"row\"\n align=\"center\"\n gap=\"sm\"\n shrink={false}\n {...rest}\n data-slot=\"nav-brand\"\n >\n {children}\n </LayoutBlock>\n );\n}\n\nexport function NavGroup(props: NavGroupProps): JSX.Element {\n const { align, children, label, title = label, ...rest } = props;\n\n return (\n <LayoutBlock align={align} gap=\"sm\" {...rest} data-align={align} data-slot=\"nav-group\">\n {title !== undefined ? <div data-slot=\"nav-group-label\">{title}</div> : null}\n <LayoutBlock gap=\"xs\" data-slot=\"nav-group-body\">\n {children}\n </LayoutBlock>\n </LayoutBlock>\n );\n}\n\nexport function NavDropdown(props: NavDropdownProps): JSX.Element {\n const { align = \"end\", children, label, side = \"bottom\", sideOffset = 6, ...rest } = props;\n\n return (\n <LayoutBlock direction=\"row\" align=\"center\" data-slot=\"nav-dropdown\">\n <Dropdown {...rest}>\n <DropdownTrigger class={classes(\"nav-item\")} data-slot=\"nav-dropdown-trigger\">\n {label}\n </DropdownTrigger>\n <DropdownContent\n align={align}\n class={classes(\"dropdown-content\")}\n data-slot=\"nav-dropdown-content\"\n side={side}\n sideOffset={sideOffset}\n >\n {children}\n </DropdownContent>\n </Dropdown>\n </LayoutBlock>\n );\n}\n"],"mappings":";;;;;;;AAcA,MAAM,gBAAgB,OAAO,IAAI,eAAe;AAChD,MAAM,cAAc;AAEpB,SAAS,sBAAsB,UAA8B;CAC3D,OAAO,aAAa,QAAQ,CAAC,CAAC,SAAS,UAAU;EAC/C,IAAI,aAAa,KAAK,KAAK,MAAM,SAAS,eACxC,OAAO,sBAAsB,MAAM,OAAO,QAAQ;EAGpD,OAAO,CAAC,KAAK;CACf,CAAC;AACH;AAEA,SAAS,gBAAgB,OAAyB;CAChD,OACE,aAAa,KAAK,MAAM,MAAM,SAAS,YAAY,MAAM,QAAQ,iBAAiB;AAEtF;AAEA,SAAS,sBAAsB,UAAuC;CACpE,OAAO,SAAS,MAAM,UAAU;EAC9B,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,sBAAsB,KAAK;EAGpC,OAAO,UAAU,KAAA,KAAa,UAAU,QAAQ,OAAO,UAAU;CAC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,MAAM,EAAE,OAAO,UAAU,OAAO,QAAQ,OAAO,GAAG,SAAS;CAE3D,OACE,qBAAC,aAAD;EAAoB;EAAO,KAAI;EAAK,GAAI;EAAM,cAAY;EAAO,aAAU;EAA3E,UAAA,CACG,UAAU,KAAA,IAAY,oBAAC,OAAD;GAAK,aAAU;GAAmB,UAAA;EAAW,CAAA,IAAI,MACxE,oBAAC,aAAD;GAAa,KAAI;GAAK,aAAU;GAC7B;EACU,CAAA,CACF;;AAEjB;AAEA,SAAgB,YAAY,OAAsC;CAChE,MAAM,EAAE,QAAQ,OAAO,UAAU,OAAO,OAAO,UAAU,aAAa,GAAG,GAAG,SAAS;CAErF,OACE,oBAAC,aAAD;EAAa,WAAU;EAAM,OAAM;EAAS,aAAU;EACpD,UAAA,qBAAC,UAAD;GAAU,GAAI;GAAd,UAAA,CACE,oBAAC,iBAAD;IAAiB,OAAO,QAAQ,UAAU;IAAG,aAAU;IACpD,UAAA;GACc,CAAA,GACjB,oBAACA,mBAAD;IACS;IACP,OAAO,QAAQ,kBAAkB;IACjC,aAAU;IACJ;IACM;IAEX;GACc,CAAA,CACT;;CACC,CAAA;AAEjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-content.js","names":["DropdownContent","UiDropdownContent"],"sources":["../../../src/components/overlays/dropdown-content.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { DropdownContent as UiDropdownContent } from \"@askrjs/ui\";\nimport type { DropdownContentAsChildProps, DropdownContentProps } from \"@askrjs/ui\";\n\ntype DropdownContentBodyProps = {\n render: () => unknown;\n};\n\nfunction DropdownContentBody(props: DropdownContentBodyProps): JSX.Element {\n return <>{props.render()}</>;\n}\n\nexport function DropdownContent(props: DropdownContentProps): JSX.Element | null;\nexport function DropdownContent(props: DropdownContentAsChildProps): JSX.Element | null;\nexport function DropdownContent(\n props: DropdownContentProps | DropdownContentAsChildProps,\n): JSX.Element | null {\n if (\"asChild\" in props && props.asChild) {\n return <UiDropdownContent {...props} />;\n }\n\n const { children, ...rest } = props as DropdownContentProps;\n\n return (\n <UiDropdownContent {...rest}>\n <DropdownContentBody render={() => children} />\n </UiDropdownContent>\n );\n}\n"],"mappings":";;;AAQA,SAAS,oBAAoB,OAA8C;CACzE,OAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,OAAO,EAAI,CAAA;AAC7B;AAIA,SAAgBA,kBACd,OACoB;CACpB,IAAI,aAAa,SAAS,MAAM,SAC9B,OAAO,oBAACC,iBAAD,EAAmB,GAAI,MAAQ,CAAA;CAGxC,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAACA,iBAAD;EAAmB,GAAI;YACrB,oBAAC,qBAAD,EAAqB,cAAc,SAAW,CAAA;CAC7B,CAAA;AAEvB"}
1
+ {"version":3,"file":"dropdown-content.js","names":["DropdownContent","UiDropdownContent"],"sources":["../../../src/components/overlays/dropdown-content.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { DropdownContent as UiDropdownContent } from \"@askrjs/ui\";\nimport type { DropdownContentAsChildProps, DropdownContentProps } from \"@askrjs/ui\";\n\ntype DropdownContentBodyProps = {\n render: () => unknown;\n};\n\nfunction DropdownContentBody(props: DropdownContentBodyProps): JSX.Element {\n return <>{props.render()}</>;\n}\n\nexport function DropdownContent(props: DropdownContentProps): JSX.Element | null;\nexport function DropdownContent(props: DropdownContentAsChildProps): JSX.Element | null;\nexport function DropdownContent(\n props: DropdownContentProps | DropdownContentAsChildProps,\n): JSX.Element | null {\n if (\"asChild\" in props && props.asChild) {\n return <UiDropdownContent {...props} />;\n }\n\n const { children, ...rest } = props as DropdownContentProps;\n\n return (\n <UiDropdownContent {...rest}>\n <DropdownContentBody render={() => children} />\n </UiDropdownContent>\n );\n}\n"],"mappings":";;;AAQA,SAAS,oBAAoB,OAA8C;CACzE,OAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,OAAO,EAAI,CAAA;AAC7B;AAIA,SAAgBA,kBACd,OACoB;CACpB,IAAI,aAAa,SAAS,MAAM,SAC9B,OAAO,oBAACC,iBAAD,EAAmB,GAAI,MAAQ,CAAA;CAGxC,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAACA,iBAAD;EAAmB,GAAI;EACrB,UAAA,oBAAC,qBAAD,EAAqB,cAAc,SAAW,CAAA;CAC7B,CAAA;AAEvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","names":[],"sources":["../../../src/components/page/page.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport { Container } from \"../container\";\nimport type { PageProps } from \"./page.types\";\n\nexport function Page(props: PageProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <Block as=\"main\" grow {...rest} data-slot=\"page\">\n <Container>\n <Block paddingY=\"xl\" gap=\"lg\">\n {children}\n </Block>\n </Container>\n </Block>\n );\n}\n"],"mappings":";;;;AAKA,SAAgB,KAAK,OAA+B;CAClD,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAAC,OAAD;EAAO,IAAG;EAAO,MAAA;EAAK,GAAI;EAAM,aAAU;YACxC,oBAAC,WAAD,EAAA,UACE,oBAAC,OAAD;GAAO,UAAS;GAAK,KAAI;GACtB;EACI,CAAA,EACE,CAAA;CACN,CAAA;AAEX"}
1
+ {"version":3,"file":"page.js","names":[],"sources":["../../../src/components/page/page.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport { Container } from \"../container\";\nimport type { PageProps } from \"./page.types\";\n\nexport function Page(props: PageProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <Block as=\"main\" grow {...rest} data-slot=\"page\">\n <Container>\n <Block paddingY=\"xl\" gap=\"lg\">\n {children}\n </Block>\n </Container>\n </Block>\n );\n}\n"],"mappings":";;;;AAKA,SAAgB,KAAK,OAA+B;CAClD,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAAC,OAAD;EAAO,IAAG;EAAO,MAAA;EAAK,GAAI;EAAM,aAAU;EACxC,UAAA,oBAAC,WAAD,EAAA,UACE,oBAAC,OAAD;GAAO,UAAS;GAAK,KAAI;GACtB;EACI,CAAA,EACE,CAAA;CACN,CAAA;AAEX"}
@@ -1 +1 @@
1
- {"version":3,"file":"page-header.js","names":[],"sources":["../../../src/components/page-header/page-header.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport type { PageHeaderProps } from \"./page-header.types\";\n\nexport function PageHeader(props: PageHeaderProps): JSX.Element {\n const { title, description, actions, ...rest } = props;\n\n return (\n <Block\n rowFrom=\"md\"\n align={{ base: \"start\", md: \"center\" }}\n justify=\"between\"\n gap=\"lg\"\n {...rest}\n data-slot=\"page-header\"\n >\n <Block gap=\"xs\" data-slot=\"page-header-copy\">\n <h1 data-slot=\"page-header-title\">{title}</h1>\n {description !== undefined ? (\n <p data-slot=\"page-header-description\">{description}</p>\n ) : null}\n </Block>\n {actions !== undefined ? (\n <Block direction=\"row\" gap=\"sm\" data-slot=\"page-header-actions\">\n {actions}\n </Block>\n ) : null}\n </Block>\n );\n}\n"],"mappings":";;;AAIA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,EAAE,OAAO,aAAa,SAAS,GAAG,SAAS;CAEjD,OACE,qBAAC,OAAD;EACE,SAAQ;EACR,OAAO;GAAE,MAAM;GAAS,IAAI;EAAS;EACrC,SAAQ;EACR,KAAI;EACJ,GAAI;EACJ,aAAU;YANZ,CAQE,qBAAC,OAAD;GAAO,KAAI;GAAK,aAAU;aAA1B,CACE,oBAAC,MAAD;IAAI,aAAU;cAAqB;GAAU,CAAA,GAC5C,gBAAgB,KAAA,IACf,oBAAC,KAAD;IAAG,aAAU;cAA2B;GAAe,CAAA,IACrD,IACC;MACN,YAAY,KAAA,IACX,oBAAC,OAAD;GAAO,WAAU;GAAM,KAAI;GAAK,aAAU;aACvC;EACI,CAAA,IACL,IACC;;AAEX"}
1
+ {"version":3,"file":"page-header.js","names":[],"sources":["../../../src/components/page-header/page-header.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport type { PageHeaderProps } from \"./page-header.types\";\n\nexport function PageHeader(props: PageHeaderProps): JSX.Element {\n const { title, description, actions, ...rest } = props;\n\n return (\n <Block\n rowFrom=\"md\"\n align={{ base: \"start\", md: \"center\" }}\n justify=\"between\"\n gap=\"lg\"\n {...rest}\n data-slot=\"page-header\"\n >\n <Block gap=\"xs\" data-slot=\"page-header-copy\">\n <h1 data-slot=\"page-header-title\">{title}</h1>\n {description !== undefined ? (\n <p data-slot=\"page-header-description\">{description}</p>\n ) : null}\n </Block>\n {actions !== undefined ? (\n <Block direction=\"row\" gap=\"sm\" data-slot=\"page-header-actions\">\n {actions}\n </Block>\n ) : null}\n </Block>\n );\n}\n"],"mappings":";;;AAIA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,EAAE,OAAO,aAAa,SAAS,GAAG,SAAS;CAEjD,OACE,qBAAC,OAAD;EACE,SAAQ;EACR,OAAO;GAAE,MAAM;GAAS,IAAI;EAAS;EACrC,SAAQ;EACR,KAAI;EACJ,GAAI;EACJ,aAAU;EANZ,UAAA,CAQE,qBAAC,OAAD;GAAO,KAAI;GAAK,aAAU;GAA1B,UAAA,CACE,oBAAC,MAAD;IAAI,aAAU;IAAqB,UAAA;GAAU,CAAA,GAC5C,gBAAgB,KAAA,IACf,oBAAC,KAAD;IAAG,aAAU;IAA2B,UAAA;GAAe,CAAA,IACrD,IACC;EACN,CAAA,GAAA,YAAY,KAAA,IACX,oBAAC,OAAD;GAAO,WAAU;GAAM,KAAI;GAAK,aAAU;GACvC,UAAA;EACI,CAAA,IACL,IACC;;AAEX"}
@@ -1,6 +1,6 @@
1
1
  import { classes } from "../_internal/classes.js";
2
2
  import { mergeProps } from "../_internal/merge-props.js";
3
- import { intrinsicElement } from "../_internal/jsx.js";
3
+ import { intrinsicElement, normalizeAriaProps } from "../_internal/jsx.js";
4
4
  import { Block } from "../block/block.js";
5
5
  import { jsx } from "@askrjs/askr/jsx-runtime";
6
6
  import { Slot } from "@askrjs/askr/foundations";
@@ -13,7 +13,7 @@ function sidebarTooltipProps(tooltip, tooltipSide) {
13
13
  }
14
14
  function sidebarPart(props, slot, element = "div") {
15
15
  const { as, asChild, children, class: className, ...rest } = props;
16
- const finalProps = mergeProps(rest, {
16
+ const finalProps = mergeProps(normalizeAriaProps(rest), {
17
17
  class: className,
18
18
  "data-slot": slot
19
19
  });
@@ -74,7 +74,7 @@ function SidebarMenuItem(props) {
74
74
  }
75
75
  function SidebarMenuButton(props) {
76
76
  const { active, asChild, children, class: className, size, tooltip, tooltipSide, type = "button", variant, ...rest } = props;
77
- const finalProps = mergeProps(rest, {
77
+ const finalProps = mergeProps(normalizeAriaProps(rest), {
78
78
  class: classes(className),
79
79
  "data-active": active ? "true" : void 0,
80
80
  "data-size": size && size !== "default" ? size : void 0,
@@ -95,7 +95,7 @@ function SidebarMenuButton(props) {
95
95
  }
96
96
  function SidebarMenuAction(props) {
97
97
  const { asChild, children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
98
- const finalProps = mergeProps(rest, {
98
+ const finalProps = mergeProps(normalizeAriaProps(rest), {
99
99
  class: classes(className),
100
100
  "data-slot": "sidebar-menu-action",
101
101
  ...sidebarTooltipProps(tooltip, tooltipSide)
@@ -116,7 +116,7 @@ function SidebarMenuBadge(props) {
116
116
  }
117
117
  function SidebarRail(props) {
118
118
  const { asChild, children, class: className, type = "button", ...rest } = props;
119
- const finalProps = mergeProps(rest, {
119
+ const finalProps = mergeProps(normalizeAriaProps(rest), {
120
120
  class: classes(className),
121
121
  "data-slot": "sidebar-rail"
122
122
  });
@@ -133,7 +133,7 @@ function SidebarRail(props) {
133
133
  }
134
134
  function SidebarTrigger(props) {
135
135
  const { asChild, children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
136
- const finalProps = mergeProps(rest, {
136
+ const finalProps = mergeProps(normalizeAriaProps(rest), {
137
137
  class: classes("btn btn-ghost btn-icon", className),
138
138
  "data-slot": "sidebar-trigger",
139
139
  ...sidebarTooltipProps(tooltip, tooltipSide)
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar.js","names":[],"sources":["../../../src/components/sidebar/sidebar.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport type {\n SidebarButtonProps,\n SidebarPartProps,\n SidebarProps,\n SidebarTooltipSide,\n} from \"./sidebar.types\";\n\nfunction sidebarTooltipProps(\n tooltip: string | undefined,\n tooltipSide: SidebarTooltipSide | undefined,\n): Record<string, string | undefined> {\n return {\n \"data-tooltip\": tooltip,\n \"data-tooltip-side\": tooltip ? tooltipSide : undefined,\n };\n}\n\nfunction sidebarPart(\n props: SidebarPartProps,\n slot: string,\n element: keyof JSX.IntrinsicElements = \"div\",\n): JSX.Element {\n const { as, asChild, children, class: className, ...rest } = props;\n const finalProps = mergeProps(rest, {\n class: className,\n \"data-slot\": slot,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return intrinsicElement(String(as ?? element), finalProps, children);\n}\n\nexport function Sidebar(props: SidebarProps): JSX.Element {\n const {\n children,\n collapsible = \"offcanvas\",\n side = \"left\",\n variant = \"sidebar\",\n width = \"sidebar\",\n shrink = false,\n ...rest\n } = props;\n\n return (\n <Block\n as=\"aside\"\n width={width}\n shrink={shrink}\n minHeight=\"screen\"\n padding=\"md\"\n gap=\"lg\"\n borderRight={true}\n {...rest}\n data-collapsible={collapsible}\n data-side={side}\n data-slot=\"sidebar\"\n data-variant={variant}\n >\n {children}\n </Block>\n );\n}\n\nexport function SidebarScope(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-scope\");\n}\n\nexport function SidebarInset(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-inset\", \"main\");\n}\n\nexport function SidebarContent(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-content\");\n}\n\nexport function SidebarHeader(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-header\");\n}\n\nexport function SidebarFooter(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-footer\");\n}\n\nexport function SidebarGroup(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group\");\n}\n\nexport function SidebarGroupLabel(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group-label\");\n}\n\nexport function SidebarGroupContent(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group-content\");\n}\n\nexport function SidebarMenu(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu\", \"ul\");\n}\n\nexport function SidebarMenuItem(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu-item\", \"li\");\n}\n\nexport function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {\n const {\n active,\n asChild,\n children,\n class: className,\n size,\n tooltip,\n tooltipSide,\n type = \"button\",\n variant,\n ...rest\n } = props;\n const finalProps = mergeProps(rest, {\n class: classes(className),\n \"data-active\": active ? \"true\" : undefined,\n \"data-size\": size && size !== \"default\" ? size : undefined,\n \"data-slot\": \"sidebar-menu-button\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n \"data-variant\": variant && variant !== \"default\" ? variant : undefined,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {\n const {\n asChild,\n children,\n class: className,\n tooltip,\n tooltipSide,\n type = \"button\",\n ...rest\n } = props;\n const finalProps = mergeProps(rest, {\n class: classes(className),\n \"data-slot\": \"sidebar-menu-action\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n });\n if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarMenuBadge(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu-badge\", \"span\");\n}\n\nexport function SidebarRail(props: SidebarButtonProps): JSX.Element {\n const { asChild, children, class: className, type = \"button\", ...rest } = props;\n const finalProps = mergeProps(rest, {\n class: classes(className),\n \"data-slot\": \"sidebar-rail\",\n });\n if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarTrigger(props: SidebarButtonProps): JSX.Element {\n const {\n asChild,\n children,\n class: className,\n tooltip,\n tooltipSide,\n type = \"button\",\n ...rest\n } = props;\n const finalProps = mergeProps(rest, {\n class: classes(\"btn btn-ghost btn-icon\", className),\n \"data-slot\": \"sidebar-trigger\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n });\n if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAS,oBACP,SACA,aACoC;CACpC,OAAO;EACL,gBAAgB;EAChB,qBAAqB,UAAU,cAAc,KAAA;CAC/C;AACF;AAEA,SAAS,YACP,OACA,MACA,UAAuC,OAC1B;CACb,MAAM,EAAE,IAAI,SAAS,UAAU,OAAO,WAAW,GAAG,SAAS;CAC7D,MAAM,aAAa,WAAW,MAAM;EAClC,OAAO;EACP,aAAa;CACf,CAAC;CAED,IAAI,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WAAW,MAAM;EAClC,OAAO,QAAQ,0BAA0B,SAAS;EAClD,aAAa;EACb,GAAG,oBAAoB,SAAS,WAAW;CAC7C,CAAC;CACD,IAAI,SAAS,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAA0B,CAAA;CACtF,OACE,oBAAC,UAAD;EAAc;EAAmD,GAAI;EAClE;CACK,CAAA;AAEZ"}
1
+ {"version":3,"file":"sidebar.js","names":[],"sources":["../../../src/components/sidebar/sidebar.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement, normalizeAriaProps } from \"../_internal/jsx\";\nimport type {\n SidebarButtonProps,\n SidebarPartProps,\n SidebarProps,\n SidebarTooltipSide,\n} from \"./sidebar.types\";\n\nfunction sidebarTooltipProps(\n tooltip: string | undefined,\n tooltipSide: SidebarTooltipSide | undefined,\n): Record<string, string | undefined> {\n return {\n \"data-tooltip\": tooltip,\n \"data-tooltip-side\": tooltip ? tooltipSide : undefined,\n };\n}\n\nfunction sidebarPart(\n props: SidebarPartProps,\n slot: string,\n element: keyof JSX.IntrinsicElements = \"div\",\n): JSX.Element {\n const { as, asChild, children, class: className, ...rest } = props;\n const finalProps = mergeProps(normalizeAriaProps(rest), {\n class: className,\n \"data-slot\": slot,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return intrinsicElement(String(as ?? element), finalProps, children);\n}\n\nexport function Sidebar(props: SidebarProps): JSX.Element {\n const {\n children,\n collapsible = \"offcanvas\",\n side = \"left\",\n variant = \"sidebar\",\n width = \"sidebar\",\n shrink = false,\n ...rest\n } = props;\n\n return (\n <Block\n as=\"aside\"\n width={width}\n shrink={shrink}\n minHeight=\"screen\"\n padding=\"md\"\n gap=\"lg\"\n borderRight={true}\n {...rest}\n data-collapsible={collapsible}\n data-side={side}\n data-slot=\"sidebar\"\n data-variant={variant}\n >\n {children}\n </Block>\n );\n}\n\nexport function SidebarScope(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-scope\");\n}\n\nexport function SidebarInset(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-inset\", \"main\");\n}\n\nexport function SidebarContent(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-content\");\n}\n\nexport function SidebarHeader(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-header\");\n}\n\nexport function SidebarFooter(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-footer\");\n}\n\nexport function SidebarGroup(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group\");\n}\n\nexport function SidebarGroupLabel(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group-label\");\n}\n\nexport function SidebarGroupContent(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group-content\");\n}\n\nexport function SidebarMenu(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu\", \"ul\");\n}\n\nexport function SidebarMenuItem(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu-item\", \"li\");\n}\n\nexport function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {\n const {\n active,\n asChild,\n children,\n class: className,\n size,\n tooltip,\n tooltipSide,\n type = \"button\",\n variant,\n ...rest\n } = props;\n const finalProps = mergeProps(normalizeAriaProps(rest), {\n class: classes(className),\n \"data-active\": active ? \"true\" : undefined,\n \"data-size\": size && size !== \"default\" ? size : undefined,\n \"data-slot\": \"sidebar-menu-button\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n \"data-variant\": variant && variant !== \"default\" ? variant : undefined,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {\n const {\n asChild,\n children,\n class: className,\n tooltip,\n tooltipSide,\n type = \"button\",\n ...rest\n } = props;\n const finalProps = mergeProps(normalizeAriaProps(rest), {\n class: classes(className),\n \"data-slot\": \"sidebar-menu-action\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n });\n if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarMenuBadge(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu-badge\", \"span\");\n}\n\nexport function SidebarRail(props: SidebarButtonProps): JSX.Element {\n const { asChild, children, class: className, type = \"button\", ...rest } = props;\n const finalProps = mergeProps(normalizeAriaProps(rest), {\n class: classes(className),\n \"data-slot\": \"sidebar-rail\",\n });\n if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarTrigger(props: SidebarButtonProps): JSX.Element {\n const {\n asChild,\n children,\n class: className,\n tooltip,\n tooltipSide,\n type = \"button\",\n ...rest\n } = props;\n const finalProps = mergeProps(normalizeAriaProps(rest), {\n class: classes(\"btn btn-ghost btn-icon\", className),\n \"data-slot\": \"sidebar-trigger\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n });\n if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n return (\n <button type={type as \"button\" | \"submit\" | \"reset\" | undefined} {...finalProps}>\n {children}\n </button>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAS,oBACP,SACA,aACoC;CACpC,OAAO;EACL,gBAAgB;EAChB,qBAAqB,UAAU,cAAc,KAAA;CAC/C;AACF;AAEA,SAAS,YACP,OACA,MACA,UA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I;EAAsB;CAA0B,CAAA;CACtF,OACE,oBAAC,UAAD;EAAc;EAAmD,GAAI;EAClE;CACK,CAAA;AAEZ;AAEA,SAAgB,eAAe,OAAwC;CACrE,MAAM,EACJ,SACA,UACA,OAAO,WACP,SACA,aACA,OAAO,UACP,GAAG,SACD;CACJ,MAAM,aAAa,WAAW,mBAAmB,IAAI,GAAG;EACtD,OAAO,QAAQ,0BAA0B,SAAS;EAClD,aAAa;EACb,GAAG,oBAAoB,SAAS,WAAW;CAC7C,CAAC;CACD,IAAI,SAAS,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAA0B,CAAA;CACtF,OACE,oBAAC,UAAD;EAAc;EAAmD,GAAI;EAClE;CACK,CAAA;AAEZ"}
@@ -17,9 +17,10 @@ function Skeleton(props) {
17
17
  const inlineSize = resolveSkeletonDimension(width);
18
18
  if (blockSize !== void 0) dimensions.blockSize = blockSize;
19
19
  if (inlineSize !== void 0) dimensions.inlineSize = inlineSize;
20
+ const layoutClass = styleDeclarationsToClass(mergeLayoutStyles(dimensions, style));
20
21
  const finalProps = mergeProps(rest, {
21
22
  ref,
22
- class: classes(classProp, className, styleDeclarationsToClass(mergeLayoutStyles(dimensions, style))),
23
+ class: classes(classProp, className, layoutClass),
23
24
  "data-slot": "skeleton",
24
25
  "data-skeleton": "true",
25
26
  "aria-hidden": "true"
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/skeleton/skeleton.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeLayoutStyles } from \"../_internal/block-layout\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport { styleDeclarationsToClass } from \"../_internal/style\";\nimport type { SkeletonAsChildProps, SkeletonProps } from \"./skeleton.types\";\n\nfunction resolveSkeletonDimension(value: string | number | undefined): string | undefined {\n if (typeof value === \"number\") return `${value}px`;\n return value;\n}\n\nexport function Skeleton(props: SkeletonProps): JSX.Element;\nexport function Skeleton(props: SkeletonAsChildProps): JSX.Element;\nexport function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {\n const {\n asChild,\n children,\n class: classProp,\n className,\n height,\n ref,\n style,\n width,\n ...rest\n } = props as (SkeletonProps | SkeletonAsChildProps) & {\n class?: unknown;\n className?: unknown;\n style?: unknown;\n };\n const dimensions: Record<string, string | number> = {};\n const blockSize = resolveSkeletonDimension(height);\n const inlineSize = resolveSkeletonDimension(width);\n if (blockSize !== undefined) dimensions.blockSize = blockSize;\n if (inlineSize !== undefined) dimensions.inlineSize = inlineSize;\n const layoutClass = styleDeclarationsToClass(mergeLayoutStyles(dimensions, style));\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(classProp, className, layoutClass),\n \"data-slot\": \"skeleton\",\n \"data-skeleton\": \"true\",\n \"aria-hidden\": \"true\",\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children} />;\n }\n\n return intrinsicElement(\"div\", finalProps, children);\n}\n"],"mappings":";;;;;;;;AASA,SAAS,yBAAyB,OAAwD;CACxF,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,OAAO;AACT;AAIA,SAAgB,SAAS,OAA6C;CACpE,MAAM,EACJ,SACA,UACA,OAAO,WACP,WACA,QACA,KACA,OACA,OACA,GAAG,SACD;CAKJ,MAAM,aAA8C,CAAC;CACrD,MAAM,YAAY,yBAAyB,MAAM;CACjD,MAAM,aAAa,yBAAyB,KAAK;CACjD,IAAI,cAAc,KAAA,GAAW,WAAW,YAAY;CACpD,IAAI,eAAe,KAAA,GAAW,WAAW,aAAa;CAEtD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,WAAW,WAHR,yBAAyB,kBAAkB,YAAY,KAAK,CAG/B,CAAC;EAChD,aAAa;EACb,iBAAiB;EACjB,eAAe;CACjB,CAAC;CAED,IAAI,SACF,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAAW,CAAA;CAG5D,OAAO,iBAAiB,OAAO,YAAY,QAAQ;AACrD"}
1
+ {"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/skeleton/skeleton.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeLayoutStyles } from \"../_internal/block-layout\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { intrinsicElement } from \"../_internal/jsx\";\nimport { styleDeclarationsToClass } from \"../_internal/style\";\nimport type { SkeletonAsChildProps, SkeletonProps } from \"./skeleton.types\";\n\nfunction resolveSkeletonDimension(value: string | number | undefined): string | undefined {\n if (typeof value === \"number\") return `${value}px`;\n return value;\n}\n\nexport function Skeleton(props: SkeletonProps): JSX.Element;\nexport function Skeleton(props: SkeletonAsChildProps): JSX.Element;\nexport function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {\n const {\n asChild,\n children,\n class: classProp,\n className,\n height,\n ref,\n style,\n width,\n ...rest\n } = props as (SkeletonProps | SkeletonAsChildProps) & {\n class?: unknown;\n className?: unknown;\n style?: unknown;\n };\n const dimensions: Record<string, string | number> = {};\n const blockSize = resolveSkeletonDimension(height);\n const inlineSize = resolveSkeletonDimension(width);\n if (blockSize !== undefined) dimensions.blockSize = blockSize;\n if (inlineSize !== undefined) dimensions.inlineSize = inlineSize;\n const layoutClass = styleDeclarationsToClass(mergeLayoutStyles(dimensions, style));\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(classProp, className, layoutClass),\n \"data-slot\": \"skeleton\",\n \"data-skeleton\": \"true\",\n \"aria-hidden\": \"true\",\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children} />;\n }\n\n return intrinsicElement(\"div\", finalProps, children);\n}\n"],"mappings":";;;;;;;;AASA,SAAS,yBAAyB,OAAwD;CACxF,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,OAAO;AACT;AAIA,SAAgB,SAAS,OAA6C;CACpE,MAAM,EACJ,SACA,UACA,OAAO,WACP,WACA,QACA,KACA,OACA,OACA,GAAG,SACD;CAKJ,MAAM,aAA8C,CAAC;CACrD,MAAM,YAAY,yBAAyB,MAAM;CACjD,MAAM,aAAa,yBAAyB,KAAK;CACjD,IAAI,cAAc,KAAA,GAAW,WAAW,YAAY;CACpD,IAAI,eAAe,KAAA,GAAW,WAAW,aAAa;CACtD,MAAM,cAAc,yBAAyB,kBAAkB,YAAY,KAAK,CAAC;CACjF,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,WAAW,WAAW,WAAW;EAChD,aAAa;EACb,iBAAiB;EACjB,eAAe;CACjB,CAAC;CAED,IAAI,SACF,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAAW,CAAA;CAG5D,OAAO,iBAAiB,OAAO,YAAY,QAAQ;AACrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { ProgressCircle, ProgressCircleIndicator } from \"@askrjs/ui\";\nimport type { SpinnerProps } from \"./spinner.types\";\n\nexport function Spinner(props: SpinnerProps): JSX.Element {\n const {\n label,\n size,\n \"aria-label\": ariaLabel,\n ...rest\n } = props as SpinnerProps & {\n \"aria-label\"?: string;\n };\n\n return (\n <ProgressCircle\n {...rest}\n aria-label={ariaLabel ?? label ?? \"Loading\"}\n data-spinner=\"true\"\n data-size={size && size !== \"md\" ? size : undefined}\n value={null}\n getValueLabel={() => label ?? \"Loading\"}\n >\n <ProgressCircleIndicator />\n </ProgressCircle>\n );\n}\n"],"mappings":";;;AAIA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EACJ,OACA,MACA,cAAc,WACd,GAAG,SACD;CAIJ,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,cAAY,aAAa,SAAS;EAClC,gBAAa;EACb,aAAW,QAAQ,SAAS,OAAO,OAAO,KAAA;EAC1C,OAAO;EACP,qBAAqB,SAAS;YAE9B,oBAAC,yBAAD,CAA0B,CAAA;CACZ,CAAA;AAEpB"}
1
+ {"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { ProgressCircle, ProgressCircleIndicator } from \"@askrjs/ui\";\nimport type { SpinnerProps } from \"./spinner.types\";\n\nexport function Spinner(props: SpinnerProps): JSX.Element {\n const {\n label,\n size,\n \"aria-label\": ariaLabel,\n ...rest\n } = props as SpinnerProps & {\n \"aria-label\"?: string;\n };\n\n return (\n <ProgressCircle\n {...rest}\n aria-label={ariaLabel ?? label ?? \"Loading\"}\n data-spinner=\"true\"\n data-size={size && size !== \"md\" ? size : undefined}\n value={null}\n getValueLabel={() => label ?? \"Loading\"}\n >\n <ProgressCircleIndicator />\n </ProgressCircle>\n );\n}\n"],"mappings":";;;AAIA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EACJ,OACA,MACA,cAAc,WACd,GAAG,SACD;CAIJ,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,cAAY,aAAa,SAAS;EAClC,gBAAa;EACb,aAAW,QAAQ,SAAS,OAAO,OAAO,KAAA;EAC1C,OAAO;EACP,qBAAqB,SAAS;EAE9B,UAAA,oBAAC,yBAAD,CAA0B,CAAA;CACZ,CAAA;AAEpB"}
@@ -4,45 +4,49 @@ import { jsx } from "@askrjs/askr/jsx-runtime";
4
4
  //#region src/components/stat/stat.tsx
5
5
  function Stat(props) {
6
6
  const { children, class: className, ref, ...rest } = props;
7
+ const finalProps = mergeProps(rest, {
8
+ ref,
9
+ class: classes("stat", className),
10
+ "data-slot": "stat"
11
+ });
7
12
  return /* @__PURE__ */ jsx("div", {
8
- ...mergeProps(rest, {
9
- ref,
10
- class: classes("stat", className),
11
- "data-slot": "stat"
12
- }),
13
+ ...finalProps,
13
14
  children
14
15
  });
15
16
  }
16
17
  function StatLabel(props) {
17
18
  const { children, class: className, ref, ...rest } = props;
19
+ const finalProps = mergeProps(rest, {
20
+ ref,
21
+ class: classes("stat-label", className),
22
+ "data-slot": "stat-label"
23
+ });
18
24
  return /* @__PURE__ */ jsx("p", {
19
- ...mergeProps(rest, {
20
- ref,
21
- class: classes("stat-label", className),
22
- "data-slot": "stat-label"
23
- }),
25
+ ...finalProps,
24
26
  children
25
27
  });
26
28
  }
27
29
  function StatValue(props) {
28
30
  const { children, class: className, ref, ...rest } = props;
31
+ const finalProps = mergeProps(rest, {
32
+ ref,
33
+ class: classes("stat-value", className),
34
+ "data-slot": "stat-value"
35
+ });
29
36
  return /* @__PURE__ */ jsx("p", {
30
- ...mergeProps(rest, {
31
- ref,
32
- class: classes("stat-value", className),
33
- "data-slot": "stat-value"
34
- }),
37
+ ...finalProps,
35
38
  children
36
39
  });
37
40
  }
38
41
  function StatDescription(props) {
39
42
  const { children, class: className, ref, ...rest } = props;
43
+ const finalProps = mergeProps(rest, {
44
+ ref,
45
+ class: classes("stat-description", className),
46
+ "data-slot": "stat-description"
47
+ });
40
48
  return /* @__PURE__ */ jsx("p", {
41
- ...mergeProps(rest, {
42
- ref,
43
- class: classes("stat-description", className),
44
- "data-slot": "stat-description"
45
- }),
49
+ ...finalProps,
46
50
  children
47
51
  });
48
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stat.js","names":[],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type { StatDescriptionProps, StatLabelProps, StatProps, StatValueProps } from \"./stat.types\";\n\nexport function Stat(props: StatProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat\", className),\n \"data-slot\": \"stat\",\n });\n\n return <div {...finalProps}>{children}</div>;\n}\n\nexport function StatLabel(props: StatLabelProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat-label\", className),\n \"data-slot\": \"stat-label\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n\nexport function StatValue(props: StatValueProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat-value\", className),\n \"data-slot\": \"stat-value\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n\nexport function StatDescription(props: StatDescriptionProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat-description\", className),\n \"data-slot\": \"stat-description\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n"],"mappings":";;;;AAKA,SAAgB,KAAK,OAA+B;CAClD,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,OAAD;EAAK,GANO,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,QAAQ,SAAS;GAChC,aAAa;EACf,CAEyB;EAAI;CAAc,CAAA;AAC7C;AAEA,SAAgB,UAAU,OAAoC;CAC5D,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,KAAD;EAAG,GANS,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,cAAc,SAAS;GACtC,aAAa;EACf,CAEuB;EAAI;CAAY,CAAA;AACzC;AAEA,SAAgB,UAAU,OAAoC;CAC5D,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,KAAD;EAAG,GANS,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,cAAc,SAAS;GACtC,aAAa;EACf,CAEuB;EAAI;CAAY,CAAA;AACzC;AAEA,SAAgB,gBAAgB,OAA0C;CACxE,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CAOrD,OAAO,oBAAC,KAAD;EAAG,GANS,WAAW,MAAM;GAClC;GACA,OAAO,QAAQ,oBAAoB,SAAS;GAC5C,aAAa;EACf,CAEuB;EAAI;CAAY,CAAA;AACzC"}
1
+ {"version":3,"file":"stat.js","names":[],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type { StatDescriptionProps, StatLabelProps, StatProps, StatValueProps } from \"./stat.types\";\n\nexport function Stat(props: StatProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat\", className),\n \"data-slot\": \"stat\",\n });\n\n return <div {...finalProps}>{children}</div>;\n}\n\nexport function StatLabel(props: StatLabelProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat-label\", className),\n \"data-slot\": \"stat-label\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n\nexport function StatValue(props: StatValueProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat-value\", className),\n \"data-slot\": \"stat-value\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n\nexport function StatDescription(props: StatDescriptionProps): JSX.Element {\n const { children, class: className, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"stat-description\", className),\n \"data-slot\": \"stat-description\",\n });\n\n return <p {...finalProps}>{children}</p>;\n}\n"],"mappings":";;;;AAKA,SAAgB,KAAK,OAA+B;CAClD,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CACrD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,QAAQ,SAAS;EAChC,aAAa;CACf,CAAC;CAED,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAa;CAAc,CAAA;AAC7C;AAEA,SAAgB,UAAU,OAAoC;CAC5D,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CACrD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,cAAc,SAAS;EACtC,aAAa;CACf,CAAC;CAED,OAAO,oBAAC,KAAD;EAAG,GAAI;EAAa;CAAY,CAAA;AACzC;AAEA,SAAgB,UAAU,OAAoC;CAC5D,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CACrD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,cAAc,SAAS;EACtC,aAAa;CACf,CAAC;CAED,OAAO,oBAAC,KAAD;EAAG,GAAI;EAAa;CAAY,CAAA;AACzC;AAEA,SAAgB,gBAAgB,OAA0C;CACxE,MAAM,EAAE,UAAU,OAAO,WAAW,KAAK,GAAG,SAAS;CACrD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,oBAAoB,SAAS;EAC5C,aAAa;CACf,CAAC;CAED,OAAO,oBAAC,KAAD;EAAG,GAAI;EAAa;CAAY,CAAA;AACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":[],"sources":["../../../src/components/theme/theme.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { defineScope, getSignal, readScope, state } from \"@askrjs/askr\";\nimport { cloneElement, isElement, type JSXElement } from \"@askrjs/askr/foundations/structures\";\nimport { Button } from \"@askrjs/ui\";\nimport type { ButtonNativeProps, PressEvent } from \"@askrjs/ui\";\n\nexport const CAT_THEME_NAMES = [\"tabby\", \"ginger\", \"tuxedo\", \"calico\", \"torty\"] as const;\n\nexport type CatThemeName = (typeof CAT_THEME_NAMES)[number];\nexport type ThemeName = \"light\" | \"dark\" | \"system\" | CatThemeName | (string & {});\n\nexport type ThemeOption = {\n value: ThemeName;\n label: string;\n};\n\nexport type ThemeScopeValue = {\n theme: () => ThemeName;\n resolvedSystemTheme: () => \"light\" | \"dark\";\n setTheme: (theme: ThemeName) => void;\n themes: readonly ThemeOption[];\n storageKey: string;\n};\n\nexport type ThemeScopeProps = {\n children?: unknown;\n defaultTheme?: ThemeName;\n themes?: readonly ThemeOption[];\n storageKey?: string;\n};\n\nexport type ThemePickerProps = Omit<\n JSX.IntrinsicElements[\"select\"],\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n themes?: readonly ThemeOption[];\n label?: string;\n};\n\nexport type ThemeToggleRenderContext = {\n theme: ThemeName;\n nextTheme: ThemeName;\n};\n\nexport type ThemeToggleProps = Omit<ButtonNativeProps, \"children\" | \"onPress\"> & {\n children?: unknown | ((context: ThemeToggleRenderContext) => unknown);\n lightIcon?: unknown;\n darkIcon?: unknown;\n systemIcon?: unknown;\n themes?: readonly ThemeName[];\n onPress?: (event: PressEvent) => void;\n};\n\nexport const DEFAULT_THEME_OPTIONS: readonly ThemeOption[] = [\n { value: \"system\", label: \"System\" },\n { value: \"light\", label: \"Light\" },\n { value: \"dark\", label: \"Dark\" },\n];\n\nexport const CAT_THEME_OPTIONS: readonly ThemeOption[] = [\n { value: \"tabby\", label: \"Tabby\" },\n { value: \"ginger\", label: \"Ginger\" },\n { value: \"tuxedo\", label: \"Tuxedo\" },\n { value: \"calico\", label: \"Calico\" },\n { value: \"torty\", label: \"Torty\" },\n];\n\nconst DEFAULT_STORAGE_KEY = \"askr-theme\";\nconst STATIC_CHILDREN = Symbol.for(\"askr.static-children\");\nconst documentThemeCoordinators = new WeakMap<Document, ThemeCoordinator>();\ntype ThemeCoordinator = ReturnType<typeof createThemeCoordinator>;\ntype InternalThemeScopeValue = ThemeScopeValue & {\n readonly coordinator: ThemeCoordinator | null;\n readonly depth: number;\n};\n\nconst ThemeScopeContext = defineScope<InternalThemeScopeValue>({\n theme: () => \"system\",\n resolvedSystemTheme: () => \"light\",\n setTheme: () => undefined,\n themes: DEFAULT_THEME_OPTIONS,\n storageKey: DEFAULT_STORAGE_KEY,\n coordinator: null,\n depth: -1,\n});\n\nexport function theme(): ThemeScopeValue {\n return readScope(ThemeScopeContext);\n}\n\nexport function ThemeScope(props: ThemeScopeProps): JSX.Element {\n const {\n children,\n defaultTheme = \"system\",\n themes = DEFAULT_THEME_OPTIONS,\n storageKey = DEFAULT_STORAGE_KEY,\n } = props;\n\n const scopeId = state<symbol>(Symbol(\"ThemeScope\"))();\n const scopeSignal = getSignal();\n // The first render must be identical on the server and in the browser.\n // Browser persistence is adopted from the committed root ref, after Askr's\n // hydration verifier has accepted the server markup.\n const themeState = state<ThemeName>(defaultTheme);\n const localResolvedSystemTheme = state<\"light\" | \"dark\">(\"light\");\n const persistenceAdoption = state({ complete: false })();\n const currentTheme = themeState();\n const parentScope = readScope(ThemeScopeContext);\n const ownedCoordinator = state<ThemeCoordinator>(getDefaultThemeCoordinator())();\n const coordinator = parentScope.coordinator ?? ownedCoordinator;\n const scopeDepth = parentScope.depth + 1;\n coordinator.register(scopeId, scopeDepth, currentTheme, scopeSignal, (nextTheme) => {\n if (themeState() !== nextTheme) themeState.set(nextTheme);\n });\n\n const setTheme = (nextTheme: ThemeName) => {\n themeState.set(nextTheme);\n writeStoredTheme(storageKey, nextTheme);\n coordinator.activate(scopeId, nextTheme);\n };\n\n const resolvedSystemTheme = parentScope.coordinator\n ? parentScope.resolvedSystemTheme\n : localResolvedSystemTheme;\n const value: InternalThemeScopeValue = {\n theme: themeState,\n resolvedSystemTheme,\n setTheme,\n themes,\n storageKey,\n coordinator,\n depth: scopeDepth,\n };\n\n return (\n <ThemeScopeContext value={value}>\n <div\n data-slot=\"theme-scope\"\n ref={\n parentScope.coordinator === null\n ? (element: HTMLElement | null) => {\n coordinator.attach(\n element,\n (nextTheme) => localResolvedSystemTheme.set(nextTheme),\n scopeSignal,\n );\n if (element && typeof window !== \"undefined\") {\n const onStorage = (event: StorageEvent) => {\n let storageMatches = event.storageArea == null;\n try {\n storageMatches ||= event.storageArea === window.localStorage;\n } catch {\n // Locked-down/private contexts may deny access to localStorage.\n }\n if (!storageMatches || event.key !== storageKey) {\n return;\n }\n const nextTheme = event.newValue as ThemeName | null;\n if (!nextTheme) return;\n themeState.set(nextTheme);\n coordinator.activate(scopeId, nextTheme);\n };\n window.addEventListener(\"storage\", onStorage);\n scopeSignal.addEventListener(\n \"abort\",\n () => window.removeEventListener(\"storage\", onStorage),\n { once: true },\n );\n }\n if (!element || persistenceAdoption.complete) return;\n persistenceAdoption.complete = true;\n const storedTheme = readStoredTheme(storageKey);\n if (storedTheme && storedTheme !== themeState()) {\n themeState.set(storedTheme);\n coordinator.activate(scopeId, storedTheme);\n }\n }\n : undefined\n }\n >\n {children}\n </div>\n </ThemeScopeContext>\n );\n}\n\nfunction getDefaultThemeCoordinator(): ThemeCoordinator {\n if (typeof document === \"undefined\") {\n return createThemeCoordinator();\n }\n\n const existing = documentThemeCoordinators.get(document);\n if (existing) return existing;\n\n const coordinator = createThemeCoordinator();\n documentThemeCoordinators.set(document, coordinator);\n return coordinator;\n}\n\nfunction removeEmptyGeneratedStyleRegistries(root: Node | null): void {\n const ownerDocument =\n root?.nodeType === 9\n ? (root as Document)\n : (root?.ownerDocument ?? (typeof document === \"undefined\" ? null : document));\n if (!ownerDocument) return;\n\n for (const registry of ownerDocument.querySelectorAll<HTMLStyleElement>(\n \"style[data-askr-style-registry]\",\n )) {\n if (!registry.textContent?.trim()) registry.remove();\n }\n}\n\nfunction createThemeCoordinator() {\n const scopes = new Map<\n symbol,\n {\n depth: number;\n sequence: number;\n theme: ThemeName;\n signal: AbortSignal;\n onThemeChange: (themeName: ThemeName) => void;\n }\n >();\n let nextSequence = 0;\n let explicitOwner: symbol | undefined;\n let root: Node | null = null;\n let scheduled = false;\n\n const target = (): HTMLElement | null => {\n if (root?.nodeType === 9) return (root as Document).documentElement;\n if (root && \"host\" in root) return (root as ShadowRoot).host as HTMLElement;\n return typeof document === \"undefined\" ? null : document.documentElement;\n };\n const syncActive = (): void => {\n if (explicitOwner !== undefined) return;\n let candidate: { depth: number; sequence: number; theme: ThemeName } | undefined;\n for (const scope of scopes.values()) {\n if (\n !candidate ||\n scope.depth > candidate.depth ||\n (scope.depth === candidate.depth && scope.sequence > candidate.sequence)\n ) {\n candidate = scope;\n }\n }\n if (candidate) syncThemeTarget(target(), candidate.theme);\n };\n const schedule = (): void => {\n if (typeof document === \"undefined\" || scheduled) return;\n scheduled = true;\n setTimeout(() => {\n scheduled = false;\n syncActive();\n if (scopes.size === 0) removeEmptyGeneratedStyleRegistries(root);\n }, 0);\n };\n\n return Object.freeze({\n attach(\n element: HTMLElement | null,\n onResolvedSystemTheme: (themeName: \"light\" | \"dark\") => void,\n signal: AbortSignal,\n ) {\n if (element) root = element.getRootNode();\n if (element && typeof window !== \"undefined\" && typeof window.matchMedia === \"function\") {\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const update = () => onResolvedSystemTheme(media.matches ? \"dark\" : \"light\");\n update();\n media.addEventListener?.(\"change\", update);\n signal.addEventListener(\"abort\", () => media.removeEventListener?.(\"change\", update), {\n once: true,\n });\n }\n schedule();\n },\n register(\n id: symbol,\n depth: number,\n themeName: ThemeName,\n signal: AbortSignal,\n onThemeChange: (themeName: ThemeName) => void,\n ) {\n const existing = scopes.get(id);\n scopes.set(id, {\n depth,\n sequence: existing?.sequence ?? nextSequence++,\n theme: themeName,\n signal,\n onThemeChange,\n });\n if (!existing) {\n signal.addEventListener(\n \"abort\",\n () => {\n scopes.delete(id);\n if (explicitOwner === id) explicitOwner = undefined;\n schedule();\n },\n { once: true },\n );\n }\n schedule();\n },\n activate(id: symbol, themeName: ThemeName) {\n const scope = scopes.get(id);\n if (scope) scope.theme = themeName;\n explicitOwner = id;\n const ownerDepth = scope?.depth;\n for (const [scopeId, registered] of scopes) {\n if (scopeId !== id && registered.depth === ownerDepth) {\n registered.theme = themeName;\n registered.onThemeChange(themeName);\n }\n }\n syncThemeTarget(target(), themeName);\n },\n });\n}\n\nexport function ThemePicker(props: ThemePickerProps): JSX.Element {\n const activeTheme = theme();\n const { themes = activeTheme.themes, label = \"Theme\", ...rest } = props;\n const currentTheme = activeTheme.theme();\n\n return (\n <select\n {...rest}\n aria-label={rest[\"aria-label\"] ?? label}\n data-slot=\"theme-picker\"\n value={currentTheme}\n onChange={(event: Event) => {\n const target = getThemePickerTarget(event);\n if (target) {\n activeTheme.setTheme(target.value as ThemeName);\n }\n }}\n >\n {themes.map((option) => (\n <option key={option.value} value={option.value} selected={option.value === currentTheme}>\n {option.label}\n </option>\n ))}\n </select>\n );\n}\n\nfunction getThemePickerTarget(event: Event): HTMLSelectElement | null {\n if (typeof HTMLSelectElement === \"undefined\") {\n return null;\n }\n\n const path = typeof event.composedPath === \"function\" ? event.composedPath() : [];\n const candidates = [event.target, event.currentTarget, ...path];\n\n for (const candidate of candidates) {\n if (candidate instanceof HTMLSelectElement) {\n return candidate;\n }\n }\n\n return null;\n}\n\nexport function ThemeToggle(props: ThemeToggleProps): JSX.Element {\n const activeTheme = theme();\n const {\n children,\n lightIcon,\n darkIcon,\n systemIcon,\n themes = [\"light\", \"dark\"],\n onPress,\n ...rest\n } = props;\n\n const currentTheme = activeTheme.theme();\n const nextTheme = getNextTheme(currentTheme, themes, activeTheme.resolvedSystemTheme());\n const renderContext = { theme: currentTheme, nextTheme };\n const ariaLabel = (rest as Record<string, unknown>)[\"aria-label\"];\n const themedIcon = resolveThemeToggleIcon(currentTheme, nextTheme, {\n lightIcon,\n darkIcon,\n systemIcon,\n });\n const renderedIcon = cloneThemeToggleIcon(themedIcon, currentTheme);\n const renderedIconSlots =\n renderThemeToggleIconSlots(currentTheme, {\n lightIcon,\n darkIcon,\n systemIcon,\n }) ?? renderedIcon;\n const content =\n typeof children === \"function\" ? children(renderContext) : (children ?? renderedIconSlots);\n\n return (\n <Button\n {...(rest as ButtonNativeProps)}\n aria-label={typeof ariaLabel === \"string\" ? ariaLabel : `Switch to ${nextTheme} theme`}\n data-theme-control=\"toggle\"\n data-theme-choice={currentTheme}\n data-next-theme={nextTheme}\n onPress={(event) => {\n onPress?.(event);\n if (!event.defaultPrevented && !Object.is(nextTheme, currentTheme)) {\n activeTheme.setTheme(nextTheme);\n }\n }}\n >\n <span data-slot=\"theme-toggle-content\">{content}</span>\n </Button>\n );\n}\n\nfunction getNextTheme(\n currentTheme: ThemeName,\n themes: readonly ThemeName[],\n resolvedSystemTheme: \"light\" | \"dark\" = \"light\",\n): ThemeName {\n if (themes.length === 0) return currentTheme;\n const index = themes.indexOf(currentTheme);\n if (index < 0 && currentTheme === \"system\") {\n if (themes.includes(\"light\") && themes.includes(\"dark\")) {\n return resolvedSystemTheme === \"dark\" ? \"light\" : \"dark\";\n }\n }\n return themes[index >= 0 && index < themes.length - 1 ? index + 1 : 0]!;\n}\n\nfunction getThemeIcon(\n theme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n if (theme === \"light\") return icons.lightIcon;\n if (theme === \"dark\") return icons.darkIcon;\n if (theme === \"system\") return icons.systemIcon;\n return undefined;\n}\n\nexport function resolveThemeToggleIcon(\n theme: ThemeName,\n nextTheme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n return getThemeIcon(theme, icons) ?? getThemeIcon(nextTheme, icons);\n}\n\nfunction renderThemeToggleIconSlots(\n theme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n if (getThemeIcon(theme, icons) === undefined) {\n return undefined;\n }\n\n const slots = [\n [\"light\", icons.lightIcon],\n [\"dark\", icons.darkIcon],\n [\"system\", icons.systemIcon],\n ] as const;\n const availableSlots = slots.filter(([, icon]) => icon !== undefined && icon !== null);\n\n if (availableSlots.length <= 1) {\n return undefined;\n }\n\n return availableSlots.map(([slotTheme, icon]) => (\n <span\n key={slotTheme}\n data-slot=\"theme-toggle-icon\"\n data-theme-toggle-icon={slotTheme}\n hidden={slotTheme === theme ? undefined : true}\n >\n {cloneThemeToggleIcon(icon, slotTheme)}\n </span>\n ));\n}\n\nfunction cloneThemeToggleIcon(icon: unknown, key?: string): unknown {\n if (Array.isArray(icon)) {\n const clonedChildren = icon.map((child) => cloneThemeToggleIcon(child));\n if ((icon as unknown as Record<symbol, unknown>)[STATIC_CHILDREN] === true) {\n Object.defineProperty(clonedChildren, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n return clonedChildren;\n }\n\n if (!isElement(icon)) return icon;\n\n const props = icon.props as Record<string, unknown> | undefined;\n const clonedProps = props ? { ...props } : {};\n\n if (\"children\" in clonedProps) {\n clonedProps.children = cloneThemeToggleIcon(clonedProps.children);\n }\n\n const clonedIcon = cloneElement(icon, clonedProps);\n return {\n ...clonedIcon,\n key: icon.key ?? key ?? null,\n } satisfies JSXElement;\n}\n\nfunction syncThemeTarget(\n html: HTMLElement | null,\n themeChoice: ThemeName | null | undefined,\n): void {\n if (!html) return;\n\n if (themeChoice == null) {\n html.removeAttribute(\"data-theme\");\n html.removeAttribute(\"data-theme-choice\");\n return;\n }\n\n html.setAttribute(\"data-theme-choice\", themeChoice);\n\n if (themeChoice === \"system\") {\n html.removeAttribute(\"data-theme\");\n } else {\n html.setAttribute(\"data-theme\", themeChoice);\n }\n}\n\nfunction readStoredTheme(storageKey: string): ThemeName | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n const storedTheme = window.localStorage.getItem(storageKey);\n return storedTheme ? (storedTheme as ThemeName) : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction writeStoredTheme(storageKey: string, theme: ThemeName): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(storageKey, theme);\n } catch {\n // Storage can be unavailable in private or locked-down browser contexts.\n }\n}\n"],"mappings":";;;;;AAMA,MAAa,kBAAkB;CAAC;CAAS;CAAU;CAAU;CAAU;AA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C,IAAI,cAAc,aAChB,YAAY,WAAW,qBAAqB,YAAY,QAAQ;CAIlE,OAAO;EACL,GAFiB,aAAa,MAAM,WAExB;EACZ,KAAK,KAAK,OAAO,OAAO;CAC1B;AACF;AAEA,SAAS,gBACP,MACA,aACM;CACN,IAAI,CAAC,MAAM;CAEX,IAAI,eAAe,MAAM;EACvB,KAAK,gBAAgB,YAAY;EACjC,KAAK,gBAAgB,mBAAmB;EACxC;CACF;CAEA,KAAK,aAAa,qBAAqB,WAAW;CAElD,IAAI,gBAAgB,UAClB,KAAK,gBAAgB,YAAY;MAEjC,KAAK,aAAa,cAAc,WAAW;AAE/C;AAEA,SAAS,gBAAgB,YAA2C;CAClE,IAAI,OAAO,WAAW,aAAa,OAAO,KAAA;CAC1C,IAAI;EACF,MAAM,cAAc,OAAO,aAAa,QAAQ,UAAU;EAC1D,OAAO,cAAe,cAA4B,KAAA;CACpD,QAAQ;EACN;CACF;AACF;AAEA,SAAS,iBAAiB,YAAoB,OAAwB;CACpE,IAAI,OAAO,WAAW,aAAa;CACnC,IAAI;EACF,OAAO,aAAa,QAAQ,YAAY,KAAK;CAC/C,QAAQ,CAER;AACF"}
1
+ {"version":3,"file":"theme.js","names":[],"sources":["../../../src/components/theme/theme.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { defineScope, getSignal, readScope, state } from \"@askrjs/askr\";\nimport { cloneElement, isElement, type JSXElement } from \"@askrjs/askr/foundations/structures\";\nimport { Button } from \"@askrjs/ui\";\nimport type { ButtonNativeProps, PressEvent } from \"@askrjs/ui\";\n\nexport const CAT_THEME_NAMES = [\"tabby\", \"ginger\", \"tuxedo\", \"calico\", \"torty\"] as const;\n\nexport type CatThemeName = (typeof CAT_THEME_NAMES)[number];\nexport type ThemeName = \"light\" | \"dark\" | \"system\" | CatThemeName | (string & {});\n\nexport type ThemeOption = {\n value: ThemeName;\n label: string;\n};\n\nexport type ThemeScopeValue = {\n theme: () => ThemeName;\n resolvedSystemTheme: () => \"light\" | \"dark\";\n setTheme: (theme: ThemeName) => void;\n themes: readonly ThemeOption[];\n storageKey: string;\n};\n\nexport type ThemeScopeProps = {\n children?: unknown;\n defaultTheme?: ThemeName;\n themes?: readonly ThemeOption[];\n storageKey?: string;\n};\n\nexport type ThemePickerProps = Omit<\n JSX.IntrinsicElements[\"select\"],\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n themes?: readonly ThemeOption[];\n label?: string;\n};\n\nexport type ThemeToggleRenderContext = {\n theme: ThemeName;\n nextTheme: ThemeName;\n};\n\nexport type ThemeToggleProps = Omit<ButtonNativeProps, \"children\" | \"onPress\"> & {\n children?: unknown | ((context: ThemeToggleRenderContext) => unknown);\n lightIcon?: unknown;\n darkIcon?: unknown;\n systemIcon?: unknown;\n themes?: readonly ThemeName[];\n onPress?: (event: PressEvent) => void;\n};\n\nexport const DEFAULT_THEME_OPTIONS: readonly ThemeOption[] = [\n { value: \"system\", label: \"System\" },\n { value: \"light\", label: \"Light\" },\n { value: \"dark\", label: \"Dark\" },\n];\n\nexport const CAT_THEME_OPTIONS: readonly ThemeOption[] = [\n { value: \"tabby\", label: \"Tabby\" },\n { value: \"ginger\", label: \"Ginger\" },\n { value: \"tuxedo\", label: \"Tuxedo\" },\n { value: \"calico\", label: \"Calico\" },\n { value: \"torty\", label: \"Torty\" },\n];\n\nconst DEFAULT_STORAGE_KEY = \"askr-theme\";\nconst STATIC_CHILDREN = Symbol.for(\"askr.static-children\");\nconst documentThemeCoordinators = new WeakMap<Document, ThemeCoordinator>();\ntype ThemeCoordinator = ReturnType<typeof createThemeCoordinator>;\ntype InternalThemeScopeValue = ThemeScopeValue & {\n readonly coordinator: ThemeCoordinator | null;\n readonly depth: number;\n};\n\nconst ThemeScopeContext = defineScope<InternalThemeScopeValue>({\n theme: () => \"system\",\n resolvedSystemTheme: () => \"light\",\n setTheme: () => undefined,\n themes: DEFAULT_THEME_OPTIONS,\n storageKey: DEFAULT_STORAGE_KEY,\n coordinator: null,\n depth: -1,\n});\n\nexport function theme(): ThemeScopeValue {\n return readScope(ThemeScopeContext);\n}\n\nexport function ThemeScope(props: ThemeScopeProps): JSX.Element {\n const {\n children,\n defaultTheme = \"system\",\n themes = DEFAULT_THEME_OPTIONS,\n storageKey = DEFAULT_STORAGE_KEY,\n } = props;\n\n const scopeId = state<symbol>(Symbol(\"ThemeScope\"))();\n const scopeSignal = getSignal();\n // The first render must be identical on the server and in the browser.\n // Browser persistence is adopted from the committed root ref, after Askr's\n // hydration verifier has accepted the server markup.\n const themeState = state<ThemeName>(defaultTheme);\n const localResolvedSystemTheme = state<\"light\" | \"dark\">(\"light\");\n const persistenceAdoption = state({ complete: false })();\n const currentTheme = themeState();\n const parentScope = readScope(ThemeScopeContext);\n const ownedCoordinator = state<ThemeCoordinator>(getDefaultThemeCoordinator())();\n const coordinator = parentScope.coordinator ?? ownedCoordinator;\n const scopeDepth = parentScope.depth + 1;\n coordinator.register(scopeId, scopeDepth, currentTheme, scopeSignal, (nextTheme) => {\n if (themeState() !== nextTheme) themeState.set(nextTheme);\n });\n\n const setTheme = (nextTheme: ThemeName) => {\n themeState.set(nextTheme);\n writeStoredTheme(storageKey, nextTheme);\n coordinator.activate(scopeId, nextTheme);\n };\n\n const resolvedSystemTheme = parentScope.coordinator\n ? parentScope.resolvedSystemTheme\n : localResolvedSystemTheme;\n const value: InternalThemeScopeValue = {\n theme: themeState,\n resolvedSystemTheme,\n setTheme,\n themes,\n storageKey,\n coordinator,\n depth: scopeDepth,\n };\n\n return (\n <ThemeScopeContext value={value}>\n <div\n data-slot=\"theme-scope\"\n ref={\n parentScope.coordinator === null\n ? (element: HTMLElement | null) => {\n coordinator.attach(\n element,\n (nextTheme) => localResolvedSystemTheme.set(nextTheme),\n scopeSignal,\n );\n if (element && typeof window !== \"undefined\") {\n const onStorage = (event: StorageEvent) => {\n let storageMatches = event.storageArea == null;\n try {\n storageMatches ||= event.storageArea === window.localStorage;\n } catch {\n // Locked-down/private contexts may deny access to localStorage.\n }\n if (!storageMatches || event.key !== storageKey) {\n return;\n }\n const nextTheme = event.newValue as ThemeName | null;\n if (!nextTheme) return;\n themeState.set(nextTheme);\n coordinator.activate(scopeId, nextTheme);\n };\n window.addEventListener(\"storage\", onStorage);\n scopeSignal.addEventListener(\n \"abort\",\n () => window.removeEventListener(\"storage\", onStorage),\n { once: true },\n );\n }\n if (!element || persistenceAdoption.complete) return;\n persistenceAdoption.complete = true;\n const storedTheme = readStoredTheme(storageKey);\n if (storedTheme && storedTheme !== themeState()) {\n themeState.set(storedTheme);\n coordinator.activate(scopeId, storedTheme);\n }\n }\n : undefined\n }\n >\n {children}\n </div>\n </ThemeScopeContext>\n );\n}\n\nfunction getDefaultThemeCoordinator(): ThemeCoordinator {\n if (typeof document === \"undefined\") {\n return createThemeCoordinator();\n }\n\n const existing = documentThemeCoordinators.get(document);\n if (existing) return existing;\n\n const coordinator = createThemeCoordinator();\n documentThemeCoordinators.set(document, coordinator);\n return coordinator;\n}\n\nfunction removeEmptyGeneratedStyleRegistries(root: Node | null): void {\n const ownerDocument =\n root?.nodeType === 9\n ? (root as Document)\n : (root?.ownerDocument ?? (typeof document === \"undefined\" ? null : document));\n if (!ownerDocument) return;\n\n for (const registry of ownerDocument.querySelectorAll<HTMLStyleElement>(\n \"style[data-askr-style-registry]\",\n )) {\n if (!registry.textContent?.trim()) registry.remove();\n }\n}\n\nfunction createThemeCoordinator() {\n const scopes = new Map<\n symbol,\n {\n depth: number;\n sequence: number;\n theme: ThemeName;\n signal: AbortSignal;\n onThemeChange: (themeName: ThemeName) => void;\n }\n >();\n let nextSequence = 0;\n let explicitOwner: symbol | undefined;\n let root: Node | null = null;\n let scheduled = false;\n\n const target = (): HTMLElement | null => {\n if (root?.nodeType === 9) return (root as Document).documentElement;\n if (root && \"host\" in root) return (root as ShadowRoot).host as HTMLElement;\n return typeof document === \"undefined\" ? null : document.documentElement;\n };\n const syncActive = (): void => {\n if (explicitOwner !== undefined) return;\n let candidate: { depth: number; sequence: number; theme: ThemeName } | undefined;\n for (const scope of scopes.values()) {\n if (\n !candidate ||\n scope.depth > candidate.depth ||\n (scope.depth === candidate.depth && scope.sequence > candidate.sequence)\n ) {\n candidate = scope;\n }\n }\n if (candidate) syncThemeTarget(target(), candidate.theme);\n };\n const schedule = (): void => {\n if (typeof document === \"undefined\" || scheduled) return;\n scheduled = true;\n setTimeout(() => {\n scheduled = false;\n syncActive();\n if (scopes.size === 0) removeEmptyGeneratedStyleRegistries(root);\n }, 0);\n };\n\n return Object.freeze({\n attach(\n element: HTMLElement | null,\n onResolvedSystemTheme: (themeName: \"light\" | \"dark\") => void,\n signal: AbortSignal,\n ) {\n if (element) root = element.getRootNode();\n if (element && typeof window !== \"undefined\" && typeof window.matchMedia === \"function\") {\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const update = () => onResolvedSystemTheme(media.matches ? \"dark\" : \"light\");\n update();\n media.addEventListener?.(\"change\", update);\n signal.addEventListener(\"abort\", () => media.removeEventListener?.(\"change\", update), {\n once: true,\n });\n }\n schedule();\n },\n register(\n id: symbol,\n depth: number,\n themeName: ThemeName,\n signal: AbortSignal,\n onThemeChange: (themeName: ThemeName) => void,\n ) {\n const existing = scopes.get(id);\n scopes.set(id, {\n depth,\n sequence: existing?.sequence ?? nextSequence++,\n theme: themeName,\n signal,\n onThemeChange,\n });\n if (!existing) {\n signal.addEventListener(\n \"abort\",\n () => {\n scopes.delete(id);\n if (explicitOwner === id) explicitOwner = undefined;\n schedule();\n },\n { once: true },\n );\n }\n schedule();\n },\n activate(id: symbol, themeName: ThemeName) {\n const scope = scopes.get(id);\n if (scope) scope.theme = themeName;\n explicitOwner = id;\n const ownerDepth = scope?.depth;\n for (const [scopeId, registered] of scopes) {\n if (scopeId !== id && registered.depth === ownerDepth) {\n registered.theme = themeName;\n registered.onThemeChange(themeName);\n }\n }\n syncThemeTarget(target(), themeName);\n },\n });\n}\n\nexport function ThemePicker(props: ThemePickerProps): JSX.Element {\n const activeTheme = theme();\n const { themes = activeTheme.themes, label = \"Theme\", ...rest } = props;\n const currentTheme = activeTheme.theme();\n\n return (\n <select\n {...rest}\n aria-label={rest[\"aria-label\"] ?? label}\n data-slot=\"theme-picker\"\n value={currentTheme}\n onChange={(event: Event) => {\n const target = getThemePickerTarget(event);\n if (target) {\n activeTheme.setTheme(target.value as ThemeName);\n }\n }}\n >\n {themes.map((option) => (\n <option key={option.value} value={option.value} selected={option.value === currentTheme}>\n {option.label}\n </option>\n ))}\n </select>\n );\n}\n\nfunction getThemePickerTarget(event: Event): HTMLSelectElement | null {\n if (typeof HTMLSelectElement === \"undefined\") {\n return null;\n }\n\n const path = typeof event.composedPath === \"function\" ? event.composedPath() : [];\n const candidates = [event.target, event.currentTarget, ...path];\n\n for (const candidate of candidates) {\n if (candidate instanceof HTMLSelectElement) {\n return candidate;\n }\n }\n\n return null;\n}\n\nexport function ThemeToggle(props: ThemeToggleProps): JSX.Element {\n const activeTheme = theme();\n const {\n children,\n lightIcon,\n darkIcon,\n systemIcon,\n themes = [\"light\", \"dark\"],\n onPress,\n ...rest\n } = props;\n\n const currentTheme = activeTheme.theme();\n const nextTheme = getNextTheme(currentTheme, themes, activeTheme.resolvedSystemTheme());\n const renderContext = { theme: currentTheme, nextTheme };\n const ariaLabel = (rest as Record<string, unknown>)[\"aria-label\"];\n const themedIcon = resolveThemeToggleIcon(currentTheme, nextTheme, {\n lightIcon,\n darkIcon,\n systemIcon,\n });\n const renderedIcon = cloneThemeToggleIcon(themedIcon, currentTheme);\n const renderedIconSlots =\n renderThemeToggleIconSlots(currentTheme, {\n lightIcon,\n darkIcon,\n systemIcon,\n }) ?? renderedIcon;\n const content =\n typeof children === \"function\" ? children(renderContext) : (children ?? renderedIconSlots);\n\n return (\n <Button\n {...(rest as ButtonNativeProps)}\n aria-label={typeof ariaLabel === \"string\" ? ariaLabel : `Switch to ${nextTheme} theme`}\n data-theme-control=\"toggle\"\n data-theme-choice={currentTheme}\n data-next-theme={nextTheme}\n onPress={(event) => {\n onPress?.(event);\n if (!event.defaultPrevented && !Object.is(nextTheme, currentTheme)) {\n activeTheme.setTheme(nextTheme);\n }\n }}\n >\n <span data-slot=\"theme-toggle-content\">{content}</span>\n </Button>\n );\n}\n\nfunction getNextTheme(\n currentTheme: ThemeName,\n themes: readonly ThemeName[],\n resolvedSystemTheme: \"light\" | \"dark\" = \"light\",\n): ThemeName {\n if (themes.length === 0) return currentTheme;\n const index = themes.indexOf(currentTheme);\n if (index < 0 && currentTheme === \"system\") {\n if (themes.includes(\"light\") && themes.includes(\"dark\")) {\n return resolvedSystemTheme === \"dark\" ? \"light\" : \"dark\";\n }\n }\n return themes[index >= 0 && index < themes.length - 1 ? index + 1 : 0]!;\n}\n\nfunction getThemeIcon(\n theme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n if (theme === \"light\") return icons.lightIcon;\n if (theme === \"dark\") return icons.darkIcon;\n if (theme === \"system\") return icons.systemIcon;\n return undefined;\n}\n\nexport function resolveThemeToggleIcon(\n theme: ThemeName,\n nextTheme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n return getThemeIcon(theme, icons) ?? getThemeIcon(nextTheme, icons);\n}\n\nfunction renderThemeToggleIconSlots(\n theme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n if (getThemeIcon(theme, icons) === undefined) {\n return undefined;\n }\n\n const slots = [\n [\"light\", icons.lightIcon],\n [\"dark\", icons.darkIcon],\n [\"system\", icons.systemIcon],\n ] as const;\n const availableSlots = slots.filter(([, icon]) => icon !== undefined && icon !== null);\n\n if (availableSlots.length <= 1) {\n return undefined;\n }\n\n return availableSlots.map(([slotTheme, icon]) => (\n <span\n key={slotTheme}\n data-slot=\"theme-toggle-icon\"\n data-theme-toggle-icon={slotTheme}\n hidden={slotTheme === theme ? undefined : true}\n >\n {cloneThemeToggleIcon(icon, slotTheme)}\n </span>\n ));\n}\n\nfunction cloneThemeToggleIcon(icon: unknown, key?: string): unknown {\n if (Array.isArray(icon)) {\n const clonedChildren = icon.map((child) => cloneThemeToggleIcon(child));\n if ((icon as unknown as Record<symbol, unknown>)[STATIC_CHILDREN] === true) {\n Object.defineProperty(clonedChildren, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n return clonedChildren;\n }\n\n if (!isElement(icon)) return icon;\n\n const props = icon.props as Record<string, unknown> | undefined;\n const clonedProps = props ? { ...props } : {};\n\n if (\"children\" in clonedProps) {\n clonedProps.children = cloneThemeToggleIcon(clonedProps.children);\n }\n\n const clonedIcon = cloneElement(icon, clonedProps);\n return {\n ...clonedIcon,\n key: icon.key ?? key ?? null,\n } satisfies JSXElement;\n}\n\nfunction syncThemeTarget(\n html: HTMLElement | null,\n themeChoice: ThemeName | null | undefined,\n): void {\n if (!html) return;\n\n if (themeChoice == null) {\n html.removeAttribute(\"data-theme\");\n html.removeAttribute(\"data-theme-choice\");\n return;\n }\n\n html.setAttribute(\"data-theme-choice\", themeChoice);\n\n if (themeChoice === \"system\") {\n html.removeAttribute(\"data-theme\");\n } else {\n html.setAttribute(\"data-theme\", themeChoice);\n }\n}\n\nfunction readStoredTheme(storageKey: string): ThemeName | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n const storedTheme = window.localStorage.getItem(storageKey);\n return storedTheme ? (storedTheme as ThemeName) : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction writeStoredTheme(storageKey: string, theme: ThemeName): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(storageKey, theme);\n } catch {\n // Storage can be unavailable in private or locked-down browser contexts.\n }\n}\n"],"mappings":";;;;;AAMA,MAAa,kBAAkB;CAAC;CAAS;CAAU;CAAU;CAAU;AAAO;AA+C9E,MAAa,wBAAgD;CAC3D;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OA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AqB,YAAY,QAAQ;CAIlE,OAAO;EACL,GAFiB,aAAa,MAAM,WAExB;EACZ,KAAK,KAAK,OAAO,OAAO;CAC1B;AACF;AAEA,SAAS,gBACP,MACA,aACM;CACN,IAAI,CAAC,MAAM;CAEX,IAAI,eAAe,MAAM;EACvB,KAAK,gBAAgB,YAAY;EACjC,KAAK,gBAAgB,mBAAmB;EACxC;CACF;CAEA,KAAK,aAAa,qBAAqB,WAAW;CAElD,IAAI,gBAAgB,UAClB,KAAK,gBAAgB,YAAY;MAEjC,KAAK,aAAa,cAAc,WAAW;AAE/C;AAEA,SAAS,gBAAgB,YAA2C;CAClE,IAAI,OAAO,WAAW,aAAa,OAAO,KAAA;CAC1C,IAAI;EACF,MAAM,cAAc,OAAO,aAAa,QAAQ,UAAU;EAC1D,OAAO,cAAe,cAA4B,KAAA;CACpD,QAAQ;EACN;CACF;AACF;AAEA,SAAS,iBAAiB,YAAoB,OAAwB;CACpE,IAAI,OAAO,WAAW,aAAa;CACnC,IAAI;EACF,OAAO,aAAa,QAAQ,YAAY,KAAK;CAC/C,QAAQ,CAER;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar.js","names":[],"sources":["../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport type { ToolbarProps } from \"./toolbar.types\";\n\nexport function Toolbar(props: ToolbarProps): JSX.Element {\n const { title, actions, ...rest } = props;\n\n return (\n <Block\n rowFrom=\"md\"\n align={{ base: \"start\", md: \"center\" }}\n justify=\"between\"\n gap=\"md\"\n {...rest}\n data-slot=\"toolbar\"\n >\n <h2 data-slot=\"toolbar-title\">{title}</h2>\n {actions !== undefined ? (\n <Block direction=\"row\" gap=\"sm\" data-slot=\"toolbar-actions\">\n {actions}\n </Block>\n ) : null}\n </Block>\n );\n}\n"],"mappings":";;;AAIA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EAAE,OAAO,SAAS,GAAG,SAAS;CAEpC,OACE,qBAAC,OAAD;EACE,SAAQ;EACR,OAAO;GAAE,MAAM;GAAS,IAAI;EAAS;EACrC,SAAQ;EACR,KAAI;EACJ,GAAI;EACJ,aAAU;YANZ,CAQE,oBAAC,MAAD;GAAI,aAAU;aAAiB;EAAU,CAAA,GACxC,YAAY,KAAA,IACX,oBAAC,OAAD;GAAO,WAAU;GAAM,KAAI;GAAK,aAAU;aACvC;EACI,CAAA,IACL,IACC;;AAEX"}
1
+ {"version":3,"file":"toolbar.js","names":[],"sources":["../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["import type { JSX } from \"@askrjs/askr/jsx-runtime\";\nimport { Block } from \"../block\";\nimport type { ToolbarProps } from \"./toolbar.types\";\n\nexport function Toolbar(props: ToolbarProps): JSX.Element {\n const { title, actions, ...rest } = props;\n\n return (\n <Block\n rowFrom=\"md\"\n align={{ base: \"start\", md: \"center\" }}\n justify=\"between\"\n gap=\"md\"\n {...rest}\n data-slot=\"toolbar\"\n >\n <h2 data-slot=\"toolbar-title\">{title}</h2>\n {actions !== undefined ? (\n <Block direction=\"row\" gap=\"sm\" data-slot=\"toolbar-actions\">\n {actions}\n </Block>\n ) : null}\n </Block>\n );\n}\n"],"mappings":";;;AAIA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EAAE,OAAO,SAAS,GAAG,SAAS;CAEpC,OACE,qBAAC,OAAD;EACE,SAAQ;EACR,OAAO;GAAE,MAAM;GAAS,IAAI;EAAS;EACrC,SAAQ;EACR,KAAI;EACJ,GAAI;EACJ,aAAU;EANZ,UAAA,CAQE,oBAAC,MAAD;GAAI,aAAU;GAAiB,UAAA;EAAU,CAAA,GACxC,YAAY,KAAA,IACX,oBAAC,OAAD;GAAO,WAAU;GAAM,KAAI;GAAK,aAAU;GACvC,UAAA;EACI,CAAA,IACL,IACC;;AAEX"}