@stylexjs/babel-plugin 0.13.1 → 0.14.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/README.md +1 -1
- package/lib/index.js +528 -175
- package/lib/shared/common-types.d.ts +1 -0
- package/lib/shared/common-types.js.flow +1 -0
- package/lib/shared/messages.d.ts +1 -0
- package/lib/shared/messages.js.flow +2 -0
- package/lib/shared/physical-rtl/generate-ltr.d.ts +2 -0
- package/lib/shared/physical-rtl/generate-ltr.js.flow +2 -0
- package/lib/shared/physical-rtl/generate-rtl.d.ts +2 -0
- package/lib/shared/physical-rtl/generate-rtl.js.flow +2 -0
- package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +6 -14
- package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +6 -14
- package/lib/shared/stylex-view-transition-class.d.ts +22 -0
- package/lib/shared/stylex-view-transition-class.js.flow +23 -0
- package/lib/shared/utils/generate-css-rule.d.ts +2 -1
- package/lib/shared/utils/generate-css-rule.js.flow +2 -2
- package/lib/utils/state-manager.d.ts +5 -2
- package/lib/utils/state-manager.js.flow +3 -1
- package/lib/visitors/stylex-view-transition-class.d.ts +17 -0
- package/lib/visitors/stylex-view-transition-class.js.flow +22 -0
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -720,6 +720,7 @@ class StateManager {
|
|
|
720
720
|
stylexDefineConstsImport = (() => new Set())();
|
|
721
721
|
stylexCreateThemeImport = (() => new Set())();
|
|
722
722
|
stylexTypesImport = (() => new Set())();
|
|
723
|
+
stylexViewTransitionClassImport = (() => new Set())();
|
|
723
724
|
injectImportInserted = null;
|
|
724
725
|
styleMap = (() => new Map())();
|
|
725
726
|
styleVars = (() => new Map())();
|
|
@@ -739,13 +740,14 @@ class StateManager {
|
|
|
739
740
|
const enableFontSizePxToRem = logAndDefault(boolean(), options.enableFontSizePxToRem ?? false, false, 'options.enableFontSizePxToRem');
|
|
740
741
|
const enableInlinedConditionalMerge = logAndDefault(boolean(), options.enableInlinedConditionalMerge ?? true, true, 'options.enableInlinedConditionalMerge');
|
|
741
742
|
const enableMinifiedKeys = logAndDefault(boolean(), options.enableMinifiedKeys ?? true, true, 'options.enableMinifiedKeys');
|
|
743
|
+
const enableLogicalStylesPolyfill = logAndDefault(boolean(), options.enableLogicalStylesPolyfill ?? false, false, 'options.enableLogicalStylesPolyfill');
|
|
742
744
|
const test = logAndDefault(boolean(), options.test ?? false, false, 'options.test');
|
|
743
745
|
const configRuntimeInjection = logAndDefault(checkRuntimeInjection, options.runtimeInjection ?? false, false, 'options.runtimeInjection');
|
|
744
746
|
const runtimeInjection = configRuntimeInjection === true ? DEFAULT_INJECT_PATH : configRuntimeInjection === false ? undefined : configRuntimeInjection;
|
|
745
747
|
const classNamePrefix = logAndDefault(string(), options.classNamePrefix ?? 'x', 'x', 'options.classNamePrefix');
|
|
746
748
|
const configuredImportSources = logAndDefault(checkImportSources, options.importSources ?? [], [], 'options.importSources');
|
|
747
749
|
const importSources = [name, 'stylex', ...configuredImportSources];
|
|
748
|
-
const styleResolution = logAndDefault(unionOf3(literal('application-order'), literal('property-specificity'), literal('legacy-expand-shorthands')), options.styleResolution ?? '
|
|
750
|
+
const styleResolution = logAndDefault(unionOf3(literal('application-order'), literal('property-specificity'), literal('legacy-expand-shorthands')), options.styleResolution ?? 'property-specificity', 'property-specificity', 'options.styleResolution');
|
|
749
751
|
const unstable_moduleResolution = logAndDefault(unionOf(nullish(), CheckModuleResolution), options.unstable_moduleResolution, null, 'options.unstable_moduleResolution');
|
|
750
752
|
const treeshakeCompensation = logAndDefault(boolean(), options.treeshakeCompensation ?? false, false, 'options.treeshakeCompensation');
|
|
751
753
|
const aliasesOption = logAndDefault(unionOf(nullish(), objectOf(unionOf(string(), array(string())))), options.aliases, null, 'options.aliases');
|
|
@@ -768,6 +770,7 @@ class StateManager {
|
|
|
768
770
|
enableFontSizePxToRem,
|
|
769
771
|
enableInlinedConditionalMerge,
|
|
770
772
|
enableMinifiedKeys,
|
|
773
|
+
enableLogicalStylesPolyfill,
|
|
771
774
|
importSources,
|
|
772
775
|
rewriteAliases: typeof options.rewriteAliases === 'boolean' ? options.rewriteAliases : false,
|
|
773
776
|
runtimeInjection,
|
|
@@ -1140,6 +1143,9 @@ function readImportDeclarations(path, state) {
|
|
|
1140
1143
|
if (importedName === 'positionTry') {
|
|
1141
1144
|
state.stylexPositionTryImport.add(localName);
|
|
1142
1145
|
}
|
|
1146
|
+
if (importedName === 'viewTransitionClass') {
|
|
1147
|
+
state.stylexViewTransitionClassImport.add(localName);
|
|
1148
|
+
}
|
|
1143
1149
|
if (importedName === 'include') {
|
|
1144
1150
|
state.stylexIncludeImport.add(localName);
|
|
1145
1151
|
}
|
|
@@ -1194,6 +1200,9 @@ function readRequires(path, state) {
|
|
|
1194
1200
|
if (prop.key.name === 'positionTry') {
|
|
1195
1201
|
state.stylexPositionTryImport.add(value.name);
|
|
1196
1202
|
}
|
|
1203
|
+
if (prop.key.name === 'viewTransitionClass') {
|
|
1204
|
+
state.stylexViewTransitionClassImport.add(value.name);
|
|
1205
|
+
}
|
|
1197
1206
|
if (prop.key.name === 'include') {
|
|
1198
1207
|
state.stylexIncludeImport.add(value.name);
|
|
1199
1208
|
}
|
|
@@ -1266,10 +1275,12 @@ const defaultOptions = {
|
|
|
1266
1275
|
dev: false,
|
|
1267
1276
|
debug: false,
|
|
1268
1277
|
enableDebugClassNames: true,
|
|
1278
|
+
enableDevClassNames: false,
|
|
1269
1279
|
enableDebugDataProp: true,
|
|
1270
|
-
enableFontSizePxToRem:
|
|
1280
|
+
enableFontSizePxToRem: false,
|
|
1281
|
+
enableLogicalStylesPolyfill: false,
|
|
1271
1282
|
enableMinifiedKeys: true,
|
|
1272
|
-
styleResolution: '
|
|
1283
|
+
styleResolution: 'property-specificity',
|
|
1273
1284
|
test: false
|
|
1274
1285
|
};
|
|
1275
1286
|
|
|
@@ -2068,35 +2079,35 @@ function splitValue(str) {
|
|
|
2068
2079
|
|
|
2069
2080
|
const shorthands$1 = {
|
|
2070
2081
|
border: rawValue => {
|
|
2071
|
-
return [['borderTop', rawValue], ['
|
|
2082
|
+
return [['borderTop', rawValue], ['borderInlineEnd', rawValue], ['borderBottom', rawValue], ['borderInlineStart', rawValue]];
|
|
2072
2083
|
},
|
|
2073
2084
|
borderColor: rawValue => {
|
|
2074
2085
|
const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
|
|
2075
|
-
return [['borderTopColor', top], ['
|
|
2086
|
+
return [['borderTopColor', top], ['borderInlineEndColor', right], ['borderBottomColor', bottom], ['borderInlineStartColor', left]];
|
|
2076
2087
|
},
|
|
2077
2088
|
borderHorizontal: rawValue => {
|
|
2078
|
-
return [['
|
|
2089
|
+
return [['borderInlineStart', rawValue], ['borderInlineEnd', rawValue]];
|
|
2079
2090
|
},
|
|
2080
2091
|
borderStyle: rawValue => {
|
|
2081
2092
|
const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
|
|
2082
|
-
return [['borderTopStyle', top], ['
|
|
2093
|
+
return [['borderTopStyle', top], ['borderInlineEndStyle', right], ['borderBottomStyle', bottom], ['borderInlineStartStyle', left]];
|
|
2083
2094
|
},
|
|
2084
2095
|
borderVertical: rawValue => {
|
|
2085
2096
|
return [['borderTop', rawValue], ['borderBottom', rawValue]];
|
|
2086
2097
|
},
|
|
2087
2098
|
borderWidth: rawValue => {
|
|
2088
2099
|
const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
|
|
2089
|
-
return [['borderTopWidth', top], ['
|
|
2100
|
+
return [['borderTopWidth', top], ['borderInlineEndWidth', right], ['borderBottomWidth', bottom], ['borderInlineStartWidth', left]];
|
|
2090
2101
|
},
|
|
2091
|
-
borderHorizontalColor: rawValue => [['
|
|
2092
|
-
borderHorizontalStyle: rawValue => [['
|
|
2093
|
-
borderHorizontalWidth: rawValue => [['
|
|
2102
|
+
borderHorizontalColor: rawValue => [['borderInlineStartColor', rawValue], ['borderInlineEndColor', rawValue]],
|
|
2103
|
+
borderHorizontalStyle: rawValue => [['borderInlineStartStyle', rawValue], ['borderInlineEndStyle', rawValue]],
|
|
2104
|
+
borderHorizontalWidth: rawValue => [['borderInlineStartWidth', rawValue], ['borderInlineEndWidth', rawValue]],
|
|
2094
2105
|
borderVerticalColor: rawValue => [['borderTopColor', rawValue], ['borderBottomColor', rawValue]],
|
|
2095
2106
|
borderVerticalStyle: rawValue => [['borderTopStyle', rawValue], ['borderBottomStyle', rawValue]],
|
|
2096
2107
|
borderVerticalWidth: rawValue => [['borderTopWidth', rawValue], ['borderBottomWidth', rawValue]],
|
|
2097
2108
|
borderRadius: rawValue => {
|
|
2098
2109
|
const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
|
|
2099
|
-
return [['
|
|
2110
|
+
return [['borderStartStartRadius', top], ['borderStartEndRadius', right], ['borderEndEndRadius', bottom], ['borderEndStartRadius', left]];
|
|
2100
2111
|
},
|
|
2101
2112
|
containIntrinsicSize: rawValue => {
|
|
2102
2113
|
const parts = splitValue(rawValue);
|
|
@@ -2109,26 +2120,26 @@ const shorthands$1 = {
|
|
|
2109
2120
|
}, []);
|
|
2110
2121
|
return [['containIntrinsicWidth', width], ['containIntrinsicHeight', height]];
|
|
2111
2122
|
},
|
|
2112
|
-
inset: rawValue => [['top', rawValue], ['
|
|
2123
|
+
inset: rawValue => [['top', rawValue], ['insetInlineEnd', rawValue], ['bottom', rawValue], ['insetInlineStart', rawValue]],
|
|
2113
2124
|
insetInline: rawValue => [...shorthands$1.start(rawValue), ...shorthands$1.end(rawValue)],
|
|
2114
2125
|
insetBlock: rawValue => [['top', rawValue], ['bottom', rawValue]],
|
|
2115
|
-
start: rawValue => [['
|
|
2116
|
-
end: rawValue => [['
|
|
2117
|
-
left: rawValue => [['left', rawValue], ['
|
|
2118
|
-
right: rawValue => [['right', rawValue], ['
|
|
2126
|
+
start: rawValue => [['insetInlineStart', rawValue], ['left', null], ['right', null]],
|
|
2127
|
+
end: rawValue => [['insetInlineEnd', rawValue], ['left', null], ['right', null]],
|
|
2128
|
+
left: rawValue => [['left', rawValue], ['insetInlineStart', null], ['insetInlineEnd', null]],
|
|
2129
|
+
right: rawValue => [['right', rawValue], ['insetInlineStart', null], ['insetInlineEnd', null]],
|
|
2119
2130
|
gap: rawValue => {
|
|
2120
2131
|
const [row, column = row] = splitValue(rawValue);
|
|
2121
2132
|
return [['rowGap', row], ['columnGap', column]];
|
|
2122
2133
|
},
|
|
2123
2134
|
margin: rawValue => {
|
|
2124
2135
|
const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
|
|
2125
|
-
return [['marginTop', top], ['
|
|
2136
|
+
return [['marginTop', top], ['marginInlineEnd', right], ['marginBottom', bottom], ['marginInlineStart', left]];
|
|
2126
2137
|
},
|
|
2127
2138
|
marginHorizontal: rawValue => [...shorthands$1.marginStart(rawValue), ...shorthands$1.marginEnd(rawValue)],
|
|
2128
|
-
marginStart: rawValue => [['
|
|
2129
|
-
marginEnd: rawValue => [['
|
|
2130
|
-
marginLeft: rawValue => [['marginLeft', rawValue], ['
|
|
2131
|
-
marginRight: rawValue => [['marginRight', rawValue], ['
|
|
2139
|
+
marginStart: rawValue => [['marginInlineStart', rawValue], ['marginLeft', null], ['marginRight', null]],
|
|
2140
|
+
marginEnd: rawValue => [['marginInlineEnd', rawValue], ['marginLeft', null], ['marginRight', null]],
|
|
2141
|
+
marginLeft: rawValue => [['marginLeft', rawValue], ['marginInlineStart', null], ['marginInlineEnd', null]],
|
|
2142
|
+
marginRight: rawValue => [['marginRight', rawValue], ['marginInlineStart', null], ['marginInlineEnd', null]],
|
|
2132
2143
|
marginVertical: rawValue => {
|
|
2133
2144
|
return [['marginTop', rawValue], ['marginBottom', rawValue]];
|
|
2134
2145
|
},
|
|
@@ -2138,13 +2149,13 @@ const shorthands$1 = {
|
|
|
2138
2149
|
},
|
|
2139
2150
|
padding: rawValue => {
|
|
2140
2151
|
const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
|
|
2141
|
-
return [['paddingTop', top], ['
|
|
2152
|
+
return [['paddingTop', top], ['paddingInlineEnd', right], ['paddingBottom', bottom], ['paddingInlineStart', left]];
|
|
2142
2153
|
},
|
|
2143
2154
|
paddingHorizontal: val => [...shorthands$1.paddingStart(val), ...shorthands$1.paddingEnd(val)],
|
|
2144
|
-
paddingStart: val => [['
|
|
2145
|
-
paddingEnd: val => [['
|
|
2155
|
+
paddingStart: val => [['paddingInlineStart', val], ['paddingLeft', null], ['paddingRight', null]],
|
|
2156
|
+
paddingEnd: val => [['paddingInlineEnd', val], ['paddingLeft', null], ['paddingRight', null]],
|
|
2146
2157
|
paddingLeft: val => [['paddingLeft', val], ['paddingStart', null], ['paddingEnd', null]],
|
|
2147
|
-
paddingRight: val => [['paddingRight', val], ['
|
|
2158
|
+
paddingRight: val => [['paddingRight', val], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
|
|
2148
2159
|
paddingVertical: val => [['paddingTop', val], ['paddingBottom', val]]
|
|
2149
2160
|
};
|
|
2150
2161
|
const aliases$1 = {
|
|
@@ -2158,6 +2169,8 @@ const aliases$1 = {
|
|
|
2158
2169
|
minInlineSize: val => [['minWidth', val]],
|
|
2159
2170
|
maxBlockSize: val => [['maxHeight', val]],
|
|
2160
2171
|
maxInlineSize: val => [['maxWidth', val]],
|
|
2172
|
+
borderStart: val => [['borderInlineStart', val]],
|
|
2173
|
+
borderEnd: val => [['borderInlineEnd', val]],
|
|
2161
2174
|
borderBlockWidth: shorthands$1.borderVerticalWidth,
|
|
2162
2175
|
borderBlockStyle: shorthands$1.borderVerticalStyle,
|
|
2163
2176
|
borderBlockColor: shorthands$1.borderVerticalColor,
|
|
@@ -2170,16 +2183,10 @@ const aliases$1 = {
|
|
|
2170
2183
|
borderInlineWidth: shorthands$1.borderHorizontalWidth,
|
|
2171
2184
|
borderInlineStyle: shorthands$1.borderHorizontalStyle,
|
|
2172
2185
|
borderInlineColor: shorthands$1.borderHorizontalColor,
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
borderInlineEndStyle: val => [['borderEndStyle', val]],
|
|
2178
|
-
borderInlineEndColor: val => [['borderEndColor', val]],
|
|
2179
|
-
borderStartStartRadius: val => [['borderTopStartRadius', val]],
|
|
2180
|
-
borderStartEndRadius: val => [['borderTopEndRadius', val]],
|
|
2181
|
-
borderEndStartRadius: val => [['borderBottomStartRadius', val]],
|
|
2182
|
-
borderEndEndRadius: val => [['borderBottomEndRadius', val]],
|
|
2186
|
+
borderTopStartRadius: val => [['borderStartStartRadius', val]],
|
|
2187
|
+
borderTopEndRadius: val => [['borderStartEndRadius', val]],
|
|
2188
|
+
borderBottomStartRadius: val => [['borderEndStartRadius', val]],
|
|
2189
|
+
borderBottomEndRadius: val => [['borderEndEndRadius', val]],
|
|
2183
2190
|
gridGap: shorthands$1.gap,
|
|
2184
2191
|
gridRowGap: value => [['rowGap', value]],
|
|
2185
2192
|
gridColumnGap: value => [['columnGap', value]],
|
|
@@ -2187,16 +2194,12 @@ const aliases$1 = {
|
|
|
2187
2194
|
marginBlockStart: val => [['marginTop', val]],
|
|
2188
2195
|
marginBlockEnd: val => [['marginBottom', val]],
|
|
2189
2196
|
marginInline: shorthands$1.marginHorizontal,
|
|
2190
|
-
marginInlineStart: val => [['marginStart', val]],
|
|
2191
|
-
marginInlineEnd: val => [['marginEnd', val]],
|
|
2192
2197
|
overflowBlock: value => [['overflowY', value]],
|
|
2193
2198
|
overflowInline: value => [['overflowX', value]],
|
|
2194
2199
|
paddingBlock: shorthands$1.paddingVertical,
|
|
2195
2200
|
paddingBlockStart: val => [['paddingTop', val]],
|
|
2196
2201
|
paddingBlockEnd: val => [['paddingBottom', val]],
|
|
2197
2202
|
paddingInline: shorthands$1.paddingHorizontal,
|
|
2198
|
-
paddingInlineStart: val => [['paddingStart', val]],
|
|
2199
|
-
paddingInlineEnd: val => [['paddingEnd', val]],
|
|
2200
2203
|
scrollMarginBlockStart: value => [['scrollMarginTop', value]],
|
|
2201
2204
|
scrollMarginBlockEnd: value => [['scrollMarginBottom', value]]
|
|
2202
2205
|
};
|
|
@@ -2316,7 +2319,7 @@ function flatMapExpandedShorthands(objEntry, options) {
|
|
|
2316
2319
|
if (key.startsWith('var(') && key.endsWith(')')) {
|
|
2317
2320
|
key = key.slice(4, -1);
|
|
2318
2321
|
}
|
|
2319
|
-
const expansion = expansions[options.styleResolution ?? '
|
|
2322
|
+
const expansion = expansions[options.styleResolution ?? 'property-specificity'][key];
|
|
2320
2323
|
if (expansion) {
|
|
2321
2324
|
if (Array.isArray(value)) {
|
|
2322
2325
|
throw new Error('Cannot use fallbacks for shorthands. Use the expansion instead.');
|
|
@@ -2497,6 +2500,7 @@ const ONLY_NAMED_PARAMETERS_IN_DYNAMIC_STYLE_FUNCTIONS = 'Only named parameters
|
|
|
2497
2500
|
const ONLY_TOP_LEVEL = 'create() is only allowed at the root of a program.';
|
|
2498
2501
|
const UNKNOWN_PROP_KEY = 'Unknown property key';
|
|
2499
2502
|
const POSITION_TRY_INVALID_PROPERTY = 'Invalid property in `positionTry()` call. It may only contain, positionAnchor, positionArea, inset properties (top, left, insetInline etc.), margin properties, size properties (height, inlineSize, etc.), and self-alignment properties (alignSelf, justifySelf, placeSelf)';
|
|
2503
|
+
const VIEW_TRANSITION_CLASS_INVALID_PROPERTY = 'Invalid property in `viewTransitionClass()` call. It may only contain group, imagePair, old, and new properties';
|
|
2500
2504
|
|
|
2501
2505
|
var m = /*#__PURE__*/Object.freeze({
|
|
2502
2506
|
__proto__: null,
|
|
@@ -2518,6 +2522,7 @@ var m = /*#__PURE__*/Object.freeze({
|
|
|
2518
2522
|
ONLY_TOP_LEVEL: ONLY_TOP_LEVEL,
|
|
2519
2523
|
POSITION_TRY_INVALID_PROPERTY: POSITION_TRY_INVALID_PROPERTY,
|
|
2520
2524
|
UNKNOWN_PROP_KEY: UNKNOWN_PROP_KEY,
|
|
2525
|
+
VIEW_TRANSITION_CLASS_INVALID_PROPERTY: VIEW_TRANSITION_CLASS_INVALID_PROPERTY,
|
|
2521
2526
|
illegalArgumentLength: illegalArgumentLength,
|
|
2522
2527
|
nonExportNamedDeclaration: nonExportNamedDeclaration,
|
|
2523
2528
|
nonStaticValue: nonStaticValue,
|
|
@@ -2606,100 +2611,202 @@ const lengthUnits = new Set(['backgroundPositionX', 'backgroundPositionY', 'bloc
|
|
|
2606
2611
|
|
|
2607
2612
|
const logicalToPhysical$1 = {
|
|
2608
2613
|
start: 'left',
|
|
2609
|
-
end: 'right'
|
|
2614
|
+
end: 'right',
|
|
2615
|
+
'inline-start': 'left',
|
|
2616
|
+
'inline-end': 'right'
|
|
2617
|
+
};
|
|
2618
|
+
const legacyValuesPolyfill$1 = {
|
|
2619
|
+
float: _ref => {
|
|
2620
|
+
let [key, val] = _ref;
|
|
2621
|
+
return [key, logicalToPhysical$1[val] ?? val];
|
|
2622
|
+
},
|
|
2623
|
+
clear: _ref2 => {
|
|
2624
|
+
let [key, val] = _ref2;
|
|
2625
|
+
return [key, logicalToPhysical$1[val] ?? val];
|
|
2626
|
+
}
|
|
2627
|
+
};
|
|
2628
|
+
const inlinePropertyToLTR = {
|
|
2629
|
+
'margin-inline-start': _ref3 => {
|
|
2630
|
+
let [_key, val] = _ref3;
|
|
2631
|
+
return ['margin-left', val];
|
|
2632
|
+
},
|
|
2633
|
+
'margin-inline-end': _ref4 => {
|
|
2634
|
+
let [_key, val] = _ref4;
|
|
2635
|
+
return ['margin-right', val];
|
|
2636
|
+
},
|
|
2637
|
+
'padding-inline-start': _ref5 => {
|
|
2638
|
+
let [_key, val] = _ref5;
|
|
2639
|
+
return ['padding-left', val];
|
|
2640
|
+
},
|
|
2641
|
+
'padding-inline-end': _ref6 => {
|
|
2642
|
+
let [_key, val] = _ref6;
|
|
2643
|
+
return ['padding-right', val];
|
|
2644
|
+
},
|
|
2645
|
+
'border-inline-start': _ref7 => {
|
|
2646
|
+
let [_key, val] = _ref7;
|
|
2647
|
+
return ['border-left', val];
|
|
2648
|
+
},
|
|
2649
|
+
'border-inline-end': _ref8 => {
|
|
2650
|
+
let [_key, val] = _ref8;
|
|
2651
|
+
return ['border-right', val];
|
|
2652
|
+
},
|
|
2653
|
+
'border-inline-start-width': _ref9 => {
|
|
2654
|
+
let [_key, val] = _ref9;
|
|
2655
|
+
return ['border-left-width', val];
|
|
2656
|
+
},
|
|
2657
|
+
'border-inline-end-width': _ref0 => {
|
|
2658
|
+
let [_key, val] = _ref0;
|
|
2659
|
+
return ['border-right-width', val];
|
|
2660
|
+
},
|
|
2661
|
+
'border-inline-start-color': _ref1 => {
|
|
2662
|
+
let [_key, val] = _ref1;
|
|
2663
|
+
return ['border-left-color', val];
|
|
2664
|
+
},
|
|
2665
|
+
'border-inline-end-color': _ref10 => {
|
|
2666
|
+
let [_key, val] = _ref10;
|
|
2667
|
+
return ['border-right-color', val];
|
|
2668
|
+
},
|
|
2669
|
+
'border-inline-start-style': _ref11 => {
|
|
2670
|
+
let [_key, val] = _ref11;
|
|
2671
|
+
return ['border-left-style', val];
|
|
2672
|
+
},
|
|
2673
|
+
'border-inline-end-style': _ref12 => {
|
|
2674
|
+
let [_key, val] = _ref12;
|
|
2675
|
+
return ['border-right-style', val];
|
|
2676
|
+
},
|
|
2677
|
+
'border-start-start-radius': _ref13 => {
|
|
2678
|
+
let [_key, val] = _ref13;
|
|
2679
|
+
return ['border-top-left-radius', val];
|
|
2680
|
+
},
|
|
2681
|
+
'border-end-start-radius': _ref14 => {
|
|
2682
|
+
let [_key, val] = _ref14;
|
|
2683
|
+
return ['border-bottom-left-radius', val];
|
|
2684
|
+
},
|
|
2685
|
+
'border-start-end-radius': _ref15 => {
|
|
2686
|
+
let [_key, val] = _ref15;
|
|
2687
|
+
return ['border-top-right-radius', val];
|
|
2688
|
+
},
|
|
2689
|
+
'border-end-end-radius': _ref16 => {
|
|
2690
|
+
let [_key, val] = _ref16;
|
|
2691
|
+
return ['border-bottom-right-radius', val];
|
|
2692
|
+
},
|
|
2693
|
+
'inset-inline-start': _ref17 => {
|
|
2694
|
+
let [_key, val] = _ref17;
|
|
2695
|
+
return ['left', val];
|
|
2696
|
+
},
|
|
2697
|
+
'inset-inline-end': _ref18 => {
|
|
2698
|
+
let [_key, val] = _ref18;
|
|
2699
|
+
return ['right', val];
|
|
2700
|
+
}
|
|
2610
2701
|
};
|
|
2611
2702
|
const propertyToLTR = {
|
|
2612
|
-
'margin-start':
|
|
2613
|
-
let [_key, val] =
|
|
2703
|
+
'margin-start': _ref19 => {
|
|
2704
|
+
let [_key, val] = _ref19;
|
|
2614
2705
|
return ['margin-left', val];
|
|
2615
2706
|
},
|
|
2616
|
-
'margin-end':
|
|
2617
|
-
let [_key, val] =
|
|
2707
|
+
'margin-end': _ref20 => {
|
|
2708
|
+
let [_key, val] = _ref20;
|
|
2618
2709
|
return ['margin-right', val];
|
|
2619
2710
|
},
|
|
2620
|
-
'padding-start':
|
|
2621
|
-
let [_key, val] =
|
|
2711
|
+
'padding-start': _ref21 => {
|
|
2712
|
+
let [_key, val] = _ref21;
|
|
2622
2713
|
return ['padding-left', val];
|
|
2623
2714
|
},
|
|
2624
|
-
'padding-end':
|
|
2625
|
-
let [_key, val] =
|
|
2715
|
+
'padding-end': _ref22 => {
|
|
2716
|
+
let [_key, val] = _ref22;
|
|
2626
2717
|
return ['padding-right', val];
|
|
2627
2718
|
},
|
|
2628
|
-
'border-start':
|
|
2629
|
-
let [_key, val] =
|
|
2719
|
+
'border-start': _ref23 => {
|
|
2720
|
+
let [_key, val] = _ref23;
|
|
2630
2721
|
return ['border-left', val];
|
|
2631
2722
|
},
|
|
2632
|
-
'border-end':
|
|
2633
|
-
let [_key, val] =
|
|
2723
|
+
'border-end': _ref24 => {
|
|
2724
|
+
let [_key, val] = _ref24;
|
|
2634
2725
|
return ['border-right', val];
|
|
2635
2726
|
},
|
|
2636
|
-
'border-start-width':
|
|
2637
|
-
let [_key, val] =
|
|
2727
|
+
'border-start-width': _ref25 => {
|
|
2728
|
+
let [_key, val] = _ref25;
|
|
2638
2729
|
return ['border-left-width', val];
|
|
2639
2730
|
},
|
|
2640
|
-
'border-end-width':
|
|
2641
|
-
let [_key, val] =
|
|
2731
|
+
'border-end-width': _ref26 => {
|
|
2732
|
+
let [_key, val] = _ref26;
|
|
2642
2733
|
return ['border-right-width', val];
|
|
2643
2734
|
},
|
|
2644
|
-
'border-start-color':
|
|
2645
|
-
let [_key, val] =
|
|
2735
|
+
'border-start-color': _ref27 => {
|
|
2736
|
+
let [_key, val] = _ref27;
|
|
2646
2737
|
return ['border-left-color', val];
|
|
2647
2738
|
},
|
|
2648
|
-
'border-end-color':
|
|
2649
|
-
let [_key, val] =
|
|
2739
|
+
'border-end-color': _ref28 => {
|
|
2740
|
+
let [_key, val] = _ref28;
|
|
2650
2741
|
return ['border-right-color', val];
|
|
2651
2742
|
},
|
|
2652
|
-
'border-start-style':
|
|
2653
|
-
let [_key, val] =
|
|
2743
|
+
'border-start-style': _ref29 => {
|
|
2744
|
+
let [_key, val] = _ref29;
|
|
2654
2745
|
return ['border-left-style', val];
|
|
2655
2746
|
},
|
|
2656
|
-
'border-end-style':
|
|
2657
|
-
let [_key, val] =
|
|
2747
|
+
'border-end-style': _ref30 => {
|
|
2748
|
+
let [_key, val] = _ref30;
|
|
2658
2749
|
return ['border-right-style', val];
|
|
2659
2750
|
},
|
|
2660
|
-
'border-top-start-radius':
|
|
2661
|
-
let [_key, val] =
|
|
2751
|
+
'border-top-start-radius': _ref31 => {
|
|
2752
|
+
let [_key, val] = _ref31;
|
|
2662
2753
|
return ['border-top-left-radius', val];
|
|
2663
2754
|
},
|
|
2664
|
-
'border-bottom-start-radius':
|
|
2665
|
-
let [_key, val] =
|
|
2755
|
+
'border-bottom-start-radius': _ref32 => {
|
|
2756
|
+
let [_key, val] = _ref32;
|
|
2666
2757
|
return ['border-bottom-left-radius', val];
|
|
2667
2758
|
},
|
|
2668
|
-
'border-top-end-radius':
|
|
2669
|
-
let [_key, val] =
|
|
2759
|
+
'border-top-end-radius': _ref33 => {
|
|
2760
|
+
let [_key, val] = _ref33;
|
|
2670
2761
|
return ['border-top-right-radius', val];
|
|
2671
2762
|
},
|
|
2672
|
-
'border-bottom-end-radius':
|
|
2673
|
-
let [_key, val] =
|
|
2763
|
+
'border-bottom-end-radius': _ref34 => {
|
|
2764
|
+
let [_key, val] = _ref34;
|
|
2674
2765
|
return ['border-bottom-right-radius', val];
|
|
2675
2766
|
},
|
|
2676
|
-
float:
|
|
2677
|
-
let [key, val] =
|
|
2767
|
+
float: _ref35 => {
|
|
2768
|
+
let [key, val] = _ref35;
|
|
2678
2769
|
return [key, logicalToPhysical$1[val] ?? val];
|
|
2679
2770
|
},
|
|
2680
|
-
clear:
|
|
2681
|
-
let [key, val] =
|
|
2771
|
+
clear: _ref36 => {
|
|
2772
|
+
let [key, val] = _ref36;
|
|
2682
2773
|
return [key, logicalToPhysical$1[val] ?? val];
|
|
2683
2774
|
},
|
|
2684
|
-
start:
|
|
2685
|
-
let [_key, val] =
|
|
2775
|
+
start: _ref37 => {
|
|
2776
|
+
let [_key, val] = _ref37;
|
|
2686
2777
|
return ['left', val];
|
|
2687
2778
|
},
|
|
2688
|
-
end:
|
|
2689
|
-
let [_key, val] =
|
|
2779
|
+
end: _ref38 => {
|
|
2780
|
+
let [_key, val] = _ref38;
|
|
2690
2781
|
return ['right', val];
|
|
2691
2782
|
},
|
|
2692
|
-
'background-position':
|
|
2693
|
-
let [key, val] =
|
|
2694
|
-
return [key, val.split(' ').map(word => word === 'start' ? 'left' : word === 'end' ? 'right' : word).join(' ')];
|
|
2783
|
+
'background-position': _ref39 => {
|
|
2784
|
+
let [key, val] = _ref39;
|
|
2785
|
+
return [key, val.split(' ').map(word => word === 'start' || word === 'insetInlineStart' ? 'left' : word === 'end' || word === 'insetInlineEnd' ? 'right' : word).join(' ')];
|
|
2695
2786
|
}
|
|
2696
2787
|
};
|
|
2697
2788
|
function generateLTR(pair) {
|
|
2789
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
|
|
2790
|
+
const {
|
|
2791
|
+
enableLogicalStylesPolyfill,
|
|
2792
|
+
styleResolution
|
|
2793
|
+
} = options;
|
|
2698
2794
|
const [key] = pair;
|
|
2699
|
-
if (
|
|
2700
|
-
|
|
2795
|
+
if (styleResolution === 'legacy-expand-shorthands') {
|
|
2796
|
+
if (!enableLogicalStylesPolyfill) {
|
|
2797
|
+
if (legacyValuesPolyfill$1[key]) {
|
|
2798
|
+
return legacyValuesPolyfill$1[key](pair);
|
|
2799
|
+
}
|
|
2800
|
+
return pair;
|
|
2801
|
+
}
|
|
2802
|
+
if (inlinePropertyToLTR[key]) {
|
|
2803
|
+
return inlinePropertyToLTR[key](pair);
|
|
2804
|
+
}
|
|
2701
2805
|
}
|
|
2702
|
-
|
|
2806
|
+
if (!propertyToLTR[key]) {
|
|
2807
|
+
return pair;
|
|
2808
|
+
}
|
|
2809
|
+
return propertyToLTR[key](pair);
|
|
2703
2810
|
}
|
|
2704
2811
|
|
|
2705
2812
|
const cursorFlip = {
|
|
@@ -2758,118 +2865,220 @@ function flipShadow(value) {
|
|
|
2758
2865
|
}
|
|
2759
2866
|
const logicalToPhysical = {
|
|
2760
2867
|
start: 'right',
|
|
2761
|
-
end: 'left'
|
|
2868
|
+
end: 'left',
|
|
2869
|
+
'inline-start': 'right',
|
|
2870
|
+
'inline-end': 'left'
|
|
2871
|
+
};
|
|
2872
|
+
const legacyValuesPolyfill = {
|
|
2873
|
+
float: _ref => {
|
|
2874
|
+
let [key, val] = _ref;
|
|
2875
|
+
return [key, logicalToPhysical[val] ?? val];
|
|
2876
|
+
},
|
|
2877
|
+
clear: _ref2 => {
|
|
2878
|
+
let [key, val] = _ref2;
|
|
2879
|
+
return [key, logicalToPhysical[val] ?? val];
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2882
|
+
const inlinePropertyToRTL = {
|
|
2883
|
+
'margin-inline-start': _ref3 => {
|
|
2884
|
+
let [_key, val] = _ref3;
|
|
2885
|
+
return ['margin-right', val];
|
|
2886
|
+
},
|
|
2887
|
+
'margin-inline-end': _ref4 => {
|
|
2888
|
+
let [_key, val] = _ref4;
|
|
2889
|
+
return ['margin-left', val];
|
|
2890
|
+
},
|
|
2891
|
+
'padding-inline-start': _ref5 => {
|
|
2892
|
+
let [_key, val] = _ref5;
|
|
2893
|
+
return ['padding-right', val];
|
|
2894
|
+
},
|
|
2895
|
+
'padding-inline-end': _ref6 => {
|
|
2896
|
+
let [_key, val] = _ref6;
|
|
2897
|
+
return ['padding-left', val];
|
|
2898
|
+
},
|
|
2899
|
+
'border-inline-start': _ref7 => {
|
|
2900
|
+
let [_key, val] = _ref7;
|
|
2901
|
+
return ['border-right', val];
|
|
2902
|
+
},
|
|
2903
|
+
'border-inline-end': _ref8 => {
|
|
2904
|
+
let [_key, val] = _ref8;
|
|
2905
|
+
return ['border-left', val];
|
|
2906
|
+
},
|
|
2907
|
+
'border-inline-start-width': _ref9 => {
|
|
2908
|
+
let [_key, val] = _ref9;
|
|
2909
|
+
return ['border-right-width', val];
|
|
2910
|
+
},
|
|
2911
|
+
'border-inline-end-width': _ref0 => {
|
|
2912
|
+
let [_key, val] = _ref0;
|
|
2913
|
+
return ['border-left-width', val];
|
|
2914
|
+
},
|
|
2915
|
+
'border-inline-start-color': _ref1 => {
|
|
2916
|
+
let [_key, val] = _ref1;
|
|
2917
|
+
return ['border-right-color', val];
|
|
2918
|
+
},
|
|
2919
|
+
'border-inline-end-color': _ref10 => {
|
|
2920
|
+
let [_key, val] = _ref10;
|
|
2921
|
+
return ['border-left-color', val];
|
|
2922
|
+
},
|
|
2923
|
+
'border-inline-start-style': _ref11 => {
|
|
2924
|
+
let [_key, val] = _ref11;
|
|
2925
|
+
return ['border-right-style', val];
|
|
2926
|
+
},
|
|
2927
|
+
'border-inline-end-style': _ref12 => {
|
|
2928
|
+
let [_key, val] = _ref12;
|
|
2929
|
+
return ['border-left-style', val];
|
|
2930
|
+
},
|
|
2931
|
+
'border-start-start-radius': _ref13 => {
|
|
2932
|
+
let [_key, val] = _ref13;
|
|
2933
|
+
return ['border-top-right-radius', val];
|
|
2934
|
+
},
|
|
2935
|
+
'border-end-start-radius': _ref14 => {
|
|
2936
|
+
let [_key, val] = _ref14;
|
|
2937
|
+
return ['border-bottom-right-radius', val];
|
|
2938
|
+
},
|
|
2939
|
+
'border-start-end-radius': _ref15 => {
|
|
2940
|
+
let [_key, val] = _ref15;
|
|
2941
|
+
return ['border-top-left-radius', val];
|
|
2942
|
+
},
|
|
2943
|
+
'border-end-end-radius': _ref16 => {
|
|
2944
|
+
let [_key, val] = _ref16;
|
|
2945
|
+
return ['border-bottom-left-radius', val];
|
|
2946
|
+
},
|
|
2947
|
+
'inset-inline-start': _ref17 => {
|
|
2948
|
+
let [_key, val] = _ref17;
|
|
2949
|
+
return ['right', val];
|
|
2950
|
+
},
|
|
2951
|
+
'inset-inline-end': _ref18 => {
|
|
2952
|
+
let [_key, val] = _ref18;
|
|
2953
|
+
return ['left', val];
|
|
2954
|
+
}
|
|
2762
2955
|
};
|
|
2763
2956
|
const propertyToRTL = {
|
|
2764
|
-
'margin-start':
|
|
2765
|
-
let [_key, val] =
|
|
2957
|
+
'margin-start': _ref19 => {
|
|
2958
|
+
let [_key, val] = _ref19;
|
|
2766
2959
|
return ['margin-right', val];
|
|
2767
2960
|
},
|
|
2768
|
-
'margin-end':
|
|
2769
|
-
let [_key, val] =
|
|
2961
|
+
'margin-end': _ref20 => {
|
|
2962
|
+
let [_key, val] = _ref20;
|
|
2770
2963
|
return ['margin-left', val];
|
|
2771
2964
|
},
|
|
2772
|
-
'padding-start':
|
|
2773
|
-
let [_key, val] =
|
|
2965
|
+
'padding-start': _ref21 => {
|
|
2966
|
+
let [_key, val] = _ref21;
|
|
2774
2967
|
return ['padding-right', val];
|
|
2775
2968
|
},
|
|
2776
|
-
'padding-end':
|
|
2777
|
-
let [_key, val] =
|
|
2969
|
+
'padding-end': _ref22 => {
|
|
2970
|
+
let [_key, val] = _ref22;
|
|
2778
2971
|
return ['padding-left', val];
|
|
2779
2972
|
},
|
|
2780
|
-
'border-start':
|
|
2781
|
-
let [_key, val] =
|
|
2973
|
+
'border-start': _ref23 => {
|
|
2974
|
+
let [_key, val] = _ref23;
|
|
2782
2975
|
return ['border-right', val];
|
|
2783
2976
|
},
|
|
2784
|
-
'border-end':
|
|
2785
|
-
let [_key, val] =
|
|
2977
|
+
'border-end': _ref24 => {
|
|
2978
|
+
let [_key, val] = _ref24;
|
|
2786
2979
|
return ['border-left', val];
|
|
2787
2980
|
},
|
|
2788
|
-
'border-start-width':
|
|
2789
|
-
let [_key, val] =
|
|
2981
|
+
'border-start-width': _ref25 => {
|
|
2982
|
+
let [_key, val] = _ref25;
|
|
2790
2983
|
return ['border-right-width', val];
|
|
2791
2984
|
},
|
|
2792
|
-
'border-end-width':
|
|
2793
|
-
let [_key, val] =
|
|
2985
|
+
'border-end-width': _ref26 => {
|
|
2986
|
+
let [_key, val] = _ref26;
|
|
2794
2987
|
return ['border-left-width', val];
|
|
2795
2988
|
},
|
|
2796
|
-
'border-start-color':
|
|
2797
|
-
let [_key, val] =
|
|
2989
|
+
'border-start-color': _ref27 => {
|
|
2990
|
+
let [_key, val] = _ref27;
|
|
2798
2991
|
return ['border-right-color', val];
|
|
2799
2992
|
},
|
|
2800
|
-
'border-end-color':
|
|
2801
|
-
let [_key, val] =
|
|
2993
|
+
'border-end-color': _ref28 => {
|
|
2994
|
+
let [_key, val] = _ref28;
|
|
2802
2995
|
return ['border-left-color', val];
|
|
2803
2996
|
},
|
|
2804
|
-
'border-start-style':
|
|
2805
|
-
let [_key, val] =
|
|
2997
|
+
'border-start-style': _ref29 => {
|
|
2998
|
+
let [_key, val] = _ref29;
|
|
2806
2999
|
return ['border-right-style', val];
|
|
2807
3000
|
},
|
|
2808
|
-
'border-end-style':
|
|
2809
|
-
let [_key, val] =
|
|
3001
|
+
'border-end-style': _ref30 => {
|
|
3002
|
+
let [_key, val] = _ref30;
|
|
2810
3003
|
return ['border-left-style', val];
|
|
2811
3004
|
},
|
|
2812
|
-
'border-top-start-radius':
|
|
2813
|
-
let [_key, val] =
|
|
3005
|
+
'border-top-start-radius': _ref31 => {
|
|
3006
|
+
let [_key, val] = _ref31;
|
|
2814
3007
|
return ['border-top-right-radius', val];
|
|
2815
3008
|
},
|
|
2816
|
-
'border-bottom-start-radius':
|
|
2817
|
-
let [_key, val] =
|
|
3009
|
+
'border-bottom-start-radius': _ref32 => {
|
|
3010
|
+
let [_key, val] = _ref32;
|
|
2818
3011
|
return ['border-bottom-right-radius', val];
|
|
2819
3012
|
},
|
|
2820
|
-
'border-top-end-radius':
|
|
2821
|
-
let [_key, val] =
|
|
3013
|
+
'border-top-end-radius': _ref33 => {
|
|
3014
|
+
let [_key, val] = _ref33;
|
|
2822
3015
|
return ['border-top-left-radius', val];
|
|
2823
3016
|
},
|
|
2824
|
-
'border-bottom-end-radius':
|
|
2825
|
-
let [_key, val] =
|
|
3017
|
+
'border-bottom-end-radius': _ref34 => {
|
|
3018
|
+
let [_key, val] = _ref34;
|
|
2826
3019
|
return ['border-bottom-left-radius', val];
|
|
2827
3020
|
},
|
|
2828
|
-
float:
|
|
2829
|
-
let [key, val] =
|
|
3021
|
+
float: _ref35 => {
|
|
3022
|
+
let [key, val] = _ref35;
|
|
2830
3023
|
return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
|
|
2831
3024
|
},
|
|
2832
|
-
clear:
|
|
2833
|
-
let [key, val] =
|
|
3025
|
+
clear: _ref36 => {
|
|
3026
|
+
let [key, val] = _ref36;
|
|
2834
3027
|
return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
|
|
2835
3028
|
},
|
|
2836
|
-
start:
|
|
2837
|
-
let [_key, val] =
|
|
3029
|
+
start: _ref37 => {
|
|
3030
|
+
let [_key, val] = _ref37;
|
|
2838
3031
|
return ['right', val];
|
|
2839
3032
|
},
|
|
2840
|
-
end:
|
|
2841
|
-
let [_key, val] =
|
|
3033
|
+
end: _ref38 => {
|
|
3034
|
+
let [_key, val] = _ref38;
|
|
2842
3035
|
return ['left', val];
|
|
2843
3036
|
},
|
|
2844
|
-
'background-position':
|
|
2845
|
-
let [key, val] =
|
|
3037
|
+
'background-position': _ref39 => {
|
|
3038
|
+
let [key, val] = _ref39;
|
|
2846
3039
|
const words = val.split(' ');
|
|
2847
3040
|
if (!words.includes('start') && !words.includes('end')) {
|
|
2848
3041
|
return null;
|
|
2849
3042
|
}
|
|
2850
|
-
return [key, words.map(word => word === 'start' ? 'right' : word === 'end' ? 'left' : word).join(' ')];
|
|
3043
|
+
return [key, words.map(word => word === 'start' || word === 'insetInlineStart' ? 'right' : word === 'end' || word === 'insetInlineEnd' ? 'left' : word).join(' ')];
|
|
2851
3044
|
},
|
|
2852
|
-
cursor:
|
|
2853
|
-
let [key, val] =
|
|
3045
|
+
cursor: _ref40 => {
|
|
3046
|
+
let [key, val] = _ref40;
|
|
2854
3047
|
return cursorFlip[val] != null ? [key, cursorFlip[val]] : null;
|
|
2855
3048
|
},
|
|
2856
|
-
'box-shadow':
|
|
2857
|
-
let [key, val] =
|
|
3049
|
+
'box-shadow': _ref41 => {
|
|
3050
|
+
let [key, val] = _ref41;
|
|
2858
3051
|
const rtlVal = flipShadow(val);
|
|
2859
3052
|
return rtlVal ? [key, rtlVal] : null;
|
|
2860
3053
|
},
|
|
2861
|
-
'text-shadow':
|
|
2862
|
-
let [key, val] =
|
|
3054
|
+
'text-shadow': _ref42 => {
|
|
3055
|
+
let [key, val] = _ref42;
|
|
2863
3056
|
const rtlVal = flipShadow(val);
|
|
2864
3057
|
return rtlVal ? [key, rtlVal] : null;
|
|
2865
3058
|
}
|
|
2866
3059
|
};
|
|
2867
|
-
function generateRTL(
|
|
2868
|
-
let [key, value] =
|
|
2869
|
-
|
|
2870
|
-
|
|
3060
|
+
function generateRTL(_ref43) {
|
|
3061
|
+
let [key, value] = _ref43;
|
|
3062
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
|
|
3063
|
+
const {
|
|
3064
|
+
enableLogicalStylesPolyfill,
|
|
3065
|
+
styleResolution
|
|
3066
|
+
} = options;
|
|
3067
|
+
if (styleResolution === 'legacy-expand-shorthands') {
|
|
3068
|
+
if (!enableLogicalStylesPolyfill) {
|
|
3069
|
+
if (legacyValuesPolyfill[key]) {
|
|
3070
|
+
return legacyValuesPolyfill[key]([key, value]);
|
|
3071
|
+
}
|
|
3072
|
+
return null;
|
|
3073
|
+
}
|
|
3074
|
+
if (inlinePropertyToRTL[key]) {
|
|
3075
|
+
return inlinePropertyToRTL[key]([key, value]);
|
|
3076
|
+
}
|
|
2871
3077
|
}
|
|
2872
|
-
|
|
3078
|
+
if (!propertyToRTL[key]) {
|
|
3079
|
+
return null;
|
|
3080
|
+
}
|
|
3081
|
+
return propertyToRTL[key]([key, value]);
|
|
2873
3082
|
}
|
|
2874
3083
|
|
|
2875
3084
|
const longHandPhysical = new Set();
|
|
@@ -3389,17 +3598,17 @@ function getPriority(key) {
|
|
|
3389
3598
|
const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
|
|
3390
3599
|
return PSEUDO_CLASS_PRIORITIES[prop] ?? 40;
|
|
3391
3600
|
}
|
|
3392
|
-
if (
|
|
3393
|
-
return
|
|
3394
|
-
}
|
|
3395
|
-
if (longHandLogical.has(key)) {
|
|
3396
|
-
return 3000;
|
|
3601
|
+
if (shorthandsOfShorthands.has(key)) {
|
|
3602
|
+
return 1000;
|
|
3397
3603
|
}
|
|
3398
3604
|
if (shorthandsOfLonghands.has(key)) {
|
|
3399
3605
|
return 2000;
|
|
3400
3606
|
}
|
|
3401
|
-
if (
|
|
3402
|
-
return
|
|
3607
|
+
if (longHandLogical.has(key)) {
|
|
3608
|
+
return 3000;
|
|
3609
|
+
}
|
|
3610
|
+
if (longHandPhysical.has(key)) {
|
|
3611
|
+
return 4000;
|
|
3403
3612
|
}
|
|
3404
3613
|
return 3000;
|
|
3405
3614
|
}
|
|
@@ -3415,10 +3624,11 @@ function buildNestedCSSRule(className, decls, pseudos, atRules, constRules) {
|
|
|
3415
3624
|
return combinedAtRules.reduce((acc, combinedAtRules) => `${combinedAtRules}{${acc}}`, `${selectorForAtRules}{${decls}}`);
|
|
3416
3625
|
}
|
|
3417
3626
|
function generateCSSRule(className, key, value, pseudos, atRules, constRules) {
|
|
3627
|
+
let options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : defaultOptions;
|
|
3418
3628
|
const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
|
|
3419
|
-
const ltrPairs = pairs.map(generateLTR);
|
|
3629
|
+
const ltrPairs = pairs.map(pair => generateLTR(pair, options));
|
|
3420
3630
|
const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
|
|
3421
|
-
const rtlDecls = pairs.map(generateRTL).filter(Boolean).map(pair => pair.join(':')).join(';');
|
|
3631
|
+
const rtlDecls = pairs.map(pair => generateRTL(pair, options)).filter(Boolean).map(pair => pair.join(':')).join(';');
|
|
3422
3632
|
const ltrRule = buildNestedCSSRule(className, ltrDecls, pseudos, atRules, constRules);
|
|
3423
3633
|
const rtlRule = !rtlDecls ? null : buildNestedCSSRule(className, rtlDecls, pseudos, atRules, constRules);
|
|
3424
3634
|
const priority = getPriority(key) + pseudos.map(getPriority).reduce((a, b) => a + b, 0) + atRules.map(getPriority).reduce((a, b) => a + b, 0) + constRules.map(getPriority).reduce((a, b) => a + b, 0);
|
|
@@ -3546,7 +3756,7 @@ function convertStyleToClassName(objEntry, pseudos, atRules, constRules) {
|
|
|
3546
3756
|
const valueAsString = Array.isArray(value) ? value.join(', ') : value;
|
|
3547
3757
|
const stringToHash = dashedKey + valueAsString + modifierHashString;
|
|
3548
3758
|
const className = debug && enableDebugClassNames ? `${key}-${classNamePrefix}${hash('<>' + stringToHash)}` : classNamePrefix + hash('<>' + stringToHash);
|
|
3549
|
-
const cssRules = generateCSSRule(className, dashedKey, value, pseudos, atRules, constRules);
|
|
3759
|
+
const cssRules = generateCSSRule(className, dashedKey, value, pseudos, atRules, constRules, options);
|
|
3550
3760
|
return [key, className, cssRules];
|
|
3551
3761
|
}
|
|
3552
3762
|
function variableFallbacks(values) {
|
|
@@ -4031,7 +4241,7 @@ function collectVarsByAtRule(key, _ref) {
|
|
|
4031
4241
|
return;
|
|
4032
4242
|
}
|
|
4033
4243
|
if (Array.isArray(value)) {
|
|
4034
|
-
throw new Error('Array is not supported in
|
|
4244
|
+
throw new Error('Array is not supported in defineVars');
|
|
4035
4245
|
}
|
|
4036
4246
|
if (typeof value === 'object') {
|
|
4037
4247
|
if (value.default === undefined) {
|
|
@@ -4050,7 +4260,7 @@ function wrapWithAtRules(ltr, atRule) {
|
|
|
4050
4260
|
}
|
|
4051
4261
|
function priorityForAtRule(atRule) {
|
|
4052
4262
|
if (atRule === 'default') {
|
|
4053
|
-
return
|
|
4263
|
+
return 1;
|
|
4054
4264
|
}
|
|
4055
4265
|
return atRule.split(SPLIT_TOKEN).length;
|
|
4056
4266
|
}
|
|
@@ -4062,7 +4272,7 @@ function getDefaultValue(value) {
|
|
|
4062
4272
|
return null;
|
|
4063
4273
|
}
|
|
4064
4274
|
if (Array.isArray(value)) {
|
|
4065
|
-
throw new Error('Array is not supported in
|
|
4275
|
+
throw new Error('Array is not supported in defineVars');
|
|
4066
4276
|
}
|
|
4067
4277
|
if (typeof value === 'object') {
|
|
4068
4278
|
if (value.default === undefined) {
|
|
@@ -4070,7 +4280,7 @@ function getDefaultValue(value) {
|
|
|
4070
4280
|
}
|
|
4071
4281
|
return getDefaultValue(value.default);
|
|
4072
4282
|
}
|
|
4073
|
-
throw new Error('Invalid value in
|
|
4283
|
+
throw new Error('Invalid value in defineVars');
|
|
4074
4284
|
}
|
|
4075
4285
|
|
|
4076
4286
|
function styleXDefineVars(variables, options) {
|
|
@@ -4190,7 +4400,7 @@ function styleXDefineConsts(constants, options) {
|
|
|
4190
4400
|
|
|
4191
4401
|
function styleXCreateTheme(themeVars, variables, options) {
|
|
4192
4402
|
if (typeof themeVars.__themeName__ !== 'string') {
|
|
4193
|
-
throw new Error('Can only override variables theme created with
|
|
4403
|
+
throw new Error('Can only override variables theme created with defineVars().');
|
|
4194
4404
|
}
|
|
4195
4405
|
const {
|
|
4196
4406
|
classNamePrefix
|
|
@@ -4231,8 +4441,8 @@ function styleXCreateTheme(themeVars, variables, options) {
|
|
|
4231
4441
|
}
|
|
4232
4442
|
const themeClass = `${overrideClassName} ${themeVars.__themeName__}`;
|
|
4233
4443
|
return [{
|
|
4234
|
-
|
|
4235
|
-
|
|
4444
|
+
[themeVars.__themeName__]: themeClass,
|
|
4445
|
+
$$css: true
|
|
4236
4446
|
}, stylesToInject];
|
|
4237
4447
|
}
|
|
4238
4448
|
|
|
@@ -4252,7 +4462,7 @@ function styleXKeyframes(frames) {
|
|
|
4252
4462
|
return [animationName, {
|
|
4253
4463
|
ltr,
|
|
4254
4464
|
rtl,
|
|
4255
|
-
priority:
|
|
4465
|
+
priority: 0
|
|
4256
4466
|
}];
|
|
4257
4467
|
}
|
|
4258
4468
|
function expandFrameShorthands(frame, options) {
|
|
@@ -4282,7 +4492,7 @@ function styleXPositionTry(styles) {
|
|
|
4282
4492
|
const {
|
|
4283
4493
|
classNamePrefix = 'x'
|
|
4284
4494
|
} = options;
|
|
4285
|
-
const expandedObject = Pipe.create(styles).pipe(styles => preprocessProperties(styles, options)).pipe(x => objMapKeys(x, dashify)).pipe(x => objMap(x, (value, key) => transformValue(key, value, options))).done();
|
|
4495
|
+
const expandedObject = Pipe.create(styles).pipe(styles => preprocessProperties$1(styles, options)).pipe(x => objMapKeys(x, dashify)).pipe(x => objMap(x, (value, key) => transformValue(key, value, options))).done();
|
|
4286
4496
|
const ltrStyles = objMap(expandedObject, (value, key) => generateLTR([key, value]));
|
|
4287
4497
|
const rtlStyles = objMap(expandedObject, (value, key) => generateRTL([key, value]) ?? value);
|
|
4288
4498
|
const ltrString = constructPositionTryObj(ltrStyles);
|
|
@@ -4293,10 +4503,10 @@ function styleXPositionTry(styles) {
|
|
|
4293
4503
|
return [positionTryName, {
|
|
4294
4504
|
ltr,
|
|
4295
4505
|
rtl,
|
|
4296
|
-
priority:
|
|
4506
|
+
priority: 0
|
|
4297
4507
|
}];
|
|
4298
4508
|
}
|
|
4299
|
-
function preprocessProperties(styles, options) {
|
|
4509
|
+
function preprocessProperties$1(styles, options) {
|
|
4300
4510
|
return objFromEntries(objEntries(styles).flatMap(pair => flatMapExpandedShorthands(pair, options).map(_ref => {
|
|
4301
4511
|
let [key, value] = _ref;
|
|
4302
4512
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
@@ -4557,8 +4767,8 @@ function evaluateThemeRef(fileName, exportName, state) {
|
|
|
4557
4767
|
debug,
|
|
4558
4768
|
enableDebugClassNames
|
|
4559
4769
|
} = state.traversalState.options;
|
|
4560
|
-
const varSafeKey = (key[0] >= '0' && key[0] <= '9' ? `_${key}` : key).replace(/[^a-zA-Z0-9]/g, '_');
|
|
4561
|
-
const varName = debug && enableDebugClassNames ? varSafeKey +
|
|
4770
|
+
const varSafeKey = key === '__themeName__' ? '' : (key[0] >= '0' && key[0] <= '9' ? `_${key}` : key).replace(/[^a-zA-Z0-9]/g, '_') + '-';
|
|
4771
|
+
const varName = debug && enableDebugClassNames ? varSafeKey + state.traversalState.options.classNamePrefix + utils.hash(strToHash) : state.traversalState.options.classNamePrefix + utils.hash(strToHash);
|
|
4562
4772
|
if (key === '__themeName__') {
|
|
4563
4773
|
return varName;
|
|
4564
4774
|
}
|
|
@@ -5625,7 +5835,7 @@ function transformStyleXCreateTheme(callExpressionPath, state) {
|
|
|
5625
5835
|
throw callExpressionPath.buildCodeFrameError(messages.nonStyleObject('createTheme'), SyntaxError);
|
|
5626
5836
|
}
|
|
5627
5837
|
if (typeof variables.__themeName__ !== 'string' || variables.__themeName__ === '') {
|
|
5628
|
-
throw callExpressionPath.buildCodeFrameError('Can only override variables theme created with
|
|
5838
|
+
throw callExpressionPath.buildCodeFrameError('Can only override variables theme created with defineVars().', SyntaxError);
|
|
5629
5839
|
}
|
|
5630
5840
|
let [overridesObj, injectedStyles] = createTheme(variables, overrides, state.options);
|
|
5631
5841
|
if (state.isTest) {
|
|
@@ -5743,7 +5953,7 @@ function transformStyleXDefineVars(callExpressionPath, state) {
|
|
|
5743
5953
|
}
|
|
5744
5954
|
const fileName = state.fileNameForHashing;
|
|
5745
5955
|
if (fileName == null) {
|
|
5746
|
-
throw new Error('No filename found for generating
|
|
5956
|
+
throw new Error('No filename found for generating defineVars key name.');
|
|
5747
5957
|
}
|
|
5748
5958
|
const exportName = varId.name;
|
|
5749
5959
|
const [variablesObj, injectedStylesSansKeyframes] = defineVars(value, {
|
|
@@ -5806,7 +6016,7 @@ function transformStyleXDefineConsts(callExpressionPath, state) {
|
|
|
5806
6016
|
}
|
|
5807
6017
|
const fileName = state.fileNameForHashing;
|
|
5808
6018
|
if (fileName == null) {
|
|
5809
|
-
throw new Error('No filename found for generating
|
|
6019
|
+
throw new Error('No filename found for generating defineConsts key name.');
|
|
5810
6020
|
}
|
|
5811
6021
|
const exportName = varId.name;
|
|
5812
6022
|
const themeName = utils.genFileBasedIdentifier({
|
|
@@ -5966,7 +6176,7 @@ function transformStyleXPositionTry(path, state) {
|
|
|
5966
6176
|
}
|
|
5967
6177
|
const plainObject = value;
|
|
5968
6178
|
assertValidPositionTry(firstArgPath, plainObject);
|
|
5969
|
-
assertValidProperties(firstArgPath, plainObject);
|
|
6179
|
+
assertValidProperties$1(firstArgPath, plainObject);
|
|
5970
6180
|
const [positionTryName, {
|
|
5971
6181
|
ltr,
|
|
5972
6182
|
priority,
|
|
@@ -5985,7 +6195,7 @@ function assertValidPositionTry(path, obj) {
|
|
|
5985
6195
|
}
|
|
5986
6196
|
}
|
|
5987
6197
|
const VALID_POSITION_TRY_PROPERTIES = ['anchorName', 'positionAnchor', 'positionArea', 'top', 'right', 'bottom', 'left', 'inset', 'insetBlock', 'insetBlockEnd', 'insetBlockStart', 'insetInline', 'insetInlineEnd', 'insetInlineStart', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight', 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'blockSize', 'inlineSize', 'minBlockSize', 'minInlineSize', 'maxBlockSize', 'maxInlineSize', 'alignSelf', 'justifySelf', 'placeSelf'];
|
|
5988
|
-
function assertValidProperties(path, obj) {
|
|
6198
|
+
function assertValidProperties$1(path, obj) {
|
|
5989
6199
|
const keys = Object.keys(obj);
|
|
5990
6200
|
if (keys.some(key => !VALID_POSITION_TRY_PROPERTIES.includes(key))) {
|
|
5991
6201
|
throw path.buildCodeFrameError(POSITION_TRY_INVALID_PROPERTY, SyntaxError);
|
|
@@ -6451,6 +6661,147 @@ function isCalleeMemberExpression(path, state) {
|
|
|
6451
6661
|
return node != null && node.callee != null && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'props' && state.stylexImport.has(node.callee.object.name);
|
|
6452
6662
|
}
|
|
6453
6663
|
|
|
6664
|
+
function styleXViewTransitionClass(styles) {
|
|
6665
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
|
|
6666
|
+
const {
|
|
6667
|
+
classNamePrefix = 'x'
|
|
6668
|
+
} = options;
|
|
6669
|
+
const preprocessedObject = objMap(styles, style => Pipe.create(style).pipe(style => preprocessProperties(style, options)).pipe(x => objMapKeys(x, dashify)).pipe(x => objMap(x, (value, key) => transformValue(key, value, options))).done());
|
|
6670
|
+
const expandedObject = objMapKeys(preprocessedObject, k => `::view-transition-${dashify(k)}`);
|
|
6671
|
+
const styleStrings = objMap(expandedObject, constructViewTransitionClassStyleStr);
|
|
6672
|
+
const viewTransitionClassName = classNamePrefix + hash(constructViewTransitionClassStyleStr(styleStrings));
|
|
6673
|
+
const style = constructFinalViewTransitionCSSStr(styleStrings, viewTransitionClassName);
|
|
6674
|
+
return [viewTransitionClassName, {
|
|
6675
|
+
ltr: style,
|
|
6676
|
+
rtl: null,
|
|
6677
|
+
priority: 1
|
|
6678
|
+
}];
|
|
6679
|
+
}
|
|
6680
|
+
function preprocessProperties(styles, options) {
|
|
6681
|
+
return objFromEntries(objEntries(styles).flatMap(pair => flatMapExpandedShorthands(pair, options).map(_ref => {
|
|
6682
|
+
let [key, value] = _ref;
|
|
6683
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
6684
|
+
return [key, value];
|
|
6685
|
+
}
|
|
6686
|
+
return null;
|
|
6687
|
+
}).filter(Boolean)).filter(_ref2 => {
|
|
6688
|
+
let [_key, value] = _ref2;
|
|
6689
|
+
return value != null;
|
|
6690
|
+
}));
|
|
6691
|
+
}
|
|
6692
|
+
function constructViewTransitionClassStyleStr(style) {
|
|
6693
|
+
return objEntries(style).map(_ref3 => {
|
|
6694
|
+
let [k, v] = _ref3;
|
|
6695
|
+
return `${k}:${v};`;
|
|
6696
|
+
}).join('');
|
|
6697
|
+
}
|
|
6698
|
+
function constructFinalViewTransitionCSSStr(styles, className) {
|
|
6699
|
+
return objEntries(styles).map(_ref4 => {
|
|
6700
|
+
let [k, v] = _ref4;
|
|
6701
|
+
return `${k}(*.${className}){${v}}`;
|
|
6702
|
+
}).join('');
|
|
6703
|
+
}
|
|
6704
|
+
|
|
6705
|
+
function transformStyleXViewTransitionClass(path, state) {
|
|
6706
|
+
const initPath = path.get('init');
|
|
6707
|
+
if (!initPath.isCallExpression()) {
|
|
6708
|
+
return;
|
|
6709
|
+
}
|
|
6710
|
+
const callExpressionPath = initPath;
|
|
6711
|
+
const idPath = path.get('id');
|
|
6712
|
+
if (!idPath.isIdentifier()) {
|
|
6713
|
+
return;
|
|
6714
|
+
}
|
|
6715
|
+
const nodeInit = callExpressionPath.node;
|
|
6716
|
+
if (nodeInit.callee.type === 'Identifier' && state.stylexViewTransitionClassImport.has(nodeInit.callee.name) || nodeInit.callee.type === 'MemberExpression' && nodeInit.callee.object.type === 'Identifier' && nodeInit.callee.property.name === 'viewTransitionClass' && nodeInit.callee.property.type === 'Identifier' && state.stylexImport.has(nodeInit.callee.object.name)) {
|
|
6717
|
+
const init = path.get('init');
|
|
6718
|
+
if (init == null || !init.isCallExpression()) {
|
|
6719
|
+
throw path.buildCodeFrameError(nonStaticValue('viewTransitionClass'), SyntaxError);
|
|
6720
|
+
}
|
|
6721
|
+
if (nodeInit.arguments.length !== 1) {
|
|
6722
|
+
throw path.buildCodeFrameError(illegalArgumentLength('viewTransitionClass', 1), SyntaxError);
|
|
6723
|
+
}
|
|
6724
|
+
const args = init.get('arguments');
|
|
6725
|
+
const firstArgPath = args[0];
|
|
6726
|
+
const otherInjectedCSSRules = {};
|
|
6727
|
+
const keyframes$1 = animation => {
|
|
6728
|
+
const [animationName, injectedStyle] = keyframes(animation, state.options);
|
|
6729
|
+
otherInjectedCSSRules[animationName] = injectedStyle;
|
|
6730
|
+
return animationName;
|
|
6731
|
+
};
|
|
6732
|
+
const identifiers = {};
|
|
6733
|
+
const memberExpressions = {};
|
|
6734
|
+
state.stylexFirstThatWorksImport.forEach(name => {
|
|
6735
|
+
identifiers[name] = {
|
|
6736
|
+
fn: firstThatWorks
|
|
6737
|
+
};
|
|
6738
|
+
});
|
|
6739
|
+
state.stylexKeyframesImport.forEach(name => {
|
|
6740
|
+
identifiers[name] = {
|
|
6741
|
+
fn: keyframes$1
|
|
6742
|
+
};
|
|
6743
|
+
});
|
|
6744
|
+
state.stylexImport.forEach(name => {
|
|
6745
|
+
if (memberExpressions[name] == null) {
|
|
6746
|
+
memberExpressions[name] = {};
|
|
6747
|
+
}
|
|
6748
|
+
memberExpressions[name].firstThatWorks = {
|
|
6749
|
+
fn: firstThatWorks
|
|
6750
|
+
};
|
|
6751
|
+
memberExpressions[name].keyframes = {
|
|
6752
|
+
fn: keyframes$1
|
|
6753
|
+
};
|
|
6754
|
+
});
|
|
6755
|
+
const {
|
|
6756
|
+
confident,
|
|
6757
|
+
value
|
|
6758
|
+
} = evaluate(firstArgPath, state, {
|
|
6759
|
+
identifiers,
|
|
6760
|
+
memberExpressions
|
|
6761
|
+
});
|
|
6762
|
+
if (!confident) {
|
|
6763
|
+
throw callExpressionPath.buildCodeFrameError(nonStaticValue('viewTransitionClass'), SyntaxError);
|
|
6764
|
+
}
|
|
6765
|
+
const plainObject = value;
|
|
6766
|
+
assertValidViewTransitionClass(firstArgPath, plainObject);
|
|
6767
|
+
assertValidProperties(firstArgPath, plainObject);
|
|
6768
|
+
const [viewTransitionClassName, {
|
|
6769
|
+
ltr,
|
|
6770
|
+
priority,
|
|
6771
|
+
rtl
|
|
6772
|
+
}] = styleXViewTransitionClass(plainObject, state.options);
|
|
6773
|
+
init.replaceWith(t__namespace.stringLiteral(viewTransitionClassName));
|
|
6774
|
+
const injectedStyles = {
|
|
6775
|
+
...otherInjectedCSSRules,
|
|
6776
|
+
[viewTransitionClassName]: {
|
|
6777
|
+
priority,
|
|
6778
|
+
ltr,
|
|
6779
|
+
rtl
|
|
6780
|
+
}
|
|
6781
|
+
};
|
|
6782
|
+
const listOfStyles = Object.entries(injectedStyles).map(_ref => {
|
|
6783
|
+
let [key, {
|
|
6784
|
+
priority,
|
|
6785
|
+
...rest
|
|
6786
|
+
}] = _ref;
|
|
6787
|
+
return [key, rest, priority];
|
|
6788
|
+
});
|
|
6789
|
+
state.registerStyles(listOfStyles, path);
|
|
6790
|
+
}
|
|
6791
|
+
}
|
|
6792
|
+
function assertValidViewTransitionClass(path, obj) {
|
|
6793
|
+
if (typeof obj !== 'object' || Array.isArray(obj) || obj == null) {
|
|
6794
|
+
throw path.buildCodeFrameError(nonStyleObject('viewTransitionClass'), SyntaxError);
|
|
6795
|
+
}
|
|
6796
|
+
}
|
|
6797
|
+
const VALID_VIEW_TRANSITION_CLASS_PROPERTIES = ['group', 'imagePair', 'old', 'new'];
|
|
6798
|
+
function assertValidProperties(path, obj) {
|
|
6799
|
+
const keys = Object.keys(obj);
|
|
6800
|
+
if (keys.some(key => !VALID_VIEW_TRANSITION_CLASS_PROPERTIES.includes(key))) {
|
|
6801
|
+
throw path.buildCodeFrameError(VIEW_TRANSITION_CLASS_INVALID_PROPERTY, SyntaxError);
|
|
6802
|
+
}
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6454
6805
|
const NAME = 'stylex';
|
|
6455
6806
|
function styleXTransform() {
|
|
6456
6807
|
let state;
|
|
@@ -6614,6 +6965,7 @@ function styleXTransform() {
|
|
|
6614
6965
|
const parentPath = path.parentPath;
|
|
6615
6966
|
if (parentPath.isVariableDeclarator()) {
|
|
6616
6967
|
transformStyleXKeyframes(parentPath, state);
|
|
6968
|
+
transformStyleXViewTransitionClass(parentPath, state);
|
|
6617
6969
|
transformStyleXPositionTry(parentPath, state);
|
|
6618
6970
|
}
|
|
6619
6971
|
}
|
|
@@ -6727,14 +7079,15 @@ function processStylexRules(rules) {
|
|
|
6727
7079
|
}, []);
|
|
6728
7080
|
const header = useLayers ? '\n@layer ' + grouped.map((_, index) => `priority${index + 1}`).join(', ') + ';\n' : '';
|
|
6729
7081
|
const collectedCSS = grouped.map((group, index) => {
|
|
7082
|
+
const pri = group[0][2];
|
|
6730
7083
|
const collectedCSS = Array.from(new Map(group.map(_ref8 => {
|
|
6731
7084
|
let [a, b] = _ref8;
|
|
6732
7085
|
return [a, b];
|
|
6733
|
-
})).values()).flatMap(
|
|
6734
|
-
|
|
7086
|
+
})).values()).flatMap(rule => {
|
|
7087
|
+
const {
|
|
6735
7088
|
ltr,
|
|
6736
7089
|
rtl
|
|
6737
|
-
} =
|
|
7090
|
+
} = rule;
|
|
6738
7091
|
let ltrRule = ltr,
|
|
6739
7092
|
rtlRule = rtl;
|
|
6740
7093
|
if (!useLayers) {
|
|
@@ -6743,7 +7096,7 @@ function processStylexRules(rules) {
|
|
|
6743
7096
|
}
|
|
6744
7097
|
return rtlRule ? [addAncestorSelector(ltrRule, "html:not([dir='rtl'])"), addAncestorSelector(rtlRule, "html[dir='rtl']")] : [ltrRule];
|
|
6745
7098
|
}).join('\n');
|
|
6746
|
-
return useLayers ? `@layer priority${index + 1}{\n${collectedCSS}\n}` : collectedCSS;
|
|
7099
|
+
return useLayers && pri > 0 ? `@layer priority${index + 1}{\n${collectedCSS}\n}` : collectedCSS;
|
|
6747
7100
|
}).join('\n');
|
|
6748
7101
|
return header + collectedCSS;
|
|
6749
7102
|
}
|