tamagui 1.84.0 → 1.84.2
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/native.js +38 -28
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +37 -29
- package/dist/test.native.js.map +2 -2
- package/package.json +52 -52
package/dist/native.js
CHANGED
|
@@ -3928,10 +3928,10 @@ var require_ThemeManagerContext_native = __commonJS({
|
|
|
3928
3928
|
return to;
|
|
3929
3929
|
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), ThemeManagerContext_exports = {};
|
|
3930
3930
|
__export2(ThemeManagerContext_exports, {
|
|
3931
|
-
|
|
3931
|
+
ThemeManagerIDContext: () => ThemeManagerIDContext
|
|
3932
3932
|
});
|
|
3933
3933
|
module2.exports = __toCommonJS2(ThemeManagerContext_exports);
|
|
3934
|
-
var import_react2 = require("react"),
|
|
3934
|
+
var import_react2 = require("react"), ThemeManagerIDContext = (0, import_react2.createContext)(1);
|
|
3935
3935
|
}
|
|
3936
3936
|
});
|
|
3937
3937
|
|
|
@@ -3960,7 +3960,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3960
3960
|
}
|
|
3961
3961
|
var uid = 0, ThemeManager = class {
|
|
3962
3962
|
constructor(props = {}, parentManager) {
|
|
3963
|
-
if (this.props = props, this.id =
|
|
3963
|
+
if (this.props = props, this.id = 0, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, uid = (uid + 1) % Number.MAX_VALUE, this.id = uid, parentManager === "root") {
|
|
3964
3964
|
this.updateStateFromProps(props, !1);
|
|
3965
3965
|
return;
|
|
3966
3966
|
}
|
|
@@ -4103,6 +4103,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4103
4103
|
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), useTheme_exports = {};
|
|
4104
4104
|
__export2(useTheme_exports, {
|
|
4105
4105
|
activeThemeManagers: () => activeThemeManagers,
|
|
4106
|
+
getThemeManager: () => getThemeManager,
|
|
4106
4107
|
getThemeProxied: () => getThemeProxied,
|
|
4107
4108
|
useChangeThemeEffect: () => useChangeThemeEffect,
|
|
4108
4109
|
useTheme: () => useTheme4,
|
|
@@ -4133,13 +4134,13 @@ var require_useTheme_native = __commonJS({
|
|
|
4133
4134
|
}), next;
|
|
4134
4135
|
}
|
|
4135
4136
|
), { themeManager, state } = changedThemeState;
|
|
4136
|
-
state != null && state.theme || process.env.
|
|
4137
|
+
process.env.NODE_ENV === "development" && (state != null && state.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.warn(
|
|
4137
4138
|
`[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(
|
|
4138
4139
|
props
|
|
4139
4140
|
)}).
|
|
4140
4141
|
|
|
4141
4142
|
If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
|
|
4142
|
-
);
|
|
4143
|
+
));
|
|
4143
4144
|
let themeProxied = (0, import_react2.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]);
|
|
4144
4145
|
return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
|
|
4145
4146
|
};
|
|
@@ -4217,8 +4218,13 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4217
4218
|
}
|
|
4218
4219
|
return !1;
|
|
4219
4220
|
}
|
|
4220
|
-
var activeThemeManagers = /* @__PURE__ */ new Set(),
|
|
4221
|
-
|
|
4221
|
+
var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = (id) => _idToUID[id], getThemeManager = (id) => _uidToManager.get(getId(id)), registerThemeManager = (t) => {
|
|
4222
|
+
if (!_idToUID[t.id]) {
|
|
4223
|
+
let id = _idToUID[t.id] = {};
|
|
4224
|
+
_uidToManager.set(id, t);
|
|
4225
|
+
}
|
|
4226
|
+
}, useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
|
|
4227
|
+
let { disable } = props, parentManagerId = (0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerIDContext), parentManager = getThemeManager(parentManagerId);
|
|
4222
4228
|
if (!isRoot && !parentManager || disable)
|
|
4223
4229
|
return {
|
|
4224
4230
|
isNewTheme: !1,
|
|
@@ -4244,7 +4250,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4244
4250
|
}));
|
|
4245
4251
|
return;
|
|
4246
4252
|
}
|
|
4247
|
-
isNewTheme
|
|
4253
|
+
(isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
|
|
4248
4254
|
let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
|
|
4249
4255
|
forced && setThemeState((prev) => createState(prev, !0));
|
|
4250
4256
|
}), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
|
|
@@ -4255,7 +4261,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4255
4261
|
themeManager.id
|
|
4256
4262
|
);
|
|
4257
4263
|
return () => {
|
|
4258
|
-
selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), activeThemeManagers.delete(themeManager);
|
|
4264
|
+
selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), isNewTheme && activeThemeManagers.delete(themeManager);
|
|
4259
4265
|
};
|
|
4260
4266
|
}, [
|
|
4261
4267
|
themeManager,
|
|
@@ -4303,14 +4309,16 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4303
4309
|
} else
|
|
4304
4310
|
themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
|
|
4305
4311
|
}
|
|
4306
|
-
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse)
|
|
4312
|
+
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
|
|
4313
|
+
isNewTheme2 && registerThemeManager(themeManager2);
|
|
4314
|
+
let mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
4307
4315
|
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
4308
4316
|
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
|
|
4309
4317
|
themeManager: themeManager2,
|
|
4310
4318
|
isNewTheme: isNewTheme2,
|
|
4311
4319
|
mounted: mounted2,
|
|
4312
4320
|
inversed: inversed2
|
|
4313
|
-
}, shouldReturnPrev =
|
|
4321
|
+
}, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
|
|
4314
4322
|
(0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
|
|
4315
4323
|
(0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
|
|
4316
4324
|
if (prev && shouldReturnPrev)
|
|
@@ -4406,7 +4414,7 @@ var require_Theme_native = __commonJS({
|
|
|
4406
4414
|
function getThemedChildren(themeState, children, props, isRoot = !1) {
|
|
4407
4415
|
let { themeManager, isNewTheme } = themeState;
|
|
4408
4416
|
if (!themeManager)
|
|
4409
|
-
throw "\u274C";
|
|
4417
|
+
throw new Error(process.env.NODE_ENV === "development" ? "\u274C No theme found, either incorrect name, potential duplicate tamagui deps, or TamaguiProvider not providing themes." : "\u274C");
|
|
4410
4418
|
let { shallow, forceClassName } = props, hasEverThemed = (0, import_react2.useRef)(!1), shouldRenderChildrenWithTheme = isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot;
|
|
4411
4419
|
if (shouldRenderChildrenWithTheme && (hasEverThemed.current = !0), !shouldRenderChildrenWithTheme)
|
|
4412
4420
|
return children;
|
|
@@ -4416,7 +4424,7 @@ var require_Theme_native = __commonJS({
|
|
|
4416
4424
|
void 0,
|
|
4417
4425
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Theme2, { name: themeManager.state.parentName, children: child.props.children })
|
|
4418
4426
|
) : child));
|
|
4419
|
-
let elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeManagerContext.
|
|
4427
|
+
let elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ThemeManagerContext.ThemeManagerIDContext.Provider, { value: themeManager.id, children: next });
|
|
4420
4428
|
return forceClassName === !1 ? elementsWithContext : import_constants4.isWeb ? wrapThemeElements({
|
|
4421
4429
|
children: elementsWithContext,
|
|
4422
4430
|
themeState,
|
|
@@ -4949,7 +4957,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
4949
4957
|
fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
|
|
4950
4958
|
let fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", style = avoidAnimationStyle ? splitStyles.style : animationStyles || splitStyles.style, className;
|
|
4951
4959
|
asChild === "except-style" || asChild === "except-style-web" || (viewProps.style = style);
|
|
4952
|
-
let runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), attachFocus = !!(runtimePressStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = runtimeHoverStyle || onHoverIn || onHoverOut, isHoverable = import_constants4.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !!(attachFocus || attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
4960
|
+
let runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = runtimeHoverStyle || onHoverIn || onHoverOut, isHoverable = import_constants4.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !!(attachFocus || attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
4953
4961
|
process.env.NODE_ENV === "development" && time && time`events-setup`;
|
|
4954
4962
|
let events = shouldAttach && !isDisabled && !props.asChild ? {
|
|
4955
4963
|
onPressOut: attachPress ? (e) => {
|
|
@@ -6100,9 +6108,9 @@ var require_useThemeName_native = __commonJS({
|
|
|
6100
6108
|
useThemeName: () => useThemeName2
|
|
6101
6109
|
});
|
|
6102
6110
|
module2.exports = __toCommonJS2(useThemeName_exports);
|
|
6103
|
-
var import_constants4 = require_index_native(), import_react2 = require("react"), import_ThemeManagerContext = require_ThemeManagerContext_native();
|
|
6111
|
+
var import_constants4 = require_index_native(), import_react2 = require("react"), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native();
|
|
6104
6112
|
function useThemeName2(opts) {
|
|
6105
|
-
let manager = (0, import_react2.useContext)(import_ThemeManagerContext.
|
|
6113
|
+
let manager = (0, import_useTheme.getThemeManager)((0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerIDContext)), [name, setName] = (0, import_react2.useState)((manager == null ? void 0 : manager.state.name) || "");
|
|
6106
6114
|
return (0, import_constants4.useIsomorphicLayoutEffect)(() => {
|
|
6107
6115
|
if (manager)
|
|
6108
6116
|
return setName(manager.state.name), manager.onChangeTheme((next, manager2) => {
|
|
@@ -11191,7 +11199,7 @@ var require_Dialog_native = __commonJS({
|
|
|
11191
11199
|
}
|
|
11192
11200
|
), TITLE_NAME = "DialogTitle", DialogTitleFrame = (0, import_core13.styled)(import_text2.H2, {
|
|
11193
11201
|
name: TITLE_NAME
|
|
11194
|
-
}), DialogTitle =
|
|
11202
|
+
}), DialogTitle = DialogTitleFrame.styleable(
|
|
11195
11203
|
(props, forwardedRef) => {
|
|
11196
11204
|
let { __scopeDialog, ...titleProps } = props, context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
11197
11205
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogTitleFrame, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
@@ -11200,17 +11208,19 @@ var require_Dialog_native = __commonJS({
|
|
|
11200
11208
|
DialogTitle.displayName = TITLE_NAME;
|
|
11201
11209
|
var DialogDescriptionFrame = (0, import_core13.styled)(import_text2.Paragraph, {
|
|
11202
11210
|
name: "DialogDescription"
|
|
11203
|
-
}), DESCRIPTION_NAME = "DialogDescription", DialogDescription =
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11211
|
+
}), DESCRIPTION_NAME = "DialogDescription", DialogDescription = DialogDescriptionFrame.styleable(
|
|
11212
|
+
(props, forwardedRef) => {
|
|
11213
|
+
let { __scopeDialog, ...descriptionProps } = props, context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
11214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11215
|
+
DialogDescriptionFrame,
|
|
11216
|
+
{
|
|
11217
|
+
id: context.descriptionId,
|
|
11218
|
+
...descriptionProps,
|
|
11219
|
+
ref: forwardedRef
|
|
11220
|
+
}
|
|
11221
|
+
);
|
|
11222
|
+
}
|
|
11223
|
+
);
|
|
11214
11224
|
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
11215
11225
|
var CLOSE_NAME = "DialogClose", DialogCloseFrame = (0, import_core13.styled)(import_core13.View, {
|
|
11216
11226
|
name: CLOSE_NAME,
|