@animus-ui/core 0.0.1-fb698e5b.0 → 0.1.0-next.8

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 (41) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/CLAUDE.md +39 -0
  3. package/README.md +1 -86
  4. package/package.json +12 -13
  5. package/tsconfig.build.json +8 -0
  6. package/tsconfig.json +3 -2
  7. package/LICENSE +0 -21
  8. package/babel.config.js +0 -5
  9. package/dist/animusBuilder.d.ts +0 -82
  10. package/dist/configBuilder.d.ts +0 -11
  11. package/dist/createAnimus.d.ts +0 -2
  12. package/dist/deprecated/core.d.ts +0 -10
  13. package/dist/index.cjs.js +0 -1
  14. package/dist/index.d.ts +0 -1597
  15. package/dist/index.esm.js +0 -1
  16. package/dist/internal/compose.d.ts +0 -2
  17. package/dist/internal/create.d.ts +0 -2
  18. package/dist/internal/createCss.d.ts +0 -2
  19. package/dist/internal/createStates.d.ts +0 -2
  20. package/dist/internal/createVariant.d.ts +0 -2
  21. package/dist/props/baseConfig.d.ts +0 -586
  22. package/dist/props/baseScales.d.ts +0 -51
  23. package/dist/scales/createScale.d.ts +0 -3
  24. package/dist/scales/createScaleLookup.d.ts +0 -5
  25. package/dist/styles/createParser.d.ts +0 -2
  26. package/dist/styles/createStylist.d.ts +0 -2
  27. package/dist/styles/createTransform.d.ts +0 -2
  28. package/dist/transforms/grid.d.ts +0 -4
  29. package/dist/transforms/index.d.ts +0 -2
  30. package/dist/transforms/size.d.ts +0 -2
  31. package/dist/types/config.d.ts +0 -81
  32. package/dist/types/properties.d.ts +0 -25
  33. package/dist/types/props.d.ts +0 -47
  34. package/dist/types/theme.d.ts +0 -33
  35. package/dist/types/utils.d.ts +0 -3
  36. package/dist/utils/__fixtures__/testConfig.d.ts +0 -153
  37. package/dist/utils/getStaticProperties.d.ts +0 -1
  38. package/dist/utils/propNames.d.ts +0 -6
  39. package/dist/utils/responsive.d.ts +0 -13
  40. package/dist/utils/styledOptions.d.ts +0 -21
  41. package/rollup.config.js +0 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,136 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [0.2.0-beta.2](https://github.com/codecaaron/animus/compare/@animus-ui/core@0.2.0-beta.0...@animus-ui/core@0.2.0-beta.2) (2025-07-01)
7
+
8
+ **Note:** Version bump only for package @animus-ui/core
9
+
10
+ # 0.2.0-beta.1 (2025-06-15)
11
+
12
+ ### Features
13
+
14
+ - Implement layered documentation and file-based governance voting ([7cdb599](https://github.com/codecaaron/animus/commit/7cdb5995e94d26059bfdd3ec01279fc4e4b45d40))
15
+
16
+ ## 0.1.1-beta.1 (2022-01-09)
17
+
18
+ ## 0.1.1-beta.0 (2022-01-09)
19
+
20
+ # [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)
21
+
22
+ ### Features
23
+
24
+ - Implement layered documentation and file-based governance voting ([7cdb599](https://github.com/codecaaron/animus/commit/7cdb5995e94d26059bfdd3ec01279fc4e4b45d40))
25
+
26
+ ## [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)
27
+
28
+ **Note:** Version bump only for package @animus-ui/core
29
+
30
+ ## [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)
31
+
32
+ **Note:** Version bump only for package @animus-ui/core
33
+
34
+ ## [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)
35
+
36
+ **Note:** Version bump only for package @animus-ui/core
37
+
38
+ ## [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)
39
+
40
+ **Note:** Version bump only for package @animus-ui/core
41
+
42
+ ## [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)
43
+
44
+ **Note:** Version bump only for package @animus-ui/core
45
+
46
+ ## [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)
47
+
48
+ **Note:** Version bump only for package @animus-ui/core
49
+
50
+ ## [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)
51
+
52
+ **Note:** Version bump only for package @animus-ui/core
53
+
54
+ ## [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)
55
+
56
+ **Note:** Version bump only for package @animus-ui/core
57
+
58
+ ## [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)
59
+
60
+ **Note:** Version bump only for package @animus-ui/core
61
+
62
+ ## [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)
63
+
64
+ **Note:** Version bump only for package @animus-ui/core
65
+
66
+ ## [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)
67
+
68
+ **Note:** Version bump only for package @animus-ui/core
69
+
70
+ ## [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)
71
+
72
+ **Note:** Version bump only for package @animus-ui/core
73
+
74
+ ## [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)
75
+
76
+ **Note:** Version bump only for package @animus-ui/core
77
+
78
+ ## [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)
79
+
80
+ **Note:** Version bump only for package @animus-ui/core
81
+
82
+ ## [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)
83
+
84
+ **Note:** Version bump only for package @animus-ui/core
85
+
86
+ ## [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)
87
+
88
+ **Note:** Version bump only for package @animus-ui/core
89
+
90
+ ## [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)
91
+
92
+ **Note:** Version bump only for package @animus-ui/core
93
+
94
+ ## [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)
95
+
96
+ **Note:** Version bump only for package @animus-ui/core
97
+
98
+ ## [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)
99
+
100
+ **Note:** Version bump only for package @animus-ui/core
101
+
102
+ ## [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)
103
+
104
+ **Note:** Version bump only for package @animus-ui/core
105
+
106
+ ## [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)
107
+
108
+ **Note:** Version bump only for package @animus-ui/core
109
+
110
+ ## [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)
111
+
112
+ **Note:** Version bump only for package @animus-ui/core
113
+
114
+ ## [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)
115
+
116
+ **Note:** Version bump only for package @animus-ui/core
117
+
118
+ ## [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)
119
+
120
+ **Note:** Version bump only for package @animus-ui/core
121
+
122
+ ## 0.1.1-beta.2 (2022-01-09)
123
+
124
+ ## 0.1.1-beta.1 (2022-01-09)
125
+
126
+ ## 0.1.1-beta.0 (2022-01-09)
127
+
128
+ **Note:** Version bump only for package @animus-ui/core
129
+
130
+ ## [0.1.1-beta.1](https://github.com/codecaaron/animus/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2022-01-09)
131
+
132
+ **Note:** Version bump only for package @animus-ui/core
133
+
134
+ ## 0.1.1-beta.0 (2022-01-09)
135
+
136
+ **Note:** Version bump only for package @animus-ui/core
package/CLAUDE.md ADDED
@@ -0,0 +1,39 @@
1
+ # Animus Core Package
2
+
3
+ ## Canonical Specifications
4
+
5
+ Authoritative behavioral contracts:
6
+
7
+ - **`openspec/specs/builder-chain/spec.md`** — Type-state machine, cascade ordering, terminals, backwards inheritance
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
10
+
11
+ ## Key Files
12
+
13
+ - `src/Animus.ts` — Builder chain (6 classes, backwards inheritance)
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
20
+
21
+ ## Builder Chain Order
22
+
23
+ ```
24
+ animus.styles() → .variant() → .states() → .groups() → .props() → .asElement()
25
+ ```
26
+
27
+ This order defines cascade priority. Later stages override earlier. The chain maps to CSS @layer: `base, variants, states, system, custom`.
28
+
29
+ ## Responsive Syntax
30
+
31
+ ```tsx
32
+ // Array: [default, xs, sm, md, lg, xl]
33
+ p={[8, 12, , 16]}
34
+
35
+ // Object: named breakpoints
36
+ p={{ _: 8, sm: 16 }}
37
+ ```
38
+
39
+ Both generate equivalent `@media` queries. Available in `.styles()`, `.variant()`, `.states()`, and component props.
package/README.md CHANGED
@@ -1,86 +1 @@
1
- # Animus
2
-
3
- This is an experimental package for creating dynamic and typesafe style props.
4
-
5
- ## Usage
6
-
7
- Configure your props with a simple configuration object. The keys of your object become your prop names and their values describe their responsibilities and valid types.
8
-
9
- ```tsx
10
- import styled from '@emotion/styled';
11
- import { create } from '@animus-ui/core';
12
-
13
- const Container = styled.div(
14
- create({
15
- w: { property: 'width' },
16
- p: { property: 'padding', scale: 'spacing' },
17
- })
18
- );
19
-
20
- <Container w="100%" p={[16, 24]}>
21
- Contained!
22
- </Container>;
23
- ```
24
-
25
- ## Composition
26
-
27
- You can compose props that you've created seperately to create new prop functions.
28
-
29
- ```tsx
30
- import { create } from '@animus-ui/core';
31
-
32
- const spacing = create({
33
- m: { property: 'padding', scale: 'margin' },
34
- p: { property: 'padding', scale: 'spacing' },
35
- });
36
-
37
- const dimensions = create({
38
- w: { property: 'width' },
39
- h: { property: 'height' },
40
- });
41
-
42
- const combinedProps = compose(spacing, dimensions);
43
-
44
- const Box = styled.div(combinedProps);
45
- ```
46
-
47
- ## Static CSS
48
-
49
- ```tsx
50
- import styled from '@emotion/styled';
51
- import { create } from '@animus-ui/core';
52
-
53
- const css = createCss({
54
- m: { property: 'padding', scale: 'margin' },
55
- p: { property: 'padding', scale: 'spacing' },
56
- });
57
-
58
- const MyCoolThing = styled.div(
59
- css({
60
- width: '100%',
61
- height: '500px',
62
- p: [32, , 64],
63
- })
64
- );
65
-
66
- const variant = createVariant({
67
- m: { property: 'padding', scale: 'margin' },
68
- p: { property: 'padding', scale: 'spacing' },
69
- });
70
-
71
- const MyCoolThing = styled.div(
72
- variant({
73
- base: { width: '100%' },
74
- variants: {
75
- big: {
76
- height: '500px',
77
- p: [32, , 64],
78
- },
79
- small: {
80
- height: '250px',
81
- p: [16, , 32],
82
- },
83
- },
84
- })
85
- );
86
- ```
1
+ # `animus-ui/core`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@animus-ui/core",
3
- "description": "Constraint based CSS in JS for building scalable design systems",
4
- "version": "0.0.1-fb698e5b.0+fb698e5",
3
+ "description": "Constraint based CSS in JS Foundations",
4
+ "version": "0.1.0-next.8",
5
5
  "keywords": [
6
6
  "emotion",
7
7
  "css",
@@ -10,9 +10,9 @@
10
10
  ],
11
11
  "author": "codecaaron <airrobb@gmail.com>",
12
12
  "license": "MIT",
13
- "main": "dist/index.cjs.js",
14
- "module": "dist/index.esm.js",
15
- "types": "dist/index.d.ts",
13
+ "module": "./dist/index.mjs",
14
+ "main": "./dist/index.mjs",
15
+ "types": "./dist/index.d.ts",
16
16
  "publishConfig": {
17
17
  "access": "public"
18
18
  },
@@ -21,18 +21,17 @@
21
21
  "url": "git+https://github.com/codecaaron/animus"
22
22
  },
23
23
  "scripts": {
24
- "build:clean": "rm -rf ./dist",
25
- "build": "yarn build:clean && rollup -c",
26
- "lernaBuildTask": "yarn build"
24
+ "build": "tsdown && tsc -p tsconfig.build.json",
25
+ "compile": "tsc --noEmit"
27
26
  },
28
27
  "peerDependencies": {
29
- "@emotion/react": ">=11.0.0",
30
- "@emotion/styled": ">=11.0.0",
31
28
  "lodash": "*",
32
29
  "typescript": ">=4.3.5"
33
30
  },
34
31
  "dependencies": {
35
- "csstype": "^3.0.7"
36
- },
37
- "gitHead": "fb698e5b65cdb6e4af5e85e62fadc9ae1a3bf7bf"
32
+ "@emotion/is-prop-valid": "^1.3.1",
33
+ "@emotion/react": "^11.14.0",
34
+ "@emotion/styled": "^11.14.0",
35
+ "csstype": "^3.1.3"
36
+ }
38
37
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "emitDeclarationOnly": true,
5
+ "declaration": true,
6
+ "declarationMap": true
7
+ }
8
+ }
package/tsconfig.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
+ "rootDir": "./src",
4
5
  "outDir": "./dist"
5
6
  },
6
- "include": ["../../typings/*.d.ts", "./src/**/*.ts", "./src/**/*.tsx"],
7
- "exclude": ["./**/*.test.tsx", "./**/*.test.ts"]
7
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
8
+ "exclude": ["**/*.test.ts", "**/*.test.tsx"]
8
9
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Aaron Robb
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/babel.config.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- extends: '../../babel.config.js',
3
- include: ['./src/**/*.ts', './src/**/*.tsx'],
4
- ignore: ['./**/*.d.ts', '__tests__'],
5
- };
@@ -1,82 +0,0 @@
1
- /// <reference types="react" />
2
- import { Parser, Prop, SystemProps, TransformerMap } from './types/config';
3
- import { AbstractProps, CSSPropMap, CSSProps, CSSObject, ThemeProps } from './types/props';
4
- import { Arg, PropConfig } from './types/config';
5
- export declare class AnimusWithAll<C extends PropConfig, P extends Parser<TransformerMap<C['props']>>, Base extends CSSProps<AbstractProps, SystemProps<P>>, Variants extends Record<string, {
6
- prop?: any;
7
- defaultVariant?: any;
8
- base?: CSSProps<AbstractProps, SystemProps<P>>;
9
- variants: CSSPropMap<AbstractProps, SystemProps<P>>;
10
- }>, States extends CSSPropMap<AbstractProps, SystemProps<P>>, G extends (keyof C['groups'])[] | never[]> {
11
- props: C;
12
- parser: P;
13
- groups: G;
14
- base: Base;
15
- statesConfig: States;
16
- variants: Variants;
17
- constructor(props: C, parser: P, base: Base, variants: Variants, states: States, groups: G);
18
- asComponent<T extends keyof JSX.IntrinsicElements>(component: T): import("@emotion/styled").StyledComponent<{
19
- theme?: import("@emotion/react").Theme | undefined;
20
- as?: import("react").ElementType<any> | undefined;
21
- } & { [K_3 in keyof ThemeProps<{ [K in keyof Arg<P>]?: Arg<P>[K] | undefined; } & { [K_1 in keyof Variants]?: keyof Variants[K_1]["variants"] | undefined; } & { [K_2 in keyof States]?: boolean | undefined; }>]: ThemeProps<{ [K in keyof Arg<P>]?: Arg<P>[K] | undefined; } & { [K_1 in keyof Variants]?: keyof Variants[K_1]["variants"] | undefined; } & { [K_2 in keyof States]?: boolean | undefined; }>[K_3]; }, JSX.IntrinsicElements[T], {}>;
22
- build(): (props: ThemeProps<{ [K in keyof Arg<P>]?: Arg<P>[K] | undefined; } & { [K_1 in keyof Variants]?: keyof Variants[K_1]["variants"] | undefined; } & { [K_2 in keyof States]?: boolean | undefined; }>) => CSSObject;
23
- }
24
- declare class AnimusWithSystem<C extends PropConfig, P extends Parser<TransformerMap<C['props']>>, Base extends CSSProps<AbstractProps, SystemProps<P>>, Variants extends Record<string, {
25
- prop?: any;
26
- defaultVariant?: any;
27
- base?: CSSProps<AbstractProps, SystemProps<P>>;
28
- variants: CSSPropMap<AbstractProps, SystemProps<P>>;
29
- }>, States extends CSSPropMap<AbstractProps, SystemProps<P>>, G extends (keyof C['groups'])[] | never[]> extends AnimusWithAll<C, P, Base, Variants, States, G> {
30
- constructor(props: C, parser: P, base: Base, variants: Variants, states: States, groups: G);
31
- customProps<ExtraProps extends Record<string, Prop>>(config: ExtraProps): AnimusWithAll<C & {
32
- props: C["props"] & ExtraProps;
33
- }, Parser<TransformerMap<C["props"] & ExtraProps>>, Base, Variants, States, G>;
34
- }
35
- declare class AnimusWithStates<C extends PropConfig, P extends Parser<TransformerMap<C['props']>>, Base extends CSSProps<AbstractProps, SystemProps<P>>, Variants extends Record<string, {
36
- prop?: any;
37
- defaultVariant?: any;
38
- base?: CSSProps<AbstractProps, SystemProps<P>>;
39
- variants: CSSPropMap<AbstractProps, SystemProps<P>>;
40
- }>, States extends CSSPropMap<AbstractProps, SystemProps<P>>> extends AnimusWithSystem<C, P, Base, Variants, States, []> {
41
- constructor(props: C, parser: P, base: Base, variants: Variants, states: States);
42
- systemProps<PickedGroups extends keyof C['groups']>(config: Record<PickedGroups, true>): AnimusWithSystem<C, P, Base, Variants, States, PickedGroups[]>;
43
- }
44
- declare class AnimusWithVariants<C extends PropConfig, P extends Parser<TransformerMap<C['props']>>, Base extends CSSProps<AbstractProps, SystemProps<P>>, Variants extends Record<string, {
45
- prop?: any;
46
- defaultVariant?: any;
47
- base?: CSSProps<AbstractProps, SystemProps<P>>;
48
- variants: CSSPropMap<AbstractProps, SystemProps<P>>;
49
- }>> extends AnimusWithStates<C, P, Base, Variants, {}> {
50
- constructor(props: C, parser: P, base: Base, variants: Variants);
51
- states<Props extends AbstractProps>(config: CSSPropMap<Props, SystemProps<P>>): AnimusWithStates<C, P, Base, Variants, CSSPropMap<Props, SystemProps<P>>>;
52
- variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
53
- prop?: PropKey;
54
- defaultVariant?: keyof Props;
55
- base?: CSSProps<Base, SystemProps<P>>;
56
- variants: CSSPropMap<Props, SystemProps<P>>;
57
- }): AnimusWithVariants<C, P, Base, Variants & Record<PropKey, {
58
- prop?: PropKey | undefined;
59
- defaultVariant?: keyof Props | undefined;
60
- base?: CSSProps<Base, SystemProps<P>> | undefined;
61
- variants: CSSPropMap<Props, SystemProps<P>>;
62
- }>>;
63
- }
64
- declare class AnimusWithBase<C extends PropConfig, P extends Parser<TransformerMap<C['props']>>, Base extends CSSProps<AbstractProps, SystemProps<P>>> extends AnimusWithVariants<C, P, Base, {}> {
65
- constructor(props: C, parser: P, base: Base);
66
- variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
67
- prop?: PropKey;
68
- defaultVariant?: keyof Props;
69
- base?: CSSProps<Base, SystemProps<P>>;
70
- variants: CSSPropMap<Props, SystemProps<P>>;
71
- }): AnimusWithVariants<C, P, Base, Record<PropKey, {
72
- prop?: PropKey | undefined;
73
- defaultVariant?: keyof Props | undefined;
74
- base?: CSSProps<Base, SystemProps<P>> | undefined;
75
- variants: CSSPropMap<Props, SystemProps<P>>;
76
- }>>;
77
- }
78
- export declare class Animus<C extends PropConfig, P extends Parser<TransformerMap<C['props']>>> extends AnimusWithBase<C, P, {}> {
79
- constructor(config: C);
80
- styles<Props extends AbstractProps>(config: CSSProps<Props, SystemProps<P>>): AnimusWithBase<C, P, CSSProps<Props, SystemProps<P>>>;
81
- }
82
- export {};
@@ -1,11 +0,0 @@
1
- import { PropConfig } from './types/config';
2
- import { Animus } from './animusBuilder';
3
- export declare class AnimusConfig<C extends PropConfig['props'] = {}, G extends Record<string, (keyof C)[]> = {}> {
4
- #private;
5
- constructor(config?: C, groups?: G);
6
- addGroup<Name extends string, Conf extends PropConfig['props'], PropNames extends keyof Conf>(name: Name, config: Conf): AnimusConfig<C & Conf, G & Record<Name, PropNames[]>>;
7
- build(): Animus<{
8
- props: { [K in keyof C]: C[K]; };
9
- groups: { [K_1 in keyof G]: G[K_1]; };
10
- }, import("./types/config").Parser<import("./types/config").TransformerMap<{ [K in keyof C]: C[K]; }>>>;
11
- }
@@ -1,2 +0,0 @@
1
- import { AnimusConfig } from './configBuilder';
2
- export declare const createAnimus: () => AnimusConfig<{}, {}>;
@@ -1,10 +0,0 @@
1
- import { AbstractParser, AbstractPropTransformer, Compose, CSS, Parser, Prop, PropTransformer, States, TransformerMap, Variant } from '../types/config';
2
- export declare const variance: {
3
- createParser<Config extends Record<string, AbstractPropTransformer>>(config: Config): Parser<Config>;
4
- createTransform<P extends string, Config_1 extends Prop>(prop: P, config: Config_1): PropTransformer<P, Config_1>;
5
- compose<Args extends AbstractParser[]>(...parsers: Args): Parser<Compose<Args>>;
6
- createCss<Config_2 extends Record<string, Prop>, P_1 extends Parser<TransformerMap<Config_2>>>(config: Config_2): CSS<P_1>;
7
- createVariant<Config_3 extends Record<string, Prop>, P_2 extends Parser<TransformerMap<Config_3>>>(config: Config_3): Variant<P_2>;
8
- createStates<Config_4 extends Record<string, Prop>, P_3 extends Parser<TransformerMap<Config_4>>>(config: Config_4): States<P_3>;
9
- create<Config_5 extends Record<string, Prop>>(config: Config_5): Parser<TransformerMap<Config_5>>;
10
- };
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("lodash");function e(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var t=e(require("@emotion/styled"));const o=()=>[],s=(r,e)=>{const t=Object.keys(r),o=Object.keys(e);return r=>{const e=[];return t.forEach((t=>{r[t]&&e.push(`${t}-${r[t]}`)})),o.forEach((t=>{r[t]&&e.push(t)})),e}},p=(r,e)=>{const t={},o={};return Object.entries(r).forEach((([r,s])=>{(e.includes(r)?o:t)[r]=s})),[t,o]},i=(e,t,o,s)=>{const{base:i}=t,{parser:a,getMediaSelectors:n,getActiveOverrides:d}=s,{theme:c}=o,l=Object.values(r.pick(t,d(o))),g=n(o),[u,y]=p(a({...i,theme:c},!0),g);for(const r in u)e[r]=u[r];l.forEach((t=>{((e={},t,o,s,i,a)=>{const[n,d]=p(s({...e,theme:i},!0),a);for(const r in n)t[r]=n[r];a.forEach((e=>{const t=d[e];if(!t||r.isEmpty(t))return;o[e]||(o[e]={});const s=o[e];for(const r in t)s[r]=t[r]}))})(t,e,y,a,c,g)})),g.forEach((t=>{const o=y[t];r.isEmpty(o)||(e[t]=o)}))},a=(e,t={},o={},p={},a={})=>{const n=((e={},t={},o={},s)=>{const p={};return Object.entries(e).forEach((([e,t])=>{!s.includes(e)&&r.isObject(t)?r.set(p,[e,"base"],t):r.set(p,["primary","base",e],t)})),Object.entries(t).forEach((([e,{variants:t}])=>{Object.entries(t).forEach((([t,o])=>{const i=`${e}-${t}`;Object.entries(o).forEach((([e,t])=>{!s.includes(e)&&r.isObject(t)?r.set(p,[e,i],t):r.set(p,["primary",i,e],t)}))}))})),Object.entries(o).forEach((([e,t])=>{Object.entries(t).forEach((([t,o])=>{!s.includes(t)&&r.isObject(o)?r.set(p,[t,e],o):r.set(p,["primary",e,t],o)}))})),p})(t,o,p,e.propNames),d={parser:e,getMediaSelectors:({theme:r})=>["xs","sm","md","lg","xl"].map((e=>r?.breakpoints[e])),getActiveOverrides:s(o,p)};return r=>{const{vars:t}=r,o={...t};return Object.entries(n).forEach((([e,t={}])=>{"primary"===e?i(o,t,r,d):(o[e]={},i(o[e],t,r,d))})),i(o,{base:e(r)},r,d),o}},n=["border","borderTop","borderBottom","borderLeft","borderRight","borderWidth","borderStyle","borderColor","background","flex","margin","padding","transition","gap","grid","gridArea","gridColumn","gridRow","gridTemplate","overflow","transition"],d=-1,c=1,l=1,g=(r,e)=>r<e?d:e<r?c:l,u=["_","xs","sm","md","lg","xl"],y=r=>`@media screen and (min-width: ${r}px)`,b={xs:480,sm:768,md:1024,lg:1200,xl:1440},m=(e,t,o,s,p)=>{const i=r.get(o,t);switch(typeof i){case"string":case"number":case"function":return Object.assign(e,s.styleFn(i,t,o));case"object":if(!p.mediaQueries)return;if(a=i,Array.isArray(a))return r.merge(e,((r,e,t,o)=>{const s={},{styleFn:p,prop:i}=t,[a,...n]=r;return a&&Object.assign(s,p(a,i,e)),n.forEach(((r,t)=>{const a=o[t];a&&void 0!==r&&Object.assign(s,{[a]:p(r,i,e)})})),s})(i,o,s,p.mediaQueries.array));if(i&&(e=>r.intersection(Object.keys(e),u).length>0)(i))return r.merge(e,((r,e,t,o)=>{const s={},{styleFn:p,prop:i}=t,{_:a,...n}=r;return a&&Object.assign(s,p(a,i,e)),Object.keys(o).forEach((r=>{const t=n[r];void 0!==t&&Object.assign(s,{[o[r]]:p(t,i,e)})})),s})(i,o,s,p.mediaQueries.map))}var a};function h(e){const t=(r=>Object.keys(r).sort(((e,t)=>{const{[e]:o,[t]:s}=r,{property:p,properties:i=[]}=o,{property:a,properties:u=[]}=s,y=n.includes(p),b=n.includes(a);if(y&&b){const r=i.length,e=u.length;if(p!==a)return g(n.indexOf(p),n.indexOf(a));if(p===a){if(0===r)return d;if(0===e)return c}return g(e,r)}return y?d:b?c:l})))(e),o={mediaQueries:null};return Object.assign(((s,p=!1)=>{const i={},{theme:a}=s;return o.mediaQueries||(o.mediaQueries=(e=>{if(void 0===e)return null;const{xs:t,sm:o,md:s,lg:p,xl:i}=e??{};return{map:r.mapValues(e,y),array:[t,o,s,p,i].map(y)}})(a?.breakpoints??b)),p?Object.keys(s).forEach((t=>{const p=e[t];p?m(i,t,s,p,o):"theme"!==t&&Object.assign(i,{[t]:r.get(s,t)})})):t.forEach((r=>{const t=e[r];m(i,r,s,t,o)})),null!==o.mediaQueries?((e,t)=>{const o=r.omit(e,t);return t.forEach((r=>{e[r]&&(o[r]=e[r])})),o})(i,o.mediaQueries.array):i}),{propNames:t,config:e})}function f(e,t){const{transform:o=r.identity,property:s,properties:p=[s],scale:i}=t,a=(e=>r.isString(e)?(t,o)=>r.get(o,["theme",e,t]):r.isArray(e)?r=>r:r.isObject(e)?t=>r.get(e,t):()=>{})(i),n=void 0===i||r.isArray(i);return{...t,prop:e,styleFn:(e,t,s)=>{const i={};if(r.isUndefined(e))return i;let d,c,l=!1;switch(typeof e){case"number":case"string":c=a(e,s),l=void 0!==c||n,d=c??e;break;case"function":s.theme&&(d=e(s.theme));break;default:return i}return p.forEach((e=>{let t=d;switch(l&&!r.isUndefined(t)&&(t=o(t,e,s)),typeof t){case"number":case"string":return i[e]=t;case"object":return Object.assign(i,t)}})),i}}}function R(r){const e={};for(const t in r)"string"==typeof t&&(e[t]=f(t,r[t]));return h(e)}class x{props={};parser={};groups=[];base={};statesConfig={};variants={};constructor(r,e,t,o,s,p){this.props=r,this.parser=e,this.groups=p,this.base=t,this.statesConfig=s,this.variants=o}asComponent(r){const e=a(this.parser,this.base,this.variants,this.statesConfig,{});return t.default(r)(e)}build(){return a(this.parser,this.base,this.variants,this.statesConfig,{})}}class w extends x{constructor(r,e,t,o,s,p){super(r,e,t,o,s,p)}customProps(r){const e={...this.props.props,...r},t=R(e);return new x({...this.props,props:e},t,this.base,this.variants,this.statesConfig,this.groups)}}class C extends w{constructor(r,e,t,o,s){super(r,e,t,o,s,[])}systemProps(r){return new w(this.props,this.parser,this.base,this.variants,this.statesConfig,Object.keys(r))}}class S extends C{constructor(r,e,t,o){super(r,e,t,o,{})}states(r){return new C(this.props,this.parser,this.base,this.variants,r)}variant(e){const t=e.prop||"variant";return new S(this.props,this.parser,this.base,r.merge(this.variants,{[t]:e}))}}class v extends S{constructor(r,e,t){super(r,e,t,{})}variant(e){const t=e.prop||"variant";return new S(this.props,this.parser,this.base,r.merge(this.variants,{[t]:e}))}}class j extends v{constructor(r){super(r,R(r.props),{})}styles(r){return new v(this.props,this.parser,r)}}class T{#r={};#e={};constructor(r,e){this.#r=r||{},this.#e=e||{}}addGroup(r,e){const t={[r]:Object.keys(e)};return new T({...this.#r,...e},{...this.#e,...t})}build(){return new j({props:this.#r,groups:this.#e})}}const O=()=>new T,A=r=>0===r?r:r<=1&&r>=-1?100*r+"%":`${r}px`,k=/(-?\d*\.?\d+)(%|\w*)/,B=e=>{if(r.isNumber(e))return A(e);if(e.includes("calc"))return e;const[t,o,s]=k.exec(e)||[];if(void 0===t)return e;const p=parseFloat(o);return s?`${p}${s}`:A(p)},W={max:"max-content",min:"min-content"},E=new RegExp(/^[0-9]*$/),L=e=>{var t;return`minmax(0, ${t=e,E.test(t)?`${e}fr`:r.get(W,e,e)})`},G=(r,e)=>{const t=L(r);return e>1?`repeat(${e}, ${t})`:t},$=r=>{const e=r.split(":");let t=["",0],o="";for(let r=0;r<e.length+1;r+=1){const s=o.length>0?" ":"",p=e[r];t?.[0]!==p?(t[0].length&&(o+=s+G(...t)),p&&(t=[p,1])):t[1]+=1}return o},I=e=>r.isNumber(e)?G("1",e):$(e),F={justifySelf:{property:"justifySelf"},alignSelf:{property:"alignSelf"},gridArea:{property:"gridArea"},area:{property:"gridArea"}},z={justifyContent:{property:"justifyContent"},justifyItems:{property:"justifyItems"},alignItems:{property:"alignItems"},alignContent:{property:"alignContent"},...F},H={flexBasis:{property:"flexBasis"},flexShrink:{property:"flexShrink"},flexGrow:{property:"flexGrow"},order:{property:"order"}},Q={flexDirection:{property:"flexDirection"},flexWrap:{property:"flexWrap"},flex:{property:"flex"},...z,...H},X={gridColumn:{property:"gridColumn"},gridRow:{property:"gridRow"},gridColumnStart:{property:"gridColumnStart"},gridRowStart:{property:"gridRowStart"},gridColumnEnd:{property:"gridColumnEnd"},gridRowEnd:{property:"gridRowEnd"}},Y={gridAutoColumns:{property:"gridAutoColumns"},gridAutoRows:{property:"gridAutoRows"},gridTemplateColumns:{property:"gridTemplateColumns"},gridTemplateRows:{property:"gridTemplateRows"},gridTemplateAreas:{property:"gridTemplateAreas"},gridAutoFlow:{property:"gridAutoFlow"},gap:{property:"gap",scale:"spacing"},rowGap:{property:"rowGap",scale:"spacing"},columnGap:{property:"columnGap",scale:"spacing"},flow:{property:"gridAutoFlow",scale:{row:"row",column:"column",dense:"dense","column-dense":"column dense","row-dense":"row dense"}},cols:{property:"gridTemplateColumns",transform:I,scale:[]},rows:{property:"gridTemplateRows",transform:I,scale:[]},autoRows:{property:"gridAutoRows",transform:L},autoCols:{property:"gridAutoColumns",transform:L},alignAll:{property:"justifyContent",properties:["justifyContent","alignItems"]},...z,...X},P={position:{property:"position"},inset:{property:"inset",properties:["top","right","bottom","left"],transform:B},top:{property:"top",transform:B},right:{property:"right",transform:B},bottom:{property:"bottom",transform:B},left:{property:"left",transform:B},zIndex:{property:"zIndex"},opacity:{property:"opacity"}},D={display:{property:"display"},overflow:{property:"overflow"},overflowX:{property:"overflowX"},overflowY:{property:"overflowY"},size:{property:"width",properties:["width","height"],transform:B},width:{property:"width",transform:B},minWidth:{property:"minWidth",transform:B},maxWidth:{property:"maxWidth",transform:B},height:{property:"height",transform:B},minHeight:{property:"minHeight",transform:B},maxHeight:{property:"maxHeight",transform:B},verticalAlign:{property:"verticalAlign"},...F,...X,...H},N={m:{property:"margin",scale:"spacing"},mx:{property:"margin",properties:["marginLeft","marginRight"],scale:"spacing"},my:{property:"margin",properties:["marginTop","marginBottom"],scale:"spacing"},mt:{property:"marginTop",scale:"spacing"},mb:{property:"marginBottom",scale:"spacing"},mr:{property:"marginRight",scale:"spacing"},ml:{property:"marginLeft",scale:"spacing"},p:{property:"padding",scale:"spacing"},px:{property:"padding",properties:["paddingLeft","paddingRight"],scale:"spacing"},py:{property:"padding",properties:["paddingTop","paddingBottom"],scale:"spacing"},pt:{property:"paddingTop",scale:"spacing"},pb:{property:"paddingBottom",scale:"spacing"},pr:{property:"paddingRight",scale:"spacing"},pl:{property:"paddingLeft",scale:"spacing"}},_=O().addGroup("space",N).addGroup("background",{background:{property:"background"},backgroundImage:{property:"backgroundImage"},backgroundSize:{property:"backgroundSize"},backgroundRepeat:{property:"backgroundRepeat"},backgroundPosition:{property:"backgroundPosition"}}).addGroup("layout",D).addGroup("color",{color:{property:"color",scale:"colors"},textColor:{property:"color",scale:"colors"},bg:{property:"backgroundColor",scale:"colors"},borderColor:{property:"borderColor",scale:"colors"},borderColorX:{property:"borderColor",properties:["borderLeftColor","borderRightColor"],scale:"colors"},borderColorY:{property:"borderColor",properties:["borderTopColor","borderBottomColor"],scale:"colors"},borderColorLeft:{property:"borderLeftColor",scale:"colors"},borderColorRight:{property:"borderRightColor",scale:"colors"},borderColorTop:{property:"borderTopColor",scale:"colors"},borderColorBottom:{property:"borderBottomColor",scale:"colors"}}).addGroup("typography",{fontFamily:{property:"fontFamily",scale:"fontFamily"},fontWeight:{property:"fontWeight",scale:{400:400,600:600,700:700}},lineHeight:{property:"lineHeight",scale:"lineHeight",lineHeight:[1,1.5]},fontSize:{property:"fontSize",scale:{64:64,44:44,34:34,26:26,22:22,20:20,18:18,16:16,14:14}},letterSpacing:{property:"letterSpacing"},textAlign:{property:"textAlign"},fontStyle:{property:"fontStyle"},textDecoration:{property:"textDecoration"},textTransform:{property:"textTransform"},whiteSpace:{property:"whiteSpace"}}).addGroup("shadows",{boxShadow:{property:"boxShadow"},textShadow:{property:"textShadow"}}).addGroup("borders",{border:{property:"border",scale:"borders"},borderX:{property:"border",properties:["borderLeft","borderRight"],scale:"borders"},borderY:{property:"border",properties:["borderTop","borderBottom"],scale:"borders"},borderTop:{property:"borderTop",scale:"borders"},borderRight:{property:"borderRight",scale:"borders"},borderBottom:{property:"borderBottom",scale:"borders"},borderLeft:{property:"borderLeft",scale:"borders"},borderWidth:{property:"borderWidth"},borderWidthX:{property:"borderWidth",properties:["borderLeftWidth","borderRightWidth"]},borderWidthY:{property:"borderWidth",properties:["borderTopWidth","borderBottomWidth"]},borderWidthLeft:{property:"borderLeftWidth"},borderWidthRight:{property:"borderRightWidth"},borderWidthTop:{property:"borderTopWidth"},borderWidthBottom:{property:"borderBottomWidth"},borderRadius:{property:"borderRadius",scale:"radii"},borderRadiusLeft:{property:"borderRadius",properties:["borderTopLeftRadius","borderBottomLeftRadius"],scale:"radii"},borderRadiusTop:{property:"borderRadius",properties:["borderTopLeftRadius","borderTopRightRadius"],scale:"radii"},borderRadiusBottom:{property:"borderRadius",properties:["borderBottomLeftRadius","borderBottomRightRadius"],scale:"radii"},borderRadiusRight:{property:"borderRadius",properties:["borderTopRightRadius","borderBottomRightRadius"],scale:"radii"},borderRadiusTopLeft:{property:"borderTopLeftRadius",scale:"radii"},borderRadiusTopRight:{property:"borderTopRightRadius",scale:"radii"},borderRadiusBottomRight:{property:"borderBottomRightRadius",scale:"radii"},borderRadiusBottomLeft:{property:"borderBottomLeftRadius",scale:"radii"},borderStyle:{property:"borderStyle"},borderStyleX:{property:"borderStyle",properties:["borderLeftStyle","borderRightStyle"]},borderStyleY:{property:"borderStyle",properties:["borderTopStyle","borderBottomStyle"]},borderStyleLeft:{property:"borderLeftStyle"},borderStyleRight:{property:"borderRightStyle"},borderStyleTop:{property:"borderTopStyle"},borderStyleBottom:{property:"borderBottomStyle"}}).addGroup("positioning",P).addGroup("flex",Q).addGroup("grid",Y).addGroup("mode",{mode:{property:"none",scale:"mode"},vars:{property:"variables"}}),M=_.build();exports.AnimusConfig=T,exports.animus=M,exports.coreConfig=_,exports.createAnimus=O,exports.createScale=o,exports.gridItem=L,exports.gridItemRatio=I,exports.parseGridRatio=$,exports.percentageOrAbsolute=A,exports.repeatGridItem=G,exports.size=B;