@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,27 @@
|
|
|
1
|
+
import type { CurveType, Point } from "./types";
|
|
2
|
+
export interface PathLineOptions {
|
|
3
|
+
curve?: CurveType;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Generates an SVG path `d` string representing a polyline or smooth spline curve.
|
|
7
|
+
*/
|
|
8
|
+
export declare function pathLine(points: Point[], options?: PathLineOptions): string;
|
|
9
|
+
export interface PathAreaOptions {
|
|
10
|
+
curve?: CurveType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generates an SVG path `d` string for a closed area polygon, anchored to a baseline Y coordinate.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pathArea(points: Point[], baselineY: number, options?: PathAreaOptions): string;
|
|
16
|
+
export interface ArcOptions {
|
|
17
|
+
cx: number;
|
|
18
|
+
cy: number;
|
|
19
|
+
innerRadius: number;
|
|
20
|
+
outerRadius: number;
|
|
21
|
+
startAngle: number;
|
|
22
|
+
endAngle: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generates an SVG arc path string for a pie or donut slice.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pathArc(options: ArcOptions): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BandScale, LinearScale } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates human-friendly rounded tick marks across a numerical interval.
|
|
4
|
+
* Uses the standard Wilkinson-style step rounding algorithm.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateNiceTicks(min: number, max: number, count?: number): number[];
|
|
7
|
+
export interface LinearScaleOptions {
|
|
8
|
+
clamp?: boolean;
|
|
9
|
+
nice?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a continuous linear mathematical scale mapping input domain to SVG pixel range.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createLinearScale(domain: [number, number], range: [number, number], options?: LinearScaleOptions): LinearScale;
|
|
15
|
+
export interface BandScaleOptions {
|
|
16
|
+
paddingInner?: number;
|
|
17
|
+
paddingOuter?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates an ordinal band scale mapping categorical strings (e.g. months, labels)
|
|
21
|
+
* to partitioned SVG pixel bands (used by Bar and column charts).
|
|
22
|
+
*/
|
|
23
|
+
export declare function createBandScale(domain: any[], range: [number, number], options?: BandScaleOptions): BandScale;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface Margin {
|
|
2
|
+
top: number;
|
|
3
|
+
right: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
left: number;
|
|
6
|
+
}
|
|
7
|
+
export type CurveType = "linear" | "smooth" | "step";
|
|
8
|
+
export interface Point {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
export interface LinearScale {
|
|
13
|
+
type: "linear";
|
|
14
|
+
(val: number): number;
|
|
15
|
+
domain: [number, number];
|
|
16
|
+
range: [number, number];
|
|
17
|
+
invert: (pixel: number) => number;
|
|
18
|
+
ticks: (count?: number) => number[];
|
|
19
|
+
}
|
|
20
|
+
export interface BandScale {
|
|
21
|
+
type: "band";
|
|
22
|
+
(val: any): number;
|
|
23
|
+
domain: any[];
|
|
24
|
+
range: [number, number];
|
|
25
|
+
bandwidth: () => number;
|
|
26
|
+
step: () => number;
|
|
27
|
+
ticks: () => any[];
|
|
28
|
+
}
|
|
29
|
+
export type AnyScale = LinearScale | BandScale;
|
|
30
|
+
export interface HoverState {
|
|
31
|
+
active: boolean;
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
index: number;
|
|
35
|
+
datum?: any;
|
|
36
|
+
}
|
|
37
|
+
export interface SeriesMeta {
|
|
38
|
+
id: string;
|
|
39
|
+
dataKey: string;
|
|
40
|
+
type: "line" | "area" | "bar";
|
|
41
|
+
color?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WritableSignal } from "../signals";
|
|
2
|
+
import type { SignalRecord } from "./types";
|
|
3
|
+
interface GraphInspectorProps {
|
|
4
|
+
selectedNode: () => SignalRecord | null;
|
|
5
|
+
selectedId: WritableSignal<string | null>;
|
|
6
|
+
getDependencies: (node: SignalRecord) => SignalRecord[];
|
|
7
|
+
getDependents: (node: SignalRecord) => SignalRecord[];
|
|
8
|
+
formatJSON: (val: any) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare function GraphInspector(props: GraphInspectorProps): import("..").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type WritableSignal } from "../signals";
|
|
2
|
+
import type { DevToolsHub } from "./hub";
|
|
3
|
+
interface GraphTabProps {
|
|
4
|
+
hub: DevToolsHub;
|
|
5
|
+
selectedId: WritableSignal<string | null>;
|
|
6
|
+
searchQuery: WritableSignal<string>;
|
|
7
|
+
formatJSON: (val: any) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function GraphTab(props: GraphTabProps): import("..").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WritableSignal } from "../signals";
|
|
2
|
+
import type { DevToolsHub } from "./hub";
|
|
3
|
+
interface QueryTabProps {
|
|
4
|
+
hub: DevToolsHub;
|
|
5
|
+
selectedId: WritableSignal<string | null>;
|
|
6
|
+
searchQuery: WritableSignal<string>;
|
|
7
|
+
formatJSON: (val: any) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function QueryTab(props: QueryTabProps): import("..").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WritableSignal } from "../signals";
|
|
2
|
+
import type { DevToolsHub } from "./hub";
|
|
3
|
+
interface RpcTabProps {
|
|
4
|
+
hub: DevToolsHub;
|
|
5
|
+
selectedId: WritableSignal<string | null>;
|
|
6
|
+
searchQuery: WritableSignal<string>;
|
|
7
|
+
formatJSON: (val: any) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function RpcTab(props: RpcTabProps): import("..").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WritableSignal } from "../signals";
|
|
2
|
+
import type { DevToolsHub } from "./hub";
|
|
3
|
+
interface SignalsTabProps {
|
|
4
|
+
hub: DevToolsHub;
|
|
5
|
+
selectedId: WritableSignal<string | null>;
|
|
6
|
+
searchQuery: WritableSignal<string>;
|
|
7
|
+
formatJSON: (val: any) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function SignalsTab(props: SignalsTabProps): import("..").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { QueryClient } from "../query/query-client";
|
|
2
|
+
import type { DevToolsTab, QueryRecord, RpcRecord, SignalRecord } from "./types";
|
|
3
|
+
export declare class DevToolsHub {
|
|
4
|
+
readonly isOpen: import("..").WritableSignal<boolean>;
|
|
5
|
+
readonly activeTab: import("..").WritableSignal<DevToolsTab>;
|
|
6
|
+
readonly highlightDOM: import("..").WritableSignal<boolean>;
|
|
7
|
+
readonly searchQuery: import("..").WritableSignal<string>;
|
|
8
|
+
private _signalsMap;
|
|
9
|
+
readonly signalsList: import("..").WritableSignal<SignalRecord[]>;
|
|
10
|
+
private _queriesMap;
|
|
11
|
+
readonly queriesList: import("..").WritableSignal<QueryRecord[]>;
|
|
12
|
+
readonly rpcLogs: import("..").WritableSignal<RpcRecord[]>;
|
|
13
|
+
private _queryClients;
|
|
14
|
+
private _signalCounter;
|
|
15
|
+
constructor();
|
|
16
|
+
toggle(): void;
|
|
17
|
+
setTab(tab: DevToolsTab): void;
|
|
18
|
+
registerSignal(options: {
|
|
19
|
+
id?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
type?: "signal" | "computed";
|
|
22
|
+
getValue: () => any;
|
|
23
|
+
version: () => number;
|
|
24
|
+
dependencies?: () => string[];
|
|
25
|
+
dependents?: () => string[];
|
|
26
|
+
subscribersCount?: () => number;
|
|
27
|
+
}): string;
|
|
28
|
+
unregisterSignal(id: string): void;
|
|
29
|
+
clearSignals(): void;
|
|
30
|
+
clearQueries(): void;
|
|
31
|
+
clearAll(): void;
|
|
32
|
+
private refreshSignals;
|
|
33
|
+
attachQueryClient(client: QueryClient): void;
|
|
34
|
+
logRpcCall(record: Omit<RpcRecord, "status" | "startTime"> & {
|
|
35
|
+
status?: RpcRecord["status"];
|
|
36
|
+
}): string;
|
|
37
|
+
updateRpcCall(id: string, updates: Partial<RpcRecord>): void;
|
|
38
|
+
logRpcEvent(id: string, data: any): void;
|
|
39
|
+
clearLogs(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare const devtoolsHub: DevToolsHub;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { QueryClient } from "../query/query-client";
|
|
2
|
+
export { VisageDevTools } from "./component";
|
|
3
|
+
export { highlightElement } from "./highlighter";
|
|
4
|
+
export { DevToolsHub, devtoolsHub } from "./hub";
|
|
5
|
+
export type { DevToolsOptions, DevToolsTab, QueryRecord, RpcRecord, SignalRecord } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Connect QueryClient or RPC client to Visage DevTools
|
|
8
|
+
*/
|
|
9
|
+
export declare function connectDevTools(client: QueryClient): 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 @@
|
|
|
1
|
+
export declare const devtoolsStyles = "\n .visage-devtools-root {\n position: fixed;\n z-index: 999999;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n font-size: 13px;\n color: #f1f5f9;\n box-sizing: border-box;\n }\n .visage-devtools-root * {\n box-sizing: border-box;\n }\n .visage-devtools-trigger {\n position: fixed;\n bottom: 20px;\n left: 20px;\n background: #0f172a;\n color: #38bdf8;\n border: 1px solid #334155;\n border-radius: 9999px;\n padding: 8px 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n font-weight: 600;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 0 10px rgba(56, 189, 248, 0.2);\n transition: all 0.2s ease;\n z-index: 999999;\n }\n .visage-devtools-trigger:hover {\n background: #1e293b;\n border-color: #38bdf8;\n transform: translateY(-2px);\n }\n .visage-devtools-drawer {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n height: 420px;\n background: #090d16;\n border-top: 1px solid #1e293b;\n display: flex;\n flex-direction: column;\n box-shadow: 0 -20px 25px -5px rgba(0, 0, 0, 0.7);\n z-index: 999999;\n }\n .visage-devtools-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 16px;\n background: #0f172a;\n border-bottom: 1px solid #1e293b;\n }\n .visage-devtools-tabs {\n display: flex;\n gap: 4px;\n }\n .visage-devtools-tab {\n background: transparent;\n border: none;\n color: #94a3b8;\n padding: 6px 12px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 12px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n .visage-devtools-tab:hover {\n color: #f1f5f9;\n background: #1e293b;\n }\n .visage-devtools-tab.active {\n color: #38bdf8;\n background: #1e293b;\n font-weight: 600;\n }\n .visage-devtools-badge {\n background: #334155;\n color: #f1f5f9;\n padding: 1px 6px;\n border-radius: 9999px;\n font-size: 10px;\n font-weight: 600;\n }\n .visage-devtools-body {\n flex: 1;\n display: flex;\n overflow: hidden;\n }\n .visage-devtools-sidebar {\n width: 320px;\n border-right: 1px solid #1e293b;\n display: flex;\n flex-direction: column;\n background: #0c111d;\n }\n .visage-devtools-search {\n padding: 8px;\n border-bottom: 1px solid #1e293b;\n }\n .visage-devtools-input {\n width: 100%;\n background: #090d16;\n border: 1px solid #334155;\n border-radius: 6px;\n color: #f1f5f9;\n padding: 6px 10px;\n font-size: 12px;\n outline: none;\n }\n .visage-devtools-input:focus {\n border-color: #38bdf8;\n }\n .visage-devtools-list {\n flex: 1;\n overflow-y: auto;\n padding: 4px;\n }\n .visage-devtools-item {\n padding: 8px 10px;\n border-radius: 6px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 2px;\n font-size: 12px;\n }\n .visage-devtools-item:hover {\n background: #1e293b;\n }\n .visage-devtools-item.selected {\n background: #1e293b;\n border-left: 3px solid #38bdf8;\n }\n .visage-devtools-main {\n flex: 1;\n padding: 16px;\n overflow-y: auto;\n background: #090d16;\n }\n .visage-devtools-json {\n background: #050811;\n border: 1px solid #1e293b;\n border-radius: 6px;\n padding: 12px;\n font-family: \"JetBrains Mono\", Menlo, Monaco, Consolas, monospace;\n font-size: 12px;\n color: #38bdf8;\n overflow-x: auto;\n white-space: pre-wrap;\n }\n .visage-devtools-actions {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n .visage-devtools-btn {\n background: #1e293b;\n border: 1px solid #334155;\n color: #f1f5f9;\n padding: 4px 10px;\n border-radius: 4px;\n font-size: 11px;\n cursor: pointer;\n font-weight: 500;\n }\n .visage-devtools-btn:hover {\n background: #334155;\n }\n .visage-devtools-btn.active {\n background: #0284c7;\n border-color: #38bdf8;\n }\n /* DAG Graph Visualization */\n .visage-graph-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: #050811;\n position: relative;\n }\n .visage-graph-toolbar {\n padding: 8px 16px;\n background: #090d16;\n border-bottom: 1px solid #1e293b;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n }\n .visage-graph-canvas {\n flex: 1;\n overflow: auto;\n padding: 24px;\n position: relative;\n display: flex;\n gap: 40px;\n }\n .visage-graph-column {\n display: flex;\n flex-direction: column;\n gap: 16px;\n min-width: 220px;\n }\n .visage-graph-col-header {\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #64748b;\n margin-bottom: 4px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n .visage-graph-node {\n background: #0f172a;\n border: 1px solid #1e293b;\n border-radius: 8px;\n padding: 10px 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n position: relative;\n }\n .visage-graph-node:hover {\n border-color: #38bdf8;\n transform: translateY(-2px);\n box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);\n }\n .visage-graph-node.selected {\n border-color: #38bdf8;\n box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);\n background: #131d35;\n }\n .visage-graph-node.is-dependency {\n border-color: #38bdf8;\n box-shadow: 0 0 0 1px #38bdf8, 0 2px 8px rgba(56, 189, 248, 0.25);\n background: #082f49;\n }\n .visage-graph-node.is-dependent {\n border-color: #c084fc;\n box-shadow: 0 0 0 1px #c084fc, 0 2px 8px rgba(192, 132, 252, 0.25);\n background: #3b0764;\n }\n .visage-graph-node.is-dimmed {\n opacity: 0.3;\n filter: grayscale(0.5);\n }\n .visage-graph-node-title {\n font-weight: 600;\n font-size: 12px;\n color: #f8fafc;\n margin-bottom: 4px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .visage-graph-node-val {\n font-family: monospace;\n font-size: 11px;\n color: #94a3b8;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 190px;\n }\n .visage-graph-pulse {\n display: inline-block;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: #10b981;\n box-shadow: 0 0 8px #10b981;\n }\n .visage-graph-pulse.computed {\n background: #a855f7;\n box-shadow: 0 0 8px #a855f7;\n }\n .visage-graph-pill {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: #1e293b;\n color: #cbd5e1;\n padding: 3px 8px;\n border-radius: 4px;\n font-size: 11px;\n cursor: pointer;\n border: 1px solid #334155;\n transition: all 0.15s ease;\n }\n .visage-graph-pill:hover {\n background: #334155;\n color: #fff;\n border-color: #38bdf8;\n }\n .visage-graph-pill.source {\n border-color: #0369a1;\n color: #7dd3fc;\n }\n .visage-graph-pill.target {\n border-color: #7e22ce;\n color: #d8b4fe;\n }\n";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type DevToolsTab = "signals" | "graph" | "query" | "rpc" | "dom" | "concepts";
|
|
2
|
+
export interface SignalRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: "signal" | "computed";
|
|
6
|
+
getValue: () => any;
|
|
7
|
+
version: () => number;
|
|
8
|
+
dependencies?: () => string[];
|
|
9
|
+
dependents?: () => string[];
|
|
10
|
+
subscribersCount?: () => number;
|
|
11
|
+
lastUpdatedAt: number;
|
|
12
|
+
}
|
|
13
|
+
export interface QueryRecord {
|
|
14
|
+
hash: string;
|
|
15
|
+
key: any;
|
|
16
|
+
status: () => string;
|
|
17
|
+
fetchStatus: () => string;
|
|
18
|
+
data: () => any;
|
|
19
|
+
error: () => any;
|
|
20
|
+
dataUpdatedAt: () => number;
|
|
21
|
+
refetch?: () => Promise<any>;
|
|
22
|
+
invalidate?: () => void;
|
|
23
|
+
}
|
|
24
|
+
export interface RpcRecord {
|
|
25
|
+
id: string;
|
|
26
|
+
path: string;
|
|
27
|
+
type: "query" | "mutation" | "subscription";
|
|
28
|
+
input: any;
|
|
29
|
+
response?: any;
|
|
30
|
+
error?: any;
|
|
31
|
+
status: "pending" | "success" | "error" | "streaming";
|
|
32
|
+
startTime: number;
|
|
33
|
+
duration?: number;
|
|
34
|
+
events?: Array<{
|
|
35
|
+
timestamp: number;
|
|
36
|
+
data: any;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface DevToolsOptions {
|
|
40
|
+
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
41
|
+
initialOpen?: boolean;
|
|
42
|
+
initialTab?: DevToolsTab;
|
|
43
|
+
highlightDOM?: boolean;
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Child } from "./render";
|
|
2
|
+
import { createResource, type Resource, type ResourceActions, SuspenseContext, type SuspenseContextValue } from "./resource";
|
|
3
|
+
export { type Component, type LazyComponent, lazy } from "./lazy";
|
|
4
|
+
export { createResource, type Resource, type ResourceActions, SuspenseContext, type SuspenseContextValue };
|
|
5
|
+
export interface SuspenseProps {
|
|
6
|
+
fallback: Child;
|
|
7
|
+
children: Child | (() => Child);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Suspense boundary for fine-grained async coordination.
|
|
11
|
+
* Displays the `fallback` UI while child async resources or queries are loading.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Suspense fallback={<div>Loading profile...</div>}>
|
|
16
|
+
* <UserProfile />
|
|
17
|
+
* </Suspense>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function Suspense(props: SuspenseProps): any;
|
|
21
|
+
export interface ErrorBoundaryProps {
|
|
22
|
+
fallback: Child | ((error: any, reset: () => void) => Child);
|
|
23
|
+
children: Child | (() => Child);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Catches JavaScript rendering and effect errors in descendant subtrees
|
|
27
|
+
* and displays a fallback UI instead of crashing the application.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <ErrorBoundary fallback={(err, reset) => (
|
|
32
|
+
* <div>
|
|
33
|
+
* <p>Something went wrong: {err.message}</p>
|
|
34
|
+
* <button onClick={reset}>Retry</button>
|
|
35
|
+
* </div>
|
|
36
|
+
* )}>
|
|
37
|
+
* <RiskyComponent />
|
|
38
|
+
* </ErrorBoundary>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function ErrorBoundary(props: ErrorBoundaryProps): any;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Child, type ReactiveValue } from "./render";
|
|
2
|
+
export interface ShowProps<T> {
|
|
3
|
+
when: ReactiveValue<T | false | null | undefined>;
|
|
4
|
+
fallback?: Child;
|
|
5
|
+
children: Child | ((item: () => T) => Child);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Conditionally renders JSX children when the `when` condition evaluates to truthy,
|
|
9
|
+
* with fine-grained reactive scope lifecycle management and automatic fallback rendering.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const loggedIn = signal(false);
|
|
14
|
+
*
|
|
15
|
+
* <Show when={loggedIn} fallback={<div>Please log in</div>}>
|
|
16
|
+
* <Dashboard />
|
|
17
|
+
* </Show>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function Show<T>(props: ShowProps<T>): any;
|
|
21
|
+
export interface ForProps<T> {
|
|
22
|
+
each: ReactiveValue<readonly T[] | undefined | null>;
|
|
23
|
+
fallback?: Child;
|
|
24
|
+
children: (item: T, index: () => number) => Child;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Keyed / referential list renderer with fine-grained item reconciliation.
|
|
28
|
+
*
|
|
29
|
+
* Items in the list are reused across array mutations without re-rendering existing items
|
|
30
|
+
* or tearing down their active reactive scopes.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const items = signal(["Apple", "Banana", "Cherry"]);
|
|
35
|
+
*
|
|
36
|
+
* <For each={items} fallback={<div>No items found</div>}>
|
|
37
|
+
* {(item, index) => (
|
|
38
|
+
* <li>
|
|
39
|
+
* {index() + 1}. {item}
|
|
40
|
+
* </li>
|
|
41
|
+
* )}
|
|
42
|
+
* </For>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function For<T>(props: ForProps<T>): any;
|
|
46
|
+
export interface PortalProps {
|
|
47
|
+
mount?: HTMLElement | null;
|
|
48
|
+
children: Child | (() => Child);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Portal renders children into a different DOM container while preserving reactive context
|
|
52
|
+
*/
|
|
53
|
+
export declare function Portal(props: PortalProps): any;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type Component, createResource, ErrorBoundary, type ErrorBoundaryProps, type LazyComponent, lazy, type Resource, type ResourceActions, Suspense, SuspenseContext, type SuspenseContextValue, type SuspenseProps } from "./async";
|
|
2
|
+
export { For, type ForProps, Portal, type PortalProps, Show, type ShowProps } from "./control-flow";
|
|
3
|
+
export { type Child, insertChild, isReactive, type ReactiveValue, render, resolveValue, setAttribute } from "./render";
|