@tamagui/static 1.0.1-beta.86 → 1.0.1-beta.89

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.
@@ -99,8 +99,8 @@ function createExtractor() {
99
99
  let loadedTamaguiConfig;
100
100
  let hasLogged = false;
101
101
  function isValidStyleKey(name, staticConfig) {
102
- var _a;
103
- return !!(!!((_a = staticConfig.validStyles) == null ? void 0 : _a[name]) || !!import_core_node.pseudoDescriptors[name] || loadedTamaguiConfig.shorthands[name] || (name[0] === "$" ? !!import_core_node.mediaQueryConfig[name.slice(1)] : false));
102
+ var _a, _b;
103
+ return !!(!!((_a = staticConfig.validStyles) == null ? void 0 : _a[name]) || !!import_core_node.pseudoDescriptors[name] || ((_b = staticConfig.variants) == null ? void 0 : _b[name]) || loadedTamaguiConfig.shorthands[name] || (name[0] === "$" ? !!import_core_node.mediaQueryConfig[name.slice(1)] : false));
104
104
  }
105
105
  return {
106
106
  getTamagui() {
@@ -249,6 +249,7 @@ function createExtractor() {
249
249
  }
250
250
  },
251
251
  CallExpression(path) {
252
+ var _a2;
252
253
  if (disable || disableExtraction || extractStyledDefinitions === false) {
253
254
  return;
254
255
  }
@@ -270,15 +271,14 @@ function createExtractor() {
270
271
  const componentSkipProps = /* @__PURE__ */ new Set([
271
272
  ...Component.staticConfig.inlineWhenUnflattened || [],
272
273
  ...Component.staticConfig.inlineProps || [],
273
- ...Component.staticConfig.deoptProps || []
274
+ ...Component.staticConfig.deoptProps || [],
275
+ "variants",
276
+ "defaultVariants",
277
+ "fontFamily",
278
+ "name"
274
279
  ]);
275
280
  const skipped = [];
276
281
  const styles = {};
277
- const skipProps = {
278
- variants: true,
279
- defaultVariants: true,
280
- name: true
281
- };
282
282
  const staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(path.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug);
283
283
  const attemptEval = !evaluateVars ? import_evaluateAstNode.evaluateAstNode : (0, import_createEvaluator.createEvaluator)({
284
284
  tamaguiConfig,
@@ -288,7 +288,7 @@ function createExtractor() {
288
288
  });
289
289
  const attemptEvalSafe = (0, import_createEvaluator.createSafeEvaluator)(attemptEval);
290
290
  for (const property of definition.properties) {
291
- if (!t.isObjectProperty(property) || !t.isIdentifier(property.key) || skipProps[property.key.name] || !isValidStyleKey(property.key.name, Component.staticConfig) || componentSkipProps.has(property.key.name)) {
291
+ if (!t.isObjectProperty(property) || !t.isIdentifier(property.key) || !isValidStyleKey(property.key.name, Component.staticConfig) || ((_a2 = Component.staticConfig.variants) == null ? void 0 : _a2[property.key.name]) || componentSkipProps.has(property.key.name)) {
292
292
  skipped.push(property);
293
293
  continue;
294
294
  }
@@ -321,6 +321,9 @@ function createExtractor() {
321
321
  }
322
322
  definition.properties = skipped;
323
323
  for (const cn in classNames) {
324
+ if (componentSkipProps.has(cn)) {
325
+ continue;
326
+ }
324
327
  const val = classNames[cn];
325
328
  definition.properties.push(t.objectProperty(t.stringLiteral(cn), t.stringLiteral(val)));
326
329
  }
@@ -335,7 +338,7 @@ function createExtractor() {
335
338
  }
336
339
  },
337
340
  JSXElement(traversePath) {
338
- var _a2, _b2, _c, _d, _e;
341
+ var _a2, _b2, _c, _d;
339
342
  tm.mark("jsx-element", shouldPrintDebug === "verbose");
340
343
  const node = traversePath.node.openingElement;
341
344
  const ogAttributes = node.attributes;
@@ -819,7 +822,7 @@ function createExtractor() {
819
822
  const variants = staticConfig.variants || {};
820
823
  const isTextView = staticConfig.isText || false;
821
824
  const validStyles = (staticConfig == null ? void 0 : staticConfig.validStyles) ?? {};
822
- let tagName = ((_a2 = staticConfig.defaultProps) == null ? void 0 : _a2.tag) ?? (isTextView ? "span" : "div");
825
+ let tagName = staticConfig.defaultProps.tag ?? (isTextView ? "span" : "div");
823
826
  traversePath.get("openingElement").get("attributes").forEach((path) => {
824
827
  const attr = path.node;
825
828
  if (t.isJSXSpreadAttribute(attr))
@@ -977,7 +980,7 @@ function createExtractor() {
977
980
  let themeVal = inlined.get("theme");
978
981
  inlined.delete("theme");
979
982
  for (const [key] of [...inlined]) {
980
- if (INLINE_EXTRACTABLE[key] || ((_b2 = staticConfig.variants) == null ? void 0 : _b2[key])) {
983
+ if (INLINE_EXTRACTABLE[key] || ((_a2 = staticConfig.variants) == null ? void 0 : _a2[key])) {
981
984
  inlined.delete(key);
982
985
  }
983
986
  }
@@ -1008,7 +1011,7 @@ function createExtractor() {
1008
1011
  t.jsxAttribute(t.jsxIdentifier("name"), themeVal.value)
1009
1012
  ]), t.jsxClosingElement(t.jsxIdentifier("_TamaguiTheme")), [traversePath.node]));
1010
1013
  }
1011
- if (shouldFlatten && staticConfig.defaultProps) {
1014
+ if (shouldFlatten) {
1012
1015
  const defaultStyleAttrs = Object.keys(staticConfig.defaultProps).flatMap((key) => {
1013
1016
  if (!isValidStyleKey(key, staticConfig)) {
1014
1017
  return [];
@@ -1040,10 +1043,10 @@ function createExtractor() {
1040
1043
  for (const cur of attrs) {
1041
1044
  if (cur.type === "style") {
1042
1045
  for (const key in cur.value) {
1043
- const shouldEnsureOverridden = !!((_c = staticConfig.ensureOverriddenProp) == null ? void 0 : _c[key]);
1046
+ const shouldEnsureOverridden = !!((_b2 = staticConfig.ensureOverriddenProp) == null ? void 0 : _b2[key]);
1044
1047
  const isSetInAttrsAlready = attrs.some((x) => x.type === "attr" && x.value.type === "JSXAttribute" && x.value.name.name === key);
1045
1048
  if (!isSetInAttrsAlready) {
1046
- const isVariant = !!((_d = staticConfig.variants) == null ? void 0 : _d[cur.name || ""]);
1049
+ const isVariant = !!((_c = staticConfig.variants) == null ? void 0 : _c[cur.name || ""]);
1047
1050
  if (isVariant || shouldEnsureOverridden) {
1048
1051
  ensureOverridden[key] = true;
1049
1052
  }
@@ -1303,7 +1306,7 @@ function createExtractor() {
1303
1306
  if (INLINE_EXTRACTABLE[name]) {
1304
1307
  attr.value.name.name = INLINE_EXTRACTABLE[name];
1305
1308
  }
1306
- if ((_e = staticConfig.variants) == null ? void 0 : _e[name]) {
1309
+ if ((_d = staticConfig.variants) == null ? void 0 : _d[name]) {
1307
1310
  const expanded = getStyles({});
1308
1311
  }
1309
1312
  }