stoop 0.0.20 → 0.2.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/LICENSE.md +21 -0
- package/README.md +144 -35
- package/dist/api/create-theme.d.ts +13 -0
- package/dist/api/css.d.ts +16 -0
- package/dist/api/global-css.d.ts +18 -0
- package/dist/api/keyframes.d.ts +16 -0
- package/dist/api/provider.d.ts +19 -0
- package/dist/api/styled.d.ts +41 -0
- package/dist/api/use-theme.d.ts +13 -0
- package/dist/constants.d.ts +21 -0
- package/dist/core/cache.d.ts +39 -0
- package/dist/core/compiler.d.ts +19 -0
- package/dist/core/theme-manager.d.ts +30 -0
- package/dist/core/variants.d.ts +15 -0
- package/dist/create-stoop.d.ts +12 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +13 -36
- package/dist/inject/browser.d.ts +59 -0
- package/dist/inject/dedup.d.ts +29 -0
- package/dist/inject/index.d.ts +41 -0
- package/dist/inject/ssr.d.ts +28 -0
- package/dist/types/index.d.ts +141 -0
- package/dist/types/react-polymorphic-types.d.ts +17 -0
- package/dist/utils/string.d.ts +102 -0
- package/dist/utils/theme-map.d.ts +25 -0
- package/dist/utils/theme-validation.d.ts +13 -0
- package/dist/utils/theme.d.ts +43 -0
- package/dist/utils/type-guards.d.ts +26 -0
- package/dist/utils/utilities.d.ts +14 -0
- package/package.json +66 -39
- package/dist/components/Button/Button.d.ts +0 -4
- package/dist/index.css +0 -1
package/dist/index.js
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`),
|
|
5
|
-
`)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Did you accidentally put curly braces around the import?`,M),"default"in M||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
16
|
-
|
|
17
|
-
Your code should look like:
|
|
18
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,M),M.default;throw B._result}function K(){var B=U.H;return B===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
19
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
20
|
-
2. You might be breaking the Rules of Hooks
|
|
21
|
-
3. You might have more than one copy of React in the same app
|
|
22
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),B}function F(){}function l(B){if(IB===null)try{var M=("require"+Math.random()).slice(0,7);IB=(bB&&bB[M]).call(bB,"timers").setImmediate}catch(X){IB=function(z){eB===!1&&(eB=!0,typeof MessageChannel==="undefined"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Y=new MessageChannel;Y.port1.onmessage=z,Y.port2.postMessage(void 0)}}return IB(B)}function L(B){return 1<B.length&&typeof AggregateError==="function"?new AggregateError(B):B[0]}function UB(B,M){M!==gB-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),gB=M}function i(B,M,X){var z=U.actQueue;if(z!==null)if(z.length!==0)try{D(z),l(function(){return i(B,M,X)});return}catch(Y){U.thrownErrors.push(Y)}else U.actQueue=null;0<U.thrownErrors.length?(z=L(U.thrownErrors),U.thrownErrors.length=0,X(z)):M(B)}function D(B){if(!uB){uB=!0;var M=0;try{for(;M<B.length;M++){var X=B[M];do{U.didUsePromise=!1;var z=X(!1);if(z!==null){if(U.didUsePromise){B[M]=X,B.splice(0,M);return}X=z}else break}while(1)}B.length=0}catch(Y){B.splice(0,M+1),U.thrownErrors.push(Y)}finally{uB=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!=="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=Symbol.for("react.transitional.element"),NB=Symbol.for("react.portal"),WB=Symbol.for("react.fragment"),YB=Symbol.for("react.strict_mode"),ZB=Symbol.for("react.profiler");Symbol.for("react.provider");var a=Symbol.for("react.consumer"),QB=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),t=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),n=Symbol.for("react.lazy"),CB=Symbol.for("react.offscreen"),VB=Symbol.iterator,wB={},TB={isMounted:function(){return!1},enqueueForceUpdate:function(B){I(B,"forceUpdate")},enqueueReplaceState:function(B){I(B,"replaceState")},enqueueSetState:function(B){I(B,"setState")}},H=Object.assign,Z={};Object.freeze(Z),w.prototype.isReactComponent={},w.prototype.setState=function(B,M){if(typeof B!=="object"&&typeof B!=="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,M,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};var W={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},E;for(E in W)W.hasOwnProperty(E)&&A(E,W[E]);f.prototype=w.prototype,W=GB.prototype=new f,W.constructor=GB,H(W,w.prototype),W.isPureReactComponent=!0;var N=Array.isArray,O=Symbol.for("react.client.reference"),U={H:null,A:null,T:null,S:null,actQueue:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null},T=Object.prototype.hasOwnProperty,d=Symbol.for("react.client.reference"),x=0,S,m,C,r,$,yB,cB;vB.__reactDisabledLog=!0;var kB,lB,fB=!1,hB=new(typeof WeakMap==="function"?WeakMap:Map),WH=Symbol.for("react.client.reference"),iB,oB,aB={},pB={},tB=!1,nB=/\/+/g,rB=typeof reportError==="function"?reportError:function(B){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B==="object"&&B!==null&&typeof B.message==="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(M))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",B);return}console.error(B)},eB=!1,IB=null,gB=0,_B=!1,uB=!1,BH=typeof queueMicrotask==="function"?function(B){queueMicrotask(function(){return queueMicrotask(B)})}:l;JH.Children={map:zB,forEach:function(B,M,X){zB(B,function(){M.apply(this,arguments)},X)},count:function(B){var M=0;return zB(B,function(){M++}),M},toArray:function(B){return zB(B,function(M){return M})||[]},only:function(B){if(!g(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},JH.Component=w,JH.Fragment=WB,JH.Profiler=ZB,JH.PureComponent=GB,JH.StrictMode=YB,JH.Suspense=p,JH.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,JH.act=function(B){var M=U.actQueue,X=gB;gB++;var z=U.actQueue=M!==null?M:[],Y=!1;try{var G=B()}catch(J){U.thrownErrors.push(J)}if(0<U.thrownErrors.length)throw UB(M,X),B=L(U.thrownErrors),U.thrownErrors.length=0,B;if(G!==null&&typeof G==="object"&&typeof G.then==="function"){var Q=G;return BH(function(){Y||_B||(_B=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(J,j){Y=!0,Q.then(function(v){if(UB(M,X),X===0){try{D(z),l(function(){return i(v,J,j)})}catch(b){U.thrownErrors.push(b)}if(0<U.thrownErrors.length){var e=L(U.thrownErrors);U.thrownErrors.length=0,j(e)}}else J(v)},function(v){UB(M,X),0<U.thrownErrors.length?(v=L(U.thrownErrors),U.thrownErrors.length=0,j(v)):j(v)})}}}var q=G;if(UB(M,X),X===0&&(D(z),z.length!==0&&BH(function(){Y||_B||(_B=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),U.actQueue=null),0<U.thrownErrors.length)throw B=L(U.thrownErrors),U.thrownErrors.length=0,B;return{then:function(J,j){Y=!0,X===0?(U.actQueue=z,l(function(){return i(q,J,j)})):J(q)}}},JH.cache=function(B){return function(){return B.apply(null,arguments)}},JH.cloneElement=function(B,M,X){if(B===null||B===void 0)throw Error("The argument must be a React element, but you passed "+B+".");var z=H({},B.props),Y=B.key,G=B._owner;if(M!=null){var Q;B:{if(T.call(M,"ref")&&(Q=Object.getOwnPropertyDescriptor(M,"ref").get)&&Q.isReactWarning){Q=!1;break B}Q=M.ref!==void 0}Q&&(G=h()),EB(M)&&(y(M.key),Y=""+M.key);for(q in M)!T.call(M,q)||q==="key"||q==="__self"||q==="__source"||q==="ref"&&M.ref===void 0||(z[q]=M[q])}var q=arguments.length-2;if(q===1)z.children=X;else if(1<q){Q=Array(q);for(var J=0;J<q;J++)Q[J]=arguments[J+2];z.children=Q}z=qB(B.type,Y,void 0,void 0,G,z);for(Y=2;Y<arguments.length;Y++)jB(arguments[Y],z.type);return z},JH.createContext=function(B){return B={$$typeof:QB,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:a,_context:B},B._currentRenderer=null,B._currentRenderer2=null,B},JH.createElement=function(B,M,X){if(BB(B))for(var z=2;z<arguments.length;z++)jB(arguments[z],B);else{if(z="",B===void 0||typeof B==="object"&&B!==null&&Object.keys(B).length===0)z+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";if(B===null)var Y="null";else N(B)?Y="array":B!==void 0&&B.$$typeof===o?(Y="<"+(P(B.type)||"Unknown")+" />",z=" Did you accidentally export a JSX literal instead of a component?"):Y=typeof B;console.error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Y,z)}var G;if(z={},Y=null,M!=null)for(G in oB||!("__self"in M)||"key"in M||(oB=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),EB(M)&&(y(M.key),Y=""+M.key),M)T.call(M,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(z[G]=M[G]);var Q=arguments.length-2;if(Q===1)z.children=X;else if(1<Q){for(var q=Array(Q),J=0;J<Q;J++)q[J]=arguments[J+2];Object.freeze&&Object.freeze(q),z.children=q}if(B&&B.defaultProps)for(G in Q=B.defaultProps,Q)z[G]===void 0&&(z[G]=Q[G]);return Y&&RB(z,typeof B==="function"?B.displayName||B.name||"Unknown":B),qB(B,Y,void 0,void 0,h(),z)},JH.createRef=function(){var B={current:null};return Object.seal(B),B},JH.forwardRef=function(B){B!=null&&B.$$typeof===R?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof B!=="function"?console.error("forwardRef requires a render function but was given %s.",B===null?"null":typeof B):B.length!==0&&B.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",B.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),B!=null&&B.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var M={$$typeof:u,render:B},X;return Object.defineProperty(M,"displayName",{enumerable:!1,configurable:!0,get:function(){return X},set:function(z){X=z,B.name||B.displayName||(Object.defineProperty(B,"name",{value:z}),B.displayName=z)}}),M},JH.isValidElement=g,JH.lazy=function(B){return{$$typeof:n,_payload:{_status:-1,_result:B},_init:PB}},JH.memo=function(B,M){BB(B)||console.error("memo: The first argument must be a component. Instead received: %s",B===null?"null":typeof B),M={$$typeof:R,type:B,compare:M===void 0?null:M};var X;return Object.defineProperty(M,"displayName",{enumerable:!1,configurable:!0,get:function(){return X},set:function(z){X=z,B.name||B.displayName||(Object.defineProperty(B,"name",{value:z}),B.displayName=z)}}),M},JH.startTransition=function(B){var M=U.T,X={};U.T=X,X._updatedFibers=new Set;try{var z=B(),Y=U.S;Y!==null&&Y(X,z),typeof z==="object"&&z!==null&&typeof z.then==="function"&&z.then(F,rB)}catch(G){rB(G)}finally{M===null&&X._updatedFibers&&(B=X._updatedFibers.size,X._updatedFibers.clear(),10<B&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),U.T=M}},JH.unstable_useCacheRefresh=function(){return K().useCacheRefresh()},JH.use=function(B){return K().use(B)},JH.useActionState=function(B,M,X){return K().useActionState(B,M,X)},JH.useCallback=function(B,M){return K().useCallback(B,M)},JH.useContext=function(B){var M=K();return B.$$typeof===a&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),M.useContext(B)},JH.useDebugValue=function(B,M){return K().useDebugValue(B,M)},JH.useDeferredValue=function(B,M){return K().useDeferredValue(B,M)},JH.useEffect=function(B,M){return K().useEffect(B,M)},JH.useId=function(){return K().useId()},JH.useImperativeHandle=function(B,M,X){return K().useImperativeHandle(B,M,X)},JH.useInsertionEffect=function(B,M){return K().useInsertionEffect(B,M)},JH.useLayoutEffect=function(B,M){return K().useLayoutEffect(B,M)},JH.useMemo=function(B,M){return K().useMemo(B,M)},JH.useOptimistic=function(B,M){return K().useOptimistic(B,M)},JH.useReducer=function(B,M,X){return K().useReducer(B,M,X)},JH.useRef=function(B){return K().useRef(B)},JH.useState=function(B){return K().useState(B)},JH.useSyncExternalStore=function(B,M,X){return K().useSyncExternalStore(B,M,X)},JH.useTransition=function(){return K().useTransition()},JH.version="19.0.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!=="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var sB=MH((qH)=>{var mB=dB(zH(),1);(function(){function A(H){if(H==null)return null;if(typeof H==="function")return H.$$typeof===K?null:H.displayName||H.name||null;if(typeof H==="string")return H;switch(H){case OB:return"Fragment";case qB:return"Portal";case g:return"Profiler";case jB:return"StrictMode";case c:return"Suspense";case XB:return"SuspenseList"}if(typeof H==="object")switch(typeof H.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),H.$$typeof){case $B:return(H.displayName||"Context")+".Provider";case AB:return(H._context.displayName||"Context")+".Consumer";case KB:var Z=H.render;return H=H.displayName,H||(H=Z.displayName||Z.name||"",H=H!==""?"ForwardRef("+H+")":"ForwardRef"),H;case xB:return Z=H.displayName||null,Z!==null?Z:A(H.type)||"Memo";case _:Z=H._payload,H=H._init;try{return A(H(Z))}catch(W){}}return null}function V(H){return""+H}function I(H){try{V(H);var Z=!1}catch(N){Z=!0}if(Z){Z=console;var W=Z.error,E=typeof Symbol==="function"&&Symbol.toStringTag&&H[Symbol.toStringTag]||H.constructor.name||"Object";return W.call(Z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),V(H)}}function w(){}function f(){if(D===0){o=console.log,NB=console.info,WB=console.warn,YB=console.error,ZB=console.group,a=console.groupCollapsed,QB=console.groupEnd;var H={configurable:!0,enumerable:!0,value:w,writable:!0};Object.defineProperties(console,{info:H,log:H,warn:H,error:H,group:H,groupCollapsed:H,groupEnd:H})}D++}function GB(){if(D--,D===0){var H={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},H,{value:o}),info:L({},H,{value:NB}),warn:L({},H,{value:WB}),error:L({},H,{value:YB}),group:L({},H,{value:ZB}),groupCollapsed:L({},H,{value:a}),groupEnd:L({},H,{value:QB})})}0>D&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function s(H){if(u===void 0)try{throw Error()}catch(W){var Z=W.stack.trim().match(/\n( *(at )?)/);u=Z&&Z[1]||"",p=-1<W.stack.indexOf(`
|
|
23
|
-
at`)?" (<anonymous>)":-1<W.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
24
|
-
`+u+H+p}function y(H,Z){if(!H||t)return"";var W=R.get(H);if(W!==void 0)return W;t=!0,W=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var E=null;E=F.H,F.H=null,f();try{var N={DetermineComponentFrameRoot:function(){try{if(Z){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch($){var r=$}Reflect.construct(H,[],C)}else{try{C.call()}catch($){r=$}H.call(C.prototype)}}else{try{throw Error()}catch($){r=$}(C=H())&&typeof C.catch==="function"&&C.catch(function(){})}}catch($){if($&&r&&typeof $.stack==="string")return[$.stack,r.stack]}return[null,null]}};N.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var O=Object.getOwnPropertyDescriptor(N.DetermineComponentFrameRoot,"name");O&&O.configurable&&Object.defineProperty(N.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var U=N.DetermineComponentFrameRoot(),T=U[0],d=U[1];if(T&&d){var x=T.split(`
|
|
25
|
-
`),S=d.split(`
|
|
26
|
-
`);for(U=O=0;O<x.length&&!x[O].includes("DetermineComponentFrameRoot");)O++;for(;U<S.length&&!S[U].includes("DetermineComponentFrameRoot");)U++;if(O===x.length||U===S.length)for(O=x.length-1,U=S.length-1;1<=O&&0<=U&&x[O]!==S[U];)U--;for(;1<=O&&0<=U;O--,U--)if(x[O]!==S[U]){if(O!==1||U!==1)do if(O--,U--,0>U||x[O]!==S[U]){var m=`
|
|
27
|
-
`+x[O].replace(" at new "," at ");return H.displayName&&m.includes("<anonymous>")&&(m=m.replace("<anonymous>",H.displayName)),typeof H==="function"&&R.set(H,m),m}while(1<=O&&0<=U);break}}}finally{t=!1,F.H=E,GB(),Error.prepareStackTrace=W}return x=(x=H?H.displayName||H.name:"")?s(x):"",typeof H==="function"&&R.set(H,x),x}function P(H){if(H==null)return"";if(typeof H==="function"){var Z=H.prototype;return y(H,!(!Z||!Z.isReactComponent))}if(typeof H==="string")return s(H);switch(H){case c:return s("Suspense");case XB:return s("SuspenseList")}if(typeof H==="object")switch(H.$$typeof){case KB:return H=y(H.render,!1),H;case xB:return P(H.type);case _:Z=H._payload,H=H._init;try{return P(H(Z))}catch(W){}}return""}function BB(){var H=F.A;return H===null?null:H.getOwner()}function vB(H){if(l.call(H,"key")){var Z=Object.getOwnPropertyDescriptor(H,"key").get;if(Z&&Z.isReactWarning)return!1}return H.key!==void 0}function FB(H,Z){function W(){CB||(CB=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Z))}W.isReactWarning=!0,Object.defineProperty(H,"key",{get:W,configurable:!0})}function DB(){var H=A(this.type);return VB[H]||(VB[H]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),H=this.props.ref,H!==void 0?H:null}function HB(H,Z,W,E,N,O){return W=O.ref,H={$$typeof:JB,type:H,key:Z,props:O,_owner:N},(W!==void 0?W:null)!==null?Object.defineProperty(H,"ref",{enumerable:!1,get:DB}):Object.defineProperty(H,"ref",{enumerable:!1,value:null}),H._store={},Object.defineProperty(H._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(H,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(H.props),Object.freeze(H)),H}function LB(H,Z,W,E,N,O){if(typeof H==="string"||typeof H==="function"||H===OB||H===g||H===jB||H===c||H===XB||H===zB||typeof H==="object"&&H!==null&&(H.$$typeof===_||H.$$typeof===xB||H.$$typeof===$B||H.$$typeof===AB||H.$$typeof===KB||H.$$typeof===UB||H.getModuleId!==void 0)){var U=Z.children;if(U!==void 0)if(E)if(i(U)){for(E=0;E<U.length;E++)MB(U[E],H);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else MB(U,H)}else{if(U="",H===void 0||typeof H==="object"&&H!==null&&Object.keys(H).length===0)U+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";H===null?E="null":i(H)?E="array":H!==void 0&&H.$$typeof===JB?(E="<"+(A(H.type)||"Unknown")+" />",U=" Did you accidentally export a JSX literal instead of a component?"):E=typeof H,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,U)}if(l.call(Z,"key")){U=A(H);var T=Object.keys(Z).filter(function(x){return x!=="key"});E=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",wB[U+E]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
28
|
-
let props = %s;
|
|
29
|
-
<%s {...props} />
|
|
30
|
-
React keys must be passed directly to JSX without using spread:
|
|
31
|
-
let props = %s;
|
|
32
|
-
<%s key={someKey} {...props} />`,E,U,T,U),wB[U+E]=!0)}if(U=null,W!==void 0&&(I(W),U=""+W),vB(Z)&&(I(Z.key),U=""+Z.key),"key"in Z){W={};for(var d in Z)d!=="key"&&(W[d]=Z[d])}else W=Z;return U&&FB(W,typeof H==="function"?H.displayName||H.name||"Unknown":H),HB(H,U,O,N,BB(),W)}function MB(H,Z){if(typeof H==="object"&&H&&H.$$typeof!==n){if(i(H))for(var W=0;W<H.length;W++){var E=H[W];h(E)&&EB(E,Z)}else if(h(H))H._store&&(H._store.validated=1);else if(H===null||typeof H!=="object"?W=null:(W=PB&&H[PB]||H["@@iterator"],W=typeof W==="function"?W:null),typeof W==="function"&&W!==H.entries&&(W=W.call(H),W!==H))for(;!(H=W.next()).done;)h(H.value)&&EB(H.value,Z)}}function h(H){return typeof H==="object"&&H!==null&&H.$$typeof===JB}function EB(H,Z){if(H._store&&!H._store.validated&&H.key==null&&(H._store.validated=1,Z=RB(Z),!TB[Z])){TB[Z]=!0;var W="";H&&H._owner!=null&&H._owner!==BB()&&(W=null,typeof H._owner.tag==="number"?W=A(H._owner.type):typeof H._owner.name==="string"&&(W=H._owner.name),W=" It was passed a child from "+W+".");var E=F.getCurrentStack;F.getCurrentStack=function(){var N=P(H.type);return E&&(N+=E()||""),N},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',Z,W),F.getCurrentStack=E}}function RB(H){var Z="",W=BB();return W&&(W=A(W.type))&&(Z=`
|
|
33
|
-
|
|
34
|
-
Check the render method of \``+W+"`."),Z||(H=A(H))&&(Z=`
|
|
35
|
-
|
|
36
|
-
Check the top-level render call using <`+H+">."),Z}var JB=Symbol.for("react.transitional.element"),qB=Symbol.for("react.portal"),OB=Symbol.for("react.fragment"),jB=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler");Symbol.for("react.provider");var AB=Symbol.for("react.consumer"),$B=Symbol.for("react.context"),KB=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),XB=Symbol.for("react.suspense_list"),xB=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),zB=Symbol.for("react.offscreen"),PB=Symbol.iterator,K=Symbol.for("react.client.reference"),F=mB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,l=Object.prototype.hasOwnProperty,L=Object.assign,UB=Symbol.for("react.client.reference"),i=Array.isArray,D=0,o,NB,WB,YB,ZB,a,QB;w.__reactDisabledLog=!0;var u,p,t=!1,R=new(typeof WeakMap==="function"?WeakMap:Map),n=Symbol.for("react.client.reference"),CB,VB={},wB={},TB={};qH.Fragment=OB,qH.jsxDEV=function(H,Z,W,E,N,O){return LB(H,Z,W,E,N,O)}})()});var XH={button:"button_5RnP0A"};var UH=dB(sB(),1);function OH({className:A,...V}){return UH.jsxDEV("button",{className:XH.button,type:"button",...V},void 0,!1,void 0,this)}export{OH as Button};
|
|
1
|
+
import{createContext as C4}from"react";import{createContext as W4}from"react";var YJ=Object.freeze({}),PJ=1e4,XJ=5000,GJ=10,NJ=W4(null),QJ=["colors","opacities","space","radii","sizes","fonts","fontWeights","fontSizes","letterSpacings","shadows","zIndices","transitions"],a={accentColor:"colors",animation:"transitions",animationDelay:"transitions",animationDuration:"transitions",animationTimingFunction:"transitions",backdropFilter:"shadows",background:"colors",backgroundColor:"colors",blockSize:"sizes",border:"colors",borderBlockColor:"colors",borderBlockEndColor:"colors",borderBlockStartColor:"colors",borderBottomColor:"colors",borderBottomLeftRadius:"radii",borderBottomRightRadius:"radii",borderColor:"colors",borderEndEndRadius:"radii",borderEndStartRadius:"radii",borderInlineColor:"colors",borderInlineEndColor:"colors",borderInlineStartColor:"colors",borderLeftColor:"colors",borderRadius:"radii",borderRightColor:"colors",borderStartEndRadius:"radii",borderStartStartRadius:"radii",borderTopColor:"colors",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",bottom:"space",boxShadow:"shadows",caretColor:"colors",color:"colors",columnGap:"space",columnRuleColor:"colors",fill:"colors",filter:"shadows",flexBasis:"sizes",floodColor:"colors",font:"fontSizes",fontFamily:"fonts",fontSize:"fontSizes",fontWeight:"fontWeights",gap:"space",gridColumnGap:"space",gridGap:"space",gridRowGap:"space",height:"sizes",inlineSize:"sizes",inset:"space",insetBlock:"space",insetBlockEnd:"space",insetBlockStart:"space",insetInline:"space",insetInlineEnd:"space",insetInlineStart:"space",left:"space",letterSpacing:"letterSpacings",lightingColor:"colors",margin:"space",marginBlock:"space",marginBlockEnd:"space",marginBlockStart:"space",marginBottom:"space",marginInline:"space",marginInlineEnd:"space",marginInlineStart:"space",marginLeft:"space",marginRight:"space",marginTop:"space",maxBlockSize:"sizes",maxHeight:"sizes",maxInlineSize:"sizes",maxWidth:"sizes",minBlockSize:"sizes",minHeight:"sizes",minInlineSize:"sizes",minWidth:"sizes",opacity:"opacities",outline:"colors",outlineColor:"colors",padding:"space",paddingBlock:"space",paddingBlockEnd:"space",paddingBlockStart:"space",paddingBottom:"space",paddingInline:"space",paddingInlineEnd:"space",paddingInlineStart:"space",paddingLeft:"space",paddingRight:"space",paddingTop:"space",right:"space",rowGap:"space",size:"sizes",stopColor:"colors",stroke:"colors",textDecorationColor:"colors",textEmphasisColor:"colors",textShadow:"shadows",top:"space",transition:"transitions",transitionDelay:"transitions",transitionDuration:"transitions",transitionProperty:"transitions",transitionTimingFunction:"transitions",width:"sizes",zIndex:"zIndices"},t=Symbol.for("stoop.component");function BJ(J){if(!J||typeof J!=="object"||Array.isArray(J))throw new Error("[Stoop] Theme must be a non-null object");let $=J,Z=[];for(let X in $){if(X==="media")continue;if(!QJ.includes(X))Z.push(X)}if(Z.length>0){let X=`[Stoop] Theme contains invalid scales: ${Z.join(", ")}. Only these scales are allowed: ${QJ.join(", ")}`;if(typeof process!=="undefined"&&process.env?.NODE_ENV!=="production")throw new Error(X);console.warn(X)}return J}function C(J){return typeof J==="object"&&J!==null}function D4(J){return typeof J==="object"&&J!==null&&"__isStoopStyled"in J&&"__stoopClassName"in J&&J.__isStoopStyled===!0}function wJ(J){return C(J)&&!D4(J)}function o(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function xJ(J){return function $(Z){let X=BJ(Z);function q(Y,Q){let G={...Y},W=Object.keys(Q);for(let B of W){let D=Q[B],H=Y[B];if(o(D)&&o(H))G[B]={...H,...D};else if(D!==void 0)G[B]=D}let F=Object.keys(Y);for(let B of F)if(!(B in G))G[B]=Y[B];return G}return q(J,X)}}var gJ=new Map;class UJ extends Map{maxSize;constructor(J){super();this.maxSize=J}get(J){let $=super.get(J);if($!==void 0)super.delete(J),super.set(J,$);return $}set(J,$){if(super.has(J))super.delete(J);else if(this.size>=this.maxSize){let Z=this.keys().next().value;if(Z!==void 0)super.delete(Z)}return super.set(J,$),this}}var p=new UJ(XJ),e=new UJ(XJ);function bJ(J){return gJ.has(J)}function vJ(J){gJ.set(J,J)}function TJ(){if(p.size>XJ){let J=p.keys().next().value;if(J)p.delete(J),e.delete(J)}}function FJ(J){let $=0;for(let Z=0;Z<J.length;Z++){let X=J.charCodeAt(Z);$=($<<5)-$+X,$=$&$}return Math.abs($).toString(36)}function WJ(J){try{return FJ(JSON.stringify(J))}catch{return FJ(String(J))}}function H4(J){return J.replace(/([A-Z])/g,"-$1").toLowerCase()}function h(J){return String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/'/g,"\\'").replace(/;/g,"\\;").replace(/\n/g,"\\A ").replace(/\r/g,"").replace(/\f/g,"\\C ")}function P(J){let $=J.replace(/[^a-zA-Z0-9\s\-_>+~:.#[\]&@()]/g,"");if(!$.trim()||/^[>+~:.#[\]&@()\s]+$/.test($))return"";return $}function f(J){return J.replace(/[^a-zA-Z0-9-_]/g,"-").replace(/^[\d-]+/,"").replace(/^-+/,"")||"invalid"}function kJ(J){return String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/'/g,"\\'").replace(/;/g,"\\;").replace(/\n/g,"\\A ").replace(/\r/g,"").replace(/\f/g,"\\C ").replace(/\{/g,"\\7B ").replace(/\}/g,"\\7D ")}function M(J){if(!J)return"";return J.replace(/[^a-zA-Z0-9-_]/g,"").replace(/^[\d-]+/,"").replace(/^-+/,"")||""}function CJ(J){if(!J)return"";return J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function DJ(J){if(!J||typeof J!=="string")return"";let $=J.replace(/[^a-zA-Z0-9\s():,<>=\-@]/g,"");if(!$.trim()||!/[a-zA-Z]/.test($))return"";return $}function fJ(J){if(!J||typeof J!=="string")return"";let $=J.trim().split(/\s+/),Z=[];for(let X of $){if(!X)continue;let Y=X.replace(/[^a-zA-Z0-9-_]/g,"").replace(/^\d+/,"");if(Y&&/^[a-zA-Z-_]/.test(Y))Z.push(Y)}return Z.join(" ")}function c(J){if(!J||typeof J!=="string")return"";return H4(J).replace(/[^a-zA-Z0-9-]/g,"").replace(/^-+|-+$/g,"").replace(/^\d+/,"")||""}function SJ(J){if(!J||typeof J!=="string")return!1;if(J==="from"||J==="to")return!0;if(/^\d+(\.\d+)?%$/.test(J)){let Z=parseFloat(J);return Z>=0&&Z<=100}return!1}function L4(J){if(J.includes("Color")||J==="fill"||J==="stroke"||J==="accentColor"||J==="caretColor"||J==="border"||J==="outline"||J.includes("background")&&!J.includes("Size")&&!J.includes("Image"))return"colors";if(/^(margin|padding|gap|inset|top|right|bottom|left|rowGap|columnGap|gridGap|gridRowGap|gridColumnGap)/.test(J)||J.includes("Block")||J.includes("Inline"))return"space";if(/(width|height|size|basis)$/i.test(J)||J.includes("BlockSize")||J.includes("InlineSize"))return"sizes";if(J==="fontSize"||J==="font"&&!J.includes("Family"))return"fontSizes";if(J==="fontFamily"||J.includes("FontFamily"))return"fonts";if(J==="fontWeight"||J.includes("FontWeight"))return"fontWeights";if(J==="letterSpacing"||J.includes("LetterSpacing"))return"letterSpacings";if(J.includes("Radius")||J.includes("radius"))return"radii";if(J.includes("Shadow")||J.includes("shadow")||J==="filter"||J==="backdropFilter")return"shadows";if(J==="zIndex"||J.includes("ZIndex")||J.includes("z-index"))return"zIndices";if(J==="opacity"||J.includes("Opacity"))return"opacities";if(J.startsWith("transition")||J.startsWith("animation")||J.includes("Transition")||J.includes("Animation"))return"transitions";return}function dJ(J,$){if($&&J in $)return $[J];if(J in a)return a[J];return L4(J)}var yJ=new WeakMap;function w4(J){let $=yJ.get(J);if($)return $;let Z=new Map;function X(q,Y=[]){let Q=Object.keys(q).sort();for(let G of Q){let W=q[G],F=[...Y,G];if(o(W))X(W,F);else{let B=Z.get(G);if(B)B.push(F);else Z.set(G,[F])}}}X(J);for(let[q,Y]of Z.entries())if(Y.length>1){if(Y.sort((Q,G)=>{let W=Q.length-G.length;if(W!==0)return W;let F=Q.join("."),B=G.join(".");return F.localeCompare(B)}),typeof process!=="undefined"&&process.env?.NODE_ENV!=="production")console.warn(`[Stoop] Ambiguous token "$${q}" found in multiple categories: ${Y.map((Q)=>Q.join(".")).join(", ")}. Using "${Y[0].join(".")}" (deterministic: shorter paths first, then alphabetical). Use full path "$${Y[0].join(".")}" to be explicit.`)}return yJ.set(J,Z),Z}function U4(J,$){let Z=Object.keys(J).filter((q)=>q!=="media"),X=Object.keys($).filter((q)=>q!=="media");if(Z.length!==X.length)return!1;for(let q of Z)if(!(q in $))return!1;return!0}function uJ(J,$){if(J===$)return!0;if(!J||!$)return!1;if(!U4(J,$))return!1;let Z={...J},X={...$};return delete Z.media,delete X.media,JSON.stringify(Z)===JSON.stringify(X)}function RJ(J,$,Z){if(Z&&Z in J){let Y=J[Z];if(Y&&typeof Y==="object"&&!Array.isArray(Y)&&$ in Y)return[Z,$]}let q=w4(J).get($);if(!q||q.length===0)return null;return q[0]}function R4(J,$,Z,X){if(!J.startsWith("$"))return J;let q=J.slice(1);if(q.includes("$")||q.includes("."))return`var(${`--${(q.includes("$")?q.split("$"):q.split(".")).map((B)=>f(B)).join("-")}`})`;if($&&Z){let G=dJ(Z,X);if(G){let F=RJ($,q,G);if(F)return`var(${`--${F.map((H)=>f(H)).join("-")}`})`}let W=RJ($,q);if(W)return`var(${`--${W.map((D)=>f(D)).join("-")}`})`}else if($){let G=RJ($,q);if(G)return`var(${`--${G.map((B)=>f(B)).join("-")}`})`}return`var(${`--${f(q)}`})`}function n(J,$=""){let Z=CJ($),X=Z?`:root[data-stoop="${Z}"]`:":root",q=[];function Y(Q,G=[]){let W=Object.keys(Q).sort();for(let F of W){if(F==="media")continue;let B=Q[F],D=[...G,F];if(o(B))Y(B,D);else{let L=`--${D.map((R)=>f(R)).join("-")}`,O=typeof B==="string"||typeof B==="number"?kJ(B):String(B);q.push(` ${L}: ${O};`)}}}if(Y(J),q.length===0)return"";return`${X} {
|
|
2
|
+
${q.join(`
|
|
3
|
+
`)}
|
|
4
|
+
}`}function S(J,$,Z,X){if(!J||typeof J!=="object")return J;let q={};for(let Y in J){let Q=J[Y];if(C(Q))q[Y]=S(Q,$,Z,X);else if(typeof Q==="string"&&Q.includes("$")){let G=X||Y;q[Y]=Q.replace(/(calc\()?(-?)(\$[a-zA-Z][a-zA-Z0-9]*(?:\$[a-zA-Z][a-zA-Z0-9]*)?(?:\.[a-zA-Z][a-zA-Z0-9]*)?)/g,(W,F,B,D,H,L)=>{let O=R4(D,$,G,Z),R=L.slice(Math.max(0,H-10),H),A=R.includes("calc(")&&!R.includes(")");if(B==="-"){if(A||F==="calc(")return`${F||""}-${O}`;return`calc(-1 * ${O})`}if(F==="calc(")return`${F}${O}`;return O})}else q[Y]=Q}return q}var AJ=new Map;function g(J){return AJ.has(J)}function N(J,$){AJ.set(J,$)}function HJ(){return new Map(AJ)}var m=[];function JJ(J){if(m.includes(J))return;if(m.length>=PJ)m.shift();m.push(J)}function IJ(){return m.join(`
|
|
5
|
+
`)}function pJ(J){return m.includes(J)}var U=null,_J=new Map,cJ=new Map,A4=new Map,l=new Map,d=null;if(typeof document!=="undefined")(function J(){if(!U)U=document.createElement("style"),U.setAttribute("data-stoop","stoop"),document.head.appendChild(U)})();function nJ(){if(l.size===0||!U||!U.parentNode){d=null;return}let J=Array.from(l.values()).join(`
|
|
6
|
+
`);if(!J){l.clear(),d=null;return}let{sheet:$}=U;if($&&$.insertRule&&!J.includes("@")&&!J.includes("&"))try{let X=J.split(/(?<=})\s*(?=\S)/),q=!0;for(let Y of X){let Q=Y.trim();if(Q)try{$.insertRule(Q,$.cssRules.length)}catch{q=!1;break}}if(q){l.clear(),d=null;return}}catch{}let Z=U.textContent||"";U.textContent=Z+(Z?`
|
|
7
|
+
`:"")+J,l.clear(),d=null}function I4(J,$){if(l.set($,J),!d&&typeof requestAnimationFrame!=="undefined")d=requestAnimationFrame(nJ);else if(!d)nJ()}function KJ(J=""){if(typeof document==="undefined")throw new Error("Cannot access document in SSR context");let $=M(J);if(U){if(U.parentNode)return U;if(U.textContent)try{return document.head.appendChild(U),U}catch{}U=null}return U=document.createElement("style"),U.setAttribute("data-stoop",$||"stoop"),document.head.appendChild(U),U}function OJ(J,$,Z=""){if(!J)return;let X=M(Z),q=`__theme_vars_${X}`;if((cJ.get(q)??null)===J){if((_J.get(q)??null)!==$)_J.set(q,$);return}if(_J.set(q,$),cJ.set(q,J),typeof document==="undefined"){JJ(J);return}let Q=KJ(X),G=Q.textContent||"";if(g(q)){let W=X?`:root[data-stoop="${X}"]`:":root",F=new RegExp(`${W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\{[\\s\\S]*?\\}`,"g"),B=G.replace(F,"").trim();Q.textContent=J+(B?`
|
|
8
|
+
`+B:""),N(q,J)}else Q.textContent=J+(G?`
|
|
9
|
+
`+G:""),N(q,J)}function mJ(J,$=""){let Z=M($);if(A4.set(Z,J),typeof document!=="undefined"){KJ(Z);let X=n(J,Z);OJ(X,J,Z)}}function _4(J,$,Z=""){if(typeof document==="undefined")return;let X=M(Z);if(U&&U.parentNode){let q=U.textContent||"",Y=J.replace(/\s+/g," ").trim();if(q.replace(/\s+/g," ").trim().includes(Y)){if(!g($))N($,J);return}}try{let q=KJ(X),Y=q.textContent||"",Q=J.replace(/\s+/g," ").trim();if(Y.replace(/\s+/g," ").trim().includes(Q)){if(!g($))N($,J);return}if(!Y){let W=HJ();if(W.size>0){let F=Array.from(W.entries()).filter(([B])=>!B.startsWith("__theme_vars_")&&B!==$).map(([,B])=>B).join(`
|
|
10
|
+
`);q.textContent=F+(F?`
|
|
11
|
+
`:"")+J}else q.textContent=J}else I4(J,$);if(!g($))N($,J)}catch{if(!g($))N($,J)}if(!pJ(J))JJ(J)}function lJ(J,$,Z=""){if(g($))return;if(N($,J),bJ(J))return;vJ(J);let X=M(Z);if(U&&U.parentNode)try{let q=U.textContent||"",Y=J.replace(/\s+/g," ").trim();if(q.replace(/\s+/g," ").trim().includes(Y))return}catch{}_4(J,$,X)}function iJ(){return U}function T(J,$="",Z){let X=Z||J;if(typeof document==="undefined"){if(!g(X))N(X,J);JJ(J);return}lJ(J,X,$)}function rJ(J,$,Z=""){OJ(J,$,Z)}function sJ(J,$=""){mJ(J,$)}function aJ(){if(typeof document!=="undefined"){let J=iJ();if(J&&J.parentNode){let $=J.textContent||"";if(!$&&HJ().size>0)return IJ();return $}}return IJ()}function $J(J,$){if(!$||!J||typeof J!=="object")return J;let Z={},X=Object.keys($);for(let q in J){let Y=J[q];if(X.includes(q)&&$[q])try{let Q=$[q](Y);if(Q&&typeof Q==="object")Object.assign(Z,Q)}catch{Z[q]=Y}else if(C(Y))Z[q]=$J(Y,$);else Z[q]=Y}return Z}function O4(J,$){if(typeof J==="symbol"&&J===t)return!0;if(typeof $==="object"&&$!==null&&t in $)return!0;if(typeof J==="string"&&J.startsWith("__STOOP_COMPONENT_"))return!0;return!1}function E4(J,$){if(typeof $==="object"&&$!==null&&"__stoopClassName"in $&&typeof $.__stoopClassName==="string")return $.__stoopClassName;if(typeof J==="string"&&J.startsWith("__STOOP_COMPONENT_"))return J.replace("__STOOP_COMPONENT_","");return""}function x(J,$="",Z=0,X){if(!J||typeof J!=="object")return"";if(Z>GJ)return"";let q="",Y="";for(let G in J){let W=J[G];if(O4(G,W)){let F=E4(G,W);if(!F)continue;let B=P(F);if(!B)continue;let D=`.${B}`,H=wJ(W)?x(W,D,Z+1,X):"";Y+=H;continue}if(wJ(W))if(X&&G in X){let F=DJ(X[G]);if(F){let B=x(W,$,Z+1,X);Y+=`${F} { ${B} }`}}else if(G.startsWith("@")){let F=P(G);if(F){let B=x(W,$,Z+1,X);Y+=`${F} { ${B} }`}}else if(G.includes("&")){let F=P(G);if(F){let B=F.replace(/&/g,$),D=x(W,B,Z+1,X);Y+=D}}else if(G.startsWith(":")){let F=P(G);if(F){let B=`${$}${F}`,D=x(W,B,Z+1,X);Y+=D}}else if(G.includes(" ")||G.includes(">")||G.includes("+")||G.includes("~")){let F=P(G);if(F){let B=`${$} ${F}`,D=x(W,B,Z+1,X);Y+=D}}else{let F=P(G);if(F){let B=$?`${$} ${F}`:F,D=x(W,B,Z+1,X);Y+=D}}else if(W!==void 0){let F=c(G);if(F&&(typeof W==="string"||typeof W==="number")){let B=h(W);q+=`${F}: ${B}; `}}}return(q?`${$} { ${q.trim()}}`:"")+Y}function y(J,$,Z="",X,q,Y){let Q=M(Z),G=$J(J,q),W=S(G,$,Y),F=x(W,"",0,X),B=FJ(F),D=`${Q}:${B}`,H=p.get(D);if(H){let R=e.get(D);if(R)return T(R,Q,D),H;let A=x(W,`.${H}`,0,X);return e.set(D,A),T(A,Q,D),H}let L=Q?`${Q}-${B}`:`css-${B}`,O=x(W,`.${L}`,0,X);return p.set(D,L),e.set(D,O),TJ(),T(O,Q,D),L}function tJ(J,$="",Z,X,q){return function Y(Q){return y(Q,J,$,Z,X,q)}}function eJ(J,$="",Z,X,q){let Y=new Set;return function Q(G){if(typeof document==="undefined")return()=>{};let W=WJ(G);if(Y.has(W))return()=>{};Y.add(W);function F(O,R=0){if(R>GJ)return"";let A="";return Object.entries(O).forEach(([z,_])=>{if(C(_))if(Z&&z in Z){let K=DJ(Z[z]);if(K){let w=F(_,R+1);A+=`${K} { ${w} }`}}else if(z.startsWith("@")){let K=P(z);if(K){let w=F(_,R+1);A+=`${K} { ${w} }`}}else{let K=P(z);if(K){let w=F(_,R+1);A+=`${K} { ${w} }`}}else if(_!==void 0){let K=c(z);if(K&&(typeof _==="string"||typeof _==="number")){let w=h(_);A+=`${K}: ${w}; `}}}),A}let B=M($),D=$J(G,X),H=S(D,J,q),L=F(H);return T(L,B,`__global_${W}`),()=>{Y.delete(W)}}}function M4(J,$,Z,X){let q=`@keyframes ${$} {`,Y=Object.keys(J).sort((Q,G)=>{let W=parseFloat(Q.replace("%","")),F=parseFloat(G.replace("%",""));if(Q==="from")return-1;if(G==="from")return 1;if(Q==="to")return 1;if(G==="to")return-1;return W-F});for(let Q of Y){if(!SJ(Q))continue;let G=J[Q];if(!G||typeof G!=="object")continue;q+=` ${Q} {`;let W=S(G,Z,X);for(let F in W){let B=W[F];if(B!==void 0&&(typeof B==="string"||typeof B==="number")){let D=c(F);if(D){let H=h(B);q+=` ${D}: ${H};`}}}q+=" }"}return q+=" }",q}function J4(J="",$,Z){let X=M(J),q=new Map;return function Y(Q){let G=WJ(Q),W=q.get(G);if(W)return W;let F=G.slice(0,8),B=X?`${X}-${F}`:`stoop-${F}`,D=M4(Q,B,$,Z),H=`__keyframes_${B}`;return T(D,X,H),q.set(G,B),B}}import{createContext as V4,useCallback as EJ,useLayoutEffect as q4,useMemo as MJ,useState as P4}from"react";var $4=new Map;function Z4(J,$=""){let Z=$||"";$4.set(Z,J)}function z4(J=""){let $=J||"";return $4.get($)||null}function j4(J,$=""){let Z=z4($);if(!Z)return J;if(uJ(J,Z))return J;let X={...Z},q=Object.keys(J);for(let Y of q){if(Y==="media")continue;let Q=J[Y],G=Z[Y];if(Q&&typeof Q==="object"&&!Array.isArray(Q)&&G&&typeof G==="object"&&!Array.isArray(G))X[Y]={...G,...Q};else if(Q!==void 0)X[Y]=Q}return X}function LJ(J,$=""){if(typeof document==="undefined")return;let Z=j4(J,$),X=n(Z,$);rJ(X,Z,$)}import{jsxDEV as Y4}from"react/jsx-dev-runtime";function X4(J,$,Z,X=""){let q=V4(null),Y=Object.keys($),Q=Y[0]||"default";function G({attribute:W="data-theme",children:F,defaultTheme:B,storageKey:D="stoop-theme"}){let H=EJ(()=>{if(typeof window==="undefined")return B||Q;try{let w=localStorage.getItem(D);if(w&&$[w])return w}catch{}return B||Q},[B,D]),[L,O]=P4(H),R=MJ(()=>{return $[L]||$[B||Q]||Z},[L,B]);q4(()=>{if(R)LJ(R,X)},[R]),q4(()=>{if(typeof document!=="undefined"&&W)document.documentElement.setAttribute(W,L)},[L,W]);let A=EJ((w)=>{if($[w]){O(w);try{localStorage.setItem(D,w)}catch{}}else if(typeof process!=="undefined"&&process.env?.NODE_ENV!=="production")console.warn(`[Stoop] Theme "${w}" not found. Available themes: ${Y.join(", ")}`)},[D]),z=MJ(()=>({theme:R,themeName:L}),[R,L]),_=EJ(()=>{let V=(Y.indexOf(L)+1)%Y.length,k=Y[V];A(k)},[L,A]),K=MJ(()=>({availableThemes:Y,setTheme:A,theme:R,themeName:L,toggleTheme:_}),[R,L,A,_]);return Y4(J.Provider,{value:z,children:Y4(q.Provider,{value:K,children:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)}return{Provider:G,ThemeManagementContext:q}}import{useMemo as zJ,forwardRef as N4,createElement as x4,useContext as g4}from"react";function G4(J,$,Z){let X=!1,q=[];for(let Y in J){let Q=$[Y];if(Q===void 0)continue;let G=J[Y],W=Q===!0?"true":Q===!1?"false":String(Q);if(G[W])q.push(G[W]),X=!0}return X?Object.assign({},Z,...q):Z}function b4(J){return{__isStoopStyled:!0,__stoopClassName:J,[t]:J,toString:()=>`__STOOP_COMPONENT_${J}`}}function v4(J){return typeof J==="object"&&J!==null&&"__isStoopStyled"in J&&J.__isStoopStyled===!0}function T4(J,$){if(!$)return{elementProps:J,variantProps:{}};let Z=new Set(Object.keys($)),X={},q={};for(let Y in J)if(Z.has(Y))X[Y]=J[Y];else q[Y]=J[Y];return{elementProps:q,variantProps:X}}function Q4(J,$="",Z,X,q,Y){return function Q(G,W,F){let B=W||YJ,D=F;if(W&&"variants"in W&&typeof W.variants==="object"){D=W.variants;let{compoundVariants:A,variants:z,..._}=W;B=_}let H=y(B,J,$,Z,X,q),L;if(typeof G!=="string"&&v4(G))L=G.__stoopClassName;let R=N4(function A(z,_){let{as:K,className:w,css:V,...k}=z,I=K||G,E=V&&typeof V==="object"&&V!==null?V:YJ,{elementProps:b,variantProps:v}=T4(k,D),i=g4(Y||NJ)?.theme||J,qJ=i.media||Z,r=zJ(()=>{if(!D)return"";let j=Object.entries(v);if(j.length===0)return"";return j.sort(([u],[s])=>u.localeCompare(s)).map(([u,s])=>`${u}:${String(s)}`).join("|")},[D,...Object.values(v)]),jJ=zJ(()=>{let j=B;if(D&&r)j=G4(D,v,B);if(E!==YJ)j=Object.assign({},j,E);return j},[r,E]),F4=zJ(()=>{let j=[];if(L)j.push(L);let u=y(jJ,i,$,qJ,X,q);if(u)j.push(u);if(w){let s=typeof w==="string"?w:String(w),VJ=fJ(s);if(VJ)j.push(VJ)}return j.length>0?j.join(" "):void 0},[jJ,i,$,qJ,X,q,w,L]);return x4(I,{...b,className:F4,ref:_})});return R.selector=b4(H),R}}import{useContext as k4}from"react";function B4(J){return function $(){let Z=k4(J);if(!Z)throw new Error("useTheme must be used within a Provider");return Z}}function f4(J){let{media:$,prefix:Z="",theme:X,themeMap:q,utils:Y}=J,Q=M(Z),G=BJ(X),W=G.media||$,F={...a,...q},B=C4(null);Z4(G,Q),sJ(G,Q);let D=tJ(G,Q,W,Y,F),H=xJ(G),L=eJ(G,Q,W,Y,F),O=J4(Q,G,F),R=Q4(G,Q,W,Y,F,B),A=Object.freeze({...G});function z(I){for(let E of I)try{y(E,G,Q,W,Y,F)}catch{}}function _(I){let E;if(typeof I==="string")if(J.themes&&J.themes[I])E=J.themes[I];else{if(typeof process!=="undefined"&&process.env?.NODE_ENV!=="production")console.warn(`[Stoop] Theme "${I}" not found. Available themes: ${J.themes?Object.keys(J.themes).join(", "):"none"}`);return}else E=I;LJ(E,Q)}function K(I){let E=G;if(I)if(typeof I==="string"){if(J.themes&&J.themes[I])E=J.themes[I];else if(typeof process!=="undefined"&&process.env?.NODE_ENV!=="production")console.warn(`[Stoop] Theme "${I}" not found. Using default theme. Available: ${J.themes?Object.keys(J.themes).join(", "):"none"}`)}else E=I;let b="",v=n(E,Q);if(v)b+=v+`
|
|
12
|
+
`;let ZJ=aJ(),i=Q?`:root[data-stoop="${Q}"]`:":root",qJ=new RegExp(`${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\{[^}]*\\}`,"g"),r=ZJ.replace(qJ,"").trim();if(r)b+=(b?`
|
|
13
|
+
`:"")+r;return b}let w,V;if(J.themes){let I={};for(let[v,ZJ]of Object.entries(J.themes))I[v]=H(ZJ);let{Provider:E,ThemeManagementContext:b}=X4(B,I,G,Q);w=E,V=B4(b)}let k={config:{...J,prefix:Q},createTheme:H,css:D,getCssText:K,globalCss:L,keyframes:O,preloadTheme:_,styled:R,theme:A,warmCache:z};if(w)k.Provider=w;if(V)k.useTheme=V;return k}export{f4 as createStoop};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-specific CSS injection.
|
|
3
|
+
* Manages a single stylesheet element that gets updated with new CSS rules.
|
|
4
|
+
* Handles theme variable injection, deduplication, and stylesheet lifecycle.
|
|
5
|
+
*/
|
|
6
|
+
import type { Theme } from "../types";
|
|
7
|
+
/**
|
|
8
|
+
* Gets or creates the stylesheet element for CSS injection.
|
|
9
|
+
*
|
|
10
|
+
* @param prefix - Optional prefix for stylesheet identification
|
|
11
|
+
* @returns HTMLStyleElement
|
|
12
|
+
* @throws Error if called in SSR context
|
|
13
|
+
*/
|
|
14
|
+
export declare function getStylesheet(prefix?: string): HTMLStyleElement;
|
|
15
|
+
/**
|
|
16
|
+
* Injects theme CSS variables into the stylesheet.
|
|
17
|
+
* Automatically ensures stylesheet exists before injection.
|
|
18
|
+
*
|
|
19
|
+
* @param cssVars - CSS variables string
|
|
20
|
+
* @param theme - Theme object
|
|
21
|
+
* @param prefix - Optional prefix for CSS variables
|
|
22
|
+
*/
|
|
23
|
+
export declare function injectThemeVariables(cssVars: string, theme: Theme, prefix?: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Registers a theme for injection (browser-specific).
|
|
26
|
+
* Automatically ensures stylesheet exists and injects theme variables.
|
|
27
|
+
* Note: This is typically called with the default theme from createStoop.
|
|
28
|
+
* Additional themes should use updateThemeVariables which handles merging.
|
|
29
|
+
*
|
|
30
|
+
* @param theme - Theme object to register
|
|
31
|
+
* @param prefix - Optional prefix for CSS variables
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerTheme(theme: Theme, prefix?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Updates the stylesheet with new CSS rules.
|
|
36
|
+
*
|
|
37
|
+
* @param css - CSS string to inject
|
|
38
|
+
* @param ruleKey - Unique key for deduplication
|
|
39
|
+
* @param prefix - Optional prefix for CSS rules
|
|
40
|
+
*/
|
|
41
|
+
export declare function updateStylesheet(css: string, ruleKey: string, prefix?: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Injects CSS into the browser stylesheet with deduplication.
|
|
44
|
+
*
|
|
45
|
+
* @param css - CSS string to inject
|
|
46
|
+
* @param ruleKey - Unique key for deduplication
|
|
47
|
+
* @param prefix - Optional prefix for CSS rules
|
|
48
|
+
*/
|
|
49
|
+
export declare function injectBrowserCSS(css: string, ruleKey: string, prefix?: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the current stylesheet element.
|
|
52
|
+
*
|
|
53
|
+
* @returns HTMLStyleElement or null if not created
|
|
54
|
+
*/
|
|
55
|
+
export declare function getStylesheetElement(): HTMLStyleElement | null;
|
|
56
|
+
/**
|
|
57
|
+
* Clears the stylesheet and all pending updates.
|
|
58
|
+
*/
|
|
59
|
+
export declare function clearStylesheet(): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS injection deduplication.
|
|
3
|
+
* Tracks which CSS rules have been injected to prevent duplicates.
|
|
4
|
+
* Used by both browser and SSR injection systems.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a CSS rule has already been injected.
|
|
8
|
+
*
|
|
9
|
+
* @param key - Rule key to check
|
|
10
|
+
* @returns True if rule is already injected
|
|
11
|
+
*/
|
|
12
|
+
export declare function isInjectedRule(key: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Marks a CSS rule as injected.
|
|
15
|
+
*
|
|
16
|
+
* @param key - Rule key
|
|
17
|
+
* @param css - CSS string
|
|
18
|
+
*/
|
|
19
|
+
export declare function markRuleAsInjected(key: string, css: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Gets all injected rules as a new Map.
|
|
22
|
+
*
|
|
23
|
+
* @returns Map of all injected rules
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAllInjectedRules(): Map<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Clears all injected rule tracking.
|
|
28
|
+
*/
|
|
29
|
+
export declare function clearInjectedRules(): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS injection public API.
|
|
3
|
+
* Composes browser, SSR, and deduplication modules into a unified interface.
|
|
4
|
+
* Provides single stylesheet injection with automatic SSR support.
|
|
5
|
+
*/
|
|
6
|
+
import type { Theme } from "../types";
|
|
7
|
+
export { isInjectedRule } from "./dedup";
|
|
8
|
+
/**
|
|
9
|
+
* Injects CSS into the document with automatic SSR support.
|
|
10
|
+
*
|
|
11
|
+
* @param css - CSS string to inject
|
|
12
|
+
* @param prefix - Optional prefix for CSS rules
|
|
13
|
+
* @param ruleKey - Optional unique key for deduplication
|
|
14
|
+
*/
|
|
15
|
+
export declare function injectCSS(css: string, prefix?: string, ruleKey?: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Injects theme CSS variables into the document.
|
|
18
|
+
*
|
|
19
|
+
* @param cssVars - CSS variables string
|
|
20
|
+
* @param theme - Theme object
|
|
21
|
+
* @param prefix - Optional prefix for CSS variables
|
|
22
|
+
*/
|
|
23
|
+
export declare function injectThemeVariables(cssVars: string, theme: Theme, prefix?: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Registers a theme for injection.
|
|
26
|
+
* Automatically ensures stylesheet exists and injects theme variables.
|
|
27
|
+
*
|
|
28
|
+
* @param theme - Theme object to register
|
|
29
|
+
* @param prefix - Optional prefix for CSS variables
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerTheme(theme: Theme, prefix?: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Gets all injected CSS text (browser or SSR).
|
|
34
|
+
*
|
|
35
|
+
* @returns CSS text string
|
|
36
|
+
*/
|
|
37
|
+
export declare function getCssText(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Clears all injected CSS and caches.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clearStylesheet(): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR cache management for CSS injection.
|
|
3
|
+
* Maintains a cache of CSS text for server-side rendering.
|
|
4
|
+
* Implements FIFO eviction to prevent memory leaks.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Adds CSS to the SSR cache with FIFO eviction.
|
|
8
|
+
*
|
|
9
|
+
* @param css - CSS string to cache
|
|
10
|
+
*/
|
|
11
|
+
export declare function addToSSRCache(css: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Gets all cached CSS text for SSR.
|
|
14
|
+
*
|
|
15
|
+
* @returns Joined CSS text string
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSSRCacheText(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Clears the SSR cache.
|
|
20
|
+
*/
|
|
21
|
+
export declare function clearSSRCache(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if CSS is already in the SSR cache.
|
|
24
|
+
*
|
|
25
|
+
* @param css - CSS string to check
|
|
26
|
+
* @returns True if CSS is cached
|
|
27
|
+
*/
|
|
28
|
+
export declare function isInSSRCache(css: string): boolean;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core TypeScript type definitions for Stoop.
|
|
3
|
+
* Defines CSS objects, themes, variants, styled components, and instance types.
|
|
4
|
+
*/
|
|
5
|
+
import type { ComponentType, ElementType, JSX, ReactNode } from "react";
|
|
6
|
+
import type { PolymorphicPropsWithRef } from "react-polymorphic-types";
|
|
7
|
+
import type { createTheme } from "../api/create-theme";
|
|
8
|
+
import type { createCSSFunction } from "../api/css";
|
|
9
|
+
import type { createGlobalCSSFunction } from "../api/global-css";
|
|
10
|
+
import type { createKeyframesFunction } from "../api/keyframes";
|
|
11
|
+
import type { createStyledFunction } from "../api/styled";
|
|
12
|
+
export type CSSPropertyValue = string | number;
|
|
13
|
+
export interface StyledComponentRef {
|
|
14
|
+
readonly __stoopClassName: string;
|
|
15
|
+
readonly __isStoopStyled: true;
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
18
|
+
export interface CSS {
|
|
19
|
+
[property: string]: CSSPropertyValue | CSS | Variants | unknown[] | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface Variants {
|
|
22
|
+
[variantName: string]: {
|
|
23
|
+
[variantValue: string]: CSS;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface VariantProps {
|
|
27
|
+
[variantName: string]: string | number | boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
export type HTMLElements = keyof JSX.IntrinsicElements;
|
|
30
|
+
export type StylableElement = HTMLElements | ElementType;
|
|
31
|
+
export interface StyledBaseProps {
|
|
32
|
+
css?: CSS;
|
|
33
|
+
}
|
|
34
|
+
export type UtilityFunction = (value: CSSPropertyValue | CSS | undefined) => CSS;
|
|
35
|
+
/**
|
|
36
|
+
* Theme scale type - represents valid keys from DefaultTheme.
|
|
37
|
+
* Used for type-safe theme scale references throughout the codebase.
|
|
38
|
+
*/
|
|
39
|
+
export type ThemeScale = keyof DefaultTheme;
|
|
40
|
+
/**
|
|
41
|
+
* Theme interface - strictly enforces only these 12 approved scales.
|
|
42
|
+
* Custom theme scales are NOT allowed.
|
|
43
|
+
* Media queries are also supported as part of the theme.
|
|
44
|
+
*/
|
|
45
|
+
export interface DefaultTheme {
|
|
46
|
+
colors?: Record<string, string>;
|
|
47
|
+
opacities?: Record<string, string | number>;
|
|
48
|
+
space?: Record<string, string>;
|
|
49
|
+
radii?: Record<string, string>;
|
|
50
|
+
sizes?: Record<string, string>;
|
|
51
|
+
fonts?: Record<string, string>;
|
|
52
|
+
fontWeights?: Record<string, string | number>;
|
|
53
|
+
fontSizes?: Record<string, string>;
|
|
54
|
+
letterSpacings?: Record<string, string>;
|
|
55
|
+
shadows?: Record<string, string>;
|
|
56
|
+
zIndices?: Record<string, string | number>;
|
|
57
|
+
transitions?: Record<string, string>;
|
|
58
|
+
media?: Record<string, string>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Theme type - strictly enforces DefaultTheme structure.
|
|
62
|
+
* No custom scales are allowed.
|
|
63
|
+
*/
|
|
64
|
+
export type Theme = DefaultTheme;
|
|
65
|
+
export interface StoopConfig {
|
|
66
|
+
theme: DefaultTheme;
|
|
67
|
+
themes?: Record<string, DefaultTheme>;
|
|
68
|
+
media?: Record<string, string>;
|
|
69
|
+
utils?: Record<string, UtilityFunction>;
|
|
70
|
+
prefix?: string;
|
|
71
|
+
themeMap?: Record<string, ThemeScale>;
|
|
72
|
+
}
|
|
73
|
+
export type VariantKeys<T extends Variants> = keyof T;
|
|
74
|
+
export type VariantPropsFromConfig<T extends Variants> = {
|
|
75
|
+
[K in VariantKeys<T>]?: keyof T[K] | boolean | number;
|
|
76
|
+
};
|
|
77
|
+
type StyledOwnProps<VariantsConfig extends Variants> = StyledBaseProps & (VariantsConfig extends Record<string, never> ? {} : VariantPropsFromConfig<VariantsConfig>);
|
|
78
|
+
export type StyledComponentProps<DefaultElement extends ElementType, VariantsConfig extends Variants = {}> = PolymorphicPropsWithRef<StyledOwnProps<VariantsConfig>, DefaultElement>;
|
|
79
|
+
export interface ThemeContextValue {
|
|
80
|
+
theme: Theme;
|
|
81
|
+
themeName?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ThemeManagementContextValue {
|
|
84
|
+
theme: Theme;
|
|
85
|
+
themeName: string;
|
|
86
|
+
setTheme: (themeName: string) => void;
|
|
87
|
+
toggleTheme: () => void;
|
|
88
|
+
availableThemes: readonly string[];
|
|
89
|
+
}
|
|
90
|
+
export interface GetCssTextOptions {
|
|
91
|
+
theme?: Theme;
|
|
92
|
+
includeThemeVars?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface ProviderProps {
|
|
95
|
+
children: ReactNode;
|
|
96
|
+
defaultTheme?: string;
|
|
97
|
+
storageKey?: string;
|
|
98
|
+
attribute?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface StoopInstance {
|
|
101
|
+
styled: ReturnType<typeof createStyledFunction>;
|
|
102
|
+
css: ReturnType<typeof createCSSFunction>;
|
|
103
|
+
createTheme: ReturnType<typeof createTheme>;
|
|
104
|
+
globalCss: ReturnType<typeof createGlobalCSSFunction>;
|
|
105
|
+
keyframes: ReturnType<typeof createKeyframesFunction>;
|
|
106
|
+
theme: DefaultTheme;
|
|
107
|
+
/**
|
|
108
|
+
* Gets all generated CSS text for server-side rendering.
|
|
109
|
+
* Always includes theme CSS variables.
|
|
110
|
+
*
|
|
111
|
+
* @param theme - Optional theme (name or object) to include vars for (defaults to default theme)
|
|
112
|
+
* @returns CSS text string with theme variables and component styles
|
|
113
|
+
*/
|
|
114
|
+
getCssText: (theme?: string | Theme) => string;
|
|
115
|
+
config: StoopConfig;
|
|
116
|
+
/**
|
|
117
|
+
* Pre-compiles CSS objects to warm the cache.
|
|
118
|
+
* Useful for eliminating FOUC by pre-compiling common styles.
|
|
119
|
+
*
|
|
120
|
+
* @param styles - Array of CSS objects to pre-compile
|
|
121
|
+
*/
|
|
122
|
+
warmCache: (styles: CSS[]) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Preloads a theme by injecting its CSS variables before React renders.
|
|
125
|
+
* Useful for preventing FOUC when loading a non-default theme from localStorage.
|
|
126
|
+
*
|
|
127
|
+
* @param theme - Theme to preload (theme name string or Theme object)
|
|
128
|
+
*/
|
|
129
|
+
preloadTheme: (theme: string | Theme) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Provider component for managing theme state and updates.
|
|
132
|
+
* Only available if themes were provided in createStoop config.
|
|
133
|
+
*/
|
|
134
|
+
Provider?: ComponentType<ProviderProps>;
|
|
135
|
+
/**
|
|
136
|
+
* Hook to access theme management context.
|
|
137
|
+
* Only available if themes were provided in createStoop config.
|
|
138
|
+
*/
|
|
139
|
+
useTheme?: () => ThemeManagementContextValue;
|
|
140
|
+
}
|
|
141
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declaration for react-polymorphic-types to work around package.json exports issue.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare module "react-polymorphic-types" {
|
|
6
|
+
import type { ElementType, ComponentPropsWithRef, ComponentPropsWithoutRef } from "react";
|
|
7
|
+
|
|
8
|
+
export type PolymorphicPropsWithRef<
|
|
9
|
+
OwnProps,
|
|
10
|
+
DefaultElement extends ElementType,
|
|
11
|
+
> = OwnProps & ComponentPropsWithRef<DefaultElement>;
|
|
12
|
+
|
|
13
|
+
export type PolymorphicPropsWithoutRef<
|
|
14
|
+
OwnProps,
|
|
15
|
+
DefaultElement extends ElementType,
|
|
16
|
+
> = OwnProps & ComponentPropsWithoutRef<DefaultElement>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String utility functions.
|
|
3
|
+
* Provides hashing for class name generation, camelCase to kebab-case conversion,
|
|
4
|
+
* and CSS sanitization utilities for security.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generates a hash string from an input string.
|
|
8
|
+
*
|
|
9
|
+
* @param str - String to hash
|
|
10
|
+
* @returns Hashed string
|
|
11
|
+
*/
|
|
12
|
+
export declare function hash(str: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a hash string from an object by stringifying it.
|
|
15
|
+
*
|
|
16
|
+
* @param obj - Object to hash
|
|
17
|
+
* @returns Hashed string
|
|
18
|
+
*/
|
|
19
|
+
export declare function hashObject(obj: unknown): string;
|
|
20
|
+
/**
|
|
21
|
+
* Converts a camelCase string to kebab-case.
|
|
22
|
+
*
|
|
23
|
+
* @param str - String to convert
|
|
24
|
+
* @returns Kebab-case string
|
|
25
|
+
*/
|
|
26
|
+
export declare function toKebabCase(str: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Escapes CSS property values to prevent injection attacks.
|
|
29
|
+
* Escapes quotes, semicolons, and other special characters.
|
|
30
|
+
*
|
|
31
|
+
* @param value - Value to escape
|
|
32
|
+
* @returns Escaped value string
|
|
33
|
+
*/
|
|
34
|
+
export declare function escapeCSSValue(value: string | number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Validates and sanitizes CSS selectors to prevent injection attacks.
|
|
37
|
+
* Only allows safe selector characters. Returns empty string for invalid selectors.
|
|
38
|
+
*
|
|
39
|
+
* @param selector - Selector to sanitize
|
|
40
|
+
* @returns Sanitized selector string or empty string if invalid
|
|
41
|
+
*/
|
|
42
|
+
export declare function sanitizeCSSSelector(selector: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Validates and sanitizes CSS variable names to prevent injection attacks.
|
|
45
|
+
* CSS custom properties must start with -- and contain only valid characters.
|
|
46
|
+
*
|
|
47
|
+
* @param name - Variable name to sanitize
|
|
48
|
+
* @returns Sanitized variable name
|
|
49
|
+
*/
|
|
50
|
+
export declare function sanitizeCSSVariableName(name: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Escapes CSS variable values to prevent injection attacks.
|
|
53
|
+
*
|
|
54
|
+
* @param value - Value to escape
|
|
55
|
+
* @returns Escaped value string
|
|
56
|
+
*/
|
|
57
|
+
export declare function escapeCSSVariableValue(value: string | number): string;
|
|
58
|
+
/**
|
|
59
|
+
* Sanitizes prefix for use in CSS selectors and class names.
|
|
60
|
+
* Only allows alphanumeric characters, hyphens, and underscores.
|
|
61
|
+
*
|
|
62
|
+
* @param prefix - Prefix to sanitize
|
|
63
|
+
* @returns Sanitized prefix string
|
|
64
|
+
*/
|
|
65
|
+
export declare function sanitizePrefix(prefix: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Escapes prefix for use in CSS attribute selectors.
|
|
68
|
+
*
|
|
69
|
+
* @param prefix - Prefix to escape
|
|
70
|
+
* @returns Escaped prefix string
|
|
71
|
+
*/
|
|
72
|
+
export declare function escapePrefixForSelector(prefix: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Sanitizes media query strings to prevent injection attacks.
|
|
75
|
+
* Only allows safe characters for media queries.
|
|
76
|
+
*
|
|
77
|
+
* @param mediaQuery - Media query string to sanitize
|
|
78
|
+
* @returns Sanitized media query string or empty string if invalid
|
|
79
|
+
*/
|
|
80
|
+
export declare function sanitizeMediaQuery(mediaQuery: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Sanitizes CSS class names to prevent injection attacks.
|
|
83
|
+
* Only allows valid CSS class name characters.
|
|
84
|
+
*
|
|
85
|
+
* @param className - Class name(s) to sanitize
|
|
86
|
+
* @returns Sanitized class name string
|
|
87
|
+
*/
|
|
88
|
+
export declare function sanitizeClassName(className: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Sanitizes CSS property names to prevent injection attacks.
|
|
91
|
+
*
|
|
92
|
+
* @param propertyName - Property name to sanitize
|
|
93
|
+
* @returns Sanitized property name
|
|
94
|
+
*/
|
|
95
|
+
export declare function sanitizeCSSPropertyName(propertyName: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* Validates keyframe percentage keys (e.g., "0%", "50%", "from", "to").
|
|
98
|
+
*
|
|
99
|
+
* @param key - Keyframe key to validate
|
|
100
|
+
* @returns True if key is valid
|
|
101
|
+
*/
|
|
102
|
+
export declare function validateKeyframeKey(key: string): boolean;
|