@animus-ui/system 0.1.0-next.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/Animus.d.ts +36 -30
- package/dist/Animus.d.ts.map +1 -1
- package/dist/AnimusExtended.d.ts +32 -27
- package/dist/AnimusExtended.d.ts.map +1 -1
- package/dist/SystemBuilder.d.ts +38 -17
- package/dist/SystemBuilder.d.ts.map +1 -1
- package/dist/compose.d.ts +24 -0
- package/dist/compose.d.ts.map +1 -0
- package/dist/compose.js +36 -0
- package/dist/composeWithContext.d.ts +30 -0
- package/dist/composeWithContext.d.ts.map +1 -0
- package/dist/composeWithContext.js +79 -0
- package/dist/createComposedFamily-BsyI6rBc.js +230 -0
- package/dist/groups/index.d.ts +455 -359
- package/dist/groups/index.d.ts.map +1 -1
- package/dist/groups/index.js +139 -55
- package/dist/index.d.ts +11 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +666 -395
- package/dist/keyframes.d.ts +45 -0
- package/dist/keyframes.d.ts.map +1 -0
- package/dist/runtime/createClassResolver.d.ts +10 -0
- package/dist/runtime/createClassResolver.d.ts.map +1 -0
- package/dist/runtime/createComposedFamily.d.ts +16 -0
- package/dist/runtime/createComposedFamily.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +2 -18
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/resolveClasses.d.ts +59 -0
- package/dist/runtime/resolveClasses.d.ts.map +1 -0
- package/dist/runtime-entry.d.ts +10 -0
- package/dist/runtime-entry.d.ts.map +1 -0
- package/dist/runtime-entry.js +2 -0
- package/dist/selectors.d.ts +40 -0
- package/dist/selectors.d.ts.map +1 -0
- package/dist/size-CusLCguT.js +97 -0
- package/dist/theme/createTheme.d.ts +54 -54
- package/dist/theme/createTheme.d.ts.map +1 -1
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/serializeTokens.d.ts +0 -14
- package/dist/theme/serializeTokens.d.ts.map +1 -1
- package/dist/theme/utils.d.ts +20 -4
- package/dist/theme/utils.d.ts.map +1 -1
- package/dist/transforms/border.d.ts +4 -0
- package/dist/transforms/border.d.ts.map +1 -1
- package/dist/transforms/createTransform.d.ts +3 -1
- package/dist/transforms/createTransform.d.ts.map +1 -1
- package/dist/transforms/grid.d.ts +12 -2
- package/dist/transforms/grid.d.ts.map +1 -1
- package/dist/transforms/index.d.ts +0 -1
- package/dist/transforms/index.d.ts.map +1 -1
- package/dist/transforms/size.d.ts +8 -0
- package/dist/transforms/size.d.ts.map +1 -1
- package/dist/types/component.d.ts +141 -23
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/config.d.ts +50 -5
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/properties.d.ts +1 -2
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/props.d.ts +13 -25
- package/dist/types/props.d.ts.map +1 -1
- package/dist/types/theme.d.ts +73 -11
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/utils/deepMerge.d.ts +5 -0
- package/dist/utils/deepMerge.d.ts.map +1 -0
- package/package.json +47 -15
- package/dist/PropertyBuilder.d.ts +0 -11
- package/dist/PropertyBuilder.d.ts.map +0 -1
- package/dist/size-Dge_rsuz.js +0 -70
- package/dist/transforms/utils.d.ts +0 -3
- package/dist/transforms/utils.d.ts.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyframes primitive — top-level factory for declaring named CSS animations
|
|
3
|
+
* as a branded collection of typed per-key references.
|
|
4
|
+
*
|
|
5
|
+
* The returned collection is:
|
|
6
|
+
* - Branded (`__brand: 'Keyframes'`) for plugin discovery via named-export scan.
|
|
7
|
+
* - Carries raw frame data on `__frames` as `{ [key]: { name, frames } }`,
|
|
8
|
+
* where `name` is the resolved keyframes identifier emitted into CSS.
|
|
9
|
+
* - Exposes one `KeyframeRef<Name>` per named key — each ref coerces to its
|
|
10
|
+
* resolved name via `toString()`/`valueOf()` for runtime-fallback paths.
|
|
11
|
+
*
|
|
12
|
+
* Naming: each keyframe's name is generated at authoring time via a
|
|
13
|
+
* deterministic FNV-1a content hash over its frame body (`animus-kf-<hash>`).
|
|
14
|
+
* Identical frame bodies dedupe into a single `@keyframes` emission naturally.
|
|
15
|
+
* The Rust extractor substitutes `motion.ember`-style member-expression
|
|
16
|
+
* references in component styles to the static name at emit time.
|
|
17
|
+
*
|
|
18
|
+
* Frame body vocabulary (narrower than component styles — factory is not
|
|
19
|
+
* system-bound, so prop-config resolution is not available):
|
|
20
|
+
* - CSS property names (camelCase → kebab-case at emission)
|
|
21
|
+
* - Raw CSS values
|
|
22
|
+
* - `{scale.key}` token references (resolved via theme_resolver at emission)
|
|
23
|
+
* - Bare scale keys (e.g. `textShadow: 'glow-text'`) are NOT resolved —
|
|
24
|
+
* consumers must use `{scale.key}` form for theme-resolved values.
|
|
25
|
+
*/
|
|
26
|
+
export type KeyframeFrameMap = Record<string, Record<string, unknown>>;
|
|
27
|
+
export interface KeyframeRef<Name extends string> {
|
|
28
|
+
readonly __brand: 'KeyframeRef';
|
|
29
|
+
readonly __name: Name;
|
|
30
|
+
toString(): string;
|
|
31
|
+
valueOf(): string;
|
|
32
|
+
}
|
|
33
|
+
export type Keyframes<Map extends Record<string, KeyframeFrameMap>> = {
|
|
34
|
+
readonly __brand: 'Keyframes';
|
|
35
|
+
readonly __frames: {
|
|
36
|
+
readonly [K in keyof Map & string]: {
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly frames: Map[K];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
} & {
|
|
42
|
+
readonly [K in keyof Map & string]: KeyframeRef<K>;
|
|
43
|
+
};
|
|
44
|
+
export declare function keyframes<Map extends Record<string, KeyframeFrameMap>>(map: Map): Keyframes<Map>;
|
|
45
|
+
//# sourceMappingURL=keyframes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyframes.d.ts","sourceRoot":"","sources":["../src/keyframes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,WAAW,CAAC,IAAI,SAAS,MAAM;IAC9C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,IAAI,MAAM,CAAC;IACnB,OAAO,IAAI,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI;IACpE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,EAAE,CAAC,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG;YAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;SACzB;KACF,CAAC;CACH,GAAG;IACF,QAAQ,EAAE,CAAC,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC;CACnD,CAAC;AA+CF,wBAAgB,SAAS,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACpE,GAAG,EAAE,GAAG,GACP,SAAS,CAAC,GAAG,CAAC,CAiBhB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createClassResolver — framework-agnostic className resolution.
|
|
3
|
+
*
|
|
4
|
+
* Produced by .asClass() terminal. Same resolution logic as createComponent
|
|
5
|
+
* (variants, states, compounds, system props) but returns a className string
|
|
6
|
+
* instead of a React element.
|
|
7
|
+
*/
|
|
8
|
+
import { type ClassResolverConfig, type DynamicPropConfig, type SystemPropMap } from './resolveClasses';
|
|
9
|
+
export declare function createClassResolver(className: string, config: ClassResolverConfig, systemPropMap?: SystemPropMap, dynamicPropConfig?: DynamicPropConfig): (props?: Record<string, unknown>) => string;
|
|
10
|
+
//# sourceMappingURL=createClassResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createClassResolver.d.ts","sourceRoot":"","sources":["../../src/runtime/createClassResolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAC3B,aAAa,CAAC,EAAE,aAAa,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAW7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createComposedFamily — extraction-time replacement for compose().
|
|
3
|
+
*
|
|
4
|
+
* The transform emitter replaces `compose({ Root, Body }, { shared, name })`
|
|
5
|
+
* with `createComposedFamily({ Root, Body }, { name })`.
|
|
6
|
+
*
|
|
7
|
+
* RSC-safe: uses only forwardRef and createElement — no createContext,
|
|
8
|
+
* no useContext, no hooks.
|
|
9
|
+
*/
|
|
10
|
+
import { type ForwardRefExoticComponent } from 'react';
|
|
11
|
+
interface ComposedFamilyConfig {
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createComposedFamily(slots: Record<string, ForwardRefExoticComponent<any>>, config: ComposedFamilyConfig): Record<string, ForwardRefExoticComponent<any>>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=createComposedFamily.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createComposedFamily.d.ts","sourceRoot":"","sources":["../../src/runtime/createComposedFamily.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,OAAO,CAAC;AAEf,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,EACrD,MAAM,EAAE,oBAAoB,GAC3B,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAiBhD"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
default?: string;
|
|
2
|
+
import { type ClassResolverConfig, type DynamicPropConfig, type SystemPropMap } from './resolveClasses';
|
|
3
|
+
interface ComponentConfig extends ClassResolverConfig {
|
|
5
4
|
}
|
|
6
|
-
interface ComponentConfig {
|
|
7
|
-
variants?: Record<string, VariantConfig>;
|
|
8
|
-
states?: string[];
|
|
9
|
-
systemPropNames?: string[];
|
|
10
|
-
customPropMap?: Record<string, Record<string, string>>;
|
|
11
|
-
customDynamicConfig?: DynamicPropConfig;
|
|
12
|
-
}
|
|
13
|
-
type SystemPropMap = Record<string, Record<string, string>>;
|
|
14
|
-
type DynamicPropConfig = Record<string, {
|
|
15
|
-
varName: string;
|
|
16
|
-
slotClass: string;
|
|
17
|
-
transformName?: string;
|
|
18
|
-
transform?: (value: string | number) => string | number;
|
|
19
|
-
scaleValues?: Record<string, string>;
|
|
20
|
-
}>;
|
|
21
5
|
type ElementType = string | React.ComponentType<any>;
|
|
22
6
|
type AnimusComponent = ReturnType<typeof forwardRef> & {
|
|
23
7
|
extend: () => never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,UAAU,EAEX,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,UAAU,eAAgB,SAAQ,mBAAmB;CAAG;AAIxD,KAAK,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAErD,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG;IACrD,MAAM,EAAE,MAAM,KAAK,CAAC;CACrB,CAAC;AAgBF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,EACvB,aAAa,CAAC,EAAE,aAAa,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,eAAe,CAkHjB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared className resolution logic used by both createComponent (React)
|
|
3
|
+
* and createClassResolver (framework-agnostic).
|
|
4
|
+
*
|
|
5
|
+
* Factored to ensure behavioral parity between .asElement() and .asClass() outputs.
|
|
6
|
+
*/
|
|
7
|
+
interface VariantConfig {
|
|
8
|
+
options: string[];
|
|
9
|
+
default?: string;
|
|
10
|
+
}
|
|
11
|
+
interface CompoundConfig {
|
|
12
|
+
conditions: Record<string, string | string[]>;
|
|
13
|
+
className: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ClassResolverConfig {
|
|
16
|
+
variants?: Record<string, VariantConfig>;
|
|
17
|
+
compounds?: CompoundConfig[];
|
|
18
|
+
states?: string[];
|
|
19
|
+
systemPropNames?: string[];
|
|
20
|
+
customPropMap?: Record<string, Record<string, string>>;
|
|
21
|
+
customDynamicConfig?: DynamicPropConfig;
|
|
22
|
+
}
|
|
23
|
+
export type SystemPropMap = Record<string, Record<string, string>>;
|
|
24
|
+
export type DynamicPropConfig = Record<string, {
|
|
25
|
+
varName: string;
|
|
26
|
+
slotClass: string;
|
|
27
|
+
transformName?: string;
|
|
28
|
+
transform?: (value: string | number) => string | number;
|
|
29
|
+
scaleValues?: Record<string, string>;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Apply unit fallback to a value for a given CSS property.
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyUnitFallback(value: string | number, cssProperty: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Serialize a system prop value to a lookup key matching the Rust
|
|
37
|
+
* css_generator's serialize_value_key output format.
|
|
38
|
+
*/
|
|
39
|
+
export declare function serializeValueKey(value: unknown): string;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a dynamic prop value through scale lookup → transform → unit fallback.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveValue(value: unknown, dc: {
|
|
44
|
+
varName: string;
|
|
45
|
+
transform?: (value: string | number) => string | number;
|
|
46
|
+
scaleValues?: Record<string, string>;
|
|
47
|
+
}): string;
|
|
48
|
+
export interface ClassResolution {
|
|
49
|
+
classes: string[];
|
|
50
|
+
dynamicStyle?: Record<string, string>;
|
|
51
|
+
activeStates: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolve className parts from props, using extracted configuration.
|
|
55
|
+
* This is the shared logic between createComponent and createClassResolver.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveClasses(baseClassName: string, props: Record<string, any>, config: ClassResolverConfig, systemPropMap?: SystemPropMap, dynamicPropConfig?: DynamicPropConfig): ClassResolution;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=resolveClasses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveClasses.d.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BAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWxD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EACd,EAAE,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,GAAG,MAAM,CAAC;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,GACA,MAAM,CAaR;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,aAAa,CAAC,EAAE,aAAa,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,eAAe,CAyGjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook-free runtime entry — safe for React Server Components.
|
|
3
|
+
*
|
|
4
|
+
* Extracted components import from this subpath instead of the barrel
|
|
5
|
+
* so they don't pull in compose() (which uses createContext/useContext).
|
|
6
|
+
*/
|
|
7
|
+
export { createComponent } from './runtime';
|
|
8
|
+
export { createClassResolver } from './runtime/createClassResolver';
|
|
9
|
+
export { createComposedFamily } from './runtime/createComposedFamily';
|
|
10
|
+
//# sourceMappingURL=runtime-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-entry.d.ts","sourceRoot":"","sources":["../src/runtime-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selector alias registry — maps `_`-prefixed alias keys to CSS selectors.
|
|
3
|
+
*
|
|
4
|
+
* Sort order determines cascade precedence within a layer:
|
|
5
|
+
* later entries override earlier ones when specificity is equal.
|
|
6
|
+
* The ordering follows CSS conventions (LVHA) and interaction semantics
|
|
7
|
+
* (disabled beats interaction states, pseudo-elements after states).
|
|
8
|
+
*/
|
|
9
|
+
export interface SelectorAlias {
|
|
10
|
+
/** CSS selector string (comma-separated for compound selectors) */
|
|
11
|
+
selector: string;
|
|
12
|
+
/** Sort index for cascade ordering within a layer */
|
|
13
|
+
order: number;
|
|
14
|
+
}
|
|
15
|
+
export type SelectorAliasMap = Record<string, SelectorAlias>;
|
|
16
|
+
/**
|
|
17
|
+
* Built-in selector aliases.
|
|
18
|
+
*
|
|
19
|
+
* Compound selectors (e.g. `_disabled`) target multiple CSS selectors
|
|
20
|
+
* via comma-separation to cover native, ARIA, and data attribute conventions.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILT_IN_SELECTORS: SelectorAliasMap;
|
|
23
|
+
/**
|
|
24
|
+
* Merge user-provided selectors with built-in defaults.
|
|
25
|
+
* User selectors override built-in aliases of the same name.
|
|
26
|
+
* New aliases get an order value based on their position (500+).
|
|
27
|
+
*/
|
|
28
|
+
export declare function mergeSelectors(base: SelectorAliasMap, custom: Record<string, string>): SelectorAliasMap;
|
|
29
|
+
/** Get the sorted alias keys for deterministic cascade ordering. */
|
|
30
|
+
export declare function getSortedAliasKeys(map: SelectorAliasMap): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Serialize the selector map for the extraction pipeline.
|
|
33
|
+
* Emits a flat `Record<string, string>` (alias → selector) plus
|
|
34
|
+
* the ordered key list for cascade determinism.
|
|
35
|
+
*/
|
|
36
|
+
export declare function serializeSelectorMap(map: SelectorAliasMap): {
|
|
37
|
+
selectors: Record<string, string>;
|
|
38
|
+
order: string[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAyDhC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,gBAAgB,CAgBlB;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAElE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG;IAC3D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAOA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/scales/createScale.ts
|
|
2
|
+
const createScale = () => [];
|
|
3
|
+
const numericScale = [];
|
|
4
|
+
const stringScale = [];
|
|
5
|
+
const numericOrStringScale = [];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/transforms/createTransform.ts
|
|
8
|
+
function createTransform(name, fn) {
|
|
9
|
+
const wrapper = (value, property, props) => fn(value, property, props);
|
|
10
|
+
Object.defineProperty(wrapper, "name", { value: name });
|
|
11
|
+
return Object.assign(wrapper, { transformName: name });
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/transforms/border.ts
|
|
15
|
+
/**
|
|
16
|
+
* Self-contained transform: all logic inlined in the callback.
|
|
17
|
+
* No external references — satisfies the extraction constraint.
|
|
18
|
+
*/
|
|
19
|
+
const borderShorthand = createTransform("borderShorthand", (val) => typeof val === "number" ? `${val}px solid currentColor` : val);
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/transforms/grid.ts
|
|
22
|
+
/**
|
|
23
|
+
* Self-contained transform: all logic inlined in the callback.
|
|
24
|
+
* No external references — satisfies the extraction constraint.
|
|
25
|
+
*/
|
|
26
|
+
const gridItem = createTransform("gridItem", (item) => {
|
|
27
|
+
const map = {
|
|
28
|
+
max: "max-content",
|
|
29
|
+
min: "min-content"
|
|
30
|
+
};
|
|
31
|
+
const strItem = String(item);
|
|
32
|
+
return `minmax(0, ${/^[0-9]*$/.test(strItem) ? `${strItem}fr` : map[strItem] ?? strItem})`;
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Convert a grid item value to a CSS template string.
|
|
36
|
+
* Exported for non-extraction use — NOT referenced from createTransform callbacks.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Self-contained transform: all logic inlined in the callback.
|
|
40
|
+
* Duplicates grid-item-to-template logic to avoid cross-transform reference.
|
|
41
|
+
*/
|
|
42
|
+
const gridItemRatio = createTransform("gridItemRatio", (val) => {
|
|
43
|
+
const toTemplate = (item) => {
|
|
44
|
+
return `minmax(0, ${/^[0-9]*$/.test(item) ? `${item}fr` : {
|
|
45
|
+
max: "max-content",
|
|
46
|
+
min: "min-content"
|
|
47
|
+
}[item] ?? item})`;
|
|
48
|
+
};
|
|
49
|
+
const repeat = (item, count) => {
|
|
50
|
+
const template = toTemplate(item);
|
|
51
|
+
return count > 1 ? `repeat(${count}, ${template})` : template;
|
|
52
|
+
};
|
|
53
|
+
if (typeof val === "number") return repeat("1", val);
|
|
54
|
+
const items = String(val).split(":");
|
|
55
|
+
let repeated = ["", 0];
|
|
56
|
+
let gridStyle = "";
|
|
57
|
+
for (let i = 0; i < items.length + 1; i += 1) {
|
|
58
|
+
const delimiter = gridStyle.length > 0 ? " " : "";
|
|
59
|
+
const curr = items[i];
|
|
60
|
+
if (repeated?.[0] !== curr) {
|
|
61
|
+
if (repeated[0].length) gridStyle += delimiter + repeat(repeated[0], repeated[1]);
|
|
62
|
+
if (curr) repeated = [curr, 1];
|
|
63
|
+
} else repeated[1] += 1;
|
|
64
|
+
}
|
|
65
|
+
return gridStyle;
|
|
66
|
+
});
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/transforms/size.ts
|
|
69
|
+
/**
|
|
70
|
+
* Convert a numeric coordinate to a CSS value.
|
|
71
|
+
* Exported for non-extraction use — NOT referenced from the createTransform callback.
|
|
72
|
+
*/
|
|
73
|
+
const percentageOrAbsolute = (coordinate) => {
|
|
74
|
+
if (coordinate === 0) return coordinate;
|
|
75
|
+
if (coordinate <= 1 && coordinate >= -1) return `${coordinate * 100}%`;
|
|
76
|
+
return `${coordinate}px`;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Self-contained transform: all logic inlined in the callback.
|
|
80
|
+
* No external references — satisfies the extraction constraint.
|
|
81
|
+
*/
|
|
82
|
+
const size = createTransform("size", (value) => {
|
|
83
|
+
const toSize = (n) => {
|
|
84
|
+
if (n === 0) return n;
|
|
85
|
+
if (n <= 1 && n >= -1) return `${n * 100}%`;
|
|
86
|
+
return `${n}px`;
|
|
87
|
+
};
|
|
88
|
+
if (typeof value === "number") return toSize(value);
|
|
89
|
+
const strValue = value;
|
|
90
|
+
if (strValue.includes("calc")) return strValue;
|
|
91
|
+
const [match, number, unit] = /(-?\d*\.?\d+)(%|\w*)/.exec(strValue) || [];
|
|
92
|
+
if (match === void 0) return strValue;
|
|
93
|
+
const numericValue = parseFloat(number);
|
|
94
|
+
return !unit ? toSize(numericValue) : `${numericValue}${unit}`;
|
|
95
|
+
});
|
|
96
|
+
//#endregion
|
|
97
|
+
export { borderShorthand as a, numericOrStringScale as c, gridItemRatio as i, numericScale as l, size as n, createTransform as o, gridItem as r, createScale as s, percentageOrAbsolute as t, stringScale as u };
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSColorValue, SerializedTheme, ThemeManifest } from '../types/theme';
|
|
2
2
|
import { LiteralPaths } from './flattenScale';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*/
|
|
49
|
-
updateScale<Key extends keyof T, Fn extends (tokens: T[Key]) => Record<string | number, unknown>>(key: Key, updateFn: Fn): ThemeBuilder<T & Record<Key, T[Key] & ReturnType<Fn>>>;
|
|
3
|
+
/** Flatten a type to prevent MergeTheme depth accumulation (TS2589). Exported for use in consumer themes. */
|
|
4
|
+
export type Flatten<T> = {
|
|
5
|
+
[K in keyof T]: T[K];
|
|
6
|
+
};
|
|
7
|
+
/** The built theme: nested raw data + non-enumerable boundary methods */
|
|
8
|
+
type BuiltTheme<T, Emitted extends string> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {
|
|
11
|
+
/** Phantom — tuple wrapper prevents never-distribution. Non-enumerable at runtime. */
|
|
12
|
+
readonly __emitted: [Emitted];
|
|
13
|
+
manifest: ThemeManifest;
|
|
14
|
+
serialize(): SerializedTheme;
|
|
15
|
+
/** Resolve a dot-path token to its var() reference. Runtime-validated against the manifest. */
|
|
16
|
+
varRef(tokenPath: string): string | undefined;
|
|
17
|
+
};
|
|
18
|
+
/** Shared runtime state passed between builder phases. */
|
|
19
|
+
interface BuilderState {
|
|
20
|
+
theme: Record<string, unknown>;
|
|
21
|
+
emittedScales: Set<string>;
|
|
22
|
+
contextualVars: Map<string, string[]>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ThemeScales — the final phase. Has addScale, extendScale, declareContextualVars, build.
|
|
26
|
+
* Also allows addColors and addColorModes for augmentation.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ThemeBuilder<T extends Record<string, unknown> = Record<string, unknown>, Emitted extends string = never> {
|
|
29
|
+
/** @internal */ _state: BuilderState;
|
|
30
|
+
constructor(state: BuilderState);
|
|
31
|
+
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_1 in keyof BP]: BP[K_1]; }>)[K]; }, Emitted>;
|
|
32
|
+
from<Source extends Record<string, unknown>>(builtTheme: Source): ThemeBuilder<T & Source, Emitted>;
|
|
33
|
+
addColors<Colors extends Record<string, CSSColorValue | Record<string, CSSColorValue>>, NextColors extends LiteralPaths<Colors, '.'> = LiteralPaths<Colors, '.'>>(colors: Colors): ThemeBuilder<{ [K in keyof (T & Record<"colors", NextColors>)]: (T & Record<"colors", NextColors>)[K]; }, "colors" | Emitted>;
|
|
34
|
+
addColorModes<Config extends Record<string, Record<string, unknown>>, AliasKeys extends LiteralPaths<Config[keyof Config], '.', '_'> = LiteralPaths<Config[keyof Config], '.', '_'>>(initialMode: string, modeConfig: Config): ThemeBuilder<{ [K in keyof (Omit<T, "colors"> & Record<"colors", (T extends {
|
|
35
|
+
colors: infer C;
|
|
36
|
+
} ? C : unknown) & AliasKeys>)]: (Omit<T, "colors"> & Record<"colors", (T extends {
|
|
37
|
+
colors: infer C;
|
|
38
|
+
} ? C : unknown) & AliasKeys>)[K]; }, Emitted>;
|
|
39
|
+
addScale<Key extends string, Values extends Record<string | number, string | number | Record<string, string | number>>, Emit extends boolean = false, NewScale extends LiteralPaths<Values, '.'> = LiteralPaths<Values, '.'>>(config: {
|
|
40
|
+
name: Key;
|
|
41
|
+
values: Values;
|
|
42
|
+
emit?: Emit;
|
|
43
|
+
}): ThemeBuilder<{ [K in keyof (T & Record<Key, NewScale>)]: (T & Record<Key, NewScale>)[K]; }, Emit extends true ? Emitted | Key : Emitted>;
|
|
44
|
+
declareContextualVars<const Vars extends Partial<{
|
|
45
|
+
[K in keyof T & string]: readonly string[];
|
|
46
|
+
}>>(vars: Vars): 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>;
|
|
47
|
+
extendScale<Key extends keyof T, Fn extends (tokens: T[Key]) => Record<string | number, unknown>>(key: Key, updateFn: Fn): ThemeBuilder<{ [K in keyof (T & Record<Key, T[Key] & ReturnType<Fn>>)]: (T & Record<Key, T[Key] & ReturnType<Fn>>)[K]; }, Emitted>;
|
|
50
48
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
49
|
+
* Finalize the theme build.
|
|
50
|
+
* Flattens nested data at the boundary — produces manifest and serialize().
|
|
53
51
|
*/
|
|
54
|
-
build():
|
|
55
|
-
[K in keyof (T & PrivateThemeKeys)]: (T & PrivateThemeKeys)[K];
|
|
56
|
-
};
|
|
52
|
+
build(): BuiltTheme<T, Emitted>;
|
|
57
53
|
}
|
|
58
|
-
|
|
54
|
+
type EmptyTheme = {
|
|
55
|
+
breakpoints: Record<string, number>;
|
|
56
|
+
};
|
|
57
|
+
export declare function createTheme(): ThemeBuilder<EmptyTheme, never>;
|
|
58
|
+
export {};
|
|
59
59
|
//# sourceMappingURL=createTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA0H9C,6GAA6G;AAC7G,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAElD,yEAAyE;AACzE,KAAK,UAAU,CAAC,CAAC,EAAE,OAAO,SAAS,MAAM,IAAI;KAC1C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GAAG;IACF,sFAAsF;IACtF,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,IAAI,eAAe,CAAC;IAC7B,+FAA+F;IAC/F,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC/C,CAAC;AAQF,0DAA0D;AAC1D,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,M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M,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAClD,EACD,IAAI,SAAS,OAAO,GAAG,KAAK,EAE5B,QAAQ,SAAS,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,EACtE,MAAM,EAAE;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,mBAMnC,CAAC,wHAMjB;IAED,qBAAqB,CACnB,KAAK,CAAC,IAAI,SAAS,OAAO,CAAC;SACxB,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE;KAC3C,CAAC,EACF,IAAI,EAAE,IAAI,mBAWP,CAAC,uJAkBL;IAED,WAAW,CACT,GAAG,SAAS,MAAM,CAAC,EACnB,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,mBAMP,CAAC,kHAEjB;IAED;;;OAGG;IACH,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CA6F9B;CACF;AAED,KAAK,UAAU,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAE1D,wBAAgB,WAAW,oCAE1B"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { createTheme, ThemeBuilder } from './createTheme';
|
|
2
2
|
export type { FindPath, LiteralPaths, Path, PathToLiteral, PathValue, } from './flattenScale';
|
|
3
|
-
export { flattenScale } from './flattenScale';
|
|
4
3
|
export type { KeyAsVariable, SanitizeKey } from './serializeTokens';
|
|
5
|
-
export { serializeTokens } from './serializeTokens';
|
|
6
4
|
export type { Assign, AssignValueIfUnmergable, ColorModeConfig, Mergable, Merge, MergeTheme, PrivateThemeKeys, } from './types';
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,YAAY,EACV,MAAM,EACN,uBAAuB,EACvB,eAAe,EACf,QAAQ,EACR,KAAK,EACL,UAAU,EACV,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BaseTheme, CSSObject } from '../types/theme';
|
|
2
1
|
/**
|
|
3
2
|
* Returns an type of any object with { key: 'var(--key) }
|
|
4
3
|
*/
|
|
@@ -6,17 +5,4 @@ export type KeyAsVariable<T extends Record<string, any>, Prefix extends string>
|
|
|
6
5
|
[V in keyof T]: `var(--${Prefix}-${SanitizeKey<Extract<V, string>>})`;
|
|
7
6
|
};
|
|
8
7
|
export type SanitizeKey<T extends string> = T extends `${'$'}${infer Y}` ? Y : T;
|
|
9
|
-
type ThemeWithBreakpoints = BaseTheme | {
|
|
10
|
-
breakpoints: Record<string, string | number>;
|
|
11
|
-
};
|
|
12
|
-
type SerializedTokensInput = Record<string, string | number | CSSObject | SerializedTokensInputRecursive>;
|
|
13
|
-
interface SerializedTokensInputRecursive {
|
|
14
|
-
[i: number]: SerializedTokensInput;
|
|
15
|
-
[i: string]: SerializedTokensInput;
|
|
16
|
-
}
|
|
17
|
-
export declare const serializeTokens: <T extends SerializedTokensInput, Prefix extends string>(tokens: T, prefix: Prefix, theme: ThemeWithBreakpoints | undefined) => {
|
|
18
|
-
tokens: KeyAsVariable<T, Prefix>;
|
|
19
|
-
variables: CSSObject;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
22
8
|
//# sourceMappingURL=serializeTokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializeTokens.d.ts","sourceRoot":"","sources":["../../src/theme/serializeTokens.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializeTokens.d.ts","sourceRoot":"","sources":["../../src/theme/serializeTokens.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,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/utils.d.ts
CHANGED
|
@@ -4,9 +4,25 @@ export declare function isObject(value: unknown): value is object;
|
|
|
4
4
|
export declare function merge<A, B>(target: A, source: B): A & B;
|
|
5
5
|
export declare function merge<A, B, C>(target: A, s1: B, s2: C): A & B & C;
|
|
6
6
|
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
|
+
export declare function walkDotPath(obj: Record<string, unknown>, path: string): unknown;
|
|
13
|
+
/**
|
|
14
|
+
* Flatten a nested object into a flat Record with dot-path keys.
|
|
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).
|
|
19
|
+
*/
|
|
20
|
+
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
|
+
export declare function dotToDash(dotPath: string): string;
|
|
7
27
|
/** Map over object values — matches lodash.mapValues overload signatures */
|
|
8
|
-
export declare function mapValues<T extends object, TResult>(obj: T, fn: (value: T[keyof T], key: string, collection: T) => TResult): {
|
|
9
|
-
[P in keyof T]: TResult;
|
|
10
|
-
};
|
|
11
|
-
export declare function mapValues<TResult>(obj: Record<string, any>, fn: (value: any, key: string) => TResult): Record<string, TResult>;
|
|
12
28
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/theme/utils.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED,4DAA4D;A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ACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAQT;AAED;;;;;;GAMG;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;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,4EAA4E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/transforms/border.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/transforms/border.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,eAAe,4CAE3B,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AbstractProps } from '../types/props';
|
|
2
|
+
import type { CSSObject } from '../types/shared';
|
|
3
|
+
export type TransformFn = (value: string | number, property?: string, props?: AbstractProps) => string | number | CSSObject;
|
|
2
4
|
export type NamedTransform = TransformFn & {
|
|
3
5
|
transformName: string;
|
|
4
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransform.d.ts","sourceRoot":"","sources":["../../src/transforms/createTransform.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CACxB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,
|
|
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,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;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,cAAc,CAK7E"}
|