@animus-ui/system 0.1.9 → 0.1.12
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/README.md +124 -51
- package/dist/Animus.d.ts +3 -2
- package/dist/Animus.d.ts.map +1 -1
- package/dist/AnimusExtended.d.ts +3 -2
- package/dist/AnimusExtended.d.ts.map +1 -1
- package/dist/SystemBuilder.d.ts +184 -155
- package/dist/SystemBuilder.d.ts.map +1 -1
- package/dist/appearance/index.d.ts +0 -68
- package/dist/appearance/index.d.ts.map +1 -1
- package/dist/appearance/index.js +0 -91
- package/dist/assert-root-slot-C3Lp9MNJ.js +10 -0
- package/dist/asset.d.ts +4 -13
- package/dist/asset.d.ts.map +1 -1
- package/dist/bootstrap/createAppearanceBootstrap.d.ts +0 -57
- package/dist/bootstrap/createAppearanceBootstrap.d.ts.map +1 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +4 -58
- package/dist/class-resolver.d.ts +6 -0
- package/dist/class-resolver.d.ts.map +1 -0
- package/dist/class-resolver.js +2 -0
- package/dist/compose.d.ts +2 -16
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +3 -17
- package/dist/composeWithContext.d.ts +4 -15
- package/dist/composeWithContext.d.ts.map +1 -1
- package/dist/composeWithContext.js +5 -16
- package/dist/conditions.d.ts +24 -141
- package/dist/conditions.d.ts.map +1 -1
- package/dist/createClassResolver-EpwTL9Sa.js +228 -0
- package/dist/createComposedFamily-C4NovMcd.js +115 -0
- package/dist/groups/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +318 -408
- package/dist/keyframes.d.ts +2 -23
- package/dist/keyframes.d.ts.map +1 -1
- package/dist/runtime/assert-root-slot.d.ts +2 -13
- package/dist/runtime/assert-root-slot.d.ts.map +1 -1
- package/dist/runtime/createClassResolver.d.ts +10 -9
- package/dist/runtime/createClassResolver.d.ts.map +1 -1
- package/dist/runtime/createComposedFamily.d.ts +2 -7
- package/dist/runtime/createComposedFamily.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +0 -16
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/is-dev.d.ts +2 -42
- package/dist/runtime/is-dev.d.ts.map +1 -1
- package/dist/runtime/resolveClasses.d.ts +8 -33
- package/dist/runtime/resolveClasses.d.ts.map +1 -1
- package/dist/runtime/witness.d.ts +0 -8
- package/dist/runtime/witness.d.ts.map +1 -1
- package/dist/runtime-entry.d.ts +2 -7
- package/dist/runtime-entry.d.ts.map +1 -1
- package/dist/runtime-entry.js +2 -1
- package/dist/selectors.d.ts +6 -45
- package/dist/selectors.d.ts.map +1 -1
- package/dist/{size-DHdmBc64.js → size-C6jqxiQy.js} +7 -34
- package/dist/theme/createTheme.d.ts +26 -95
- package/dist/theme/createTheme.d.ts.map +1 -1
- package/dist/theme/flattenScale.d.ts +4 -10
- package/dist/theme/flattenScale.d.ts.map +1 -1
- package/dist/theme/resolveReferences.d.ts +7 -35
- package/dist/theme/resolveReferences.d.ts.map +1 -1
- package/dist/theme/serializeTokens.d.ts +0 -3
- package/dist/theme/serializeTokens.d.ts.map +1 -1
- package/dist/theme/types.d.ts +4 -26
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/utils.d.ts +1 -18
- package/dist/theme/utils.d.ts.map +1 -1
- package/dist/transforms/border.d.ts +1 -4
- package/dist/transforms/border.d.ts.map +1 -1
- package/dist/transforms/createTransform.d.ts +6 -31
- package/dist/transforms/createTransform.d.ts.map +1 -1
- package/dist/transforms/grid.d.ts +2 -12
- package/dist/transforms/grid.d.ts.map +1 -1
- package/dist/transforms/size.d.ts +2 -8
- package/dist/transforms/size.d.ts.map +1 -1
- package/dist/types/component.d.ts +9 -105
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/config.d.ts +12 -141
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/theme.d.ts +8 -165
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/utils/deepMerge.d.ts.map +1 -1
- package/package.json +17 -4
- package/dist/assert-root-slot-B83scqPh.js +0 -21
- package/dist/createComposedFamily-3ZugjBpU.js +0 -472
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
import { ColorModeOptions, ContextualVarRegistration, CSSColorValue, ModeAliasDefinition, SerializedTheme, ThemeCssFragment, ThemeManifest, ThemeStructuralKey, TokenDefinition } from '../types/theme';
|
|
2
2
|
import { LiteralPaths } from './flattenScale';
|
|
3
|
-
/**
|
|
3
|
+
/** Identity mapping that caches the type, preventing TS2589 depth growth. */
|
|
4
4
|
export type Flatten<T> = {
|
|
5
5
|
[K in keyof T]: T[K];
|
|
6
6
|
};
|
|
7
|
-
/** Right-biased object merge used where runtime composition is also right-biased. */
|
|
8
7
|
type MergeRecord<Base, Incoming> = Omit<Base, keyof Incoming> & Incoming;
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* parameter's key constraint — it derives FROM the already-inferred `Vars`, so
|
|
13
|
-
* it can never feed back into `Vars` inference or perturb literal-key narrowing.
|
|
9
|
+
* Var NAMES across all scales. Derives from the already-inferred `Vars`, so it
|
|
10
|
+
* never feeds back into inference or perturbs literal-key narrowing.
|
|
14
11
|
*/
|
|
15
12
|
type ContextualVarNames<Vars> = {
|
|
16
13
|
[K in keyof Vars]: Vars[K] extends readonly (infer N extends string)[] ? N : never;
|
|
17
14
|
}[keyof Vars];
|
|
18
15
|
type ThemeScaleKeys<T> = Exclude<keyof T & string, ThemeStructuralKey>;
|
|
19
|
-
/**
|
|
16
|
+
/** Theme data plus boundary members, non-enumerable at runtime. */
|
|
20
17
|
type BuiltTheme<T, Emitted extends string> = {
|
|
21
18
|
[K in keyof T]: T[K];
|
|
22
19
|
} & {
|
|
23
|
-
/**
|
|
20
|
+
/** Tuple wrapper prevents never-distribution. Non-enumerable at runtime. */
|
|
24
21
|
readonly __emitted: [Emitted];
|
|
25
22
|
manifest: ThemeManifest;
|
|
26
23
|
serialize(): SerializedTheme;
|
|
27
|
-
/**
|
|
24
|
+
/** Dot-path token → `var()` ref, or the raw value if not emitted. */
|
|
28
25
|
varRef(tokenPath: string): string | undefined;
|
|
29
26
|
};
|
|
30
27
|
/**
|
|
31
|
-
* Manifest
|
|
32
|
-
*
|
|
33
|
-
* A read-only carrier for the D8 copy-on-write substrate: in this manifest
|
|
34
|
-
* version `build()` still REGENERATES every fragment from the authored data
|
|
35
|
-
* (zero-delta contract — carried fragments never become the source of
|
|
36
|
-
* `variableCss` here); later increments consult it for per-section
|
|
37
|
-
* pass-through.
|
|
28
|
+
* Manifest fields carried through the explicit manifest read — the manifest is
|
|
29
|
+
* non-enumerable. Read-only: `build()` regenerates every fragment.
|
|
38
30
|
*/
|
|
39
31
|
interface CarriedManifestV2 {
|
|
40
32
|
tokenDefinitions?: Record<string, TokenDefinition>;
|
|
@@ -45,64 +37,43 @@ interface CarriedManifestV2 {
|
|
|
45
37
|
contractHash?: string;
|
|
46
38
|
cssFragments?: ThemeCssFragment[];
|
|
47
39
|
}
|
|
48
|
-
/** Shared runtime state passed between builder phases. */
|
|
49
40
|
interface BuilderState {
|
|
50
41
|
theme: Record<string, unknown>;
|
|
51
42
|
emittedScales: Set<string>;
|
|
52
43
|
contextualVars: Map<string, string[]>;
|
|
53
44
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* Kept separate from `contextualVars` so the names-only registry the Rust
|
|
57
|
-
* extractor consumes (`contextualVarsJson`) never changes shape.
|
|
45
|
+
* Keyed by contextual var NAME, not the `--` custom property. Kept out of
|
|
46
|
+
* `contextualVars` so the extractor's names-only registry keeps its shape.
|
|
58
47
|
*/
|
|
59
48
|
contextualVarRegistrations: Map<string, ContextualVarRegistration>;
|
|
60
|
-
/** See {@link CarriedManifestV2}. Present only after a v2-manifest from(). */
|
|
61
49
|
carriedManifestV2?: CarriedManifestV2;
|
|
62
50
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* ALL v2 manifest fields rather than fabricating them from resolved values
|
|
66
|
-
* (D8) — the composed theme stays v1-shaped and increment 03's targeted
|
|
67
|
-
* `createThemeVariants` rejection keys off exactly that absence.
|
|
51
|
+
* A source manifest without the v2 discriminant: the authored graph is
|
|
52
|
+
* unknowable, so `build()` suppresses all v2 fields instead of fabricating.
|
|
68
53
|
*/
|
|
69
54
|
hasLegacyManifestSource: boolean;
|
|
70
55
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* conflicts error naming both sources positionally; positional labels are
|
|
74
|
-
* the accepted form until DEF-4's provenance artifact).
|
|
56
|
+
* Flattened leaf path → 1-based index of the `extend()` call that first
|
|
57
|
+
* defined it; sibling conflicts name both sources by that index.
|
|
75
58
|
*/
|
|
76
59
|
extendProvenance: Map<string, number>;
|
|
77
|
-
/** Number of `extend()` calls made so far — the next source's label index. */
|
|
78
60
|
extendCount: number;
|
|
79
61
|
/**
|
|
80
|
-
* Mode names carried in by `extend()
|
|
81
|
-
*
|
|
82
|
-
* pre-existing behavior, not consumer breakage, and must round-trip.
|
|
62
|
+
* Mode names carried in by `extend()`. Exempt from the coverage gate — a
|
|
63
|
+
* kit's own alias asymmetry must round-trip unchanged.
|
|
83
64
|
*/
|
|
84
65
|
inheritedModes: Set<string>;
|
|
85
66
|
/**
|
|
86
|
-
* Alias dot-paths
|
|
87
|
-
*
|
|
88
|
-
* entry or the build fails listing the uncovered set.
|
|
67
|
+
* Alias dot-paths from extended sources: a consumer-declared mode must cover
|
|
68
|
+
* them or name a base.
|
|
89
69
|
*/
|
|
90
70
|
inheritedModeAliases: Set<string>;
|
|
91
71
|
/**
|
|
92
|
-
* Token
|
|
93
|
-
*
|
|
94
|
-
* target is absent from the merged map AND present here is a hard error;
|
|
95
|
-
* a later re-add simply makes the target known again.
|
|
72
|
+
* Token path dropped by `addScale({ replace: true })` → the replaced scale.
|
|
73
|
+
* A reference to one that is never re-added fails `build()`.
|
|
96
74
|
*/
|
|
97
75
|
droppedTokenPaths: Map<string, string>;
|
|
98
76
|
}
|
|
99
|
-
/**
|
|
100
|
-
* What `from()` actually inherits from its argument: a library bundle
|
|
101
|
-
* contributes its theme half — `theme ?? tokens` (D9 naming; `tokens`
|
|
102
|
-
* accepted until DEF-8 resolves) — anything else is treated as a built
|
|
103
|
-
* theme and contributes itself. Mirrors the runtime bundle detection inside
|
|
104
|
-
* `from()`.
|
|
105
|
-
*/
|
|
106
77
|
type ThemeSourceOf<Source> = Source extends {
|
|
107
78
|
system: {
|
|
108
79
|
toConfig(...args: never[]): unknown;
|
|
@@ -111,22 +82,13 @@ type ThemeSourceOf<Source> = Source extends {
|
|
|
111
82
|
tokens?: infer TokensHalf;
|
|
112
83
|
} ? ThemeHalf extends Record<string, unknown> ? ThemeHalf : TokensHalf extends Record<string, unknown> ? TokensHalf : Record<never, never> : Source;
|
|
113
84
|
type ThemeBoundaryKey = '__emitted' | 'manifest' | 'serialize' | 'varRef';
|
|
114
|
-
/** Runtime composition copies enumerable data and deliberately skips methods. */
|
|
115
85
|
type ThemeDataOf<Source> = {
|
|
116
86
|
[Key in keyof Source as Key extends ThemeBoundaryKey ? never : Extract<Source[Key], (...args: never[]) => unknown> extends never ? Key : never]: Source[Key];
|
|
117
87
|
};
|
|
118
88
|
type MergeThemeData<Base, Source> = Flatten<MergeRecord<Base, ThemeDataOf<Source>>>;
|
|
119
|
-
/** Preserve the built source's exact emitted-scale phantom without exposing it as data. */
|
|
120
89
|
type EmittedThemeScalesOf<Source> = Source extends {
|
|
121
90
|
readonly __emitted: [infer Emitted extends string];
|
|
122
91
|
} ? Emitted : never;
|
|
123
|
-
/**
|
|
124
|
-
* What `extend()` inherits from its argument: a library bundle contributes
|
|
125
|
-
* its THEME half — `theme ?? tokens` (D9 naming; `tokens` accepted until
|
|
126
|
-
* DEF-8 resolves) — anything else is treated as a built theme and
|
|
127
|
-
* contributes itself. Mirrors the runtime bundle-half resolution inside
|
|
128
|
-
* `extend()`.
|
|
129
|
-
*/
|
|
130
92
|
type ExtendedThemeSourceOf<Source> = Source extends {
|
|
131
93
|
system: {
|
|
132
94
|
toConfig(...args: never[]): unknown;
|
|
@@ -136,50 +98,23 @@ type ExtendedThemeSourceOf<Source> = Source extends {
|
|
|
136
98
|
} ? ThemeHalf extends Record<string, unknown> ? ThemeHalf : TokensHalf extends Record<string, unknown> ? TokensHalf : Record<never, never> : Source;
|
|
137
99
|
declare const THEME_STAGE_BRAND: unique symbol;
|
|
138
100
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* builder is in the `'inherit'` stage; every augmentation method advances to
|
|
142
|
-
* `'extend'`, making "inherit first, then extend" a compile error rather
|
|
143
|
-
* than a lint. `from()` is deliberately NOT stage-gated — its call-anywhere
|
|
144
|
-
* semantics are frozen for the deprecation window, so it passes the stage
|
|
145
|
-
* through unchanged. Phantom — never present at runtime.
|
|
101
|
+
* Phantom builder stage: `extend()` is callable only while `'inherit'`, and
|
|
102
|
+
* every augmentation method advances to `'extend'`. `from()` is not gated.
|
|
146
103
|
*/
|
|
147
104
|
export type ThemeBuilderStage = 'inherit' | 'extend';
|
|
148
|
-
/**
|
|
149
|
-
* ThemeScales — the final phase. Has addScale, extendScale, declareContextualVars, build.
|
|
150
|
-
* Also allows addColors and addColorModes for augmentation.
|
|
151
|
-
*/
|
|
152
105
|
export declare class ThemeBuilder<T extends Record<string, unknown> = Record<string, unknown>, Emitted extends string = never, Stage extends ThemeBuilderStage = 'inherit'> {
|
|
153
106
|
readonly [THEME_STAGE_BRAND]?: Stage;
|
|
154
107
|
/** @internal */ _state: BuilderState;
|
|
155
108
|
constructor(state: BuilderState);
|
|
156
109
|
addBreakpoints<BP extends Record<string, number>>(breakpoints: BP): ThemeBuilder<{ [K in keyof (Omit<T, "breakpoints"> & Record<"breakpoints", { [K in keyof BP]: BP[K]; }>)]: (Omit<T, "breakpoints"> & Record<"breakpoints", { [K in keyof BP]: BP[K]; }>)[K]; }, Emitted, "extend">;
|
|
157
110
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* through unchanged. Do not add a stage gate; do not flip the merge
|
|
161
|
-
* direction. Those semantics ship under the new verb only.
|
|
162
|
-
*
|
|
163
|
-
* @deprecated Use `extend(source)` — the single extension verb on both
|
|
164
|
-
* builders: the extended source seeds the base and later local calls win.
|
|
165
|
-
* `from()` keeps these frozen source-wins semantics for at least one minor
|
|
166
|
-
* release after `extend()` ships.
|
|
111
|
+
* Source-WINS precedence over prior builder state, callable at any stage.
|
|
112
|
+
* @deprecated Use `extend(source)` — the source seeds the base, local wins.
|
|
167
113
|
*/
|
|
168
114
|
from<Source extends object>(builtTheme: Source): ThemeBuilder<Flatten<MergeRecord<T, ThemeDataOf<ThemeSourceOf<Source>>>>, Emitted | EmittedThemeScalesOf<ThemeSourceOf<Source>>, Stage>;
|
|
169
115
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* set — seeds the builder as the BASE, and local calls made after
|
|
173
|
-
* `extend()` win on conflict (the mirror of `from()`'s source-wins).
|
|
174
|
-
* Chainable and repeatable, but only before augmentation methods ("inherit
|
|
175
|
-
* first, then extend" — enforced by the phantom builder stage). Accepts a
|
|
176
|
-
* built theme or a library bundle, consuming the bundle's theme half
|
|
177
|
-
* (`theme ?? tokens`, D9) and ignoring the rest.
|
|
178
|
-
*
|
|
179
|
-
* Sibling conflicts fail loud (D3/G4): a leaf path defined divergently by
|
|
180
|
-
* two extended sources throws naming the path and both sources
|
|
181
|
-
* positionally; equal values coalesce silently, and the consumer's own
|
|
182
|
-
* post-extend `add*` calls override silently (NS-4).
|
|
116
|
+
* Inherits a built theme or library bundle as the BASE; local calls after
|
|
117
|
+
* `extend()` win, and leaves that two sources define divergently throw.
|
|
183
118
|
*/
|
|
184
119
|
extend<Source extends object>(this: ThemeBuilder<T, Emitted, 'inherit'>, source: Source): ThemeBuilder<MergeThemeData<T, ExtendedThemeSourceOf<Source>>, Emitted | EmittedThemeScalesOf<ExtendedThemeSourceOf<Source>>, 'inherit'>;
|
|
185
120
|
addColors<Colors extends Record<string, CSSColorValue | Record<string, CSSColorValue>>, NextColors extends LiteralPaths<Colors, '.'> = LiteralPaths<Colors, '.'>>(colors: Colors): ThemeBuilder<Flatten<Omit<T, "colors"> & Record<"colors", Flatten<MergeRecord<T extends {
|
|
@@ -200,10 +135,6 @@ export declare class ThemeBuilder<T extends Record<string, unknown> = Record<str
|
|
|
200
135
|
[K in ThemeScaleKeys<T>]: readonly string[];
|
|
201
136
|
}>>(vars: Vars & Record<Exclude<keyof Vars, ThemeScaleKeys<T>>, never>, registrations?: Partial<Record<ContextualVarNames<Vars>, ContextualVarRegistration>>): ThemeBuilder<{ [K in keyof T]: K extends keyof Vars ? Vars[K] extends readonly string[] ? T[K] & Record<Vars[K][number], `var(--${string})`> : T[K] : T[K]; }, Emitted, "extend">;
|
|
202
137
|
extendScale<Key extends Exclude<keyof T, ThemeStructuralKey>, Fn extends (tokens: T[Key]) => Record<string | number, unknown>>(key: Key, updateFn: Fn): ThemeBuilder<Flatten<Omit<T, Key> & Record<Key, Flatten<MergeRecord<T[Key], ReturnType<Fn>>>>>, Emitted, "extend">;
|
|
203
|
-
/**
|
|
204
|
-
* Finalize the theme build.
|
|
205
|
-
* Flattens nested data at the boundary — produces manifest and serialize().
|
|
206
|
-
*/
|
|
207
138
|
build(): BuiltTheme<T, Emitted>;
|
|
208
139
|
}
|
|
209
140
|
type EmptyTheme = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,mBAAmB,EACnB,eAAe,EAEf,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"createTheme.d.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I,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAGlE,aAAa,CAAC,EAAE,OAAO,CACrB,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,yBAAyB,CAAC,CAC5D,mBAYE,CAAC,iKA4BL;IAED,WAAW,CACT,GAAG,SAAS,OAAO,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC,EAChD,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAC/D,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,sHASvB;IAED,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CA6P9B;CACF;AAED,KAAK,UAAU,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAE1D,wBAAgB,WAAW,+CAE1B"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an exhaustive list of all possible paths of an object T for keys K.
|
|
3
|
-
* Possibilities are returned as `k1.k2.k3`.
|
|
4
|
-
*/
|
|
1
|
+
/** Every path through T reachable from K, joined by `D`. */
|
|
5
2
|
export 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;
|
|
6
|
-
/** Returns valid paths of object T */
|
|
7
3
|
export type Path<T, D extends string = '.'> = FindPath<T, keyof T, D> | keyof T;
|
|
8
|
-
/** Returns the value of a valid path P `k1.k2.k3` in object T */
|
|
9
4
|
export 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;
|
|
10
|
-
/**
|
|
5
|
+
/** Only the paths whose value is a string or number, as a union. */
|
|
11
6
|
export 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;
|
|
12
7
|
/**
|
|
13
|
-
*
|
|
14
|
-
* {
|
|
15
|
-
*
|
|
8
|
+
* Flat map of the primitive-valued paths only: `{ a: { b: 1 } }` becomes
|
|
9
|
+
* `{ 'a-b': 1 }` when `D` is `-`.
|
|
16
10
|
*/
|
|
17
11
|
export type LiteralPaths<T extends Record<string | number, any>, D extends string = '.', Base extends string = ''> = {
|
|
18
12
|
[K in Path<T, D> as PathToLiteral<T, K, D, Base>]: PathValue<T, PathToLiteral<T, K, D>, D>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flattenScale.d.ts","sourceRoot":"","sources":["../../src/theme/flattenScale.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"flattenScale.d.ts","sourceRoot":"","sources":["../../src/theme/flattenScale.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,GAAG,IAAI,CAAC,SAClE,MAAM,GACN,MAAM,GACN,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GACvC,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,GACzB,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GACp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AM,MAAM,YAAY,CACtB,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACtC,CAAC,SAAS,MAAM,GAAG,GAAG,EACtB,IAAI,SAAS,MAAM,GAAG,EAAE,IACtB;KACD,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,SAAS,CAC1D,CAAC,EACD,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACtB,CAAC,CACF;CACF,CAAC;AAEF,wBAAgB,YAAY,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAC1C,CAAC,SAAS,MAAM,EAChB,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAkBhD"}
|
|
@@ -1,49 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* openspec change first-class-extension).
|
|
4
|
-
*
|
|
5
|
-
* Replaces the old single-pass, insertion-order-dependent rewrite: references
|
|
6
|
-
* resolve against the COMPLETE flattened map via depth-first traversal of the
|
|
7
|
-
* reference DAG, so declaration order is never observable (G3), references
|
|
8
|
-
* inside emitted scales resolve into the emitted variable declarations
|
|
9
|
-
* instead of leaking literally into CSS (G2), and a token resolves to the
|
|
10
|
-
* same value whether its scale is emitted or inlined (G1 — an emitted target
|
|
11
|
-
* substitutes as `var()`, which the cascade late-binds to exactly the value
|
|
12
|
-
* the inlined form substitutes directly).
|
|
13
|
-
*
|
|
14
|
-
* Pure module: consumes the flatten pass's maps, returns fresh maps, mutates
|
|
15
|
-
* nothing. Runs in QuickJS — ES built-ins only, no Node/WHATWG APIs.
|
|
2
|
+
* Runs inside QuickJS: ES built-ins only, no Node or WHATWG APIs.
|
|
16
3
|
*/
|
|
17
4
|
export interface ResolvedReferences {
|
|
18
5
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Keys are in sorted token-path order (deterministic serialization).
|
|
6
|
+
* Emitted paths keep their `var()` indirection, every other path its
|
|
7
|
+
* resolved literal; keys are in sorted path order for stable output.
|
|
22
8
|
*/
|
|
23
9
|
tokenMap: Record<string, string>;
|
|
24
10
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* so reversed-declaration builds produce byte-identical CSS.
|
|
11
|
+
* Declaration values for the emitted paths, in sorted token-path order —
|
|
12
|
+
* the CSS emitter writes in iteration order, so builds are byte-identical.
|
|
28
13
|
*/
|
|
29
14
|
variables: Record<string, string>;
|
|
30
15
|
}
|
|
31
16
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* - `tokenMap`/`variableMap`/`variables` are `flattenTheme`'s outputs: an
|
|
35
|
-
* emitted path's tokenMap entry is its `var()` indirection and its RAW
|
|
36
|
-
* authored value is parked in `variables`; a non-emitted path's tokenMap
|
|
37
|
-
* entry IS its raw value.
|
|
38
|
-
* - Substitution per reference: emitted target → `var(--target)`; non-emitted
|
|
39
|
-
* target → its resolved literal; `{path/NN}` keeps the existing
|
|
40
|
-
* `color-mix` output shape (`/0` → `transparent`, `/100` → the base).
|
|
41
|
-
* - Unresolvable target: warn once per missing path, keep the literal — a
|
|
42
|
-
* SUPPORTED pattern (a kit theme may reference tokens its consumer
|
|
43
|
-
* provides later). Dangling-reference errors arrive with the explicit
|
|
44
|
-
* replacement form (D5, increment 04).
|
|
45
|
-
* - Reference cycle: hard error naming the cycle's token paths in traversal
|
|
46
|
-
* order, regardless of emission flags (emission-invariant failure, G1).
|
|
17
|
+
* An unresolvable reference warns and keeps its literal: a kit theme may
|
|
18
|
+
* reference tokens its consumer supplies later.
|
|
47
19
|
*/
|
|
48
20
|
export declare function resolveReferences(tokenMap: Record<string, string>, variableMap: Record<string, string>, variables: Record<string, string>): ResolvedReferences;
|
|
49
21
|
//# sourceMappingURL=resolveReferences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveReferences.d.ts","sourceRoot":"","sources":["../../src/theme/resolveReferences.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resolveReferences.d.ts","sourceRoot":"","sources":["../../src/theme/resolveReferences.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiCH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,kBAAkB,CAqHpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializeTokens.d.ts","sourceRoot":"","sources":["../../src/theme/serializeTokens.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"serializeTokens.d.ts","sourceRoot":"","sources":["../../src/theme/serializeTokens.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,MAAM,SAAS,MAAM,IACnB;KACD,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG;CACtE,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,GAAG,GAAG,MAAM,CAAC,EAAE,GACpE,CAAC,GACD,CAAC,CAAC"}
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -1,42 +1,20 @@
|
|
|
1
1
|
import { AbstractTheme, CSSObject } from '../types/theme';
|
|
2
|
-
/**
|
|
3
|
-
* This is a custom generic that ensures the safety of adding additional values to a theme object without accidentally wiping out
|
|
4
|
-
* required keys like `breakpoints`. It works by creating a new mapped type and merging the values of the union of Base & Next:
|
|
5
|
-
* 1. If the key exists on both Base and Next return the intersection of both values
|
|
6
|
-
* 2. If the key exists on next use the value on next.
|
|
7
|
-
* 3. If the key exists on base but nothing else use the value on base.
|
|
8
|
-
*
|
|
9
|
-
* The resulting type is then rejoined with keys that cannot be mutated (breakpoints) as the next version of Theme
|
|
10
|
-
*/
|
|
11
2
|
export type MergeTheme<Base extends AbstractTheme, Next, Unmergable = Record<'breakpoints', Base['breakpoints']>> = Unmergable & Merge<Base, Next>;
|
|
12
|
-
/** This merges at 2 levels of depth */
|
|
13
3
|
export type Merge<A, B> = {
|
|
14
4
|
[K in keyof (A & B)]: K extends keyof B ? K extends keyof A ? AssignValueIfUnmergable<A[K], B[K]> : B[K] : K extends keyof A ? A[K] : never;
|
|
15
5
|
};
|
|
16
|
-
/** Extract mergable objects */
|
|
17
6
|
export type Mergable<T> = Exclude<T, ((...args: any) => any) | string | boolean | symbol | number | any[]>;
|
|
18
|
-
/** Return B if either A or B is unmergable */
|
|
19
7
|
export type AssignValueIfUnmergable<A, B> = Mergable<A> extends never ? B : Mergable<B> extends never ? B : Assign<A, B>;
|
|
20
|
-
/** Prefer all values from B */
|
|
21
8
|
export type Assign<A, B> = {
|
|
22
9
|
[K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
|
|
23
10
|
};
|
|
24
|
-
/** These are keys that are consistent for all theme builds - they are loosely typed as they are not meant to be accessed directly */
|
|
25
11
|
export type PrivateThemeKeys = {
|
|
26
12
|
_variables: Record<string, CSSObject>;
|
|
27
13
|
_tokens: Record<string | number, any>;
|
|
28
14
|
};
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
* bg: {
|
|
34
|
-
* hover: 'someAlias'
|
|
35
|
-
* }
|
|
36
|
-
* }
|
|
37
|
-
* }
|
|
38
|
-
*
|
|
39
|
-
* `button-bg-hover`
|
|
40
|
-
* */
|
|
15
|
+
/**
|
|
16
|
+
* Nesting flattens to dash-joined keys: `{ button: { bg: { hover } } }`
|
|
17
|
+
* becomes `button-bg-hover`.
|
|
18
|
+
*/
|
|
41
19
|
export type ColorModeConfig<Colors> = Record<string, Colors | Record<string, Colors> | Record<string, Colors | Record<string, Colors>>>;
|
|
42
20
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,MAAM,UAAU,CACpB,IAAI,SAAS,aAAa,EAC1B,IAAI,EACJ,UAAU,GAAG,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,IACrD,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAEnC,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GACnC,CAAC,SAAS,MAAM,CAAC,GACf,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GACnC,CAAC,CAAC,CAAC,CAAC,GACN,CAAC,SAAS,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Object(value: unknown): value is object;
|
|
3
|
-
/** Deep merge — matches lodash.merge overload signatures */
|
|
4
2
|
export declare function merge<A, B>(target: A, source: B): A & B;
|
|
5
3
|
export declare function merge<A, B, C>(target: A, s1: B, s2: C): A & B & C;
|
|
6
4
|
export declare function merge<A, B, C, D>(target: A, s1: B, s2: C, s3: D): A & B & C & D;
|
|
7
|
-
/**
|
|
8
|
-
* Resolve a dot-path string against a nested object.
|
|
9
|
-
* walkDotPath({ gray: { 50: '#fafafa' } }, 'gray.50') → '#fafafa'
|
|
10
|
-
* The `_` identity key is handled: 'primary' resolves to obj.primary._ if obj.primary is an object with _.
|
|
11
|
-
*/
|
|
12
5
|
export declare function walkDotPath(obj: Record<string, unknown>, path: string): unknown;
|
|
13
6
|
/**
|
|
14
|
-
*
|
|
15
|
-
* The `_` key is an identity marker — it produces the parent key without suffix.
|
|
16
|
-
* { gray: { 50: '#fafafa' } } → { 'gray.50': '#fafafa' }
|
|
17
|
-
* { primary: { _: 'ember', hover: 'x' } } → { 'primary': 'ember', 'primary.hover': 'x' }
|
|
18
|
-
* CSS variable names use dash-join, computed at the serialization boundary (not here).
|
|
7
|
+
* A `_` key is an identity marker: it takes the parent path with no suffix.
|
|
19
8
|
*/
|
|
20
9
|
export declare function flattenToDotPaths(object: Record<string | number, unknown>, path?: string): Record<string, unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* Convert a dot-path key to a dash-join key for CSS variable naming.
|
|
23
|
-
* 'gray.50' → 'gray-50'
|
|
24
|
-
* 'primary.hover' → 'primary-hover'
|
|
25
|
-
*/
|
|
26
10
|
export declare function dotToDash(dotPath: string): string;
|
|
27
|
-
/** Map over object values — matches lodash.mapValues overload signatures */
|
|
28
11
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/theme/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/theme/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnE,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,GACJ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAiBjB,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAezB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-contained transform: all logic inlined in the callback.
|
|
3
|
-
* No external references — satisfies the extraction constraint.
|
|
4
|
-
*/
|
|
1
|
+
/** All logic stays inline: the extractor cannot follow external references. */
|
|
5
2
|
export declare const borderShorthand: import("./createTransform").NamedTransform;
|
|
6
3
|
//# sourceMappingURL=border.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/transforms/border.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/transforms/border.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,eAAO,MAAM,eAAe,4CAE3B,CAAC"}
|
|
@@ -1,47 +1,22 @@
|
|
|
1
1
|
import type { AbstractProps } from '../types/props';
|
|
2
2
|
import type { CSSObject } from '../types/shared';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* The `CSSObject` arm of the return union is DEPRECATED and is rejected on
|
|
8
|
-
* both resolution paths. Build-time evaluation hard-errors on an object
|
|
9
|
-
* return — no declaration is emitted and the build fails, naming the transform
|
|
10
|
-
* and the file — and the browser runtime drops the whole prop value with a
|
|
11
|
-
* dev-mode warning (production drops quietly). A transform must return a
|
|
12
|
-
* `string` or a finite `number`; rule-level styling ships as declaration
|
|
13
|
-
* scales (`composite-style-scales`), which is the sanctioned path.
|
|
14
|
-
*
|
|
15
|
-
* The arm survives in the type only so imported transforms whose inferred
|
|
16
|
-
* signatures already carry it keep type-checking in `.props({ transform })`
|
|
17
|
-
* positions; TypeScript cannot express `@deprecated` on a single union arm.
|
|
18
|
-
* Narrowing to `string | number` is scheduled for the next breaking release.
|
|
4
|
+
* The `CSSObject` return arm fails the build and drops the value at runtime;
|
|
5
|
+
* a transform must return a string or a finite number.
|
|
19
6
|
*/
|
|
20
7
|
export type TransformFn = (value: string | number, property?: string, props?: AbstractProps) => string | number | CSSObject;
|
|
21
8
|
export type NamedTransform = TransformFn & {
|
|
22
9
|
transformName: string;
|
|
23
10
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* (the body is closure-captured), so cross-system equality must compare
|
|
27
|
-
* the original source. Optional in the type: instances built by an older
|
|
28
|
-
* @animus-ui/system lack it, and a name match with a missing source is a
|
|
29
|
-
* loud conflict, never a silent coalesce.
|
|
11
|
+
* A wrapper's own `toString()` is identical for every transform, so
|
|
12
|
+
* equality compares this captured source instead.
|
|
30
13
|
*/
|
|
31
14
|
transformSource?: string;
|
|
32
15
|
};
|
|
33
16
|
export declare function createTransform(name: string, fn: TransformFn): NamedTransform;
|
|
34
17
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* `transformSource`. A name match with the captured source missing on either
|
|
38
|
-
* side is a loud conflict (older-instance safety), as is a named/bare mix.
|
|
39
|
-
* Bare-function pairs compare by their own `toString()` (their body IS their
|
|
40
|
-
* source; only `createTransform` wrappers hide it). Known accepted residual:
|
|
41
|
-
* two functions with byte-identical source can close over different values
|
|
42
|
-
* and would coalesce — the loud-conflict alternative (identity-only) was
|
|
43
|
-
* measured to false-conflict every transform-bearing prop under duplicate
|
|
44
|
-
* module instances (inc-01 spike) and to forbid re-registering kit props.
|
|
18
|
+
* Two transforms with byte-identical source compare equal even when they
|
|
19
|
+
* close over different values.
|
|
45
20
|
*/
|
|
46
21
|
export declare function areTransformsEqual(a: TransformFn | undefined, b: TransformFn | undefined): boolean;
|
|
47
22
|
//# sourceMappingURL=createTransform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/createTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"createTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/createTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,aAAa,KAClB,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,cAAc,CAW7E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,WAAW,GAAG,SAAS,EAC1B,CAAC,EAAE,WAAW,GAAG,SAAS,GACzB,OAAO,CAkBT"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-contained transform: all logic inlined in the callback.
|
|
3
|
-
* No external references — satisfies the extraction constraint.
|
|
4
|
-
*/
|
|
1
|
+
/** All logic stays inline: the extractor cannot follow external references. */
|
|
5
2
|
export declare const gridItem: import("./createTransform").NamedTransform;
|
|
6
|
-
/**
|
|
7
|
-
* Convert a grid item value to a CSS template string.
|
|
8
|
-
* Exported for non-extraction use — NOT referenced from createTransform callbacks.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Self-contained transform: all logic inlined in the callback.
|
|
12
|
-
* Duplicates grid-item-to-template logic to avoid cross-transform reference.
|
|
13
|
-
*/
|
|
3
|
+
/** Template logic is duplicated rather than shared: no external references. */
|
|
14
4
|
export declare const gridItemRatio: import("./createTransform").NamedTransform;
|
|
15
5
|
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/transforms/grid.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/transforms/grid.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,eAAO,MAAM,QAAQ,4CAUnB,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,aAAa,4CAoCxB,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a numeric coordinate to a CSS value.
|
|
3
|
-
* Exported for non-extraction use — NOT referenced from the createTransform callback.
|
|
4
|
-
*/
|
|
1
|
+
/** The transform below cannot reference this: it inlines its own copy. */
|
|
5
2
|
export declare const percentageOrAbsolute: (coordinate: number) => string | 0;
|
|
6
|
-
/**
|
|
7
|
-
* Self-contained transform: all logic inlined in the callback.
|
|
8
|
-
* No external references — satisfies the extraction constraint.
|
|
9
|
-
*/
|
|
3
|
+
/** All logic stays inline: the extractor cannot follow external references. */
|
|
10
4
|
export declare const size: import("./createTransform").NamedTransform;
|
|
11
5
|
//# sourceMappingURL=size.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/transforms/size.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/transforms/size.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,eAAgB,MAAM,eAQtD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,IAAI,4CA0Bf,CAAC"}
|