@tamagui/static 3.0.0-beta.806.1 → 3.0.0-beta.831.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/compilerHost.cjs +26 -16
- package/dist/cjs/domStructuralPass.cjs +4 -4
- package/dist/cjs/staticEvaluationIgnoredModules.cjs +1 -1
- package/dist/esm/compilerHost.mjs +26 -16
- package/dist/esm/compilerHost.mjs.map +1 -1
- package/dist/esm/domStructuralPass.mjs +4 -4
- package/dist/esm/domStructuralPass.mjs.map +1 -1
- package/dist/esm/staticEvaluationIgnoredModules.mjs +1 -1
- package/dist/esm/staticEvaluationIgnoredModules.mjs.map +1 -1
- package/package.json +17 -17
- package/src/compilerHost.ts +27 -35
- package/src/domStructuralPass.ts +4 -4
- package/src/staticEvaluationIgnoredModules.ts +1 -1
- package/types/compilerHost.d.ts.map +1 -1
|
@@ -26,11 +26,11 @@ const domStructuralPass = {
|
|
|
26
26
|
const edits = [];
|
|
27
27
|
const diagnostics = [];
|
|
28
28
|
const domElements = module.elements.filter(isDOMElement);
|
|
29
|
-
const supportedDOMElements = domElements.filter((element) =>
|
|
29
|
+
const supportedDOMElements = domElements.filter((element) => element.component.name in TAGS);
|
|
30
30
|
const domBySpan = new Map(supportedDOMElements.map((element) => [`${element.span.start}:${element.span.end}`, element]));
|
|
31
31
|
for (const element of domElements) {
|
|
32
32
|
const tagName = element.component.name;
|
|
33
|
-
if (!
|
|
33
|
+
if (!(tagName in TAGS)) {
|
|
34
34
|
diagnostics.push(localBailout("local/unsupported-target", element.component.span, `html.${element.component.name} is not part of the Tamagui DOM contract`));
|
|
35
35
|
continue;
|
|
36
36
|
}
|
|
@@ -41,8 +41,8 @@ const domStructuralPass = {
|
|
|
41
41
|
}
|
|
42
42
|
for (const entry of element.entries) {
|
|
43
43
|
if (entry.kind !== "prop") continue;
|
|
44
|
-
const attribute = (
|
|
45
|
-
const event =
|
|
44
|
+
const attribute = (entry.name in ATTRIBUTES ? ATTRIBUTES[entry.name] : void 0) ?? (entry.name.startsWith("data-") ? ATTRIBUTES["data-*"] : void 0);
|
|
45
|
+
const event = entry.name in EVENTS ? EVENTS[entry.name] : void 0;
|
|
46
46
|
const row = attribute ?? event;
|
|
47
47
|
if (!row) continue;
|
|
48
48
|
if (!acceptsTag(row.tags, tagName)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domStructuralPass.js","names":[],"sources":["esm/domStructuralPass.js"],"sourcesContent":["import {\n ATTRIBUTES,\n EVENTS,\n NATIVE_BACKING,\n TAGS\n} from \"@tamagui/dom\";\nimport {\n localBailout\n} from \"@tamagui/compiler-core\";\nimport { createHash } from \"node:crypto\";\nconst DOM_FRONTENDS = /* @__PURE__ */ new Set([\n \"tamagui\",\n \"tamagui/dom\",\n \"@tamagui/core\",\n \"@tamagui/core/dom\",\n \"@tamagui/tailwind\"\n]);\nconst acceptsTag = (accepted, tag) => accepted === \"*\" || accepted.includes(tag);\nfunction isDOMElement(element) {\n const provenance = element.component.provenance;\n return provenance?.importedName === \"html\" && DOM_FRONTENDS.has(provenance.specifier);\n}\nconst versionHash = createHash(\"sha256\").update(\n JSON.stringify({\n ATTRIBUTES,\n EVENTS,\n NATIVE_BACKING,\n TAGS\n })\n).digest(\"hex\");\nconst domStructuralPass = {\n versionHash: `dom-structural-v3-${versionHash}`,\n transform({ module, source, target }) {\n const edits = [];\n const diagnostics = [];\n const domElements = module.elements.filter(isDOMElement);\n const supportedDOMElements = domElements.filter(\n (element) =>
|
|
1
|
+
{"version":3,"file":"domStructuralPass.js","names":[],"sources":["esm/domStructuralPass.js"],"sourcesContent":["import {\n ATTRIBUTES,\n EVENTS,\n NATIVE_BACKING,\n TAGS\n} from \"@tamagui/dom\";\nimport {\n localBailout\n} from \"@tamagui/compiler-core\";\nimport { createHash } from \"node:crypto\";\nconst DOM_FRONTENDS = /* @__PURE__ */ new Set([\n \"tamagui\",\n \"tamagui/dom\",\n \"@tamagui/core\",\n \"@tamagui/core/dom\",\n \"@tamagui/tailwind\"\n]);\nconst acceptsTag = (accepted, tag) => accepted === \"*\" || accepted.includes(tag);\nfunction isDOMElement(element) {\n const provenance = element.component.provenance;\n return provenance?.importedName === \"html\" && DOM_FRONTENDS.has(provenance.specifier);\n}\nconst versionHash = createHash(\"sha256\").update(\n JSON.stringify({\n ATTRIBUTES,\n EVENTS,\n NATIVE_BACKING,\n TAGS\n })\n).digest(\"hex\");\nconst domStructuralPass = {\n versionHash: `dom-structural-v3-${versionHash}`,\n transform({ module, source, target }) {\n const edits = [];\n const diagnostics = [];\n const domElements = module.elements.filter(isDOMElement);\n const supportedDOMElements = domElements.filter(\n (element) => element.component.name in TAGS\n );\n const domBySpan = new Map(\n supportedDOMElements.map((element) => [\n `${element.span.start}:${element.span.end}`,\n element\n ])\n );\n for (const element of domElements) {\n const tagName = element.component.name;\n if (!(tagName in TAGS)) {\n diagnostics.push(\n localBailout(\n \"local/unsupported-target\",\n element.component.span,\n `html.${element.component.name} is not part of the Tamagui DOM contract`\n )\n );\n continue;\n }\n const tag = TAGS[tagName];\n if (target === \"native\" && tag.native === \"none\") {\n diagnostics.push(\n localBailout(\n \"local/unsupported-target\",\n element.component.span,\n `html.${tagName} is not supported on native: ${tag.note ?? \"no native backing\"}`\n )\n );\n continue;\n }\n for (const entry of element.entries) {\n if (entry.kind !== \"prop\") continue;\n const attribute = (entry.name in ATTRIBUTES ? ATTRIBUTES[entry.name] : void 0) ?? (entry.name.startsWith(\"data-\") ? ATTRIBUTES[\"data-*\"] : void 0);\n const event = entry.name in EVENTS ? EVENTS[entry.name] : void 0;\n const row = attribute ?? event;\n if (!row) continue;\n if (!acceptsTag(row.tags, tagName)) {\n diagnostics.push(\n localBailout(\n \"local/unsupported-prop-key\",\n entry.span,\n `${entry.name} is not supported on html.${tagName}`\n )\n );\n continue;\n }\n if (target === \"native\" && row.native === \"none\") {\n if (event) continue;\n diagnostics.push(\n localBailout(\n \"local/unsupported-prop-key\",\n entry.span,\n `${entry.name} is not supported on native html.${tagName}: ${row.note ?? \"no native equivalent\"}`\n )\n );\n }\n }\n for (const entry of element.entries) {\n if (entry.kind !== \"child\" || entry.value.kind !== \"element\") continue;\n const child = domBySpan.get(`${entry.value.span.start}:${entry.value.span.end}`);\n if (!child) continue;\n const childTag = child.component.name;\n const invalid = tag.content === \"void\" || tag.content === \"text\" || tag.content === \"phrasing\" && TAGS[childTag].display === \"block\" || tag.content === \"tags\" && !tag.childTags?.includes(childTag);\n if (invalid) {\n diagnostics.push(\n localBailout(\n \"local/unsupported-child\",\n child.component.span,\n `html.${childTag} cannot be nested directly inside html.${tagName}`\n )\n );\n }\n }\n }\n for (const definition of module.domStyleDefinitions) {\n if (definition.value.kind !== \"static\") {\n diagnostics.push(\n localBailout(\n \"local/dynamic-style-value\",\n definition.value.span,\n `style() definition ${definition.name} must be statically evaluable`\n )\n );\n continue;\n }\n edits.push({\n start: definition.span.start,\n end: definition.span.end,\n content: \"undefined\",\n origin: definition.span\n });\n }\n const nextModule = module;\n return {\n module: nextModule,\n edits,\n imports: [],\n diagnostics,\n dependencies: []\n };\n }\n};\nexport {\n domStructuralPass\n};\n//# sourceMappingURL=domStructuralPass.js.map\n"],"mappings":"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"}
|
|
@@ -6,7 +6,7 @@ const tamaguiStaticEvaluationModules = Object.freeze({
|
|
|
6
6
|
"react-native-worklets": "react-native-worklets/lib/module/mock.js"
|
|
7
7
|
});
|
|
8
8
|
function getStaticEvaluationModuleReplacement(moduleName) {
|
|
9
|
-
return
|
|
9
|
+
return moduleName in tamaguiStaticEvaluationModules ? tamaguiStaticEvaluationModules[moduleName] : void 0;
|
|
10
10
|
}
|
|
11
11
|
function isIgnoredStaticEvaluationModule(moduleName, userIgnoredModules = []) {
|
|
12
12
|
return getStaticEvaluationModuleReplacement(moduleName) !== void 0 || userIgnoredModules.includes(moduleName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticEvaluationIgnoredModules.js","names":[],"sources":["esm/staticEvaluationIgnoredModules.js"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nconst tamaguiStaticEvaluationModules = Object.freeze({\n // react-native-safe-area-context evaluates its native codegen spec in Node and\n // calls codegenNativeComponent, which is unavailable during static evaluation.\n \"react-native-safe-area-context\": null,\n // react-native-worklets initializes native JSI in Node, so static evaluation\n // inlines the package's own mock while preserving the authored animation config.\n // the vendor mock mutates _WORKLET, __RUNTIME_KIND, _log,\n // _getAnimationTimestamp, and requestAnimationFrame in the compiler process.\n \"react-native-worklets\": \"react-native-worklets/lib/module/mock.js\"\n});\nfunction getStaticEvaluationModuleReplacement(moduleName) {\n return
|
|
1
|
+
{"version":3,"file":"staticEvaluationIgnoredModules.js","names":[],"sources":["esm/staticEvaluationIgnoredModules.js"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nconst tamaguiStaticEvaluationModules = Object.freeze({\n // react-native-safe-area-context evaluates its native codegen spec in Node and\n // calls codegenNativeComponent, which is unavailable during static evaluation.\n \"react-native-safe-area-context\": null,\n // react-native-worklets initializes native JSI in Node, so static evaluation\n // inlines the package's own mock while preserving the authored animation config.\n // the vendor mock mutates _WORKLET, __RUNTIME_KIND, _log,\n // _getAnimationTimestamp, and requestAnimationFrame in the compiler process.\n \"react-native-worklets\": \"react-native-worklets/lib/module/mock.js\"\n});\nfunction getStaticEvaluationModuleReplacement(moduleName) {\n return moduleName in tamaguiStaticEvaluationModules ? tamaguiStaticEvaluationModules[moduleName] : void 0;\n}\nfunction isIgnoredStaticEvaluationModule(moduleName, userIgnoredModules = []) {\n return getStaticEvaluationModuleReplacement(moduleName) !== void 0 || userIgnoredModules.includes(moduleName);\n}\nfunction staticEvaluationIgnorePlugin(userIgnoredModules = []) {\n return {\n name: \"tamagui-static-evaluation-ignore\",\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (isIgnoredStaticEvaluationModule(args.path, userIgnoredModules)) {\n return { path: args.path, namespace: \"tamagui-static-evaluation-ignore\" };\n }\n return null;\n });\n build.onLoad(\n { filter: /.*/, namespace: \"tamagui-static-evaluation-ignore\" },\n async (args) => {\n const replacement = getStaticEvaluationModuleReplacement(args.path);\n if (replacement) {\n const resolved = await build.resolve(replacement, {\n kind: \"require-call\",\n resolveDir: build.initialOptions.absWorkingDir || process.cwd()\n });\n if (resolved.errors.length) {\n return { errors: resolved.errors, warnings: resolved.warnings };\n }\n return {\n contents: await readFile(resolved.path, \"utf8\"),\n loader: \"js\",\n resolveDir: dirname(resolved.path),\n warnings: resolved.warnings\n };\n }\n return {\n contents: \"module.exports = {}\",\n loader: \"js\",\n resolveDir: build.initialOptions.absWorkingDir || process.cwd()\n };\n }\n );\n }\n };\n}\nexport {\n getStaticEvaluationModuleReplacement,\n isIgnoredStaticEvaluationModule,\n staticEvaluationIgnorePlugin,\n tamaguiStaticEvaluationModules\n};\n//# sourceMappingURL=staticEvaluationIgnoredModules.js.map\n"],"mappings":";;;;AAEA,MAAM,iCAAiC,OAAO,OAAO;CAGnD,kCAAkC;CAKlC,yBAAyB;AAC3B,CAAC;AACD,SAAS,qCAAqC,YAAY;CACxD,OAAO,cAAc,iCAAiC,+BAA+B,cAAc,KAAK;AAC1G;AACA,SAAS,gCAAgC,YAAY,qBAAqB,CAAC,GAAG;CAC5E,OAAO,qCAAqC,UAAU,MAAM,KAAK,KAAK,mBAAmB,SAAS,UAAU;AAC9G;AACA,SAAS,6BAA6B,qBAAqB,CAAC,GAAG;CAC7D,OAAO;EACL,MAAM;EACN,MAAM,OAAO;GACX,MAAM,UAAU,EAAE,QAAQ,KAAK,IAAI,SAAS;IAC1C,IAAI,gCAAgC,KAAK,MAAM,kBAAkB,GAAG;KAClE,OAAO;MAAE,MAAM,KAAK;MAAM,WAAW;KAAmC;IAC1E;IACA,OAAO;GACT,CAAC;GACD,MAAM,OACJ;IAAE,QAAQ;IAAM,WAAW;GAAmC,GAC9D,OAAO,SAAS;IACd,MAAM,cAAc,qCAAqC,KAAK,IAAI;IAClE,IAAI,aAAa;KACf,MAAM,WAAW,MAAM,MAAM,QAAQ,aAAa;MAChD,MAAM;MACN,YAAY,MAAM,eAAe,iBAAiB,QAAQ,IAAI;KAChE,CAAC;KACD,IAAI,SAAS,OAAO,QAAQ;MAC1B,OAAO;OAAE,QAAQ,SAAS;OAAQ,UAAU,SAAS;MAAS;KAChE;KACA,OAAO;MACL,UAAU,MAAM,SAAS,SAAS,MAAM,MAAM;MAC9C,QAAQ;MACR,YAAY,QAAQ,SAAS,IAAI;MACjC,UAAU,SAAS;KACrB;IACF;IACA,OAAO;KACL,UAAU;KACV,QAAQ;KACR,YAAY,MAAM,eAAe,iBAAiB,QAAQ,IAAI;IAChE;GACF,CACF;EACF;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/static",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.831.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"clean:build": "tamagui-build clean:build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tamagui/cli-color": "3.0.0-beta.
|
|
49
|
-
"@tamagui/compiler-core": "3.0.0-beta.
|
|
50
|
-
"@tamagui/config-default": "3.0.0-beta.
|
|
51
|
-
"@tamagui/core": "3.0.0-beta.
|
|
52
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
53
|
-
"@tamagui/fake-react-native": "3.0.0-beta.
|
|
54
|
-
"@tamagui/generate-themes": "3.0.0-beta.
|
|
55
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
56
|
-
"@tamagui/helpers-node": "3.0.0-beta.
|
|
57
|
-
"@tamagui/react-native-web-internals": "3.0.0-beta.
|
|
58
|
-
"@tamagui/react-native-web-lite": "3.0.0-beta.
|
|
59
|
-
"@tamagui/shorthands": "3.0.0-beta.
|
|
60
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
61
|
-
"@tamagui/types": "3.0.0-beta.
|
|
62
|
-
"@tamagui/web": "3.0.0-beta.
|
|
48
|
+
"@tamagui/cli-color": "3.0.0-beta.831.1",
|
|
49
|
+
"@tamagui/compiler-core": "3.0.0-beta.831.1",
|
|
50
|
+
"@tamagui/config-default": "3.0.0-beta.831.1",
|
|
51
|
+
"@tamagui/core": "3.0.0-beta.831.1",
|
|
52
|
+
"@tamagui/dom": "3.0.0-beta.831.1",
|
|
53
|
+
"@tamagui/fake-react-native": "3.0.0-beta.831.1",
|
|
54
|
+
"@tamagui/generate-themes": "3.0.0-beta.831.1",
|
|
55
|
+
"@tamagui/helpers": "3.0.0-beta.831.1",
|
|
56
|
+
"@tamagui/helpers-node": "3.0.0-beta.831.1",
|
|
57
|
+
"@tamagui/react-native-web-internals": "3.0.0-beta.831.1",
|
|
58
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.831.1",
|
|
59
|
+
"@tamagui/shorthands": "3.0.0-beta.831.1",
|
|
60
|
+
"@tamagui/style-grammar": "3.0.0-beta.831.1",
|
|
61
|
+
"@tamagui/types": "3.0.0-beta.831.1",
|
|
62
|
+
"@tamagui/web": "3.0.0-beta.831.1",
|
|
63
63
|
"browserslist": "^4.28.1",
|
|
64
64
|
"check-dependency-version-consistency": "^4.1.0",
|
|
65
65
|
"esbuild": "0.28.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react-native-web": "~0.21.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@tamagui/build": "3.0.0-beta.
|
|
74
|
+
"@tamagui/build": "3.0.0-beta.831.1",
|
|
75
75
|
"@types/find-root": "^1.1.2",
|
|
76
76
|
"@types/node": "^22.1.0",
|
|
77
77
|
"@types/webpack": "^4.41.26",
|
package/src/compilerHost.ts
CHANGED
|
@@ -759,9 +759,9 @@ function nativeDOMProps(input: LoweringCandidateInput, tag: TagName) {
|
|
|
759
759
|
for (const entry of entries) {
|
|
760
760
|
const value = entrySource(input, entry)
|
|
761
761
|
const attribute =
|
|
762
|
-
(
|
|
762
|
+
(entry.name in ATTRIBUTES ? ATTRIBUTES[entry.name] : undefined) ??
|
|
763
763
|
(entry.name.startsWith('data-') ? ATTRIBUTES['data-*'] : undefined)
|
|
764
|
-
const event =
|
|
764
|
+
const event = entry.name in EVENTS ? EVENTS[entry.name] : undefined
|
|
765
765
|
if (event) {
|
|
766
766
|
if (event.native === 'none') {
|
|
767
767
|
return {
|
|
@@ -1040,16 +1040,25 @@ export function createTamaguiCompilerHost(
|
|
|
1040
1040
|
|
|
1041
1041
|
// A component's import provenance chose its authoring syntax, and the frontend
|
|
1042
1042
|
// descriptor frozen onto its static config is the only thing that knows how to
|
|
1043
|
-
// resolve that syntax's static input (a class-string base, string variants
|
|
1044
|
-
//
|
|
1043
|
+
// resolve that syntax's static input (a class-string base, string variants) into
|
|
1044
|
+
// styles. Regular Tamagui components carry no descriptor
|
|
1045
1045
|
// because their static config is already the renderer's input shape. The compiler
|
|
1046
1046
|
// must never import a frontend package: `@tamagui/tailwind/vite` already depends on
|
|
1047
1047
|
// the static compiler, so reaching the other way would be a cycle.
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1048
|
+
const normalizedStyleConfigs = new WeakMap<StaticConfig, any>()
|
|
1049
|
+
const normalizeStaticConfig = (staticConfig: StaticConfig): StaticConfig => {
|
|
1050
|
+
if (!staticConfig.styleFrontend) return staticConfig
|
|
1051
|
+
const normalized = core.getStyleStaticConfig(staticConfig, options.tamaguiConfig)
|
|
1052
|
+
const result = {
|
|
1053
|
+
...staticConfig,
|
|
1054
|
+
baseStyle: normalized.baseStyle,
|
|
1055
|
+
defaultProps: normalized.defaultProps,
|
|
1056
|
+
variants: normalized.variants,
|
|
1057
|
+
passthroughClassName: normalized.passthroughClassName,
|
|
1058
|
+
}
|
|
1059
|
+
normalizedStyleConfigs.set(result, normalized)
|
|
1060
|
+
return result
|
|
1061
|
+
}
|
|
1053
1062
|
|
|
1054
1063
|
const directStaticConfig = (
|
|
1055
1064
|
element: MaterializedElement
|
|
@@ -1081,7 +1090,7 @@ export function createTamaguiCompilerHost(
|
|
|
1081
1090
|
if (
|
|
1082
1091
|
identity?.importedName !== 'html' ||
|
|
1083
1092
|
!DOM_FRONTENDS.has(identity.specifier) ||
|
|
1084
|
-
!
|
|
1093
|
+
!(tag in TAGS)
|
|
1085
1094
|
) {
|
|
1086
1095
|
return null
|
|
1087
1096
|
}
|
|
@@ -1141,7 +1150,6 @@ export function createTamaguiCompilerHost(
|
|
|
1141
1150
|
const {
|
|
1142
1151
|
variants,
|
|
1143
1152
|
defaultVariants,
|
|
1144
|
-
compoundVariants,
|
|
1145
1153
|
displayName,
|
|
1146
1154
|
context,
|
|
1147
1155
|
contextProps,
|
|
@@ -1161,10 +1169,6 @@ export function createTamaguiCompilerHost(
|
|
|
1161
1169
|
...base.staticConfig.variants,
|
|
1162
1170
|
...(variants as object | undefined),
|
|
1163
1171
|
},
|
|
1164
|
-
compoundVariants: [
|
|
1165
|
-
...(base.staticConfig.compoundVariants ?? []),
|
|
1166
|
-
...(compoundVariants ?? []),
|
|
1167
|
-
],
|
|
1168
1172
|
defaultProps: {
|
|
1169
1173
|
...base.staticConfig.defaultProps,
|
|
1170
1174
|
...defaultProps,
|
|
@@ -1190,7 +1194,7 @@ export function createTamaguiCompilerHost(
|
|
|
1190
1194
|
const resolved =
|
|
1191
1195
|
dom ?? styledStaticConfig(styledDefinition) ?? directStaticConfig(element)
|
|
1192
1196
|
if (!resolved) return null
|
|
1193
|
-
const defaultProps =
|
|
1197
|
+
const defaultProps = resolved.staticConfig.defaultProps ?? {}
|
|
1194
1198
|
return {
|
|
1195
1199
|
key: resolved.key,
|
|
1196
1200
|
canFlatten:
|
|
@@ -1209,8 +1213,7 @@ export function createTamaguiCompilerHost(
|
|
|
1209
1213
|
Object.keys(defaultProps).length === 0 &&
|
|
1210
1214
|
!resolved.staticConfig.defaultVariants &&
|
|
1211
1215
|
!resolved.staticConfig.baseClassName &&
|
|
1212
|
-
!resolved.staticConfig.baseStyle
|
|
1213
|
-
(resolved.staticConfig.compoundVariants?.length ?? 0) === 0,
|
|
1216
|
+
!resolved.staticConfig.baseStyle,
|
|
1214
1217
|
}
|
|
1215
1218
|
}
|
|
1216
1219
|
|
|
@@ -1282,7 +1285,6 @@ export function createTamaguiCompilerHost(
|
|
|
1282
1285
|
}
|
|
1283
1286
|
process.env.TAMAGUI_TARGET = platform
|
|
1284
1287
|
try {
|
|
1285
|
-
core.prepareStyleStaticConfig(staticConfig)
|
|
1286
1288
|
return core.getSplitStyles(
|
|
1287
1289
|
props,
|
|
1288
1290
|
staticConfig,
|
|
@@ -1301,7 +1303,8 @@ export function createTamaguiCompilerHost(
|
|
|
1301
1303
|
undefined,
|
|
1302
1304
|
undefined,
|
|
1303
1305
|
undefined,
|
|
1304
|
-
animationDriver
|
|
1306
|
+
animationDriver,
|
|
1307
|
+
normalizedStyleConfigs.get(staticConfig)
|
|
1305
1308
|
)
|
|
1306
1309
|
} finally {
|
|
1307
1310
|
if (previousStatic === undefined) delete process.env.IS_STATIC
|
|
@@ -1316,7 +1319,6 @@ export function createTamaguiCompilerHost(
|
|
|
1316
1319
|
baseStyle: undefined,
|
|
1317
1320
|
defaultProps: {},
|
|
1318
1321
|
defaultVariants: undefined,
|
|
1319
|
-
compoundVariants: [],
|
|
1320
1322
|
variants: {},
|
|
1321
1323
|
})
|
|
1322
1324
|
|
|
@@ -1557,7 +1559,7 @@ export function createTamaguiCompilerHost(
|
|
|
1557
1559
|
const disableOptimizationEntry = input.element.entries.find(
|
|
1558
1560
|
(entry) => entry.kind === 'prop' && entry.name === 'disableOptimization'
|
|
1559
1561
|
)
|
|
1560
|
-
if (disableOptimizationEntry ||
|
|
1562
|
+
if (disableOptimizationEntry || 'disableOptimization' in props) {
|
|
1561
1563
|
return bailout(
|
|
1562
1564
|
input,
|
|
1563
1565
|
'local/unsupported-target',
|
|
@@ -1628,7 +1630,7 @@ export function createTamaguiCompilerHost(
|
|
|
1628
1630
|
// had never been written: the element flattened and the prop was dropped
|
|
1629
1631
|
// with no diagnostic. Same merge function and same precedence as
|
|
1630
1632
|
// completeProps, so there is one answer to "what is this prop's value".
|
|
1631
|
-
const animationDefaultProps =
|
|
1633
|
+
const animationDefaultProps = component.staticConfig.defaultProps ?? {}
|
|
1632
1634
|
const animationProps = core.mergeProps(animationDefaultProps, props)
|
|
1633
1635
|
const animationNames = new Set([
|
|
1634
1636
|
...input.element.entries.flatMap((entry) =>
|
|
@@ -1849,7 +1851,7 @@ export function createTamaguiCompilerHost(
|
|
|
1849
1851
|
const asChildEntry = input.element.entries.find(
|
|
1850
1852
|
(entry) => entry.kind === 'prop' && entry.name === 'asChild'
|
|
1851
1853
|
)
|
|
1852
|
-
if (asChildEntry ||
|
|
1854
|
+
if (asChildEntry || 'asChild' in props) {
|
|
1853
1855
|
return bailout(
|
|
1854
1856
|
input,
|
|
1855
1857
|
'local/unsupported-target',
|
|
@@ -2045,7 +2047,7 @@ export function createTamaguiCompilerHost(
|
|
|
2045
2047
|
entry.span
|
|
2046
2048
|
)
|
|
2047
2049
|
}
|
|
2048
|
-
const staticDefaultProps =
|
|
2050
|
+
const staticDefaultProps = component.staticConfig.defaultProps ?? {}
|
|
2049
2051
|
const defaultProps =
|
|
2050
2052
|
platform === 'web' &&
|
|
2051
2053
|
!component.staticConfig.isText &&
|
|
@@ -2126,16 +2128,6 @@ export function createTamaguiCompilerHost(
|
|
|
2126
2128
|
isClauseValue(name, value)
|
|
2127
2129
|
)
|
|
2128
2130
|
)
|
|
2129
|
-
) ||
|
|
2130
|
-
// compound variant styles are contributed by resolveSplitStyles too,
|
|
2131
|
-
// so a clause there would also freeze build-machine state if folded
|
|
2132
|
-
(component.staticConfig.compoundVariants ?? []).some(
|
|
2133
|
-
(compound) =>
|
|
2134
|
-
staticObject(compound) &&
|
|
2135
|
-
staticObject(compound.style) &&
|
|
2136
|
-
Object.entries(compound.style).some(([name, value]) =>
|
|
2137
|
-
isClauseValue(name, value)
|
|
2138
|
-
)
|
|
2139
2131
|
)
|
|
2140
2132
|
if (carriesClause) {
|
|
2141
2133
|
return bailout(
|
package/src/domStructuralPass.ts
CHANGED
|
@@ -54,7 +54,7 @@ export const domStructuralPass: StructuralModulePass = {
|
|
|
54
54
|
element
|
|
55
55
|
): element is MaterializedElement & {
|
|
56
56
|
component: MaterializedElement['component'] & { name: TagName }
|
|
57
|
-
} =>
|
|
57
|
+
} => element.component.name in TAGS
|
|
58
58
|
)
|
|
59
59
|
const domBySpan = new Map(
|
|
60
60
|
supportedDOMElements.map((element) => [
|
|
@@ -65,7 +65,7 @@ export const domStructuralPass: StructuralModulePass = {
|
|
|
65
65
|
|
|
66
66
|
for (const element of domElements) {
|
|
67
67
|
const tagName = element.component.name as TagName
|
|
68
|
-
if (!
|
|
68
|
+
if (!(tagName in TAGS)) {
|
|
69
69
|
diagnostics.push(
|
|
70
70
|
localBailout(
|
|
71
71
|
'local/unsupported-target',
|
|
@@ -90,9 +90,9 @@ export const domStructuralPass: StructuralModulePass = {
|
|
|
90
90
|
for (const entry of element.entries) {
|
|
91
91
|
if (entry.kind !== 'prop') continue
|
|
92
92
|
const attribute =
|
|
93
|
-
(
|
|
93
|
+
(entry.name in ATTRIBUTES ? ATTRIBUTES[entry.name] : undefined) ??
|
|
94
94
|
(entry.name.startsWith('data-') ? ATTRIBUTES['data-*'] : undefined)
|
|
95
|
-
const event =
|
|
95
|
+
const event = entry.name in EVENTS ? EVENTS[entry.name] : undefined
|
|
96
96
|
const row = attribute ?? event
|
|
97
97
|
if (!row) continue
|
|
98
98
|
if (!acceptsTag(row.tags, tagName)) {
|
|
@@ -14,7 +14,7 @@ export const tamaguiStaticEvaluationModules = Object.freeze({
|
|
|
14
14
|
} as const)
|
|
15
15
|
|
|
16
16
|
export function getStaticEvaluationModuleReplacement(moduleName: string) {
|
|
17
|
-
return
|
|
17
|
+
return moduleName in tamaguiStaticEvaluationModules
|
|
18
18
|
? tamaguiStaticEvaluationModules[
|
|
19
19
|
moduleName as keyof typeof tamaguiStaticEvaluationModules
|
|
20
20
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilerHost.d.ts","sourceRoot":"","sources":["../src/compilerHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACpB,cAAc,EAQf,MAAM,wBAAwB,CAAA;AAmC/B,OAAO,KAAK,EAAiC,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAIhE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,cAAc,CAAA;IACtB,aAAa,EAAE,qBAAqB,CAAA;IACpC,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,gBAAgB,EAAE,uBAAuB,EAAE,CAAA;IAC3C,wEAAwE;IACxE,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,mEAAmE;IACnE,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAo2BD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"compilerHost.d.ts","sourceRoot":"","sources":["../src/compilerHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACpB,cAAc,EAQf,MAAM,wBAAwB,CAAA;AAmC/B,OAAO,KAAK,EAAiC,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAIhE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,cAAc,CAAA;IACtB,aAAa,EAAE,qBAAqB,CAAA;IACpC,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,gBAAgB,EAAE,uBAAuB,EAAE,CAAA;IAC3C,wEAAwE;IACxE,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,mEAAmE;IACnE,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAo2BD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,oBAAoB,CAy2EtB"}
|