@tamagui/web 1.11.1 → 1.11.2
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/createComponent.js +1 -2
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +1 -8
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +62 -57
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/createComponent.js +1 -2
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.mjs +1 -2
- package/dist/esm/createComponent.mjs.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +1 -7
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs +1 -7
- package/dist/esm/helpers/getSplitStyles.mjs.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +59 -54
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.mjs +59 -54
- package/dist/esm/helpers/insertStyleRule.mjs.map +2 -2
- package/package.json +9 -9
- package/src/createComponent.tsx +1 -2
- package/src/helpers/getSplitStyles.tsx +1 -7
- package/src/helpers/insertStyleRule.tsx +80 -58
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +0 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +3 -3
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isClient } from "@tamagui/constants";
|
|
1
2
|
const allSelectors = {};
|
|
2
3
|
const allRules = {};
|
|
3
4
|
const insertedTransforms = {};
|
|
@@ -10,7 +11,7 @@ function addTransform(identifier, css, rule) {
|
|
|
10
11
|
if (process.env.NODE_ENV === "development") {
|
|
11
12
|
console.error(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`);
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
+
return;
|
|
14
15
|
}
|
|
15
16
|
const startI = s + "transform:".length;
|
|
16
17
|
const endI = css.indexOf(";");
|
|
@@ -19,47 +20,50 @@ function addTransform(identifier, css, rule) {
|
|
|
19
20
|
insertedTransforms[identifier] = value;
|
|
20
21
|
return true;
|
|
21
22
|
}
|
|
22
|
-
return false;
|
|
23
23
|
}
|
|
24
|
-
const isClient = typeof document !== "undefined";
|
|
25
24
|
const scannedCache = /* @__PURE__ */ new WeakMap();
|
|
26
|
-
const
|
|
25
|
+
const totalSelectorsInserted = /* @__PURE__ */ new Map();
|
|
27
26
|
function listenForSheetChanges() {
|
|
28
27
|
if (!isClient)
|
|
29
28
|
return;
|
|
30
|
-
function handleNode(node, remove = false) {
|
|
31
|
-
if (node instanceof HTMLStyleElement && node.sheet) {
|
|
32
|
-
updateSheetStyles(node.sheet, remove);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
29
|
const mo = new MutationObserver((entries) => {
|
|
36
30
|
for (const entry of entries) {
|
|
37
|
-
entry.
|
|
38
|
-
|
|
31
|
+
if (entry instanceof HTMLStyleElement && entry.sheet || entry instanceof HTMLLinkElement && entry.href.endsWith(".css")) {
|
|
32
|
+
scanAllSheets();
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
39
35
|
}
|
|
40
36
|
});
|
|
41
37
|
mo.observe(document.head, {
|
|
42
38
|
childList: true
|
|
43
39
|
});
|
|
44
40
|
}
|
|
41
|
+
let lastScannedSheets = null;
|
|
45
42
|
function scanAllSheets() {
|
|
46
43
|
if (process.env.NODE_ENV === "test")
|
|
47
44
|
return;
|
|
48
45
|
if (!isClient)
|
|
49
46
|
return;
|
|
50
|
-
const sheets = document.styleSheets;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const sheet2
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
const sheets = document.styleSheets || [];
|
|
48
|
+
const prev = lastScannedSheets;
|
|
49
|
+
const current = new Set(sheets);
|
|
50
|
+
if (document.styleSheets) {
|
|
51
|
+
for (const sheet2 of current) {
|
|
52
|
+
sheet2 && updateSheetStyles(sheet2);
|
|
53
|
+
}
|
|
54
|
+
lastScannedSheets = current;
|
|
55
|
+
}
|
|
56
|
+
if (prev) {
|
|
57
|
+
for (const sheet2 of prev) {
|
|
58
|
+
if (sheet2 && !current.has(sheet2)) {
|
|
59
|
+
updateSheetStyles(sheet2, true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
function track(id, remove = false) {
|
|
61
|
-
const next = (
|
|
62
|
-
|
|
65
|
+
const next = (totalSelectorsInserted.get(id) || 0) + (remove ? -1 : 1);
|
|
66
|
+
totalSelectorsInserted.set(id, next);
|
|
63
67
|
return next;
|
|
64
68
|
}
|
|
65
69
|
function updateSheetStyles(sheet2, remove = false) {
|
|
@@ -71,9 +75,6 @@ function updateSheetStyles(sheet2, remove = false) {
|
|
|
71
75
|
return;
|
|
72
76
|
}
|
|
73
77
|
const firstSelector = (_a = getTamaguiSelector(rules[0])) == null ? void 0 : _a[0];
|
|
74
|
-
if (!firstSelector) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
78
|
const lastSelector = (_b = getTamaguiSelector(rules[rules.length - 1])) == null ? void 0 : _b[0];
|
|
78
79
|
const cacheKey = `${rules.length}${firstSelector}${lastSelector}`;
|
|
79
80
|
const lastScanned = scannedCache.get(sheet2);
|
|
@@ -83,11 +84,18 @@ function updateSheetStyles(sheet2, remove = false) {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
const len = rules.length;
|
|
87
|
+
let fails = 0;
|
|
86
88
|
for (let i = 0; i < len; i++) {
|
|
87
89
|
const rule = rules[i];
|
|
90
|
+
if (!(rule instanceof CSSStyleRule))
|
|
91
|
+
continue;
|
|
88
92
|
const response = getTamaguiSelector(rule);
|
|
89
93
|
if (!response) {
|
|
90
|
-
|
|
94
|
+
fails++;
|
|
95
|
+
if (fails > 5) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
continue;
|
|
91
99
|
}
|
|
92
100
|
const [identifier, cssRule] = response;
|
|
93
101
|
const total = track(identifier, remove);
|
|
@@ -95,13 +103,11 @@ function updateSheetStyles(sheet2, remove = false) {
|
|
|
95
103
|
if (total === 0) {
|
|
96
104
|
delete allSelectors[identifier];
|
|
97
105
|
}
|
|
98
|
-
} else {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
allSelectors[identifier] = cssRule.cssText;
|
|
104
|
-
}
|
|
106
|
+
} else if (!(identifier in allSelectors)) {
|
|
107
|
+
const isTransform = identifier.startsWith("_transform");
|
|
108
|
+
const shouldInsert = isTransform ? addTransform(identifier, cssRule.cssText, cssRule) : true;
|
|
109
|
+
if (shouldInsert) {
|
|
110
|
+
allSelectors[identifier] = cssRule.cssText;
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
}
|
|
@@ -126,8 +132,9 @@ function getTamaguiSelector(rule) {
|
|
|
126
132
|
const getIdentifierFromTamaguiSelector = (selector) => selector.replace(/(:root)+\s+/, "").replace(/:[a-z]+$/, "").slice(1);
|
|
127
133
|
const sheet = isClient ? document.head.appendChild(document.createElement("style")).sheet : null;
|
|
128
134
|
function updateRules(identifier, rules) {
|
|
129
|
-
if (allRules
|
|
135
|
+
if (identifier in allRules) {
|
|
130
136
|
return false;
|
|
137
|
+
}
|
|
131
138
|
allRules[identifier] = rules.join(" ");
|
|
132
139
|
if (identifier.startsWith("_transform")) {
|
|
133
140
|
return addTransform(identifier, rules[0]);
|
|
@@ -135,42 +142,40 @@ function updateRules(identifier, rules) {
|
|
|
135
142
|
return true;
|
|
136
143
|
}
|
|
137
144
|
function insertStyleRules(rulesToInsert) {
|
|
138
|
-
if (!rulesToInsert.length)
|
|
139
|
-
return;
|
|
140
|
-
if (isClient && !sheet) {
|
|
141
|
-
if (process.env.NODE_ENV === "development")
|
|
142
|
-
throw "impossible";
|
|
145
|
+
if (!rulesToInsert.length || !sheet) {
|
|
143
146
|
return;
|
|
144
147
|
}
|
|
145
148
|
for (const { identifier, rules } of rulesToInsert) {
|
|
146
|
-
if (identifier
|
|
149
|
+
if (!shouldInsertStyleRules(identifier)) {
|
|
147
150
|
continue;
|
|
148
|
-
|
|
151
|
+
}
|
|
152
|
+
allSelectors[identifier] = rules.join("\n");
|
|
153
|
+
track(identifier);
|
|
149
154
|
updateRules(identifier, rules);
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
for (const rule of rules) {
|
|
156
|
+
if (process.env.NODE_ENV === "production") {
|
|
157
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
158
|
+
} else {
|
|
152
159
|
try {
|
|
153
160
|
sheet.insertRule(rule, sheet.cssRules.length);
|
|
154
161
|
} catch (err) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
console.groupEnd();
|
|
162
|
-
}
|
|
162
|
+
console.groupCollapsed(
|
|
163
|
+
`Error inserting rule into CSSStyleSheet: ${String(err)}`
|
|
164
|
+
);
|
|
165
|
+
console.log({ rule, rulesToInsert });
|
|
166
|
+
console.trace();
|
|
167
|
+
console.groupEnd();
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
172
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (IS_STATIC) {
|
|
173
|
+
function shouldInsertStyleRules(identifier) {
|
|
174
|
+
if (process.env.IS_STATIC === "is_static") {
|
|
171
175
|
return true;
|
|
172
176
|
}
|
|
173
|
-
|
|
177
|
+
const total = totalSelectorsInserted.get(identifier);
|
|
178
|
+
return total === void 0 || total < 2;
|
|
174
179
|
}
|
|
175
180
|
export {
|
|
176
181
|
getAllRules,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/insertStyleRule.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { RulesToInsert, StyleObject } from '../types.js'\n\nconst allSelectors: Record<string, string> = {}\nconst allRules: Record<string, string> = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getAllRules = () => Object.values(allRules)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n console.error(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n }\n return
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { isClient } from '@tamagui/constants'\n\nimport type { RulesToInsert, StyleObject } from '../types.js'\n\nconst allSelectors: Record<string, string> = {}\nconst allRules: Record<string, string> = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getAllRules = () => Object.values(allRules)\nexport const getAllTransforms = () => insertedTransforms\n\n// keep transforms in map for merging later\nfunction addTransform(identifier: string, css: string, rule?: CSSRule) {\n const s = css.indexOf('transform:')\n if (s === -1) {\n if (process.env.NODE_ENV === 'development') {\n console.error(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n if (!insertedTransforms[identifier]) {\n insertedTransforms[identifier] = value\n return true\n }\n}\n\n// gets existing ones (client side)\n// takes ~0.1ms for a fairly large page\n// used now for three things:\n// 1. debugging at dev time\n// 2. avoid duplicate insert styles at runtime\n// 3. used now for merging transforms atomically\n\n// multiple sheets could have the same ids so we have to count\n\n// only cache tamagui styles\nconst scannedCache = new WeakMap<CSSStyleSheet, string>()\nconst totalSelectorsInserted = new Map<string, number>()\n\nexport function listenForSheetChanges() {\n if (!isClient) return\n\n const mo = new MutationObserver((entries) => {\n for (const entry of entries) {\n if (\n (entry instanceof HTMLStyleElement && entry.sheet) ||\n (entry instanceof HTMLLinkElement && entry.href.endsWith('.css'))\n ) {\n scanAllSheets()\n break\n }\n }\n })\n\n mo.observe(document.head, {\n childList: true,\n })\n}\n\nlet lastScannedSheets: Set<CSSStyleSheet> | null = null\n\nexport function scanAllSheets() {\n if (process.env.NODE_ENV === 'test') return\n if (!isClient) return\n\n const sheets = document.styleSheets || []\n const prev = lastScannedSheets\n const current = new Set(sheets as any as CSSStyleSheet[])\n if (document.styleSheets) {\n for (const sheet of current) {\n sheet && updateSheetStyles(sheet)\n }\n lastScannedSheets = current\n }\n\n if (prev) {\n for (const sheet of prev) {\n if (sheet && !current.has(sheet)) {\n updateSheetStyles(sheet, true)\n }\n }\n }\n}\n\nfunction track(id: string, remove = false) {\n const next = (totalSelectorsInserted.get(id) || 0) + (remove ? -1 : 1)\n totalSelectorsInserted.set(id, next)\n return next\n}\n\nfunction updateSheetStyles(sheet: CSSStyleSheet, remove = false) {\n // avoid errors on cross origin sheets\n // https://stackoverflow.com/questions/49993633/uncaught-domexception-failed-to-read-the-cssrules-property\n let rules: CSSRuleList\n try {\n rules = sheet.cssRules\n } catch {\n return\n }\n\n const firstSelector = getTamaguiSelector(rules[0])?.[0]\n const lastSelector = getTamaguiSelector(rules[rules.length - 1])?.[0]\n const cacheKey = `${rules.length}${firstSelector}${lastSelector}`\n const lastScanned = scannedCache.get(sheet)\n\n if (!remove) {\n // avoid re-scanning\n if (lastScanned === cacheKey) {\n return\n }\n }\n\n const len = rules.length\n let fails = 0\n\n for (let i = 0; i < len; i++) {\n const rule = rules[i]\n if (!(rule instanceof CSSStyleRule)) continue\n\n const response = getTamaguiSelector(rule)\n\n if (!response) {\n fails++\n if (fails > 5) {\n // conservatively bail out of non-tamagui sheets\n return\n }\n continue\n }\n\n const [identifier, cssRule] = response\n\n // track references\n const total = track(identifier, remove)\n\n if (remove) {\n if (total === 0) {\n delete allSelectors[identifier]\n }\n } else if (!(identifier in allSelectors)) {\n const isTransform = identifier.startsWith('_transform')\n const shouldInsert = isTransform\n ? addTransform(identifier, cssRule.cssText, cssRule)\n : true\n if (shouldInsert) {\n allSelectors[identifier] = cssRule.cssText\n }\n }\n }\n\n scannedCache.set(sheet, cacheKey)\n}\n\nfunction getTamaguiSelector(\n rule: CSSRule | null\n): readonly [string, CSSStyleRule] | null {\n if (rule instanceof CSSStyleRule) {\n const text = rule.selectorText\n if (text[0] === '.' && text[1] === '_') {\n return [text.slice(1), rule]\n }\n if (text.startsWith(':root') && text.includes('._')) {\n return [getIdentifierFromTamaguiSelector(text), rule]\n }\n } else if (rule instanceof CSSMediaRule) {\n // tamagui only ever inserts 1 rule per media\n if (rule.cssRules.length > 1) return null\n return getTamaguiSelector(rule.cssRules[0])\n }\n return null\n}\n\nconst getIdentifierFromTamaguiSelector = (selector: string) =>\n selector\n .replace(/(:root)+\\s+/, '')\n .replace(/:[a-z]+$/, '')\n .slice(1)\n\nconst sheet = isClient\n ? document.head.appendChild(document.createElement('style')).sheet\n : null\n\nexport function updateRules(identifier: string, rules: string[]) {\n if (identifier in allRules) {\n return false\n }\n allRules[identifier] = rules.join(' ')\n if (identifier.startsWith('_transform')) {\n return addTransform(identifier, rules[0])\n }\n return true\n}\n\nexport function insertStyleRules(rulesToInsert: RulesToInsert) {\n if (!rulesToInsert.length || !sheet) {\n return\n }\n\n for (const { identifier, rules } of rulesToInsert) {\n if (!shouldInsertStyleRules(identifier)) {\n continue\n }\n\n allSelectors[identifier] = rules.join('\\n')\n track(identifier)\n updateRules(identifier, rules)\n\n for (const rule of rules) {\n if (process.env.NODE_ENV === 'production') {\n sheet.insertRule(rule, sheet.cssRules.length)\n } else {\n try {\n sheet.insertRule(rule, sheet.cssRules.length)\n } catch (err) {\n console.groupCollapsed(\n `Error inserting rule into CSSStyleSheet: ${String(err)}`\n )\n console.log({ rule, rulesToInsert })\n console.trace()\n console.groupEnd()\n }\n }\n }\n }\n}\n\nexport function shouldInsertStyleRules(identifier: string) {\n if (process.env.IS_STATIC === 'is_static') {\n return true\n }\n const total = totalSelectorsInserted.get(identifier)\n // note, -1, we are being conservative and leaving some in\n return total === undefined || total < 2\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAIzB,MAAM,eAAuC,CAAC;AAC9C,MAAM,WAAmC,CAAC;AACnC,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,MAAM;AAC9B,MAAM,cAAc,MAAM,OAAO,OAAO,QAAQ;AAChD,MAAM,mBAAmB,MAAM;AAGtC,SAAS,aAAa,YAAoB,KAAa,MAAgB;AACrE,QAAM,IAAI,IAAI,QAAQ,YAAY;AAClC,MAAI,MAAM,IAAI;AACZ,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,MAAM,0DAAqD,YAAY;AAAA,IACjF;AACA;AAAA,EACF;AACA,QAAM,SAAS,IAAI,aAAa;AAChC,QAAM,OAAO,IAAI,QAAQ,GAAG;AAC5B,QAAM,QAAQ,IAAI,MAAM,QAAQ,IAAI;AACpC,MAAI,CAAC,mBAAmB,UAAU,GAAG;AACnC,uBAAmB,UAAU,IAAI;AACjC,WAAO;AAAA,EACT;AACF;AAYA,MAAM,eAAe,oBAAI,QAA+B;AACxD,MAAM,yBAAyB,oBAAI,IAAoB;AAEhD,SAAS,wBAAwB;AACtC,MAAI,CAAC;AAAU;AAEf,QAAM,KAAK,IAAI,iBAAiB,CAAC,YAAY;AAC3C,eAAW,SAAS,SAAS;AAC3B,UACG,iBAAiB,oBAAoB,MAAM,SAC3C,iBAAiB,mBAAmB,MAAM,KAAK,SAAS,MAAM,GAC/D;AACA,sBAAc;AACd;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AAED,KAAG,QAAQ,SAAS,MAAM;AAAA,IACxB,WAAW;AAAA,EACb,CAAC;AACH;AAEA,IAAI,oBAA+C;AAE5C,SAAS,gBAAgB;AAC9B,MAAI,QAAQ,IAAI,aAAa;AAAQ;AACrC,MAAI,CAAC;AAA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AAC;AAAA,EAC1C;AACA,SAAO;AACT;AAEO,SAAS,iBAAiB,eAA8B;AAC7D,MAAI,CAAC,cAAc,UAAU,CAAC,OAAO;AACnC;AAAA,EACF;AAEA,aAAW,EAAE,YAAY,MAAM,KAAK,eAAe;AACjD,QAAI,CAAC,uBAAuB,UAAU,GAAG;AACvC;AAAA,IACF;AAEA,iBAAa,UAAU,IAAI,MAAM,KAAK,IAAI;AAC1C,UAAM,UAAU;AAChB,gBAAY,YAAY,KAAK;AAE7B,eAAW,QAAQ,OAAO;AACxB,UAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAM,WAAW,MAAM,MAAM,SAAS,MAAM;AAAA,MAC9C,OAAO;AACL,YAAI;AACF,gBAAM,WAAW,MAAM,MAAM,SAAS,MAAM;AAAA,QAC9C,SAAS,KAAP;AACA,kBAAQ;AAAA,YACN,4CAA4C,OAAO,GAAG;AAAA,UACxD;AACA,kBAAQ,IAAI,EAAE,MAAM,cAAc,CAAC;AACnC,kBAAQ,MAAM;AACd,kBAAQ,SAAS;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,uBAAuB,YAAoB;AACzD,MAAI,QAAQ,IAAI,cAAc,aAAa;AACzC,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,uBAAuB,IAAI,UAAU;AAEnD,SAAO,UAAU,UAAa,QAAQ;AACxC;",
|
|
6
6
|
"names": ["sheet"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.11.
|
|
31
|
-
"@tamagui/constants": "1.11.
|
|
32
|
-
"@tamagui/helpers": "1.11.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.11.
|
|
34
|
-
"@tamagui/use-did-finish-ssr": "1.11.
|
|
35
|
-
"@tamagui/use-event": "1.11.
|
|
36
|
-
"@tamagui/use-force-update": "1.11.
|
|
30
|
+
"@tamagui/compose-refs": "1.11.2",
|
|
31
|
+
"@tamagui/constants": "1.11.2",
|
|
32
|
+
"@tamagui/helpers": "1.11.2",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.11.2",
|
|
34
|
+
"@tamagui/use-did-finish-ssr": "1.11.2",
|
|
35
|
+
"@tamagui/use-event": "1.11.2",
|
|
36
|
+
"@tamagui/use-force-update": "1.11.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "1.11.
|
|
42
|
+
"@tamagui/build": "1.11.2",
|
|
43
43
|
"@testing-library/react": "^13.4.0",
|
|
44
44
|
"csstype": "^3.0.10",
|
|
45
45
|
"react": "^18.2.0",
|
package/src/createComponent.tsx
CHANGED
|
@@ -20,7 +20,6 @@ import { TextAncestorContext } from './contexts/TextAncestorContext.js'
|
|
|
20
20
|
import { didGetVariableValue, setDidGetVariableValue } from './createVariable.js'
|
|
21
21
|
import { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig.js'
|
|
22
22
|
import { useSplitStyles } from './helpers/getSplitStyles.js'
|
|
23
|
-
import { getAllSelectors } from './helpers/insertStyleRule.js'
|
|
24
23
|
import { mergeProps } from './helpers/mergeProps.js'
|
|
25
24
|
import { proxyThemeVariables } from './helpers/proxyThemeVariables.js'
|
|
26
25
|
import { useShallowSetState } from './helpers/useShallowSetState.js'
|
|
@@ -760,7 +759,7 @@ export function createComponent<
|
|
|
760
759
|
console.groupEnd()
|
|
761
760
|
if (typeof window !== 'undefined') {
|
|
762
761
|
// prettier-ignore
|
|
763
|
-
console.log({ state, themeState, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, staticConfig, tamaguiConfig, shouldForcePseudo
|
|
762
|
+
console.log({ state, themeState, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, staticConfig, tamaguiConfig, shouldForcePseudo })
|
|
764
763
|
}
|
|
765
764
|
console.groupEnd()
|
|
766
765
|
}
|
|
@@ -1126,12 +1126,6 @@ export const getSubStyle = (
|
|
|
1126
1126
|
return styleOut
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
|
-
export const insertSplitStyles: StyleSplitter = (...args) => {
|
|
1130
|
-
const res = getSplitStyles(...args)
|
|
1131
|
-
insertStyleRules(res.rulesToInsert)
|
|
1132
|
-
return res
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
1129
|
// on native no need to insert any css
|
|
1136
1130
|
const useInsertEffectCompat = isWeb
|
|
1137
1131
|
? useInsertionEffect || useIsomorphicLayoutEffect
|
|
@@ -1151,7 +1145,7 @@ export const useSplitStyles: StyleSplitter = (...args) => {
|
|
|
1151
1145
|
|
|
1152
1146
|
function addStyleToInsertRules(rulesToInsert: RulesToInsert, styleObject: StyleObject) {
|
|
1153
1147
|
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
1154
|
-
if (!shouldInsertStyleRules(styleObject)) {
|
|
1148
|
+
if (!shouldInsertStyleRules(styleObject.identifier)) {
|
|
1155
1149
|
return
|
|
1156
1150
|
}
|
|
1157
1151
|
updateRules(styleObject.identifier, styleObject.rules)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isClient } from '@tamagui/constants'
|
|
2
|
+
|
|
1
3
|
import type { RulesToInsert, StyleObject } from '../types.js'
|
|
2
4
|
|
|
3
5
|
const allSelectors: Record<string, string> = {}
|
|
@@ -15,7 +17,7 @@ function addTransform(identifier: string, css: string, rule?: CSSRule) {
|
|
|
15
17
|
if (process.env.NODE_ENV === 'development') {
|
|
16
18
|
console.error(`❌ Invalid transform, likely used deg/% improperly ${identifier}`)
|
|
17
19
|
}
|
|
18
|
-
return
|
|
20
|
+
return
|
|
19
21
|
}
|
|
20
22
|
const startI = s + 'transform:'.length
|
|
21
23
|
const endI = css.indexOf(';')
|
|
@@ -24,11 +26,8 @@ function addTransform(identifier: string, css: string, rule?: CSSRule) {
|
|
|
24
26
|
insertedTransforms[identifier] = value
|
|
25
27
|
return true
|
|
26
28
|
}
|
|
27
|
-
return false
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
const isClient = typeof document !== 'undefined'
|
|
31
|
-
|
|
32
31
|
// gets existing ones (client side)
|
|
33
32
|
// takes ~0.1ms for a fairly large page
|
|
34
33
|
// used now for three things:
|
|
@@ -40,41 +39,56 @@ const isClient = typeof document !== 'undefined'
|
|
|
40
39
|
|
|
41
40
|
// only cache tamagui styles
|
|
42
41
|
const scannedCache = new WeakMap<CSSStyleSheet, string>()
|
|
43
|
-
const
|
|
42
|
+
const totalSelectorsInserted = new Map<string, number>()
|
|
44
43
|
|
|
45
44
|
export function listenForSheetChanges() {
|
|
46
45
|
if (!isClient) return
|
|
47
|
-
|
|
48
|
-
if (node instanceof HTMLStyleElement && node.sheet) {
|
|
49
|
-
updateSheetStyles(node.sheet, remove)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
46
|
+
|
|
52
47
|
const mo = new MutationObserver((entries) => {
|
|
53
48
|
for (const entry of entries) {
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
if (
|
|
50
|
+
(entry instanceof HTMLStyleElement && entry.sheet) ||
|
|
51
|
+
(entry instanceof HTMLLinkElement && entry.href.endsWith('.css'))
|
|
52
|
+
) {
|
|
53
|
+
scanAllSheets()
|
|
54
|
+
break
|
|
55
|
+
}
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
|
+
|
|
58
59
|
mo.observe(document.head, {
|
|
59
60
|
childList: true,
|
|
60
61
|
})
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
let lastScannedSheets: Set<CSSStyleSheet> | null = null
|
|
65
|
+
|
|
63
66
|
export function scanAllSheets() {
|
|
64
67
|
if (process.env.NODE_ENV === 'test') return
|
|
65
68
|
if (!isClient) return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
|
|
70
|
+
const sheets = document.styleSheets || []
|
|
71
|
+
const prev = lastScannedSheets
|
|
72
|
+
const current = new Set(sheets as any as CSSStyleSheet[])
|
|
73
|
+
if (document.styleSheets) {
|
|
74
|
+
for (const sheet of current) {
|
|
75
|
+
sheet && updateSheetStyles(sheet)
|
|
76
|
+
}
|
|
77
|
+
lastScannedSheets = current
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (prev) {
|
|
81
|
+
for (const sheet of prev) {
|
|
82
|
+
if (sheet && !current.has(sheet)) {
|
|
83
|
+
updateSheetStyles(sheet, true)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
72
86
|
}
|
|
73
87
|
}
|
|
74
88
|
|
|
75
89
|
function track(id: string, remove = false) {
|
|
76
|
-
const next = (
|
|
77
|
-
|
|
90
|
+
const next = (totalSelectorsInserted.get(id) || 0) + (remove ? -1 : 1)
|
|
91
|
+
totalSelectorsInserted.set(id, next)
|
|
78
92
|
return next
|
|
79
93
|
}
|
|
80
94
|
|
|
@@ -88,16 +102,11 @@ function updateSheetStyles(sheet: CSSStyleSheet, remove = false) {
|
|
|
88
102
|
return
|
|
89
103
|
}
|
|
90
104
|
|
|
91
|
-
// not tamagui stylesheet
|
|
92
105
|
const firstSelector = getTamaguiSelector(rules[0])?.[0]
|
|
93
|
-
if (!firstSelector) {
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
|
|
97
106
|
const lastSelector = getTamaguiSelector(rules[rules.length - 1])?.[0]
|
|
98
|
-
|
|
99
107
|
const cacheKey = `${rules.length}${firstSelector}${lastSelector}`
|
|
100
108
|
const lastScanned = scannedCache.get(sheet)
|
|
109
|
+
|
|
101
110
|
if (!remove) {
|
|
102
111
|
// avoid re-scanning
|
|
103
112
|
if (lastScanned === cacheKey) {
|
|
@@ -106,11 +115,21 @@ function updateSheetStyles(sheet: CSSStyleSheet, remove = false) {
|
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
const len = rules.length
|
|
118
|
+
let fails = 0
|
|
119
|
+
|
|
109
120
|
for (let i = 0; i < len; i++) {
|
|
110
121
|
const rule = rules[i]
|
|
122
|
+
if (!(rule instanceof CSSStyleRule)) continue
|
|
123
|
+
|
|
111
124
|
const response = getTamaguiSelector(rule)
|
|
125
|
+
|
|
112
126
|
if (!response) {
|
|
113
|
-
|
|
127
|
+
fails++
|
|
128
|
+
if (fails > 5) {
|
|
129
|
+
// conservatively bail out of non-tamagui sheets
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
continue
|
|
114
133
|
}
|
|
115
134
|
|
|
116
135
|
const [identifier, cssRule] = response
|
|
@@ -122,15 +141,13 @@ function updateSheetStyles(sheet: CSSStyleSheet, remove = false) {
|
|
|
122
141
|
if (total === 0) {
|
|
123
142
|
delete allSelectors[identifier]
|
|
124
143
|
}
|
|
125
|
-
} else {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
allSelectors[identifier] = cssRule.cssText
|
|
133
|
-
}
|
|
144
|
+
} else if (!(identifier in allSelectors)) {
|
|
145
|
+
const isTransform = identifier.startsWith('_transform')
|
|
146
|
+
const shouldInsert = isTransform
|
|
147
|
+
? addTransform(identifier, cssRule.cssText, cssRule)
|
|
148
|
+
: true
|
|
149
|
+
if (shouldInsert) {
|
|
150
|
+
allSelectors[identifier] = cssRule.cssText
|
|
134
151
|
}
|
|
135
152
|
}
|
|
136
153
|
}
|
|
@@ -168,7 +185,9 @@ const sheet = isClient
|
|
|
168
185
|
: null
|
|
169
186
|
|
|
170
187
|
export function updateRules(identifier: string, rules: string[]) {
|
|
171
|
-
if (allRules
|
|
188
|
+
if (identifier in allRules) {
|
|
189
|
+
return false
|
|
190
|
+
}
|
|
172
191
|
allRules[identifier] = rules.join(' ')
|
|
173
192
|
if (identifier.startsWith('_transform')) {
|
|
174
193
|
return addTransform(identifier, rules[0])
|
|
@@ -177,40 +196,43 @@ export function updateRules(identifier: string, rules: string[]) {
|
|
|
177
196
|
}
|
|
178
197
|
|
|
179
198
|
export function insertStyleRules(rulesToInsert: RulesToInsert) {
|
|
180
|
-
if (!rulesToInsert.length)
|
|
181
|
-
if (isClient && !sheet) {
|
|
182
|
-
if (process.env.NODE_ENV === 'development') throw 'impossible'
|
|
199
|
+
if (!rulesToInsert.length || !sheet) {
|
|
183
200
|
return
|
|
184
201
|
}
|
|
202
|
+
|
|
185
203
|
for (const { identifier, rules } of rulesToInsert) {
|
|
186
|
-
if (identifier
|
|
187
|
-
|
|
188
|
-
|
|
204
|
+
if (!shouldInsertStyleRules(identifier)) {
|
|
205
|
+
continue
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
allSelectors[identifier] = rules.join('\n')
|
|
209
|
+
track(identifier)
|
|
189
210
|
updateRules(identifier, rules)
|
|
190
|
-
|
|
191
|
-
|
|
211
|
+
|
|
212
|
+
for (const rule of rules) {
|
|
213
|
+
if (process.env.NODE_ENV === 'production') {
|
|
214
|
+
sheet.insertRule(rule, sheet.cssRules.length)
|
|
215
|
+
} else {
|
|
192
216
|
try {
|
|
193
217
|
sheet.insertRule(rule, sheet.cssRules.length)
|
|
194
218
|
} catch (err) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
console.groupEnd()
|
|
202
|
-
}
|
|
219
|
+
console.groupCollapsed(
|
|
220
|
+
`Error inserting rule into CSSStyleSheet: ${String(err)}`
|
|
221
|
+
)
|
|
222
|
+
console.log({ rule, rulesToInsert })
|
|
223
|
+
console.trace()
|
|
224
|
+
console.groupEnd()
|
|
203
225
|
}
|
|
204
226
|
}
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
229
|
}
|
|
208
230
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
export function shouldInsertStyleRules(styleObject: StyleObject) {
|
|
212
|
-
if (IS_STATIC) {
|
|
231
|
+
export function shouldInsertStyleRules(identifier: string) {
|
|
232
|
+
if (process.env.IS_STATIC === 'is_static') {
|
|
213
233
|
return true
|
|
214
234
|
}
|
|
215
|
-
|
|
235
|
+
const total = totalSelectorsInserted.get(identifier)
|
|
236
|
+
// note, -1, we are being conservative and leaving some in
|
|
237
|
+
return total === undefined || total < 2
|
|
216
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAUN,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAUN,MAAM,OAAO,CAAA;AAiBd,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAEhB,qBAAqB,EAErB,cAAc,EAIf,MAAM,SAAS,CAAA;AAqBhB,eAAO,MAAM,qBAAqB,EAAE,qBAMnC,CAAA;AAeD,eAAO,MAAM,QAAQ,eAAsB,CAAA;AA8B3C,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,GAAG,EAAE,EACtC,GAAG,GAAG,cAAc,EACpB,SAAS,GAAG,KAAK,EAEjB,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,kBAAkB,EACpD,eAAe,CAAC,EAAE,iBAAiB,4DAowBpC;AAGD,eAAO,MAAM,QAAQ;YAAW;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;;CAAmB,CAAA;AAMrE,eAAO,MAAM,MAAM,0DA8CjB,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,mBAiGxD"}
|
|
@@ -22,7 +22,6 @@ type StyleSplitter = (props: {
|
|
|
22
22
|
export declare const PROP_SPLIT = "-";
|
|
23
23
|
export declare const getSplitStyles: StyleSplitter;
|
|
24
24
|
export declare const getSubStyle: (styleState: GetStyleState, subKey: string, styleIn: Object, avoidDefaultProps?: boolean, avoidMergeTransform?: boolean) => TextStyleProps;
|
|
25
|
-
export declare const insertSplitStyles: StyleSplitter;
|
|
26
25
|
export declare const useSplitStyles: StyleSplitter;
|
|
27
26
|
export type FlatTransforms = Record<string, any>;
|
|
28
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSplitStyles.d.ts","sourceRoot":"","sources":["../../src/helpers/getSplitStyles.tsx"],"names":[],"mappings":"AA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CAAE,EAC7B,YAAY,EAAE,kBAAkB,EAChC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,eAAe,EACtB,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,mBAAmB,EAErC,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,SAAS,KACd,cAAc,CAAA;AAEnB,eAAO,MAAM,UAAU,MAAM,CAAA;AAqB7B,eAAO,MAAM,cAAc,EAAE,aAgyB5B,CAAA;AA0FD,eAAO,MAAM,WAAW,eACV,aAAa,UACjB,MAAM,WACL,MAAM,sBACK,OAAO,wBACL,OAAO,KAC5B,cA6BF,CAAA;AAOD,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAA;AA2BD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { RulesToInsert
|
|
1
|
+
import type { RulesToInsert } from '../types.js';
|
|
2
2
|
export declare const insertedTransforms: {};
|
|
3
3
|
export declare const getAllSelectors: () => Record<string, string>;
|
|
4
4
|
export declare const getAllRules: () => string[];
|
|
5
5
|
export declare const getAllTransforms: () => {};
|
|
6
6
|
export declare function listenForSheetChanges(): void;
|
|
7
7
|
export declare function scanAllSheets(): void;
|
|
8
|
-
export declare function updateRules(identifier: string, rules: string[]): boolean;
|
|
8
|
+
export declare function updateRules(identifier: string, rules: string[]): boolean | undefined;
|
|
9
9
|
export declare function insertStyleRules(rulesToInsert: RulesToInsert): void;
|
|
10
|
-
export declare function shouldInsertStyleRules(
|
|
10
|
+
export declare function shouldInsertStyleRules(identifier: string): boolean;
|
|
11
11
|
//# sourceMappingURL=insertStyleRule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,aAAa,CAAA;AAI7D,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,8BAAqB,CAAA;AACjD,eAAO,MAAM,WAAW,gBAAgC,CAAA;AACxD,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AAiCxD,wBAAgB,qBAAqB,SAkBpC;AAID,wBAAgB,aAAa,SAqB5B;AAoGD,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,uBAS9D;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,QA+B5D;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,WAOxD"}
|