@thalavaisankar/atoms 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +196 -2
- package/THIRD_PARTY_NOTICES.md +275 -0
- package/dist/blocks/index.d.mts +2 -0
- package/dist/blocks/index.mjs +1 -0
- package/dist/blocks/index.mjs.map +1 -0
- package/dist/components/ui/accordion/accordion.mjs +194 -0
- package/dist/components/ui/accordion/accordion.mjs.map +1 -0
- package/dist/components/ui/accordion/index.mjs +15 -0
- package/dist/components/ui/accordion/index.mjs.map +1 -0
- package/dist/components/ui/activity-feed/activity-feed.mjs +287 -0
- package/dist/components/ui/activity-feed/activity-feed.mjs.map +1 -0
- package/dist/components/ui/activity-feed/index.mjs +39 -0
- package/dist/components/ui/activity-feed/index.mjs.map +1 -0
- package/dist/components/ui/alert/alert.mjs +128 -0
- package/dist/components/ui/alert/alert.mjs.map +1 -0
- package/dist/components/ui/alert/index.mjs +17 -0
- package/dist/components/ui/alert/index.mjs.map +1 -0
- package/dist/components/ui/animated-label/animated-label.mjs +89 -0
- package/dist/components/ui/animated-label/animated-label.mjs.map +1 -0
- package/dist/components/ui/animated-label/index.mjs +9 -0
- package/dist/components/ui/animated-label/index.mjs.map +1 -0
- package/dist/components/ui/animated-number/animated-number.mjs +101 -0
- package/dist/components/ui/animated-number/animated-number.mjs.map +1 -0
- package/dist/components/ui/animated-number/index.mjs +5 -0
- package/dist/components/ui/animated-number/index.mjs.map +1 -0
- package/dist/components/ui/avatar/avatar.mjs +130 -0
- package/dist/components/ui/avatar/avatar.mjs.map +1 -0
- package/dist/components/ui/avatar/index.mjs +17 -0
- package/dist/components/ui/avatar/index.mjs.map +1 -0
- package/dist/components/ui/avatar-group/avatar-group.mjs +49 -0
- package/dist/components/ui/avatar-group/avatar-group.mjs.map +1 -0
- package/dist/components/ui/avatar-group/index.mjs +5 -0
- package/dist/components/ui/avatar-group/index.mjs.map +1 -0
- package/dist/components/ui/badge/badge-motion.mjs +108 -0
- package/dist/components/ui/badge/badge-motion.mjs.map +1 -0
- package/dist/components/ui/badge/badge.mjs +314 -0
- package/dist/components/ui/badge/badge.mjs.map +1 -0
- package/dist/components/ui/badge/index.mjs +27 -0
- package/dist/components/ui/badge/index.mjs.map +1 -0
- package/dist/components/ui/badge/readable-ink.mjs +36 -0
- package/dist/components/ui/badge/readable-ink.mjs.map +1 -0
- package/dist/components/ui/badge-group/badge-group.mjs +132 -0
- package/dist/components/ui/badge-group/badge-group.mjs.map +1 -0
- package/dist/components/ui/badge-group/index.mjs +5 -0
- package/dist/components/ui/badge-group/index.mjs.map +1 -0
- package/dist/components/ui/breadcrumb/breadcrumb.mjs +108 -0
- package/dist/components/ui/breadcrumb/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/breadcrumb/index.mjs +19 -0
- package/dist/components/ui/breadcrumb/index.mjs.map +1 -0
- package/dist/components/ui/button/button-variants.mjs +80 -0
- package/dist/components/ui/button/button-variants.mjs.map +1 -0
- package/dist/components/ui/button/button.mjs +74 -0
- package/dist/components/ui/button/button.mjs.map +1 -0
- package/dist/components/ui/button/index.mjs +17 -0
- package/dist/components/ui/button/index.mjs.map +1 -0
- package/dist/components/ui/button/social-button.mjs +45 -0
- package/dist/components/ui/button/social-button.mjs.map +1 -0
- package/dist/components/ui/button/social-logos.mjs +179 -0
- package/dist/components/ui/button/social-logos.mjs.map +1 -0
- package/dist/components/ui/button/split-button.mjs +72 -0
- package/dist/components/ui/button/split-button.mjs.map +1 -0
- package/dist/components/ui/button-group/button-group.mjs +58 -0
- package/dist/components/ui/button-group/button-group.mjs.map +1 -0
- package/dist/components/ui/button-group/index.mjs +11 -0
- package/dist/components/ui/button-group/index.mjs.map +1 -0
- package/dist/components/ui/card/card.mjs +131 -0
- package/dist/components/ui/card/card.mjs.map +1 -0
- package/dist/components/ui/card/index.mjs +23 -0
- package/dist/components/ui/card/index.mjs.map +1 -0
- package/dist/components/ui/chart/bar-list.mjs +87 -0
- package/dist/components/ui/chart/bar-list.mjs.map +1 -0
- package/dist/components/ui/chart/chart-colors.mjs +68 -0
- package/dist/components/ui/chart/chart-colors.mjs.map +1 -0
- package/dist/components/ui/chart/chart-geometry.mjs +152 -0
- package/dist/components/ui/chart/chart-geometry.mjs.map +1 -0
- package/dist/components/ui/chart/chart-specialized.mjs +194 -0
- package/dist/components/ui/chart/chart-specialized.mjs.map +1 -0
- package/dist/components/ui/chart/chart.mjs +648 -0
- package/dist/components/ui/chart/chart.mjs.map +1 -0
- package/dist/components/ui/chart/index.mjs +88 -0
- package/dist/components/ui/chart/index.mjs.map +1 -0
- package/dist/components/ui/chart/radial-meter.mjs +142 -0
- package/dist/components/ui/chart/radial-meter.mjs.map +1 -0
- package/dist/components/ui/chart/types.mjs +1 -0
- package/dist/components/ui/chart/types.mjs.map +1 -0
- package/dist/components/ui/checkbox/checkbox.mjs +183 -0
- package/dist/components/ui/checkbox/checkbox.mjs.map +1 -0
- package/dist/components/ui/checkbox/index.mjs +11 -0
- package/dist/components/ui/checkbox/index.mjs.map +1 -0
- package/dist/components/ui/checklist/checklist.mjs +353 -0
- package/dist/components/ui/checklist/checklist.mjs.map +1 -0
- package/dist/components/ui/checklist/index.mjs +33 -0
- package/dist/components/ui/checklist/index.mjs.map +1 -0
- package/dist/components/ui/chip/chip.mjs +202 -0
- package/dist/components/ui/chip/chip.mjs.map +1 -0
- package/dist/components/ui/chip/index.mjs +13 -0
- package/dist/components/ui/chip/index.mjs.map +1 -0
- package/dist/components/ui/chip-group/chip-group.mjs +204 -0
- package/dist/components/ui/chip-group/chip-group.mjs.map +1 -0
- package/dist/components/ui/chip-group/index.mjs +11 -0
- package/dist/components/ui/chip-group/index.mjs.map +1 -0
- package/dist/components/ui/code-snippet/code-highlighter.mjs +16 -0
- package/dist/components/ui/code-snippet/code-highlighter.mjs.map +1 -0
- package/dist/components/ui/code-snippet/code-snippet.mjs +437 -0
- package/dist/components/ui/code-snippet/code-snippet.mjs.map +1 -0
- package/dist/components/ui/code-snippet/index.mjs +17 -0
- package/dist/components/ui/code-snippet/index.mjs.map +1 -0
- package/dist/components/ui/code-snippet/labels.mjs +16 -0
- package/dist/components/ui/code-snippet/labels.mjs.map +1 -0
- package/dist/components/ui/code-snippet/tokenize.mjs +715 -0
- package/dist/components/ui/code-snippet/tokenize.mjs.map +1 -0
- package/dist/components/ui/code-snippet/types.mjs +1 -0
- package/dist/components/ui/code-snippet/types.mjs.map +1 -0
- package/dist/components/ui/collapsible/collapsible.mjs +85 -0
- package/dist/components/ui/collapsible/collapsible.mjs.map +1 -0
- package/dist/components/ui/collapsible/index.mjs +15 -0
- package/dist/components/ui/collapsible/index.mjs.map +1 -0
- package/dist/components/ui/color-picker/color-picker.mjs +852 -0
- package/dist/components/ui/color-picker/color-picker.mjs.map +1 -0
- package/dist/components/ui/color-picker/index.mjs +47 -0
- package/dist/components/ui/color-picker/index.mjs.map +1 -0
- package/dist/components/ui/combobox/combobox.mjs +745 -0
- package/dist/components/ui/combobox/combobox.mjs.map +1 -0
- package/dist/components/ui/combobox/index.mjs +27 -0
- package/dist/components/ui/combobox/index.mjs.map +1 -0
- package/dist/components/ui/command/command.mjs +439 -0
- package/dist/components/ui/command/command.mjs.map +1 -0
- package/dist/components/ui/command/index.mjs +31 -0
- package/dist/components/ui/command/index.mjs.map +1 -0
- package/dist/components/ui/compare-slider/compare-slider.mjs +335 -0
- package/dist/components/ui/compare-slider/compare-slider.mjs.map +1 -0
- package/dist/components/ui/compare-slider/index.mjs +17 -0
- package/dist/components/ui/compare-slider/index.mjs.map +1 -0
- package/dist/components/ui/context-menu/context-menu.mjs +184 -0
- package/dist/components/ui/context-menu/context-menu.mjs.map +1 -0
- package/dist/components/ui/context-menu/index.mjs +37 -0
- package/dist/components/ui/context-menu/index.mjs.map +1 -0
- package/dist/components/ui/data-table/active-filters.mjs +69 -0
- package/dist/components/ui/data-table/active-filters.mjs.map +1 -0
- package/dist/components/ui/data-table/body-row.mjs +118 -0
- package/dist/components/ui/data-table/body-row.mjs.map +1 -0
- package/dist/components/ui/data-table/cards.mjs +76 -0
- package/dist/components/ui/data-table/cards.mjs.map +1 -0
- package/dist/components/ui/data-table/data-table.mjs +680 -0
- package/dist/components/ui/data-table/data-table.mjs.map +1 -0
- package/dist/components/ui/data-table/empty.mjs +26 -0
- package/dist/components/ui/data-table/empty.mjs.map +1 -0
- package/dist/components/ui/data-table/expand.mjs +70 -0
- package/dist/components/ui/data-table/expand.mjs.map +1 -0
- package/dist/components/ui/data-table/faceted-filter.mjs +112 -0
- package/dist/components/ui/data-table/faceted-filter.mjs.map +1 -0
- package/dist/components/ui/data-table/features.mjs +96 -0
- package/dist/components/ui/data-table/features.mjs.map +1 -0
- package/dist/components/ui/data-table/grip.mjs +37 -0
- package/dist/components/ui/data-table/grip.mjs.map +1 -0
- package/dist/components/ui/data-table/header-cell.mjs +85 -0
- package/dist/components/ui/data-table/header-cell.mjs.map +1 -0
- package/dist/components/ui/data-table/index.mjs +55 -0
- package/dist/components/ui/data-table/index.mjs.map +1 -0
- package/dist/components/ui/data-table/labels.mjs +55 -0
- package/dist/components/ui/data-table/labels.mjs.map +1 -0
- package/dist/components/ui/data-table/load-more.mjs +56 -0
- package/dist/components/ui/data-table/load-more.mjs.map +1 -0
- package/dist/components/ui/data-table/move-item.mjs +11 -0
- package/dist/components/ui/data-table/move-item.mjs.map +1 -0
- package/dist/components/ui/data-table/persist.mjs +65 -0
- package/dist/components/ui/data-table/persist.mjs.map +1 -0
- package/dist/components/ui/data-table/selection-bar.mjs +51 -0
- package/dist/components/ui/data-table/selection-bar.mjs.map +1 -0
- package/dist/components/ui/data-table/tabs.mjs +48 -0
- package/dist/components/ui/data-table/tabs.mjs.map +1 -0
- package/dist/components/ui/data-table/toolbar.mjs +92 -0
- package/dist/components/ui/data-table/toolbar.mjs.map +1 -0
- package/dist/components/ui/data-table/use-reorder.mjs +239 -0
- package/dist/components/ui/data-table/use-reorder.mjs.map +1 -0
- package/dist/components/ui/data-table/use-reveal.mjs +24 -0
- package/dist/components/ui/data-table/use-reveal.mjs.map +1 -0
- package/dist/components/ui/data-table/use-table-state.mjs +38 -0
- package/dist/components/ui/data-table/use-table-state.mjs.map +1 -0
- package/dist/components/ui/data-table/view-options.mjs +66 -0
- package/dist/components/ui/data-table/view-options.mjs.map +1 -0
- package/dist/components/ui/date-picker/calendar.mjs +466 -0
- package/dist/components/ui/date-picker/calendar.mjs.map +1 -0
- package/dist/components/ui/date-picker/date-picker.mjs +366 -0
- package/dist/components/ui/date-picker/date-picker.mjs.map +1 -0
- package/dist/components/ui/date-picker/index.mjs +17 -0
- package/dist/components/ui/date-picker/index.mjs.map +1 -0
- package/dist/components/ui/date-picker/presets.mjs +49 -0
- package/dist/components/ui/date-picker/presets.mjs.map +1 -0
- package/dist/components/ui/description-list/description-list.mjs +40 -0
- package/dist/components/ui/description-list/description-list.mjs.map +1 -0
- package/dist/components/ui/description-list/index.mjs +15 -0
- package/dist/components/ui/description-list/index.mjs.map +1 -0
- package/dist/components/ui/dialog/dialog-stepper.mjs +23 -0
- package/dist/components/ui/dialog/dialog-stepper.mjs.map +1 -0
- package/dist/components/ui/dialog/dialog.mjs +343 -0
- package/dist/components/ui/dialog/dialog.mjs.map +1 -0
- package/dist/components/ui/dialog/focus-return.mjs +21 -0
- package/dist/components/ui/dialog/focus-return.mjs.map +1 -0
- package/dist/components/ui/dialog/index.mjs +33 -0
- package/dist/components/ui/dialog/index.mjs.map +1 -0
- package/dist/components/ui/divider/divider.mjs +130 -0
- package/dist/components/ui/divider/divider.mjs.map +1 -0
- package/dist/components/ui/divider/index.mjs +6 -0
- package/dist/components/ui/divider/index.mjs.map +1 -0
- package/dist/components/ui/dock/dock.mjs +444 -0
- package/dist/components/ui/dock/dock.mjs.map +1 -0
- package/dist/components/ui/dock/index.mjs +19 -0
- package/dist/components/ui/dock/index.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-actions.mjs +118 -0
- package/dist/components/ui/document-editor/block-actions.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-commands.mjs +182 -0
- package/dist/components/ui/document-editor/block-commands.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-handle.mjs +387 -0
- package/dist/components/ui/document-editor/block-handle.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-morph.mjs +95 -0
- package/dist/components/ui/document-editor/block-morph.mjs.map +1 -0
- package/dist/components/ui/document-editor/block-selection.mjs +81 -0
- package/dist/components/ui/document-editor/block-selection.mjs.map +1 -0
- package/dist/components/ui/document-editor/blocks.mjs +30 -0
- package/dist/components/ui/document-editor/blocks.mjs.map +1 -0
- package/dist/components/ui/document-editor/bubble-menu.mjs +120 -0
- package/dist/components/ui/document-editor/bubble-menu.mjs.map +1 -0
- package/dist/components/ui/document-editor/code-block.mjs +89 -0
- package/dist/components/ui/document-editor/code-block.mjs.map +1 -0
- package/dist/components/ui/document-editor/collaboration-types.mjs +9 -0
- package/dist/components/ui/document-editor/collaboration-types.mjs.map +1 -0
- package/dist/components/ui/document-editor/collaboration.mjs +198 -0
- package/dist/components/ui/document-editor/collaboration.mjs.map +1 -0
- package/dist/components/ui/document-editor/columns.mjs +52 -0
- package/dist/components/ui/document-editor/columns.mjs.map +1 -0
- package/dist/components/ui/document-editor/contents.mjs +60 -0
- package/dist/components/ui/document-editor/contents.mjs.map +1 -0
- package/dist/components/ui/document-editor/date-chip.mjs +115 -0
- package/dist/components/ui/document-editor/date-chip.mjs.map +1 -0
- package/dist/components/ui/document-editor/date-words.mjs +101 -0
- package/dist/components/ui/document-editor/date-words.mjs.map +1 -0
- package/dist/components/ui/document-editor/doc-labels.mjs +19 -0
- package/dist/components/ui/document-editor/doc-labels.mjs.map +1 -0
- package/dist/components/ui/document-editor/document-editor.mjs +496 -0
- package/dist/components/ui/document-editor/document-editor.mjs.map +1 -0
- package/dist/components/ui/document-editor/emoji-suggest.mjs +81 -0
- package/dist/components/ui/document-editor/emoji-suggest.mjs.map +1 -0
- package/dist/components/ui/document-editor/focus-mode.mjs +32 -0
- package/dist/components/ui/document-editor/focus-mode.mjs.map +1 -0
- package/dist/components/ui/document-editor/geometry.mjs +35 -0
- package/dist/components/ui/document-editor/geometry.mjs.map +1 -0
- package/dist/components/ui/document-editor/ghost-text.mjs +154 -0
- package/dist/components/ui/document-editor/ghost-text.mjs.map +1 -0
- package/dist/components/ui/document-editor/gliding-caret.mjs +118 -0
- package/dist/components/ui/document-editor/gliding-caret.mjs.map +1 -0
- package/dist/components/ui/document-editor/headings.mjs +64 -0
- package/dist/components/ui/document-editor/headings.mjs.map +1 -0
- package/dist/components/ui/document-editor/image.mjs +318 -0
- package/dist/components/ui/document-editor/image.mjs.map +1 -0
- package/dist/components/ui/document-editor/index.mjs +131 -0
- package/dist/components/ui/document-editor/index.mjs.map +1 -0
- package/dist/components/ui/document-editor/labels.mjs +96 -0
- package/dist/components/ui/document-editor/labels.mjs.map +1 -0
- package/dist/components/ui/document-editor/link-card.mjs +138 -0
- package/dist/components/ui/document-editor/link-card.mjs.map +1 -0
- package/dist/components/ui/document-editor/mentions.mjs +105 -0
- package/dist/components/ui/document-editor/mentions.mjs.map +1 -0
- package/dist/components/ui/document-editor/outline.mjs +138 -0
- package/dist/components/ui/document-editor/outline.mjs.map +1 -0
- package/dist/components/ui/document-editor/section-fold.mjs +124 -0
- package/dist/components/ui/document-editor/section-fold.mjs.map +1 -0
- package/dist/components/ui/document-editor/slash-command.mjs +210 -0
- package/dist/components/ui/document-editor/slash-command.mjs.map +1 -0
- package/dist/components/ui/document-editor/suggest-list.mjs +187 -0
- package/dist/components/ui/document-editor/suggest-list.mjs.map +1 -0
- package/dist/components/ui/document-editor/table.mjs +242 -0
- package/dist/components/ui/document-editor/table.mjs.map +1 -0
- package/dist/components/ui/document-editor/templates.mjs +66 -0
- package/dist/components/ui/document-editor/templates.mjs.map +1 -0
- package/dist/components/ui/document-editor/toggle.mjs +176 -0
- package/dist/components/ui/document-editor/toggle.mjs.map +1 -0
- package/dist/components/ui/document-editor/typography-rules.mjs +8 -0
- package/dist/components/ui/document-editor/typography-rules.mjs.map +1 -0
- package/dist/components/ui/document-editor/use-editor-value.mjs +34 -0
- package/dist/components/ui/document-editor/use-editor-value.mjs.map +1 -0
- package/dist/components/ui/drawer/drawer-nav.mjs +153 -0
- package/dist/components/ui/drawer/drawer-nav.mjs.map +1 -0
- package/dist/components/ui/drawer/drawer.mjs +334 -0
- package/dist/components/ui/drawer/drawer.mjs.map +1 -0
- package/dist/components/ui/drawer/index.mjs +37 -0
- package/dist/components/ui/drawer/index.mjs.map +1 -0
- package/dist/components/ui/drawer/use-swipe-to-close.mjs +77 -0
- package/dist/components/ui/drawer/use-swipe-to-close.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.mjs +567 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu/index.mjs +43 -0
- package/dist/components/ui/dropdown-menu/index.mjs.map +1 -0
- package/dist/components/ui/editable-text/editable-text.mjs +148 -0
- package/dist/components/ui/editable-text/editable-text.mjs.map +1 -0
- package/dist/components/ui/editable-text/index.mjs +6 -0
- package/dist/components/ui/editable-text/index.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/emoji-data.mjs +469 -0
- package/dist/components/ui/emoji-picker/emoji-data.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/emoji-picker.mjs +464 -0
- package/dist/components/ui/emoji-picker/emoji-picker.mjs.map +1 -0
- package/dist/components/ui/emoji-picker/index.mjs +19 -0
- package/dist/components/ui/emoji-picker/index.mjs.map +1 -0
- package/dist/components/ui/empty-state/empty-state.mjs +110 -0
- package/dist/components/ui/empty-state/empty-state.mjs.map +1 -0
- package/dist/components/ui/empty-state/index.mjs +17 -0
- package/dist/components/ui/empty-state/index.mjs.map +1 -0
- package/dist/components/ui/event-calendar/calendar-math.mjs +256 -0
- package/dist/components/ui/event-calendar/calendar-math.mjs.map +1 -0
- package/dist/components/ui/event-calendar/context.mjs +51 -0
- package/dist/components/ui/event-calendar/context.mjs.map +1 -0
- package/dist/components/ui/event-calendar/editor.mjs +292 -0
- package/dist/components/ui/event-calendar/editor.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-block.mjs +55 -0
- package/dist/components/ui/event-calendar/event-block.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-calendar.mjs +438 -0
- package/dist/components/ui/event-calendar/event-calendar.mjs.map +1 -0
- package/dist/components/ui/event-calendar/event-keys.mjs +41 -0
- package/dist/components/ui/event-calendar/event-keys.mjs.map +1 -0
- package/dist/components/ui/event-calendar/index.mjs +37 -0
- package/dist/components/ui/event-calendar/index.mjs.map +1 -0
- package/dist/components/ui/event-calendar/month-grid.mjs +207 -0
- package/dist/components/ui/event-calendar/month-grid.mjs.map +1 -0
- package/dist/components/ui/event-calendar/narrow.mjs +193 -0
- package/dist/components/ui/event-calendar/narrow.mjs.map +1 -0
- package/dist/components/ui/event-calendar/time-grid.mjs +534 -0
- package/dist/components/ui/event-calendar/time-grid.mjs.map +1 -0
- package/dist/components/ui/expandable-search/expandable-search.mjs +174 -0
- package/dist/components/ui/expandable-search/expandable-search.mjs.map +1 -0
- package/dist/components/ui/expandable-search/index.mjs +6 -0
- package/dist/components/ui/expandable-search/index.mjs.map +1 -0
- package/dist/components/ui/field/field.mjs +444 -0
- package/dist/components/ui/field/field.mjs.map +1 -0
- package/dist/components/ui/field/index.mjs +21 -0
- package/dist/components/ui/field/index.mjs.map +1 -0
- package/dist/components/ui/file-card/file-card.mjs +198 -0
- package/dist/components/ui/file-card/file-card.mjs.map +1 -0
- package/dist/components/ui/file-card/file-icon.mjs +66 -0
- package/dist/components/ui/file-card/file-icon.mjs.map +1 -0
- package/dist/components/ui/file-card/file-types.mjs +70 -0
- package/dist/components/ui/file-card/file-types.mjs.map +1 -0
- package/dist/components/ui/file-card/index.mjs +32 -0
- package/dist/components/ui/file-card/index.mjs.map +1 -0
- package/dist/components/ui/file-preview/context.mjs +77 -0
- package/dist/components/ui/file-preview/context.mjs.map +1 -0
- package/dist/components/ui/file-preview/file-preview.mjs +865 -0
- package/dist/components/ui/file-preview/file-preview.mjs.map +1 -0
- package/dist/components/ui/file-preview/index.mjs +56 -0
- package/dist/components/ui/file-preview/index.mjs.map +1 -0
- package/dist/components/ui/file-preview/pdf.mjs +250 -0
- package/dist/components/ui/file-preview/pdf.mjs.map +1 -0
- package/dist/components/ui/file-preview/renderers.mjs +257 -0
- package/dist/components/ui/file-preview/renderers.mjs.map +1 -0
- package/dist/components/ui/file-upload/file-upload.mjs +633 -0
- package/dist/components/ui/file-upload/file-upload.mjs.map +1 -0
- package/dist/components/ui/file-upload/index.mjs +42 -0
- package/dist/components/ui/file-upload/index.mjs.map +1 -0
- package/dist/components/ui/file-upload/validate.mjs +111 -0
- package/dist/components/ui/file-upload/validate.mjs.map +1 -0
- package/dist/components/ui/flag/flag.mjs +39 -0
- package/dist/components/ui/flag/flag.mjs.map +1 -0
- package/dist/components/ui/flag/index.mjs +7 -0
- package/dist/components/ui/flag/index.mjs.map +1 -0
- package/dist/components/ui/floating-window/floating-window.mjs +255 -0
- package/dist/components/ui/floating-window/floating-window.mjs.map +1 -0
- package/dist/components/ui/floating-window/index.mjs +11 -0
- package/dist/components/ui/floating-window/index.mjs.map +1 -0
- package/dist/components/ui/form/form-section.mjs +87 -0
- package/dist/components/ui/form/form-section.mjs.map +1 -0
- package/dist/components/ui/form/form.mjs +205 -0
- package/dist/components/ui/form/form.mjs.map +1 -0
- package/dist/components/ui/form/index.mjs +29 -0
- package/dist/components/ui/form/index.mjs.map +1 -0
- package/dist/components/ui/globe/globe-data.mjs +9 -0
- package/dist/components/ui/globe/globe-data.mjs.map +1 -0
- package/dist/components/ui/globe/globe-math.mjs +269 -0
- package/dist/components/ui/globe/globe-math.mjs.map +1 -0
- package/dist/components/ui/globe/globe.mjs +719 -0
- package/dist/components/ui/globe/globe.mjs.map +1 -0
- package/dist/components/ui/globe/index.mjs +13 -0
- package/dist/components/ui/globe/index.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-children.mjs +13 -0
- package/dist/components/ui/highlight-match/highlight-children.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-match-variants.mjs +17 -0
- package/dist/components/ui/highlight-match/highlight-match-variants.mjs.map +1 -0
- package/dist/components/ui/highlight-match/highlight-match.mjs +37 -0
- package/dist/components/ui/highlight-match/highlight-match.mjs.map +1 -0
- package/dist/components/ui/highlight-match/index.mjs +15 -0
- package/dist/components/ui/highlight-match/index.mjs.map +1 -0
- package/dist/components/ui/highlight-match/match-ranges.mjs +50 -0
- package/dist/components/ui/highlight-match/match-ranges.mjs.map +1 -0
- package/dist/components/ui/histogram-slider/histogram-slider.mjs +83 -0
- package/dist/components/ui/histogram-slider/histogram-slider.mjs.map +1 -0
- package/dist/components/ui/histogram-slider/index.mjs +6 -0
- package/dist/components/ui/histogram-slider/index.mjs.map +1 -0
- package/dist/components/ui/hold-button/hold-button.mjs +258 -0
- package/dist/components/ui/hold-button/hold-button.mjs.map +1 -0
- package/dist/components/ui/hold-button/index.mjs +6 -0
- package/dist/components/ui/hold-button/index.mjs.map +1 -0
- package/dist/components/ui/hover-card/hover-card.mjs +111 -0
- package/dist/components/ui/hover-card/hover-card.mjs.map +1 -0
- package/dist/components/ui/hover-card/index.mjs +21 -0
- package/dist/components/ui/hover-card/index.mjs.map +1 -0
- package/dist/components/ui/ink-tray/index.mjs +29 -0
- package/dist/components/ui/ink-tray/index.mjs.map +1 -0
- package/dist/components/ui/ink-tray/ink-tray-art.mjs +68 -0
- package/dist/components/ui/ink-tray/ink-tray-art.mjs.map +1 -0
- package/dist/components/ui/ink-tray/ink-tray.mjs +350 -0
- package/dist/components/ui/ink-tray/ink-tray.mjs.map +1 -0
- package/dist/components/ui/input/index.mjs +41 -0
- package/dist/components/ui/input/index.mjs.map +1 -0
- package/dist/components/ui/input/input.mjs +268 -0
- package/dist/components/ui/input/input.mjs.map +1 -0
- package/dist/components/ui/input/number-input.mjs +272 -0
- package/dist/components/ui/input/number-input.mjs.map +1 -0
- package/dist/components/ui/input/password-input.mjs +49 -0
- package/dist/components/ui/input/password-input.mjs.map +1 -0
- package/dist/components/ui/input/phone-input-countries.mjs +216 -0
- package/dist/components/ui/input/phone-input-countries.mjs.map +1 -0
- package/dist/components/ui/input/phone-input.mjs +326 -0
- package/dist/components/ui/input/phone-input.mjs.map +1 -0
- package/dist/components/ui/input/use-controllable-state.mjs +24 -0
- package/dist/components/ui/input/use-controllable-state.mjs.map +1 -0
- package/dist/components/ui/input/use-hold-repeat.mjs +35 -0
- package/dist/components/ui/input/use-hold-repeat.mjs.map +1 -0
- package/dist/components/ui/input-group/index.mjs +11 -0
- package/dist/components/ui/input-group/index.mjs.map +1 -0
- package/dist/components/ui/input-group/input-group.mjs +78 -0
- package/dist/components/ui/input-group/input-group.mjs.map +1 -0
- package/dist/components/ui/island/index.mjs +23 -0
- package/dist/components/ui/island/index.mjs.map +1 -0
- package/dist/components/ui/island/island.mjs +328 -0
- package/dist/components/ui/island/island.mjs.map +1 -0
- package/dist/components/ui/kbd/index.mjs +6 -0
- package/dist/components/ui/kbd/index.mjs.map +1 -0
- package/dist/components/ui/kbd/kbd.mjs +73 -0
- package/dist/components/ui/kbd/kbd.mjs.map +1 -0
- package/dist/components/ui/keypad/index.mjs +23 -0
- package/dist/components/ui/keypad/index.mjs.map +1 -0
- package/dist/components/ui/keypad/keypad.mjs +345 -0
- package/dist/components/ui/keypad/keypad.mjs.map +1 -0
- package/dist/components/ui/label/index.mjs +7 -0
- package/dist/components/ui/label/index.mjs.map +1 -0
- package/dist/components/ui/label/label.mjs +117 -0
- package/dist/components/ui/label/label.mjs.map +1 -0
- package/dist/components/ui/lightbox/index.mjs +47 -0
- package/dist/components/ui/lightbox/index.mjs.map +1 -0
- package/dist/components/ui/lightbox/labels.mjs +23 -0
- package/dist/components/ui/lightbox/labels.mjs.map +1 -0
- package/dist/components/ui/lightbox/lightbox.mjs +1359 -0
- package/dist/components/ui/lightbox/lightbox.mjs.map +1 -0
- package/dist/components/ui/link/index.mjs +6 -0
- package/dist/components/ui/link/index.mjs.map +1 -0
- package/dist/components/ui/link/link.mjs +64 -0
- package/dist/components/ui/link/link.mjs.map +1 -0
- package/dist/components/ui/list/index.mjs +35 -0
- package/dist/components/ui/list/index.mjs.map +1 -0
- package/dist/components/ui/list/list.mjs +505 -0
- package/dist/components/ui/list/list.mjs.map +1 -0
- package/dist/components/ui/load-more/index.mjs +23 -0
- package/dist/components/ui/load-more/index.mjs.map +1 -0
- package/dist/components/ui/load-more/load-more.mjs +409 -0
- package/dist/components/ui/load-more/load-more.mjs.map +1 -0
- package/dist/components/ui/map/index.mjs +27 -0
- package/dist/components/ui/map/index.mjs.map +1 -0
- package/dist/components/ui/map/map-style.mjs +169 -0
- package/dist/components/ui/map/map-style.mjs.map +1 -0
- package/dist/components/ui/map/map.mjs +624 -0
- package/dist/components/ui/map/map.mjs.map +1 -0
- package/dist/components/ui/map-pin/index.mjs +6 -0
- package/dist/components/ui/map-pin/index.mjs.map +1 -0
- package/dist/components/ui/map-pin/map-pin.mjs +55 -0
- package/dist/components/ui/map-pin/map-pin.mjs.map +1 -0
- package/dist/components/ui/mention/index.mjs +29 -0
- package/dist/components/ui/mention/index.mjs.map +1 -0
- package/dist/components/ui/mention/mention.mjs +262 -0
- package/dist/components/ui/mention/mention.mjs.map +1 -0
- package/dist/components/ui/mention/split-mentions.mjs +24 -0
- package/dist/components/ui/mention/split-mentions.mjs.map +1 -0
- package/dist/components/ui/menubar/index.mjs +39 -0
- package/dist/components/ui/menubar/index.mjs.map +1 -0
- package/dist/components/ui/menubar/menubar.mjs +222 -0
- package/dist/components/ui/menubar/menubar.mjs.map +1 -0
- package/dist/components/ui/meter/index.mjs +21 -0
- package/dist/components/ui/meter/index.mjs.map +1 -0
- package/dist/components/ui/meter/meter.mjs +167 -0
- package/dist/components/ui/meter/meter.mjs.map +1 -0
- package/dist/components/ui/multi-select/index.mjs +25 -0
- package/dist/components/ui/multi-select/index.mjs.map +1 -0
- package/dist/components/ui/multi-select/multi-select.mjs +285 -0
- package/dist/components/ui/multi-select/multi-select.mjs.map +1 -0
- package/dist/components/ui/navigation-menu/index.mjs +41 -0
- package/dist/components/ui/navigation-menu/index.mjs.map +1 -0
- package/dist/components/ui/navigation-menu/navigation-menu.mjs +396 -0
- package/dist/components/ui/navigation-menu/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/notebook-page/index.mjs +15 -0
- package/dist/components/ui/notebook-page/index.mjs.map +1 -0
- package/dist/components/ui/notebook-page/notebook-page.mjs +162 -0
- package/dist/components/ui/notebook-page/notebook-page.mjs.map +1 -0
- package/dist/components/ui/notification-inbox/index.mjs +47 -0
- package/dist/components/ui/notification-inbox/index.mjs.map +1 -0
- package/dist/components/ui/notification-inbox/notification-inbox.mjs +422 -0
- package/dist/components/ui/notification-inbox/notification-inbox.mjs.map +1 -0
- package/dist/components/ui/number-field/index.mjs +24 -0
- package/dist/components/ui/number-field/index.mjs.map +1 -0
- package/dist/components/ui/number-field/number-field.mjs +460 -0
- package/dist/components/ui/number-field/number-field.mjs.map +1 -0
- package/dist/components/ui/number-field/number-format.mjs +48 -0
- package/dist/components/ui/number-field/number-format.mjs.map +1 -0
- package/dist/components/ui/otp-input/index.mjs +9 -0
- package/dist/components/ui/otp-input/index.mjs.map +1 -0
- package/dist/components/ui/otp-input/otp-input.mjs +285 -0
- package/dist/components/ui/otp-input/otp-input.mjs.map +1 -0
- package/dist/components/ui/pager/index.mjs +7 -0
- package/dist/components/ui/pager/index.mjs.map +1 -0
- package/dist/components/ui/pager/pager.mjs +86 -0
- package/dist/components/ui/pager/pager.mjs.map +1 -0
- package/dist/components/ui/pagination/index.mjs +23 -0
- package/dist/components/ui/pagination/index.mjs.map +1 -0
- package/dist/components/ui/pagination/pagination.mjs +210 -0
- package/dist/components/ui/pagination/pagination.mjs.map +1 -0
- package/dist/components/ui/password-strength/index.mjs +21 -0
- package/dist/components/ui/password-strength/index.mjs.map +1 -0
- package/dist/components/ui/password-strength/password-rules.mjs +25 -0
- package/dist/components/ui/password-strength/password-rules.mjs.map +1 -0
- package/dist/components/ui/password-strength/password-strength.mjs +125 -0
- package/dist/components/ui/password-strength/password-strength.mjs.map +1 -0
- package/dist/components/ui/popover/index.mjs +31 -0
- package/dist/components/ui/popover/index.mjs.map +1 -0
- package/dist/components/ui/popover/popover.mjs +574 -0
- package/dist/components/ui/popover/popover.mjs.map +1 -0
- package/dist/components/ui/progress/index.mjs +15 -0
- package/dist/components/ui/progress/index.mjs.map +1 -0
- package/dist/components/ui/progress/progress.mjs +224 -0
- package/dist/components/ui/progress/progress.mjs.map +1 -0
- package/dist/components/ui/prose/index.mjs +6 -0
- package/dist/components/ui/prose/index.mjs.map +1 -0
- package/dist/components/ui/prose/prose.mjs +89 -0
- package/dist/components/ui/prose/prose.mjs.map +1 -0
- package/dist/components/ui/radio-group/index.mjs +15 -0
- package/dist/components/ui/radio-group/index.mjs.map +1 -0
- package/dist/components/ui/radio-group/radio-group.mjs +88 -0
- package/dist/components/ui/radio-group/radio-group.mjs.map +1 -0
- package/dist/components/ui/rating/index.mjs +6 -0
- package/dist/components/ui/rating/index.mjs.map +1 -0
- package/dist/components/ui/rating/rating.mjs +119 -0
- package/dist/components/ui/rating/rating.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/bubble-menu.mjs +120 -0
- package/dist/components/ui/rich-text-editor/bubble-menu.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/image-links.mjs +63 -0
- package/dist/components/ui/rich-text-editor/image-links.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/index.mjs +37 -0
- package/dist/components/ui/rich-text-editor/index.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/labels.mjs +27 -0
- package/dist/components/ui/rich-text-editor/labels.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/rich-text-editor.mjs +149 -0
- package/dist/components/ui/rich-text-editor/rich-text-editor.mjs.map +1 -0
- package/dist/components/ui/rich-text-editor/toolbar.mjs +325 -0
- package/dist/components/ui/rich-text-editor/toolbar.mjs.map +1 -0
- package/dist/components/ui/save-bar/index.mjs +13 -0
- package/dist/components/ui/save-bar/index.mjs.map +1 -0
- package/dist/components/ui/save-bar/save-bar.mjs +59 -0
- package/dist/components/ui/save-bar/save-bar.mjs.map +1 -0
- package/dist/components/ui/scroll-area/index.mjs +6 -0
- package/dist/components/ui/scroll-area/index.mjs.map +1 -0
- package/dist/components/ui/scroll-area/scroll-area.mjs +148 -0
- package/dist/components/ui/scroll-area/scroll-area.mjs.map +1 -0
- package/dist/components/ui/scroll-area/use-drag-scroll.mjs +134 -0
- package/dist/components/ui/scroll-area/use-drag-scroll.mjs.map +1 -0
- package/dist/components/ui/select/index.mjs +23 -0
- package/dist/components/ui/select/index.mjs.map +1 -0
- package/dist/components/ui/select/select.mjs +216 -0
- package/dist/components/ui/select/select.mjs.map +1 -0
- package/dist/components/ui/sheet/index.mjs +23 -0
- package/dist/components/ui/sheet/index.mjs.map +1 -0
- package/dist/components/ui/sheet/sheet.mjs +292 -0
- package/dist/components/ui/sheet/sheet.mjs.map +1 -0
- package/dist/components/ui/sidebar/index.mjs +122 -0
- package/dist/components/ui/sidebar/index.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-group.mjs +75 -0
- package/dist/components/ui/sidebar/sidebar-group.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-item.mjs +199 -0
- package/dist/components/ui/sidebar/sidebar-item.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-panels.mjs +182 -0
- package/dist/components/ui/sidebar/sidebar-panels.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-peek.mjs +324 -0
- package/dist/components/ui/sidebar/sidebar-peek.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-rich.mjs +65 -0
- package/dist/components/ui/sidebar/sidebar-rich.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar-tree.mjs +224 -0
- package/dist/components/ui/sidebar/sidebar-tree.mjs.map +1 -0
- package/dist/components/ui/sidebar/sidebar.mjs +205 -0
- package/dist/components/ui/sidebar/sidebar.mjs.map +1 -0
- package/dist/components/ui/sidebar/variants.mjs +396 -0
- package/dist/components/ui/sidebar/variants.mjs.map +1 -0
- package/dist/components/ui/signature/index.mjs +6 -0
- package/dist/components/ui/signature/index.mjs.map +1 -0
- package/dist/components/ui/signature/signature.mjs +145 -0
- package/dist/components/ui/signature/signature.mjs.map +1 -0
- package/dist/components/ui/signature-pad/index.mjs +19 -0
- package/dist/components/ui/signature-pad/index.mjs.map +1 -0
- package/dist/components/ui/signature-pad/signature-pad.mjs +210 -0
- package/dist/components/ui/signature-pad/signature-pad.mjs.map +1 -0
- package/dist/components/ui/signature-pad/strokes.mjs +68 -0
- package/dist/components/ui/signature-pad/strokes.mjs.map +1 -0
- package/dist/components/ui/skeleton/index.mjs +9 -0
- package/dist/components/ui/skeleton/index.mjs.map +1 -0
- package/dist/components/ui/skeleton/skeleton.mjs +58 -0
- package/dist/components/ui/skeleton/skeleton.mjs.map +1 -0
- package/dist/components/ui/slide/index.mjs +25 -0
- package/dist/components/ui/slide/index.mjs.map +1 -0
- package/dist/components/ui/slide/slide.mjs +159 -0
- package/dist/components/ui/slide/slide.mjs.map +1 -0
- package/dist/components/ui/slider/index.mjs +21 -0
- package/dist/components/ui/slider/index.mjs.map +1 -0
- package/dist/components/ui/slider/slider-input.mjs +449 -0
- package/dist/components/ui/slider/slider-input.mjs.map +1 -0
- package/dist/components/ui/slider/slider.mjs +235 -0
- package/dist/components/ui/slider/slider.mjs.map +1 -0
- package/dist/components/ui/slides/index.mjs +31 -0
- package/dist/components/ui/slides/index.mjs.map +1 -0
- package/dist/components/ui/slides/slides.mjs +890 -0
- package/dist/components/ui/slides/slides.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/index.mjs +17 -0
- package/dist/components/ui/smooth-anchors/index.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/smooth-anchors.mjs +75 -0
- package/dist/components/ui/smooth-anchors/smooth-anchors.mjs.map +1 -0
- package/dist/components/ui/smooth-anchors/smooth-scroll.mjs +87 -0
- package/dist/components/ui/smooth-anchors/smooth-scroll.mjs.map +1 -0
- package/dist/components/ui/spinner/index.mjs +6 -0
- package/dist/components/ui/spinner/index.mjs.map +1 -0
- package/dist/components/ui/spinner/spinner.mjs +49 -0
- package/dist/components/ui/spinner/spinner.mjs.map +1 -0
- package/dist/components/ui/stat/index.mjs +29 -0
- package/dist/components/ui/stat/index.mjs.map +1 -0
- package/dist/components/ui/stat/stat.mjs +226 -0
- package/dist/components/ui/stat/stat.mjs.map +1 -0
- package/dist/components/ui/status-bar/index.mjs +17 -0
- package/dist/components/ui/status-bar/index.mjs.map +1 -0
- package/dist/components/ui/status-bar/status-bar.mjs +96 -0
- package/dist/components/ui/status-bar/status-bar.mjs.map +1 -0
- package/dist/components/ui/stepper/index.mjs +25 -0
- package/dist/components/ui/stepper/index.mjs.map +1 -0
- package/dist/components/ui/stepper/stepper.mjs +235 -0
- package/dist/components/ui/stepper/stepper.mjs.map +1 -0
- package/dist/components/ui/steps/index.mjs +9 -0
- package/dist/components/ui/steps/index.mjs.map +1 -0
- package/dist/components/ui/steps/steps.mjs +70 -0
- package/dist/components/ui/steps/steps.mjs.map +1 -0
- package/dist/components/ui/swatch-grid/index.mjs +7 -0
- package/dist/components/ui/swatch-grid/index.mjs.map +1 -0
- package/dist/components/ui/swatch-grid/swatch-grid.mjs +110 -0
- package/dist/components/ui/swatch-grid/swatch-grid.mjs.map +1 -0
- package/dist/components/ui/switch/index.mjs +7 -0
- package/dist/components/ui/switch/index.mjs.map +1 -0
- package/dist/components/ui/switch/switch.mjs +79 -0
- package/dist/components/ui/switch/switch.mjs.map +1 -0
- package/dist/components/ui/tab-strip/index.mjs +13 -0
- package/dist/components/ui/tab-strip/index.mjs.map +1 -0
- package/dist/components/ui/tab-strip/tab-strip.mjs +244 -0
- package/dist/components/ui/tab-strip/tab-strip.mjs.map +1 -0
- package/dist/components/ui/table/index.mjs +27 -0
- package/dist/components/ui/table/index.mjs.map +1 -0
- package/dist/components/ui/table/table.mjs +290 -0
- package/dist/components/ui/table/table.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/index.mjs +20 -0
- package/dist/components/ui/table-of-contents/index.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/scroll-spy.mjs +60 -0
- package/dist/components/ui/table-of-contents/scroll-spy.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/table-of-contents.mjs +371 -0
- package/dist/components/ui/table-of-contents/table-of-contents.mjs.map +1 -0
- package/dist/components/ui/table-of-contents/use-headings.mjs +40 -0
- package/dist/components/ui/table-of-contents/use-headings.mjs.map +1 -0
- package/dist/components/ui/tablet-frame/index.mjs +7 -0
- package/dist/components/ui/tablet-frame/index.mjs.map +1 -0
- package/dist/components/ui/tablet-frame/tablet-frame.mjs +48 -0
- package/dist/components/ui/tablet-frame/tablet-frame.mjs.map +1 -0
- package/dist/components/ui/tabs/index.mjs +25 -0
- package/dist/components/ui/tabs/index.mjs.map +1 -0
- package/dist/components/ui/tabs/tabs.mjs +382 -0
- package/dist/components/ui/tabs/tabs.mjs.map +1 -0
- package/dist/components/ui/tabs/use-tabs-indicator.mjs +90 -0
- package/dist/components/ui/tabs/use-tabs-indicator.mjs.map +1 -0
- package/dist/components/ui/tags-input/index.mjs +9 -0
- package/dist/components/ui/tags-input/index.mjs.map +1 -0
- package/dist/components/ui/tags-input/split.mjs +38 -0
- package/dist/components/ui/tags-input/split.mjs.map +1 -0
- package/dist/components/ui/tags-input/tags-input.mjs +328 -0
- package/dist/components/ui/tags-input/tags-input.mjs.map +1 -0
- package/dist/components/ui/terminal/index.mjs +41 -0
- package/dist/components/ui/terminal/index.mjs.map +1 -0
- package/dist/components/ui/terminal/terminal.mjs +287 -0
- package/dist/components/ui/terminal/terminal.mjs.map +1 -0
- package/dist/components/ui/textarea/index.mjs +21 -0
- package/dist/components/ui/textarea/index.mjs.map +1 -0
- package/dist/components/ui/textarea/textarea.mjs +244 -0
- package/dist/components/ui/textarea/textarea.mjs.map +1 -0
- package/dist/components/ui/theme-provider/index.mjs +6 -0
- package/dist/components/ui/theme-provider/index.mjs.map +1 -0
- package/dist/components/ui/theme-provider/theme-provider.mjs +70 -0
- package/dist/components/ui/theme-provider/theme-provider.mjs.map +1 -0
- package/dist/components/ui/toast/index.mjs +19 -0
- package/dist/components/ui/toast/index.mjs.map +1 -0
- package/dist/components/ui/toast/store.mjs +96 -0
- package/dist/components/ui/toast/store.mjs.map +1 -0
- package/dist/components/ui/toast/toast.mjs +395 -0
- package/dist/components/ui/toast/toast.mjs.map +1 -0
- package/dist/components/ui/toggle/index.mjs +13 -0
- package/dist/components/ui/toggle/index.mjs.map +1 -0
- package/dist/components/ui/toggle/toggle.mjs +123 -0
- package/dist/components/ui/toggle/toggle.mjs.map +1 -0
- package/dist/components/ui/toggle-group/index.mjs +11 -0
- package/dist/components/ui/toggle-group/index.mjs.map +1 -0
- package/dist/components/ui/toggle-group/toggle-group.mjs +243 -0
- package/dist/components/ui/toggle-group/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggletip/index.mjs +6 -0
- package/dist/components/ui/toggletip/index.mjs.map +1 -0
- package/dist/components/ui/toggletip/toggletip.mjs +95 -0
- package/dist/components/ui/toggletip/toggletip.mjs.map +1 -0
- package/dist/components/ui/toolbar/index.mjs +21 -0
- package/dist/components/ui/toolbar/index.mjs.map +1 -0
- package/dist/components/ui/toolbar/toolbar.mjs +130 -0
- package/dist/components/ui/toolbar/toolbar.mjs.map +1 -0
- package/dist/components/ui/tooltip/index.mjs +29 -0
- package/dist/components/ui/tooltip/index.mjs.map +1 -0
- package/dist/components/ui/tooltip/tooltip.mjs +640 -0
- package/dist/components/ui/tooltip/tooltip.mjs.map +1 -0
- package/dist/components/ui/tree/index.mjs +11 -0
- package/dist/components/ui/tree/index.mjs.map +1 -0
- package/dist/components/ui/tree/tree.mjs +450 -0
- package/dist/components/ui/tree/tree.mjs.map +1 -0
- package/dist/index.d.mts +19397 -0
- package/dist/index.mjs +157 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/color.mjs +78 -0
- package/dist/lib/color.mjs.map +1 -0
- package/dist/lib/create-context.mjs +31 -0
- package/dist/lib/create-context.mjs.map +1 -0
- package/dist/lib/date.mjs +116 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/density.mjs +79 -0
- package/dist/lib/density.mjs.map +1 -0
- package/dist/lib/field-context.mjs +13 -0
- package/dist/lib/field-context.mjs.map +1 -0
- package/dist/lib/filter.mjs +28 -0
- package/dist/lib/filter.mjs.map +1 -0
- package/dist/lib/gesture.mjs +38 -0
- package/dist/lib/gesture.mjs.map +1 -0
- package/dist/lib/hit-area.mjs +14 -0
- package/dist/lib/hit-area.mjs.map +1 -0
- package/dist/lib/labels.mjs +27 -0
- package/dist/lib/labels.mjs.map +1 -0
- package/dist/lib/morph-box.mjs +56 -0
- package/dist/lib/morph-box.mjs.map +1 -0
- package/dist/lib/motion.mjs +70 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/lib/pulse.mjs +69 -0
- package/dist/lib/pulse.mjs.map +1 -0
- package/dist/lib/roving-focus.mjs +74 -0
- package/dist/lib/roving-focus.mjs.map +1 -0
- package/dist/lib/theme.mjs +67 -0
- package/dist/lib/theme.mjs.map +1 -0
- package/dist/lib/tv.mjs +11 -0
- package/dist/lib/tv.mjs.map +1 -0
- package/dist/lib/utils.mjs +82 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +133 -4
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { Extension } from "@tiptap/core";
|
|
6
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
7
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
8
|
+
import { defaultBlockCommands, filterBlockCommands } from "./block-commands.mjs";
|
|
9
|
+
import { listPosition, onViewportMove } from "./geometry.mjs";
|
|
10
|
+
import { useActiveDescendant } from "./suggest-list.mjs";
|
|
11
|
+
const CLOSED = { open: false, query: "", from: 0, to: 0, index: 0, rect: null };
|
|
12
|
+
function createSlashStore() {
|
|
13
|
+
let state = CLOSED;
|
|
14
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
15
|
+
return {
|
|
16
|
+
get: () => state,
|
|
17
|
+
set(next) {
|
|
18
|
+
state = { ...state, ...next };
|
|
19
|
+
listeners.forEach((l) => l());
|
|
20
|
+
},
|
|
21
|
+
subscribe(listener) {
|
|
22
|
+
listeners.add(listener);
|
|
23
|
+
return () => listeners.delete(listener);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const key = new PluginKey("slashCommand");
|
|
28
|
+
const TRIGGER = /(?:^|\s)(\/([^\s/]{0,24}))$/;
|
|
29
|
+
const slashCommandExtension = Extension.create({
|
|
30
|
+
name: "slashCommand",
|
|
31
|
+
addOptions() {
|
|
32
|
+
return { commands: defaultBlockCommands };
|
|
33
|
+
},
|
|
34
|
+
addStorage() {
|
|
35
|
+
const store = createSlashStore();
|
|
36
|
+
return {
|
|
37
|
+
store,
|
|
38
|
+
matches: () => filterBlockCommands(this.options.commands, store.get().query),
|
|
39
|
+
run: () => {
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
onCreate() {
|
|
44
|
+
const editor = this.editor;
|
|
45
|
+
const storage = this.storage;
|
|
46
|
+
storage.matches = () => filterBlockCommands(this.options.commands, storage.store.get().query);
|
|
47
|
+
storage.run = (command) => {
|
|
48
|
+
const { from, to } = storage.store.get();
|
|
49
|
+
storage.store.set(CLOSED);
|
|
50
|
+
editor.chain().focus().deleteRange({ from, to }).run();
|
|
51
|
+
command.run(editor);
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
addProseMirrorPlugins() {
|
|
55
|
+
const editor = this.editor;
|
|
56
|
+
const storage = this.storage;
|
|
57
|
+
let dismissedAt = null;
|
|
58
|
+
return [
|
|
59
|
+
new Plugin({
|
|
60
|
+
key,
|
|
61
|
+
view: () => ({
|
|
62
|
+
update: (view) => {
|
|
63
|
+
const { selection } = view.state;
|
|
64
|
+
const store = storage.store;
|
|
65
|
+
const close = () => {
|
|
66
|
+
if (store.get().open) store.set(CLOSED);
|
|
67
|
+
};
|
|
68
|
+
if (!editor.isEditable || !selection.empty || !view.hasFocus()) return close();
|
|
69
|
+
const $from = selection.$from;
|
|
70
|
+
if ($from.parent.type.spec.code) return close();
|
|
71
|
+
const before = $from.parent.textBetween(0, $from.parentOffset, void 0, "\uFFFC");
|
|
72
|
+
const match = TRIGGER.exec(before);
|
|
73
|
+
if (!match) {
|
|
74
|
+
dismissedAt = null;
|
|
75
|
+
return close();
|
|
76
|
+
}
|
|
77
|
+
const from = $from.pos - match[1].length;
|
|
78
|
+
if (dismissedAt === from) return close();
|
|
79
|
+
const coords = view.coordsAtPos(from);
|
|
80
|
+
const query = match[2];
|
|
81
|
+
const current = store.get();
|
|
82
|
+
store.set({
|
|
83
|
+
open: true,
|
|
84
|
+
query,
|
|
85
|
+
from,
|
|
86
|
+
to: $from.pos,
|
|
87
|
+
index: current.open && current.query === query ? current.index : 0,
|
|
88
|
+
rect: { left: coords.left, top: coords.top, bottom: coords.bottom }
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
destroy: () => storage.store.set(CLOSED)
|
|
92
|
+
}),
|
|
93
|
+
props: {
|
|
94
|
+
handleKeyDown: (_view, event) => {
|
|
95
|
+
const state = storage.store.get();
|
|
96
|
+
if (!state.open) return false;
|
|
97
|
+
const matches = storage.matches();
|
|
98
|
+
if (event.key === "Escape") {
|
|
99
|
+
dismissedAt = state.from;
|
|
100
|
+
storage.store.set(CLOSED);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
if (!matches.length) return false;
|
|
104
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
105
|
+
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
106
|
+
storage.store.set({ index: (state.index + step + matches.length) % matches.length });
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
110
|
+
storage.run(matches[Math.min(state.index, matches.length - 1)]);
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
},
|
|
115
|
+
handleDOMEvents: {
|
|
116
|
+
blur: () => {
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
if (!editor.isDestroyed && !editor.view.hasFocus()) storage.store.set(CLOSED);
|
|
119
|
+
}, 120);
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
function SlashMenuList({ editor, labels, className }) {
|
|
129
|
+
const storage = editor.storage.slashCommand;
|
|
130
|
+
const state = React.useSyncExternalStore(storage.store.subscribe, storage.store.get, () => CLOSED);
|
|
131
|
+
const listRef = React.useRef(null);
|
|
132
|
+
const matches = state.open ? storage.matches() : [];
|
|
133
|
+
const index = Math.min(state.index, Math.max(0, matches.length - 1));
|
|
134
|
+
const listId = React.useId();
|
|
135
|
+
useActiveDescendant(editor, state.open, listId, matches.length ? `${listId}-${index}` : null);
|
|
136
|
+
React.useEffect(() => {
|
|
137
|
+
listRef.current?.querySelector("[data-highlighted]")?.scrollIntoView({ block: "nearest" });
|
|
138
|
+
}, [index, state.open]);
|
|
139
|
+
React.useEffect(() => {
|
|
140
|
+
if (!state.open) return;
|
|
141
|
+
return onViewportMove(() => {
|
|
142
|
+
const { open, from } = storage.store.get();
|
|
143
|
+
if (!open || editor.isDestroyed) return;
|
|
144
|
+
const coords = editor.view.coordsAtPos(from);
|
|
145
|
+
storage.store.set({ rect: { left: coords.left, top: coords.top, bottom: coords.bottom } });
|
|
146
|
+
});
|
|
147
|
+
}, [state.open, storage, editor]);
|
|
148
|
+
if (!state.open || !state.rect) return null;
|
|
149
|
+
const style = listPosition(state.rect, 288, 330);
|
|
150
|
+
const groups = /* @__PURE__ */ new Map();
|
|
151
|
+
for (const command of matches) {
|
|
152
|
+
const group = command.group ?? labels.basicBlocks;
|
|
153
|
+
groups.set(group, [...groups.get(group) ?? [], command]);
|
|
154
|
+
}
|
|
155
|
+
return createPortal(
|
|
156
|
+
/* @__PURE__ */ jsx(
|
|
157
|
+
"div",
|
|
158
|
+
{
|
|
159
|
+
ref: listRef,
|
|
160
|
+
id: listId,
|
|
161
|
+
role: "listbox",
|
|
162
|
+
"aria-label": labels.blocks,
|
|
163
|
+
"data-slot": "document-editor-slash-menu",
|
|
164
|
+
className: cn(
|
|
165
|
+
"fixed z-50 max-h-80 w-72 overflow-y-auto overscroll-contain rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-border-soft ring-inset [--surface:var(--popover)]",
|
|
166
|
+
"animate-in fade-in-0 zoom-in-95 duration-fast ease-out",
|
|
167
|
+
className
|
|
168
|
+
),
|
|
169
|
+
style,
|
|
170
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
171
|
+
children: matches.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-sm text-muted-foreground", children: labels.noResults }) : [...groups.entries()].map(([group, commands]) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": group, children: [
|
|
172
|
+
/* @__PURE__ */ jsx("p", { className: "px-2 pt-1.5 pb-1 text-xs font-medium text-muted-foreground", children: group }),
|
|
173
|
+
commands.map((command) => {
|
|
174
|
+
const i = matches.indexOf(command);
|
|
175
|
+
const highlighted = i === index;
|
|
176
|
+
return /* @__PURE__ */ jsxs(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
id: `${listId}-${i}`,
|
|
180
|
+
role: "option",
|
|
181
|
+
"aria-selected": highlighted,
|
|
182
|
+
"data-highlighted": highlighted ? "" : void 0,
|
|
183
|
+
className: "flex cursor-pointer items-center gap-2.5 rounded-md px-2 py-1.5 text-sm data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
184
|
+
onMouseMove: () => {
|
|
185
|
+
if (!highlighted) storage.store.set({ index: i });
|
|
186
|
+
},
|
|
187
|
+
onClick: () => storage.run(command),
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-md bg-(--surface) ring-1 ring-border [&_svg]:size-4.5", children: command.icon }),
|
|
190
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
191
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: command.title }),
|
|
192
|
+
command.description ? /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: command.description }) : null
|
|
193
|
+
] }),
|
|
194
|
+
command.shortcut ? /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-xs text-muted-foreground", children: command.shortcut }) : null
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
command.id
|
|
198
|
+
);
|
|
199
|
+
})
|
|
200
|
+
] }, group))
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
document.body
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
SlashMenuList,
|
|
208
|
+
slashCommandExtension
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=slash-command.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/document-editor/slash-command.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { Extension, type Editor } from \"@tiptap/core\"\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\"\n\nimport { cn } from \"../../../lib/utils.mjs\"\n\nimport { defaultBlockCommands, filterBlockCommands, type BlockCommand } from \"./block-commands.mjs\"\nimport { listPosition, onViewportMove } from \"./geometry.mjs\"\nimport { useActiveDescendant } from \"./suggest-list.mjs\"\n\n/*\n * The slash menu. A ProseMirror plugin watches the text before the caret for a \"/\" at the start\n * of a line or after a space, and publishes the query and its position to a small store; the\n * React list reads the store. While it's open the plugin takes the arrows, Enter, Tab and Escape.\n */\n\nexport interface SlashState {\n open: boolean\n query: string\n /** The \"/\" and the query after it, in document positions. */\n from: number\n to: number\n index: number\n rect: { left: number; top: number; bottom: number } | null\n}\n\nconst CLOSED: SlashState = { open: false, query: \"\", from: 0, to: 0, index: 0, rect: null }\n\nfunction createSlashStore() {\n let state = CLOSED\n const listeners = new Set<() => void>()\n return {\n get: () => state,\n set(next: Partial<SlashState>) {\n state = { ...state, ...next }\n listeners.forEach((l) => l())\n },\n subscribe(listener: () => void) {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n }\n}\nexport type SlashStore = ReturnType<typeof createSlashStore>\n\nexport interface SlashCommandOptions {\n commands: BlockCommand[]\n}\n\nexport interface SlashCommandStorage {\n store: SlashStore\n /** The commands matching the current query. */\n matches: () => BlockCommand[]\n run: (command: BlockCommand) => void\n}\n\ndeclare module \"@tiptap/core\" {\n interface Storage {\n slashCommand: SlashCommandStorage\n }\n}\n\nconst key = new PluginKey(\"slashCommand\")\nconst TRIGGER = /(?:^|\\s)(\\/([^\\s/]{0,24}))$/\n\nexport const slashCommandExtension = Extension.create<SlashCommandOptions, SlashCommandStorage>({\n name: \"slashCommand\",\n\n addOptions() {\n return { commands: defaultBlockCommands }\n },\n\n addStorage() {\n const store = createSlashStore()\n return {\n store,\n matches: () => filterBlockCommands(this.options.commands, store.get().query),\n run: () => {},\n }\n },\n\n onCreate() {\n const editor = this.editor\n const storage = this.storage\n storage.matches = () => filterBlockCommands(this.options.commands, storage.store.get().query)\n storage.run = (command) => {\n const { from, to } = storage.store.get()\n storage.store.set(CLOSED)\n editor.chain().focus().deleteRange({ from, to }).run()\n command.run(editor)\n }\n },\n\n addProseMirrorPlugins() {\n const editor = this.editor\n const storage = this.storage\n let dismissedAt: number | null = null\n\n return [\n new Plugin({\n key,\n view: () => ({\n update: (view) => {\n const { selection } = view.state\n const store = storage.store\n const close = () => {\n if (store.get().open) store.set(CLOSED)\n }\n if (!editor.isEditable || !selection.empty || !view.hasFocus()) return close()\n const $from = selection.$from\n if ($from.parent.type.spec.code) return close()\n const before = $from.parent.textBetween(0, $from.parentOffset, undefined, \"\")\n const match = TRIGGER.exec(before)\n if (!match) {\n dismissedAt = null\n return close()\n }\n const from = $from.pos - match[1].length\n if (dismissedAt === from) return close()\n const coords = view.coordsAtPos(from)\n const query = match[2]\n const current = store.get()\n store.set({\n open: true,\n query,\n from,\n to: $from.pos,\n index: current.open && current.query === query ? current.index : 0,\n rect: { left: coords.left, top: coords.top, bottom: coords.bottom },\n })\n },\n destroy: () => storage.store.set(CLOSED),\n }),\n props: {\n handleKeyDown: (_view, event) => {\n const state = storage.store.get()\n if (!state.open) return false\n const matches = storage.matches()\n if (event.key === \"Escape\") {\n dismissedAt = state.from\n storage.store.set(CLOSED)\n return true\n }\n if (!matches.length) return false\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n const step = event.key === \"ArrowDown\" ? 1 : -1\n storage.store.set({ index: (state.index + step + matches.length) % matches.length })\n return true\n }\n if (event.key === \"Enter\" || event.key === \"Tab\") {\n storage.run(matches[Math.min(state.index, matches.length - 1)])\n return true\n }\n return false\n },\n handleDOMEvents: {\n blur: () => {\n // Let a press on the list land before it closes.\n setTimeout(() => {\n if (!editor.isDestroyed && !editor.view.hasFocus()) storage.store.set(CLOSED)\n }, 120)\n return false\n },\n },\n },\n }),\n ]\n },\n})\n\n/* ─── The list ────────────────────────────────────────────────────────────── */\n\nexport interface SlashMenuListProps {\n editor: Editor\n labels: { blocks: string; basicBlocks: string; noResults: string }\n className?: string\n}\n\n/** The slash menu's floating list: grouped commands, the highlighted one scrolled into view. */\nexport function SlashMenuList({ editor, labels, className }: SlashMenuListProps) {\n const storage = editor.storage.slashCommand\n const state = React.useSyncExternalStore(storage.store.subscribe, storage.store.get, () => CLOSED)\n const listRef = React.useRef<HTMLDivElement | null>(null)\n const matches = state.open ? storage.matches() : []\n const index = Math.min(state.index, Math.max(0, matches.length - 1))\n const listId = React.useId()\n useActiveDescendant(editor, state.open, listId, matches.length ? `${listId}-${index}` : null)\n\n React.useEffect(() => {\n listRef.current?.querySelector<HTMLElement>(\"[data-highlighted]\")?.scrollIntoView({ block: \"nearest\" })\n }, [index, state.open])\n\n // It stays with its line as the page scrolls; the list's own scrolling doesn't count.\n React.useEffect(() => {\n if (!state.open) return\n return onViewportMove(() => {\n const { open, from } = storage.store.get()\n if (!open || editor.isDestroyed) return\n const coords = editor.view.coordsAtPos(from)\n storage.store.set({ rect: { left: coords.left, top: coords.top, bottom: coords.bottom } })\n })\n }, [state.open, storage, editor])\n\n if (!state.open || !state.rect) return null\n\n const style = listPosition(state.rect, 288, 330)\n\n const groups = new Map<string, BlockCommand[]>()\n for (const command of matches) {\n const group = command.group ?? labels.basicBlocks\n groups.set(group, [...(groups.get(group) ?? []), command])\n }\n\n return createPortal(\n <div\n ref={listRef}\n id={listId}\n role=\"listbox\"\n aria-label={labels.blocks}\n data-slot=\"document-editor-slash-menu\"\n className={cn(\n \"fixed z-50 max-h-80 w-72 overflow-y-auto overscroll-contain rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-border-soft ring-inset [--surface:var(--popover)]\",\n \"animate-in fade-in-0 zoom-in-95 duration-fast ease-out\",\n className,\n )}\n style={style}\n // Keep the caret in the document.\n onMouseDown={(event) => event.preventDefault()}\n >\n {matches.length === 0 ? (\n <p className=\"px-2 py-1.5 text-sm text-muted-foreground\">{labels.noResults}</p>\n ) : (\n [...groups.entries()].map(([group, commands]) => (\n <div key={group} role=\"group\" aria-label={group}>\n <p className=\"px-2 pt-1.5 pb-1 text-xs font-medium text-muted-foreground\">{group}</p>\n {commands.map((command) => {\n const i = matches.indexOf(command)\n const highlighted = i === index\n return (\n <div\n key={command.id}\n id={`${listId}-${i}`}\n role=\"option\"\n aria-selected={highlighted}\n data-highlighted={highlighted ? \"\" : undefined}\n className=\"flex cursor-pointer items-center gap-2.5 rounded-md px-2 py-1.5 text-sm data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground\"\n onMouseMove={() => {\n if (!highlighted) storage.store.set({ index: i })\n }}\n onClick={() => storage.run(command)}\n >\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md bg-(--surface) ring-1 ring-border [&_svg]:size-4.5\">\n {command.icon}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate font-medium\">{command.title}</span>\n {command.description ? (\n <span className=\"truncate text-xs text-muted-foreground\">{command.description}</span>\n ) : null}\n </span>\n {command.shortcut ? (\n <span className=\"shrink-0 font-mono text-xs text-muted-foreground\">{command.shortcut}</span>\n ) : null}\n </div>\n )\n })}\n </div>\n ))\n )}\n </div>,\n document.body,\n )\n}\n"],"mappings":";AAyOQ,cAwBU,YAxBV;AAvOR,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,iBAA8B;AACvC,SAAS,QAAQ,iBAAiB;AAElC,SAAS,UAAU;AAEnB,SAAS,sBAAsB,2BAA8C;AAC7E,SAAS,cAAc,sBAAsB;AAC7C,SAAS,2BAA2B;AAkBpC,MAAM,SAAqB,EAAE,MAAM,OAAO,OAAO,IAAI,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,KAAK;AAE1F,SAAS,mBAAmB;AAC1B,MAAI,QAAQ;AACZ,QAAM,YAAY,oBAAI,IAAgB;AACtC,SAAO;AAAA,IACL,KAAK,MAAM;AAAA,IACX,IAAI,MAA2B;AAC7B,cAAQ,EAAE,GAAG,OAAO,GAAG,KAAK;AAC5B,gBAAU,QAAQ,CAAC,MAAM,EAAE,CAAC;AAAA,IAC9B;AAAA,IACA,UAAU,UAAsB;AAC9B,gBAAU,IAAI,QAAQ;AACtB,aAAO,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,gBAEC,IAAI,GAAG,MAAM,IAAI,CAAC;AAAA,gBAClB,MAAK;AAAA,gBACL,iBAAe;AAAA,gBACf,oBAAkB,cAAc,KAAK;AAAA,gBACrC,WAAU;AAAA,gBACV,aAAa,MAAM;AACjB,sBAAI,CAAC,YAAa,SAAQ,MAAM,IAAI,EAAE,OAAO,EAAE,CAAC;AAAA,gBAClD;AAAA,gBACA,SAAS,MAAM,QAAQ,IAAI,OAAO;AAAA,gBAElC;AAAA,sCAAC,UAAK,WAAU,kHACb,kBAAQ,MACX;AAAA,kBACA,qBAAC,UAAK,WAAU,gCACd;AAAA,wCAAC,UAAK,WAAU,wBAAwB,kBAAQ,OAAM;AAAA,oBACrD,QAAQ,cACP,oBAAC,UAAK,WAAU,0CAA0C,kBAAQ,aAAY,IAC5E;AAAA,qBACN;AAAA,kBACC,QAAQ,WACP,oBAAC,UAAK,WAAU,oDAAoD,kBAAQ,UAAS,IACnF;AAAA;AAAA;AAAA,cAtBC,QAAQ;AAAA,YAuBf;AAAA,UAEJ,CAAC;AAAA,aAhCO,KAiCV,CACD;AAAA;AAAA,IAEL;AAAA,IACA,SAAS;AAAA,EACX;AACF;","names":[]}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { Extension } from "@tiptap/core";
|
|
6
|
+
import { exitSuggestion } from "@tiptap/suggestion";
|
|
7
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
8
|
+
import { listPosition, onViewportMove } from "./geometry.mjs";
|
|
9
|
+
const CLOSED = { open: false, groups: [], rows: [], index: 0, rect: null };
|
|
10
|
+
function createSuggestStore() {
|
|
11
|
+
const sources = /* @__PURE__ */ new Map();
|
|
12
|
+
let state = CLOSED;
|
|
13
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
14
|
+
const emit = (next) => {
|
|
15
|
+
state = next;
|
|
16
|
+
listeners.forEach((l) => l());
|
|
17
|
+
};
|
|
18
|
+
const place = () => {
|
|
19
|
+
for (const source of sources.values()) {
|
|
20
|
+
const r = source.locate();
|
|
21
|
+
if (r) return { left: r.left, top: r.top, bottom: r.bottom };
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
const rebuild = () => {
|
|
26
|
+
const active = [...sources.values()].sort((a, b) => a.order - b.order);
|
|
27
|
+
const groups = active.flatMap((s) => s.groups).filter((g) => g.rows.length);
|
|
28
|
+
const empty = active.find((s) => s.empty)?.empty;
|
|
29
|
+
emit({
|
|
30
|
+
open: active.length > 0 && (groups.length > 0 || Boolean(empty)),
|
|
31
|
+
groups,
|
|
32
|
+
rows: groups.flatMap((g) => g.rows),
|
|
33
|
+
index: 0,
|
|
34
|
+
empty,
|
|
35
|
+
rect: place()
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
get: () => state,
|
|
40
|
+
subscribe(listener) {
|
|
41
|
+
listeners.add(listener);
|
|
42
|
+
return () => {
|
|
43
|
+
listeners.delete(listener);
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
set(name, source) {
|
|
47
|
+
sources.set(name, source);
|
|
48
|
+
rebuild();
|
|
49
|
+
},
|
|
50
|
+
remove(name) {
|
|
51
|
+
if (sources.delete(name)) rebuild();
|
|
52
|
+
},
|
|
53
|
+
highlight(index) {
|
|
54
|
+
if (index !== state.index) emit({ ...state, index });
|
|
55
|
+
},
|
|
56
|
+
/** The page moved under the list. */
|
|
57
|
+
move() {
|
|
58
|
+
if (state.open) emit({ ...state, rect: place() ?? state.rect });
|
|
59
|
+
},
|
|
60
|
+
keys: () => [...sources.values()].map((s) => s.key)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const SuggestListHost = Extension.create({
|
|
64
|
+
name: "suggestList",
|
|
65
|
+
addStorage() {
|
|
66
|
+
return { store: createSuggestStore() };
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
function suggestRender(options) {
|
|
70
|
+
return () => {
|
|
71
|
+
let store = null;
|
|
72
|
+
const show = (props) => {
|
|
73
|
+
store = props.editor.storage.suggestList.store;
|
|
74
|
+
store.set(options.name, {
|
|
75
|
+
order: options.order,
|
|
76
|
+
key: options.key,
|
|
77
|
+
groups: options.groups(props.items, (item) => props.command(item), props.editor),
|
|
78
|
+
empty: options.empty?.(props.editor),
|
|
79
|
+
locate: () => props.clientRect?.() ?? null
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
onStart: show,
|
|
84
|
+
onUpdate: show,
|
|
85
|
+
onExit: () => store?.remove(options.name),
|
|
86
|
+
onKeyDown: ({ view, event }) => {
|
|
87
|
+
if (!store) return false;
|
|
88
|
+
if (event.key === "Escape") {
|
|
89
|
+
store.keys().forEach((key) => key !== options.key && exitSuggestion(view, key));
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
const { rows, index } = store.get();
|
|
93
|
+
if (!rows.length) return false;
|
|
94
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
95
|
+
store.highlight((index + (event.key === "ArrowDown" ? 1 : -1) + rows.length) % rows.length);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
99
|
+
rows[Math.min(index, rows.length - 1)].pick();
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function useActiveDescendant(editor, open, listId, optionId) {
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
if (!open) return;
|
|
110
|
+
const dom = editor.view.dom;
|
|
111
|
+
dom.setAttribute("aria-controls", listId);
|
|
112
|
+
if (optionId) dom.setAttribute("aria-activedescendant", optionId);
|
|
113
|
+
else dom.removeAttribute("aria-activedescendant");
|
|
114
|
+
return () => {
|
|
115
|
+
dom.removeAttribute("aria-controls");
|
|
116
|
+
dom.removeAttribute("aria-activedescendant");
|
|
117
|
+
};
|
|
118
|
+
}, [editor, open, listId, optionId]);
|
|
119
|
+
}
|
|
120
|
+
function SuggestList({ editor, label }) {
|
|
121
|
+
const { store } = editor.storage.suggestList;
|
|
122
|
+
const state = React.useSyncExternalStore(store.subscribe, store.get, () => CLOSED);
|
|
123
|
+
const listRef = React.useRef(null);
|
|
124
|
+
const listId = React.useId();
|
|
125
|
+
const { open, rows, index, groups, rect, empty } = state;
|
|
126
|
+
useActiveDescendant(editor, open, listId, rows.length ? `${listId}-${index}` : null);
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
listRef.current?.querySelector("[data-highlighted]")?.scrollIntoView({ block: "nearest" });
|
|
129
|
+
}, [index, open]);
|
|
130
|
+
React.useEffect(() => {
|
|
131
|
+
if (open) return onViewportMove(store.move);
|
|
132
|
+
}, [open, store]);
|
|
133
|
+
if (!open || !rect) return null;
|
|
134
|
+
return createPortal(
|
|
135
|
+
/* @__PURE__ */ jsxs(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
ref: listRef,
|
|
139
|
+
id: listId,
|
|
140
|
+
role: "listbox",
|
|
141
|
+
"aria-label": label,
|
|
142
|
+
"data-slot": "document-editor-suggest-list",
|
|
143
|
+
className: cn(
|
|
144
|
+
"fixed z-50 max-h-72 w-64 overflow-y-auto overscroll-contain rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-border-soft ring-inset [--surface:var(--popover)]",
|
|
145
|
+
"animate-in fade-in-0 zoom-in-95 duration-fast ease-out"
|
|
146
|
+
),
|
|
147
|
+
style: listPosition(rect, 256, 300),
|
|
148
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
149
|
+
children: [
|
|
150
|
+
groups.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-1.5 text-sm text-muted-foreground", children: empty }) : null,
|
|
151
|
+
groups.map((group) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": group.label, children: [
|
|
152
|
+
/* @__PURE__ */ jsx("p", { className: "px-2 pt-1.5 pb-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
153
|
+
group.rows.map((row) => {
|
|
154
|
+
const i = rows.indexOf(row);
|
|
155
|
+
return /* @__PURE__ */ jsxs(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
id: `${listId}-${i}`,
|
|
159
|
+
role: "option",
|
|
160
|
+
"aria-selected": i === index,
|
|
161
|
+
"data-highlighted": i === index ? "" : void 0,
|
|
162
|
+
className: "flex min-h-control-sm cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-sm data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground pointer-coarse:min-h-11",
|
|
163
|
+
onMouseMove: () => store.highlight(i),
|
|
164
|
+
onClick: row.pick,
|
|
165
|
+
children: [
|
|
166
|
+
row.lead,
|
|
167
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: row.label }),
|
|
168
|
+
row.detail ? /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 pl-2 text-xs text-muted-foreground", children: row.detail }) : null
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
row.id
|
|
172
|
+
);
|
|
173
|
+
})
|
|
174
|
+
] }, group.label))
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
document.body
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
SuggestList,
|
|
183
|
+
SuggestListHost,
|
|
184
|
+
suggestRender,
|
|
185
|
+
useActiveDescendant
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=suggest-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/document-editor/suggest-list.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { Extension, type Editor } from \"@tiptap/core\"\nimport type { PluginKey } from \"@tiptap/pm/state\"\nimport { exitSuggestion, type SuggestionKeyDownProps, type SuggestionOptions, type SuggestionProps } from \"@tiptap/suggestion\"\n\nimport { cn } from \"../../../lib/utils.mjs\"\n\nimport { listPosition, onViewportMove, type AnchorRect } from \"./geometry.mjs\"\n\n/*\n * One list for every trigger (@ for people, pages and dates, : for emoji). Each suggestion plugin\n * is a source that adds its groups while it's active, so two plugins on the same character share\n * the list, its highlight and its keys.\n */\n\nexport interface SuggestRow {\n id: string\n label: string\n /** The quiet text at the end of the row. */\n detail?: string\n lead?: React.ReactNode\n pick: () => void\n}\n\nexport interface SuggestGroup {\n label: string\n rows: SuggestRow[]\n}\n\ninterface Source {\n order: number\n key: PluginKey\n groups: SuggestGroup[]\n /** Shown when no source has a row. */\n empty?: string\n locate: () => DOMRect | null\n}\n\ninterface SuggestState {\n open: boolean\n groups: SuggestGroup[]\n rows: SuggestRow[]\n index: number\n empty?: string\n rect: AnchorRect | null\n}\n\nconst CLOSED: SuggestState = { open: false, groups: [], rows: [], index: 0, rect: null }\n\nfunction createSuggestStore() {\n const sources = new Map<string, Source>()\n let state = CLOSED\n const listeners = new Set<() => void>()\n const emit = (next: SuggestState) => {\n state = next\n listeners.forEach((l) => l())\n }\n const place = (): AnchorRect | null => {\n for (const source of sources.values()) {\n const r = source.locate()\n if (r) return { left: r.left, top: r.top, bottom: r.bottom }\n }\n return null\n }\n const rebuild = () => {\n const active = [...sources.values()].sort((a, b) => a.order - b.order)\n const groups = active.flatMap((s) => s.groups).filter((g) => g.rows.length)\n const empty = active.find((s) => s.empty)?.empty\n emit({\n open: active.length > 0 && (groups.length > 0 || Boolean(empty)),\n groups,\n rows: groups.flatMap((g) => g.rows),\n index: 0,\n empty,\n rect: place(),\n })\n }\n return {\n get: () => state,\n subscribe(listener: () => void) {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n set(name: string, source: Source) {\n sources.set(name, source)\n rebuild()\n },\n remove(name: string) {\n if (sources.delete(name)) rebuild()\n },\n highlight(index: number) {\n if (index !== state.index) emit({ ...state, index })\n },\n /** The page moved under the list. */\n move() {\n if (state.open) emit({ ...state, rect: place() ?? state.rect })\n },\n keys: () => [...sources.values()].map((s) => s.key),\n }\n}\nexport type SuggestStore = ReturnType<typeof createSuggestStore>\n\ndeclare module \"@tiptap/core\" {\n interface Storage {\n suggestList: { store: SuggestStore }\n }\n}\n\n/** Holds the shared list. Every Document Editor has it; add it to an editor of your own. */\nexport const SuggestListHost = Extension.create<object, { store: SuggestStore }>({\n name: \"suggestList\",\n addStorage() {\n return { store: createSuggestStore() }\n },\n})\n\n/** A suggestion plugin's `render`, feeding the shared list. */\nexport function suggestRender<Item>(options: {\n /** Names the source; also its place in the list through `order`. */\n name: string\n order: number\n key: PluginKey\n groups: (items: Item[], pick: (item: Item) => void, editor: Editor) => SuggestGroup[]\n empty?: (editor: Editor) => string\n}): NonNullable<SuggestionOptions<Item>[\"render\"]> {\n return () => {\n let store: SuggestStore | null = null\n const show = (props: SuggestionProps<Item>) => {\n store = props.editor.storage.suggestList.store\n store.set(options.name, {\n order: options.order,\n key: options.key,\n groups: options.groups(props.items, (item) => props.command(item as never), props.editor),\n empty: options.empty?.(props.editor),\n locate: () => props.clientRect?.() ?? null,\n })\n }\n return {\n onStart: show,\n onUpdate: show,\n onExit: () => store?.remove(options.name),\n onKeyDown: ({ view, event }: SuggestionKeyDownProps) => {\n if (!store) return false\n if (event.key === \"Escape\") {\n // Tiptap closes the plugin that saw the key; the others on the list go with it.\n store.keys().forEach((key) => key !== options.key && exitSuggestion(view, key))\n return false\n }\n const { rows, index } = store.get()\n if (!rows.length) return false\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n store.highlight((index + (event.key === \"ArrowDown\" ? 1 : -1) + rows.length) % rows.length)\n return true\n }\n if (event.key === \"Enter\" || event.key === \"Tab\") {\n rows[Math.min(index, rows.length - 1)].pick()\n return true\n }\n return false\n },\n }\n }\n}\n\n/** Points the textbox at the highlighted row, for screen readers: focus never leaves the document. */\nexport function useActiveDescendant(editor: Editor, open: boolean, listId: string, optionId: string | null) {\n React.useEffect(() => {\n if (!open) return\n const dom = editor.view.dom\n dom.setAttribute(\"aria-controls\", listId)\n if (optionId) dom.setAttribute(\"aria-activedescendant\", optionId)\n else dom.removeAttribute(\"aria-activedescendant\")\n return () => {\n dom.removeAttribute(\"aria-controls\")\n dom.removeAttribute(\"aria-activedescendant\")\n }\n }, [editor, open, listId, optionId])\n}\n\n/** The shared list on screen. The root renders it. */\nexport function SuggestList({ editor, label }: { editor: Editor; label: string }) {\n const { store } = editor.storage.suggestList\n const state = React.useSyncExternalStore(store.subscribe, store.get, () => CLOSED)\n const listRef = React.useRef<HTMLDivElement | null>(null)\n const listId = React.useId()\n const { open, rows, index, groups, rect, empty } = state\n useActiveDescendant(editor, open, listId, rows.length ? `${listId}-${index}` : null)\n\n React.useEffect(() => {\n listRef.current?.querySelector(\"[data-highlighted]\")?.scrollIntoView({ block: \"nearest\" })\n }, [index, open])\n React.useEffect(() => {\n if (open) return onViewportMove(store.move)\n }, [open, store])\n\n if (!open || !rect) return null\n return createPortal(\n <div\n ref={listRef}\n id={listId}\n role=\"listbox\"\n aria-label={label}\n data-slot=\"document-editor-suggest-list\"\n className={cn(\n \"fixed z-50 max-h-72 w-64 overflow-y-auto overscroll-contain rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-border-soft ring-inset [--surface:var(--popover)]\",\n \"animate-in fade-in-0 zoom-in-95 duration-fast ease-out\",\n )}\n style={listPosition(rect, 256, 300)}\n // Keep the caret in the document.\n onMouseDown={(event) => event.preventDefault()}\n >\n {groups.length === 0 ? <p className=\"px-2 py-1.5 text-sm text-muted-foreground\">{empty}</p> : null}\n {groups.map((group) => (\n <div key={group.label} role=\"group\" aria-label={group.label}>\n <p className=\"px-2 pt-1.5 pb-1 text-xs font-medium text-muted-foreground\">{group.label}</p>\n {group.rows.map((row) => {\n const i = rows.indexOf(row)\n return (\n <div\n key={row.id}\n id={`${listId}-${i}`}\n role=\"option\"\n aria-selected={i === index}\n data-highlighted={i === index ? \"\" : undefined}\n className=\"flex min-h-control-sm cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-sm data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground pointer-coarse:min-h-11\"\n onMouseMove={() => store.highlight(i)}\n onClick={row.pick}\n >\n {row.lead}\n <span className=\"truncate\">{row.label}</span>\n {row.detail ? <span className=\"ml-auto shrink-0 pl-2 text-xs text-muted-foreground\">{row.detail}</span> : null}\n </div>\n )\n })}\n </div>\n ))}\n </div>,\n document.body,\n )\n}\n"],"mappings":";AAwN6B,cAOf,YAPe;AAtN7B,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,iBAA8B;AAEvC,SAAS,sBAAiG;AAE1G,SAAS,UAAU;AAEnB,SAAS,cAAc,sBAAuC;AAwC9D,MAAM,SAAuB,EAAE,MAAM,OAAO,QAAQ,CAAC,GAAG,MAAM,CAAC,GAAG,OAAO,GAAG,MAAM,KAAK;AAEvF,SAAS,qBAAqB;AAC5B,QAAM,UAAU,oBAAI,IAAoB;AACxC,MAAI,QAAQ;AACZ,QAAM,YAAY,oBAAI,IAAgB;AACtC,QAAM,OAAO,CAAC,SAAuB;AACnC,YAAQ;AACR,cAAU,QAAQ,CAAC,MAAM,EAAE,CAAC;AAAA,EAC9B;AACA,QAAM,QAAQ,MAAyB;AACrC,eAAW,UAAU,QAAQ,OAAO,GAAG;AACrC,YAAM,IAAI,OAAO,OAAO;AACxB,UAAI,EAAG,QAAO,EAAE,MAAM,EAAE,MAAM,KAAK,EAAE,KAAK,QAAQ,EAAE,OAAO;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AACA,QAAM,UAAU,MAAM;AACpB,UAAM,SAAS,CAAC,GAAG,QAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;AACrE,UAAM,SAAS,OAAO,QAA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