@tamagui/web 1.85.3 → 1.85.5
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/createComponent.js +86 -111
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createComponent.native.js +78 -106
- package/dist/cjs/createComponent.native.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +2 -3
- package/dist/cjs/helpers/ThemeManager.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.native.js +2 -3
- package/dist/cjs/helpers/ThemeManager.native.js.map +1 -1
- package/dist/cjs/helpers/createShallowSetState.js +4 -4
- package/dist/cjs/helpers/createShallowSetState.js.map +1 -1
- package/dist/cjs/helpers/createShallowSetState.native.js +4 -4
- package/dist/cjs/helpers/createShallowSetState.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.js +12 -31
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +7 -12
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getStylesAtomic.js +5 -11
- package/dist/cjs/helpers/getStylesAtomic.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.js +2 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +2 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/pseudoDescriptors.js +1 -1
- package/dist/cjs/helpers/pseudoDescriptors.native.js +1 -1
- package/dist/cjs/hooks/useTheme.js +1 -1
- package/dist/cjs/hooks/useTheme.js.map +1 -1
- package/dist/cjs/hooks/useTheme.native.js +1 -1
- package/dist/cjs/hooks/useTheme.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +6 -6
- package/dist/cjs/views/TamaguiProvider.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.native.js +6 -6
- package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
- package/dist/cjs/views/Theme.js +1 -1
- package/dist/cjs/views/Theme.native.js +1 -1
- package/dist/esm/createComponent.js +75 -103
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.native.js +67 -97
- package/dist/esm/createComponent.native.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +2 -3
- package/dist/esm/helpers/ThemeManager.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.native.js +2 -3
- package/dist/esm/helpers/ThemeManager.native.js.map +1 -1
- package/dist/esm/helpers/createShallowSetState.js +4 -4
- package/dist/esm/helpers/createShallowSetState.js.map +1 -1
- package/dist/esm/helpers/createShallowSetState.native.js +4 -4
- package/dist/esm/helpers/createShallowSetState.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +12 -31
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +7 -12
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getStylesAtomic.js +5 -11
- package/dist/esm/helpers/getStylesAtomic.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js +2 -1
- package/dist/esm/helpers/insertStyleRule.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +2 -1
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/pseudoDescriptors.js +1 -1
- package/dist/esm/helpers/pseudoDescriptors.native.js +1 -1
- package/dist/esm/hooks/useTheme.js +1 -1
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/hooks/useTheme.native.js +1 -1
- package/dist/esm/hooks/useTheme.native.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +6 -6
- package/dist/esm/views/TamaguiProvider.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.native.js +6 -6
- package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
- package/dist/esm/views/Theme.js +1 -1
- package/dist/esm/views/Theme.native.js +1 -1
- package/package.json +10 -10
- package/src/createComponent.tsx +169 -207
- package/src/helpers/ThemeManager.tsx +5 -12
- package/src/helpers/createShallowSetState.tsx +19 -4
- package/src/helpers/getSplitStyles.tsx +21 -57
- package/src/helpers/getStylesAtomic.ts +8 -9
- package/src/helpers/insertStyleRule.tsx +3 -5
- package/src/helpers/pseudoDescriptors.ts +2 -1
- package/src/hooks/useTheme.tsx +1 -1
- package/src/setupHooks.ts +2 -1
- package/src/types.tsx +0 -2
- package/src/views/TamaguiProvider.tsx +13 -10
- package/src/views/Theme.tsx +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/ThemeManager.d.ts.map +1 -1
- package/types/helpers/createShallowSetState.d.ts +3 -2
- package/types/helpers/createShallowSetState.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/pseudoDescriptors.d.ts +1 -0
- package/types/helpers/pseudoDescriptors.d.ts.map +1 -1
- package/types/setupHooks.d.ts +1 -1
- package/types/setupHooks.d.ts.map +1 -1
- package/types/types.d.ts +0 -2
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.d.ts.map +1 -1
|
@@ -43,7 +43,7 @@ const useTheme = (props = emptyProps) => {
|
|
|
43
43
|
import_constants.isServer ? void 0 : () => {
|
|
44
44
|
var _a, _b;
|
|
45
45
|
const next = ((_a = props.shouldUpdate) == null ? void 0 : _a.call(props)) ?? (keys.current.length > 0 ? !0 : void 0);
|
|
46
|
-
return process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
|
|
46
|
+
return process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile" && console.info(" \u{1F3A8} useTheme() shouldUpdate?", next, {
|
|
47
47
|
shouldUpdateProp: (_b = props.shouldUpdate) == null ? void 0 : _b.call(props),
|
|
48
48
|
keys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+CAAe,MAAM,GACxC,WAAW,+CAAe,IAC1B,oBAAoB,EAAE,GAAGA,cAAa,MAAM;AAClD,cAAQ,KAAK;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,GACD,QAAQ,SAAS;AAAA,IACnB;AAEA,WAAO;AAAA,EACT;AACF;",
|
|
5
5
|
"names": ["_", "themeManager", "state", "isNewTheme", "mounted", "inversed"]
|
|
6
6
|
}
|
|
@@ -33,12 +33,12 @@ function TamaguiProvider({
|
|
|
33
33
|
...themePropsProvider
|
|
34
34
|
}) {
|
|
35
35
|
return (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && React.useLayoutEffect(() => {
|
|
36
|
-
if (document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), disableInjectCSS)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
36
|
+
if (config.disableSSR || document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), !disableInjectCSS) {
|
|
37
|
+
const style = document.createElement("style");
|
|
38
|
+
return style.appendChild(document.createTextNode(config.getCSS())), document.head.appendChild(style), () => {
|
|
39
|
+
document.head.removeChild(style);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
42
|
}, [config, disableInjectCSS]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { animationDriver: config.animations, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
43
43
|
import_ThemeProvider.ThemeProvider,
|
|
44
44
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/TamaguiProvider.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyB,+BACzB,QAAuB,2BAEvB,0BAAiC,yCACjC,kBAAoC,8BAEpC,uBAA8B,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyB,+BACzB,QAAuB,2BAEvB,0BAAiC,yCACjC,kBAAoC,8BAEpC,uBAA8B,4BAmCxB;AAjCC,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,kDAAoB,GAEhB,6BAGF,MAAM,gBAAgB,MAAM;AAS1B,QARK,OAAO,cAGN,SAAS,gBAAgB,UAAU,SAAS,aAAa,KAC3D,SAAS,gBAAgB,UAAU,OAAO,aAAa,GAIvD,CAAC,kBAAkB;AACrB,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,mBAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC,GAC1D,SAAS,KAAK,YAAY,KAAK,GACxB,MAAM;AACX,iBAAS,KAAK,YAAY,KAAK;AAAA,MACjC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,gBAAgB,CAAC,GAI7B,4CAAC,yCAAiB,UAAjB,EAA0B,iBAAiB,OAAO,YACjD;AAAA,IAAC;AAAA;AAAA,MACC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,MAC7B,GAAG;AAAA,MACJ,cAAc,mBAAmB,gBAAgB,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC;AAAA,MAE5E;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,gBAAgB,cAAiB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -34,12 +34,12 @@ function TamaguiProvider({
|
|
|
34
34
|
...themePropsProvider
|
|
35
35
|
}) {
|
|
36
36
|
return (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && React.useLayoutEffect(() => {
|
|
37
|
-
if (document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), disableInjectCSS)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
37
|
+
if (config.disableSSR || document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), !disableInjectCSS) {
|
|
38
|
+
const style = document.createElement("style");
|
|
39
|
+
return style.appendChild(document.createTextNode(config.getCSS())), document.head.appendChild(style), () => {
|
|
40
|
+
document.head.removeChild(style);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
43
|
}, [config, disableInjectCSS]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { animationDriver: config.animations, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
44
44
|
import_ThemeProvider.ThemeProvider,
|
|
45
45
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/TamaguiProvider.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyB,+BACzB,QAAuB,2BAEvB,0BAAiC,yCACjC,kBAAoC,8BAEpC,uBAA8B,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyB,+BACzB,QAAuB,2BAEvB,0BAAiC,yCACjC,kBAAoC,8BAEpC,uBAA8B,4BAmCxB;AAjCC,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,kDAAoB,GAEhB,6BAGF,MAAM,gBAAgB,MAAM;AAS1B,QARK,OAAO,cAGN,SAAS,gBAAgB,UAAU,SAAS,aAAa,KAC3D,SAAS,gBAAgB,UAAU,OAAO,aAAa,GAIvD,CAAC,kBAAkB;AACrB,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,mBAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC,GAC1D,SAAS,KAAK,YAAY,KAAK,GACxB,MAAM;AACX,iBAAS,KAAK,YAAY,KAAK;AAAA,MACjC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,gBAAgB,CAAC,GAI7B,4CAAC,yCAAiB,UAAjB,EAA0B,iBAAiB,OAAO,YACjD;AAAA,IAAC;AAAA;AAAA,MACC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,MAC7B,GAAG;AAAA,MACJ,cAAc,mBAAmB,gBAAgB,OAAO,KAAK,OAAO,MAAM,EAAE,CAAC;AAAA,MAE5E;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,gBAAgB,cAAiB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/views/Theme.js
CHANGED
|
@@ -48,7 +48,7 @@ function getThemedChildren(themeState, children, props, isRoot = !1) {
|
|
|
48
48
|
const { themeManager, isNewTheme } = themeState;
|
|
49
49
|
if (!themeManager)
|
|
50
50
|
throw new Error(
|
|
51
|
-
process.env.NODE_ENV === "development" ? "\u274C No theme found, either incorrect name, potential duplicate tamagui deps, or TamaguiProvider not providing themes." : "\u274C"
|
|
51
|
+
process.env.NODE_ENV === "development" ? "\u274C No theme found, either incorrect name, potential duplicate tamagui deps, or TamaguiProvider not providing themes." : "\u274C 005"
|
|
52
52
|
);
|
|
53
53
|
const { shallow, forceClassName } = props, hasEverThemed = (0, import_react.useRef)(!1), shouldRenderChildrenWithTheme = isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot;
|
|
54
54
|
if (shouldRenderChildrenWithTheme && (hasEverThemed.current = !0), !shouldRenderChildrenWithTheme)
|
|
@@ -49,7 +49,7 @@ function getThemedChildren(themeState, children, props, isRoot = !1) {
|
|
|
49
49
|
const { themeManager, isNewTheme } = themeState;
|
|
50
50
|
if (!themeManager)
|
|
51
51
|
throw new Error(
|
|
52
|
-
process.env.NODE_ENV === "development" ? "\u274C No theme found, either incorrect name, potential duplicate tamagui deps, or TamaguiProvider not providing themes." : "\u274C"
|
|
52
|
+
process.env.NODE_ENV === "development" ? "\u274C No theme found, either incorrect name, potential duplicate tamagui deps, or TamaguiProvider not providing themes." : "\u274C 005"
|
|
53
53
|
);
|
|
54
54
|
const { shallow, forceClassName } = props, hasEverThemed = (0, import_react.useRef)(!1), shouldRenderChildrenWithTheme = isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot;
|
|
55
55
|
if (shouldRenderChildrenWithTheme && (hasEverThemed.current = !0), !shouldRenderChildrenWithTheme)
|
|
@@ -8,7 +8,6 @@ import React, {
|
|
|
8
8
|
createElement,
|
|
9
9
|
forwardRef,
|
|
10
10
|
memo,
|
|
11
|
-
useCallback,
|
|
12
11
|
useContext,
|
|
13
12
|
useEffect,
|
|
14
13
|
useId,
|
|
@@ -32,7 +31,6 @@ import {
|
|
|
32
31
|
import { useSplitStyles } from "./helpers/getSplitStyles";
|
|
33
32
|
import { log } from "./helpers/log";
|
|
34
33
|
import { mergeProps } from "./helpers/mergeProps";
|
|
35
|
-
import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
|
|
36
34
|
import { themeable } from "./helpers/themeable";
|
|
37
35
|
import { mediaKeyMatch, setMediaShouldUpdate, useMedia } from "./hooks/useMedia";
|
|
38
36
|
import { useThemeWithState } from "./hooks/useTheme";
|
|
@@ -41,7 +39,7 @@ import { Slot } from "./views/Slot";
|
|
|
41
39
|
import { getThemedChildren } from "./views/Theme";
|
|
42
40
|
import { ThemeDebug } from "./views/ThemeDebug";
|
|
43
41
|
import { jsx } from "react/jsx-runtime";
|
|
44
|
-
let tamaguiConfig,
|
|
42
|
+
let tamaguiConfig, time, debugKeyListeners, startVisualizer;
|
|
45
43
|
const mouseUps = /* @__PURE__ */ new Set();
|
|
46
44
|
if (typeof document < "u") {
|
|
47
45
|
const cancelTouches = () => {
|
|
@@ -71,16 +69,13 @@ if (typeof document < "u") {
|
|
|
71
69
|
}
|
|
72
70
|
let BaseText, BaseView;
|
|
73
71
|
function createComponent(staticConfig) {
|
|
72
|
+
const { componentName } = staticConfig;
|
|
74
73
|
let config = null, defaultProps = staticConfig.defaultProps;
|
|
75
74
|
onConfiguredOnce((conf) => {
|
|
76
|
-
if (config = conf,
|
|
77
|
-
const defaultForComponent = conf.defaultProps?.[
|
|
75
|
+
if (config = conf, componentName) {
|
|
76
|
+
const defaultForComponent = conf.defaultProps?.[componentName];
|
|
78
77
|
defaultForComponent && (defaultProps = { ...defaultForComponent, ...defaultProps });
|
|
79
78
|
}
|
|
80
|
-
if (!tamaguiConfig && (tamaguiConfig = conf, !initialTheme)) {
|
|
81
|
-
const next = conf.themes[Object.keys(conf.themes)[0]];
|
|
82
|
-
initialTheme = proxyThemeVariables(next), process.env.NODE_ENV === "development" && (initialTheme || log("Warning: Missing theme"));
|
|
83
|
-
}
|
|
84
79
|
});
|
|
85
80
|
const {
|
|
86
81
|
Component,
|
|
@@ -89,8 +84,8 @@ function createComponent(staticConfig) {
|
|
|
89
84
|
isHOC,
|
|
90
85
|
validStyles: validStyles2 = {},
|
|
91
86
|
variants = {}
|
|
92
|
-
} = staticConfig
|
|
93
|
-
process.env.NODE_ENV === "development" && staticConfig.defaultProps?.debug && process.env.IS_STATIC !== "is_static" && log(`\u{1F41B} [${
|
|
87
|
+
} = staticConfig;
|
|
88
|
+
process.env.NODE_ENV === "development" && staticConfig.defaultProps?.debug && process.env.IS_STATIC !== "is_static" && log(`\u{1F41B} [${componentName || "Component"}]`, {
|
|
94
89
|
staticConfig,
|
|
95
90
|
defaultProps,
|
|
96
91
|
defaultPropsKeyOrder: defaultProps ? Object.keys(defaultProps) : []
|
|
@@ -115,7 +110,7 @@ function createComponent(staticConfig) {
|
|
|
115
110
|
const curDefaultProps = styledContextProps ? { ...defaultProps, ...styledContextProps } : defaultProps;
|
|
116
111
|
let props = propsIn;
|
|
117
112
|
curDefaultProps && (props = mergeProps(curDefaultProps, propsIn));
|
|
118
|
-
const debugProp = props.debug,
|
|
113
|
+
const debugProp = props.debug, componentName2 = props.componentName || staticConfig.componentName;
|
|
119
114
|
process.env.NODE_ENV === "development" && isClient && useEffect(() => {
|
|
120
115
|
let overlay = null;
|
|
121
116
|
const debugVisualizerHandler = (show = !1) => {
|
|
@@ -124,33 +119,33 @@ function createComponent(staticConfig) {
|
|
|
124
119
|
if (show) {
|
|
125
120
|
overlay = document.createElement("span"), overlay.style.inset = "0px", overlay.style.zIndex = "1000000", overlay.style.position = "absolute", overlay.style.borderColor = "red", overlay.style.borderWidth = "1px", overlay.style.borderStyle = "dotted";
|
|
126
121
|
const dataAt = node.getAttribute("data-at") || "", dataIn = node.getAttribute("data-in") || "", tooltip = document.createElement("span");
|
|
127
|
-
tooltip.style.position = "absolute", tooltip.style.top = "0px", tooltip.style.left = "0px", tooltip.style.padding = "3px", tooltip.style.background = "rgba(0,0,0,0.75)", tooltip.style.color = "rgba(255,255,255,1)", tooltip.style.fontSize = "12px", tooltip.style.lineHeight = "12px", tooltip.style.fontFamily = "monospace", tooltip.style.webkitFontSmoothing = "none", tooltip.innerText = `${
|
|
122
|
+
tooltip.style.position = "absolute", tooltip.style.top = "0px", tooltip.style.left = "0px", tooltip.style.padding = "3px", tooltip.style.background = "rgba(0,0,0,0.75)", tooltip.style.color = "rgba(255,255,255,1)", tooltip.style.fontSize = "12px", tooltip.style.lineHeight = "12px", tooltip.style.fontFamily = "monospace", tooltip.style.webkitFontSmoothing = "none", tooltip.innerText = `${componentName2 || ""} ${dataAt} ${dataIn}`.trim(), overlay.appendChild(tooltip), node.appendChild(overlay);
|
|
128
123
|
} else
|
|
129
124
|
overlay && node.removeChild(overlay);
|
|
130
125
|
};
|
|
131
126
|
return debugKeyListeners ||= /* @__PURE__ */ new Set(), debugKeyListeners.add(debugVisualizerHandler), () => {
|
|
132
127
|
debugKeyListeners?.delete(debugVisualizerHandler);
|
|
133
128
|
};
|
|
134
|
-
}, [
|
|
135
|
-
const isHydrated = config?.disableSSR ? !0 : useDidFinishSSR();
|
|
136
|
-
process.env.NODE_ENV === "development" && time && time`did-finish-ssr`;
|
|
129
|
+
}, [componentName2]), !process.env.TAMAGUI_IS_CORE_NODE && process.env.NODE_ENV === "development" && debugProp === "profile" && !time && (time = require("@tamagui/timer").timer().start()), process.env.NODE_ENV === "development" && time && time`start (ignore)`, process.env.NODE_ENV === "development" && time && time`did-finish-ssr`;
|
|
137
130
|
const stateRef = useRef(
|
|
138
131
|
{}
|
|
139
132
|
);
|
|
140
133
|
process.env.NODE_ENV === "development" && time && time`stateref`;
|
|
141
|
-
const hostRef = useRef(null), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig?.useAnimations, hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig?.supportsCSSVars,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
134
|
+
const hostRef = useRef(null), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig?.useAnimations, hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig?.supportsCSSVars, curState = stateRef.current, willBeAnimatedClient = !!(!!(hasAnimationProp && !isHOC && useAnimations) || curState.hasAnimated), willBeAnimated = !isServer && willBeAnimatedClient;
|
|
135
|
+
willBeAnimated && !curState.hasAnimated && (curState.hasAnimated = !0);
|
|
136
|
+
const isHydrated = config?.disableSSR ? !0 : useDidFinishSSR(), presence = willBeAnimated && animationsConfig?.usePresence?.() || null, presenceState = presence?.[2], enterExitVariant = presenceState?.enterExitVariant, enterVariant = enterExitVariant ?? presenceState?.enterVariant, hasEnterStyle = !!props.enterStyle, hasRNAnimation = hasAnimationProp && animationsConfig?.isReactNative, isReactNative = staticConfig.isReactNative;
|
|
137
|
+
let isAnimated = willBeAnimated;
|
|
138
|
+
!isReactNative && hasRNAnimation && !isHOC && !isHydrated && (isAnimated = !1, curState.willHydrate = !0), process.env.NODE_ENV === "development" && time && time`pre-use-state`;
|
|
139
|
+
const initialState = hasEnterStyle || enterVariant ? isHydrated ? defaultComponentState : defaultComponentStateShouldEnter : defaultComponentStateMounted, states = useState(initialState), state = props.forceStyle ? { ...states[0], [props.forceStyle]: !0 } : states[0], setState = states[1];
|
|
140
|
+
let setStateShallow = createShallowSetState(setState, debugProp);
|
|
141
|
+
if (isHydrated && state.unmounted === "should-enter" && (state.unmounted = !0), presenceState && isAnimated && isHydrated) {
|
|
142
|
+
const isExiting2 = !presenceState.isPresent, exitVariant = enterExitVariant ?? presenceState.exitVariant;
|
|
143
|
+
state.unmounted && enterVariant ? (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence ENTER "${enterVariant}"`), props[enterVariant] = !0) : isExiting2 && exitVariant && (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence EXIT "${enterVariant}"`), props[exitVariant] = !enterExitVariant);
|
|
144
|
+
}
|
|
145
|
+
const shouldAvoidClasses = !!(!isWeb || isAnimated && !supportsCSSVars || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, groupName = props.group, groupClassName = groupName ? `t_group_${props.group}` : "";
|
|
146
|
+
if (groupName && !curState.group) {
|
|
152
147
|
const listeners = /* @__PURE__ */ new Set();
|
|
153
|
-
|
|
148
|
+
curState.group = {
|
|
154
149
|
listeners,
|
|
155
150
|
emit(name, state2) {
|
|
156
151
|
listeners.forEach((l) => l(name, state2));
|
|
@@ -165,7 +160,7 @@ function createComponent(staticConfig) {
|
|
|
165
160
|
if (groupName) {
|
|
166
161
|
const groupContextState = componentContext.groups.state, og = setStateShallow;
|
|
167
162
|
setStateShallow = (state2) => {
|
|
168
|
-
og(state2),
|
|
163
|
+
og(state2), curState.group.emit(groupName, {
|
|
169
164
|
pseudo: state2
|
|
170
165
|
});
|
|
171
166
|
const next = {
|
|
@@ -176,54 +171,31 @@ function createComponent(staticConfig) {
|
|
|
176
171
|
};
|
|
177
172
|
}
|
|
178
173
|
process.env.NODE_ENV === "development" && time && time`use-state`;
|
|
179
|
-
|
|
180
|
-
willBeAnimated && !supportsCSSVars && !presence && isHydrated && (isServer || state.unmounted === !0) && (isAnimated = !1), willBeAnimated && !stateRef.current.hasAnimated && (stateRef.current.hasAnimated = !0);
|
|
181
|
-
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName, hasTextAncestor = !!(isWeb && isText && componentContext.inText), isDisabled = props.disabled ?? props.accessibilityState?.disabled;
|
|
174
|
+
const componentNameFinal = props.componentName || componentName2, componentClassName = props.asChild || !componentNameFinal ? "" : `is_${componentNameFinal}`, hasTextAncestor = !!(isWeb && isText && componentContext.inText), isDisabled = props.disabled ?? props.accessibilityState?.disabled;
|
|
182
175
|
process.env.NODE_ENV === "development" && time && time`use-context`;
|
|
183
176
|
const element = isWeb && (!Component || typeof Component == "string") && props.tag || Component;
|
|
184
177
|
let elementType = isText ? BaseText || element || "span" : BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const isEntering = state.unmounted, isExiting2 = !presenceState.isPresent, enterExitVariant = presenceState.enterExitVariant, enterVariant = enterExitVariant ?? presenceState.enterVariant, exitVariant = enterExitVariant ?? presenceState.exitVariant;
|
|
189
|
-
isEntering && enterVariant ? (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence ENTER "${enterVariant}"`), props[enterVariant] = !0) : isExiting2 && exitVariant && (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence EXIT "${enterVariant}"`), props[exitVariant] = !enterExitVariant);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
const isAnimatedReactNative = hasAnimationProp && animationsConfig?.isReactNative, isReactNative = !!(staticConfig.isReactNative || isAnimatedReactNative), shouldAvoidClasses = !!(!isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, disableTheme = props["data-disable-theme"] && !willBeAnimated || isHOC;
|
|
193
|
-
process.env.NODE_ENV === "development" && time && time`theme-props`, props.themeShallow && (stateRef.current.themeShallow = !0);
|
|
178
|
+
animationsConfig && isAnimated && (elementType = animationsConfig[isText ? "Text" : "View"] || elementType);
|
|
179
|
+
const disableTheme = props["data-disable-theme"] && !willBeAnimated || isHOC;
|
|
180
|
+
process.env.NODE_ENV === "development" && time && time`theme-props`, props.themeShallow && (curState.themeShallow = !0);
|
|
194
181
|
const themeStateProps = {
|
|
195
182
|
name: props.theme,
|
|
196
|
-
componentName,
|
|
183
|
+
componentName: componentName2,
|
|
197
184
|
disable: disableTheme,
|
|
198
|
-
shallow:
|
|
185
|
+
shallow: curState.themeShallow,
|
|
199
186
|
inverse: props.themeInverse,
|
|
200
187
|
debug: debugProp
|
|
201
188
|
};
|
|
202
|
-
typeof
|
|
189
|
+
typeof curState.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = () => stateRef.current.isListeningToTheme);
|
|
203
190
|
const isExiting = !state.unmounted && presence?.[0] === !1;
|
|
204
191
|
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
205
|
-
const name = `${
|
|
192
|
+
const name = `${componentName2 || Component?.displayName || Component?.name || "[Unnamed Component]"}`, type = (hasEnterStyle ? "(hasEnter)" : "") + (isAnimated ? "(animated)" : "") + (isReactNative ? "(rnw)" : ""), dataIs = propsIn["data-is"] || "", banner = `${internalID} ${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
206
193
|
console.group(
|
|
207
|
-
`%c ${banner} (
|
|
194
|
+
`%c ${banner} (hydrated: ${isHydrated}) (unmounted: ${state.unmounted})`,
|
|
208
195
|
"background: green; color: white;"
|
|
209
|
-
), isServer || (console.groupCollapsed(
|
|
196
|
+
), isServer || (console.groupEnd(), console.groupEnd(), console.groupCollapsed(
|
|
210
197
|
`Info (collapsed): ${state.press || state.pressIn ? "PRESSED " : ""}${state.hover ? "HOVERED " : ""}${state.focus ? "FOCUSED" : " "}`
|
|
211
|
-
), log({
|
|
212
|
-
propsIn,
|
|
213
|
-
props,
|
|
214
|
-
state,
|
|
215
|
-
staticConfig,
|
|
216
|
-
elementType,
|
|
217
|
-
themeStateProps,
|
|
218
|
-
styledContext: { contextProps: styledContextProps, overriddenContextProps },
|
|
219
|
-
presence,
|
|
220
|
-
isAnimated,
|
|
221
|
-
isHOC,
|
|
222
|
-
hasAnimationProp,
|
|
223
|
-
useAnimations,
|
|
224
|
-
propsInOrder: Object.keys(propsIn),
|
|
225
|
-
propsOrder: Object.keys(props)
|
|
226
|
-
}), console.groupEnd());
|
|
198
|
+
), log({ propsIn, props, state, staticConfig, elementType, themeStateProps }), log({ contextProps: styledContextProps, overriddenContextProps }), log({ presence, isAnimated, isHOC, hasAnimationProp, useAnimations }), console.groupEnd());
|
|
227
199
|
}
|
|
228
200
|
process.env.NODE_ENV === "development" && time && time`pre-theme-media`;
|
|
229
201
|
const [themeState, theme] = useThemeWithState(themeStateProps);
|
|
@@ -235,13 +207,12 @@ function createComponent(staticConfig) {
|
|
|
235
207
|
const resolveValues = (
|
|
236
208
|
// if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
|
|
237
209
|
isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
|
|
238
|
-
),
|
|
210
|
+
), styleProps = {
|
|
239
211
|
mediaState,
|
|
240
212
|
noClassNames,
|
|
241
213
|
resolveValues,
|
|
242
214
|
isExiting,
|
|
243
|
-
isAnimated
|
|
244
|
-
keepStyleSSR
|
|
215
|
+
isAnimated
|
|
245
216
|
}, splitStyles = useSplitStyles(
|
|
246
217
|
props,
|
|
247
218
|
staticConfig,
|
|
@@ -254,15 +225,12 @@ function createComponent(staticConfig) {
|
|
|
254
225
|
elementType,
|
|
255
226
|
debugProp
|
|
256
227
|
);
|
|
257
|
-
props.group && props.untilMeasured === "hide" && !
|
|
228
|
+
props.group && props.untilMeasured === "hide" && !curState.hasMeasured && (splitStyles.style.opacity = 0), process.env.NODE_ENV === "development" && time && time`split-styles`, curState.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
258
229
|
const isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = didGetVariableValue() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
|
|
259
230
|
setMediaShouldUpdate(stateRef, {
|
|
260
231
|
enabled: shouldListenForMedia,
|
|
261
232
|
keys: mediaListeningKeys
|
|
262
233
|
});
|
|
263
|
-
const isAnimatedReactNativeWeb = hasAnimationProp && isReactNative;
|
|
264
|
-
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && (console.groupCollapsed(">>>"), log("props in", propsIn, "mapped to", props, "in order", Object.keys(props)), log("splitStyles", splitStyles), log("media", { shouldListenForMedia, isMediaArray, mediaListeningKeys }), log("className", Object.values(splitStyles.classNames)), isClient && log("ref", hostRef, "(click to view)"), console.groupEnd(), debugProp === "break"))
|
|
265
|
-
debugger;
|
|
266
234
|
const {
|
|
267
235
|
viewProps: viewPropsIn,
|
|
268
236
|
pseudos,
|
|
@@ -271,12 +239,14 @@ function createComponent(staticConfig) {
|
|
|
271
239
|
space
|
|
272
240
|
} = splitStyles, propsWithAnimation = props;
|
|
273
241
|
let animationStyles;
|
|
274
|
-
if (
|
|
242
|
+
if (
|
|
243
|
+
// if it supports css vars we run it on server too to get matching initial style
|
|
244
|
+
(supportsCSSVars ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC
|
|
245
|
+
) {
|
|
275
246
|
const animations = useAnimations({
|
|
276
247
|
props: propsWithAnimation,
|
|
277
248
|
// if hydrating, send empty style
|
|
278
249
|
style: splitStylesStyle,
|
|
279
|
-
// style: splitStylesStyle,
|
|
280
250
|
presence,
|
|
281
251
|
componentState: state,
|
|
282
252
|
styleProps,
|
|
@@ -285,7 +255,7 @@ function createComponent(staticConfig) {
|
|
|
285
255
|
hostRef,
|
|
286
256
|
staticConfig
|
|
287
257
|
});
|
|
288
|
-
isAnimated && animations && (animationStyles = animations.style), process.env.NODE_ENV === "development" && time && time`animations`;
|
|
258
|
+
(isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style), process.env.NODE_ENV === "development" && time && time`animations`;
|
|
289
259
|
}
|
|
290
260
|
const {
|
|
291
261
|
asChild,
|
|
@@ -330,7 +300,12 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
330
300
|
layout: e.nativeEvent.layout
|
|
331
301
|
}), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState((prev) => ({ ...prev })), stateRef.current.hasMeasured = !0;
|
|
332
302
|
}
|
|
333
|
-
)),
|
|
303
|
+
)), viewProps = hooks.usePropsTransform?.(
|
|
304
|
+
elementType,
|
|
305
|
+
nonTamaguiProps,
|
|
306
|
+
hostRef,
|
|
307
|
+
curState.willHydrate
|
|
308
|
+
) ?? nonTamaguiProps;
|
|
334
309
|
const composedRef = useComposedRefs(hostRef, forwardedRef);
|
|
335
310
|
viewProps.ref = composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && isWeb && !isHOC && Children.toArray(props.children).forEach((item) => {
|
|
336
311
|
typeof item == "string" && item !== `
|
|
@@ -338,18 +313,12 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
338
313
|
`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`
|
|
339
314
|
);
|
|
340
315
|
}), process.env.NODE_ENV === "development" && time && time`events-hooks`;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
unPress = useCallback(unPress, []);
|
|
346
|
-
const shouldSetMounted = needsMount && state.unmounted, { pseudoGroups, mediaGroups } = splitStyles;
|
|
316
|
+
const { pseudoGroups, mediaGroups } = splitStyles;
|
|
317
|
+
curState.unPress || (curState.unPress = () => setStateShallow({ press: !1, pressIn: !1 }));
|
|
318
|
+
const unPress = curState.unPress, shouldEnter = state.unmounted;
|
|
347
319
|
useEffect(() => {
|
|
348
|
-
if (
|
|
349
|
-
|
|
350
|
-
setStateShallow({
|
|
351
|
-
unmounted
|
|
352
|
-
});
|
|
320
|
+
if (shouldEnter) {
|
|
321
|
+
setStateShallow({ unmounted: !1 });
|
|
353
322
|
return;
|
|
354
323
|
}
|
|
355
324
|
let disposeGroupsListener;
|
|
@@ -382,19 +351,17 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
382
351
|
disposeGroupsListener?.(), mouseUps.delete(unPress);
|
|
383
352
|
};
|
|
384
353
|
}, [
|
|
385
|
-
|
|
386
|
-
state.unmounted,
|
|
354
|
+
shouldEnter,
|
|
387
355
|
pseudoGroups ? Object.keys([...pseudoGroups]).join("") : 0,
|
|
388
356
|
mediaGroups ? Object.keys([...mediaGroups]).join("") : 0
|
|
389
357
|
]);
|
|
390
|
-
const avoidAnimationStyle = keepStyleSSR && state.unmounted === !0;
|
|
391
358
|
let fontFamily = isText ? splitStyles.fontFamily || staticConfig.defaultProps?.fontFamily : null;
|
|
392
359
|
fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
|
|
393
|
-
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", style =
|
|
360
|
+
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", style = animationStyles || splitStyles.style;
|
|
394
361
|
let className;
|
|
395
362
|
if (!(asChild === "except-style" || asChild === "except-style-web")) {
|
|
396
363
|
let classList = [];
|
|
397
|
-
if (
|
|
364
|
+
if (componentName2 && classList.push(componentClassName), fontFamilyClassName && classList.push(fontFamilyClassName), classNames && classList.push(Object.values(classNames).join(" ")), groupClassName && classList.push(groupClassName), className = classList.join(" "), isAnimated && !supportsCSSVars && isReactNative)
|
|
398
365
|
viewProps.style = style;
|
|
399
366
|
else if (isReactNative) {
|
|
400
367
|
const cnStyles = { $$css: !0 };
|
|
@@ -484,8 +451,8 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
484
451
|
staticConfig
|
|
485
452
|
)), useChildrenResult ? content = useChildrenResult : content = createElement(elementType, viewProps, content);
|
|
486
453
|
const ResetPresence = config?.animations?.ResetPresence;
|
|
487
|
-
willBeAnimated &&
|
|
488
|
-
const groupState =
|
|
454
|
+
willBeAnimated && hasEnterStyle && ResetPresence && content && typeof content != "string" && (content = /* @__PURE__ */ jsx(ResetPresence, { children: content })), process.env.NODE_ENV === "development" && time && time`create-element`;
|
|
455
|
+
const groupState = curState.group, subGroupContext = useMemo(() => {
|
|
489
456
|
if (!(!groupState || !groupName))
|
|
490
457
|
return groupState.listeners.clear(), {
|
|
491
458
|
...componentContext.groups,
|
|
@@ -493,7 +460,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
493
460
|
state: {
|
|
494
461
|
...componentContext.groups.state,
|
|
495
462
|
[groupName]: {
|
|
496
|
-
pseudo:
|
|
463
|
+
pseudo: defaultComponentStateMounted,
|
|
497
464
|
// capture just initial width and height if they exist
|
|
498
465
|
// will have top, left, width, height (not x, y)
|
|
499
466
|
layout: {
|
|
@@ -506,11 +473,15 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
506
473
|
subscribe: groupState.subscribe
|
|
507
474
|
};
|
|
508
475
|
}, [groupName]);
|
|
509
|
-
if (groupName && subGroupContext && (content = /* @__PURE__ */ jsx(ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : getThemedChildren(themeState, content, themeStateProps, !1), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ jsx(ThemeDebug, { themeState, themeProps: props, children: content })), isReactNative && (content = /* @__PURE__ */ jsx(
|
|
476
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */ jsx(ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : getThemedChildren(themeState, content, themeStateProps, !1), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ jsx(ThemeDebug, { themeState, themeProps: props, children: content })), isReactNative && !asChild && !isHOC && (content = /* @__PURE__ */ jsx(
|
|
510
477
|
"span",
|
|
511
478
|
{
|
|
512
|
-
|
|
513
|
-
|
|
479
|
+
...isHydrated ? {
|
|
480
|
+
className: "_dsp_contents",
|
|
481
|
+
...events && getWebEvents(events)
|
|
482
|
+
} : {
|
|
483
|
+
className: "_dsp_contents"
|
|
484
|
+
},
|
|
514
485
|
children: content
|
|
515
486
|
}
|
|
516
487
|
)), staticConfig.context) {
|
|
@@ -525,16 +496,16 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
525
496
|
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
526
497
|
console.groupCollapsed(`render <${typeof elementType == "string" ? elementType : "Component"} /> (${internalID}) with props`);
|
|
527
498
|
try {
|
|
528
|
-
log("viewProps", viewProps), log("
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
499
|
+
log("viewProps", viewProps), log("children", content), typeof window < "u" && (log("props in", propsIn, "mapped to", props, "in order", Object.keys(props)), log({
|
|
500
|
+
shouldListenForMedia,
|
|
501
|
+
mediaListeningKeys,
|
|
502
|
+
isMediaArray,
|
|
532
503
|
viewProps,
|
|
504
|
+
hostRef,
|
|
533
505
|
state,
|
|
534
506
|
styleProps,
|
|
535
507
|
themeState,
|
|
536
508
|
isAnimated,
|
|
537
|
-
isAnimatedReactNativeWeb,
|
|
538
509
|
defaultProps,
|
|
539
510
|
splitStyles,
|
|
540
511
|
animationStyles,
|
|
@@ -555,10 +526,11 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
555
526
|
elementType,
|
|
556
527
|
initialState,
|
|
557
528
|
classNames
|
|
558
|
-
});
|
|
529
|
+
}));
|
|
559
530
|
} catch {
|
|
560
531
|
}
|
|
561
|
-
console.groupEnd(),
|
|
532
|
+
if (console.groupEnd(), debugProp === "break")
|
|
533
|
+
debugger;
|
|
562
534
|
}
|
|
563
535
|
return process.env.NODE_ENV === "development" && time && (time`rest`, globalThis.willPrint || (globalThis.willPrint = !0, setTimeout(() => {
|
|
564
536
|
delete globalThis.willPrint, time.print(), time = null;
|