@calame/style-types 0.2.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.
@@ -0,0 +1,6 @@
1
+ export type { CalameAnimation, CalameStyle } from './makeStyles';
2
+ export type { CalameResetStyle } from './makeResetStyles';
3
+ export type { CalameStaticStyle, CalameStaticStyles } from './makeStaticStyles';
4
+ export type { CalameStylesCSSValue, ValueOrArray } from './shared';
5
+ export type { CalameStylesUnsupportedCSSProperties } from './unsupported-properties';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACnE,YAAY,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type * as CSS from 'csstype';
2
+ import type { CalameStylesCSSValue } from './shared';
3
+ type CalameResetStylesCSSProperties = Omit<CSS.PropertiesFallback<CalameStylesCSSValue>, 'animationName'>;
4
+ export type CalameResetStylesStrictCSSObject = CalameResetStylesCSSProperties & CalameCSSPseudos & {
5
+ animationName?: CalameResetAnimation | CalameResetAnimation[] | string;
6
+ };
7
+ type CalameCSSObjectCustom = {
8
+ [Property: string]: CalameResetStyle | CalameStylesCSSValue;
9
+ } & CalameResetStylesStrictCSSObject;
10
+ type CalameCSSPseudos = {
11
+ [Property in CSS.Pseudos]?: CalameResetStylesStrictCSSObject | CalameCSSObjectCustom;
12
+ };
13
+ export type CalameResetAnimation = Record<'from' | 'to' | string, CalameResetStylesCSSProperties & {
14
+ [Property in `--${string}`]: string;
15
+ }>;
16
+ export type CalameResetStyle = CalameResetStylesStrictCSSObject | CalameCSSObjectCustom;
17
+ export {};
18
+ //# sourceMappingURL=makeResetStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeResetStyles.d.ts","sourceRoot":"","sources":["../src/makeResetStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAOrD,KAAK,8BAA8B,GAAG,IAAI,CACxC,GAAG,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,EAE5C,eAAe,CAChB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,8BAA8B,GAC3E,gBAAgB,GAAG;IAAE,aAAa,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,GAAG,MAAM,CAAA;CAAE,CAAC;AAEhG,KAAK,qBAAqB,GAAG;IAC3B,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;CAC7D,GAAG,gCAAgC,CAAC;AAErC,KAAK,gBAAgB,GAAG;KACrB,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,gCAAgC,GAAG,qBAAqB;CACrF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CACvC,MAAM,GAAG,IAAI,GAAG,MAAM,EACtB,8BAA8B,GAAG;KAAG,QAAQ,IAAI,KAAK,MAAM,EAAE,GAAG,MAAM;CAAE,CACzE,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG,gCAAgC,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=makeResetStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeResetStyles.js","sourceRoot":"","sources":["../src/makeResetStyles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type * as CSS from 'csstype';
2
+ import type { CalameStylesCSSValue, Fallback } from './shared';
3
+ export type CalameStaticStyle = {
4
+ [key: string]: (CSS.Properties | Fallback<CSS.Properties<CalameStylesCSSValue>>) & Record<string, any>;
5
+ } & {
6
+ '@font-face'?: {
7
+ fontFamily: string;
8
+ src: string;
9
+ fontDisplay?: string;
10
+ fontFeatureSettings?: string;
11
+ fontStretch?: string;
12
+ fontStyle?: string;
13
+ fontVariant?: string;
14
+ fontVariationSettings?: string;
15
+ fontWeight?: number | string;
16
+ unicodeRange?: string;
17
+ };
18
+ };
19
+ export type CalameStaticStyles = CalameStaticStyle | string;
20
+ //# sourceMappingURL=makeStaticStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeStaticStyles.d.ts","sourceRoot":"","sources":["../src/makeStaticStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAO/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAE9E,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACvB,GAAG;IACF,YAAY,CAAC,EAAE;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QAEZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAE7B,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=makeStaticStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeStaticStyles.js","sourceRoot":"","sources":["../src/makeStaticStyles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type * as CSS from 'csstype';
2
+ import type { Fallback, CalameStylesCSSValue } from './shared';
3
+ import type { CalameStylesUnsupportedCSSProperties } from './unsupported-properties';
4
+ type CalameStylesCSSProperties = Omit<Fallback<CSS.Properties<CalameStylesCSSValue>>, 'animationName'> & Partial<CalameStylesUnsupportedCSSProperties>;
5
+ export type CalameStylesStrictCSSObject = CalameStylesCSSProperties & {
6
+ animationName?: CalameAnimation | CalameAnimation[] | string;
7
+ } & CalameCSSPseudos;
8
+ type CalameCSSObjectCustom = {
9
+ [Property: string]: CalameStyle | CalameStylesCSSValue;
10
+ } & CalameStylesStrictCSSObject;
11
+ type CalameCSSPseudos = {
12
+ [Property in CSS.Pseudos]?: CalameStylesStrictCSSObject | CalameCSSObjectCustom;
13
+ };
14
+ export type CalameAnimation = Record<'from' | 'to' | string, CalameStylesCSSProperties & {
15
+ [Property in `--${string}`]: string;
16
+ }>;
17
+ export type CalameStyle = CalameStylesStrictCSSObject | CalameCSSObjectCustom;
18
+ export {};
19
+ //# sourceMappingURL=makeStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeStyles.d.ts","sourceRoot":"","sources":["../src/makeStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAOrF,KAAK,yBAAyB,GAAG,IAAI,CACnC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAE9C,eAAe,CAChB,GACC,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAEhD,MAAM,MAAM,2BAA2B,GAAG,yBAAyB,GAAG;IACpE,aAAa,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;CAC9D,GAAG,gBAAgB,CAAC;AAErB,KAAK,qBAAqB,GAAG;IAC3B,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,oBAAoB,CAAC;CACxD,GAAG,2BAA2B,CAAC;AAEhC,KAAK,gBAAgB,GAAG;KACrB,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,2BAA2B,GAAG,qBAAqB;CAChF,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,GAAG,IAAI,GAAG,MAAM,EACtB,yBAAyB,GAAG;KAAG,QAAQ,IAAI,KAAK,MAAM,EAAE,GAAG,MAAM;CAAE,CACpE,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,2BAA2B,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=makeStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeStyles.js","sourceRoot":"","sources":["../src/makeStyles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export type CalameStylesCSSValue = string | 0;
2
+ /**
3
+ * instead of using `CSS.PropertiesFallback` from csstype that remaps properties to `readonly` union we need to use our cutom Fallback mapped type in order to avoid type issues
4
+ * @see https://github.com/frenic/csstype/blob/master/src/typescript.ts#L73
5
+ */
6
+ export type Fallback<T> = {
7
+ [P in keyof T]: T[P] | NonNullable<T[P]>[];
8
+ };
9
+ export type ValueOrArray<T> = T | Array<T>;
10
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;CAAE,CAAC;AAEzE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC"}
package/dist/shared.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Calame doesn't support *some* of CSS shorthands, they are listed below.
3
+ *
4
+ * They can be replaced either with the corresponding longhand properties or with the `shorthands` helper functions.
5
+ *
6
+ * @see https://github.com/microsoft/calame/issues/531
7
+ * @see https://calame.js.org/react/guides/limitations#css-shorthands-are-not-supported
8
+ */
9
+ export interface CalameStylesUnsupportedCSSProperties {
10
+ /** @deprecated */
11
+ all: never;
12
+ /** @deprecated Use `shorthands.borderColor()` instead. */
13
+ borderColor: never;
14
+ /** @deprecated Use `shorthands.borderStyle()` instead. */
15
+ borderStyle: never;
16
+ /** @deprecated Use `shorthands.borderWidth()` instead. */
17
+ borderWidth: never;
18
+ /** @deprecated Use corresponding longhand properties such as `borderBlockStartColor` and `borderBlockEndStyle` instead. */
19
+ borderBlock: never;
20
+ /** @deprecated Use corresponding longhand properties such as `borderBlockEndColor` and `borderBlockEndStyle` instead. */
21
+ borderBlockEnd: never;
22
+ /** @deprecated Use corresponding longhand properties such as `borderBlockStartColor` and `borderBlockStartStyle` instead. */
23
+ borderBlockStart: never;
24
+ /** @deprecated Use corresponding longhand properties such as `borderInlineStartColor` and `borderInlineEndStyle` instead. */
25
+ borderInline: never;
26
+ /** @deprecated Use corresponding longhand properties such as `borderInlineEndColor` and `borderInlineEndStyle` instead. */
27
+ borderInlineEnd: never;
28
+ /** @deprecated Use corresponding longhand properties such as `borderInlineStartColor` and `borderInlineStartStyle` instead. */
29
+ borderInlineStart: never;
30
+ }
31
+ //# sourceMappingURL=unsupported-properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported-properties.d.ts","sourceRoot":"","sources":["../src/unsupported-properties.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,oCAAoC;IACnD,kBAAkB;IAClB,GAAG,EAAE,KAAK,CAAC;IAEX,0DAA0D;IAC1D,WAAW,EAAE,KAAK,CAAC;IACnB,0DAA0D;IAC1D,WAAW,EAAE,KAAK,CAAC;IACnB,0DAA0D;IAC1D,WAAW,EAAE,KAAK,CAAC;IAEnB,2HAA2H;IAC3H,WAAW,EAAE,KAAK,CAAC;IACnB,yHAAyH;IACzH,cAAc,EAAE,KAAK,CAAC;IACtB,6HAA6H;IAC7H,gBAAgB,EAAE,KAAK,CAAC;IACxB,6HAA6H;IAC7H,YAAY,EAAE,KAAK,CAAC;IACpB,2HAA2H;IAC3H,eAAe,EAAE,KAAK,CAAC;IACvB,+HAA+H;IAC/H,iBAAiB,EAAE,KAAK,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=unsupported-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported-properties.js","sourceRoot":"","sources":["../src/unsupported-properties.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@calame/style-types",
3
+ "version": "0.2.0",
4
+ "description": "Types for engine style objects",
5
+ "license": "MIT",
6
+ "sideEffects": false,
7
+ "types": "dist/index.d.ts",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc -b tsconfig.json"
15
+ },
16
+ "dependencies": {
17
+ "csstype": "^3.1.3",
18
+ "tslib": "^2.8.1"
19
+ }
20
+ }