@stylexjs/babel-plugin 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +25 -5
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -2158,11 +2158,11 @@ longHandLogical.add('border-block-width');
|
|
|
2158
2158
|
shorthandsOfLonghands.add('border-block-start');
|
|
2159
2159
|
shorthandsOfLonghands.add('border-top');
|
|
2160
2160
|
longHandLogical.add('border-block-start-color');
|
|
2161
|
-
|
|
2161
|
+
longHandPhysical.add('border-top-color');
|
|
2162
2162
|
longHandLogical.add('border-block-start-style');
|
|
2163
|
-
|
|
2163
|
+
longHandPhysical.add('border-top-style');
|
|
2164
2164
|
longHandLogical.add('border-block-start-width');
|
|
2165
|
-
|
|
2165
|
+
longHandPhysical.add('border-top-width');
|
|
2166
2166
|
shorthandsOfLonghands.add('border-block-end');
|
|
2167
2167
|
shorthandsOfLonghands.add('border-bottom');
|
|
2168
2168
|
longHandLogical.add('border-block-end-color');
|
|
@@ -3494,11 +3494,25 @@ Object.defineProperty(stylexFirstThatWorks$1, "__esModule", {
|
|
|
3494
3494
|
value: true
|
|
3495
3495
|
});
|
|
3496
3496
|
stylexFirstThatWorks$1.default = stylexFirstThatWorks;
|
|
3497
|
+
const isVar = arg => typeof arg === 'string' && arg.match(/^var\(--[a-zA-Z0-9-_]+\)$/);
|
|
3497
3498
|
function stylexFirstThatWorks() {
|
|
3498
3499
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3499
3500
|
args[_key] = arguments[_key];
|
|
3500
3501
|
}
|
|
3501
|
-
|
|
3502
|
+
const firstVar = args.findIndex(isVar);
|
|
3503
|
+
if (firstVar === -1) {
|
|
3504
|
+
return [...args].reverse();
|
|
3505
|
+
}
|
|
3506
|
+
const priorities = args.slice(0, firstVar).reverse();
|
|
3507
|
+
const rest = args.slice(firstVar);
|
|
3508
|
+
const firstNonVar = rest.findIndex(arg => !isVar(arg));
|
|
3509
|
+
const varParts = rest.slice(0, firstNonVar === -1 ? rest.length : firstNonVar + 1).reverse();
|
|
3510
|
+
const vars = varParts.map(arg => isVar(arg) ? arg.slice(4, -1) : arg);
|
|
3511
|
+
const returnValue = [vars.reduce((soFar, varName) => soFar ? `var(${varName}, ${String(soFar)})` : varName.startsWith('--') ? `var(${varName})` : varName, ''), ...priorities];
|
|
3512
|
+
if (returnValue.length === 1) {
|
|
3513
|
+
return returnValue[0];
|
|
3514
|
+
}
|
|
3515
|
+
return returnValue;
|
|
3502
3516
|
}
|
|
3503
3517
|
|
|
3504
3518
|
var fileBasedIdentifier = {};
|
|
@@ -3660,10 +3674,13 @@ function evaluateImportedFile(filePath, namedExport, state) {
|
|
|
3660
3674
|
}
|
|
3661
3675
|
function evaluateThemeRef(fileName, exportName, state) {
|
|
3662
3676
|
const resolveKey = key => {
|
|
3677
|
+
if (key.startsWith('--')) {
|
|
3678
|
+
return `var(${key})`;
|
|
3679
|
+
}
|
|
3663
3680
|
const strToHash = key === '__themeName__' ? utils_1.genFileBasedIdentifier({
|
|
3664
3681
|
fileName,
|
|
3665
3682
|
exportName
|
|
3666
|
-
}) :
|
|
3683
|
+
}) : utils_1.genFileBasedIdentifier({
|
|
3667
3684
|
fileName,
|
|
3668
3685
|
exportName,
|
|
3669
3686
|
key
|
|
@@ -4059,6 +4076,9 @@ function _evaluate(path, state) {
|
|
|
4059
4076
|
if ((isStringLiteral(object) || isNumericLiteral(object)) && isIdentifier(property)) {
|
|
4060
4077
|
const val = object.node.value;
|
|
4061
4078
|
func = val[property.node.name];
|
|
4079
|
+
if (typeof val === 'string') {
|
|
4080
|
+
context = object.node.value;
|
|
4081
|
+
}
|
|
4062
4082
|
}
|
|
4063
4083
|
if (func == null) {
|
|
4064
4084
|
const parsedObj = evaluate(object, state.traversalState, state.functions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/babel-plugin",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "StyleX babel plugin.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": "https://github.com/facebook/stylex",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/helper-module-imports": "^7.22.15",
|
|
17
|
-
"@stylexjs/shared": "0.7.
|
|
18
|
-
"@stylexjs/stylex": "0.7.
|
|
17
|
+
"@stylexjs/shared": "0.7.5",
|
|
18
|
+
"@stylexjs/stylex": "0.7.5",
|
|
19
19
|
"@babel/core": "^7.23.6",
|
|
20
20
|
"@babel/traverse": "^7.23.6",
|
|
21
21
|
"@babel/types": "^7.23.6"
|