@glasshome/ui 1.33.2 → 1.34.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.
@@ -0,0 +1,45 @@
1
+ import { type Accessor } from "solid-js";
2
+ import { type InitialFocus } from "../solid/bottom-sheet/focus-trap.js";
3
+ /** True for a node inside a shadow root, where page-level layer logic sees only the root's host. */
4
+ export declare const inShadowRoot: (node: Node | undefined) => boolean;
5
+ type OutsideEvent = {
6
+ target: EventTarget | null;
7
+ preventDefault(): void;
8
+ };
9
+ type AutoFocusEvent = {
10
+ preventDefault(): void;
11
+ };
12
+ export interface LayerHandlers {
13
+ onInteractOutside: (e: OutsideEvent) => void;
14
+ onCloseAutoFocus: (e: AutoFocusEvent) => void;
15
+ onOpenAutoFocus: (e: AutoFocusEvent) => void;
16
+ /** The shadow root's host while the layer is in one: what the page sees as the target of anything inside. */
17
+ host: () => Element | undefined;
18
+ }
19
+ interface ShadowLayerOptions {
20
+ content: Accessor<HTMLElement | undefined>;
21
+ open: Accessor<boolean>;
22
+ /** Absent for layers that close on pointer leave (tooltips, hover cards): they never join the stack. */
23
+ dismiss?: () => void;
24
+ /** A press on it is the trigger's own toggle, never an outside press. */
25
+ trigger?: Accessor<Element | undefined>;
26
+ /** Menus: any press outside the layer and the layers above it dismisses it, newest or not, as Kobalte's menus do. */
27
+ tree?: boolean;
28
+ /** The layer keeps Tab inside itself (dialogs); its initial focus is then ui's, not Kobalte's. */
29
+ trapsFocus?: boolean;
30
+ initialFocus?: InitialFocus;
31
+ consumer: {
32
+ onInteractOutside?: (e: never) => void;
33
+ onCloseAutoFocus?: (e: never) => void;
34
+ onOpenAutoFocus?: (e: never) => void;
35
+ };
36
+ }
37
+ /**
38
+ * Kobalte decides "outside" from the page, where a press or focus inside a shadow root is one on
39
+ * the root's host, so a layer portaled into a shadow root would dismiss on every press inside it.
40
+ * The handlers ignore those; while the layer is open in a shadow root, a press elsewhere in that
41
+ * root dismisses the newest layer from a listener on the root itself. Outside a shadow root the
42
+ * handlers only pass the consumer's own through.
43
+ */
44
+ export declare function shadowLayer(options: ShadowLayerOptions): LayerHandlers;
45
+ export {};
@@ -1,25 +1,6 @@
1
1
  import { ContextMenu as ContextMenuPrimitive } from "@kobalte/core/context-menu";
2
2
  import { type Component, type ComponentProps, type ParentComponent } from "solid-js";
3
- declare const ContextMenu: typeof import("@kobalte/core/context-menu").Root & {
4
- Arrow: typeof import("@kobalte/core/popover").Arrow;
5
- CheckboxItem: typeof import("@kobalte/core/context-menu").CheckboxItem;
6
- Content: typeof import("@kobalte/core/context-menu").Content;
7
- Group: typeof import("@kobalte/core/context-menu").Group;
8
- GroupLabel: typeof import("@kobalte/core/context-menu").GroupLabel;
9
- Icon: typeof import("@kobalte/core/context-menu").Icon;
10
- Item: typeof import("@kobalte/core/context-menu").Item;
11
- ItemDescription: typeof import("@kobalte/core/context-menu").ItemDescription;
12
- ItemIndicator: typeof import("@kobalte/core/context-menu").ItemIndicator;
13
- ItemLabel: typeof import("@kobalte/core/context-menu").ItemLabel;
14
- Portal: typeof import("@kobalte/core/context-menu").Portal;
15
- RadioGroup: typeof import("@kobalte/core/context-menu").RadioGroup;
16
- RadioItem: typeof import("@kobalte/core/context-menu").RadioItem;
17
- Separator: typeof import("@kobalte/core/context-menu").Separator;
18
- Sub: typeof import("@kobalte/core/context-menu").Sub;
19
- SubContent: typeof import("@kobalte/core/context-menu").SubContent;
20
- SubTrigger: typeof import("@kobalte/core/context-menu").SubTrigger;
21
- Trigger: typeof import("@kobalte/core/context-menu").Trigger;
22
- };
3
+ declare const ContextMenu: Component<ComponentProps<typeof ContextMenuPrimitive>> & typeof ContextMenuPrimitive;
23
4
  declare const ContextMenuGroup: typeof import("@kobalte/core/context-menu").Group;
24
5
  declare const ContextMenuSub: typeof import("@kobalte/core/context-menu").Sub;
25
6
  declare const ContextMenuRadioGroup: typeof import("@kobalte/core/context-menu").RadioGroup;
@@ -68,6 +68,7 @@ export { PICKER_ROW_HEIGHT, PickerRow } from "./picker-row.js";
68
68
  export { PickerSearch, type PickerSearchProps } from "./picker-search.js";
69
69
  export { PickerTrigger, type PickerTriggerProps } from "./picker-trigger.js";
70
70
  export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
71
+ export { PortalMountContext, usePortalMount } from "./portal-mount.js";
71
72
  export { PreviewTile, PreviewTileGroup } from "./preview-tile.js";
72
73
  export { Progress } from "./progress.js";
73
74
  export { RadioGroup, RadioGroupItem } from "./radio-group.js";