sinwan-ui-core 0.0.0 → 1.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.
@@ -0,0 +1,141 @@
1
+ import { type InjectionKey, type SinwanNode } from "sinwan/component";
2
+ import { For, Show } from "sinwan/control-flow";
3
+ import { type Computed, type Signal } from "sinwan/reactivity";
4
+ import { Slot } from "./slot";
5
+ export declare const TabsKey: InjectionKey<{
6
+ value: Signal<string> | Computed<string>;
7
+ setValue: (v: string) => void;
8
+ }>;
9
+ export declare const TabsRoot: import("sinwan/component").SinwanComponent<{
10
+ children?: SinwanNode;
11
+ value?: string;
12
+ defaultValue?: string;
13
+ onValueChange?: (v: string) => void;
14
+ class?: string;
15
+ orientation?: "horizontal" | "vertical";
16
+ }>;
17
+ export declare const TabsList: import("sinwan/component").SinwanComponent<{
18
+ children?: SinwanNode;
19
+ class?: string;
20
+ "data-variant"?: string;
21
+ }>;
22
+ export declare const TabsTrigger: import("sinwan/component").SinwanComponent<{
23
+ children?: SinwanNode;
24
+ class?: string;
25
+ value: string;
26
+ disabled?: boolean;
27
+ }>;
28
+ export declare const TabsContent: import("sinwan/component").SinwanComponent<{
29
+ children?: SinwanNode;
30
+ class?: string;
31
+ value: string;
32
+ }>;
33
+ export declare const AccordionKey: InjectionKey<{
34
+ type: "single" | "multiple";
35
+ value: Signal<string[]> | Computed<string[]>;
36
+ toggle: (item: string) => void;
37
+ }>;
38
+ export declare const AccordionItemKey: InjectionKey<{
39
+ value: string;
40
+ }>;
41
+ export declare const AccordionRoot: import("sinwan/component").SinwanComponent<{
42
+ children?: SinwanNode;
43
+ type?: "single" | "multiple";
44
+ value?: string | string[];
45
+ defaultValue?: string | string[];
46
+ onValueChange?: (v: string | string[]) => void;
47
+ class?: string;
48
+ collapsible?: boolean;
49
+ }>;
50
+ export declare const AccordionItem: import("sinwan/component").SinwanComponent<{
51
+ children?: SinwanNode;
52
+ class?: string;
53
+ value: string;
54
+ }>;
55
+ export declare const AccordionTrigger: import("sinwan/component").SinwanComponent<{
56
+ children?: SinwanNode;
57
+ class?: string;
58
+ }>;
59
+ export declare const AccordionContent: import("sinwan/component").SinwanComponent<{
60
+ children?: SinwanNode;
61
+ class?: string;
62
+ }>;
63
+ export declare const CheckboxRoot: import("sinwan/component").SinwanComponent<{
64
+ checked?: boolean;
65
+ indeterminate?: boolean;
66
+ defaultChecked?: boolean;
67
+ onCheckedChange?: (checked: boolean) => void;
68
+ disabled?: boolean;
69
+ class?: string;
70
+ id?: string;
71
+ name?: string;
72
+ value?: string;
73
+ "aria-label"?: string;
74
+ children?: SinwanNode;
75
+ }>;
76
+ export declare const SwitchRoot: import("sinwan/component").SinwanComponent<{
77
+ checked?: boolean;
78
+ defaultChecked?: boolean;
79
+ onCheckedChange?: (checked: boolean) => void;
80
+ disabled?: boolean;
81
+ class?: string;
82
+ id?: string;
83
+ children?: SinwanNode;
84
+ "data-size"?: string;
85
+ }>;
86
+ export declare const RadioGroupKey: InjectionKey<{
87
+ value: Signal<string> | Computed<string>;
88
+ setValue: (v: string) => void;
89
+ name?: string;
90
+ }>;
91
+ export declare const RadioGroupRoot: import("sinwan/component").SinwanComponent<{
92
+ children?: SinwanNode;
93
+ value?: string;
94
+ defaultValue?: string;
95
+ onValueChange?: (v: string) => void;
96
+ class?: string;
97
+ name?: string;
98
+ }>;
99
+ export declare const RadioGroupItem: import("sinwan/component").SinwanComponent<{
100
+ value: string;
101
+ class?: string;
102
+ disabled?: boolean;
103
+ id?: string;
104
+ children?: SinwanNode;
105
+ }>;
106
+ export declare const ToggleRoot: import("sinwan/component").SinwanComponent<{
107
+ pressed?: boolean;
108
+ defaultPressed?: boolean;
109
+ onPressedChange?: (pressed: boolean) => void;
110
+ disabled?: boolean;
111
+ class?: string;
112
+ children?: SinwanNode;
113
+ }>;
114
+ export declare const ToggleGroupKey: InjectionKey<{
115
+ type: "single" | "multiple";
116
+ value: Signal<string[]> | Computed<string[]>;
117
+ toggle: (v: string) => void;
118
+ }>;
119
+ export declare const ToggleGroupRoot: import("sinwan/component").SinwanComponent<{
120
+ children?: SinwanNode;
121
+ type?: "single" | "multiple";
122
+ value?: string | string[];
123
+ defaultValue?: string | string[];
124
+ onValueChange?: (v: string | string[]) => void;
125
+ class?: string;
126
+ style?: Record<string, string> | string;
127
+ "data-variant"?: string;
128
+ "data-size"?: string;
129
+ "data-spacing"?: string | number;
130
+ "data-orientation"?: string;
131
+ }>;
132
+ export declare const ToggleGroupItem: import("sinwan/component").SinwanComponent<{
133
+ children?: SinwanNode;
134
+ class?: string;
135
+ value: string;
136
+ disabled?: boolean;
137
+ "data-variant"?: string;
138
+ "data-size"?: string;
139
+ "data-spacing"?: string | number;
140
+ }>;
141
+ export { For, Show, Slot };
@@ -0,0 +1,55 @@
1
+ import {
2
+ For2,
3
+ Show2,
4
+ TabsKey2,
5
+ TabsRoot2,
6
+ TabsList2,
7
+ TabsTrigger2,
8
+ TabsContent2,
9
+ AccordionKey2,
10
+ AccordionItemKey2,
11
+ AccordionRoot2,
12
+ AccordionItem2,
13
+ AccordionTrigger2,
14
+ AccordionContent2,
15
+ CheckboxRoot2,
16
+ SwitchRoot2,
17
+ RadioGroupKey2,
18
+ RadioGroupRoot2,
19
+ RadioGroupItem2,
20
+ ToggleRoot2,
21
+ ToggleGroupKey2,
22
+ ToggleGroupRoot2,
23
+ ToggleGroupItem2
24
+ } from "./chunks/chunk-te52bwb8.js";
25
+ import {
26
+ Slot2
27
+ } from "./chunks/chunk-bw9vp0y9.js";
28
+ import"./chunks/chunk-7r6fwdyt.js";
29
+ import"./chunks/chunk-ejwby1pn.js";
30
+ import"./chunks/chunk-6r59k5mb.js";
31
+ export {
32
+ AccordionContent2 as AccordionContent,
33
+ AccordionItem2 as AccordionItem,
34
+ AccordionItemKey2 as AccordionItemKey,
35
+ AccordionKey2 as AccordionKey,
36
+ AccordionRoot2 as AccordionRoot,
37
+ AccordionTrigger2 as AccordionTrigger,
38
+ CheckboxRoot2 as CheckboxRoot,
39
+ For2 as For,
40
+ RadioGroupItem2 as RadioGroupItem,
41
+ RadioGroupKey2 as RadioGroupKey,
42
+ RadioGroupRoot2 as RadioGroupRoot,
43
+ Show2 as Show,
44
+ Slot2 as Slot,
45
+ SwitchRoot2 as SwitchRoot,
46
+ TabsContent2 as TabsContent,
47
+ TabsKey2 as TabsKey,
48
+ TabsList2 as TabsList,
49
+ TabsRoot2 as TabsRoot,
50
+ TabsTrigger2 as TabsTrigger,
51
+ ToggleGroupItem2 as ToggleGroupItem,
52
+ ToggleGroupKey2 as ToggleGroupKey,
53
+ ToggleGroupRoot2 as ToggleGroupRoot,
54
+ ToggleRoot2 as ToggleRoot
55
+ };
package/dist/core.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { type SinwanNode } from "sinwan/component";
2
+ import { Portal as SinwanPortal, Show } from "sinwan/control-flow";
3
+ import { signal, type Signal } from "sinwan/reactivity";
4
+ export type PresenceProps = {
5
+ present?: boolean;
6
+ exitMs?: number;
7
+ children?: SinwanNode;
8
+ };
9
+ /** Keep children mounted through CSS exit (`data-state=closed`) before unmount. */
10
+ export declare const Presence: import("sinwan/component").SinwanComponent<PresenceProps>;
11
+ export type UiPortalProps = {
12
+ children?: SinwanNode;
13
+ container?: HTMLElement | null | (() => HTMLElement | null);
14
+ };
15
+ export declare const UiPortal: import("sinwan/component").SinwanComponent<UiPortalProps>;
16
+ export declare function useControllableState<T>(options: {
17
+ value?: T | (() => T);
18
+ defaultValue: T;
19
+ onChange?: (value: T) => void;
20
+ }): [Signal<T>, (value: T | ((prev: T) => T)) => void];
21
+ export declare function getFocusableElements(root: HTMLElement): HTMLElement[];
22
+ export declare function trapFocus(event: KeyboardEvent, root: HTMLElement): void;
23
+ export { basePlacement, computePosition, createPointReference, createRectReference, createSizeFloating, estimatePosition, readDocumentRtl, toFloatingPlacement, useAnchorPosition, usePointPosition, type Align, type FloatingPosition, type FloatingStyle, type Placement, type RectLike, type UseAnchorPositionOptions, type UsePointPositionOptions, } from "./floating";
24
+ export { signal, Show, SinwanPortal };
package/dist/core.js ADDED
@@ -0,0 +1,42 @@
1
+ import {
2
+ SinwanPortal2,
3
+ Show3,
4
+ signal2,
5
+ Presence2,
6
+ UiPortal2,
7
+ useControllableState2,
8
+ getFocusableElements2,
9
+ trapFocus2
10
+ } from "./chunks/chunk-ejwby1pn.js";
11
+ import {
12
+ toFloatingPlacement2,
13
+ basePlacement2,
14
+ readDocumentRtl2,
15
+ createRectReference2,
16
+ createSizeFloating2,
17
+ createPointReference2,
18
+ computePosition2,
19
+ estimatePosition2,
20
+ useAnchorPosition2,
21
+ usePointPosition2
22
+ } from "./chunks/chunk-6r59k5mb.js";
23
+ export {
24
+ Presence2 as Presence,
25
+ Show3 as Show,
26
+ SinwanPortal2 as SinwanPortal,
27
+ UiPortal2 as UiPortal,
28
+ basePlacement2 as basePlacement,
29
+ computePosition2 as computePosition,
30
+ createPointReference2 as createPointReference,
31
+ createRectReference2 as createRectReference,
32
+ createSizeFloating2 as createSizeFloating,
33
+ estimatePosition2 as estimatePosition,
34
+ getFocusableElements2 as getFocusableElements,
35
+ readDocumentRtl2 as readDocumentRtl,
36
+ signal2 as signal,
37
+ toFloatingPlacement2 as toFloatingPlacement,
38
+ trapFocus2 as trapFocus,
39
+ useAnchorPosition2 as useAnchorPosition,
40
+ useControllableState2 as useControllableState,
41
+ usePointPosition2 as usePointPosition
42
+ };
@@ -0,0 +1,15 @@
1
+ import { type InjectionKey, type SinwanNode } from "sinwan/component";
2
+ export type Direction = "ltr" | "rtl";
3
+ export type DirectionApi = {
4
+ dir: {
5
+ readonly value: Direction;
6
+ };
7
+ setDir: (dir: Direction) => void;
8
+ };
9
+ export declare const DirectionKey: InjectionKey<DirectionApi>;
10
+ export type DirectionProviderProps = {
11
+ children?: SinwanNode;
12
+ dir?: Direction;
13
+ };
14
+ export declare const DirectionProvider: import("sinwan/component").SinwanComponent<DirectionProviderProps>;
15
+ export declare function useDirection(): Direction;
@@ -0,0 +1,10 @@
1
+ import {
2
+ DirectionKey2,
3
+ DirectionProvider2,
4
+ useDirection2
5
+ } from "./chunks/chunk-f6hw8ash.js";
6
+ export {
7
+ DirectionKey2 as DirectionKey,
8
+ DirectionProvider2 as DirectionProvider,
9
+ useDirection2 as useDirection
10
+ };
@@ -0,0 +1 @@
1
+ export declare function isDismissExemptPointerTarget(target: EventTarget | null): boolean;
@@ -0,0 +1,6 @@
1
+ import {
2
+ isDismissExemptPointerTarget2
3
+ } from "./chunks/chunk-9whagkb6.js";
4
+ export {
5
+ isDismissExemptPointerTarget2 as isDismissExemptPointerTarget
6
+ };
@@ -0,0 +1,105 @@
1
+ import { type Placement as FuiPlacement } from "@floating-ui/dom";
2
+ import { type Computed, type Signal } from "sinwan/reactivity";
3
+ type SignalOrComputed<T> = Signal<T> | Computed<T>;
4
+ export type Placement = "top" | "right" | "bottom" | "left";
5
+ export type Align = "start" | "center" | "end";
6
+ export type FloatingStyle = Record<string, string>;
7
+ export type RectLike = {
8
+ top: number;
9
+ left: number;
10
+ bottom: number;
11
+ right: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ /** Map sinwan-ui side + align to Floating UI placement (`bottom-start`, …). */
16
+ export declare function toFloatingPlacement(placement?: Placement, align?: Align): FuiPlacement;
17
+ export declare function basePlacement(placement: FuiPlacement | string): Placement;
18
+ /** LTR-safe RTL probe for Floating UI (Happy-DOM-safe). */
19
+ export declare function readDocumentRtl(): boolean;
20
+ export type VirtualClientRect = {
21
+ x: number;
22
+ y: number;
23
+ width: number;
24
+ height: number;
25
+ top: number;
26
+ right: number;
27
+ bottom: number;
28
+ left: number;
29
+ toJSON(): VirtualClientRect;
30
+ };
31
+ export declare function createRectReference(rect: RectLike): {
32
+ getBoundingClientRect(): VirtualClientRect;
33
+ };
34
+ export declare function createSizeFloating(width: number, height: number): {
35
+ getBoundingClientRect(): VirtualClientRect;
36
+ };
37
+ export declare function createPointReference(x: number, y: number): {
38
+ getBoundingClientRect(): VirtualClientRect;
39
+ };
40
+ /**
41
+ * Position a floating box relative to an anchor rect using @floating-ui/dom
42
+ * (offset, flip, shift). Falls back to `estimatePosition` if Floating UI fails.
43
+ */
44
+ export declare function computePosition(anchor: RectLike, content: {
45
+ width: number;
46
+ height: number;
47
+ }, placement?: Placement, align?: Align, gap?: number): Promise<{
48
+ top: number;
49
+ left: number;
50
+ placement: FuiPlacement;
51
+ }>;
52
+ /**
53
+ * Sync estimate for first paint (before Floating UI's async refine).
54
+ * Matches basic offset + align; flip/shift apply on the next Floating UI pass.
55
+ */
56
+ export declare function estimatePosition(anchor: RectLike, content: {
57
+ width: number;
58
+ height: number;
59
+ }, placement?: Placement, align?: Align, gap?: number): {
60
+ top: number;
61
+ left: number;
62
+ };
63
+ export type UseAnchorPositionOptions = {
64
+ open: SignalOrComputed<boolean>;
65
+ trigger: SignalOrComputed<HTMLElement | null>;
66
+ content?: SignalOrComputed<HTMLElement | null>;
67
+ placement?: Placement;
68
+ align?: Align;
69
+ gap?: number;
70
+ fallbackSize?: {
71
+ width: number;
72
+ height: number;
73
+ };
74
+ extra?: (anchor: DOMRect) => Record<string, string>;
75
+ };
76
+ export type FloatingPosition = {
77
+ style: Signal<FloatingStyle>;
78
+ ready: Signal<boolean>;
79
+ /** Resolved base side after Floating UI flip (for `data-side`). */
80
+ side: Signal<Placement>;
81
+ present: {
82
+ readonly value: boolean;
83
+ };
84
+ };
85
+ /**
86
+ * Anchor a fixed layer to a trigger with @floating-ui/dom.
87
+ * `present` places synchronously for the first paint, then Floating UI refines
88
+ * with flip/shift and `autoUpdate` while open.
89
+ */
90
+ export declare function useAnchorPosition(options: UseAnchorPositionOptions): FloatingPosition;
91
+ export type UsePointPositionOptions = {
92
+ open: SignalOrComputed<boolean>;
93
+ point: SignalOrComputed<{
94
+ x: number;
95
+ y: number;
96
+ }>;
97
+ content?: SignalOrComputed<HTMLElement | null>;
98
+ fallbackSize?: {
99
+ width: number;
100
+ height: number;
101
+ };
102
+ };
103
+ /** Position a layer at a pointer coordinate (context menu) via Floating UI. */
104
+ export declare function usePointPosition(options: UsePointPositionOptions): FloatingPosition;
105
+ export {};
@@ -0,0 +1,24 @@
1
+ import {
2
+ toFloatingPlacement2,
3
+ basePlacement2,
4
+ readDocumentRtl2,
5
+ createRectReference2,
6
+ createSizeFloating2,
7
+ createPointReference2,
8
+ computePosition2,
9
+ estimatePosition2,
10
+ useAnchorPosition2,
11
+ usePointPosition2
12
+ } from "./chunks/chunk-6r59k5mb.js";
13
+ export {
14
+ basePlacement2 as basePlacement,
15
+ computePosition2 as computePosition,
16
+ createPointReference2 as createPointReference,
17
+ createRectReference2 as createRectReference,
18
+ createSizeFloating2 as createSizeFloating,
19
+ estimatePosition2 as estimatePosition,
20
+ readDocumentRtl2 as readDocumentRtl,
21
+ toFloatingPlacement2 as toFloatingPlacement,
22
+ useAnchorPosition2 as useAnchorPosition,
23
+ usePointPosition2 as usePointPosition
24
+ };
@@ -0,0 +1,10 @@
1
+ export * from "./controls";
2
+ export * from "./core";
3
+ export * from "./direction";
4
+ export * from "./dismiss";
5
+ export * from "./floating";
6
+ export * from "./menu-sub";
7
+ export * from "./overlay";
8
+ export * from "./slot";
9
+ export * from "./theme";
10
+ export * from "./types";
package/dist/index.js ADDED
@@ -0,0 +1,166 @@
1
+ import {
2
+ isSinwanElement2,
3
+ flattenChildren2
4
+ } from "./chunks/chunk-7r6fwdyt.js";
5
+ import {
6
+ Slot2
7
+ } from "./chunks/chunk-bw9vp0y9.js";
8
+ import {
9
+ toFloatingPlacement2,
10
+ basePlacement2,
11
+ readDocumentRtl2,
12
+ createRectReference2,
13
+ createSizeFloating2,
14
+ createPointReference2,
15
+ computePosition2,
16
+ estimatePosition2,
17
+ useAnchorPosition2,
18
+ usePointPosition2
19
+ } from "./chunks/chunk-6r59k5mb.js";
20
+ import {
21
+ SinwanPortal2,
22
+ signal2,
23
+ Presence2,
24
+ UiPortal2,
25
+ useControllableState2,
26
+ getFocusableElements2,
27
+ trapFocus2
28
+ } from "./chunks/chunk-ejwby1pn.js";
29
+ import {
30
+ For2,
31
+ TabsKey2,
32
+ TabsRoot2,
33
+ TabsList2,
34
+ TabsTrigger2,
35
+ TabsContent2,
36
+ AccordionKey2,
37
+ AccordionItemKey2,
38
+ AccordionRoot2,
39
+ AccordionItem2,
40
+ AccordionTrigger2,
41
+ AccordionContent2,
42
+ CheckboxRoot2,
43
+ SwitchRoot2,
44
+ RadioGroupKey2,
45
+ RadioGroupRoot2,
46
+ RadioGroupItem2,
47
+ ToggleRoot2,
48
+ ToggleGroupKey2,
49
+ ToggleGroupRoot2,
50
+ ToggleGroupItem2
51
+ } from "./chunks/chunk-te52bwb8.js";
52
+ import {
53
+ DirectionKey2,
54
+ DirectionProvider2,
55
+ useDirection2
56
+ } from "./chunks/chunk-f6hw8ash.js";
57
+ import {
58
+ isDismissExemptPointerTarget2
59
+ } from "./chunks/chunk-9whagkb6.js";
60
+ import {
61
+ createMenuSubApi2,
62
+ createMenuSubTriggerHandlers2,
63
+ isInsideMenuSubContent2,
64
+ MenuSubContentLayer2
65
+ } from "./chunks/chunk-8zvv4kad.js";
66
+ import {
67
+ DialogKey2,
68
+ DialogRoot2,
69
+ DialogTrigger2,
70
+ DialogClose2,
71
+ DialogOverlay2,
72
+ DialogContent2,
73
+ CollapsibleKey2,
74
+ CollapsibleRoot2,
75
+ CollapsibleTrigger2,
76
+ CollapsibleContent2,
77
+ PopoverKey2,
78
+ PopoverRoot2,
79
+ PopoverTrigger2,
80
+ PopoverContent2,
81
+ TooltipKey2,
82
+ TooltipProvider2,
83
+ TooltipRoot2,
84
+ TooltipTrigger2,
85
+ TooltipContent2
86
+ } from "./chunks/chunk-94xhejch.js";
87
+ import {
88
+ ThemeKey2,
89
+ ThemeProvider2,
90
+ useTheme2,
91
+ ThemeToggle2
92
+ } from "./chunks/chunk-3zrktrd2.js";
93
+ export {
94
+ AccordionContent2 as AccordionContent,
95
+ AccordionItem2 as AccordionItem,
96
+ AccordionItemKey2 as AccordionItemKey,
97
+ AccordionKey2 as AccordionKey,
98
+ AccordionRoot2 as AccordionRoot,
99
+ AccordionTrigger2 as AccordionTrigger,
100
+ CheckboxRoot2 as CheckboxRoot,
101
+ CollapsibleContent2 as CollapsibleContent,
102
+ CollapsibleKey2 as CollapsibleKey,
103
+ CollapsibleRoot2 as CollapsibleRoot,
104
+ CollapsibleTrigger2 as CollapsibleTrigger,
105
+ DialogClose2 as DialogClose,
106
+ DialogContent2 as DialogContent,
107
+ DialogKey2 as DialogKey,
108
+ DialogOverlay2 as DialogOverlay,
109
+ DialogRoot2 as DialogRoot,
110
+ DialogTrigger2 as DialogTrigger,
111
+ DirectionKey2 as DirectionKey,
112
+ DirectionProvider2 as DirectionProvider,
113
+ For2 as For,
114
+ MenuSubContentLayer2 as MenuSubContentLayer,
115
+ PopoverContent2 as PopoverContent,
116
+ PopoverKey2 as PopoverKey,
117
+ PopoverRoot2 as PopoverRoot,
118
+ PopoverTrigger2 as PopoverTrigger,
119
+ Presence2 as Presence,
120
+ RadioGroupItem2 as RadioGroupItem,
121
+ RadioGroupKey2 as RadioGroupKey,
122
+ RadioGroupRoot2 as RadioGroupRoot,
123
+ SinwanPortal2 as SinwanPortal,
124
+ Slot2 as Slot,
125
+ SwitchRoot2 as SwitchRoot,
126
+ TabsContent2 as TabsContent,
127
+ TabsKey2 as TabsKey,
128
+ TabsList2 as TabsList,
129
+ TabsRoot2 as TabsRoot,
130
+ TabsTrigger2 as TabsTrigger,
131
+ ThemeKey2 as ThemeKey,
132
+ ThemeProvider2 as ThemeProvider,
133
+ ThemeToggle2 as ThemeToggle,
134
+ ToggleGroupItem2 as ToggleGroupItem,
135
+ ToggleGroupKey2 as ToggleGroupKey,
136
+ ToggleGroupRoot2 as ToggleGroupRoot,
137
+ ToggleRoot2 as ToggleRoot,
138
+ TooltipContent2 as TooltipContent,
139
+ TooltipKey2 as TooltipKey,
140
+ TooltipProvider2 as TooltipProvider,
141
+ TooltipRoot2 as TooltipRoot,
142
+ TooltipTrigger2 as TooltipTrigger,
143
+ UiPortal2 as UiPortal,
144
+ basePlacement2 as basePlacement,
145
+ computePosition2 as computePosition,
146
+ createMenuSubApi2 as createMenuSubApi,
147
+ createMenuSubTriggerHandlers2 as createMenuSubTriggerHandlers,
148
+ createPointReference2 as createPointReference,
149
+ createRectReference2 as createRectReference,
150
+ createSizeFloating2 as createSizeFloating,
151
+ estimatePosition2 as estimatePosition,
152
+ flattenChildren2 as flattenChildren,
153
+ getFocusableElements2 as getFocusableElements,
154
+ isDismissExemptPointerTarget2 as isDismissExemptPointerTarget,
155
+ isInsideMenuSubContent2 as isInsideMenuSubContent,
156
+ isSinwanElement2 as isSinwanElement,
157
+ readDocumentRtl2 as readDocumentRtl,
158
+ signal2 as signal,
159
+ toFloatingPlacement2 as toFloatingPlacement,
160
+ trapFocus2 as trapFocus,
161
+ useAnchorPosition2 as useAnchorPosition,
162
+ useControllableState2 as useControllableState,
163
+ useDirection2 as useDirection,
164
+ usePointPosition2 as usePointPosition,
165
+ useTheme2 as useTheme
166
+ };
@@ -0,0 +1,34 @@
1
+ import { type SinwanNode } from "sinwan/component";
2
+ import { type Computed, type Signal } from "sinwan/reactivity";
3
+ export type MenuSubApi = {
4
+ open: Signal<boolean> | Computed<boolean>;
5
+ setOpen: (value: boolean) => void;
6
+ triggerEl: Signal<HTMLElement | null>;
7
+ cancelClose: () => void;
8
+ requestClose: (delayMs?: number) => void;
9
+ };
10
+ export type MenuSubOptions = {
11
+ controlled: boolean;
12
+ defaultOpen?: boolean;
13
+ readOpen: () => boolean;
14
+ onOpenChange?: (open: boolean) => void;
15
+ /** Open state of the menu or submenu that contains this submenu; the sub closes when it turns false. */
16
+ parentOpen?: () => boolean;
17
+ };
18
+ export type MenuSubTriggerHandlers = {
19
+ onMouseEnter: () => void;
20
+ onMouseLeave: () => void;
21
+ onClick: () => void;
22
+ onKeyDown: (event: KeyboardEvent) => void;
23
+ };
24
+ export declare function createMenuSubApi(options: MenuSubOptions): MenuSubApi;
25
+ /** Hover, click and ArrowRight open the sub (never toggle it closed); leaving starts the hover close delay. */
26
+ export declare function createMenuSubTriggerHandlers(api: MenuSubApi): MenuSubTriggerHandlers;
27
+ export declare function isInsideMenuSubContent(target: EventTarget | null): boolean;
28
+ export type MenuSubContentLayerProps = {
29
+ api: MenuSubApi;
30
+ slot: string;
31
+ class?: string;
32
+ children?: SinwanNode;
33
+ };
34
+ export declare function MenuSubContentLayer(props: MenuSubContentLayerProps): SinwanNode;
@@ -0,0 +1,14 @@
1
+ import {
2
+ createMenuSubApi2,
3
+ createMenuSubTriggerHandlers2,
4
+ isInsideMenuSubContent2,
5
+ MenuSubContentLayer2
6
+ } from "./chunks/chunk-8zvv4kad.js";
7
+ import"./chunks/chunk-ejwby1pn.js";
8
+ import"./chunks/chunk-6r59k5mb.js";
9
+ export {
10
+ MenuSubContentLayer2 as MenuSubContentLayer,
11
+ createMenuSubApi2 as createMenuSubApi,
12
+ createMenuSubTriggerHandlers2 as createMenuSubTriggerHandlers,
13
+ isInsideMenuSubContent2 as isInsideMenuSubContent
14
+ };