@codecademy/variance 0.21.0 → 0.21.1-alpha.63b306.0
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/package.json +3 -3
- package/dist/core.d.ts +0 -10
- package/dist/core.js +0 -222
- package/dist/createTheme/createTheme.d.ts +0 -55
- package/dist/createTheme/createTheme.js +0 -150
- package/dist/createTheme/createTheme.test.js +0 -192
- package/dist/createTheme/index.d.ts +0 -3
- package/dist/createTheme/index.js +0 -3
- package/dist/createTheme/types.d.ts +0 -42
- package/dist/createTheme/types.js +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/scales/createScale.d.ts +0 -3
- package/dist/scales/createScale.js +0 -3
- package/dist/scales/createScaleLookup.d.ts +0 -5
- package/dist/scales/createScaleLookup.js +0 -21
- package/dist/transforms/index.d.ts +0 -1
- package/dist/transforms/index.js +0 -1
- package/dist/transforms/transformSize.d.ts +0 -2
- package/dist/transforms/transformSize.js +0 -35
- package/dist/types/config.d.ts +0 -71
- package/dist/types/config.js +0 -1
- package/dist/types/properties.d.ts +0 -22
- package/dist/types/properties.js +0 -1
- package/dist/types/props.d.ts +0 -47
- package/dist/types/props.js +0 -1
- package/dist/types/theme.d.ts +0 -17
- package/dist/types/theme.js +0 -1
- package/dist/types/utils.d.ts +0 -3
- package/dist/types/utils.js +0 -1
- package/dist/utils/__fixtures__/testConfig.d.ts +0 -153
- package/dist/utils/__fixtures__/testConfig.js +0 -153
- package/dist/utils/flattenScale.d.ts +0 -20
- package/dist/utils/flattenScale.js +0 -23
- package/dist/utils/getStaticProperties.d.ts +0 -1
- package/dist/utils/getStaticProperties.js +0 -6
- package/dist/utils/propNames.d.ts +0 -6
- package/dist/utils/propNames.js +0 -45
- package/dist/utils/responsive.d.ts +0 -16
- package/dist/utils/responsive.js +0 -81
- package/dist/utils/serializeTokens.d.ts +0 -18
- package/dist/utils/serializeTokens.js +0 -36
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from '../types/props';
|
|
2
|
-
import { AbstractTheme } from '../types/theme';
|
|
3
|
-
/**
|
|
4
|
-
* This is a custom generic that ensures the safety of adding additional values to a theme object without accidentally wiping out
|
|
5
|
-
* required keys like `breakpoints`. It works by creating a new mapped type and merging the values of the union of Base & Next:
|
|
6
|
-
* 1. If the key exists on both Base and Next return the intersection of both values
|
|
7
|
-
* 2. If the key exists on next use the value on next.
|
|
8
|
-
* 3. If the key exists on base but nothing else use the value on base.
|
|
9
|
-
*
|
|
10
|
-
* The resulting type is then rejoined with keys that cannot be mutated (breakpoints) as the next version of Theme
|
|
11
|
-
*/
|
|
12
|
-
export declare type MergeTheme<Base extends AbstractTheme, Next, Unmergable = Record<'breakpoints', Base['breakpoints']>> = Unmergable & Merge<Base, Next>;
|
|
13
|
-
/** This merges at 2 levels of depth */
|
|
14
|
-
export declare type Merge<A, B> = {
|
|
15
|
-
[K in keyof (A & B)]: K extends keyof B ? K extends keyof A ? AssignValueIfUnmergable<A[K], B[K]> : B[K] : K extends keyof A ? A[K] : never;
|
|
16
|
-
};
|
|
17
|
-
/** Extract mergable objects */
|
|
18
|
-
export declare type Mergable<T> = Exclude<T, ((...args: any) => any) | string | boolean | symbol | number | any[]>;
|
|
19
|
-
/** Return B if either A or B is unmergable */
|
|
20
|
-
export declare type AssignValueIfUnmergable<A, B> = Mergable<A> extends never ? B : Mergable<B> extends never ? B : Assign<A, B>;
|
|
21
|
-
/** Prefer all values from B */
|
|
22
|
-
export declare type Assign<A, B> = {
|
|
23
|
-
[K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
|
|
24
|
-
};
|
|
25
|
-
/** These are keys that are consistent for all theme builds - they are loosely typed as they are not meant to be accessed directly */
|
|
26
|
-
export declare type PrivateThemeKeys = {
|
|
27
|
-
_variables: Record<string, CSSObject>;
|
|
28
|
-
_tokens: Record<string | number, any>;
|
|
29
|
-
};
|
|
30
|
-
/** This allows 3 layers of color aliases to be constructed when adding colorModes
|
|
31
|
-
* @example
|
|
32
|
-
* {
|
|
33
|
-
* button: {
|
|
34
|
-
* bg: {
|
|
35
|
-
* hover: 'someAlias'
|
|
36
|
-
* }
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* `button-bg-hover`
|
|
41
|
-
* */
|
|
42
|
-
export declare type ColorModeConfig<Colors> = Record<string, Colors | Record<string, Colors> | Record<string, Colors | Record<string, Colors>>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Prop } from '../types/config';
|
|
2
|
-
import { ThemeProps } from '../types/props';
|
|
3
|
-
declare type GetScaleValue = (val: string | number, props: ThemeProps) => string | number | undefined;
|
|
4
|
-
export declare const createScaleLookup: (scale: Prop['scale']) => GetScaleValue;
|
|
5
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { get, isArray, isObject, isString } from 'lodash';
|
|
2
|
-
export var createScaleLookup = function createScaleLookup(scale) {
|
|
3
|
-
if (isString(scale)) {
|
|
4
|
-
return function (val, props) {
|
|
5
|
-
return get(props, ['theme', scale, val]);
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
if (isArray(scale)) {
|
|
9
|
-
return function (val) {
|
|
10
|
-
return val;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
if (isObject(scale)) {
|
|
14
|
-
return function (val) {
|
|
15
|
-
return get(scale, val);
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
return function () {
|
|
19
|
-
return undefined;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './transformSize';
|
package/dist/transforms/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './transformSize';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { isNumber } from 'lodash';
|
|
8
|
-
export var percentageOrAbsolute = function percentageOrAbsolute(coordinate) {
|
|
9
|
-
if (coordinate === 0) {
|
|
10
|
-
return coordinate;
|
|
11
|
-
}
|
|
12
|
-
if (coordinate <= 1 && coordinate >= -1) {
|
|
13
|
-
return "".concat(coordinate * 100, "%");
|
|
14
|
-
}
|
|
15
|
-
return "".concat(coordinate, "px");
|
|
16
|
-
};
|
|
17
|
-
var valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
|
|
18
|
-
export var transformSize = function transformSize(value) {
|
|
19
|
-
if (isNumber(value)) {
|
|
20
|
-
return percentageOrAbsolute(value);
|
|
21
|
-
}
|
|
22
|
-
if (value.includes('calc')) {
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
var _ref = valueWithUnit.exec(value) || [],
|
|
26
|
-
_ref2 = _slicedToArray(_ref, 3),
|
|
27
|
-
match = _ref2[0],
|
|
28
|
-
number = _ref2[1],
|
|
29
|
-
unit = _ref2[2];
|
|
30
|
-
if (match === undefined) {
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
var numericValue = parseFloat(number);
|
|
34
|
-
return !unit ? percentageOrAbsolute(numericValue) : "".concat(numericValue).concat(unit);
|
|
35
|
-
};
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Theme } from '@emotion/react';
|
|
2
|
-
import { DefaultCSSPropertyValue, PropertyTypes } from './properties';
|
|
3
|
-
import { AbstractProps, CSSObject, CSSPropMap, CSSProps, ResponsiveProp, ThemeProps } from './props';
|
|
4
|
-
import { AllUnionKeys, Key, KeyFromUnion } from './utils';
|
|
5
|
-
export declare type MapScale = Record<string | number, string | number>;
|
|
6
|
-
export declare type ArrayScale = readonly (string | number)[] & {
|
|
7
|
-
length: 0;
|
|
8
|
-
};
|
|
9
|
-
export interface BaseProperty {
|
|
10
|
-
property: keyof PropertyTypes;
|
|
11
|
-
properties?: readonly (keyof PropertyTypes)[];
|
|
12
|
-
}
|
|
13
|
-
export interface Prop extends BaseProperty {
|
|
14
|
-
scale?: keyof Theme | MapScale | ArrayScale;
|
|
15
|
-
transform?: (val: string | number, prop?: string, props?: AbstractProps) => string | number | CSSObject;
|
|
16
|
-
}
|
|
17
|
-
export interface AbstractPropTransformer extends Prop {
|
|
18
|
-
prop: string;
|
|
19
|
-
styleFn: (value: unknown, prop: string, props: AbstractProps) => CSSObject;
|
|
20
|
-
}
|
|
21
|
-
export interface AbstractParser {
|
|
22
|
-
(props: AbstractProps): CSSObject;
|
|
23
|
-
propNames: string[];
|
|
24
|
-
config: Record<string, AbstractPropTransformer>;
|
|
25
|
-
}
|
|
26
|
-
export declare type PropertyValues<Property extends keyof PropertyTypes, All extends boolean = false> = Exclude<PropertyTypes<All extends true ? DefaultCSSPropertyValue : never>[Property], All extends true ? never : object | any[]>;
|
|
27
|
-
export declare type ScaleValue<Config extends Prop> = Config['scale'] extends keyof Theme ? keyof Theme[Config['scale']] | PropertyValues<Config['property']> : Config['scale'] extends MapScale ? keyof Config['scale'] | PropertyValues<Config['property']> : Config['scale'] extends ArrayScale ? Config['scale'][number] | PropertyValues<Config['property']> : PropertyValues<Config['property'], true>;
|
|
28
|
-
export declare type Scale<Config extends Prop> = ResponsiveProp<ScaleValue<Config> | ((theme: Theme) => ScaleValue<Config>)>;
|
|
29
|
-
export interface TransformFn<P extends string, Config extends Prop> {
|
|
30
|
-
(value: Scale<Config> | Scale<Config>, prop: P, props: ThemeProps<{
|
|
31
|
-
[K in P]?: Scale<Config>;
|
|
32
|
-
}>): CSSObject;
|
|
33
|
-
}
|
|
34
|
-
export interface PropTransformer<P extends string, C extends Prop> extends AbstractPropTransformer, Prop {
|
|
35
|
-
prop: P;
|
|
36
|
-
styleFn: TransformFn<P, C>;
|
|
37
|
-
}
|
|
38
|
-
export declare type TransformerMap<Config extends Record<string, Prop>> = {
|
|
39
|
-
[P in Key<keyof Config>]: PropTransformer<Key<P>, Config[P]>;
|
|
40
|
-
};
|
|
41
|
-
export interface Parser<Config extends Record<string, AbstractPropTransformer>> {
|
|
42
|
-
(props: ParserProps<Config>): CSSObject;
|
|
43
|
-
propNames: (keyof Config)[];
|
|
44
|
-
config: Config;
|
|
45
|
-
}
|
|
46
|
-
export declare type Compose<Args extends AbstractParser[]> = {
|
|
47
|
-
[K in AllUnionKeys<Args[number]['config']>]: KeyFromUnion<Args[number]['config'], K>;
|
|
48
|
-
};
|
|
49
|
-
export interface Variant<P extends AbstractParser> {
|
|
50
|
-
<Keys extends keyof Props, Base extends AbstractProps, Props extends Record<Keys, AbstractProps>, PropKey extends Readonly<string> = 'variant'>(options: {
|
|
51
|
-
prop?: PropKey;
|
|
52
|
-
defaultVariant?: keyof Props;
|
|
53
|
-
base?: CSSProps<Base, SystemProps<P>>;
|
|
54
|
-
variants: CSSPropMap<Props, SystemProps<P>>;
|
|
55
|
-
}): (props: VariantProps<PropKey, Keys | false> & ThemeProps) => CSSObject;
|
|
56
|
-
}
|
|
57
|
-
export interface States<P extends AbstractParser> {
|
|
58
|
-
<Props extends Record<string, AbstractProps>>(states: CSSPropMap<Props, SystemProps<P>>): (props: Partial<Record<keyof Props, boolean>> & ThemeProps) => CSSObject;
|
|
59
|
-
}
|
|
60
|
-
export interface CSS<P extends AbstractParser> {
|
|
61
|
-
<Props extends AbstractProps>(config: CSSProps<Props, SystemProps<P>>): (props: ThemeProps) => CSSObject;
|
|
62
|
-
}
|
|
63
|
-
export declare type ParserProps<Config extends Record<string, AbstractPropTransformer>> = ThemeProps<{
|
|
64
|
-
[P in keyof Config]?: Parameters<Config[P]['styleFn']>[2][Config[P]['prop']];
|
|
65
|
-
}>;
|
|
66
|
-
export declare type SystemProps<P extends AbstractParser> = {
|
|
67
|
-
[K in keyof Omit<Parameters<P>[0], 'theme'>]: Omit<Parameters<P>[0], 'theme'>[K];
|
|
68
|
-
};
|
|
69
|
-
export declare type VariantProps<T extends string, V> = {
|
|
70
|
-
[Key in T]?: V;
|
|
71
|
-
};
|
package/dist/types/config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Globals, StandardProperties, VendorProperties } from 'csstype';
|
|
2
|
-
declare type ColorProperties = 'color' | `${string}Color`;
|
|
3
|
-
declare type ColorGlobals = {
|
|
4
|
-
[K in Extract<keyof StandardProperties, ColorProperties>]?: Globals | 'currentColor' | 'transparent' | (string & {});
|
|
5
|
-
};
|
|
6
|
-
declare type SizeProperties = 'left' | 'right' | 'top' | 'bottom' | 'inset' | 'width' | 'height' | `${string}${'Width' | 'Height'}`;
|
|
7
|
-
declare type SizeGlobals = {
|
|
8
|
-
[K in Extract<keyof StandardProperties, SizeProperties>]?: StandardProperties[K] | (number & {});
|
|
9
|
-
};
|
|
10
|
-
/** This is a placeholder type for CSS properties that may not have any specific global values (outlineOffset).
|
|
11
|
-
* (string & {}) will allow strings but not generalize the union type to just a string if other string literals exist in the union.
|
|
12
|
-
*
|
|
13
|
-
* This ensures that autosuggestions will still work for literal types but still allow any string for certain properties.
|
|
14
|
-
*/
|
|
15
|
-
export declare type DefaultCSSPropertyValue = (string & {}) | 0;
|
|
16
|
-
export interface PropertyTypes<Overrides = DefaultCSSPropertyValue> extends Omit<StandardProperties<Overrides>, keyof ColorGlobals | keyof SizeGlobals>, ColorGlobals, SizeGlobals {
|
|
17
|
-
}
|
|
18
|
-
export interface VendorPropertyTypes<Overrides = DefaultCSSPropertyValue> extends VendorProperties<Overrides> {
|
|
19
|
-
}
|
|
20
|
-
export interface CSSPropertyTypes<Overrides = DefaultCSSPropertyValue> extends PropertyTypes<Overrides>, VendorPropertyTypes<Overrides> {
|
|
21
|
-
}
|
|
22
|
-
export {};
|
package/dist/types/properties.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/props.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Theme } from '@emotion/react';
|
|
2
|
-
import { AbstractParser, Scale } from './config';
|
|
3
|
-
import { CSSPropertyTypes } from './properties';
|
|
4
|
-
export declare type AbstractProps = ThemeProps<Record<string, unknown>>;
|
|
5
|
-
interface BreakpointKeys<T = string> {
|
|
6
|
-
xs: T;
|
|
7
|
-
sm: T;
|
|
8
|
-
md: T;
|
|
9
|
-
lg: T;
|
|
10
|
-
xl: T;
|
|
11
|
-
}
|
|
12
|
-
export interface BreakpointCache {
|
|
13
|
-
map: BreakpointKeys;
|
|
14
|
-
array: string[];
|
|
15
|
-
}
|
|
16
|
-
export declare type ThemeProps<Props = {}> = Props & {
|
|
17
|
-
theme?: Theme;
|
|
18
|
-
};
|
|
19
|
-
export interface MediaQueryArray<T> {
|
|
20
|
-
0?: T;
|
|
21
|
-
1?: T;
|
|
22
|
-
2?: T;
|
|
23
|
-
3?: T;
|
|
24
|
-
4?: T;
|
|
25
|
-
5?: T;
|
|
26
|
-
}
|
|
27
|
-
export interface MediaQueryMap<T> {
|
|
28
|
-
_?: T;
|
|
29
|
-
xs?: T;
|
|
30
|
-
sm?: T;
|
|
31
|
-
md?: T;
|
|
32
|
-
lg?: T;
|
|
33
|
-
xl?: T;
|
|
34
|
-
}
|
|
35
|
-
export declare type ResponsiveProp<T> = T | MediaQueryMap<T> | MediaQueryArray<T>;
|
|
36
|
-
export interface CSSObject {
|
|
37
|
-
[key: string]: string | number | CSSObject | undefined;
|
|
38
|
-
}
|
|
39
|
-
export declare type CSSPropMap<Props, System> = {
|
|
40
|
-
[K in keyof Props]?: CSSProps<Props[K], System>;
|
|
41
|
-
};
|
|
42
|
-
export declare type CSSProps<Props, System> = {
|
|
43
|
-
[K in keyof Props]?: K extends keyof System ? System[K] : K extends keyof CSSPropertyTypes ? CSSPropertyTypes[K] : Omit<CSSPropertyTypes, keyof System> & Omit<System, 'theme'>;
|
|
44
|
-
};
|
|
45
|
-
export declare type StyleProps<T extends (args: AbstractProps) => CSSObject> = Parameters<T>[0];
|
|
46
|
-
export declare type ScaleValue<P extends AbstractParser, Prop extends keyof P['config']> = Scale<P['config'][Prop]>;
|
|
47
|
-
export {};
|
package/dist/types/props.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/theme.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface Breakpoints<T = string> {
|
|
2
|
-
xs: T;
|
|
3
|
-
sm: T;
|
|
4
|
-
md: T;
|
|
5
|
-
lg: T;
|
|
6
|
-
xl: T;
|
|
7
|
-
}
|
|
8
|
-
export interface BaseTheme {
|
|
9
|
-
breakpoints: Breakpoints;
|
|
10
|
-
}
|
|
11
|
-
export interface AbstractTheme extends BaseTheme {
|
|
12
|
-
readonly [key: string]: any;
|
|
13
|
-
}
|
|
14
|
-
declare module '@emotion/react' {
|
|
15
|
-
interface Theme extends BaseTheme {
|
|
16
|
-
}
|
|
17
|
-
}
|
package/dist/types/theme.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/utils.d.ts
DELETED
package/dist/types/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
export declare const testConfig: {
|
|
2
|
-
readonly textColor: {
|
|
3
|
-
readonly property: "color";
|
|
4
|
-
};
|
|
5
|
-
readonly bg: {
|
|
6
|
-
readonly property: "backgroundColor";
|
|
7
|
-
};
|
|
8
|
-
readonly borderColor: {
|
|
9
|
-
readonly property: "borderColor";
|
|
10
|
-
};
|
|
11
|
-
readonly borderColorX: {
|
|
12
|
-
readonly property: "borderColor";
|
|
13
|
-
readonly properties: readonly ["borderLeftColor", "borderRightColor"];
|
|
14
|
-
readonly scale: "colors";
|
|
15
|
-
};
|
|
16
|
-
readonly borderColorY: {
|
|
17
|
-
readonly property: "borderColor";
|
|
18
|
-
readonly properties: readonly ["borderTopColor", "borderBottomColor"];
|
|
19
|
-
readonly scale: "colors";
|
|
20
|
-
};
|
|
21
|
-
readonly borderColorLeft: {
|
|
22
|
-
readonly property: "borderLeftColor";
|
|
23
|
-
};
|
|
24
|
-
readonly borderColorRight: {
|
|
25
|
-
readonly property: "borderRightColor";
|
|
26
|
-
};
|
|
27
|
-
readonly borderColorTop: {
|
|
28
|
-
readonly property: "borderTopColor";
|
|
29
|
-
};
|
|
30
|
-
readonly borderColorBottom: {
|
|
31
|
-
readonly property: "borderBottomColor";
|
|
32
|
-
};
|
|
33
|
-
readonly border: {
|
|
34
|
-
readonly property: "border";
|
|
35
|
-
};
|
|
36
|
-
readonly borderX: {
|
|
37
|
-
readonly property: "border";
|
|
38
|
-
readonly properties: readonly ["borderLeft", "borderRight"];
|
|
39
|
-
};
|
|
40
|
-
readonly borderY: {
|
|
41
|
-
readonly property: "border";
|
|
42
|
-
readonly properties: readonly ["borderTop", "borderBottom"];
|
|
43
|
-
};
|
|
44
|
-
readonly borderTop: {
|
|
45
|
-
readonly property: "borderTop";
|
|
46
|
-
};
|
|
47
|
-
readonly borderRight: {
|
|
48
|
-
readonly property: "borderRight";
|
|
49
|
-
};
|
|
50
|
-
readonly borderBottom: {
|
|
51
|
-
readonly property: "borderBottom";
|
|
52
|
-
};
|
|
53
|
-
readonly borderLeft: {
|
|
54
|
-
readonly property: "borderLeft";
|
|
55
|
-
};
|
|
56
|
-
readonly borderWidth: {
|
|
57
|
-
readonly property: "borderWidth";
|
|
58
|
-
};
|
|
59
|
-
readonly borderWidthX: {
|
|
60
|
-
readonly property: "borderWidth";
|
|
61
|
-
readonly properties: readonly ["borderLeftWidth", "borderRightWidth"];
|
|
62
|
-
};
|
|
63
|
-
readonly borderWidthY: {
|
|
64
|
-
readonly property: "borderWidth";
|
|
65
|
-
readonly properties: readonly ["borderTopWidth", "borderBottomWidth"];
|
|
66
|
-
};
|
|
67
|
-
readonly borderRadius: {
|
|
68
|
-
readonly property: "borderRadius";
|
|
69
|
-
};
|
|
70
|
-
readonly borderRadiusLeft: {
|
|
71
|
-
readonly property: "borderRadius";
|
|
72
|
-
readonly properties: readonly ["borderTopLeftRadius", "borderBottomLeftRadius"];
|
|
73
|
-
};
|
|
74
|
-
readonly borderRadiusTop: {
|
|
75
|
-
readonly property: "borderRadius";
|
|
76
|
-
readonly properties: readonly ["borderTopLeftRadius", "borderTopRightRadius"];
|
|
77
|
-
};
|
|
78
|
-
readonly borderRadiusBottom: {
|
|
79
|
-
readonly property: "borderRadius";
|
|
80
|
-
readonly properties: readonly ["borderBottomLeftRadius", "borderBottomRightRadius"];
|
|
81
|
-
};
|
|
82
|
-
readonly borderRadiusRight: {
|
|
83
|
-
readonly property: "borderRadius";
|
|
84
|
-
readonly properties: readonly ["borderTopRightRadius", "borderBottomRightRadius"];
|
|
85
|
-
};
|
|
86
|
-
readonly borderStyle: {
|
|
87
|
-
readonly property: "borderStyle";
|
|
88
|
-
};
|
|
89
|
-
readonly borderStyleX: {
|
|
90
|
-
readonly property: "borderStyle";
|
|
91
|
-
readonly properties: readonly ["borderLeftStyle", "borderRightStyle"];
|
|
92
|
-
};
|
|
93
|
-
readonly borderStyleY: {
|
|
94
|
-
readonly property: "borderStyle";
|
|
95
|
-
readonly properties: readonly ["borderTopStyle", "borderBottomStyle"];
|
|
96
|
-
};
|
|
97
|
-
readonly flex: {
|
|
98
|
-
readonly property: "flex";
|
|
99
|
-
};
|
|
100
|
-
readonly flexBasis: {
|
|
101
|
-
readonly property: "flexBasis";
|
|
102
|
-
};
|
|
103
|
-
readonly p: {
|
|
104
|
-
readonly property: "padding";
|
|
105
|
-
};
|
|
106
|
-
readonly px: {
|
|
107
|
-
readonly property: "padding";
|
|
108
|
-
readonly properties: readonly ["paddingLeft", "paddingRight"];
|
|
109
|
-
readonly scale: "spacing";
|
|
110
|
-
};
|
|
111
|
-
readonly py: {
|
|
112
|
-
readonly property: "padding";
|
|
113
|
-
readonly properties: readonly ["paddingTop", "paddingBottom"];
|
|
114
|
-
readonly scale: "spacing";
|
|
115
|
-
};
|
|
116
|
-
readonly pt: {
|
|
117
|
-
readonly property: "paddingTop";
|
|
118
|
-
};
|
|
119
|
-
readonly pb: {
|
|
120
|
-
readonly property: "paddingBottom";
|
|
121
|
-
};
|
|
122
|
-
readonly pr: {
|
|
123
|
-
readonly property: "paddingRight";
|
|
124
|
-
};
|
|
125
|
-
readonly pl: {
|
|
126
|
-
readonly property: "paddingLeft";
|
|
127
|
-
};
|
|
128
|
-
readonly m: {
|
|
129
|
-
readonly property: "margin";
|
|
130
|
-
};
|
|
131
|
-
readonly mx: {
|
|
132
|
-
readonly property: "margin";
|
|
133
|
-
readonly properties: readonly ["marginLeft", "marginRight"];
|
|
134
|
-
readonly scale: "spacing";
|
|
135
|
-
};
|
|
136
|
-
readonly my: {
|
|
137
|
-
readonly property: "margin";
|
|
138
|
-
readonly properties: readonly ["marginTop", "marginBottom"];
|
|
139
|
-
readonly scale: "spacing";
|
|
140
|
-
};
|
|
141
|
-
readonly mt: {
|
|
142
|
-
readonly property: "marginTop";
|
|
143
|
-
};
|
|
144
|
-
readonly mb: {
|
|
145
|
-
readonly property: "marginBottom";
|
|
146
|
-
};
|
|
147
|
-
readonly mr: {
|
|
148
|
-
readonly property: "marginRight";
|
|
149
|
-
};
|
|
150
|
-
readonly ml: {
|
|
151
|
-
readonly property: "marginLeft";
|
|
152
|
-
};
|
|
153
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
export var testConfig = {
|
|
2
|
-
textColor: {
|
|
3
|
-
property: 'color'
|
|
4
|
-
},
|
|
5
|
-
bg: {
|
|
6
|
-
property: 'backgroundColor'
|
|
7
|
-
},
|
|
8
|
-
borderColor: {
|
|
9
|
-
property: 'borderColor'
|
|
10
|
-
},
|
|
11
|
-
borderColorX: {
|
|
12
|
-
property: 'borderColor',
|
|
13
|
-
properties: ['borderLeftColor', 'borderRightColor'],
|
|
14
|
-
scale: 'colors'
|
|
15
|
-
},
|
|
16
|
-
borderColorY: {
|
|
17
|
-
property: 'borderColor',
|
|
18
|
-
properties: ['borderTopColor', 'borderBottomColor'],
|
|
19
|
-
scale: 'colors'
|
|
20
|
-
},
|
|
21
|
-
borderColorLeft: {
|
|
22
|
-
property: 'borderLeftColor'
|
|
23
|
-
},
|
|
24
|
-
borderColorRight: {
|
|
25
|
-
property: 'borderRightColor'
|
|
26
|
-
},
|
|
27
|
-
borderColorTop: {
|
|
28
|
-
property: 'borderTopColor'
|
|
29
|
-
},
|
|
30
|
-
borderColorBottom: {
|
|
31
|
-
property: 'borderBottomColor'
|
|
32
|
-
},
|
|
33
|
-
border: {
|
|
34
|
-
property: 'border'
|
|
35
|
-
},
|
|
36
|
-
borderX: {
|
|
37
|
-
property: 'border',
|
|
38
|
-
properties: ['borderLeft', 'borderRight']
|
|
39
|
-
},
|
|
40
|
-
borderY: {
|
|
41
|
-
property: 'border',
|
|
42
|
-
properties: ['borderTop', 'borderBottom']
|
|
43
|
-
},
|
|
44
|
-
borderTop: {
|
|
45
|
-
property: 'borderTop'
|
|
46
|
-
},
|
|
47
|
-
borderRight: {
|
|
48
|
-
property: 'borderRight'
|
|
49
|
-
},
|
|
50
|
-
borderBottom: {
|
|
51
|
-
property: 'borderBottom'
|
|
52
|
-
},
|
|
53
|
-
borderLeft: {
|
|
54
|
-
property: 'borderLeft'
|
|
55
|
-
},
|
|
56
|
-
borderWidth: {
|
|
57
|
-
property: 'borderWidth'
|
|
58
|
-
},
|
|
59
|
-
borderWidthX: {
|
|
60
|
-
property: 'borderWidth',
|
|
61
|
-
properties: ['borderLeftWidth', 'borderRightWidth']
|
|
62
|
-
},
|
|
63
|
-
borderWidthY: {
|
|
64
|
-
property: 'borderWidth',
|
|
65
|
-
properties: ['borderTopWidth', 'borderBottomWidth']
|
|
66
|
-
},
|
|
67
|
-
borderRadius: {
|
|
68
|
-
property: 'borderRadius'
|
|
69
|
-
},
|
|
70
|
-
borderRadiusLeft: {
|
|
71
|
-
property: 'borderRadius',
|
|
72
|
-
properties: ['borderTopLeftRadius', 'borderBottomLeftRadius']
|
|
73
|
-
},
|
|
74
|
-
borderRadiusTop: {
|
|
75
|
-
property: 'borderRadius',
|
|
76
|
-
properties: ['borderTopLeftRadius', 'borderTopRightRadius']
|
|
77
|
-
},
|
|
78
|
-
borderRadiusBottom: {
|
|
79
|
-
property: 'borderRadius',
|
|
80
|
-
properties: ['borderBottomLeftRadius', 'borderBottomRightRadius']
|
|
81
|
-
},
|
|
82
|
-
borderRadiusRight: {
|
|
83
|
-
property: 'borderRadius',
|
|
84
|
-
properties: ['borderTopRightRadius', 'borderBottomRightRadius']
|
|
85
|
-
},
|
|
86
|
-
borderStyle: {
|
|
87
|
-
property: 'borderStyle'
|
|
88
|
-
},
|
|
89
|
-
borderStyleX: {
|
|
90
|
-
property: 'borderStyle',
|
|
91
|
-
properties: ['borderLeftStyle', 'borderRightStyle']
|
|
92
|
-
},
|
|
93
|
-
borderStyleY: {
|
|
94
|
-
property: 'borderStyle',
|
|
95
|
-
properties: ['borderTopStyle', 'borderBottomStyle']
|
|
96
|
-
},
|
|
97
|
-
flex: {
|
|
98
|
-
property: 'flex'
|
|
99
|
-
},
|
|
100
|
-
flexBasis: {
|
|
101
|
-
property: 'flexBasis'
|
|
102
|
-
},
|
|
103
|
-
p: {
|
|
104
|
-
property: 'padding'
|
|
105
|
-
},
|
|
106
|
-
px: {
|
|
107
|
-
property: 'padding',
|
|
108
|
-
properties: ['paddingLeft', 'paddingRight'],
|
|
109
|
-
scale: 'spacing'
|
|
110
|
-
},
|
|
111
|
-
py: {
|
|
112
|
-
property: 'padding',
|
|
113
|
-
properties: ['paddingTop', 'paddingBottom'],
|
|
114
|
-
scale: 'spacing'
|
|
115
|
-
},
|
|
116
|
-
pt: {
|
|
117
|
-
property: 'paddingTop'
|
|
118
|
-
},
|
|
119
|
-
pb: {
|
|
120
|
-
property: 'paddingBottom'
|
|
121
|
-
},
|
|
122
|
-
pr: {
|
|
123
|
-
property: 'paddingRight'
|
|
124
|
-
},
|
|
125
|
-
pl: {
|
|
126
|
-
property: 'paddingLeft'
|
|
127
|
-
},
|
|
128
|
-
m: {
|
|
129
|
-
property: 'margin'
|
|
130
|
-
},
|
|
131
|
-
mx: {
|
|
132
|
-
property: 'margin',
|
|
133
|
-
properties: ['marginLeft', 'marginRight'],
|
|
134
|
-
scale: 'spacing'
|
|
135
|
-
},
|
|
136
|
-
my: {
|
|
137
|
-
property: 'margin',
|
|
138
|
-
properties: ['marginTop', 'marginBottom'],
|
|
139
|
-
scale: 'spacing'
|
|
140
|
-
},
|
|
141
|
-
mt: {
|
|
142
|
-
property: 'marginTop'
|
|
143
|
-
},
|
|
144
|
-
mb: {
|
|
145
|
-
property: 'marginBottom'
|
|
146
|
-
},
|
|
147
|
-
mr: {
|
|
148
|
-
property: 'marginRight'
|
|
149
|
-
},
|
|
150
|
-
ml: {
|
|
151
|
-
property: 'marginLeft'
|
|
152
|
-
}
|
|
153
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an exhaustive list of all possible paths of an object T for keys K.
|
|
3
|
-
* Possibilities are returned as `k1.k2.k3`.
|
|
4
|
-
*/
|
|
5
|
-
export declare type FindPath<T, K extends keyof T, D extends string = '.'> = K extends string | number ? T[K] extends Record<string | number, any> ? T[K] extends ArrayLike<any> ? K | `${K}${D}${FindPath<T[K], Exclude<keyof T[K], keyof any[]>, D>}` : K | `${K}${D}${FindPath<T[K], keyof T[K], D>}` : K : never;
|
|
6
|
-
/** Returns valid paths of object T */
|
|
7
|
-
export declare type Path<T, D extends string = '.'> = FindPath<T, keyof T, D> | keyof T;
|
|
8
|
-
/** Returns the value of a valid path P `k1.k2.k3` in object T */
|
|
9
|
-
export declare type PathValue<T, P extends Path<T, D>, D extends string = '.'> = P extends `${infer K}${D}${infer Rest}` ? K extends keyof T ? Rest extends Path<T[K], D> ? PathValue<T[K], Rest, D> : never : never : P extends keyof T ? T[P] : never;
|
|
10
|
-
/** Check if path has a primitive end value and return only the union of end paths */
|
|
11
|
-
export declare type PathToLiteral<T, K extends Path<T, D>, D extends string = '.', Base extends string = ''> = PathValue<T, K, D> extends string | number ? K extends string | number ? K extends `${infer BasePath}${D}${Base}` ? BasePath : K : never : never;
|
|
12
|
-
/**
|
|
13
|
-
* Reduce all paths to a single map of paths with primitive values removing all extra non stateful paths
|
|
14
|
-
* { path: { sub: 1 } } => { 'path-sub': 1 }
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export declare type LiteralPaths<T extends Record<string | number, any>, D extends string = '.', Base extends string = ''> = {
|
|
18
|
-
[K in Path<T, D> as PathToLiteral<T, K, D, Base>]: PathValue<T, PathToLiteral<T, K, D>, D>;
|
|
19
|
-
};
|
|
20
|
-
export declare function flattenScale<T extends Record<string | number, any>, P extends string>(object: T, path?: P): LiteralPaths<T, '-', '_'>;
|