@atmos.build/ui 0.1.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/README.md +45 -0
- package/dist/components/alert-dialog.d.ts +14 -0
- package/dist/components/alert-dialog.js +40 -0
- package/dist/components/at-search.d.ts +35 -0
- package/dist/components/at-search.js +57 -0
- package/dist/components/attachment-thumbnail-stack.d.ts +13 -0
- package/dist/components/attachment-thumbnail-stack.js +23 -0
- package/dist/components/audio-preview.d.ts +33 -0
- package/dist/components/audio-preview.js +176 -0
- package/dist/components/avatar-uploader.d.ts +29 -0
- package/dist/components/avatar-uploader.js +67 -0
- package/dist/components/avatar.d.ts +12 -0
- package/dist/components/avatar.js +38 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.js +25 -0
- package/dist/components/button-group.d.ts +12 -0
- package/dist/components/button-group.js +29 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +42 -0
- package/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.js +154 -0
- package/dist/components/channel-list.d.ts +33 -0
- package/dist/components/channel-list.js +40 -0
- package/dist/components/charts/area-chart.d.ts +2 -0
- package/dist/components/charts/area-chart.js +5 -0
- package/dist/components/charts/bar-chart.d.ts +2 -0
- package/dist/components/charts/bar-chart.js +58 -0
- package/dist/components/charts/colors.d.ts +2 -0
- package/dist/components/charts/colors.js +42 -0
- package/dist/components/charts/hover.d.ts +20 -0
- package/dist/components/charts/hover.js +31 -0
- package/dist/components/charts/index.d.ts +10 -0
- package/dist/components/charts/index.js +9 -0
- package/dist/components/charts/layout.d.ts +35 -0
- package/dist/components/charts/layout.js +101 -0
- package/dist/components/charts/legend.d.ts +6 -0
- package/dist/components/charts/legend.js +7 -0
- package/dist/components/charts/line-area-chart.d.ts +4 -0
- package/dist/components/charts/line-area-chart.js +86 -0
- package/dist/components/charts/line-chart.d.ts +2 -0
- package/dist/components/charts/line-chart.js +5 -0
- package/dist/components/charts/pie-chart.d.ts +2 -0
- package/dist/components/charts/pie-chart.js +22 -0
- package/dist/components/charts/radar-chart.d.ts +2 -0
- package/dist/components/charts/radar-chart.js +29 -0
- package/dist/components/charts/radial-chart.d.ts +2 -0
- package/dist/components/charts/radial-chart.js +19 -0
- package/dist/components/charts/scatter-chart.d.ts +2 -0
- package/dist/components/charts/scatter-chart.js +16 -0
- package/dist/components/charts/story-data.d.ts +24 -0
- package/dist/components/charts/story-data.js +48 -0
- package/dist/components/charts/types.d.ts +43 -0
- package/dist/components/charts/types.js +1 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +10 -0
- package/dist/components/chip.d.ts +25 -0
- package/dist/components/chip.js +36 -0
- package/dist/components/code-editor-theme.d.ts +19 -0
- package/dist/components/code-editor-theme.js +100 -0
- package/dist/components/collapsible-section-header.d.ts +82 -0
- package/dist/components/collapsible-section-header.js +82 -0
- package/dist/components/collection-view/collection-view-group-settings.d.ts +73 -0
- package/dist/components/collection-view/collection-view-group-settings.js +55 -0
- package/dist/components/collection-view/collection-view-settings.d.ts +115 -0
- package/dist/components/collection-view/collection-view-settings.js +146 -0
- package/dist/components/collection-view/collection-view.d.ts +87 -0
- package/dist/components/collection-view/collection-view.js +95 -0
- package/dist/components/collection-view/index.d.ts +6 -0
- package/dist/components/collection-view/index.js +6 -0
- package/dist/components/collection-view/use-collection-detail-navigation.d.ts +11 -0
- package/dist/components/collection-view/use-collection-detail-navigation.js +12 -0
- package/dist/components/collection-view/use-collection-escape.d.ts +9 -0
- package/dist/components/collection-view/use-collection-escape.js +20 -0
- package/dist/components/collection-view/use-collection-selection.d.ts +42 -0
- package/dist/components/collection-view/use-collection-selection.js +203 -0
- package/dist/components/color-picker.d.ts +18 -0
- package/dist/components/color-picker.js +77 -0
- package/dist/components/color-swatch-list.d.ts +16 -0
- package/dist/components/color-swatch-list.js +60 -0
- package/dist/components/combobox/combobox.d.ts +4 -0
- package/dist/components/combobox/combobox.js +70 -0
- package/dist/components/combobox/compound.d.ts +68 -0
- package/dist/components/combobox/compound.js +151 -0
- package/dist/components/combobox/context.d.ts +34 -0
- package/dist/components/combobox/context.js +123 -0
- package/dist/components/combobox/create-step.d.ts +12 -0
- package/dist/components/combobox/create-step.js +8 -0
- package/dist/components/combobox/index.d.ts +10 -0
- package/dist/components/combobox/index.js +5 -0
- package/dist/components/combobox/inline-create-form.d.ts +24 -0
- package/dist/components/combobox/inline-create-form.js +43 -0
- package/dist/components/combobox/types.d.ts +57 -0
- package/dist/components/combobox/types.js +10 -0
- package/dist/components/command.d.ts +35 -0
- package/dist/components/command.js +76 -0
- package/dist/components/comment-pin.d.ts +13 -0
- package/dist/components/comment-pin.js +33 -0
- package/dist/components/confidence-meter.d.ts +11 -0
- package/dist/components/confidence-meter.js +24 -0
- package/dist/components/context-menu.d.ts +31 -0
- package/dist/components/context-menu.js +54 -0
- package/dist/components/copy-button.d.ts +12 -0
- package/dist/components/copy-button.js +32 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +86 -0
- package/dist/components/date-tile.d.ts +11 -0
- package/dist/components/date-tile.js +16 -0
- package/dist/components/date-time-picker.d.ts +25 -0
- package/dist/components/date-time-picker.js +153 -0
- package/dist/components/detail-breadcrumb-utils.d.ts +2 -0
- package/dist/components/detail-breadcrumb-utils.js +18 -0
- package/dist/components/detail-nav-bar.d.ts +28 -0
- package/dist/components/detail-nav-bar.js +28 -0
- package/dist/components/detail-top-bar.d.ts +49 -0
- package/dist/components/detail-top-bar.js +41 -0
- package/dist/components/dialog.d.ts +22 -0
- package/dist/components/dialog.js +51 -0
- package/dist/components/dropdown-menu.d.ts +29 -0
- package/dist/components/dropdown-menu.js +52 -0
- package/dist/components/editable-doc-title.d.ts +17 -0
- package/dist/components/editable-doc-title.js +147 -0
- package/dist/components/empty-state.d.ts +12 -0
- package/dist/components/empty-state.js +6 -0
- package/dist/components/filter-condition-editor.d.ts +18 -0
- package/dist/components/filter-condition-editor.js +102 -0
- package/dist/components/form-dialog.d.ts +30 -0
- package/dist/components/form-dialog.js +52 -0
- package/dist/components/formula-editor.d.ts +18 -0
- package/dist/components/formula-editor.js +154 -0
- package/dist/components/hover-card.d.ts +52 -0
- package/dist/components/hover-card.js +51 -0
- package/dist/components/icon-button.d.ts +15 -0
- package/dist/components/icon-button.js +18 -0
- package/dist/components/inline-alert.d.ts +11 -0
- package/dist/components/inline-alert.js +17 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +7 -0
- package/dist/components/kanban-board.d.ts +27 -0
- package/dist/components/kanban-board.js +145 -0
- package/dist/components/kbd.d.ts +3 -0
- package/dist/components/kbd.js +8 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +9 -0
- package/dist/components/markdown-editor/index.d.ts +4 -0
- package/dist/components/markdown-editor/index.js +2 -0
- package/dist/components/markdown-editor/markdown-editor.d.ts +16 -0
- package/dist/components/markdown-editor/markdown-editor.js +53 -0
- package/dist/components/markdown-editor/serialize.d.ts +12 -0
- package/dist/components/markdown-editor/serialize.js +122 -0
- package/dist/components/markdown-editor/vim.d.ts +8 -0
- package/dist/components/markdown-editor/vim.js +394 -0
- package/dist/components/metric-grid.d.ts +41 -0
- package/dist/components/metric-grid.js +39 -0
- package/dist/components/microphone-priority.d.ts +29 -0
- package/dist/components/microphone-priority.js +15 -0
- package/dist/components/middle-truncate.d.ts +6 -0
- package/dist/components/middle-truncate.js +15 -0
- package/dist/components/multi-combobox.d.ts +48 -0
- package/dist/components/multi-combobox.js +221 -0
- package/dist/components/naut-avatar-engine.d.ts +83 -0
- package/dist/components/naut-avatar-engine.js +803 -0
- package/dist/components/naut-avatar.d.ts +31 -0
- package/dist/components/naut-avatar.js +108 -0
- package/dist/components/navigable-list.d.ts +4 -0
- package/dist/components/navigable-list.js +20 -0
- package/dist/components/note-icon-picker.d.ts +20 -0
- package/dist/components/note-icon-picker.js +84 -0
- package/dist/components/note-icon.d.ts +690 -0
- package/dist/components/note-icon.js +353 -0
- package/dist/components/note-row.d.ts +33 -0
- package/dist/components/note-row.js +29 -0
- package/dist/components/overlapping-dots.d.ts +10 -0
- package/dist/components/overlapping-dots.js +13 -0
- package/dist/components/overview-card.d.ts +12 -0
- package/dist/components/overview-card.js +9 -0
- package/dist/components/panel-header.d.ts +8 -0
- package/dist/components/panel-header.js +6 -0
- package/dist/components/panel-section-states.d.ts +9 -0
- package/dist/components/panel-section-states.js +10 -0
- package/dist/components/person-avatar.d.ts +10 -0
- package/dist/components/person-avatar.js +23 -0
- package/dist/components/photo-avatar.d.ts +11 -0
- package/dist/components/photo-avatar.js +24 -0
- package/dist/components/picker-field.d.ts +23 -0
- package/dist/components/picker-field.js +24 -0
- package/dist/components/popover-stack.d.ts +26 -0
- package/dist/components/popover-stack.js +89 -0
- package/dist/components/popover.d.ts +12 -0
- package/dist/components/popover.js +31 -0
- package/dist/components/portal-login-barrier.d.ts +12 -0
- package/dist/components/portal-login-barrier.js +41 -0
- package/dist/components/presence-dot.d.ts +8 -0
- package/dist/components/presence-dot.js +15 -0
- package/dist/components/presence-overlay.d.ts +27 -0
- package/dist/components/presence-overlay.js +34 -0
- package/dist/components/property-list.d.ts +64 -0
- package/dist/components/property-list.js +313 -0
- package/dist/components/property-panel.d.ts +54 -0
- package/dist/components/property-panel.js +87 -0
- package/dist/components/property-selector.d.ts +36 -0
- package/dist/components/property-selector.js +141 -0
- package/dist/components/provenance-chip.d.ts +12 -0
- package/dist/components/provenance-chip.js +17 -0
- package/dist/components/qr-code.d.ts +13 -0
- package/dist/components/qr-code.js +42 -0
- package/dist/components/qr-encode.d.ts +2 -0
- package/dist/components/qr-encode.js +469 -0
- package/dist/components/quantity-stepper.d.ts +25 -0
- package/dist/components/quantity-stepper.js +43 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.js +13 -0
- package/dist/components/rename-dialog.d.ts +19 -0
- package/dist/components/rename-dialog.js +35 -0
- package/dist/components/row-surface.d.ts +1 -0
- package/dist/components/row-surface.js +5 -0
- package/dist/components/row-trailing.d.ts +30 -0
- package/dist/components/row-trailing.js +59 -0
- package/dist/components/run-status-badge.d.ts +16 -0
- package/dist/components/run-status-badge.js +43 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/scroll-area.js +12 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.js +39 -0
- package/dist/components/selectable-card.d.ts +33 -0
- package/dist/components/selectable-card.js +66 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +8 -0
- package/dist/components/settings-dialog-shell.d.ts +46 -0
- package/dist/components/settings-dialog-shell.js +48 -0
- package/dist/components/shimmer-text.d.ts +8 -0
- package/dist/components/shimmer-text.js +26 -0
- package/dist/components/side-panel-tokens.d.ts +27 -0
- package/dist/components/side-panel-tokens.js +26 -0
- package/dist/components/side-panel.d.ts +94 -0
- package/dist/components/side-panel.js +106 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +6 -0
- package/dist/components/sortable.d.ts +65 -0
- package/dist/components/sortable.js +110 -0
- package/dist/components/spec-strip.d.ts +18 -0
- package/dist/components/spec-strip.js +15 -0
- package/dist/components/speech-playback.d.ts +25 -0
- package/dist/components/speech-playback.js +35 -0
- package/dist/components/sql-editor.d.ts +13 -0
- package/dist/components/sql-editor.js +228 -0
- package/dist/components/stat-tile.d.ts +7 -0
- package/dist/components/stat-tile.js +6 -0
- package/dist/components/status-badge.d.ts +17 -0
- package/dist/components/status-badge.js +8 -0
- package/dist/components/status-tone.d.ts +9 -0
- package/dist/components/status-tone.js +10 -0
- package/dist/components/sticky-header-fade.d.ts +8 -0
- package/dist/components/sticky-header-fade.js +11 -0
- package/dist/components/swatch-button.d.ts +14 -0
- package/dist/components/swatch-button.js +25 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +9 -0
- package/dist/components/system-load/index.d.ts +6 -0
- package/dist/components/system-load/index.js +6 -0
- package/dist/components/system-load/load-block.d.ts +20 -0
- package/dist/components/system-load/load-block.js +23 -0
- package/dist/components/system-load/load-grid.d.ts +16 -0
- package/dist/components/system-load/load-grid.js +23 -0
- package/dist/components/system-load/load-meter.d.ts +25 -0
- package/dist/components/system-load/load-meter.js +29 -0
- package/dist/components/system-load/load-tone.d.ts +21 -0
- package/dist/components/system-load/load-tone.js +29 -0
- package/dist/components/system-load/meter-row.d.ts +31 -0
- package/dist/components/system-load/meter-row.js +29 -0
- package/dist/components/system-load/resource-meter.d.ts +19 -0
- package/dist/components/system-load/resource-meter.js +15 -0
- package/dist/components/tab-title-bar.d.ts +12 -0
- package/dist/components/tab-title-bar.js +9 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +29 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +97 -0
- package/dist/components/template-chip-input.d.ts +36 -0
- package/dist/components/template-chip-input.js +271 -0
- package/dist/components/template-input.d.ts +24 -0
- package/dist/components/template-input.js +57 -0
- package/dist/components/terminal-spinner.d.ts +11 -0
- package/dist/components/terminal-spinner.js +48 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +7 -0
- package/dist/components/time-column.d.ts +24 -0
- package/dist/components/time-column.js +60 -0
- package/dist/components/timestamped-transcript.d.ts +38 -0
- package/dist/components/timestamped-transcript.js +29 -0
- package/dist/components/timezone-picker.d.ts +22 -0
- package/dist/components/timezone-picker.js +60 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +29 -0
- package/dist/components/transcription-overlay.d.ts +47 -0
- package/dist/components/transcription-overlay.js +30 -0
- package/dist/components/usage-bar.d.ts +17 -0
- package/dist/components/usage-bar.js +26 -0
- package/dist/components/view-query-bar.d.ts +13 -0
- package/dist/components/view-query-bar.js +13 -0
- package/dist/components/view-query-controls.d.ts +159 -0
- package/dist/components/view-query-controls.js +109 -0
- package/dist/components/view-save-menu.d.ts +20 -0
- package/dist/components/view-save-menu.js +13 -0
- package/dist/components/view-sort-editor.d.ts +40 -0
- package/dist/components/view-sort-editor.js +47 -0
- package/dist/components/voice-line.d.ts +37 -0
- package/dist/components/voice-line.js +293 -0
- package/dist/components/weekly-schedule-editor.d.ts +15 -0
- package/dist/components/weekly-schedule-editor.js +28 -0
- package/dist/flow/canvas/canvas-frame.d.ts +160 -0
- package/dist/flow/canvas/canvas-frame.js +521 -0
- package/dist/flow/canvas/collaborator-layer.d.ts +12 -0
- package/dist/flow/canvas/collaborator-layer.js +43 -0
- package/dist/flow/canvas/connector-edge.d.ts +22 -0
- package/dist/flow/canvas/connector-edge.js +61 -0
- package/dist/flow/canvas/editor-context.d.ts +23 -0
- package/dist/flow/canvas/editor-context.js +6 -0
- package/dist/flow/canvas/graph-core.d.ts +60 -0
- package/dist/flow/canvas/graph-core.js +296 -0
- package/dist/flow/canvas/minimap-sticky-overlay.d.ts +4 -0
- package/dist/flow/canvas/minimap-sticky-overlay.js +45 -0
- package/dist/flow/canvas/node-card.d.ts +46 -0
- package/dist/flow/canvas/node-card.js +56 -0
- package/dist/flow/canvas/node-library.d.ts +40 -0
- package/dist/flow/canvas/node-library.js +54 -0
- package/dist/flow/canvas/sticky-notes.d.ts +25 -0
- package/dist/flow/canvas/sticky-notes.js +101 -0
- package/dist/flow/collaborative-graph-presence.d.ts +28 -0
- package/dist/flow/collaborative-graph-presence.js +55 -0
- package/dist/flow/collaborative-graph-sync.d.ts +40 -0
- package/dist/flow/collaborative-graph-sync.js +127 -0
- package/dist/flow/editor/adapter.d.ts +64 -0
- package/dist/flow/editor/adapter.js +1 -0
- package/dist/flow/editor/command-registry.d.ts +10 -0
- package/dist/flow/editor/command-registry.js +35 -0
- package/dist/flow/editor/dag-canvas.d.ts +18 -0
- package/dist/flow/editor/dag-canvas.js +33 -0
- package/dist/flow/editor/flow-editor.d.ts +54 -0
- package/dist/flow/editor/flow-editor.js +199 -0
- package/dist/flow/editor/issues-popover.d.ts +11 -0
- package/dist/flow/editor/issues-popover.js +70 -0
- package/dist/flow/editor/library-rail.d.ts +19 -0
- package/dist/flow/editor/library-rail.js +25 -0
- package/dist/flow/editor/make-controller.d.ts +18 -0
- package/dist/flow/editor/make-controller.js +44 -0
- package/dist/flow/editor/node-chip.d.ts +2 -0
- package/dist/flow/editor/node-chip.js +16 -0
- package/dist/flow/editor/save-publish-bar.d.ts +27 -0
- package/dist/flow/editor/save-publish-bar.js +14 -0
- package/dist/flow/editor/settings-dialog.d.ts +11 -0
- package/dist/flow/editor/settings-dialog.js +11 -0
- package/dist/flow/editor/settings-shell.d.ts +21 -0
- package/dist/flow/editor/settings-shell.js +20 -0
- package/dist/flow/editor/side-rail.d.ts +22 -0
- package/dist/flow/editor/side-rail.js +15 -0
- package/dist/flow/editor/use-dag-editor.d.ts +94 -0
- package/dist/flow/editor/use-dag-editor.js +502 -0
- package/dist/flow/index.d.ts +25 -0
- package/dist/flow/index.js +25 -0
- package/dist/flow/presence-motion.d.ts +10 -0
- package/dist/flow/presence-motion.js +88 -0
- package/dist/flow/styles.css +1 -0
- package/dist/flow/use-collaborative-graph.d.ts +61 -0
- package/dist/flow/use-collaborative-graph.js +396 -0
- package/dist/flow/use-debounced-value.d.ts +1 -0
- package/dist/flow/use-debounced-value.js +10 -0
- package/dist/hooks/use-detail-nav.d.ts +11 -0
- package/dist/hooks/use-detail-nav.js +49 -0
- package/dist/hooks/use-flush-on-hide.d.ts +1 -0
- package/dist/hooks/use-flush-on-hide.js +21 -0
- package/dist/hooks/use-media-query.d.ts +1 -0
- package/dist/hooks/use-media-query.js +20 -0
- package/dist/hooks/use-virtualizer.d.ts +1 -0
- package/dist/hooks/use-virtualizer.js +1 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.js +139 -0
- package/dist/lib/brand-style.d.ts +6 -0
- package/dist/lib/brand-style.js +16 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/cn.js +5 -0
- package/dist/lib/composited-glint.d.ts +7 -0
- package/dist/lib/composited-glint.js +98 -0
- package/dist/lib/date-time-format.d.ts +2 -0
- package/dist/lib/date-time-format.js +21 -0
- package/dist/lib/disclosure-state.d.ts +11 -0
- package/dist/lib/disclosure-state.js +22 -0
- package/dist/lib/label-swatches.d.ts +10 -0
- package/dist/lib/label-swatches.js +24 -0
- package/dist/lib/local-ui-state.d.ts +10 -0
- package/dist/lib/local-ui-state.js +95 -0
- package/dist/lib/parse-loose-datetime.d.ts +1 -0
- package/dist/lib/parse-loose-datetime.js +180 -0
- package/dist/lib/parse-loose-time.d.ts +6 -0
- package/dist/lib/parse-loose-time.js +53 -0
- package/dist/lib/parse-loose.d.ts +1 -0
- package/dist/lib/parse-loose.js +170 -0
- package/dist/lib/react-19-jsx.d.ts +8 -0
- package/dist/lib/react-19-jsx.js +1 -0
- package/dist/lib/view-chrome.d.ts +5 -0
- package/dist/lib/view-chrome.js +5 -0
- package/dist/lib/view-query/config.d.ts +26 -0
- package/dist/lib/view-query/config.js +162 -0
- package/dist/lib/view-query/evaluate.d.ts +11 -0
- package/dist/lib/view-query/evaluate.js +196 -0
- package/dist/lib/view-query/group-order.d.ts +25 -0
- package/dist/lib/view-query/group-order.js +49 -0
- package/dist/lib/view-query/index.d.ts +6 -0
- package/dist/lib/view-query/index.js +6 -0
- package/dist/lib/view-query/model.d.ts +34 -0
- package/dist/lib/view-query/model.js +88 -0
- package/dist/lib/view-query/sort.d.ts +7 -0
- package/dist/lib/view-query/sort.js +30 -0
- package/dist/lib/view-query/types.d.ts +70 -0
- package/dist/lib/view-query/types.js +12 -0
- package/dist/lib/weekly-schedule.d.ts +8 -0
- package/dist/lib/weekly-schedule.js +10 -0
- package/dist/mcp-app/index.d.ts +4 -0
- package/dist/mcp-app/index.js +3 -0
- package/dist/mcp-app/shadcn.css +629 -0
- package/dist/mcp-app/styles.css +72 -0
- package/dist/mcp-app/theme.d.ts +2 -0
- package/dist/mcp-app/theme.js +62 -0
- package/dist/mcp-app/use-atmos-mcp-app.d.ts +109 -0
- package/dist/mcp-app/use-atmos-mcp-app.js +30 -0
- package/dist/mcp-app/vite.d.ts +7 -0
- package/dist/mcp-app/vite.js +30 -0
- package/dist/tokens/index.d.ts +7 -0
- package/dist/tokens/index.js +7 -0
- package/dist/tokens/semantic.css +110 -0
- package/dist/tokens/tokens.css +195 -0
- package/package.json +98 -0
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
+
import ReactFlow, { Background, BackgroundVariant, Controls, MiniMap, Panel, } from 'reactflow';
|
|
5
|
+
import { ClipboardPaste, Copy, Hand, Map as MapIcon, MousePointer2, Redo2, StickyNote, Undo2, Wand2, } from 'lucide-react';
|
|
6
|
+
import { Button } from '../../components/button.js';
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../components/tooltip.js';
|
|
8
|
+
import { cn } from '../../lib/cn.js';
|
|
9
|
+
import { FlowEditorContext } from './editor-context.js';
|
|
10
|
+
import { StickyNotesLayer } from './sticky-notes.js';
|
|
11
|
+
import { MiniMapStickyOverlay } from './minimap-sticky-overlay.js';
|
|
12
|
+
import { FlowCollaboratorLayer } from './collaborator-layer.js';
|
|
13
|
+
const EMPTY_EDGE_HIGHLIGHT = new Set();
|
|
14
|
+
const EMPTY_INVALID_NODES = new Set();
|
|
15
|
+
const EMPTY_STATUS_BY_NODE = {};
|
|
16
|
+
const EMPTY_DURATION_BY_NODE = {};
|
|
17
|
+
const EMPTY_TAKEN_HANDLES_BY_NODE = {};
|
|
18
|
+
export const FLOW_NODE_DND_MIME = 'application/atmos-flow-node';
|
|
19
|
+
const KEYBOARD_PAN_SPEED = 820;
|
|
20
|
+
const KEYBOARD_PAN_EASE = 16;
|
|
21
|
+
const KEYBOARD_PAN_SETTLE_PX = 0.35;
|
|
22
|
+
const KEYBOARD_PAN_KEYS = new Set(['w', 'a', 's', 'd']);
|
|
23
|
+
export function FlowCanvasFrame({ controller, nodeTypes, edgeTypes, labels, titleForKind, renderDropPicker, renderInsertPicker, collaborators = [], onPointer, onNodeDragPreview, highlightedNodeId = null, highlightedEdgeIds, invalidNodeIds, showStickyNotes = false, onAddPickerReady, onCopySelection, onPasteSelection, toolbarExtras, rightPanel, onPaneDrop, testId = 'flow-canvas', collaboratorCursorTestIdPrefix = `${testId}-collaborator-cursor`, className = 'relative h-[360px] min-w-0 shrink-0 xl:h-auto xl:flex-1 xl:shrink', minimapDefaultThreshold = 8, dropPickerWidth = 320, dropPickerHeight = 360, replay = false, statusByNode, durationByNode, takenHandlesByNode, traversedEdgeIds, onReplayNodeClick, replayBanner, }) {
|
|
24
|
+
const { nodes, edges, onNodesChange, onEdgesChange, onConnect, isValidConnection, insertNodeOnEdge, removeNode, duplicateNode, } = controller;
|
|
25
|
+
const [mode, setMode] = useState('select');
|
|
26
|
+
const [hoveredEdgeId, setHoveredEdgeId] = useState(null);
|
|
27
|
+
const [insertEdgeId, setInsertEdgeId] = useState(null);
|
|
28
|
+
const [dropAdd, setDropAdd] = useState(null);
|
|
29
|
+
const [minimapPref, setMinimapPref] = useState(null);
|
|
30
|
+
const connectStartRef = useRef(null);
|
|
31
|
+
const didConnectRef = useRef(false);
|
|
32
|
+
const edgesRef = useRef(edges);
|
|
33
|
+
const controllerRef = useRef(controller);
|
|
34
|
+
const selectedIdsRef = useRef([]);
|
|
35
|
+
const canvasRef = useRef(null);
|
|
36
|
+
const sideRailRef = useRef(null);
|
|
37
|
+
const flowRef = useRef(null);
|
|
38
|
+
const userMovedViewportRef = useRef(false);
|
|
39
|
+
const pointerEventRef = useRef(null);
|
|
40
|
+
const pointerPublishTimerRef = useRef(null);
|
|
41
|
+
const keyboardPanKeysRef = useRef(new Set());
|
|
42
|
+
const keyboardPanFrameRef = useRef(null);
|
|
43
|
+
const keyboardPanTimeRef = useRef(0);
|
|
44
|
+
const keyboardPanTargetRef = useRef(null);
|
|
45
|
+
const keyboardPanRenderedRef = useRef(null);
|
|
46
|
+
const [layoutTick, setLayoutTick] = useState(0);
|
|
47
|
+
const selectedIds = useMemo(() => nodes.filter((n) => n.selected).map((n) => n.id), [nodes]);
|
|
48
|
+
const hasSelection = selectedIds.length > 0;
|
|
49
|
+
const showMinimap = minimapPref ?? nodes.length > minimapDefaultThreshold;
|
|
50
|
+
const remoteSelectedNodeIds = useMemo(() => {
|
|
51
|
+
const ids = new Set();
|
|
52
|
+
for (const collaborator of collaborators) {
|
|
53
|
+
for (const id of collaborator.selectedNodeIds ?? [])
|
|
54
|
+
ids.add(id);
|
|
55
|
+
}
|
|
56
|
+
return ids;
|
|
57
|
+
}, [collaborators]);
|
|
58
|
+
const stickyEnabled = showStickyNotes &&
|
|
59
|
+
Boolean(controller.annotations &&
|
|
60
|
+
controller.updateAnnotation &&
|
|
61
|
+
controller.commitAnnotation &&
|
|
62
|
+
controller.removeAnnotation);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
edgesRef.current = edges;
|
|
65
|
+
selectedIdsRef.current = selectedIds;
|
|
66
|
+
}, [edges, selectedIds]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
controllerRef.current = controller;
|
|
69
|
+
}, [controller]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const el = canvasRef.current;
|
|
72
|
+
if (!el || typeof ResizeObserver === 'undefined')
|
|
73
|
+
return;
|
|
74
|
+
const observer = new ResizeObserver(() => setLayoutTick((tick) => tick + 1));
|
|
75
|
+
observer.observe(el);
|
|
76
|
+
return () => observer.disconnect();
|
|
77
|
+
}, []);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (userMovedViewportRef.current || nodes.length === 0)
|
|
80
|
+
return;
|
|
81
|
+
const frame = requestAnimationFrame(() => {
|
|
82
|
+
flowRef.current?.fitView({ padding: 0.18, maxZoom: 1.1, duration: 0 });
|
|
83
|
+
});
|
|
84
|
+
return () => cancelAnimationFrame(frame);
|
|
85
|
+
}, [layoutTick, nodes]);
|
|
86
|
+
useEffect(() => () => {
|
|
87
|
+
if (pointerPublishTimerRef.current)
|
|
88
|
+
clearTimeout(pointerPublishTimerRef.current);
|
|
89
|
+
if (keyboardPanFrameRef.current != null)
|
|
90
|
+
cancelAnimationFrame(keyboardPanFrameRef.current);
|
|
91
|
+
}, []);
|
|
92
|
+
const focusRequest = controller.focusRequest;
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!focusRequest)
|
|
95
|
+
return;
|
|
96
|
+
let inner = 0;
|
|
97
|
+
const outer = requestAnimationFrame(() => {
|
|
98
|
+
inner = requestAnimationFrame(() => {
|
|
99
|
+
const flow = flowRef.current;
|
|
100
|
+
const rect = canvasRef.current?.getBoundingClientRect();
|
|
101
|
+
if (!flow || !rect)
|
|
102
|
+
return;
|
|
103
|
+
const node = flow.getNode(focusRequest.id);
|
|
104
|
+
if (!node)
|
|
105
|
+
return;
|
|
106
|
+
const width = node.width ?? 200;
|
|
107
|
+
const height = node.height ?? 64;
|
|
108
|
+
const { x, y, zoom } = flow.getViewport();
|
|
109
|
+
const left = node.position.x * zoom + x;
|
|
110
|
+
const top = node.position.y * zoom + y;
|
|
111
|
+
const margin = 24;
|
|
112
|
+
const inView = left >= margin &&
|
|
113
|
+
top >= margin &&
|
|
114
|
+
left + width * zoom <= rect.width - margin &&
|
|
115
|
+
top + height * zoom <= rect.height - margin;
|
|
116
|
+
if (inView)
|
|
117
|
+
return;
|
|
118
|
+
userMovedViewportRef.current = true;
|
|
119
|
+
void flow.setCenter(node.position.x + width / 2, node.position.y + height / 2, {
|
|
120
|
+
zoom,
|
|
121
|
+
duration: 320,
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
return () => {
|
|
126
|
+
cancelAnimationFrame(outer);
|
|
127
|
+
if (inner)
|
|
128
|
+
cancelAnimationFrame(inner);
|
|
129
|
+
};
|
|
130
|
+
}, [focusRequest]);
|
|
131
|
+
const onConnectStart = useCallback((_, params) => {
|
|
132
|
+
connectStartRef.current = params;
|
|
133
|
+
didConnectRef.current = false;
|
|
134
|
+
}, []);
|
|
135
|
+
const handleConnect = useCallback((connection) => {
|
|
136
|
+
didConnectRef.current = true;
|
|
137
|
+
onConnect(connection);
|
|
138
|
+
}, [onConnect]);
|
|
139
|
+
const onConnectEnd = useCallback((event) => {
|
|
140
|
+
const start = connectStartRef.current;
|
|
141
|
+
connectStartRef.current = null;
|
|
142
|
+
if (!start?.nodeId)
|
|
143
|
+
return;
|
|
144
|
+
if (didConnectRef.current)
|
|
145
|
+
return;
|
|
146
|
+
const targetEl = event.target;
|
|
147
|
+
if (targetEl?.closest('.react-flow__node'))
|
|
148
|
+
return;
|
|
149
|
+
if (!targetEl?.classList.contains('react-flow__pane'))
|
|
150
|
+
return;
|
|
151
|
+
const point = 'changedTouches' in event ? event.changedTouches[0] : event;
|
|
152
|
+
const flow = flowRef.current;
|
|
153
|
+
const rect = canvasRef.current?.getBoundingClientRect();
|
|
154
|
+
if (!point || !flow || !rect)
|
|
155
|
+
return;
|
|
156
|
+
const flowPos = flow.screenToFlowPosition({ x: point.clientX, y: point.clientY });
|
|
157
|
+
const screen = {
|
|
158
|
+
x: Math.max(8, Math.min(point.clientX - rect.left, rect.width - dropPickerWidth - 8)),
|
|
159
|
+
y: Math.max(8, Math.min(point.clientY - rect.top, rect.height - dropPickerHeight - 8)),
|
|
160
|
+
};
|
|
161
|
+
setDropAdd(start.handleType === 'target'
|
|
162
|
+
? { flow: flowPos, screen, to: { targetId: start.nodeId } }
|
|
163
|
+
: {
|
|
164
|
+
flow: flowPos,
|
|
165
|
+
screen,
|
|
166
|
+
from: { sourceId: start.nodeId, handleId: start.handleId ?? null },
|
|
167
|
+
});
|
|
168
|
+
}, [dropPickerHeight, dropPickerWidth]);
|
|
169
|
+
const addConnectedNodeAt = controller.addConnectedNodeAt;
|
|
170
|
+
const handleDropPick = useCallback((kind) => {
|
|
171
|
+
if (!dropAdd)
|
|
172
|
+
return;
|
|
173
|
+
addConnectedNodeAt({
|
|
174
|
+
kind,
|
|
175
|
+
title: titleForKind(kind),
|
|
176
|
+
at: { x: dropAdd.flow.x - 100, y: dropAdd.flow.y - 32 },
|
|
177
|
+
...(dropAdd.from ? { from: dropAdd.from } : {}),
|
|
178
|
+
...(dropAdd.to ? { to: dropAdd.to } : {}),
|
|
179
|
+
});
|
|
180
|
+
setDropAdd(null);
|
|
181
|
+
}, [addConnectedNodeAt, dropAdd, titleForKind]);
|
|
182
|
+
const openAddPicker = useCallback(() => {
|
|
183
|
+
const flow = flowRef.current;
|
|
184
|
+
const rect = canvasRef.current?.getBoundingClientRect();
|
|
185
|
+
if (!flow || !rect)
|
|
186
|
+
return;
|
|
187
|
+
const flowPos = flow.screenToFlowPosition({
|
|
188
|
+
x: rect.left + rect.width / 2,
|
|
189
|
+
y: rect.top + rect.height / 2,
|
|
190
|
+
});
|
|
191
|
+
setDropAdd({
|
|
192
|
+
flow: flowPos,
|
|
193
|
+
screen: {
|
|
194
|
+
x: Math.max(8, rect.width / 2 - dropPickerWidth / 2),
|
|
195
|
+
y: Math.max(8, Math.min(rect.height / 2 - 120, rect.height - dropPickerHeight - 8)),
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}, [dropPickerHeight, dropPickerWidth]);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
onAddPickerReady?.(openAddPicker);
|
|
201
|
+
}, [onAddPickerReady, openAddPicker]);
|
|
202
|
+
const deleteEdge = useCallback((edgeId) => controllerRef.current.removeNodesAndEdges([], [edgeId]), []);
|
|
203
|
+
const onPaneDragOver = useCallback((event) => {
|
|
204
|
+
if (!onPaneDrop)
|
|
205
|
+
return;
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
208
|
+
}, [onPaneDrop]);
|
|
209
|
+
const onPaneDropHandler = useCallback((event) => {
|
|
210
|
+
if (!onPaneDrop)
|
|
211
|
+
return;
|
|
212
|
+
const kind = event.dataTransfer.getData(FLOW_NODE_DND_MIME);
|
|
213
|
+
if (!kind)
|
|
214
|
+
return;
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
const flow = flowRef.current;
|
|
217
|
+
if (!flow)
|
|
218
|
+
return;
|
|
219
|
+
const screenToFlow = flow.screenToFlowPosition?.bind(flow) ??
|
|
220
|
+
flow.project?.bind(flow);
|
|
221
|
+
if (!screenToFlow)
|
|
222
|
+
return;
|
|
223
|
+
const flowPos = screenToFlow({ x: event.clientX, y: event.clientY });
|
|
224
|
+
onPaneDrop(kind, { x: flowPos.x - 100, y: flowPos.y - 32 });
|
|
225
|
+
}, [onPaneDrop]);
|
|
226
|
+
const editorContext = useMemo(() => ({
|
|
227
|
+
hoveredEdgeId,
|
|
228
|
+
highlightedNodeId,
|
|
229
|
+
highlightedEdgeIds: highlightedEdgeIds ?? EMPTY_EDGE_HIGHLIGHT,
|
|
230
|
+
invalidNodeIds: invalidNodeIds ?? EMPTY_INVALID_NODES,
|
|
231
|
+
remoteSelectedNodeIds,
|
|
232
|
+
requestInsert: (edgeId) => setInsertEdgeId(edgeId),
|
|
233
|
+
deleteNode: removeNode,
|
|
234
|
+
deleteEdge,
|
|
235
|
+
duplicateNode,
|
|
236
|
+
replay,
|
|
237
|
+
statusByNode: statusByNode ?? EMPTY_STATUS_BY_NODE,
|
|
238
|
+
durationByNode: durationByNode ?? EMPTY_DURATION_BY_NODE,
|
|
239
|
+
takenHandlesByNode: takenHandlesByNode ?? EMPTY_TAKEN_HANDLES_BY_NODE,
|
|
240
|
+
traversedEdgeIds: traversedEdgeIds ?? EMPTY_EDGE_HIGHLIGHT,
|
|
241
|
+
}), [
|
|
242
|
+
highlightedNodeId,
|
|
243
|
+
highlightedEdgeIds,
|
|
244
|
+
invalidNodeIds,
|
|
245
|
+
remoteSelectedNodeIds,
|
|
246
|
+
hoveredEdgeId,
|
|
247
|
+
removeNode,
|
|
248
|
+
deleteEdge,
|
|
249
|
+
duplicateNode,
|
|
250
|
+
replay,
|
|
251
|
+
statusByNode,
|
|
252
|
+
durationByNode,
|
|
253
|
+
takenHandlesByNode,
|
|
254
|
+
traversedEdgeIds,
|
|
255
|
+
]);
|
|
256
|
+
const publishPointer = useCallback((event) => {
|
|
257
|
+
if (!onPointer)
|
|
258
|
+
return;
|
|
259
|
+
pointerEventRef.current = { x: event.clientX, y: event.clientY };
|
|
260
|
+
if (pointerPublishTimerRef.current)
|
|
261
|
+
return;
|
|
262
|
+
pointerPublishTimerRef.current = setTimeout(() => {
|
|
263
|
+
pointerPublishTimerRef.current = null;
|
|
264
|
+
const point = pointerEventRef.current;
|
|
265
|
+
const flow = flowRef.current;
|
|
266
|
+
if (!point || !flow)
|
|
267
|
+
return;
|
|
268
|
+
// Broadcast in flow/world coordinates so every peer projects the cursor
|
|
269
|
+
// back through its own pan/zoom viewport (correct position at any zoom).
|
|
270
|
+
onPointer(flow.screenToFlowPosition({ x: point.x, y: point.y }));
|
|
271
|
+
}, 50);
|
|
272
|
+
}, [onPointer]);
|
|
273
|
+
const emitNodeDrag = useCallback((node) => {
|
|
274
|
+
if (!onNodeDragPreview)
|
|
275
|
+
return;
|
|
276
|
+
onNodeDragPreview({
|
|
277
|
+
nodeId: node.id,
|
|
278
|
+
x: node.position.x,
|
|
279
|
+
y: node.position.y,
|
|
280
|
+
width: node.width ?? 160,
|
|
281
|
+
height: node.height ?? 44,
|
|
282
|
+
});
|
|
283
|
+
}, [onNodeDragPreview]);
|
|
284
|
+
useEffect(() => {
|
|
285
|
+
function stopKeyboardPan() {
|
|
286
|
+
keyboardPanKeysRef.current.clear();
|
|
287
|
+
if (keyboardPanFrameRef.current == null)
|
|
288
|
+
return;
|
|
289
|
+
cancelAnimationFrame(keyboardPanFrameRef.current);
|
|
290
|
+
keyboardPanFrameRef.current = null;
|
|
291
|
+
keyboardPanTargetRef.current = null;
|
|
292
|
+
keyboardPanRenderedRef.current = null;
|
|
293
|
+
}
|
|
294
|
+
function runKeyboardPan(timestamp) {
|
|
295
|
+
const keys = keyboardPanKeysRef.current;
|
|
296
|
+
const flow = flowRef.current;
|
|
297
|
+
if (!flow) {
|
|
298
|
+
keyboardPanFrameRef.current = null;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const viewport = flow.getViewport();
|
|
302
|
+
const elapsedSeconds = Math.min(0.05, Math.max(0, timestamp - keyboardPanTimeRef.current) / 1000);
|
|
303
|
+
const target = keyboardPanTargetRef.current ?? viewport;
|
|
304
|
+
const rendered = keyboardPanRenderedRef.current ?? viewport;
|
|
305
|
+
let xDirection = 0;
|
|
306
|
+
let yDirection = 0;
|
|
307
|
+
if (keys.has('a'))
|
|
308
|
+
xDirection += 1;
|
|
309
|
+
if (keys.has('d'))
|
|
310
|
+
xDirection -= 1;
|
|
311
|
+
if (keys.has('w'))
|
|
312
|
+
yDirection += 1;
|
|
313
|
+
if (keys.has('s'))
|
|
314
|
+
yDirection -= 1;
|
|
315
|
+
if (xDirection !== 0 || yDirection !== 0) {
|
|
316
|
+
const distance = elapsedSeconds * KEYBOARD_PAN_SPEED;
|
|
317
|
+
const scale = xDirection !== 0 && yDirection !== 0 ? Math.SQRT1_2 : 1;
|
|
318
|
+
keyboardPanTargetRef.current = {
|
|
319
|
+
x: target.x + xDirection * distance * scale,
|
|
320
|
+
y: target.y + yDirection * distance * scale,
|
|
321
|
+
zoom: viewport.zoom,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
keyboardPanTargetRef.current = { ...target, zoom: viewport.zoom };
|
|
326
|
+
}
|
|
327
|
+
const nextTarget = keyboardPanTargetRef.current;
|
|
328
|
+
const ease = 1 - Math.exp(-KEYBOARD_PAN_EASE * elapsedSeconds);
|
|
329
|
+
const nextRendered = {
|
|
330
|
+
x: rendered.x + (nextTarget.x - rendered.x) * ease,
|
|
331
|
+
y: rendered.y + (nextTarget.y - rendered.y) * ease,
|
|
332
|
+
zoom: viewport.zoom,
|
|
333
|
+
};
|
|
334
|
+
const delta = Math.hypot(nextTarget.x - nextRendered.x, nextTarget.y - nextRendered.y);
|
|
335
|
+
const active = keys.size > 0 || delta > KEYBOARD_PAN_SETTLE_PX;
|
|
336
|
+
userMovedViewportRef.current = true;
|
|
337
|
+
keyboardPanRenderedRef.current =
|
|
338
|
+
keys.size === 0 && delta <= KEYBOARD_PAN_SETTLE_PX ? nextTarget : nextRendered;
|
|
339
|
+
void flow.setViewport(keyboardPanRenderedRef.current);
|
|
340
|
+
keyboardPanTimeRef.current = timestamp;
|
|
341
|
+
if (active) {
|
|
342
|
+
keyboardPanFrameRef.current = requestAnimationFrame(runKeyboardPan);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
keyboardPanFrameRef.current = null;
|
|
346
|
+
keyboardPanTargetRef.current = null;
|
|
347
|
+
keyboardPanRenderedRef.current = null;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function startKeyboardPan(key) {
|
|
351
|
+
keyboardPanKeysRef.current.add(key);
|
|
352
|
+
if (keyboardPanFrameRef.current != null)
|
|
353
|
+
return;
|
|
354
|
+
const viewport = flowRef.current?.getViewport();
|
|
355
|
+
keyboardPanTargetRef.current = viewport ?? null;
|
|
356
|
+
keyboardPanRenderedRef.current = viewport ?? null;
|
|
357
|
+
keyboardPanTimeRef.current = performance.now();
|
|
358
|
+
keyboardPanFrameRef.current = requestAnimationFrame(runKeyboardPan);
|
|
359
|
+
}
|
|
360
|
+
function onKey(e) {
|
|
361
|
+
if (replay)
|
|
362
|
+
return;
|
|
363
|
+
const target = e.target;
|
|
364
|
+
// The side rail (step config + node library) owns its own keys — no canvas
|
|
365
|
+
// shortcut fires while focus is there; Tab or click back to a node.
|
|
366
|
+
if (target && sideRailRef.current?.contains(target))
|
|
367
|
+
return;
|
|
368
|
+
const editable = Boolean(target?.closest('input, textarea, [contenteditable="true"]'));
|
|
369
|
+
if (editable)
|
|
370
|
+
return;
|
|
371
|
+
if ((e.metaKey || e.ctrlKey) && !e.altKey && e.key.toLowerCase() === 'z') {
|
|
372
|
+
e.preventDefault();
|
|
373
|
+
if (e.shiftKey)
|
|
374
|
+
controllerRef.current.redo();
|
|
375
|
+
else
|
|
376
|
+
controllerRef.current.undo();
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && e.key.toLowerCase() === 'y') {
|
|
380
|
+
e.preventDefault();
|
|
381
|
+
controllerRef.current.redo();
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if ((e.key === 'Backspace' || e.key === 'Delete') && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
385
|
+
// Only delete when the keystroke lands on the canvas — the rail bailed
|
|
386
|
+
// above, and this also blocks a stray Backspace on <body> after a rail
|
|
387
|
+
// field empties and blurs. Clicking a node focuses its .react-flow__node.
|
|
388
|
+
const onCanvas = Boolean(canvasRef.current && target && canvasRef.current.contains(target));
|
|
389
|
+
if (!onCanvas)
|
|
390
|
+
return;
|
|
391
|
+
const selectedEdgeIds = edgesRef.current
|
|
392
|
+
.filter((edge) => edge.selected)
|
|
393
|
+
.map((edge) => edge.id);
|
|
394
|
+
const selectedNodeIds = selectedIdsRef.current;
|
|
395
|
+
if (selectedNodeIds.length > 0 || selectedEdgeIds.length > 0) {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
controllerRef.current.removeNodesAndEdges(selectedNodeIds, selectedEdgeIds);
|
|
398
|
+
}
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (editable)
|
|
402
|
+
return;
|
|
403
|
+
if (!e.metaKey && !e.ctrlKey && !e.altKey && e.key.toLowerCase() === 'h') {
|
|
404
|
+
e.preventDefault();
|
|
405
|
+
setMode('move');
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (!e.metaKey && !e.ctrlKey && !e.altKey && e.key.toLowerCase() === 'v') {
|
|
409
|
+
e.preventDefault();
|
|
410
|
+
setMode('select');
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const panKey = e.key.toLowerCase();
|
|
414
|
+
if (!e.metaKey && !e.ctrlKey && !e.altKey && KEYBOARD_PAN_KEYS.has(panKey)) {
|
|
415
|
+
e.preventDefault();
|
|
416
|
+
startKeyboardPan(panKey);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if ((e.metaKey || e.ctrlKey) &&
|
|
420
|
+
e.key.toLowerCase() === 'c' &&
|
|
421
|
+
selectedIdsRef.current.length > 0) {
|
|
422
|
+
e.preventDefault();
|
|
423
|
+
void onCopySelection?.();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'v') {
|
|
427
|
+
e.preventDefault();
|
|
428
|
+
void onPasteSelection?.();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
document.addEventListener('keydown', onKey);
|
|
432
|
+
function onKeyUp(e) {
|
|
433
|
+
keyboardPanKeysRef.current.delete(e.key.toLowerCase());
|
|
434
|
+
}
|
|
435
|
+
document.addEventListener('keyup', onKeyUp);
|
|
436
|
+
window.addEventListener('blur', stopKeyboardPan);
|
|
437
|
+
return () => {
|
|
438
|
+
document.removeEventListener('keydown', onKey);
|
|
439
|
+
document.removeEventListener('keyup', onKeyUp);
|
|
440
|
+
window.removeEventListener('blur', stopKeyboardPan);
|
|
441
|
+
stopKeyboardPan();
|
|
442
|
+
};
|
|
443
|
+
}, [onCopySelection, onPasteSelection, replay]);
|
|
444
|
+
useEffect(() => {
|
|
445
|
+
function onEscape(e) {
|
|
446
|
+
if (e.key !== 'Escape')
|
|
447
|
+
return;
|
|
448
|
+
const target = e.target;
|
|
449
|
+
const inEditor = !target ||
|
|
450
|
+
target === document.body ||
|
|
451
|
+
canvasRef.current?.contains(target) ||
|
|
452
|
+
Boolean(target.closest?.('[data-flow-editor-region]'));
|
|
453
|
+
if (!inEditor)
|
|
454
|
+
return;
|
|
455
|
+
if (dropAdd) {
|
|
456
|
+
e.preventDefault();
|
|
457
|
+
e.stopPropagation();
|
|
458
|
+
setDropAdd(null);
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (insertEdgeId) {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
e.stopPropagation();
|
|
464
|
+
setInsertEdgeId(null);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (target?.closest?.('input, textarea, [contenteditable="true"]')) {
|
|
468
|
+
e.preventDefault();
|
|
469
|
+
e.stopPropagation();
|
|
470
|
+
document.activeElement?.blur();
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const hasSelected = selectedIdsRef.current.length > 0 || edgesRef.current.some((edge) => edge.selected);
|
|
474
|
+
if (hasSelected) {
|
|
475
|
+
e.preventDefault();
|
|
476
|
+
e.stopPropagation();
|
|
477
|
+
controllerRef.current.deselectAll();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
document.addEventListener('keydown', onEscape, true);
|
|
481
|
+
return () => document.removeEventListener('keydown', onEscape, true);
|
|
482
|
+
}, [dropAdd, insertEdgeId]);
|
|
483
|
+
const stickyController = stickyEnabled && controller.annotations
|
|
484
|
+
? {
|
|
485
|
+
annotations: controller.annotations,
|
|
486
|
+
updateAnnotation: controller.updateAnnotation,
|
|
487
|
+
commitAnnotation: controller.commitAnnotation,
|
|
488
|
+
removeAnnotation: controller.removeAnnotation,
|
|
489
|
+
}
|
|
490
|
+
: null;
|
|
491
|
+
const canvas = (_jsxs("div", { ref: canvasRef, className: className, "data-testid": testId, onMouseMove: publishPointer, onMouseLeave: () => onPointer?.(null), ...(onPaneDrop ? { onDragOver: onPaneDragOver, onDrop: onPaneDropHandler } : {}), children: [_jsxs(ReactFlow, { nodes: nodes, edges: edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: handleConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, isValidConnection: isValidConnection, onInit: (instance) => {
|
|
492
|
+
flowRef.current = instance;
|
|
493
|
+
}, onMoveStart: () => {
|
|
494
|
+
userMovedViewportRef.current = true;
|
|
495
|
+
}, onNodeDragStart: (_, node) => {
|
|
496
|
+
userMovedViewportRef.current = true;
|
|
497
|
+
emitNodeDrag(node);
|
|
498
|
+
}, onNodeDrag: (_, node) => emitNodeDrag(node), onNodeDragStop: () => onNodeDragPreview?.(null), onSelectionDragStart: () => {
|
|
499
|
+
userMovedViewportRef.current = true;
|
|
500
|
+
}, onEdgeMouseEnter: (_, edge) => setHoveredEdgeId(edge.id), onEdgeMouseLeave: () => setHoveredEdgeId(null), ...(replay && onReplayNodeClick
|
|
501
|
+
? {
|
|
502
|
+
onNodeClick: (_, node) => onReplayNodeClick(node.id),
|
|
503
|
+
onPaneClick: () => onReplayNodeClick(null),
|
|
504
|
+
}
|
|
505
|
+
: {}), nodesDraggable: !replay, nodesConnectable: !replay, elementsSelectable: !replay, selectionOnDrag: !replay && mode === 'select', selectNodesOnDrag: false, zoomOnDoubleClick: false, panOnDrag: replay || mode === 'move' ? [0, 1, 2] : [1, 2], zoomOnScroll: true, panOnScroll: true, multiSelectionKeyCode: ['Meta', 'Control', 'Shift'], deleteKeyCode: null, snapToGrid: true, snapGrid: [4, 4], proOptions: { hideAttribution: true }, fitView: true, fitViewOptions: { padding: 0.18, maxZoom: 1.1 }, children: [replay ? (_jsx(Panel, { position: "top-left", className: "!z-20", children: replayBanner })) : (_jsx(Panel, { position: "top-left", className: "!z-20 flex items-center gap-1", children: _jsxs(TooltipProvider, { delayDuration: 300, children: [_jsx(ToolbarButton, { active: mode === 'move', title: labels.modeMove, onClick: () => setMode('move'), children: _jsx(Hand, { className: "size-3.5", strokeWidth: 1.8 }) }), _jsx(ToolbarButton, { active: mode === 'select', title: labels.modeSelect, onClick: () => setMode('select'), children: _jsx(MousePointer2, { className: "size-3.5", strokeWidth: 1.8 }) }), onCopySelection || onPasteSelection ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "bg-border/70 mx-0.5 h-5 w-px" }), _jsx(ToolbarButton, { disabled: !hasSelection, title: labels.copy, onClick: () => void onCopySelection?.(), children: _jsx(Copy, { className: "size-3.5", strokeWidth: 1.8 }) }), _jsx(ToolbarButton, { title: labels.paste, onClick: () => void onPasteSelection?.(), children: _jsx(ClipboardPaste, { className: "size-3.5", strokeWidth: 1.8 }) })] })) : null, _jsx("span", { className: "bg-border/70 mx-0.5 h-5 w-px" }), _jsx(ToolbarButton, { disabled: !controller.canUndo, title: labels.undo, onClick: controller.undo, children: _jsx(Undo2, { className: "size-3.5", strokeWidth: 1.8 }) }), _jsx(ToolbarButton, { disabled: !controller.canRedo, title: labels.redo, onClick: controller.redo, children: _jsx(Redo2, { className: "size-3.5", strokeWidth: 1.8 }) }), _jsx("span", { className: "bg-border/70 mx-0.5 h-5 w-px" }), _jsx(ToolbarButton, { title: labels.tidy, onClick: controller.tidy, children: _jsx(Wand2, { className: "size-3.5", strokeWidth: 1.8 }) }), stickyEnabled && controller.addAnnotation ? (_jsx(ToolbarButton, { title: labels.addNote, onClick: () => controller.addAnnotation?.(), children: _jsx(StickyNote, { className: "size-3.5", strokeWidth: 1.8 }) })) : null, _jsx(ToolbarButton, { active: showMinimap, title: showMinimap ? labels.minimapHide : labels.minimapShow, onClick: () => setMinimapPref(!showMinimap), children: _jsx(MapIcon, { className: "size-3.5", strokeWidth: 1.8 }) }), toolbarExtras ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "bg-border/70 mx-0.5 h-5 w-px" }), toolbarExtras] })) : null] }) })), showMinimap ? (_jsx(MiniMap, { pannable: true, zoomable: true, position: "bottom-left", className: "!bg-background/95 !border-border/60 !z-20 !rounded-md !border !shadow-md", nodeColor: "var(--border)", nodeStrokeColor: "var(--muted-foreground)", maskColor: "color-mix(in srgb, var(--muted) 45%, transparent)" })) : null, showMinimap && stickyController && stickyController.annotations.length > 0 ? (_jsx(Panel, { position: "bottom-left", className: "pointer-events-none !z-20", children: _jsx(MiniMapStickyOverlay, { annotations: stickyController.annotations }) })) : null, stickyController ? (_jsx(StickyNotesLayer, { controller: stickyController, labels: labels.stickyNotes })) : null, _jsx(Background, { variant: BackgroundVariant.Dots, gap: 20, size: 1.4, color: "currentColor", className: "text-muted-foreground/35" }), _jsx(Controls, { showInteractive: false, position: "bottom-right", className: "!border-border/60 !bg-background/95 !z-20 !rounded-md !border !shadow-md" }), _jsx(FlowCollaboratorLayer, { collaborators: collaborators, testIdPrefix: collaboratorCursorTestIdPrefix })] }), insertEdgeId
|
|
506
|
+
? renderInsertPicker(insertEdgeId, {
|
|
507
|
+
onClose: () => setInsertEdgeId(null),
|
|
508
|
+
onPick: (kind) => {
|
|
509
|
+
insertNodeOnEdge(insertEdgeId, kind, titleForKind(kind));
|
|
510
|
+
setInsertEdgeId(null);
|
|
511
|
+
},
|
|
512
|
+
})
|
|
513
|
+
: null, dropAdd ? (_jsxs("div", { className: "absolute inset-0 z-20", role: "dialog", "aria-modal": "true", children: [_jsx("button", { type: "button", "aria-label": labels.closePicker, onClick: () => setDropAdd(null), className: "absolute inset-0 cursor-default" }), renderDropPicker(dropAdd, {
|
|
514
|
+
onClose: () => setDropAdd(null),
|
|
515
|
+
onPick: handleDropPick,
|
|
516
|
+
})] })) : null] }));
|
|
517
|
+
return (_jsx(FlowEditorContext.Provider, { value: editorContext, children: rightPanel != null ? (_jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col xl:flex-row", children: [canvas, _jsx("div", { ref: sideRailRef, className: "contents", children: rightPanel })] })) : (canvas) }));
|
|
518
|
+
}
|
|
519
|
+
export function ToolbarButton({ active, disabled, title, onClick, children, }) {
|
|
520
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "outline", size: "icon", "aria-label": title, "aria-pressed": active, disabled: disabled, onClick: onClick, className: cn('bg-background/95 text-muted-foreground shadow-sm', 'hover:text-foreground hover:border-foreground/25', active && 'text-primary border-primary/45 bg-primary/10'), children: children }) }), _jsx(TooltipContent, { children: title })] }));
|
|
521
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FlowCollaborator } from './canvas-frame.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders peer cursors and live node-drag ghosts. Peers broadcast pointer and
|
|
4
|
+
* drag positions in flow/world coordinates; this layer is a child of ReactFlow,
|
|
5
|
+
* so `useViewport()` gives it the live pan/zoom to project world → screen. That
|
|
6
|
+
* projection is what makes a peer's cursor land on the same node for everyone,
|
|
7
|
+
* regardless of how each viewer has panned or zoomed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function FlowCollaboratorLayer({ collaborators, testIdPrefix, }: {
|
|
10
|
+
collaborators: readonly FlowCollaborator[];
|
|
11
|
+
testIdPrefix: string;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MousePointer2 } from 'lucide-react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useViewport } from 'reactflow';
|
|
6
|
+
import { useSmoothedFlowPoints } from '../presence-motion.js';
|
|
7
|
+
/**
|
|
8
|
+
* Renders peer cursors and live node-drag ghosts. Peers broadcast pointer and
|
|
9
|
+
* drag positions in flow/world coordinates; this layer is a child of ReactFlow,
|
|
10
|
+
* so `useViewport()` gives it the live pan/zoom to project world → screen. That
|
|
11
|
+
* projection is what makes a peer's cursor land on the same node for everyone,
|
|
12
|
+
* regardless of how each viewer has panned or zoomed.
|
|
13
|
+
*/
|
|
14
|
+
export function FlowCollaboratorLayer({ collaborators, testIdPrefix, }) {
|
|
15
|
+
const { x: panX, y: panY, zoom } = useViewport();
|
|
16
|
+
const motionTargets = useMemo(() => collaborators.map((peer) => ({ id: peer.id, point: peer.pointer ?? null })), [collaborators]);
|
|
17
|
+
const smoothedPoints = useSmoothedFlowPoints(motionTargets);
|
|
18
|
+
const projected = useMemo(() => collaborators.map((peer) => {
|
|
19
|
+
const world = smoothedPoints.get(peer.id) ?? peer.pointer ?? null;
|
|
20
|
+
const cursor = world ? { x: world.x * zoom + panX, y: world.y * zoom + panY } : null;
|
|
21
|
+
const drag = peer.drag
|
|
22
|
+
? {
|
|
23
|
+
left: peer.drag.x * zoom + panX,
|
|
24
|
+
top: peer.drag.y * zoom + panY,
|
|
25
|
+
width: peer.drag.width * zoom,
|
|
26
|
+
height: peer.drag.height * zoom,
|
|
27
|
+
}
|
|
28
|
+
: null;
|
|
29
|
+
return { peer, cursor, drag };
|
|
30
|
+
}), [collaborators, smoothedPoints, panX, panY, zoom]);
|
|
31
|
+
if (projected.length === 0)
|
|
32
|
+
return null;
|
|
33
|
+
return (_jsxs("div", { className: "pointer-events-none absolute inset-0 z-20 overflow-hidden", children: [projected.map(({ peer, drag }) => drag ? (_jsx("div", { className: "absolute rounded-lg border-2 border-dashed", style: {
|
|
34
|
+
transform: `translate(${drag.left}px, ${drag.top}px)`,
|
|
35
|
+
width: drag.width,
|
|
36
|
+
height: drag.height,
|
|
37
|
+
borderColor: peer.color,
|
|
38
|
+
backgroundColor: `${peer.color}1f`,
|
|
39
|
+
} }, `${peer.id}-drag`)) : null), projected.map(({ peer, cursor }) => cursor ? (_jsxs("div", { "data-testid": `${testIdPrefix}-${peer.id}`, className: "absolute", style: {
|
|
40
|
+
transform: `translate(${cursor.x}px, ${cursor.y}px)`,
|
|
41
|
+
color: peer.color,
|
|
42
|
+
}, children: [_jsx(MousePointer2, { className: "size-4 drop-shadow-sm", fill: "currentColor" }), _jsx("span", { className: "border-border/70 bg-background/90 text-foreground ml-3 inline-flex max-w-36 truncate rounded-md border px-1.5 py-0.5 text-[11px] shadow-sm", children: peer.name })] }, peer.id)) : null)] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type EdgeProps } from 'reactflow';
|
|
2
|
+
export declare function edgeLabelPosition(args: {
|
|
3
|
+
sourceX: number;
|
|
4
|
+
sourceY: number;
|
|
5
|
+
targetX: number;
|
|
6
|
+
targetY: number;
|
|
7
|
+
midX: number;
|
|
8
|
+
midY: number;
|
|
9
|
+
}): {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export type FlowConnectorEdgeProps = EdgeProps & {
|
|
14
|
+
active?: boolean;
|
|
15
|
+
/** Animate a drifting dash along the edge — the "current flowed here" replay cue. */
|
|
16
|
+
flow?: boolean;
|
|
17
|
+
label?: string | null;
|
|
18
|
+
insertLabel: string;
|
|
19
|
+
deleteLabel: string;
|
|
20
|
+
testIdPrefix?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function FlowConnectorEdge({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, selected, active: activeProp, flow, label, insertLabel, deleteLabel, testIdPrefix, }: FlowConnectorEdgeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { BaseEdge, EdgeLabelRenderer, getSmoothStepPath } from 'reactflow';
|
|
4
|
+
import { Plus, X } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../lib/cn.js';
|
|
6
|
+
import { useFlowEditor } from './editor-context.js';
|
|
7
|
+
export function edgeLabelPosition(args) {
|
|
8
|
+
const { sourceX, sourceY, targetX, targetY, midX, midY } = args;
|
|
9
|
+
const dx = targetX - sourceX;
|
|
10
|
+
if (Math.abs(dx) < 140)
|
|
11
|
+
return { x: midX, y: midY };
|
|
12
|
+
const t = 0.28;
|
|
13
|
+
return {
|
|
14
|
+
x: sourceX + dx * t,
|
|
15
|
+
y: sourceY + (targetY - sourceY) * (t * 0.45),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function FlowConnectorEdge({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, selected, active: activeProp = false, flow = false, label, insertLabel, deleteLabel, testIdPrefix = 'flow-edge', }) {
|
|
19
|
+
const [edgePath, midX, midY] = getSmoothStepPath({
|
|
20
|
+
sourceX,
|
|
21
|
+
sourceY,
|
|
22
|
+
sourcePosition,
|
|
23
|
+
targetX,
|
|
24
|
+
targetY,
|
|
25
|
+
targetPosition,
|
|
26
|
+
borderRadius: 8,
|
|
27
|
+
});
|
|
28
|
+
const editor = useFlowEditor();
|
|
29
|
+
const hovered = editor?.hoveredEdgeId === id;
|
|
30
|
+
const onHighlightedPath = editor?.highlightedEdgeIds.has(id) ?? false;
|
|
31
|
+
const active = activeProp || onHighlightedPath;
|
|
32
|
+
const emphasized = active || hovered || Boolean(selected);
|
|
33
|
+
const labelPos = edgeLabelPosition({ sourceX, sourceY, targetX, targetY, midX, midY });
|
|
34
|
+
const showLabel = Boolean(label) && !hovered;
|
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, path: edgePath, markerEnd: markerEnd, interactionWidth: 28, style: {
|
|
36
|
+
stroke: emphasized ? 'var(--primary)' : 'currentColor',
|
|
37
|
+
strokeWidth: selected ? 2 : emphasized ? 1.6 : 1.25,
|
|
38
|
+
strokeDasharray: active || selected ? undefined : '4 4',
|
|
39
|
+
opacity: emphasized ? 1 : 0.55,
|
|
40
|
+
} }), flow ? (_jsx("path", { d: edgePath, fill: "none", stroke: "var(--primary)", strokeWidth: 1.6, strokeLinecap: "round", strokeDasharray: "3 11", className: "flow-edge-current", style: { pointerEvents: 'none' } })) : null, showLabel && (_jsx(EdgeLabelRenderer, { children: _jsx("div", { style: {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
transform: `translate(-50%, -50%) translate(${labelPos.x}px, ${labelPos.y}px)`,
|
|
43
|
+
pointerEvents: 'none',
|
|
44
|
+
}, className: cn('rounded-sm px-1.5 py-0.5 font-mono text-[10px] leading-none tabular-nums', active || selected
|
|
45
|
+
? 'bg-primary/15 text-primary border-primary/30 border'
|
|
46
|
+
: 'bg-background text-muted-foreground border-border/60 border'), children: label }) })), editor && hovered && !editor.replay && (_jsx(EdgeLabelRenderer, { children: _jsx("button", { type: "button", "data-testid": `${testIdPrefix}-insert-${id}`, "aria-label": insertLabel, title: insertLabel, onClick: (event) => {
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
editor.requestInsert(id);
|
|
49
|
+
}, style: {
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
transform: `translate(-50%, -50%) translate(${midX}px, ${midY - 16}px)`,
|
|
52
|
+
pointerEvents: 'all',
|
|
53
|
+
}, className: "nodrag nopan border-primary/50 bg-background text-primary hover:bg-primary hover:text-primary-foreground inline-flex size-5 items-center justify-center rounded-full border shadow-sm transition-colors", children: _jsx(Plus, { className: "size-3", strokeWidth: 2.2 }) }) })), editor && selected && (_jsx(EdgeLabelRenderer, { children: _jsx("button", { type: "button", "data-testid": `${testIdPrefix}-delete-${id}`, "aria-label": deleteLabel, title: deleteLabel, onClick: (event) => {
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
editor.deleteEdge(id);
|
|
56
|
+
}, style: {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
transform: `translate(-50%, -50%) translate(${midX}px, ${midY + (hovered ? 16 : 0)}px)`,
|
|
59
|
+
pointerEvents: 'all',
|
|
60
|
+
}, className: "nodrag nopan border-destructive/50 bg-background text-destructive hover:bg-destructive inline-flex size-5 items-center justify-center rounded-full border shadow-sm transition-colors hover:text-white", children: _jsx(X, { className: "size-3", strokeWidth: 2.2 }) }) }))] }));
|
|
61
|
+
}
|