@stylexjs/babel-plugin 0.11.1 → 0.13.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/index.d.ts +2 -1
- package/lib/index.js +3797 -2229
- package/lib/index.js.flow +11 -1
- package/lib/shared/common-types.d.ts +57 -0
- package/lib/shared/common-types.js.flow +71 -0
- package/lib/shared/hash.d.ts +12 -0
- package/lib/shared/hash.js.flow +12 -0
- package/lib/shared/index.d.ts +57 -0
- package/lib/shared/index.js.flow +66 -0
- package/lib/shared/messages.d.ts +35 -0
- package/lib/shared/messages.js.flow +40 -0
- package/lib/shared/physical-rtl/generate-ltr.d.ts +13 -0
- package/lib/shared/physical-rtl/generate-ltr.js.flow +12 -0
- package/lib/shared/physical-rtl/generate-rtl.d.ts +13 -0
- package/lib/shared/physical-rtl/generate-rtl.js.flow +12 -0
- package/lib/shared/preprocess-rules/PreRule.d.ts +51 -0
- package/lib/shared/preprocess-rules/PreRule.js.flow +63 -0
- package/lib/shared/preprocess-rules/application-order.d.ts +183 -0
- package/lib/shared/preprocess-rules/application-order.js.flow +134 -0
- package/lib/shared/preprocess-rules/basic-validation.d.ts +13 -0
- package/lib/shared/preprocess-rules/basic-validation.js.flow +13 -0
- package/lib/shared/preprocess-rules/flatten-raw-style-obj.d.ts +20 -0
- package/lib/shared/preprocess-rules/flatten-raw-style-obj.js.flow +23 -0
- package/lib/shared/preprocess-rules/index.d.ts +18 -0
- package/lib/shared/preprocess-rules/index.js.flow +22 -0
- package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +165 -0
- package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +144 -0
- package/lib/shared/preprocess-rules/property-specificity.d.ts +78 -0
- package/lib/shared/preprocess-rules/property-specificity.js.flow +87 -0
- package/lib/shared/stylex-consts-utils.d.ts +11 -0
- package/lib/shared/stylex-consts-utils.js.flow +14 -0
- package/lib/shared/stylex-create-theme.d.ts +26 -0
- package/lib/shared/stylex-create-theme.js.flow +19 -0
- package/lib/shared/stylex-create.d.ts +27 -0
- package/lib/shared/stylex-create.js.flow +37 -0
- package/lib/shared/stylex-define-consts.d.ts +23 -0
- package/lib/shared/stylex-define-consts.js.flow +19 -0
- package/lib/shared/stylex-define-vars.d.ts +28 -0
- package/lib/shared/stylex-define-vars.js.flow +26 -0
- package/lib/shared/stylex-first-that-works.d.ts +13 -0
- package/lib/shared/stylex-first-that-works.js.flow +12 -0
- package/lib/shared/stylex-keyframes.d.ts +17 -0
- package/lib/shared/stylex-keyframes.js.flow +20 -0
- package/lib/shared/stylex-position-try.d.ts +15 -0
- package/lib/shared/stylex-position-try.js.flow +18 -0
- package/lib/shared/stylex-vars-utils.d.ts +27 -0
- package/lib/shared/stylex-vars-utils.js.flow +31 -0
- package/lib/shared/types/index.d.ts +240 -0
- package/lib/shared/types/index.js.flow +280 -0
- package/lib/shared/utils/Rule.d.ts +58 -0
- package/lib/shared/utils/Rule.js.flow +64 -0
- package/lib/shared/utils/convert-to-className.d.ts +21 -0
- package/lib/shared/utils/convert-to-className.js.flow +29 -0
- package/lib/shared/utils/dashify.d.ts +11 -0
- package/lib/shared/utils/dashify.js.flow +10 -0
- package/lib/shared/utils/default-options.d.ts +11 -0
- package/lib/shared/utils/default-options.js.flow +12 -0
- package/lib/shared/utils/file-based-identifier.d.ts +15 -0
- package/lib/shared/utils/file-based-identifier.js.flow +14 -0
- package/lib/shared/utils/generate-css-rule.d.ts +18 -0
- package/lib/shared/utils/generate-css-rule.js.flow +19 -0
- package/lib/shared/utils/normalize-value.d.ts +16 -0
- package/lib/shared/utils/normalize-value.js.flow +16 -0
- package/lib/shared/utils/normalizers/convert-camel-case-values.d.ts +14 -0
- package/lib/shared/utils/normalizers/convert-camel-case-values.js.flow +13 -0
- package/lib/shared/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
- package/lib/shared/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
- package/lib/shared/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
- package/lib/shared/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
- package/lib/shared/utils/normalizers/leading-zero.d.ts +17 -0
- package/lib/shared/utils/normalizers/leading-zero.js.flow +16 -0
- package/lib/shared/utils/normalizers/quotes.d.ts +18 -0
- package/lib/shared/utils/normalizers/quotes.js.flow +17 -0
- package/lib/shared/utils/normalizers/timings.d.ts +18 -0
- package/lib/shared/utils/normalizers/timings.js.flow +17 -0
- package/lib/shared/utils/normalizers/whitespace.d.ts +19 -0
- package/lib/shared/utils/normalizers/whitespace.js.flow +18 -0
- package/lib/shared/utils/normalizers/zero-dimensions.d.ts +19 -0
- package/lib/shared/utils/normalizers/zero-dimensions.js.flow +18 -0
- package/lib/shared/utils/object-utils.d.ts +66 -0
- package/lib/shared/utils/object-utils.js.flow +78 -0
- package/lib/shared/utils/property-priorities.d.ts +17 -0
- package/lib/shared/utils/property-priorities.js.flow +78 -0
- package/lib/shared/utils/rule-utils.d.ts +15 -0
- package/lib/shared/utils/rule-utils.js.flow +16 -0
- package/lib/shared/utils/split-css-value.d.ts +14 -0
- package/lib/shared/utils/split-css-value.js.flow +15 -0
- package/lib/shared/utils/transform-value.d.ts +22 -0
- package/lib/shared/utils/transform-value.js.flow +25 -0
- package/lib/shared/validate.d.ts +12 -0
- package/lib/shared/validate.js.flow +12 -0
- package/lib/utils/add-sourcemap-data.d.ts +1 -1
- package/lib/utils/add-sourcemap-data.js.flow +1 -1
- package/lib/utils/dev-classname.d.ts +1 -1
- package/lib/utils/dev-classname.js.flow +2 -1
- package/lib/utils/evaluate-path.d.ts +19 -0
- package/lib/utils/evaluate-path.js.flow +26 -0
- package/lib/utils/js-to-ast.d.ts +1 -1
- package/lib/utils/js-to-ast.js.flow +1 -1
- package/lib/utils/state-manager.d.ts +36 -6
- package/lib/utils/state-manager.js.flow +35 -5
- package/lib/visitors/imports.d.ts +1 -1
- package/lib/visitors/imports.js.flow +2 -1
- package/lib/visitors/{stylex-create/parse-stylex-create-arg.d.ts → parse-stylex-create-arg.d.ts} +2 -2
- package/lib/visitors/{stylex-create/parse-stylex-create-arg.js.flow → parse-stylex-create-arg.js.flow} +5 -4
- package/lib/visitors/stylex-create-theme.d.ts +1 -1
- package/lib/visitors/stylex-create-theme.js.flow +1 -1
- package/lib/visitors/{stylex-create/index.d.ts → stylex-create.d.ts} +2 -2
- package/lib/visitors/{stylex-create/index.js.flow → stylex-create.js.flow} +3 -3
- package/lib/visitors/{stylex-attrs.d.ts → stylex-define-consts.d.ts} +3 -7
- package/lib/visitors/stylex-define-consts.js.flow +25 -0
- package/lib/visitors/stylex-define-vars.d.ts +1 -1
- package/lib/visitors/stylex-define-vars.js.flow +1 -1
- package/lib/visitors/stylex-keyframes.d.ts +1 -1
- package/lib/visitors/stylex-keyframes.js.flow +1 -1
- package/lib/visitors/stylex-position-try.d.ts +17 -0
- package/lib/visitors/stylex-position-try.js.flow +22 -0
- package/package.json +11 -12
- package/lib/babel-path-utils.d.ts +0 -1100
- package/lib/babel-path-utils.js.flow +0 -1108
- package/lib/visitors/stylex-attrs.js.flow +0 -25
|
@@ -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
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { TRawValue, StyleRule, StyleXOptions } from '../common-types';
|
|
11
|
+
export declare function convertStyleToClassName(
|
|
12
|
+
objEntry: Readonly<[string, TRawValue]>,
|
|
13
|
+
pseudos: ReadonlyArray<string>,
|
|
14
|
+
atRules: ReadonlyArray<string>,
|
|
15
|
+
constRules: ReadonlyArray<string>,
|
|
16
|
+
options: StyleXOptions,
|
|
17
|
+
): StyleRule;
|
|
18
|
+
declare function variableFallbacks(
|
|
19
|
+
values: ReadonlyArray<string>,
|
|
20
|
+
): ReadonlyArray<string>;
|
|
21
|
+
export default variableFallbacks;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { TRawValue, StyleRule, StyleXOptions } from '../common-types';
|
|
11
|
+
|
|
12
|
+
// This function takes a single style rule and transforms it into a CSS rule.
|
|
13
|
+
// [color: 'red'] => ['color', 'classname-for-color-red', CSSRULE{ltr, rtl, priority}]
|
|
14
|
+
//
|
|
15
|
+
// It converts the camelCased style key to a dash-separated key.
|
|
16
|
+
// Handles RTL-flipping
|
|
17
|
+
// Hashes to get a className
|
|
18
|
+
// Returns the final key, className a CSS Rule
|
|
19
|
+
declare export function convertStyleToClassName(
|
|
20
|
+
objEntry: $ReadOnly<[string, TRawValue]>,
|
|
21
|
+
pseudos: $ReadOnlyArray<string>,
|
|
22
|
+
atRules: $ReadOnlyArray<string>,
|
|
23
|
+
constRules: $ReadOnlyArray<string>,
|
|
24
|
+
options: StyleXOptions,
|
|
25
|
+
): StyleRule;
|
|
26
|
+
|
|
27
|
+
declare export default function variableFallbacks(
|
|
28
|
+
values: $ReadOnlyArray<string>,
|
|
29
|
+
): $ReadOnlyArray<string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 dashify(str: string): string;
|
|
11
|
+
export default dashify;
|
|
@@ -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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare export default function dashify(str: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 { StyleXOptions } from '../common-types';
|
|
11
|
+
export declare const defaultOptions: StyleXOptions;
|
|
@@ -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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { StyleXOptions } from '../common-types';
|
|
11
|
+
|
|
12
|
+
declare export const defaultOptions: StyleXOptions;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 genFileBasedIdentifier($$PARAM_0$$: {
|
|
11
|
+
readonly fileName: string;
|
|
12
|
+
readonly exportName: string;
|
|
13
|
+
readonly key?: string;
|
|
14
|
+
}): string;
|
|
15
|
+
export default genFileBasedIdentifier;
|
|
@@ -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
|
+
declare export default function genFileBasedIdentifier({
|
|
11
|
+
+fileName: string,
|
|
12
|
+
+exportName: string,
|
|
13
|
+
+key?: string,
|
|
14
|
+
}): string;
|
|
@@ -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 { InjectableStyle } from '../common-types';
|
|
11
|
+
export declare function generateCSSRule(
|
|
12
|
+
className: string,
|
|
13
|
+
key: string,
|
|
14
|
+
value: string | ReadonlyArray<string>,
|
|
15
|
+
pseudos: ReadonlyArray<string>,
|
|
16
|
+
atRules: ReadonlyArray<string>,
|
|
17
|
+
constRules: ReadonlyArray<string>,
|
|
18
|
+
): InjectableStyle;
|
|
@@ -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
|
+
import type { InjectableStyle } from '../common-types';
|
|
11
|
+
|
|
12
|
+
declare export function generateCSSRule(
|
|
13
|
+
className: string,
|
|
14
|
+
key: string,
|
|
15
|
+
value: string | $ReadOnlyArray<string>,
|
|
16
|
+
pseudos: $ReadOnlyArray<string>,
|
|
17
|
+
atRules: $ReadOnlyArray<string>,
|
|
18
|
+
constRules: $ReadOnlyArray<string>,
|
|
19
|
+
): InjectableStyle;
|
|
@@ -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
|
+
import type { StyleXOptions } from '../common-types';
|
|
11
|
+
declare function normalizeValue(
|
|
12
|
+
value: string,
|
|
13
|
+
key: string,
|
|
14
|
+
$$PARAM_2$$: StyleXOptions,
|
|
15
|
+
): string;
|
|
16
|
+
export default normalizeValue;
|
|
@@ -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
|
+
import type { StyleXOptions } from '../common-types';
|
|
11
|
+
|
|
12
|
+
declare export default function normalizeValue(
|
|
13
|
+
value: string,
|
|
14
|
+
key: string,
|
|
15
|
+
StyleXOptions,
|
|
16
|
+
): string;
|
|
@@ -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,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;
|
|
@@ -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;
|
|
@@ -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,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;
|
|
@@ -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;
|
|
@@ -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 space 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;
|
|
@@ -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 space 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, timings, fractions, and percentages,
|
|
12
|
+
* in which case make them consistent 0deg, 0s, 0fr, and 0%.
|
|
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, timings, fractions, and percentages,
|
|
12
|
+
* in which case make them consistent 0deg, 0s, 0fr, and 0%.
|
|
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
|
+
type AnyObject = { readonly [$$Key$$: string]: unknown };
|
|
12
|
+
export declare function isPlainObject(obj: unknown): obj is AnyObject;
|
|
13
|
+
export declare function flattenObject(obj: CompiledStyles): {
|
|
14
|
+
readonly [$$Key$$: string]: null | string;
|
|
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$$: Readonly<[K1, V]>) => Readonly<[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;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
// A bunch of object utils with better Flow types
|
|
11
|
+
|
|
12
|
+
import type { CompiledStyles } from '../common-types';
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line no-unused-vars
|
|
15
|
+
type AnyObject = { +[string]: mixed };
|
|
16
|
+
|
|
17
|
+
declare export function isPlainObject(obj: mixed): implies obj is AnyObject;
|
|
18
|
+
|
|
19
|
+
declare export function flattenObject(obj: CompiledStyles): {
|
|
20
|
+
+[string]: null | string,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type _ObjectEntries<Obj: { +[string]: mixed }> = {
|
|
24
|
+
[Key in keyof Obj]: [Key, Obj[Key]],
|
|
25
|
+
};
|
|
26
|
+
type ObjectEntries<Obj: { +[string]: mixed }> = $Values<_ObjectEntries<Obj>>;
|
|
27
|
+
|
|
28
|
+
declare export function objEntries<Obj: { +[string]: mixed }>(
|
|
29
|
+
obj: Obj,
|
|
30
|
+
): $ReadOnlyArray<ObjectEntries<Obj>>;
|
|
31
|
+
|
|
32
|
+
declare export function objValues<Obj: { +[string]: mixed }>(
|
|
33
|
+
obj: Obj,
|
|
34
|
+
): $ReadOnlyArray<Obj[$Keys<Obj>]>;
|
|
35
|
+
|
|
36
|
+
declare export function objFromEntries<K: string | number, V>(
|
|
37
|
+
entries: $ReadOnlyArray<$ReadOnly<[K, V]>>,
|
|
38
|
+
): { [K]: V };
|
|
39
|
+
|
|
40
|
+
declare export function objMapKeys<V, K1: string = string, K2: string = string>(
|
|
41
|
+
obj: { +[K1]: V },
|
|
42
|
+
mapper: (K1) => K2,
|
|
43
|
+
): { +[K2]: V };
|
|
44
|
+
|
|
45
|
+
declare export function objMapEntry<
|
|
46
|
+
V,
|
|
47
|
+
V2,
|
|
48
|
+
K1: string = string,
|
|
49
|
+
K2: string = string,
|
|
50
|
+
>(
|
|
51
|
+
obj: { +[K1]: V },
|
|
52
|
+
mapper: ($ReadOnly<[K1, V]>) => $ReadOnly<[K2, V2]>,
|
|
53
|
+
): { +[K2]: V2 };
|
|
54
|
+
|
|
55
|
+
declare export function objMap<V, V2, K: string = string>(
|
|
56
|
+
obj: { +[K]: V },
|
|
57
|
+
mapper: (V, K) => V2,
|
|
58
|
+
): { +[K]: V2 };
|
|
59
|
+
|
|
60
|
+
declare export class Pipe<T> {
|
|
61
|
+
value: T;
|
|
62
|
+
constructor(val: T): void;
|
|
63
|
+
pipe<T2>(mapper: (T) => T2): Pipe<T2>;
|
|
64
|
+
done(): T;
|
|
65
|
+
static create(val: T): Pipe<T>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Function that sorts an array without mutating it and returns a new array
|
|
69
|
+
declare export const arraySort: <T>(
|
|
70
|
+
arr: $ReadOnlyArray<T>,
|
|
71
|
+
fn?: (T, T) => number,
|
|
72
|
+
) => $ReadOnlyArray<T>;
|
|
73
|
+
|
|
74
|
+
declare export const arrayEquals: <T>(
|
|
75
|
+
arr1: $ReadOnlyArray<T>,
|
|
76
|
+
arr2: $ReadOnlyArray<T>,
|
|
77
|
+
equals: (T, T) => boolean,
|
|
78
|
+
) => boolean;
|
|
@@ -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
|
+
export declare const PSEUDO_CLASS_PRIORITIES: Readonly<{
|
|
11
|
+
[$$Key$$: string]: number;
|
|
12
|
+
}>;
|
|
13
|
+
type AtRulePriorities = { '@supports': 30; '@media': 200; '@container': 300 };
|
|
14
|
+
export declare const AT_RULE_PRIORITIES: Readonly<AtRulePriorities>;
|
|
15
|
+
export declare const PSEUDO_ELEMENT_PRIORITY: number;
|
|
16
|
+
declare function getPriority(key: string): number;
|
|
17
|
+
export default getPriority;
|