@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,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Grid3x3, Mic, Sparkles } from 'lucide-react';
|
|
5
|
+
import { cn } from '../lib/cn.js';
|
|
6
|
+
import { ConfidenceMeter } from './confidence-meter.js';
|
|
7
|
+
const METHOD_ICON = { dtmf: Grid3x3, deterministic: Mic, llm: Sparkles };
|
|
8
|
+
export function ProvenanceChip({ method, label, raw, rawLabel, expandLabel, confidence, confidenceLabel, className, ...props }) {
|
|
9
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
10
|
+
const Icon = METHOD_ICON[method];
|
|
11
|
+
const rawText = raw?.trim() || '';
|
|
12
|
+
const hasRaw = rawText.length > 0;
|
|
13
|
+
const hasConfidence = typeof confidence === 'number' && Number.isFinite(confidence);
|
|
14
|
+
const chipInner = _jsxs(_Fragment, { children: [_jsx(Icon, { className: "size-3 shrink-0", strokeWidth: 1.5, "aria-hidden": true }), _jsx("span", { className: "truncate", children: label })] });
|
|
15
|
+
const chipClass = cn('inline-flex h-5 items-center gap-1 rounded-md border border-border/60 bg-muted/40 px-1.5 text-[10.5px] font-medium text-muted-foreground', hasRaw && 'cursor-pointer outline-none transition-colors hover:border-border hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50');
|
|
16
|
+
return (_jsxs("span", { "data-slot": "provenance-chip", "data-method": method, className: cn('inline-flex flex-col items-start gap-1', className), ...props, children: [_jsxs("span", { className: "inline-flex flex-wrap items-center gap-1.5", children: [hasRaw ? _jsx("button", { type: "button", onClick: () => setExpanded((value) => !value), "aria-expanded": expanded, "aria-label": expandLabel ?? label, title: rawLabel ? `${rawLabel}: ${rawText}` : rawText, className: chipClass, children: chipInner }) : _jsx("span", { className: chipClass, children: chipInner }), hasConfidence ? _jsx(ConfidenceMeter, { value: confidence, label: confidenceLabel ?? label, showValue: true }) : null] }), hasRaw && expanded ? _jsxs("span", { className: "max-w-full rounded-md border border-border/50 bg-background/60 px-2 py-1 text-[11px] leading-relaxed text-muted-foreground", children: [rawLabel ? _jsxs("span", { className: "mr-1 text-muted-foreground/60", children: [rawLabel, ":"] }) : null, _jsx("span", { className: "break-words whitespace-pre-wrap text-foreground/80", children: rawText })] }) : null] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface QrCodeProps {
|
|
2
|
+
value: string;
|
|
3
|
+
size?: number;
|
|
4
|
+
margin?: number;
|
|
5
|
+
level?: 'L' | 'M' | 'Q' | 'H';
|
|
6
|
+
foreground?: string;
|
|
7
|
+
background?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function qrSvgMarkup(value: string, { size, margin, level, foreground, background, title }?: Omit<QrCodeProps, 'value' | 'className'>): string;
|
|
12
|
+
export declare function qrPngDataUrl(value: string, options?: Omit<QrCodeProps, 'value' | 'className'>): Promise<string>;
|
|
13
|
+
export declare function QrCode({ value, size, margin, level, foreground, background, title, className }: QrCodeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
import { encodeQr } from './qr-encode.js';
|
|
6
|
+
export function qrSvgMarkup(value, { size = 200, margin = 4, level = 'M', foreground = '#0a0a0a', background = '#ffffff', title } = {}) {
|
|
7
|
+
const matrix = encodeQr(value, level);
|
|
8
|
+
const dimension = matrix.length + margin * 2;
|
|
9
|
+
const modules = matrix.flatMap((row, y) => row.flatMap((filled, x) => filled ? [`<rect x="${x + margin}" y="${y + margin}" width="1" height="1"/>`] : [])).join('');
|
|
10
|
+
const accessibleTitle = title ? `<title>${escapeXml(title)}</title>` : '';
|
|
11
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${dimension} ${dimension}" shape-rendering="crispEdges" role="img"${title ? ` aria-label="${escapeXml(title)}"` : ''}>${accessibleTitle}<rect width="${dimension}" height="${dimension}" fill="${escapeXml(background)}"/><g fill="${escapeXml(foreground)}">${modules}</g></svg>`;
|
|
12
|
+
}
|
|
13
|
+
export function qrPngDataUrl(value, options = {}) {
|
|
14
|
+
const size = options.size ?? 512;
|
|
15
|
+
const url = URL.createObjectURL(new Blob([qrSvgMarkup(value, { ...options, size })], { type: 'image/svg+xml;charset=utf-8' }));
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const image = new Image();
|
|
18
|
+
image.onload = () => {
|
|
19
|
+
const canvas = document.createElement('canvas');
|
|
20
|
+
canvas.width = size;
|
|
21
|
+
canvas.height = size;
|
|
22
|
+
const context = canvas.getContext('2d');
|
|
23
|
+
if (!context) {
|
|
24
|
+
URL.revokeObjectURL(url);
|
|
25
|
+
reject(new Error('canvas unavailable'));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
context.drawImage(image, 0, 0, size, size);
|
|
29
|
+
URL.revokeObjectURL(url);
|
|
30
|
+
resolve(canvas.toDataURL('image/png'));
|
|
31
|
+
};
|
|
32
|
+
image.onerror = () => { URL.revokeObjectURL(url); reject(new Error('qr render failed')); };
|
|
33
|
+
image.src = url;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function QrCode({ value, size = 200, margin = 4, level = 'M', foreground = '#0a0a0a', background = '#ffffff', title, className }) {
|
|
37
|
+
const markup = useMemo(() => qrSvgMarkup(value, { size, margin, level, foreground, background, title }), [background, foreground, level, margin, size, title, value]);
|
|
38
|
+
return _jsx("span", { className: cn('inline-block leading-none', className), dangerouslySetInnerHTML: { __html: markup } });
|
|
39
|
+
}
|
|
40
|
+
function escapeXml(value) {
|
|
41
|
+
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
42
|
+
}
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
const EXP = new Uint8Array(512);
|
|
2
|
+
const LOG = new Uint8Array(256);
|
|
3
|
+
(() => {
|
|
4
|
+
let x = 1;
|
|
5
|
+
for (let i = 0; i < 255; i++) {
|
|
6
|
+
EXP[i] = x;
|
|
7
|
+
LOG[x] = i;
|
|
8
|
+
x <<= 1;
|
|
9
|
+
if (x & 0x100)
|
|
10
|
+
x ^= 0x11d;
|
|
11
|
+
}
|
|
12
|
+
for (let i = 255; i < 512; i++)
|
|
13
|
+
EXP[i] = EXP[i - 255];
|
|
14
|
+
})();
|
|
15
|
+
function gfMul(a, b) {
|
|
16
|
+
if (a === 0 || b === 0)
|
|
17
|
+
return 0;
|
|
18
|
+
return EXP[LOG[a] + LOG[b]];
|
|
19
|
+
}
|
|
20
|
+
function rsGenerator(degree) {
|
|
21
|
+
let poly = [1];
|
|
22
|
+
for (let i = 0; i < degree; i++) {
|
|
23
|
+
const next = new Array(poly.length + 1).fill(0);
|
|
24
|
+
for (let j = 0; j < poly.length; j++) {
|
|
25
|
+
const pj = poly[j];
|
|
26
|
+
next[j] = next[j] ^ pj;
|
|
27
|
+
next[j + 1] = next[j + 1] ^ gfMul(pj, EXP[i]);
|
|
28
|
+
}
|
|
29
|
+
poly = next;
|
|
30
|
+
}
|
|
31
|
+
return poly;
|
|
32
|
+
}
|
|
33
|
+
function rsEncode(data, degree) {
|
|
34
|
+
const gen = rsGenerator(degree);
|
|
35
|
+
const res = new Array(degree).fill(0);
|
|
36
|
+
for (const d of data) {
|
|
37
|
+
const factor = d ^ res[0];
|
|
38
|
+
res.shift();
|
|
39
|
+
res.push(0);
|
|
40
|
+
for (let i = 0; i < gen.length - 1; i++) {
|
|
41
|
+
res[i] = res[i] ^ gfMul(gen[i + 1], factor);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
// prettier-ignore
|
|
47
|
+
const EC_TABLE = {
|
|
48
|
+
L: [
|
|
49
|
+
[0, 0, 0, 0, 0], [7, 1, 19, 0, 0], [10, 1, 34, 0, 0], [15, 1, 55, 0, 0], [20, 1, 80, 0, 0], [26, 1, 108, 0, 0],
|
|
50
|
+
[18, 2, 68, 0, 0], [20, 2, 78, 0, 0], [24, 2, 97, 0, 0], [30, 2, 116, 0, 0], [18, 2, 68, 2, 69],
|
|
51
|
+
[20, 4, 81, 0, 0], [24, 2, 92, 2, 93], [26, 4, 107, 0, 0], [30, 3, 115, 1, 116], [22, 5, 87, 1, 88],
|
|
52
|
+
[24, 5, 98, 1, 99], [28, 1, 107, 5, 108], [30, 5, 120, 1, 121], [28, 3, 113, 4, 114], [28, 3, 107, 5, 108],
|
|
53
|
+
[28, 4, 116, 4, 117], [28, 2, 111, 7, 112], [30, 4, 121, 5, 122], [30, 6, 117, 4, 118], [26, 8, 106, 4, 107],
|
|
54
|
+
[28, 10, 114, 2, 115], [30, 8, 122, 4, 123], [30, 3, 117, 10, 118], [30, 7, 116, 7, 117], [30, 5, 115, 10, 116],
|
|
55
|
+
[30, 13, 115, 3, 116], [30, 17, 115, 0, 0], [30, 17, 115, 1, 116], [30, 13, 115, 6, 116], [30, 12, 121, 7, 122],
|
|
56
|
+
[30, 6, 121, 14, 122], [30, 17, 122, 4, 123], [30, 4, 122, 18, 123], [30, 20, 117, 4, 118], [30, 19, 118, 6, 119],
|
|
57
|
+
],
|
|
58
|
+
M: [
|
|
59
|
+
[0, 0, 0, 0, 0], [10, 1, 16, 0, 0], [16, 1, 28, 0, 0], [26, 1, 44, 0, 0], [18, 2, 32, 0, 0], [24, 2, 43, 0, 0],
|
|
60
|
+
[16, 4, 27, 0, 0], [18, 4, 31, 0, 0], [22, 2, 38, 2, 39], [22, 3, 36, 2, 37], [26, 4, 43, 1, 44],
|
|
61
|
+
[30, 1, 50, 4, 51], [22, 6, 36, 2, 37], [22, 8, 37, 1, 38], [24, 4, 40, 5, 41], [24, 5, 41, 5, 42],
|
|
62
|
+
[28, 7, 45, 3, 46], [28, 10, 46, 1, 47], [26, 9, 43, 4, 44], [26, 3, 44, 11, 45], [26, 3, 41, 13, 42],
|
|
63
|
+
[26, 17, 42, 0, 0], [28, 17, 46, 0, 0], [28, 4, 47, 14, 48], [28, 6, 45, 14, 46], [28, 8, 47, 13, 48],
|
|
64
|
+
[28, 19, 46, 4, 47], [28, 22, 45, 3, 46], [28, 3, 45, 23, 46], [28, 21, 45, 7, 46], [28, 19, 47, 10, 48],
|
|
65
|
+
[28, 2, 46, 29, 47], [28, 10, 46, 23, 47], [28, 14, 46, 21, 47], [28, 14, 46, 23, 47], [28, 12, 47, 26, 48],
|
|
66
|
+
[28, 6, 47, 34, 48], [28, 29, 46, 14, 47], [28, 13, 46, 32, 47], [28, 40, 47, 7, 48], [28, 18, 47, 31, 48],
|
|
67
|
+
],
|
|
68
|
+
Q: [
|
|
69
|
+
[0, 0, 0, 0, 0], [13, 1, 13, 0, 0], [22, 1, 22, 0, 0], [18, 2, 17, 0, 0], [26, 2, 24, 0, 0], [18, 2, 15, 2, 16],
|
|
70
|
+
[24, 4, 19, 0, 0], [18, 2, 14, 4, 15], [22, 4, 18, 2, 19], [20, 4, 16, 4, 17], [24, 6, 19, 2, 20],
|
|
71
|
+
[28, 4, 22, 4, 23], [26, 4, 20, 6, 21], [24, 8, 20, 4, 21], [20, 11, 16, 5, 17], [30, 5, 24, 7, 25],
|
|
72
|
+
[24, 15, 19, 2, 20], [28, 1, 22, 15, 23], [28, 17, 22, 1, 23], [26, 17, 21, 4, 22], [30, 15, 24, 5, 25],
|
|
73
|
+
[28, 17, 22, 6, 23], [30, 7, 24, 16, 25], [30, 11, 24, 14, 25], [30, 11, 24, 16, 25], [30, 7, 24, 22, 25],
|
|
74
|
+
[28, 28, 22, 6, 23], [30, 8, 23, 26, 24], [30, 4, 24, 31, 25], [30, 1, 23, 37, 24], [30, 15, 24, 25, 25],
|
|
75
|
+
[30, 42, 24, 1, 25], [30, 10, 24, 35, 25], [30, 29, 24, 19, 25], [30, 44, 24, 7, 25], [30, 39, 24, 14, 25],
|
|
76
|
+
[30, 46, 24, 10, 25], [30, 49, 24, 10, 25], [30, 48, 24, 14, 25], [30, 43, 24, 22, 25], [30, 34, 24, 34, 25],
|
|
77
|
+
],
|
|
78
|
+
H: [
|
|
79
|
+
[0, 0, 0, 0, 0], [17, 1, 9, 0, 0], [28, 1, 16, 0, 0], [22, 2, 13, 0, 0], [16, 4, 9, 0, 0], [22, 2, 11, 2, 12],
|
|
80
|
+
[28, 4, 15, 0, 0], [26, 4, 13, 1, 14], [26, 4, 14, 2, 15], [24, 4, 12, 4, 13], [28, 6, 15, 2, 16],
|
|
81
|
+
[24, 3, 12, 8, 13], [28, 7, 14, 4, 15], [22, 12, 11, 4, 12], [24, 11, 12, 5, 13], [24, 11, 12, 7, 13],
|
|
82
|
+
[30, 3, 15, 13, 16], [28, 2, 14, 17, 15], [28, 2, 14, 19, 15], [26, 9, 13, 16, 14], [28, 15, 15, 10, 16],
|
|
83
|
+
[30, 19, 16, 6, 17], [24, 34, 13, 0, 0], [30, 16, 15, 14, 16], [30, 30, 16, 2, 17], [30, 22, 15, 13, 16],
|
|
84
|
+
[30, 33, 16, 4, 17], [30, 12, 15, 28, 16], [30, 11, 15, 31, 16], [30, 19, 15, 26, 16], [30, 23, 15, 25, 16],
|
|
85
|
+
[30, 23, 15, 28, 16], [30, 19, 15, 35, 16], [30, 11, 15, 46, 16], [30, 59, 16, 1, 17], [30, 22, 15, 41, 16],
|
|
86
|
+
[30, 2, 15, 64, 16], [30, 24, 15, 46, 16], [30, 42, 15, 32, 16], [30, 10, 15, 67, 16], [30, 20, 15, 61, 16],
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
function ecRow(level, version) {
|
|
90
|
+
const row = EC_TABLE[level][version];
|
|
91
|
+
if (!row)
|
|
92
|
+
throw new Error('invalid version');
|
|
93
|
+
return row;
|
|
94
|
+
}
|
|
95
|
+
const ALIGN_POS = [
|
|
96
|
+
[], [], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46],
|
|
97
|
+
[6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74],
|
|
98
|
+
[6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98],
|
|
99
|
+
[6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118],
|
|
100
|
+
[6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134],
|
|
101
|
+
[6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150],
|
|
102
|
+
[6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162],
|
|
103
|
+
[6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170],
|
|
104
|
+
];
|
|
105
|
+
const EC_FORMAT_BITS = { L: 0b01, M: 0b00, Q: 0b11, H: 0b10 };
|
|
106
|
+
function dataCodewords(version, level) {
|
|
107
|
+
const [, b1, d1, b2, d2] = ecRow(level, version);
|
|
108
|
+
return b1 * d1 + b2 * d2;
|
|
109
|
+
}
|
|
110
|
+
function chooseVersion(byteLen, level) {
|
|
111
|
+
for (let v = 1; v <= 40; v++) {
|
|
112
|
+
const cci = v < 10 ? 8 : 16;
|
|
113
|
+
const dataBits = 4 + cci + byteLen * 8;
|
|
114
|
+
if (dataCodewords(v, level) * 8 >= dataBits)
|
|
115
|
+
return v;
|
|
116
|
+
}
|
|
117
|
+
throw new Error('data too large for a QR code');
|
|
118
|
+
}
|
|
119
|
+
function buildBitstream(data, version, level) {
|
|
120
|
+
const cci = version < 10 ? 8 : 16;
|
|
121
|
+
const bits = [];
|
|
122
|
+
const push = (val, len) => {
|
|
123
|
+
for (let i = len - 1; i >= 0; i--)
|
|
124
|
+
bits.push((val >> i) & 1);
|
|
125
|
+
};
|
|
126
|
+
push(0b0100, 4);
|
|
127
|
+
push(data.length, cci);
|
|
128
|
+
for (const b of data)
|
|
129
|
+
push(b, 8);
|
|
130
|
+
const capacityBits = dataCodewords(version, level) * 8;
|
|
131
|
+
const term = Math.min(4, capacityBits - bits.length);
|
|
132
|
+
for (let i = 0; i < term; i++)
|
|
133
|
+
bits.push(0);
|
|
134
|
+
while (bits.length % 8 !== 0)
|
|
135
|
+
bits.push(0);
|
|
136
|
+
const pads = [0xec, 0x11];
|
|
137
|
+
let pi = 0;
|
|
138
|
+
while (bits.length < capacityBits) {
|
|
139
|
+
push(pads[pi % 2], 8);
|
|
140
|
+
pi++;
|
|
141
|
+
}
|
|
142
|
+
return bits;
|
|
143
|
+
}
|
|
144
|
+
function buildCodewords(bits, version, level) {
|
|
145
|
+
const [ecPerBlock, b1, d1, b2, d2] = ecRow(level, version);
|
|
146
|
+
const dataBytes = [];
|
|
147
|
+
for (let i = 0; i < bits.length; i += 8) {
|
|
148
|
+
let byte = 0;
|
|
149
|
+
for (let j = 0; j < 8; j++)
|
|
150
|
+
byte = (byte << 1) | bits[i + j];
|
|
151
|
+
dataBytes.push(byte);
|
|
152
|
+
}
|
|
153
|
+
const blocks = [];
|
|
154
|
+
let offset = 0;
|
|
155
|
+
const make = (count, dlen) => {
|
|
156
|
+
for (let i = 0; i < count; i++) {
|
|
157
|
+
const d = dataBytes.slice(offset, offset + dlen);
|
|
158
|
+
offset += dlen;
|
|
159
|
+
blocks.push({ data: d, ec: rsEncode(d, ecPerBlock) });
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
make(b1, d1);
|
|
163
|
+
if (b2)
|
|
164
|
+
make(b2, d2);
|
|
165
|
+
const result = [];
|
|
166
|
+
const maxData = Math.max(d1, d2);
|
|
167
|
+
for (let i = 0; i < maxData; i++) {
|
|
168
|
+
for (const blk of blocks) {
|
|
169
|
+
const v = blk.data[i];
|
|
170
|
+
if (v !== undefined)
|
|
171
|
+
result.push(v);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (let i = 0; i < ecPerBlock; i++) {
|
|
175
|
+
for (const blk of blocks)
|
|
176
|
+
result.push(blk.ec[i]);
|
|
177
|
+
}
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
class Grid {
|
|
181
|
+
size;
|
|
182
|
+
cells;
|
|
183
|
+
constructor(size) {
|
|
184
|
+
this.size = size;
|
|
185
|
+
this.cells = new Int8Array(size * size).fill(-1);
|
|
186
|
+
}
|
|
187
|
+
get(r, c) {
|
|
188
|
+
return this.cells[r * this.size + c];
|
|
189
|
+
}
|
|
190
|
+
set(r, c, v) {
|
|
191
|
+
this.cells[r * this.size + c] = v;
|
|
192
|
+
}
|
|
193
|
+
isSet(r, c) {
|
|
194
|
+
return this.cells[r * this.size + c] !== -1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function placeFinder(m, r, c) {
|
|
198
|
+
for (let dr = -1; dr <= 7; dr++) {
|
|
199
|
+
for (let dc = -1; dc <= 7; dc++) {
|
|
200
|
+
const rr = r + dr;
|
|
201
|
+
const cc = c + dc;
|
|
202
|
+
if (rr < 0 || cc < 0 || rr >= m.size || cc >= m.size)
|
|
203
|
+
continue;
|
|
204
|
+
const inRing = dr >= 0 && dr <= 6 && dc >= 0 && dc <= 6 && (dr === 0 || dr === 6 || dc === 0 || dc === 6);
|
|
205
|
+
const inCenter = dr >= 2 && dr <= 4 && dc >= 2 && dc <= 4;
|
|
206
|
+
m.set(rr, cc, inRing || inCenter ? 1 : 0);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function placeAlignment(m, version) {
|
|
211
|
+
const centers = ALIGN_POS[version] ?? [];
|
|
212
|
+
for (const r of centers) {
|
|
213
|
+
for (const c of centers) {
|
|
214
|
+
if ((r <= 8 && c <= 8) || (r <= 8 && c >= m.size - 9) || (r >= m.size - 9 && c <= 8))
|
|
215
|
+
continue;
|
|
216
|
+
for (let dr = -2; dr <= 2; dr++) {
|
|
217
|
+
for (let dc = -2; dc <= 2; dc++) {
|
|
218
|
+
m.set(r + dr, c + dc, Math.max(Math.abs(dr), Math.abs(dc)) !== 1 ? 1 : 0);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function placeTiming(m) {
|
|
225
|
+
for (let i = 8; i < m.size - 8; i++) {
|
|
226
|
+
const v = i % 2 === 0 ? 1 : 0;
|
|
227
|
+
if (!m.isSet(6, i))
|
|
228
|
+
m.set(6, i, v);
|
|
229
|
+
if (!m.isSet(i, 6))
|
|
230
|
+
m.set(i, 6, v);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function reserveFormat(size, version) {
|
|
234
|
+
const reserved = new Uint8Array(size * size);
|
|
235
|
+
const mark = (r, c) => {
|
|
236
|
+
if (r >= 0 && c >= 0 && r < size && c < size)
|
|
237
|
+
reserved[r * size + c] = 1;
|
|
238
|
+
};
|
|
239
|
+
for (let i = 0; i <= 8; i++) {
|
|
240
|
+
mark(8, i);
|
|
241
|
+
mark(i, 8);
|
|
242
|
+
}
|
|
243
|
+
for (let i = 0; i <= 7; i++) {
|
|
244
|
+
mark(8, size - 1 - i);
|
|
245
|
+
mark(size - 1 - i, 8);
|
|
246
|
+
}
|
|
247
|
+
mark(size - 8, 8);
|
|
248
|
+
if (version >= 7) {
|
|
249
|
+
for (let i = 0; i < 6; i++) {
|
|
250
|
+
for (let j = 0; j < 3; j++) {
|
|
251
|
+
mark(i, size - 11 + j);
|
|
252
|
+
mark(size - 11 + j, i);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return reserved;
|
|
257
|
+
}
|
|
258
|
+
function functionMap(m, reserved) {
|
|
259
|
+
const size = m.size;
|
|
260
|
+
const out = new Uint8Array(size * size);
|
|
261
|
+
for (let r = 0; r < size; r++) {
|
|
262
|
+
for (let c = 0; c < size; c++) {
|
|
263
|
+
out[r * size + c] = m.isSet(r, c) || reserved[r * size + c] === 1 ? 1 : 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
268
|
+
function placeData(m, funcMap, codewords) {
|
|
269
|
+
const size = m.size;
|
|
270
|
+
const bits = [];
|
|
271
|
+
for (const cw of codewords)
|
|
272
|
+
for (let i = 7; i >= 0; i--)
|
|
273
|
+
bits.push((cw >> i) & 1);
|
|
274
|
+
let bitIdx = 0;
|
|
275
|
+
let upward = true;
|
|
276
|
+
for (let col = size - 1; col > 0; col -= 2) {
|
|
277
|
+
if (col === 6)
|
|
278
|
+
col--;
|
|
279
|
+
for (let i = 0; i < size; i++) {
|
|
280
|
+
const row = upward ? size - 1 - i : i;
|
|
281
|
+
for (let dc = 0; dc < 2; dc++) {
|
|
282
|
+
const c = col - dc;
|
|
283
|
+
if (funcMap[row * size + c] === 1)
|
|
284
|
+
continue;
|
|
285
|
+
m.set(row, c, bitIdx < bits.length ? bits[bitIdx] : 0);
|
|
286
|
+
bitIdx++;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
upward = !upward;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const MASKS = [
|
|
293
|
+
(r, c) => (r + c) % 2 === 0,
|
|
294
|
+
(r) => r % 2 === 0,
|
|
295
|
+
(_r, c) => c % 3 === 0,
|
|
296
|
+
(r, c) => (r + c) % 3 === 0,
|
|
297
|
+
(r, c) => (Math.floor(r / 2) + Math.floor(c / 3)) % 2 === 0,
|
|
298
|
+
(r, c) => ((r * c) % 2) + ((r * c) % 3) === 0,
|
|
299
|
+
(r, c) => (((r * c) % 2) + ((r * c) % 3)) % 2 === 0,
|
|
300
|
+
(r, c) => (((r + c) % 2) + ((r * c) % 3)) % 2 === 0,
|
|
301
|
+
];
|
|
302
|
+
function maskFn(mask) {
|
|
303
|
+
return MASKS[mask] ?? MASKS[0] ?? (() => false);
|
|
304
|
+
}
|
|
305
|
+
function applyMask(m, funcMap, mask) {
|
|
306
|
+
const size = m.size;
|
|
307
|
+
const fn = maskFn(mask);
|
|
308
|
+
const out = new Uint8Array(size * size);
|
|
309
|
+
for (let r = 0; r < size; r++) {
|
|
310
|
+
for (let c = 0; c < size; c++) {
|
|
311
|
+
let v = m.get(r, c) === 1;
|
|
312
|
+
if (funcMap[r * size + c] !== 1 && fn(r, c))
|
|
313
|
+
v = !v;
|
|
314
|
+
out[r * size + c] = v ? 1 : 0;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return out;
|
|
318
|
+
}
|
|
319
|
+
function formatBits(level, mask) {
|
|
320
|
+
const data = (EC_FORMAT_BITS[level] << 3) | mask;
|
|
321
|
+
let rem = data << 10;
|
|
322
|
+
for (let i = 14; i >= 10; i--) {
|
|
323
|
+
if ((rem >> i) & 1)
|
|
324
|
+
rem ^= 0x537 << (i - 10);
|
|
325
|
+
}
|
|
326
|
+
return ((data << 10) | rem) ^ 0x5412;
|
|
327
|
+
}
|
|
328
|
+
function versionBits(version) {
|
|
329
|
+
let rem = version << 12;
|
|
330
|
+
for (let i = 17; i >= 12; i--) {
|
|
331
|
+
if ((rem >> i) & 1)
|
|
332
|
+
rem ^= 0x1f25 << (i - 12);
|
|
333
|
+
}
|
|
334
|
+
return (version << 12) | rem;
|
|
335
|
+
}
|
|
336
|
+
function placeFormatAndVersion(out, size, level, mask, version) {
|
|
337
|
+
const set = (r, c, v) => {
|
|
338
|
+
out[r * size + c] = v;
|
|
339
|
+
};
|
|
340
|
+
const fmt = formatBits(level, mask);
|
|
341
|
+
const getBit = (i) => (fmt >> (14 - i)) & 1;
|
|
342
|
+
for (let i = 0; i <= 5; i++)
|
|
343
|
+
set(8, i, getBit(i));
|
|
344
|
+
set(8, 7, getBit(6));
|
|
345
|
+
set(8, 8, getBit(7));
|
|
346
|
+
set(7, 8, getBit(8));
|
|
347
|
+
for (let i = 9; i <= 14; i++)
|
|
348
|
+
set(14 - i, 8, getBit(i));
|
|
349
|
+
for (let i = 0; i <= 7; i++)
|
|
350
|
+
set(size - 1 - i, 8, getBit(i));
|
|
351
|
+
for (let i = 8; i <= 14; i++)
|
|
352
|
+
set(8, size - 15 + i, getBit(i));
|
|
353
|
+
set(size - 8, 8, 1);
|
|
354
|
+
if (version >= 7) {
|
|
355
|
+
const vb = versionBits(version);
|
|
356
|
+
for (let i = 0; i < 18; i++) {
|
|
357
|
+
const bit = (vb >> i) & 1;
|
|
358
|
+
const r = Math.floor(i / 3);
|
|
359
|
+
const c = i % 3;
|
|
360
|
+
set(r, size - 11 + c, bit);
|
|
361
|
+
set(size - 11 + c, r, bit);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function penalty(m, n) {
|
|
366
|
+
const at = (r, c) => m[r * n + c];
|
|
367
|
+
let score = 0;
|
|
368
|
+
for (let line = 0; line < n; line++) {
|
|
369
|
+
for (let dir = 0; dir < 2; dir++) {
|
|
370
|
+
let run = 1;
|
|
371
|
+
let prev = dir === 0 ? at(line, 0) : at(0, line);
|
|
372
|
+
for (let i = 1; i < n; i++) {
|
|
373
|
+
const cur = dir === 0 ? at(line, i) : at(i, line);
|
|
374
|
+
if (cur === prev) {
|
|
375
|
+
run++;
|
|
376
|
+
if (run === 5)
|
|
377
|
+
score += 3;
|
|
378
|
+
else if (run > 5)
|
|
379
|
+
score += 1;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
run = 1;
|
|
383
|
+
prev = cur;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
for (let r = 0; r < n - 1; r++) {
|
|
389
|
+
for (let c = 0; c < n - 1; c++) {
|
|
390
|
+
const v = at(r, c);
|
|
391
|
+
if (v === at(r, c + 1) && v === at(r + 1, c) && v === at(r + 1, c + 1))
|
|
392
|
+
score += 3;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
const pat1 = [1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0];
|
|
396
|
+
const pat2 = [0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1];
|
|
397
|
+
for (let r = 0; r < n; r++) {
|
|
398
|
+
for (let c = 0; c <= n - 11; c++) {
|
|
399
|
+
let ok1 = true;
|
|
400
|
+
let ok2 = true;
|
|
401
|
+
for (let k = 0; k < 11; k++) {
|
|
402
|
+
const v = at(r, c + k);
|
|
403
|
+
if (v !== pat1[k])
|
|
404
|
+
ok1 = false;
|
|
405
|
+
if (v !== pat2[k])
|
|
406
|
+
ok2 = false;
|
|
407
|
+
}
|
|
408
|
+
if (ok1 || ok2)
|
|
409
|
+
score += 40;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
for (let c = 0; c < n; c++) {
|
|
413
|
+
for (let r = 0; r <= n - 11; r++) {
|
|
414
|
+
let ok1 = true;
|
|
415
|
+
let ok2 = true;
|
|
416
|
+
for (let k = 0; k < 11; k++) {
|
|
417
|
+
const v = at(r + k, c);
|
|
418
|
+
if (v !== pat1[k])
|
|
419
|
+
ok1 = false;
|
|
420
|
+
if (v !== pat2[k])
|
|
421
|
+
ok2 = false;
|
|
422
|
+
}
|
|
423
|
+
if (ok1 || ok2)
|
|
424
|
+
score += 40;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
let dark = 0;
|
|
428
|
+
for (let i = 0; i < m.length; i++)
|
|
429
|
+
dark += m[i];
|
|
430
|
+
const ratio = (dark * 100) / (n * n);
|
|
431
|
+
score += Math.floor(Math.abs(ratio - 50) / 5) * 10;
|
|
432
|
+
return score;
|
|
433
|
+
}
|
|
434
|
+
export function encodeQr(text, level = 'M') {
|
|
435
|
+
const data = new TextEncoder().encode(text);
|
|
436
|
+
const version = chooseVersion(data.length, level);
|
|
437
|
+
const size = version * 4 + 17;
|
|
438
|
+
const bits = buildBitstream(data, version, level);
|
|
439
|
+
const codewords = buildCodewords(bits, version, level);
|
|
440
|
+
const base = new Grid(size);
|
|
441
|
+
placeFinder(base, 0, 0);
|
|
442
|
+
placeFinder(base, 0, size - 7);
|
|
443
|
+
placeFinder(base, size - 7, 0);
|
|
444
|
+
placeAlignment(base, version);
|
|
445
|
+
placeTiming(base);
|
|
446
|
+
const reserved = reserveFormat(size, version);
|
|
447
|
+
const funcMap = functionMap(base, reserved);
|
|
448
|
+
placeData(base, funcMap, codewords);
|
|
449
|
+
let best = null;
|
|
450
|
+
let bestScore = Infinity;
|
|
451
|
+
for (let mask = 0; mask < 8; mask++) {
|
|
452
|
+
const masked = applyMask(base, funcMap, mask);
|
|
453
|
+
placeFormatAndVersion(masked, size, level, mask, version);
|
|
454
|
+
const p = penalty(masked, size);
|
|
455
|
+
if (p < bestScore) {
|
|
456
|
+
bestScore = p;
|
|
457
|
+
best = masked;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
const grid = best;
|
|
461
|
+
const out = [];
|
|
462
|
+
for (let r = 0; r < size; r++) {
|
|
463
|
+
const row = [];
|
|
464
|
+
for (let c = 0; c < size; c++)
|
|
465
|
+
row.push(grid[r * size + c] === 1);
|
|
466
|
+
out.push(row);
|
|
467
|
+
}
|
|
468
|
+
return out;
|
|
469
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface QuantityStepperProps {
|
|
3
|
+
value: number;
|
|
4
|
+
onValueChange: (value: number) => void;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** A short trailing unit, shown inside the field so the number keeps its own column. */
|
|
10
|
+
unit?: ReactNode;
|
|
11
|
+
/** Labels the field itself; the two buttons derive theirs from decrementLabel/incrementLabel. */
|
|
12
|
+
label: string;
|
|
13
|
+
decrementLabel: string;
|
|
14
|
+
incrementLabel: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A number you nudge rather than type: the buttons carry the common case and the field
|
|
19
|
+
* stays editable for the uncommon one.
|
|
20
|
+
*
|
|
21
|
+
* The value is clamped on commit rather than on every keystroke, because clamping as
|
|
22
|
+
* someone types makes an intermediate "1" on the way to "12" jump to the minimum and eat
|
|
23
|
+
* the next digit. Typing is free; blur and the buttons are what settle it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const QuantityStepper: import("react").ForwardRefExoticComponent<QuantityStepperProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useState } from 'react';
|
|
4
|
+
import { Minus, Plus } from 'lucide-react';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { Input } from './input.js';
|
|
7
|
+
import { cn } from '../lib/cn.js';
|
|
8
|
+
/**
|
|
9
|
+
* A number you nudge rather than type: the buttons carry the common case and the field
|
|
10
|
+
* stays editable for the uncommon one.
|
|
11
|
+
*
|
|
12
|
+
* The value is clamped on commit rather than on every keystroke, because clamping as
|
|
13
|
+
* someone types makes an intermediate "1" on the way to "12" jump to the minimum and eat
|
|
14
|
+
* the next digit. Typing is free; blur and the buttons are what settle it.
|
|
15
|
+
*/
|
|
16
|
+
export const QuantityStepper = forwardRef(function QuantityStepper({ value, onValueChange, min = 0, max = Number.MAX_SAFE_INTEGER, step = 1, disabled = false, unit, label, decrementLabel, incrementLabel, className, }, ref) {
|
|
17
|
+
const [draft, setDraft] = useState(String(value));
|
|
18
|
+
const [trackedValue, setTrackedValue] = useState(value);
|
|
19
|
+
// The committed value can move underneath an idle control — a peer's change, a rejected
|
|
20
|
+
// write rolling back — and the field has to follow it rather than show a stale number.
|
|
21
|
+
if (value !== trackedValue) {
|
|
22
|
+
setTrackedValue(value);
|
|
23
|
+
setDraft(String(value));
|
|
24
|
+
}
|
|
25
|
+
const clamp = (next) => Math.min(Math.max(next, min), max);
|
|
26
|
+
const commit = (next) => {
|
|
27
|
+
const settled = clamp(Number.isFinite(next) ? next : value);
|
|
28
|
+
setDraft(String(settled));
|
|
29
|
+
if (settled !== value)
|
|
30
|
+
onValueChange(settled);
|
|
31
|
+
};
|
|
32
|
+
return (_jsxs("div", { "data-slot": "quantity-stepper", className: cn('flex items-center gap-1.5', className), children: [_jsx(Button, { type: "button", variant: "outline", size: "icon-sm", "aria-label": decrementLabel, disabled: disabled || value <= min, onClick: () => commit(value - step), children: _jsx(Minus, { className: "size-3.5", strokeWidth: 1.5, "aria-hidden": true }) }), _jsxs("div", { className: "relative", children: [_jsx(Input, { ref: ref, value: draft, inputMode: "numeric", autoComplete: "off", disabled: disabled, "aria-label": label, className: cn('w-[92px] text-center font-mono text-[12.5px] tabular-nums', unit && 'pr-7'), onChange: (event) => setDraft(event.target.value.replace(/[^\d]/g, '')), onBlur: () => commit(Number.parseInt(draft, 10)), onKeyDown: (event) => {
|
|
33
|
+
if (event.key === 'Enter') {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
event.currentTarget.blur();
|
|
36
|
+
}
|
|
37
|
+
else if (event.key === 'Escape') {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
setDraft(String(value));
|
|
40
|
+
event.currentTarget.blur();
|
|
41
|
+
}
|
|
42
|
+
} }), unit ? (_jsx("span", { className: "text-muted-foreground pointer-events-none absolute inset-y-0 right-2.5 flex items-center font-mono text-[11px]", children: unit })) : null] }), _jsx(Button, { type: "button", variant: "outline", size: "icon-sm", "aria-label": incrementLabel, disabled: disabled || value >= max, onClick: () => commit(value + step), children: _jsx(Plus, { className: "size-3.5", strokeWidth: 1.5, "aria-hidden": true }) })] }));
|
|
43
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
3
|
+
declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element;
|
|
5
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
5
|
+
import { CircleIcon } from "lucide-react";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
function RadioGroup({ className, ...props }) {
|
|
8
|
+
return (_jsx(RadioGroupPrimitive.Root, { "data-slot": "radio-group", className: cn("grid gap-2", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function RadioGroupItem({ className, ...props }) {
|
|
11
|
+
return (_jsx(RadioGroupPrimitive.Item, { "data-slot": "radio-group-item", className: cn("aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:border-primary dark:bg-input/30", className), ...props, children: _jsx(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: _jsx(CircleIcon, { className: "size-2 fill-primary text-primary" }) }) }));
|
|
12
|
+
}
|
|
13
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface RenameDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
value: string;
|
|
5
|
+
title: string;
|
|
6
|
+
label: string;
|
|
7
|
+
confirmLabel: string;
|
|
8
|
+
cancelLabel: string;
|
|
9
|
+
onOpenChange: (open: boolean) => void;
|
|
10
|
+
onSubmit: (next: string) => Promise<void> | void;
|
|
11
|
+
description?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
busy?: boolean;
|
|
14
|
+
error?: string | null;
|
|
15
|
+
requiredError?: string;
|
|
16
|
+
detail?: ReactNode;
|
|
17
|
+
detailPlacement?: 'top' | 'bottom';
|
|
18
|
+
}
|
|
19
|
+
export declare function RenameDialog({ open, value, title, label, confirmLabel, cancelLabel, onOpenChange, onSubmit, description, placeholder, busy, error, requiredError, detail, detailPlacement, }: RenameDialogProps): import("react").JSX.Element;
|