Comparing version 2.1.2 to 2.1.3
@@ -1,2 +0,2 @@ | ||
var ae=Object.defineProperty,pe=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var Y=(r,l,i)=>l in r?ae(r,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[l]=i,R=(r,l)=>{for(var i in l||(l={}))ie.call(l,i)&&Y(r,i,l[i]);if(W)for(var i of W(l))ue.call(l,i)&&Y(r,i,l[i]);return r},E=(r,l)=>pe(r,ce(l));export const Fragment=Symbol.for("FORGO_FRAGMENT");const Ce="http://www.w3.org/1999/xhtml",xe="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",q=1,Te=2,k=3;export function createElement(r,l){var C;l=l!=null?l:{},l.children=arguments.length>3?S(Array.from(arguments).slice(2)):arguments.length===3?S(arguments[2]):void 0;const i=(C=l.key)!=null?C:void 0;return{type:r,props:l,key:i,__is_forgo_element__:!0}}export const h=createElement;function fe(r,l){return i=>{if(!r.__forgo_deleted)return l(i)}}export function createForgoInstance(r){var J;const l=r;l.__internal=(J=l.__internal)!=null?J:{Text:l.window.Text,HTMLElement:l.window.HTMLElement};function i(n,e,o,t){return Array.isArray(n)?U(n,e,o,t):L(n)?ge(n)?A(n,e,o,t):D(n)?K(n,e,o,t):z(n,e,o,t):n==null?C(n,e,o,t):T(n,e,o,t)}function C(n,e,o,t){return{nodes:[]}}function T(n,e,o,t){var d;if(e.type==="detached"){const p=l.document.createTextNode($(n));return b(n,p,!0,o,void 0),{nodes:[p]}}else{const p=l.document.createTextNode($(n)),s=e.parentElement.childNodes;if(e.length){let c=s[e.currentNodeIndex];if(c.nodeType===k){c.replaceWith(p);const u=(d=getForgoState(c))==null?void 0:d.components;return b(n,p,!0,o,u),{nodes:[p]}}else{const u=s[e.currentNodeIndex];return e.parentElement.insertBefore(p,u),b(n,p,!0,o,void 0),{nodes:[p]}}}else{const c=e.parentElement.childNodes;if(c.length===0||e.currentNodeIndex===0)e.parentElement.prepend(p);else{const u=c[e.currentNodeIndex];e.parentElement.insertBefore(p,u)}return b(n,p,!0,o,void 0),{nodes:[p]}}}}function A(n,e,o,t){if(e.type==="detached")return s(void 0,null);{const c=e.parentElement.childNodes;if(e.length){const u=Q(n,c,e.currentNodeIndex,e.length);return u.found?p(u.index,c,e):s(e.parentElement,c[e.currentNodeIndex])}else return s(e.parentElement,c[e.currentNodeIndex])}function d(c){if(n.props.dangerouslySetInnerHTML)c.innerHTML=n.props.dangerouslySetInnerHTML.__html;else{const u=n.props.children,a=S((Array.isArray(u)?u:[u]).filter(y=>y!=null));let m=0;for(const y of a){const{nodes:N}=i(y,{type:"search",parentElement:c,currentNodeIndex:m,length:c.childNodes.length-m},[],t);m+=N.length}const f=P(c.childNodes,m,c.childNodes.length);f.length&&_(f,[])}}function p(c,u,a){var N;const m=P(u,a.currentNodeIndex,c);_(m,o);const f=u[a.currentNodeIndex];d(f);const y=(N=getForgoState(f))==null?void 0:N.components;return b(n,f,!1,o,y),{nodes:[f]}}function s(c,u){const a=te(n,c);return c&&c.insertBefore(a,u),n.props.ref&&(n.props.ref.value=a),d(a),b(n,a,!0,o,void 0),{nodes:[a]}}}function z(n,e,o,t){const d=o.length;if(e.type==="detached")return s();if(e.length){if(t)return s();{const u=e.parentElement.childNodes,a=O(n,u,e.currentNodeIndex,e.length,o.length);return a.found?p(a.index,u,e):s()}}else return s();function p(u,a,m){const f=a[u],N=H(f).components[d],F=P(a,m.currentNodeIndex,u);if(_(F,o.concat(N)),!N.component.shouldUpdate||N.component.shouldUpdate(n.props,N.props)){const g=E(R({},N),{props:n.props}),x=g.component.render(n.props,g.args),w=o.concat(g),re=N.args.element.node,de=g.component.error?g.component:void 0,se=c(n.props,g.args,w,de,()=>{const le={type:"search",currentNodeIndex:m.currentNodeIndex,length:g.nodes.length,parentElement:m.parentElement};return I(x,le,w,g,t)});return g.component.afterRender&&g.component.afterRender(n.props,E(R({},g.args),{previousNode:re})),se}else{let g=B(m.parentElement.childNodes,N.args.element.node);return{nodes:P(m.parentElement.childNodes,g,g+N.nodes.length)}}}function s(){const u={element:{componentIndex:d},update:F=>G(u.element,F)},a=n.type,m=a(n.props,{environment:l});he(a,m);const f=m.error?m:void 0,y={key:n.key,ctor:a,component:m,props:n.props,args:u,nodes:[],isMounted:!1},N=o.concat(y);return c(n.props,u,N,f,()=>{const F=m.render(n.props,u),g=e.type==="detached"?e:{type:"search",currentNodeIndex:e.currentNodeIndex,length:t?e.length:0,parentElement:e.parentElement},x=i(F,g,N,t);return y.nodes=x.nodes,x.nodes.length>1&&(y.args.element.node=x.nodes[0]),m.afterRender&&m.afterRender(n.props,u),x})}function c(u,a,m,f,y){try{return y()}catch(N){if(f&&f.error){const F=E(R({},a),{error:N}),g=f.error(u,F);return i(g,e,m,t)}else throw N}}}function I(n,e,o,t,d){const p=e.parentElement.childNodes.length,s=i(n,e,o,d),c=e.parentElement.childNodes.length,u=p+s.nodes.length-c,a=e.currentNodeIndex+s.nodes.length,m=P(e.parentElement.childNodes,a,a+t.nodes.length-u),f=s.nodes.length>0?o:[];return _(m,f),t.nodes=s.nodes,s.nodes.length>1&&(t.args.element.node=s.nodes[0]),s}function U(n,e,o,t){const d=S(n);if(e.type==="detached")throw new Error("Arrays and fragments cannot be rendered at the top level.");{let p=[],s=e.currentNodeIndex,c=e.length;for(const u of d){const a=e.parentElement.childNodes.length,m=E(R({},e),{currentNodeIndex:s,length:c}),{nodes:f}=i(u,m,o,t);p=p.concat(f);const y=e.parentElement.childNodes.length,N=a+f.length-y;s+=f.length,c-=N}return{nodes:p}}}function K(n,e,o,t){return U(S(n),e,o,t)}function b(n,e,o,t,d){if(ee(n,e,o,t),d){const p=j(t,d);M(d,p),X(t,p)}else X(t,0)}function _(n,e){for(const o of n){const t=getForgoState(o);if(o.__forgo_deleted=!0,o.remove(),t){const d=t.components,p=j(e,d);M(t.components,p)}}}function j(n,e){let o=0;for(const t of n)if(e.length>o){if(e[o].component!==t.component)break;o++}else break;return o}function M(n,e){let o=!1;for(let t=e;t<n.length;t++){const d=n[t];d.component.unmount&&(o||d.nodes.every(p=>{if(p.isConnected){const s=H(p);return!s.components[t]||s.components[t].component!==d.component}else return!0}))&&(d.component.unmount(d.props,d.args),o=!0)}}function X(n,e){for(let o=e;o<n.length;o++){const t=n[o];t.component.mount&&!t.isMounted&&(t.isMounted=!0,t.component.mount(t.props,t.args))}}function Q(n,e,o,t){for(let d=o;d<o+t;d++){const p=e[d];if(Z(p)){const s=getForgoState(p);if(n.key){if((s==null?void 0:s.key)===n.key)return{found:!0,index:d}}else if(p.tagName.toLowerCase()===n.type&&(!s||!s.key))return{found:!0,index:d}}}return{found:!1}}function O(n,e,o,t,d){for(let p=o;p<o+t;p++){const s=e[p],c=getForgoState(s);if(c&&c.components.length>d){if(n.key){if(c.components[d].key===n.key)return{found:!0,index:p}}else if(c.components[d].ctor===n.type)return{found:!0,index:p}}}return{found:!1}}function ee(n,e,o,t){var p;const d=[];for(const s of t)d.push(s.component.afterRender?s.args.element.node:void 0),s.args.element.node=e;if(L(n)){const s=getForgoState(e);if(s&&s.props)for(const a in s.props)a in n.props||a!=="children"&&a!=="xmlns"&&(e.nodeType===k||e instanceof l.__internal.HTMLElement&&a in e?delete e[a]:e.removeAttribute(a));else if(!o&&Z(e)&&e.hasAttributes()){const a=Array.from(e.attributes);for(const m of a){const f=m.name;f in n.props||e.removeAttribute(f)}}const c=Object.entries(n.props);for(const[a,m]of c)if(((p=s==null?void 0:s.props)==null?void 0:p[a])!==m&&a!=="children"&&a!=="xmlns")if(e.nodeType===k)e[a]=m;else if(e instanceof l.__internal.HTMLElement)if(a==="style"){if(s===void 0||s.style===void 0||s.style!==n.props.style){const f=ye(n.props.style);e.style.cssText!==f&&(e.style.cssText=f)}}else a==="onblur"?e[a]=fe(e,m):a in e?e[a]=m:e.setAttribute(a,m);else typeof m=="string"?e.setAttribute(a,m):e[a]=m;const u={key:n.key,props:n.props,components:t};setForgoState(e,u)}else setForgoState(e,{components:t})}function ne(n,e){let o=Ne(e)?l.document.querySelector(e):e;if(o)if(o.nodeType===q){const t=o.childNodes.length>0,d=i(n,{type:"search",currentNodeIndex:0,length:o.childNodes.length,parentElement:o},[],t);if(d.nodes.length<o.childNodes.length){const p=P(o.childNodes,d.nodes.length,o.childNodes.length);for(const s of p)s.remove()}return d}else throw new Error("The container argument to the mount() function should be an HTML element.");else throw new Error(`The mount() function was called on a non-element (${typeof e=="string"?e:e==null?void 0:e.tagName}).`)}function oe(n){const e=i(n,{type:"detached"},[],!1);return{node:e.nodes[0],nodes:e.nodes}}function G(n,e){if(n&&n.node){const o=n.node.parentElement;if(o!==null){const t=H(n.node),d=t.components[n.componentIndex],p=e!==void 0?e:d.props;if(!d.component.shouldUpdate||d.component.shouldUpdate(p,d.props)){const s=E(R({},d),{props:p}),c=t.components.slice(0,n.componentIndex),u=c.concat(s),a=d.args.element.node,m=d.component.render(p,d.args);let f=B(o.childNodes,n.node);const y={type:"search",currentNodeIndex:f,length:d.nodes.length,parentElement:o},N=I(m,y,u,s,!1);for(let F=0;F<c.length;F++){const g=c[F],x=g.nodes.findIndex(w=>w===d.nodes[0]);if(g.nodes=g.nodes.slice(0,x).concat(N.nodes).concat(g.nodes.slice(x+d.nodes.length)),g.nodes.length===0){M(c,F);break}else g.args.element.node=g.nodes[0]}return d.component.afterRender&&d.component.afterRender(p,E(R({},d.args),{previousNode:a})),N}else{let s=B(o.childNodes,n.node);return{nodes:P(o.childNodes,s,s+d.nodes.length)}}}else throw new Error("The rerender() function was called on a detached node.")}else throw new Error("Missing node information in rerender() argument.")}function te(n,e){var t;const o=((t=n.props.xmlns)!=null?t:n.type==="svg")?me:e&&e.namespaceURI;return n.props.is?o?l.document.createElementNS(o,n.type,{is:n.props.is}):l.document.createElement(n.type,{is:n.props.is}):o?l.document.createElementNS(o,n.type):l.document.createElement(n.type)}return{mount:ne,render:oe,rerender:G}}const V=globalThis||window;let v=createForgoInstance({window:V,document:V.document});export function setCustomEnv(r){v=createForgoInstance(r)}export function mount(r,l){return v.mount(r,l)}export function render(r){return v.render(r)}export function rerender(r,l){return v.rerender(r,l)}function S(r){function l(i,C=[]){const T=Array.isArray(i)?i:D(i)?Array.isArray(i.props.children)?i.props.children:i.props.children!==void 0&&i.props.children!==null?[i.props.children]:[]:[i];for(const A of T)Array.isArray(A)||D(A)?l(A,C):C.push(A);return C}return l(r,[])}function $(r){return r.toString()}function L(r){return r!=null&&r.__is_forgo_element__===!0}function ge(r){return L(r)&&typeof r.type=="string"}function D(r){return r!=null&&r.type===Fragment}export function getForgoState(r){return r.__forgo}function H(r){if(r.__forgo)return r.__forgo;throw new Error("Missing forgo state on node.")}export function setForgoState(r,l){r.__forgo=l}function he(r,l){if(!l.render)throw new Error(`${r.name||"Unnamed"} component constructor must return an object having a render() function.`)}function Ne(r){return typeof r=="string"}function Z(r){return r.nodeType===q}function ye(r){return typeof r=="string"?r:r==null?"":Object.keys(r).reduce((l,i)=>l+i.split(/(?=[A-Z])/).join("-").toLowerCase()+":"+r[i]+";","")}function P(r,l,i){const C=[];for(let T=l;T<i;T++)C.push(r[T]);return C}function B(r,l){for(let i=0;i<r.length;i++)if(r[i]===l)return i;return-1}export{}; | ||
var ae=Object.defineProperty,pe=Object.defineProperties;var ce=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var Y=(r,l,i)=>l in r?ae(r,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[l]=i,R=(r,l)=>{for(var i in l||(l={}))ie.call(l,i)&&Y(r,i,l[i]);if(W)for(var i of W(l))ue.call(l,i)&&Y(r,i,l[i]);return r},E=(r,l)=>pe(r,ce(l));export const Fragment=Symbol.for("FORGO_FRAGMENT");const Ce="http://www.w3.org/1999/xhtml",xe="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",q=1,Te=2,k=3;export function createElement(r,l){var C;l=l!=null?l:{},l.children=arguments.length>3?S(Array.from(arguments).slice(2)):arguments.length===3?S(arguments[2]):void 0;const i=(C=l.key)!=null?C:void 0;return{type:r,props:l,key:i,__is_forgo_element__:!0}}export const h=createElement;function fe(r,l){return i=>{if(!r.__forgo_deleted)return l(i)}}export function createForgoInstance(r){var J;const l=r;l.__internal=(J=l.__internal)!=null?J:{Text:l.window.Text,HTMLElement:l.window.HTMLElement};function i(n,e,o,t){return Array.isArray(n)?U(n,e,o,t):L(n)?ge(n)?A(n,e,o,t):D(n)?K(n,e,o,t):z(n,e,o,t):n==null?C(n,e,o,t):T(n,e,o,t)}function C(n,e,o,t){return{nodes:[]}}function T(n,e,o,t){var d;if(e.type==="detached"){const p=l.document.createTextNode($(n));return b(n,p,!0,o,void 0),{nodes:[p]}}else{const p=l.document.createTextNode($(n)),s=e.parentElement.childNodes;if(e.length){let c=s[e.currentNodeIndex];if(c.nodeType===k){c.replaceWith(p);const u=(d=getForgoState(c))==null?void 0:d.components;return b(n,p,!0,o,u),{nodes:[p]}}else{const u=s[e.currentNodeIndex];return e.parentElement.insertBefore(p,u),b(n,p,!0,o,void 0),{nodes:[p]}}}else{const c=e.parentElement.childNodes;if(c.length===0||e.currentNodeIndex===0)e.parentElement.prepend(p);else{const u=c[e.currentNodeIndex];e.parentElement.insertBefore(p,u)}return b(n,p,!0,o,void 0),{nodes:[p]}}}}function A(n,e,o,t){if(e.type==="detached")return s(void 0,null);{const c=e.parentElement.childNodes;if(e.length){const u=Q(n,c,e.currentNodeIndex,e.length);return u.found?p(u.index,c,e):s(e.parentElement,c[e.currentNodeIndex])}else return s(e.parentElement,c[e.currentNodeIndex])}function d(c){if(n.props.dangerouslySetInnerHTML)c.innerHTML=n.props.dangerouslySetInnerHTML.__html;else{const u=n.props.children,a=S((Array.isArray(u)?u:[u]).filter(y=>y!=null));let m=0;for(const y of a){const{nodes:N}=i(y,{type:"search",parentElement:c,currentNodeIndex:m,length:c.childNodes.length-m},[],t);m+=N.length}const f=P(c.childNodes,m,c.childNodes.length);f.length&&_(f,[])}}function p(c,u,a){var N;const m=P(u,a.currentNodeIndex,c);_(m,o);const f=u[a.currentNodeIndex];d(f);const y=(N=getForgoState(f))==null?void 0:N.components;return b(n,f,!1,o,y),{nodes:[f]}}function s(c,u){const a=te(n,c);return c&&c.insertBefore(a,u),n.props.ref&&(n.props.ref.value=a),d(a),b(n,a,!0,o,void 0),{nodes:[a]}}}function z(n,e,o,t){const d=o.length;if(e.type==="detached")return s();if(e.length){if(t)return s();{const u=e.parentElement.childNodes,a=O(n,u,e.currentNodeIndex,e.length,o.length);return a.found?p(a.index,u,e):s()}}else return s();function p(u,a,m){const f=a[u],N=H(f).components[d],F=P(a,m.currentNodeIndex,u);if(_(F,o.concat(N)),!N.component.shouldUpdate||N.component.shouldUpdate(n.props,N.props)){const g=E(R({},N),{props:n.props}),x=g.component.render(n.props,g.args),w=o.concat(g),re=N.args.element.node,de=g.component.error?g.component:void 0,se=c(n.props,g.args,w,de,()=>{const le={type:"search",currentNodeIndex:m.currentNodeIndex,length:g.nodes.length,parentElement:m.parentElement};return I(x,le,w,g,t)});return g.component.afterRender&&g.component.afterRender(n.props,E(R({},g.args),{previousNode:re})),se}else{let g=B(m.parentElement.childNodes,N.args.element.node);return{nodes:P(m.parentElement.childNodes,g,g+N.nodes.length)}}}function s(){const u={element:{componentIndex:d},update:F=>G(u.element,F)},a=n.type,m=a(n.props,{environment:l});he(a,m);const f=m.error?m:void 0,y={key:n.key,ctor:a,component:m,props:n.props,args:u,nodes:[],isMounted:!1},N=o.concat(y);return c(n.props,u,N,f,()=>{const F=m.render(n.props,u),g=e.type==="detached"?e:{type:"search",currentNodeIndex:e.currentNodeIndex,length:t?e.length:0,parentElement:e.parentElement},x=i(F,g,N,t);return y.nodes=x.nodes,x.nodes.length>1&&(y.args.element.node=x.nodes[0]),m.afterRender&&m.afterRender(n.props,u),x})}function c(u,a,m,f,y){try{return y()}catch(N){if(f&&f.error){const F=E(R({},a),{error:N}),g=f.error(u,F);return i(g,e,m,t)}else throw N}}}function I(n,e,o,t,d){const p=e.parentElement.childNodes.length,s=i(n,e,o,d),c=e.parentElement.childNodes.length,u=p+s.nodes.length-c,a=e.currentNodeIndex+s.nodes.length,m=P(e.parentElement.childNodes,a,a+t.nodes.length-u),f=s.nodes.length>0?o:[];return _(m,f),t.nodes=s.nodes,s.nodes.length>1&&(t.args.element.node=s.nodes[0]),s}function U(n,e,o,t){const d=S(n);if(e.type==="detached")throw new Error("Arrays and fragments cannot be rendered at the top level.");{let p=[],s=e.currentNodeIndex,c=e.length;for(const u of d){const a=e.parentElement.childNodes.length,m=E(R({},e),{currentNodeIndex:s,length:c}),{nodes:f}=i(u,m,o,t);p=p.concat(f);const y=e.parentElement.childNodes.length,N=a+f.length-y;s+=f.length,c-=N}return{nodes:p}}}function K(n,e,o,t){return U(S(n),e,o,t)}function b(n,e,o,t,d){if(ee(n,e,o,t),d){const p=j(t,d);M(d,p),X(t,p)}else X(t,0)}function _(n,e){for(const o of n){const t=getForgoState(o);if(o.__forgo_deleted=!0,o.remove(),t){const d=t.components,p=j(e,d);M(t.components,p)}}}function j(n,e){let o=0;for(const t of n)if(e.length>o){if(e[o].component!==t.component)break;o++}else break;return o}function M(n,e){let o=!1;for(let t=e;t<n.length;t++){const d=n[t];d.component.unmount&&(o||d.nodes.every(p=>{if(p.isConnected){const s=H(p);return!s.components[t]||s.components[t].component!==d.component}else return!0}))&&(d.component.unmount(d.props,d.args),o=!0)}}function X(n,e){for(let o=e;o<n.length;o++){const t=n[o];t.component.mount&&!t.isMounted&&(t.isMounted=!0,t.component.mount(t.props,t.args))}}function Q(n,e,o,t){for(let d=o;d<o+t;d++){const p=e[d];if(Z(p)){const s=getForgoState(p);if(n.key){if((s==null?void 0:s.key)===n.key)return{found:!0,index:d}}else if(p.tagName.toLowerCase()===n.type&&(!s||!s.key))return{found:!0,index:d}}}return{found:!1}}function O(n,e,o,t,d){for(let p=o;p<o+t;p++){const s=e[p],c=getForgoState(s);if(c&&c.components.length>d){if(n.key){if(c.components[d].key===n.key)return{found:!0,index:p}}else if(c.components[d].ctor===n.type)return{found:!0,index:p}}}return{found:!1}}function ee(n,e,o,t){var p;const d=[];for(const s of t)d.push(s.component.afterRender?s.args.element.node:void 0),s.args.element.node=e;if(L(n)){const s=getForgoState(e);if(s&&s.props)for(const a in s.props)a in n.props||a!=="children"&&a!=="xmlns"&&(e.nodeType===k||e instanceof l.__internal.HTMLElement&&a in e?delete e[a]:e.removeAttribute(a));else if(!o&&Z(e)&&e.hasAttributes()){const a=Array.from(e.attributes);for(const m of a){const f=m.name;f in n.props||e.removeAttribute(f)}}const c=Object.entries(n.props);for(const[a,m]of c)if(((p=s==null?void 0:s.props)==null?void 0:p[a])!==m&&a!=="children"&&a!=="xmlns")if(e.nodeType===k)e[a]=m;else if(e instanceof l.__internal.HTMLElement)if(a==="style"){if(s===void 0||s.style===void 0||s.style!==n.props.style){const f=ye(n.props.style);e.style.cssText!==f&&(e.style.cssText=f)}}else a==="onblur"?e[a]=fe(e,m):a in e?e[a]=m:e.setAttribute(a,m);else typeof m=="string"?e.setAttribute(a,m):e[a]=m;const u={key:n.key,props:n.props,components:t};setForgoState(e,u)}else setForgoState(e,{components:t})}function ne(n,e){let o=Ne(e)?l.document.querySelector(e):e;if(o)if(o.nodeType===q){const t=o.childNodes.length>0,d=i(n,{type:"search",currentNodeIndex:0,length:o.childNodes.length,parentElement:o},[],t);if(d.nodes.length<o.childNodes.length){const p=P(o.childNodes,d.nodes.length,o.childNodes.length);for(const s of p)s.remove()}return d}else throw new Error("The container argument to the mount() function should be an HTML element.");else throw new Error(`The mount() function was called on a non-element (${typeof e=="string"?e:e==null?void 0:e.tagName}).`)}function oe(n){const e=i(n,{type:"detached"},[],!1);return{node:e.nodes[0],nodes:e.nodes}}function G(n,e){if(n&&n.node){const o=n.node.parentElement;if(o!==null){const t=H(n.node),d=t.components[n.componentIndex],p=e!==void 0?e:d.props;if(!d.component.shouldUpdate||d.component.shouldUpdate(p,d.props)){const s=E(R({},d),{props:p}),c=t.components.slice(0,n.componentIndex),u=c.concat(s),a=d.args.element.node,m=d.component.render(p,d.args);let f=B(o.childNodes,n.node);const y={type:"search",currentNodeIndex:f,length:d.nodes.length,parentElement:o},N=I(m,y,u,s,!1);for(let F=0;F<c.length;F++){const g=c[F],x=g.nodes.findIndex(w=>w===d.nodes[0]);if(g.nodes=g.nodes.slice(0,x).concat(N.nodes).concat(g.nodes.slice(x+d.nodes.length)),g.nodes.length===0){M(c,F);break}else g.args.element.node=g.nodes[0]}return d.component.afterRender&&d.component.afterRender(p,E(R({},d.args),{previousNode:a})),N}else{let s=B(o.childNodes,n.node);return{nodes:P(o.childNodes,s,s+d.nodes.length)}}}else return{nodes:[]}}else throw new Error("Missing node information in rerender() argument.")}function te(n,e){var t;const o=((t=n.props.xmlns)!=null?t:n.type==="svg")?me:e&&e.namespaceURI;return n.props.is?o?l.document.createElementNS(o,n.type,{is:n.props.is}):l.document.createElement(n.type,{is:n.props.is}):o?l.document.createElementNS(o,n.type):l.document.createElement(n.type)}return{mount:ne,render:oe,rerender:G}}const V=globalThis||window;let v=createForgoInstance({window:V,document:V.document});export function setCustomEnv(r){v=createForgoInstance(r)}export function mount(r,l){return v.mount(r,l)}export function render(r){return v.render(r)}export function rerender(r,l){return v.rerender(r,l)}function S(r){function l(i,C=[]){const T=Array.isArray(i)?i:D(i)?Array.isArray(i.props.children)?i.props.children:i.props.children!==void 0&&i.props.children!==null?[i.props.children]:[]:[i];for(const A of T)Array.isArray(A)||D(A)?l(A,C):C.push(A);return C}return l(r,[])}function $(r){return r.toString()}function L(r){return r!=null&&r.__is_forgo_element__===!0}function ge(r){return L(r)&&typeof r.type=="string"}function D(r){return r!=null&&r.type===Fragment}export function getForgoState(r){return r.__forgo}function H(r){if(r.__forgo)return r.__forgo;throw new Error("Missing forgo state on node.")}export function setForgoState(r,l){r.__forgo=l}function he(r,l){if(!l.render)throw new Error(`${r.name||"Unnamed"} component constructor must return an object having a render() function.`)}function Ne(r){return typeof r=="string"}function Z(r){return r.nodeType===q}function ye(r){return typeof r=="string"?r:r==null?"":Object.keys(r).reduce((l,i)=>l+i.split(/(?=[A-Z])/).join("-").toLowerCase()+":"+r[i]+";","")}function P(r,l,i){const C=[];for(let T=l;T<i;T++)C.push(r[T]);return C}function B(r,l){for(let i=0;i<r.length;i++)if(r[i]===l)return i;return-1}export{}; | ||
//# sourceMappingURL=forgo.min.js.map |
{ | ||
"name": "forgo", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -1531,5 +1531,3 @@ /* | ||
} else { | ||
throw new Error( | ||
`The rerender() function was called on a detached node.` | ||
); | ||
return { nodes: [] }; | ||
} | ||
@@ -1536,0 +1534,0 @@ } else { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
285685
16
4300