@threadlabs/looma 0.32.0 → 0.33.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/components/shared/icons.js +1 -0
- package/components/shared/overlay.js +1 -1
- package/components/ui-action-bar/ui-action-bar.html +11 -11
- package/components/ui-affordance-scope/ui-affordance-scope.html +2 -2
- package/components/ui-avatar/ui-avatar.html +8 -8
- package/components/ui-avatar-group/ui-avatar-group.html +14 -14
- package/components/ui-avatar-group/ui-avatar-group.js +3 -2
- package/components/ui-badge/ui-badge.html +43 -43
- package/components/ui-breadcrumb-item/ui-breadcrumb-item.html +13 -13
- package/components/ui-breadcrumbs/ui-breadcrumbs.html +8 -8
- package/components/ui-button/ui-button.html +32 -29
- package/components/ui-callout/ui-callout.html +9 -9
- package/components/ui-card/ui-card.html +11 -11
- package/components/ui-checkbox/ui-checkbox.html +52 -33
- package/components/ui-cluster/ui-cluster.html +21 -21
- package/components/ui-color-picker/ui-color-picker.html +135 -0
- package/components/ui-color-picker/ui-color-picker.js +76 -0
- package/components/ui-combobox/ui-combobox.html +43 -43
- package/components/ui-container/ui-container.html +7 -7
- package/components/ui-context-menu/ui-context-menu.html +9 -9
- package/components/ui-cover/ui-cover.html +8 -8
- package/components/ui-description-item/ui-description-item.html +7 -7
- package/components/ui-description-list/ui-description-list.html +4 -4
- package/components/ui-dialog/ui-dialog.html +26 -26
- package/components/ui-disclosure/ui-disclosure.html +23 -23
- package/components/ui-editable/ui-editable.html +16 -16
- package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.html +9 -9
- package/components/ui-editor-link-form/ui-editor-link-form.html +1 -2
- package/components/ui-editor-mention-menu/ui-editor-mention-menu.html +23 -23
- package/components/ui-editor-mention-menu-item/ui-editor-mention-menu-item.html +10 -10
- package/components/ui-editor-slash-menu/ui-editor-slash-menu.html +29 -29
- package/components/ui-editor-slash-menu-group/ui-editor-slash-menu-group.html +5 -5
- package/components/ui-editor-slash-menu-item/ui-editor-slash-menu-item.html +11 -11
- package/components/ui-editor-surface/ui-editor-surface.html +2 -2
- package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.html +25 -25
- package/components/ui-editor-table-overlay/ui-editor-table-overlay.html +13 -13
- package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.html +31 -31
- package/components/ui-editor-toolbar/ui-editor-toolbar.html +13 -13
- package/components/ui-floating-action-button/ui-floating-action-button.html +8 -8
- package/components/ui-form-field/ui-form-field.html +15 -15
- package/components/ui-form-field/ui-form-field.js +12 -4
- package/components/ui-grid/ui-grid.html +4 -4
- package/components/ui-icon/ui-icon.html +3 -2
- package/components/ui-icon-button/ui-icon-button.html +15 -14
- package/components/ui-image/ui-image.html +14 -14
- package/components/ui-input/ui-input.html +8 -8
- package/components/ui-input-group/ui-input-group.html +18 -18
- package/components/ui-list/ui-list.html +11 -11
- package/components/ui-list-item/ui-list-item.html +18 -18
- package/components/ui-listbox/ui-listbox.html +10 -10
- package/components/ui-menu/ui-menu.html +18 -17
- package/components/ui-menu-group/ui-menu-group.html +4 -4
- package/components/ui-menu-item/ui-menu-item.html +20 -20
- package/components/ui-meter/ui-meter.html +5 -5
- package/components/ui-nav-item/ui-nav-item.html +20 -20
- package/components/ui-page-header/ui-page-header.html +18 -17
- package/components/ui-popover/ui-popover.html +8 -8
- package/components/ui-radio/ui-radio.html +25 -17
- package/components/ui-radio-group/ui-radio-group.html +10 -10
- package/components/ui-reel/ui-reel.html +5 -5
- package/components/ui-scroll-area/ui-scroll-area.html +10 -10
- package/components/ui-search-result-row/ui-search-result-row.html +19 -19
- package/components/ui-search-shell/ui-search-shell.html +22 -22
- package/components/ui-section/ui-section.html +24 -23
- package/components/ui-select/ui-select.html +10 -10
- package/components/ui-separator/ui-separator.html +2 -2
- package/components/ui-sidebar/ui-sidebar.html +8 -8
- package/components/ui-spinner/ui-spinner.html +6 -6
- package/components/ui-stack/ui-stack.html +12 -12
- package/components/ui-status-message/ui-status-message.html +17 -17
- package/components/ui-swatch/ui-swatch.html +2 -2
- package/components/ui-switch/ui-switch.html +36 -26
- package/components/ui-switcher/ui-switcher.html +7 -7
- package/components/ui-table/ui-table.html +6 -6
- package/components/ui-tabs/ui-tabs.html +16 -15
- package/components/ui-text/ui-text.html +3 -2
- package/components/ui-textarea/ui-textarea.html +10 -10
- package/components/ui-toast/ui-toast.html +9 -9
- package/components/ui-toast-region/ui-toast-region.html +12 -12
- package/components/ui-tooltip/ui-tooltip.html +15 -15
- package/components/ui-top-bar/ui-top-bar.html +11 -11
- package/components/ui-tree/ui-tree.html +5 -5
- package/components/ui-tree-item/ui-tree-item.html +36 -36
- package/dist/index.js +46 -45
- package/editor/chunks/extensions.js +17 -1
- package/editor/extensions/slash-command.d.ts +1 -1
- package/editor/file-uploads.d.ts +31 -0
- package/editor/icons.d.ts +1 -0
- package/editor/index.js +2 -1
- package/package.json +3 -2
- package/styles/ui-action-bar.css +11 -11
- package/styles/ui-affordance-scope.css +2 -2
- package/styles/ui-avatar-group.css +14 -14
- package/styles/ui-avatar.css +8 -8
- package/styles/ui-badge.css +41 -41
- package/styles/ui-breadcrumb-item.css +13 -13
- package/styles/ui-breadcrumbs.css +8 -8
- package/styles/ui-button.css +30 -28
- package/styles/ui-callout.css +9 -9
- package/styles/ui-card.css +11 -11
- package/styles/ui-checkbox.css +52 -33
- package/styles/ui-cluster.css +21 -21
- package/styles/ui-color-picker.css +120 -0
- package/styles/ui-combobox.css +86 -86
- package/styles/ui-container.css +7 -7
- package/styles/ui-context-menu.css +9 -9
- package/styles/ui-cover.css +8 -8
- package/styles/ui-description-item.css +7 -7
- package/styles/ui-description-list.css +4 -4
- package/styles/ui-dialog.css +52 -52
- package/styles/ui-disclosure.css +23 -23
- package/styles/ui-editable.css +16 -16
- package/styles/ui-editor-insert-table-grid.css +9 -9
- package/styles/ui-editor-mention-menu-item.css +10 -10
- package/styles/ui-editor-mention-menu.css +23 -23
- package/styles/ui-editor-slash-menu-group.css +5 -5
- package/styles/ui-editor-slash-menu-item.css +11 -11
- package/styles/ui-editor-slash-menu.css +29 -29
- package/styles/ui-editor-surface.css +2 -2
- package/styles/ui-editor-table-context-menu.css +25 -25
- package/styles/ui-editor-table-overlay.css +13 -13
- package/styles/ui-editor-table-toolbar.css +31 -31
- package/styles/ui-editor-toolbar.css +13 -13
- package/styles/ui-floating-action-button.css +8 -8
- package/styles/ui-form-field.css +13 -13
- package/styles/ui-grid.css +4 -4
- package/styles/ui-icon-button.css +13 -13
- package/styles/ui-icon.css +2 -2
- package/styles/ui-image.css +14 -14
- package/styles/ui-input-group.css +18 -18
- package/styles/ui-input.css +8 -8
- package/styles/ui-list-item.css +18 -18
- package/styles/ui-list.css +11 -11
- package/styles/ui-listbox.css +20 -20
- package/styles/ui-menu-group.css +4 -4
- package/styles/ui-menu-item.css +20 -20
- package/styles/ui-menu.css +16 -16
- package/styles/ui-meter.css +5 -5
- package/styles/ui-nav-item.css +20 -20
- package/styles/ui-page-header.css +18 -17
- package/styles/ui-popover.css +8 -8
- package/styles/ui-radio-group.css +10 -10
- package/styles/ui-radio.css +26 -18
- package/styles/ui-reel.css +5 -5
- package/styles/ui-scroll-area.css +10 -10
- package/styles/ui-search-result-row.css +19 -19
- package/styles/ui-search-shell.css +22 -22
- package/styles/ui-section.css +24 -23
- package/styles/ui-select.css +10 -10
- package/styles/ui-separator.css +2 -2
- package/styles/ui-sidebar.css +8 -8
- package/styles/ui-spinner.css +6 -6
- package/styles/ui-stack.css +12 -12
- package/styles/ui-status-message.css +17 -17
- package/styles/ui-swatch.css +2 -2
- package/styles/ui-switch.css +36 -28
- package/styles/ui-switcher.css +7 -7
- package/styles/ui-table.css +6 -6
- package/styles/ui-tabs.css +11 -11
- package/styles/ui-text.css +3 -2
- package/styles/ui-textarea.css +10 -10
- package/styles/ui-toast-region.css +24 -24
- package/styles/ui-toast.css +18 -18
- package/styles/ui-tooltip.css +15 -15
- package/styles/ui-top-bar.css +11 -11
- package/styles/ui-tree-item.css +71 -71
- package/styles/ui-tree.css +5 -5
- package/theme-system.css +80 -0
- package/tokens.css +14 -3
- package/vanilla/UiColorPicker.d.ts +30 -0
- package/vanilla/UiColorPicker.js +77 -0
- package/vanilla/UiIcon.js +1 -1
- package/vanilla/index.js +1 -0
- package/vue/UiActionBar.vue +11 -11
- package/vue/UiAffordanceScope.vue +2 -2
- package/vue/UiAvatar.vue +8 -8
- package/vue/UiAvatarGroup.vue +14 -14
- package/vue/UiBadge.vue +43 -42
- package/vue/UiBreadcrumbItem.vue +13 -13
- package/vue/UiBreadcrumbs.vue +8 -8
- package/vue/UiButton.vue +34 -29
- package/vue/UiCallout.vue +9 -9
- package/vue/UiCard.vue +11 -11
- package/vue/UiCheckbox.vue +57 -34
- package/vue/UiCluster.vue +21 -21
- package/vue/UiColorPicker.d.ts +65 -0
- package/vue/UiColorPicker.js +2 -0
- package/vue/UiColorPicker.vue +422 -0
- package/vue/UiCombobox.vue +86 -86
- package/vue/UiContainer.vue +7 -7
- package/vue/UiContextMenu.vue +9 -9
- package/vue/UiCover.vue +8 -8
- package/vue/UiDescriptionItem.vue +7 -7
- package/vue/UiDescriptionList.vue +4 -4
- package/vue/UiDialog.vue +52 -52
- package/vue/UiDisclosure.vue +23 -23
- package/vue/UiEditable.vue +16 -16
- package/vue/UiEditorInsertTableGrid.vue +9 -9
- package/vue/UiEditorMentionMenu.vue +23 -23
- package/vue/UiEditorMentionMenuItem.vue +10 -10
- package/vue/UiEditorSlashMenu.vue +29 -29
- package/vue/UiEditorSlashMenuGroup.vue +5 -5
- package/vue/UiEditorSlashMenuItem.vue +11 -11
- package/vue/UiEditorSurface.vue +2 -2
- package/vue/UiEditorTableContextMenu.vue +25 -25
- package/vue/UiEditorTableOverlay.vue +13 -13
- package/vue/UiEditorTableToolbar.vue +31 -31
- package/vue/UiEditorToolbar.vue +13 -13
- package/vue/UiFloatingActionButton.vue +8 -8
- package/vue/UiFormField.vue +14 -14
- package/vue/UiGrid.vue +4 -4
- package/vue/UiIcon.vue +6 -2
- package/vue/UiIconButton.vue +14 -14
- package/vue/UiImage.vue +14 -14
- package/vue/UiInput.vue +9 -8
- package/vue/UiInputGroup.vue +18 -18
- package/vue/UiList.vue +11 -11
- package/vue/UiListItem.vue +18 -18
- package/vue/UiListbox.vue +20 -20
- package/vue/UiMenu.vue +16 -16
- package/vue/UiMenuGroup.vue +4 -4
- package/vue/UiMenuItem.vue +20 -20
- package/vue/UiMeter.vue +5 -5
- package/vue/UiNavItem.vue +20 -20
- package/vue/UiPageHeader.vue +18 -17
- package/vue/UiPopover.vue +8 -8
- package/vue/UiRadio.vue +28 -17
- package/vue/UiRadioGroup.vue +10 -10
- package/vue/UiReel.vue +5 -5
- package/vue/UiScrollArea.vue +10 -10
- package/vue/UiSearchResultRow.vue +19 -19
- package/vue/UiSearchShell.vue +22 -22
- package/vue/UiSection.vue +24 -23
- package/vue/UiSelect.vue +11 -10
- package/vue/UiSeparator.vue +2 -2
- package/vue/UiSidebar.vue +8 -8
- package/vue/UiSpinner.vue +6 -6
- package/vue/UiStack.vue +12 -12
- package/vue/UiStatusMessage.vue +17 -17
- package/vue/UiSwatch.vue +2 -2
- package/vue/UiSwitch.vue +38 -25
- package/vue/UiSwitcher.vue +7 -7
- package/vue/UiTable.vue +6 -6
- package/vue/UiTabs.vue +13 -13
- package/vue/UiText.vue +3 -2
- package/vue/UiTextarea.vue +10 -10
- package/vue/UiToast.vue +18 -18
- package/vue/UiToastRegion.vue +24 -24
- package/vue/UiTooltip.vue +15 -15
- package/vue/UiTopBar.vue +11 -11
- package/vue/UiTree.vue +5 -5
- package/vue/UiTreeItem.vue +73 -71
- package/vue/chunks/UiActionBar.js +1 -1
- package/vue/chunks/UiAffordanceScope.js +1 -1
- package/vue/chunks/UiAvatar.js +1 -1
- package/vue/chunks/UiAvatarGroup.js +1 -1
- package/vue/chunks/UiBadge.js +2 -2
- package/vue/chunks/UiBreadcrumbItem.js +1 -1
- package/vue/chunks/UiBreadcrumbs.js +1 -1
- package/vue/chunks/UiButton.js +2 -2
- package/vue/chunks/UiCallout.js +1 -1
- package/vue/chunks/UiCard.js +1 -1
- package/vue/chunks/UiCheckbox.js +1 -1
- package/vue/chunks/UiCluster.js +1 -1
- package/vue/chunks/UiColorPicker.js +326 -0
- package/vue/chunks/UiCombobox.js +1 -1
- package/vue/chunks/UiContainer.js +1 -1
- package/vue/chunks/UiContextMenu.js +1 -1
- package/vue/chunks/UiCover.js +1 -1
- package/vue/chunks/UiDescriptionItem.js +1 -1
- package/vue/chunks/UiDescriptionList.js +1 -1
- package/vue/chunks/UiDialog.js +1 -1
- package/vue/chunks/UiDisclosure.js +1 -1
- package/vue/chunks/UiEditable.js +1 -1
- package/vue/chunks/UiEditorImageToolbar.js +1 -1
- package/vue/chunks/UiEditorInsertTableGrid.js +1 -1
- package/vue/chunks/UiEditorLinkForm.js +1 -1
- package/vue/chunks/UiEditorMentionMenu.js +1 -1
- package/vue/chunks/UiEditorMentionMenuItem.js +1 -1
- package/vue/chunks/UiEditorSlashMenu.js +1 -1
- package/vue/chunks/UiEditorSlashMenuGroup.js +1 -1
- package/vue/chunks/UiEditorSlashMenuItem.js +1 -1
- package/vue/chunks/UiEditorSurface.js +1 -1
- package/vue/chunks/UiEditorTableContextMenu.js +1 -1
- package/vue/chunks/UiEditorTableOverlay.js +1 -1
- package/vue/chunks/UiEditorTableToolbar.js +1 -1
- package/vue/chunks/UiEditorToolbar.js +1 -1
- package/vue/chunks/UiFloatingActionButton.js +1 -1
- package/vue/chunks/UiFormField.js +2 -2
- package/vue/chunks/UiGrid.js +1 -1
- package/vue/chunks/UiIcon.js +5 -1
- package/vue/chunks/UiIconButton.js +2 -2
- package/vue/chunks/UiImage.js +1 -1
- package/vue/chunks/UiInput.js +1 -1
- package/vue/chunks/UiInputGroup.js +1 -1
- package/vue/chunks/UiList.js +1 -1
- package/vue/chunks/UiListItem.js +1 -1
- package/vue/chunks/UiListbox.js +1 -1
- package/vue/chunks/UiMenu.js +1 -1
- package/vue/chunks/UiMenuGroup.js +1 -1
- package/vue/chunks/UiMenuItem.js +1 -1
- package/vue/chunks/UiMeter.js +1 -1
- package/vue/chunks/UiNavItem.js +1 -1
- package/vue/chunks/UiPageHeader.js +1 -1
- package/vue/chunks/UiPopover.js +1 -1
- package/vue/chunks/UiRadio.js +1 -1
- package/vue/chunks/UiRadioGroup.js +1 -1
- package/vue/chunks/UiReel.js +1 -1
- package/vue/chunks/UiScrollArea.js +1 -1
- package/vue/chunks/UiSearchResultRow.js +1 -1
- package/vue/chunks/UiSearchShell.js +1 -1
- package/vue/chunks/UiSection.js +1 -1
- package/vue/chunks/UiSelect.js +1 -1
- package/vue/chunks/UiSeparator.js +1 -1
- package/vue/chunks/UiSidebar.js +1 -1
- package/vue/chunks/UiSpinner.js +1 -1
- package/vue/chunks/UiStack.js +1 -1
- package/vue/chunks/UiStatusMessage.js +1 -1
- package/vue/chunks/UiSwatch.js +1 -1
- package/vue/chunks/UiSwitch.js +1 -1
- package/vue/chunks/UiSwitcher.js +1 -1
- package/vue/chunks/UiTable.js +1 -1
- package/vue/chunks/UiTabs.js +3 -3
- package/vue/chunks/UiText.js +1 -1
- package/vue/chunks/UiTextarea.js +1 -1
- package/vue/chunks/UiToast.js +1 -1
- package/vue/chunks/UiToastRegion.js +1 -1
- package/vue/chunks/UiTooltip.js +1 -1
- package/vue/chunks/UiTopBar.js +1 -1
- package/vue/chunks/UiTree.js +1 -1
- package/vue/chunks/UiTreeItem.js +1 -1
- package/vue/components.css +1857 -1654
- package/vue/editor/LoomaEditor.d.ts +18 -2
- package/vue/editor/index.d.ts +2 -1
- package/vue/editor/index.js +147 -16
- package/vue/index.d.ts +1 -0
- package/vue/index.js +3 -2
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
<!-- Generated by HTML Next 1.0.0-alpha.69 for Vue 3.5. Do not edit. -->
|
|
2
|
+
<script setup lang="ts">
|
|
3
|
+
import { computed, getCurrentInstance, ref, useTemplateRef, watchSyncEffect } from 'vue'
|
|
4
|
+
import type { PropType } from 'vue'
|
|
5
|
+
import {
|
|
6
|
+
checkHydratedRoot,
|
|
7
|
+
createDispatch,
|
|
8
|
+
nativeAttrs,
|
|
9
|
+
useComponentHost,
|
|
10
|
+
useReflectedProp,
|
|
11
|
+
} from './host'
|
|
12
|
+
import {
|
|
13
|
+
BINDING_INPUTS_PROP,
|
|
14
|
+
checkedProp,
|
|
15
|
+
checkPropInput,
|
|
16
|
+
type InputBindings,
|
|
17
|
+
propValidityState,
|
|
18
|
+
READY_INPUT,
|
|
19
|
+
requireInputStatus,
|
|
20
|
+
UNRESOLVED_INPUT,
|
|
21
|
+
vPropValidity,
|
|
22
|
+
vuePropInputs,
|
|
23
|
+
} from './props'
|
|
24
|
+
import UiInput from './UiInput.vue'
|
|
25
|
+
|
|
26
|
+
defineOptions({ inheritAttrs: false })
|
|
27
|
+
|
|
28
|
+
const propValidityContract = {
|
|
29
|
+
props: {
|
|
30
|
+
disabled: {
|
|
31
|
+
type: { kind: 'terminal', name: 'boolean' },
|
|
32
|
+
required: false,
|
|
33
|
+
target: { attribute: 'disabled' },
|
|
34
|
+
description: 'Prevents opening and editing.',
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
label: {
|
|
38
|
+
type: { kind: 'terminal', name: 'string' },
|
|
39
|
+
required: false,
|
|
40
|
+
target: { attribute: 'aria-label' },
|
|
41
|
+
description: 'Accessible name for the swatch button and editor.',
|
|
42
|
+
default: 'Choose colour',
|
|
43
|
+
},
|
|
44
|
+
name: {
|
|
45
|
+
type: { kind: 'terminal', name: 'string' },
|
|
46
|
+
required: false,
|
|
47
|
+
target: { attribute: 'name' },
|
|
48
|
+
description:
|
|
49
|
+
'The form field name. Leave empty to omit the colour from form submission. A form reset restores value.',
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
round: {
|
|
53
|
+
type: { kind: 'terminal', name: 'boolean' },
|
|
54
|
+
required: false,
|
|
55
|
+
target: { attribute: 'round' },
|
|
56
|
+
description: 'Makes the square swatch circular.',
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
size: {
|
|
60
|
+
type: { kind: 'terminal', name: 'keyword' },
|
|
61
|
+
required: false,
|
|
62
|
+
target: { attribute: 'size' },
|
|
63
|
+
description: 'Shared control height, matching Input and Button of the same size.',
|
|
64
|
+
values: ['sm', 'md', 'lg'],
|
|
65
|
+
default: 'md',
|
|
66
|
+
},
|
|
67
|
+
value: {
|
|
68
|
+
type: { kind: 'terminal', name: 'string' },
|
|
69
|
+
required: false,
|
|
70
|
+
target: { attribute: 'value' },
|
|
71
|
+
description:
|
|
72
|
+
'An opaque sRGB colour as six hexadecimal digits prefixed with #. User edits emit input and change with detail.value. Invalid values are ignored. This\n control does not submit a named form value.',
|
|
73
|
+
default: '#000000',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
} as const
|
|
77
|
+
const props = defineProps({
|
|
78
|
+
disabled: { type: null as unknown as PropType<boolean | null> },
|
|
79
|
+
label: { type: null as unknown as PropType<string | null> },
|
|
80
|
+
name: { type: null as unknown as PropType<string | null> },
|
|
81
|
+
round: { type: null as unknown as PropType<boolean | null> },
|
|
82
|
+
size: { type: null as unknown as PropType<'sm' | 'md' | 'lg' | null> },
|
|
83
|
+
value: { type: null as unknown as PropType<string | null> },
|
|
84
|
+
[BINDING_INPUTS_PROP]: { type: null as unknown as PropType<InputBindings> },
|
|
85
|
+
})
|
|
86
|
+
const acceptedProps: Record<string, unknown> = {
|
|
87
|
+
disabled: false,
|
|
88
|
+
label: 'Choose colour',
|
|
89
|
+
name: '',
|
|
90
|
+
round: false,
|
|
91
|
+
size: 'md',
|
|
92
|
+
value: '#000000',
|
|
93
|
+
}
|
|
94
|
+
const inputTracking = vuePropInputs(acceptedProps, {
|
|
95
|
+
disabled: false,
|
|
96
|
+
label: 'Choose colour',
|
|
97
|
+
name: '',
|
|
98
|
+
round: false,
|
|
99
|
+
size: 'md',
|
|
100
|
+
value: '#000000',
|
|
101
|
+
}, (name, value, source, values) => {
|
|
102
|
+
switch (name) {
|
|
103
|
+
case 'disabled':
|
|
104
|
+
return checkPropInput(value, { kind: 'terminal', name: 'boolean' }, true, true)
|
|
105
|
+
case 'label':
|
|
106
|
+
return checkPropInput(value, { kind: 'terminal', name: 'string' }, true, true)
|
|
107
|
+
case 'name':
|
|
108
|
+
return checkPropInput(value, { kind: 'terminal', name: 'string' }, true, true)
|
|
109
|
+
case 'round':
|
|
110
|
+
return checkPropInput(value, { kind: 'terminal', name: 'boolean' }, true, true)
|
|
111
|
+
case 'size':
|
|
112
|
+
return checkPropInput(value, { kind: 'terminal', name: 'keyword' }, true, true)
|
|
113
|
+
case 'value':
|
|
114
|
+
return checkPropInput(value, { kind: 'terminal', name: 'string' }, true, true)
|
|
115
|
+
default:
|
|
116
|
+
return { ok: false }
|
|
117
|
+
}
|
|
118
|
+
}, () => {
|
|
119
|
+
void checkedProps.value
|
|
120
|
+
})
|
|
121
|
+
const propInputs = inputTracking.inputs
|
|
122
|
+
const checkedProps = computed(() => {
|
|
123
|
+
void inputTracking.version.value
|
|
124
|
+
return ({
|
|
125
|
+
disabled: propInputs.value<boolean | null>(
|
|
126
|
+
'disabled',
|
|
127
|
+
props['disabled'],
|
|
128
|
+
props[BINDING_INPUTS_PROP],
|
|
129
|
+
) as boolean,
|
|
130
|
+
label: propInputs.value<string | null>(
|
|
131
|
+
'label',
|
|
132
|
+
props['label'],
|
|
133
|
+
props[BINDING_INPUTS_PROP],
|
|
134
|
+
) as string,
|
|
135
|
+
name: propInputs.value<string | null>(
|
|
136
|
+
'name',
|
|
137
|
+
props['name'],
|
|
138
|
+
props[BINDING_INPUTS_PROP],
|
|
139
|
+
) as string,
|
|
140
|
+
round: propInputs.value<boolean | null>(
|
|
141
|
+
'round',
|
|
142
|
+
props['round'],
|
|
143
|
+
props[BINDING_INPUTS_PROP],
|
|
144
|
+
) as boolean,
|
|
145
|
+
size: propInputs.value<'sm' | 'md' | 'lg' | null>(
|
|
146
|
+
'size',
|
|
147
|
+
props['size'],
|
|
148
|
+
props[BINDING_INPUTS_PROP],
|
|
149
|
+
) as 'sm' | 'md' | 'lg',
|
|
150
|
+
value: propInputs.value<string | null>(
|
|
151
|
+
'value',
|
|
152
|
+
props['value'],
|
|
153
|
+
props[BINDING_INPUTS_PROP],
|
|
154
|
+
) as string,
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
const inputStatus = (name: string, handlesError: boolean) => {
|
|
158
|
+
void checkedProps.value
|
|
159
|
+
void inputTracking.version.value
|
|
160
|
+
return requireInputStatus(propInputs.status(name), handlesError)
|
|
161
|
+
}
|
|
162
|
+
void checkedProps.value
|
|
163
|
+
watchSyncEffect(() => {
|
|
164
|
+
void checkedProps.value
|
|
165
|
+
})
|
|
166
|
+
const reflectedProp = useReflectedProp()
|
|
167
|
+
const hydrationInstance = getCurrentInstance()
|
|
168
|
+
const emit = defineEmits<{
|
|
169
|
+
'update:value': [value: string]
|
|
170
|
+
input: [event: CustomEvent<{ readonly value: string }>]
|
|
171
|
+
change: [event: CustomEvent<{ readonly value: string }>]
|
|
172
|
+
}>()
|
|
173
|
+
|
|
174
|
+
const root = ref<HTMLElement | null>(null)
|
|
175
|
+
const fieldElement = useTemplateRef<HTMLElement>('fieldElement')
|
|
176
|
+
const triggerElement = useTemplateRef<HTMLElement>('triggerElement')
|
|
177
|
+
const colourElement = useTemplateRef<HTMLElement>('colourElement')
|
|
178
|
+
const editorElement = useTemplateRef<HTMLElement>('editorElement')
|
|
179
|
+
const redElement = useTemplateRef<HTMLElement>('redElement')
|
|
180
|
+
const greenElement = useTemplateRef<HTMLElement>('greenElement')
|
|
181
|
+
const blueElement = useTemplateRef<HTMLElement>('blueElement')
|
|
182
|
+
const hexElement = useTemplateRef<HTMLElement>('hexElement')
|
|
183
|
+
checkHydratedRoot('span', 'ui-color-picker')
|
|
184
|
+
|
|
185
|
+
/** The values the styles' :host() and :state() rules test. */
|
|
186
|
+
const hostState = computed(() =>
|
|
187
|
+
[
|
|
188
|
+
checkedProps.value.size && 'size',
|
|
189
|
+
checkedProps.value.size != null && `size=${encodeURIComponent(checkedProps.value.size)}`,
|
|
190
|
+
checkedProps.value.round && 'round',
|
|
191
|
+
].filter(Boolean).join(' ')
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
const isInputDetail = (
|
|
195
|
+
detail: unknown,
|
|
196
|
+
): boolean => (detail !== null && typeof detail === 'object' && !Array.isArray(detail)
|
|
197
|
+
&& typeof (detail as Record<string, unknown>)['value'] === 'string'
|
|
198
|
+
&& Object.keys(detail as object).every((key) => ['value'].includes(key)))
|
|
199
|
+
const dispatch = createDispatch(root, emit as (name: string, detail: unknown) => void, {
|
|
200
|
+
checks: {
|
|
201
|
+
input: isInputDetail,
|
|
202
|
+
change: isInputDetail,
|
|
203
|
+
},
|
|
204
|
+
modeled: ['value'],
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
useComponentHost(() => import('../components/ui-color-picker/ui-color-picker.js'), {
|
|
208
|
+
root,
|
|
209
|
+
module: true,
|
|
210
|
+
dispatch,
|
|
211
|
+
controllerSource: {
|
|
212
|
+
specifier: '../components/ui-color-picker/ui-color-picker.js',
|
|
213
|
+
definition: './components/ui-color-picker/ui-color-picker.html',
|
|
214
|
+
},
|
|
215
|
+
props: checkedProps,
|
|
216
|
+
inputs: propInputs,
|
|
217
|
+
inputTracking,
|
|
218
|
+
propInputs: (name: string) => {
|
|
219
|
+
const incoming = hydrationInstance?.vnode.props
|
|
220
|
+
const kebab = name.replace(/[A-Z]/g, (letter) => '-' + letter.toLowerCase())
|
|
221
|
+
return incoming !== null && incoming !== undefined
|
|
222
|
+
? (incoming[name] ?? incoming[kebab] ?? null)
|
|
223
|
+
: null
|
|
224
|
+
},
|
|
225
|
+
propNames: ['disabled', 'label', 'name', 'round', 'size', 'value'],
|
|
226
|
+
propValidity: (name: string) =>
|
|
227
|
+
propValidityState({ contract: propValidityContract, values: { ...props } }, name),
|
|
228
|
+
refs: {
|
|
229
|
+
field: fieldElement,
|
|
230
|
+
trigger: triggerElement,
|
|
231
|
+
colour: colourElement,
|
|
232
|
+
editor: editorElement,
|
|
233
|
+
red: redElement,
|
|
234
|
+
green: greenElement,
|
|
235
|
+
blue: blueElement,
|
|
236
|
+
hex: hexElement,
|
|
237
|
+
},
|
|
238
|
+
})
|
|
239
|
+
</script>
|
|
240
|
+
|
|
241
|
+
<template>
|
|
242
|
+
<span
|
|
243
|
+
class="ui-color-picker"
|
|
244
|
+
v-bind="nativeAttrs($attrs)"
|
|
245
|
+
data-hn
|
|
246
|
+
v-prop-validity="{ contract: propValidityContract, values: { ...props } }"
|
|
247
|
+
:data-ui-color-picker-prop-disabled="reflectedProp('disabled', 'disabled', checkedProps.disabled, undefined, false)"
|
|
248
|
+
:data-ui-color-picker-prop-label="reflectedProp('label', 'label', checkedProps.label, undefined, false)"
|
|
249
|
+
:data-ui-color-picker-prop-name="reflectedProp('name', 'name', checkedProps.name, undefined, false)"
|
|
250
|
+
:data-ui-color-picker-prop-round="reflectedProp('round', 'round', checkedProps.round, undefined, false)"
|
|
251
|
+
:data-ui-color-picker-prop-size="reflectedProp('size', 'size', checkedProps.size, undefined, false)"
|
|
252
|
+
:data-ui-color-picker-prop-value="reflectedProp('value', 'value', checkedProps.value, undefined, false)"
|
|
253
|
+
:data-ui-color-picker-state="hostState || undefined"
|
|
254
|
+
ref="root"
|
|
255
|
+
><input
|
|
256
|
+
type="hidden"
|
|
257
|
+
data-ui-field-value=""
|
|
258
|
+
:name="checkedProps.name ?? undefined"
|
|
259
|
+
:disabled="checkedProps.disabled ?? undefined"
|
|
260
|
+
ref="fieldElement"
|
|
261
|
+
>{{ ' ' }}<button
|
|
262
|
+
data-ui-field-control=""
|
|
263
|
+
type="button"
|
|
264
|
+
aria-haspopup="dialog"
|
|
265
|
+
aria-expanded="false"
|
|
266
|
+
:aria-label="checkedProps.label ?? undefined"
|
|
267
|
+
:disabled="checkedProps.disabled ?? undefined"
|
|
268
|
+
ref="triggerElement"
|
|
269
|
+
>
|
|
270
|
+
<span class="colour" ref="colourElement"></span>
|
|
271
|
+
</button>{{ ' ' }}<span
|
|
272
|
+
class="editor"
|
|
273
|
+
hidden=""
|
|
274
|
+
role="dialog"
|
|
275
|
+
:aria-label="checkedProps.label ?? undefined"
|
|
276
|
+
ref="editorElement"
|
|
277
|
+
><label class="channel">Red<input
|
|
278
|
+
type="range"
|
|
279
|
+
min="0"
|
|
280
|
+
max="255"
|
|
281
|
+
aria-label="Red"
|
|
282
|
+
ref="redElement"
|
|
283
|
+
></label>{{ ' ' }}<label class="channel">Green<input
|
|
284
|
+
type="range"
|
|
285
|
+
min="0"
|
|
286
|
+
max="255"
|
|
287
|
+
aria-label="Green"
|
|
288
|
+
ref="greenElement"
|
|
289
|
+
></label>{{ ' ' }}<label class="channel">Blue<input
|
|
290
|
+
type="range"
|
|
291
|
+
min="0"
|
|
292
|
+
max="255"
|
|
293
|
+
aria-label="Blue"
|
|
294
|
+
ref="blueElement"
|
|
295
|
+
></label>{{ ' ' }}<UiInput
|
|
296
|
+
class="ui-input"
|
|
297
|
+
size="sm"
|
|
298
|
+
aria-label="Hex colour"
|
|
299
|
+
maxlength="7"
|
|
300
|
+
spellcheck="false"
|
|
301
|
+
ref="hexElement"
|
|
302
|
+
/></span></span>
|
|
303
|
+
</template>
|
|
304
|
+
|
|
305
|
+
<style scoped>
|
|
306
|
+
@scope (.ui-color-picker) to ([data-hn]) {
|
|
307
|
+
:global(:scope) {
|
|
308
|
+
display: inline-flex !important;
|
|
309
|
+
flex: 0 0 auto;
|
|
310
|
+
margin: 0 !important;
|
|
311
|
+
padding: 0 !important;
|
|
312
|
+
--_size: var(--ui-control-size-md);
|
|
313
|
+
--_font: 1em;
|
|
314
|
+
--_padding: var(--ui-control-inset-block-md, var(--ui-space-2));
|
|
315
|
+
}
|
|
316
|
+
:global(:scope[data-ui-color-picker-state~="size=sm"]) {
|
|
317
|
+
--_size: var(--ui-control-size-sm);
|
|
318
|
+
--_font: var(--ui-font-size-sm);
|
|
319
|
+
--_padding: var(--ui-control-inset-block-sm, var(--ui-space-1));
|
|
320
|
+
}
|
|
321
|
+
:global(:scope[data-ui-color-picker-state~="size=lg"]) {
|
|
322
|
+
--_size: var(--ui-control-size-lg);
|
|
323
|
+
--_font: var(--ui-font-size-md);
|
|
324
|
+
--_padding: var(--ui-control-inset-block-lg, var(--ui-space-3));
|
|
325
|
+
}
|
|
326
|
+
:global(button) {
|
|
327
|
+
--_radius: min(var(--ui-field-radius, var(--ui-radius-md)), calc(var(--_size) / 4));
|
|
328
|
+
--_inset: min(calc(var(--ui-space-1) * 1.5), calc(var(--_size) / 5));
|
|
329
|
+
box-sizing: border-box !important;
|
|
330
|
+
display: inline-grid !important;
|
|
331
|
+
place-items: center;
|
|
332
|
+
margin: 0 !important;
|
|
333
|
+
padding: var(--_inset) !important;
|
|
334
|
+
inline-size: max(
|
|
335
|
+
var(--_size),
|
|
336
|
+
calc(
|
|
337
|
+
var(--_font) * var(--ui-line-height-tight) + var(--_padding) * 2 +
|
|
338
|
+
var(--ui-border-width) * 2
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
aspect-ratio: 1;
|
|
342
|
+
flex: 0 0 auto;
|
|
343
|
+
border: var(--ui-border-width) solid var(--ui-control-border, var(--ui-border-strong));
|
|
344
|
+
border-radius: var(--_radius);
|
|
345
|
+
background: var(--ui-control-surface, var(--ui-surface-elevated));
|
|
346
|
+
box-shadow: var(--ui-control-inset);
|
|
347
|
+
font: inherit;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
transition:
|
|
350
|
+
background-color var(--ui-motion-fast) var(--ui-motion-ease),
|
|
351
|
+
scale var(--ui-motion-press, var(--ui-motion-fast)) var(--ui-motion-ease);
|
|
352
|
+
}
|
|
353
|
+
:global(button:hover:not(:disabled)) {
|
|
354
|
+
background: var(--ui-surface-subtle);
|
|
355
|
+
}
|
|
356
|
+
:global(button:active:not(:disabled)) {
|
|
357
|
+
scale: var(--ui-press-scale, 0.96);
|
|
358
|
+
}
|
|
359
|
+
:global(button:focus-visible) {
|
|
360
|
+
outline: var(--ui-focus-width) solid var(--ui-focus-ring, var(--ui-accent-solid));
|
|
361
|
+
outline-offset: var(--ui-focus-width);
|
|
362
|
+
}
|
|
363
|
+
:global(button:disabled) {
|
|
364
|
+
opacity: 0.5;
|
|
365
|
+
cursor: not-allowed;
|
|
366
|
+
}
|
|
367
|
+
:global(.colour) {
|
|
368
|
+
display: block !important;
|
|
369
|
+
inline-size: 100%;
|
|
370
|
+
block-size: 100%;
|
|
371
|
+
border-radius: max(0px, calc(var(--_radius) - var(--_inset) - var(--ui-border-width)));
|
|
372
|
+
box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
|
|
373
|
+
}
|
|
374
|
+
:global(:scope[data-ui-color-picker-state~="round"] button) {
|
|
375
|
+
border-radius: 50%;
|
|
376
|
+
}
|
|
377
|
+
:global(:scope[data-ui-color-picker-state~="round"] .colour) {
|
|
378
|
+
border-radius: 50%;
|
|
379
|
+
}
|
|
380
|
+
:global(.editor) {
|
|
381
|
+
box-sizing: border-box !important;
|
|
382
|
+
display: grid !important;
|
|
383
|
+
gap: var(--ui-space-3) !important;
|
|
384
|
+
padding: var(--ui-space-4) !important;
|
|
385
|
+
margin: 0 !important;
|
|
386
|
+
inline-size: min(18rem, calc(100vw - 1rem));
|
|
387
|
+
border: var(--ui-border-width) solid var(--ui-border-strong);
|
|
388
|
+
border-radius: var(--ui-radius-md);
|
|
389
|
+
background: var(--ui-surface-elevated);
|
|
390
|
+
color: var(--ui-text-primary);
|
|
391
|
+
box-shadow: var(--ui-shadow-lg);
|
|
392
|
+
font: inherit;
|
|
393
|
+
}
|
|
394
|
+
:global(.editor[hidden]) {
|
|
395
|
+
display: none !important;
|
|
396
|
+
}
|
|
397
|
+
:global(.channel) {
|
|
398
|
+
display: grid !important;
|
|
399
|
+
grid-template-columns: 3.5em 1fr;
|
|
400
|
+
align-items: center !important;
|
|
401
|
+
gap: var(--ui-space-2) !important;
|
|
402
|
+
padding: 0 !important;
|
|
403
|
+
margin: 0 !important;
|
|
404
|
+
}
|
|
405
|
+
:global(input[type="range"]) {
|
|
406
|
+
inline-size: 100%;
|
|
407
|
+
min-inline-size: 0;
|
|
408
|
+
margin: 0 !important;
|
|
409
|
+
padding: 0 !important;
|
|
410
|
+
accent-color: var(--ui-accent-solid);
|
|
411
|
+
}
|
|
412
|
+
@media (pointer: coarse) {
|
|
413
|
+
:global(:scope) {
|
|
414
|
+
--_size: max(var(--ui-control-size-md), var(--ui-control-min-block-size));
|
|
415
|
+
}
|
|
416
|
+
:global(:scope[data-ui-color-picker-state~="size=sm"]) {
|
|
417
|
+
--_size: var(--ui-control-min-block-size);
|
|
418
|
+
--_font: var(--ui-font-size-md);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
</style>
|