@stylexjs/shared 0.2.0-beta.9 → 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.
- package/lib/common-types.d.ts +50 -0
- package/lib/common-types.js.flow +65 -0
- package/lib/convert-to-className.d.ts +16 -0
- package/lib/convert-to-className.js +17 -26
- package/lib/convert-to-className.js.flow +23 -0
- package/lib/generate-css-rule.d.ts +17 -0
- package/lib/generate-css-rule.js +6 -17
- package/lib/generate-css-rule.js.flow +17 -0
- package/lib/hash.d.ts +11 -0
- package/lib/hash.js +3 -27
- package/lib/hash.js.flow +10 -0
- package/lib/index.d.ts +42 -85
- package/lib/index.js +19 -27
- package/lib/index.js.flow +57 -3
- package/lib/messages.d.ts +36 -0
- package/lib/messages.js +28 -53
- package/lib/messages.js.flow +39 -0
- package/lib/physical-rtl/generate-ltr.d.ts +11 -0
- package/lib/physical-rtl/generate-ltr.js +18 -46
- package/lib/physical-rtl/generate-ltr.js.flow +12 -0
- package/lib/physical-rtl/generate-rtl.d.ts +13 -0
- package/lib/physical-rtl/generate-rtl.js +18 -50
- package/lib/physical-rtl/generate-rtl.js.flow +12 -0
- package/lib/preprocess-rules/PreRule.d.ts +52 -0
- package/lib/preprocess-rules/PreRule.js +87 -0
- package/lib/preprocess-rules/PreRule.js.flow +64 -0
- package/lib/preprocess-rules/application-order.d.ts +290 -0
- package/lib/preprocess-rules/application-order.js +59 -125
- package/lib/preprocess-rules/application-order.js.flow +241 -0
- package/lib/preprocess-rules/basic-validation.d.ts +13 -0
- package/lib/preprocess-rules/basic-validation.js +83 -0
- package/lib/preprocess-rules/basic-validation.js.flow +13 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +25 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js +120 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +27 -0
- package/lib/preprocess-rules/index.d.ts +18 -0
- package/lib/preprocess-rules/index.js +0 -9
- package/lib/preprocess-rules/index.js.flow +19 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +200 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.js +90 -123
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +179 -0
- package/lib/preprocess-rules/property-specificity.d.ts +89 -0
- package/lib/preprocess-rules/property-specificity.js +46 -74
- package/lib/preprocess-rules/property-specificity.js.flow +98 -0
- package/lib/properties/CSS Animations.json +445 -0
- package/lib/properties/CSS Backgrounds and Borders.json +1085 -0
- package/lib/properties/CSS Basic User Interface.json +365 -0
- package/lib/properties/CSS Box Alignment.json +245 -0
- package/lib/properties/CSS Box Model.json +501 -0
- package/lib/properties/CSS Color.json +100 -0
- package/lib/properties/CSS Columns.json +185 -0
- package/lib/properties/CSS Containment.json +203 -0
- package/lib/properties/CSS Counter Styles.json +56 -0
- package/lib/properties/CSS Display.json +20 -0
- package/lib/properties/CSS Flexible Box Layout.json +167 -0
- package/lib/properties/CSS Fonts.json +684 -0
- package/lib/properties/CSS Fragmentation.json +110 -0
- package/lib/properties/CSS Generated Content.json +38 -0
- package/lib/properties/CSS Grid Layout.json +500 -0
- package/lib/properties/CSS Images.json +91 -0
- package/lib/properties/CSS Inline.json +38 -0
- package/lib/properties/CSS Lists and Counters.json +86 -0
- package/lib/properties/CSS Logical Properties.json +1086 -0
- package/lib/properties/CSS Masking.json +399 -0
- package/lib/properties/CSS Miscellaneous.json +38 -0
- package/lib/properties/CSS Motion Path.json +132 -0
- package/lib/properties/CSS Overflow.json +216 -0
- package/lib/properties/CSS Pages.json +83 -0
- package/lib/properties/CSS Positioning.json +166 -0
- package/lib/properties/CSS Ruby.json +55 -0
- package/lib/properties/CSS Scroll Anchoring.json +19 -0
- package/lib/properties/CSS Scroll Snap.json +604 -0
- package/lib/properties/CSS Scrollbars.json +38 -0
- package/lib/properties/CSS Shapes.json +56 -0
- package/lib/properties/CSS Speech.json +20 -0
- package/lib/properties/CSS Table.json +115 -0
- package/lib/properties/CSS Text Decoration.json +312 -0
- package/lib/properties/CSS Text.json +415 -0
- package/lib/properties/CSS Transforms.json +188 -0
- package/lib/properties/CSS Transitions.json +122 -0
- package/lib/properties/CSS Variables.json +20 -0
- package/lib/properties/CSS View Transitions.json +20 -0
- package/lib/properties/CSS Will Change.json +20 -0
- package/lib/properties/CSS Writing Modes.json +92 -0
- package/lib/properties/Compositing and Blending.json +62 -0
- package/lib/properties/Filter Effects.json +38 -0
- package/lib/properties/MathML.json +56 -0
- package/lib/properties/Microsoft Extensions.json +885 -0
- package/lib/properties/Mozilla Extensions.json +607 -0
- package/lib/properties/Pointer Events.json +20 -0
- package/lib/properties/WebKit Extensions.json +707 -0
- package/lib/properties.json +10122 -0
- package/lib/stylex-create-theme.d.ts +26 -0
- package/lib/stylex-create-theme.js +62 -0
- package/lib/stylex-create-theme.js.flow +19 -0
- package/lib/stylex-create.d.ts +23 -0
- package/lib/stylex-create.js +30 -146
- package/lib/stylex-create.js.flow +30 -0
- package/lib/stylex-define-vars.d.ts +36 -0
- package/lib/stylex-define-vars.js +72 -0
- package/lib/stylex-define-vars.js.flow +28 -0
- package/lib/stylex-first-that-works.d.ts +13 -0
- package/lib/stylex-first-that-works.js +0 -10
- package/lib/stylex-first-that-works.js.flow +12 -0
- package/lib/stylex-include.d.ts +18 -0
- package/lib/stylex-include.js +0 -10
- package/lib/stylex-include.js.flow +20 -0
- package/lib/stylex-keyframes.d.ts +17 -0
- package/lib/stylex-keyframes.js +6 -26
- package/lib/stylex-keyframes.js.flow +20 -0
- package/lib/transform-value.d.ts +22 -0
- package/lib/transform-value.js +9 -23
- package/lib/transform-value.js.flow +25 -0
- package/lib/types/index.d.ts +205 -0
- package/lib/types/index.js +191 -0
- package/lib/types/index.js.flow +241 -0
- package/lib/utils/Rule.d.ts +58 -0
- package/lib/utils/Rule.js +0 -21
- package/lib/utils/Rule.js.flow +64 -0
- package/lib/utils/dashify.d.ts +11 -0
- package/lib/utils/dashify.js +0 -8
- package/lib/utils/dashify.js.flow +10 -0
- package/lib/utils/default-options.d.ts +11 -0
- package/lib/utils/default-options.js +14 -0
- package/lib/utils/default-options.js.flow +25 -0
- package/lib/utils/file-based-identifier.d.ts +15 -0
- package/lib/utils/file-based-identifier.js +14 -0
- package/lib/utils/file-based-identifier.js.flow +14 -0
- package/lib/utils/genCSSRule.d.ts +15 -0
- package/lib/utils/genCSSRule.js +9 -18
- package/lib/utils/genCSSRule.js.flow +15 -0
- package/lib/utils/normalize-value.d.ts +16 -0
- package/lib/utils/normalize-value.js +8 -15
- package/lib/utils/normalize-value.js.flow +16 -0
- package/lib/utils/normalizers/convert-camel-case-transition-props.d.ts +14 -0
- package/lib/utils/normalizers/convert-camel-case-transition-props.js +23 -0
- package/lib/utils/normalizers/convert-camel-case-transition-props.js.flow +13 -0
- package/lib/utils/normalizers/convert-camel-case-values.d.ts +14 -0
- package/lib/utils/normalizers/convert-camel-case-values.js +23 -0
- package/lib/utils/normalizers/convert-camel-case-values.js.flow +13 -0
- package/lib/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
- package/lib/utils/normalizers/detect-unclosed-fns.js +0 -12
- package/lib/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
- package/lib/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
- package/lib/utils/normalizers/font-size-px-to-rem.js +9 -19
- package/lib/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
- package/lib/utils/normalizers/leading-zero.d.ts +17 -0
- package/lib/utils/normalizers/leading-zero.js +0 -12
- package/lib/utils/normalizers/leading-zero.js.flow +16 -0
- package/lib/utils/normalizers/quotes.d.ts +18 -0
- package/lib/utils/normalizers/quotes.js +0 -13
- package/lib/utils/normalizers/quotes.js.flow +17 -0
- package/lib/utils/normalizers/timings.d.ts +18 -0
- package/lib/utils/normalizers/timings.js +0 -14
- package/lib/utils/normalizers/timings.js.flow +17 -0
- package/lib/utils/normalizers/whitespace.d.ts +19 -0
- package/lib/utils/normalizers/whitespace.js +0 -15
- package/lib/utils/normalizers/whitespace.js.flow +18 -0
- package/lib/utils/normalizers/zero-dimensions.d.ts +19 -0
- package/lib/utils/normalizers/zero-dimensions.js +0 -15
- package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
- package/lib/utils/object-utils.d.ts +66 -0
- package/lib/utils/object-utils.js +21 -13
- package/lib/utils/object-utils.js.flow +77 -0
- package/lib/utils/property-priorities.d.ts +11 -0
- package/lib/utils/property-priorities.js +516 -101
- package/lib/utils/property-priorities.js.flow +10 -0
- package/lib/utils/split-css-value.d.ts +14 -0
- package/lib/utils/split-css-value.js +0 -14
- package/lib/utils/split-css-value.js.flow +15 -0
- package/lib/validate.d.ts +12 -0
- package/lib/validate.js +1 -10
- package/lib/validate.js.flow +12 -0
- package/package.json +4 -5
- package/lib/expand-shorthands.d.ts +0 -5
- package/lib/expand-shorthands.js +0 -330
- package/lib/namespace-transforms/__tests__/preflatten.test.js +0 -120
- package/lib/namespace-transforms/preflatten.js +0 -89
- package/lib/preprocess-rules/expand-shorthands.js +0 -156
- package/lib/preprocess-rules/null-out-longhand.js +0 -310
- package/lib/preprocess-rules/react-native-web.js +0 -142
- package/lib/stylex-defaultValue.js +0 -397
|
@@ -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
|
+
|
|
10
|
+
declare function convertCamelCasedTransitionProps(
|
|
11
|
+
ast: PostCSSValueAST,
|
|
12
|
+
key: string,
|
|
13
|
+
): PostCSSValueAST;
|
|
14
|
+
export default convertCamelCasedTransitionProps;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = convertCamelCasedTransitionProps;
|
|
7
|
+
var _dashify = _interopRequireDefault(require("../dashify"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
function convertCamelCasedTransitionProps(ast, key) {
|
|
10
|
+
if (key !== 'transitionProperty') {
|
|
11
|
+
return ast;
|
|
12
|
+
}
|
|
13
|
+
const nodes = ast.nodes;
|
|
14
|
+
if (!nodes) {
|
|
15
|
+
return ast;
|
|
16
|
+
}
|
|
17
|
+
nodes.forEach(node => {
|
|
18
|
+
if (node.type === 'word' && !node.value.startsWith('--')) {
|
|
19
|
+
node.value = (0, _dashify.default)(node.value);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return ast;
|
|
23
|
+
}
|
|
@@ -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
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare export default function convertCamelCasedTransitionProps(
|
|
11
|
+
ast: PostCSSValueAST,
|
|
12
|
+
key: string,
|
|
13
|
+
): PostCSSValueAST;
|
|
@@ -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
|
+
|
|
10
|
+
declare function convertCamelCasedValues(
|
|
11
|
+
ast: PostCSSValueAST,
|
|
12
|
+
key: string,
|
|
13
|
+
): PostCSSValueAST;
|
|
14
|
+
export default convertCamelCasedValues;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = convertCamelCasedValues;
|
|
7
|
+
var _dashify = _interopRequireDefault(require("../dashify"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
function convertCamelCasedValues(ast, key) {
|
|
10
|
+
if (key !== 'transitionProperty' && key !== 'willChange') {
|
|
11
|
+
return ast;
|
|
12
|
+
}
|
|
13
|
+
const nodes = ast.nodes;
|
|
14
|
+
if (!nodes) {
|
|
15
|
+
return ast;
|
|
16
|
+
}
|
|
17
|
+
nodes.forEach(node => {
|
|
18
|
+
if (node.type === 'word' && !node.value.startsWith('--')) {
|
|
19
|
+
node.value = (0, _dashify.default)(node.value);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return ast;
|
|
23
|
+
}
|
|
@@ -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
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare export default function convertCamelCasedValues(
|
|
11
|
+
ast: PostCSSValueAST,
|
|
12
|
+
key: string,
|
|
13
|
+
): 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 detectUnclosedFns(
|
|
14
|
+
ast: PostCSSValueAST,
|
|
15
|
+
_: unknown,
|
|
16
|
+
): PostCSSValueAST;
|
|
17
|
+
export default detectUnclosedFns;
|
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
'use strict';
|
|
11
2
|
|
|
12
3
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -16,9 +7,6 @@ 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
12
|
if (node.type === 'function' && node.unclosed) {
|
|
@@ -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;
|
|
@@ -1,23 +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
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
1
|
'use strict';
|
|
11
2
|
|
|
12
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = convertFontSizeToRem;
|
|
7
|
+
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
9
|
const ROOT_FONT_SIZE = 16;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Convert font sizes from absolute unit `px` to relative unit `rem`.
|
|
17
|
-
* This will allow developers to continue thinking and using what's familiar
|
|
18
|
-
* while we output font sizes that are adjustable
|
|
19
|
-
*/
|
|
20
|
-
module.exports = function convertFontSizeToRem(ast, key) {
|
|
10
|
+
function convertFontSizeToRem(ast, key) {
|
|
21
11
|
if (key !== 'fontSize') {
|
|
22
12
|
return ast;
|
|
23
13
|
}
|
|
@@ -25,10 +15,10 @@ module.exports = function convertFontSizeToRem(ast, key) {
|
|
|
25
15
|
if (node.type !== 'word') {
|
|
26
16
|
return;
|
|
27
17
|
}
|
|
28
|
-
const dimension =
|
|
18
|
+
const dimension = _postcssValueParser.default.unit(node.value);
|
|
29
19
|
if (dimension && dimension.unit === 'px') {
|
|
30
20
|
node.value = `${parseFloat(dimension.number) / ROOT_FONT_SIZE}rem`;
|
|
31
21
|
}
|
|
32
22
|
});
|
|
33
23
|
return ast;
|
|
34
|
-
}
|
|
24
|
+
}
|
|
@@ -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;
|
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
'use strict';
|
|
11
2
|
|
|
12
3
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -15,9 +6,6 @@ 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
11
|
if (node.type !== 'word') {
|
|
@@ -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,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
|
+
/**
|
|
11
|
+
* Make empty strings use consistent double quotes
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare function normalizeQuotes(
|
|
15
|
+
ast: PostCSSValueAST,
|
|
16
|
+
_: unknown,
|
|
17
|
+
): PostCSSValueAST;
|
|
18
|
+
export default normalizeQuotes;
|
|
@@ -1,18 +1,5 @@
|
|
|
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
1
|
'use strict';
|
|
12
2
|
|
|
13
|
-
/**
|
|
14
|
-
* Make empty strings use consistent double quotes
|
|
15
|
-
*/
|
|
16
3
|
Object.defineProperty(exports, "__esModule", {
|
|
17
4
|
value: true
|
|
18
5
|
});
|
|
@@ -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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Make empty strings use consistent double quotes
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare export default function normalizeQuotes(
|
|
15
|
+
ast: PostCSSValueAST,
|
|
16
|
+
_: mixed,
|
|
17
|
+
): PostCSSValueAST;
|
|
@@ -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
|
+
/**
|
|
11
|
+
* Turn millisecond values to seconds (shorter), except when < 10ms
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare function normalizeTimings(
|
|
15
|
+
ast: PostCSSValueAST,
|
|
16
|
+
_: unknown,
|
|
17
|
+
): PostCSSValueAST;
|
|
18
|
+
export default normalizeTimings;
|
|
@@ -1,13 +1,3 @@
|
|
|
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
1
|
'use strict';
|
|
12
2
|
|
|
13
3
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -16,10 +6,6 @@ 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
11
|
if (node.type !== 'word') {
|
|
@@ -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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Turn millisecond values to seconds (shorter), except when < 10ms
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare export default function normalizeTimings(
|
|
15
|
+
ast: PostCSSValueAST,
|
|
16
|
+
_: mixed,
|
|
17
|
+
): 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
|
+
* Use single spaces and remove spaces when not needed: around functions,
|
|
12
|
+
* commas. But preserve spece around + and - as they are required in calc()
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare function normalizeWhitespace(
|
|
16
|
+
ast: PostCSSValueAST,
|
|
17
|
+
_: unknown,
|
|
18
|
+
): PostCSSValueAST;
|
|
19
|
+
export default normalizeWhitespace;
|
|
@@ -1,25 +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
|
-
*/
|
|
10
|
-
|
|
11
1
|
'use strict';
|
|
12
2
|
|
|
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
8
|
if (ast.nodes[0].type === 'space') {
|
|
24
9
|
ast.nodes.shift();
|
|
25
10
|
}
|
|
@@ -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
|
+
* Use single spaces and remove spaces when not needed: around functions,
|
|
12
|
+
* commas. But preserve spece around + and - as they are required in calc()
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare export default function normalizeWhitespace(
|
|
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
|
+
* 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;
|
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
'use strict';
|
|
11
2
|
|
|
12
3
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -17,12 +8,6 @@ var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser")
|
|
|
17
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
9
|
const angles = ['deg', 'grad', 'turn', 'rad'];
|
|
19
10
|
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
|
-
|
|
26
11
|
function normalizeZeroDimensions(ast, _) {
|
|
27
12
|
ast.walk(node => {
|
|
28
13
|
if (node.type !== 'word') {
|
|
@@ -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,66 @@
|
|
|
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): void;
|
|
13
|
+
export declare function flattenObject(obj: CompiledStyles): {
|
|
14
|
+
readonly [$$Key$$: string]: null | string | IncludedStyles;
|
|
15
|
+
};
|
|
16
|
+
type _ObjectEntries<Obj extends { readonly [$$Key$$: string]: unknown }> = {
|
|
17
|
+
[Key in keyof Obj]: [Key, Obj[Key]];
|
|
18
|
+
};
|
|
19
|
+
type ObjectEntries<Obj extends { readonly [$$Key$$: string]: unknown }> =
|
|
20
|
+
_ObjectEntries<Obj>[keyof _ObjectEntries<Obj>];
|
|
21
|
+
export declare function objEntries<
|
|
22
|
+
Obj extends { readonly [$$Key$$: string]: unknown },
|
|
23
|
+
>(obj: Obj): ReadonlyArray<ObjectEntries<Obj>>;
|
|
24
|
+
export declare function objValues<
|
|
25
|
+
Obj extends { readonly [$$Key$$: string]: unknown },
|
|
26
|
+
>(obj: Obj): ReadonlyArray<Obj[keyof Obj]>;
|
|
27
|
+
export declare function objFromEntries<K extends string | number, V>(
|
|
28
|
+
entries: ReadonlyArray<Readonly<[K, V]>>,
|
|
29
|
+
): { [$$Key$$: K]: V };
|
|
30
|
+
export declare function objMapKeys<
|
|
31
|
+
V,
|
|
32
|
+
K1 extends string = string,
|
|
33
|
+
K2 extends string = string,
|
|
34
|
+
>(
|
|
35
|
+
obj: { readonly [$$Key$$: K1]: V },
|
|
36
|
+
mapper: ($$PARAM_0$$: K1) => K2,
|
|
37
|
+
): { readonly [$$Key$$: K2]: V };
|
|
38
|
+
export declare function objMapEntry<
|
|
39
|
+
V,
|
|
40
|
+
V2,
|
|
41
|
+
K1 extends string = string,
|
|
42
|
+
K2 extends string = string,
|
|
43
|
+
>(
|
|
44
|
+
obj: { readonly [$$Key$$: K1]: V },
|
|
45
|
+
mapper: ($$PARAM_0$$: [K1, V]) => [K2, V2],
|
|
46
|
+
): { readonly [$$Key$$: K2]: V2 };
|
|
47
|
+
export declare function objMap<V, V2, K extends string = string>(
|
|
48
|
+
obj: { readonly [$$Key$$: K]: V },
|
|
49
|
+
mapper: ($$PARAM_0$$: V, $$PARAM_1$$: K) => V2,
|
|
50
|
+
): { readonly [$$Key$$: K]: V2 };
|
|
51
|
+
export declare class Pipe<T> {
|
|
52
|
+
value: T;
|
|
53
|
+
constructor(val: T);
|
|
54
|
+
pipe<T2>(mapper: ($$PARAM_0$$: T) => T2): Pipe<T2>;
|
|
55
|
+
done(): T;
|
|
56
|
+
static create(val: T): Pipe<T>;
|
|
57
|
+
}
|
|
58
|
+
export declare const arraySort: <T>(
|
|
59
|
+
arr: ReadonlyArray<T>,
|
|
60
|
+
fn?: ($$PARAM_0$$: T, $$PARAM_1$$: T) => number,
|
|
61
|
+
) => ReadonlyArray<T>;
|
|
62
|
+
export declare const arrayEquals: <T>(
|
|
63
|
+
arr1: ReadonlyArray<T>,
|
|
64
|
+
arr2: ReadonlyArray<T>,
|
|
65
|
+
equals: ($$PARAM_0$$: T, $$PARAM_1$$: T) => boolean,
|
|
66
|
+
) => boolean;
|