@tamagui/static 1.0.0-alpha.59 → 1.0.0-alpha.62
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/dist/cjs/extractor/createExtractor.js +41 -26
- package/dist/cjs/extractor/createExtractor.js.map +2 -2
- package/dist/cjs/extractor/extractToClassNames.js +3 -0
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/extractor/logLines.js +1 -1
- package/dist/cjs/extractor/logLines.js.map +2 -2
- package/dist/esm/extractor/createExtractor.js +41 -26
- package/dist/esm/extractor/createExtractor.js.map +2 -2
- package/dist/esm/extractor/extractToClassNames.js +3 -0
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/esm/extractor/logLines.js +1 -1
- package/dist/esm/extractor/logLines.js.map +2 -2
- package/dist/jsx/extractor/createExtractor.js +41 -26
- package/dist/jsx/extractor/extractToClassNames.js +3 -0
- package/dist/jsx/extractor/logLines.js +1 -1
- package/package.json +4 -4
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
|
@@ -206,9 +206,6 @@ function createExtractor() {
|
|
|
206
206
|
if (shouldPrintDebug) {
|
|
207
207
|
console.log(" staticNamespace", Object.keys(staticNamespace).join(", "));
|
|
208
208
|
}
|
|
209
|
-
const hasDeopt = /* @__PURE__ */ __name((obj) => {
|
|
210
|
-
return Object.keys(obj).some(isDeoptedProp);
|
|
211
|
-
}, "hasDeopt");
|
|
212
209
|
const flattenedAttrs = [];
|
|
213
210
|
traversePath.get("openingElement").get("attributes").forEach((path) => {
|
|
214
211
|
const attr = path.node;
|
|
@@ -391,10 +388,16 @@ function createExtractor() {
|
|
|
391
388
|
}
|
|
392
389
|
}
|
|
393
390
|
if (t.isJSXSpreadAttribute(attribute) || !attribute.name || typeof attribute.name.name !== "string") {
|
|
391
|
+
if (shouldPrintDebug) {
|
|
392
|
+
console.log(" ! inlining, spread attr");
|
|
393
|
+
}
|
|
394
394
|
inlinePropCount++;
|
|
395
395
|
return attr;
|
|
396
396
|
}
|
|
397
397
|
const name = attribute.name.name;
|
|
398
|
+
if (name.startsWith("data-")) {
|
|
399
|
+
return attr;
|
|
400
|
+
}
|
|
398
401
|
if (isExcludedProp(name)) {
|
|
399
402
|
return null;
|
|
400
403
|
}
|
|
@@ -455,7 +458,7 @@ function createExtractor() {
|
|
|
455
458
|
if (value) {
|
|
456
459
|
if (value.type === "StringLiteral" && value.value[0] === "$") {
|
|
457
460
|
if (shouldPrintDebug) {
|
|
458
|
-
console.log(`
|
|
461
|
+
console.log(` ! inlining, native disable extract: ${name} =`, value.value);
|
|
459
462
|
}
|
|
460
463
|
inlinePropCount++;
|
|
461
464
|
return attr;
|
|
@@ -471,11 +474,15 @@ function createExtractor() {
|
|
|
471
474
|
keys = Object.keys(out);
|
|
472
475
|
}
|
|
473
476
|
}
|
|
474
|
-
|
|
475
|
-
if (
|
|
476
|
-
|
|
477
|
+
for (const key of keys) {
|
|
478
|
+
if (!isStaticAttributeName(key)) {
|
|
479
|
+
if (shouldPrintDebug) {
|
|
480
|
+
console.log(" ! inlining, non-static", key);
|
|
481
|
+
}
|
|
482
|
+
inlinePropCount++;
|
|
477
483
|
}
|
|
478
|
-
|
|
484
|
+
}
|
|
485
|
+
if (inlinePropCount) {
|
|
479
486
|
return attr;
|
|
480
487
|
}
|
|
481
488
|
}
|
|
@@ -715,31 +722,33 @@ function createExtractor() {
|
|
|
715
722
|
cur.value = { [nonShortKey]: value };
|
|
716
723
|
key = nonShortKey;
|
|
717
724
|
}
|
|
725
|
+
if (!shouldFlatten) {
|
|
726
|
+
if (stylePropsTransform[key] || !validStyles[key] && !pseudos[key] && !key.startsWith("data-")) {
|
|
727
|
+
acc.push({
|
|
728
|
+
type: "attr",
|
|
729
|
+
value: t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(typeof value === "string" ? t.stringLiteral(value) : literalToAst(value)))
|
|
730
|
+
});
|
|
731
|
+
return acc;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
718
734
|
if (disableExtractVariables) {
|
|
719
735
|
if (value[0] === "$") {
|
|
720
736
|
if (shouldPrintDebug) {
|
|
721
737
|
console.log(` keeping variable inline: ${key} =`, value);
|
|
722
738
|
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
];
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
if (!validStyles[key] && !pseudos[key]) {
|
|
732
|
-
if (shouldPrintDebug) {
|
|
733
|
-
console.log(" - ignoring (expanded already):", key);
|
|
739
|
+
acc.push({
|
|
740
|
+
type: "attr",
|
|
741
|
+
value: t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(t.stringLiteral(value)))
|
|
742
|
+
});
|
|
743
|
+
return acc;
|
|
734
744
|
}
|
|
735
|
-
return acc;
|
|
736
745
|
}
|
|
737
746
|
}
|
|
738
747
|
acc.push(cur);
|
|
739
748
|
return acc;
|
|
740
749
|
}, []);
|
|
741
750
|
if (shouldPrintDebug) {
|
|
742
|
-
console.log(" - attrs (evaluated
|
|
751
|
+
console.log(" - attrs (evaluated): \n", logLines(attrs.map(attrStr).join(", ")));
|
|
743
752
|
}
|
|
744
753
|
let prev = null;
|
|
745
754
|
attrs = attrs.reduce((acc, cur) => {
|
|
@@ -766,12 +775,18 @@ function createExtractor() {
|
|
|
766
775
|
delete props2[key];
|
|
767
776
|
}
|
|
768
777
|
}
|
|
778
|
+
if (shouldPrintDebug) {
|
|
779
|
+
props2["debug"] = true;
|
|
780
|
+
}
|
|
769
781
|
const out = postProcessStyles(props2, staticConfig, defaultTheme);
|
|
782
|
+
if (shouldPrintDebug) {
|
|
783
|
+
delete props2["debug"];
|
|
784
|
+
}
|
|
770
785
|
const next = (_a2 = out == null ? void 0 : out.style) != null ? _a2 : props2;
|
|
771
786
|
if (shouldPrintDebug) {
|
|
772
|
-
console.log("
|
|
773
|
-
console.log("
|
|
774
|
-
console.log("
|
|
787
|
+
console.log(" -- viewProps:\n", logLines(objToStr(out.viewProps)));
|
|
788
|
+
console.log(" -- props:\n", logLines(objToStr(props2)));
|
|
789
|
+
console.log(" -- next:\n", logLines(objToStr(next)));
|
|
775
790
|
}
|
|
776
791
|
for (const key in next) {
|
|
777
792
|
if (staticConfig.validStyles) {
|
|
@@ -800,8 +815,8 @@ function createExtractor() {
|
|
|
800
815
|
}
|
|
801
816
|
}
|
|
802
817
|
if (shouldPrintDebug) {
|
|
803
|
-
console.log(" completeStaticProps\n",
|
|
804
|
-
console.log(" completeStylesProcessed\n",
|
|
818
|
+
console.log(" completeStaticProps\n", completeStaticProps);
|
|
819
|
+
console.log(" completeStylesProcessed\n", completeStylesProcessed);
|
|
805
820
|
}
|
|
806
821
|
let getStyleError = null;
|
|
807
822
|
for (const attr of attrs) {
|
|
@@ -96,6 +96,9 @@ function extractToClassNames({
|
|
|
96
96
|
return [];
|
|
97
97
|
const styleWithPrev = ensureNeededPrevStyle(style);
|
|
98
98
|
const res2 = getStylesAtomic(styleWithPrev);
|
|
99
|
+
if (shouldPrintDebug) {
|
|
100
|
+
console.log("styleWithPrev", styleWithPrev, res2);
|
|
101
|
+
}
|
|
99
102
|
if (res2.length) {
|
|
100
103
|
finalStyles = [...finalStyles, ...res2];
|
|
101
104
|
}
|
|
@@ -4,7 +4,7 @@ const logLines = /* @__PURE__ */ __name((str) => {
|
|
|
4
4
|
let lines = [""];
|
|
5
5
|
const items = str.split(" ");
|
|
6
6
|
for (const item of items) {
|
|
7
|
-
if (item.length + lines[lines.length - 1].length >
|
|
7
|
+
if (item.length + lines[lines.length - 1].length > 85) {
|
|
8
8
|
lines.push("");
|
|
9
9
|
}
|
|
10
10
|
lines[lines.length - 1] += item + " ";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.62",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"typings": "types",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@dish/babel-preset": "^0.0.6",
|
|
61
61
|
"@expo/match-media": "^0.1.0",
|
|
62
62
|
"@tamagui/build": "^1.0.0-alpha.58",
|
|
63
|
-
"@tamagui/core": "^1.0.0-alpha.
|
|
63
|
+
"@tamagui/core": "^1.0.0-alpha.62",
|
|
64
64
|
"@tamagui/core-node": "^1.0.0-alpha.58",
|
|
65
65
|
"@tamagui/fake-react-native": "^1.0.0-alpha.17",
|
|
66
66
|
"@tamagui/helpers": "^1.0.0-alpha.58",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"invariant": "^2.2.4",
|
|
73
73
|
"loader-utils": "^2.0.0",
|
|
74
74
|
"lodash": "^4.17.21",
|
|
75
|
-
"tamagui": "^1.0.0-alpha.
|
|
75
|
+
"tamagui": "^1.0.0-alpha.62"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"react-native-web": "*"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "76f3b735226bdb7feffb53e3c8e3fd34392b6a10"
|
|
81
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAM9E,OAAO,EAAoC,mBAAmB,EAAW,MAAM,UAAU,CAAA;AAyBzF,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI1D,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;wBAsBb,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,+MAcrC,mBAAmB;;;;;
|
|
1
|
+
{"version":3,"file":"createExtractor.d.ts","sourceRoot":"","sources":["../../src/extractor/createExtractor.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AACjC,OAAO,KAAK,EAAsB,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAM9E,OAAO,EAAoC,mBAAmB,EAAW,MAAM,UAAU,CAAA;AAyBzF,oBAAY,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI1D,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;wBAsBb,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,+MAcrC,mBAAmB;;;;;EAwoC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAQjC,OAAO,EAAgC,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAc7C,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,GAAG,CAAA;IACX,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,GAAG;IACT,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAA;IACX,GAAG,EAAE,GAAG,CAAA;CACT,
|
|
1
|
+
{"version":3,"file":"extractToClassNames.d.ts","sourceRoot":"","sources":["../../src/extractor/extractToClassNames.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAA;AAQjC,OAAO,EAAgC,cAAc,EAAE,MAAM,UAAU,CAAA;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAc7C,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,GAAG,CAAA;IACX,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,gBAAgB,EAAE,OAAO,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,IAAI,GAAG;IACT,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAA;IACX,GAAG,EAAE,GAAG,CAAA;CACT,CA+RA"}
|