@hoardodile/ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/README.md +70 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +97 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/app-dialog.d.ts +62 -0
- package/dist/components/app-dialog.js +656 -0
- package/dist/components/app-dialog.js.map +1 -0
- package/dist/components/badge.d.ts +11 -0
- package/dist/components/badge.js +70 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +617 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +78 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/caption-bar.d.ts +44 -0
- package/dist/components/caption-bar.js +827 -0
- package/dist/components/caption-bar.js.map +1 -0
- package/dist/components/chart-card.d.ts +15 -0
- package/dist/components/chart-card.js +27 -0
- package/dist/components/chart-card.js.map +1 -0
- package/dist/components/checkbox.d.ts +6 -0
- package/dist/components/checkbox.js +76 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip-button.d.ts +28 -0
- package/dist/components/chip-button.js +87 -0
- package/dist/components/chip-button.js.map +1 -0
- package/dist/components/close-confirm-dialog.d.ts +19 -0
- package/dist/components/close-confirm-dialog.js +743 -0
- package/dist/components/close-confirm-dialog.js.map +1 -0
- package/dist/components/color-picker.d.ts +32 -0
- package/dist/components/color-picker.js +667 -0
- package/dist/components/color-picker.js.map +1 -0
- package/dist/components/combobox.d.ts +32 -0
- package/dist/components/combobox.js +1211 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/confirm-by-typing-dialog.d.ts +48 -0
- package/dist/components/confirm-by-typing-dialog.js +759 -0
- package/dist/components/confirm-by-typing-dialog.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +34 -0
- package/dist/components/confirm-dialog.js +710 -0
- package/dist/components/confirm-dialog.js.map +1 -0
- package/dist/components/count-badge.d.ts +13 -0
- package/dist/components/count-badge.js +39 -0
- package/dist/components/count-badge.js.map +1 -0
- package/dist/components/dialog.d.ts +40 -0
- package/dist/components/dialog.js +571 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +45 -0
- package/dist/components/dropdown-menu.js +1003 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/dropdown-select.d.ts +29 -0
- package/dist/components/dropdown-select.js +1036 -0
- package/dist/components/dropdown-select.js.map +1 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +119 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/filter-rail.d.ts +48 -0
- package/dist/components/filter-rail.js +231 -0
- package/dist/components/filter-rail.js.map +1 -0
- package/dist/components/fixed-action-bar.d.ts +24 -0
- package/dist/components/fixed-action-bar.js +48 -0
- package/dist/components/fixed-action-bar.js.map +1 -0
- package/dist/components/font-picker.d.ts +45 -0
- package/dist/components/font-picker.js +759 -0
- package/dist/components/font-picker.js.map +1 -0
- package/dist/components/form.d.ts +17 -0
- package/dist/components/form.js +150 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/group-label.d.ts +12 -0
- package/dist/components/group-label.js +10 -0
- package/dist/components/group-label.js.map +1 -0
- package/dist/components/icon-tile.d.ts +16 -0
- package/dist/components/icon-tile.js +67 -0
- package/dist/components/icon-tile.js.map +1 -0
- package/dist/components/icon-toggle.d.ts +24 -0
- package/dist/components/icon-toggle.js +81 -0
- package/dist/components/icon-toggle.js.map +1 -0
- package/dist/components/icon.d.ts +2 -0
- package/dist/components/icon.js +49 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/image-crop-panel.d.ts +80 -0
- package/dist/components/image-crop-panel.js +1104 -0
- package/dist/components/image-crop-panel.js.map +1 -0
- package/dist/components/image-cropper.d.ts +63 -0
- package/dist/components/image-cropper.js +166 -0
- package/dist/components/image-cropper.js.map +1 -0
- package/dist/components/input-group.d.ts +22 -0
- package/dist/components/input-group.js +270 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +60 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +5 -0
- package/dist/components/label.js +40 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/list-empty-row.d.ts +16 -0
- package/dist/components/list-empty-row.js +40 -0
- package/dist/components/list-empty-row.js.map +1 -0
- package/dist/components/management-empty.d.ts +14 -0
- package/dist/components/management-empty.js +40 -0
- package/dist/components/management-empty.js.map +1 -0
- package/dist/components/management-skeleton.d.ts +11 -0
- package/dist/components/management-skeleton.js +72 -0
- package/dist/components/management-skeleton.js.map +1 -0
- package/dist/components/meta-chip.d.ts +17 -0
- package/dist/components/meta-chip.js +49 -0
- package/dist/components/meta-chip.js.map +1 -0
- package/dist/components/mobile-drawer.d.ts +29 -0
- package/dist/components/mobile-drawer.js +331 -0
- package/dist/components/mobile-drawer.js.map +1 -0
- package/dist/components/page-header.d.ts +20 -0
- package/dist/components/page-header.js +44 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/page-scaffold.d.ts +34 -0
- package/dist/components/page-scaffold.js +157 -0
- package/dist/components/page-scaffold.js.map +1 -0
- package/dist/components/pagination-bar.d.ts +22 -0
- package/dist/components/pagination-bar.js +703 -0
- package/dist/components/pagination-bar.js.map +1 -0
- package/dist/components/pagination.d.ts +22 -0
- package/dist/components/pagination.js +680 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/panel-toolbar.d.ts +37 -0
- package/dist/components/panel-toolbar.js +781 -0
- package/dist/components/panel-toolbar.js.map +1 -0
- package/dist/components/pill-tabs.d.ts +33 -0
- package/dist/components/pill-tabs.js +66 -0
- package/dist/components/pill-tabs.js.map +1 -0
- package/dist/components/plugin-download-consent.d.ts +52 -0
- package/dist/components/plugin-download-consent.js +780 -0
- package/dist/components/plugin-download-consent.js.map +1 -0
- package/dist/components/popover.d.ts +26 -0
- package/dist/components/popover.js +343 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +103 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/query-state-view.d.ts +36 -0
- package/dist/components/query-state-view.js +17 -0
- package/dist/components/query-state-view.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.js +60 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/scroll-area.d.ts +7 -0
- package/dist/components/scroll-area.js +80 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/search-field.d.ts +49 -0
- package/dist/components/search-field.js +586 -0
- package/dist/components/search-field.js.map +1 -0
- package/dist/components/secondary-stat.d.ts +13 -0
- package/dist/components/secondary-stat.js +56 -0
- package/dist/components/secondary-stat.js.map +1 -0
- package/dist/components/section-header.d.ts +23 -0
- package/dist/components/section-header.js +76 -0
- package/dist/components/section-header.js.map +1 -0
- package/dist/components/section-label.d.ts +20 -0
- package/dist/components/section-label.js +46 -0
- package/dist/components/section-label.js.map +1 -0
- package/dist/components/section-tabs.d.ts +47 -0
- package/dist/components/section-tabs.js +145 -0
- package/dist/components/section-tabs.js.map +1 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +49 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +22 -0
- package/dist/components/sheet.js +469 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.js +1645 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +8 -0
- package/dist/components/skeleton.js +41 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +6 -0
- package/dist/components/slider.js +75 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sortable-chip-list.d.ts +26 -0
- package/dist/components/sortable-chip-list.js +59 -0
- package/dist/components/sortable-chip-list.js.map +1 -0
- package/dist/components/spinner.d.ts +5 -0
- package/dist/components/spinner.js +65 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/surface.d.ts +13 -0
- package/dist/components/surface.js +51 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +53 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +129 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/textarea.d.ts +15 -0
- package/dist/components/textarea.js +58 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toast.d.ts +19 -0
- package/dist/components/toast.js +805 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toggle.d.ts +12 -0
- package/dist/components/toggle.js +63 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +9 -0
- package/dist/components/tooltip.js +82 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/hooks/use-dialog-footer-actions.d.ts +18 -0
- package/dist/hooks/use-dialog-footer-actions.js +11 -0
- package/dist/hooks/use-dialog-footer-actions.js.map +1 -0
- package/dist/hooks/use-form-field.d.ts +33 -0
- package/dist/hooks/use-form-field.js +36 -0
- package/dist/hooks/use-form-field.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +34 -0
- package/dist/hooks/use-mobile.js +29 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-pinch-pan.d.ts +56 -0
- package/dist/hooks/use-pinch-pan.js +223 -0
- package/dist/hooks/use-pinch-pan.js.map +1 -0
- package/dist/hooks/useMobileBackToClose.d.ts +61 -0
- package/dist/hooks/useMobileBackToClose.js +234 -0
- package/dist/hooks/useMobileBackToClose.js.map +1 -0
- package/dist/icon-BOgL5bpL.d.ts +85 -0
- package/dist/icons/actions.d.ts +4 -0
- package/dist/icons/actions.js +520 -0
- package/dist/icons/actions.js.map +1 -0
- package/dist/icons/icon-style.d.ts +2 -0
- package/dist/icons/icon-style.js +51 -0
- package/dist/icons/icon-style.js.map +1 -0
- package/dist/icons/marks.d.ts +15 -0
- package/dist/icons/marks.js +48 -0
- package/dist/icons/marks.js.map +1 -0
- package/dist/icons/registry.d.ts +177 -0
- package/dist/icons/registry.js +1180 -0
- package/dist/icons/registry.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +653 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/merge-config.d.ts +15 -0
- package/dist/lib/merge-config.js +20 -0
- package/dist/lib/merge-config.js.map +1 -0
- package/dist/lib/pagination.d.ts +19 -0
- package/dist/lib/pagination.js +26 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +26 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles/theme.css +480 -0
- package/dist/styles/theme.css.map +1 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/viewport.d.ts +64 -0
- package/dist/viewport.js +13 -0
- package/dist/viewport.js.map +1 -0
- package/package.json +122 -0
- package/src/components/alert.tsx +76 -0
- package/src/components/app-dialog.tsx +187 -0
- package/src/components/badge.tsx +52 -0
- package/src/components/breadcrumb.tsx +129 -0
- package/src/components/button.tsx +70 -0
- package/src/components/caption-bar.test.tsx +151 -0
- package/src/components/caption-bar.tsx +392 -0
- package/src/components/chart-card.tsx +31 -0
- package/src/components/checkbox.tsx +28 -0
- package/src/components/chip-button.tsx +69 -0
- package/src/components/close-confirm-dialog.tsx +99 -0
- package/src/components/color-picker.tsx +186 -0
- package/src/components/combobox.tsx +335 -0
- package/src/components/confirm-by-typing-dialog.tsx +130 -0
- package/src/components/confirm-dialog.test.tsx +39 -0
- package/src/components/confirm-dialog.tsx +98 -0
- package/src/components/count-badge.tsx +23 -0
- package/src/components/dialog.tsx +315 -0
- package/src/components/dropdown-menu.tsx +311 -0
- package/src/components/dropdown-select.tsx +211 -0
- package/src/components/empty.tsx +104 -0
- package/src/components/filter-rail.tsx +139 -0
- package/src/components/fixed-action-bar.tsx +46 -0
- package/src/components/font-picker.tsx +257 -0
- package/src/components/form.tsx +127 -0
- package/src/components/group-label.tsx +13 -0
- package/src/components/icon-tile.tsx +35 -0
- package/src/components/icon-toggle.tsx +57 -0
- package/src/components/icon.tsx +66 -0
- package/src/components/image-crop-panel.test.tsx +167 -0
- package/src/components/image-crop-panel.tsx +465 -0
- package/src/components/image-cropper.test.tsx +144 -0
- package/src/components/image-cropper.tsx +265 -0
- package/src/components/input-group.tsx +156 -0
- package/src/components/input.tsx +45 -0
- package/src/components/label.tsx +20 -0
- package/src/components/list-empty-row.tsx +27 -0
- package/src/components/management-empty.tsx +25 -0
- package/src/components/management-skeleton.tsx +23 -0
- package/src/components/meta-chip.tsx +40 -0
- package/src/components/mobile-drawer.test.tsx +52 -0
- package/src/components/mobile-drawer.tsx +98 -0
- package/src/components/page-header.tsx +47 -0
- package/src/components/page-scaffold.test.tsx +24 -0
- package/src/components/page-scaffold.tsx +131 -0
- package/src/components/pagination-bar.test.tsx +87 -0
- package/src/components/pagination-bar.tsx +139 -0
- package/src/components/pagination.tsx +139 -0
- package/src/components/panel-toolbar.tsx +99 -0
- package/src/components/pill-tabs.test.tsx +84 -0
- package/src/components/pill-tabs.tsx +77 -0
- package/src/components/plugin-download-consent.test.tsx +90 -0
- package/src/components/plugin-download-consent.tsx +183 -0
- package/src/components/popover.tsx +133 -0
- package/src/components/progress.tsx +88 -0
- package/src/components/query-state-view.tsx +47 -0
- package/src/components/radio-group.tsx +36 -0
- package/src/components/scroll-area.tsx +52 -0
- package/src/components/search-field.test.tsx +86 -0
- package/src/components/search-field.tsx +119 -0
- package/src/components/secondary-stat.tsx +24 -0
- package/src/components/section-header.tsx +54 -0
- package/src/components/section-label.tsx +40 -0
- package/src/components/section-tabs.test.tsx +154 -0
- package/src/components/section-tabs.tsx +190 -0
- package/src/components/separator.tsx +38 -0
- package/src/components/sheet.tsx +170 -0
- package/src/components/sidebar.tsx +725 -0
- package/src/components/skeleton.tsx +18 -0
- package/src/components/slider.tsx +52 -0
- package/src/components/sortable-chip-list.tsx +56 -0
- package/src/components/spinner.tsx +35 -0
- package/src/components/surface.tsx +37 -0
- package/src/components/switch.tsx +30 -0
- package/src/components/table.tsx +116 -0
- package/src/components/textarea.tsx +41 -0
- package/src/components/toast.tsx +239 -0
- package/src/components/toggle.tsx +45 -0
- package/src/components/tooltip.tsx +64 -0
- package/src/hooks/use-dialog-footer-actions.ts +23 -0
- package/src/hooks/use-form-field.ts +62 -0
- package/src/hooks/use-mobile.ts +54 -0
- package/src/hooks/use-pinch-pan.test.tsx +42 -0
- package/src/hooks/use-pinch-pan.ts +340 -0
- package/src/hooks/useMobileBackToClose.test.tsx +140 -0
- package/src/hooks/useMobileBackToClose.ts +508 -0
- package/src/icons/actions.ts +10 -0
- package/src/icons/icon-style.test.tsx +69 -0
- package/src/icons/icon-style.ts +104 -0
- package/src/icons/marks.tsx +72 -0
- package/src/icons/registry.test.ts +65 -0
- package/src/icons/registry.ts +1163 -0
- package/src/index.ts +22 -0
- package/src/lib/merge-config.test.ts +109 -0
- package/src/lib/merge-config.ts +22 -0
- package/src/lib/pagination.test.ts +55 -0
- package/src/lib/pagination.ts +42 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/scan-contract.test.ts +74 -0
- package/src/styles/theme.css +798 -0
- package/src/test/i18n.tsx +22 -0
- package/src/test/setup.ts +104 -0
- package/src/viewport.ts +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/viewport.ts","../../src/hooks/use-mobile.ts","../../src/hooks/useMobileBackToClose.ts"],"names":[],"mappings":";;;;AAeO,IAAM,oBAAA,GAAuB,GAAA;AAgB7B,IAAM,YAAA,GAAe,CAAA,YAAA,EAAe,oBAAA,GAAuB,CAAC,CAAA,GAAA,CAAA;ACjB5D,SAAS,SAAA,GAAqB;AACpC,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,EAAA,OAAO,MA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AAQ,QAAA,KAAa,EAAA,GAAK,YAAA,CAAa,QAAQ,CAAA,GAAI,MAAA;AACzD,MAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAY,GAAI,gBAAgB,EAAE,CAAA;AACnD,MAAA,IAAI,OAAA,IAAW,UAAU,MAAA,EAAW;AACnC,QAAA,oBAAA,CAAqB,EAAA,EAAI,KAAA,CAAM,SAAA,EAAW,WAAW,CAAA;AAAA,MACtD;AAAA,IACD;AAAA,EACD,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA;AAET,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,OAAO,MAAM;AACZ,MAAA,IAAI,KAAA,CAAM,YAAY,MAAA,EAAW;AAChC,QAAA,MAAM,KAAK,KAAA,CAAM,OAAA;AACjB,QAAA,KAAA,CAAM,OAAA,GAAU,MAAA;AAChB,QAAA,MAAM,WAAW,YAAA,CAAa,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,EAAE,CAAA;AAC1D,QAAA,MAAM,KAAA,GAAQ,QAAA,KAAa,EAAA,GAAK,YAAA,CAAa,QAAQ,CAAA,GAAI,MAAA;AACzD,QAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAY,GAAI,gBAAgB,EAAE,CAAA;AACnD,QAAA,IAAI,OAAA,IAAW,UAAU,MAAA,EAAW;AACnC,UAAA,oBAAA,CAAqB,EAAA,EAAI,KAAA,CAAM,SAAA,EAAW,WAAW,CAAA;AAAA,QACtD;AAAA,MACD;AAAA,IACD,CAAA;AAAA,EACD,CAAA,EAAG,EAAE,CAAA;AACN","file":"useMobileBackToClose.js","sourcesContent":["/**\n * Mobile viewport initial-scale factor used across the app shell and\n * plugin iframe previews. Kept in one place so it can be changed\n * without hunting through HTML templates and CSS rules.\n */\nexport const MOBILE_INITIAL_SCALE = 0.8\n\n/**\n * Width in pixels at which the app switches from below-md to md+ layouts.\n *\n * This value is intentionally aligned with Tailwind's `md` breakpoint\n * (768 px) so that JS detection and CSS responsive prefixes stay in sync.\n * Components that need to know whether they are in the \"below md\" viewport\n * should use {@link isBelowMd} or {@link useBelowMd} from @hoardodile/ui/hooks/use-mobile.\n */\nexport const MOBILE_BREAKPOINT_PX = 768\n\n/**\n * Same breakpoint expressed in rems, matching Tailwind's default theme\n * (`--breakpoint-md: 48rem`). Useful for CSS media queries and comments.\n */\nexport const MOBILE_BREAKPOINT_REM = MOBILE_BREAKPOINT_PX / 16\n\n/**\n * Media query string that matches viewports below the `md` breakpoint\n * (< 768 px). Shared between JS hooks and anywhere else that needs to detect\n * a below-md viewport.\n *\n * Keep this in sync with the CSS/Tailwind breakpoint so JS and CSS never\n * disagree about the viewport size.\n */\nexport const MOBILE_QUERY = `(max-width: ${MOBILE_BREAKPOINT_PX - 1}px)`\n\n/**\n * Width in pixels at which the app switches from a drawer to a fixed left\n * sidebar (the \"app shell\"). Raised above `md` so mid-size viewports keep\n * the whole width for their content column — below this the sidebar hides\n * behind the hamburger drawer.\n *\n * Use the CSS `sidebar:` / `max-sidebar:` variants (`--breakpoint-sidebar`)\n * at call sites — this value is the single source of truth for both.\n */\nexport const SIDEBAR_BREAKPOINT_PX = 1150\n\n/**\n * Media query string that matches viewports below the sidebar breakpoint\n * (`max-sidebar`), i.e. where the shell shows the drawer instead of the fixed\n * sidebar. Shared between JS hooks and anywhere else that needs the\n * below-sidebar viewport.\n */\nexport const SIDEBAR_QUERY = `(max-width: ${SIDEBAR_BREAKPOINT_PX - 1}px)`\n\n/**\n * Width in pixels at which the right filter rail switches from a fixed\n * column to a drawer (DESIGN.md — Layout: \"the panel becomes an\n * overlay below 1440px\"). Below this the sidebar + panel + content no\n * longer fit comfortably, so the rail hides behind a Filters button.\n *\n * Use the CSS `panel:` / `max-panel:` variants (`--breakpoint-panel`)\n * at call sites — this value is the single source of truth for both.\n */\nexport const PANEL_BREAKPOINT_PX = 1440\n\n/**\n * Media query string that matches viewports below the panel breakpoint\n * (< 1440 px), i.e. where the filter rail lives in a drawer. Shared\n * between JS hooks and anywhere else that needs the below-panel viewport.\n */\nexport const PANEL_QUERY = `(max-width: ${PANEL_BREAKPOINT_PX - 1}px)`\n","import {\n\tMOBILE_QUERY,\n\tPANEL_QUERY,\n\tSIDEBAR_QUERY,\n} from \"@hoardodile/ui/viewport\"\nimport { useMedia } from \"react-use\"\n\n/**\n * One-shot check for viewports below the `md` breakpoint (< 768 px).\n *\n * Prefer {@link useBelowMd} in React components so they re-render when the\n * viewport crosses the breakpoint. Use this helper only in event handlers,\n * utility functions, or effects where a reactive hook is not appropriate.\n */\nexport function isBelowMd(): boolean {\n\tif (typeof window === \"undefined\") return false\n\treturn window.matchMedia(MOBILE_QUERY).matches\n}\n\nexport function useBelowMd(): boolean {\n\treturn useMedia(MOBILE_QUERY, false)\n}\n\n/**\n * Reactive check for viewports below the app-shell sidebar breakpoint\n * (`max-sidebar`), where the fixed sidebar is replaced by the hamburger\n * drawer. Keep in sync with `SIDEBAR_BREAKPOINT_PX` and the\n * `sidebar:` / `max-sidebar:` CSS variants. The shell alone decides its own chrome;\n * compact-UI consumers keep using {@link useBelowMd}.\n */\nexport function useBelowSidebar(): boolean {\n\treturn useMedia(SIDEBAR_QUERY, false)\n}\n\n/**\n * Reactive check for viewports below the filter-rail breakpoint\n * (< 1440 px), where the rail becomes a drawer instead of a fixed right\n * column. Keep in sync with `PANEL_BREAKPOINT_PX` and the\n * `panel:` / `max-panel:` CSS variants.\n */\nexport function useBelowPanel(): boolean {\n\treturn useMedia(PANEL_QUERY, false)\n}\n\n/**\n * Compatibility alias for official shadcn-generated components (e.g.\n * `sidebar.tsx`), which import `useIsMobile` from this module. Mobile\n * detection rules are owned by THIS file for the whole repo (apps and\n * plugins alike) — never let the registry version of `use-mobile.ts`\n * replace it; restore after every `shadcn add`.\n */\nexport function useIsMobile(): boolean {\n\treturn useBelowMd()\n}\n","import { isBelowMd } from \"@hoardodile/ui/hooks/use-mobile\"\nimport { useEffect, useRef } from \"react\"\n\nconst HISTORY_KEY = \"__appMobileOverlay\"\n\n/**\n * LIFO stack of currently-open overlays registered via\n * {@link useMobileBackToClose}. Each entry knows how to close its own\n * overlay. The browser back gesture only closes the top entry, so\n * stacking dialogs/popovers/sheets unwind in reverse opening order\n * instead of all collapsing on the first back press.\n *\n * State is module-level so multiple component instances share a\n * single popstate listener and a single ordering source of truth.\n */\ntype OverlayEntry = {\n\treadonly id: number\n\t/** Original history state captured at push time for later restore. */\n\treadonly baseState: unknown\n\tclose: (() => void) | undefined\n}\n\nconst overlayStack: OverlayEntry[] = []\nlet popListenerInstalled = false\nlet historyPatched = false\nlet nextOverlayId = 0\n// Counts consecutive popstate events to suppress. When we call\n// `history.back()` N times (e.g. to unwind an active entry plus\n// parked entries), the next N popstate events must be swallowed so\n// they don't cascade-close deeper overlays.\nlet suppressPopCount = 0\n/**\n * Tracks every synthetic entry ID ever pushed. Used by the\n * capture-phase popstate listener to identify \"phantom\" entries —\n * synthetic history slots that remain in forward/back history after\n * the overlay was closed via route navigation. The listener auto-skips\n * these to prevent dead back-presses and router confusion.\n */\nconst seenSyntheticIds = new Set<number>()\n\n/**\n * Optional navigation-resolver registration injected by the host app.\n *\n * When set (via {@link setNavigationResolver}), `scheduleStateRestore`\n * uses it to receive a deterministic \"navigation complete\" signal from\n * the router instead of guessing timing via `requestAnimationFrame`.\n *\n * The registered function accepts a one-shot callback and returns an\n * unsubscribe function. The hook calls it, inspects `history.state`\n * inside the callback, then unsubscribes.\n */\ntype NavigationResolver = (onResolved: () => void) => () => void\nlet navigationResolver: NavigationResolver | undefined\n\n/**\n * Registers a navigation-resolver factory so that\n * {@link useMobileBackToClose} can wait for the router to finish\n * flushing its history mutations before inspecting `history.state`.\n *\n * Call this once at app startup, after the router is created:\n *\n * ```ts\n * import { setNavigationResolver } from \"@hoardodile/ui\"\n * import { router } from \"./router\"\n *\n * setNavigationResolver((fn) => router.subscribe(\"onResolved\", fn))\n * ```\n *\n * When no resolver is registered, the hook falls back to\n * `requestAnimationFrame` (correct for microtask-based routers but\n * less deterministic).\n */\nexport function setNavigationResolver(resolver: NavigationResolver): void {\n\tnavigationResolver = resolver\n}\n\n/**\n * Patches `history.pushState` once (idempotent) so that every call\n * from a router (or any other non-overlay code) is intercepted.\n *\n * When a pushState is detected that does NOT carry our\n * {@link HISTORY_KEY} marker, all open overlay entries are closed\n * and the stack is cleared. The synthetic entry's marker is\n * intentionally NOT stripped — the capture-phase popstate listener\n * uses it to identify and auto-skip the stranded entry when the\n * user later navigates past it.\n */\nfunction patchHistory(): void {\n\tif (historyPatched) return\n\tif (typeof window === \"undefined\") return\n\thistoryPatched = true\n\tconst origPush = window.history.pushState.bind(window.history)\n\twindow.history.pushState = (\n\t\tdata: unknown,\n\t\tunused: string,\n\t\turl?: string | URL | null,\n\t): void => {\n\t\tconst state = data as Record<string, unknown> | null\n\t\tif (state !== null && typeof state === \"object\" && HISTORY_KEY in state) {\n\t\t\t// Our own synthetic push — pass through.\n\t\t\torigPush(data, unused, url)\n\t\t\treturn\n\t\t}\n\t\t// Real navigation — close all overlays so the stack is\n\t\t// cleared synchronously (before React's async effects).\n\t\t// The synthetic entry remains in history with its marker\n\t\t// intact; the capture-phase popstate listener will\n\t\t// auto-skip it later.\n\t\tif (overlayStack.length > 0) {\n\t\t\tcloseAllOverlays()\n\t\t}\n\t\torigPush(data, unused, url)\n\t}\n}\n\n/**\n * Closes every active overlay in the stack (top-down) and clears\n * the stack. Called when a real navigation is detected so that\n * overlay state doesn't leak across route boundaries.\n */\nfunction closeAllOverlays(): void {\n\twhile (overlayStack.length > 0) {\n\t\tconst entry = overlayStack.pop()\n\t\tif (entry?.close !== undefined) {\n\t\t\tconst fn = entry.close\n\t\t\tentry.close = undefined\n\t\t\tfn()\n\t\t}\n\t}\n}\n\n/**\n * Installs popstate listeners and patches history.pushState.\n *\n * Two listeners are installed:\n *\n * 1. **Capture-phase** — runs BEFORE any bubbling-phase listeners\n * (including TanStack Router's popstate handler). Inspects the\n * state at the history pointer:\n *\n * - **Active entry** (id found in overlayStack): the back\n * gesture landed on a synthetic entry that belongs to an\n * overlay still below the top of the stack. Pop and close the\n * top overlay (the one the user is actually dismissing) and\n * block the event from reaching the router via\n * `stopImmediatePropagation()`.\n *\n * - **Phantom entry** (id in `seenSyntheticIds` but NOT in\n * overlayStack): a synthetic history slot that remains after\n * the overlay was closed via route navigation. Blocks the\n * event AND auto-skips by calling `history.back()` to advance\n * the pointer past the phantom, so the router never sees its\n * stale URL.\n *\n * 2. **Bubbling-phase** — closes the top overlay when the back\n * gesture returns to the base route state (no synthetic marker),\n * which happens for the last open overlay.\n */\nfunction ensurePopListener(): void {\n\tif (popListenerInstalled) return\n\tif (typeof window === \"undefined\") return\n\tpopListenerInstalled = true\n\n\t// Capture-phase gate: block synthetic popstate from reaching\n\t// the router (or any other bubbling-phase listener on window).\n\twindow.addEventListener(\n\t\t\"popstate\",\n\t\t(e: PopStateEvent) => {\n\t\t\tif (suppressPopCount > 0) return // let the counter handle it\n\t\t\tconst state = e.state as Record<string, unknown> | null\n\t\t\tif (state !== null && typeof state === \"object\" && HISTORY_KEY in state) {\n\t\t\t\tconst id = state[HISTORY_KEY]\n\t\t\t\t// Active entry still in the stack → the back gesture\n\t\t\t\t// landed on a synthetic entry of an overlay below the\n\t\t\t\t// top. Close the top overlay and hide the event from\n\t\t\t\t// the router.\n\t\t\t\tif (\n\t\t\t\t\ttypeof id === \"number\" &&\n\t\t\t\t\toverlayStack.some((entry) => entry.id === id)\n\t\t\t\t) {\n\t\t\t\t\tcloseTopOverlay()\n\t\t\t\t\te.stopImmediatePropagation()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// Phantom entry: a synthetic history slot that\n\t\t\t\t// remains after the overlay was closed via\n\t\t\t\t// route navigation. Block the event from the\n\t\t\t\t// router AND auto-skip by calling history.back()\n\t\t\t\t// to move the pointer past the phantom.\n\t\t\t\te.stopImmediatePropagation()\n\t\t\t\tif (typeof id === \"number\" && seenSyntheticIds.has(id)) {\n\t\t\t\t\twindow.history.back()\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\ttrue, // capture phase\n\t)\n\n\twindow.addEventListener(\"popstate\", handlePop)\n\tpatchHistory()\n}\n\nfunction closeTopOverlay(): void {\n\tconst top = overlayStack.pop()\n\tif (top === undefined) return\n\t// `close` may be cleared if this entry was dismissed via UI from a\n\t// non-top position; the popstate then just unwinds a stale\n\t// synthetic history slot and there is nothing to close.\n\tif (top.close === undefined) return\n\t// Clear close before calling it so the resulting effect sees\n\t// idRef as undefined (back-gesture close) and skips the\n\t// back() + replaceState() UI-close path.\n\tconst closeFn = top.close\n\ttop.close = undefined\n\tcloseFn()\n}\n\nfunction handlePop(): void {\n\tif (suppressPopCount > 0) {\n\t\tsuppressPopCount--\n\t\treturn\n\t}\n\tcloseTopOverlay()\n}\n\n/**\n * Removes the entry with the given `id` from the overlay stack.\n *\n * When the entry is **not** the top of the stack, it is \"parked\"\n * (left in place with its close callback cleared) so the synthetic\n * history slot survives until swept.\n *\n * @returns An object describing what was removed:\n * - `removed`: whether the entry was found.\n * - `parkedBelow`: how many parked (close=undefined) entries were\n * found below the removed entry. These must be unwound alongside\n * the active entry to prevent dead back-presses.\n */\nfunction removeFromStack(id: number): {\n\treadonly removed: boolean\n\treadonly parkedBelow: number\n} {\n\tconst idx = overlayStack.findIndex((e) => e.id === id)\n\tif (idx === -1) return { removed: false, parkedBelow: 0 }\n\tconst wasTop = idx === overlayStack.length - 1\n\tif (!wasTop) {\n\t\t// Park: keep the history slot but neutralise the callback.\n\t\tconst entry = overlayStack[idx]\n\t\tif (entry !== undefined) entry.close = undefined\n\t\treturn { removed: true, parkedBelow: 0 }\n\t}\n\t// Top entry — remove it and count ALL parked entries below so\n\t// their orphaned synthetic history slots are unwound in the same\n\t// batch as the active entry's slot.\n\toverlayStack.pop()\n\tconst remaining = overlayStack.splice(0, overlayStack.length)\n\tconst active = remaining.filter((e) => e.close !== undefined)\n\tconst parkedBelow = remaining.length - active.length\n\toverlayStack.push(...active)\n\treturn { removed: true, parkedBelow }\n}\n\n/**\n * Cleans up the synthetic history entry after an overlay closes via\n * UI (not back gesture, not route navigation).\n *\n * `history.back()` is asynchronous — it queues a history traversal\n * task. The popstate event fires only after the traversal completes\n * (pointer has moved to the target entry). By replacing the state\n * inside the popstate handler, we ensure:\n *\n * 1. The pointer is at the base entry (not the synthetic one).\n * 2. `replaceState` truncates forward history, eliminating the\n * phantom synthetic entry that `back()` alone would leave behind.\n *\n * **Route-change safety**: When a navigation-resolver is registered\n * (via {@link setNavigationResolver}), `scheduleStateRestore` uses\n * the router's deterministic \"navigation resolved\" signal to know\n * when `history.state` reflects the new route. When no resolver is\n * available (e.g. tests), it falls back to `requestAnimationFrame`,\n * which runs after the microtask queue where the router flushes its\n * pending `pushState` calls.\n *\n * - If `history.state` still carries our marker → normal UI close,\n * proceed with the `back()` + `replaceState()` cleanup.\n * - If `history.state` no longer carries our marker → a route\n * change has pushed a real entry on top. Skip the `back()` call\n * to avoid racing with the router's push. The capture-phase\n * popstate listener will auto-skip the stranded phantom entry.\n */\nfunction scheduleStateRestore(\n\tid: number,\n\tbaseState: unknown,\n\tparkedBelow: number,\n): void {\n\tfunction check(): void {\n\t\tconst currentState = window.history.state as Record<string, unknown> | null\n\n\t\t// The history pointer is no longer on this overlay's own\n\t\t// synthetic entry (route change, or another overlay has\n\t\t// already pushed/popped on top). Do NOT call history.back()\n\t\t// — it would race with the current top entry and navigate\n\t\t// to the wrong place. Just sweep parked entries from the\n\t\t// stack but do NOT prune `seenSyntheticIds`; any stranded\n\t\t// synthetic entries will be auto-skipped by the capture-phase\n\t\t// listener when the user navigates past them.\n\t\tif (\n\t\t\tcurrentState === null ||\n\t\t\ttypeof currentState !== \"object\" ||\n\t\t\t!(HISTORY_KEY in currentState) ||\n\t\t\tcurrentState[HISTORY_KEY] !== id\n\t\t) {\n\t\t\tsweepParkedEntries()\n\t\t\treturn\n\t\t}\n\n\t\tconst totalBacks = 1 + parkedBelow\n\t\tlet done = false\n\n\t\tfunction restore(): void {\n\t\t\tif (done) return\n\t\t\tdone = true\n\t\t\twindow.removeEventListener(\"popstate\", onPop)\n\t\t\twindow.history.replaceState(baseState, \"\")\n\t\t\t// replaceState truncates forward history, eliminating\n\t\t\t// phantom entries. Safe to prune their IDs from\n\t\t\t// `seenSyntheticIds` (excluding IDs still in the\n\t\t\t// active stack).\n\t\t\tconst sweptIds = sweepParkedEntries()\n\t\t\tcleanupSeenIds(sweptIds)\n\t\t}\n\n\t\tfunction onPop(): void {\n\t\t\tif (suppressPopCount > 0) {\n\t\t\t\tsuppressPopCount--\n\t\t\t\treturn\n\t\t\t}\n\t\t\trestore()\n\t\t}\n\n\t\twindow.addEventListener(\"popstate\", onPop)\n\n\t\tsuppressPopCount += totalBacks\n\t\tfor (let i = 0; i < totalBacks; i++) {\n\t\t\twindow.history.back()\n\t\t}\n\t}\n\n\t// Use both the router's deterministic \"navigation resolved\" signal\n\t// and a requestAnimationFrame fallback. In the common UI-close case\n\t// (e.g. clicking outside a dropdown) there is no route change, so\n\t// the resolver never fires. Without the fallback the synthetic\n\t// history entry would be left behind as a phantom.\n\tlet disposed = false\n\tlet rafId: number | undefined\n\tlet unsub: (() => void) | undefined\n\n\tfunction run(): void {\n\t\tif (disposed) return\n\t\tdisposed = true\n\t\tunsub?.()\n\t\tif (rafId !== undefined) {\n\t\t\tcancelAnimationFrame(rafId)\n\t\t}\n\t\tcheck()\n\t}\n\n\tif (navigationResolver !== undefined) {\n\t\tunsub = navigationResolver(run)\n\t}\n\n\trafId = requestAnimationFrame(run)\n}\n\n/**\n * Sweeps all parked entries (those with no close callback) from the\n * overlay stack. Called after `replaceState` truncates forward\n * history, since parked entries no longer have corresponding history\n * entries and would cause dead back-presses.\n *\n * @returns The IDs of entries that were removed, used by the caller\n * to prune `seenSyntheticIds`.\n */\nfunction sweepParkedEntries(): readonly number[] {\n\tconst sweptIds: number[] = []\n\tfor (let i = overlayStack.length - 1; i >= 0; i--) {\n\t\tconst entry = overlayStack[i]\n\t\tif (entry !== undefined && entry.close === undefined) {\n\t\t\tsweptIds.push(entry.id)\n\t\t\toverlayStack.splice(i, 1)\n\t\t}\n\t}\n\treturn sweptIds\n}\n\n/**\n * Removes swept IDs from `seenSyntheticIds` to prevent unbounded\n * growth over the lifetime of the SPA session.\n *\n * After `replaceState` truncates forward history, phantom entries\n * for swept parked overlays are eliminated. Their IDs can safely\n * be removed from `seenSyntheticIds` — unless the same ID belongs\n * to an entry still active in the stack (which happens when a\n * lower-ID entry is parked but a higher-ID entry above it is still\n * open and not swept).\n */\nfunction cleanupSeenIds(sweptIds: readonly number[]): void {\n\tconst activeIds = new Set(overlayStack.map((e) => e.id))\n\tfor (const id of sweptIds) {\n\t\tif (!activeIds.has(id)) {\n\t\t\tseenSyntheticIds.delete(id)\n\t\t}\n\t}\n}\n\n/**\n * On mobile (< sm), when an overlay (dialog/sheet/popover) opens we push a\n * synthetic history entry so the device back gesture closes it instead of\n * navigating away from the page.\n *\n * **Closing via UI** calls `history.back()` to navigate past the\n * synthetic entry, then uses `replaceState` (inside the resulting\n * popstate handler) to restore the original history state.\n *\n * **Closing via back gesture** is handled by the popstate listener,\n * which pops the stack entry and calls the close callback.\n *\n * **Closing via route navigation**: the `pushState` interceptor\n * closes all overlays synchronously but does NOT strip the synthetic\n * marker. The React effect's `scheduleStateRestore` waits for the\n * router's navigation-resolved signal (or falls back to\n * `requestAnimationFrame`); by then the router's push has completed\n * and the marker is gone from `history.state`, so `back()` is\n * skipped. The stranded synthetic entry is later auto-skipped by the\n * capture-phase popstate listener when the user navigates past it.\n *\n * Multiple overlays open at once stack: pressing back closes the most\n * recently opened one first, matching the visual stacking order.\n *\n * No-op on non-mobile viewports and when no `onOpenChange` is provided\n * (uncontrolled overlays cannot be closed externally).\n */\nexport function useMobileBackToClose(\n\topen: boolean | undefined,\n\tonOpenChange: ((open: boolean) => void) | undefined,\n): void {\n\tconst idRef = useRef<number | undefined>(undefined)\n\tconst onChangeRef = useRef(onOpenChange)\n\tonChangeRef.current = onOpenChange\n\n\tuseEffect(() => {\n\t\tif (typeof window === \"undefined\") return\n\t\tif (onChangeRef.current === undefined) return\n\t\tif (!isBelowMd()) return\n\t\tensurePopListener()\n\n\t\tif (open === true && idRef.current === undefined) {\n\t\t\tconst id = ++nextOverlayId\n\t\t\tidRef.current = id\n\t\t\tseenSyntheticIds.add(id)\n\t\t\t// Capture the base state BEFORE pushing so we can restore\n\t\t\t// it on close (via replaceState) to eliminate phantoms.\n\t\t\tconst baseState = window.history.state ?? null\n\t\t\twindow.history.pushState(\n\t\t\t\t{\n\t\t\t\t\t...((baseState as Record<string, unknown>) ?? {}),\n\t\t\t\t\t[HISTORY_KEY]: id,\n\t\t\t\t},\n\t\t\t\t\"\",\n\t\t\t)\n\t\t\toverlayStack.push({\n\t\t\t\tid,\n\t\t\t\tbaseState,\n\t\t\t\tclose() {\n\t\t\t\t\tidRef.current = undefined\n\t\t\t\t\tonChangeRef.current?.(false)\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (open !== true && idRef.current !== undefined) {\n\t\t\tconst id = idRef.current\n\t\t\tidRef.current = undefined\n\t\t\tconst entryIdx = overlayStack.findIndex((e) => e.id === id)\n\t\t\tconst entry = entryIdx !== -1 ? overlayStack[entryIdx] : undefined\n\t\t\tconst { removed, parkedBelow } = removeFromStack(id)\n\t\t\tif (removed && entry !== undefined) {\n\t\t\t\tscheduleStateRestore(id, entry.baseState, parkedBelow)\n\t\t\t}\n\t\t}\n\t}, [open])\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (idRef.current !== undefined) {\n\t\t\t\tconst id = idRef.current\n\t\t\t\tidRef.current = undefined\n\t\t\t\tconst entryIdx = overlayStack.findIndex((e) => e.id === id)\n\t\t\t\tconst entry = entryIdx !== -1 ? overlayStack[entryIdx] : undefined\n\t\t\t\tconst { removed, parkedBelow } = removeFromStack(id)\n\t\t\t\tif (removed && entry !== undefined) {\n\t\t\t\t\tscheduleStateRestore(id, entry.baseState, parkedBelow)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [])\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Icon-mode-aware glyph wrapper (Settings → Icons in the host app).
|
|
6
|
+
*
|
|
7
|
+
* The active icon style lives as `data-icon-style` on `document.documentElement`
|
|
8
|
+
* — the host app writes it from its preference store, plugin iframes receive
|
|
9
|
+
* it through the `themeChanged` push — so this module needs no context or
|
|
10
|
+
* injected state: a single shared `MutationObserver` watches the attribute
|
|
11
|
+
* and every wrapped component re-renders through `useSyncExternalStore`
|
|
12
|
+
* when it flips.
|
|
13
|
+
*
|
|
14
|
+
* Only `linear` needs a component swap: the boldDuotone glyphs change to
|
|
15
|
+
* their thin-line linear counterparts. `grayscale` is pure CSS (theme.css
|
|
16
|
+
* recolors the `.hd-icon` hook), so the store only tracks the mode.
|
|
17
|
+
*/
|
|
18
|
+
type IconStyleValue = "duotone" | "grayscale" | "linear";
|
|
19
|
+
/**
|
|
20
|
+
* The parallel Solar weights an icon registers — named after Solar's own
|
|
21
|
+
* weights (DESIGN.md — Iconography). Every icon carries all of them;
|
|
22
|
+
* adding a mode here forces every registry entry to fill it in.
|
|
23
|
+
*/
|
|
24
|
+
type IconMode = "bold" | "boldDuotone" | "linear";
|
|
25
|
+
/** All three mode glyphs of one icon. Mandatory and complete by type. */
|
|
26
|
+
type IconVariants = Record<IconMode, IconType>;
|
|
27
|
+
/**
|
|
28
|
+
* Wraps a Solar glyph family so its render follows the host's icon style.
|
|
29
|
+
*
|
|
30
|
+
* `createIcon({ bold, boldDuotone, linear })` — the three parallel weights
|
|
31
|
+
* of one icon. Without a `mode` prop the wrapper renders the glyph for the
|
|
32
|
+
* active icon style; an explicit `mode` overrides it (selected states pass
|
|
33
|
+
* `"bold"` through `Icon`).
|
|
34
|
+
*
|
|
35
|
+
* Every wrapped render merges the `hd-icon` hook class, so the duotone /
|
|
36
|
+
* grayscale CSS in theme.css applies to direct renders too. Returns
|
|
37
|
+
* `undefined`-free components callable through the `Icon` wrapper or bare
|
|
38
|
+
* JSX alike.
|
|
39
|
+
*/
|
|
40
|
+
declare function createIcon(variants: IconVariants): ComponentType<Record<string, unknown>>;
|
|
41
|
+
|
|
42
|
+
/** Anything renderable through `Icon`: a Solar icon (imported from the
|
|
43
|
+
central registry on the web side) or a local utility mark (marks.tsx) —
|
|
44
|
+
both take `className`; registry icons take `mode` (marks ignore it). */
|
|
45
|
+
type IconType = ComponentType<{
|
|
46
|
+
className?: string;
|
|
47
|
+
mode?: IconMode;
|
|
48
|
+
}>;
|
|
49
|
+
/** The three sanctioned icon sizes: `sm` 12 inside pills and meta lines,
|
|
50
|
+
`md` 16 by default, `lg` 20 for primary toolbar actions. */
|
|
51
|
+
type IconSize = "sm" | "md" | "lg";
|
|
52
|
+
/**
|
|
53
|
+
* Solar icons with the design system's defaults baked in: callers pass
|
|
54
|
+
* the registry icon — by default it renders the boldDuotone weight,
|
|
55
|
+
* whose second tone takes the palette's `--icon-tone` hue (theme.css
|
|
56
|
+
* recolors the duotone accent via `--solar-secondary-color` under the
|
|
57
|
+
* `hd-icon` hook), so colored palettes feel alive while mono stays
|
|
58
|
+
* neutral.
|
|
59
|
+
*
|
|
60
|
+
* Mode is one channel: `mode` picks the weight directly; `selected` maps
|
|
61
|
+
* to `"bold"` (the filled, single-color weight — the only sanctioned use
|
|
62
|
+
* of Bold); otherwise the active icon style preference decides.
|
|
63
|
+
*
|
|
64
|
+
* Sizing is class-based, three tiers only — `sm`/`md`/`lg` map to
|
|
65
|
+
* `size-3/4/5` (12/16/20). Escape the tiers with
|
|
66
|
+
* `className="size-[18px]"` — twMerge lets the later class win.
|
|
67
|
+
*
|
|
68
|
+
* ✓/×/+ semantics never use Solar's Circle/Square composites — the
|
|
69
|
+
* container is full-bleed while the informative mark is barely a third
|
|
70
|
+
* of the box, so it goes muddy at small sizes. The plain marks (Check,
|
|
71
|
+
* Cross, Plus from marks.tsx) cover these at every size; `sm` otherwise
|
|
72
|
+
* belongs to simple single-stroke glyphs (arrows, dots, grips).
|
|
73
|
+
*/
|
|
74
|
+
declare function Icon({ icon: IconComponent, mode, size, selected, className, ...rest }: {
|
|
75
|
+
icon: IconType;
|
|
76
|
+
/** Explicit weight override; `selected` and the style preference lose
|
|
77
|
+
to it. */
|
|
78
|
+
mode?: IconMode;
|
|
79
|
+
size?: IconSize;
|
|
80
|
+
/** Selected state — renders the icon's `"bold"` weight. */
|
|
81
|
+
selected?: boolean;
|
|
82
|
+
className?: string;
|
|
83
|
+
} & Record<string, unknown>): React.JSX.Element;
|
|
84
|
+
|
|
85
|
+
export { type IconType as I, type IconSize as a, type IconMode as b, type IconStyleValue as c, type IconVariants as d, createIcon as e, Icon as f };
|