@tamagui/static 3.0.0-beta.1313.1 → 3.0.0-beta.1342.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 +51 -3
- package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +49 -10
- package/dist/esm/compilerHost.mjs +52 -4
- package/dist/esm/compilerHost.mjs.map +1 -1
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs +48 -10
- package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -1
- package/package.json +18 -18
- package/src/compilerHost.ts +119 -4
- package/src/extractor/esbuildTsconfigPaths.ts +57 -12
- package/types/compilerHost.d.ts.map +1 -1
- package/types/extractor/esbuildTsconfigPaths.d.ts +2 -0
- package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
- package/types/zero/identity.d.ts +1 -1
|
@@ -526,6 +526,35 @@ function isSerializableNativeStyle(value) {
|
|
|
526
526
|
if (prototype !== Object.prototype && prototype !== null) return false;
|
|
527
527
|
return Object.values(value).every(isSerializableNativeStyle);
|
|
528
528
|
}
|
|
529
|
+
function nativeTextMetrics(result) {
|
|
530
|
+
const value = result?.nativeTextMetrics;
|
|
531
|
+
if (!staticObject(value)) return null;
|
|
532
|
+
const { fontSize, lineHeight } = value;
|
|
533
|
+
if (fontSize !== void 0 && typeof fontSize !== "number" || lineHeight !== void 0 && typeof lineHeight !== "number" && typeof lineHeight !== "string") {
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
return fontSize === void 0 && lineHeight === void 0 ? null : value;
|
|
537
|
+
}
|
|
538
|
+
function mergeNativeTextMetrics(current, next) {
|
|
539
|
+
if (!current) return next;
|
|
540
|
+
if (!next) return current;
|
|
541
|
+
return {
|
|
542
|
+
fontSize: next.fontSize ?? current.fontSize,
|
|
543
|
+
lineHeight: next.lineHeight ?? current.lineHeight
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function hasChildThatMayRenderReactNode(element) {
|
|
547
|
+
return element.entries.some((entry) => {
|
|
548
|
+
if (entry.kind !== "child" || entry.value.kind === "empty") return false;
|
|
549
|
+
if (entry.value.kind === "element") return true;
|
|
550
|
+
if (entry.value.kind === "bailout") return entry.value.dynamic === null;
|
|
551
|
+
if (entry.value.kind === "conditional") {
|
|
552
|
+
return (0, import_compiler_core.collectLeaves)(entry.value.tree).some(({ value }) => value === void 0 || value !== null && typeof value === "object");
|
|
553
|
+
}
|
|
554
|
+
if (entry.value.kind !== "static") return true;
|
|
555
|
+
return entry.value.value !== null && typeof entry.value.value === "object";
|
|
556
|
+
});
|
|
557
|
+
}
|
|
529
558
|
function unusedIdentifier(source, base) {
|
|
530
559
|
let candidate = base;
|
|
531
560
|
let suffix = 0;
|
|
@@ -790,6 +819,7 @@ function createTamaguiCompilerHost(options) {
|
|
|
790
819
|
};
|
|
791
820
|
const configuredAnimationDriver = options.tamaguiConfig.animations;
|
|
792
821
|
const configuredCssAnimationDriver = platform === "web" && configuredAnimationDriver?.outputStyle === "css" && !options.tamaguiConfig.animationDrivers ? configuredAnimationDriver : null;
|
|
822
|
+
const nativeTextMetricsByElement = /* @__PURE__ */ new WeakMap();
|
|
793
823
|
const resolveStaticCssTransition = (value, transitionPresets) => {
|
|
794
824
|
if (platform !== "web" || typeof value !== "string") return null;
|
|
795
825
|
const transitionPresetNames = new Set(Object.keys(transitionPresets));
|
|
@@ -863,7 +893,6 @@ function createTamaguiCompilerHost(options) {
|
|
|
863
893
|
const base = (textLike ? core.Text : core.View)?.staticConfig;
|
|
864
894
|
if (!base) return null;
|
|
865
895
|
const platformDefaults = platform === "web" ? {
|
|
866
|
-
...import_dom.DISPLAY_WEB_RESET[row.display],
|
|
867
896
|
...row.defaults,
|
|
868
897
|
...import_dom.TAG_WEB_DEFAULTS[tag]
|
|
869
898
|
} : {
|
|
@@ -878,6 +907,7 @@ function createTamaguiCompilerHost(options) {
|
|
|
878
907
|
displayName: tag,
|
|
879
908
|
staticConfig: normalizeStaticConfig({
|
|
880
909
|
...base,
|
|
910
|
+
isDOM: true,
|
|
881
911
|
isInput: row.backing === "textinput",
|
|
882
912
|
validStyles: {
|
|
883
913
|
...import_helpers.validStyles,
|
|
@@ -1531,6 +1561,21 @@ function createTamaguiCompilerHost(options) {
|
|
|
1531
1561
|
if (!split) {
|
|
1532
1562
|
return bailout(input, "local/style-resolution-failed", "getSplitStyles returned no static result");
|
|
1533
1563
|
}
|
|
1564
|
+
const nativeMetrics = platform === "native" ? nativeTextMetrics(split) : null;
|
|
1565
|
+
if (nativeMetrics) nativeTextMetricsByElement.set(input.element, nativeMetrics);
|
|
1566
|
+
const hasDynamicFontSize = dynamicStyleEntries.some((entry) => {
|
|
1567
|
+
const name = directStyleName(entry.name, component);
|
|
1568
|
+
return name === "fontFamily" || name === "fontSize";
|
|
1569
|
+
});
|
|
1570
|
+
const hasUnresolvedNativeLineHeight = typeof nativeMetrics?.lineHeight === "number" && nativeMetrics.fontSize === void 0 && !hasDynamicFontSize;
|
|
1571
|
+
const hasDynamicTextMetric = dynamicStyleEntries.some((entry) => {
|
|
1572
|
+
const name = directStyleName(entry.name, component);
|
|
1573
|
+
return name === "fontFamily" || name === "fontSize" || name === "lineHeight" || name === null && !!component.staticConfig.variants?.[entry.name];
|
|
1574
|
+
});
|
|
1575
|
+
const changesInheritedNativeFontSize = nativeMetrics?.fontSize !== void 0 && nativeMetrics.lineHeight === void 0;
|
|
1576
|
+
if (platform === "native" && component.staticConfig.isText && !component.domTag && (hasUnresolvedNativeLineHeight || changesInheritedNativeFontSize || hasChildThatMayRenderReactNode(input.element) && (nativeMetrics !== null || hasDynamicTextMetric) || input.module.elements.some((ancestor) => ancestor !== input.element && ancestor.span.start < input.element.span.start && ancestor.span.end > input.element.span.end && nativeTextMetricsByElement.has(ancestor)))) {
|
|
1577
|
+
return bailout(input, "local/unsupported-target", "Native text metrics need the runtime Text provider for this subtree");
|
|
1578
|
+
}
|
|
1534
1579
|
if (split.programLifecycleStyleKeys?.enter?.size || split.programLifecycleStyleKeys?.exit?.size) {
|
|
1535
1580
|
return bailout(input, "local/unsupported-target", "Lifecycle value programs remain on the runtime path", input.element.span, {
|
|
1536
1581
|
rule: 5,
|
|
@@ -1664,6 +1709,7 @@ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
|
|
|
1664
1709
|
}
|
|
1665
1710
|
styleEntries = [.../* @__PURE__ */ new Set([...styleEntries, ...propsResult.consumed])];
|
|
1666
1711
|
let nativeDOMStyleSource = nativeStyleSource;
|
|
1712
|
+
let nativeDOMMetrics = nativeMetrics;
|
|
1667
1713
|
let runtimeStyleSource = null;
|
|
1668
1714
|
if (domStyleProgram?.kind === "prop" && domStyleProgram.value.kind === "dom-style") {
|
|
1669
1715
|
const needsRuntime = domStyleProgram.value.items.some((item) => item.value.kind === "static" && staticObject(item.value.value) && (Object.keys(item.value.value).some((property) => nativeRuntimeOnlyStyleProperties.has(property)) || Object.values(item.value.value).some((value) => typeof value === "string" && (flatClausePattern.test(value) || nativeInheritedKeywordPattern.test(value)) || isClauseObjectValue(value))));
|
|
@@ -1684,6 +1730,7 @@ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
|
|
|
1684
1730
|
if (!isSerializableNativeStyle(itemStyle) || core.containsThemeRef(itemStyle)) {
|
|
1685
1731
|
return bailout(input, "local/unsupported-target", "Native style() output is not serializable", item.value.span);
|
|
1686
1732
|
}
|
|
1733
|
+
nativeDOMMetrics = mergeNativeTextMetrics(nativeDOMMetrics, nativeTextMetrics(itemSplit));
|
|
1687
1734
|
value = JSON.stringify(itemStyle ?? {});
|
|
1688
1735
|
}
|
|
1689
1736
|
const condition = item.condition ? input.source.slice(item.condition.start, item.condition.end) : null;
|
|
@@ -1700,6 +1747,7 @@ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
|
|
|
1700
1747
|
const propertyContent = [
|
|
1701
1748
|
input.element.form === "jsx" ? `style={${nativeDOMStyleSource}}` : `style: ${nativeDOMStyleSource}`,
|
|
1702
1749
|
runtimeStyleSource ? input.element.form === "jsx" ? `__styles={${runtimeStyleSource}}` : `__styles: ${runtimeStyleSource}` : "",
|
|
1750
|
+
nativeDOMMetrics ? serializedProps(input.element.form, [["__textMetrics", JSON.stringify(nativeDOMMetrics)]]) : "",
|
|
1703
1751
|
serializedProps(input.element.form, propsResult.additions)
|
|
1704
1752
|
].filter(Boolean).join(input.element.form === "jsx" ? " " : ", ");
|
|
1705
1753
|
const primitiveTagEdits = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
|
|
@@ -2035,7 +2083,7 @@ const ${nativeLocal} = require('react-native').${nativeExport};`,
|
|
|
2035
2083
|
flattened: true
|
|
2036
2084
|
};
|
|
2037
2085
|
}
|
|
2038
|
-
const artifacts = extractedStyleArtifacts(split, props, options.tamaguiConfig,
|
|
2086
|
+
const artifacts = extractedStyleArtifacts(split, props, options.tamaguiConfig, true, Boolean(component.staticConfig.styleFrontend));
|
|
2039
2087
|
const className = artifacts.className;
|
|
2040
2088
|
const rawInlineStyle = split.viewProps?.style;
|
|
2041
2089
|
const inlineStyle = staticObject(rawInlineStyle) && Object.keys(rawInlineStyle).length > 0 ? rawInlineStyle : null;
|
|
@@ -2131,7 +2179,7 @@ const ${nativeLocal} = require('react-native').${nativeExport};`,
|
|
|
2131
2179
|
if (conflictsWithInline(changedKeys, laneAOwners, laneAMemberOwners)) {
|
|
2132
2180
|
return bailout(input, "local/dynamic-style-value", `${entry.name} and an inline dynamic style both contribute a CSS property; their precedence cannot be resolved per-branch`, entry.value.span);
|
|
2133
2181
|
}
|
|
2134
|
-
const branchArtifacts = extractedStyleArtifacts(branchSplit, branchProps, options.tamaguiConfig,
|
|
2182
|
+
const branchArtifacts = extractedStyleArtifacts(branchSplit, branchProps, options.tamaguiConfig, true, Boolean(component.staticConfig.styleFrontend));
|
|
2135
2183
|
leafArtifactsMap.set(leaf, {
|
|
2136
2184
|
classes: branchArtifacts.className.split(" ").filter(Boolean),
|
|
2137
2185
|
css: branchArtifacts.css
|
|
@@ -27,12 +27,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
27
27
|
var esbuildTsconfigPaths_exports = {};
|
|
28
28
|
__export(esbuildTsconfigPaths_exports, {
|
|
29
29
|
TsconfigPathsPlugin: () => TsconfigPathsPlugin,
|
|
30
|
-
createTsconfigPathsMatcher: () => createTsconfigPathsMatcher
|
|
30
|
+
createTsconfigPathsMatcher: () => createTsconfigPathsMatcher,
|
|
31
|
+
loadTsconfigPathMatcher: () => loadTsconfigPathMatcher
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(esbuildTsconfigPaths_exports);
|
|
34
|
+
var import_get_tsconfig = require("get-tsconfig");
|
|
33
35
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
34
36
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
-
var import_get_tsconfig = require("get-tsconfig");
|
|
36
37
|
const name = "tsconfig-paths";
|
|
37
38
|
function loadTsconfig(tsconfig, cwd = process.cwd()) {
|
|
38
39
|
if (!tsconfig) {
|
|
@@ -57,27 +58,65 @@ function createTsconfigPathsMatcher(tsconfig, cwd = process.cwd()) {
|
|
|
57
58
|
const loaded = loadTsconfig(tsconfig, cwd);
|
|
58
59
|
return loaded ? (0, import_get_tsconfig.createPathsMatcher)(loaded) : null;
|
|
59
60
|
}
|
|
61
|
+
function loadTsconfigPathMatcher(tsconfig) {
|
|
62
|
+
let result;
|
|
63
|
+
if (!tsconfig) {
|
|
64
|
+
result = (0, import_get_tsconfig.getTsconfig)(process.cwd()) || (0, import_get_tsconfig.getTsconfig)(process.cwd(), "jsconfig.json");
|
|
65
|
+
} else if (typeof tsconfig === "string") {
|
|
66
|
+
if (import_node_fs.default.existsSync(tsconfig)) {
|
|
67
|
+
const configPath = import_node_path.default.resolve(tsconfig);
|
|
68
|
+
result = {
|
|
69
|
+
config: (0, import_get_tsconfig.parseTsconfig)(configPath),
|
|
70
|
+
path: configPath
|
|
71
|
+
};
|
|
72
|
+
} else {
|
|
73
|
+
throw new Error(`Specified tsconfig file not found: ${tsconfig}`);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
result = {
|
|
77
|
+
config: tsconfig,
|
|
78
|
+
path: import_node_path.default.join(process.cwd(), "tsconfig.json")
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (!result) return () => [];
|
|
82
|
+
const matchPaths = (0, import_get_tsconfig.createPathsMatcher)(result);
|
|
83
|
+
const patterns = Object.keys(result.config.compilerOptions?.paths || {});
|
|
84
|
+
if (!matchPaths || patterns.length === 0) return () => [];
|
|
85
|
+
return (specifier) => {
|
|
86
|
+
const matchesExplicitPath = patterns.some((pattern) => {
|
|
87
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
88
|
+
if (wildcardIndex === -1) return pattern === specifier;
|
|
89
|
+
return specifier.startsWith(pattern.slice(0, wildcardIndex)) && specifier.endsWith(pattern.slice(wildcardIndex + 1));
|
|
90
|
+
});
|
|
91
|
+
return matchesExplicitPath ? matchPaths(specifier) : [];
|
|
92
|
+
};
|
|
93
|
+
}
|
|
60
94
|
function TsconfigPathsPlugin() {
|
|
61
|
-
const
|
|
95
|
+
const matchTsconfigPath = loadTsconfigPathMatcher();
|
|
62
96
|
return {
|
|
63
97
|
name,
|
|
64
98
|
setup(build) {
|
|
65
99
|
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
66
|
-
|
|
100
|
+
const pluginData = args.pluginData;
|
|
101
|
+
if (pluginData?.tamaguiTsconfigPaths || pluginData?.tamaguiTsconfigPathsResolved) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (args.path.startsWith("@tamagui/")) {
|
|
67
105
|
return null;
|
|
68
106
|
}
|
|
69
|
-
for (const candidate of
|
|
107
|
+
for (const candidate of matchTsconfigPath(args.path)) {
|
|
70
108
|
const resolved = await build.resolve(candidate, {
|
|
71
109
|
importer: args.importer,
|
|
72
110
|
kind: args.kind,
|
|
73
111
|
namespace: args.namespace,
|
|
74
|
-
resolveDir: args.resolveDir,
|
|
75
112
|
pluginData: {
|
|
76
|
-
...args.pluginData,
|
|
77
|
-
tamaguiTsconfigPaths: true
|
|
78
|
-
|
|
113
|
+
...args.pluginData && typeof args.pluginData === "object" ? args.pluginData : {},
|
|
114
|
+
tamaguiTsconfigPaths: true,
|
|
115
|
+
tamaguiTsconfigPathsResolved: true
|
|
116
|
+
},
|
|
117
|
+
resolveDir: args.resolveDir
|
|
79
118
|
});
|
|
80
|
-
if (resolved.
|
|
119
|
+
if (resolved.path && !resolved.path.endsWith(".d.ts") && resolved.errors.length === 0) {
|
|
81
120
|
return resolved;
|
|
82
121
|
}
|
|
83
122
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { collectLeaves, zeroRuleMessage, zeroThemeBoundaryMessage } from "@tamagui/compiler-core";
|
|
2
2
|
import { StyleObjectIdentifier, StyleObjectProperty, StyleObjectRules, StyleObjectValue, stylePropsAll, stylePropsInput, stylePropsText, validStyles } from "@tamagui/helpers";
|
|
3
|
-
import { ATTRIBUTES,
|
|
3
|
+
import { ATTRIBUTES, 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 { resolveTransition, toCSSTransition } from "@tamagui/animation-helpers";
|
|
5
5
|
import { createModifierRegistry, parseTransition, parseValue } from "@tamagui/style-grammar/tooling";
|
|
6
6
|
import { isValidStyleKey } from "@tamagui/web";
|
|
@@ -501,6 +501,35 @@ function isSerializableNativeStyle(value) {
|
|
|
501
501
|
if (prototype !== Object.prototype && prototype !== null) return false;
|
|
502
502
|
return Object.values(value).every(isSerializableNativeStyle);
|
|
503
503
|
}
|
|
504
|
+
function nativeTextMetrics(result) {
|
|
505
|
+
const value = result?.nativeTextMetrics;
|
|
506
|
+
if (!staticObject(value)) return null;
|
|
507
|
+
const { fontSize, lineHeight } = value;
|
|
508
|
+
if (fontSize !== void 0 && typeof fontSize !== "number" || lineHeight !== void 0 && typeof lineHeight !== "number" && typeof lineHeight !== "string") {
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
return fontSize === void 0 && lineHeight === void 0 ? null : value;
|
|
512
|
+
}
|
|
513
|
+
function mergeNativeTextMetrics(current, next) {
|
|
514
|
+
if (!current) return next;
|
|
515
|
+
if (!next) return current;
|
|
516
|
+
return {
|
|
517
|
+
fontSize: next.fontSize ?? current.fontSize,
|
|
518
|
+
lineHeight: next.lineHeight ?? current.lineHeight
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
function hasChildThatMayRenderReactNode(element) {
|
|
522
|
+
return element.entries.some((entry) => {
|
|
523
|
+
if (entry.kind !== "child" || entry.value.kind === "empty") return false;
|
|
524
|
+
if (entry.value.kind === "element") return true;
|
|
525
|
+
if (entry.value.kind === "bailout") return entry.value.dynamic === null;
|
|
526
|
+
if (entry.value.kind === "conditional") {
|
|
527
|
+
return collectLeaves(entry.value.tree).some(({ value }) => value === void 0 || value !== null && typeof value === "object");
|
|
528
|
+
}
|
|
529
|
+
if (entry.value.kind !== "static") return true;
|
|
530
|
+
return entry.value.value !== null && typeof entry.value.value === "object";
|
|
531
|
+
});
|
|
532
|
+
}
|
|
504
533
|
function unusedIdentifier(source, base) {
|
|
505
534
|
let candidate = base;
|
|
506
535
|
let suffix = 0;
|
|
@@ -765,6 +794,7 @@ function createTamaguiCompilerHost(options) {
|
|
|
765
794
|
};
|
|
766
795
|
const configuredAnimationDriver = options.tamaguiConfig.animations;
|
|
767
796
|
const configuredCssAnimationDriver = platform === "web" && configuredAnimationDriver?.outputStyle === "css" && !options.tamaguiConfig.animationDrivers ? configuredAnimationDriver : null;
|
|
797
|
+
const nativeTextMetricsByElement = /* @__PURE__ */ new WeakMap();
|
|
768
798
|
const resolveStaticCssTransition = (value, transitionPresets) => {
|
|
769
799
|
if (platform !== "web" || typeof value !== "string") return null;
|
|
770
800
|
const transitionPresetNames = new Set(Object.keys(transitionPresets));
|
|
@@ -838,7 +868,6 @@ function createTamaguiCompilerHost(options) {
|
|
|
838
868
|
const base = (textLike ? core.Text : core.View)?.staticConfig;
|
|
839
869
|
if (!base) return null;
|
|
840
870
|
const platformDefaults = platform === "web" ? {
|
|
841
|
-
...DISPLAY_WEB_RESET[row.display],
|
|
842
871
|
...row.defaults,
|
|
843
872
|
...TAG_WEB_DEFAULTS[tag]
|
|
844
873
|
} : {
|
|
@@ -853,6 +882,7 @@ function createTamaguiCompilerHost(options) {
|
|
|
853
882
|
displayName: tag,
|
|
854
883
|
staticConfig: normalizeStaticConfig({
|
|
855
884
|
...base,
|
|
885
|
+
isDOM: true,
|
|
856
886
|
isInput: row.backing === "textinput",
|
|
857
887
|
validStyles: {
|
|
858
888
|
...validStyles,
|
|
@@ -1506,6 +1536,21 @@ function createTamaguiCompilerHost(options) {
|
|
|
1506
1536
|
if (!split) {
|
|
1507
1537
|
return bailout(input, "local/style-resolution-failed", "getSplitStyles returned no static result");
|
|
1508
1538
|
}
|
|
1539
|
+
const nativeMetrics = platform === "native" ? nativeTextMetrics(split) : null;
|
|
1540
|
+
if (nativeMetrics) nativeTextMetricsByElement.set(input.element, nativeMetrics);
|
|
1541
|
+
const hasDynamicFontSize = dynamicStyleEntries.some((entry) => {
|
|
1542
|
+
const name = directStyleName(entry.name, component);
|
|
1543
|
+
return name === "fontFamily" || name === "fontSize";
|
|
1544
|
+
});
|
|
1545
|
+
const hasUnresolvedNativeLineHeight = typeof nativeMetrics?.lineHeight === "number" && nativeMetrics.fontSize === void 0 && !hasDynamicFontSize;
|
|
1546
|
+
const hasDynamicTextMetric = dynamicStyleEntries.some((entry) => {
|
|
1547
|
+
const name = directStyleName(entry.name, component);
|
|
1548
|
+
return name === "fontFamily" || name === "fontSize" || name === "lineHeight" || name === null && !!component.staticConfig.variants?.[entry.name];
|
|
1549
|
+
});
|
|
1550
|
+
const changesInheritedNativeFontSize = nativeMetrics?.fontSize !== void 0 && nativeMetrics.lineHeight === void 0;
|
|
1551
|
+
if (platform === "native" && component.staticConfig.isText && !component.domTag && (hasUnresolvedNativeLineHeight || changesInheritedNativeFontSize || hasChildThatMayRenderReactNode(input.element) && (nativeMetrics !== null || hasDynamicTextMetric) || input.module.elements.some((ancestor) => ancestor !== input.element && ancestor.span.start < input.element.span.start && ancestor.span.end > input.element.span.end && nativeTextMetricsByElement.has(ancestor)))) {
|
|
1552
|
+
return bailout(input, "local/unsupported-target", "Native text metrics need the runtime Text provider for this subtree");
|
|
1553
|
+
}
|
|
1509
1554
|
if (split.programLifecycleStyleKeys?.enter?.size || split.programLifecycleStyleKeys?.exit?.size) {
|
|
1510
1555
|
return bailout(input, "local/unsupported-target", "Lifecycle value programs remain on the runtime path", input.element.span, {
|
|
1511
1556
|
rule: 5,
|
|
@@ -1639,6 +1684,7 @@ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
|
|
|
1639
1684
|
}
|
|
1640
1685
|
styleEntries = [.../* @__PURE__ */ new Set([...styleEntries, ...propsResult.consumed])];
|
|
1641
1686
|
let nativeDOMStyleSource = nativeStyleSource;
|
|
1687
|
+
let nativeDOMMetrics = nativeMetrics;
|
|
1642
1688
|
let runtimeStyleSource = null;
|
|
1643
1689
|
if (domStyleProgram?.kind === "prop" && domStyleProgram.value.kind === "dom-style") {
|
|
1644
1690
|
const needsRuntime = domStyleProgram.value.items.some((item) => item.value.kind === "static" && staticObject(item.value.value) && (Object.keys(item.value.value).some((property) => nativeRuntimeOnlyStyleProperties.has(property)) || Object.values(item.value.value).some((value) => typeof value === "string" && (flatClausePattern.test(value) || nativeInheritedKeywordPattern.test(value)) || isClauseObjectValue(value))));
|
|
@@ -1659,6 +1705,7 @@ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
|
|
|
1659
1705
|
if (!isSerializableNativeStyle(itemStyle) || core.containsThemeRef(itemStyle)) {
|
|
1660
1706
|
return bailout(input, "local/unsupported-target", "Native style() output is not serializable", item.value.span);
|
|
1661
1707
|
}
|
|
1708
|
+
nativeDOMMetrics = mergeNativeTextMetrics(nativeDOMMetrics, nativeTextMetrics(itemSplit));
|
|
1662
1709
|
value = JSON.stringify(itemStyle ?? {});
|
|
1663
1710
|
}
|
|
1664
1711
|
const condition = item.condition ? input.source.slice(item.condition.start, item.condition.end) : null;
|
|
@@ -1675,6 +1722,7 @@ const ${mappingLocal} = ${JSON.stringify(themedStyleKeys)};`,
|
|
|
1675
1722
|
const propertyContent = [
|
|
1676
1723
|
input.element.form === "jsx" ? `style={${nativeDOMStyleSource}}` : `style: ${nativeDOMStyleSource}`,
|
|
1677
1724
|
runtimeStyleSource ? input.element.form === "jsx" ? `__styles={${runtimeStyleSource}}` : `__styles: ${runtimeStyleSource}` : "",
|
|
1725
|
+
nativeDOMMetrics ? serializedProps(input.element.form, [["__textMetrics", JSON.stringify(nativeDOMMetrics)]]) : "",
|
|
1678
1726
|
serializedProps(input.element.form, propsResult.additions)
|
|
1679
1727
|
].filter(Boolean).join(input.element.form === "jsx" ? " " : ", ");
|
|
1680
1728
|
const primitiveTagEdits = [input.element.component.span, input.element.component.closingSpan].filter((span) => !!span).map((span) => ({
|
|
@@ -2010,7 +2058,7 @@ const ${nativeLocal} = require('react-native').${nativeExport};`,
|
|
|
2010
2058
|
flattened: true
|
|
2011
2059
|
};
|
|
2012
2060
|
}
|
|
2013
|
-
const artifacts = extractedStyleArtifacts(split, props, options.tamaguiConfig,
|
|
2061
|
+
const artifacts = extractedStyleArtifacts(split, props, options.tamaguiConfig, true, Boolean(component.staticConfig.styleFrontend));
|
|
2014
2062
|
const className = artifacts.className;
|
|
2015
2063
|
const rawInlineStyle = split.viewProps?.style;
|
|
2016
2064
|
const inlineStyle = staticObject(rawInlineStyle) && Object.keys(rawInlineStyle).length > 0 ? rawInlineStyle : null;
|
|
@@ -2106,7 +2154,7 @@ const ${nativeLocal} = require('react-native').${nativeExport};`,
|
|
|
2106
2154
|
if (conflictsWithInline(changedKeys, laneAOwners, laneAMemberOwners)) {
|
|
2107
2155
|
return bailout(input, "local/dynamic-style-value", `${entry.name} and an inline dynamic style both contribute a CSS property; their precedence cannot be resolved per-branch`, entry.value.span);
|
|
2108
2156
|
}
|
|
2109
|
-
const branchArtifacts = extractedStyleArtifacts(branchSplit, branchProps, options.tamaguiConfig,
|
|
2157
|
+
const branchArtifacts = extractedStyleArtifacts(branchSplit, branchProps, options.tamaguiConfig, true, Boolean(component.staticConfig.styleFrontend));
|
|
2110
2158
|
leafArtifactsMap.set(leaf, {
|
|
2111
2159
|
classes: branchArtifacts.className.split(" ").filter(Boolean),
|
|
2112
2160
|
css: branchArtifacts.css
|