@tamagui/static 1.135.3 → 1.135.4-1761749240853

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.
Files changed (181) hide show
  1. package/dist/check-dep-versions.mjs +268 -0
  2. package/dist/check-dep-versions.mjs.map +1 -0
  3. package/dist/checkDeps.mjs +33 -0
  4. package/dist/checkDeps.mjs.map +1 -0
  5. package/dist/constants.mjs +50 -0
  6. package/dist/constants.mjs.map +1 -0
  7. package/dist/exports.mjs +42 -0
  8. package/dist/exports.mjs.map +1 -0
  9. package/dist/extractor/accessSafe.mjs +47 -0
  10. package/dist/extractor/accessSafe.mjs.map +1 -0
  11. package/dist/extractor/babelParse.mjs +55 -0
  12. package/dist/extractor/babelParse.mjs.map +1 -0
  13. package/dist/extractor/bundle.mjs +149 -0
  14. package/dist/extractor/bundle.mjs.map +1 -0
  15. package/dist/extractor/bundleConfig.mjs +331 -0
  16. package/dist/extractor/bundleConfig.mjs.map +1 -0
  17. package/dist/extractor/concatClassName.mjs +79 -0
  18. package/dist/extractor/concatClassName.mjs.map +1 -0
  19. package/dist/extractor/createEvaluator.mjs +76 -0
  20. package/dist/extractor/createEvaluator.mjs.map +1 -0
  21. package/dist/extractor/createExtractor.mjs +976 -0
  22. package/dist/extractor/createExtractor.mjs.map +1 -0
  23. package/dist/extractor/createLogger.mjs +46 -0
  24. package/dist/extractor/createLogger.mjs.map +1 -0
  25. package/dist/extractor/errors.mjs +27 -0
  26. package/dist/extractor/errors.mjs.map +1 -0
  27. package/dist/extractor/esbuildAliasPlugin.mjs +45 -0
  28. package/dist/extractor/esbuildAliasPlugin.mjs.map +1 -0
  29. package/dist/extractor/esbuildTsconfigPaths.mjs +85 -0
  30. package/dist/extractor/esbuildTsconfigPaths.mjs.map +1 -0
  31. package/dist/extractor/evaluateAstNode.mjs +84 -0
  32. package/dist/extractor/evaluateAstNode.mjs.map +1 -0
  33. package/dist/extractor/extractHelpers.mjs +121 -0
  34. package/dist/extractor/extractHelpers.mjs.map +1 -0
  35. package/dist/extractor/extractMediaStyle.mjs +129 -0
  36. package/dist/extractor/extractMediaStyle.mjs.map +1 -0
  37. package/dist/extractor/extractToClassNames.mjs +304 -0
  38. package/dist/extractor/extractToClassNames.mjs.map +1 -0
  39. package/dist/extractor/extractToNative.mjs +262 -0
  40. package/dist/extractor/extractToNative.mjs.map +1 -0
  41. package/dist/extractor/findTopmostFunction.mjs +35 -0
  42. package/dist/extractor/findTopmostFunction.mjs.map +1 -0
  43. package/dist/extractor/{generatedUid.native.js → generatedUid.mjs} +26 -23
  44. package/dist/extractor/generatedUid.mjs.map +1 -0
  45. package/dist/extractor/getPrefixLogs.mjs +30 -0
  46. package/dist/extractor/getPrefixLogs.mjs.map +1 -0
  47. package/dist/extractor/getPropValueFromAttributes.mjs +68 -0
  48. package/dist/extractor/getPropValueFromAttributes.mjs.map +1 -0
  49. package/dist/extractor/getSourceModule.mjs +65 -0
  50. package/dist/extractor/getSourceModule.mjs.map +1 -0
  51. package/dist/extractor/getStaticBindingsForScope.mjs +149 -0
  52. package/dist/extractor/getStaticBindingsForScope.mjs.map +1 -0
  53. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.mjs +36 -0
  54. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +1 -0
  55. package/dist/extractor/literalToAst.mjs +85 -0
  56. package/dist/extractor/literalToAst.mjs.map +1 -0
  57. package/dist/extractor/loadFile.mjs +12 -0
  58. package/dist/extractor/loadFile.mjs.map +1 -0
  59. package/dist/extractor/loadTamagui.mjs +296 -0
  60. package/dist/extractor/loadTamagui.mjs.map +1 -0
  61. package/dist/extractor/logLines.mjs +36 -0
  62. package/dist/extractor/logLines.mjs.map +1 -0
  63. package/dist/extractor/{normalizeTernaries.native.js → normalizeTernaries.mjs} +45 -31
  64. package/dist/extractor/normalizeTernaries.mjs.map +1 -0
  65. package/dist/extractor/propsToFontFamilyCache.mjs +39 -0
  66. package/dist/extractor/propsToFontFamilyCache.mjs.map +1 -0
  67. package/dist/extractor/regenerateConfig.mjs +145 -0
  68. package/dist/extractor/regenerateConfig.mjs.map +1 -0
  69. package/dist/extractor/removeUnusedHooks.mjs +77 -0
  70. package/dist/extractor/removeUnusedHooks.mjs.map +1 -0
  71. package/dist/extractor/timer.mjs +44 -0
  72. package/dist/extractor/timer.mjs.map +1 -0
  73. package/dist/extractor/{validHTMLAttributes.native.js → validHTMLAttributes.mjs} +17 -16
  74. package/dist/extractor/validHTMLAttributes.mjs.map +1 -0
  75. package/dist/extractor/watchTamaguiConfig.mjs +59 -0
  76. package/dist/extractor/watchTamaguiConfig.mjs.map +1 -0
  77. package/dist/getPragmaOptions.mjs +55 -0
  78. package/dist/getPragmaOptions.mjs.map +1 -0
  79. package/dist/helpers/memoize.mjs +38 -0
  80. package/dist/helpers/memoize.mjs.map +1 -0
  81. package/dist/helpers/requireTamaguiCore.mjs +34 -0
  82. package/dist/helpers/requireTamaguiCore.mjs.map +1 -0
  83. package/dist/index.mjs +41 -0
  84. package/dist/index.mjs.map +1 -0
  85. package/dist/registerRequire.mjs +107 -0
  86. package/dist/registerRequire.mjs.map +1 -0
  87. package/dist/server.mjs +76 -0
  88. package/dist/server.mjs.map +1 -0
  89. package/dist/setup.mjs +2 -0
  90. package/dist/setup.mjs.map +1 -0
  91. package/dist/{types.native.js → types.mjs} +8 -6
  92. package/dist/types.mjs.map +1 -0
  93. package/package.json +19 -21
  94. package/dist/check-dep-versions.native.js +0 -602
  95. package/dist/check-dep-versions.native.js.map +0 -6
  96. package/dist/checkDeps.native.js +0 -34
  97. package/dist/checkDeps.native.js.map +0 -6
  98. package/dist/constants.native.js +0 -45
  99. package/dist/constants.native.js.map +0 -6
  100. package/dist/exports.native.js +0 -52
  101. package/dist/exports.native.js.map +0 -6
  102. package/dist/extractor/accessSafe.native.js +0 -48
  103. package/dist/extractor/accessSafe.native.js.map +0 -6
  104. package/dist/extractor/babelParse.native.js +0 -62
  105. package/dist/extractor/babelParse.native.js.map +0 -6
  106. package/dist/extractor/bundle.native.js +0 -168
  107. package/dist/extractor/bundle.native.js.map +0 -6
  108. package/dist/extractor/bundleConfig.native.js +0 -394
  109. package/dist/extractor/bundleConfig.native.js.map +0 -6
  110. package/dist/extractor/concatClassName.native.js +0 -69
  111. package/dist/extractor/concatClassName.native.js.map +0 -6
  112. package/dist/extractor/createEvaluator.native.js +0 -63
  113. package/dist/extractor/createEvaluator.native.js.map +0 -6
  114. package/dist/extractor/createExtractor.native.js +0 -1229
  115. package/dist/extractor/createExtractor.native.js.map +0 -6
  116. package/dist/extractor/createLogger.native.js +0 -35
  117. package/dist/extractor/createLogger.native.js.map +0 -6
  118. package/dist/extractor/errors.native.js +0 -119
  119. package/dist/extractor/errors.native.js.map +0 -6
  120. package/dist/extractor/esbuildAliasPlugin.native.js +0 -52
  121. package/dist/extractor/esbuildAliasPlugin.native.js.map +0 -6
  122. package/dist/extractor/esbuildTsconfigPaths.native.js +0 -79
  123. package/dist/extractor/esbuildTsconfigPaths.native.js.map +0 -6
  124. package/dist/extractor/evaluateAstNode.native.js +0 -98
  125. package/dist/extractor/evaluateAstNode.native.js.map +0 -6
  126. package/dist/extractor/extractHelpers.native.js +0 -183
  127. package/dist/extractor/extractHelpers.native.js.map +0 -6
  128. package/dist/extractor/extractMediaStyle.native.js +0 -138
  129. package/dist/extractor/extractMediaStyle.native.js.map +0 -6
  130. package/dist/extractor/extractToClassNames.native.js +0 -332
  131. package/dist/extractor/extractToClassNames.native.js.map +0 -6
  132. package/dist/extractor/extractToNative.native.js +0 -276
  133. package/dist/extractor/extractToNative.native.js.map +0 -6
  134. package/dist/extractor/findTopmostFunction.native.js +0 -37
  135. package/dist/extractor/findTopmostFunction.native.js.map +0 -6
  136. package/dist/extractor/generatedUid.native.js.map +0 -6
  137. package/dist/extractor/getPrefixLogs.native.js +0 -30
  138. package/dist/extractor/getPrefixLogs.native.js.map +0 -6
  139. package/dist/extractor/getPropValueFromAttributes.native.js +0 -68
  140. package/dist/extractor/getPropValueFromAttributes.native.js.map +0 -6
  141. package/dist/extractor/getSourceModule.native.js +0 -80
  142. package/dist/extractor/getSourceModule.native.js.map +0 -6
  143. package/dist/extractor/getStaticBindingsForScope.native.js +0 -183
  144. package/dist/extractor/getStaticBindingsForScope.native.js.map +0 -6
  145. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.native.js +0 -37
  146. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +0 -6
  147. package/dist/extractor/literalToAst.native.js +0 -106
  148. package/dist/extractor/literalToAst.native.js.map +0 -6
  149. package/dist/extractor/loadFile.native.js +0 -21
  150. package/dist/extractor/loadFile.native.js.map +0 -6
  151. package/dist/extractor/loadTamagui.native.js +0 -314
  152. package/dist/extractor/loadTamagui.native.js.map +0 -6
  153. package/dist/extractor/logLines.native.js +0 -53
  154. package/dist/extractor/logLines.native.js.map +0 -6
  155. package/dist/extractor/normalizeTernaries.native.js.map +0 -6
  156. package/dist/extractor/propsToFontFamilyCache.native.js +0 -40
  157. package/dist/extractor/propsToFontFamilyCache.native.js.map +0 -6
  158. package/dist/extractor/regenerateConfig.native.js +0 -148
  159. package/dist/extractor/regenerateConfig.native.js.map +0 -6
  160. package/dist/extractor/removeUnusedHooks.native.js +0 -111
  161. package/dist/extractor/removeUnusedHooks.native.js.map +0 -6
  162. package/dist/extractor/timer.native.js +0 -44
  163. package/dist/extractor/timer.native.js.map +0 -6
  164. package/dist/extractor/validHTMLAttributes.native.js.map +0 -6
  165. package/dist/extractor/watchTamaguiConfig.native.js +0 -60
  166. package/dist/extractor/watchTamaguiConfig.native.js.map +0 -6
  167. package/dist/getPragmaOptions.native.js +0 -62
  168. package/dist/getPragmaOptions.native.js.map +0 -6
  169. package/dist/helpers/memoize.native.js +0 -40
  170. package/dist/helpers/memoize.native.js.map +0 -6
  171. package/dist/helpers/requireTamaguiCore.native.js +0 -34
  172. package/dist/helpers/requireTamaguiCore.native.js.map +0 -6
  173. package/dist/index.native.js +0 -35
  174. package/dist/index.native.js.map +0 -6
  175. package/dist/registerRequire.native.js +0 -124
  176. package/dist/registerRequire.native.js.map +0 -6
  177. package/dist/server.native.js +0 -70
  178. package/dist/server.native.js.map +0 -6
  179. package/dist/setup.native.js +0 -2
  180. package/dist/setup.native.js.map +0 -6
  181. package/dist/types.native.js.map +0 -6
@@ -1,183 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
- var extractHelpers_exports = {};
25
- __export(extractHelpers_exports, {
26
- attrStr: () => attrStr,
27
- findComponentName: () => findComponentName,
28
- getValidComponent: () => getValidComponent,
29
- getValidComponentsPaths: () => getValidComponentsPaths,
30
- getValidImport: () => getValidImport,
31
- isComponentPackage: () => isComponentPackage,
32
- isInsideComponentPackage: () => isInsideComponentPackage,
33
- isPresent: () => isPresent,
34
- isSimpleSpread: () => isSimpleSpread,
35
- isValidImport: () => isValidImport,
36
- isValidModule: () => isValidModule,
37
- isValidThemeHook: () => isValidThemeHook,
38
- objToStr: () => objToStr,
39
- ternaryStr: () => ternaryStr
40
- });
41
- module.exports = __toCommonJS(extractHelpers_exports);
42
- var import_node_path = require("node:path"), import_generator = __toESM(require("@babel/generator")), t = __toESM(require("@babel/types")), import_find_root = __toESM(require("find-root")), import_memoize = require("../helpers/memoize");
43
- function isPresent(input) {
44
- return input != null;
45
- }
46
- function isSimpleSpread(node) {
47
- return t.isIdentifier(node.argument) || t.isMemberExpression(node.argument);
48
- }
49
- var attrStr = function(attr) {
50
- return attr ? attr.type === "attr" ? getNameAttr(attr.value) : attr.type === "ternary" ? `...${ternaryStr(attr.value)}` : `${attr.type}(${objToStr(attr.value)})` : "";
51
- }, objToStr = function(obj) {
52
- var spacer = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ", ";
53
- return obj ? `{${Object.entries(obj).map(function(param) {
54
- var [k, v] = param;
55
- return `${k}:${Array.isArray(v) ? "[...]" : v && typeof v == "object" ? `${objToStr(v, ",")}` : JSON.stringify(v)}`;
56
- }).join(spacer)}}` : `${obj}`;
57
- }, getNameAttr = function(attr) {
58
- return t.isJSXSpreadAttribute(attr) ? `...${attr.argument.name}` : "name" in attr ? attr.name.name : `unknown-${attr.type}`;
59
- }, ternaryStr = function(x) {
60
- var conditional = t.isIdentifier(x.test) ? x.test.name : t.isMemberExpression(x.test) ? [
61
- x.test.object.name,
62
- x.test.property.name
63
- ] : (
64
- // @ts-ignore
65
- (0, import_generator.default)(x.test).code
66
- );
67
- return [
68
- "ternary(",
69
- conditional,
70
- isFilledObj(x.consequent) ? ` ? ${objToStr(x.consequent)}` : " ? \u{1F6AB}",
71
- isFilledObj(x.alternate) ? ` : ${objToStr(x.alternate)}` : " : \u{1F6AB}",
72
- ")"
73
- ].flat().join("");
74
- }, isFilledObj = function(obj) {
75
- return obj && Object.keys(obj).length;
76
- };
77
- function findComponentName(scope) {
78
- for (var componentName = "", cur = scope.path; cur.parentPath && !t.isProgram(cur.parentPath.parent); )
79
- cur = cur.parentPath;
80
- var node = cur.parent;
81
- if (t.isExportNamedDeclaration(node) && (node = node.declaration), t.isVariableDeclaration(node)) {
82
- var [dec] = node.declarations;
83
- if (t.isVariableDeclarator(dec) && t.isIdentifier(dec.id))
84
- return dec.id.name;
85
- }
86
- if (t.isFunctionDeclaration(node)) {
87
- var _node_id;
88
- return (_node_id = node.id) === null || _node_id === void 0 ? void 0 : _node_id.name;
89
- }
90
- return componentName;
91
- }
92
- function isValidThemeHook(props, jsxPath, n, sourcePath) {
93
- var _binding_scope_getBinding;
94
- if (!t.isIdentifier(n.object) || !t.isIdentifier(n.property)) return !1;
95
- var bindings = jsxPath.scope.getAllBindings(), binding = bindings[n.object.name];
96
- if (!(binding != null && binding.path) || !binding.path.isVariableDeclarator()) return !1;
97
- var init = binding.path.node.init;
98
- if (!init || !t.isCallExpression(init) || !t.isIdentifier(init.callee) || init.callee.name !== "useTheme") return !1;
99
- var importNode = (_binding_scope_getBinding = binding.scope.getBinding("useTheme")) === null || _binding_scope_getBinding === void 0 ? void 0 : _binding_scope_getBinding.path.parent;
100
- return !(!t.isImportDeclaration(importNode) || sourcePath && !isValidImport(props, sourcePath));
101
- }
102
- var isInsideComponentPackage = function(props, moduleName) {
103
- return getValidComponentsPaths(props).some(function(path) {
104
- return moduleName.startsWith(path);
105
- });
106
- }, isComponentPackage = function(props, srcName) {
107
- return getValidComponentsPaths(props).some(function(path) {
108
- return srcName.startsWith(path);
109
- });
110
- };
111
- function getValidComponent(props, moduleName, componentName) {
112
- if (componentName[0].toUpperCase() !== componentName[0])
113
- return !1;
114
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
115
- try {
116
- for (var _iterator = props.allLoadedComponents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
117
- var loaded = _step.value;
118
- if (loaded) {
119
- var isInModule = moduleName === "*" || moduleName.startsWith(loaded.moduleName), foundComponent = loaded.nameToInfo[componentName];
120
- if (isInModule && foundComponent)
121
- return foundComponent;
122
- }
123
- }
124
- } catch (err) {
125
- _didIteratorError = !0, _iteratorError = err;
126
- } finally {
127
- try {
128
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
129
- } finally {
130
- if (_didIteratorError)
131
- throw _iteratorError;
132
- }
133
- }
134
- return null;
135
- }
136
- var isValidModule = function(props, moduleName) {
137
- if (typeof moduleName != "string")
138
- throw new Error("No module name");
139
- var isLocal = moduleName.startsWith(".");
140
- return {
141
- isLocal,
142
- isValid: isLocal ? isInsideComponentPackage(props, moduleName) : isComponentPackage(props, moduleName)
143
- };
144
- }, getValidImport = function(props, moduleName, componentName) {
145
- var { isValid, isLocal } = isValidModule(props, moduleName);
146
- return !isValid || !componentName ? null : getValidComponent(props, isLocal ? "*" : moduleName, componentName) || null;
147
- }, isValidImport = function(props, moduleName, componentName) {
148
- return componentName ? !!getValidImport(props, moduleName, componentName) : isValidModule(props, moduleName).isValid;
149
- }, getValidComponentPackages = (0, import_memoize.memoize)(function(props) {
150
- return [
151
- .../* @__PURE__ */ new Set([
152
- "@tamagui/core",
153
- "tamagui",
154
- ...props.components || []
155
- ])
156
- ];
157
- }), getValidComponentsPaths = (0, import_memoize.memoize)(function(props) {
158
- return getValidComponentPackages(props).flatMap(function(pkg) {
159
- var root = (0, import_find_root.default)(pkg), based = (0, import_node_path.basename)(root);
160
- return [
161
- based,
162
- pkg
163
- ].filter(Boolean);
164
- });
165
- });
166
- // Annotate the CommonJS export names for ESM import in node:
167
- 0 && (module.exports = {
168
- attrStr,
169
- findComponentName,
170
- getValidComponent,
171
- getValidComponentsPaths,
172
- getValidImport,
173
- isComponentPackage,
174
- isInsideComponentPackage,
175
- isPresent,
176
- isSimpleSpread,
177
- isValidImport,
178
- isValidModule,
179
- isValidThemeHook,
180
- objToStr,
181
- ternaryStr
182
- });
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"names": ["generate", "findRoot"]
6
- }
@@ -1,138 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
- var extractMediaStyle_exports = {};
25
- __export(extractMediaStyle_exports, {
26
- extractMediaStyle: () => extractMediaStyle,
27
- isValidMediaCall: () => isValidMediaCall
28
- });
29
- module.exports = __toCommonJS(extractMediaStyle_exports);
30
- var t = __toESM(require("@babel/types")), core = __toESM(require("@tamagui/core")), import_requireTamaguiCore = require("../helpers/requireTamaguiCore"), import_extractHelpers = require("./extractHelpers");
31
- function extractMediaStyle(props, ternary, jsxPath, tamaguiConfig, sourcePath) {
32
- var importance = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, shouldPrintDebug = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !1, { getCSSStylesAtomic } = (0, import_requireTamaguiCore.requireTamaguiCore)("web"), mt = getMediaQueryTernary(props, ternary, jsxPath, sourcePath);
33
- if (!mt)
34
- return null;
35
- var { key } = mt, mq = tamaguiConfig.media[key];
36
- if (!mq)
37
- return console.error(`Media query "${key}" not found: ${Object.keys(tamaguiConfig.media)}`), null;
38
- var getStyleObj = function(styleObj) {
39
- var negate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
40
- return styleObj ? {
41
- styleObj,
42
- negate
43
- } : null;
44
- }, styleOpts = [
45
- getStyleObj(ternary.consequent, !1),
46
- getStyleObj(ternary.alternate, !0)
47
- ].filter(import_extractHelpers.isPresent);
48
- if (shouldPrintDebug && !styleOpts.length)
49
- return console.info(" media query, no styles?"), null;
50
- var mediaKeys = Object.keys(tamaguiConfig.media), mediaKeyPrecendence = mediaKeys.reduce(function(acc, cur, i) {
51
- return acc[cur] = new Array(importance + 1).fill(":root").join(""), acc;
52
- }, {}), mediaStyles = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
53
- try {
54
- for (var _loop = function() {
55
- var { styleObj, negate } = _step.value, styles = getCSSStylesAtomic(styleObj), singleMediaStyles = styles.map(function(style) {
56
- var mediaStyle = core.createMediaStyle(style, key, tamaguiConfig.media, !0, negate), className = `.${mediaStyle[core.StyleObjectIdentifier]}`;
57
- return {
58
- ...mediaStyle,
59
- className
60
- };
61
- });
62
- shouldPrintDebug === "verbose" && console.info(" media styles:", importance, styleObj, singleMediaStyles.map(function(x) {
63
- return x[core.StyleObjectIdentifier];
64
- }).join(", ")), mediaStyles = [
65
- ...mediaStyles,
66
- ...singleMediaStyles
67
- ];
68
- }, _iterator = styleOpts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) _loop();
69
- } catch (err) {
70
- _didIteratorError = !0, _iteratorError = err;
71
- } finally {
72
- try {
73
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
74
- } finally {
75
- if (_didIteratorError)
76
- throw _iteratorError;
77
- }
78
- }
79
- return ternary.remove(), {
80
- mediaStyles,
81
- ternaryWithoutMedia: mt.ternaryWithoutMedia
82
- };
83
- }
84
- function getMediaQueryTernary(props, ternary, jsxPath, sourcePath) {
85
- if (t.isLogicalExpression(ternary.test) && ternary.test.operator === "&&") {
86
- var mediaLeft = getMediaInfoFromExpression(props, ternary.test.left, jsxPath, sourcePath, ternary.inlineMediaQuery);
87
- if (mediaLeft)
88
- return {
89
- ...mediaLeft,
90
- ternaryWithoutMedia: {
91
- ...ternary,
92
- test: ternary.test.right
93
- }
94
- };
95
- }
96
- var result = getMediaInfoFromExpression(props, ternary.test, jsxPath, sourcePath, ternary.inlineMediaQuery);
97
- return result ? {
98
- ...result,
99
- ternaryWithoutMedia: null
100
- } : null;
101
- }
102
- function getMediaInfoFromExpression(props, test, jsxPath, sourcePath, inlineMediaQuery) {
103
- if (inlineMediaQuery)
104
- return {
105
- key: inlineMediaQuery,
106
- bindingName: inlineMediaQuery
107
- };
108
- if (t.isMemberExpression(test) && t.isIdentifier(test.object) && t.isIdentifier(test.property)) {
109
- var _binding_path, name = test.object.name, key = test.property.name, bindings = jsxPath.scope.getAllBindings(), binding = bindings[name];
110
- if (!binding) return !1;
111
- var bindingNode = (_binding_path = binding.path) === null || _binding_path === void 0 ? void 0 : _binding_path.node;
112
- return !t.isVariableDeclarator(bindingNode) || !bindingNode.init || !isValidMediaCall(props, jsxPath, bindingNode.init, sourcePath) ? !1 : {
113
- key,
114
- bindingName: name
115
- };
116
- }
117
- if (t.isIdentifier(test)) {
118
- var _jsxPath_scope_getBinding_path, _jsxPath_scope_getBinding, key1 = test.name, node = (_jsxPath_scope_getBinding = jsxPath.scope.getBinding(test.name)) === null || _jsxPath_scope_getBinding === void 0 || (_jsxPath_scope_getBinding_path = _jsxPath_scope_getBinding.path) === null || _jsxPath_scope_getBinding_path === void 0 ? void 0 : _jsxPath_scope_getBinding_path.node;
119
- return !t.isVariableDeclarator(node) || !node.init || !isValidMediaCall(props, jsxPath, node.init, sourcePath) ? !1 : {
120
- key: key1,
121
- bindingName: key1
122
- };
123
- }
124
- return null;
125
- }
126
- function isValidMediaCall(props, jsxPath, init, sourcePath) {
127
- if (!init || !t.isCallExpression(init) || !t.isIdentifier(init.callee) || init.callee.name !== "useMedia") return !1;
128
- var bindings = jsxPath.scope.getAllBindings(), mediaBinding = bindings.useMedia;
129
- if (!mediaBinding) return !1;
130
- var useMediaImport = mediaBinding.path.parent;
131
- return !(!t.isImportDeclaration(useMediaImport) || !(0, import_extractHelpers.isValidImport)(props, sourcePath));
132
- }
133
- // Annotate the CommonJS export names for ESM import in node:
134
- 0 && (module.exports = {
135
- extractMediaStyle,
136
- isValidMediaCall
137
- });
138
- //# sourceMappingURL=extractMediaStyle.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/extractMediaStyle.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB,kCACnB,OAAsB,mCACtB,4BAAmC,0CACnC,wBAAyC;AAClC,SAAS,kBAAkB,OAAO,SAAS,SAAS,eAAe,YAAY;AAClF,MAAI,aAAa,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAS,UAAU,CAAC,IAAI,GAAG,mBAAmB,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAS,UAAU,CAAC,IAAI,IACrK,EAAE,mBAAmB,QAAI,8CAAmB,KAAK,GACjD,KAAK,qBAAqB,OAAO,SAAS,SAAS,UAAU;AACjE,MAAI,CAAC;AACD,WAAO;AAEX,MAAI,EAAE,IAAI,IAAI,IACV,KAAK,cAAc,MAAM,GAAG;AAChC,MAAI,CAAC;AACD,mBAAQ,MAAM,gBAAgB,GAAG,gBAAgB,OAAO,KAAK,cAAc,KAAK,CAAC,EAAE,GAC5E;AAEX,MAAI,cAAc,SAAS,UAAU;AACjC,QAAI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