@stylexjs/shared 0.2.0-beta.11 → 0.2.0-beta.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. package/lib/common-types.d.ts +49 -0
  2. package/lib/common-types.js.flow +64 -0
  3. package/lib/convert-to-className.d.ts +16 -0
  4. package/lib/convert-to-className.js.flow +23 -0
  5. package/lib/generate-css-rule.d.ts +17 -0
  6. package/lib/generate-css-rule.js.flow +17 -0
  7. package/lib/hash.d.ts +11 -0
  8. package/lib/hash.js.flow +12 -0
  9. package/lib/index.d.ts +32 -95
  10. package/lib/index.js.flow +46 -3
  11. package/lib/messages.d.ts +32 -0
  12. package/lib/messages.js.flow +35 -0
  13. package/lib/physical-rtl/generate-ltr.d.ts +12 -0
  14. package/lib/physical-rtl/generate-ltr.js.flow +13 -0
  15. package/lib/physical-rtl/generate-rtl.d.ts +14 -0
  16. package/lib/physical-rtl/generate-rtl.js.flow +13 -0
  17. package/lib/preprocess-rules/PreRule.d.ts +52 -0
  18. package/lib/preprocess-rules/PreRule.js.flow +64 -0
  19. package/lib/preprocess-rules/application-order.d.ts +253 -0
  20. package/lib/preprocess-rules/application-order.js.flow +206 -0
  21. package/lib/preprocess-rules/basic-validation.d.ts +13 -0
  22. package/lib/preprocess-rules/basic-validation.js.flow +13 -0
  23. package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +25 -0
  24. package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +27 -0
  25. package/lib/preprocess-rules/index.d.ts +18 -0
  26. package/lib/preprocess-rules/index.js.flow +19 -0
  27. package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +122 -0
  28. package/lib/preprocess-rules/legacy-expand-shorthands.js +0 -139
  29. package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +101 -0
  30. package/lib/preprocess-rules/property-specificity.d.ts +76 -0
  31. package/lib/preprocess-rules/property-specificity.js.flow +87 -0
  32. package/lib/stylex-create-vars.d.ts +27 -0
  33. package/lib/stylex-create-vars.js.flow +22 -0
  34. package/lib/stylex-create.d.ts +23 -0
  35. package/lib/stylex-create.js.flow +30 -0
  36. package/lib/stylex-first-that-works.d.ts +14 -0
  37. package/lib/stylex-first-that-works.js.flow +13 -0
  38. package/lib/stylex-include.d.ts +19 -0
  39. package/lib/stylex-include.js.flow +21 -0
  40. package/lib/stylex-keyframes.d.ts +17 -0
  41. package/lib/stylex-keyframes.js.flow +20 -0
  42. package/lib/transform-value.d.ts +13 -0
  43. package/lib/transform-value.js.flow +15 -0
  44. package/lib/utils/Rule.d.ts +58 -0
  45. package/lib/utils/Rule.js.flow +64 -0
  46. package/lib/utils/dashify.d.ts +10 -0
  47. package/lib/utils/dashify.js.flow +9 -0
  48. package/lib/utils/default-options.d.ts +10 -0
  49. package/lib/utils/default-options.js.flow +24 -0
  50. package/lib/utils/file-based-identifier.d.ts +14 -0
  51. package/lib/utils/file-based-identifier.js +22 -0
  52. package/lib/utils/file-based-identifier.js.flow +13 -0
  53. package/lib/utils/genCSSRule.d.ts +16 -0
  54. package/lib/utils/genCSSRule.js.flow +16 -0
  55. package/lib/utils/normalize-value.d.ts +12 -0
  56. package/lib/utils/normalize-value.js.flow +14 -0
  57. package/lib/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
  58. package/lib/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
  59. package/lib/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
  60. package/lib/utils/normalizers/font-size-px-to-rem.js +9 -4
  61. package/lib/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
  62. package/lib/utils/normalizers/leading-zero.d.ts +17 -0
  63. package/lib/utils/normalizers/leading-zero.js.flow +16 -0
  64. package/lib/utils/normalizers/quotes.d.ts +19 -0
  65. package/lib/utils/normalizers/quotes.js.flow +18 -0
  66. package/lib/utils/normalizers/timings.d.ts +19 -0
  67. package/lib/utils/normalizers/timings.js.flow +18 -0
  68. package/lib/utils/normalizers/whitespace.d.ts +20 -0
  69. package/lib/utils/normalizers/whitespace.js.flow +19 -0
  70. package/lib/utils/normalizers/zero-dimensions.d.ts +19 -0
  71. package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
  72. package/lib/utils/object-utils.d.ts +61 -0
  73. package/lib/utils/object-utils.js.flow +81 -0
  74. package/lib/utils/property-priorities.d.ts +11 -0
  75. package/lib/utils/property-priorities.js.flow +10 -0
  76. package/lib/utils/split-css-value.d.ts +15 -0
  77. package/lib/utils/split-css-value.js.flow +16 -0
  78. package/lib/validate.d.ts +12 -0
  79. package/lib/validate.js.flow +12 -0
  80. package/package.json +3 -1
  81. package/lib/expand-shorthands.d.ts +0 -5
  82. package/lib/expand-shorthands.js +0 -330
  83. package/lib/namespace-transforms/__tests__/preflatten.test.js +0 -120
  84. package/lib/namespace-transforms/preflatten.js +0 -89
  85. package/lib/preprocess-rules/expand-shorthands.js +0 -156
  86. package/lib/preprocess-rules/null-out-longhand.js +0 -310
  87. package/lib/preprocess-rules/react-native-web.js +0 -142
  88. package/lib/stylex-defaultValue.js +0 -397
@@ -0,0 +1,58 @@
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
+ * This could be an interface, but we use a class so that we can
12
+ * use instanceof to check for it.
13
+ */
14
+ export declare class Rule<V> {}
15
+ /**
16
+ * This is a class that represents a raw style rule.
17
+ *
18
+ * It exists to track the actual CSS rule that should be compiled
19
+ * even as we transform the structure of the RawStyles object.
20
+ */
21
+ export declare class RawRule<V> extends Rule<V> {
22
+ readonly key: string;
23
+ readonly value: V;
24
+ readonly psuedos: null | undefined | ReadonlyArray<string>;
25
+ readonly atRules: null | undefined | ReadonlyArray<string>;
26
+ constructor(
27
+ key: string,
28
+ value: V,
29
+ psuedos: null | undefined | ReadonlyArray<string>,
30
+ atRules: null | undefined | ReadonlyArray<string>
31
+ );
32
+ }
33
+ export declare class RawRuleList<V> extends Rule<V> {
34
+ readonly rules: ReadonlyArray<Rule<V>>;
35
+ constructor(rules: ReadonlyArray<Rule<V>>);
36
+ }
37
+ export declare class RawRuleRTLTuple<V1, V2> extends Rule<V1 | V2> {
38
+ readonly rules: [RawRule<V1>, RawRule<V2>];
39
+ constructor(rule1: RawRule<V1>, rule2: RawRule<V2>);
40
+ }
41
+ export declare class CompiledRule<V> extends Rule<V> {
42
+ readonly key: string;
43
+ readonly value: V;
44
+ readonly psuedos: null | undefined | ReadonlyArray<string>;
45
+ readonly atRules: null | undefined | ReadonlyArray<string>;
46
+ readonly className: string;
47
+ constructor(
48
+ key: string,
49
+ value: V,
50
+ psuedos: null | undefined | ReadonlyArray<string>,
51
+ atRules: null | undefined | ReadonlyArray<string>,
52
+ className: string
53
+ );
54
+ }
55
+ export declare class CompiledRuleTuple2<V1, V2> extends Rule<V1 | V2> {
56
+ readonly rules: [CompiledRule<V1>, CompiledRule<V2>];
57
+ constructor(rule1: CompiledRule<V1>, rule2: CompiledRule<V2>);
58
+ }
@@ -0,0 +1,64 @@
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
+ * This could be an interface, but we use a class so that we can
12
+ * use instanceof to check for it.
13
+ */
14
+ // eslint-disable-next-line no-unused-vars
15
+ declare export class Rule<+V> {}
16
+
17
+ /**
18
+ * This is a class that represents a raw style rule.
19
+ *
20
+ * It exists to track the actual CSS rule that should be compiled
21
+ * even as we transform the structure of the RawStyles object.
22
+ */
23
+ declare export class RawRule<V> extends Rule<V> {
24
+ +key: string;
25
+ +value: V;
26
+ +psuedos: ?$ReadOnlyArray<string>;
27
+ +atRules: ?$ReadOnlyArray<string>;
28
+ constructor(
29
+ key: string,
30
+ value: V,
31
+ psuedos: ?$ReadOnlyArray<string>,
32
+ atRules: ?$ReadOnlyArray<string>
33
+ ): void;
34
+ }
35
+
36
+ declare export class RawRuleList<V> extends Rule<V> {
37
+ +rules: $ReadOnlyArray<Rule<V>>;
38
+ constructor(rules: $ReadOnlyArray<Rule<V>>): void;
39
+ }
40
+
41
+ declare export class RawRuleRTLTuple<V1, V2> extends Rule<V1 | V2> {
42
+ +rules: [RawRule<V1>, RawRule<V2>];
43
+ constructor(rule1: RawRule<V1>, rule2: RawRule<V2>): void;
44
+ }
45
+
46
+ declare export class CompiledRule<V> extends Rule<V> {
47
+ +key: string;
48
+ +value: V;
49
+ +psuedos: ?$ReadOnlyArray<string>;
50
+ +atRules: ?$ReadOnlyArray<string>;
51
+ +className: string;
52
+ constructor(
53
+ key: string,
54
+ value: V,
55
+ psuedos: ?$ReadOnlyArray<string>,
56
+ atRules: ?$ReadOnlyArray<string>,
57
+ className: string
58
+ ): void;
59
+ }
60
+
61
+ declare export class CompiledRuleTuple2<V1, V2> extends Rule<V1 | V2> {
62
+ +rules: [CompiledRule<V1>, CompiledRule<V2>];
63
+ constructor(rule1: CompiledRule<V1>, rule2: CompiledRule<V2>): void;
64
+ }
@@ -0,0 +1,10 @@
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
+ declare function dashify(str: string): string;
10
+ export default dashify;
@@ -0,0 +1,9 @@
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
+ * @flow strict
7
+ */
8
+
9
+ declare export default function dashify(str: string): string;
@@ -0,0 +1,10 @@
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
+ import type { StyleXOptions } from '../common-types';
10
+ export declare var defaultOptions: StyleXOptions;
@@ -0,0 +1,24 @@
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
+ * @flow strict
7
+ */
8
+
9
+ import type { StyleXOptions } from '../common-types';
10
+
11
+ // {
12
+ // ...options,
13
+ // dev: !!(options as any).dev,
14
+ // test: !!(options as any).test,
15
+ // stylexSheetName: (options as any).stylexSheetName ?? undefined,
16
+ // classNamePrefix: (options as any).classNamePrefix ?? 'x',
17
+ // importSources: (options as any).importSources ?? [name, 'stylex'],
18
+ // definedStylexCSSVariables:
19
+ // (options as any).definedStylexCSSVariables ?? {},
20
+ // genConditionalClasses: !!(options as any).genConditionalClasses,
21
+ // skipShorthandExpansion: !!(options as any).skipShorthandExpansion,
22
+ // } as StyleXOptions;
23
+
24
+ declare export var defaultOptions: StyleXOptions;
@@ -0,0 +1,14 @@
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
+ declare function genFileBasedIdentifier($$PARAM_0$$: {
10
+ readonly fileName: string;
11
+ readonly exportName: string;
12
+ readonly key?: string;
13
+ }): string;
14
+ export default genFileBasedIdentifier;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = genFileBasedIdentifier;
7
+ /**
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+
15
+ function genFileBasedIdentifier(_ref) {
16
+ let {
17
+ fileName,
18
+ exportName,
19
+ key
20
+ } = _ref;
21
+ return `${fileName}//${exportName}${key != null ? `.${key}` : ''}`;
22
+ }
@@ -0,0 +1,13 @@
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
+ * @flow strict
7
+ */
8
+
9
+ declare export default function genFileBasedIdentifier({
10
+ +fileName: string,
11
+ +exportName: string,
12
+ +key?: string,
13
+ }): string;
@@ -0,0 +1,16 @@
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
+ export declare function genCSSRule(
12
+ className: string,
13
+ decls: string,
14
+ pseudos: ReadonlyArray<string>,
15
+ atRules: ReadonlyArray<string>
16
+ ): string;
@@ -0,0 +1,16 @@
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
+ declare export function genCSSRule(
12
+ className: string,
13
+ decls: string,
14
+ pseudos: $ReadOnlyArray<string>,
15
+ atRules: $ReadOnlyArray<string>
16
+ ): string;
@@ -0,0 +1,12 @@
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
+ declare function normalizeValue(value: string, key: string): string;
12
+ export default normalizeValue;
@@ -0,0 +1,14 @@
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
+ declare export default function normalizeValue(
12
+ value: string,
13
+ key: string
14
+ ): string;
@@ -0,0 +1,17 @@
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
+ * Remove leading zeros from numbers
12
+ */
13
+ declare function detectUnclosedFns(
14
+ ast: PostCSSValueAST,
15
+ _: unknown
16
+ ): PostCSSValueAST;
17
+ export default detectUnclosedFns;
@@ -0,0 +1,16 @@
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
+ * Remove leading zeros from numbers
12
+ */
13
+ declare export default function detectUnclosedFns(
14
+ ast: PostCSSValueAST,
15
+ _: mixed
16
+ ): PostCSSValueAST;
@@ -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
+ /**
11
+ * Convert font sizes from absolute unit `px` to relative unit `rem`.
12
+ * This will allow developers to continue thinking and using what's familiar
13
+ * while we output font sizes that are adjustable
14
+ */
15
+ declare function convertFontSizeToRem(
16
+ ast: PostCSSValueAST,
17
+ key: string
18
+ ): PostCSSValueAST;
19
+ export default convertFontSizeToRem;
@@ -9,7 +9,12 @@
9
9
 
10
10
  'use strict';
11
11
 
12
- const parser = require('postcss-value-parser');
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
15
+ exports.default = convertFontSizeToRem;
16
+ var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
18
  const ROOT_FONT_SIZE = 16;
14
19
 
15
20
  /**
@@ -17,7 +22,7 @@ const ROOT_FONT_SIZE = 16;
17
22
  * This will allow developers to continue thinking and using what's familiar
18
23
  * while we output font sizes that are adjustable
19
24
  */
20
- module.exports = function convertFontSizeToRem(ast, key) {
25
+ function convertFontSizeToRem(ast, key) {
21
26
  if (key !== 'fontSize') {
22
27
  return ast;
23
28
  }
@@ -25,10 +30,10 @@ module.exports = function convertFontSizeToRem(ast, key) {
25
30
  if (node.type !== 'word') {
26
31
  return;
27
32
  }
28
- const dimension = parser.unit(node.value);
33
+ const dimension = _postcssValueParser.default.unit(node.value);
29
34
  if (dimension && dimension.unit === 'px') {
30
35
  node.value = `${parseFloat(dimension.number) / ROOT_FONT_SIZE}rem`;
31
36
  }
32
37
  });
33
38
  return ast;
34
- };
39
+ }
@@ -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
+ * @flow strict
8
+ */
9
+
10
+ /**
11
+ * Convert font sizes from absolute unit `px` to relative unit `rem`.
12
+ * This will allow developers to continue thinking and using what's familiar
13
+ * while we output font sizes that are adjustable
14
+ */
15
+ declare export default function convertFontSizeToRem(
16
+ ast: PostCSSValueAST,
17
+ key: string
18
+ ): PostCSSValueAST;
@@ -0,0 +1,17 @@
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
+ * Remove leading zeros from numbers
12
+ */
13
+ declare function normalizeLeadingZero(
14
+ ast: PostCSSValueAST,
15
+ _: unknown
16
+ ): PostCSSValueAST;
17
+ export default normalizeLeadingZero;
@@ -0,0 +1,16 @@
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
+ * Remove leading zeros from numbers
12
+ */
13
+ declare export default function normalizeLeadingZero(
14
+ ast: PostCSSValueAST,
15
+ _: mixed
16
+ ): PostCSSValueAST;
@@ -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
+
11
+ /**
12
+ * Make empty strings use consistent double quotes
13
+ */
14
+
15
+ declare function normalizeQuotes(
16
+ ast: PostCSSValueAST,
17
+ _: unknown
18
+ ): PostCSSValueAST;
19
+ export default normalizeQuotes;
@@ -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
+ * @flow strict
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Make empty strings use consistent double quotes
13
+ */
14
+
15
+ declare export default function normalizeQuotes(
16
+ ast: PostCSSValueAST,
17
+ _: mixed
18
+ ): PostCSSValueAST;
@@ -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
+
11
+ /**
12
+ * Turn millisecond values to seconds (shorter), except when < 10ms
13
+ */
14
+
15
+ declare function normalizeTimings(
16
+ ast: PostCSSValueAST,
17
+ _: unknown
18
+ ): PostCSSValueAST;
19
+ export default normalizeTimings;
@@ -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
+ * @flow strict
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Turn millisecond values to seconds (shorter), except when < 10ms
13
+ */
14
+
15
+ declare export default function normalizeTimings(
16
+ ast: PostCSSValueAST,
17
+ _: mixed
18
+ ): PostCSSValueAST;
@@ -0,0 +1,20 @@
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
+ /**
12
+ * Use single spaces and remove spaces when not needed: around functions,
13
+ * commas. But preserve spece around + and - as they are required in calc()
14
+ */
15
+
16
+ declare function normalizeWhitespace(
17
+ ast: PostCSSValueAST,
18
+ _: unknown
19
+ ): PostCSSValueAST;
20
+ export default normalizeWhitespace;
@@ -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
+
11
+ /**
12
+ * Use single spaces and remove spaces when not needed: around functions,
13
+ * commas. But preserve spece around + and - as they are required in calc()
14
+ */
15
+
16
+ declare export default function normalizeWhitespace(
17
+ ast: PostCSSValueAST,
18
+ _: mixed
19
+ ): PostCSSValueAST;
@@ -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
+ /**
11
+ * Remove units in zero values, except when required: in angles and timings,
12
+ * in which case make them consistent 0deg and 0s.
13
+ */
14
+
15
+ declare function normalizeZeroDimensions(
16
+ ast: PostCSSValueAST,
17
+ _: unknown
18
+ ): PostCSSValueAST;
19
+ export default normalizeZeroDimensions;
@@ -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
+ * @flow strict
8
+ */
9
+
10
+ /**
11
+ * Remove units in zero values, except when required: in angles and timings,
12
+ * in which case make them consistent 0deg and 0s.
13
+ */
14
+
15
+ declare export default function normalizeZeroDimensions(
16
+ ast: PostCSSValueAST,
17
+ _: mixed
18
+ ): PostCSSValueAST;
@@ -0,0 +1,61 @@
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 { CompiledStyles } from '../common-types';
11
+ import { IncludedStyles } from '../stylex-include';
12
+ export declare function isPlainObject(obj: unknown): boolean;
13
+ export declare function flattenObject(obj: CompiledStyles): {
14
+ readonly [$$Key$$: string]: null | string | IncludedStyles;
15
+ };
16
+ export declare function objEntries<Obj extends {}>(
17
+ obj: Obj
18
+ ): ReadonlyArray<[keyof Obj, Obj[keyof Obj]]>;
19
+ export declare function objValues<Obj extends {}>(
20
+ obj: Obj
21
+ ): ReadonlyArray<Obj[keyof Obj]>;
22
+ export declare function objFromEntries<K extends string | number, V>(
23
+ entries: ReadonlyArray<Readonly<[K, V]>>
24
+ ): { [$$Key$$: K]: V };
25
+ export declare function objMapKeys<
26
+ V,
27
+ K1 extends string | number = string,
28
+ K2 extends string | number = string
29
+ >(
30
+ obj: { readonly [$$Key$$: K1]: V },
31
+ mapper: ($$PARAM_0$$: K1) => K2
32
+ ): { readonly [$$Key$$: K2]: V };
33
+ export declare function objMapEntry<
34
+ V,
35
+ V2,
36
+ K1 extends string | number = string,
37
+ K2 extends string | number = string
38
+ >(
39
+ obj: { readonly [$$Key$$: K1]: V },
40
+ mapper: ($$PARAM_0$$: [K1, V]) => [K2, V2]
41
+ ): { readonly [$$Key$$: K2]: V2 };
42
+ export declare function objMap<V, V2, K extends string | number = string>(
43
+ obj: { readonly [$$Key$$: K]: V },
44
+ mapper: ($$PARAM_0$$: V, $$PARAM_1$$: K) => V2
45
+ ): { readonly [$$Key$$: K]: V2 };
46
+ export declare class Pipe<T> {
47
+ value: T;
48
+ constructor(val: T);
49
+ pipe<T2>(mapper: ($$PARAM_0$$: T) => T2): Pipe<T2>;
50
+ done(): T;
51
+ static create(val: T): Pipe<T>;
52
+ }
53
+ export declare var arraySort: <T>(
54
+ arr: ReadonlyArray<T>,
55
+ fn?: ($$PARAM_0$$: T, $$PARAM_1$$: T) => number
56
+ ) => ReadonlyArray<T>;
57
+ export declare var arrayEquals: <T>(
58
+ arr1: ReadonlyArray<T>,
59
+ arr2: ReadonlyArray<T>,
60
+ equals: ($$PARAM_0$$: T, $$PARAM_1$$: T) => boolean
61
+ ) => boolean;