@kortix/ui 0.0.0-bootstrap.0 → 0.14.3
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 +153 -2
- package/dist/_vendor/kortix-shared.js +341 -0
- package/dist/chat/agent-picker.d.ts +8 -0
- package/dist/chat/agent-picker.js +18 -0
- package/dist/chat/composer.d.ts +31 -0
- package/dist/chat/composer.js +114 -0
- package/dist/chat/index.d.ts +22 -0
- package/dist/chat/index.js +22 -0
- package/dist/chat/markdown.d.ts +10 -0
- package/dist/chat/markdown.js +36 -0
- package/dist/chat/message-list.d.ts +25 -0
- package/dist/chat/message-list.js +73 -0
- package/dist/chat/message-view.d.ts +17 -0
- package/dist/chat/message-view.js +86 -0
- package/dist/chat/model-picker.d.ts +10 -0
- package/dist/chat/model-picker.js +68 -0
- package/dist/chat/permission-prompt.d.ts +10 -0
- package/dist/chat/permission-prompt.js +40 -0
- package/dist/chat/question-prompt.d.ts +8 -0
- package/dist/chat/question-prompt.js +60 -0
- package/dist/chat/send-failure.d.ts +9 -0
- package/dist/chat/send-failure.js +21 -0
- package/dist/chat/session-thread.d.ts +28 -0
- package/dist/chat/session-thread.js +47 -0
- package/dist/chat/streaming-markdown.d.ts +21 -0
- package/dist/chat/streaming-markdown.js +59 -0
- package/dist/chat/tool-call.d.ts +4 -0
- package/dist/chat/tool-call.js +150 -0
- package/dist/chat/user-message-parts.d.ts +6 -0
- package/dist/chat/user-message-parts.js +11 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +18 -0
- package/dist/components/ui/alert-dialog.d.ts +19 -0
- package/dist/components/ui/alert-dialog.js +48 -0
- package/dist/components/ui/alert.d.ts +13 -0
- package/dist/components/ui/alert.js +67 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.js +23 -0
- package/dist/components/ui/back-pill.d.ts +13 -0
- package/dist/components/ui/back-pill.js +18 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.js +42 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +28 -0
- package/dist/components/ui/bubble.d.ts +20 -0
- package/dist/components/ui/bubble.js +38 -0
- package/dist/components/ui/button-group.d.ts +9 -0
- package/dist/components/ui/button-group.js +32 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/button.js +67 -0
- package/dist/components/ui/calendar.d.ts +4 -0
- package/dist/components/ui/calendar.js +39 -0
- package/dist/components/ui/card.d.ts +96 -0
- package/dist/components/ui/card.js +291 -0
- package/dist/components/ui/chain-of-thought.d.ts +75 -0
- package/dist/components/ui/chain-of-thought.js +66 -0
- package/dist/components/ui/chart.d.ts +65 -0
- package/dist/components/ui/chart.js +118 -0
- package/dist/components/ui/checkbox-group.d.ts +19 -0
- package/dist/components/ui/checkbox-group.js +41 -0
- package/dist/components/ui/checkbox.d.ts +14 -0
- package/dist/components/ui/checkbox.js +27 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +14 -0
- package/dist/components/ui/command.d.ts +58 -0
- package/dist/components/ui/command.js +135 -0
- package/dist/components/ui/confirm-dialog.d.ts +19 -0
- package/dist/components/ui/confirm-dialog.js +30 -0
- package/dist/components/ui/context-menu.d.ts +45 -0
- package/dist/components/ui/context-menu.js +93 -0
- package/dist/components/ui/count-badge.d.ts +26 -0
- package/dist/components/ui/count-badge.js +26 -0
- package/dist/components/ui/data-grid.d.ts +24 -0
- package/dist/components/ui/data-grid.js +107 -0
- package/dist/components/ui/date-range-picker.d.ts +119 -0
- package/dist/components/ui/date-range-picker.js +190 -0
- package/dist/components/ui/definition-list.d.ts +15 -0
- package/dist/components/ui/definition-list.js +26 -0
- package/dist/components/ui/dialog.d.ts +29 -0
- package/dist/components/ui/dialog.js +52 -0
- package/dist/components/ui/disclosure.d.ts +121 -0
- package/dist/components/ui/disclosure.js +138 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-10.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-10.js +29 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-12.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-12.js +19 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-13.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-13.js +19 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-15.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-15.js +22 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-16.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-16.js +5 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-18.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-18.js +5 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-19.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-19.js +5 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-2.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-2.js +3 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-20.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-20.js +5 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-21.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-21.js +5 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-3.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-3.js +3 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-4.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-4.js +3 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-5.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-5.js +3 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-6.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-6.js +19 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-7.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-7.js +19 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-8.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-8.js +19 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-9.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-3x3-9.js +23 -0
- package/dist/components/ui/dot-matrix/dotm-circular-1.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-1.js +28 -0
- package/dist/components/ui/dot-matrix/dotm-circular-10.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-10.js +40 -0
- package/dist/components/ui/dot-matrix/dotm-circular-11.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-11.js +37 -0
- package/dist/components/ui/dot-matrix/dotm-circular-12.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-12.js +42 -0
- package/dist/components/ui/dot-matrix/dotm-circular-14.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-14.js +37 -0
- package/dist/components/ui/dot-matrix/dotm-circular-15.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-15.js +49 -0
- package/dist/components/ui/dot-matrix/dotm-circular-17.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-17.js +31 -0
- package/dist/components/ui/dot-matrix/dotm-circular-2.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-2.js +37 -0
- package/dist/components/ui/dot-matrix/dotm-circular-3.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-3.js +54 -0
- package/dist/components/ui/dot-matrix/dotm-circular-4.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-4.js +35 -0
- package/dist/components/ui/dot-matrix/dotm-circular-5.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-5.js +30 -0
- package/dist/components/ui/dot-matrix/dotm-circular-6.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-6.js +37 -0
- package/dist/components/ui/dot-matrix/dotm-circular-7.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-7.js +25 -0
- package/dist/components/ui/dot-matrix/dotm-circular-8.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-8.js +26 -0
- package/dist/components/ui/dot-matrix/dotm-circular-9.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-circular-9.js +41 -0
- package/dist/components/ui/dot-matrix/dotm-square-1.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-1.js +27 -0
- package/dist/components/ui/dot-matrix/dotm-square-10.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-10.js +27 -0
- package/dist/components/ui/dot-matrix/dotm-square-11.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-11.js +25 -0
- package/dist/components/ui/dot-matrix/dotm-square-12.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-12.js +28 -0
- package/dist/components/ui/dot-matrix/dotm-square-13.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-13.js +45 -0
- package/dist/components/ui/dot-matrix/dotm-square-14.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-14.js +38 -0
- package/dist/components/ui/dot-matrix/dotm-square-15.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-15.js +31 -0
- package/dist/components/ui/dot-matrix/dotm-square-16.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-16.js +33 -0
- package/dist/components/ui/dot-matrix/dotm-square-17.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-17.js +27 -0
- package/dist/components/ui/dot-matrix/dotm-square-18.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-18.js +29 -0
- package/dist/components/ui/dot-matrix/dotm-square-19.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-19.js +74 -0
- package/dist/components/ui/dot-matrix/dotm-square-2.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-2.js +72 -0
- package/dist/components/ui/dot-matrix/dotm-square-20.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-20.js +79 -0
- package/dist/components/ui/dot-matrix/dotm-square-3.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-3.js +23 -0
- package/dist/components/ui/dot-matrix/dotm-square-4.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-4.js +41 -0
- package/dist/components/ui/dot-matrix/dotm-square-5.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-5.js +23 -0
- package/dist/components/ui/dot-matrix/dotm-square-6.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-6.js +20 -0
- package/dist/components/ui/dot-matrix/dotm-square-7.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-7.js +43 -0
- package/dist/components/ui/dot-matrix/dotm-square-8.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-8.js +57 -0
- package/dist/components/ui/dot-matrix/dotm-square-9.d.ts +4 -0
- package/dist/components/ui/dot-matrix/dotm-square-9.js +89 -0
- package/dist/components/ui/dot-matrix/session-dot-matrix.d.ts +46 -0
- package/dist/components/ui/dot-matrix/session-dot-matrix.js +153 -0
- package/dist/components/ui/drawer.d.ts +15 -0
- package/dist/components/ui/drawer.js +35 -0
- package/dist/components/ui/dropdown-menu.d.ts +49 -0
- package/dist/components/ui/dropdown-menu.js +113 -0
- package/dist/components/ui/emoji-picker.d.ts +15 -0
- package/dist/components/ui/emoji-picker.js +137 -0
- package/dist/components/ui/emoji-tint.d.ts +41 -0
- package/dist/components/ui/emoji-tint.js +131 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/empty.js +33 -0
- package/dist/components/ui/entity-avatar.d.ts +84 -0
- package/dist/components/ui/entity-avatar.js +106 -0
- package/dist/components/ui/faded-scroll-area.d.ts +8 -0
- package/dist/components/ui/faded-scroll-area.js +80 -0
- package/dist/components/ui/favicon-avatar.d.ts +32 -0
- package/dist/components/ui/favicon-avatar.js +18 -0
- package/dist/components/ui/field.d.ts +15 -0
- package/dist/components/ui/field.js +48 -0
- package/dist/components/ui/file-tree.d.ts +32 -0
- package/dist/components/ui/file-tree.js +30 -0
- package/dist/components/ui/glyph-face.d.ts +18 -0
- package/dist/components/ui/glyph-face.js +37 -0
- package/dist/components/ui/glyph-paths-source.d.ts +2 -0
- package/dist/components/ui/glyph-paths-source.js +40 -0
- package/dist/components/ui/glyph-paths.generated.d.ts +2 -0
- package/dist/components/ui/glyph-paths.generated.js +207 -0
- package/dist/components/ui/glyph-picker.d.ts +22 -0
- package/dist/components/ui/glyph-picker.js +118 -0
- package/dist/components/ui/glyph-registry.d.ts +36 -0
- package/dist/components/ui/glyph-registry.js +479 -0
- package/dist/components/ui/glyph-tint.d.ts +6 -0
- package/dist/components/ui/glyph-tint.js +93 -0
- package/dist/components/ui/hint.d.ts +14 -0
- package/dist/components/ui/hint.js +12 -0
- package/dist/components/ui/histogram-bars.d.ts +38 -0
- package/dist/components/ui/histogram-bars.js +93 -0
- package/dist/components/ui/hover-card.d.ts +28 -0
- package/dist/components/ui/hover-card.js +35 -0
- package/dist/components/ui/icon-provider.d.ts +23 -0
- package/dist/components/ui/icon-provider.js +30 -0
- package/dist/components/ui/info-banner.d.ts +14 -0
- package/dist/components/ui/info-banner.js +72 -0
- package/dist/components/ui/inline-meta.d.ts +6 -0
- package/dist/components/ui/inline-meta.js +8 -0
- package/dist/components/ui/input-group.d.ts +19 -0
- package/dist/components/ui/input-group.js +73 -0
- package/dist/components/ui/input.d.ts +26 -0
- package/dist/components/ui/input.js +23 -0
- package/dist/components/ui/item.d.ts +23 -0
- package/dist/components/ui/item.js +67 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +20 -0
- package/dist/components/ui/kortix-asterisk.d.ts +6 -0
- package/dist/components/ui/kortix-asterisk.js +17 -0
- package/dist/components/ui/kortix-icons.d.ts +2 -0
- package/dist/components/ui/kortix-icons.js +17 -0
- package/dist/components/ui/kortix-loader.d.ts +76 -0
- package/dist/components/ui/kortix-loader.js +74 -0
- package/dist/components/ui/kortix-logo.d.ts +30 -0
- package/dist/components/ui/kortix-logo.js +47 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +9 -0
- package/dist/components/ui/list.d.ts +15 -0
- package/dist/components/ui/list.js +25 -0
- package/dist/components/ui/loading.d.ts +19 -0
- package/dist/components/ui/loading.js +31 -0
- package/dist/components/ui/local-time.d.ts +34 -0
- package/dist/components/ui/local-time.js +60 -0
- package/dist/components/ui/map.d.ts +101 -0
- package/dist/components/ui/map.js +257 -0
- package/dist/components/ui/marker.d.ts +14 -0
- package/dist/components/ui/marker.js +28 -0
- package/dist/components/ui/menu-recipe.d.ts +102 -0
- package/dist/components/ui/menu-recipe.js +129 -0
- package/dist/components/ui/mermaid-render.d.ts +51 -0
- package/dist/components/ui/mermaid-render.js +65 -0
- package/dist/components/ui/mermaid-renderer.d.ts +13 -0
- package/dist/components/ui/mermaid-renderer.js +340 -0
- package/dist/components/ui/message.d.ts +15 -0
- package/dist/components/ui/message.js +26 -0
- package/dist/components/ui/modal.d.ts +104 -0
- package/dist/components/ui/modal.js +180 -0
- package/dist/components/ui/navigation-menu.d.ts +16 -0
- package/dist/components/ui/navigation-menu.js +35 -0
- package/dist/components/ui/page-search-bar.d.ts +11 -0
- package/dist/components/ui/page-search-bar.js +13 -0
- package/dist/components/ui/phone-input.d.ts +7 -0
- package/dist/components/ui/phone-input.js +59 -0
- package/dist/components/ui/pixel-kortix-mark.d.ts +13 -0
- package/dist/components/ui/pixel-kortix-mark.js +40 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +38 -0
- package/dist/components/ui/portal.d.ts +5 -0
- package/dist/components/ui/portal.js +15 -0
- package/dist/components/ui/preview-image.d.ts +14 -0
- package/dist/components/ui/preview-image.js +58 -0
- package/dist/components/ui/progress-ring.d.ts +6 -0
- package/dist/components/ui/progress-ring.js +9 -0
- package/dist/components/ui/progress.d.ts +6 -0
- package/dist/components/ui/progress.js +8 -0
- package/dist/components/ui/radio-group.d.ts +12 -0
- package/dist/components/ui/radio-group.js +20 -0
- package/dist/components/ui/resizable.d.ts +24 -0
- package/dist/components/ui/resizable.js +16 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/section-card.d.ts +37 -0
- package/dist/components/ui/section-card.js +14 -0
- package/dist/components/ui/section.d.ts +10 -0
- package/dist/components/ui/section.js +22 -0
- package/dist/components/ui/select.d.ts +25 -0
- package/dist/components/ui/select.js +59 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/shader-safe.d.ts +48 -0
- package/dist/components/ui/shader-safe.js +74 -0
- package/dist/components/ui/sheet.d.ts +32 -0
- package/dist/components/ui/sheet.js +55 -0
- package/dist/components/ui/sidebar-context.d.ts +72 -0
- package/dist/components/ui/sidebar-context.js +36 -0
- package/dist/components/ui/sidebar-menu-primitives.d.ts +38 -0
- package/dist/components/ui/sidebar-menu-primitives.js +97 -0
- package/dist/components/ui/sidebar-panel.d.ts +36 -0
- package/dist/components/ui/sidebar-panel.js +265 -0
- package/dist/components/ui/sidebar-peek.d.ts +27 -0
- package/dist/components/ui/sidebar-peek.js +70 -0
- package/dist/components/ui/sidebar-width.d.ts +48 -0
- package/dist/components/ui/sidebar-width.js +62 -0
- package/dist/components/ui/sidebar.d.ts +18 -0
- package/dist/components/ui/sidebar.js +194 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/slider-native.d.ts +7 -0
- package/dist/components/ui/slider-native.js +16 -0
- package/dist/components/ui/slider.d.ts +14 -0
- package/dist/components/ui/slider.js +48 -0
- package/dist/components/ui/sliding-tab-indicator.d.ts +61 -0
- package/dist/components/ui/sliding-tab-indicator.js +128 -0
- package/dist/components/ui/split-sheet.d.ts +61 -0
- package/dist/components/ui/split-sheet.js +239 -0
- package/dist/components/ui/spotlight-card.d.ts +8 -0
- package/dist/components/ui/spotlight-card.js +43 -0
- package/dist/components/ui/status-ring.d.ts +38 -0
- package/dist/components/ui/status-ring.js +38 -0
- package/dist/components/ui/status.d.ts +58 -0
- package/dist/components/ui/status.js +76 -0
- package/dist/components/ui/stepper.d.ts +28 -0
- package/dist/components/ui/stepper.js +73 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.js +131 -0
- package/dist/components/ui/system-message.d.ts +23 -0
- package/dist/components/ui/system-message.js +51 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +28 -0
- package/dist/components/ui/tabs.d.ts +73 -0
- package/dist/components/ui/tabs.js +207 -0
- package/dist/components/ui/tag.d.ts +7 -0
- package/dist/components/ui/tag.js +22 -0
- package/dist/components/ui/text-shimmer.d.ts +13 -0
- package/dist/components/ui/text-shimmer.js +91 -0
- package/dist/components/ui/textarea.d.ts +33 -0
- package/dist/components/ui/textarea.js +87 -0
- package/dist/components/ui/toast.d.ts +105 -0
- package/dist/components/ui/toast.js +233 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.js +16 -0
- package/dist/components/ui/trigger-variants.d.ts +14 -0
- package/dist/components/ui/trigger-variants.js +67 -0
- package/dist/components/ui/type-to-confirm-dialog.d.ts +88 -0
- package/dist/components/ui/type-to-confirm-dialog.js +101 -0
- package/dist/components/ui/typed-title-logic.d.ts +22 -0
- package/dist/components/ui/typed-title-logic.js +33 -0
- package/dist/components/ui/typed-title.d.ts +38 -0
- package/dist/components/ui/typed-title.js +66 -0
- package/dist/components/ui/typing-animation.d.ts +36 -0
- package/dist/components/ui/typing-animation.js +141 -0
- package/dist/components/ui/user-avatar.d.ts +47 -0
- package/dist/components/ui/user-avatar.js +46 -0
- package/dist/hooks/use-debounce.d.ts +4 -0
- package/dist/hooks/use-debounce.js +17 -0
- package/dist/hooks/use-is-dark.d.ts +2 -0
- package/dist/hooks/use-is-dark.js +27 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/hooks/use-proximity-hover.d.ts +52 -0
- package/dist/hooks/use-proximity-hover.js +232 -0
- package/dist/icons/close.d.ts +2 -0
- package/dist/icons/close.js +7 -0
- package/dist/icons/copy.d.ts +3 -0
- package/dist/icons/copy.js +6 -0
- package/dist/icons/sidebar-toggle.d.ts +13 -0
- package/dist/icons/sidebar-toggle.js +13 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +33 -0
- package/dist/lib/dotmatrix-core.d.ts +113 -0
- package/dist/lib/dotmatrix-core.js +920 -0
- package/dist/lib/dotmatrix-hooks.d.ts +28 -0
- package/dist/lib/dotmatrix-hooks.js +151 -0
- package/dist/lib/favicon.d.ts +4 -0
- package/dist/lib/favicon.js +21 -0
- package/dist/lib/font-weight.d.ts +6 -0
- package/dist/lib/font-weight.js +6 -0
- package/dist/lib/icon-config.d.ts +33 -0
- package/dist/lib/icon-config.js +22 -0
- package/dist/lib/icon-context.d.ts +34 -0
- package/dist/lib/icon-context.js +81 -0
- package/dist/lib/portal-root.d.ts +8 -0
- package/dist/lib/portal-root.js +26 -0
- package/dist/lib/settle.d.ts +16 -0
- package/dist/lib/settle.js +29 -0
- package/dist/lib/springs.d.ts +31 -0
- package/dist/lib/springs.js +29 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/lib/z-stack.d.ts +55 -0
- package/dist/lib/z-stack.js +130 -0
- package/dist/providers/ui-provider.d.ts +141 -0
- package/dist/providers/ui-provider.js +93 -0
- package/dist/styles/dotmatrix-loader.css +1239 -0
- package/dist/styles/fonts.css +46 -0
- package/dist/styles/tailwind.css +10 -0
- package/dist/styles/theme.css +1019 -0
- package/dist/styles/tokens.css +146 -0
- package/dist/styles.css +2 -0
- package/package.json +874 -4
- package/skills/kortix-ui/SKILL.md +150 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mermaid configuration and render cleanup, kept apart from the component so
|
|
3
|
+
* the contract is testable without a DOM.
|
|
4
|
+
*
|
|
5
|
+
* A failed render must stay inside its own diagram. `suppressErrorRendering`
|
|
6
|
+
* stops Mermaid from drawing its "Syntax error in text" diagram into the page;
|
|
7
|
+
* `render()` then throws and the component shows its own error state. The only
|
|
8
|
+
* nodes a render may leave behind are the two it created: the SVG (`chartId`)
|
|
9
|
+
* and its wrapper (`d${chartId}`). Cleanup removes those by id and nothing
|
|
10
|
+
* else — a sweep that matched on text would also match any app element whose
|
|
11
|
+
* content quotes that text.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MERMAID_CONFIG: {
|
|
14
|
+
readonly startOnLoad: false;
|
|
15
|
+
readonly securityLevel: "strict";
|
|
16
|
+
readonly suppressErrorRendering: true;
|
|
17
|
+
readonly theme: "base";
|
|
18
|
+
readonly fontFamily: "ui-sans-serif, system-ui, sans-serif";
|
|
19
|
+
readonly gitGraph: {
|
|
20
|
+
readonly showBranches: true;
|
|
21
|
+
readonly showCommitLabel: true;
|
|
22
|
+
readonly mainBranchName: "main";
|
|
23
|
+
readonly rotateCommitLabel: true;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** Remove the temporary nodes one `mermaid.render(chartId, …)` call created. */
|
|
27
|
+
export declare function removeMermaidRenderArtifacts(doc: Pick<Document, 'getElementById'>, chartId: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Rendered SVG per diagram source, least recently used first.
|
|
30
|
+
*
|
|
31
|
+
* Keyed by the source text itself, not a hash of it: a 32-bit hash served one
|
|
32
|
+
* diagram another diagram's SVG on a collision. Capped, because every distinct
|
|
33
|
+
* source a tab renders would otherwise stay for the life of the tab.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MERMAID_SVG_CACHE_MAX = 32;
|
|
36
|
+
/** The cached SVG for `source`, marked as most recently used. */
|
|
37
|
+
export declare function readCachedMermaidSvg(source: string): string | undefined;
|
|
38
|
+
export declare function cacheMermaidSvg(source: string, svg: string): void;
|
|
39
|
+
export declare function zoomAtPoint(zoom: number, panOffset: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}, point: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}, zoomFactor: number): {
|
|
46
|
+
zoom: number;
|
|
47
|
+
panOffset: {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mermaid configuration and render cleanup, kept apart from the component so
|
|
3
|
+
* the contract is testable without a DOM.
|
|
4
|
+
*
|
|
5
|
+
* A failed render must stay inside its own diagram. `suppressErrorRendering`
|
|
6
|
+
* stops Mermaid from drawing its "Syntax error in text" diagram into the page;
|
|
7
|
+
* `render()` then throws and the component shows its own error state. The only
|
|
8
|
+
* nodes a render may leave behind are the two it created: the SVG (`chartId`)
|
|
9
|
+
* and its wrapper (`d${chartId}`). Cleanup removes those by id and nothing
|
|
10
|
+
* else — a sweep that matched on text would also match any app element whose
|
|
11
|
+
* content quotes that text.
|
|
12
|
+
*/
|
|
13
|
+
export const MERMAID_CONFIG = {
|
|
14
|
+
startOnLoad: false,
|
|
15
|
+
securityLevel: 'strict',
|
|
16
|
+
suppressErrorRendering: true,
|
|
17
|
+
theme: 'base',
|
|
18
|
+
fontFamily: 'ui-sans-serif, system-ui, sans-serif',
|
|
19
|
+
gitGraph: {
|
|
20
|
+
showBranches: true,
|
|
21
|
+
showCommitLabel: true,
|
|
22
|
+
mainBranchName: 'main',
|
|
23
|
+
rotateCommitLabel: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
/** Remove the temporary nodes one `mermaid.render(chartId, …)` call created. */
|
|
27
|
+
export function removeMermaidRenderArtifacts(doc, chartId) {
|
|
28
|
+
for (const id of [chartId, `d${chartId}`]) {
|
|
29
|
+
doc.getElementById(id)?.remove();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rendered SVG per diagram source, least recently used first.
|
|
34
|
+
*
|
|
35
|
+
* Keyed by the source text itself, not a hash of it: a 32-bit hash served one
|
|
36
|
+
* diagram another diagram's SVG on a collision. Capped, because every distinct
|
|
37
|
+
* source a tab renders would otherwise stay for the life of the tab.
|
|
38
|
+
*/
|
|
39
|
+
export const MERMAID_SVG_CACHE_MAX = 32;
|
|
40
|
+
const mermaidSvgCache = new Map();
|
|
41
|
+
/** The cached SVG for `source`, marked as most recently used. */
|
|
42
|
+
export function readCachedMermaidSvg(source) {
|
|
43
|
+
const svg = mermaidSvgCache.get(source);
|
|
44
|
+
if (svg === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
mermaidSvgCache.delete(source);
|
|
47
|
+
mermaidSvgCache.set(source, svg);
|
|
48
|
+
return svg;
|
|
49
|
+
}
|
|
50
|
+
export function cacheMermaidSvg(source, svg) {
|
|
51
|
+
mermaidSvgCache.delete(source);
|
|
52
|
+
mermaidSvgCache.set(source, svg);
|
|
53
|
+
if (mermaidSvgCache.size > MERMAID_SVG_CACHE_MAX) {
|
|
54
|
+
const oldest = mermaidSvgCache.keys().next().value;
|
|
55
|
+
if (oldest !== undefined)
|
|
56
|
+
mermaidSvgCache.delete(oldest);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function zoomAtPoint(zoom, panOffset, point, zoomFactor) {
|
|
60
|
+
const newZoom = Math.max(0.1, Math.min(5, zoom * zoomFactor));
|
|
61
|
+
return { zoom: newZoom, panOffset: {
|
|
62
|
+
x: point.x - (point.x - panOffset.x) * (newZoom / zoom),
|
|
63
|
+
y: point.y - (point.y - panOffset.y) * (newZoom / zoom),
|
|
64
|
+
} };
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface MermaidRendererProps {
|
|
3
|
+
chart: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
enableFullscreen?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The message is still streaming. The diagram renders once its source holds
|
|
8
|
+
* still for `CODE_SETTLE_MS`, not once per streamed token.
|
|
9
|
+
*/
|
|
10
|
+
isStreaming?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const MermaidRenderer: React.FC<MermaidRendererProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CODE_SETTLE_MS, useSettledValue } from '../../lib/settle.js';
|
|
4
|
+
import { Button } from './button.js';
|
|
5
|
+
import { ButtonGroup } from './button-group.js';
|
|
6
|
+
import Hint from './hint.js';
|
|
7
|
+
import { KortixLoader } from './kortix-loader.js';
|
|
8
|
+
import { cacheMermaidSvg, MERMAID_CONFIG, readCachedMermaidSvg, removeMermaidRenderArtifacts, zoomAtPoint, } from './mermaid-render.js';
|
|
9
|
+
import { Modal, ModalBody, ModalClose, ModalContent, ModalTitle } from './modal.js';
|
|
10
|
+
import { cn } from '../../lib/utils.js';
|
|
11
|
+
import { CheckIcon as Check, ArrowsOutSimpleIcon as Maximize2, ArrowCounterClockwiseIcon as RotateCcw, XIcon as X, MagnifyingGlassPlusIcon as ZoomIn, MagnifyingGlassMinusIcon as ZoomOut, } from '@phosphor-icons/react';
|
|
12
|
+
import { Copy } from '../../icons/copy.js';
|
|
13
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
14
|
+
let mermaidInstance = null;
|
|
15
|
+
export const MermaidRenderer = React.memo(({ chart, className, enableFullscreen = true, isStreaming = false }) => {
|
|
16
|
+
const containerRef = useRef(null);
|
|
17
|
+
const [error, setError] = useState(null);
|
|
18
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
19
|
+
const [renderedContent, setRenderedContent] = useState('');
|
|
20
|
+
const [isFullscreenOpen, setIsFullscreenOpen] = useState(false);
|
|
21
|
+
// The source to render: null while a streaming diagram is still changing.
|
|
22
|
+
const source = useSettledValue(chart.trim(), isStreaming, CODE_SETTLE_MS);
|
|
23
|
+
// Canvas state for fullscreen viewer
|
|
24
|
+
const canvasRef = useRef(null);
|
|
25
|
+
const [zoom, setZoom] = useState(1);
|
|
26
|
+
const [rotation, setRotation] = useState(0);
|
|
27
|
+
const [panOffset, setPanOffset] = useState({ x: 0, y: 0 });
|
|
28
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
29
|
+
const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
|
|
30
|
+
const [lastTouchDistance, setLastTouchDistance] = useState(null);
|
|
31
|
+
// Inline-card control: copy the diagram source.
|
|
32
|
+
const [copied, setCopied] = useState(false);
|
|
33
|
+
const handleCopySource = useCallback(async () => {
|
|
34
|
+
try {
|
|
35
|
+
await navigator.clipboard.writeText(chart);
|
|
36
|
+
setCopied(true);
|
|
37
|
+
setTimeout(() => setCopied(false), 2000);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
console.error('Failed to copy diagram source:', err);
|
|
41
|
+
}
|
|
42
|
+
}, [chart]);
|
|
43
|
+
const handleRotate = useCallback(() => setRotation((prev) => prev + 90), []);
|
|
44
|
+
// Canvas event handlers
|
|
45
|
+
const handleMouseDown = useCallback((e) => {
|
|
46
|
+
if (e.button === 0) {
|
|
47
|
+
// Left mouse button
|
|
48
|
+
setIsDragging(true);
|
|
49
|
+
setDragStart({
|
|
50
|
+
x: e.clientX - panOffset.x,
|
|
51
|
+
y: e.clientY - panOffset.y,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, [panOffset]);
|
|
55
|
+
const handleMouseMove = useCallback((e) => {
|
|
56
|
+
if (isDragging) {
|
|
57
|
+
const newOffset = {
|
|
58
|
+
x: e.clientX - dragStart.x,
|
|
59
|
+
y: e.clientY - dragStart.y,
|
|
60
|
+
};
|
|
61
|
+
setPanOffset(newOffset);
|
|
62
|
+
}
|
|
63
|
+
}, [isDragging, dragStart]);
|
|
64
|
+
const handleMouseUp = useCallback(() => {
|
|
65
|
+
setIsDragging(false);
|
|
66
|
+
}, []);
|
|
67
|
+
// Touch event handlers for mobile support
|
|
68
|
+
const getTouchDistance = (touches) => {
|
|
69
|
+
if (touches.length < 2)
|
|
70
|
+
return null;
|
|
71
|
+
const touch1 = touches[0];
|
|
72
|
+
const touch2 = touches[1];
|
|
73
|
+
return Math.sqrt(Math.pow(touch2.clientX - touch1.clientX, 2) + Math.pow(touch2.clientY - touch1.clientY, 2));
|
|
74
|
+
};
|
|
75
|
+
const getTouchCenter = (touches) => {
|
|
76
|
+
if (touches.length === 0)
|
|
77
|
+
return { x: 0, y: 0 };
|
|
78
|
+
if (touches.length === 1)
|
|
79
|
+
return { x: touches[0].clientX, y: touches[0].clientY };
|
|
80
|
+
const touch1 = touches[0];
|
|
81
|
+
const touch2 = touches[1];
|
|
82
|
+
return {
|
|
83
|
+
x: (touch1.clientX + touch2.clientX) / 2,
|
|
84
|
+
y: (touch1.clientY + touch2.clientY) / 2,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const handleTouchStart = useCallback((e) => {
|
|
88
|
+
if (e.touches.length === 1) {
|
|
89
|
+
// Single touch - start panning
|
|
90
|
+
setIsDragging(true);
|
|
91
|
+
setDragStart({
|
|
92
|
+
x: e.touches[0].clientX - panOffset.x,
|
|
93
|
+
y: e.touches[0].clientY - panOffset.y,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else if (e.touches.length === 2) {
|
|
97
|
+
// Two touches - start pinch zoom
|
|
98
|
+
setIsDragging(false);
|
|
99
|
+
setLastTouchDistance(getTouchDistance(e.touches));
|
|
100
|
+
}
|
|
101
|
+
}, [panOffset]);
|
|
102
|
+
const handleTouchMove = useCallback((e) => {
|
|
103
|
+
// Only prevent default if we're actively interacting with the canvas
|
|
104
|
+
if (isDragging || (e.touches.length === 2 && lastTouchDistance)) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
}
|
|
107
|
+
if (e.touches.length === 1 && isDragging) {
|
|
108
|
+
// Single touch - pan
|
|
109
|
+
const newOffset = {
|
|
110
|
+
x: e.touches[0].clientX - dragStart.x,
|
|
111
|
+
y: e.touches[0].clientY - dragStart.y,
|
|
112
|
+
};
|
|
113
|
+
setPanOffset(newOffset);
|
|
114
|
+
}
|
|
115
|
+
else if (e.touches.length === 2 && lastTouchDistance) {
|
|
116
|
+
// Two touches - pinch zoom
|
|
117
|
+
e.preventDefault(); // Always prevent default for pinch zoom
|
|
118
|
+
const currentDistance = getTouchDistance(e.touches);
|
|
119
|
+
if (currentDistance) {
|
|
120
|
+
const zoomFactor = currentDistance / lastTouchDistance;
|
|
121
|
+
// Zoom towards touch center
|
|
122
|
+
if (canvasRef.current) {
|
|
123
|
+
const rect = canvasRef.current.getBoundingClientRect();
|
|
124
|
+
const touchCenter = getTouchCenter(e.touches);
|
|
125
|
+
const centerX = touchCenter.x - rect.left;
|
|
126
|
+
const centerY = touchCenter.y - rect.top;
|
|
127
|
+
const next = zoomAtPoint(zoom, panOffset, { x: centerX, y: centerY }, zoomFactor);
|
|
128
|
+
setZoom(next.zoom);
|
|
129
|
+
setPanOffset(next.panOffset);
|
|
130
|
+
}
|
|
131
|
+
setLastTouchDistance(currentDistance);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}, [isDragging, dragStart, lastTouchDistance, zoom, panOffset]);
|
|
135
|
+
const handleTouchEnd = useCallback(() => {
|
|
136
|
+
setIsDragging(false);
|
|
137
|
+
setLastTouchDistance(null);
|
|
138
|
+
}, []);
|
|
139
|
+
// Wheel event handler - attached manually to avoid passive event issues
|
|
140
|
+
const handleWheelEvent = useCallback((e) => {
|
|
141
|
+
// Only handle zoom if Ctrl/Cmd is held or we're over the canvas
|
|
142
|
+
if (!canvasRef.current?.contains(e.target))
|
|
143
|
+
return;
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
const zoomFactor = e.deltaY > 0 ? 0.9 : 1.1;
|
|
146
|
+
// Zoom towards mouse position
|
|
147
|
+
if (canvasRef.current) {
|
|
148
|
+
const rect = canvasRef.current.getBoundingClientRect();
|
|
149
|
+
const mouseX = e.clientX - rect.left;
|
|
150
|
+
const mouseY = e.clientY - rect.top;
|
|
151
|
+
const next = zoomAtPoint(zoom, panOffset, { x: mouseX, y: mouseY }, zoomFactor);
|
|
152
|
+
setZoom(next.zoom);
|
|
153
|
+
setPanOffset(next.panOffset);
|
|
154
|
+
}
|
|
155
|
+
}, [zoom, panOffset]);
|
|
156
|
+
// Attach wheel event listener manually with passive: false
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const canvasElement = canvasRef.current;
|
|
159
|
+
if (canvasElement && isFullscreenOpen) {
|
|
160
|
+
canvasElement.addEventListener('wheel', handleWheelEvent, {
|
|
161
|
+
passive: false,
|
|
162
|
+
});
|
|
163
|
+
return () => {
|
|
164
|
+
canvasElement.removeEventListener('wheel', handleWheelEvent);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}, [isFullscreenOpen, handleWheelEvent]);
|
|
168
|
+
// Simple zoom controls
|
|
169
|
+
const handleZoomIn = () => setZoom((prev) => Math.min(5, prev * 1.2));
|
|
170
|
+
const handleZoomOut = () => setZoom((prev) => Math.max(0.1, prev * 0.8));
|
|
171
|
+
const handleFullscreenOpen = () => {
|
|
172
|
+
if (enableFullscreen) {
|
|
173
|
+
setIsFullscreenOpen(true);
|
|
174
|
+
// Reset canvas state
|
|
175
|
+
setZoom(0.8); // Start with a reasonable fit
|
|
176
|
+
setRotation(0);
|
|
177
|
+
setPanOffset({ x: 0, y: 0 });
|
|
178
|
+
setIsDragging(false);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (source === null)
|
|
183
|
+
return;
|
|
184
|
+
let mounted = true;
|
|
185
|
+
const renderChart = async () => {
|
|
186
|
+
if (!source) {
|
|
187
|
+
if (mounted)
|
|
188
|
+
setIsLoading(false);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const cachedResult = readCachedMermaidSvg(source);
|
|
192
|
+
if (cachedResult) {
|
|
193
|
+
if (mounted) {
|
|
194
|
+
setRenderedContent(cachedResult);
|
|
195
|
+
setError(null);
|
|
196
|
+
setIsLoading(false);
|
|
197
|
+
}
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
if (mounted) {
|
|
202
|
+
setIsLoading(true);
|
|
203
|
+
setError(null);
|
|
204
|
+
}
|
|
205
|
+
// Check for basic Mermaid syntax
|
|
206
|
+
const firstLine = source.split('\n')[0].toLowerCase().trim();
|
|
207
|
+
const validStarters = [
|
|
208
|
+
'graph',
|
|
209
|
+
'flowchart',
|
|
210
|
+
'sequencediagram',
|
|
211
|
+
'sequence',
|
|
212
|
+
'classdiagram',
|
|
213
|
+
'class',
|
|
214
|
+
'statediagram',
|
|
215
|
+
'state',
|
|
216
|
+
'erdiagram',
|
|
217
|
+
'journey',
|
|
218
|
+
'gantt',
|
|
219
|
+
'pie',
|
|
220
|
+
'gitgraph',
|
|
221
|
+
'mindmap',
|
|
222
|
+
'timeline',
|
|
223
|
+
'sankey',
|
|
224
|
+
'block',
|
|
225
|
+
'quadrant',
|
|
226
|
+
'requirement',
|
|
227
|
+
'c4context',
|
|
228
|
+
'c4container',
|
|
229
|
+
'c4component',
|
|
230
|
+
'c4dynamic',
|
|
231
|
+
];
|
|
232
|
+
const hasValidStarter = validStarters.some((starter) => firstLine.startsWith(starter) || firstLine.includes(starter));
|
|
233
|
+
if (!hasValidStarter) {
|
|
234
|
+
throw new Error(`Invalid diagram type. Chart must start with a valid Mermaid diagram type (e.g., graph, flowchart, sequenceDiagram, etc.). Found: "${firstLine}"`);
|
|
235
|
+
}
|
|
236
|
+
// Use cached Mermaid instance or initialize new one
|
|
237
|
+
if (!mermaidInstance) {
|
|
238
|
+
const mermaid = (await import('mermaid')).default;
|
|
239
|
+
await mermaid.initialize({
|
|
240
|
+
...MERMAID_CONFIG,
|
|
241
|
+
gitGraph: { ...MERMAID_CONFIG.gitGraph },
|
|
242
|
+
});
|
|
243
|
+
mermaidInstance = mermaid;
|
|
244
|
+
}
|
|
245
|
+
const chartId = `mermaid-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
246
|
+
let result;
|
|
247
|
+
try {
|
|
248
|
+
result = await mermaidInstance.render(chartId, source);
|
|
249
|
+
}
|
|
250
|
+
catch (renderError) {
|
|
251
|
+
const errorMessage = renderError instanceof Error ? renderError.message : String(renderError);
|
|
252
|
+
// Remove the temporary nodes this render created, and only those.
|
|
253
|
+
removeMermaidRenderArtifacts(document, chartId);
|
|
254
|
+
if (errorMessage.includes('Parse error') || errorMessage.includes('Syntax error')) {
|
|
255
|
+
throw new Error(`Diagram syntax error: ${errorMessage}`);
|
|
256
|
+
}
|
|
257
|
+
else if (errorMessage.includes('UnknownDiagramError')) {
|
|
258
|
+
throw new Error('unsupported_diagram_type');
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
throw new Error(`Failed to render diagram: ${errorMessage}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
cacheMermaidSvg(source, result.svg);
|
|
265
|
+
if (!mounted)
|
|
266
|
+
return;
|
|
267
|
+
setRenderedContent(result.svg);
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
if (mounted) {
|
|
271
|
+
const errorMessage = err instanceof Error ? err.message : 'Failed to render diagram';
|
|
272
|
+
// Unsupported diagram types render as a plain code block below.
|
|
273
|
+
if (errorMessage.includes('UnknownDiagramError') ||
|
|
274
|
+
errorMessage.includes('No diagram type detected')) {
|
|
275
|
+
setError('unsupported_diagram_type');
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
setError(errorMessage);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
finally {
|
|
283
|
+
if (mounted)
|
|
284
|
+
setIsLoading(false);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
renderChart();
|
|
288
|
+
return () => {
|
|
289
|
+
mounted = false;
|
|
290
|
+
};
|
|
291
|
+
}, [source]);
|
|
292
|
+
// A diagram that already drew keeps its last SVG while a newer source
|
|
293
|
+
// renders, and a streaming diagram shows no error for a half-written
|
|
294
|
+
// source: the placeholder stands until there is something to draw.
|
|
295
|
+
const showError = !!error && !isStreaming;
|
|
296
|
+
if ((isLoading || (error && !showError)) && !renderedContent) {
|
|
297
|
+
return (_jsx("div", { className: cn('bg-muted/30 flex items-center justify-center rounded-lg border border-dashed p-8', className), children: _jsxs("div", { className: "text-center", children: [_jsx("div", { className: "text-muted-foreground mb-2 text-sm", children: "Rendering Mermaid diagram..." }), _jsx(KortixLoader, { size: "medium" })] }) }));
|
|
298
|
+
}
|
|
299
|
+
if (showError) {
|
|
300
|
+
// For unsupported diagram types, render as a simple code block
|
|
301
|
+
if (error === 'unsupported_diagram_type') {
|
|
302
|
+
return (_jsxs("div", { className: cn('my-2', className), children: [_jsx("div", { className: "text-muted-foreground mb-1 text-xs", children: "Unsupported diagram type (not available in Mermaid 11.x)" }), _jsx("pre", { className: "bg-muted/50 overflow-x-auto rounded-lg border p-3 font-mono text-xs whitespace-pre-wrap", children: chart })] }));
|
|
303
|
+
}
|
|
304
|
+
// For other errors, show the full error UI
|
|
305
|
+
return (_jsxs("div", { className: cn('bg-muted/30 border-border/40 rounded-lg border p-4', className), children: [_jsx("div", { className: "text-muted-foreground mb-2 text-sm font-medium", children: "Failed to render Mermaid diagram" }), _jsx("div", { className: "text-muted-foreground bg-muted/50 rounded p-2 font-mono text-xs", children: error }), _jsxs("details", { className: "mt-2", children: [_jsx("summary", { className: "text-muted-foreground hover:text-foreground cursor-pointer text-xs", children: "Show diagram source" }), _jsx("pre", { className: "bg-muted/50 mt-2 overflow-x-auto rounded p-2 text-xs whitespace-pre-wrap", children: chart })] })] }));
|
|
306
|
+
}
|
|
307
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { dangerouslySetInnerHTML: {
|
|
308
|
+
__html: `
|
|
309
|
+
.mermaid-container svg {
|
|
310
|
+
max-width: 100% !important;
|
|
311
|
+
height: auto !important;
|
|
312
|
+
display: block !important;
|
|
313
|
+
margin: 0 auto !important;
|
|
314
|
+
}
|
|
315
|
+
.mermaid-container .node {
|
|
316
|
+
fill: hsl(var(--card)) !important;
|
|
317
|
+
stroke: hsl(var(--foreground)) !important;
|
|
318
|
+
}
|
|
319
|
+
.mermaid-container .cluster {
|
|
320
|
+
fill: hsl(var(--muted)) !important;
|
|
321
|
+
stroke: hsl(var(--foreground)) !important;
|
|
322
|
+
}
|
|
323
|
+
.mermaid-container text {
|
|
324
|
+
fill: hsl(var(--foreground)) !important;
|
|
325
|
+
font-family: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif !important;
|
|
326
|
+
}
|
|
327
|
+
.mermaid-container .edgePath {
|
|
328
|
+
stroke: hsl(var(--foreground)) !important;
|
|
329
|
+
}
|
|
330
|
+
.mermaid-container .marker {
|
|
331
|
+
fill: hsl(var(--foreground)) !important;
|
|
332
|
+
}
|
|
333
|
+
`,
|
|
334
|
+
} }), _jsxs("div", { className: cn('mermaid-container group bg-background relative my-4 w-full overflow-auto rounded-lg border', className), style: { minHeight: '200px' }, children: [_jsx("div", { className: "absolute top-2 right-2 z-10 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100", children: _jsxs(ButtonGroup, { children: [enableFullscreen && (_jsx(Hint, { label: "Fullscreen", side: "top", children: _jsx(Button, { variant: "outline", size: "icon-sm", onClick: handleFullscreenOpen, className: "bg-background/90 backdrop-blur-sm", "aria-label": "Open diagram fullscreen", children: _jsx(Maximize2, { className: "size-3.5" }) }) })), _jsx(Hint, { label: copied ? 'Copied' : 'Copy source', side: "top", children: _jsx(Button, { variant: "outline", size: "icon-sm", onClick: handleCopySource, className: "bg-background/90 backdrop-blur-sm", "aria-label": "Copy diagram source", children: copied ? (_jsx(Check, { className: "text-kortix-green size-3.5" })) : (_jsx(Copy, { className: "size-3.5" })) }) })] }) }), _jsx("div", { ref: containerRef, dangerouslySetInnerHTML: { __html: renderedContent } })] }), _jsx(Modal, { open: isFullscreenOpen, onOpenChange: setIsFullscreenOpen, children: _jsxs(ModalContent, { variant: "base", showCloseButton: false, className: "flex h-[90vh] flex-col space-y-0 overflow-hidden lg:h-[90vh] lg:max-w-7xl", closeButtonChildren: _jsxs(ButtonGroup, { children: [_jsx(Hint, { label: "Zoom in", side: "bottom", children: _jsx(Button, { variant: "outline", size: "icon", onClick: handleZoomIn, "aria-label": "Zoom in", children: _jsx(ZoomIn, { className: "size-4" }) }) }), _jsx(Hint, { label: "Zoom out", side: "bottom", children: _jsx(Button, { variant: "outline", size: "icon", onClick: handleZoomOut, "aria-label": "Zoom out", children: _jsx(ZoomOut, { className: "size-4" }) }) }), _jsx(Hint, { label: "Rotate", side: "bottom", children: _jsx(Button, { variant: "outline", size: "icon", onClick: handleRotate, "aria-label": "Rotate diagram", children: _jsx(RotateCcw, { className: "size-4" }) }) }), _jsx(ModalClose, { asChild: true, children: _jsx(Button, { variant: "outline", size: "icon", "aria-label": "Close", children: _jsx(X, { className: "size-4" }) }) })] }), children: [_jsx(ModalTitle, { className: "sr-only", children: "Diagram" }), _jsx(ModalBody, { className: "relative min-h-0 flex-1 space-y-0 p-0", children: _jsx("div", { ref: canvasRef, className: "bg-muted/10 absolute inset-0 touch-none overflow-hidden select-none", onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, style: { cursor: isDragging ? 'grabbing' : 'grab' }, children: renderedContent ? (_jsx("div", { className: "mermaid-container absolute inset-0 flex items-center justify-center", style: {
|
|
335
|
+
transform: `translate(${panOffset.x}px, ${panOffset.y}px) scale(${zoom}) rotate(${rotation}deg)`,
|
|
336
|
+
transformOrigin: 'center center',
|
|
337
|
+
transition: isDragging ? 'none' : 'transform 0.15s ease-out',
|
|
338
|
+
}, dangerouslySetInnerHTML: { __html: renderedContent } })) : (_jsx("div", { className: "flex h-full w-full items-center justify-center", children: _jsx(KortixLoader, { size: "medium" }) })) }) })] }) })] }));
|
|
339
|
+
});
|
|
340
|
+
MermaidRenderer.displayName = 'MermaidRenderer';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Message: one conversation row. `align="end"` for the local user, `"start"`
|
|
4
|
+
* for the agent. Compose with `Bubble` for the surface and `MessageAvatar` for
|
|
5
|
+
* the avatar slot.
|
|
6
|
+
*/
|
|
7
|
+
declare function Message({ className, align, ...props }: React.ComponentProps<'div'> & {
|
|
8
|
+
align?: 'start' | 'end';
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function MessageGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
11
|
+
declare function MessageAvatar({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
|
+
declare function MessageContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
13
|
+
declare function MessageHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
14
|
+
declare function MessageFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
15
|
+
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Message: one conversation row. `align="end"` for the local user, `"start"`
|
|
5
|
+
* for the agent. Compose with `Bubble` for the surface and `MessageAvatar` for
|
|
6
|
+
* the avatar slot.
|
|
7
|
+
*/
|
|
8
|
+
function Message({ className, align = 'start', ...props }) {
|
|
9
|
+
return (_jsx("div", { "data-slot": "message", "data-align": align, className: cn('flex w-full items-end gap-2.5', align === 'end' ? 'flex-row-reverse' : 'flex-row', className), ...props }));
|
|
10
|
+
}
|
|
11
|
+
function MessageGroup({ className, ...props }) {
|
|
12
|
+
return _jsx("div", { "data-slot": "message-group", className: cn('flex flex-col gap-1.5', className), ...props });
|
|
13
|
+
}
|
|
14
|
+
function MessageAvatar({ className, ...props }) {
|
|
15
|
+
return _jsx("div", { "data-slot": "message-avatar", className: cn('shrink-0 self-end', className), ...props });
|
|
16
|
+
}
|
|
17
|
+
function MessageContent({ className, ...props }) {
|
|
18
|
+
return (_jsx("div", { "data-slot": "message-content", className: cn('flex min-w-0 flex-col gap-1', className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function MessageHeader({ className, ...props }) {
|
|
21
|
+
return (_jsx("div", { "data-slot": "message-header", className: cn('text-muted-foreground flex items-center gap-2 text-xs', className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
function MessageFooter({ className, ...props }) {
|
|
24
|
+
return (_jsx("div", { "data-slot": "message-footer", className: cn('text-muted-foreground flex items-center gap-2 text-xs', className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
export { Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* ```tsx
|
|
4
|
+
* import {
|
|
5
|
+
* Modal,
|
|
6
|
+
* ModalBody,
|
|
7
|
+
* ModalContent,
|
|
8
|
+
* ModalDescription,
|
|
9
|
+
* ModalFooter,
|
|
10
|
+
* ModalHeader,
|
|
11
|
+
* ModalTitle,
|
|
12
|
+
* ModalTrigger,
|
|
13
|
+
* } from './modal.js';
|
|
14
|
+
* import { Button } from './button.js';
|
|
15
|
+
*
|
|
16
|
+
* <Modal>
|
|
17
|
+
* <ModalTrigger asChild>
|
|
18
|
+
* <Button>Open</Button>
|
|
19
|
+
* </ModalTrigger>
|
|
20
|
+
* <ModalContent className="lg:max-w-md">
|
|
21
|
+
* <ModalHeader>
|
|
22
|
+
* <ModalTitle>Title</ModalTitle>
|
|
23
|
+
* <ModalDescription>Description</ModalDescription>
|
|
24
|
+
* </ModalHeader>
|
|
25
|
+
* <ModalBody>{children}</ModalBody>
|
|
26
|
+
* <ModalFooter>
|
|
27
|
+
* <Button variant="outline-ghost">Cancel</Button>
|
|
28
|
+
* <Button>Confirm</Button>
|
|
29
|
+
* </ModalFooter>
|
|
30
|
+
* </ModalContent>
|
|
31
|
+
* </Modal>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Controlled:
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Modal open={open} onOpenChange={setOpen}>
|
|
37
|
+
* <ModalContent>...</ModalContent>
|
|
38
|
+
* </Modal>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
42
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
43
|
+
import * as React from 'react';
|
|
44
|
+
import { type TriggerVariantProps } from './trigger-variants.js';
|
|
45
|
+
declare const Modal: ({ open, defaultOpen, onOpenChange, ...props }: DialogPrimitive.DialogProps) => React.JSX.Element;
|
|
46
|
+
declare const ModalTrigger: ({ className, variant, size, asChild, ...props }: Omit<React.ComponentProps<typeof DialogPrimitive.Trigger>, "size"> & TriggerVariantProps) => React.JSX.Element;
|
|
47
|
+
declare const ModalClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
48
|
+
declare const ModalPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
49
|
+
declare const overlayAnimationClasses: {
|
|
50
|
+
readonly default: "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200";
|
|
51
|
+
readonly none: "";
|
|
52
|
+
};
|
|
53
|
+
declare const ModalOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
54
|
+
animation?: keyof typeof overlayAnimationClasses;
|
|
55
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
declare const ModalVariants: (props?: ({
|
|
57
|
+
variant?: "default" | "transparent" | "base" | null | undefined;
|
|
58
|
+
side?: "left" | "right" | "bottom" | "top" | "fullscreen" | null | undefined;
|
|
59
|
+
animation?: "none" | "default" | null | undefined;
|
|
60
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
61
|
+
interface ModalContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof ModalVariants> {
|
|
62
|
+
closeClassName?: string;
|
|
63
|
+
closeLabel?: string;
|
|
64
|
+
modalClassName?: string;
|
|
65
|
+
showCloseButton?: boolean;
|
|
66
|
+
closeButtonChildren?: React.ReactNode;
|
|
67
|
+
closeOnOutsideClick?: boolean;
|
|
68
|
+
overlayClassName?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Should an "outside" interaction actually dismiss the modal?
|
|
72
|
+
*
|
|
73
|
+
* Two cases both look like backdrop clicks to Radix and must NOT dismiss:
|
|
74
|
+
*
|
|
75
|
+
* 1. The click lands on a portaled Select / DropdownMenu / tooltip panel.
|
|
76
|
+
* Those portal to `document.body`, outside the modal's DOM subtree, so
|
|
77
|
+
* containment says "outside". `isFloatingLayerTarget` catches that.
|
|
78
|
+
*
|
|
79
|
+
* 2. A *modal* DropdownMenu is open and the click lands anywhere else —
|
|
80
|
+
* including visually on the modal body, or on the dark overlay. While the
|
|
81
|
+
* menu is open Radix sets `pointer-events: none` on everything under it, so
|
|
82
|
+
* the event target is `body` / the overlay, not the menu. Checking the
|
|
83
|
+
* target alone fails; Escape already uses `hasOpenFloatingLayer()` for the
|
|
84
|
+
* same reason. The gesture owns the floating layer: dismiss that first, and
|
|
85
|
+
* require a second click to close the modal.
|
|
86
|
+
*/
|
|
87
|
+
export declare function modalDismissesOnOutsideInteraction(target: EventTarget | null, closeOnOutsideClick: boolean): boolean;
|
|
88
|
+
declare const ModalContentInner: React.ForwardRefExoticComponent<ModalContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
declare const ModalContent: React.ForwardRefExoticComponent<ModalContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
|
+
declare const ModalHeader: {
|
|
91
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
92
|
+
displayName: string;
|
|
93
|
+
};
|
|
94
|
+
declare const ModalFooter: {
|
|
95
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
96
|
+
displayName: string;
|
|
97
|
+
};
|
|
98
|
+
declare const ModalTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
99
|
+
declare const ModalDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
100
|
+
declare const ModalBody: {
|
|
101
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
102
|
+
displayName: string;
|
|
103
|
+
};
|
|
104
|
+
export { Modal, ModalBody, ModalClose, ModalContent, ModalContentInner, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, };
|