@threadlabs/looma 0.28.12 → 0.28.14
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/ui-affordance-scope/ui-affordance-scope.html +1 -1
- package/components/ui-avatar/ui-avatar.html +1 -1
- package/components/ui-combobox/ui-combobox.html +1 -1
- package/components/ui-disclosure/ui-disclosure.html +4 -4
- package/components/ui-editable/ui-editable.html +3 -3
- package/components/ui-menu/ui-menu.html +1 -1
- package/components/ui-popover/ui-popover.html +1 -1
- package/components/ui-sidebar/ui-sidebar.html +4 -4
- package/components/ui-switcher/ui-switcher.html +1 -1
- package/components/ui-tree-item/ui-tree-item.html +2 -2
- package/dist/index.js +1 -1
- package/editor/formatting-selection.d.ts +49 -0
- package/package.json +3 -3
- 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 +1 -1
- package/styles/ui-disclosure.css +2 -2
- package/styles/ui-editable.css +1 -1
- package/styles/ui-editor-block-actions.css +1 -1
- package/styles/ui-editor-chip-editor.css +1 -1
- package/styles/ui-editor-code-language.css +1 -1
- package/styles/ui-editor-image-toolbar.css +1 -1
- package/styles/ui-editor-insert-table-grid.css +1 -1
- package/styles/ui-editor-link-card.css +1 -1
- package/styles/ui-editor-link-form.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-surface.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-image.css +1 -1
- package/styles/ui-input-group.css +1 -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 +2 -2
- 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 +2 -2
- 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 +1 -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 +2 -2
- 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-swatch.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 +2 -2
- package/vanilla/UiAvatar.d.ts +1 -1
- package/vanilla/UiAvatar.js +2 -2
- package/vanilla/UiAvatarGroup.d.ts +1 -1
- package/vanilla/UiAvatarGroup.js +2 -2
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +2 -2
- package/vanilla/UiBreadcrumbItem.d.ts +1 -1
- package/vanilla/UiBreadcrumbItem.js +2 -2
- package/vanilla/UiBreadcrumbs.d.ts +1 -1
- package/vanilla/UiBreadcrumbs.js +2 -2
- package/vanilla/UiButton.d.ts +1 -1
- package/vanilla/UiButton.js +3 -3
- package/vanilla/UiCallout.d.ts +1 -1
- package/vanilla/UiCallout.js +2 -2
- package/vanilla/UiCard.d.ts +1 -1
- package/vanilla/UiCard.js +3 -3
- package/vanilla/UiCheckbox.d.ts +1 -1
- package/vanilla/UiCheckbox.js +2 -2
- package/vanilla/UiCluster.d.ts +1 -1
- package/vanilla/UiCluster.js +2 -2
- package/vanilla/UiCombobox.d.ts +1 -1
- package/vanilla/UiCombobox.js +2 -2
- package/vanilla/UiContainer.d.ts +1 -1
- package/vanilla/UiContainer.js +2 -2
- package/vanilla/UiContextMenu.d.ts +1 -1
- package/vanilla/UiContextMenu.js +2 -2
- package/vanilla/UiCover.d.ts +1 -1
- package/vanilla/UiCover.js +2 -2
- package/vanilla/UiDescriptionItem.d.ts +1 -1
- package/vanilla/UiDescriptionItem.js +2 -2
- package/vanilla/UiDescriptionList.d.ts +1 -1
- package/vanilla/UiDescriptionList.js +2 -2
- package/vanilla/UiDialog.d.ts +1 -1
- package/vanilla/UiDialog.js +2 -2
- package/vanilla/UiDisclosure.d.ts +1 -1
- package/vanilla/UiDisclosure.js +2 -2
- package/vanilla/UiEditable.d.ts +1 -1
- package/vanilla/UiEditable.js +2 -2
- package/vanilla/UiEditorBlockActions.d.ts +1 -1
- package/vanilla/UiEditorBlockActions.js +2 -2
- package/vanilla/UiEditorChipEditor.d.ts +1 -1
- package/vanilla/UiEditorChipEditor.js +2 -2
- package/vanilla/UiEditorCodeLanguage.d.ts +1 -1
- package/vanilla/UiEditorCodeLanguage.js +2 -2
- package/vanilla/UiEditorImageToolbar.d.ts +1 -1
- package/vanilla/UiEditorImageToolbar.js +2 -2
- package/vanilla/UiEditorInsertTableGrid.d.ts +1 -1
- package/vanilla/UiEditorInsertTableGrid.js +2 -2
- package/vanilla/UiEditorLinkCard.d.ts +1 -1
- package/vanilla/UiEditorLinkCard.js +2 -2
- package/vanilla/UiEditorLinkForm.d.ts +1 -1
- package/vanilla/UiEditorLinkForm.js +2 -2
- package/vanilla/UiEditorMentionMenu.d.ts +1 -1
- package/vanilla/UiEditorMentionMenu.js +2 -2
- package/vanilla/UiEditorMentionMenuItem.d.ts +1 -1
- package/vanilla/UiEditorMentionMenuItem.js +3 -3
- package/vanilla/UiEditorSlashMenu.d.ts +1 -1
- package/vanilla/UiEditorSlashMenu.js +2 -2
- package/vanilla/UiEditorSlashMenuGroup.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuGroup.js +2 -2
- package/vanilla/UiEditorSlashMenuItem.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuItem.js +3 -3
- package/vanilla/UiEditorSurface.d.ts +1 -1
- package/vanilla/UiEditorSurface.js +2 -2
- package/vanilla/UiEditorTableContextMenu.d.ts +1 -1
- package/vanilla/UiEditorTableContextMenu.js +2 -2
- package/vanilla/UiEditorTableOverlay.d.ts +1 -1
- package/vanilla/UiEditorTableOverlay.js +2 -2
- package/vanilla/UiEditorTableToolbar.d.ts +1 -1
- package/vanilla/UiEditorTableToolbar.js +2 -2
- package/vanilla/UiEditorToolbar.d.ts +1 -1
- package/vanilla/UiEditorToolbar.js +2 -2
- package/vanilla/UiFloatingActionButton.d.ts +1 -1
- package/vanilla/UiFloatingActionButton.js +2 -2
- package/vanilla/UiFormField.d.ts +1 -1
- package/vanilla/UiFormField.js +2 -2
- package/vanilla/UiGrid.d.ts +1 -1
- package/vanilla/UiGrid.js +2 -2
- package/vanilla/UiIcon.d.ts +1 -1
- package/vanilla/UiIcon.js +2 -2
- package/vanilla/UiIconButton.d.ts +1 -1
- package/vanilla/UiIconButton.js +3 -3
- package/vanilla/UiImage.d.ts +1 -1
- package/vanilla/UiImage.js +2 -2
- package/vanilla/UiInput.d.ts +1 -1
- package/vanilla/UiInput.js +2 -2
- package/vanilla/UiInputGroup.d.ts +1 -1
- package/vanilla/UiInputGroup.js +2 -2
- package/vanilla/UiList.d.ts +1 -1
- package/vanilla/UiList.js +3 -3
- package/vanilla/UiListItem.d.ts +1 -1
- package/vanilla/UiListItem.js +2 -2
- package/vanilla/UiListbox.d.ts +1 -1
- package/vanilla/UiListbox.js +2 -2
- package/vanilla/UiMenu.d.ts +1 -1
- package/vanilla/UiMenu.js +2 -2
- package/vanilla/UiMenuGroup.d.ts +1 -1
- package/vanilla/UiMenuGroup.js +2 -2
- package/vanilla/UiMenuItem.d.ts +1 -1
- package/vanilla/UiMenuItem.js +4 -4
- package/vanilla/UiMeter.d.ts +1 -1
- package/vanilla/UiMeter.js +2 -2
- package/vanilla/UiNavItem.d.ts +1 -1
- package/vanilla/UiNavItem.js +3 -3
- package/vanilla/UiPageHeader.d.ts +1 -1
- package/vanilla/UiPageHeader.js +2 -2
- package/vanilla/UiPopover.d.ts +1 -1
- package/vanilla/UiPopover.js +2 -2
- package/vanilla/UiRadio.d.ts +1 -1
- package/vanilla/UiRadio.js +2 -2
- package/vanilla/UiRadioGroup.d.ts +1 -1
- package/vanilla/UiRadioGroup.js +2 -2
- package/vanilla/UiReel.d.ts +1 -1
- package/vanilla/UiReel.js +2 -2
- package/vanilla/UiScrollArea.d.ts +1 -1
- package/vanilla/UiScrollArea.js +2 -2
- package/vanilla/UiSearchResultRow.d.ts +1 -1
- package/vanilla/UiSearchResultRow.js +2 -2
- package/vanilla/UiSearchShell.d.ts +1 -1
- package/vanilla/UiSearchShell.js +2 -2
- package/vanilla/UiSection.d.ts +1 -1
- package/vanilla/UiSection.js +2 -2
- package/vanilla/UiSelect.d.ts +1 -1
- package/vanilla/UiSelect.js +2 -2
- package/vanilla/UiSeparator.d.ts +1 -1
- package/vanilla/UiSeparator.js +2 -2
- package/vanilla/UiSidebar.d.ts +1 -1
- package/vanilla/UiSidebar.js +2 -2
- package/vanilla/UiSpinner.d.ts +1 -1
- package/vanilla/UiSpinner.js +2 -2
- package/vanilla/UiStack.d.ts +1 -1
- package/vanilla/UiStack.js +2 -2
- package/vanilla/UiStatusMessage.d.ts +1 -1
- package/vanilla/UiStatusMessage.js +2 -2
- package/vanilla/UiSwatch.d.ts +1 -1
- package/vanilla/UiSwatch.js +2 -2
- package/vanilla/UiSwitch.d.ts +1 -1
- package/vanilla/UiSwitch.js +2 -2
- package/vanilla/UiSwitcher.d.ts +1 -1
- package/vanilla/UiSwitcher.js +2 -2
- package/vanilla/UiTable.d.ts +1 -1
- package/vanilla/UiTable.js +2 -2
- package/vanilla/UiTabs.d.ts +1 -1
- package/vanilla/UiTabs.js +2 -2
- package/vanilla/UiText.d.ts +1 -1
- package/vanilla/UiText.js +3 -3
- package/vanilla/UiTextarea.d.ts +1 -1
- package/vanilla/UiTextarea.js +2 -2
- package/vanilla/UiToast.d.ts +1 -1
- package/vanilla/UiToast.js +2 -2
- package/vanilla/UiToastRegion.d.ts +1 -1
- package/vanilla/UiToastRegion.js +2 -2
- package/vanilla/UiTooltip.d.ts +1 -1
- package/vanilla/UiTooltip.js +2 -2
- package/vanilla/UiTopBar.d.ts +1 -1
- package/vanilla/UiTopBar.js +1 -1
- package/vanilla/UiTree.d.ts +1 -1
- package/vanilla/UiTree.js +2 -2
- package/vanilla/UiTreeItem.d.ts +1 -1
- package/vanilla/UiTreeItem.js +3 -3
- package/vue/UiActionBar.vue +23 -15
- package/vue/UiAffordanceScope.vue +11 -9
- package/vue/UiAvatar.vue +34 -27
- package/vue/UiAvatarGroup.vue +22 -17
- package/vue/UiBadge.vue +78 -69
- package/vue/UiBreadcrumbItem.vue +17 -14
- package/vue/UiBreadcrumbs.vue +9 -7
- package/vue/UiButton.vue +150 -138
- package/vue/UiCallout.vue +68 -43
- package/vue/UiCard.vue +52 -44
- package/vue/UiCheckbox.vue +48 -40
- package/vue/UiCluster.vue +35 -33
- package/vue/UiCombobox.vue +158 -107
- package/vue/UiContainer.vue +16 -14
- package/vue/UiContextMenu.vue +24 -13
- package/vue/UiCover.vue +10 -8
- package/vue/UiDescriptionItem.vue +11 -9
- package/vue/UiDescriptionList.vue +20 -18
- package/vue/UiDialog.vue +41 -37
- package/vue/UiDisclosure.vue +65 -51
- package/vue/UiEditable.vue +34 -33
- package/vue/UiEditorBlockActions.vue +4 -3
- package/vue/UiEditorChipEditor.vue +4 -3
- package/vue/UiEditorCodeLanguage.vue +5 -4
- package/vue/UiEditorImageToolbar.vue +5 -4
- package/vue/UiEditorInsertTableGrid.vue +19 -18
- package/vue/UiEditorLinkCard.vue +7 -6
- package/vue/UiEditorLinkForm.vue +15 -14
- package/vue/UiEditorMentionMenu.vue +52 -37
- package/vue/UiEditorMentionMenuItem.vue +30 -20
- package/vue/UiEditorSlashMenu.vue +49 -36
- package/vue/UiEditorSlashMenuGroup.vue +16 -10
- package/vue/UiEditorSlashMenuItem.vue +36 -26
- package/vue/UiEditorSurface.vue +8 -6
- package/vue/UiEditorTableContextMenu.vue +26 -25
- package/vue/UiEditorTableOverlay.vue +56 -51
- package/vue/UiEditorTableToolbar.vue +37 -36
- package/vue/UiEditorToolbar.vue +24 -20
- package/vue/UiFloatingActionButton.vue +17 -15
- package/vue/UiFormField.vue +27 -22
- package/vue/UiGrid.vue +17 -15
- package/vue/UiIcon.vue +7 -6
- package/vue/UiIconButton.vue +75 -70
- package/vue/UiImage.vue +61 -46
- package/vue/UiInput.vue +28 -28
- package/vue/UiInputGroup.vue +48 -43
- package/vue/UiList.vue +25 -21
- package/vue/UiListItem.vue +54 -44
- package/vue/UiListbox.vue +29 -22
- package/vue/UiMenu.vue +25 -23
- package/vue/UiMenuGroup.vue +11 -7
- package/vue/UiMenuItem.vue +52 -43
- package/vue/UiMeter.vue +42 -41
- package/vue/UiNavItem.vue +60 -47
- package/vue/UiPageHeader.vue +27 -20
- package/vue/UiPopover.vue +21 -19
- package/vue/UiRadio.vue +32 -28
- package/vue/UiRadioGroup.vue +24 -19
- package/vue/UiReel.vue +24 -22
- package/vue/UiScrollArea.vue +30 -24
- package/vue/UiSearchResultRow.vue +41 -26
- package/vue/UiSearchShell.vue +37 -29
- package/vue/UiSection.vue +31 -24
- package/vue/UiSelect.vue +23 -21
- package/vue/UiSeparator.vue +14 -13
- package/vue/UiSidebar.vue +48 -40
- package/vue/UiSpinner.vue +14 -13
- package/vue/UiStack.vue +26 -24
- package/vue/UiStatusMessage.vue +26 -21
- package/vue/UiSwatch.vue +13 -12
- package/vue/UiSwitch.vue +37 -33
- package/vue/UiSwitcher.vue +27 -22
- package/vue/UiTable.vue +23 -19
- package/vue/UiTabs.vue +48 -33
- package/vue/UiText.vue +173 -151
- package/vue/UiTextarea.vue +27 -27
- package/vue/UiToast.vue +17 -15
- package/vue/UiToastRegion.vue +36 -31
- package/vue/UiTooltip.vue +40 -34
- package/vue/UiTopBar.vue +17 -13
- package/vue/UiTree.vue +17 -15
- package/vue/UiTreeItem.vue +202 -133
- package/vue/chunks/UiActionBar.js +21 -6
- package/vue/chunks/UiAffordanceScope.js +8 -6
- package/vue/chunks/UiAvatar.js +30 -20
- package/vue/chunks/UiAvatarGroup.js +16 -13
- package/vue/chunks/UiBadge.js +19 -13
- package/vue/chunks/UiBreadcrumbItem.js +13 -7
- package/vue/chunks/UiBreadcrumbs.js +9 -4
- package/vue/chunks/UiButton.js +158 -124
- package/vue/chunks/UiCallout.js +105 -37
- package/vue/chunks/UiCard.js +50 -42
- package/vue/chunks/UiCheckbox.js +32 -22
- package/vue/chunks/UiCluster.js +18 -16
- package/vue/chunks/UiCombobox.js +130 -73
- package/vue/chunks/UiContainer.js +10 -8
- package/vue/chunks/UiContextMenu.js +7 -4
- package/vue/chunks/UiCover.js +7 -5
- package/vue/chunks/UiDescriptionItem.js +9 -3
- package/vue/chunks/UiDescriptionList.js +10 -8
- package/vue/chunks/UiDialog.js +26 -19
- package/vue/chunks/UiDisclosure.js +43 -25
- package/vue/chunks/UiEditable.js +25 -24
- package/vue/chunks/UiEditorBlockActions.js +4 -3
- package/vue/chunks/UiEditorChipEditor.js +4 -3
- package/vue/chunks/UiEditorCodeLanguage.js +5 -4
- package/vue/chunks/UiEditorImageToolbar.js +7 -6
- package/vue/chunks/UiEditorInsertTableGrid.js +10 -9
- package/vue/chunks/UiEditorLinkCard.js +11 -10
- package/vue/chunks/UiEditorLinkForm.js +26 -25
- package/vue/chunks/UiEditorMentionMenu.js +41 -24
- package/vue/chunks/UiEditorMentionMenuItem.js +23 -11
- package/vue/chunks/UiEditorSlashMenu.js +41 -20
- package/vue/chunks/UiEditorSlashMenuGroup.js +16 -5
- package/vue/chunks/UiEditorSlashMenuItem.js +28 -14
- package/vue/chunks/UiEditorSurface.js +6 -4
- package/vue/chunks/UiEditorTableContextMenu.js +14 -13
- package/vue/chunks/UiEditorTableOverlay.js +6 -5
- package/vue/chunks/UiEditorTableToolbar.js +14 -13
- package/vue/chunks/UiEditorToolbar.js +8 -5
- package/vue/chunks/UiFloatingActionButton.js +11 -9
- package/vue/chunks/UiFormField.js +30 -16
- package/vue/chunks/UiGrid.js +10 -8
- package/vue/chunks/UiIcon.js +6 -3
- package/vue/chunks/UiIconButton.js +33 -26
- package/vue/chunks/UiImage.js +31 -22
- package/vue/chunks/UiInput.js +17 -16
- package/vue/chunks/UiInputGroup.js +30 -16
- package/vue/chunks/UiList.js +24 -20
- package/vue/chunks/UiListItem.js +39 -22
- package/vue/chunks/UiListbox.js +35 -25
- package/vue/chunks/UiMenu.js +22 -17
- package/vue/chunks/UiMenuGroup.js +7 -4
- package/vue/chunks/UiMenuItem.js +57 -38
- package/vue/chunks/UiMeter.js +22 -21
- package/vue/chunks/UiNavItem.js +78 -42
- package/vue/chunks/UiPageHeader.js +30 -10
- package/vue/chunks/UiPopover.js +16 -11
- package/vue/chunks/UiRadio.js +26 -16
- package/vue/chunks/UiRadioGroup.js +24 -19
- package/vue/chunks/UiReel.js +11 -9
- package/vue/chunks/UiScrollArea.js +16 -13
- package/vue/chunks/UiSearchResultRow.js +39 -19
- package/vue/chunks/UiSearchShell.js +36 -18
- package/vue/chunks/UiSection.js +31 -13
- package/vue/chunks/UiSelect.js +14 -12
- package/vue/chunks/UiSeparator.js +11 -10
- package/vue/chunks/UiSidebar.js +33 -23
- package/vue/chunks/UiSpinner.js +7 -6
- package/vue/chunks/UiStack.js +14 -12
- package/vue/chunks/UiStatusMessage.js +23 -11
- package/vue/chunks/UiSwatch.js +5 -4
- package/vue/chunks/UiSwitch.js +26 -16
- package/vue/chunks/UiSwitcher.js +13 -11
- package/vue/chunks/UiTable.js +9 -7
- package/vue/chunks/UiTabs.js +23 -18
- package/vue/chunks/UiText.js +277 -255
- package/vue/chunks/UiTextarea.js +21 -20
- package/vue/chunks/UiToast.js +13 -7
- package/vue/chunks/UiToastRegion.js +15 -8
- package/vue/chunks/UiTooltip.js +27 -19
- package/vue/chunks/UiTopBar.js +21 -6
- package/vue/chunks/UiTree.js +18 -16
- package/vue/chunks/UiTreeItem.js +82 -45
- package/vue/chunks/_plugin-vue_export-helper.js +17 -4
- package/vue/components.css +1507 -1479
- package/vue/editor/index.js +108 -65
- package/vue/host.ts +26 -6
package/vue/editor/index.js
CHANGED
|
@@ -1131,6 +1131,76 @@ function runBlockAction(editor, action) {
|
|
|
1131
1131
|
return true;
|
|
1132
1132
|
}
|
|
1133
1133
|
//#endregion
|
|
1134
|
+
//#region src/editor/formatting-selection.ts
|
|
1135
|
+
var HOLD_MS = 500;
|
|
1136
|
+
var HOLD_SLOP_PX = 8;
|
|
1137
|
+
function createFormattingSelection(options) {
|
|
1138
|
+
const { editor } = options;
|
|
1139
|
+
let dismissedSelection = null;
|
|
1140
|
+
let heldSelection = null;
|
|
1141
|
+
let held = null;
|
|
1142
|
+
let timer;
|
|
1143
|
+
const cancel = () => {
|
|
1144
|
+
clearTimeout(timer);
|
|
1145
|
+
timer = void 0;
|
|
1146
|
+
held = null;
|
|
1147
|
+
};
|
|
1148
|
+
return {
|
|
1149
|
+
active() {
|
|
1150
|
+
const selection = editor.state.selection;
|
|
1151
|
+
return (selection instanceof TextSelection || selection instanceof AllSelection && Boolean(editor.state.doc.textContent)) && !dismissedSelection?.eq(selection) && (!selection.empty || Boolean(heldSelection?.eq(selection)) || options.shownAtCaret());
|
|
1152
|
+
},
|
|
1153
|
+
dismissed: (selection) => Boolean(dismissedSelection?.eq(selection)),
|
|
1154
|
+
dismiss(selection) {
|
|
1155
|
+
const current = editor.state.selection;
|
|
1156
|
+
dismissedSelection = selection !== void 0 ? selection : current instanceof TextSelection || current instanceof AllSelection ? current : null;
|
|
1157
|
+
heldSelection = null;
|
|
1158
|
+
},
|
|
1159
|
+
undismiss() {
|
|
1160
|
+
dismissedSelection = null;
|
|
1161
|
+
},
|
|
1162
|
+
release() {
|
|
1163
|
+
heldSelection = null;
|
|
1164
|
+
},
|
|
1165
|
+
selectionChanged() {
|
|
1166
|
+
const selection = editor.state.selection;
|
|
1167
|
+
if (!dismissedSelection?.eq(selection)) dismissedSelection = null;
|
|
1168
|
+
if (!heldSelection?.eq(selection)) heldSelection = null;
|
|
1169
|
+
},
|
|
1170
|
+
press: {
|
|
1171
|
+
down(event) {
|
|
1172
|
+
cancel();
|
|
1173
|
+
if (!options.canHold() || editor.isDestroyed || event.button !== 0 || !event.isPrimary || !(event.target instanceof Element) || !editor.view.dom.contains(event.target) || event.target.closest("button, input, select, textarea, [data-looma-image-node]")) return;
|
|
1174
|
+
held = {
|
|
1175
|
+
id: event.pointerId,
|
|
1176
|
+
x: event.clientX,
|
|
1177
|
+
y: event.clientY,
|
|
1178
|
+
time: event.timeStamp
|
|
1179
|
+
};
|
|
1180
|
+
timer = setTimeout(() => {
|
|
1181
|
+
timer = void 0;
|
|
1182
|
+
const selection = editor.state.selection;
|
|
1183
|
+
if (!held || !options.canHold() || !editor.isFocused || options.menuOpen() || !(selection instanceof TextSelection)) return;
|
|
1184
|
+
dismissedSelection = null;
|
|
1185
|
+
heldSelection = selection;
|
|
1186
|
+
options.onHold(selection);
|
|
1187
|
+
}, HOLD_MS);
|
|
1188
|
+
},
|
|
1189
|
+
move(event) {
|
|
1190
|
+
if (held?.id === event.pointerId && Math.hypot(event.clientX - held.x, event.clientY - held.y) > HOLD_SLOP_PX) cancel();
|
|
1191
|
+
},
|
|
1192
|
+
end(event) {
|
|
1193
|
+
if (held?.id === event.pointerId) cancel();
|
|
1194
|
+
},
|
|
1195
|
+
cancel,
|
|
1196
|
+
viewportChanged(event) {
|
|
1197
|
+
if (!event || !held || event.timeStamp >= held.time) cancel();
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
destroy: cancel
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
//#endregion
|
|
1134
1204
|
//#region src/editor/table-overlay.ts
|
|
1135
1205
|
function mapTableCells(table) {
|
|
1136
1206
|
const rows = Array.from(table.rows);
|
|
@@ -2908,29 +2978,18 @@ var LoomaEditor = defineComponent({
|
|
|
2908
2978
|
const mobileToolbarStyle = ref({});
|
|
2909
2979
|
const mobile = ref(typeof window !== "undefined" && window.innerWidth <= 767);
|
|
2910
2980
|
const editorFocused = ref(false);
|
|
2911
|
-
let
|
|
2912
|
-
let heldFormattingSelection = null;
|
|
2981
|
+
let formatting;
|
|
2913
2982
|
let formattingPopup = null;
|
|
2914
2983
|
let linkPopup = null;
|
|
2915
2984
|
let imagePopup = null;
|
|
2916
|
-
let heldPressTimer;
|
|
2917
|
-
let heldPress = null;
|
|
2918
2985
|
const floatingFormattingMode = () => props.toolbarMode !== "sticky" && !(props.toolbarMode === "popover" && props.toolbarOpen) && !mobile.value;
|
|
2919
2986
|
const formattingPickerOpen = () => linkState.value.surface === "popover" || tablePickerOpen.value || formatOpen.value;
|
|
2920
|
-
const cancelHeldPress = () => {
|
|
2921
|
-
clearTimeout(heldPressTimer);
|
|
2922
|
-
heldPressTimer = void 0;
|
|
2923
|
-
heldPress = null;
|
|
2924
|
-
};
|
|
2925
2987
|
const activeRangeActions = (instance) => {
|
|
2926
2988
|
const selection = instance.state.selection;
|
|
2927
2989
|
if (!(selection instanceof TextSelection) || !selection.empty) return [];
|
|
2928
2990
|
return props.rangeActions.filter((action) => Number.isSafeInteger(action.from) && Number.isSafeInteger(action.to) && action.from >= 0 && action.to > action.from && action.to <= instance.state.doc.content.size && action.from <= selection.from && selection.from <= action.to);
|
|
2929
2991
|
};
|
|
2930
|
-
const
|
|
2931
|
-
const selection = instance.state.selection;
|
|
2932
|
-
return (selection instanceof TextSelection || selection instanceof AllSelection && Boolean(instance.state.doc.textContent)) && !dismissedFormattingSelection?.eq(selection) && (!selection.empty || Boolean(heldFormattingSelection?.eq(selection)) || activeRangeActions(instance).length > 0);
|
|
2933
|
-
};
|
|
2992
|
+
const formattingActive = () => formatting?.active() ?? false;
|
|
2934
2993
|
const editorStateVersion = ref(0);
|
|
2935
2994
|
const mobileToolbarMode = ref("formatting");
|
|
2936
2995
|
let dragLeaveTimer = null;
|
|
@@ -3100,7 +3159,7 @@ var LoomaEditor = defineComponent({
|
|
|
3100
3159
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
3101
3160
|
return true;
|
|
3102
3161
|
}
|
|
3103
|
-
|
|
3162
|
+
formatting?.undismiss();
|
|
3104
3163
|
requestAnimationFrame(() => {
|
|
3105
3164
|
if (view.isDestroyed) return;
|
|
3106
3165
|
editorStateVersion.value += 1;
|
|
@@ -3123,10 +3182,9 @@ var LoomaEditor = defineComponent({
|
|
|
3123
3182
|
onSelectionUpdate: ({ editor: instance }) => {
|
|
3124
3183
|
rememberSelection(instance);
|
|
3125
3184
|
if (floatingFormattingMode()) {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
if (!
|
|
3129
|
-
if (!formattingSelectionActive(instance)) formattingPopup?.hide();
|
|
3185
|
+
instance.state.selection;
|
|
3186
|
+
formatting?.selectionChanged();
|
|
3187
|
+
if (!formattingActive()) formattingPopup?.hide();
|
|
3130
3188
|
}
|
|
3131
3189
|
},
|
|
3132
3190
|
onUpdate: ({ editor: instance }) => {
|
|
@@ -3149,6 +3207,17 @@ var LoomaEditor = defineComponent({
|
|
|
3149
3207
|
linkState.value = engine.state;
|
|
3150
3208
|
});
|
|
3151
3209
|
linkEditing = engine;
|
|
3210
|
+
const instance = session.editor;
|
|
3211
|
+
formatting = createFormattingSelection({
|
|
3212
|
+
editor: instance,
|
|
3213
|
+
canHold: () => floatingFormattingMode() && !tableResizeActive && props.editable,
|
|
3214
|
+
menuOpen: () => slash.active || mention.active,
|
|
3215
|
+
shownAtCaret: () => activeRangeActions(instance).length > 0,
|
|
3216
|
+
onHold: (selection) => {
|
|
3217
|
+
formattingPopup?.setAnchor(() => posToDOMRect(instance.view, selection.from, selection.to));
|
|
3218
|
+
formattingPopup?.show();
|
|
3219
|
+
}
|
|
3220
|
+
});
|
|
3152
3221
|
});
|
|
3153
3222
|
const attachDocument = (element) => {
|
|
3154
3223
|
if (element instanceof HTMLElement) session?.attach(element);
|
|
@@ -3170,7 +3239,7 @@ var LoomaEditor = defineComponent({
|
|
|
3170
3239
|
const to = selection?.to ?? current.to;
|
|
3171
3240
|
linkEditing?.open(from, to, context ? "context" : "popover");
|
|
3172
3241
|
nextTick(() => {
|
|
3173
|
-
if (context) (props.toolbarMode === "contextual" && floatingFormattingMode() &&
|
|
3242
|
+
if (context) (props.toolbarMode === "contextual" && floatingFormattingMode() && formattingActive() ? formattingPopup : linkPopup)?.setAnchor(() => posToDOMRect(instance.view, instance.state.selection.from, instance.state.selection.to));
|
|
3174
3243
|
(linkState.value.mode === "url" ? linkDestinationInput() : linkFormRoot.value?.querySelector("[data-link-search]"))?.focus();
|
|
3175
3244
|
});
|
|
3176
3245
|
};
|
|
@@ -3178,8 +3247,7 @@ var LoomaEditor = defineComponent({
|
|
|
3178
3247
|
linkEditing?.close();
|
|
3179
3248
|
const range = linkState.value.range;
|
|
3180
3249
|
if (restoreFocus && range) editor.value?.chain().focus().setTextSelection(range.to).run();
|
|
3181
|
-
|
|
3182
|
-
heldFormattingSelection = null;
|
|
3250
|
+
formatting?.dismiss(editor.value?.state.selection ?? null);
|
|
3183
3251
|
linkPopup?.hide();
|
|
3184
3252
|
formattingPopup?.hide();
|
|
3185
3253
|
};
|
|
@@ -3248,8 +3316,8 @@ var LoomaEditor = defineComponent({
|
|
|
3248
3316
|
editor.value?.commands.dismissLoomaSlashMenu();
|
|
3249
3317
|
});
|
|
3250
3318
|
watch(() => props.editable, (editable) => {
|
|
3251
|
-
|
|
3252
|
-
|
|
3319
|
+
formatting?.press.cancel();
|
|
3320
|
+
formatting?.release();
|
|
3253
3321
|
editor.value?.setEditable(editable);
|
|
3254
3322
|
if (!editable) formattingPopup?.hide();
|
|
3255
3323
|
if (editor.value) imageDelivery.reset(editor.value);
|
|
@@ -3264,7 +3332,7 @@ var LoomaEditor = defineComponent({
|
|
|
3264
3332
|
formatOpen
|
|
3265
3333
|
], ([linking, table, format]) => {
|
|
3266
3334
|
if (linking || table || format || !floatingFormattingMode() || editor.value?.isFocused || formattingPopup?.element.contains(document.activeElement)) return;
|
|
3267
|
-
|
|
3335
|
+
formatting?.release();
|
|
3268
3336
|
formattingPopup?.hide();
|
|
3269
3337
|
});
|
|
3270
3338
|
watch(() => props.rangeActions, () => {
|
|
@@ -3440,12 +3508,12 @@ var LoomaEditor = defineComponent({
|
|
|
3440
3508
|
updateMobileViewport();
|
|
3441
3509
|
};
|
|
3442
3510
|
const onEditorBlur = () => {
|
|
3443
|
-
|
|
3511
|
+
formatting?.press.cancel();
|
|
3444
3512
|
queueMicrotask(updateTableUi);
|
|
3445
3513
|
updateCodeUi();
|
|
3446
3514
|
setTimeout(() => {
|
|
3447
3515
|
if (!tableInteractionActive && !editor.value?.isFocused && !mobileToolbarShell.value?.contains(document.activeElement)) editorFocused.value = false;
|
|
3448
|
-
if (!editor.value?.isFocused && !formattingPickerOpen() && !formattingPopup?.element.contains(document.activeElement))
|
|
3516
|
+
if (!editor.value?.isFocused && !formattingPickerOpen() && !formattingPopup?.element.contains(document.activeElement)) formatting?.release();
|
|
3449
3517
|
}, 0);
|
|
3450
3518
|
};
|
|
3451
3519
|
const bindEditorUi = (instance) => {
|
|
@@ -3471,15 +3539,15 @@ var LoomaEditor = defineComponent({
|
|
|
3471
3539
|
}, { immediate: true });
|
|
3472
3540
|
const onViewportChange = (event) => {
|
|
3473
3541
|
if (event?.type === "scroll" && event.target instanceof Node && (tableToolbarShell.value?.contains(event.target) || tableMenuShell.value?.contains(event.target))) return;
|
|
3474
|
-
|
|
3542
|
+
formatting?.press.viewportChanged(event);
|
|
3475
3543
|
const wasMobile = mobile.value;
|
|
3476
3544
|
if (slash.active && slash.getRect) slash.rect = slash.getRect();
|
|
3477
3545
|
if (mention.active && mention.getRect) mention.rect = mention.getRect();
|
|
3478
3546
|
updateMobileViewport();
|
|
3479
|
-
if (wasMobile !== mobile.value)
|
|
3547
|
+
if (wasMobile !== mobile.value) formatting?.release();
|
|
3480
3548
|
updateTableUi();
|
|
3481
3549
|
updateCodeUi();
|
|
3482
|
-
if (floatingFormattingMode() && editor.value && !
|
|
3550
|
+
if (floatingFormattingMode() && editor.value && !formattingActive()) formattingPopup?.hide();
|
|
3483
3551
|
tableUi.menuOpen = false;
|
|
3484
3552
|
};
|
|
3485
3553
|
let stopViewport;
|
|
@@ -3516,42 +3584,17 @@ var LoomaEditor = defineComponent({
|
|
|
3516
3584
|
}, 0);
|
|
3517
3585
|
if ((tableUi.toolbarOpen || tableUi.overlayOpen || tableUi.menuOpen) && !inElement(root.value) && !inTableUi) closeTableUi();
|
|
3518
3586
|
};
|
|
3519
|
-
const onFormattingPointerDown = (event) =>
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
if (!floatingFormattingMode() || tableResizeActive || !props.editable || !instance || event.button !== 0 || !event.isPrimary || !(event.target instanceof Element) || !instance.view.dom.contains(event.target) || event.target.closest("button, input, select, textarea, [data-looma-image-node]")) return;
|
|
3523
|
-
heldPress = {
|
|
3524
|
-
id: event.pointerId,
|
|
3525
|
-
x: event.clientX,
|
|
3526
|
-
y: event.clientY,
|
|
3527
|
-
time: event.timeStamp
|
|
3528
|
-
};
|
|
3529
|
-
heldPressTimer = setTimeout(() => {
|
|
3530
|
-
heldPressTimer = void 0;
|
|
3531
|
-
const selection = instance.state.selection;
|
|
3532
|
-
if (!heldPress || !floatingFormattingMode() || tableResizeActive || !props.editable || !instance.isFocused || slash.active || mention.active || !(selection instanceof TextSelection)) return;
|
|
3533
|
-
dismissedFormattingSelection = null;
|
|
3534
|
-
heldFormattingSelection = selection;
|
|
3535
|
-
formattingPopup?.setAnchor(() => posToDOMRect(instance.view, selection.from, selection.to));
|
|
3536
|
-
formattingPopup?.show();
|
|
3537
|
-
}, 500);
|
|
3538
|
-
};
|
|
3539
|
-
const onFormattingPointerMove = (event) => {
|
|
3540
|
-
if (heldPress?.id === event.pointerId && Math.hypot(event.clientX - heldPress.x, event.clientY - heldPress.y) > 8) cancelHeldPress();
|
|
3541
|
-
};
|
|
3542
|
-
const onFormattingPointerEnd = (event) => {
|
|
3543
|
-
if (heldPress?.id === event.pointerId) cancelHeldPress();
|
|
3544
|
-
};
|
|
3587
|
+
const onFormattingPointerDown = (event) => formatting?.press.down(event);
|
|
3588
|
+
const onFormattingPointerMove = (event) => formatting?.press.move(event);
|
|
3589
|
+
const onFormattingPointerEnd = (event) => formatting?.press.end(event);
|
|
3545
3590
|
const onFormattingKeyDown = (event) => {
|
|
3546
|
-
|
|
3591
|
+
formatting?.press.cancel();
|
|
3547
3592
|
if (event.key !== "Escape" || !(event.target instanceof Node) || !(root.value?.contains(event.target) || formattingPopup?.element.contains(event.target) || linkPopup?.element.contains(event.target)) || !(formatOpen.value || formattingPopup?.isOpen() || linkPopup?.isOpen())) return false;
|
|
3548
3593
|
dismissFormatting();
|
|
3549
3594
|
return true;
|
|
3550
3595
|
};
|
|
3551
3596
|
const dismissFormatting = () => {
|
|
3552
|
-
|
|
3553
|
-
dismissedFormattingSelection = selection instanceof TextSelection || selection instanceof AllSelection ? selection : null;
|
|
3554
|
-
heldFormattingSelection = null;
|
|
3597
|
+
formatting?.dismiss();
|
|
3555
3598
|
formatOpen.value = false;
|
|
3556
3599
|
formattingPopup?.hide();
|
|
3557
3600
|
linkPopup?.hide();
|
|
@@ -3574,10 +3617,10 @@ var LoomaEditor = defineComponent({
|
|
|
3574
3617
|
editor: instance,
|
|
3575
3618
|
element,
|
|
3576
3619
|
pluginKey: "looma-text-formatting-menu",
|
|
3577
|
-
shouldShow: ({ editor: menuEditor }) => (props.toolbarMode !== "popover" || !props.toolbarOpen) && !slash.active && !mention.active && (!props.editable && (props.selectionActions.length > 0 || props.rangeActions.length > 0) || menuEditor.isFocused || formattingPopup?.element.contains(document.activeElement) || linkState.value.surface === "context" || formattingPickerOpen()) &&
|
|
3620
|
+
shouldShow: ({ editor: menuEditor }) => (props.toolbarMode !== "popover" || !props.toolbarOpen) && !slash.active && !mention.active && (!props.editable && (props.selectionActions.length > 0 || props.rangeActions.length > 0) || menuEditor.isFocused || formattingPopup?.element.contains(document.activeElement) || linkState.value.surface === "context" || formattingPickerOpen()) && formattingActive(),
|
|
3578
3621
|
boundary: () => props.toolbarMode === "contextual" ? root.value : null,
|
|
3579
3622
|
related: editorRoot,
|
|
3580
|
-
onHide: () => instance.isEditable && floatingFormattingMode() && formattingPickerOpen() &&
|
|
3623
|
+
onHide: () => instance.isEditable && floatingFormattingMode() && formattingPickerOpen() && formattingActive() ? false : void 0,
|
|
3581
3624
|
onDismiss: (reason) => reason === "escape" ? dismissFormatting() : formattingPopup?.hide()
|
|
3582
3625
|
}));
|
|
3583
3626
|
const linkSurfaceRef = surfaceRef((surface) => {
|
|
@@ -3586,7 +3629,7 @@ var LoomaEditor = defineComponent({
|
|
|
3586
3629
|
editor: instance,
|
|
3587
3630
|
element,
|
|
3588
3631
|
pluginKey: "looma-link-context-menu",
|
|
3589
|
-
shouldShow: ({ editor: menuEditor, from, to }) => from === to && menuEditor.isActive("link") && linkState.value.surface !== "popover" && !
|
|
3632
|
+
shouldShow: ({ editor: menuEditor, from, to }) => from === to && menuEditor.isActive("link") && linkState.value.surface !== "popover" && !formatting?.dismissed(menuEditor.state.selection) && Boolean(menuEditor.isFocused || linkState.value.surface === "context" || linkPopup?.element.contains(document.activeElement)) && !(props.toolbarMode === "contextual" && floatingFormattingMode() && formattingActive()),
|
|
3590
3633
|
maxWidth: () => Math.min(480, window.innerWidth - 24),
|
|
3591
3634
|
related: editorRoot,
|
|
3592
3635
|
onDismiss: (reason) => reason === "escape" ? dismissFormatting() : linkPopup?.hide()
|
|
@@ -3753,7 +3796,7 @@ var LoomaEditor = defineComponent({
|
|
|
3753
3796
|
window.removeEventListener("keyup", onLinkNavigationModifier);
|
|
3754
3797
|
window.removeEventListener("pointermove", onLinkNavigationModifier);
|
|
3755
3798
|
window.removeEventListener("blur", clearLinkNavigationModifier);
|
|
3756
|
-
|
|
3799
|
+
formatting?.destroy();
|
|
3757
3800
|
formattingPopup = null;
|
|
3758
3801
|
document.removeEventListener("pointerdown", onDocumentPointerDown, true);
|
|
3759
3802
|
document.removeEventListener("pointerdown", onFormattingPointerDown);
|
|
@@ -4183,12 +4226,12 @@ var LoomaEditor = defineComponent({
|
|
|
4183
4226
|
ref: formattingSurfaceRef,
|
|
4184
4227
|
class: "looma-editor__floating-shell looma-editor__formatting-shell",
|
|
4185
4228
|
hidden: true
|
|
4186
|
-
}, [props.toolbarMode === "contextual" ? h(Stack, { gap: "xs" }, () => [renderToolbar(instance, true), (linkState.value.surface === "context" || instance.state.selection.empty && instance.isActive("link")) && linkState.value.surface !== "popover" &&
|
|
4229
|
+
}, [props.toolbarMode === "contextual" ? h(Stack, { gap: "xs" }, () => [renderToolbar(instance, true), (linkState.value.surface === "context" || instance.state.selection.empty && instance.isActive("link")) && linkState.value.surface !== "popover" && formattingActive() ? renderLinkContextCard(instance) : null]) : renderToolbar(instance, true, props.toolbarMode === "popover")])]) : null,
|
|
4187
4230
|
instance && props.editable ? h("div", { key: "looma-link-host" }, [h("div", {
|
|
4188
4231
|
ref: linkSurfaceRef,
|
|
4189
4232
|
class: "looma-editor__floating-shell looma-editor__link-shell",
|
|
4190
4233
|
hidden: true
|
|
4191
|
-
}, [props.toolbarMode === "contextual" && floatingFormattingMode() &&
|
|
4234
|
+
}, [props.toolbarMode === "contextual" && floatingFormattingMode() && formattingActive() ? null : renderLinkContextCard(instance)])]) : null,
|
|
4192
4235
|
instance && props.editable && !mobile.value && props.toolbarMode === "popover" && props.toolbarTriggerId ? h(Popover, {
|
|
4193
4236
|
class: "looma-editor__formatting-popover",
|
|
4194
4237
|
role: "region",
|
package/vue/host.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by HTML Next 1.0.0-alpha.
|
|
1
|
+
// Generated by HTML Next 1.0.0-alpha.52 for Vue 3.5. Do not edit.
|
|
2
2
|
import {
|
|
3
3
|
computed,
|
|
4
4
|
createTextVNode,
|
|
@@ -349,6 +349,20 @@ export interface Readable<T> {
|
|
|
349
349
|
readonly value: T
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
/** Vue refs a component invocation as its public instance; the ref is the root element it lowered to. */
|
|
353
|
+
function refElement(ref: any): Element {
|
|
354
|
+
return ref == null || ref.nodeType === 1 ? ref : ref.$el
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** The root ref as an element: a delegating component's root ref holds the invoked component. */
|
|
358
|
+
function rootElement<T extends Element>(root: Readable<T | null>): Readable<T | null> {
|
|
359
|
+
return {
|
|
360
|
+
get value() {
|
|
361
|
+
return refElement(root.value) as T | null
|
|
362
|
+
},
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
352
366
|
type DocumentMutationSubscriber = (mutations: readonly MutationRecord[]) => void
|
|
353
367
|
interface DocumentMutationHub {
|
|
354
368
|
readonly observer: MutationObserver
|
|
@@ -391,10 +405,11 @@ function observeConnection(element: Element, check: () => void): () => void {
|
|
|
391
405
|
* reinserted outside Vue.
|
|
392
406
|
*/
|
|
393
407
|
export function useLifecycle(
|
|
394
|
-
|
|
408
|
+
componentRoot: Readable<Element | null>,
|
|
395
409
|
connect?: () => void,
|
|
396
410
|
disconnect?: () => void,
|
|
397
411
|
): void {
|
|
412
|
+
const root = rootElement(componentRoot)
|
|
398
413
|
let connected = false
|
|
399
414
|
let stop: (() => void) | undefined
|
|
400
415
|
const synchronize = (): void => {
|
|
@@ -416,7 +431,8 @@ export function useLifecycle(
|
|
|
416
431
|
}
|
|
417
432
|
|
|
418
433
|
/** Keep native focus on the corresponding control when a root-level $match replaces its element. */
|
|
419
|
-
export function preserveRootFocus(
|
|
434
|
+
export function preserveRootFocus(componentRoot: Readable<Element | null>): void {
|
|
435
|
+
const root = rootElement(componentRoot)
|
|
420
436
|
const focusable =
|
|
421
437
|
'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]'
|
|
422
438
|
let previous: Element | null = null
|
|
@@ -496,8 +512,8 @@ export function useComponentHost(
|
|
|
496
512
|
controllerLoader: () => Promise<unknown>,
|
|
497
513
|
options: ComponentHostOptions,
|
|
498
514
|
) {
|
|
515
|
+
const root = rootElement(options.root)
|
|
499
516
|
const {
|
|
500
|
-
root,
|
|
501
517
|
dispatch,
|
|
502
518
|
props,
|
|
503
519
|
propInputs = () => null,
|
|
@@ -634,7 +650,10 @@ export function useComponentHost(
|
|
|
634
650
|
Object.fromEntries(
|
|
635
651
|
Object.entries(refs).map(([name, ref]) => [name, {
|
|
636
652
|
enumerable: true,
|
|
637
|
-
get: () =>
|
|
653
|
+
get: () =>
|
|
654
|
+
Array.isArray(ref.value)
|
|
655
|
+
? inDocumentOrder(ref.value.map(refElement))
|
|
656
|
+
: refElement(ref.value),
|
|
638
657
|
}]),
|
|
639
658
|
),
|
|
640
659
|
) as Readonly<Record<string, Element | readonly Element[]>>,
|
|
@@ -819,10 +838,11 @@ export function runFilteredEvent(
|
|
|
819
838
|
|
|
820
839
|
/** Reports declared CustomEvents to Vue and dispatches them through the DOM. */
|
|
821
840
|
export function createDispatch(
|
|
822
|
-
|
|
841
|
+
componentRoot: Readable<HTMLElement | null>,
|
|
823
842
|
emit?: (name: string, detail: unknown) => void,
|
|
824
843
|
options: DispatchOptions = {},
|
|
825
844
|
): (name: string, detail?: unknown, targets?: unknown) => boolean {
|
|
845
|
+
const root = rootElement(componentRoot)
|
|
826
846
|
const { declared = {}, checks = {}, modeled = [] } = options
|
|
827
847
|
// One change can be reported by more than one event — a choice is both a select and a change —
|
|
828
848
|
// and each carries the new value. The prop updates once per change: a value already reported in
|