@stylexjs/stylex 0.2.0-beta.8 → 0.3.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.
Files changed (52) hide show
  1. package/README.md +284 -0
  2. package/lib/StyleXCSSTypes.d.ts +1414 -0
  3. package/lib/StyleXCSSTypes.js +0 -9
  4. package/lib/StyleXCSSTypes.js.flow +1503 -0
  5. package/lib/StyleXSheet.d.ts +49 -0
  6. package/lib/StyleXSheet.js +7 -120
  7. package/lib/StyleXSheet.js.flow +49 -0
  8. package/lib/StyleXTypes.d.ts +212 -0
  9. package/lib/StyleXTypes.js +0 -9
  10. package/lib/StyleXTypes.js.flow +184 -0
  11. package/lib/native/CSSCustomPropertyValue.d.ts +26 -0
  12. package/lib/native/CSSCustomPropertyValue.js +27 -0
  13. package/lib/native/CSSCustomPropertyValue.js.flow +27 -0
  14. package/lib/native/CSSLengthUnitValue.d.ts +18 -0
  15. package/lib/native/CSSLengthUnitValue.js +73 -0
  16. package/lib/native/CSSLengthUnitValue.js.flow +21 -0
  17. package/lib/native/CSSMediaQuery.d.ts +25 -0
  18. package/lib/native/CSSMediaQuery.js +55 -0
  19. package/lib/native/CSSMediaQuery.js.flow +26 -0
  20. package/lib/native/SpreadOptions.d.ts +19 -0
  21. package/lib/native/SpreadOptions.js +1 -0
  22. package/lib/native/SpreadOptions.js.flow +19 -0
  23. package/lib/native/__tests__/__snapshots__/stylex-css-var-test.js.snap +48 -0
  24. package/lib/native/__tests__/__snapshots__/stylex-test.js.snap +1046 -0
  25. package/lib/native/__tests__/parseTimeValue-test.js +11 -0
  26. package/lib/native/__tests__/stylex-css-var-test.js +148 -0
  27. package/lib/native/__tests__/stylex-test.js +924 -0
  28. package/lib/native/errorMsg.d.ts +11 -0
  29. package/lib/native/errorMsg.js +13 -0
  30. package/lib/native/errorMsg.js.flow +12 -0
  31. package/lib/native/fixContentBox.d.ts +11 -0
  32. package/lib/native/fixContentBox.js +59 -0
  33. package/lib/native/fixContentBox.js.flow +11 -0
  34. package/lib/native/flattenStyle.d.ts +15 -0
  35. package/lib/native/flattenStyle.js +20 -0
  36. package/lib/native/flattenStyle.js.flow +20 -0
  37. package/lib/native/parseShadow.d.ts +18 -0
  38. package/lib/native/parseShadow.js +36 -0
  39. package/lib/native/parseShadow.js.flow +19 -0
  40. package/lib/native/parseTimeValue.d.ts +11 -0
  41. package/lib/native/parseTimeValue.js +18 -0
  42. package/lib/native/parseTimeValue.js.flow +12 -0
  43. package/lib/native/stylex.d.ts +50 -0
  44. package/lib/native/stylex.js +393 -0
  45. package/lib/native/stylex.js.flow +60 -0
  46. package/lib/stylex-inject.d.ts +15 -0
  47. package/lib/stylex-inject.js +0 -9
  48. package/lib/stylex-inject.js.flow +14 -0
  49. package/lib/stylex.d.ts +134 -59
  50. package/lib/stylex.js +123 -91
  51. package/lib/stylex.js.flow +151 -0
  52. package/package.json +8 -6
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type { CSSProperties } from './StyleXCSSTypes';
11
+
12
+ // Using an opaque type to declare ClassNames generated by stylex.
13
+ declare export opaque type StyleXClassNameFor<+_K, +_V>: string;
14
+ export type StyleXClassNameForValue<+V> = StyleXClassNameFor<mixed, V>;
15
+ export type StyleXClassNameForKey<+K> = StyleXClassNameFor<K, mixed>;
16
+ export type StyleXClassName = StyleXClassNameFor<mixed, mixed>;
17
+
18
+ // Type for arbitrarily nested Array.
19
+ export type StyleXArray<+T> = T | $ReadOnlyArray<StyleXArray<T>>;
20
+
21
+ type CSSPropertiesWithExtras = $ReadOnly<{
22
+ ...CSSProperties,
23
+ '::before'?: CSSProperties,
24
+ '::after'?: CSSProperties,
25
+ '::backdrop'?: CSSProperties,
26
+ '::cue'?: CSSProperties,
27
+ '::cue-region'?: CSSProperties,
28
+ '::first-letter'?: CSSProperties,
29
+ '::first-line'?: CSSProperties,
30
+ '::file-selector-button'?: CSSProperties,
31
+ '::grammar-error'?: CSSProperties,
32
+ '::marker'?: CSSProperties,
33
+ '::placeholder'?: CSSProperties,
34
+ '::selection'?: CSSProperties,
35
+ '::spelling-error'?: CSSProperties,
36
+ '::target-text'?: CSSProperties,
37
+ '::-webkit-scrollbar'?: CSSProperties,
38
+ // webkit styles used for Search in Safari
39
+ '::-webkit-search-decoration'?: CSSProperties,
40
+ '::-webkit-search-cancel-button'?: CSSProperties,
41
+ '::-webkit-search-results-button'?: CSSProperties,
42
+ '::-webkit-search-results-decoration'?: CSSProperties,
43
+ }>;
44
+
45
+ export type NestedCSSPropTypes = $ReadOnly<{
46
+ [Key in keyof CSSPropertiesWithExtras]?: StyleXClassNameForKey<Key>,
47
+ }>;
48
+
49
+ export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
50
+ export type XStyle<+T = NestedCSSPropTypes> = StyleXArray<
51
+ false | ?$ReadOnly<{ ...T, $$css: true }>,
52
+ >;
53
+ export type XStyleWithout<+T: { +[string]: mixed }> = XStyle<
54
+ $ReadOnly<$Rest<NestedCSSPropTypes, $Exact<T>>>,
55
+ >;
56
+
57
+ export type Keyframes = $ReadOnly<{ [name: string]: CSSProperties, ... }>;
58
+
59
+ export type LegacyThemeStyles = $ReadOnly<{
60
+ [constantName: string]: string,
61
+ ...
62
+ }>;
63
+
64
+ type ComplexStyleValueType<+T> = T extends StyleXVar<infer U>
65
+ ? U
66
+ : T extends string | number | null
67
+ ? T
68
+ : T extends $ReadOnlyArray<infer U>
69
+ ? U
70
+ : T extends $ReadOnly<{ default: infer A, +[string]: infer B }>
71
+ ? ComplexStyleValueType<A> | ComplexStyleValueType<B>
72
+ : $ReadOnly<T>;
73
+
74
+ type _MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
75
+ [Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
76
+ }>;
77
+ export type MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
78
+ ..._MapNamespace<CSS>,
79
+ $$css: true,
80
+ }>;
81
+ export type MapNamespaces<+S: { +[string]: mixed }> = $ReadOnly<{
82
+ [Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
83
+ ? (...args: Args) => $ReadOnly<[MapNamespace<Obj>, InlineStyles]>
84
+ : MapNamespace<S[Key]>,
85
+ }>;
86
+ export type Stylex$Create = <S: { +[string]: mixed }>(
87
+ styles: S,
88
+ ) => MapNamespaces<S>;
89
+
90
+ export type CompiledStyles = $ReadOnly<{
91
+ $$css: true,
92
+ [key: string]: StyleXClassName,
93
+ }>;
94
+ export type InlineStyles = $ReadOnly<{
95
+ $$css?: void,
96
+ [key: string]: string,
97
+ }>;
98
+
99
+ type _GenStylePropType<+CSS: { +[string]: mixed }> = $ReadOnly<{
100
+ [Key in keyof CSS]: CSS[Key] extends { +[string]: mixed }
101
+ ? StyleXClassNameFor<Key, $ReadOnly<CSS[Key]>>
102
+ : StyleXClassNameFor<Key, CSS[Key]>,
103
+ }>;
104
+ type GenStylePropType<+CSS: { +[string]: mixed }> = $ReadOnly<{
105
+ ..._GenStylePropType<CSS>,
106
+ $$css: true,
107
+ }>;
108
+
109
+ // Replace `XStyle` with this.
110
+ export type StaticStyles<+CSS: { +[string]: mixed } = CSSPropertiesWithExtras> =
111
+ StyleXArray<false | ?GenStylePropType<$ReadOnly<CSS>>>;
112
+
113
+ export type StaticStylesWithout<+CSS: { +[string]: mixed }> = StaticStyles<
114
+ $Rest<CSSPropertiesWithExtras, $ReadOnly<CSS>>,
115
+ >;
116
+
117
+ export type StyleXStyles<+CSS: { +[string]: mixed } = CSSPropertiesWithExtras> =
118
+ StyleXArray<
119
+ | ?false
120
+ | GenStylePropType<$ReadOnly<CSS>>
121
+ | $ReadOnly<[GenStylePropType<$ReadOnly<CSS>>, InlineStyles]>,
122
+ >;
123
+
124
+ export type StyleXStylesWithout<+CSS: { +[string]: mixed }> = StyleXStyles<
125
+ $Rest<CSSPropertiesWithExtras, $ReadOnly<CSS>>,
126
+ >;
127
+
128
+ // This is the type for the variables object
129
+ declare export opaque type StyleXVar<+Val: mixed>;
130
+
131
+ declare export opaque type VarGroup<
132
+ +Tokens: { +[string]: mixed },
133
+ +_ID: string = string,
134
+ >: $ReadOnly<{ [Key in keyof Tokens]: StyleXVar<Tokens[Key]> }>;
135
+
136
+ export type TokensFromVarGroup<T: VarGroup<{ +[string]: mixed }>> =
137
+ T extends VarGroup<infer Tokens extends { +[string]: mixed }>
138
+ ? Tokens
139
+ : empty;
140
+ type IDFromVarGroup<+T: VarGroup<{ +[string]: mixed }>> = T extends VarGroup<
141
+ { +[string]: mixed },
142
+ infer ID,
143
+ >
144
+ ? ID
145
+ : empty;
146
+
147
+ type TTokens = $ReadOnly<{
148
+ [string]:
149
+ | number
150
+ | string
151
+ | $ReadOnly<{ default: number | string, [string]: number | string }>,
152
+ }>;
153
+
154
+ export type FlattenTokens<T: TTokens> = {
155
+ +[Key in keyof T]: T[Key] extends { +default: infer X, +[string]: infer Y }
156
+ ? X | Y
157
+ : T[Key],
158
+ };
159
+
160
+ export type StyleX$DefineVars = <DefaultTokens: TTokens, ID: string = string>(
161
+ tokens: DefaultTokens,
162
+ ) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
163
+
164
+ export type Theme<
165
+ +T: VarGroup<{ +[string]: mixed }, string>,
166
+ +_Tag: string = string,
167
+ > = $ReadOnly<{
168
+ $$css: true,
169
+ [string]: StyleXClassNameFor<string, IDFromVarGroup<T>>,
170
+ }>;
171
+
172
+ export type OverridesForTokenType<Config: { +[string]: mixed }> = {
173
+ [Key in keyof Config]:
174
+ | Config[Key]
175
+ | { +default: Config[Key], +[string]: Config[Key] },
176
+ };
177
+
178
+ export type StyleX$CreateTheme = <
179
+ BaseTokens: VarGroup<{ +[string]: mixed }>,
180
+ ID: string = string,
181
+ >(
182
+ baseTokens: BaseTokens,
183
+ overrides: OverridesForTokenType<TokensFromVarGroup<BaseTokens>>,
184
+ ) => Theme<BaseTokens, ID>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ /**
11
+ * Either create a custom property value or return null if the input is not a string
12
+ * containing a 'var(--name)' or 'var(--name, default)' sequence.
13
+ *
14
+ * Made this a single function to test and create to avoid parsing the RegExp twice.
15
+ */
16
+ export declare function createCSSCustomPropertyValue(
17
+ value: string,
18
+ ): CSSCustomPropertyValue | null;
19
+ /**
20
+ * Class representing a custom property value with an optional fallback.
21
+ */
22
+ export declare class CSSCustomPropertyValue {
23
+ name: string;
24
+ defaultValue: unknown;
25
+ constructor(kebabCasePropName: string, fallback: unknown);
26
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CSSCustomPropertyValue = void 0;
7
+ exports.createCSSCustomPropertyValue = createCSSCustomPropertyValue;
8
+ const CUSTOM_PROPERTY_REGEX = /^var\(--([\w-]+) *(?:\)|, *(.+)\))$/;
9
+ function camelize(s) {
10
+ return s.replace(/-./g, x => x.toUpperCase()[1]);
11
+ }
12
+ function createCSSCustomPropertyValue(value) {
13
+ if (typeof value === 'string') {
14
+ const match = CUSTOM_PROPERTY_REGEX.exec(value);
15
+ if (match) {
16
+ return new CSSCustomPropertyValue(match[1], match[2]);
17
+ }
18
+ }
19
+ return null;
20
+ }
21
+ class CSSCustomPropertyValue {
22
+ constructor(kebabCasePropName, fallback) {
23
+ this.name = camelize(kebabCasePropName);
24
+ this.defaultValue = fallback ?? null;
25
+ }
26
+ }
27
+ exports.CSSCustomPropertyValue = CSSCustomPropertyValue;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ /**
11
+ * Either create a custom property value or return null if the input is not a string
12
+ * containing a 'var(--name)' or 'var(--name, default)' sequence.
13
+ *
14
+ * Made this a single function to test and create to avoid parsing the RegExp twice.
15
+ */
16
+ declare export function createCSSCustomPropertyValue(
17
+ value: string,
18
+ ): CSSCustomPropertyValue | null;
19
+
20
+ /**
21
+ * Class representing a custom property value with an optional fallback.
22
+ */
23
+ declare export class CSSCustomPropertyValue {
24
+ name: string;
25
+ defaultValue: mixed;
26
+ constructor(kebabCasePropName: string, fallback: mixed): void;
27
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ import type { SpreadOptions } from './SpreadOptions';
11
+ type CSSLengthUnitType = 'em' | 'px' | 'rem' | 'vh' | 'vmax' | 'vmin' | 'vw';
12
+ export declare class CSSLengthUnitValue {
13
+ static parse(inp: string): [number, CSSLengthUnitType] | null;
14
+ value: number;
15
+ unit: CSSLengthUnitType;
16
+ constructor(value: number, unit: CSSLengthUnitType);
17
+ resolvePixelValue(options: SpreadOptions): number;
18
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CSSLengthUnitValue = void 0;
7
+ const LENGTH_REGEX = /^([0-9]*[.]?[0-9]+)(em|px|rem|vh|vmax|vmin|vw)$/;
8
+ class CSSLengthUnitValue {
9
+ static parse(inp) {
10
+ const match = inp.match(LENGTH_REGEX);
11
+ if (match == null) {
12
+ return null;
13
+ }
14
+ const [, value, unit] = match;
15
+ const parsedValue = parseFloat(value);
16
+ return [parsedValue, unit];
17
+ }
18
+ constructor(value, unit) {
19
+ this.value = value;
20
+ this.unit = unit;
21
+ }
22
+ resolvePixelValue(options) {
23
+ const {
24
+ viewportWidth,
25
+ viewportHeight,
26
+ fontScale = 1,
27
+ inheritedFontSize
28
+ } = options;
29
+ const unit = this.unit;
30
+ const value = this.value;
31
+ const valuePercent = value / 100;
32
+ switch (unit) {
33
+ case 'em':
34
+ {
35
+ if (inheritedFontSize == null) {
36
+ return fontScale * 16 * value;
37
+ } else {
38
+ return inheritedFontSize * value;
39
+ }
40
+ }
41
+ case 'px':
42
+ {
43
+ return value;
44
+ }
45
+ case 'rem':
46
+ {
47
+ return fontScale * 16 * value;
48
+ }
49
+ case 'vh':
50
+ {
51
+ return viewportHeight * valuePercent;
52
+ }
53
+ case 'vmin':
54
+ {
55
+ return Math.min(viewportWidth, viewportHeight) * valuePercent;
56
+ }
57
+ case 'vmax':
58
+ {
59
+ return Math.max(viewportWidth, viewportHeight) * valuePercent;
60
+ }
61
+ case 'vw':
62
+ {
63
+ return viewportWidth * valuePercent;
64
+ }
65
+ default:
66
+ {
67
+ console.error(`[stylex]: Unsupported unit of "${unit}"`);
68
+ return 0;
69
+ }
70
+ }
71
+ }
72
+ }
73
+ exports.CSSLengthUnitValue = CSSLengthUnitValue;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type { SpreadOptions } from './SpreadOptions';
11
+
12
+ type CSSLengthUnitType = 'em' | 'px' | 'rem' | 'vh' | 'vmax' | 'vmin' | 'vw';
13
+
14
+ // TODO: this only works on simple values
15
+ declare export class CSSLengthUnitValue {
16
+ static parse(inp: string): [number, CSSLengthUnitType] | null;
17
+ value: number;
18
+ unit: CSSLengthUnitType;
19
+ constructor(value: number, unit: CSSLengthUnitType): void;
20
+ resolvePixelValue(options: SpreadOptions): number;
21
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ export type MatchObject = {
11
+ width: number;
12
+ height: number;
13
+ direction: 'ltr' | 'rtl';
14
+ };
15
+ export declare class CSSMediaQuery {
16
+ static isMediaQueryString(inp: string): boolean;
17
+ static resolveMediaQueries(
18
+ styleObj: { readonly [$$Key$$: string]: unknown },
19
+ matchObj: MatchObject,
20
+ ): { [$$Key$$: string]: unknown };
21
+ query: string;
22
+ matchedStyle: { [$$Key$$: string]: unknown };
23
+ constructor(query: string, matchedStyle: { [$$Key$$: string]: unknown });
24
+ resolve(matchObject: MatchObject): { [$$Key$$: string]: unknown };
25
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CSSMediaQuery = void 0;
7
+ var _cssMediaquery = _interopRequireDefault(require("css-mediaquery"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const MQ_PREFIX = '@media';
10
+ class CSSMediaQuery {
11
+ static isMediaQueryString(inp) {
12
+ return inp.startsWith(MQ_PREFIX);
13
+ }
14
+ static resolveMediaQueries(styleObj, matchObj) {
15
+ const mediaQueries = [];
16
+ const result = {};
17
+ for (const [key, value] of Object.entries(styleObj)) {
18
+ if (value instanceof CSSMediaQuery) {
19
+ mediaQueries.push(value);
20
+ } else {
21
+ result[key] = value;
22
+ }
23
+ }
24
+ if (mediaQueries.length > 0) {
25
+ for (const mqInst of mediaQueries) {
26
+ const unresolvedMatchedStyle = mqInst.resolve(matchObj);
27
+ const resolvedMatchedStyle = this.resolveMediaQueries(unresolvedMatchedStyle, matchObj);
28
+ for (const propName in resolvedMatchedStyle) {
29
+ result[propName] = resolvedMatchedStyle[propName];
30
+ }
31
+ }
32
+ }
33
+ return result;
34
+ }
35
+ constructor(query, matchedStyle) {
36
+ this.query = query.replace(MQ_PREFIX, '');
37
+ this.matchedStyle = matchedStyle;
38
+ }
39
+ resolve(matchObject) {
40
+ const {
41
+ width,
42
+ height,
43
+ direction
44
+ } = matchObject;
45
+ const matches = _cssMediaquery.default.match(this.query, {
46
+ width,
47
+ height,
48
+ orientation: width > height ? 'landscape' : 'portrait',
49
+ 'aspect-ratio': width / height,
50
+ direction: direction
51
+ });
52
+ return matches ? this.matchedStyle : {};
53
+ }
54
+ }
55
+ exports.CSSMediaQuery = CSSMediaQuery;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ export type MatchObject = {
11
+ width: number,
12
+ height: number,
13
+ direction: 'ltr' | 'rtl',
14
+ };
15
+
16
+ declare export class CSSMediaQuery {
17
+ static isMediaQueryString(inp: string): boolean;
18
+ static resolveMediaQueries(
19
+ styleObj: { +[string]: mixed },
20
+ matchObj: MatchObject,
21
+ ): { [string]: mixed };
22
+ query: string;
23
+ matchedStyle: { [string]: mixed };
24
+ constructor(query: string, matchedStyle: { [string]: mixed }): void;
25
+ resolve(matchObject: MatchObject): { [string]: mixed };
26
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ export type SpreadOptions = Readonly<{
11
+ customProperties: {};
12
+ inheritedFontSize: null | undefined | number;
13
+ fontScale: number | void;
14
+ hover?: null | undefined | boolean;
15
+ passthroughProperties: Array<string>;
16
+ viewportHeight: number;
17
+ viewportWidth: number;
18
+ writingDirection: 'ltr' | 'rtl';
19
+ }>;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ export type SpreadOptions = $ReadOnly<{
11
+ customProperties: {},
12
+ inheritedFontSize: ?number,
13
+ fontScale: number | void,
14
+ hover?: ?boolean,
15
+ passthroughProperties: Array<string>,
16
+ viewportHeight: number,
17
+ viewportWidth: number,
18
+ writingDirection: 'ltr' | 'rtl',
19
+ }>;
@@ -0,0 +1,48 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`stylex CSSCustomProperty value test falls back to a default value with spaces 1`] = `
4
+ {
5
+ "style": {
6
+ "shadowColor": "0px 0px 0px black",
7
+ "shadowOffset": {
8
+ "height": undefined,
9
+ "width": undefined,
10
+ },
11
+ "shadowOpacity": 1,
12
+ },
13
+ }
14
+ `;
15
+
16
+ exports[`stylex CSSCustomProperty value test parses a variable with a default value with spaces 1`] = `
17
+ {
18
+ "style": {
19
+ "shadowColor": "5px 5px 5px black",
20
+ "shadowOffset": {
21
+ "height": undefined,
22
+ "width": undefined,
23
+ },
24
+ "shadowOpacity": 1,
25
+ },
26
+ }
27
+ `;
28
+
29
+ exports[`stylex CSSCustomProperty value test parses and falls back to a default value containing spaces and embedded variables 1`] = `
30
+ {
31
+ "style": {
32
+ "shadowColor": "var(--boxShadowVarNotFound",
33
+ "shadowOffset": {
34
+ "height": undefined,
35
+ "width": undefined,
36
+ },
37
+ "shadowOpacity": 1,
38
+ },
39
+ }
40
+ `;
41
+
42
+ exports[`stylex CSSCustomProperty value test parses and falls back to default value containing a variable 1`] = `
43
+ {
44
+ "style": {
45
+ "color": "blue",
46
+ },
47
+ }
48
+ `;