@tamagui/web 1.112.1 → 1.112.3
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 +6 -141
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createComponent.native.js +8 -143
- package/dist/cjs/createComponent.native.js.map +2 -2
- package/dist/cjs/createTamagui.js +2 -3
- package/dist/cjs/createTamagui.js.map +1 -1
- package/dist/cjs/createTamagui.native.js +2 -5
- package/dist/cjs/createTamagui.native.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +2 -2
- package/dist/cjs/helpers/getSplitStyles.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +2 -2
- package/dist/cjs/helpers/getSplitStyles.native.js.map +2 -2
- package/dist/cjs/helpers/getThemeCSSRules.js +2 -2
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.js +1 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +2 -2
- package/dist/cjs/helpers/setElementProps.js +4 -1
- package/dist/cjs/helpers/setElementProps.js.map +1 -1
- package/dist/cjs/helpers/sortString.js +21 -0
- package/dist/cjs/helpers/sortString.js.map +6 -0
- package/dist/cjs/helpers/sortString.native.js +28 -0
- package/dist/cjs/helpers/sortString.native.js.map +6 -0
- package/dist/cjs/helpers/subscribeToContextGroup.js +53 -0
- package/dist/cjs/helpers/subscribeToContextGroup.js.map +6 -0
- package/dist/cjs/helpers/subscribeToContextGroup.native.js +52 -0
- package/dist/cjs/helpers/subscribeToContextGroup.native.js.map +6 -0
- package/dist/cjs/hooks/useComponentState.js +113 -0
- package/dist/cjs/hooks/useComponentState.js.map +6 -0
- package/dist/cjs/hooks/useComponentState.native.js +127 -0
- package/dist/cjs/hooks/useComponentState.native.js.map +6 -0
- package/dist/cjs/hooks/useProps.js +3 -3
- package/dist/cjs/hooks/useProps.js.map +1 -1
- package/dist/cjs/hooks/useProps.native.js +3 -3
- package/dist/cjs/hooks/useProps.native.js.map +1 -1
- package/dist/cjs/setupHooks.js.map +1 -1
- package/dist/cjs/setupHooks.native.js +1 -1
- package/dist/cjs/setupHooks.native.js.map +1 -1
- package/dist/cjs/subscribeToContextGroup.js +53 -0
- package/dist/cjs/subscribeToContextGroup.js.map +6 -0
- package/dist/cjs/subscribeToContextGroup.native.js +52 -0
- package/dist/cjs/subscribeToContextGroup.native.js.map +6 -0
- package/dist/esm/createComponent.js +8 -151
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.mjs +18 -182
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +20 -200
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createTamagui.js +2 -3
- package/dist/esm/createTamagui.js.map +1 -1
- package/dist/esm/createTamagui.mjs +2 -5
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +2 -5
- package/dist/esm/createTamagui.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +2 -1
- package/dist/esm/helpers/getSplitStyles.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +2 -1
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +2 -1
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +2 -1
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs +2 -1
- package/dist/esm/helpers/getThemeCSSRules.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js +1 -1
- package/dist/esm/helpers/insertStyleRule.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/setElementProps.js +4 -1
- package/dist/esm/helpers/setElementProps.js.map +1 -1
- package/dist/esm/helpers/setElementProps.mjs +4 -1
- package/dist/esm/helpers/setElementProps.mjs.map +1 -1
- package/dist/esm/helpers/sortString.js +5 -0
- package/dist/esm/helpers/sortString.js.map +6 -0
- package/dist/esm/helpers/sortString.mjs +3 -0
- package/dist/esm/helpers/sortString.mjs.map +1 -0
- package/dist/esm/helpers/sortString.native.js +5 -0
- package/dist/esm/helpers/sortString.native.js.map +1 -0
- package/dist/esm/helpers/subscribeToContextGroup.js +38 -0
- package/dist/esm/helpers/subscribeToContextGroup.js.map +6 -0
- package/dist/esm/helpers/subscribeToContextGroup.mjs +38 -0
- package/dist/esm/helpers/subscribeToContextGroup.mjs.map +1 -0
- package/dist/esm/helpers/subscribeToContextGroup.native.js +42 -0
- package/dist/esm/helpers/subscribeToContextGroup.native.js.map +1 -0
- package/dist/esm/hooks/useComponentState.js +107 -0
- package/dist/esm/hooks/useComponentState.js.map +6 -0
- package/dist/esm/hooks/useComponentState.mjs +135 -0
- package/dist/esm/hooks/useComponentState.mjs.map +1 -0
- package/dist/esm/hooks/useComponentState.native.js +147 -0
- package/dist/esm/hooks/useComponentState.native.js.map +1 -0
- package/dist/esm/hooks/useProps.js +2 -1
- package/dist/esm/hooks/useProps.js.map +1 -1
- package/dist/esm/hooks/useProps.mjs +2 -1
- package/dist/esm/hooks/useProps.mjs.map +1 -1
- package/dist/esm/hooks/useProps.native.js +2 -1
- package/dist/esm/hooks/useProps.native.js.map +1 -1
- package/dist/esm/setupHooks.js.map +1 -1
- package/dist/esm/setupHooks.mjs.map +1 -1
- package/dist/esm/setupHooks.native.js +0 -1
- package/dist/esm/setupHooks.native.js.map +1 -1
- package/dist/esm/subscribeToContextGroup.js +38 -0
- package/dist/esm/subscribeToContextGroup.js.map +6 -0
- package/dist/esm/subscribeToContextGroup.mjs +38 -0
- package/dist/esm/subscribeToContextGroup.mjs.map +1 -0
- package/dist/esm/subscribeToContextGroup.native.js +42 -0
- package/dist/esm/subscribeToContextGroup.native.js.map +1 -0
- package/package.json +12 -12
- package/src/createComponent.tsx +6 -316
- package/src/createTamagui.ts +11 -4
- package/src/helpers/getSplitStyles.tsx +2 -1
- package/src/helpers/getThemeCSSRules.ts +2 -1
- package/src/helpers/insertStyleRule.tsx +3 -1
- package/src/helpers/setElementProps.tsx +5 -1
- package/src/helpers/sortString.ts +1 -0
- package/src/helpers/subscribeToContextGroup.tsx +56 -0
- package/src/hooks/useComponentState.ts +258 -0
- package/src/hooks/useProps.tsx +2 -2
- package/src/setupHooks.ts +4 -5
- package/types/createComponent.d.ts +1 -30
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/setElementProps.d.ts +1 -1
- package/types/helpers/setElementProps.d.ts.map +1 -1
- package/types/helpers/sortString.d.ts +2 -0
- package/types/helpers/sortString.d.ts.map +1 -0
- package/types/helpers/subscribeToContextGroup.d.ts +10 -0
- package/types/helpers/subscribeToContextGroup.d.ts.map +1 -0
- package/types/hooks/useComponentState.d.ts +22 -0
- package/types/hooks/useComponentState.d.ts.map +1 -0
- package/types/hooks/useProps.d.ts.map +1 -1
- package/types/setupHooks.d.ts +3 -2
- package/types/setupHooks.d.ts.map +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var useComponentState_exports = {};
|
|
17
|
+
__export(useComponentState_exports, {
|
|
18
|
+
useComponentState: () => useComponentState
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(useComponentState_exports);
|
|
21
|
+
var import_defaultComponentState = require("../defaultComponentState"), import_useDidHydrateOnce = require("../hooks/useDidHydrateOnce"), import_react = require("react"), import_constants = require("@tamagui/constants"), import_createShallowSetState = require("../helpers/createShallowSetState"), import_isObj = require("../helpers/isObj"), import_log = require("../helpers/log"), useComponentState = function(props, param, staticConfig, config) {
|
|
22
|
+
var { animationDriver, groups } = param, _animationDriver_usePresence, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react.useRef)(void 0);
|
|
23
|
+
stateRef.current || (stateRef.current = {});
|
|
24
|
+
var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = function() {
|
|
25
|
+
var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
|
|
26
|
+
return !!(next || curStateRef.hasAnimated);
|
|
27
|
+
}(), willBeAnimated = !import_constants.isServer && willBeAnimatedClient;
|
|
28
|
+
willBeAnimated && !curStateRef.hasAnimated && (curStateRef.hasAnimated = !0);
|
|
29
|
+
var presence = willBeAnimated && props.animatePresence !== !1 && (animationDriver == null || (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null, presenceState = presence == null ? void 0 : presence[2], isExiting = (presenceState == null ? void 0 : presenceState.isPresent) === !1, isEntering = (presenceState == null ? void 0 : presenceState.isPresent) === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasRNAnimation = hasAnimationProp && (animationDriver == null ? void 0 : animationDriver.isReactNative), hasEnterState = hasEnterStyle || isEntering, didHydrateOnce = willBeAnimated ? (0, import_useDidHydrateOnce.useDidHydrateOnce)() : !0, shouldEnter = hasEnterState || !didHydrateOnce && hasRNAnimation, shouldEnterFromUnhydrated = import_constants.isWeb && !didHydrateOnce, initialState = shouldEnter ? (
|
|
30
|
+
// on the very first render we switch all spring animation drivers to css rendering
|
|
31
|
+
// this is because we need to use css variables, which they don't support to do proper SSR
|
|
32
|
+
// without flickers of the wrong colors.
|
|
33
|
+
// but once we do that initial hydration and we are in client side rendering mode,
|
|
34
|
+
// we can avoid the extra re-render on mount
|
|
35
|
+
shouldEnterFromUnhydrated ? import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateShouldEnter
|
|
36
|
+
) : import_defaultComponentState.defaultComponentStateMounted, disabled = isDisabled(props);
|
|
37
|
+
disabled != null && (initialState.disabled = disabled);
|
|
38
|
+
var states = (0, import_react.useState)(initialState), state = props.forceStyle ? {
|
|
39
|
+
...states[0],
|
|
40
|
+
[props.forceStyle]: !0
|
|
41
|
+
} : states[0], setState = states[1], isHydrated = state.unmounted === !1 || state.unmounted === "should-enter", isAnimated = willBeAnimated;
|
|
42
|
+
import_constants.isWeb && hasRNAnimation && !staticConfig.isHOC && state.unmounted === !0 && (isAnimated = !1, curStateRef.willHydrate = !0), disabled !== state.disabled && (state.disabled = disabled, disabled && Object.assign(state, import_defaultComponentState.defaultComponentStateMounted), setState({
|
|
43
|
+
...state
|
|
44
|
+
}));
|
|
45
|
+
var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled, !1, props.debug);
|
|
46
|
+
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
47
|
+
process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`has presenceState ${JSON.stringify(presenceState)}`);
|
|
48
|
+
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
49
|
+
(0, import_isObj.isObj)(custom) && Object.assign(props, custom);
|
|
50
|
+
var exv = exitVariant ?? enterExitVariant, env = enterVariant ?? enterExitVariant;
|
|
51
|
+
state.unmounted && env && staticConfig.variants[env] ? (process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`Animating presence ENTER "${env}"`), props[env] = !0) : isExiting && exv && (process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`Animating presence EXIT "${exv}"`), props[exv] = exitVariant !== enterExitVariant);
|
|
52
|
+
}
|
|
53
|
+
var shouldAvoidClasses = !import_constants.isWeb;
|
|
54
|
+
if (import_constants.isWeb) {
|
|
55
|
+
var { disableClassName } = props, isAnimatedAndHydrated = isAnimated && !supportsCSSVars && didHydrateOnce && !import_constants.isServer, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || didHydrateOnce), isDisabledManually = disableClassName && !import_constants.isServer && didHydrateOnce && state.unmounted === !0;
|
|
56
|
+
(isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0, process.env.NODE_ENV === "development" && props.debug && (0, import_log.log)("avoiding className", {
|
|
57
|
+
isAnimatedAndHydrated,
|
|
58
|
+
isDisabledManually,
|
|
59
|
+
isClassNameDisabled
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
var groupName = props.group;
|
|
63
|
+
if (groupName && !curStateRef.group) {
|
|
64
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
65
|
+
curStateRef.group = {
|
|
66
|
+
listeners,
|
|
67
|
+
emit(name, state2) {
|
|
68
|
+
listeners.forEach(function(l) {
|
|
69
|
+
return l(name, state2);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
subscribe(cb) {
|
|
73
|
+
return listeners.add(cb), function() {
|
|
74
|
+
listeners.delete(cb);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (groupName) {
|
|
80
|
+
var groupContextState = groups.state, og = setStateShallow;
|
|
81
|
+
setStateShallow = function(state2) {
|
|
82
|
+
og(state2), curStateRef.group.emit(groupName, {
|
|
83
|
+
pseudo: state2
|
|
84
|
+
});
|
|
85
|
+
var next = {
|
|
86
|
+
...groupContextState[groupName],
|
|
87
|
+
...state2
|
|
88
|
+
};
|
|
89
|
+
groupContextState[groupName] = next;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
curStateRef,
|
|
94
|
+
disabled,
|
|
95
|
+
groupName,
|
|
96
|
+
hasAnimationProp,
|
|
97
|
+
hasEnterStyle,
|
|
98
|
+
isAnimated,
|
|
99
|
+
isExiting,
|
|
100
|
+
isHydrated,
|
|
101
|
+
presence,
|
|
102
|
+
presenceState,
|
|
103
|
+
setState,
|
|
104
|
+
setStateShallow,
|
|
105
|
+
shouldAvoidClasses,
|
|
106
|
+
state,
|
|
107
|
+
stateRef,
|
|
108
|
+
supportsCSSVars,
|
|
109
|
+
willBeAnimated,
|
|
110
|
+
willBeAnimatedClient
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
function hasAnimatedStyleValue(style) {
|
|
114
|
+
return Object.keys(style).some(function(k) {
|
|
115
|
+
var val = style[k];
|
|
116
|
+
return val && typeof val == "object" && "_animation" in val;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
var isDisabled = function(props) {
|
|
120
|
+
var _props_accessibilityState;
|
|
121
|
+
return props.disabled || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props["aria-disabled"] || props.accessibilityDisabled || !1;
|
|
122
|
+
};
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
useComponentState
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=useComponentState.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/Users/n8/tamagui/code/core/web/src/hooks/useComponentState.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;mCAIO,qCACP,2BAAkC,uCAClC,eAAiC,kBAYjC,mBAAgC,+BAChC,+BAAsC,6CACtC,eAAsB,6BACtB,aAAoB,2BAEPA,oBAAoB,SAC/BC,OAAAA,OAEAC,cACAC,QAAAA;MAFA,EAAEC,iBAAiBC,OAAM,IAAqB,OAsC1CD,8BAlCEE,gBAAgBF,mBAAAA,OAAAA,SAAAA,gBAAiBE,eAEjCC,eAAWC,qBACfC,MAAAA;AAEF,EAAKF,SAASG,YACZH,SAASG,UAAU,CAAC;AAItB,MAAMC,mBAAmBC,GACvB,eAAeX,SAAUA,MAAMY,SAASC,sBAAsBb,MAAMY,KAAK,IAIrEE,kBAAkBX,mBAAAA,OAAAA,SAAAA,gBAAiBW,iBACnCC,cAAcT,SAASG,SAEvBO,uBAAwB,WAAA;AAC5B,QAAMC,OAAO,CAAC,EAAEP,oBAAoB,CAACT,aAAaiB,SAASb;AAC3D,WAAOM,GAAQM,QAAQF,YAAYI;EACrC,EAAA,GAEMC,iBAAiB,CAACC,6BAAYL;AAGpC,EAAII,kBAAkB,CAACL,YAAYI,gBACjCJ,YAAYI,cAAc;AAI5B,MAAMG,WACHF,kBACCpB,MAAM,oBAAuB,OAC7BG,mBAAAA,SAAAA,+BAAAA,gBAAiBoB,iBAAW,QAA5BpB,iCAAAA,SAAAA,SAAAA,6BAAAA,KAAAA,eAAAA,MACF,MACIqB,gBAAgBF,YAAAA,OAAAA,SAAAA,SAAW,CAAA,GAC3BG,aAAYD,iBA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A,GACP,WAAA;AACLP,oBAAUS,OAAOF,EAAAA;QACnB;MACF;IACF;EACF;AAEA,MAAIT,WAAW;AAEb,QAAMY,oBAAoBzF,OAAO2C,OAC3B+C,KAAKtC;AACXA,sBAAkB,SAACT,QAAAA;AACjB+C,SAAG/C,MAAAA,GACHhC,YAAYmE,MAAOG,KAAKJ,WAAW;QACjCc,QAAQhD;MACV,CAAA;AAEA,UAAM9B,OAAO;QACX,GAAG4E,kBAAkBZ,SAAAA;QACrB,GAAGlC;MACL;AACA8C,wBAAkBZ,SAAAA,IAAahE;IACjC;EACF;AAEA,SAAO;IACLF;IACA4B;IACAsC;IACAvE;IACAmB;IACAuB;IACA3B;IACAyB;IACA5B;IACAE;IACAyB;IACAO;IACAiB;IACA1B;IACAzC;IACAQ;IACAM;IACAJ;EACF;AACF;AAEA,SAASH,sBAAsBD,OAAa;AAC1C,SAAO0C,OAAO0C,KAAKpF,KAAAA,EAAOqF,KAAK,SAACC,GAAAA;AAC9B,QAAMC,MAAMvF,MAAMsF,CAAAA;AAClB,WAAOC,OAAO,OAAOA,OAAQ,YAAY,gBAAgBA;EAC3D,CAAA;AACF;AAEA,IAAMvD,aAAa,SAAC5C,OAAAA;MAGhBA;AAFF,SACEA,MAAM2C,cACN3C,4BAAAA,MAAMoG,wBAAkB,QAAxBpG,8BAAAA,SAAAA,SAAAA,0BAA0B2C,aAC1B3C,MAAM,eAAA,KACNA,MAAMqG,yBACN;AAEJ;",
|
|
5
|
+
"names": ["useComponentState", "props", "staticConfig", "config", "animationDriver", "groups", "useAnimations", "stateRef", "useRef", "undefined", "current", "hasAnimationProp", "Boolean", "style", "hasAnimatedStyleValue", "supportsCSSVars", "curStateRef", "willBeAnimatedClient", "next", "isHOC", "hasAnimated", "willBeAnimated", "isServer", "presence", "usePresence", "presenceState", "isExiting", "isPresent", "isEntering", "initial", "hasEnterStyle", "enterStyle", "hasRNAnimation", "isReactNative", "hasEnterState", "didHydrateOnce", "useDidHydrateOnce", "shouldEnter", "shouldEnterFromUnhydrated", "isWeb", "initialState", "defaultComponentState", "defaultComponentStateShouldEnter", "defaultComponentStateMounted", "disabled", "isDisabled", "states", "useState", "state", "forceStyle", "setState", "isHydrated", "unmounted", "isAnimated", "willHydrate", "Object", "assign", "setStateShallow", "createShallowSetState", "debug", "variants", "process", "env", "NODE_ENV", "console", "warn", "JSON", "stringify", "enterVariant", "exitVariant", "enterExitVariant", "custom", "isObj", "exv", "shouldAvoidClasses", "disableClassName", "isAnimatedAndHydrated", "isClassNameDisabled", "acceptsClassName", "disableSSR", "isDisabledManually", "log", "groupName", "group", "listeners", "Set", "emit", "name", "forEach", "l", "subscribe", "cb", "add", "delete", "groupContextState", "og", "pseudo", "keys", "some", "k", "val", "accessibilityState", "accessibilityDisabled"]
|
|
6
|
+
}
|
|
@@ -27,7 +27,7 @@ __export(useProps_exports, {
|
|
|
27
27
|
useStyle: () => useStyle
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(useProps_exports);
|
|
30
|
-
var import_react = __toESM(require("react")), import_config = require("../config"), import_ComponentContext = require("../contexts/ComponentContext"),
|
|
30
|
+
var import_react = __toESM(require("react")), import_config = require("../config"), import_ComponentContext = require("../contexts/ComponentContext"), import_getSplitStyles = require("../helpers/getSplitStyles"), import_subscribeToContextGroup = require("../helpers/subscribeToContextGroup"), import_Stack = require("../views/Stack"), import_useComponentState = require("./useComponentState"), import_useMedia = require("./useMedia"), import_useTheme = require("./useTheme");
|
|
31
31
|
function useProps(props, opts) {
|
|
32
32
|
const [propsOut, styleOut] = usePropsAndStyle(props, {
|
|
33
33
|
...opts,
|
|
@@ -48,7 +48,7 @@ function usePropsAndStyle(props, opts) {
|
|
|
48
48
|
componentName: staticConfig.componentName,
|
|
49
49
|
name: "theme" in props ? props.theme : void 0,
|
|
50
50
|
inverse: "themeInverse" in props ? props.themeInverse : void 0
|
|
51
|
-
}), componentContext = import_react.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0,
|
|
51
|
+
}), componentContext = import_react.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(
|
|
52
52
|
props,
|
|
53
53
|
componentContext,
|
|
54
54
|
staticConfig,
|
|
@@ -77,7 +77,7 @@ function usePropsAndStyle(props, opts) {
|
|
|
77
77
|
setStateShallow({ unmounted: !1 });
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
return (0,
|
|
80
|
+
return (0, import_subscribeToContextGroup.subscribeToContextGroup)({
|
|
81
81
|
disabled,
|
|
82
82
|
componentContext,
|
|
83
83
|
setStateShallow,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useProps.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,gBAA0B,sBAC1B,0BAAiC,yCACjC,wBAA+B,sCAC/B,iCAAwC,+CAExC,eAAsB,2BAEtB,2BAAkC,gCAClC,kBAAyB,uBACzB,kBAAkC;AAyB3B,SAAS,SACd,OACA,MAC4B;AAC5B,QAAM,CAAC,UAAU,QAAQ,IAAI,iBAAiB,OAAO;AAAA,IACnD,GAAG;AAAA,IACH,UAAU;AAAA,IACV,aAAa;AAAA,IACb,eAAe;AAAA,EACjB,CAAC;AACD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAQO,SAAS,SACd,OACA,MAC4B;AAC5B,SAAO,iBAAiB,OAAO,IAAI,EAAE,CAAC,KAAK,CAAC;AAC9C;AAQO,SAAS,iBACd,OACA,MACsF;AACtF,QAAM,eAAe,MAAM,cAAc,gBAAgB,mBAAM,cACzD,CAAC,YAAY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useStyle
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(useProps_exports);
|
|
31
|
-
var import_react = __toESM(require("react")), import_config = require("../config"), import_ComponentContext = require("../contexts/ComponentContext"),
|
|
31
|
+
var import_react = __toESM(require("react")), import_config = require("../config"), import_ComponentContext = require("../contexts/ComponentContext"), import_getSplitStyles = require("../helpers/getSplitStyles"), import_subscribeToContextGroup = require("../helpers/subscribeToContextGroup"), import_Stack = require("../views/Stack"), import_useComponentState = require("./useComponentState"), import_useMedia = require("./useMedia"), import_useTheme = require("./useTheme");
|
|
32
32
|
function useProps(props, opts) {
|
|
33
33
|
var [propsOut, styleOut] = usePropsAndStyle(props, {
|
|
34
34
|
...opts,
|
|
@@ -49,7 +49,7 @@ function usePropsAndStyle(props, opts) {
|
|
|
49
49
|
componentName: staticConfig.componentName,
|
|
50
50
|
name: "theme" in props ? props.theme : void 0,
|
|
51
51
|
inverse: "themeInverse" in props ? props.themeInverse : void 0
|
|
52
|
-
}), componentContext = import_react.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0,
|
|
52
|
+
}), componentContext = import_react.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, {
|
|
53
53
|
isAnimated: !1,
|
|
54
54
|
mediaState: media,
|
|
55
55
|
noSkip: !0,
|
|
@@ -66,7 +66,7 @@ function usePropsAndStyle(props, opts) {
|
|
|
66
66
|
});
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
return (0,
|
|
69
|
+
return (0, import_subscribeToContextGroup.subscribeToContextGroup)({
|
|
70
70
|
disabled,
|
|
71
71
|
componentContext,
|
|
72
72
|
setStateShallow,
|
|
@@ -1,6 +1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BAAcC,sCAClBhC,OACAU,cACAG,SACAJ,oBAAAA,WAAWe,WAAK,QAAhBf,sBAAAA,SAAAA,SAAAA,kBAAkBO,SAAQ,IAC1BQ,OACA;IACES,YAAY;IACZC,YAAYL;IACZM,QAAQ;IACRC,cAAc;IACdC,cAAc;IACd9B,eAAe;IACf,GAAGN;EACL,GACA,MACAmB,gBAAAA,GAGI,EAAEkB,aAAaC,aAAY,IAAKR;AAEtCV,sBAAAA,QAAMmB,UAAU,WAAA;AACd,QAAIf,WAIJ;UAAID,MAAMiB,WAAW;AACnBf,wBAAgB;UAAEe,WAAW;QAAM,CAAA;AACnC;MACF;AAEA,iBAAOC,wDAAwB;QAC7BjB;QACAL;QACAM;QACAF;QACAc;QACAC;MACF,CAAA;;EACF,GAAG;IACDd;IACAc,eAAeI,OAAOC,KAAK;SAAIL;KAAa,EAAEM,KAAK,EAAA,IAAM;IACzDP,cAAcK,OAAOC,KAAK;SAAIN;KAAY,EAAEO,KAAK,EAAA,IAAM;GACxD,GAEM;IAACd,YAAYe;IAAWf,YAAYgB,SAAS,CAAC;IAAGlC;IAAOgB;;AACjE;",
|
|
5
5
|
"names": ["useProps", "props", "opts", "propsOut", "styleOut", "usePropsAndStyle", "noExpand", "noNormalize", "resolveValues", "useStyle", "themeState", "staticConfig", "forComponent", "Stack", "theme", "useThemeWithState", "componentName", "name", "undefined", "inverse", "themeInverse", "componentContext", "React", "useContext", "ComponentContext", "state", "disabled", "setStateShallow", "useComponentState", "getConfig", "media", "useMedia", "splitStyles", "useSplitStyles", "isAnimated", "mediaState", "noSkip", "noMergeStyle", "noClassNames", "mediaGroups", "pseudoGroups", "useEffect", "unmounted", "subscribeToContextGroup", "Object", "keys", "join", "viewProps", "style"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/setupHooks.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,QAAuB,CAAC;AAG9B,SAAS,WAAW,MAAqB;AAC9C,SAAO,OAAO,OAAO,IAAI;AAC3B;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -19,7 +19,7 @@ __export(setupHooks_exports, {
|
|
|
19
19
|
setupHooks: () => setupHooks
|
|
20
20
|
});
|
|
21
21
|
module.exports = __toCommonJS(setupHooks_exports);
|
|
22
|
-
var
|
|
22
|
+
var hooks = {};
|
|
23
23
|
function setupHooks(next) {
|
|
24
24
|
Object.assign(hooks, next);
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/core/web/src/setupHooks.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAIA;;;;;;AAAO,IAAMA,QAAuB,CAAC;AAG9B,SAASC,WAAWC,MAAmB;AAC5CC,SAAOC,OAAOJ,OAAOE,IAAAA;AACvB;",
|
|
5
5
|
"names": ["hooks", "setupHooks", "next", "Object", "assign"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var subscribeToContextGroup_exports = {};
|
|
16
|
+
__export(subscribeToContextGroup_exports, {
|
|
17
|
+
subscribeToContextGroup: () => subscribeToContextGroup
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(subscribeToContextGroup_exports);
|
|
20
|
+
var import_createShallowSetState = require("./helpers/createShallowSetState"), import_useMedia = require("./hooks/useMedia");
|
|
21
|
+
const subscribeToContextGroup = ({
|
|
22
|
+
disabled = !1,
|
|
23
|
+
setStateShallow,
|
|
24
|
+
pseudoGroups,
|
|
25
|
+
mediaGroups,
|
|
26
|
+
componentContext,
|
|
27
|
+
state
|
|
28
|
+
}) => {
|
|
29
|
+
if (pseudoGroups || mediaGroups) {
|
|
30
|
+
const current = {
|
|
31
|
+
pseudo: {},
|
|
32
|
+
media: {}
|
|
33
|
+
};
|
|
34
|
+
return process.env.NODE_ENV === "development" && !componentContext.groups && console.debug("No context group found"), componentContext.groups?.subscribe?.((name, { layout, pseudo }) => {
|
|
35
|
+
if (pseudo && pseudoGroups?.has(String(name)))
|
|
36
|
+
Object.assign(current.pseudo, pseudo), persist();
|
|
37
|
+
else if (layout && mediaGroups) {
|
|
38
|
+
const mediaState = (0, import_useMedia.getMediaState)(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState);
|
|
39
|
+
next !== current.media && (Object.assign(current.media, next), persist());
|
|
40
|
+
}
|
|
41
|
+
function persist() {
|
|
42
|
+
const group = {
|
|
43
|
+
...state.group,
|
|
44
|
+
[name]: current
|
|
45
|
+
};
|
|
46
|
+
setStateShallow({
|
|
47
|
+
group
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=subscribeToContextGroup.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/subscribeToContextGroup.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAuC,4CACvC,kBAA8B;AAGvB,MAAM,0BAA0B,CAAC;AAAA,EACtC,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAOM;AAEJ,MAAI,gBAAgB,aAAa;AAC/B,UAAM,UAAU;AAAA,MACd,QAAQ,CAAC;AAAA,MACT,OAAO,CAAC;AAAA,IACV;AAEA,WAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,iBAAiB,UAC9D,QAAQ,MAAM,wBAAwB,GAGjC,iBAAiB,QAAQ,YAAY,CAAC,MAAM,EAAE,QAAQ,OAAO,MAAM;AACxE,UAAI,UAAU,cAAc,IAAI,OAAO,IAAI,CAAC;AAE1C,eAAO,OAAO,QAAQ,QAAQ,MAAM,GACpC,QAAQ;AAAA,eACC,UAAU,aAAa;AAChC,cAAM,iBAAa,+BAAc,aAAa,MAAM,GAC9C,WAAO,qDAAuB,QAAQ,OAAO,UAAU;AAC7D,QAAI,SAAS,QAAQ,UACnB,OAAO,OAAO,QAAQ,OAAO,IAAI,GACjC,QAAQ;AAAA,MAEZ;AACA,eAAS,UAAU;AAEjB,cAAM,QAAQ;AAAA,UACZ,GAAG,MAAM;AAAA,UACT,CAAC,IAAI,GAAG;AAAA,QACV;AACA,wBAAgB;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var subscribeToContextGroup_exports = {};
|
|
17
|
+
__export(subscribeToContextGroup_exports, {
|
|
18
|
+
subscribeToContextGroup: () => subscribeToContextGroup
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(subscribeToContextGroup_exports);
|
|
21
|
+
var import_createShallowSetState = require("./helpers/createShallowSetState"), import_useMedia = require("./hooks/useMedia"), subscribeToContextGroup = function(param) {
|
|
22
|
+
var { disabled = !1, setStateShallow, pseudoGroups, mediaGroups, componentContext, state } = param;
|
|
23
|
+
if (pseudoGroups || mediaGroups) {
|
|
24
|
+
var _componentContext_groups_subscribe, _componentContext_groups, current = {
|
|
25
|
+
pseudo: {},
|
|
26
|
+
media: {}
|
|
27
|
+
};
|
|
28
|
+
return process.env.NODE_ENV === "development" && !componentContext.groups && console.debug("No context group found"), (_componentContext_groups = componentContext.groups) === null || _componentContext_groups === void 0 || (_componentContext_groups_subscribe = _componentContext_groups.subscribe) === null || _componentContext_groups_subscribe === void 0 ? void 0 : _componentContext_groups_subscribe.call(_componentContext_groups, function(name, param2) {
|
|
29
|
+
var { layout, pseudo } = param2;
|
|
30
|
+
if (pseudo && (pseudoGroups != null && pseudoGroups.has(String(name))))
|
|
31
|
+
Object.assign(current.pseudo, pseudo), persist();
|
|
32
|
+
else if (layout && mediaGroups) {
|
|
33
|
+
var mediaState = (0, import_useMedia.getMediaState)(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState);
|
|
34
|
+
next !== current.media && (Object.assign(current.media, next), persist());
|
|
35
|
+
}
|
|
36
|
+
function persist() {
|
|
37
|
+
var group = {
|
|
38
|
+
...state.group,
|
|
39
|
+
[name]: current
|
|
40
|
+
};
|
|
41
|
+
setStateShallow({
|
|
42
|
+
group
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
subscribeToContextGroup
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=subscribeToContextGroup.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/core/web/src/subscribeToContextGroup.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;mCAAuC,4CACvC,kBAA8B,6BAGjBA,0BAA0B,SAAA,OAAA;MAAC,EACtCC,WAAW,IACXC,iBACAC,cACAC,aACAC,kBACAC,MAAK,IAQN;AAEC,MAAIH,gBAAgBC,aAAa;QAUxBC,oCAAAA,0BATDE,UAAU;MACdC,QAAQ,CAAC;MACTC,OAAO,CAAC;IACV;AAEA,WAAIC,QAAQC,IAAIC,aAAa,iBAAiB,CAACP,iBAAiBQ,UAC9DC,QAAQC,MAAM,wBAAwB,IAGjCV,2BAAAA,iBAAiBQ,YAAM,QAAvBR,6BAAAA,WAAAA,qCAAAA,yBAAyBW,eAAS,QAAlCX,uCAAAA,SAAAA,SAAAA,mCAAAA,KAAAA,0BAAqC,SAACY,MAAAA,QAAAA;UAAM,EAAEC,QAAQV,OAAM,IAAEW;AACnE,UAAIX,WAAUL,gBAAAA,QAAAA,aAAciB,IAAIC,OAAOJ,IAAAA,CAAAA;AAErCK,eAAOC,OAAOhB,QAAQC,QAAQA,MAAAA,GAC9BgB,QAAAA;eACSN,UAAUd,aAAa;AAChC,YAAMqB,iBAAaC,+BAActB,aAAac,MAAAA,GACxCS,WAAOC,qDAAuBrB,QAAQE,OAAOgB,UAAAA;AACnD,QAAIE,SAASpB,QAAQE,UACnBa,OAAOC,OAAOhB,QAAQE,OAAOkB,IAAAA,GAC7BH,QAAAA;MAEJ;AACA,eAASA,UAAAA;AAEP,YAAMK,QAAQ;UACZ,GAAGvB,MAAMuB;UACT,CAACZ,IAAAA,GAAOV;QACV;AACAL,wBAAgB;UACd2B;QACF,CAAA;MACF;IACF,CAAA;EACF;AACF;",
|
|
5
|
+
"names": ["subscribeToContextGroup", "disabled", "setStateShallow", "pseudoGroups", "mediaGroups", "componentContext", "state", "current", "pseudo", "media", "process", "env", "NODE_ENV", "groups", "console", "debug", "subscribe", "name", "layout", "param", "has", "String", "Object", "assign", "persist", "mediaState", "getMediaState", "next", "mergeIfNotShallowEqual", "group"]
|
|
6
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
3
2
|
import { isClient, isServer, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
3
|
import {
|
|
@@ -7,28 +6,21 @@ import {
|
|
|
7
6
|
composeEventHandlers,
|
|
8
7
|
validStyles
|
|
9
8
|
} from "@tamagui/helpers";
|
|
9
|
+
import React from "react";
|
|
10
10
|
import { devConfig, getConfig, onConfiguredOnce } from "./config";
|
|
11
11
|
import { stackDefaultStyles } from "./constants/constants";
|
|
12
12
|
import { isDevTools } from "./constants/isDevTools";
|
|
13
13
|
import { ComponentContext } from "./contexts/ComponentContext";
|
|
14
14
|
import { didGetVariableValue, setDidGetVariableValue } from "./createVariable";
|
|
15
|
-
import {
|
|
16
|
-
defaultComponentState,
|
|
17
|
-
defaultComponentStateMounted,
|
|
18
|
-
defaultComponentStateShouldEnter
|
|
19
|
-
} from "./defaultComponentState";
|
|
20
|
-
import {
|
|
21
|
-
createShallowSetState,
|
|
22
|
-
mergeIfNotShallowEqual
|
|
23
|
-
} from "./helpers/createShallowSetState";
|
|
15
|
+
import { defaultComponentStateMounted } from "./defaultComponentState";
|
|
24
16
|
import { useSplitStyles } from "./helpers/getSplitStyles";
|
|
25
|
-
import { isObj } from "./helpers/isObj";
|
|
26
17
|
import { log } from "./helpers/log";
|
|
27
18
|
import { mergeProps } from "./helpers/mergeProps";
|
|
28
19
|
import { setElementProps } from "./helpers/setElementProps";
|
|
20
|
+
import { subscribeToContextGroup } from "./helpers/subscribeToContextGroup";
|
|
29
21
|
import { themeable } from "./helpers/themeable";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
22
|
+
import { useComponentState } from "./hooks/useComponentState";
|
|
23
|
+
import { setMediaShouldUpdate, useMedia } from "./hooks/useMedia";
|
|
32
24
|
import { useThemeWithState } from "./hooks/useTheme";
|
|
33
25
|
import { hooks } from "./setupHooks";
|
|
34
26
|
import { Slot } from "./views/Slot";
|
|
@@ -69,93 +61,6 @@ if (typeof document < "u") {
|
|
|
69
61
|
}
|
|
70
62
|
});
|
|
71
63
|
}
|
|
72
|
-
const useComponentState = (props, { animationDriver, groups }, staticConfig, config) => {
|
|
73
|
-
const useAnimations = animationDriver?.useAnimations, stateRef = React.useRef(
|
|
74
|
-
void 0
|
|
75
|
-
);
|
|
76
|
-
stateRef.current || (stateRef.current = {});
|
|
77
|
-
const hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver?.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = !!(!!(hasAnimationProp && !staticConfig.isHOC && useAnimations) || curStateRef.hasAnimated), willBeAnimated = !isServer && willBeAnimatedClient;
|
|
78
|
-
willBeAnimated && !curStateRef.hasAnimated && (curStateRef.hasAnimated = !0);
|
|
79
|
-
const presence = willBeAnimated && props.animatePresence !== !1 && animationDriver?.usePresence?.() || null, presenceState = presence?.[2], isExiting = presenceState?.isPresent === !1, isEntering = presenceState?.isPresent === !0 && presenceState.initial !== !1, hasEnterStyle = !!props.enterStyle, hasRNAnimation = hasAnimationProp && animationDriver?.isReactNative;
|
|
80
|
-
process.env.NODE_ENV === "development" && time && time`pre-use-state`;
|
|
81
|
-
const hasEnterState = hasEnterStyle || isEntering, didHydrateOnce = willBeAnimated ? useDidHydrateOnce() : !0, initialState = hasEnterState || !didHydrateOnce && hasRNAnimation ? (
|
|
82
|
-
// on the very first render we switch all spring animation drivers to css rendering
|
|
83
|
-
// this is because we need to use css variables, which they don't support to do proper SSR
|
|
84
|
-
// without flickers of the wrong colors.
|
|
85
|
-
// but once we do that initial hydration and we are in client side rendering mode,
|
|
86
|
-
// we can avoid the extra re-render on mount
|
|
87
|
-
isWeb && !didHydrateOnce ? defaultComponentState : defaultComponentStateShouldEnter
|
|
88
|
-
) : defaultComponentStateMounted, disabled = isDisabled(props);
|
|
89
|
-
disabled != null && (initialState.disabled = disabled);
|
|
90
|
-
const states = React.useState(initialState), state = props.forceStyle ? { ...states[0], [props.forceStyle]: !0 } : states[0], setState = states[1], isHydrated = state.unmounted === !1 || state.unmounted === "should-enter";
|
|
91
|
-
let isAnimated = willBeAnimated;
|
|
92
|
-
isWeb && hasRNAnimation && !staticConfig.isHOC && state.unmounted === !0 && (isAnimated = !1, curStateRef.willHydrate = !0), disabled !== state.disabled && (state.disabled = disabled, disabled && Object.assign(state, defaultComponentStateMounted), setState({ ...state }));
|
|
93
|
-
let setStateShallow = createShallowSetState(setState, disabled, !1, props.debug);
|
|
94
|
-
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
95
|
-
process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`has presenceState ${JSON.stringify(presenceState)}`);
|
|
96
|
-
const { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
97
|
-
isObj(custom) && Object.assign(props, custom);
|
|
98
|
-
const exv = exitVariant ?? enterExitVariant, env = enterVariant ?? enterExitVariant;
|
|
99
|
-
state.unmounted && env && staticConfig.variants[env] ? (process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`Animating presence ENTER "${env}"`), props[env] = !0) : isExiting && exv && (process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`Animating presence EXIT "${exv}"`), props[exv] = exitVariant !== enterExitVariant);
|
|
100
|
-
}
|
|
101
|
-
let shouldAvoidClasses = !isWeb;
|
|
102
|
-
if (isWeb) {
|
|
103
|
-
const { disableClassName } = props, isAnimatedAndHydrated = isAnimated && !supportsCSSVars && didHydrateOnce && !isServer, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || didHydrateOnce), isDisabledManually = disableClassName && !isServer && didHydrateOnce && state.unmounted === !0;
|
|
104
|
-
(isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0, process.env.NODE_ENV === "development" && props.debug && log("avoiding className", {
|
|
105
|
-
isAnimatedAndHydrated,
|
|
106
|
-
isDisabledManually,
|
|
107
|
-
isClassNameDisabled
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
const groupName = props.group;
|
|
111
|
-
if (groupName && !curStateRef.group) {
|
|
112
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
113
|
-
curStateRef.group = {
|
|
114
|
-
listeners,
|
|
115
|
-
emit(name, state2) {
|
|
116
|
-
listeners.forEach((l) => l(name, state2));
|
|
117
|
-
},
|
|
118
|
-
subscribe(cb) {
|
|
119
|
-
return listeners.add(cb), () => {
|
|
120
|
-
listeners.delete(cb);
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (groupName) {
|
|
126
|
-
const groupContextState = groups.state, og = setStateShallow;
|
|
127
|
-
setStateShallow = (state2) => {
|
|
128
|
-
og(state2), curStateRef.group.emit(groupName, {
|
|
129
|
-
pseudo: state2
|
|
130
|
-
});
|
|
131
|
-
const next = {
|
|
132
|
-
...groupContextState[groupName],
|
|
133
|
-
...state2
|
|
134
|
-
};
|
|
135
|
-
groupContextState[groupName] = next;
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
curStateRef,
|
|
140
|
-
disabled,
|
|
141
|
-
groupName,
|
|
142
|
-
hasAnimationProp,
|
|
143
|
-
hasEnterStyle,
|
|
144
|
-
isAnimated,
|
|
145
|
-
isExiting,
|
|
146
|
-
isHydrated,
|
|
147
|
-
presence,
|
|
148
|
-
presenceState,
|
|
149
|
-
setState,
|
|
150
|
-
setStateShallow,
|
|
151
|
-
shouldAvoidClasses,
|
|
152
|
-
state,
|
|
153
|
-
stateRef,
|
|
154
|
-
supportsCSSVars,
|
|
155
|
-
willBeAnimated,
|
|
156
|
-
willBeAnimatedClient
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
64
|
let BaseText, BaseView;
|
|
160
65
|
const lastInteractionWasKeyboard = { value: !1 };
|
|
161
66
|
isWeb && globalThis.document && (document.addEventListener("keydown", () => {
|
|
@@ -174,14 +79,7 @@ function createComponent(staticConfig) {
|
|
|
174
79
|
defaultForComponent && (defaultProps = { ...defaultForComponent, ...defaultProps });
|
|
175
80
|
}
|
|
176
81
|
});
|
|
177
|
-
const {
|
|
178
|
-
Component,
|
|
179
|
-
isText,
|
|
180
|
-
isZStack,
|
|
181
|
-
isHOC,
|
|
182
|
-
validStyles: validStyles2 = {},
|
|
183
|
-
variants = {}
|
|
184
|
-
} = staticConfig;
|
|
82
|
+
const { Component, isText, isZStack, isHOC } = staticConfig;
|
|
185
83
|
process.env.NODE_ENV === "development" && staticConfig.defaultProps?.debug && process.env.IS_STATIC !== "is_static" && log(`\u{1F41B} [${componentName || "Component"}]`, {
|
|
186
84
|
staticConfig,
|
|
187
85
|
defaultProps,
|
|
@@ -792,53 +690,12 @@ const AbsoluteFill = createComponent({
|
|
|
792
690
|
left: 0,
|
|
793
691
|
pointerEvents: "box-none"
|
|
794
692
|
}
|
|
795
|
-
});
|
|
796
|
-
function hasAnimatedStyleValue(style) {
|
|
797
|
-
return Object.keys(style).some((k) => {
|
|
798
|
-
const val = style[k];
|
|
799
|
-
return val && typeof val == "object" && "_animation" in val;
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
const fromPx = (val) => typeof val != "string" ? val : +val.replace("px", ""), isDisabled = (props) => props.disabled || props.accessibilityState?.disabled || props["aria-disabled"] || props.accessibilityDisabled || !1, subscribeToContextGroup = ({
|
|
803
|
-
disabled = !1,
|
|
804
|
-
setStateShallow,
|
|
805
|
-
pseudoGroups,
|
|
806
|
-
mediaGroups,
|
|
807
|
-
componentContext,
|
|
808
|
-
state
|
|
809
|
-
}) => {
|
|
810
|
-
if (pseudoGroups || mediaGroups) {
|
|
811
|
-
const current = {
|
|
812
|
-
pseudo: {},
|
|
813
|
-
media: {}
|
|
814
|
-
};
|
|
815
|
-
return process.env.NODE_ENV === "development" && !componentContext.groups && console.debug("No context group found"), componentContext.groups?.subscribe?.((name, { layout, pseudo }) => {
|
|
816
|
-
if (pseudo && pseudoGroups?.has(String(name)))
|
|
817
|
-
Object.assign(current.pseudo, pseudo), persist();
|
|
818
|
-
else if (layout && mediaGroups) {
|
|
819
|
-
const mediaState = getMediaState(mediaGroups, layout), next = mergeIfNotShallowEqual(current.media, mediaState);
|
|
820
|
-
next !== current.media && (Object.assign(current.media, next), persist());
|
|
821
|
-
}
|
|
822
|
-
function persist() {
|
|
823
|
-
const group = {
|
|
824
|
-
...state.group,
|
|
825
|
-
[name]: current
|
|
826
|
-
};
|
|
827
|
-
setStateShallow({
|
|
828
|
-
group
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
};
|
|
693
|
+
}), fromPx = (val) => typeof val != "string" ? val : +val.replace("px", "");
|
|
834
694
|
export {
|
|
835
695
|
Spacer,
|
|
836
696
|
Unspaced,
|
|
837
697
|
componentSetStates,
|
|
838
698
|
createComponent,
|
|
839
|
-
|
|
840
|
-
spacedChildren,
|
|
841
|
-
subscribeToContextGroup,
|
|
842
|
-
useComponentState
|
|
699
|
+
spacedChildren
|
|
843
700
|
};
|
|
844
701
|
//# sourceMappingURL=createComponent.js.map
|