@sewadah/selaras 0.1.1 → 0.3.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 +67 -20
- package/dist/module.d.mts +10 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +123 -36
- package/dist/runtime/components/Accordion.d.vue.ts +3 -0
- package/dist/runtime/components/Accordion.vue +5 -1
- package/dist/runtime/components/Accordion.vue.d.ts +3 -0
- package/dist/runtime/components/Alert.d.vue.ts +2 -1
- package/dist/runtime/components/Alert.vue +6 -3
- package/dist/runtime/components/Alert.vue.d.ts +2 -1
- package/dist/runtime/components/AlertDialog.d.vue.ts +2 -0
- package/dist/runtime/components/AlertDialog.vue +21 -8
- package/dist/runtime/components/AlertDialog.vue.d.ts +2 -0
- package/dist/runtime/components/App.vue +9 -2
- package/dist/runtime/components/Autocomplete.d.vue.ts +22 -58
- package/dist/runtime/components/Autocomplete.vue +50 -11
- package/dist/runtime/components/Autocomplete.vue.d.ts +22 -58
- package/dist/runtime/components/Avatar.d.vue.ts +2 -1
- package/dist/runtime/components/Avatar.vue +4 -2
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/Badge.d.vue.ts +3 -2
- package/dist/runtime/components/Badge.vue +8 -5
- package/dist/runtime/components/Badge.vue.d.ts +3 -2
- package/dist/runtime/components/Breadcrumb.d.vue.ts +3 -0
- package/dist/runtime/components/Breadcrumb.vue +5 -2
- package/dist/runtime/components/Breadcrumb.vue.d.ts +3 -0
- package/dist/runtime/components/Button.d.vue.ts +5 -2
- package/dist/runtime/components/Button.vue +5 -2
- package/dist/runtime/components/Button.vue.d.ts +5 -2
- package/dist/runtime/components/Checkbox.d.vue.ts +2 -1
- package/dist/runtime/components/Checkbox.vue +4 -2
- package/dist/runtime/components/Checkbox.vue.d.ts +2 -1
- package/dist/runtime/components/Chip.d.vue.ts +2 -1
- package/dist/runtime/components/Chip.vue +4 -2
- package/dist/runtime/components/Chip.vue.d.ts +2 -1
- package/dist/runtime/components/Collapsible.d.vue.ts +3 -0
- package/dist/runtime/components/Collapsible.vue +11 -6
- package/dist/runtime/components/Collapsible.vue.d.ts +3 -0
- package/dist/runtime/components/ColorPicker.d.vue.ts +13 -3
- package/dist/runtime/components/ColorPicker.vue +60 -14
- package/dist/runtime/components/ColorPicker.vue.d.ts +13 -3
- package/dist/runtime/components/Column.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue +18 -16
- package/dist/runtime/components/ContentNavigation.d.vue.ts +3 -0
- package/dist/runtime/components/ContentNavigation.vue +6 -3
- package/dist/runtime/components/ContentNavigation.vue.d.ts +3 -0
- package/dist/runtime/components/ContentSurround.d.vue.ts +3 -0
- package/dist/runtime/components/ContentSurround.vue +7 -4
- package/dist/runtime/components/ContentSurround.vue.d.ts +3 -0
- package/dist/runtime/components/ContentToc.d.vue.ts +3 -0
- package/dist/runtime/components/ContentToc.vue +22 -12
- package/dist/runtime/components/ContentToc.vue.d.ts +3 -0
- package/dist/runtime/components/ContextMenu.vue +3 -2
- package/dist/runtime/components/DashboardSidebar.vue +1 -1
- package/dist/runtime/components/DashboardSidebarToggle.d.vue.ts +1 -0
- package/dist/runtime/components/DashboardSidebarToggle.vue +3 -1
- package/dist/runtime/components/DashboardSidebarToggle.vue.d.ts +1 -0
- package/dist/runtime/components/DatePicker.d.vue.ts +32 -23
- package/dist/runtime/components/DatePicker.vue +130 -60
- package/dist/runtime/components/DatePicker.vue.d.ts +32 -23
- package/dist/runtime/components/Drawer.d.vue.ts +2 -0
- package/dist/runtime/components/Drawer.vue +21 -8
- package/dist/runtime/components/Drawer.vue.d.ts +2 -0
- package/dist/runtime/components/DrawerRenderer.vue +28 -21
- package/dist/runtime/components/Dropdown.d.vue.ts +14 -4
- package/dist/runtime/components/Dropdown.vue +19 -4
- package/dist/runtime/components/Dropdown.vue.d.ts +14 -4
- package/dist/runtime/components/FileTree.d.vue.ts +3 -0
- package/dist/runtime/components/FileTree.vue +7 -3
- package/dist/runtime/components/FileTree.vue.d.ts +3 -0
- package/dist/runtime/components/FileUpload.d.vue.ts +2 -1
- package/dist/runtime/components/FileUpload.vue +75 -32
- package/dist/runtime/components/FileUpload.vue.d.ts +2 -1
- package/dist/runtime/components/FormField.d.vue.ts +2 -0
- package/dist/runtime/components/FormField.vue +12 -9
- package/dist/runtime/components/FormField.vue.d.ts +2 -0
- package/dist/runtime/components/Icon.d.vue.ts +2 -4
- package/dist/runtime/components/Icon.vue +7 -2
- package/dist/runtime/components/Icon.vue.d.ts +2 -4
- package/dist/runtime/components/Input.d.vue.ts +2 -1
- package/dist/runtime/components/Input.vue +12 -6
- package/dist/runtime/components/Input.vue.d.ts +2 -1
- package/dist/runtime/components/InputNumber.d.vue.ts +4 -1
- package/dist/runtime/components/InputNumber.vue +21 -8
- package/dist/runtime/components/InputNumber.vue.d.ts +4 -1
- package/dist/runtime/components/Modal.d.vue.ts +2 -0
- package/dist/runtime/components/Modal.vue +21 -8
- package/dist/runtime/components/Modal.vue.d.ts +2 -0
- package/dist/runtime/components/ModalRenderer.vue +23 -16
- package/dist/runtime/components/NavigationMenu.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenu.vue +8 -4
- package/dist/runtime/components/NavigationMenu.vue.d.ts +2 -4
- package/dist/runtime/components/NavigationMenuAccordionItem.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenuAccordionItem.vue +5 -3
- package/dist/runtime/components/NavigationMenuAccordionItem.vue.d.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutList.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutList.vue +7 -4
- package/dist/runtime/components/NavigationMenuFlyoutList.vue.d.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutTrigger.d.vue.ts +2 -4
- package/dist/runtime/components/NavigationMenuFlyoutTrigger.vue +9 -2
- package/dist/runtime/components/NavigationMenuFlyoutTrigger.vue.d.ts +2 -4
- package/dist/runtime/components/Pagination.d.vue.ts +3 -2
- package/dist/runtime/components/Pagination.vue.d.ts +3 -2
- package/dist/runtime/components/PinInput.d.vue.ts +2 -1
- package/dist/runtime/components/PinInput.vue +17 -6
- package/dist/runtime/components/PinInput.vue.d.ts +2 -1
- package/dist/runtime/components/Popover.d.vue.ts +2 -0
- package/dist/runtime/components/Popover.vue +14 -7
- package/dist/runtime/components/Popover.vue.d.ts +2 -0
- package/dist/runtime/components/Progress.d.vue.ts +2 -1
- package/dist/runtime/components/Progress.vue +6 -4
- package/dist/runtime/components/Progress.vue.d.ts +2 -1
- package/dist/runtime/components/ProseH1.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH1.vue +7 -4
- package/dist/runtime/components/ProseH1.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH2.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH2.vue +7 -4
- package/dist/runtime/components/ProseH2.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH3.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH3.vue +7 -4
- package/dist/runtime/components/ProseH3.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH4.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH4.vue +7 -4
- package/dist/runtime/components/ProseH4.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH5.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH5.vue +7 -4
- package/dist/runtime/components/ProseH5.vue.d.ts +2 -0
- package/dist/runtime/components/ProseH6.d.vue.ts +2 -0
- package/dist/runtime/components/ProseH6.vue +7 -4
- package/dist/runtime/components/ProseH6.vue.d.ts +2 -0
- package/dist/runtime/components/ProsePre.d.vue.ts +4 -2
- package/dist/runtime/components/ProsePre.vue +9 -3
- package/dist/runtime/components/ProsePre.vue.d.ts +4 -2
- package/dist/runtime/components/RadioGroup.d.vue.ts +2 -1
- package/dist/runtime/components/RadioGroup.vue +9 -5
- package/dist/runtime/components/RadioGroup.vue.d.ts +2 -1
- package/dist/runtime/components/Rating.d.vue.ts +2 -1
- package/dist/runtime/components/Rating.vue +4 -1
- package/dist/runtime/components/Rating.vue.d.ts +2 -1
- package/dist/runtime/components/ReadMore.d.vue.ts +3 -0
- package/dist/runtime/components/ReadMore.vue +24 -6
- package/dist/runtime/components/ReadMore.vue.d.ts +3 -0
- package/dist/runtime/components/Select.d.vue.ts +21 -57
- package/dist/runtime/components/Select.vue +58 -9
- package/dist/runtime/components/Select.vue.d.ts +21 -57
- package/dist/runtime/components/Separator.d.vue.ts +2 -1
- package/dist/runtime/components/Separator.vue +4 -2
- package/dist/runtime/components/Separator.vue.d.ts +2 -1
- package/dist/runtime/components/Slideover.d.vue.ts +2 -0
- package/dist/runtime/components/Slideover.vue +21 -8
- package/dist/runtime/components/Slideover.vue.d.ts +2 -0
- package/dist/runtime/components/SlideoverRenderer.vue +25 -18
- package/dist/runtime/components/Slider.d.vue.ts +2 -1
- package/dist/runtime/components/Slider.vue +4 -1
- package/dist/runtime/components/Slider.vue.d.ts +2 -1
- package/dist/runtime/components/SplitterResizeHandle.d.vue.ts +3 -0
- package/dist/runtime/components/SplitterResizeHandle.vue +5 -2
- package/dist/runtime/components/SplitterResizeHandle.vue.d.ts +3 -0
- package/dist/runtime/components/Stepper.d.vue.ts +2 -1
- package/dist/runtime/components/Stepper.vue +4 -1
- package/dist/runtime/components/Stepper.vue.d.ts +2 -1
- package/dist/runtime/components/Switch.d.vue.ts +2 -1
- package/dist/runtime/components/Switch.vue +4 -2
- package/dist/runtime/components/Switch.vue.d.ts +2 -1
- package/dist/runtime/components/Table.d.vue.ts +28 -80
- package/dist/runtime/components/Table.vue +25 -13
- package/dist/runtime/components/Table.vue.d.ts +28 -80
- package/dist/runtime/components/Tabs.d.vue.ts +3 -0
- package/dist/runtime/components/Tabs.vue +5 -1
- package/dist/runtime/components/Tabs.vue.d.ts +3 -0
- package/dist/runtime/components/Textarea.d.vue.ts +2 -1
- package/dist/runtime/components/Textarea.vue +11 -6
- package/dist/runtime/components/Textarea.vue.d.ts +2 -1
- package/dist/runtime/components/Theme.d.vue.ts +16 -5
- package/dist/runtime/components/Theme.vue +30 -5
- package/dist/runtime/components/Theme.vue.d.ts +16 -5
- package/dist/runtime/components/Toast.vue +11 -39
- package/dist/runtime/components/Toggle.d.vue.ts +2 -1
- package/dist/runtime/components/Toggle.vue +4 -1
- package/dist/runtime/components/Toggle.vue.d.ts +2 -1
- package/dist/runtime/components/ToggleGroup.d.vue.ts +2 -1
- package/dist/runtime/components/ToggleGroup.vue +4 -1
- package/dist/runtime/components/ToggleGroup.vue.d.ts +2 -1
- package/dist/runtime/components/Tooltip.vue +3 -2
- package/dist/runtime/components/Tree.d.vue.ts +5 -2
- package/dist/runtime/components/Tree.vue +5 -1
- package/dist/runtime/components/Tree.vue.d.ts +5 -2
- package/dist/runtime/composables/use-drawer.d.ts +1 -22
- package/dist/runtime/composables/use-drawer.js +12 -18
- package/dist/runtime/composables/use-form-field.d.ts +1 -0
- package/dist/runtime/composables/use-icons.d.ts +2 -2
- package/dist/runtime/composables/use-icons.js +1 -1
- package/dist/runtime/composables/use-locale.d.ts +2 -2
- package/dist/runtime/composables/use-locale.js +1 -1
- package/dist/runtime/composables/use-media-query.d.ts +6 -8
- package/dist/runtime/composables/use-media-query.js +7 -2
- package/dist/runtime/composables/use-messages.d.ts +2 -2
- package/dist/runtime/composables/use-messages.js +1 -1
- package/dist/runtime/composables/use-modal.d.ts +1 -17
- package/dist/runtime/composables/use-modal.js +12 -18
- package/dist/runtime/composables/use-ripple.d.ts +2 -2
- package/dist/runtime/composables/use-ripple.js +1 -1
- package/dist/runtime/composables/use-slideover.d.ts +1 -19
- package/dist/runtime/composables/use-slideover.js +12 -18
- package/dist/runtime/composables/use-table.d.ts +74 -17
- package/dist/runtime/composables/use-table.js +4 -1
- package/dist/runtime/composables/use-toast.d.ts +8 -8
- package/dist/runtime/composables/use-toast.js +9 -11
- package/dist/runtime/default-color-metadata.d.ts +4 -0
- package/dist/runtime/default-color-metadata.js +4 -0
- package/dist/runtime/default-colors.css +1 -0
- package/dist/runtime/internal/ColorPickerBody.d.vue.ts +1 -0
- package/dist/runtime/internal/ColorPickerBody.vue +24 -1
- package/dist/runtime/internal/ColorPickerBody.vue.d.ts +1 -0
- package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +50 -46
- package/dist/runtime/internal/ComboboxSelectBase.vue +340 -93
- package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +50 -46
- package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +29 -23
- package/dist/runtime/internal/ComboboxSelectBody.vue +74 -40
- package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +29 -23
- package/dist/runtime/internal/DatePickerCalendarBody.d.vue.ts +3 -5
- package/dist/runtime/internal/DatePickerCalendarBody.vue +2 -2
- package/dist/runtime/internal/DatePickerCalendarBody.vue.d.ts +3 -5
- package/dist/runtime/internal/DatePickerRangeCalendarBody.d.vue.ts +3 -5
- package/dist/runtime/internal/DatePickerRangeCalendarBody.vue +1 -1
- package/dist/runtime/internal/DatePickerRangeCalendarBody.vue.d.ts +3 -5
- package/dist/runtime/internal/DatePickerTimeBody.d.vue.ts +2 -4
- package/dist/runtime/internal/DatePickerTimeBody.vue.d.ts +2 -4
- package/dist/runtime/internal/ProgrammaticTheme.d.vue.ts +17 -0
- package/dist/runtime/internal/ProgrammaticTheme.vue +41 -0
- package/dist/runtime/internal/ProgrammaticTheme.vue.d.ts +17 -0
- package/dist/runtime/internal/TimeStepper.vue +1 -1
- package/dist/runtime/internal/ToastItemRenderer.d.vue.ts +14 -0
- package/dist/runtime/internal/ToastItemRenderer.vue +54 -0
- package/dist/runtime/internal/ToastItemRenderer.vue.d.ts +14 -0
- package/dist/runtime/internal/combobox-select.d.ts +52 -0
- package/dist/runtime/{composables/use-combobox-select.js → internal/combobox-select.js} +26 -11
- package/dist/runtime/internal/programmatic-services.d.ts +71 -0
- package/dist/runtime/internal/programmatic-services.js +61 -0
- package/dist/runtime/prose.css +1 -1
- package/dist/runtime/structural.css +1 -0
- package/dist/runtime/table.d.ts +3 -0
- package/dist/runtime/table.js +1 -0
- package/dist/runtime/theme/accordion.d.ts +27 -0
- package/dist/runtime/theme/accordion.js +15 -6
- package/dist/runtime/theme/alert-dialog.js +5 -5
- package/dist/runtime/theme/alert.js +6 -15
- package/dist/runtime/theme/avatar-group.js +2 -2
- package/dist/runtime/theme/avatar.js +12 -18
- package/dist/runtime/theme/badge.d.ts +39 -9
- package/dist/runtime/theme/badge.js +11 -40
- package/dist/runtime/theme/breadcrumb.d.ts +29 -47
- package/dist/runtime/theme/breadcrumb.js +16 -5
- package/dist/runtime/theme/button.d.ts +45 -15
- package/dist/runtime/theme/button.js +10 -57
- package/dist/runtime/theme/callout.js +7 -7
- package/dist/runtime/theme/card.js +7 -7
- package/dist/runtime/theme/checkbox.d.ts +21 -84
- package/dist/runtime/theme/checkbox.js +15 -36
- package/dist/runtime/theme/chip.js +4 -22
- package/dist/runtime/theme/code-button.js +2 -2
- package/dist/runtime/theme/code-tree.d.ts +3 -3
- package/dist/runtime/theme/code-tree.js +4 -4
- package/dist/runtime/theme/collapsible.d.ts +27 -0
- package/dist/runtime/theme/collapsible.js +12 -3
- package/dist/runtime/theme/color-picker.d.ts +18 -54
- package/dist/runtime/theme/color-picker.js +19 -18
- package/dist/runtime/theme/command-palette.d.ts +6 -6
- package/dist/runtime/theme/command-palette.js +12 -10
- package/dist/runtime/theme/content-navigation.d.ts +27 -0
- package/dist/runtime/theme/content-navigation.js +14 -5
- package/dist/runtime/theme/content-surround.d.ts +27 -0
- package/dist/runtime/theme/content-surround.js +13 -4
- package/dist/runtime/theme/content-toc.d.ts +27 -0
- package/dist/runtime/theme/content-toc.js +14 -5
- package/dist/runtime/theme/context-menu.js +7 -7
- package/dist/runtime/theme/dashboard-navbar.d.ts +6 -6
- package/dist/runtime/theme/dashboard-navbar.js +2 -2
- package/dist/runtime/theme/dashboard-resize-handle.js +3 -3
- package/dist/runtime/theme/dashboard-sidebar.js +3 -3
- package/dist/runtime/theme/date-picker.js +10 -10
- package/dist/runtime/theme/drawer.js +9 -9
- package/dist/runtime/theme/dropdown.js +7 -7
- package/dist/runtime/theme/file-tree.d.ts +27 -0
- package/dist/runtime/theme/file-tree.js +12 -3
- package/dist/runtime/theme/file-upload.d.ts +18 -72
- package/dist/runtime/theme/file-upload.js +20 -19
- package/dist/runtime/theme/form-field.js +5 -5
- package/dist/runtime/theme/header.d.ts +3 -3
- package/dist/runtime/theme/header.js +1 -1
- package/dist/runtime/theme/icon.d.ts +30 -57
- package/dist/runtime/theme/icon.js +19 -9
- package/dist/runtime/theme/input-number.d.ts +21 -63
- package/dist/runtime/theme/input-number.js +12 -12
- package/dist/runtime/theme/input.d.ts +21 -63
- package/dist/runtime/theme/input.js +12 -12
- package/dist/runtime/theme/kbd.js +1 -1
- package/dist/runtime/theme/modal.js +4 -4
- package/dist/runtime/theme/navigation-menu.d.ts +2 -0
- package/dist/runtime/theme/navigation-menu.js +17 -28
- package/dist/runtime/theme/page-header.js +3 -3
- package/dist/runtime/theme/pagination.js +1 -1
- package/dist/runtime/theme/pin-input.d.ts +21 -63
- package/dist/runtime/theme/pin-input.js +13 -11
- package/dist/runtime/theme/popover.js +2 -2
- package/dist/runtime/theme/progress.d.ts +21 -84
- package/dist/runtime/theme/progress.js +12 -12
- package/dist/runtime/theme/prose.d.ts +35 -50
- package/dist/runtime/theme/prose.js +24 -11
- package/dist/runtime/theme/radio-group.d.ts +21 -84
- package/dist/runtime/theme/radio-group.js +16 -22
- package/dist/runtime/theme/rating.d.ts +21 -63
- package/dist/runtime/theme/rating.js +10 -10
- package/dist/runtime/theme/read-more.d.ts +27 -0
- package/dist/runtime/theme/read-more.js +13 -4
- package/dist/runtime/theme/scroll-area.d.ts +3 -3
- package/dist/runtime/theme/scroll-area.js +2 -2
- package/dist/runtime/theme/select.d.ts +21 -54
- package/dist/runtime/theme/select.js +32 -24
- package/dist/runtime/theme/separator.d.ts +18 -54
- package/dist/runtime/theme/separator.js +16 -12
- package/dist/runtime/theme/skeleton.js +4 -4
- package/dist/runtime/theme/slideover.js +5 -5
- package/dist/runtime/theme/slider.d.ts +21 -84
- package/dist/runtime/theme/slider.js +14 -14
- package/dist/runtime/theme/splitter-resize-handle.d.ts +27 -0
- package/dist/runtime/theme/splitter-resize-handle.js +11 -1
- package/dist/runtime/theme/stepper.d.ts +21 -84
- package/dist/runtime/theme/stepper.js +12 -33
- package/dist/runtime/theme/switch.d.ts +21 -84
- package/dist/runtime/theme/switch.js +13 -13
- package/dist/runtime/theme/table.d.ts +27 -0
- package/dist/runtime/theme/table.js +31 -21
- package/dist/runtime/theme/tabs.d.ts +27 -0
- package/dist/runtime/theme/tabs.js +17 -7
- package/dist/runtime/theme/textarea.d.ts +21 -63
- package/dist/runtime/theme/textarea.js +12 -12
- package/dist/runtime/theme/toast.d.ts +12 -48
- package/dist/runtime/theme/toast.js +9 -9
- package/dist/runtime/theme/toggle-group.js +5 -11
- package/dist/runtime/theme/toggle.js +2 -12
- package/dist/runtime/theme/tooltip.d.ts +3 -3
- package/dist/runtime/theme/tooltip.js +3 -3
- package/dist/runtime/theme/tree.d.ts +27 -0
- package/dist/runtime/theme/tree.js +13 -3
- package/dist/runtime/theme-api.d.ts +15 -0
- package/dist/runtime/theme-api.js +12 -0
- package/dist/runtime/theme-config.d.ts +470 -0
- package/dist/runtime/theme-config.js +0 -0
- package/dist/runtime/theme.css +1 -1
- package/dist/runtime/types/app-config.d.ts +11 -8
- package/dist/runtime/types/index.d.ts +19 -1
- package/dist/runtime/utils/app-scoped-state.d.ts +2 -0
- package/dist/runtime/utils/app-scoped-state.js +13 -0
- package/dist/runtime/utils/autocomplete-contracts.d.ts +24 -0
- package/dist/runtime/utils/autocomplete-contracts.js +0 -0
- package/dist/runtime/utils/color-registry.d.ts +62 -0
- package/dist/runtime/utils/color-registry.js +191 -0
- package/dist/runtime/utils/dtcg-colors.d.ts +25 -0
- package/dist/runtime/utils/dtcg-colors.js +40 -0
- package/dist/runtime/utils/file-icons.d.ts +8 -0
- package/dist/runtime/utils/file-icons.js +131 -0
- package/dist/runtime/utils/functional-tokens.d.ts +26 -0
- package/dist/runtime/utils/functional-tokens.js +54 -0
- package/dist/runtime/utils/icons.d.ts +3 -0
- package/dist/runtime/utils/icons.js +4 -0
- package/dist/runtime/utils/injection-keys.d.ts +12 -3
- package/dist/runtime/utils/native-input.d.ts +5 -0
- package/dist/runtime/utils/native-input.js +32 -0
- package/dist/runtime/utils/navigation-menu.d.ts +3 -0
- package/dist/runtime/utils/programmatic-theme.d.ts +17 -0
- package/dist/runtime/utils/programmatic-theme.js +59 -0
- package/dist/runtime/utils/registered-colors.d.ts +3 -0
- package/dist/runtime/utils/registered-colors.js +14 -0
- package/dist/runtime/utils/seed-colors.d.ts +19 -0
- package/dist/runtime/utils/seed-colors.js +207 -0
- package/dist/runtime/utils/select-contracts.d.ts +101 -0
- package/dist/runtime/utils/select-contracts.js +0 -0
- package/dist/runtime/utils/table-contracts.d.ts +60 -0
- package/dist/runtime/utils/table-contracts.js +0 -0
- package/dist/runtime/utils/ui.d.ts +26 -4
- package/dist/runtime/utils/ui.js +38 -5
- package/dist/tokens/default-colors.tokens.json +879 -0
- package/package.json +83 -16
- package/dist/runtime/composables/use-combobox-select.d.ts +0 -45
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { hasInjectionContext, inject, toRaw } from "vue";
|
|
2
|
+
import { useAppConfig } from "#imports";
|
|
3
|
+
import { THEME_INJECTION_KEY } from "./injection-keys.js";
|
|
4
|
+
function cloneSnapshotValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
5
|
+
if (value === null || typeof value !== "object")
|
|
6
|
+
return value;
|
|
7
|
+
const raw = toRaw(value);
|
|
8
|
+
const existing = seen.get(raw);
|
|
9
|
+
if (existing)
|
|
10
|
+
return existing;
|
|
11
|
+
if (Array.isArray(raw)) {
|
|
12
|
+
const result2 = [];
|
|
13
|
+
seen.set(raw, result2);
|
|
14
|
+
for (const item of raw)
|
|
15
|
+
result2.push(cloneSnapshotValue(item, seen));
|
|
16
|
+
return result2;
|
|
17
|
+
}
|
|
18
|
+
const prototype = Object.getPrototypeOf(raw);
|
|
19
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
20
|
+
return raw;
|
|
21
|
+
const result = {};
|
|
22
|
+
seen.set(raw, result);
|
|
23
|
+
for (const key of Reflect.ownKeys(raw))
|
|
24
|
+
result[key] = cloneSnapshotValue(raw[key], seen);
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
function contextChain(context) {
|
|
28
|
+
const chain = [];
|
|
29
|
+
for (let current = context; current; current = current.parent)
|
|
30
|
+
chain.unshift(current);
|
|
31
|
+
return chain;
|
|
32
|
+
}
|
|
33
|
+
export function useProgrammaticThemeSnapshot() {
|
|
34
|
+
const appConfig = useAppConfig();
|
|
35
|
+
const injected = hasInjectionContext() ? inject(THEME_INJECTION_KEY, void 0) : void 0;
|
|
36
|
+
return function snapshotProgrammaticTheme() {
|
|
37
|
+
const current = injected?.value;
|
|
38
|
+
const layers = [];
|
|
39
|
+
if (!current?.replaceGlobal && (appConfig.selaras?.ui || appConfig.selaras?.defaults)) {
|
|
40
|
+
layers.push(cloneSnapshotValue({
|
|
41
|
+
ui: appConfig.selaras.ui,
|
|
42
|
+
defaults: appConfig.selaras.defaults
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
for (const context of contextChain(current)) {
|
|
46
|
+
if (context.ui || context.defaults) {
|
|
47
|
+
layers.push(cloneSnapshotValue({
|
|
48
|
+
ui: context.ui,
|
|
49
|
+
defaults: context.defaults
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
layers,
|
|
55
|
+
tokens: cloneSnapshotValue(current?.tokens ?? appConfig.selaras?.tokens),
|
|
56
|
+
mode: current?.mode ?? "root"
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { colorRoles } from "#build/selaras-color-roles.mjs";
|
|
2
|
+
import { builtinColorNames } from "./color-registry.js";
|
|
3
|
+
const registeredRoles = /* @__PURE__ */ new Set([...builtinColorNames, ...colorRoles]);
|
|
4
|
+
const warnedRoles = /* @__PURE__ */ new Set();
|
|
5
|
+
export function resolveRegisteredColorRole(role, fallback) {
|
|
6
|
+
if (typeof role !== "string" || !registeredRoles.has(role)) {
|
|
7
|
+
if (import.meta.dev && typeof role === "string" && !warnedRoles.has(role)) {
|
|
8
|
+
warnedRoles.add(role);
|
|
9
|
+
console.warn(`[selaras] Unknown color role "${role}". Falling back to "${fallback}".`);
|
|
10
|
+
}
|
|
11
|
+
return fallback;
|
|
12
|
+
}
|
|
13
|
+
return role;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ColorModePair, ColorRecipe } from './color-registry.js';
|
|
2
|
+
export interface SeedColorSurfaces {
|
|
3
|
+
light: string;
|
|
4
|
+
dark: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SeedColorOptions {
|
|
7
|
+
/** Opaque sRGB surfaces used to derive and verify each mode. */
|
|
8
|
+
surfaces?: SeedColorSurfaces;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Preserves one opaque sRGB seed as the resting fill and derives a complete,
|
|
12
|
+
* opaque two-mode web ColorRecipe around it.
|
|
13
|
+
* Custom or unresolved surfaces require explicit recipes instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare function defineColorFromSeed(seed: string, options?: SeedColorOptions): ColorModePair<ColorRecipe>;
|
|
16
|
+
export declare const seedColorContrastTargets: {
|
|
17
|
+
readonly text: 4.5;
|
|
18
|
+
readonly nonText: 3;
|
|
19
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { defaultSeedSurfaces } from "../default-color-metadata.js";
|
|
2
|
+
const textMinimum = 4.5;
|
|
3
|
+
const nonTextMinimum = 3;
|
|
4
|
+
const textGuard = 4.7;
|
|
5
|
+
const nonTextGuard = 3.2;
|
|
6
|
+
const black = [0, 0, 0];
|
|
7
|
+
const white = [1, 1, 1];
|
|
8
|
+
function invalid(message) {
|
|
9
|
+
throw new Error(`Invalid Selaras seed color: ${message}`);
|
|
10
|
+
}
|
|
11
|
+
function rgb(red, green, blue) {
|
|
12
|
+
return [red, green, blue];
|
|
13
|
+
}
|
|
14
|
+
function parseHex(value, label) {
|
|
15
|
+
if (typeof value !== "string" || !/^#[0-9a-f]{6}$/i.test(value))
|
|
16
|
+
invalid(`${label} must be an opaque six-digit sRGB hex color such as "#FD5E53".`);
|
|
17
|
+
return rgb(
|
|
18
|
+
Number.parseInt(value.slice(1, 3), 16) / 255,
|
|
19
|
+
Number.parseInt(value.slice(3, 5), 16) / 255,
|
|
20
|
+
Number.parseInt(value.slice(5, 7), 16) / 255
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function gammaToLinear(value) {
|
|
24
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
25
|
+
}
|
|
26
|
+
function linearToGamma(value) {
|
|
27
|
+
return value <= 31308e-7 ? value * 12.92 : 1.055 * value ** (1 / 2.4) - 0.055;
|
|
28
|
+
}
|
|
29
|
+
function rgbToLab(rgb2) {
|
|
30
|
+
const [red, green, blue] = rgb2;
|
|
31
|
+
const r = gammaToLinear(red);
|
|
32
|
+
const g = gammaToLinear(green);
|
|
33
|
+
const b = gammaToLinear(blue);
|
|
34
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
35
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
36
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
37
|
+
return [
|
|
38
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
39
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
40
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function labToRgb([L, a, b]) {
|
|
44
|
+
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
45
|
+
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
46
|
+
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
47
|
+
return [
|
|
48
|
+
linearToGamma(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
|
|
49
|
+
linearToGamma(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
|
|
50
|
+
linearToGamma(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function labToLch([l, a, b]) {
|
|
54
|
+
const chroma = Math.hypot(a, b);
|
|
55
|
+
return [l, chroma, chroma < 1e-7 ? 0 : (Math.atan2(b, a) * 180 / Math.PI + 360) % 360];
|
|
56
|
+
}
|
|
57
|
+
function lchToLab([l, chroma, hue]) {
|
|
58
|
+
const radians = hue * Math.PI / 180;
|
|
59
|
+
return [l, chroma * Math.cos(radians), chroma * Math.sin(radians)];
|
|
60
|
+
}
|
|
61
|
+
function inGamut(rgb2) {
|
|
62
|
+
return rgb2.every((value) => value >= -1e-7 && value <= 1 + 1e-7);
|
|
63
|
+
}
|
|
64
|
+
function fitLch([lightness, chroma, hue]) {
|
|
65
|
+
let low = 0;
|
|
66
|
+
let high = chroma;
|
|
67
|
+
let result = labToRgb(lchToLab([lightness, 0, hue]));
|
|
68
|
+
for (let iteration = 0; iteration < 24; iteration++) {
|
|
69
|
+
const candidateChroma = (low + high) / 2;
|
|
70
|
+
const candidate = labToRgb(lchToLab([lightness, candidateChroma, hue]));
|
|
71
|
+
if (inGamut(candidate)) {
|
|
72
|
+
low = candidateChroma;
|
|
73
|
+
result = candidate;
|
|
74
|
+
} else {
|
|
75
|
+
high = candidateChroma;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return rgb(
|
|
79
|
+
Math.min(1, Math.max(0, result[0])),
|
|
80
|
+
Math.min(1, Math.max(0, result[1])),
|
|
81
|
+
Math.min(1, Math.max(0, result[2]))
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function quantize(rgb2) {
|
|
85
|
+
return parseHex(toHex(rgb2), "derived color");
|
|
86
|
+
}
|
|
87
|
+
function toHex(rgb2) {
|
|
88
|
+
return `#${rgb2.map((value) => Math.round(value * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
89
|
+
}
|
|
90
|
+
function luminance(rgb2) {
|
|
91
|
+
const [red, green, blue] = rgb2;
|
|
92
|
+
const r = gammaToLinear(red);
|
|
93
|
+
const g = gammaToLinear(green);
|
|
94
|
+
const b = gammaToLinear(blue);
|
|
95
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
96
|
+
}
|
|
97
|
+
function contrast(left, right) {
|
|
98
|
+
const leftLuminance = luminance(left);
|
|
99
|
+
const rightLuminance = luminance(right);
|
|
100
|
+
const lighter = Math.max(leftLuminance, rightLuminance);
|
|
101
|
+
const darker = Math.min(leftLuminance, rightLuminance);
|
|
102
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
103
|
+
}
|
|
104
|
+
function mixLab(left, right, amount) {
|
|
105
|
+
const source = rgbToLab(left);
|
|
106
|
+
const target = rgbToLab(right);
|
|
107
|
+
const mixed = labToRgb(rgb(
|
|
108
|
+
source[0] * (1 - amount) + target[0] * amount,
|
|
109
|
+
source[1] * (1 - amount) + target[1] * amount,
|
|
110
|
+
source[2] * (1 - amount) + target[2] * amount
|
|
111
|
+
));
|
|
112
|
+
return rgb(
|
|
113
|
+
Math.min(1, Math.max(0, mixed[0])),
|
|
114
|
+
Math.min(1, Math.max(0, mixed[1])),
|
|
115
|
+
Math.min(1, Math.max(0, mixed[2]))
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function findSeries(seed, direction, step, count, accepts, distinct = true) {
|
|
119
|
+
const [seedLightness, seedChroma, seedHue] = labToLch(rgbToLab(seed));
|
|
120
|
+
let best;
|
|
121
|
+
for (let index = 0; index <= 1e3; index++) {
|
|
122
|
+
const baseLightness = index / 1e3;
|
|
123
|
+
const lightnesses = Array.from({ length: count }, (_, state) => baseLightness + direction * step * state);
|
|
124
|
+
if (lightnesses.some((value) => value < 0 || value > 1))
|
|
125
|
+
continue;
|
|
126
|
+
const colors = lightnesses.map((lightness) => quantize(fitLch([lightness, seedChroma, seedHue])));
|
|
127
|
+
if (!colors.every(accepts) || distinct && new Set(colors.map(toHex)).size !== colors.length)
|
|
128
|
+
continue;
|
|
129
|
+
const cost = Math.abs(baseLightness - seedLightness);
|
|
130
|
+
if (!best || cost < best.cost)
|
|
131
|
+
best = { colors, cost };
|
|
132
|
+
}
|
|
133
|
+
if (!best)
|
|
134
|
+
throw new Error("no series satisfies the required contrast.");
|
|
135
|
+
return best;
|
|
136
|
+
}
|
|
137
|
+
function findStateSeries(seed, direction, step, count, accepts) {
|
|
138
|
+
for (const scale of [1, 0.75, 0.5, 0.25, 0.1]) {
|
|
139
|
+
try {
|
|
140
|
+
return { ...findSeries(seed, direction, step * scale, count, accepts), collapsed: false };
|
|
141
|
+
} catch {
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { ...findSeries(seed, direction, 0, count, accepts, false), collapsed: true };
|
|
145
|
+
}
|
|
146
|
+
function requireSeries(mode, family, create) {
|
|
147
|
+
try {
|
|
148
|
+
return create();
|
|
149
|
+
} catch {
|
|
150
|
+
invalid(`cannot derive the ${mode} ${family} family while preserving its contrast targets; provide an explicit defineColor() recipe.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function deriveFillStates(seed, foreground, mode) {
|
|
154
|
+
const preferredTarget = mode === "light" ? black : white;
|
|
155
|
+
const alternateTarget = preferredTarget === black ? white : black;
|
|
156
|
+
for (const target of [preferredTarget, alternateTarget]) {
|
|
157
|
+
for (const scale of [1, 0.75, 0.5, 0.25, 0.125, 0.0625, 0.03125]) {
|
|
158
|
+
const hover = quantize(mixLab(seed, target, 0.06 * scale));
|
|
159
|
+
const pressed = quantize(mixLab(seed, target, 0.12 * scale));
|
|
160
|
+
const colors = [seed, hover, pressed];
|
|
161
|
+
if (new Set(colors.map(toHex)).size === colors.length && colors.every((color) => contrast(color, foreground) >= textMinimum))
|
|
162
|
+
return [hover, pressed];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
invalid(`cannot derive distinct ${mode} fill states while preserving readable content; provide an explicit defineColor() recipe.`);
|
|
166
|
+
}
|
|
167
|
+
function deriveMode(seed, surface, mode) {
|
|
168
|
+
const direction = contrast(white, surface) > contrast(black, surface) ? 1 : -1;
|
|
169
|
+
const foreground = contrast(seed, black) >= contrast(seed, white) ? black : white;
|
|
170
|
+
if (contrast(seed, foreground) < textMinimum)
|
|
171
|
+
invalid(`cannot preserve the ${mode} fill while deriving readable content; provide an explicit defineColor() recipe.`);
|
|
172
|
+
const [fillHover, fillPressed] = deriveFillStates(seed, foreground, mode);
|
|
173
|
+
const fillColor = seed;
|
|
174
|
+
const subtle = quantize(mixLab(surface, fillColor, 0.1));
|
|
175
|
+
const subtleHover = quantize(mixLab(surface, fillColor, 0.14));
|
|
176
|
+
const subtlePressed = quantize(mixLab(surface, fillColor, 0.18));
|
|
177
|
+
const text = requireSeries(mode, "text/subtle", () => findStateSeries(seed, direction, 0.03, 3, (color) => [surface, subtle, subtleHover, subtlePressed].every((background) => contrast(color, background) >= textGuard))).colors;
|
|
178
|
+
const border = requireSeries(mode, "border", () => findStateSeries(seed, direction, 0.02, 1, (color) => contrast(color, surface) >= nonTextGuard)).colors[0];
|
|
179
|
+
return {
|
|
180
|
+
fill: toHex(fillColor),
|
|
181
|
+
fillHover: toHex(fillHover),
|
|
182
|
+
fillPressed: toHex(fillPressed),
|
|
183
|
+
onFill: toHex(foreground),
|
|
184
|
+
indicator: toHex(border),
|
|
185
|
+
subtle: toHex(subtle),
|
|
186
|
+
subtleHover: toHex(subtleHover),
|
|
187
|
+
subtlePressed: toHex(subtlePressed),
|
|
188
|
+
onSubtle: toHex(text[0]),
|
|
189
|
+
text: toHex(text[0]),
|
|
190
|
+
textHover: toHex(text[1]),
|
|
191
|
+
textPressed: toHex(text[2]),
|
|
192
|
+
border: toHex(border),
|
|
193
|
+
focus: toHex(text[0])
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
export function defineColorFromSeed(seed, options = {}) {
|
|
197
|
+
const surfaces = options.surfaces ?? defaultSeedSurfaces;
|
|
198
|
+
const color = parseHex(seed, "seed");
|
|
199
|
+
return {
|
|
200
|
+
light: deriveMode(color, parseHex(surfaces.light, "surfaces.light"), "light"),
|
|
201
|
+
dark: deriveMode(color, parseHex(surfaces.dark, "surfaces.dark"), "dark")
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export const seedColorContrastTargets = {
|
|
205
|
+
text: textMinimum,
|
|
206
|
+
nonText: nonTextMinimum
|
|
207
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
+
import type { selectTheme, SelectThemeSlots } from '../theme/select.js';
|
|
3
|
+
import type { ColorRole } from './color-registry.js';
|
|
4
|
+
import type { UiProp } from './ui.js';
|
|
5
|
+
export type SelectValue = string | number;
|
|
6
|
+
export interface SelectGroup<Item extends object> {
|
|
7
|
+
label: string;
|
|
8
|
+
items: readonly Item[];
|
|
9
|
+
}
|
|
10
|
+
/** Infer options from the entry array before unwrapping one group level. */
|
|
11
|
+
export type SelectEntryItem<Entry> = Entry extends SelectGroup<infer Item> ? Item : Entry;
|
|
12
|
+
export type SelectEntryGroup<Entry> = Extract<Entry, SelectGroup<object>>;
|
|
13
|
+
export type SelectIdentityKeys<Item> = {
|
|
14
|
+
[Key in keyof Item]-?: Item[Key] extends SelectValue ? Key : never;
|
|
15
|
+
}[keyof Item] & string;
|
|
16
|
+
export type SelectIdentity<Entry, Key extends string> = SelectEntryItem<Entry>[Key & keyof SelectEntryItem<Entry>] & SelectValue;
|
|
17
|
+
export type SelectModel<Value, Multiple extends boolean> = Multiple extends true ? Value[] : Value | undefined;
|
|
18
|
+
type ValidEntry<Entry, Key extends string> = Entry extends SelectGroup<infer Item> ? SelectGroup<Item & Record<Key, SelectValue>> : Entry & Record<Key, SelectValue>;
|
|
19
|
+
export interface SelectResolvedOption<Entry, Key extends string = 'value'> {
|
|
20
|
+
value: SelectIdentity<Entry, Key>;
|
|
21
|
+
label: string;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
/** Undefined while a selected identity is absent from the current options. */
|
|
24
|
+
raw: SelectEntryItem<Entry> | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface SelectProps<Entry extends object = {
|
|
27
|
+
value: SelectValue;
|
|
28
|
+
label?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
}, Key extends string = 'value', Multiple extends boolean = false> {
|
|
31
|
+
id?: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
/** ID of an associated form outside the component's ancestors. */
|
|
34
|
+
form?: string;
|
|
35
|
+
items: readonly Entry[] & NoInfer<readonly ValidEntry<Entry, Key>[]>;
|
|
36
|
+
valueKey?: Key & SelectIdentityKeys<SelectEntryItem<Entry>>;
|
|
37
|
+
labelKey?: keyof SelectEntryItem<Entry> & string;
|
|
38
|
+
open?: boolean;
|
|
39
|
+
/** Initial uncontrolled open state. */
|
|
40
|
+
defaultOpen?: boolean;
|
|
41
|
+
modelValue?: NoInfer<SelectModel<SelectIdentity<Entry, Key>, Multiple>>;
|
|
42
|
+
/** Mount-captured selection/reset target, adapted to the current multiple mode. */
|
|
43
|
+
defaultValue?: NoInfer<SelectModel<SelectIdentity<Entry, Key>, Multiple>>;
|
|
44
|
+
/** Controlled parents must update selection shape and mode together. */
|
|
45
|
+
multiple?: Multiple;
|
|
46
|
+
searchable?: boolean;
|
|
47
|
+
virtualize?: boolean | {
|
|
48
|
+
estimateSize?: number;
|
|
49
|
+
overscan?: number;
|
|
50
|
+
};
|
|
51
|
+
displayMode?: 'comma' | 'chip';
|
|
52
|
+
maxChips?: number;
|
|
53
|
+
loading?: boolean;
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
size?: VariantProps<typeof selectTheme>['size'];
|
|
58
|
+
invalid?: boolean;
|
|
59
|
+
/** The focus-ring color; the resting ring stays neutral. */
|
|
60
|
+
color?: ColorRole;
|
|
61
|
+
clearable?: boolean;
|
|
62
|
+
searchTerm?: string;
|
|
63
|
+
resetSearchTermOnBlur?: boolean;
|
|
64
|
+
resetSearchTermOnSelect?: boolean;
|
|
65
|
+
arrow?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Opts into the control's accessible small-screen presentation. Select uses
|
|
68
|
+
* a centered modal; Autocomplete keeps its editable combobox in a wider
|
|
69
|
+
* nonmodal panel. The active presentation is chosen on open and held until
|
|
70
|
+
* close.
|
|
71
|
+
*/
|
|
72
|
+
adaptive?: boolean;
|
|
73
|
+
ui?: UiProp<SelectThemeSlots>;
|
|
74
|
+
}
|
|
75
|
+
export interface SelectEmits<Entry extends object = {
|
|
76
|
+
value: SelectValue;
|
|
77
|
+
}, Key extends string = 'value', Multiple extends boolean = false> {
|
|
78
|
+
'update:open': [value: boolean];
|
|
79
|
+
'update:modelValue': [value: SelectModel<SelectIdentity<Entry, Key>, Multiple>];
|
|
80
|
+
'update:searchTerm': [value: string];
|
|
81
|
+
}
|
|
82
|
+
export interface SelectSlots<Entry extends object, Key extends string = 'value'> {
|
|
83
|
+
'item'?: (props: {
|
|
84
|
+
item: SelectEntryItem<Entry>;
|
|
85
|
+
}) => any;
|
|
86
|
+
'group'?: (props: {
|
|
87
|
+
group: SelectEntryGroup<Entry>;
|
|
88
|
+
}) => any;
|
|
89
|
+
'value'?: (props: {
|
|
90
|
+
selected: SelectResolvedOption<Entry, Key> | undefined;
|
|
91
|
+
}) => any;
|
|
92
|
+
'header'?: () => any;
|
|
93
|
+
'footer'?: () => any;
|
|
94
|
+
'empty'?: () => any;
|
|
95
|
+
'empty-filter'?: () => any;
|
|
96
|
+
'filter-icon'?: () => any;
|
|
97
|
+
'clear-icon'?: () => any;
|
|
98
|
+
'loading-icon'?: () => any;
|
|
99
|
+
'dropdown-icon'?: () => any;
|
|
100
|
+
}
|
|
101
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { RowData } from '@tanstack/vue-table';
|
|
2
|
+
import type { TableColumnDef, TableColumnVisibilityState, TableExpandedState, TableGetRowId, TableRowSelectionState, TableSortingState } from '../composables/use-table.js';
|
|
3
|
+
import type { TableThemeSlots } from '../theme/table.js';
|
|
4
|
+
import type { ColorRole } from './color-registry.js';
|
|
5
|
+
import type { UiProp } from './ui.js';
|
|
6
|
+
export interface TableProps<TData extends RowData = RowData> {
|
|
7
|
+
data: TData[];
|
|
8
|
+
columns?: TableColumnDef<TData>[];
|
|
9
|
+
selectable?: boolean;
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
sorting?: TableSortingState;
|
|
13
|
+
defaultSorting?: TableSortingState;
|
|
14
|
+
rowSelection?: TableRowSelectionState;
|
|
15
|
+
globalFilter?: string;
|
|
16
|
+
pageIndex?: number;
|
|
17
|
+
size?: 'sm' | 'md' | 'lg';
|
|
18
|
+
/** The sortable-header focus ring and loading indicator accent. @default 'primary' */
|
|
19
|
+
color?: ColorRole;
|
|
20
|
+
gridlines?: boolean;
|
|
21
|
+
striped?: boolean;
|
|
22
|
+
expandable?: boolean;
|
|
23
|
+
expanded?: TableExpandedState;
|
|
24
|
+
columnVisibility?: TableColumnVisibilityState;
|
|
25
|
+
columnToggle?: boolean;
|
|
26
|
+
/** Enables vertical scroll with a sticky header, capped at this CSS height (e.g. '24rem'). */
|
|
27
|
+
scrollHeight?: string;
|
|
28
|
+
virtualize?: boolean | {
|
|
29
|
+
estimateSize?: number;
|
|
30
|
+
overscan?: number;
|
|
31
|
+
};
|
|
32
|
+
/** Opts out of the local sorted/filtered/paginated row models - set when `data` is already sorted/filtered/paginated server-side, so this table doesn't redundantly (and incorrectly) reprocess an already-server-processed slice. `sorting`/`globalFilter`/`pageIndex` still drive the UI and still emit their `update:*` events the same way - only the *local row model* is skipped, not the state itself. `manualPagination` also suppresses the built-in Pagination UI entirely (there's no way to know the real page count from a server-paginated slice) - bring your own `SPagination`, bound to your own server metadata, the same way this table already expects you to bring your own search input for `globalFilter`. */
|
|
33
|
+
manualSorting?: boolean;
|
|
34
|
+
manualFiltering?: boolean;
|
|
35
|
+
manualPagination?: boolean;
|
|
36
|
+
/** Returns the stable id used by selection and expansion state. Defaults to the row index. */
|
|
37
|
+
getRowId?: TableGetRowId<TData>;
|
|
38
|
+
/** Adds a class to a body row based on its own data - e.g. highlighting a flagged row. Called per row, not per render, so keep it cheap. */
|
|
39
|
+
rowClass?: (row: TData) => string | undefined;
|
|
40
|
+
/** Same as `rowClass`, for inline styles. */
|
|
41
|
+
rowStyle?: (row: TData) => Record<string, string> | undefined;
|
|
42
|
+
ui?: UiProp<TableThemeSlots>;
|
|
43
|
+
}
|
|
44
|
+
export interface TableEmits<TData extends RowData = RowData> {
|
|
45
|
+
'update:sorting': [value: TableSortingState];
|
|
46
|
+
'update:rowSelection': [value: TableRowSelectionState];
|
|
47
|
+
'update:globalFilter': [value: string];
|
|
48
|
+
'update:pageIndex': [value: number];
|
|
49
|
+
'update:expanded': [value: TableExpandedState];
|
|
50
|
+
'update:columnVisibility': [value: TableColumnVisibilityState];
|
|
51
|
+
'rowClick': [row: TData, event: MouseEvent];
|
|
52
|
+
'rowContextmenu': [row: TData, event: MouseEvent];
|
|
53
|
+
}
|
|
54
|
+
export interface TableSlots<TData extends RowData = RowData> {
|
|
55
|
+
default?: () => any;
|
|
56
|
+
empty?: () => any;
|
|
57
|
+
expanded?: (props: {
|
|
58
|
+
row: TData;
|
|
59
|
+
}) => any;
|
|
60
|
+
}
|
|
File without changes
|
|
@@ -51,7 +51,7 @@ export declare function applyClassPrefix(classString: string, prefix?: string):
|
|
|
51
51
|
* applies this to a `:ui` override *before* handing it to the slot function,
|
|
52
52
|
* because `tailwind-merge` (bundled by `tailwind-variants`) has no concept
|
|
53
53
|
* of Tailwind v4's `tw:`-style prefix syntax: a mixed merge - an unprefixed
|
|
54
|
-
* base class (`bg-[var(--
|
|
54
|
+
* base class (`bg-[var(--_selaras-color-fill)]`) against an already-prefixed override
|
|
55
55
|
* (`tw:bg-red-500`, exactly what a consumer is documented to write once a
|
|
56
56
|
* prefix is configured) - never dedupes, confirmed directly (both classes
|
|
57
57
|
* survive as-is). Since Selaras's own safelist stylesheet loads after the
|
|
@@ -101,11 +101,23 @@ export declare function withFallthroughClass(fallthroughClass: string | undefine
|
|
|
101
101
|
* component. Bind the result with a single `v-bind` (Vue's template compiler
|
|
102
102
|
* rejects two bare v-bind spreads on the same element).
|
|
103
103
|
*/
|
|
104
|
-
export declare function useRootProps<T extends AnySlotFn>(slotFn: () => T, override: () => UiSlotValue | undefined
|
|
104
|
+
export declare function useRootProps<T extends AnySlotFn>(slotFn: () => T, override: () => UiSlotValue | undefined, options?: {
|
|
105
|
+
exclude?: (key: string) => boolean;
|
|
106
|
+
includeClass?: boolean;
|
|
107
|
+
}): ComputedRef<{
|
|
105
108
|
[x: string]: unknown;
|
|
106
109
|
}>;
|
|
107
110
|
/**
|
|
108
|
-
*
|
|
111
|
+
* Returns fallthrough attributes selected for a component's real interactive
|
|
112
|
+
* element. Wrapped controls use this alongside useRootProps: layout and
|
|
113
|
+
* component classes stay on the root slot, while native attributes/listeners
|
|
114
|
+
* such as autocomplete and focus/blur reach the input itself.
|
|
115
|
+
*/
|
|
116
|
+
export declare function useFallthroughAttrs(select: (key: string) => boolean): ComputedRef<{
|
|
117
|
+
[k: string]: unknown;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Merges a component's global `app.config.selaras.ui.<key>` override, then any
|
|
109
121
|
* ancestor STheme's scoped `ui.<key>` override, into its base `tv()`
|
|
110
122
|
* theme - each layered via tv()'s own `extend` composition, so an
|
|
111
123
|
* override only needs to name the slots it actually changes. Falls back
|
|
@@ -113,7 +125,7 @@ export declare function useRootProps<T extends AnySlotFn>(slotFn: () => T, overr
|
|
|
113
125
|
*/
|
|
114
126
|
export declare function useComponentTheme<T extends (...args: any[]) => any>(key: string, base: T): ComputedRef<T>;
|
|
115
127
|
/**
|
|
116
|
-
* The nearest (chain-merged) STheme `
|
|
128
|
+
* The nearest (chain-merged) STheme `defaults.<key>` override, if any - a
|
|
117
129
|
* component reads this as its own prop's fallback, one level below its
|
|
118
130
|
* own explicit prop but above whatever hardcoded/tv() default it'd
|
|
119
131
|
* otherwise use (`props.size ?? useThemeProps('button').value.size`),
|
|
@@ -121,4 +133,14 @@ export declare function useComponentTheme<T extends (...args: any[]) => any>(key
|
|
|
121
133
|
* generically instead of each needing its own bespoke injection key.
|
|
122
134
|
*/
|
|
123
135
|
export declare function useThemeProps(key: string): ComputedRef<Record<string, unknown>>;
|
|
136
|
+
/** Returns the nearest explicit STheme DOM marker for portalled content roots. */
|
|
137
|
+
export declare function useThemeScope(): ComputedRef<string | undefined>;
|
|
138
|
+
/** Managed ownership follows Vue ancestry, including through Teleport. */
|
|
139
|
+
export declare function useThemeBindings(): ComputedRef<{
|
|
140
|
+
'data-selaras-theme': string;
|
|
141
|
+
'data-selaras-mode': "root" | "light" | "dark";
|
|
142
|
+
style: {
|
|
143
|
+
colorScheme: "light" | "dark";
|
|
144
|
+
} | undefined;
|
|
145
|
+
}>;
|
|
124
146
|
export {};
|
package/dist/runtime/utils/ui.js
CHANGED
|
@@ -39,11 +39,24 @@ export function withFallthroughClass(fallthroughClass, override) {
|
|
|
39
39
|
}
|
|
40
40
|
return [fallthroughClass, override].filter(Boolean).join(" ") || void 0;
|
|
41
41
|
}
|
|
42
|
-
export function useRootProps(slotFn, override) {
|
|
42
|
+
export function useRootProps(slotFn, override, options) {
|
|
43
43
|
const { fallthroughClass, attrsWithoutClass } = useRootFallthrough();
|
|
44
|
+
const themeBindings = useThemeBindings();
|
|
45
|
+
const rootAttrs = computed(() => {
|
|
46
|
+
if (!options?.exclude)
|
|
47
|
+
return attrsWithoutClass.value;
|
|
48
|
+
return Object.fromEntries(Object.entries(attrsWithoutClass.value).filter(([key]) => !options.exclude(key)));
|
|
49
|
+
});
|
|
44
50
|
return computed(() => mergeProps(
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
themeBindings.value,
|
|
52
|
+
rootAttrs.value,
|
|
53
|
+
resolveSlot(slotFn(), withFallthroughClass(options?.includeClass === false ? void 0 : fallthroughClass.value, override()))
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
export function useFallthroughAttrs(select) {
|
|
57
|
+
const attrs = useAttrs();
|
|
58
|
+
return computed(() => Object.fromEntries(
|
|
59
|
+
Object.entries(attrs).filter(([key]) => select(key))
|
|
47
60
|
));
|
|
48
61
|
}
|
|
49
62
|
function collectThemeChain(context, pick, key) {
|
|
@@ -60,7 +73,7 @@ export function useComponentTheme(key, base) {
|
|
|
60
73
|
const themeContext = inject(THEME_INJECTION_KEY, void 0);
|
|
61
74
|
return computed(() => {
|
|
62
75
|
let result = base;
|
|
63
|
-
const globalOverride = appConfig.ui?.[key];
|
|
76
|
+
const globalOverride = themeContext?.value.replaceGlobal ? void 0 : appConfig.selaras?.ui?.[key];
|
|
64
77
|
if (globalOverride)
|
|
65
78
|
result = tv({ extend: result, ...globalOverride });
|
|
66
79
|
for (const override of collectThemeChain(themeContext?.value, (c) => c.ui, key))
|
|
@@ -69,6 +82,26 @@ export function useComponentTheme(key, base) {
|
|
|
69
82
|
});
|
|
70
83
|
}
|
|
71
84
|
export function useThemeProps(key) {
|
|
85
|
+
const appConfig = useAppConfig();
|
|
72
86
|
const themeContext = inject(THEME_INJECTION_KEY, void 0);
|
|
73
|
-
return computed(() => Object.assign(
|
|
87
|
+
return computed(() => Object.assign(
|
|
88
|
+
{},
|
|
89
|
+
themeContext?.value.replaceGlobal ? void 0 : appConfig.selaras?.defaults?.[key],
|
|
90
|
+
...collectThemeChain(themeContext?.value, (c) => c.defaults, key)
|
|
91
|
+
));
|
|
92
|
+
}
|
|
93
|
+
export function useThemeScope() {
|
|
94
|
+
const themeContext = inject(THEME_INJECTION_KEY, void 0);
|
|
95
|
+
return computed(() => themeContext?.value.scopeId);
|
|
96
|
+
}
|
|
97
|
+
export function useThemeBindings() {
|
|
98
|
+
const context = inject(THEME_INJECTION_KEY, void 0);
|
|
99
|
+
return computed(() => {
|
|
100
|
+
const mode = context?.value.mode ?? "root";
|
|
101
|
+
return {
|
|
102
|
+
"data-selaras-theme": context?.value.scopeId ?? "global",
|
|
103
|
+
"data-selaras-mode": mode,
|
|
104
|
+
"style": mode === "root" ? void 0 : { colorScheme: mode }
|
|
105
|
+
};
|
|
106
|
+
});
|
|
74
107
|
}
|