@akashjs/runtime 0.1.42 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YN2TQLVA.cjs → chunk-4HAE7H7W.cjs} +2 -2
- package/dist/{chunk-YN2TQLVA.cjs.map → chunk-4HAE7H7W.cjs.map} +1 -1
- package/dist/{chunk-YSVREYEH.cjs → chunk-5EFX654I.cjs} +2 -2
- package/dist/{chunk-YSVREYEH.cjs.map → chunk-5EFX654I.cjs.map} +1 -1
- package/dist/{chunk-NC5RE4IQ.js → chunk-CGKMCVEZ.js} +2 -2
- package/dist/{chunk-NC5RE4IQ.js.map → chunk-CGKMCVEZ.js.map} +1 -1
- package/dist/{chunk-TBCX5WQQ.cjs → chunk-CHF5LH56.cjs} +3 -3
- package/dist/{chunk-TBCX5WQQ.cjs.map → chunk-CHF5LH56.cjs.map} +1 -1
- package/dist/{chunk-CEJF44LZ.js → chunk-DPJ6RJ7A.js} +2 -2
- package/dist/{chunk-CEJF44LZ.js.map → chunk-DPJ6RJ7A.js.map} +1 -1
- package/dist/chunk-DYJUCZXA.js +5 -0
- package/dist/chunk-DYJUCZXA.js.map +1 -0
- package/dist/chunk-EUKRTV4W.js +13 -0
- package/dist/chunk-EUKRTV4W.js.map +1 -0
- package/dist/{chunk-M7HHZMIO.cjs → chunk-P5GADKQS.cjs} +2 -2
- package/dist/{chunk-M7HHZMIO.cjs.map → chunk-P5GADKQS.cjs.map} +1 -1
- package/dist/{chunk-3KIPMVCN.js → chunk-Q5BER4ZB.js} +2 -2
- package/dist/{chunk-3KIPMVCN.js.map → chunk-Q5BER4ZB.js.map} +1 -1
- package/dist/chunk-QDCIW4YE.cjs +5 -0
- package/dist/chunk-QDCIW4YE.cjs.map +1 -0
- package/dist/{chunk-CO4D6JTQ.cjs → chunk-R3W5W647.cjs} +2 -2
- package/dist/{chunk-CO4D6JTQ.cjs.map → chunk-R3W5W647.cjs.map} +1 -1
- package/dist/{chunk-42ZHET2G.js → chunk-SRPWGLOQ.js} +2 -2
- package/dist/{chunk-42ZHET2G.js.map → chunk-SRPWGLOQ.js.map} +1 -1
- package/dist/chunk-V7VG23IO.cjs +13 -0
- package/dist/chunk-V7VG23IO.cjs.map +1 -0
- package/dist/{chunk-WG5GKD3B.js → chunk-VFOAULHK.js} +3 -3
- package/dist/{chunk-WG5GKD3B.js.map → chunk-VFOAULHK.js.map} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/machine.cjs +1 -1
- package/dist/machine.js +1 -1
- package/dist/offline.cjs +1 -1
- package/dist/offline.js +1 -1
- package/dist/pwa.cjs +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssr.cjs +1 -1
- package/dist/ssr.js +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.js +1 -1
- package/dist/sync.cjs +1 -1
- package/dist/sync.js +1 -1
- package/dist/test.cjs +2 -2
- package/dist/test.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-367DJVST.js +0 -5
- package/dist/chunk-367DJVST.js.map +0 -1
- package/dist/chunk-RTJ6UDGV.cjs +0 -13
- package/dist/chunk-RTJ6UDGV.cjs.map +0 -1
- package/dist/chunk-TWA4T6PX.js +0 -13
- package/dist/chunk-TWA4T6PX.js.map +0 -1
- package/dist/chunk-YIVBLM2A.cjs +0 -5
- package/dist/chunk-YIVBLM2A.cjs.map +0 -1
package/dist/machine.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk5EFX654I_cjs=require('./chunk-5EFX654I.cjs');require('./chunk-V7VG23IO.cjs');Object.defineProperty(exports,"createMachine",{enumerable:true,get:function(){return chunk5EFX654I_cjs.a}});//# sourceMappingURL=machine.cjs.map
|
|
2
2
|
//# sourceMappingURL=machine.cjs.map
|
package/dist/machine.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as createMachine}from'./chunk-
|
|
1
|
+
export{a as createMachine}from'./chunk-SRPWGLOQ.js';import'./chunk-EUKRTV4W.js';//# sourceMappingURL=machine.js.map
|
|
2
2
|
//# sourceMappingURL=machine.js.map
|
package/dist/offline.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkR3W5W647_cjs=require('./chunk-R3W5W647.cjs');require('./chunk-V7VG23IO.cjs');Object.defineProperty(exports,"createOfflineStore",{enumerable:true,get:function(){return chunkR3W5W647_cjs.a}});//# sourceMappingURL=offline.cjs.map
|
|
2
2
|
//# sourceMappingURL=offline.cjs.map
|
package/dist/offline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as createOfflineStore}from'./chunk-
|
|
1
|
+
export{a as createOfflineStore}from'./chunk-CGKMCVEZ.js';import'./chunk-EUKRTV4W.js';//# sourceMappingURL=offline.js.map
|
|
2
2
|
//# sourceMappingURL=offline.js.map
|
package/dist/pwa.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCHF5LH56_cjs=require('./chunk-CHF5LH56.cjs');require('./chunk-V7VG23IO.cjs');Object.defineProperty(exports,"generateSWScript",{enumerable:true,get:function(){return chunkCHF5LH56_cjs.b}});Object.defineProperty(exports,"registerServiceWorker",{enumerable:true,get:function(){return chunkCHF5LH56_cjs.a}});Object.defineProperty(exports,"subscribePush",{enumerable:true,get:function(){return chunkCHF5LH56_cjs.c}});//# sourceMappingURL=pwa.cjs.map
|
|
2
2
|
//# sourceMappingURL=pwa.cjs.map
|
package/dist/pwa.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as generateSWScript,a as registerServiceWorker,c as subscribePush}from'./chunk-
|
|
1
|
+
export{b as generateSWScript,a as registerServiceWorker,c as subscribePush}from'./chunk-VFOAULHK.js';import'./chunk-EUKRTV4W.js';//# sourceMappingURL=pwa.js.map
|
|
2
2
|
//# sourceMappingURL=pwa.js.map
|
package/dist/ssr.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkUOD4PYAN_cjs=require('./chunk-UOD4PYAN.cjs');require('./chunk-
|
|
1
|
+
'use strict';var chunkUOD4PYAN_cjs=require('./chunk-UOD4PYAN.cjs');require('./chunk-V7VG23IO.cjs');Object.defineProperty(exports,"escapeHtml",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.a}});Object.defineProperty(exports,"isServerRendering",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.b}});Object.defineProperty(exports,"nodeToHtml",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.i}});Object.defineProperty(exports,"renderNodes",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.j}});Object.defineProperty(exports,"renderToStream",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.e}});Object.defineProperty(exports,"renderToString",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.c}});Object.defineProperty(exports,"renderToStringSync",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.d}});Object.defineProperty(exports,"ssrElement",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.f}});Object.defineProperty(exports,"ssrRaw",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.h}});Object.defineProperty(exports,"ssrText",{enumerable:true,get:function(){return chunkUOD4PYAN_cjs.g}});//# sourceMappingURL=ssr.cjs.map
|
|
2
2
|
//# sourceMappingURL=ssr.cjs.map
|
package/dist/ssr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as escapeHtml,b as isServerRendering,i as nodeToHtml,j as renderNodes,e as renderToStream,c as renderToString,d as renderToStringSync,f as ssrElement,h as ssrRaw,g as ssrText}from'./chunk-QTPP343X.js';import'./chunk-
|
|
1
|
+
export{a as escapeHtml,b as isServerRendering,i as nodeToHtml,j as renderNodes,e as renderToStream,c as renderToString,d as renderToStringSync,f as ssrElement,h as ssrRaw,g as ssrText}from'./chunk-QTPP343X.js';import'./chunk-EUKRTV4W.js';//# sourceMappingURL=ssr.js.map
|
|
2
2
|
//# sourceMappingURL=ssr.js.map
|
package/dist/store.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkP5GADKQS_cjs=require('./chunk-P5GADKQS.cjs');require('./chunk-V7VG23IO.cjs');Object.defineProperty(exports,"__getStoreInstances",{enumerable:true,get:function(){return chunkP5GADKQS_cjs.d}});Object.defineProperty(exports,"clearStores",{enumerable:true,get:function(){return chunkP5GADKQS_cjs.c}});Object.defineProperty(exports,"configureStores",{enumerable:true,get:function(){return chunkP5GADKQS_cjs.a}});Object.defineProperty(exports,"defineStore",{enumerable:true,get:function(){return chunkP5GADKQS_cjs.b}});//# sourceMappingURL=store.cjs.map
|
|
2
2
|
//# sourceMappingURL=store.cjs.map
|
package/dist/store.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{d as __getStoreInstances,c as clearStores,a as configureStores,b as defineStore}from'./chunk-
|
|
1
|
+
export{d as __getStoreInstances,c as clearStores,a as configureStores,b as defineStore}from'./chunk-Q5BER4ZB.js';import'./chunk-EUKRTV4W.js';//# sourceMappingURL=store.js.map
|
|
2
2
|
//# sourceMappingURL=store.js.map
|
package/dist/sync.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4HAE7H7W_cjs=require('./chunk-4HAE7H7W.cjs');require('./chunk-V7VG23IO.cjs');Object.defineProperty(exports,"LWWRegister",{enumerable:true,get:function(){return chunk4HAE7H7W_cjs.a}});Object.defineProperty(exports,"createLocalTransport",{enumerable:true,get:function(){return chunk4HAE7H7W_cjs.c}});Object.defineProperty(exports,"createSync",{enumerable:true,get:function(){return chunk4HAE7H7W_cjs.d}});Object.defineProperty(exports,"createWebSocketTransport",{enumerable:true,get:function(){return chunk4HAE7H7W_cjs.b}});//# sourceMappingURL=sync.cjs.map
|
|
2
2
|
//# sourceMappingURL=sync.cjs.map
|
package/dist/sync.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as LWWRegister,c as createLocalTransport,d as createSync,b as createWebSocketTransport}from'./chunk-
|
|
1
|
+
export{a as LWWRegister,c as createLocalTransport,d as createSync,b as createWebSocketTransport}from'./chunk-DPJ6RJ7A.js';import'./chunk-EUKRTV4W.js';//# sourceMappingURL=sync.js.map
|
|
2
2
|
//# sourceMappingURL=sync.js.map
|
package/dist/test.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkQDCIW4YE_cjs=require('./chunk-QDCIW4YE.cjs'),chunkV7VG23IO_cjs=require('./chunk-V7VG23IO.cjs');function H(t,n){let e=document.createElement("div");e.setAttribute("data-akash-test-root","");let i=n?.props??{},r=n?.provide,s;return r&&r.size>0?s=chunkQDCIW4YE_cjs.B(()=>{for(let[l,d]of r)chunkQDCIW4YE_cjs.h(l,d);return ()=>t(i)})({}):s=t(i),e.appendChild(s),document.body.appendChild(e),{container:e,unmount(){e.remove();},getByText(o){let l=T(e,o);if(!l)throw new Error(`[AkashJS Test] Could not find element with text: "${o}"
|
|
2
2
|
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},getByRole(o){let l=e.querySelector(`[role="${o}"]`)??f(e,o);if(!l)throw new Error(`[AkashJS Test] Could not find element with role: "${o}"
|
|
3
3
|
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},getByTestId(o){let l=e.querySelector(`[data-testid="${o}"]`);if(!l)throw new Error(`[AkashJS Test] Could not find element with data-testid: "${o}"
|
|
4
|
-
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},queryAll(o){return Array.from(e.querySelectorAll(o))},query(o){return e.querySelector(o)}}}var L={async click(t){t.dispatchEvent(new MouseEvent("click",{bubbles:true,cancelable:true})),await a();},async input(t,n){let e=Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;e?e.call(t,n):t.value=n,t.dispatchEvent(new Event("input",{bubbles:true})),t.dispatchEvent(new Event("change",{bubbles:true})),await a();},async submit(t){t.dispatchEvent(new Event("submit",{bubbles:true,cancelable:true})),await a();},async focus(t){t.focus(),t.dispatchEvent(new FocusEvent("focus",{bubbles:true})),await a();},async blur(t){t.blur(),t.dispatchEvent(new FocusEvent("blur",{bubbles:true})),await a();},async keyDown(t,n,e){t.dispatchEvent(new KeyboardEvent("keydown",{key:n,bubbles:true,...e})),await a();},async keyUp(t,n,e){t.dispatchEvent(new KeyboardEvent("keyup",{key:n,bubbles:true,...e})),await a();}};function a(){return new Promise(t=>queueMicrotask(t))}function T(t,n){let e=null,i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=i.nextNode();for(;r;)r instanceof HTMLElement&&r.textContent?.includes(n)&&(e=r),r=i.nextNode();return !e&&t.textContent?.includes(n)&&(e=t),e}var E={button:["button"],a:["link"],input:["textbox","checkbox","radio","spinbutton","slider"],select:["combobox","listbox"],textarea:["textbox"],img:["img"],form:["form"],nav:["navigation"],main:["main"],header:["banner"],footer:["contentinfo"],aside:["complementary"],section:["region"],article:["article"],ul:["list"],ol:["list"],li:["listitem"],table:["table"],th:["columnheader"],td:["cell"],h1:["heading"],h2:["heading"],h3:["heading"],h4:["heading"],h5:["heading"],h6:["heading"]};function f(t,n){let e=[];for(let[r,s]of Object.entries(E))s.includes(n)&&e.push(r);if(e.length===0)return null;let i=e.join(", ");return t.querySelector(i)}async function y(t,n){let{timeout:e=1e3,interval:i=50}=n??{},r=Date.now();for(;;)try{await t();return}catch(s){if(Date.now()-r>=e)throw s;await new Promise(o=>setTimeout(o,i));}}async function w(t,n,e){let i=null;return await y(()=>{if(i=t.querySelector(n),!i)throw new Error(`Element "${n}" not found`)},e),i}function v(t){let n=
|
|
4
|
+
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},queryAll(o){return Array.from(e.querySelectorAll(o))},query(o){return e.querySelector(o)}}}var L={async click(t){t.dispatchEvent(new MouseEvent("click",{bubbles:true,cancelable:true})),await a();},async input(t,n){let e=Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;e?e.call(t,n):t.value=n,t.dispatchEvent(new Event("input",{bubbles:true})),t.dispatchEvent(new Event("change",{bubbles:true})),await a();},async submit(t){t.dispatchEvent(new Event("submit",{bubbles:true,cancelable:true})),await a();},async focus(t){t.focus(),t.dispatchEvent(new FocusEvent("focus",{bubbles:true})),await a();},async blur(t){t.blur(),t.dispatchEvent(new FocusEvent("blur",{bubbles:true})),await a();},async keyDown(t,n,e){t.dispatchEvent(new KeyboardEvent("keydown",{key:n,bubbles:true,...e})),await a();},async keyUp(t,n,e){t.dispatchEvent(new KeyboardEvent("keyup",{key:n,bubbles:true,...e})),await a();}};function a(){return new Promise(t=>queueMicrotask(t))}function T(t,n){let e=null,i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=i.nextNode();for(;r;)r instanceof HTMLElement&&r.textContent?.includes(n)&&(e=r),r=i.nextNode();return !e&&t.textContent?.includes(n)&&(e=t),e}var E={button:["button"],a:["link"],input:["textbox","checkbox","radio","spinbutton","slider"],select:["combobox","listbox"],textarea:["textbox"],img:["img"],form:["form"],nav:["navigation"],main:["main"],header:["banner"],footer:["contentinfo"],aside:["complementary"],section:["region"],article:["article"],ul:["list"],ol:["list"],li:["listitem"],table:["table"],th:["columnheader"],td:["cell"],h1:["heading"],h2:["heading"],h3:["heading"],h4:["heading"],h5:["heading"],h6:["heading"]};function f(t,n){let e=[];for(let[r,s]of Object.entries(E))s.includes(n)&&e.push(r);if(e.length===0)return null;let i=e.join(", ");return t.querySelector(i)}async function y(t,n){let{timeout:e=1e3,interval:i=50}=n??{},r=Date.now();for(;;)try{await t();return}catch(s){if(Date.now()-r>=e)throw s;await new Promise(o=>setTimeout(o,i));}}async function w(t,n,e){let i=null;return await y(()=>{if(i=t.querySelector(n),!i)throw new Error(`Element "${n}" not found`)},e),i}function v(t){let n=chunkV7VG23IO_cjs.l(t),e=[t],i=0,r=(()=>n());return r.set=s=>{n.set(s),e.push(s),i++;},r.update=s=>{let o=s(n.peek());r.set(o);},r.peek=()=>n.peek(),Object.defineProperty(r,"history",{get:()=>[...e]}),Object.defineProperty(r,"setCount",{get:()=>i}),r.resetHistory=()=>{e.length=0,e.push(n.peek()),i=0;},r}Object.defineProperty(exports,"flush",{enumerable:true,get:function(){return chunkV7VG23IO_cjs.b}});exports.createTestSignal=v;exports.fireEvent=L;exports.mount=H;exports.waitFor=y;exports.waitForElement=w;//# sourceMappingURL=test.cjs.map
|
|
5
5
|
//# sourceMappingURL=test.cjs.map
|
package/dist/test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {B,h}from'./chunk-
|
|
1
|
+
import {B,h}from'./chunk-DYJUCZXA.js';import {l}from'./chunk-EUKRTV4W.js';export{b as flush}from'./chunk-EUKRTV4W.js';function H(t,n){let e=document.createElement("div");e.setAttribute("data-akash-test-root","");let i=n?.props??{},r=n?.provide,s;return r&&r.size>0?s=B(()=>{for(let[l,d]of r)h(l,d);return ()=>t(i)})({}):s=t(i),e.appendChild(s),document.body.appendChild(e),{container:e,unmount(){e.remove();},getByText(o){let l=T(e,o);if(!l)throw new Error(`[AkashJS Test] Could not find element with text: "${o}"
|
|
2
2
|
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},getByRole(o){let l=e.querySelector(`[role="${o}"]`)??f(e,o);if(!l)throw new Error(`[AkashJS Test] Could not find element with role: "${o}"
|
|
3
3
|
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},getByTestId(o){let l=e.querySelector(`[data-testid="${o}"]`);if(!l)throw new Error(`[AkashJS Test] Could not find element with data-testid: "${o}"
|
|
4
4
|
Container HTML: ${e.innerHTML.slice(0,200)}`);return l},queryAll(o){return Array.from(e.querySelectorAll(o))},query(o){return e.querySelector(o)}}}var L={async click(t){t.dispatchEvent(new MouseEvent("click",{bubbles:true,cancelable:true})),await a();},async input(t,n){let e=Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;e?e.call(t,n):t.value=n,t.dispatchEvent(new Event("input",{bubbles:true})),t.dispatchEvent(new Event("change",{bubbles:true})),await a();},async submit(t){t.dispatchEvent(new Event("submit",{bubbles:true,cancelable:true})),await a();},async focus(t){t.focus(),t.dispatchEvent(new FocusEvent("focus",{bubbles:true})),await a();},async blur(t){t.blur(),t.dispatchEvent(new FocusEvent("blur",{bubbles:true})),await a();},async keyDown(t,n,e){t.dispatchEvent(new KeyboardEvent("keydown",{key:n,bubbles:true,...e})),await a();},async keyUp(t,n,e){t.dispatchEvent(new KeyboardEvent("keyup",{key:n,bubbles:true,...e})),await a();}};function a(){return new Promise(t=>queueMicrotask(t))}function T(t,n){let e=null,i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),r=i.nextNode();for(;r;)r instanceof HTMLElement&&r.textContent?.includes(n)&&(e=r),r=i.nextNode();return !e&&t.textContent?.includes(n)&&(e=t),e}var E={button:["button"],a:["link"],input:["textbox","checkbox","radio","spinbutton","slider"],select:["combobox","listbox"],textarea:["textbox"],img:["img"],form:["form"],nav:["navigation"],main:["main"],header:["banner"],footer:["contentinfo"],aside:["complementary"],section:["region"],article:["article"],ul:["list"],ol:["list"],li:["listitem"],table:["table"],th:["columnheader"],td:["cell"],h1:["heading"],h2:["heading"],h3:["heading"],h4:["heading"],h5:["heading"],h6:["heading"]};function f(t,n){let e=[];for(let[r,s]of Object.entries(E))s.includes(n)&&e.push(r);if(e.length===0)return null;let i=e.join(", ");return t.querySelector(i)}async function y(t,n){let{timeout:e=1e3,interval:i=50}=n??{},r=Date.now();for(;;)try{await t();return}catch(s){if(Date.now()-r>=e)throw s;await new Promise(o=>setTimeout(o,i));}}async function w(t,n,e){let i=null;return await y(()=>{if(i=t.querySelector(n),!i)throw new Error(`Element "${n}" not found`)},e),i}function v(t){let n=l(t),e=[t],i=0,r=(()=>n());return r.set=s=>{n.set(s),e.push(s),i++;},r.update=s=>{let o=s(n.peek());r.set(o);},r.peek=()=>n.peek(),Object.defineProperty(r,"history",{get:()=>[...e]}),Object.defineProperty(r,"setCount",{get:()=>i}),r.resetHistory=()=>{e.length=0,e.push(n.peek()),i=0;},r}export{v as createTestSignal,L as fireEvent,H as mount,y as waitFor,w as waitForElement};//# sourceMappingURL=test.js.map
|
package/package.json
CHANGED
package/dist/chunk-367DJVST.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {n}from'./chunk-TWA4T6PX.js';var v={AK0010:{code:"AK0010",message:"provide() called outside of component setup.",hint:"provide() must be called inside defineComponent()."},AK0012:{code:"AK0012",message:"inject() called outside of component setup.",hint:"inject() must be called inside defineComponent()."},AK0013:{code:"AK0013",message:"No provider found for injected context.",hint:"Make sure an ancestor component calls provide() with this key."},AK0020:{code:"AK0020",message:"onMount() called outside of component setup.",hint:"onMount() must be called inside defineComponent()."},AK0021:{code:"AK0021",message:"onUnmount() called outside of component setup.",hint:"onUnmount() must be called inside defineComponent()."},AK0022:{code:"AK0022",message:"onError() called outside of component setup.",hint:"onError() must be called inside defineComponent()."},AK0030:{code:"AK0030",message:"Circular dependency detected in computed signal.",hint:"A computed signal is reading itself, directly or via other computeds."},AK0031:{code:"AK0031",message:"Signal set() called during computation.",hint:"Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers."},AK0040:{code:"AK0040",message:"Component setup must return a render function.",hint:"The function passed to defineComponent() must return () => AkashNode."},AK0041:{code:"AK0041",message:"Required prop is missing.",hint:"Check that the parent component is passing all required props."},AK0050:{code:"AK0050",message:"useRoute() called outside of router context.",hint:"Make sure your component is rendered inside a router provider."},AK0051:{code:"AK0051",message:"No route matched the current URL.",hint:"Add a catch-all route ([...rest]) to handle unmatched paths."},AK0052:{code:"AK0052",message:"Route guard threw an error.",hint:"Check the guard function for unhandled exceptions."},AK0060:{code:"AK0060",message:"Form submitted while invalid.",hint:"The submit handler was not called because validation failed. Check form.errors()."},AK0061:{code:"AK0061",message:"Async validator timed out.",hint:"The async validator did not resolve within the expected time. Check your async validation logic."},AK0070:{code:"AK0070",message:"HTTP request failed.",hint:"Check the server response status and network connectivity."},AK0071:{code:"AK0071",message:"createResource() fetcher threw an error.",hint:"Check the fetcher function passed to createResource()."}},P="https://akashjs.dev/errors";function L(e,n){let t=v[e];if(!t)return `[AkashJS ${e}] Unknown error code.`;let o=`[AkashJS ${e}] ${t.message}`;return n&&(o+=`
|
|
2
|
-
${n}`),o+=`
|
|
3
|
-
${t.hint}`,o+=`
|
|
4
|
-
See: ${P}/${e}`,o}function g(e,n){return new Error(L(e,n))}function D(e){return v[e]}function F(){return Object.keys(v)}var M=Symbol("akash.context"),p=null;function S(e=p){let n={values:new Map,parent:e};return p=n,n}function w(e){p=e.parent;}function C(){return p}function K(e,n){let t=p;p=e;try{return n()}finally{p=t;}}function I(e){return {[M]:true,_type:void 0,defaultValue:e,id:Symbol("context")}}function B(e,n){if(!p)throw g("AK0010");p.values.set(e.id,n);}function O(e,n){if(!p)throw g("AK0012");let t=p;for(;t;){if(t.values.has(e.id))return t.values.get(e.id);t=t.parent;}if(n!==void 0)return n;if(e.defaultValue!==void 0)return e.defaultValue;throw g("AK0013")}function q(e,n){let t=document.createElement(e);if(n)for(let[o,a]of Object.entries(n))E(t,o,a);return t}function J(e){return document.createTextNode(e)}function W(e){let n=document.createElement("template");return n.innerHTML=e,n.content.cloneNode(true)}function E(e,n,t){if(n==="class"||n==="className")e.className=t;else if(n==="style"&&typeof t=="object"&&t!==null)Object.assign(e.style,t);else if(n==="innerHTML")e.innerHTML=t;else if(n!=="ref")if(n.startsWith("on")){let o=n.slice(2).toLowerCase();e.addEventListener(o,t);}else n in e?e[n]=t:t===false||t==null?e.removeAttribute(n):e.setAttribute(n,t===true?"":String(t));}function X(e,n$1){return n(()=>{e.textContent=String(n$1());},{render:true})}function z(e,n$1,t){return n(()=>{E(e,n$1,t());},{render:true})}function G(e,n$1){return n(()=>{e.style.display=n$1()?"":"none";},{render:true})}function b(e=""){return document.createComment(e)}function R(e,n$1,t,o,a){let s=null,A=C(),N=n(()=>{let i=t();if(s){for(let l of s.nodes)try{l.parentNode?.removeChild(l);}catch{}s.dispose?.(),s=null;}let d=i?o:a,h=n$1.parentNode;if(d&&h){let l=A?K(A,d):d(),r=l instanceof DocumentFragment?Array.from(l.childNodes):[l];for(let c of r)h.insertBefore(c,n$1);s={nodes:r,dispose:null};}},{render:true});return ()=>{if(N(),s){for(let i of s.nodes)try{i.parentNode?.removeChild(i);}catch{}s.dispose?.();}}}function j(e,n$1,t,o,a){let s=[],A=C(),N=n(()=>{let i=t(),d=[],h=new Map;for(let r of s)h.set(r.key,r);for(let r=0;r<i.length;r++){let c=i[r],u=o(c,r),f=h.get(u);if(f)h.delete(u),f.value=c,d.push(f);else {let T=A?K(A,()=>a(c,r)):a(c,r),y=T instanceof DocumentFragment?Array.from(T.childNodes):[T];d.push({key:u,value:c,nodes:y,dispose:null});}}for(let r of h.values()){for(let c of r.nodes)c.parentNode&&c.parentNode.removeChild(c);r.dispose?.();}let l=n$1.parentNode;if(l)for(let r of d)for(let c of r.nodes)l.insertBefore(c,n$1);s=d;},{render:true});return ()=>{N();for(let i of s){for(let d of i.nodes)d.parentNode&&d.parentNode.removeChild(d);i.dispose?.();}s=[];}}function Q(e){let n=b("show"),t=document.createDocumentFragment();t.appendChild(n);let o=typeof e.when=="function"?e.when:()=>e.when,a;return R(t,n,()=>(a=o(),!!a),()=>x(e.children(a)),e.fallback?()=>x(e.fallback()):void 0),t}function Y(e){let n=b("for"),t=document.createDocumentFragment();t.appendChild(n);let o=typeof e.each=="function"?e.each:()=>e.each;return j(t,n,o,e.key,(a,s)=>x(e.children(a,s))),t}function x(e){if(e==null||typeof e=="boolean")return document.createTextNode("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(e instanceof Node)return e;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let t of e)n.appendChild(x(t));return n}return document.createTextNode(String(e))}function Z(e,n,t){let o=x(n);t?e.insertBefore(o,t):e.appendChild(o);}function re(e){return e.__reactive=true,e}var m=null;function ie(e){if(!m)throw g("AK0020");m.mount.push(e);}function se(e){if(!m)throw g("AK0021");m.unmount.push(e);}function ce(e){if(!m)throw g("AK0022");m.error.push(e);}function de(){return {current:void 0}}function ae(e){let n=t=>{let{children:o,...a}=t??{},N={props:new Proxy(a,{get(u,f,T){let y=Reflect.get(u,f,T);return typeof y=="function"&&y.__reactive?y():y}}),children:typeof o=="function"?o:()=>o??null},i={mount:[],unmount:[],error:[]},d=m;m=i;let h=C(),l=S(h),r,c;try{if(r=e(N),typeof r!="function")throw g("AK0040");let u=r();c=x(u);}catch(u){if(w(l),m=d,i.error.length>0){for(let f of i.error)f(u instanceof Error?u:new Error(String(u)));return document.createComment("error")}throw u}return w(l),m=d,i.mount.length>0&&queueMicrotask(()=>{for(let u of i.mount)try{let f=u();typeof f=="function"&&i.unmount.push(f);}catch(f){for(let T of i.error)T(f instanceof Error?f:new Error(String(f)));}}),c};return n._akash=true,n}export{de as A,ae as B,L as a,g as b,D as c,F as d,C as e,K as f,I as g,B as h,O as i,q as j,J as k,W as l,E as m,X as n,z as o,G as p,R as q,j as r,Q as s,Y as t,x as u,Z as v,re as w,ie as x,se as y,ce as z};//# sourceMappingURL=chunk-367DJVST.js.map
|
|
5
|
-
//# sourceMappingURL=chunk-367DJVST.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/context.ts","../src/dom.ts","../src/component.ts"],"names":["errors","DOC_BASE","formatError","code","context","def","msg","akashError","getErrorDef","getAllErrorCodes","CONTEXT_BRAND","currentScope","pushScope","parent","scope","popScope","getCurrentScope","runInScope","fn","prev","createContext","defaultValue","provide","key","value","inject","fallback","createElement","tag","attrs","el","setProperty","createText","cloneTemplate","html","template","event","bindText","node","effect","bindProperty","bindVisible","createAnchor","label","renderConditional","anchor","condition","trueBranch","falseBranch","current","dispose","branch","liveParent","fragment","nodes","renderList","items","keyFn","renderItem","currentItems","newData","newItems","oldMap","item","i","data","existing","Show","props","container","getWhen","whenValue","nodeToDOM","For","getEach","index","child","insert","domNode","__getter","currentHooks","onMount","onUnmount","onError","ref","defineComponent","setup","component","rawProps","childrenProp","restProps","ctx","target","receiver","val","hooks","prevHooks","parentScope","renderFn","rendered","err","handler","mountFn","cleanup"],"mappings":"oCAqBA,IAAMA,EAAmC,CAEvC,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,8CAAA,CACT,IAAA,CAAM,oDACR,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,6CAAA,CACT,IAAA,CAAM,mDACR,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,yCAAA,CACT,IAAA,CAAM,gEACR,CAAA,CAGA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,8CAAA,CACT,IAAA,CAAM,oDACR,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,gDAAA,CACT,IAAA,CAAM,sDACR,CAAA,CACA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,8CAAA,CACT,KAAM,oDACR,CAAA,CAGA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,kDAAA,CACT,KAAM,uEACR,CAAA,CACA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,yCAAA,CACT,KAAM,gHACR,CAAA,CAGA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,gDAAA,CACT,KAAM,uEACR,CAAA,CACA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAA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,IAAWN,CAAAA,CAAM,KAAA,CAC1BM,CAAAA,CAAQD,aAAe,KAAA,CAAQA,CAAAA,CAAM,IAAI,KAAA,CAAM,MAAA,CAAOA,CAAG,CAAC,CAAC,EAE7D,OAAO,QAAA,CAAS,aAAA,CAAc,OAAO,CACvC,CACA,MAAMA,CACR,CAGA,OAAArF,CAAAA,CAASD,CAAK,CAAA,CACdkE,CAAAA,CAAegB,CAAAA,CAGXD,CAAAA,CAAM,KAAA,CAAM,MAAA,CAAS,GACvB,cAAA,CAAe,IAAM,CACnB,IAAA,IAAWO,KAAWP,CAAAA,CAAM,KAAA,CAC1B,GAAI,CACF,IAAMQ,CAAAA,CAAUD,CAAAA,EAAQ,CACpB,OAAOC,CAAAA,EAAY,UAAA,EACrBR,CAAAA,CAAM,OAAA,CAAQ,KAAKQ,CAAO,EAE9B,CAAA,MAASH,CAAAA,CAAK,CACZ,IAAA,IAAWC,CAAAA,IAAWN,CAAAA,CAAM,KAAA,CAC1BM,EAAQD,CAAAA,YAAe,KAAA,CAAQA,CAAAA,CAAM,IAAI,KAAA,CAAM,MAAA,CAAOA,CAAG,CAAC,CAAC,EAE/D,CAEJ,CAAC,CAAA,CAGItB,CACT,CAAA,CAEA,OAAAS,CAAAA,CAAU,MAAA,CAAS,KACZA,CACT","file":"chunk-367DJVST.js","sourcesContent":["/**\n * Error message catalog.\n *\n * Every AkashJS runtime error has a unique code (AK0001, AK0002, etc.),\n * a one-line description, and a link to detailed documentation.\n *\n * Usage:\n * throw akashError('AK0010', 'provide()');\n */\n\n// --- Error registry ---\n\nexport interface ErrorDef {\n /** Error code */\n code: string;\n /** Short description */\n message: string;\n /** Extended explanation and fix suggestion */\n hint: string;\n}\n\nconst errors: Record<string, ErrorDef> = {\n // --- Context errors (AK001x) ---\n AK0010: {\n code: 'AK0010',\n message: 'provide() called outside of component setup.',\n hint: 'provide() must be called inside defineComponent().',\n },\n AK0012: {\n code: 'AK0012',\n message: 'inject() called outside of component setup.',\n hint: 'inject() must be called inside defineComponent().',\n },\n AK0013: {\n code: 'AK0013',\n message: 'No provider found for injected context.',\n hint: 'Make sure an ancestor component calls provide() with this key.',\n },\n\n // --- Lifecycle errors (AK002x) ---\n AK0020: {\n code: 'AK0020',\n message: 'onMount() called outside of component setup.',\n hint: 'onMount() must be called inside defineComponent().',\n },\n AK0021: {\n code: 'AK0021',\n message: 'onUnmount() called outside of component setup.',\n hint: 'onUnmount() must be called inside defineComponent().',\n },\n AK0022: {\n code: 'AK0022',\n message: 'onError() called outside of component setup.',\n hint: 'onError() must be called inside defineComponent().',\n },\n\n // --- Signal errors (AK003x) ---\n AK0030: {\n code: 'AK0030',\n message: 'Circular dependency detected in computed signal.',\n hint: 'A computed signal is reading itself, directly or via other computeds.',\n },\n AK0031: {\n code: 'AK0031',\n message: 'Signal set() called during computation.',\n hint: 'Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers.',\n },\n\n // --- Component errors (AK004x) ---\n AK0040: {\n code: 'AK0040',\n message: 'Component setup must return a render function.',\n hint: 'The function passed to defineComponent() must return () => AkashNode.',\n },\n AK0041: {\n code: 'AK0041',\n message: 'Required prop is missing.',\n hint: 'Check that the parent component is passing all required props.',\n },\n\n // --- Router errors (AK005x) ---\n AK0050: {\n code: 'AK0050',\n message: 'useRoute() called outside of router context.',\n hint: 'Make sure your component is rendered inside a router provider.',\n },\n AK0051: {\n code: 'AK0051',\n message: 'No route matched the current URL.',\n hint: 'Add a catch-all route ([...rest]) to handle unmatched paths.',\n },\n AK0052: {\n code: 'AK0052',\n message: 'Route guard threw an error.',\n hint: 'Check the guard function for unhandled exceptions.',\n },\n\n // --- Form errors (AK006x) ---\n AK0060: {\n code: 'AK0060',\n message: 'Form submitted while invalid.',\n hint: 'The submit handler was not called because validation failed. Check form.errors().',\n },\n AK0061: {\n code: 'AK0061',\n message: 'Async validator timed out.',\n hint: 'The async validator did not resolve within the expected time. Check your async validation logic.',\n },\n\n // --- HTTP errors (AK007x) ---\n AK0070: {\n code: 'AK0070',\n message: 'HTTP request failed.',\n hint: 'Check the server response status and network connectivity.',\n },\n AK0071: {\n code: 'AK0071',\n message: 'createResource() fetcher threw an error.',\n hint: 'Check the fetcher function passed to createResource().',\n },\n};\n\n// --- Public API ---\n\nconst DOC_BASE = 'https://akashjs.dev/errors';\n\n/**\n * Format an AkashJS error with code, message, hint, and doc link.\n */\nexport function formatError(code: string, context?: string): string {\n const def = errors[code];\n if (!def) {\n return `[AkashJS ${code}] Unknown error code.`;\n }\n\n let msg = `[AkashJS ${code}] ${def.message}`;\n if (context) {\n msg += `\\n ${context}`;\n }\n msg += `\\n ${def.hint}`;\n msg += `\\n See: ${DOC_BASE}/${code}`;\n return msg;\n}\n\n/**\n * Create and throw an AkashJS error.\n */\nexport function akashError(code: string, context?: string): Error {\n return new Error(formatError(code, context));\n}\n\n/**\n * Get the error definition for a code.\n */\nexport function getErrorDef(code: string): ErrorDef | undefined {\n return errors[code];\n}\n\n/**\n * Get all registered error codes.\n */\nexport function getAllErrorCodes(): string[] {\n return Object.keys(errors);\n}\n","/**\n * Lightweight dependency injection via provide/inject.\n *\n * Context is scoped to the component tree — no injector hierarchy,\n * no decorators, no classes. Just createContext(), provide(), inject().\n */\n\n// --- Types ---\n\nimport { akashError } from './errors.js';\n\nconst CONTEXT_BRAND = Symbol('akash.context');\n\nexport interface InjectionKey<T> {\n readonly [CONTEXT_BRAND]: true;\n readonly _type: T; // phantom type — never used at runtime\n readonly defaultValue: T | undefined;\n readonly id: symbol;\n}\n\n// --- Context stack (managed by component system) ---\n\ninterface ContextScope {\n values: Map<symbol, unknown>;\n parent: ContextScope | null;\n}\n\nlet currentScope: ContextScope | null = null;\n\n/** @internal — called by defineComponent to push/pop context scopes */\nexport function pushScope(parent: ContextScope | null = currentScope): ContextScope {\n const scope: ContextScope = { values: new Map(), parent };\n currentScope = scope;\n return scope;\n}\n\n/** @internal */\nexport function popScope(scope: ContextScope): void {\n currentScope = scope.parent;\n}\n\n/** @internal */\nexport function getCurrentScope(): ContextScope | null {\n return currentScope;\n}\n\n/**\n * Run a function within a given scope so that provide/inject\n * work correctly for components created asynchronously\n * (e.g., lazy-loaded route components).\n */\nexport function runInScope<T>(scope: ContextScope, fn: () => T): T {\n const prev = currentScope;\n currentScope = scope;\n try {\n return fn();\n } finally {\n currentScope = prev;\n }\n}\n\n// --- Public API ---\n\n/**\n * Create a typed context key with an optional default value.\n *\n * ```ts\n * const ThemeContext = createContext<'light' | 'dark'>('light');\n * ```\n */\nexport function createContext<T>(defaultValue?: T): InjectionKey<T> {\n return {\n [CONTEXT_BRAND]: true,\n _type: undefined as T,\n defaultValue,\n id: Symbol('context'),\n };\n}\n\n/**\n * Provide a value for a context key in the current component scope.\n * All descendant components can inject() this value.\n *\n * Must be called inside defineComponent() setup.\n */\nexport function provide<T>(key: InjectionKey<T>, value: T): void {\n if (!currentScope) {\n throw akashError('AK0010');\n }\n currentScope.values.set(key.id, value);\n}\n\n/**\n * Inject a value from the nearest ancestor that provided it.\n *\n * Must be called inside defineComponent() setup.\n */\nexport function inject<T>(key: InjectionKey<T>): T;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, fallback?: T): T {\n if (!currentScope) {\n throw akashError('AK0012');\n }\n\n // Walk up the scope chain\n let scope: ContextScope | null = currentScope;\n while (scope) {\n if (scope.values.has(key.id)) {\n return scope.values.get(key.id) as T;\n }\n scope = scope.parent;\n }\n\n // Check fallback, then default\n if (fallback !== undefined) return fallback;\n if (key.defaultValue !== undefined) return key.defaultValue;\n\n throw akashError('AK0013');\n}\n","/**\n * Direct DOM rendering runtime.\n *\n * No virtual DOM. The compiler generates calls to these helpers.\n * Signal reads inside templates become fine-grained effects that\n * update only the specific DOM node that changed.\n */\n\nimport { effect } from './signals.js';\nimport { getCurrentScope, runInScope } from './context.js';\nimport type { AkashNode } from './types.js';\n\n// --- DOM creation helpers (used by compiler output) ---\n\n/** Create an element and optionally set static attributes */\nexport function createElement(\n tag: string,\n attrs?: Record<string, unknown>,\n): HTMLElement {\n const el = document.createElement(tag);\n if (attrs) {\n for (const [key, value] of Object.entries(attrs)) {\n setProperty(el, key, value);\n }\n }\n return el;\n}\n\n/** Create a text node */\nexport function createText(value: string): Text {\n return document.createTextNode(value);\n}\n\n/** Clone a template element for static structure */\nexport function cloneTemplate(html: string): DocumentFragment {\n const template = document.createElement('template');\n template.innerHTML = html;\n return template.content.cloneNode(true) as DocumentFragment;\n}\n\n// --- Property/attribute setting ---\n\nexport function setProperty(el: HTMLElement, key: string, value: unknown): void {\n if (key === 'class' || key === 'className') {\n el.className = value as string;\n } else if (key === 'style' && typeof value === 'object' && value !== null) {\n Object.assign(el.style, value);\n } else if (key === 'innerHTML') {\n el.innerHTML = value as string;\n } else if (key === 'ref') {\n // Handled separately by component system\n } else if (key.startsWith('on')) {\n const event = key.slice(2).toLowerCase();\n el.addEventListener(event, value as EventListener);\n } else if (key in el) {\n (el as Record<string, unknown>)[key] = value;\n } else if (value === false || value == null) {\n el.removeAttribute(key);\n } else {\n el.setAttribute(key, value === true ? '' : String(value));\n }\n}\n\n// --- Reactive binding (used by compiler for dynamic expressions) ---\n\n/** Bind a reactive expression to a text node's content */\nexport function bindText(node: Text, fn: () => unknown): () => void {\n return effect(\n () => {\n node.textContent = String(fn());\n },\n { render: true },\n );\n}\n\n/** Bind a reactive expression to an element's attribute/property */\nexport function bindProperty(\n el: HTMLElement,\n key: string,\n fn: () => unknown,\n): () => void {\n return effect(\n () => {\n setProperty(el, key, fn());\n },\n { render: true },\n );\n}\n\n/** Bind a reactive expression to an element's visibility (display) */\nexport function bindVisible(el: HTMLElement, fn: () => boolean): () => void {\n return effect(\n () => {\n el.style.display = fn() ? '' : 'none';\n },\n { render: true },\n );\n}\n\n// --- Conditional rendering ---\n\n/** Anchor node type for marking insertion points */\ntype Anchor = Comment;\n\nfunction createAnchor(label = ''): Anchor {\n return document.createComment(label);\n}\n\ninterface ConditionalBlock {\n nodes: Node[];\n dispose: (() => void) | null;\n}\n\n/**\n * Render a conditional block. Swaps DOM fragments based on a reactive\n * condition. Used by the compiler for :if directives and <Show>.\n */\nexport function renderConditional(\n parent: Node,\n anchor: Node,\n condition: () => boolean,\n trueBranch: () => Node,\n falseBranch?: () => Node,\n): () => void {\n let current: ConditionalBlock | null = null;\n\n // Capture scope so children created in branches inherit provide/inject context\n const scope = getCurrentScope();\n\n const dispose = effect(\n () => {\n const value = condition();\n\n // Remove old nodes\n if (current) {\n for (const node of current.nodes) {\n try { node.parentNode?.removeChild(node); } catch {}\n }\n current.dispose?.();\n current = null;\n }\n\n // Insert new nodes — use anchor.parentNode since the anchor may have\n // moved from the initial DocumentFragment into the real DOM\n const branch = value ? trueBranch : falseBranch;\n const liveParent = anchor.parentNode;\n if (branch && liveParent) {\n const fragment = scope ? runInScope(scope, branch) : branch();\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n for (const node of nodes) {\n liveParent.insertBefore(node, anchor);\n }\n current = { nodes, dispose: null };\n }\n },\n { render: true },\n );\n\n return () => {\n dispose();\n if (current) {\n for (const node of current.nodes) {\n try { node.parentNode?.removeChild(node); } catch {}\n }\n current.dispose?.();\n }\n };\n}\n\n// --- List rendering ---\n\ninterface ListItem<T> {\n key: unknown;\n value: T;\n nodes: Node[];\n dispose: (() => void) | null;\n}\n\n/**\n * Render a reactive list with keyed reconciliation.\n * Used by the compiler for :for directives and <For>.\n */\nexport function renderList<T>(\n parent: Node,\n anchor: Node,\n items: () => T[],\n keyFn: (item: T, index: number) => unknown,\n renderItem: (item: T, index: number) => Node,\n): () => void {\n let currentItems: ListItem<T>[] = [];\n\n // Capture scope so children created in renderItem inherit provide/inject context\n const scope = getCurrentScope();\n\n const dispose = effect(\n () => {\n const newData = items();\n const newItems: ListItem<T>[] = [];\n const oldMap = new Map<unknown, ListItem<T>>();\n\n for (const item of currentItems) {\n oldMap.set(item.key, item);\n }\n\n // Build new list, reuse existing DOM nodes when keys match\n for (let i = 0; i < newData.length; i++) {\n const data = newData[i];\n const key = keyFn(data, i);\n const existing = oldMap.get(key);\n\n if (existing) {\n oldMap.delete(key);\n existing.value = data;\n newItems.push(existing);\n } else {\n const fragment = scope ? runInScope(scope, () => renderItem(data, i)) : renderItem(data, i);\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n newItems.push({ key, value: data, nodes, dispose: null });\n }\n }\n\n // Remove items that are no longer in the list\n for (const item of oldMap.values()) {\n for (const node of item.nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n item.dispose?.();\n }\n\n // Reconcile DOM order — use anchor.parentNode since anchor may have\n // moved from the initial DocumentFragment into the real DOM\n const liveParent = anchor.parentNode;\n if (liveParent) {\n for (const item of newItems) {\n for (const node of item.nodes) {\n liveParent.insertBefore(node, anchor);\n }\n }\n }\n\n currentItems = newItems;\n },\n { render: true },\n );\n\n return () => {\n dispose();\n for (const item of currentItems) {\n for (const node of item.nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n item.dispose?.();\n }\n currentItems = [];\n };\n}\n\n// --- Built-in control flow components ---\n\n/** Props for the <Show> component */\nexport interface ShowProps<T> {\n when: (() => T | null | undefined | false) | T | null | undefined | false;\n fallback?: () => AkashNode;\n children: (value: T) => AkashNode;\n}\n\n/**\n * <Show> component — conditionally renders children with type narrowing.\n * The children callback receives the non-null/undefined value.\n * `when` can be a reactive getter or a static value.\n */\nexport function Show<T>(props: ShowProps<T>): Node {\n const anchor = createAnchor('show');\n const container = document.createDocumentFragment();\n container.appendChild(anchor);\n\n // Resolve when — if it's a function, always call it (supports both\n // compiler-generated __reactive getters and plain programmatic functions)\n const getWhen = typeof props.when === 'function'\n ? props.when as () => T | null | undefined | false\n : () => props.when as T | null | undefined | false;\n\n // Capture the when value once per evaluation so the condition check\n // and the children callback receive the same value (fixes nested For contexts)\n let whenValue: T | null | undefined | false;\n renderConditional(\n container,\n anchor,\n () => { whenValue = getWhen(); return !!whenValue; },\n () => nodeToDOM(props.children(whenValue as T)),\n props.fallback ? () => nodeToDOM(props.fallback!()) : undefined,\n );\n\n return container;\n}\n\n/** Props for the <For> component */\nexport interface ForProps<T> {\n each: (() => T[]) | T[];\n key: (item: T) => unknown;\n children: (item: T, index: number) => AkashNode;\n}\n\n/**\n * <For> component — renders a list with keyed reconciliation.\n * `each` can be a reactive getter or a static array.\n */\nexport function For<T>(props: ForProps<T>): Node {\n const anchor = createAnchor('for');\n const container = document.createDocumentFragment();\n container.appendChild(anchor);\n\n // Resolve each — if it's a function, always call it (supports both\n // compiler-generated __reactive getters and plain programmatic functions)\n const getEach = typeof props.each === 'function'\n ? props.each as () => T[]\n : () => props.each as T[];\n\n renderList(\n container,\n anchor,\n getEach,\n props.key,\n (item, index) => nodeToDOM(props.children(item, index)),\n );\n\n return container;\n}\n\n// --- Helpers ---\n\n/** Convert an AkashNode to a DOM Node */\nexport function nodeToDOM(node: AkashNode): Node {\n if (node == null || typeof node === 'boolean') {\n return document.createTextNode('');\n }\n if (typeof node === 'string' || typeof node === 'number') {\n return document.createTextNode(String(node));\n }\n if (node instanceof Node) {\n return node;\n }\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment();\n for (const child of node) {\n fragment.appendChild(nodeToDOM(child));\n }\n return fragment;\n }\n return document.createTextNode(String(node));\n}\n\n/** Insert a node into a parent before an anchor */\nexport function insert(parent: Node, node: AkashNode, anchor?: Node): void {\n const domNode = nodeToDOM(node);\n if (anchor) {\n parent.insertBefore(domNode, anchor);\n } else {\n parent.appendChild(domNode);\n }\n}\n","/**\n * Component system.\n *\n * Components are functions. defineComponent() wraps a setup function\n * that runs once, establishes signals and effects, and returns a\n * render function that produces DOM nodes.\n */\n\nimport { effect } from './signals.js';\nimport { pushScope, popScope, getCurrentScope } from './context.js';\nimport { nodeToDOM } from './dom.js';\nimport { akashError } from './errors.js';\nimport type { AkashNode } from './types.js';\n\n// --- Reactive getter marker (used by compiler) ---\n\n/** Mark a function as a compiler-generated reactive getter */\nexport function __getter<T>(fn: () => T): (() => T) & { __reactive: true } {\n (fn as any).__reactive = true;\n return fn as any;\n}\n\n// --- Types ---\n\nexport interface Ref<T = HTMLElement> {\n current: T | undefined;\n}\n\nexport interface ComponentContext<P extends Record<string, unknown> = Record<string, unknown>> {\n props: Readonly<P>;\n children: () => AkashNode;\n}\n\nexport type Component<P extends Record<string, unknown> = Record<string, unknown>> = {\n (props: P & { children?: AkashNode | (() => AkashNode) }): Node;\n _akash: true;\n};\n\n// --- Lifecycle hook storage ---\n\ninterface LifecycleHooks {\n mount: Array<() => void | (() => void)>;\n unmount: Array<() => void>;\n error: Array<(error: Error) => void>;\n}\n\nlet currentHooks: LifecycleHooks | null = null;\n\n// --- Public lifecycle hooks ---\n\n/**\n * Register a callback to run after the component is mounted to the DOM.\n * If the callback returns a function, it will be called on unmount (cleanup).\n */\nexport function onMount(fn: () => void | (() => void)): void {\n if (!currentHooks) {\n throw akashError('AK0020');\n }\n currentHooks.mount.push(fn);\n}\n\n/**\n * Register a callback to run before the component is unmounted.\n */\nexport function onUnmount(fn: () => void): void {\n if (!currentHooks) {\n throw akashError('AK0021');\n }\n currentHooks.unmount.push(fn);\n}\n\n/**\n * Register an error handler for this component and its descendants.\n */\nexport function onError(fn: (error: Error) => void): void {\n if (!currentHooks) {\n throw akashError('AK0022');\n }\n currentHooks.error.push(fn);\n}\n\n/**\n * Create a ref for accessing a DOM element.\n */\nexport function ref<T = HTMLElement>(): Ref<T> {\n return { current: undefined };\n}\n\n// --- defineComponent ---\n\n/**\n * Define a component. The setup function runs once per instance.\n * It receives a context with typed props and must return a render function.\n *\n * ```ts\n * const Counter = defineComponent<{ initial: number }>((ctx) => {\n * const count = signal(ctx.props.initial);\n * return () => <div>{count()}</div>;\n * });\n * ```\n */\nexport function defineComponent<P extends Record<string, unknown> = Record<string, unknown>>(\n setup: (ctx: ComponentContext<P>) => () => AkashNode,\n): Component<P> {\n const component = (rawProps: P & { children?: AkashNode | (() => AkashNode) }): Node => {\n // Separate children from props, unwrap getter functions for reactivity\n const { children: childrenProp, ...restProps } = rawProps ?? {};\n const props = new Proxy(restProps as unknown as P, {\n get(target, key, receiver) {\n const val = Reflect.get(target, key, receiver);\n // Unwrap compiler-generated reactive getters (marked with __reactive)\n if (typeof val === 'function' && (val as any).__reactive) {\n return val();\n }\n return val;\n },\n });\n\n const childrenFn: () => AkashNode =\n typeof childrenProp === 'function'\n ? childrenProp\n : () => childrenProp ?? null;\n\n const ctx: ComponentContext<P> = {\n props,\n children: childrenFn,\n };\n\n // Set up lifecycle hooks collector\n const hooks: LifecycleHooks = { mount: [], unmount: [], error: [] };\n const prevHooks = currentHooks;\n currentHooks = hooks;\n\n // Push context scope for provide/inject\n const parentScope = getCurrentScope();\n const scope = pushScope(parentScope);\n\n let renderFn: () => AkashNode;\n let domNode: Node;\n\n try {\n renderFn = setup(ctx);\n if (typeof renderFn !== 'function') { throw akashError('AK0040'); }\n const rendered = renderFn();\n domNode = nodeToDOM(rendered);\n } catch (err) {\n popScope(scope);\n currentHooks = prevHooks;\n if (hooks.error.length > 0) {\n for (const handler of hooks.error) {\n handler(err instanceof Error ? err : new Error(String(err)));\n }\n return document.createComment('error');\n }\n throw err;\n }\n\n // Restore parent state\n popScope(scope);\n currentHooks = prevHooks;\n\n // Run mount callbacks (microtask to ensure DOM is attached)\n if (hooks.mount.length > 0) {\n queueMicrotask(() => {\n for (const mountFn of hooks.mount) {\n try {\n const cleanup = mountFn();\n if (typeof cleanup === 'function') {\n hooks.unmount.push(cleanup);\n }\n } catch (err) {\n for (const handler of hooks.error) {\n handler(err instanceof Error ? err : new Error(String(err)));\n }\n }\n }\n });\n }\n\n return domNode;\n };\n\n component._akash = true as const;\n return component as Component<P>;\n}\n"]}
|
package/dist/chunk-RTJ6UDGV.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';var f=new Set,l=new Set,b=false,d=0,E=3,x=100;function v(){if(b)return;b=true;let e=new Map,n=false,t=0;for(;(f.size>0||l.size>0)&&t<x;){if(t++,f.size>0){let o=[...f].sort(k);f.clear();for(let r of o){let s=(e.get(r)??0)+1;if(e.set(r,s),s>E){n=true;continue}r.run();}}if(l.size>0){let o=[...l].sort(k);l.clear();for(let r of o){let s=(e.get(r)??0)+1;if(e.set(r,s),s>E){n=true;continue}r.run();}}if(n&&f.size===0&&l.size===0)break}(n||t>=x)&&(f.clear(),l.clear(),console.error("[AkashJS] Circular dependency detected between effects. Two or more effects are writing to each other's dependencies. The cycle has been broken after "+t+" iterations.")),b=false;}function P(e){e.isRender?f.add(e):l.add(e),d===0&&!b&&v();}function N(e){d++;try{e();}finally{d--,d===0&&v();}}function C(){d++;}function R(){d--,d===0&&v();}function k(e,n){return (e.depth??0)-(n.depth??0)}function J(){v();}var T=false,S=[],w=0;function B(){T=true,S=[],w=performance.now();}function K(){T=false;let e=performance.now();return {entries:[...S],totalDuration:e-w,startTime:w,endTime:e}}function g(){return T}function p(e,n,t){T&&S.push({type:e,name:n,duration:t,timestamp:performance.now()});}function $(e){let n=e.entries.filter(u=>u.type==="render"),t=e.entries.filter(u=>u.type==="effect"),o=e.entries.filter(u=>u.type==="signal-update"),r=e.entries.filter(u=>u.type==="computed"),s=u=>u.length>0?u.reduce((c,m)=>c+m.duration,0)/u.length:0,a=u=>u.length>0?u.reduce((c,m)=>m.duration>c.duration?m:c):null;return {totalRenders:n.length,totalEffects:t.length,totalSignalUpdates:o.length,totalComputedEvals:r.length,avgRenderTime:s(n),avgEffectTime:s(t),slowestRender:a(n),slowestEffect:a(t)}}function O(e,n){let t=performance.now(),o=n(),r=performance.now()-t;return p("render",e,r),{result:o,duration:r}}async function M(e,n){let t=performance.now(),o=await n(),r=performance.now()-t;return p("render",e,r),{result:o,duration:r}}function j(e){let n=0,t=0;return {start(){n=performance.now();},stop(){t=performance.now()-n,p("render",e,t);},get duration(){return t}}}function I(e){let n=$(e),t=`
|
|
2
|
-
Performance Profile
|
|
3
|
-
`;return t+=" "+"\u2500".repeat(50)+`
|
|
4
|
-
`,t+=` Duration: ${e.totalDuration.toFixed(1)} ms
|
|
5
|
-
`,t+=` Renders: ${n.totalRenders} (avg ${n.avgRenderTime.toFixed(2)} ms)
|
|
6
|
-
`,t+=` Effects: ${n.totalEffects} (avg ${n.avgEffectTime.toFixed(2)} ms)
|
|
7
|
-
`,t+=` Signal updates: ${n.totalSignalUpdates}
|
|
8
|
-
`,t+=` Computed evals: ${n.totalComputedEvals}
|
|
9
|
-
`,n.slowestRender&&(t+=` Slowest render: ${n.slowestRender.name} (${n.slowestRender.duration.toFixed(2)} ms)
|
|
10
|
-
`),n.slowestEffect&&(t+=` Slowest effect: ${n.slowestEffect.name} (${n.slowestEffect.duration.toFixed(2)} ms)
|
|
11
|
-
`),t+=" "+"\u2500".repeat(50)+`
|
|
12
|
-
`,t}var F=typeof process>"u"||process.env?.NODE_ENV!=="production";var i=null;function W(e,n){let t={value:e,subscribers:new Set,equals:n?.equals??Object.is},o=()=>(U(t),t.value);return o.set=r=>{F&&i&&i._tag==="computed"&&console.warn("[AkashJS] Writing to a signal inside computed() is not allowed. The write will be lost on the next evaluation."),!t.equals(t.value,r)&&(t.value=r,g()&&p("signal-update","signal.set",0),N(()=>{h(t);}));},o.update=r=>{o.set(r(t.value));},o.peek=()=>t.value,o}function G(e,n){let t={_tag:"computed",fn:e,value:void 0,state:1,subscribers:new Set,sources:new Set,equals:n?.equals??Object.is};return ()=>(i&&(t.subscribers.add(i),"sources"in i&&i.sources.add(t)),t.state!==0&&D(t),t.value)}var y=new Set;function D(e){if(y.has(e))throw new Error("[AkashJS] Circular dependency detected between computed values.");y.add(e),C();for(let o of e.sources)o.subscribers.delete(e);e.sources.clear();let n=i;i=e;let t=g()?performance.now():0;try{let o=e.fn(),r=e.value===void 0||!e.equals(e.value,o);e.value=o,e.state=0,r&&h(e);}finally{t&&p("computed","computed",performance.now()-t),y.delete(e),i=n,R();}}function Q(e,n){let t={_tag:"effect",fn:e,cleanup:null,sources:new Set,disposed:false,isRender:n?.render??false,run(){_(t);}};return _(t),()=>{t.disposed=true,q(t);for(let o of t.sources)o.subscribers.delete(t);t.sources.clear();}}function _(e){if(e.disposed)return;if(e.sources.size>0){let r=false;for(let s of e.sources)if("_tag"in s&&s._tag==="computed"){if(s.state===1){let a=s.value;D(s),s.equals(a,s.value)||(r=true);}}else r=true;if(!r)return}q(e);let n=new Set(e.sources);for(let r of e.sources)r.subscribers.delete(e);e.sources.clear();let t=i;i=e;let o=g()?performance.now():0;try{let r=e.fn();typeof r=="function"&&(e.cleanup=r);}catch(r){for(let s of n)s.subscribers.add(e),e.sources.add(s);console.error("[AkashJS] Error in effect (will retry on next signal change):",r);}finally{o&&p("effect","effect",performance.now()-o),i=t;}}function q(e){if(e.cleanup){try{e.cleanup();}catch(n){console.error("[AkashJS] Error in effect cleanup (ignored):",n);}e.cleanup=null;}}function z(e){let n=i;i=null;try{return e()}finally{i=n;}}function Y(e,n,t){let o=Array.isArray(e),r=o?e:[e],s,a=true;return ()=>{let u=r.map(m=>m());if(a&&(a=false,s=u.slice(),t?.defer!==false))return;let c=s;return s=u.slice(),z(()=>n(o?u:u[0],c?o?c:c[0]:void 0))}}function U(e){i&&(e.subscribers.add(i),"sources"in i&&i.sources.add(e));}function h(e){let n=[...e.subscribers];for(let t of n)t._tag==="computed"?(t.state=1,h(t)):t._tag==="effect"&&P(t);}exports.a=N;exports.b=J;exports.c=B;exports.d=K;exports.e=g;exports.f=p;exports.g=$;exports.h=O;exports.i=M;exports.j=j;exports.k=I;exports.l=W;exports.m=G;exports.n=Q;exports.o=z;exports.p=Y;//# sourceMappingURL=chunk-RTJ6UDGV.cjs.map
|
|
13
|
-
//# sourceMappingURL=chunk-RTJ6UDGV.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scheduler.ts","../src/perf.ts","../src/signals.ts"],"names":["pendingRender","pendingUser","flushing","batchDepth","MAX_EFFECT_RUNS","MAX_FLUSH_ITERATIONS","flush","runCounts","circularDetected","iterations","queue","byDepth","fx","count","scheduleEffect","batch","fn","enterBatch","exitBatch","a","b","flushSync","profiling","entries","profileStart","startProfiling","stopProfiling","endTime","isProfiling","recordPerfEntry","type","name","duration","getProfileSummary","profile","renders","e","effects","signalUpdates","computeds","avg","arr","s","slowest","measureSync","start","result","measureAsync","createTimer","startTime","dur","formatProfile","summary","out","__DEV__","currentSubscriber","signal","initialValue","options","node","read","trackSubscriber","value","notifySubscribers","computed","recompute","computingSet","source","prevSubscriber","_t0","newValue","changed","effect","runEffect","cleanupEffect","anyChanged","oldValue","prevSources","err","untrack","prev","on","deps","isArray","depArray","prevValues","isFirst","values","d","subs","sub"],"mappings":"aAcA,IAAMA,CAAAA,CAAgB,IAAI,GAAA,CACpBC,CAAAA,CAAc,IAAI,GAAA,CACpBC,CAAAA,CAAW,KAAA,CACXC,CAAAA,CAAa,CAAA,CAGXC,CAAAA,CAAkB,CAAA,CAClBC,CAAAA,CAAuB,IAE7B,SAASC,CAAAA,EAAc,CACrB,GAAIJ,CAAAA,CAAU,OACdA,CAAAA,CAAW,IACM,CAGjB,IAAMK,CAAAA,CAAY,IAAI,GAAA,CAClBC,CAAAA,CAAmB,KAAA,CAInBC,CAAAA,CAAa,CAAA,CACjB,KAAA,CAAQT,CAAAA,CAAc,IAAA,CAAO,CAAA,EAAKC,CAAAA,CAAY,IAAA,CAAO,CAAA,GAAMQ,CAAAA,CAAaJ,CAAAA,EAAsB,CAI5F,GAHAI,IAGIT,CAAAA,CAAc,IAAA,CAAO,CAAA,CAAG,CAC1B,IAAMU,CAAAA,CAAQ,CAAC,GAAGV,CAAa,CAAA,CAAE,IAAA,CAAKW,CAAO,CAAA,CAC7CX,CAAAA,CAAc,KAAA,EAAM,CACpB,QAAWY,CAAAA,IAAMF,CAAAA,CAAO,CACtB,IAAMG,CAAAA,CAAAA,CAASN,CAAAA,CAAU,GAAA,CAAIK,CAAE,CAAA,EAAK,CAAA,EAAK,CAAA,CAEzC,GADAL,CAAAA,CAAU,GAAA,CAA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,CAAG,EAGxB","file":"chunk-RTJ6UDGV.cjs","sourcesContent":["/**\n * Microtask-based effect scheduler with priority levels and deduplication.\n *\n * Render effects (DOM bindings) run before user effects to ensure\n * DOM is consistent before user-side effects execute.\n */\n\nexport interface ScheduledEffect {\n run(): void;\n isRender: boolean;\n /** Depth in the dependency graph (0 = root). Lower depth runs first. */\n depth?: number;\n}\n\nconst pendingRender = new Set<ScheduledEffect>();\nconst pendingUser = new Set<ScheduledEffect>();\nlet flushing = false;\nlet batchDepth = 0;\nlet flushScheduled = false;\n\nconst MAX_EFFECT_RUNS = 3;\nconst MAX_FLUSH_ITERATIONS = 100;\n\nfunction flush(): void {\n if (flushing) return;\n flushing = true;\n flushScheduled = false;\n\n // Fresh per-effect run counter for THIS flush — reset every time\n const runCounts = new Map<ScheduledEffect, number>();\n let circularDetected = false;\n\n // Process render effects first, then user effects.\n // Effects may enqueue more effects during flush, so loop until empty.\n let iterations = 0;\n while ((pendingRender.size > 0 || pendingUser.size > 0) && iterations < MAX_FLUSH_ITERATIONS) {\n iterations++;\n\n // Drain render effects (sorted by depth — parents before children)\n if (pendingRender.size > 0) {\n const queue = [...pendingRender].sort(byDepth);\n pendingRender.clear();\n for (const fx of queue) {\n const count = (runCounts.get(fx) ?? 0) + 1;\n runCounts.set(fx, count);\n if (count > MAX_EFFECT_RUNS) {\n circularDetected = true;\n continue; // skip this effect — it's in a cycle\n }\n fx.run();\n }\n }\n\n // Drain user effects (sorted by depth)\n if (pendingUser.size > 0) {\n const queue = [...pendingUser].sort(byDepth);\n pendingUser.clear();\n for (const fx of queue) {\n const count = (runCounts.get(fx) ?? 0) + 1;\n runCounts.set(fx, count);\n if (count > MAX_EFFECT_RUNS) {\n circularDetected = true;\n continue; // skip this effect — it's in a cycle\n }\n fx.run();\n }\n }\n\n // If all remaining effects were skipped due to cycle detection, break\n if (circularDetected && pendingRender.size === 0 && pendingUser.size === 0) {\n break;\n }\n }\n\n if (circularDetected || iterations >= MAX_FLUSH_ITERATIONS) {\n pendingRender.clear();\n pendingUser.clear();\n console.error(\n '[AkashJS] Circular dependency detected between effects. ' +\n 'Two or more effects are writing to each other\\'s dependencies. ' +\n 'The cycle has been broken after ' + iterations + ' iterations.'\n );\n }\n\n flushing = false;\n}\n\nexport function scheduleEffect(fx: ScheduledEffect): void {\n if (fx.isRender) {\n pendingRender.add(fx);\n } else {\n pendingUser.add(fx);\n }\n\n if (batchDepth === 0 && !flushing) {\n flush();\n }\n}\n\n/**\n * Batch multiple signal writes — subscribers are notified only once\n * at the end of the batch.\n */\nexport function batch(fn: () => void): void {\n batchDepth++;\n try {\n fn();\n } finally {\n batchDepth--;\n if (batchDepth === 0) {\n flush();\n }\n }\n}\n\n/** Enter/exit batch depth — used by computed recompute to prevent mid-evaluation flush */\nexport function enterBatch(): void { batchDepth++; }\nexport function exitBatch(): void {\n batchDepth--;\n if (batchDepth === 0) flush();\n}\n\n/** Sort effects by depth (lower depth first = parents before children) */\nfunction byDepth(a: ScheduledEffect, b: ScheduledEffect): number {\n return (a.depth ?? 0) - (b.depth ?? 0);\n}\n\n/** Synchronously flush all pending effects. Useful for testing. */\nexport function flushSync(): void {\n flush();\n}\n","/**\n * Performance profiling utilities.\n *\n * Measure component render times, signal propagation, and\n * effect execution for performance debugging.\n *\n * ```ts\n * import { startProfiling, stopProfiling, getProfile } from '@akashjs/runtime';\n *\n * startProfiling();\n * // ... do stuff ...\n * stopProfiling();\n * console.table(getProfile().entries);\n * ```\n */\n\n// --- Types ---\n\nexport interface PerfEntry {\n type: 'render' | 'effect' | 'signal-update' | 'computed';\n name: string;\n duration: number;\n timestamp: number;\n}\n\nexport interface PerfProfile {\n entries: PerfEntry[];\n totalDuration: number;\n startTime: number;\n endTime: number;\n}\n\nexport interface PerfSummary {\n totalRenders: number;\n totalEffects: number;\n totalSignalUpdates: number;\n totalComputedEvals: number;\n avgRenderTime: number;\n avgEffectTime: number;\n slowestRender: PerfEntry | null;\n slowestEffect: PerfEntry | null;\n}\n\n// --- Profiling state ---\n\nlet profiling = false;\nlet entries: PerfEntry[] = [];\nlet profileStart = 0;\n\n// --- Public API ---\n\n/**\n * Start profiling. Clears previous data.\n */\nexport function startProfiling(): void {\n profiling = true;\n entries = [];\n profileStart = performance.now();\n}\n\n/**\n * Stop profiling.\n */\nexport function stopProfiling(): PerfProfile {\n profiling = false;\n const endTime = performance.now();\n\n return {\n entries: [...entries],\n totalDuration: endTime - profileStart,\n startTime: profileStart,\n endTime,\n };\n}\n\n/**\n * Check if profiling is active.\n */\nexport function isProfiling(): boolean {\n return profiling;\n}\n\n/**\n * Record a performance entry (called internally by the framework).\n */\nexport function recordPerfEntry(\n type: PerfEntry['type'],\n name: string,\n duration: number,\n): void {\n if (!profiling) return;\n entries.push({\n type,\n name,\n duration,\n timestamp: performance.now(),\n });\n}\n\n/**\n * Get a summary of the profiling data.\n */\nexport function getProfileSummary(profile: PerfProfile): PerfSummary {\n const renders = profile.entries.filter((e) => e.type === 'render');\n const effects = profile.entries.filter((e) => e.type === 'effect');\n const signalUpdates = profile.entries.filter((e) => e.type === 'signal-update');\n const computeds = profile.entries.filter((e) => e.type === 'computed');\n\n const avg = (arr: PerfEntry[]) =>\n arr.length > 0 ? arr.reduce((s, e) => s + e.duration, 0) / arr.length : 0;\n\n const slowest = (arr: PerfEntry[]) =>\n arr.length > 0 ? arr.reduce((s, e) => (e.duration > s.duration ? e : s)) : null;\n\n return {\n totalRenders: renders.length,\n totalEffects: effects.length,\n totalSignalUpdates: signalUpdates.length,\n totalComputedEvals: computeds.length,\n avgRenderTime: avg(renders),\n avgEffectTime: avg(effects),\n slowestRender: slowest(renders),\n slowestEffect: slowest(effects),\n };\n}\n\n// --- Measurement helpers ---\n\n/**\n * Measure the time to execute a function.\n *\n * ```ts\n * const { result, duration } = measureSync('my-operation', () => expensiveWork());\n * ```\n */\nexport function measureSync<T>(name: string, fn: () => T): { result: T; duration: number } {\n const start = performance.now();\n const result = fn();\n const duration = performance.now() - start;\n recordPerfEntry('render', name, duration);\n return { result, duration };\n}\n\n/**\n * Measure the time to execute an async function.\n */\nexport async function measureAsync<T>(\n name: string,\n fn: () => Promise<T>,\n): Promise<{ result: T; duration: number }> {\n const start = performance.now();\n const result = await fn();\n const duration = performance.now() - start;\n recordPerfEntry('render', name, duration);\n return { result, duration };\n}\n\n/**\n * Create a named timer for manual start/stop measurement.\n *\n * ```ts\n * const timer = createTimer('data-fetch');\n * timer.start();\n * await fetch(...);\n * timer.stop(); // records the entry\n * timer.duration; // ms\n * ```\n */\nexport function createTimer(name: string) {\n let startTime = 0;\n let dur = 0;\n\n return {\n start() { startTime = performance.now(); },\n stop() {\n dur = performance.now() - startTime;\n recordPerfEntry('render', name, dur);\n },\n get duration() { return dur; },\n };\n}\n\n/**\n * Format a profile for console output.\n */\nexport function formatProfile(profile: PerfProfile): string {\n const summary = getProfileSummary(profile);\n let out = '\\n Performance Profile\\n';\n out += ' ' + '─'.repeat(50) + '\\n';\n out += ` Duration: ${profile.totalDuration.toFixed(1)} ms\\n`;\n out += ` Renders: ${summary.totalRenders} (avg ${summary.avgRenderTime.toFixed(2)} ms)\\n`;\n out += ` Effects: ${summary.totalEffects} (avg ${summary.avgEffectTime.toFixed(2)} ms)\\n`;\n out += ` Signal updates: ${summary.totalSignalUpdates}\\n`;\n out += ` Computed evals: ${summary.totalComputedEvals}\\n`;\n\n if (summary.slowestRender) {\n out += ` Slowest render: ${summary.slowestRender.name} (${summary.slowestRender.duration.toFixed(2)} ms)\\n`;\n }\n if (summary.slowestEffect) {\n out += ` Slowest effect: ${summary.slowestEffect.name} (${summary.slowestEffect.duration.toFixed(2)} ms)\\n`;\n }\n\n out += ' ' + '─'.repeat(50) + '\\n';\n return out;\n}\n","/**\n * Fine-grained reactivity system.\n *\n * Inspired by SolidJS/Preact Signals. Provides signal(), computed(),\n * effect(), and untrack() primitives with automatic dependency tracking\n * and glitch-free diamond dependency resolution.\n */\n\nimport { scheduleEffect, batch, enterBatch, exitBatch, type ScheduledEffect } from './scheduler.js';\nimport { recordPerfEntry, isProfiling } from './perf.js';\n\nconst __DEV__ = typeof process === 'undefined' || process.env?.NODE_ENV !== 'production';\n\n/** Depth counter to defer effect scheduling until all notifications complete (glitch-free) */\nlet notifyDepth = 0;\n\n// --- Tracking scope ---\n\ntype Subscriber = EffectNode | ComputedNode<unknown>;\n\nlet currentSubscriber: Subscriber | null = null;\n\n// --- Signal ---\n\nexport interface Signal<T> {\n /** Read the current value (tracks dependency if inside a reactive scope) */\n (): T;\n /** Set a new value */\n set(value: T): void;\n /** Update the value using the previous value */\n update(fn: (prev: T) => T): void;\n /** Read without tracking (no dependency registered) */\n peek(): T;\n}\n\nexport type ReadonlySignal<T> = () => T;\n\ninterface SignalNode<T> {\n value: T;\n subscribers: Set<Subscriber>;\n equals: (a: T, b: T) => boolean;\n}\n\nexport function signal<T>(\n initialValue: T,\n options?: { equals?: (a: T, b: T) => boolean },\n): Signal<T> {\n const node: SignalNode<T> = {\n value: initialValue,\n subscribers: new Set(),\n equals: options?.equals ?? Object.is,\n };\n\n const read = (): T => {\n trackSubscriber(node);\n return node.value;\n };\n\n read.set = (value: T): void => {\n if (__DEV__ && currentSubscriber && currentSubscriber._tag === 'computed') {\n console.warn('[AkashJS] Writing to a signal inside computed() is not allowed. The write will be lost on the next evaluation.');\n }\n if (node.equals(node.value, value)) return;\n node.value = value;\n if (isProfiling()) recordPerfEntry('signal-update', 'signal.set', 0);\n batch(() => { notifySubscribers(node); });\n };\n\n read.update = (fn: (prev: T) => T): void => {\n read.set(fn(node.value));\n };\n\n read.peek = (): T => node.value;\n\n return read;\n}\n\n// --- Computed ---\n\nconst enum ComputedState {\n Clean = 0,\n Dirty = 1,\n}\n\ninterface ComputedNode<T> {\n _tag: 'computed';\n fn: () => T;\n value: T | undefined;\n state: ComputedState;\n subscribers: Set<Subscriber>;\n sources: Set<SignalNode<unknown> | ComputedNode<unknown>>;\n equals: (a: T, b: T) => boolean;\n}\n\nexport function computed<T>(\n fn: () => T,\n options?: { equals?: (a: T, b: T) => boolean },\n): ReadonlySignal<T> {\n const node: ComputedNode<T> = {\n _tag: 'computed',\n fn,\n value: undefined,\n state: ComputedState.Dirty,\n subscribers: new Set(),\n sources: new Set(),\n equals: options?.equals ?? Object.is,\n };\n\n const read = (): T => {\n // Track this computed as a dependency of the current subscriber\n if (currentSubscriber) {\n node.subscribers.add(currentSubscriber);\n if ('sources' in currentSubscriber) {\n currentSubscriber.sources.add(node);\n }\n }\n\n if (node.state !== ComputedState.Clean) {\n recompute(node);\n }\n\n return node.value as T;\n };\n\n return read;\n}\n\nconst computingSet = new Set<ComputedNode<unknown>>();\n\nfunction recompute<T>(node: ComputedNode<T>): void {\n // Detect circular computed dependencies — only if THIS node is already being computed\n if (computingSet.has(node as ComputedNode<unknown>)) {\n throw new Error('[AkashJS] Circular dependency detected between computed values.');\n }\n computingSet.add(node as ComputedNode<unknown>);\n\n // Prevent effects from flushing while computed is evaluating.\n // Without this, a computed that reads other dirty computeds can trigger\n // notifySubscribers → scheduleEffect → flush → re-enter recompute on\n // a node still in computingSet (false circular detection).\n enterBatch();\n\n // Clean up old source subscriptions\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n\n const prevSubscriber = currentSubscriber;\n currentSubscriber = node;\n\n const _t0 = isProfiling() ? performance.now() : 0;\n try {\n const newValue = node.fn();\n const changed =\n node.value === undefined || !node.equals(node.value, newValue);\n node.value = newValue;\n node.state = ComputedState.Clean;\n\n // Only propagate if value actually changed.\n if (changed) {\n notifySubscribers(node);\n }\n } finally {\n if (_t0) recordPerfEntry('computed', 'computed', performance.now() - _t0);\n computingSet.delete(node as ComputedNode<unknown>);\n currentSubscriber = prevSubscriber;\n exitBatch();\n }\n}\n\n// --- Effect ---\n\ninterface EffectNode extends ScheduledEffect {\n _tag: 'effect';\n fn: () => void | (() => void);\n cleanup: (() => void) | null;\n sources: Set<SignalNode<unknown> | ComputedNode<unknown>>;\n disposed: boolean;\n isRender: boolean;\n}\n\nexport function effect(\n fn: () => void | (() => void),\n options?: { render?: boolean },\n): () => void {\n const node: EffectNode = {\n _tag: 'effect',\n fn,\n cleanup: null,\n sources: new Set(),\n disposed: false,\n isRender: options?.render ?? false,\n run() {\n runEffect(node);\n },\n };\n\n // Run immediately to establish dependencies\n runEffect(node);\n\n // Return dispose function\n return () => {\n node.disposed = true;\n cleanupEffect(node);\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n };\n}\n\nfunction runEffect(node: EffectNode): void {\n if (node.disposed) return;\n\n // Before re-running, check if any dirty computed source actually changed.\n // If all computed sources resolved to the same value, skip the re-run.\n if (node.sources.size > 0) {\n let anyChanged = false;\n for (const source of node.sources) {\n if ('_tag' in source && source._tag === 'computed') {\n if (source.state === ComputedState.Dirty) {\n const oldValue = source.value;\n recompute(source);\n if (!source.equals(oldValue as never, source.value as never)) {\n anyChanged = true;\n }\n }\n } else {\n // Plain signal source — if we got scheduled, something changed\n anyChanged = true;\n }\n }\n if (!anyChanged) return;\n }\n\n // Clean up previous run\n cleanupEffect(node);\n\n // Save old sources in case the effect throws — we need to re-subscribe\n const prevSources = new Set(node.sources);\n\n // Clean up old source subscriptions\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n\n const prevSubscriber = currentSubscriber;\n currentSubscriber = node;\n const _t0 = isProfiling() ? performance.now() : 0;\n\n try {\n const result = node.fn();\n if (typeof result === 'function') {\n node.cleanup = result;\n }\n } catch (err) {\n // Re-subscribe to previous sources so the effect can recover on next change\n for (const source of prevSources) {\n source.subscribers.add(node);\n node.sources.add(source);\n }\n console.error('[AkashJS] Error in effect (will retry on next signal change):', err);\n } finally {\n if (_t0) recordPerfEntry('effect', 'effect', performance.now() - _t0);\n currentSubscriber = prevSubscriber;\n }\n}\n\nfunction cleanupEffect(node: EffectNode): void {\n if (node.cleanup) {\n try {\n node.cleanup();\n } catch (err) {\n console.error('[AkashJS] Error in effect cleanup (ignored):', err);\n }\n node.cleanup = null;\n }\n}\n\n// --- Untrack ---\n\n/** Execute a function without tracking any signal reads */\nexport function untrack<T>(fn: () => T): T {\n const prev = currentSubscriber;\n currentSubscriber = null;\n try {\n return fn();\n } finally {\n currentSubscriber = prev;\n }\n}\n\n// --- on() helper ---\n\n/**\n * Create an effect callback that only tracks specific signals.\n * All other signal reads inside the callback are untracked.\n *\n * ```ts\n * effect(on(url, (currentUrl, prevUrl) => {\n * fetch(currentUrl, options()); // options() not tracked\n * }));\n *\n * effect(on([url, page], ([u, p], prev) => {\n * fetch(`${u}?page=${p}`);\n * }));\n * ```\n */\nexport function on<T>(\n dep: () => T,\n fn: (value: T, prev: T | undefined) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void);\nexport function on<T extends readonly (() => unknown)[]>(\n deps: [...T],\n fn: (values: { [K in keyof T]: ReturnType<T[K]> }, prev: { [K in keyof T]: ReturnType<T[K]> } | undefined) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void);\nexport function on(\n deps: (() => unknown) | (() => unknown)[],\n fn: (values: unknown, prev: unknown) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void) {\n const isArray = Array.isArray(deps);\n const depArray = isArray ? deps : [deps];\n let prevValues: unknown[] | undefined;\n let isFirst = true;\n\n return () => {\n // Track only the specified deps\n const values = depArray.map(d => d());\n\n // Skip the initial effect run — only fire on actual changes\n // (pass { defer: false } to opt out and run immediately)\n if (isFirst) {\n isFirst = false;\n prevValues = values.slice();\n if (options?.defer !== false) return;\n }\n\n const prev = prevValues;\n prevValues = values.slice();\n\n // Run fn without tracking so reads inside don't create subscriptions\n return untrack(() => fn(\n isArray ? values : values[0],\n prev ? (isArray ? prev : prev[0]) : undefined,\n ));\n };\n}\n\n// --- Internal helpers ---\n\nfunction trackSubscriber(\n node: SignalNode<unknown> | ComputedNode<unknown>,\n): void {\n if (currentSubscriber) {\n node.subscribers.add(currentSubscriber);\n\n if ('sources' in currentSubscriber) {\n currentSubscriber.sources.add(node);\n }\n }\n}\n\nfunction notifySubscribers(\n node: SignalNode<unknown> | ComputedNode<unknown>,\n): void {\n // Snapshot subscribers before iterating. Effects that run synchronously\n // during flush() will delete and re-add themselves to the Set, and JS\n // Set iterators visit newly added entries — causing an infinite loop\n // without the snapshot.\n const subs = [...node.subscribers];\n for (const sub of subs) {\n if (sub._tag === 'computed') {\n // Mark dirty. The computed will re-evaluate lazily when read.\n sub.state = ComputedState.Dirty;\n // Propagate through the computed chain to reach effects.\n // The effects will re-read the computed, triggering recompute,\n // and only update DOM if the value actually changed.\n notifySubscribers(sub);\n } else if (sub._tag === 'effect') {\n scheduleEffect(sub);\n }\n }\n}\n"]}
|
package/dist/chunk-TWA4T6PX.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var f=new Set,l=new Set,b=false,d=0,E=3,x=100;function v(){if(b)return;b=true;let e=new Map,n=false,t=0;for(;(f.size>0||l.size>0)&&t<x;){if(t++,f.size>0){let o=[...f].sort(k);f.clear();for(let r of o){let s=(e.get(r)??0)+1;if(e.set(r,s),s>E){n=true;continue}r.run();}}if(l.size>0){let o=[...l].sort(k);l.clear();for(let r of o){let s=(e.get(r)??0)+1;if(e.set(r,s),s>E){n=true;continue}r.run();}}if(n&&f.size===0&&l.size===0)break}(n||t>=x)&&(f.clear(),l.clear(),console.error("[AkashJS] Circular dependency detected between effects. Two or more effects are writing to each other's dependencies. The cycle has been broken after "+t+" iterations.")),b=false;}function P(e){e.isRender?f.add(e):l.add(e),d===0&&!b&&v();}function N(e){d++;try{e();}finally{d--,d===0&&v();}}function C(){d++;}function R(){d--,d===0&&v();}function k(e,n){return (e.depth??0)-(n.depth??0)}function J(){v();}var T=false,S=[],w=0;function B(){T=true,S=[],w=performance.now();}function K(){T=false;let e=performance.now();return {entries:[...S],totalDuration:e-w,startTime:w,endTime:e}}function g(){return T}function p(e,n,t){T&&S.push({type:e,name:n,duration:t,timestamp:performance.now()});}function $(e){let n=e.entries.filter(u=>u.type==="render"),t=e.entries.filter(u=>u.type==="effect"),o=e.entries.filter(u=>u.type==="signal-update"),r=e.entries.filter(u=>u.type==="computed"),s=u=>u.length>0?u.reduce((c,m)=>c+m.duration,0)/u.length:0,a=u=>u.length>0?u.reduce((c,m)=>m.duration>c.duration?m:c):null;return {totalRenders:n.length,totalEffects:t.length,totalSignalUpdates:o.length,totalComputedEvals:r.length,avgRenderTime:s(n),avgEffectTime:s(t),slowestRender:a(n),slowestEffect:a(t)}}function O(e,n){let t=performance.now(),o=n(),r=performance.now()-t;return p("render",e,r),{result:o,duration:r}}async function M(e,n){let t=performance.now(),o=await n(),r=performance.now()-t;return p("render",e,r),{result:o,duration:r}}function j(e){let n=0,t=0;return {start(){n=performance.now();},stop(){t=performance.now()-n,p("render",e,t);},get duration(){return t}}}function I(e){let n=$(e),t=`
|
|
2
|
-
Performance Profile
|
|
3
|
-
`;return t+=" "+"\u2500".repeat(50)+`
|
|
4
|
-
`,t+=` Duration: ${e.totalDuration.toFixed(1)} ms
|
|
5
|
-
`,t+=` Renders: ${n.totalRenders} (avg ${n.avgRenderTime.toFixed(2)} ms)
|
|
6
|
-
`,t+=` Effects: ${n.totalEffects} (avg ${n.avgEffectTime.toFixed(2)} ms)
|
|
7
|
-
`,t+=` Signal updates: ${n.totalSignalUpdates}
|
|
8
|
-
`,t+=` Computed evals: ${n.totalComputedEvals}
|
|
9
|
-
`,n.slowestRender&&(t+=` Slowest render: ${n.slowestRender.name} (${n.slowestRender.duration.toFixed(2)} ms)
|
|
10
|
-
`),n.slowestEffect&&(t+=` Slowest effect: ${n.slowestEffect.name} (${n.slowestEffect.duration.toFixed(2)} ms)
|
|
11
|
-
`),t+=" "+"\u2500".repeat(50)+`
|
|
12
|
-
`,t}var F=typeof process>"u"||process.env?.NODE_ENV!=="production";var i=null;function W(e,n){let t={value:e,subscribers:new Set,equals:n?.equals??Object.is},o=()=>(U(t),t.value);return o.set=r=>{F&&i&&i._tag==="computed"&&console.warn("[AkashJS] Writing to a signal inside computed() is not allowed. The write will be lost on the next evaluation."),!t.equals(t.value,r)&&(t.value=r,g()&&p("signal-update","signal.set",0),N(()=>{h(t);}));},o.update=r=>{o.set(r(t.value));},o.peek=()=>t.value,o}function G(e,n){let t={_tag:"computed",fn:e,value:void 0,state:1,subscribers:new Set,sources:new Set,equals:n?.equals??Object.is};return ()=>(i&&(t.subscribers.add(i),"sources"in i&&i.sources.add(t)),t.state!==0&&D(t),t.value)}var y=new Set;function D(e){if(y.has(e))throw new Error("[AkashJS] Circular dependency detected between computed values.");y.add(e),C();for(let o of e.sources)o.subscribers.delete(e);e.sources.clear();let n=i;i=e;let t=g()?performance.now():0;try{let o=e.fn(),r=e.value===void 0||!e.equals(e.value,o);e.value=o,e.state=0,r&&h(e);}finally{t&&p("computed","computed",performance.now()-t),y.delete(e),i=n,R();}}function Q(e,n){let t={_tag:"effect",fn:e,cleanup:null,sources:new Set,disposed:false,isRender:n?.render??false,run(){_(t);}};return _(t),()=>{t.disposed=true,q(t);for(let o of t.sources)o.subscribers.delete(t);t.sources.clear();}}function _(e){if(e.disposed)return;if(e.sources.size>0){let r=false;for(let s of e.sources)if("_tag"in s&&s._tag==="computed"){if(s.state===1){let a=s.value;D(s),s.equals(a,s.value)||(r=true);}}else r=true;if(!r)return}q(e);let n=new Set(e.sources);for(let r of e.sources)r.subscribers.delete(e);e.sources.clear();let t=i;i=e;let o=g()?performance.now():0;try{let r=e.fn();typeof r=="function"&&(e.cleanup=r);}catch(r){for(let s of n)s.subscribers.add(e),e.sources.add(s);console.error("[AkashJS] Error in effect (will retry on next signal change):",r);}finally{o&&p("effect","effect",performance.now()-o),i=t;}}function q(e){if(e.cleanup){try{e.cleanup();}catch(n){console.error("[AkashJS] Error in effect cleanup (ignored):",n);}e.cleanup=null;}}function z(e){let n=i;i=null;try{return e()}finally{i=n;}}function Y(e,n,t){let o=Array.isArray(e),r=o?e:[e],s,a=true;return ()=>{let u=r.map(m=>m());if(a&&(a=false,s=u.slice(),t?.defer!==false))return;let c=s;return s=u.slice(),z(()=>n(o?u:u[0],c?o?c:c[0]:void 0))}}function U(e){i&&(e.subscribers.add(i),"sources"in i&&i.sources.add(e));}function h(e){let n=[...e.subscribers];for(let t of n)t._tag==="computed"?(t.state=1,h(t)):t._tag==="effect"&&P(t);}export{N as a,J as b,B as c,K as d,g as e,p as f,$ as g,O as h,M as i,j,I as k,W as l,G as m,Q as n,z as o,Y as p};//# sourceMappingURL=chunk-TWA4T6PX.js.map
|
|
13
|
-
//# sourceMappingURL=chunk-TWA4T6PX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scheduler.ts","../src/perf.ts","../src/signals.ts"],"names":["pendingRender","pendingUser","flushing","batchDepth","MAX_EFFECT_RUNS","MAX_FLUSH_ITERATIONS","flush","runCounts","circularDetected","iterations","queue","byDepth","fx","count","scheduleEffect","batch","fn","enterBatch","exitBatch","a","b","flushSync","profiling","entries","profileStart","startProfiling","stopProfiling","endTime","isProfiling","recordPerfEntry","type","name","duration","getProfileSummary","profile","renders","e","effects","signalUpdates","computeds","avg","arr","s","slowest","measureSync","start","result","measureAsync","createTimer","startTime","dur","formatProfile","summary","out","__DEV__","currentSubscriber","signal","initialValue","options","node","read","trackSubscriber","value","notifySubscribers","computed","recompute","computingSet","source","prevSubscriber","_t0","newValue","changed","effect","runEffect","cleanupEffect","anyChanged","oldValue","prevSources","err","untrack","prev","on","deps","isArray","depArray","prevValues","isFirst","values","d","subs","sub"],"mappings":"AAcA,IAAMA,CAAAA,CAAgB,IAAI,GAAA,CACpBC,CAAAA,CAAc,IAAI,GAAA,CACpBC,CAAAA,CAAW,KAAA,CACXC,CAAAA,CAAa,CAAA,CAGXC,CAAAA,CAAkB,CAAA,CAClBC,CAAAA,CAAuB,IAE7B,SAASC,CAAAA,EAAc,CACrB,GAAIJ,CAAAA,CAAU,OACdA,CAAAA,CAAW,IACM,CAGjB,IAAMK,CAAAA,CAAY,IAAI,GAAA,CAClBC,CAAAA,CAAmB,KAAA,CAInBC,CAAAA,CAAa,CA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A,SAASnB,EACPF,CAAAA,CACM,CACFJ,CAAAA,GACFI,CAAAA,CAAK,YAAY,GAAA,CAAIJ,CAAiB,CAAA,CAElC,SAAA,GAAaA,CAAAA,EACfA,CAAAA,CAAkB,OAAA,CAAQ,GAAA,CAAII,CAAI,CAAA,EAGxC,CAEA,SAASI,CAAAA,CACPJ,EACM,CAKN,IAAM8B,CAAAA,CAAO,CAAC,GAAG9B,CAAAA,CAAK,WAAW,CAAA,CACjC,IAAA,IAAW+B,KAAOD,CAAAA,CACZC,CAAAA,CAAI,IAAA,GAAS,UAAA,EAEfA,EAAI,KAAA,CAAQ,CAAA,CAIZ3B,CAAAA,CAAkB2B,CAAG,GACZA,CAAAA,CAAI,IAAA,GAAS,QAAA,EACtB5E,CAAAA,CAAe4E,CAAG,EAGxB","file":"chunk-TWA4T6PX.js","sourcesContent":["/**\n * Microtask-based effect scheduler with priority levels and deduplication.\n *\n * Render effects (DOM bindings) run before user effects to ensure\n * DOM is consistent before user-side effects execute.\n */\n\nexport interface ScheduledEffect {\n run(): void;\n isRender: boolean;\n /** Depth in the dependency graph (0 = root). Lower depth runs first. */\n depth?: number;\n}\n\nconst pendingRender = new Set<ScheduledEffect>();\nconst pendingUser = new Set<ScheduledEffect>();\nlet flushing = false;\nlet batchDepth = 0;\nlet flushScheduled = false;\n\nconst MAX_EFFECT_RUNS = 3;\nconst MAX_FLUSH_ITERATIONS = 100;\n\nfunction flush(): void {\n if (flushing) return;\n flushing = true;\n flushScheduled = false;\n\n // Fresh per-effect run counter for THIS flush — reset every time\n const runCounts = new Map<ScheduledEffect, number>();\n let circularDetected = false;\n\n // Process render effects first, then user effects.\n // Effects may enqueue more effects during flush, so loop until empty.\n let iterations = 0;\n while ((pendingRender.size > 0 || pendingUser.size > 0) && iterations < MAX_FLUSH_ITERATIONS) {\n iterations++;\n\n // Drain render effects (sorted by depth — parents before children)\n if (pendingRender.size > 0) {\n const queue = [...pendingRender].sort(byDepth);\n pendingRender.clear();\n for (const fx of queue) {\n const count = (runCounts.get(fx) ?? 0) + 1;\n runCounts.set(fx, count);\n if (count > MAX_EFFECT_RUNS) {\n circularDetected = true;\n continue; // skip this effect — it's in a cycle\n }\n fx.run();\n }\n }\n\n // Drain user effects (sorted by depth)\n if (pendingUser.size > 0) {\n const queue = [...pendingUser].sort(byDepth);\n pendingUser.clear();\n for (const fx of queue) {\n const count = (runCounts.get(fx) ?? 0) + 1;\n runCounts.set(fx, count);\n if (count > MAX_EFFECT_RUNS) {\n circularDetected = true;\n continue; // skip this effect — it's in a cycle\n }\n fx.run();\n }\n }\n\n // If all remaining effects were skipped due to cycle detection, break\n if (circularDetected && pendingRender.size === 0 && pendingUser.size === 0) {\n break;\n }\n }\n\n if (circularDetected || iterations >= MAX_FLUSH_ITERATIONS) {\n pendingRender.clear();\n pendingUser.clear();\n console.error(\n '[AkashJS] Circular dependency detected between effects. ' +\n 'Two or more effects are writing to each other\\'s dependencies. ' +\n 'The cycle has been broken after ' + iterations + ' iterations.'\n );\n }\n\n flushing = false;\n}\n\nexport function scheduleEffect(fx: ScheduledEffect): void {\n if (fx.isRender) {\n pendingRender.add(fx);\n } else {\n pendingUser.add(fx);\n }\n\n if (batchDepth === 0 && !flushing) {\n flush();\n }\n}\n\n/**\n * Batch multiple signal writes — subscribers are notified only once\n * at the end of the batch.\n */\nexport function batch(fn: () => void): void {\n batchDepth++;\n try {\n fn();\n } finally {\n batchDepth--;\n if (batchDepth === 0) {\n flush();\n }\n }\n}\n\n/** Enter/exit batch depth — used by computed recompute to prevent mid-evaluation flush */\nexport function enterBatch(): void { batchDepth++; }\nexport function exitBatch(): void {\n batchDepth--;\n if (batchDepth === 0) flush();\n}\n\n/** Sort effects by depth (lower depth first = parents before children) */\nfunction byDepth(a: ScheduledEffect, b: ScheduledEffect): number {\n return (a.depth ?? 0) - (b.depth ?? 0);\n}\n\n/** Synchronously flush all pending effects. Useful for testing. */\nexport function flushSync(): void {\n flush();\n}\n","/**\n * Performance profiling utilities.\n *\n * Measure component render times, signal propagation, and\n * effect execution for performance debugging.\n *\n * ```ts\n * import { startProfiling, stopProfiling, getProfile } from '@akashjs/runtime';\n *\n * startProfiling();\n * // ... do stuff ...\n * stopProfiling();\n * console.table(getProfile().entries);\n * ```\n */\n\n// --- Types ---\n\nexport interface PerfEntry {\n type: 'render' | 'effect' | 'signal-update' | 'computed';\n name: string;\n duration: number;\n timestamp: number;\n}\n\nexport interface PerfProfile {\n entries: PerfEntry[];\n totalDuration: number;\n startTime: number;\n endTime: number;\n}\n\nexport interface PerfSummary {\n totalRenders: number;\n totalEffects: number;\n totalSignalUpdates: number;\n totalComputedEvals: number;\n avgRenderTime: number;\n avgEffectTime: number;\n slowestRender: PerfEntry | null;\n slowestEffect: PerfEntry | null;\n}\n\n// --- Profiling state ---\n\nlet profiling = false;\nlet entries: PerfEntry[] = [];\nlet profileStart = 0;\n\n// --- Public API ---\n\n/**\n * Start profiling. Clears previous data.\n */\nexport function startProfiling(): void {\n profiling = true;\n entries = [];\n profileStart = performance.now();\n}\n\n/**\n * Stop profiling.\n */\nexport function stopProfiling(): PerfProfile {\n profiling = false;\n const endTime = performance.now();\n\n return {\n entries: [...entries],\n totalDuration: endTime - profileStart,\n startTime: profileStart,\n endTime,\n };\n}\n\n/**\n * Check if profiling is active.\n */\nexport function isProfiling(): boolean {\n return profiling;\n}\n\n/**\n * Record a performance entry (called internally by the framework).\n */\nexport function recordPerfEntry(\n type: PerfEntry['type'],\n name: string,\n duration: number,\n): void {\n if (!profiling) return;\n entries.push({\n type,\n name,\n duration,\n timestamp: performance.now(),\n });\n}\n\n/**\n * Get a summary of the profiling data.\n */\nexport function getProfileSummary(profile: PerfProfile): PerfSummary {\n const renders = profile.entries.filter((e) => e.type === 'render');\n const effects = profile.entries.filter((e) => e.type === 'effect');\n const signalUpdates = profile.entries.filter((e) => e.type === 'signal-update');\n const computeds = profile.entries.filter((e) => e.type === 'computed');\n\n const avg = (arr: PerfEntry[]) =>\n arr.length > 0 ? arr.reduce((s, e) => s + e.duration, 0) / arr.length : 0;\n\n const slowest = (arr: PerfEntry[]) =>\n arr.length > 0 ? arr.reduce((s, e) => (e.duration > s.duration ? e : s)) : null;\n\n return {\n totalRenders: renders.length,\n totalEffects: effects.length,\n totalSignalUpdates: signalUpdates.length,\n totalComputedEvals: computeds.length,\n avgRenderTime: avg(renders),\n avgEffectTime: avg(effects),\n slowestRender: slowest(renders),\n slowestEffect: slowest(effects),\n };\n}\n\n// --- Measurement helpers ---\n\n/**\n * Measure the time to execute a function.\n *\n * ```ts\n * const { result, duration } = measureSync('my-operation', () => expensiveWork());\n * ```\n */\nexport function measureSync<T>(name: string, fn: () => T): { result: T; duration: number } {\n const start = performance.now();\n const result = fn();\n const duration = performance.now() - start;\n recordPerfEntry('render', name, duration);\n return { result, duration };\n}\n\n/**\n * Measure the time to execute an async function.\n */\nexport async function measureAsync<T>(\n name: string,\n fn: () => Promise<T>,\n): Promise<{ result: T; duration: number }> {\n const start = performance.now();\n const result = await fn();\n const duration = performance.now() - start;\n recordPerfEntry('render', name, duration);\n return { result, duration };\n}\n\n/**\n * Create a named timer for manual start/stop measurement.\n *\n * ```ts\n * const timer = createTimer('data-fetch');\n * timer.start();\n * await fetch(...);\n * timer.stop(); // records the entry\n * timer.duration; // ms\n * ```\n */\nexport function createTimer(name: string) {\n let startTime = 0;\n let dur = 0;\n\n return {\n start() { startTime = performance.now(); },\n stop() {\n dur = performance.now() - startTime;\n recordPerfEntry('render', name, dur);\n },\n get duration() { return dur; },\n };\n}\n\n/**\n * Format a profile for console output.\n */\nexport function formatProfile(profile: PerfProfile): string {\n const summary = getProfileSummary(profile);\n let out = '\\n Performance Profile\\n';\n out += ' ' + '─'.repeat(50) + '\\n';\n out += ` Duration: ${profile.totalDuration.toFixed(1)} ms\\n`;\n out += ` Renders: ${summary.totalRenders} (avg ${summary.avgRenderTime.toFixed(2)} ms)\\n`;\n out += ` Effects: ${summary.totalEffects} (avg ${summary.avgEffectTime.toFixed(2)} ms)\\n`;\n out += ` Signal updates: ${summary.totalSignalUpdates}\\n`;\n out += ` Computed evals: ${summary.totalComputedEvals}\\n`;\n\n if (summary.slowestRender) {\n out += ` Slowest render: ${summary.slowestRender.name} (${summary.slowestRender.duration.toFixed(2)} ms)\\n`;\n }\n if (summary.slowestEffect) {\n out += ` Slowest effect: ${summary.slowestEffect.name} (${summary.slowestEffect.duration.toFixed(2)} ms)\\n`;\n }\n\n out += ' ' + '─'.repeat(50) + '\\n';\n return out;\n}\n","/**\n * Fine-grained reactivity system.\n *\n * Inspired by SolidJS/Preact Signals. Provides signal(), computed(),\n * effect(), and untrack() primitives with automatic dependency tracking\n * and glitch-free diamond dependency resolution.\n */\n\nimport { scheduleEffect, batch, enterBatch, exitBatch, type ScheduledEffect } from './scheduler.js';\nimport { recordPerfEntry, isProfiling } from './perf.js';\n\nconst __DEV__ = typeof process === 'undefined' || process.env?.NODE_ENV !== 'production';\n\n/** Depth counter to defer effect scheduling until all notifications complete (glitch-free) */\nlet notifyDepth = 0;\n\n// --- Tracking scope ---\n\ntype Subscriber = EffectNode | ComputedNode<unknown>;\n\nlet currentSubscriber: Subscriber | null = null;\n\n// --- Signal ---\n\nexport interface Signal<T> {\n /** Read the current value (tracks dependency if inside a reactive scope) */\n (): T;\n /** Set a new value */\n set(value: T): void;\n /** Update the value using the previous value */\n update(fn: (prev: T) => T): void;\n /** Read without tracking (no dependency registered) */\n peek(): T;\n}\n\nexport type ReadonlySignal<T> = () => T;\n\ninterface SignalNode<T> {\n value: T;\n subscribers: Set<Subscriber>;\n equals: (a: T, b: T) => boolean;\n}\n\nexport function signal<T>(\n initialValue: T,\n options?: { equals?: (a: T, b: T) => boolean },\n): Signal<T> {\n const node: SignalNode<T> = {\n value: initialValue,\n subscribers: new Set(),\n equals: options?.equals ?? Object.is,\n };\n\n const read = (): T => {\n trackSubscriber(node);\n return node.value;\n };\n\n read.set = (value: T): void => {\n if (__DEV__ && currentSubscriber && currentSubscriber._tag === 'computed') {\n console.warn('[AkashJS] Writing to a signal inside computed() is not allowed. The write will be lost on the next evaluation.');\n }\n if (node.equals(node.value, value)) return;\n node.value = value;\n if (isProfiling()) recordPerfEntry('signal-update', 'signal.set', 0);\n batch(() => { notifySubscribers(node); });\n };\n\n read.update = (fn: (prev: T) => T): void => {\n read.set(fn(node.value));\n };\n\n read.peek = (): T => node.value;\n\n return read;\n}\n\n// --- Computed ---\n\nconst enum ComputedState {\n Clean = 0,\n Dirty = 1,\n}\n\ninterface ComputedNode<T> {\n _tag: 'computed';\n fn: () => T;\n value: T | undefined;\n state: ComputedState;\n subscribers: Set<Subscriber>;\n sources: Set<SignalNode<unknown> | ComputedNode<unknown>>;\n equals: (a: T, b: T) => boolean;\n}\n\nexport function computed<T>(\n fn: () => T,\n options?: { equals?: (a: T, b: T) => boolean },\n): ReadonlySignal<T> {\n const node: ComputedNode<T> = {\n _tag: 'computed',\n fn,\n value: undefined,\n state: ComputedState.Dirty,\n subscribers: new Set(),\n sources: new Set(),\n equals: options?.equals ?? Object.is,\n };\n\n const read = (): T => {\n // Track this computed as a dependency of the current subscriber\n if (currentSubscriber) {\n node.subscribers.add(currentSubscriber);\n if ('sources' in currentSubscriber) {\n currentSubscriber.sources.add(node);\n }\n }\n\n if (node.state !== ComputedState.Clean) {\n recompute(node);\n }\n\n return node.value as T;\n };\n\n return read;\n}\n\nconst computingSet = new Set<ComputedNode<unknown>>();\n\nfunction recompute<T>(node: ComputedNode<T>): void {\n // Detect circular computed dependencies — only if THIS node is already being computed\n if (computingSet.has(node as ComputedNode<unknown>)) {\n throw new Error('[AkashJS] Circular dependency detected between computed values.');\n }\n computingSet.add(node as ComputedNode<unknown>);\n\n // Prevent effects from flushing while computed is evaluating.\n // Without this, a computed that reads other dirty computeds can trigger\n // notifySubscribers → scheduleEffect → flush → re-enter recompute on\n // a node still in computingSet (false circular detection).\n enterBatch();\n\n // Clean up old source subscriptions\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n\n const prevSubscriber = currentSubscriber;\n currentSubscriber = node;\n\n const _t0 = isProfiling() ? performance.now() : 0;\n try {\n const newValue = node.fn();\n const changed =\n node.value === undefined || !node.equals(node.value, newValue);\n node.value = newValue;\n node.state = ComputedState.Clean;\n\n // Only propagate if value actually changed.\n if (changed) {\n notifySubscribers(node);\n }\n } finally {\n if (_t0) recordPerfEntry('computed', 'computed', performance.now() - _t0);\n computingSet.delete(node as ComputedNode<unknown>);\n currentSubscriber = prevSubscriber;\n exitBatch();\n }\n}\n\n// --- Effect ---\n\ninterface EffectNode extends ScheduledEffect {\n _tag: 'effect';\n fn: () => void | (() => void);\n cleanup: (() => void) | null;\n sources: Set<SignalNode<unknown> | ComputedNode<unknown>>;\n disposed: boolean;\n isRender: boolean;\n}\n\nexport function effect(\n fn: () => void | (() => void),\n options?: { render?: boolean },\n): () => void {\n const node: EffectNode = {\n _tag: 'effect',\n fn,\n cleanup: null,\n sources: new Set(),\n disposed: false,\n isRender: options?.render ?? false,\n run() {\n runEffect(node);\n },\n };\n\n // Run immediately to establish dependencies\n runEffect(node);\n\n // Return dispose function\n return () => {\n node.disposed = true;\n cleanupEffect(node);\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n };\n}\n\nfunction runEffect(node: EffectNode): void {\n if (node.disposed) return;\n\n // Before re-running, check if any dirty computed source actually changed.\n // If all computed sources resolved to the same value, skip the re-run.\n if (node.sources.size > 0) {\n let anyChanged = false;\n for (const source of node.sources) {\n if ('_tag' in source && source._tag === 'computed') {\n if (source.state === ComputedState.Dirty) {\n const oldValue = source.value;\n recompute(source);\n if (!source.equals(oldValue as never, source.value as never)) {\n anyChanged = true;\n }\n }\n } else {\n // Plain signal source — if we got scheduled, something changed\n anyChanged = true;\n }\n }\n if (!anyChanged) return;\n }\n\n // Clean up previous run\n cleanupEffect(node);\n\n // Save old sources in case the effect throws — we need to re-subscribe\n const prevSources = new Set(node.sources);\n\n // Clean up old source subscriptions\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n\n const prevSubscriber = currentSubscriber;\n currentSubscriber = node;\n const _t0 = isProfiling() ? performance.now() : 0;\n\n try {\n const result = node.fn();\n if (typeof result === 'function') {\n node.cleanup = result;\n }\n } catch (err) {\n // Re-subscribe to previous sources so the effect can recover on next change\n for (const source of prevSources) {\n source.subscribers.add(node);\n node.sources.add(source);\n }\n console.error('[AkashJS] Error in effect (will retry on next signal change):', err);\n } finally {\n if (_t0) recordPerfEntry('effect', 'effect', performance.now() - _t0);\n currentSubscriber = prevSubscriber;\n }\n}\n\nfunction cleanupEffect(node: EffectNode): void {\n if (node.cleanup) {\n try {\n node.cleanup();\n } catch (err) {\n console.error('[AkashJS] Error in effect cleanup (ignored):', err);\n }\n node.cleanup = null;\n }\n}\n\n// --- Untrack ---\n\n/** Execute a function without tracking any signal reads */\nexport function untrack<T>(fn: () => T): T {\n const prev = currentSubscriber;\n currentSubscriber = null;\n try {\n return fn();\n } finally {\n currentSubscriber = prev;\n }\n}\n\n// --- on() helper ---\n\n/**\n * Create an effect callback that only tracks specific signals.\n * All other signal reads inside the callback are untracked.\n *\n * ```ts\n * effect(on(url, (currentUrl, prevUrl) => {\n * fetch(currentUrl, options()); // options() not tracked\n * }));\n *\n * effect(on([url, page], ([u, p], prev) => {\n * fetch(`${u}?page=${p}`);\n * }));\n * ```\n */\nexport function on<T>(\n dep: () => T,\n fn: (value: T, prev: T | undefined) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void);\nexport function on<T extends readonly (() => unknown)[]>(\n deps: [...T],\n fn: (values: { [K in keyof T]: ReturnType<T[K]> }, prev: { [K in keyof T]: ReturnType<T[K]> } | undefined) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void);\nexport function on(\n deps: (() => unknown) | (() => unknown)[],\n fn: (values: unknown, prev: unknown) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void) {\n const isArray = Array.isArray(deps);\n const depArray = isArray ? deps : [deps];\n let prevValues: unknown[] | undefined;\n let isFirst = true;\n\n return () => {\n // Track only the specified deps\n const values = depArray.map(d => d());\n\n // Skip the initial effect run — only fire on actual changes\n // (pass { defer: false } to opt out and run immediately)\n if (isFirst) {\n isFirst = false;\n prevValues = values.slice();\n if (options?.defer !== false) return;\n }\n\n const prev = prevValues;\n prevValues = values.slice();\n\n // Run fn without tracking so reads inside don't create subscriptions\n return untrack(() => fn(\n isArray ? values : values[0],\n prev ? (isArray ? prev : prev[0]) : undefined,\n ));\n };\n}\n\n// --- Internal helpers ---\n\nfunction trackSubscriber(\n node: SignalNode<unknown> | ComputedNode<unknown>,\n): void {\n if (currentSubscriber) {\n node.subscribers.add(currentSubscriber);\n\n if ('sources' in currentSubscriber) {\n currentSubscriber.sources.add(node);\n }\n }\n}\n\nfunction notifySubscribers(\n node: SignalNode<unknown> | ComputedNode<unknown>,\n): void {\n // Snapshot subscribers before iterating. Effects that run synchronously\n // during flush() will delete and re-add themselves to the Set, and JS\n // Set iterators visit newly added entries — causing an infinite loop\n // without the snapshot.\n const subs = [...node.subscribers];\n for (const sub of subs) {\n if (sub._tag === 'computed') {\n // Mark dirty. The computed will re-evaluate lazily when read.\n sub.state = ComputedState.Dirty;\n // Propagate through the computed chain to reach effects.\n // The effects will re-read the computed, triggering recompute,\n // and only update DOM if the value actually changed.\n notifySubscribers(sub);\n } else if (sub._tag === 'effect') {\n scheduleEffect(sub);\n }\n }\n}\n"]}
|
package/dist/chunk-YIVBLM2A.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkRTJ6UDGV_cjs=require('./chunk-RTJ6UDGV.cjs');var v={AK0010:{code:"AK0010",message:"provide() called outside of component setup.",hint:"provide() must be called inside defineComponent()."},AK0012:{code:"AK0012",message:"inject() called outside of component setup.",hint:"inject() must be called inside defineComponent()."},AK0013:{code:"AK0013",message:"No provider found for injected context.",hint:"Make sure an ancestor component calls provide() with this key."},AK0020:{code:"AK0020",message:"onMount() called outside of component setup.",hint:"onMount() must be called inside defineComponent()."},AK0021:{code:"AK0021",message:"onUnmount() called outside of component setup.",hint:"onUnmount() must be called inside defineComponent()."},AK0022:{code:"AK0022",message:"onError() called outside of component setup.",hint:"onError() must be called inside defineComponent()."},AK0030:{code:"AK0030",message:"Circular dependency detected in computed signal.",hint:"A computed signal is reading itself, directly or via other computeds."},AK0031:{code:"AK0031",message:"Signal set() called during computation.",hint:"Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers."},AK0040:{code:"AK0040",message:"Component setup must return a render function.",hint:"The function passed to defineComponent() must return () => AkashNode."},AK0041:{code:"AK0041",message:"Required prop is missing.",hint:"Check that the parent component is passing all required props."},AK0050:{code:"AK0050",message:"useRoute() called outside of router context.",hint:"Make sure your component is rendered inside a router provider."},AK0051:{code:"AK0051",message:"No route matched the current URL.",hint:"Add a catch-all route ([...rest]) to handle unmatched paths."},AK0052:{code:"AK0052",message:"Route guard threw an error.",hint:"Check the guard function for unhandled exceptions."},AK0060:{code:"AK0060",message:"Form submitted while invalid.",hint:"The submit handler was not called because validation failed. Check form.errors()."},AK0061:{code:"AK0061",message:"Async validator timed out.",hint:"The async validator did not resolve within the expected time. Check your async validation logic."},AK0070:{code:"AK0070",message:"HTTP request failed.",hint:"Check the server response status and network connectivity."},AK0071:{code:"AK0071",message:"createResource() fetcher threw an error.",hint:"Check the fetcher function passed to createResource()."}},P="https://akashjs.dev/errors";function L(e,n){let t=v[e];if(!t)return `[AkashJS ${e}] Unknown error code.`;let o=`[AkashJS ${e}] ${t.message}`;return n&&(o+=`
|
|
2
|
-
${n}`),o+=`
|
|
3
|
-
${t.hint}`,o+=`
|
|
4
|
-
See: ${P}/${e}`,o}function g(e,n){return new Error(L(e,n))}function D(e){return v[e]}function F(){return Object.keys(v)}var M=Symbol("akash.context"),p=null;function S(e=p){let n={values:new Map,parent:e};return p=n,n}function w(e){p=e.parent;}function C(){return p}function K(e,n){let t=p;p=e;try{return n()}finally{p=t;}}function I(e){return {[M]:true,_type:void 0,defaultValue:e,id:Symbol("context")}}function B(e,n){if(!p)throw g("AK0010");p.values.set(e.id,n);}function O(e,n){if(!p)throw g("AK0012");let t=p;for(;t;){if(t.values.has(e.id))return t.values.get(e.id);t=t.parent;}if(n!==void 0)return n;if(e.defaultValue!==void 0)return e.defaultValue;throw g("AK0013")}function q(e,n){let t=document.createElement(e);if(n)for(let[o,a]of Object.entries(n))E(t,o,a);return t}function J(e){return document.createTextNode(e)}function W(e){let n=document.createElement("template");return n.innerHTML=e,n.content.cloneNode(true)}function E(e,n,t){if(n==="class"||n==="className")e.className=t;else if(n==="style"&&typeof t=="object"&&t!==null)Object.assign(e.style,t);else if(n==="innerHTML")e.innerHTML=t;else if(n!=="ref")if(n.startsWith("on")){let o=n.slice(2).toLowerCase();e.addEventListener(o,t);}else n in e?e[n]=t:t===false||t==null?e.removeAttribute(n):e.setAttribute(n,t===true?"":String(t));}function X(e,n){return chunkRTJ6UDGV_cjs.n(()=>{e.textContent=String(n());},{render:true})}function z(e,n,t){return chunkRTJ6UDGV_cjs.n(()=>{E(e,n,t());},{render:true})}function G(e,n){return chunkRTJ6UDGV_cjs.n(()=>{e.style.display=n()?"":"none";},{render:true})}function b(e=""){return document.createComment(e)}function R(e,n,t,o,a){let s=null,A=C(),N=chunkRTJ6UDGV_cjs.n(()=>{let i=t();if(s){for(let l of s.nodes)try{l.parentNode?.removeChild(l);}catch{}s.dispose?.(),s=null;}let d=i?o:a,h=n.parentNode;if(d&&h){let l=A?K(A,d):d(),r=l instanceof DocumentFragment?Array.from(l.childNodes):[l];for(let c of r)h.insertBefore(c,n);s={nodes:r,dispose:null};}},{render:true});return ()=>{if(N(),s){for(let i of s.nodes)try{i.parentNode?.removeChild(i);}catch{}s.dispose?.();}}}function j(e,n,t,o,a){let s=[],A=C(),N=chunkRTJ6UDGV_cjs.n(()=>{let i=t(),d=[],h=new Map;for(let r of s)h.set(r.key,r);for(let r=0;r<i.length;r++){let c=i[r],u=o(c,r),f=h.get(u);if(f)h.delete(u),f.value=c,d.push(f);else {let T=A?K(A,()=>a(c,r)):a(c,r),y=T instanceof DocumentFragment?Array.from(T.childNodes):[T];d.push({key:u,value:c,nodes:y,dispose:null});}}for(let r of h.values()){for(let c of r.nodes)c.parentNode&&c.parentNode.removeChild(c);r.dispose?.();}let l=n.parentNode;if(l)for(let r of d)for(let c of r.nodes)l.insertBefore(c,n);s=d;},{render:true});return ()=>{N();for(let i of s){for(let d of i.nodes)d.parentNode&&d.parentNode.removeChild(d);i.dispose?.();}s=[];}}function Q(e){let n=b("show"),t=document.createDocumentFragment();t.appendChild(n);let o=typeof e.when=="function"?e.when:()=>e.when,a;return R(t,n,()=>(a=o(),!!a),()=>x(e.children(a)),e.fallback?()=>x(e.fallback()):void 0),t}function Y(e){let n=b("for"),t=document.createDocumentFragment();t.appendChild(n);let o=typeof e.each=="function"?e.each:()=>e.each;return j(t,n,o,e.key,(a,s)=>x(e.children(a,s))),t}function x(e){if(e==null||typeof e=="boolean")return document.createTextNode("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(e instanceof Node)return e;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let t of e)n.appendChild(x(t));return n}return document.createTextNode(String(e))}function Z(e,n,t){let o=x(n);t?e.insertBefore(o,t):e.appendChild(o);}function re(e){return e.__reactive=true,e}var m=null;function ie(e){if(!m)throw g("AK0020");m.mount.push(e);}function se(e){if(!m)throw g("AK0021");m.unmount.push(e);}function ce(e){if(!m)throw g("AK0022");m.error.push(e);}function de(){return {current:void 0}}function ae(e){let n=t=>{let{children:o,...a}=t??{},N={props:new Proxy(a,{get(u,f,T){let y=Reflect.get(u,f,T);return typeof y=="function"&&y.__reactive?y():y}}),children:typeof o=="function"?o:()=>o??null},i={mount:[],unmount:[],error:[]},d=m;m=i;let h=C(),l=S(h),r,c;try{if(r=e(N),typeof r!="function")throw g("AK0040");let u=r();c=x(u);}catch(u){if(w(l),m=d,i.error.length>0){for(let f of i.error)f(u instanceof Error?u:new Error(String(u)));return document.createComment("error")}throw u}return w(l),m=d,i.mount.length>0&&queueMicrotask(()=>{for(let u of i.mount)try{let f=u();typeof f=="function"&&i.unmount.push(f);}catch(f){for(let T of i.error)T(f instanceof Error?f:new Error(String(f)));}}),c};return n._akash=true,n}exports.A=de;exports.B=ae;exports.a=L;exports.b=g;exports.c=D;exports.d=F;exports.e=C;exports.f=K;exports.g=I;exports.h=B;exports.i=O;exports.j=q;exports.k=J;exports.l=W;exports.m=E;exports.n=X;exports.o=z;exports.p=G;exports.q=R;exports.r=j;exports.s=Q;exports.t=Y;exports.u=x;exports.v=Z;exports.w=re;exports.x=ie;exports.y=se;exports.z=ce;//# sourceMappingURL=chunk-YIVBLM2A.cjs.map
|
|
5
|
-
//# sourceMappingURL=chunk-YIVBLM2A.cjs.map
|