@stylexjs/shared 0.17.5 → 0.18.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/common-types.d.ts +61 -0
- package/lib/common-types.js +1 -0
- package/lib/common-types.js.flow +85 -0
- package/lib/hash.d.ts +15 -0
- package/lib/hash.js +49 -0
- package/lib/hash.js.flow +12 -0
- package/lib/messages.d.ts +70 -0
- package/lib/messages.js +38 -0
- package/lib/messages.js.flow +44 -0
- package/lib/physical-rtl/generate-ltr.d.ts +15 -0
- package/lib/physical-rtl/generate-ltr.js +75 -0
- package/lib/physical-rtl/generate-ltr.js.flow +14 -0
- package/lib/physical-rtl/generate-rtl.d.ts +15 -0
- package/lib/physical-rtl/generate-rtl.js +157 -0
- package/lib/physical-rtl/generate-rtl.js.flow +14 -0
- package/lib/preprocess-rules/PreRule.d.ts +51 -0
- package/lib/preprocess-rules/PreRule.js +79 -0
- package/lib/preprocess-rules/PreRule.js.flow +63 -0
- package/lib/preprocess-rules/__tests__/PreRule-test.js +33 -0
- package/lib/preprocess-rules/__tests__/flatten-raw-style-obj-test.js +196 -0
- package/lib/preprocess-rules/application-order.d.ts +186 -0
- package/lib/preprocess-rules/application-order.js +195 -0
- package/lib/preprocess-rules/application-order.js.flow +141 -0
- package/lib/preprocess-rules/basic-validation.d.ts +13 -0
- package/lib/preprocess-rules/basic-validation.js +70 -0
- package/lib/preprocess-rules/basic-validation.js.flow +13 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +20 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js +100 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +23 -0
- package/lib/preprocess-rules/index.d.ts +21 -0
- package/lib/preprocess-rules/index.js +45 -0
- package/lib/preprocess-rules/index.js.flow +23 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +170 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.js +222 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +142 -0
- package/lib/preprocess-rules/property-specificity.d.ts +79 -0
- package/lib/preprocess-rules/property-specificity.js +107 -0
- package/lib/preprocess-rules/property-specificity.js.flow +93 -0
- package/lib/stylex-consts-utils.d.ts +11 -0
- package/lib/stylex-consts-utils.js +1 -0
- package/lib/stylex-consts-utils.js.flow +14 -0
- package/lib/stylex-create-theme.d.ts +26 -0
- package/lib/stylex-create-theme.js +53 -0
- package/lib/stylex-create-theme.js.flow +19 -0
- package/lib/stylex-create.d.ts +27 -0
- package/lib/stylex-create.js +60 -0
- package/lib/stylex-create.js.flow +37 -0
- package/lib/stylex-defaultMarker.d.ts +14 -0
- package/lib/stylex-defaultMarker.js +14 -0
- package/lib/stylex-defaultMarker.js.flow +13 -0
- package/lib/stylex-define-consts.d.ts +23 -0
- package/lib/stylex-define-consts.js +40 -0
- package/lib/stylex-define-consts.js.flow +19 -0
- package/lib/stylex-define-vars.d.ts +28 -0
- package/lib/stylex-define-vars.js +90 -0
- package/lib/stylex-define-vars.js.flow +26 -0
- package/lib/stylex-first-that-works.d.ts +13 -0
- package/lib/stylex-first-that-works.js +23 -0
- package/lib/stylex-first-that-works.js.flow +12 -0
- package/lib/stylex-keyframes.d.ts +17 -0
- package/lib/stylex-keyframes.js +46 -0
- package/lib/stylex-keyframes.js.flow +20 -0
- package/lib/stylex-position-try.d.ts +15 -0
- package/lib/stylex-position-try.js +47 -0
- package/lib/stylex-position-try.js.flow +18 -0
- package/lib/stylex-vars-utils.d.ts +27 -0
- package/lib/stylex-vars-utils.js +66 -0
- package/lib/stylex-vars-utils.js.flow +31 -0
- package/lib/stylex-view-transition-class.d.ts +22 -0
- package/lib/stylex-view-transition-class.js +42 -0
- package/lib/stylex-view-transition-class.js.flow +23 -0
- package/lib/types/__tests__/stylex-types-test.js +178 -0
- package/lib/types/index.d.ts +254 -0
- package/lib/types/index.js +147 -0
- package/lib/types/index.js.flow +280 -0
- package/lib/utils/Rule.d.ts +58 -0
- package/lib/utils/Rule.js +50 -0
- package/lib/utils/Rule.js.flow +64 -0
- package/lib/utils/__tests__/convert-to-className-test.js +85 -0
- package/lib/utils/__tests__/property-priorities-test.js +33 -0
- package/lib/utils/__tests__/split-css-value-test.js +26 -0
- package/lib/utils/__tests__/transform-value-test.js +36 -0
- package/lib/utils/convert-to-className.d.ts +21 -0
- package/lib/utils/convert-to-className.js +61 -0
- package/lib/utils/convert-to-className.js.flow +29 -0
- package/lib/utils/css-properties.js.flow +155 -0
- package/lib/utils/dashify.d.ts +11 -0
- package/lib/utils/dashify.js +9 -0
- package/lib/utils/dashify.js.flow +10 -0
- package/lib/utils/default-options.d.ts +12 -0
- package/lib/utils/default-options.js +26 -0
- package/lib/utils/default-options.js.flow +12 -0
- package/lib/utils/file-based-identifier.d.ts +15 -0
- package/lib/utils/file-based-identifier.js +13 -0
- package/lib/utils/file-based-identifier.js.flow +14 -0
- package/lib/utils/generate-css-rule.d.ts +19 -0
- package/lib/utils/generate-css-rule.js +37 -0
- package/lib/utils/generate-css-rule.js.flow +19 -0
- package/lib/utils/normalize-value.d.ts +16 -0
- package/lib/utils/normalize-value.js +27 -0
- package/lib/utils/normalize-value.js.flow +16 -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 +16 -0
- 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 +24 -0
- 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 +24 -0
- 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 +17 -0
- package/lib/utils/normalizers/quotes.js.flow +17 -0
- package/lib/utils/normalizers/timings.d.ts +18 -0
- package/lib/utils/normalizers/timings.js +25 -0
- package/lib/utils/normalizers/timings.js.flow +17 -0
- package/lib/utils/normalizers/whitespace.d.ts +19 -0
- package/lib/utils/normalizers/whitespace.js +54 -0
- 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 +45 -0
- package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
- package/lib/utils/object-utils.d.ts +68 -0
- package/lib/utils/object-utils.js +89 -0
- package/lib/utils/object-utils.js.flow +78 -0
- package/lib/utils/property-priorities.js +13 -1
- package/lib/utils/rule-utils.d.ts +17 -0
- package/lib/utils/rule-utils.js +41 -0
- package/lib/utils/rule-utils.js.flow +16 -0
- package/lib/utils/split-css-value.d.ts +14 -0
- package/lib/utils/split-css-value.js +41 -0
- package/lib/utils/split-css-value.js.flow +15 -0
- package/lib/utils/transform-value.d.ts +24 -0
- package/lib/utils/transform-value.js +50 -0
- package/lib/utils/transform-value.js.flow +25 -0
- package/lib/validate.d.ts +12 -0
- package/lib/validate.js +19 -0
- package/lib/validate.js.flow +14 -0
- package/lib/when/when.d.ts +67 -0
- package/lib/when/when.js +71 -0
- package/lib/when/when.js.flow +73 -0
- package/package.json +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Shorthand properties:
|
|
13
|
+
* - [x] all - Should be banned
|
|
14
|
+
* - [x] animation
|
|
15
|
+
* - [x] background
|
|
16
|
+
* - [x] border
|
|
17
|
+
* - [x] border-block-end
|
|
18
|
+
* - [x] border-block-start
|
|
19
|
+
* - [x] border-bottom
|
|
20
|
+
* - [x] border-color
|
|
21
|
+
* - [x] border-image
|
|
22
|
+
* - [x] border-inline-end
|
|
23
|
+
* - [x] border-inline-start
|
|
24
|
+
* - [x] border-left
|
|
25
|
+
* - [x] border-radius
|
|
26
|
+
* - [x] corner-shape
|
|
27
|
+
* - [x] border-right
|
|
28
|
+
* - [x] border-style
|
|
29
|
+
* - [x] border-top
|
|
30
|
+
* - [x] border-width
|
|
31
|
+
* - [x] column-rule
|
|
32
|
+
* - [x] columns
|
|
33
|
+
* - [x] container
|
|
34
|
+
* - [x] flex
|
|
35
|
+
* - [x] flex-flow
|
|
36
|
+
* - [x] font
|
|
37
|
+
* - [x] gap
|
|
38
|
+
* - [x] grid
|
|
39
|
+
* - [x] grid-area
|
|
40
|
+
* - [x] grid-column
|
|
41
|
+
* - [x] grid-row
|
|
42
|
+
* - [x] grid-template
|
|
43
|
+
* - [x] inset
|
|
44
|
+
* - [x] inset-block
|
|
45
|
+
* - [x] inset-inline
|
|
46
|
+
* - [x] list-style
|
|
47
|
+
* - [x] margin
|
|
48
|
+
* - [x] mask
|
|
49
|
+
* - [x] offset
|
|
50
|
+
* - [x] outline
|
|
51
|
+
* - [x] overflow
|
|
52
|
+
* - [x] padding
|
|
53
|
+
* - [x] place-content
|
|
54
|
+
* - [x] place-items
|
|
55
|
+
* - [x] place-self
|
|
56
|
+
* - [x] scroll-margin
|
|
57
|
+
* - [x] scroll-padding
|
|
58
|
+
* - [x] text-decoration
|
|
59
|
+
* - [x] text-emphasis
|
|
60
|
+
* - [x] transition
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Shorthand properties:
|
|
65
|
+
* - [x] all - Should be banned
|
|
66
|
+
* - [x] animation
|
|
67
|
+
* - [x] background
|
|
68
|
+
* - [x] border
|
|
69
|
+
* - [x] border-block-end
|
|
70
|
+
* - [x] border-block-start
|
|
71
|
+
* - [x] border-bottom
|
|
72
|
+
* - [x] border-color
|
|
73
|
+
* - [x] border-image
|
|
74
|
+
* - [x] border-inline-end
|
|
75
|
+
* - [x] border-inline-start
|
|
76
|
+
* - [x] border-left
|
|
77
|
+
* - [x] border-radius
|
|
78
|
+
* - [x] corner-shape
|
|
79
|
+
* - [x] border-right
|
|
80
|
+
* - [x] border-style
|
|
81
|
+
* - [x] border-top
|
|
82
|
+
* - [x] border-width
|
|
83
|
+
* - [x] column-rule
|
|
84
|
+
* - [x] columns
|
|
85
|
+
* - [x] container
|
|
86
|
+
* - [x] flex
|
|
87
|
+
* - [x] flex-flow
|
|
88
|
+
* - [x] font
|
|
89
|
+
* - [x] gap
|
|
90
|
+
* - [x] grid
|
|
91
|
+
* - [x] grid-area
|
|
92
|
+
* - [x] grid-column
|
|
93
|
+
* - [x] grid-row
|
|
94
|
+
* - [x] grid-template
|
|
95
|
+
* - [x] inset
|
|
96
|
+
* - [x] inset-block
|
|
97
|
+
* - [x] inset-inline
|
|
98
|
+
* - [x] list-style
|
|
99
|
+
* - [x] margin
|
|
100
|
+
* - [x] mask
|
|
101
|
+
* - [x] offset
|
|
102
|
+
* - [x] outline
|
|
103
|
+
* - [x] overflow
|
|
104
|
+
* - [x] padding
|
|
105
|
+
* - [x] place-content
|
|
106
|
+
* - [x] place-items
|
|
107
|
+
* - [x] place-self
|
|
108
|
+
* - [x] scroll-margin
|
|
109
|
+
* - [x] scroll-padding
|
|
110
|
+
* - [x] text-decoration
|
|
111
|
+
* - [x] text-emphasis
|
|
112
|
+
* - [x] transition
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
type TReturn = ReadonlyArray<[string, TStyleValue]>;
|
|
116
|
+
declare const shorthands: Readonly<{
|
|
117
|
+
[key: string]: ($$PARAM_0$$: TStyleValue) => TReturn;
|
|
118
|
+
}>;
|
|
119
|
+
declare const aliases: {
|
|
120
|
+
borderHorizontal: typeof shorthands.borderInline;
|
|
121
|
+
borderVertical: typeof shorthands.borderBlock;
|
|
122
|
+
borderBlockStart: typeof shorthands.borderTop;
|
|
123
|
+
borderEnd: typeof shorthands.borderInlineEnd;
|
|
124
|
+
borderBlockEnd: typeof shorthands.borderBottom;
|
|
125
|
+
borderStart: typeof shorthands.borderInlineStart;
|
|
126
|
+
blockSize: (val: TStyleValue) => TReturn;
|
|
127
|
+
inlineSize: (val: TStyleValue) => TReturn;
|
|
128
|
+
minBlockSize: (val: TStyleValue) => TReturn;
|
|
129
|
+
minInlineSize: (val: TStyleValue) => TReturn;
|
|
130
|
+
maxBlockSize: (val: TStyleValue) => TReturn;
|
|
131
|
+
maxInlineSize: (val: TStyleValue) => TReturn;
|
|
132
|
+
borderHorizontalWidth: typeof shorthands.borderInlineWidth;
|
|
133
|
+
borderHorizontalStyle: typeof shorthands.borderInlineStyle;
|
|
134
|
+
borderHorizontalColor: typeof shorthands.borderInlineColor;
|
|
135
|
+
borderVerticalWidth: typeof shorthands.borderBlockWidth;
|
|
136
|
+
borderVerticalStyle: typeof shorthands.borderBlockStyle;
|
|
137
|
+
borderVerticalColor: typeof shorthands.borderBlockColor;
|
|
138
|
+
borderBlockStartColor: (value: TStyleValue) => TReturn;
|
|
139
|
+
borderBlockEndColor: (value: TStyleValue) => TReturn;
|
|
140
|
+
borderBlockStartStyle: (value: TStyleValue) => TReturn;
|
|
141
|
+
borderBlockEndStyle: (value: TStyleValue) => TReturn;
|
|
142
|
+
borderBlockStartWidth: (value: TStyleValue) => TReturn;
|
|
143
|
+
borderBlockEndWidth: (value: TStyleValue) => TReturn;
|
|
144
|
+
borderStartColor: typeof shorthands.borderInlineStartColor;
|
|
145
|
+
borderEndColor: typeof shorthands.borderInlineEndColor;
|
|
146
|
+
borderStartStyle: typeof shorthands.borderInlineStartStyle;
|
|
147
|
+
borderEndStyle: typeof shorthands.borderInlineEndStyle;
|
|
148
|
+
borderStartWidth: typeof shorthands.borderInlineStartWidth;
|
|
149
|
+
borderEndWidth: typeof shorthands.borderInlineEndWidth;
|
|
150
|
+
borderTopStartRadius: (value: TStyleValue) => TReturn;
|
|
151
|
+
borderTopEndRadius: (value: TStyleValue) => TReturn;
|
|
152
|
+
borderBottomStartRadius: (value: TStyleValue) => TReturn;
|
|
153
|
+
borderBottomEndRadius: (value: TStyleValue) => TReturn;
|
|
154
|
+
containIntrinsicBlockSize: (value: TStyleValue) => TReturn;
|
|
155
|
+
containIntrinsicInlineSize: (value: TStyleValue) => TReturn;
|
|
156
|
+
gridGap: typeof shorthands.gap;
|
|
157
|
+
gridRowGap: (value: TStyleValue) => TReturn;
|
|
158
|
+
gridColumnGap: (value: TStyleValue) => TReturn;
|
|
159
|
+
marginBlockStart: (value: TStyleValue) => TReturn;
|
|
160
|
+
marginBlockEnd: (value: TStyleValue) => TReturn;
|
|
161
|
+
marginStart: typeof shorthands.marginInlineStart;
|
|
162
|
+
marginEnd: typeof shorthands.marginInlineEnd;
|
|
163
|
+
marginHorizontal: typeof shorthands.marginInline;
|
|
164
|
+
marginVertical: typeof shorthands.marginBlock;
|
|
165
|
+
overflowBlock: (value: TStyleValue) => TReturn;
|
|
166
|
+
overflowInline: (value: TStyleValue) => TReturn;
|
|
167
|
+
paddingBlockStart: (rawValue: TStyleValue) => TReturn;
|
|
168
|
+
paddingBlockEnd: (rawValue: TStyleValue) => TReturn;
|
|
169
|
+
paddingStart: typeof shorthands.paddingInlineStart;
|
|
170
|
+
paddingEnd: typeof shorthands.paddingInlineEnd;
|
|
171
|
+
paddingHorizontal: typeof shorthands.paddingInline;
|
|
172
|
+
paddingVertical: typeof shorthands.paddingBlock;
|
|
173
|
+
scrollMarginBlockStart: (value: TStyleValue) => TReturn;
|
|
174
|
+
scrollMarginBlockEnd: (value: TStyleValue) => TReturn;
|
|
175
|
+
insetBlockStart: (value: TStyleValue) => TReturn;
|
|
176
|
+
insetBlockEnd: (value: TStyleValue) => TReturn;
|
|
177
|
+
start: typeof shorthands.insetInlineStart;
|
|
178
|
+
end: typeof shorthands.insetInlineEnd;
|
|
179
|
+
};
|
|
180
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly<
|
|
181
|
+
Omit<typeof shorthands, keyof typeof aliases | keyof {}> &
|
|
182
|
+
Omit<typeof aliases, keyof {}> & {}
|
|
183
|
+
>;
|
|
184
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
185
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
186
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const shorthands = {
|
|
8
|
+
all: _ => {
|
|
9
|
+
throw new Error('all is not supported');
|
|
10
|
+
},
|
|
11
|
+
animation: value => [['animation', value], ['animationComposition', null], ['animationName', null], ['animationDuration', null], ['animationTimingFunction', null], ['animationDelay', null], ['animationIterationCount', null], ['animationDirection', null], ['animationFillMode', null], ['animationPlayState', null], ...shorthands.animationRange(null), ['animationTimeline', null]],
|
|
12
|
+
animationRange: value => [['animationRange', value], ['animationRangeEnd', null], ['animationRangeStart', null]],
|
|
13
|
+
background: value => [['background', value], ['backgroundAttachment', null], ['backgroundClip', null], ['backgroundColor', null], ['backgroundImage', null], ['backgroundOrigin', null], ...shorthands.backgroundPosition(null), ['backgroundRepeat', null], ['backgroundSize', null]],
|
|
14
|
+
backgroundPosition: value => [['backgroundPosition', value], ['backgroundPositionX', null], ['backgroundPositionY', null]],
|
|
15
|
+
border: rawValue => [['border', rawValue], ...shorthands.borderWidth(null), ...shorthands.borderStyle(null), ...shorthands.borderColor(null)],
|
|
16
|
+
borderInline: rawValue => [['borderInline', rawValue], ...shorthands.borderInlineWidth(null), ...shorthands.borderInlineStyle(null), ...shorthands.borderInlineColor(null)],
|
|
17
|
+
borderBlock: rawValue => [['borderBlock', rawValue], ...shorthands.borderBlockWidth(null), ...shorthands.borderBlockStyle(null), ...shorthands.borderBlockColor(null)],
|
|
18
|
+
borderTop: rawValue => [['borderTop', rawValue], ['borderTopWidth', null], ['borderTopStyle', null], ['borderTopColor', null]],
|
|
19
|
+
borderInlineEnd: rawValue => [['borderInlineEnd', rawValue], ...shorthands.borderInlineEndWidth(null), ...shorthands.borderInlineEndStyle(null), ...shorthands.borderInlineEndColor(null)],
|
|
20
|
+
borderRight: rawValue => [['borderRight', rawValue], ...shorthands.borderRightWidth(null), ...shorthands.borderRightStyle(null), ...shorthands.borderRightColor(null)],
|
|
21
|
+
borderBottom: rawValue => [['borderBottom', rawValue], ['borderBottomWidth', null], ['borderBottomStyle', null], ['borderBottomColor', null]],
|
|
22
|
+
borderInlineStart: rawValue => [['borderInlineStart', rawValue], ...shorthands.borderInlineStartWidth(null), ...shorthands.borderInlineStartStyle(null), ...shorthands.borderInlineStartColor(null)],
|
|
23
|
+
borderLeft: rawValue => [['borderLeft', rawValue], ...shorthands.borderLeftWidth(null), ...shorthands.borderLeftStyle(null), ...shorthands.borderLeftColor(null)],
|
|
24
|
+
borderInlineWidth: rawValue => [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderLeftWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null]],
|
|
25
|
+
borderInlineStyle: rawValue => [['borderInlineStyle', rawValue], ['borderInlineStartStyle', null], ['borderLeftStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null]],
|
|
26
|
+
borderInlineColor: rawValue => [['borderInlineColor', rawValue], ['borderInlineStartColor', null], ['borderLeftColor', null], ['borderInlineEndColor', null], ['borderRightColor', null]],
|
|
27
|
+
borderBlockWidth: rawValue => [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]],
|
|
28
|
+
borderBlockStyle: rawValue => [['borderBlockStyle', rawValue], ['borderTopStyle', null], ['borderBottomStyle', null]],
|
|
29
|
+
borderBlockColor: rawValue => [['borderBlockColor', rawValue], ['borderTopColor', null], ['borderBottomColor', null]],
|
|
30
|
+
borderColor: value => [['borderColor', value], ...shorthands.borderInlineColor(null), ...shorthands.borderBlockColor(null)],
|
|
31
|
+
borderStyle: value => [['borderStyle', value], ...shorthands.borderInlineStyle(null), ...shorthands.borderBlockStyle(null)],
|
|
32
|
+
borderWidth: value => [['borderWidth', value], ...shorthands.borderInlineWidth(null), ...shorthands.borderBlockWidth(null)],
|
|
33
|
+
borderInlineStartColor: value => [['borderInlineStartColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
|
|
34
|
+
borderInlineEndColor: value => [['borderInlineEndColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
|
|
35
|
+
borderInlineStartStyle: value => [['borderInlineStartStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
|
|
36
|
+
borderInlineEndStyle: value => [['borderInlineEndStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
|
|
37
|
+
borderInlineStartWidth: value => [['borderInlineStartWidth', value], ['borderLeftWidth', null], ['borderRightWidth', null]],
|
|
38
|
+
borderInlineEndWidth: value => [['borderInlineEndWidth', value], ['borderLeftWidth', null], ['borderRightWidth', null]],
|
|
39
|
+
borderLeftColor: value => [['borderLeftColor', value], ['borderInlineStartColor', null], ['borderInlineEndColor', null]],
|
|
40
|
+
borderRightColor: value => [['borderRightColor', value], ['borderInlineStartColor', null], ['borderInlineEndColor', null]],
|
|
41
|
+
borderLeftStyle: value => [['borderLeftStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
|
|
42
|
+
borderRightStyle: value => [['borderRightStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
|
|
43
|
+
borderLeftWidth: value => [['borderLeftWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
|
|
44
|
+
borderRightWidth: value => [['borderRightWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
|
|
45
|
+
borderRadius: value => [['borderRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null], ['borderEndStartRadius', null], ['borderEndEndRadius', null], ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
|
|
46
|
+
borderStartStartRadius: value => [['borderStartStartRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
|
|
47
|
+
borderStartEndRadius: value => [['borderStartEndRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
|
|
48
|
+
borderEndStartRadius: value => [['borderEndStartRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
|
|
49
|
+
borderEndEndRadius: value => [['borderEndEndRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
|
|
50
|
+
borderTopLeftRadius: value => [['borderTopLeftRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
|
|
51
|
+
borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
|
|
52
|
+
borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
|
|
53
|
+
borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
|
|
54
|
+
cornerShape: value => [['cornerShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null], ['cornerEndStartShape', null], ['cornerEndEndShape', null], ['cornerTopLeftShape', null], ['cornerTopRightShape', null], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
55
|
+
cornerStartStartShape: value => [['cornerStartStartShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
|
|
56
|
+
cornerStartEndShape: value => [['cornerStartEndShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
|
|
57
|
+
cornerEndStartShape: value => [['cornerEndStartShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
58
|
+
cornerEndEndShape: value => [['cornerEndEndShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
59
|
+
cornerTopLeftShape: value => [['cornerTopLeftShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
|
|
60
|
+
cornerTopRightShape: value => [['cornerTopRightShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
|
|
61
|
+
cornerBottomLeftShape: value => [['cornerBottomLeftShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
|
|
62
|
+
cornerBottomRightShape: value => [['cornerBottomRightShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
|
|
63
|
+
borderImage: value => [['borderImage', value], ['borderImageOutset', null], ['borderImageRepeat', null], ['borderImageSlice', null], ['borderImageSource', null], ['borderImageWidth', null]],
|
|
64
|
+
columnRule: value => [['columnRule', value], ['columnRuleColor', null], ['columnRuleStyle', null], ['columnRuleWidth', null]],
|
|
65
|
+
columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
|
|
66
|
+
container: value => [['container', value], ['containerName', null], ['containerType', null]],
|
|
67
|
+
containIntrinsicSize: value => [['containIntrinsicSize', value], ['containIntrinsicWidth', null], ['containIntrinsicHeight', null]],
|
|
68
|
+
flex: value => [['flex', value], ['flexGrow', null], ['flexShrink', null], ['flexBasis', null]],
|
|
69
|
+
flexFlow: value => [['flexFlow', value], ['flexDirection', null], ['flexWrap', null]],
|
|
70
|
+
font: value => [['font', value], ['fontFamily', null], ['fontSize', null], ['fontStretch', null], ['fontStyle', null], ...shorthands.fontVariant(null), ['fontWeight', null], ['lineHeight', null]],
|
|
71
|
+
fontVariant: value => [['fontVariant', value], ['fontVariantAlternates', null], ['fontVariantCaps', null], ['fontVariantEastAsian', null], ['fontVariantEmoji', null], ['fontVariantLigatures', null], ['fontVariantNumeric', null], ['fontVariantPosition', null]],
|
|
72
|
+
gap: value => [['gap', value], ['rowGap', null], ['columnGap', null]],
|
|
73
|
+
grid: value => [['grid', value], ...shorthands.gridTemplate(null), ['gridAutoRows', null], ['gridAutoColumns', null], ['gridAutoFlow', null]],
|
|
74
|
+
gridArea: value => [['gridArea', value], ['gridRow', null], ['gridRowStart', null], ['gridRowEnd', null], ['gridColumn', null], ['gridColumnStart', null], ['gridColumnEnd', null]],
|
|
75
|
+
gridRow: value => [['gridRow', value], ['gridRowStart', null], ['gridRowEnd', null]],
|
|
76
|
+
gridColumn: value => [['gridColumn', value], ['gridColumnStart', null], ['gridColumnEnd', null]],
|
|
77
|
+
gridTemplate: value => [['gridTemplate', value], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null]],
|
|
78
|
+
inset: value => [['inset', value], ...shorthands.insetInline(null), ...shorthands.insetBlock(null)],
|
|
79
|
+
insetInline: value => [['insetInline', value], ['insetInlineStart', null], ['insetInlineEnd', null], ['left', null], ['right', null]],
|
|
80
|
+
insetBlock: value => [['insetBlock', value], ['top', null], ['bottom', null]],
|
|
81
|
+
insetInlineStart: value => [['insetInlineStart', value], ['left', null], ['right', null]],
|
|
82
|
+
insetInlineEnd: value => [['insetInlineEnd', value], ['left', null], ['right', null]],
|
|
83
|
+
left: value => [['left', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
|
|
84
|
+
right: value => [['right', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
|
|
85
|
+
listStyle: value => [['listStyle', value], ['listStyleImage', null], ['listStylePosition', null], ['listStyleType', null]],
|
|
86
|
+
margin: value => [['margin', value], ...shorthands.marginInline(null), ...shorthands.marginBlock(null)],
|
|
87
|
+
marginInline: value => [['marginInline', value], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null]],
|
|
88
|
+
marginBlock: value => [['marginBlock', value], ['marginTop', null], ['marginBottom', null]],
|
|
89
|
+
marginInlineStart: value => [['marginInlineStart', value], ['marginLeft', null], ['marginRight', null]],
|
|
90
|
+
marginInlineEnd: value => [['marginInlineEnd', value], ['marginLeft', null], ['marginRight', null]],
|
|
91
|
+
marginLeft: value => [['marginLeft', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
|
|
92
|
+
marginRight: value => [['marginRight', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
|
|
93
|
+
mask: value => [['mask', value], ['maskClip', null], ['maskComposite', null], ['maskImage', null], ['maskMode', null], ['maskOrigin', null], ['maskPosition', null], ['maskRepeat', null], ['maskSize', null]],
|
|
94
|
+
maskBorder: value => [['maskBorder', value], ['maskBorderMode', null], ['maskBorderOutset', null], ['maskBorderRepeat', null], ['maskBorderSlice', null], ['maskBorderSource', null], ['maskBorderWidth', null]],
|
|
95
|
+
offset: value => [['offset', value], ['offsetAnchor', null], ['offsetDistance', null], ['offsetPath', null], ['offsetPosition', null], ['offsetRotate', null]],
|
|
96
|
+
outline: value => [['outline', value], ['outlineColor', null], ['outlineOffset', null], ['outlineStyle', null], ['outlineWidth', null]],
|
|
97
|
+
overflow: value => [['overflow', value], ['overflowX', null], ['overflowY', null]],
|
|
98
|
+
padding: rawValue => {
|
|
99
|
+
return [['padding', rawValue], ...shorthands.paddingInline(null), ...shorthands.paddingBlock(null)];
|
|
100
|
+
},
|
|
101
|
+
paddingInline: rawValue => [['paddingInline', rawValue], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null]],
|
|
102
|
+
paddingBlock: rawValue => [['paddingBlock', rawValue], ['paddingTop', null], ['paddingBottom', null]],
|
|
103
|
+
paddingInlineStart: value => [['paddingInlineStart', value], ['paddingLeft', null], ['paddingRight', null]],
|
|
104
|
+
paddingInlineEnd: value => [['paddingInlineEnd', value], ['paddingLeft', null], ['paddingRight', null]],
|
|
105
|
+
paddingLeft: value => [['paddingLeft', value], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
|
|
106
|
+
paddingRight: value => [['paddingRight', value], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
|
|
107
|
+
placeContent: value => [['placeContent', value], ['alignContent', null], ['justifyContent', null]],
|
|
108
|
+
placeItems: value => [['placeItems', value], ['alignItems', null], ['justifyItems', null]],
|
|
109
|
+
placeSelf: value => [['placeSelf', value], ['alignSelf', null], ['justifySelf', null]],
|
|
110
|
+
scrollMargin: value => [['scrollMargin', value], ...shorthands.scrollMarginBlock(null), ...shorthands.scrollMarginInline(null)],
|
|
111
|
+
scrollMarginBlock: value => [['scrollMarginBlock', value], ['scrollMarginTop', null], ['scrollMarginBottom', null]],
|
|
112
|
+
scrollMarginInline: value => [['scrollMarginInline', value], ['scrollMarginInlineStart', null], ['scrollMarginInlineEnd', null], ['scrollMarginLeft', null], ['scrollMarginRight', null]],
|
|
113
|
+
scrollMarginInlineStart: value => [['scrollMarginInlineStart', value], ['scrollMarginLeft', null], ['scrollMarginRight', null]],
|
|
114
|
+
scrollMarginInlineEnd: value => [['scrollMarginInlineEnd', value], ['scrollMarginLeft', null], ['scrollMarginRight', null]],
|
|
115
|
+
scrollMarginLeft: value => [['scrollMarginLeft', value], ['scrollMarginInlineStart', null], ['scrollMarginInlineEnd', null]],
|
|
116
|
+
scrollMarginRight: value => [['scrollMarginRight', value], ['scrollMarginInlineStart', null], ['scrollMarginInlineEnd', null]],
|
|
117
|
+
scrollPadding: value => [['scrollPadding', value], ...shorthands.scrollPaddingBlock(null), ...shorthands.scrollPaddingInline(null)],
|
|
118
|
+
scrollPaddingBlock: value => [['scrollPaddingBlock', value], ['scrollPaddingTop', null], ['scrollPaddingBottom', null]],
|
|
119
|
+
scrollPaddingInline: value => [['scrollPaddingInline', value], ['scrollPaddingInlineStart', null], ['scrollPaddingInlineEnd', null], ['scrollPaddingLeft', null], ['scrollPaddingRight', null]],
|
|
120
|
+
scrollPaddingInlineStart: value => [['scrollPaddingInlineStart', value], ['scrollPaddingLeft', null], ['scrollPaddingRight', null]],
|
|
121
|
+
scrollPaddingInlineEnd: value => [['scrollPaddingInlineEnd', value], ['scrollPaddingLeft', null], ['scrollPaddingRight', null]],
|
|
122
|
+
scrollPaddingLeft: value => [['scrollPaddingLeft', value], ['scrollPaddingInlineStart', null], ['scrollPaddingInlineEnd', null]],
|
|
123
|
+
scrollPaddingRight: value => [['scrollPaddingRight', value], ['scrollPaddingInlineStart', null], ['scrollPaddingInlineEnd', null]],
|
|
124
|
+
scrollSnapType: value => [['scrollSnapType', value], ['scrollSnapTypeX', null], ['scrollSnapTypeY', null]],
|
|
125
|
+
scrollTimeline: value => [['scrollTimeline', value], ['scrollTimelineName', null], ['scrollTimelineAxis', null]],
|
|
126
|
+
textDecoration: value => [['textDecoration', value], ['textDecorationColor', null], ['textDecorationLine', null], ['textDecorationStyle', null], ['textDecorationThickness', null]],
|
|
127
|
+
textEmphasis: value => [['textEmphasis', value], ['textEmphasisColor', null], ['textEmphasisStyle', null]],
|
|
128
|
+
transition: value => [['transition', value], ['transitionBehavior', null], ['transitionDelay', null], ['transitionDuration', null], ['transitionProperty', null], ['transitionTimingFunction', null]]
|
|
129
|
+
};
|
|
130
|
+
const aliases = {
|
|
131
|
+
borderHorizontal: shorthands.borderInline,
|
|
132
|
+
borderVertical: shorthands.borderBlock,
|
|
133
|
+
borderBlockStart: shorthands.borderTop,
|
|
134
|
+
borderEnd: shorthands.borderInlineEnd,
|
|
135
|
+
borderBlockEnd: shorthands.borderBottom,
|
|
136
|
+
borderStart: shorthands.borderInlineStart,
|
|
137
|
+
blockSize: val => [['height', val]],
|
|
138
|
+
inlineSize: val => [['width', val]],
|
|
139
|
+
minBlockSize: val => [['minHeight', val]],
|
|
140
|
+
minInlineSize: val => [['minWidth', val]],
|
|
141
|
+
maxBlockSize: val => [['maxHeight', val]],
|
|
142
|
+
maxInlineSize: val => [['maxWidth', val]],
|
|
143
|
+
borderHorizontalWidth: shorthands.borderInlineWidth,
|
|
144
|
+
borderHorizontalStyle: shorthands.borderInlineStyle,
|
|
145
|
+
borderHorizontalColor: shorthands.borderInlineColor,
|
|
146
|
+
borderVerticalWidth: shorthands.borderBlockWidth,
|
|
147
|
+
borderVerticalStyle: shorthands.borderBlockStyle,
|
|
148
|
+
borderVerticalColor: shorthands.borderBlockColor,
|
|
149
|
+
borderBlockStartColor: value => [['borderTopColor', value]],
|
|
150
|
+
borderBlockEndColor: value => [['borderBottomColor', value]],
|
|
151
|
+
borderBlockStartStyle: value => [['borderTopStyle', value]],
|
|
152
|
+
borderBlockEndStyle: value => [['borderBottomStyle', value]],
|
|
153
|
+
borderBlockStartWidth: value => [['borderTopWidth', value]],
|
|
154
|
+
borderBlockEndWidth: value => [['borderBottomWidth', value]],
|
|
155
|
+
borderStartColor: shorthands.borderInlineStartColor,
|
|
156
|
+
borderEndColor: shorthands.borderInlineEndColor,
|
|
157
|
+
borderStartStyle: shorthands.borderInlineStartStyle,
|
|
158
|
+
borderEndStyle: shorthands.borderInlineEndStyle,
|
|
159
|
+
borderStartWidth: shorthands.borderInlineStartWidth,
|
|
160
|
+
borderEndWidth: shorthands.borderInlineEndWidth,
|
|
161
|
+
borderTopStartRadius: value => [['borderStartStartRadius', value]],
|
|
162
|
+
borderTopEndRadius: value => [['borderStartEndRadius', value]],
|
|
163
|
+
borderBottomStartRadius: value => [['borderEndStartRadius', value]],
|
|
164
|
+
borderBottomEndRadius: value => [['borderEndEndRadius', value]],
|
|
165
|
+
containIntrinsicBlockSize: value => [['containIntrinsicHeight', value]],
|
|
166
|
+
containIntrinsicInlineSize: value => [['containIntrinsicWidth', value]],
|
|
167
|
+
gridGap: shorthands.gap,
|
|
168
|
+
gridRowGap: value => [['rowGap', value]],
|
|
169
|
+
gridColumnGap: value => [['columnGap', value]],
|
|
170
|
+
marginBlockStart: value => [['marginTop', value]],
|
|
171
|
+
marginBlockEnd: value => [['marginBottom', value]],
|
|
172
|
+
marginStart: shorthands.marginInlineStart,
|
|
173
|
+
marginEnd: shorthands.marginInlineEnd,
|
|
174
|
+
marginHorizontal: shorthands.marginInline,
|
|
175
|
+
marginVertical: shorthands.marginBlock,
|
|
176
|
+
overflowBlock: value => [['overflowY', value]],
|
|
177
|
+
overflowInline: value => [['overflowX', value]],
|
|
178
|
+
paddingBlockStart: rawValue => [['paddingTop', rawValue]],
|
|
179
|
+
paddingBlockEnd: rawValue => [['paddingBottom', rawValue]],
|
|
180
|
+
paddingStart: shorthands.paddingInlineStart,
|
|
181
|
+
paddingEnd: shorthands.paddingInlineEnd,
|
|
182
|
+
paddingHorizontal: shorthands.paddingInline,
|
|
183
|
+
paddingVertical: shorthands.paddingBlock,
|
|
184
|
+
scrollMarginBlockStart: value => [['scrollMarginTop', value]],
|
|
185
|
+
scrollMarginBlockEnd: value => [['scrollMarginBottom', value]],
|
|
186
|
+
insetBlockStart: value => [['top', value]],
|
|
187
|
+
insetBlockEnd: value => [['bottom', value]],
|
|
188
|
+
start: shorthands.insetInlineStart,
|
|
189
|
+
end: shorthands.insetInlineEnd
|
|
190
|
+
};
|
|
191
|
+
const expansions = {
|
|
192
|
+
...shorthands,
|
|
193
|
+
...aliases
|
|
194
|
+
};
|
|
195
|
+
var _default = exports.default = expansions;
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
/**
|
|
13
|
+
* Shorthand properties:
|
|
14
|
+
* - [x] all - Should be banned
|
|
15
|
+
* - [x] animation
|
|
16
|
+
* - [x] background
|
|
17
|
+
* - [x] border
|
|
18
|
+
* - [x] border-block-end
|
|
19
|
+
* - [x] border-block-start
|
|
20
|
+
* - [x] border-bottom
|
|
21
|
+
* - [x] border-color
|
|
22
|
+
* - [x] border-image
|
|
23
|
+
* - [x] border-inline-end
|
|
24
|
+
* - [x] border-inline-start
|
|
25
|
+
* - [x] border-left
|
|
26
|
+
* - [x] border-radius
|
|
27
|
+
* - [x] corner-shape
|
|
28
|
+
* - [x] border-right
|
|
29
|
+
* - [x] border-style
|
|
30
|
+
* - [x] border-top
|
|
31
|
+
* - [x] border-width
|
|
32
|
+
* - [x] column-rule
|
|
33
|
+
* - [x] columns
|
|
34
|
+
* - [x] container
|
|
35
|
+
* - [x] flex
|
|
36
|
+
* - [x] flex-flow
|
|
37
|
+
* - [x] font
|
|
38
|
+
* - [x] gap
|
|
39
|
+
* - [x] grid
|
|
40
|
+
* - [x] grid-area
|
|
41
|
+
* - [x] grid-column
|
|
42
|
+
* - [x] grid-row
|
|
43
|
+
* - [x] grid-template
|
|
44
|
+
* - [x] inset
|
|
45
|
+
* - [x] inset-block
|
|
46
|
+
* - [x] inset-inline
|
|
47
|
+
* - [x] list-style
|
|
48
|
+
* - [x] margin
|
|
49
|
+
* - [x] mask
|
|
50
|
+
* - [x] offset
|
|
51
|
+
* - [x] outline
|
|
52
|
+
* - [x] overflow
|
|
53
|
+
* - [x] padding
|
|
54
|
+
* - [x] place-content
|
|
55
|
+
* - [x] place-items
|
|
56
|
+
* - [x] place-self
|
|
57
|
+
* - [x] scroll-margin
|
|
58
|
+
* - [x] scroll-padding
|
|
59
|
+
* - [x] text-decoration
|
|
60
|
+
* - [x] text-emphasis
|
|
61
|
+
* - [x] transition
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
|
|
65
|
+
|
|
66
|
+
declare const shorthands: $ReadOnly<{
|
|
67
|
+
[key: string]: (TStyleValue) => TReturn,
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
declare const aliases: {
|
|
71
|
+
// @Deprecated
|
|
72
|
+
borderHorizontal: typeof shorthands.borderInline,
|
|
73
|
+
// @Deprecated
|
|
74
|
+
borderVertical: typeof shorthands.borderBlock,
|
|
75
|
+
// @Deprecated
|
|
76
|
+
borderBlockStart: typeof shorthands.borderTop,
|
|
77
|
+
// @Deprecated
|
|
78
|
+
borderEnd: typeof shorthands.borderInlineEnd,
|
|
79
|
+
// @Deprecated
|
|
80
|
+
borderBlockEnd: typeof shorthands.borderBottom,
|
|
81
|
+
// @Deprecated
|
|
82
|
+
borderStart: typeof shorthands.borderInlineStart,
|
|
83
|
+
blockSize: (val: TStyleValue) => TReturn,
|
|
84
|
+
inlineSize: (val: TStyleValue) => TReturn,
|
|
85
|
+
minBlockSize: (val: TStyleValue) => TReturn,
|
|
86
|
+
minInlineSize: (val: TStyleValue) => TReturn,
|
|
87
|
+
maxBlockSize: (val: TStyleValue) => TReturn,
|
|
88
|
+
maxInlineSize: (val: TStyleValue) => TReturn,
|
|
89
|
+
borderHorizontalWidth: typeof shorthands.borderInlineWidth,
|
|
90
|
+
borderHorizontalStyle: typeof shorthands.borderInlineStyle,
|
|
91
|
+
borderHorizontalColor: typeof shorthands.borderInlineColor,
|
|
92
|
+
borderVerticalWidth: typeof shorthands.borderBlockWidth,
|
|
93
|
+
borderVerticalStyle: typeof shorthands.borderBlockStyle,
|
|
94
|
+
borderVerticalColor: typeof shorthands.borderBlockColor,
|
|
95
|
+
borderBlockStartColor: (value: TStyleValue) => TReturn,
|
|
96
|
+
borderBlockEndColor: (value: TStyleValue) => TReturn,
|
|
97
|
+
borderBlockStartStyle: (value: TStyleValue) => TReturn,
|
|
98
|
+
borderBlockEndStyle: (value: TStyleValue) => TReturn,
|
|
99
|
+
borderBlockStartWidth: (value: TStyleValue) => TReturn,
|
|
100
|
+
borderBlockEndWidth: (value: TStyleValue) => TReturn,
|
|
101
|
+
borderStartColor: typeof shorthands.borderInlineStartColor,
|
|
102
|
+
borderEndColor: typeof shorthands.borderInlineEndColor,
|
|
103
|
+
borderStartStyle: typeof shorthands.borderInlineStartStyle,
|
|
104
|
+
borderEndStyle: typeof shorthands.borderInlineEndStyle,
|
|
105
|
+
borderStartWidth: typeof shorthands.borderInlineStartWidth,
|
|
106
|
+
borderEndWidth: typeof shorthands.borderInlineEndWidth,
|
|
107
|
+
borderTopStartRadius: (value: TStyleValue) => TReturn,
|
|
108
|
+
borderTopEndRadius: (value: TStyleValue) => TReturn,
|
|
109
|
+
borderBottomStartRadius: (value: TStyleValue) => TReturn,
|
|
110
|
+
borderBottomEndRadius: (value: TStyleValue) => TReturn,
|
|
111
|
+
containIntrinsicBlockSize: (value: TStyleValue) => TReturn,
|
|
112
|
+
containIntrinsicInlineSize: (value: TStyleValue) => TReturn,
|
|
113
|
+
gridGap: typeof shorthands.gap,
|
|
114
|
+
gridRowGap: (value: TStyleValue) => TReturn,
|
|
115
|
+
gridColumnGap: (value: TStyleValue) => TReturn,
|
|
116
|
+
marginBlockStart: (value: TStyleValue) => TReturn,
|
|
117
|
+
marginBlockEnd: (value: TStyleValue) => TReturn,
|
|
118
|
+
marginStart: typeof shorthands.marginInlineStart,
|
|
119
|
+
marginEnd: typeof shorthands.marginInlineEnd,
|
|
120
|
+
marginHorizontal: typeof shorthands.marginInline,
|
|
121
|
+
marginVertical: typeof shorthands.marginBlock,
|
|
122
|
+
overflowBlock: (value: TStyleValue) => TReturn,
|
|
123
|
+
overflowInline: (value: TStyleValue) => TReturn,
|
|
124
|
+
paddingBlockStart: (rawValue: TStyleValue) => TReturn,
|
|
125
|
+
paddingBlockEnd: (rawValue: TStyleValue) => TReturn,
|
|
126
|
+
paddingStart: typeof shorthands.paddingInlineStart,
|
|
127
|
+
paddingEnd: typeof shorthands.paddingInlineEnd,
|
|
128
|
+
paddingHorizontal: typeof shorthands.paddingInline,
|
|
129
|
+
paddingVertical: typeof shorthands.paddingBlock,
|
|
130
|
+
scrollMarginBlockStart: (value: TStyleValue) => TReturn,
|
|
131
|
+
scrollMarginBlockEnd: (value: TStyleValue) => TReturn,
|
|
132
|
+
insetBlockStart: (value: TStyleValue) => TReturn,
|
|
133
|
+
insetBlockEnd: (value: TStyleValue) => TReturn,
|
|
134
|
+
start: typeof shorthands.insetInlineStart,
|
|
135
|
+
end: typeof shorthands.insetInlineEnd,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
declare export default $ReadOnly<{
|
|
139
|
+
...typeof shorthands,
|
|
140
|
+
...typeof aliases,
|
|
141
|
+
}>;
|
|
@@ -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
|
+
export declare function validateNamespace(
|
|
11
|
+
namespace: unknown,
|
|
12
|
+
conditions?: ReadonlyArray<string>,
|
|
13
|
+
): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateNamespace = validateNamespace;
|
|
7
|
+
var messages = _interopRequireWildcard(require("../messages"));
|
|
8
|
+
var _objectUtils = require("../utils/object-utils");
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
function validateNamespace(namespace, conditions = []) {
|
|
11
|
+
if (!(0, _objectUtils.isPlainObject)(namespace)) {
|
|
12
|
+
throw new Error(messages.ILLEGAL_NAMESPACE_VALUE);
|
|
13
|
+
}
|
|
14
|
+
const ns = namespace;
|
|
15
|
+
for (const key in ns) {
|
|
16
|
+
const val = ns[key];
|
|
17
|
+
if (val === null || typeof val === 'string' || typeof val === 'number') {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(val)) {
|
|
21
|
+
for (const v of val) {
|
|
22
|
+
if (v === null || typeof v === 'string' || typeof v === 'number') {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
throw new Error(messages.ILLEGAL_PROP_ARRAY_VALUE);
|
|
26
|
+
}
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if ((0, _objectUtils.isPlainObject)(val)) {
|
|
30
|
+
if (key.startsWith('@') || key.startsWith(':') || key.startsWith('[')) {
|
|
31
|
+
if (conditions.includes(key)) {
|
|
32
|
+
throw new Error(messages.DUPLICATE_CONDITIONAL);
|
|
33
|
+
}
|
|
34
|
+
validateNamespace(val, [...conditions, key]);
|
|
35
|
+
} else {
|
|
36
|
+
validateConditionalStyles(val);
|
|
37
|
+
}
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
throw new Error(messages.ILLEGAL_PROP_VALUE);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function validateConditionalStyles(val, conditions = []) {
|
|
44
|
+
for (const key in val) {
|
|
45
|
+
const v = val[key];
|
|
46
|
+
if (!(key.startsWith('@') || key.startsWith(':') || key.startsWith('[') || key.startsWith('var(--') || key === 'default')) {
|
|
47
|
+
throw new Error(messages.INVALID_PSEUDO_OR_AT_RULE);
|
|
48
|
+
}
|
|
49
|
+
if (conditions.includes(key)) {
|
|
50
|
+
throw new Error(messages.DUPLICATE_CONDITIONAL);
|
|
51
|
+
}
|
|
52
|
+
if (v === null || typeof v === 'string' || typeof v === 'number') {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(v)) {
|
|
56
|
+
for (const vv of v) {
|
|
57
|
+
if (vv === null || typeof vv === 'string' || typeof vv === 'number') {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
throw new Error(messages.ILLEGAL_PROP_VALUE);
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if ((0, _objectUtils.isPlainObject)(v)) {
|
|
65
|
+
validateConditionalStyles(v, [...conditions, key]);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
throw new Error(messages.ILLEGAL_PROP_VALUE);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare export function validateNamespace(
|
|
11
|
+
namespace: mixed,
|
|
12
|
+
conditions?: $ReadOnlyArray<string>,
|
|
13
|
+
): void;
|
|
@@ -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
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { RawStyles, StyleXOptions } from '../common-types';
|
|
11
|
+
import { type AnyPreRule, type IPreRule } from './PreRule';
|
|
12
|
+
export declare function flattenRawStyleObject(
|
|
13
|
+
style: RawStyles,
|
|
14
|
+
options: StyleXOptions,
|
|
15
|
+
): ReadonlyArray<Readonly<[string, IPreRule]>>;
|
|
16
|
+
export declare function _flattenRawStyleObject(
|
|
17
|
+
style: RawStyles,
|
|
18
|
+
keyPath: ReadonlyArray<string>,
|
|
19
|
+
options: StyleXOptions,
|
|
20
|
+
): Array<Readonly<[string, AnyPreRule]>>;
|