@tamagui/static 3.0.0-beta.831.1 → 3.0.0-beta.881.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.
Files changed (41) hide show
  1. package/dist/cjs/compiler.cjs +17 -5
  2. package/dist/cjs/compilerHost.cjs +142 -38
  3. package/dist/cjs/componentDiscovery.cjs +90 -0
  4. package/dist/cjs/domStructuralPass.cjs +12 -2
  5. package/dist/cjs/exports.cjs +4 -1
  6. package/dist/cjs/extractor/bundleConfig.cjs +23 -0
  7. package/dist/cjs/zero/theme.cjs +5 -20
  8. package/dist/esm/compiler.mjs +18 -6
  9. package/dist/esm/compiler.mjs.map +1 -1
  10. package/dist/esm/compilerHost.mjs +140 -39
  11. package/dist/esm/compilerHost.mjs.map +1 -1
  12. package/dist/esm/componentDiscovery.mjs +65 -0
  13. package/dist/esm/componentDiscovery.mjs.map +1 -0
  14. package/dist/esm/domStructuralPass.mjs +12 -2
  15. package/dist/esm/domStructuralPass.mjs.map +1 -1
  16. package/dist/esm/exports.mjs +4 -1
  17. package/dist/esm/extractor/bundleConfig.mjs +23 -1
  18. package/dist/esm/extractor/bundleConfig.mjs.map +1 -1
  19. package/dist/esm/zero/theme.mjs +5 -20
  20. package/dist/esm/zero/theme.mjs.map +1 -1
  21. package/package.json +17 -17
  22. package/src/compiler.ts +27 -5
  23. package/src/compilerHost.ts +250 -73
  24. package/src/componentDiscovery.ts +95 -0
  25. package/src/domStructuralPass.ts +22 -2
  26. package/src/exports.ts +2 -0
  27. package/src/extractor/bundleConfig.ts +34 -0
  28. package/src/zero/theme.ts +12 -21
  29. package/types/compiler.d.ts +13 -0
  30. package/types/compiler.d.ts.map +1 -1
  31. package/types/compilerHost.d.ts +13 -0
  32. package/types/compilerHost.d.ts.map +1 -1
  33. package/types/componentDiscovery.d.ts +27 -0
  34. package/types/componentDiscovery.d.ts.map +1 -0
  35. package/types/domStructuralPass.d.ts.map +1 -1
  36. package/types/exports.d.ts +2 -0
  37. package/types/exports.d.ts.map +1 -1
  38. package/types/extractor/bundleConfig.d.ts +7 -0
  39. package/types/extractor/bundleConfig.d.ts.map +1 -1
  40. package/types/zero/theme.d.ts +0 -1
  41. package/types/zero/theme.d.ts.map +1 -1
@@ -31,11 +31,7 @@ var import_helpers = require("@tamagui/helpers");
31
31
  var import_web = require("@tamagui/web");
32
32
  var import_theme_update = require("@tamagui/web/theme-update");
33
33
  const MAX_THEME_BRANCHES = 8;
34
- const LOWERABLE_RESERVED_PROPS = /* @__PURE__ */ new Set([
35
- "name",
36
- "reset",
37
- "contain"
38
- ]);
34
+ const LOWERABLE_RESERVED_PROPS = /* @__PURE__ */ new Set(["name", "contain"]);
39
35
  function jsxAttributeName(attribute) {
40
36
  const name = (0, import_compiler_core.childNode)(attribute, "name");
41
37
  return name && typeof name.name === "string" ? name.name : null;
@@ -98,7 +94,7 @@ function resolveThemeChain(chain, rootThemeName, config) {
98
94
  const next = [];
99
95
  for (const parent of branches) {
100
96
  for (const option of node.options) {
101
- const resolved = (0, import_web.resolveThemeName)(parent.name, option.name, node.reset, config.themes);
97
+ const resolved = (0, import_web.resolveThemeName)(parent.name, option.name, config.themes);
102
98
  const tests = [parent.test, option.test].filter(Boolean);
103
99
  next.push({
104
100
  test: tests.length ? tests.join(" && ") : null,
@@ -126,7 +122,6 @@ function readStaticTheme(element, id, source, config, kind = "Theme") {
126
122
  test: null,
127
123
  name: void 0
128
124
  }];
129
- let reset = false;
130
125
  let contain = false;
131
126
  const themeKeyProps = {};
132
127
  for (const attribute of (0, import_compiler_core.childNodes)(opening, "attributes")) {
@@ -191,7 +186,6 @@ function readStaticTheme(element, id, source, config, kind = "Theme") {
191
186
  });
192
187
  continue;
193
188
  }
194
- if (key === "reset") reset = literal2;
195
189
  if (key === "contain") contain = literal2;
196
190
  continue;
197
191
  }
@@ -222,15 +216,6 @@ function readStaticTheme(element, id, source, config, kind = "Theme") {
222
216
  }
223
217
  themeKeyProps[key] = literal;
224
218
  }
225
- if (kind === "Theme" && reset && options.some((option) => option.name !== void 0)) {
226
- violations.push({
227
- rule: 4,
228
- code: "local/unsupported-target",
229
- span: span(opening),
230
- component: "Theme",
231
- message: (0, import_compiler_core.zeroRuleMessage)(4, { detail: "a <Theme> with both name and reset, which cannot mean one theme," })
232
- });
233
- }
234
219
  if (!closing) {
235
220
  violations.push({
236
221
  rule: 4,
@@ -241,7 +226,8 @@ function readStaticTheme(element, id, source, config, kind = "Theme") {
241
226
  });
242
227
  }
243
228
  const issues = [];
244
- const inlineValues = kind === "ThemeUpdate" && Object.keys(themeKeyProps).length ? (0, import_theme_update.getInlineValuesFromProps)(themeKeyProps, config, (issue) => issues.push(issue)) : null;
229
+ const themeUpdateConfig = config;
230
+ const inlineValues = kind === "ThemeUpdate" && Object.keys(themeKeyProps).length ? (0, import_theme_update.getInlineValuesFromProps)(themeKeyProps, themeUpdateConfig, (issue) => issues.push(issue)) : null;
245
231
  for (const issue of issues) {
246
232
  violations.push({
247
233
  rule: 3,
@@ -255,7 +241,7 @@ function readStaticTheme(element, id, source, config, kind = "Theme") {
255
241
  })
256
242
  });
257
243
  }
258
- const inlineCSS = inlineValues ? (0, import_theme_update.getVariablesCSSRules)(inlineValues, config) : null;
244
+ const inlineCSS = inlineValues ? (0, import_theme_update.getVariablesCSSRules)(inlineValues, themeUpdateConfig) : null;
259
245
  if (inlineCSS) css.set(inlineCSS.identifier, inlineCSS.rules.join(""));
260
246
  if (violations.length) return {
261
247
  node: null,
@@ -269,7 +255,6 @@ function readStaticTheme(element, id, source, config, kind = "Theme") {
269
255
  opening,
270
256
  closing,
271
257
  options,
272
- reset,
273
258
  contain,
274
259
  layer: inlineValues && inlineCSS ? {
275
260
  inlineValues,
@@ -2,7 +2,8 @@ import { CompilerSession, LOWERED_MODULE_PLAN_VERSION, ModulePlanCache, PLAN_CAC
2
2
  import { readFileSync } from "node:fs";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
- import { createTamaguiCompilerHost } from "./compilerHost.mjs";
5
+ import { ComponentDiscovery } from "./componentDiscovery.mjs";
6
+ import { createComponentRegistry, createTamaguiCompilerHost } from "./compilerHost.mjs";
6
7
  import { domStructuralPass } from "./domStructuralPass.mjs";
7
8
  import { loadTamagui } from "./extractor/loadTamagui.mjs";
8
9
  import { resolveZeroRuntimeSync } from "./zero/options.mjs";
@@ -90,6 +91,7 @@ var CompilerFrontend = class {
90
91
  planCaches = /* @__PURE__ */ new Map();
91
92
  moduleRecords = /* @__PURE__ */ new Map();
92
93
  moduleContext = null;
94
+ discovery = new ComponentDiscovery();
93
95
  /**
94
96
  * One cache per project root and platform. Absent when the project produced
95
97
  * no content stamp, in which case plans are never persisted rather than
@@ -183,14 +185,18 @@ var CompilerFrontend = class {
183
185
  if (!projectInfo.tamaguiConfig || !projectInfo.components) {
184
186
  throw new Error("The compiler requires evaluated Tamagui config and components");
185
187
  }
188
+ const componentModules = input.project.componentModules.map((component) => ({
189
+ moduleName: component.moduleName,
190
+ resolvedId: cleanId(component.id)
191
+ }));
192
+ const registry = createComponentRegistry(projectInfo.components, componentModules);
193
+ this.discovery.seed(registry);
186
194
  const host = createTamaguiCompilerHost({
187
195
  target: input.target,
188
196
  tamaguiConfig: projectInfo.tamaguiConfig,
189
197
  components: projectInfo.components,
190
- componentModules: input.project.componentModules.map((component) => ({
191
- moduleName: component.moduleName,
192
- resolvedId: cleanId(component.id)
193
- })),
198
+ componentModules,
199
+ registry,
194
200
  disablePartialExtraction: input.project.disablePartialExtraction,
195
201
  experimentalNativeFastPath: input.project.experimentalNativeFastPath,
196
202
  zeroRuntime: input.project.zeroRuntime
@@ -204,7 +210,8 @@ var CompilerFrontend = class {
204
210
  planCache: this.planCacheFor(input),
205
211
  async load(id) {
206
212
  return modules.get(id) ?? null;
207
- }
213
+ },
214
+ prepare: (module) => this.discovery.prepare(module, registry, input.evaluate)
208
215
  },
209
216
  structuralPass: domStructuralPass
210
217
  });
@@ -215,10 +222,15 @@ var CompilerFrontend = class {
215
222
  invalidatedIds: [...invalidated].sort()
216
223
  };
217
224
  }
225
+ /** host-resolved ids of every module discovery found components in */
226
+ discoveredModuleIds() {
227
+ return this.discovery.ids();
228
+ }
218
229
  async buildTree(input) {
219
230
  const moduleContext = compilerContext(input);
220
231
  if (this.moduleContext !== moduleContext) {
221
232
  this.moduleRecords.clear();
233
+ this.discovery.clear();
222
234
  this.moduleContext = moduleContext;
223
235
  }
224
236
  const componentBySpecifier = new Map(input.project.componentModules.map((component) => [component.moduleName, resolvedModuleId(cleanId(component.id))]));
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.js","names":[],"sources":["esm/compiler.js"],"sourcesContent":["import {\n CompilerSession,\n LOWERED_MODULE_PLAN_VERSION,\n ModulePlanCache,\n PLAN_CACHE_SCHEMA_VERSION,\n contentHash,\n defaultPlanCacheRoot,\n resolvedModuleId,\n stableStringify,\n yukuFactory\n} from \"@tamagui/compiler-core\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { createTamaguiCompilerHost } from \"./compilerHost\";\nimport { domStructuralPass } from \"./domStructuralPass\";\nimport { loadTamagui } from \"./extractor/loadTamagui\";\nimport { resolveZeroRuntimeSync } from \"./zero/options\";\nasync function loadCompilerProject({\n root,\n target,\n options: optionsIn,\n generation,\n rebuild = false,\n hostVersions = [],\n missingProjectMessage = \"Unable to load the Tamagui compiler project\",\n load = loadTamagui,\n resolveComponents\n}) {\n const components = [\n .../* @__PURE__ */ new Set([\"@tamagui/core\", ...optionsIn.components || [\"tamagui\"]])\n ];\n const options = {\n ...optionsIn,\n root,\n platform: target,\n components\n };\n const zeroRuntime = resolveZeroRuntimeSync(options, root).mode;\n if (zeroRuntime === \"enforce\") options.outputCSS = void 0;\n const projectInfo = await load(options, rebuild);\n if (!projectInfo?.tamaguiConfig || !projectInfo.components) {\n throw new Error(missingProjectMessage);\n }\n const componentModules = resolveComponents ? await resolveComponents(components, projectInfo, options) : [];\n const disablePartialExtraction = !!options.disablePartialExtraction;\n const experimentalNativeFastPath = target === \"native\" && options.experimental?.nativeFastPath === true;\n return {\n projectInfo,\n componentModules,\n generation: typeof generation === \"function\" ? generation(projectInfo, componentModules, options) : generation,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n cacheStamp: compilerProjectStamp({\n stampSources: projectInfo.stampSources ?? [],\n hostVersions,\n target,\n componentModules,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n development: process.env.NODE_ENV === \"development\"\n })\n };\n}\nconst requireFromCompiler = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst compilerPackageVersions = [\"@tamagui/compiler-core\", \"@tamagui/static\"].map(\n (name) => `${name}@${requireFromCompiler(`${name}/package.json`).version}`\n);\nfunction compilerProjectStamp(input) {\n if (!input.stampSources.length) return null;\n const sources = [];\n for (const file of [...new Set(input.stampSources)].sort()) {\n try {\n sources.push([file, contentHash(readFileSync(file))]);\n } catch {\n return null;\n }\n }\n return contentHash(\n stableStringify({\n schema: PLAN_CACHE_SCHEMA_VERSION,\n plan: LOWERED_MODULE_PLAN_VERSION,\n packages: [...compilerPackageVersions, ...input.hostVersions].sort(),\n target: input.target,\n development: input.development,\n componentModules: input.componentModules.map(({ moduleName, id }) => [\n moduleName,\n cleanId(id)\n ]),\n disablePartialExtraction: input.disablePartialExtraction,\n experimentalNativeFastPath: input.experimentalNativeFastPath,\n zeroRuntime: input.zeroRuntime,\n sources\n })\n );\n}\nfunction cleanId(id) {\n return id.split(/[?#]/, 1)[0];\n}\nfunction externalId(specifier) {\n return resolvedModuleId(`external://${encodeURIComponent(specifier)}`);\n}\nfunction compilerContext(input) {\n return `${input.root}\\0${input.target}\\0${input.environment ?? \"\"}\\0${input.project.generation}`;\n}\nfunction sourceCanBeLinked(root, id) {\n const clean = cleanId(id);\n const normalized = clean.replace(/\\\\/g, \"/\");\n if (!path.isAbsolute(clean) || normalized.includes(\"/node_modules/\")) return false;\n const relative = path.relative(root, clean);\n return relative === \"\" || relative !== \"..\" && !relative.startsWith(`..${path.sep}`);\n}\nclass CompilerFrontend {\n session = new CompilerSession();\n queue = Promise.resolve();\n planCaches = /* @__PURE__ */ new Map();\n moduleRecords = /* @__PURE__ */ new Map();\n moduleContext = null;\n /**\n * One cache per project root and platform. Absent when the project produced\n * no content stamp, in which case plans are never persisted rather than\n * persisted under an identity that cannot see a config change.\n */\n planCacheFor(input) {\n const stamp = input.project.cacheStamp;\n if (!stamp) return void 0;\n const root = defaultPlanCacheRoot(input.root, input.target);\n let store = this.planCaches.get(root);\n if (!store) {\n store = new ModulePlanCache(root);\n this.planCaches.set(root, store);\n }\n return { store, stamp };\n }\n /** Hits, misses and writes across every plan cache this frontend has used. */\n get planCacheStats() {\n const total = { hits: 0, misses: 0, writes: 0 };\n for (const store of this.planCaches.values()) {\n total.hits += store.stats.hits;\n total.misses += store.stats.misses;\n total.writes += store.stats.writes;\n }\n return total;\n }\n compile(input) {\n const operation = this.queue.then(async () => {\n const previousTarget = process.env.TAMAGUI_TARGET;\n const previousStatic = process.env.IS_STATIC;\n try {\n return await this.compileNow(input);\n } finally {\n if (previousTarget === void 0) delete process.env.TAMAGUI_TARGET;\n else process.env.TAMAGUI_TARGET = previousTarget;\n if (previousStatic === void 0) delete process.env.IS_STATIC;\n else process.env.IS_STATIC = previousStatic;\n }\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n update(input) {\n const operation = this.queue.then(async () => {\n const { modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n return [...invalidated].sort();\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n has(id) {\n return this.session.has(resolvedModuleId(cleanId(id)));\n }\n dependentsOf(id) {\n return this.session.dependentsOf(resolvedModuleId(cleanId(id)));\n }\n remove(id) {\n const operation = this.queue.then(async () => {\n const result = await this.session.remove(resolvedModuleId(cleanId(id)));\n for (const invalidatedId of result.invalidatedIds) {\n this.moduleRecords.delete(invalidatedId);\n }\n return result;\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n parseCount(id) {\n return this.session.parseCount(resolvedModuleId(cleanId(id)));\n }\n async compileNow(input) {\n const { rootModule, modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n const projectInfo = input.project.projectInfo;\n if (!projectInfo.tamaguiConfig || !projectInfo.components) {\n throw new Error(\"The compiler requires evaluated Tamagui config and components\");\n }\n const host = createTamaguiCompilerHost({\n target: input.target,\n tamaguiConfig: projectInfo.tamaguiConfig,\n components: projectInfo.components,\n componentModules: input.project.componentModules.map((component) => ({\n moduleName: component.moduleName,\n resolvedId: cleanId(component.id)\n })),\n disablePartialExtraction: input.project.disablePartialExtraction,\n experimentalNativeFastPath: input.project.experimentalNativeFastPath,\n zeroRuntime: input.project.zeroRuntime\n });\n const result = await this.session.compile({\n module: rootModule,\n adapter: {\n target: input.target,\n projectGeneration: input.project.generation,\n host,\n planCache: this.planCacheFor(input),\n async load(id) {\n return modules.get(id) ?? null;\n }\n },\n structuralPass: domStructuralPass\n });\n for (const id of result.invalidatedIds) invalidated.add(id);\n return {\n plan: result.plan,\n output: result.output,\n invalidatedIds: [...invalidated].sort()\n };\n }\n async buildTree(input) {\n const moduleContext = compilerContext(input);\n if (this.moduleContext !== moduleContext) {\n this.moduleRecords.clear();\n this.moduleContext = moduleContext;\n }\n const componentBySpecifier = new Map(\n input.project.componentModules.map((component) => [\n component.moduleName,\n resolvedModuleId(cleanId(component.id))\n ])\n );\n const modules = /* @__PURE__ */ new Map();\n const loading = /* @__PURE__ */ new Set();\n const addInstalledClosure = (module) => {\n if (modules.has(module.id) || loading.has(module.id)) return;\n loading.add(module.id);\n for (const dependency of module.imports) {\n if (dependency.external) continue;\n const installedDependency = this.moduleRecords.get(dependency.resolvedId);\n if (installedDependency && this.session.has(dependency.resolvedId)) {\n addInstalledClosure(installedDependency);\n }\n }\n modules.set(module.id, module);\n loading.delete(module.id);\n };\n const loadModule = async (rawId, source) => {\n const id = resolvedModuleId(cleanId(rawId));\n const existing = modules.get(id);\n if (existing) return existing;\n const installed = this.moduleRecords.get(id);\n if (installed?.source === source && this.session.has(id)) {\n addInstalledClosure(installed);\n return installed;\n }\n if (loading.has(id)) {\n return { id, source, imports: [] };\n }\n loading.add(id);\n const imports = [];\n for (const specifier of yukuFactory.scanImports(id, source)) {\n const configuredComponent = componentBySpecifier.get(specifier);\n if (configuredComponent) {\n imports.push({ specifier, resolvedId: configuredComponent, external: true });\n continue;\n }\n const resolution = await input.resolve(specifier, id);\n if (!resolution) continue;\n const canLink = !resolution.external && sourceCanBeLinked(input.root, resolution.id);\n const resolvedId = canLink ? resolvedModuleId(cleanId(resolution.id)) : path.isAbsolute(cleanId(resolution.id)) ? resolvedModuleId(cleanId(resolution.id)) : externalId(specifier);\n imports.push({ specifier, resolvedId, external: !canLink });\n if (canLink && !modules.has(resolvedId) && !loading.has(resolvedId)) {\n const installedDependency = this.moduleRecords.get(resolvedId);\n if (installedDependency && this.session.has(resolvedId)) {\n addInstalledClosure(installedDependency);\n } else {\n const dependencySource = await input.load(resolution.id);\n if (dependencySource !== null) {\n await loadModule(resolution.id, dependencySource);\n }\n }\n }\n }\n const module = { id, source, imports };\n modules.set(id, module);\n loading.delete(id);\n return module;\n };\n const rootModule = await loadModule(input.id, input.source);\n return { rootModule, modules };\n }\n}\nexport {\n CompilerFrontend,\n compilerProjectStamp,\n loadCompilerProject\n};\n//# sourceMappingURL=compiler.js.map\n"],"mappings":";;;;;;;;;;AAkBA,eAAe,oBAAoB,EACjC,MACA,QACA,SAAS,WACT,YACA,UAAU,OACV,eAAe,CAAC,GAChB,wBAAwB,+CACxB,OAAO,aACP,qBACC;CACD,MAAM,aAAa,CACjB,mBAAm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,MAAM,MAAM,KAAK,WAAW,EAAE;MACvD,IAAI,qBAAqB,MAAM;OAC7B,MAAM,WAAW,WAAW,IAAI,gBAAgB;MAClD;KACF;IACF;GACF;GACA,MAAM,SAAS;IAAE;IAAI;IAAQ;GAAQ;GACrC,QAAQ,IAAI,IAAI,MAAM;GACtB,QAAQ,OAAO,EAAE;GACjB,OAAO;EACT;EACA,MAAM,aAAa,MAAM,WAAW,MAAM,IAAI,MAAM,MAAM;EAC1D,OAAO;GAAE;GAAY;EAAQ;CAC/B;AACF"}
1
+ {"version":3,"file":"compiler.js","names":[],"sources":["esm/compiler.js"],"sourcesContent":["import {\n CompilerSession,\n LOWERED_MODULE_PLAN_VERSION,\n ModulePlanCache,\n PLAN_CACHE_SCHEMA_VERSION,\n contentHash,\n defaultPlanCacheRoot,\n resolvedModuleId,\n stableStringify,\n yukuFactory\n} from \"@tamagui/compiler-core\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { ComponentDiscovery } from \"./componentDiscovery\";\nimport { createComponentRegistry, createTamaguiCompilerHost } from \"./compilerHost\";\nimport { domStructuralPass } from \"./domStructuralPass\";\nimport { loadTamagui } from \"./extractor/loadTamagui\";\nimport { resolveZeroRuntimeSync } from \"./zero/options\";\nasync function loadCompilerProject({\n root,\n target,\n options: optionsIn,\n generation,\n rebuild = false,\n hostVersions = [],\n missingProjectMessage = \"Unable to load the Tamagui compiler project\",\n load = loadTamagui,\n resolveComponents\n}) {\n const components = [\n .../* @__PURE__ */ new Set([\"@tamagui/core\", ...optionsIn.components || [\"tamagui\"]])\n ];\n const options = {\n ...optionsIn,\n root,\n platform: target,\n components\n };\n const zeroRuntime = resolveZeroRuntimeSync(options, root).mode;\n if (zeroRuntime === \"enforce\") options.outputCSS = void 0;\n const projectInfo = await load(options, rebuild);\n if (!projectInfo?.tamaguiConfig || !projectInfo.components) {\n throw new Error(missingProjectMessage);\n }\n const componentModules = resolveComponents ? await resolveComponents(components, projectInfo, options) : [];\n const disablePartialExtraction = !!options.disablePartialExtraction;\n const experimentalNativeFastPath = target === \"native\" && options.experimental?.nativeFastPath === true;\n return {\n projectInfo,\n componentModules,\n generation: typeof generation === \"function\" ? generation(projectInfo, componentModules, options) : generation,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n cacheStamp: compilerProjectStamp({\n stampSources: projectInfo.stampSources ?? [],\n hostVersions,\n target,\n componentModules,\n disablePartialExtraction,\n experimentalNativeFastPath,\n zeroRuntime: zeroRuntime !== \"off\",\n development: process.env.NODE_ENV === \"development\"\n })\n };\n}\nconst requireFromCompiler = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst compilerPackageVersions = [\"@tamagui/compiler-core\", \"@tamagui/static\"].map(\n (name) => `${name}@${requireFromCompiler(`${name}/package.json`).version}`\n);\nfunction compilerProjectStamp(input) {\n if (!input.stampSources.length) return null;\n const sources = [];\n for (const file of [...new Set(input.stampSources)].sort()) {\n try {\n sources.push([file, contentHash(readFileSync(file))]);\n } catch {\n return null;\n }\n }\n return contentHash(\n stableStringify({\n schema: PLAN_CACHE_SCHEMA_VERSION,\n plan: LOWERED_MODULE_PLAN_VERSION,\n packages: [...compilerPackageVersions, ...input.hostVersions].sort(),\n target: input.target,\n development: input.development,\n componentModules: input.componentModules.map(({ moduleName, id }) => [\n moduleName,\n cleanId(id)\n ]),\n disablePartialExtraction: input.disablePartialExtraction,\n experimentalNativeFastPath: input.experimentalNativeFastPath,\n zeroRuntime: input.zeroRuntime,\n sources\n })\n );\n}\nfunction cleanId(id) {\n return id.split(/[?#]/, 1)[0];\n}\nfunction externalId(specifier) {\n return resolvedModuleId(`external://${encodeURIComponent(specifier)}`);\n}\nfunction compilerContext(input) {\n return `${input.root}\\0${input.target}\\0${input.environment ?? \"\"}\\0${input.project.generation}`;\n}\nfunction sourceCanBeLinked(root, id) {\n const clean = cleanId(id);\n const normalized = clean.replace(/\\\\/g, \"/\");\n if (!path.isAbsolute(clean) || normalized.includes(\"/node_modules/\")) return false;\n const relative = path.relative(root, clean);\n return relative === \"\" || relative !== \"..\" && !relative.startsWith(`..${path.sep}`);\n}\nclass CompilerFrontend {\n session = new CompilerSession();\n queue = Promise.resolve();\n planCaches = /* @__PURE__ */ new Map();\n moduleRecords = /* @__PURE__ */ new Map();\n moduleContext = null;\n discovery = new ComponentDiscovery();\n /**\n * One cache per project root and platform. Absent when the project produced\n * no content stamp, in which case plans are never persisted rather than\n * persisted under an identity that cannot see a config change.\n */\n planCacheFor(input) {\n const stamp = input.project.cacheStamp;\n if (!stamp) return void 0;\n const root = defaultPlanCacheRoot(input.root, input.target);\n let store = this.planCaches.get(root);\n if (!store) {\n store = new ModulePlanCache(root);\n this.planCaches.set(root, store);\n }\n return { store, stamp };\n }\n /** Hits, misses and writes across every plan cache this frontend has used. */\n get planCacheStats() {\n const total = { hits: 0, misses: 0, writes: 0 };\n for (const store of this.planCaches.values()) {\n total.hits += store.stats.hits;\n total.misses += store.stats.misses;\n total.writes += store.stats.writes;\n }\n return total;\n }\n compile(input) {\n const operation = this.queue.then(async () => {\n const previousTarget = process.env.TAMAGUI_TARGET;\n const previousStatic = process.env.IS_STATIC;\n try {\n return await this.compileNow(input);\n } finally {\n if (previousTarget === void 0) delete process.env.TAMAGUI_TARGET;\n else process.env.TAMAGUI_TARGET = previousTarget;\n if (previousStatic === void 0) delete process.env.IS_STATIC;\n else process.env.IS_STATIC = previousStatic;\n }\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n update(input) {\n const operation = this.queue.then(async () => {\n const { modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n return [...invalidated].sort();\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n has(id) {\n return this.session.has(resolvedModuleId(cleanId(id)));\n }\n dependentsOf(id) {\n return this.session.dependentsOf(resolvedModuleId(cleanId(id)));\n }\n remove(id) {\n const operation = this.queue.then(async () => {\n const result = await this.session.remove(resolvedModuleId(cleanId(id)));\n for (const invalidatedId of result.invalidatedIds) {\n this.moduleRecords.delete(invalidatedId);\n }\n return result;\n });\n this.queue = operation.catch(() => void 0);\n return operation;\n }\n parseCount(id) {\n return this.session.parseCount(resolvedModuleId(cleanId(id)));\n }\n async compileNow(input) {\n const { rootModule, modules } = await this.buildTree(input);\n const invalidated = /* @__PURE__ */ new Set();\n for (const module of modules.values()) {\n for (const id of await this.session.update(module)) invalidated.add(id);\n this.moduleRecords.set(module.id, module);\n }\n const projectInfo = input.project.projectInfo;\n if (!projectInfo.tamaguiConfig || !projectInfo.components) {\n throw new Error(\"The compiler requires evaluated Tamagui config and components\");\n }\n const componentModules = input.project.componentModules.map((component) => ({\n moduleName: component.moduleName,\n resolvedId: cleanId(component.id)\n }));\n const registry = createComponentRegistry(projectInfo.components, componentModules);\n this.discovery.seed(registry);\n const host = createTamaguiCompilerHost({\n target: input.target,\n tamaguiConfig: projectInfo.tamaguiConfig,\n components: projectInfo.components,\n componentModules,\n registry,\n disablePartialExtraction: input.project.disablePartialExtraction,\n experimentalNativeFastPath: input.project.experimentalNativeFastPath,\n zeroRuntime: input.project.zeroRuntime\n });\n const result = await this.session.compile({\n module: rootModule,\n adapter: {\n target: input.target,\n projectGeneration: input.project.generation,\n host,\n planCache: this.planCacheFor(input),\n async load(id) {\n return modules.get(id) ?? null;\n },\n prepare: (module) => this.discovery.prepare(module, registry, input.evaluate)\n },\n structuralPass: domStructuralPass\n });\n for (const id of result.invalidatedIds) invalidated.add(id);\n return {\n plan: result.plan,\n output: result.output,\n invalidatedIds: [...invalidated].sort()\n };\n }\n /** host-resolved ids of every module discovery found components in */\n discoveredModuleIds() {\n return this.discovery.ids();\n }\n async buildTree(input) {\n const moduleContext = compilerContext(input);\n if (this.moduleContext !== moduleContext) {\n this.moduleRecords.clear();\n this.discovery.clear();\n this.moduleContext = moduleContext;\n }\n const componentBySpecifier = new Map(\n input.project.componentModules.map((component) => [\n component.moduleName,\n resolvedModuleId(cleanId(component.id))\n ])\n );\n const modules = /* @__PURE__ */ new Map();\n const loading = /* @__PURE__ */ new Set();\n const addInstalledClosure = (module) => {\n if (modules.has(module.id) || loading.has(module.id)) return;\n loading.add(module.id);\n for (const dependency of module.imports) {\n if (dependency.external) continue;\n const installedDependency = this.moduleRecords.get(dependency.resolvedId);\n if (installedDependency && this.session.has(dependency.resolvedId)) {\n addInstalledClosure(installedDependency);\n }\n }\n modules.set(module.id, module);\n loading.delete(module.id);\n };\n const loadModule = async (rawId, source) => {\n const id = resolvedModuleId(cleanId(rawId));\n const existing = modules.get(id);\n if (existing) return existing;\n const installed = this.moduleRecords.get(id);\n if (installed?.source === source && this.session.has(id)) {\n addInstalledClosure(installed);\n return installed;\n }\n if (loading.has(id)) {\n return { id, source, imports: [] };\n }\n loading.add(id);\n const imports = [];\n for (const specifier of yukuFactory.scanImports(id, source)) {\n const configuredComponent = componentBySpecifier.get(specifier);\n if (configuredComponent) {\n imports.push({ specifier, resolvedId: configuredComponent, external: true });\n continue;\n }\n const resolution = await input.resolve(specifier, id);\n if (!resolution) continue;\n const canLink = !resolution.external && sourceCanBeLinked(input.root, resolution.id);\n const resolvedId = canLink ? resolvedModuleId(cleanId(resolution.id)) : path.isAbsolute(cleanId(resolution.id)) ? resolvedModuleId(cleanId(resolution.id)) : externalId(specifier);\n imports.push({ specifier, resolvedId, external: !canLink });\n if (canLink && !modules.has(resolvedId) && !loading.has(resolvedId)) {\n const installedDependency = this.moduleRecords.get(resolvedId);\n if (installedDependency && this.session.has(resolvedId)) {\n addInstalledClosure(installedDependency);\n } else {\n const dependencySource = await input.load(resolution.id);\n if (dependencySource !== null) {\n await loadModule(resolution.id, dependencySource);\n }\n }\n }\n }\n const module = { id, source, imports };\n modules.set(id, module);\n loading.delete(id);\n return module;\n };\n const rootModule = await loadModule(input.id, input.source);\n return { rootModule, modules };\n }\n}\nex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AC,WAAW,YAAY,kBAAkB,MAAM,MAAM,WAAW,EAAE;IACnF,MAAM,aAAa,UAAU,iBAAiB,QAAQ,WAAW,EAAE,CAAC,IAAI,KAAK,WAAW,QAAQ,WAAW,EAAE,CAAC,IAAI,iBAAiB,QAAQ,WAAW,EAAE,CAAC,IAAI,WAAW,SAAS;IACjL,QAAQ,KAAK;KAAE;KAAW;KAAY,UAAU,CAAC;IAAQ,CAAC;IAC1D,IAAI,WAAW,CAAC,QAAQ,IAAI,UAAU,KAAK,CAAC,QAAQ,IAAI,UAAU,GAAG;KACnE,MAAM,sBAAsB,KAAK,cAAc,IAAI,UAAU;KAC7D,IAAI,uBAAuB,KAAK,QAAQ,IAAI,UAAU,GAAG;MACvD,oBAAoB,mBAAmB;KACzC,OAAO;MACL,MAAM,mBAAmB,MAAM,MAAM,KAAK,WAAW,EAAE;MACvD,IAAI,qBAAqB,MAAM;OAC7B,MAAM,WAAW,WAAW,IAAI,gBAAgB;MAClD;KACF;IACF;GACF;GACA,MAAM,SAAS;IAAE;IAAI;IAAQ;GAAQ;GACrC,QAAQ,IAAI,IAAI,MAAM;GACtB,QAAQ,OAAO,EAAE;GACjB,OAAO;EACT;EACA,MAAM,aAAa,MAAM,WAAW,MAAM,IAAI,MAAM,MAAM;EAC1D,OAAO;GAAE;GAAY;EAAQ;CAC/B;AACF"}
@@ -1,11 +1,17 @@
1
1
  import { collectLeaves, zeroRuleMessage, zeroThemeBoundaryMessage } from "@tamagui/compiler-core";
2
- import { StyleObjectIdentifier, StyleObjectProperty, StyleObjectRules, StyleObjectValue, stylePropsAll, stylePropsText, validStyles } from "@tamagui/helpers";
2
+ import { StyleObjectIdentifier, StyleObjectProperty, StyleObjectRules, StyleObjectValue, stylePropsAll, stylePropsInput, stylePropsText, validStyles } from "@tamagui/helpers";
3
3
  import { ATTRIBUTES, DISPLAY_WEB_RESET, EVENTS, NATIVE_BACKING, NATIVE_BLOCK_DEFAULTS, NATIVE_ELEMENT_DEFAULTS, NATIVE_FLEX_DEFAULTS, NATIVE_INPUT_TYPES, NATIVE_PRIMITIVE_MODULE, TAGS, TAG_WEB_DEFAULTS } from "@tamagui/dom";
4
4
  import { createModifierRegistry, parseTransition, parseValue } from "@tamagui/style-grammar/tooling";
5
5
  import { isValidStyleKey } from "@tamagui/web";
6
6
  import { concatClassName } from "./extractor/concatClassName.mjs";
7
7
  import { requireTamaguiCore } from "./helpers/requireTamaguiCore.mjs";
8
8
 
9
+ function createComponentRegistry(components, componentModules) {
10
+ return {
11
+ modulesById: new Map(componentModules.map((module) => [module.resolvedId, module.moduleName])),
12
+ componentsByModule: new Map(components.map((component) => [component.moduleName, component]))
13
+ };
14
+ }
9
15
  const DOM_FRONTENDS = /* @__PURE__ */ new Set([
10
16
  "tamagui",
11
17
  "tamagui/dom",
@@ -214,6 +220,11 @@ const runtimeAnimationProps = /* @__PURE__ */ new Set([
214
220
  "animatePresence",
215
221
  "animatedBy"
216
222
  ]);
223
+ const componentOnlyProps = /* @__PURE__ */ new Set([
224
+ "asChild",
225
+ "disableOptimization",
226
+ "themeInverse"
227
+ ]);
217
228
  const cssShorthandConflicts = {
218
229
  background: [
219
230
  "backgroundAttachment",
@@ -390,6 +401,12 @@ const cssShorthandConflicts = {
390
401
  ]
391
402
  };
392
403
  const cssConflictFamilies = [
404
+ /* @__PURE__ */ new Set(["width", "inlineSize"]),
405
+ /* @__PURE__ */ new Set(["minWidth", "minInlineSize"]),
406
+ /* @__PURE__ */ new Set(["maxWidth", "maxInlineSize"]),
407
+ /* @__PURE__ */ new Set(["height", "blockSize"]),
408
+ /* @__PURE__ */ new Set(["minHeight", "minBlockSize"]),
409
+ /* @__PURE__ */ new Set(["maxHeight", "maxBlockSize"]),
393
410
  /* @__PURE__ */ new Set([
394
411
  "marginInline",
395
412
  "marginInlineEnd",
@@ -701,6 +718,7 @@ function webDOMProps(input, tag) {
701
718
  function createTamaguiCompilerHost(options) {
702
719
  const platform = options.target === "native" ? "native" : "web";
703
720
  const core = requireTamaguiCore(platform);
721
+ const compilerVariantStyleResolver = core.styled(core.View, {}).staticConfig.variantStyleResolver;
704
722
  const firstThemeName = Object.keys(options.tamaguiConfig.themes ?? {})[0] ?? "";
705
723
  const firstTheme = options.tamaguiConfig.themes?.[firstThemeName] ?? {};
706
724
  const theme = firstTheme;
@@ -723,6 +741,27 @@ function createTamaguiCompilerHost(options) {
723
741
  }
724
742
  return false;
725
743
  };
744
+ const platformModifiersRegistered = modifierRegistry.get("web") === "platform" && modifierRegistry.get("native") === "platform";
745
+ const nativeClauseValue = (value) => {
746
+ if (typeof value !== "string" || !flatClausePattern.test(value)) {
747
+ return isClauseObjectValue(value) ? "live" : null;
748
+ }
749
+ if (!platformModifiersRegistered) return "live";
750
+ const parsed = parseValue(value, modifierRegistry);
751
+ if (!parsed.ok || parsed.value.clauses.length === 0) return "live";
752
+ let payload = parsed.value.base;
753
+ let matched = parsed.value.base !== null;
754
+ for (const clause of parsed.value.clauses) {
755
+ if (clause.modifiers.includes("web")) continue;
756
+ if (clause.modifiers.length !== 1 || clause.modifiers[0] !== "native") return "live";
757
+ payload = clause.payload;
758
+ matched = true;
759
+ }
760
+ return {
761
+ payload,
762
+ matched
763
+ };
764
+ };
726
765
  const configuredAnimationDriver = options.tamaguiConfig.animations;
727
766
  const configuredCssAnimationDriver = platform === "web" && configuredAnimationDriver?.outputStyle === "css" && !options.tamaguiConfig.animationDrivers ? configuredAnimationDriver : null;
728
767
  const resolveStaticCssTransition = (value, transitionPresets) => {
@@ -761,8 +800,7 @@ function createTamaguiCompilerHost(options) {
761
800
  }
762
801
  return resolved.join(" ");
763
802
  };
764
- const modulesById = new Map(options.componentModules.map((module) => [module.resolvedId, module.moduleName]));
765
- const componentsByModule = new Map(options.components.map((component) => [component.moduleName, component]));
803
+ const { modulesById, componentsByModule } = options.registry ?? createComponentRegistry(options.components, options.componentModules);
766
804
  const normalizedStyleConfigs = /* @__PURE__ */ new WeakMap();
767
805
  const normalizeStaticConfig = (staticConfig) => {
768
806
  if (!staticConfig.styleFrontend) return staticConfig;
@@ -818,7 +856,7 @@ function createTamaguiCompilerHost(options) {
818
856
  isInput: row.backing === "textinput",
819
857
  validStyles: {
820
858
  ...validStyles,
821
- ...stylePropsText
859
+ ...row.backing === "textinput" ? stylePropsInput : stylePropsText
822
860
  },
823
861
  defaultProps: {
824
862
  ...base.defaultProps,
@@ -843,25 +881,27 @@ function createTamaguiCompilerHost(options) {
843
881
  if (!base || !staticObject(definition.options.value)) return null;
844
882
  const { variants, defaultVariants, displayName, context, contextProps, ...defaultProps } = definition.options.value;
845
883
  const baseClassName = definition.baseClassName?.kind === "static" && typeof definition.baseClassName.value === "string" ? definition.baseClassName.value : void 0;
884
+ const localStaticConfig = {
885
+ ...base.staticConfig,
886
+ variants: {
887
+ ...base.staticConfig.variants,
888
+ ...variants
889
+ },
890
+ defaultProps: {
891
+ ...base.staticConfig.defaultProps,
892
+ ...defaultProps,
893
+ ...defaultVariants
894
+ },
895
+ defaultVariants,
896
+ baseClassName: [base.staticConfig.baseClassName, baseClassName].filter(Boolean).join(" "),
897
+ context: context ?? base.staticConfig.context,
898
+ contextProps: context ? contextProps : contextProps ?? base.staticConfig.contextProps
899
+ };
900
+ localStaticConfig.variantStyleResolver = compilerVariantStyleResolver;
846
901
  return {
847
902
  key: componentKey(definition.id, definition.name),
848
903
  displayName: displayName || base.displayName,
849
- staticConfig: normalizeStaticConfig({
850
- ...base.staticConfig,
851
- variants: {
852
- ...base.staticConfig.variants,
853
- ...variants
854
- },
855
- defaultProps: {
856
- ...base.staticConfig.defaultProps,
857
- ...defaultProps,
858
- ...defaultVariants
859
- },
860
- defaultVariants,
861
- baseClassName: [base.staticConfig.baseClassName, baseClassName].filter(Boolean).join(" "),
862
- context: context ?? base.staticConfig.context,
863
- contextProps: context ? contextProps : contextProps ?? base.staticConfig.contextProps
864
- })
904
+ staticConfig: normalizeStaticConfig(localStaticConfig)
865
905
  };
866
906
  };
867
907
  const resolve = (element, styledDefinition) => {
@@ -896,8 +936,8 @@ function createTamaguiCompilerHost(options) {
896
936
  const canLowerConditionalStyleProp = (name, component) => isStyleProp(name, component) && !runtimeOnlyStyleProps.has(name);
897
937
  const isInvalidHostStyleProp = (name, component) => {
898
938
  const staticConfig = component.staticConfig;
899
- const validStyles$1 = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? stylePropsText : validStyles);
900
- return name in stylePropsAll && !isValidStyleKey(name, validStyles$1, staticConfig.accept);
939
+ const validStyles$1 = staticConfig.validStyles || (staticConfig.isInput ? stylePropsInput : staticConfig.isText ? stylePropsText : validStyles);
940
+ return name in stylePropsAll && !isValidStyleKey(name, validStyles$1);
901
941
  };
902
942
  const directStyleName = (name, component) => {
903
943
  if (compilerStyleProps.has(name) || name === "style") {
@@ -919,6 +959,7 @@ function createTamaguiCompilerHost(options) {
919
959
  process.env.TAMAGUI_TARGET = platform;
920
960
  try {
921
961
  return core.getSplitStyles(props, staticConfig, theme, firstThemeName, componentState, {
962
+ isStatic: true,
922
963
  resolveValues: platform === "native" ? "except-theme" : "variable",
923
964
  noClass: platform === "native",
924
965
  isAnimated: false,
@@ -1041,6 +1082,9 @@ function createTamaguiCompilerHost(options) {
1041
1082
  if (!options.disablePartialExtraction && valueKind === "conditional" && canLowerConditionalStyleProp(name, component)) {
1042
1083
  return true;
1043
1084
  }
1085
+ if (component.staticConfig.resolvers?.length) {
1086
+ return false;
1087
+ }
1044
1088
  return !options.disablePartialExtraction && (platform === "web" && !!directStyleName(name, component) || platform === "native" && directStyleName(name, component) === "opacity");
1045
1089
  },
1046
1090
  developmentDebugInstrumentation,
@@ -1071,9 +1115,30 @@ function createTamaguiCompilerHost(options) {
1071
1115
  props[entry.name] = entry.value.value;
1072
1116
  }
1073
1117
  }
1074
- const disableOptimizationEntry = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "disableOptimization");
1075
- if (disableOptimizationEntry || "disableOptimization" in props) {
1076
- return bailout(input, "local/unsupported-target", "disableOptimization keeps the component on the runtime path", disableOptimizationEntry?.span);
1118
+ if (component.staticConfig.resolvers?.length) {
1119
+ const unresolvedProps = input.element.entries.filter((entry) => entry.kind === "prop" && entry.value.kind !== "static");
1120
+ const onlyStaticBranchConditional = unresolvedProps.length === 1 && unresolvedProps[0]?.kind === "prop" && unresolvedProps[0].value.kind === "conditional" && canLowerConditionalStyleProp(unresolvedProps[0].name, component);
1121
+ const unresolvedProp = onlyStaticBranchConditional ? void 0 : unresolvedProps[0];
1122
+ if (unresolvedProp?.kind === "prop") {
1123
+ return bailout(input, "local/dynamic-style-value", `Component resolver prop ${unresolvedProp.name} could not be evaluated`, unresolvedProp.span, void 0, unresolvedProp.name);
1124
+ }
1125
+ }
1126
+ const componentOnlyProp = (name) => {
1127
+ let span;
1128
+ let unknown = false;
1129
+ for (const entry of input.element.entries) {
1130
+ if (entry.kind !== "prop" || entry.name !== name) continue;
1131
+ span = entry.span;
1132
+ if (entry.value.kind !== "static") unknown = true;
1133
+ }
1134
+ return {
1135
+ unknown,
1136
+ span
1137
+ };
1138
+ };
1139
+ const disableOptimization = componentOnlyProp("disableOptimization");
1140
+ if (disableOptimization.unknown || props.disableOptimization) {
1141
+ return bailout(input, "local/unsupported-target", "disableOptimization keeps the component on the runtime path", disableOptimization.span);
1077
1142
  }
1078
1143
  if (component.domTag && props.hidden) props.display = "none";
1079
1144
  if (component.domTag && platform === "native") {
@@ -1140,7 +1205,7 @@ function createTamaguiCompilerHost(options) {
1140
1205
  const expression = input.source.slice(entry.value.span.start, entry.value.span.end);
1141
1206
  if (resolvedCssTransition !== null && (name === "opacity" || name === "scale")) {
1142
1207
  property = name === "opacity" ? `opacity: (${expression})` : `transform: "scale(" + (${expression}) + ")"`;
1143
- } else if (entry.value.kind === "bailout" && owners.size === 1 && owners.has(name)) {
1208
+ } else if (entry.value.kind === "bailout" && owners.has(name)) {
1144
1209
  const dynamic = entry.value.dynamic;
1145
1210
  if (dynamic?.type === "number") {
1146
1211
  property = `${JSON.stringify(name)}: (${expression})`;
@@ -1178,16 +1243,19 @@ function createTamaguiCompilerHost(options) {
1178
1243
  }
1179
1244
  }
1180
1245
  const supportsWebConditionalClasses = platform === "web" && !options.disablePartialExtraction && (input.element.form === "jsx" || input.element.propsSpan !== null) && dynamicHostStyleProperties === null && dynamicStyleEntries.length > 0 && dynamicStyleEntries.every((entry) => entry.kind === "prop" && entry.value.kind === "conditional" && canLowerConditionalStyleProp(entry.name, component));
1181
- if ("theme" in props || "themeInverse" in props) {
1182
- const themeProp = "theme" in props ? "theme" : "themeInverse";
1246
+ const themeEntry = componentOnlyProp("theme");
1247
+ const themeInverseEntry = componentOnlyProp("themeInverse");
1248
+ const themeBoundary = themeEntry.unknown || "theme" in props;
1249
+ if (themeBoundary || themeInverseEntry.unknown || props.themeInverse) {
1250
+ const themeProp = themeBoundary ? "theme" : "themeInverse";
1183
1251
  return bailout(input, "local/unsupported-target", "Theme boundary candidates remain on the runtime path", input.element.span, {
1184
1252
  rule: 4,
1185
1253
  message: zeroThemeBoundaryMessage(input.element.component.name, themeProp)
1186
1254
  });
1187
1255
  }
1188
- const asChildEntry = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "asChild");
1189
- if (asChildEntry || "asChild" in props) {
1190
- return bailout(input, "local/unsupported-target", "asChild renders a Slot, not a host view", asChildEntry?.span);
1256
+ const asChild = componentOnlyProp("asChild");
1257
+ if (asChild.unknown || props.asChild) {
1258
+ return bailout(input, "local/unsupported-target", "asChild renders a Slot, not a host view", asChild.span);
1191
1259
  }
1192
1260
  if (platform === "native" && ("group" in props || "container" in props || "containerName" in props || "containerType" in props)) {
1193
1261
  return bailout(input, "local/unsupported-target", "Native group and container providers remain on the runtime path");
@@ -1286,12 +1354,17 @@ function createTamaguiCompilerHost(options) {
1286
1354
  const entry = dynamicStyleEntries[0];
1287
1355
  return bailout(input, "local/dynamic-style-value", `Style prop ${entry.kind === "prop" ? entry.name : "unknown"} could not be safely extracted`, entry.span);
1288
1356
  }
1289
- const staticDefaultProps = component.staticConfig.defaultProps ?? {};
1357
+ const resolvedStyleStaticConfig = core.getStyleStaticConfig(component.staticConfig, core.getConfig());
1358
+ const staticDefaultProps = resolvedStyleStaticConfig.defaultProps ?? {};
1290
1359
  const defaultProps = platform === "web" && !component.staticConfig.isText && options.tamaguiConfig.settings.defaultPosition === "relative" && staticDefaultProps.position === void 0 ? core.mergeProps({ position: "relative" }, staticDefaultProps) : staticDefaultProps;
1291
1360
  let completeProps = core.mergeProps(defaultProps, props);
1292
1361
  if (platform === "native" && component.domTag && props.display === "flex") {
1293
1362
  completeProps = core.mergeProps(core.mergeProps(defaultProps, NATIVE_FLEX_DEFAULTS), props);
1294
1363
  }
1364
+ const domStyleProgram = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "style" && entry.value.kind === "dom-style");
1365
+ if (platform === "native" && !component.domTag && domStyleProgram) {
1366
+ return bailout(input, "local/unsupported-target", "Native style() pieces remain on the runtime path");
1367
+ }
1295
1368
  const propsForConditional = (target, value) => {
1296
1369
  const branchProps = {};
1297
1370
  for (const entry of input.element.entries) {
@@ -1319,6 +1392,14 @@ function createTamaguiCompilerHost(options) {
1319
1392
  }
1320
1393
  }
1321
1394
  const branchCompleteProps = platform === "native" && component.domTag && branchProps.display === "flex" ? core.mergeProps(core.mergeProps(defaultProps, NATIVE_FLEX_DEFAULTS), branchProps) : core.mergeProps(defaultProps, branchProps);
1395
+ if (platform === "native") {
1396
+ for (const [name, value2] of Object.entries(branchCompleteProps)) {
1397
+ const clause = isStyleProp(name, component) ? nativeClauseValue(value2) : null;
1398
+ if (clause === null || clause === "live") continue;
1399
+ if (clause.matched) branchCompleteProps[name] = clause.payload;
1400
+ else delete branchCompleteProps[name];
1401
+ }
1402
+ }
1322
1403
  return {
1323
1404
  branchProps,
1324
1405
  branchCompleteProps
@@ -1327,10 +1408,30 @@ function createTamaguiCompilerHost(options) {
1327
1408
  if (platform === "native") {
1328
1409
  const isClauseValue = (name, value) => isStyleProp(name, component) && (typeof value === "string" && flatClausePattern.test(value) || isClauseObjectValue(value));
1329
1410
  const defaultVariants = component.staticConfig.defaultVariants ?? {};
1330
- const carriesClause = Object.entries(completeProps).some(([name, value]) => isClauseValue(name, value)) || Object.entries(component.staticConfig.variants ?? {}).some(([variantName, definitions]) => (completeProps[variantName] !== void 0 || defaultVariants[variantName] !== void 0) && staticObject(definitions) && Object.values(definitions).some((definition) => staticObject(definition) && Object.entries(definition).some(([name, value]) => isClauseValue(name, value))));
1331
- if (carriesClause) {
1411
+ const definitionCarriesClause = Object.entries(resolvedStyleStaticConfig.baseStyle ?? {}).some(([name, value]) => isClauseValue(name, value)) || Object.entries(component.staticConfig.variants ?? {}).some(([variantName, definitions]) => (completeProps[variantName] !== void 0 || defaultVariants[variantName] !== void 0) && staticObject(definitions) && Object.values(definitions).some((definition) => staticObject(definition) && Object.entries(definition).some(([name, value]) => isClauseValue(name, value))));
1412
+ if (definitionCarriesClause) {
1332
1413
  return bailout(input, "local/unsupported-target", "Native conditional value programs remain on the runtime path");
1333
1414
  }
1415
+ const reducedProps = {};
1416
+ for (const [name, value] of Object.entries(completeProps)) {
1417
+ const clause = isStyleProp(name, component) ? nativeClauseValue(value) : null;
1418
+ if (clause === "live") {
1419
+ return bailout(input, "local/unsupported-target", "Native conditional value programs remain on the runtime path");
1420
+ }
1421
+ if (clause === null) {
1422
+ reducedProps[name] = value;
1423
+ continue;
1424
+ }
1425
+ if (clause.matched) reducedProps[name] = clause.payload;
1426
+ }
1427
+ completeProps = reducedProps;
1428
+ for (const entry of dynamicStyleEntries) {
1429
+ if (entry.value.kind !== "conditional") continue;
1430
+ for (const leaf of collectLeaves(entry.value.tree)) {
1431
+ if (nativeClauseValue(leaf.value) !== "live") continue;
1432
+ return bailout(input, "local/unsupported-target", "Native conditional value programs remain on the runtime path");
1433
+ }
1434
+ }
1334
1435
  }
1335
1436
  const split = resolveSplitStyles(completeProps, component.staticConfig, cssAnimationDriver, component.displayName);
1336
1437
  if (!split) {
@@ -1342,7 +1443,6 @@ function createTamaguiCompilerHost(options) {
1342
1443
  message: zeroRuleMessage(5, { detail: `an enter or exit style program on ${input.element.component.name}` })
1343
1444
  });
1344
1445
  }
1345
- const domStyleProgram = input.element.entries.find((entry) => entry.kind === "prop" && entry.name === "style" && entry.value.kind === "dom-style");
1346
1446
  const flatTag = component.domTag ?? (typeof props.render === "string" ? props.render : typeof defaultProps.render === "string" ? defaultProps.render : component.staticConfig.isText ? "span" : "div");
1347
1447
  const tagEdits = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
1348
1448
  start: span.start,
@@ -1350,7 +1450,7 @@ function createTamaguiCompilerHost(options) {
1350
1450
  content: input.element.form === "jsx" ? flatTag : JSON.stringify(flatTag),
1351
1451
  origin: span
1352
1452
  }));
1353
- const isPropIgnored = (name) => isStyleProp(name, component) || isInvalidHostStyleProp(name, component);
1453
+ const isPropIgnored = (name) => isStyleProp(name, component) || isInvalidHostStyleProp(name, component) || componentOnlyProps.has(name);
1354
1454
  const spreadReplacement = (form, entry) => spreadNonStyleReplacement(form, entry, isPropIgnored, (name, value) => {
1355
1455
  if (platform !== "web") return [name, value];
1356
1456
  if (name === "testID") return ["data-testid", value];
@@ -1360,7 +1460,7 @@ function createTamaguiCompilerHost(options) {
1360
1460
  }
1361
1461
  return [name, value];
1362
1462
  });
1363
- let styleEntries = input.element.entries.filter((entry) => entry.kind === "prop" && (isStyleProp(entry.name, component) || isInvalidHostStyleProp(entry.name, component)) || entry.kind === "spread" && entry.value.kind === "static" && staticObject(entry.value.value) && Object.keys(entry.value.value).some((name) => isStyleProp(name, component) || isInvalidHostStyleProp(name, component)));
1463
+ let styleEntries = input.element.entries.filter((entry) => entry.kind === "prop" && isPropIgnored(entry.name) || entry.kind === "spread" && entry.value.kind === "static" && staticObject(entry.value.value) && Object.keys(entry.value.value).some(isPropIgnored));
1364
1464
  let invalidHostStyle;
1365
1465
  for (const entry of input.element.entries) {
1366
1466
  if (entry.kind === "prop") {
@@ -2028,7 +2128,7 @@ const ${nativeLocal} = require('react-native').${nativeExport};`,
2028
2128
  }
2029
2129
  };
2030
2130
  }
2031
- function bailout(input, code, message, span = input.element.span, zero) {
2131
+ function bailout(input, code, message, span = input.element.span, zero, prop) {
2032
2132
  return {
2033
2133
  ok: false,
2034
2134
  bailout: {
@@ -2037,6 +2137,7 @@ function bailout(input, code, message, span = input.element.span, zero) {
2037
2137
  message,
2038
2138
  span,
2039
2139
  component: input.element.component.name,
2140
+ ...prop && { prop },
2040
2141
  ...zero && {
2041
2142
  zeroRule: zero.rule,
2042
2143
  zeroMessage: zero.message
@@ -2045,5 +2146,5 @@ function bailout(input, code, message, span = input.element.span, zero) {
2045
2146
  };
2046
2147
  }
2047
2148
 
2048
- export { createTamaguiCompilerHost };
2149
+ export { createComponentRegistry, createTamaguiCompilerHost };
2049
2150
  //# sourceMappingURL=compilerHost.mjs.map