@animus-ui/core 0.1.1-beta.5 → 0.1.1-beta.9
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 +32 -0
- package/README.md +1 -86
- package/dist/Animus.d.ts +63 -0
- package/dist/AnimusConfig.d.ts +8 -0
- package/dist/{utils/__fixtures__ → __fixtures__}/testConfig.d.ts +0 -0
- package/dist/compatTheme.d.ts +20 -0
- package/dist/config.d.ts +2193 -0
- package/dist/createAnimus.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +417 -997
- package/dist/index.esm.js +1 -1
- package/dist/legacy/compose.d.ts +2 -0
- package/dist/legacy/config.d.ts +85 -0
- package/dist/legacy/core.d.ts +12 -0
- package/dist/legacy/create.d.ts +2 -0
- package/dist/{internal → legacy}/createCss.d.ts +1 -1
- package/dist/legacy/createParser.d.ts +9 -0
- package/dist/{internal → legacy}/createStates.d.ts +1 -1
- package/dist/{styles → legacy}/createTransform.d.ts +1 -1
- package/dist/{internal → legacy}/createVariant.d.ts +1 -1
- package/dist/{utils → legacy}/responsive.d.ts +3 -2
- package/dist/properties/getStylePropNames.d.ts +1 -0
- package/dist/{utils/propNames.d.ts → properties/orderPropNames.d.ts} +1 -1
- package/dist/{utils → properties}/styledOptions.d.ts +0 -0
- package/dist/scales/lookupScaleValue.d.ts +3 -0
- package/dist/styles/createParser.d.ts +2 -2
- package/dist/styles/createPropertyStyle.d.ts +3 -0
- package/dist/styles/createStylist.d.ts +1 -1
- package/dist/styles/responsive.d.ts +14 -0
- package/dist/transforms/border.d.ts +1 -0
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/utils.d.ts +2 -0
- package/dist/types/config.d.ts +24 -62
- package/dist/types/properties.d.ts +4 -3
- package/dist/types/props.d.ts +1 -5
- package/dist/types/scales.d.ts +2 -0
- package/dist/types/shared.d.ts +4 -0
- package/dist/types/theme.d.ts +0 -16
- package/dist/types/utils.d.ts +1 -0
- package/package.json +5 -3
- package/dist/animusBuilder.d.ts +0 -81
- package/dist/configBuilder.d.ts +0 -11
- package/dist/deprecated/core.d.ts +0 -10
- package/dist/internal/compose.d.ts +0 -2
- package/dist/internal/create.d.ts +0 -2
- package/dist/props/baseConfig.d.ts +0 -588
- package/dist/props/baseScales.d.ts +0 -51
- package/dist/scales/createScaleLookup.d.ts +0 -5
- package/dist/utils/getStaticProperties.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [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)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [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)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [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)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @animus-ui/core
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [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)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @animus-ui/core
|
package/README.md
CHANGED
|
@@ -1,86 +1 @@
|
|
|
1
|
-
#
|
|
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/dist/Animus.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AbstractProps, CSSPropMap, CSSProps, ThemeProps } from './types/props';
|
|
3
|
+
import { CSSObject } from './types/shared';
|
|
4
|
+
import { Parser, Prop, SystemProps, VariantConfig } from './types/config';
|
|
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
|
+
} & { [K_4 in keyof ThemeProps<{ [K in keyof Arg<BaseParser> as K extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K : never]?: Arg<BaseParser>[K] | undefined; } & { [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]; }>]: ThemeProps<{ [K in keyof Arg<BaseParser> as K extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K : never]?: Arg<BaseParser>[K] | undefined; } & { [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]; }>[K_4]; }, JSX.IntrinsicElements[T], {}>;
|
|
20
|
+
build(): (props: { [K in keyof ThemeProps<{ [K_1 in keyof Arg<BaseParser> as K_1 extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K_1 : never]?: Arg<BaseParser>[K_1] | undefined; } & { [K_2 in keyof Variants]?: keyof Variants[K_2]["variants"] | undefined; } & { [K_3 in keyof States]?: boolean | undefined; } & { [K_4 in keyof import("./types/config").ParserProps<CustomProps>]: import("./types/config").ParserProps<CustomProps>[K_4]; }>]: ThemeProps<{ [K_1 in keyof Arg<BaseParser> as K_1 extends GroupRegistry[Extract<keyof ActiveGroups, keyof GroupRegistry>][number] ? K_1 : never]?: Arg<BaseParser>[K_1] | undefined; } & { [K_2 in keyof Variants]?: keyof Variants[K_2]["variants"] | undefined; } & { [K_3 in keyof States]?: boolean | undefined; } & { [K_4 in keyof import("./types/config").ParserProps<CustomProps>]: import("./types/config").ParserProps<CustomProps>[K_4]; }>[K]; }) => CSSObject;
|
|
21
|
+
}
|
|
22
|
+
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, {}> {
|
|
23
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States, activeGroups: ActiveGroups);
|
|
24
|
+
props<CustomProps extends Record<string, Prop>>(config: CustomProps): AnimusWithAll<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, ActiveGroups, CustomProps>;
|
|
25
|
+
}
|
|
26
|
+
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, {}> {
|
|
27
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants, states: States);
|
|
28
|
+
groups<PickedGroups extends keyof GroupRegistry>(config: Record<PickedGroups, true>): AnimusWithSystem<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, States, Record<PickedGroups, true>>;
|
|
29
|
+
}
|
|
30
|
+
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, {}> {
|
|
31
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles, variants: Variants);
|
|
32
|
+
states<Props extends AbstractProps>(config: CSSPropMap<Props, SystemProps<BaseParser>>): AnimusWithStates<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants, CSSPropMap<Props, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>>>;
|
|
33
|
+
variant<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
34
|
+
prop?: PropKey;
|
|
35
|
+
defaultVariant?: keyof Props;
|
|
36
|
+
base?: CSSProps<Base, SystemProps<BaseParser>>;
|
|
37
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
38
|
+
}): AnimusWithVariants<PropRegistry, GroupRegistry, BaseParser, BaseStyles, Variants & Record<PropKey, {
|
|
39
|
+
prop?: PropKey | undefined;
|
|
40
|
+
defaultVariant?: keyof Props | undefined;
|
|
41
|
+
base?: CSSProps<Base, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>> | undefined;
|
|
42
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
43
|
+
}>>;
|
|
44
|
+
}
|
|
45
|
+
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, {}> {
|
|
46
|
+
constructor(props: PropRegistry, groups: GroupRegistry, parser: BaseParser, base: BaseStyles);
|
|
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 | undefined;
|
|
54
|
+
defaultVariant?: keyof Props | undefined;
|
|
55
|
+
base?: CSSProps<Base, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>> | undefined;
|
|
56
|
+
variants: CSSPropMap<Props, SystemProps<BaseParser>>;
|
|
57
|
+
}>>;
|
|
58
|
+
}
|
|
59
|
+
export declare class Animus<PropRegistry extends Record<string, Prop>, GroupRegistry extends Record<string, (keyof PropRegistry)[]>, BaseParser extends Parser<PropRegistry>> extends AnimusWithBase<PropRegistry, GroupRegistry, BaseParser, {}> {
|
|
60
|
+
constructor(props: PropRegistry, groups: GroupRegistry);
|
|
61
|
+
styles<Props extends AbstractProps>(config: CSSProps<Props, SystemProps<BaseParser>>): AnimusWithBase<PropRegistry, GroupRegistry, BaseParser, CSSProps<Props, SystemProps<BaseParser, Omit<Arg<BaseParser>, "theme">>>>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Prop } from './types/config';
|
|
2
|
+
import { Animus } from './Animus';
|
|
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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const compatTheme: {
|
|
2
|
+
readonly spacing: readonly [0, 4, 8, 12, 16, 24, 32, 40, 48, 64, 96];
|
|
3
|
+
readonly fontSize: readonly [64, 44, 34, 26, 22, 20, 18, 16, 14];
|
|
4
|
+
readonly lineHeight: {
|
|
5
|
+
readonly body: 1.5;
|
|
6
|
+
readonly heading: 1;
|
|
7
|
+
};
|
|
8
|
+
readonly fontWeight: readonly [400, 600, 700];
|
|
9
|
+
readonly fontFamily: {
|
|
10
|
+
readonly body: "Verdana, sans-serif";
|
|
11
|
+
readonly heading: "Verdana, Lato, sans-serif";
|
|
12
|
+
readonly monospace: "monospace";
|
|
13
|
+
};
|
|
14
|
+
readonly radii: readonly [2, 4, 6, 8];
|
|
15
|
+
readonly borders: readonly [1, 2, 3];
|
|
16
|
+
readonly colors: {};
|
|
17
|
+
readonly modes: {};
|
|
18
|
+
readonly mode: undefined;
|
|
19
|
+
};
|
|
20
|
+
export declare type CompatTheme = typeof compatTheme;
|