@kumix/ui 0.3.1 → 0.3.2
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 +33 -17
- package/dist/components/agents/agent-activity/activity-row.d.ts +8 -0
- package/dist/components/agents/agent-activity/activity-row.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/activity-row.js +228 -0
- package/dist/components/agents/agent-activity/activity-row.js.map +1 -0
- package/dist/components/agents/agent-activity/index.d.ts +6 -0
- package/dist/components/agents/agent-activity/index.d.ts.map +1 -0
- package/dist/components/agents/agent-activity/index.js +182 -0
- package/dist/components/agents/agent-activity/index.js.map +1 -0
- package/dist/components/agents/agent-code.d.ts +25 -0
- package/dist/components/agents/agent-code.d.ts.map +1 -0
- package/dist/components/agents/agent-code.js +117 -0
- package/dist/components/agents/agent-code.js.map +1 -0
- package/dist/components/agents/agent-disclosure.d.ts +12 -0
- package/dist/components/agents/agent-disclosure.d.ts.map +1 -0
- package/dist/components/agents/agent-disclosure.js +36 -0
- package/dist/components/agents/agent-disclosure.js.map +1 -0
- package/dist/components/agents/ai-sidebar.d.ts +41 -0
- package/dist/components/agents/ai-sidebar.d.ts.map +1 -0
- package/dist/components/agents/ai-sidebar.js +576 -0
- package/dist/components/agents/ai-sidebar.js.map +1 -0
- package/dist/components/agents/approval-card/index.d.ts +51 -0
- package/dist/components/agents/approval-card/index.d.ts.map +1 -0
- package/dist/components/agents/approval-card/index.js +317 -0
- package/dist/components/agents/approval-card/index.js.map +1 -0
- package/dist/components/agents/chat-app.d.ts +10 -0
- package/dist/components/agents/chat-app.d.ts.map +1 -0
- package/dist/components/agents/chat-app.js +20 -0
- package/dist/components/agents/chat-app.js.map +1 -0
- package/dist/components/agents/citations.d.ts +45 -0
- package/dist/components/agents/citations.d.ts.map +1 -0
- package/dist/components/agents/citations.js +175 -0
- package/dist/components/agents/citations.js.map +1 -0
- package/dist/components/agents/code-block.d.ts +21 -0
- package/dist/components/agents/code-block.d.ts.map +1 -0
- package/dist/components/agents/code-block.js +113 -0
- package/dist/components/agents/code-block.js.map +1 -0
- package/dist/components/agents/file-diff.d.ts +30 -0
- package/dist/components/agents/file-diff.d.ts.map +1 -0
- package/dist/components/agents/file-diff.js +186 -0
- package/dist/components/agents/file-diff.js.map +1 -0
- package/dist/components/agents/image-generation.d.ts +27 -0
- package/dist/components/agents/image-generation.d.ts.map +1 -0
- package/dist/components/agents/image-generation.js +308 -0
- package/dist/components/agents/image-generation.js.map +1 -0
- package/dist/components/agents/loading-states/agent-progress.d.ts +16 -0
- package/dist/components/agents/loading-states/agent-progress.d.ts.map +1 -0
- package/dist/components/agents/loading-states/agent-progress.js +117 -0
- package/dist/components/agents/loading-states/agent-progress.js.map +1 -0
- package/dist/components/agents/loading-states/reasoning-text.d.ts +20 -0
- package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -0
- package/dist/components/agents/loading-states/reasoning-text.js +184 -0
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -0
- package/dist/components/agents/loading-states/thinking-shimmer.d.ts +13 -0
- package/dist/components/agents/loading-states/thinking-shimmer.d.ts.map +1 -0
- package/dist/components/agents/loading-states/thinking-shimmer.js +17 -0
- package/dist/components/agents/loading-states/thinking-shimmer.js.map +1 -0
- package/dist/components/agents/message-bubble.d.ts +38 -0
- package/dist/components/agents/message-bubble.d.ts.map +1 -0
- package/dist/components/agents/message-bubble.js +182 -0
- package/dist/components/agents/message-bubble.js.map +1 -0
- package/dist/components/agents/message-context.d.ts +6 -0
- package/dist/components/agents/message-context.d.ts.map +1 -0
- package/dist/components/agents/message-context.js +8 -0
- package/dist/components/agents/message-context.js.map +1 -0
- package/dist/components/agents/message-scroller.d.ts +30 -0
- package/dist/components/agents/message-scroller.d.ts.map +1 -0
- package/dist/components/agents/message-scroller.js +314 -0
- package/dist/components/agents/message-scroller.js.map +1 -0
- package/dist/components/agents/message.d.ts +37 -0
- package/dist/components/agents/message.d.ts.map +1 -0
- package/dist/components/agents/message.js +139 -0
- package/dist/components/agents/message.js.map +1 -0
- package/dist/components/agents/prompt-input.d.ts +37 -0
- package/dist/components/agents/prompt-input.d.ts.map +1 -0
- package/dist/components/agents/prompt-input.js +216 -0
- package/dist/components/agents/prompt-input.js.map +1 -0
- package/dist/components/agents/streaming-response.d.ts +35 -0
- package/dist/components/agents/streaming-response.d.ts.map +1 -0
- package/dist/components/agents/streaming-response.js +151 -0
- package/dist/components/agents/streaming-response.js.map +1 -0
- package/dist/components/agents/todo-list.d.ts +24 -0
- package/dist/components/agents/todo-list.d.ts.map +1 -0
- package/dist/components/agents/todo-list.js +334 -0
- package/dist/components/agents/todo-list.js.map +1 -0
- package/dist/components/agents/tool-approval.d.ts +33 -0
- package/dist/components/agents/tool-approval.d.ts.map +1 -0
- package/dist/components/agents/tool-approval.js +166 -0
- package/dist/components/agents/tool-approval.js.map +1 -0
- package/dist/components/agents/tool-result.d.ts +34 -0
- package/dist/components/agents/tool-result.d.ts.map +1 -0
- package/dist/components/agents/tool-result.js +220 -0
- package/dist/components/agents/tool-result.js.map +1 -0
- package/dist/components/custom/confirm-dialog.js +1 -1
- package/dist/components/motion/animated-badge.js +1 -1
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +3 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/animated-toast-stack.js +3 -3
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.js +2 -2
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +1 -1
- package/dist/components/motion/button/stateful.js +1 -1
- package/dist/components/motion/center-morph-modal.js +3 -3
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/chromatic-text-reveal.js +1 -1
- package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
- package/dist/components/motion/command-palette.js +8 -4
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/feedback-widget.js +1 -1
- package/dist/components/motion/file-upload.js +1 -1
- package/dist/components/motion/infinite-masonry.js +1 -1
- package/dist/components/motion/notification-stack.js +1 -1
- package/dist/components/motion/overflow-actions.js +1 -1
- package/dist/components/motion/preview-rail.d.ts +10 -2
- package/dist/components/motion/preview-rail.d.ts.map +1 -1
- package/dist/components/motion/preview-rail.js +58 -27
- package/dist/components/motion/preview-rail.js.map +1 -1
- package/dist/components/motion/select-morph.js +1 -1
- package/dist/components/motion/select.js +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/text-shimmer.d.ts.map +1 -1
- package/dist/components/motion/text-shimmer.js +4 -3
- package/dist/components/motion/text-shimmer.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts +4 -3
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -2
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +15 -4
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +36 -8
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts +3 -2
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +0 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +3 -4
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +12 -7
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts +71 -4
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +147 -40
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +5 -6
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +6 -5
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +9 -10
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +60 -33
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +152 -68
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +105 -20
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +83 -10
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.js +47 -44
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +20 -2
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js +7 -5
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -1
- package/dist/components/reui/filters.js +26 -21
- package/dist/components/reui/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/icon-tile.d.ts.map +1 -1
- package/dist/components/reui/icon-tile.js +8 -1
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/phone-input.js +1 -1
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/sortable.js +13 -11
- package/dist/components/reui/sortable.js.map +1 -1
- package/dist/components/reui/tree.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.js +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/questionnaire.d.ts +21 -0
- package/dist/components/ui/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire.js +164 -0
- package/dist/components/ui/questionnaire.js.map +1 -0
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/{copy-menu-BJ-MXnkN.js → copy-menu-Bk5GP9Gp.js} +3 -3
- package/dist/{copy-menu-BJ-MXnkN.js.map → copy-menu-Bk5GP9Gp.js.map} +1 -1
- package/dist/hooks/use-body-classes.d.ts +0 -3
- package/dist/hooks/use-body-classes.d.ts.map +1 -1
- package/dist/hooks/use-body-classes.js +0 -3
- package/dist/hooks/use-body-classes.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +0 -3
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +0 -3
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
- package/dist/hooks/use-file-upload.js +6 -4
- package/dist/hooks/use-file-upload.js.map +1 -1
- package/dist/hooks/use-hydrated.d.ts +0 -10
- package/dist/hooks/use-hydrated.d.ts.map +1 -1
- package/dist/hooks/use-hydrated.js +0 -10
- package/dist/hooks/use-hydrated.js.map +1 -1
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -1
- package/dist/hooks/use-intersection-observer.js +0 -5
- package/dist/hooks/use-intersection-observer.js.map +1 -1
- package/dist/hooks/use-is-mac.d.ts +0 -5
- package/dist/hooks/use-is-mac.d.ts.map +1 -1
- package/dist/hooks/use-is-mac.js +0 -5
- package/dist/hooks/use-is-mac.js.map +1 -1
- package/dist/hooks/use-media-query.d.ts +0 -5
- package/dist/hooks/use-media-query.d.ts.map +1 -1
- package/dist/hooks/use-media-query.js +0 -5
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-meta-color.d.ts.map +1 -1
- package/dist/hooks/use-meta-color.js +0 -3
- package/dist/hooks/use-meta-color.js.map +1 -1
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -1
- package/dist/hooks/use-mutation-observer.js +0 -5
- package/dist/hooks/use-mutation-observer.js.map +1 -1
- package/dist/hooks/use-scroll-position.d.ts.map +1 -1
- package/dist/hooks/use-scroll-position.js +0 -5
- package/dist/hooks/use-scroll-position.js.map +1 -1
- package/dist/hooks/use-slider-input.d.ts.map +1 -1
- package/dist/hooks/use-slider-input.js +0 -5
- package/dist/hooks/use-slider-input.js.map +1 -1
- package/dist/hooks/use-viewport.d.ts +0 -5
- package/dist/hooks/use-viewport.d.ts.map +1 -1
- package/dist/hooks/use-viewport.js +0 -5
- package/dist/hooks/use-viewport.js.map +1 -1
- package/dist/lib/favicon.d.ts +5 -0
- package/dist/lib/favicon.d.ts.map +1 -0
- package/dist/lib/favicon.js +12 -0
- package/dist/lib/favicon.js.map +1 -0
- package/dist/lib/text-shimmer.d.ts +8 -0
- package/dist/lib/text-shimmer.d.ts.map +1 -0
- package/dist/lib/text-shimmer.js +10 -0
- package/dist/lib/text-shimmer.js.map +1 -0
- package/dist/types-j36vVGtZ.d.ts +78 -0
- package/dist/types-j36vVGtZ.d.ts.map +1 -0
- package/package.json +18 -13
- package/dist/components/ui/sonner.d.ts +0 -7
- package/dist/components/ui/sonner.d.ts.map +0 -1
- package/dist/components/ui/sonner.js +0 -32
- package/dist/components/ui/sonner.js.map +0 -1
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
//#region src/hooks/use-intersection-observer.ts
|
|
4
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
5
|
* A shared intersection observer to manage multiple targets with a single observer instance.
|
|
11
6
|
* Optimized for high-density lists (like the patterns grid).
|
|
12
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intersection-observer.js","names":["React"],"sources":["../../src/hooks/use-intersection-observer.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-intersection-observer.js","names":["React"],"sources":["../../src/hooks/use-intersection-observer.ts"],"sourcesContent":["\"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":";;;;;;;AAyBA,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"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
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
2
|
/**
|
|
8
3
|
* React hook that returns whether the current browser reports a macOS platform.
|
|
9
4
|
* It prefers `navigator.userAgentData.platform` when available and falls back
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-is-mac.d.ts","names":[],"sources":["../../src/hooks/use-is-mac.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-is-mac.d.ts","names":[],"sources":["../../src/hooks/use-is-mac.ts"],"mappings":";;;;;;;;;;;;;;;;;;;iBAsBgB"}
|
package/dist/hooks/use-is-mac.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
//#region src/hooks/use-is-mac.ts
|
|
4
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
5
|
* React hook that returns whether the current browser reports a macOS platform.
|
|
11
6
|
* It prefers `navigator.userAgentData.platform` when available and falls back
|
|
12
7
|
* to `navigator.userAgent`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-is-mac.js","names":[],"sources":["../../src/hooks/use-is-mac.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-is-mac.js","names":[],"sources":["../../src/hooks/use-is-mac.ts"],"sourcesContent":["\"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":";;;;;;;;;;;;;;;;;;;;;AAsBA,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"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
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
2
|
/**
|
|
8
3
|
* Hook for tracking CSS media query matches in React components
|
|
9
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-media-query.d.ts","names":[],"sources":["../../src/hooks/use-media-query.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-media-query.d.ts","names":[],"sources":["../../src/hooks/use-media-query.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCa,gBAAiB"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import { useCallback, useSyncExternalStore } from "react";
|
|
3
3
|
//#region src/hooks/use-media-query.ts
|
|
4
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
5
|
* Hook for tracking CSS media query matches in React components
|
|
11
6
|
*
|
|
12
7
|
* Features:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-media-query.js","names":[],"sources":["../../src/hooks/use-media-query.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-media-query.js","names":[],"sources":["../../src/hooks/use-media-query.ts"],"sourcesContent":["\"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-meta-color.d.ts","names":[],"sources":["../../src/hooks/use-meta-color.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-meta-color.d.ts","names":[],"sources":["../../src/hooks/use-meta-color.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0EgB,aAAa,uBAAuB;;;;EAqDH,eAAA"}
|
|
@@ -4,9 +4,6 @@ import { META_THEME_COLORS, THEME_MODES } from "@kumix/utils";
|
|
|
4
4
|
import { useTheme } from "next-themes";
|
|
5
5
|
//#region src/hooks/use-meta-color.ts
|
|
6
6
|
/**
|
|
7
|
-
* Meta theme color management hook for React components.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
7
|
* Calculates and applies the HTML `theme-color` meta tag from `next-themes`.
|
|
11
8
|
* The returned setter can be used for temporary manual overrides.
|
|
12
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-meta-color.js","names":["React"],"sources":["../../src/hooks/use-meta-color.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-meta-color.js","names":["React"],"sources":["../../src/hooks/use-meta-color.ts"],"sourcesContent":["\"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mutation-observer.d.ts","names":[],"sources":["../../src/hooks/use-mutation-observer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-mutation-observer.d.ts","names":[],"sources":["../../src/hooks/use-mutation-observer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0Ea,sBACX,KAAK,QAAM,UAAU,qBACrB,UAAU,kBACV,UAAS"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
//#region src/hooks/use-mutation-observer.ts
|
|
4
4
|
/**
|
|
5
|
-
* DOM Mutation Observer hook for React components
|
|
6
|
-
* Provides a React-friendly interface for observing DOM changes
|
|
7
|
-
* with automatic cleanup and ref integration
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
5
|
* Default options for MutationObserver
|
|
11
6
|
* Observes all types of mutations by default
|
|
12
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mutation-observer.js","names":[],"sources":["../../src/hooks/use-mutation-observer.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-mutation-observer.js","names":[],"sources":["../../src/hooks/use-mutation-observer.ts"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\n/**\n * Default options for MutationObserver\n * Observes all types of mutations by default\n */\nconst DEFAULT_OPTIONS: MutationObserverInit = {\n /** Watch for attribute changes */\n attributes: true,\n /** Watch for text content changes */\n characterData: true,\n /** Watch for child element additions/removals */\n childList: true,\n /** Watch for changes in descendant elements */\n subtree: true,\n};\n\n/**\n * Hook to observe DOM mutations on a referenced element\n *\n * This hook provides a React-friendly way to use the MutationObserver API.\n * It automatically handles observer creation, cleanup, and ref management.\n * Useful for detecting DOM changes that occur outside of React's control.\n *\n * Features:\n * - Automatic observer lifecycle management\n * - Configurable observation options\n * - Ref-based element targeting\n * - Automatic cleanup on unmount\n *\n * @param ref - React ref pointing to the element to observe\n * @param callback - Function called when mutations are detected\n * @param options - MutationObserver configuration options\n *\n * @example\n * ```tsx\n * function DynamicContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n *\n * // Watch for any changes to the content div\n * useMutationObserver(\n * contentRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * console.log('DOM changed:', mutation.type);\n * });\n * }\n * );\n *\n * return <div ref={contentRef}>Dynamic content here</div>;\n * }\n *\n * // Watch only for attribute changes\n * function AttributeWatcher() {\n * const elementRef = useRef<HTMLElement>(null);\n *\n * useMutationObserver(\n * elementRef,\n * (mutations) => {\n * mutations.forEach((mutation) => {\n * if (mutation.type === 'attributes') {\n * console.log('Attribute changed:', mutation.attributeName);\n * }\n * });\n * },\n * { attributes: true, childList: false, subtree: false }\n * );\n *\n * return <div ref={elementRef}>Watched element</div>;\n * }\n * ```\n */\nexport const useMutationObserver = (\n ref: React.RefObject<HTMLElement | null>,\n callback: MutationCallback,\n options: MutationObserverInit = DEFAULT_OPTIONS,\n) => {\n React.useEffect(() => {\n // Only proceed if ref has a current element\n if (ref.current) {\n // Create new MutationObserver instance\n const observer = new MutationObserver(callback);\n\n // Start observing the target element\n observer.observe(ref.current, options);\n\n // Cleanup function to disconnect observer\n return () => {\n observer.disconnect();\n };\n }\n }, [ref, callback, options]); // Re-run effect when dependencies change\n};\n"],"mappings":";;;;;;;AAQA,MAAM,kBAAwC;;CAE5C,YAAY;;CAEZ,eAAe;;CAEf,WAAW;;CAEX,SAAS;AACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,MAAa,uBACX,KACA,UACA,UAAgC,oBAC7B;CACH,QAAM,gBAAgB;EAEpB,IAAI,IAAI,SAAS;GAEf,MAAM,WAAW,IAAI,iBAAiB,QAAQ;GAG9C,SAAS,QAAQ,IAAI,SAAS,OAAO;GAGrC,aAAa;IACX,SAAS,WAAW;GACtB;EACF;CACF,GAAG;EAAC;EAAK;EAAU;CAAO,CAAC;AAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-position.d.ts","names":[],"sources":["../../src/hooks/use-scroll-position.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"use-scroll-position.d.ts","names":[],"sources":["../../src/hooks/use-scroll-position.ts"],"mappings":";;;;;UAOU;;EAER,YAAY,UAAU,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkEzB,sBAAqB,cAAe"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
//#region src/hooks/use-scroll-position.ts
|
|
4
4
|
/**
|
|
5
|
-
* Scroll position tracking hook for React components
|
|
6
|
-
* Monitors scroll position of window or specific elements
|
|
7
|
-
* with real-time updates and automatic cleanup
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
5
|
* Hook to track scroll position of window or specific elements
|
|
11
6
|
*
|
|
12
7
|
* This hook provides real-time tracking of scroll position with support
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-position.js","names":[],"sources":["../../src/hooks/use-scroll-position.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-scroll-position.js","names":[],"sources":["../../src/hooks/use-scroll-position.ts"],"sourcesContent":["\"use client\";\n\nimport { type RefObject, useEffect, useState } from \"react\";\n\n/**\n * Configuration options for the scroll position hook\n */\ninterface UseScrollPositionProps {\n /** Optional ref to a specific scrollable element (defaults to document) */\n targetRef?: RefObject<HTMLElement | Document | undefined>;\n}\n\n/**\n * Hook to track scroll position of window or specific elements\n *\n * This hook provides real-time tracking of scroll position with support\n * for both window scrolling and element-specific scrolling. It automatically\n * handles event listener management and cleanup.\n *\n * Features:\n * - Real-time scroll position tracking\n * - Support for window and element scrolling\n * - Automatic event listener cleanup\n * - SSR-safe implementation\n * - Performance optimized\n *\n * @param options - Configuration options for the hook\n * @returns Current scroll position in pixels\n *\n * @example\n * ```tsx\n * // Track window scroll position\n * function ScrollIndicator() {\n * const scrollPosition = useScrollPosition();\n *\n * return (\n * <div className=\"scroll-indicator\">\n * Scrolled: {scrollPosition}px\n * </div>\n * );\n * }\n *\n * // Track specific element scroll position\n * function ScrollableContent() {\n * const contentRef = useRef<HTMLDivElement>(null);\n * const scrollPosition = useScrollPosition({ targetRef: contentRef });\n *\n * return (\n * <div\n * ref={contentRef}\n * className=\"h-96 overflow-y-auto\"\n * >\n * <div className=\"h-[1000px]\">\n * <p>Scroll position: {scrollPosition}px</p>\n * <p>Long content here...</p>\n * </div>\n * </div>\n * );\n * }\n *\n * // Show/hide header based on scroll\n * function StickyHeader() {\n * const scrollPosition = useScrollPosition();\n * const isVisible = scrollPosition < 100;\n *\n * return (\n * <header className={`transition-transform ${\n * isVisible ? 'translate-y-0' : '-translate-y-full'\n * }`}>\n * Header content\n * </header>\n * );\n * }\n * ```\n */\nexport const useScrollPosition = ({ targetRef }: UseScrollPositionProps = {}): number => {\n /** State to track current scroll position */\n const [scrollPosition, setScrollPosition] = useState<number>(0);\n\n useEffect(() => {\n // Determine the target element (fallback to document if not provided)\n const target = targetRef?.current || document;\n\n // Determine the scrollable element (window for document, element for others)\n const scrollable = target === document ? window : target;\n\n /**\n * Update scroll position state\n * Handles both window and element scrolling\n */\n const updatePosition = () => {\n // Get scroll position based on target type\n const scrollY =\n target === document\n ? window.scrollY || window.pageYOffset // Fallback for older browsers\n : (target as HTMLElement).scrollTop;\n\n setScrollPosition(scrollY);\n };\n\n // Add scroll event listener\n scrollable.addEventListener(\"scroll\", updatePosition, { passive: true });\n\n // Set initial scroll position\n updatePosition();\n\n // Cleanup function to remove event listener\n return () => {\n scrollable.removeEventListener(\"scroll\", updatePosition);\n };\n }, [targetRef]); // Re-run effect when targetRef changes\n\n return scrollPosition;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,MAAa,qBAAqB,EAAE,cAAsC,CAAC,MAAc;;CAEvF,MAAM,CAAC,gBAAgB,qBAAqB,SAAiB,CAAC;CAE9D,gBAAgB;EAEd,MAAM,SAAS,WAAW,WAAW;EAGrC,MAAM,aAAa,WAAW,WAAW,SAAS;;;;;EAMlD,MAAM,uBAAuB;GAE3B,MAAM,UACJ,WAAW,WACP,OAAO,WAAW,OAAO,cACxB,OAAuB;GAE9B,kBAAkB,OAAO;EAC3B;EAGA,WAAW,iBAAiB,UAAU,gBAAgB,EAAE,SAAS,KAAK,CAAC;EAGvE,eAAe;EAGf,aAAa;GACX,WAAW,oBAAoB,UAAU,cAAc;EACzD;CACF,GAAG,CAAC,SAAS,CAAC;CAEd,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slider-input.d.ts","names":[],"sources":["../../src/hooks/use-slider-input.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"use-slider-input.d.ts","names":[],"sources":["../../src/hooks/use-slider-input.ts"],"mappings":";;;;;UAQU;;EAER;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiEc,iBAAiB,UAAU,UAAU,gBAAgB;;;;;;;;;;EAanB,qBAAA;;EAa1C,oBAAA,GAAA,QAAM,YAAY,mBAAiB;;EAsB/B,yBAAA,eAAM"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
//#region src/hooks/use-slider-input.ts
|
|
4
4
|
/**
|
|
5
|
-
* Dual slider input management hook for React components
|
|
6
|
-
* Provides synchronized state management between range slider and number inputs
|
|
7
|
-
* with validation and boundary enforcement
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
5
|
* Hook for managing dual slider input with synchronized state
|
|
11
6
|
*
|
|
12
7
|
* This hook provides state management for components that need both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slider-input.js","names":[],"sources":["../../src/hooks/use-slider-input.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-slider-input.js","names":[],"sources":["../../src/hooks/use-slider-input.ts"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport { useCallback, useState } from \"react\";\n\n/**\n * Configuration options for the slider input hook\n */\ninterface UseSliderInputProps {\n /** Minimum allowed value for the range */\n minValue: number;\n /** Maximum allowed value for the range */\n maxValue: number;\n /** Initial values for the range [min, max] */\n initialValue: [number, number];\n}\n\n/**\n * Hook for managing dual slider input with synchronized state\n *\n * This hook provides state management for components that need both\n * a range slider and corresponding number inputs. It handles synchronization\n * between the two input types, validation, and boundary enforcement.\n *\n * Features:\n * - Synchronized slider and input values\n * - Automatic validation and boundary enforcement\n * - Prevents invalid range configurations (min > max)\n * - Optimized with useCallback for performance\n *\n * @param props - Configuration options for the hook\n * @returns Object containing state and handlers for slider and inputs\n *\n * @example\n * ```tsx\n * function PriceRangeFilter() {\n * const {\n * sliderValues,\n * inputValues,\n * handleSliderChange,\n * handleInputChange,\n * validateAndUpdateValue\n * } = useSliderInput({\n * minValue: 0,\n * maxValue: 1000,\n * initialValue: [100, 500]\n * });\n *\n * return (\n * <div className=\"price-range\">\n * <div className=\"inputs\">\n * <input\n * type=\"number\"\n * value={inputValues[0]}\n * onChange={(e) => handleInputChange(e, 0)}\n * onBlur={() => validateAndUpdateValue(inputValues[0], 0)}\n * placeholder=\"Min price\"\n * />\n * <input\n * type=\"number\"\n * value={inputValues[1]}\n * onChange={(e) => handleInputChange(e, 1)}\n * onBlur={() => validateAndUpdateValue(inputValues[1], 1)}\n * placeholder=\"Max price\"\n * />\n * </div>\n *\n * <Slider\n * value={sliderValues}\n * onValueChange={handleSliderChange}\n * min={0}\n * max={1000}\n * step={10}\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps) {\n /** State for slider component values */\n const [sliderValues, setSliderValues] = useState<[number, number]>(initialValue);\n\n /** State for input field values (may temporarily differ from slider) */\n const [inputValues, setInputValues] = useState<[number, number]>(initialValue);\n\n /**\n * Handle slider value changes and sync with input values\n * Called when user interacts with the range slider\n *\n * @param values - New slider values [min, max]\n */\n const handleSliderChange = useCallback((values: [number, number]) => {\n setSliderValues(values);\n setInputValues(values); // Keep inputs in sync with slider\n }, []);\n\n /**\n * Handle input field changes\n * Updates input state without immediately affecting slider\n *\n * @param e - Input change event\n * @param index - Index of the input (0 for min, 1 for max)\n */\n const handleInputChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>, index: 0 | 1) => {\n const newValue = parseFloat(e.target.value);\n\n // Only update if the value is a valid number\n if (!Number.isNaN(newValue)) {\n const updatedInputs = [...inputValues] as [number, number];\n updatedInputs[index] = newValue;\n setInputValues(updatedInputs);\n }\n },\n [inputValues],\n );\n\n /**\n * Validate and update slider values from input\n * Called when input loses focus or user presses Enter\n * Enforces boundaries and prevents invalid ranges\n *\n * @param value - Value to validate and apply\n * @param index - Index of the value (0 for min, 1 for max)\n */\n const validateAndUpdateValue = useCallback(\n (value: number, index: 0 | 1) => {\n const updatedSlider = [...sliderValues] as [number, number];\n\n if (index === 0) {\n // Validate minimum value\n // Ensure it's not less than minValue and not greater than current max\n updatedSlider[0] = Math.max(minValue, Math.min(value, sliderValues[1]));\n } else {\n // Validate maximum value\n // Ensure it's not greater than maxValue and not less than current min\n updatedSlider[1] = Math.min(maxValue, Math.max(value, sliderValues[0]));\n }\n\n // Update both slider and input values to validated values\n setSliderValues(updatedSlider);\n setInputValues(updatedSlider);\n },\n [sliderValues, minValue, maxValue],\n );\n\n return {\n /** Function to manually set slider values */\n setSliderValues,\n /** Function to manually set input values */\n setInputValues,\n /** Current slider values [min, max] */\n sliderValues,\n /** Current input values [min, max] */\n inputValues,\n /** Handler for slider value changes */\n handleSliderChange,\n /** Handler for input field changes */\n handleInputChange,\n /** Function to validate and update values from inputs */\n validateAndUpdateValue,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,eAAe,EAAE,UAAU,UAAU,gBAAqC;;CAExF,MAAM,CAAC,cAAc,mBAAmB,SAA2B,YAAY;;CAG/E,MAAM,CAAC,aAAa,kBAAkB,SAA2B,YAAY;CA+D7E,OAAO;;EAEL;;EAEA;;EAEA;;EAEA;;EAEA,oBAjEyB,aAAa,WAA6B;GACnE,gBAAgB,MAAM;GACtB,eAAe,MAAM;EACvB,GAAG,CAAC,CA8De;;EAEjB,mBAvDwB,aACvB,GAAwC,UAAiB;GACxD,MAAM,WAAW,WAAW,EAAE,OAAO,KAAK;GAG1C,IAAI,CAAC,OAAO,MAAM,QAAQ,GAAG;IAC3B,MAAM,gBAAgB,CAAC,GAAG,WAAW;IACrC,cAAc,SAAS;IACvB,eAAe,aAAa;GAC9B;EACF,GACA,CAAC,WAAW,CA4CI;;EAEhB,wBAnC6B,aAC5B,OAAe,UAAiB;GAC/B,MAAM,gBAAgB,CAAC,GAAG,YAAY;GAEtC,IAAI,UAAU,GAGZ,cAAc,KAAK,KAAK,IAAI,UAAU,KAAK,IAAI,OAAO,aAAa,EAAE,CAAC;QAItE,cAAc,KAAK,KAAK,IAAI,UAAU,KAAK,IAAI,OAAO,aAAa,EAAE,CAAC;GAIxE,gBAAgB,aAAa;GAC7B,eAAe,aAAa;EAC9B,GACA;GAAC;GAAc;GAAU;EAAQ,CAiBZ;CACvB;AACF"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
//#region src/hooks/use-viewport.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Viewport dimensions tracking hook for React components
|
|
4
|
-
* Provides real-time viewport width and height with automatic updates
|
|
5
|
-
* on window resize events with SSR-safe implementation
|
|
6
|
-
*/
|
|
7
2
|
/**
|
|
8
3
|
* Type definition for viewport dimensions
|
|
9
4
|
* Returns tuple of [width, height] in pixels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-viewport.d.ts","names":[],"sources":["../../src/hooks/use-viewport.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-viewport.d.ts","names":[],"sources":["../../src/hooks/use-viewport.ts"],"mappings":";;;;;KAQK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2DQ,mBAAkB"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
//#region src/hooks/use-viewport.ts
|
|
4
4
|
/**
|
|
5
|
-
* Viewport dimensions tracking hook for React components
|
|
6
|
-
* Provides real-time viewport width and height with automatic updates
|
|
7
|
-
* on window resize events with SSR-safe implementation
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
5
|
* Hook to track viewport dimensions with real-time updates
|
|
11
6
|
*
|
|
12
7
|
* This hook provides the current viewport dimensions and automatically
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-viewport.js","names":[],"sources":["../../src/hooks/use-viewport.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"use-viewport.js","names":[],"sources":["../../src/hooks/use-viewport.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Type definition for viewport dimensions\n * Returns tuple of [width, height] in pixels\n */\ntype ViewportDimensions = [number, number];\n\n/**\n * Hook to track viewport dimensions with real-time updates\n *\n * This hook provides the current viewport dimensions and automatically\n * updates when the window is resized. It's useful for responsive layouts,\n * conditional rendering based on screen size, and dynamic calculations.\n *\n * Features:\n * - Real-time viewport dimension tracking\n * - Automatic updates on window resize\n * - Performance optimized with passive event listeners\n * - SSR-safe implementation\n * - Returns both width and height\n *\n * @returns Tuple containing [width, height] in pixels\n *\n * @example\n * ```tsx\n * // Basic usage\n * function ResponsiveComponent() {\n * const [width, height] = useViewport();\n *\n * return (\n * <div>\n * <p>Viewport: {width}x{height}</p>\n * {width > 768 ? <DesktopLayout /> : <MobileLayout />}\n * </div>\n * );\n * }\n *\n * // Destructured usage\n * function ViewportInfo() {\n * const [width, height] = useViewport();\n * const aspectRatio = (width / height).toFixed(2);\n *\n * return (\n * <div className=\"viewport-info\">\n * <p>Width: {width}px</p>\n * <p>Height: {height}px</p>\n * <p>Aspect Ratio: {aspectRatio}</p>\n * </div>\n * );\n * }\n *\n * // Conditional rendering based on viewport\n * function AdaptiveGrid() {\n * const [width] = useViewport();\n * const columns = width > 1200 ? 4 : width > 768 ? 3 : width > 480 ? 2 : 1;\n *\n * return (\n * <div className={`grid grid-cols-${columns} gap-4`}>\n * {items.map(item => <GridItem key={item.id} {...item} />)}\n * </div>\n * );\n * }\n * ```\n */\nexport const useViewport = (): ViewportDimensions => {\n /**\n * State to track viewport dimensions\n * Initialized with current window dimensions or fallback for SSR\n */\n const [dimensions, setDimensions] = useState<ViewportDimensions>([0, 0]);\n\n useEffect(() => {\n /**\n * Handle window resize events\n * Updates dimensions state with current viewport size\n */\n const handleResize = (): void => {\n setDimensions([window.innerWidth, window.innerHeight]);\n };\n\n // Set initial dimensions on mount (for SSR hydration)\n handleResize();\n\n // Add resize event listener with passive option for better performance\n window.addEventListener(\"resize\", handleResize, { passive: true });\n\n // Cleanup function to remove event listener\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []); // Empty dependency array - effect runs once on mount\n\n return dimensions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAa,oBAAwC;;;;;CAKnD,MAAM,CAAC,YAAY,iBAAiB,SAA6B,CAAC,GAAG,CAAC,CAAC;CAEvE,gBAAgB;;;;;EAKd,MAAM,qBAA2B;GAC/B,cAAc,CAAC,OAAO,YAAY,OAAO,WAAW,CAAC;EACvD;EAGA,aAAa;EAGb,OAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,KAAK,CAAC;EAGjE,aAAa;GACX,OAAO,oBAAoB,UAAU,YAAY;EACnD;CACF,GAAG,CAAC,CAAC;CAEL,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"favicon.d.ts","names":[],"sources":["../../src/lib/favicon.ts"],"mappings":";iBAAgB,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"favicon.js","names":[],"sources":["../../src/lib/favicon.ts"],"sourcesContent":["export function getFaviconUrl(value: string) {\n try {\n return new URL(\"/favicon.ico\", value).toString();\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAgB,cAAc,OAAe;CAC3C,IAAI;EACF,OAAO,IAAI,IAAI,gBAAgB,KAAK,CAAC,CAAC,SAAS;CACjD,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
//#region src/lib/text-shimmer.d.ts
|
|
3
|
+
declare const TEXT_SHIMMER_KEYFRAMES = "@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}";
|
|
4
|
+
declare const TEXT_SHIMMER_CLASS_NAME = "bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]";
|
|
5
|
+
declare function textShimmerStyle(duration: number): CSSProperties;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { TEXT_SHIMMER_CLASS_NAME, TEXT_SHIMMER_KEYFRAMES, textShimmerStyle };
|
|
8
|
+
//# sourceMappingURL=text-shimmer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-shimmer.d.ts","names":[],"sources":["../../src/lib/text-shimmer.ts"],"mappings":";;cAEa;cAGA;iBAGG,iBAAiB,mBAAmB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/lib/text-shimmer.ts
|
|
2
|
+
const TEXT_SHIMMER_KEYFRAMES = "@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}";
|
|
3
|
+
const TEXT_SHIMMER_CLASS_NAME = "bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]";
|
|
4
|
+
function textShimmerStyle(duration) {
|
|
5
|
+
return { animation: `beui-text-shimmer ${duration}s linear infinite` };
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { TEXT_SHIMMER_CLASS_NAME, TEXT_SHIMMER_KEYFRAMES, textShimmerStyle };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=text-shimmer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-shimmer.js","names":[],"sources":["../../src/lib/text-shimmer.ts"],"sourcesContent":["import type { CSSProperties } from \"react\";\n\nexport const TEXT_SHIMMER_KEYFRAMES =\n \"@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}\";\n\nexport const TEXT_SHIMMER_CLASS_NAME =\n \"bg-[length:200%_100%] bg-clip-text text-transparent bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]\";\n\nexport function textShimmerStyle(duration: number): CSSProperties {\n return {\n animation: `beui-text-shimmer ${duration}s linear infinite`,\n };\n}\n"],"mappings":";AAEA,MAAa,yBACX;AAEF,MAAa,0BACX;AAEF,SAAgB,iBAAiB,UAAiC;CAChE,OAAO,EACL,WAAW,qBAAqB,SAAS,mBAC3C;AACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/components/agents/agent-activity/types.d.ts
|
|
3
|
+
type AgentActivityStatus = "working" | "complete";
|
|
4
|
+
type AgentStepStatus = "pending" | "active" | "complete";
|
|
5
|
+
interface AgentActivityStep {
|
|
6
|
+
id: string;
|
|
7
|
+
type: "step";
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
status?: AgentStepStatus;
|
|
10
|
+
meta?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface AgentActivityText {
|
|
13
|
+
id: string;
|
|
14
|
+
type: "text";
|
|
15
|
+
content: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
interface AgentSearchResult {
|
|
18
|
+
id: string;
|
|
19
|
+
title: ReactNode;
|
|
20
|
+
domain?: ReactNode;
|
|
21
|
+
url?: string;
|
|
22
|
+
icon?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
interface AgentActivitySearch {
|
|
25
|
+
id: string;
|
|
26
|
+
type: "search";
|
|
27
|
+
query: ReactNode;
|
|
28
|
+
results?: AgentSearchResult[];
|
|
29
|
+
moreCount?: number;
|
|
30
|
+
}
|
|
31
|
+
interface AgentActivityTool {
|
|
32
|
+
id: string;
|
|
33
|
+
type: "tool";
|
|
34
|
+
action: "read" | "edit" | "run" | (string & {});
|
|
35
|
+
target: ReactNode;
|
|
36
|
+
additions?: number;
|
|
37
|
+
deletions?: number;
|
|
38
|
+
}
|
|
39
|
+
type AgentTraceKind = "thinking" | "message" | "write" | "run" | "read" | (string & {});
|
|
40
|
+
interface AgentActivityTrace {
|
|
41
|
+
id: string;
|
|
42
|
+
type: "trace";
|
|
43
|
+
kind: AgentTraceKind;
|
|
44
|
+
label: ReactNode;
|
|
45
|
+
detail?: ReactNode;
|
|
46
|
+
icon?: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
type AgentActivityItem = AgentActivityStep | AgentActivityText | AgentActivitySearch | AgentActivityTool | AgentActivityTrace;
|
|
49
|
+
type AgentActivityContentType = AgentActivityItem["type"] | "mixed";
|
|
50
|
+
interface AgentActivityProps {
|
|
51
|
+
/** Chronological activity entries. Append or update items as events stream. */
|
|
52
|
+
items: AgentActivityItem[];
|
|
53
|
+
/** Expected activity kind before the first streamed item arrives. */
|
|
54
|
+
contentType?: AgentActivityContentType;
|
|
55
|
+
/** Current run phase. Active runs always stay expanded. */
|
|
56
|
+
status?: AgentActivityStatus;
|
|
57
|
+
/** Elapsed run time, in seconds. Used by the step-only summary. */
|
|
58
|
+
duration?: number;
|
|
59
|
+
/** Controlled expanded state used after the run completes. */
|
|
60
|
+
open?: boolean;
|
|
61
|
+
/** Initial expanded state used after the run completes. */
|
|
62
|
+
defaultOpen?: boolean;
|
|
63
|
+
/** Called when the completed activity disclosure changes state. */
|
|
64
|
+
onOpenChange?: (open: boolean) => void;
|
|
65
|
+
/** Collapse the disclosure when status changes from working to complete. */
|
|
66
|
+
collapseOnComplete?: boolean;
|
|
67
|
+
/** Optional label shown while the run is active. */
|
|
68
|
+
activeLabel?: ReactNode;
|
|
69
|
+
/** Optional completed summary. Derived from the item types by default. */
|
|
70
|
+
summary?: ReactNode;
|
|
71
|
+
/** Maximum visible activity height before the stream begins gliding. */
|
|
72
|
+
maxHeight?: number;
|
|
73
|
+
className?: string;
|
|
74
|
+
contentClassName?: string;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { AgentActivityStatus as a, AgentActivityTool as c, AgentStepStatus as d, AgentTraceKind as f, AgentActivitySearch as i, AgentActivityTrace as l, AgentActivityItem as n, AgentActivityStep as o, AgentActivityProps as r, AgentActivityText as s, AgentActivityContentType as t, AgentSearchResult as u };
|
|
78
|
+
//# sourceMappingURL=types-j36vVGtZ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-j36vVGtZ.d.ts","names":[],"sources":["../src/components/agents/agent-activity/types.ts"],"mappings":";;KAEY;KACA;UAEK;EACf;EACA;EACA,OAAO;EACP,SAAS;EACT,OAAO;;UAGQ;EACf;EACA;EACA,SAAS;;UAGM;EACf;EACA,OAAO;EACP,SAAS;EACT;EACA,OAAO;;UAGQ;EACf;EACA;EACA,OAAO;EACP,UAAU;EACV;;UAGe;EACf;EACA;EACA;EACA,QAAQ;EACR;EACA;;KAGU;UAEK;EACf;EACA;EACA,MAAM;EACN,OAAO;EACP,SAAS;EACT,OAAO;;KAGG,oBACR,oBACA,oBACA,sBACA,oBACA;KAEQ,2BAA2B;UAEtB;;EAEf,OAAO;;EAEP,cAAc;;EAEd,SAAS;;EAET;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB;;EAEA,cAAc;;EAEd,UAAU;;EAEV;EACA;EACA"}
|