@animus-ui/core 0.1.0-next.23 → 0.1.0-next.31
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/CLAUDE.md +10 -27
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @animus-ui/core — Legacy Builder Implementation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Status: Legacy.** Consumers use `@animus-ui/system`, which re-exports the relevant parts. Do not add new API surface here — extend system instead.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## What This Package Is
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **`openspec/specs/extension-system/spec.md`** — AnimusExtended flexible ordering, merge semantics, extension cascade ordering
|
|
9
|
-
- **`openspec/specs/prop-system/spec.md`** — Groups, scale resolution, transforms, responsive syntax, prop forwarding
|
|
7
|
+
Runtime implementation of the builder chain (Animus.ts, AnimusExtended.ts) and prop system (config.ts, groups). System imports from core at build time and flattens into its own dist.
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## Architecture: Backwards Inheritance
|
|
12
10
|
|
|
13
|
-
- `
|
|
14
|
-
- `src/AnimusExtended.ts` — Extension system (flexible ordering, immutable merge)
|
|
15
|
-
- `src/AnimusConfig.ts` — Entry point: `createAnimus().addGroup().build()`
|
|
16
|
-
- `src/config.ts` — 13 prop groups, default `animus` instance
|
|
17
|
-
- `src/styles/createStylist.ts` — Runtime style compilation (cascade merge)
|
|
18
|
-
- `src/styles/createParser.ts` — Prop→CSS resolution with responsive handling
|
|
19
|
-
- `src/styles/createPropertyStyle.ts` — Single prop→CSS with scale lookup + transform
|
|
11
|
+
The 6-class hierarchy (`Animus` → `AnimusWithBase` → ... → `AnimusWithAll`) uses backwards inheritance — each child class extends its parent and removes preceding methods. This enforces cascade ordering at the type level without runtime checks.
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
**Why backwards:** The chain builds UP (styles → variant → states), but each new stage needs to hide previous-stage methods. In normal inheritance, children add methods. Here, children constrain by inheriting only what's still callable. The "parent" in the class hierarchy is actually the LATER stage.
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
animus.styles() → .variant() → .states() → .groups() → .props() → .asElement()
|
|
25
|
-
```
|
|
15
|
+
## Prop Config
|
|
26
16
|
|
|
27
|
-
|
|
17
|
+
`src/config.ts` defines the canonical prop registry: 13 groups (space, color, typography, layout, etc.) with ~80 individual props. Each prop specifies `{ property, scale?, transform?, negative?, strict? }`.
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
// Object: named breakpoints (keys come from createTheme breakpoints config)
|
|
33
|
-
p={{ _: 8, sm: 16 }}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
The `_` key is the default (no media query). Named keys generate `@media` queries. Available in `.styles()`, `.variant()`, `.states()`, and component props. Breakpoint keys are user-defined via `createTheme({ breakpoints: {...} })` — types contract to exactly the configured keys.
|
|
19
|
+
This config is serialized by `ds.serialize()` and consumed by both the Rust extraction crate and the runtime.
|