@tamagui/web 3.0.0-beta.1125.1 → 3.0.0-beta.1133.1
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/config.cjs +4 -1
- package/dist/cjs/config.native.cjs +4 -1
- package/dist/cjs/config.native.js +4 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +17 -28
- package/dist/cjs/helpers/getSplitStyles.native.cjs +36 -35
- package/dist/cjs/helpers/getSplitStyles.native.js +36 -35
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/config.mjs +4 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +4 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +17 -28
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +37 -36
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/package.json +17 -17
- package/src/config.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +42 -39
- package/types/config.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
package/dist/cjs/config.cjs
CHANGED
|
@@ -54,7 +54,7 @@ const getConfigFromGlobalOrLocal = () => {
|
|
|
54
54
|
return conf;
|
|
55
55
|
}
|
|
56
56
|
if (globalThis.__tamaguiConfig) {
|
|
57
|
-
if (process.env.NODE_ENV === "development" && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {
|
|
57
|
+
if (process.env.NODE_ENV === "development" && globalThis.__tamaguiEvaluationConfig !== globalThis.__tamaguiConfig && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {
|
|
58
58
|
globalThis.__tamaguiPendingCheck = true;
|
|
59
59
|
setTimeout(() => {
|
|
60
60
|
if (!setConfigCalledByThisInstance && !globalThis.__tamaguiHasWarnedGlobalFallback) {
|
|
@@ -91,6 +91,9 @@ const setConfig = (next) => {
|
|
|
91
91
|
if (conf !== previous || globalThis.__tamaguiConfig !== previousGlobal) return;
|
|
92
92
|
conf = next;
|
|
93
93
|
globalThis.__tamaguiConfig = next;
|
|
94
|
+
if (process.env.TAMAGUI_ENVIRONMENT === "tamagui") {
|
|
95
|
+
globalThis.__tamaguiEvaluationConfig = next;
|
|
96
|
+
}
|
|
94
97
|
};
|
|
95
98
|
const setConfigFont = (name, font, fontParsed) => {
|
|
96
99
|
const config = getConfigFromGlobalOrLocal();
|
|
@@ -56,7 +56,7 @@ var getConfigFromGlobalOrLocal = function() {
|
|
|
56
56
|
return conf;
|
|
57
57
|
}
|
|
58
58
|
if (globalThis.__tamaguiConfig) {
|
|
59
|
-
if (process.env.NODE_ENV === "development" && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {
|
|
59
|
+
if (process.env.NODE_ENV === "development" && globalThis.__tamaguiEvaluationConfig !== globalThis.__tamaguiConfig && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {
|
|
60
60
|
globalThis.__tamaguiPendingCheck = true;
|
|
61
61
|
setTimeout(function() {
|
|
62
62
|
if (!setConfigCalledByThisInstance && !globalThis.__tamaguiHasWarnedGlobalFallback) {
|
|
@@ -94,6 +94,9 @@ var setConfig = function(next) {
|
|
|
94
94
|
if (conf !== previous || globalThis.__tamaguiConfig !== previousGlobal) return;
|
|
95
95
|
conf = next;
|
|
96
96
|
globalThis.__tamaguiConfig = next;
|
|
97
|
+
if (process.env.TAMAGUI_ENVIRONMENT === "tamagui") {
|
|
98
|
+
globalThis.__tamaguiEvaluationConfig = next;
|
|
99
|
+
}
|
|
97
100
|
};
|
|
98
101
|
var setConfigFont = function(name, font, fontParsed) {
|
|
99
102
|
var config = getConfigFromGlobalOrLocal();
|
|
@@ -56,7 +56,7 @@ var getConfigFromGlobalOrLocal = function() {
|
|
|
56
56
|
return conf;
|
|
57
57
|
}
|
|
58
58
|
if (globalThis.__tamaguiConfig) {
|
|
59
|
-
if (process.env.NODE_ENV === "development" && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {
|
|
59
|
+
if (process.env.NODE_ENV === "development" && globalThis.__tamaguiEvaluationConfig !== globalThis.__tamaguiConfig && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {
|
|
60
60
|
globalThis.__tamaguiPendingCheck = true;
|
|
61
61
|
setTimeout(function() {
|
|
62
62
|
if (!setConfigCalledByThisInstance && !globalThis.__tamaguiHasWarnedGlobalFallback) {
|
|
@@ -94,6 +94,9 @@ var setConfig = function(next) {
|
|
|
94
94
|
if (conf !== previous || globalThis.__tamaguiConfig !== previousGlobal) return;
|
|
95
95
|
conf = next;
|
|
96
96
|
globalThis.__tamaguiConfig = next;
|
|
97
|
+
if (process.env.TAMAGUI_ENVIRONMENT === "tamagui") {
|
|
98
|
+
globalThis.__tamaguiEvaluationConfig = next;
|
|
99
|
+
}
|
|
97
100
|
};
|
|
98
101
|
var setConfigFont = function(name, font, fontParsed) {
|
|
99
102
|
var config = getConfigFromGlobalOrLocal();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.native.js","names":[],"sources":["cjs/config.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar config_exports = {};\n__export(config_exports, {\n devConfig: () => devConfig,\n getConfig: () => getConfig,\n getConfigMaybe: () => getConfigMaybe,\n getFont: () => getFont,\n getSetting: () => getSetting,\n getStyleCompat: () => getStyleCompat,\n getThemes: () => getThemes,\n getToken: () => getToken,\n getTokenObject: () => getTokenObject,\n getTokenValue: () => getTokenValue,\n getTokens: () => getTokens,\n loadAnimationDriver: () => loadAnimationDriver,\n setConfig: () => setConfig,\n setConfigFont: () => setConfigFont,\n setTokens: () => setTokens,\n setupDev: () => setupDev,\n updateConfig: () => updateConfig,\n useTokens: () => useTokens\n});\nmodule.exports = __toCommonJS(config_exports);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_constants2 = require(\"./constants/constants\");\nvar import_formatDiagnostic = require(\"./helpers/formatDiagnostic\");\nvar import_grammarConfig = require(\"./helpers/grammarConfig\");\nvar conf;\nvar setConfigCalledByThisInstance = false;\nvar haventCalledErrorMessage = process.env.NODE_ENV === \"development\" ? `\nHaven't called createTamagui yet. ${import_constants2.MISSING_THEME_MESSAGE}\n` : `\\u274C Error 001`;\nvar getConfigFromGlobalOrLocal = function() {\n if (conf) {\n return conf;\n }\n if (globalThis.__tamaguiConfig) {\n if (process.env.NODE_ENV === \"development\" && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {\n globalThis.__tamaguiPendingCheck = true;\n setTimeout(function() {\n if (!setConfigCalledByThisInstance && !globalThis.__tamaguiHasWarnedGlobalFallback) {\n globalThis.__tamaguiHasWarnedGlobalFallback = true;\n console.warn(`\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\n\nTamagui: Using global config fallback. This may indicate duplicate tamagui instances (e.g., from Vite SSR bundling). This is handled automatically, but likely causes issues!\n\n\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F`);\n }\n globalThis.__tamaguiPendingCheck = false;\n }, 500);\n }\n return globalThis.__tamaguiConfig;\n }\n return null;\n};\nvar getSetting = function(key) {\n var config = getConfigFromGlobalOrLocal();\n if (process.env.NODE_ENV === \"development\") {\n if (!config) throw new Error(haventCalledErrorMessage);\n }\n return config.settings[key];\n};\nfunction getStyleCompat() {\n var _config_settings;\n var config = getConfigFromGlobalOrLocal();\n return (config === null || config === void 0 ? void 0 : (_config_settings = config.settings) === null || _config_settings === void 0 ? void 0 : _config_settings.styleCompat) || \"web\";\n}\nvar setConfig = function(next) {\n setConfigCalledByThisInstance = true;\n var previous = conf;\n var previousGlobal = globalThis.__tamaguiConfig;\n (0, import_grammarConfig.prepareConfigRevision)(next);\n if (conf !== previous || globalThis.__tamaguiConfig !== previousGlobal) return;\n conf = next;\n globalThis.__tamaguiConfig = next;\n};\nvar setConfigFont = function(name, font, fontParsed) {\n var config = getConfigFromGlobalOrLocal();\n if (process.env.NODE_ENV === \"development\") {\n if (!config) throw new Error(haventCalledErrorMessage);\n }\n config.fonts[name] = font;\n config.fontsParsed[name] = fontParsed;\n (0, import_grammarConfig.prepareConfigRevision)(config);\n};\nvar getConfig = function() {\n var config = getConfigFromGlobalOrLocal();\n if (!config) {\n throw new Error((0, import_formatDiagnostic.formatDiagnostic)(\"Err0\", \"TamaguiConfig\", \"no config is available\", \"Call createTamagui before rendering and deduplicate Tamagui package versions\", \"config\", config));\n }\n return config;\n};\nvar getConfigMaybe = function() {\n return getConfigFromGlobalOrLocal();\n};\nvar tokens;\nfunction setTokens(next) {\n tokens = next;\n}\nvar getTokensParsed = function() {\n var _getConfigFromGlobalOrLocal;\n var _getConfigFromGlobalOrLocal_tokensParsed;\n return (_getConfigFromGlobalOrLocal_tokensParsed = (_getConfigFromGlobalOrLocal = getConfigFromGlobalOrLocal()) === null || _getConfigFromGlobalOrLocal === void 0 ? void 0 : _getConfigFromGlobalOrLocal.tokensParsed) !== null && _getConfigFromGlobalOrLocal_tokensParsed !== void 0 ? _getConfigFromGlobalOrLocal_tokensParsed : tokens;\n};\nvar getTokens = function() {\n if (process.env.NODE_ENV === \"development\") {\n if (!getConfigFromGlobalOrLocal()) throw new Error(haventCalledErrorMessage);\n }\n return getTokensParsed();\n};\nvar getTokenObject = function(value, group) {\n var _tokens_group, _tokens_;\n var tokens2 = getTokensParsed();\n return group ? (_tokens_group = tokens2[group]) === null || _tokens_group === void 0 ? void 0 : _tokens_group[value] : (_tokens_ = tokens2[Object.keys(tokens2).find(function(cat) {\n return tokens2[cat][value];\n }) || \"\"]) === null || _tokens_ === void 0 ? void 0 : _tokens_[value];\n};\nvar getToken = function(value, group) {\n var useVariable = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : import_constants.isWeb;\n var token = getTokenObject(value, group);\n return useVariable ? token === null || token === void 0 ? void 0 : token.variable : token === null || token === void 0 ? void 0 : token.val;\n};\nvar getTokenValue = function(value, group) {\n if (value === \"unset\" || value === \"auto\") return;\n return getToken(value, group, false);\n};\nvar useTokens = getTokens;\nvar getThemes = function() {\n return getConfigFromGlobalOrLocal().themes;\n};\nvar updateConfig = function(key, value) {\n var config = getConfigFromGlobalOrLocal();\n if (!config || key === \"__proto__\" || !(key in config)) {\n return;\n }\n Object.assign(config[key], value);\n (0, import_grammarConfig.prepareConfigRevision)(config);\n};\nvar getFont = function(name) {\n var _Object_entries_find;\n var conf2 = getConfig();\n var _conf_fontsParsed_name;\n return (_conf_fontsParsed_name = conf2.fontsParsed[name]) !== null && _conf_fontsParsed_name !== void 0 ? _conf_fontsParsed_name : (_Object_entries_find = Object.entries(conf2.fontsParsed).find(function(param) {\n var [k] = param;\n var _conf_fontsParsed_k_family, _conf_fontsParsed_k;\n return ((_conf_fontsParsed_k = conf2.fontsParsed[k]) === null || _conf_fontsParsed_k === void 0 ? void 0 : (_conf_fontsParsed_k_family = _conf_fontsParsed_k.family) === null || _conf_fontsParsed_k_family === void 0 ? void 0 : _conf_fontsParsed_k_family[\"val\"]) === name;\n })) === null || _Object_entries_find === void 0 ? void 0 : _Object_entries_find[1];\n};\nvar devConfig;\nfunction setupDev(conf2) {\n if (process.env.NODE_ENV === \"development\") {\n devConfig = conf2;\n }\n}\nfunction loadAnimationDriver(name, driver) {\n var config = getConfigFromGlobalOrLocal();\n if (!config) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(\"loadAnimationDriver called before createTamagui\");\n }\n return;\n }\n if (config.animations && !(\"default\" in config.animations)) {\n ;\n config.animations = {\n default: config.animations\n };\n }\n if (config.animations) {\n ;\n config.animations[name] = driver;\n } else {\n ;\n config.animations = {\n default: driver,\n [name]: driver\n };\n }\n}\n//# sourceMappingURL=config.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,iBAAiB,CAAC;AACtB,SAAS,gBAAgB;CACvB,iBAAiB;CACjB,iBAAiB;CACjB,sBAAsB;CACtB,eAAe;CACf,kBAAkB;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4B;EAChC,SAAS,sBAAsB,MAAM,YAAY,QAAQ,QAAQ,wBAAwB,KAAK,IAAI,KAAK,KAAK,6BAA6B,oBAAoB,YAAY,QAAQ,+BAA+B,KAAK,IAAI,KAAK,IAAI,2BAA2B,YAAY;CAC3Q,CAAC,OAAO,QAAQ,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB;AAClF;AACA,IAAI;AACJ,SAAS,SAAS,OAAO;CACvB,IAAI,QAAQ,IAAI,aAAa,eAAe;EAC1C,YAAY;CACd;AACF;AACA,SAAS,oBAAoB,MAAM,QAAQ;CACzC,IAAI,SAAS,2BAA2B;CACxC,IAAI,CAAC,QAAQ;EACX,IAAI,QAAQ,IAAI,aAAa,eAAe;GAC1C,QAAQ,KAAK,iDAAiD;EAChE;EACA;CACF;CACA,IAAI,OAAO,cAAc,EAAE,aAAa,OAAO,aAAa;EAC1D;EACA,OAAO,aAAa,EAClB,SAAS,OAAO,WAClB;CACF;CACA,IAAI,OAAO,YAAY;EACrB;EACA,OAAO,WAAW,QAAQ;CAC5B,OAAO;EACL;EACA,OAAO,aAAa;GAClB,SAAS;IACR,OAAO;EACV;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"config.native.js","names":[],"sources":["cjs/config.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar config_exports = {};\n__export(config_exports, {\n devConfig: () => devConfig,\n getConfig: () => getConfig,\n getConfigMaybe: () => getConfigMaybe,\n getFont: () => getFont,\n getSetting: () => getSetting,\n getStyleCompat: () => getStyleCompat,\n getThemes: () => getThemes,\n getToken: () => getToken,\n getTokenObject: () => getTokenObject,\n getTokenValue: () => getTokenValue,\n getTokens: () => getTokens,\n loadAnimationDriver: () => loadAnimationDriver,\n setConfig: () => setConfig,\n setConfigFont: () => setConfigFont,\n setTokens: () => setTokens,\n setupDev: () => setupDev,\n updateConfig: () => updateConfig,\n useTokens: () => useTokens\n});\nmodule.exports = __toCommonJS(config_exports);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_constants2 = require(\"./constants/constants\");\nvar import_formatDiagnostic = require(\"./helpers/formatDiagnostic\");\nvar import_grammarConfig = require(\"./helpers/grammarConfig\");\nvar conf;\nvar setConfigCalledByThisInstance = false;\nvar haventCalledErrorMessage = process.env.NODE_ENV === \"development\" ? `\nHaven't called createTamagui yet. ${import_constants2.MISSING_THEME_MESSAGE}\n` : `\\u274C Error 001`;\nvar getConfigFromGlobalOrLocal = function() {\n if (conf) {\n return conf;\n }\n if (globalThis.__tamaguiConfig) {\n if (process.env.NODE_ENV === \"development\" && globalThis.__tamaguiEvaluationConfig !== globalThis.__tamaguiConfig && !globalThis.__tamaguiHasWarnedGlobalFallback && !globalThis.__tamaguiPendingCheck) {\n globalThis.__tamaguiPendingCheck = true;\n setTimeout(function() {\n if (!setConfigCalledByThisInstance && !globalThis.__tamaguiHasWarnedGlobalFallback) {\n globalThis.__tamaguiHasWarnedGlobalFallback = true;\n console.warn(`\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\n\nTamagui: Using global config fallback. This may indicate duplicate tamagui instances (e.g., from Vite SSR bundling). This is handled automatically, but likely causes issues!\n\n\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F\\u26A0\\uFE0F`);\n }\n globalThis.__tamaguiPendingCheck = false;\n }, 500);\n }\n return globalThis.__tamaguiConfig;\n }\n return null;\n};\nvar getSetting = function(key) {\n var config = getConfigFromGlobalOrLocal();\n if (process.env.NODE_ENV === \"development\") {\n if (!config) throw new Error(haventCalledErrorMessage);\n }\n return config.settings[key];\n};\nfunction getStyleCompat() {\n var _config_settings;\n var config = getConfigFromGlobalOrLocal();\n return (config === null || config === void 0 ? void 0 : (_config_settings = config.settings) === null || _config_settings === void 0 ? void 0 : _config_settings.styleCompat) || \"web\";\n}\nvar setConfig = function(next) {\n setConfigCalledByThisInstance = true;\n var previous = conf;\n var previousGlobal = globalThis.__tamaguiConfig;\n (0, import_grammarConfig.prepareConfigRevision)(next);\n if (conf !== previous || globalThis.__tamaguiConfig !== previousGlobal) return;\n conf = next;\n globalThis.__tamaguiConfig = next;\n if (process.env.TAMAGUI_ENVIRONMENT === \"tamagui\") {\n globalThis.__tamaguiEvaluationConfig = next;\n }\n};\nvar setConfigFont = function(name, font, fontParsed) {\n var config = getConfigFromGlobalOrLocal();\n if (process.env.NODE_ENV === \"development\") {\n if (!config) throw new Error(haventCalledErrorMessage);\n }\n config.fonts[name] = font;\n config.fontsParsed[name] = fontParsed;\n (0, import_grammarConfig.prepareConfigRevision)(config);\n};\nvar getConfig = function() {\n var config = getConfigFromGlobalOrLocal();\n if (!config) {\n throw new Error((0, import_formatDiagnostic.formatDiagnostic)(\"Err0\", \"TamaguiConfig\", \"no config is available\", \"Call createTamagui before rendering and deduplicate Tamagui package versions\", \"config\", config));\n }\n return config;\n};\nvar getConfigMaybe = function() {\n return getConfigFromGlobalOrLocal();\n};\nvar tokens;\nfunction setTokens(next) {\n tokens = next;\n}\nvar getTokensParsed = function() {\n var _getConfigFromGlobalOrLocal;\n var _getConfigFromGlobalOrLocal_tokensParsed;\n return (_getConfigFromGlobalOrLocal_tokensParsed = (_getConfigFromGlobalOrLocal = getConfigFromGlobalOrLocal()) === null || _getConfigFromGlobalOrLocal === void 0 ? void 0 : _getConfigFromGlobalOrLocal.tokensParsed) !== null && _getConfigFromGlobalOrLocal_tokensParsed !== void 0 ? _getConfigFromGlobalOrLocal_tokensParsed : tokens;\n};\nvar getTokens = function() {\n if (process.env.NODE_ENV === \"development\") {\n if (!getConfigFromGlobalOrLocal()) throw new Error(haventCalledErrorMessage);\n }\n return getTokensParsed();\n};\nvar getTokenObject = function(value, group) {\n var _tokens_group, _tokens_;\n var tokens2 = getTokensParsed();\n return group ? (_tokens_group = tokens2[group]) === null || _tokens_group === void 0 ? void 0 : _tokens_group[value] : (_tokens_ = tokens2[Object.keys(tokens2).find(function(cat) {\n return tokens2[cat][value];\n }) || \"\"]) === null || _tokens_ === void 0 ? void 0 : _tokens_[value];\n};\nvar getToken = function(value, group) {\n var useVariable = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : import_constants.isWeb;\n var token = getTokenObject(value, group);\n return useVariable ? token === null || token === void 0 ? void 0 : token.variable : token === null || token === void 0 ? void 0 : token.val;\n};\nvar getTokenValue = function(value, group) {\n if (value === \"unset\" || value === \"auto\") return;\n return getToken(value, group, false);\n};\nvar useTokens = getTokens;\nvar getThemes = function() {\n return getConfigFromGlobalOrLocal().themes;\n};\nvar updateConfig = function(key, value) {\n var config = getConfigFromGlobalOrLocal();\n if (!config || key === \"__proto__\" || !(key in config)) {\n return;\n }\n Object.assign(config[key], value);\n (0, import_grammarConfig.prepareConfigRevision)(config);\n};\nvar getFont = function(name) {\n var _Object_entries_find;\n var conf2 = getConfig();\n var _conf_fontsParsed_name;\n return (_conf_fontsParsed_name = conf2.fontsParsed[name]) !== null && _conf_fontsParsed_name !== void 0 ? _conf_fontsParsed_name : (_Object_entries_find = Object.entries(conf2.fontsParsed).find(function(param) {\n var [k] = param;\n var _conf_fontsParsed_k_family, _conf_fontsParsed_k;\n return ((_conf_fontsParsed_k = conf2.fontsParsed[k]) === null || _conf_fontsParsed_k === void 0 ? void 0 : (_conf_fontsParsed_k_family = _conf_fontsParsed_k.family) === null || _conf_fontsParsed_k_family === void 0 ? void 0 : _conf_fontsParsed_k_family[\"val\"]) === name;\n })) === null || _Object_entries_find === void 0 ? void 0 : _Object_entries_find[1];\n};\nvar devConfig;\nfunction setupDev(conf2) {\n if (process.env.NODE_ENV === \"development\") {\n devConfig = conf2;\n }\n}\nfunction loadAnimationDriver(name, driver) {\n var config = getConfigFromGlobalOrLocal();\n if (!config) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(\"loadAnimationDriver called before createTamagui\");\n }\n return;\n }\n if (config.animations && !(\"default\" in config.animations)) {\n ;\n config.animations = {\n default: config.animations\n };\n }\n if (config.animations) {\n ;\n config.animations[name] = driver;\n } else {\n ;\n config.animations = {\n default: driver,\n [name]: driver\n };\n }\n}\n//# sourceMappingURL=config.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,iBAAiB,CAAC;AACtB,SAAS,gBAAgB;CACvB,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AM,YAAY,WAAW,QAAQ,2BAA2B,KAAK,IAAI,0BAA0B,uBAAuB,OAAO,QAAQ,MAAM,WAAW,CAAC,CAAC,KAAK,SAAS,OAAO;EAChN,IAAI,CAAC,KAAK;EACV,IAAI,4BAA4B;EAChC,SAAS,sBAAsB,MAAM,YAAY,QAAQ,QAAQ,wBAAwB,KAAK,IAAI,KAAK,KAAK,6BAA6B,oBAAoB,YAAY,QAAQ,+BAA+B,KAAK,IAAI,KAAK,IAAI,2BAA2B,YAAY;CAC3Q,CAAC,OAAO,QAAQ,yBAAyB,KAAK,IAAI,KAAK,IAAI,qBAAqB;AAClF;AACA,IAAI;AACJ,SAAS,SAAS,OAAO;CACvB,IAAI,QAAQ,IAAI,aAAa,eAAe;EAC1C,YAAY;CACd;AACF;AACA,SAAS,oBAAoB,MAAM,QAAQ;CACzC,IAAI,SAAS,2BAA2B;CACxC,IAAI,CAAC,QAAQ;EACX,IAAI,QAAQ,IAAI,aAAa,eAAe;GAC1C,QAAQ,KAAK,iDAAiD;EAChE;EACA;CACF;CACA,IAAI,OAAO,cAAc,EAAE,aAAa,OAAO,aAAa;EAC1D;EACA,OAAO,aAAa,EAClB,SAAS,OAAO,WAClB;CACF;CACA,IAAI,OAAO,YAAY;EACrB;EACA,OAAO,WAAW,QAAQ;CAC5B,OAAO;EACL;EACA,OAAO,aAAa;GAClB,SAAS;IACR,OAAO;EACV;CACF;AACF"}
|
|
@@ -1042,8 +1042,8 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
|
|
|
1042
1042
|
let tokenName = typeof originalVal === "string" ? originalVal : "";
|
|
1043
1043
|
if (tokenName) {
|
|
1044
1044
|
const slash = tokenName.lastIndexOf("/");
|
|
1045
|
-
const opacity = slash === -1 ? NaN :
|
|
1046
|
-
if (
|
|
1045
|
+
const opacity = slash === -1 ? NaN : +tokenName.slice(slash + 1);
|
|
1046
|
+
if (opacity % 1 === 0 && opacity >= 0 && opacity <= 100) tokenName = tokenName.slice(0, slash);
|
|
1047
1047
|
}
|
|
1048
1048
|
if (tokenName !== "" && (tokenName in styleState.theme || tokenName in (styleState.conf.themes?.[styleState.flatThemeName || ""] || {}) || Object.values(styleState.conf.tokensParsed).some((category) => tokenName in category))) (styleState.tokenProvenance ||= {})[key] = originalVal;
|
|
1049
1049
|
else if (styleState.tokenProvenance && key in styleState.tokenProvenance) delete styleState.tokenProvenance[key];
|
|
@@ -1271,8 +1271,8 @@ function configuredValue(state, property, raw, embedded = false) {
|
|
|
1271
1271
|
let opacity;
|
|
1272
1272
|
const slash = raw.lastIndexOf("/");
|
|
1273
1273
|
if (slash > 0) {
|
|
1274
|
-
const amount =
|
|
1275
|
-
if (
|
|
1274
|
+
const amount = +raw.slice(slash + 1);
|
|
1275
|
+
if (amount % 1 === 0 && amount >= 0 && amount <= 100) {
|
|
1276
1276
|
name = raw.slice(0, slash);
|
|
1277
1277
|
opacity = amount;
|
|
1278
1278
|
}
|
|
@@ -1349,26 +1349,17 @@ function configuredValue(state, property, raw, embedded = false) {
|
|
|
1349
1349
|
const rawNum = Number(name);
|
|
1350
1350
|
const tokens = category ? state.conf.tokensParsed[category] : void 0;
|
|
1351
1351
|
if (tokens && Number.isFinite(rawNum)) for (const key in tokens) {
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
|
|
1352
|
+
const val = tokens[key]?.val;
|
|
1353
|
+
const valNum = typeof val === "number" ? val : Number(val);
|
|
1354
|
+
if (Number.isFinite(valNum)) {
|
|
1355
|
+
const dist = Math.abs(valNum - rawNum);
|
|
1355
1356
|
if (dist < minDistance) {
|
|
1356
1357
|
minDistance = dist;
|
|
1357
1358
|
nearest = key;
|
|
1358
1359
|
}
|
|
1359
|
-
} else {
|
|
1360
|
-
const val = tokens[key]?.val;
|
|
1361
|
-
const valNum = typeof val === "number" ? val : Number(val);
|
|
1362
|
-
if (Number.isFinite(valNum)) {
|
|
1363
|
-
const dist = Math.abs(valNum - rawNum);
|
|
1364
|
-
if (dist < minDistance) {
|
|
1365
|
-
minDistance = dist;
|
|
1366
|
-
nearest = key;
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
1360
|
}
|
|
1370
1361
|
}
|
|
1371
|
-
(0, import_warnOnce.warnOnce)(`numeric-token:${property}=${raw}`, `${property}="${raw}" was passed to CSS as-is with px units${nearest ? `; nearest token is "${nearest}"` : ""}`);
|
|
1362
|
+
if (nearest) (0, import_warnOnce.warnOnce)(`numeric-token:${property}=${raw}`, `${property}="${raw}" was passed to CSS as-is${category === "zIndex" ? "" : " with px units"}${nearest ? `; nearest token is "${nearest}"` : ""}`);
|
|
1372
1363
|
} else if (category === "color" && /^[a-zA-Z0-9-]+$/.test(name) && /[a-zA-Z]/.test(name)) {
|
|
1373
1364
|
const lower = name.toLowerCase();
|
|
1374
1365
|
if (!import_runtime.namedCssColors.has(lower) && !cssWideColorKeywords.has(lower)) {
|
|
@@ -1479,17 +1470,15 @@ function numericUnitValue(value, first, second) {
|
|
|
1479
1470
|
return value.length > first.length && (value.endsWith(first) || value.endsWith(second)) ? +value.slice(0, -first.length) : NaN;
|
|
1480
1471
|
}
|
|
1481
1472
|
function resolveNumericValue(value) {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
const numeric = +value;
|
|
1485
|
-
return Number.isFinite(numeric) ? numeric : value;
|
|
1473
|
+
let numeric = numericUnitValue(value, "px", "dp");
|
|
1474
|
+
return isFinite(numeric) ? numeric : isFinite(numeric = +value) ? numeric : value;
|
|
1486
1475
|
}
|
|
1487
1476
|
function emitResolved(state, property, raw, cursor, originalValue, contextOnly) {
|
|
1488
1477
|
emitProperty(state, property, resolveValue(state, property, raw), cursor, originalValue, contextOnly);
|
|
1489
1478
|
}
|
|
1490
1479
|
function resolveValue(state, property, raw) {
|
|
1491
1480
|
let value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
|
|
1492
|
-
if (!state.flatShouldDoClasses && typeof value === "string" && value !== "") value = resolveNumericValue(value);
|
|
1481
|
+
if (!state.flatShouldDoClasses && typeof value === "string" && value !== "" && property !== "lineHeight") value = resolveNumericValue(value);
|
|
1493
1482
|
return value;
|
|
1494
1483
|
}
|
|
1495
1484
|
function shadowUnit(part) {
|
|
@@ -1565,7 +1554,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
|
|
|
1565
1554
|
if (property === "x" || property === "y" || property === "scale" || property === "scaleX" || property === "scaleY" || property === "rotate") {
|
|
1566
1555
|
let value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
1567
1556
|
if (!state.flatShouldDoClasses && typeof value2 === "string" && !value2.startsWith(import_themeRef.THEME_REF_PREFIX)) {
|
|
1568
|
-
if (property === "rotate" && !
|
|
1557
|
+
if (property === "rotate" && !isFinite(numericUnitValue(value2, "deg", "rad")) && !(0, import_borderComponents.startsValueFunction)(value2)) {
|
|
1569
1558
|
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`native transform "${property}" cannot represent "${value2}"; dropping it`);
|
|
1570
1559
|
if (condition & 1) {
|
|
1571
1560
|
(0, import_runtime.removeTransformValue)(state.transformAccumulator, property);
|
|
@@ -1630,9 +1619,9 @@ function walkConditionalValue(state, property, value, parent, sink, warnMode = 0
|
|
|
1630
1619
|
if (slices === void 0) parsedSlices.set(parsed, slices = []);
|
|
1631
1620
|
const chainCount = segments.length / 5 - 1;
|
|
1632
1621
|
if (property === "aspectRatio" && chainCount === 1) {
|
|
1633
|
-
const left =
|
|
1634
|
-
const right =
|
|
1635
|
-
if (left > 0 && right > 0 &&
|
|
1622
|
+
const left = +value.slice(segments[7], segments[8]);
|
|
1623
|
+
const right = +value.slice(segments[5], segments[6]);
|
|
1624
|
+
if (left > 0 && right > 0 && isFinite(left) && isFinite(right)) return false;
|
|
1636
1625
|
}
|
|
1637
1626
|
for (let index = 0; index < segments.length; index += 5) {
|
|
1638
1627
|
const start = segments[index];
|
|
@@ -1685,7 +1674,7 @@ function walkConditionalValue(state, property, value, parent, sink, warnMode = 0
|
|
|
1685
1674
|
if (cursor[conditionValue] & conditionResolvedFlag || warnMode) emitConditionalValue(state, property, value[key], cursor, value[key], sink, warnMode, contextOnly);
|
|
1686
1675
|
}
|
|
1687
1676
|
}
|
|
1688
|
-
if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && (0, import_grammarConfig.getConfigRevisionState)(state.conf).tokenCategory(property) && (0, import_borderComponents.splitComponents)(lastPayload).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1677
|
+
if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && (0, import_grammarConfig.getConfigRevisionState)(state.conf).tokenCategory(property) && (0, import_grammarConfig.getConfigRevisionState)(state.conf).propertyKind(property) !== 8 && property !== "boxShadow" && property !== "textShadow" && property !== "fontFamily" && property !== "gap" && (0, import_borderComponents.splitComponents)(lastPayload).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1689
1678
|
if (warnMode === 1 && (!import_getCSSStylesAtomic.canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
|
|
1690
1679
|
const resting = property === "opacity" || property.startsWith("scale") ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
|
|
1691
1680
|
if (resting !== null && !state.flatPropertyLayers?.has(property)) emitConditionalValue(state, property, resting, parentCondition, resting, sink, warnMode, contextOnly);
|
|
@@ -1030,8 +1030,8 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
|
|
|
1030
1030
|
var tokenName = typeof originalVal === "string" ? originalVal : "";
|
|
1031
1031
|
if (tokenName) {
|
|
1032
1032
|
var slash = tokenName.lastIndexOf("/");
|
|
1033
|
-
var opacity = slash === -1 ? NaN :
|
|
1034
|
-
if (
|
|
1033
|
+
var opacity = slash === -1 ? NaN : +tokenName.slice(slash + 1);
|
|
1034
|
+
if (opacity % 1 === 0 && opacity >= 0 && opacity <= 100) tokenName = tokenName.slice(0, slash);
|
|
1035
1035
|
}
|
|
1036
1036
|
if (tokenName !== "" && (tokenName in styleState.theme || tokenName in (((_styleState_conf_themes = styleState.conf.themes) === null || _styleState_conf_themes === void 0 ? void 0 : _styleState_conf_themes[styleState.flatThemeName || ""]) || {}) || Object.values(styleState.conf.tokensParsed).some(function(category) {
|
|
1037
1037
|
return tokenName in category;
|
|
@@ -1295,8 +1295,8 @@ function configuredValue(state, property, raw) {
|
|
|
1295
1295
|
var opacity;
|
|
1296
1296
|
var slash = raw.lastIndexOf("/");
|
|
1297
1297
|
if (slash > 0) {
|
|
1298
|
-
var amount =
|
|
1299
|
-
if (
|
|
1298
|
+
var amount = +raw.slice(slash + 1);
|
|
1299
|
+
if (amount % 1 === 0 && amount >= 0 && amount <= 100) {
|
|
1300
1300
|
name = raw.slice(0, slash);
|
|
1301
1301
|
opacity = amount;
|
|
1302
1302
|
}
|
|
@@ -1385,27 +1385,18 @@ function configuredValue(state, property, raw) {
|
|
|
1385
1385
|
var rawNum = Number(name);
|
|
1386
1386
|
var tokens = category1 ? state.conf.tokensParsed[category1] : void 0;
|
|
1387
1387
|
if (tokens && Number.isFinite(rawNum)) for (var key in tokens) {
|
|
1388
|
-
var
|
|
1389
|
-
|
|
1390
|
-
|
|
1388
|
+
var _tokens_key;
|
|
1389
|
+
var val = (_tokens_key = tokens[key]) === null || _tokens_key === void 0 ? void 0 : _tokens_key.val;
|
|
1390
|
+
var valNum = typeof val === "number" ? val : Number(val);
|
|
1391
|
+
if (Number.isFinite(valNum)) {
|
|
1392
|
+
var dist = Math.abs(valNum - rawNum);
|
|
1391
1393
|
if (dist < minDistance) {
|
|
1392
1394
|
minDistance = dist;
|
|
1393
1395
|
nearest = key;
|
|
1394
1396
|
}
|
|
1395
|
-
} else {
|
|
1396
|
-
var _tokens_key;
|
|
1397
|
-
var val = (_tokens_key = tokens[key]) === null || _tokens_key === void 0 ? void 0 : _tokens_key.val;
|
|
1398
|
-
var valNum = typeof val === "number" ? val : Number(val);
|
|
1399
|
-
if (Number.isFinite(valNum)) {
|
|
1400
|
-
var dist1 = Math.abs(valNum - rawNum);
|
|
1401
|
-
if (dist1 < minDistance) {
|
|
1402
|
-
minDistance = dist1;
|
|
1403
|
-
nearest = key;
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
1397
|
}
|
|
1407
1398
|
}
|
|
1408
|
-
(0, import_warnOnce.warnOnce)(`numeric-token:${property}=${raw}`, `${property}="${raw}" was passed to CSS as-is with px units${nearest ? `; nearest token is "${nearest}"` : ""}`);
|
|
1399
|
+
if (nearest) (0, import_warnOnce.warnOnce)(`numeric-token:${property}=${raw}`, `${property}="${raw}" was passed to CSS as-is${category1 === "zIndex" ? "" : " with px units"}${nearest ? `; nearest token is "${nearest}"` : ""}`);
|
|
1409
1400
|
} else if (category1 === "color" && /^[a-zA-Z0-9-]+$/.test(name) && /[a-zA-Z]/.test(name)) {
|
|
1410
1401
|
var lower = name.toLowerCase();
|
|
1411
1402
|
if (!import_runtime.namedCssColors.has(lower) && !cssWideColorKeywords.has(lower)) {
|
|
@@ -1436,9 +1427,9 @@ function configuredValue(state, property, raw) {
|
|
|
1436
1427
|
prev = temp;
|
|
1437
1428
|
}
|
|
1438
1429
|
}
|
|
1439
|
-
var
|
|
1440
|
-
if (
|
|
1441
|
-
minDistance1 =
|
|
1430
|
+
var dist1 = d[m];
|
|
1431
|
+
if (dist1 <= 2 && dist1 < minDistance1) {
|
|
1432
|
+
minDistance1 = dist1;
|
|
1442
1433
|
bestMatch = key1;
|
|
1443
1434
|
}
|
|
1444
1435
|
}
|
|
@@ -1511,9 +1502,21 @@ function emitProperty(state, property, value, cursor, originalValue, contextOnly
|
|
|
1511
1502
|
var theme = cursor ? cursor[conditionTheme] : "";
|
|
1512
1503
|
if (theme) {
|
|
1513
1504
|
if (import_constants.supportsDynamicColorIOS && (0, import_getDynamicVal.isColorStyleKey)(property)) {
|
|
1514
|
-
var _direct
|
|
1515
|
-
var
|
|
1516
|
-
schemes
|
|
1505
|
+
var _direct;
|
|
1506
|
+
var colors = (_direct = direct).flatDynamicColors || (_direct.flatDynamicColors = {});
|
|
1507
|
+
var schemes = colors[property];
|
|
1508
|
+
if (!schemes) {
|
|
1509
|
+
var _direct_flatSlots_get_find, _direct_flatSlots_get, _direct_flatSlots;
|
|
1510
|
+
schemes = colors[property] = {};
|
|
1511
|
+
var base = (_direct_flatSlots = direct.flatSlots) === null || _direct_flatSlots === void 0 ? void 0 : (_direct_flatSlots_get = _direct_flatSlots.get(property)) === null || _direct_flatSlots_get === void 0 ? void 0 : (_direct_flatSlots_get_find = _direct_flatSlots_get.find(function(entry) {
|
|
1512
|
+
return !entry[2];
|
|
1513
|
+
})) === null || _direct_flatSlots_get_find === void 0 ? void 0 : _direct_flatSlots_get_find[1];
|
|
1514
|
+
if (base !== void 0) {
|
|
1515
|
+
schemes.light = (0, import_getDynamicVal.extractValueFromDynamic)(base, "light");
|
|
1516
|
+
schemes.dark = (0, import_getDynamicVal.extractValueFromDynamic)(base, "dark");
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
schemes[theme] = (0, import_getDynamicVal.extractValueFromDynamic)(value, theme);
|
|
1517
1520
|
streamWriteInline(state, property, { dynamic: { ...schemes } }, cursor, originalValue, true, condition & 1 ? condition : condition + 1);
|
|
1518
1521
|
return;
|
|
1519
1522
|
}
|
|
@@ -1565,10 +1568,8 @@ function numericUnitValue(value, first, second) {
|
|
|
1565
1568
|
return value.length > first.length && (value.endsWith(first) || value.endsWith(second)) ? +value.slice(0, -first.length) : NaN;
|
|
1566
1569
|
}
|
|
1567
1570
|
function resolveNumericValue(value) {
|
|
1568
|
-
var
|
|
1569
|
-
|
|
1570
|
-
var numeric = +value;
|
|
1571
|
-
return Number.isFinite(numeric) ? numeric : value;
|
|
1571
|
+
var numeric = numericUnitValue(value, "px", "dp");
|
|
1572
|
+
return isFinite(numeric) ? numeric : isFinite(numeric = +value) ? numeric : value;
|
|
1572
1573
|
}
|
|
1573
1574
|
function emitBorder(state, property, raw, cursor, originalValue, contextOnly) {
|
|
1574
1575
|
if (property === "borderBlock" || property === "borderInline") {
|
|
@@ -1627,7 +1628,7 @@ function emitResolved(state, property, raw, cursor, originalValue, contextOnly)
|
|
|
1627
1628
|
}
|
|
1628
1629
|
function resolveValue(state, property, raw) {
|
|
1629
1630
|
var value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
|
|
1630
|
-
if (typeof value === "string" && value !== "") value = resolveNumericValue(value);
|
|
1631
|
+
if (typeof value === "string" && value !== "" && true) value = resolveNumericValue(value);
|
|
1631
1632
|
return value;
|
|
1632
1633
|
}
|
|
1633
1634
|
function shadowUnit(part) {
|
|
@@ -1679,7 +1680,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
|
|
|
1679
1680
|
if (property === "x" || property === "y" || property === "scale" || property === "scaleX" || property === "scaleY" || property === "rotate") {
|
|
1680
1681
|
var value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
1681
1682
|
if (typeof value2 === "string" && !value2.startsWith(import_themeRef.THEME_REF_PREFIX)) {
|
|
1682
|
-
if (property === "rotate" && !
|
|
1683
|
+
if (property === "rotate" && !isFinite(numericUnitValue(value2, "deg", "rad")) && true) {
|
|
1683
1684
|
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`native transform "${property}" cannot represent "${value2}"; dropping it`);
|
|
1684
1685
|
if (condition & 1) {
|
|
1685
1686
|
(0, import_runtime.removeTransformValue)(state.transformAccumulator, property);
|
|
@@ -1799,9 +1800,9 @@ function walkConditionalValue(state, property, value, parent, sink) {
|
|
|
1799
1800
|
if (slices === void 0) parsedSlices.set(parsed, slices = []);
|
|
1800
1801
|
var chainCount = segments.length / 5 - 1;
|
|
1801
1802
|
if (property === "aspectRatio" && chainCount === 1) {
|
|
1802
|
-
var left =
|
|
1803
|
-
var right =
|
|
1804
|
-
if (left > 0 && right > 0 &&
|
|
1803
|
+
var left = +value.slice(segments[7], segments[8]);
|
|
1804
|
+
var right = +value.slice(segments[5], segments[6]);
|
|
1805
|
+
if (left > 0 && right > 0 && isFinite(left) && isFinite(right)) return false;
|
|
1805
1806
|
}
|
|
1806
1807
|
for (var index = 0; index < segments.length; index += 5) {
|
|
1807
1808
|
var start = segments[index];
|
|
@@ -1862,7 +1863,7 @@ function walkConditionalValue(state, property, value, parent, sink) {
|
|
|
1862
1863
|
if (cursor1[conditionValue] & conditionResolvedFlag || warnMode) emitConditionalValue(state, property, value[key], cursor1, value[key], sink, warnMode, contextOnly);
|
|
1863
1864
|
}
|
|
1864
1865
|
}
|
|
1865
|
-
if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && (0, import_grammarConfig.getConfigRevisionState)(state.conf).tokenCategory(property) && (0, import_borderComponents.splitComponents)(lastPayload).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1866
|
+
if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && (0, import_grammarConfig.getConfigRevisionState)(state.conf).tokenCategory(property) && (0, import_grammarConfig.getConfigRevisionState)(state.conf).propertyKind(property) !== 8 && property !== "boxShadow" && property !== "textShadow" && property !== "fontFamily" && property !== "gap" && (0, import_borderComponents.splitComponents)(lastPayload).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1866
1867
|
if (warnMode === 1 && (!import_getCSSStylesAtomic.canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
|
|
1867
1868
|
var _state_flatPropertyLayers;
|
|
1868
1869
|
var resting = property === "opacity" || property.startsWith("scale") ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
|
|
@@ -1030,8 +1030,8 @@ function recordStyleTokenProvenance(styleState, key, originalVal) {
|
|
|
1030
1030
|
var tokenName = typeof originalVal === "string" ? originalVal : "";
|
|
1031
1031
|
if (tokenName) {
|
|
1032
1032
|
var slash = tokenName.lastIndexOf("/");
|
|
1033
|
-
var opacity = slash === -1 ? NaN :
|
|
1034
|
-
if (
|
|
1033
|
+
var opacity = slash === -1 ? NaN : +tokenName.slice(slash + 1);
|
|
1034
|
+
if (opacity % 1 === 0 && opacity >= 0 && opacity <= 100) tokenName = tokenName.slice(0, slash);
|
|
1035
1035
|
}
|
|
1036
1036
|
if (tokenName !== "" && (tokenName in styleState.theme || tokenName in (((_styleState_conf_themes = styleState.conf.themes) === null || _styleState_conf_themes === void 0 ? void 0 : _styleState_conf_themes[styleState.flatThemeName || ""]) || {}) || Object.values(styleState.conf.tokensParsed).some(function(category) {
|
|
1037
1037
|
return tokenName in category;
|
|
@@ -1295,8 +1295,8 @@ function configuredValue(state, property, raw) {
|
|
|
1295
1295
|
var opacity;
|
|
1296
1296
|
var slash = raw.lastIndexOf("/");
|
|
1297
1297
|
if (slash > 0) {
|
|
1298
|
-
var amount =
|
|
1299
|
-
if (
|
|
1298
|
+
var amount = +raw.slice(slash + 1);
|
|
1299
|
+
if (amount % 1 === 0 && amount >= 0 && amount <= 100) {
|
|
1300
1300
|
name = raw.slice(0, slash);
|
|
1301
1301
|
opacity = amount;
|
|
1302
1302
|
}
|
|
@@ -1385,27 +1385,18 @@ function configuredValue(state, property, raw) {
|
|
|
1385
1385
|
var rawNum = Number(name);
|
|
1386
1386
|
var tokens = category1 ? state.conf.tokensParsed[category1] : void 0;
|
|
1387
1387
|
if (tokens && Number.isFinite(rawNum)) for (var key in tokens) {
|
|
1388
|
-
var
|
|
1389
|
-
|
|
1390
|
-
|
|
1388
|
+
var _tokens_key;
|
|
1389
|
+
var val = (_tokens_key = tokens[key]) === null || _tokens_key === void 0 ? void 0 : _tokens_key.val;
|
|
1390
|
+
var valNum = typeof val === "number" ? val : Number(val);
|
|
1391
|
+
if (Number.isFinite(valNum)) {
|
|
1392
|
+
var dist = Math.abs(valNum - rawNum);
|
|
1391
1393
|
if (dist < minDistance) {
|
|
1392
1394
|
minDistance = dist;
|
|
1393
1395
|
nearest = key;
|
|
1394
1396
|
}
|
|
1395
|
-
} else {
|
|
1396
|
-
var _tokens_key;
|
|
1397
|
-
var val = (_tokens_key = tokens[key]) === null || _tokens_key === void 0 ? void 0 : _tokens_key.val;
|
|
1398
|
-
var valNum = typeof val === "number" ? val : Number(val);
|
|
1399
|
-
if (Number.isFinite(valNum)) {
|
|
1400
|
-
var dist1 = Math.abs(valNum - rawNum);
|
|
1401
|
-
if (dist1 < minDistance) {
|
|
1402
|
-
minDistance = dist1;
|
|
1403
|
-
nearest = key;
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
1397
|
}
|
|
1407
1398
|
}
|
|
1408
|
-
(0, import_warnOnce.warnOnce)(`numeric-token:${property}=${raw}`, `${property}="${raw}" was passed to CSS as-is with px units${nearest ? `; nearest token is "${nearest}"` : ""}`);
|
|
1399
|
+
if (nearest) (0, import_warnOnce.warnOnce)(`numeric-token:${property}=${raw}`, `${property}="${raw}" was passed to CSS as-is${category1 === "zIndex" ? "" : " with px units"}${nearest ? `; nearest token is "${nearest}"` : ""}`);
|
|
1409
1400
|
} else if (category1 === "color" && /^[a-zA-Z0-9-]+$/.test(name) && /[a-zA-Z]/.test(name)) {
|
|
1410
1401
|
var lower = name.toLowerCase();
|
|
1411
1402
|
if (!import_runtime.namedCssColors.has(lower) && !cssWideColorKeywords.has(lower)) {
|
|
@@ -1436,9 +1427,9 @@ function configuredValue(state, property, raw) {
|
|
|
1436
1427
|
prev = temp;
|
|
1437
1428
|
}
|
|
1438
1429
|
}
|
|
1439
|
-
var
|
|
1440
|
-
if (
|
|
1441
|
-
minDistance1 =
|
|
1430
|
+
var dist1 = d[m];
|
|
1431
|
+
if (dist1 <= 2 && dist1 < minDistance1) {
|
|
1432
|
+
minDistance1 = dist1;
|
|
1442
1433
|
bestMatch = key1;
|
|
1443
1434
|
}
|
|
1444
1435
|
}
|
|
@@ -1511,9 +1502,21 @@ function emitProperty(state, property, value, cursor, originalValue, contextOnly
|
|
|
1511
1502
|
var theme = cursor ? cursor[conditionTheme] : "";
|
|
1512
1503
|
if (theme) {
|
|
1513
1504
|
if (import_constants.supportsDynamicColorIOS && (0, import_getDynamicVal.isColorStyleKey)(property)) {
|
|
1514
|
-
var _direct
|
|
1515
|
-
var
|
|
1516
|
-
schemes
|
|
1505
|
+
var _direct;
|
|
1506
|
+
var colors = (_direct = direct).flatDynamicColors || (_direct.flatDynamicColors = {});
|
|
1507
|
+
var schemes = colors[property];
|
|
1508
|
+
if (!schemes) {
|
|
1509
|
+
var _direct_flatSlots_get_find, _direct_flatSlots_get, _direct_flatSlots;
|
|
1510
|
+
schemes = colors[property] = {};
|
|
1511
|
+
var base = (_direct_flatSlots = direct.flatSlots) === null || _direct_flatSlots === void 0 ? void 0 : (_direct_flatSlots_get = _direct_flatSlots.get(property)) === null || _direct_flatSlots_get === void 0 ? void 0 : (_direct_flatSlots_get_find = _direct_flatSlots_get.find(function(entry) {
|
|
1512
|
+
return !entry[2];
|
|
1513
|
+
})) === null || _direct_flatSlots_get_find === void 0 ? void 0 : _direct_flatSlots_get_find[1];
|
|
1514
|
+
if (base !== void 0) {
|
|
1515
|
+
schemes.light = (0, import_getDynamicVal.extractValueFromDynamic)(base, "light");
|
|
1516
|
+
schemes.dark = (0, import_getDynamicVal.extractValueFromDynamic)(base, "dark");
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
schemes[theme] = (0, import_getDynamicVal.extractValueFromDynamic)(value, theme);
|
|
1517
1520
|
streamWriteInline(state, property, { dynamic: { ...schemes } }, cursor, originalValue, true, condition & 1 ? condition : condition + 1);
|
|
1518
1521
|
return;
|
|
1519
1522
|
}
|
|
@@ -1565,10 +1568,8 @@ function numericUnitValue(value, first, second) {
|
|
|
1565
1568
|
return value.length > first.length && (value.endsWith(first) || value.endsWith(second)) ? +value.slice(0, -first.length) : NaN;
|
|
1566
1569
|
}
|
|
1567
1570
|
function resolveNumericValue(value) {
|
|
1568
|
-
var
|
|
1569
|
-
|
|
1570
|
-
var numeric = +value;
|
|
1571
|
-
return Number.isFinite(numeric) ? numeric : value;
|
|
1571
|
+
var numeric = numericUnitValue(value, "px", "dp");
|
|
1572
|
+
return isFinite(numeric) ? numeric : isFinite(numeric = +value) ? numeric : value;
|
|
1572
1573
|
}
|
|
1573
1574
|
function emitBorder(state, property, raw, cursor, originalValue, contextOnly) {
|
|
1574
1575
|
if (property === "borderBlock" || property === "borderInline") {
|
|
@@ -1627,7 +1628,7 @@ function emitResolved(state, property, raw, cursor, originalValue, contextOnly)
|
|
|
1627
1628
|
}
|
|
1628
1629
|
function resolveValue(state, property, raw) {
|
|
1629
1630
|
var value = typeof raw === "string" ? configuredValue(state, property, raw, true) : raw;
|
|
1630
|
-
if (typeof value === "string" && value !== "") value = resolveNumericValue(value);
|
|
1631
|
+
if (typeof value === "string" && value !== "" && true) value = resolveNumericValue(value);
|
|
1631
1632
|
return value;
|
|
1632
1633
|
}
|
|
1633
1634
|
function shadowUnit(part) {
|
|
@@ -1679,7 +1680,7 @@ function emitValue(state, property, raw, cursor, originalValue, contextOnly) {
|
|
|
1679
1680
|
if (property === "x" || property === "y" || property === "scale" || property === "scaleX" || property === "scaleY" || property === "rotate") {
|
|
1680
1681
|
var value2 = typeof raw === "string" ? configuredValue(state, property, raw) : raw;
|
|
1681
1682
|
if (typeof value2 === "string" && !value2.startsWith(import_themeRef.THEME_REF_PREFIX)) {
|
|
1682
|
-
if (property === "rotate" && !
|
|
1683
|
+
if (property === "rotate" && !isFinite(numericUnitValue(value2, "deg", "rad")) && true) {
|
|
1683
1684
|
if (process.env.NODE_ENV === "development") (0, import_warnOnce.warnOnce)(`native transform "${property}" cannot represent "${value2}"; dropping it`);
|
|
1684
1685
|
if (condition & 1) {
|
|
1685
1686
|
(0, import_runtime.removeTransformValue)(state.transformAccumulator, property);
|
|
@@ -1799,9 +1800,9 @@ function walkConditionalValue(state, property, value, parent, sink) {
|
|
|
1799
1800
|
if (slices === void 0) parsedSlices.set(parsed, slices = []);
|
|
1800
1801
|
var chainCount = segments.length / 5 - 1;
|
|
1801
1802
|
if (property === "aspectRatio" && chainCount === 1) {
|
|
1802
|
-
var left =
|
|
1803
|
-
var right =
|
|
1804
|
-
if (left > 0 && right > 0 &&
|
|
1803
|
+
var left = +value.slice(segments[7], segments[8]);
|
|
1804
|
+
var right = +value.slice(segments[5], segments[6]);
|
|
1805
|
+
if (left > 0 && right > 0 && isFinite(left) && isFinite(right)) return false;
|
|
1805
1806
|
}
|
|
1806
1807
|
for (var index = 0; index < segments.length; index += 5) {
|
|
1807
1808
|
var start = segments[index];
|
|
@@ -1862,7 +1863,7 @@ function walkConditionalValue(state, property, value, parent, sink) {
|
|
|
1862
1863
|
if (cursor1[conditionValue] & conditionResolvedFlag || warnMode) emitConditionalValue(state, property, value[key], cursor1, value[key], sink, warnMode, contextOnly);
|
|
1863
1864
|
}
|
|
1864
1865
|
}
|
|
1865
|
-
if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && (0, import_grammarConfig.getConfigRevisionState)(state.conf).tokenCategory(property) && (0, import_borderComponents.splitComponents)(lastPayload).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1866
|
+
if (warnMode && process.env.NODE_ENV === "development" && typeof value === "string" && !hasBase && conditions && (0, import_grammarConfig.getConfigRevisionState)(state.conf).tokenCategory(property) && (0, import_grammarConfig.getConfigRevisionState)(state.conf).propertyKind(property) !== 8 && property !== "boxShadow" && property !== "textShadow" && property !== "fontFamily" && property !== "gap" && (0, import_borderComponents.splitComponents)(lastPayload).length > 1) (0, import_warnOnce.warnOnce)(`${property}="${value}" has multiple values after its first conditional. Write the base value before the first conditional.`);
|
|
1866
1867
|
if (warnMode === 1 && (!import_getCSSStylesAtomic.canGenerateCSS || !state.flatShouldDoClasses) && conditions & 12 && !hasBase) {
|
|
1867
1868
|
var _state_flatPropertyLayers;
|
|
1868
1869
|
var resting = property === "opacity" || property.startsWith("scale") ? 1 : property === "rotate" ? "0deg" : property === "x" || property === "y" ? 0 : null;
|