@ghostvue/vue 0.0.0-stage → 0.1.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/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 +28 -0
- package/dist/GhostFieldControl.vue.d.ts +13 -0
- package/dist/GhostFieldDescription.vue.d.ts +21 -0
- package/dist/GhostFieldError.vue.d.ts +21 -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/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/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 +51 -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 +17 -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/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/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 +143 -0
- package/dist/dialog-shared.d.ts +169 -0
- package/dist/dismissable-layer-stack.d.ts +27 -0
- package/dist/form-reset.d.ts +21 -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.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 +254 -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 +151 -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-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-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 +131 -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-switch.d.ts +77 -0
- package/dist/ghost-table.d.ts +62 -0
- package/dist/ghost-tabs.d.ts +154 -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 +37 -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 +17534 -0
- package/dist/has-tabbable-descendants.d.ts +2 -0
- package/dist/index.d.ts +307 -0
- package/dist/invoke-attr-handler.d.ts +15 -0
- package/dist/is-ime-composing.d.ts +28 -0
- package/dist/manifest.json +17098 -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/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 +40 -0
- package/dist/use-floating.d.ts +38 -0
- package/dist/use-focus-scope.d.ts +34 -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.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-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-collection.d.ts +19 -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-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 +52 -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 +20 -0
- package/dist/use-scroll-lock.d.ts +13 -0
- package/package.json +59 -4
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { DataTableCellContext, DataTableColumnDef } from './ghost-data-table.js';
|
|
3
|
+
/**
|
|
4
|
+
* Cell context for a column built with {@link defineDataTableColumns}. Same
|
|
5
|
+
* fields as {@link DataTableCellContext}, plus `value` and a typed `getValue`.
|
|
6
|
+
*/
|
|
7
|
+
export type DataTableTypedCellContext<TData, TValue> = Omit<DataTableCellContext<TData>, 'getValue'> & {
|
|
8
|
+
/** This cell's value, read once from the column accessor. */
|
|
9
|
+
value: TValue;
|
|
10
|
+
/** Returns {@link DataTableTypedCellContext.value}. */
|
|
11
|
+
getValue: () => TValue;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Column options for {@link DataTableColumnHelper.accessorKey}. `id` defaults
|
|
15
|
+
* to the key.
|
|
16
|
+
*
|
|
17
|
+
* `accessorFn` is omitted on purpose: at runtime an `accessorFn` wins over
|
|
18
|
+
* `accessorKey`, so allowing both would make the typed `value` lie. Use
|
|
19
|
+
* {@link DataTableColumnHelper.accessorFn} for derived values.
|
|
20
|
+
*/
|
|
21
|
+
export type DataTableAccessorKeyColumn<TData, K extends keyof TData & string> = Omit<DataTableColumnDef<TData>, 'accessorKey' | 'accessorFn' | 'id' | 'cell'> & {
|
|
22
|
+
/** @default the accessor key */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** Render hook with the typed value of `row[key]`. */
|
|
25
|
+
cell?: (context: DataTableTypedCellContext<TData, TData[K]>) => VNodeChild;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Column options for {@link DataTableColumnHelper.accessorFn}. The column
|
|
29
|
+
* value type is inferred from the `accessorFn` return type. `accessorKey` is
|
|
30
|
+
* omitted because `accessorFn` would shadow it at runtime.
|
|
31
|
+
*/
|
|
32
|
+
export type DataTableAccessorFnColumn<TData, TValue> = Omit<DataTableColumnDef<TData>, 'accessorKey' | 'accessorFn' | 'id' | 'cell'> & {
|
|
33
|
+
accessorFn: (row: TData, index: number) => TValue;
|
|
34
|
+
/** Render hook with the typed `accessorFn` result. */
|
|
35
|
+
cell?: (context: DataTableTypedCellContext<TData, TValue>) => VNodeChild;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Column returned by {@link DataTableColumnHelper.accessorKey}: a plain
|
|
39
|
+
* {@link DataTableColumnDef} whose `id` and `accessorKey` keep their literal
|
|
40
|
+
* types. `TId` is the key unless the options set their own `id`; with a custom
|
|
41
|
+
* id the type is `TId | K`, a harmless superset of the runtime id.
|
|
42
|
+
*/
|
|
43
|
+
export type DataTableAccessorKeyColumnDef<TData, K extends keyof TData & string, TId extends string = K> = DataTableColumnDef<TData> & {
|
|
44
|
+
id: TId | K;
|
|
45
|
+
accessorKey: K;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Column returned by {@link DataTableColumnHelper.accessorFn}: a plain
|
|
49
|
+
* {@link DataTableColumnDef} whose `id` is the literal id and whose
|
|
50
|
+
* `accessorFn` keeps its return type.
|
|
51
|
+
*/
|
|
52
|
+
export type DataTableAccessorFnColumnDef<TData, TValue, TId extends string = string> = DataTableColumnDef<TData> & {
|
|
53
|
+
id: TId;
|
|
54
|
+
accessorFn: (row: TData, index: number) => TValue;
|
|
55
|
+
};
|
|
56
|
+
/** Builders returned by {@link defineDataTableColumns}. */
|
|
57
|
+
export interface DataTableColumnHelper<TData> {
|
|
58
|
+
/**
|
|
59
|
+
* Column that reads `row[key]`. `key` must be a string key of `TData`, so
|
|
60
|
+
* renaming the row property breaks the definition at compile time.
|
|
61
|
+
*/
|
|
62
|
+
accessorKey: <K extends keyof TData & string, TId extends string = K>(key: K, column: DataTableAccessorKeyColumn<TData, K> & {
|
|
63
|
+
id?: TId;
|
|
64
|
+
}) => DataTableAccessorKeyColumnDef<TData, K, TId>;
|
|
65
|
+
/** Column whose value comes from `accessorFn`. `id` is required. */
|
|
66
|
+
accessorFn: <TValue, TId extends string = string>(id: TId, column: DataTableAccessorFnColumn<TData, TValue>) => DataTableAccessorFnColumnDef<TData, TValue, TId>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Typed column factory for DataTable. Pass the row type once; each builder
|
|
70
|
+
* infers the column's value type so `cell` receives a typed `value` and
|
|
71
|
+
* `getValue()`:
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* const columns = defineDataTableColumns<Invoice>()
|
|
75
|
+
* const defs = [
|
|
76
|
+
* columns.accessorKey('amount', {
|
|
77
|
+
* header: 'Amount',
|
|
78
|
+
* cell: ({ value }) => `${value.toFixed(2)} USD`,
|
|
79
|
+
* }),
|
|
80
|
+
* ]
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* Holds no state and does not touch Vue reactivity. Each builder returns a
|
|
84
|
+
* new {@link DataTableColumnDef} and never mutates the options object.
|
|
85
|
+
* Generic contexts (for example `getBodyCellContext` in the `GhostDataTable`
|
|
86
|
+
* slot) still type `getValue()` as `unknown`, because one column array mixes
|
|
87
|
+
* value types.
|
|
88
|
+
*/
|
|
89
|
+
export declare function defineDataTableColumns<TData>(): DataTableColumnHelper<TData>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export type GhostCodeLevel = 'warn' | 'error';
|
|
2
|
+
export interface GhostCodeEntry {
|
|
3
|
+
readonly level: GhostCodeLevel;
|
|
4
|
+
readonly title: string;
|
|
5
|
+
/**
|
|
6
|
+
* Runtime message. `{name}` placeholders are replaced by `logGhostCode`
|
|
7
|
+
* replacements; unknown placeholders are left unchanged.
|
|
8
|
+
*/
|
|
9
|
+
readonly message: string;
|
|
10
|
+
/** Markdown path relative to `docs/warnings.md`. */
|
|
11
|
+
readonly relatedDocs?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RetiredGhostCodeEntry {
|
|
14
|
+
readonly reason: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Canonical public URL for the diagnostic catalog. Console messages link here
|
|
18
|
+
* until a hosted docs origin exists.
|
|
19
|
+
*/
|
|
20
|
+
export declare const GHOST_CODE_DOCS_URL = "https://github.com/zprue743/ghostvue/blob/master/docs/warnings.md";
|
|
21
|
+
/**
|
|
22
|
+
* Assigned development diagnostic codes. Keys are stable public identifiers and
|
|
23
|
+
* must never be reused. Retire a code in `retiredGhostCodes` instead of deleting
|
|
24
|
+
* it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ghostCodes: {
|
|
27
|
+
readonly GHOST001: {
|
|
28
|
+
readonly level: "warn";
|
|
29
|
+
readonly title: "Controlled and uncontrolled state mixed";
|
|
30
|
+
readonly message: "A component switched from {from} to {to}. Pass the value prop for the lifetime of the instance, or omit it and use default*.";
|
|
31
|
+
readonly relatedDocs: "./architecture/component-state.md";
|
|
32
|
+
};
|
|
33
|
+
readonly GHOST002: {
|
|
34
|
+
readonly level: "warn";
|
|
35
|
+
readonly title: "Dialog content missing accessible name";
|
|
36
|
+
readonly message: "GhostDialogContent, GhostDrawerContent, and GhostCommandPaletteContent require an accessible name. Render GhostDialogTitle, GhostDrawerTitle, or GhostCommandPaletteTitle inside the content, or pass aria-label or aria-labelledby.";
|
|
37
|
+
readonly relatedDocs: "./components/dialog.md";
|
|
38
|
+
};
|
|
39
|
+
readonly GHOST003: {
|
|
40
|
+
readonly level: "warn";
|
|
41
|
+
readonly title: "Alert dialog missing description";
|
|
42
|
+
readonly message: "GhostDialogContent or GhostDrawerContent with role=\"alertdialog\" should provide a description. Render GhostDialogDescription or GhostDrawerDescription inside the content, or pass aria-describedby.";
|
|
43
|
+
readonly relatedDocs: "./components/dialog.md";
|
|
44
|
+
};
|
|
45
|
+
readonly GHOST004: {
|
|
46
|
+
readonly level: "warn";
|
|
47
|
+
readonly title: "DatePicker format callback threw";
|
|
48
|
+
readonly message: "The GhostDatePicker format callback threw for {date}. The input shows the ISO YYYY-MM-DD text instead. Make format synchronous, pure, and total for valid CalendarDate values.";
|
|
49
|
+
readonly relatedDocs: "./components/date-picker.md";
|
|
50
|
+
};
|
|
51
|
+
readonly GHOST005: {
|
|
52
|
+
readonly level: "warn";
|
|
53
|
+
readonly title: "Deprecated API used";
|
|
54
|
+
readonly message: "{api} is deprecated since {since} and will be removed in {removal}. {migration}";
|
|
55
|
+
readonly relatedDocs: "./standards/component-stability.md";
|
|
56
|
+
};
|
|
57
|
+
readonly GHOST006: {
|
|
58
|
+
readonly level: "warn";
|
|
59
|
+
readonly title: "Toast created during server rendering";
|
|
60
|
+
readonly message: "toast() ran during server-side rendering and was ignored. The server never queues toasts; call toast() from client code such as onMounted or an event handler.";
|
|
61
|
+
readonly relatedDocs: "./components/toast.md";
|
|
62
|
+
};
|
|
63
|
+
readonly GHOST007: {
|
|
64
|
+
readonly level: "warn";
|
|
65
|
+
readonly title: "Toast duration ignored";
|
|
66
|
+
readonly message: "duration is ignored on toast \"{id}\" because {reason} toasts persist until dismissed. Remove duration, or make the toast informational.";
|
|
67
|
+
readonly relatedDocs: "./components/toast.md";
|
|
68
|
+
};
|
|
69
|
+
readonly GHOST008: {
|
|
70
|
+
readonly level: "warn";
|
|
71
|
+
readonly title: "Invalid toast option";
|
|
72
|
+
readonly message: "{option} {value} is invalid; expected {expected}. Using {fallback} instead.";
|
|
73
|
+
readonly relatedDocs: "./components/toast.md";
|
|
74
|
+
};
|
|
75
|
+
readonly GHOST009: {
|
|
76
|
+
readonly level: "warn";
|
|
77
|
+
readonly title: "Toast id uses the reserved prefix";
|
|
78
|
+
readonly message: "Toast id \"{id}\" starts with the generated-id prefix \"{prefix}\". It is treated as an update of an existing toast only; omit id for a generated one or choose another explicit id.";
|
|
79
|
+
readonly relatedDocs: "./components/toast.md";
|
|
80
|
+
};
|
|
81
|
+
readonly GHOST010: {
|
|
82
|
+
readonly level: "warn";
|
|
83
|
+
readonly title: "Many toasts waiting";
|
|
84
|
+
readonly message: "{count} toasts are waiting behind the visible stack. Check for runaway toast() calls, and reuse an id to update a toast in place.";
|
|
85
|
+
readonly relatedDocs: "./components/toast.md";
|
|
86
|
+
};
|
|
87
|
+
readonly GHOST011: {
|
|
88
|
+
readonly level: "warn";
|
|
89
|
+
readonly title: "Toast without a title";
|
|
90
|
+
readonly message: "toast() and update() need a non-empty title. The {call} call was ignored.";
|
|
91
|
+
readonly relatedDocs: "./components/toast.md";
|
|
92
|
+
};
|
|
93
|
+
readonly GHOST012: {
|
|
94
|
+
readonly level: "warn";
|
|
95
|
+
readonly title: "Duplicate command palette item id";
|
|
96
|
+
readonly message: "Two GhostCommandPaletteItem components in one palette use the id \"{id}\". Give every command a unique, stable id; duplicates share one highlight and registry entry.";
|
|
97
|
+
readonly relatedDocs: "./components/command-palette.md";
|
|
98
|
+
};
|
|
99
|
+
readonly GHOST013: {
|
|
100
|
+
readonly level: "warn";
|
|
101
|
+
readonly title: "Duplicate scroll spy target";
|
|
102
|
+
readonly message: "Two GhostScrollSpyLink components in one GhostScrollSpy use the target \"{target}\". Each section id should appear once. Duplicate registrations resolve to the first enabled link in DOM order.";
|
|
103
|
+
readonly relatedDocs: "./components/scroll-spy.md";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Formerly assigned codes. Kept so the number cannot be given to a new meaning.
|
|
108
|
+
*/
|
|
109
|
+
export declare const retiredGhostCodes: Readonly<Record<string, RetiredGhostCodeEntry>>;
|
|
110
|
+
export type GhostCode = keyof typeof ghostCodes;
|
|
111
|
+
export declare function ghostCodeDocsUrl(code: GhostCode): string;
|
|
112
|
+
export declare function formatGhostCodeMessage(code: GhostCode, replacements?: Readonly<Record<string, string>>): string;
|
|
113
|
+
/**
|
|
114
|
+
* Emits a coded diagnostic. Callers must wrap this in
|
|
115
|
+
* `process.env.NODE_ENV !== 'production'` so consumer bundlers can strip both
|
|
116
|
+
* the call and these strings. `import.meta.env.DEV` would be baked by the
|
|
117
|
+
* library build.
|
|
118
|
+
*/
|
|
119
|
+
export declare function logGhostCode(code: GhostCode, replacements?: Readonly<Record<string, string>>): void;
|
|
120
|
+
/**
|
|
121
|
+
* One deprecation notice. Every field is consumer-facing text in the GHOST005
|
|
122
|
+
* message, so `migration` names the replacement and how to move to it.
|
|
123
|
+
*/
|
|
124
|
+
export interface GhostDeprecation {
|
|
125
|
+
/** The deprecated API, e.g. `GhostFoo prop "size"` or `GhostFoo`. */
|
|
126
|
+
readonly api: string;
|
|
127
|
+
/** Package version that first deprecated it, e.g. `0.4.0`. */
|
|
128
|
+
readonly since: string;
|
|
129
|
+
/**
|
|
130
|
+
* Earliest release that may remove it: a minor before 1.0 and a major from
|
|
131
|
+
* 1.0 onward, at least one minor release and 30 days after `since`.
|
|
132
|
+
*/
|
|
133
|
+
readonly removal: string;
|
|
134
|
+
/** Replacement and migration steps. */
|
|
135
|
+
readonly migration: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Reports deprecated API use with GHOST005, once per `api` per JavaScript
|
|
139
|
+
* realm. This is the only sanctioned deprecation warning; see
|
|
140
|
+
* docs/standards/component-stability.md. Callers must wrap it in
|
|
141
|
+
* `process.env.NODE_ENV !== 'production'` like `logGhostCode`.
|
|
142
|
+
*/
|
|
143
|
+
export declare function warnGhostDeprecation(deprecation: GhostDeprecation): void;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal compound-dialog part mechanics shared by `GhostDialog*` and
|
|
3
|
+
* `GhostDrawer*`.
|
|
4
|
+
*
|
|
5
|
+
* Both families implement the same APG Dialog (Modal) contract: controllable
|
|
6
|
+
* open state, deterministic part IDs, trigger/close activation, modal overlay,
|
|
7
|
+
* and a content surface composing `useScrollLock`, `useInertOthers`,
|
|
8
|
+
* `useDismissableLayer`, and `useFocusScope`. Keeping one implementation here
|
|
9
|
+
* prevents the focus, dismissal, scroll-lock, and background-isolation logic
|
|
10
|
+
* from drifting between the two families (GHO-91).
|
|
11
|
+
*
|
|
12
|
+
* This module is intentionally not exported from the public barrel. Each family
|
|
13
|
+
* provides the context returned by {@link createDialogPartsContext} under its own
|
|
14
|
+
* injection key (`ghostDialogContextKey` vs `ghostDrawerContextKey`) so a
|
|
15
|
+
* `GhostDialog` nested inside a `GhostDrawer` (or vice versa) never resolves the
|
|
16
|
+
* wrong ancestor through `provide` / `inject`.
|
|
17
|
+
*/
|
|
18
|
+
import { type ComputedRef, type InjectionKey, type MaybeRefOrGetter, type Ref, type ShallowRef } from 'vue';
|
|
19
|
+
import type { GhostDialogContentRole, GhostDialogContext } from './ghost-dialog.js';
|
|
20
|
+
import type { GhostPortalTarget } from './ghost-portal.js';
|
|
21
|
+
/**
|
|
22
|
+
* Context shared by every compound dialog part. Structurally identical to the
|
|
23
|
+
* public `GhostDialogContext` plus the internal `openedAtMount` flag used by
|
|
24
|
+
* non-modal autofocus.
|
|
25
|
+
*/
|
|
26
|
+
export type DialogPartsContext = GhostDialogContext & {
|
|
27
|
+
openedAtMount: Ref<boolean>;
|
|
28
|
+
};
|
|
29
|
+
/** Ref contract every part exposes through `defineExpose`. */
|
|
30
|
+
export interface DialogPartExposed {
|
|
31
|
+
readonly element: HTMLElement | null;
|
|
32
|
+
focus(options?: FocusOptions): void;
|
|
33
|
+
blur(): void;
|
|
34
|
+
}
|
|
35
|
+
/** Options accepted by {@link useDialogState}. */
|
|
36
|
+
export interface UseDialogStateOptions {
|
|
37
|
+
open?: MaybeRefOrGetter<boolean | undefined>;
|
|
38
|
+
defaultOpen?: MaybeRefOrGetter<boolean | undefined>;
|
|
39
|
+
modal?: MaybeRefOrGetter<boolean | undefined>;
|
|
40
|
+
onOpenChange?: (open: boolean) => void;
|
|
41
|
+
}
|
|
42
|
+
/** Return value of {@link useDialogState}. */
|
|
43
|
+
export interface UseDialogStateReturn {
|
|
44
|
+
isOpen: Ref<boolean>;
|
|
45
|
+
isModal: ComputedRef<boolean>;
|
|
46
|
+
open: () => void;
|
|
47
|
+
close: () => void;
|
|
48
|
+
toggle: () => void;
|
|
49
|
+
triggerId: ComputedRef<string>;
|
|
50
|
+
contentId: ComputedRef<string>;
|
|
51
|
+
titleId: ComputedRef<string>;
|
|
52
|
+
descriptionId: ComputedRef<string>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Controllable open state, modal flag, and deterministic SSR-safe IDs.
|
|
56
|
+
*
|
|
57
|
+
* `idPrefix` keeps generated IDs readable per family (`ghost-dialog-*` vs
|
|
58
|
+
* `ghost-drawer-*`); uniqueness still comes from `useGhostId`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function useDialogState(options: UseDialogStateOptions, idPrefix: string): UseDialogStateReturn;
|
|
61
|
+
/**
|
|
62
|
+
* Builds the root context provided to compound parts. Must run during the
|
|
63
|
+
* root component's `setup`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createDialogPartsContext(state: UseDialogStateReturn): DialogPartsContext;
|
|
66
|
+
/**
|
|
67
|
+
* Injects a family context or throws a consumer-facing error naming both the
|
|
68
|
+
* part and its required root.
|
|
69
|
+
*/
|
|
70
|
+
export declare function injectDialogPartsContext<T extends DialogPartsContext>(key: InjectionKey<T>, partName: string, rootName: string): T;
|
|
71
|
+
/**
|
|
72
|
+
* Resolves a DOM element from either a raw element or a component ref
|
|
73
|
+
* (preferring exposed `.element` over `.$el` so wrappers like themed
|
|
74
|
+
* `GhostButton` with a `display: contents` scope resolve to their inner control).
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveDialogHtmlElement(target: unknown): HTMLElement | null;
|
|
77
|
+
/** Builds the `{ element, focus, blur }` ref contract for one part. */
|
|
78
|
+
export declare function createDialogPartExposed(element: () => HTMLElement | null): DialogPartExposed;
|
|
79
|
+
type ExtraAttrs = () => Record<string, unknown>;
|
|
80
|
+
/** Props shared by button-like parts (Trigger and Close). */
|
|
81
|
+
interface DialogButtonPartProps {
|
|
82
|
+
as: unknown;
|
|
83
|
+
disabled: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** Trigger part: opens/toggles the dialog and registers its id and element. */
|
|
86
|
+
export declare function useDialogTriggerPart(context: DialogPartsContext, props: DialogButtonPartProps, hostRef: Readonly<ShallowRef<unknown>>, options?: {
|
|
87
|
+
haspopup?: string;
|
|
88
|
+
extraAttrs?: ExtraAttrs;
|
|
89
|
+
}): {
|
|
90
|
+
triggerAttrs: ComputedRef<{
|
|
91
|
+
id: string;
|
|
92
|
+
'aria-haspopup': string;
|
|
93
|
+
'aria-expanded': string;
|
|
94
|
+
'aria-controls': string;
|
|
95
|
+
'data-part': string;
|
|
96
|
+
'data-state': string;
|
|
97
|
+
}>;
|
|
98
|
+
onClick: (event: MouseEvent) => void;
|
|
99
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
100
|
+
exposed: DialogPartExposed;
|
|
101
|
+
};
|
|
102
|
+
/** Close part: closes the enclosing dialog on click or keyboard activation. */
|
|
103
|
+
export declare function useDialogClosePart(context: DialogPartsContext, props: DialogButtonPartProps, hostRef: Readonly<ShallowRef<unknown>>): {
|
|
104
|
+
closeAttrs: ComputedRef<{
|
|
105
|
+
'data-part': string;
|
|
106
|
+
}>;
|
|
107
|
+
onClick: (event: MouseEvent) => void;
|
|
108
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
109
|
+
exposed: DialogPartExposed;
|
|
110
|
+
};
|
|
111
|
+
/** Overlay part: modal-only backdrop that stays non-inert while open. */
|
|
112
|
+
export declare function useDialogOverlayPart(context: DialogPartsContext, hostRef: Readonly<ShallowRef<unknown>>, options?: {
|
|
113
|
+
extraAttrs?: ExtraAttrs;
|
|
114
|
+
}): {
|
|
115
|
+
attrs: import("vue").Attrs;
|
|
116
|
+
visible: ComputedRef<boolean>;
|
|
117
|
+
overlayAttrs: ComputedRef<{
|
|
118
|
+
'aria-hidden': string;
|
|
119
|
+
'data-part': string;
|
|
120
|
+
'data-state': string;
|
|
121
|
+
}>;
|
|
122
|
+
exposed: DialogPartExposed;
|
|
123
|
+
};
|
|
124
|
+
/** Title or Description part: registers its id for automatic ARIA linking. */
|
|
125
|
+
export declare function useDialogLabelPart(context: DialogPartsContext, kind: 'title' | 'description', hostRef: Readonly<ShallowRef<unknown>>): {
|
|
126
|
+
labelAttrs: ComputedRef<{
|
|
127
|
+
id: string;
|
|
128
|
+
'data-part': "title" | "description";
|
|
129
|
+
}>;
|
|
130
|
+
exposed: DialogPartExposed;
|
|
131
|
+
};
|
|
132
|
+
/** Props consumed by {@link useDialogContentPart}. */
|
|
133
|
+
export interface DialogContentPartProps {
|
|
134
|
+
role: GhostDialogContentRole;
|
|
135
|
+
closeOnEscape: boolean;
|
|
136
|
+
closeOnOutsideClick: boolean | undefined;
|
|
137
|
+
portal: boolean;
|
|
138
|
+
portalTo: GhostPortalTarget;
|
|
139
|
+
/**
|
|
140
|
+
* Focus-entry hooks exposed by `GhostDialogContent` (GHO-209). Optional so
|
|
141
|
+
* `GhostDrawerContent`, which does not expose them, keeps the defaults.
|
|
142
|
+
*/
|
|
143
|
+
focusReady?: boolean;
|
|
144
|
+
initialFocus?: (() => HTMLElement | null) | undefined;
|
|
145
|
+
returnFocus?: (() => HTMLElement | null) | undefined;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Content part: the dialog surface. Composes scroll lock, background inert,
|
|
149
|
+
* dismissable layer, and focus scope, links Title/Description, and emits
|
|
150
|
+
* `GHOST002` / `GHOST003` development diagnostics.
|
|
151
|
+
*
|
|
152
|
+
* `extraAttrs` lets a family add its own hooks (for example the drawer's
|
|
153
|
+
* `data-side` / `data-dir`). They are applied after consumer attrs and before
|
|
154
|
+
* the ARIA relationships, so they cannot override role or labelling.
|
|
155
|
+
*
|
|
156
|
+
* `suppressRestoreFocus` lets a family close without restoring focus when the
|
|
157
|
+
* user already moved focus elsewhere (the non-modal command palette's focus
|
|
158
|
+
* departure, GHO-166). Dialog and Drawer do not pass it.
|
|
159
|
+
*/
|
|
160
|
+
export declare function useDialogContentPart(context: DialogPartsContext, props: DialogContentPartProps, hostRef: Readonly<ShallowRef<unknown>>, options?: {
|
|
161
|
+
extraAttrs?: ExtraAttrs;
|
|
162
|
+
suppressRestoreFocus?: () => boolean;
|
|
163
|
+
}): {
|
|
164
|
+
attrs: import("vue").Attrs;
|
|
165
|
+
contentElement: ComputedRef<HTMLElement | null>;
|
|
166
|
+
contentAttrs: ComputedRef<Record<string, unknown>>;
|
|
167
|
+
exposed: DialogPartExposed;
|
|
168
|
+
};
|
|
169
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal module-level stack of active dismissable layers (per copy of
|
|
3
|
+
* `@ghostvue/vue`). Shared between `useDismissableLayer` and `useFocusScope`
|
|
4
|
+
* without a circular import or new public exports.
|
|
5
|
+
*/
|
|
6
|
+
export interface DismissableLayerEntry {
|
|
7
|
+
readonly id: symbol;
|
|
8
|
+
readonly element: HTMLElement;
|
|
9
|
+
/**
|
|
10
|
+
* Escape-only layers (such as an open tooltip) take part in `Escape`
|
|
11
|
+
* ordering but never in outside-pointer dismissal or focus ownership, so they
|
|
12
|
+
* cannot block or steal those interactions from the layers beneath them.
|
|
13
|
+
*/
|
|
14
|
+
readonly escapeOnly?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function pushDismissableLayer(entry: DismissableLayerEntry): void;
|
|
17
|
+
export declare function removeDismissableLayer(entry: DismissableLayerEntry): void;
|
|
18
|
+
export declare function getTopDismissableLayer(): DismissableLayerEntry | undefined;
|
|
19
|
+
/** Active layers ordered bottom to top. Read-only view of the live stack. */
|
|
20
|
+
export declare function getDismissableLayers(): readonly DismissableLayerEntry[];
|
|
21
|
+
export declare function hasDismissableLayers(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns `true` when `activeElement` sits inside a dismissable layer stacked
|
|
24
|
+
* above the layer owning `scopeRoot`. Used by a trapped `useFocusScope` to
|
|
25
|
+
* ignore `Tab` while focus lives inside a portaled popover opened from the modal.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isFocusInUpperDismissableLayer(scopeRoot: HTMLElement, activeElement: Element | null): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schedules reconciliation after the `reset` event has fully dispatched so
|
|
3
|
+
* `defaultPrevented` is final (including listeners on `document` and `window`
|
|
4
|
+
* registered after the library listener).
|
|
5
|
+
*
|
|
6
|
+
* Uses a macrotask (`setTimeout(0)`), not a microtask: after each listener the
|
|
7
|
+
* engine can drain microtasks while dispatch is still in progress (for example
|
|
8
|
+
* when reset comes from a real reset-button click). A microtask checkpoint can
|
|
9
|
+
* run before a later `window` listener calls `preventDefault`; a task runs only
|
|
10
|
+
* after the whole dispatch finishes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function afterNativeFormReset(event: Event, apply: () => void): () => void;
|
|
13
|
+
/** Awaits the macrotask scheduled by {@link afterNativeFormReset} (for tests). */
|
|
14
|
+
export declare function waitForFormResetDeferral(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Listens for a native `reset` on the control's current owner form. Uses bubble
|
|
17
|
+
* phase on `document` so form-scoped `preventDefault` runs during dispatch.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useNativeFormReset(getElement: () => (HTMLElement & {
|
|
20
|
+
form?: HTMLFormElement | null;
|
|
21
|
+
}) | null, apply: () => void): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface GetPaginationRangeOptions {
|
|
2
|
+
/** 1-based current page. */
|
|
3
|
+
page: number;
|
|
4
|
+
/** Total pages (values below 1 are treated as 1). */
|
|
5
|
+
pageCount: number;
|
|
6
|
+
/** Pages adjacent to the current page. Invalid values fall back to 1. */
|
|
7
|
+
siblingCount?: number;
|
|
8
|
+
/** Pages always visible at the start and end. Invalid values fall back to 1. */
|
|
9
|
+
boundaryCount?: number;
|
|
10
|
+
}
|
|
11
|
+
export type GhostPaginationRangeEntry = {
|
|
12
|
+
type: 'page';
|
|
13
|
+
page: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'ellipsis';
|
|
16
|
+
placement: 'start' | 'end';
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Pure pagination range with ellipsis markers. Used by {@link useGhostPagination}
|
|
20
|
+
* and covered by unit tests so ellipsis placement stays stable.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPaginationRange(options: GetPaginationRangeOptions): GhostPaginationRangeEntry[];
|
|
23
|
+
/** @deprecated Use {@link GhostPaginationRangeEntry}. */
|
|
24
|
+
export type GhostPaginationItem = GhostPaginationRangeEntry;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small local tabbable query. Dialog, menus, and composites need this without
|
|
3
|
+
* taking on `tabbable` / `focus-trap` as a runtime dependency.
|
|
4
|
+
*
|
|
5
|
+
* Visibility uses computed style and hiding attributes rather than layout
|
|
6
|
+
* metrics: jsdom reports 0×0 for every element, so offsetWidth would empty
|
|
7
|
+
* the sequence in unit tests and still be wrong for zero-size controls.
|
|
8
|
+
*
|
|
9
|
+
* Scope boundary: queries light-DOM candidates under `root` (or the direct tree
|
|
10
|
+
* of `root` when `root` itself is a `ShadowRoot`). Does not traverse into nested
|
|
11
|
+
* open shadow roots or closed shadow roots.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTabbableElements(root: ParentNode): HTMLElement[];
|
|
14
|
+
/** Focusable includes tabindex="-1", which roving items use as the resting stop. */
|
|
15
|
+
export declare function getFocusableElements(root: ParentNode): HTMLElement[];
|
|
16
|
+
export declare function isFocusable(element: HTMLElement): boolean;
|
|
17
|
+
export declare function isSameRadioGroup(a: Element, b: Element): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Composite navigation policy: roving widgets skip these items but loading
|
|
20
|
+
* controls may keep `aria-disabled` while remaining natively focusable.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isDisabledElement(element: HTMLElement): boolean;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey, MaybeRefOrGetter, Ref, WritableComputedRef } from 'vue';
|
|
2
|
+
import type { GhostCollapsibleContentElement, GhostCollapsibleContentExposed, GhostCollapsibleTriggerElement, GhostCollapsibleTriggerExposed } from './ghost-collapsible.js';
|
|
3
|
+
export type GhostAccordionType = 'single' | 'multiple';
|
|
4
|
+
export type GhostAccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
export type GhostAccordionValue = string | string[] | undefined;
|
|
6
|
+
/** Valid `as` targets for {@link GhostAccordionTrigger}. */
|
|
7
|
+
export type GhostAccordionTriggerElement = GhostCollapsibleTriggerElement;
|
|
8
|
+
/** Valid `as` targets for {@link GhostAccordionContent}. */
|
|
9
|
+
export type GhostAccordionContentElement = GhostCollapsibleContentElement;
|
|
10
|
+
/** Props for the {@link GhostAccordion} root provider component. */
|
|
11
|
+
export interface GhostAccordionProps {
|
|
12
|
+
/**
|
|
13
|
+
* Single expansion (one open item) or multiple open items.
|
|
14
|
+
* @default 'single'
|
|
15
|
+
*/
|
|
16
|
+
type?: GhostAccordionType;
|
|
17
|
+
/**
|
|
18
|
+
* When `type` is `single`, allow closing the open item so none are expanded.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
collapsible?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Controlled expansion. Omit for uncontrolled. `string` or `undefined` when
|
|
24
|
+
* `type` is `single`; `string[]` when `type` is `multiple`.
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
modelValue?: GhostAccordionValue;
|
|
28
|
+
/**
|
|
29
|
+
* Initial expansion when `modelValue` is omitted.
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
32
|
+
defaultValue?: GhostAccordionValue;
|
|
33
|
+
/**
|
|
34
|
+
* Heading level wrapping each accordion trigger.
|
|
35
|
+
* @default 3
|
|
36
|
+
*/
|
|
37
|
+
headingLevel?: GhostAccordionHeadingLevel;
|
|
38
|
+
/**
|
|
39
|
+
* Disables toggling on every item when `true`.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Props for {@link GhostAccordionItem}. */
|
|
45
|
+
export interface GhostAccordionItemProps {
|
|
46
|
+
/** Stable value identifying this panel in the root `modelValue`. */
|
|
47
|
+
value: string;
|
|
48
|
+
/**
|
|
49
|
+
* Disables toggling on this item.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Props for {@link GhostAccordionTrigger}. */
|
|
55
|
+
export interface GhostAccordionTriggerProps {
|
|
56
|
+
/**
|
|
57
|
+
* Tag name or component forwarded to the inner disclosure trigger.
|
|
58
|
+
* @default 'button'
|
|
59
|
+
*/
|
|
60
|
+
as?: GhostAccordionTriggerElement;
|
|
61
|
+
}
|
|
62
|
+
/** Props for {@link GhostAccordionContent}. */
|
|
63
|
+
export interface GhostAccordionContentProps {
|
|
64
|
+
/**
|
|
65
|
+
* Tag name or component forwarded to the inner disclosure panel.
|
|
66
|
+
* @default 'div'
|
|
67
|
+
*/
|
|
68
|
+
as?: GhostAccordionContentElement;
|
|
69
|
+
/**
|
|
70
|
+
* Skips theme height animations even when motion is allowed.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
disableAnimation?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export type GhostAccordionTriggerExposed = GhostCollapsibleTriggerExposed;
|
|
76
|
+
export type GhostAccordionContentExposed = GhostCollapsibleContentExposed;
|
|
77
|
+
/** Methods and state exposed by a template ref to {@link GhostAccordion}. */
|
|
78
|
+
export interface GhostAccordionExposed {
|
|
79
|
+
readonly element: HTMLElement | null;
|
|
80
|
+
focus(options?: FocusOptions): void;
|
|
81
|
+
blur(): void;
|
|
82
|
+
}
|
|
83
|
+
/** Options for {@link useGhostAccordion}. */
|
|
84
|
+
export interface UseGhostAccordionOptions {
|
|
85
|
+
type?: MaybeRefOrGetter<GhostAccordionType>;
|
|
86
|
+
collapsible?: MaybeRefOrGetter<boolean>;
|
|
87
|
+
modelValue?: MaybeRefOrGetter<GhostAccordionValue>;
|
|
88
|
+
defaultValue?: MaybeRefOrGetter<GhostAccordionValue>;
|
|
89
|
+
onValueChange?: (value: GhostAccordionValue) => void;
|
|
90
|
+
}
|
|
91
|
+
/** Reactive state and helpers returned by {@link useGhostAccordion}. */
|
|
92
|
+
export interface UseGhostAccordionReturn {
|
|
93
|
+
modelValue: WritableComputedRef<GhostAccordionValue>;
|
|
94
|
+
type: ComputedRef<GhostAccordionType>;
|
|
95
|
+
collapsible: ComputedRef<boolean>;
|
|
96
|
+
isItemOpen: (value: string) => boolean;
|
|
97
|
+
setItemOpen: (value: string, open: boolean) => void;
|
|
98
|
+
}
|
|
99
|
+
/** Internal context shared between `GhostAccordion` parts. */
|
|
100
|
+
export interface GhostAccordionContext {
|
|
101
|
+
type: ComputedRef<GhostAccordionType>;
|
|
102
|
+
collapsible: ComputedRef<boolean>;
|
|
103
|
+
headingLevel: ComputedRef<GhostAccordionHeadingLevel>;
|
|
104
|
+
disabled: Ref<boolean>;
|
|
105
|
+
isItemOpen: (value: string) => boolean;
|
|
106
|
+
setItemOpen: (value: string, open: boolean) => void;
|
|
107
|
+
isItemDisabled: (value: string) => boolean;
|
|
108
|
+
}
|
|
109
|
+
/** Per-item context from {@link GhostAccordionItem}. */
|
|
110
|
+
export interface GhostAccordionItemContext {
|
|
111
|
+
value: string;
|
|
112
|
+
disabled: ComputedRef<boolean>;
|
|
113
|
+
}
|
|
114
|
+
export declare const ghostAccordionContextKey: InjectionKey<GhostAccordionContext>;
|
|
115
|
+
export declare const ghostAccordionItemContextKey: InjectionKey<GhostAccordionItemContext>;
|
|
116
|
+
/**
|
|
117
|
+
* Resolves a DOM element from either a raw element or a component ref
|
|
118
|
+
* (preferring exposed `.element` over `.$el`).
|
|
119
|
+
*/
|
|
120
|
+
export declare function resolveAccordionHtmlElement(target: unknown): HTMLElement | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { HTMLAttributes, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/** Root element for {@link GhostAvatar}. */
|
|
3
|
+
export type GhostAvatarElement = 'span' | 'div';
|
|
4
|
+
/** Client image pipeline state. `idle` means no `src` was provided. */
|
|
5
|
+
export type GhostAvatarImageStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
6
|
+
/** `data-state` on the avatar root while an image `src` is in play. */
|
|
7
|
+
export type GhostAvatarDataState = 'loading' | 'loaded' | 'error';
|
|
8
|
+
/**
|
|
9
|
+
* Unstyled {@link GhostAvatar} props. `@vue-ignore` keeps native attributes as
|
|
10
|
+
* fallthrough at runtime while typing the host contract for consumers.
|
|
11
|
+
*/
|
|
12
|
+
export interface GhostAvatarProps extends /* @vue-ignore */ HTMLAttributes {
|
|
13
|
+
/** Image URL. Omit for initials-only avatars. */
|
|
14
|
+
src?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Accessible name for the loaded `<img>`. Falls back to {@link name}. Use an
|
|
17
|
+
* empty string when a parent control already names the entity.
|
|
18
|
+
*/
|
|
19
|
+
alt?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Display name used for fallback initials and as the default `alt` when the
|
|
22
|
+
* image loads.
|
|
23
|
+
*/
|
|
24
|
+
name?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Root host. Stay within valid HTML for the parent context.
|
|
27
|
+
* @default 'span'
|
|
28
|
+
*/
|
|
29
|
+
as?: GhostAvatarElement;
|
|
30
|
+
}
|
|
31
|
+
/** Options for {@link useGhostAvatar}. */
|
|
32
|
+
export interface UseGhostAvatarOptions {
|
|
33
|
+
src?: MaybeRefOrGetter<string | undefined>;
|
|
34
|
+
alt?: MaybeRefOrGetter<string | undefined>;
|
|
35
|
+
name?: MaybeRefOrGetter<string | undefined>;
|
|
36
|
+
}
|
|
37
|
+
/** Methods and state available from a template ref to {@link GhostAvatar}. */
|
|
38
|
+
export interface GhostAvatarExposed {
|
|
39
|
+
/** The root host element after mount, or `null` before mount. */
|
|
40
|
+
readonly element: HTMLElement | null;
|
|
41
|
+
}
|