@animus-ui/core 0.1.1-fffe37d2.0 → 0.2.0-beta.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/CHANGELOG.md +66 -8
- package/CLAUDE.md +352 -0
- package/dist/Animus.d.ts +77 -63
- package/dist/AnimusConfig.d.ts +8 -8
- package/dist/AnimusExtended.d.ts +49 -0
- package/dist/__fixtures__/testConfig.d.ts +153 -153
- package/dist/compatTheme.d.ts +28 -20
- package/dist/config.d.ts +2321 -2193
- package/dist/createAnimus.d.ts +2 -2
- package/dist/index.d.ts +1084 -1019
- package/dist/index.js +1950 -0
- package/dist/legacy/compose.d.ts +2 -2
- package/dist/legacy/config.d.ts +86 -85
- package/dist/legacy/core.d.ts +12 -12
- package/dist/legacy/create.d.ts +2 -2
- package/dist/legacy/createCss.d.ts +2 -2
- package/dist/legacy/createParser.d.ts +2 -9
- package/dist/legacy/createStates.d.ts +2 -2
- package/dist/legacy/createTransform.d.ts +2 -2
- package/dist/legacy/createVariant.d.ts +2 -2
- package/dist/legacy/responsive.d.ts +14 -14
- package/dist/properties/getStylePropNames.d.ts +1 -1
- package/dist/properties/orderPropNames.d.ts +6 -6
- package/dist/properties/styledOptions.d.ts +20 -20
- package/dist/scales/createScale.d.ts +6 -3
- package/dist/scales/lookupScaleValue.d.ts +3 -3
- package/dist/static-poc/atomic-css.d.ts +14 -0
- package/dist/static-poc/run-poc.d.ts +5 -0
- package/dist/static-poc/static-mode.d.ts +15 -0
- package/dist/static-poc/validate-poc.d.ts +5 -0
- package/dist/styles/createParser.d.ts +2 -9
- package/dist/styles/createPropertyStyle.d.ts +4 -3
- package/dist/styles/createStylist.d.ts +2 -2
- package/dist/styles/responsive.d.ts +14 -14
- package/dist/transforms/border.d.ts +1 -1
- package/dist/transforms/grid.d.ts +4 -4
- package/dist/transforms/index.d.ts +4 -4
- package/dist/transforms/size.d.ts +2 -2
- package/dist/transforms/utils.d.ts +2 -1
- package/dist/types/config.d.ts +50 -44
- package/dist/types/properties.d.ts +23 -26
- package/dist/types/props.d.ts +34 -43
- package/dist/types/scales.d.ts +2 -2
- package/dist/types/shared.d.ts +4 -4
- package/dist/types/theme.d.ts +17 -17
- package/dist/types/utils.d.ts +4 -4
- package/docs/AGENT-QUESTIONS.md +79 -0
- package/docs/agentic-alliance.md +415 -0
- package/docs/ai-collaboration-guide.md +141 -0
- package/docs/critical-findings.md +87 -0
- package/docs/gemini-tamagui-compiler-learnings.md +393 -0
- package/docs/tamagui-compiler-learnings.md +575 -0
- package/jest.config.js +1 -0
- package/package.json +11 -9
- package/rollup.config.js +2 -2
- package/tsconfig.json +4 -2
- package/dist/index.cjs.js +0 -1
- package/dist/index.esm.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,61 +3,119 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [0.2.0-beta.0](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.26...@animus-ui/core@0.2.0-beta.0) (2025-06-13)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Implement layered documentation and file-based governance voting ([7cdb599](https://github.com/codecaaron/animus/commit/7cdb5995e94d26059bfdd3ec01279fc4e4b45d40))
|
|
11
|
+
|
|
12
|
+
## [0.1.1-beta.26](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.25...@animus-ui/core@0.1.1-beta.26) (2025-05-29)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @animus-ui/core
|
|
9
15
|
|
|
16
|
+
## [0.1.1-beta.25](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.24...@animus-ui/core@0.1.1-beta.25) (2025-05-29)
|
|
10
17
|
|
|
18
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
11
19
|
|
|
20
|
+
## [0.1.1-beta.24](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.23...@animus-ui/core@0.1.1-beta.24) (2023-03-15)
|
|
12
21
|
|
|
22
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
13
23
|
|
|
14
|
-
## [0.1.1-beta.
|
|
24
|
+
## [0.1.1-beta.23](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.22...@animus-ui/core@0.1.1-beta.23) (2023-03-15)
|
|
15
25
|
|
|
16
26
|
**Note:** Version bump only for package @animus-ui/core
|
|
17
27
|
|
|
28
|
+
## [0.1.1-beta.22](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.21...@animus-ui/core@0.1.1-beta.22) (2023-03-13)
|
|
18
29
|
|
|
30
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
19
31
|
|
|
32
|
+
## [0.1.1-beta.21](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.20...@animus-ui/core@0.1.1-beta.21) (2022-03-25)
|
|
20
33
|
|
|
34
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
21
35
|
|
|
22
|
-
## [0.1.1-beta.
|
|
36
|
+
## [0.1.1-beta.20](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.19...@animus-ui/core@0.1.1-beta.20) (2022-02-14)
|
|
23
37
|
|
|
24
38
|
**Note:** Version bump only for package @animus-ui/core
|
|
25
39
|
|
|
40
|
+
## [0.1.1-beta.19](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.18...@animus-ui/core@0.1.1-beta.19) (2022-02-14)
|
|
26
41
|
|
|
42
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
27
43
|
|
|
44
|
+
## [0.1.1-beta.18](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.17...@animus-ui/core@0.1.1-beta.18) (2022-02-11)
|
|
28
45
|
|
|
46
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
29
47
|
|
|
30
|
-
## [0.1.1-beta.
|
|
48
|
+
## [0.1.1-beta.17](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.16...@animus-ui/core@0.1.1-beta.17) (2022-02-02)
|
|
31
49
|
|
|
32
50
|
**Note:** Version bump only for package @animus-ui/core
|
|
33
51
|
|
|
52
|
+
## [0.1.1-beta.16](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.15...@animus-ui/core@0.1.1-beta.16) (2022-02-02)
|
|
34
53
|
|
|
54
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
35
55
|
|
|
56
|
+
## [0.1.1-beta.15](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.14...@animus-ui/core@0.1.1-beta.15) (2022-01-26)
|
|
36
57
|
|
|
58
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
37
59
|
|
|
38
|
-
## 0.1.1-beta.
|
|
60
|
+
## [0.1.1-beta.14](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.13...@animus-ui/core@0.1.1-beta.14) (2022-01-24)
|
|
39
61
|
|
|
62
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
40
63
|
|
|
64
|
+
## [0.1.1-beta.13](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.12...@animus-ui/core@0.1.1-beta.13) (2022-01-24)
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
43
67
|
|
|
68
|
+
## [0.1.1-beta.12](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.11...@animus-ui/core@0.1.1-beta.12) (2022-01-24)
|
|
44
69
|
|
|
70
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
45
71
|
|
|
46
|
-
## 0.1.1-beta.0 (2022-01-
|
|
72
|
+
## [0.1.1-beta.11](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.10...@animus-ui/core@0.1.1-beta.11) (2022-01-24)
|
|
47
73
|
|
|
48
74
|
**Note:** Version bump only for package @animus-ui/core
|
|
49
75
|
|
|
76
|
+
## [0.1.1-beta.10](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.9...@animus-ui/core@0.1.1-beta.10) (2022-01-23)
|
|
50
77
|
|
|
78
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
51
79
|
|
|
80
|
+
## [0.1.1-beta.9](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.8...@animus-ui/core@0.1.1-beta.9) (2022-01-18)
|
|
52
81
|
|
|
82
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
53
83
|
|
|
54
|
-
## [0.1.1-beta.
|
|
84
|
+
## [0.1.1-beta.8](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.7...@animus-ui/core@0.1.1-beta.8) (2022-01-16)
|
|
55
85
|
|
|
56
86
|
**Note:** Version bump only for package @animus-ui/core
|
|
57
87
|
|
|
88
|
+
## [0.1.1-beta.7](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.6...@animus-ui/core@0.1.1-beta.7) (2022-01-16)
|
|
58
89
|
|
|
90
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
59
91
|
|
|
92
|
+
## [0.1.1-beta.6](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.5...@animus-ui/core@0.1.1-beta.6) (2022-01-11)
|
|
60
93
|
|
|
94
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
95
|
+
|
|
96
|
+
## [0.1.1-beta.5](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.4...@animus-ui/core@0.1.1-beta.5) (2022-01-09)
|
|
97
|
+
|
|
98
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
99
|
+
|
|
100
|
+
## [0.1.1-beta.4](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.3...@animus-ui/core@0.1.1-beta.4) (2022-01-09)
|
|
101
|
+
|
|
102
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
103
|
+
|
|
104
|
+
## [0.1.1-beta.3](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.1.1-beta.2...@animus-ui/core@0.1.1-beta.3) (2022-01-09)
|
|
105
|
+
|
|
106
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
107
|
+
|
|
108
|
+
## 0.1.1-beta.2 (2022-01-09)
|
|
109
|
+
|
|
110
|
+
## 0.1.1-beta.1 (2022-01-09)
|
|
111
|
+
|
|
112
|
+
## 0.1.1-beta.0 (2022-01-09)
|
|
113
|
+
|
|
114
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
115
|
+
|
|
116
|
+
## [0.1.1-beta.1](https://github.com/codecaaron/animus/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2022-01-09)
|
|
117
|
+
|
|
118
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
61
119
|
|
|
62
120
|
## 0.1.1-beta.0 (2022-01-09)
|
|
63
121
|
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# CLAUDE.md - Animus Core Package
|
|
2
|
+
|
|
3
|
+
This file provides detailed guidance for working with the Animus core builder implementation.
|
|
4
|
+
|
|
5
|
+
## Quick Philosophy Reminder for AI Agents
|
|
6
|
+
|
|
7
|
+
**This is optimal for us because:**
|
|
8
|
+
- Method order = semantic intent (styles=base, variants=choices, states=interactions, props=dynamics)
|
|
9
|
+
- Constraints guide us to correct patterns, not limit capabilities
|
|
10
|
+
- `extend()` provides full flexibility when needed
|
|
11
|
+
- One canonical path eliminates ambiguity
|
|
12
|
+
|
|
13
|
+
**Key Insight**: We're not limited in WHAT we can style, only guided in HOW we express styling intent. This transforms CSS from an open-ended problem to a solvable pattern-matching exercise.
|
|
14
|
+
|
|
15
|
+
## Architecture Overview
|
|
16
|
+
|
|
17
|
+
The Animus builder implements a sophisticated type-safe fluent API pattern using TypeScript's class inheritance and type narrowing. The architecture enforces a specific method call order to mirror CSS cascade principles.
|
|
18
|
+
|
|
19
|
+
## Builder Chain Architecture
|
|
20
|
+
|
|
21
|
+
### Class Hierarchy
|
|
22
|
+
```
|
|
23
|
+
AnimusConfig → Animus → AnimusWithBase → AnimusWithVariants → AnimusWithStates → AnimusWithSystem → AnimusWithAll
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Each class progressively narrows available methods:
|
|
27
|
+
- **AnimusConfig**: Entry point with `addGroup()` and `build()`
|
|
28
|
+
- **Animus**: Adds `styles()` method
|
|
29
|
+
- **AnimusWithBase**: Adds `variant()` method
|
|
30
|
+
- **AnimusWithVariants**: Adds `states()` and `variant()` methods
|
|
31
|
+
- **AnimusWithStates**: Adds `groups()` method
|
|
32
|
+
- **AnimusWithSystem**: Adds `props()` method
|
|
33
|
+
- **AnimusWithAll**: Terminal class with `asElement()`, `asComponent()`, `build()`, and `extend()`
|
|
34
|
+
|
|
35
|
+
### Method Chain Enforcement
|
|
36
|
+
|
|
37
|
+
The builder enforces this cascade order:
|
|
38
|
+
1. `.styles()` - Base styles (foundation layer)
|
|
39
|
+
2. `.variant()` - Variant-based styles (can be called multiple times)
|
|
40
|
+
3. `.states()` - Boolean state styles
|
|
41
|
+
4. `.groups()` - Enable prop groups
|
|
42
|
+
5. `.props()` - Custom props with scales
|
|
43
|
+
6. `.asElement()` or `.asComponent()` - Terminal methods
|
|
44
|
+
|
|
45
|
+
This order mirrors CSS cascade specificity where later rules override earlier ones.
|
|
46
|
+
|
|
47
|
+
### Extension Pattern
|
|
48
|
+
|
|
49
|
+
The `extend()` method is special - it returns an `AnimusExtended` instance that:
|
|
50
|
+
- Preserves all configuration from the parent
|
|
51
|
+
- Allows any builder method to be called in any order
|
|
52
|
+
- Merges configurations using lodash `merge()` to combine nested objects
|
|
53
|
+
- Maintains proper style execution order despite flexible API
|
|
54
|
+
|
|
55
|
+
## Key Components
|
|
56
|
+
|
|
57
|
+
### AnimusConfig (Entry Point)
|
|
58
|
+
Located in `AnimusConfig.ts`:
|
|
59
|
+
- Manages prop registry and group definitions
|
|
60
|
+
- `addGroup()`: Registers named groups of props
|
|
61
|
+
- `build()`: Creates the initial Animus instance
|
|
62
|
+
|
|
63
|
+
### Animus Classes (Builder Chain)
|
|
64
|
+
Located in `Animus.ts`:
|
|
65
|
+
- Each class extends the previous, adding specific methods
|
|
66
|
+
- Uses TypeScript generics to track configuration state
|
|
67
|
+
- Methods return new instances of the next class in chain
|
|
68
|
+
|
|
69
|
+
### AnimusExtended (Extension Handler)
|
|
70
|
+
Located in `AnimusExtended.ts`:
|
|
71
|
+
- Handles component extension with full method access
|
|
72
|
+
- Merges parent and child configurations
|
|
73
|
+
- Preserves cascade order during style execution
|
|
74
|
+
|
|
75
|
+
### Style Processing
|
|
76
|
+
|
|
77
|
+
#### createStylist (Style Compiler)
|
|
78
|
+
Located in `styles/createStylist.ts`:
|
|
79
|
+
- Compiles all style layers into a single function
|
|
80
|
+
- Handles selector generation for variants and states
|
|
81
|
+
- Manages responsive breakpoint extraction
|
|
82
|
+
- Applies styles in correct cascade order:
|
|
83
|
+
1. Base styles
|
|
84
|
+
2. Variant styles (when active)
|
|
85
|
+
3. State styles (when active)
|
|
86
|
+
4. System props (from parser)
|
|
87
|
+
5. Custom props
|
|
88
|
+
|
|
89
|
+
#### createParser (Prop Parser)
|
|
90
|
+
Located in `styles/createParser.ts`:
|
|
91
|
+
- Converts prop values to CSS using scale lookups
|
|
92
|
+
- Handles responsive prop arrays
|
|
93
|
+
- Manages prop-to-CSS property mapping
|
|
94
|
+
|
|
95
|
+
## Type System
|
|
96
|
+
|
|
97
|
+
The builder uses extensive TypeScript generics to track:
|
|
98
|
+
- **PropRegistry**: All registered props and their types
|
|
99
|
+
- **GroupRegistry**: Named groups and their constituent props
|
|
100
|
+
- **BaseParser**: Parser configuration for system props
|
|
101
|
+
- **BaseStyles**: Base CSS styles
|
|
102
|
+
- **Variants**: Variant configurations with their options
|
|
103
|
+
- **States**: Boolean state configurations
|
|
104
|
+
- **ActiveGroups**: Currently enabled prop groups
|
|
105
|
+
- **CustomProps**: User-defined custom props
|
|
106
|
+
|
|
107
|
+
## Style Execution Order
|
|
108
|
+
|
|
109
|
+
When a component renders, styles are applied in this order:
|
|
110
|
+
1. CSS variables (from `vars` prop)
|
|
111
|
+
2. Base styles from `.styles()`
|
|
112
|
+
3. Active variant styles
|
|
113
|
+
4. Active state styles
|
|
114
|
+
5. System props (parsed from component props)
|
|
115
|
+
6. Inline style overrides
|
|
116
|
+
|
|
117
|
+
## Prop Forwarding
|
|
118
|
+
|
|
119
|
+
The builder automatically filters props:
|
|
120
|
+
- System props (in PropRegistry) are consumed and not forwarded
|
|
121
|
+
- Valid HTML attributes are forwarded (using @emotion/is-prop-valid)
|
|
122
|
+
- Custom props are consumed based on configuration
|
|
123
|
+
|
|
124
|
+
## Best Practices
|
|
125
|
+
|
|
126
|
+
1. **Define base styles first** - Use `.styles()` for foundational styles
|
|
127
|
+
2. **Use variants for design options** - Color schemes, sizes, etc.
|
|
128
|
+
3. **Use states for interactive states** - Hover, focus, disabled, etc.
|
|
129
|
+
4. **Group related props** - Use `.groups()` to enable sets of props
|
|
130
|
+
5. **Extend for variations** - Use `.extend()` to create component variants
|
|
131
|
+
|
|
132
|
+
## Common Patterns
|
|
133
|
+
|
|
134
|
+
### Basic Component
|
|
135
|
+
```typescript
|
|
136
|
+
const Button = animus
|
|
137
|
+
.styles({
|
|
138
|
+
padding: '8px 16px',
|
|
139
|
+
borderRadius: '4px'
|
|
140
|
+
})
|
|
141
|
+
.asElement('button');
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Component with Variants
|
|
145
|
+
```typescript
|
|
146
|
+
const Button = animus
|
|
147
|
+
.styles({ base: '...' })
|
|
148
|
+
.variant({
|
|
149
|
+
prop: 'size',
|
|
150
|
+
variants: {
|
|
151
|
+
small: { padding: '4px 8px' },
|
|
152
|
+
large: { padding: '12px 24px' }
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
.asElement('button');
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Extended Component
|
|
159
|
+
```typescript
|
|
160
|
+
const PrimaryButton = Button.extend()
|
|
161
|
+
.styles({
|
|
162
|
+
backgroundColor: 'blue',
|
|
163
|
+
color: 'white'
|
|
164
|
+
})
|
|
165
|
+
.asElement('button');
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Debugging Tips
|
|
169
|
+
|
|
170
|
+
1. **Check method order** - Ensure builder methods are called in correct sequence
|
|
171
|
+
2. **Inspect built styles** - Use `.build()` to see the compiled style function
|
|
172
|
+
3. **Verify prop filtering** - Check `shouldForwardProp` logic
|
|
173
|
+
4. **Trace style cascade** - Follow execution through createStylist
|
|
174
|
+
5. **Type errors** - Usually indicate incorrect method order or invalid configurations
|
|
175
|
+
|
|
176
|
+
## Practical Patterns & Examples
|
|
177
|
+
|
|
178
|
+
This section provides answers to common implementation questions for AI agents.
|
|
179
|
+
|
|
180
|
+
### Responsive Design
|
|
181
|
+
*Documentation coming soon - how arrays work, breakpoint system*
|
|
182
|
+
Array responsive syntax works for specificing values mobile first, from no breakpoint to the highest breakpoint configured in the theme. Omitted sequential values in the array are ignored (only if undefined).
|
|
183
|
+
|
|
184
|
+
The object syntax is equivalent but uses named keys for the sequence. Please see the example:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
// Object syntax
|
|
188
|
+
animus.styles({ width: { _: '100px', xs: '200px', md: '300px' }})
|
|
189
|
+
// Equivalent Array Syntax
|
|
190
|
+
animus.styles({ width: ['100px', '200px', , '300px' ]});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Responsive syntax is available definitionally in `.styles()`, `.variant()` and `.states()` for example:
|
|
194
|
+
```tsx
|
|
195
|
+
animus
|
|
196
|
+
.variant({
|
|
197
|
+
prop: 'size',
|
|
198
|
+
variants: {
|
|
199
|
+
large: { padding: ['1rem', '2rem'] } // Is this valid?
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
And for `groups()` and custom `props()` they are available in the final prop API as valid syntax E.G:
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
const Box = animus.groups({ space: true }).asElement('div');
|
|
208
|
+
|
|
209
|
+
<Box p={['1rem', '2rem', '3rem']} />
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Theming Integration
|
|
213
|
+
*Documentation coming soon - design tokens, theme values, typing*
|
|
214
|
+
|
|
215
|
+
### Complex Selectors
|
|
216
|
+
*Documentation coming soon - pseudo-selectors, nested selectors placement*
|
|
217
|
+
Pseudo selectors and nested selectors are available for `.styles()`, `.variant()` and `.states()` as they all represent a set of CSS rules rather than indivdiual utilities.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
const HoverableItem = animus
|
|
221
|
+
.styles({
|
|
222
|
+
backgroundColor: 'white',
|
|
223
|
+
'&:hover': {
|
|
224
|
+
backgroundColor: 'grey',
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
.variant({
|
|
228
|
+
prop: 'intent',
|
|
229
|
+
variants: {
|
|
230
|
+
primary: {
|
|
231
|
+
backgroundColor: 'blue',
|
|
232
|
+
color: 'white',
|
|
233
|
+
'&:hover': {
|
|
234
|
+
backgroundColor: 'darkblue',
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
danger: {
|
|
238
|
+
backgroundColor: 'red',
|
|
239
|
+
color: 'white',
|
|
240
|
+
'&:hover': {
|
|
241
|
+
backgroundColor: 'darkred',
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
.states({
|
|
247
|
+
disabled: {
|
|
248
|
+
backgroundColor: 'grey',
|
|
249
|
+
opacity: 0.8,
|
|
250
|
+
'&:hover': {
|
|
251
|
+
cursor: 'not-allowed',
|
|
252
|
+
backgroundColor: 'grey',
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
This also applies to complex or multiple selectors and or pseudo elements like - however may not include escaping the current context with `.parent + &`:
|
|
259
|
+
```tsx
|
|
260
|
+
const ComplexThing = animus
|
|
261
|
+
.styles({
|
|
262
|
+
'&:before': {
|
|
263
|
+
content: '""',
|
|
264
|
+
position: 'absolute',
|
|
265
|
+
borderRadius: 4,
|
|
266
|
+
gradient: 'flowX',
|
|
267
|
+
backgroundSize: '300px 100px',
|
|
268
|
+
backgroundPosition: '0px 0%',
|
|
269
|
+
transition: 'bg',
|
|
270
|
+
inset: 0,
|
|
271
|
+
bg: 'background-current',
|
|
272
|
+
zIndex: 0,
|
|
273
|
+
},
|
|
274
|
+
'&:after': {
|
|
275
|
+
content: '""',
|
|
276
|
+
inset: 2,
|
|
277
|
+
borderRadius: 2,
|
|
278
|
+
bg: 'background-current',
|
|
279
|
+
zIndex: 0,
|
|
280
|
+
position: 'absolute',
|
|
281
|
+
},
|
|
282
|
+
'&:hover:before': {
|
|
283
|
+
backgroundPosition: '-100px 0%',
|
|
284
|
+
},
|
|
285
|
+
'&:active:hover:before': {
|
|
286
|
+
backgroundPosition: '-400px 0%',
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Chain definition order reflects the order of evaluation:
|
|
292
|
+
1. `styles`
|
|
293
|
+
2. `variant` preserving the order in which variants are registered if this is called multiple times.
|
|
294
|
+
3. `states`
|
|
295
|
+
4. `groups`
|
|
296
|
+
5. `props`
|
|
297
|
+
|
|
298
|
+
When extending a component using `.extend()` you can inject new styles to specific layers without effecting the prop cascade!
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
### Animation Patterns
|
|
303
|
+
*Documentation coming soon - where animations belong in the cascade*
|
|
304
|
+
|
|
305
|
+
### Compound Components
|
|
306
|
+
*Documentation coming soon - Card.Header, Card.Body patterns*
|
|
307
|
+
|
|
308
|
+
Compound composition is up to the user - a Compound component can befined as aliases of local components to indicate they are intended to be used together:
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
const Card = animus
|
|
312
|
+
.styles({
|
|
313
|
+
padding: '1rem',
|
|
314
|
+
backgroundColor: 'grey',
|
|
315
|
+
border: 1,
|
|
316
|
+
})
|
|
317
|
+
.asElement('div');
|
|
318
|
+
|
|
319
|
+
const CardHeader = animus
|
|
320
|
+
.styles({
|
|
321
|
+
fontSize: 18,
|
|
322
|
+
fontWeight: 500
|
|
323
|
+
})
|
|
324
|
+
.asElement('h2');
|
|
325
|
+
|
|
326
|
+
const CardBody = animus
|
|
327
|
+
.styles({
|
|
328
|
+
padding: '1rem',
|
|
329
|
+
fontSize: 14,
|
|
330
|
+
})
|
|
331
|
+
.asElement('div');
|
|
332
|
+
|
|
333
|
+
Card.Header = CardHeader;
|
|
334
|
+
Card.Body = CardBody;
|
|
335
|
+
|
|
336
|
+
export default Card;
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Global Styles & Resets
|
|
340
|
+
*Documentation coming soon - app-wide styles approach*
|
|
341
|
+
|
|
342
|
+
### Performance Considerations
|
|
343
|
+
*Documentation coming soon - patterns to avoid, optimization tips*
|
|
344
|
+
|
|
345
|
+
### Complete Component Examples
|
|
346
|
+
*Documentation coming soon - comprehensive examples with all features*
|
|
347
|
+
|
|
348
|
+
### Common UI Patterns
|
|
349
|
+
*Documentation coming soon - modal, dropdown, form field implementations*
|
|
350
|
+
|
|
351
|
+
### Design System Integration
|
|
352
|
+
*Documentation coming soon - token integration, migration patterns*
|
package/dist/Animus.d.ts
CHANGED
|
@@ -1,63 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Arg } from './types/utils';
|
|
6
|
-
export declare class AnimusWithAll<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<BaseParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, Prop>> {
|
|
7
|
-
propRegistry: PropRegistry;
|
|
8
|
-
groupRegistry: GroupRegistry;
|
|
9
|
-
parser: BaseParser;
|
|
10
|
-
baseStyles: BaseStyles;
|
|
11
|
-
statesConfig: States;
|
|
12
|
-
variants: Variants;
|
|
13
|
-
activeGroups: ActiveGroups;
|
|
14
|
-
custom: CustomProps;
|
|
15
|
-
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps);
|
|
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
|
-
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
48
|
-
prop?: PropKey;
|
|
49
|
-
defaultVariant?: keyof Props;
|
|
50
|
-
base?: CSSProps<Base, SystemProps<BaseParser>>;
|
|
51
|
-
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
52
|
-
}): AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Record<PropKey, {
|
|
53
|
-
prop?: PropKey
|
|
54
|
-
defaultVariant?: keyof Props
|
|
55
|
-
base?: CSSProps<Base, SystemProps<BaseParser
|
|
56
|
-
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
57
|
-
}>>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
constructor(props: PropRegistry, groups: GroupRegistry);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
import { AnimusExtended } from './AnimusExtended';
|
|
2
|
+
import { CSSPropMap, CSSProps, Parser, Prop, SystemProps, VariantConfig } from './types/config';
|
|
3
|
+
import { AbstractProps, ThemeProps } from './types/props';
|
|
4
|
+
import { CSSObject } from './types/shared';
|
|
5
|
+
import { Arg } from './types/utils';
|
|
6
|
+
export declare class AnimusWithAll<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<BaseParser>>, ActiveGroups extends Record<string, true>, CustomProps extends Record<string, Prop>> {
|
|
7
|
+
propRegistry: PropRegistry;
|
|
8
|
+
groupRegistry: GroupRegistry;
|
|
9
|
+
parser: BaseParser;
|
|
10
|
+
baseStyles: BaseStyles;
|
|
11
|
+
statesConfig: States;
|
|
12
|
+
variants: Variants;
|
|
13
|
+
activeGroups: ActiveGroups;
|
|
14
|
+
custom: CustomProps;
|
|
15
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups, custom: CustomProps);
|
|
16
|
+
extend(): AnimusExtended<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
17
|
+
asElement<T extends keyof JSX.IntrinsicElements>(component: T): import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
} & Omit<{ [K in keyof Arg<BaseParser> as K extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K : never]?: Arg<BaseParser>[K] | undefined; }, "theme" | keyof Variants | keyof States | keyof CustomProps> & { [K_1 in keyof Variants]?: keyof Variants[K_1]["variants"] | undefined; } & { [K_2 in keyof States]?: boolean | undefined; } & { [K_3 in keyof import("./types/config").ParserProps<CustomProps>]: import("./types/config").ParserProps<CustomProps>[K_3]; } & {
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
}, JSX.IntrinsicElements[T], {}> & {
|
|
23
|
+
extend: () => AnimusExtended<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
24
|
+
};
|
|
25
|
+
asComponent<T extends (props: {
|
|
26
|
+
className?: string;
|
|
27
|
+
}) => any>(AsComponent: T): import("@emotion/styled").StyledComponent<JSX.LibraryManagedAttributes<T, import("react").ComponentProps<T>> & {
|
|
28
|
+
theme?: import("@emotion/react").Theme;
|
|
29
|
+
} & Omit<{ [K in keyof Arg<BaseParser> as K extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K : never]?: Arg<BaseParser>[K] | undefined; }, "theme" | keyof Variants | keyof States | keyof CustomProps> & { [K_1 in keyof Variants]?: keyof Variants[K_1]["variants"] | undefined; } & { [K_2 in keyof States]?: boolean | undefined; } & { [K_3 in keyof import("./types/config").ParserProps<CustomProps>]: import("./types/config").ParserProps<CustomProps>[K_3]; }, {}, {}> & {
|
|
30
|
+
extend: () => AnimusExtended<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
31
|
+
};
|
|
32
|
+
build(): ((props: ThemeProps<Omit<{ [K in keyof Arg<BaseParser> as K extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K : never]?: Arg<BaseParser>[K] | undefined; }, "theme" | keyof Variants | keyof States | keyof CustomProps> & { [K_1 in keyof Variants]?: keyof Variants[K_1]["variants"] | undefined; } & { [K_2 in keyof States]?: boolean | undefined; } & { [K_3 in keyof import("./types/config").ParserProps<CustomProps>]: import("./types/config").ParserProps<CustomProps>[K_3]; }>) => CSSObject) & {
|
|
33
|
+
extend: () => AnimusExtended<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
declare class AnimusWithSystem<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<BaseParser>>, ActiveGroups extends Record<string, true>> extends AnimusWithAll<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, {}> {
|
|
37
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups);
|
|
38
|
+
props<CustomProps extends Record<string, Prop>>(config: CustomProps): AnimusWithAll<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
39
|
+
}
|
|
40
|
+
declare class AnimusWithStates<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>, Variants extends Record<string, VariantConfig>, States extends CSSPropMap<AbstractProps, SystemProps<BaseParser>>> extends AnimusWithSystem<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, {}> {
|
|
41
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States);
|
|
42
|
+
groups<PickedGroups extends keyof GroupRegistry>(config: Record<PickedGroups, true>): AnimusWithSystem<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, Record<PickedGroups, true>>;
|
|
43
|
+
}
|
|
44
|
+
declare class AnimusWithVariants<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>, Variants extends Record<string, VariantConfig>> extends AnimusWithStates<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, {}> {
|
|
45
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants);
|
|
46
|
+
states<Props extends AbstractProps>(config: CSSPropMap<Props, SystemProps<BaseParser>>): AnimusWithStates<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, CSSPropMap<Props, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>>>;
|
|
47
|
+
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
48
|
+
prop?: PropKey;
|
|
49
|
+
defaultVariant?: keyof Props;
|
|
50
|
+
base?: CSSProps<Base, SystemProps<BaseParser>>;
|
|
51
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
52
|
+
}): AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants & Record<PropKey, {
|
|
53
|
+
prop?: PropKey;
|
|
54
|
+
defaultVariant?: keyof Props;
|
|
55
|
+
base?: CSSProps<Base, SystemProps<BaseParser>>;
|
|
56
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
57
|
+
}>>;
|
|
58
|
+
}
|
|
59
|
+
declare class AnimusWithBase<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>, BaseStyles extends CSSProps<AbstractProps, SystemProps<BaseParser>>> extends AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, {}> {
|
|
60
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles);
|
|
61
|
+
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
62
|
+
prop?: PropKey;
|
|
63
|
+
defaultVariant?: keyof Props;
|
|
64
|
+
base?: CSSProps<Base, SystemProps<BaseParser>>;
|
|
65
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
66
|
+
}): AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Record<PropKey, {
|
|
67
|
+
prop?: PropKey;
|
|
68
|
+
defaultVariant?: keyof Props;
|
|
69
|
+
base?: CSSProps<Base, SystemProps<BaseParser>>;
|
|
70
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
71
|
+
}>>;
|
|
72
|
+
}
|
|
73
|
+
export declare class Animus<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>> extends AnimusWithBase<PropRegistry, GroupRegistry, BaseParser, {}> {
|
|
74
|
+
constructor(props: PropRegistry, groups: GroupRegistry);
|
|
75
|
+
styles<Props extends AbstractProps>(config: CSSProps<Props, SystemProps<BaseParser>>): AnimusWithBase<PropRegistry, GroupRegistry, BaseParser, CSSProps<Props, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>>>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
package/dist/AnimusConfig.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class AnimusConfig<C extends Record<string, Prop> = {}, G extends Record<string, (keyof C)[]> = {}> {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(config?: C, groups?: G);
|
|
6
|
-
addGroup<Name extends string, Conf extends Record<string, Prop>, PropNames extends keyof Conf>(name: Name, config: Conf): AnimusConfig<C & Conf, G & Record<Name, PropNames[]>>;
|
|
7
|
-
build(): Animus<{ [K in keyof C]: C[K]; }, { [K_1 in keyof G]: G[K_1]; }, import("./types/config").Parser<{ [K in keyof C]: C[K]; }>>;
|
|
8
|
-
}
|
|
1
|
+
import { Animus } from './Animus';
|
|
2
|
+
import { Prop } from './types/config';
|
|
3
|
+
export declare class AnimusConfig<C extends Record<string, Prop> = {}, G extends Record<string, (keyof C)[]> = {}> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(config?: C, groups?: G);
|
|
6
|
+
addGroup<Name extends string, Conf extends Record<string, Prop>, PropNames extends keyof Conf>(name: Name, config: Conf): AnimusConfig<C & Conf, G & Record<Name, PropNames[]>>;
|
|
7
|
+
build(): Animus<{ [K in keyof C]: C[K]; }, { [K_1 in keyof G]: G[K_1]; }, import("./types/config").Parser<{ [K in keyof C]: C[K]; }>>;
|
|
8
|
+
}
|