@animus-ui/system 0.1.20 → 0.1.22
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/appearance/controller.d.ts +35 -0
- package/dist/appearance/controller.d.ts.map +1 -0
- package/dist/appearance/controller.js +69 -0
- package/dist/appearance/index.d.ts +2 -7
- package/dist/appearance/react.d.ts +10 -0
- package/dist/appearance/react.d.ts.map +1 -0
- package/dist/appearance/react.js +12 -0
- package/dist/appearance/svelte.d.ts +12 -0
- package/dist/appearance/svelte.d.ts.map +1 -0
- package/dist/appearance/svelte.js +14 -0
- package/dist/bootstrap/index.d.ts +24 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +10 -2
- package/dist/class-resolver.d.ts +2 -6
- package/dist/class-resolver.js +1 -1
- package/dist/component-stJhG_A-.d.ts +659 -0
- package/dist/component-stJhG_A-.d.ts.map +1 -0
- package/dist/compose-BQi7TDtL.d.ts +15 -0
- package/dist/compose-BQi7TDtL.d.ts.map +1 -0
- package/dist/compose.d.ts +2 -12
- package/dist/composeWithContext.d.ts +9 -7
- package/dist/composeWithContext.d.ts.map +1 -1
- package/dist/createClassResolver-Do1nmvkf.d.ts +71 -0
- package/dist/createClassResolver-Do1nmvkf.d.ts.map +1 -0
- package/dist/{createClassResolver-DPLExqGy.js → createClassResolver-DtHjTYa7.js} +106 -79
- package/dist/createComposedFamily-BbA_d0QH.js +195 -0
- package/dist/createComposedFamily-BkrvSsfl.d.ts +40 -0
- package/dist/createComposedFamily-BkrvSsfl.d.ts.map +1 -0
- package/dist/groups/index.d.ts +702 -699
- package/dist/groups/index.d.ts.map +1 -1
- package/dist/index-BjJkQo64.d.ts +10 -0
- package/dist/index-BjJkQo64.d.ts.map +1 -0
- package/dist/index-C1AAiaiJ.d.ts +663 -0
- package/dist/index-C1AAiaiJ.d.ts.map +1 -0
- package/dist/index.d.ts +6 -26
- package/dist/index.js +141 -41
- package/dist/runtime-entry.d.ts +3 -5
- package/dist/runtime-entry.js +3 -3
- package/package.json +15 -3
- package/dist/Animus.d.ts +0 -81
- package/dist/Animus.d.ts.map +0 -1
- package/dist/AnimusExtended.d.ts +0 -82
- package/dist/AnimusExtended.d.ts.map +0 -1
- package/dist/SystemBuilder.d.ts +0 -305
- package/dist/SystemBuilder.d.ts.map +0 -1
- package/dist/appearance/index.d.ts.map +0 -1
- package/dist/asset.d.ts +0 -16
- package/dist/asset.d.ts.map +0 -1
- package/dist/bootstrap/createAppearanceBootstrap.d.ts +0 -14
- package/dist/bootstrap/createAppearanceBootstrap.d.ts.map +0 -1
- package/dist/class-resolver.d.ts.map +0 -1
- package/dist/compose.d.ts.map +0 -1
- package/dist/conditions.d.ts +0 -94
- package/dist/conditions.d.ts.map +0 -1
- package/dist/createComposedFamily-C6CLAsMx.js +0 -128
- package/dist/declarations.d.ts +0 -38
- package/dist/declarations.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/keyframes.d.ts +0 -24
- package/dist/keyframes.d.ts.map +0 -1
- package/dist/runtime/assert-root-slot.d.ts +0 -6
- package/dist/runtime/assert-root-slot.d.ts.map +0 -1
- package/dist/runtime/createClassResolver.d.ts +0 -11
- package/dist/runtime/createClassResolver.d.ts.map +0 -1
- package/dist/runtime/createComposedFamily.d.ts +0 -11
- package/dist/runtime/createComposedFamily.d.ts.map +0 -1
- package/dist/runtime/index.d.ts +0 -14
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/is-dev.d.ts +0 -6
- package/dist/runtime/is-dev.d.ts.map +0 -1
- package/dist/runtime/resolveClasses.d.ts +0 -83
- package/dist/runtime/resolveClasses.d.ts.map +0 -1
- package/dist/runtime/witness.d.ts +0 -10
- package/dist/runtime/witness.d.ts.map +0 -1
- package/dist/runtime-entry.d.ts.map +0 -1
- package/dist/scales/createScale.d.ts +0 -7
- package/dist/scales/createScale.d.ts.map +0 -1
- package/dist/selectors.d.ts +0 -27
- package/dist/selectors.d.ts.map +0 -1
- package/dist/theme/createTheme.d.ts +0 -170
- package/dist/theme/createTheme.d.ts.map +0 -1
- package/dist/theme/flattenScale.d.ts +0 -15
- package/dist/theme/flattenScale.d.ts.map +0 -1
- package/dist/theme/index.d.ts +0 -5
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/property-records.d.ts +0 -79
- package/dist/theme/property-records.d.ts.map +0 -1
- package/dist/theme/resolveReferences.d.ts +0 -27
- package/dist/theme/resolveReferences.d.ts.map +0 -1
- package/dist/theme/serializeTokens.d.ts +0 -5
- package/dist/theme/serializeTokens.d.ts.map +0 -1
- package/dist/theme/types.d.ts +0 -20
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/utils.d.ts +0 -11
- package/dist/theme/utils.d.ts.map +0 -1
- package/dist/transforms/border.d.ts +0 -3
- package/dist/transforms/border.d.ts.map +0 -1
- package/dist/transforms/createTransform.d.ts +0 -24
- package/dist/transforms/createTransform.d.ts.map +0 -1
- package/dist/transforms/grid.d.ts +0 -5
- package/dist/transforms/grid.d.ts.map +0 -1
- package/dist/transforms/index.d.ts +0 -5
- package/dist/transforms/index.d.ts.map +0 -1
- package/dist/transforms/size.d.ts +0 -5
- package/dist/transforms/size.d.ts.map +0 -1
- package/dist/types/component.d.ts +0 -100
- package/dist/types/component.d.ts.map +0 -1
- package/dist/types/config.d.ts +0 -149
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/properties.d.ts +0 -17
- package/dist/types/properties.d.ts.map +0 -1
- package/dist/types/props.d.ts +0 -19
- package/dist/types/props.d.ts.map +0 -1
- package/dist/types/scales.d.ts +0 -3
- package/dist/types/scales.d.ts.map +0 -1
- package/dist/types/shared.d.ts +0 -4
- package/dist/types/shared.d.ts.map +0 -1
- package/dist/types/theme.d.ts +0 -111
- package/dist/types/theme.d.ts.map +0 -1
- package/dist/types/utils.d.ts +0 -5
- package/dist/types/utils.d.ts.map +0 -1
- package/dist/utils/deepMerge.d.ts +0 -2
- package/dist/utils/deepMerge.d.ts.map +0 -1
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import { i as ClassResolverConfig, t as ClassResolver } from "./createClassResolver-Do1nmvkf.js";
|
|
2
|
+
import { ComponentPropsWithRef, ComponentType, ForwardRefExoticComponent, JSX, ReactNode } from "react";
|
|
3
|
+
import { Globals, ObsoleteProperties, StandardProperties, SvgProperties, VendorProperties } from "csstype";
|
|
4
|
+
//#region src/conditions.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Condition alias registry: `_`-prefixed alias keys → at-rule condition
|
|
7
|
+
* strings, plus the authoring type surface consumers augment.
|
|
8
|
+
*/
|
|
9
|
+
type ConditionKind = 'media' | 'container' | 'supports';
|
|
10
|
+
/**
|
|
11
|
+
* Augmentable registry of registered condition alias keys. Empty keeps `_`
|
|
12
|
+
* block keys permissive; publishing either registry validates both.
|
|
13
|
+
*/
|
|
14
|
+
interface Conditions {}
|
|
15
|
+
declare const CONDS_BRAND: unique symbol;
|
|
16
|
+
declare const SELS_BRAND: unique symbol;
|
|
17
|
+
/**
|
|
18
|
+
* Type-only phantom brand on a built system, carrying the registered
|
|
19
|
+
* condition (`C`) and selector (`S`) alias keys to the augmentation site.
|
|
20
|
+
*/
|
|
21
|
+
interface RegistryBrand<C extends string = never, S extends string = never> {
|
|
22
|
+
readonly [CONDS_BRAND]?: C;
|
|
23
|
+
readonly [SELS_BRAND]?: S;
|
|
24
|
+
}
|
|
25
|
+
type ConditionsOf<Sys> = Sys extends RegistryBrand<infer C, string> ? C : never;
|
|
26
|
+
type SelectorsOf<Sys> = Sys extends RegistryBrand<string, infer S> ? S : never;
|
|
27
|
+
/**
|
|
28
|
+
* Branded rejection for a `_` block key that no registry owns. Not a bare
|
|
29
|
+
* `never`: that reports a misleading "not assignable to 'undefined'".
|
|
30
|
+
*/
|
|
31
|
+
interface UnknownConditionAlias<K extends string> {
|
|
32
|
+
readonly __unknownConditionAlias: K;
|
|
33
|
+
readonly hint: `"${K}" is not a registered condition or selector alias. Register it with .addConditions() / .addSelectors(), or use a raw "&…" selector or "@media|@container|@supports (…)" key.`;
|
|
34
|
+
}
|
|
35
|
+
interface UnknownAtRule<K extends string> {
|
|
36
|
+
readonly __unknownAtRule: K;
|
|
37
|
+
readonly hint: `"${K}" is not a valid at-rule block key. At-rule keys must begin with "@media ", "@container ", or "@supports " followed by a parenthesized/feature tail.`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Rejection for an `addConditions()` key the selector registry owns. Never a
|
|
41
|
+
* bare `never`: in VALUE position it drops both the check and accumulation.
|
|
42
|
+
*/
|
|
43
|
+
interface ReservedBySelectorRegistry<K extends string> {
|
|
44
|
+
readonly __reservedBySelectorRegistry: K;
|
|
45
|
+
readonly hint: `"${K}" is already a selector alias — condition and selector alias names must be disjoint. Rename this condition alias, or redefine the selector with .addSelectors().`;
|
|
46
|
+
}
|
|
47
|
+
interface ReservedByConditionRegistry<K extends string> {
|
|
48
|
+
readonly __reservedByConditionRegistry: K;
|
|
49
|
+
readonly hint: `"${K}" is already a condition alias — condition and selector alias names must be disjoint. Rename this selector alias, or redefine the condition with .addConditions().`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Alias names, or `never` once the union has widened to the whole `_`
|
|
53
|
+
* pattern — a widened union would reject every legal alias downstream.
|
|
54
|
+
*/
|
|
55
|
+
type NarrowedAliases<U extends string> = `_${string}` extends U ? never : U;
|
|
56
|
+
/**
|
|
57
|
+
* Prefix + tail only: a deep query grammar hits TS2589. The trailing space
|
|
58
|
+
* is load-bearing — it rejects prefix typos (`@medi …`) without a grammar.
|
|
59
|
+
*/
|
|
60
|
+
type RawAtRuleKey = `@media ${string}` | `@container ${string}` | `@supports ${string}`;
|
|
61
|
+
/**
|
|
62
|
+
* No trailing space, unlike `RawAtRuleKey`: a value may open its query
|
|
63
|
+
* immediately (`@media(width>=40em)`).
|
|
64
|
+
*/
|
|
65
|
+
type AtRuleValue = `@media${string}` | `@container${string}` | `@supports${string}`;
|
|
66
|
+
interface ConditionAlias {
|
|
67
|
+
/** Full at-rule condition string, e.g. `@media print`. */
|
|
68
|
+
value: string;
|
|
69
|
+
/** Sort index for cascade ordering within a layer. */
|
|
70
|
+
order: number;
|
|
71
|
+
/** Condition kind, inferred from the at-rule prefix of `value`. */
|
|
72
|
+
kind: ConditionKind;
|
|
73
|
+
}
|
|
74
|
+
type ConditionAliasMap = Record<string, ConditionAlias>;
|
|
75
|
+
/**
|
|
76
|
+
* Media-feature aliases only — color-mode aliases are selector-kind. The
|
|
77
|
+
* reserved order band (300–380) sits below the user band (500+).
|
|
78
|
+
*/
|
|
79
|
+
declare const BUILT_IN_CONDITIONS: ConditionAliasMap;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/keyframes.d.ts
|
|
82
|
+
/**
|
|
83
|
+
* Frame values take raw CSS or `{scale.key}` token references; a bare scale
|
|
84
|
+
* key is not resolved. The extractor substitutes refs with the hashed name.
|
|
85
|
+
*/
|
|
86
|
+
type KeyframeFrameMap = Record<string, Record<string, unknown>>;
|
|
87
|
+
interface KeyframeRef<Name extends string> {
|
|
88
|
+
readonly __brand: 'KeyframeRef';
|
|
89
|
+
readonly __name: Name;
|
|
90
|
+
toString(): string;
|
|
91
|
+
valueOf(): string;
|
|
92
|
+
}
|
|
93
|
+
type Keyframes<Map extends Record<string, KeyframeFrameMap>> = {
|
|
94
|
+
readonly __brand: 'Keyframes';
|
|
95
|
+
readonly __frames: { readonly [K in keyof Map & string]: {
|
|
96
|
+
readonly name: string;
|
|
97
|
+
readonly frames: Map[K];
|
|
98
|
+
}; };
|
|
99
|
+
} & { readonly [K in keyof Map & string]: KeyframeRef<K>; };
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/selectors.d.ts
|
|
102
|
+
/**
|
|
103
|
+
* `order` is cascade precedence inside a layer: a later entry overrides an
|
|
104
|
+
* earlier one at equal specificity.
|
|
105
|
+
*/
|
|
106
|
+
interface SelectorAlias {
|
|
107
|
+
selector: string;
|
|
108
|
+
order: number;
|
|
109
|
+
}
|
|
110
|
+
type SelectorAliasMap = Record<string, SelectorAlias>;
|
|
111
|
+
/**
|
|
112
|
+
* Module augmentation publishes custom aliases as typed `_` keys. Augmenting
|
|
113
|
+
* either `Selectors` or `Conditions` makes the whole `_` namespace validating.
|
|
114
|
+
*/
|
|
115
|
+
interface Selectors {}
|
|
116
|
+
declare const BUILT_IN_SELECTORS: SelectorAliasMap;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/types/properties.d.ts
|
|
119
|
+
/** CSS Borders 4's `corner-shape`, which the pinned csstype predates. */
|
|
120
|
+
type BordersLevel4Properties = {
|
|
121
|
+
cornerShape?: Globals | 'bevel' | 'notch' | 'round' | 'scoop' | 'square' | 'squircle' | `superellipse(${string})` | (string & {});
|
|
122
|
+
};
|
|
123
|
+
type AnimusCSSProperties<Overrides = (string & {}) | 0> = StandardProperties<Overrides> & VendorProperties<Overrides> & Pick<ObsoleteProperties<Overrides>, 'WebkitBoxOrient'> & Omit<SvgProperties<Overrides>, keyof StandardProperties> & BordersLevel4Properties;
|
|
124
|
+
type ColorProperties = 'color' | `${string}Color` | 'fill' | 'stroke';
|
|
125
|
+
type ColorGlobals = { [K in Extract<keyof AnimusCSSProperties, ColorProperties>]?: Globals | 'currentColor' | 'transparent' | (string & {}); };
|
|
126
|
+
type SizeProperties = 'left' | 'right' | 'top' | 'bottom' | 'inset' | 'width' | 'height' | `${string}${'Width' | 'Height'}` | 'inlineSize' | 'blockSize' | `${string}${'InlineSize' | 'BlockSize'}` | `inset${'Inline' | 'Block'}${'' | 'Start' | 'End'}`;
|
|
127
|
+
type SizeValues = `${number}${'px' | 'rem' | 'vh' | 'vw' | 'vmax' | 'vmin' | '%'}` | `calc(${any})`;
|
|
128
|
+
type SizeGlobals = { [K in Extract<keyof AnimusCSSProperties, SizeProperties>]?: AnimusCSSProperties[K] | SizeValues | (number & {}); };
|
|
129
|
+
/**
|
|
130
|
+
* A non-strict `fontSize` takes a number, as the size properties do; a strict
|
|
131
|
+
* one (`Overrides` of `never`) keeps to its scale.
|
|
132
|
+
*/
|
|
133
|
+
type FontSizeGlobals<Overrides> = {
|
|
134
|
+
fontSize?: AnimusCSSProperties<Overrides>['fontSize'] | ([Overrides] extends [never] ? never : number & {});
|
|
135
|
+
};
|
|
136
|
+
interface PropertyTypes<Overrides = (string & {}) | 0> extends Omit<AnimusCSSProperties<Overrides>, keyof ColorGlobals | keyof SizeGlobals | 'fontSize'>, ColorGlobals, SizeGlobals, FontSizeGlobals<Overrides> {
|
|
137
|
+
none?: never;
|
|
138
|
+
[key: `--${string}`]: (string & {}) | number | undefined;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/theme/flattenScale.d.ts
|
|
142
|
+
/** Every path through T reachable from K, joined by `D`. */
|
|
143
|
+
type FindPath<T, K extends keyof T, D extends string = '.'> = K extends string | number ? T[K] extends Record<string | number, any> ? T[K] extends ArrayLike<any> ? K | `${K}${D}${FindPath<T[K], Exclude<keyof T[K], keyof any[]>, D>}` : K | `${K}${D}${FindPath<T[K], keyof T[K], D>}` : K : never;
|
|
144
|
+
type Path<T, D extends string = '.'> = FindPath<T, keyof T, D> | keyof T;
|
|
145
|
+
type PathValue<T, P extends Path<T, D>, D extends string = '.'> = P extends `${infer K}${D}${infer Rest}` ? K extends keyof T ? Rest extends Path<T[K], D> ? PathValue<T[K], Rest, D> : never : never : P extends keyof T ? T[P] : never;
|
|
146
|
+
/** Only the paths whose value is a string or number, as a union. */
|
|
147
|
+
type PathToLiteral<T, K extends Path<T, D>, D extends string = '.', Base extends string = ''> = PathValue<T, K, D> extends string | number ? K extends string | number ? K extends `${infer BasePath}${D}${Base}` ? BasePath : K : never : never;
|
|
148
|
+
/**
|
|
149
|
+
* Flat map of the primitive-valued paths only: `{ a: { b: 1 } }` becomes
|
|
150
|
+
* `{ 'a-b': 1 }` when `D` is `-`.
|
|
151
|
+
*/
|
|
152
|
+
type LiteralPaths<T extends Record<string | number, any>, D extends string = '.', Base extends string = ''> = { [K in Path<T, D> as PathToLiteral<T, K, D, Base>]: PathValue<T, PathToLiteral<T, K, D>, D>; };
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/types/shared.d.ts
|
|
155
|
+
interface CSSObject {
|
|
156
|
+
[key: string]: string | number | CSSObject | undefined;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/types/theme.d.ts
|
|
160
|
+
interface BaseTheme {}
|
|
161
|
+
interface AbstractTheme extends BaseTheme {
|
|
162
|
+
breakpoints: Record<string, number>;
|
|
163
|
+
readonly [key: string]: any;
|
|
164
|
+
}
|
|
165
|
+
type ThemeStructuralKey = 'breakpoints' | 'modes' | 'mode' | 'systemPreference' | 'browserColorScheme' | 'modeBases' | '__emitted' | '__declarationScales' | 'manifest' | 'serialize' | 'varRef';
|
|
166
|
+
type TokenScales<T> = Omit<T, ThemeStructuralKey>;
|
|
167
|
+
/**
|
|
168
|
+
* Consumers augment this interface to constrain CSS values to their theme's
|
|
169
|
+
* scale keys; unaugmented, values fall back to standard CSS property types.
|
|
170
|
+
*/
|
|
171
|
+
interface Theme extends BaseTheme {}
|
|
172
|
+
type CSSColorValue = `#${string}` | `rgb(${string})` | `rgba(${string})` | `hsl(${string})` | `hsla(${string})` | `oklch(${string})` | `oklab(${string})` | `lch(${string})` | `lab(${string})` | `color-mix(${string})` | `color(${string})` | 'transparent' | 'currentColor' | (string & {});
|
|
173
|
+
/**
|
|
174
|
+
* Scale names emitted as CSS variables. The `colors` fallback covers augmented
|
|
175
|
+
* `Theme` interfaces, which carry no `__emitted` tuple.
|
|
176
|
+
*/
|
|
177
|
+
type EmittedScales<T> = T extends {
|
|
178
|
+
__emitted: [infer E extends string];
|
|
179
|
+
} ? E & keyof TokenScales<T> : 'colors' extends keyof TokenScales<T> ? 'colors' : never;
|
|
180
|
+
type EmittedTokenPaths<T> = keyof LiteralPaths<Pick<TokenScales<T>, EmittedScales<T>>, '.'>;
|
|
181
|
+
type ScaleTokenRef<E extends string> = `${string}{${E}.${string}}${string}`;
|
|
182
|
+
type ColorTokenRef = Theme extends {
|
|
183
|
+
colors: infer C;
|
|
184
|
+
} ? C extends Record<string, unknown> ? `{colors.${Extract<keyof C, string>}}` | `{colors.${Extract<keyof C, string>}/${number}}` : never : never;
|
|
185
|
+
/** `@property` metadata. A syntax other than `'*'` needs an `initialValue`;
|
|
186
|
+
* extraction reports a registration browsers would ignore. */
|
|
187
|
+
interface ContextualVarRegistration {
|
|
188
|
+
syntax: string;
|
|
189
|
+
inherits: boolean;
|
|
190
|
+
initialValue?: string;
|
|
191
|
+
}
|
|
192
|
+
interface SystemPreferenceConfig {
|
|
193
|
+
light: string;
|
|
194
|
+
dark: string;
|
|
195
|
+
}
|
|
196
|
+
type BrowserColorSchemeConfig = Record<string, 'light' | 'dark' | 'normal'>;
|
|
197
|
+
/**
|
|
198
|
+
* Options for `addColorModes`, typed from this call's mode config alone —
|
|
199
|
+
* threading the mode union through the builder generics risks TS2589.
|
|
200
|
+
*/
|
|
201
|
+
interface ColorModeOptions<Config> {
|
|
202
|
+
systemPreference?: {
|
|
203
|
+
light: keyof Config & string;
|
|
204
|
+
dark: keyof Config & string;
|
|
205
|
+
};
|
|
206
|
+
browserColorScheme?: Partial<Record<keyof Config & string, 'light' | 'dark' | 'normal'>>;
|
|
207
|
+
basedOn?: Partial<Record<keyof Config & string, string>>;
|
|
208
|
+
}
|
|
209
|
+
interface SerializedTheme {
|
|
210
|
+
scalesJson: string;
|
|
211
|
+
variableMapJson: string;
|
|
212
|
+
variableCss: string;
|
|
213
|
+
contextualVarsJson: string;
|
|
214
|
+
/**
|
|
215
|
+
* `{ scale: { kind: 'declarations', members, values: { key: record } } }`,
|
|
216
|
+
* token references resolved. Absent when the theme has no declaration
|
|
217
|
+
* scales, so a scalar theme serializes as before.
|
|
218
|
+
*/
|
|
219
|
+
declarationScalesJson?: string;
|
|
220
|
+
/**
|
|
221
|
+
* One record per declared custom property, sorted by name: authored name,
|
|
222
|
+
* syntax, inherits, initial value, scales, home, whether it is registered,
|
|
223
|
+
* and whether the contextual-variable method made it. Absent when none.
|
|
224
|
+
*/
|
|
225
|
+
propertyRecordsJson?: string;
|
|
226
|
+
}
|
|
227
|
+
interface TokenReference {
|
|
228
|
+
path: string;
|
|
229
|
+
opacity?: string;
|
|
230
|
+
}
|
|
231
|
+
type TokenDefinition = {
|
|
232
|
+
kind: 'literal';
|
|
233
|
+
value: string;
|
|
234
|
+
} | {
|
|
235
|
+
kind: 'reference';
|
|
236
|
+
value: string;
|
|
237
|
+
references: TokenReference[];
|
|
238
|
+
};
|
|
239
|
+
type ModeAliasDefinition = Record<string, Record<string, string>>;
|
|
240
|
+
interface ThemeCssFragment {
|
|
241
|
+
id: string;
|
|
242
|
+
kind: 'registrations' | 'base';
|
|
243
|
+
cssText: string;
|
|
244
|
+
}
|
|
245
|
+
interface ThemeManifest {
|
|
246
|
+
tokenMap: Record<string, string>;
|
|
247
|
+
variableMap: Record<string, string>;
|
|
248
|
+
/**
|
|
249
|
+
* Mode name → flat key → resolved value; a reference contributes its resolved
|
|
250
|
+
* value, never a raw `{…}` string. Mode keys and inner keys are sorted.
|
|
251
|
+
*/
|
|
252
|
+
modes: Record<string, Record<string, string>>;
|
|
253
|
+
variableCss: string;
|
|
254
|
+
contextualVars?: Record<string, string[]>;
|
|
255
|
+
systemPreference?: SystemPreferenceConfig;
|
|
256
|
+
browserColorScheme?: BrowserColorSchemeConfig;
|
|
257
|
+
manifestVersion?: 2;
|
|
258
|
+
tokenDefinitions?: Record<string, TokenDefinition>;
|
|
259
|
+
emittedScales?: string[];
|
|
260
|
+
modeAliasDefinitions?: ModeAliasDefinition;
|
|
261
|
+
registrations?: Record<string, ContextualVarRegistration>;
|
|
262
|
+
emitterVersion?: number;
|
|
263
|
+
contractHash?: string;
|
|
264
|
+
cssFragments?: ThemeCssFragment[];
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/types/props.d.ts
|
|
268
|
+
type AbstractProps = ThemeProps<Record<string, unknown>, BaseTheme>;
|
|
269
|
+
type ThemeProps<Props = {}, T extends BaseTheme = BaseTheme> = Props & {
|
|
270
|
+
theme?: T;
|
|
271
|
+
};
|
|
272
|
+
type ThemeBreakpoints = Theme extends {
|
|
273
|
+
breakpoints: infer B;
|
|
274
|
+
} ? B : Record<string, number>;
|
|
275
|
+
type BreakpointKeys = keyof ThemeBreakpoints;
|
|
276
|
+
type MediaQueryMap<T> = {
|
|
277
|
+
_?: T;
|
|
278
|
+
} & (string extends BreakpointKeys ? {
|
|
279
|
+
[key: string]: T | undefined;
|
|
280
|
+
} : { [K in BreakpointKeys]?: T; });
|
|
281
|
+
type ResponsiveProp<T> = T | MediaQueryMap<T>;
|
|
282
|
+
/**
|
|
283
|
+
* A component prop's responsive value, where any breakpoint may hold
|
|
284
|
+
* `undefined`, which the runtime drops. Kept apart from `ResponsiveProp`:
|
|
285
|
+
* giving that one an `undefined` parameter, even unused, makes TS 5.9
|
|
286
|
+
* overflow (TS2590) relating a multi-group component's props.
|
|
287
|
+
*/
|
|
288
|
+
type ResponsivePropValue<T> = T | ({
|
|
289
|
+
_?: T | undefined;
|
|
290
|
+
} & (string extends BreakpointKeys ? {
|
|
291
|
+
[key: string]: T | undefined;
|
|
292
|
+
} : { [K in BreakpointKeys]?: T | undefined; }));
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/types/scales.d.ts
|
|
295
|
+
type MapScale = Record<string | number, string | number>;
|
|
296
|
+
type ArrayScale = readonly (string | number)[];
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/types/utils.d.ts
|
|
299
|
+
type Arg<T extends (...args: any) => any> = Parameters<T>[0];
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/types/config.d.ts
|
|
302
|
+
interface BaseProperty {
|
|
303
|
+
property: keyof PropertyTypes;
|
|
304
|
+
properties?: readonly (keyof PropertyTypes)[];
|
|
305
|
+
}
|
|
306
|
+
interface Prop extends BaseProperty {
|
|
307
|
+
/** Only a declaration prop has a kind. */
|
|
308
|
+
kind?: never;
|
|
309
|
+
scale?: string | MapScale | ArrayScale;
|
|
310
|
+
variable?: string;
|
|
311
|
+
negative?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* When false, scale-bound props accept arbitrary strings alongside scale
|
|
314
|
+
* keys. Defaults to true.
|
|
315
|
+
*/
|
|
316
|
+
strict?: boolean;
|
|
317
|
+
currentVar?: string;
|
|
318
|
+
transform?: (val: string | number, prop?: string, props?: AbstractProps) => string | number;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Binds a system prop to a declaration scale registered with
|
|
322
|
+
* `addDeclarationScale`: each key applies its complete record of `members`.
|
|
323
|
+
* It has no primary property, transform, negative form or raw-value fallback.
|
|
324
|
+
*/
|
|
325
|
+
interface DeclarationProp {
|
|
326
|
+
kind: 'declarations';
|
|
327
|
+
scale: DeclarationScaleName;
|
|
328
|
+
members: readonly (keyof PropertyTypes)[];
|
|
329
|
+
property?: never;
|
|
330
|
+
properties?: never;
|
|
331
|
+
transform?: never;
|
|
332
|
+
negative?: never;
|
|
333
|
+
strict?: never;
|
|
334
|
+
variable?: never;
|
|
335
|
+
currentVar?: never;
|
|
336
|
+
}
|
|
337
|
+
/** Any system prop definition: a value prop or a declaration prop. */
|
|
338
|
+
type SystemProp = Prop | DeclarationProp;
|
|
339
|
+
type DeclarationScalesOf<T> = T extends {
|
|
340
|
+
__declarationScales: infer Scales;
|
|
341
|
+
} ? Scales : {};
|
|
342
|
+
/**
|
|
343
|
+
* The theme's declaration scale names, plus any string: the literal members
|
|
344
|
+
* keep an authored name literal, so its keys can be read back.
|
|
345
|
+
*/
|
|
346
|
+
type DeclarationScaleName = Extract<keyof DeclarationScalesOf<Theme>, string> | (string & {});
|
|
347
|
+
/** The keys of a declaration prop's scale; any key while the theme is unknown. */
|
|
348
|
+
type DeclarationKey<Config extends DeclarationProp> = Config['scale'] extends keyof DeclarationScalesOf<Theme> ? keyof DeclarationScalesOf<Theme>[Config['scale']] : string | number;
|
|
349
|
+
interface CustomPropConfig extends Prop {
|
|
350
|
+
transform?: (val: string | number, prop?: string, props?: AbstractProps) => string | number;
|
|
351
|
+
}
|
|
352
|
+
interface AbstractParser {
|
|
353
|
+
(props: AbstractProps, orderProps?: boolean): CSSObject;
|
|
354
|
+
propNames: string[];
|
|
355
|
+
config: Record<string, Prop>;
|
|
356
|
+
}
|
|
357
|
+
type IsEmpty<T> = [] extends T ? true : false | {} extends T ? true : false;
|
|
358
|
+
type StrictOrEmpty<Config extends SystemProp, ScaleT> = Config['strict'] extends false ? true : IsEmpty<ScaleT>;
|
|
359
|
+
type NegateKeys<T> = T extends number ? T extends 0 ? never : `-${T}` extends `${infer N extends number}` ? N : never : never;
|
|
360
|
+
type PropertyValues<Property extends SystemProp, IncludeGlobals = false> = Exclude<PropertyTypes<IncludeGlobals extends true ? (string & {}) | 0 : never>[Property['property'] & string], IncludeGlobals extends true ? never : object | any[]>;
|
|
361
|
+
type NegativeOf<Config extends SystemProp, Keys> = Config['negative'] extends true ? NegateKeys<Extract<Keys, number>> : never;
|
|
362
|
+
/**
|
|
363
|
+
* What a strict scale admits beside its keys and keywords, as strict
|
|
364
|
+
* extraction and the runtime do: the string zero on a property that takes a
|
|
365
|
+
* length, and a reference to one of the scale's own tokens. A non-strict scale
|
|
366
|
+
* already admits both through its raw values. The numeric zero waits: adding
|
|
367
|
+
* a number to every length prop overflows the union TS builds when checking
|
|
368
|
+
* keyframe frames against a large prop registry (TS2590).
|
|
369
|
+
*/
|
|
370
|
+
type StrictAdmissions<Config extends SystemProp, Strict, ScaleName, Keys> = Strict extends true ? never : (0 extends PropertyValues<Config, true> ? '0' : never) | (ScaleName extends string ? `{${ScaleName}.${Extract<Keys, string | number>}}` : never);
|
|
371
|
+
type ScaleValue<Config extends SystemProp, T extends BaseTheme> = Config['scale'] extends keyof TokenScales<T> ? keyof TokenScales<T>[Config['scale']] | NegativeOf<Config, keyof TokenScales<T>[Config['scale']]> | PropertyValues<Config, StrictOrEmpty<Config, TokenScales<T>[Config['scale']]>> | StrictAdmissions<Config, StrictOrEmpty<Config, TokenScales<T>[Config['scale']]>, Config['scale'], keyof TokenScales<T>[Config['scale']]> : Config['scale'] extends MapScale ? keyof Config['scale'] | NegativeOf<Config, keyof Config['scale']> | PropertyValues<Config, StrictOrEmpty<Config, Config['scale']>> | StrictAdmissions<Config, StrictOrEmpty<Config, Config['scale']>, never, never> : Config['scale'] extends ArrayScale ? Config['scale'][number] | PropertyValues<Config, StrictOrEmpty<Config, Config['scale']>> | StrictAdmissions<Config, StrictOrEmpty<Config, Config['scale']>, never, never> : PropertyValues<Config, true>;
|
|
372
|
+
type Scale<Config extends SystemProp, T extends BaseTheme> = [Config] extends [DeclarationProp] ? ResponsiveProp<DeclarationKey<Extract<Config, DeclarationProp>>> : ResponsiveProp<ScaleValue<Config, T>>;
|
|
373
|
+
type ParserProps<Config extends Record<string, SystemProp>, T extends BaseTheme> = ThemeProps<{ [P in keyof Config]?: Scale<Config[P], T>; }, T>;
|
|
374
|
+
interface Parser<Config extends Record<string, SystemProp>, T extends BaseTheme> {
|
|
375
|
+
(props: ParserProps<Config, T>, orderProps?: boolean): CSSObject;
|
|
376
|
+
propNames: Extract<keyof Config, string>[];
|
|
377
|
+
config: Config;
|
|
378
|
+
}
|
|
379
|
+
type SystemProps<P extends AbstractParser, SafeProps = Omit<Arg<P>, 'theme'>> = { [K in keyof SafeProps]: SafeProps[K]; };
|
|
380
|
+
type ColorOpacityRef<Config extends SystemProp> = Config['scale'] extends 'colors' ? 'colors' extends keyof TokenScales<Theme> ? `{colors.${keyof TokenScales<Theme>[Config['scale'] & keyof TokenScales<Theme>] & string}/${number}}` : never : never;
|
|
381
|
+
/**
|
|
382
|
+
* The six container-query units, admitted on strict scale props ('2vw' stays
|
|
383
|
+
* rejected). The union stays flat — cross-products hit TS2589.
|
|
384
|
+
*/
|
|
385
|
+
type ContainerUnitValue = `${number}cqw` | `${number}cqi` | `${number}cqh` | `${number}cqb` | `${number}cqmin` | `${number}cqmax`;
|
|
386
|
+
type ThemedScaleValue<Config extends SystemProp> = Config['scale'] extends keyof TokenScales<Theme> ? keyof TokenScales<Theme>[Config['scale']] | NegativeOf<Config, keyof TokenScales<Theme>[Config['scale']]> | PropertyValues<Config, StrictOrEmpty<Config, TokenScales<Theme>[Config['scale']]>> | StrictAdmissions<Config, StrictOrEmpty<Config, TokenScales<Theme>[Config['scale']]>, Config['scale'], keyof TokenScales<Theme>[Config['scale']]> | ColorOpacityRef<Config> | ContainerUnitValue : Config['scale'] extends MapScale ? keyof Config['scale'] | NegativeOf<Config, keyof Config['scale']> | PropertyValues<Config, StrictOrEmpty<Config, Config['scale']>> | StrictAdmissions<Config, StrictOrEmpty<Config, Config['scale']>, never, never> | ContainerUnitValue : Config['scale'] extends ArrayScale ? Config['scale'][number] | PropertyValues<Config, StrictOrEmpty<Config, Config['scale']>> | StrictAdmissions<Config, StrictOrEmpty<Config, Config['scale']>, never, never> : PropertyValues<Config, true>;
|
|
387
|
+
type ThemedScale<Config extends SystemProp> = [Config] extends [DeclarationProp] ? ResponsiveProp<DeclarationKey<Extract<Config, DeclarationProp>>> : ResponsiveProp<ThemedScaleValue<Config>>;
|
|
388
|
+
/** `ThemedScale` as a component prop takes it: see `ResponsivePropValue`. */
|
|
389
|
+
type ThemedPropValue<Config extends SystemProp> = [Config] extends [DeclarationProp] ? ResponsivePropValue<DeclarationKey<Extract<Config, DeclarationProp>>> : ResponsivePropValue<ThemedScaleValue<Config>>;
|
|
390
|
+
type RawSelectorKey = `${string}&${string}`;
|
|
391
|
+
type PublishedAliasKeys = Extract<keyof Conditions | keyof Selectors, `_${string}`>;
|
|
392
|
+
type KnownUnderscoreKey = [PublishedAliasKeys] extends [never] ? `_${string}` : BuiltInSelectorAlias | BuiltInConditionAlias | PublishedAliasKeys;
|
|
393
|
+
/** A keyword with `!important`, which CSS accepts after any declared value,
|
|
394
|
+
* or the shorthand `!` that means the same. */
|
|
395
|
+
type Important<Value> = Value extends string ? `${Value} !important` | `${Value}!` : never;
|
|
396
|
+
type PassThroughProp<K extends keyof PropertyTypes> = K extends 'animationName' ? ResponsiveProp<KeyframeRef<string> | PropertyTypes[K]> : ResponsiveProp<PropertyTypes[K] | Important<PropertyTypes<never>[K]>>;
|
|
397
|
+
type UnderscoreBlockMembers<Config extends Record<string, SystemProp>> = { [K in KnownUnderscoreKey]?: ThemedBlockBody<Config>; };
|
|
398
|
+
/**
|
|
399
|
+
* Must stay a FIXED type: an arm referencing the outer inferred `Props` is
|
|
400
|
+
* reverse-mapped away at `.styles()` and stops checking nested values.
|
|
401
|
+
*/
|
|
402
|
+
type ThemedBlockBody<Config extends Record<string, SystemProp>> = { [K in Exclude<keyof PropertyTypes, keyof Config>]?: PassThroughProp<K>; } & { [P in keyof Config]?: ThemedScale<Config[P]>; } & { [K in RawSelectorKey | RawAtRuleKey]?: ThemedBlockBody<Config>; } & UnderscoreBlockMembers<Config>;
|
|
403
|
+
type ThemedCSSProps<Props, Config extends Record<string, SystemProp>> = { [K in keyof Props]?: K extends keyof Config ? ThemedScale<Config[K]> : K extends RawSelectorKey ? ThemedBlockBody<Config> : K extends RawAtRuleKey ? ThemedBlockBody<Config> : K extends KnownUnderscoreKey ? ThemedBlockBody<Config> : K extends keyof PropertyTypes ? PassThroughProp<K> : K extends `_${string}` ? UnknownConditionAlias<K & string> : K extends `@${string}` ? UnknownAtRule<K & string> : Omit<PropertyTypes, keyof Config> & { [P in keyof Config]?: ThemedScale<Config[P]>; }; };
|
|
404
|
+
type ThemedCSSPropMap<Props, Config extends Record<string, SystemProp>> = { [K in keyof Props]?: ThemedCSSProps<Props[K], Config>; };
|
|
405
|
+
interface VariantConfig {
|
|
406
|
+
prop?: string;
|
|
407
|
+
defaultVariant?: string;
|
|
408
|
+
base?: CSSProps<AbstractProps, SystemProps<AbstractParser>>;
|
|
409
|
+
variants: CSSPropMap<AbstractProps, SystemProps<AbstractParser>>;
|
|
410
|
+
}
|
|
411
|
+
interface CompoundEntry {
|
|
412
|
+
condition: Record<string, string>;
|
|
413
|
+
styles: CSSProps<AbstractProps, SystemProps<AbstractParser>>;
|
|
414
|
+
}
|
|
415
|
+
type CSSPropMap<Props, System> = { [K in keyof Props]?: CSSProps<Props[K], System>; };
|
|
416
|
+
type CSSProps<Props, System> = { [K in keyof Props]?: K extends keyof System ? System[K] : K extends keyof PropertyTypes ? PropertyTypes[K] : Omit<PropertyTypes, keyof System> & Omit<System, 'theme'>; };
|
|
417
|
+
type BuiltInSelectorAlias = '_link' | '_visited' | '_hover' | '_focus' | '_focusVisible' | '_focusWithin' | '_active' | '_target' | '_disabled' | '_checked' | '_invalid' | '_required' | '_readOnly' | '_expanded' | '_selected' | '_pressed' | '_before' | '_after' | '_placeholder' | '_selection' | '_first' | '_last' | '_even' | '_odd' | '_empty';
|
|
418
|
+
/**
|
|
419
|
+
* Built-in media-condition aliases. A static union, never members of the
|
|
420
|
+
* augmentable `Conditions`: membership would make the `_` namespace validating
|
|
421
|
+
* for every consumer. Every alias needs a matching entry in
|
|
422
|
+
* `BUILT_IN_CONDITIONS` in conditions.ts, and only type tests catch that drift.
|
|
423
|
+
*/
|
|
424
|
+
type BuiltInConditionAlias = '_motionReduce' | '_motionSafe' | '_print' | '_portrait' | '_landscape' | '_moreContrast' | '_lessContrast' | '_osDark' | '_osLight';
|
|
425
|
+
type SelectorAliasProps<GroupPropValues> = { [K in BuiltInSelectorAlias | Extract<keyof Selectors, `_${string}`>]?: Partial<GroupPropValues> | undefined; };
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/types/styling-names.d.ts
|
|
428
|
+
/** `T`'s declared keys, without a string index signature. */
|
|
429
|
+
type KnownKeys$1<T> = keyof { [K in keyof T as string extends K ? never : K]: T[K]; };
|
|
430
|
+
/** The variant and state props a component declared. */
|
|
431
|
+
type StylingNames<Variants, States> = Extract<KnownKeys$1<Variants> | KnownKeys$1<States>, string>;
|
|
432
|
+
/** The system props one `.system()` key admits: a group's members, or the prop. */
|
|
433
|
+
type PickedProps<GroupRegistry, Key> = Key extends keyof GroupRegistry ? GroupRegistry[Key] extends readonly (infer Member)[] ? Extract<Member, string> : never : Extract<Key, string>;
|
|
434
|
+
/** The system props a component admitted. */
|
|
435
|
+
type AdmittedNames<GroupRegistry, ActiveGroups> = PickedProps<GroupRegistry, KnownKeys$1<ActiveGroups>>;
|
|
436
|
+
/**
|
|
437
|
+
* A `.system()` config. Each key is `true`, unless it admits a prop that a
|
|
438
|
+
* variant or state already names: one value would then drive both.
|
|
439
|
+
*/
|
|
440
|
+
type SystemPicks<GroupRegistry, Picked extends PropertyKey, Names extends string> = { [K in Picked]: [Extract<PickedProps<GroupRegistry, K>, Names>] extends [never] ? true : K extends keyof GroupRegistry ? `"${K & string}" admits "${Extract<PickedProps<GroupRegistry, K>, Names>}", already a variant or state prop` : `"${K & string}" is already a variant or state prop`; };
|
|
441
|
+
/** A variant prop name, unless a system prop of that name is admitted. */
|
|
442
|
+
type UnadmittedName<Name extends string, Admitted> = Name extends Admitted ? `"${Name}" is already an admitted system prop` : Name;
|
|
443
|
+
/** Rejects each state named after an admitted system prop. */
|
|
444
|
+
type UnadmittedStates<Props, Admitted> = { [K in Extract<keyof Props, Admitted>]: `"${K & string}" is already an admitted system prop`; };
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/AnimusExtended.d.ts
|
|
447
|
+
/** `T`'s declared keys, without a string index signature. */
|
|
448
|
+
type KnownKeys<T> = keyof { [K in keyof T as string extends K ? never : K]: T[K]; };
|
|
449
|
+
/**
|
|
450
|
+
* The options an extension inherits on the axis `PropKey`. Redeclaring the
|
|
451
|
+
* axis merges its options at runtime, so a default may name any of them. An
|
|
452
|
+
* axis the parent never declared resolves through the extension's string
|
|
453
|
+
* index to a table with no declared options.
|
|
454
|
+
*/
|
|
455
|
+
type InheritedOptions<Variants, PropKey extends string> = Variants[PropKey & keyof Variants] extends {
|
|
456
|
+
variants: infer Options;
|
|
457
|
+
} ? Extract<KnownKeys<Options>, string> : never;
|
|
458
|
+
/**
|
|
459
|
+
* The inherited custom props without those `Own` redeclares, then `Own`.
|
|
460
|
+
* Key remapping keeps the known keys beside the extension's index signature,
|
|
461
|
+
* which `Omit` would collapse.
|
|
462
|
+
*/
|
|
463
|
+
type Redeclared<Inherited, Own> = { [K in keyof Inherited as K extends keyof Own ? never : K]: Inherited[K]; } & Own;
|
|
464
|
+
declare class AnimusExtendedWithAll<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> {
|
|
465
|
+
propRegistry: PropRegistry;
|
|
466
|
+
groupRegistry: GroupRegistry;
|
|
467
|
+
baseStyles: BaseStyles;
|
|
468
|
+
statesConfig: States;
|
|
469
|
+
variants: Variants;
|
|
470
|
+
activeGroups: ActiveGroups;
|
|
471
|
+
custom: CustomProps;
|
|
472
|
+
compounds: CompoundEntry[];
|
|
473
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps, compounds?: CompoundEntry[]);
|
|
474
|
+
protected extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
475
|
+
asElement<El extends keyof JSX.IntrinsicElements>(component: El): AnimusComponent<El, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
476
|
+
asComponent<C extends ComponentType<any>>(AsComponent: C): AnimusWrappedComponent<C, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
477
|
+
asClass<This extends {
|
|
478
|
+
_buildComponentConfig(): ClassResolverConfig;
|
|
479
|
+
}>(this: This): ClassResolver<BuilderClassProps<This>>;
|
|
480
|
+
_buildComponentConfig(): ClassResolverConfig;
|
|
481
|
+
}
|
|
482
|
+
declare class AnimusExtendedWithSystem<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> extends AnimusExtendedWithAll<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
483
|
+
props<NewCustomProps extends Record<string, CustomPropConfig | DeclarationProp>>(config: NewCustomProps): AnimusExtendedWithAll<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, Redeclared<CustomProps, NewCustomProps>>;
|
|
484
|
+
}
|
|
485
|
+
declare class AnimusExtendedWithStates<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> extends AnimusExtendedWithSystem<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
486
|
+
system<PickedKeys extends keyof GroupRegistry | Extract<keyof PropRegistry, string>>(config: SystemPicks<GroupRegistry, PickedKeys, StylingNames<Variants, States>>): AnimusExtendedWithSystem<PropRegistry, GroupRegistry, BaseStyles, Variants, States, Record<PickedKeys, true> & ActiveGroups, CustomProps>;
|
|
487
|
+
}
|
|
488
|
+
declare class AnimusExtendedWithCompounds<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> extends AnimusExtendedWithStates<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
489
|
+
compound<Props extends AbstractProps>(condition: { [K in keyof Variants]?: keyof Variants[K]['variants'] | ReadonlyArray<keyof Variants[K]['variants']>; }, styles: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
490
|
+
states<Props extends AbstractProps>(config: ThemedCSSPropMap<Props, PropRegistry> & UnadmittedStates<Props, AdmittedNames<GroupRegistry, ActiveGroups>>): AnimusExtendedWithStates<PropRegistry, GroupRegistry, BaseStyles, Variants, ThemedCSSPropMap<Props, PropRegistry> & UnadmittedStates<Props, AdmittedNames<GroupRegistry, ActiveGroups>> & States, ActiveGroups, CustomProps>;
|
|
491
|
+
}
|
|
492
|
+
declare class AnimusExtendedWithVariants<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> extends AnimusExtendedWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
493
|
+
compound<Props extends AbstractProps>(condition: { [K in keyof Variants]?: keyof Variants[K]['variants'] | ReadonlyArray<keyof Variants[K]['variants']>; }, styles: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
494
|
+
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
495
|
+
prop?: UnadmittedName<PropKey, AdmittedNames<GroupRegistry, ActiveGroups>>;
|
|
496
|
+
defaultVariant?: Extract<keyof Props, string> | InheritedOptions<Variants, PropKey>;
|
|
497
|
+
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
498
|
+
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
499
|
+
}): AnimusExtendedWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants & Record<PropKey, {
|
|
500
|
+
prop?: UnadmittedName<PropKey, AdmittedNames<GroupRegistry, ActiveGroups>>;
|
|
501
|
+
defaultVariant?: Extract<keyof Props, string> | InheritedOptions<Variants, PropKey> | undefined;
|
|
502
|
+
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
503
|
+
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
504
|
+
}>, States, ActiveGroups, CustomProps>;
|
|
505
|
+
}
|
|
506
|
+
declare class AnimusExtendedWithBase<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> extends AnimusExtendedWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
507
|
+
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
508
|
+
prop?: UnadmittedName<PropKey, AdmittedNames<GroupRegistry, ActiveGroups>>;
|
|
509
|
+
defaultVariant?: Extract<keyof Props, string> | InheritedOptions<Variants, PropKey>;
|
|
510
|
+
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
511
|
+
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
512
|
+
}): AnimusExtendedWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants & Record<PropKey, {
|
|
513
|
+
prop?: UnadmittedName<PropKey, AdmittedNames<GroupRegistry, ActiveGroups>>;
|
|
514
|
+
defaultVariant?: Extract<keyof Props, string> | InheritedOptions<Variants, PropKey> | undefined;
|
|
515
|
+
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
516
|
+
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
517
|
+
}>, States, ActiveGroups, CustomProps>;
|
|
518
|
+
}
|
|
519
|
+
declare class AnimusExtended<PropRegistry extends Record<string, SystemProp>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, SystemProp>> extends AnimusExtendedWithBase<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
520
|
+
styles<Props extends AbstractProps>(config: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithBase<PropRegistry, GroupRegistry, ThemedCSSProps<Props, PropRegistry> & BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
521
|
+
}
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region src/types/component.d.ts
|
|
524
|
+
declare const ConsumerProps: unique symbol;
|
|
525
|
+
declare const VariantConfigBrand: unique symbol;
|
|
526
|
+
/**
|
|
527
|
+
* Structural constraint for compose() slots. `any` as P avoids expanding the
|
|
528
|
+
* full AnimusComponent intersection, which hits TS2590 on large registries.
|
|
529
|
+
*/
|
|
530
|
+
type AnyBrandedComponent = ForwardRefExoticComponent<any> & {
|
|
531
|
+
readonly [ConsumerProps]: unknown;
|
|
532
|
+
readonly [VariantConfigBrand]: unknown;
|
|
533
|
+
extend: () => unknown;
|
|
534
|
+
};
|
|
535
|
+
type ExtendFn<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, BS, V, S, AG, CP> = {
|
|
536
|
+
extend: () => AnimusExtended<PR, GR, BS & CSSProps<AbstractProps, SystemProps<AbstractParser>>, V & Record<string, VariantConfig>, S & CSSPropMap<AbstractProps, SystemProps<AbstractParser>>, AG & Record<string, true>, CP & Record<string, SystemProp>>;
|
|
537
|
+
};
|
|
538
|
+
type ActiveGroupPropNames<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, AG> = GR[Extract<keyof StripIndex<AG>, keyof GR>][number] | Extract<keyof StripIndex<AG>, keyof PR>;
|
|
539
|
+
type GroupProps<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, AG> = { [K in ActiveGroupPropNames<PR, GR, AG> as K extends string ? K : never]?: ThemedPropValue<PR[K & keyof PR]> | undefined; };
|
|
540
|
+
type CustomPropValues<CP extends Record<string, SystemProp>> = { [K in keyof StripIndex<CP>]?: ThemedPropValue<StripIndex<CP>[K & keyof StripIndex<CP>]> | undefined; };
|
|
541
|
+
type StripIndex<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]; };
|
|
542
|
+
/**
|
|
543
|
+
* Each axis's options, read from its `variants` table alone. A declaration
|
|
544
|
+
* build without `exactOptionalPropertyTypes` prints a config's optional fields
|
|
545
|
+
* as `?: X | undefined`, so testing the whole config against `VariantConfig`
|
|
546
|
+
* fails in a consumer that sets it, and the axis would widen to `string`.
|
|
547
|
+
*/
|
|
548
|
+
type VariantProps<V> = { [K in keyof StripIndex<V>]?: StripIndex<V>[K] extends {
|
|
549
|
+
variants: infer Options;
|
|
550
|
+
} ? keyof Options | undefined : string | undefined; };
|
|
551
|
+
type StateProps<S> = { [K in keyof StripIndex<S>]?: boolean | undefined; };
|
|
552
|
+
/**
|
|
553
|
+
* Keys Animus consumes; the runtime strips them before DOM forwarding.
|
|
554
|
+
* Unioned per source — `keyof` of the intersection hits TS2590 on emit.
|
|
555
|
+
*/
|
|
556
|
+
type AnimusManagedKeys<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, V, S, AG, CP extends Record<string, SystemProp>> = ActiveGroupPropNames<PR, GR, AG> | keyof VariantProps<V> | keyof StateProps<S> | keyof StripIndex<CP> | 'as' | 'asChild' | 'className' | 'children';
|
|
557
|
+
/**
|
|
558
|
+
* Named alias so group props and selector-alias values share one mapped type;
|
|
559
|
+
* inlining it re-derives the type instead of hitting the structural cache.
|
|
560
|
+
*/
|
|
561
|
+
type ResolvedGroupProps<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, AG> = GroupProps<PR, GR, AG>;
|
|
562
|
+
/** What `as` names on a string terminal: an element tag or a component. */
|
|
563
|
+
type AsTarget = keyof JSX.IntrinsicElements | ComponentType<any>;
|
|
564
|
+
/** Everything the builder admitted, whichever element renders. */
|
|
565
|
+
type AnimusOwnProps<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, V, S, AG, CP extends Record<string, SystemProp>> = ResolvedGroupProps<PR, GR, AG> & VariantProps<V> & StateProps<S> & CustomPropValues<CP> & SelectorAliasProps<ResolvedGroupProps<PR, GR, AG>> & {
|
|
566
|
+
asChild?: boolean | undefined;
|
|
567
|
+
className?: string | undefined;
|
|
568
|
+
children?: ReactNode;
|
|
569
|
+
};
|
|
570
|
+
/** A string terminal rendered as `E`: E's native props and ref, then Animus's. */
|
|
571
|
+
type AnimusNativeProps<E extends AsTarget, PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, V, S, AG, CP extends Record<string, SystemProp>> = Omit<ComponentPropsWithRef<E>, AnimusManagedKeys<PR, GR, V, S, AG, CP>> & AnimusOwnProps<PR, GR, V, S, AG, CP>;
|
|
572
|
+
/**
|
|
573
|
+
* The default element's props with `as` open to any target, as compose()
|
|
574
|
+
* reads a slot.
|
|
575
|
+
*/
|
|
576
|
+
type AnimusConsumerProps<El extends keyof JSX.IntrinsicElements, PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, V, S, AG, CP extends Record<string, SystemProp>> = AnimusNativeProps<El, PR, GR, V, S, AG, CP> & {
|
|
577
|
+
as?: AsTarget | undefined;
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* The element `As` selects, or the default element when `As` stays at its
|
|
581
|
+
* constraint.
|
|
582
|
+
*/
|
|
583
|
+
type ElementFor<As extends AsTarget, El extends keyof JSX.IntrinsicElements> = [AsTarget] extends [As] ? El : As;
|
|
584
|
+
/**
|
|
585
|
+
* The default element's signature comes first; without it the builder classes
|
|
586
|
+
* hit TS2589 or check in seconds instead of under one. The polymorphic
|
|
587
|
+
* signature comes last: `ComponentProps` and `createElement` read the last
|
|
588
|
+
* signature, and a rejected JSX call reports its error, naming the prop the
|
|
589
|
+
* selected element or component lacks.
|
|
590
|
+
*/
|
|
591
|
+
type AnimusComponent<El extends keyof JSX.IntrinsicElements, PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, BS, V, S, AG, CP extends Record<string, SystemProp>> = ForwardRefExoticComponent<AnimusNativeProps<El, PR, GR, V, S, AG, CP> & {
|
|
592
|
+
as?: El | undefined;
|
|
593
|
+
}> & (<As extends AsTarget>(props: AnimusNativeProps<ElementFor<As, El>, PR, GR, V, S, AG, CP> & {
|
|
594
|
+
as?: As | undefined;
|
|
595
|
+
}) => ReactNode) & ExtendFn<PR, GR, BS, V, S, AG, CP> & {
|
|
596
|
+
readonly [ConsumerProps]: AnimusConsumerProps<El, PR, GR, V, S, AG, CP>;
|
|
597
|
+
readonly [VariantConfigBrand]: V;
|
|
598
|
+
readonly variantDefaults: Readonly<Record<string, string>>;
|
|
599
|
+
};
|
|
600
|
+
/** `Omit` per union member, so a discriminated-union target keeps each arm. */
|
|
601
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
602
|
+
/**
|
|
603
|
+
* The wrapped component's own props, with its ref, then exactly what the
|
|
604
|
+
* builder admitted: the active groups' props, variants, states and custom
|
|
605
|
+
* props. Managed keys are removed from the wrapped component's props first —
|
|
606
|
+
* intersecting a variant union with its own type for a key collapses to never.
|
|
607
|
+
* `as` and `asChild` are the target's own, since the runtime hands them to it:
|
|
608
|
+
* a target without them does not offer them.
|
|
609
|
+
*/
|
|
610
|
+
type AnimusWrappedConsumerProps<C extends ComponentType<any>, PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, V, S, AG, CP extends Record<string, SystemProp>> = DistributiveOmit<ComponentPropsWithRef<C>, Exclude<AnimusManagedKeys<PR, GR, V, S, AG, CP>, 'as' | 'asChild'>> & ResolvedGroupProps<PR, GR, AG> & VariantProps<V> & StateProps<S> & CustomPropValues<CP> & SelectorAliasProps<ResolvedGroupProps<PR, GR, AG>> & {
|
|
611
|
+
className?: string | undefined;
|
|
612
|
+
children?: ReactNode;
|
|
613
|
+
};
|
|
614
|
+
type AnimusWrappedComponent<C extends ComponentType<any>, PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, BS, V, S, AG, CP extends Record<string, SystemProp>> = ForwardRefExoticComponent<AnimusWrappedConsumerProps<C, PR, GR, V, S, AG, CP>> & ExtendFn<PR, GR, BS, V, S, AG, CP> & {
|
|
615
|
+
readonly [ConsumerProps]: AnimusWrappedConsumerProps<C, PR, GR, V, S, AG, CP>;
|
|
616
|
+
readonly [VariantConfigBrand]: V;
|
|
617
|
+
readonly variantDefaults: Readonly<Record<string, string>>;
|
|
618
|
+
};
|
|
619
|
+
type StripStringIndex<T> = { [K in keyof T as string extends K ? never : K]: T[K]; };
|
|
620
|
+
type ExtractVariantsConfig<C> = C extends {
|
|
621
|
+
readonly [VariantConfigBrand]: infer V;
|
|
622
|
+
} ? StripStringIndex<V> : C extends {
|
|
623
|
+
extend: () => {
|
|
624
|
+
variants: infer V;
|
|
625
|
+
};
|
|
626
|
+
} ? StripStringIndex<V> : {};
|
|
627
|
+
type VariantPropsOf<C> = VariantProps<ExtractVariantsConfig<C>>;
|
|
628
|
+
type RootSlot<Slots extends Record<string, unknown>> = 'Root' extends keyof Slots ? Slots['Root'] : never;
|
|
629
|
+
type RootVariantKeys<Slots extends Record<string, unknown>> = keyof VariantPropsOf<RootSlot<Slots>> & string;
|
|
630
|
+
type SharedConfig<Slots extends Record<string, unknown>> = { [K in RootVariantKeys<Slots>]?: true; };
|
|
631
|
+
type SealedProps<C> = C extends {
|
|
632
|
+
readonly [ConsumerProps]: infer P;
|
|
633
|
+
} ? Omit<P, 'extend'> & {
|
|
634
|
+
className?: string | undefined;
|
|
635
|
+
children?: ReactNode;
|
|
636
|
+
} : C extends ForwardRefExoticComponent<infer P> ? Omit<P, 'extend'> & {
|
|
637
|
+
className?: string | undefined;
|
|
638
|
+
children?: ReactNode;
|
|
639
|
+
} : never;
|
|
640
|
+
type ComposedFamily<Slots extends Record<string, unknown>> = { [K in keyof Slots]: ForwardRefExoticComponent<SealedProps<Slots[K]>>; };
|
|
641
|
+
/** An `asClass()` resolver's input: exactly the props the builder admitted. */
|
|
642
|
+
type AnimusClassProps<PR extends Record<string, SystemProp>, GR extends Record<string, (keyof PR)[]>, V, S, AG, CP extends Record<string, SystemProp>> = ResolvedGroupProps<PR, GR, AG> & VariantProps<V> & StateProps<S> & CustomPropValues<CP> & SelectorAliasProps<ResolvedGroupProps<PR, GR, AG>>;
|
|
643
|
+
/**
|
|
644
|
+
* The `asClass()` input of the builder `B`, read from the registries its
|
|
645
|
+
* public fields carry. Resolved from the receiver at the call, so the
|
|
646
|
+
* builder classes' own type parameters never carry it.
|
|
647
|
+
*/
|
|
648
|
+
type BuilderClassProps<B> = B extends {
|
|
649
|
+
propRegistry: infer PR extends Record<string, SystemProp>;
|
|
650
|
+
} ? B extends {
|
|
651
|
+
groupRegistry: infer GR extends Record<string, (keyof PR)[]>;
|
|
652
|
+
variants: infer V;
|
|
653
|
+
statesConfig: infer S;
|
|
654
|
+
activeGroups: infer AG;
|
|
655
|
+
custom: infer CP extends Record<string, SystemProp>;
|
|
656
|
+
} ? AnimusClassProps<PR, GR, V, S, AG, CP> : never : never;
|
|
657
|
+
//#endregion
|
|
658
|
+
export { SerializedTheme as $, SystemProps as A, ReservedByConditionRegistry as At, ResponsiveProp as B, ParserProps as C, ConditionAliasMap as Ct, ScaleValue as D, NarrowedAliases as Dt, Scale as E, ConditionsOf as Et, VariantConfig as F, CSSColorValue as G, AbstractTheme as H, ArrayScale as I, ContextualVarRegistration as J, ColorModeOptions as K, MapScale as L, ThemedCSSProps as M, SelectorsOf as Mt, ThemedScale as N, UnknownAtRule as Nt, SelectorAliasProps as O, RawAtRuleKey as Ot, ThemedScaleValue as P, UnknownConditionAlias as Pt, ScaleTokenRef as Q, AbstractProps as R, Parser as S, ConditionAlias as St, PropertyValues as T, Conditions as Tt, BaseTheme as U, ThemeProps as V, BrowserColorSchemeConfig as W, EmittedTokenPaths as X, EmittedScales as Y, ModeAliasDefinition as Z, CSSProps as _, KeyframeFrameMap as _t, BuilderClassProps as a, TokenDefinition as at, DeclarationKey as b, AtRuleValue as bt, VariantPropsOf as c, FindPath as ct, StylingNames as d, PathToLiteral as dt, SystemPreferenceConfig as et, SystemPicks as f, PathValue as ft, CSSPropMap as g, Selectors as gt, BuiltInSelectorAlias as h, SelectorAliasMap as ht, AnyBrandedComponent as i, ThemeStructuralKey as it, ThemedCSSPropMap as j, ReservedBySelectorRegistry as jt, SystemProp as k, RegistryBrand as kt, AnimusExtended as l, LiteralPaths as lt, BuiltInConditionAlias as m, SelectorAlias as mt, AnimusComponent as n, ThemeCssFragment as nt, ComposedFamily as o, TokenScales as ot, AbstractParser as p, BUILT_IN_SELECTORS as pt, ColorTokenRef as q, AnimusWrappedComponent as r, ThemeManifest as rt, SharedConfig as s, CSSObject as st, AnimusClassProps as t, Theme as tt, AnimusExtendedWithAll as u, Path as ut, CompoundEntry as v, KeyframeRef as vt, Prop as w, ConditionKind as wt, DeclarationProp as x, BUILT_IN_CONDITIONS as xt, CustomPropConfig as y, Keyframes as yt, MediaQueryMap as z };
|
|
659
|
+
//# sourceMappingURL=component-stJhG_A-.d.ts.map
|