@stylexjs/shared 0.11.1 → 0.17.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 +10 -36
- package/lib/index.js +8 -25
- package/lib/index.js.flow +10 -43
- package/lib/utils/property-priorities.d.ts +4 -0
- package/lib/utils/property-priorities.js +54 -8
- package/lib/utils/property-priorities.js.flow +8 -0
- package/package.json +9 -22
- package/README.md +0 -81
- package/lib/common-types.d.ts +0 -47
- package/lib/common-types.js +0 -1
- package/lib/common-types.js.flow +0 -60
- package/lib/convert-to-className.d.ts +0 -20
- package/lib/convert-to-className.js +0 -66
- package/lib/convert-to-className.js.flow +0 -27
- package/lib/generate-css-rule.d.ts +0 -17
- package/lib/generate-css-rule.js +0 -25
- package/lib/generate-css-rule.js.flow +0 -17
- package/lib/hash.d.ts +0 -11
- package/lib/hash.js +0 -37
- package/lib/hash.js.flow +0 -10
- package/lib/messages.d.ts +0 -41
- package/lib/messages.js +0 -38
- package/lib/messages.js.flow +0 -44
- package/lib/physical-rtl/generate-ltr.d.ts +0 -13
- package/lib/physical-rtl/generate-ltr.js +0 -103
- package/lib/physical-rtl/generate-ltr.js.flow +0 -12
- package/lib/physical-rtl/generate-rtl.d.ts +0 -13
- package/lib/physical-rtl/generate-rtl.js +0 -177
- package/lib/physical-rtl/generate-rtl.js.flow +0 -12
- package/lib/preprocess-rules/PreRule.d.ts +0 -50
- package/lib/preprocess-rules/PreRule.js +0 -76
- package/lib/preprocess-rules/PreRule.js.flow +0 -62
- package/lib/preprocess-rules/application-order.d.ts +0 -183
- package/lib/preprocess-rules/application-order.js +0 -186
- package/lib/preprocess-rules/application-order.js.flow +0 -134
- package/lib/preprocess-rules/basic-validation.d.ts +0 -13
- package/lib/preprocess-rules/basic-validation.js +0 -73
- package/lib/preprocess-rules/basic-validation.js.flow +0 -13
- package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +0 -20
- package/lib/preprocess-rules/flatten-raw-style-obj.js +0 -98
- package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +0 -23
- package/lib/preprocess-rules/index.d.ts +0 -18
- package/lib/preprocess-rules/index.js +0 -33
- package/lib/preprocess-rules/index.js.flow +0 -22
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +0 -165
- package/lib/preprocess-rules/legacy-expand-shorthands.js +0 -147
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +0 -144
- package/lib/preprocess-rules/property-specificity.d.ts +0 -78
- package/lib/preprocess-rules/property-specificity.js +0 -107
- package/lib/preprocess-rules/property-specificity.js.flow +0 -87
- package/lib/stylex-create-theme.d.ts +0 -26
- package/lib/stylex-create-theme.js +0 -58
- package/lib/stylex-create-theme.js.flow +0 -19
- package/lib/stylex-create.d.ts +0 -27
- package/lib/stylex-create.js +0 -57
- package/lib/stylex-create.js.flow +0 -38
- package/lib/stylex-define-vars.d.ts +0 -28
- package/lib/stylex-define-vars.js +0 -94
- package/lib/stylex-define-vars.js.flow +0 -27
- package/lib/stylex-first-that-works.d.ts +0 -13
- package/lib/stylex-first-that-works.js +0 -26
- package/lib/stylex-first-that-works.js.flow +0 -12
- package/lib/stylex-include.d.ts +0 -18
- package/lib/stylex-include.js +0 -28
- package/lib/stylex-include.js.flow +0 -20
- package/lib/stylex-keyframes.d.ts +0 -17
- package/lib/stylex-keyframes.js +0 -55
- package/lib/stylex-keyframes.js.flow +0 -20
- package/lib/stylex-vars-utils.d.ts +0 -27
- package/lib/stylex-vars-utils.js +0 -69
- package/lib/stylex-vars-utils.js.flow +0 -31
- package/lib/transform-value.d.ts +0 -22
- package/lib/transform-value.js +0 -50
- package/lib/transform-value.js.flow +0 -25
- package/lib/types/index.d.ts +0 -240
- package/lib/types/index.js +0 -147
- package/lib/types/index.js.flow +0 -280
- package/lib/utils/Rule.d.ts +0 -58
- package/lib/utils/Rule.js +0 -50
- package/lib/utils/Rule.js.flow +0 -64
- package/lib/utils/dashify.d.ts +0 -11
- package/lib/utils/dashify.js +0 -9
- package/lib/utils/dashify.js.flow +0 -10
- package/lib/utils/default-options.d.ts +0 -11
- package/lib/utils/default-options.js +0 -15
- package/lib/utils/default-options.js.flow +0 -12
- package/lib/utils/file-based-identifier.d.ts +0 -15
- package/lib/utils/file-based-identifier.js +0 -14
- package/lib/utils/file-based-identifier.js.flow +0 -14
- package/lib/utils/genCSSRule.d.ts +0 -15
- package/lib/utils/genCSSRule.js +0 -15
- package/lib/utils/genCSSRule.js.flow +0 -15
- package/lib/utils/normalize-value.d.ts +0 -16
- package/lib/utils/normalize-value.js +0 -28
- package/lib/utils/normalize-value.js.flow +0 -16
- package/lib/utils/normalizers/convert-camel-case-values.d.ts +0 -14
- package/lib/utils/normalizers/convert-camel-case-values.js +0 -23
- package/lib/utils/normalizers/convert-camel-case-values.js.flow +0 -13
- package/lib/utils/normalizers/detect-unclosed-fns.d.ts +0 -17
- package/lib/utils/normalizers/detect-unclosed-fns.js +0 -17
- package/lib/utils/normalizers/detect-unclosed-fns.js.flow +0 -16
- package/lib/utils/normalizers/font-size-px-to-rem.d.ts +0 -19
- package/lib/utils/normalizers/font-size-px-to-rem.js +0 -24
- package/lib/utils/normalizers/font-size-px-to-rem.js.flow +0 -18
- package/lib/utils/normalizers/leading-zero.d.ts +0 -17
- package/lib/utils/normalizers/leading-zero.js +0 -24
- package/lib/utils/normalizers/leading-zero.js.flow +0 -16
- package/lib/utils/normalizers/quotes.d.ts +0 -18
- package/lib/utils/normalizers/quotes.js +0 -17
- package/lib/utils/normalizers/quotes.js.flow +0 -17
- package/lib/utils/normalizers/timings.d.ts +0 -18
- package/lib/utils/normalizers/timings.js +0 -25
- package/lib/utils/normalizers/timings.js.flow +0 -17
- package/lib/utils/normalizers/whitespace.d.ts +0 -19
- package/lib/utils/normalizers/whitespace.js +0 -54
- package/lib/utils/normalizers/whitespace.js.flow +0 -18
- package/lib/utils/normalizers/zero-dimensions.d.ts +0 -19
- package/lib/utils/normalizers/zero-dimensions.js +0 -42
- package/lib/utils/normalizers/zero-dimensions.js.flow +0 -18
- package/lib/utils/object-utils.d.ts +0 -66
- package/lib/utils/object-utils.js +0 -99
- package/lib/utils/object-utils.js.flow +0 -78
- package/lib/utils/rule-utils.d.ts +0 -15
- package/lib/utils/rule-utils.js +0 -41
- package/lib/utils/rule-utils.js.flow +0 -16
- package/lib/utils/split-css-value.d.ts +0 -14
- package/lib/utils/split-css-value.js +0 -33
- package/lib/utils/split-css-value.js.flow +0 -15
- package/lib/validate.d.ts +0 -12
- package/lib/validate.js +0 -21
- package/lib/validate.js.flow +0 -12
package/lib/utils/Rule.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
}
|
package/lib/utils/Rule.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Rule = exports.RawRuleRTLTuple = exports.RawRuleList = exports.RawRule = exports.CompiledRuleTuple2 = exports.CompiledRule = void 0;
|
|
7
|
-
class Rule {}
|
|
8
|
-
exports.Rule = Rule;
|
|
9
|
-
class RawRule extends Rule {
|
|
10
|
-
constructor(key, value, psuedos, atRules) {
|
|
11
|
-
super();
|
|
12
|
-
this.key = key;
|
|
13
|
-
this.value = value;
|
|
14
|
-
this.psuedos = psuedos;
|
|
15
|
-
this.atRules = atRules;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.RawRule = RawRule;
|
|
19
|
-
class RawRuleList extends Rule {
|
|
20
|
-
constructor(rules) {
|
|
21
|
-
super();
|
|
22
|
-
this.rules = rules;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.RawRuleList = RawRuleList;
|
|
26
|
-
class RawRuleRTLTuple extends Rule {
|
|
27
|
-
constructor(rule1, rule2) {
|
|
28
|
-
super();
|
|
29
|
-
this.rules = [rule1, rule2];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.RawRuleRTLTuple = RawRuleRTLTuple;
|
|
33
|
-
class CompiledRule extends Rule {
|
|
34
|
-
constructor(key, value, psuedos, atRules, className) {
|
|
35
|
-
super();
|
|
36
|
-
this.key = key;
|
|
37
|
-
this.value = value;
|
|
38
|
-
this.psuedos = psuedos;
|
|
39
|
-
this.atRules = atRules;
|
|
40
|
-
this.className = className;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.CompiledRule = CompiledRule;
|
|
44
|
-
class CompiledRuleTuple2 extends Rule {
|
|
45
|
-
constructor(rule1, rule2) {
|
|
46
|
-
super();
|
|
47
|
-
this.rules = [rule1, rule2];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.CompiledRuleTuple2 = CompiledRuleTuple2;
|
package/lib/utils/Rule.js.flow
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|
package/lib/utils/dashify.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
package/lib/utils/dashify.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.defaultOptions = void 0;
|
|
7
|
-
const defaultOptions = exports.defaultOptions = {
|
|
8
|
-
dev: false,
|
|
9
|
-
debug: false,
|
|
10
|
-
enableDebugClassNames: true,
|
|
11
|
-
useRemForFontSize: true,
|
|
12
|
-
test: false,
|
|
13
|
-
classNamePrefix: 'x',
|
|
14
|
-
styleResolution: 'application-order'
|
|
15
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = genFileBasedIdentifier;
|
|
7
|
-
function genFileBasedIdentifier(_ref) {
|
|
8
|
-
let {
|
|
9
|
-
fileName,
|
|
10
|
-
exportName,
|
|
11
|
-
key
|
|
12
|
-
} = _ref;
|
|
13
|
-
return `${fileName}//${exportName}${key != null ? `.${key}` : ''}`;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
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 function genCSSRule(
|
|
11
|
-
className: string,
|
|
12
|
-
decls: string,
|
|
13
|
-
pseudos: ReadonlyArray<string>,
|
|
14
|
-
atRules: ReadonlyArray<string>,
|
|
15
|
-
): string;
|
package/lib/utils/genCSSRule.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.genCSSRule = genCSSRule;
|
|
7
|
-
const THUMB_VARIANTS = ['::-webkit-slider-thumb', '::-moz-range-thumb', '::-ms-thumb'];
|
|
8
|
-
function genCSSRule(className, decls, pseudos, atRules) {
|
|
9
|
-
const pseudo = pseudos.filter(p => p !== '::thumb').join('');
|
|
10
|
-
let selectorForAtRules = `.${className}` + atRules.map(() => `.${className}`).join('') + pseudo;
|
|
11
|
-
if (pseudos.includes('::thumb')) {
|
|
12
|
-
selectorForAtRules = THUMB_VARIANTS.map(suffix => selectorForAtRules + suffix).join(', ');
|
|
13
|
-
}
|
|
14
|
-
return atRules.reduce((acc, atRule) => `${atRule}{${acc}}`, `${selectorForAtRules}{${decls}}`);
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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 function genCSSRule(
|
|
11
|
-
className: string,
|
|
12
|
-
decls: string,
|
|
13
|
-
pseudos: $ReadOnlyArray<string>,
|
|
14
|
-
atRules: $ReadOnlyArray<string>,
|
|
15
|
-
): string;
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = normalizeValue;
|
|
7
|
-
var _fontSizePxToRem = _interopRequireDefault(require("./normalizers/font-size-px-to-rem"));
|
|
8
|
-
var _leadingZero = _interopRequireDefault(require("./normalizers/leading-zero"));
|
|
9
|
-
var _quotes = _interopRequireDefault(require("./normalizers/quotes"));
|
|
10
|
-
var _timings = _interopRequireDefault(require("./normalizers/timings"));
|
|
11
|
-
var _whitespace = _interopRequireDefault(require("./normalizers/whitespace"));
|
|
12
|
-
var _zeroDimensions = _interopRequireDefault(require("./normalizers/zero-dimensions"));
|
|
13
|
-
var _detectUnclosedFns = _interopRequireDefault(require("./normalizers/detect-unclosed-fns"));
|
|
14
|
-
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
15
|
-
var _convertCamelCaseValues = _interopRequireDefault(require("./normalizers/convert-camel-case-values"));
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
const normalizers = [_detectUnclosedFns.default, _whitespace.default, _timings.default, _zeroDimensions.default, _leadingZero.default, _quotes.default, _convertCamelCaseValues.default];
|
|
18
|
-
function normalizeValue(value, key, _ref) {
|
|
19
|
-
let {
|
|
20
|
-
useRemForFontSize
|
|
21
|
-
} = _ref;
|
|
22
|
-
if (value == null) {
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
const parsedAST = (0, _postcssValueParser.default)(value);
|
|
26
|
-
const relevantNormalizers = useRemForFontSize ? [...normalizers, _fontSizePxToRem.default] : normalizers;
|
|
27
|
-
return relevantNormalizers.reduce((ast, fn) => fn(ast, key), parsedAST).toString();
|
|
28
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,23 +0,0 @@
|
|
|
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(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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,17 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = detectUnclosedFns;
|
|
7
|
-
var messages = _interopRequireWildcard(require("../../messages"));
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
-
function detectUnclosedFns(ast, _) {
|
|
11
|
-
ast.walk(node => {
|
|
12
|
-
if (node.type === 'function' && node.unclosed) {
|
|
13
|
-
throw new Error(messages.LINT_UNCLOSED_FUNCTION);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return ast;
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,19 +0,0 @@
|
|
|
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,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = convertFontSizeToRem;
|
|
7
|
-
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const ROOT_FONT_SIZE = 16;
|
|
10
|
-
function convertFontSizeToRem(ast, key) {
|
|
11
|
-
if (key !== 'fontSize') {
|
|
12
|
-
return ast;
|
|
13
|
-
}
|
|
14
|
-
ast.walk(node => {
|
|
15
|
-
if (node.type !== 'word') {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const dimension = _postcssValueParser.default.unit(node.value);
|
|
19
|
-
if (dimension && dimension.unit === 'px') {
|
|
20
|
-
node.value = `${parseFloat(dimension.number) / ROOT_FONT_SIZE}rem`;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return ast;
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = normalizeLeadingZero;
|
|
7
|
-
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
function normalizeLeadingZero(ast, _) {
|
|
10
|
-
ast.walk(node => {
|
|
11
|
-
if (node.type !== 'word') {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const value = Number.parseFloat(node.value);
|
|
15
|
-
if (Number.isNaN(value)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const dimension = _postcssValueParser.default.unit(node.value);
|
|
19
|
-
if (value < 1 && value >= 0) {
|
|
20
|
-
node.value = value.toString().replace('0.', '.') + (dimension ? dimension.unit : '');
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return ast;
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|