@tamagui/core 1.0.0-beta.6 → 1.0.0-beta.7
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/helpers/insertStyleRule.js +1 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +1 -0
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/jsx/helpers/insertStyleRule.js +1 -0
- package/package.json +5 -5
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
|
@@ -106,6 +106,7 @@ function insertStyleRule(identifier, rule) {
|
|
|
106
106
|
return;
|
|
107
107
|
hasInsertedSinceUpdate = true;
|
|
108
108
|
updateInsertedCache(identifier, rule);
|
|
109
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
109
110
|
sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
|
|
110
111
|
}
|
|
111
112
|
__name(insertStyleRule, "insertStyleRule");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/insertStyleRule.tsx"],
|
|
4
|
-
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\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.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\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\nlet hasInsertedSinceUpdate = true\n\nexport function updateInserted() {\n if (!isClient) return\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!(firstRule instanceof CSSStyleRule)) continue\n const firstSelector = firstRule.selectorText\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (let i = 0; i < rules.length; i++) {\n const rule = rules.item(i)\n if (!(rule instanceof CSSStyleRule)) continue\n const identifier = rule.selectorText.slice(1)\n if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier, rule)\n sheet?.insertRule(rule, sheet.cssRules.length)\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAo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a,MAAM,CAAC;AAC5C,YAAI,CAAC,aAAa,aAAa;AAC7B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA7BgB;AA+BhB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AANgB;AAQT,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;
|
|
4
|
+
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\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.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\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\nlet hasInsertedSinceUpdate = true\n\nexport function updateInserted() {\n if (!isClient) return\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!(firstRule instanceof CSSStyleRule)) continue\n const firstSelector = firstRule.selectorText\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (let i = 0; i < rules.length; i++) {\n const rule = rules.item(i)\n if (!(rule instanceof CSSStyleRule)) continue\n const identifier = rule.selectorText.slice(1)\n if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier, rule)\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule : true\n sheet?.insertRule(rule, sheet.cssRules.length)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,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Aa;AAC7B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA7BgB;AA+BhB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AANgB;AAQT,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;AANgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -79,6 +79,7 @@ function insertStyleRule(identifier, rule) {
|
|
|
79
79
|
return;
|
|
80
80
|
hasInsertedSinceUpdate = true;
|
|
81
81
|
updateInsertedCache(identifier, rule);
|
|
82
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
82
83
|
sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
|
|
83
84
|
}
|
|
84
85
|
__name(insertStyleRule, "insertStyleRule");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/insertStyleRule.tsx"],
|
|
4
|
-
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\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.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\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\nlet hasInsertedSinceUpdate = true\n\nexport function updateInserted() {\n if (!isClient) return\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!(firstRule instanceof CSSStyleRule)) continue\n const firstSelector = firstRule.selectorText\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (let i = 0; i < rules.length; i++) {\n const rule = rules.item(i)\n if (!(rule instanceof CSSStyleRule)) continue\n const identifier = rule.selectorText.slice(1)\n if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier, rule)\n sheet?.insertRule(rule, sheet.cssRules.length)\n}\n"],
|
|
5
|
-
"mappings": ";;AAIA,MAAM,eAAe,CAAC;AACtB,MAAM,oBAAoB,CAAC;AACpB,MAAM,qBAAqB,CAAC;AAE5B,MAAM,kBAAkB,6BAAM,cAAN;AACxB,MAAM,mBAAmB,6BAAM,OAAO,OAAO,iBAAiB,GAArC;AACzB,MAAM,mBAAmB,6BAAM,oBAAN;AAGhC,sBAAsB,YAAoB,KAAa,MAAgB;AACrE,QAAM,IAAI,IAAI,QAAQ,YAAY;AAClC,MAAI,MAAM,IAAI;AACZ,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,cAAQ,eAAe,0DAAqD,YAAY;AACxF,cAAQ,IAAI,SAAS,IAAI;AACzB,cAAQ,MAAM;AACd,cAAQ,SAAS;AAAA,IACnB,OAAO;AACL,cAAQ,MAAM,qBAAqB,YAAY,KAAK,IAAI;AAAA,IAC1D;AACA;AAAA,EACF;AACA,QAAM,SAAS,IAAI,aAAa;AAChC,QAAM,OAAO,IAAI,QAAQ,GAAG;AAC5B,QAAM,QAAQ,IAAI,MAAM,QAAQ,IAAI;AACpC,qBAAmB,cAAc;AACnC;AAjBS;AAmBT,MAAM,WAAW,OAAO,aAAa;AAQrC,IAAI,yBAAyB;AAEtB,0BAA0B;AAC/B,MAAI,CAAC;AAAU;AACf,MAAI,CAAC,wBAAwB;AAC3B,YAAQ,KAAK,sBAAsB;AACnC;AAAA,EACF;AACA,QAAM,SAAS,SAAS;AACxB,MAAI,CAAC;AAAQ;AACb,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,UAAM,QAAQ,OAAO,GAAG;AACxB,UAAM,YAAY,MAAM;AACxB,QAAI,CAAE,sBAAqB;AAAe;AAC1C,UAAM,gBAAgB,UAAU;AAChC,QAAI,CAAC;AAAe;AACpB,QAAI,kBAAkB,WAAW,cAAc,WAAW,IAAI,GAAG;AAC/D,eAAS,KAAI,GAAG,KAAI,MAAM,QAAQ,MAAK;AACrC,cAAM,OAAO,MAAM,KAAK,EAAC;AACzB,YAAI,CAAE,iBAAgB;AAAe;AACrC,cAAM,aAAa,KAAK,aAAa,MAAM,CAAC;AAC5C,YAAI,CAAC,aAAa,aAAa;AAC7B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA7BgB;AA+BhB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AANgB;AAQT,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;
|
|
4
|
+
"sourcesContent": ["// this needs to check if its inserted already? 99% of the time it is\n// this should avoid re-inserts, but need to test the perf trade-offs\n// i tested with the site itself and the initial insert was trivial\n\nconst allSelectors = {}\nconst insertedSelectors = {}\nexport const insertedTransforms = {}\n\nexport const getAllSelectors = () => allSelectors\nexport const getInsertedRules = () => Object.values(insertedSelectors)\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.groupCollapsed(`\u274C Invalid transform, likely used deg/% improperly ${identifier}`)\n console.log('rule:', rule)\n console.trace()\n console.groupEnd()\n } else {\n console.error(`Missing transform`, identifier, css, rule)\n }\n return\n }\n const startI = s + 'transform:'.length\n const endI = css.indexOf(';')\n const value = css.slice(startI, endI)\n insertedTransforms[identifier] = value\n}\n\nconst isClient = typeof document !== 'undefined'\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\nlet hasInsertedSinceUpdate = true\n\nexport function updateInserted() {\n if (!isClient) return\n if (!hasInsertedSinceUpdate) {\n console.warn('hasnt inserted since')\n return\n }\n const sheets = document.styleSheets\n if (!sheets) return\n for (let i = 0; i < sheets.length; i++) {\n const rules = sheets[i].cssRules\n const firstRule = rules[0]\n if (!(firstRule instanceof CSSStyleRule)) continue\n const firstSelector = firstRule.selectorText\n if (!firstSelector) continue\n if (firstSelector === ':root' || firstSelector.startsWith('._')) {\n for (let i = 0; i < rules.length; i++) {\n const rule = rules.item(i)\n if (!(rule instanceof CSSStyleRule)) continue\n const identifier = rule.selectorText.slice(1)\n if (!allSelectors[identifier]) {\n allSelectors[identifier] = process.env.NODE_ENV === 'development' ? rule.cssText : true\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule.cssText, rule)\n }\n }\n }\n }\n }\n hasInsertedSinceUpdate = false\n}\n\nupdateInserted()\n\nconst sheet = isClient ? document.head.appendChild(document.createElement('style')).sheet : null\n\nexport function updateInsertedCache(identifier: string, rule: string) {\n if (insertedSelectors[identifier]) return\n insertedSelectors[identifier] = rule\n if (identifier.startsWith('_transform')) {\n addTransform(identifier, rule)\n }\n}\n\nexport function insertStyleRule(identifier: string, rule: string) {\n if (allSelectors[identifier]) return\n hasInsertedSinceUpdate = true\n updateInsertedCache(identifier,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AG;AAC/D,eAAS,KAAI,GAAG,KAAI,MAAM,QAAQ,MAAK;AACrC,cAAM,OAAO,MAAM,KAAK,EAAC;AACzB,YAAI,CAAE,iBAAgB;AAAe;AACrC,cAAM,aAAa,KAAK,aAAa,MAAM,CAAC;AAC5C,YAAI,CAAC,aAAa,aAAa;AAC7B,uBAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,KAAK,UAAU;AACnF,cAAI,WAAW,WAAW,YAAY,GAAG;AACvC,yBAAa,YAAY,KAAK,SAAS,IAAI;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,2BAAyB;AAC3B;AA7BgB;AA+BhB,eAAe;AAEf,MAAM,QAAQ,WAAW,SAAS,KAAK,YAAY,SAAS,cAAc,OAAO,CAAC,EAAE,QAAQ;AAErF,6BAA6B,YAAoB,MAAc;AACpE,MAAI,kBAAkB;AAAa;AACnC,oBAAkB,cAAc;AAChC,MAAI,WAAW,WAAW,YAAY,GAAG;AACvC,iBAAa,YAAY,IAAI;AAAA,EAC/B;AACF;AANgB;AAQT,yBAAyB,YAAoB,MAAc;AAChE,MAAI,aAAa;AAAa;AAC9B,2BAAyB;AACzB,sBAAoB,YAAY,IAAI;AACpC,eAAa,cAAc,QAAQ,IAAI,aAAa,gBAAgB,OAAO;AAC3E,iCAAO,WAAW,MAAM,MAAM,SAAS;AACzC;AANgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -79,6 +79,7 @@ function insertStyleRule(identifier, rule) {
|
|
|
79
79
|
return;
|
|
80
80
|
hasInsertedSinceUpdate = true;
|
|
81
81
|
updateInsertedCache(identifier, rule);
|
|
82
|
+
allSelectors[identifier] = process.env.NODE_ENV === "development" ? rule : true;
|
|
82
83
|
sheet == null ? void 0 : sheet.insertRule(rule, sheet.cssRules.length);
|
|
83
84
|
}
|
|
84
85
|
__name(insertStyleRule, "insertStyleRule");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tamagui/helpers": "^1.0.0-beta.
|
|
22
|
+
"@tamagui/helpers": "^1.0.0-beta.7",
|
|
23
23
|
"@tamagui/ow": "^0.28.1",
|
|
24
|
-
"@tamagui/use-debounce": "^1.0.0-beta.
|
|
25
|
-
"@tamagui/use-force-update": "^1.0.0-beta.
|
|
24
|
+
"@tamagui/use-debounce": "^1.0.0-beta.7",
|
|
25
|
+
"@tamagui/use-force-update": "^1.0.0-beta.7",
|
|
26
26
|
"react": "*",
|
|
27
27
|
"react-dom": "*"
|
|
28
28
|
},
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"react-native-web": "*"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "^1.0.0-beta.
|
|
33
|
+
"@tamagui/build": "^1.0.0-beta.7",
|
|
34
34
|
"@types/react": "^17.0.35",
|
|
35
35
|
"csstype": "^3.0.10",
|
|
36
36
|
"esbuild": "^0.14.36",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,UAAqB,CAAA;AACjD,eAAO,MAAM,gBAAgB,iBAAyC,CAAA;AACtE,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AAgCxD,wBAAgB,cAAc,SA6B7B;AAMD,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAMnE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"insertStyleRule.d.ts","sourceRoot":"","sources":["../../src/helpers/insertStyleRule.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,IAAK,CAAA;AAEpC,eAAO,MAAM,eAAe,UAAqB,CAAA;AACjD,eAAO,MAAM,gBAAgB,iBAAyC,CAAA;AACtE,eAAO,MAAM,gBAAgB,UAA2B,CAAA;AAgCxD,wBAAgB,cAAc,SA6B7B;AAMD,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAMnE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAM/D"}
|