@animus-ui/core 0.1.1-beta.2 → 0.1.1-beta.20

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 (52) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/README.md +1 -86
  3. package/dist/Animus.d.ts +65 -0
  4. package/dist/AnimusConfig.d.ts +8 -0
  5. package/dist/{utils/__fixtures__ → __fixtures__}/testConfig.d.ts +0 -0
  6. package/dist/compatTheme.d.ts +28 -0
  7. package/dist/config.d.ts +2321 -0
  8. package/dist/createAnimus.d.ts +1 -1
  9. package/dist/index.d.ts +507 -1022
  10. package/dist/index.js +2113 -0
  11. package/dist/legacy/compose.d.ts +2 -0
  12. package/dist/legacy/config.d.ts +86 -0
  13. package/dist/legacy/core.d.ts +12 -0
  14. package/dist/legacy/create.d.ts +2 -0
  15. package/dist/{internal → legacy}/createCss.d.ts +1 -1
  16. package/dist/legacy/createParser.d.ts +2 -0
  17. package/dist/{internal → legacy}/createStates.d.ts +1 -1
  18. package/dist/{styles → legacy}/createTransform.d.ts +1 -1
  19. package/dist/{internal → legacy}/createVariant.d.ts +1 -1
  20. package/dist/{utils → legacy}/responsive.d.ts +3 -2
  21. package/dist/properties/getStylePropNames.d.ts +1 -0
  22. package/dist/{utils/propNames.d.ts → properties/orderPropNames.d.ts} +1 -1
  23. package/dist/{utils → properties}/styledOptions.d.ts +0 -0
  24. package/dist/scales/createScale.d.ts +3 -0
  25. package/dist/scales/lookupScaleValue.d.ts +3 -0
  26. package/dist/styles/createParser.d.ts +2 -9
  27. package/dist/styles/createPropertyStyle.d.ts +4 -0
  28. package/dist/styles/createStylist.d.ts +1 -1
  29. package/dist/styles/responsive.d.ts +14 -0
  30. package/dist/transforms/border.d.ts +1 -0
  31. package/dist/transforms/index.d.ts +2 -0
  32. package/dist/transforms/utils.d.ts +2 -0
  33. package/dist/types/config.d.ts +30 -61
  34. package/dist/types/properties.d.ts +8 -10
  35. package/dist/types/props.d.ts +0 -13
  36. package/dist/types/scales.d.ts +2 -0
  37. package/dist/types/shared.d.ts +4 -0
  38. package/dist/types/theme.d.ts +0 -16
  39. package/dist/types/utils.d.ts +1 -0
  40. package/package.json +8 -6
  41. package/tsconfig.json +1 -0
  42. package/dist/animusBuilder.d.ts +0 -81
  43. package/dist/configBuilder.d.ts +0 -11
  44. package/dist/deprecated/core.d.ts +0 -10
  45. package/dist/index.cjs.js +0 -1
  46. package/dist/index.esm.js +0 -1
  47. package/dist/internal/compose.d.ts +0 -2
  48. package/dist/internal/create.d.ts +0 -2
  49. package/dist/props/baseConfig.d.ts +0 -588
  50. package/dist/props/baseScales.d.ts +0 -51
  51. package/dist/scales/createScaleLookup.d.ts +0 -5
  52. package/dist/utils/getStaticProperties.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,150 @@
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
+ ## [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)
7
+
8
+ **Note:** Version bump only for package @animus-ui/core
9
+
10
+
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+ **Note:** Version bump only for package @animus-ui/core
17
+
18
+
19
+
20
+
21
+
22
+ ## [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)
23
+
24
+ **Note:** Version bump only for package @animus-ui/core
25
+
26
+
27
+
28
+
29
+
30
+ ## [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
+
32
+ **Note:** Version bump only for package @animus-ui/core
33
+
34
+
35
+
36
+
37
+
38
+ ## [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)
39
+
40
+ **Note:** Version bump only for package @animus-ui/core
41
+
42
+
43
+
44
+
45
+
46
+ ## [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)
47
+
48
+ **Note:** Version bump only for package @animus-ui/core
49
+
50
+
51
+
52
+
53
+
54
+ ## [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)
55
+
56
+ **Note:** Version bump only for package @animus-ui/core
57
+
58
+
59
+
60
+
61
+
62
+ ## [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)
63
+
64
+ **Note:** Version bump only for package @animus-ui/core
65
+
66
+
67
+
68
+
69
+
70
+ ## [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)
71
+
72
+ **Note:** Version bump only for package @animus-ui/core
73
+
74
+
75
+
76
+
77
+
78
+ ## [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)
79
+
80
+ **Note:** Version bump only for package @animus-ui/core
81
+
82
+
83
+
84
+
85
+
86
+ ## [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)
87
+
88
+ **Note:** Version bump only for package @animus-ui/core
89
+
90
+
91
+
92
+
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
+
99
+
100
+
101
+
102
+ ## [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)
103
+
104
+ **Note:** Version bump only for package @animus-ui/core
105
+
106
+
107
+
108
+
109
+
110
+ ## [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)
111
+
112
+ **Note:** Version bump only for package @animus-ui/core
113
+
114
+
115
+
116
+
117
+
118
+ ## [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)
119
+
120
+ **Note:** Version bump only for package @animus-ui/core
121
+
122
+
123
+
124
+
125
+
126
+ ## [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)
127
+
128
+ **Note:** Version bump only for package @animus-ui/core
129
+
130
+
131
+
132
+
133
+
134
+ ## [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)
135
+
136
+ **Note:** Version bump only for package @animus-ui/core
137
+
138
+
139
+
140
+
141
+
142
+ ## [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)
143
+
144
+ **Note:** Version bump only for package @animus-ui/core
145
+
146
+
147
+
148
+
149
+
6
150
  ## 0.1.1-beta.2 (2022-01-09)
7
151
 
8
152
 
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`
@@ -0,0 +1,65 @@
1
+ /// <reference types="react" />
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
+ asComponent<T extends keyof JSX.IntrinsicElements>(component: T): import("@emotion/styled").StyledComponent<{
17
+ theme?: import("@emotion/react").Theme | undefined;
18
+ as?: import("react").ElementType<any> | undefined;
19
+ } & Omit<{ [K in keyof Arg<BaseParser> as K extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K : never]?: Arg<BaseParser>[K] | undefined; }, "theme" | keyof CustomProps | keyof Variants | keyof States> & { [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]; } & {
20
+ theme?: import("@emotion/react").Theme | undefined;
21
+ }, JSX.IntrinsicElements[T], {}>;
22
+ 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 CustomProps | keyof Variants | keyof States> & { [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;
23
+ }
24
+ 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, {}> {
25
+ constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups);
26
+ props<CustomProps extends Record<string, Prop>>(config: CustomProps): AnimusWithAll<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
27
+ }
28
+ 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, {}> {
29
+ constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States);
30
+ groups<PickedGroups extends keyof GroupRegistry>(config: Record<PickedGroups, true>): AnimusWithSystem<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, Record<PickedGroups, true>>;
31
+ }
32
+ 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, {}> {
33
+ constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants);
34
+ states<Props extends AbstractProps>(config: CSSPropMap<Props, SystemProps<BaseParser>>): AnimusWithStates<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, CSSPropMap<Props, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>>>;
35
+ variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
36
+ prop?: PropKey;
37
+ defaultVariant?: keyof Props;
38
+ base?: CSSProps<Base, SystemProps<BaseParser>>;
39
+ variants: CSSPropMap<Props, SystemProps<BaseParser>>;
40
+ }): AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants & Record<PropKey, {
41
+ prop?: PropKey | undefined;
42
+ defaultVariant?: keyof Props | undefined;
43
+ base?: CSSProps<Base, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>> | undefined;
44
+ variants: CSSPropMap<Props, SystemProps<BaseParser>>;
45
+ }>>;
46
+ }
47
+ 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, {}> {
48
+ constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles);
49
+ variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
50
+ prop?: PropKey;
51
+ defaultVariant?: keyof Props;
52
+ base?: CSSProps<Base, SystemProps<BaseParser>>;
53
+ variants: CSSPropMap<Props, SystemProps<BaseParser>>;
54
+ }): AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Record<PropKey, {
55
+ prop?: PropKey | undefined;
56
+ defaultVariant?: keyof Props | undefined;
57
+ base?: CSSProps<Base, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>> | undefined;
58
+ variants: CSSPropMap<Props, SystemProps<BaseParser>>;
59
+ }>>;
60
+ }
61
+ export declare class Animus<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>> extends AnimusWithBase<PropRegistry, GroupRegistry, BaseParser, {}> {
62
+ constructor(props: PropRegistry, groups: GroupRegistry);
63
+ styles<Props extends AbstractProps>(config: CSSProps<Props, SystemProps<BaseParser>>): AnimusWithBase<PropRegistry, GroupRegistry, BaseParser, CSSProps<Props, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>>>;
64
+ }
65
+ export {};
@@ -0,0 +1,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
+ }
@@ -0,0 +1,28 @@
1
+ export declare const compatTheme: {
2
+ readonly breakpoints: {
3
+ readonly xs: 480;
4
+ readonly sm: 768;
5
+ readonly md: 1024;
6
+ readonly lg: 1200;
7
+ readonly xl: 1440;
8
+ };
9
+ readonly space: readonly [0, 2, 4, 8, 12, 16, 24, 32, 40, 48, 64, 96];
10
+ readonly fontSizes: readonly [64, 44, 34, 26, 22, 20, 18, 16, 14];
11
+ readonly lineHeights: ((string & {}) | (number & {}))[];
12
+ readonly letterSpacings: {};
13
+ readonly fontWeights: ((string & {}) | (number & {}))[];
14
+ readonly fonts: {};
15
+ readonly radii: ((string & {}) | (number & {}))[];
16
+ readonly borders: ((string & {}) | (number & {}))[];
17
+ readonly borderWidths: ((string & {}) | (number & {}))[];
18
+ readonly colors: {};
19
+ readonly gradients: {};
20
+ readonly shadows: {};
21
+ readonly modes: {};
22
+ readonly transitions: {};
23
+ readonly animations: {};
24
+ readonly zIndices: {};
25
+ readonly opacities: {};
26
+ readonly mode: undefined;
27
+ };
28
+ export declare type CompatTheme = typeof compatTheme;