@stylexjs/shared 0.2.0-beta.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -3,8 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.Pipe = void 0;
|
6
|
+
exports.arraySort = exports.arrayEquals = exports.Pipe = void 0;
|
7
7
|
exports.flattenObject = flattenObject;
|
8
|
+
exports.isPlainObject = isPlainObject;
|
8
9
|
exports.objEntries = objEntries;
|
9
10
|
exports.objFromEntries = objFromEntries;
|
10
11
|
exports.objMap = objMap;
|
@@ -12,17 +13,9 @@ exports.objMapEntry = objMapEntry;
|
|
12
13
|
exports.objMapKeys = objMapKeys;
|
13
14
|
exports.objValues = objValues;
|
14
15
|
var _stylexInclude = require("../stylex-include");
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
* This source code is licensed under the MIT license found in the
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*/
|
23
|
-
|
24
|
-
// A bunch of object utils with better Flow types
|
25
|
-
|
16
|
+
function isPlainObject(obj) {
|
17
|
+
return typeof obj === 'object' && obj != null && !Array.isArray(obj) && obj?.constructor === Object;
|
18
|
+
}
|
26
19
|
function flattenObject(obj) {
|
27
20
|
const result = {};
|
28
21
|
for (const [key, value] of objEntries(obj)) {
|
@@ -91,4 +84,19 @@ class Pipe {
|
|
91
84
|
return new Pipe(val);
|
92
85
|
}
|
93
86
|
}
|
94
|
-
exports.Pipe = Pipe;
|
87
|
+
exports.Pipe = Pipe;
|
88
|
+
const arraySort = (arr, fn) => [...arr].sort(fn);
|
89
|
+
exports.arraySort = arraySort;
|
90
|
+
const arrayEquals = function (arr1, arr2) {
|
91
|
+
let equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (a, b) => a === b;
|
92
|
+
if (arr1.length !== arr2.length) {
|
93
|
+
return false;
|
94
|
+
}
|
95
|
+
for (let i = 0; i < arr1.length; i++) {
|
96
|
+
if (!equals(arr1[i], arr2[i])) {
|
97
|
+
return false;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return true;
|
101
|
+
};
|
102
|
+
exports.arrayEquals = arrayEquals;
|
@@ -0,0 +1,77 @@
|
|
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
|
+
import { IncludedStyles } from '../stylex-include';
|
15
|
+
|
16
|
+
declare export function isPlainObject(obj: mixed): void;
|
17
|
+
|
18
|
+
declare export function flattenObject(obj: CompiledStyles): {
|
19
|
+
+[string]: null | string | IncludedStyles,
|
20
|
+
};
|
21
|
+
|
22
|
+
type _ObjectEntries<Obj: { +[string]: mixed }> = {
|
23
|
+
[Key in keyof Obj]: [Key, Obj[Key]],
|
24
|
+
};
|
25
|
+
type ObjectEntries<Obj: { +[string]: mixed }> = $Values<_ObjectEntries<Obj>>;
|
26
|
+
|
27
|
+
declare export function objEntries<Obj: { +[string]: mixed }>(
|
28
|
+
obj: Obj,
|
29
|
+
): $ReadOnlyArray<ObjectEntries<Obj>>;
|
30
|
+
|
31
|
+
declare export function objValues<Obj: { +[string]: mixed }>(
|
32
|
+
obj: Obj,
|
33
|
+
): $ReadOnlyArray<Obj[$Keys<Obj>]>;
|
34
|
+
|
35
|
+
declare export function objFromEntries<K: string | number, V>(
|
36
|
+
entries: $ReadOnlyArray<$ReadOnly<[K, V]>>,
|
37
|
+
): { [K]: V };
|
38
|
+
|
39
|
+
declare export function objMapKeys<V, K1: string = string, K2: string = string>(
|
40
|
+
obj: { +[K1]: V },
|
41
|
+
mapper: (K1) => K2,
|
42
|
+
): { +[K2]: V };
|
43
|
+
|
44
|
+
declare export function objMapEntry<
|
45
|
+
V,
|
46
|
+
V2,
|
47
|
+
K1: string = string,
|
48
|
+
K2: string = string,
|
49
|
+
>(
|
50
|
+
obj: { +[K1]: V },
|
51
|
+
mapper: ([K1, V]) => [K2, V2],
|
52
|
+
): { +[K2]: V2 };
|
53
|
+
|
54
|
+
declare export function objMap<V, V2, K: string = string>(
|
55
|
+
obj: { +[K]: V },
|
56
|
+
mapper: (V, K) => V2,
|
57
|
+
): { +[K]: V2 };
|
58
|
+
|
59
|
+
declare export class Pipe<T> {
|
60
|
+
value: T;
|
61
|
+
constructor(val: T): void;
|
62
|
+
pipe<T2>(mapper: (T) => T2): Pipe<T2>;
|
63
|
+
done(): T;
|
64
|
+
static create(val: T): Pipe<T>;
|
65
|
+
}
|
66
|
+
|
67
|
+
// Function that sorts an array without mutating it and returns a new array
|
68
|
+
declare export const arraySort: <T>(
|
69
|
+
arr: $ReadOnlyArray<T>,
|
70
|
+
fn?: (T, T) => number,
|
71
|
+
) => $ReadOnlyArray<T>;
|
72
|
+
|
73
|
+
declare export const arrayEquals: <T>(
|
74
|
+
arr1: $ReadOnlyArray<T>,
|
75
|
+
arr2: $ReadOnlyArray<T>,
|
76
|
+
equals: (T, T) => boolean,
|
77
|
+
) => boolean;
|
@@ -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 getPriority(key: string): number;
|
11
|
+
export default getPriority;
|