@threadlabs/looma 0.14.8 → 0.15.1
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 +5 -0
- package/components/shared/menu-navigation.js +49 -0
- package/components/shared/overlay.js +33 -60
- package/components/ui-avatar/ui-avatar.html +19 -2
- package/components/ui-avatar/ui-avatar.js +7 -1
- package/components/ui-avatar-group/ui-avatar-group.html +8 -3
- package/components/ui-avatar-group/ui-avatar-group.js +6 -2
- package/components/ui-badge/ui-badge.html +70 -4
- package/components/ui-button/ui-button.html +21 -5
- package/components/ui-button/ui-button.js +10 -0
- package/components/ui-callout/ui-callout.html +13 -5
- package/components/ui-checkbox/ui-checkbox.html +11 -0
- package/components/ui-cluster/ui-cluster.html +7 -0
- package/components/ui-combobox/ui-combobox.html +46 -10
- package/components/ui-combobox/ui-combobox.js +5 -5
- package/components/ui-context-menu/ui-context-menu.html +33 -5
- package/components/ui-context-menu/ui-context-menu.js +26 -17
- package/components/ui-dialog/ui-dialog.html +51 -8
- package/components/ui-dialog/ui-dialog.js +28 -7
- package/components/ui-disclosure/ui-disclosure.html +14 -5
- package/components/ui-disclosure/ui-disclosure.js +51 -4
- package/components/ui-editable/ui-editable.html +17 -3
- package/components/ui-editable/ui-editable.js +7 -0
- package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.html +48 -14
- package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.js +40 -6
- package/components/ui-editor-mention-menu/ui-editor-mention-menu.html +22 -9
- package/components/ui-editor-mention-menu/ui-editor-mention-menu.js +33 -11
- package/components/ui-editor-mention-menu-item/ui-editor-mention-menu-item.html +67 -0
- package/components/ui-editor-slash-menu/ui-editor-slash-menu.html +33 -30
- package/components/ui-editor-slash-menu/ui-editor-slash-menu.js +42 -8
- package/components/ui-editor-slash-menu-group/ui-editor-slash-menu-group.html +31 -0
- package/components/ui-editor-slash-menu-item/ui-editor-slash-menu-item.html +75 -0
- package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.html +16 -5
- package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.js +10 -2
- package/components/ui-editor-table-overlay/ui-editor-table-overlay.html +5 -5
- package/components/ui-editor-table-overlay/ui-editor-table-overlay.js +5 -2
- package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.html +14 -4
- package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.js +2 -2
- package/components/ui-editor-toolbar/ui-editor-toolbar.html +1 -1
- package/components/ui-editor-toolbar/ui-editor-toolbar.js +46 -0
- package/components/ui-floating-action-button/ui-floating-action-button.html +1 -1
- package/components/ui-form-field/ui-form-field.html +16 -3
- package/components/ui-form-field/ui-form-field.js +1 -1
- package/components/ui-grid/ui-grid.html +17 -2
- package/components/ui-icon/ui-icon.html +5 -0
- package/components/ui-icon-button/ui-icon-button.html +25 -6
- package/components/ui-icon-button/ui-icon-button.js +11 -1
- package/components/ui-input/ui-input.html +3 -3
- package/components/ui-input-group/ui-input-group.html +18 -4
- package/components/ui-listbox/ui-listbox.html +81 -0
- package/components/ui-listbox/ui-listbox.js +27 -0
- package/components/ui-menu/ui-menu.html +33 -5
- package/components/ui-menu/ui-menu.js +18 -12
- package/components/ui-menu-group/ui-menu-group.html +27 -0
- package/components/ui-menu-item/ui-menu-item.html +80 -8
- package/components/ui-menu-item/ui-menu-item.js +47 -0
- package/components/ui-popover/ui-popover.html +33 -5
- package/components/ui-popover/ui-popover.js +9 -1
- package/components/ui-radio-group/ui-radio-group.html +13 -1
- package/components/ui-search-shell/ui-search-shell.html +6 -6
- package/components/ui-search-shell/ui-search-shell.js +21 -5
- package/components/ui-select/ui-select.html +14 -4
- package/components/ui-switch/ui-switch.html +2 -2
- package/components/ui-switcher/ui-switcher.html +8 -1
- package/components/ui-switcher/ui-switcher.js +15 -0
- package/components/ui-tabs/ui-tabs.html +17 -12
- package/components/ui-tabs/ui-tabs.js +43 -7
- package/components/ui-textarea/ui-textarea.html +28 -5
- package/components/ui-toast/ui-toast.html +88 -0
- package/components/ui-toast/ui-toast.js +68 -0
- package/components/ui-toast-region/ui-toast-region.html +102 -19
- package/components/ui-toast-region/ui-toast-region.js +10 -18
- package/components/ui-tooltip/ui-tooltip.html +51 -7
- package/components/ui-tooltip/ui-tooltip.js +29 -3
- package/components/ui-tree/ui-tree.html +12 -0
- package/components/ui-tree/ui-tree.js +191 -12
- package/components/ui-tree-item/ui-tree-item.html +87 -8
- package/components/ui-tree-item/ui-tree-item.js +3 -1
- package/dist/index.js +38 -32
- package/editor/chunks/extensions.js +82 -2
- package/editor/extensions/table-commands.d.ts +8 -0
- package/editor/icons.d.ts +5 -0
- package/editor/index.js +7 -2
- package/editor/insert-table-grid.d.ts +1 -1
- package/editor/mention-menu.d.ts +2 -0
- package/editor/slash-menu.d.ts +3 -0
- package/editor/table-context-menu.d.ts +1 -1
- package/editor/table-overlay.d.ts +2 -2
- package/package.json +1 -1
- package/styles/ui-avatar-group.css +1 -2
- package/styles/ui-avatar.css +11 -1
- package/styles/ui-badge.css +73 -1
- package/styles/ui-button.css +9 -1
- package/styles/ui-callout.css +1 -1
- package/styles/ui-checkbox.css +9 -0
- package/styles/ui-cluster.css +3 -0
- package/styles/ui-combobox.css +38 -7
- package/styles/ui-context-menu.css +32 -4
- package/styles/ui-dialog.css +42 -5
- package/styles/ui-editor-insert-table-grid.css +48 -11
- package/styles/ui-editor-mention-menu-item.css +57 -0
- package/styles/ui-editor-mention-menu.css +11 -1
- package/styles/ui-editor-slash-menu-group.css +21 -0
- package/styles/ui-editor-slash-menu-item.css +62 -0
- package/styles/ui-editor-slash-menu.css +10 -21
- package/styles/ui-editor-table-context-menu.css +1 -1
- package/styles/ui-floating-action-button.css +1 -1
- package/styles/ui-form-field.css +14 -1
- package/styles/ui-grid.css +14 -1
- package/styles/ui-icon-button.css +17 -5
- package/styles/ui-input-group.css +18 -4
- package/styles/ui-input.css +3 -3
- package/styles/ui-listbox.css +69 -0
- package/styles/ui-menu-group.css +19 -0
- package/styles/ui-menu-item.css +48 -9
- package/styles/ui-menu.css +32 -4
- package/styles/ui-popover.css +28 -4
- package/styles/ui-radio-group.css +9 -0
- package/styles/ui-search-shell.css +5 -5
- package/styles/ui-select.css +14 -4
- package/styles/ui-switch.css +2 -2
- package/styles/ui-switcher.css +4 -0
- package/styles/ui-textarea.css +27 -4
- package/styles/ui-toast-region.css +88 -4
- package/styles/ui-toast.css +74 -0
- package/styles/ui-tooltip.css +46 -6
- package/styles/ui-tree-item.css +72 -4
- package/styles/ui-tree.css +8 -0
- package/tokens.css +3 -0
- package/vanilla/UiAvatar.d.ts +2 -0
- package/vanilla/UiAvatar.js +8 -1
- package/vanilla/UiAvatarGroup.d.ts +2 -0
- package/vanilla/UiAvatarGroup.js +1 -1
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +1 -1
- package/vanilla/UiButton.d.ts +1 -0
- package/vanilla/UiButton.js +22 -6
- package/vanilla/UiCallout.d.ts +1 -1
- package/vanilla/UiCallout.js +1 -1
- package/vanilla/UiCheckbox.d.ts +1 -0
- package/vanilla/UiCheckbox.js +12 -9
- package/vanilla/UiCluster.d.ts +1 -0
- package/vanilla/UiCluster.js +2 -0
- package/vanilla/UiCombobox.d.ts +3 -0
- package/vanilla/UiCombobox.js +30 -15
- package/vanilla/UiContextMenu.d.ts +1 -1
- package/vanilla/UiContextMenu.js +1 -1
- package/vanilla/UiDialog.d.ts +5 -2
- package/vanilla/UiDialog.js +1 -1
- package/vanilla/UiDisclosure.d.ts +2 -0
- package/vanilla/UiDisclosure.js +32 -18
- package/vanilla/UiEditable.d.ts +5 -0
- package/vanilla/UiEditable.js +7 -3
- package/vanilla/UiEditorInsertTableGrid.js +1 -6
- package/vanilla/UiEditorMentionMenu.d.ts +4 -2
- package/vanilla/UiEditorMentionMenu.js +49 -31
- package/vanilla/UiEditorMentionMenuItem.d.ts +16 -0
- package/vanilla/UiEditorMentionMenuItem.js +56 -0
- package/vanilla/UiEditorSlashMenu.d.ts +4 -3
- package/vanilla/UiEditorSlashMenu.js +59 -46
- package/vanilla/UiEditorSlashMenuGroup.d.ts +14 -0
- package/vanilla/UiEditorSlashMenuGroup.js +48 -0
- package/vanilla/UiEditorSlashMenuItem.d.ts +18 -0
- package/vanilla/UiEditorSlashMenuItem.js +57 -0
- package/vanilla/UiEditorTableContextMenu.d.ts +5 -2
- package/vanilla/UiEditorTableContextMenu.js +1 -2
- package/vanilla/UiEditorTableOverlay.d.ts +1 -1
- package/vanilla/UiEditorTableOverlay.js +5 -5
- package/vanilla/UiEditorTableToolbar.d.ts +4 -2
- package/vanilla/UiEditorTableToolbar.js +1 -2
- package/vanilla/UiEditorToolbar.js +2 -0
- package/vanilla/UiGrid.d.ts +1 -0
- package/vanilla/UiGrid.js +8 -7
- package/vanilla/UiIcon.js +1 -1
- package/vanilla/UiIconButton.d.ts +1 -0
- package/vanilla/UiIconButton.js +11 -2
- package/vanilla/UiListbox.d.ts +20 -0
- package/vanilla/UiListbox.js +45 -0
- package/vanilla/UiMenu.d.ts +1 -1
- package/vanilla/UiMenu.js +1 -1
- package/vanilla/UiMenuGroup.d.ts +14 -0
- package/vanilla/UiMenuGroup.js +35 -0
- package/vanilla/UiMenuItem.d.ts +5 -1
- package/vanilla/UiMenuItem.js +91 -30
- package/vanilla/UiPopover.d.ts +1 -1
- package/vanilla/UiPopover.js +1 -1
- package/vanilla/UiRadioGroup.d.ts +1 -0
- package/vanilla/UiRadioGroup.js +6 -3
- package/vanilla/UiSwitcher.d.ts +1 -0
- package/vanilla/UiSwitcher.js +7 -9
- package/vanilla/UiTabs.d.ts +1 -0
- package/vanilla/UiTabs.js +9 -1
- package/vanilla/UiTextarea.d.ts +1 -0
- package/vanilla/UiTextarea.js +4 -1
- package/vanilla/UiToast.d.ts +16 -0
- package/vanilla/UiToast.js +53 -0
- package/vanilla/UiToastRegion.d.ts +1 -4
- package/vanilla/UiToastRegion.js +3 -11
- package/vanilla/UiTooltip.d.ts +1 -1
- package/vanilla/UiTooltip.js +1 -1
- package/vanilla/UiTree.d.ts +2 -0
- package/vanilla/UiTree.js +1 -1
- package/vanilla/UiTreeItem.d.ts +1 -0
- package/vanilla/UiTreeItem.js +45 -31
- package/vanilla/index.js +6 -0
- package/vue/UiAvatar.d.ts +4 -0
- package/vue/UiAvatar.vue +23 -3
- package/vue/UiAvatarGroup.d.ts +3 -0
- package/vue/UiAvatarGroup.vue +7 -4
- package/vue/UiBadge.d.ts +2 -2
- package/vue/UiBadge.vue +74 -2
- package/vue/UiButton.d.ts +5 -3
- package/vue/UiButton.vue +41 -7
- package/vue/UiCallout.d.ts +2 -2
- package/vue/UiCallout.vue +3 -2
- package/vue/UiCheckbox.d.ts +2 -0
- package/vue/UiCheckbox.vue +16 -0
- package/vue/UiCluster.d.ts +1 -0
- package/vue/UiCluster.vue +5 -0
- package/vue/UiCombobox.d.ts +11 -3
- package/vue/UiCombobox.vue +60 -11
- package/vue/UiContextMenu.d.ts +2 -0
- package/vue/UiContextMenu.vue +47 -6
- package/vue/UiDialog.d.ts +18 -4
- package/vue/UiDialog.vue +86 -11
- package/vue/UiDisclosure.d.ts +8 -2
- package/vue/UiDisclosure.vue +38 -14
- package/vue/UiEditable.d.ts +10 -0
- package/vue/UiEditable.vue +14 -2
- package/vue/UiEditorInsertTableGrid.vue +52 -15
- package/vue/UiEditorMentionMenu.d.ts +24 -2
- package/vue/UiEditorMentionMenu.vue +27 -11
- package/vue/UiEditorMentionMenuItem.d.ts +24 -0
- package/vue/UiEditorMentionMenuItem.js +2 -0
- package/vue/UiEditorMentionMenuItem.vue +88 -0
- package/vue/UiEditorSlashMenu.d.ts +24 -1
- package/vue/UiEditorSlashMenu.vue +33 -33
- package/vue/UiEditorSlashMenuGroup.d.ts +18 -0
- package/vue/UiEditorSlashMenuGroup.js +2 -0
- package/vue/UiEditorSlashMenuGroup.vue +43 -0
- package/vue/UiEditorSlashMenuItem.d.ts +26 -0
- package/vue/UiEditorSlashMenuItem.js +2 -0
- package/vue/UiEditorSlashMenuItem.vue +101 -0
- package/vue/UiEditorTableContextMenu.d.ts +9 -3
- package/vue/UiEditorTableContextMenu.vue +53 -3
- package/vue/UiEditorTableOverlay.d.ts +2 -2
- package/vue/UiEditorTableOverlay.vue +8 -6
- package/vue/UiEditorTableToolbar.d.ts +7 -3
- package/vue/UiEditorTableToolbar.vue +50 -2
- package/vue/UiEditorToolbar.vue +14 -1
- package/vue/UiFloatingActionButton.vue +1 -1
- package/vue/UiFormField.vue +28 -3
- package/vue/UiGrid.d.ts +1 -0
- package/vue/UiGrid.vue +26 -2
- package/vue/UiIcon.vue +16 -0
- package/vue/UiIconButton.d.ts +5 -3
- package/vue/UiIconButton.vue +40 -6
- package/vue/UiInput.vue +10 -3
- package/vue/UiInputGroup.vue +32 -11
- package/vue/UiListbox.d.ts +33 -0
- package/vue/UiListbox.js +2 -0
- package/vue/UiListbox.vue +131 -0
- package/vue/UiMenu.d.ts +2 -0
- package/vue/UiMenu.vue +43 -6
- package/vue/UiMenuGroup.d.ts +18 -0
- package/vue/UiMenuGroup.js +2 -0
- package/vue/UiMenuGroup.vue +39 -0
- package/vue/UiMenuItem.d.ts +34 -2
- package/vue/UiMenuItem.vue +145 -9
- package/vue/UiPopover.d.ts +2 -2
- package/vue/UiPopover.vue +44 -5
- package/vue/UiRadioGroup.d.ts +2 -0
- package/vue/UiRadioGroup.vue +17 -0
- package/vue/UiSearchShell.vue +12 -5
- package/vue/UiSelect.vue +18 -4
- package/vue/UiSwitch.vue +2 -2
- package/vue/UiSwitcher.d.ts +1 -0
- package/vue/UiSwitcher.vue +22 -1
- package/vue/UiTabs.d.ts +6 -2
- package/vue/UiTabs.vue +14 -12
- package/vue/UiTextarea.d.ts +2 -0
- package/vue/UiTextarea.vue +32 -4
- package/vue/UiToast.d.ts +34 -0
- package/vue/UiToast.js +2 -0
- package/vue/UiToast.vue +173 -0
- package/vue/UiToastRegion.d.ts +2 -18
- package/vue/UiToastRegion.vue +123 -48
- package/vue/UiTooltip.d.ts +2 -2
- package/vue/UiTooltip.vue +67 -12
- package/vue/UiTree.d.ts +10 -0
- package/vue/UiTree.vue +27 -0
- package/vue/UiTreeItem.d.ts +2 -0
- package/vue/UiTreeItem.vue +96 -4
- package/vue/chunks/UiAvatar.js +19 -5
- package/vue/chunks/UiAvatarGroup.js +10 -4
- package/vue/chunks/UiBadge.js +1 -1
- package/vue/chunks/UiButton.js +58 -11
- package/vue/chunks/UiCallout.js +2 -2
- package/vue/chunks/UiCheckbox.js +12 -2
- package/vue/chunks/UiCluster.js +5 -3
- package/vue/chunks/UiCombobox.js +29 -13
- package/vue/chunks/UiContextMenu.js +6 -2
- package/vue/chunks/UiDialog.js +25 -8
- package/vue/chunks/UiDisclosure.js +36 -12
- package/vue/chunks/UiEditable.js +22 -8
- package/vue/chunks/UiEditorInsertTableGrid.js +11 -14
- package/vue/chunks/UiEditorMentionMenu.js +30 -19
- package/vue/chunks/UiEditorMentionMenuItem.js +36 -0
- package/vue/chunks/UiEditorSlashMenu.js +33 -35
- package/vue/chunks/UiEditorSlashMenuGroup.js +26 -0
- package/vue/chunks/UiEditorSlashMenuItem.js +51 -0
- package/vue/chunks/UiEditorTableContextMenu.js +39 -5
- package/vue/chunks/UiEditorTableOverlay.js +6 -6
- package/vue/chunks/UiEditorTableToolbar.js +37 -4
- package/vue/chunks/UiEditorToolbar.js +18 -4
- package/vue/chunks/UiFloatingActionButton.js +1 -1
- package/vue/chunks/UiFormField.js +13 -9
- package/vue/chunks/UiGrid.js +6 -2
- package/vue/chunks/UiIcon.js +40 -2
- package/vue/chunks/UiIconButton.js +35 -4
- package/vue/chunks/UiInput.js +1 -1
- package/vue/chunks/UiInputGroup.js +1 -1
- package/vue/chunks/UiListbox.js +70 -0
- package/vue/chunks/UiMenu.js +6 -2
- package/vue/chunks/UiMenuGroup.js +25 -0
- package/vue/chunks/UiMenuItem.js +128 -7
- package/vue/chunks/UiPopover.js +1 -1
- package/vue/chunks/UiRadioGroup.js +8 -2
- package/vue/chunks/UiSearchShell.js +1 -1
- package/vue/chunks/UiSelect.js +1 -1
- package/vue/chunks/UiSwitch.js +1 -1
- package/vue/chunks/UiSwitcher.js +20 -3
- package/vue/chunks/UiTabs.js +4 -3
- package/vue/chunks/UiTextarea.js +7 -2
- package/vue/chunks/UiToast.js +81 -0
- package/vue/chunks/UiToastRegion.js +25 -49
- package/vue/chunks/UiTooltip.js +3 -7
- package/vue/chunks/UiTree.js +8 -4
- package/vue/chunks/UiTreeItem.js +28 -10
- package/vue/components.css +1856 -864
- package/vue/editor/index.js +263 -2
- package/vue/index.d.ts +6 -0
- package/vue/index.js +9 -3
package/vue/UiToastRegion.vue
CHANGED
|
@@ -1,35 +1,24 @@
|
|
|
1
1
|
<!-- Generated by HTML Next 1.0.0-alpha.7 for Vue 3.5. Do not edit. -->
|
|
2
2
|
<script setup lang="ts">
|
|
3
|
-
import { ref } from 'vue'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
4
|
import * as controllerModule from '../components/ui-toast-region/ui-toast-region.js'
|
|
5
5
|
import { createDispatch, useComponentHost } from './host'
|
|
6
|
+
import UiIcon from './UiIcon.vue'
|
|
6
7
|
import UiIconButton from './UiIconButton.vue'
|
|
7
8
|
|
|
8
9
|
defineOptions({ inheritAttrs: false })
|
|
9
10
|
|
|
10
11
|
const props = withDefaults(
|
|
11
12
|
defineProps<{
|
|
12
|
-
auto?: boolean
|
|
13
13
|
duration?: number
|
|
14
|
-
|
|
15
|
-
open?: boolean
|
|
14
|
+
placement?: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'
|
|
16
15
|
}>(),
|
|
17
16
|
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message: 'Notification',
|
|
21
|
-
open: false,
|
|
17
|
+
duration: 0,
|
|
18
|
+
placement: 'top',
|
|
22
19
|
},
|
|
23
20
|
)
|
|
24
21
|
const emit = defineEmits<{
|
|
25
|
-
'update:open': [value: boolean]
|
|
26
|
-
close: [
|
|
27
|
-
detail: {
|
|
28
|
-
readonly open: boolean
|
|
29
|
-
readonly reason: 'action' | 'timeout' | 'programmatic' | 'light-dismiss' | 'escape'
|
|
30
|
-
readonly trigger: 'keyboard' | 'pointer' | 'programmatic'
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
22
|
dismiss: [
|
|
34
23
|
detail: {
|
|
35
24
|
readonly id: string
|
|
@@ -40,23 +29,23 @@ const emit = defineEmits<{
|
|
|
40
29
|
}>()
|
|
41
30
|
|
|
42
31
|
const root = ref<HTMLElement | null>(null)
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
const toasts = ref<
|
|
33
|
+
{
|
|
34
|
+
id: string
|
|
35
|
+
message: string
|
|
36
|
+
tone: 'neutral' | 'info' | 'success' | 'warning' | 'danger'
|
|
37
|
+
role: 'alert' | 'status'
|
|
38
|
+
closing: boolean
|
|
39
|
+
}[]
|
|
40
|
+
>([])
|
|
41
|
+
|
|
42
|
+
/** The values the styles' :host-state() rules test. */
|
|
43
|
+
const hostState = computed(() =>
|
|
44
|
+
[
|
|
45
|
+
props.placement && `placement placement=${props.placement}`,
|
|
46
|
+
].filter(Boolean).join(' ')
|
|
46
47
|
)
|
|
47
48
|
|
|
48
|
-
const isCloseDetail = (detail: unknown): boolean =>
|
|
49
|
-
detail !== null && typeof detail === 'object' && !Array.isArray(detail)
|
|
50
|
-
&& typeof (detail as Record<string, unknown>)['open'] === 'boolean'
|
|
51
|
-
&& ((detail as Record<string, unknown>)['reason'] === 'action'
|
|
52
|
-
|| (detail as Record<string, unknown>)['reason'] === 'timeout'
|
|
53
|
-
|| (detail as Record<string, unknown>)['reason'] === 'programmatic'
|
|
54
|
-
|| (detail as Record<string, unknown>)['reason'] === 'light-dismiss'
|
|
55
|
-
|| (detail as Record<string, unknown>)['reason'] === 'escape')
|
|
56
|
-
&& ((detail as Record<string, unknown>)['trigger'] === 'keyboard'
|
|
57
|
-
|| (detail as Record<string, unknown>)['trigger'] === 'pointer'
|
|
58
|
-
|| (detail as Record<string, unknown>)['trigger'] === 'programmatic')
|
|
59
|
-
&& Object.keys(detail as object).every((key) => ['open', 'reason', 'trigger'].includes(key))
|
|
60
49
|
const isDismissDetail = (detail: unknown): boolean =>
|
|
61
50
|
detail !== null && typeof detail === 'object' && !Array.isArray(detail)
|
|
62
51
|
&& typeof (detail as Record<string, unknown>)['id'] === 'string'
|
|
@@ -68,17 +57,15 @@ const isDismissDetail = (detail: unknown): boolean =>
|
|
|
68
57
|
&& Object.keys(detail as object).every((key) => ['id', 'reason', 'trigger'].includes(key))
|
|
69
58
|
const dispatch = createDispatch(root, emit as (name: string, detail: unknown) => void, {
|
|
70
59
|
checks: {
|
|
71
|
-
close: isCloseDetail,
|
|
72
60
|
dismiss: isDismissDetail,
|
|
73
61
|
},
|
|
74
|
-
modeled: ['open'],
|
|
75
62
|
})
|
|
76
63
|
|
|
77
64
|
const { host, ready } = useComponentHost(controllerModule.default, {
|
|
78
65
|
root,
|
|
79
66
|
dispatch,
|
|
80
67
|
props,
|
|
81
|
-
state: {
|
|
68
|
+
state: { toasts },
|
|
82
69
|
})
|
|
83
70
|
|
|
84
71
|
defineExpose({
|
|
@@ -100,6 +87,7 @@ defineExpose({
|
|
|
100
87
|
aria-live="polite"
|
|
101
88
|
popover="manual"
|
|
102
89
|
v-bind="$attrs"
|
|
90
|
+
:data-ui-toast-region-state="hostState || undefined"
|
|
103
91
|
ref="root"
|
|
104
92
|
>
|
|
105
93
|
<slot />
|
|
@@ -109,6 +97,7 @@ defineExpose({
|
|
|
109
97
|
class="toast"
|
|
110
98
|
:id="toast.id"
|
|
111
99
|
:role="toast.role"
|
|
100
|
+
:data-tone="toast.tone"
|
|
112
101
|
:class="{ closing: toast.closing }"
|
|
113
102
|
>
|
|
114
103
|
<span class="message">{{ toast.message }}</span>
|
|
@@ -117,22 +106,29 @@ defineExpose({
|
|
|
117
106
|
variant="ghost"
|
|
118
107
|
:round="true"
|
|
119
108
|
:label="`Dismiss ${toast.message}`"
|
|
120
|
-
><
|
|
121
|
-
viewBox="0 0 24 24"
|
|
122
|
-
fill="none"
|
|
123
|
-
stroke="currentColor"
|
|
124
|
-
stroke-width="2"
|
|
125
|
-
stroke-linecap="round"
|
|
126
|
-
aria-hidden="true"
|
|
127
|
-
>
|
|
128
|
-
<path d="M18 6 6 18M6 6l12 12"></path>
|
|
129
|
-
</svg></UiIconButton></span>
|
|
109
|
+
><UiIcon name="x" /></UiIconButton></span>
|
|
130
110
|
</div>
|
|
131
111
|
</div>
|
|
132
112
|
</template>
|
|
133
113
|
|
|
134
114
|
<style scoped>
|
|
135
115
|
/* This component's hooks style the element they are set on, and never a nested one. */
|
|
116
|
+
@property --ui-toast-region-surface {
|
|
117
|
+
syntax: "*";
|
|
118
|
+
inherits: false;
|
|
119
|
+
}
|
|
120
|
+
@property --ui-toast-region-border {
|
|
121
|
+
syntax: "*";
|
|
122
|
+
inherits: false;
|
|
123
|
+
}
|
|
124
|
+
@property --ui-toast-region-radius {
|
|
125
|
+
syntax: "*";
|
|
126
|
+
inherits: false;
|
|
127
|
+
}
|
|
128
|
+
@property --ui-toast-region-shadow {
|
|
129
|
+
syntax: "*";
|
|
130
|
+
inherits: false;
|
|
131
|
+
}
|
|
136
132
|
@property --ui-toast-region-enter-duration {
|
|
137
133
|
syntax: "*";
|
|
138
134
|
inherits: false;
|
|
@@ -144,6 +140,10 @@ defineExpose({
|
|
|
144
140
|
|
|
145
141
|
[data-component~="ui-toast-region"] {
|
|
146
142
|
/* Hooks do not inherit, so the parts below read them from the root. */
|
|
143
|
+
--_ui-toast-region-surface: var(--ui-toast-region-surface);
|
|
144
|
+
--_ui-toast-region-border: var(--ui-toast-region-border);
|
|
145
|
+
--_ui-toast-region-radius: var(--ui-toast-region-radius);
|
|
146
|
+
--_ui-toast-region-shadow: var(--ui-toast-region-shadow);
|
|
147
147
|
--_ui-toast-region-enter-duration: var(--ui-toast-region-enter-duration);
|
|
148
148
|
--_ui-toast-region-exit-duration: var(--ui-toast-region-exit-duration);
|
|
149
149
|
|
|
@@ -173,6 +173,29 @@ defineExpose({
|
|
|
173
173
|
display: none;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=top-start"],
|
|
177
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-start"] {
|
|
178
|
+
left: auto;
|
|
179
|
+
right: auto;
|
|
180
|
+
inset-inline-start: calc(var(--ui-space-4) + env(safe-area-inset-left));
|
|
181
|
+
transform: none;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=top-end"],
|
|
185
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-end"] {
|
|
186
|
+
left: auto;
|
|
187
|
+
right: auto;
|
|
188
|
+
inset-inline-end: calc(var(--ui-space-4) + env(safe-area-inset-right));
|
|
189
|
+
transform: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom"],
|
|
193
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-start"],
|
|
194
|
+
[data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-end"] {
|
|
195
|
+
top: auto;
|
|
196
|
+
bottom: calc(var(--ui-space-4) + env(safe-area-inset-bottom));
|
|
197
|
+
}
|
|
198
|
+
|
|
176
199
|
[data-component~="ui-toast-region"] > .toast,
|
|
177
200
|
[data-component~="ui-toast-region"] > :slotted(*) {
|
|
178
201
|
pointer-events: auto;
|
|
@@ -183,22 +206,52 @@ defineExpose({
|
|
|
183
206
|
grid-template-columns: 1fr auto;
|
|
184
207
|
gap: var(--ui-space-2);
|
|
185
208
|
align-items: start;
|
|
186
|
-
border: 1px solid
|
|
187
|
-
|
|
209
|
+
border: 1px solid
|
|
210
|
+
var(--_ui-toast-region-border, var(--ui-overlay-border, var(--ui-border-default)));
|
|
211
|
+
border-radius: var(--_ui-toast-region-radius, var(--ui-overlay-radius, var(--ui-radius-lg)));
|
|
188
212
|
padding: var(--ui-space-3) var(--ui-space-4);
|
|
189
|
-
background: var(
|
|
213
|
+
background: var(
|
|
214
|
+
--_ui-toast-region-surface,
|
|
215
|
+
var(--ui-overlay-surface, var(--ui-surface-elevated))
|
|
216
|
+
);
|
|
190
217
|
color: var(--ui-text-primary);
|
|
191
|
-
box-shadow: var(
|
|
218
|
+
box-shadow: var(
|
|
219
|
+
--_ui-toast-region-shadow,
|
|
220
|
+
var(--ui-overlay-shadow, var(--ui-elevation-overlay, var(--ui-shadow-lg)))
|
|
221
|
+
);
|
|
192
222
|
animation: ui-toast-enter var(--_ui-toast-region-enter-duration, 0.32s)
|
|
193
223
|
var(--ui-motion-ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
|
|
194
224
|
}
|
|
195
225
|
|
|
226
|
+
.toast[data-tone="info"] {
|
|
227
|
+
border-inline-start: 3px solid var(--ui-info-solid);
|
|
228
|
+
}
|
|
229
|
+
.toast[data-tone="success"] {
|
|
230
|
+
border-inline-start: 3px solid var(--ui-success-solid);
|
|
231
|
+
}
|
|
232
|
+
.toast[data-tone="warning"] {
|
|
233
|
+
border-inline-start: 3px solid var(--ui-warning-solid);
|
|
234
|
+
}
|
|
235
|
+
.toast[data-tone="danger"] {
|
|
236
|
+
border-inline-start: 3px solid var(--ui-danger-solid);
|
|
237
|
+
}
|
|
238
|
+
|
|
196
239
|
/* Leaving slides on down and fades; the controller removes the toast when this ends. */
|
|
197
240
|
.toast.closing {
|
|
198
241
|
animation: ui-toast-exit var(--_ui-toast-region-exit-duration, 0.22s) var(--ui-motion-ease) both;
|
|
199
242
|
pointer-events: none;
|
|
200
243
|
}
|
|
201
244
|
|
|
245
|
+
:is([data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom"], [data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-start"], [data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-end"])
|
|
246
|
+
.toast {
|
|
247
|
+
animation-name: ui-toast-enter-bottom;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:is([data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom"], [data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-start"], [data-component~="ui-toast-region"][data-ui-toast-region-state~="placement=bottom-end"])
|
|
251
|
+
.toast.closing {
|
|
252
|
+
animation-name: ui-toast-exit-bottom;
|
|
253
|
+
}
|
|
254
|
+
|
|
202
255
|
@keyframes ui-toast-enter {
|
|
203
256
|
from {
|
|
204
257
|
opacity: 0;
|
|
@@ -221,6 +274,28 @@ defineExpose({
|
|
|
221
274
|
}
|
|
222
275
|
}
|
|
223
276
|
|
|
277
|
+
@keyframes ui-toast-enter-bottom {
|
|
278
|
+
from {
|
|
279
|
+
opacity: 0;
|
|
280
|
+
transform: translateY(1rem);
|
|
281
|
+
}
|
|
282
|
+
to {
|
|
283
|
+
opacity: 1;
|
|
284
|
+
transform: translateY(0);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
@keyframes ui-toast-exit-bottom {
|
|
289
|
+
from {
|
|
290
|
+
opacity: 1;
|
|
291
|
+
transform: translateY(0);
|
|
292
|
+
}
|
|
293
|
+
to {
|
|
294
|
+
opacity: 0;
|
|
295
|
+
transform: translateY(-0.75rem);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
224
299
|
@media (prefers-reduced-motion: reduce) {
|
|
225
300
|
.toast, .toast.closing {
|
|
226
301
|
animation: none;
|
package/vue/UiTooltip.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
hideDelay?: number;
|
|
4
4
|
inverse?: boolean;
|
|
5
5
|
open?: boolean;
|
|
6
|
-
placement?:
|
|
6
|
+
placement?: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
7
7
|
showDelay?: number;
|
|
8
8
|
trigger?: 'hover' | 'click' | 'focus';
|
|
9
9
|
};
|
|
@@ -43,7 +43,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
43
43
|
hideDelay: number;
|
|
44
44
|
inverse: boolean;
|
|
45
45
|
open: boolean;
|
|
46
|
-
placement:
|
|
46
|
+
placement: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
47
47
|
showDelay: number;
|
|
48
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
49
49
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
package/vue/UiTooltip.vue
CHANGED
|
@@ -12,7 +12,19 @@ const props = withDefaults(
|
|
|
12
12
|
hideDelay?: number
|
|
13
13
|
inverse?: boolean
|
|
14
14
|
open?: boolean
|
|
15
|
-
placement?:
|
|
15
|
+
placement?:
|
|
16
|
+
| 'top'
|
|
17
|
+
| 'top-start'
|
|
18
|
+
| 'top-end'
|
|
19
|
+
| 'bottom'
|
|
20
|
+
| 'bottom-start'
|
|
21
|
+
| 'bottom-end'
|
|
22
|
+
| 'left'
|
|
23
|
+
| 'left-start'
|
|
24
|
+
| 'left-end'
|
|
25
|
+
| 'right'
|
|
26
|
+
| 'right-start'
|
|
27
|
+
| 'right-end'
|
|
16
28
|
showDelay?: number
|
|
17
29
|
trigger?: 'hover' | 'click' | 'focus'
|
|
18
30
|
}>(),
|
|
@@ -21,7 +33,7 @@ const props = withDefaults(
|
|
|
21
33
|
hideDelay: 100,
|
|
22
34
|
inverse: false,
|
|
23
35
|
open: false,
|
|
24
|
-
placement: 'top
|
|
36
|
+
placement: 'top',
|
|
25
37
|
showDelay: 500,
|
|
26
38
|
trigger: 'hover',
|
|
27
39
|
},
|
|
@@ -52,8 +64,6 @@ const internalOpen = ref(false)
|
|
|
52
64
|
const hostState = computed(() =>
|
|
53
65
|
[
|
|
54
66
|
props.inverse && 'inverse',
|
|
55
|
-
props.placement && 'placement',
|
|
56
|
-
`placement=${encodeURIComponent(props.placement)}`,
|
|
57
67
|
].filter(Boolean).join(' ')
|
|
58
68
|
)
|
|
59
69
|
|
|
@@ -117,6 +127,10 @@ useComponentHost(controllerModule.default, {
|
|
|
117
127
|
syntax: "*";
|
|
118
128
|
inherits: false;
|
|
119
129
|
}
|
|
130
|
+
@property --ui-tooltip-offset {
|
|
131
|
+
syntax: "*";
|
|
132
|
+
inherits: false;
|
|
133
|
+
}
|
|
120
134
|
@property --ui-tooltip-radius {
|
|
121
135
|
syntax: "*";
|
|
122
136
|
inherits: false;
|
|
@@ -168,19 +182,22 @@ useComponentHost(controllerModule.default, {
|
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
.surface {
|
|
171
|
-
--_tooltip-line: var(--_ui-tooltip-border, var(--ui-border-default));
|
|
185
|
+
--_tooltip-line: var(--_ui-tooltip-border, var(--ui-overlay-border, var(--ui-border-default)));
|
|
172
186
|
position: relative;
|
|
173
187
|
box-sizing: border-box;
|
|
174
188
|
max-inline-size: var(--_ui-tooltip-max-inline-size, 18rem);
|
|
175
189
|
border: 1px solid var(--_tooltip-line);
|
|
176
|
-
border-radius: var(--_ui-tooltip-radius, var(--ui-radius-sm));
|
|
177
|
-
background: var(--_ui-tooltip-surface, var(--ui-surface-elevated));
|
|
190
|
+
border-radius: var(--_ui-tooltip-radius, var(--ui-overlay-radius, var(--ui-radius-sm)));
|
|
191
|
+
background: var(--_ui-tooltip-surface, var(--ui-overlay-surface, var(--ui-surface-elevated)));
|
|
178
192
|
color: var(--_ui-tooltip-text, var(--ui-text-primary));
|
|
179
193
|
padding: var(--ui-space-1) var(--ui-space-2);
|
|
180
194
|
font-family: var(--ui-font-family-sans);
|
|
181
195
|
font-size: var(--ui-font-size-sm);
|
|
182
196
|
line-height: var(--ui-line-height-tight);
|
|
183
|
-
box-shadow: var(
|
|
197
|
+
box-shadow: var(
|
|
198
|
+
--_ui-tooltip-shadow,
|
|
199
|
+
var(--ui-overlay-shadow, var(--ui-elevation-tooltip, var(--ui-shadow-md)))
|
|
200
|
+
);
|
|
184
201
|
}
|
|
185
202
|
|
|
186
203
|
[data-component~="ui-tooltip"][data-ui-tooltip-state~="inverse"] .surface {
|
|
@@ -208,8 +225,7 @@ useComponentHost(controllerModule.default, {
|
|
|
208
225
|
transform: rotate(45deg);
|
|
209
226
|
}
|
|
210
227
|
|
|
211
|
-
|
|
212
|
-
.surface::after {
|
|
228
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="bottom"] .surface::after {
|
|
213
229
|
inset-block-start: calc(var(--_ui-tooltip-arrow-size, 0.5rem) / -2 - 0.5px);
|
|
214
230
|
inset-block-end: auto;
|
|
215
231
|
border-inline-end-width: 0;
|
|
@@ -220,12 +236,51 @@ useComponentHost(controllerModule.default, {
|
|
|
220
236
|
border-start-start-radius: 1px;
|
|
221
237
|
}
|
|
222
238
|
|
|
223
|
-
|
|
224
|
-
.
|
|
239
|
+
[data-component~="ui-tooltip"][data-ui-actual-align="center"] .surface::after {
|
|
240
|
+
inset-inline-start: calc(50% - var(--_ui-tooltip-arrow-size, 0.5rem) / 2);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
[data-component~="ui-tooltip"][data-ui-actual-align="end"] .surface::after {
|
|
225
244
|
inset-inline-start: auto;
|
|
226
245
|
inset-inline-end: var(--ui-space-3);
|
|
227
246
|
}
|
|
228
247
|
|
|
248
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="left"] .surface::after,
|
|
249
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="right"] .surface::after {
|
|
250
|
+
inset-block-start: calc(50% - var(--_ui-tooltip-arrow-size, 0.5rem) / 2);
|
|
251
|
+
inset-block-end: auto;
|
|
252
|
+
border: 0 solid var(--_tooltip-line);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="left"] .surface::after {
|
|
256
|
+
inset-inline-start: auto;
|
|
257
|
+
inset-inline-end: calc(var(--_ui-tooltip-arrow-size, 0.5rem) / -2 - 0.5px);
|
|
258
|
+
border-inline-end-width: 1px;
|
|
259
|
+
border-block-end-width: 1px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="right"] .surface::after {
|
|
263
|
+
inset-inline-start: calc(var(--_ui-tooltip-arrow-size, 0.5rem) / -2 - 0.5px);
|
|
264
|
+
inset-inline-end: auto;
|
|
265
|
+
border-inline-start-width: 1px;
|
|
266
|
+
border-block-start-width: 1px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="left"][data-ui-actual-align="start"]
|
|
270
|
+
.surface::after,
|
|
271
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="right"][data-ui-actual-align="start"]
|
|
272
|
+
.surface::after {
|
|
273
|
+
inset-block-start: var(--ui-space-3);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="left"][data-ui-actual-align="end"]
|
|
277
|
+
.surface::after,
|
|
278
|
+
[data-component~="ui-tooltip"][data-ui-actual-placement="right"][data-ui-actual-align="end"]
|
|
279
|
+
.surface::after {
|
|
280
|
+
inset-block-start: auto;
|
|
281
|
+
inset-block-end: var(--ui-space-3);
|
|
282
|
+
}
|
|
283
|
+
|
|
229
284
|
[data-component~="ui-tooltip"]:popover-open {
|
|
230
285
|
opacity: 1;
|
|
231
286
|
transform: translateY(0);
|
package/vue/UiTree.d.ts
CHANGED
|
@@ -4,12 +4,17 @@ type __VLS_Props = {
|
|
|
4
4
|
label?: string;
|
|
5
5
|
marquee?: boolean;
|
|
6
6
|
maxDepth?: number;
|
|
7
|
+
selection?: 'none' | 'single' | 'multiple';
|
|
7
8
|
};
|
|
8
9
|
declare var __VLS_1: {};
|
|
9
10
|
type __VLS_Slots = {} & {
|
|
10
11
|
default?: (props: typeof __VLS_1) => any;
|
|
11
12
|
};
|
|
12
13
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
select: (detail: {
|
|
15
|
+
readonly ids: readonly (string)[];
|
|
16
|
+
readonly trigger: "keyboard" | "pointer" | "programmatic";
|
|
17
|
+
}) => any;
|
|
13
18
|
"update:maxDepth": (value: number) => any;
|
|
14
19
|
reorder: (detail: {
|
|
15
20
|
readonly sourceId: string;
|
|
@@ -31,6 +36,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
31
36
|
readonly trigger: "keyboard" | "pointer" | "programmatic";
|
|
32
37
|
}) => any;
|
|
33
38
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
39
|
+
onSelect?: ((detail: {
|
|
40
|
+
readonly ids: readonly (string)[];
|
|
41
|
+
readonly trigger: "keyboard" | "pointer" | "programmatic";
|
|
42
|
+
}) => any) | undefined;
|
|
34
43
|
"onUpdate:maxDepth"?: ((value: number) => any) | undefined;
|
|
35
44
|
onReorder?: ((detail: {
|
|
36
45
|
readonly sourceId: string;
|
|
@@ -54,6 +63,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
54
63
|
}>, {
|
|
55
64
|
label: string;
|
|
56
65
|
marquee: boolean;
|
|
66
|
+
selection: "none" | "single" | "multiple";
|
|
57
67
|
density: "comfortable" | "compact";
|
|
58
68
|
hoverExpandDelay: number;
|
|
59
69
|
maxDepth: number;
|
package/vue/UiTree.vue
CHANGED
|
@@ -13,6 +13,7 @@ const props = withDefaults(
|
|
|
13
13
|
label?: string
|
|
14
14
|
marquee?: boolean
|
|
15
15
|
maxDepth?: number
|
|
16
|
+
selection?: 'none' | 'single' | 'multiple'
|
|
16
17
|
}>(),
|
|
17
18
|
{
|
|
18
19
|
density: 'comfortable',
|
|
@@ -20,6 +21,7 @@ const props = withDefaults(
|
|
|
20
21
|
label: 'Tree',
|
|
21
22
|
marquee: false,
|
|
22
23
|
maxDepth: 0,
|
|
24
|
+
selection: 'none',
|
|
23
25
|
},
|
|
24
26
|
)
|
|
25
27
|
const emit = defineEmits<{
|
|
@@ -47,6 +49,12 @@ const emit = defineEmits<{
|
|
|
47
49
|
readonly trigger: 'keyboard' | 'pointer' | 'programmatic'
|
|
48
50
|
},
|
|
49
51
|
]
|
|
52
|
+
select: [
|
|
53
|
+
detail: {
|
|
54
|
+
readonly ids: readonly (string)[]
|
|
55
|
+
readonly trigger: 'keyboard' | 'pointer' | 'programmatic'
|
|
56
|
+
},
|
|
57
|
+
]
|
|
50
58
|
}>()
|
|
51
59
|
|
|
52
60
|
const root = ref<HTMLElement | null>(null)
|
|
@@ -102,10 +110,21 @@ const isReorderRejectedDetail = (detail: unknown): boolean =>
|
|
|
102
110
|
['sourceId', 'targetId', 'position', 'reason', 'maxDepth', 'resultingDepth', 'trigger']
|
|
103
111
|
.includes(key)
|
|
104
112
|
)
|
|
113
|
+
const isSelectDetail = (detail: unknown): boolean =>
|
|
114
|
+
detail !== null && typeof detail === 'object' && !Array.isArray(detail)
|
|
115
|
+
&& (Array.isArray((detail as Record<string, unknown>)['ids'])
|
|
116
|
+
&& ((detail as Record<string, unknown>)['ids'] as unknown[]).every((item: unknown) =>
|
|
117
|
+
typeof item === 'string'
|
|
118
|
+
))
|
|
119
|
+
&& ((detail as Record<string, unknown>)['trigger'] === 'keyboard'
|
|
120
|
+
|| (detail as Record<string, unknown>)['trigger'] === 'pointer'
|
|
121
|
+
|| (detail as Record<string, unknown>)['trigger'] === 'programmatic')
|
|
122
|
+
&& Object.keys(detail as object).every((key) => ['ids', 'trigger'].includes(key))
|
|
105
123
|
const dispatch = createDispatch(root, emit as (name: string, detail: unknown) => void, {
|
|
106
124
|
checks: {
|
|
107
125
|
reorder: isReorderDetail,
|
|
108
126
|
'reorder-rejected': isReorderRejectedDetail,
|
|
127
|
+
select: isSelectDetail,
|
|
109
128
|
},
|
|
110
129
|
modeled: ['maxDepth'],
|
|
111
130
|
})
|
|
@@ -171,6 +190,14 @@ useComponentHost(controllerModule.default, {
|
|
|
171
190
|
padding-inline-start: var(--ui-tree-gutter, 0px);
|
|
172
191
|
}
|
|
173
192
|
|
|
193
|
+
[data-component~="ui-tree"][data-move-mode]::after {
|
|
194
|
+
content: "Choose a destination row, or use Up and Down; Right nests inside a branch. Enter places it, Escape cancels.";
|
|
195
|
+
display: block;
|
|
196
|
+
padding: var(--ui-space-2);
|
|
197
|
+
color: var(--ui-text-secondary);
|
|
198
|
+
font-size: var(--ui-font-size-sm);
|
|
199
|
+
}
|
|
200
|
+
|
|
174
201
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
175
202
|
[data-component~="ui-tree"][hidden] {
|
|
176
203
|
display: none;
|
package/vue/UiTreeItem.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ type __VLS_Props = {
|
|
|
8
8
|
expanded?: boolean;
|
|
9
9
|
itemId?: string;
|
|
10
10
|
label?: string;
|
|
11
|
+
lazy?: boolean;
|
|
11
12
|
marquee?: boolean;
|
|
12
13
|
selected?: boolean;
|
|
13
14
|
sortable?: boolean;
|
|
@@ -48,6 +49,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
48
49
|
dragType: string;
|
|
49
50
|
dropScope: string;
|
|
50
51
|
itemId: string;
|
|
52
|
+
lazy: boolean;
|
|
51
53
|
sortable: boolean;
|
|
52
54
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
53
55
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|