@animus-ui/system 0.1.0-next.38 → 0.1.0-next.39

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.
Files changed (2) hide show
  1. package/README.md +127 -0
  2. package/package.json +18 -3
package/README.md ADDED
@@ -0,0 +1,127 @@
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
+ - [`@animus-ui/vite-plugin`](https://github.com/codecaaron/animus/tree/main/packages/vite-plugin) for Vite
13
+ - [`@animus-ui/next-plugin`](https://github.com/codecaaron/animus/tree/main/packages/next-plugin) for Next.js
14
+
15
+ ## Quick Start
16
+
17
+ ### 1. Define tokens
18
+
19
+ ```tsx
20
+ import { createTheme } from '@animus-ui/system';
21
+
22
+ const tokens = createTheme()
23
+ .addBreakpoints({ sm: 480, md: 768, lg: 1024 })
24
+ .addColors({
25
+ gray: { 100: '#f0f0f0', 800: '#1a1a1a' },
26
+ blue: { 400: '#3d94ff', 700: '#003d99' },
27
+ })
28
+ .addColorModes('dark', {
29
+ dark: { primary: 'blue.400', bg: 'gray.800', text: 'gray.100' },
30
+ light: { primary: 'blue.700', bg: 'gray.100', text: 'gray.800' },
31
+ })
32
+ .addScale({ name: 'space', values: { sm: '0.5rem', md: '1rem', lg: '1.5rem' } })
33
+ .build();
34
+
35
+ declare module '@animus-ui/system' {
36
+ interface Theme extends typeof tokens {}
37
+ }
38
+ ```
39
+
40
+ ### 2. Create system with prop groups
41
+
42
+ Pre-built groups ship with the package. Compose them into your own semantic groups:
43
+
44
+ ```tsx
45
+ import { createSystem } from '@animus-ui/system';
46
+ import { space, color, typography, border, shadows, background, flex, layout } from '@animus-ui/system/groups';
47
+
48
+ export const { system: ds, createGlobalStyles } = createSystem()
49
+ .addGroup('surface', { ...color, ...border, ...shadows, ...background })
50
+ .addGroup('space', space)
51
+ .addGroup('text', typography)
52
+ .addGroup('arrange', { ...flex, ...layout })
53
+ .build();
54
+ ```
55
+
56
+ Each group becomes an opt-in set of props that components can enable via `.system()`:
57
+
58
+ ```tsx
59
+ const Box = ds.styles({}).system({ surface: true, space: true }).asElement('div');
60
+
61
+ // Box now accepts: color, bg, border, shadow, p, m, gap, etc.
62
+ <Box bg="surface" p="md" borderBottom="1" />
63
+ ```
64
+
65
+ ### 3. Build components
66
+
67
+ ```tsx
68
+ const Button = ds
69
+ .styles({
70
+ display: 'inline-flex',
71
+ alignItems: 'center',
72
+ cursor: 'pointer',
73
+ border: 'none',
74
+ borderRadius: 4,
75
+ fontFamily: '{fonts.body}',
76
+ })
77
+ .variant({
78
+ size: {
79
+ prop: 'size',
80
+ variants: {
81
+ small: { fontSize: 14, padding: '{space.sm}' },
82
+ large: { fontSize: 18, padding: '{space.md} {space.lg}' },
83
+ },
84
+ },
85
+ intent: {
86
+ prop: 'intent',
87
+ variants: {
88
+ primary: { backgroundColor: '{colors.primary}', color: 'white' },
89
+ ghost: { backgroundColor: 'transparent', color: '{colors.primary}' },
90
+ },
91
+ },
92
+ })
93
+ .states({
94
+ disabled: { opacity: 0.5, pointerEvents: 'none' },
95
+ })
96
+ .system({ space: true })
97
+ .asElement('button');
98
+
99
+ <Button size="large" intent="primary" m={8} disabled />;
100
+ ```
101
+
102
+ ## Builder Chain
103
+
104
+ The chain enforces cascade ordering — each method maps to a CSS `@layer`:
105
+
106
+ ```
107
+ ds.styles() → @layer base
108
+ .variant() → @layer variants
109
+ .compound() → @layer compounds
110
+ .states() → @layer states
111
+ .system() → @layer system
112
+ .props() → @layer custom
113
+ .asElement() → typed React component
114
+ ```
115
+
116
+ The type system prevents calling methods out of order. `.variant()` after `.states()` is a type error.
117
+
118
+ ## Exports
119
+
120
+ | Path | What's in it |
121
+ |------|-------------|
122
+ | `@animus-ui/system` | Full API — builder, theme, runtime, types |
123
+ | `@animus-ui/system/groups` | Pre-built prop groups: `space`, `color`, `typography`, `layout`, `flex`, `grid`, `border`, `shadows`, `background`, `positioning`, `transitions` |
124
+
125
+ ## License
126
+
127
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/system",
3
- "version": "0.1.0-next.38",
3
+ "version": "0.1.0-next.39",
4
4
  "description": "Animus design system builder — tokens, prop groups, global styles",
5
5
  "author": "codecaaron <airrobb@gmail.com>",
6
6
  "license": "MIT",
@@ -29,17 +29,32 @@
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
+ "homepage": "https://github.com/codecaaron/animus/tree/main/packages/system#readme",
32
33
  "repository": {
33
34
  "type": "git",
34
- "url": "git+https://github.com/codecaaron/animus"
35
+ "url": "git+https://github.com/codecaaron/animus",
36
+ "directory": "packages/system"
35
37
  },
38
+ "keywords": [
39
+ "css",
40
+ "css-in-js",
41
+ "zero-runtime",
42
+ "styled",
43
+ "react",
44
+ "typescript",
45
+ "design-system",
46
+ "tokens",
47
+ "theming",
48
+ "variants",
49
+ "styled-components"
50
+ ],
36
51
  "scripts": {
37
52
  "build": "bun run build:ts",
38
53
  "build:ts": "tsdown && tsc -p tsconfig.build.json",
39
54
  "compile": "tsc --noEmit"
40
55
  },
41
56
  "dependencies": {
42
- "@animus-ui/properties": "0.1.0-next.38"
57
+ "@animus-ui/properties": "0.1.0-next.39"
43
58
  },
44
59
  "peerDependencies": {
45
60
  "react": "^18.0.0 || ^19.0.0"