@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,144 @@
|
|
|
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
|
+
// TODO: to be added later.
|
|
13
|
+
// const aliases = {
|
|
14
|
+
// marginInlineStart: (rawValue) => [['marginStart', rawValue]],
|
|
15
|
+
// marginInlineEnd: (rawValue) => [['marginEnd', rawValue]],
|
|
16
|
+
// marginInline: (rawValue) => [
|
|
17
|
+
// ['marginStart', rawValue],
|
|
18
|
+
// ['marginEnd', rawValue],
|
|
19
|
+
// ],
|
|
20
|
+
// paddingInlineStart: (rawValue) => [['paddingStart', rawValue]],
|
|
21
|
+
// paddingInlineEnd: (rawValue) => [['paddingEnd', rawValue]],
|
|
22
|
+
// paddingInline: (rawValue) => [
|
|
23
|
+
// ['paddingStart', rawValue],
|
|
24
|
+
// ['paddingEnd', rawValue],
|
|
25
|
+
// ],
|
|
26
|
+
// // 'borderInlineStart': (rawValue) => [['borderStart', rawValue]],
|
|
27
|
+
// // 'borderInlineEnd': (rawValue) => [['borderEnd', rawValue]],
|
|
28
|
+
// // // This will need to change.
|
|
29
|
+
// // 'borderInline': (rawValue) => [
|
|
30
|
+
// // ['borderStart', rawValue],
|
|
31
|
+
// // ['borderEnd', rawValue],
|
|
32
|
+
// // ],
|
|
33
|
+
// };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Shorthand properties:
|
|
37
|
+
* - [x] all - Should be banned
|
|
38
|
+
* - [ ] animation
|
|
39
|
+
* - [ ] background
|
|
40
|
+
* - [-] border
|
|
41
|
+
* - [x] border-block-end
|
|
42
|
+
* - [x] border-block-start
|
|
43
|
+
* - [ ] border-bottom
|
|
44
|
+
* - [x] border-color
|
|
45
|
+
* - [x] border-image
|
|
46
|
+
* - [x] border-inline-end
|
|
47
|
+
* - [x] border-inline-start
|
|
48
|
+
* - [ ] border-left
|
|
49
|
+
* - [x] border-radius
|
|
50
|
+
* - [ ] border-right
|
|
51
|
+
* - [x] border-style
|
|
52
|
+
* - [ ] border-top
|
|
53
|
+
* - [x] border-width
|
|
54
|
+
* - [ ] column-rule
|
|
55
|
+
* - [ ] columns
|
|
56
|
+
* - [ ] flex
|
|
57
|
+
* - [ ] flex-flow
|
|
58
|
+
* - [ ] font
|
|
59
|
+
* - [ ] gap
|
|
60
|
+
* - [ ] grid
|
|
61
|
+
* - [ ] grid-area
|
|
62
|
+
* - [ ] grid-column
|
|
63
|
+
* - [ ] grid-row
|
|
64
|
+
* - [ ] grid-template
|
|
65
|
+
* - [ ] list-style
|
|
66
|
+
* - [x] margin
|
|
67
|
+
* - [ ] mask
|
|
68
|
+
* - [ ] offset
|
|
69
|
+
* - [ ] outline
|
|
70
|
+
* - [x] overflow
|
|
71
|
+
* - [x] padding
|
|
72
|
+
* - [ ] place-content
|
|
73
|
+
* - [ ] place-items
|
|
74
|
+
* - [ ] place-self
|
|
75
|
+
* - [ ] scroll-margin
|
|
76
|
+
* - [ ] scroll-padding
|
|
77
|
+
* - [ ] text-decoration
|
|
78
|
+
* - [ ] text-emphasis
|
|
79
|
+
* - [ ] transition
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
|
|
83
|
+
|
|
84
|
+
declare const shorthands: $ReadOnly<{
|
|
85
|
+
[key: string]: (TStyleValue) => TReturn,
|
|
86
|
+
}>;
|
|
87
|
+
|
|
88
|
+
declare const aliases: {
|
|
89
|
+
insetBlockStart: (val: TStyleValue) => TReturn,
|
|
90
|
+
insetBlockEnd: (val: TStyleValue) => TReturn,
|
|
91
|
+
insetInlineStart: $FlowFixMe,
|
|
92
|
+
insetInlineEnd: $FlowFixMe,
|
|
93
|
+
blockSize: (val: TStyleValue) => TReturn,
|
|
94
|
+
inlineSize: (val: TStyleValue) => TReturn,
|
|
95
|
+
minBlockSize: (val: TStyleValue) => TReturn,
|
|
96
|
+
minInlineSize: (val: TStyleValue) => TReturn,
|
|
97
|
+
maxBlockSize: (val: TStyleValue) => TReturn,
|
|
98
|
+
maxInlineSize: (val: TStyleValue) => TReturn,
|
|
99
|
+
borderBlockWidth: $FlowFixMe,
|
|
100
|
+
borderBlockStyle: $FlowFixMe,
|
|
101
|
+
borderBlockColor: $FlowFixMe,
|
|
102
|
+
borderBlockStartWidth: (val: TStyleValue) => TReturn,
|
|
103
|
+
borderBlockStartStyle: (val: TStyleValue) => TReturn,
|
|
104
|
+
borderBlockStartColor: (val: TStyleValue) => TReturn,
|
|
105
|
+
borderBlockEndWidth: (val: TStyleValue) => TReturn,
|
|
106
|
+
borderBlockEndStyle: (val: TStyleValue) => TReturn,
|
|
107
|
+
borderBlockEndColor: (val: TStyleValue) => TReturn,
|
|
108
|
+
borderInlineWidth: $FlowFixMe,
|
|
109
|
+
borderInlineStyle: $FlowFixMe,
|
|
110
|
+
borderInlineColor: $FlowFixMe,
|
|
111
|
+
borderInlineStartWidth: (val: TStyleValue) => TReturn,
|
|
112
|
+
borderInlineStartStyle: (val: TStyleValue) => TReturn,
|
|
113
|
+
borderInlineStartColor: (val: TStyleValue) => TReturn,
|
|
114
|
+
borderInlineEndWidth: (val: TStyleValue) => TReturn,
|
|
115
|
+
borderInlineEndStyle: (val: TStyleValue) => TReturn,
|
|
116
|
+
borderInlineEndColor: (val: TStyleValue) => TReturn,
|
|
117
|
+
borderStartStartRadius: (val: TStyleValue) => TReturn,
|
|
118
|
+
borderStartEndRadius: (val: TStyleValue) => TReturn,
|
|
119
|
+
borderEndStartRadius: (val: TStyleValue) => TReturn,
|
|
120
|
+
borderEndEndRadius: (val: TStyleValue) => TReturn,
|
|
121
|
+
gridGap: $FlowFixMe,
|
|
122
|
+
gridRowGap: (value: TStyleValue) => TReturn,
|
|
123
|
+
gridColumnGap: (value: TStyleValue) => TReturn,
|
|
124
|
+
marginBlock: $FlowFixMe,
|
|
125
|
+
marginBlockStart: (val: TStyleValue) => TReturn,
|
|
126
|
+
marginBlockEnd: (val: TStyleValue) => TReturn,
|
|
127
|
+
marginInline: $FlowFixMe,
|
|
128
|
+
marginInlineStart: (val: TStyleValue) => TReturn,
|
|
129
|
+
marginInlineEnd: (val: TStyleValue) => TReturn,
|
|
130
|
+
overflowBlock: (value: TStyleValue) => TReturn,
|
|
131
|
+
overflowInline: (value: TStyleValue) => TReturn,
|
|
132
|
+
paddingBlock: $FlowFixMe,
|
|
133
|
+
paddingBlockStart: (val: TStyleValue) => TReturn,
|
|
134
|
+
paddingBlockEnd: (val: TStyleValue) => TReturn,
|
|
135
|
+
paddingInline: $FlowFixMe,
|
|
136
|
+
paddingInlineStart: (val: TStyleValue) => TReturn,
|
|
137
|
+
paddingInlineEnd: (val: TStyleValue) => TReturn,
|
|
138
|
+
scrollMarginBlockStart: (value: TStyleValue) => TReturn,
|
|
139
|
+
scrollMarginBlockEnd: (value: TStyleValue) => TReturn,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
declare const expansions: { ...shorthands, ...aliases };
|
|
143
|
+
|
|
144
|
+
declare export default typeof expansions;
|
|
@@ -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
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { TStyleValue } from '../common-types';
|
|
11
|
+
type TReturn = ReadonlyArray<[string, TStyleValue]>;
|
|
12
|
+
declare const shorthands: Readonly<{
|
|
13
|
+
[key: string]: ($$PARAM_0$$: TStyleValue) => TReturn;
|
|
14
|
+
}>;
|
|
15
|
+
declare const aliases: {
|
|
16
|
+
borderHorizontal: any;
|
|
17
|
+
borderVertical: any;
|
|
18
|
+
borderBlockStart: any;
|
|
19
|
+
borderEnd: any;
|
|
20
|
+
borderBlockEnd: any;
|
|
21
|
+
borderStart: any;
|
|
22
|
+
blockSize: (val: TStyleValue) => TReturn;
|
|
23
|
+
inlineSize: (val: TStyleValue) => TReturn;
|
|
24
|
+
minBlockSize: (val: TStyleValue) => TReturn;
|
|
25
|
+
minInlineSize: (val: TStyleValue) => TReturn;
|
|
26
|
+
maxBlockSize: (val: TStyleValue) => TReturn;
|
|
27
|
+
maxInlineSize: (val: TStyleValue) => TReturn;
|
|
28
|
+
borderHorizontalWidth: (val: TStyleValue) => TReturn;
|
|
29
|
+
borderHorizontalStyle: (val: TStyleValue) => TReturn;
|
|
30
|
+
borderHorizontalColor: (val: TStyleValue) => TReturn;
|
|
31
|
+
borderVerticalWidth: (val: TStyleValue) => TReturn;
|
|
32
|
+
borderVerticalStyle: (val: TStyleValue) => TReturn;
|
|
33
|
+
borderVerticalColor: (val: TStyleValue) => TReturn;
|
|
34
|
+
borderBlockStartColor: (value: TStyleValue) => TReturn;
|
|
35
|
+
borderBlockEndColor: (value: TStyleValue) => TReturn;
|
|
36
|
+
borderBlockStartStyle: (value: TStyleValue) => TReturn;
|
|
37
|
+
borderBlockEndStyle: (value: TStyleValue) => TReturn;
|
|
38
|
+
borderBlockStartWidth: (value: TStyleValue) => TReturn;
|
|
39
|
+
borderBlockEndWidth: (value: TStyleValue) => TReturn;
|
|
40
|
+
borderStartColor: (val: TStyleValue) => TReturn;
|
|
41
|
+
borderEndColor: (val: TStyleValue) => TReturn;
|
|
42
|
+
borderStartStyle: (val: TStyleValue) => TReturn;
|
|
43
|
+
borderEndStyle: (val: TStyleValue) => TReturn;
|
|
44
|
+
borderStartWidth: (val: TStyleValue) => TReturn;
|
|
45
|
+
borderEndWidth: (val: TStyleValue) => TReturn;
|
|
46
|
+
borderTopStartRadius: (value: TStyleValue) => TReturn;
|
|
47
|
+
borderTopEndRadius: (value: TStyleValue) => TReturn;
|
|
48
|
+
borderBottomStartRadius: (value: TStyleValue) => TReturn;
|
|
49
|
+
borderBottomEndRadius: (value: TStyleValue) => TReturn;
|
|
50
|
+
containIntrinsicBlockSize: (value: TStyleValue) => TReturn;
|
|
51
|
+
containIntrinsicInlineSize: (value: TStyleValue) => TReturn;
|
|
52
|
+
marginBlockStart: (value: TStyleValue) => TReturn;
|
|
53
|
+
marginBlockEnd: (value: TStyleValue) => TReturn;
|
|
54
|
+
marginStart: (val: TStyleValue) => TReturn;
|
|
55
|
+
marginEnd: (val: TStyleValue) => TReturn;
|
|
56
|
+
marginHorizontal: (val: TStyleValue) => TReturn;
|
|
57
|
+
marginVertical: (val: TStyleValue) => TReturn;
|
|
58
|
+
overflowBlock: (value: TStyleValue) => TReturn;
|
|
59
|
+
overflowInline: (value: TStyleValue) => TReturn;
|
|
60
|
+
paddingBlockStart: (rawValue: TStyleValue) => TReturn;
|
|
61
|
+
paddingBlockEnd: (rawValue: TStyleValue) => TReturn;
|
|
62
|
+
paddingStart: (val: TStyleValue) => TReturn;
|
|
63
|
+
paddingEnd: (val: TStyleValue) => TReturn;
|
|
64
|
+
paddingHorizontal: (val: TStyleValue) => TReturn;
|
|
65
|
+
paddingVertical: (val: TStyleValue) => TReturn;
|
|
66
|
+
scrollMarginBlockStart: (value: TStyleValue) => TReturn;
|
|
67
|
+
scrollMarginBlockEnd: (value: TStyleValue) => TReturn;
|
|
68
|
+
insetBlockStart: (value: TStyleValue) => TReturn;
|
|
69
|
+
insetBlockEnd: (value: TStyleValue) => TReturn;
|
|
70
|
+
start: (val: TStyleValue) => TReturn;
|
|
71
|
+
end: (val: TStyleValue) => TReturn;
|
|
72
|
+
};
|
|
73
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly</**
|
|
74
|
+
* > 85 | ...typeof shorthands,
|
|
75
|
+
* | ^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
|
|
76
|
+
**/
|
|
77
|
+
any>;
|
|
78
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
/// # Handle CSS shorthands in a React Native compatible way.
|
|
13
|
+
///
|
|
14
|
+
/// This means:
|
|
15
|
+
/// - disallowing certain properties altogether by throwing errors
|
|
16
|
+
/// - disallowing multiple values within many shorthands
|
|
17
|
+
/// - Treating certain non-standard properties as aliases for real CSS properties
|
|
18
|
+
|
|
19
|
+
type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
|
|
20
|
+
|
|
21
|
+
declare const shorthands: $ReadOnly<{
|
|
22
|
+
[key: string]: (TStyleValue) => TReturn,
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
declare const aliases: {
|
|
26
|
+
borderHorizontal: $FlowFixMe,
|
|
27
|
+
borderVertical: $FlowFixMe,
|
|
28
|
+
borderBlockStart: $FlowFixMe,
|
|
29
|
+
borderEnd: $FlowFixMe,
|
|
30
|
+
borderBlockEnd: $FlowFixMe,
|
|
31
|
+
borderStart: $FlowFixMe,
|
|
32
|
+
blockSize: (val: TStyleValue) => TReturn,
|
|
33
|
+
inlineSize: (val: TStyleValue) => TReturn,
|
|
34
|
+
minBlockSize: (val: TStyleValue) => TReturn,
|
|
35
|
+
minInlineSize: (val: TStyleValue) => TReturn,
|
|
36
|
+
maxBlockSize: (val: TStyleValue) => TReturn,
|
|
37
|
+
maxInlineSize: (val: TStyleValue) => TReturn,
|
|
38
|
+
borderHorizontalWidth: (val: TStyleValue) => TReturn,
|
|
39
|
+
borderHorizontalStyle: (val: TStyleValue) => TReturn,
|
|
40
|
+
borderHorizontalColor: (val: TStyleValue) => TReturn,
|
|
41
|
+
borderVerticalWidth: (val: TStyleValue) => TReturn,
|
|
42
|
+
borderVerticalStyle: (val: TStyleValue) => TReturn,
|
|
43
|
+
borderVerticalColor: (val: TStyleValue) => TReturn,
|
|
44
|
+
borderBlockStartColor: (value: TStyleValue) => TReturn,
|
|
45
|
+
borderBlockEndColor: (value: TStyleValue) => TReturn,
|
|
46
|
+
borderBlockStartStyle: (value: TStyleValue) => TReturn,
|
|
47
|
+
borderBlockEndStyle: (value: TStyleValue) => TReturn,
|
|
48
|
+
borderBlockStartWidth: (value: TStyleValue) => TReturn,
|
|
49
|
+
borderBlockEndWidth: (value: TStyleValue) => TReturn,
|
|
50
|
+
borderStartColor: (val: TStyleValue) => TReturn,
|
|
51
|
+
borderEndColor: (val: TStyleValue) => TReturn,
|
|
52
|
+
borderStartStyle: (val: TStyleValue) => TReturn,
|
|
53
|
+
borderEndStyle: (val: TStyleValue) => TReturn,
|
|
54
|
+
borderStartWidth: (val: TStyleValue) => TReturn,
|
|
55
|
+
borderEndWidth: (val: TStyleValue) => TReturn,
|
|
56
|
+
borderTopStartRadius: (value: TStyleValue) => TReturn,
|
|
57
|
+
borderTopEndRadius: (value: TStyleValue) => TReturn,
|
|
58
|
+
borderBottomStartRadius: (value: TStyleValue) => TReturn,
|
|
59
|
+
borderBottomEndRadius: (value: TStyleValue) => TReturn,
|
|
60
|
+
containIntrinsicBlockSize: (value: TStyleValue) => TReturn,
|
|
61
|
+
containIntrinsicInlineSize: (value: TStyleValue) => TReturn,
|
|
62
|
+
marginBlockStart: (value: TStyleValue) => TReturn,
|
|
63
|
+
marginBlockEnd: (value: TStyleValue) => TReturn,
|
|
64
|
+
marginStart: (val: TStyleValue) => TReturn,
|
|
65
|
+
marginEnd: (val: TStyleValue) => TReturn,
|
|
66
|
+
marginHorizontal: (val: TStyleValue) => TReturn,
|
|
67
|
+
marginVertical: (val: TStyleValue) => TReturn,
|
|
68
|
+
overflowBlock: (value: TStyleValue) => TReturn,
|
|
69
|
+
overflowInline: (value: TStyleValue) => TReturn,
|
|
70
|
+
paddingBlockStart: (rawValue: TStyleValue) => TReturn,
|
|
71
|
+
paddingBlockEnd: (rawValue: TStyleValue) => TReturn,
|
|
72
|
+
paddingStart: (val: TStyleValue) => TReturn,
|
|
73
|
+
paddingEnd: (val: TStyleValue) => TReturn,
|
|
74
|
+
paddingHorizontal: (val: TStyleValue) => TReturn,
|
|
75
|
+
paddingVertical: (val: TStyleValue) => TReturn,
|
|
76
|
+
scrollMarginBlockStart: (value: TStyleValue) => TReturn,
|
|
77
|
+
scrollMarginBlockEnd: (value: TStyleValue) => TReturn,
|
|
78
|
+
insetBlockStart: (value: TStyleValue) => TReturn,
|
|
79
|
+
insetBlockEnd: (value: TStyleValue) => TReturn,
|
|
80
|
+
start: (val: TStyleValue) => TReturn,
|
|
81
|
+
end: (val: TStyleValue) => TReturn,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
declare export default $ReadOnly<{
|
|
85
|
+
...typeof shorthands,
|
|
86
|
+
...typeof aliases,
|
|
87
|
+
}>;
|
|
@@ -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
|
+
export type ConstsConfigValue = string | number;
|
|
11
|
+
export type ConstsConfig = Readonly<{ [$$Key$$: string]: ConstsConfigValue }>;
|
|
@@ -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
|
+
export type ConstsConfigValue = string | number;
|
|
11
|
+
|
|
12
|
+
export type ConstsConfig = $ReadOnly<{
|
|
13
|
+
[string]: ConstsConfigValue,
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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, StyleXOptions } from './common-types';
|
|
11
|
+
declare function styleXCreateTheme(
|
|
12
|
+
themeVars: {
|
|
13
|
+
readonly __themeName__: string;
|
|
14
|
+
readonly [$$Key$$: string]: string;
|
|
15
|
+
},
|
|
16
|
+
variables: {
|
|
17
|
+
readonly [$$Key$$: string]:
|
|
18
|
+
| string
|
|
19
|
+
| { default: string; readonly [$$Key$$: string]: string };
|
|
20
|
+
},
|
|
21
|
+
options?: StyleXOptions,
|
|
22
|
+
): [
|
|
23
|
+
{ $$css: true; readonly [$$Key$$: string]: string },
|
|
24
|
+
{ [$$Key$$: string]: InjectableStyle },
|
|
25
|
+
];
|
|
26
|
+
export default styleXCreateTheme;
|
|
@@ -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, StyleXOptions } from './common-types';
|
|
11
|
+
|
|
12
|
+
// It takes an object of variables with their values and the original set of variables to override
|
|
13
|
+
// and returns a hashed className with variables overrides.
|
|
14
|
+
//
|
|
15
|
+
declare export default function styleXCreateTheme(
|
|
16
|
+
themeVars: { +__themeName__: string, +[string]: string },
|
|
17
|
+
variables: { +[string]: string | { default: string, +[string]: string } },
|
|
18
|
+
options?: StyleXOptions,
|
|
19
|
+
): [{ $$css: true, +[string]: string }, { [string]: InjectableStyle }];
|
|
@@ -0,0 +1,27 @@
|
|
|
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 {
|
|
11
|
+
RawStyles,
|
|
12
|
+
InjectableStyle,
|
|
13
|
+
StyleXOptions,
|
|
14
|
+
FlatCompiledStyles,
|
|
15
|
+
} from './common-types';
|
|
16
|
+
type ClassPathsInNamespace = {
|
|
17
|
+
readonly [className: string]: ReadonlyArray<string>;
|
|
18
|
+
};
|
|
19
|
+
declare function styleXCreateSet(
|
|
20
|
+
namespaces: { readonly [$$Key$$: string]: RawStyles },
|
|
21
|
+
options?: StyleXOptions,
|
|
22
|
+
): [
|
|
23
|
+
{ [$$Key$$: string]: FlatCompiledStyles },
|
|
24
|
+
{ [$$Key$$: string]: InjectableStyle },
|
|
25
|
+
{ readonly [$$Key$$: string]: ClassPathsInNamespace },
|
|
26
|
+
];
|
|
27
|
+
export default styleXCreateSet;
|
|
@@ -0,0 +1,37 @@
|
|
|
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 {
|
|
11
|
+
RawStyles,
|
|
12
|
+
InjectableStyle,
|
|
13
|
+
StyleXOptions,
|
|
14
|
+
FlatCompiledStyles,
|
|
15
|
+
} from './common-types';
|
|
16
|
+
type ClassPathsInNamespace = {
|
|
17
|
+
+[className: string]: $ReadOnlyArray<string>,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// This takes the object of styles passed to `stylex.create` and transforms it.
|
|
21
|
+
// The transformation replaces style values with classNames.
|
|
22
|
+
//
|
|
23
|
+
// It also collects all injected styles along the way.
|
|
24
|
+
// It then returns a tuple of the transformed style Object and an object of injected styles.
|
|
25
|
+
//
|
|
26
|
+
// This function does some basic validation, and then uses `styleXCreateNamespace` to transform
|
|
27
|
+
// each namespace within,
|
|
28
|
+
//
|
|
29
|
+
// Before returning, it ensures that there are no duplicate styles being injected.
|
|
30
|
+
declare export default function styleXCreateSet(
|
|
31
|
+
namespaces: { +[string]: RawStyles },
|
|
32
|
+
options?: StyleXOptions,
|
|
33
|
+
): [
|
|
34
|
+
{ [string]: FlatCompiledStyles },
|
|
35
|
+
{ [string]: InjectableStyle },
|
|
36
|
+
{ +[string]: ClassPathsInNamespace },
|
|
37
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { InjectableConstStyle, StyleXOptions } from './common-types';
|
|
11
|
+
import type { ConstsConfig } from './stylex-consts-utils';
|
|
12
|
+
declare function styleXDefineConsts<Vars extends ConstsConfig>(
|
|
13
|
+
constants: Vars,
|
|
14
|
+
options: Readonly<
|
|
15
|
+
Omit<Partial<StyleXOptions>, keyof ({ themeName: string })> & {
|
|
16
|
+
themeName: string;
|
|
17
|
+
}
|
|
18
|
+
>,
|
|
19
|
+
): [
|
|
20
|
+
{ [$$Key$$: string]: string | number },
|
|
21
|
+
{ [$$Key$$: string]: InjectableConstStyle },
|
|
22
|
+
];
|
|
23
|
+
export default styleXDefineConsts;
|
|
@@ -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 { InjectableConstStyle, StyleXOptions } from './common-types';
|
|
11
|
+
import type { ConstsConfig } from './stylex-consts-utils';
|
|
12
|
+
|
|
13
|
+
declare export default function styleXDefineConsts<Vars: ConstsConfig>(
|
|
14
|
+
constants: Vars,
|
|
15
|
+
options: $ReadOnly<{ ...Partial<StyleXOptions>, themeName: string, ... }>,
|
|
16
|
+
): [
|
|
17
|
+
{ [string]: string | number }, // jsOutput JS output
|
|
18
|
+
{ [string]: InjectableConstStyle }, // metadata for registerinjectableStyles
|
|
19
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
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, StyleXOptions } from './common-types';
|
|
11
|
+
import type { VarsConfig } from './stylex-vars-utils';
|
|
12
|
+
type VarsKeysWithStringValues<Vars extends VarsConfig> = Readonly<{
|
|
13
|
+
[$$Key$$: keyof Vars]: string;
|
|
14
|
+
}>;
|
|
15
|
+
type VarsObject<Vars extends VarsConfig> = Readonly<
|
|
16
|
+
Omit<VarsKeysWithStringValues<Vars>, keyof ({ __themeName__: string })> & {
|
|
17
|
+
__themeName__: string;
|
|
18
|
+
}
|
|
19
|
+
>;
|
|
20
|
+
declare function styleXDefineVars<Vars extends VarsConfig>(
|
|
21
|
+
variables: Vars,
|
|
22
|
+
options: Readonly<
|
|
23
|
+
Omit<Partial<StyleXOptions>, keyof ({ themeName: string })> & {
|
|
24
|
+
themeName: string;
|
|
25
|
+
}
|
|
26
|
+
>,
|
|
27
|
+
): [VarsObject<Vars>, { [$$Key$$: string]: InjectableStyle }];
|
|
28
|
+
export default styleXDefineVars;
|
|
@@ -0,0 +1,26 @@
|
|
|
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, StyleXOptions } from './common-types';
|
|
11
|
+
import type { VarsConfig } from './stylex-vars-utils';
|
|
12
|
+
type VarsKeysWithStringValues<Vars: VarsConfig> = $ReadOnly<{
|
|
13
|
+
[$Keys<Vars>]: string,
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
type VarsObject<Vars: VarsConfig> = $ReadOnly<{
|
|
17
|
+
...VarsKeysWithStringValues<Vars>,
|
|
18
|
+
__themeName__: string,
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
// Similar to `stylex.create` it takes an object of variables with their values
|
|
22
|
+
// and returns a string after hashing it.
|
|
23
|
+
declare export default function styleXDefineVars<Vars: VarsConfig>(
|
|
24
|
+
variables: Vars,
|
|
25
|
+
options: $ReadOnly<{ ...Partial<StyleXOptions>, themeName: string, ... }>,
|
|
26
|
+
): [VarsObject<Vars>, { [string]: InjectableStyle }];
|
|
@@ -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
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare function stylexFirstThatWorks(
|
|
11
|
+
...args: ReadonlyArray<string>
|
|
12
|
+
): ReadonlyArray<string> | string;
|
|
13
|
+
export default stylexFirstThatWorks;
|
|
@@ -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
|
+
declare export default function stylexFirstThatWorks(
|
|
11
|
+
...args: $ReadOnlyArray<string>
|
|
12
|
+
): $ReadOnlyArray<string> | string;
|
|
@@ -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
|
+
import type { InjectableStyle, StyleXOptions } from './common-types';
|
|
11
|
+
declare function styleXKeyframes(
|
|
12
|
+
frames: {
|
|
13
|
+
readonly [$$Key$$: string]: { readonly [$$Key$$: string]: string | number };
|
|
14
|
+
},
|
|
15
|
+
options: StyleXOptions,
|
|
16
|
+
): [string, InjectableStyle];
|
|
17
|
+
export default styleXKeyframes;
|
|
@@ -0,0 +1,20 @@
|
|
|
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, StyleXOptions } from './common-types';
|
|
11
|
+
|
|
12
|
+
// Similar to `stylex.create` it takes an object of keyframes
|
|
13
|
+
// and returns a string after hashing it.
|
|
14
|
+
//
|
|
15
|
+
// It also expands shorthand properties to maintain parity with
|
|
16
|
+
// `stylex.create`.
|
|
17
|
+
declare export default function styleXKeyframes(
|
|
18
|
+
frames: { +[string]: { +[string]: string | number } },
|
|
19
|
+
options: StyleXOptions,
|
|
20
|
+
): [string, InjectableStyle];
|
|
@@ -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
|
+
import type { InjectableStyle, StyleXOptions } from './common-types';
|
|
11
|
+
declare function styleXPositionTry(
|
|
12
|
+
styles: { readonly [$$Key$$: string]: string | number },
|
|
13
|
+
options: StyleXOptions,
|
|
14
|
+
): [string, InjectableStyle];
|
|
15
|
+
export default styleXPositionTry;
|
|
@@ -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
|
+
import type { InjectableStyle, StyleXOptions } from './common-types';
|
|
11
|
+
|
|
12
|
+
// Similar to `stylex.keyframes` but for position-try-fallbacks
|
|
13
|
+
// Takes an object of positioning properties and returns a string after hashing it
|
|
14
|
+
// The generated string must be prefixed with -- for anchor positioning
|
|
15
|
+
declare export default function styleXPositionTry(
|
|
16
|
+
styles: { +[string]: string | number },
|
|
17
|
+
options: StyleXOptions,
|
|
18
|
+
): [string, InjectableStyle];
|