@ghostvue/vue 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +40 -2
- package/dist/.registries/component-names.generated.d.ts +3 -0
- package/dist/GhostAccordion.vue.d.ts +38 -0
- package/dist/GhostAccordionContent.vue.d.ts +26 -0
- package/dist/GhostAccordionItem.vue.d.ts +20 -0
- package/dist/GhostAccordionTrigger.vue.d.ts +23 -0
- package/dist/GhostAvatar.vue.d.ts +27 -0
- package/dist/GhostBadge.vue.d.ts +16 -0
- package/dist/GhostBreadcrumb.vue.d.ts +28 -0
- package/dist/GhostBreadcrumbEllipsis.vue.d.ts +20 -0
- package/dist/GhostBreadcrumbItem.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbLink.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbList.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbPage.vue.d.ts +25 -0
- package/dist/GhostBreadcrumbSeparator.vue.d.ts +25 -0
- package/dist/GhostButton.vue.d.ts +25 -0
- package/dist/GhostCalendar.vue.d.ts +57 -0
- package/dist/GhostCalendarCell.vue.d.ts +35 -0
- package/dist/GhostCalendarGrid.vue.d.ts +19 -0
- package/dist/GhostCalendarHeader.vue.d.ts +24 -0
- package/dist/GhostCalendarHeading.vue.d.ts +22 -0
- package/dist/GhostCalendarNextButton.vue.d.ts +24 -0
- package/dist/GhostCalendarPrevButton.vue.d.ts +24 -0
- package/dist/GhostCard.vue.d.ts +18 -0
- package/dist/GhostCheckbox.vue.d.ts +48 -0
- package/dist/GhostCheckboxGroup.vue.d.ts +24 -0
- package/dist/GhostCollapsible.vue.d.ts +31 -0
- package/dist/GhostCollapsibleContent.vue.d.ts +30 -0
- package/dist/GhostCollapsibleTrigger.vue.d.ts +28 -0
- package/dist/GhostCombobox.vue.d.ts +69 -0
- package/dist/GhostComboboxContent.vue.d.ts +41 -0
- package/dist/GhostComboboxEmpty.vue.d.ts +21 -0
- package/dist/GhostComboboxGroup.vue.d.ts +21 -0
- package/dist/GhostComboboxInput.vue.d.ts +11 -0
- package/dist/GhostComboboxLabel.vue.d.ts +21 -0
- package/dist/GhostComboboxOption.vue.d.ts +29 -0
- package/dist/GhostComboboxTrigger.vue.d.ts +26 -0
- package/dist/GhostCommandPalette.vue.d.ts +57 -0
- package/dist/GhostCommandPaletteContent.vue.d.ts +47 -0
- package/dist/GhostCommandPaletteEmpty.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteGroup.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteInput.vue.d.ts +13 -0
- package/dist/GhostCommandPaletteItem.vue.d.ts +33 -0
- package/dist/GhostCommandPaletteLabel.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteList.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteOverlay.vue.d.ts +32 -0
- package/dist/GhostCommandPaletteSeparator.vue.d.ts +10 -0
- package/dist/GhostCommandPaletteTitle.vue.d.ts +25 -0
- package/dist/GhostCommandPaletteTrigger.vue.d.ts +28 -0
- package/dist/GhostContextMenu.vue.d.ts +26 -0
- package/dist/GhostContextMenuCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostContextMenuContent.vue.d.ts +39 -0
- package/dist/GhostContextMenuGroup.vue.d.ts +21 -0
- package/dist/GhostContextMenuItem.vue.d.ts +30 -0
- package/dist/GhostContextMenuLabel.vue.d.ts +21 -0
- package/dist/GhostContextMenuRadioGroup.vue.d.ts +31 -0
- package/dist/GhostContextMenuRadioItem.vue.d.ts +31 -0
- package/dist/GhostContextMenuSeparator.vue.d.ts +11 -0
- package/dist/GhostContextMenuTrigger.vue.d.ts +28 -0
- package/dist/GhostDataTable.vue.d.ts +29 -0
- package/dist/GhostDataTablePreset.vue.d.ts +21 -0
- package/dist/GhostDataTableTable.vue.d.ts +20 -0
- package/dist/GhostDatePicker.vue.d.ts +106 -0
- package/dist/GhostDatePickerCalendar.vue.d.ts +16 -0
- package/dist/GhostDatePickerContent.vue.d.ts +46 -0
- package/dist/GhostDatePickerInput.vue.d.ts +19 -0
- package/dist/GhostDatePickerTrigger.vue.d.ts +14 -0
- package/dist/GhostDialog.vue.d.ts +31 -0
- package/dist/GhostDialogClose.vue.d.ts +28 -0
- package/dist/GhostDialogContent.vue.d.ts +50 -0
- package/dist/GhostDialogDescription.vue.d.ts +25 -0
- package/dist/GhostDialogOverlay.vue.d.ts +32 -0
- package/dist/GhostDialogTitle.vue.d.ts +25 -0
- package/dist/GhostDialogTrigger.vue.d.ts +28 -0
- package/dist/GhostDrawer.vue.d.ts +39 -0
- package/dist/GhostDrawerClose.vue.d.ts +28 -0
- package/dist/GhostDrawerContent.vue.d.ts +47 -0
- package/dist/GhostDrawerDescription.vue.d.ts +25 -0
- package/dist/GhostDrawerOverlay.vue.d.ts +32 -0
- package/dist/GhostDrawerTitle.vue.d.ts +25 -0
- package/dist/GhostDrawerTrigger.vue.d.ts +28 -0
- package/dist/GhostDropdownMenu.vue.d.ts +26 -0
- package/dist/GhostDropdownMenuCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostDropdownMenuContent.vue.d.ts +39 -0
- package/dist/GhostDropdownMenuGroup.vue.d.ts +21 -0
- package/dist/GhostDropdownMenuItem.vue.d.ts +30 -0
- package/dist/GhostDropdownMenuLabel.vue.d.ts +21 -0
- package/dist/GhostDropdownMenuRadioGroup.vue.d.ts +31 -0
- package/dist/GhostDropdownMenuRadioItem.vue.d.ts +31 -0
- package/dist/GhostDropdownMenuSeparator.vue.d.ts +11 -0
- package/dist/GhostDropdownMenuTrigger.vue.d.ts +26 -0
- package/dist/GhostEmptyState.vue.d.ts +19 -0
- package/dist/GhostField.vue.d.ts +31 -0
- package/dist/GhostFieldControl.vue.d.ts +13 -0
- package/dist/GhostFieldDescription.vue.d.ts +21 -0
- package/dist/GhostFieldError.vue.d.ts +18 -0
- package/dist/GhostFieldLabel.vue.d.ts +30 -0
- package/dist/GhostFileUpload.vue.d.ts +64 -0
- package/dist/GhostFileUploadDropzone.vue.d.ts +13 -0
- package/dist/GhostFileUploadItem.vue.d.ts +17 -0
- package/dist/GhostFileUploadItemRemove.vue.d.ts +13 -0
- package/dist/GhostFileUploadList.vue.d.ts +13 -0
- package/dist/GhostFileUploadTrigger.vue.d.ts +19 -0
- package/dist/GhostForm.vue.d.ts +25 -0
- package/dist/GhostHoverCard.vue.d.ts +37 -0
- package/dist/GhostHoverCardContent.vue.d.ts +47 -0
- package/dist/GhostHoverCardTrigger.vue.d.ts +28 -0
- package/dist/GhostInlineAlert.vue.d.ts +19 -0
- package/dist/GhostInput.vue.d.ts +26 -0
- package/dist/GhostInteractiveSurface.vue.d.ts +25 -0
- package/dist/GhostKbd.vue.d.ts +25 -0
- package/dist/GhostLink.vue.d.ts +25 -0
- package/dist/GhostMenubar.vue.d.ts +27 -0
- package/dist/GhostMenubarCheckboxItem.vue.d.ts +63 -0
- package/dist/GhostMenubarContent.vue.d.ts +39 -0
- package/dist/GhostMenubarGroup.vue.d.ts +21 -0
- package/dist/GhostMenubarItem.vue.d.ts +30 -0
- package/dist/GhostMenubarLabel.vue.d.ts +21 -0
- package/dist/GhostMenubarMenu.vue.d.ts +26 -0
- package/dist/GhostMenubarRadioGroup.vue.d.ts +31 -0
- package/dist/GhostMenubarRadioItem.vue.d.ts +31 -0
- package/dist/GhostMenubarSeparator.vue.d.ts +11 -0
- package/dist/GhostMenubarTrigger.vue.d.ts +26 -0
- package/dist/GhostNumberInput.vue.d.ts +37 -0
- package/dist/GhostPagination.vue.d.ts +53 -0
- package/dist/GhostPopover.vue.d.ts +28 -0
- package/dist/GhostPopoverClose.vue.d.ts +28 -0
- package/dist/GhostPopoverContent.vue.d.ts +47 -0
- package/dist/GhostPopoverTrigger.vue.d.ts +28 -0
- package/dist/GhostPortal.vue.d.ts +28 -0
- package/dist/GhostPresence.vue.d.ts +27 -0
- package/dist/GhostProgress.vue.d.ts +14 -0
- package/dist/GhostRadioGroup.vue.d.ts +36 -0
- package/dist/GhostRadioGroupItem.vue.d.ts +10 -0
- package/dist/GhostScrollArea.vue.d.ts +17 -0
- package/dist/GhostScrollSpy.vue.d.ts +57 -0
- package/dist/GhostScrollSpyItem.vue.d.ts +26 -0
- package/dist/GhostScrollSpyLink.vue.d.ts +27 -0
- package/dist/GhostScrollSpyList.vue.d.ts +24 -0
- package/dist/GhostSegmentedControl.vue.d.ts +44 -0
- package/dist/GhostSegmentedControlIndicator.vue.d.ts +3 -0
- package/dist/GhostSegmentedControlItem.vue.d.ts +30 -0
- package/dist/GhostSelect.vue.d.ts +24 -0
- package/dist/GhostSelectContent.vue.d.ts +41 -0
- package/dist/GhostSelectGroup.vue.d.ts +21 -0
- package/dist/GhostSelectLabel.vue.d.ts +21 -0
- package/dist/GhostSelectOption.vue.d.ts +29 -0
- package/dist/GhostSelectTrigger.vue.d.ts +26 -0
- package/dist/GhostSelectValue.vue.d.ts +14 -0
- package/dist/GhostSeparator.vue.d.ts +7 -0
- package/dist/GhostSkeleton.vue.d.ts +18 -0
- package/dist/GhostSlider.vue.d.ts +141 -0
- package/dist/GhostSpinner.vue.d.ts +8 -0
- package/dist/GhostSubmenu.vue.d.ts +23 -0
- package/dist/GhostSubmenuContent.vue.d.ts +20 -0
- package/dist/GhostSubmenuTrigger.vue.d.ts +17 -0
- package/dist/GhostSwitch.vue.d.ts +37 -0
- package/dist/GhostTable.vue.d.ts +15 -0
- package/dist/GhostTableBody.vue.d.ts +13 -0
- package/dist/GhostTableCaption.vue.d.ts +13 -0
- package/dist/GhostTableCell.vue.d.ts +13 -0
- package/dist/GhostTableFoot.vue.d.ts +13 -0
- package/dist/GhostTableHead.vue.d.ts +13 -0
- package/dist/GhostTableHeaderCell.vue.d.ts +13 -0
- package/dist/GhostTableRow.vue.d.ts +13 -0
- package/dist/GhostTabs.vue.d.ts +37 -0
- package/dist/GhostTabsContent.vue.d.ts +27 -0
- package/dist/GhostTabsList.vue.d.ts +25 -0
- package/dist/GhostTabsTrigger.vue.d.ts +30 -0
- package/dist/GhostTagsInput.vue.d.ts +26 -0
- package/dist/GhostTextarea.vue.d.ts +29 -0
- package/dist/GhostToast.vue.d.ts +17 -0
- package/dist/GhostToastAction.vue.d.ts +17 -0
- package/dist/GhostToastClose.vue.d.ts +16 -0
- package/dist/GhostToastDescription.vue.d.ts +12 -0
- package/dist/GhostToastProvider.vue.d.ts +24 -0
- package/dist/GhostToastTitle.vue.d.ts +12 -0
- package/dist/GhostToastViewport.vue.d.ts +25 -0
- package/dist/GhostToggleGroup.vue.d.ts +41 -0
- package/dist/GhostToggleGroupItem.vue.d.ts +30 -0
- package/dist/GhostToolbar.vue.d.ts +29 -0
- package/dist/GhostTooltip.vue.d.ts +36 -0
- package/dist/GhostTooltipContent.vue.d.ts +47 -0
- package/dist/GhostTooltipProvider.vue.d.ts +16 -0
- package/dist/GhostTooltipTrigger.vue.d.ts +28 -0
- package/dist/GhostTree.vue.d.ts +59 -0
- package/dist/GhostTreeGroup.vue.d.ts +22 -0
- package/dist/GhostTreeItem.vue.d.ts +27 -0
- package/dist/GhostTreeTrigger.vue.d.ts +25 -0
- package/dist/GhostVisuallyHidden.vue.d.ts +19 -0
- package/dist/accordion-header-keyboard.d.ts +11 -0
- package/dist/calendar-date-math.d.ts +16 -0
- package/dist/calendar-intl.d.ts +7 -0
- package/dist/calendar-public-date.d.ts +1 -0
- package/dist/command-palette-context.d.ts +6 -0
- package/dist/data-table-interaction.d.ts +57 -0
- package/dist/data-table-processing.d.ts +32 -0
- package/dist/data-table-render.d.ts +40 -0
- package/dist/data-table-slot-bindings.d.ts +21 -0
- package/dist/date-picker-calendar-bridge.d.ts +25 -0
- package/dist/date-picker-value.d.ts +33 -0
- package/dist/define-data-table-columns.d.ts +89 -0
- package/dist/dev-codes.d.ts +179 -0
- package/dist/dialog-shared.d.ts +178 -0
- package/dist/dismissable-layer-stack.d.ts +28 -0
- package/dist/form-reset.d.ts +29 -0
- package/dist/get-pagination-range.d.ts +24 -0
- package/dist/get-tabbable-elements.d.ts +22 -0
- package/dist/ghost-accordion.d.ts +120 -0
- package/dist/ghost-avatar.d.ts +41 -0
- package/dist/ghost-badge.d.ts +11 -0
- package/dist/ghost-breadcrumb.d.ts +114 -0
- package/dist/ghost-button.d.ts +39 -0
- package/dist/ghost-calendar.d.ts +148 -0
- package/dist/ghost-card.d.ts +29 -0
- package/dist/ghost-checkbox-group.d.ts +88 -0
- package/dist/ghost-checkbox.d.ts +51 -0
- package/dist/ghost-collapsible.d.ts +104 -0
- package/dist/ghost-combobox.d.ts +217 -0
- package/dist/ghost-command-palette.d.ts +377 -0
- package/dist/ghost-context-menu.d.ts +226 -0
- package/dist/ghost-data-table-preset.d.ts +107 -0
- package/dist/ghost-data-table-table.d.ts +76 -0
- package/dist/ghost-data-table.d.ts +508 -0
- package/dist/ghost-date-picker.d.ts +301 -0
- package/dist/ghost-dialog.d.ts +256 -0
- package/dist/ghost-drawer.d.ts +268 -0
- package/dist/ghost-dropdown-menu.d.ts +226 -0
- package/dist/ghost-empty-state.d.ts +26 -0
- package/dist/ghost-field.d.ts +172 -0
- package/dist/ghost-file-upload-accept.d.ts +32 -0
- package/dist/ghost-file-upload-messages.d.ts +14 -0
- package/dist/ghost-file-upload.d.ts +325 -0
- package/dist/ghost-form.d.ts +273 -0
- package/dist/ghost-hover-card.d.ts +192 -0
- package/dist/ghost-inline-alert.d.ts +34 -0
- package/dist/ghost-input.d.ts +71 -0
- package/dist/ghost-interactive-surface.d.ts +41 -0
- package/dist/ghost-kbd.d.ts +39 -0
- package/dist/ghost-link.d.ts +58 -0
- package/dist/ghost-menubar.d.ts +260 -0
- package/dist/ghost-number-input.d.ts +88 -0
- package/dist/ghost-pagination.d.ts +92 -0
- package/dist/ghost-popover.d.ts +188 -0
- package/dist/ghost-portal.d.ts +21 -0
- package/dist/ghost-presence.d.ts +78 -0
- package/dist/ghost-progress.d.ts +40 -0
- package/dist/ghost-radio-group.d.ts +100 -0
- package/dist/ghost-scroll-area.d.ts +46 -0
- package/dist/ghost-scroll-spy.d.ts +150 -0
- package/dist/ghost-segmented-control.d.ts +124 -0
- package/dist/ghost-select.d.ts +188 -0
- package/dist/ghost-separator.d.ts +33 -0
- package/dist/ghost-skeleton.d.ts +14 -0
- package/dist/ghost-slider.d.ts +99 -0
- package/dist/ghost-spinner.d.ts +22 -0
- package/dist/ghost-submenu.d.ts +20 -0
- package/dist/ghost-switch.d.ts +77 -0
- package/dist/ghost-table.d.ts +62 -0
- package/dist/ghost-tabs.d.ts +154 -0
- package/dist/ghost-tags-input.d.ts +41 -0
- package/dist/ghost-textarea.d.ts +78 -0
- package/dist/ghost-toast.d.ts +219 -0
- package/dist/ghost-toggle-group.d.ts +123 -0
- package/dist/ghost-toolbar.d.ts +23 -0
- package/dist/ghost-tooltip-provider.d.ts +48 -0
- package/dist/ghost-tooltip.d.ts +190 -0
- package/dist/ghost-tree.d.ts +355 -0
- package/dist/ghost-visually-hidden.d.ts +27 -0
- package/dist/ghostvue.js +19653 -0
- package/dist/has-tabbable-descendants.d.ts +2 -0
- package/dist/index.d.ts +322 -0
- package/dist/invoke-attr-handler.d.ts +15 -0
- package/dist/is-ime-composing.d.ts +28 -0
- package/dist/manifest.json +18406 -0
- package/dist/measure-scroll-overflow.d.ts +6 -0
- package/dist/menu-item-activation.d.ts +39 -0
- package/dist/resolver.d.ts +49 -0
- package/dist/resolver.js +14 -0
- package/dist/scroll-spy-motion.d.ts +26 -0
- package/dist/sort-by-document-order.d.ts +23 -0
- package/dist/sync-calendar-focus-tab-stops.d.ts +2 -0
- package/dist/sync-segmented-control-item-order.d.ts +5 -0
- package/dist/sync-tabs-selection-tab-stops.d.ts +7 -0
- package/dist/sync-toggle-group-selection-tab-stops.d.ts +14 -0
- package/dist/track-reactive-reads.d.ts +13 -0
- package/dist/typeahead-match.d.ts +15 -0
- package/dist/use-collapsible-content-hidden.d.ts +28 -0
- package/dist/use-controllable-state.d.ts +20 -0
- package/dist/use-dismissable-layer.d.ts +48 -0
- package/dist/use-floating.d.ts +38 -0
- package/dist/use-focus-scope.d.ts +41 -0
- package/dist/use-ghost-accordion.d.ts +5 -0
- package/dist/use-ghost-avatar.d.ts +28 -0
- package/dist/use-ghost-badge.d.ts +13 -0
- package/dist/use-ghost-breadcrumb.d.ts +19 -0
- package/dist/use-ghost-button.d.ts +18 -0
- package/dist/use-ghost-calendar.d.ts +3 -0
- package/dist/use-ghost-card.d.ts +15 -0
- package/dist/use-ghost-checkbox-group.d.ts +13 -0
- package/dist/use-ghost-checkbox.d.ts +24 -0
- package/dist/use-ghost-collapsible.d.ts +8 -0
- package/dist/use-ghost-combobox.d.ts +65 -0
- package/dist/use-ghost-command-palette.d.ts +24 -0
- package/dist/use-ghost-context-menu.d.ts +14 -0
- package/dist/use-ghost-data-table.d.ts +55 -0
- package/dist/use-ghost-date-picker.d.ts +11 -0
- package/dist/use-ghost-dialog.d.ts +10 -0
- package/dist/use-ghost-drawer.d.ts +11 -0
- package/dist/use-ghost-dropdown-menu.d.ts +5 -0
- package/dist/use-ghost-empty-state.d.ts +18 -0
- package/dist/use-ghost-field-part-content.d.ts +15 -0
- package/dist/use-ghost-field.d.ts +10 -0
- package/dist/use-ghost-file-upload.d.ts +16 -0
- package/dist/use-ghost-form.d.ts +7 -0
- package/dist/use-ghost-hover-card.d.ts +8 -0
- package/dist/use-ghost-id.d.ts +6 -0
- package/dist/use-ghost-inline-alert.d.ts +20 -0
- package/dist/use-ghost-input.d.ts +29 -0
- package/dist/use-ghost-interactive-surface.d.ts +21 -0
- package/dist/use-ghost-kbd.d.ts +35 -0
- package/dist/use-ghost-link.d.ts +20 -0
- package/dist/use-ghost-menu-branch.d.ts +54 -0
- package/dist/use-ghost-menu-collection.d.ts +30 -0
- package/dist/use-ghost-menu-root.d.ts +13 -0
- package/dist/use-ghost-menubar-menu.d.ts +3 -0
- package/dist/use-ghost-menubar.d.ts +10 -0
- package/dist/use-ghost-number-input.d.ts +63 -0
- package/dist/use-ghost-pagination.d.ts +22 -0
- package/dist/use-ghost-popover.d.ts +8 -0
- package/dist/use-ghost-presence.d.ts +48 -0
- package/dist/use-ghost-progress.d.ts +33 -0
- package/dist/use-ghost-radio-group.d.ts +5 -0
- package/dist/use-ghost-scroll-area.d.ts +23 -0
- package/dist/use-ghost-scroll-spy.d.ts +25 -0
- package/dist/use-ghost-segmented-control.d.ts +6 -0
- package/dist/use-ghost-select.d.ts +62 -0
- package/dist/use-ghost-separator.d.ts +19 -0
- package/dist/use-ghost-skeleton.d.ts +19 -0
- package/dist/use-ghost-slider.d.ts +65 -0
- package/dist/use-ghost-spinner.d.ts +18 -0
- package/dist/use-ghost-switch.d.ts +39 -0
- package/dist/use-ghost-table.d.ts +70 -0
- package/dist/use-ghost-tabs.d.ts +5 -0
- package/dist/use-ghost-textarea.d.ts +44 -0
- package/dist/use-ghost-toast.d.ts +56 -0
- package/dist/use-ghost-toggle-group.d.ts +6 -0
- package/dist/use-ghost-toolbar.d.ts +23 -0
- package/dist/use-ghost-tooltip.d.ts +8 -0
- package/dist/use-ghost-tree.d.ts +14 -0
- package/dist/use-ghost-visually-hidden.d.ts +35 -0
- package/dist/use-inert-others.d.ts +20 -0
- package/dist/use-roving-focus.d.ts +22 -0
- package/dist/use-scroll-lock.d.ts +13 -0
- package/package.json +60 -4
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Presence lifecycle phase. `'exiting'` means the surface is logically closed
|
|
4
|
+
* but its DOM stays mounted while its own CSS exit motion runs.
|
|
5
|
+
*/
|
|
6
|
+
export type GhostPresencePhase = 'closed' | 'open' | 'exiting';
|
|
7
|
+
/**
|
|
8
|
+
* Value written to the surface's `data-state` hook. `'closed'` covers both the
|
|
9
|
+
* `'exiting'` and `'closed'` phases, so exit CSS targets `[data-state='closed']`.
|
|
10
|
+
*/
|
|
11
|
+
export type GhostPresenceDataState = 'open' | 'closed';
|
|
12
|
+
/** Options for {@link useGhostPresence}. */
|
|
13
|
+
export interface UseGhostPresenceOptions {
|
|
14
|
+
/** Logical open state (`true` while open, `false` when logically closed). */
|
|
15
|
+
present: MaybeRefOrGetter<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Host element (HTML or SVG) whose own CSS transitions/animations gate DOM
|
|
18
|
+
* removal during the `exiting` phase. Optional when binding `setElement` as a
|
|
19
|
+
* template ref.
|
|
20
|
+
*/
|
|
21
|
+
element?: MaybeRefOrGetter<Element | null | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Skips exit retention when `true` (for example `disableAnimation` or an
|
|
24
|
+
* anchored overlay closed before initial positioning completed).
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Invoked once after an `exiting` surface finishes its exit motion and flips
|
|
30
|
+
* `isPresent` to `false`. Never called when an exit is interrupted by reopen
|
|
31
|
+
* or aborted by owner component unmount.
|
|
32
|
+
*/
|
|
33
|
+
onExitComplete?: () => void;
|
|
34
|
+
}
|
|
35
|
+
/** Reactive state returned by {@link useGhostPresence}. */
|
|
36
|
+
export interface UseGhostPresenceReturn {
|
|
37
|
+
/** `true` while `present` is `true` or while `phase` is `'exiting'`. */
|
|
38
|
+
isPresent: ComputedRef<boolean>;
|
|
39
|
+
/** Current lifecycle phase: `'closed'`, `'open'`, or `'exiting'`. */
|
|
40
|
+
phase: Readonly<Ref<GhostPresencePhase>>;
|
|
41
|
+
/** `'open'` when logically open; `'closed'` during `'exiting'` and `'closed'`. */
|
|
42
|
+
dataState: ComputedRef<GhostPresenceDataState>;
|
|
43
|
+
/** `true` only while `phase` is `'exiting'`. */
|
|
44
|
+
isExiting: ComputedRef<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Template-ref setter accepting a raw `Element`, a component instance exposing
|
|
47
|
+
* `{ element: Element | null }` or an `Element` `$el`, or `null`. Used when `options.element`
|
|
48
|
+
* is not passed directly.
|
|
49
|
+
*/
|
|
50
|
+
setElement: (target: unknown) => void;
|
|
51
|
+
}
|
|
52
|
+
/** Props for the renderless {@link GhostPresence} component. */
|
|
53
|
+
export interface GhostPresenceProps {
|
|
54
|
+
/**
|
|
55
|
+
* Logical open/mounted state. When `true`, mounts the default slot; when
|
|
56
|
+
* `false`, transitions through `exiting` before unmount.
|
|
57
|
+
*/
|
|
58
|
+
present: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* When `true`, bypasses exit waiting and unmounts immediately when `present`
|
|
61
|
+
* turns `false`.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** Props passed to the {@link GhostPresence} default slot. */
|
|
67
|
+
export interface GhostPresenceSlotProps {
|
|
68
|
+
/** Logical `present` value passed to the component. */
|
|
69
|
+
present: boolean;
|
|
70
|
+
/** Current lifecycle phase. */
|
|
71
|
+
phase: GhostPresencePhase;
|
|
72
|
+
/** Value to bind as `data-state` on a surface that binds `setElement` manually. */
|
|
73
|
+
state: GhostPresenceDataState;
|
|
74
|
+
/** `true` while the exit motion runs; bind `:inert="exiting || undefined"` when binding manually. */
|
|
75
|
+
exiting: boolean;
|
|
76
|
+
/** Template-ref setter for the animated surface when the slot is not a single element. */
|
|
77
|
+
setElement: (target: unknown) => void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HTMLAttributes, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Unstyled {@link GhostProgress} props. `@vue-ignore` keeps native attributes as
|
|
4
|
+
* fallthrough at runtime while typing the full div contract for consumers.
|
|
5
|
+
*/
|
|
6
|
+
export interface GhostProgressProps extends /* @vue-ignore */ HTMLAttributes {
|
|
7
|
+
/**
|
|
8
|
+
* Current progress in the same unit as {@link max}. Omit or pass `null` for
|
|
9
|
+
* the indeterminate fallback. Non-finite numbers are treated as unknown.
|
|
10
|
+
* Finite values are clamped to `[0, max]`.
|
|
11
|
+
*/
|
|
12
|
+
value?: number | null;
|
|
13
|
+
/**
|
|
14
|
+
* Exclusive upper bound of the range. Matches the ARIA `progressbar` default
|
|
15
|
+
* for `aria-valuemax`, not HTML `<progress>` (`1`), because percent-complete
|
|
16
|
+
* is the ordinary upload/table call site.
|
|
17
|
+
* @default 100
|
|
18
|
+
*/
|
|
19
|
+
max?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Accessible name, applied as `aria-label`. `role="progressbar"` is
|
|
22
|
+
* `nameFrom: author`; contents are presentational and cannot name the widget.
|
|
23
|
+
* Prefer `aria-labelledby` fallthrough when a visible heading already names
|
|
24
|
+
* the task.
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Accessible value text (`aria-valuetext`) for determinate instances. When
|
|
29
|
+
* omitted, the default is the rounded percent (`"40%"`). Ignored while
|
|
30
|
+
* indeterminate.
|
|
31
|
+
*/
|
|
32
|
+
valueText?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Options for {@link useGhostProgress}. */
|
|
35
|
+
export interface UseGhostProgressOptions {
|
|
36
|
+
value?: MaybeRefOrGetter<number | null | undefined>;
|
|
37
|
+
max?: MaybeRefOrGetter<number | undefined>;
|
|
38
|
+
label?: MaybeRefOrGetter<string | undefined>;
|
|
39
|
+
valueText?: MaybeRefOrGetter<string | undefined>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Component, ComputedRef, InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
export type GhostRadioGroupOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
/** Valid `as` targets for {@link GhostRadioGroup}. */
|
|
4
|
+
export type GhostRadioGroupElement = string | Component;
|
|
5
|
+
/** Props for {@link GhostRadioGroup}. */
|
|
6
|
+
export interface GhostRadioGroupProps {
|
|
7
|
+
/**
|
|
8
|
+
* Controlled selected value. Omit for uncontrolled mode.
|
|
9
|
+
* @default undefined
|
|
10
|
+
*/
|
|
11
|
+
modelValue?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Initial selected value when `modelValue` is omitted. Form reset restores
|
|
14
|
+
* this captured seed.
|
|
15
|
+
* @default undefined
|
|
16
|
+
*/
|
|
17
|
+
defaultValue?: string | undefined;
|
|
18
|
+
/** Shared native `name` for item inputs. */
|
|
19
|
+
name?: string | undefined;
|
|
20
|
+
/** Disables the whole group. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Required semantics propagated to item inputs. */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** Invalid semantics for Field integration (`aria-invalid` on root). */
|
|
25
|
+
invalid?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Layout and roving arrow-key orientation.
|
|
28
|
+
* @default 'vertical'
|
|
29
|
+
*/
|
|
30
|
+
orientation?: GhostRadioGroupOrientation;
|
|
31
|
+
/**
|
|
32
|
+
* Root host element.
|
|
33
|
+
* @default 'fieldset'
|
|
34
|
+
*/
|
|
35
|
+
as?: GhostRadioGroupElement;
|
|
36
|
+
}
|
|
37
|
+
/** Props for {@link GhostRadioGroupItem}. */
|
|
38
|
+
export interface GhostRadioGroupItemProps {
|
|
39
|
+
/** Option value; must be unique within the group. */
|
|
40
|
+
value: string;
|
|
41
|
+
/** Disables this option only. */
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Methods exposed by {@link GhostRadioGroup}. */
|
|
45
|
+
export interface GhostRadioGroupExposed {
|
|
46
|
+
readonly element: HTMLElement | null;
|
|
47
|
+
focus(options?: FocusOptions): void;
|
|
48
|
+
blur(): void;
|
|
49
|
+
}
|
|
50
|
+
/** Methods exposed by {@link GhostRadioGroupItem}. */
|
|
51
|
+
export interface GhostRadioGroupItemExposed {
|
|
52
|
+
readonly element: HTMLInputElement | null;
|
|
53
|
+
focus(options?: FocusOptions): void;
|
|
54
|
+
blur(): void;
|
|
55
|
+
}
|
|
56
|
+
/** Options for {@link useGhostRadioGroup}. */
|
|
57
|
+
export interface UseGhostRadioGroupOptions {
|
|
58
|
+
modelValue?: MaybeRefOrGetter<string | undefined>;
|
|
59
|
+
defaultValue?: MaybeRefOrGetter<string | undefined>;
|
|
60
|
+
name?: MaybeRefOrGetter<string | undefined>;
|
|
61
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
62
|
+
required?: MaybeRefOrGetter<boolean | undefined>;
|
|
63
|
+
invalid?: MaybeRefOrGetter<boolean | undefined>;
|
|
64
|
+
orientation?: MaybeRefOrGetter<GhostRadioGroupOrientation | undefined>;
|
|
65
|
+
onValueChange?: (value: string) => void;
|
|
66
|
+
}
|
|
67
|
+
/** Reactive state returned by {@link useGhostRadioGroup}. */
|
|
68
|
+
export interface UseGhostRadioGroupReturn {
|
|
69
|
+
selectedValue: Ref<string | undefined>;
|
|
70
|
+
name: ComputedRef<string>;
|
|
71
|
+
disabled: ComputedRef<boolean>;
|
|
72
|
+
required: ComputedRef<boolean>;
|
|
73
|
+
invalid: ComputedRef<boolean>;
|
|
74
|
+
orientation: ComputedRef<GhostRadioGroupOrientation>;
|
|
75
|
+
select: (value: string) => void;
|
|
76
|
+
isSelected: (value: string) => boolean;
|
|
77
|
+
isItemDisabled: (value: string) => boolean;
|
|
78
|
+
registerItem: (value: string, disabled: boolean, getElement: () => HTMLInputElement | null) => void;
|
|
79
|
+
setItemDisabled: (value: string, disabled: boolean) => void;
|
|
80
|
+
unregisterItem: (value: string) => void;
|
|
81
|
+
restoreItemDom: (value: string) => void;
|
|
82
|
+
applyFormReset: () => void;
|
|
83
|
+
registryVersion: Ref<number>;
|
|
84
|
+
}
|
|
85
|
+
/** Shared context between radio group parts. */
|
|
86
|
+
export interface GhostRadioGroupContext {
|
|
87
|
+
readonly selectedValue: Ref<string | undefined>;
|
|
88
|
+
name: ComputedRef<string>;
|
|
89
|
+
disabled: ComputedRef<boolean>;
|
|
90
|
+
required: ComputedRef<boolean>;
|
|
91
|
+
select: (value: string) => void;
|
|
92
|
+
isSelected: (value: string) => boolean;
|
|
93
|
+
isItemDisabled: (value: string) => boolean;
|
|
94
|
+
registerItem: (value: string, disabled: boolean, getElement: () => HTMLInputElement | null) => void;
|
|
95
|
+
setItemDisabled: (value: string, disabled: boolean) => void;
|
|
96
|
+
unregisterItem: (value: string) => void;
|
|
97
|
+
restoreItemDom: (value: string) => void;
|
|
98
|
+
registryVersion: Ref<number>;
|
|
99
|
+
}
|
|
100
|
+
export declare const ghostRadioGroupContextKey: InjectionKey<GhostRadioGroupContext>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/** Host for the scrollable root. Closed union; widening is additive. */
|
|
3
|
+
export type GhostScrollAreaElement = 'div';
|
|
4
|
+
/** Axes that may scroll when content exceeds the box. */
|
|
5
|
+
export type GhostScrollAreaOrientation = 'vertical' | 'horizontal' | 'both';
|
|
6
|
+
/** Native overflow mode on enabled axes. */
|
|
7
|
+
export type GhostScrollAreaOverflowType = 'auto' | 'scroll';
|
|
8
|
+
/** Runtime overflow measured on the root. */
|
|
9
|
+
export type GhostScrollAreaOverflowState = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
10
|
+
/** Props for the unstyled {@link GhostScrollArea} component. */
|
|
11
|
+
export interface GhostScrollAreaProps {
|
|
12
|
+
/**
|
|
13
|
+
* When the root is a tab stop with no inner focusables, sets `role="region"`
|
|
14
|
+
* and `aria-label`. Provide this whenever overflowed static content has no
|
|
15
|
+
* tab stops inside.
|
|
16
|
+
*/
|
|
17
|
+
label?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Which axes may scroll.
|
|
20
|
+
* @default 'vertical'
|
|
21
|
+
*/
|
|
22
|
+
orientation?: GhostScrollAreaOrientation;
|
|
23
|
+
/**
|
|
24
|
+
* Root host element.
|
|
25
|
+
* @default 'div'
|
|
26
|
+
*/
|
|
27
|
+
as?: GhostScrollAreaElement;
|
|
28
|
+
/**
|
|
29
|
+
* `auto` shows scrollbars when needed; `scroll` keeps scrollable overflow on
|
|
30
|
+
* enabled axes.
|
|
31
|
+
* @default 'auto'
|
|
32
|
+
*/
|
|
33
|
+
type?: GhostScrollAreaOverflowType;
|
|
34
|
+
}
|
|
35
|
+
/** Options for {@link useGhostScrollArea}. */
|
|
36
|
+
export interface UseGhostScrollAreaOptions {
|
|
37
|
+
as?: MaybeRefOrGetter<GhostScrollAreaElement | undefined>;
|
|
38
|
+
label?: MaybeRefOrGetter<string | undefined>;
|
|
39
|
+
orientation?: MaybeRefOrGetter<GhostScrollAreaOrientation | undefined>;
|
|
40
|
+
type?: MaybeRefOrGetter<GhostScrollAreaOverflowType | undefined>;
|
|
41
|
+
}
|
|
42
|
+
/** Exposed handle for {@link GhostScrollArea}. */
|
|
43
|
+
export interface GhostScrollAreaExposed {
|
|
44
|
+
/** Scrollable root element. */
|
|
45
|
+
get element(): HTMLElement | undefined;
|
|
46
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Component, ComputedRef, InjectionKey, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { GhostLinkElement } from './ghost-link.js';
|
|
3
|
+
/** Valid `as` targets for {@link GhostScrollSpy}. */
|
|
4
|
+
export type GhostScrollSpyElement = string | Component;
|
|
5
|
+
/** Valid `as` targets for {@link GhostScrollSpyList}. */
|
|
6
|
+
export type GhostScrollSpyListElement = string | Component;
|
|
7
|
+
/** Valid `as` targets for {@link GhostScrollSpyItem}. */
|
|
8
|
+
export type GhostScrollSpyItemElement = string | Component;
|
|
9
|
+
/** How URL hash is updated on plain link activation. */
|
|
10
|
+
export type GhostScrollSpyHistoryMode = 'replace' | 'push' | 'none';
|
|
11
|
+
/** Layout axis for the scroll spy navigation rail. */
|
|
12
|
+
export type GhostScrollSpyOrientation = 'vertical' | 'horizontal';
|
|
13
|
+
/** Scroll travel direction exposed on the root while the page is moving. */
|
|
14
|
+
export type GhostScrollSpyTravelDirection = 'down' | 'up';
|
|
15
|
+
/** Scroll container for measurement and programmatic scrolling. */
|
|
16
|
+
export type GhostScrollSpyContainer = HTMLElement | Window | null | undefined;
|
|
17
|
+
/** Props for {@link GhostScrollSpy}. */
|
|
18
|
+
export interface GhostScrollSpyProps {
|
|
19
|
+
/** Root landmark element. @default 'nav' */
|
|
20
|
+
as?: GhostScrollSpyElement;
|
|
21
|
+
/**
|
|
22
|
+
* Accessible name when neither `aria-label` nor `aria-labelledby` is passed
|
|
23
|
+
* through attrs.
|
|
24
|
+
* @default 'Page sections'
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Controlled active section id (without leading `#`). */
|
|
28
|
+
modelValue?: string | undefined;
|
|
29
|
+
/** Initial active section id in uncontrolled mode. */
|
|
30
|
+
defaultValue?: string | undefined;
|
|
31
|
+
/** @default 'vertical' */
|
|
32
|
+
orientation?: GhostScrollSpyOrientation;
|
|
33
|
+
/** Scroll container to observe. Defaults to the viewport (`window`). */
|
|
34
|
+
container?: GhostScrollSpyContainer;
|
|
35
|
+
/**
|
|
36
|
+
* Activation threshold as a fraction of viewport height, or pixels when
|
|
37
|
+
* `> 1` or `0`.
|
|
38
|
+
* @default 0.4
|
|
39
|
+
*/
|
|
40
|
+
probeOffset?: number;
|
|
41
|
+
/** @default 0.995 */
|
|
42
|
+
endThreshold?: number;
|
|
43
|
+
/** @default 'smooth' */
|
|
44
|
+
scrollBehavior?: ScrollBehavior;
|
|
45
|
+
/** @default 'replace' */
|
|
46
|
+
historyMode?: GhostScrollSpyHistoryMode;
|
|
47
|
+
/** @default true */
|
|
48
|
+
focusTarget?: boolean;
|
|
49
|
+
/** @default 180 */
|
|
50
|
+
travelSettleMs?: number;
|
|
51
|
+
}
|
|
52
|
+
/** Scoped slot props on {@link GhostScrollSpy}. */
|
|
53
|
+
export interface GhostScrollSpySlotProps {
|
|
54
|
+
activeId: string | undefined;
|
|
55
|
+
travelDirection: GhostScrollSpyTravelDirection | undefined;
|
|
56
|
+
itemCount: number;
|
|
57
|
+
scrollTo: (targetId: string, options?: {
|
|
58
|
+
behavior?: ScrollBehavior;
|
|
59
|
+
focus?: boolean;
|
|
60
|
+
}) => void;
|
|
61
|
+
}
|
|
62
|
+
/** Props for {@link GhostScrollSpyList}. */
|
|
63
|
+
export interface GhostScrollSpyListProps {
|
|
64
|
+
/** @default 'ol' */
|
|
65
|
+
as?: GhostScrollSpyListElement;
|
|
66
|
+
}
|
|
67
|
+
/** Props for {@link GhostScrollSpyItem}. */
|
|
68
|
+
export interface GhostScrollSpyItemProps {
|
|
69
|
+
/** @default 'li' */
|
|
70
|
+
as?: GhostScrollSpyItemElement;
|
|
71
|
+
}
|
|
72
|
+
/** Props for {@link GhostScrollSpyLink}. */
|
|
73
|
+
export interface GhostScrollSpyLinkProps {
|
|
74
|
+
/** Target section id (a leading `#` is stripped). */
|
|
75
|
+
target: string;
|
|
76
|
+
/** Native anchor href. @default `` `#${target}` `` */
|
|
77
|
+
href?: string;
|
|
78
|
+
/** Passed through to {@link GhostLink}. @default 'a' */
|
|
79
|
+
as?: GhostLinkElement;
|
|
80
|
+
/** @default false */
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/** Payload for the `activate` event on {@link GhostScrollSpy}. */
|
|
84
|
+
export interface GhostScrollSpyActivateDetail {
|
|
85
|
+
id: string;
|
|
86
|
+
element: HTMLElement | null;
|
|
87
|
+
event: MouseEvent | KeyboardEvent;
|
|
88
|
+
}
|
|
89
|
+
/** Methods and state exposed by {@link GhostScrollSpy}. */
|
|
90
|
+
export interface GhostScrollSpyExposed {
|
|
91
|
+
readonly element: HTMLElement | null;
|
|
92
|
+
readonly activeId: string | undefined;
|
|
93
|
+
scrollTo(targetId: string, options?: {
|
|
94
|
+
behavior?: ScrollBehavior;
|
|
95
|
+
focus?: boolean;
|
|
96
|
+
}): void;
|
|
97
|
+
measure(): void;
|
|
98
|
+
}
|
|
99
|
+
export interface GhostScrollSpyListExposed {
|
|
100
|
+
readonly element: HTMLElement | null;
|
|
101
|
+
}
|
|
102
|
+
export interface GhostScrollSpyItemExposed {
|
|
103
|
+
readonly element: HTMLElement | null;
|
|
104
|
+
}
|
|
105
|
+
export interface GhostScrollSpyLinkExposed {
|
|
106
|
+
readonly element: HTMLElement | null;
|
|
107
|
+
focus(options?: FocusOptions): void;
|
|
108
|
+
blur(): void;
|
|
109
|
+
}
|
|
110
|
+
export interface UseGhostScrollSpyOptions {
|
|
111
|
+
modelValue?: MaybeRefOrGetter<string | undefined>;
|
|
112
|
+
defaultValue?: MaybeRefOrGetter<string | undefined>;
|
|
113
|
+
onValueChange?: (id: string | undefined) => void;
|
|
114
|
+
orientation?: MaybeRefOrGetter<GhostScrollSpyOrientation | undefined>;
|
|
115
|
+
container?: MaybeRefOrGetter<GhostScrollSpyContainer>;
|
|
116
|
+
probeOffset?: MaybeRefOrGetter<number | undefined>;
|
|
117
|
+
endThreshold?: MaybeRefOrGetter<number | undefined>;
|
|
118
|
+
scrollBehavior?: MaybeRefOrGetter<ScrollBehavior | undefined>;
|
|
119
|
+
historyMode?: MaybeRefOrGetter<GhostScrollSpyHistoryMode | undefined>;
|
|
120
|
+
focusTarget?: MaybeRefOrGetter<boolean | undefined>;
|
|
121
|
+
travelSettleMs?: MaybeRefOrGetter<number | undefined>;
|
|
122
|
+
onActivate?: (detail: GhostScrollSpyActivateDetail) => void;
|
|
123
|
+
}
|
|
124
|
+
interface ScrollSpyRegistryEntry {
|
|
125
|
+
readonly id: symbol;
|
|
126
|
+
readonly target: string;
|
|
127
|
+
disabled: boolean;
|
|
128
|
+
getLinkElement: () => HTMLElement | null;
|
|
129
|
+
}
|
|
130
|
+
/** Context shared between {@link GhostScrollSpy} compound parts. */
|
|
131
|
+
export interface GhostScrollSpyContext {
|
|
132
|
+
readonly orientation: ComputedRef<GhostScrollSpyOrientation>;
|
|
133
|
+
readonly activeId: ComputedRef<string | undefined>;
|
|
134
|
+
isActive(target: string, registrationId?: symbol): boolean;
|
|
135
|
+
registerItem(id: symbol, target: string, disabled: boolean, getLinkElement: () => HTMLElement | null): void;
|
|
136
|
+
unregisterItem(id: symbol): void;
|
|
137
|
+
setItemDisabled(id: symbol, disabled: boolean): void;
|
|
138
|
+
handleActivate(detail: GhostScrollSpyActivateDetail): void;
|
|
139
|
+
}
|
|
140
|
+
export declare const ghostScrollSpyContextKey: InjectionKey<GhostScrollSpyContext>;
|
|
141
|
+
export type { ScrollSpyRegistryEntry };
|
|
142
|
+
/**
|
|
143
|
+
* Resolves a DOM element from either a raw element or a component ref
|
|
144
|
+
* (preferring exposed `.element` over `.$el`).
|
|
145
|
+
*/
|
|
146
|
+
export declare function resolveScrollSpyHtmlElement(target: unknown): HTMLElement | null;
|
|
147
|
+
/** Strips a leading `#` from fragment targets. */
|
|
148
|
+
export declare function normalizeScrollSpyTargetId(target: string): string;
|
|
149
|
+
/** Whether the activation should run scroll, hash, and focus side effects. */
|
|
150
|
+
export declare function isScrollSpyPlainActivation(event: MouseEvent | KeyboardEvent): boolean;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Component, ComputedRef, InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import type { TextDirection } from './use-roving-focus.js';
|
|
3
|
+
import { resolveToggleGroupHtmlElement } from './ghost-toggle-group.js';
|
|
4
|
+
/** Controlled value for {@link GhostSegmentedControl}. */
|
|
5
|
+
export type GhostSegmentedControlValue = string | undefined;
|
|
6
|
+
export type GhostSegmentedControlOrientation = 'horizontal' | 'vertical';
|
|
7
|
+
/** Valid `as` targets for {@link GhostSegmentedControl}. */
|
|
8
|
+
export type GhostSegmentedControlElement = string | Component;
|
|
9
|
+
/** Valid `as` targets for {@link GhostSegmentedControlItem}. */
|
|
10
|
+
export type GhostSegmentedControlItemElement = string | Component;
|
|
11
|
+
/** Props for the {@link GhostSegmentedControl} root. */
|
|
12
|
+
export interface GhostSegmentedControlProps {
|
|
13
|
+
/**
|
|
14
|
+
* Controlled selection. Omit for uncontrolled mode.
|
|
15
|
+
* @default undefined
|
|
16
|
+
*/
|
|
17
|
+
modelValue?: GhostSegmentedControlValue;
|
|
18
|
+
/**
|
|
19
|
+
* Initial selection when `modelValue` is omitted.
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
defaultValue?: GhostSegmentedControlValue;
|
|
23
|
+
/**
|
|
24
|
+
* Layout for roving arrow keys, indicator slide axis, and optional
|
|
25
|
+
* `aria-orientation`.
|
|
26
|
+
* @default 'horizontal'
|
|
27
|
+
*/
|
|
28
|
+
orientation?: GhostSegmentedControlOrientation;
|
|
29
|
+
/** Explicit text direction for horizontal roving focus. */
|
|
30
|
+
dir?: TextDirection;
|
|
31
|
+
/**
|
|
32
|
+
* Root host element. Must not be interactive itself.
|
|
33
|
+
* @default 'div'
|
|
34
|
+
*/
|
|
35
|
+
as?: GhostSegmentedControlElement;
|
|
36
|
+
/**
|
|
37
|
+
* Disables toggling for every item.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* When false, pressing the active segment keeps it selected.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
deselectable?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Props for {@link GhostSegmentedControlItem}. */
|
|
48
|
+
export interface GhostSegmentedControlItemProps {
|
|
49
|
+
/**
|
|
50
|
+
* Tag name or component for the segment control.
|
|
51
|
+
* @default 'button'
|
|
52
|
+
*/
|
|
53
|
+
as?: GhostSegmentedControlItemElement;
|
|
54
|
+
/** Stable value identifying this item in the group model. */
|
|
55
|
+
value: string;
|
|
56
|
+
/**
|
|
57
|
+
* Disables this item and removes it from roving focus.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** Methods and state exposed by a template ref to {@link GhostSegmentedControl}. */
|
|
63
|
+
export interface GhostSegmentedControlExposed {
|
|
64
|
+
readonly element: HTMLElement | null;
|
|
65
|
+
focus(options?: FocusOptions): void;
|
|
66
|
+
blur(): void;
|
|
67
|
+
}
|
|
68
|
+
/** Methods and state exposed by a template ref to {@link GhostSegmentedControlItem}. */
|
|
69
|
+
export interface GhostSegmentedControlItemExposed {
|
|
70
|
+
readonly element: HTMLElement | null;
|
|
71
|
+
focus(options?: FocusOptions): void;
|
|
72
|
+
blur(): void;
|
|
73
|
+
}
|
|
74
|
+
/** Options for {@link useGhostSegmentedControl}. */
|
|
75
|
+
export interface UseGhostSegmentedControlOptions {
|
|
76
|
+
modelValue?: MaybeRefOrGetter<GhostSegmentedControlValue>;
|
|
77
|
+
defaultValue?: MaybeRefOrGetter<GhostSegmentedControlValue>;
|
|
78
|
+
orientation?: MaybeRefOrGetter<GhostSegmentedControlOrientation>;
|
|
79
|
+
dir?: MaybeRefOrGetter<TextDirection | undefined>;
|
|
80
|
+
disabled?: MaybeRefOrGetter<boolean>;
|
|
81
|
+
deselectable?: MaybeRefOrGetter<boolean>;
|
|
82
|
+
onValueChange?: (value: GhostSegmentedControlValue) => void;
|
|
83
|
+
}
|
|
84
|
+
/** Reactive state and helpers returned by {@link useGhostSegmentedControl}. */
|
|
85
|
+
export interface UseGhostSegmentedControlReturn {
|
|
86
|
+
modelValue: Ref<GhostSegmentedControlValue>;
|
|
87
|
+
orientation: ComputedRef<GhostSegmentedControlOrientation>;
|
|
88
|
+
dir: ComputedRef<TextDirection | undefined>;
|
|
89
|
+
groupDisabled: ComputedRef<boolean>;
|
|
90
|
+
deselectable: ComputedRef<boolean>;
|
|
91
|
+
isPressed: (value: string) => boolean;
|
|
92
|
+
toggle: (value: string) => void;
|
|
93
|
+
registerItem: (value: string, disabled: boolean) => void;
|
|
94
|
+
setItemDisabled: (value: string, disabled: boolean) => void;
|
|
95
|
+
unregisterItem: (value: string) => void;
|
|
96
|
+
tabStopValue: ComputedRef<string | undefined>;
|
|
97
|
+
registryVersion: Ref<number>;
|
|
98
|
+
/** Registration order of item values (SSR-safe indicator index). */
|
|
99
|
+
itemOrder: Ref<string[]>;
|
|
100
|
+
/** Selected index in `itemOrder`, or `-1` when none. */
|
|
101
|
+
selectedIndex: ComputedRef<number>;
|
|
102
|
+
itemCount: ComputedRef<number>;
|
|
103
|
+
/** Align `itemOrder` with DOM after mount; no-op when DOM has no items. */
|
|
104
|
+
reconcileItemOrderFromDom: (root: HTMLElement) => void;
|
|
105
|
+
}
|
|
106
|
+
/** Internal context shared between segmented control parts. */
|
|
107
|
+
export interface GhostSegmentedControlContext {
|
|
108
|
+
modelValue: Ref<GhostSegmentedControlValue>;
|
|
109
|
+
orientation: ComputedRef<GhostSegmentedControlOrientation>;
|
|
110
|
+
dir: ComputedRef<TextDirection | undefined>;
|
|
111
|
+
groupDisabled: ComputedRef<boolean>;
|
|
112
|
+
isPressed: (value: string) => boolean;
|
|
113
|
+
toggle: (value: string) => void;
|
|
114
|
+
registerItem: (value: string, disabled: boolean) => void;
|
|
115
|
+
setItemDisabled: (value: string, disabled: boolean) => void;
|
|
116
|
+
unregisterItem: (value: string) => void;
|
|
117
|
+
tabStopValue: ComputedRef<string | undefined>;
|
|
118
|
+
registryVersion: Ref<number>;
|
|
119
|
+
itemCount: ComputedRef<number>;
|
|
120
|
+
selectedIndex: ComputedRef<number>;
|
|
121
|
+
syncSelectionTabStops: (groupRoot: HTMLElement) => void;
|
|
122
|
+
}
|
|
123
|
+
export declare const ghostSegmentedControlContextKey: InjectionKey<GhostSegmentedControlContext>;
|
|
124
|
+
export { resolveToggleGroupHtmlElement as resolveSegmentedControlHtmlElement };
|