@tamagui/core 1.125.33 → 1.125.35

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/native.js CHANGED
@@ -6262,12 +6262,12 @@ var require_useThemeState_native = __commonJS({
6262
6262
  function getNewThemeName() {
6263
6263
  var parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", { name, reset, componentName, inverse, debug } = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
6264
6264
  if (name && reset) throw new Error(process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time.");
6265
+ var { themes: themes2 } = (0, import_config.getConfig)();
6265
6266
  if (reset) {
6266
- if (!parentName) throw new Error("\u203C\uFE0F");
6267
- var lastPartIndex = parentName.lastIndexOf("_");
6268
- return lastPartIndex <= 0 ? parentName : parentName.slice(lastPartIndex);
6267
+ var lastPartIndex = parentName.lastIndexOf("_"), name1 = lastPartIndex <= 0 ? parentName : parentName.slice(lastPartIndex), scheme = parentName.slice(0, lastPartIndex), result = themes2[name1] ? name1 : scheme;
6268
+ return result;
6269
6269
  }
6270
- var { themes: themes2 } = (0, import_config.getConfig)(), parentParts = parentName.split("_"), lastName = parentParts[parentParts.length - 1];
6270
+ var parentParts = parentName.split("_"), lastName = parentParts[parentParts.length - 1];
6271
6271
  lastName && lastName[0].toLowerCase() !== lastName[0] && parentParts.pop();
6272
6272
  for (var subNames = [
6273
6273
  name && componentName ? `${name}_${componentName}` : void 0,
@@ -6296,8 +6296,8 @@ var require_useThemeState_native = __commonJS({
6296
6296
  }
6297
6297
  if (inverse) {
6298
6298
  found || (found = parentName);
6299
- var scheme = found.split("_")[0];
6300
- found = found.replace(new RegExp(`^${scheme}`), scheme === "light" ? "dark" : "light");
6299
+ var scheme1 = found.split("_")[0];
6300
+ found = found.replace(new RegExp(`^${scheme1}`), scheme1 === "light" ? "dark" : "light");
6301
6301
  }
6302
6302
  return !forceUpdate && found === parentName && // if its a scheme only sub-theme, we always consider it "new" because it likely inverses
6303
6303
  // and we want to avoid reparenting