@tamagui/web 3.3.0 → 3.3.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/createTamagui.cjs +1 -1
- package/dist/cjs/createTamagui.native.cjs +1 -1
- package/dist/cjs/createTamagui.native.js +1 -1
- package/dist/cjs/createTamagui.native.js.map +1 -1
- package/dist/cjs/dom/htmlRuntime.native.cjs +3 -2
- package/dist/cjs/dom/htmlRuntime.native.js +3 -2
- package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
- package/dist/cjs/dom/primitives.native.cjs +13 -3
- package/dist/cjs/dom/primitives.native.js +13 -3
- package/dist/cjs/dom/primitives.native.js.map +1 -1
- package/dist/cjs/helpers/createDesignSystem.cjs +16 -9
- package/dist/cjs/helpers/createDesignSystem.native.cjs +43 -6
- package/dist/cjs/helpers/createDesignSystem.native.js +43 -6
- package/dist/cjs/helpers/createDesignSystem.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.cjs +19 -3
- package/dist/cjs/helpers/getThemeCSSRules.native.cjs +5 -1
- package/dist/cjs/helpers/getThemeCSSRules.native.js +5 -1
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +6 -0
- package/dist/cjs/helpers/styleStaticConfigCore.cjs +14 -2
- package/dist/cjs/helpers/styleStaticConfigCore.native.cjs +21 -9
- package/dist/cjs/helpers/styleStaticConfigCore.native.js +21 -9
- package/dist/cjs/helpers/styleStaticConfigCore.native.js.map +1 -1
- package/dist/cjs/styled.cjs +2 -1
- package/dist/cjs/styled.native.cjs +2 -1
- package/dist/cjs/styled.native.js +2 -1
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/esm/createTamagui.mjs +1 -1
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +1 -1
- package/dist/esm/createTamagui.native.js.map +1 -1
- package/dist/esm/dom/htmlRuntime.native.js +3 -2
- package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
- package/dist/esm/dom/primitives.native.js +13 -3
- package/dist/esm/dom/primitives.native.js.map +1 -1
- package/dist/esm/helpers/createDesignSystem.mjs +17 -10
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
- package/dist/esm/helpers/createDesignSystem.native.js +44 -7
- package/dist/esm/helpers/createDesignSystem.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs +16 -3
- package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js +2 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +6 -0
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/styleStaticConfigCore.mjs +14 -2
- package/dist/esm/helpers/styleStaticConfigCore.mjs.map +1 -1
- package/dist/esm/helpers/styleStaticConfigCore.native.js +21 -9
- package/dist/esm/helpers/styleStaticConfigCore.native.js.map +1 -1
- package/dist/esm/styled.mjs +2 -1
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +2 -1
- package/dist/esm/styled.native.js.map +1 -1
- package/package.json +18 -18
- package/src/createTamagui.ts +1 -1
- package/src/dom/htmlRuntime.native.tsx +3 -2
- package/src/dom/primitives.native.tsx +24 -5
- package/src/helpers/createDesignSystem.ts +16 -2
- package/src/helpers/getThemeCSSRules.native.ts +2 -0
- package/src/helpers/getThemeCSSRules.ts +34 -13
- package/src/helpers/insertStyleRule.tsx +11 -1
- package/src/helpers/styleStaticConfigCore.ts +13 -3
- package/src/styled.tsx +4 -1
- package/types/dom/htmlRuntime.native.d.ts.map +1 -1
- package/types/dom/primitives.native.d.ts.map +1 -1
- package/types/helpers/createDesignSystem.d.ts +1 -1
- package/types/helpers/createDesignSystem.d.ts.map +1 -1
- package/types/helpers/getThemeCSSRules.d.ts +3 -1
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
- package/types/helpers/getThemeCSSRules.native.d.ts +1 -0
- package/types/helpers/getThemeCSSRules.native.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/styleStaticConfigCore.d.ts.map +1 -1
- package/types/styled.d.ts.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isWeb } from "@tamagui/constants";
|
|
2
2
|
import { registerCSSVariable, variableToCSS } from "./registerCSSVariable.native.js";
|
|
3
|
-
import { getThemeCSSRules } from "./getThemeCSSRules.native.js";
|
|
3
|
+
import { getSharedThemeCSSRule, getThemeCSSRules } from "./getThemeCSSRules.native.js";
|
|
4
4
|
|
|
5
5
|
var isProd = process.env.NODE_ENV === "production";
|
|
6
6
|
function createTokenCSS(tokens, shouldTokenCategoryHaveUnits) {
|
|
@@ -126,29 +126,66 @@ function buildCSSRuleSets(declarations, fontDeclarations) {
|
|
|
126
126
|
return [];
|
|
127
127
|
}
|
|
128
128
|
function createThemeCSS(dedupedThemes, configIn) {
|
|
129
|
+
var colorTokens = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
129
130
|
if (!process.env.TAMAGUI_DID_OUTPUT_CSS) {
|
|
130
131
|
var themeRuleSets = [];
|
|
131
132
|
if (isWeb) {
|
|
133
|
+
var sharedKeys = new Set(dedupedThemes.length ? Object.keys(colorTokens) : []);
|
|
132
134
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
133
135
|
try {
|
|
134
136
|
for (var _iterator = dedupedThemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
135
|
-
var {
|
|
137
|
+
var { theme } = _step.value;
|
|
138
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
139
|
+
try {
|
|
140
|
+
for (var _iterator1 = sharedKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
141
|
+
var key = _step1.value;
|
|
142
|
+
var _theme_key;
|
|
143
|
+
if (((_theme_key = theme[key]) === null || _theme_key === void 0 ? void 0 : _theme_key.val) !== colorTokens[key].val) sharedKeys.delete(key);
|
|
144
|
+
}
|
|
145
|
+
} catch (err) {
|
|
146
|
+
_didIteratorError1 = true;
|
|
147
|
+
_iteratorError1 = err;
|
|
148
|
+
} finally {
|
|
149
|
+
try {
|
|
150
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
|
|
151
|
+
} finally {
|
|
152
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} catch (err) {
|
|
157
|
+
_didIteratorError = true;
|
|
158
|
+
_iteratorError = err;
|
|
159
|
+
} finally {
|
|
160
|
+
try {
|
|
161
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
162
|
+
} finally {
|
|
163
|
+
if (_didIteratorError) throw _iteratorError;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
var sharedRule = getSharedThemeCSSRule(colorTokens, sharedKeys);
|
|
167
|
+
if (sharedRule) themeRuleSets.push(sharedRule);
|
|
168
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
169
|
+
try {
|
|
170
|
+
for (var _iterator2 = dedupedThemes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
171
|
+
var { names, theme: theme1 } = _step2.value;
|
|
136
172
|
var nextRules = getThemeCSSRules({
|
|
137
173
|
config: configIn,
|
|
138
174
|
themeName: names[0],
|
|
139
175
|
names,
|
|
140
|
-
theme
|
|
176
|
+
theme: theme1,
|
|
177
|
+
sharedKeys
|
|
141
178
|
});
|
|
142
179
|
themeRuleSets = [...themeRuleSets, ...nextRules];
|
|
143
180
|
}
|
|
144
181
|
} catch (err) {
|
|
145
|
-
|
|
146
|
-
|
|
182
|
+
_didIteratorError2 = true;
|
|
183
|
+
_iteratorError2 = err;
|
|
147
184
|
} finally {
|
|
148
185
|
try {
|
|
149
|
-
if (!
|
|
186
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) _iterator2.return();
|
|
150
187
|
} finally {
|
|
151
|
-
if (
|
|
188
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
152
189
|
}
|
|
153
190
|
}
|
|
154
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDesignSystem.native.js","names":[],"sources":["esm/helpers/createDesignSystem.native.js"],"sourcesContent":["import { isWeb } from \"@tamagui/constants\";\nimport { registerCSSVariable, variableToCSS } from \"./registerCSSVariable\";\nimport { getThemeCSSRules } from \"./getThemeCSSRules\";\n\nvar isProd = process.env.NODE_ENV === \"production\";\nfunction createTokenCSS(tokens, shouldTokenCategoryHaveUnits) {\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tvar declarations = [];\n\t\tvar sortedTokenKeys = Object.keys(tokens).sort();\n\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\ttry {\n\t\t\tfor (var _iterator = sortedTokenKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\tvar key = _step.value;\n\t\t\t\tvar sortedSubKeys = Object.keys(tokens[key]).sort();\n\t\t\t\tvar _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tfor (var _iterator1 = sortedSubKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n\t\t\t\t\t\tvar skey = _step1.value;\n\t\t\t\t\t\tvar variable = tokens[key][skey];\n\t\t\t\t\t\tif (isWeb) {\n\t\t\t\t\t\t\tregisterCSSVariable(variable);\n\t\t\t\t\t\t\tvar variableNeedsPx = variable.needsPx === true;\n\t\t\t\t\t\t\tvar categoryNeedsPx = shouldTokenCategoryHaveUnits(key);\n\t\t\t\t\t\t\tvar shouldBeUnitless = !(variableNeedsPx || categoryNeedsPx);\n\t\t\t\t\t\t\tdeclarations.push(variableToCSS(variable, shouldBeUnitless));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\t_didIteratorError1 = true;\n\t\t\t\t\t_iteratorError1 = err;\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (_didIteratorError1) throw _iteratorError1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError = true;\n\t\t\t_iteratorError = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t}\n\t\t}\n\t\treturn declarations;\n\t}\n\treturn [];\n}\nfunction createFontCSS(fontsParsed, registerFontVariables) {\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tvar fontDeclarations = {};\n\t\tif (!fontsParsed) return fontDeclarations;\n\t\tvar sortedFontKeys = Object.keys(fontsParsed).sort();\n\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\ttry {\n\t\t\tfor (var _iterator = sortedFontKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\tvar key = _step.value;\n\t\t\t\tvar fontParsed = fontsParsed[key];\n\t\t\t\tvar [name, language] = key.includes(\"_\") ? key.split(\"_\") : [key];\n\t\t\t\tfontDeclarations[key] = {\n\t\t\t\t\tname,\n\t\t\t\t\tdeclarations: registerFontVariables(fontParsed),\n\t\t\t\t\tlanguage,\n\t\t\t\t\tfontParsed\n\t\t\t\t};\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError = true;\n\t\t\t_iteratorError = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t}\n\t\t}\n\t\treturn fontDeclarations;\n\t}\n\treturn {};\n}\nfunction buildCSSRuleSets(declarations, fontDeclarations) {\n\tvar defaultFontToken = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : \"\";\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tlet declarationsToRuleSet2 = function(decs) {\n\t\t\treturn `:root${arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"\"}${sep}{${sep}${[...decs].join(`;${sep}`)}${developmentWhitespace ? \"\\n\" : \"\"}}`;\n\t\t};\n\t\tvar cssRuleSets = [];\n\t\tvar developmentWhitespace = !isProd && process.env.NODE_ENV === \"development\";\n\t\tvar sep = developmentWhitespace ? \" \" : \"\";\n\t\tif (declarations.length) cssRuleSets.push(declarationsToRuleSet2(declarations));\n\t\tvar fontSelectors = [];\n\t\tvar sortedFontDeclarationKeys = Object.keys(fontDeclarations).sort();\n\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\ttry {\n\t\t\tfor (var _iterator = sortedFontDeclarationKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\tvar { name, declarations: _$declarations, language = \"default\" } = fontDeclarations[_step.value];\n\t\t\t\tvar fontSelector = `.font_${name}`;\n\t\t\t\tfontSelectors.push(fontSelector);\n\t\t\t\tvar langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`;\n\t\t\t\tvar specificRuleSet = declarationsToRuleSet2(_$declarations, language === \"default\" ? ` ${fontSelector}, ${langSelector}` : langSelector);\n\t\t\t\tcssRuleSets.push(specificRuleSet);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError = true;\n\t\t\t_iteratorError = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t}\n\t\t}\n\t\tif (fontSelectors.length) {\n\t\t\tvar defaultFont = fontDeclarations[defaultFontToken];\n\t\t\tif (defaultFont === null || defaultFont === void 0 ? void 0 : defaultFont.fontParsed) {\n\t\t\t\tvar sharedSelectors = `:where(${[...fontSelectors, \".is_View\"].join(\", \")})`;\n\t\t\t\tcssRuleSets.push(`${sharedSelectors}${sep}{font-family:${sep}var(--f-family)}`);\n\t\t\t}\n\t\t}\n\t\treturn cssRuleSets;\n\t}\n\treturn [];\n}\nfunction createThemeCSS(dedupedThemes, configIn) {\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tvar themeRuleSets = [];\n\t\tif (isWeb) {\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = dedupedThemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar { names, theme } = _step.value;\n\t\t\t\t\tvar nextRules = getThemeCSSRules({\n\t\t\t\t\t\tconfig: configIn,\n\t\t\t\t\t\tthemeName: names[0],\n\t\t\t\t\t\tnames,\n\t\t\t\t\t\ttheme\n\t\t\t\t\t});\n\t\t\t\t\tthemeRuleSets = [...themeRuleSets, ...nextRules];\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn themeRuleSets;\n\t}\n\treturn [];\n}\nfunction getCSS(themeConfig) {\n\targuments.length > 1 && arguments[1] !== void 0 && arguments[1];\n\targuments.length > 2 && arguments[2];\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS && false);\n\treturn \"\";\n}\n\nexport { buildCSSRuleSets, createFontCSS, createThemeCSS, createTokenCSS, getCSS };"],"mappings":";;;;;AAIA,IAAI,SAAS,QAAQ,IAAI,aAAa;AACtC,SAAS,eAAe,QAAQ,8BAA8B;CAC7D,IAAI,CAAC,QAAQ,IAAI,wBAAwB;EACxC,IAAI,eAAe,CAAC;EACpB,IAAI,kBAAkB,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK;EAC/C,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;EACvF,IAAI;GACH,KAAK,IAAI,YAAY,gBAAgB,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;IACjK,IAAI,MAAM,MAAM;IAChB,IAAI,gBAAgB,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,KAAK;IAClD,IAAI,6BAA6B,MAAM,qBAAqB,OAAO,kBAAkB,KAAK;IAC1F,IAAI;KACH,KAAK,IAAI,aAAa,cAAc,OAAO,SAAS,CAAC,GAAG,QAAQ,EAAE,8BAA8B,SAAS,WAAW,KAAK,EAAC,CAAE,OAAO,6BAA6B,MAAM;MACrK,IAAI,OAAO,OAAO;MAClB,IAAI,WAAW,OAAO,IAAI,CAAC;MAC3B,IAAI,OAAO;OACV,oBAAoB,QAAQ;OAC5B,IAAI,kBAAkB,SAAS,YAAY;OAC3C,IAAI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,IAAI,0BAA0B;CAC3C,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"createDesignSystem.native.js","names":[],"sources":["esm/helpers/createDesignSystem.native.js"],"sourcesContent":["import { isWeb } from \"@tamagui/constants\";\nimport { registerCSSVariable, variableToCSS } from \"./registerCSSVariable\";\nimport { getSharedThemeCSSRule, getThemeCSSRules } from \"./getThemeCSSRules\";\n\nvar isProd = process.env.NODE_ENV === \"production\";\nfunction createTokenCSS(tokens, shouldTokenCategoryHaveUnits) {\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tvar declarations = [];\n\t\tvar sortedTokenKeys = Object.keys(tokens).sort();\n\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\ttry {\n\t\t\tfor (var _iterator = sortedTokenKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\tvar key = _step.value;\n\t\t\t\tvar sortedSubKeys = Object.keys(tokens[key]).sort();\n\t\t\t\tvar _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tfor (var _iterator1 = sortedSubKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n\t\t\t\t\t\tvar skey = _step1.value;\n\t\t\t\t\t\tvar variable = tokens[key][skey];\n\t\t\t\t\t\tif (isWeb) {\n\t\t\t\t\t\t\tregisterCSSVariable(variable);\n\t\t\t\t\t\t\tvar variableNeedsPx = variable.needsPx === true;\n\t\t\t\t\t\t\tvar categoryNeedsPx = shouldTokenCategoryHaveUnits(key);\n\t\t\t\t\t\t\tvar shouldBeUnitless = !(variableNeedsPx || categoryNeedsPx);\n\t\t\t\t\t\t\tdeclarations.push(variableToCSS(variable, shouldBeUnitless));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\t_didIteratorError1 = true;\n\t\t\t\t\t_iteratorError1 = err;\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (_didIteratorError1) throw _iteratorError1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError = true;\n\t\t\t_iteratorError = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t}\n\t\t}\n\t\treturn declarations;\n\t}\n\treturn [];\n}\nfunction createFontCSS(fontsParsed, registerFontVariables) {\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tvar fontDeclarations = {};\n\t\tif (!fontsParsed) return fontDeclarations;\n\t\tvar sortedFontKeys = Object.keys(fontsParsed).sort();\n\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\ttry {\n\t\t\tfor (var _iterator = sortedFontKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\tvar key = _step.value;\n\t\t\t\tvar fontParsed = fontsParsed[key];\n\t\t\t\tvar [name, language] = key.includes(\"_\") ? key.split(\"_\") : [key];\n\t\t\t\tfontDeclarations[key] = {\n\t\t\t\t\tname,\n\t\t\t\t\tdeclarations: registerFontVariables(fontParsed),\n\t\t\t\t\tlanguage,\n\t\t\t\t\tfontParsed\n\t\t\t\t};\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError = true;\n\t\t\t_iteratorError = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t}\n\t\t}\n\t\treturn fontDeclarations;\n\t}\n\treturn {};\n}\nfunction buildCSSRuleSets(declarations, fontDeclarations) {\n\tvar defaultFontToken = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : \"\";\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tlet declarationsToRuleSet2 = function(decs) {\n\t\t\treturn `:root${arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : \"\"}${sep}{${sep}${[...decs].join(`;${sep}`)}${developmentWhitespace ? \"\\n\" : \"\"}}`;\n\t\t};\n\t\tvar cssRuleSets = [];\n\t\tvar developmentWhitespace = !isProd && process.env.NODE_ENV === \"development\";\n\t\tvar sep = developmentWhitespace ? \" \" : \"\";\n\t\tif (declarations.length) cssRuleSets.push(declarationsToRuleSet2(declarations));\n\t\tvar fontSelectors = [];\n\t\tvar sortedFontDeclarationKeys = Object.keys(fontDeclarations).sort();\n\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\ttry {\n\t\t\tfor (var _iterator = sortedFontDeclarationKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\tvar { name, declarations: _$declarations, language = \"default\" } = fontDeclarations[_step.value];\n\t\t\t\tvar fontSelector = `.font_${name}`;\n\t\t\t\tfontSelectors.push(fontSelector);\n\t\t\t\tvar langSelector = `:root .t_lang-${name}-${language} ${fontSelector}`;\n\t\t\t\tvar specificRuleSet = declarationsToRuleSet2(_$declarations, language === \"default\" ? ` ${fontSelector}, ${langSelector}` : langSelector);\n\t\t\t\tcssRuleSets.push(specificRuleSet);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError = true;\n\t\t\t_iteratorError = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t}\n\t\t}\n\t\tif (fontSelectors.length) {\n\t\t\tvar defaultFont = fontDeclarations[defaultFontToken];\n\t\t\tif (defaultFont === null || defaultFont === void 0 ? void 0 : defaultFont.fontParsed) {\n\t\t\t\tvar sharedSelectors = `:where(${[...fontSelectors, \".is_View\"].join(\", \")})`;\n\t\t\t\tcssRuleSets.push(`${sharedSelectors}${sep}{font-family:${sep}var(--f-family)}`);\n\t\t\t}\n\t\t}\n\t\treturn cssRuleSets;\n\t}\n\treturn [];\n}\nfunction createThemeCSS(dedupedThemes, configIn) {\n\tvar colorTokens = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS) {\n\t\tvar themeRuleSets = [];\n\t\tif (isWeb) {\n\t\t\tvar sharedKeys = new Set(dedupedThemes.length ? Object.keys(colorTokens) : []);\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = dedupedThemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar { theme } = _step.value;\n\t\t\t\t\tvar _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor (var _iterator1 = sharedKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n\t\t\t\t\t\t\tvar key = _step1.value;\n\t\t\t\t\t\t\tvar _theme_key;\n\t\t\t\t\t\t\tif (((_theme_key = theme[key]) === null || _theme_key === void 0 ? void 0 : _theme_key.val) !== colorTokens[key].val) sharedKeys.delete(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t_didIteratorError1 = true;\n\t\t\t\t\t\t_iteratorError1 = err;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (_didIteratorError1) throw _iteratorError1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar sharedRule = getSharedThemeCSSRule(colorTokens, sharedKeys);\n\t\t\tif (sharedRule) themeRuleSets.push(sharedRule);\n\t\t\tvar _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator2 = dedupedThemes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n\t\t\t\t\tvar { names, theme: theme1 } = _step2.value;\n\t\t\t\t\tvar nextRules = getThemeCSSRules({\n\t\t\t\t\t\tconfig: configIn,\n\t\t\t\t\t\tthemeName: names[0],\n\t\t\t\t\t\tnames,\n\t\t\t\t\t\ttheme: theme1,\n\t\t\t\t\t\tsharedKeys\n\t\t\t\t\t});\n\t\t\t\t\tthemeRuleSets = [...themeRuleSets, ...nextRules];\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError2 = true;\n\t\t\t\t_iteratorError2 = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion2 && _iterator2.return != null) _iterator2.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError2) throw _iteratorError2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn themeRuleSets;\n\t}\n\treturn [];\n}\nfunction getCSS(themeConfig) {\n\targuments.length > 1 && arguments[1] !== void 0 && arguments[1];\n\targuments.length > 2 && arguments[2];\n\tif (!process.env.TAMAGUI_DID_OUTPUT_CSS && false);\n\treturn \"\";\n}\n\nexport { buildCSSRuleSets, createFontCSS, createThemeCSS, createTokenCSS, getCSS };"],"mappings":";;;;;AAIA,IAAI,SAAS,QAAQ,IAAI,aAAa;AACtC,SAAS,eAAe,QAAQ,8BAA8B;CAC7D,IAAI,CAAC,QAAQ,IAAI,wBAAwB;EACxC,IAAI,eAAe,CAAC;EACpB,IAAI,kBAAkB,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK;EAC/C,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;EACvF,IAAI;GACH,KAAK,IAAI,YAAY,gBAAgB,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;IACjK,IAAI,MAAM,MAAM;IAChB,IAAI,gBAAgB,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,KAAK;IAClD,IAAI,6BAA6B,MAAM,qBAAqB,OAAO,kBAAkB,KAAK;IAC1F,IAAI;KACH,KAAK,IAAI,aAAa,cAAc,OAAO,SAAS,CAAC,GAAG,QAAQ,EAAE,8BAA8B,SAAS,WAAW,KAAK,EAAC,CAAE,OAAO,6BAA6B,MAAM;MACrK,IAAI,OAAO,OAAO;MAClB,IAAI,WAAW,OAAO,IAAI,CAAC;MAC3B,IAAI,OAAO;OACV,oBAAoB,QAAQ;OAC5B,IAAI,kBAAkB,SAAS,YAAY;OAC3C,IAAI,kBAAkB,6BAA6B,GAAG;OACtD,IAAI,mBAAmB,EAAE,mBAAmB;OAC5C,aAAa,KAAK,cAAc,UAAU,gBAAgB,CAAC;MAC5D;KACD;IACD,SAAS,KAAK;KACb,qBAAqB;KACrB,kBAAkB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F,UAAU;OACT,IAAI,oBAAoB,MAAM;MAC/B;KACD;IACD;GACD,SAAS,KAAK;IACb,oBAAoB;IACpB,iBAAiB;GAClB,UAAU;IACT,IAAI;KACH,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM,UAAU,OAAO;IAC9E,UAAU;KACT,IAAI,mBAAmB,MAAM;IAC9B;GACD;GACA,IAAI,aAAa,sBAAsB,aAAa,UAAU;GAC9D,IAAI,YAAY,cAAc,KAAK,UAAU;GAC7C,IAAI,6BAA6B,MAAM,qBAAqB,OAAO,kBAAkB,KAAK;GAC1F,IAAI;IACH,KAAK,IAAI,aAAa,cAAc,OAAO,SAAS,CAAC,GAAG,QAAQ,EAAE,8BAA8B,SAAS,WAAW,KAAK,EAAC,CAAE,OAAO,6BAA6B,MAAM;KACrK,IAAI,EAAE,OAAO,OAAO,WAAW,OAAO;KACtC,IAAI,YAAY,iBAAiB;MAChC,QAAQ;MACR,WAAW,MAAM;MACjB;MACA,OAAO;MACP;KACD,CAAC;KACD,gBAAgB,CAAC,GAAG,eAAe,GAAG,SAAS;IAChD;GACD,SAAS,KAAK;IACb,qBAAqB;IACrB,kBAAkB;GACnB,UAAU;IACT,IAAI;KACH,IAAI,CAAC,8BAA8B,WAAW,UAAU,MAAM,WAAW,OAAO;IACjF,UAAU;KACT,IAAI,oBAAoB,MAAM;IAC/B;GACD;EACD;EACA,OAAO;CACR;CACA,OAAO,CAAC;AACT;AACA,SAAS,OAAO,aAAa;CAC5B,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,KAAK,UAAU;CAC7D,UAAU,SAAS,KAAK,UAAU;CAClC,IAAI,CAAC,QAAQ,IAAI,0BAA0B;CAC3C,OAAO;AACR"}
|
|
@@ -9,8 +9,20 @@ import { getAuthoredThemeScheme, themeSchemeSelectorPrefix } from "./themes.mjs"
|
|
|
9
9
|
const isProd = process.env.NODE_ENV === "production";
|
|
10
10
|
const darkLight = ["dark", "light"];
|
|
11
11
|
const lightDark = ["light", "dark"];
|
|
12
|
+
const shouldBuildThemeCSS = () => !process.env.TAMAGUI_DID_OUTPUT_CSS && (!process.env.TAMAGUI_DOES_SSR_CSS || process.env.TAMAGUI_DOES_SSR_CSS === "mutates-themes" || process.env.TAMAGUI_DOES_SSR_CSS === "false");
|
|
13
|
+
const themeVarName = (themeKey) => `--${process.env.TAMAGUI_CSS_VARIABLE_PREFIX || ""}${simpleHash(themeKey, 40)}`;
|
|
14
|
+
function getSharedThemeCSSRule(colorTokens, keys) {
|
|
15
|
+
if (!shouldBuildThemeCSS()) return;
|
|
16
|
+
let vars = "";
|
|
17
|
+
for (const key of keys) {
|
|
18
|
+
const token = colorTokens[key];
|
|
19
|
+
vars += `${themeVarName(key)}:${getOrCreateVariable(token.val).variable};`;
|
|
20
|
+
}
|
|
21
|
+
if (!vars) return;
|
|
22
|
+
return `:root, .tm_xxt${!isProd && process.env.NODE_ENV === "development" ? " " : ""}{${vars}}`;
|
|
23
|
+
}
|
|
12
24
|
function getThemeCSSRules(props) {
|
|
13
|
-
if (
|
|
25
|
+
if (shouldBuildThemeCSS()) {
|
|
14
26
|
const cssRuleSets = [];
|
|
15
27
|
const { config, themeName, theme, names } = props;
|
|
16
28
|
const whitespace = !isProd && process.env.NODE_ENV === "development" ? " " : "";
|
|
@@ -21,9 +33,10 @@ function getThemeCSSRules(props) {
|
|
|
21
33
|
let vars = "";
|
|
22
34
|
const variableCreator = props.useMutatedVariables ? getOrCreateMutatedVariable : getOrCreateVariable;
|
|
23
35
|
for (const themeKey in theme) {
|
|
36
|
+
if (props.sharedKeys?.has(themeKey)) continue;
|
|
24
37
|
const variable = theme[themeKey];
|
|
25
38
|
const value = variableCreator(variable.needsPx ? `${variable.val}px` : variable.val).variable;
|
|
26
|
-
vars +=
|
|
39
|
+
vars += `${themeVarName(themeKey)}:${value};`;
|
|
27
40
|
}
|
|
28
41
|
const isDarkBase = themeName === "dark";
|
|
29
42
|
const isLightBase = themeName === "light";
|
|
@@ -120,5 +133,5 @@ const darkSelector = ".t_dark";
|
|
|
120
133
|
const lightSelector = ".t_light";
|
|
121
134
|
const isBaseTheme = (x) => x === darkSelector || x === lightSelector || x.startsWith(".t_dark ") || x.startsWith(".t_light ");
|
|
122
135
|
|
|
123
|
-
export { getThemeCSSRules };
|
|
136
|
+
export { getSharedThemeCSSRule, getThemeCSSRules };
|
|
124
137
|
//# sourceMappingURL=getThemeCSSRules.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThemeCSSRules.js","names":[],"sources":["esm/helpers/getThemeCSSRules.js"],"sourcesContent":["import { simpleHash } from \"@tamagui/helpers\";\nimport { getSetting } from \"../config\";\nimport { THEME_CLASSNAME_PREFIX } from \"../constants/constants\";\nimport { variableToString } from \"../createVariable\";\nimport { getOrCreateMutatedVariable, getOrCreateVariable } from \"./registerCSSVariable\";\nimport { sortString } from \"./sortString\";\nimport { getAuthoredThemeScheme, themeSchemeSelectorPrefix } from \"./themes\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\nconst darkLight = [\"dark\", \"light\"];\nconst lightDark = [\"light\", \"dark\"];\nfunction getThemeCSSRules(props) {\n\tif (process.env.TAMAGUI_DID_OUTPUT_CSS) {} else if (!process.env.TAMAGUI_DOES_SSR_CSS || process.env.TAMAGUI_DOES_SSR_CSS === \"mutates-themes\" || process.env.TAMAGUI_DOES_SSR_CSS === \"false\") {\n\t\tconst cssRuleSets = [];\n\t\tconst { config, themeName, theme, names } = props;\n\t\tconst whitespace = !isProd && process.env.NODE_ENV === \"development\" ? \" \" : \"\";\n\t\tconst mediaIndent = !isProd && process.env.NODE_ENV === \"development\" ? \"\\n \" : \"\";\n\t\tconst mediaClose = !isProd && process.env.NODE_ENV === \"development\" ? \"\\n \" : \"\";\n\t\tconst hasDarkLight = props.hasDarkLight ?? (config.themes && (\"light\" in config.themes || \"dark\" in config.themes));\n\t\tconst CNP = `.${THEME_CLASSNAME_PREFIX}`;\n\t\tlet vars = \"\";\n\t\tconst variableCreator = props.useMutatedVariables ? getOrCreateMutatedVariable : getOrCreateVariable;\n\t\tfor (const themeKey in theme) {\n\t\t\tconst variable = theme[themeKey];\n\t\t\tconst value = variableCreator(variable.needsPx ? `${variable.val}px` : variable.val).variable;\n\t\t\tvars += `--${process.env.TAMAGUI_CSS_VARIABLE_PREFIX || \"\"}${simpleHash(themeKey, 40)}:${value};`;\n\t\t}\n\t\tconst isDarkBase = themeName === \"dark\";\n\t\tconst isLightBase = themeName === \"light\";\n\t\tconst baseSelectors = names.map((name) => `${CNP}${name}`);\n\t\tconst selectorsSet = new Set(isDarkBase || isLightBase ? baseSelectors : []);\n\t\tconst selectorScheme = /* @__PURE__ */ new Map();\n\t\tfor (const name of names) selectorsSet.add(`${CNP}${name}:not(#t_theme_full_name)`);\n\t\tif (hasDarkLight) {\n\t\t\tconst maxDepth = 2;\n\t\t\tfor (const subName of names) {\n\t\t\t\tconst hasDarkPrefix = subName === \"dark\" || subName.startsWith(\"dark_\");\n\t\t\t\tconst hasLightPrefix = subName === \"light\" || subName.startsWith(\"light_\");\n\t\t\t\tconst isDark = hasDarkPrefix || !hasLightPrefix && isDarkBase;\n\t\t\t\tif (!(isDark || hasLightPrefix || !hasDarkPrefix && isLightBase)) {\n\t\t\t\t\tselectorsSet.add(`${CNP}${subName}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst childSelector = `${CNP}${subName.replace(/^(dark|light)_/, \"\")}`;\n\t\t\t\tconst [stronger, weaker] = isDark ? darkLight : lightDark;\n\t\t\t\tconst numSelectors = Math.round(maxDepth * 1.5);\n\t\t\t\tfor (let depth = 0; depth < numSelectors; depth++) {\n\t\t\t\t\tconst isOdd = depth % 2 === 1;\n\t\t\t\t\tif (isOdd && depth < 3) continue;\n\t\t\t\t\tconst parents = new Array(depth + 1).fill(0).map((_, idx) => {\n\t\t\t\t\t\treturn `${CNP}${idx % 2 === 0 ? stronger : weaker}`;\n\t\t\t\t\t});\n\t\t\t\t\tlet parentSelectors = parents.length > 1 ? parents.slice(1) : parents;\n\t\t\t\t\tif (isOdd) {\n\t\t\t\t\t\tconst [_first, second, ...rest] = parentSelectors;\n\t\t\t\t\t\tparentSelectors = [\n\t\t\t\t\t\t\tsecond,\n\t\t\t\t\t\t\t...rest,\n\t\t\t\t\t\t\tsecond\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\tconst nextChildSelector = childSelector === parentSelectors[parentSelectors.length - 1] ? \"\" : childSelector;\n\t\t\t\t\tconst selector = `${parentSelectors.join(\" \")} ${nextChildSelector}`;\n\t\t\t\t\tselectorsSet.add(selector);\n\t\t\t\t\tselectorScheme.set(selector, isDark ? \"dark\" : \"light\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst selectors = [...selectorsSet].sort(sortString);\n\t\tconst authoredScheme = getAuthoredThemeScheme(theme);\n\t\tconst css = `${selectors.map((x) => {\n\t\t\tconst addTo = getSetting(\"addThemeClassName\");\n\t\t\tif (!(isBaseTheme(x) && (addTo === \"html\" || addTo === \"body\"))) return `:root ${x}`;\n\t\t\treturn `${addTo === \"body\" ? \"body\" : \":root\"}${x}`;\n\t\t}).join(\", \") + `, .tm_xxt` + (authoredScheme ? `, ${themeSchemeSelectorPrefix}${authoredScheme}` : \"\")}${whitespace}{${vars}}`;\n\t\tcssRuleSets.push(css);\n\t\tif (getSetting(\"shouldAddPrefersColorThemes\")) {\n\t\t\tconst schemeOf = (x) => {\n\t\t\t\tif (x === darkSelector) return \"dark\";\n\t\t\t\tif (x === lightSelector) return \"light\";\n\t\t\t\tif (x.startsWith(`${darkSelector} `)) return \"dark\";\n\t\t\t\tif (x.startsWith(`${lightSelector} `)) return \"light\";\n\t\t\t\treturn selectorScheme.get(x);\n\t\t\t};\n\t\t\tfor (const baseName of lightDark) {\n\t\t\t\tconst lessSpecificSelectors = selectors.map((x) => {\n\t\t\t\t\tif (x === darkSelector || x === lightSelector) return schemeOf(x) === baseName ? \":root\" : void 0;\n\t\t\t\t\tconst scheme = schemeOf(x);\n\t\t\t\t\tif (scheme && scheme !== baseName) return;\n\t\t\t\t\treturn x.replace(/^\\.t_(dark|light) /, \"\").trim();\n\t\t\t\t}).filter(Boolean).join(\", \");\n\t\t\t\tif (!lessSpecificSelectors) continue;\n\t\t\t\tconst isBase = !themeName.includes(\"_\");\n\t\t\t\tlet bodyRulesString = \"\";\n\t\t\t\tif (isBase && themeName === baseName) {\n\t\t\t\t\tconst bgString = theme.background ? `background:${variableToString(theme.background)};` : \"\";\n\t\t\t\t\tconst fgString = theme.color ? `color:${variableToString(theme.color)}` : \"\";\n\t\t\t\t\tbodyRulesString = bgString || fgString ? `body{${bgString}${fgString}}${mediaIndent}` : \"\";\n\t\t\t\t}\n\t\t\t\tcssRuleSets.push(`@media(prefers-color-scheme:${baseName}){${mediaIndent}${bodyRulesString}${lessSpecificSelectors}${whitespace}{${vars}}${mediaClose}}`);\n\t\t\t}\n\t\t}\n\t\tconst selectionStyles = getSetting(\"selectionStyles\");\n\t\tif (selectionStyles) {\n\t\t\tconst rules = selectionStyles(theme);\n\t\t\tif (rules) {\n\t\t\t\tconst selectionSelectors = baseSelectors.map((s) => `${s} ::selection`).join(\", \");\n\t\t\t\tconst styles = Object.entries(rules).flatMap(([k, v]) => v ? `${k === \"backgroundColor\" ? \"background\" : k}:${variableToString(v)}` : []).join(\";\");\n\t\t\t\tif (styles) {\n\t\t\t\t\tconst css2 = `${selectionSelectors}{${styles}}`;\n\t\t\t\t\tcssRuleSets.push(css2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cssRuleSets;\n\t}\n\treturn [];\n}\nconst darkSelector = \".t_dark\";\nconst lightSelector = \".t_light\";\nconst isBaseTheme = (x) => x === darkSelector || x === lightSelector || x.startsWith(\".t_dark \") || x.startsWith(\".t_light \");\n\nexport { getThemeCSSRules };"],"mappings":";;;;;;;;;AAQA,MAAM,SAAS,QAAQ,IAAI,aAAa;AACxC,MAAM,YAAY,CAAC,QAAQ,OAAO;AAClC,MAAM,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EACpD,IAAI,iBAAiB;GACpB,MAAM,QAAQ,gBAAgB,KAAK;GACnC,IAAI,OAAO;IACV,MAAM,qBAAqB,cAAc,KAAK,MAAM,GAAG,EAAE,aAAa,CAAC,CAAC,KAAK,IAAI;IACjF,MAAM,SAAS,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,IAAI,GAAG,MAAM,oBAAoB,eAAe,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;IAClJ,IAAI,QAAQ;KACX,MAAM,OAAO,GAAG,mBAAmB,GAAG,OAAO;KAC7C,YAAY,KAAK,IAAI;IACtB;GACD;EACD;EACA,OAAO;CACR;CACA,OAAO,CAAC;AACT;AACA,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,eAAe,MAAM,MAAM,gBAAgB,MAAM,iBAAiB,EAAE,WAAW,UAAU,KAAK,EAAE,WAAW,WAAW"}
|
|
1
|
+
{"version":3,"file":"getThemeCSSRules.js","names":[],"sources":["esm/helpers/getThemeCSSRules.js"],"sourcesContent":["import { simpleHash } from \"@tamagui/helpers\";\nimport { getSetting } from \"../config\";\nimport { THEME_CLASSNAME_PREFIX } from \"../constants/constants\";\nimport { variableToString } from \"../createVariable\";\nimport { getOrCreateMutatedVariable, getOrCreateVariable } from \"./registerCSSVariable\";\nimport { sortString } from \"./sortString\";\nimport { getAuthoredThemeScheme, themeSchemeSelectorPrefix } from \"./themes\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\nconst darkLight = [\"dark\", \"light\"];\nconst lightDark = [\"light\", \"dark\"];\nconst shouldBuildThemeCSS = () => !process.env.TAMAGUI_DID_OUTPUT_CSS && (!process.env.TAMAGUI_DOES_SSR_CSS || process.env.TAMAGUI_DOES_SSR_CSS === \"mutates-themes\" || process.env.TAMAGUI_DOES_SSR_CSS === \"false\");\nconst themeVarName = (themeKey) => `--${process.env.TAMAGUI_CSS_VARIABLE_PREFIX || \"\"}${simpleHash(themeKey, 40)}`;\nfunction getSharedThemeCSSRule(colorTokens, keys) {\n\tif (!shouldBuildThemeCSS()) return;\n\tlet vars = \"\";\n\tfor (const key of keys) {\n\t\tconst token = colorTokens[key];\n\t\tvars += `${themeVarName(key)}:${getOrCreateVariable(token.val).variable};`;\n\t}\n\tif (!vars) return;\n\treturn `:root, .tm_xxt${!isProd && process.env.NODE_ENV === \"development\" ? \" \" : \"\"}{${vars}}`;\n}\nfunction getThemeCSSRules(props) {\n\tif (shouldBuildThemeCSS()) {\n\t\tconst cssRuleSets = [];\n\t\tconst { config, themeName, theme, names } = props;\n\t\tconst whitespace = !isProd && process.env.NODE_ENV === \"development\" ? \" \" : \"\";\n\t\tconst mediaIndent = !isProd && process.env.NODE_ENV === \"development\" ? \"\\n \" : \"\";\n\t\tconst mediaClose = !isProd && process.env.NODE_ENV === \"development\" ? \"\\n \" : \"\";\n\t\tconst hasDarkLight = props.hasDarkLight ?? (config.themes && (\"light\" in config.themes || \"dark\" in config.themes));\n\t\tconst CNP = `.${THEME_CLASSNAME_PREFIX}`;\n\t\tlet vars = \"\";\n\t\tconst variableCreator = props.useMutatedVariables ? getOrCreateMutatedVariable : getOrCreateVariable;\n\t\tfor (const themeKey in theme) {\n\t\t\tif (props.sharedKeys?.has(themeKey)) continue;\n\t\t\tconst variable = theme[themeKey];\n\t\t\tconst value = variableCreator(variable.needsPx ? `${variable.val}px` : variable.val).variable;\n\t\t\tvars += `${themeVarName(themeKey)}:${value};`;\n\t\t}\n\t\tconst isDarkBase = themeName === \"dark\";\n\t\tconst isLightBase = themeName === \"light\";\n\t\tconst baseSelectors = names.map((name) => `${CNP}${name}`);\n\t\tconst selectorsSet = new Set(isDarkBase || isLightBase ? baseSelectors : []);\n\t\tconst selectorScheme = /* @__PURE__ */ new Map();\n\t\tfor (const name of names) selectorsSet.add(`${CNP}${name}:not(#t_theme_full_name)`);\n\t\tif (hasDarkLight) {\n\t\t\tconst maxDepth = 2;\n\t\t\tfor (const subName of names) {\n\t\t\t\tconst hasDarkPrefix = subName === \"dark\" || subName.startsWith(\"dark_\");\n\t\t\t\tconst hasLightPrefix = subName === \"light\" || subName.startsWith(\"light_\");\n\t\t\t\tconst isDark = hasDarkPrefix || !hasLightPrefix && isDarkBase;\n\t\t\t\tif (!(isDark || hasLightPrefix || !hasDarkPrefix && isLightBase)) {\n\t\t\t\t\tselectorsSet.add(`${CNP}${subName}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst childSelector = `${CNP}${subName.replace(/^(dark|light)_/, \"\")}`;\n\t\t\t\tconst [stronger, weaker] = isDark ? darkLight : lightDark;\n\t\t\t\tconst numSelectors = Math.round(maxDepth * 1.5);\n\t\t\t\tfor (let depth = 0; depth < numSelectors; depth++) {\n\t\t\t\t\tconst isOdd = depth % 2 === 1;\n\t\t\t\t\tif (isOdd && depth < 3) continue;\n\t\t\t\t\tconst parents = new Array(depth + 1).fill(0).map((_, idx) => {\n\t\t\t\t\t\treturn `${CNP}${idx % 2 === 0 ? stronger : weaker}`;\n\t\t\t\t\t});\n\t\t\t\t\tlet parentSelectors = parents.length > 1 ? parents.slice(1) : parents;\n\t\t\t\t\tif (isOdd) {\n\t\t\t\t\t\tconst [_first, second, ...rest] = parentSelectors;\n\t\t\t\t\t\tparentSelectors = [\n\t\t\t\t\t\t\tsecond,\n\t\t\t\t\t\t\t...rest,\n\t\t\t\t\t\t\tsecond\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\tconst nextChildSelector = childSelector === parentSelectors[parentSelectors.length - 1] ? \"\" : childSelector;\n\t\t\t\t\tconst selector = `${parentSelectors.join(\" \")} ${nextChildSelector}`;\n\t\t\t\t\tselectorsSet.add(selector);\n\t\t\t\t\tselectorScheme.set(selector, isDark ? \"dark\" : \"light\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst selectors = [...selectorsSet].sort(sortString);\n\t\tconst authoredScheme = getAuthoredThemeScheme(theme);\n\t\tconst css = `${selectors.map((x) => {\n\t\t\tconst addTo = getSetting(\"addThemeClassName\");\n\t\t\tif (!(isBaseTheme(x) && (addTo === \"html\" || addTo === \"body\"))) return `:root ${x}`;\n\t\t\treturn `${addTo === \"body\" ? \"body\" : \":root\"}${x}`;\n\t\t}).join(\", \") + `, .tm_xxt` + (authoredScheme ? `, ${themeSchemeSelectorPrefix}${authoredScheme}` : \"\")}${whitespace}{${vars}}`;\n\t\tcssRuleSets.push(css);\n\t\tif (getSetting(\"shouldAddPrefersColorThemes\")) {\n\t\t\tconst schemeOf = (x) => {\n\t\t\t\tif (x === darkSelector) return \"dark\";\n\t\t\t\tif (x === lightSelector) return \"light\";\n\t\t\t\tif (x.startsWith(`${darkSelector} `)) return \"dark\";\n\t\t\t\tif (x.startsWith(`${lightSelector} `)) return \"light\";\n\t\t\t\treturn selectorScheme.get(x);\n\t\t\t};\n\t\t\tfor (const baseName of lightDark) {\n\t\t\t\tconst lessSpecificSelectors = selectors.map((x) => {\n\t\t\t\t\tif (x === darkSelector || x === lightSelector) return schemeOf(x) === baseName ? \":root\" : void 0;\n\t\t\t\t\tconst scheme = schemeOf(x);\n\t\t\t\t\tif (scheme && scheme !== baseName) return;\n\t\t\t\t\treturn x.replace(/^\\.t_(dark|light) /, \"\").trim();\n\t\t\t\t}).filter(Boolean).join(\", \");\n\t\t\t\tif (!lessSpecificSelectors) continue;\n\t\t\t\tconst isBase = !themeName.includes(\"_\");\n\t\t\t\tlet bodyRulesString = \"\";\n\t\t\t\tif (isBase && themeName === baseName) {\n\t\t\t\t\tconst bgString = theme.background ? `background:${variableToString(theme.background)};` : \"\";\n\t\t\t\t\tconst fgString = theme.color ? `color:${variableToString(theme.color)}` : \"\";\n\t\t\t\t\tbodyRulesString = bgString || fgString ? `body{${bgString}${fgString}}${mediaIndent}` : \"\";\n\t\t\t\t}\n\t\t\t\tcssRuleSets.push(`@media(prefers-color-scheme:${baseName}){${mediaIndent}${bodyRulesString}${lessSpecificSelectors}${whitespace}{${vars}}${mediaClose}}`);\n\t\t\t}\n\t\t}\n\t\tconst selectionStyles = getSetting(\"selectionStyles\");\n\t\tif (selectionStyles) {\n\t\t\tconst rules = selectionStyles(theme);\n\t\t\tif (rules) {\n\t\t\t\tconst selectionSelectors = baseSelectors.map((s) => `${s} ::selection`).join(\", \");\n\t\t\t\tconst styles = Object.entries(rules).flatMap(([k, v]) => v ? `${k === \"backgroundColor\" ? \"background\" : k}:${variableToString(v)}` : []).join(\";\");\n\t\t\t\tif (styles) {\n\t\t\t\t\tconst css2 = `${selectionSelectors}{${styles}}`;\n\t\t\t\t\tcssRuleSets.push(css2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cssRuleSets;\n\t}\n\treturn [];\n}\nconst darkSelector = \".t_dark\";\nconst lightSelector = \".t_light\";\nconst isBaseTheme = (x) => x === darkSelector || x === lightSelector || x.startsWith(\".t_dark \") || x.startsWith(\".t_light \");\n\nexport { getSharedThemeCSSRule, getThemeCSSRules };"],"mappings":";;;;;;;;;AAQA,MAAM,SAAS,QAAQ,IAAI,aAAa;AACxC,MAAM,YAAY,CAAC,QAAQ,OAAO;AAClC,MAAM,YAAY,CAAC,SAAS,MAAM;AAClC,MAAM,4BAA4B,CAAC,QAAQ,IAAI,2BAA2B,CAAC,QAAQ,IAAI,wBAAwB,QAAQ,IAAI,yBAAyB,oBAAoB,QAAQ,IAAI,yBAAyB;AAC7M,MAAM,gBAAgB,aAAa,KAAK,QAAQ,IAAI,+BAA+B,KAAK,WAAW,UAAU,EAAE;AAC/G,SAAS,sBAAsB,aAAa,MAAM;CACjD,IAAI,CAAC,oBAAoB,GAAG;CAC5B,IAAI,OAAO;CACX,KAAK,MAAM,OAAO,MAAM;EACvB,MAAM,QAAQ,YAAY;EAC1B,QAAQ,GAAG,aAAa,GAAG,EAAE,GAAG,oBAAoB,MAAM,GAAG,CAAC,CAAC,SAAS;CACzE;CACA,IAAI,CAAC,MAAM;CACX,OAAO,iBAAiB,CAAC,UAAU,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,OAAO;IACV,MAAM,qBAAqB,cAAc,KAAK,MAAM,GAAG,EAAE,aAAa,CAAC,CAAC,KAAK,IAAI;IACjF,MAAM,SAAS,OAAO,QAAQ,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,IAAI,GAAG,MAAM,oBAAoB,eAAe,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;IAClJ,IAAI,QAAQ;KACX,MAAM,OAAO,GAAG,mBAAmB,GAAG,OAAO;KAC7C,YAAY,KAAK,IAAI;IACtB;GACD;EACD;EACA,OAAO;CACR;CACA,OAAO,CAAC;AACT;AACA,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,eAAe,MAAM,MAAM,gBAAgB,MAAM,iBAAiB,EAAE,WAAW,UAAU,KAAK,EAAE,WAAW,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThemeCSSRules.native.js","names":[],"sources":["esm/helpers/getThemeCSSRules.native.js"],"sourcesContent":["function getThemeCSSRules() {\n return [];\n}\nexport {\n getThemeCSSRules\n};\n//# sourceMappingURL=getThemeCSSRules.native.js.map\n"],"mappings":";AAAA,SAAS,mBAAmB;CAC1B,OAAO,CAAC;AACV"}
|
|
1
|
+
{"version":3,"file":"getThemeCSSRules.native.js","names":[],"sources":["esm/helpers/getThemeCSSRules.native.js"],"sourcesContent":["function getThemeCSSRules() {\n return [];\n}\nfunction getSharedThemeCSSRule() {\n}\nexport {\n getSharedThemeCSSRule,\n getThemeCSSRules\n};\n//# sourceMappingURL=getThemeCSSRules.native.js.map\n"],"mappings":";AAAA,SAAS,mBAAmB;CAC1B,OAAO,CAAC;AACV;AACA,SAAS,wBAAwB,CACjC"}
|
|
@@ -130,6 +130,11 @@ function addThemesFromCSS(cssStyleRule, tokens) {
|
|
|
130
130
|
}
|
|
131
131
|
const rules = (cssStyleRule.cssText || "").slice(cssStyleRule.selectorText.length + 2, -1).split(";");
|
|
132
132
|
const values = {};
|
|
133
|
+
for (const key in tokens?.color) values[key] = createVariable({
|
|
134
|
+
key,
|
|
135
|
+
name: key,
|
|
136
|
+
val: tokens.color[key].val
|
|
137
|
+
}, true);
|
|
133
138
|
for (const rule of rules) {
|
|
134
139
|
const sepI = rule.indexOf(":");
|
|
135
140
|
if (sepI === -1) continue;
|
|
@@ -164,6 +169,7 @@ function addThemesFromCSS(cssStyleRule, tokens) {
|
|
|
164
169
|
const themeName = getThemeNameFromSelector(selector);
|
|
165
170
|
if (themeName) names.add(themeName);
|
|
166
171
|
}
|
|
172
|
+
if (!names.size) return;
|
|
167
173
|
return {
|
|
168
174
|
names: [...names],
|
|
169
175
|
theme: values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertStyleRule.js","names":[],"sources":["esm/helpers/insertStyleRule.js"],"sourcesContent":["import { StyleObjectIdentifier, StyleObjectRules } from \"@tamagui/helpers\";\nimport { createVariable } from \"../createVariable\";\nimport { formatDiagnostic } from \"./formatDiagnostic\";\nimport { setAuthoredThemeScheme, themeSchemeSelectorPrefix } from \"./themes\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\nconst scannedCache = /* @__PURE__ */ new WeakMap();\nconst totalSelectorsInserted = /* @__PURE__ */ new Map();\nconst allSelectors = {};\nconst allRules = {};\nconst allRuleSets = {};\nconst getAllSelectors = () => allSelectors;\nconst getRulesForIdentifier = (identifier) => allRuleSets[identifier];\nlet sortedRules = [];\nlet sortedRulesStale = true;\nconst getAllRules = () => {\n\tif (process.env.TAMAGUI_RUNTIME !== \"island\") {\n\t\tif (sortedRulesStale) {\n\t\t\tsortedRules = Object.keys(allRules).sort().map((key) => allRules[key]);\n\t\t\tsortedRulesStale = false;\n\t\t}\n\t\treturn sortedRules;\n\t}\n\treturn [];\n};\nfunction wrapStyleRules(css) {\n\tconst layer = process.env.TAMAGUI_CSS_LAYER;\n\treturn layer && css ? `@layer ${layer} {\n${css}\n}` : css;\n}\nlet lastScannedSheets = null;\nfunction scanAllSheets(collectThemes = false, tokens) {\n\tif (process.env.TAMAGUI_RUNTIME !== \"island\" || collectThemes) {\n\t\tif (!isProd && process.env.NODE_ENV === \"test\") return;\n\t\tif (typeof document === \"undefined\") return;\n\t\tlet themes;\n\t\tconst sheets = document.styleSheets || [];\n\t\tconst prev = lastScannedSheets;\n\t\tconst current = new Set(sheets);\n\t\tfor (const sheet2 of current) if (sheet2) {\n\t\t\tconst out = updateSheetStyles(sheet2, false, collectThemes, tokens);\n\t\t\tif (out) themes = out;\n\t\t}\n\t\tlastScannedSheets = current;\n\t\tif (prev) {\n\t\t\tfor (const sheet2 of prev) if (sheet2 && !current.has(sheet2)) updateSheetStyles(sheet2, true);\n\t\t}\n\t\treturn themes;\n\t}\n}\nfunction trackInsertedStyle(id) {\n\tconst next = (totalSelectorsInserted.get(id) || 0) + 1;\n\ttotalSelectorsInserted.set(id, next);\n\treturn next;\n}\nconst bailAfterEnv = process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES;\nconst bailAfter = bailAfterEnv ? +bailAfterEnv : 8e3;\nfunction updateSheetStyles(sheet2, remove = false, collectThemes = false, tokens) {\n\tlet rules;\n\ttry {\n\t\tif (!sheet2.cssRules) return;\n\t\trules = flattenCSSRules(sheet2.cssRules);\n\t} catch {\n\t\treturn;\n\t}\n\tconst firstSelector = getTamaguiSelector(rules[0], collectThemes)?.[0];\n\tconst lastSelector = getTamaguiSelector(rules[rules.length - 1], collectThemes)?.[0];\n\tconst cacheKey = `${rules.length}${firstSelector}${lastSelector}`;\n\tconst lastScanned = scannedCache.get(sheet2);\n\tif (!remove) {\n\t\tif (lastScanned === cacheKey) return;\n\t}\n\tconst len = rules.length;\n\tlet fails = 0;\n\tlet dedupedThemes;\n\tconst nameToTheme = {};\n\tfor (let i = 0; i < len; i++) {\n\t\tconst rule = rules[i];\n\t\tif (!(rule instanceof CSSStyleRule)) continue;\n\t\tconst response = getTamaguiSelector(rule, collectThemes);\n\t\tif (response) fails = 0;\n\t\telse {\n\t\t\tfails++;\n\t\t\tif (fails > bailAfter) return;\n\t\t\tcontinue;\n\t\t}\n\t\tconst [identifier, cssRule, isTheme] = response;\n\t\tif (isTheme) {\n\t\t\tconst deduped = addThemesFromCSS(cssRule, tokens);\n\t\t\tif (deduped) {\n\t\t\t\tfor (const name of deduped.names) if (nameToTheme[name]) {\n\t\t\t\t\tObject.apply(nameToTheme[name], deduped.theme);\n\t\t\t\t\tdeduped.names = deduped.names.filter((x) => x !== name);\n\t\t\t\t} else nameToTheme[name] = deduped.theme;\n\t\t\t\tdedupedThemes ||= [];\n\t\t\t\tdedupedThemes.push(deduped);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t}\n\tscannedCache.set(sheet2, cacheKey);\n\treturn dedupedThemes;\n}\nfunction flattenCSSRules(rules, output = []) {\n\tfor (let index = 0; index < rules.length; index++) {\n\t\tconst rule = rules[index];\n\t\tif (rule instanceof CSSStyleRule) {\n\t\t\toutput.push(rule);\n\t\t\tcontinue;\n\t\t}\n\t\tif (\"cssRules\" in rule) {\n\t\t\tconst nested = rule.cssRules;\n\t\t\tif (nested) flattenCSSRules(nested, output);\n\t\t}\n\t}\n\treturn output;\n}\nlet colorVarToVal;\nlet rootComputedStyle = null;\nfunction addThemesFromCSS(cssStyleRule, tokens) {\n\tconst selectors = cssStyleRule.selectorText.split(\",\");\n\tif (!selectors.length) return;\n\tif (tokens?.color && !colorVarToVal) {\n\t\tcolorVarToVal = {};\n\t\tfor (const key in tokens.color) {\n\t\t\tconst token = tokens.color[key];\n\t\t\tif (token) colorVarToVal[token.name] = token.val;\n\t\t}\n\t}\n\tconst rules = (cssStyleRule.cssText || \"\").slice(cssStyleRule.selectorText.length + 2, -1).split(\";\");\n\tconst values = {};\n\tfor (const rule of rules) {\n\t\tconst sepI = rule.indexOf(\":\");\n\t\tif (sepI === -1) continue;\n\t\tconst varIndex = rule.indexOf(\"--\");\n\t\tlet key = rule.slice(varIndex === -1 ? 0 : varIndex + 2, sepI);\n\t\tif (process.env.TAMAGUI_CSS_VARIABLE_PREFIX) key = key.replace(process.env.TAMAGUI_CSS_VARIABLE_PREFIX, \"\");\n\t\tconst val = rule.slice(sepI + 2);\n\t\tlet value;\n\t\tif (val[0] === \"v\" && val.startsWith(\"var(\")) {\n\t\t\tconst varName = val.slice(6, -1);\n\t\t\tconst tokenVal = colorVarToVal?.[varName];\n\t\t\tif (tokenVal) value = tokenVal;\n\t\t\telse {\n\t\t\t\trootComputedStyle ||= getComputedStyle(document.body);\n\t\t\t\tvalue = rootComputedStyle.getPropertyValue(\"--\" + varName);\n\t\t\t}\n\t\t} else value = val;\n\t\tvalues[key] = createVariable({\n\t\t\tkey,\n\t\t\tname: key,\n\t\t\tval: value\n\t\t}, true);\n\t}\n\tconst names = /* @__PURE__ */ new Set();\n\tfor (const selector of selectors) {\n\t\tconst marker = selector.trim();\n\t\tif (marker.startsWith(themeSchemeSelectorPrefix)) {\n\t\t\tconst scheme = marker.slice(themeSchemeSelectorPrefix.length);\n\t\t\tif (scheme === \"light\" || scheme === \"dark\") setAuthoredThemeScheme(values, scheme);\n\t\t\tcontinue;\n\t\t}\n\t\tconst themeName = getThemeNameFromSelector(selector);\n\t\tif (themeName) names.add(themeName);\n\t}\n\treturn {\n\t\tnames: [...names],\n\t\ttheme: values\n\t};\n}\nfunction getThemeNameFromSelector(selector) {\n\tif (selector === \" .tm_xxt\") return;\n\tconst lastThemeSelectorIndex = selector.lastIndexOf(\".t_\");\n\tif (lastThemeSelectorIndex === -1) return;\n\tconst name = selector.slice(lastThemeSelectorIndex + 3).match(/^[\\w-]+/)?.[0];\n\tif (!name) return;\n\tconst schemeChar = selector[lastThemeSelectorIndex - 5];\n\tconst scheme = schemeChar === \"d\" ? \"dark\" : schemeChar === \"i\" ? \"light\" : \"\";\n\tconst themeName = scheme && scheme !== name ? `${scheme}_${name}` : name;\n\tif (themeName === \"light_dark\" || themeName === \"dark_light\") return;\n\treturn themeName;\n}\nconst tamaguiSelectorRegex = /\\.tm_xxt/;\nfunction getTamaguiSelector(rule, collectThemes = false) {\n\tif (rule instanceof CSSStyleRule) {\n\t\tconst text = rule.selectorText;\n\t\tif (text[0] === \":\" && text[1] === \"r\" && tamaguiSelectorRegex.test(text)) {\n\t\t\tconst id = getIdentifierFromTamaguiSelector(text.replace(tamaguiSelectorRegex, \"\"));\n\t\t\treturn collectThemes ? [\n\t\t\t\tid,\n\t\t\t\trule,\n\t\t\t\ttrue\n\t\t\t] : [id, rule];\n\t\t}\n\t} else if (rule instanceof CSSMediaRule) {\n\t\tif (rule.cssRules.length > 1) return;\n\t\treturn getTamaguiSelector(rule.cssRules[0]);\n\t}\n}\nconst getIdentifierFromTamaguiSelector = (selector) => {\n\tconst dotIndex = selector.indexOf(\":\");\n\tif (dotIndex > -1) return selector.slice(7, dotIndex);\n\treturn selector.slice(7);\n};\nlet sheet = null;\nlet mountedProviders = 0;\nlet trackAllRules = true;\nfunction stopAccumulatingRules() {\n\tmountedProviders++;\n\ttrackAllRules = false;\n\treturn () => {\n\t\tmountedProviders--;\n\t\ttrackAllRules = mountedProviders === 0;\n\t};\n}\nfunction updateRules(identifier, rules) {\n\tif (process.env.TAMAGUI_RUNTIME !== \"island\" && trackAllRules) {\n\t\tallRules[identifier] = rules.join(\" \");\n\t\tallRuleSets[identifier] = rules;\n\t\tsortedRulesStale = true;\n\t}\n\treturn true;\n}\nlet nonce = \"\";\nfunction setNonce(_) {\n\tnonce = _;\n}\nfunction insertStyleRules(rulesToInsert) {\n\tif (process.env.TAMAGUI_RUNTIME === \"island\" || false) return;\n\tif (!sheet && document.head) {\n\t\tconst styleTag = document.createElement(\"style\");\n\t\tstyleTag.id = \"_tamagui-styles\";\n\t\tif (nonce) styleTag.nonce = nonce;\n\t\tconst rootSheet = document.head.appendChild(styleTag).sheet;\n\t\tconst layer = process.env.TAMAGUI_CSS_LAYER;\n\t\tif (rootSheet && layer) {\n\t\t\trootSheet.insertRule(`@layer ${layer} {}`, rootSheet.cssRules.length);\n\t\t\tconst layerRule = rootSheet.cssRules[rootSheet.cssRules.length - 1];\n\t\t\tsheet = \"cssRules\" in layerRule && \"insertRule\" in layerRule ? layerRule : rootSheet;\n\t\t} else sheet = rootSheet;\n\t}\n\tif (!sheet) return;\n\tfor (const key in rulesToInsert) {\n\t\tconst styleObject = rulesToInsert[key];\n\t\tconst identifier = styleObject[StyleObjectIdentifier];\n\t\tif (!shouldInsertStyleRules(identifier)) continue;\n\t\tconst rules = styleObject[StyleObjectRules];\n\t\tallSelectors[identifier] = rules.join(\"\\n\");\n\t\ttrackInsertedStyle(identifier);\n\t\tupdateRules(identifier, rules);\n\t\ttry {\n\t\t\tfor (const rule of rules) sheet.insertRule(rule, sheet.cssRules.length);\n\t\t} catch (err) {\n\t\t\tif (!isProd && process.env.NODE_ENV === \"development\") {\n\t\t\t\tconst rule = rules[0] || \"\";\n\t\t\t\tconst selectorEnd = rule.indexOf(\"{\");\n\t\t\t\tconst owner = \"ownerNode\" in sheet ? sheet.ownerNode : null;\n\t\t\t\tconsole.error(formatDiagnostic(\"TAMAGUI_STYLE_INSERT\", \"insertStyleRules\", \"the stylesheet rejected a generated rule\", \"Fix or remove the invalid style declaration\", \"identifier,selector,target\", {\n\t\t\t\t\tidentifier,\n\t\t\t\t\tselector: (selectorEnd === -1 ? rule : rule.slice(0, selectorEnd)).trim(),\n\t\t\t\t\ttarget: owner ? `${owner.nodeName.toLowerCase()}${owner.id ? `#${owner.id}` : \"\"}` : sheet.constructor?.name || \"CSSStyleSheet\"\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\t}\n}\nconst maxToInsert = process.env.TAMAGUI_INSERT_SELECTOR_TRIES ? +process.env.TAMAGUI_INSERT_SELECTOR_TRIES : 1;\nfunction shouldInsertStyleRules(identifier) {\n\tif (process.env.IS_STATIC === \"is_static\") return true;\n\tconst total = totalSelectorsInserted.get(identifier) || 0;\n\tif (!isProd && process.env.NODE_ENV === \"development\") {\n\t\tif (total > +(process.env.TAMAGUI_STYLE_INSERTION_WARNING_LIMIT || 10)) console.warn(`Warning: inserting many CSS rules, you may be animating something and generating many CSS insertions, which can degrade performance. Instead, try using the \"disableClassName\" property on elements that change styles often. To disable this warning set TAMAGUI_STYLE_INSERTION_WARNING_LIMIT from 50000 to something higher`);\n\t}\n\treturn total < maxToInsert;\n}\n\nexport { getAllRules, getAllSelectors, getRulesForIdentifier, getThemeNameFromSelector, insertStyleRules, scanAllSheets, setNonce, shouldInsertStyleRules, stopAccumulatingRules, updateRules, wrapStyleRules };"],"mappings":";;;;;;AAKA,MAAM,SAAS,QAAQ,IAAI,aAAa;AACxC,MAAM,+BAA+B,IAAI,QAAQ;AACjD,MAAM,yCAAyC,IAAI,IAAI;AACvD,MAAM,eAAe,CAAC;AACtB,MAAM,WAAW,CAAC;AAClB,MAAM,cAAc,CAAC;AACrB,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB,eAAe,YAAY;AAC1D,IAAI,cAAc,CAAC;AACnB,IAAI,mBAAmB;AACvB,MAAM,oBAAoB;CACzB,IAAI,QAAQ,IAAI,oBAAoB,UAAU;EAC7C,IAAI,kBAAkB;GACrB,cAAc,OAAO,KAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,QAAQ,SAAS,IAAI;GACrE,mBAAmB;EACpB;EACA,OAAO;CACR;CACA,OAAO,CAAC;AACT;AACA,SAAS,eAAe,KAAK;CAC5B,MAAM,QAAQ,QAAQ,IAAI;CAC1B,OAAO,SAAS,MAAM,UAAU,MAAM;EACrC,IAAI;KACD;AACL;AACA,IAAI,oBAAoB;AACxB,SAAS,cAAc,gBAAgB,OAAO,QAAQ;CACrD,IAAI,QAAQ,IAAI,oBAAoB,YAAY,eAAe;EAC9D,IAAI,CAAC,UAAU,QAAQ,IAAI,aAAa,QAAQ;EAChD,IAAI,OAAO,aAAa,aAAa;EACrC,IAAI;EACJ,MAAM,SAAS,SAAS,eAAe,CAAC;EACxC,MAAM,OAAO;EACb,MAAM,UAAU,IAAI,I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AM,cAAc,QAAQ,IAAI,gCAAgC,CAAC,QAAQ,IAAI,gCAAgC;AAC7G,SAAS,uBAAuB,YAAY;CAC3C,IAAI,QAAQ,IAAI,cAAc,aAAa,OAAO;CAClD,MAAM,QAAQ,uBAAuB,IAAI,UAAU,KAAK;CACxD,IAAI,CAAC,UAAU,QAAQ,IAAI,aAAa,eAAe;EACtD,IAAI,QAAQ,EAAE,QAAQ,IAAI,yCAAyC,KAAK,QAAQ,KAAK,gUAAgU;CACtZ;CACA,OAAO,QAAQ;AAChB"}
|
|
1
|
+
{"version":3,"file":"insertStyleRule.js","names":[],"sources":["esm/helpers/insertStyleRule.js"],"sourcesContent":["import { StyleObjectIdentifier, StyleObjectRules } from \"@tamagui/helpers\";\nimport { createVariable } from \"../createVariable\";\nimport { formatDiagnostic } from \"./formatDiagnostic\";\nimport { setAuthoredThemeScheme, themeSchemeSelectorPrefix } from \"./themes\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\nconst scannedCache = /* @__PURE__ */ new WeakMap();\nconst totalSelectorsInserted = /* @__PURE__ */ new Map();\nconst allSelectors = {};\nconst allRules = {};\nconst allRuleSets = {};\nconst getAllSelectors = () => allSelectors;\nconst getRulesForIdentifier = (identifier) => allRuleSets[identifier];\nlet sortedRules = [];\nlet sortedRulesStale = true;\nconst getAllRules = () => {\n\tif (process.env.TAMAGUI_RUNTIME !== \"island\") {\n\t\tif (sortedRulesStale) {\n\t\t\tsortedRules = Object.keys(allRules).sort().map((key) => allRules[key]);\n\t\t\tsortedRulesStale = false;\n\t\t}\n\t\treturn sortedRules;\n\t}\n\treturn [];\n};\nfunction wrapStyleRules(css) {\n\tconst layer = process.env.TAMAGUI_CSS_LAYER;\n\treturn layer && css ? `@layer ${layer} {\n${css}\n}` : css;\n}\nlet lastScannedSheets = null;\nfunction scanAllSheets(collectThemes = false, tokens) {\n\tif (process.env.TAMAGUI_RUNTIME !== \"island\" || collectThemes) {\n\t\tif (!isProd && process.env.NODE_ENV === \"test\") return;\n\t\tif (typeof document === \"undefined\") return;\n\t\tlet themes;\n\t\tconst sheets = document.styleSheets || [];\n\t\tconst prev = lastScannedSheets;\n\t\tconst current = new Set(sheets);\n\t\tfor (const sheet2 of current) if (sheet2) {\n\t\t\tconst out = updateSheetStyles(sheet2, false, collectThemes, tokens);\n\t\t\tif (out) themes = out;\n\t\t}\n\t\tlastScannedSheets = current;\n\t\tif (prev) {\n\t\t\tfor (const sheet2 of prev) if (sheet2 && !current.has(sheet2)) updateSheetStyles(sheet2, true);\n\t\t}\n\t\treturn themes;\n\t}\n}\nfunction trackInsertedStyle(id) {\n\tconst next = (totalSelectorsInserted.get(id) || 0) + 1;\n\ttotalSelectorsInserted.set(id, next);\n\treturn next;\n}\nconst bailAfterEnv = process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES;\nconst bailAfter = bailAfterEnv ? +bailAfterEnv : 8e3;\nfunction updateSheetStyles(sheet2, remove = false, collectThemes = false, tokens) {\n\tlet rules;\n\ttry {\n\t\tif (!sheet2.cssRules) return;\n\t\trules = flattenCSSRules(sheet2.cssRules);\n\t} catch {\n\t\treturn;\n\t}\n\tconst firstSelector = getTamaguiSelector(rules[0], collectThemes)?.[0];\n\tconst lastSelector = getTamaguiSelector(rules[rules.length - 1], collectThemes)?.[0];\n\tconst cacheKey = `${rules.length}${firstSelector}${lastSelector}`;\n\tconst lastScanned = scannedCache.get(sheet2);\n\tif (!remove) {\n\t\tif (lastScanned === cacheKey) return;\n\t}\n\tconst len = rules.length;\n\tlet fails = 0;\n\tlet dedupedThemes;\n\tconst nameToTheme = {};\n\tfor (let i = 0; i < len; i++) {\n\t\tconst rule = rules[i];\n\t\tif (!(rule instanceof CSSStyleRule)) continue;\n\t\tconst response = getTamaguiSelector(rule, collectThemes);\n\t\tif (response) fails = 0;\n\t\telse {\n\t\t\tfails++;\n\t\t\tif (fails > bailAfter) return;\n\t\t\tcontinue;\n\t\t}\n\t\tconst [identifier, cssRule, isTheme] = response;\n\t\tif (isTheme) {\n\t\t\tconst deduped = addThemesFromCSS(cssRule, tokens);\n\t\t\tif (deduped) {\n\t\t\t\tfor (const name of deduped.names) if (nameToTheme[name]) {\n\t\t\t\t\tObject.apply(nameToTheme[name], deduped.theme);\n\t\t\t\t\tdeduped.names = deduped.names.filter((x) => x !== name);\n\t\t\t\t} else nameToTheme[name] = deduped.theme;\n\t\t\t\tdedupedThemes ||= [];\n\t\t\t\tdedupedThemes.push(deduped);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t}\n\tscannedCache.set(sheet2, cacheKey);\n\treturn dedupedThemes;\n}\nfunction flattenCSSRules(rules, output = []) {\n\tfor (let index = 0; index < rules.length; index++) {\n\t\tconst rule = rules[index];\n\t\tif (rule instanceof CSSStyleRule) {\n\t\t\toutput.push(rule);\n\t\t\tcontinue;\n\t\t}\n\t\tif (\"cssRules\" in rule) {\n\t\t\tconst nested = rule.cssRules;\n\t\t\tif (nested) flattenCSSRules(nested, output);\n\t\t}\n\t}\n\treturn output;\n}\nlet colorVarToVal;\nlet rootComputedStyle = null;\nfunction addThemesFromCSS(cssStyleRule, tokens) {\n\tconst selectors = cssStyleRule.selectorText.split(\",\");\n\tif (!selectors.length) return;\n\tif (tokens?.color && !colorVarToVal) {\n\t\tcolorVarToVal = {};\n\t\tfor (const key in tokens.color) {\n\t\t\tconst token = tokens.color[key];\n\t\t\tif (token) colorVarToVal[token.name] = token.val;\n\t\t}\n\t}\n\tconst rules = (cssStyleRule.cssText || \"\").slice(cssStyleRule.selectorText.length + 2, -1).split(\";\");\n\tconst values = {};\n\tfor (const key in tokens?.color) values[key] = createVariable({\n\t\tkey,\n\t\tname: key,\n\t\tval: tokens.color[key].val\n\t}, true);\n\tfor (const rule of rules) {\n\t\tconst sepI = rule.indexOf(\":\");\n\t\tif (sepI === -1) continue;\n\t\tconst varIndex = rule.indexOf(\"--\");\n\t\tlet key = rule.slice(varIndex === -1 ? 0 : varIndex + 2, sepI);\n\t\tif (process.env.TAMAGUI_CSS_VARIABLE_PREFIX) key = key.replace(process.env.TAMAGUI_CSS_VARIABLE_PREFIX, \"\");\n\t\tconst val = rule.slice(sepI + 2);\n\t\tlet value;\n\t\tif (val[0] === \"v\" && val.startsWith(\"var(\")) {\n\t\t\tconst varName = val.slice(6, -1);\n\t\t\tconst tokenVal = colorVarToVal?.[varName];\n\t\t\tif (tokenVal) value = tokenVal;\n\t\t\telse {\n\t\t\t\trootComputedStyle ||= getComputedStyle(document.body);\n\t\t\t\tvalue = rootComputedStyle.getPropertyValue(\"--\" + varName);\n\t\t\t}\n\t\t} else value = val;\n\t\tvalues[key] = createVariable({\n\t\t\tkey,\n\t\t\tname: key,\n\t\t\tval: value\n\t\t}, true);\n\t}\n\tconst names = /* @__PURE__ */ new Set();\n\tfor (const selector of selectors) {\n\t\tconst marker = selector.trim();\n\t\tif (marker.startsWith(themeSchemeSelectorPrefix)) {\n\t\t\tconst scheme = marker.slice(themeSchemeSelectorPrefix.length);\n\t\t\tif (scheme === \"light\" || scheme === \"dark\") setAuthoredThemeScheme(values, scheme);\n\t\t\tcontinue;\n\t\t}\n\t\tconst themeName = getThemeNameFromSelector(selector);\n\t\tif (themeName) names.add(themeName);\n\t}\n\tif (!names.size) return;\n\treturn {\n\t\tnames: [...names],\n\t\ttheme: values\n\t};\n}\nfunction getThemeNameFromSelector(selector) {\n\tif (selector === \" .tm_xxt\") return;\n\tconst lastThemeSelectorIndex = selector.lastIndexOf(\".t_\");\n\tif (lastThemeSelectorIndex === -1) return;\n\tconst name = selector.slice(lastThemeSelectorIndex + 3).match(/^[\\w-]+/)?.[0];\n\tif (!name) return;\n\tconst schemeChar = selector[lastThemeSelectorIndex - 5];\n\tconst scheme = schemeChar === \"d\" ? \"dark\" : schemeChar === \"i\" ? \"light\" : \"\";\n\tconst themeName = scheme && scheme !== name ? `${scheme}_${name}` : name;\n\tif (themeName === \"light_dark\" || themeName === \"dark_light\") return;\n\treturn themeName;\n}\nconst tamaguiSelectorRegex = /\\.tm_xxt/;\nfunction getTamaguiSelector(rule, collectThemes = false) {\n\tif (rule instanceof CSSStyleRule) {\n\t\tconst text = rule.selectorText;\n\t\tif (text[0] === \":\" && text[1] === \"r\" && tamaguiSelectorRegex.test(text)) {\n\t\t\tconst id = getIdentifierFromTamaguiSelector(text.replace(tamaguiSelectorRegex, \"\"));\n\t\t\treturn collectThemes ? [\n\t\t\t\tid,\n\t\t\t\trule,\n\t\t\t\ttrue\n\t\t\t] : [id, rule];\n\t\t}\n\t} else if (rule instanceof CSSMediaRule) {\n\t\tif (rule.cssRules.length > 1) return;\n\t\treturn getTamaguiSelector(rule.cssRules[0]);\n\t}\n}\nconst getIdentifierFromTamaguiSelector = (selector) => {\n\tconst dotIndex = selector.indexOf(\":\");\n\tif (dotIndex > -1) return selector.slice(7, dotIndex);\n\treturn selector.slice(7);\n};\nlet sheet = null;\nlet mountedProviders = 0;\nlet trackAllRules = true;\nfunction stopAccumulatingRules() {\n\tmountedProviders++;\n\ttrackAllRules = false;\n\treturn () => {\n\t\tmountedProviders--;\n\t\ttrackAllRules = mountedProviders === 0;\n\t};\n}\nfunction updateRules(identifier, rules) {\n\tif (process.env.TAMAGUI_RUNTIME !== \"island\" && trackAllRules) {\n\t\tallRules[identifier] = rules.join(\" \");\n\t\tallRuleSets[identifier] = rules;\n\t\tsortedRulesStale = true;\n\t}\n\treturn true;\n}\nlet nonce = \"\";\nfunction setNonce(_) {\n\tnonce = _;\n}\nfunction insertStyleRules(rulesToInsert) {\n\tif (process.env.TAMAGUI_RUNTIME === \"island\" || false) return;\n\tif (!sheet && document.head) {\n\t\tconst styleTag = document.createElement(\"style\");\n\t\tstyleTag.id = \"_tamagui-styles\";\n\t\tif (nonce) styleTag.nonce = nonce;\n\t\tconst rootSheet = document.head.appendChild(styleTag).sheet;\n\t\tconst layer = process.env.TAMAGUI_CSS_LAYER;\n\t\tif (rootSheet && layer) {\n\t\t\trootSheet.insertRule(`@layer ${layer} {}`, rootSheet.cssRules.length);\n\t\t\tconst layerRule = rootSheet.cssRules[rootSheet.cssRules.length - 1];\n\t\t\tsheet = \"cssRules\" in layerRule && \"insertRule\" in layerRule ? layerRule : rootSheet;\n\t\t} else sheet = rootSheet;\n\t}\n\tif (!sheet) return;\n\tfor (const key in rulesToInsert) {\n\t\tconst styleObject = rulesToInsert[key];\n\t\tconst identifier = styleObject[StyleObjectIdentifier];\n\t\tif (!shouldInsertStyleRules(identifier)) continue;\n\t\tconst rules = styleObject[StyleObjectRules];\n\t\tallSelectors[identifier] = rules.join(\"\\n\");\n\t\ttrackInsertedStyle(identifier);\n\t\tupdateRules(identifier, rules);\n\t\ttry {\n\t\t\tfor (const rule of rules) sheet.insertRule(rule, sheet.cssRules.length);\n\t\t} catch (err) {\n\t\t\tif (!isProd && process.env.NODE_ENV === \"development\") {\n\t\t\t\tconst rule = rules[0] || \"\";\n\t\t\t\tconst selectorEnd = rule.indexOf(\"{\");\n\t\t\t\tconst owner = \"ownerNode\" in sheet ? sheet.ownerNode : null;\n\t\t\t\tconsole.error(formatDiagnostic(\"TAMAGUI_STYLE_INSERT\", \"insertStyleRules\", \"the stylesheet rejected a generated rule\", \"Fix or remove the invalid style declaration\", \"identifier,selector,target\", {\n\t\t\t\t\tidentifier,\n\t\t\t\t\tselector: (selectorEnd === -1 ? rule : rule.slice(0, selectorEnd)).trim(),\n\t\t\t\t\ttarget: owner ? `${owner.nodeName.toLowerCase()}${owner.id ? `#${owner.id}` : \"\"}` : sheet.constructor?.name || \"CSSStyleSheet\"\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\t}\n}\nconst maxToInsert = process.env.TAMAGUI_INSERT_SELECTOR_TRIES ? +process.env.TAMAGUI_INSERT_SELECTOR_TRIES : 1;\nfunction shouldInsertStyleRules(identifier) {\n\tif (process.env.IS_STATIC === \"is_static\") return true;\n\tconst total = totalSelectorsInserted.get(identifier) || 0;\n\tif (!isProd && process.env.NODE_ENV === \"development\") {\n\t\tif (total > +(process.env.TAMAGUI_STYLE_INSERTION_WARNING_LIMIT || 10)) console.warn(`Warning: inserting many CSS rules, you may be animating something and generating many CSS insertions, which can degrade performance. Instead, try using the \"disableClassName\" property on elements that change styles often. To disable this warning set TAMAGUI_STYLE_INSERTION_WARNING_LIMIT from 50000 to something higher`);\n\t}\n\treturn total < maxToInsert;\n}\n\nexport { getAllRules, getAllSelectors, getRulesForIdentifier, getThemeNameFromSelector, insertStyleRules, scanAllSheets, setNonce, shouldInsertStyleRules, stopAccumulatingRules, updateRules, wrapStyleRules };"],"mappings":";;;;;;AAKA,MAAM,SAAS,QAAQ,IAAI,aAAa;AACxC,MAAM,+BAA+B,IAAI,QAAQ;AACjD,MAAM,yCAAyC,IAAI,IAAI;AACvD,MAAM,eAAe,CAAC;AACtB,MAAM,WAAW,CAAC;AAClB,MAAM,cAAc,CAAC;AACrB,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB,eAAe,YAAY;AAC1D,IAAI,cAAc,CAAC;AACnB,IAAI,mBAAmB;AACvB,MAAM,oBAAoB;CACzB,IAAI,QAAQ,IAAI,oBAAoB,UAAU;EAC7C,IAAI,kBAAkB;GACrB,cAAc,OAAO,KAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,QAAQ,SAAS,IAAI;GACrE,mBAAmB;EACpB;EACA,OAAO;CACR;CACA,OAAO,CAAC;AACT;AACA,SAAS,eAAe,KAAK;CAC5B,MAAM,QAAQ,QAAQ,IAAI;CAC1B,OAAO,SAAS,MAAM,UAAU,MAAM;EACrC,IAAI;KACD;AACL;AACA,IAAI,oBAAoB;AACxB,SAAS,cAAc,gBAAgB,OAAO,QAAQ;CACrD,IAAI,QAAQ,IAAI,oBAAoB,YAAY,eAAe;EAC9D,IAAI,CAAC,UAAU,QAAQ,IAAI,aAAa,QAAQ;EAChD,IAAI,OAAO,aAAa,aAAa;EACrC,IAAI;EACJ,MAAM,SAAS,SAAS,eAAe,CAAC;EACxC,MAAM,OAAO;EACb,MAAM,UAAU,IAAI,IAAI,MAAM;EAC9B,K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AAQ,GAAG,MAAM,SAAS,YAAY,IAAI,MAAM,KAAK,IAAI,MAAM,OAAO,OAAO,MAAM,aAAa,QAAQ;IACjH,CAAC,CAAC;GACH;EACD;CACD;AACD;AACA,MAAM,cAAc,QAAQ,IAAI,gCAAgC,CAAC,QAAQ,IAAI,gCAAgC;AAC7G,SAAS,uBAAuB,YAAY;CAC3C,IAAI,QAAQ,IAAI,cAAc,aAAa,OAAO;CAClD,MAAM,QAAQ,uBAAuB,IAAI,UAAU,KAAK;CACxD,IAAI,CAAC,UAAU,QAAQ,IAAI,aAAa,eAAe;EACtD,IAAI,QAAQ,EAAE,QAAQ,IAAI,yCAAyC,KAAK,QAAQ,KAAK,gUAAgU;CACtZ;CACA,OAAO,QAAQ;AAChB"}
|
|
@@ -20,9 +20,12 @@ function resolveStyleStaticConfig(staticConfig, conf, revision) {
|
|
|
20
20
|
for (const key in authoredDefaultProps) {
|
|
21
21
|
const isVariant = Boolean(variants?.[key]);
|
|
22
22
|
const isStyle = key !== "transition" && (key in validStyles$1 || key in conf.shorthands);
|
|
23
|
-
if (
|
|
23
|
+
if (isStyle && !isVariant) {
|
|
24
24
|
;
|
|
25
|
-
(baseStyle ||=
|
|
25
|
+
(baseStyle ||= {})[key] = authoredDefaultProps[key];
|
|
26
|
+
} else if (isVariant && !authoredBaseStyle) {
|
|
27
|
+
;
|
|
28
|
+
(baseStyle ||= {})[key] = authoredDefaultProps[key];
|
|
26
29
|
}
|
|
27
30
|
if (isVariant || !isStyle || staticConfig.inlineProps?.has(key) || styledContextKeys?.has(key)) {
|
|
28
31
|
;
|
|
@@ -33,6 +36,15 @@ function resolveStyleStaticConfig(staticConfig, conf, revision) {
|
|
|
33
36
|
(baseVariantProps ||= {})[key] = authoredDefaultProps[key];
|
|
34
37
|
}
|
|
35
38
|
}
|
|
39
|
+
if (authoredBaseStyle) {
|
|
40
|
+
Object.assign(baseStyle ||= {}, authoredBaseStyle);
|
|
41
|
+
if (baseVariantProps) {
|
|
42
|
+
for (const key in baseVariantProps) {
|
|
43
|
+
delete baseStyle[key];
|
|
44
|
+
baseStyle[key] = baseVariantProps[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
36
48
|
}
|
|
37
49
|
const resolvedBaseStyle = baseStyle || authoredBaseStyle;
|
|
38
50
|
let baseStylePiece;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleStaticConfigCore.js","names":["validStyles","validStylesView"],"sources":["esm/helpers/styleStaticConfigCore.js"],"sourcesContent":["import {\n stylePropsInput,\n stylePropsText,\n validStyles as validStylesView\n} from \"@tamagui/helpers\";\nimport { createStylePiece } from \"../style\";\nconst styleStaticConfigCache = /* @__PURE__ */ new WeakMap();\nfunction resolveStyleStaticConfig(staticConfig, conf, revision) {\n let configCache = styleStaticConfigCache.get(staticConfig);\n const cached = configCache?.get(conf);\n if (cached?.revision === revision) return cached.value;\n const normalized = staticConfig.styleFrontend?.normalizeStaticConfig?.(\n staticConfig,\n conf\n );\n const variants = normalized ? normalized.variants : staticConfig.variants;\n const authoredBaseStyle = normalized ? normalized.baseStyle : staticConfig.baseStyle;\n const authoredDefaultProps = staticConfig.defaultProps;\n const keys = staticConfig.contextProps || staticConfig.context?.propKeys;\n const styledContextKeys = keys ? new Set(keys) : null;\n let baseStyle;\n let baseVariantProps;\n let defaultProps;\n const validStyles = staticConfig.validStyles || (staticConfig.isInput ? stylePropsInput : staticConfig.isText ? stylePropsText : validStylesView);\n if (authoredDefaultProps) {\n for (const key in authoredDefaultProps) {\n const isVariant = Boolean(variants?.[key]);\n const isStyle = key !== \"transition\" && (key in validStyles || key in conf.shorthands);\n if (
|
|
1
|
+
{"version":3,"file":"styleStaticConfigCore.js","names":["validStyles","validStylesView"],"sources":["esm/helpers/styleStaticConfigCore.js"],"sourcesContent":["import {\n stylePropsInput,\n stylePropsText,\n validStyles as validStylesView\n} from \"@tamagui/helpers\";\nimport { createStylePiece } from \"../style\";\nconst styleStaticConfigCache = /* @__PURE__ */ new WeakMap();\nfunction resolveStyleStaticConfig(staticConfig, conf, revision) {\n let configCache = styleStaticConfigCache.get(staticConfig);\n const cached = configCache?.get(conf);\n if (cached?.revision === revision) return cached.value;\n const normalized = staticConfig.styleFrontend?.normalizeStaticConfig?.(\n staticConfig,\n conf\n );\n const variants = normalized ? normalized.variants : staticConfig.variants;\n const authoredBaseStyle = normalized ? normalized.baseStyle : staticConfig.baseStyle;\n const authoredDefaultProps = staticConfig.defaultProps;\n const keys = staticConfig.contextProps || staticConfig.context?.propKeys;\n const styledContextKeys = keys ? new Set(keys) : null;\n let baseStyle;\n let baseVariantProps;\n let defaultProps;\n const validStyles = staticConfig.validStyles || (staticConfig.isInput ? stylePropsInput : staticConfig.isText ? stylePropsText : validStylesView);\n if (authoredDefaultProps) {\n for (const key in authoredDefaultProps) {\n const isVariant = Boolean(variants?.[key]);\n const isStyle = key !== \"transition\" && (key in validStyles || key in conf.shorthands);\n if (isStyle && !isVariant) {\n ;\n (baseStyle ||= {})[key] = authoredDefaultProps[key];\n } else if (isVariant && !authoredBaseStyle) {\n ;\n (baseStyle ||= {})[key] = authoredDefaultProps[key];\n }\n if (isVariant || !isStyle || staticConfig.inlineProps?.has(key) || styledContextKeys?.has(key)) {\n ;\n (defaultProps ||= {})[key] = authoredDefaultProps[key];\n }\n if (isVariant) {\n ;\n (baseVariantProps ||= {})[key] = authoredDefaultProps[key];\n }\n }\n if (authoredBaseStyle) {\n Object.assign(baseStyle ||= {}, authoredBaseStyle);\n if (baseVariantProps) {\n for (const key in baseVariantProps) {\n delete baseStyle[key];\n baseStyle[key] = baseVariantProps[key];\n }\n }\n }\n }\n const resolvedBaseStyle = baseStyle || authoredBaseStyle;\n let baseStylePiece;\n let baseStylePieces;\n if (resolvedBaseStyle && !staticConfig.disableBaseStylePiece) {\n let directBaseStyle;\n let directBaseKeys;\n const flushDirectBaseStyle = () => {\n if (!directBaseStyle || !directBaseKeys) return;\n const piece = createStylePiece(directBaseStyle, \"base\");\n baseStylePiece ||= piece;\n baseStylePieces ||= {};\n for (const key of directBaseKeys) {\n baseStylePieces[key] = piece;\n }\n directBaseStyle = void 0;\n directBaseKeys = void 0;\n };\n for (const key in resolvedBaseStyle) {\n const expanded = conf.shorthands[key] || key;\n if (key !== \"transition\" && !variants?.[key] && !staticConfig.inlineProps?.has(expanded) && expanded in validStyles) {\n ;\n (directBaseStyle ||= {})[key] = resolvedBaseStyle[key];\n (directBaseKeys ||= []).push(key);\n } else {\n flushDirectBaseStyle();\n }\n }\n flushDirectBaseStyle();\n }\n const value = {\n baseStyle: resolvedBaseStyle,\n baseVariantProps,\n baseStylePiece,\n baseStylePieces,\n defaultProps,\n styledContextKeys,\n variants,\n variantStyleResolver: staticConfig.variantStyleResolver,\n passthroughClassName: normalized ? normalized.passthroughClassName : staticConfig.passthroughClassName\n };\n if (!configCache) {\n configCache = /* @__PURE__ */ new WeakMap();\n styleStaticConfigCache.set(staticConfig, configCache);\n }\n configCache.set(conf, { revision, value });\n return value;\n}\nexport {\n resolveStyleStaticConfig\n};\n//# sourceMappingURL=styleStaticConfigCore.js.map\n"],"mappings":";;;;AAMA,MAAM,yCAAyC,IAAI,QAAQ;AAC3D,SAAS,yBAAyB,cAAc,MAAM,UAAU;CAC9D,IAAI,cAAc,uBAAuB,IAAI,YAAY;CACzD,MAAM,SAAS,aAAa,IAAI,IAAI;CACpC,IAAI,QAAQ,aAAa,UAAU,OAAO,OAAO;CACjD,MAAM,aAAa,aAAa,eAAe,wBAC7C,cACA,IACF;CACA,MAAM,WAAW,aAAa,WAAW,WAAW,aAAa;CACjE,MAAM,oBAAoB,aAAa,WAAW,YAAY,aAAa;CAC3E,MAAM,uBAAuB,aAAa;CAC1C,MAAM,OAAO,aAAa,gBAAgB,aAAa,SAAS;CAChE,MAAM,oBAAoB,OAAO,IAAI,IAAI,IAAI,IAAI;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAMA,gBAAc,aAAa,gBAAgB,aAAa,UAAU,kBAA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B,CAAC,WAAW,QAAQ,CAAC,aAAa,aAAa,IAAI,QAAQ,KAAK,YAAYA,eAAa;IACnH;IACA,CAAC,oBAAoB,CAAC,EAAC,CAAE,OAAO,kBAAkB;IAClD,CAAC,mBAAmB,CAAC,EAAC,CAAE,KAAK,GAAG;GAClC,OAAO;IACL,qBAAqB;GACvB;EACF;EACA,qBAAqB;CACvB;CACA,MAAM,QAAQ;EACZ,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB,aAAa;EACnC,sBAAsB,aAAa,WAAW,uBAAuB,aAAa;CACpF;CACA,IAAI,CAAC,aAAa;EAChB,8BAA8B,IAAI,QAAQ;EAC1C,uBAAuB,IAAI,cAAc,WAAW;CACtD;CACA,YAAY,IAAI,MAAM;EAAE;EAAU;CAAM,CAAC;CACzC,OAAO;AACT"}
|
|
@@ -22,9 +22,12 @@ function resolveStyleStaticConfig(staticConfig, conf, revision) {
|
|
|
22
22
|
var _staticConfig_inlineProps;
|
|
23
23
|
var isVariant = Boolean(variants === null || variants === void 0 ? void 0 : variants[key]);
|
|
24
24
|
var isStyle = key !== "transition" && (key in validStyles$1 || key in conf.shorthands);
|
|
25
|
-
if (
|
|
25
|
+
if (isStyle && !isVariant) {
|
|
26
26
|
;
|
|
27
|
-
(baseStyle || (baseStyle =
|
|
27
|
+
(baseStyle || (baseStyle = {}))[key] = authoredDefaultProps[key];
|
|
28
|
+
} else if (isVariant && !authoredBaseStyle) {
|
|
29
|
+
;
|
|
30
|
+
(baseStyle || (baseStyle = {}))[key] = authoredDefaultProps[key];
|
|
28
31
|
}
|
|
29
32
|
if (isVariant || !isStyle || ((_staticConfig_inlineProps = staticConfig.inlineProps) === null || _staticConfig_inlineProps === void 0 ? void 0 : _staticConfig_inlineProps.has(key)) || (styledContextKeys === null || styledContextKeys === void 0 ? void 0 : styledContextKeys.has(key))) {
|
|
30
33
|
;
|
|
@@ -35,6 +38,15 @@ function resolveStyleStaticConfig(staticConfig, conf, revision) {
|
|
|
35
38
|
(baseVariantProps || (baseVariantProps = {}))[key] = authoredDefaultProps[key];
|
|
36
39
|
}
|
|
37
40
|
}
|
|
41
|
+
if (authoredBaseStyle) {
|
|
42
|
+
Object.assign(baseStyle || (baseStyle = {}), authoredBaseStyle);
|
|
43
|
+
if (baseVariantProps) {
|
|
44
|
+
for (var key1 in baseVariantProps) {
|
|
45
|
+
delete baseStyle[key1];
|
|
46
|
+
baseStyle[key1] = baseVariantProps[key1];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
38
50
|
}
|
|
39
51
|
var resolvedBaseStyle = baseStyle || authoredBaseStyle;
|
|
40
52
|
var baseStylePiece;
|
|
@@ -50,8 +62,8 @@ function resolveStyleStaticConfig(staticConfig, conf, revision) {
|
|
|
50
62
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
51
63
|
try {
|
|
52
64
|
for (var _iterator = directBaseKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
53
|
-
var
|
|
54
|
-
baseStylePieces[
|
|
65
|
+
var key3 = _step.value;
|
|
66
|
+
baseStylePieces[key3] = piece;
|
|
55
67
|
}
|
|
56
68
|
} catch (err) {
|
|
57
69
|
_didIteratorError = true;
|
|
@@ -70,13 +82,13 @@ function resolveStyleStaticConfig(staticConfig, conf, revision) {
|
|
|
70
82
|
directBaseStyle = void 0;
|
|
71
83
|
directBaseKeys = void 0;
|
|
72
84
|
};
|
|
73
|
-
for (var
|
|
85
|
+
for (var key2 in resolvedBaseStyle) {
|
|
74
86
|
var _staticConfig_inlineProps1;
|
|
75
|
-
var expanded = conf.shorthands[
|
|
76
|
-
if (
|
|
87
|
+
var expanded = conf.shorthands[key2] || key2;
|
|
88
|
+
if (key2 !== "transition" && !(variants === null || variants === void 0 ? void 0 : variants[key2]) && !((_staticConfig_inlineProps1 = staticConfig.inlineProps) === null || _staticConfig_inlineProps1 === void 0 ? void 0 : _staticConfig_inlineProps1.has(expanded)) && expanded in validStyles$1) {
|
|
77
89
|
;
|
|
78
|
-
(directBaseStyle || (directBaseStyle = {}))[
|
|
79
|
-
(directBaseKeys || (directBaseKeys = [])).push(
|
|
90
|
+
(directBaseStyle || (directBaseStyle = {}))[key2] = resolvedBaseStyle[key2];
|
|
91
|
+
(directBaseKeys || (directBaseKeys = [])).push(key2);
|
|
80
92
|
} else {
|
|
81
93
|
flushDirectBaseStyle();
|
|
82
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleStaticConfigCore.native.js","names":["validStyles","validStylesView"],"sources":["esm/helpers/styleStaticConfigCore.native.js"],"sourcesContent":["import { stylePropsInput, stylePropsText, validStyles as validStylesView } from \"@tamagui/helpers\";\nimport { createStylePiece } from \"../style\";\nvar styleStaticConfigCache = /* @__PURE__ */ new WeakMap();\nfunction resolveStyleStaticConfig(staticConfig, conf, revision) {\n var _staticConfig_styleFrontend_normalizeStaticConfig, _staticConfig_styleFrontend, _staticConfig_context;\n var configCache = styleStaticConfigCache.get(staticConfig);\n var cached = configCache === null || configCache === void 0 ? void 0 : configCache.get(conf);\n if ((cached === null || cached === void 0 ? void 0 : cached.revision) === revision) return cached.value;\n var normalized = (_staticConfig_styleFrontend = staticConfig.styleFrontend) === null || _staticConfig_styleFrontend === void 0 ? void 0 : (_staticConfig_styleFrontend_normalizeStaticConfig = _staticConfig_styleFrontend.normalizeStaticConfig) === null || _staticConfig_styleFrontend_normalizeStaticConfig === void 0 ? void 0 : _staticConfig_styleFrontend_normalizeStaticConfig.call(_staticConfig_styleFrontend, staticConfig, conf);\n var variants = normalized ? normalized.variants : staticConfig.variants;\n var authoredBaseStyle = normalized ? normalized.baseStyle : staticConfig.baseStyle;\n var authoredDefaultProps = staticConfig.defaultProps;\n var keys = staticConfig.contextProps || ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.propKeys);\n var styledContextKeys = keys ? new Set(keys) : null;\n var baseStyle;\n var baseVariantProps;\n var defaultProps;\n var validStyles = staticConfig.validStyles || (staticConfig.isInput ? stylePropsInput : staticConfig.isText ? stylePropsText : validStylesView);\n if (authoredDefaultProps) {\n for (var key in authoredDefaultProps) {\n var _staticConfig_inlineProps;\n var isVariant = Boolean(variants === null || variants === void 0 ? void 0 : variants[key]);\n var isStyle = key !== \"transition\" && (key in validStyles || key in conf.shorthands);\n if (
|
|
1
|
+
{"version":3,"file":"styleStaticConfigCore.native.js","names":["validStyles","validStylesView"],"sources":["esm/helpers/styleStaticConfigCore.native.js"],"sourcesContent":["import { stylePropsInput, stylePropsText, validStyles as validStylesView } from \"@tamagui/helpers\";\nimport { createStylePiece } from \"../style\";\nvar styleStaticConfigCache = /* @__PURE__ */ new WeakMap();\nfunction resolveStyleStaticConfig(staticConfig, conf, revision) {\n var _staticConfig_styleFrontend_normalizeStaticConfig, _staticConfig_styleFrontend, _staticConfig_context;\n var configCache = styleStaticConfigCache.get(staticConfig);\n var cached = configCache === null || configCache === void 0 ? void 0 : configCache.get(conf);\n if ((cached === null || cached === void 0 ? void 0 : cached.revision) === revision) return cached.value;\n var normalized = (_staticConfig_styleFrontend = staticConfig.styleFrontend) === null || _staticConfig_styleFrontend === void 0 ? void 0 : (_staticConfig_styleFrontend_normalizeStaticConfig = _staticConfig_styleFrontend.normalizeStaticConfig) === null || _staticConfig_styleFrontend_normalizeStaticConfig === void 0 ? void 0 : _staticConfig_styleFrontend_normalizeStaticConfig.call(_staticConfig_styleFrontend, staticConfig, conf);\n var variants = normalized ? normalized.variants : staticConfig.variants;\n var authoredBaseStyle = normalized ? normalized.baseStyle : staticConfig.baseStyle;\n var authoredDefaultProps = staticConfig.defaultProps;\n var keys = staticConfig.contextProps || ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.propKeys);\n var styledContextKeys = keys ? new Set(keys) : null;\n var baseStyle;\n var baseVariantProps;\n var defaultProps;\n var validStyles = staticConfig.validStyles || (staticConfig.isInput ? stylePropsInput : staticConfig.isText ? stylePropsText : validStylesView);\n if (authoredDefaultProps) {\n for (var key in authoredDefaultProps) {\n var _staticConfig_inlineProps;\n var isVariant = Boolean(variants === null || variants === void 0 ? void 0 : variants[key]);\n var isStyle = key !== \"transition\" && (key in validStyles || key in conf.shorthands);\n if (isStyle && !isVariant) {\n ;\n (baseStyle || (baseStyle = {}))[key] = authoredDefaultProps[key];\n } else if (isVariant && !authoredBaseStyle) {\n ;\n (baseStyle || (baseStyle = {}))[key] = authoredDefaultProps[key];\n }\n if (isVariant || !isStyle || ((_staticConfig_inlineProps = staticConfig.inlineProps) === null || _staticConfig_inlineProps === void 0 ? void 0 : _staticConfig_inlineProps.has(key)) || (styledContextKeys === null || styledContextKeys === void 0 ? void 0 : styledContextKeys.has(key))) {\n ;\n (defaultProps || (defaultProps = {}))[key] = authoredDefaultProps[key];\n }\n if (isVariant) {\n ;\n (baseVariantProps || (baseVariantProps = {}))[key] = authoredDefaultProps[key];\n }\n }\n if (authoredBaseStyle) {\n Object.assign(baseStyle || (baseStyle = {}), authoredBaseStyle);\n if (baseVariantProps) {\n for (var key1 in baseVariantProps) {\n delete baseStyle[key1];\n baseStyle[key1] = baseVariantProps[key1];\n }\n }\n }\n }\n var resolvedBaseStyle = baseStyle || authoredBaseStyle;\n var baseStylePiece;\n var baseStylePieces;\n if (resolvedBaseStyle && !staticConfig.disableBaseStylePiece) {\n var directBaseStyle;\n var directBaseKeys;\n var flushDirectBaseStyle = function flushDirectBaseStyle2() {\n if (!directBaseStyle || !directBaseKeys) return;\n var piece = createStylePiece(directBaseStyle, \"base\");\n baseStylePiece || (baseStylePiece = piece);\n baseStylePieces || (baseStylePieces = {});\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = directBaseKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var key3 = _step.value;\n baseStylePieces[key3] = piece;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n directBaseStyle = void 0;\n directBaseKeys = void 0;\n };\n for (var key2 in resolvedBaseStyle) {\n var _staticConfig_inlineProps1;\n var expanded = conf.shorthands[key2] || key2;\n if (key2 !== \"transition\" && !(variants === null || variants === void 0 ? void 0 : variants[key2]) && !((_staticConfig_inlineProps1 = staticConfig.inlineProps) === null || _staticConfig_inlineProps1 === void 0 ? void 0 : _staticConfig_inlineProps1.has(expanded)) && expanded in validStyles) {\n ;\n (directBaseStyle || (directBaseStyle = {}))[key2] = resolvedBaseStyle[key2];\n (directBaseKeys || (directBaseKeys = [])).push(key2);\n } else {\n flushDirectBaseStyle();\n }\n }\n flushDirectBaseStyle();\n }\n var value = {\n baseStyle: resolvedBaseStyle,\n baseVariantProps,\n baseStylePiece,\n baseStylePieces,\n defaultProps,\n styledContextKeys,\n variants,\n variantStyleResolver: staticConfig.variantStyleResolver,\n passthroughClassName: normalized ? normalized.passthroughClassName : staticConfig.passthroughClassName\n };\n if (!configCache) {\n configCache = /* @__PURE__ */ new WeakMap();\n styleStaticConfigCache.set(staticConfig, configCache);\n }\n configCache.set(conf, {\n revision,\n value\n });\n return value;\n}\nexport {\n resolveStyleStaticConfig\n};\n//# sourceMappingURL=styleStaticConfigCore.js.map\n"],"mappings":";;;;AAEA,IAAI,yCAAyC,IAAI,QAAQ;AACzD,SAAS,yBAAyB,cAAc,MAAM,UAAU;CAC9D,IAAI,mDAAmD,6BAA6B;CACpF,IAAI,cAAc,uBAAuB,IAAI,YAAY;CACzD,IAAI,SAAS,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI,KAAK,IAAI,YAAY,IAAI,IAAI;CAC3F,KAAK,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI,OAAO,cAAc,UAAU,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,UAAU,GAAG,6BAA6B,aAAa,iBAAiB,QAAQ,+BAA+B,KAAK,IAAI,KAAK,IAAI,2BAA2B,IAAI,QAAQ,MAAM,YAAYA,eAAa;IACjS;IACA,CAAC,oBAAoB,kBAAkB,CAAC,GAAE,CAAE,QAAQ,kBAAkB;IACtE,CAAC,mBAAmB,iBAAiB,CAAC,GAAE,CAAE,KAAK,IAAI;GACrD,OAAO;IACL,qBAAqB;GACvB;EACF;EACA,qBAAqB;CACvB;CACA,IAAI,QAAQ;EACV,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB,aAAa;EACnC,sBAAsB,aAAa,WAAW,uBAAuB,aAAa;CACpF;CACA,IAAI,CAAC,aAAa;EAChB,8BAA8B,IAAI,QAAQ;EAC1C,uBAAuB,IAAI,cAAc,WAAW;CACtD;CACA,YAAY,IAAI,MAAM;EACpB;EACA;CACF,CAAC;CACD,OAAO;AACT"}
|
package/dist/esm/styled.mjs
CHANGED
|
@@ -29,7 +29,7 @@ function styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptio
|
|
|
29
29
|
const isPlainStyledComponent = !!parentStaticConfig && !parentStaticConfig.isHOC;
|
|
30
30
|
let Component = parentStaticConfig?.isHOC && !parentStaticConfig?.isStyledHOC || isPlainStyledComponent ? ComponentIn : parentStaticConfig?.Component || ComponentIn;
|
|
31
31
|
const resolvedIsReactNative = Boolean(isReactNative);
|
|
32
|
-
const
|
|
32
|
+
const created = createComponent((() => {
|
|
33
33
|
let { variants, displayName: _displayName, defaultVariants, context, contextProps, ...defaultProps } = options || {};
|
|
34
34
|
let parentDefaultVariants;
|
|
35
35
|
let parentDefaultProps;
|
|
@@ -91,6 +91,7 @@ function styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptio
|
|
|
91
91
|
if (defaultProps["children"] || !acceptsClassName || mergedContext) conf.neverFlatten = true;
|
|
92
92
|
return conf;
|
|
93
93
|
})() || {});
|
|
94
|
+
const component = ComponentIn.rebindDOMTag ? ComponentIn.rebindDOMTag(created) : created;
|
|
94
95
|
for (const key in ComponentIn) {
|
|
95
96
|
if (key === "propTypes") continue;
|
|
96
97
|
if (key in component) continue;
|
package/dist/esm/styled.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","names":[],"sources":["esm/styled.js"],"sourcesContent":["import { stylePropsInput, stylePropsText } from \"@tamagui/helpers\";\nimport { createComponent } from \"./createComponent\";\nimport { componentDisplayName } from \"./helpers/componentDisplayName\";\nimport { mergeVariants } from \"./helpers/mergeVariants\";\nimport { resolveVariantStyle } from \"./helpers/resolveVariantStyle\";\nimport { styledDynamic } from \"./helpers/styledDynamic\";\nimport { warnOnce } from \"./helpers/warnOnce\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\nfunction styledFn(...args) {\n\treturn styledImpl(void 0, ...args);\n}\nconst styled = Object.assign(styledFn, { dynamic: styledDynamic });\nfunction createFrontendStyled(frontend) {\n\treturn (ComponentIn, optionsOrBaseClassName, configOrOptions, maybeConfig) => styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptions, maybeConfig);\n}\nfunction styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptions, maybeConfig) {\n\tconst hasBaseClassName = typeof optionsOrBaseClassName === \"string\";\n\tconst baseClassName = hasBaseClassName ? optionsOrBaseClassName : void 0;\n\tconst optionsIn = hasBaseClassName ? configOrOptions : optionsOrBaseClassName;\n\tconst config = hasBaseClassName ? maybeConfig : configOrOptions;\n\tconst options = optionsIn;\n\tconst displayName = options?.displayName;\n\tif (!ComponentIn) throw new Error(!isProd && process.env.NODE_ENV === \"development\" ? \"No component given to styled()\" : \"❌ Error 006\");\n\tconst parentStaticConfig = ComponentIn[\"staticConfig\"];\n\tconst requestedReactNativeInterop = Boolean(config?.isReactNative || parentStaticConfig?.isReactNative);\n\tif (!isProd && process.env.NODE_ENV === \"development\" && requestedReactNativeInterop) warnOnce(\"isReactNative-web-removed\", \"The isReactNative styled-component option is native-only in Tamagui v3. React Native Web hosts on web are no longer adapted; use a component that accepts className, data-* attributes, and DOM events.\");\n\tconst isReactNative = false;\n\tconst isPlainStyledComponent = !!parentStaticConfig && !parentStaticConfig.isHOC;\n\tlet Component = parentStaticConfig?.isHOC && !parentStaticConfig?.isStyledHOC || isPlainStyledComponent ? ComponentIn : parentStaticConfig?.Component || ComponentIn;\n\tconst resolvedIsReactNative = Boolean(isReactNative);\n\tconst
|
|
1
|
+
{"version":3,"file":"styled.js","names":[],"sources":["esm/styled.js"],"sourcesContent":["import { stylePropsInput, stylePropsText } from \"@tamagui/helpers\";\nimport { createComponent } from \"./createComponent\";\nimport { componentDisplayName } from \"./helpers/componentDisplayName\";\nimport { mergeVariants } from \"./helpers/mergeVariants\";\nimport { resolveVariantStyle } from \"./helpers/resolveVariantStyle\";\nimport { styledDynamic } from \"./helpers/styledDynamic\";\nimport { warnOnce } from \"./helpers/warnOnce\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\nfunction styledFn(...args) {\n\treturn styledImpl(void 0, ...args);\n}\nconst styled = Object.assign(styledFn, { dynamic: styledDynamic });\nfunction createFrontendStyled(frontend) {\n\treturn (ComponentIn, optionsOrBaseClassName, configOrOptions, maybeConfig) => styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptions, maybeConfig);\n}\nfunction styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptions, maybeConfig) {\n\tconst hasBaseClassName = typeof optionsOrBaseClassName === \"string\";\n\tconst baseClassName = hasBaseClassName ? optionsOrBaseClassName : void 0;\n\tconst optionsIn = hasBaseClassName ? configOrOptions : optionsOrBaseClassName;\n\tconst config = hasBaseClassName ? maybeConfig : configOrOptions;\n\tconst options = optionsIn;\n\tconst displayName = options?.displayName;\n\tif (!ComponentIn) throw new Error(!isProd && process.env.NODE_ENV === \"development\" ? \"No component given to styled()\" : \"❌ Error 006\");\n\tconst parentStaticConfig = ComponentIn[\"staticConfig\"];\n\tconst requestedReactNativeInterop = Boolean(config?.isReactNative || parentStaticConfig?.isReactNative);\n\tif (!isProd && process.env.NODE_ENV === \"development\" && requestedReactNativeInterop) warnOnce(\"isReactNative-web-removed\", \"The isReactNative styled-component option is native-only in Tamagui v3. React Native Web hosts on web are no longer adapted; use a component that accepts className, data-* attributes, and DOM events.\");\n\tconst isReactNative = false;\n\tconst isPlainStyledComponent = !!parentStaticConfig && !parentStaticConfig.isHOC;\n\tlet Component = parentStaticConfig?.isHOC && !parentStaticConfig?.isStyledHOC || isPlainStyledComponent ? ComponentIn : parentStaticConfig?.Component || ComponentIn;\n\tconst resolvedIsReactNative = Boolean(isReactNative);\n\tconst created = createComponent((() => {\n\t\tlet { variants, displayName: _displayName, defaultVariants, context, contextProps, ...defaultProps } = options || {};\n\t\tlet parentDefaultVariants;\n\t\tlet parentDefaultProps;\n\t\tconst mergedBaseClassName = parentStaticConfig?.baseClassName && baseClassName ? `${parentStaticConfig.baseClassName} ${baseClassName}` : baseClassName || parentStaticConfig?.baseClassName;\n\t\tif (parentStaticConfig) {\n\t\t\tif (!(parentStaticConfig.isHOC && !parentStaticConfig.isStyledHOC)) {\n\t\t\t\tconst pdp = parentStaticConfig.defaultProps;\n\t\t\t\tfor (const key in pdp) {\n\t\t\t\t\tconst val = pdp[key];\n\t\t\t\t\tif (parentStaticConfig.defaultVariants) {\n\t\t\t\t\t\tif (key in parentStaticConfig.defaultVariants) {\n\t\t\t\t\t\t\tif (!defaultVariants || !(key in defaultVariants)) {\n\t\t\t\t\t\t\t\tparentDefaultVariants ||= {};\n\t\t\t\t\t\t\t\tparentDefaultVariants[key] = val;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!(key in defaultProps) && (!defaultVariants || !(key in defaultVariants))) {\n\t\t\t\t\t\tparentDefaultProps ||= {};\n\t\t\t\t\t\tparentDefaultProps[key] = pdp[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (parentStaticConfig.variants) variants = mergeVariants(parentStaticConfig.variants, variants);\n\t\t\t}\n\t\t}\n\t\tconst mergedContext = context || parentStaticConfig?.context;\n\t\tconst mergedContextProps = context ? contextProps : contextProps || parentStaticConfig?.contextProps;\n\t\tif (parentDefaultProps || defaultVariants || parentDefaultVariants) defaultProps = {\n\t\t\t...parentDefaultProps,\n\t\t\t...parentDefaultVariants,\n\t\t\t...defaultProps,\n\t\t\t...defaultVariants\n\t\t};\n\t\tconst isInput = Boolean(config?.isInput || parentStaticConfig?.isInput);\n\t\tconst isText = Boolean(config?.isText || parentStaticConfig?.isText);\n\t\tconst validStyles = config?.validStyles || (config?.isInput ? stylePropsInput : config?.isText ? stylePropsText : parentStaticConfig?.validStyles);\n\t\tconst acceptsClassName = config?.acceptsClassName ?? (isPlainStyledComponent || resolvedIsReactNative || parentStaticConfig?.isHOC && parentStaticConfig?.acceptsClassName);\n\t\tconst conf = {\n\t\t\t...parentStaticConfig,\n\t\t\t...config,\n\t\t\t...!isPlainStyledComponent && { Component },\n\t\t\tvariants,\n\t\t\tbaseClassName: mergedBaseClassName,\n\t\t\tdefaultProps,\n\t\t\tdefaultVariants,\n\t\t\tisText,\n\t\t\tisInput,\n\t\t\tvalidStyles,\n\t\t\tacceptsClassName,\n\t\t\tcontext: mergedContext,\n\t\t\tcontextProps: mergedContextProps,\n\t\t\tisStyledHOC: Boolean(parentStaticConfig?.isHOC),\n\t\t\tparentStaticConfig,\n\t\t\tdisplayName: displayName || ComponentIn[componentDisplayName],\n\t\t\t...frontend && { styleFrontend: frontend }\n\t\t};\n\t\tconf.variantStyleResolver = resolveVariantStyle;\n\t\tdelete conf.isReactNative;\n\t\tif (defaultProps[\"children\"] || !acceptsClassName || mergedContext) conf.neverFlatten = true;\n\t\treturn conf;\n\t})() || {});\n\tconst component = ComponentIn.rebindDOMTag ? ComponentIn.rebindDOMTag(created) : created;\n\tfor (const key in ComponentIn) {\n\t\tif (key === \"propTypes\") continue;\n\t\tif (key in component) continue;\n\t\tc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AAa,eAAe,YAAY;GACxC,GAAG,YAAY,EAAE,eAAe,SAAS;EAC1C;EACA,KAAK,uBAAuB;EAC5B,OAAO,KAAK;EACZ,IAAI,aAAa,eAAe,CAAC,oBAAoB,eAAe,KAAK,eAAe;EACxF,OAAO;CACR,EAAC,CAAE,KAAK,CAAC,CAAC;CACV,MAAM,YAAY,YAAY,eAAe,YAAY,aAAa,OAAO,IAAI;CACjF,KAAK,MAAM,OAAO,aAAa;EAC9B,IAAI,QAAQ,aAAa;EACzB,IAAI,OAAO,WAAW;EACtB,UAAU,OAAO,YAAY;CAC9B;CACA,OAAO;AACR"}
|
|
@@ -32,7 +32,7 @@ function styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptio
|
|
|
32
32
|
var Component = (parentStaticConfig === null || parentStaticConfig === void 0 ? void 0 : parentStaticConfig.isHOC) && !(parentStaticConfig === null || parentStaticConfig === void 0 ? void 0 : parentStaticConfig.isStyledHOC) || isPlainStyledComponent ? ComponentIn : (parentStaticConfig === null || parentStaticConfig === void 0 ? void 0 : parentStaticConfig.Component) || ComponentIn;
|
|
33
33
|
var reactNativeConfig = !parentStaticConfig ? getReactNativeConfig(Component) : void 0;
|
|
34
34
|
var resolvedIsReactNative = Boolean(reactNativeConfig || isReactNative);
|
|
35
|
-
var
|
|
35
|
+
var created = createComponent((function() {
|
|
36
36
|
var _ref;
|
|
37
37
|
var { variants, displayName: _displayName, defaultVariants, context, contextProps, ...defaultProps } = options || {};
|
|
38
38
|
var parentDefaultVariants;
|
|
@@ -96,6 +96,7 @@ function styledImpl(frontend, ComponentIn, optionsOrBaseClassName, configOrOptio
|
|
|
96
96
|
if (defaultProps["children"] || !acceptsClassName || mergedContext) conf.neverFlatten = true;
|
|
97
97
|
return conf;
|
|
98
98
|
})() || {});
|
|
99
|
+
var component = ComponentIn.rebindDOMTag ? ComponentIn.rebindDOMTag(created) : created;
|
|
99
100
|
for (var key in ComponentIn) {
|
|
100
101
|
if (key === "propTypes") continue;
|
|
101
102
|
if (key in component) continue;
|