@animus-ui/system 0.1.0-next.21 → 0.1.0-next.30
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/Animus.d.ts +2 -7
- package/dist/Animus.d.ts.map +1 -1
- package/dist/AnimusExtended.d.ts +2 -7
- package/dist/AnimusExtended.d.ts.map +1 -1
- package/dist/SystemBuilder.d.ts +16 -13
- package/dist/SystemBuilder.d.ts.map +1 -1
- package/dist/compose.d.ts +2 -4
- package/dist/compose.d.ts.map +1 -1
- package/dist/createClassResolver-Dny76K15.js +227 -0
- package/dist/groups/index.d.ts +1 -0
- package/dist/groups/index.d.ts.map +1 -1
- package/dist/groups/index.js +3 -2
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +339 -527
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime-entry.d.ts +9 -0
- package/dist/runtime-entry.d.ts.map +1 -0
- package/dist/runtime-entry.js +2 -0
- package/dist/theme/createTheme.d.ts +46 -53
- 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 +2 -2
- package/dist/theme/serializeTokens.d.ts.map +1 -1
- package/dist/theme/utils.d.ts +20 -0
- package/dist/theme/utils.d.ts.map +1 -1
- package/dist/types/component.d.ts +45 -26
- package/dist/types/component.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -2
- package/dist/types/config.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 +38 -19
- 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 +6 -1
- package/dist/PropertyBuilder.d.ts +0 -11
- package/dist/PropertyBuilder.d.ts.map +0 -1
- /package/dist/{size-Dge_rsuz.js → size-BjymBo7z.js} +0 -0
package/dist/types/theme.d.ts
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import type { LiteralPaths } from '../theme/flattenScale';
|
|
2
2
|
export type { CSSObject } from './shared';
|
|
3
|
-
export interface Breakpoints<T = number> {
|
|
4
|
-
xs: T;
|
|
5
|
-
sm: T;
|
|
6
|
-
md: T;
|
|
7
|
-
lg: T;
|
|
8
|
-
xl: T;
|
|
9
|
-
}
|
|
10
3
|
export interface BaseTheme {
|
|
11
|
-
breakpoints: Breakpoints;
|
|
12
4
|
}
|
|
13
5
|
export interface AbstractTheme extends BaseTheme {
|
|
6
|
+
breakpoints: Record<string, number>;
|
|
14
7
|
readonly [key: string]: any;
|
|
15
8
|
}
|
|
16
9
|
/**
|
|
17
|
-
* Filter
|
|
18
|
-
*
|
|
10
|
+
* Filter non-scale keys from T so only user-defined scales appear.
|
|
11
|
+
* breakpoints, modes, mode are structural — not token scales.
|
|
19
12
|
*/
|
|
20
|
-
export type TokenScales<T> = Omit<T, '
|
|
13
|
+
export type TokenScales<T> = Omit<T, 'breakpoints' | 'modes' | 'mode'>;
|
|
21
14
|
/**
|
|
22
15
|
* Augmentable Theme interface. Consumers extend this via module augmentation
|
|
23
16
|
* to get type-safe scale lookups in .styles(), .variant(), and .states():
|
|
@@ -31,6 +24,10 @@ export type TokenScales<T> = Omit<T, '_variables' | '_tokens' | 'mode' | '_getCo
|
|
|
31
24
|
* When augmented, CSS object values like `fontSize` become constrained to
|
|
32
25
|
* the theme's scale keys (e.g. `11 | 12 | 13 | 14 | 16 | ...`).
|
|
33
26
|
* When NOT augmented, values fall back to standard CSS property types.
|
|
27
|
+
*
|
|
28
|
+
* BaseTheme uses an open index signature so that module augmentation can
|
|
29
|
+
* provide a concrete breakpoints type (e.g. `{ sm: number; lg: number }`)
|
|
30
|
+
* without conflicting with a fixed Breakpoints interface.
|
|
34
31
|
*/
|
|
35
32
|
export interface Theme extends BaseTheme {
|
|
36
33
|
}
|
|
@@ -41,17 +38,15 @@ export interface Theme extends BaseTheme {
|
|
|
41
38
|
*/
|
|
42
39
|
export 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 & {});
|
|
43
40
|
/**
|
|
44
|
-
* Extract scale names from a built theme
|
|
45
|
-
*
|
|
41
|
+
* Extract scale names from a built theme that were emitted with CSS variables.
|
|
42
|
+
* With nested storage, emitted scales are tracked by the builder's Emitted type param.
|
|
43
|
+
* This heuristic checks for 'colors' (always emitted) and scales with var() values
|
|
44
|
+
* for backward compatibility with augmented Theme interfaces.
|
|
46
45
|
*
|
|
47
|
-
*
|
|
48
|
-
* ```ts
|
|
49
|
-
* type Emitted = Pick<TokenScales<T>, EmittedScales<T>>;
|
|
50
|
-
* type Static = Omit<TokenScales<T>, EmittedScales<T>>;
|
|
51
|
-
* ```
|
|
46
|
+
* TODO: Thread Emitted type param through the built theme type for precise detection.
|
|
52
47
|
*/
|
|
53
48
|
export type EmittedScales<T> = {
|
|
54
|
-
[K in keyof TokenScales<T>]: TokenScales<T>[K] extends Record<string, `var(--${string})`> ? K : never;
|
|
49
|
+
[K in keyof TokenScales<T>]: K extends 'colors' ? K : TokenScales<T>[K] extends Record<string, `var(--${string})`> ? K : never;
|
|
55
50
|
}[keyof TokenScales<T>];
|
|
56
51
|
/**
|
|
57
52
|
* All valid token ref paths for emitted scales in a theme.
|
|
@@ -68,6 +63,28 @@ export type EmittedTokenPaths<T> = keyof LiteralPaths<Pick<TokenScales<T>, Emitt
|
|
|
68
63
|
* Constrains the scale name portion of `{scale.key}` to only emitted scales.
|
|
69
64
|
*/
|
|
70
65
|
export type ScaleTokenRef<E extends string> = `${string}{${E}.${string}}${string}`;
|
|
66
|
+
/**
|
|
67
|
+
* Token ref union for color-scale values, computed from the augmented Theme.
|
|
68
|
+
* Accepts `{colors.key}` and `{colors.key/alpha}` patterns.
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const ref: ColorTokenRef = '{colors.primary/50}'; // ✓
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export type ColorTokenRef = Theme extends {
|
|
75
|
+
colors: infer C;
|
|
76
|
+
} ? C extends Record<string, unknown> ? `{colors.${Extract<keyof C, string>}}` | `{colors.${Extract<keyof C, string>}/${number}}` : never : never;
|
|
77
|
+
/** Pipeline-ready JSON strings returned by `.serialize()` on a built theme. */
|
|
78
|
+
export interface SerializedTheme {
|
|
79
|
+
/** Flattened token map as JSON: { "space.8": "0.5rem", "breakpoints.sm": "768" } */
|
|
80
|
+
scalesJson: string;
|
|
81
|
+
/** Token path → CSS variable name as JSON: { "colors.primary": "--colors-primary" } */
|
|
82
|
+
variableMapJson: string;
|
|
83
|
+
/** Pre-built CSS string with :root and [data-color-mode] blocks */
|
|
84
|
+
variableCss: string;
|
|
85
|
+
/** Contextual vars registry as JSON: { "colors": ["background-current"] } */
|
|
86
|
+
contextualVarsJson: string;
|
|
87
|
+
}
|
|
71
88
|
/** Structured manifest emitted by ThemeBuilder.build() for plugin consumption. */
|
|
72
89
|
export interface ThemeManifest {
|
|
73
90
|
/** Flat token key → raw value (e.g. 'space.8' → '0.5rem', 'colors.ember' → '#FF2800') */
|
|
@@ -78,5 +95,7 @@ export interface ThemeManifest {
|
|
|
78
95
|
modes: Record<string, Record<string, string>>;
|
|
79
96
|
/** Pre-built CSS string with :root and [data-color-mode] blocks */
|
|
80
97
|
variableCss: string;
|
|
98
|
+
/** Contextual vars registry: scale_name → [var_name] for --current-{name} side-effects */
|
|
99
|
+
contextualVars?: Record<string, string[]>;
|
|
81
100
|
}
|
|
82
101
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/utils/deepMerge.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAiB7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/system",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.30",
|
|
4
4
|
"description": "Animus design system builder — tokens, prop groups, global styles",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"./groups": {
|
|
17
17
|
"types": "./dist/groups/index.d.ts",
|
|
18
18
|
"import": "./dist/groups/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./runtime": {
|
|
21
|
+
"types": "./dist/runtime-entry.d.ts",
|
|
22
|
+
"import": "./dist/runtime-entry.js",
|
|
23
|
+
"default": "./dist/runtime-entry.js"
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"files": [
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Prop } from './types/config';
|
|
2
|
-
export declare class PropertyBuilder<PropReg extends Record<string, Prop> = {}, GroupReg extends Record<string, (keyof PropReg)[]> = {}> {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(props?: PropReg, groups?: GroupReg);
|
|
5
|
-
addGroup<Name extends string, Conf extends Record<string, Prop>, PropNames extends keyof Conf>(name: Name, config: Conf): PropertyBuilder<PropReg & Conf, GroupReg & Record<Name, PropNames[]>>;
|
|
6
|
-
build(): {
|
|
7
|
-
propRegistry: { [K in keyof PropReg]: PropReg[K]; };
|
|
8
|
-
groupRegistry: { [K in keyof GroupReg]: GroupReg[K]; };
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=PropertyBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyBuilder.d.ts","sourceRoot":"","sources":["../src/PropertyBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,qBAAa,eAAe,CAC1B,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,EACzC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE;;gBAK3C,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ;IAK9C,QAAQ,CACN,IAAI,SAAS,MAAM,EACnB,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACjC,SAAS,SAAS,MAAM,IAAI,EAC5B,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI;IAW1B,KAAK;sBAE4B,GAAG,CAAC,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAE;uBAClC,GAAG,CAAC,IAAI,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAE;;CAG1E"}
|
|
File without changes
|