@tamagui/core 1.0.1-beta.148 → 1.0.1-beta.151
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/constants/platform.js.map +2 -2
- package/dist/cjs/createComponent.js +161 -52
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js +2 -1
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +60 -50
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/mergeTransform.js.map +2 -2
- package/dist/cjs/hooks/useFeatures.js +0 -120
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/insertFont.js +1 -1
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/createComponent.js +169 -55
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createFont.js +2 -1
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +60 -50
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +0 -120
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/insertFont.js +1 -1
- package/dist/esm/insertFont.js.map +2 -2
- package/package.json +10 -9
- package/src/constants/platform.ts +1 -0
- package/src/createComponent.tsx +246 -57
- package/src/createFont.ts +4 -1
- package/src/helpers/getSplitStyles.tsx +73 -65
- package/src/helpers/mergeTransform.ts +2 -0
- package/src/insertFont.ts +1 -1
- package/src/types.tsx +7 -5
- package/types/helpers/getSplitStyles.d.ts +1 -0
- package/types/hooks/useFeatures.d.ts +0 -1
- package/types/types.d.ts +11 -3
- package/src/hooks/useFeatures.tsx +0 -289
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/platform.ts"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const isSSR = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\n\nexport const isRSC = process.env.ENABLE_RSC\n ? // note this is statically analyzed so no funny business, just access it without optional chaining\n // @ts-ignore\n import.meta.env\n ? // @ts-ignore\n import.meta.env.SSR\n : false\n : false\n\nconst idFn = () => {}\nexport const useIsomorphicLayoutEffect = isRSC ? idFn : isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const isWebTouchable = isClient && 'ontouchstart' in window\nexport const isTouchable = !isWeb || isWebTouchable\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,0BAAyB;AADzB;AAAA;AAGO,MAAM,YAAY,2DAAU,QAAO;AACnC,MAAM,QAAQ,2DAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,QAAQ,SAAS,CAAC;AACxB,MAAM,WAAW,SAAS;
|
|
4
|
+
"sourcesContent": ["import { useEffect, useLayoutEffect } from 'react'\nimport { Platform } from 'react-native'\n\nexport const isAndroid = Platform?.OS === 'android'\nexport const isIOS = Platform?.OS === 'ios'\nexport const isWeb = process.env.TAMAGUI_TARGET === 'web'\nexport const isWindowDefined = typeof window !== 'undefined'\nexport const isSSR = isWeb && !isWindowDefined\nexport const isClient = isWeb && isWindowDefined\n\n// may want to move to VITE_RSC_BUILD\nexport const isRSC = process.env.ENABLE_RSC\n ? // note this is statically analyzed so no funny business, just access it without optional chaining\n // @ts-ignore\n import.meta.env\n ? // @ts-ignore\n import.meta.env.SSR\n : false\n : false\n\nconst idFn = () => {}\nexport const useIsomorphicLayoutEffect = isRSC ? idFn : isSSR ? useEffect : useLayoutEffect\nexport const isChrome = typeof navigator !== 'undefined' && /Chrome/.test(navigator.userAgent || '')\nexport const isWebTouchable = isClient && 'ontouchstart' in window\nexport const isTouchable = !isWeb || isWebTouchable\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,0BAAyB;AADzB;AAAA;AAGO,MAAM,YAAY,2DAAU,QAAO;AACnC,MAAM,QAAQ,2DAAU,QAAO;AAC/B,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,kBAAkB,OAAO,WAAW;AAC1C,MAAM,QAAQ,SAAS,CAAC;AACxB,MAAM,WAAW,SAAS;AAG1B,MAAM,QAAQ,QAAQ,IAAI,aAG7B,YAAY,MAEV,YAAY,IAAI,MAChB,QACF;AAEJ,MAAM,OAAO,MAAM;AAAC;AACb,MAAM,4BAA4B,QAAQ,OAAO,QAAQ,yBAAY;AACrE,MAAM,WAAW,OAAO,cAAc,eAAe,SAAS,KAAK,UAAU,aAAa,EAAE;AAC5F,MAAM,iBAAiB,YAAY,kBAAkB;AACrD,MAAM,cAAc,CAAC,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -48,7 +48,6 @@ var import_getSplitStyles = require("./helpers/getSplitStyles");
|
|
|
48
48
|
var import_insertStyleRule = require("./helpers/insertStyleRule");
|
|
49
49
|
var import_mergeProps = require("./helpers/mergeProps");
|
|
50
50
|
var import_proxyThemeVariables = require("./helpers/proxyThemeVariables");
|
|
51
|
-
var import_useFeatures = require("./hooks/useFeatures");
|
|
52
51
|
var import_useMedia = require("./hooks/useMedia");
|
|
53
52
|
var import_usePressable = require("./hooks/usePressable");
|
|
54
53
|
var import_useServerHooks = require("./hooks/useServerHooks");
|
|
@@ -82,6 +81,7 @@ function mergeShorthands({ defaultProps }, { shorthands }) {
|
|
|
82
81
|
}
|
|
83
82
|
let initialTheme;
|
|
84
83
|
let config;
|
|
84
|
+
let mediaPropNames = [];
|
|
85
85
|
function createComponent(configIn, ParentComponent) {
|
|
86
86
|
const staticConfig = (() => {
|
|
87
87
|
const next = (0, import_extendStaticConfig.extendStaticConfig)(configIn, ParentComponent);
|
|
@@ -101,7 +101,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
101
101
|
let tamaguiDefaultProps;
|
|
102
102
|
let initialSplitStyles;
|
|
103
103
|
const component = (0, import_react.forwardRef)((propsIn, forwardedRef) => {
|
|
104
|
-
var _a, _b, _c, _d;
|
|
104
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
105
105
|
let props;
|
|
106
106
|
if (tamaguiDefaultProps && !propsIn.asChild) {
|
|
107
107
|
props = (0, import_mergeProps.mergeProps)(tamaguiDefaultProps, propsIn)[0];
|
|
@@ -150,23 +150,54 @@ function createComponent(configIn, ParentComponent) {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
|
|
153
|
+
const { viewProps: viewPropsIn, pseudos, medias, style, classNames, mediaKeys } = splitStyles;
|
|
154
|
+
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
155
|
+
for (const key of mediaKeys) {
|
|
156
|
+
(0, import_useMedia.addMediaQueryListener)(key, forceUpdate);
|
|
157
|
+
}
|
|
158
|
+
return () => {
|
|
159
|
+
for (const key of mediaKeys) {
|
|
160
|
+
(0, import_useMedia.removeMediaQueryListener)(key, forceUpdate);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}, [mediaKeys.join(",")]);
|
|
154
164
|
const useAnimations = (_a = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
155
165
|
const isAnimated = !!(useAnimations && props.animation);
|
|
156
166
|
const hasEnterStyle = !!props.enterStyle;
|
|
157
167
|
const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...style } : null;
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
const propsWithAnimation = props;
|
|
169
|
+
if (!import_platform.isRSC && isAnimated) {
|
|
170
|
+
const animationState = useAnimations(propsWithAnimation, {
|
|
171
|
+
state,
|
|
172
|
+
pseudos,
|
|
173
|
+
onDidAnimate: props.onDidAnimate,
|
|
174
|
+
hostRef,
|
|
175
|
+
staticConfig,
|
|
176
|
+
getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
|
|
177
|
+
var _a2, _b2, _c2, _d2;
|
|
178
|
+
const style2 = animationFeatureStylesIn;
|
|
179
|
+
const enterStyle = isEntering ? enterVariant && ((_a2 = staticConfig.variants) == null ? void 0 : _a2[enterVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)("", (_b2 = staticConfig.variants) == null ? void 0 : _b2[enterVariant]["true"], staticConfig, theme, props, state, tamaguiConfig) || pseudos.enterStyle : pseudos.enterStyle : null;
|
|
180
|
+
const exitStyle = isExiting ? exitVariant && ((_c2 = staticConfig.variants) == null ? void 0 : _c2[exitVariant]["true"]) ? (0, import_getSplitStyles.getSubStyle)("", (_d2 = staticConfig.variants) == null ? void 0 : _d2[exitVariant]["true"], staticConfig, theme, props, state, tamaguiConfig) || pseudos.exitStyle : pseudos.exitStyle : null;
|
|
181
|
+
ensureBaseHasDefaults(style2, pseudos.hoverStyle, pseudos.focusStyle, pseudos.pressStyle, pseudos.pressStyle);
|
|
182
|
+
enterStyle && isEntering && merge(style2, enterStyle);
|
|
183
|
+
state.hover && pseudos.hoverStyle && merge(style2, pseudos.hoverStyle);
|
|
184
|
+
state.focus && pseudos.focusStyle && merge(style2, pseudos.focusStyle);
|
|
185
|
+
state.press && pseudos.pressStyle && merge(style2, pseudos.pressStyle);
|
|
186
|
+
exitStyle && isExiting && merge(style2, exitStyle);
|
|
187
|
+
if (process.env.NODE_ENV === "development") {
|
|
188
|
+
if (props["debug"]) {
|
|
189
|
+
console.log("animation style", style2);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return style2;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
if (animationState !== state.animation) {
|
|
196
|
+
setStateShallow({
|
|
197
|
+
animation: animationState
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
170
201
|
const {
|
|
171
202
|
tag,
|
|
172
203
|
hitSlop,
|
|
@@ -298,7 +329,14 @@ function createComponent(configIn, ParentComponent) {
|
|
|
298
329
|
onStartShouldSetResponderCapture
|
|
299
330
|
});
|
|
300
331
|
const platformMethodsRef = (0, import_rnw.usePlatformMethods)(viewProps);
|
|
301
|
-
const
|
|
332
|
+
const shouldSetMounted = Boolean(import_platform.isClient && (hasEnterStyle || props.animation) && !state.mounted);
|
|
333
|
+
const setRef = (0, import_rnw.useMergeRefs)(hostRef, platformMethodsRef, forwardedRef, shouldSetMounted ? () => {
|
|
334
|
+
setTimeout(() => {
|
|
335
|
+
setStateShallow({
|
|
336
|
+
mounted: true
|
|
337
|
+
});
|
|
338
|
+
}, 10);
|
|
339
|
+
} : void 0);
|
|
302
340
|
viewProps.ref = setRef;
|
|
303
341
|
}
|
|
304
342
|
if (props.href != void 0 && hrefAttrs != void 0) {
|
|
@@ -343,26 +381,13 @@ function createComponent(configIn, ParentComponent) {
|
|
|
343
381
|
}
|
|
344
382
|
});
|
|
345
383
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
384
|
+
if (!import_platform.isRSC) {
|
|
385
|
+
(0, import_react.useEffect)(() => {
|
|
386
|
+
return () => {
|
|
387
|
+
mouseUps.delete(unPress);
|
|
388
|
+
};
|
|
389
|
+
}, []);
|
|
351
390
|
}
|
|
352
|
-
(0, import_platform.useIsomorphicLayoutEffect)(() => {
|
|
353
|
-
if (import_platform.isClient && (hasEnterStyle || props.animation) && !state.mounted) {
|
|
354
|
-
setStateShallow({
|
|
355
|
-
mounted: true
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
internal.current.isMounted = true;
|
|
359
|
-
return () => {
|
|
360
|
-
var _a2;
|
|
361
|
-
mouseUps.delete(unPress);
|
|
362
|
-
internal.current.isMounted = false;
|
|
363
|
-
(_a2 = internal.current.unmountEffects) == null ? void 0 : _a2.forEach((cb) => cb());
|
|
364
|
-
};
|
|
365
|
-
}, [hasEnterStyle, props.animation]);
|
|
366
391
|
let styles;
|
|
367
392
|
const animationStyles = state.animation ? state.animation.style : null;
|
|
368
393
|
if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {
|
|
@@ -379,11 +404,10 @@ function createComponent(configIn, ParentComponent) {
|
|
|
379
404
|
];
|
|
380
405
|
if (!animationStyles && initialSplitStyles) {
|
|
381
406
|
const initPseudos = initialSplitStyles.pseudos;
|
|
382
|
-
const force = shouldForcePseudo;
|
|
383
407
|
!state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
|
|
384
|
-
state.hover && addPseudoToStyles(styles, initPseudos, pseudos, "hoverStyle",
|
|
385
|
-
state.focus && addPseudoToStyles(styles, initPseudos, pseudos, "focusStyle",
|
|
386
|
-
state.press && addPseudoToStyles(styles, initPseudos, pseudos, "pressStyle",
|
|
408
|
+
state.hover && addPseudoToStyles(styles, initPseudos, pseudos, "hoverStyle", shouldForcePseudo);
|
|
409
|
+
state.focus && addPseudoToStyles(styles, initPseudos, pseudos, "focusStyle", shouldForcePseudo);
|
|
410
|
+
state.press && addPseudoToStyles(styles, initPseudos, pseudos, "pressStyle", shouldForcePseudo);
|
|
387
411
|
}
|
|
388
412
|
if (shouldForcePseudo) {
|
|
389
413
|
const next = {};
|
|
@@ -427,7 +451,31 @@ function createComponent(configIn, ParentComponent) {
|
|
|
427
451
|
viewProps.className = className;
|
|
428
452
|
}
|
|
429
453
|
viewProps.style = style2;
|
|
430
|
-
}
|
|
454
|
+
}
|
|
455
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
456
|
+
if (splitStyles.fontFamily) {
|
|
457
|
+
const faceInfo = (_b = config.fontsParsed[splitStyles.fontFamily]) == null ? void 0 : _b.face;
|
|
458
|
+
if (faceInfo) {
|
|
459
|
+
const [weight, style2] = (() => {
|
|
460
|
+
var _a2, _b2;
|
|
461
|
+
let weight2;
|
|
462
|
+
let style3;
|
|
463
|
+
for (let i = styles.length; i >= 0; i--) {
|
|
464
|
+
weight2 ?? (weight2 = (_a2 = styles[i]) == null ? void 0 : _a2.fontWeight);
|
|
465
|
+
style3 ?? (style3 = (_b2 = styles[i]) == null ? void 0 : _b2.fontStyle);
|
|
466
|
+
}
|
|
467
|
+
return [weight2 || "400", style3 || "normal"];
|
|
468
|
+
})();
|
|
469
|
+
const overrideFace = (_d = (_c = faceInfo[weight]) == null ? void 0 : _c[style2]) == null ? void 0 : _d.val;
|
|
470
|
+
if (overrideFace) {
|
|
471
|
+
for (const style3 of styles) {
|
|
472
|
+
if (style3 == null ? void 0 : style3.fontFamily) {
|
|
473
|
+
style3.fontFamily = overrideFace;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
431
479
|
viewProps.style = styles;
|
|
432
480
|
}
|
|
433
481
|
const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
|
|
@@ -440,8 +488,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
440
488
|
const pressOutKey = handlesPressEvents ? "onPressOut" : "onMouseUp";
|
|
441
489
|
const shouldAttach = !asChild && (attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || import_platform.isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props));
|
|
442
490
|
const unPress = (0, import_react.useCallback)(() => {
|
|
443
|
-
if (!internal.current.isMounted)
|
|
444
|
-
return;
|
|
445
491
|
setStateShallow({
|
|
446
492
|
press: false,
|
|
447
493
|
pressIn: false
|
|
@@ -504,7 +550,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
504
550
|
} : null,
|
|
505
551
|
...!import_platform.isWeb && {
|
|
506
552
|
cancelable: !props.rejectResponderTermination,
|
|
507
|
-
disabled: props.disabled !== null ? props.disabled : (
|
|
553
|
+
disabled: props.disabled !== null ? props.disabled : (_e = props.accessibilityState) == null ? void 0 : _e.disabled,
|
|
508
554
|
hitSlop: props.hitSlop,
|
|
509
555
|
delayLongPress: props.delayLongPress,
|
|
510
556
|
delayPressIn: props.delayPressIn,
|
|
@@ -514,7 +560,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
514
560
|
}
|
|
515
561
|
} : null;
|
|
516
562
|
let space = spaceProp;
|
|
517
|
-
if (
|
|
563
|
+
if (mediaKeys.length) {
|
|
518
564
|
for (const key in import_useMedia.mediaState) {
|
|
519
565
|
if (!import_useMedia.mediaState[key])
|
|
520
566
|
continue;
|
|
@@ -591,7 +637,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
591
637
|
content = (0, import_react.createElement)(elementType, viewProps, childEls);
|
|
592
638
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
593
639
|
const isAnimatedRNWView = isAnimated && typeof elementType !== "string";
|
|
594
|
-
const shouldWrapWithComponentTheme = isAnimatedRNWView && (0, import_createPropMapper.getReturnVariablesAs)(props, splitStyleState) === "non-color-value";
|
|
640
|
+
const shouldWrapWithComponentTheme = !!theme.className && isAnimatedRNWView && (0, import_createPropMapper.getReturnVariablesAs)(props, splitStyleState) === "non-color-value";
|
|
595
641
|
const shouldWrapWithHover = Boolean(events || import_platform.isRSC) && attachHover;
|
|
596
642
|
if (shouldWrapWithHover || shouldWrapWithComponentTheme) {
|
|
597
643
|
const themeClassName = shouldWrapWithComponentTheme ? `${theme.className}` : "";
|
|
@@ -618,12 +664,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
618
664
|
console.log("children", content);
|
|
619
665
|
console.groupEnd();
|
|
620
666
|
if (typeof window !== "undefined") {
|
|
621
|
-
console.log({ state, shouldProvideThemeManager, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: (
|
|
667
|
+
console.log({ state, shouldProvideThemeManager, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: (_f = props.className) == null ? void 0 : _f.split(" "), classNamesOut: (_g = viewProps.className) == null ? void 0 : _g.split(" "), events, shouldAttach, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeClassName: theme.className, staticConfig, tamaguiConfig, events, shouldAvoidClasses, shouldForcePseudo, classNames: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, (0, import_insertStyleRule.getAllSelectors)()[v]])) } : null });
|
|
622
668
|
}
|
|
623
669
|
console.groupEnd();
|
|
624
670
|
}
|
|
625
671
|
}
|
|
626
|
-
return
|
|
672
|
+
return content;
|
|
627
673
|
});
|
|
628
674
|
if (staticConfig.componentName) {
|
|
629
675
|
component.displayName = staticConfig.componentName;
|
|
@@ -659,7 +705,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
659
705
|
resolveVariablesAs: "both",
|
|
660
706
|
keepVariantsAsProps: true
|
|
661
707
|
}, void 0, void 0, debug);
|
|
662
|
-
const [
|
|
708
|
+
const [defaults2, defaultsClassnames] = (0, import_mergeProps.mergeProps)(component.defaultProps, initialSplitStyles.viewProps, true);
|
|
663
709
|
initialSplitStyles.classNames = {
|
|
664
710
|
...parentClassNames,
|
|
665
711
|
...defaultsClassnames,
|
|
@@ -673,7 +719,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
673
719
|
if (import_helpers.validPseudoKeys[key])
|
|
674
720
|
continue;
|
|
675
721
|
if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
|
|
676
|
-
|
|
722
|
+
defaults2[key] = val;
|
|
677
723
|
} else {
|
|
678
724
|
defaultNativeStyle[key] = val;
|
|
679
725
|
}
|
|
@@ -682,8 +728,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
682
728
|
defaultNativeStyleSheet = import_react_native.StyleSheet.create({
|
|
683
729
|
base: defaultNativeStyle
|
|
684
730
|
});
|
|
685
|
-
if (Object.keys(
|
|
686
|
-
tamaguiDefaultProps =
|
|
731
|
+
if (Object.keys(defaults2).length) {
|
|
732
|
+
tamaguiDefaultProps = defaults2;
|
|
687
733
|
}
|
|
688
734
|
if (process.env.NODE_ENV === "development" && debug) {
|
|
689
735
|
if (process.env.IS_STATIC !== "is_static") {
|
|
@@ -692,7 +738,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
692
738
|
initialSplitStyles,
|
|
693
739
|
tamaguiDefaultProps,
|
|
694
740
|
defaultNativeStyle,
|
|
695
|
-
defaults,
|
|
741
|
+
defaults: defaults2,
|
|
696
742
|
defaultPropsIn
|
|
697
743
|
});
|
|
698
744
|
}
|
|
@@ -907,6 +953,69 @@ function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf)
|
|
|
907
953
|
}
|
|
908
954
|
return props;
|
|
909
955
|
}
|
|
956
|
+
const defaults = {
|
|
957
|
+
left: 0,
|
|
958
|
+
right: 0,
|
|
959
|
+
top: 0,
|
|
960
|
+
bottom: 0,
|
|
961
|
+
opacity: 1,
|
|
962
|
+
translateX: 0,
|
|
963
|
+
translateY: 0,
|
|
964
|
+
skew: 0,
|
|
965
|
+
skewX: 0,
|
|
966
|
+
skewY: 0,
|
|
967
|
+
scale: 1,
|
|
968
|
+
rotate: "0deg",
|
|
969
|
+
rotateY: "0deg",
|
|
970
|
+
rotateX: "0deg"
|
|
971
|
+
};
|
|
972
|
+
function ensureBaseHasDefaults(base, ...pseudos) {
|
|
973
|
+
for (const pseudo of pseudos) {
|
|
974
|
+
if (!pseudo)
|
|
975
|
+
continue;
|
|
976
|
+
for (const key in pseudo) {
|
|
977
|
+
const val = pseudo[key];
|
|
978
|
+
if (key === "transform") {
|
|
979
|
+
if (typeof val === "string") {
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
for (const t of val) {
|
|
983
|
+
const tkey = Object.keys(t)[0];
|
|
984
|
+
const defaultVal = defaults[tkey];
|
|
985
|
+
const tDefaultVal = { [tkey]: defaultVal };
|
|
986
|
+
if (!base.transform) {
|
|
987
|
+
base.transform = [tDefaultVal];
|
|
988
|
+
} else {
|
|
989
|
+
if (!base.transform.find((x) => x[tkey])) {
|
|
990
|
+
base.transform.push(tDefaultVal);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
} else {
|
|
995
|
+
if (!(key in base)) {
|
|
996
|
+
base[key] = defaults[key];
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
function merge(base, next) {
|
|
1003
|
+
if (!next.transform || !base.transform) {
|
|
1004
|
+
Object.assign(base, next);
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const { transform, ...rest } = next;
|
|
1008
|
+
Object.assign(base, rest);
|
|
1009
|
+
for (const t of transform) {
|
|
1010
|
+
const key = Object.keys(t)[0];
|
|
1011
|
+
const existing = base.transform.find((x) => key in x);
|
|
1012
|
+
if (existing) {
|
|
1013
|
+
existing[key] = t[key];
|
|
1014
|
+
} else {
|
|
1015
|
+
base.transform.push(t);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
910
1019
|
// Annotate the CommonJS export names for ESM import in node:
|
|
911
1020
|
0 && (module.exports = {
|
|
912
1021
|
Spacer,
|