@stylexjs/shared 0.2.0-beta.16 → 0.2.0-beta.18

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 (100) hide show
  1. package/lib/convert-to-className.d.ts +1 -1
  2. package/lib/convert-to-className.js +6 -22
  3. package/lib/convert-to-className.js.flow +1 -1
  4. package/lib/generate-css-rule.d.ts +1 -1
  5. package/lib/generate-css-rule.js +3 -14
  6. package/lib/generate-css-rule.js.flow +1 -1
  7. package/lib/hash.d.ts +2 -2
  8. package/lib/hash.js +9 -33
  9. package/lib/hash.js.flow +1 -3
  10. package/lib/index.d.ts +9 -9
  11. package/lib/index.js +0 -14
  12. package/lib/index.js.flow +9 -9
  13. package/lib/messages.d.ts +26 -26
  14. package/lib/messages.js +26 -36
  15. package/lib/messages.js.flow +26 -26
  16. package/lib/physical-rtl/generate-ltr.js +39 -67
  17. package/lib/physical-rtl/generate-ltr.js.flow +1 -1
  18. package/lib/physical-rtl/generate-rtl.d.ts +1 -2
  19. package/lib/physical-rtl/generate-rtl.js +57 -89
  20. package/lib/physical-rtl/generate-rtl.js.flow +1 -2
  21. package/lib/preprocess-rules/PreRule.d.ts +3 -3
  22. package/lib/preprocess-rules/PreRule.js +3 -17
  23. package/lib/preprocess-rules/PreRule.js.flow +3 -3
  24. package/lib/preprocess-rules/application-order.d.ts +8 -5
  25. package/lib/preprocess-rules/application-order.js +121 -160
  26. package/lib/preprocess-rules/application-order.js.flow +6 -5
  27. package/lib/preprocess-rules/basic-validation.d.ts +1 -1
  28. package/lib/preprocess-rules/basic-validation.js +6 -15
  29. package/lib/preprocess-rules/basic-validation.js.flow +1 -1
  30. package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +2 -2
  31. package/lib/preprocess-rules/flatten-raw-style-obj.js +14 -43
  32. package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +2 -2
  33. package/lib/preprocess-rules/index.d.ts +2 -2
  34. package/lib/preprocess-rules/index.js +6 -15
  35. package/lib/preprocess-rules/index.js.flow +2 -2
  36. package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +3 -2
  37. package/lib/preprocess-rules/legacy-expand-shorthands.js +14 -33
  38. package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +2 -2
  39. package/lib/preprocess-rules/property-specificity.d.ts +8 -5
  40. package/lib/preprocess-rules/property-specificity.js +54 -76
  41. package/lib/preprocess-rules/property-specificity.js.flow +6 -5
  42. package/lib/stylex-create-vars.d.ts +17 -8
  43. package/lib/stylex-create-vars.js +30 -17
  44. package/lib/stylex-create-vars.js.flow +10 -4
  45. package/lib/stylex-create.d.ts +2 -2
  46. package/lib/stylex-create.js +1 -20
  47. package/lib/stylex-create.js.flow +1 -1
  48. package/lib/stylex-first-that-works.js +0 -10
  49. package/lib/stylex-include.js +0 -10
  50. package/lib/stylex-keyframes.d.ts +1 -1
  51. package/lib/stylex-keyframes.js +7 -27
  52. package/lib/stylex-keyframes.js.flow +1 -1
  53. package/lib/stylex-override-vars.d.ts +11 -4
  54. package/lib/stylex-override-vars.js +32 -18
  55. package/lib/stylex-override-vars.js.flow +3 -3
  56. package/lib/transform-value.js +11 -29
  57. package/lib/transform-value.js.flow +1 -1
  58. package/lib/utils/Rule.d.ts +2 -2
  59. package/lib/utils/Rule.js +0 -21
  60. package/lib/utils/Rule.js.flow +2 -2
  61. package/lib/utils/dashify.js +1 -9
  62. package/lib/utils/default-options.d.ts +1 -1
  63. package/lib/utils/default-options.js +2 -23
  64. package/lib/utils/default-options.js.flow +1 -1
  65. package/lib/utils/file-based-identifier.js +1 -9
  66. package/lib/utils/genCSSRule.d.ts +1 -1
  67. package/lib/utils/genCSSRule.js +6 -16
  68. package/lib/utils/genCSSRule.js.flow +1 -1
  69. package/lib/utils/normalize-value.js +1 -13
  70. package/lib/utils/normalize-value.js.flow +1 -1
  71. package/lib/utils/normalizers/detect-unclosed-fns.d.ts +1 -1
  72. package/lib/utils/normalizers/detect-unclosed-fns.js +2 -14
  73. package/lib/utils/normalizers/detect-unclosed-fns.js.flow +1 -1
  74. package/lib/utils/normalizers/font-size-px-to-rem.d.ts +1 -1
  75. package/lib/utils/normalizers/font-size-px-to-rem.js +4 -19
  76. package/lib/utils/normalizers/font-size-px-to-rem.js.flow +1 -1
  77. package/lib/utils/normalizers/leading-zero.d.ts +1 -1
  78. package/lib/utils/normalizers/leading-zero.js +3 -15
  79. package/lib/utils/normalizers/leading-zero.js.flow +1 -1
  80. package/lib/utils/normalizers/quotes.d.ts +1 -1
  81. package/lib/utils/normalizers/quotes.js +4 -17
  82. package/lib/utils/normalizers/quotes.js.flow +1 -1
  83. package/lib/utils/normalizers/timings.d.ts +1 -1
  84. package/lib/utils/normalizers/timings.js +4 -18
  85. package/lib/utils/normalizers/timings.js.flow +1 -1
  86. package/lib/utils/normalizers/whitespace.d.ts +1 -1
  87. package/lib/utils/normalizers/whitespace.js +12 -27
  88. package/lib/utils/normalizers/whitespace.js.flow +1 -1
  89. package/lib/utils/normalizers/zero-dimensions.d.ts +1 -1
  90. package/lib/utils/normalizers/zero-dimensions.js +8 -23
  91. package/lib/utils/normalizers/zero-dimensions.js.flow +1 -1
  92. package/lib/utils/object-utils.d.ts +28 -20
  93. package/lib/utils/object-utils.js +2 -15
  94. package/lib/utils/object-utils.js.flow +23 -27
  95. package/lib/utils/property-priorities.js +68 -83
  96. package/lib/utils/split-css-value.d.ts +1 -1
  97. package/lib/utils/split-css-value.js +8 -22
  98. package/lib/utils/split-css-value.js.flow +1 -1
  99. package/lib/validate.js +2 -11
  100. package/package.json +2 -3
@@ -12,5 +12,5 @@ declare export function genCSSRule(
12
12
  className: string,
13
13
  decls: string,
14
14
  pseudos: $ReadOnlyArray<string>,
15
- atRules: $ReadOnlyArray<string>
15
+ atRules: $ReadOnlyArray<string>,
16
16
  ): string;
@@ -1,14 +1,4 @@
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
- 'use strict';
1
+ "use strict";
12
2
 
13
3
  Object.defineProperty(exports, "__esModule", {
14
4
  value: true
@@ -23,8 +13,6 @@ var _zeroDimensions = _interopRequireDefault(require("./normalizers/zero-dimensi
23
13
  var _detectUnclosedFns = _interopRequireDefault(require("./normalizers/detect-unclosed-fns"));
24
14
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
25
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
- // `Timings` should be before `LeadingZero`, because it
27
- // changes 500ms to 0.5s, then `LeadingZero` makes it .5s
28
16
  const normalizers = [_detectUnclosedFns.default, _whitespace.default, _timings.default, _zeroDimensions.default, _leadingZero.default, _quotes.default, _fontSizePxToRem.default];
29
17
  function normalizeValue(value, key) {
30
18
  if (value == null) {
@@ -10,5 +10,5 @@
10
10
 
11
11
  declare export default function normalizeValue(
12
12
  value: string,
13
- key: string
13
+ key: string,
14
14
  ): string;
@@ -12,6 +12,6 @@
12
12
  */
13
13
  declare function detectUnclosedFns(
14
14
  ast: PostCSSValueAST,
15
- _: unknown
15
+ _: unknown,
16
16
  ): PostCSSValueAST;
17
17
  export default detectUnclosedFns;
@@ -1,13 +1,4 @@
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
- 'use strict';
1
+ "use strict";
11
2
 
12
3
  Object.defineProperty(exports, "__esModule", {
13
4
  value: true
@@ -16,12 +7,9 @@ exports.default = detectUnclosedFns;
16
7
  var messages = _interopRequireWildcard(require("../../messages"));
17
8
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
9
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
- /**
20
- * Remove leading zeros from numbers
21
- */
22
10
  function detectUnclosedFns(ast, _) {
23
11
  ast.walk(node => {
24
- if (node.type === 'function' && node.unclosed) {
12
+ if (node.type === "function" && node.unclosed) {
25
13
  throw new Error(messages.LINT_UNCLOSED_FUNCTION);
26
14
  }
27
15
  });
@@ -12,5 +12,5 @@
12
12
  */
13
13
  declare export default function detectUnclosedFns(
14
14
  ast: PostCSSValueAST,
15
- _: mixed
15
+ _: mixed,
16
16
  ): PostCSSValueAST;
@@ -14,6 +14,6 @@
14
14
  */
15
15
  declare function convertFontSizeToRem(
16
16
  ast: PostCSSValueAST,
17
- key: string
17
+ key: string,
18
18
  ): PostCSSValueAST;
19
19
  export default convertFontSizeToRem;
@@ -1,13 +1,4 @@
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
- 'use strict';
1
+ "use strict";
11
2
 
12
3
  Object.defineProperty(exports, "__esModule", {
13
4
  value: true
@@ -16,22 +7,16 @@ exports.default = convertFontSizeToRem;
16
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
17
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
9
  const ROOT_FONT_SIZE = 16;
19
-
20
- /**
21
- * Convert font sizes from absolute unit `px` to relative unit `rem`.
22
- * This will allow developers to continue thinking and using what's familiar
23
- * while we output font sizes that are adjustable
24
- */
25
10
  function convertFontSizeToRem(ast, key) {
26
- if (key !== 'fontSize') {
11
+ if (key !== "fontSize") {
27
12
  return ast;
28
13
  }
29
14
  ast.walk(node => {
30
- if (node.type !== 'word') {
15
+ if (node.type !== "word") {
31
16
  return;
32
17
  }
33
18
  const dimension = _postcssValueParser.default.unit(node.value);
34
- if (dimension && dimension.unit === 'px') {
19
+ if (dimension && dimension.unit === "px") {
35
20
  node.value = `${parseFloat(dimension.number) / ROOT_FONT_SIZE}rem`;
36
21
  }
37
22
  });
@@ -14,5 +14,5 @@
14
14
  */
15
15
  declare export default function convertFontSizeToRem(
16
16
  ast: PostCSSValueAST,
17
- key: string
17
+ key: string,
18
18
  ): PostCSSValueAST;
@@ -12,6 +12,6 @@
12
12
  */
13
13
  declare function normalizeLeadingZero(
14
14
  ast: PostCSSValueAST,
15
- _: unknown
15
+ _: unknown,
16
16
  ): PostCSSValueAST;
17
17
  export default normalizeLeadingZero;
@@ -1,13 +1,4 @@
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
- 'use strict';
1
+ "use strict";
11
2
 
12
3
  Object.defineProperty(exports, "__esModule", {
13
4
  value: true
@@ -15,12 +6,9 @@ Object.defineProperty(exports, "__esModule", {
15
6
  exports.default = normalizeLeadingZero;
16
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
17
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
- /**
19
- * Remove leading zeros from numbers
20
- */
21
9
  function normalizeLeadingZero(ast, _) {
22
10
  ast.walk(node => {
23
- if (node.type !== 'word') {
11
+ if (node.type !== "word") {
24
12
  return;
25
13
  }
26
14
  const value = Number.parseFloat(node.value);
@@ -29,7 +17,7 @@ function normalizeLeadingZero(ast, _) {
29
17
  }
30
18
  const dimension = _postcssValueParser.default.unit(node.value);
31
19
  if (value < 1 && value >= 0) {
32
- node.value = value.toString().replace('0.', '.') + (dimension ? dimension.unit : '');
20
+ node.value = value.toString().replace("0.", ".") + (dimension ? dimension.unit : "");
33
21
  }
34
22
  });
35
23
  return ast;
@@ -12,5 +12,5 @@
12
12
  */
13
13
  declare export default function normalizeLeadingZero(
14
14
  ast: PostCSSValueAST,
15
- _: mixed
15
+ _: mixed,
16
16
  ): PostCSSValueAST;
@@ -14,6 +14,6 @@
14
14
 
15
15
  declare function normalizeQuotes(
16
16
  ast: PostCSSValueAST,
17
- _: unknown
17
+ _: unknown,
18
18
  ): PostCSSValueAST;
19
19
  export default normalizeQuotes;
@@ -1,29 +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
- */
1
+ "use strict";
10
2
 
11
- 'use strict';
12
-
13
- /**
14
- * Make empty strings use consistent double quotes
15
- */
16
3
  Object.defineProperty(exports, "__esModule", {
17
4
  value: true
18
5
  });
19
6
  exports.default = normalizeQuotes;
20
7
  function normalizeQuotes(ast, _) {
21
8
  ast.walk(node => {
22
- if (node.type !== 'string') {
9
+ if (node.type !== "string") {
23
10
  return;
24
11
  }
25
- if (node.value === '') {
26
- node.quote = '"';
12
+ if (node.value === "") {
13
+ node.quote = "\"";
27
14
  }
28
15
  });
29
16
  return ast;
@@ -14,5 +14,5 @@
14
14
 
15
15
  declare export default function normalizeQuotes(
16
16
  ast: PostCSSValueAST,
17
- _: mixed
17
+ _: mixed,
18
18
  ): PostCSSValueAST;
@@ -14,6 +14,6 @@
14
14
 
15
15
  declare function normalizeTimings(
16
16
  ast: PostCSSValueAST,
17
- _: unknown
17
+ _: unknown,
18
18
  ): PostCSSValueAST;
19
19
  export default normalizeTimings;
@@ -1,14 +1,4 @@
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
- 'use strict';
1
+ "use strict";
12
2
 
13
3
  Object.defineProperty(exports, "__esModule", {
14
4
  value: true
@@ -16,13 +6,9 @@ Object.defineProperty(exports, "__esModule", {
16
6
  exports.default = normalizeTimings;
17
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
18
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
- /**
20
- * Turn millisecond values to seconds (shorter), except when < 10ms
21
- */
22
-
23
9
  function normalizeTimings(ast, _) {
24
10
  ast.walk(node => {
25
- if (node.type !== 'word') {
11
+ if (node.type !== "word") {
26
12
  return;
27
13
  }
28
14
  const value = Number.parseFloat(node.value);
@@ -30,10 +16,10 @@ function normalizeTimings(ast, _) {
30
16
  return;
31
17
  }
32
18
  const dimension = _postcssValueParser.default.unit(node.value);
33
- if (!dimension || dimension.unit !== 'ms' || value < 10) {
19
+ if (!dimension || dimension.unit !== "ms" || value < 10) {
34
20
  return;
35
21
  }
36
- node.value = value / 1000 + 's';
22
+ node.value = value / 1000 + "s";
37
23
  });
38
24
  return ast;
39
25
  }
@@ -14,5 +14,5 @@
14
14
 
15
15
  declare export default function normalizeTimings(
16
16
  ast: PostCSSValueAST,
17
- _: mixed
17
+ _: mixed,
18
18
  ): PostCSSValueAST;
@@ -15,6 +15,6 @@
15
15
 
16
16
  declare function normalizeWhitespace(
17
17
  ast: PostCSSValueAST,
18
- _: unknown
18
+ _: unknown,
19
19
  ): PostCSSValueAST;
20
20
  export default normalizeWhitespace;
@@ -1,49 +1,34 @@
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
- */
1
+ "use strict";
10
2
 
11
- 'use strict';
12
-
13
- /**
14
- * Use single spaces and remove spaces when not needed: around functions,
15
- * commas. But preserve spece around + and - as they are required in calc()
16
- */
17
3
  Object.defineProperty(exports, "__esModule", {
18
4
  value: true
19
5
  });
20
6
  exports.default = normalizeWhitespace;
21
7
  function normalizeWhitespace(ast, _) {
22
- // trim
23
- if (ast.nodes[0].type === 'space') {
8
+ if (ast.nodes[0].type === "space") {
24
9
  ast.nodes.shift();
25
10
  }
26
- if (ast.nodes[ast.nodes.length - 1].type === 'space') {
11
+ if (ast.nodes[ast.nodes.length - 1].type === "space") {
27
12
  ast.nodes.pop();
28
13
  }
29
14
  ast.walk((node, idx) => {
30
15
  switch (node.type) {
31
- case 'space':
16
+ case "space":
32
17
  {
33
- node.value = ' ';
18
+ node.value = " ";
34
19
  break;
35
20
  }
36
- case 'div':
37
- case 'function':
21
+ case "div":
22
+ case "function":
38
23
  {
39
- node.before = '';
40
- node.after = '';
24
+ node.before = "";
25
+ node.after = "";
41
26
  break;
42
27
  }
43
- case 'word':
28
+ case "word":
44
29
  {
45
- if (node.value === '!important') {
46
- if (ast.nodes[idx - 1] && ast.nodes[idx - 1].type === 'space') {
30
+ if (node.value === "!important") {
31
+ if (ast.nodes[idx - 1] && ast.nodes[idx - 1].type === "space") {
47
32
  ast.nodes.splice(idx - 1, 1);
48
33
  }
49
34
  }
@@ -15,5 +15,5 @@
15
15
 
16
16
  declare export default function normalizeWhitespace(
17
17
  ast: PostCSSValueAST,
18
- _: mixed
18
+ _: mixed,
19
19
  ): PostCSSValueAST;
@@ -14,6 +14,6 @@
14
14
 
15
15
  declare function normalizeZeroDimensions(
16
16
  ast: PostCSSValueAST,
17
- _: unknown
17
+ _: unknown,
18
18
  ): PostCSSValueAST;
19
19
  export default normalizeZeroDimensions;
@@ -1,13 +1,4 @@
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
- 'use strict';
1
+ "use strict";
11
2
 
12
3
  Object.defineProperty(exports, "__esModule", {
13
4
  value: true
@@ -15,29 +6,23 @@ Object.defineProperty(exports, "__esModule", {
15
6
  exports.default = normalizeZeroDimensions;
16
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
17
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
- const angles = ['deg', 'grad', 'turn', 'rad'];
19
- const timings = ['ms', 's'];
20
-
21
- /**
22
- * Remove units in zero values, except when required: in angles and timings,
23
- * in which case make them consistent 0deg and 0s.
24
- */
25
-
9
+ const angles = ["deg", "grad", "turn", "rad"];
10
+ const timings = ["ms", "s"];
26
11
  function normalizeZeroDimensions(ast, _) {
27
12
  ast.walk(node => {
28
- if (node.type !== 'word') {
13
+ if (node.type !== "word") {
29
14
  return;
30
15
  }
31
16
  const dimension = _postcssValueParser.default.unit(node.value);
32
- if (!dimension || dimension.number !== '0') {
17
+ if (!dimension || dimension.number !== "0") {
33
18
  return;
34
19
  }
35
20
  if (angles.indexOf(dimension.unit) !== -1) {
36
- node.value = '0deg';
21
+ node.value = "0deg";
37
22
  } else if (timings.indexOf(dimension.unit) !== -1) {
38
- node.value = '0s';
23
+ node.value = "0s";
39
24
  } else {
40
- node.value = '0';
25
+ node.value = "0";
41
26
  }
42
27
  });
43
28
  return ast;
@@ -14,5 +14,5 @@
14
14
 
15
15
  declare export default function normalizeZeroDimensions(
16
16
  ast: PostCSSValueAST,
17
- _: mixed
17
+ _: mixed,
18
18
  ): PostCSSValueAST;
@@ -9,39 +9,47 @@
9
9
 
10
10
  import type { CompiledStyles } from '../common-types';
11
11
  import { IncludedStyles } from '../stylex-include';
12
- export declare function isPlainObject(obj: unknown): boolean;
12
+ export declare function isPlainObject(obj: unknown): void;
13
13
  export declare function flattenObject(obj: CompiledStyles): {
14
14
  readonly [$$Key$$: string]: null | string | IncludedStyles;
15
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]>;
16
+ type _ObjectEntries<Obj extends { readonly [$$Key$$: string]: unknown }> =
17
+ /**
18
+ * > 23 | [Key in keyof Obj]: [Key, Obj[Key]],
19
+ * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object type with mapped type property" is currently not supported.
20
+ **/
21
+ any;
22
+ type ObjectEntries<Obj extends { readonly [$$Key$$: string]: unknown }> =
23
+ _ObjectEntries<Obj>[keyof _ObjectEntries<Obj>];
24
+ export declare function objEntries<
25
+ Obj extends { readonly [$$Key$$: string]: unknown },
26
+ >(obj: Obj): ReadonlyArray<ObjectEntries<Obj>>;
27
+ export declare function objValues<
28
+ Obj extends { readonly [$$Key$$: string]: unknown },
29
+ >(obj: Obj): ReadonlyArray<Obj[keyof Obj]>;
22
30
  export declare function objFromEntries<K extends string | number, V>(
23
- entries: ReadonlyArray<Readonly<[K, V]>>
31
+ entries: ReadonlyArray<Readonly<[K, V]>>,
24
32
  ): { [$$Key$$: K]: V };
25
33
  export declare function objMapKeys<
26
34
  V,
27
- K1 extends string | number = string,
28
- K2 extends string | number = string
35
+ K1 extends string = string,
36
+ K2 extends string = string,
29
37
  >(
30
38
  obj: { readonly [$$Key$$: K1]: V },
31
- mapper: ($$PARAM_0$$: K1) => K2
39
+ mapper: ($$PARAM_0$$: K1) => K2,
32
40
  ): { readonly [$$Key$$: K2]: V };
33
41
  export declare function objMapEntry<
34
42
  V,
35
43
  V2,
36
- K1 extends string | number = string,
37
- K2 extends string | number = string
44
+ K1 extends string = string,
45
+ K2 extends string = string,
38
46
  >(
39
47
  obj: { readonly [$$Key$$: K1]: V },
40
- mapper: ($$PARAM_0$$: [K1, V]) => [K2, V2]
48
+ mapper: ($$PARAM_0$$: [K1, V]) => [K2, V2],
41
49
  ): { readonly [$$Key$$: K2]: V2 };
42
- export declare function objMap<V, V2, K extends string | number = string>(
50
+ export declare function objMap<V, V2, K extends string = string>(
43
51
  obj: { readonly [$$Key$$: K]: V },
44
- mapper: ($$PARAM_0$$: V, $$PARAM_1$$: K) => V2
52
+ mapper: ($$PARAM_0$$: V, $$PARAM_1$$: K) => V2,
45
53
  ): { readonly [$$Key$$: K]: V2 };
46
54
  export declare class Pipe<T> {
47
55
  value: T;
@@ -50,12 +58,12 @@ export declare class Pipe<T> {
50
58
  done(): T;
51
59
  static create(val: T): Pipe<T>;
52
60
  }
53
- export declare var arraySort: <T>(
61
+ export declare const arraySort: <T>(
54
62
  arr: ReadonlyArray<T>,
55
- fn?: ($$PARAM_0$$: T, $$PARAM_1$$: T) => number
63
+ fn?: ($$PARAM_0$$: T, $$PARAM_1$$: T) => number,
56
64
  ) => ReadonlyArray<T>;
57
- export declare var arrayEquals: <T>(
65
+ export declare const arrayEquals: <T>(
58
66
  arr1: ReadonlyArray<T>,
59
67
  arr2: ReadonlyArray<T>,
60
- equals: ($$PARAM_0$$: T, $$PARAM_1$$: T) => boolean
68
+ equals: ($$PARAM_0$$: T, $$PARAM_1$$: T) => boolean,
61
69
  ) => boolean;
@@ -13,24 +13,13 @@ exports.objMapEntry = objMapEntry;
13
13
  exports.objMapKeys = objMapKeys;
14
14
  exports.objValues = objValues;
15
15
  var _stylexInclude = require("../stylex-include");
16
- /**
17
- * Copyright (c) Meta Platforms, Inc. and affiliates.
18
- *
19
- * This source code is licensed under the MIT license found in the
20
- * LICENSE file in the root directory of this source tree.
21
- *
22
- *
23
- */
24
-
25
- // A bunch of object utils with better Flow types
26
-
27
16
  function isPlainObject(obj) {
28
- return typeof obj === 'object' && obj != null && !Array.isArray(obj) && (obj === null || obj === void 0 ? void 0 : obj.constructor) === Object;
17
+ return typeof obj === "object" && obj != null && !Array.isArray(obj) && obj?.constructor === Object;
29
18
  }
30
19
  function flattenObject(obj) {
31
20
  const result = {};
32
21
  for (const [key, value] of objEntries(obj)) {
33
- if (typeof value === 'string' || value == null) {
22
+ if (typeof value === "string" || value == null) {
34
23
  result[key] = value;
35
24
  } else if (value instanceof _stylexInclude.IncludedStyles) {
36
25
  result[key] = value;
@@ -95,8 +84,6 @@ class Pipe {
95
84
  return new Pipe(val);
96
85
  }
97
86
  }
98
-
99
- // Function that sorts an array without mutating it and returns a new array
100
87
  exports.Pipe = Pipe;
101
88
  const arraySort = (arr, fn) => [...arr].sort(fn);
102
89
  exports.arraySort = arraySort;