sinwan-ui-core 0.0.0 → 1.0.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,189 @@
1
+ // src/theme.tsx
2
+ import { _$createTemplate } from "sinwan/renderer/web";
3
+ import { unwrap as _$unwrap } from "sinwan/reactivity";
4
+ import {
5
+ cc,
6
+ inject,
7
+ onMounted,
8
+ onUnmounted,
9
+ provide
10
+ } from "sinwan/component";
11
+ import { batch, computed, signal } from "sinwan/reactivity";
12
+ import { jsx, Fragment } from "sinwan/jsx-runtime";
13
+ var _$tmpl_0 = {
14
+ html: '<button type="button" data-slot="theme-toggle" aria-label="Toggle color theme"></button>',
15
+ slots: [
16
+ { path: [], type: "attr", name: "class" },
17
+ { path: [], type: "event", name: "onclick" },
18
+ { path: [], type: "child" }
19
+ ]
20
+ };
21
+ var DEFAULT_PALETTES = ["credit-blue", "jomlaty"];
22
+ var ThemeKey2 = Symbol("sinwan-ui.theme");
23
+ function isTheme(value) {
24
+ return value === "light" || value === "dark" || value === "system";
25
+ }
26
+ function isPalette(value, allowed) {
27
+ return value !== null && allowed.includes(value);
28
+ }
29
+ function readStoredTheme(storageKey, fallback) {
30
+ if (typeof localStorage === "undefined")
31
+ return fallback;
32
+ try {
33
+ const value = localStorage.getItem(storageKey);
34
+ if (isTheme(value))
35
+ return value;
36
+ } catch {}
37
+ return fallback;
38
+ }
39
+ function readStoredPalette(storageKey, fallback, allowed) {
40
+ if (typeof localStorage === "undefined")
41
+ return fallback;
42
+ try {
43
+ const value = localStorage.getItem(storageKey);
44
+ if (isPalette(value, allowed))
45
+ return value;
46
+ } catch {}
47
+ return fallback;
48
+ }
49
+ function getSystemTheme() {
50
+ if (typeof window === "undefined" || !window.matchMedia)
51
+ return "light";
52
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
53
+ }
54
+ function disableTransitionsTemporarily() {
55
+ const style = document.createElement("style");
56
+ style.appendChild(document.createTextNode("*,*::before,*::after{transition:none!important;animation:none!important}"));
57
+ document.head.appendChild(style);
58
+ return () => {
59
+ window.getComputedStyle(document.body);
60
+ requestAnimationFrame(() => {
61
+ style.parentNode?.removeChild(style);
62
+ });
63
+ };
64
+ }
65
+ function writeDomTheme(next, attribute) {
66
+ if (typeof document === "undefined")
67
+ return;
68
+ const root = document.documentElement;
69
+ if (attribute === "class") {
70
+ root.classList.remove("light", "dark");
71
+ root.classList.add(next);
72
+ } else {
73
+ root.setAttribute("data-theme", next);
74
+ }
75
+ root.style.colorScheme = next;
76
+ }
77
+ function writeDomPalette(next) {
78
+ if (typeof document === "undefined")
79
+ return;
80
+ document.documentElement.setAttribute("data-palette", next);
81
+ }
82
+ var ThemeProvider2 = cc((props) => {
83
+ const allowedPalettes = (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
84
+ const initialTheme = props.forcedTheme ?? readStoredTheme(props.storageKey === undefined ? "sinwan-ui-theme" : props.storageKey, props.defaultTheme === undefined ? "system" : props.defaultTheme);
85
+ const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "credit-blue" : props.defaultPalette, allowedPalettes);
86
+ const theme = signal(initialTheme);
87
+ const palette = signal(initialPalette);
88
+ const resolved = signal(initialTheme === "system" ? getSystemTheme() : initialTheme);
89
+ const resolve = (value) => {
90
+ if (props.forcedTheme === "light" || props.forcedTheme === "dark")
91
+ return props.forcedTheme;
92
+ if (props.forcedTheme === "system")
93
+ return getSystemTheme();
94
+ if (value === "system")
95
+ return (props.enableSystem === undefined ? true : props.enableSystem) ? getSystemTheme() : "light";
96
+ return value;
97
+ };
98
+ const withTransitionLock = (apply) => {
99
+ const restore = (props.disableTransitionOnChange === undefined ? true : props.disableTransitionOnChange) && typeof document !== "undefined" ? disableTransitionsTemporarily() : null;
100
+ apply();
101
+ restore?.();
102
+ };
103
+ const commit = (value, nextTheme) => {
104
+ const next = resolve(value);
105
+ withTransitionLock(() => {
106
+ writeDomTheme(next, props.attribute === undefined ? "class" : props.attribute);
107
+ writeDomPalette(palette.value);
108
+ batch(() => {
109
+ if (nextTheme !== undefined) {
110
+ theme.value = nextTheme;
111
+ }
112
+ resolved.value = next;
113
+ });
114
+ });
115
+ };
116
+ const commitPalette = (next) => {
117
+ withTransitionLock(() => {
118
+ writeDomPalette(next);
119
+ writeDomTheme(resolved.value, props.attribute === undefined ? "class" : props.attribute);
120
+ palette.value = next;
121
+ });
122
+ };
123
+ const setTheme = (value) => {
124
+ if (props.forcedTheme)
125
+ return;
126
+ try {
127
+ localStorage.setItem(props.storageKey === undefined ? "sinwan-ui-theme" : props.storageKey, value);
128
+ } catch {}
129
+ commit(value, value);
130
+ };
131
+ const setPalette = (value) => {
132
+ if (props.forcedPalette)
133
+ return;
134
+ if (!allowedPalettes.includes(value))
135
+ return;
136
+ try {
137
+ localStorage.setItem(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, value);
138
+ } catch {}
139
+ commitPalette(value);
140
+ };
141
+ onMounted(() => {
142
+ commit(theme.value);
143
+ writeDomPalette(palette.value);
144
+ if (!(props.enableSystem === undefined ? true : props.enableSystem))
145
+ return;
146
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
147
+ const onChange = () => {
148
+ if (theme.value === "system" || props.forcedTheme === "system") {
149
+ commit("system");
150
+ }
151
+ };
152
+ mq.addEventListener("change", onChange);
153
+ onUnmounted(() => mq.removeEventListener("change", onChange));
154
+ });
155
+ provide(ThemeKey2, {
156
+ theme,
157
+ resolved,
158
+ setTheme,
159
+ themes: (props.enableSystem === undefined ? true : props.enableSystem) ? ["light", "dark", "system"] : ["light", "dark"],
160
+ palette,
161
+ setPalette,
162
+ palettes: allowedPalettes
163
+ });
164
+ computed(() => resolved.value);
165
+ computed(() => palette.value);
166
+ return /* @__PURE__ */ jsx(Fragment, {
167
+ children: () => _$unwrap(props).children
168
+ });
169
+ });
170
+ function useTheme2() {
171
+ const api = inject(ThemeKey2);
172
+ if (!api) {
173
+ throw new Error("useTheme() must be used within a ThemeProvider");
174
+ }
175
+ return api;
176
+ }
177
+ var ThemeToggle2 = cc((props) => {
178
+ const { theme, resolved, setTheme } = useTheme2();
179
+ return _$createTemplate(_$tmpl_0, [
180
+ () => _$unwrap(props).class,
181
+ () => {
182
+ const next = theme.value === "system" ? resolved.value === "dark" ? "light" : "dark" : theme.value === "dark" ? "light" : "dark";
183
+ setTheme(next);
184
+ },
185
+ () => _$unwrap(props).children ?? (resolved.value === "dark" ? "Light" : "Dark")
186
+ ]);
187
+ });
188
+
189
+ export { ThemeKey2, ThemeProvider2, useTheme2, ThemeToggle2 };
@@ -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";