rockin 0.0.39 → 0.0.41
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/dist/chunk-4ILCWFOE.js +18 -0
- package/dist/chunk-GL2CQ5TR.js +78 -0
- package/dist/{chunk-6JS62NO4.js → chunk-ILKXRTV2.js} +2 -2
- package/dist/chunk-UZGJXAFX.js +41 -0
- package/dist/{chunk-G3RYS466.js → chunk-YA5PSI7E.js} +6 -2
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +257 -18
- package/dist/index.d.ts +38 -0
- package/dist/index.js +2 -2
- package/dist/layout.js +2 -5
- package/dist/lib/index.d.ts +43 -1
- package/dist/lib/index.js +5 -1
- package/dist/provider.d.ts +0 -1
- package/dist/provider.js +3 -3
- package/dist/sdk/accordion.d.ts +1 -0
- package/dist/sdk/accordion.js +1 -0
- package/dist/sdk/agent.d.ts +1 -0
- package/dist/sdk/agent.js +1 -0
- package/dist/sdk/alert-dialog.d.ts +1 -0
- package/dist/sdk/alert-dialog.js +1 -0
- package/dist/sdk/async-options.d.ts +1 -0
- package/dist/sdk/async-options.js +1 -0
- package/dist/sdk/autocomplete.d.ts +1 -0
- package/dist/sdk/autocomplete.js +1 -0
- package/dist/sdk/avatar.d.ts +1 -0
- package/dist/sdk/avatar.js +1 -0
- package/dist/sdk/button.d.ts +1 -0
- package/dist/sdk/button.js +1 -0
- package/dist/sdk/calendar.d.ts +1 -0
- package/dist/sdk/calendar.js +1 -0
- package/dist/sdk/carousel.d.ts +1 -0
- package/dist/sdk/carousel.js +1 -0
- package/dist/sdk/checkbox.d.ts +1 -0
- package/dist/sdk/checkbox.js +1 -0
- package/dist/sdk/collapsible.d.ts +1 -0
- package/dist/sdk/collapsible.js +1 -0
- package/dist/sdk/color-picker.d.ts +1 -0
- package/dist/sdk/color-picker.js +1 -0
- package/dist/sdk/color.d.ts +1 -0
- package/dist/sdk/color.js +1 -0
- package/dist/sdk/combobox.d.ts +1 -0
- package/dist/sdk/combobox.js +1 -0
- package/dist/sdk/command.d.ts +1 -0
- package/dist/sdk/command.js +1 -0
- package/dist/sdk/core/accordion.d.ts +1 -0
- package/dist/sdk/core/accordion.js +1 -0
- package/dist/sdk/core/agent.d.ts +1 -0
- package/dist/sdk/core/agent.js +1 -0
- package/dist/sdk/core/alert-dialog.d.ts +1 -0
- package/dist/sdk/core/alert-dialog.js +1 -0
- package/dist/sdk/core/async-options.d.ts +1 -0
- package/dist/sdk/core/async-options.js +1 -0
- package/dist/sdk/core/autocomplete.d.ts +1 -0
- package/dist/sdk/core/autocomplete.js +1 -0
- package/dist/sdk/core/avatar.d.ts +1 -0
- package/dist/sdk/core/avatar.js +1 -0
- package/dist/sdk/core/button.d.ts +1 -0
- package/dist/sdk/core/button.js +1 -0
- package/dist/sdk/core/calendar.d.ts +1 -0
- package/dist/sdk/core/calendar.js +1 -0
- package/dist/sdk/core/carousel.d.ts +1 -0
- package/dist/sdk/core/carousel.js +1 -0
- package/dist/sdk/core/checkbox.d.ts +1 -0
- package/dist/sdk/core/checkbox.js +1 -0
- package/dist/sdk/core/collapsible.d.ts +1 -0
- package/dist/sdk/core/collapsible.js +1 -0
- package/dist/sdk/core/color-picker.d.ts +1 -0
- package/dist/sdk/core/color-picker.js +1 -0
- package/dist/sdk/core/color.d.ts +1 -0
- package/dist/sdk/core/color.js +1 -0
- package/dist/sdk/core/combobox.d.ts +1 -0
- package/dist/sdk/core/combobox.js +1 -0
- package/dist/sdk/core/command.d.ts +1 -0
- package/dist/sdk/core/command.js +1 -0
- package/dist/sdk/core/date-input.d.ts +1 -0
- package/dist/sdk/core/date-input.js +1 -0
- package/dist/sdk/core/date-picker.d.ts +1 -0
- package/dist/sdk/core/date-picker.js +1 -0
- package/dist/sdk/core/date.d.ts +1 -0
- package/dist/sdk/core/date.js +1 -0
- package/dist/sdk/core/dialog.d.ts +1 -0
- package/dist/sdk/core/dialog.js +1 -0
- package/dist/sdk/core/drawer.d.ts +1 -0
- package/dist/sdk/core/drawer.js +1 -0
- package/dist/sdk/core/field.d.ts +1 -0
- package/dist/sdk/core/field.js +1 -0
- package/dist/sdk/core/file-input.d.ts +1 -0
- package/dist/sdk/core/file-input.js +1 -0
- package/dist/sdk/core/gesture.d.ts +1 -0
- package/dist/sdk/core/gesture.js +1 -0
- package/dist/sdk/core/history.d.ts +1 -0
- package/dist/sdk/core/history.js +1 -0
- package/dist/sdk/core/hover-card.d.ts +1 -0
- package/dist/sdk/core/hover-card.js +1 -0
- package/dist/sdk/core/image-cropper.d.ts +1 -0
- package/dist/sdk/core/image-cropper.js +1 -0
- package/dist/sdk/core/image.d.ts +1 -0
- package/dist/sdk/core/image.js +1 -0
- package/dist/sdk/core/input.d.ts +1 -0
- package/dist/sdk/core/input.js +1 -0
- package/dist/sdk/core/label.d.ts +1 -0
- package/dist/sdk/core/label.js +1 -0
- package/dist/sdk/core/listbox.d.ts +1 -0
- package/dist/sdk/core/listbox.js +1 -0
- package/dist/sdk/core/menu.d.ts +1 -0
- package/dist/sdk/core/menu.js +1 -0
- package/dist/sdk/core/menubar.d.ts +1 -0
- package/dist/sdk/core/menubar.js +1 -0
- package/dist/sdk/core/meter.d.ts +1 -0
- package/dist/sdk/core/meter.js +1 -0
- package/dist/sdk/core/navigation-menu.d.ts +1 -0
- package/dist/sdk/core/navigation-menu.js +1 -0
- package/dist/sdk/core/number-input.d.ts +1 -0
- package/dist/sdk/core/number-input.js +1 -0
- package/dist/sdk/core/number.d.ts +1 -0
- package/dist/sdk/core/number.js +1 -0
- package/dist/sdk/core/observe.d.ts +1 -0
- package/dist/sdk/core/observe.js +1 -0
- package/dist/sdk/core/otp-input.d.ts +1 -0
- package/dist/sdk/core/otp-input.js +1 -0
- package/dist/sdk/core/overlays.d.ts +1 -0
- package/dist/sdk/core/overlays.js +1 -0
- package/dist/sdk/core/pagination.d.ts +1 -0
- package/dist/sdk/core/pagination.js +1 -0
- package/dist/sdk/core/password-input.d.ts +1 -0
- package/dist/sdk/core/password-input.js +1 -0
- package/dist/sdk/core/popover.d.ts +1 -0
- package/dist/sdk/core/popover.js +1 -0
- package/dist/sdk/core/progress.d.ts +1 -0
- package/dist/sdk/core/progress.js +1 -0
- package/dist/sdk/core/radio.d.ts +1 -0
- package/dist/sdk/core/radio.js +1 -0
- package/dist/sdk/core/rating.d.ts +1 -0
- package/dist/sdk/core/rating.js +1 -0
- package/dist/sdk/core/renderer.d.ts +1 -0
- package/dist/sdk/core/renderer.js +1 -0
- package/dist/sdk/core/resizable.d.ts +1 -0
- package/dist/sdk/core/resizable.js +1 -0
- package/dist/sdk/core/scroll-area.d.ts +1 -0
- package/dist/sdk/core/scroll-area.js +1 -0
- package/dist/sdk/core/segmented-control.d.ts +1 -0
- package/dist/sdk/core/segmented-control.js +1 -0
- package/dist/sdk/core/select.d.ts +1 -0
- package/dist/sdk/core/select.js +1 -0
- package/dist/sdk/core/separator.d.ts +1 -0
- package/dist/sdk/core/separator.js +1 -0
- package/dist/sdk/core/shortcuts.d.ts +1 -0
- package/dist/sdk/core/shortcuts.js +1 -0
- package/dist/sdk/core/slider.d.ts +1 -0
- package/dist/sdk/core/slider.js +1 -0
- package/dist/sdk/core/switch.d.ts +1 -0
- package/dist/sdk/core/switch.js +1 -0
- package/dist/sdk/core/tabs.d.ts +1 -0
- package/dist/sdk/core/tabs.js +1 -0
- package/dist/sdk/core/testing.d.ts +1 -0
- package/dist/sdk/core/testing.js +1 -0
- package/dist/sdk/core/text-match.d.ts +1 -0
- package/dist/sdk/core/text-match.js +1 -0
- package/dist/sdk/core/time-input.d.ts +1 -0
- package/dist/sdk/core/time-input.js +1 -0
- package/dist/sdk/core/timeline.d.ts +1 -0
- package/dist/sdk/core/timeline.js +1 -0
- package/dist/sdk/core/toast.d.ts +1 -0
- package/dist/sdk/core/toast.js +1 -0
- package/dist/sdk/core/toggle.d.ts +1 -0
- package/dist/sdk/core/toggle.js +1 -0
- package/dist/sdk/core/token-input.d.ts +1 -0
- package/dist/sdk/core/token-input.js +1 -0
- package/dist/sdk/core/toolbar.d.ts +1 -0
- package/dist/sdk/core/toolbar.js +1 -0
- package/dist/sdk/core/tooltip.d.ts +1 -0
- package/dist/sdk/core/tooltip.js +1 -0
- package/dist/sdk/core/tree.d.ts +1 -0
- package/dist/sdk/core/tree.js +1 -0
- package/dist/sdk/core/trigger-menu.d.ts +1 -0
- package/dist/sdk/core/trigger-menu.js +1 -0
- package/dist/sdk/core/waterfall.d.ts +1 -0
- package/dist/sdk/core/waterfall.js +1 -0
- package/dist/sdk/core.d.ts +1 -0
- package/dist/sdk/core.js +1 -0
- package/dist/sdk/date-input.d.ts +1 -0
- package/dist/sdk/date-input.js +1 -0
- package/dist/sdk/date-picker.d.ts +1 -0
- package/dist/sdk/date-picker.js +1 -0
- package/dist/sdk/date.d.ts +1 -0
- package/dist/sdk/date.js +1 -0
- package/dist/sdk/dialog.d.ts +1 -0
- package/dist/sdk/dialog.js +1 -0
- package/dist/sdk/drawer.d.ts +1 -0
- package/dist/sdk/drawer.js +1 -0
- package/dist/sdk/field.d.ts +1 -0
- package/dist/sdk/field.js +1 -0
- package/dist/sdk/file-input.d.ts +1 -0
- package/dist/sdk/file-input.js +1 -0
- package/dist/sdk/gesture.d.ts +1 -0
- package/dist/sdk/gesture.js +1 -0
- package/dist/sdk/history.d.ts +1 -0
- package/dist/sdk/history.js +1 -0
- package/dist/sdk/hover-card.d.ts +1 -0
- package/dist/sdk/hover-card.js +1 -0
- package/dist/sdk/image-cropper.d.ts +1 -0
- package/dist/sdk/image-cropper.js +1 -0
- package/dist/sdk/image.d.ts +1 -0
- package/dist/sdk/image.js +1 -0
- package/dist/sdk/input.d.ts +1 -0
- package/dist/sdk/input.js +1 -0
- package/dist/sdk/label.d.ts +1 -0
- package/dist/sdk/label.js +1 -0
- package/dist/sdk/listbox.d.ts +1 -0
- package/dist/sdk/listbox.js +1 -0
- package/dist/sdk/menu.d.ts +1 -0
- package/dist/sdk/menu.js +1 -0
- package/dist/sdk/menubar.d.ts +1 -0
- package/dist/sdk/menubar.js +1 -0
- package/dist/sdk/meter.d.ts +1 -0
- package/dist/sdk/meter.js +1 -0
- package/dist/sdk/navigation-menu.d.ts +1 -0
- package/dist/sdk/navigation-menu.js +1 -0
- package/dist/sdk/number-input.d.ts +1 -0
- package/dist/sdk/number-input.js +1 -0
- package/dist/sdk/number.d.ts +1 -0
- package/dist/sdk/number.js +1 -0
- package/dist/sdk/observe.d.ts +1 -0
- package/dist/sdk/observe.js +1 -0
- package/dist/sdk/otp-input.d.ts +1 -0
- package/dist/sdk/otp-input.js +1 -0
- package/dist/sdk/overlays.d.ts +1 -0
- package/dist/sdk/overlays.js +1 -0
- package/dist/sdk/pagination.d.ts +1 -0
- package/dist/sdk/pagination.js +1 -0
- package/dist/sdk/password-input.d.ts +1 -0
- package/dist/sdk/password-input.js +1 -0
- package/dist/sdk/popover.d.ts +1 -0
- package/dist/sdk/popover.js +1 -0
- package/dist/sdk/preferences.d.ts +1 -0
- package/dist/sdk/preferences.js +1 -0
- package/dist/sdk/primitive.d.ts +1 -0
- package/dist/sdk/primitive.js +1 -0
- package/dist/sdk/progress.d.ts +1 -0
- package/dist/sdk/progress.js +1 -0
- package/dist/sdk/radio.d.ts +1 -0
- package/dist/sdk/radio.js +1 -0
- package/dist/sdk/rating.d.ts +1 -0
- package/dist/sdk/rating.js +1 -0
- package/dist/sdk/resizable.d.ts +1 -0
- package/dist/sdk/resizable.js +1 -0
- package/dist/sdk/scroll-area.d.ts +1 -0
- package/dist/sdk/scroll-area.js +1 -0
- package/dist/sdk/segmented-control.d.ts +1 -0
- package/dist/sdk/segmented-control.js +1 -0
- package/dist/sdk/select.d.ts +1 -0
- package/dist/sdk/select.js +1 -0
- package/dist/sdk/separator.d.ts +1 -0
- package/dist/sdk/separator.js +1 -0
- package/dist/sdk/shortcuts.d.ts +1 -0
- package/dist/sdk/shortcuts.js +1 -0
- package/dist/sdk/slider.d.ts +1 -0
- package/dist/sdk/slider.js +1 -0
- package/dist/sdk/switch.d.ts +1 -0
- package/dist/sdk/switch.js +1 -0
- package/dist/sdk/tabs.d.ts +1 -0
- package/dist/sdk/tabs.js +1 -0
- package/dist/sdk/text-match.d.ts +1 -0
- package/dist/sdk/text-match.js +1 -0
- package/dist/sdk/textarea.d.ts +1 -0
- package/dist/sdk/textarea.js +1 -0
- package/dist/sdk/time-input.d.ts +1 -0
- package/dist/sdk/time-input.js +1 -0
- package/dist/sdk/timeline.d.ts +1 -0
- package/dist/sdk/timeline.js +1 -0
- package/dist/sdk/toast.d.ts +1 -0
- package/dist/sdk/toast.js +1 -0
- package/dist/sdk/toggle.d.ts +1 -0
- package/dist/sdk/toggle.js +1 -0
- package/dist/sdk/token-input.d.ts +1 -0
- package/dist/sdk/token-input.js +1 -0
- package/dist/sdk/toolbar.d.ts +1 -0
- package/dist/sdk/toolbar.js +1 -0
- package/dist/sdk/tooltip.d.ts +1 -0
- package/dist/sdk/tooltip.js +1 -0
- package/dist/sdk/tree.d.ts +1 -0
- package/dist/sdk/tree.js +1 -0
- package/dist/sdk/trigger-menu.d.ts +1 -0
- package/dist/sdk/trigger-menu.js +1 -0
- package/dist/sdk/waterfall.d.ts +1 -0
- package/dist/sdk/waterfall.js +1 -0
- package/dist/ui/bridge.js +1 -1
- package/dist/ui/code-block.js +2 -2
- package/dist/ui/drawer-dialog.js +411 -0
- package/dist/ui/farmer/div.js +4 -2
- package/dist/ui/index.d.ts +61 -1
- package/dist/ui/index.js +1 -0
- package/dist/ui/sonner.js +2 -2
- package/dist/ui/sortable.js +29 -64
- package/dist/ui/tabs.js +1 -1
- package/dist/ui/theme-switcher.js +3 -3
- package/dist/ui/theme-toggle.js +2 -2
- package/package.json +25 -24
- package/dist/chunk-G233W3IR.js +0 -17
- package/dist/chunk-JPOAXESG.js +0 -250
- package/dist/chunk-X56ZEDOW.js +0 -46
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usePreferences
|
|
3
|
+
} from "./chunk-YA5PSI7E.js";
|
|
4
|
+
|
|
5
|
+
// src/hooks/useMediaQuery.ts
|
|
6
|
+
import { usePreference } from "@ui-sdk/react/preferences";
|
|
7
|
+
function useMediaQuery() {
|
|
8
|
+
const device = usePreference(usePreferences().screen);
|
|
9
|
+
return {
|
|
10
|
+
device,
|
|
11
|
+
isMobile: device === "mobile",
|
|
12
|
+
isDesktop: device === "desktop"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
useMediaQuery
|
|
18
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// src/lib/preferences.ts
|
|
2
|
+
import {
|
|
3
|
+
createColorScheme,
|
|
4
|
+
createCookieStorage,
|
|
5
|
+
createPreference
|
|
6
|
+
} from "@ui-sdk/core";
|
|
7
|
+
var ACCENTS = ["slate", "violet", "mint", "gold"];
|
|
8
|
+
var DEVICES = ["mobile", "desktop"];
|
|
9
|
+
var MOBILE_QUERY = "(max-width: 767px)";
|
|
10
|
+
var PREFERENCE_COOKIES = {
|
|
11
|
+
colorScheme: "color-scheme",
|
|
12
|
+
accent: "accent",
|
|
13
|
+
device: "device"
|
|
14
|
+
};
|
|
15
|
+
function createAppPreferences(cookie) {
|
|
16
|
+
const device = createPreference({
|
|
17
|
+
values: DEVICES,
|
|
18
|
+
defaultValue: "desktop",
|
|
19
|
+
attribute: "data-device",
|
|
20
|
+
global: true,
|
|
21
|
+
storage: createCookieStorage(PREFERENCE_COOKIES.device, { cookie })
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
colorScheme: createColorScheme({
|
|
25
|
+
global: true,
|
|
26
|
+
storage: createCookieStorage(PREFERENCE_COOKIES.colorScheme, { cookie })
|
|
27
|
+
}),
|
|
28
|
+
accent: createPreference({
|
|
29
|
+
values: ACCENTS,
|
|
30
|
+
defaultValue: "slate",
|
|
31
|
+
attribute: "data-accent",
|
|
32
|
+
global: true,
|
|
33
|
+
storage: createCookieStorage(PREFERENCE_COOKIES.accent, { cookie })
|
|
34
|
+
}),
|
|
35
|
+
device,
|
|
36
|
+
screen: createScreen(device)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function createScreen(device) {
|
|
40
|
+
const read = () => window.matchMedia(MOBILE_QUERY).matches ? "mobile" : "desktop";
|
|
41
|
+
return {
|
|
42
|
+
initialState: device.initialState.value,
|
|
43
|
+
get: () => typeof window === "undefined" ? device.initialState.value : read(),
|
|
44
|
+
subscribe(listener) {
|
|
45
|
+
const list = window.matchMedia(MOBILE_QUERY);
|
|
46
|
+
const sync = () => {
|
|
47
|
+
device.set(read());
|
|
48
|
+
listener();
|
|
49
|
+
};
|
|
50
|
+
device.set(read());
|
|
51
|
+
list.addEventListener("change", sync);
|
|
52
|
+
return () => list.removeEventListener("change", sync);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function preferenceAttributes(cookie) {
|
|
57
|
+
const { colorScheme, accent, device } = createAppPreferences(cookie);
|
|
58
|
+
return {
|
|
59
|
+
[colorScheme.attribute]: colorScheme.initialState.value,
|
|
60
|
+
[accent.attribute]: accent.initialState.value,
|
|
61
|
+
[device.attribute]: device.initialState.value
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function preferencesScript(cookie) {
|
|
65
|
+
return `(()=>{const r=document.documentElement;for(const[k,v]of Object.entries(${JSON.stringify(
|
|
66
|
+
preferenceAttributes(cookie)
|
|
67
|
+
)}))r.setAttribute(k,v)})()`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
ACCENTS,
|
|
72
|
+
DEVICES,
|
|
73
|
+
MOBILE_QUERY,
|
|
74
|
+
PREFERENCE_COOKIES,
|
|
75
|
+
createAppPreferences,
|
|
76
|
+
preferenceAttributes,
|
|
77
|
+
preferencesScript
|
|
78
|
+
};
|
|
@@ -157,7 +157,7 @@ function TabsList({
|
|
|
157
157
|
shown: overflowing && !(side === "start" ? scroll.atStart : scroll.atEnd),
|
|
158
158
|
"data-no-ring": true,
|
|
159
159
|
className: cn(
|
|
160
|
-
`pointer-events-none absolute inset-y-0 z-10 inline-flex w-9 scale-75 items-center justify-center text-foreground opacity-0 transition-[opacity,scale] duration-200 outline-none data-visible:pointer-events-auto data-visible:scale-100 data-visible:opacity-100 motion-reduce:transition-none ${vertical}:inset-x-0 ${vertical}:inset-y-auto ${vertical}:h-9 ${vertical}:w-auto [&_svg]:size-4.5 [&_svg]:transition-opacity [&_svg]:duration-150 hover:[&_svg]:opacity-70`,
|
|
160
|
+
`pointer-events-none absolute inset-y-0 z-10 inline-flex w-9 scale-75 items-center justify-center text-foreground opacity-0 transition-[opacity,scale] duration-200 outline-none not-supports-[animation-timeline:scroll()]:data-visible:pointer-events-auto not-supports-[animation-timeline:scroll()]:data-visible:scale-100 not-supports-[animation-timeline:scroll()]:data-visible:opacity-100 motion-reduce:transition-none ${vertical}:inset-x-0 ${vertical}:inset-y-auto ${vertical}:h-9 ${vertical}:w-auto [&_svg]:size-4.5 [&_svg]:transition-opacity [&_svg]:duration-150 hover:[&_svg]:opacity-70`,
|
|
161
161
|
ease,
|
|
162
162
|
arrowSide[side]
|
|
163
163
|
),
|
|
@@ -175,7 +175,7 @@ function TabsList({
|
|
|
175
175
|
{
|
|
176
176
|
"data-no-ring": true,
|
|
177
177
|
className: cn(
|
|
178
|
-
"max-h-[inherit] min-w-0 flex-1 scroll-fade-x scrollbar-none outline-none [--scroll-fade-reveal:2.25rem]
|
|
178
|
+
"max-h-[inherit] min-w-0 flex-1 scroll-fade-x scroll-fade scrollbar-none outline-none [--scroll-fade-reveal:2.25rem] in-data-[orientation=vertical]:scroll-fade-y [&::-webkit-scrollbar]:hidden"
|
|
179
179
|
),
|
|
180
180
|
children: /* @__PURE__ */ jsx(Scroll.Content, { className: "w-max min-w-full", children: /* @__PURE__ */ jsx(Arrows.Track, { children: /* @__PURE__ */ jsx(
|
|
181
181
|
Tab.List,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/lib/compose-refs.ts
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
function setRef(ref, value) {
|
|
4
|
+
if (typeof ref === "function") {
|
|
5
|
+
return ref(value);
|
|
6
|
+
}
|
|
7
|
+
if (ref !== null && ref !== void 0) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function composeRefs(...refs) {
|
|
12
|
+
return (node) => {
|
|
13
|
+
let hasCleanup = false;
|
|
14
|
+
const cleanups = refs.map((ref) => {
|
|
15
|
+
const cleanup = setRef(ref, node);
|
|
16
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
17
|
+
hasCleanup = true;
|
|
18
|
+
}
|
|
19
|
+
return cleanup;
|
|
20
|
+
});
|
|
21
|
+
if (hasCleanup) {
|
|
22
|
+
return () => {
|
|
23
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
24
|
+
const cleanup = cleanups[i];
|
|
25
|
+
if (typeof cleanup === "function") {
|
|
26
|
+
cleanup();
|
|
27
|
+
} else {
|
|
28
|
+
setRef(refs[i], null);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function useComposedRefs(...refs) {
|
|
36
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
useComposedRefs
|
|
41
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAppPreferences
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GL2CQ5TR.js";
|
|
4
4
|
|
|
5
5
|
// src/theme.tsx
|
|
6
6
|
import { Preferences, usePreference } from "@ui-sdk/react/preferences";
|
|
@@ -16,7 +16,11 @@ function PreferencesProvider({
|
|
|
16
16
|
return /* @__PURE__ */ jsx(PreferencesContext, { value: preferences, children: /* @__PURE__ */ jsx(
|
|
17
17
|
Preferences,
|
|
18
18
|
{
|
|
19
|
-
preferences: [
|
|
19
|
+
preferences: [
|
|
20
|
+
preferences.colorScheme,
|
|
21
|
+
preferences.accent,
|
|
22
|
+
preferences.device
|
|
23
|
+
],
|
|
20
24
|
children
|
|
21
25
|
}
|
|
22
26
|
) });
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ declare function useFullscreen(): {
|
|
|
7
7
|
toggleFullscreen: () => Promise<void>;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
declare function useMediaQuery(
|
|
10
|
+
declare function useMediaQuery(): {
|
|
11
|
+
device: "mobile" | "desktop";
|
|
12
|
+
isMobile: boolean;
|
|
13
|
+
isDesktop: boolean;
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
declare function useMounted(): {
|
|
13
17
|
mounted: boolean;
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
useMounted
|
|
4
4
|
} from "../chunk-G4NDAZTB.js";
|
|
5
|
-
import {
|
|
6
|
-
useMediaQuery
|
|
7
|
-
} from "../chunk-G233W3IR.js";
|
|
8
5
|
import {
|
|
9
6
|
useDataGrid,
|
|
10
7
|
useDataTable,
|
|
@@ -12,10 +9,19 @@ import {
|
|
|
12
9
|
useDataTableRows,
|
|
13
10
|
useDataTableSearch
|
|
14
11
|
} from "../chunk-D6TULSM6.js";
|
|
12
|
+
import {
|
|
13
|
+
useMediaQuery
|
|
14
|
+
} from "../chunk-4ILCWFOE.js";
|
|
15
15
|
import "../chunk-VFDNWPOI.js";
|
|
16
16
|
import "../chunk-COPQJFDI.js";
|
|
17
17
|
import "../chunk-MZBLIA6C.js";
|
|
18
18
|
import "../chunk-7JJBATB2.js";
|
|
19
|
+
import {
|
|
20
|
+
buildFlagSearchParamHref,
|
|
21
|
+
hasFlagSearchParam,
|
|
22
|
+
searchParamKeys,
|
|
23
|
+
searchParams
|
|
24
|
+
} from "../chunk-M5NHRP6W.js";
|
|
19
25
|
import "../chunk-DVNTJNDP.js";
|
|
20
26
|
import {
|
|
21
27
|
useFullscreen,
|
|
@@ -24,13 +30,246 @@ import {
|
|
|
24
30
|
import {
|
|
25
31
|
isNativeApp
|
|
26
32
|
} from "../chunk-2LD63YUK.js";
|
|
33
|
+
import "../chunk-YA5PSI7E.js";
|
|
34
|
+
import "../chunk-GL2CQ5TR.js";
|
|
35
|
+
|
|
36
|
+
// src/hooks/useSearchParams.ts
|
|
27
37
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from "
|
|
32
|
-
import
|
|
33
|
-
|
|
38
|
+
useSearchParams as useNextSearchParams,
|
|
39
|
+
usePathname,
|
|
40
|
+
useRouter
|
|
41
|
+
} from "next/navigation";
|
|
42
|
+
import {
|
|
43
|
+
debounce,
|
|
44
|
+
useQueryStates
|
|
45
|
+
} from "nuqs";
|
|
46
|
+
import { NuqsAdapter } from "nuqs/adapters/next/app";
|
|
47
|
+
import * as React from "react";
|
|
48
|
+
var SEARCH_DELAY = 300;
|
|
49
|
+
var QUERY_SEARCH_DELAY = 300;
|
|
50
|
+
function isSearchPath(pathname) {
|
|
51
|
+
return pathname === "/" || pathname === "/pos" || pathname === "/orders" || pathname === "/bin" || pathname.startsWith("/pos/") || pathname.startsWith("/orders/") || pathname.startsWith("/bin/");
|
|
52
|
+
}
|
|
53
|
+
var pendingSearchFocus = false;
|
|
54
|
+
function searchFocus() {
|
|
55
|
+
if (!pendingSearchFocus) return false;
|
|
56
|
+
pendingSearchFocus = false;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
function searchHref(query) {
|
|
60
|
+
const params = new URLSearchParams();
|
|
61
|
+
if (query) params.set(searchParamKeys.query, query);
|
|
62
|
+
const search = params.toString();
|
|
63
|
+
return search ? `/?${search}` : "/";
|
|
64
|
+
}
|
|
65
|
+
function useSearchParams() {
|
|
66
|
+
const pathname = usePathname();
|
|
67
|
+
const router = useRouter();
|
|
68
|
+
const nativeSearchParams = useNextSearchParams();
|
|
69
|
+
const [isPending, startTransition] = React.useTransition();
|
|
70
|
+
const [params, setParams] = useQueryStates(searchParams, {
|
|
71
|
+
urlKeys: searchParamKeys,
|
|
72
|
+
history: "replace",
|
|
73
|
+
shallow: false,
|
|
74
|
+
scroll: false,
|
|
75
|
+
startTransition
|
|
76
|
+
});
|
|
77
|
+
const productQueryRef = React.useRef(params.query);
|
|
78
|
+
const productNavigationQueuedRef = React.useRef(false);
|
|
79
|
+
const onSearchPath = isSearchPath(pathname);
|
|
80
|
+
const cart = hasFlagSearchParam(nativeSearchParams, "cart");
|
|
81
|
+
const notification = hasFlagSearchParam(nativeSearchParams, "notification");
|
|
82
|
+
const updateParams = React.useCallback(
|
|
83
|
+
(values, options) => {
|
|
84
|
+
void setParams(values, options);
|
|
85
|
+
},
|
|
86
|
+
[setParams]
|
|
87
|
+
);
|
|
88
|
+
const setQuery = React.useCallback(
|
|
89
|
+
(value) => {
|
|
90
|
+
const update = setParams(
|
|
91
|
+
{ query: value, page: 1 },
|
|
92
|
+
{
|
|
93
|
+
history: "replace",
|
|
94
|
+
scroll: false,
|
|
95
|
+
shallow: !onSearchPath,
|
|
96
|
+
limitUrlUpdates: debounce(QUERY_SEARCH_DELAY)
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
if (onSearchPath) return;
|
|
100
|
+
productQueryRef.current = value;
|
|
101
|
+
if (productNavigationQueuedRef.current) return;
|
|
102
|
+
productNavigationQueuedRef.current = true;
|
|
103
|
+
void update.then(() => {
|
|
104
|
+
productNavigationQueuedRef.current = false;
|
|
105
|
+
const query = productQueryRef.current.trim();
|
|
106
|
+
if (!query) return;
|
|
107
|
+
pendingSearchFocus = true;
|
|
108
|
+
router.push(searchHref(query), { scroll: true });
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
[onSearchPath, router, setParams]
|
|
112
|
+
);
|
|
113
|
+
const commitQuery = React.useCallback(() => {
|
|
114
|
+
const query = params.query.trim();
|
|
115
|
+
if (!query || onSearchPath) return;
|
|
116
|
+
pendingSearchFocus = true;
|
|
117
|
+
router.push(searchHref(query), { scroll: true });
|
|
118
|
+
}, [onSearchPath, params.query, router]);
|
|
119
|
+
const setCategory = React.useCallback(
|
|
120
|
+
(value) => {
|
|
121
|
+
updateParams(
|
|
122
|
+
{ category: value, page: 1 },
|
|
123
|
+
{ history: "push", shallow: false, scroll: true }
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
[updateParams]
|
|
127
|
+
);
|
|
128
|
+
const setProductStatus = React.useCallback(
|
|
129
|
+
(value) => {
|
|
130
|
+
updateParams(
|
|
131
|
+
{ productStatus: value, page: 1 },
|
|
132
|
+
{ history: "push", shallow: false, scroll: true }
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
[updateParams]
|
|
136
|
+
);
|
|
137
|
+
const setUser = React.useCallback(
|
|
138
|
+
(value) => {
|
|
139
|
+
updateParams(
|
|
140
|
+
{ user: value },
|
|
141
|
+
{
|
|
142
|
+
history: "replace",
|
|
143
|
+
shallow: false,
|
|
144
|
+
scroll: false,
|
|
145
|
+
limitUrlUpdates: debounce(SEARCH_DELAY)
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
[updateParams]
|
|
150
|
+
);
|
|
151
|
+
const setPage = React.useCallback(
|
|
152
|
+
(value) => {
|
|
153
|
+
updateParams(
|
|
154
|
+
{ page: value },
|
|
155
|
+
{ history: "replace", shallow: true, scroll: false }
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
[updateParams]
|
|
159
|
+
);
|
|
160
|
+
const setUserTransaction = React.useCallback(
|
|
161
|
+
(value) => {
|
|
162
|
+
updateParams(
|
|
163
|
+
{ user: value, transaction: "", transactionPage: 1 },
|
|
164
|
+
{ history: "replace", shallow: false, scroll: false }
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
[updateParams]
|
|
168
|
+
);
|
|
169
|
+
const setTransactionDetail = React.useCallback(
|
|
170
|
+
(value) => {
|
|
171
|
+
updateParams(
|
|
172
|
+
{ transaction: value },
|
|
173
|
+
{ history: "replace", shallow: false, scroll: false }
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
[updateParams]
|
|
177
|
+
);
|
|
178
|
+
const clearTransactionDetail = React.useCallback(() => {
|
|
179
|
+
updateParams(
|
|
180
|
+
{ transaction: "" },
|
|
181
|
+
{ history: "replace", shallow: false, scroll: false }
|
|
182
|
+
);
|
|
183
|
+
}, [updateParams]);
|
|
184
|
+
const clearUserTransaction = React.useCallback(() => {
|
|
185
|
+
updateParams(
|
|
186
|
+
{ user: "", transaction: "", transactionPage: 1 },
|
|
187
|
+
{ history: "replace", shallow: false, scroll: false }
|
|
188
|
+
);
|
|
189
|
+
}, [updateParams]);
|
|
190
|
+
const clearAll = React.useCallback(() => {
|
|
191
|
+
updateParams(
|
|
192
|
+
{
|
|
193
|
+
query: "",
|
|
194
|
+
category: "",
|
|
195
|
+
productStatus: "active",
|
|
196
|
+
user: "",
|
|
197
|
+
transaction: "",
|
|
198
|
+
page: 1,
|
|
199
|
+
transactionPage: 1
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
history: "replace",
|
|
203
|
+
shallow: false,
|
|
204
|
+
scroll: true
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}, [updateParams]);
|
|
208
|
+
const setCart = React.useCallback(
|
|
209
|
+
(value) => {
|
|
210
|
+
window.history.replaceState(
|
|
211
|
+
null,
|
|
212
|
+
"",
|
|
213
|
+
buildFlagSearchParamHref(pathname, nativeSearchParams, "cart", value)
|
|
214
|
+
);
|
|
215
|
+
},
|
|
216
|
+
[nativeSearchParams, pathname]
|
|
217
|
+
);
|
|
218
|
+
const toggleCart = React.useCallback(() => {
|
|
219
|
+
setCart(!cart);
|
|
220
|
+
}, [cart, setCart]);
|
|
221
|
+
const setNotification = React.useCallback(
|
|
222
|
+
(value) => {
|
|
223
|
+
window.history.replaceState(
|
|
224
|
+
null,
|
|
225
|
+
"",
|
|
226
|
+
buildFlagSearchParamHref(
|
|
227
|
+
pathname,
|
|
228
|
+
nativeSearchParams,
|
|
229
|
+
"notification",
|
|
230
|
+
value
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
},
|
|
234
|
+
[nativeSearchParams, pathname]
|
|
235
|
+
);
|
|
236
|
+
return {
|
|
237
|
+
...params,
|
|
238
|
+
cart,
|
|
239
|
+
setCart,
|
|
240
|
+
openCart: () => setCart(true),
|
|
241
|
+
closeCart: () => setCart(false),
|
|
242
|
+
toggleCart,
|
|
243
|
+
notification,
|
|
244
|
+
setNotification,
|
|
245
|
+
openNotification: () => setNotification(true),
|
|
246
|
+
closeNotification: () => setNotification(false),
|
|
247
|
+
toggleNotification: () => setNotification(!notification),
|
|
248
|
+
setQuery,
|
|
249
|
+
setCategory,
|
|
250
|
+
setProductStatus,
|
|
251
|
+
setUser,
|
|
252
|
+
setPage,
|
|
253
|
+
setUserTransaction,
|
|
254
|
+
setTransactionDetail,
|
|
255
|
+
commitQuery,
|
|
256
|
+
clearQuery: () => setQuery(""),
|
|
257
|
+
clearCategory: () => setCategory(""),
|
|
258
|
+
clearProductStatus: () => setProductStatus("active"),
|
|
259
|
+
clearUser: () => setUser(""),
|
|
260
|
+
clearTransactionDetail,
|
|
261
|
+
clearUserTransaction,
|
|
262
|
+
clearPage: () => setPage(1),
|
|
263
|
+
clearAll,
|
|
264
|
+
isQueryPending: isPending,
|
|
265
|
+
isCategoryPending: isPending,
|
|
266
|
+
isUserPending: isPending,
|
|
267
|
+
setTab: (value) => updateParams(
|
|
268
|
+
{ tab: value },
|
|
269
|
+
{ history: "replace", shallow: false, scroll: false }
|
|
270
|
+
)
|
|
271
|
+
};
|
|
272
|
+
}
|
|
34
273
|
|
|
35
274
|
// src/hooks/useSideRail.ts
|
|
36
275
|
import { useSyncExternalStore } from "react";
|
|
@@ -101,21 +340,21 @@ function useDataGridMove() {
|
|
|
101
340
|
}
|
|
102
341
|
|
|
103
342
|
// src/ui/data-table/hooks/use-grid-changes.ts
|
|
104
|
-
import * as
|
|
343
|
+
import * as React2 from "react";
|
|
105
344
|
function useGridChanges(grid, options = {}) {
|
|
106
345
|
const initialRows = options.initialRows ?? [];
|
|
107
|
-
const [dirtyRowIds, setDirtyRowIds] =
|
|
108
|
-
const [deletedRowIds, setDeletedRowIds] =
|
|
346
|
+
const [dirtyRowIds, setDirtyRowIds] = React2.useState(/* @__PURE__ */ new Set());
|
|
347
|
+
const [deletedRowIds, setDeletedRowIds] = React2.useState(
|
|
109
348
|
/* @__PURE__ */ new Set()
|
|
110
349
|
);
|
|
111
|
-
const updateCell =
|
|
350
|
+
const updateCell = React2.useCallback(
|
|
112
351
|
(rowId, columnId, value) => {
|
|
113
352
|
grid.updateCell(rowId, columnId, value);
|
|
114
353
|
setDirtyRowIds((current) => new Set(current).add(rowId));
|
|
115
354
|
},
|
|
116
355
|
[grid]
|
|
117
356
|
);
|
|
118
|
-
const getChangeSet =
|
|
357
|
+
const getChangeSet = React2.useCallback(() => {
|
|
119
358
|
const created = [];
|
|
120
359
|
const updated = [];
|
|
121
360
|
const initialById = new Map(
|
|
@@ -136,7 +375,7 @@ function useGridChanges(grid, options = {}) {
|
|
|
136
375
|
});
|
|
137
376
|
return { created, updated, deleted };
|
|
138
377
|
}, [deletedRowIds, dirtyRowIds, grid, initialRows]);
|
|
139
|
-
const insertRows =
|
|
378
|
+
const insertRows = React2.useCallback(
|
|
140
379
|
(rows, index) => {
|
|
141
380
|
grid.insertRows(rows, index);
|
|
142
381
|
setDirtyRowIds((current) => {
|
|
@@ -147,14 +386,14 @@ function useGridChanges(grid, options = {}) {
|
|
|
147
386
|
},
|
|
148
387
|
[grid]
|
|
149
388
|
);
|
|
150
|
-
const deleteRows =
|
|
389
|
+
const deleteRows = React2.useCallback(
|
|
151
390
|
(rowIds) => {
|
|
152
391
|
grid.deleteRows(rowIds);
|
|
153
392
|
setDeletedRowIds((current) => /* @__PURE__ */ new Set([...current, ...rowIds]));
|
|
154
393
|
},
|
|
155
394
|
[grid]
|
|
156
395
|
);
|
|
157
|
-
const reset =
|
|
396
|
+
const reset = React2.useCallback(
|
|
158
397
|
(rows = initialRows) => {
|
|
159
398
|
grid.updateRows(() => rows);
|
|
160
399
|
setDirtyRowIds(/* @__PURE__ */ new Set());
|
|
@@ -162,7 +401,7 @@ function useGridChanges(grid, options = {}) {
|
|
|
162
401
|
},
|
|
163
402
|
[grid, initialRows]
|
|
164
403
|
);
|
|
165
|
-
const reconcile =
|
|
404
|
+
const reconcile = React2.useCallback(
|
|
166
405
|
(succeededIds, failedIds = []) => {
|
|
167
406
|
const succeeded = new Set(succeededIds);
|
|
168
407
|
setDirtyRowIds(
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,44 @@ declare function usePreferences(): {
|
|
|
73
73
|
value: "gold" | "violet" | "slate" | "mint";
|
|
74
74
|
}>, key: Key) => () => void;
|
|
75
75
|
};
|
|
76
|
+
device: {
|
|
77
|
+
attribute: `data-${string}`;
|
|
78
|
+
global: boolean;
|
|
79
|
+
values: readonly ("mobile" | "desktop")[];
|
|
80
|
+
defaultValue: "mobile" | "desktop";
|
|
81
|
+
storage: {
|
|
82
|
+
id: string;
|
|
83
|
+
kind: "local" | "session" | "cookie";
|
|
84
|
+
readsOnServer: boolean;
|
|
85
|
+
script: (options: _ui_sdk_core.StorageScriptOptions) => string | undefined;
|
|
86
|
+
available: () => boolean;
|
|
87
|
+
get: () => string | null;
|
|
88
|
+
set: (value: string) => boolean;
|
|
89
|
+
remove: () => boolean;
|
|
90
|
+
subscribe(listener: (value: string | null) => void): () => void;
|
|
91
|
+
} | undefined;
|
|
92
|
+
initialState: {
|
|
93
|
+
value: "mobile" | "desktop";
|
|
94
|
+
};
|
|
95
|
+
get: () => {
|
|
96
|
+
value: "mobile" | "desktop";
|
|
97
|
+
};
|
|
98
|
+
set: (next: "mobile" | "desktop", change?: {
|
|
99
|
+
reason?: _ui_sdk_core.ChangeReason;
|
|
100
|
+
event?: Event;
|
|
101
|
+
}) => boolean;
|
|
102
|
+
subscribe: (listener: (state: {
|
|
103
|
+
value: "mobile" | "desktop";
|
|
104
|
+
}) => void) => () => void;
|
|
105
|
+
follow: <Key extends string>(store: _ui_sdk_core.PreferenceStore<Key, {
|
|
106
|
+
value: "mobile" | "desktop";
|
|
107
|
+
}>, key: Key) => () => void;
|
|
108
|
+
};
|
|
109
|
+
screen: {
|
|
110
|
+
initialState: "mobile" | "desktop";
|
|
111
|
+
get: () => "mobile" | "desktop";
|
|
112
|
+
subscribe(listener: () => void): () => void;
|
|
113
|
+
};
|
|
76
114
|
};
|
|
77
115
|
/** The theme as next-themes shaped it, backed by ui-sdk's color scheme. */
|
|
78
116
|
declare function useTheme(): {
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
useAccent,
|
|
5
5
|
usePreferences,
|
|
6
6
|
useTheme
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YA5PSI7E.js";
|
|
8
8
|
import {
|
|
9
9
|
TopLoader
|
|
10
10
|
} from "./chunk-3ZGQJTWY.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-GL2CQ5TR.js";
|
|
12
12
|
import {
|
|
13
13
|
BellIcon,
|
|
14
14
|
IconSwap,
|
package/dist/layout.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NuqsAdapter
|
|
3
|
-
} from "./chunk-JPOAXESG.js";
|
|
4
|
-
import "./chunk-M5NHRP6W.js";
|
|
5
1
|
import {
|
|
6
2
|
preferencesScript
|
|
7
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GL2CQ5TR.js";
|
|
8
4
|
|
|
9
5
|
// src/layout/layout.tsx
|
|
10
6
|
import { cookies } from "next/headers";
|
|
7
|
+
import { NuqsAdapter } from "nuqs/adapters/next/app";
|
|
11
8
|
import { ClientProvider } from "./provider.js";
|
|
12
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
10
|
async function Layout({ cookie, ...props }) {
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -201,9 +201,13 @@ declare function pickNativeChooserImageFiles({ isNative, limit, title, }: {
|
|
|
201
201
|
|
|
202
202
|
declare const ACCENTS: readonly ["slate", "violet", "mint", "gold"];
|
|
203
203
|
type Accent = (typeof ACCENTS)[number];
|
|
204
|
+
declare const DEVICES: readonly ["mobile", "desktop"];
|
|
205
|
+
type Device = (typeof DEVICES)[number];
|
|
206
|
+
declare const MOBILE_QUERY = "(max-width: 767px)";
|
|
204
207
|
declare const PREFERENCE_COOKIES: {
|
|
205
208
|
readonly colorScheme: "color-scheme";
|
|
206
209
|
readonly accent: "accent";
|
|
210
|
+
readonly device: "device";
|
|
207
211
|
};
|
|
208
212
|
/**
|
|
209
213
|
* The app's saved preferences, kept in cookies so the server renders them too.
|
|
@@ -268,6 +272,44 @@ declare function createAppPreferences(cookie?: string | null): {
|
|
|
268
272
|
value: "gold" | "violet" | "slate" | "mint";
|
|
269
273
|
}>, key: Key) => () => void;
|
|
270
274
|
};
|
|
275
|
+
device: {
|
|
276
|
+
attribute: `data-${string}`;
|
|
277
|
+
global: boolean;
|
|
278
|
+
values: readonly ("mobile" | "desktop")[];
|
|
279
|
+
defaultValue: "mobile" | "desktop";
|
|
280
|
+
storage: {
|
|
281
|
+
id: string;
|
|
282
|
+
kind: "local" | "session" | "cookie";
|
|
283
|
+
readsOnServer: boolean;
|
|
284
|
+
script: (options: _ui_sdk_core.StorageScriptOptions) => string | undefined;
|
|
285
|
+
available: () => boolean;
|
|
286
|
+
get: () => string | null;
|
|
287
|
+
set: (value: string) => boolean;
|
|
288
|
+
remove: () => boolean;
|
|
289
|
+
subscribe(listener: (value: string | null) => void): () => void;
|
|
290
|
+
} | undefined;
|
|
291
|
+
initialState: {
|
|
292
|
+
value: "mobile" | "desktop";
|
|
293
|
+
};
|
|
294
|
+
get: () => {
|
|
295
|
+
value: "mobile" | "desktop";
|
|
296
|
+
};
|
|
297
|
+
set: (next: "mobile" | "desktop", change?: {
|
|
298
|
+
reason?: _ui_sdk_core.ChangeReason;
|
|
299
|
+
event?: Event;
|
|
300
|
+
}) => boolean;
|
|
301
|
+
subscribe: (listener: (state: {
|
|
302
|
+
value: "mobile" | "desktop";
|
|
303
|
+
}) => void) => () => void;
|
|
304
|
+
follow: <Key extends string>(store: _ui_sdk_core.PreferenceStore<Key, {
|
|
305
|
+
value: "mobile" | "desktop";
|
|
306
|
+
}>, key: Key) => () => void;
|
|
307
|
+
};
|
|
308
|
+
screen: {
|
|
309
|
+
initialState: "mobile" | "desktop";
|
|
310
|
+
get: () => "mobile" | "desktop";
|
|
311
|
+
subscribe(listener: () => void): () => void;
|
|
312
|
+
};
|
|
271
313
|
};
|
|
272
314
|
type AppPreferences = ReturnType<typeof createAppPreferences>;
|
|
273
315
|
/** The `<html>` attributes for a request's saved preferences. */
|
|
@@ -275,4 +317,4 @@ declare function preferenceAttributes(cookie?: string | null): Record<`data-${st
|
|
|
275
317
|
/** Sets the saved preferences on `<html>` while the page parses, before it paints. */
|
|
276
318
|
declare function preferencesScript(cookie?: string | null): string;
|
|
277
319
|
|
|
278
|
-
export { ACCENTS, type Accent, type AppPreferences, type NativeSharePayload, type NativeSharedFile, type NativeUpdateInfo, type NativeUpdateState, PREFERENCE_COOKIES, createAppPreferences, getNativeAppPlugin, getNativeAppSettingsPlugin, getNativeBrowserPlugin, getNativeCameraPlugin, getNativeImagePickerPlugin, getNativeInAppUpdatePlugin, getNativePaymentPlugin, getNativePlatform, getNativeShareFilePlugin, getNativeSharePlugin, getNativeShareTargetPlugin, getNativeStatusBarPlugin, getNativeThemePlugin, isNativeApp, nativeSharedFileToFile, openExternalUrl, openNativeAppSettings, openUpiPaymentUrl, pickNativeChooserImageFiles, pickNativeImageFiles, preferenceAttributes, preferencesScript, saveNativeShareImage, shareNativeOrWeb };
|
|
320
|
+
export { ACCENTS, type Accent, type AppPreferences, DEVICES, type Device, MOBILE_QUERY, type NativeSharePayload, type NativeSharedFile, type NativeUpdateInfo, type NativeUpdateState, PREFERENCE_COOKIES, createAppPreferences, getNativeAppPlugin, getNativeAppSettingsPlugin, getNativeBrowserPlugin, getNativeCameraPlugin, getNativeImagePickerPlugin, getNativeInAppUpdatePlugin, getNativePaymentPlugin, getNativePlatform, getNativeShareFilePlugin, getNativeSharePlugin, getNativeShareTargetPlugin, getNativeStatusBarPlugin, getNativeThemePlugin, isNativeApp, nativeSharedFileToFile, openExternalUrl, openNativeAppSettings, openUpiPaymentUrl, pickNativeChooserImageFiles, pickNativeImageFiles, preferenceAttributes, preferencesScript, saveNativeShareImage, shareNativeOrWeb };
|