@epoch32/visage 0.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/index.js +3571 -1293
- 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/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/vite/index.js +296 -15
- 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
- package/dist/bundle.dev.js +0 -4875
- package/dist/src/index.js +0 -11826
- package/dist/src/vite/index.js +0 -984
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Child } from "../dom/render";
|
|
2
|
+
import { type StyleDefinition } from "./create-style";
|
|
3
|
+
export interface StyleProps {
|
|
4
|
+
children?: string | StyleDefinition | (() => string | StyleDefinition);
|
|
5
|
+
classes?: StyleDefinition | (() => StyleDefinition);
|
|
6
|
+
passToChildren?: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Scoped Component Style Block
|
|
11
|
+
*
|
|
12
|
+
* Automatically hashes and scopes CSS rules to the parent component/container,
|
|
13
|
+
* preventing style leaks and collisions. Supports CSS strings or JavaScript style objects.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
*
|
|
17
|
+
* 1. Object syntax:
|
|
18
|
+
* ```tsx
|
|
19
|
+
* export function Card(props) {
|
|
20
|
+
* return (
|
|
21
|
+
* <div class="card">
|
|
22
|
+
* <h2>{props.title}</h2>
|
|
23
|
+
* <Style classes={{
|
|
24
|
+
* card: { background: "var(--card-bg)", padding: "20px", borderRadius: "8px" },
|
|
25
|
+
* "& h2": { fontSize: "1.2rem", color: "var(--text)" }
|
|
26
|
+
* }} />
|
|
27
|
+
* </div>
|
|
28
|
+
* );
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* 2. Component Scoped CSS string:
|
|
33
|
+
* ```tsx
|
|
34
|
+
* export function StepItem(props) {
|
|
35
|
+
* return (
|
|
36
|
+
* <div class="step-node">
|
|
37
|
+
* <span class="step-num">{props.step}</span>
|
|
38
|
+
* <span>{props.title}</span>
|
|
39
|
+
*
|
|
40
|
+
* <Style>{`
|
|
41
|
+
* .step-node { display: flex; align-items: center; gap: 8px; }
|
|
42
|
+
* .step-num { font-weight: 600; color: var(--primary); }
|
|
43
|
+
* `}</Style>
|
|
44
|
+
* </div>
|
|
45
|
+
* );
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function Style(props: StyleProps): Child;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type * as CSS from "csstype";
|
|
2
|
+
import { type ClassValue } from "./cx";
|
|
3
|
+
/**
|
|
4
|
+
* Standard CSS Properties interface with full TypeScript & VS Code IntelliSense,
|
|
5
|
+
* supporting nested pseudo-classes, descendant selectors, and custom CSS variables.
|
|
6
|
+
*/
|
|
7
|
+
export type CSSProperties = CSS.Properties<string | number> & {
|
|
8
|
+
[key: `&${string}`]: CSSProperties | undefined;
|
|
9
|
+
[key: `.${string}`]: CSSProperties | undefined;
|
|
10
|
+
[key: `:${string}`]: CSSProperties | undefined;
|
|
11
|
+
[key: `@media${string}`]: CSSProperties | undefined;
|
|
12
|
+
[key: `@keyframes${string}`]: Record<string, CSSProperties> | undefined;
|
|
13
|
+
[key: `${number}%`]: CSSProperties | undefined;
|
|
14
|
+
from?: CSSProperties;
|
|
15
|
+
to?: CSSProperties;
|
|
16
|
+
[customProp: `--${string}`]: string | number | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type StyleDefinition = Record<string, CSSProperties>;
|
|
19
|
+
export type StyleClasses<T extends string = string> = {
|
|
20
|
+
[K in T]: string;
|
|
21
|
+
} & Record<string, any> & {
|
|
22
|
+
scope: string;
|
|
23
|
+
scopeAttr: string;
|
|
24
|
+
css: string;
|
|
25
|
+
cx: (...args: ClassValue[]) => string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Convert a JavaScript object style dictionary into standard CSS
|
|
29
|
+
*/
|
|
30
|
+
export declare function objectToCSS(classes: Record<string, any>): string;
|
|
31
|
+
/**
|
|
32
|
+
* Define scoped CSS styles with type-safe class name mappings
|
|
33
|
+
*
|
|
34
|
+
* Supports tagged template literals, string CSS, or JavaScript style objects:
|
|
35
|
+
*
|
|
36
|
+
* 1. Object syntax with full VS Code CSS IntelliSense:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const styles = createStyle({
|
|
39
|
+
* card: { background: "var(--card-bg)", padding: "16px", display: "flex" },
|
|
40
|
+
* button: { background: "var(--primary)", "&:hover": { background: "var(--primary-hover)" } }
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* 2. Tagged template literal syntax:
|
|
45
|
+
* ```tsx
|
|
46
|
+
* const styles = createStyle`
|
|
47
|
+
* .card { padding: 16px; border-radius: 8px; }
|
|
48
|
+
* .active { color: var(--primary); }
|
|
49
|
+
* `;
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function createStyle<T extends string = string>(templateOrObject: string | TemplateStringsArray | StyleDefinition, ...valuesOrOptions: any[]): StyleClasses<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Tagged template for defining a single scoped CSS class
|
|
55
|
+
*/
|
|
56
|
+
export declare function css(strings: TemplateStringsArray, ...values: any[]): string;
|
|
57
|
+
/**
|
|
58
|
+
* Hook to inject dynamic or component-level CSS with automatic cleanup
|
|
59
|
+
*/
|
|
60
|
+
export declare function useStyle(cssInput: string | StyleDefinition | (() => string | StyleDefinition), options?: {
|
|
61
|
+
passToChildren?: boolean;
|
|
62
|
+
id?: string;
|
|
63
|
+
}): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ClassValue = string | number | boolean | null | undefined | (() => any) | ClassValue[] | Record<string, any>;
|
|
2
|
+
/**
|
|
3
|
+
* Check if a class value tree contains any reactive signal or function getters
|
|
4
|
+
*/
|
|
5
|
+
export declare function hasReactiveClass(val: any): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Normalize dynamic classes from strings, numbers, arrays, and objects
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeClass(val: any): string;
|
|
10
|
+
/**
|
|
11
|
+
* Flexible classnames utility for combining conditional classes
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* ```ts
|
|
15
|
+
* cx("btn", { active: isActive(), disabled: !isEnabled() }, ["extra-1", extraClass])
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function cx(...args: ClassValue[]): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast 32-bit FNV-1a deterministic string hashing algorithm
|
|
3
|
+
*/
|
|
4
|
+
export declare function hashString(str: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate a deterministic scope identifier for CSS blocks
|
|
7
|
+
*/
|
|
8
|
+
export declare function getScopeId(css: string, prefix?: string): string;
|
|
@@ -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,129 @@
|
|
|
1
|
+
import type { Child } from "../dom";
|
|
2
|
+
import type { ClassProp, HTMLAttributes } from "../jsx-runtime/jsx";
|
|
3
|
+
export interface BaseLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
as?: string;
|
|
5
|
+
gap?: number | string;
|
|
6
|
+
p?: number | string;
|
|
7
|
+
px?: number | string;
|
|
8
|
+
py?: number | string;
|
|
9
|
+
pt?: number | string;
|
|
10
|
+
pb?: number | string;
|
|
11
|
+
pl?: number | string;
|
|
12
|
+
pr?: number | string;
|
|
13
|
+
m?: number | string;
|
|
14
|
+
mx?: number | string;
|
|
15
|
+
my?: number | string;
|
|
16
|
+
mt?: number | string;
|
|
17
|
+
mb?: number | string;
|
|
18
|
+
ml?: number | string;
|
|
19
|
+
mr?: number | string;
|
|
20
|
+
w?: number | string;
|
|
21
|
+
h?: number | string;
|
|
22
|
+
minW?: number | string;
|
|
23
|
+
maxW?: number | string;
|
|
24
|
+
minH?: number | string;
|
|
25
|
+
maxH?: number | string;
|
|
26
|
+
class?: ClassProp;
|
|
27
|
+
className?: ClassProp;
|
|
28
|
+
style?: any;
|
|
29
|
+
children?: Child;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export interface StackProps extends BaseLayoutProps {
|
|
33
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
34
|
+
justify?: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
35
|
+
direction?: "vertical" | "horizontal";
|
|
36
|
+
reversed?: boolean;
|
|
37
|
+
wrap?: boolean | "wrap" | "nowrap" | "wrap-reverse";
|
|
38
|
+
inline?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* <Stack> Layout Primitive
|
|
42
|
+
*
|
|
43
|
+
* Vertical (column) layout by default. Provides zero margin collapse,
|
|
44
|
+
* built-in spatial scale gap, and automatic flex overflow containment.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* <Stack gap={4} align="center">
|
|
48
|
+
* <Header />
|
|
49
|
+
* <Content />
|
|
50
|
+
* </Stack>
|
|
51
|
+
*/
|
|
52
|
+
export declare function Stack(props: StackProps): Child;
|
|
53
|
+
export interface RowProps extends BaseLayoutProps {
|
|
54
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
55
|
+
justify?: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
56
|
+
reversed?: boolean;
|
|
57
|
+
wrap?: boolean | "wrap" | "nowrap" | "wrap-reverse";
|
|
58
|
+
inline?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* <Row> Layout Primitive
|
|
62
|
+
*
|
|
63
|
+
* Horizontal row layout with sensible vertical centering (align="center") by default.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* <Row gap={3} justify="between">
|
|
67
|
+
* <Avatar />
|
|
68
|
+
* <Typography>Online</Typography>
|
|
69
|
+
* </Row>
|
|
70
|
+
*/
|
|
71
|
+
export declare function Row(props: RowProps): Child;
|
|
72
|
+
export interface CenterProps extends BaseLayoutProps {
|
|
73
|
+
inline?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* <Center> Layout Primitive
|
|
77
|
+
*
|
|
78
|
+
* Centers child content horizontally and vertically without CSS boilerplate.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* <Center h="screen">
|
|
82
|
+
* <Spinner />
|
|
83
|
+
* </Center>
|
|
84
|
+
*/
|
|
85
|
+
export declare function Center(props: CenterProps): Child;
|
|
86
|
+
export interface GridProps extends BaseLayoutProps {
|
|
87
|
+
columns?: number | string;
|
|
88
|
+
minChildWidth?: number | string;
|
|
89
|
+
rows?: number | string;
|
|
90
|
+
rowGap?: number | string;
|
|
91
|
+
colGap?: number | string;
|
|
92
|
+
align?: "start" | "center" | "end" | "stretch";
|
|
93
|
+
justify?: "start" | "center" | "end" | "stretch";
|
|
94
|
+
inline?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* <Grid> Layout Primitive
|
|
98
|
+
*
|
|
99
|
+
* Effortless CSS Grid. Specify fixed columns or a responsive minChildWidth
|
|
100
|
+
* to achieve fluid wrapping grids without writing complex media queries.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // Responsive auto-wrapping grid
|
|
104
|
+
* <Grid minChildWidth={260} gap={4}>
|
|
105
|
+
* <Card />
|
|
106
|
+
* <Card />
|
|
107
|
+
* </Grid>
|
|
108
|
+
*/
|
|
109
|
+
export declare function Grid(props: GridProps): Child;
|
|
110
|
+
export interface SpacerProps extends BaseLayoutProps {
|
|
111
|
+
size?: number | string;
|
|
112
|
+
x?: number | string;
|
|
113
|
+
y?: number | string;
|
|
114
|
+
flex?: boolean | number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* <Spacer> Layout Primitive
|
|
118
|
+
*
|
|
119
|
+
* Creates flexible pushing space in Rows/Stacks (defaults to flex: 1)
|
|
120
|
+
* or creates a dedicated spatial gap block when given size.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <Row>
|
|
124
|
+
* <Logo />
|
|
125
|
+
* <Spacer />
|
|
126
|
+
* <UserProfile />
|
|
127
|
+
* </Row>
|
|
128
|
+
*/
|
|
129
|
+
export declare function Spacer(props: SpacerProps): Child;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface InjectedStyle {
|
|
2
|
+
id: string;
|
|
3
|
+
css: string;
|
|
4
|
+
count: number;
|
|
5
|
+
element?: HTMLStyleElement;
|
|
6
|
+
}
|
|
7
|
+
export declare class StyleManager {
|
|
8
|
+
private _styles;
|
|
9
|
+
private _ssrStyles;
|
|
10
|
+
/**
|
|
11
|
+
* Inject CSS into the document head or SSR registry
|
|
12
|
+
*/
|
|
13
|
+
inject(id: string, css: string): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a style scope is currently registered
|
|
16
|
+
*/
|
|
17
|
+
has(id: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Extract all styles collected during Server-Side Rendering (SSR)
|
|
20
|
+
*/
|
|
21
|
+
extractSSRStyles(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Clear all registered and SSR styles
|
|
24
|
+
*/
|
|
25
|
+
clear(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare const styleManager: StyleManager;
|
|
28
|
+
/**
|
|
29
|
+
* Helper to get SSR style tag HTML
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractStyleTags(): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ScopeOptions {
|
|
2
|
+
scopeId: string;
|
|
3
|
+
passToChildren?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Scope a single CSS selector string with the given scope identifier
|
|
7
|
+
*/
|
|
8
|
+
export declare function scopeSelector(selector: string, options: ScopeOptions): string;
|
|
9
|
+
/**
|
|
10
|
+
* Full CSS block scoping transformer
|
|
11
|
+
*/
|
|
12
|
+
export declare function scopeCSS(css: string, options: ScopeOptions): string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visage Spatial Engine & Style Primitives
|
|
3
|
+
*
|
|
4
|
+
* Eliminates measurement fatigue, layout bugs, and manual viewport calculations.
|
|
5
|
+
* Standardizes on a crisp 4px spatial scale, semantic viewport intents,
|
|
6
|
+
* fluid clamp calculations, and typed visual design tokens.
|
|
7
|
+
*/
|
|
8
|
+
export declare const UNITLESS_PROPERTIES: Set<string>;
|
|
9
|
+
export declare const DIMENSION_KEYWORDS: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a spatial scale step or dimensional intent to a valid CSS measurement.
|
|
12
|
+
* Numbers map to the 4px engineering grid (1 = 4px, 2 = 8px, 4 = 16px, 8 = 32px).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* space(1) // "4px"
|
|
16
|
+
* space(2) // "8px"
|
|
17
|
+
* space(4) // "16px"
|
|
18
|
+
* space(6) // "24px"
|
|
19
|
+
* space("full") // "100%"
|
|
20
|
+
* space("screen") // "100dvh"
|
|
21
|
+
*/
|
|
22
|
+
export declare function space(val: number | string | undefined | null): string;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves width, height, or grid sizing into valid CSS.
|
|
25
|
+
* Small numbers (<= 48) map to the 4px scale, while larger numbers (> 48)
|
|
26
|
+
* are treated as explicit pixel dimensions.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveDimension(val: number | string | undefined | null): string;
|
|
29
|
+
/**
|
|
30
|
+
* Explicit raw pixel measurement helper.
|
|
31
|
+
*/
|
|
32
|
+
export declare function px(val: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Explicit rem measurement helper.
|
|
35
|
+
*/
|
|
36
|
+
export declare function rem(val: number): string;
|
|
37
|
+
/**
|
|
38
|
+
* Explicit em measurement helper.
|
|
39
|
+
*/
|
|
40
|
+
export declare function em(val: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Computes an optimal fluid clamp() expression.
|
|
43
|
+
* Eliminates the math nightmare of manual linear viewport interpolation slopes.
|
|
44
|
+
*
|
|
45
|
+
* @param minPx Minimum size in pixels at mobile viewport
|
|
46
|
+
* @param maxPx Maximum size in pixels at desktop viewport
|
|
47
|
+
* @param options Min/max viewport bounds (defaults to 375px mobile and 1280px desktop)
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* fluid(16, 32)
|
|
51
|
+
* // clamp(16px, 9.38px + 1.77vw, 32px)
|
|
52
|
+
*/
|
|
53
|
+
export declare function fluid(minPx: number, maxPx: number, options?: {
|
|
54
|
+
minVw?: number;
|
|
55
|
+
maxVw?: number;
|
|
56
|
+
}): string;
|
|
57
|
+
export type ShadowVariant = "none" | "sm" | "md" | "lg" | "xl" | "soft" | "glow" | "inner";
|
|
58
|
+
export declare const SHADOW_PRESETS: Record<ShadowVariant, string>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns typed box-shadow tokens designed for high-contrast optical depth.
|
|
61
|
+
*/
|
|
62
|
+
export declare function shadow(variant: ShadowVariant | string): string;
|
|
63
|
+
export type RadiusVariant = "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full" | number;
|
|
64
|
+
export declare const RADIUS_PRESETS: Record<string, string>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns typed border-radius tokens or scale numbers.
|
|
67
|
+
*/
|
|
68
|
+
export declare function radius(variant: RadiusVariant): string;
|
|
69
|
+
export interface GlassOptions {
|
|
70
|
+
blur?: number | string;
|
|
71
|
+
tint?: string;
|
|
72
|
+
border?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generates tactile glassmorphism CSS styles with backdrop filters and frosted borders.
|
|
76
|
+
*/
|
|
77
|
+
export declare function glass(options?: GlassOptions): Record<string, string>;
|
|
78
|
+
/**
|
|
79
|
+
* Formats a style property value for direct DOM binding or SSR generation.
|
|
80
|
+
* Handles automatic unit resolution, dimension keywords, and custom CSS variables.
|
|
81
|
+
*/
|
|
82
|
+
export declare function formatStyleProp(prop: string, val: any): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { html, template } from "./template";
|
|
@@ -431,10 +431,12 @@ class Signal {
|
|
|
431
431
|
_value;
|
|
432
432
|
_subscribers = new Set;
|
|
433
433
|
_equals;
|
|
434
|
+
_onSet;
|
|
434
435
|
version = 0;
|
|
435
|
-
constructor(initialValue, equals) {
|
|
436
|
+
constructor(initialValue, equals, onSet) {
|
|
436
437
|
this._value = initialValue;
|
|
437
438
|
this._equals = equals ?? Object.is;
|
|
439
|
+
this._onSet = onSet;
|
|
438
440
|
}
|
|
439
441
|
get() {
|
|
440
442
|
if (currentSubscriber !== null && currentSubscriber.state !== 3 /* DISPOSED */) {
|
|
@@ -459,6 +461,9 @@ class Signal {
|
|
|
459
461
|
}
|
|
460
462
|
this._value = newValue;
|
|
461
463
|
this.version++;
|
|
464
|
+
if (this._onSet) {
|
|
465
|
+
this._onSet(newValue);
|
|
466
|
+
}
|
|
462
467
|
batch(() => {
|
|
463
468
|
this.notify();
|
|
464
469
|
});
|
|
@@ -484,11 +489,91 @@ class Signal {
|
|
|
484
489
|
}
|
|
485
490
|
}
|
|
486
491
|
}
|
|
492
|
+
function resolveStorage(storageOption) {
|
|
493
|
+
if (storageOption && typeof storageOption === "object") {
|
|
494
|
+
return storageOption;
|
|
495
|
+
}
|
|
496
|
+
if (storageOption === "session") {
|
|
497
|
+
try {
|
|
498
|
+
if (typeof sessionStorage !== "undefined")
|
|
499
|
+
return sessionStorage;
|
|
500
|
+
} catch {}
|
|
501
|
+
try {
|
|
502
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
503
|
+
return window.sessionStorage;
|
|
504
|
+
}
|
|
505
|
+
} catch {}
|
|
506
|
+
try {
|
|
507
|
+
if (typeof globalThis !== "undefined" && globalThis.sessionStorage) {
|
|
508
|
+
return globalThis.sessionStorage;
|
|
509
|
+
}
|
|
510
|
+
} catch {}
|
|
511
|
+
return null;
|
|
512
|
+
}
|
|
513
|
+
try {
|
|
514
|
+
if (typeof localStorage !== "undefined")
|
|
515
|
+
return localStorage;
|
|
516
|
+
} catch {}
|
|
517
|
+
try {
|
|
518
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
519
|
+
return window.localStorage;
|
|
520
|
+
}
|
|
521
|
+
} catch {}
|
|
522
|
+
try {
|
|
523
|
+
if (typeof globalThis !== "undefined" && globalThis.localStorage) {
|
|
524
|
+
return globalThis.localStorage;
|
|
525
|
+
}
|
|
526
|
+
} catch {}
|
|
527
|
+
return null;
|
|
528
|
+
}
|
|
487
529
|
function signal(initialValue, optionsOrEquals) {
|
|
488
530
|
const equals = typeof optionsOrEquals === "function" ? optionsOrEquals : optionsOrEquals?.equals;
|
|
489
531
|
const isInternal = typeof optionsOrEquals === "object" ? optionsOrEquals?.internal : false;
|
|
490
532
|
const customName = typeof optionsOrEquals === "object" ? optionsOrEquals?.name : undefined;
|
|
491
|
-
const
|
|
533
|
+
const persistOption = typeof optionsOrEquals === "object" ? optionsOrEquals?.persist : undefined;
|
|
534
|
+
const persistConfig = persistOption ? typeof persistOption === "string" ? { key: persistOption } : persistOption : undefined;
|
|
535
|
+
let effectiveInitial = initialValue;
|
|
536
|
+
const storage = persistConfig ? resolveStorage(persistConfig.storage) : null;
|
|
537
|
+
const serialize = persistConfig?.serialize ?? JSON.stringify;
|
|
538
|
+
const deserialize = persistConfig?.deserialize ?? JSON.parse;
|
|
539
|
+
if (persistConfig && storage) {
|
|
540
|
+
try {
|
|
541
|
+
const stored = storage.getItem(persistConfig.key);
|
|
542
|
+
if (stored !== null) {
|
|
543
|
+
effectiveInitial = deserialize(stored);
|
|
544
|
+
}
|
|
545
|
+
} catch {}
|
|
546
|
+
}
|
|
547
|
+
let isSyncing = false;
|
|
548
|
+
const onSet = persistConfig && storage ? (val) => {
|
|
549
|
+
if (isSyncing)
|
|
550
|
+
return;
|
|
551
|
+
try {
|
|
552
|
+
storage.setItem(persistConfig.key, serialize(val));
|
|
553
|
+
} catch {}
|
|
554
|
+
} : undefined;
|
|
555
|
+
const s = new Signal(effectiveInitial, equals, onSet);
|
|
556
|
+
if (persistConfig && storage && (persistConfig.syncTabs ?? true) && typeof window !== "undefined" && typeof window.addEventListener === "function") {
|
|
557
|
+
const onStorage = (e) => {
|
|
558
|
+
if (e.key === persistConfig.key) {
|
|
559
|
+
try {
|
|
560
|
+
const nextVal = e.newValue !== null ? deserialize(e.newValue) : initialValue;
|
|
561
|
+
isSyncing = true;
|
|
562
|
+
try {
|
|
563
|
+
s.set(nextVal);
|
|
564
|
+
} finally {
|
|
565
|
+
isSyncing = false;
|
|
566
|
+
}
|
|
567
|
+
} catch {}
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
window.addEventListener("storage", onStorage);
|
|
571
|
+
if (currentScope) {
|
|
572
|
+
currentScope.addCleanup(() => {
|
|
573
|
+
window.removeEventListener("storage", onStorage);
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
}
|
|
492
577
|
const accessor = (...args) => {
|
|
493
578
|
if (args.length === 0) {
|
|
494
579
|
return s.get();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache and clone pre-parsed HTML template strings with native browser cloneNode(true)
|
|
3
|
+
*/
|
|
4
|
+
export declare function template<T extends HTMLElement = HTMLElement>(htmlString: string): () => T;
|
|
5
|
+
/**
|
|
6
|
+
* Tagged template literal for ultra-fast HTML string rendering with reactive signal bindings
|
|
7
|
+
*/
|
|
8
|
+
export declare function html(strings: TemplateStringsArray, ...values: any[]): HTMLElement | DocumentFragment;
|