@kumix/ui 0.1.3 → 0.2.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/README.md +115 -95
- package/dist/components/reui/alert.d.ts +12 -0
- package/dist/components/reui/alert.d.ts.map +1 -0
- package/dist/components/reui/alert.js +58 -0
- package/dist/components/reui/alert.js.map +1 -0
- package/dist/components/reui/autocomplete.d.ts +43 -0
- package/dist/components/reui/autocomplete.d.ts.map +1 -0
- package/dist/components/reui/autocomplete.js +165 -0
- package/dist/components/reui/autocomplete.js.map +1 -0
- package/dist/components/reui/badge.d.ts +17 -0
- package/dist/components/reui/badge.d.ts.map +1 -0
- package/dist/components/reui/badge.js +75 -0
- package/dist/components/reui/badge.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts +17 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js +127 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +18 -0
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-header.js +228 -0
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts +10 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +28 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts +22 -0
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js +144 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts +12 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +289 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts +14 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +166 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +10 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +171 -0
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +29 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +269 -0
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table.d.ts +116 -0
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-table.js +864 -0
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid.d.ts +112 -0
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid.js +134 -0
- package/dist/components/reui/data-grid/data-grid.js.map +1 -0
- package/dist/components/reui/date-selector.d.ts +131 -0
- package/dist/components/reui/date-selector.d.ts.map +1 -0
- package/dist/components/reui/date-selector.js +783 -0
- package/dist/components/reui/date-selector.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.d.ts +7 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +108 -0
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-content.d.ts +15 -0
- package/dist/components/reui/event-calendar/event-calendar-content.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-content.js +44 -0
- package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts +30 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +581 -0
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +73 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.js +299 -0
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts +103 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.js +141 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.d.ts +111 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.js +398 -0
- package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts +29 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +530 -0
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts +71 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.js +319 -0
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts +32 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js +300 -0
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts +14 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +355 -0
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +35 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +651 -0
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +236 -0
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-types.js +2 -0
- package/dist/components/reui/event-calendar/event-calendar.d.ts +561 -0
- package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar.js +817 -0
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -0
- package/dist/components/reui/filters.d.ts +176 -0
- package/dist/components/reui/filters.d.ts.map +1 -0
- package/dist/components/reui/filters.js +1216 -0
- package/dist/components/reui/filters.js.map +1 -0
- package/dist/components/reui/frame.d.ts +32 -0
- package/dist/components/reui/frame.d.ts.map +1 -0
- package/dist/components/reui/frame.js +115 -0
- package/dist/components/reui/frame.js.map +1 -0
- package/dist/components/reui/gantt/gantt-bar.d.ts +44 -0
- package/dist/components/reui/gantt/gantt-bar.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-bar.js +229 -0
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -0
- package/dist/components/reui/gantt/gantt-dnd.d.ts +36 -0
- package/dist/components/reui/gantt/gantt-dnd.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-dnd.js +615 -0
- package/dist/components/reui/gantt/gantt-dnd.js.map +1 -0
- package/dist/components/reui/gantt/gantt-i18n.d.ts +91 -0
- package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-i18n.js +131 -0
- package/dist/components/reui/gantt/gantt-i18n.js.map +1 -0
- package/dist/components/reui/gantt/gantt-lib.d.ts +123 -0
- package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-lib.js +354 -0
- package/dist/components/reui/gantt/gantt-lib.js.map +1 -0
- package/dist/components/reui/gantt/gantt-nav.d.ts +60 -0
- package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-nav.js +266 -0
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -0
- package/dist/components/reui/gantt/gantt-recurrence.d.ts +37 -0
- package/dist/components/reui/gantt/gantt-recurrence.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-recurrence.js +230 -0
- package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -0
- package/dist/components/reui/gantt/gantt-types.d.ts +251 -0
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-types.js +2 -0
- package/dist/components/reui/gantt/gantt-view.d.ts +10 -0
- package/dist/components/reui/gantt/gantt-view.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt-view.js +2193 -0
- package/dist/components/reui/gantt/gantt-view.js.map +1 -0
- package/dist/components/reui/gantt/gantt.d.ts +602 -0
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -0
- package/dist/components/reui/gantt/gantt.js +796 -0
- package/dist/components/reui/gantt/gantt.js.map +1 -0
- package/dist/components/reui/icon-stack.d.ts +7 -0
- package/dist/components/reui/icon-stack.d.ts.map +1 -0
- package/dist/components/reui/icon-stack.js +76 -0
- package/dist/components/reui/icon-stack.js.map +1 -0
- package/dist/components/reui/kanban.d.ts +70 -0
- package/dist/components/reui/kanban.d.ts.map +1 -0
- package/dist/components/reui/kanban.js +519 -0
- package/dist/components/reui/kanban.js.map +1 -0
- package/dist/components/reui/number-field.d.ts +29 -0
- package/dist/components/reui/number-field.d.ts.map +1 -0
- package/dist/components/reui/number-field.js +127 -0
- package/dist/components/reui/number-field.js.map +1 -0
- package/dist/components/reui/phone-input.d.ts +13 -0
- package/dist/components/reui/phone-input.d.ts.map +1 -0
- package/dist/components/reui/phone-input.js +126 -0
- package/dist/components/reui/phone-input.js.map +1 -0
- package/dist/components/reui/rating.d.ts +34 -0
- package/dist/components/reui/rating.d.ts.map +1 -0
- package/dist/components/reui/rating.js +94 -0
- package/dist/components/reui/rating.js.map +1 -0
- package/dist/components/reui/scrollspy.d.ts +17 -0
- package/dist/components/reui/scrollspy.d.ts.map +1 -0
- package/dist/components/reui/scrollspy.js +130 -0
- package/dist/components/reui/scrollspy.js.map +1 -0
- package/dist/components/reui/sortable.d.ts +48 -0
- package/dist/components/reui/sortable.d.ts.map +1 -0
- package/dist/components/reui/sortable.js +230 -0
- package/dist/components/reui/sortable.js.map +1 -0
- package/dist/components/reui/stepper.d.ts +63 -0
- package/dist/components/reui/stepper.d.ts.map +1 -0
- package/dist/components/reui/stepper.js +234 -0
- package/dist/components/reui/stepper.js.map +1 -0
- package/dist/components/reui/timeline.d.ts +24 -0
- package/dist/components/reui/timeline.d.ts.map +1 -0
- package/dist/components/reui/timeline.js +123 -0
- package/dist/components/reui/timeline.js.map +1 -0
- package/dist/components/reui/tree.d.ts +23 -0
- package/dist/components/reui/tree.d.ts.map +1 -0
- package/dist/components/reui/tree.js +115 -0
- package/dist/components/reui/tree.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +9 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +56 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +96 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +13 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +45 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +8 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +16 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/attachment.d.ts +26 -0
- package/dist/components/ui/attachment.d.ts.map +1 -0
- package/dist/components/ui/attachment.js +106 -0
- package/dist/components/ui/attachment.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +14 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +52 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +32 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +13 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +72 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/bubble.d.ts +19 -0
- package/dist/components/ui/bubble.d.ts.map +1 -0
- package/dist/components/ui/bubble.js +75 -0
- package/dist/components/ui/bubble.js.map +1 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +44 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +47 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +13 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +110 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +14 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +58 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/carousel.d.ts +31 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +135 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/chart.d.ts +47 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/chart.js +151 -0
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +22 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +8 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +26 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +27 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +164 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command.d.ts +22 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +89 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +32 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +134 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +93 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/direction.d.ts +2 -0
- package/dist/components/ui/direction.js +3 -0
- package/dist/components/ui/drawer.d.ts +19 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +125 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +32 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +138 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/empty.d.ts +15 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +62 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +28 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +112 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +8 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +38 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +21 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +80 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +14 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +49 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +17 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/item.d.ts +25 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +123 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +7 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +22 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +15 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/marker.d.ts +13 -0
- package/dist/components/ui/marker.d.ts.map +1 -0
- package/dist/components/ui/marker.js +45 -0
- package/dist/components/ui/marker.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +32 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +137 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/message-scroller.d.ts +13 -0
- package/dist/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/components/ui/message-scroller.js +62 -0
- package/dist/components/ui/message-scroller.js.map +1 -0
- package/dist/components/ui/message.d.ts +13 -0
- package/dist/components/ui/message.d.ts.map +1 -0
- package/dist/components/ui/message.js +51 -0
- package/dist/components/ui/message.js.map +1 -0
- package/dist/components/ui/native-select.d.ts +11 -0
- package/dist/components/ui/native-select.d.ts.map +1 -0
- package/dist/components/ui/native-select.js +40 -0
- package/dist/components/ui/native-select.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +15 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +85 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +20 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +81 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +12 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +56 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +10 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +46 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +29 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +30 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +38 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +99 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +17 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +17 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +90 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +383 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +6 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +6 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +36 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +7 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +32 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +6 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +18 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +13 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +68 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +13 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +47 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +15 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +14 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +54 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +11 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +38 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +43 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/hooks/use-body-classes.d.ts +27 -0
- package/dist/hooks/use-body-classes.d.ts.map +1 -0
- package/dist/hooks/use-body-classes.js +52 -0
- package/dist/hooks/use-body-classes.js.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +43 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +69 -0
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
- package/dist/hooks/use-file-upload.d.ts +49 -0
- package/dist/hooks/use-file-upload.d.ts.map +1 -0
- package/dist/hooks/use-file-upload.js +227 -0
- package/dist/hooks/use-file-upload.js.map +1 -0
- package/dist/hooks/use-hydrated.d.ts +37 -0
- package/dist/hooks/use-hydrated.d.ts.map +1 -0
- package/dist/hooks/use-hydrated.js +50 -0
- package/dist/hooks/use-hydrated.js.map +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +55 -0
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -0
- package/dist/hooks/use-intersection-observer.js +144 -0
- package/dist/hooks/use-intersection-observer.js.map +1 -0
- package/dist/hooks/use-is-mac.d.ts +28 -0
- package/dist/hooks/use-is-mac.d.ts.map +1 -0
- package/dist/hooks/use-is-mac.js +38 -0
- package/dist/hooks/use-is-mac.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +44 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-meta-color.d.ts +78 -0
- package/dist/hooks/use-meta-color.d.ts.map +1 -0
- package/dist/hooks/use-meta-color.js +138 -0
- package/dist/hooks/use-meta-color.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +5 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +21 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-mutation-observer.d.ts +61 -0
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
- package/dist/hooks/use-mutation-observer.js +96 -0
- package/dist/hooks/use-mutation-observer.js.map +1 -0
- package/dist/hooks/use-scroll-position.d.ts +76 -0
- package/dist/hooks/use-scroll-position.d.ts.map +1 -0
- package/dist/hooks/use-scroll-position.js +97 -0
- package/dist/hooks/use-scroll-position.js.map +1 -0
- package/dist/hooks/use-slider-input.d.ts +94 -0
- package/dist/hooks/use-slider-input.d.ts.map +1 -0
- package/dist/hooks/use-slider-input.js +116 -0
- package/dist/hooks/use-slider-input.js.map +1 -0
- package/dist/hooks/use-viewport.d.ts +72 -0
- package/dist/hooks/use-viewport.d.ts.map +1 -0
- package/dist/hooks/use-viewport.js +91 -0
- package/dist/hooks/use-viewport.js.map +1 -0
- package/dist/style.css +0 -247
- package/dist/theme.css +244 -0
- package/dist/theme.css.d.ts +3 -0
- package/package.json +42 -40
- package/dist/hooks.d.ts +0 -957
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js +0 -1391
- package/dist/hooks.js.map +0 -1
- package/dist/index.d.ts +0 -1993
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -10647
- package/dist/index.js.map +0 -1
- package/dist/source.css +0 -1
- package/dist/source.css.d.ts +0 -3
- package/dist/use-is-mobile-Dln4-L1O.js +0 -210
- package/dist/use-is-mobile-Dln4-L1O.js.map +0 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/hooks/use-intersection-observer.ts
|
|
4
|
+
/**
|
|
5
|
+
* Intersection observer hook for React components
|
|
6
|
+
* Efficiently observes visibility of DOM elements using a shared IntersectionObserver instance.
|
|
7
|
+
* Ideal for lazy loading, infinite scrolling, and animating elements when they enter the viewport.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A shared intersection observer to manage multiple targets with a single observer instance.
|
|
11
|
+
* Optimized for high-density lists (like the patterns grid).
|
|
12
|
+
*/
|
|
13
|
+
var SharedObserver = class {
|
|
14
|
+
observer = null;
|
|
15
|
+
callbacks = /* @__PURE__ */ new Map();
|
|
16
|
+
options;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
20
|
+
getObserver() {
|
|
21
|
+
if (!this.observer) this.observer = new IntersectionObserver((entries) => {
|
|
22
|
+
entries.forEach((entry) => {
|
|
23
|
+
const callback = this.callbacks.get(entry.target);
|
|
24
|
+
if (callback) callback(entry.isIntersecting);
|
|
25
|
+
});
|
|
26
|
+
}, this.options);
|
|
27
|
+
return this.observer;
|
|
28
|
+
}
|
|
29
|
+
observe(element, callback) {
|
|
30
|
+
this.callbacks.set(element, callback);
|
|
31
|
+
this.getObserver().observe(element);
|
|
32
|
+
}
|
|
33
|
+
unobserve(element) {
|
|
34
|
+
this.callbacks.delete(element);
|
|
35
|
+
this.observer?.unobserve(element);
|
|
36
|
+
}
|
|
37
|
+
get size() {
|
|
38
|
+
return this.callbacks.size;
|
|
39
|
+
}
|
|
40
|
+
disconnect() {
|
|
41
|
+
this.observer?.disconnect();
|
|
42
|
+
this.callbacks.clear();
|
|
43
|
+
this.observer = null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const observers = /* @__PURE__ */ new Map();
|
|
47
|
+
const rootIds = /* @__PURE__ */ new WeakMap();
|
|
48
|
+
let rootId = 0;
|
|
49
|
+
function getRootKey(root) {
|
|
50
|
+
if (!root) return "null";
|
|
51
|
+
if (!rootIds.has(root)) rootIds.set(root, ++rootId);
|
|
52
|
+
return rootIds.get(root);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get or create a shared `IntersectionObserver` instance based on the provided options.
|
|
56
|
+
*
|
|
57
|
+
* Using a shared observer reduces the number of underlying `IntersectionObserver`
|
|
58
|
+
* instances created by the browser, which is especially beneficial for pages
|
|
59
|
+
* with many observed elements.
|
|
60
|
+
*
|
|
61
|
+
* @param options - Intersection observer configuration (threshold, root, rootMargin)
|
|
62
|
+
* @returns A shared `SharedObserver` instance for the given options
|
|
63
|
+
*/
|
|
64
|
+
function getSharedObserver(options) {
|
|
65
|
+
const threshold = Array.isArray(options.threshold) ? options.threshold.join(",") : options.threshold ?? 0;
|
|
66
|
+
const key = `${getRootKey(options.root)}|${options.rootMargin ?? "0px"}|${threshold}`;
|
|
67
|
+
if (!observers.has(key)) observers.set(key, new SharedObserver(options));
|
|
68
|
+
return {
|
|
69
|
+
key,
|
|
70
|
+
observer: observers.get(key)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* React hook that tracks whether a DOM element is currently intersecting the viewport.
|
|
75
|
+
*
|
|
76
|
+
* Features:
|
|
77
|
+
* - Uses a shared `IntersectionObserver` instance for better performance.
|
|
78
|
+
* - Supports custom `threshold`, `root`, and `rootMargin` options.
|
|
79
|
+
* - Optional `freezeOnceVisible` flag to stop observing after first intersection.
|
|
80
|
+
*
|
|
81
|
+
* @param elementRef - React ref pointing to the DOM element to observe.
|
|
82
|
+
* @param options - Optional observer configuration and behavior flags.
|
|
83
|
+
* @param options.threshold - Intersection threshold(s) for triggering visibility changes.
|
|
84
|
+
* @param options.root - Scrollable ancestor element to use as the viewport (defaults to browser viewport).
|
|
85
|
+
* @param options.rootMargin - Margin around the root, expressed in CSS units (e.g. `"0px 0px -20% 0px"`).
|
|
86
|
+
* @param options.freezeOnceVisible - When `true`, stops observing after the element first becomes visible.
|
|
87
|
+
*
|
|
88
|
+
* @returns `true` when the element is intersecting based on the given options, otherwise `false`.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const ref = React.useRef<HTMLDivElement | null>(null);
|
|
93
|
+
* const isVisible = useIntersectionObserver(ref, {
|
|
94
|
+
* threshold: 0.2,
|
|
95
|
+
* rootMargin: "0px 0px -10% 0px",
|
|
96
|
+
* freezeOnceVisible: true,
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* return (
|
|
100
|
+
* <div ref={ref} className={isVisible ? "animate-in" : "opacity-0"}>
|
|
101
|
+
* I will animate when I enter the viewport.
|
|
102
|
+
* </div>
|
|
103
|
+
* );
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
function useIntersectionObserver(elementRef, { threshold = 0, root = null, rootMargin = "0%", freezeOnceVisible = false } = {}) {
|
|
107
|
+
const [isIntersecting, setIntersecting] = React$1.useState(false);
|
|
108
|
+
const frozen = React$1.useRef(false);
|
|
109
|
+
React$1.useEffect(() => {
|
|
110
|
+
const element = elementRef?.current;
|
|
111
|
+
if (!element || freezeOnceVisible && frozen.current) return;
|
|
112
|
+
if (typeof IntersectionObserver === "undefined") return;
|
|
113
|
+
const { key, observer } = getSharedObserver({
|
|
114
|
+
threshold,
|
|
115
|
+
root,
|
|
116
|
+
rootMargin
|
|
117
|
+
});
|
|
118
|
+
observer.observe(element, (intersecting) => {
|
|
119
|
+
setIntersecting(intersecting);
|
|
120
|
+
if (intersecting && freezeOnceVisible) {
|
|
121
|
+
frozen.current = true;
|
|
122
|
+
observer.unobserve(element);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return () => {
|
|
126
|
+
observer.unobserve(element);
|
|
127
|
+
if (observer.size === 0) {
|
|
128
|
+
observer.disconnect();
|
|
129
|
+
observers.delete(key);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}, [
|
|
133
|
+
elementRef,
|
|
134
|
+
threshold,
|
|
135
|
+
root,
|
|
136
|
+
rootMargin,
|
|
137
|
+
freezeOnceVisible
|
|
138
|
+
]);
|
|
139
|
+
return isIntersecting;
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { useIntersectionObserver };
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=use-intersection-observer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-intersection-observer.js","names":["React"],"sources":["../../src/hooks/use-intersection-observer.ts"],"sourcesContent":["/**\n * Intersection observer hook for React components\n * Efficiently observes visibility of DOM elements using a shared IntersectionObserver instance.\n * Ideal for lazy loading, infinite scrolling, and animating elements when they enter the viewport.\n */\n\n\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Configuration options for the `useIntersectionObserver` hook.\n *\n * Extends the native `IntersectionObserverInit` options with an additional\n * convenience flag for freezing the observer state.\n */\ninterface IntersectionObserverOptions extends IntersectionObserverInit {\n /**\n * When `true`, the hook stops observing once the element becomes visible\n * and keeps returning `true` for subsequent renders.\n *\n * This is useful for one-time animations or lazy loading where you only\n * care about the first time an element enters the viewport.\n */\n freezeOnceVisible?: boolean;\n}\n\n/**\n * A shared intersection observer to manage multiple targets with a single observer instance.\n * Optimized for high-density lists (like the patterns grid).\n */\nclass SharedObserver {\n private observer: IntersectionObserver | null = null;\n private callbacks = new Map<Element, (isIntersecting: boolean) => void>();\n private options: IntersectionObserverInit;\n\n constructor(options: IntersectionObserverInit) {\n this.options = options;\n }\n\n private getObserver() {\n if (!this.observer) {\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const callback = this.callbacks.get(entry.target);\n if (callback) {\n callback(entry.isIntersecting);\n }\n });\n }, this.options);\n }\n return this.observer;\n }\n\n observe(element: Element, callback: (isIntersecting: boolean) => void) {\n this.callbacks.set(element, callback);\n this.getObserver().observe(element);\n }\n\n unobserve(element: Element) {\n this.callbacks.delete(element);\n this.observer?.unobserve(element);\n }\n\n get size() {\n return this.callbacks.size;\n }\n\n disconnect() {\n this.observer?.disconnect();\n this.callbacks.clear();\n this.observer = null;\n }\n}\n\n// Singleton instances for common observer options to maximize reuse.\nconst observers = new Map<string, SharedObserver>();\nconst rootIds = new WeakMap<Element, number>();\nlet rootId = 0;\n\nfunction getRootKey(root: Element | Document | null | undefined) {\n if (!root) return \"null\";\n if (!rootIds.has(root as Element)) {\n rootIds.set(root as Element, ++rootId);\n }\n return rootIds.get(root as Element);\n}\n\n/**\n * Get or create a shared `IntersectionObserver` instance based on the provided options.\n *\n * Using a shared observer reduces the number of underlying `IntersectionObserver`\n * instances created by the browser, which is especially beneficial for pages\n * with many observed elements.\n *\n * @param options - Intersection observer configuration (threshold, root, rootMargin)\n * @returns A shared `SharedObserver` instance for the given options\n */\nfunction getSharedObserver(options: IntersectionObserverInit) {\n const threshold = Array.isArray(options.threshold)\n ? options.threshold.join(\",\")\n : (options.threshold ?? 0);\n const key = `${getRootKey(options.root)}|${options.rootMargin ?? \"0px\"}|${threshold}`;\n if (!observers.has(key)) {\n observers.set(key, new SharedObserver(options));\n }\n return { key, observer: observers.get(key)! };\n}\n\n/**\n * React hook that tracks whether a DOM element is currently intersecting the viewport.\n *\n * Features:\n * - Uses a shared `IntersectionObserver` instance for better performance.\n * - Supports custom `threshold`, `root`, and `rootMargin` options.\n * - Optional `freezeOnceVisible` flag to stop observing after first intersection.\n *\n * @param elementRef - React ref pointing to the DOM element to observe.\n * @param options - Optional observer configuration and behavior flags.\n * @param options.threshold - Intersection threshold(s) for triggering visibility changes.\n * @param options.root - Scrollable ancestor element to use as the viewport (defaults to browser viewport).\n * @param options.rootMargin - Margin around the root, expressed in CSS units (e.g. `\"0px 0px -20% 0px\"`).\n * @param options.freezeOnceVisible - When `true`, stops observing after the element first becomes visible.\n *\n * @returns `true` when the element is intersecting based on the given options, otherwise `false`.\n *\n * @example\n * ```tsx\n * const ref = React.useRef<HTMLDivElement | null>(null);\n * const isVisible = useIntersectionObserver(ref, {\n * threshold: 0.2,\n * rootMargin: \"0px 0px -10% 0px\",\n * freezeOnceVisible: true,\n * });\n *\n * return (\n * <div ref={ref} className={isVisible ? \"animate-in\" : \"opacity-0\"}>\n * I will animate when I enter the viewport.\n * </div>\n * );\n * ```\n */\nexport function useIntersectionObserver(\n elementRef: React.RefObject<Element | null>,\n {\n threshold = 0,\n root = null,\n rootMargin = \"0%\",\n freezeOnceVisible = false,\n }: IntersectionObserverOptions = {},\n): boolean {\n const [isIntersecting, setIntersecting] = React.useState(false);\n const frozen = React.useRef(false);\n\n React.useEffect(() => {\n const element = elementRef?.current;\n if (!element || (freezeOnceVisible && frozen.current)) return;\n if (typeof IntersectionObserver === \"undefined\") return;\n\n const { key, observer } = getSharedObserver({ threshold, root, rootMargin });\n\n observer.observe(element, (intersecting) => {\n setIntersecting(intersecting);\n if (intersecting && freezeOnceVisible) {\n frozen.current = true;\n observer.unobserve(element);\n }\n });\n\n return () => {\n observer.unobserve(element);\n if (observer.size === 0) {\n observer.disconnect();\n observers.delete(key);\n }\n };\n }, [elementRef, threshold, root, rootMargin, freezeOnceVisible]);\n\n return isIntersecting;\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,IAAM,iBAAN,MAAqB;CACnB,WAAgD;CAChD,4BAAoB,IAAI,IAAgD;CACxE;CAEA,YAAY,SAAmC;EAC7C,KAAK,UAAU;CACjB;CAEA,cAAsB;EACpB,IAAI,CAAC,KAAK,UACR,KAAK,WAAW,IAAI,sBAAsB,YAAY;GACpD,QAAQ,SAAS,UAAU;IACzB,MAAM,WAAW,KAAK,UAAU,IAAI,MAAM,MAAM;IAChD,IAAI,UACF,SAAS,MAAM,cAAc;GAEjC,CAAC;EACH,GAAG,KAAK,OAAO;EAEjB,OAAO,KAAK;CACd;CAEA,QAAQ,SAAkB,UAA6C;EACrE,KAAK,UAAU,IAAI,SAAS,QAAQ;EACpC,KAAK,YAAY,CAAC,CAAC,QAAQ,OAAO;CACpC;CAEA,UAAU,SAAkB;EAC1B,KAAK,UAAU,OAAO,OAAO;EAC7B,KAAK,UAAU,UAAU,OAAO;CAClC;CAEA,IAAI,OAAO;EACT,OAAO,KAAK,UAAU;CACxB;CAEA,aAAa;EACX,KAAK,UAAU,WAAW;EAC1B,KAAK,UAAU,MAAM;EACrB,KAAK,WAAW;CAClB;AACF;AAGA,MAAM,4BAAY,IAAI,IAA4B;AAClD,MAAM,0BAAU,IAAI,QAAyB;AAC7C,IAAI,SAAS;AAEb,SAAS,WAAW,MAA6C;CAC/D,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,CAAC,QAAQ,IAAI,IAAe,GAC9B,QAAQ,IAAI,MAAiB,EAAE,MAAM;CAEvC,OAAO,QAAQ,IAAI,IAAe;AACpC;;;;;;;;;;;AAYA,SAAS,kBAAkB,SAAmC;CAC5D,MAAM,YAAY,MAAM,QAAQ,QAAQ,SAAS,IAC7C,QAAQ,UAAU,KAAK,GAAG,IACzB,QAAQ,aAAa;CAC1B,MAAM,MAAM,GAAG,WAAW,QAAQ,IAAI,EAAE,GAAG,QAAQ,cAAc,MAAM,GAAG;CAC1E,IAAI,CAAC,UAAU,IAAI,GAAG,GACpB,UAAU,IAAI,KAAK,IAAI,eAAe,OAAO,CAAC;CAEhD,OAAO;EAAE;EAAK,UAAU,UAAU,IAAI,GAAG;CAAG;AAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,wBACd,YACA,EACE,YAAY,GACZ,OAAO,MACP,aAAa,MACb,oBAAoB,UACW,CAAC,GACzB;CACT,MAAM,CAAC,gBAAgB,mBAAmBA,QAAM,SAAS,KAAK;CAC9D,MAAM,SAASA,QAAM,OAAO,KAAK;CAEjC,QAAM,gBAAgB;EACpB,MAAM,UAAU,YAAY;EAC5B,IAAI,CAAC,WAAY,qBAAqB,OAAO,SAAU;EACvD,IAAI,OAAO,yBAAyB,aAAa;EAEjD,MAAM,EAAE,KAAK,aAAa,kBAAkB;GAAE;GAAW;GAAM;EAAW,CAAC;EAE3E,SAAS,QAAQ,UAAU,iBAAiB;GAC1C,gBAAgB,YAAY;GAC5B,IAAI,gBAAgB,mBAAmB;IACrC,OAAO,UAAU;IACjB,SAAS,UAAU,OAAO;GAC5B;EACF,CAAC;EAED,aAAa;GACX,SAAS,UAAU,OAAO;GAC1B,IAAI,SAAS,SAAS,GAAG;IACvB,SAAS,WAAW;IACpB,UAAU,OAAO,GAAG;GACtB;EACF;CACF,GAAG;EAAC;EAAY;EAAW;EAAM;EAAY;CAAiB,CAAC;CAE/D,OAAO;AACT"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/hooks/use-is-mac.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Platform detection hook for React components
|
|
4
|
+
* Determines whether the current user agent is running on a macOS device.
|
|
5
|
+
* Useful for rendering platform-specific keyboard shortcuts or UI variations.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* React hook that returns whether the current browser reports a macOS platform.
|
|
9
|
+
* It prefers `navigator.userAgentData.platform` when available and falls back
|
|
10
|
+
* to `navigator.userAgent`.
|
|
11
|
+
*
|
|
12
|
+
* @returns `true` if the current platform is macOS, otherwise `false`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const isMac = useIsMac();
|
|
17
|
+
*
|
|
18
|
+
* return (
|
|
19
|
+
* <kbd>
|
|
20
|
+
* {isMac ? "⌘" : "Ctrl"} + K
|
|
21
|
+
* </kbd>
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function useIsMac(): boolean;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useIsMac };
|
|
28
|
+
//# sourceMappingURL=use-is-mac.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-mac.d.ts","names":[],"sources":["../../src/hooks/use-is-mac.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;iBA4BgB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
//#region src/hooks/use-is-mac.ts
|
|
4
|
+
/**
|
|
5
|
+
* Platform detection hook for React components
|
|
6
|
+
* Determines whether the current user agent is running on a macOS device.
|
|
7
|
+
* Useful for rendering platform-specific keyboard shortcuts or UI variations.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* React hook that returns whether the current browser reports a macOS platform.
|
|
11
|
+
* It prefers `navigator.userAgentData.platform` when available and falls back
|
|
12
|
+
* to `navigator.userAgent`.
|
|
13
|
+
*
|
|
14
|
+
* @returns `true` if the current platform is macOS, otherwise `false`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const isMac = useIsMac();
|
|
19
|
+
*
|
|
20
|
+
* return (
|
|
21
|
+
* <kbd>
|
|
22
|
+
* {isMac ? "⌘" : "Ctrl"} + K
|
|
23
|
+
* </kbd>
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function useIsMac() {
|
|
28
|
+
const [isMac, setIsMac] = useState(false);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const platform = navigator.userAgentData?.platform ?? navigator.userAgent ?? "";
|
|
31
|
+
setIsMac(platform.toUpperCase().includes("MAC"));
|
|
32
|
+
}, []);
|
|
33
|
+
return isMac;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { useIsMac };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=use-is-mac.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-mac.js","names":[],"sources":["../../src/hooks/use-is-mac.ts"],"sourcesContent":["/**\n * Platform detection hook for React components\n * Determines whether the current user agent is running on a macOS device.\n * Useful for rendering platform-specific keyboard shortcuts or UI variations.\n */\n\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * React hook that returns whether the current browser reports a macOS platform.\n * It prefers `navigator.userAgentData.platform` when available and falls back\n * to `navigator.userAgent`.\n *\n * @returns `true` if the current platform is macOS, otherwise `false`.\n *\n * @example\n * ```tsx\n * const isMac = useIsMac();\n *\n * return (\n * <kbd>\n * {isMac ? \"⌘\" : \"Ctrl\"} + K\n * </kbd>\n * );\n * ```\n */\nexport function useIsMac() {\n const [isMac, setIsMac] = useState(false);\n\n useEffect(() => {\n const platform =\n (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData\n ?.platform ??\n navigator.userAgent ??\n \"\";\n setIsMac(platform.toUpperCase().includes(\"MAC\"));\n }, []);\n\n return isMac;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,WAAW;CACzB,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK;CAExC,gBAAgB;EACd,MAAM,WACH,UAAoE,eACjE,YACJ,UAAU,aACV;EACF,SAAS,SAAS,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC;CACjD,GAAG,CAAC,CAAC;CAEL,OAAO;AACT"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/hooks/use-media-query.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Media query hook for responsive React components
|
|
4
|
+
* Provides real-time tracking of CSS media query matches
|
|
5
|
+
* with SSR-safe implementation and automatic cleanup
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Hook for tracking CSS media query matches in React components
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Real-time updates when media query state changes
|
|
12
|
+
* - SSR-safe implementation
|
|
13
|
+
* - Automatic event listener cleanup
|
|
14
|
+
* - Supports all standard CSS media queries
|
|
15
|
+
*
|
|
16
|
+
* @param query - CSS media query string (e.g., '(min-width: 768px)')
|
|
17
|
+
* @returns Boolean indicating whether the media query currently matches
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Basic responsive behavior
|
|
22
|
+
* const isMobile = useMediaQuery('(max-width: 768px)');
|
|
23
|
+
* const isTablet = useMediaQuery('(min-width: 769px) and (max-width: 1024px)');
|
|
24
|
+
* const isDesktop = useMediaQuery('(min-width: 1025px)');
|
|
25
|
+
*
|
|
26
|
+
* // Dark mode preference
|
|
27
|
+
* const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
28
|
+
*
|
|
29
|
+
* // Reduced motion preference
|
|
30
|
+
* const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
31
|
+
*
|
|
32
|
+
* return (
|
|
33
|
+
* <div>
|
|
34
|
+
* {isMobile && <MobileLayout />}
|
|
35
|
+
* {isTablet && <TabletLayout />}
|
|
36
|
+
* {isDesktop && <DesktopLayout />}
|
|
37
|
+
* </div>
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare const useMediaQuery: (query: string) => boolean;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { useMediaQuery };
|
|
44
|
+
//# sourceMappingURL=use-media-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-query.d.ts","names":[],"sources":["../../src/hooks/use-media-query.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4Ca,gBAAiB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
3
|
+
//#region src/hooks/use-media-query.ts
|
|
4
|
+
/**
|
|
5
|
+
* Media query hook for responsive React components
|
|
6
|
+
* Provides real-time tracking of CSS media query matches
|
|
7
|
+
* with SSR-safe implementation and automatic cleanup
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Hook for tracking CSS media query matches in React components
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Real-time updates when media query state changes
|
|
14
|
+
* - SSR-safe implementation
|
|
15
|
+
* - Automatic event listener cleanup
|
|
16
|
+
* - Supports all standard CSS media queries
|
|
17
|
+
*
|
|
18
|
+
* @param query - CSS media query string (e.g., '(min-width: 768px)')
|
|
19
|
+
* @returns Boolean indicating whether the media query currently matches
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Basic responsive behavior
|
|
24
|
+
* const isMobile = useMediaQuery('(max-width: 768px)');
|
|
25
|
+
* const isTablet = useMediaQuery('(min-width: 769px) and (max-width: 1024px)');
|
|
26
|
+
* const isDesktop = useMediaQuery('(min-width: 1025px)');
|
|
27
|
+
*
|
|
28
|
+
* // Dark mode preference
|
|
29
|
+
* const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
30
|
+
*
|
|
31
|
+
* // Reduced motion preference
|
|
32
|
+
* const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
33
|
+
*
|
|
34
|
+
* return (
|
|
35
|
+
* <div>
|
|
36
|
+
* {isMobile && <MobileLayout />}
|
|
37
|
+
* {isTablet && <TabletLayout />}
|
|
38
|
+
* {isDesktop && <DesktopLayout />}
|
|
39
|
+
* </div>
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
const useMediaQuery = (query) => {
|
|
44
|
+
const subscribe = useCallback((onChange) => {
|
|
45
|
+
const matchMedia = window.matchMedia(query);
|
|
46
|
+
matchMedia.addEventListener("change", onChange);
|
|
47
|
+
return () => {
|
|
48
|
+
matchMedia.removeEventListener("change", onChange);
|
|
49
|
+
};
|
|
50
|
+
}, [query]);
|
|
51
|
+
const getSnapshot = useCallback(() => window.matchMedia(query).matches, [query]);
|
|
52
|
+
const getServerSnapshot = () => false;
|
|
53
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { useMediaQuery };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=use-media-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-query.js","names":[],"sources":["../../src/hooks/use-media-query.ts"],"sourcesContent":["/**\n * Media query hook for responsive React components\n * Provides real-time tracking of CSS media query matches\n * with SSR-safe implementation and automatic cleanup\n */\n\n\"use client\";\n\nimport { useCallback, useSyncExternalStore } from \"react\";\n\n/**\n * Hook for tracking CSS media query matches in React components\n *\n * Features:\n * - Real-time updates when media query state changes\n * - SSR-safe implementation\n * - Automatic event listener cleanup\n * - Supports all standard CSS media queries\n *\n * @param query - CSS media query string (e.g., '(min-width: 768px)')\n * @returns Boolean indicating whether the media query currently matches\n *\n * @example\n * ```tsx\n * // Basic responsive behavior\n * const isMobile = useMediaQuery('(max-width: 768px)');\n * const isTablet = useMediaQuery('(min-width: 769px) and (max-width: 1024px)');\n * const isDesktop = useMediaQuery('(min-width: 1025px)');\n *\n * // Dark mode preference\n * const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');\n *\n * // Reduced motion preference\n * const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n *\n * return (\n * <div>\n * {isMobile && <MobileLayout />}\n * {isTablet && <TabletLayout />}\n * {isDesktop && <DesktopLayout />}\n * </div>\n * );\n * ```\n */\nexport const useMediaQuery = (query: string): boolean => {\n // Subscribe to media query changes and clean up automatically\n const subscribe = useCallback(\n (onChange: () => void) => {\n const matchMedia = window.matchMedia(query);\n matchMedia.addEventListener(\"change\", onChange);\n return () => {\n matchMedia.removeEventListener(\"change\", onChange);\n };\n },\n [query],\n );\n\n // Read the current match status on the client\n const getSnapshot = useCallback(() => window.matchMedia(query).matches, [query]);\n\n // Always report false during SSR to avoid hydration mismatches\n const getServerSnapshot = () => false;\n\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,iBAAiB,UAA2B;CAEvD,MAAM,YAAY,aACf,aAAyB;EACxB,MAAM,aAAa,OAAO,WAAW,KAAK;EAC1C,WAAW,iBAAiB,UAAU,QAAQ;EAC9C,aAAa;GACX,WAAW,oBAAoB,UAAU,QAAQ;EACnD;CACF,GACA,CAAC,KAAK,CACR;CAGA,MAAM,cAAc,kBAAkB,OAAO,WAAW,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;CAG/E,MAAM,0BAA0B;CAEhC,OAAO,qBAAqB,WAAW,aAAa,iBAAiB;AACvE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { META_THEME_COLORS } from "@kumix/utils";
|
|
2
|
+
//#region src/hooks/use-meta-color.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Calculates and applies the HTML `theme-color` meta tag from `next-themes`.
|
|
5
|
+
* The returned setter can be used for temporary manual overrides.
|
|
6
|
+
*
|
|
7
|
+
* @param defaultColors - Optional custom color configuration (defaults to META_THEME_COLORS)
|
|
8
|
+
* @returns Object containing current meta color and setter function.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // Basic usage with default colors (supports light, dark, and system)
|
|
13
|
+
* function App() {
|
|
14
|
+
* const { metaColor, setMetaColor } = useMetaColor();
|
|
15
|
+
*
|
|
16
|
+
* // metaColor automatically updates based on theme (light/dark/system)
|
|
17
|
+
* useEffect(() => {
|
|
18
|
+
* console.log('Current meta color:', metaColor);
|
|
19
|
+
* }, [metaColor]);
|
|
20
|
+
*
|
|
21
|
+
* return <div>App content</div>;
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* // Custom colors with system theme support
|
|
25
|
+
* function CustomThemeApp() {
|
|
26
|
+
* const customColors = {
|
|
27
|
+
* light: '#f0f0f0',
|
|
28
|
+
* dark: '#1a1a1a',
|
|
29
|
+
* system: 'auto' // Will resolve to light or dark based on OS preference
|
|
30
|
+
* };
|
|
31
|
+
* const { metaColor } = useMetaColor(customColors);
|
|
32
|
+
*
|
|
33
|
+
* return <div style={{ backgroundColor: metaColor }}>Custom themed app</div>;
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* // Manual meta color override for special pages
|
|
37
|
+
* function SpecialPage() {
|
|
38
|
+
* const { setMetaColor } = useMetaColor();
|
|
39
|
+
*
|
|
40
|
+
* useEffect(() => {
|
|
41
|
+
* // Override meta color for this page
|
|
42
|
+
* setMetaColor('#ff0000');
|
|
43
|
+
*
|
|
44
|
+
* // Cleanup: reset to theme color when leaving page
|
|
45
|
+
* return () => {
|
|
46
|
+
* setMetaColor(''); // This will revert to theme-based color
|
|
47
|
+
* };
|
|
48
|
+
* }, [setMetaColor]);
|
|
49
|
+
*
|
|
50
|
+
* return <div>Special page with red theme color</div>;
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* // Integration with theme switcher
|
|
54
|
+
* function ThemeAwareComponent() {
|
|
55
|
+
* const { theme, setTheme } = useTheme();
|
|
56
|
+
* const { metaColor } = useMetaColor();
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <div>
|
|
60
|
+
* <p>Current theme: {theme}</p>
|
|
61
|
+
* <p>Meta color: {metaColor}</p>
|
|
62
|
+
* <button onClick={() => setTheme('light')}>Light</button>
|
|
63
|
+
* <button onClick={() => setTheme('dark')}>Dark</button>
|
|
64
|
+
* <button onClick={() => setTheme('system')}>System</button>
|
|
65
|
+
* </div>
|
|
66
|
+
* );
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function useMetaColor(defaultColors?: typeof META_THEME_COLORS): {
|
|
71
|
+
/** Current meta theme color based on resolved theme */
|
|
72
|
+
metaColor: "#09090b" | "#ffffff";
|
|
73
|
+
/** Function to manually set meta theme color */
|
|
74
|
+
setMetaColor: (color: string) => void;
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { useMetaColor };
|
|
78
|
+
//# sourceMappingURL=use-meta-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-meta-color.d.ts","names":[],"sources":["../../src/hooks/use-meta-color.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8EgB,aAAa,uBAAuB;;;;EAqDH,eAAA"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { META_THEME_COLORS, THEME_MODES } from "@kumix/utils";
|
|
4
|
+
import { useTheme } from "next-themes";
|
|
5
|
+
//#region src/hooks/use-meta-color.ts
|
|
6
|
+
/**
|
|
7
|
+
* Meta theme color management hook for React components.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Calculates and applies the HTML `theme-color` meta tag from `next-themes`.
|
|
11
|
+
* The returned setter can be used for temporary manual overrides.
|
|
12
|
+
*
|
|
13
|
+
* @param defaultColors - Optional custom color configuration (defaults to META_THEME_COLORS)
|
|
14
|
+
* @returns Object containing current meta color and setter function.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic usage with default colors (supports light, dark, and system)
|
|
19
|
+
* function App() {
|
|
20
|
+
* const { metaColor, setMetaColor } = useMetaColor();
|
|
21
|
+
*
|
|
22
|
+
* // metaColor automatically updates based on theme (light/dark/system)
|
|
23
|
+
* useEffect(() => {
|
|
24
|
+
* console.log('Current meta color:', metaColor);
|
|
25
|
+
* }, [metaColor]);
|
|
26
|
+
*
|
|
27
|
+
* return <div>App content</div>;
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* // Custom colors with system theme support
|
|
31
|
+
* function CustomThemeApp() {
|
|
32
|
+
* const customColors = {
|
|
33
|
+
* light: '#f0f0f0',
|
|
34
|
+
* dark: '#1a1a1a',
|
|
35
|
+
* system: 'auto' // Will resolve to light or dark based on OS preference
|
|
36
|
+
* };
|
|
37
|
+
* const { metaColor } = useMetaColor(customColors);
|
|
38
|
+
*
|
|
39
|
+
* return <div style={{ backgroundColor: metaColor }}>Custom themed app</div>;
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* // Manual meta color override for special pages
|
|
43
|
+
* function SpecialPage() {
|
|
44
|
+
* const { setMetaColor } = useMetaColor();
|
|
45
|
+
*
|
|
46
|
+
* useEffect(() => {
|
|
47
|
+
* // Override meta color for this page
|
|
48
|
+
* setMetaColor('#ff0000');
|
|
49
|
+
*
|
|
50
|
+
* // Cleanup: reset to theme color when leaving page
|
|
51
|
+
* return () => {
|
|
52
|
+
* setMetaColor(''); // This will revert to theme-based color
|
|
53
|
+
* };
|
|
54
|
+
* }, [setMetaColor]);
|
|
55
|
+
*
|
|
56
|
+
* return <div>Special page with red theme color</div>;
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* // Integration with theme switcher
|
|
60
|
+
* function ThemeAwareComponent() {
|
|
61
|
+
* const { theme, setTheme } = useTheme();
|
|
62
|
+
* const { metaColor } = useMetaColor();
|
|
63
|
+
*
|
|
64
|
+
* return (
|
|
65
|
+
* <div>
|
|
66
|
+
* <p>Current theme: {theme}</p>
|
|
67
|
+
* <p>Meta color: {metaColor}</p>
|
|
68
|
+
* <button onClick={() => setTheme('light')}>Light</button>
|
|
69
|
+
* <button onClick={() => setTheme('dark')}>Dark</button>
|
|
70
|
+
* <button onClick={() => setTheme('system')}>System</button>
|
|
71
|
+
* </div>
|
|
72
|
+
* );
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function useMetaColor(defaultColors) {
|
|
77
|
+
/** Get resolved theme from next-themes */
|
|
78
|
+
const { resolvedTheme } = useTheme();
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to detect system dark mode preference
|
|
81
|
+
*/
|
|
82
|
+
const isSystemDarkMode = React$1.useCallback(() => {
|
|
83
|
+
if (typeof window === "undefined") return false;
|
|
84
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
85
|
+
}, []);
|
|
86
|
+
/**
|
|
87
|
+
* Get effective theme mode (resolves 'system' to actual preference)
|
|
88
|
+
*/
|
|
89
|
+
const getEffectiveTheme = React$1.useCallback((theme) => {
|
|
90
|
+
if (theme === THEME_MODES.SYSTEM) return isSystemDarkMode() ? THEME_MODES.DARK : THEME_MODES.LIGHT;
|
|
91
|
+
return theme;
|
|
92
|
+
}, [isSystemDarkMode]);
|
|
93
|
+
/**
|
|
94
|
+
* Calculate appropriate meta color based on current theme
|
|
95
|
+
* Handles light, dark, and system themes properly
|
|
96
|
+
* Memoized to prevent unnecessary recalculations
|
|
97
|
+
*/
|
|
98
|
+
const metaColor = React$1.useMemo(() => {
|
|
99
|
+
const colorsToUse = defaultColors ?? META_THEME_COLORS;
|
|
100
|
+
const effectiveTheme = getEffectiveTheme(resolvedTheme);
|
|
101
|
+
if (effectiveTheme === THEME_MODES.DARK) return colorsToUse[THEME_MODES.DARK];
|
|
102
|
+
else if (effectiveTheme === THEME_MODES.LIGHT) return colorsToUse[THEME_MODES.LIGHT];
|
|
103
|
+
return colorsToUse[THEME_MODES.LIGHT];
|
|
104
|
+
}, [
|
|
105
|
+
resolvedTheme,
|
|
106
|
+
defaultColors,
|
|
107
|
+
getEffectiveTheme
|
|
108
|
+
]);
|
|
109
|
+
/**
|
|
110
|
+
* Manually set meta theme color in the document
|
|
111
|
+
* Useful for temporary color overrides or custom scenarios
|
|
112
|
+
*
|
|
113
|
+
* @param color - Hex color string to set as meta theme color
|
|
114
|
+
*/
|
|
115
|
+
const setMetaColor = React$1.useCallback((color) => {
|
|
116
|
+
const metaTag = document.querySelector("meta[name=\"theme-color\"]");
|
|
117
|
+
if (metaTag) metaTag.setAttribute("content", color);
|
|
118
|
+
else {
|
|
119
|
+
const newMetaTag = document.createElement("meta");
|
|
120
|
+
newMetaTag.name = "theme-color";
|
|
121
|
+
newMetaTag.content = color;
|
|
122
|
+
document.head.appendChild(newMetaTag);
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
React$1.useEffect(() => {
|
|
126
|
+
setMetaColor(metaColor);
|
|
127
|
+
}, [metaColor, setMetaColor]);
|
|
128
|
+
return {
|
|
129
|
+
/** Current meta theme color based on resolved theme */
|
|
130
|
+
metaColor,
|
|
131
|
+
/** Function to manually set meta theme color */
|
|
132
|
+
setMetaColor
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { useMetaColor };
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=use-meta-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-meta-color.js","names":["React"],"sources":["../../src/hooks/use-meta-color.ts"],"sourcesContent":["/**\n * Meta theme color management hook for React components.\n */\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { useTheme } from \"next-themes\";\n\nimport { META_THEME_COLORS, THEME_MODES } from \"@kumix/utils\";\n\n/**\n * Calculates and applies the HTML `theme-color` meta tag from `next-themes`.\n * The returned setter can be used for temporary manual overrides.\n *\n * @param defaultColors - Optional custom color configuration (defaults to META_THEME_COLORS)\n * @returns Object containing current meta color and setter function.\n *\n * @example\n * ```tsx\n * // Basic usage with default colors (supports light, dark, and system)\n * function App() {\n * const { metaColor, setMetaColor } = useMetaColor();\n *\n * // metaColor automatically updates based on theme (light/dark/system)\n * useEffect(() => {\n * console.log('Current meta color:', metaColor);\n * }, [metaColor]);\n *\n * return <div>App content</div>;\n * }\n *\n * // Custom colors with system theme support\n * function CustomThemeApp() {\n * const customColors = {\n * light: '#f0f0f0',\n * dark: '#1a1a1a',\n * system: 'auto' // Will resolve to light or dark based on OS preference\n * };\n * const { metaColor } = useMetaColor(customColors);\n *\n * return <div style={{ backgroundColor: metaColor }}>Custom themed app</div>;\n * }\n *\n * // Manual meta color override for special pages\n * function SpecialPage() {\n * const { setMetaColor } = useMetaColor();\n *\n * useEffect(() => {\n * // Override meta color for this page\n * setMetaColor('#ff0000');\n *\n * // Cleanup: reset to theme color when leaving page\n * return () => {\n * setMetaColor(''); // This will revert to theme-based color\n * };\n * }, [setMetaColor]);\n *\n * return <div>Special page with red theme color</div>;\n * }\n *\n * // Integration with theme switcher\n * function ThemeAwareComponent() {\n * const { theme, setTheme } = useTheme();\n * const { metaColor } = useMetaColor();\n *\n * return (\n * <div>\n * <p>Current theme: {theme}</p>\n * <p>Meta color: {metaColor}</p>\n * <button onClick={() => setTheme('light')}>Light</button>\n * <button onClick={() => setTheme('dark')}>Dark</button>\n * <button onClick={() => setTheme('system')}>System</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useMetaColor(defaultColors?: typeof META_THEME_COLORS) {\n /** Get resolved theme from next-themes */\n const { resolvedTheme } = useTheme();\n\n /**\n * Helper function to detect system dark mode preference\n */\n const isSystemDarkMode = React.useCallback(() => {\n if (typeof window === \"undefined\") return false;\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n }, []);\n\n /**\n * Get effective theme mode (resolves 'system' to actual preference)\n */\n const getEffectiveTheme = React.useCallback(\n (theme: string | undefined) => {\n if (theme === THEME_MODES.SYSTEM) {\n return isSystemDarkMode() ? THEME_MODES.DARK : THEME_MODES.LIGHT;\n }\n return theme;\n },\n [isSystemDarkMode],\n );\n\n /**\n * Calculate appropriate meta color based on current theme\n * Handles light, dark, and system themes properly\n * Memoized to prevent unnecessary recalculations\n */\n const metaColor = React.useMemo(() => {\n const colorsToUse = defaultColors ?? META_THEME_COLORS;\n\n // Get the effective theme (resolves system to light/dark)\n const effectiveTheme = getEffectiveTheme(resolvedTheme);\n\n // Handle different theme modes\n if (effectiveTheme === THEME_MODES.DARK) {\n return colorsToUse[THEME_MODES.DARK];\n } else if (effectiveTheme === THEME_MODES.LIGHT) {\n return colorsToUse[THEME_MODES.LIGHT];\n }\n\n // Fallback to light theme if resolvedTheme is undefined (during hydration)\n return colorsToUse[THEME_MODES.LIGHT];\n }, [resolvedTheme, defaultColors, getEffectiveTheme]);\n\n /**\n * Manually set meta theme color in the document\n * Useful for temporary color overrides or custom scenarios\n *\n * @param color - Hex color string to set as meta theme color\n */\n const setMetaColor = React.useCallback((color: string) => {\n // Find and update the meta theme-color tag\n const metaTag = document.querySelector('meta[name=\"theme-color\"]');\n if (metaTag) {\n metaTag.setAttribute(\"content\", color);\n } else {\n // Create meta tag if it doesn't exist\n const newMetaTag = document.createElement(\"meta\");\n newMetaTag.name = \"theme-color\";\n newMetaTag.content = color;\n document.head.appendChild(newMetaTag);\n }\n }, []);\n\n React.useEffect(() => {\n setMetaColor(metaColor);\n }, [metaColor, setMetaColor]);\n\n return {\n /** Current meta theme color based on resolved theme */\n metaColor,\n /** Function to manually set meta theme color */\n setMetaColor,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,SAAgB,aAAa,eAA0C;;CAErE,MAAM,EAAE,kBAAkB,SAAS;;;;CAKnC,MAAM,mBAAmBA,QAAM,kBAAkB;EAC/C,IAAI,OAAO,WAAW,aAAa,OAAO;EAC1C,OAAO,OAAO,WAAW,8BAA8B,CAAC,CAAC;CAC3D,GAAG,CAAC,CAAC;;;;CAKL,MAAM,oBAAoBA,QAAM,aAC7B,UAA8B;EAC7B,IAAI,UAAU,YAAY,QACxB,OAAO,iBAAiB,IAAI,YAAY,OAAO,YAAY;EAE7D,OAAO;CACT,GACA,CAAC,gBAAgB,CACnB;;;;;;CAOA,MAAM,YAAYA,QAAM,cAAc;EACpC,MAAM,cAAc,iBAAiB;EAGrC,MAAM,iBAAiB,kBAAkB,aAAa;EAGtD,IAAI,mBAAmB,YAAY,MACjC,OAAO,YAAY,YAAY;OAC1B,IAAI,mBAAmB,YAAY,OACxC,OAAO,YAAY,YAAY;EAIjC,OAAO,YAAY,YAAY;CACjC,GAAG;EAAC;EAAe;EAAe;CAAiB,CAAC;;;;;;;CAQpD,MAAM,eAAeA,QAAM,aAAa,UAAkB;EAExD,MAAM,UAAU,SAAS,cAAc,4BAA0B;EACjE,IAAI,SACF,QAAQ,aAAa,WAAW,KAAK;OAChC;GAEL,MAAM,aAAa,SAAS,cAAc,MAAM;GAChD,WAAW,OAAO;GAClB,WAAW,UAAU;GACrB,SAAS,KAAK,YAAY,UAAU;EACtC;CACF,GAAG,CAAC,CAAC;CAEL,QAAM,gBAAgB;EACpB,aAAa,SAAS;CACxB,GAAG,CAAC,WAAW,YAAY,CAAC;CAE5B,OAAO;;EAEL;;EAEA;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mobile.d.ts","names":[],"sources":["../../src/hooks/use-mobile.ts"],"mappings":";iBAMgB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/hooks/use-mobile.ts
|
|
4
|
+
const MOBILE_BREAKPOINT = 768;
|
|
5
|
+
function useIsMobile() {
|
|
6
|
+
const [isMobile, setIsMobile] = React$1.useState(void 0);
|
|
7
|
+
React$1.useEffect(() => {
|
|
8
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
9
|
+
const onChange = () => {
|
|
10
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
11
|
+
};
|
|
12
|
+
mql.addEventListener("change", onChange);
|
|
13
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
14
|
+
return () => mql.removeEventListener("change", onChange);
|
|
15
|
+
}, []);
|
|
16
|
+
return !!isMobile;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { useIsMobile };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=use-mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-mobile.js","names":["React"],"sources":["../../src/hooks/use-mobile.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return !!isMobile;\n}\n"],"mappings":";;;AAIA,MAAM,oBAAoB;AAE1B,SAAgB,cAAc;CAC5B,MAAM,CAAC,UAAU,eAAeA,QAAM,SAA8B,KAAA,CAAS;CAE7E,QAAM,gBAAgB;EACpB,MAAM,MAAM,OAAO,WAAW,eAAe,oBAAoB,EAAE,IAAI;EACvE,MAAM,iBAAiB;GACrB,YAAY,OAAO,aAAa,iBAAiB;EACnD;EACA,IAAI,iBAAiB,UAAU,QAAQ;EACvC,YAAY,OAAO,aAAa,iBAAiB;EACjD,aAAa,IAAI,oBAAoB,UAAU,QAAQ;CACzD,GAAG,CAAC,CAAC;CAEL,OAAO,CAAC,CAAC;AACX"}
|