@ghostvue/vue 0.1.0 → 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.
Files changed (53) hide show
  1. package/dist/GhostCheckboxGroup.vue.d.ts +24 -0
  2. package/dist/GhostComboboxContent.vue.d.ts +2 -2
  3. package/dist/GhostContextMenuContent.vue.d.ts +2 -2
  4. package/dist/GhostDatePickerContent.vue.d.ts +2 -2
  5. package/dist/GhostDropdownMenuContent.vue.d.ts +2 -2
  6. package/dist/GhostField.vue.d.ts +8 -5
  7. package/dist/GhostFieldError.vue.d.ts +3 -6
  8. package/dist/GhostFileUpload.vue.d.ts +1 -1
  9. package/dist/GhostForm.vue.d.ts +25 -0
  10. package/dist/GhostHoverCardContent.vue.d.ts +2 -2
  11. package/dist/GhostMenubarContent.vue.d.ts +2 -2
  12. package/dist/GhostPopoverContent.vue.d.ts +2 -2
  13. package/dist/GhostPresence.vue.d.ts +27 -0
  14. package/dist/GhostScrollSpy.vue.d.ts +1 -1
  15. package/dist/GhostScrollSpyItem.vue.d.ts +1 -1
  16. package/dist/GhostSelect.vue.d.ts +19 -46
  17. package/dist/GhostSelectContent.vue.d.ts +2 -2
  18. package/dist/GhostSelectValue.vue.d.ts +4 -7
  19. package/dist/GhostSubmenu.vue.d.ts +23 -0
  20. package/dist/GhostSubmenuContent.vue.d.ts +20 -0
  21. package/dist/GhostSubmenuTrigger.vue.d.ts +17 -0
  22. package/dist/GhostTagsInput.vue.d.ts +26 -0
  23. package/dist/GhostTooltipContent.vue.d.ts +2 -2
  24. package/dist/GhostTree.vue.d.ts +1 -1
  25. package/dist/dev-codes.d.ts +36 -0
  26. package/dist/dialog-shared.d.ts +15 -6
  27. package/dist/dismissable-layer-stack.d.ts +1 -0
  28. package/dist/form-reset.d.ts +9 -1
  29. package/dist/ghost-checkbox-group.d.ts +88 -0
  30. package/dist/ghost-dialog.d.ts +2 -0
  31. package/dist/ghost-field.d.ts +22 -1
  32. package/dist/ghost-form.d.ts +273 -0
  33. package/dist/ghost-presence.d.ts +78 -0
  34. package/dist/ghost-select.d.ts +63 -6
  35. package/dist/ghost-submenu.d.ts +20 -0
  36. package/dist/ghost-tags-input.d.ts +41 -0
  37. package/dist/ghost-tooltip-provider.d.ts +15 -4
  38. package/dist/ghostvue.js +7988 -5869
  39. package/dist/index.d.ts +17 -2
  40. package/dist/manifest.json +1378 -70
  41. package/dist/resolver.js +1 -1
  42. package/dist/track-reactive-reads.d.ts +13 -0
  43. package/dist/use-dismissable-layer.d.ts +8 -0
  44. package/dist/use-focus-scope.d.ts +7 -0
  45. package/dist/use-ghost-checkbox-group.d.ts +13 -0
  46. package/dist/use-ghost-form.d.ts +7 -0
  47. package/dist/use-ghost-menu-branch.d.ts +54 -0
  48. package/dist/use-ghost-menu-collection.d.ts +11 -0
  49. package/dist/use-ghost-menu-root.d.ts +13 -0
  50. package/dist/use-ghost-presence.d.ts +48 -0
  51. package/dist/use-ghost-select.d.ts +18 -8
  52. package/dist/use-roving-focus.d.ts +2 -0
  53. package/package.json +2 -1
package/dist/resolver.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/.registries/component-names.generated.ts
2
- var e = /* @__PURE__ */ "GhostAccordion.GhostAccordionContent.GhostAccordionItem.GhostAccordionTrigger.GhostAvatar.GhostBadge.GhostBreadcrumb.GhostBreadcrumbEllipsis.GhostBreadcrumbItem.GhostBreadcrumbLink.GhostBreadcrumbList.GhostBreadcrumbPage.GhostBreadcrumbSeparator.GhostButton.GhostCalendar.GhostCalendarCell.GhostCalendarGrid.GhostCalendarHeader.GhostCalendarHeading.GhostCalendarNextButton.GhostCalendarPrevButton.GhostCard.GhostCheckbox.GhostCollapsible.GhostCollapsibleContent.GhostCollapsibleTrigger.GhostCombobox.GhostComboboxContent.GhostComboboxEmpty.GhostComboboxGroup.GhostComboboxInput.GhostComboboxLabel.GhostComboboxOption.GhostComboboxTrigger.GhostCommandPalette.GhostCommandPaletteContent.GhostCommandPaletteEmpty.GhostCommandPaletteGroup.GhostCommandPaletteInput.GhostCommandPaletteItem.GhostCommandPaletteLabel.GhostCommandPaletteList.GhostCommandPaletteOverlay.GhostCommandPaletteSeparator.GhostCommandPaletteTitle.GhostCommandPaletteTrigger.GhostContextMenu.GhostContextMenuCheckboxItem.GhostContextMenuContent.GhostContextMenuGroup.GhostContextMenuItem.GhostContextMenuLabel.GhostContextMenuRadioGroup.GhostContextMenuRadioItem.GhostContextMenuSeparator.GhostContextMenuTrigger.GhostDataTable.GhostDataTablePreset.GhostDataTableTable.GhostDatePicker.GhostDatePickerCalendar.GhostDatePickerContent.GhostDatePickerInput.GhostDatePickerTrigger.GhostDialog.GhostDialogClose.GhostDialogContent.GhostDialogDescription.GhostDialogOverlay.GhostDialogTitle.GhostDialogTrigger.GhostDrawer.GhostDrawerClose.GhostDrawerContent.GhostDrawerDescription.GhostDrawerOverlay.GhostDrawerTitle.GhostDrawerTrigger.GhostDropdownMenu.GhostDropdownMenuCheckboxItem.GhostDropdownMenuContent.GhostDropdownMenuGroup.GhostDropdownMenuItem.GhostDropdownMenuLabel.GhostDropdownMenuRadioGroup.GhostDropdownMenuRadioItem.GhostDropdownMenuSeparator.GhostDropdownMenuTrigger.GhostEmptyState.GhostField.GhostFieldControl.GhostFieldDescription.GhostFieldError.GhostFieldLabel.GhostFileUpload.GhostFileUploadDropzone.GhostFileUploadItem.GhostFileUploadItemRemove.GhostFileUploadList.GhostFileUploadTrigger.GhostHoverCard.GhostHoverCardContent.GhostHoverCardTrigger.GhostInlineAlert.GhostInput.GhostInteractiveSurface.GhostKbd.GhostLink.GhostMenubar.GhostMenubarCheckboxItem.GhostMenubarContent.GhostMenubarGroup.GhostMenubarItem.GhostMenubarLabel.GhostMenubarMenu.GhostMenubarRadioGroup.GhostMenubarRadioItem.GhostMenubarSeparator.GhostMenubarTrigger.GhostNumberInput.GhostPagination.GhostPopover.GhostPopoverClose.GhostPopoverContent.GhostPopoverTrigger.GhostPortal.GhostProgress.GhostRadioGroup.GhostRadioGroupItem.GhostScrollArea.GhostScrollSpy.GhostScrollSpyItem.GhostScrollSpyLink.GhostScrollSpyList.GhostSegmentedControl.GhostSegmentedControlItem.GhostSelect.GhostSelectContent.GhostSelectGroup.GhostSelectLabel.GhostSelectOption.GhostSelectTrigger.GhostSelectValue.GhostSeparator.GhostSkeleton.GhostSlider.GhostSpinner.GhostSwitch.GhostTable.GhostTableBody.GhostTableCaption.GhostTableCell.GhostTableFoot.GhostTableHead.GhostTableHeaderCell.GhostTableRow.GhostTabs.GhostTabsContent.GhostTabsList.GhostTabsTrigger.GhostTextarea.GhostToast.GhostToastAction.GhostToastClose.GhostToastDescription.GhostToastProvider.GhostToastTitle.GhostToastViewport.GhostToggleGroup.GhostToggleGroupItem.GhostToolbar.GhostTooltip.GhostTooltipContent.GhostTooltipProvider.GhostTooltipTrigger.GhostTree.GhostTreeGroup.GhostTreeItem.GhostTreeTrigger.GhostVisuallyHidden".split(".");
2
+ var e = /* @__PURE__ */ "GhostAccordion.GhostAccordionContent.GhostAccordionItem.GhostAccordionTrigger.GhostAvatar.GhostBadge.GhostBreadcrumb.GhostBreadcrumbEllipsis.GhostBreadcrumbItem.GhostBreadcrumbLink.GhostBreadcrumbList.GhostBreadcrumbPage.GhostBreadcrumbSeparator.GhostButton.GhostCalendar.GhostCalendarCell.GhostCalendarGrid.GhostCalendarHeader.GhostCalendarHeading.GhostCalendarNextButton.GhostCalendarPrevButton.GhostCard.GhostCheckbox.GhostCheckboxGroup.GhostCollapsible.GhostCollapsibleContent.GhostCollapsibleTrigger.GhostCombobox.GhostComboboxContent.GhostComboboxEmpty.GhostComboboxGroup.GhostComboboxInput.GhostComboboxLabel.GhostComboboxOption.GhostComboboxTrigger.GhostCommandPalette.GhostCommandPaletteContent.GhostCommandPaletteEmpty.GhostCommandPaletteGroup.GhostCommandPaletteInput.GhostCommandPaletteItem.GhostCommandPaletteLabel.GhostCommandPaletteList.GhostCommandPaletteOverlay.GhostCommandPaletteSeparator.GhostCommandPaletteTitle.GhostCommandPaletteTrigger.GhostContextMenu.GhostContextMenuCheckboxItem.GhostContextMenuContent.GhostContextMenuGroup.GhostContextMenuItem.GhostContextMenuLabel.GhostContextMenuRadioGroup.GhostContextMenuRadioItem.GhostContextMenuSeparator.GhostContextMenuTrigger.GhostDataTable.GhostDataTablePreset.GhostDataTableTable.GhostDatePicker.GhostDatePickerCalendar.GhostDatePickerContent.GhostDatePickerInput.GhostDatePickerTrigger.GhostDialog.GhostDialogClose.GhostDialogContent.GhostDialogDescription.GhostDialogOverlay.GhostDialogTitle.GhostDialogTrigger.GhostDrawer.GhostDrawerClose.GhostDrawerContent.GhostDrawerDescription.GhostDrawerOverlay.GhostDrawerTitle.GhostDrawerTrigger.GhostDropdownMenu.GhostDropdownMenuCheckboxItem.GhostDropdownMenuContent.GhostDropdownMenuGroup.GhostDropdownMenuItem.GhostDropdownMenuLabel.GhostDropdownMenuRadioGroup.GhostDropdownMenuRadioItem.GhostDropdownMenuSeparator.GhostDropdownMenuTrigger.GhostEmptyState.GhostField.GhostFieldControl.GhostFieldDescription.GhostFieldError.GhostFieldLabel.GhostFileUpload.GhostFileUploadDropzone.GhostFileUploadItem.GhostFileUploadItemRemove.GhostFileUploadList.GhostFileUploadTrigger.GhostForm.GhostHoverCard.GhostHoverCardContent.GhostHoverCardTrigger.GhostInlineAlert.GhostInput.GhostInteractiveSurface.GhostKbd.GhostLink.GhostMenubar.GhostMenubarCheckboxItem.GhostMenubarContent.GhostMenubarGroup.GhostMenubarItem.GhostMenubarLabel.GhostMenubarMenu.GhostMenubarRadioGroup.GhostMenubarRadioItem.GhostMenubarSeparator.GhostMenubarTrigger.GhostNumberInput.GhostPagination.GhostPopover.GhostPopoverClose.GhostPopoverContent.GhostPopoverTrigger.GhostPortal.GhostPresence.GhostProgress.GhostRadioGroup.GhostRadioGroupItem.GhostScrollArea.GhostScrollSpy.GhostScrollSpyItem.GhostScrollSpyLink.GhostScrollSpyList.GhostSegmentedControl.GhostSegmentedControlItem.GhostSelect.GhostSelectContent.GhostSelectGroup.GhostSelectLabel.GhostSelectOption.GhostSelectTrigger.GhostSelectValue.GhostSeparator.GhostSkeleton.GhostSlider.GhostSpinner.GhostSubmenu.GhostSubmenuContent.GhostSubmenuTrigger.GhostSwitch.GhostTable.GhostTableBody.GhostTableCaption.GhostTableCell.GhostTableFoot.GhostTableHead.GhostTableHeaderCell.GhostTableRow.GhostTabs.GhostTabsContent.GhostTabsList.GhostTabsTrigger.GhostTagsInput.GhostTextarea.GhostToast.GhostToastAction.GhostToastClose.GhostToastDescription.GhostToastProvider.GhostToastTitle.GhostToastViewport.GhostToggleGroup.GhostToggleGroupItem.GhostToolbar.GhostTooltip.GhostTooltipContent.GhostTooltipProvider.GhostTooltipTrigger.GhostTree.GhostTreeGroup.GhostTreeItem.GhostTreeTrigger.GhostVisuallyHidden".split(".");
3
3
  // src/resolver.ts
4
4
  function t() {
5
5
  let t = new Set(e);
@@ -0,0 +1,13 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Subscribes the running reactive effect (a `computed`, watcher, or render) to
4
+ * each source without using its value.
5
+ *
6
+ * Use it when an effect must re-run on a change it cannot observe directly.
7
+ * The usual case is a registry version counter: registries keep their items in
8
+ * collections the effect reads through `toRaw` or the DOM, so the counter is
9
+ * the only reactive signal that an item registered, unregistered, or
10
+ * relabelled. Calling this at the top of the effect states that dependency
11
+ * explicitly. Outside an effect it is a plain read with no side effect.
12
+ */
13
+ export declare function trackReactiveReads(...sources: readonly MaybeRefOrGetter<unknown>[]): void;
@@ -19,6 +19,11 @@ export interface UseDismissableLayerOptions {
19
19
  */
20
20
  ignore?: MaybeRefOrGetter<DismissableLayerIgnore | undefined>;
21
21
  }
22
+ interface BranchDismissableLayerOptions extends UseDismissableLayerOptions {
23
+ /** Portaled surfaces that share the root layer's focus and dismissal. */
24
+ branches?: () => readonly HTMLElement[];
25
+ onPointerInside?: (event: PointerEvent) => void;
26
+ }
22
27
  /**
23
28
  * Dismisses the topmost active overlay layer on Escape or pointerdown outside
24
29
  * `el` and any `ignore` elements.
@@ -27,6 +32,8 @@ export interface UseDismissableLayerOptions {
27
32
  * layers remain active, keeping SSR setup pure.
28
33
  */
29
34
  export declare function useDismissableLayer(el: MaybeRefOrGetter<DismissableLayerTarget>, options: UseDismissableLayerOptions): void;
35
+ /** Registers one overlay layer for a root menu and its portaled descendants. */
36
+ export declare function useBranchDismissableLayer(el: MaybeRefOrGetter<DismissableLayerTarget>, options: BranchDismissableLayerOptions): void;
30
37
  /**
31
38
  * Internal (not part of the public entry point): joins `el` to the shared
32
39
  * layer stack for `Escape` ordering only. Used by `GhostTooltipContent` so one
@@ -38,3 +45,4 @@ export declare function useDismissableLayer(el: MaybeRefOrGetter<DismissableLaye
38
45
  * `preventDefault()` alone is unreliable.
39
46
  */
40
47
  export declare function useEscapeDismissableLayer(el: MaybeRefOrGetter<DismissableLayerTarget>, onEscape: (event: KeyboardEvent) => void): void;
48
+ export {};
@@ -24,6 +24,13 @@ export interface UseFocusScopeOptions {
24
24
  */
25
25
  returnFocus?: MaybeRefOrGetter<HTMLElement | null | undefined>;
26
26
  }
27
+ /**
28
+ * Returns `true` when focus currently sits inside an active trapped focus
29
+ * scope (or an upper dismissable layer owned by that scope) outside
30
+ * `container`, so callers such as `GhostForm` do not yank focus out of a
31
+ * modal opened while an async check was in flight.
32
+ */
33
+ export declare function isFocusInExternalTrappedScope(container: HTMLElement, activeElement?: Element | null): boolean;
27
34
  /**
28
35
  * Focus entry, optional focus/Tab trap, and restoration for overlays.
29
36
  *
@@ -0,0 +1,13 @@
1
+ import type { GhostCheckboxGroupContext, GhostCheckboxGroupRegisteredMember, UseGhostCheckboxGroupOptions } from './ghost-checkbox-group.js';
2
+ /**
3
+ * Selection state, member registry, and native form-reset baseline for
4
+ * {@link GhostCheckboxGroup}. Does not install a provide/inject context.
5
+ */
6
+ export declare function useGhostCheckboxGroup<TValue extends string = string>(options?: UseGhostCheckboxGroupOptions<TValue>): GhostCheckboxGroupContext<TValue> & {
7
+ /** Internal member map shared with GhostCheckboxGroup for focus/DOM order. */
8
+ readonly _members: Map<symbol, GhostCheckboxGroupRegisteredMember>;
9
+ /** Internal member-string bridge for GhostCheckboxGroup context wiring. */
10
+ readonly _setSelectedMember: (value: string, checked: boolean) => void;
11
+ /** Internal member-string toggle bridge for GhostCheckboxGroup context wiring. */
12
+ readonly _toggleMember: (value: string) => void;
13
+ };
@@ -0,0 +1,7 @@
1
+ import { type StandardSchemaV1, type UseGhostFormOptions, type UseGhostFormReturn } from './ghost-form.js';
2
+ /**
3
+ * Schema-backed form orchestration built on Standard Schema v1 (`~standard`),
4
+ * progressive error visibility, monotonic async epochs, and native reset
5
+ * suppression.
6
+ */
7
+ export declare function useGhostForm<TSchema extends StandardSchemaV1 = StandardSchemaV1, TValues = StandardSchemaV1.InferInput<TSchema>>(options: UseGhostFormOptions<TSchema, TValues>): UseGhostFormReturn<TSchema, TValues>;
@@ -0,0 +1,54 @@
1
+ import { shallowRef, type InjectionKey } from 'vue';
2
+ interface SubmenuBranch {
3
+ readonly id: symbol;
4
+ readonly level: MenuLevel;
5
+ readonly trigger: () => HTMLElement | null;
6
+ readonly requested: () => boolean;
7
+ readonly disabled: () => boolean;
8
+ requestOpen: (focus: boolean) => void;
9
+ requestClose: (restore?: boolean) => void;
10
+ cancelHover: () => void;
11
+ cancelPending: () => void;
12
+ }
13
+ interface MenuRoot {
14
+ readonly active: ReturnType<typeof shallowRef<MenuLevel | null>>;
15
+ readonly tab: (event: KeyboardEvent) => void;
16
+ readonly select: () => void;
17
+ readonly direction: () => 'ltr' | 'rtl';
18
+ /** Only a Menubar can advance from a leaf to another top-level menu. */
19
+ readonly adjacent?: ((key: 'ArrowLeft' | 'ArrowRight') => void) | undefined;
20
+ }
21
+ export interface MenuLevel {
22
+ readonly parent: MenuLevel | null;
23
+ readonly root: MenuRoot;
24
+ readonly surface: () => HTMLElement | null;
25
+ readonly visible: () => boolean;
26
+ readonly activeChild: () => SubmenuBranch | undefined;
27
+ readonly hasChildren: () => boolean;
28
+ register: (child: SubmenuBranch) => () => void;
29
+ open: (child: SubmenuBranch, focus: boolean) => void;
30
+ openFromModel: (child: SubmenuBranch) => void;
31
+ cancelChildRequests: () => void;
32
+ dismissOutsideChild: (event: PointerEvent) => void;
33
+ dismissOnNavigate: (target: HTMLElement) => void;
34
+ }
35
+ export declare const menuLevelKey: InjectionKey<MenuLevel>;
36
+ export declare const submenuKey: InjectionKey<{
37
+ readonly branch: SubmenuBranch;
38
+ readonly triggerId: () => string;
39
+ readonly contentId: () => string;
40
+ readonly setTrigger: (element: HTMLElement | null) => void;
41
+ readonly setSurface: (element: HTMLElement | null) => void;
42
+ readonly setDisabled: (disabled: boolean) => void;
43
+ readonly focusOnEntry: (surface: HTMLElement, focus: (surface: HTMLElement) => void) => void;
44
+ readonly close: (restore: boolean) => void;
45
+ readonly hoverIn: (event: PointerEvent) => void;
46
+ readonly hoverOut: (event: PointerEvent) => void;
47
+ readonly keepHoveredBranch: () => void;
48
+ }>;
49
+ export declare function useGhostMenuLevel(parent: MenuLevel | null, root: MenuRoot, surface: MenuLevel['surface'], visible: MenuLevel['visible']): MenuLevel;
50
+ export declare function branchHasFocus(level: MenuLevel): boolean;
51
+ export declare function branchSurfaces(level: MenuLevel): HTMLElement[];
52
+ export declare function eventMenuLevel(level: MenuLevel, event: Event): MenuLevel | null;
53
+ export declare function readMenuDirection(element: HTMLElement | null): 'ltr' | 'rtl';
54
+ export {};
@@ -6,14 +6,25 @@ export interface UseGhostMenuCollectionOptions {
6
6
  /** APG: Tab closes the menu without restoring focus to the trigger. */
7
7
  onClose?: (reason?: GhostMenuCollectionCloseReason) => void;
8
8
  }
9
+ interface MenuLevelCollectionOptions extends UseGhostMenuCollectionOptions {
10
+ onTab?: (event: KeyboardEvent) => void;
11
+ active?: () => boolean;
12
+ onFocusIn?: () => void;
13
+ onNavigate?: (target: HTMLElement) => void;
14
+ }
9
15
  /** Enabled menu items inside `root`, in DOM order. */
10
16
  export declare function getMenuItems(root: ParentNode): HTMLElement[];
11
17
  /** Roving tabindex: focus the first enabled item. */
12
18
  export declare function focusFirstMenuItem(root: ParentNode): boolean;
13
19
  /** Roving tabindex: focus the last enabled item. */
14
20
  export declare function focusLastMenuItem(root: ParentNode): boolean;
21
+ /** An inline submenu owns its own items even though the ancestor contains them. */
22
+ export declare function belongsToMenu(root: ParentNode, element: HTMLElement): boolean;
15
23
  /**
16
24
  * APG menu keyboard behavior: vertical roving, typeahead, and item activation.
17
25
  * Listeners attach in `onMounted` so SSR setup does not touch the document.
18
26
  */
19
27
  export declare function useGhostMenuCollection(container: MaybeRefOrGetter<HTMLElement | null | undefined>, options?: UseGhostMenuCollectionOptions): void;
28
+ /** Connects one registered level of a nested menu to the shared collection. */
29
+ export declare function useGhostMenuLevelCollection(container: MaybeRefOrGetter<HTMLElement | null | undefined>, options?: MenuLevelCollectionOptions): void;
30
+ export {};
@@ -0,0 +1,13 @@
1
+ import { type Ref } from 'vue';
2
+ import { type MenuLevel } from './use-ghost-menu-branch.js';
3
+ interface MenuHost {
4
+ isOpen: Readonly<Ref<boolean>>;
5
+ triggerElement: Readonly<Ref<HTMLElement | null>>;
6
+ close: () => void;
7
+ }
8
+ /** One dismissal layer owns the root and all its inline or portaled children. */
9
+ export declare function useGhostMenuRoot(host: MenuHost, surface: Readonly<Ref<HTMLElement | null>>, openAdjacent?: (trigger: HTMLElement, key: 'ArrowLeft' | 'ArrowRight') => void): {
10
+ level: MenuLevel;
11
+ shouldRestoreFocus: import("vue").ShallowRef<boolean, boolean>;
12
+ };
13
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { UseGhostPresenceOptions, UseGhostPresenceReturn } from './ghost-presence.js';
2
+ /**
3
+ * Resolves a template-ref target to a DOM `Element`: a raw element, or a
4
+ * component instance exposing `element` (preferred) or `$el`. `Element`
5
+ * rather than `HTMLElement` so an animated `<svg>` root (an `SVGElement`)
6
+ * keeps its exit motion; a fragment component's `$el` is a text or comment
7
+ * anchor and still resolves to `null`.
8
+ */
9
+ export declare function resolvePresenceElement(target: unknown): Element | null;
10
+ /** Exit motion measured from computed styles when `getAnimations` is missing. */
11
+ export interface ComputedExitMotion {
12
+ /** Longest included transition or finite animation, in milliseconds. */
13
+ totalMs: number;
14
+ /**
15
+ * Transition properties with positive `delay + duration`. A property listed
16
+ * twice runs one transition (the last declaration wins), so this is a set.
17
+ */
18
+ transitions: ReadonlySet<string>;
19
+ /**
20
+ * Finite animation names with positive active time, counted per entry:
21
+ * `animation: fade 100ms, fade 200ms` runs two animations that each end.
22
+ * Infinite and paused animations are excluded and never gate removal.
23
+ */
24
+ animations: ReadonlyMap<string, number>;
25
+ }
26
+ type ComputedMotionStyle = Pick<CSSStyleDeclaration, 'transitionProperty' | 'transitionDuration' | 'transitionDelay' | 'animationName' | 'animationDuration' | 'animationDelay' | 'animationIterationCount' | 'animationPlayState'>;
27
+ /**
28
+ * Applies CSS list-matching rules: the property/name list sets the entry
29
+ * count and shorter time lists cycle. Transitions contribute
30
+ * `delay + duration` (a positive delay alone keeps the surface mounted);
31
+ * finite running animations contribute `delay + duration * count`; infinite
32
+ * and paused animations are excluded. Entries with positive time are also returned
33
+ * individually so the event fallback can wait for each of them.
34
+ */
35
+ export declare function measureComputedExitMotion(style: ComputedMotionStyle): ComputedExitMotion;
36
+ /**
37
+ * Decouples logical open state from physical DOM presence for one surface.
38
+ *
39
+ * On a mounted client, `present: true -> false` flips `phase` to `'exiting'`
40
+ * synchronously (before the close render) so the node stays mounted with
41
+ * `data-state="closed"`. After that render flushes, the surface's own finite
42
+ * CSS transitions and animations are awaited; with none, removal happens in
43
+ * the same post-flush tick. Reopening while exiting reuses the same node, and
44
+ * an attempt counter turns every late completion from an older exit into a
45
+ * no-op. Setup touches no browser globals, so SSR output is unchanged.
46
+ */
47
+ export declare function useGhostPresence(options: UseGhostPresenceOptions): UseGhostPresenceReturn;
48
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { type ComputedRef, type CSSProperties, type Ref } from 'vue';
2
- import type { UseGhostSelectOptions } from './ghost-select.js';
2
+ import type { GhostSelectMessages, UseGhostSelectOptions } from './ghost-select.js';
3
3
  /** Native submit + `required` constraint validation (not `type=hidden`). */
4
4
  export interface GhostSelectFormInputProps {
5
5
  type: 'text';
@@ -14,13 +14,10 @@ export interface GhostSelectFormInputProps {
14
14
  style: CSSProperties;
15
15
  autocomplete: 'off';
16
16
  }
17
- /**
18
- * Selected value, option registry, listbox open state, typeahead, and form
19
- * hidden-input props for {@link GhostSelect}.
20
- */
21
- export declare function useGhostSelect(options?: UseGhostSelectOptions): {
17
+ export interface UseGhostSelectBaseReturn {
18
+ multiple: ComputedRef<boolean>;
22
19
  labelVersion: Ref<number>;
23
- selectedValue: Ref<string | undefined>;
20
+ selectedValues: ComputedRef<readonly string[]>;
24
21
  isOpen: Ref<boolean>;
25
22
  open: () => void;
26
23
  close: () => void;
@@ -31,6 +28,7 @@ export declare function useGhostSelect(options?: UseGhostSelectOptions): {
31
28
  required: ComputedRef<boolean>;
32
29
  invalid: ComputedRef<boolean>;
33
30
  placeholder: ComputedRef<string | undefined>;
31
+ messages: ComputedRef<GhostSelectMessages | undefined>;
34
32
  optionOrder: ComputedRef<string[]>;
35
33
  registerOption: GhostSelectContextRegisterOption;
36
34
  unregisterOption: (value: string) => void;
@@ -44,9 +42,21 @@ export declare function useGhostSelect(options?: UseGhostSelectOptions): {
44
42
  focusOptionByValue: (value: string) => void;
45
43
  focusFirstEnabledOption: (fromEnd?: boolean) => void;
46
44
  formInputProps: ComputedRef<GhostSelectFormInputProps>;
45
+ formInputs: ComputedRef<GhostSelectFormInputProps[]>;
47
46
  applyFormReset: () => void;
48
47
  syncFormValidity: () => void;
49
48
  handleFormInputInvalid: () => void;
50
- };
49
+ }
50
+ export type UseGhostSelectReturn<Multiple extends boolean = false> = UseGhostSelectBaseReturn & (Multiple extends true ? {
51
+ selectedValue: Readonly<Ref<readonly string[]>>;
52
+ replaceSelection: (values: readonly string[]) => void;
53
+ } : {
54
+ selectedValue: Ref<string | undefined>;
55
+ });
56
+ /**
57
+ * Selected value, option registry, listbox open state, typeahead, and form
58
+ * hidden-input props for {@link GhostSelect}.
59
+ */
60
+ export declare function useGhostSelect<Multiple extends boolean = false>(...args: [options: UseGhostSelectOptions<Multiple>] | (false extends Multiple ? [options?: undefined] : never)): UseGhostSelectReturn<Multiple>;
51
61
  type GhostSelectContextRegisterOption = (value: string, textValue: string, disabled: boolean, getElement: () => HTMLElement | null) => void;
52
62
  export {};
@@ -18,3 +18,5 @@ export interface UseRovingFocusOptions {
18
18
  * Listeners attach in `onMounted` so SSR setup does not touch the document.
19
19
  */
20
20
  export declare function useRovingFocus(container: MaybeRefOrGetter<HTMLElement | null | undefined>, options?: UseRovingFocusOptions): void;
21
+ /** Composites with nested widgets can restrict roving to their own controls. */
22
+ export declare function useRovingFocusItems(container: MaybeRefOrGetter<HTMLElement | null | undefined>, options: UseRovingFocusOptions | undefined, itemsIn: (root: HTMLElement) => HTMLElement[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostvue/vue",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Vue 3 integration for the headless-first GhostVue library.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,6 +43,7 @@
43
43
  }
44
44
  },
45
45
  "devDependencies": {
46
+ "@standard-schema/spec": "1.1.0",
46
47
  "vue": "3.5.45"
47
48
  },
48
49
  "typesVersions": {