@stylexjs/shared 0.12.0 → 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 +5 -21
- package/README.md +0 -81
- package/lib/common-types.d.ts +0 -50
- package/lib/common-types.js +0 -1
- package/lib/common-types.js.flow +0 -63
- 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 -12
- package/lib/hash.js +0 -50
- package/lib/hash.js.flow +0 -12
- package/lib/messages.d.ts +0 -42
- package/lib/messages.js +0 -39
- package/lib/messages.js.flow +0 -45
- 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-consts-utils.d.ts +0 -11
- package/lib/stylex-consts-utils.js +0 -1
- package/lib/stylex-consts-utils.js.flow +0 -14
- 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 -64
- package/lib/stylex-create.js.flow +0 -37
- package/lib/stylex-define-consts.d.ts +0 -23
- package/lib/stylex-define-consts.js +0 -42
- package/lib/stylex-define-consts.js.flow +0 -18
- package/lib/stylex-define-vars.d.ts +0 -28
- package/lib/stylex-define-vars.js +0 -96
- 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 -17
- 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/media-query-transform.d.ts +0 -16
- package/lib/utils/media-query-transform.js +0 -53
- package/lib/utils/media-query-transform.js.flow +0 -20
- 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
|
@@ -1,66 +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 { 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;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.arraySort = exports.arrayEquals = exports.Pipe = void 0;
|
|
7
|
-
exports.flattenObject = flattenObject;
|
|
8
|
-
exports.isPlainObject = isPlainObject;
|
|
9
|
-
exports.objEntries = objEntries;
|
|
10
|
-
exports.objFromEntries = objFromEntries;
|
|
11
|
-
exports.objMap = objMap;
|
|
12
|
-
exports.objMapEntry = objMapEntry;
|
|
13
|
-
exports.objMapKeys = objMapKeys;
|
|
14
|
-
exports.objValues = objValues;
|
|
15
|
-
function isPlainObject(obj) {
|
|
16
|
-
return typeof obj === 'object' && obj != null && !Array.isArray(obj) && obj?.constructor === Object;
|
|
17
|
-
}
|
|
18
|
-
function flattenObject(obj) {
|
|
19
|
-
const result = {};
|
|
20
|
-
for (const [key, value] of objEntries(obj)) {
|
|
21
|
-
if (typeof value === 'string' || value == null) {
|
|
22
|
-
result[key] = value;
|
|
23
|
-
} else {
|
|
24
|
-
for (const [subKey, subValue] of objEntries(value)) {
|
|
25
|
-
result[`${key}_${subKey}`] = subValue;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
function objEntries(obj) {
|
|
32
|
-
const retVal = [];
|
|
33
|
-
for (const key of Object.keys(obj)) {
|
|
34
|
-
retVal.push([key, obj[key]]);
|
|
35
|
-
}
|
|
36
|
-
return retVal;
|
|
37
|
-
}
|
|
38
|
-
function objValues(obj) {
|
|
39
|
-
const retVal = [];
|
|
40
|
-
for (const key of Object.keys(obj)) {
|
|
41
|
-
retVal.push(obj[key]);
|
|
42
|
-
}
|
|
43
|
-
return retVal;
|
|
44
|
-
}
|
|
45
|
-
function objFromEntries(entries) {
|
|
46
|
-
const retVal = {};
|
|
47
|
-
for (const [key, value] of entries) {
|
|
48
|
-
retVal[key] = value;
|
|
49
|
-
}
|
|
50
|
-
return retVal;
|
|
51
|
-
}
|
|
52
|
-
function objMapKeys(obj, mapper) {
|
|
53
|
-
return objFromEntries(objEntries(obj).map(_ref => {
|
|
54
|
-
let [key, value] = _ref;
|
|
55
|
-
return [mapper(key), value];
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
function objMapEntry(obj, mapper) {
|
|
59
|
-
return objFromEntries(objEntries(obj).map(_ref2 => {
|
|
60
|
-
let [key, value] = _ref2;
|
|
61
|
-
return mapper([key, value]);
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
function objMap(obj, mapper) {
|
|
65
|
-
return objFromEntries(objEntries(obj).map(_ref3 => {
|
|
66
|
-
let [key, value] = _ref3;
|
|
67
|
-
return [key, mapper(value, key)];
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
class Pipe {
|
|
71
|
-
constructor(val) {
|
|
72
|
-
this.value = val;
|
|
73
|
-
}
|
|
74
|
-
pipe(mapper) {
|
|
75
|
-
return new Pipe(mapper(this.value));
|
|
76
|
-
}
|
|
77
|
-
done() {
|
|
78
|
-
return this.value;
|
|
79
|
-
}
|
|
80
|
-
static create(val) {
|
|
81
|
-
return new Pipe(val);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.Pipe = Pipe;
|
|
85
|
-
const arraySort = (arr, fn) => [...arr].sort(fn);
|
|
86
|
-
exports.arraySort = arraySort;
|
|
87
|
-
const arrayEquals = function (arr1, arr2) {
|
|
88
|
-
let equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (a, b) => a === b;
|
|
89
|
-
if (arr1.length !== arr2.length) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
for (let i = 0; i < arr1.length; i++) {
|
|
93
|
-
if (!equals(arr1[i], arr2[i])) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
};
|
|
99
|
-
exports.arrayEquals = arrayEquals;
|
|
@@ -1,78 +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
|
-
// 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;
|
|
@@ -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 const sortPseudos: (
|
|
11
|
-
pseudos: ReadonlyArray<string>,
|
|
12
|
-
) => ReadonlyArray<string>;
|
|
13
|
-
export declare const sortAtRules: (
|
|
14
|
-
atRules: ReadonlyArray<string>,
|
|
15
|
-
) => ReadonlyArray<string>;
|
package/lib/utils/rule-utils.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sortPseudos = exports.sortAtRules = void 0;
|
|
7
|
-
var _objectUtils = require("./object-utils");
|
|
8
|
-
const sortPseudos = pseudos => {
|
|
9
|
-
if (pseudos.length < 2) {
|
|
10
|
-
return pseudos;
|
|
11
|
-
}
|
|
12
|
-
return pseudos.reduce((acc, pseudo) => {
|
|
13
|
-
if (pseudo.startsWith('::')) {
|
|
14
|
-
return [...acc, pseudo];
|
|
15
|
-
}
|
|
16
|
-
const lastElement = acc[acc.length - 1];
|
|
17
|
-
const allButLast = acc.slice(0, acc.length - 1);
|
|
18
|
-
if (Array.isArray(lastElement)) {
|
|
19
|
-
return [...allButLast, [...lastElement, pseudo]];
|
|
20
|
-
} else {
|
|
21
|
-
return [...allButLast, lastElement, [pseudo]].filter(Boolean);
|
|
22
|
-
}
|
|
23
|
-
}, []).flatMap(pseudo => {
|
|
24
|
-
if (Array.isArray(pseudo)) {
|
|
25
|
-
return (0, _objectUtils.arraySort)(pseudo, stringComparator);
|
|
26
|
-
}
|
|
27
|
-
return [pseudo];
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
exports.sortPseudos = sortPseudos;
|
|
31
|
-
const sortAtRules = atRules => (0, _objectUtils.arraySort)(atRules);
|
|
32
|
-
exports.sortAtRules = sortAtRules;
|
|
33
|
-
const stringComparator = (a, b) => {
|
|
34
|
-
if (a === 'default') {
|
|
35
|
-
return -1;
|
|
36
|
-
}
|
|
37
|
-
if (b === 'default') {
|
|
38
|
-
return 1;
|
|
39
|
-
}
|
|
40
|
-
return a.localeCompare(b);
|
|
41
|
-
};
|
|
@@ -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
|
-
declare export const sortPseudos: (
|
|
11
|
-
pseudos: $ReadOnlyArray<string>,
|
|
12
|
-
) => $ReadOnlyArray<string>;
|
|
13
|
-
|
|
14
|
-
declare export const sortAtRules: (
|
|
15
|
-
atRules: $ReadOnlyArray<string>,
|
|
16
|
-
) => $ReadOnlyArray<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
|
-
import type { TStyleValue } from '../common-types';
|
|
11
|
-
declare function splitValue(
|
|
12
|
-
str: TStyleValue,
|
|
13
|
-
): ReadonlyArray<number | string | null>;
|
|
14
|
-
export default splitValue;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = splitValue;
|
|
7
|
-
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
function printNode(node) {
|
|
10
|
-
switch (node.type) {
|
|
11
|
-
case 'word':
|
|
12
|
-
case 'string':
|
|
13
|
-
return `${node.value}`;
|
|
14
|
-
case 'function':
|
|
15
|
-
return `${node.value}(${node.nodes.map(printNode).join('')})`;
|
|
16
|
-
default:
|
|
17
|
-
return node.value;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function splitValue(str) {
|
|
21
|
-
if (str == null || typeof str === 'number') {
|
|
22
|
-
return [str];
|
|
23
|
-
}
|
|
24
|
-
if (Array.isArray(str)) {
|
|
25
|
-
return str;
|
|
26
|
-
}
|
|
27
|
-
const parsed = (0, _postcssValueParser.default)(str.trim());
|
|
28
|
-
const nodes = parsed.nodes.filter(node => node.type !== 'space' && node.type !== 'div').map(printNode);
|
|
29
|
-
if (nodes.length > 1 && nodes[nodes.length - 1].toLowerCase() === '!important') {
|
|
30
|
-
return nodes.slice(0, nodes.length - 1).map(node => node + ' !important');
|
|
31
|
-
}
|
|
32
|
-
return nodes;
|
|
33
|
-
}
|
|
@@ -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
|
-
import type { TStyleValue } from '../common-types';
|
|
11
|
-
|
|
12
|
-
// Using split(' ') Isn't enough because of values like calc.
|
|
13
|
-
declare export default function splitValue(
|
|
14
|
-
str: TStyleValue,
|
|
15
|
-
): $ReadOnlyArray<number | string | null>;
|
package/lib/validate.d.ts
DELETED
|
@@ -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
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { TRawValue } from './common-types';
|
|
11
|
-
declare function validateEntry($$PARAM_0$$: [string, TRawValue]): void;
|
|
12
|
-
export default validateEntry;
|
package/lib/validate.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = validateEntry;
|
|
7
|
-
function validateEntry(_ref) {
|
|
8
|
-
let [key, value] = _ref;
|
|
9
|
-
if (Array.isArray(value)) {
|
|
10
|
-
value.forEach(val => validateSimplyEntry([key, val]));
|
|
11
|
-
} else {
|
|
12
|
-
validateSimplyEntry([key, value]);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function validateSimplyEntry(_ref2) {
|
|
16
|
-
let [key, _value] = _ref2;
|
|
17
|
-
if (BANNED_KEYS.has(key)) {
|
|
18
|
-
throw new Error('Banned key: ' + key);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const BANNED_KEYS = new Set(['background', 'transition', 'grid']);
|
package/lib/validate.js.flow
DELETED
|
@@ -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 { TRawValue } from './common-types';
|
|
11
|
-
|
|
12
|
-
declare export default function validateEntry([string, TRawValue]): void;
|