@tamagui/core 1.74.21 → 1.75.0
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/createOptimizedView.js +26 -0
- package/dist/cjs/createOptimizedView.js.map +6 -0
- package/dist/cjs/createOptimizedView.native.js +228 -0
- package/dist/cjs/createOptimizedView.native.js.map +6 -0
- package/dist/cjs/getBaseViews.native.js +5 -2
- package/dist/cjs/getBaseViews.native.js.map +1 -1
- package/dist/cjs/index.js +2 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +10 -17
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/createOptimizedView.js +6 -0
- package/dist/esm/createOptimizedView.js.map +6 -0
- package/dist/esm/createOptimizedView.native.js +206 -0
- package/dist/esm/createOptimizedView.native.js.map +6 -0
- package/dist/esm/getBaseViews.native.js +5 -2
- package/dist/esm/getBaseViews.native.js.map +1 -1
- package/dist/esm/index.js +3 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.native.js +11 -16
- package/dist/esm/index.native.js.map +1 -1
- package/dist/native.js +317 -119
- package/dist/native.js.map +3 -3
- package/dist/test.native.js +297 -101
- package/dist/test.native.js.map +3 -3
- package/package.json +6 -6
- package/src/createOptimizedView.native.tsx +268 -0
- package/src/createOptimizedView.tsx +5 -0
- package/src/getBaseViews.native.ts +15 -1
- package/src/index.tsx +25 -16
- package/types/createOptimizedView.d.ts +2 -0
- package/types/createOptimizedView.d.ts.map +1 -0
- package/types/createOptimizedView.native.d.ts +17 -0
- package/types/createOptimizedView.native.d.ts.map +1 -0
- package/types/getBaseViews.native.d.ts +2 -0
- package/types/getBaseViews.native.d.ts.map +1 -1
- package/types/index.d.ts +4 -4
- package/types/index.d.ts.map +1 -1
package/dist/test.native.js
CHANGED
|
@@ -834,7 +834,7 @@ var require_constants_native = __commonJS({
|
|
|
834
834
|
useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect3
|
|
835
835
|
});
|
|
836
836
|
module2.exports = __toCommonJS2(constants_native_exports);
|
|
837
|
-
var
|
|
837
|
+
var import_react3 = require("react"), isWeb = !1, isWindowDefined = !1, isServer = !1, isClient = !1, useIsomorphicLayoutEffect3 = import_react3.useLayoutEffect, isChrome = !1, isWebTouchable = !1, isTouchable = !0, isAndroid = !1, isIos = !1, currentPlatform = "native";
|
|
838
838
|
}
|
|
839
839
|
});
|
|
840
840
|
|
|
@@ -1652,26 +1652,26 @@ var require_createStyledContext_native = __commonJS({
|
|
|
1652
1652
|
createStyledContext: () => createStyledContext
|
|
1653
1653
|
});
|
|
1654
1654
|
module2.exports = __toCommonJS2(createStyledContext_exports);
|
|
1655
|
-
var
|
|
1655
|
+
var import_react3 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
|
|
1656
1656
|
function createStyledContext(defaultValues) {
|
|
1657
|
-
let OGContext = (0,
|
|
1657
|
+
let OGContext = (0, import_react3.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
|
|
1658
1658
|
children,
|
|
1659
1659
|
scope,
|
|
1660
1660
|
...values
|
|
1661
1661
|
}) => {
|
|
1662
|
-
let value = (0,
|
|
1662
|
+
let value = (0, import_react3.useMemo)(() => ({
|
|
1663
1663
|
// this ! is a workaround for ts error
|
|
1664
1664
|
...defaultValues,
|
|
1665
1665
|
...values
|
|
1666
1666
|
}), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider;
|
|
1667
1667
|
if (scope) {
|
|
1668
1668
|
let ScopedContext = scopedContexts.get(scope);
|
|
1669
|
-
ScopedContext || (ScopedContext = (0,
|
|
1669
|
+
ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
1670
1670
|
}
|
|
1671
1671
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value, children });
|
|
1672
1672
|
}, useStyledContext = (scope) => {
|
|
1673
1673
|
let context = scope ? scopedContexts.get(scope) : OGContext;
|
|
1674
|
-
return (0,
|
|
1674
|
+
return (0, import_react3.useContext)(context);
|
|
1675
1675
|
};
|
|
1676
1676
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
1677
1677
|
}
|
|
@@ -1733,9 +1733,9 @@ var require_useDisableSSR_native = __commonJS({
|
|
|
1733
1733
|
useDisableSSR: () => useDisableSSR
|
|
1734
1734
|
});
|
|
1735
1735
|
module2.exports = __toCommonJS2(useDisableSSR_exports);
|
|
1736
|
-
var
|
|
1736
|
+
var import_react3 = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native();
|
|
1737
1737
|
function useDisableSSR() {
|
|
1738
|
-
let componentContext = (0,
|
|
1738
|
+
let componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext);
|
|
1739
1739
|
return getDisableSSR(componentContext);
|
|
1740
1740
|
}
|
|
1741
1741
|
function getDisableSSR(componentContext) {
|
|
@@ -1776,7 +1776,7 @@ var require_useMedia_native = __commonJS({
|
|
|
1776
1776
|
useMediaListeners: () => useMediaListeners
|
|
1777
1777
|
});
|
|
1778
1778
|
module2.exports = __toCommonJS2(useMedia_exports);
|
|
1779
|
-
var import_constants2 = require_index_native2(),
|
|
1779
|
+
var import_constants2 = require_index_native2(), import_react3 = require("react"), import_config = require_config_native(), import_createProxy = require_createProxy_native(), import_matchMedia = require_matchMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), import_useDisableSSR = require_useDisableSSR_native(), mediaState2 = {}, mediaQueryConfig2 = {}, getMedia2 = () => mediaState2, mediaKeys = /* @__PURE__ */ new Set(), isMediaKey = (key) => {
|
|
1780
1780
|
if (mediaKeys.has(key))
|
|
1781
1781
|
return !0;
|
|
1782
1782
|
if (key[0] === "$") {
|
|
@@ -1838,7 +1838,7 @@ var require_useMedia_native = __commonJS({
|
|
|
1838
1838
|
return listeners.add(subscriber), () => listeners.delete(subscriber);
|
|
1839
1839
|
}
|
|
1840
1840
|
function useMedia2(uid, componentContext) {
|
|
1841
|
-
let internal = (0,
|
|
1841
|
+
let internal = (0, import_react3.useRef)(), initialState = ((componentContext ? (0, import_useDisableSSR.getDisableSSR)(componentContext) : (0, import_useDisableSSR.useDisableSSR)()) ? mediaState2 : initState) || {}, state = (0, import_react3.useSyncExternalStore)(
|
|
1842
1842
|
subscribe,
|
|
1843
1843
|
() => {
|
|
1844
1844
|
if (!internal.current)
|
|
@@ -2020,7 +2020,7 @@ var require_index_native6 = __commonJS({
|
|
|
2020
2020
|
useDidFinishSSR: () => useDidFinishSSR
|
|
2021
2021
|
});
|
|
2022
2022
|
module2.exports = __toCommonJS2(src_exports2);
|
|
2023
|
-
var
|
|
2023
|
+
var import_react3 = require("react");
|
|
2024
2024
|
function useDidFinishSSR(value) {
|
|
2025
2025
|
return value ?? !0;
|
|
2026
2026
|
}
|
|
@@ -3368,7 +3368,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
3368
3368
|
useSplitStyles: () => useSplitStyles
|
|
3369
3369
|
});
|
|
3370
3370
|
module2.exports = __toCommonJS2(getSplitStyles_exports);
|
|
3371
|
-
var import_constants2 = require_index_native2(), import_helpers = require_index_native4(),
|
|
3371
|
+
var import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), fontFamilyKey = "fontFamily", IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-", getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
|
|
3372
3372
|
var _a, _b, _c, _e, _f, _g;
|
|
3373
3373
|
conf = conf || (0, import_config.getConfig)();
|
|
3374
3374
|
let { shorthands } = conf, {
|
|
@@ -3692,7 +3692,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
3692
3692
|
for (let key in cur)
|
|
3693
3693
|
key in styleState.usedKeys || mergeStyle(styleState, key, cur[key]);
|
|
3694
3694
|
}
|
|
3695
|
-
var useInsertEffectCompat = import_constants2.isWeb ?
|
|
3695
|
+
var useInsertEffectCompat = import_constants2.isWeb ? import_react3.useInsertionEffect || import_constants2.useIsomorphicLayoutEffect : () => {
|
|
3696
3696
|
}, useSplitStyles = (...args) => {
|
|
3697
3697
|
let res = getSplitStyles(...args);
|
|
3698
3698
|
return useInsertEffectCompat(() => {
|
|
@@ -3847,7 +3847,7 @@ var require_ThemeManagerContext_native = __commonJS({
|
|
|
3847
3847
|
ThemeManagerContext: () => ThemeManagerContext
|
|
3848
3848
|
});
|
|
3849
3849
|
module2.exports = __toCommonJS2(ThemeManagerContext_exports);
|
|
3850
|
-
var
|
|
3850
|
+
var import_react3 = require("react"), ThemeManagerContext = (0, import_react3.createContext)(null);
|
|
3851
3851
|
}
|
|
3852
3852
|
});
|
|
3853
3853
|
|
|
@@ -3889,7 +3889,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3889
3889
|
}
|
|
3890
3890
|
updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
|
|
3891
3891
|
if (this.props = props, props.forceTheme)
|
|
3892
|
-
return this.state.theme = props.forceTheme, this.state.name = props.name || "", !0;
|
|
3892
|
+
return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
|
|
3893
3893
|
let nextState = this.getStateIfChanged(props);
|
|
3894
3894
|
if (nextState)
|
|
3895
3895
|
return this.updateState(nextState, shouldNotify), nextState;
|
|
@@ -3940,7 +3940,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3940
3940
|
if (!baseManager && props.reset)
|
|
3941
3941
|
return console.warn("Cannot reset, no parent theme exists"), null;
|
|
3942
3942
|
let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
|
|
3943
|
-
baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][
|
|
3943
|
+
baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
|
|
3944
3944
|
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
3945
3945
|
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
3946
3946
|
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
|
|
@@ -4039,7 +4039,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4039
4039
|
useThemeWithState: () => useThemeWithState
|
|
4040
4040
|
});
|
|
4041
4041
|
module2.exports = __toCommonJS2(useTheme_exports);
|
|
4042
|
-
var import_constants2 = require_index_native2(),
|
|
4042
|
+
var import_constants2 = require_index_native2(), import_react3 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
|
|
4043
4043
|
function getDefaultThemeProxied() {
|
|
4044
4044
|
if (cached)
|
|
4045
4045
|
return cached;
|
|
@@ -4050,7 +4050,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4050
4050
|
let [_, theme] = useThemeWithState(props);
|
|
4051
4051
|
return theme || getDefaultThemeProxied();
|
|
4052
4052
|
}, useThemeWithState = (props) => {
|
|
4053
|
-
let keys = (0,
|
|
4053
|
+
let keys = (0, import_react3.useRef)([]), changedThemeState = useChangeThemeEffect(
|
|
4054
4054
|
props,
|
|
4055
4055
|
!1,
|
|
4056
4056
|
keys.current,
|
|
@@ -4060,7 +4060,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4060
4060
|
}
|
|
4061
4061
|
), { themeManager, state } = changedThemeState;
|
|
4062
4062
|
state != null && state.theme;
|
|
4063
|
-
let themeProxied = (0,
|
|
4063
|
+
let themeProxied = (0, import_react3.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
|
|
4064
4064
|
return [changedThemeState, themeProxied];
|
|
4065
4065
|
};
|
|
4066
4066
|
function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
|
|
@@ -4133,14 +4133,14 @@ var require_useTheme_native = __commonJS({
|
|
|
4133
4133
|
return !1;
|
|
4134
4134
|
}
|
|
4135
4135
|
var activeThemeManagers = /* @__PURE__ */ new Set(), useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
|
|
4136
|
-
let { disable } = props, parentManager = (0,
|
|
4136
|
+
let { disable } = props, parentManager = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerContext);
|
|
4137
4137
|
if (!isRoot && !parentManager || disable)
|
|
4138
4138
|
return {
|
|
4139
4139
|
isNewTheme: !1,
|
|
4140
4140
|
state: parentManager == null ? void 0 : parentManager.state,
|
|
4141
4141
|
themeManager: parentManager
|
|
4142
4142
|
};
|
|
4143
|
-
let [themeState, setThemeState] = (0,
|
|
4143
|
+
let [themeState, setThemeState] = (0, import_react3.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
|
|
4144
4144
|
function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
|
|
4145
4145
|
let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
|
|
4146
4146
|
if (!manager || !forceShouldChange && forceUpdate === !1)
|
|
@@ -4149,7 +4149,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4149
4149
|
if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
|
|
4150
4150
|
return next;
|
|
4151
4151
|
}
|
|
4152
|
-
if (import_constants2.isServer || (0,
|
|
4152
|
+
if (import_constants2.isServer || (0, import_react3.useLayoutEffect)(() => {
|
|
4153
4153
|
if (!themeManager)
|
|
4154
4154
|
return;
|
|
4155
4155
|
if (props.inverse && !mounted) {
|
|
@@ -4162,9 +4162,12 @@ var require_useTheme_native = __commonJS({
|
|
|
4162
4162
|
isNewTheme && themeManager && activeThemeManagers.add(themeManager), (isNewTheme || getShouldUpdateTheme(themeManager)) && setThemeState(createState);
|
|
4163
4163
|
let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
|
|
4164
4164
|
forced && setThemeState((prev) => createState(prev, !0));
|
|
4165
|
-
}), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
|
|
4166
|
-
(
|
|
4167
|
-
|
|
4165
|
+
}), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
|
|
4166
|
+
(name, manager, forced) => {
|
|
4167
|
+
((forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"]) ?? !!(keys != null && keys.length || isNewTheme)) && setThemeState(createState);
|
|
4168
|
+
},
|
|
4169
|
+
themeManager.id
|
|
4170
|
+
);
|
|
4168
4171
|
return () => {
|
|
4169
4172
|
selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), activeThemeManagers.delete(themeManager);
|
|
4170
4173
|
};
|
|
@@ -4195,14 +4198,14 @@ var require_useTheme_native = __commonJS({
|
|
|
4195
4198
|
themeManager
|
|
4196
4199
|
};
|
|
4197
4200
|
function createState(prev, force = !1) {
|
|
4198
|
-
if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1)
|
|
4201
|
+
if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
|
|
4199
4202
|
return prev;
|
|
4200
4203
|
let themeManager2 = parentManager, state2;
|
|
4201
4204
|
if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
|
|
4202
4205
|
let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
|
|
4203
4206
|
if (prev != null && prev.themeManager) {
|
|
4204
4207
|
themeManager2 = prev.themeManager;
|
|
4205
|
-
let forceChange = !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
|
|
4208
|
+
let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
|
|
4206
4209
|
themeManager2,
|
|
4207
4210
|
next,
|
|
4208
4211
|
prev.state,
|
|
@@ -4280,17 +4283,17 @@ var require_Theme_native = __commonJS({
|
|
|
4280
4283
|
useThemedChildren: () => useThemedChildren
|
|
4281
4284
|
});
|
|
4282
4285
|
module2.exports = __toCommonJS2(Theme_exports);
|
|
4283
|
-
var import_constants2 = require_index_native2(),
|
|
4286
|
+
var import_constants2 = require_index_native2(), import_react3 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), Theme = (0, import_react3.forwardRef)(function(props, ref) {
|
|
4284
4287
|
if (props.disable)
|
|
4285
4288
|
return props.children;
|
|
4286
|
-
let isRoot = !!props._isRoot, disableDirectChildTheme = props["disable-child-theme"], themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), children = (0,
|
|
4287
|
-
let children2 = disableDirectChildTheme ?
|
|
4289
|
+
let isRoot = !!props._isRoot, disableDirectChildTheme = props["disable-child-theme"], themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), children = (0, import_react3.useMemo)(() => {
|
|
4290
|
+
let children2 = disableDirectChildTheme ? import_react3.Children.map(
|
|
4288
4291
|
props.children,
|
|
4289
|
-
(child) => (0,
|
|
4292
|
+
(child) => (0, import_react3.cloneElement)(child, { "data-disable-theme": !0 })
|
|
4290
4293
|
) : props.children;
|
|
4291
4294
|
if (ref)
|
|
4292
4295
|
try {
|
|
4293
|
-
|
|
4296
|
+
import_react3.default.Children.only(children2), children2 = (0, import_react3.cloneElement)(children2, { ref });
|
|
4294
4297
|
} catch {
|
|
4295
4298
|
}
|
|
4296
4299
|
return children2;
|
|
@@ -4299,11 +4302,11 @@ var require_Theme_native = __commonJS({
|
|
|
4299
4302
|
});
|
|
4300
4303
|
Theme.avoidForwardRef = !0;
|
|
4301
4304
|
function useThemedChildren(themeState, children, props, isRoot = !1, avoidWrap = !1) {
|
|
4302
|
-
let { themeManager, isNewTheme } = themeState, { shallow, forceClassName } = props, hasEverThemed = (0,
|
|
4305
|
+
let { themeManager, isNewTheme } = themeState, { shallow, forceClassName } = props, hasEverThemed = (0, import_react3.useRef)(!1);
|
|
4303
4306
|
if (isNewTheme && (hasEverThemed.current = !0), !(isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot))
|
|
4304
4307
|
return children;
|
|
4305
4308
|
let next = children;
|
|
4306
|
-
shallow && themeManager && (next =
|
|
4309
|
+
shallow && themeManager && (next = import_react3.Children.toArray(children).map((child) => (0, import_react3.isValidElement)(child) ? (0, import_react3.cloneElement)(
|
|
4307
4310
|
child,
|
|
4308
4311
|
void 0,
|
|
4309
4312
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children })
|
|
@@ -4362,9 +4365,9 @@ var require_themeable_native = __commonJS({
|
|
|
4362
4365
|
themeable: () => themeable
|
|
4363
4366
|
});
|
|
4364
4367
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
4365
|
-
var
|
|
4368
|
+
var import_react3 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime = require("react/jsx-runtime");
|
|
4366
4369
|
function themeable(Component, staticConfig) {
|
|
4367
|
-
let withTheme = (0,
|
|
4370
|
+
let withTheme = (0, import_react3.forwardRef)(function(props, ref) {
|
|
4368
4371
|
let { themeInverse, theme, componentName, themeReset, ...rest } = props, element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref, ...rest, "data-disable-theme": !0 });
|
|
4369
4372
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4370
4373
|
import_Theme.Theme,
|
|
@@ -4427,11 +4430,11 @@ var require_Slot_native = __commonJS({
|
|
|
4427
4430
|
Slottable: () => Slottable
|
|
4428
4431
|
});
|
|
4429
4432
|
module2.exports = __toCommonJS2(Slot_exports);
|
|
4430
|
-
var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(),
|
|
4433
|
+
var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_react3 = require("react"), import_jsx_runtime = require("react/jsx-runtime"), Slot = (0, import_react3.forwardRef)(function(props, forwardedRef) {
|
|
4431
4434
|
let { children, ...slotProps } = props;
|
|
4432
|
-
if ((0,
|
|
4435
|
+
if ((0, import_react3.isValidElement)(children)) {
|
|
4433
4436
|
let mergedProps = mergeSlotProps(children, slotProps);
|
|
4434
|
-
return (0,
|
|
4437
|
+
return (0, import_react3.cloneElement)(
|
|
4435
4438
|
children,
|
|
4436
4439
|
children.type.avoidForwardRef ? mergedProps : {
|
|
4437
4440
|
...mergedProps,
|
|
@@ -4439,7 +4442,7 @@ var require_Slot_native = __commonJS({
|
|
|
4439
4442
|
}
|
|
4440
4443
|
);
|
|
4441
4444
|
}
|
|
4442
|
-
return
|
|
4445
|
+
return import_react3.Children.count(children) > 1 ? import_react3.Children.only(null) : null;
|
|
4443
4446
|
}), Slottable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }), pressMap = import_constants2.isWeb ? {
|
|
4444
4447
|
onPress: "onClick",
|
|
4445
4448
|
onPressOut: "onMouseUp",
|
|
@@ -4488,7 +4491,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4488
4491
|
spacedChildren: () => spacedChildren
|
|
4489
4492
|
});
|
|
4490
4493
|
module2.exports = __toCommonJS2(createComponent_exports);
|
|
4491
|
-
var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_use_did_finish_ssr = require_index_native6(),
|
|
4494
|
+
var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_use_did_finish_ssr = require_index_native6(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_ComponentContext = require_ComponentContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_createShallowSetState = require_createShallowSetState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_mergeProps = require_mergeProps_native(), import_proxyThemeVariables = require_proxyThemeVariables_native(), import_themeable = require_themeable_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), tamaguiConfig, AnimatedText, AnimatedView, initialTheme, mouseUps = /* @__PURE__ */ new Set();
|
|
4492
4495
|
if (typeof document < "u") {
|
|
4493
4496
|
let cancelTouches = () => {
|
|
4494
4497
|
mouseUps.forEach((x) => x()), mouseUps.clear();
|
|
@@ -4512,17 +4515,17 @@ var require_createComponent_native = __commonJS({
|
|
|
4512
4515
|
isHOC,
|
|
4513
4516
|
validStyles: validStyles2 = {},
|
|
4514
4517
|
variants = {}
|
|
4515
|
-
} = staticConfig, defaultComponentClassName = `is_${staticConfig.componentName}`, defaultProps = staticConfig.defaultProps, component = (0,
|
|
4516
|
-
var _a2, _b, _c, _d, _e, _f, _i, _j, _k, _l, _m
|
|
4518
|
+
} = staticConfig, defaultComponentClassName = `is_${staticConfig.componentName}`, defaultProps = staticConfig.defaultProps, component = (0, import_react3.forwardRef)((propsIn, forwardedRef) => {
|
|
4519
|
+
var _a2, _b, _c, _d, _e, _f, _i, _j, _k, _l, _m;
|
|
4517
4520
|
if (!hasSetupBaseViews) {
|
|
4518
4521
|
hasSetupBaseViews = !0;
|
|
4519
|
-
let
|
|
4520
|
-
|
|
4522
|
+
let baseViews2 = (_b = (_a2 = import_setupHooks.hooks).getBaseViews) == null ? void 0 : _b.call(_a2);
|
|
4523
|
+
baseViews2 && (BaseText = baseViews2.Text, BaseView = baseViews2.View);
|
|
4521
4524
|
}
|
|
4522
4525
|
propsIn["data-test-renders"] && (propsIn["data-test-renders"].current ??= 0, propsIn["data-test-renders"].current += 1);
|
|
4523
|
-
let componentContext = (0,
|
|
4526
|
+
let componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, { context } = staticConfig;
|
|
4524
4527
|
if (context) {
|
|
4525
|
-
contextValue = (0,
|
|
4528
|
+
contextValue = (0, import_react3.useContext)(context);
|
|
4526
4529
|
let { inverseShorthands } = (0, import_config.getConfig)();
|
|
4527
4530
|
for (let key in context.props) {
|
|
4528
4531
|
let propVal = (
|
|
@@ -4534,16 +4537,16 @@ var require_createComponent_native = __commonJS({
|
|
|
4534
4537
|
}
|
|
4535
4538
|
let curDefaultProps = styledContextProps ? { ...defaultProps, ...styledContextProps } : defaultProps, props = propsIn;
|
|
4536
4539
|
curDefaultProps && (props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn));
|
|
4537
|
-
let debugProp = props.debug, componentName = props.componentName || staticConfig.componentName, isHydrated = config != null && config.disableSSR ? !0 : (0, import_use_did_finish_ssr.useDidFinishSSR)(), stateRef = (0,
|
|
4540
|
+
let debugProp = props.debug, componentName = props.componentName || staticConfig.componentName, isHydrated = config != null && config.disableSSR ? !0 : (0, import_use_did_finish_ssr.useDidFinishSSR)(), stateRef = (0, import_react3.useRef)(
|
|
4538
4541
|
void 0
|
|
4539
4542
|
);
|
|
4540
4543
|
stateRef.current ||= {};
|
|
4541
|
-
let hostRef = (0,
|
|
4544
|
+
let hostRef = (0, import_react3.useRef)(null), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations, hasAnimationProp = !!(props.animation || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig == null ? void 0 : animationsConfig.supportsCSSVars, willBeAnimated = (() => {
|
|
4542
4545
|
if (import_constants2.isServer && !supportsCSSVars)
|
|
4543
4546
|
return !1;
|
|
4544
4547
|
let curState = stateRef.current;
|
|
4545
4548
|
return !!(hasAnimationProp && !isHOC && useAnimations || curState.hasAnimated);
|
|
4546
|
-
})(), usePresence = animationsConfig == null ? void 0 : animationsConfig.usePresence, presence = willBeAnimated && (usePresence == null ? void 0 : usePresence()) || null, hasEnterStyle = !!props.enterStyle, needsMount = !!((!import_constants2.isWeb || import_constants2.isClient) && willBeAnimated), initialState = willBeAnimated ? supportsCSSVars ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted, states = (0,
|
|
4549
|
+
})(), usePresence = animationsConfig == null ? void 0 : animationsConfig.usePresence, presence = willBeAnimated && (usePresence == null ? void 0 : usePresence()) || null, hasEnterStyle = !!props.enterStyle, needsMount = !!((!import_constants2.isWeb || import_constants2.isClient) && willBeAnimated), initialState = willBeAnimated ? supportsCSSVars ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted, states = (0, import_react3.useState)(initialState), state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: !0 } : states[0], setState = states[1], setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState), groupName = props.group, groupClassName = groupName ? `t_group_${props.group}` : "";
|
|
4547
4550
|
if (groupName) {
|
|
4548
4551
|
let groupContextState = componentContext.groups.state, og = setStateShallow;
|
|
4549
4552
|
setStateShallow = (state2) => {
|
|
@@ -4576,14 +4579,9 @@ var require_createComponent_native = __commonJS({
|
|
|
4576
4579
|
componentName,
|
|
4577
4580
|
disable: disableTheme,
|
|
4578
4581
|
shallow: stateRef.current.themeShallow,
|
|
4579
|
-
// if this returns undefined it defers to the keys tracking, so its only used to force either updates or no updates
|
|
4580
|
-
shouldUpdate: () => (
|
|
4581
|
-
// when we use $theme- styles we need to force it to re-render on theme changes (this can be optimized likely)
|
|
4582
|
-
stateRef.current.isListeningToTheme
|
|
4583
|
-
),
|
|
4584
4582
|
debug: debugProp
|
|
4585
4583
|
};
|
|
4586
|
-
themeStateProps.deopt = willBeAnimated;
|
|
4584
|
+
typeof stateRef.current.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = () => stateRef.current.isListeningToTheme), themeStateProps.deopt = willBeAnimated;
|
|
4587
4585
|
let isExiting = !state.unmounted && (presence == null ? void 0 : presence[0]) === !1, [themeState, theme] = (0, import_useTheme.useThemeWithState)(themeStateProps);
|
|
4588
4586
|
elementType = Component || elementType;
|
|
4589
4587
|
let isStringElement = typeof elementType == "string", mediaState2 = (0, import_useMedia.useMedia)(stateRef, componentContext);
|
|
@@ -4682,7 +4680,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4682
4680
|
press: !1,
|
|
4683
4681
|
pressIn: !1
|
|
4684
4682
|
}), shouldSetMounted = needsMount && state.unmounted, { pseudoGroups, mediaGroups } = splitStyles;
|
|
4685
|
-
(0,
|
|
4683
|
+
(0, import_react3.useEffect)(() => {
|
|
4686
4684
|
if (shouldSetMounted) {
|
|
4687
4685
|
let unmounted = state.unmounted === !0 && hasEnterStyle ? "should-enter" : !1;
|
|
4688
4686
|
setStateShallow({
|
|
@@ -4788,8 +4786,16 @@ var require_createComponent_native = __commonJS({
|
|
|
4788
4786
|
isZStack,
|
|
4789
4787
|
debug: debugProp
|
|
4790
4788
|
});
|
|
4791
|
-
asChild && (elementType = import_Slot.Slot, Object.assign(viewProps, { onPress, onLongPress }))
|
|
4792
|
-
let
|
|
4789
|
+
asChild && (elementType = import_Slot.Slot, Object.assign(viewProps, { onPress, onLongPress }));
|
|
4790
|
+
let useChildrenResult;
|
|
4791
|
+
import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(
|
|
4792
|
+
elementType,
|
|
4793
|
+
content,
|
|
4794
|
+
viewProps,
|
|
4795
|
+
events,
|
|
4796
|
+
staticConfig
|
|
4797
|
+
)), useChildrenResult ? content = useChildrenResult : content = (0, import_react3.createElement)(elementType, viewProps, content);
|
|
4798
|
+
let subGroupContext = (0, import_react3.useMemo)(() => {
|
|
4793
4799
|
if (groupName)
|
|
4794
4800
|
return {
|
|
4795
4801
|
...componentContext.groups,
|
|
@@ -4825,7 +4831,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4825
4831
|
});
|
|
4826
4832
|
staticConfig.componentName && (component.displayName = staticConfig.componentName);
|
|
4827
4833
|
let res = component;
|
|
4828
|
-
(process.env.TAMAGUI_FORCE_MEMO || staticConfig.memo) && (res = (0,
|
|
4834
|
+
(process.env.TAMAGUI_FORCE_MEMO || staticConfig.memo) && (res = (0, import_react3.memo)(res)), res.staticConfig = staticConfig;
|
|
4829
4835
|
function extendStyledConfig(extended) {
|
|
4830
4836
|
return {
|
|
4831
4837
|
...staticConfig,
|
|
@@ -4842,7 +4848,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4842
4848
|
var _a2;
|
|
4843
4849
|
let ComponentForwardedRef = ((_a2 = Component2.render) == null ? void 0 : _a2.length) === 2 ? Component2 : (
|
|
4844
4850
|
// memo because theme changes otherwise would always re-render
|
|
4845
|
-
(0,
|
|
4851
|
+
(0, import_react3.memo)((0, import_react3.forwardRef)(Component2))
|
|
4846
4852
|
), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig), out = options != null && options.disableTheme ? ComponentForwardedRef : (0, import_themeable.themeable)(ComponentForwardedRef, extendedConfig);
|
|
4847
4853
|
return out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
4848
4854
|
}
|
|
@@ -4900,19 +4906,19 @@ var require_createComponent_native = __commonJS({
|
|
|
4900
4906
|
let { isZStack, children, space, direction, spaceFlex, separator } = props, hasSpace = !!(space || spaceFlex), hasSeparator = separator != null;
|
|
4901
4907
|
if (!(hasSpace || hasSeparator || isZStack))
|
|
4902
4908
|
return children;
|
|
4903
|
-
let childrenList =
|
|
4909
|
+
let childrenList = import_react3.Children.toArray(children);
|
|
4904
4910
|
if (childrenList.length <= 1 && !isZStack && !((_b = (_a = childrenList[0]) == null ? void 0 : _a.type) != null && _b.shouldForwardSpace))
|
|
4905
4911
|
return childrenList;
|
|
4906
4912
|
let final = [];
|
|
4907
4913
|
for (let [index, child] of childrenList.entries()) {
|
|
4908
4914
|
let isEmpty = child == null || Array.isArray(child) && child.length === 0;
|
|
4909
|
-
if (!isEmpty &&
|
|
4915
|
+
if (!isEmpty && import_react3.default.isValidElement(child) && (_c = child.type) != null && _c.shouldForwardSpace && (child = import_react3.default.cloneElement(child, {
|
|
4910
4916
|
space,
|
|
4911
4917
|
spaceFlex,
|
|
4912
4918
|
separator,
|
|
4913
4919
|
key: child.key
|
|
4914
4920
|
})), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(
|
|
4915
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4921
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react3.Fragment, { children: isZStack ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AbsoluteFill, { children: child }) : child }, index)
|
|
4916
4922
|
), isUnspaced(child) && index === 0 || isZStack)
|
|
4917
4923
|
continue;
|
|
4918
4924
|
let next = childrenList[index + 1];
|
|
@@ -4924,7 +4930,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4924
4930
|
spaceFlex
|
|
4925
4931
|
})
|
|
4926
4932
|
), final.push(
|
|
4927
|
-
|
|
4933
|
+
import_react3.default.isValidElement(separator) ? import_react3.default.cloneElement(separator, { key: `sep_${index}` }) : separator
|
|
4928
4934
|
), hasSpace && final.push(
|
|
4929
4935
|
createSpacer({
|
|
4930
4936
|
key: `_${index}01tmgui`,
|
|
@@ -5786,7 +5792,7 @@ var require_isTamaguiElement_native = __commonJS({
|
|
|
5786
5792
|
isTamaguiElement: () => isTamaguiElement
|
|
5787
5793
|
});
|
|
5788
5794
|
module2.exports = __toCommonJS2(isTamaguiElement_exports);
|
|
5789
|
-
var
|
|
5795
|
+
var import_react3 = require("react"), import_isTamaguiComponent = require_isTamaguiComponent_native(), isTamaguiElement = (child, name) => (0, import_react3.isValidElement)(child) && (0, import_isTamaguiComponent.isTamaguiComponent)(child.type, name);
|
|
5790
5796
|
}
|
|
5791
5797
|
});
|
|
5792
5798
|
|
|
@@ -5807,11 +5813,11 @@ var require_withStaticProperties_native = __commonJS({
|
|
|
5807
5813
|
withStaticProperties: () => withStaticProperties
|
|
5808
5814
|
});
|
|
5809
5815
|
module2.exports = __toCommonJS2(withStaticProperties_exports);
|
|
5810
|
-
var
|
|
5816
|
+
var import_react3 = require("react"), Decorated = Symbol(), withStaticProperties = function(component, staticProps) {
|
|
5811
5817
|
let next = (() => {
|
|
5812
5818
|
if (component[Decorated]) {
|
|
5813
|
-
let _ = (0,
|
|
5814
|
-
(props, ref) => (0,
|
|
5819
|
+
let _ = (0, import_react3.forwardRef)(
|
|
5820
|
+
(props, ref) => (0, import_react3.createElement)(component, { ...props, ref })
|
|
5815
5821
|
);
|
|
5816
5822
|
for (let key in component) {
|
|
5817
5823
|
let v = component[key];
|
|
@@ -5842,9 +5848,9 @@ var require_useThemeName_native = __commonJS({
|
|
|
5842
5848
|
useThemeName: () => useThemeName
|
|
5843
5849
|
});
|
|
5844
5850
|
module2.exports = __toCommonJS2(useThemeName_exports);
|
|
5845
|
-
var import_constants2 = require_index_native2(),
|
|
5851
|
+
var import_constants2 = require_index_native2(), import_react3 = require("react"), import_ThemeManagerContext = require_ThemeManagerContext_native();
|
|
5846
5852
|
function useThemeName(opts) {
|
|
5847
|
-
let manager = (0,
|
|
5853
|
+
let manager = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerContext), [name, setName] = (0, import_react3.useState)((manager == null ? void 0 : manager.state.name) || "");
|
|
5848
5854
|
return (0, import_constants2.useIsomorphicLayoutEffect)(() => {
|
|
5849
5855
|
if (manager)
|
|
5850
5856
|
return setName(manager.state.name), manager.onChangeTheme((next, manager2) => {
|
|
@@ -5873,8 +5879,8 @@ var require_useConfiguration_native = __commonJS({
|
|
|
5873
5879
|
useConfiguration: () => useConfiguration
|
|
5874
5880
|
});
|
|
5875
5881
|
module2.exports = __toCommonJS2(useConfiguration_exports);
|
|
5876
|
-
var
|
|
5877
|
-
let { groups, animationDriver, ...restComponentConfig } = (0,
|
|
5882
|
+
var import_react3 = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native(), useConfiguration = () => {
|
|
5883
|
+
let { groups, animationDriver, ...restComponentConfig } = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), { animations, ...restConfig } = (0, import_config.getConfig)();
|
|
5878
5884
|
return {
|
|
5879
5885
|
...restConfig,
|
|
5880
5886
|
...restComponentConfig,
|
|
@@ -5949,7 +5955,7 @@ var require_useProps_native = __commonJS({
|
|
|
5949
5955
|
useStyle: () => useStyle
|
|
5950
5956
|
});
|
|
5951
5957
|
module2.exports = __toCommonJS2(useProps_exports);
|
|
5952
|
-
var
|
|
5958
|
+
var import_react3 = require("react"), import_ComponentContext = require_ComponentContext_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_Stack = require_Stack_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native();
|
|
5953
5959
|
function useProps(props, opts) {
|
|
5954
5960
|
let [propsOut, styleOut] = usePropsAndStyle(props, {
|
|
5955
5961
|
...opts,
|
|
@@ -5969,7 +5975,7 @@ var require_useProps_native = __commonJS({
|
|
|
5969
5975
|
var _a, _b;
|
|
5970
5976
|
let staticConfig = ((_a = opts == null ? void 0 : opts.forComponent) == null ? void 0 : _a.staticConfig) ?? import_Stack.Stack.staticConfig, [themeState, theme] = (0, import_useTheme.useThemeWithState)({
|
|
5971
5977
|
componentName: staticConfig.componentName
|
|
5972
|
-
}), componentContext = (0,
|
|
5978
|
+
}), componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
5973
5979
|
props,
|
|
5974
5980
|
staticConfig,
|
|
5975
5981
|
theme,
|
|
@@ -6080,7 +6086,7 @@ var require_ThemeProvider_native = __commonJS({
|
|
|
6080
6086
|
ThemeProvider: () => ThemeProvider
|
|
6081
6087
|
});
|
|
6082
6088
|
module2.exports = __toCommonJS2(ThemeProvider_exports);
|
|
6083
|
-
var import_constants2 = require_index_native2(),
|
|
6089
|
+
var import_constants2 = require_index_native2(), import_react3 = require("react"), import_constants22 = require_constants_native2(), import_Theme = require_Theme_native(), import_jsx_runtime = require("react/jsx-runtime"), ThemeProvider = (props) => (import_constants2.isClient && (0, import_react3.useLayoutEffect)(() => {
|
|
6084
6090
|
if (props.disableRootThemeClass)
|
|
6085
6091
|
return;
|
|
6086
6092
|
let cn = `${import_constants22.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`, target = props.themeClassNameOnRoot ? document.documentElement : document.body;
|
|
@@ -6117,8 +6123,8 @@ var require_FontLanguage_native = __commonJS({
|
|
|
6117
6123
|
FontLanguage: () => FontLanguage
|
|
6118
6124
|
});
|
|
6119
6125
|
module2.exports = __toCommonJS2(FontLanguage_native_exports);
|
|
6120
|
-
var
|
|
6121
|
-
let language = (0,
|
|
6126
|
+
var import_react3 = require("react"), import_ComponentContext = require_ComponentContext_native(), import_jsx_runtime = require("react/jsx-runtime"), FontLanguage = ({ children, ...props }) => {
|
|
6127
|
+
let language = (0, import_react3.useMemo)(() => props, [JSON.stringify(props)]);
|
|
6122
6128
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { language, children });
|
|
6123
6129
|
};
|
|
6124
6130
|
}
|
|
@@ -6214,12 +6220,12 @@ var require_useGet_native = __commonJS({
|
|
|
6214
6220
|
useGet: () => useGet
|
|
6215
6221
|
});
|
|
6216
6222
|
module2.exports = __toCommonJS2(useGet_exports);
|
|
6217
|
-
var
|
|
6223
|
+
var import_react3 = require("react"), isWeb = !1, isClient = typeof window < "u", useIsomorphicLayoutEffect3 = !isWeb || isClient ? import_react3.useLayoutEffect : import_react3.useEffect;
|
|
6218
6224
|
function useGet(currentValue, initialValue, forwardToFunction) {
|
|
6219
|
-
let curRef = (0,
|
|
6225
|
+
let curRef = (0, import_react3.useRef)(initialValue ?? currentValue);
|
|
6220
6226
|
return useIsomorphicLayoutEffect3(() => {
|
|
6221
6227
|
curRef.current = currentValue;
|
|
6222
|
-
}), (0,
|
|
6228
|
+
}), (0, import_react3.useCallback)(
|
|
6223
6229
|
forwardToFunction ? (...args) => {
|
|
6224
6230
|
var _a;
|
|
6225
6231
|
return (_a = curRef.current) == null ? void 0 : _a.apply(null, args);
|
|
@@ -6421,14 +6427,217 @@ __export(src_exports, {
|
|
|
6421
6427
|
Text: () => Text
|
|
6422
6428
|
});
|
|
6423
6429
|
module.exports = __toCommonJS(src_exports);
|
|
6424
|
-
var import_react_native_use_responder_events = __toESM(require_index_native()), import_web2 = __toESM(require_index_native9());
|
|
6430
|
+
var import_react_native_use_responder_events = __toESM(require_index_native()), import_web2 = __toESM(require_index_native9()), import_react2 = require("react");
|
|
6431
|
+
|
|
6432
|
+
// src/createOptimizedView.native.tsx
|
|
6433
|
+
var import_react = require("react");
|
|
6434
|
+
function createOptimizedView(children, viewProps, baseViews2) {
|
|
6435
|
+
let TextAncestor = baseViews2.TextAncestor, ViewNativeComponent = baseViews2.View, {
|
|
6436
|
+
accessibilityElementsHidden,
|
|
6437
|
+
accessibilityLabel,
|
|
6438
|
+
accessibilityLabelledBy,
|
|
6439
|
+
accessibilityLiveRegion,
|
|
6440
|
+
accessibilityRole,
|
|
6441
|
+
accessibilityState,
|
|
6442
|
+
accessibilityValue,
|
|
6443
|
+
"aria-busy": ariaBusy,
|
|
6444
|
+
"aria-checked": ariaChecked,
|
|
6445
|
+
"aria-disabled": ariaDisabled,
|
|
6446
|
+
"aria-expanded": ariaExpanded,
|
|
6447
|
+
"aria-hidden": ariaHidden,
|
|
6448
|
+
"aria-label": ariaLabel,
|
|
6449
|
+
"aria-labelledby": ariaLabelledBy,
|
|
6450
|
+
"aria-live": ariaLive,
|
|
6451
|
+
"aria-selected": ariaSelected,
|
|
6452
|
+
"aria-valuemax": ariaValueMax,
|
|
6453
|
+
"aria-valuemin": ariaValueMin,
|
|
6454
|
+
"aria-valuenow": ariaValueNow,
|
|
6455
|
+
"aria-valuetext": ariaValueText,
|
|
6456
|
+
focusable,
|
|
6457
|
+
id,
|
|
6458
|
+
importantForAccessibility,
|
|
6459
|
+
nativeID,
|
|
6460
|
+
pointerEvents,
|
|
6461
|
+
role,
|
|
6462
|
+
tabIndex
|
|
6463
|
+
// ...otherProps
|
|
6464
|
+
} = viewProps, _accessibilityLabelledBy = (ariaLabelledBy == null ? void 0 : ariaLabelledBy.split(/\s*,\s*/g)) ?? accessibilityLabelledBy, _accessibilityState;
|
|
6465
|
+
(accessibilityState != null || ariaBusy != null || ariaChecked != null || ariaDisabled != null || ariaExpanded != null || ariaSelected != null) && (_accessibilityState = {
|
|
6466
|
+
busy: ariaBusy ?? (accessibilityState == null ? void 0 : accessibilityState.busy),
|
|
6467
|
+
checked: ariaChecked ?? (accessibilityState == null ? void 0 : accessibilityState.checked),
|
|
6468
|
+
disabled: ariaDisabled ?? (accessibilityState == null ? void 0 : accessibilityState.disabled),
|
|
6469
|
+
expanded: ariaExpanded ?? (accessibilityState == null ? void 0 : accessibilityState.expanded),
|
|
6470
|
+
selected: ariaSelected ?? (accessibilityState == null ? void 0 : accessibilityState.selected)
|
|
6471
|
+
});
|
|
6472
|
+
let _accessibilityValue;
|
|
6473
|
+
(accessibilityValue != null || ariaValueMax != null || ariaValueMin != null || ariaValueNow != null || ariaValueText != null) && (_accessibilityValue = {
|
|
6474
|
+
max: ariaValueMax ?? (accessibilityValue == null ? void 0 : accessibilityValue.max),
|
|
6475
|
+
min: ariaValueMin ?? (accessibilityValue == null ? void 0 : accessibilityValue.min),
|
|
6476
|
+
now: ariaValueNow ?? (accessibilityValue == null ? void 0 : accessibilityValue.now),
|
|
6477
|
+
text: ariaValueText ?? (accessibilityValue == null ? void 0 : accessibilityValue.text)
|
|
6478
|
+
});
|
|
6479
|
+
let style = Array.isArray(viewProps.style) ? baseViews2.StyleSheet.flatten(viewProps.style) : viewProps.style, newPointerEvents = (style == null ? void 0 : style.pointerEvents) || pointerEvents, finalProps = viewProps, extras = {
|
|
6480
|
+
accessibilityLiveRegion: ariaLive === "off" ? "none" : ariaLive ?? accessibilityLiveRegion,
|
|
6481
|
+
accessibilityLabel: ariaLabel ?? accessibilityLabel,
|
|
6482
|
+
focusable: tabIndex !== void 0 ? !tabIndex : focusable,
|
|
6483
|
+
accessibilityState: _accessibilityState,
|
|
6484
|
+
accessibilityRole: role ? getAccessibilityRoleFromRole(role) : accessibilityRole,
|
|
6485
|
+
accessibilityElementsHidden: ariaHidden ?? accessibilityElementsHidden,
|
|
6486
|
+
accessibilityLabelledBy: _accessibilityLabelledBy,
|
|
6487
|
+
accessibilityValue: _accessibilityValue,
|
|
6488
|
+
importantForAccessibility: ariaHidden === !0 ? "no-hide-descendants" : importantForAccessibility,
|
|
6489
|
+
nativeID: id ?? nativeID,
|
|
6490
|
+
style,
|
|
6491
|
+
pointerEvents: newPointerEvents
|
|
6492
|
+
};
|
|
6493
|
+
for (let key in extras)
|
|
6494
|
+
extras[key] != null && (finalProps[key] = extras[key]);
|
|
6495
|
+
let isInText = (0, import_react.useContext)(TextAncestor), finalElement = (0, import_react.createElement)(ViewNativeComponent, finalProps, children);
|
|
6496
|
+
return isInText ? (0, import_react.createElement)(TextAncestor.Provider, { value: !1 }, finalElement) : finalElement;
|
|
6497
|
+
}
|
|
6498
|
+
function getAccessibilityRoleFromRole(role) {
|
|
6499
|
+
switch (role) {
|
|
6500
|
+
case "alert":
|
|
6501
|
+
return "alert";
|
|
6502
|
+
case "alertdialog":
|
|
6503
|
+
return;
|
|
6504
|
+
case "application":
|
|
6505
|
+
return;
|
|
6506
|
+
case "article":
|
|
6507
|
+
return;
|
|
6508
|
+
case "banner":
|
|
6509
|
+
return;
|
|
6510
|
+
case "button":
|
|
6511
|
+
return "button";
|
|
6512
|
+
case "cell":
|
|
6513
|
+
return;
|
|
6514
|
+
case "checkbox":
|
|
6515
|
+
return "checkbox";
|
|
6516
|
+
case "columnheader":
|
|
6517
|
+
return;
|
|
6518
|
+
case "combobox":
|
|
6519
|
+
return "combobox";
|
|
6520
|
+
case "complementary":
|
|
6521
|
+
return;
|
|
6522
|
+
case "contentinfo":
|
|
6523
|
+
return;
|
|
6524
|
+
case "definition":
|
|
6525
|
+
return;
|
|
6526
|
+
case "dialog":
|
|
6527
|
+
return;
|
|
6528
|
+
case "directory":
|
|
6529
|
+
return;
|
|
6530
|
+
case "document":
|
|
6531
|
+
return;
|
|
6532
|
+
case "feed":
|
|
6533
|
+
return;
|
|
6534
|
+
case "figure":
|
|
6535
|
+
return;
|
|
6536
|
+
case "form":
|
|
6537
|
+
return;
|
|
6538
|
+
case "grid":
|
|
6539
|
+
return "grid";
|
|
6540
|
+
case "group":
|
|
6541
|
+
return;
|
|
6542
|
+
case "heading":
|
|
6543
|
+
return "header";
|
|
6544
|
+
case "img":
|
|
6545
|
+
return "image";
|
|
6546
|
+
case "link":
|
|
6547
|
+
return "link";
|
|
6548
|
+
case "list":
|
|
6549
|
+
return "list";
|
|
6550
|
+
case "listitem":
|
|
6551
|
+
return;
|
|
6552
|
+
case "log":
|
|
6553
|
+
return;
|
|
6554
|
+
case "main":
|
|
6555
|
+
return;
|
|
6556
|
+
case "marquee":
|
|
6557
|
+
return;
|
|
6558
|
+
case "math":
|
|
6559
|
+
return;
|
|
6560
|
+
case "menu":
|
|
6561
|
+
return "menu";
|
|
6562
|
+
case "menubar":
|
|
6563
|
+
return "menubar";
|
|
6564
|
+
case "menuitem":
|
|
6565
|
+
return "menuitem";
|
|
6566
|
+
case "meter":
|
|
6567
|
+
return;
|
|
6568
|
+
case "navigation":
|
|
6569
|
+
return;
|
|
6570
|
+
case "none":
|
|
6571
|
+
return "none";
|
|
6572
|
+
case "note":
|
|
6573
|
+
return;
|
|
6574
|
+
case "option":
|
|
6575
|
+
return;
|
|
6576
|
+
case "presentation":
|
|
6577
|
+
return "none";
|
|
6578
|
+
case "progressbar":
|
|
6579
|
+
return "progressbar";
|
|
6580
|
+
case "radio":
|
|
6581
|
+
return "radio";
|
|
6582
|
+
case "radiogroup":
|
|
6583
|
+
return "radiogroup";
|
|
6584
|
+
case "region":
|
|
6585
|
+
return;
|
|
6586
|
+
case "row":
|
|
6587
|
+
return;
|
|
6588
|
+
case "rowgroup":
|
|
6589
|
+
return;
|
|
6590
|
+
case "rowheader":
|
|
6591
|
+
return;
|
|
6592
|
+
case "scrollbar":
|
|
6593
|
+
return "scrollbar";
|
|
6594
|
+
case "searchbox":
|
|
6595
|
+
return "search";
|
|
6596
|
+
case "separator":
|
|
6597
|
+
return;
|
|
6598
|
+
case "slider":
|
|
6599
|
+
return "adjustable";
|
|
6600
|
+
case "spinbutton":
|
|
6601
|
+
return "spinbutton";
|
|
6602
|
+
case "status":
|
|
6603
|
+
return;
|
|
6604
|
+
case "summary":
|
|
6605
|
+
return "summary";
|
|
6606
|
+
case "switch":
|
|
6607
|
+
return "switch";
|
|
6608
|
+
case "tab":
|
|
6609
|
+
return "tab";
|
|
6610
|
+
case "table":
|
|
6611
|
+
return;
|
|
6612
|
+
case "tablist":
|
|
6613
|
+
return "tablist";
|
|
6614
|
+
case "tabpanel":
|
|
6615
|
+
return;
|
|
6616
|
+
case "term":
|
|
6617
|
+
return;
|
|
6618
|
+
case "timer":
|
|
6619
|
+
return "timer";
|
|
6620
|
+
case "toolbar":
|
|
6621
|
+
return "toolbar";
|
|
6622
|
+
case "tooltip":
|
|
6623
|
+
return;
|
|
6624
|
+
case "tree":
|
|
6625
|
+
return;
|
|
6626
|
+
case "treegrid":
|
|
6627
|
+
return;
|
|
6628
|
+
case "treeitem":
|
|
6629
|
+
return;
|
|
6630
|
+
}
|
|
6631
|
+
}
|
|
6425
6632
|
|
|
6426
6633
|
// src/getBaseViews.native.ts
|
|
6427
6634
|
function getBaseViews() {
|
|
6428
|
-
let native = require("react-native");
|
|
6429
|
-
return {
|
|
6430
|
-
View
|
|
6635
|
+
let native = require("react-native"), View, TextAncestor;
|
|
6636
|
+
return View || (View = native.View || native.default.View), {
|
|
6637
|
+
View,
|
|
6431
6638
|
Text: native.Text || native.default.Text,
|
|
6639
|
+
StyleSheet: native.StyleSheet || native.default.StyleSheet,
|
|
6640
|
+
TextAncestor,
|
|
6432
6641
|
Pressable: native.Pressable || native.default.Pressable
|
|
6433
6642
|
};
|
|
6434
6643
|
}
|
|
@@ -6508,7 +6717,7 @@ var Pressability = require_fake_react_native().default, usePressability = (init_
|
|
|
6508
6717
|
|
|
6509
6718
|
// src/index.tsx
|
|
6510
6719
|
__reExport(src_exports, __toESM(require_index_native9()), module.exports);
|
|
6511
|
-
var Stack = import_web2.Stack, Text = import_web2.Text;
|
|
6720
|
+
var Stack = import_web2.Stack, Text = import_web2.Text, baseViews = getBaseViews();
|
|
6512
6721
|
(0, import_web2.setupHooks)({
|
|
6513
6722
|
getBaseViews,
|
|
6514
6723
|
usePropsTransform(elementType, propsIn, hostRef) {
|
|
@@ -6581,22 +6790,9 @@ var Stack = import_web2.Stack, Text = import_web2.Text;
|
|
|
6581
6790
|
viewProps[key] = og && !dontComposePressabilityKeys[key] ? (0, import_web2.composeEventHandlers)(og, val) : val;
|
|
6582
6791
|
}
|
|
6583
6792
|
}
|
|
6793
|
+
},
|
|
6794
|
+
useChildren(elementType, children, viewProps, events, staticConfig) {
|
|
6584
6795
|
}
|
|
6585
|
-
// attempt at properly fixing RN input, but <Pressable><TextInput /> just doesnt work on RN
|
|
6586
|
-
// useChildren(children, viewProps, events, staticConfig) {
|
|
6587
|
-
// if (process.env.TAMAGUI_TARGET === 'native') {
|
|
6588
|
-
// if (staticConfig.isInput && !staticConfig.isHOC) {
|
|
6589
|
-
// const Pressable = getBaseViews().Pressable
|
|
6590
|
-
// console.log(
|
|
6591
|
-
// 'wrapping in pressable',
|
|
6592
|
-
// events?.['onPressIn']?.toString(),
|
|
6593
|
-
// viewProps['onPressIn']
|
|
6594
|
-
// )
|
|
6595
|
-
// // we need to wrap it in a view?
|
|
6596
|
-
// return <Pressable {...events}>{children}</Pressable>
|
|
6597
|
-
// }
|
|
6598
|
-
// }
|
|
6599
|
-
// },
|
|
6600
6796
|
});
|
|
6601
6797
|
var dontComposePressabilityKeys = {
|
|
6602
6798
|
onClick: !0
|