@askrjs/themes 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/THEMING.md +930 -0
- package/dist/_internal/box-layout.js +115 -0
- package/dist/_internal/box-layout.js.map +1 -0
- package/dist/_internal/classes.js +8 -0
- package/dist/_internal/classes.js.map +1 -0
- package/dist/_internal/jsx.js +12 -0
- package/dist/_internal/jsx.js.map +1 -0
- package/dist/_internal/layout.d.ts +9 -0
- package/dist/_internal/layout.js +156 -0
- package/dist/_internal/layout.js.map +1 -0
- package/dist/_internal/merge-props.js +50 -0
- package/dist/_internal/merge-props.js.map +1 -0
- package/dist/accessible-icon/accessible-icon.d.ts +7 -0
- package/dist/accessible-icon/accessible-icon.js +20 -0
- package/dist/accessible-icon/accessible-icon.js.map +1 -0
- package/dist/accessible-icon/accessible-icon.types.d.ts +9 -0
- package/dist/askr/dist/common/jsx.d.ts +16 -0
- package/dist/askr/dist/common/props.d.ts +22 -0
- package/dist/askr-themes/src/themes/default/index.css +3736 -0
- package/dist/aspect-ratio/aspect-ratio.d.ts +8 -0
- package/dist/aspect-ratio/aspect-ratio.js +36 -0
- package/dist/aspect-ratio/aspect-ratio.js.map +1 -0
- package/dist/aspect-ratio/aspect-ratio.types.d.ts +20 -0
- package/dist/aspect-ratio/index.d.ts +2 -0
- package/dist/badge/badge.d.ts +8 -0
- package/dist/badge/badge.js +26 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/badge.types.d.ts +20 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/box/box.d.ts +9 -0
- package/dist/box/box.js +35 -0
- package/dist/box/box.js.map +1 -0
- package/dist/box/box.types.d.ts +71 -0
- package/dist/box/index.d.ts +2 -0
- package/dist/breadcrumb/breadcrumb.d.ts +18 -0
- package/dist/breadcrumb/breadcrumb.js +113 -0
- package/dist/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/breadcrumb/breadcrumb.types.d.ts +64 -0
- package/dist/breadcrumb/index.d.ts +2 -0
- package/dist/card/card.d.ts +12 -0
- package/dist/card/card.js +68 -0
- package/dist/card/card.js.map +1 -0
- package/dist/card/card.types.d.ts +37 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/components/_internal/box-layout.d.ts +7 -0
- package/dist/components/_internal/classes.d.ts +1 -0
- package/dist/components/_internal/jsx.d.ts +8 -0
- package/dist/components/_internal/layout.d.ts +31 -0
- package/dist/components/_internal/merge-props.d.ts +1 -0
- package/dist/components/_internal/style.d.ts +1 -0
- package/dist/components/accessible-icon/accessible-icon.d.ts +2 -0
- package/dist/components/accessible-icon/accessible-icon.types.d.ts +5 -0
- package/dist/components/accessible-icon/index.d.ts +2 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +3 -0
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +15 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/badge/badge.a11y.d.ts +13 -0
- package/dist/components/badge/badge.d.ts +3 -0
- package/dist/components/badge/badge.types.d.ts +15 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/box/box.a11y.d.ts +10 -0
- package/dist/components/box/box.d.ts +4 -0
- package/dist/components/box/box.types.d.ts +66 -0
- package/dist/components/box/index.d.ts +3 -0
- package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +13 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +13 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +59 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/card/card.d.ts +7 -0
- package/dist/components/card/card.types.d.ts +33 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/container/container.a11y.d.ts +16 -0
- package/dist/components/container/container.d.ts +3 -0
- package/dist/components/container/container.types.d.ts +29 -0
- package/dist/components/container/index.d.ts +3 -0
- package/dist/components/empty-state/empty-state.d.ts +2 -0
- package/dist/components/empty-state/empty-state.types.d.ts +9 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/flex/flex.a11y.d.ts +18 -0
- package/dist/components/flex/flex.d.ts +4 -0
- package/dist/components/flex/flex.types.d.ts +41 -0
- package/dist/components/flex/index.d.ts +3 -0
- package/dist/components/grid/grid.a11y.d.ts +21 -0
- package/dist/components/grid/grid.d.ts +4 -0
- package/dist/components/grid/grid.types.d.ts +37 -0
- package/dist/components/grid/index.d.ts +3 -0
- package/dist/components/header/header.a11y.d.ts +10 -0
- package/dist/components/header/header.d.ts +2 -0
- package/dist/components/header/header.types.d.ts +5 -0
- package/dist/components/header/index.d.ts +3 -0
- package/dist/components/index.d.ts +49 -0
- package/dist/components/index.js +28 -0
- package/dist/components/inline/index.d.ts +6 -0
- package/dist/components/logos/create-logo.d.ts +5 -0
- package/dist/components/logos/github-logo.d.ts +4 -0
- package/dist/components/logos/google-logo.d.ts +4 -0
- package/dist/components/logos/index.d.ts +5 -0
- package/dist/components/logos/microsoft-logo.d.ts +4 -0
- package/dist/components/logos/types.d.ts +14 -0
- package/dist/components/navbar/index.d.ts +2 -0
- package/dist/components/navbar/navbar.d.ts +6 -0
- package/dist/components/navbar/navbar.types.d.ts +24 -0
- package/dist/components/section/index.d.ts +3 -0
- package/dist/components/section/section.a11y.d.ts +11 -0
- package/dist/components/section/section.d.ts +3 -0
- package/dist/components/section/section.types.d.ts +17 -0
- package/dist/components/separator/index.d.ts +3 -0
- package/dist/components/separator/separator.a11y.d.ts +13 -0
- package/dist/components/separator/separator.d.ts +3 -0
- package/dist/components/separator/separator.types.d.ts +16 -0
- package/dist/components/sidebar-layout/index.d.ts +3 -0
- package/dist/components/sidebar-layout/sidebar-layout.a11y.d.ts +15 -0
- package/dist/components/sidebar-layout/sidebar-layout.d.ts +2 -0
- package/dist/components/sidebar-layout/sidebar-layout.types.d.ts +20 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/skeleton.a11y.d.ts +12 -0
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.types.d.ts +13 -0
- package/dist/components/spacer/index.d.ts +3 -0
- package/dist/components/spacer/spacer.a11y.d.ts +13 -0
- package/dist/components/spacer/spacer.d.ts +3 -0
- package/dist/components/spacer/spacer.types.d.ts +24 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/spinner.d.ts +2 -0
- package/dist/components/spinner/spinner.types.d.ts +5 -0
- package/dist/components/stack/index.d.ts +3 -0
- package/dist/components/stack/stack.a11y.d.ts +14 -0
- package/dist/components/stack/stack.d.ts +3 -0
- package/dist/components/stack/stack.types.d.ts +16 -0
- package/dist/components/theme/index.d.ts +2 -0
- package/dist/components/theme/theme.d.ts +40 -0
- package/dist/components/topbar-layout/index.d.ts +3 -0
- package/dist/components/topbar-layout/topbar-layout.a11y.d.ts +13 -0
- package/dist/components/topbar-layout/topbar-layout.d.ts +2 -0
- package/dist/components/topbar-layout/topbar-layout.types.d.ts +12 -0
- package/dist/container/container.d.ts +8 -0
- package/dist/container/container.js +82 -0
- package/dist/container/container.js.map +1 -0
- package/dist/container/container.types.d.ts +28 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/empty-state/empty-state.d.ts +7 -0
- package/dist/empty-state/empty-state.js +39 -0
- package/dist/empty-state/empty-state.js.map +1 -0
- package/dist/empty-state/empty-state.types.d.ts +13 -0
- package/dist/flex/flex.d.ts +9 -0
- package/dist/flex/flex.js +114 -0
- package/dist/flex/flex.js.map +1 -0
- package/dist/flex/flex.types.d.ts +41 -0
- package/dist/flex/index.d.ts +2 -0
- package/dist/grid/grid.d.ts +9 -0
- package/dist/grid/grid.js +115 -0
- package/dist/grid/grid.js.map +1 -0
- package/dist/grid/grid.types.d.ts +40 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/header/header.d.ts +7 -0
- package/dist/header/header.js +18 -0
- package/dist/header/header.js.map +1 -0
- package/dist/header/header.types.d.ts +9 -0
- package/dist/inline/index.d.ts +7 -0
- package/dist/inline/index.js +13 -0
- package/dist/inline/index.js.map +1 -0
- package/dist/logos/create-logo.js +75 -0
- package/dist/logos/create-logo.js.map +1 -0
- package/dist/logos/github-logo.d.ts +18 -0
- package/dist/logos/github-logo.js +9 -0
- package/dist/logos/github-logo.js.map +1 -0
- package/dist/logos/google-logo.d.ts +18 -0
- package/dist/logos/google-logo.js +23 -0
- package/dist/logos/google-logo.js.map +1 -0
- package/dist/logos/microsoft-logo.d.ts +18 -0
- package/dist/logos/microsoft-logo.js +35 -0
- package/dist/logos/microsoft-logo.js.map +1 -0
- package/dist/logos/types.d.ts +16 -0
- package/dist/navbar/index.d.ts +2 -0
- package/dist/navbar/navbar.d.ts +11 -0
- package/dist/navbar/navbar.js +57 -0
- package/dist/navbar/navbar.js.map +1 -0
- package/dist/navbar/navbar.types.d.ts +29 -0
- package/dist/section/index.d.ts +2 -0
- package/dist/section/section.d.ts +8 -0
- package/dist/section/section.js +40 -0
- package/dist/section/section.js.map +1 -0
- package/dist/section/section.types.d.ts +22 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/separator.d.ts +8 -0
- package/dist/separator/separator.js +27 -0
- package/dist/separator/separator.js.map +1 -0
- package/dist/separator/separator.types.d.ts +21 -0
- package/dist/sidebar-layout/index.d.ts +2 -0
- package/dist/sidebar-layout/sidebar-layout.d.ts +7 -0
- package/dist/sidebar-layout/sidebar-layout.js +51 -0
- package/dist/sidebar-layout/sidebar-layout.js.map +1 -0
- package/dist/sidebar-layout/sidebar-layout.types.d.ts +20 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/skeleton.d.ts +8 -0
- package/dist/skeleton/skeleton.js +26 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/skeleton/skeleton.types.d.ts +18 -0
- package/dist/spacer/index.d.ts +2 -0
- package/dist/spacer/spacer.d.ts +8 -0
- package/dist/spacer/spacer.js +47 -0
- package/dist/spacer/spacer.js.map +1 -0
- package/dist/spacer/spacer.types.d.ts +25 -0
- package/dist/spinner/index.d.ts +2 -0
- package/dist/spinner/spinner.d.ts +7 -0
- package/dist/spinner/spinner.js +16 -0
- package/dist/spinner/spinner.js.map +1 -0
- package/dist/spinner/spinner.types.d.ts +10 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/stack.d.ts +8 -0
- package/dist/stack/stack.js +16 -0
- package/dist/stack/stack.js.map +1 -0
- package/dist/stack/stack.types.d.ts +21 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/theme.d.ts +44 -0
- package/dist/theme/theme.js +159 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/topbar-layout/index.d.ts +2 -0
- package/dist/topbar-layout/topbar-layout.d.ts +7 -0
- package/dist/topbar-layout/topbar-layout.js +37 -0
- package/dist/topbar-layout/topbar-layout.js.map +1 -0
- package/dist/topbar-layout/topbar-layout.types.d.ts +13 -0
- package/package.json +122 -0
- package/scripts/new-theme.js +87 -0
- package/src/askr-compat.d.ts +110 -0
- package/src/components/_internal/box-layout.ts +156 -0
- package/src/components/_internal/classes.ts +5 -0
- package/src/components/_internal/jsx.ts +141 -0
- package/src/components/_internal/layout.ts +223 -0
- package/src/components/_internal/merge-props.ts +89 -0
- package/src/components/_internal/style.ts +18 -0
- package/src/components/accessible-icon/accessible-icon.tsx +18 -0
- package/src/components/accessible-icon/accessible-icon.types.ts +5 -0
- package/src/components/accessible-icon/index.ts +2 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +48 -0
- package/src/components/aspect-ratio/aspect-ratio.types.ts +19 -0
- package/src/components/aspect-ratio/index.ts +2 -0
- package/src/components/badge/badge.a11y.ts +15 -0
- package/src/components/badge/badge.tsx +21 -0
- package/src/components/badge/badge.types.ts +27 -0
- package/src/components/badge/index.ts +3 -0
- package/src/components/box/box.a11y.ts +11 -0
- package/src/components/box/box.tsx +37 -0
- package/src/components/box/box.types.ts +75 -0
- package/src/components/box/index.ts +11 -0
- package/src/components/breadcrumb/breadcrumb.a11y.ts +15 -0
- package/src/components/breadcrumb/breadcrumb.tsx +123 -0
- package/src/components/breadcrumb/breadcrumb.types.ts +73 -0
- package/src/components/breadcrumb/index.ts +24 -0
- package/src/components/card/card.tsx +79 -0
- package/src/components/card/card.types.ts +40 -0
- package/src/components/card/index.ts +12 -0
- package/src/components/container/container.a11y.ts +17 -0
- package/src/components/container/container.tsx +139 -0
- package/src/components/container/container.types.ts +35 -0
- package/src/components/container/index.ts +9 -0
- package/src/components/empty-state/empty-state.tsx +42 -0
- package/src/components/empty-state/empty-state.types.ts +10 -0
- package/src/components/empty-state/index.ts +2 -0
- package/src/components/flex/flex.a11y.ts +19 -0
- package/src/components/flex/flex.tsx +160 -0
- package/src/components/flex/flex.types.ts +50 -0
- package/src/components/flex/index.ts +16 -0
- package/src/components/grid/grid.a11y.ts +22 -0
- package/src/components/grid/grid.tsx +172 -0
- package/src/components/grid/grid.types.ts +45 -0
- package/src/components/grid/index.ts +10 -0
- package/src/components/header/header.a11y.ts +11 -0
- package/src/components/header/header.tsx +18 -0
- package/src/components/header/header.types.ts +6 -0
- package/src/components/header/index.ts +3 -0
- package/src/components/index.ts +107 -0
- package/src/components/inline/index.tsx +28 -0
- package/src/components/logos/create-logo.tsx +103 -0
- package/src/components/logos/github-logo.tsx +13 -0
- package/src/components/logos/google-logo.tsx +34 -0
- package/src/components/logos/index.ts +5 -0
- package/src/components/logos/microsoft-logo.tsx +10 -0
- package/src/components/logos/types.ts +24 -0
- package/src/components/navbar/index.ts +9 -0
- package/src/components/navbar/navbar.tsx +59 -0
- package/src/components/navbar/navbar.types.ts +33 -0
- package/src/components/section/index.ts +8 -0
- package/src/components/section/section.a11y.ts +12 -0
- package/src/components/section/section.tsx +37 -0
- package/src/components/section/section.types.ts +22 -0
- package/src/components/separator/index.ts +12 -0
- package/src/components/separator/separator.a11y.ts +15 -0
- package/src/components/separator/separator.tsx +23 -0
- package/src/components/separator/separator.types.ts +21 -0
- package/src/components/sidebar-layout/index.ts +6 -0
- package/src/components/sidebar-layout/sidebar-layout.a11y.ts +16 -0
- package/src/components/sidebar-layout/sidebar-layout.tsx +59 -0
- package/src/components/sidebar-layout/sidebar-layout.types.ts +22 -0
- package/src/components/skeleton/index.ts +3 -0
- package/src/components/skeleton/skeleton.a11y.ts +14 -0
- package/src/components/skeleton/skeleton.tsx +21 -0
- package/src/components/skeleton/skeleton.types.ts +17 -0
- package/src/components/spacer/index.ts +9 -0
- package/src/components/spacer/spacer.a11y.ts +14 -0
- package/src/components/spacer/spacer.tsx +58 -0
- package/src/components/spacer/spacer.types.ts +30 -0
- package/src/components/spinner/index.ts +2 -0
- package/src/components/spinner/spinner.tsx +21 -0
- package/src/components/spinner/spinner.types.ts +7 -0
- package/src/components/stack/index.ts +3 -0
- package/src/components/stack/stack.a11y.ts +15 -0
- package/src/components/stack/stack.tsx +13 -0
- package/src/components/stack/stack.types.ts +21 -0
- package/src/components/theme/index.ts +10 -0
- package/src/components/theme/theme.tsx +260 -0
- package/src/components/topbar-layout/index.ts +3 -0
- package/src/components/topbar-layout/topbar-layout.a11y.ts +14 -0
- package/src/components/topbar-layout/topbar-layout.tsx +39 -0
- package/src/components/topbar-layout/topbar-layout.types.ts +13 -0
- package/src/css.d.ts +1 -0
- package/src/index.css +1 -0
- package/src/jsx.d.ts +23 -0
- package/src/themes/default/index.css +48 -0
- package/src/themes/default/styles/actions/button.css +196 -0
- package/src/themes/default/styles/actions/toggle-group.css +52 -0
- package/src/themes/default/styles/actions/toggle.css +44 -0
- package/src/themes/default/styles/base/icon.css +10 -0
- package/src/themes/default/styles/base/typography.css +208 -0
- package/src/themes/default/styles/base/utilities.css +223 -0
- package/src/themes/default/styles/disclosure/accordion.css +62 -0
- package/src/themes/default/styles/disclosure/collapsible.css +47 -0
- package/src/themes/default/styles/display/avatar.css +25 -0
- package/src/themes/default/styles/display/badge.css +51 -0
- package/src/themes/default/styles/display/card.css +53 -0
- package/src/themes/default/styles/display/coverage.css +248 -0
- package/src/themes/default/styles/display/progress-circle.css +18 -0
- package/src/themes/default/styles/display/progress.css +18 -0
- package/src/themes/default/styles/display/scroll-area.css +34 -0
- package/src/themes/default/styles/display/separator.css +15 -0
- package/src/themes/default/styles/display/skeleton.css +6 -0
- package/src/themes/default/styles/display/spinner.css +9 -0
- package/src/themes/default/styles/display/table.css +63 -0
- package/src/themes/default/styles/forms/checkbox.css +64 -0
- package/src/themes/default/styles/forms/form.css +5 -0
- package/src/themes/default/styles/forms/input.css +49 -0
- package/src/themes/default/styles/forms/label.css +6 -0
- package/src/themes/default/styles/forms/radio-group.css +53 -0
- package/src/themes/default/styles/forms/select.css +143 -0
- package/src/themes/default/styles/forms/slider.css +75 -0
- package/src/themes/default/styles/forms/switch.css +70 -0
- package/src/themes/default/styles/forms/textarea.css +37 -0
- package/src/themes/default/styles/layout/aspect-ratio.css +5 -0
- package/src/themes/default/styles/layout/dashboard-layout.css +15 -0
- package/src/themes/default/styles/layout/docs-layout.css +10 -0
- package/src/themes/default/styles/layout/layout.css +946 -0
- package/src/themes/default/styles/layout/patterns.css +43 -0
- package/src/themes/default/styles/layout/responsive-layout.css +209 -0
- package/src/themes/default/styles/layout/sidebar.css +10 -0
- package/src/themes/default/styles/navigation/breadcrumb.css +39 -0
- package/src/themes/default/styles/navigation/menu.css +60 -0
- package/src/themes/default/styles/navigation/menubar.css +89 -0
- package/src/themes/default/styles/navigation/navigation-menu.css +90 -0
- package/src/themes/default/styles/navigation/tabs.css +61 -0
- package/src/themes/default/styles/overlays/alert-dialog.css +9 -0
- package/src/themes/default/styles/overlays/dialog.css +116 -0
- package/src/themes/default/styles/overlays/dropdown-menu.css +109 -0
- package/src/themes/default/styles/overlays/hover-card.css +46 -0
- package/src/themes/default/styles/overlays/popover.css +72 -0
- package/src/themes/default/styles/overlays/toast.css +123 -0
- package/src/themes/default/styles/overlays/tooltip.css +83 -0
- package/src/themes/default/styles/shell/header.css +36 -0
- package/src/themes/default/styles/shell/navbar.css +158 -0
- package/src/themes/default/styles/shell/theme.css +35 -0
- package/src/themes/default/tokens.css +316 -0
- package/templates/theme/index.css +48 -0
- package/templates/theme/styles/actions/button.css +196 -0
- package/templates/theme/styles/actions/toggle-group.css +52 -0
- package/templates/theme/styles/actions/toggle.css +44 -0
- package/templates/theme/styles/base/icon.css +10 -0
- package/templates/theme/styles/base/typography.css +208 -0
- package/templates/theme/styles/base/utilities.css +19 -0
- package/templates/theme/styles/disclosure/accordion.css +62 -0
- package/templates/theme/styles/disclosure/collapsible.css +47 -0
- package/templates/theme/styles/display/avatar.css +25 -0
- package/templates/theme/styles/display/badge.css +51 -0
- package/templates/theme/styles/display/card.css +53 -0
- package/templates/theme/styles/display/coverage.css +146 -0
- package/templates/theme/styles/display/progress-circle.css +18 -0
- package/templates/theme/styles/display/progress.css +18 -0
- package/templates/theme/styles/display/scroll-area.css +34 -0
- package/templates/theme/styles/display/separator.css +15 -0
- package/templates/theme/styles/display/skeleton.css +6 -0
- package/templates/theme/styles/display/spinner.css +9 -0
- package/templates/theme/styles/display/table.css +63 -0
- package/templates/theme/styles/forms/checkbox.css +64 -0
- package/templates/theme/styles/forms/form.css +5 -0
- package/templates/theme/styles/forms/input.css +49 -0
- package/templates/theme/styles/forms/label.css +6 -0
- package/templates/theme/styles/forms/radio-group.css +53 -0
- package/templates/theme/styles/forms/select.css +143 -0
- package/templates/theme/styles/forms/slider.css +75 -0
- package/templates/theme/styles/forms/switch.css +70 -0
- package/templates/theme/styles/forms/textarea.css +37 -0
- package/templates/theme/styles/layout/aspect-ratio.css +5 -0
- package/templates/theme/styles/layout/dashboard-layout.css +16 -0
- package/templates/theme/styles/layout/docs-layout.css +11 -0
- package/templates/theme/styles/layout/layout.css +1 -0
- package/templates/theme/styles/layout/patterns.css +43 -0
- package/templates/theme/styles/layout/responsive-layout.css +209 -0
- package/templates/theme/styles/layout/sidebar.css +11 -0
- package/templates/theme/styles/navigation/breadcrumb.css +31 -0
- package/templates/theme/styles/navigation/menu.css +60 -0
- package/templates/theme/styles/navigation/menubar.css +89 -0
- package/templates/theme/styles/navigation/navigation-menu.css +90 -0
- package/templates/theme/styles/navigation/tabs.css +61 -0
- package/templates/theme/styles/overlays/alert-dialog.css +9 -0
- package/templates/theme/styles/overlays/dialog.css +116 -0
- package/templates/theme/styles/overlays/dropdown-menu.css +109 -0
- package/templates/theme/styles/overlays/hover-card.css +46 -0
- package/templates/theme/styles/overlays/popover.css +72 -0
- package/templates/theme/styles/overlays/toast.css +123 -0
- package/templates/theme/styles/overlays/tooltip.css +83 -0
- package/templates/theme/styles/shell/header.css +36 -0
- package/templates/theme/styles/shell/navbar.css +158 -0
- package/templates/theme/styles/shell/theme.css +35 -0
- package/templates/theme/tokens.css +316 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { mergeLayoutStyles, resolveSpaceValue, setResponsiveStyleVar } from "./layout.js";
|
|
2
|
+
//#region src/components/_internal/box-layout.ts
|
|
3
|
+
const SPACE_PROP_KEYS = new Set([
|
|
4
|
+
"m",
|
|
5
|
+
"mx",
|
|
6
|
+
"my",
|
|
7
|
+
"mt",
|
|
8
|
+
"mr",
|
|
9
|
+
"mb",
|
|
10
|
+
"ml",
|
|
11
|
+
"p",
|
|
12
|
+
"px",
|
|
13
|
+
"py",
|
|
14
|
+
"pt",
|
|
15
|
+
"pr",
|
|
16
|
+
"pb",
|
|
17
|
+
"pl",
|
|
18
|
+
"inset",
|
|
19
|
+
"top",
|
|
20
|
+
"right",
|
|
21
|
+
"bottom",
|
|
22
|
+
"left"
|
|
23
|
+
]);
|
|
24
|
+
const BOX_PROP_KEYS = new Set([
|
|
25
|
+
"display",
|
|
26
|
+
"m",
|
|
27
|
+
"mx",
|
|
28
|
+
"my",
|
|
29
|
+
"mt",
|
|
30
|
+
"mr",
|
|
31
|
+
"mb",
|
|
32
|
+
"ml",
|
|
33
|
+
"p",
|
|
34
|
+
"px",
|
|
35
|
+
"py",
|
|
36
|
+
"pt",
|
|
37
|
+
"pr",
|
|
38
|
+
"pb",
|
|
39
|
+
"pl",
|
|
40
|
+
"width",
|
|
41
|
+
"minWidth",
|
|
42
|
+
"maxWidth",
|
|
43
|
+
"height",
|
|
44
|
+
"minHeight",
|
|
45
|
+
"maxHeight",
|
|
46
|
+
"position",
|
|
47
|
+
"inset",
|
|
48
|
+
"top",
|
|
49
|
+
"right",
|
|
50
|
+
"bottom",
|
|
51
|
+
"left",
|
|
52
|
+
"overflow",
|
|
53
|
+
"overflowX",
|
|
54
|
+
"overflowY",
|
|
55
|
+
"flexBasis",
|
|
56
|
+
"flexGrow",
|
|
57
|
+
"flexShrink",
|
|
58
|
+
"gridArea",
|
|
59
|
+
"gridColumn",
|
|
60
|
+
"gridColumnStart",
|
|
61
|
+
"gridColumnEnd",
|
|
62
|
+
"gridRow",
|
|
63
|
+
"gridRowStart",
|
|
64
|
+
"gridRowEnd"
|
|
65
|
+
]);
|
|
66
|
+
function variableNameForProp(prop) {
|
|
67
|
+
switch (prop) {
|
|
68
|
+
case "overflowX": return "overflow-x";
|
|
69
|
+
case "overflowY": return "overflow-y";
|
|
70
|
+
case "minWidth": return "min-width";
|
|
71
|
+
case "maxWidth": return "max-width";
|
|
72
|
+
case "minHeight": return "min-height";
|
|
73
|
+
case "maxHeight": return "max-height";
|
|
74
|
+
case "flexBasis": return "flex-basis";
|
|
75
|
+
case "flexGrow": return "flex-grow";
|
|
76
|
+
case "flexShrink": return "flex-shrink";
|
|
77
|
+
case "gridArea": return "grid-area";
|
|
78
|
+
case "gridColumn": return "grid-column";
|
|
79
|
+
case "gridColumnStart": return "grid-column-start";
|
|
80
|
+
case "gridColumnEnd": return "grid-column-end";
|
|
81
|
+
case "gridRow": return "grid-row";
|
|
82
|
+
case "gridRowStart": return "grid-row-start";
|
|
83
|
+
case "gridRowEnd": return "grid-row-end";
|
|
84
|
+
default: return prop;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function splitBoxLayoutProps(props) {
|
|
88
|
+
const boxProps = {};
|
|
89
|
+
const rest = {};
|
|
90
|
+
for (const [key, value] of Object.entries(props)) if (BOX_PROP_KEYS.has(key)) boxProps[key] = value;
|
|
91
|
+
else rest[key] = value;
|
|
92
|
+
return {
|
|
93
|
+
boxProps,
|
|
94
|
+
rest
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function applyBoxLayoutStyles(styles, boxProps) {
|
|
98
|
+
for (const key of BOX_PROP_KEYS) {
|
|
99
|
+
const value = boxProps[key];
|
|
100
|
+
if (value === void 0) continue;
|
|
101
|
+
const variable = variableNameForProp(key);
|
|
102
|
+
if (SPACE_PROP_KEYS.has(key)) {
|
|
103
|
+
setResponsiveStyleVar(styles, variable, value, resolveSpaceValue);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
setResponsiveStyleVar(styles, variable, value, (input) => input);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function withBoxLayoutStyle(styles, userStyle) {
|
|
110
|
+
return mergeLayoutStyles(styles, userStyle);
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { applyBoxLayoutStyles, splitBoxLayoutProps, withBoxLayoutStyle };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=box-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box-layout.js","names":[],"sources":["../../src/components/_internal/box-layout.ts"],"sourcesContent":["import { mergeLayoutStyles, resolveSpaceValue, setResponsiveStyleVar } from \"./layout\";\nimport type { BoxLayoutOwnProps } from \"../box/box.types\";\n\nconst SPACE_PROP_KEYS = new Set([\n \"m\",\n \"mx\",\n \"my\",\n \"mt\",\n \"mr\",\n \"mb\",\n \"ml\",\n \"p\",\n \"px\",\n \"py\",\n \"pt\",\n \"pr\",\n \"pb\",\n \"pl\",\n \"inset\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\nconst BOX_PROP_KEYS = new Set<keyof BoxLayoutOwnProps>([\n \"display\",\n \"m\",\n \"mx\",\n \"my\",\n \"mt\",\n \"mr\",\n \"mb\",\n \"ml\",\n \"p\",\n \"px\",\n \"py\",\n \"pt\",\n \"pr\",\n \"pb\",\n \"pl\",\n \"width\",\n \"minWidth\",\n \"maxWidth\",\n \"height\",\n \"minHeight\",\n \"maxHeight\",\n \"position\",\n \"inset\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"overflow\",\n \"overflowX\",\n \"overflowY\",\n \"flexBasis\",\n \"flexGrow\",\n \"flexShrink\",\n \"gridArea\",\n \"gridColumn\",\n \"gridColumnStart\",\n \"gridColumnEnd\",\n \"gridRow\",\n \"gridRowStart\",\n \"gridRowEnd\",\n]);\n\nfunction variableNameForProp(prop: keyof BoxLayoutOwnProps): string {\n switch (prop) {\n case \"overflowX\":\n return \"overflow-x\";\n case \"overflowY\":\n return \"overflow-y\";\n case \"minWidth\":\n return \"min-width\";\n case \"maxWidth\":\n return \"max-width\";\n case \"minHeight\":\n return \"min-height\";\n case \"maxHeight\":\n return \"max-height\";\n case \"flexBasis\":\n return \"flex-basis\";\n case \"flexGrow\":\n return \"flex-grow\";\n case \"flexShrink\":\n return \"flex-shrink\";\n case \"gridArea\":\n return \"grid-area\";\n case \"gridColumn\":\n return \"grid-column\";\n case \"gridColumnStart\":\n return \"grid-column-start\";\n case \"gridColumnEnd\":\n return \"grid-column-end\";\n case \"gridRow\":\n return \"grid-row\";\n case \"gridRowStart\":\n return \"grid-row-start\";\n case \"gridRowEnd\":\n return \"grid-row-end\";\n default:\n return prop;\n }\n}\n\nexport function splitBoxLayoutProps<T extends Record<string, unknown>>(\n props: T,\n): {\n boxProps: Partial<BoxLayoutOwnProps>;\n rest: Omit<T, keyof BoxLayoutOwnProps>;\n} {\n const boxProps: Partial<BoxLayoutOwnProps> = {};\n const rest: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (BOX_PROP_KEYS.has(key as keyof BoxLayoutOwnProps)) {\n (boxProps as Record<string, unknown>)[key] = value;\n } else {\n rest[key] = value;\n }\n }\n\n return { boxProps, rest: rest as Omit<T, keyof BoxLayoutOwnProps> };\n}\n\nexport function applyBoxLayoutStyles(\n styles: Record<string, string | number>,\n boxProps: Partial<BoxLayoutOwnProps>,\n) {\n for (const key of BOX_PROP_KEYS) {\n const value = boxProps[key];\n if (value === undefined) continue;\n\n const variable = variableNameForProp(key);\n if (SPACE_PROP_KEYS.has(key)) {\n setResponsiveStyleVar(styles, variable, value as string | number, resolveSpaceValue);\n continue;\n }\n\n setResponsiveStyleVar(\n styles,\n variable,\n value as string | number,\n (input) => input as string | number,\n );\n }\n}\n\nexport function withBoxLayoutStyle(\n styles: Record<string, string | number>,\n userStyle: unknown,\n): string | undefined {\n return mergeLayoutStyles(styles, userStyle);\n}\n"],"mappings":";;AAGA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,gBAAgB,IAAI,IAA6B;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAS,oBAAoB,MAAuC;AAClE,SAAQ,MAAR;EACE,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,YACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,aACH,QAAO;EACT,KAAK,WACH,QAAO;EACT,KAAK,aACH,QAAO;EACT,KAAK,kBACH,QAAO;EACT,KAAK,gBACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,KAAK,eACH,QAAO;EACT,KAAK,aACH,QAAO;EACT,QACE,QAAO;;;AAIb,SAAgB,oBACd,OAIA;CACA,MAAM,WAAuC,EAAE;CAC/C,MAAM,OAAgC,EAAE;AAExC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC9C,KAAI,cAAc,IAAI,IAA+B,CAClD,UAAqC,OAAO;KAE7C,MAAK,OAAO;AAIhB,QAAO;EAAE;EAAgB;EAA0C;;AAGrE,SAAgB,qBACd,QACA,UACA;AACA,MAAK,MAAM,OAAO,eAAe;EAC/B,MAAM,QAAQ,SAAS;AACvB,MAAI,UAAU,KAAA,EAAW;EAEzB,MAAM,WAAW,oBAAoB,IAAI;AACzC,MAAI,gBAAgB,IAAI,IAAI,EAAE;AAC5B,yBAAsB,QAAQ,UAAU,OAA0B,kBAAkB;AACpF;;AAGF,wBACE,QACA,UACA,QACC,UAAU,MACZ;;;AAIL,SAAgB,mBACd,QACA,WACoB;AACpB,QAAO,kBAAkB,QAAQ,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.js","names":[],"sources":["../../src/components/_internal/classes.ts"],"sourcesContent":["export function classes(...values: Array<unknown>): string | undefined {\n const value = values.filter((item) => typeof item === \"string\" && item.trim()).join(\" \");\n\n return value || undefined;\n}\n"],"mappings":";AAAA,SAAgB,QAAQ,GAAG,QAA4C;AAGrE,QAFc,OAAO,QAAQ,SAAS,OAAO,SAAS,YAAY,KAAK,MAAM,CAAC,CAAC,KAAK,IAExE,IAAI,KAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/components/_internal/jsx.ts
|
|
2
|
+
function isJsxElement(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && "$$typeof" in value && "props" in value;
|
|
4
|
+
}
|
|
5
|
+
function toChildArray(children) {
|
|
6
|
+
if (Array.isArray(children)) return children;
|
|
7
|
+
return children === void 0 || children === null ? [] : [children];
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isJsxElement, toChildArray };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=jsx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.js","names":[],"sources":["../../src/components/_internal/jsx.ts"],"sourcesContent":["import type { JSXElement } from \"@askrjs/askr/foundations\";\n\nexport function isJsxElement(value: unknown): value is JSXElement {\n return typeof value === \"object\" && value !== null && \"$$typeof\" in value && \"props\" in value;\n}\n\nexport function hasJsxIntrinsicType(value: unknown, expectedType: string): value is JSXElement {\n return isJsxElement(value) && value.type === expectedType;\n}\n\nexport function toChildArray(children: unknown): unknown[] {\n if (Array.isArray(children)) {\n return children;\n }\n\n return children === undefined || children === null ? [] : [children];\n}\n\nexport function mapJsxTree(children: unknown, mapper: (element: JSXElement) => unknown): unknown {\n if (Array.isArray(children)) {\n return children.map((child) => mapJsxTree(child, mapper));\n }\n\n if (!isJsxElement(children)) {\n return children;\n }\n\n const mapped = mapper(children);\n\n if (!isJsxElement(mapped)) {\n return mapped;\n }\n\n const currentChildren = mapped.props?.children;\n const nextChildren = mapJsxTree(currentChildren, mapper);\n\n if (nextChildren === currentChildren) {\n return mapped;\n }\n\n return {\n ...mapped,\n props: {\n ...mapped.props,\n children: nextChildren,\n },\n };\n}\n\nexport function collectJsxElements(\n children: unknown,\n predicate?: (element: JSXElement) => boolean,\n): JSXElement[] {\n const result: JSXElement[] = [];\n\n const visit = (value: unknown) => {\n if (Array.isArray(value)) {\n value.forEach(visit);\n return;\n }\n\n if (!isJsxElement(value)) {\n return;\n }\n\n if (!predicate || predicate(value)) {\n result.push(value);\n }\n\n visit(value.props?.children);\n };\n\n visit(children);\n\n return result;\n}\n\nexport function extractTextContent(value: unknown): string {\n if (Array.isArray(value)) {\n return value.map((entry) => extractTextContent(entry)).join(\"\");\n }\n\n if (\n value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"function\"\n ) {\n return \"\";\n }\n\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value);\n }\n\n if (isJsxElement(value)) {\n return extractTextContent(value.props?.children);\n }\n\n return \"\";\n}\n\nexport function serializeForId(value: unknown): string {\n if (Array.isArray(value)) {\n return value.map((item) => serializeForId(item)).join(\"|\");\n }\n\n if (value === undefined || value === null || typeof value === \"boolean\") {\n return \"\";\n }\n\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value);\n }\n\n if (isJsxElement(value)) {\n const typeName =\n typeof value.type === \"string\"\n ? value.type\n : typeof value.type === \"function\"\n ? value.type.name || \"component\"\n : \"component\";\n const propEntries = Object.entries(value.props ?? {})\n .filter(\n ([key, entryValue]) =>\n key !== \"children\" &&\n key !== \"ref\" &&\n !key.startsWith(\"on\") &&\n (typeof entryValue === \"string\" ||\n typeof entryValue === \"number\" ||\n typeof entryValue === \"boolean\"),\n )\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([key, entryValue]) => `${key}:${String(entryValue)}`)\n .join(\",\");\n\n return `${typeName}[${propEntries}](${serializeForId(value.props?.children)})`;\n }\n\n return typeof value;\n}\n"],"mappings":";AAEA,SAAgB,aAAa,OAAqC;AAChE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,cAAc,SAAS,WAAW;;AAO1F,SAAgB,aAAa,UAA8B;AACzD,KAAI,MAAM,QAAQ,SAAS,CACzB,QAAO;AAGT,QAAO,aAAa,KAAA,KAAa,aAAa,OAAO,EAAE,GAAG,CAAC,SAAS"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/_internal/layout.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Layout helpers shared by headless layout primitives.
|
|
4
|
+
*/
|
|
5
|
+
type LayoutBreakpoint = "initial" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ResponsiveValue };
|
|
9
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//#region src/components/_internal/layout.ts
|
|
2
|
+
const BREAKPOINTS = [
|
|
3
|
+
"initial",
|
|
4
|
+
"sm",
|
|
5
|
+
"md",
|
|
6
|
+
"lg",
|
|
7
|
+
"xl"
|
|
8
|
+
];
|
|
9
|
+
/** Units and patterns that identify a concrete CSS length value. */
|
|
10
|
+
const CSS_UNIT_RE = /^-?[\d.]+(%|px|em|rem|ex|ch|ic|lh|rlh|vw|vh|vmin|vmax|svw|svh|dvw|dvh|cqw|cqh|cqi|cqb|fr|cm|mm|in|pt|pc|Q)$/;
|
|
11
|
+
const SPACE_TOKEN_MAP = {
|
|
12
|
+
"1": "var(--ak-space-1)",
|
|
13
|
+
"2": "var(--ak-space-2)",
|
|
14
|
+
"3": "var(--ak-space-3)",
|
|
15
|
+
"4": "var(--ak-space-4)",
|
|
16
|
+
"5": "var(--ak-space-5)",
|
|
17
|
+
"6": "var(--ak-space-6)",
|
|
18
|
+
"7": "var(--ak-space-7)",
|
|
19
|
+
"8": "var(--ak-space-8)",
|
|
20
|
+
"9": "var(--ak-space-9)",
|
|
21
|
+
xs: "var(--ak-space-xs)",
|
|
22
|
+
sm: "var(--ak-space-sm)",
|
|
23
|
+
md: "var(--ak-space-md)",
|
|
24
|
+
lg: "var(--ak-space-lg)",
|
|
25
|
+
xl: "var(--ak-space-xl)",
|
|
26
|
+
"2xl": "var(--ak-space-2xl)",
|
|
27
|
+
"3xl": "var(--ak-space-3xl)"
|
|
28
|
+
};
|
|
29
|
+
const CONTAINER_SIZE_MAP = {
|
|
30
|
+
"1": "var(--ak-container-1)",
|
|
31
|
+
"2": "var(--ak-container-2)",
|
|
32
|
+
"3": "var(--ak-container-3)",
|
|
33
|
+
"4": "var(--ak-container-4)",
|
|
34
|
+
sm: "var(--ak-container-1)",
|
|
35
|
+
md: "var(--ak-container-2)",
|
|
36
|
+
lg: "var(--ak-container-3)",
|
|
37
|
+
xl: "var(--ak-container-4)"
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Returns true when `value` is a concrete CSS length/size that can be applied
|
|
41
|
+
* directly as an inline style.
|
|
42
|
+
*/
|
|
43
|
+
function isCssLength(value) {
|
|
44
|
+
if (typeof value !== "string") return false;
|
|
45
|
+
const v = value.trim();
|
|
46
|
+
if (v === "0") return true;
|
|
47
|
+
if (CSS_UNIT_RE.test(v)) return true;
|
|
48
|
+
if (/^[a-z][a-z-]*\(/.test(v)) return true;
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
function isResponsiveValue(value) {
|
|
52
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
53
|
+
return BREAKPOINTS.some((breakpoint) => breakpoint in value);
|
|
54
|
+
}
|
|
55
|
+
function normalizeResponsiveValue(value) {
|
|
56
|
+
if (value === void 0) return void 0;
|
|
57
|
+
if (isResponsiveValue(value)) return value;
|
|
58
|
+
return { initial: value };
|
|
59
|
+
}
|
|
60
|
+
function serializeResponsiveValue(value) {
|
|
61
|
+
const normalized = normalizeResponsiveValue(value);
|
|
62
|
+
if (!normalized) return void 0;
|
|
63
|
+
return BREAKPOINTS.map((breakpoint) => {
|
|
64
|
+
const breakpointValue = normalized[breakpoint];
|
|
65
|
+
if (breakpointValue === void 0) return "";
|
|
66
|
+
return `${breakpoint}:${String(breakpointValue)}`;
|
|
67
|
+
}).filter(Boolean).join("|");
|
|
68
|
+
}
|
|
69
|
+
function serializeResponsiveValueIf(value, predicate) {
|
|
70
|
+
const normalized = normalizeResponsiveValue(value);
|
|
71
|
+
if (!normalized) return void 0;
|
|
72
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
73
|
+
const breakpointValue = normalized[breakpoint];
|
|
74
|
+
if (breakpointValue === void 0) continue;
|
|
75
|
+
if (!predicate(breakpointValue)) return void 0;
|
|
76
|
+
}
|
|
77
|
+
return serializeResponsiveValue(value);
|
|
78
|
+
}
|
|
79
|
+
function serializeValueIf(value, predicate) {
|
|
80
|
+
if (value === void 0 || !predicate(value)) return void 0;
|
|
81
|
+
return String(value);
|
|
82
|
+
}
|
|
83
|
+
function setResponsiveStyleVar(styles, variable, value, resolve = (input) => input) {
|
|
84
|
+
const normalized = normalizeResponsiveValue(value);
|
|
85
|
+
if (!normalized) return;
|
|
86
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
87
|
+
const breakpointValue = normalized[breakpoint];
|
|
88
|
+
if (breakpointValue === void 0) continue;
|
|
89
|
+
const resolved = resolve(breakpointValue);
|
|
90
|
+
if (resolved === void 0 || resolved === null || resolved === "") continue;
|
|
91
|
+
styles[`--ak-${variable}-${breakpoint}`] = resolved;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function resolveSpaceValue(value) {
|
|
95
|
+
if (typeof value === "number") return String(value);
|
|
96
|
+
const trimmed = value.trim();
|
|
97
|
+
return SPACE_TOKEN_MAP[trimmed] ?? trimmed;
|
|
98
|
+
}
|
|
99
|
+
function resolveContainerSizeValue(value) {
|
|
100
|
+
const trimmed = value.trim();
|
|
101
|
+
return CONTAINER_SIZE_MAP[trimmed] ?? trimmed;
|
|
102
|
+
}
|
|
103
|
+
function resolveGridTrackValue(value) {
|
|
104
|
+
if (typeof value === "number") return `repeat(${value}, minmax(0, 1fr))`;
|
|
105
|
+
const trimmed = value.trim();
|
|
106
|
+
if (/^\d+$/.test(trimmed)) return `repeat(${trimmed}, minmax(0, 1fr))`;
|
|
107
|
+
return trimmed;
|
|
108
|
+
}
|
|
109
|
+
function resolveJustifyValue(value) {
|
|
110
|
+
const trimmed = value.trim();
|
|
111
|
+
if (trimmed === "between") return "space-between";
|
|
112
|
+
if (trimmed === "start") return "flex-start";
|
|
113
|
+
if (trimmed === "end") return "flex-end";
|
|
114
|
+
return trimmed;
|
|
115
|
+
}
|
|
116
|
+
function resolveAlignValue(value) {
|
|
117
|
+
const trimmed = value.trim();
|
|
118
|
+
if (trimmed === "start") return "flex-start";
|
|
119
|
+
if (trimmed === "end") return "flex-end";
|
|
120
|
+
return trimmed;
|
|
121
|
+
}
|
|
122
|
+
function resolveInlineAlignValue(value) {
|
|
123
|
+
if (value === "left") return {
|
|
124
|
+
marginLeft: "0",
|
|
125
|
+
marginRight: "auto"
|
|
126
|
+
};
|
|
127
|
+
if (value === "right") return {
|
|
128
|
+
marginLeft: "auto",
|
|
129
|
+
marginRight: "0"
|
|
130
|
+
};
|
|
131
|
+
return {
|
|
132
|
+
marginLeft: "auto",
|
|
133
|
+
marginRight: "auto"
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Merges a record of computed layout styles with a user-supplied `style` prop.
|
|
138
|
+
* The user's styles take precedence for conflicting keys.
|
|
139
|
+
*/
|
|
140
|
+
function mergeLayoutStyles(layout, user) {
|
|
141
|
+
const merged = { ...layout };
|
|
142
|
+
if (user !== null && user !== void 0 && typeof user === "object") Object.assign(merged, user);
|
|
143
|
+
const mergedString = objectToCssString(merged);
|
|
144
|
+
if (typeof user === "string" && user.trim()) return mergedString ? `${mergedString};${user.trim()}` : user.trim();
|
|
145
|
+
return mergedString || void 0;
|
|
146
|
+
}
|
|
147
|
+
function camelToKebab(s) {
|
|
148
|
+
return s.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`);
|
|
149
|
+
}
|
|
150
|
+
function objectToCssString(styles) {
|
|
151
|
+
return Object.entries(styles).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${camelToKebab(key)}:${String(value)}`).join(";");
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { isCssLength, isResponsiveValue, mergeLayoutStyles, resolveAlignValue, resolveContainerSizeValue, resolveGridTrackValue, resolveInlineAlignValue, resolveJustifyValue, resolveSpaceValue, serializeResponsiveValueIf, serializeValueIf, setResponsiveStyleVar };
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","names":[],"sources":["../../src/components/_internal/layout.ts"],"sourcesContent":["/**\n * Layout helpers shared by headless layout primitives.\n */\n\nexport type LayoutBreakpoint = \"initial\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;\n\nconst BREAKPOINTS: readonly LayoutBreakpoint[] = [\"initial\", \"sm\", \"md\", \"lg\", \"xl\"];\n\n/** Units and patterns that identify a concrete CSS length value. */\nconst CSS_UNIT_RE =\n /^-?[\\d.]+(%|px|em|rem|ex|ch|ic|lh|rlh|vw|vh|vmin|vmax|svw|svh|dvw|dvh|cqw|cqh|cqi|cqb|fr|cm|mm|in|pt|pc|Q)$/;\n\nconst SPACE_TOKEN_MAP: Record<string, string> = {\n \"1\": \"var(--ak-space-1)\",\n \"2\": \"var(--ak-space-2)\",\n \"3\": \"var(--ak-space-3)\",\n \"4\": \"var(--ak-space-4)\",\n \"5\": \"var(--ak-space-5)\",\n \"6\": \"var(--ak-space-6)\",\n \"7\": \"var(--ak-space-7)\",\n \"8\": \"var(--ak-space-8)\",\n \"9\": \"var(--ak-space-9)\",\n xs: \"var(--ak-space-xs)\",\n sm: \"var(--ak-space-sm)\",\n md: \"var(--ak-space-md)\",\n lg: \"var(--ak-space-lg)\",\n xl: \"var(--ak-space-xl)\",\n \"2xl\": \"var(--ak-space-2xl)\",\n \"3xl\": \"var(--ak-space-3xl)\",\n};\n\nconst CONTAINER_SIZE_MAP: Record<string, string> = {\n \"1\": \"var(--ak-container-1)\",\n \"2\": \"var(--ak-container-2)\",\n \"3\": \"var(--ak-container-3)\",\n \"4\": \"var(--ak-container-4)\",\n sm: \"var(--ak-container-1)\",\n md: \"var(--ak-container-2)\",\n lg: \"var(--ak-container-3)\",\n xl: \"var(--ak-container-4)\",\n};\n\nconst SECTION_SIZE_MAP: Record<string, string> = {\n \"1\": \"var(--ak-section-1)\",\n \"2\": \"var(--ak-section-2)\",\n \"3\": \"var(--ak-section-3)\",\n \"4\": \"var(--ak-section-4)\",\n};\n\n/**\n * Returns true when `value` is a concrete CSS length/size that can be applied\n * directly as an inline style.\n */\nexport function isCssLength(value: unknown): value is string {\n if (typeof value !== \"string\") return false;\n const v = value.trim();\n if (v === \"0\") return true;\n if (CSS_UNIT_RE.test(v)) return true;\n // CSS functions: calc(), min(), max(), clamp(), fit-content(), env(), var()\n if (/^[a-z][a-z-]*\\(/.test(v)) return true;\n return false;\n}\n\nexport function isResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): value is Partial<Record<LayoutBreakpoint, T>> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n return BREAKPOINTS.some((breakpoint) => breakpoint in value);\n}\n\nexport function normalizeResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): Partial<Record<LayoutBreakpoint, T>> | undefined {\n if (value === undefined) return undefined;\n if (isResponsiveValue(value)) return value;\n return { initial: value };\n}\n\nexport function serializeResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): string | undefined {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return undefined;\n\n return BREAKPOINTS.map((breakpoint) => {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) return \"\";\n return `${breakpoint}:${String(breakpointValue)}`;\n })\n .filter(Boolean)\n .join(\"|\");\n}\n\nexport function serializeResponsiveValueIf<T>(\n value: ResponsiveValue<T> | undefined,\n predicate: (value: T) => boolean,\n): string | undefined {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return undefined;\n\n for (const breakpoint of BREAKPOINTS) {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) continue;\n if (!predicate(breakpointValue)) return undefined;\n }\n\n return serializeResponsiveValue(value);\n}\n\nexport function serializeValueIf<T>(\n value: T | undefined,\n predicate: (value: T) => boolean,\n): string | undefined {\n if (value === undefined || !predicate(value)) return undefined;\n return String(value);\n}\n\nexport function setResponsiveStyleVar<T>(\n styles: Record<string, string | number>,\n variable: string,\n value: ResponsiveValue<T> | undefined,\n resolve: (value: T) => string | number | undefined = (input) =>\n input as string | number | undefined,\n) {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return;\n\n for (const breakpoint of BREAKPOINTS) {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) continue;\n const resolved = resolve(breakpointValue);\n if (resolved === undefined || resolved === null || resolved === \"\") continue;\n styles[`--ak-${variable}-${breakpoint}`] = resolved;\n }\n}\n\nexport function resolveSpaceValue(value: string | number): string | number {\n if (typeof value === \"number\") return String(value);\n const trimmed = value.trim();\n return SPACE_TOKEN_MAP[trimmed] ?? trimmed;\n}\n\nexport function resolveContainerSizeValue(value: string): string {\n const trimmed = value.trim();\n return CONTAINER_SIZE_MAP[trimmed] ?? trimmed;\n}\n\nexport function resolveSectionSizeValue(value: string): string {\n const trimmed = value.trim();\n return SECTION_SIZE_MAP[trimmed] ?? trimmed;\n}\n\nexport function resolveGridTrackValue(value: string | number): string {\n if (typeof value === \"number\") {\n return `repeat(${value}, minmax(0, 1fr))`;\n }\n\n const trimmed = value.trim();\n if (/^\\d+$/.test(trimmed)) {\n return `repeat(${trimmed}, minmax(0, 1fr))`;\n }\n\n return trimmed;\n}\n\nexport function resolveJustifyValue(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"between\") return \"space-between\";\n if (trimmed === \"start\") return \"flex-start\";\n if (trimmed === \"end\") return \"flex-end\";\n return trimmed;\n}\n\nexport function resolveAlignValue(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"start\") return \"flex-start\";\n if (trimmed === \"end\") return \"flex-end\";\n return trimmed;\n}\n\nexport function resolveInlineAlignValue(value: \"left\" | \"center\" | \"right\"): {\n marginLeft?: string;\n marginRight?: string;\n} {\n if (value === \"left\") return { marginLeft: \"0\", marginRight: \"auto\" };\n if (value === \"right\") return { marginLeft: \"auto\", marginRight: \"0\" };\n return { marginLeft: \"auto\", marginRight: \"auto\" };\n}\n\n/**\n * Merges a record of computed layout styles with a user-supplied `style` prop.\n * The user's styles take precedence for conflicting keys.\n */\nexport function mergeLayoutStyles(\n layout: Record<string, string | number>,\n user: unknown,\n): string | undefined {\n const merged: Record<string, unknown> = { ...layout };\n\n if (user !== null && user !== undefined && typeof user === \"object\") {\n Object.assign(merged, user as Record<string, unknown>);\n }\n\n const mergedString = objectToCssString(merged);\n\n if (typeof user === \"string\" && user.trim()) {\n return mergedString ? `${mergedString};${user.trim()}` : user.trim();\n }\n\n return mergedString || undefined;\n}\n\nfunction camelToKebab(s: string): string {\n return s.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`);\n}\n\nfunction objectToCssString(styles: Record<string, unknown>): string {\n return Object.entries(styles)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${camelToKebab(key)}:${String(value)}`)\n .join(\";\");\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/components/_internal/merge-props.ts
|
|
2
|
+
function isEventHandlerKey(key) {
|
|
3
|
+
return key.startsWith("on");
|
|
4
|
+
}
|
|
5
|
+
function isDefaultPrevented(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && "defaultPrevented" in value && value.defaultPrevented === true;
|
|
7
|
+
}
|
|
8
|
+
function composeHandlers(first, second) {
|
|
9
|
+
return (...args) => {
|
|
10
|
+
first(...args);
|
|
11
|
+
if (isDefaultPrevented(args[0])) return;
|
|
12
|
+
second(...args);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function setRef(ref, value) {
|
|
16
|
+
if (!ref) return;
|
|
17
|
+
if (typeof ref === "function") {
|
|
18
|
+
ref(value);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (Object.isExtensible(ref)) ref.current = value;
|
|
22
|
+
}
|
|
23
|
+
function composeRefs(...refs) {
|
|
24
|
+
return (value) => {
|
|
25
|
+
for (const ref of refs) setRef(ref, value);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function mergeProps(base, injected) {
|
|
29
|
+
const baseKeys = Object.keys(base);
|
|
30
|
+
if (baseKeys.length === 0) return injected;
|
|
31
|
+
const out = { ...injected };
|
|
32
|
+
for (const key of baseKeys) {
|
|
33
|
+
const baseValue = base[key];
|
|
34
|
+
const injectedValue = injected[key];
|
|
35
|
+
if (key === "ref") {
|
|
36
|
+
out[key] = composeRefs(injectedValue, baseValue);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (isEventHandlerKey(key) && typeof baseValue === "function" && typeof injectedValue === "function") {
|
|
40
|
+
out[key] = composeHandlers(injectedValue, baseValue);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
out[key] = baseValue;
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { mergeProps };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=merge-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-props.js","names":[],"sources":["../../src/components/_internal/merge-props.ts"],"sourcesContent":["type Handler = (...args: readonly unknown[]) => void;\ntype Ref<T> = { current: T | null } | ((value: T | null) => void) | null | undefined;\n\nfunction isEventHandlerKey(key: string): boolean {\n return key.startsWith(\"on\");\n}\n\nfunction isDefaultPrevented(value: unknown): value is { defaultPrevented: true } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"defaultPrevented\" in value &&\n (value as { defaultPrevented?: boolean }).defaultPrevented === true\n );\n}\n\nfunction composeHandlers(first: Handler, second: Handler): Handler {\n return (...args) => {\n first(...args);\n\n if (isDefaultPrevented(args[0])) {\n return;\n }\n\n second(...args);\n };\n}\n\nfunction setRef<T>(ref: Ref<T>, value: T | null): void {\n if (!ref) return;\n\n if (typeof ref === \"function\") {\n ref(value);\n return;\n }\n\n if (Object.isExtensible(ref)) {\n (ref as { current: T | null }).current = value;\n }\n}\n\nfunction composeRefs<T>(...refs: Array<Ref<T>>): (value: T | null) => void {\n return (value: T | null) => {\n for (const ref of refs) {\n setRef(ref, value);\n }\n };\n}\n\nexport function mergeProps<TBase extends object, TInjected extends object>(\n base: TBase,\n injected: TInjected,\n): TInjected & TBase {\n const baseKeys = Object.keys(base);\n if (baseKeys.length === 0) {\n return injected as TInjected & TBase;\n }\n\n const out = { ...(injected as object) } as TInjected & TBase;\n\n for (const key of baseKeys as Array<Extract<keyof TBase, string>>) {\n const baseValue = (base as Record<string, unknown>)[key];\n const injectedValue = (injected as Record<string, unknown>)[key];\n\n if (key === \"ref\") {\n (out as Record<string, unknown>)[key] = composeRefs(\n injectedValue as Ref<unknown>,\n baseValue as Ref<unknown>,\n );\n continue;\n }\n\n if (\n isEventHandlerKey(key) &&\n typeof baseValue === \"function\" &&\n typeof injectedValue === \"function\"\n ) {\n (out as Record<string, unknown>)[key] = composeHandlers(\n injectedValue as Handler,\n baseValue as Handler,\n );\n continue;\n }\n\n (out as Record<string, unknown>)[key] = baseValue;\n }\n\n return out;\n}\n"],"mappings":";AAGA,SAAS,kBAAkB,KAAsB;AAC/C,QAAO,IAAI,WAAW,KAAK;;AAG7B,SAAS,mBAAmB,OAAqD;AAC/E,QACE,OAAO,UAAU,YACjB,UAAU,QACV,sBAAsB,SACrB,MAAyC,qBAAqB;;AAInE,SAAS,gBAAgB,OAAgB,QAA0B;AACjE,SAAQ,GAAG,SAAS;AAClB,QAAM,GAAG,KAAK;AAEd,MAAI,mBAAmB,KAAK,GAAG,CAC7B;AAGF,SAAO,GAAG,KAAK;;;AAInB,SAAS,OAAU,KAAa,OAAuB;AACrD,KAAI,CAAC,IAAK;AAEV,KAAI,OAAO,QAAQ,YAAY;AAC7B,MAAI,MAAM;AACV;;AAGF,KAAI,OAAO,aAAa,IAAI,CACzB,KAA8B,UAAU;;AAI7C,SAAS,YAAe,GAAG,MAAgD;AACzE,SAAQ,UAAoB;AAC1B,OAAK,MAAM,OAAO,KAChB,QAAO,KAAK,MAAM;;;AAKxB,SAAgB,WACd,MACA,UACmB;CACnB,MAAM,WAAW,OAAO,KAAK,KAAK;AAClC,KAAI,SAAS,WAAW,EACtB,QAAO;CAGT,MAAM,MAAM,EAAE,GAAI,UAAqB;AAEvC,MAAK,MAAM,OAAO,UAAiD;EACjE,MAAM,YAAa,KAAiC;EACpD,MAAM,gBAAiB,SAAqC;AAE5D,MAAI,QAAQ,OAAO;AAChB,OAAgC,OAAO,YACtC,eACA,UACD;AACD;;AAGF,MACE,kBAAkB,IAAI,IACtB,OAAO,cAAc,cACrB,OAAO,kBAAkB,YACzB;AACC,OAAgC,OAAO,gBACtC,eACA,UACD;AACD;;AAGD,MAAgC,OAAO;;AAG1C,QAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AccessibleIconProps } from "./accessible-icon.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/accessible-icon/accessible-icon.d.ts
|
|
4
|
+
declare function AccessibleIcon(props: AccessibleIconProps): JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { AccessibleIcon };
|
|
7
|
+
//# sourceMappingURL=accessible-icon.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@askrjs/askr/jsx-runtime";
|
|
2
|
+
//#region src/components/accessible-icon/accessible-icon.tsx
|
|
3
|
+
function AccessibleIcon(props) {
|
|
4
|
+
const { children, label, decorative = label ? false : true } = props;
|
|
5
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
6
|
+
"data-slot": "accessible-icon",
|
|
7
|
+
"data-decorative": decorative ? "true" : void 0,
|
|
8
|
+
role: decorative ? void 0 : "img",
|
|
9
|
+
"aria-hidden": decorative ? "true" : void 0,
|
|
10
|
+
"aria-label": decorative ? void 0 : label,
|
|
11
|
+
children: [children, !decorative && label ? /* @__PURE__ */ jsx("span", {
|
|
12
|
+
class: "sr-only",
|
|
13
|
+
children: label
|
|
14
|
+
}) : null]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { AccessibleIcon };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=accessible-icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessible-icon.js","names":[],"sources":["../../src/components/accessible-icon/accessible-icon.tsx"],"sourcesContent":["import type { AccessibleIconProps } from \"./accessible-icon.types\";\n\nexport function AccessibleIcon(props: AccessibleIconProps): JSX.Element {\n const { children, label, decorative = label ? false : true } = props;\n\n return (\n <span\n data-slot=\"accessible-icon\"\n data-decorative={decorative ? \"true\" : undefined}\n role={decorative ? undefined : \"img\"}\n aria-hidden={decorative ? \"true\" : undefined}\n aria-label={decorative ? undefined : label}\n >\n {children}\n {!decorative && label ? <span class=\"sr-only\">{label}</span> : null}\n </span>\n );\n}\n"],"mappings":";;AAEA,SAAgB,eAAe,OAAyC;CACtE,MAAM,EAAE,UAAU,OAAO,aAAa,QAAQ,QAAQ,SAAS;AAE/D,QACE,qBAAC,QAAD;EACE,aAAU;EACV,mBAAiB,aAAa,SAAS,KAAA;EACvC,MAAM,aAAa,KAAA,IAAY;EAC/B,eAAa,aAAa,SAAS,KAAA;EACnC,cAAY,aAAa,KAAA,IAAY;YALvC,CAOG,UACA,CAAC,cAAc,QAAQ,oBAAC,QAAD;GAAM,OAAM;aAAW;GAAa,CAAA,GAAG,KAC1D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/accessible-icon/accessible-icon.types.d.ts
|
|
2
|
+
type AccessibleIconProps = {
|
|
3
|
+
children?: unknown;
|
|
4
|
+
label?: string;
|
|
5
|
+
decorative?: boolean;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AccessibleIconProps };
|
|
9
|
+
//# sourceMappingURL=accessible-icon.types.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Props } from "./props.js";
|
|
2
|
+
|
|
3
|
+
//#region ../askr/dist/common/jsx.d.ts
|
|
4
|
+
interface JSXElement {
|
|
5
|
+
/** Internal element marker */
|
|
6
|
+
$$typeof: symbol;
|
|
7
|
+
/** Element type: string, component, Fragment, etc */
|
|
8
|
+
type: string | ((props: Props) => unknown) | symbol;
|
|
9
|
+
/** Props bag */
|
|
10
|
+
props: Props;
|
|
11
|
+
/** Optional key (normalized by runtime) */
|
|
12
|
+
key?: string | number | null;
|
|
13
|
+
} //#endregion
|
|
14
|
+
//#endregion
|
|
15
|
+
export { JSXElement };
|
|
16
|
+
//# sourceMappingURL=jsx.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region ../askr/dist/common/props.d.ts
|
|
2
|
+
//#region src/common/props.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Common call contracts: Props
|
|
5
|
+
*
|
|
6
|
+
* This file holds structural types shared across multiple modules.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Props accepted by components and elements.
|
|
10
|
+
* Intentionally permissive but provides a single named type.
|
|
11
|
+
*/
|
|
12
|
+
interface Props {
|
|
13
|
+
/** Optional key for keyed lists (string | number | symbol for internal frames) */
|
|
14
|
+
key?: string | number | symbol;
|
|
15
|
+
/** Optional children slot */
|
|
16
|
+
children?: unknown;
|
|
17
|
+
/** Allow additional arbitrary attributes (e.g., class, id, data-*) */
|
|
18
|
+
[attr: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Props };
|
|
22
|
+
//# sourceMappingURL=props.d.ts.map
|