@stylexjs/babel-plugin 0.2.0-beta.11 → 0.2.0-beta.13
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 +36 -115
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -453,8 +453,8 @@ Object.defineProperty(splitCssValue, "__esModule", {
|
|
|
453
453
|
value: true
|
|
454
454
|
});
|
|
455
455
|
splitCssValue.default = splitValue;
|
|
456
|
-
var _postcssValueParser$
|
|
457
|
-
function _interopRequireDefault$
|
|
456
|
+
var _postcssValueParser$6 = _interopRequireDefault$i(require$$0);
|
|
457
|
+
function _interopRequireDefault$i(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
458
458
|
/**
|
|
459
459
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
460
460
|
*
|
|
@@ -487,7 +487,7 @@ function splitValue(str) {
|
|
|
487
487
|
if (Array.isArray(str)) {
|
|
488
488
|
return str;
|
|
489
489
|
}
|
|
490
|
-
const parsed = (0, _postcssValueParser$
|
|
490
|
+
const parsed = (0, _postcssValueParser$6.default)(str.trim());
|
|
491
491
|
const nodes = parsed.nodes.filter(node => node.type !== 'space' && node.type !== 'div').map(printNode);
|
|
492
492
|
if (nodes.length > 1 && nodes[nodes.length - 1].toLowerCase() === '!important') {
|
|
493
493
|
return nodes.slice(0, nodes.length - 1).map(node => node + ' !important');
|
|
@@ -499,8 +499,8 @@ Object.defineProperty(applicationOrder, "__esModule", {
|
|
|
499
499
|
value: true
|
|
500
500
|
});
|
|
501
501
|
applicationOrder.default = void 0;
|
|
502
|
-
var _splitCssValue$2 = _interopRequireDefault$
|
|
503
|
-
function _interopRequireDefault$
|
|
502
|
+
var _splitCssValue$2 = _interopRequireDefault$h(splitCssValue);
|
|
503
|
+
function _interopRequireDefault$h(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
504
504
|
/**
|
|
505
505
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
506
506
|
*
|
|
@@ -759,101 +759,18 @@ Object.defineProperty(legacyExpandShorthands, "__esModule", {
|
|
|
759
759
|
value: true
|
|
760
760
|
});
|
|
761
761
|
legacyExpandShorthands.default = void 0;
|
|
762
|
-
var _splitCssValue$1 = _interopRequireDefault$
|
|
763
|
-
function _interopRequireDefault$
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
// const parts = splitValue(rawValue);
|
|
773
|
-
// const [width, style, color] = borderDetector(parts);
|
|
774
|
-
|
|
775
|
-
// return [
|
|
776
|
-
// ...(width != null ? expansions.borderWidth(width) : []),
|
|
777
|
-
// ...(style != null ? expansions.borderStyle(style) : []),
|
|
778
|
-
// ...(color != null ? expansions.borderColor(color) : []),
|
|
779
|
-
// ];
|
|
780
|
-
// },
|
|
781
|
-
// borderTop: (rawValue: TStyleValue): TReturn => {
|
|
782
|
-
// if (typeof rawValue === 'number') {
|
|
783
|
-
// return [['borderTopWidth', rawValue]];
|
|
784
|
-
// }
|
|
785
|
-
// const parts = splitValue(rawValue);
|
|
786
|
-
// const [width, style, color] = borderDetector(parts);
|
|
787
|
-
|
|
788
|
-
// return [
|
|
789
|
-
// width != null ? ['borderTopWidth', width] : null,
|
|
790
|
-
// style != null ? ['borderTopStyle', style] : null,
|
|
791
|
-
// color != null ? ['borderTopColor', color] : null,
|
|
792
|
-
// ].filter(Boolean);
|
|
793
|
-
// },
|
|
794
|
-
// borderEnd: (rawValue: TStyleValue): TReturn => {
|
|
795
|
-
// if (typeof rawValue === 'number') {
|
|
796
|
-
// return [['borderEndWidth', rawValue]];
|
|
797
|
-
// }
|
|
798
|
-
|
|
799
|
-
// const parts = splitValue(rawValue);
|
|
800
|
-
// const [width, style, color] = borderDetector(parts);
|
|
801
|
-
|
|
802
|
-
// return [
|
|
803
|
-
// width != null ? ['borderEndWidth', width] : null,
|
|
804
|
-
// style != null ? ['borderEndStyle', style] : null,
|
|
805
|
-
// color != null ? ['borderEndColor', color] : null,
|
|
806
|
-
// ].filter(Boolean);
|
|
807
|
-
// },
|
|
808
|
-
// borderRight: (rawValue: TStyleValue): TReturn => {
|
|
809
|
-
// if (typeof rawValue === 'number') {
|
|
810
|
-
// return [['borderRightWidth', rawValue]];
|
|
811
|
-
// }
|
|
812
|
-
// const parts = splitValue(rawValue);
|
|
813
|
-
// const [width, style, color] = borderDetector(parts);
|
|
814
|
-
// return [
|
|
815
|
-
// width != null ? ['borderRightWidth', width] : null,
|
|
816
|
-
// style != null ? ['borderRightStyle', style] : null,
|
|
817
|
-
// color != null ? ['borderRightColor', color] : null,
|
|
818
|
-
// ].filter(Boolean);
|
|
819
|
-
// },
|
|
820
|
-
// borderBottom: (rawValue: TStyleValue): TReturn => {
|
|
821
|
-
// if (typeof rawValue === 'number') {
|
|
822
|
-
// return [['borderBottomWidth', rawValue]];
|
|
823
|
-
// }
|
|
824
|
-
// const parts = splitValue(rawValue);
|
|
825
|
-
// const [width, style, color] = borderDetector(parts);
|
|
826
|
-
// return [
|
|
827
|
-
// width != null ? ['borderBottomWidth', width] : null,
|
|
828
|
-
// style != null ? ['borderBottomStyle', style] : null,
|
|
829
|
-
// color != null ? ['borderBottomColor', color] : null,
|
|
830
|
-
// ].filter(Boolean);
|
|
831
|
-
// },
|
|
832
|
-
// borderStart: (rawValue: TStyleValue): TReturn => {
|
|
833
|
-
// if (typeof rawValue === 'number') {
|
|
834
|
-
// return [['borderStartWidth', rawValue]];
|
|
835
|
-
// }
|
|
836
|
-
// const parts = splitValue(rawValue);
|
|
837
|
-
// const [width, style, color] = borderDetector(parts);
|
|
838
|
-
// return [
|
|
839
|
-
// width != null ? ['borderStartWidth', width] : null,
|
|
840
|
-
// style != null ? ['borderStartStyle', style] : null,
|
|
841
|
-
// color != null ? ['borderStartColor', color] : null,
|
|
842
|
-
// ].filter(Boolean);
|
|
843
|
-
// },
|
|
844
|
-
// borderLeft: (rawValue: TStyleValue): TReturn => {
|
|
845
|
-
// if (typeof rawValue === 'number') {
|
|
846
|
-
// return [['borderLeftWidth', rawValue]];
|
|
847
|
-
// }
|
|
848
|
-
// const parts = splitValue(rawValue);
|
|
849
|
-
// const [width, style, color] = borderDetector(parts);
|
|
850
|
-
// return [
|
|
851
|
-
// width != null ? ['borderLeftWidth', width] : null,
|
|
852
|
-
// style != null ? ['borderLeftStyle', style] : null,
|
|
853
|
-
// color != null ? ['borderLeftColor', color] : null,
|
|
854
|
-
// ].filter(Boolean);
|
|
855
|
-
// },
|
|
762
|
+
var _splitCssValue$1 = _interopRequireDefault$g(splitCssValue);
|
|
763
|
+
function _interopRequireDefault$g(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
764
|
+
/**
|
|
765
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
766
|
+
*
|
|
767
|
+
* This source code is licensed under the MIT license found in the
|
|
768
|
+
* LICENSE file in the root directory of this source tree.
|
|
769
|
+
*
|
|
770
|
+
*
|
|
771
|
+
*/
|
|
856
772
|
|
|
773
|
+
const expansions$2 = {
|
|
857
774
|
border: rawValue => {
|
|
858
775
|
return [['borderTop', rawValue], ['borderEnd', rawValue], ['borderBottom', rawValue], ['borderStart', rawValue]];
|
|
859
776
|
},
|
|
@@ -923,8 +840,8 @@ Object.defineProperty(propertySpecificity, "__esModule", {
|
|
|
923
840
|
value: true
|
|
924
841
|
});
|
|
925
842
|
propertySpecificity.default = void 0;
|
|
926
|
-
var _splitCssValue = _interopRequireDefault$
|
|
927
|
-
function _interopRequireDefault$
|
|
843
|
+
var _splitCssValue = _interopRequireDefault$f(splitCssValue);
|
|
844
|
+
function _interopRequireDefault$f(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
928
845
|
/**
|
|
929
846
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
930
847
|
*
|
|
@@ -1058,10 +975,10 @@ Object.defineProperty(preprocessRules, "__esModule", {
|
|
|
1058
975
|
});
|
|
1059
976
|
preprocessRules.default = flatMapExpandedShorthands;
|
|
1060
977
|
preprocessRules.getExpandedKeys = getExpandedKeys;
|
|
1061
|
-
var _applicationOrder = _interopRequireDefault$
|
|
1062
|
-
var _legacyExpandShorthands = _interopRequireDefault$
|
|
1063
|
-
var _propertySpecificity = _interopRequireDefault$
|
|
1064
|
-
function _interopRequireDefault$
|
|
978
|
+
var _applicationOrder = _interopRequireDefault$e(applicationOrder);
|
|
979
|
+
var _legacyExpandShorthands = _interopRequireDefault$e(legacyExpandShorthands);
|
|
980
|
+
var _propertySpecificity = _interopRequireDefault$e(propertySpecificity);
|
|
981
|
+
function _interopRequireDefault$e(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1065
982
|
/**
|
|
1066
983
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1067
984
|
*
|
|
@@ -1179,6 +1096,8 @@ var transformValue$1 = {};
|
|
|
1179
1096
|
|
|
1180
1097
|
var normalizeValue$1 = {};
|
|
1181
1098
|
|
|
1099
|
+
var fontSizePxToRem = {};
|
|
1100
|
+
|
|
1182
1101
|
/**
|
|
1183
1102
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1184
1103
|
*
|
|
@@ -1188,7 +1107,12 @@ var normalizeValue$1 = {};
|
|
|
1188
1107
|
*
|
|
1189
1108
|
*/
|
|
1190
1109
|
|
|
1191
|
-
|
|
1110
|
+
Object.defineProperty(fontSizePxToRem, "__esModule", {
|
|
1111
|
+
value: true
|
|
1112
|
+
});
|
|
1113
|
+
fontSizePxToRem.default = convertFontSizeToRem;
|
|
1114
|
+
var _postcssValueParser$5 = _interopRequireDefault$d(require$$0);
|
|
1115
|
+
function _interopRequireDefault$d(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1192
1116
|
const ROOT_FONT_SIZE = 16;
|
|
1193
1117
|
|
|
1194
1118
|
/**
|
|
@@ -1196,7 +1120,7 @@ const ROOT_FONT_SIZE = 16;
|
|
|
1196
1120
|
* This will allow developers to continue thinking and using what's familiar
|
|
1197
1121
|
* while we output font sizes that are adjustable
|
|
1198
1122
|
*/
|
|
1199
|
-
|
|
1123
|
+
function convertFontSizeToRem(ast, key) {
|
|
1200
1124
|
if (key !== 'fontSize') {
|
|
1201
1125
|
return ast;
|
|
1202
1126
|
}
|
|
@@ -1204,13 +1128,13 @@ var fontSizePxToRem = function convertFontSizeToRem(ast, key) {
|
|
|
1204
1128
|
if (node.type !== 'word') {
|
|
1205
1129
|
return;
|
|
1206
1130
|
}
|
|
1207
|
-
const dimension =
|
|
1131
|
+
const dimension = _postcssValueParser$5.default.unit(node.value);
|
|
1208
1132
|
if (dimension && dimension.unit === 'px') {
|
|
1209
1133
|
node.value = `${parseFloat(dimension.number) / ROOT_FONT_SIZE}rem`;
|
|
1210
1134
|
}
|
|
1211
1135
|
});
|
|
1212
1136
|
return ast;
|
|
1213
|
-
}
|
|
1137
|
+
}
|
|
1214
1138
|
|
|
1215
1139
|
var leadingZero = {};
|
|
1216
1140
|
|
|
@@ -3768,10 +3692,7 @@ stylex$1.stylex = void 0;
|
|
|
3768
3692
|
var _stylexInject = _interopRequireDefault(stylexInject);
|
|
3769
3693
|
var _styleq = require$$1;
|
|
3770
3694
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
3771
|
-
function spread() {
|
|
3772
|
-
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3773
|
-
styles[_key] = arguments[_key];
|
|
3774
|
-
}
|
|
3695
|
+
function spread(styles, _options) {
|
|
3775
3696
|
const [className, style] = (0, _styleq.styleq)(styles);
|
|
3776
3697
|
return {
|
|
3777
3698
|
className,
|
|
@@ -3803,8 +3724,8 @@ const UNSUPPORTED_PROPERTY = _props => {
|
|
|
3803
3724
|
};
|
|
3804
3725
|
stylex$1.UNSUPPORTED_PROPERTY = UNSUPPORTED_PROPERTY;
|
|
3805
3726
|
function _stylex() {
|
|
3806
|
-
for (var
|
|
3807
|
-
styles[
|
|
3727
|
+
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3728
|
+
styles[_key] = arguments[_key];
|
|
3808
3729
|
}
|
|
3809
3730
|
const [className] = (0, _styleq.styleq)(styles);
|
|
3810
3731
|
return className;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/babel-plugin",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.13",
|
|
4
4
|
"description": "StyleX babel plugin.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": "https://github.com/facebook/stylex",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"test": "jest"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@stylexjs/shared": "0.2.0-beta.
|
|
14
|
+
"@stylexjs/shared": "0.2.0-beta.13"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@babel/core": "^7.19.6",
|