@selvajs/ui 6.6.0-beta.8 → 7.0.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 +0 -3
- package/dist/components/ErrorScreen.svelte +1 -1
- package/dist/components/compute/AppLayout.svelte +95 -37
- package/dist/components/compute/AppLayout.svelte.d.ts +18 -1
- package/dist/components/compute/CollapsedPanelStrip.svelte +4 -2
- package/dist/components/compute/ComputeApp.svelte +6 -2
- package/dist/components/compute/ComputeApp.svelte.d.ts +1 -1
- package/dist/components/compute/ComputeMessagesDialog.svelte +3 -3
- package/dist/components/compute/ParameterPresetManager.svelte +9 -21
- package/dist/components/compute/SolveMessages.svelte +101 -87
- package/dist/components/compute/SolveMessages.svelte.d.ts +12 -0
- package/dist/components/layout/AppShell.svelte +2 -2
- package/dist/components/layout/FooterItemRenderer.svelte +2 -2
- package/dist/components/layout/FooterItemRenderer.svelte.d.ts +1 -1
- package/dist/components/layout/PageContent.svelte +3 -2
- package/dist/components/layout/PageFooter.svelte +8 -6
- package/dist/components/layout/PageHeader.svelte +3 -3
- package/dist/components/layout/SideNav.svelte +56 -15
- package/dist/components/layout/SubNav.svelte +2 -2
- package/dist/components/preview/ChartOutput.svelte +158 -62
- package/dist/components/preview/Group.svelte +14 -9
- package/dist/components/preview/HelpButton.svelte +1 -1
- package/dist/components/preview/ImageOutput.svelte +16 -11
- package/dist/components/preview/InputControl.svelte +115 -50
- package/dist/components/preview/InputControl.svelte.d.ts +5 -1
- package/dist/components/preview/OutputDisplay.svelte +26 -17
- package/dist/components/preview/TabBar.svelte +8 -6
- package/dist/components/preview/TabBar.svelte.d.ts +2 -0
- package/dist/components/preview/TabContent.svelte +65 -33
- package/dist/components/preview/TabContent.svelte.d.ts +5 -1
- package/dist/components/preview/TabLayout.svelte +29 -8
- package/dist/components/preview/TabLayout.svelte.d.ts +5 -0
- package/dist/components/preview/inputs/CheckboxInput.svelte +1 -1
- package/dist/components/preview/inputs/ChecklistInput.svelte +11 -6
- package/dist/components/preview/inputs/ChecklistInput.svelte.d.ts +2 -1
- package/dist/components/preview/inputs/ColorInput.svelte +356 -14
- package/dist/components/preview/inputs/ColorInput.svelte.d.ts +1 -0
- package/dist/components/preview/inputs/DropdownInput.svelte +18 -6
- package/dist/components/preview/inputs/DropdownInput.svelte.d.ts +2 -1
- package/dist/components/preview/inputs/FileInput.svelte +71 -75
- package/dist/components/preview/inputs/GeometryInput.svelte +128 -0
- package/dist/components/preview/inputs/GeometryInput.svelte.d.ts +21 -0
- package/dist/components/preview/inputs/NumberInput.svelte +8 -8
- package/dist/components/preview/inputs/OptionGlyph.svelte +29 -0
- package/dist/components/preview/inputs/OptionGlyph.svelte.d.ts +8 -0
- package/dist/components/preview/inputs/SegmentedInput.svelte +45 -0
- package/dist/components/preview/inputs/SegmentedInput.svelte.d.ts +12 -0
- package/dist/components/preview/inputs/TextInput.svelte +5 -5
- package/dist/components/preview/inputs/TileInput.svelte +83 -0
- package/dist/components/preview/inputs/TileInput.svelte.d.ts +12 -0
- package/dist/components/preview/inputs/index.d.ts +3 -0
- package/dist/components/preview/inputs/index.js +3 -0
- package/dist/components/primitives/CalculateButton.svelte +10 -4
- package/dist/components/primitives/Callout.svelte +8 -6
- package/dist/components/primitives/Callout.svelte.d.ts +4 -4
- package/dist/components/primitives/DataTable.svelte +1 -1
- package/dist/components/primitives/FilterableDropdown.svelte +13 -1
- package/dist/components/primitives/FilterableDropdown.svelte.d.ts +5 -0
- package/dist/components/primitives/ImageUploadField.svelte +1 -1
- package/dist/components/primitives/SolvingIndicator.svelte +245 -19
- package/dist/components/primitives/SolvingIndicator.svelte.d.ts +15 -0
- package/dist/components/primitives/alert-dialog/alert-dialog-content.svelte +1 -1
- package/dist/components/primitives/badge/badge.svelte +2 -2
- package/dist/components/primitives/badge/badge.svelte.d.ts +6 -6
- package/dist/components/primitives/button/button.svelte +9 -7
- package/dist/components/primitives/button/button.svelte.d.ts +19 -16
- package/dist/components/primitives/card/card.svelte +1 -1
- package/dist/components/primitives/card/card.svelte.d.ts +1 -1
- package/dist/components/primitives/checkbox/checkbox.svelte +1 -1
- package/dist/components/primitives/command/command-input.svelte +1 -1
- package/dist/components/primitives/command/command-item.svelte +1 -1
- package/dist/components/primitives/command/command-link-item.svelte +1 -1
- package/dist/components/primitives/command/command.svelte +1 -1
- package/dist/components/primitives/context-menu/context-menu-checkbox-item.svelte +1 -1
- package/dist/components/primitives/context-menu/context-menu-content.svelte +1 -1
- package/dist/components/primitives/context-menu/context-menu-item.svelte +1 -1
- package/dist/components/primitives/context-menu/context-menu-radio-item.svelte +1 -1
- package/dist/components/primitives/context-menu/context-menu-sub-content.svelte +1 -1
- package/dist/components/primitives/context-menu/context-menu-sub-trigger.svelte +1 -1
- package/dist/components/primitives/dialog/dialog-content.svelte +3 -3
- package/dist/components/primitives/drawer/Drawer.svelte +1 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-checkbox-item.svelte +31 -11
- package/dist/components/primitives/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +2 -0
- package/dist/components/primitives/dropdown-menu/dropdown-menu-content.svelte +5 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-content.svelte.d.ts +2 -0
- package/dist/components/primitives/dropdown-menu/dropdown-menu-item.svelte +4 -2
- package/dist/components/primitives/dropdown-menu/dropdown-menu-item.svelte.d.ts +2 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-shortcut.svelte +1 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/primitives/index.d.ts +1 -1
- package/dist/components/primitives/index.js +1 -1
- package/dist/components/primitives/input/input.svelte +2 -2
- package/dist/components/primitives/input-group/input-group-input.svelte.d.ts +1 -1
- package/dist/components/primitives/input-group/input-group.svelte +1 -1
- package/dist/components/primitives/mode-toggle/mode-toggle.svelte +2 -2
- package/dist/components/primitives/popover/popover-content.svelte +1 -1
- package/dist/components/primitives/resizable/resizable-handle.svelte +2 -2
- package/dist/components/primitives/search/search.svelte +1 -1
- package/dist/components/primitives/select/select-content.svelte +1 -1
- package/dist/components/primitives/select/select-item.svelte +1 -1
- package/dist/components/primitives/select/select-trigger.svelte +1 -1
- package/dist/components/primitives/slider/slider.svelte +1 -1
- package/dist/components/primitives/switch/switch.svelte +1 -1
- package/dist/components/primitives/tabs/tabs-list.svelte +2 -2
- package/dist/components/primitives/tabs/tabs-list.svelte.d.ts +6 -6
- package/dist/components/primitives/tabs/tabs-trigger.svelte +2 -2
- package/dist/components/primitives/tabs/tabs-trigger.svelte.d.ts +6 -6
- package/dist/components/primitives/textarea/textarea.svelte +1 -1
- package/dist/components/primitives/toggle/toggle.svelte +11 -3
- package/dist/components/primitives/toggle/toggle.svelte.d.ts +13 -4
- package/dist/components/primitives/toggle-group/toggle-group-item.svelte +1 -1
- package/dist/components/primitives/toggle-group/toggle-group.svelte +1 -1
- package/dist/components/primitives/tooltip/index.d.ts +6 -0
- package/dist/components/primitives/tooltip/index.js +8 -0
- package/dist/components/primitives/tooltip/tooltip-content.svelte +34 -0
- package/dist/components/primitives/tooltip/tooltip-content.svelte.d.ts +10 -0
- package/dist/components/primitives/tooltip/tooltip-portal.svelte +7 -0
- package/dist/components/primitives/tooltip/tooltip-portal.svelte.d.ts +4 -0
- package/dist/components/primitives/tooltip/tooltip-provider.svelte +7 -0
- package/dist/components/primitives/tooltip/tooltip-provider.svelte.d.ts +4 -0
- package/dist/components/primitives/tooltip/tooltip-trigger.svelte +7 -0
- package/dist/components/primitives/tooltip/tooltip-trigger.svelte.d.ts +4 -0
- package/dist/components/primitives/tooltip/tooltip.svelte +7 -0
- package/dist/components/primitives/tooltip/tooltip.svelte.d.ts +4 -0
- package/dist/components/viewer/MeshMetadataPanel.svelte +2 -2
- package/dist/components/viewer/SceneManager.svelte +32 -21
- package/dist/components/viewer/SceneManager.svelte.d.ts +3 -1
- package/dist/components/viewer/Viewer.svelte +135 -185
- package/dist/components/viewer/Viewer.svelte.d.ts +7 -2
- package/dist/components/viewer/ViewerDock.svelte +404 -0
- package/dist/components/viewer/ViewerDock.svelte.d.ts +42 -0
- package/dist/composables/useFooterItem.svelte.d.ts +1 -1
- package/dist/composables/useFooterItem.svelte.js +1 -1
- package/dist/compute/liveProgress.svelte.d.ts +16 -0
- package/dist/compute/liveProgress.svelte.js +90 -0
- package/dist/compute/solving.svelte.d.ts +11 -7
- package/dist/compute/solving.svelte.js +64 -45
- package/dist/constants.d.ts +6 -8
- package/dist/constants.js +8 -11
- package/dist/contexts/hostContext.svelte.d.ts +39 -0
- package/dist/contexts/hostContext.svelte.js +9 -0
- package/dist/features/chart/plotly-compat.d.ts +15 -0
- package/dist/features/chart/plotly-compat.js +124 -0
- package/dist/i18n/messages.d.ts +50 -0
- package/dist/i18n/messages.js +84 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/public.d.ts +1 -0
- package/dist/public.js +1 -0
- package/dist/schema/host-support.d.ts +29 -0
- package/dist/schema/host-support.js +97 -0
- package/dist/schema/option-display.d.ts +12 -0
- package/dist/schema/option-display.js +29 -0
- package/dist/schema/param-exporter.d.ts +4 -1
- package/dist/schema/param-exporter.js +10 -6
- package/dist/schema/visibility-rules.d.ts +7 -1
- package/dist/schema/visibility-rules.js +17 -0
- package/dist/styles/base.css +94 -84
- package/dist/utils/color-space.d.ts +21 -0
- package/dist/utils/color-space.js +90 -0
- package/dist/utils/file-download.js +6 -10
- package/dist/utils/host-files.d.ts +12 -0
- package/dist/utils/host-files.js +46 -0
- package/dist/utils/webp-to-png.d.ts +10 -0
- package/dist/utils/webp-to-png.js +41 -0
- package/package.json +31 -23
- package/src/lib/components/ErrorScreen.svelte +1 -1
- package/src/lib/components/compute/AppLayout.svelte +96 -38
- package/src/lib/components/compute/CollapsedPanelStrip.svelte +4 -2
- package/src/lib/components/compute/ComputeApp.svelte +6 -2
- package/src/lib/components/compute/ComputeMessagesDialog.svelte +4 -4
- package/src/lib/components/compute/ParameterPresetManager.svelte +9 -21
- package/src/lib/components/compute/SolveMessages.svelte +103 -89
- package/src/lib/components/layout/AppShell.svelte +2 -2
- package/src/lib/components/layout/FooterItemRenderer.svelte +2 -2
- package/src/lib/components/layout/PageContent.svelte +3 -2
- package/src/lib/components/layout/PageFooter.svelte +8 -6
- package/src/lib/components/layout/PageHeader.svelte +3 -3
- package/src/lib/components/layout/SideNav.svelte +56 -15
- package/src/lib/components/layout/SubNav.svelte +2 -2
- package/src/lib/components/preview/ChartOutput.svelte +158 -62
- package/src/lib/components/preview/Group.svelte +14 -9
- package/src/lib/components/preview/HelpButton.svelte +1 -1
- package/src/lib/components/preview/ImageOutput.svelte +16 -11
- package/src/lib/components/preview/InputControl.svelte +115 -50
- package/src/lib/components/preview/OutputDisplay.svelte +26 -17
- package/src/lib/components/preview/TabBar.svelte +8 -6
- package/src/lib/components/preview/TabContent.svelte +65 -33
- package/src/lib/components/preview/TabLayout.svelte +29 -8
- package/src/lib/components/preview/inputs/CheckboxInput.svelte +1 -1
- package/src/lib/components/preview/inputs/ChecklistInput.svelte +11 -6
- package/src/lib/components/preview/inputs/ColorInput.svelte +356 -14
- package/src/lib/components/preview/inputs/DropdownInput.svelte +18 -6
- package/src/lib/components/preview/inputs/FileInput.svelte +71 -75
- package/src/lib/components/preview/inputs/GeometryInput.svelte +128 -0
- package/src/lib/components/preview/inputs/NumberInput.svelte +8 -8
- package/src/lib/components/preview/inputs/OptionGlyph.svelte +29 -0
- package/src/lib/components/preview/inputs/SegmentedInput.svelte +45 -0
- package/src/lib/components/preview/inputs/TextInput.svelte +5 -5
- package/src/lib/components/preview/inputs/TileInput.svelte +83 -0
- package/src/lib/components/preview/inputs/index.ts +3 -0
- package/src/lib/components/primitives/CalculateButton.svelte +10 -4
- package/src/lib/components/primitives/Callout.svelte +9 -7
- package/src/lib/components/primitives/DataTable.svelte +1 -1
- package/src/lib/components/primitives/FilterableDropdown.svelte +14 -2
- package/src/lib/components/primitives/ImageUploadField.svelte +1 -1
- package/src/lib/components/primitives/IssueList.svelte +1 -1
- package/src/lib/components/primitives/SeverityIcon.svelte +1 -1
- package/src/lib/components/primitives/SolvingIndicator.svelte +245 -19
- package/src/lib/components/primitives/StateDisplay.svelte +1 -1
- package/src/lib/components/primitives/alert-dialog/alert-dialog-action.svelte +2 -2
- package/src/lib/components/primitives/alert-dialog/alert-dialog-cancel.svelte +2 -2
- package/src/lib/components/primitives/alert-dialog/alert-dialog-content.svelte +2 -2
- package/src/lib/components/primitives/alert-dialog/alert-dialog-description.svelte +1 -1
- package/src/lib/components/primitives/alert-dialog/alert-dialog-footer.svelte +1 -1
- package/src/lib/components/primitives/alert-dialog/alert-dialog-header.svelte +1 -1
- package/src/lib/components/primitives/alert-dialog/alert-dialog-overlay.svelte +1 -1
- package/src/lib/components/primitives/alert-dialog/alert-dialog-title.svelte +1 -1
- package/src/lib/components/primitives/badge/badge.svelte +3 -3
- package/src/lib/components/primitives/button/button.svelte +9 -7
- package/src/lib/components/primitives/button-group/button-group-separator.svelte +2 -2
- package/src/lib/components/primitives/button-group/button-group-text.svelte +1 -1
- package/src/lib/components/primitives/button-group/button-group.svelte +1 -1
- package/src/lib/components/primitives/card/card-content.svelte +1 -1
- package/src/lib/components/primitives/card/card-description.svelte +1 -1
- package/src/lib/components/primitives/card/card-footer.svelte +1 -1
- package/src/lib/components/primitives/card/card-header.svelte +1 -1
- package/src/lib/components/primitives/card/card-title.svelte +1 -1
- package/src/lib/components/primitives/card/card.svelte +2 -2
- package/src/lib/components/primitives/checkbox/checkbox.svelte +2 -2
- package/src/lib/components/primitives/command/command-dialog.svelte +2 -2
- package/src/lib/components/primitives/command/command-empty.svelte +1 -1
- package/src/lib/components/primitives/command/command-group.svelte +1 -1
- package/src/lib/components/primitives/command/command-input.svelte +3 -3
- package/src/lib/components/primitives/command/command-item.svelte +2 -2
- package/src/lib/components/primitives/command/command-link-item.svelte +2 -2
- package/src/lib/components/primitives/command/command-list.svelte +1 -1
- package/src/lib/components/primitives/command/command-separator.svelte +1 -1
- package/src/lib/components/primitives/command/command-shortcut.svelte +1 -1
- package/src/lib/components/primitives/command/command.svelte +2 -2
- package/src/lib/components/primitives/context-menu/context-menu-checkbox-item.svelte +2 -2
- package/src/lib/components/primitives/context-menu/context-menu-content.svelte +2 -2
- package/src/lib/components/primitives/context-menu/context-menu-group-heading.svelte +1 -1
- package/src/lib/components/primitives/context-menu/context-menu-item.svelte +2 -2
- package/src/lib/components/primitives/context-menu/context-menu-label.svelte +1 -1
- package/src/lib/components/primitives/context-menu/context-menu-radio-item.svelte +2 -2
- package/src/lib/components/primitives/context-menu/context-menu-separator.svelte +1 -1
- package/src/lib/components/primitives/context-menu/context-menu-shortcut.svelte +1 -1
- package/src/lib/components/primitives/context-menu/context-menu-sub-content.svelte +2 -2
- package/src/lib/components/primitives/context-menu/context-menu-sub-trigger.svelte +2 -2
- package/src/lib/components/primitives/dialog/dialog-content.svelte +4 -4
- package/src/lib/components/primitives/dialog/dialog-description.svelte +1 -1
- package/src/lib/components/primitives/dialog/dialog-footer.svelte +1 -1
- package/src/lib/components/primitives/dialog/dialog-header.svelte +1 -1
- package/src/lib/components/primitives/dialog/dialog-overlay.svelte +1 -1
- package/src/lib/components/primitives/dialog/dialog-title.svelte +1 -1
- package/src/lib/components/primitives/drawer/Drawer.svelte +1 -1
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-checkbox-item.svelte +32 -12
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-content.svelte +6 -2
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-group-heading.svelte +1 -1
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-item.svelte +5 -3
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-label.svelte +1 -1
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-radio-item.svelte +2 -2
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-separator.svelte +1 -1
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-shortcut.svelte +2 -2
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-sub-content.svelte +2 -2
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-sub-trigger.svelte +2 -2
- package/src/lib/components/primitives/empty/empty-content.svelte +1 -1
- package/src/lib/components/primitives/empty/empty-description.svelte +1 -1
- package/src/lib/components/primitives/empty/empty-header.svelte +1 -1
- package/src/lib/components/primitives/empty/empty-media.svelte +1 -1
- package/src/lib/components/primitives/empty/empty-title.svelte +1 -1
- package/src/lib/components/primitives/empty/empty.svelte +1 -1
- package/src/lib/components/primitives/field/field-content.svelte +1 -1
- package/src/lib/components/primitives/field/field-description.svelte +1 -1
- package/src/lib/components/primitives/field/field-error.svelte +1 -1
- package/src/lib/components/primitives/field/field-group.svelte +1 -1
- package/src/lib/components/primitives/field/field-label.svelte +2 -2
- package/src/lib/components/primitives/field/field-legend.svelte +1 -1
- package/src/lib/components/primitives/field/field-separator.svelte +2 -2
- package/src/lib/components/primitives/field/field-set.svelte +1 -1
- package/src/lib/components/primitives/field/field-title.svelte +1 -1
- package/src/lib/components/primitives/field/field.svelte +1 -1
- package/src/lib/components/primitives/index.ts +1 -1
- package/src/lib/components/primitives/input/input.svelte +3 -3
- package/src/lib/components/primitives/input-group/input-group-addon.svelte +1 -1
- package/src/lib/components/primitives/input-group/input-group-button.svelte +2 -2
- package/src/lib/components/primitives/input-group/input-group-input.svelte +2 -2
- package/src/lib/components/primitives/input-group/input-group-text.svelte +1 -1
- package/src/lib/components/primitives/input-group/input-group-textarea.svelte +2 -2
- package/src/lib/components/primitives/input-group/input-group.svelte +2 -2
- package/src/lib/components/primitives/label/label.svelte +1 -1
- package/src/lib/components/primitives/mode-toggle/mode-toggle.svelte +2 -2
- package/src/lib/components/primitives/popover/popover-content.svelte +2 -2
- package/src/lib/components/primitives/popover/popover-description.svelte +1 -1
- package/src/lib/components/primitives/popover/popover-header.svelte +1 -1
- package/src/lib/components/primitives/popover/popover-title.svelte +1 -1
- package/src/lib/components/primitives/popover/popover-trigger.svelte +1 -1
- package/src/lib/components/primitives/resizable/resizable-handle.svelte +3 -3
- package/src/lib/components/primitives/resizable/resizable-pane-group.svelte +1 -1
- package/src/lib/components/primitives/scroll-area/scroll-area-scrollbar.svelte +1 -1
- package/src/lib/components/primitives/scroll-area/scroll-area.svelte +1 -1
- package/src/lib/components/primitives/search/search.svelte +2 -2
- package/src/lib/components/primitives/select/select-content.svelte +2 -2
- package/src/lib/components/primitives/select/select-group-heading.svelte +1 -1
- package/src/lib/components/primitives/select/select-item.svelte +2 -2
- package/src/lib/components/primitives/select/select-label.svelte +1 -1
- package/src/lib/components/primitives/select/select-scroll-down-button.svelte +1 -1
- package/src/lib/components/primitives/select/select-scroll-up-button.svelte +1 -1
- package/src/lib/components/primitives/select/select-separator.svelte +2 -2
- package/src/lib/components/primitives/select/select-trigger.svelte +2 -2
- package/src/lib/components/primitives/separator/separator.svelte +1 -1
- package/src/lib/components/primitives/slider/slider.svelte +2 -2
- package/src/lib/components/primitives/spinner/spinner.svelte +1 -1
- package/src/lib/components/primitives/switch/switch.svelte +2 -2
- package/src/lib/components/primitives/tabs/tabs-content.svelte +1 -1
- package/src/lib/components/primitives/tabs/tabs-list.svelte +3 -3
- package/src/lib/components/primitives/tabs/tabs-trigger.svelte +3 -3
- package/src/lib/components/primitives/tabs/tabs.svelte +1 -1
- package/src/lib/components/primitives/textarea/textarea.svelte +2 -2
- package/src/lib/components/primitives/toggle/toggle.svelte +12 -4
- package/src/lib/components/primitives/toggle-group/toggle-group-item.svelte +3 -3
- package/src/lib/components/primitives/toggle-group/toggle-group.svelte +3 -3
- package/src/lib/components/primitives/tooltip/index.ts +19 -0
- package/src/lib/components/primitives/tooltip/tooltip-content.svelte +34 -0
- package/src/lib/components/primitives/tooltip/tooltip-portal.svelte +7 -0
- package/src/lib/components/primitives/tooltip/tooltip-provider.svelte +7 -0
- package/src/lib/components/primitives/tooltip/tooltip-trigger.svelte +7 -0
- package/src/lib/components/primitives/tooltip/tooltip.svelte +7 -0
- package/src/lib/components/viewer/MeshMetadataPanel.svelte +2 -2
- package/src/lib/components/viewer/SceneManager.svelte +32 -21
- package/src/lib/components/viewer/Viewer.svelte +136 -186
- package/src/lib/components/viewer/ViewerDock.svelte +404 -0
- package/src/lib/composables/useFooterItem.svelte.ts +1 -1
- package/src/lib/compute/liveProgress.svelte.ts +103 -0
- package/src/lib/compute/solving.svelte.ts +66 -50
- package/src/lib/constants.ts +8 -11
- package/src/lib/contexts/hostContext.svelte.ts +51 -0
- package/src/lib/features/chart/plotly-compat.ts +141 -0
- package/src/lib/i18n/messages.ts +139 -0
- package/src/lib/index.ts +22 -0
- package/src/lib/public.ts +1 -0
- package/src/lib/schema/host-support.ts +129 -0
- package/src/lib/schema/option-display.ts +44 -0
- package/src/lib/schema/param-exporter.ts +10 -7
- package/src/lib/schema/visibility-rules.ts +27 -1
- package/src/lib/styles/base.css +94 -84
- package/src/lib/utils/color-space.ts +107 -0
- package/src/lib/utils/file-download.ts +7 -11
- package/src/lib/utils/host-files.ts +61 -0
- package/src/lib/utils/webp-to-png.ts +48 -0
- package/dist/components/primitives/theme-switcher/ThemeSwitcher.svelte +0 -39
- package/dist/components/primitives/theme-switcher/ThemeSwitcher.svelte.d.ts +0 -3
- package/dist/components/primitives/theme-switcher/index.d.ts +0 -1
- package/dist/components/primitives/theme-switcher/index.js +0 -1
- package/dist/styles/themes/cyberpunk.css +0 -98
- package/dist/styles/themes/neutral.css +0 -72
- package/dist/styles/themes/ocean.css +0 -75
- package/dist/styles/themes/selva.css +0 -105
- package/dist/theme/themeStore.svelte.d.ts +0 -12
- package/dist/theme/themeStore.svelte.js +0 -40
- package/dist/theme/themes.d.ts +0 -5
- package/dist/theme/themes.js +0 -13
- package/src/lib/components/primitives/theme-switcher/ThemeSwitcher.svelte +0 -39
- package/src/lib/components/primitives/theme-switcher/index.ts +0 -1
- package/src/lib/styles/themes/cyberpunk.css +0 -98
- package/src/lib/styles/themes/neutral.css +0 -72
- package/src/lib/styles/themes/ocean.css +0 -75
- package/src/lib/styles/themes/selva.css +0 -105
- package/src/lib/theme/themeStore.svelte.ts +0 -50
- package/src/lib/theme/themes.ts +0 -18
package/dist/public.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { writeExternalValue, readExternalValue, clearExternalValue, getExternalI
|
|
|
14
14
|
export * from './schema/defaults';
|
|
15
15
|
export * from './schema/traversal';
|
|
16
16
|
export * from './schema/dynamic-value-list';
|
|
17
|
+
export { visibleInputItems } from './schema/visibility-rules';
|
|
17
18
|
export type { ActionButton } from './types/actionButton';
|
|
18
19
|
export type { SolveFn, SolveResult, SolveDiagnostic } from '@selvajs/solve/shared';
|
|
19
20
|
export { DEFAULT_PRESET_LABELS, type PresetLabels } from './types/presetLabels';
|
package/dist/public.js
CHANGED
|
@@ -28,4 +28,5 @@ export { writeExternalValue, readExternalValue, clearExternalValue, getExternalI
|
|
|
28
28
|
export * from './schema/defaults';
|
|
29
29
|
export * from './schema/traversal';
|
|
30
30
|
export * from './schema/dynamic-value-list';
|
|
31
|
+
export { visibleInputItems } from './schema/visibility-rules';
|
|
31
32
|
export { DEFAULT_PRESET_LABELS } from './types/presetLabels';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { InputLayoutItem, LayoutItem, SchemaInput, UISchema } from '@selvajs/schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Where a UI runs: `rhino` is the plugin's page inside Rhino, solving in the user's own
|
|
4
|
+
* Grasshopper; `selva` is the Selva app, solving headless on Rhino.Compute.
|
|
5
|
+
*/
|
|
6
|
+
export type UIHost = 'rhino' | 'selva';
|
|
7
|
+
/**
|
|
8
|
+
* - `value`: an input or output every host renders.
|
|
9
|
+
* - `geometry`: a Rhino Get Geometry/Point/Line/Plane input, filled by picking in the viewport.
|
|
10
|
+
* - `trigger`: a boolean input shown as a button; a press solves once with `true`.
|
|
11
|
+
* - `unknown`: a layout item from a newer schema than this build knows.
|
|
12
|
+
*/
|
|
13
|
+
export type ElementKind = 'value' | 'geometry' | 'trigger' | 'unknown';
|
|
14
|
+
export declare const HOST_LABELS: Record<UIHost, string>;
|
|
15
|
+
/** The control comes from this, whatever the saved widgetType says: saved ones hold `text`. */
|
|
16
|
+
export declare function isGeometryParamType(paramType: string | undefined): boolean;
|
|
17
|
+
export declare function isTriggerItem(item: LayoutItem): boolean;
|
|
18
|
+
export declare function layoutItemKind(item: LayoutItem, inputs: readonly SchemaInput[]): ElementKind;
|
|
19
|
+
export declare function hostsFor(kind: ElementKind): readonly UIHost[];
|
|
20
|
+
export declare function isSupportedOn(host: UIHost, kind: ElementKind): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Inputs the form keeps no value for: geometry lives on the Grasshopper param after a pick, and a
|
|
23
|
+
* button only sends a press. Value updates and presets skip them; holding a button's `true` would
|
|
24
|
+
* fire its action again on every solve.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isValuelessInput(item: InputLayoutItem, input: SchemaInput | undefined): boolean;
|
|
27
|
+
export declare function valuelessInputIds(schema: UISchema): Set<string>;
|
|
28
|
+
/** The placed items a host won't render, for the builder's summary of where the UI runs. */
|
|
29
|
+
export declare function unsupportedItems(schema: UISchema, host: UIHost): LayoutItem[];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Which elements of a schema each host renders. Worked out from the schema on every read and
|
|
2
|
+
// never stored in it: a stored copy goes stale the way a saved paramType does. Making an element
|
|
3
|
+
// work on Selva later is a change to SUPPORT, with no schema change and no migration.
|
|
4
|
+
import { getGroups } from '@selvajs/schemas';
|
|
5
|
+
const SUPPORT = {
|
|
6
|
+
value: ['rhino', 'selva'],
|
|
7
|
+
geometry: ['rhino'],
|
|
8
|
+
trigger: ['rhino'],
|
|
9
|
+
unknown: []
|
|
10
|
+
};
|
|
11
|
+
export const HOST_LABELS = { rhino: 'Rhino', selva: 'Selva' };
|
|
12
|
+
const GEOMETRY_PARAM_TYPES = new Set(['geometry', 'point', 'line', 'plane']);
|
|
13
|
+
// Keyed by the schema's own widget unions, so a widget added to the schema fails to compile here
|
|
14
|
+
// until someone decides which hosts render it.
|
|
15
|
+
const INPUT_WIDGETS = {
|
|
16
|
+
number: true,
|
|
17
|
+
text: true,
|
|
18
|
+
dropdown: true,
|
|
19
|
+
dynamicValueList: true,
|
|
20
|
+
checkbox: true,
|
|
21
|
+
file: true,
|
|
22
|
+
color: true
|
|
23
|
+
};
|
|
24
|
+
const OUTPUT_WIDGETS = {
|
|
25
|
+
text: true,
|
|
26
|
+
number: true,
|
|
27
|
+
file: true,
|
|
28
|
+
chart: true,
|
|
29
|
+
image: true,
|
|
30
|
+
dynamicValueList: true
|
|
31
|
+
};
|
|
32
|
+
const KNOWN_WIDGETS = {
|
|
33
|
+
input: new Set(Object.keys(INPUT_WIDGETS)),
|
|
34
|
+
output: new Set(Object.keys(OUTPUT_WIDGETS))
|
|
35
|
+
};
|
|
36
|
+
/** The control comes from this, whatever the saved widgetType says: saved ones hold `text`. */
|
|
37
|
+
export function isGeometryParamType(paramType) {
|
|
38
|
+
return paramType !== undefined && GEOMETRY_PARAM_TYPES.has(paramType);
|
|
39
|
+
}
|
|
40
|
+
export function isTriggerItem(item) {
|
|
41
|
+
return (item.type === 'input' &&
|
|
42
|
+
item.widgetType === 'checkbox' &&
|
|
43
|
+
item.config?.displayAs === 'button');
|
|
44
|
+
}
|
|
45
|
+
export function layoutItemKind(item, inputs) {
|
|
46
|
+
if (item.type === 'linebreak')
|
|
47
|
+
return 'value';
|
|
48
|
+
if (item.type !== 'input' && item.type !== 'output')
|
|
49
|
+
return 'unknown';
|
|
50
|
+
if (item.type === 'input') {
|
|
51
|
+
const paramType = inputs.find((i) => i.id === item.paramId)?.paramType;
|
|
52
|
+
if (isGeometryParamType(paramType))
|
|
53
|
+
return 'geometry';
|
|
54
|
+
}
|
|
55
|
+
if (!KNOWN_WIDGETS[item.type].has(item.widgetType))
|
|
56
|
+
return 'unknown';
|
|
57
|
+
return isTriggerItem(item) ? 'trigger' : 'value';
|
|
58
|
+
}
|
|
59
|
+
export function hostsFor(kind) {
|
|
60
|
+
return SUPPORT[kind];
|
|
61
|
+
}
|
|
62
|
+
export function isSupportedOn(host, kind) {
|
|
63
|
+
return SUPPORT[kind].includes(host);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Inputs the form keeps no value for: geometry lives on the Grasshopper param after a pick, and a
|
|
67
|
+
* button only sends a press. Value updates and presets skip them; holding a button's `true` would
|
|
68
|
+
* fire its action again on every solve.
|
|
69
|
+
*/
|
|
70
|
+
export function isValuelessInput(item, input) {
|
|
71
|
+
return isGeometryParamType(input?.paramType) || isTriggerItem(item);
|
|
72
|
+
}
|
|
73
|
+
export function valuelessInputIds(schema) {
|
|
74
|
+
const ids = new Set();
|
|
75
|
+
for (const input of schema.inputs) {
|
|
76
|
+
if (isGeometryParamType(input.paramType))
|
|
77
|
+
ids.add(input.id);
|
|
78
|
+
}
|
|
79
|
+
for (const group of getGroups(schema)) {
|
|
80
|
+
for (const item of group.items ?? []) {
|
|
81
|
+
if (isTriggerItem(item))
|
|
82
|
+
ids.add(item.paramId);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return ids;
|
|
86
|
+
}
|
|
87
|
+
/** The placed items a host won't render, for the builder's summary of where the UI runs. */
|
|
88
|
+
export function unsupportedItems(schema, host) {
|
|
89
|
+
const items = [];
|
|
90
|
+
for (const group of getGroups(schema)) {
|
|
91
|
+
for (const item of group.items ?? []) {
|
|
92
|
+
if (!isSupportedOn(host, layoutItemKind(item, schema.inputs)))
|
|
93
|
+
items.push(item);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return items;
|
|
97
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DropdownWidgetConfig, OptionMedia, UISchema } from '@selvajs/schemas';
|
|
2
|
+
export type OptionDisplay = NonNullable<DropdownWidgetConfig['displayAs']>;
|
|
3
|
+
export declare function resolveOptionDisplay(displayAs: string | undefined, optionCount: number): OptionDisplay;
|
|
4
|
+
export type GlyphSource = {
|
|
5
|
+
kind: 'icon';
|
|
6
|
+
d: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'image';
|
|
9
|
+
src: string;
|
|
10
|
+
};
|
|
11
|
+
/** What to draw beside an option: its thumbnail, else its icon. */
|
|
12
|
+
export declare function optionGlyph(media: OptionMedia | undefined, assets: UISchema['assets'] | undefined): GlyphSource | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Past this a button row no longer fits a panel column. A computed list can grow past it at
|
|
2
|
+
// runtime, so the row turns back into a dropdown instead of wrapping.
|
|
3
|
+
const MAX_SEGMENTED_OPTIONS = 6;
|
|
4
|
+
export function resolveOptionDisplay(displayAs, optionCount) {
|
|
5
|
+
switch (displayAs) {
|
|
6
|
+
case 'checklist':
|
|
7
|
+
case 'tiles':
|
|
8
|
+
return displayAs;
|
|
9
|
+
case 'segmented':
|
|
10
|
+
return optionCount <= MAX_SEGMENTED_OPTIONS ? 'segmented' : 'dropdown';
|
|
11
|
+
default:
|
|
12
|
+
return 'dropdown';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
// The schema can come from any .gh, so an image reaches <img> only as an inline raster data URI.
|
|
16
|
+
// Anything else could be a URL that makes every viewer's browser call wherever the file points.
|
|
17
|
+
const RASTER_DATA_URI = /^data:image\/(webp|jpeg|png);base64,[A-Za-z0-9+/=]+$/;
|
|
18
|
+
/** What to draw beside an option: its thumbnail, else its icon. */
|
|
19
|
+
export function optionGlyph(media, assets) {
|
|
20
|
+
if (!media || !assets)
|
|
21
|
+
return undefined;
|
|
22
|
+
if (media.image) {
|
|
23
|
+
const src = assets[media.image]?.img;
|
|
24
|
+
if (src && RASTER_DATA_URI.test(src))
|
|
25
|
+
return { kind: 'image', src };
|
|
26
|
+
}
|
|
27
|
+
const d = media.icon ? assets[media.icon]?.d : undefined;
|
|
28
|
+
return d ? { kind: 'icon', d } : undefined;
|
|
29
|
+
}
|
|
@@ -14,6 +14,8 @@ export declare function validateSavedState(savedState: ParameterPreset, currentS
|
|
|
14
14
|
* Params the current schema no longer has are dropped. That's the same condition
|
|
15
15
|
* `validateSavedState` flags as an error, but the rule is re-derived from the schema here
|
|
16
16
|
* rather than read back off the issue list — nothing couples to how sentinel ids are encoded.
|
|
17
|
+
* Valueless inputs are dropped too: a preset saved before an input became a button or a
|
|
18
|
+
* geometry input still holds a value for it.
|
|
17
19
|
*/
|
|
18
20
|
export declare function extractLoadableValues(savedState: ParameterPreset, currentSchema: UISchema): Record<string, unknown>;
|
|
19
21
|
export interface PresetLoadResult {
|
|
@@ -28,5 +30,6 @@ export interface PresetLoadResult {
|
|
|
28
30
|
}
|
|
29
31
|
/** Validates and computes the loadable values in one pass, so callers thread one object. */
|
|
30
32
|
export declare function loadPreset(savedState: ParameterPreset, currentSchema: UISchema): PresetLoadResult;
|
|
31
|
-
|
|
33
|
+
/** Resolves false when the user cancelled the save. */
|
|
34
|
+
export declare function exportStateAsJson(savedState: ParameterPreset): Promise<boolean>;
|
|
32
35
|
export declare function importStateFromJson(file: File): Promise<ParameterPreset>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { randomId } from '../utils/randomId';
|
|
2
|
+
import { saveBlob } from '../utils/host-files';
|
|
2
3
|
import { getGroups } from '@selvajs/schemas';
|
|
4
|
+
import { isValuelessInput, valuelessInputIds } from './host-support';
|
|
3
5
|
export function createSavedState(schema, currentValues, metadata) {
|
|
4
6
|
const parameters = [];
|
|
5
7
|
for (const group of getGroups(schema)) {
|
|
@@ -8,6 +10,8 @@ export function createSavedState(schema, currentValues, metadata) {
|
|
|
8
10
|
continue;
|
|
9
11
|
const value = currentValues[item.paramId];
|
|
10
12
|
const inputDef = schema.inputs.find((i) => i.id === item.paramId);
|
|
13
|
+
if (isValuelessInput(item, inputDef))
|
|
14
|
+
continue;
|
|
11
15
|
if (value !== undefined && inputDef) {
|
|
12
16
|
parameters.push({
|
|
13
17
|
paramId: item.paramId,
|
|
@@ -78,12 +82,15 @@ export function validateSavedState(savedState, currentSchema) {
|
|
|
78
82
|
* Params the current schema no longer has are dropped. That's the same condition
|
|
79
83
|
* `validateSavedState` flags as an error, but the rule is re-derived from the schema here
|
|
80
84
|
* rather than read back off the issue list — nothing couples to how sentinel ids are encoded.
|
|
85
|
+
* Valueless inputs are dropped too: a preset saved before an input became a button or a
|
|
86
|
+
* geometry input still holds a value for it.
|
|
81
87
|
*/
|
|
82
88
|
export function extractLoadableValues(savedState, currentSchema) {
|
|
83
89
|
const values = {};
|
|
90
|
+
const valueless = valuelessInputIds(currentSchema);
|
|
84
91
|
for (const paramState of savedState.parameters) {
|
|
85
92
|
const exists = currentSchema.inputs.some((i) => i.id === paramState.paramId);
|
|
86
|
-
if (exists) {
|
|
93
|
+
if (exists && !valueless.has(paramState.paramId)) {
|
|
87
94
|
values[paramState.paramId] = paramState.value;
|
|
88
95
|
}
|
|
89
96
|
}
|
|
@@ -99,17 +106,14 @@ export function loadPreset(savedState, currentSchema) {
|
|
|
99
106
|
canLoad: validation.canLoad
|
|
100
107
|
};
|
|
101
108
|
}
|
|
109
|
+
/** Resolves false when the user cancelled the save. */
|
|
102
110
|
export function exportStateAsJson(savedState) {
|
|
103
111
|
const blob = new Blob([JSON.stringify(savedState, null, 2)], { type: 'application/json' });
|
|
104
112
|
const safeName = savedState.name.replace(/[^a-z0-9]/gi, '_');
|
|
105
113
|
const date = savedState.timestamp.split('T')[0].replace(/-/g, '_');
|
|
106
|
-
const link = document.createElement('a');
|
|
107
|
-
link.href = URL.createObjectURL(blob);
|
|
108
114
|
// .slvp = Selva parameter preset. Import still accepts the pre-rename .sps — same JSON,
|
|
109
115
|
// only the writer's extension changed.
|
|
110
|
-
|
|
111
|
-
link.click();
|
|
112
|
-
URL.revokeObjectURL(link.href);
|
|
116
|
+
return saveBlob(blob, `${safeName}_${date}.slvp`);
|
|
113
117
|
}
|
|
114
118
|
export async function importStateFromJson(file) {
|
|
115
119
|
const state = JSON.parse(await file.text());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LayoutItem, VisibilityRule, VisibilityCondition, GroupVisibilityCondition, TabConfig } from '@selvajs/schemas';
|
|
1
|
+
import type { InputLayoutItem, LayoutItem, VisibilityRule, VisibilityCondition, GroupVisibilityCondition, TabConfig, UISchema } from '@selvajs/schemas';
|
|
2
2
|
export interface VisibilityResult {
|
|
3
3
|
visible: boolean;
|
|
4
4
|
disabled: boolean;
|
|
@@ -20,6 +20,12 @@ export declare function evaluateGroupVisibility(group: {
|
|
|
20
20
|
items?: LayoutItem[];
|
|
21
21
|
}, values: Record<string, unknown>): boolean;
|
|
22
22
|
export declare function isTabVisible(tab: TabConfig, values: Record<string, unknown>): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The input items the form shows for these values: each passes its own condition, inside a
|
|
25
|
+
* shown group and, when tabbed, a shown tab. For a host that repeats the form back, such as a
|
|
26
|
+
* summary before a commit, without re-deriving the renderer's rules.
|
|
27
|
+
*/
|
|
28
|
+
export declare function visibleInputItems(schema: UISchema, values: Record<string, unknown>): InputLayoutItem[];
|
|
23
29
|
/**
|
|
24
30
|
* A linebreak is always "visible" but renders as a divider only, so a group left with
|
|
25
31
|
* nothing but separators counts as empty.
|
|
@@ -106,6 +106,23 @@ export function evaluateGroupVisibility(group, values) {
|
|
|
106
106
|
export function isTabVisible(tab, values) {
|
|
107
107
|
return (tab.visible !== false && tab.groups.some((group) => evaluateGroupVisibility(group, values)));
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* The input items the form shows for these values: each passes its own condition, inside a
|
|
111
|
+
* shown group and, when tabbed, a shown tab. For a host that repeats the form back, such as a
|
|
112
|
+
* summary before a commit, without re-deriving the renderer's rules.
|
|
113
|
+
*/
|
|
114
|
+
export function visibleInputItems(schema, values) {
|
|
115
|
+
const layout = schema?.layout;
|
|
116
|
+
const groups = layout?.type === 'tabbed'
|
|
117
|
+
? (layout.tabs ?? []).filter((t) => isTabVisible(t, values)).flatMap((t) => t.groups ?? [])
|
|
118
|
+
: layout?.type === 'flat'
|
|
119
|
+
? (layout.groups ?? [])
|
|
120
|
+
: [];
|
|
121
|
+
return groups
|
|
122
|
+
.filter((g) => evaluateGroupVisibility(g, values))
|
|
123
|
+
.flatMap((g) => g.items ?? [])
|
|
124
|
+
.filter((i) => i.type === 'input' && evaluateVisibility(i, values).visible);
|
|
125
|
+
}
|
|
109
126
|
/**
|
|
110
127
|
* A linebreak is always "visible" but renders as a divider only, so a group left with
|
|
111
128
|
* nothing but separators counts as empty.
|
package/dist/styles/base.css
CHANGED
|
@@ -1,77 +1,95 @@
|
|
|
1
|
+
@import '@fontsource-variable/hanken-grotesk';
|
|
2
|
+
|
|
1
3
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
2
4
|
|
|
5
|
+
/* Surfaces, edges and states share one set of names in both modes; each mode only changes the
|
|
6
|
+
values. Ratios are WCAG 2.x. The roles and when to use each: docs/contributing/design-system.md. */
|
|
3
7
|
:root {
|
|
4
|
-
--radius: 0.625rem;
|
|
5
8
|
--header-h: 3.5rem;
|
|
9
|
+
--below-header-h: calc(100svh - var(--header-h));
|
|
6
10
|
--page-px: 1rem;
|
|
7
11
|
--page-py: 1.75rem;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
--
|
|
12
|
-
--
|
|
13
|
-
--
|
|
14
|
-
|
|
15
|
-
--
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
--
|
|
12
|
+
/* Canvas, then surface (cards, panels), then raised (rows, menus, popovers). Light can't go
|
|
13
|
+
lighter than white, so raised is white too and lifts with a border and a shadow instead.
|
|
14
|
+
Values follow stock shadcn neutral. */
|
|
15
|
+
--background: oklch(0.985 0 0);
|
|
16
|
+
--card: oklch(1 0 0);
|
|
17
|
+
--raised: oklch(1 0 0);
|
|
18
|
+
/* Recessed fill for trays, table heads, code and skeletons: darker than the surface around it. */
|
|
19
|
+
--muted: oklch(0.97 0 0);
|
|
20
|
+
/* Fill of anything you type into, on a card: recessed, the same step as muted, in both modes.
|
|
21
|
+
The edge (`--input`) carries the boundary. */
|
|
22
|
+
--field: var(--muted);
|
|
23
|
+
--foreground: oklch(0.145 0 0);
|
|
24
|
+
--card-foreground: oklch(0.145 0 0);
|
|
25
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
26
|
+
/* 4.5:1 on every surface. */
|
|
19
27
|
--muted-foreground: oklch(0.5 0 0);
|
|
20
|
-
|
|
21
|
-
--
|
|
22
|
-
/*
|
|
23
|
-
--
|
|
24
|
-
--
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
--
|
|
30
|
-
|
|
28
|
+
/* Icons, placeholders, disabled text: 3:1 on every surface. */
|
|
29
|
+
--faint-foreground: oklch(0.6 0 0);
|
|
30
|
+
/* State overlays, laid over whatever surface is underneath. */
|
|
31
|
+
--hover: oklch(0 0 0 / 4%);
|
|
32
|
+
--selected: oklch(0 0 0 / 8%);
|
|
33
|
+
/* Rest fill of a neutral filled control; its hover is `selected`. */
|
|
34
|
+
--secondary: oklch(0.97 0 0);
|
|
35
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
36
|
+
/* Outlines and separators. */
|
|
37
|
+
--border: oklch(0 0 0 / 8%);
|
|
38
|
+
/* Popovers, outline buttons, dashed drop zones. */
|
|
39
|
+
--border-strong: oklch(0 0 0 / 14%);
|
|
40
|
+
/* Edge of anything you type into or toggle, slider tracks included. Softer than the 3:1 WCAG
|
|
41
|
+
boundary minimum in both modes: the recessed field fill carries the rest of the boundary. */
|
|
42
|
+
--input: oklch(0 0 0 / 10%);
|
|
43
|
+
--ring: oklch(0.708 0 0);
|
|
44
|
+
--elevation-raised: 0 1px 2px oklch(0 0 0 / 5%);
|
|
45
|
+
--elevation-popover: 0 8px 24px oklch(0 0 0 / 10%);
|
|
46
|
+
/* 4.5:1 as text on a card and under its foreground; 3:1 as a fill on every surface. */
|
|
47
|
+
--primary: oklch(0.205 0 0);
|
|
48
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
49
|
+
--destructive: #c9302d;
|
|
50
|
+
--destructive-foreground: #fbfbfb;
|
|
51
|
+
/* 3:1 on every surface, as icons and dots. */
|
|
52
|
+
--success: #51a556;
|
|
31
53
|
--success-foreground: oklch(0.99 0 0);
|
|
32
|
-
--warning:
|
|
54
|
+
--warning: #bd8630;
|
|
33
55
|
--warning-foreground: oklch(0.25 0.04 75);
|
|
34
|
-
--info:
|
|
56
|
+
--info: #5399d1;
|
|
35
57
|
--info-foreground: oklch(0.99 0 0);
|
|
36
58
|
--chart-1: oklch(0.65 0.14 135);
|
|
37
59
|
--chart-2: oklch(0.7 0.11 200);
|
|
38
60
|
--chart-3: oklch(0.6 0.13 260);
|
|
39
61
|
--chart-4: oklch(0.78 0.13 80);
|
|
40
62
|
--chart-5: oklch(0.68 0.15 30);
|
|
41
|
-
--sidebar: oklch(0.96 0 0);
|
|
42
|
-
--sidebar-foreground: oklch(0.25 0 0);
|
|
43
|
-
--sidebar-primary: oklch(0.57 0.07 135);
|
|
44
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
45
|
-
--sidebar-accent: oklch(0.93 0 0);
|
|
46
|
-
--sidebar-accent-foreground: oklch(0.3 0 0);
|
|
47
|
-
--sidebar-border: oklch(0.88 0 0);
|
|
48
|
-
--sidebar-ring: oklch(0.55 0 0);
|
|
49
|
-
--inputparam: oklch(1 0 0);
|
|
50
|
-
--outputparam: oklch(1 0 0);
|
|
51
63
|
/* Scrim behind modal dialogs and drawers. */
|
|
52
64
|
--overlay: oklch(0 0 0 / 50%);
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
.dark {
|
|
56
|
-
--background: oklch(0.
|
|
57
|
-
--
|
|
58
|
-
--
|
|
59
|
-
--
|
|
60
|
-
--
|
|
61
|
-
--
|
|
62
|
-
--
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
--
|
|
66
|
-
--
|
|
67
|
-
--
|
|
68
|
-
--
|
|
69
|
-
--
|
|
68
|
+
--background: oklch(0.145 0 0);
|
|
69
|
+
--card: oklch(0.205 0 0);
|
|
70
|
+
--raised: oklch(0.24 0 0);
|
|
71
|
+
--muted: oklch(0.269 0 0);
|
|
72
|
+
--foreground: oklch(0.985 0 0);
|
|
73
|
+
--card-foreground: oklch(0.985 0 0);
|
|
74
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
75
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
76
|
+
--faint-foreground: oklch(0.556 0 0);
|
|
77
|
+
--hover: oklch(1 0 0 / 6%);
|
|
78
|
+
--selected: oklch(1 0 0 / 10%);
|
|
79
|
+
--secondary: oklch(0.269 0 0);
|
|
80
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
81
|
+
--border: oklch(1 0 0 / 10%);
|
|
82
|
+
--border-strong: oklch(1 0 0 / 18%);
|
|
83
|
+
--input: oklch(1 0 0 / 15%);
|
|
84
|
+
--ring: oklch(0.556 0 0);
|
|
85
|
+
/* Shadows barely show on a dark canvas, so raised things lean on the border instead. */
|
|
86
|
+
--elevation-raised: none;
|
|
87
|
+
--elevation-popover: 0 8px 24px oklch(0 0 0 / 50%);
|
|
88
|
+
--primary: oklch(0.922 0 0);
|
|
89
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
90
|
+
/* White text can't reach 4.5:1 on a red light enough to also be text on the dark card. */
|
|
70
91
|
--destructive: oklch(0.7 0.17 22);
|
|
71
|
-
--destructive-foreground: oklch(0.
|
|
72
|
-
--border: oklch(1 0 0 / 14%);
|
|
73
|
-
--input: oklch(1 0 0 / 36%);
|
|
74
|
-
--ring: oklch(0.74 0 0);
|
|
92
|
+
--destructive-foreground: oklch(0.18 0 0);
|
|
75
93
|
--success: oklch(0.74 0.15 145);
|
|
76
94
|
--success-foreground: oklch(0.18 0.03 145);
|
|
77
95
|
--warning: oklch(0.8 0.14 75);
|
|
@@ -83,41 +101,39 @@
|
|
|
83
101
|
--chart-3: oklch(0.68 0.14 260);
|
|
84
102
|
--chart-4: oklch(0.78 0.14 80);
|
|
85
103
|
--chart-5: oklch(0.7 0.16 30);
|
|
86
|
-
--sidebar: oklch(0.21 0 0);
|
|
87
|
-
--sidebar-foreground: oklch(0.96 0 0);
|
|
88
|
-
--sidebar-primary: oklch(0.74 0.07 135);
|
|
89
|
-
--sidebar-primary-foreground: oklch(0.18 0 0);
|
|
90
|
-
--sidebar-accent: oklch(0.32 0 0);
|
|
91
|
-
--sidebar-accent-foreground: oklch(0.92 0 0);
|
|
92
|
-
--sidebar-border: oklch(1 0 0 / 10%);
|
|
93
|
-
--sidebar-ring: oklch(0.74 0 0);
|
|
94
|
-
--inputparam: oklch(0.15 0 0);
|
|
95
|
-
--outputparam: oklch(0.25 0 0);
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
@theme inline {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
--radius-
|
|
107
|
+
/* Concentric: an item inside a padded container takes the container's radius minus the
|
|
108
|
+
padding. A 12px menu with 4px padding holds 8px items; a 10px control with 2px padding
|
|
109
|
+
holds 8px segments. */
|
|
110
|
+
--radius-sm: 6px;
|
|
111
|
+
--radius-inner: 8px;
|
|
112
|
+
--radius-md: 10px;
|
|
113
|
+
--radius-lg: 12px;
|
|
114
|
+
--radius-xl: 16px;
|
|
103
115
|
--color-background: var(--background);
|
|
104
116
|
--color-foreground: var(--foreground);
|
|
105
117
|
--color-card: var(--card);
|
|
106
118
|
--color-card-foreground: var(--card-foreground);
|
|
107
|
-
--color-
|
|
119
|
+
--color-raised: var(--raised);
|
|
120
|
+
--color-popover: var(--raised);
|
|
108
121
|
--color-popover-foreground: var(--popover-foreground);
|
|
109
|
-
--color-
|
|
110
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
111
|
-
--color-secondary: var(--secondary);
|
|
112
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
122
|
+
--color-field: var(--field);
|
|
113
123
|
--color-muted: var(--muted);
|
|
114
124
|
--color-muted-foreground: var(--muted-foreground);
|
|
115
|
-
--color-
|
|
116
|
-
--color-
|
|
125
|
+
--color-faint-foreground: var(--faint-foreground);
|
|
126
|
+
--color-hover: var(--hover);
|
|
127
|
+
--color-selected: var(--selected);
|
|
128
|
+
--color-secondary: var(--secondary);
|
|
129
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
130
|
+
--color-primary: var(--primary);
|
|
131
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
117
132
|
--color-destructive: var(--destructive);
|
|
118
133
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
119
134
|
--color-overlay: var(--overlay);
|
|
120
135
|
--color-border: var(--border);
|
|
136
|
+
--color-border-strong: var(--border-strong);
|
|
121
137
|
--color-input: var(--input);
|
|
122
138
|
--color-ring: var(--ring);
|
|
123
139
|
--color-success: var(--success);
|
|
@@ -131,21 +147,15 @@
|
|
|
131
147
|
--color-chart-3: var(--chart-3);
|
|
132
148
|
--color-chart-4: var(--chart-4);
|
|
133
149
|
--color-chart-5: var(--chart-5);
|
|
134
|
-
--
|
|
135
|
-
--
|
|
136
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
137
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
138
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
139
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
140
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
141
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
142
|
-
--color-inputparam: var(--inputparam);
|
|
143
|
-
--color-outputparam: var(--outputparam);
|
|
150
|
+
--shadow-raised: var(--elevation-raised);
|
|
151
|
+
--shadow-popover: var(--elevation-popover);
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
/* Design tokens beyond Tailwind's defaults. Reach for these before an arbitrary value: the
|
|
147
155
|
design-system lint rejects `text-[10px]`, `max-h-[85dvh]` and the like. */
|
|
148
156
|
@theme {
|
|
157
|
+
/* Hanken Grotesk (OFL), self-hosted via Fontsource: the plugin UI runs offline from the .gha. */
|
|
158
|
+
--font-sans: 'Hanken Grotesk Variable', ui-sans-serif, system-ui, sans-serif;
|
|
149
159
|
/* Type tags, counters and other dense labels. */
|
|
150
160
|
--text-2xs: 0.625rem;
|
|
151
161
|
--text-2xs--line-height: calc(0.875 / 0.625);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface Rgb {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
}
|
|
6
|
+
/** h in [0, 360), s and v in [0, 1]. */
|
|
7
|
+
export interface Hsv {
|
|
8
|
+
h: number;
|
|
9
|
+
s: number;
|
|
10
|
+
v: number;
|
|
11
|
+
}
|
|
12
|
+
/** Accepts `#rgb`, `#rrggbb` and the same without `#`. Returns lowercase `#rrggbb`, or null. */
|
|
13
|
+
export declare function normalizeHex(input: string): string | null;
|
|
14
|
+
export declare function hexToRgb(hex: string): Rgb | null;
|
|
15
|
+
export declare function rgbToHex({ r, g, b }: Rgb): string;
|
|
16
|
+
export declare function rgbToHsv({ r, g, b }: Rgb): Hsv;
|
|
17
|
+
export declare function hsvToRgb({ h, s, v }: Hsv): Rgb;
|
|
18
|
+
export declare const hexToHsv: (hex: string) => Hsv | null;
|
|
19
|
+
export declare const hsvToHex: (hsv: Hsv) => string;
|
|
20
|
+
/** WCAG contrast ratio between two hex colors, 1 to 21. Null if either isn't a hex color. */
|
|
21
|
+
export declare function contrastRatio(a: string, b: string): number | null;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
2
|
+
/** Accepts `#rgb`, `#rrggbb` and the same without `#`. Returns lowercase `#rrggbb`, or null. */
|
|
3
|
+
export function normalizeHex(input) {
|
|
4
|
+
const raw = input.trim().replace(/^#/, '');
|
|
5
|
+
if (/^[0-9a-f]{3}$/i.test(raw)) {
|
|
6
|
+
return `#${raw
|
|
7
|
+
.split('')
|
|
8
|
+
.map((c) => c + c)
|
|
9
|
+
.join('')
|
|
10
|
+
.toLowerCase()}`;
|
|
11
|
+
}
|
|
12
|
+
if (/^[0-9a-f]{6}$/i.test(raw))
|
|
13
|
+
return `#${raw.toLowerCase()}`;
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
export function hexToRgb(hex) {
|
|
17
|
+
const normalized = normalizeHex(hex);
|
|
18
|
+
if (!normalized)
|
|
19
|
+
return null;
|
|
20
|
+
return {
|
|
21
|
+
r: parseInt(normalized.slice(1, 3), 16),
|
|
22
|
+
g: parseInt(normalized.slice(3, 5), 16),
|
|
23
|
+
b: parseInt(normalized.slice(5, 7), 16)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function rgbToHex({ r, g, b }) {
|
|
27
|
+
const channel = (n) => clamp(Math.round(n), 0, 255).toString(16).padStart(2, '0');
|
|
28
|
+
return `#${channel(r)}${channel(g)}${channel(b)}`;
|
|
29
|
+
}
|
|
30
|
+
export function rgbToHsv({ r, g, b }) {
|
|
31
|
+
const rn = r / 255;
|
|
32
|
+
const gn = g / 255;
|
|
33
|
+
const bn = b / 255;
|
|
34
|
+
const max = Math.max(rn, gn, bn);
|
|
35
|
+
const delta = max - Math.min(rn, gn, bn);
|
|
36
|
+
let h = 0;
|
|
37
|
+
if (delta !== 0) {
|
|
38
|
+
if (max === rn)
|
|
39
|
+
h = ((gn - bn) / delta) % 6;
|
|
40
|
+
else if (max === gn)
|
|
41
|
+
h = (bn - rn) / delta + 2;
|
|
42
|
+
else
|
|
43
|
+
h = (rn - gn) / delta + 4;
|
|
44
|
+
h *= 60;
|
|
45
|
+
if (h < 0)
|
|
46
|
+
h += 360;
|
|
47
|
+
}
|
|
48
|
+
return { h, s: max === 0 ? 0 : delta / max, v: max };
|
|
49
|
+
}
|
|
50
|
+
export function hsvToRgb({ h, s, v }) {
|
|
51
|
+
const c = v * s;
|
|
52
|
+
const hp = (((h % 360) + 360) % 360) / 60;
|
|
53
|
+
const x = c * (1 - Math.abs((hp % 2) - 1));
|
|
54
|
+
const [r1, g1, b1] = hp < 1
|
|
55
|
+
? [c, x, 0]
|
|
56
|
+
: hp < 2
|
|
57
|
+
? [x, c, 0]
|
|
58
|
+
: hp < 3
|
|
59
|
+
? [0, c, x]
|
|
60
|
+
: hp < 4
|
|
61
|
+
? [0, x, c]
|
|
62
|
+
: hp < 5
|
|
63
|
+
? [x, 0, c]
|
|
64
|
+
: [c, 0, x];
|
|
65
|
+
const m = v - c;
|
|
66
|
+
return { r: (r1 + m) * 255, g: (g1 + m) * 255, b: (b1 + m) * 255 };
|
|
67
|
+
}
|
|
68
|
+
export const hexToHsv = (hex) => {
|
|
69
|
+
const rgb = hexToRgb(hex);
|
|
70
|
+
return rgb ? rgbToHsv(rgb) : null;
|
|
71
|
+
};
|
|
72
|
+
export const hsvToHex = (hsv) => rgbToHex(hsvToRgb(hsv));
|
|
73
|
+
/** WCAG relative luminance of an sRGB color. */
|
|
74
|
+
function luminance({ r, g, b }) {
|
|
75
|
+
const lin = (c) => {
|
|
76
|
+
const n = c / 255;
|
|
77
|
+
return n <= 0.04045 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4);
|
|
78
|
+
};
|
|
79
|
+
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
|
|
80
|
+
}
|
|
81
|
+
/** WCAG contrast ratio between two hex colors, 1 to 21. Null if either isn't a hex color. */
|
|
82
|
+
export function contrastRatio(a, b) {
|
|
83
|
+
const ra = hexToRgb(a);
|
|
84
|
+
const rb = hexToRgb(b);
|
|
85
|
+
if (!ra || !rb)
|
|
86
|
+
return null;
|
|
87
|
+
const la = luminance(ra);
|
|
88
|
+
const lb = luminance(rb);
|
|
89
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
90
|
+
}
|