@threadlabs/looma 0.22.9 → 0.22.11
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/overlay.js +33 -1
- package/components/ui-affordance-scope/ui-affordance-scope.js +2 -2
- package/components/ui-avatar/ui-avatar.js +5 -5
- package/components/ui-avatar-group/ui-avatar-group.js +5 -5
- package/components/ui-button/ui-button.js +1 -1
- package/components/ui-checkbox/ui-checkbox.js +5 -5
- package/components/ui-combobox/ui-combobox.js +61 -61
- package/components/ui-context-menu/ui-context-menu.js +6 -6
- package/components/ui-dialog/ui-dialog.html +6 -0
- package/components/ui-dialog/ui-dialog.js +11 -11
- package/components/ui-disclosure/ui-disclosure.js +6 -6
- package/components/ui-editable/ui-editable.js +6 -6
- package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.js +4 -4
- package/components/ui-editor-mention-menu/ui-editor-mention-menu.js +8 -8
- package/components/ui-editor-slash-menu/ui-editor-slash-menu.js +6 -6
- package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.js +5 -5
- package/components/ui-editor-table-overlay/ui-editor-table-overlay.js +4 -4
- package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.js +5 -5
- package/components/ui-form-field/ui-form-field.js +4 -4
- package/components/ui-icon-button/ui-icon-button.js +2 -2
- package/components/ui-input/ui-input.js +1 -1
- package/components/ui-input-group/ui-input-group.html +14 -0
- package/components/ui-input-group/ui-input-group.js +1 -1
- package/components/ui-listbox/ui-listbox.js +12 -12
- package/components/ui-menu/ui-menu.js +7 -7
- package/components/ui-menu-item/ui-menu-item.js +7 -7
- package/components/ui-popover/ui-popover.js +4 -4
- package/components/ui-radio/ui-radio.js +5 -5
- package/components/ui-radio-group/ui-radio-group.js +6 -6
- package/components/ui-scroll-area/ui-scroll-area.js +1 -1
- package/components/ui-search-shell/ui-search-shell.html +8 -0
- package/components/ui-search-shell/ui-search-shell.js +17 -7
- package/components/ui-select/ui-select.js +1 -1
- package/components/ui-sidebar/ui-sidebar.js +15 -12
- package/components/ui-switch/ui-switch.js +5 -5
- package/components/ui-switcher/ui-switcher.js +1 -1
- package/components/ui-tabs/ui-tabs.js +5 -5
- package/components/ui-textarea/ui-textarea.js +1 -1
- package/components/ui-toast/ui-toast.js +3 -3
- package/components/ui-toast-region/ui-toast-region.js +5 -1
- package/components/ui-tooltip/ui-tooltip.js +22 -11
- package/components/ui-tree/ui-tree.js +4 -4
- package/components/ui-tree-item/ui-tree-item.js +11 -11
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/styles/ui-action-bar.css +1 -1
- package/styles/ui-affordance-scope.css +1 -1
- package/styles/ui-avatar-group.css +1 -1
- package/styles/ui-avatar.css +1 -1
- package/styles/ui-badge.css +1 -1
- package/styles/ui-breadcrumb-item.css +1 -1
- package/styles/ui-breadcrumbs.css +1 -1
- package/styles/ui-button.css +1 -1
- package/styles/ui-callout.css +1 -1
- package/styles/ui-card.css +1 -1
- package/styles/ui-checkbox.css +1 -1
- package/styles/ui-cluster.css +1 -1
- package/styles/ui-combobox.css +1 -1
- package/styles/ui-container.css +1 -1
- package/styles/ui-context-menu.css +1 -1
- package/styles/ui-cover.css +1 -1
- package/styles/ui-description-item.css +1 -1
- package/styles/ui-description-list.css +1 -1
- package/styles/ui-dialog.css +7 -1
- package/styles/ui-disclosure.css +1 -1
- package/styles/ui-editable.css +1 -1
- package/styles/ui-editor-insert-table-grid.css +1 -1
- package/styles/ui-editor-mention-menu-item.css +1 -1
- package/styles/ui-editor-mention-menu.css +1 -1
- package/styles/ui-editor-slash-menu-group.css +1 -1
- package/styles/ui-editor-slash-menu-item.css +1 -1
- package/styles/ui-editor-slash-menu.css +1 -1
- package/styles/ui-editor-table-context-menu.css +1 -1
- package/styles/ui-editor-table-overlay.css +1 -1
- package/styles/ui-editor-table-toolbar.css +1 -1
- package/styles/ui-editor-toolbar.css +1 -1
- package/styles/ui-floating-action-button.css +1 -1
- package/styles/ui-form-field.css +1 -1
- package/styles/ui-grid.css +1 -1
- package/styles/ui-icon-button.css +1 -1
- package/styles/ui-icon.css +1 -1
- package/styles/ui-input-group.css +17 -1
- package/styles/ui-input.css +1 -1
- package/styles/ui-list-item.css +1 -1
- package/styles/ui-list.css +1 -1
- package/styles/ui-listbox.css +1 -1
- package/styles/ui-menu-group.css +1 -1
- package/styles/ui-menu-item.css +1 -1
- package/styles/ui-menu.css +1 -1
- package/styles/ui-meter.css +1 -1
- package/styles/ui-nav-item.css +1 -1
- package/styles/ui-page-header.css +1 -1
- package/styles/ui-popover.css +1 -1
- package/styles/ui-radio-group.css +1 -1
- package/styles/ui-radio.css +1 -1
- package/styles/ui-reel.css +1 -1
- package/styles/ui-scroll-area.css +1 -1
- package/styles/ui-search-result-row.css +1 -1
- package/styles/ui-search-shell.css +9 -1
- package/styles/ui-section.css +1 -1
- package/styles/ui-select.css +1 -1
- package/styles/ui-separator.css +1 -1
- package/styles/ui-sidebar.css +1 -1
- package/styles/ui-spinner.css +1 -1
- package/styles/ui-stack.css +1 -1
- package/styles/ui-status-message.css +1 -1
- package/styles/ui-switch.css +1 -1
- package/styles/ui-switcher.css +1 -1
- package/styles/ui-table.css +1 -1
- package/styles/ui-tabs.css +1 -1
- package/styles/ui-text.css +1 -1
- package/styles/ui-textarea.css +1 -1
- package/styles/ui-toast-region.css +1 -1
- package/styles/ui-toast.css +1 -1
- package/styles/ui-tooltip.css +1 -1
- package/styles/ui-top-bar.css +1 -1
- package/styles/ui-tree-item.css +1 -1
- package/styles/ui-tree.css +1 -1
- package/vanilla/UiActionBar.d.ts +1 -1
- package/vanilla/UiActionBar.js +1 -1
- package/vanilla/UiAffordanceScope.d.ts +1 -1
- package/vanilla/UiAffordanceScope.js +1 -1
- package/vanilla/UiAvatar.d.ts +1 -1
- package/vanilla/UiAvatar.js +1 -1
- package/vanilla/UiAvatarGroup.d.ts +1 -1
- package/vanilla/UiAvatarGroup.js +1 -1
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +1 -1
- package/vanilla/UiBreadcrumbItem.d.ts +1 -1
- package/vanilla/UiBreadcrumbItem.js +1 -1
- package/vanilla/UiBreadcrumbs.d.ts +1 -1
- package/vanilla/UiBreadcrumbs.js +1 -1
- package/vanilla/UiButton.d.ts +1 -1
- package/vanilla/UiButton.js +1 -1
- package/vanilla/UiCallout.d.ts +1 -1
- package/vanilla/UiCallout.js +1 -1
- package/vanilla/UiCard.d.ts +1 -1
- package/vanilla/UiCard.js +1 -1
- package/vanilla/UiCheckbox.d.ts +1 -1
- package/vanilla/UiCheckbox.js +1 -1
- package/vanilla/UiCluster.d.ts +1 -1
- package/vanilla/UiCluster.js +1 -1
- package/vanilla/UiCombobox.d.ts +1 -1
- package/vanilla/UiCombobox.js +1 -1
- package/vanilla/UiContainer.d.ts +1 -1
- package/vanilla/UiContainer.js +1 -1
- package/vanilla/UiContextMenu.d.ts +1 -1
- package/vanilla/UiContextMenu.js +1 -1
- package/vanilla/UiCover.d.ts +1 -1
- package/vanilla/UiCover.js +1 -1
- package/vanilla/UiDescriptionItem.d.ts +1 -1
- package/vanilla/UiDescriptionItem.js +1 -1
- package/vanilla/UiDescriptionList.d.ts +1 -1
- package/vanilla/UiDescriptionList.js +1 -1
- package/vanilla/UiDialog.d.ts +1 -1
- package/vanilla/UiDialog.js +1 -1
- package/vanilla/UiDisclosure.d.ts +1 -1
- package/vanilla/UiDisclosure.js +1 -1
- package/vanilla/UiEditable.d.ts +1 -1
- package/vanilla/UiEditable.js +1 -1
- package/vanilla/UiEditorInsertTableGrid.d.ts +1 -1
- package/vanilla/UiEditorInsertTableGrid.js +1 -1
- package/vanilla/UiEditorMentionMenu.d.ts +1 -1
- package/vanilla/UiEditorMentionMenu.js +1 -1
- package/vanilla/UiEditorMentionMenuItem.d.ts +1 -1
- package/vanilla/UiEditorMentionMenuItem.js +1 -1
- package/vanilla/UiEditorSlashMenu.d.ts +1 -1
- package/vanilla/UiEditorSlashMenu.js +1 -1
- package/vanilla/UiEditorSlashMenuGroup.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuGroup.js +1 -1
- package/vanilla/UiEditorSlashMenuItem.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuItem.js +1 -1
- package/vanilla/UiEditorTableContextMenu.d.ts +1 -1
- package/vanilla/UiEditorTableContextMenu.js +1 -1
- package/vanilla/UiEditorTableOverlay.d.ts +1 -1
- package/vanilla/UiEditorTableOverlay.js +1 -1
- package/vanilla/UiEditorTableToolbar.d.ts +1 -1
- package/vanilla/UiEditorTableToolbar.js +1 -1
- package/vanilla/UiEditorToolbar.d.ts +1 -1
- package/vanilla/UiEditorToolbar.js +1 -1
- package/vanilla/UiFloatingActionButton.d.ts +1 -1
- package/vanilla/UiFloatingActionButton.js +1 -1
- package/vanilla/UiFormField.d.ts +1 -1
- package/vanilla/UiFormField.js +1 -1
- package/vanilla/UiGrid.d.ts +1 -1
- package/vanilla/UiGrid.js +1 -1
- package/vanilla/UiIcon.d.ts +1 -1
- package/vanilla/UiIcon.js +1 -1
- package/vanilla/UiIconButton.d.ts +1 -1
- package/vanilla/UiIconButton.js +1 -1
- package/vanilla/UiInput.d.ts +1 -1
- package/vanilla/UiInput.js +1 -1
- package/vanilla/UiInputGroup.d.ts +1 -1
- package/vanilla/UiInputGroup.js +1 -1
- package/vanilla/UiList.d.ts +1 -1
- package/vanilla/UiList.js +1 -1
- package/vanilla/UiListItem.d.ts +1 -1
- package/vanilla/UiListItem.js +1 -1
- package/vanilla/UiListbox.d.ts +1 -1
- package/vanilla/UiListbox.js +1 -1
- package/vanilla/UiMenu.d.ts +1 -1
- package/vanilla/UiMenu.js +1 -1
- package/vanilla/UiMenuGroup.d.ts +1 -1
- package/vanilla/UiMenuGroup.js +1 -1
- package/vanilla/UiMenuItem.d.ts +1 -1
- package/vanilla/UiMenuItem.js +1 -1
- package/vanilla/UiMeter.d.ts +1 -1
- package/vanilla/UiMeter.js +1 -1
- package/vanilla/UiNavItem.d.ts +1 -1
- package/vanilla/UiNavItem.js +1 -1
- package/vanilla/UiPageHeader.d.ts +1 -1
- package/vanilla/UiPageHeader.js +1 -1
- package/vanilla/UiPopover.d.ts +1 -1
- package/vanilla/UiPopover.js +1 -1
- package/vanilla/UiRadio.d.ts +1 -1
- package/vanilla/UiRadio.js +1 -1
- package/vanilla/UiRadioGroup.d.ts +1 -1
- package/vanilla/UiRadioGroup.js +1 -1
- package/vanilla/UiReel.d.ts +1 -1
- package/vanilla/UiReel.js +1 -1
- package/vanilla/UiScrollArea.d.ts +1 -1
- package/vanilla/UiScrollArea.js +1 -1
- package/vanilla/UiSearchResultRow.d.ts +1 -1
- package/vanilla/UiSearchResultRow.js +1 -1
- package/vanilla/UiSearchShell.d.ts +1 -1
- package/vanilla/UiSearchShell.js +1 -1
- package/vanilla/UiSection.d.ts +1 -1
- package/vanilla/UiSection.js +1 -1
- package/vanilla/UiSelect.d.ts +1 -1
- package/vanilla/UiSelect.js +1 -1
- package/vanilla/UiSeparator.d.ts +1 -1
- package/vanilla/UiSeparator.js +1 -1
- package/vanilla/UiSidebar.d.ts +1 -1
- package/vanilla/UiSidebar.js +1 -1
- package/vanilla/UiSpinner.d.ts +1 -1
- package/vanilla/UiSpinner.js +1 -1
- package/vanilla/UiStack.d.ts +1 -1
- package/vanilla/UiStack.js +1 -1
- package/vanilla/UiStatusMessage.d.ts +1 -1
- package/vanilla/UiStatusMessage.js +1 -1
- package/vanilla/UiSwitch.d.ts +1 -1
- package/vanilla/UiSwitch.js +1 -1
- package/vanilla/UiSwitcher.d.ts +1 -1
- package/vanilla/UiSwitcher.js +1 -1
- package/vanilla/UiTable.d.ts +1 -1
- package/vanilla/UiTable.js +1 -1
- package/vanilla/UiTabs.d.ts +1 -1
- package/vanilla/UiTabs.js +1 -1
- package/vanilla/UiText.d.ts +1 -1
- package/vanilla/UiText.js +1 -1
- package/vanilla/UiTextarea.d.ts +1 -1
- package/vanilla/UiTextarea.js +1 -1
- package/vanilla/UiToast.d.ts +1 -1
- package/vanilla/UiToast.js +1 -1
- package/vanilla/UiToastRegion.d.ts +1 -1
- package/vanilla/UiToastRegion.js +1 -1
- package/vanilla/UiTooltip.d.ts +1 -1
- package/vanilla/UiTooltip.js +1 -1
- package/vanilla/UiTopBar.d.ts +1 -1
- package/vanilla/UiTopBar.js +1 -1
- package/vanilla/UiTree.d.ts +1 -1
- package/vanilla/UiTree.js +1 -1
- package/vanilla/UiTreeItem.d.ts +1 -1
- package/vanilla/UiTreeItem.js +1 -1
- package/vue/UiActionBar.vue +1 -1
- package/vue/UiAffordanceScope.vue +17 -4
- package/vue/UiAvatar.vue +38 -5
- package/vue/UiAvatarGroup.vue +32 -5
- package/vue/UiBadge.vue +13 -3
- package/vue/UiBreadcrumbItem.vue +5 -3
- package/vue/UiBreadcrumbs.vue +5 -3
- package/vue/UiButton.vue +72 -7
- package/vue/UiCallout.vue +5 -3
- package/vue/UiCard.vue +16 -6
- package/vue/UiCheckbox.vue +41 -4
- package/vue/UiCluster.vue +8 -3
- package/vue/UiCombobox.vue +98 -6
- package/vue/UiContainer.vue +6 -3
- package/vue/UiContextMenu.vue +17 -4
- package/vue/UiCover.vue +5 -3
- package/vue/UiDescriptionItem.vue +5 -3
- package/vue/UiDescriptionList.vue +11 -3
- package/vue/UiDialog.vue +44 -5
- package/vue/UiDisclosure.vue +28 -4
- package/vue/UiEditable.vue +50 -4
- package/vue/UiEditorInsertTableGrid.vue +24 -4
- package/vue/UiEditorMentionMenu.vue +41 -4
- package/vue/UiEditorMentionMenuItem.vue +7 -3
- package/vue/UiEditorSlashMenu.vue +28 -4
- package/vue/UiEditorSlashMenuGroup.vue +5 -3
- package/vue/UiEditorSlashMenuItem.vue +15 -3
- package/vue/UiEditorTableContextMenu.vue +28 -4
- package/vue/UiEditorTableOverlay.vue +17 -4
- package/vue/UiEditorTableToolbar.vue +28 -4
- package/vue/UiEditorToolbar.vue +16 -4
- package/vue/UiFloatingActionButton.vue +7 -3
- package/vue/UiFormField.vue +18 -4
- package/vue/UiGrid.vue +7 -3
- package/vue/UiIcon.vue +5 -3
- package/vue/UiIconButton.vue +47 -5
- package/vue/UiInput.vue +90 -37
- package/vue/UiInputGroup.vue +30 -4
- package/vue/UiList.vue +20 -7
- package/vue/UiListItem.vue +6 -3
- package/vue/UiListbox.vue +38 -5
- package/vue/UiMenu.vue +28 -4
- package/vue/UiMenuGroup.vue +5 -3
- package/vue/UiMenuItem.vue +27 -5
- package/vue/UiMeter.vue +19 -3
- package/vue/UiNavItem.vue +28 -6
- package/vue/UiPageHeader.vue +5 -3
- package/vue/UiPopover.vue +18 -5
- package/vue/UiRadio.vue +28 -4
- package/vue/UiRadioGroup.vue +30 -4
- package/vue/UiReel.vue +7 -3
- package/vue/UiScrollArea.vue +16 -4
- package/vue/UiSearchResultRow.d.ts +1 -1
- package/vue/UiSearchResultRow.vue +6 -3
- package/vue/UiSearchShell.vue +32 -4
- package/vue/UiSection.vue +7 -3
- package/vue/UiSelect.vue +33 -5
- package/vue/UiSeparator.vue +5 -3
- package/vue/UiSidebar.vue +44 -4
- package/vue/UiSpinner.vue +6 -3
- package/vue/UiStack.vue +7 -3
- package/vue/UiStatusMessage.vue +7 -3
- package/vue/UiSwitch.vue +28 -4
- package/vue/UiSwitcher.vue +30 -5
- package/vue/UiTable.vue +17 -4
- package/vue/UiTabs.vue +28 -4
- package/vue/UiText.vue +29 -15
- package/vue/UiTextarea.vue +39 -5
- package/vue/UiToast.vue +17 -4
- package/vue/UiToastRegion.vue +17 -5
- package/vue/UiTooltip.vue +30 -5
- package/vue/UiTopBar.vue +1 -1
- package/vue/UiTree.vue +28 -4
- package/vue/UiTreeItem.d.ts +1 -1
- package/vue/UiTreeItem.vue +59 -4
- package/vue/chunks/UiActionBar.js +1 -1
- package/vue/chunks/UiAffordanceScope.js +19 -5
- package/vue/chunks/UiAvatar.js +40 -11
- package/vue/chunks/UiAvatarGroup.js +31 -8
- package/vue/chunks/UiBadge.js +13 -7
- package/vue/chunks/UiBreadcrumbItem.js +5 -4
- package/vue/chunks/UiBreadcrumbs.js +5 -4
- package/vue/chunks/UiButton.js +60 -19
- package/vue/chunks/UiCallout.js +5 -4
- package/vue/chunks/UiCard.js +16 -10
- package/vue/chunks/UiCheckbox.js +40 -11
- package/vue/chunks/UiCluster.js +13 -7
- package/vue/chunks/UiCombobox.js +85 -26
- package/vue/chunks/UiContainer.js +9 -5
- package/vue/chunks/UiContextMenu.js +19 -5
- package/vue/chunks/UiCover.js +5 -4
- package/vue/chunks/UiDescriptionItem.js +5 -4
- package/vue/chunks/UiDescriptionList.js +11 -6
- package/vue/chunks/UiDialog.js +40 -11
- package/vue/chunks/UiDisclosure.js +34 -9
- package/vue/chunks/UiEditable.js +49 -14
- package/vue/chunks/UiEditorInsertTableGrid.js +28 -7
- package/vue/chunks/UiEditorMentionMenu.js +40 -11
- package/vue/chunks/UiEditorMentionMenuItem.js +11 -6
- package/vue/chunks/UiEditorSlashMenu.js +34 -9
- package/vue/chunks/UiEditorSlashMenuGroup.js +5 -4
- package/vue/chunks/UiEditorSlashMenuItem.js +15 -8
- package/vue/chunks/UiEditorTableContextMenu.js +34 -9
- package/vue/chunks/UiEditorTableOverlay.js +19 -5
- package/vue/chunks/UiEditorTableToolbar.js +34 -9
- package/vue/chunks/UiEditorToolbar.js +15 -4
- package/vue/chunks/UiFloatingActionButton.js +11 -6
- package/vue/chunks/UiFormField.js +26 -7
- package/vue/chunks/UiGrid.js +11 -6
- package/vue/chunks/UiIcon.js +5 -4
- package/vue/chunks/UiIconButton.js +41 -12
- package/vue/chunks/UiInput.js +53 -14
- package/vue/chunks/UiInputGroup.js +16 -5
- package/vue/chunks/UiList.js +14 -8
- package/vue/chunks/UiListItem.js +9 -5
- package/vue/chunks/UiListbox.js +40 -11
- package/vue/chunks/UiMenu.js +34 -9
- package/vue/chunks/UiMenuGroup.js +5 -4
- package/vue/chunks/UiMenuItem.js +32 -9
- package/vue/chunks/UiMeter.js +19 -10
- package/vue/chunks/UiNavItem.js +16 -9
- package/vue/chunks/UiPageHeader.js +5 -4
- package/vue/chunks/UiPopover.js +25 -6
- package/vue/chunks/UiRadio.js +34 -9
- package/vue/chunks/UiRadioGroup.js +37 -10
- package/vue/chunks/UiReel.js +11 -6
- package/vue/chunks/UiScrollArea.js +15 -4
- package/vue/chunks/UiSearchResultRow.js +9 -5
- package/vue/chunks/UiSearchShell.js +28 -7
- package/vue/chunks/UiSection.js +11 -6
- package/vue/chunks/UiSelect.js +33 -10
- package/vue/chunks/UiSeparator.js +5 -4
- package/vue/chunks/UiSidebar.js +43 -12
- package/vue/chunks/UiSpinner.js +9 -5
- package/vue/chunks/UiStack.js +11 -6
- package/vue/chunks/UiStatusMessage.js +11 -6
- package/vue/chunks/UiSwitch.js +34 -9
- package/vue/chunks/UiSwitcher.js +28 -7
- package/vue/chunks/UiTable.js +20 -6
- package/vue/chunks/UiTabs.js +34 -9
- package/vue/chunks/UiText.js +29 -20
- package/vue/chunks/UiTextarea.js +42 -13
- package/vue/chunks/UiToast.js +19 -5
- package/vue/chunks/UiToastRegion.js +19 -5
- package/vue/chunks/UiTooltip.js +37 -10
- package/vue/chunks/UiTopBar.js +1 -1
- package/vue/chunks/UiTree.js +35 -10
- package/vue/chunks/UiTreeItem.js +58 -17
- package/vue/chunks/host.js +22 -4
- package/vue/chunks/props.js +20 -7
- package/vue/components.css +1228 -1205
- package/vue/editor/index.js +9 -2
- package/vue/host.ts +50 -6
|
@@ -12,7 +12,7 @@ export default function controller(host) {
|
|
|
12
12
|
const overlayId = `ui-dialog-${Math.random().toString(36).slice(2, 11)}`;
|
|
13
13
|
let trigger = null;
|
|
14
14
|
let lastFor = "";
|
|
15
|
-
let lastExternalOpen = Boolean(host.
|
|
15
|
+
let lastExternalOpen = Boolean(host.props.open.value);
|
|
16
16
|
let lastOpen;
|
|
17
17
|
host.state.internalOpen = lastExternalOpen;
|
|
18
18
|
|
|
@@ -34,7 +34,7 @@ export default function controller(host) {
|
|
|
34
34
|
apply();
|
|
35
35
|
});
|
|
36
36
|
const syncTrigger = () => {
|
|
37
|
-
const nextFor = String(host.
|
|
37
|
+
const nextFor = String(host.props.for.value ?? "");
|
|
38
38
|
if (nextFor === lastFor) return;
|
|
39
39
|
lastFor = nextFor;
|
|
40
40
|
trigger?.removeEventListener("click", onTriggerClick);
|
|
@@ -47,22 +47,22 @@ export default function controller(host) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const apply = () => {
|
|
50
|
-
const externalOpen = Boolean(host.
|
|
50
|
+
const externalOpen = Boolean(host.props.open.value);
|
|
51
51
|
if (externalOpen !== lastExternalOpen) {
|
|
52
52
|
lastExternalOpen = externalOpen;
|
|
53
53
|
host.state.internalOpen = externalOpen;
|
|
54
54
|
}
|
|
55
|
-
host.state.accessibleLabel = inferredLabel(element, host.
|
|
55
|
+
host.state.accessibleLabel = inferredLabel(element, host.props.label.value);
|
|
56
56
|
dialog?.setAttribute("aria-label", String(host.state.accessibleLabel));
|
|
57
|
-
if (host.
|
|
57
|
+
if (host.props.alert.value) dialog?.setAttribute("role", "alertdialog");
|
|
58
58
|
else dialog?.removeAttribute("role");
|
|
59
59
|
syncTrigger();
|
|
60
60
|
const open = Boolean(host.state.internalOpen);
|
|
61
61
|
// `modeless` is a deprecated no-op: non-modal is the default. An alert dialog is always modal (APG alertdialog).
|
|
62
|
-
const modal = Boolean(host.
|
|
62
|
+
const modal = Boolean(host.props.modal.value || host.props.alert.value);
|
|
63
63
|
// An unset or unknown closedby follows native <dialog>'s auto state: closerequest when modal, none otherwise.
|
|
64
|
-
const requestedClosedBy = ["any", "closerequest", "none"].includes(host.
|
|
65
|
-
const closedBy = host.
|
|
64
|
+
const requestedClosedBy = ["any", "closerequest", "none"].includes(host.props.closedby.value) ? host.props.closedby.value : modal ? "closerequest" : "none";
|
|
65
|
+
const closedBy = host.props.alert.value && requestedClosedBy === "any" ? "closerequest" : requestedClosedBy;
|
|
66
66
|
trigger?.setAttribute("aria-expanded", String(open));
|
|
67
67
|
if (!dialog) return;
|
|
68
68
|
dialog.setAttribute("closedby", closedBy);
|
|
@@ -72,7 +72,7 @@ export default function controller(host) {
|
|
|
72
72
|
if (modal) dialog.showModal();
|
|
73
73
|
else dialog.show();
|
|
74
74
|
}
|
|
75
|
-
openOverlay({ id: overlayId, modal, element, dismissible: true, canClose: (reason) => reason === "light-dismiss" ? closedBy === "any" : reason !== "escape" || closedBy !== "none", requestClose });
|
|
75
|
+
openOverlay({ id: overlayId, modal, element, modalElement: dialog, dismissible: true, canClose: (reason) => reason === "light-dismiss" ? closedBy === "any" : reason !== "escape" || closedBy !== "none", requestClose });
|
|
76
76
|
} else {
|
|
77
77
|
if (dialog.open) dialog.close();
|
|
78
78
|
closeOverlay(document, overlayId);
|
|
@@ -83,7 +83,7 @@ export default function controller(host) {
|
|
|
83
83
|
lastOpen = open;
|
|
84
84
|
};
|
|
85
85
|
const onClose = (event) => {
|
|
86
|
-
if (event instanceof CustomEvent) return;
|
|
86
|
+
if (event instanceof CustomEvent || event.target !== dialog) return;
|
|
87
87
|
// Consumers receive one Looma close event with a reason, not an additional native close event.
|
|
88
88
|
event.stopImmediatePropagation();
|
|
89
89
|
if (dialog.open || !host.state.internalOpen) return;
|
|
@@ -104,7 +104,7 @@ export default function controller(host) {
|
|
|
104
104
|
requestTopOverlayClose(document, "escape", "keyboard");
|
|
105
105
|
};
|
|
106
106
|
const observer = new MutationObserver(() => {
|
|
107
|
-
const label = inferredLabel(element, host.
|
|
107
|
+
const label = inferredLabel(element, host.props.label.value);
|
|
108
108
|
if (label !== host.state.accessibleLabel) host.state.accessibleLabel = label;
|
|
109
109
|
});
|
|
110
110
|
observer.observe(element, { childList: true, subtree: true, characterData: true });
|
|
@@ -16,7 +16,7 @@ export default function controller(host) {
|
|
|
16
16
|
const document = host.element.ownerDocument;
|
|
17
17
|
const [trigger, stopTracking] = trackTrigger(host);
|
|
18
18
|
host.state.contentId = `ui-disclosure-${++disclosures}`;
|
|
19
|
-
let external = host.
|
|
19
|
+
let external = host.props.open.value;
|
|
20
20
|
host.state.internalOpen = Boolean(external);
|
|
21
21
|
let groupName = "";
|
|
22
22
|
const member = {
|
|
@@ -27,7 +27,7 @@ export default function controller(host) {
|
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
const syncGroup = (reason, how) => {
|
|
30
|
-
const name = String(host.
|
|
30
|
+
const name = String(host.props.name.value || "");
|
|
31
31
|
if (name !== groupName) {
|
|
32
32
|
if (groupName) groupFor(document, groupName).delete(member);
|
|
33
33
|
groupName = name;
|
|
@@ -38,11 +38,11 @@ export default function controller(host) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
const stop = host.effect(() => {
|
|
41
|
-
if (host.
|
|
42
|
-
external = host.
|
|
41
|
+
if (host.props.open.value !== external) {
|
|
42
|
+
external = host.props.open.value;
|
|
43
43
|
host.state.internalOpen = Boolean(external);
|
|
44
44
|
}
|
|
45
|
-
const level = Number(host.
|
|
45
|
+
const level = Number(host.props.headingLevel.value);
|
|
46
46
|
host.state.headingRole = Number.isInteger(level) && level >= 2 && level <= 6 ? "heading" : null;
|
|
47
47
|
host.state.headingAriaLevel = host.state.headingRole ? level : null;
|
|
48
48
|
syncGroup("programmatic", "programmatic");
|
|
@@ -50,7 +50,7 @@ export default function controller(host) {
|
|
|
50
50
|
else host.refs.panel.setAttribute("hidden", "until-found");
|
|
51
51
|
});
|
|
52
52
|
const onClick = () => {
|
|
53
|
-
if (host.
|
|
53
|
+
if (host.props.disabled.value) return;
|
|
54
54
|
const open = !host.state.internalOpen;
|
|
55
55
|
const how = trigger();
|
|
56
56
|
host.state.internalOpen = open;
|
|
@@ -8,15 +8,15 @@ export default function controller(host) {
|
|
|
8
8
|
const document = element.ownerDocument;
|
|
9
9
|
const { preview, input } = host.refs;
|
|
10
10
|
|
|
11
|
-
let lastExternalEdit = Boolean(host.
|
|
12
|
-
let lastExternalValue = String(host.
|
|
11
|
+
let lastExternalEdit = Boolean(host.props.edit.value);
|
|
12
|
+
let lastExternalValue = String(host.props.value.value ?? "");
|
|
13
13
|
host.state.internalEdit = lastExternalEdit;
|
|
14
14
|
host.state.internalValue = lastExternalValue;
|
|
15
15
|
host.state.draft = lastExternalValue;
|
|
16
16
|
|
|
17
17
|
const apply = () => {
|
|
18
|
-
const externalEdit = Boolean(host.
|
|
19
|
-
const externalValue = String(host.
|
|
18
|
+
const externalEdit = Boolean(host.props.edit.value);
|
|
19
|
+
const externalValue = String(host.props.value.value ?? "");
|
|
20
20
|
if (externalEdit !== lastExternalEdit) {
|
|
21
21
|
lastExternalEdit = externalEdit;
|
|
22
22
|
host.state.internalEdit = externalEdit;
|
|
@@ -29,13 +29,13 @@ export default function controller(host) {
|
|
|
29
29
|
}
|
|
30
30
|
// The inactive input stays in layout (it shares the value's cell) but out of the tab order.
|
|
31
31
|
input.tabIndex = host.state.internalEdit ? 0 : -1;
|
|
32
|
-
const maxLength = Number(host.
|
|
32
|
+
const maxLength = Number(host.props.maxLength.value);
|
|
33
33
|
if (Number.isFinite(maxLength) && maxLength > 0) input.maxLength = Math.floor(maxLength);
|
|
34
34
|
else input.removeAttribute("maxlength");
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const setEditing = (next, reason, trigger, returnFocus = true) => {
|
|
38
|
-
if (host.
|
|
38
|
+
if (host.props.disabled.value || Boolean(host.state.internalEdit) === next) return;
|
|
39
39
|
// Measured before the input is disabled, which drops focus to the body. A press elsewhere has
|
|
40
40
|
// not moved focus yet, so it says not to return it.
|
|
41
41
|
const focusWasInside = returnFocus && element.contains(document.activeElement);
|
|
@@ -8,12 +8,12 @@ export default function controller(host) {
|
|
|
8
8
|
const element = host.element;
|
|
9
9
|
let selected = { rows: 3, cols: 3 };
|
|
10
10
|
let preview = null;
|
|
11
|
-
let lastHeaderRow = Boolean(host.
|
|
11
|
+
let lastHeaderRow = Boolean(host.props.headerRow.value);
|
|
12
12
|
host.state.withHeaderRow = lastHeaderRow;
|
|
13
13
|
|
|
14
14
|
const update = () => {
|
|
15
|
-
const rows = bounded(host.
|
|
16
|
-
const cols = bounded(host.
|
|
15
|
+
const rows = bounded(host.props.maxRows.value, 8);
|
|
16
|
+
const cols = bounded(host.props.maxCols.value, 8);
|
|
17
17
|
selected = { rows: Math.min(selected.rows, rows), cols: Math.min(selected.cols, cols) };
|
|
18
18
|
const active = preview ?? selected;
|
|
19
19
|
host.state.rows = rows;
|
|
@@ -26,7 +26,7 @@ export default function controller(host) {
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
const stop = host.effect(() => {
|
|
29
|
-
const headerRow = Boolean(host.
|
|
29
|
+
const headerRow = Boolean(host.props.headerRow.value);
|
|
30
30
|
if (headerRow !== lastHeaderRow) {
|
|
31
31
|
lastHeaderRow = headerRow;
|
|
32
32
|
host.state.withHeaderRow = headerRow;
|
|
@@ -5,7 +5,7 @@ export default function controller(host) {
|
|
|
5
5
|
const element = host.element;
|
|
6
6
|
const authoredLabel = element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby");
|
|
7
7
|
const place = () => {
|
|
8
|
-
if (host.state.visible) positionMenu(element, normalizeAnchor(host.
|
|
8
|
+
if (host.state.visible) positionMenu(element, normalizeAnchor(host.props.anchorRect.value), 320);
|
|
9
9
|
};
|
|
10
10
|
const options = () => Array.from(element.querySelectorAll('[role="option"]'));
|
|
11
11
|
const syncOptions = () => {
|
|
@@ -19,18 +19,18 @@ export default function controller(host) {
|
|
|
19
19
|
if (rows.length) element.setAttribute("aria-activedescendant", rows[active].id);
|
|
20
20
|
else element.removeAttribute("aria-activedescendant");
|
|
21
21
|
const empty = Boolean(host.refs.empty.children.length);
|
|
22
|
-
host.refs.empty.hidden = rows.length > 0 || host.
|
|
23
|
-
const visible = Boolean(host.
|
|
24
|
-
&& (host.
|
|
22
|
+
host.refs.empty.hidden = rows.length > 0 || host.props.loading.value;
|
|
23
|
+
const visible = Boolean(host.props.open.value && normalizeAnchor(host.props.anchorRect.value)
|
|
24
|
+
&& (host.props.loading.value || rows.length > 0 || empty));
|
|
25
25
|
if (host.state.visible !== visible) host.state.visible = visible;
|
|
26
26
|
place();
|
|
27
27
|
};
|
|
28
28
|
const stop = host.effect(() => {
|
|
29
|
-
if (!authoredLabel) element.setAttribute("aria-label", String(host.
|
|
30
|
-
const items = (Array.isArray(host.
|
|
29
|
+
if (!authoredLabel) element.setAttribute("aria-label", String(host.props.label.value || "Mentions"));
|
|
30
|
+
const items = (Array.isArray(host.props.items.value) ? host.props.items.value : []).slice(0, 20);
|
|
31
31
|
host.state.rows = items.map((item) => ({ ...item, initials: item.initials ?? String(item.label).slice(0, 2).toUpperCase() }));
|
|
32
|
-
host.state.searching = Boolean(host.
|
|
33
|
-
host.state.active = Math.min(Number(host.
|
|
32
|
+
host.state.searching = Boolean(host.props.loading.value && !items.length);
|
|
33
|
+
host.state.active = Math.min(Number(host.props.selectedIndex.value ?? 0), Math.max(0, items.length - 1));
|
|
34
34
|
host.state.prefix = element.id || "ui-editor-mention-menu";
|
|
35
35
|
queueMicrotask(syncOptions);
|
|
36
36
|
});
|
|
@@ -5,11 +5,11 @@ export default function controller(host) {
|
|
|
5
5
|
const element = host.element;
|
|
6
6
|
const authoredLabel = element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby");
|
|
7
7
|
const place = () => {
|
|
8
|
-
if (host.state.visible) positionMenu(element, normalizeAnchor(host.
|
|
8
|
+
if (host.state.visible) positionMenu(element, normalizeAnchor(host.props.anchorRect.value), 280);
|
|
9
9
|
};
|
|
10
10
|
const options = () => Array.from(element.querySelectorAll('[role="option"]'));
|
|
11
11
|
const syncOptions = () => {
|
|
12
|
-
const query = String(host.
|
|
12
|
+
const query = String(host.props.query.value || "").trim().toLocaleLowerCase();
|
|
13
13
|
const generated = host.state.rows.length > 0;
|
|
14
14
|
for (const row of options()) {
|
|
15
15
|
if (generated) break;
|
|
@@ -28,16 +28,16 @@ export default function controller(host) {
|
|
|
28
28
|
row.setAttribute("aria-selected", String(index === active));
|
|
29
29
|
});
|
|
30
30
|
host.refs.empty.hidden = rows.length > 0;
|
|
31
|
-
const visible = Boolean(host.
|
|
31
|
+
const visible = Boolean(host.props.open.value && normalizeAnchor(host.props.anchorRect.value)
|
|
32
32
|
&& (rows.length > 0 || host.refs.empty.children.length));
|
|
33
33
|
if (host.state.visible !== visible) host.state.visible = visible;
|
|
34
34
|
place();
|
|
35
35
|
};
|
|
36
36
|
const stop = host.effect(() => {
|
|
37
|
-
const items = Array.isArray(host.
|
|
38
|
-
if (!authoredLabel) element.setAttribute("aria-label", String(host.
|
|
37
|
+
const items = Array.isArray(host.props.items.value) ? host.props.items.value : [];
|
|
38
|
+
if (!authoredLabel) element.setAttribute("aria-label", String(host.props.label.value || "Insert block"));
|
|
39
39
|
host.state.rows = items.map((item) => ({ ...item, value: String(item.value ?? item.title) }));
|
|
40
|
-
host.state.active = Number(host.
|
|
40
|
+
host.state.active = Number(host.props.selectedIndex.value ?? 0);
|
|
41
41
|
queueMicrotask(syncOptions);
|
|
42
42
|
});
|
|
43
43
|
const rowOf = (event) => event.target.closest?.('[role="option"]');
|
|
@@ -48,10 +48,10 @@ export default function controller(host) {
|
|
|
48
48
|
frame = requestAnimationFrame(nudge);
|
|
49
49
|
};
|
|
50
50
|
const stop = host.effect(() => {
|
|
51
|
-
const scope = String(host.
|
|
52
|
-
const enabled = new Set((Array.isArray(host.
|
|
51
|
+
const scope = String(host.props.scope.value || "cell");
|
|
52
|
+
const enabled = new Set((Array.isArray(host.props.actions.value) ? host.props.actions.value : []).filter((action) =>
|
|
53
53
|
scope === "cell" || (scope === "row" ? !action.includes("column") : !action.includes("row"))));
|
|
54
|
-
const background = String(host.
|
|
54
|
+
const background = String(host.props.cellBackground.value ?? "");
|
|
55
55
|
const swatches = backgrounds.filter(([action]) => enabled.has(action))
|
|
56
56
|
.map(([action, label, color]) => ({ action, label, color, selected: color === background }));
|
|
57
57
|
host.state.swatches = swatches.length ? swatches : null;
|
|
@@ -59,10 +59,10 @@ export default function controller(host) {
|
|
|
59
59
|
.map(([heading, items]) => ({
|
|
60
60
|
heading,
|
|
61
61
|
items: items.filter(([action]) => enabled.has(action))
|
|
62
|
-
.map(([action, label, icon, tone]) => ({ action, label, icon, danger: tone === "danger", checkable: action.startsWith("toggle-header-"), checked: action === "toggle-header-row" ? Boolean(host.
|
|
62
|
+
.map(([action, label, icon, tone]) => ({ action, label, icon, danger: tone === "danger", checkable: action.startsWith("toggle-header-"), checked: action === "toggle-header-row" ? Boolean(host.props.headerRow.value) : action === "toggle-header-column" ? Boolean(host.props.headerColumn.value) : false })),
|
|
63
63
|
}))
|
|
64
64
|
.filter((section) => section.items.length);
|
|
65
|
-
if (host.
|
|
65
|
+
if (host.props.open.value) schedule();
|
|
66
66
|
});
|
|
67
67
|
const onClick = (event) => {
|
|
68
68
|
const action = event.target.closest?.("[data-action]")?.dataset.action;
|
|
@@ -99,7 +99,7 @@ export default function controller(host) {
|
|
|
99
99
|
if (to !== from) host.dispatch(axis === "row" ? "reorder-row" : "reorder-column", { fromIndex: from, toIndex: to });
|
|
100
100
|
};
|
|
101
101
|
const boundaries = (axis) => {
|
|
102
|
-
const values = host.
|
|
102
|
+
const values = host.props.geometry.value?.[axis === "row" ? "rowBoundaries" : "columnBoundaries"];
|
|
103
103
|
if (Array.isArray(values) && values.length >= 2 && values.every(Number.isFinite)) return values;
|
|
104
104
|
const rect = element.getBoundingClientRect();
|
|
105
105
|
return fallbackBoundaries(3, axis === "row" ? rect.height : rect.width);
|
|
@@ -118,19 +118,19 @@ export default function controller(host) {
|
|
|
118
118
|
};
|
|
119
119
|
});
|
|
120
120
|
const stop = host.effect(() => {
|
|
121
|
-
if (!host.
|
|
121
|
+
if (!host.props.open.value) {
|
|
122
122
|
host.state.activeKey = "";
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
host.state.rows = controls("row");
|
|
126
126
|
host.state.cols = controls("col");
|
|
127
|
-
const hovered = host.
|
|
127
|
+
const hovered = host.props.geometry.value?.hoveredCell ?? null;
|
|
128
128
|
host.state.hovered = hovered && {
|
|
129
129
|
...hovered,
|
|
130
130
|
rowOffset: `${hovered.top + hovered.height / 2}px`,
|
|
131
131
|
columnOffset: `${hovered.left + hovered.width / 2}px`,
|
|
132
132
|
};
|
|
133
|
-
const active = host.
|
|
133
|
+
const active = host.props.geometry.value?.activeCell ?? null;
|
|
134
134
|
host.state.active = active && { ...active, menuLeft: `${active.left + active.width - 30}px`, menuTop: `${active.top + 6}px` };
|
|
135
135
|
queueMicrotask(proximity.refresh);
|
|
136
136
|
});
|
|
@@ -24,26 +24,26 @@ export default function controller(host) {
|
|
|
24
24
|
menu.style.bottom = below >= above ? "auto" : "calc(100% + var(--ui-space-2))";
|
|
25
25
|
};
|
|
26
26
|
const stop = host.effect(() => {
|
|
27
|
-
const enabled = new Set(Array.isArray(host.
|
|
28
|
-
const alignment = host.
|
|
27
|
+
const enabled = new Set(Array.isArray(host.props.actions.value) ? host.props.actions.value : []);
|
|
28
|
+
const alignment = host.props.cellAlignment.value === "center" || host.props.cellAlignment.value === "right" ? host.props.cellAlignment.value : "left";
|
|
29
29
|
host.state.alignments = [["align-left", "Align left"], ["align-center", "Align center"], ["align-right", "Align right"]]
|
|
30
30
|
.filter(([action]) => enabled.has(action))
|
|
31
31
|
.map(([action, label]) => ({ action, label, active: action === `align-${alignment}` }));
|
|
32
32
|
host.state.structure = [["add-row-after", "Add row", "rows"], ["add-column-after", "Add column", "columns"]]
|
|
33
33
|
.filter(([action]) => enabled.has(action))
|
|
34
34
|
.map(([action, label, icon]) => ({ action, label, icon }));
|
|
35
|
-
const background = String(host.
|
|
35
|
+
const background = String(host.props.cellBackground.value ?? "");
|
|
36
36
|
host.state.swatches = backgrounds.filter(([action]) => enabled.has(action))
|
|
37
37
|
.map(([action, label, color]) => ({ action, label, color, selected: color === background }));
|
|
38
38
|
host.state.sections = overflowSections
|
|
39
39
|
.map(([heading, items]) => ({
|
|
40
40
|
heading,
|
|
41
41
|
items: items.filter(([action]) => enabled.has(action))
|
|
42
|
-
.map(([action, label, icon, tone]) => ({ action, label, icon, danger: tone === "danger", checkable: action.startsWith("toggle-header-"), checked: action === "toggle-header-row" ? Boolean(host.
|
|
42
|
+
.map(([action, label, icon, tone]) => ({ action, label, icon, danger: tone === "danger", checkable: action.startsWith("toggle-header-"), checked: action === "toggle-header-row" ? Boolean(host.props.headerRow.value) : action === "toggle-header-column" ? Boolean(host.props.headerColumn.value) : false })),
|
|
43
43
|
}))
|
|
44
44
|
.filter((section) => section.items.length);
|
|
45
45
|
host.state.hasOverflow = host.state.swatches.length > 0 || host.state.sections.length > 0;
|
|
46
|
-
if (!host.
|
|
46
|
+
if (!host.props.open.value || !host.state.hasOverflow) host.state.overflowOpen = false;
|
|
47
47
|
});
|
|
48
48
|
const onClick = (event) => {
|
|
49
49
|
const action = event.target.closest?.("[data-action]")?.dataset.action;
|
|
@@ -44,7 +44,7 @@ export default function controller(host) {
|
|
|
44
44
|
if (!help.id) help.id = id("form-field-help");
|
|
45
45
|
described.push(help.id);
|
|
46
46
|
}
|
|
47
|
-
if (error && host.
|
|
47
|
+
if (error && host.props.invalid.value) {
|
|
48
48
|
if (!error.id) error.id = id("form-field-error");
|
|
49
49
|
described.push(error.id);
|
|
50
50
|
}
|
|
@@ -52,9 +52,9 @@ export default function controller(host) {
|
|
|
52
52
|
const next = Array.from(new Set([...external, ...described])).join(" ");
|
|
53
53
|
if (next && input.getAttribute("aria-describedby") !== next) input.setAttribute("aria-describedby", next);
|
|
54
54
|
else if (!next && input.hasAttribute("aria-describedby")) input.removeAttribute("aria-describedby");
|
|
55
|
-
input.disabled = Boolean(host.
|
|
56
|
-
input.required = Boolean(host.
|
|
57
|
-
input.setAttribute("aria-invalid", String(Boolean(host.
|
|
55
|
+
input.disabled = Boolean(host.props.disabled.value);
|
|
56
|
+
input.required = Boolean(host.props.required.value);
|
|
57
|
+
input.setAttribute("aria-invalid", String(Boolean(host.props.invalid.value)));
|
|
58
58
|
};
|
|
59
59
|
const schedule = () => {
|
|
60
60
|
if (queued) return;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Marks an anticipatory button for the enclosing ui-affordance-scope, which reveals it on proximity.
|
|
2
2
|
export default function controller(host) {
|
|
3
3
|
const stop = host.effect(() => {
|
|
4
|
-
if (host.
|
|
4
|
+
if (host.props.anticipatory.value) host.element.setAttribute("data-ui-affordance", "button");
|
|
5
5
|
else host.element.removeAttribute("data-ui-affordance");
|
|
6
6
|
});
|
|
7
7
|
const onClick = (event) => {
|
|
8
|
-
if (!host.
|
|
8
|
+
if (!host.props.loading.value && !host.props.pending.value) return;
|
|
9
9
|
event.preventDefault();
|
|
10
10
|
event.stopImmediatePropagation();
|
|
11
11
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// value is also made the native default, so a form reset returns to it.
|
|
3
3
|
export default function controller(host) {
|
|
4
4
|
return host.effect(() => {
|
|
5
|
-
const value = host.
|
|
5
|
+
const value = host.props.value.value;
|
|
6
6
|
if (value === undefined || value === null) return;
|
|
7
7
|
const input = host.element;
|
|
8
8
|
const text = String(value);
|
|
@@ -134,6 +134,20 @@
|
|
|
134
134
|
white-space: nowrap;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/* Fixed text is part of the value, but should not look editable. */
|
|
138
|
+
.affix:has([slot="prefix"]),
|
|
139
|
+
.affix:has([slot="suffix"]) {
|
|
140
|
+
background: var(--ui-surface-muted);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.affix:has([slot="prefix"]) {
|
|
144
|
+
border-inline-end: 1px solid var(--ui-border-divider);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.affix:has([slot="suffix"]) {
|
|
148
|
+
border-inline-start: 1px solid var(--ui-border-divider);
|
|
149
|
+
}
|
|
150
|
+
|
|
137
151
|
/* Centred rather than padded above and below: the group is exactly a lone Input's height, so a
|
|
138
152
|
small button sits inside it with the difference split evenly, and the field keeps its height. */
|
|
139
153
|
.action {
|
|
@@ -50,7 +50,7 @@ export default function controller(host) {
|
|
|
50
50
|
};
|
|
51
51
|
// Click, not pointerdown: a tap's click is a user activation, so a touch keyboard opens.
|
|
52
52
|
const onClick = (event) => {
|
|
53
|
-
if (pressedAround(event) && !host.
|
|
53
|
+
if (pressedAround(event) && !host.props.disabled.value) element.querySelector(".field input")?.focus();
|
|
54
54
|
};
|
|
55
55
|
element.addEventListener("mousedown", onMousedown);
|
|
56
56
|
element.addEventListener("click", onClick);
|
|
@@ -33,11 +33,11 @@ export default function controller(host) {
|
|
|
33
33
|
let typeaheadTimer;
|
|
34
34
|
|
|
35
35
|
const selected = () => Array.isArray(host.state.selection) ? host.state.selection : [];
|
|
36
|
-
const externallySelected = () => host.
|
|
37
|
-
? (Array.isArray(host.
|
|
38
|
-
: (host.
|
|
36
|
+
const externallySelected = () => host.props.multiple.value
|
|
37
|
+
? (Array.isArray(host.props.values.value) ? Array.from(new Set(host.props.values.value.map(String))) : null)
|
|
38
|
+
: (host.props.value.value === undefined || host.props.value.value === null ? null : [String(host.props.value.value)]);
|
|
39
39
|
const defaultSelection = () => externallySelected()
|
|
40
|
-
?? options.filter((option) => option.selected).map((option) => option.value).slice(0, host.
|
|
40
|
+
?? options.filter((option) => option.selected).map((option) => option.value).slice(0, host.props.multiple.value ? undefined : 1);
|
|
41
41
|
const enabledIndices = () => options.filter((option) => !option.disabled).map((option) => option.index);
|
|
42
42
|
const render = () => {
|
|
43
43
|
const set = new Set(selected());
|
|
@@ -83,9 +83,9 @@ export default function controller(host) {
|
|
|
83
83
|
};
|
|
84
84
|
const choose = (index, trigger) => {
|
|
85
85
|
const option = options[index];
|
|
86
|
-
if (!option || option.disabled || host.
|
|
86
|
+
if (!option || option.disabled || host.props.disabled.value) return;
|
|
87
87
|
activate(index);
|
|
88
|
-
if (host.
|
|
88
|
+
if (host.props.multiple.value) {
|
|
89
89
|
const current = selected();
|
|
90
90
|
setSelection(current.includes(option.value)
|
|
91
91
|
? current.filter((value) => value !== option.value)
|
|
@@ -101,17 +101,17 @@ export default function controller(host) {
|
|
|
101
101
|
: key === "ArrowDown" ? indices[(current + 1) % indices.length]
|
|
102
102
|
: indices[(current <= 0 ? indices.length : current) - 1];
|
|
103
103
|
activate(next);
|
|
104
|
-
if (!host.
|
|
104
|
+
if (!host.props.multiple.value) choose(next, "keyboard");
|
|
105
105
|
};
|
|
106
106
|
const onClick = (event) => {
|
|
107
|
-
if (host.
|
|
107
|
+
if (host.props.disabled.value) return;
|
|
108
108
|
const row = event.target.closest("[data-index]");
|
|
109
109
|
if (!row || !element.contains(row)) return;
|
|
110
110
|
element.focus();
|
|
111
111
|
choose(Number(row.dataset.index), "pointer");
|
|
112
112
|
};
|
|
113
113
|
const onKeydown = (event) => {
|
|
114
|
-
if (host.
|
|
114
|
+
if (host.props.disabled.value || event.altKey || event.metaKey || event.ctrlKey) return;
|
|
115
115
|
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
116
116
|
event.preventDefault();
|
|
117
117
|
move(event.key);
|
|
@@ -125,7 +125,7 @@ export default function controller(host) {
|
|
|
125
125
|
const match = options.find((option) => !option.disabled && option.label.toLocaleLowerCase().startsWith(typeahead));
|
|
126
126
|
if (match) {
|
|
127
127
|
activate(match.index);
|
|
128
|
-
if (!host.
|
|
128
|
+
if (!host.props.multiple.value) choose(match.index, "keyboard");
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
};
|
|
@@ -145,7 +145,7 @@ export default function controller(host) {
|
|
|
145
145
|
authored.disabled = true;
|
|
146
146
|
element.setAttribute("data-enhanced", "");
|
|
147
147
|
const stop = host.effect(() => {
|
|
148
|
-
const signature = JSON.stringify([host.
|
|
148
|
+
const signature = JSON.stringify([host.props.multiple.value, host.props.value.value, host.props.values.value]);
|
|
149
149
|
if (signature !== external) {
|
|
150
150
|
external = signature;
|
|
151
151
|
initial = defaultSelection();
|
|
@@ -160,7 +160,7 @@ export default function controller(host) {
|
|
|
160
160
|
return () => {
|
|
161
161
|
stop();
|
|
162
162
|
observer.disconnect();
|
|
163
|
-
authored.disabled = host.
|
|
163
|
+
authored.disabled = host.props.disabled.value;
|
|
164
164
|
element.removeAttribute("data-enhanced");
|
|
165
165
|
clearTimeout(typeaheadTimer);
|
|
166
166
|
element.removeEventListener("click", onClick);
|
|
@@ -21,7 +21,7 @@ export default function controller(host) {
|
|
|
21
21
|
let surface = null;
|
|
22
22
|
let lastFor;
|
|
23
23
|
let lastPlacement;
|
|
24
|
-
let lastExternalOpen = Boolean(host.
|
|
24
|
+
let lastExternalOpen = Boolean(host.props.open.value);
|
|
25
25
|
host.state.internalOpen = lastExternalOpen;
|
|
26
26
|
|
|
27
27
|
const onAnchorClick = (event) => {
|
|
@@ -51,8 +51,8 @@ export default function controller(host) {
|
|
|
51
51
|
anchorAria = null;
|
|
52
52
|
};
|
|
53
53
|
const setup = () => {
|
|
54
|
-
const nextFor = host.
|
|
55
|
-
const nextPlacement = String(host.
|
|
54
|
+
const nextFor = host.props.inline.value ? "" : String(host.props.for.value ?? "");
|
|
55
|
+
const nextPlacement = String(host.props.placement.value ?? "bottom-start");
|
|
56
56
|
if (nextFor === lastFor && nextPlacement === lastPlacement && surface) return;
|
|
57
57
|
lastFor = nextFor;
|
|
58
58
|
lastPlacement = nextPlacement;
|
|
@@ -64,8 +64,8 @@ export default function controller(host) {
|
|
|
64
64
|
surface = anchor ? createAnchoredSurface(element, { anchor, placement: nextPlacement }) : null;
|
|
65
65
|
};
|
|
66
66
|
const apply = () => {
|
|
67
|
-
const inline = Boolean(host.
|
|
68
|
-
const externalOpen = Boolean(host.
|
|
67
|
+
const inline = Boolean(host.props.inline.value);
|
|
68
|
+
const externalOpen = Boolean(host.props.open.value);
|
|
69
69
|
if (externalOpen !== lastExternalOpen) {
|
|
70
70
|
lastExternalOpen = externalOpen;
|
|
71
71
|
host.state.internalOpen = externalOpen;
|
|
@@ -97,14 +97,14 @@ export default function controller(host) {
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
host.dispatch("select", { value, trigger });
|
|
100
|
-
if (host.
|
|
100
|
+
if (host.props.inline.value) return;
|
|
101
101
|
host.dispatch("close", { open: false, reason: "action", trigger });
|
|
102
102
|
host.state.internalOpen = false;
|
|
103
103
|
};
|
|
104
104
|
const onClick = (event) => select(menuItemFrom(event.target), triggerFor(event));
|
|
105
105
|
const onKeydown = (event) => {
|
|
106
106
|
if (event.key === "Escape") {
|
|
107
|
-
if (host.
|
|
107
|
+
if (host.props.inline.value) return;
|
|
108
108
|
event.preventDefault();
|
|
109
109
|
requestTopOverlayClose(document, "escape", "keyboard");
|
|
110
110
|
return;
|
|
@@ -4,13 +4,13 @@ function radioScope(item) {
|
|
|
4
4
|
|
|
5
5
|
export default function controller(host) {
|
|
6
6
|
const item = host.element;
|
|
7
|
-
let external = Boolean(host.
|
|
7
|
+
let external = Boolean(host.props.checked.value);
|
|
8
8
|
host.state.internalChecked = external;
|
|
9
9
|
|
|
10
10
|
const setChecked = (checked, trigger, announce) => {
|
|
11
11
|
if (Boolean(host.state.internalChecked) === checked) return;
|
|
12
12
|
host.state.internalChecked = checked;
|
|
13
|
-
if (announce) host.dispatch("change", { checked, value: String(host.
|
|
13
|
+
if (announce) host.dispatch("change", { checked, value: String(host.props.value.value ?? ""), type: String(host.props.type.value), trigger });
|
|
14
14
|
};
|
|
15
15
|
const clearOtherRadios = (trigger, announce) => {
|
|
16
16
|
const scope = radioScope(item);
|
|
@@ -21,8 +21,8 @@ export default function controller(host) {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
const onActivate = (event) => {
|
|
24
|
-
const type = String(host.
|
|
25
|
-
if (host.
|
|
24
|
+
const type = String(host.props.type.value);
|
|
25
|
+
if (host.props.disabled.value || type === "action") return;
|
|
26
26
|
const checked = type === "radio" ? true : !host.state.internalChecked;
|
|
27
27
|
if (type === "radio") clearOtherRadios(event.detail.trigger, true);
|
|
28
28
|
setChecked(checked, event.detail.trigger, true);
|
|
@@ -30,15 +30,15 @@ export default function controller(host) {
|
|
|
30
30
|
};
|
|
31
31
|
const onClear = (event) => setChecked(false, event.detail.trigger, event.detail.announce);
|
|
32
32
|
const stop = host.effect(() => {
|
|
33
|
-
const checked = Boolean(host.
|
|
33
|
+
const checked = Boolean(host.props.checked.value);
|
|
34
34
|
if (checked === external) return;
|
|
35
35
|
external = checked;
|
|
36
|
-
if (checked && host.
|
|
36
|
+
if (checked && host.props.type.value === "radio") clearOtherRadios("programmatic", false);
|
|
37
37
|
setChecked(checked, "programmatic", false);
|
|
38
38
|
});
|
|
39
39
|
item.addEventListener("ui-menu-item-activate", onActivate);
|
|
40
40
|
item.addEventListener("ui-menu-item-clear", onClear);
|
|
41
|
-
if (external && host.
|
|
41
|
+
if (external && host.props.type.value === "radio") queueMicrotask(() => clearOtherRadios("programmatic", false));
|
|
42
42
|
return () => {
|
|
43
43
|
stop();
|
|
44
44
|
item.removeEventListener("ui-menu-item-activate", onActivate);
|
|
@@ -18,7 +18,7 @@ export default function controller(host) {
|
|
|
18
18
|
let lastFor;
|
|
19
19
|
let lastPlacement;
|
|
20
20
|
let lastOpen;
|
|
21
|
-
let lastExternalOpen = Boolean(host.
|
|
21
|
+
let lastExternalOpen = Boolean(host.props.open.value);
|
|
22
22
|
host.state.internalOpen = lastExternalOpen;
|
|
23
23
|
|
|
24
24
|
const close = (reason, trigger) => {
|
|
@@ -47,8 +47,8 @@ export default function controller(host) {
|
|
|
47
47
|
anchorExpanded = null;
|
|
48
48
|
};
|
|
49
49
|
const setup = () => {
|
|
50
|
-
const nextFor = String(host.
|
|
51
|
-
const nextPlacement = String(host.
|
|
50
|
+
const nextFor = String(host.props.for.value ?? "");
|
|
51
|
+
const nextPlacement = String(host.props.placement.value ?? "bottom-start");
|
|
52
52
|
if (surface && nextFor === lastFor && nextPlacement === lastPlacement) return;
|
|
53
53
|
lastFor = nextFor;
|
|
54
54
|
lastPlacement = nextPlacement;
|
|
@@ -60,7 +60,7 @@ export default function controller(host) {
|
|
|
60
60
|
surface = anchor ? createAnchoredSurface(element, { anchor, placement: nextPlacement, gap: offset }) : null;
|
|
61
61
|
};
|
|
62
62
|
const apply = () => {
|
|
63
|
-
const externalOpen = Boolean(host.
|
|
63
|
+
const externalOpen = Boolean(host.props.open.value);
|
|
64
64
|
if (externalOpen !== lastExternalOpen) {
|
|
65
65
|
lastExternalOpen = externalOpen;
|
|
66
66
|
host.state.internalOpen = externalOpen;
|