@tamagui/web 1.13.4 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.js +2 -2
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/helpers/ThemeManager.js +1 -1
- package/dist/cjs/helpers/ThemeManager.js.map +3 -3
- package/dist/cjs/helpers/getSplitStyles.js +2 -2
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +1 -1
- package/dist/cjs/hooks/useTheme.js.map +3 -3
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Theme.js +1 -1
- package/dist/cjs/views/Theme.js.map +3 -3
- package/dist/esm/createComponent.js +2 -2
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createComponent.mjs +2 -2
- package/dist/esm/createComponent.mjs.map +3 -3
- package/dist/esm/helpers/ThemeManager.js +1 -1
- package/dist/esm/helpers/ThemeManager.js.map +3 -3
- package/dist/esm/helpers/ThemeManager.mjs +1 -1
- package/dist/esm/helpers/ThemeManager.mjs.map +3 -3
- package/dist/esm/helpers/getSplitStyles.js +2 -2
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs +2 -2
- package/dist/esm/helpers/getSplitStyles.mjs.map +2 -2
- package/dist/esm/hooks/useTheme.js +1 -1
- package/dist/esm/hooks/useTheme.js.map +3 -3
- package/dist/esm/hooks/useTheme.mjs +1 -1
- package/dist/esm/hooks/useTheme.mjs.map +3 -3
- package/dist/esm/views/Theme.js +1 -1
- package/dist/esm/views/Theme.js.map +3 -3
- package/dist/esm/views/Theme.mjs +1 -1
- package/dist/esm/views/Theme.mjs.map +3 -3
- package/package.json +9 -9
- package/src/createComponent.tsx +38 -5
- package/src/helpers/ThemeManager.tsx +40 -32
- package/src/helpers/getSplitStyles.tsx +0 -8
- package/src/hooks/useTheme.tsx +145 -93
- package/src/types.tsx +2 -2
- package/src/views/Theme.tsx +49 -27
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/ThemeManager.d.ts +1 -0
- package/types/helpers/ThemeManager.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +5 -7
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`&&console.error(`Unexpected text node: ${t}. A text node cannot be a child of a <View>.`)});const
|
|
1
|
+
"use strict";var Jt=Object.create;var he=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var en=(s,o)=>{for(var e in o)he(s,e,{get:o[e],enumerable:!0})},ht=(s,o,e,h)=>{if(o&&typeof o=="object"||typeof o=="function")for(let y of Qt(o))!Yt.call(s,y)&&y!==e&&he(s,y,{get:()=>o[y],enumerable:!(h=qt(o,y))||h.enumerable});return s};var tn=(s,o,e)=>(e=s!=null?Jt(Xt(s)):{},ht(o||!s||!s.__esModule?he(e,"default",{value:s,enumerable:!0}):e,s)),nn=s=>ht(he({},"__esModule",{value:!0}),s);var cn={};en(cn,{Spacer:()=>Dt,Unspaced:()=>Mt,createComponent:()=>Me,defaultComponentState:()=>_e,mouseUps:()=>z,spacedChildren:()=>kt});module.exports=nn(cn);var x=require("react/jsx-runtime"),Pt=require("@tamagui/compose-refs"),d=require("@tamagui/constants"),K=require("@tamagui/helpers"),a=tn(require("react")),Nt=require("./config.js"),Re=require("./constants/constants.js"),Ct=require("./contexts/FontLanguageContext.js"),At=require("./contexts/TextAncestorContext.js"),ge=require("./createVariable.js"),te=require("./helpers/extendStaticConfig.js"),Et=require("./helpers/getSplitStyles.js"),H=require("./helpers/mergeProps.js"),wt=require("./helpers/proxyThemeVariables.js"),xt=require("./helpers/useShallowSetState.js"),Vt=require("./hooks/useAnimationDriver.js"),Se=require("./hooks/useMedia.js"),ve=require("./hooks/useServerHooks.js"),Ot=require("./hooks/useTheme.js"),ye=require("./setupHooks.js"),Rt=require("./views/Slot.js"),_t=require("./views/Theme.js");process.env.TAMAGUI_TARGET;const _e={hover:!1,press:!1,pressIn:!1,focus:!1,unmounted:!0},sn={..._e,unmounted:!1};let G,yt,gt,Ve;const z=new Set;if(typeof document<"u"){const s=()=>{z.forEach(o=>o()),z.clear()};addEventListener("mouseup",s),addEventListener("touchend",s),addEventListener("touchcancel",s)}function on({defaultProps:s},{shorthands:o}){for(const e of Object.keys(s))s[o[e]||e]=s[e]}let St,vt,bt=!1;function Me(s,o){const e=(()=>{const i=(0,te.extendStaticConfig)(s,o);return"parsed"in i?i:(0,te.parseStaticConfig)(i)})(),h=`is_${e.componentName}`;let y,A;const g=(0,a.forwardRef)((i,l)=>{var Ze,Je,qe,Qe,Xe,Ye,et,tt,nt,st,ot,at,it,rt,lt,ct,dt,ut,mt;if(process.env.TAMAGUI_TARGET==="native"&&!bt){bt=!0;const t=(Je=(Ze=ye.hooks).getBaseViews)==null?void 0:Je.call(Ze);t&&(St=t.Text,vt=t.View)}process.env.NODE_ENV==="test"&&i["data-test-renders"]&&((qe=i["data-test-renders"]).current??(qe.current=0),i["data-test-renders"].current+=1);let n;y&&!i.asChild?n=(0,H.mergeProps)(y,i)[0]:n=i;const p=n.debug,{Component:f,isText:_,isZStack:B}=e,b=n.componentName||e.componentName,r=(0,a.useRef)(void 0);r.current||(r.current={});const V=(0,ve.useServerRef)(null),m=(0,Vt.useAnimationDriver)(),$=m==null?void 0:m.useAnimations,O=(()=>{const t=!!(!e.isHOC&&$&&(n.animation||n.style&&ln(n.style)));return t&&!r.current.hasAnimated&&(r.current.hasAnimated=!0),t||r.current.hasAnimated})(),R=n.asChild?"":n.componentName?`is_${n.componentName}`:h,ne=!!(d.isWeb&&_&&(0,a.useContext)(At.TextAncestorContext)),It=d.isRSC?null:(0,a.useContext)(Ct.FontLanguageContext),De=n.disabled??((Qe=n.accessibilityState)==null?void 0:Qe.disabled),ke=d.isWeb&&(!f||typeof f=="string")&&(n.tag||A)||f,Ie=St||ke||"span",Ue=vt||ke||(ne?"span":"div");yt=m?m.Text:Ie,gt=m?m.View:Ue;let M=_?(O?yt:null)||Ie:(O?gt:null)||Ue;const be=m==null?void 0:m.isReactNative,Ge=!!n.enterStyle,se=Boolean((d.isWeb?d.isClient:!0)&&(Ge||n.animation)),Te=(0,ve.useServerState)(se?_e:sn),N=i.forceStyle?{...Te[0],[i.forceStyle]:!0}:Te[0],Ut=Te[1],k=(0,xt.useShallowSetState)(Ut,p,b),$e=m==null?void 0:m.usePresence,L=!d.isRSC&&O&&$e?$e():null;if(O&&L){const t=L[2];t&&(N.unmounted&&t.enterVariant&&(n[t.enterVariant]=!0),!t.isPresent&&t.exitVariant&&(n[t.exitVariant]=!0))}const Fe=O&&(m==null?void 0:m.isReactNative),Pe=Boolean(e.isReactNative||Fe);if(process.env.NODE_ENV==="development"){const t=(0,a.useId)();if(p){const u=`${b||(f==null?void 0:f.displayName)||(f==null?void 0:f.name)||"[Unnamed Component]"}`,S=Fe?"(animated)":Pe?"(rnw)":"",j=i["data-is"]||"",C=`${u}${j?` ${j}`:""} ${S} id ${t}`;console.group(`%c ${C}`,"background: yellow;"),d.isServer||console.log("state",N)}}const Ne=!d.isWeb||!!(n.animation&&be)||!e.acceptsClassName,oe=!!i.forceStyle,I=Ne||oe,E=(0,Ot.useThemeWithState)({name:n.theme,componentName:b,reset:n.reset,inverse:n.themeInverse,disable:n["data-themeable"],debug:process.env.NODE_ENV==="development"&&n.debug?{hostRef:V}:void 0,shouldUpdate:()=>!!r.current.didAccessThemeVariableValue});M=f||M;const je=typeof M=="string",Gt=(L==null?void 0:L[0])===!1,$t=(0,Se.useMedia)(r,p?{props:n,staticConfig:e}:null);(0,ge.setDidGetVariableValue)(!1);const T=(0,Et.useSplitStyles)(n,e,E.theme,{...N,mediaState:$t,noClassNames:I,dynamicStylesInline:I,hasTextAncestor:ne,resolveVariablesAs:"auto",isExiting:Gt},null,It||void 0,M,p),Be=Array.isArray(T.hasMedia),Le=(0,ge.didGetVariableValue)()||Be||I&&T.hasMedia===!0;(0,Se.setMediaShouldUpdate)(r,{enabled:Le,keys:I&&Be?T.hasMedia:null});const ae=O&&be;if(process.env.NODE_ENV==="development"&&(process.env.TAMAGUI_TARGET||console.error('No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".'),p&&(console.groupCollapsed("props"),console.log("props in",i,"mapped to",n,"in order",Object.keys(n)),console.log("splitStyles",T),console.log("shouldListenForMedia",Le),console.log("className",Object.values(T.classNames)),d.isClient&&console.log("ref",V,"(click to view)"),console.groupEnd(),p==="break")))debugger;const{viewProps:Ft,pseudos:U,style:ie,classNames:We,space:jt}=T,Bt=n;let Z;if(!d.isRSC&&O&&$&&!e.isHOC){const t=$({props:Bt,style:ie,presence:L,state:N,pseudos:U||null,onDidAnimate:n.onDidAnimate,hostRef:V,staticConfig:e});t&&(Z=t.style)}const{asChild:J,children:Ce,onPress:q,onPressIn:Q,onPressOut:X,onHoverIn:re,onHoverOut:le,themeShallow:Lt,spaceDirection:un,disabled:mn,onMouseUp:Ae,onMouseDown:Ee,onMouseEnter:ce,onMouseLeave:de,separator:Wt,forceStyle:fn,onClick:ue,theme:pn,defaultVariants:hn,...we}=Ft,He=((Xe=n.accessibilityState)==null?void 0:Xe.disabled)||n.accessibilityDisabled;let c=we;process.env.TAMAGUI_TARGET==="web"&&!Pe&&!J?c=(et=(Ye=ye.hooks).usePropsTransform)==null?void 0:et.call(Ye,M,we,V):c=we,c.ref=(0,Pt.useComposedRefs)(V,l),process.env.NODE_ENV==="development"&&!_&&d.isWeb&&!e.isHOC&&a.Children.toArray(n.children).forEach(t=>{typeof t=="string"&&t!==`
|
|
2
|
+
`&&console.error(`Unexpected text node: ${t}. A text node cannot be a child of a <View>.`)});const Y=(0,a.useCallback)(()=>{k({press:!1,pressIn:!1})},[k]);d.isWeb&&(0,a.useEffect)(()=>()=>{z.delete(Y)},[]);const ze=se&&N.unmounted;(0,a.useEffect)(()=>{if(ze){if(N.unmounted===!0&&se){k({unmounted:!1});return}k({unmounted:!1})}},[ze,N.unmounted]);let D;if(je&&Ne&&!oe)D={...Z??ie};else if(D=[Z??ie],oe){const t={};D.forEach(u=>Object.assign(t,u)),Object.assign(T.style,t)}let W=_?T.fontFamily||e.defaultProps.fontFamily:null;W&&W[0]==="$"&&(W=W.slice(1));const Ht=W?`font_${W}`:"",xe=[Ge&&(N.unmounted&&se||!d.isClient)?"t_will-mount":"",b?R:"",Ht,We?Object.values(We).join(" "):""].join(" ");if(process.env.TAMAGUI_TARGET==="web"){const t=Z??T.style;if(ae)c.style=t;else if(Pe){const u={$$css:!0};for(const S of xe.split(" "))u[S]=S;c.style=[...Array.isArray(t)?t:[t],u],process.env.NODE_ENV==="development"&&Object.keys(c).forEach(S=>{S.startsWith("data-")&&(c.dataSet??(c.dataSet={}),c.dataSet[S.replace("data-","")]=c[S],delete c[S])})}else c.className=xe,c.style=t}if(process.env.TAMAGUI_TARGET==="native"){if(T.fontFamily){const t=(tt=G.fontsParsed[T.fontFamily])==null?void 0:tt.face;if(t){const[u,S]=(()=>{var ft,pt;let C,fe;for(let pe=D.length;pe>=0;pe--)C??(C=(ft=D[pe])==null?void 0:ft.fontWeight),fe??(fe=(pt=D[pe])==null?void 0:pt.fontStyle);return[C||"400",fe||"normal"]})(),j=(st=(nt=t[u])==null?void 0:nt[S])==null?void 0:st.val;if(j)for(const C of D)C!=null&&C.fontFamily&&(C.fontFamily=j,C.fontWeight=void 0,C.fontStyle=void 0)}}c.style=D}const zt=!He&&I&&(U==null?void 0:U.pressStyle),me=Boolean(zt||q||X||Q||ue),Kt=!He&&I&&(U==null?void 0:U.hoverStyle),F=d.isWeb&&!!(Kt||re||le||ce||de),Zt=!(d.isWeb||J),Ke=Boolean(me||F||I&&"pressStyle"in n||d.isWeb&&I&&"hoverStyle"in n),P=Ke&&!d.isRSC&&!De&&!J?{onPressOut:me?t=>{Y(),X==null||X(t),Ae==null||Ae(t)}:void 0,...F&&{onMouseEnter:F?t=>{const u={};F&&(u.hover=!0),N.pressIn&&(u.press=!0),(F||N.pressIn)&&k(u),re==null||re(t),ce==null||ce(t)}:void 0,onMouseLeave:F?t=>{const u={};z.add(Y),F&&(u.hover=!1),N.pressIn&&(u.press=!1,u.pressIn=!1),Object.keys(u).length&&k(u),le==null||le(t),de==null||de(t)}:void 0},onPressIn:me?t=>{k({press:!0,pressIn:!0,hover:!1}),Q==null||Q(t),Ee==null||Ee(t),d.isWeb&&z.add(Y)}:void 0,onPress:me?t=>{Y(),d.isWeb&&(ue==null||ue(t)),q==null||q(t)}:void 0}:null;process.env.TAMAGUI_TARGET==="native"&&P&&Object.assign(P,{cancelable:!n.rejectResponderTermination,disabled:De,hitSlop:n.hitSlop,delayLongPress:n.delayLongPress,delayPressIn:n.delayPressIn,delayPressOut:n.delayPressOut,focusable:c.focusable??!0,minPressDuration:0}),(at=(ot=ye.hooks).useEvents)==null||at.call(ot,c,P,T,k),!!(Lt&&E.isNewTheme)&&(r.current.themeShallow=!0);let w=!Ce||J?Ce:kt({separator:Wt,children:Ce,space:jt,direction:n.spaceDirection||"both",isZStack:B,debug:p});if(J&&(M=Rt.Slot,c={...c,onPress:q,onPressIn:Q,onPressOut:X}),w=(0,a.createElement)(M,c,w),w=(0,_t.useThemedChildren)(E,w,{shallow:r.current.themeShallow}),process.env.NODE_ENV==="development"&&n.debug==="visualize"){const[t,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{var S;(S=E.themeManager)==null||S.onChangeTheme((j,C)=>{u(fe=>++fe),console.warn("\u{1F5A4}",j)})},[E.themeManager]),w=(0,x.jsxs)(x.Fragment,{children:[w,(0,x.jsx)("code",{children:(0,x.jsx)("pre",{children:JSON.stringify({name:(it=E.themeManager)==null?void 0:it.state.name,parent:(rt=E.themeManager)==null?void 0:rt.state.parentName,id:(lt=E.themeManager)==null?void 0:lt.id,parentId:(dt=(ct=E.themeManager)==null?void 0:ct.parentManager)==null?void 0:dt.id,isNew:E.isNewTheme,onChangeCount:t})})})]})}if(process.env.TAMAGUI_TARGET==="web"&&(P||ae)&&(w=(0,x.jsx)("span",{className:`${ae?xe:""} _dsp_contents`,...P&&{onMouseEnter:P.onMouseEnter,onMouseLeave:P.onMouseLeave,onClick:P.onPress,onMouseDown:P.onPressIn,onMouseUp:P.onPressOut,onTouchStart:P.onPressIn,onTouchEnd:P.onPressOut},children:w})),process.env.NODE_ENV==="development"&&process.env.DEBUG!=="tamagui"&&p){console.groupCollapsed(`render <${typeof M=="string"?M:"Component"} /> with props`,c);for(const u in c)console.log(u,c[u]);console.log("children",w),console.groupEnd(),typeof window<"u"&&console.log({state:N,themeState:E,isAnimated:O,isAnimatedReactNativeWeb:ae,tamaguiDefaultProps:y,viewProps:c,splitStyles:T,animationStyles:Z,handlesPressEvents:Zt,isStringElement:je,classNamesIn:(ut=n.className)==null?void 0:ut.split(" "),classNamesOut:(mt=c.className)==null?void 0:mt.split(" "),events:P,shouldAttach:Ke,styles:D,pseudos:U,content:w,shouldAvoidClasses:Ne,avoidClasses:be,animation:n.animation,style:ie,staticConfig:e,tamaguiConfig:G,shouldForcePseudo:oe}),console.groupEnd()}return w});e.componentName&&(g.displayName=e.componentName),(0,Nt.onConfiguredOnce)(i=>{if(!G&&(G=i,!Ve)){const R=i.themes[Object.keys(i.themes)[0]];Ve=(0,wt.proxyThemeVariables)(R),process.env.NODE_ENV==="development"&&(Ve||console.log("Warning: Missing theme"))}on(e,G);let l=e.defaultProps||{};const n=[...e.parentNames||[],e.componentName];G.defaultProps&&n&&e.componentName&&(l=an(e.componentName,l,G.defaultProps,n,G));const p=l.debug,[f,_]=(0,H.mergeProps)(l,{});f.tag&&(A=f.tag);const B=!e.acceptsClassName,{name:b,variants:r,defaultVariants:V,...m}=f,[$,O]=(0,H.mergeProps)(g.defaultProps,{...V,...m});if(!d.isWeb)for(const R in e.defaultProps){const ne=e.defaultProps[R];K.validPseudoKeys[R]||($[R]=ne)}y=$,process.env.NODE_ENV==="development"&&p&&process.env.IS_STATIC!=="is_static"&&console.log(`\u{1F41B} [${e.componentName||"Component"}]`,{staticConfig:e,tamaguiDefaultProps:y,defaults:$,defaultPropsIn:l,defaultPropsKeyOrder:Object.keys(e.defaultProps),defaultPropsInKeyOrder:Object.keys(l).map(R=>[R,l[R]]),ourProps:f,ourClassNames:_,defaultsClassnames:O,defaultTag:A,noClassNames:B})});let v=g;return s.memo&&(v=(0,a.memo)(v)),v.staticConfig={validStyles:e.validStyles||K.stylePropsView,...e},v.extractable=(i,l)=>(i.staticConfig=(0,te.extendStaticConfig)({Component:i,...l,neverFlatten:!0,isHOC:!0,defaultProps:{...i.defaultProps,...l==null?void 0:l.defaultProps}},v),i),v}const Mt=s=>s.children;Mt.isUnspaced=!0;const Dt=Me({acceptsClassName:!0,memo:!0,componentName:"Spacer",validStyles:K.validStyles,defaultProps:{...Re.stackDefaultStyles,tag:"span",size:!0,pointerEvents:"none"},variants:{size:{"...size":(s,{tokens:o})=>{s=s===!0?"$true":s;const e=o.space[s]??s;return{width:e,height:e,minWidth:e,minHeight:e}}},flex:{true:{flexGrow:1}},direction:{horizontal:{height:0,minHeight:0},vertical:{width:0,minWidth:0},both:{}}}});function kt(s){var f,_,B;const{isZStack:o,children:e,space:h,direction:y,spaceFlex:A,separator:g}=s,v=!!(h||A),i=g!=null;if(!(v||i||o))return e;const l=a.Children.toArray(e);if(l.length<=1&&!o&&!((_=(f=l[0])==null?void 0:f.type)!=null&&_.shouldForwardSpace))return l;const p=[];for(let[b,r]of l.entries()){const V=r==null||Array.isArray(r)&&r.length===0;if(!V&&a.default.isValidElement(r)&&((B=r.type)!=null&&B.shouldForwardSpace)&&(r=a.default.cloneElement(r,{space:h,spaceFlex:A,separator:g,key:r.key})),V||!r||r.key&&!o?p.push(r):p.push((0,x.jsx)(a.Fragment,{children:o?(0,x.jsx)(rn,{children:r}):r},b)),Tt(r)&&b===0||o)continue;const m=l[b+1];m&&!Tt(m)&&(g?(v&&p.push(Oe({key:`_${b}_00tmgui`,direction:y,space:h,spaceFlex:A})),p.push(a.default.isValidElement(g)?a.default.cloneElement(g,{key:`sep_${b}`}):g),v&&p.push(Oe({key:`_${b}01tmgui`,direction:y,space:h,spaceFlex:A}))):p.push(Oe({key:`_${b}02tmgui`,direction:y,space:h,spaceFlex:A})))}return process.env.NODE_ENV==="development"&&s.debug&&console.log(" Spaced children",p,s),p}function Oe({key:s,direction:o,space:e,spaceFlex:h}){return(0,x.jsx)(Dt,{size:e,direction:o,...typeof h<"u"&&{flex:h===!0?1:h===!1?0:h}},s)}function Tt(s){const o=s==null?void 0:s.type;return(o==null?void 0:o.isVisuallyHidden)||(o==null?void 0:o.isUnspaced)}const ee=new Map;function an(s,o,e,h,y){const A=h.length;let g;for(let i=0;i<A;i++){const l=h[i];if(!l)continue;if(ee.has(l)){g=ee.get(l);continue}const n=e[l];if(!n){g&&ee.set(l,g);continue}g=(0,H.mergeProps)(g||{},n,!1,y.inverseShorthands)[0],ee.set(l,g)}const v=ee.get(s);return v?(0,H.mergeProps)(o,v,!1,y.inverseShorthands)[0]:o}const rn=Me({defaultProps:{...Re.stackDefaultStyles,flexDirection:"column",position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"box-none"}});function ln(s){return Object.keys(s).some(o=>{const e=s[o];return e&&typeof e=="object"&&"_animation"in e})}0&&(module.exports={Spacer,Unspaced,createComponent,defaultComponentState,mouseUps,spacedChildren});
|
|
3
3
|
//# sourceMappingURL=createComponent.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createComponent.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useComposedRefs } from '@tamagui/compose-refs'\nimport { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport { stylePropsView, validPseudoKeys, validStyles } from '@tamagui/helpers'\nimport React, {\n Children,\n Fragment,\n createElement,\n forwardRef,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n} from 'react'\n\nimport { onConfiguredOnce } from './config.js'\nimport { stackDefaultStyles } from './constants/constants.js'\nimport { FontLanguageContext } from './contexts/FontLanguageContext.js'\nimport { TextAncestorContext } from './contexts/TextAncestorContext.js'\nimport { didGetVariableValue, setDidGetVariableValue } from './createVariable.js'\nimport { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig.js'\nimport { useSplitStyles } from './helpers/getSplitStyles.js'\nimport { mergeProps } from './helpers/mergeProps.js'\nimport { proxyThemeVariables } from './helpers/proxyThemeVariables.js'\nimport { useShallowSetState } from './helpers/useShallowSetState.js'\nimport { useAnimationDriver } from './hooks/useAnimationDriver.js'\nimport { setMediaShouldUpdate, useMedia } from './hooks/useMedia.js'\nimport { useServerRef, useServerState } from './hooks/useServerHooks.js'\nimport { useThemeWithState } from './hooks/useTheme.js'\nimport { hooks } from './setupHooks.js'\nimport {\n DebugProp,\n SpaceDirection,\n SpaceTokens,\n SpacerProps,\n StaticConfig,\n StaticConfigParsed,\n StylableComponent,\n TamaguiComponent,\n TamaguiComponentEvents,\n TamaguiComponentState,\n TamaguiConfig,\n TamaguiElement,\n TamaguiInternalConfig,\n UseAnimationHook,\n UseAnimationProps,\n} from './types'\nimport { Slot } from './views/Slot.js'\nimport { Stack } from './views/Stack.js'\nimport { Text } from './views/Text.js'\nimport { useThemedChildren } from './views/Theme.js'\n\n// let t\n// import { timer } from '@tamagui/timer'\n// if (true || process.env.ANALYZE) {\n// t = require().timer()\n// setTimeout(() => {\n// const out = t.print()\n// if (isClient) {\n// alert(out)\n// }\n// }, 2000)\n// }\n\n// this appears to fix expo / babel not picking this up sometimes? really odd\nprocess.env.TAMAGUI_TARGET\n\nexport const defaultComponentState: TamaguiComponentState = {\n hover: false,\n press: false,\n pressIn: false,\n focus: false,\n unmounted: true,\n}\n\nconst defaultComponentStateMounted: TamaguiComponentState = {\n ...defaultComponentState,\n unmounted: false,\n}\n\n/**\n * All things that need one-time setup after createTamagui is called\n */\nlet tamaguiConfig: TamaguiInternalConfig\nlet AnimatedText: any\nlet AnimatedView: any\nlet initialTheme: any\n\nexport const mouseUps = new Set<Function>()\nif (typeof document !== 'undefined') {\n const cancelTouches = () => {\n mouseUps.forEach((x) => x())\n mouseUps.clear()\n }\n addEventListener('mouseup', cancelTouches)\n addEventListener('touchend', cancelTouches)\n addEventListener('touchcancel', cancelTouches)\n}\n\n// mutates\nfunction mergeShorthands(\n { defaultProps }: StaticConfigParsed,\n { shorthands }: TamaguiConfig\n) {\n // they are defined in correct order already { ...parent, ...child }\n for (const key of Object.keys(defaultProps)) {\n defaultProps[shorthands[key] || key] = defaultProps[key]\n }\n}\n\n/**\n * Only on native do we need the actual underlying View/Text\n * On the web we avoid react-native dep altogether.\n */\nlet BaseText: any\nlet BaseView: any\nlet hasSetupBaseViews = false\n\nexport function createComponent<\n ComponentPropTypes extends Object = {},\n Ref = TamaguiElement,\n BaseProps = never\n>(\n configIn: Partial<StaticConfig> | StaticConfigParsed,\n ParentComponent?: StylableComponent\n) {\n const staticConfig = (() => {\n const next = extendStaticConfig(configIn, ParentComponent)\n if ('parsed' in next) {\n return next\n } else {\n return parseStaticConfig(next)\n }\n })()\n\n const defaultComponentClassName = `is_${staticConfig.componentName}`\n let tamaguiDefaultProps: any\n let defaultTag: string | undefined\n\n // see onConfiguredOnce below which attaches a name then to this component\n const component = forwardRef<Ref, ComponentPropTypes>((propsIn: any, forwardedRef) => {\n if (process.env.TAMAGUI_TARGET === 'native') {\n // todo this could be moved to a cleaner location\n if (!hasSetupBaseViews) {\n hasSetupBaseViews = true\n const baseViews = hooks.getBaseViews?.()\n if (baseViews) {\n BaseText = baseViews.Text\n BaseView = baseViews.View\n }\n }\n }\n\n // test only\n if (process.env.NODE_ENV === 'test') {\n if (propsIn['data-test-renders']) {\n propsIn['data-test-renders']['current'] ??= 0\n propsIn['data-test-renders']['current'] += 1\n }\n }\n // const time = t.start({ quiet: true })\n\n // React inserts default props after your props for some reason...\n // order important so we do loops, you can't just spread because JS does weird things\n let props: any\n if (tamaguiDefaultProps && !propsIn.asChild) {\n props = mergeProps(tamaguiDefaultProps, propsIn)[0]\n } else {\n props = propsIn\n }\n\n const debugProp = props['debug'] as DebugProp\n const { Component, isText, isZStack } = staticConfig\n const componentName = props.componentName || staticConfig.componentName\n\n // conditional but if ever true stays true\n // [animated, inversed]\n const stateRef = useRef(\n undefined as any as {\n hasAnimated?: boolean\n themeShallow?: boolean\n didAccessThemeVariableValue?: boolean\n }\n )\n stateRef.current ??= {}\n\n /**\n * Component state for tracking animations, pseudos\n */\n const animationsConfig = useAnimationDriver()\n const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined\n const isAnimated = (() => {\n const next = !!(\n !staticConfig.isHOC &&\n useAnimations &&\n (props.animation || (props.style && hasAnimatedStyleValue(props.style)))\n )\n if (next && !stateRef.current.hasAnimated) {\n stateRef.current.hasAnimated = true\n }\n return next || stateRef.current.hasAnimated\n })()\n const componentClassName = props.asChild\n ? ''\n : props.componentName\n ? `is_${props.componentName}`\n : defaultComponentClassName\n const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false)\n const languageContext = isRSC ? null : useContext(FontLanguageContext)\n const isDisabled = props.disabled ?? props.accessibilityState?.disabled\n\n const isTaggable = !Component || typeof Component === 'string'\n // default to tag, fallback to component (when both strings)\n const element = isWeb\n ? isTaggable\n ? props.tag || defaultTag || Component\n : Component\n : Component\n\n const BaseTextComponent = BaseText || element || 'span'\n const BaseViewComponent = BaseView || element || (hasTextAncestor ? 'span' : 'div')\n\n AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent\n AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent\n\n let elementType = isText\n ? (isAnimated ? AnimatedText : null) || BaseTextComponent\n : (isAnimated ? AnimatedView : null) || BaseViewComponent\n\n const avoidClassesWhileAnimating = animationsConfig?.isReactNative\n const hasEnterStyle = !!props.enterStyle\n const needsMount = Boolean(\n (isWeb ? isClient : true) && (hasEnterStyle || props.animation)\n )\n const states = useServerState<TamaguiComponentState>(\n needsMount ? defaultComponentState! : defaultComponentStateMounted!\n )\n\n const state = propsIn.forceStyle\n ? { ...states[0], [propsIn.forceStyle]: true }\n : states[0]\n const setState = states[1]\n const setStateShallow = useShallowSetState(setState, debugProp, componentName)\n\n const usePresence = animationsConfig?.usePresence\n const presence = !isRSC && isAnimated && usePresence ? usePresence() : null\n\n // set enter/exit variants onto our new props object\n if (isAnimated && presence) {\n const presenceState = presence[2]\n if (presenceState) {\n if (state.unmounted && presenceState.enterVariant) {\n props[presenceState.enterVariant] = true\n }\n if (!presenceState.isPresent && presenceState.exitVariant) {\n props[presenceState.exitVariant] = true\n }\n }\n }\n\n const isAnimatedReactNative = isAnimated && animationsConfig?.isReactNative\n const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative)\n\n if (process.env.NODE_ENV === 'development') {\n const id = useId()\n\n if (debugProp) {\n // prettier-ignore\n const name = `${componentName || Component?.displayName || Component?.name || '[Unnamed Component]'}`\n const type = isAnimatedReactNative ? '(animated)' : isReactNative ? '(rnw)' : ''\n const dataIs = propsIn['data-is'] || ''\n const banner = `${name}${dataIs ? ` ${dataIs}` : ''} ${type} id ${id}`\n console.group(`%c ${banner}`, 'background: yellow;')\n if (!isServer) {\n console.log('state', state)\n }\n }\n }\n\n const shouldAvoidClasses =\n !isWeb ||\n !!(props.animation && avoidClassesWhileAnimating) ||\n !staticConfig.acceptsClassName\n const shouldForcePseudo = !!propsIn.forceStyle\n const noClassNames = shouldAvoidClasses || shouldForcePseudo\n\n const themeState = useThemeWithState({\n name: props.theme,\n componentName,\n reset: props.reset,\n inverse: props.themeInverse,\n // @ts-expect-error\n disable: props['data-themeable'],\n debug: props.debug,\n shouldUpdate: () => !!stateRef.current.didAccessThemeVariableValue,\n })!\n\n elementType = Component || elementType\n const isStringElement = typeof elementType === 'string'\n\n const isExiting = presence?.[0] === false\n\n const mediaState = useMedia(\n // @ts-ignore, we just pass a stable object so we can get it later with\n // should match to the one used in `setMediaShouldUpdate` below\n stateRef,\n debugProp ? { props, staticConfig } : null\n )\n\n setDidGetVariableValue(false)\n\n const splitStyles = useSplitStyles(\n props,\n staticConfig,\n themeState.theme,\n {\n ...state,\n mediaState,\n noClassNames,\n dynamicStylesInline: noClassNames,\n hasTextAncestor,\n resolveVariablesAs: 'auto',\n isExiting,\n },\n null,\n languageContext || undefined,\n elementType,\n debugProp\n )\n\n // only listen for changes if we are using raw theme values or media space, or dynamic media (native)\n // array = space media breakpoints\n const isMediaSpaced = Array.isArray(splitStyles.hasMedia)\n const shouldListenForMedia =\n didGetVariableValue() ||\n isMediaSpaced ||\n (noClassNames && splitStyles.hasMedia === true)\n\n setMediaShouldUpdate(stateRef, {\n enabled: shouldListenForMedia,\n keys: noClassNames && isMediaSpaced ? (splitStyles.hasMedia as any) : null,\n })\n\n const hostRef = useServerRef<TamaguiElement>(null)\n\n // animation setup\n const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating\n\n if (process.env.NODE_ENV === 'development') {\n if (!process.env.TAMAGUI_TARGET) {\n console.error(\n `No process.env.TAMAGUI_TARGET set, please set it to \"native\" or \"web\".`\n )\n }\n\n if (debugProp) {\n console.groupCollapsed('props')\n // prettier-ignore\n console.log('props in', propsIn, 'mapped to', props, 'in order', Object.keys(props))\n console.log('splitStyles', splitStyles)\n // eslint-disable-next-line no-console\n console.log('shouldListenForMedia', shouldListenForMedia)\n // eslint-disable-next-line no-console\n console.log('className', Object.values(splitStyles.classNames))\n if (isClient) {\n console.log('ref', hostRef, '(click to view)')\n }\n console.groupEnd()\n if (debugProp === 'break') {\n // rome-ignore lint/suspicious/noDebugger: ok\n debugger\n }\n }\n }\n\n const {\n viewProps: viewPropsIn,\n pseudos,\n style: splitStylesStyle,\n classNames,\n space,\n } = splitStyles\n\n const propsWithAnimation = props as UseAnimationProps\n\n // once you set animation prop don't remove it, you can set to undefined/false\n // reason is animations are heavy - no way around it, and must be run inline here (\uD83D\uDE45 loading as a sub-component)\n let animationStyles: any\n if (!isRSC && isAnimated && useAnimations && !staticConfig.isHOC) {\n const animations = useAnimations({\n props: propsWithAnimation,\n style: splitStylesStyle,\n presence,\n state,\n pseudos: pseudos || null,\n onDidAnimate: props.onDidAnimate,\n hostRef,\n staticConfig,\n })\n if (animations) {\n animationStyles = animations.style\n }\n }\n\n const {\n asChild,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onHoverIn,\n onHoverOut,\n themeShallow,\n spaceDirection: _spaceDirection,\n disabled: disabledProp,\n onMouseUp,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n separator,\n // ignore from here on out\n forceStyle: _forceStyle,\n // @ts-ignore for next/link compat etc\n onClick,\n theme: _themeProp,\n // @ts-ignore\n defaultVariants,\n\n ...nonTamaguiProps\n } = viewPropsIn\n\n const disabled = props.accessibilityState?.disabled || props.accessibilityDisabled\n\n // these can ultimately be for DOM, react-native-web views, or animated views\n // so the type is pretty loose\n let viewProps = nonTamaguiProps\n\n // if react-native-web view just pass all props down\n if (process.env.TAMAGUI_TARGET === 'web' && !isReactNative && !asChild) {\n viewProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)\n } else {\n viewProps = nonTamaguiProps\n }\n\n viewProps.ref = useComposedRefs(hostRef as any, forwardedRef)\n\n if (process.env.NODE_ENV === 'development') {\n if (!isText && isWeb && !staticConfig.isHOC) {\n Children.toArray(props.children).forEach((item) => {\n // allow newlines because why not its annoying with mdx\n if (typeof item === 'string' && item !== '\\n') {\n console.error(\n `Unexpected text node: ${item}. A text node cannot be a child of a <View>.`\n )\n }\n })\n }\n }\n\n const unPress = useCallback(() => {\n setStateShallow({\n press: false,\n pressIn: false,\n })\n }, [setStateShallow])\n\n if (isWeb) {\n useEffect(() => {\n return () => {\n mouseUps.delete(unPress)\n }\n }, [])\n }\n\n const shouldSetMounted = needsMount && state.unmounted\n useEffect(() => {\n if (!shouldSetMounted) return\n if (state.unmounted === true && needsMount) {\n setStateShallow({\n unmounted: false,\n })\n return\n }\n\n setStateShallow({\n unmounted: false,\n })\n }, [shouldSetMounted, state.unmounted])\n\n let styles: Record<string, any>[]\n\n if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {\n styles = {\n ...(animationStyles ?? splitStylesStyle),\n }\n } else {\n styles = [animationStyles ?? splitStylesStyle]\n\n // ugly but for now...\n if (shouldForcePseudo) {\n const next = {}\n styles.forEach((style) => Object.assign(next, style))\n // @ts-ignore\n Object.assign(splitStyles.style, next)\n }\n }\n\n let fontFamily = isText\n ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily\n : null\n if (fontFamily && fontFamily[0] === '$') {\n fontFamily = fontFamily.slice(1)\n }\n const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''\n\n const classList = [\n hasEnterStyle && ((state.unmounted && needsMount) || !isClient)\n ? 't_will-mount'\n : '',\n componentName ? componentClassName : '',\n fontFamilyClassName,\n classNames ? Object.values(classNames).join(' ') : '',\n ]\n\n const className = classList.join(' ')\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n const style = animationStyles ?? splitStyles.style\n\n if (isAnimatedReactNativeWeb) {\n viewProps.style = style\n } else if (isReactNative) {\n // TODO these shouldn't really return from getSplitStyles when in Native mode\n const cnStyles = { $$css: true }\n for (const name of className.split(' ')) {\n cnStyles[name] = name\n }\n viewProps.style = [...(Array.isArray(style) ? style : [style]), cnStyles]\n\n if (process.env.NODE_ENV === 'development') {\n // turn debug data- props into dataSet in dev mode\n Object.keys(viewProps).forEach((key) => {\n if (key.startsWith('data-')) {\n viewProps.dataSet ??= {}\n viewProps.dataSet[key.replace('data-', '')] = viewProps[key]\n delete viewProps[key]\n }\n })\n }\n } else {\n viewProps.className = className\n viewProps.style = style\n }\n }\n\n // TODO MOVE INTO HOOK\n if (process.env.TAMAGUI_TARGET === 'native') {\n // swap out the right family based on weight/style\n if (splitStyles.fontFamily) {\n const faceInfo = tamaguiConfig.fontsParsed[splitStyles.fontFamily]?.face\n if (faceInfo) {\n const [weight, style] = (() => {\n let weight: string | undefined\n let style: string | undefined\n for (let i = styles.length; i >= 0; i--) {\n weight ??= styles[i]?.fontWeight\n style ??= styles[i]?.fontStyle\n }\n return [weight || '400', style || 'normal'] as const\n })()\n const overrideFace = faceInfo[weight]?.[style]?.val\n if (overrideFace) {\n for (const style of styles) {\n if (style?.fontFamily) {\n style.fontFamily = overrideFace\n style.fontWeight = undefined\n style.fontStyle = undefined\n }\n }\n }\n }\n }\n\n // assign styles\n viewProps.style = styles\n }\n\n const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle\n const attachPress = Boolean(\n runtimePressStyle || onPress || onPressOut || onPressIn || onClick\n )\n const runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle\n const isHoverable =\n isWeb &&\n !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave)\n\n const handlesPressEvents = !(isWeb || asChild)\n\n // check presence rather than value to prevent reparenting bugs\n // allows for onPress={x ? function : undefined} without re-ordering dom\n const shouldAttach = Boolean(\n attachPress ||\n isHoverable ||\n (noClassNames && 'pressStyle' in props) ||\n (isWeb && noClassNames && 'hoverStyle' in props)\n )\n\n const events: TamaguiComponentEvents | null =\n shouldAttach && !isRSC && !isDisabled && !asChild\n ? {\n onPressOut: attachPress\n ? (e) => {\n unPress()\n onPressOut?.(e)\n onMouseUp?.(e)\n }\n : undefined,\n ...(isHoverable && {\n onMouseEnter: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n if (isHoverable) {\n next.hover = true\n }\n if (state.pressIn) {\n next.press = true\n }\n if (isHoverable || state.pressIn) {\n setStateShallow(next)\n }\n onHoverIn?.(e)\n onMouseEnter?.(e)\n }\n : undefined,\n onMouseLeave: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n mouseUps.add(unPress)\n if (isHoverable) {\n next.hover = false\n }\n if (state.pressIn) {\n next.press = false\n next.pressIn = false\n }\n if (Object.keys(next).length) {\n setStateShallow(next)\n }\n onHoverOut?.(e)\n onMouseLeave?.(e)\n }\n : undefined,\n }),\n onPressIn: attachPress\n ? (e) => {\n setStateShallow({\n press: true,\n pressIn: true,\n hover: false,\n })\n onPressIn?.(e)\n onMouseDown?.(e)\n if (isWeb) {\n mouseUps.add(unPress)\n }\n }\n : undefined,\n onPress: attachPress\n ? (e) => {\n unPress()\n // @ts-ignore\n isWeb && onClick?.(e)\n onPress?.(e)\n }\n : undefined,\n }\n : null\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n if (events) {\n // replicating TouchableWithoutFeedback\n Object.assign(events, {\n cancelable: !props.rejectResponderTermination,\n disabled: isDisabled,\n hitSlop: props.hitSlop,\n delayLongPress: props.delayLongPress,\n delayPressIn: props.delayPressIn,\n delayPressOut: props.delayPressOut,\n focusable: viewProps.focusable ?? true,\n minPressDuration: 0,\n })\n }\n }\n\n // EVENTS native\n hooks.useEvents?.(viewProps, events, splitStyles, setStateShallow)\n\n const shouldReset = !!(themeShallow && themeState.isNewTheme)\n if (shouldReset) {\n stateRef.current.themeShallow = true\n }\n\n let content =\n !children || asChild\n ? children\n : spacedChildren({\n separator,\n children,\n space,\n direction: props.spaceDirection || 'both',\n isZStack,\n debug: debugProp,\n })\n\n if (asChild) {\n elementType = Slot\n viewProps = {\n ...viewProps,\n onPress,\n onPressIn,\n onPressOut,\n }\n }\n\n content = createElement(elementType, viewProps, content)\n\n content = useThemedChildren(themeState, content, {\n shallow: stateRef.current.themeShallow,\n // passPropsToChildren: true,\n })\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (events || isAnimatedReactNativeWeb) {\n content = (\n <span\n className={`${isAnimatedReactNativeWeb ? className : ''} _dsp_contents`}\n {...(events && {\n onMouseEnter: events.onMouseEnter,\n onMouseLeave: events.onMouseLeave,\n onClick: events.onPress,\n onMouseDown: events.onPressIn,\n onMouseUp: events.onPressOut,\n onTouchStart: events.onPressIn,\n onTouchEnd: events.onPressOut,\n })}\n >\n {content}\n </span>\n )\n }\n }\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG !== 'tamagui') {\n if (debugProp) {\n const element = typeof elementType === 'string' ? elementType : 'Component'\n console.groupCollapsed(`render <${element} /> with props`, viewProps)\n for (const key in viewProps) {\n console.log(key, viewProps[key])\n }\n console.log('children', content)\n console.groupEnd()\n if (typeof window !== 'undefined') {\n // prettier-ignore\n console.log({ state, themeState, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, staticConfig, tamaguiConfig, shouldForcePseudo })\n }\n console.groupEnd()\n }\n }\n\n return content\n })\n\n if (staticConfig.componentName) {\n component.displayName = staticConfig.componentName\n }\n\n onConfiguredOnce((conf) => {\n // one time only setup\n if (!tamaguiConfig) {\n tamaguiConfig = conf\n\n if (!initialTheme) {\n const next = conf.themes[Object.keys(conf.themes)[0]]\n initialTheme = proxyThemeVariables(next)\n if (process.env.NODE_ENV === 'development') {\n if (!initialTheme) {\n console.log('Warning: Missing theme')\n }\n }\n }\n }\n\n // per-component setup\n // do this to make sure shorthands don't duplicate with.. longhands\n mergeShorthands(staticConfig, tamaguiConfig)\n\n let defaultPropsIn = staticConfig.defaultProps || {}\n\n // because we run createTamagui after styled() defs, have to do some work here\n // gather defaults props one time and merge downwards\n // find last unprocessed and process\n const parentNames = [...(staticConfig.parentNames || []), staticConfig.componentName]\n\n if (tamaguiConfig.defaultProps && parentNames && staticConfig.componentName) {\n defaultPropsIn = mergeConfigDefaultProps(\n staticConfig.componentName,\n defaultPropsIn,\n tamaguiConfig.defaultProps,\n parentNames,\n tamaguiConfig\n )\n }\n\n const debug = defaultPropsIn['debug']\n\n // remove all classNames\n const [ourProps, ourClassNames] = mergeProps(defaultPropsIn, {})\n\n if (ourProps.tag) {\n defaultTag = ourProps.tag\n }\n\n const noClassNames = !staticConfig.acceptsClassName\n const { name, variants, defaultVariants, ...restProps } = ourProps\n\n // must preserve prop order\n // leave out className because we handle that already with initialSplitStyles.classNames\n // otherwise it confuses variant functions getting className props\n const [defaults, defaultsClassnames] = mergeProps(component.defaultProps as any, {\n ...defaultVariants,\n ...restProps,\n })\n\n // split - keep variables on props to be processed using theme values at runtime (native)\n if (!isWeb) {\n for (const key in staticConfig.defaultProps) {\n const val = staticConfig.defaultProps[key]\n if (validPseudoKeys[key]) continue\n defaults[key] = val\n }\n }\n\n // set to global\n tamaguiDefaultProps = defaults\n\n // add debug logs\n if (process.env.NODE_ENV === 'development' && debug) {\n if (process.env.IS_STATIC !== 'is_static') {\n console.log(`\uD83D\uDC1B [${staticConfig.componentName || 'Component'}]`, {\n staticConfig,\n tamaguiDefaultProps,\n defaults,\n defaultPropsIn,\n defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),\n defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [\n k,\n defaultPropsIn[k],\n ]),\n ourProps,\n ourClassNames,\n defaultsClassnames,\n defaultTag,\n noClassNames,\n })\n }\n }\n })\n\n let res: TamaguiComponent<ComponentPropTypes, Ref, BaseProps> = component as any\n\n if (configIn.memo) {\n res = memo(res) as any\n }\n\n res.staticConfig = {\n validStyles: staticConfig.validStyles || stylePropsView,\n ...staticConfig,\n }\n\n // res.extractable HoC\n res.extractable = (Component: any, conf?: Partial<StaticConfig>) => {\n Component.staticConfig = extendStaticConfig(\n {\n Component,\n ...conf,\n neverFlatten: true,\n isHOC: true,\n defaultProps: {\n ...Component.defaultProps,\n ...conf?.defaultProps,\n },\n },\n res\n )\n return Component\n }\n\n return res\n}\n\n// for elements to avoid spacing\nexport const Unspaced = (props: { children?: any }) => props.children\nUnspaced['isUnspaced'] = true\n\n// dont used styled() here to avoid circular deps\n// keep inline to avoid circular deps\n\nexport const Spacer = createComponent<SpacerProps>({\n acceptsClassName: true,\n memo: true,\n componentName: 'Spacer',\n validStyles,\n\n defaultProps: {\n ...stackDefaultStyles,\n // avoid nesting issues\n tag: 'span',\n size: true,\n pointerEvents: 'none',\n },\n\n variants: {\n size: {\n '...size': (size, { tokens }) => {\n size = size === true ? '$true' : size\n const sizePx = tokens.space[size] ?? size\n return {\n width: sizePx,\n height: sizePx,\n minWidth: sizePx,\n minHeight: sizePx,\n }\n },\n },\n\n flex: {\n true: {\n flexGrow: 1,\n },\n },\n\n direction: {\n horizontal: {\n height: 0,\n minHeight: 0,\n },\n vertical: {\n width: 0,\n minWidth: 0,\n },\n both: {},\n },\n } as const,\n})\n\nexport type SpacedChildrenProps = {\n isZStack?: boolean\n children?: React.ReactNode\n space?: SpaceTokens | number | null\n spaceFlex?: boolean | number\n direction?: SpaceDirection\n separator?: React.ReactNode\n debug?: DebugProp\n}\n\nexport function spacedChildren(props: SpacedChildrenProps) {\n const { isZStack, children, space, direction, spaceFlex, separator } = props\n const hasSpace = !!(space || spaceFlex)\n const hasSeparator = !(separator === undefined || separator === null)\n if (!(hasSpace || hasSeparator || isZStack)) {\n return children\n }\n\n const childrenList = Children.toArray(children)\n\n const len = childrenList.length\n if (len <= 1 && !isZStack && !childrenList[0]?.['type']?.['shouldForwardSpace']) {\n return childrenList\n }\n\n const final: React.ReactNode[] = []\n for (let [index, child] of childrenList.entries()) {\n const isEmpty =\n child === null ||\n child === undefined ||\n (Array.isArray(child) && child.length === 0)\n\n // forward space\n if (!isEmpty && React.isValidElement(child) && child.type?.['shouldForwardSpace']) {\n child = React.cloneElement(child, {\n space,\n spaceFlex,\n separator,\n key: child.key,\n } as any)\n }\n\n // push them all, but wrap some in Fragment\n if (isEmpty || !child || (child['key'] && !isZStack)) {\n final.push(child)\n } else {\n final.push(\n <Fragment key={index}>\n {isZStack ? <AbsoluteFill>{child}</AbsoluteFill> : child}\n </Fragment>\n )\n }\n\n // first child unspaced avoid insert space\n if (isUnspaced(child) && index === 0) continue\n // no spacing on ZStack\n if (isZStack) continue\n\n const next = childrenList[index + 1]\n\n if (next && !isUnspaced(next)) {\n if (separator) {\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}_00tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n final.push(\n React.isValidElement(separator)\n ? React.cloneElement(separator, { key: `sep_${index}` })\n : separator\n )\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}01tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n } else {\n final.push(\n createSpacer({\n key: `_${index}02tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n }\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props.debug) {\n console.log(` Spaced children`, final, props)\n }\n }\n\n return final\n}\n\ntype CreateSpacerProps = SpacedChildrenProps & { key: string }\n\nfunction createSpacer({ key, direction, space, spaceFlex }: CreateSpacerProps) {\n return (\n <Spacer\n key={key}\n size={space}\n direction={direction}\n {...(typeof spaceFlex !== 'undefined' && {\n flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex,\n })}\n />\n )\n}\n\nfunction isUnspaced(child: React.ReactNode) {\n const t = child?.['type']\n return t?.['isVisuallyHidden'] || t?.['isUnspaced']\n}\n\nconst DefaultProps = new Map()\n\nfunction mergeConfigDefaultProps(\n name: string,\n props: Record<string, any>,\n configDefaults: Record<string, Object>,\n parentNames: (string | undefined)[],\n conf: TamaguiInternalConfig\n) {\n const len = parentNames.length\n let prev\n\n for (let i = 0; i < len; i++) {\n const n = parentNames[i]\n if (!n) continue\n if (DefaultProps.has(n)) {\n prev = DefaultProps.get(n)\n continue\n }\n const props = configDefaults[n]\n if (!props) {\n if (prev) {\n DefaultProps.set(n, prev)\n }\n continue\n }\n prev = mergeProps(prev || {}, props, false, conf.inverseShorthands)[0]\n DefaultProps.set(n, prev)\n }\n\n // overwrite the user defined defaults on top of internal defined defaults\n const ourDefaultsMerged = DefaultProps.get(name)\n if (ourDefaultsMerged) {\n return mergeProps(props, ourDefaultsMerged, false, conf.inverseShorthands)[0]\n }\n return props\n}\n\nconst AbsoluteFill: any = createComponent({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n pointerEvents: 'box-none',\n },\n})\n\nfunction hasAnimatedStyleValue(style: Object) {\n return Object.keys(style).some((k) => {\n const val = style[k]\n return val && typeof val === 'object' && '_animation' in val\n })\n}\n"],
|
|
5
|
-
"mappings": "+kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,GAAA,aAAAC,GAAA,oBAAAC,GAAA,0BAAAC,GAAA,aAAAC,EAAA,mBAAAC,KAAA,eAAAC,GAAAR,IA+tBU,IAAAS,EAAA,6BA/tBVC,GAAgC,iCAChCC,EAAiD,8BACjDC,EAA6D,4BAC7DC,EAWO,qBAEPC,GAAiC,uBACjCH,GAAmC,oCACnCI,GAAoC,6CACpCC,GAAoC,6CACpCC,GAA4D,+BAC5DC,EAAsD,2CACtDC,GAA+B,uCAC/BC,EAA2B,mCAC3BC,GAAoC,4CACpCC,GAAmC,2CACnCC,GAAmC,yCACnCC,GAA+C,+BAC/CC,GAA6C,qCAC7CC,GAAkC,+BAClCC,GAAsB,2BAkBtBC,GAAqB,2BAGrBC,GAAkC,4BAelC,QAAQ,IAAI,eAEL,MAAMxB,GAA+C,CAC1D,MAAO,GACP,MAAO,GACP,QAAS,GACT,MAAO,GACP,UAAW,EACb,EAEMyB,GAAsD,CAC1D,GAAGzB,GACH,UAAW,EACb,EAKA,IAAI0B,EACAC,GACAC,GACAC,GAEG,MAAM5B,EAAW,IAAI,IAC5B,GAAI,OAAO,SAAa,IAAa,CACnC,MAAM6B,EAAgB,IAAM,CAC1B7B,EAAS,QAAS8B,GAAMA,EAAE,CAAC,EAC3B9B,EAAS,MAAM,CACjB,EACA,iBAAiB,UAAW6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ACxC,CAEA,MAAMC,EAAe,IAAI,IAEzB,SAAS5B,GACPvE,EACAhC,EACAoI,EACA9B,EACAF,EACA,CACA,MAAMiC,EAAM/B,EAAY,OACxB,IAAIgC,EAEJ,QAAS7C,EAAI,EAAGA,EAAI4C,EAAK5C,IAAK,CAC5B,MAAM8C,EAAIjC,EAAYb,CAAC,EACvB,GAAI,CAAC8C,EAAG,SACR,GAAIJ,EAAa,IAAII,CAAC,EAAG,CACvBD,EAAOH,EAAa,IAAII,CAAC,EACzB,QACF,CACA,MAAMvI,EAAQoI,EAAeG,CAAC,EAC9B,GAAI,CAACvI,EAAO,CACNsI,GACFH,EAAa,IAAII,EAAGD,CAAI,EAE1B,QACF,CACAA,KAAO,cAAWA,GAAQ,CAAC,EAAGtI,EAAO,GAAOoG,EAAK,iBAAiB,EAAE,CAAC,EACrE+B,EAAa,IAAII,EAAGD,CAAI,CAC1B,CAGA,MAAME,EAAoBL,EAAa,IAAInG,CAAI,EAC/C,OAAIwG,KACK,cAAWxI,EAAOwI,EAAmB,GAAOpC,EAAK,iBAAiB,EAAE,CAAC,EAEvEpG,CACT,CAEA,MAAM+H,GAAoBhM,GAAgB,CACxC,aAAc,CACZ,GAAG,sBACH,cAAe,SACf,SAAU,WACV,IAAK,EACL,MAAO,EACP,OAAQ,EACR,KAAM,EACN,cAAe,UACjB,CACF,CAAC,EAED,SAAS2E,GAAsBwE,EAAe,CAC5C,OAAO,OAAO,KAAKA,CAAK,EAAE,KAAM8B,GAAM,CACpC,MAAMD,EAAM7B,EAAM8B,CAAC,EACnB,OAAOD,GAAO,OAAOA,GAAQ,UAAY,eAAgBA,CAC3D,CAAC,CACH",
|
|
6
|
-
"names": ["createComponent_exports", "__export", "Spacer", "Unspaced", "createComponent", "defaultComponentState", "mouseUps", "spacedChildren", "__toCommonJS", "import_jsx_runtime", "import_compose_refs", "import_constants", "import_helpers", "import_react", "import_config", "import_FontLanguageContext", "import_TextAncestorContext", "import_createVariable", "import_extendStaticConfig", "import_getSplitStyles", "import_mergeProps", "import_proxyThemeVariables", "import_useShallowSetState", "import_useAnimationDriver", "import_useMedia", "import_useServerHooks", "import_useTheme", "import_setupHooks", "import_Slot", "import_Theme", "defaultComponentStateMounted", "tamaguiConfig", "AnimatedText", "AnimatedView", "initialTheme", "cancelTouches", "x", "mergeShorthands", "defaultProps", "shorthands", "key", "BaseText", "BaseView", "hasSetupBaseViews", "configIn", "ParentComponent", "staticConfig", "next", "defaultComponentClassName", "tamaguiDefaultProps", "defaultTag", "component", "propsIn", "forwardedRef", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "baseViews", "props", "debugProp", "Component", "isText", "isZStack", "componentName", "stateRef", "animationsConfig", "useAnimations", "isAnimated", "hasAnimatedStyleValue", "componentClassName", "hasTextAncestor", "languageContext", "isDisabled", "element", "BaseTextComponent", "BaseViewComponent", "elementType", "avoidClassesWhileAnimating", "hasEnterStyle", "needsMount", "states", "state", "setState", "setStateShallow", "usePresence", "presence", "presenceState", "isAnimatedReactNative", "isReactNative", "id", "name", "type", "dataIs", "banner", "shouldAvoidClasses", "shouldForcePseudo", "noClassNames", "themeState", "isStringElement", "isExiting", "mediaState", "splitStyles", "isMediaSpaced", "shouldListenForMedia", "
|
|
4
|
+
"sourcesContent": ["import { useComposedRefs } from '@tamagui/compose-refs'\nimport { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'\nimport { stylePropsView, validPseudoKeys, validStyles } from '@tamagui/helpers'\nimport React, {\n Children,\n Fragment,\n createElement,\n forwardRef,\n memo,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react'\n\nimport { onConfiguredOnce } from './config.js'\nimport { stackDefaultStyles } from './constants/constants.js'\nimport { FontLanguageContext } from './contexts/FontLanguageContext.js'\nimport { TextAncestorContext } from './contexts/TextAncestorContext.js'\nimport { didGetVariableValue, setDidGetVariableValue } from './createVariable.js'\nimport { extendStaticConfig, parseStaticConfig } from './helpers/extendStaticConfig.js'\nimport { useSplitStyles } from './helpers/getSplitStyles.js'\nimport { mergeProps } from './helpers/mergeProps.js'\nimport { proxyThemeVariables } from './helpers/proxyThemeVariables.js'\nimport { useShallowSetState } from './helpers/useShallowSetState.js'\nimport { useAnimationDriver } from './hooks/useAnimationDriver.js'\nimport { setMediaShouldUpdate, useMedia } from './hooks/useMedia.js'\nimport { useServerRef, useServerState } from './hooks/useServerHooks.js'\nimport { useThemeWithState } from './hooks/useTheme.js'\nimport { hooks } from './setupHooks.js'\nimport {\n DebugProp,\n SpaceDirection,\n SpaceTokens,\n SpacerProps,\n StaticConfig,\n StaticConfigParsed,\n StylableComponent,\n TamaguiComponent,\n TamaguiComponentEvents,\n TamaguiComponentState,\n TamaguiConfig,\n TamaguiElement,\n TamaguiInternalConfig,\n UseAnimationHook,\n UseAnimationProps,\n} from './types'\nimport { Slot } from './views/Slot.js'\nimport { Stack } from './views/Stack.js'\nimport { Text } from './views/Text.js'\nimport { useThemedChildren } from './views/Theme.js'\n\n// let t\n// import { timer } from '@tamagui/timer'\n// if (true || process.env.ANALYZE) {\n// t = require().timer()\n// setTimeout(() => {\n// const out = t.print()\n// if (isClient) {\n// alert(out)\n// }\n// }, 2000)\n// }\n\n// this appears to fix expo / babel not picking this up sometimes? really odd\nprocess.env.TAMAGUI_TARGET\n\nexport const defaultComponentState: TamaguiComponentState = {\n hover: false,\n press: false,\n pressIn: false,\n focus: false,\n unmounted: true,\n}\n\nconst defaultComponentStateMounted: TamaguiComponentState = {\n ...defaultComponentState,\n unmounted: false,\n}\n\n/**\n * All things that need one-time setup after createTamagui is called\n */\nlet tamaguiConfig: TamaguiInternalConfig\nlet AnimatedText: any\nlet AnimatedView: any\nlet initialTheme: any\n\nexport const mouseUps = new Set<Function>()\nif (typeof document !== 'undefined') {\n const cancelTouches = () => {\n mouseUps.forEach((x) => x())\n mouseUps.clear()\n }\n addEventListener('mouseup', cancelTouches)\n addEventListener('touchend', cancelTouches)\n addEventListener('touchcancel', cancelTouches)\n}\n\n// mutates\nfunction mergeShorthands(\n { defaultProps }: StaticConfigParsed,\n { shorthands }: TamaguiConfig\n) {\n // they are defined in correct order already { ...parent, ...child }\n for (const key of Object.keys(defaultProps)) {\n defaultProps[shorthands[key] || key] = defaultProps[key]\n }\n}\n\n/**\n * Only on native do we need the actual underlying View/Text\n * On the web we avoid react-native dep altogether.\n */\nlet BaseText: any\nlet BaseView: any\nlet hasSetupBaseViews = false\n\nexport function createComponent<\n ComponentPropTypes extends Object = {},\n Ref = TamaguiElement,\n BaseProps = never\n>(\n configIn: Partial<StaticConfig> | StaticConfigParsed,\n ParentComponent?: StylableComponent\n) {\n const staticConfig = (() => {\n const next = extendStaticConfig(configIn, ParentComponent)\n if ('parsed' in next) {\n return next\n } else {\n return parseStaticConfig(next)\n }\n })()\n\n const defaultComponentClassName = `is_${staticConfig.componentName}`\n let tamaguiDefaultProps: any\n let defaultTag: string | undefined\n\n // see onConfiguredOnce below which attaches a name then to this component\n const component = forwardRef<Ref, ComponentPropTypes>((propsIn: any, forwardedRef) => {\n if (process.env.TAMAGUI_TARGET === 'native') {\n // todo this could be moved to a cleaner location\n if (!hasSetupBaseViews) {\n hasSetupBaseViews = true\n const baseViews = hooks.getBaseViews?.()\n if (baseViews) {\n BaseText = baseViews.Text\n BaseView = baseViews.View\n }\n }\n }\n\n // test only\n if (process.env.NODE_ENV === 'test') {\n if (propsIn['data-test-renders']) {\n propsIn['data-test-renders']['current'] ??= 0\n propsIn['data-test-renders']['current'] += 1\n }\n }\n // const time = t.start({ quiet: true })\n\n // React inserts default props after your props for some reason...\n // order important so we do loops, you can't just spread because JS does weird things\n let props: any\n if (tamaguiDefaultProps && !propsIn.asChild) {\n props = mergeProps(tamaguiDefaultProps, propsIn)[0]\n } else {\n props = propsIn\n }\n\n const debugProp = props['debug'] as DebugProp\n const { Component, isText, isZStack } = staticConfig\n const componentName = props.componentName || staticConfig.componentName\n\n // conditional but if ever true stays true\n // [animated, inversed]\n const stateRef = useRef(\n undefined as any as {\n hasAnimated?: boolean\n themeShallow?: boolean\n didAccessThemeVariableValue?: boolean\n }\n )\n stateRef.current ||= {}\n\n const hostRef = useServerRef<TamaguiElement>(null)\n\n /**\n * Component state for tracking animations, pseudos\n */\n const animationsConfig = useAnimationDriver()\n const useAnimations = animationsConfig?.useAnimations as UseAnimationHook | undefined\n const isAnimated = (() => {\n const next = !!(\n !staticConfig.isHOC &&\n useAnimations &&\n (props.animation || (props.style && hasAnimatedStyleValue(props.style)))\n )\n if (next && !stateRef.current.hasAnimated) {\n stateRef.current.hasAnimated = true\n }\n return next || stateRef.current.hasAnimated\n })()\n const componentClassName = props.asChild\n ? ''\n : props.componentName\n ? `is_${props.componentName}`\n : defaultComponentClassName\n const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false)\n const languageContext = isRSC ? null : useContext(FontLanguageContext)\n const isDisabled = props.disabled ?? props.accessibilityState?.disabled\n\n const isTaggable = !Component || typeof Component === 'string'\n // default to tag, fallback to component (when both strings)\n const element = isWeb\n ? isTaggable\n ? props.tag || defaultTag || Component\n : Component\n : Component\n\n const BaseTextComponent = BaseText || element || 'span'\n const BaseViewComponent = BaseView || element || (hasTextAncestor ? 'span' : 'div')\n\n AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent\n AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent\n\n let elementType = isText\n ? (isAnimated ? AnimatedText : null) || BaseTextComponent\n : (isAnimated ? AnimatedView : null) || BaseViewComponent\n\n const avoidClassesWhileAnimating = animationsConfig?.isReactNative\n const hasEnterStyle = !!props.enterStyle\n const needsMount = Boolean(\n (isWeb ? isClient : true) && (hasEnterStyle || props.animation)\n )\n const states = useServerState<TamaguiComponentState>(\n needsMount ? defaultComponentState! : defaultComponentStateMounted!\n )\n\n const state = propsIn.forceStyle\n ? { ...states[0], [propsIn.forceStyle]: true }\n : states[0]\n const setState = states[1]\n const setStateShallow = useShallowSetState(setState, debugProp, componentName)\n\n const usePresence = animationsConfig?.usePresence\n const presence = !isRSC && isAnimated && usePresence ? usePresence() : null\n\n // set enter/exit variants onto our new props object\n if (isAnimated && presence) {\n const presenceState = presence[2]\n if (presenceState) {\n if (state.unmounted && presenceState.enterVariant) {\n props[presenceState.enterVariant] = true\n }\n if (!presenceState.isPresent && presenceState.exitVariant) {\n props[presenceState.exitVariant] = true\n }\n }\n }\n\n const isAnimatedReactNative = isAnimated && animationsConfig?.isReactNative\n const isReactNative = Boolean(staticConfig.isReactNative || isAnimatedReactNative)\n\n if (process.env.NODE_ENV === 'development') {\n const id = useId()\n\n if (debugProp) {\n // prettier-ignore\n const name = `${componentName || Component?.displayName || Component?.name || '[Unnamed Component]'}`\n const type = isAnimatedReactNative ? '(animated)' : isReactNative ? '(rnw)' : ''\n const dataIs = propsIn['data-is'] || ''\n const banner = `${name}${dataIs ? ` ${dataIs}` : ''} ${type} id ${id}`\n console.group(`%c ${banner}`, 'background: yellow;')\n if (!isServer) {\n console.log('state', state)\n }\n }\n }\n\n const shouldAvoidClasses =\n !isWeb ||\n !!(props.animation && avoidClassesWhileAnimating) ||\n !staticConfig.acceptsClassName\n const shouldForcePseudo = !!propsIn.forceStyle\n const noClassNames = shouldAvoidClasses || shouldForcePseudo\n\n const themeState = useThemeWithState({\n name: props.theme,\n componentName,\n reset: props.reset,\n inverse: props.themeInverse,\n // @ts-ignore this is internal use only\n disable: props['data-themeable'],\n debug:\n process.env.NODE_ENV === 'development' && props.debug ? { hostRef } : undefined,\n shouldUpdate: () => !!stateRef.current.didAccessThemeVariableValue,\n })!\n\n elementType = Component || elementType\n const isStringElement = typeof elementType === 'string'\n\n const isExiting = presence?.[0] === false\n\n const mediaState = useMedia(\n // @ts-ignore, we just pass a stable object so we can get it later with\n // should match to the one used in `setMediaShouldUpdate` below\n stateRef,\n debugProp ? { props, staticConfig } : null\n )\n\n setDidGetVariableValue(false)\n\n const splitStyles = useSplitStyles(\n props,\n staticConfig,\n themeState.theme,\n {\n ...state,\n mediaState,\n noClassNames,\n dynamicStylesInline: noClassNames,\n hasTextAncestor,\n resolveVariablesAs: 'auto',\n isExiting,\n },\n null,\n languageContext || undefined,\n elementType,\n debugProp\n )\n\n // only listen for changes if we are using raw theme values or media space, or dynamic media (native)\n // array = space media breakpoints\n const isMediaSpaced = Array.isArray(splitStyles.hasMedia)\n const shouldListenForMedia =\n didGetVariableValue() ||\n isMediaSpaced ||\n (noClassNames && splitStyles.hasMedia === true)\n\n setMediaShouldUpdate(stateRef, {\n enabled: shouldListenForMedia,\n keys: noClassNames && isMediaSpaced ? (splitStyles.hasMedia as any) : null,\n })\n\n // animation setup\n const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating\n\n if (process.env.NODE_ENV === 'development') {\n if (!process.env.TAMAGUI_TARGET) {\n console.error(\n `No process.env.TAMAGUI_TARGET set, please set it to \"native\" or \"web\".`\n )\n }\n\n if (debugProp) {\n console.groupCollapsed('props')\n // prettier-ignore\n console.log('props in', propsIn, 'mapped to', props, 'in order', Object.keys(props))\n console.log('splitStyles', splitStyles)\n // eslint-disable-next-line no-console\n console.log('shouldListenForMedia', shouldListenForMedia)\n // eslint-disable-next-line no-console\n console.log('className', Object.values(splitStyles.classNames))\n if (isClient) {\n console.log('ref', hostRef, '(click to view)')\n }\n console.groupEnd()\n if (debugProp === 'break') {\n // rome-ignore lint/suspicious/noDebugger: ok\n debugger\n }\n }\n }\n\n const {\n viewProps: viewPropsIn,\n pseudos,\n style: splitStylesStyle,\n classNames,\n space,\n } = splitStyles\n\n const propsWithAnimation = props as UseAnimationProps\n\n // once you set animation prop don't remove it, you can set to undefined/false\n // reason is animations are heavy - no way around it, and must be run inline here (\uD83D\uDE45 loading as a sub-component)\n let animationStyles: any\n if (!isRSC && isAnimated && useAnimations && !staticConfig.isHOC) {\n const animations = useAnimations({\n props: propsWithAnimation,\n style: splitStylesStyle,\n presence,\n state,\n pseudos: pseudos || null,\n onDidAnimate: props.onDidAnimate,\n hostRef,\n staticConfig,\n })\n if (animations) {\n animationStyles = animations.style\n }\n }\n\n const {\n asChild,\n children,\n onPress,\n onPressIn,\n onPressOut,\n onHoverIn,\n onHoverOut,\n themeShallow,\n spaceDirection: _spaceDirection,\n disabled: disabledProp,\n onMouseUp,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n separator,\n // ignore from here on out\n forceStyle: _forceStyle,\n // @ts-ignore for next/link compat etc\n onClick,\n theme: _themeProp,\n // @ts-ignore\n defaultVariants,\n\n ...nonTamaguiProps\n } = viewPropsIn\n\n const disabled = props.accessibilityState?.disabled || props.accessibilityDisabled\n\n // these can ultimately be for DOM, react-native-web views, or animated views\n // so the type is pretty loose\n let viewProps = nonTamaguiProps\n\n // if react-native-web view just pass all props down\n if (process.env.TAMAGUI_TARGET === 'web' && !isReactNative && !asChild) {\n viewProps = hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef)\n } else {\n viewProps = nonTamaguiProps\n }\n\n viewProps.ref = useComposedRefs(hostRef as any, forwardedRef)\n\n if (process.env.NODE_ENV === 'development') {\n if (!isText && isWeb && !staticConfig.isHOC) {\n Children.toArray(props.children).forEach((item) => {\n // allow newlines because why not its annoying with mdx\n if (typeof item === 'string' && item !== '\\n') {\n console.error(\n `Unexpected text node: ${item}. A text node cannot be a child of a <View>.`\n )\n }\n })\n }\n }\n\n const unPress = useCallback(() => {\n setStateShallow({\n press: false,\n pressIn: false,\n })\n }, [setStateShallow])\n\n if (isWeb) {\n useEffect(() => {\n return () => {\n mouseUps.delete(unPress)\n }\n }, [])\n }\n\n const shouldSetMounted = needsMount && state.unmounted\n useEffect(() => {\n if (!shouldSetMounted) return\n if (state.unmounted === true && needsMount) {\n setStateShallow({\n unmounted: false,\n })\n return\n }\n\n setStateShallow({\n unmounted: false,\n })\n }, [shouldSetMounted, state.unmounted])\n\n let styles: Record<string, any>[]\n\n if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {\n styles = {\n ...(animationStyles ?? splitStylesStyle),\n }\n } else {\n styles = [animationStyles ?? splitStylesStyle]\n\n // ugly but for now...\n if (shouldForcePseudo) {\n const next = {}\n styles.forEach((style) => Object.assign(next, style))\n // @ts-ignore\n Object.assign(splitStyles.style, next)\n }\n }\n\n let fontFamily = isText\n ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily\n : null\n if (fontFamily && fontFamily[0] === '$') {\n fontFamily = fontFamily.slice(1)\n }\n const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : ''\n\n const classList = [\n hasEnterStyle && ((state.unmounted && needsMount) || !isClient)\n ? 't_will-mount'\n : '',\n componentName ? componentClassName : '',\n fontFamilyClassName,\n classNames ? Object.values(classNames).join(' ') : '',\n ]\n\n const className = classList.join(' ')\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n const style = animationStyles ?? splitStyles.style\n\n if (isAnimatedReactNativeWeb) {\n viewProps.style = style\n } else if (isReactNative) {\n // TODO these shouldn't really return from getSplitStyles when in Native mode\n const cnStyles = { $$css: true }\n for (const name of className.split(' ')) {\n cnStyles[name] = name\n }\n viewProps.style = [...(Array.isArray(style) ? style : [style]), cnStyles]\n\n if (process.env.NODE_ENV === 'development') {\n // turn debug data- props into dataSet in dev mode\n Object.keys(viewProps).forEach((key) => {\n if (key.startsWith('data-')) {\n viewProps.dataSet ??= {}\n viewProps.dataSet[key.replace('data-', '')] = viewProps[key]\n delete viewProps[key]\n }\n })\n }\n } else {\n viewProps.className = className\n viewProps.style = style\n }\n }\n\n // TODO MOVE INTO HOOK\n if (process.env.TAMAGUI_TARGET === 'native') {\n // swap out the right family based on weight/style\n if (splitStyles.fontFamily) {\n const faceInfo = tamaguiConfig.fontsParsed[splitStyles.fontFamily]?.face\n if (faceInfo) {\n const [weight, style] = (() => {\n let weight: string | undefined\n let style: string | undefined\n for (let i = styles.length; i >= 0; i--) {\n weight ??= styles[i]?.fontWeight\n style ??= styles[i]?.fontStyle\n }\n return [weight || '400', style || 'normal'] as const\n })()\n const overrideFace = faceInfo[weight]?.[style]?.val\n if (overrideFace) {\n for (const style of styles) {\n if (style?.fontFamily) {\n style.fontFamily = overrideFace\n style.fontWeight = undefined\n style.fontStyle = undefined\n }\n }\n }\n }\n }\n\n // assign styles\n viewProps.style = styles\n }\n\n const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle\n const attachPress = Boolean(\n runtimePressStyle || onPress || onPressOut || onPressIn || onClick\n )\n const runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle\n const isHoverable =\n isWeb &&\n !!(runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave)\n\n const handlesPressEvents = !(isWeb || asChild)\n\n // check presence rather than value to prevent reparenting bugs\n // allows for onPress={x ? function : undefined} without re-ordering dom\n const shouldAttach = Boolean(\n attachPress ||\n isHoverable ||\n (noClassNames && 'pressStyle' in props) ||\n (isWeb && noClassNames && 'hoverStyle' in props)\n )\n\n const events: TamaguiComponentEvents | null =\n shouldAttach && !isRSC && !isDisabled && !asChild\n ? {\n onPressOut: attachPress\n ? (e) => {\n unPress()\n onPressOut?.(e)\n onMouseUp?.(e)\n }\n : undefined,\n ...(isHoverable && {\n onMouseEnter: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n if (isHoverable) {\n next.hover = true\n }\n if (state.pressIn) {\n next.press = true\n }\n if (isHoverable || state.pressIn) {\n setStateShallow(next)\n }\n onHoverIn?.(e)\n onMouseEnter?.(e)\n }\n : undefined,\n onMouseLeave: isHoverable\n ? (e) => {\n const next: Partial<typeof state> = {}\n mouseUps.add(unPress)\n if (isHoverable) {\n next.hover = false\n }\n if (state.pressIn) {\n next.press = false\n next.pressIn = false\n }\n if (Object.keys(next).length) {\n setStateShallow(next)\n }\n onHoverOut?.(e)\n onMouseLeave?.(e)\n }\n : undefined,\n }),\n onPressIn: attachPress\n ? (e) => {\n setStateShallow({\n press: true,\n pressIn: true,\n hover: false,\n })\n onPressIn?.(e)\n onMouseDown?.(e)\n if (isWeb) {\n mouseUps.add(unPress)\n }\n }\n : undefined,\n onPress: attachPress\n ? (e) => {\n unPress()\n // @ts-ignore\n isWeb && onClick?.(e)\n onPress?.(e)\n }\n : undefined,\n }\n : null\n\n if (process.env.TAMAGUI_TARGET === 'native') {\n if (events) {\n // replicating TouchableWithoutFeedback\n Object.assign(events, {\n cancelable: !props.rejectResponderTermination,\n disabled: isDisabled,\n hitSlop: props.hitSlop,\n delayLongPress: props.delayLongPress,\n delayPressIn: props.delayPressIn,\n delayPressOut: props.delayPressOut,\n focusable: viewProps.focusable ?? true,\n minPressDuration: 0,\n })\n }\n }\n\n // EVENTS native\n hooks.useEvents?.(viewProps, events, splitStyles, setStateShallow)\n\n const shouldReset = !!(themeShallow && themeState.isNewTheme)\n if (shouldReset) {\n stateRef.current.themeShallow = true\n }\n\n let content =\n !children || asChild\n ? children\n : spacedChildren({\n separator,\n children,\n space,\n direction: props.spaceDirection || 'both',\n isZStack,\n debug: debugProp,\n })\n\n if (asChild) {\n elementType = Slot\n viewProps = {\n ...viewProps,\n onPress,\n onPressIn,\n onPressOut,\n }\n }\n\n content = createElement(elementType, viewProps, content)\n\n content = useThemedChildren(themeState, content, {\n shallow: stateRef.current.themeShallow,\n // passPropsToChildren: true,\n })\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug'] === 'visualize') {\n const [onChangeCount, setOnChangeCount] = useState(0)\n\n useEffect(() => {\n themeState.themeManager?.onChangeTheme((name, manager) => {\n setOnChangeCount((p) => ++p)\n console.warn(`\uD83D\uDDA4`, name)\n })\n }, [themeState.themeManager])\n\n content = (\n <>\n {content}\n <code>\n <pre>\n {JSON.stringify({\n name: themeState.themeManager?.state.name,\n parent: themeState.themeManager?.state.parentName,\n id: themeState.themeManager?.id,\n parentId: themeState.themeManager?.parentManager?.id,\n isNew: themeState.isNewTheme,\n onChangeCount,\n })}\n </pre>\n </code>\n </>\n )\n }\n }\n\n if (process.env.TAMAGUI_TARGET === 'web') {\n if (events || isAnimatedReactNativeWeb) {\n content = (\n <span\n className={`${isAnimatedReactNativeWeb ? className : ''} _dsp_contents`}\n {...(events && {\n onMouseEnter: events.onMouseEnter,\n onMouseLeave: events.onMouseLeave,\n onClick: events.onPress,\n onMouseDown: events.onPressIn,\n onMouseUp: events.onPressOut,\n onTouchStart: events.onPressIn,\n onTouchEnd: events.onPressOut,\n })}\n >\n {content}\n </span>\n )\n }\n }\n\n if (process.env.NODE_ENV === 'development' && process.env.DEBUG !== 'tamagui') {\n if (debugProp) {\n const element = typeof elementType === 'string' ? elementType : 'Component'\n console.groupCollapsed(`render <${element} /> with props`, viewProps)\n for (const key in viewProps) {\n console.log(key, viewProps[key])\n }\n console.log('children', content)\n console.groupEnd()\n if (typeof window !== 'undefined') {\n // prettier-ignore\n console.log({ state, themeState, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: props.className?.split(' '), classNamesOut: viewProps.className?.split(' '), events, shouldAttach, styles, pseudos, content, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, staticConfig, tamaguiConfig, shouldForcePseudo })\n }\n console.groupEnd()\n }\n }\n\n return content\n })\n\n if (staticConfig.componentName) {\n component.displayName = staticConfig.componentName\n }\n\n onConfiguredOnce((conf) => {\n // one time only setup\n if (!tamaguiConfig) {\n tamaguiConfig = conf\n\n if (!initialTheme) {\n const next = conf.themes[Object.keys(conf.themes)[0]]\n initialTheme = proxyThemeVariables(next)\n if (process.env.NODE_ENV === 'development') {\n if (!initialTheme) {\n console.log('Warning: Missing theme')\n }\n }\n }\n }\n\n // per-component setup\n // do this to make sure shorthands don't duplicate with.. longhands\n mergeShorthands(staticConfig, tamaguiConfig)\n\n let defaultPropsIn = staticConfig.defaultProps || {}\n\n // because we run createTamagui after styled() defs, have to do some work here\n // gather defaults props one time and merge downwards\n // find last unprocessed and process\n const parentNames = [...(staticConfig.parentNames || []), staticConfig.componentName]\n\n if (tamaguiConfig.defaultProps && parentNames && staticConfig.componentName) {\n defaultPropsIn = mergeConfigDefaultProps(\n staticConfig.componentName,\n defaultPropsIn,\n tamaguiConfig.defaultProps,\n parentNames,\n tamaguiConfig\n )\n }\n\n const debug = defaultPropsIn['debug']\n\n // remove all classNames\n const [ourProps, ourClassNames] = mergeProps(defaultPropsIn, {})\n\n if (ourProps.tag) {\n defaultTag = ourProps.tag\n }\n\n const noClassNames = !staticConfig.acceptsClassName\n const { name, variants, defaultVariants, ...restProps } = ourProps\n\n // must preserve prop order\n // leave out className because we handle that already with initialSplitStyles.classNames\n // otherwise it confuses variant functions getting className props\n const [defaults, defaultsClassnames] = mergeProps(component.defaultProps as any, {\n ...defaultVariants,\n ...restProps,\n })\n\n // split - keep variables on props to be processed using theme values at runtime (native)\n if (!isWeb) {\n for (const key in staticConfig.defaultProps) {\n const val = staticConfig.defaultProps[key]\n if (validPseudoKeys[key]) continue\n defaults[key] = val\n }\n }\n\n // set to global\n tamaguiDefaultProps = defaults\n\n // add debug logs\n if (process.env.NODE_ENV === 'development' && debug) {\n if (process.env.IS_STATIC !== 'is_static') {\n console.log(`\uD83D\uDC1B [${staticConfig.componentName || 'Component'}]`, {\n staticConfig,\n tamaguiDefaultProps,\n defaults,\n defaultPropsIn,\n defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),\n defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [\n k,\n defaultPropsIn[k],\n ]),\n ourProps,\n ourClassNames,\n defaultsClassnames,\n defaultTag,\n noClassNames,\n })\n }\n }\n })\n\n let res: TamaguiComponent<ComponentPropTypes, Ref, BaseProps> = component as any\n\n if (configIn.memo) {\n res = memo(res) as any\n }\n\n res.staticConfig = {\n validStyles: staticConfig.validStyles || stylePropsView,\n ...staticConfig,\n }\n\n // res.extractable HoC\n res.extractable = (Component: any, conf?: Partial<StaticConfig>) => {\n Component.staticConfig = extendStaticConfig(\n {\n Component,\n ...conf,\n neverFlatten: true,\n isHOC: true,\n defaultProps: {\n ...Component.defaultProps,\n ...conf?.defaultProps,\n },\n },\n res\n )\n return Component\n }\n\n return res\n}\n\n// for elements to avoid spacing\nexport const Unspaced = (props: { children?: any }) => props.children\nUnspaced['isUnspaced'] = true\n\n// dont used styled() here to avoid circular deps\n// keep inline to avoid circular deps\n\nexport const Spacer = createComponent<SpacerProps>({\n acceptsClassName: true,\n memo: true,\n componentName: 'Spacer',\n validStyles,\n\n defaultProps: {\n ...stackDefaultStyles,\n // avoid nesting issues\n tag: 'span',\n size: true,\n pointerEvents: 'none',\n },\n\n variants: {\n size: {\n '...size': (size, { tokens }) => {\n size = size === true ? '$true' : size\n const sizePx = tokens.space[size] ?? size\n return {\n width: sizePx,\n height: sizePx,\n minWidth: sizePx,\n minHeight: sizePx,\n }\n },\n },\n\n flex: {\n true: {\n flexGrow: 1,\n },\n },\n\n direction: {\n horizontal: {\n height: 0,\n minHeight: 0,\n },\n vertical: {\n width: 0,\n minWidth: 0,\n },\n both: {},\n },\n } as const,\n})\n\nexport type SpacedChildrenProps = {\n isZStack?: boolean\n children?: React.ReactNode\n space?: SpaceTokens | number | null\n spaceFlex?: boolean | number\n direction?: SpaceDirection\n separator?: React.ReactNode\n debug?: DebugProp\n}\n\nexport function spacedChildren(props: SpacedChildrenProps) {\n const { isZStack, children, space, direction, spaceFlex, separator } = props\n const hasSpace = !!(space || spaceFlex)\n const hasSeparator = !(separator === undefined || separator === null)\n if (!(hasSpace || hasSeparator || isZStack)) {\n return children\n }\n\n const childrenList = Children.toArray(children)\n\n const len = childrenList.length\n if (len <= 1 && !isZStack && !childrenList[0]?.['type']?.['shouldForwardSpace']) {\n return childrenList\n }\n\n const final: React.ReactNode[] = []\n for (let [index, child] of childrenList.entries()) {\n const isEmpty =\n child === null ||\n child === undefined ||\n (Array.isArray(child) && child.length === 0)\n\n // forward space\n if (!isEmpty && React.isValidElement(child) && child.type?.['shouldForwardSpace']) {\n child = React.cloneElement(child, {\n space,\n spaceFlex,\n separator,\n key: child.key,\n } as any)\n }\n\n // push them all, but wrap some in Fragment\n if (isEmpty || !child || (child['key'] && !isZStack)) {\n final.push(child)\n } else {\n final.push(\n <Fragment key={index}>\n {isZStack ? <AbsoluteFill>{child}</AbsoluteFill> : child}\n </Fragment>\n )\n }\n\n // first child unspaced avoid insert space\n if (isUnspaced(child) && index === 0) continue\n // no spacing on ZStack\n if (isZStack) continue\n\n const next = childrenList[index + 1]\n\n if (next && !isUnspaced(next)) {\n if (separator) {\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}_00tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n final.push(\n React.isValidElement(separator)\n ? React.cloneElement(separator, { key: `sep_${index}` })\n : separator\n )\n if (hasSpace) {\n final.push(\n createSpacer({\n key: `_${index}01tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n } else {\n final.push(\n createSpacer({\n key: `_${index}02tmgui`,\n direction,\n space,\n spaceFlex,\n })\n )\n }\n }\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props.debug) {\n console.log(` Spaced children`, final, props)\n }\n }\n\n return final\n}\n\ntype CreateSpacerProps = SpacedChildrenProps & { key: string }\n\nfunction createSpacer({ key, direction, space, spaceFlex }: CreateSpacerProps) {\n return (\n <Spacer\n key={key}\n size={space}\n direction={direction}\n {...(typeof spaceFlex !== 'undefined' && {\n flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex,\n })}\n />\n )\n}\n\nfunction isUnspaced(child: React.ReactNode) {\n const t = child?.['type']\n return t?.['isVisuallyHidden'] || t?.['isUnspaced']\n}\n\nconst DefaultProps = new Map()\n\nfunction mergeConfigDefaultProps(\n name: string,\n props: Record<string, any>,\n configDefaults: Record<string, Object>,\n parentNames: (string | undefined)[],\n conf: TamaguiInternalConfig\n) {\n const len = parentNames.length\n let prev\n\n for (let i = 0; i < len; i++) {\n const n = parentNames[i]\n if (!n) continue\n if (DefaultProps.has(n)) {\n prev = DefaultProps.get(n)\n continue\n }\n const props = configDefaults[n]\n if (!props) {\n if (prev) {\n DefaultProps.set(n, prev)\n }\n continue\n }\n prev = mergeProps(prev || {}, props, false, conf.inverseShorthands)[0]\n DefaultProps.set(n, prev)\n }\n\n // overwrite the user defined defaults on top of internal defined defaults\n const ourDefaultsMerged = DefaultProps.get(name)\n if (ourDefaultsMerged) {\n return mergeProps(props, ourDefaultsMerged, false, conf.inverseShorthands)[0]\n }\n return props\n}\n\nconst AbsoluteFill: any = createComponent({\n defaultProps: {\n ...stackDefaultStyles,\n flexDirection: 'column',\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n pointerEvents: 'box-none',\n },\n})\n\nfunction hasAnimatedStyleValue(style: Object) {\n return Object.keys(style).some((k) => {\n const val = style[k]\n return val && typeof val === 'object' && '_animation' in val\n })\n}\n"],
|
|
5
|
+
"mappings": "+kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,GAAA,aAAAC,GAAA,oBAAAC,GAAA,0BAAAC,GAAA,aAAAC,EAAA,mBAAAC,KAAA,eAAAC,GAAAR,IA0uBU,IAAAS,EAAA,6BA1uBVC,GAAgC,iCAChCC,EAAiD,8BACjDC,EAA6D,4BAC7DC,EAYO,qBAEPC,GAAiC,uBACjCH,GAAmC,oCACnCI,GAAoC,6CACpCC,GAAoC,6CACpCC,GAA4D,+BAC5DC,GAAsD,2CACtDC,GAA+B,uCAC/BC,EAA2B,mCAC3BC,GAAoC,4CACpCC,GAAmC,2CACnCC,GAAmC,yCACnCC,GAA+C,+BAC/CC,GAA6C,qCAC7CC,GAAkC,+BAClCC,GAAsB,2BAkBtBC,GAAqB,2BAGrBC,GAAkC,4BAelC,QAAQ,IAAI,eAEL,MAAMxB,GAA+C,CAC1D,MAAO,GACP,MAAO,GACP,QAAS,GACT,MAAO,GACP,UAAW,EACb,EAEMyB,GAAsD,CAC1D,GAAGzB,GACH,UAAW,EACb,EAKA,IAAI0B,EACAC,GACAC,GACAC,GAEG,MAAM5B,EAAW,IAAI,IAC5B,GAAI,OAAO,SAAa,IA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Aa,IAAII,CAAC,EACzB,QACF,CACA,MAAM3I,EAAQwI,EAAeG,CAAC,EAC9B,GAAI,CAAC3I,EAAO,CACN0I,GACFH,GAAa,IAAII,EAAGD,CAAI,EAE1B,QACF,CACAA,KAAO,cAAWA,GAAQ,CAAC,EAAG1I,EAAO,GAAOwG,EAAK,iBAAiB,EAAE,CAAC,EACrE+B,GAAa,IAAII,EAAGD,CAAI,CAC1B,CAGA,MAAME,EAAoBL,GAAa,IAAItG,CAAI,EAC/C,OAAI2G,KACK,cAAW5I,EAAO4I,EAAmB,GAAOpC,EAAK,iBAAiB,EAAE,CAAC,EAEvExG,CACT,CAEA,MAAMmI,GAAoBzM,GAAgB,CACxC,aAAc,CACZ,GAAG,sBACH,cAAe,SACf,SAAU,WACV,IAAK,EACL,MAAO,EACP,OAAQ,EACR,KAAM,EACN,cAAe,UACjB,CACF,CAAC,EAED,SAASiF,GAAsBuE,EAAe,CAC5C,OAAO,OAAO,KAAKA,CAAK,EAAE,KAAMkC,GAAM,CACpC,MAAMD,EAAMjC,EAAMkC,CAAC,EACnB,OAAOD,GAAO,OAAOA,GAAQ,UAAY,eAAgBA,CAC3D,CAAC,CACH",
|
|
6
|
+
"names": ["createComponent_exports", "__export", "Spacer", "Unspaced", "createComponent", "defaultComponentState", "mouseUps", "spacedChildren", "__toCommonJS", "import_jsx_runtime", "import_compose_refs", "import_constants", "import_helpers", "import_react", "import_config", "import_FontLanguageContext", "import_TextAncestorContext", "import_createVariable", "import_extendStaticConfig", "import_getSplitStyles", "import_mergeProps", "import_proxyThemeVariables", "import_useShallowSetState", "import_useAnimationDriver", "import_useMedia", "import_useServerHooks", "import_useTheme", "import_setupHooks", "import_Slot", "import_Theme", "defaultComponentStateMounted", "tamaguiConfig", "AnimatedText", "AnimatedView", "initialTheme", "cancelTouches", "x", "mergeShorthands", "defaultProps", "shorthands", "key", "BaseText", "BaseView", "hasSetupBaseViews", "configIn", "ParentComponent", "staticConfig", "next", "defaultComponentClassName", "tamaguiDefaultProps", "defaultTag", "component", "propsIn", "forwardedRef", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "_s", "baseViews", "props", "debugProp", "Component", "isText", "isZStack", "componentName", "stateRef", "hostRef", "animationsConfig", "useAnimations", "isAnimated", "hasAnimatedStyleValue", "componentClassName", "hasTextAncestor", "languageContext", "isDisabled", "element", "BaseTextComponent", "BaseViewComponent", "elementType", "avoidClassesWhileAnimating", "hasEnterStyle", "needsMount", "states", "state", "setState", "setStateShallow", "usePresence", "presence", "presenceState", "isAnimatedReactNative", "isReactNative", "id", "name", "type", "dataIs", "banner", "shouldAvoidClasses", "shouldForcePseudo", "noClassNames", "themeState", "isStringElement", "isExiting", "mediaState", "splitStyles", "isMediaSpaced", "shouldListenForMedia", "isAnimatedReactNativeWeb", "viewPropsIn", "pseudos", "splitStylesStyle", "classNames", "space", "propsWithAnimation", "animationStyles", "animations", "asChild", "children", "onPress", "onPressIn", "onPressOut", "onHoverIn", "onHoverOut", "themeShallow", "_spaceDirection", "disabledProp", "onMouseUp", "onMouseDown", "onMouseEnter", "onMouseLeave", "separator", "_forceStyle", "onClick", "_themeProp", "defaultVariants", "nonTamaguiProps", "disabled", "viewProps", "item", "unPress", "shouldSetMounted", "styles", "style", "fontFamily", "fontFamilyClassName", "className", "cnStyles", "faceInfo", "weight", "i", "overrideFace", "runtimePressStyle", "attachPress", "runtimeHoverStyle", "isHoverable", "handlesPressEvents", "shouldAttach", "events", "e", "content", "onChangeCount", "setOnChangeCount", "manager", "p", "conf", "defaultPropsIn", "parentNames", "mergeConfigDefaultProps", "debug", "ourProps", "ourClassNames", "variants", "restProps", "defaults", "defaultsClassnames", "val", "k", "res", "size", "tokens", "sizePx", "direction", "spaceFlex", "hasSpace", "hasSeparator", "childrenList", "final", "index", "child", "isEmpty", "React", "AbsoluteFill", "isUnspaced", "createSpacer", "t", "DefaultProps", "configDefaults", "len", "prev", "n", "ourDefaultsMerged"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var S=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var x=(s,e)=>{for(var t in e)S(s,t,{get:e[t],enumerable:!0})},L=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of A(e))!k.call(s,n)&&n!==t&&S(s,n,{get:()=>e[n],enumerable:!(i=b(e,n))||i.enumerable});return s};var O=s=>L(S({},"__esModule",{value:!0}),s);var U={};x(U,{ThemeManager:()=>K,hasNoThemeUpdatingProps:()=>$});module.exports=O(U);var g=require("../config.js"),m=require("../constants/constants.js"),P=require("../hooks/getThemeUnwrapped.js");const C={name:""};function $(s){return!(s.name||s.componentName||s.inverse||s.reset)}let I=0;class K{constructor(e={},t){this.props=e;this.id=I++;this.themeListeners=new Set;this.parentManager=null;this.state=C;this._allKeys=null;if(t==="root"){this.updateState(e,!1);return}if(!t)throw process.env.NODE_ENV!=="production"?new Error("No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions."):"\u274C";if($(e))return t;t&&(this.parentManager=t);const i=this.getStateIfChanged(e);if(i){this.state=i;return}return t||this}updateState(e=this.props||{},t=!0){if((()=>{if(e.forceTheme)return this.state.theme=e.forceTheme,this.state.name=e.name||"",!0;const n=this.getStateIfChanged(e);if(n)return this.props=e,this.state=n,!0})())return this._allKeys=null,t&&this.notify(),this.state}getStateIfChanged(e=this.props,t=this.state,i=this.parentManager){const n=this.getState(e,i);if(t&&t!==C&&!n)return i==null?void 0:i.state;if(this.getStateShouldChange(n,t))return n}getStateShouldChange(e,t=this.state){return!(!(e!=null&&e.theme)||e.theme===(t==null?void 0:t.theme))}getState(e=this.props,t=this.parentManager){return D(e,t)||process.env.TAMAGUI_TARGET==="native"&&(t==null?void 0:t.state)||null}get allKeys(){var e;return this._allKeys||(this._allKeys=new Set([...((e=this.parentManager)==null?void 0:e.allKeys)||[],...Object.keys(this.state.theme||{})])),this._allKeys}getValue(e,t){if(!e)return;let i=(t||this.state).theme,n=this;for(;i&&n;){if(e in i)return i[e];n=n.parentManager,i=n==null?void 0:n.state.theme}const h=(0,g.getTokens)();if(e in h.color)return h.color[e]}notify(){this.themeListeners.forEach(e=>e(this.state.name,this))}onChangeTheme(e){return this.themeListeners.add(e),()=>{this.themeListeners.delete(e)}}}function V(s,e=!1){const t=`t_sub_theme ${m.THEME_CLASSNAME_PREFIX}${s}`;return e?t+(t.includes("dark_")?" t_dark":t.includes("light_")?" t_light":""):t.replace("light_","").replace("dark_","")}function D(s,e){var p,v,y;const t=(0,g.getThemes)();if(s.name&&s.reset)throw new Error("Cannot reset + set new name");if(s.reset&&!(e!=null&&e.parentManager))return process.env.NODE_ENV==="development"&&console.warn("Cannot reset no grandparent exists"),null;let i=null;const n=s.reset?((v=(p=e==null?void 0:e.parentManager)==null?void 0:p.state)==null?void 0:v.name)||"":s.name||"",{componentName:h}=s,u=((y=e==null?void 0:e.state)==null?void 0:y.name)||"",o=u.split(m.THEME_NAME_SEPARATOR),_=o[o.length-1],d=u&&_[0].toUpperCase()===_[0];d&&o.pop();const E=d?o.slice(0,o.length).join(m.THEME_NAME_SEPARATOR):u,T=o.length,N=h&&!n?T:0;process.env.NODE_ENV==="development"&&typeof s.debug=="string"&&(console.groupCollapsed("ThemeManager.getState()"),console.log({parentName:u,parentBaseTheme:E,base:o,min:N,max:T,isParentComponentTheme:d}));for(let f=T;f>=N;f--){let l=o.slice(0,f).join(m.THEME_NAME_SEPARATOR);s.inverse&&(l=R(l));const r=[];if(l&&l!==E&&r.push(l),n&&r.unshift(l?`${l}_${n}`:n),f===1){const a=r.findIndex(w=>!w.includes("_"));a>0&&r.splice(a,0,n)}if(h){if(n){const a=l.slice(0,l.indexOf(m.THEME_NAME_SEPARATOR));r.push(`${a}_${n}_${h}`)}r.push(`${l}_${h}`),n&&r.unshift(`${l}_${n}_${h}`)}const c=r.find(a=>a in t);if(process.env.NODE_ENV==="development"&&typeof s.debug=="string"&&console.log(" - ",{found:c,potentials:r}),c){i={name:c,theme:(0,P.getThemeUnwrapped)(t[c]),className:V(c,s.inverse),parentName:u};break}}return process.env.NODE_ENV==="development"&&typeof s.debug=="string"&&(console.log({result:i}),console.trace(),console.groupEnd()),i}const R=s=>s.startsWith("light")?s.replace(/^light/,"dark"):s.replace(/^dark/,"light");0&&(module.exports={ThemeManager,hasNoThemeUpdatingProps});
|
|
2
2
|
//# sourceMappingURL=ThemeManager.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/ThemeManager.tsx"],
|
|
4
|
-
"sourcesContent": ["import { getThemes, getTokens } from '../config.js'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from '../constants/constants.js'\nimport { getThemeUnwrapped } from '../hooks/getThemeUnwrapped.js'\nimport { ThemeParsed, ThemeProps } from '../types.js'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n reset?: boolean\n}\n\nexport type ThemeManagerState = {\n name: string\n theme?: ThemeParsed | null\n className?: string\n parentName?: string\n}\n\nconst emptyState: ThemeManagerState = { name: '' }\n\nexport function hasNoThemeUpdatingProps(props: ThemeProps) {\n return !(props.name || props.componentName || props.inverse || props.reset)\n}\n\nexport class ThemeManager {\n themeListeners = new Set<ThemeListener>()\n parentManager: ThemeManager | null = null\n state: ThemeManagerState = emptyState\n\n constructor(\n public props: ThemeProps = {},\n parentManager?: ThemeManager | 'root' | null | undefined\n ) {\n if (parentManager === 'root') {\n this.updateState(props, false)\n return\n }\n if (!parentManager) {\n if (process.env.NODE_ENV !== 'production') {\n
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAqC,wBACrCC,EAA6D,qCAC7DC,EAAkC,yCAoBlC,MAAMC,EAAgC,CAAE,KAAM,EAAG,EAE1C,SAASL,EAAwBM,EAAmB,CACzD,MAAO,EAAEA,EAAM,MAAQA,EAAM,eAAiBA,EAAM,SAAWA,EAAM,MACvE,
|
|
6
|
-
"names": ["ThemeManager_exports", "__export", "ThemeManager", "hasNoThemeUpdatingProps", "__toCommonJS", "import_config", "import_constants", "import_getThemeUnwrapped", "emptyState", "props", "parentManager", "updatedState", "notify", "nextState", "state", "_", "getState", "_a", "key", "theme", "manager", "tokens", "cb", "getNextThemeClassName", "name", "isInverting", "next", "
|
|
4
|
+
"sourcesContent": ["import { getThemes, getTokens } from '../config.js'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from '../constants/constants.js'\nimport { getThemeUnwrapped } from '../hooks/getThemeUnwrapped.js'\nimport { ThemeParsed, ThemeProps } from '../types.js'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n reset?: boolean\n}\n\nexport type ThemeManagerState = {\n name: string\n theme?: ThemeParsed | null\n className?: string\n parentName?: string\n}\n\nconst emptyState: ThemeManagerState = { name: '' }\n\nexport function hasNoThemeUpdatingProps(props: ThemeProps) {\n return !(props.name || props.componentName || props.inverse || props.reset)\n}\n\nlet uid = 0\n\nexport class ThemeManager {\n id = uid++\n themeListeners = new Set<ThemeListener>()\n parentManager: ThemeManager | null = null\n state: ThemeManagerState = emptyState\n\n constructor(\n public props: ThemeProps = {},\n parentManager?: ThemeManager | 'root' | null | undefined\n ) {\n if (parentManager === 'root') {\n this.updateState(props, false)\n return\n }\n if (!parentManager) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions.`\n )\n }\n throw `\u274C`\n }\n\n // no change no props\n if (hasNoThemeUpdatingProps(props)) {\n return parentManager\n }\n\n if (parentManager) {\n this.parentManager = parentManager\n }\n\n const updatedState = this.getStateIfChanged(props)\n if (updatedState) {\n this.state = updatedState\n return\n }\n\n return parentManager || this\n }\n\n updateState(\n props: ThemeProps & { forceTheme?: ThemeParsed } = this.props || {},\n notify = true\n ) {\n const shouldFlush = (() => {\n if (props.forceTheme) {\n this.state.theme = props.forceTheme\n this.state.name = props.name || ''\n return true\n }\n const nextState = this.getStateIfChanged(props)\n if (nextState) {\n this.props = props\n this.state = nextState\n return true\n }\n })()\n if (shouldFlush) {\n // reset any derived state\n this._allKeys = null\n notify && this.notify()\n return this.state\n }\n }\n\n getStateIfChanged(\n props = this.props,\n state: ThemeManagerState | null = this.state,\n parentManager = this.parentManager\n ) {\n const _ = this.getState(props, parentManager)\n // is removing\n if (state && state !== emptyState && !_) {\n return parentManager?.state\n }\n if (this.getStateShouldChange(_, state)) {\n return _\n }\n }\n\n getStateShouldChange(\n nextState: ThemeManagerState | null,\n state: ThemeManagerState | null = this.state\n ) {\n if (!nextState?.theme || nextState.theme === state?.theme) {\n return false\n }\n return true\n }\n\n getState(props = this.props, parentManager = this.parentManager) {\n return (\n getState(props, parentManager) ||\n (process.env.TAMAGUI_TARGET === 'native' ? parentManager?.state || null : null)\n )\n }\n\n _allKeys: Set<string> | null = null\n get allKeys() {\n this._allKeys ||= new Set([\n ...(this.parentManager?.allKeys || []),\n ...Object.keys(this.state.theme || {}),\n ])\n return this._allKeys\n }\n\n // gets value going up to parents\n getValue(key: string, state?: ThemeManagerState) {\n if (!key) return\n let theme = (state || this.state).theme\n let manager = this as ThemeManager | null\n while (theme && manager) {\n if (key in theme) {\n return theme[key]\n }\n manager = manager.parentManager\n theme = manager?.state.theme\n }\n const tokens = getTokens()\n if (key in tokens.color) {\n return tokens.color[key]\n }\n }\n\n notify() {\n this.themeListeners.forEach((cb) => cb(this.state.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n}\n\nfunction getNextThemeClassName(name: string, isInverting = false) {\n const next = `t_sub_theme ${THEME_CLASSNAME_PREFIX}${name}`\n if (isInverting) {\n return (\n next +\n // ensure you invert to base dark as well as specific dark\n // ... logic should likely be elsewhere\n (next.includes('dark_') ? ` t_dark` : next.includes('light_') ? ` t_light` : '')\n )\n }\n return next.replace('light_', '').replace('dark_', '')\n}\n\nfunction getState(\n props: ThemeProps,\n parentManager?: ThemeManager | null\n): ThemeManagerState | null {\n const themes = getThemes()\n\n if (props.name && props.reset) {\n throw new Error('Cannot reset + set new name')\n }\n\n if (props.reset && !parentManager?.parentManager) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Cannot reset no grandparent exists')\n }\n return null\n }\n\n let result: ThemeManagerState | null = null\n\n const nextName = props.reset\n ? parentManager?.parentManager?.state?.name || ''\n : props.name || ''\n const { componentName } = props\n const parentName = parentManager?.state?.name || ''\n\n // components look for most specific, fallback upwards\n const base = parentName.split(THEME_NAME_SEPARATOR)\n const lastSegment = base[base.length - 1]\n const isParentComponentTheme =\n parentName && lastSegment[0].toUpperCase() === lastSegment[0]\n if (isParentComponentTheme) {\n base.pop() // always remove componentName they can't nest\n }\n const parentBaseTheme = isParentComponentTheme\n ? base.slice(0, base.length).join(THEME_NAME_SEPARATOR)\n : parentName\n const max = base.length\n const min =\n componentName && !nextName\n ? max // component name only don't search upwards\n : 0\n\n // eslint-disable-next-line no-console\n if (process.env.NODE_ENV === 'development' && typeof props.debug === 'string') {\n console.groupCollapsed('ThemeManager.getState()')\n console.log({\n parentName,\n parentBaseTheme,\n base,\n min,\n max,\n isParentComponentTheme,\n })\n }\n\n for (let i = max; i >= min; i--) {\n let prefix = base.slice(0, i).join(THEME_NAME_SEPARATOR)\n if (props.inverse) {\n prefix = inverseThemeName(prefix)\n }\n const potentials: string[] = []\n if (prefix && prefix !== parentBaseTheme) {\n potentials.push(prefix)\n }\n if (nextName) {\n potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName)\n }\n if (i === 1) {\n const lastSegment = potentials.findIndex((x) => !x.includes('_'))\n if (lastSegment > 0) {\n potentials.splice(lastSegment, 0, nextName) // last try prefer our new name to parent\n }\n }\n if (componentName) {\n // components only look for component themes\n if (nextName) {\n const beforeSeparator = prefix.slice(0, prefix.indexOf(THEME_NAME_SEPARATOR))\n potentials.push(`${beforeSeparator}_${nextName}_${componentName}`)\n }\n potentials.push(`${prefix}_${componentName}`)\n if (nextName) {\n potentials.unshift(`${prefix}_${nextName}_${componentName}`)\n }\n }\n\n const found = potentials.find((t) => t in themes)\n\n if (process.env.NODE_ENV === 'development' && typeof props.debug === 'string') {\n console.log(' - ', { found, potentials })\n }\n\n if (found) {\n result = {\n name: found,\n theme: getThemeUnwrapped(themes[found]),\n className: getNextThemeClassName(found, props.inverse),\n parentName,\n }\n break\n }\n }\n\n // eslint-disable-next-line no-console\n if (process.env.NODE_ENV === 'development' && typeof props.debug === 'string') {\n console.log({\n result,\n })\n console.trace()\n console.groupEnd()\n }\n\n return result\n}\n\nconst inverseThemeName = (themeName: string) => {\n return themeName.startsWith('light')\n ? themeName.replace(/^light/, 'dark')\n : themeName.replace(/^dark/, 'light')\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAqC,wBACrCC,EAA6D,qCAC7DC,EAAkC,yCAoBlC,MAAMC,EAAgC,CAAE,KAAM,EAAG,EAE1C,SAASL,EAAwBM,EAAmB,CACzD,MAAO,EAAEA,EAAM,MAAQA,EAAM,eAAiBA,EAAM,SAAWA,EAAM,MACvE,CAEA,IAAIC,EAAM,EAEH,MAAMR,CAAa,CAMxB,YACSO,EAAoB,CAAC,EAC5BE,EACA,CAFO,WAAAF,EANT,QAAKC,IACL,oBAAiB,IAAI,IACrB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AQ,CAE9C,CACA,GAAIC,EAAe,CAEjB,GAAID,EAAU,CACZ,MAAMc,EAAkBJ,EAAO,MAAM,EAAGA,EAAO,QAAQ,sBAAoB,CAAC,EAC5EE,EAAW,KAAK,GAAGE,KAAmBd,KAAYC,GAAe,CACnE,CACAW,EAAW,KAAK,GAAGF,KAAUT,GAAe,EACxCD,GACFY,EAAW,QAAQ,GAAGF,KAAUV,KAAYC,GAAe,CAE/D,CAEA,MAAMc,EAAQH,EAAW,KAAMI,GAAMA,KAAKlB,CAAM,EAMhD,GAJI,QAAQ,IAAI,WAAa,eAAiB,OAAOrB,EAAM,OAAU,UACnE,QAAQ,IAAI,MAAO,CAAE,MAAAsC,EAAO,WAAAH,CAAW,CAAC,EAGtCG,EAAO,CACThB,EAAS,CACP,KAAMgB,EACN,SAAO,qBAAkBjB,EAAOiB,CAAK,CAAC,EACtC,UAAWvB,EAAsBuB,EAAOtC,EAAM,OAAO,EACrD,WAAAyB,CACF,EACA,KACF,CACF,CAGA,OAAI,QAAQ,IAAI,WAAa,eAAiB,OAAOzB,EAAM,OAAU,WACnE,QAAQ,IAAI,CACV,OAAAsB,CACF,CAAC,EACD,QAAQ,MAAM,EACd,QAAQ,SAAS,GAGZA,CACT,CAEA,MAAMY,EAAoBM,GACjBA,EAAU,WAAW,OAAO,EAC/BA,EAAU,QAAQ,SAAU,MAAM,EAClCA,EAAU,QAAQ,QAAS,OAAO",
|
|
6
|
+
"names": ["ThemeManager_exports", "__export", "ThemeManager", "hasNoThemeUpdatingProps", "__toCommonJS", "import_config", "import_constants", "import_getThemeUnwrapped", "emptyState", "props", "uid", "parentManager", "updatedState", "notify", "nextState", "state", "_", "getState", "_a", "key", "theme", "manager", "tokens", "cb", "getNextThemeClassName", "name", "isInverting", "next", "_b", "_c", "themes", "result", "nextName", "componentName", "parentName", "base", "lastSegment", "isParentComponentTheme", "parentBaseTheme", "max", "min", "i", "prefix", "inverseThemeName", "potentials", "x", "beforeSeparator", "found", "t", "themeName"]
|
|
7
7
|
}
|