@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
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# @animus-ui/system
|
|
2
|
+
|
|
3
|
+
Design system builder for React. Type-driven CSS-in-JS with zero runtime — styles extract to static CSS at build time.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @animus-ui/system
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Pair with a bundler plugin for extraction:
|
|
12
|
+
|
|
13
|
+
- [`@animus-ui/vite-plugin`](https://github.com/codecaaron/animus/tree/main/packages/vite-plugin) for Vite
|
|
14
|
+
- [`@animus-ui/next-plugin`](https://github.com/codecaaron/animus/tree/main/packages/next-plugin) for Next.js
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### 1. Define tokens
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { createTheme } from '@animus-ui/system';
|
|
22
|
+
|
|
23
|
+
const tokens = createTheme()
|
|
24
|
+
.addBreakpoints({ sm: 480, md: 768, lg: 1024 })
|
|
25
|
+
.addColors({
|
|
26
|
+
gray: { 100: '#f0f0f0', 800: '#1a1a1a' },
|
|
27
|
+
blue: { 400: '#3d94ff', 700: '#003d99' },
|
|
28
|
+
})
|
|
29
|
+
.addColorModes('dark', {
|
|
30
|
+
dark: { primary: 'blue.400', bg: 'gray.800', text: 'gray.100' },
|
|
31
|
+
light: { primary: 'blue.700', bg: 'gray.100', text: 'gray.800' },
|
|
32
|
+
})
|
|
33
|
+
.addScale({ name: 'space', values: { sm: '0.5rem', md: '1rem', lg: '1.5rem' } })
|
|
34
|
+
.build();
|
|
35
|
+
|
|
36
|
+
declare module '@animus-ui/system' {
|
|
37
|
+
interface Theme extends typeof tokens {}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Create system with prop groups
|
|
42
|
+
|
|
43
|
+
Pre-built groups ship with the package. Compose them into your own semantic groups:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { createSystem } from '@animus-ui/system';
|
|
47
|
+
import {
|
|
48
|
+
space,
|
|
49
|
+
color,
|
|
50
|
+
typography,
|
|
51
|
+
border,
|
|
52
|
+
shadows,
|
|
53
|
+
background,
|
|
54
|
+
flex,
|
|
55
|
+
layout,
|
|
56
|
+
} from '@animus-ui/system/groups';
|
|
57
|
+
|
|
58
|
+
export const { system: ds, createGlobalStyles } = createSystem()
|
|
59
|
+
.addGroup('surface', { ...color, ...border, ...shadows, ...background })
|
|
60
|
+
.addGroup('space', space)
|
|
61
|
+
.addGroup('text', typography)
|
|
62
|
+
.addGroup('arrange', { ...flex, ...layout })
|
|
63
|
+
.build();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Each group becomes an opt-in set of props that components can enable via `.system()`:
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
const Box = ds
|
|
70
|
+
.styles({})
|
|
71
|
+
.system({ surface: true, space: true })
|
|
72
|
+
.asElement('div');
|
|
73
|
+
|
|
74
|
+
// Box now accepts: color, bg, border, shadow, p, m, gap, etc.
|
|
75
|
+
<Box bg="surface" p="md" borderBottom="1" />;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Build components
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
export const Alert = ds
|
|
82
|
+
.styles({
|
|
83
|
+
display: 'flex',
|
|
84
|
+
alignItems: 'flex-start',
|
|
85
|
+
p: 12,
|
|
86
|
+
borderRadius: '4px',
|
|
87
|
+
fontSize: 14,
|
|
88
|
+
lineHeight: '1.5',
|
|
89
|
+
})
|
|
90
|
+
.variant({
|
|
91
|
+
prop: 'variant',
|
|
92
|
+
variants: {
|
|
93
|
+
filled: { color: 'background' },
|
|
94
|
+
outline: { bg: 'transparent', borderWidth: '1px', borderStyle: 'solid' },
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
.variant({
|
|
98
|
+
prop: 'intent',
|
|
99
|
+
variants: {
|
|
100
|
+
info: { bg: 'primary' },
|
|
101
|
+
danger: { bg: 'danger' },
|
|
102
|
+
success: { bg: 'secondary' },
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
.compound(
|
|
106
|
+
{ variant: 'outline', intent: 'info' },
|
|
107
|
+
{ borderColor: 'primary', color: 'primary' }
|
|
108
|
+
)
|
|
109
|
+
.compound(
|
|
110
|
+
{ variant: 'outline', intent: 'danger' },
|
|
111
|
+
{ borderColor: 'danger', color: 'danger' }
|
|
112
|
+
)
|
|
113
|
+
.compound(
|
|
114
|
+
{ variant: 'outline', intent: 'success' },
|
|
115
|
+
{ borderColor: 'secondary', color: 'secondary' }
|
|
116
|
+
)
|
|
117
|
+
.surface({ space: true })
|
|
118
|
+
.asElement('div');
|
|
119
|
+
|
|
120
|
+
<Alert variant="filled" intent="success" m={8} disabled />;
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Builder Chain
|
|
124
|
+
|
|
125
|
+
The chain enforces cascade ordering — each method maps to a CSS `@layer`:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
ds.styles() → @layer base
|
|
129
|
+
.variant() → @layer variants
|
|
130
|
+
.compound() → @layer compounds
|
|
131
|
+
.states() → @layer states
|
|
132
|
+
.system() → @layer system
|
|
133
|
+
.props() → @layer custom
|
|
134
|
+
.asElement() → typed React component
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The type system prevents calling methods out of order. `.variant()` after `.states()` is a type error.
|
|
138
|
+
|
|
139
|
+
## Exports
|
|
140
|
+
|
|
141
|
+
| Path | What's in it |
|
|
142
|
+
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
143
|
+
| `@animus-ui/system` | Full API — builder, theme, runtime, types |
|
|
144
|
+
| `@animus-ui/system/groups` | Pre-built prop groups: `space`, `color`, `typography`, `layout`, `flex`, `grid`, `border`, `shadows`, `background`, `positioning`, `transitions` |
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
MIT
|
package/dist/Animus.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { AnimusExtended } from './AnimusExtended';
|
|
2
|
+
import { AbstractParser, CompoundEntry, CSSPropMap, CSSProps, CustomPropConfig, Prop, SystemProps, ThemedCSSPropMap, ThemedCSSProps, VariantConfig } from './types/config';
|
|
3
|
+
import { AbstractProps } from './types/props';
|
|
2
4
|
import type { AnimusComponent, AnimusWrappedComponent } from './types/component';
|
|
3
|
-
|
|
4
|
-
import { AbstractProps, ThemeProps } from './types/props';
|
|
5
|
-
import { CSSObject } from './types/shared';
|
|
6
|
-
import { BaseTheme } from './types/theme';
|
|
7
|
-
export declare class AnimusWithAll<T extends BaseTheme, PropRegistry extends Record<string, Prop>, 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, Prop>> {
|
|
5
|
+
export declare class AnimusWithAll<PropRegistry extends Record<string, Prop>, 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, Prop>> {
|
|
8
6
|
propRegistry: PropRegistry;
|
|
9
7
|
groupRegistry: GroupRegistry;
|
|
10
8
|
baseStyles: BaseStyles;
|
|
@@ -12,15 +10,14 @@ export declare class AnimusWithAll<T extends BaseTheme, PropRegistry extends Rec
|
|
|
12
10
|
variants: Variants;
|
|
13
11
|
activeGroups: ActiveGroups;
|
|
14
12
|
custom: CustomProps;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
compounds: CompoundEntry[];
|
|
14
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps, compounds?: CompoundEntry[]);
|
|
15
|
+
extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
16
|
+
asElement<El extends keyof JSX.IntrinsicElements>(component: El): AnimusComponent<El, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
18
17
|
asComponent<C extends (props: {
|
|
19
18
|
className?: string;
|
|
20
|
-
}) => any>(AsComponent: C): AnimusWrappedComponent<
|
|
21
|
-
|
|
22
|
-
extend: () => AnimusExtended<T, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
23
|
-
};
|
|
19
|
+
}) => any>(AsComponent: C): AnimusWrappedComponent<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
20
|
+
asClass(): (props?: Record<string, unknown>) => string;
|
|
24
21
|
_buildComponentConfig(): {
|
|
25
22
|
variants: Record<string, {
|
|
26
23
|
options: string[];
|
|
@@ -30,46 +27,55 @@ export declare class AnimusWithAll<T extends BaseTheme, PropRegistry extends Rec
|
|
|
30
27
|
systemPropNames: string[];
|
|
31
28
|
};
|
|
32
29
|
}
|
|
33
|
-
declare class AnimusWithSystem<
|
|
34
|
-
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups);
|
|
35
|
-
props<NewCustomProps extends Record<string,
|
|
30
|
+
declare class AnimusWithSystem<PropRegistry extends Record<string, Prop>, 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>> extends AnimusWithAll<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, {}> {
|
|
31
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, compounds?: CompoundEntry[]);
|
|
32
|
+
props<NewCustomProps extends Record<string, CustomPropConfig>>(config: NewCustomProps): AnimusWithAll<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, NewCustomProps>;
|
|
33
|
+
}
|
|
34
|
+
declare class AnimusWithStates<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<AbstractParser>>> extends AnimusWithSystem<PropRegistry, GroupRegistry, BaseStyles, Variants, States, {}> {
|
|
35
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, compounds?: CompoundEntry[]);
|
|
36
|
+
system<PickedKeys extends keyof GroupRegistry | Extract<keyof PropRegistry, string>>(config: Record<PickedKeys, true>): AnimusWithSystem<PropRegistry, GroupRegistry, BaseStyles, Variants, States, Record<PickedKeys, true>>;
|
|
36
37
|
}
|
|
37
|
-
declare class
|
|
38
|
-
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants,
|
|
39
|
-
|
|
38
|
+
declare class AnimusWithCompounds<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>> extends AnimusWithStates<PropRegistry, GroupRegistry, BaseStyles, Variants, {}> {
|
|
39
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, compounds?: CompoundEntry[]);
|
|
40
|
+
compound<Props extends AbstractProps>(condition: {
|
|
41
|
+
[K in keyof Variants]?: keyof Variants[K]['variants'] | ReadonlyArray<keyof Variants[K]['variants']>;
|
|
42
|
+
}, styles: ThemedCSSProps<Props, PropRegistry>): AnimusWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants>;
|
|
43
|
+
states<Props extends AbstractProps>(config: ThemedCSSPropMap<Props, PropRegistry>): AnimusWithStates<PropRegistry, GroupRegistry, BaseStyles, Variants, ThemedCSSPropMap<Props, PropRegistry>>;
|
|
40
44
|
}
|
|
41
|
-
declare class AnimusWithVariants<
|
|
42
|
-
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants);
|
|
43
|
-
|
|
45
|
+
declare class AnimusWithVariants<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>, Variants extends Record<string, VariantConfig>> extends AnimusWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants> {
|
|
46
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, compounds?: CompoundEntry[]);
|
|
47
|
+
compound<Props extends AbstractProps>(condition: {
|
|
48
|
+
[K in keyof Variants]?: keyof Variants[K]['variants'] | ReadonlyArray<keyof Variants[K]['variants']>;
|
|
49
|
+
}, styles: ThemedCSSProps<Props, PropRegistry>): AnimusWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants>;
|
|
44
50
|
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
45
51
|
prop?: PropKey;
|
|
46
|
-
defaultVariant?: keyof Props
|
|
52
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
47
53
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
48
54
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
49
|
-
}): AnimusWithVariants<
|
|
55
|
+
}): AnimusWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants & Record<PropKey, {
|
|
50
56
|
prop?: PropKey;
|
|
51
|
-
defaultVariant?: keyof Props
|
|
57
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
52
58
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
53
59
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
54
60
|
}>>;
|
|
55
61
|
}
|
|
56
|
-
declare class AnimusWithBase<
|
|
62
|
+
declare class AnimusWithBase<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseStyles extends CSSProps<AbstractProps, SystemProps<AbstractParser>>> extends AnimusWithVariants<PropRegistry, GroupRegistry, BaseStyles, {}> {
|
|
57
63
|
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles);
|
|
58
64
|
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
59
65
|
prop?: PropKey;
|
|
60
|
-
defaultVariant?: keyof Props
|
|
66
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
61
67
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
62
68
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
63
|
-
}): AnimusWithVariants<
|
|
69
|
+
}): AnimusWithVariants<PropRegistry, GroupRegistry, BaseStyles, Record<PropKey, {
|
|
64
70
|
prop?: PropKey;
|
|
65
|
-
defaultVariant?: keyof Props
|
|
71
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
66
72
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
67
73
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
68
74
|
}>>;
|
|
69
75
|
}
|
|
70
|
-
export declare class Animus<
|
|
76
|
+
export declare class Animus<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>> extends AnimusWithBase<PropRegistry, GroupRegistry, {}> {
|
|
71
77
|
constructor(props: PropRegistry, groups: GroupRegistry);
|
|
72
|
-
styles<Props extends AbstractProps>(config: ThemedCSSProps<Props, PropRegistry>): AnimusWithBase<
|
|
78
|
+
styles<Props extends AbstractProps>(config: ThemedCSSProps<Props, PropRegistry>): AnimusWithBase<PropRegistry, GroupRegistry, ThemedCSSProps<Props, PropRegistry>>;
|
|
73
79
|
}
|
|
74
80
|
export {};
|
|
75
81
|
//# sourceMappingURL=Animus.d.ts.map
|
package/dist/Animus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animus.d.ts","sourceRoot":"","sources":["../src/Animus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Animus.d.ts","sourceRoot":"","s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AAE,IAAI,EAAE,UAAU,EAEvE;IAED,OAAO,CACL,IAAI,SAAS,MAAM,KAAK,EACxB,IAAI,SAAS,aAAa,EAC1B,KAAK,SAAS,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,EACzC,OAAO,SAAS,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,EAC5C,OAAO,EAAE;QACT,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,cAAc,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC,CAAC;QAC9C,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC1C,QAAQ,EAAE,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;KACjD;eAJQ,OAAO;yBACG,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC;eACtC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC;kBAC/B,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC;QAiBhD;CACF;AAED,qBAAa,MAAM,CACjB,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,CAC5D,SAAQ,cAAc,CAAC,YAAY,EAAE,aAAa,EAAE,EAAE,CAAC;IACvD,YAAY,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAErD;IACD,MAAM,CAAC,KAAK,SAAS,aAAa,EAChC,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,oFAO5C;CACF"}
|
package/dist/AnimusExtended.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { AbstractParser, CompoundEntry, CSSPropMap, CSSProps, CustomPropConfig, Prop, SystemProps, ThemedCSSPropMap, ThemedCSSProps, VariantConfig } from './types/config';
|
|
2
|
+
import { AbstractProps } from './types/props';
|
|
1
3
|
import type { AnimusComponent, AnimusWrappedComponent } from './types/component';
|
|
2
|
-
|
|
3
|
-
import { AbstractProps, ThemeProps } from './types/props';
|
|
4
|
-
import { CSSObject } from './types/shared';
|
|
5
|
-
import { BaseTheme } from './types/theme';
|
|
6
|
-
export declare class AnimusExtendedWithAll<T extends BaseTheme, PropRegistry extends Record<string, Prop>, 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, Prop>> {
|
|
4
|
+
export declare class AnimusExtendedWithAll<PropRegistry extends Record<string, Prop>, 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, Prop>> {
|
|
7
5
|
propRegistry: PropRegistry;
|
|
8
6
|
groupRegistry: GroupRegistry;
|
|
9
7
|
baseStyles: BaseStyles;
|
|
@@ -11,15 +9,14 @@ export declare class AnimusExtendedWithAll<T extends BaseTheme, PropRegistry ext
|
|
|
11
9
|
variants: Variants;
|
|
12
10
|
activeGroups: ActiveGroups;
|
|
13
11
|
custom: CustomProps;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
compounds: CompoundEntry[];
|
|
13
|
+
constructor(props: PropRegistry, groups: GroupRegistry, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps, compounds?: CompoundEntry[]);
|
|
14
|
+
extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
15
|
+
asElement<El extends keyof JSX.IntrinsicElements>(component: El): AnimusComponent<El, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
17
16
|
asComponent<C extends (props: {
|
|
18
17
|
className?: string;
|
|
19
|
-
}) => any>(AsComponent: C): AnimusWrappedComponent<
|
|
20
|
-
|
|
21
|
-
extend: () => AnimusExtended<T, PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
22
|
-
};
|
|
18
|
+
}) => any>(AsComponent: C): AnimusWrappedComponent<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
19
|
+
asClass(): (props?: Record<string, unknown>) => string;
|
|
23
20
|
_buildComponentConfig(): {
|
|
24
21
|
variants: Record<string, {
|
|
25
22
|
options: string[];
|
|
@@ -29,41 +26,49 @@ export declare class AnimusExtendedWithAll<T extends BaseTheme, PropRegistry ext
|
|
|
29
26
|
systemPropNames: string[];
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
|
-
declare class AnimusExtendedWithSystem<
|
|
33
|
-
props<NewCustomProps extends Record<string,
|
|
29
|
+
declare class AnimusExtendedWithSystem<PropRegistry extends Record<string, Prop>, 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, Prop>> extends AnimusExtendedWithAll<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
30
|
+
props<NewCustomProps extends Record<string, CustomPropConfig>>(config: NewCustomProps): AnimusExtendedWithAll<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, NewCustomProps>;
|
|
31
|
+
}
|
|
32
|
+
declare class AnimusExtendedWithStates<PropRegistry extends Record<string, Prop>, 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, Prop>> extends AnimusExtendedWithSystem<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
33
|
+
system<PickedKeys extends keyof GroupRegistry | Extract<keyof PropRegistry, string>>(config: Record<PickedKeys, true>): AnimusExtendedWithSystem<PropRegistry, GroupRegistry, BaseStyles, Variants, States, Record<PickedKeys, true> & ActiveGroups, CustomProps>;
|
|
34
34
|
}
|
|
35
|
-
declare class
|
|
36
|
-
|
|
35
|
+
declare class AnimusExtendedWithCompounds<PropRegistry extends Record<string, Prop>, 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, Prop>> extends AnimusExtendedWithStates<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
36
|
+
compound<Props extends AbstractProps>(condition: {
|
|
37
|
+
[K in keyof Variants]?: keyof Variants[K]['variants'] | ReadonlyArray<keyof Variants[K]['variants']>;
|
|
38
|
+
}, styles: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
39
|
+
states<Props extends AbstractProps>(config: ThemedCSSPropMap<Props, PropRegistry>): AnimusExtendedWithStates<PropRegistry, GroupRegistry, BaseStyles, Variants, ThemedCSSPropMap<Props, PropRegistry> & States, ActiveGroups, CustomProps>;
|
|
37
40
|
}
|
|
38
|
-
declare class AnimusExtendedWithVariants<
|
|
41
|
+
declare class AnimusExtendedWithVariants<PropRegistry extends Record<string, Prop>, 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, Prop>> extends AnimusExtendedWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
42
|
+
compound<Props extends AbstractProps>(condition: {
|
|
43
|
+
[K in keyof Variants]?: keyof Variants[K]['variants'] | ReadonlyArray<keyof Variants[K]['variants']>;
|
|
44
|
+
}, styles: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithCompounds<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
39
45
|
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
40
46
|
prop?: PropKey;
|
|
41
|
-
defaultVariant?: keyof Props
|
|
47
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
42
48
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
43
49
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
44
|
-
}): AnimusExtendedWithVariants<
|
|
50
|
+
}): AnimusExtendedWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants & Record<PropKey, {
|
|
45
51
|
prop?: PropKey;
|
|
46
|
-
defaultVariant?: keyof Props
|
|
52
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
47
53
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
48
54
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
49
55
|
}>, States, ActiveGroups, CustomProps>;
|
|
50
|
-
states<Props extends AbstractProps>(config: ThemedCSSPropMap<Props, PropRegistry>): AnimusExtendedWithStates<T, PropRegistry, GroupRegistry, BaseStyles, Variants, ThemedCSSPropMap<Props, PropRegistry> & States, ActiveGroups, CustomProps>;
|
|
51
56
|
}
|
|
52
|
-
declare class AnimusExtendedWithBase<
|
|
57
|
+
declare class AnimusExtendedWithBase<PropRegistry extends Record<string, Prop>, 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, Prop>> extends AnimusExtendedWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
53
58
|
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
54
59
|
prop?: PropKey;
|
|
55
|
-
defaultVariant?: keyof Props
|
|
60
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
56
61
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
57
62
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
58
|
-
}): AnimusExtendedWithVariants<
|
|
63
|
+
}): AnimusExtendedWithVariants<PropRegistry, GroupRegistry, BaseStyles, Variants & Record<PropKey, {
|
|
59
64
|
prop?: PropKey;
|
|
60
|
-
defaultVariant?: keyof Props
|
|
65
|
+
defaultVariant?: Extract<keyof Props, string>;
|
|
61
66
|
base?: ThemedCSSProps<Base, PropRegistry>;
|
|
62
67
|
variants: ThemedCSSPropMap<Props, PropRegistry>;
|
|
63
68
|
}>, States, ActiveGroups, CustomProps>;
|
|
64
69
|
}
|
|
65
|
-
export declare class AnimusExtended<
|
|
66
|
-
styles<Props extends AbstractProps>(config: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithBase<
|
|
70
|
+
export declare class AnimusExtended<PropRegistry extends Record<string, Prop>, 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, Prop>> extends AnimusExtendedWithBase<PropRegistry, GroupRegistry, BaseStyles, Variants, States, ActiveGroups, CustomProps> {
|
|
71
|
+
styles<Props extends AbstractProps>(config: ThemedCSSProps<Props, PropRegistry>): AnimusExtendedWithBase<PropRegistry, GroupRegistry, ThemedCSSProps<Props, PropRegistry> & BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
67
72
|
}
|
|
68
73
|
export {};
|
|
69
74
|
//# sourceMappingURL=AnimusExtended.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimusExtended.d.ts","sourceRoot":"","sources":["../src/AnimusExtended.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimusExtended.d.ts","sourceRoot":"","sources":["../src/AnimusExtended.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,IAAI,EACJ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,qBAAqB,CAChC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,EAC5D,UAAU,SAAS,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACvE,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAC9C,MAAM,SAAS,UAAU,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACrE,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;IAExC,YAAY,EAAS,YAAY,CAAC;IAClC,aAAa,EAAS,aAAa,CA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CAAC;2CAsBhD;CACF;AAED,qBAAa,cAAc,CACzB,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,YAAY,CAAC,EAAE,CAAC,EAC5D,UAAU,SAAS,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACvE,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAC9C,MAAM,SAAS,UAAU,CAAC,aAAa,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,EACrE,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACzC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CACxC,SAAQ,sBAAsB,CAC9B,YAAY,EACZ,aAAa,EACb,UAAU,EACV,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,WAAW,CACZ;IACC,MAAM,CAAC,KAAK,SAAS,aAAa,EAChC,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,sJAoB5C;CACF"}
|
package/dist/SystemBuilder.d.ts
CHANGED
|
@@ -1,31 +1,52 @@
|
|
|
1
1
|
import { Animus } from './Animus';
|
|
2
|
-
import {
|
|
2
|
+
import { type KeyframeFrameMap, type Keyframes } from './keyframes';
|
|
3
|
+
import { type SelectorAliasMap } from './selectors';
|
|
3
4
|
import { NamedTransform } from './transforms/createTransform';
|
|
4
|
-
import { Prop } from './types/config';
|
|
5
|
-
import {
|
|
5
|
+
import { Prop, ThemedCSSProps } from './types/config';
|
|
6
|
+
import { AbstractProps } from './types/props';
|
|
6
7
|
export type GlobalStyleMap = Record<string, Record<string, any>>;
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export interface GlobalStyleBlock {
|
|
9
|
+
__brand: 'GlobalStyleBlock';
|
|
10
|
+
styles: GlobalStyleMap;
|
|
11
|
+
}
|
|
12
|
+
export type GlobalStylesFactory<PropReg extends Record<string, Prop> = Record<string, Prop>> = <Map extends Record<string, AbstractProps>>(styles: {
|
|
13
|
+
readonly [K in keyof Map]: ThemedCSSProps<Map[K], PropReg>;
|
|
14
|
+
}) => GlobalStyleBlock;
|
|
15
|
+
export type CreateKeyframesFactory<PropReg extends Record<string, Prop> = Record<string, Prop>> = <Frames extends Record<string, Record<string, AbstractProps>>>(frames: {
|
|
16
|
+
readonly [N in keyof Frames]: {
|
|
17
|
+
readonly [S in keyof Frames[N]]: ThemedCSSProps<Frames[N][S], PropReg>;
|
|
18
|
+
};
|
|
19
|
+
}) => Keyframes<{
|
|
20
|
+
readonly [N in keyof Frames]: KeyframeFrameMap;
|
|
21
|
+
}>;
|
|
22
|
+
type IncludableSystem = {
|
|
23
|
+
toConfig(): SerializedConfig;
|
|
24
|
+
};
|
|
25
|
+
export interface CreateSystemConfig {
|
|
26
|
+
includes?: readonly IncludableSystem[];
|
|
10
27
|
}
|
|
11
28
|
export declare class SystemBuilder<PropReg extends Record<string, Prop> = {}, GroupReg extends Record<string, (keyof PropReg)[]> = {}> {
|
|
12
29
|
#private;
|
|
13
|
-
constructor(propRegistry?: PropReg, groupRegistry?: GroupReg,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
constructor(propRegistry?: PropReg, groupRegistry?: GroupReg, selectorRegistry?: SelectorAliasMap, includesRegistry?: readonly IncludableSystem[]);
|
|
31
|
+
addSelectors(selectors: Record<string, string>): SystemBuilder<PropReg, GroupReg>;
|
|
32
|
+
addGroup<Name extends string, Conf extends Record<string, Prop>>(name: Name extends keyof PropReg ? never : Name, config: Conf): SystemBuilder<PropReg & Conf, GroupReg & Record<Name, (keyof Conf)[]>>;
|
|
33
|
+
addProps<Conf extends Record<string, Prop> & Partial<Record<Extract<keyof GroupReg, string>, never>>>(config: Conf): SystemBuilder<PropReg & Conf, GroupReg>;
|
|
34
|
+
build(): {
|
|
35
|
+
system: SystemInstance<PropReg, GroupReg>;
|
|
36
|
+
createGlobalStyles: GlobalStylesFactory<PropReg>;
|
|
37
|
+
createKeyframes: CreateKeyframesFactory<PropReg>;
|
|
38
|
+
};
|
|
20
39
|
}
|
|
21
|
-
export type SystemInstance<PropReg extends Record<string, Prop>, GroupReg extends Record<string, (keyof PropReg)[]>> = Animus<
|
|
22
|
-
|
|
40
|
+
export type SystemInstance<PropReg extends Record<string, Prop>, GroupReg extends Record<string, (keyof PropReg)[]>> = Animus<PropReg, GroupReg> & {
|
|
41
|
+
toConfig(): SerializedConfig;
|
|
23
42
|
};
|
|
24
43
|
export interface SerializedConfig {
|
|
25
44
|
propConfig: string;
|
|
26
45
|
groupRegistry: string;
|
|
27
46
|
transforms: Record<string, NamedTransform>;
|
|
28
|
-
|
|
47
|
+
selectorAliases: string;
|
|
48
|
+
selectorOrder: string;
|
|
29
49
|
}
|
|
30
|
-
export declare function createSystem(): SystemBuilder
|
|
50
|
+
export declare function createSystem(config?: CreateSystemConfig): SystemBuilder;
|
|
51
|
+
export {};
|
|
31
52
|
//# sourceMappingURL=SystemBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemBuilder.d.ts","sourceRoot":"","sources":["../src/SystemBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"SystemBuilder.d.ts","sourceRoot":"","sources":["../src/SystemBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,cA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,CAAC,OAAO,CAAC,CAAC;KAClD,CAyBA;CACF;AAED,MAAM,MAAM,cAAc,CACxB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EACpC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC,IAChD,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG;IAC9B,QAAQ,IAAI,gBAAgB,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AA0DD,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,aAAa,CAOvE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AnyBrandedComponent, ComposedFamily, SharedConfig } from './types/component';
|
|
2
|
+
/**
|
|
3
|
+
* Compose independently-authored Animus components into a sealed,
|
|
4
|
+
* namespaced component family with shared variant propagation via
|
|
5
|
+
* CSS cascade.
|
|
6
|
+
*
|
|
7
|
+
* - **Enforce**: TypeScript ensures shared keys exist on Root (the
|
|
8
|
+
* cascade source). Non-Root slots that have the key consume it from
|
|
9
|
+
* CSS inheritance; slots without the key are unaffected.
|
|
10
|
+
* - **Wire**: The extraction pipeline emits composed variant CSS
|
|
11
|
+
* rules — two per shared variant option per child (inheritance +
|
|
12
|
+
* override) within @layer variants.
|
|
13
|
+
* - **Seal**: Output components are plain ForwardRefExoticComponent —
|
|
14
|
+
* no `.extend()`, no builder methods. One-way door from builder-land
|
|
15
|
+
* to component-land.
|
|
16
|
+
*
|
|
17
|
+
* For React context propagation (portal-crossing), use
|
|
18
|
+
* `composeWithContext` from `@animus-ui/system/compose-with-context`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function compose<Slots extends Record<string, AnyBrandedComponent>, const Shared extends SharedConfig<Slots>>(slots: Slots, options: {
|
|
21
|
+
shared: Shared;
|
|
22
|
+
name?: string;
|
|
23
|
+
}): ComposedFamily<Slots>;
|
|
24
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CACrB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACjD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,KAAK,CAAC,EAExC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,cAAc,CAAC,KAAK,CAAC,CAyBvB"}
|
package/dist/compose.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createElement, forwardRef } from "react";
|
|
2
|
+
//#region src/compose.ts
|
|
3
|
+
/**
|
|
4
|
+
* Compose independently-authored Animus components into a sealed,
|
|
5
|
+
* namespaced component family with shared variant propagation via
|
|
6
|
+
* CSS cascade.
|
|
7
|
+
*
|
|
8
|
+
* - **Enforce**: TypeScript ensures shared keys exist on Root (the
|
|
9
|
+
* cascade source). Non-Root slots that have the key consume it from
|
|
10
|
+
* CSS inheritance; slots without the key are unaffected.
|
|
11
|
+
* - **Wire**: The extraction pipeline emits composed variant CSS
|
|
12
|
+
* rules — two per shared variant option per child (inheritance +
|
|
13
|
+
* override) within @layer variants.
|
|
14
|
+
* - **Seal**: Output components are plain ForwardRefExoticComponent —
|
|
15
|
+
* no `.extend()`, no builder methods. One-way door from builder-land
|
|
16
|
+
* to component-land.
|
|
17
|
+
*
|
|
18
|
+
* For React context propagation (portal-crossing), use
|
|
19
|
+
* `composeWithContext` from `@animus-ui/system/compose-with-context`.
|
|
20
|
+
*/
|
|
21
|
+
function compose(slots, options) {
|
|
22
|
+
const familyName = options.name ?? "Composed";
|
|
23
|
+
const result = {};
|
|
24
|
+
for (const [name, SourceComponent] of Object.entries(slots)) {
|
|
25
|
+
const Wrapper = forwardRef((props, ref) => createElement(SourceComponent, {
|
|
26
|
+
...props,
|
|
27
|
+
ref
|
|
28
|
+
}, props.children));
|
|
29
|
+
Wrapper.displayName = `${familyName}.${name}`;
|
|
30
|
+
result[name] = Wrapper;
|
|
31
|
+
}
|
|
32
|
+
if (!("Root" in result)) throw new Error("compose(): No \"Root\" slot found. The root slot key must be exactly \"Root\" (PascalCase).");
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { compose };
|