@epoch32/visage 1.0.0 → 1.1.1
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/api/client.d.ts +5 -0
- package/dist/api/file-router.d.ts +29 -0
- package/dist/api/handler.d.ts +15 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/{src/api → api}/index.js +87 -2
- package/dist/api/middleware.d.ts +11 -0
- package/dist/api/pragma.d.ts +21 -0
- package/dist/api/procedure.d.ts +66 -0
- package/dist/api/types.d.ts +181 -0
- package/dist/charts/Area.d.ts +18 -0
- package/dist/charts/Axis.d.ts +21 -0
- package/dist/charts/Bar.d.ts +10 -0
- package/dist/charts/CartesianGrid.d.ts +10 -0
- package/dist/charts/Chart.d.ts +16 -0
- package/dist/charts/Cursor.d.ts +8 -0
- package/dist/charts/Legend.d.ts +9 -0
- package/dist/charts/Line.d.ts +18 -0
- package/dist/charts/Pie.d.ts +12 -0
- package/dist/charts/Tooltip.d.ts +12 -0
- package/dist/charts/context.d.ts +20 -0
- package/dist/charts/index.d.ts +14 -0
- package/dist/{src/charts → charts}/index.js +87 -2
- package/dist/charts/path.d.ts +27 -0
- package/dist/charts/scale.d.ts +23 -0
- package/dist/charts/types.d.ts +43 -0
- package/dist/devtools/DomTab.d.ts +6 -0
- package/dist/devtools/GraphInspector.d.ts +11 -0
- package/dist/devtools/GraphTab.d.ts +10 -0
- package/dist/devtools/QueryTab.d.ts +10 -0
- package/dist/devtools/RpcTab.d.ts +10 -0
- package/dist/devtools/SignalsTab.d.ts +10 -0
- package/dist/devtools/component.d.ts +2 -0
- package/dist/devtools/highlighter.d.ts +2 -0
- package/dist/devtools/hub.d.ts +41 -0
- package/dist/devtools/index.d.ts +9 -0
- package/dist/{src/devtools → devtools}/index.js +87 -2
- package/dist/devtools/styles.d.ts +1 -0
- package/dist/devtools/types.d.ts +44 -0
- package/dist/dom/async.d.ts +41 -0
- package/dist/dom/control-flow.d.ts +53 -0
- package/dist/dom/index.d.ts +3 -0
- package/dist/{src/dom → dom}/index.js +87 -2
- package/dist/dom/lazy.d.ts +30 -0
- package/dist/dom/render.d.ts +23 -0
- package/dist/dom/resource.d.ts +34 -0
- package/dist/form/form.d.ts +41 -0
- package/dist/form/index.d.ts +2 -0
- package/dist/{src/form → form}/index.js +87 -2
- package/dist/form/schema.d.ts +96 -0
- package/dist/index.d.ts +15 -0
- package/dist/{src/index.js → index.js} +87 -2
- package/dist/jsx-dev-runtime/index.d.ts +1 -0
- package/dist/jsx-runtime/index.d.ts +8 -0
- package/dist/{src/jsx-runtime → jsx-runtime}/index.js +87 -2
- package/dist/jsx-runtime/jsx.d.ts +278 -0
- package/dist/query/create-mutation.d.ts +3 -0
- package/dist/query/create-query.d.ts +4 -0
- package/dist/query/focus-manager.d.ts +14 -0
- package/dist/query/index.d.ts +9 -0
- package/dist/{src/query → query}/index.js +87 -2
- package/dist/query/mutation-cache.d.ts +24 -0
- package/dist/query/online-manager.d.ts +14 -0
- package/dist/query/query-cache.d.ts +69 -0
- package/dist/query/query-client.d.ts +46 -0
- package/dist/query/types.d.ts +131 -0
- package/dist/query/utils.d.ts +16 -0
- package/dist/router/index.d.ts +1 -0
- package/dist/{src/router → router}/index.js +87 -2
- package/dist/router/router.d.ts +91 -0
- package/dist/rpc/client.d.ts +2 -0
- package/dist/rpc/error.d.ts +16 -0
- package/dist/rpc/index.d.ts +7 -0
- package/dist/{src/rpc → rpc}/index.js +87 -2
- package/dist/rpc/procedure.d.ts +8 -0
- package/dist/rpc/router.d.ts +19 -0
- package/dist/rpc/server.d.ts +3 -0
- package/dist/rpc/types.d.ts +200 -0
- package/dist/server/hydrate.d.ts +5 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/{src/server → server}/index.js +87 -2
- package/dist/server/render-to-stream.d.ts +9 -0
- package/dist/server/render-to-string.d.ts +6 -0
- package/dist/signals/computed.d.ts +61 -0
- package/dist/signals/context.d.ts +44 -0
- package/dist/signals/effect.d.ts +56 -0
- package/dist/signals/index.d.ts +8 -0
- package/dist/{src/signals → signals}/index.js +87 -2
- package/dist/signals/scope.d.ts +61 -0
- package/dist/signals/signal.d.ts +40 -0
- package/dist/signals/store.d.ts +45 -0
- package/dist/signals/system.d.ts +56 -0
- package/dist/signals/types.d.ts +58 -0
- package/dist/style/component.d.ts +49 -0
- package/dist/style/create-style.d.ts +63 -0
- package/dist/style/cx.d.ts +18 -0
- package/dist/style/hash.d.ts +8 -0
- package/dist/style/index.d.ts +8 -0
- package/dist/{src/style → style}/index.js +87 -2
- package/dist/style/layout.d.ts +129 -0
- package/dist/style/manager.d.ts +31 -0
- package/dist/style/parser.d.ts +12 -0
- package/dist/style/scale.d.ts +82 -0
- package/dist/template/index.d.ts +1 -0
- package/dist/{src/template → template}/index.js +87 -2
- package/dist/template/template.d.ts +8 -0
- package/dist/ui/accordion.d.ts +81 -0
- package/dist/ui/command-dialog.d.ts +10 -0
- package/dist/ui/command.d.ts +103 -0
- package/dist/ui/data-table.d.ts +38 -0
- package/dist/ui/dialog.d.ts +102 -0
- package/dist/ui/dropdown-menu.d.ts +92 -0
- package/dist/ui/icon.d.ts +18 -0
- package/dist/ui/index.d.ts +14 -0
- package/dist/{src/ui → ui}/index.js +87 -2
- package/dist/ui/layout.d.ts +1 -0
- package/dist/ui/popover.d.ts +68 -0
- package/dist/ui/switch.d.ts +31 -0
- package/dist/ui/tabs.d.ts +71 -0
- package/dist/ui/toast.d.ts +91 -0
- package/dist/ui/tooltip.d.ts +64 -0
- package/dist/ui/utils.d.ts +21 -0
- package/dist/virtual/index.d.ts +2 -0
- package/dist/{src/virtual → virtual}/index.js +87 -2
- package/dist/virtual/virtual-list.d.ts +21 -0
- package/dist/virtual/virtualizer.d.ts +31 -0
- package/dist/vite/hmr.d.ts +7 -0
- package/dist/vite/index.d.ts +3 -0
- package/dist/{src/vite → vite}/index.js +4 -0
- package/dist/vite/lucide.d.ts +27 -0
- package/dist/vite/plugin.d.ts +3 -0
- package/dist/vite/rpc-middleware.d.ts +5 -0
- package/dist/vite/types.d.ts +59 -0
- package/package.json +40 -40
- package/src/signals/index.ts +1 -0
- package/src/signals/signal.ts +110 -2
- package/src/signals/types.ts +9 -0
- package/src/vite/plugin.ts +4 -0
|
@@ -848,10 +848,12 @@ class Signal {
|
|
|
848
848
|
_value;
|
|
849
849
|
_subscribers = new Set;
|
|
850
850
|
_equals;
|
|
851
|
+
_onSet;
|
|
851
852
|
version = 0;
|
|
852
|
-
constructor(initialValue, equals) {
|
|
853
|
+
constructor(initialValue, equals, onSet) {
|
|
853
854
|
this._value = initialValue;
|
|
854
855
|
this._equals = equals ?? Object.is;
|
|
856
|
+
this._onSet = onSet;
|
|
855
857
|
}
|
|
856
858
|
get() {
|
|
857
859
|
if (currentSubscriber !== null && currentSubscriber.state !== 3 /* DISPOSED */) {
|
|
@@ -876,6 +878,9 @@ class Signal {
|
|
|
876
878
|
}
|
|
877
879
|
this._value = newValue;
|
|
878
880
|
this.version++;
|
|
881
|
+
if (this._onSet) {
|
|
882
|
+
this._onSet(newValue);
|
|
883
|
+
}
|
|
879
884
|
batch(() => {
|
|
880
885
|
this.notify();
|
|
881
886
|
});
|
|
@@ -901,11 +906,91 @@ class Signal {
|
|
|
901
906
|
}
|
|
902
907
|
}
|
|
903
908
|
}
|
|
909
|
+
function resolveStorage(storageOption) {
|
|
910
|
+
if (storageOption && typeof storageOption === "object") {
|
|
911
|
+
return storageOption;
|
|
912
|
+
}
|
|
913
|
+
if (storageOption === "session") {
|
|
914
|
+
try {
|
|
915
|
+
if (typeof sessionStorage !== "undefined")
|
|
916
|
+
return sessionStorage;
|
|
917
|
+
} catch {}
|
|
918
|
+
try {
|
|
919
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
920
|
+
return window.sessionStorage;
|
|
921
|
+
}
|
|
922
|
+
} catch {}
|
|
923
|
+
try {
|
|
924
|
+
if (typeof globalThis !== "undefined" && globalThis.sessionStorage) {
|
|
925
|
+
return globalThis.sessionStorage;
|
|
926
|
+
}
|
|
927
|
+
} catch {}
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
try {
|
|
931
|
+
if (typeof localStorage !== "undefined")
|
|
932
|
+
return localStorage;
|
|
933
|
+
} catch {}
|
|
934
|
+
try {
|
|
935
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
936
|
+
return window.localStorage;
|
|
937
|
+
}
|
|
938
|
+
} catch {}
|
|
939
|
+
try {
|
|
940
|
+
if (typeof globalThis !== "undefined" && globalThis.localStorage) {
|
|
941
|
+
return globalThis.localStorage;
|
|
942
|
+
}
|
|
943
|
+
} catch {}
|
|
944
|
+
return null;
|
|
945
|
+
}
|
|
904
946
|
function signal(initialValue, optionsOrEquals) {
|
|
905
947
|
const equals = typeof optionsOrEquals === "function" ? optionsOrEquals : optionsOrEquals?.equals;
|
|
906
948
|
const isInternal = typeof optionsOrEquals === "object" ? optionsOrEquals?.internal : false;
|
|
907
949
|
const customName = typeof optionsOrEquals === "object" ? optionsOrEquals?.name : undefined;
|
|
908
|
-
const
|
|
950
|
+
const persistOption = typeof optionsOrEquals === "object" ? optionsOrEquals?.persist : undefined;
|
|
951
|
+
const persistConfig = persistOption ? typeof persistOption === "string" ? { key: persistOption } : persistOption : undefined;
|
|
952
|
+
let effectiveInitial = initialValue;
|
|
953
|
+
const storage = persistConfig ? resolveStorage(persistConfig.storage) : null;
|
|
954
|
+
const serialize = persistConfig?.serialize ?? JSON.stringify;
|
|
955
|
+
const deserialize = persistConfig?.deserialize ?? JSON.parse;
|
|
956
|
+
if (persistConfig && storage) {
|
|
957
|
+
try {
|
|
958
|
+
const stored = storage.getItem(persistConfig.key);
|
|
959
|
+
if (stored !== null) {
|
|
960
|
+
effectiveInitial = deserialize(stored);
|
|
961
|
+
}
|
|
962
|
+
} catch {}
|
|
963
|
+
}
|
|
964
|
+
let isSyncing = false;
|
|
965
|
+
const onSet = persistConfig && storage ? (val) => {
|
|
966
|
+
if (isSyncing)
|
|
967
|
+
return;
|
|
968
|
+
try {
|
|
969
|
+
storage.setItem(persistConfig.key, serialize(val));
|
|
970
|
+
} catch {}
|
|
971
|
+
} : undefined;
|
|
972
|
+
const s = new Signal(effectiveInitial, equals, onSet);
|
|
973
|
+
if (persistConfig && storage && (persistConfig.syncTabs ?? true) && typeof window !== "undefined" && typeof window.addEventListener === "function") {
|
|
974
|
+
const onStorage = (e) => {
|
|
975
|
+
if (e.key === persistConfig.key) {
|
|
976
|
+
try {
|
|
977
|
+
const nextVal = e.newValue !== null ? deserialize(e.newValue) : initialValue;
|
|
978
|
+
isSyncing = true;
|
|
979
|
+
try {
|
|
980
|
+
s.set(nextVal);
|
|
981
|
+
} finally {
|
|
982
|
+
isSyncing = false;
|
|
983
|
+
}
|
|
984
|
+
} catch {}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
window.addEventListener("storage", onStorage);
|
|
988
|
+
if (currentScope) {
|
|
989
|
+
currentScope.addCleanup(() => {
|
|
990
|
+
window.removeEventListener("storage", onStorage);
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
}
|
|
909
994
|
const accessor = (...args) => {
|
|
910
995
|
if (args.length === 0) {
|
|
911
996
|
return s.get();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type BaseLayoutProps, Center, type CenterProps, Grid, type GridProps, Row, type RowProps, Spacer, type SpacerProps, Stack, type StackProps } from "../style/layout";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Child } from "../dom/render";
|
|
2
|
+
import { type ReadonlySignal } from "../signals";
|
|
3
|
+
export interface PopoverContextValue {
|
|
4
|
+
open: ReadonlySignal<boolean>;
|
|
5
|
+
setOpen: (open: boolean) => void;
|
|
6
|
+
triggerRef: {
|
|
7
|
+
current: HTMLElement | null;
|
|
8
|
+
};
|
|
9
|
+
contentRef: {
|
|
10
|
+
current: HTMLElement | null;
|
|
11
|
+
};
|
|
12
|
+
contentId: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const PopoverContext: import("..").Context<PopoverContextValue | null>;
|
|
15
|
+
export declare function usePopoverContext(): PopoverContextValue | null;
|
|
16
|
+
export interface PopoverProps {
|
|
17
|
+
open?: () => boolean | undefined;
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
trigger?: Child | (() => Child);
|
|
21
|
+
content?: Child | (() => Child);
|
|
22
|
+
triggerClass?: any;
|
|
23
|
+
contentClass?: any;
|
|
24
|
+
portalled?: boolean;
|
|
25
|
+
children?: Child | (() => Child);
|
|
26
|
+
}
|
|
27
|
+
export declare function PopoverRoot(props: PopoverProps): Child;
|
|
28
|
+
export interface PopoverTriggerProps {
|
|
29
|
+
as?: string;
|
|
30
|
+
class?: any;
|
|
31
|
+
style?: any;
|
|
32
|
+
onClick?: (e: MouseEvent) => void;
|
|
33
|
+
children: Child | (() => Child);
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
36
|
+
export declare function PopoverTrigger(props: PopoverTriggerProps): Child;
|
|
37
|
+
export interface PopoverPortalProps {
|
|
38
|
+
mount?: HTMLElement | null;
|
|
39
|
+
children: Child | (() => Child);
|
|
40
|
+
}
|
|
41
|
+
export declare function PopoverPortal(props: PopoverPortalProps): Child;
|
|
42
|
+
export interface PopoverContentProps {
|
|
43
|
+
as?: string;
|
|
44
|
+
portalled?: boolean;
|
|
45
|
+
mount?: HTMLElement | null;
|
|
46
|
+
class?: any;
|
|
47
|
+
style?: any;
|
|
48
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
49
|
+
children: Child | (() => Child);
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}
|
|
52
|
+
export declare function PopoverContent(props: PopoverContentProps): Child;
|
|
53
|
+
export interface PopoverCloseProps {
|
|
54
|
+
as?: string;
|
|
55
|
+
class?: any;
|
|
56
|
+
style?: any;
|
|
57
|
+
onClick?: (e: MouseEvent) => void;
|
|
58
|
+
children: Child | (() => Child);
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
export declare function PopoverClose(props: PopoverCloseProps): Child;
|
|
62
|
+
export declare const Popover: typeof PopoverRoot & {
|
|
63
|
+
Root: typeof PopoverRoot;
|
|
64
|
+
Trigger: typeof PopoverTrigger;
|
|
65
|
+
Portal: typeof PopoverPortal;
|
|
66
|
+
Content: typeof PopoverContent;
|
|
67
|
+
Close: typeof PopoverClose;
|
|
68
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Child } from "../dom/render";
|
|
2
|
+
export interface SwitchProps {
|
|
3
|
+
checked?: () => boolean | undefined;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
6
|
+
disabled?: boolean | (() => boolean);
|
|
7
|
+
required?: boolean;
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
thumbClass?: any;
|
|
11
|
+
thumbStyle?: any;
|
|
12
|
+
as?: string;
|
|
13
|
+
class?: any;
|
|
14
|
+
style?: any;
|
|
15
|
+
children?: Child | (() => Child);
|
|
16
|
+
onClick?: (e: MouseEvent) => void;
|
|
17
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export declare function SwitchRoot(props: SwitchProps): Child;
|
|
21
|
+
export interface SwitchThumbProps {
|
|
22
|
+
as?: string;
|
|
23
|
+
class?: any;
|
|
24
|
+
style?: any;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export declare function SwitchThumb(props: SwitchThumbProps): Child;
|
|
28
|
+
export declare const Switch: typeof SwitchRoot & {
|
|
29
|
+
Root: typeof SwitchRoot;
|
|
30
|
+
Thumb: typeof SwitchThumb;
|
|
31
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Child } from "../dom/render";
|
|
2
|
+
import type { ReadonlySignal } from "../signals";
|
|
3
|
+
export interface TabsContextValue {
|
|
4
|
+
value: ReadonlySignal<string>;
|
|
5
|
+
setValue: (value: string) => void;
|
|
6
|
+
orientation: "horizontal" | "vertical";
|
|
7
|
+
activationMode: "automatic" | "manual";
|
|
8
|
+
baseId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const TabsContext: import("..").Context<TabsContextValue | null>;
|
|
11
|
+
export declare function useTabsContext(): TabsContextValue | null;
|
|
12
|
+
export interface TabItem {
|
|
13
|
+
value: string;
|
|
14
|
+
label: Child | (() => Child);
|
|
15
|
+
icon?: Child | (() => Child);
|
|
16
|
+
content?: Child | (() => Child);
|
|
17
|
+
disabled?: boolean | (() => boolean);
|
|
18
|
+
}
|
|
19
|
+
export interface TabsProps {
|
|
20
|
+
value?: () => string | undefined;
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
onValueChange?: (value: string) => void;
|
|
23
|
+
orientation?: "horizontal" | "vertical";
|
|
24
|
+
activationMode?: "automatic" | "manual";
|
|
25
|
+
items?: TabItem[];
|
|
26
|
+
listClass?: any;
|
|
27
|
+
triggerClass?: any;
|
|
28
|
+
contentClass?: any;
|
|
29
|
+
class?: any;
|
|
30
|
+
style?: any;
|
|
31
|
+
as?: string;
|
|
32
|
+
children?: Child | (() => Child);
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
export declare function TabsRoot(props: TabsProps): Child;
|
|
36
|
+
export interface TabsListProps {
|
|
37
|
+
as?: string;
|
|
38
|
+
class?: any;
|
|
39
|
+
style?: any;
|
|
40
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
41
|
+
children: Child | (() => Child);
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}
|
|
44
|
+
export declare function TabsList(props: TabsListProps): Child;
|
|
45
|
+
export interface TabsTriggerProps {
|
|
46
|
+
value: string;
|
|
47
|
+
disabled?: boolean | (() => boolean);
|
|
48
|
+
as?: string;
|
|
49
|
+
class?: any;
|
|
50
|
+
style?: any;
|
|
51
|
+
onClick?: (e: MouseEvent) => void;
|
|
52
|
+
children: Child | (() => Child);
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}
|
|
55
|
+
export declare function TabsTrigger(props: TabsTriggerProps): Child;
|
|
56
|
+
export interface TabsContentProps {
|
|
57
|
+
value: string;
|
|
58
|
+
forceMount?: boolean;
|
|
59
|
+
as?: string;
|
|
60
|
+
class?: any;
|
|
61
|
+
style?: any;
|
|
62
|
+
children: Child | (() => Child);
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}
|
|
65
|
+
export declare function TabsContent(props: TabsContentProps): Child;
|
|
66
|
+
export declare const Tabs: typeof TabsRoot & {
|
|
67
|
+
Root: typeof TabsRoot;
|
|
68
|
+
List: typeof TabsList;
|
|
69
|
+
Trigger: typeof TabsTrigger;
|
|
70
|
+
Content: typeof TabsContent;
|
|
71
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Child } from "../dom/render";
|
|
2
|
+
import { type ReadonlySignal } from "../signals";
|
|
3
|
+
export type ToastVariant = "default" | "success" | "error" | "warning" | "info";
|
|
4
|
+
export interface ToastData {
|
|
5
|
+
id: string;
|
|
6
|
+
title?: Child;
|
|
7
|
+
description?: Child;
|
|
8
|
+
variant?: ToastVariant;
|
|
9
|
+
duration?: number;
|
|
10
|
+
onDismiss?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface ToastOptions {
|
|
13
|
+
title?: Child;
|
|
14
|
+
description?: Child;
|
|
15
|
+
variant?: ToastVariant;
|
|
16
|
+
duration?: number;
|
|
17
|
+
onDismiss?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ToastManager {
|
|
20
|
+
(options: ToastOptions | string): string;
|
|
21
|
+
toasts: ReadonlySignal<ToastData[]>;
|
|
22
|
+
show: (options: ToastOptions | string) => string;
|
|
23
|
+
success: (title: string, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
24
|
+
error: (title: string, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
25
|
+
warning: (title: string, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
26
|
+
info: (title: string, options?: Omit<ToastOptions, "title" | "variant">) => string;
|
|
27
|
+
dismiss: (id: string) => void;
|
|
28
|
+
clear: () => void;
|
|
29
|
+
}
|
|
30
|
+
export declare function createToastManager(): ToastManager;
|
|
31
|
+
export declare const defaultToastManager: ToastManager;
|
|
32
|
+
export declare const toast: ToastManager;
|
|
33
|
+
export declare const ToastContext: import("..").Context<ToastManager>;
|
|
34
|
+
export declare function useToast(): ToastManager;
|
|
35
|
+
export interface ToastProviderProps {
|
|
36
|
+
manager?: ToastManager;
|
|
37
|
+
children: Child | (() => Child);
|
|
38
|
+
}
|
|
39
|
+
export declare function ToastProvider(props: ToastProviderProps): Child;
|
|
40
|
+
export interface ToastViewportProps {
|
|
41
|
+
as?: string;
|
|
42
|
+
class?: any;
|
|
43
|
+
style?: any;
|
|
44
|
+
children?: (item: ToastData) => Child;
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}
|
|
47
|
+
export declare function ToastViewport(props: ToastViewportProps): Child;
|
|
48
|
+
export interface ToastProps {
|
|
49
|
+
id?: string;
|
|
50
|
+
variant?: ToastVariant;
|
|
51
|
+
onDismiss?: () => void;
|
|
52
|
+
as?: string;
|
|
53
|
+
class?: any;
|
|
54
|
+
style?: any;
|
|
55
|
+
children: Child | (() => Child);
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}
|
|
58
|
+
export declare function ToastRoot(props: ToastProps): Child;
|
|
59
|
+
export interface ToastTitleProps {
|
|
60
|
+
as?: string;
|
|
61
|
+
class?: any;
|
|
62
|
+
style?: any;
|
|
63
|
+
children: Child | (() => Child);
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
}
|
|
66
|
+
export declare function ToastTitle(props: ToastTitleProps): Child;
|
|
67
|
+
export interface ToastDescriptionProps {
|
|
68
|
+
as?: string;
|
|
69
|
+
class?: any;
|
|
70
|
+
style?: any;
|
|
71
|
+
children: Child | (() => Child);
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
}
|
|
74
|
+
export declare function ToastDescription(props: ToastDescriptionProps): Child;
|
|
75
|
+
export interface ToastCloseProps {
|
|
76
|
+
as?: string;
|
|
77
|
+
class?: any;
|
|
78
|
+
style?: any;
|
|
79
|
+
onClick?: (e: MouseEvent) => void;
|
|
80
|
+
children?: Child | (() => Child);
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}
|
|
83
|
+
export declare function ToastClose(props: ToastCloseProps): Child;
|
|
84
|
+
export declare const Toast: typeof ToastRoot & {
|
|
85
|
+
Root: typeof ToastRoot;
|
|
86
|
+
Provider: typeof ToastProvider;
|
|
87
|
+
Viewport: typeof ToastViewport;
|
|
88
|
+
Title: typeof ToastTitle;
|
|
89
|
+
Description: typeof ToastDescription;
|
|
90
|
+
Close: typeof ToastClose;
|
|
91
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Child } from "../dom/render";
|
|
2
|
+
import { type ReadonlySignal } from "../signals";
|
|
3
|
+
export interface TooltipContextValue {
|
|
4
|
+
open: ReadonlySignal<boolean>;
|
|
5
|
+
setOpen: (open: boolean) => void;
|
|
6
|
+
openDelay: number;
|
|
7
|
+
closeDelay: number;
|
|
8
|
+
tooltipId: string;
|
|
9
|
+
triggerRef: {
|
|
10
|
+
current: HTMLElement | null;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const TooltipContext: import("..").Context<TooltipContextValue | null>;
|
|
14
|
+
export declare function useTooltipContext(): TooltipContextValue | null;
|
|
15
|
+
export interface TooltipProps {
|
|
16
|
+
open?: () => boolean | undefined;
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
openDelay?: number;
|
|
20
|
+
closeDelay?: number;
|
|
21
|
+
content?: Child | (() => Child);
|
|
22
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
23
|
+
triggerClass?: any;
|
|
24
|
+
triggerAs?: string;
|
|
25
|
+
contentClass?: any;
|
|
26
|
+
contentStyle?: any;
|
|
27
|
+
portalled?: boolean;
|
|
28
|
+
children?: Child | (() => Child);
|
|
29
|
+
}
|
|
30
|
+
export declare function TooltipRoot(props: TooltipProps): Child;
|
|
31
|
+
export interface TooltipTriggerProps {
|
|
32
|
+
as?: string;
|
|
33
|
+
class?: any;
|
|
34
|
+
style?: any;
|
|
35
|
+
onMouseEnter?: (e: MouseEvent) => void;
|
|
36
|
+
onMouseLeave?: (e: MouseEvent) => void;
|
|
37
|
+
onFocus?: (e: FocusEvent) => void;
|
|
38
|
+
onBlur?: (e: FocusEvent) => void;
|
|
39
|
+
children: Child | (() => Child);
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}
|
|
42
|
+
export declare function TooltipTrigger(props: TooltipTriggerProps): Child;
|
|
43
|
+
export interface TooltipPortalProps {
|
|
44
|
+
mount?: HTMLElement | null;
|
|
45
|
+
children: Child | (() => Child);
|
|
46
|
+
}
|
|
47
|
+
export declare function TooltipPortal(props: TooltipPortalProps): Child;
|
|
48
|
+
export interface TooltipContentProps {
|
|
49
|
+
forceMount?: boolean;
|
|
50
|
+
portalled?: boolean;
|
|
51
|
+
mount?: HTMLElement | null;
|
|
52
|
+
as?: string;
|
|
53
|
+
class?: any;
|
|
54
|
+
style?: any;
|
|
55
|
+
children: Child | (() => Child);
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}
|
|
58
|
+
export declare function TooltipContent(props: TooltipContentProps): Child;
|
|
59
|
+
export declare const Tooltip: typeof TooltipRoot & {
|
|
60
|
+
Root: typeof TooltipRoot;
|
|
61
|
+
Trigger: typeof TooltipTrigger;
|
|
62
|
+
Portal: typeof TooltipPortal;
|
|
63
|
+
Content: typeof TooltipContent;
|
|
64
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReadonlySignal } from "../signals";
|
|
2
|
+
/**
|
|
3
|
+
* Generate a unique, deterministic ID for ARIA attributes
|
|
4
|
+
*/
|
|
5
|
+
export declare function createId(prefix?: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Helper for components that support both controlled and uncontrolled signal/value patterns
|
|
8
|
+
*/
|
|
9
|
+
export declare function createControllableSignal<T>(options: {
|
|
10
|
+
value?: () => T | undefined;
|
|
11
|
+
defaultValue?: T;
|
|
12
|
+
onChange?: (value: T) => void;
|
|
13
|
+
}): [ReadonlySignal<T>, (next: T | ((prev: T) => T)) => void];
|
|
14
|
+
/**
|
|
15
|
+
* Setup a focus trap inside a container element
|
|
16
|
+
*/
|
|
17
|
+
export declare function trapFocus(container: HTMLElement, event: KeyboardEvent): void;
|
|
18
|
+
/**
|
|
19
|
+
* Listen for click outside a target element
|
|
20
|
+
*/
|
|
21
|
+
export declare function onClickOutside(elements: Array<HTMLElement | null | undefined> | HTMLElement | null | undefined, handler: (event: MouseEvent | TouchEvent) => void): () => void;
|
|
@@ -848,10 +848,12 @@ class Signal {
|
|
|
848
848
|
_value;
|
|
849
849
|
_subscribers = new Set;
|
|
850
850
|
_equals;
|
|
851
|
+
_onSet;
|
|
851
852
|
version = 0;
|
|
852
|
-
constructor(initialValue, equals) {
|
|
853
|
+
constructor(initialValue, equals, onSet) {
|
|
853
854
|
this._value = initialValue;
|
|
854
855
|
this._equals = equals ?? Object.is;
|
|
856
|
+
this._onSet = onSet;
|
|
855
857
|
}
|
|
856
858
|
get() {
|
|
857
859
|
if (currentSubscriber !== null && currentSubscriber.state !== 3 /* DISPOSED */) {
|
|
@@ -876,6 +878,9 @@ class Signal {
|
|
|
876
878
|
}
|
|
877
879
|
this._value = newValue;
|
|
878
880
|
this.version++;
|
|
881
|
+
if (this._onSet) {
|
|
882
|
+
this._onSet(newValue);
|
|
883
|
+
}
|
|
879
884
|
batch(() => {
|
|
880
885
|
this.notify();
|
|
881
886
|
});
|
|
@@ -901,11 +906,91 @@ class Signal {
|
|
|
901
906
|
}
|
|
902
907
|
}
|
|
903
908
|
}
|
|
909
|
+
function resolveStorage(storageOption) {
|
|
910
|
+
if (storageOption && typeof storageOption === "object") {
|
|
911
|
+
return storageOption;
|
|
912
|
+
}
|
|
913
|
+
if (storageOption === "session") {
|
|
914
|
+
try {
|
|
915
|
+
if (typeof sessionStorage !== "undefined")
|
|
916
|
+
return sessionStorage;
|
|
917
|
+
} catch {}
|
|
918
|
+
try {
|
|
919
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
920
|
+
return window.sessionStorage;
|
|
921
|
+
}
|
|
922
|
+
} catch {}
|
|
923
|
+
try {
|
|
924
|
+
if (typeof globalThis !== "undefined" && globalThis.sessionStorage) {
|
|
925
|
+
return globalThis.sessionStorage;
|
|
926
|
+
}
|
|
927
|
+
} catch {}
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
try {
|
|
931
|
+
if (typeof localStorage !== "undefined")
|
|
932
|
+
return localStorage;
|
|
933
|
+
} catch {}
|
|
934
|
+
try {
|
|
935
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
936
|
+
return window.localStorage;
|
|
937
|
+
}
|
|
938
|
+
} catch {}
|
|
939
|
+
try {
|
|
940
|
+
if (typeof globalThis !== "undefined" && globalThis.localStorage) {
|
|
941
|
+
return globalThis.localStorage;
|
|
942
|
+
}
|
|
943
|
+
} catch {}
|
|
944
|
+
return null;
|
|
945
|
+
}
|
|
904
946
|
function signal(initialValue, optionsOrEquals) {
|
|
905
947
|
const equals = typeof optionsOrEquals === "function" ? optionsOrEquals : optionsOrEquals?.equals;
|
|
906
948
|
const isInternal = typeof optionsOrEquals === "object" ? optionsOrEquals?.internal : false;
|
|
907
949
|
const customName = typeof optionsOrEquals === "object" ? optionsOrEquals?.name : undefined;
|
|
908
|
-
const
|
|
950
|
+
const persistOption = typeof optionsOrEquals === "object" ? optionsOrEquals?.persist : undefined;
|
|
951
|
+
const persistConfig = persistOption ? typeof persistOption === "string" ? { key: persistOption } : persistOption : undefined;
|
|
952
|
+
let effectiveInitial = initialValue;
|
|
953
|
+
const storage = persistConfig ? resolveStorage(persistConfig.storage) : null;
|
|
954
|
+
const serialize = persistConfig?.serialize ?? JSON.stringify;
|
|
955
|
+
const deserialize = persistConfig?.deserialize ?? JSON.parse;
|
|
956
|
+
if (persistConfig && storage) {
|
|
957
|
+
try {
|
|
958
|
+
const stored = storage.getItem(persistConfig.key);
|
|
959
|
+
if (stored !== null) {
|
|
960
|
+
effectiveInitial = deserialize(stored);
|
|
961
|
+
}
|
|
962
|
+
} catch {}
|
|
963
|
+
}
|
|
964
|
+
let isSyncing = false;
|
|
965
|
+
const onSet = persistConfig && storage ? (val) => {
|
|
966
|
+
if (isSyncing)
|
|
967
|
+
return;
|
|
968
|
+
try {
|
|
969
|
+
storage.setItem(persistConfig.key, serialize(val));
|
|
970
|
+
} catch {}
|
|
971
|
+
} : undefined;
|
|
972
|
+
const s = new Signal(effectiveInitial, equals, onSet);
|
|
973
|
+
if (persistConfig && storage && (persistConfig.syncTabs ?? true) && typeof window !== "undefined" && typeof window.addEventListener === "function") {
|
|
974
|
+
const onStorage = (e) => {
|
|
975
|
+
if (e.key === persistConfig.key) {
|
|
976
|
+
try {
|
|
977
|
+
const nextVal = e.newValue !== null ? deserialize(e.newValue) : initialValue;
|
|
978
|
+
isSyncing = true;
|
|
979
|
+
try {
|
|
980
|
+
s.set(nextVal);
|
|
981
|
+
} finally {
|
|
982
|
+
isSyncing = false;
|
|
983
|
+
}
|
|
984
|
+
} catch {}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
window.addEventListener("storage", onStorage);
|
|
988
|
+
if (currentScope) {
|
|
989
|
+
currentScope.addCleanup(() => {
|
|
990
|
+
window.removeEventListener("storage", onStorage);
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
}
|
|
909
994
|
const accessor = (...args) => {
|
|
910
995
|
if (args.length === 0) {
|
|
911
996
|
return s.get();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface VirtualListProps<T> {
|
|
2
|
+
each: T[] | (() => T[]);
|
|
3
|
+
itemHeight: number | ((index: number) => number);
|
|
4
|
+
height?: number | string;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
overscan?: number;
|
|
7
|
+
class?: string;
|
|
8
|
+
style?: Record<string, any> | (() => Record<string, any>);
|
|
9
|
+
children: (item: T, index: () => number) => any;
|
|
10
|
+
}
|
|
11
|
+
export declare function VirtualList<T>(props: VirtualListProps<T>): import("..").JSX.Element;
|
|
12
|
+
export interface VirtualGridProps<T> {
|
|
13
|
+
data: T[][] | (() => T[][]);
|
|
14
|
+
rowHeight: number;
|
|
15
|
+
columnWidth: number;
|
|
16
|
+
height?: number | string;
|
|
17
|
+
width?: number | string;
|
|
18
|
+
overscan?: number;
|
|
19
|
+
children: (item: T, rowIndex: number, colIndex: number) => any;
|
|
20
|
+
}
|
|
21
|
+
export declare function VirtualGrid<T>(props: VirtualGridProps<T>): import("..").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReadonlySignal } from "../signals";
|
|
2
|
+
export interface VirtualItem {
|
|
3
|
+
index: number;
|
|
4
|
+
start: number;
|
|
5
|
+
size: number;
|
|
6
|
+
end: number;
|
|
7
|
+
key: number | string;
|
|
8
|
+
}
|
|
9
|
+
export interface VirtualizerOptions {
|
|
10
|
+
count: number | (() => number);
|
|
11
|
+
itemHeight: number | ((index: number) => number);
|
|
12
|
+
getScrollElement: () => HTMLElement | null;
|
|
13
|
+
overscan?: number;
|
|
14
|
+
horizontal?: boolean;
|
|
15
|
+
initialSize?: number;
|
|
16
|
+
estimateSize?: (index: number) => number;
|
|
17
|
+
}
|
|
18
|
+
export interface Virtualizer {
|
|
19
|
+
virtualItems: ReadonlySignal<VirtualItem[]>;
|
|
20
|
+
totalSize: ReadonlySignal<number>;
|
|
21
|
+
scrollOffset: ReadonlySignal<number>;
|
|
22
|
+
containerSize: ReadonlySignal<number>;
|
|
23
|
+
startIndex: ReadonlySignal<number>;
|
|
24
|
+
endIndex: ReadonlySignal<number>;
|
|
25
|
+
scrollToIndex: (index: number, options?: {
|
|
26
|
+
align?: "start" | "center" | "end" | "auto";
|
|
27
|
+
}) => void;
|
|
28
|
+
scrollToOffset: (offset: number) => void;
|
|
29
|
+
measureElement: (element: HTMLElement | null, index: number) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createVirtualizer(options: VirtualizerOptions): Virtualizer;
|
|
@@ -941,6 +941,10 @@ function visage(options = {}) {
|
|
|
941
941
|
]
|
|
942
942
|
},
|
|
943
943
|
resolve: {
|
|
944
|
+
alias: [
|
|
945
|
+
{ find: /^visage\/(.*)/, replacement: "@epoch32/visage/$1" },
|
|
946
|
+
{ find: /^visage$/, replacement: "@epoch32/visage" }
|
|
947
|
+
],
|
|
944
948
|
dedupe: ["@epoch32/visage", "visage"]
|
|
945
949
|
}
|
|
946
950
|
};
|