From ee5881bcaae13758d1f6c137f802c739226752b5 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Tue, 14 May 2024 20:34:18 -0400 Subject: [PATCH] more preact tweaks --- bundled/preact/compat.js | 19 +- bundled/preact/hooks.js | 6 + bundled/preact/jsx-runtime.js | 7 - bundled/preact/preact.js | 3 + bundled/preact/signals.js | 7 + bundled/preact/to-string.js | 7 + bundled/test.tsx | 12 +- bundled/twind/core.d.ts | 1114 --------------------------------- bundled/twind/core.js | 2 +- deno.jsonc | 50 +- hmr-react.tsx | 2 +- run-serve.tsx | 3 +- 12 files changed, 74 insertions(+), 1158 deletions(-) create mode 100644 bundled/preact/hooks.js delete mode 100644 bundled/preact/jsx-runtime.js create mode 100644 bundled/preact/preact.js create mode 100644 bundled/preact/signals.js create mode 100644 bundled/preact/to-string.js delete mode 100644 bundled/twind/core.d.ts diff --git a/bundled/preact/compat.js b/bundled/preact/compat.js index ae87159..8122fb0 100644 --- a/bundled/preact/compat.js +++ b/bundled/preact/compat.js @@ -1,4 +1,19 @@ /// /* esm.sh - esbuild bundle(preact@10.20.2/compat) es2022 production */ -var V,f,Se,st,R,Ce,xe,ee,oe,te,_e,Ne,L={},Pe=[],ct=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q=Array.isArray;function P(e,t){for(var _ in t)e[_]=t[_];return e}function we(e){var t=e.parentNode;t&&t.removeChild(e)}function S(e,t,_){var n,r,o,i={};for(o in t)o=="key"?n=t[o]:o=="ref"?r=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?V.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return A(e,i,n,r,null)}function A(e,t,_,n,r){var o={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++Se,__i:-1,__u:0};return r==null&&f.vnode!=null&&f.vnode(o),o}function ue(){return{current:null}}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function U(e,t){if(t==null)return e.__?U(e.__,e.__i+1):null;for(var _;tt&&R.sort(ee));j.__r=0}function Re(e,t,_,n,r,o,i,a,s,l,p){var u,d,c,y,E,g=n&&n.__k||Pe,v=t.length;for(_.__d=s,ft(_,t,g),s=_.__d,u=0;u0?A(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=e,r.__b=e.__b+1,a=pt(r,_,i,p),r.__i=a,o=null,a!==-1&&(p--,(o=_[a])&&(o.__u|=131072)),o==null||o.__v===null?(a==-1&&u--,typeof r.type!="function"&&(r.__u|=65536)):a!==i&&(a===i+1?u++:a>i?p>s-i?u+=a-i:u--:a(s!=null&&!(131072&s.__u)?1:0))for(;i>=0||a=0){if((s=t[i])&&!(131072&s.__u)&&r==s.key&&o===s.type)return i;i--}if(a2&&(a.children=arguments.length>3?V.call(arguments,2):_),A(e.type,a,n||e.key,r||e.ref,null)}function se(e,t){var _={__c:t="__cC"+Ne++,__:e,Consumer:function(n,r){return n.children(r)},Provider:function(n){var r,o;return this.getChildContext||(r=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(i){this.props.value!==i.value&&r.some(function(a){a.__e=!0,ne(a)})},this.sub=function(i){r.push(i);var a=i.componentWillUnmount;i.componentWillUnmount=function(){r.splice(r.indexOf(i),1),a&&a.call(i)}}),n.children}};return _.Provider.__=_.Consumer.contextType=_}V=Pe.slice,f={__e:function(e,t,_,n){for(var r,o,i;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),i=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,n||{}),i=r.__d),i)return r.__E=r}catch(a){e=a}throw e}},Se=0,st=function(e){return e!=null&&e.constructor==null},k.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=P({},this.state),typeof e=="function"&&(e=e(P({},_),this.props)),e&&P(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ne(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ne(this))},k.prototype.render=x,R=[],xe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ee=function(e,t){return e.__v.__b-t.__v.__b},j.__r=0,oe=0,te=Ee(!1),_e=Ee(!0),Ne=0;var w,h,ce,Oe,O=0,$e=[],G=[],m=f,Fe=m.__b,Ae=m.__r,Le=m.diffed,Ve=m.__c,Me=m.unmount,Ie=m.__;function D(e,t){m.__h&&m.__h(h,e,O||t),O=0;var _=h.__H||(h.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:G}),_.__[e]}function Z(e){return O=1,pe(Ze,e)}function pe(e,t,_){var n=D(w++,2);if(n.t=e,!n.__c&&(n.__=[_?_(t):Ze(void 0,t),function(a){var s=n.__N?n.__N[0]:n.__[0],l=n.t(s,a);s!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=h,!h.u)){var r=function(a,s,l){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(d){return!!d.__c});if(p.every(function(d){return!d.__N}))return!o||o.call(this,a,s,l);var u=!1;return p.forEach(function(d){if(d.__N){var c=d.__[0];d.__=d.__N,d.__N=void 0,c!==d.__[0]&&(u=!0)}}),!(!u&&n.__c.props===a)&&(!o||o.call(this,a,s,l))};h.u=!0;var o=h.shouldComponentUpdate,i=h.componentWillUpdate;h.componentWillUpdate=function(a,s,l){if(this.__e){var p=o;o=void 0,r(a,s,l),o=p}i&&i.call(this,a,s,l)},h.shouldComponentUpdate=r}return n.__N||n.__}function de(e,t){var _=D(w++,3);!m.__s&&he(_.__H,t)&&(_.__=e,_.i=t,h.__H.__h.push(_))}function M(e,t){var _=D(w++,4);!m.__s&&he(_.__H,t)&&(_.__=e,_.i=t,h.__h.push(_))}function Be(e){return O=5,J(function(){return{current:e}},[])}function ze(e,t,_){O=6,M(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},_==null?_:_.concat(e))}function J(e,t){var _=D(w++,7);return he(_.__H,t)?(_.__V=e(),_.i=t,_.__h=e,_.__V):_.__}function je(e,t){return O=8,J(function(){return e},t)}function qe(e){var t=h.context[e.__c],_=D(w++,9);return _.c=e,t?(_.__==null&&(_.__=!0,t.sub(h)),t.props.value):e.__}function Ge(e,t){m.useDebugValue&&m.useDebugValue(t?t(e):e)}function t_(e){var t=D(w++,10),_=Z();return t.__=e,h.componentDidCatch||(h.componentDidCatch=function(n,r){t.__&&t.__(n,r),_[1](n)}),[_[0],function(){_[1](void 0)}]}function Ye(){var e=D(w++,11);if(!e.__){for(var t=h.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var _=t.__m||(t.__m=[0,0]);e.__="P"+_[0]+"-"+_[1]++}return e.__}function vt(){for(var e;e=$e.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Y),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],m.__e(t,e.__v)}}m.__b=function(e){h=null,Fe&&Fe(e)},m.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ie&&Ie(e,t)},m.__r=function(e){Ae&&Ae(e),w=0;var t=(h=e.__c).__H;t&&(ce===h?(t.__h=[],h.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.__V=G,_.__N=_.i=void 0})):(t.__h.forEach(Y),t.__h.forEach(fe),t.__h=[],w=0)),ce=h},m.diffed=function(e){Le&&Le(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($e.push(t)!==1&&Oe===m.requestAnimationFrame||((Oe=m.requestAnimationFrame)||mt)(vt)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==G&&(_.__=_.__V),_.i=void 0,_.__V=G})),ce=h=null},m.__c=function(e,t){t.some(function(_){try{_.__h.forEach(Y),_.__h=_.__h.filter(function(n){return!n.__||fe(n)})}catch(n){t.some(function(r){r.__h&&(r.__h=[])}),t=[],m.__e(n,_.__v)}}),Ve&&Ve(e,t)},m.unmount=function(e){Me&&Me(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{Y(n)}catch(r){t=r}}),_.__H=void 0,t&&m.__e(t,_.__v))};var We=typeof requestAnimationFrame=="function";function mt(e){var t,_=function(){clearTimeout(n),We&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,100);We&&(t=requestAnimationFrame(_))}function Y(e){var t=h,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),h=t}function fe(e){var t=h;e.__c=e.__(),h=t}function he(e,t){return!e||e.length!==t.length||t.some(function(_,n){return _!==e[n]})}function Ze(e,t){return typeof t=="function"?t(e):t}function rt(e,t){for(var _ in t)e[_]=t[_];return e}function me(e,t){for(var _ in e)if(_!=="__source"&&!(_ in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function ye(e,t){this.props=e,this.context=t}function yt(e,t){function _(r){var o=this.props.ref,i=o==r.ref;return!i&&o&&(o.call?o(null):o.current=null),t?!t(this.props,r)||!i:me(this.props,r)}function n(r){return this.shouldComponentUpdate=_,S(e,r)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}(ye.prototype=new k).isPureReactComponent=!0,ye.prototype.shouldComponentUpdate=function(e,t){return me(this.props,e)||me(this.state,t)};var Je=f.__b;f.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Je&&Je(e)};var gt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function bt(e){function t(_){var n=rt({},_);return delete n.ref,e(n,_.ref||null)}return t.$$typeof=gt,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Ke=function(e,t){return e==null?null:N(N(e).map(t))},Ct={map:Ke,forEach:Ke,count:function(e){return e?N(e).length:0},only:function(e){var t=N(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:N},kt=f.__e;f.__e=function(e,t,_,n){if(e.then){for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return t.__e==null&&(t.__e=_.__e,t.__k=_.__k),r.__c(e,t)}kt(e,t,_,n)};var Qe=f.unmount;function ot(e,t,_){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=rt({},e)).__c!=null&&(e.__c.__P===_&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return ot(n,t,_)})),e}function ut(e,t,_){return e&&_&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return ut(n,t,_)}),e.__c&&e.__c.__P===t&&(e.__e&&_.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=_)),e}function K(){this.__u=0,this.t=null,this.__b=null}function it(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Et(e){var t,_,n;function r(o){if(t||(t=e()).then(function(i){_=i.default||i},function(i){n=i}),n)throw n;if(!_)throw t;return S(_,o)}return r.displayName="Lazy",r.__f=!0,r}function I(){this.u=null,this.o=null}f.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Qe&&Qe(e)},(K.prototype=new k).__c=function(e,t){var _=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(_);var r=it(n.__v),o=!1,i=function(){o||(o=!0,_.__R=null,r?r(a):a())};_.__R=i;var a=function(){if(!--n.__u){if(n.state.__a){var s=n.state.__a;n.__v.__k[0]=ut(s,s.__c.__P,s.__c.__O)}var l;for(n.setState({__a:n.__b=null});l=n.t.pop();)l.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(i,i)},K.prototype.componentWillUnmount=function(){this.t=[]},K.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var _=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=ot(this.__b,_,n.__O=n.__P)}this.__b=null}var r=t.__a&&S(x,null,e.fallback);return r&&(r.__u&=-33),[S(x,null,t.__a?null:e.children),r]};var Xe=function(e,t,_){if(++_[1]===_[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(_=e.u;_;){for(;_.length>3;)_.pop()();if(_[1]<_[0])break;e.u=_=_[2]}};function St(e){return this.getChildContext=function(){return e.context},e.children}function xt(e){var t=this,_=e.i;t.componentWillUnmount=function(){T(null,t.l),t.l=null,t.i=null},t.i&&t.i!==_&&t.componentWillUnmount(),t.l||(t.i=_,t.l={nodeType:1,parentNode:_,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n)},insertBefore:function(n,r){this.childNodes.push(n),t.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n)}}),T(S(St,{context:t.context},e.__v),t.l)}function Nt(e,t){var _=S(xt,{__v:e,i:t});return _.containerInfo=t,_}(I.prototype=new k).__a=function(e){var t=this,_=it(t.__v),n=t.o.get(e);return n[0]++,function(r){var o=function(){t.props.revealOrder?(n.push(r),Xe(t,e,n)):r()};_?_(o):o()}},I.prototype.render=function(e){this.u=null,this.o=new Map;var t=N(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var _=t.length;_--;)this.o.set(t[_],this.u=[1,0,this.u]);return e.children},I.prototype.componentDidUpdate=I.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,_){Xe(e,_,t)})};var at=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Pt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,wt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ht=/[A-Z0-9]/g,Rt=typeof document<"u",Ut=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Dt(e,t,_){return t.__k==null&&(t.textContent=""),T(e,t),typeof _=="function"&&_(),e?e.__c:null}function Tt(e,t,_){return le(e,t),typeof _=="function"&&_(),e?e.__c:null}k.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(k.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var et=f.event;function Ot(){}function Ft(){return this.cancelBubble}function At(){return this.defaultPrevented}f.event=function(e){return et&&(e=et(e)),e.persist=Ot,e.isPropagationStopped=Ft,e.isDefaultPrevented=At,e.nativeEvent=e};var ge,Lt={enumerable:!1,configurable:!0,get:function(){return this.class}},tt=f.vnode;f.vnode=function(e){typeof e.type=="string"&&function(t){var _=t.props,n=t.type,r={};for(var o in _){var i=_[o];if(!(o==="value"&&"defaultValue"in _&&i==null||Rt&&o==="children"&&n==="noscript"||o==="class"||o==="className")){var a=o.toLowerCase();o==="defaultValue"&&"value"in _&&_.value==null?o="value":o==="download"&&i===!0?i="":a==="translate"&&i==="no"?i=!1:a==="ondoubleclick"?o="ondblclick":a!=="onchange"||n!=="input"&&n!=="textarea"||Ut(_.type)?a==="onfocus"?o="onfocusin":a==="onblur"?o="onfocusout":wt.test(o)?o=a:n.indexOf("-")===-1&&Pt.test(o)?o=o.replace(Ht,"-$&").toLowerCase():i===null&&(i=void 0):a=o="oninput",a==="oninput"&&r[o=a]&&(o="oninputCapture"),r[o]=i}}n=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=N(_.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),n=="select"&&r.defaultValue!=null&&(r.value=N(_.children).forEach(function(s){s.props.selected=r.multiple?r.defaultValue.indexOf(s.props.value)!=-1:r.defaultValue==s.props.value})),_.class&&!_.className?(r.class=_.class,Object.defineProperty(r,"className",Lt)):(_.className&&!_.class||_.class&&_.className)&&(r.class=r.className=_.className),t.props=r}(e),e.$$typeof=at,tt&&tt(e)};var _t=f.__r;f.__r=function(e){_t&&_t(e),ge=e.__c};var nt=f.diffed;f.diffed=function(e){nt&&nt(e);var t=e.props,_=e.__e;_!=null&&e.type==="textarea"&&"value"in t&&t.value!==_.value&&(_.value=t.value==null?"":t.value),ge=null};var Vt={ReactCurrentDispatcher:{current:{readContext:function(e){return ge.__n[e.__c].props.value}}}},o_="17.0.2";function Mt(e){return S.bind(null,e)}function Q(e){return!!e&&e.$$typeof===at}function It(e){return Q(e)&&e.type===x}function Wt(e){return!!e&&!!e.displayName&&(typeof e.displayName=="string"||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function $t(e){return Q(e)?Te.apply(null,arguments):e}function Bt(e){return!!e.__k&&(T(null,e),!0)}function zt(e){return e&&(e.base||e.nodeType===1&&e)||null}var jt=function(e,t){return e(t)},qt=function(e,t){return e(t)},Gt=x;function lt(e){e()}function Yt(e){return e}function Zt(){return[!1,lt]}var Jt=M,Kt=Q;function Qt(e,t){var _=t(),n=Z({h:{__:_,v:t}}),r=n[0].h,o=n[1];return M(function(){r.__=_,r.v=t,ve(r)&&o({h:r})},[e,_,t]),de(function(){return ve(r)&&o({h:r}),e(function(){ve(r)&&o({h:r})})},[e]),_}function ve(e){var t,_,n=e.v,r=e.__;try{var o=n();return!((t=r)===(_=o)&&(t!==0||1/t==1/_)||t!=t&&_!=_)}catch{return!0}}var u_={useState:Z,useId:Ye,useReducer:pe,useEffect:de,useLayoutEffect:M,useInsertionEffect:Jt,useTransition:Zt,useDeferredValue:Yt,useSyncExternalStore:Qt,startTransition:lt,useRef:Be,useImperativeHandle:ze,useMemo:J,useCallback:je,useContext:qe,useDebugValue:Ge,version:"17.0.2",Children:Ct,render:Dt,hydrate:Tt,unmountComponentAtNode:Bt,createPortal:Nt,createElement:S,createContext:se,createFactory:Mt,cloneElement:$t,createRef:ue,Fragment:x,isValidElement:Q,isElement:Kt,isFragment:It,isMemo:Wt,findDOMNode:zt,Component:k,PureComponent:ye,memo:yt,forwardRef:bt,flushSync:qt,unstable_batchedUpdates:jt,StrictMode:Gt,Suspense:K,SuspenseList:I,lazy:Et,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Vt};export{Ct as Children,k as Component,x as Fragment,ye as PureComponent,Gt as StrictMode,K as Suspense,I as SuspenseList,Vt as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$t as cloneElement,se as createContext,S as createElement,Mt as createFactory,Nt as createPortal,ue as createRef,u_ as default,zt as findDOMNode,qt as flushSync,bt as forwardRef,Tt as hydrate,Kt as isElement,It as isFragment,Wt as isMemo,Q as isValidElement,Et as lazy,yt as memo,Dt as render,lt as startTransition,Bt as unmountComponentAtNode,jt as unstable_batchedUpdates,je as useCallback,qe as useContext,Ge as useDebugValue,Yt as useDeferredValue,de as useEffect,t_ as useErrorBoundary,Ye as useId,ze as useImperativeHandle,Jt as useInsertionEffect,M as useLayoutEffect,J as useMemo,pe as useReducer,Be as useRef,Z as useState,Qt as useSyncExternalStore,Zt as useTransition,o_ as version}; -//# sourceMappingURL=compat.bundle.js.map \ No newline at end of file +import{Component as f,createElement as c,options as i,toChildArray as _,Fragment as d,render as m,hydrate as W,createContext as $,createRef as H,cloneElement as z} +from"./preact.js"; + +export {createElement as jsx, createElement as jsxs} from "./preact.js"; + +import{Component as Ve,Fragment as We,createContext as $e,createElement as He,createRef as ze} +from"./preact.js"; + +import{useState as D,useId as B,useReducer as j,useEffect as I,useLayoutEffect as E,useRef as Y,useImperativeHandle as Z,useMemo as q,useCallback as G,useContext as J,useDebugValue as K} +from"./hooks.js"; + +export*from +"./hooks.js"; + +function L(e,t){for(var n in t)e[n]=t[n];return e}function b(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function C(e,t){this.props=e,this.context=t}function Q(e,t){function n(o){var a=this.props.ref,u=a==o.ref;return!u&&a&&(a.call?a(null):a.current=null),t?!t(this.props,o)||!u:b(this.props,o)}function r(o){return this.shouldComponentUpdate=n,c(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(C.prototype=new f).isPureReactComponent=!0,C.prototype.shouldComponentUpdate=function(e,t){return b(this.props,e)||b(this.state,t)};var N=i.__b;i.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),N&&N(e)};var X=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ee(e){function t(n){var r=L({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=X,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var R=function(e,t){return e==null?null:_(_(e).map(t))},te={map:R,forEach:R,count:function(e){return e?_(e).length:0},only:function(e){var t=_(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:_},ne=i.__e;i.__e=function(e,t,n,r){if(e.then){for(var o,a=t;a=a.__;)if((o=a.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}ne(e,t,n,r)};var x=i.unmount;function T(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=L({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return T(r,t,n)})),e}function M(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return M(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function h(){this.__u=0,this.t=null,this.__b=null}function A(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function re(e){var t,n,r;function o(a){if(t||(t=e()).then(function(u){n=u.default||u},function(u){r=u}),r)throw r;if(!n)throw t;return c(n,a)}return o.displayName="Lazy",o.__f=!0,o}function p(){this.u=null,this.o=null}i.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),x&&x(e)},(h.prototype=new f).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=A(r.__v),a=!1,u=function(){a||(a=!0,n.__R=null,o?o(l):l())};n.__R=u;var l=function(){if(!--r.__u){if(r.state.__a){var s=r.state.__a;r.__v.__k[0]=M(s,s.__c.__P,s.__c.__O)}var g;for(r.setState({__a:r.__b=null});g=r.t.pop();)g.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(u,u)},h.prototype.componentWillUnmount=function(){this.t=[]},h.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=T(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&c(d,null,e.fallback);return o&&(o.__u&=-33),[c(d,null,t.__a?null:e.children),o]};var k=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.i.removeChild(r)}}),m(c(oe,{context:t.context},e.__v),t.l)}function ue(e,t){var n=c(ae,{__v:e,i:t});return n.containerInfo=t,n}(p.prototype=new f).__a=function(e){var t=this,n=A(t.__v),r=t.o.get(e);return r[0]++,function(o){var a=function(){t.props.revealOrder?(r.push(o),k(t,e,r)):o()};n?n(a):a()}},p.prototype.render=function(e){this.u=null,this.o=new Map;var t=_(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},p.prototype.componentDidUpdate=p.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){k(e,n,t)})};var F=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ie=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,le=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,se=/[A-Z0-9]/g,_e=typeof document<"u",ce=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function fe(e,t,n){return t.__k==null&&(t.textContent=""),m(e,t),typeof n=="function"&&n(),e?e.__c:null}function pe(e,t,n){return W(e,t),typeof n=="function"&&n(),e?e.__c:null}f.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(f.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var O=i.event;function de(){}function he(){return this.cancelBubble}function me(){return this.defaultPrevented}i.event=function(e){return O&&(e=O(e)),e.persist=de,e.isPropagationStopped=he,e.isDefaultPrevented=me,e.nativeEvent=e};var S,ve={enumerable:!1,configurable:!0,get:function(){return this.class}},P=i.vnode;i.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={};for(var a in n){var u=n[a];if(!(a==="value"&&"defaultValue"in n&&u==null||_e&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&u===!0?u="":l==="translate"&&u==="no"?u=!1:l==="ondoubleclick"?a="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||ce(n.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":le.test(a)?a=l:r.indexOf("-")===-1&&ie.test(a)?a=a.replace(se,"-$&").toLowerCase():u===null&&(u=void 0):l=a="oninput",l==="oninput"&&o[a=l]&&(a="oninputCapture"),o[a]=u}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=_(n.children).forEach(function(s){s.props.selected=o.value.indexOf(s.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=_(n.children).forEach(function(s){s.props.selected=o.multiple?o.defaultValue.indexOf(s.props.value)!=-1:o.defaultValue==s.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",ve)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=F,P&&P(e)};var w=i.__r;i.__r=function(e){w&&w(e),S=e.__c};var U=i.diffed;i.diffed=function(e){U&&U(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),S=null};var ye={ReactCurrentDispatcher:{current:{readContext:function(e){return S.__n[e.__c].props.value}}}},Te="17.0.2";function be(e){return c.bind(null,e)}function v(e){return!!e&&e.$$typeof===F}function Ce(e){return v(e)&&e.type===d}function Ee(e){return!!e&&!!e.displayName&&(typeof e.displayName=="string"||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function Se(e){return v(e)?z.apply(null,arguments):e}function ge(e){return!!e.__k&&(m(null,e),!0)}function Ne(e){return e&&(e.base||e.nodeType===1&&e)||null}var Re=function(e,t){return e(t)},xe=function(e,t){return e(t)},ke=d;function V(e){e()}function Oe(e){return e}function Pe(){return[!1,V]}var we=E,Ue=v;function De(e,t){var n=t(),r=D({h:{__:n,v:t}}),o=r[0].h,a=r[1];return E(function(){o.__=n,o.v=t,y(o)&&a({h:o})},[e,n,t]),I(function(){return y(o)&&a({h:o}),e(function(){y(o)&&a({h:o})})},[e]),n}function y(e){var t,n,r=e.v,o=e.__;try{var a=r();return!((t=o)===(n=a)&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}}var Me={useState:D,useId:B,useReducer:j,useEffect:I,useLayoutEffect:E,useInsertionEffect:we,useTransition:Pe,useDeferredValue:Oe,useSyncExternalStore:De,startTransition:V,useRef:Y,useImperativeHandle:Z,useMemo:q,useCallback:G,useContext:J,useDebugValue:K,version:"17.0.2",Children:te,render:fe,hydrate:pe,unmountComponentAtNode:ge,createPortal:ue,createElement:c,createContext:$,createFactory:be,cloneElement:Se,createRef:H,Fragment:d,isValidElement:v,isElement:Ue,isFragment:Ce,isMemo:Ee,findDOMNode:Ne,Component:f,PureComponent:C,memo:Q,forwardRef:ee,flushSync:xe,unstable_batchedUpdates:Re,StrictMode:ke,Suspense:h,SuspenseList:p,lazy:re,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ye}; + +export{te as Children,Ve as Component,We as Fragment,C as PureComponent,ke as StrictMode,h as Suspense,p as SuspenseList,ye as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Se as cloneElement,$e as createContext,He as createElement,be as createFactory,ue as createPortal,ze as createRef,Me as default,Ne as findDOMNode,xe as flushSync,ee as forwardRef,pe as hydrate,Ue as isElement,Ce as isFragment,Ee as isMemo,v as isValidElement,re as lazy,Q as memo,fe as render,V as startTransition,ge as unmountComponentAtNode,Re as unstable_batchedUpdates,Oe as useDeferredValue,we as useInsertionEffect,De as useSyncExternalStore,Pe as useTransition,Te as version}; \ No newline at end of file diff --git a/bundled/preact/hooks.js b/bundled/preact/hooks.js new file mode 100644 index 0000000..5c589c4 --- /dev/null +++ b/bundled/preact/hooks.js @@ -0,0 +1,6 @@ +/* esm.sh - esbuild bundle(preact@10.20.2/hooks) es2022 production */ +import{options as B}from"./preact.js"; +var c,r,H,b,v=0,x=[],p=[],o=B,g=o.__b,C=o.__r,A=o.diffed,D=o.__c,F=o.unmount,k=o.__;function l(t,_){o.__h&&o.__h(r,t,v||_),v=0;var u=r.__H||(r.__H={__:[],__h:[]});return t>=u.__.length&&u.__.push({__V:p}),u.__[t]}function I(t){return v=1,R(U,t)}function R(t,_,u){var n=l(c++,2);if(n.t=t,!n.__c&&(n.__=[u?u(_):U(void 0,_),function(a){var f=n.__N?n.__N[0]:n.__[0],s=n.t(f,a);f!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=r,!r.u)){var i=function(a,f,s){if(!n.__c.__H)return!0;var m=n.__c.__H.__.filter(function(e){return!!e.__c});if(m.every(function(e){return!e.__N}))return!h||h.call(this,a,f,s);var V=!1;return m.forEach(function(e){if(e.__N){var P=e.__[0];e.__=e.__N,e.__N=void 0,P!==e.__[0]&&(V=!0)}}),!(!V&&n.__c.props===a)&&(!h||h.call(this,a,f,s))};r.u=!0;var h=r.shouldComponentUpdate,N=r.componentWillUpdate;r.componentWillUpdate=function(a,f,s){if(this.__e){var m=h;h=void 0,i(a,f,s),h=m}N&&N.call(this,a,f,s)},r.shouldComponentUpdate=i}return n.__N||n.__}function z(t,_){var u=l(c++,3);!o.__s&&y(u.__H,_)&&(u.__=t,u.i=_,r.__H.__h.push(u))}function S(t,_){var u=l(c++,4);!o.__s&&y(u.__H,_)&&(u.__=t,u.i=_,r.__h.push(u))}function L(t){return v=5,T(function(){return{current:t}},[])}function M(t,_,u){v=6,S(function(){return typeof t=="function"?(t(_()),function(){return t(null)}):t?(t.current=_(),function(){return t.current=null}):void 0},u==null?u:u.concat(t))}function T(t,_){var u=l(c++,7);return y(u.__H,_)?(u.__V=t(),u.i=_,u.__h=t,u.__V):u.__}function G(t,_){return v=8,T(function(){return t},_)}function J(t){var _=r.context[t.__c],u=l(c++,9);return u.c=t,_?(u.__==null&&(u.__=!0,_.sub(r)),_.props.value):t.__}function K(t,_){o.useDebugValue&&o.useDebugValue(_?_(t):t)}function O(t){var _=l(c++,10),u=I();return _.__=t,r.componentDidCatch||(r.componentDidCatch=function(n,i){_.__&&_.__(n,i),u[1](n)}),[u[0],function(){u[1](void 0)}]}function Q(){var t=l(c++,11);if(!t.__){for(var _=r.__v;_!==null&&!_.__m&&_.__!==null;)_=_.__;var u=_.__m||(_.__m=[0,0]);t.__="P"+u[0]+"-"+u[1]++}return t.__}function W(){for(var t;t=x.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(d),t.__H.__h.forEach(E),t.__H.__h=[]}catch(_){t.__H.__h=[],o.__e(_,t.__v)}}o.__b=function(t){r=null,g&&g(t)},o.__=function(t,_){t&&_.__k&&_.__k.__m&&(t.__m=_.__k.__m),k&&k(t,_)},o.__r=function(t){C&&C(t),c=0;var _=(r=t.__c).__H;_&&(H===r?(_.__h=[],r.__h=[],_.__.forEach(function(u){u.__N&&(u.__=u.__N),u.__V=p,u.__N=u.i=void 0})):(_.__h.forEach(d),_.__h.forEach(E),_.__h=[],c=0)),H=r},o.diffed=function(t){A&&A(t);var _=t.__c;_&&_.__H&&(_.__H.__h.length&&(x.push(_)!==1&&b===o.requestAnimationFrame||((b=o.requestAnimationFrame)||j)(W)),_.__H.__.forEach(function(u){u.i&&(u.__H=u.i),u.__V!==p&&(u.__=u.__V),u.i=void 0,u.__V=p})),H=r=null},o.__c=function(t,_){_.some(function(u){try{u.__h.forEach(d),u.__h=u.__h.filter(function(n){return!n.__||E(n)})}catch(n){_.some(function(i){i.__h&&(i.__h=[])}),_=[],o.__e(n,u.__v)}}),D&&D(t,_)},o.unmount=function(t){F&&F(t);var _,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{d(n)}catch(i){_=i}}),u.__H=void 0,_&&o.__e(_,u.__v))};var q=typeof requestAnimationFrame=="function";function j(t){var _,u=function(){clearTimeout(n),q&&cancelAnimationFrame(_),setTimeout(t)},n=setTimeout(u,100);q&&(_=requestAnimationFrame(u))}function d(t){var _=r,u=t.__c;typeof u=="function"&&(t.__c=void 0,u()),r=_}function E(t){var _=r;t.__c=t.__(),r=_}function y(t,_){return!t||t.length!==_.length||_.some(function(u,n){return u!==t[n]})}function U(t,_){return typeof _=="function"?_(t):_} + +export{G as useCallback,J as useContext,K as useDebugValue,z as useEffect,O as useErrorBoundary,Q as useId,M as useImperativeHandle,S as useLayoutEffect,T as useMemo,R as useReducer,L as useRef,I as useState}; +//# sourceMappingURL=hooks.js.map \ No newline at end of file diff --git a/bundled/preact/jsx-runtime.js b/bundled/preact/jsx-runtime.js deleted file mode 100644 index 9ff40a7..0000000 --- a/bundled/preact/jsx-runtime.js +++ /dev/null @@ -1,7 +0,0 @@ -/* esm.sh - esbuild bundle(preact@10.20.2/jsx-runtime) es2022 production */ -import{options as c,Fragment as _}from"./compat.js"; -import{Fragment as C}from"./compat.js"; - -var v=/["&<]/;function p(t){if(t.length===0||v.test(t)===!1)return t;for(var r=0,e=0,a="",o="";e2&&(l.children=arguments.length>3?T.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(r in _.defaultProps)l[r]===void 0&&(l[r]=_.defaultProps[r]);return w(_,l,i,o,null)}function w(_,e,t,i,o){var r={type:_,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++Q,__i:-1,__u:0};return o==null&&d.vnode!=null&&d.vnode(r),r}function he(){return{current:null}}function H(_){return _.children}function M(_,e){this.props=_,this.context=e}function P(_,e){if(e==null)return _.__?P(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?P(_):null}function _e(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return _e(_)}}function R(_){(!_.__d&&(_.__d=!0)&&x.push(_)&&!W.__r++||q!==d.debounceRendering)&&((q=d.debounceRendering)||X)(W)}function W(){var _,e,t,i,o,r,l,s;for(x.sort(I);_=x.shift();)_.__d&&(e=x.length,i=void 0,r=(o=(t=_).__v).__e,l=[],s=[],t.__P&&((i=b({},o)).__v=o.__v+1,d.vnode&&d.vnode(i),V(t.__P,i,o,t.__n,t.__P.ownerSVGElement!==void 0,32&o.__u?[r]:null,l,r??P(o),!!(32&o.__u),s),i.__v=o.__v,i.__.__k[i.__i]=i,oe(l,i,s),i.__e!=r&&_e(i)),x.length>e&&x.sort(I));W.__r=0}function te(_,e,t,i,o,r,l,s,f,u,p){var n,m,c,h,k,v=i&&i.__k||Z,a=e.length;for(t.__d=f,se(t,e,v),f=t.__d,n=0;n0?w(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=_,o.__b=_.__b+1,s=ce(o,t,l,p),o.__i=s,r=null,s!==-1&&(p--,(r=t[s])&&(r.__u|=131072)),r==null||r.__v===null?(s==-1&&n--,typeof o.type!="function"&&(o.__u|=65536)):s!==l&&(s===l+1?n++:s>l?p>f-l?n+=s-l:n--:s(f!=null&&!(131072&f.__u)?1:0))for(;l>=0||s=0){if((f=e[l])&&!(131072&f.__u)&&o==f.key&&r===f.type)return l;l--}if(s2&&(s.children=arguments.length>3?T.call(arguments,2):t),w(_.type,s,i||_.key,o||_.ref,null)}function ye(_,e){var t={__c:e="__cC"+Y++,__:_,Consumer:function(i,o){return i.children(o)},Provider:function(i){var o,r;return this.getChildContext||(o=[],(r={})[e]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(l){this.props.value!==l.value&&o.some(function(s){s.__e=!0,R(s)})},this.sub=function(l){o.push(l);var s=l.componentWillUnmount;l.componentWillUnmount=function(){o.splice(o.indexOf(l),1),s&&s.call(l)}}),i.children}};return t.Provider.__=t.Consumer.contextType=t}T=Z.slice,d={__e:function(_,e,t,i){for(var o,r,l;e=e.__;)if((o=e.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(_)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(_,i||{}),l=o.__d),l)return o.__E=o}catch(s){_=s}throw _}},Q=0,re=function(_){return _!=null&&_.constructor==null},M.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=b({},this.state),typeof _=="function"&&(_=_(b({},t),this.props)),_&&b(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),R(this))},M.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),R(this))},M.prototype.render=H,x=[],X=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,I=function(_,e){return _.__v.__b-e.__v.__b},W.__r=0,G=0,$=K(!1),O=K(!0),Y=0;export{M as Component,H as Fragment,ve as cloneElement,ye as createContext,le as createElement,he as createRef,le as h,de as hydrate,re as isValidElement,d as options,ae as render,ue as toChildArray}; +//# sourceMappingURL=preact.mjs.map \ No newline at end of file diff --git a/bundled/preact/signals.js b/bundled/preact/signals.js new file mode 100644 index 0000000..5a45e5a --- /dev/null +++ b/bundled/preact/signals.js @@ -0,0 +1,7 @@ +/// +/* esm.sh - esbuild bundle(@preact/signals@1.2.3) es2022 production */ +import{Component as z,options as V,isValidElement as B}from"react"; +import{useMemo as k,useRef as G,useEffect as D}from"react"; +var M=Symbol.for("preact-signals");function b(){if(v>1)v--;else{for(var t,i=!1;p!==void 0;){var n=p;for(p=void 0,$++;n!==void 0;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&O(n))try{n.c()}catch(e){i||(t=e,i=!0)}n=r}}if($=0,v--,i)throw t}}function R(t){if(v>0)return t();v++;try{return t()}finally{b()}}var o=void 0;function T(t){var i=o;o=void 0;try{return t()}finally{o=i}}var p=void 0,v=0,$=0,S=0;function N(t){if(o!==void 0){var i=t.n;if(i===void 0||i.t!==o)return i={i:0,S:t,p:o.s,n:void 0,t:o,e:void 0,x:void 0,r:i},o.s!==void 0&&(o.s.n=i),o.s=i,t.n=i,32&o.f&&t.S(i),i;if(i.i===-1)return i.i=0,i.n!==void 0&&(i.n.p=i.p,i.p!==void 0&&(i.p.n=i.n),i.p=o.s,i.n=void 0,o.s.n=i,o.s=i),i}}function u(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}u.prototype.brand=M;u.prototype.h=function(){return!0};u.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};u.prototype.U=function(t){if(this.t!==void 0){var i=t.e,n=t.x;i!==void 0&&(i.x=n,t.e=void 0),n!==void 0&&(n.e=i,t.x=void 0),t===this.t&&(this.t=n)}};u.prototype.subscribe=function(t){var i=this;return c(function(){var n=i.value,r=o;o=void 0;try{t(n)}finally{o=r}})};u.prototype.valueOf=function(){return this.value};u.prototype.toString=function(){return this.value+""};u.prototype.toJSON=function(){return this.value};u.prototype.peek=function(){var t=o;o=void 0;try{return this.value}finally{o=t}};Object.defineProperty(u.prototype,"value",{get:function(){var t=N(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if($>100)throw new Error("Cycle detected");this.v=t,this.i++,S++,v++;try{for(var i=this.t;i!==void 0;i=i.x)i.t.N()}finally{b()}}}});function g(t){return new u(t)}function O(t){for(var i=t.s;i!==void 0;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return!0;return!1}function j(t){for(var i=t.s;i!==void 0;i=i.n){var n=i.S.n;if(n!==void 0&&(i.r=n),i.S.n=i,i.i=-1,i.n===void 0){t.s=i;break}}}function P(t){for(var i=t.s,n=void 0;i!==void 0;){var r=i.p;i.i===-1?(i.S.U(i),r!==void 0&&(r.n=i.n),i.n!==void 0&&(i.n.p=r)):n=i,i.S.n=i.r,i.r!==void 0&&(i.r=void 0),i=r}t.s=n}function h(t){u.call(this,void 0),this.x=t,this.s=void 0,this.g=S-1,this.f=4}(h.prototype=new u).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===S))return!0;if(this.g=S,this.f|=1,this.i>0&&!O(this))return this.f&=-2,!0;var t=o;try{j(this),o=this;var i=this.x();(16&this.f||this.v!==i||this.i===0)&&(this.v=i,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return o=t,P(this),this.f&=-2,!0};h.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var i=this.s;i!==void 0;i=i.n)i.S.S(i)}u.prototype.S.call(this,t)};h.prototype.U=function(t){if(this.t!==void 0&&(u.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var i=this.s;i!==void 0;i=i.n)i.S.U(i)}};h.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(h.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=N(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function w(t){return new h(t)}function A(t){var i=t.u;if(t.u=void 0,typeof i=="function"){v++;var n=o;o=void 0;try{i()}catch(r){throw t.f&=-2,t.f|=8,U(t),r}finally{o=n,b()}}}function U(t){for(var i=t.s;i!==void 0;i=i.n)i.S.U(i);t.x=void 0,t.s=void 0,A(t)}function q(t){if(o!==this)throw new Error("Out-of-order effect");P(this),o=t,this.f&=-2,8&this.f&&U(this),b()}function l(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}l.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var i=this.x();typeof i=="function"&&(this.u=i)}finally{t()}};l.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,A(this),j(this),v++;var t=o;return o=this,q.bind(this,t)};l.prototype.N=function(){2&this.f||(this.f|=2,this.o=p,p=this)};l.prototype.d=function(){this.f|=8,1&this.f||U(this)};function c(t){var i=new l(t);try{i.c()}catch(n){throw i.d(),n}return i.d.bind(i)}var x,E;function d(t,i){V[t]=i.bind(null,V[t]||function(){})}function m(t){E&&E(),E=t&&t.S()}function J(t){var i=this,n=t.data,r=H(n);r.value=n;var e=k(function(){for(var f=i.__v;f=f.__;)if(f.__c){f.__c.__$f|=4;break}return i.__$u.c=function(){var s;!B(e.peek())&&((s=i.base)==null?void 0:s.nodeType)===3?i.base.data=e.peek():(i.__$f|=1,i.setState({}))},w(function(){var s=r.value.value;return s===0?0:s===!0?"":s||""})},[]);return e.value}J.displayName="_st";Object.defineProperties(u.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:J},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});d("__b",function(t,i){if(typeof i.type=="string"){var n,r=i.props;for(var e in r)if(e!=="children"){var f=r[e];f instanceof u&&(n||(i.__np=n={}),n[e]=f,r[e]=f.peek())}}t(i)});d("__r",function(t,i){m();var n,r=i.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e){var f;return c(function(){f=this}),f.c=function(){r.__$f|=1,r.setState({})},f}())),x=r,m(n),t(i)});d("__e",function(t,i,n,r){m(),x=void 0,t(i,n,r)});d("diffed",function(t,i){m(),x=void 0;var n;if(typeof i.type=="string"&&(n=i.__e)){var r=i.__np,e=i.props;if(r){var f=n.U;if(f)for(var s in f){var a=f[s];a!==void 0&&!(s in r)&&(a.d(),f[s]=void 0)}else n.U=f={};for(var _ in r){var y=f[_],C=r[_];y===void 0?(y=F(n,_,C,e),f[_]=y):y.o(C,e)}}}t(i)});function F(t,i,n,r){var e=i in t&&t.ownerSVGElement===void 0,f=g(n);return{o:function(s,a){f.value=s,r=a},d:c(function(){var s=f.value.value;r[i]!==s&&(r[i]=s,e?t[i]=s:s?t.setAttribute(i,s):t.removeAttribute(i))})}}d("unmount",function(t,i){if(typeof i.type=="string"){var n=i.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var e in r){var f=r[e];f&&f.d()}}}}else{var s=i.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(i)});d("__h",function(t,i,n,r){(r<3||r===9)&&(i.__$f|=2),t(i,n,r)});z.prototype.shouldComponentUpdate=function(t,i){var n=this.__$u;if(!(n&&n.s!==void 0||4&this.__$f)||3&this.__$f)return!0;for(var r in i)return!0;for(var e in t)if(e!=="__source"&&t[e]!==this.props[e])return!0;for(var f in this.props)if(!(f in t))return!0;return!1};function H(t){return k(function(){return g(t)},[])}function W(t){var i=G(t);return i.current=t,x.__$f|=4,k(function(){return w(function(){return i.current()})},[])}function X(t){var i=G(t);i.current=t,D(function(){return c(function(){return i.current()})},[])} +export{u as Signal,R as batch,w as computed,c as effect,g as signal,T as untracked,W as useComputed,H as useSignal,X as useSignalEffect}; +//# sourceMappingURL=signals.bundle.mjs.map \ No newline at end of file diff --git a/bundled/preact/to-string.js b/bundled/preact/to-string.js new file mode 100644 index 0000000..a32bfc3 --- /dev/null +++ b/bundled/preact/to-string.js @@ -0,0 +1,7 @@ +/* esm.sh - esbuild bundle(preact-render-to-string@6.4.2) denonext production */ +import{options as u,h as V,Fragment as E}from"./preact.js"; + +var J=/[\s\n\\/='"\0<>]/,M=/^(xlink|xmlns|xml)([A-Z])/,oe=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,ae=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,ie=/["&<]/;function H(e){if(e.length===0||ie.test(e)===!1)return e;for(var n=0,t=0,r="",a="";t";s=h.children}else{if((S=f.contextType)!=null){var G=n[S.__c];j=G?G.props.value:S.__}if(f.prototype&&typeof f.prototype.render=="function")s=K(e,j),d=e.__c;else{e.__c=d={__v:e,props:h,context:j,setState:Y,forceUpdate:Y,__d:!0,__h:[]};for(var ee=0;d.__d&&ee++<25;)d.__d=!1,P&&P(e),s=f.call(d,h,j);d.__d=!0}if(d.getChildContext!=null&&(n=R({},n,d.getChildContext())),(f.getDerivedStateFromError||d.componentDidCatch)&&u.errorBoundaries){var z="";s=s!=null&&s.type===E&&s.key==null?s.props.children:s;try{return z=k(s,n,t,r,e,o)}catch(w){return f.getDerivedStateFromError&&(d.__s=f.getDerivedStateFromError(w)),d.componentDidCatch&&d.componentDidCatch(w,{}),d.__d&&(s=K(e,n),(d=e.__c).getChildContext!=null&&(n=R({},n,d.getChildContext())),z=k(s=s!=null&&s.type===E&&s.key==null?s.props.children:s,n,t,r,e,o)),z}finally{A&&A(e),e.__=null,C&&C(e)}}}s=s!=null&&s.type===E&&s.key==null&&s.props.tpl==null?s.props.children:s;try{var te=k(s,n,t,r,e,o);return A&&A(e),e.__=null,C&&C(e),te}catch(w){if(!o||!w||typeof w.then!="function")throw w;var ne=function re(){try{return k(s,n,t,r,e,o)}catch(Z){if(!Z||typeof Z.then!="function")throw Z;return Z.then(function(){return k(s,n,t,r,e,o)},function(){return re()})}};return w.then(function(){return ne()})}}var x,L="<"+f,b="";for(var c in h){var p=h[c];switch(c){case"children":x=p;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in h)continue;c="for";break;case"className":if("class"in h)continue;c="class";break;case"defaultChecked":c="checked";break;case"defaultSelected":c="selected";break;case"defaultValue":case"value":switch(c="value",f){case"textarea":x=p;continue;case"select":r=p;continue;case"option":r!=p||"selected"in h||(L+=" selected")}break;case"dangerouslySetInnerHTML":b=p&&p.__html;continue;case"style":typeof p=="object"&&(p=le(p));break;case"acceptCharset":c="accept-charset";break;case"httpEquiv":c="http-equiv";break;default:if(M.test(c))c=c.replace(M,"$1:$2").toLowerCase();else{if(J.test(c))continue;c[4]!=="-"&&c!=="draggable"||p==null?t?ae.test(c)&&(c=c==="panose1"?"panose-1":c.replace(/([A-Z])/g,"-$1").toLowerCase()):oe.test(c)&&(c=c.toLowerCase()):p+=""}}p!=null&&p!==!1&&typeof p!="function"&&(L=p===!0||p===""?L+" "+c:L+" "+c+'="'+H(p+"")+'"')}if(J.test(f))throw new Error(f+" is not a valid HTML tag name in "+L+">");if(b||(typeof x=="string"?b=H(x):x!=null&&x!==!1&&x!==!0&&(b=k(x,n,f==="svg"||f!=="foreignObject"&&t,r,e,o))),A&&A(e),e.__=null,C&&C(e),!b&&pe.has(f))return L+"/>";var B="",I=L+">";return Array.isArray(b)?[I].concat(b,[B]):typeof b!="string"?[I,b,B]:I+b+B}var pe=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),_e=$,ve=$,me=$; + +export{me as default,_e as render,ve as renderToStaticMarkup,$ as renderToString,de as renderToStringAsync}; +//# sourceMappingURL=preact-render-to-string.mjs.map \ No newline at end of file diff --git a/bundled/test.tsx b/bundled/test.tsx index f105a18..cf9b8bd 100644 --- a/bundled/test.tsx +++ b/bundled/test.tsx @@ -1,9 +1,5 @@ import * as TW from "./twind/core.js"; import {presetAutoprefix, presetTailwind} from "./twind/presets.js" - -import * as BUNDLE from "./preact/compat.js"; - - const Configure = { theme: {}, @@ -11,4 +7,10 @@ const Configure = hash: false } as TW.TwindUserConfig; -console.log(TW.install(Configure)); +//console.log(TW.install(Configure)); + + + +import * as LOL from "react"; + +console.log(LOL.jsx) \ No newline at end of file diff --git a/bundled/twind/core.d.ts b/bundled/twind/core.d.ts deleted file mode 100644 index ea8e99a..0000000 --- a/bundled/twind/core.d.ts +++ /dev/null @@ -1,1114 +0,0 @@ -import * as CSS$1 from 'https://esm.sh/v135/csstype@3.1.2/index.d.ts'; - -declare type Falsey = false | null | undefined | void | ''; -declare type MaybeArray = T | T[]; -declare type MaybeThunk = T | ((context: Context) => T); -declare type TypedAtRulesKeys = `@layer ${'defaults' | 'base' | 'components' | 'shortcuts' | 'utilities' | 'overrides'}` | `@media screen(${string})` | `@media ${string}` | `@keyframes ${string}`; -declare type TypedAtRules = { - [key in TypedAtRulesKeys]?: key extends `@layer ${string}` ? MaybeArray : CSSBase; -}; -interface BaseProperties extends TypedAtRules { - '@import'?: MaybeArray; - '@font-face'?: MaybeArray; -} -interface CustomProperties { - label?: string; - '@apply'?: MaybeArray | Falsey; -} -declare type CSSProperties = CSS$1.PropertiesFallback & CSS$1.PropertiesHyphenFallback & Partial; -declare type CSSFontFace = CSS$1.AtRule.FontFaceFallback & CSS$1.AtRule.FontFaceHyphenFallback; -interface CSSNested extends Record | Falsey> { -} -declare type CSSBase = BaseProperties & CSSNested; -declare type CSSObject = CSSProperties & CSSBase; -declare type CSSValue = string | number | bigint | Falsey | StringLike; -declare type StringLike = { - toString(): string; -} & string; -declare type Preflight = CSSBase | string; -interface TwindRule { - /** The calculated precedence taking all variants into account. */ - p: number; - o: number; - /** Additional classNames to propagate, does not include name */ - c?: string; - /** The rulesets (selectors and at-rules). expanded variants `@media ...`, `@supports ...`, `&:focus`, `.dark &` */ - r: string[]; - /** The name to use for `&` expansion in selectors. Maybe empty for at-rules like `@import`, `@font-face`, `@media`, ... */ - n?: string; - /** The stringified declarations. */ - d?: string; -} -declare type RestoreSnapshot = () => void; -interface Twind { - (tokens: StringLike): string; - readonly target: Target; - readonly theme: ThemeFunction>; - readonly config: TwindConfig; - snapshot(): RestoreSnapshot; - /** Clears all CSS rules from the sheet. */ - clear(): void; - destroy(): void; -} -interface Context { - /** Allows to resolve theme values. */ - theme: ThemeFunction; - /** escapes given string for use in a CSS selector or variable */ - e: (value: string) => string; - /** create hash of given string — may be no-op eg returning the same input */ - h: (value: string) => string; - /** - * returns the dark color - * - * @private - */ - d: (section: string, key: string, color: ColorValue) => ColorValue | Falsey; - /** - * resolves a variant - * - * @private - */ - v: (value: string) => MaybeArray; - /** - * resolves a rule - * - * @private - */ - r: (value: string, isDark?: boolean) => RuleResult; - /** - * stringifies a CSS property and value to a declaration - * - * @private - */ - s: (property: string, value: string) => string; - /** - * called right before the rule is stringified and inserted into the sheet - * - * @private - */ - f: (rule: TwindRule) => TwindRule; -} -declare type ThemeValue = T extends Record ? Exclude> : T; -declare type KebabCase = S extends `${infer C}${infer T}` ? KebabCase extends infer U ? U extends string ? T extends Uncapitalize ? `${Uncapitalize}${U}` : `${Uncapitalize}-${U}` : never : never : S; -interface ThemeFunction { - (): Theme; -
(section: Section | KebabCase
): Theme[Section]; -
(section: Section | KebabCase
, key: Key): ThemeValue | undefined; -
(section: Section | KebabCase
, key: string): ThemeValue | undefined; -
(section: Section | KebabCase
, key: Key, defaultValue: ThemeValue): ThemeValue; -
(section: Section | KebabCase
, key: string, defaultValue: ThemeValue): ThemeValue; -
(key: `${Section}.${string}`): ThemeValue; -
(key: `${Section}.${string}`, defaultValue: ThemeValue): ThemeValue; - (section: string): unknown | undefined; - (section: string, key: string): unknown | string | undefined; - (section: string, key: string, defaultValue: T): T | string; - (key: string, defaultValue: T): T | string; -} -declare type RuleResult = string | CSSObject | Falsey | Partial[]; -declare type RuleResolver = (match: Match, context: Context) => RuleResult; -declare type Rule = string | RegExp | [pattern: MaybeArray, alias: string & {}] | [pattern: MaybeArray, css: CSSObject] | [pattern: MaybeArray, resolve: RuleResolver] | [pattern: MaybeArray, property: keyof CSSProperties] | [ - pattern: MaybeArray, - property: keyof CSSProperties, - convert: MatchConverter -]; -declare type VariantResult = MaybeArray | Falsey; -declare type VariantResolver = (match: MatchResult, context: Context) => VariantResult; -declare type Variant = [ - condition: MaybeArray, - resolve: string | VariantResolver -]; -declare type MatchResult = RegExpExecArray & { - /** The substring following the most recent match */ - $$: string; - /** Can be used to propagate a value like a theme value */ - dark?: boolean; -}; -interface SheetRule { - /** The calculated precedence taking all variants into account. */ - p: number; - o: number; - /** The name to use for `&` expansion in selectors. Maybe empty for at-rules like `@import`, `@font-face`, `@media`, ... */ - n?: string | null; -} -interface Sheet { - readonly target: Target; - insert(cssText: string, index: number, rule: SheetRule): void; - snapshot(): RestoreSnapshot; - /** Clears all CSS rules from the sheet. */ - clear(): void; - destroy(): void; - resume(addClassName: (className: string) => void, insert: (cssText: string, rule: SheetRule) => void): void; -} -declare type StringifyDeclaration = (property: string, value: string, context: Context) => string; -declare type PreflightThunk = (context: Context) => Preflight | Falsey; -declare type HashFunction = (value: string, defaultHash: (value: string) => string) => string; -declare type DarkModeConfig = 'media' | 'class' | (string & {}) | boolean | undefined | [mode: 'class', selector: string]; -/** - * Allows to return a dark color for the given light color. - * - * ```js - * { - * // 50 -> 900, 100 -> 800, ..., 800 -> 100, 900 -> 50 - * darkColor: autoDarkColor - * // custom resolvers - * darkColor: (section, key, { theme }) => theme(`${section}.${key}-dark`) as ColorValue - * darkColor: (section, key, { theme }) => theme(`dark.${section}.${key}`) as ColorValue - * darkColor: (section, key, { theme }) => theme(`${section}.dark.${key}`) as ColorValue - * darkColor: (section, key, context, lightColor) => generateDarkColor(lightColor), - * } - * ``` - * - * Or use the light color to generate a dark color - * - * ```js - * { - * darkColor: (section, key, context, color) => generateDark(color) - * } - * ``` - * @param section the theme section - * @param key the theme key within section — maybe an arbitrary value `[...]` - * @param context the context - * @param color the current color - * @returns the dark color to use - */ -declare type DarkColor = (section: string, key: string, context: Context, color: ColorValue) => ColorValue | Falsey; -declare type Finalize = (rule: TwindRule, context: Context) => TwindRule; -interface TwindConfig { - /** Allows to change how the `dark` variant is used (default: `"media"`) */ - darkMode?: DarkModeConfig; - darkColor?: DarkColor; - theme: ThemeConfig; - preflight: false | MaybeThunk[]; - variants: Variant[]; - rules: Rule[]; - hash?: boolean | undefined | HashFunction; - stringify: StringifyDeclaration; - ignorelist: (string | RegExp)[]; - finalize: Finalize[]; -} -declare type ArrayType = T extends (infer Item)[] ? Item : T; -declare type ExtractTheme = T extends Preset ? Theme : T; -declare type ExtractUserTheme = { - [key in keyof T]: key extends 'extend' ? never : T[key] extends ThemeSectionResolver ? Value : T[key]; -} & BaseTheme; -/** @experimental */ -declare type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; -declare type ExtractThemes[]> = UnionToIntersection | BaseTheme | ArrayType>>; -interface TwindPresetConfig { - /** Allows to change how the `dark` variant is used (default: `"media"`) */ - darkMode?: DarkModeConfig; - darkColor?: DarkColor; - theme?: ThemeConfig; - preflight?: false | MaybeArray>; - variants?: Variant[]; - rules?: Rule[]; - hash?: boolean | undefined | HashFunction; - stringify?: StringifyDeclaration; - ignorelist?: MaybeArray; - finalize?: MaybeArray>; -} -interface TwindUserConfig[] = Preset[]> { - presets?: Presets; - /** Allows to change how the `dark` variant is used (default: `"media"`) */ - darkMode?: DarkModeConfig; - darkColor?: DarkColor>; - theme?: Theme | ThemeConfig>; - preflight?: false | MaybeArray>>; - variants?: Variant>[]; - rules?: Rule>[]; - /** - * Enables hashing of all classes (default: `false`). - * - * If a function is given it can be used to hash only certain classes: - * - * ```js - * { - * hash(className, defaultHash) { - * if (/^[~@]\(/.test(className)) { - * // a shortcut like `~(...)` or apply like `@(...)` - * return defaultHash(className) - * } - * return className - * } - * } - *``` - */ - hash?: boolean | undefined | HashFunction; - stringify?: StringifyDeclaration>; - ignorelist?: MaybeArray; - finalize?: MaybeArray>; -} -interface BaseTheme { - screens: Record>; - colors: Record; -} -declare type ScreenValue = string | { - raw: string; -} | { - min: string; - max?: string; -} | { - min?: string; - max: string; -}; -interface ColorFunctionOptions { - opacityVariable?: string | undefined; - opacityValue?: string | undefined; -} -declare type ColorFunction = (options: ColorFunctionOptions) => string; -interface ColorRecord extends Record { -} -declare type ColorValue = string | ColorFunction; -declare type MaybeColorValue = ColorValue | ColorRecord; -interface ThemeSectionResolverContext { - readonly colors: Theme['colors']; - readonly theme: ThemeFunction; - /** - * No-op function as negated values are automatically infered and do _not_ need to be in the theme. - */ - readonly negative: (scale: Record) => Record; - readonly breakpoints: (screens: Record>) => Record; -} -interface ThemeSectionResolver { - (context: ThemeSectionResolverContext): Value; -} -declare type ThemeSection = Value | ThemeSectionResolver; -declare type PartialTheme = { - [Section in keyof Theme]?: ThemeSection; -}; -declare type ThemeConfig = PartialTheme & { - extend?: PartialTheme; -}; -declare type MatchConverter = (match: Match, context: Context) => string; -interface PresetThunk { - (config: TwindConfig): TwindPresetConfig; -} -declare type Preset = TwindPresetConfig | PresetThunk; -interface ClassObject { - [key: string]: boolean | number | unknown; -} -declare type Class = string | number | boolean | Falsey | ClassObject | Class[]; -declare type NestedFunction = (strings: TemplateStringsArray | Class, ...interpolations: Class[]) => string; -declare type Nested = NestedFunction & { - [label: string]: NestedFunction; -}; - -/** - * @group Class Name Generators - */ -declare const apply: Nested; -/** - * @group Class Name Generators - */ -declare const shortcut: Nested; - -interface AnimationFunction { - (animation: string | CSSProperties, waypoints: StringLike): StringLike; -} -declare type Animation = AnimationFunction & { - [label: string]: AnimationFunction; -}; -/** - * @group Class Name Generators - */ -declare const animation: Animation; - -declare type AutocompleteItem = { - prefix?: string; - suffix: string; - theme?: { - section: string; - key: string; - }; - modifiers?: AutocompleteModifier[] | false | null | undefined; - color?: string | false | null | undefined; - label?: string; -}; -declare type AutocompleteModifier = { - modifier: string; - theme?: { - section: string; - key: string; - }; - color?: string | false | null | undefined; - label?: string; -}; -interface AutocompleteContext { - /** Allows to resolve theme values. */ - readonly theme: ThemeFunction; - readonly variants: Record; -} -declare type AutocompleteProvider = (match: MatchResult, context: AutocompleteContext) => (string | AutocompleteItem)[]; -/** - * @experimental - * @group Configuration - * @param resolver - * @param autocomplete - */ -declare function withAutocomplete(resolver: RuleResolver, autocomplete: AutocompleteProvider | false | null | undefined): RuleResolver; -declare function withAutocomplete(resolver: VariantResolver, autocomplete: AutocompleteProvider | false | null | undefined): VariantResolver; -declare function withAutocomplete(rule: Rule, autocomplete: AutocompleteProvider | false | null | undefined): Rule; -/** - * @internal - * @param resolver - * @returns - */ -declare function getAutocompleteProvider(resolver: RuleResolver | VariantResolver): AutocompleteProvider | undefined; - -/** - * @internal - * @param color - * @param options - * @returns - */ -declare function toColorValue(color: ColorValue, options?: ColorFunctionOptions): string; -/** - * Looks for a matching dark color within a [tailwind color palette](https://tailwindcss.com/docs/customizing-colors) (`50`, `100`, `200`, ..., `800`, `900`). - * - * ```js - * defineConfig({ - * darkColor: autoDarkColor, - * }) - * ``` - * - * **Note**: Does not work for arbitrary values like `[theme(colors.gray.500)]` or `[theme(colors.gray.500, #ccc)]`. - * - * @group Configuration - * @param section within theme to use - * @param key of the light color or an arbitrary value - * @param context to use - * @returns the dark color if found - */ -declare function autoDarkColor(section: string, key: string, { theme }: Context): ColorValue | Falsey; - -/** - * @group Class Name Generators - * @param strings - * @param interpolations - */ -declare function css(strings: TemplateStringsArray, ...interpolations: readonly CSSValue[]): string; -declare function css(style: CSSObject | string): string; - -/** - * Constructs `class` strings conditionally. - * - * Twinds version of popular libraries like [classnames](https://github.com/JedWatson/classnames) or [clsx](https://github.com/lukeed/clsx). - * The key advantage of `cx` is that it supports twinds enhanced class name syntax like grouping and aliases. - * - * @group Class Name Generators - * @param strings - * @param interpolations - * @returns - */ -declare function cx(strings: TemplateStringsArray, ...interpolations: Class[]): string; -/** - * Constructs `class` strings conditionally. - * - * Twinds version of popular libraries like [classnames](https://github.com/JedWatson/classnames) or [clsx](https://github.com/lukeed/clsx). - * The key advantage of `cx` is that it supports twinds enhanced class name syntax like grouping and aliases. - * - * @group Class Name Generators - * @param input - */ -declare function cx(...input: Class[]): string; - -/** - * @group Configuration - * @param param0 - * @returns - */ -declare function defineConfig[] = Preset[]>({ presets, ...userConfig }: TwindUserConfig): TwindConfig>; - -interface InjectGlobalFunction { - (style: CSSBase | string): void; - (strings: TemplateStringsArray, ...interpolations: readonly CSSValue[]): void; - bind(thisArg?: ((tokens: string) => string) | undefined | void): InjectGlobalFunction; - call(thisArg: ((tokens: string) => string) | undefined | void, style: CSSBase | string): void; - apply(thisArg: ((tokens: string) => string) | undefined | void, args: [CSSBase | string]): void; -} -/** - * Injects styles into the global scope and is useful for applications such as gloabl styles, CSS resets or font faces. - * - * It **does not** return a class name, but adds the styles within the base layer to the stylesheet directly. - * - * @group Style Injectors - */ -declare const injectGlobal: InjectGlobalFunction; - -/** - * @group Runtime - * @param config - * @param isProduction - */ -declare function install(config: TwindConfig, isProduction?: boolean): Twind; -declare function install[] = Preset[]>(config: TwindUserConfig, isProduction?: boolean): Twind>; - -interface KeyframesFunction { - (style: CSSObject | string): StringLike; - (strings: TemplateStringsArray, ...interpolations: readonly CSSValue[]): StringLike; - bind(thisArg?: ((tokens: string) => string) | undefined | void): Keyframes & { - [label: string]: KeyframesFunction; - }; - call(thisArg: ((tokens: string) => string) | undefined | void, style: CSSObject | string): StringLike; - call(thisArg: ((tokens: string) => string) | undefined | void, strings: TemplateStringsArray, ...interpolations: readonly CSSValue[]): StringLike; - apply(thisArg: ((tokens: string) => string) | undefined | void, args: [CSSObject | string]): StringLike; - apply(thisArg: ((tokens: string) => string) | undefined | void, args: [CSSObject | string] | [strings: TemplateStringsArray, ...interpolations: readonly CSSValue[]]): StringLike; -} -declare type Keyframes = KeyframesFunction & { - [label: string]: KeyframesFunction; -}; -/** - * **Note**: The styles will be injected on first use. - * - * @group Style Injectors - */ -declare const keyframes: Keyframes; - -interface TwindMutationObserver { - observe: (target: Node) => void; - disconnect: () => void; -} -/** - * @group Runtime - * @param tw - * @param target - * @returns - * @internal - */ -declare function mo(tw: Twind): TwindMutationObserver; -/** - * @group Runtime - * @param tw - * @param target - * @returns - */ -declare function observe(tw?: Twind, target?: false | Node): Twind; - -interface ParsedRule { - /** - * The utility name including `-` if set, but without `!` and variants - */ - readonly n: string; - /** - * All variants without trailing colon: `hover`, `after:`, `[...]` - */ - readonly v: string[]; - /** - * Something like `!underline` or `!bg-red-500` or `!red-500` - */ - readonly i?: boolean; -} -interface ParsedDevRule extends ParsedRule { - readonly a: string[]; - readonly l: [start: number, end: number]; -} -/** - * @internal - * @param token - * @returns - */ -declare function parse(token: string): ParsedRule[]; - -declare type ThemeMatchResult = MatchResult & { - /** The found theme value */ - _: Value; -}; -declare type ThemeRuleResolver = RuleResolver>; -declare type ThemeMatchConverter = MatchConverter>; -/** - * @group Configuration - * @param pattern - */ -declare function match(pattern: MaybeArray): Rule; -/** - * @group Configuration - * @param pattern - * @param resolver - */ -declare function match(pattern: MaybeArray, resolver: RuleResolver): Rule; -/** - * @group Configuration - * @param pattern - * @param resolve - */ -declare function match(pattern: MaybeArray, resolve: (string & {}) | CSSObject): Rule; -/** - * @group Configuration - * @param pattern - * @param resolve - * @param convert - */ -declare function match(pattern: MaybeArray, resolve: keyof CSSProperties, convert?: MatchConverter): Rule; -/** - * @group Configuration - * @internal - * @deprecated Use {@link match} instead. - */ -declare function fromMatch(): RuleResolver; -/** - * @group Configuration - * @internal - * @deprecated Use {@link match} instead. - */ -declare function fromMatch(resolver: RuleResolver): RuleResolver; -/** - * @group Configuration - * @internal - * @deprecated Use {@link match} instead. - */ -declare function fromMatch(resolve: keyof CSSProperties, convert?: MatchConverter): RuleResolver; -/** - * @group Configuration - * @internal - * @deprecated Use {@link match} instead. - */ -declare function fromMatch(resolve: string | CSSObject): RuleResolver; -/** - * @group Configuration - * @param pattern - * @param section - * @param resolve - * @param convert - * @returns - */ -declare function matchTheme(pattern: MaybeArray, -/** Theme section to use (default: `$1` — The first matched group) */ -section?: '' | Section | KebabCase
, -/** The css property (default: value of {@link section}) */ -resolve?: keyof CSSProperties | ThemeRuleResolver, Theme>, convert?: ThemeMatchConverter, Theme>): Rule; -/** - * @group Configuration - * @internal - * @deprecated Use {@link matchTheme} instead. - * @param section - * @param resolve - * @param convert - * @returns - */ -declare function fromTheme( -/** Theme section to use (default: `$1` — The first matched group) */ -section?: '' | Section | KebabCase
, -/** The css property (default: value of {@link section}) */ -resolve?: keyof CSSProperties | ThemeRuleResolver, Theme>, convert?: ThemeMatchConverter, Theme>): RuleResolver; -declare type FilterByThemeValue = { - [key in keyof Theme & string]: ThemeValue extends Value ? Theme[key] : never; -}; -interface ColorFromThemeValue { - value: string; - color: ColorFunction; - opacityVariable: string | undefined; - opacityValue: string | undefined; -} -interface ColorFromThemeOptions = keyof FilterByThemeValue, OpacitySection extends keyof FilterByThemeValue = keyof FilterByThemeValue> { - /** Theme section to use (default: `$0.replace('-', 'Color')` — The matched string with `Color` appended) */ - section?: Section | KebabCase
; - /** The css property (default: value of {@link section}) */ - property?: keyof CSSProperties; - /** `--tw-${$0}opacity` -> '--tw-text-opacity' */ - opacityVariable?: string | false; - /** `section.replace('Color', 'Opacity')` -> 'textOpacity' */ - opacitySection?: OpacitySection; - selector?: string; -} -/** - * @group Configuration - * @param pattern - * @param options - * @param resolve - * @returns - */ -declare function matchColor = keyof FilterByThemeValue, OpacitySection extends keyof FilterByThemeValue = keyof FilterByThemeValue>(pattern: MaybeArray, options?: ColorFromThemeOptions, resolve?: ThemeRuleResolver): Rule; -/** - * @group Configuration - * @internal - * @deprecated Use {@link matchColor} instead. - * @param options - * @param resolve - * @returns - */ -declare function colorFromTheme = keyof FilterByThemeValue, OpacitySection extends keyof FilterByThemeValue = keyof FilterByThemeValue>(options?: ColorFromThemeOptions, resolve?: ThemeRuleResolver): RuleResolver; -/** - * @internal - * @param input - */ -declare function parseValue(input: string): [value: string, modifier: string | undefined] | [value: undefined, modifier: string | undefined]; -/** - * @internal - * @param property - * @param value - * @returns - */ -declare function toCSS(property: string, value: string | ColorFromThemeValue): CSSObject; -/** - * @internal - * @param value - * @param section - * @param context - * @returns - */ -declare function arbitrary(value: string, section: string | undefined, context: Context): string | undefined; -/** - * @internal - * @param value - * @returns - */ -declare function normalize(value: string): string; - -/** - * @group Runtime - * @param install - * @returns - */ -declare function auto(install: () => void): () => void; -/** - * A proxy to the currently active Twind instance. - * @group Style Injectors - */ -declare const tw: Twind; -declare type SheetFactory = () => Sheet; -/** - * Manages a single Twind instance — works in browser, Node.js, Deno, workers... - * - * @group Runtime - * @param config - * @param sheet - * @param target - * @returns - */ -declare function setup(config?: TwindConfig, sheet?: Sheet | SheetFactory, target?: HTMLElement): Twind; -declare function setup[] = Preset[], SheetTarget = unknown>(config?: TwindUserConfig, sheet?: Sheet | SheetFactory, target?: HTMLElement): Twind, SheetTarget>; - -/** - * @group Sheets - * @param element - * @returns - */ -declare function cssom(element?: CSSStyleSheet | HTMLStyleElement | string | null | false): Sheet; -/** - * @group Sheets - * @param element - * @returns - */ -declare function dom(element?: HTMLStyleElement | string | null | false): Sheet; -/** - * @group Sheets - * @param includeResumeData - * @returns - */ -declare function virtual(includeResumeData?: boolean): Sheet; -/** - * Returns a sheet useable in the current environment. - * - * @group Sheets - * @param useDOMSheet usually something like `process.env.NODE_ENV != 'production'` or `import.meta.env.DEV` (default: browser={@link cssom}, server={@link virtual}) - * @param disableResume to not include or use resume data - * @returns a sheet to use - */ -declare function getSheet(useDOMSheet?: boolean, disableResume?: boolean): Sheet; -/** - * @group Sheets - * @param target - * @returns - */ -declare function stringify(target: unknown): string; - -/** - * Options for {@link inline} - */ -interface InlineOptions { - /** - * {@link Twind} instance to use (default: {@link @twind/core.tw}) - */ - tw?: Twind; - /** - * Allows to minify the resulting CSS. - */ - minify?: InlineMinify; -} -interface InlineMinify { - /** - * Called to minify the CSS. - * - * @param css the CSS to minify - * @param html the HTML that will be used — allows to only include above-the-fold CSS - * @return the resulting CSS - */ - (css: string, html: string): string; -} -/** - * Used for static HTML processing (usually to provide SSR support for your javascript-powered web apps) - * - * 1. parse the markup and process element classes with the provided Twind instance - * 2. update the class attributes _if_ necessary - * 3. inject a style element with the CSS as last element into the head - * 4. return the HTML string with the final element classes - * - * ```js - * import { inline } from '@twind/core' - * - * function render() { - * return inline(renderApp()) - * } - * ``` - * - * Minify CSS with [@parcel/css](https://www.npmjs.com/package/@parcel/css): - * - * ```js - * import { inline } from '@twind/core' - * import { transform } from '@parcel/css' - * - * function render() { - * return inline(renderApp(), { minify: (css) => transform({ filename: 'twind.css', code: Buffer.from(css), minify: true }) }) - * } - * ``` - * - * You can provide your own Twind instance: - * - * ```js - * import { inline } from '@twind/core' - * import { tw } from './custom/twind/instance' - * - * function render() { - * return inline(renderApp(), { tw }) - * } - * ``` - * - * @group Static Extraction - * @param markup HTML to process - * @param options to customize the processing - * @returns the resulting HTML - */ -declare function inline(markup: string, options?: InlineOptions['tw'] | InlineOptions): string; -/** - * Result of {@link extract} - */ -interface ExtractResult { - /** The possibly modified HTML */ - html: string; - /** The generated CSS */ - css: string; -} -/** - * Used for static HTML processing (usually to provide SSR support for your javascript-powered web apps) - * - * **Note**: Consider using {@link inline} instead. - * - * 1. parse the markup and process element classes with the provided Twind instance - * 2. update the class attributes _if_ necessary - * 3. return the HTML string with the final element classes - * - * ```js - * import { extract } from '@twind/core' - * - * function render() { - * const { html, css } = extract(renderApp()) - * - * // inject as last element into the head - * return html.replace('', ``) - * } - * ``` - * - * You can provide your own Twind instance: - * - * ```js - * import { extract } from '@twind/core' - * import { tw } from './custom/twind/instance' - * - * function render() { - * const { html, css } = extract(renderApp(), tw) - * - * // inject as last element into the head - * return html.replace('', ``) - * } - * ``` - * - * @group Static Extraction - * @param markup HTML to process - * @param tw a {@link Twind} instance (default: twind managed tw) - * @returns the possibly modified html and css - */ -declare function extract(html: string, tw?: Twind): ExtractResult; -/** - * Used for static HTML processing (usually to provide SSR support for your javascript-powered web apps) - * - * **Note**: Consider using {@link inline} or {@link extract} instead. - * - * 1. parse the markup and process element classes with the provided Twind instance - * 2. update the class attributes _if_ necessary - * 3. return the HTML string with the final element classes - * - * ```js - * import { consume, stringify, tw } from '@twind/core' - * - * function render() { - * const html = renderApp() - * - * // remember global classes - * const restore = tw.snapshot() - * - * // generated markup - * const markup = consume(html) - * - * // create CSS - * const css = stringify(tw.target) - * - * // restore global classes - * restore() - * - * // inject as last element into the head - * return markup.replace('', ``) - * } - * ``` - * - * You can provide your own Twind instance: - * - * ```js - * import { consume, stringify } from '@twind/core' - * import { tw } from './custom/twind/instance' - * - * function render() { - * const html = renderApp() - * - * // remember global classes - * const restore = snapshot(tw.target) - * - * // generated markup - * const markup = consume(html) - * - * // restore global classes - * restore() - * - * // create CSS - * const css = stringify(tw.target) - * - * // inject as last element into the head - * return markup.replace('', ``) - * } - * ``` - * - * @group Static Extraction - * @param markup HTML to process - * @param tw a {@link Twind} instance - * @returns possibly modified HTML - */ -declare function consume(markup: string, tw?: (className: string) => string): string; - -declare type StrictMorphVariant = T extends number ? `${T}` | T : T extends 'true' ? true | T : T extends 'false' ? false | T : T; -declare type MorphVariant = T extends number ? `${T}` | T : T extends 'true' ? boolean | T : T extends 'false' ? boolean | T : T extends `${number}` ? number | T : T; -declare type StyleTokenValue = string | Falsey; -declare type StyleToken = StyleTokenValue; -/** - * Allows to extract the supported properties of a style function. - * - * Here is an example for `react` - * ```js - * import { HTMLAttributes } from "react"; - * import { style, PropsOf } from "@twind/core"; - * const button = style({ ... }) - * type ButtonProps = PropsOf - * export const Button = (props: ButtonProps & HTMLAttributes) => { - * return