rip-lang 3.13.96 → 3.13.98

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.96-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.98-blue.svg" alt="Version"></a>
13
13
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
14
14
  <a href="#"><img src="https://img.shields.io/badge/tests-1%2C436%2F1%2C436-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
package/docs/dist/rip.js CHANGED
@@ -8862,8 +8862,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
8862
8862
  return new CodeGenerator({}).getComponentRuntime();
8863
8863
  }
8864
8864
  // src/browser.js
8865
- var VERSION = "3.13.93";
8866
- var BUILD_DATE = "2026-03-12@00:12:28GMT";
8865
+ var VERSION = "3.13.96";
8866
+ var BUILD_DATE = "2026-03-12@01:03:48GMT";
8867
8867
  if (typeof globalThis !== "undefined") {
8868
8868
  if (!globalThis.__rip)
8869
8869
  new Function(getReactiveRuntime())();
@@ -10299,14 +10299,16 @@ ${indented}`);
10299
10299
  })();
10300
10300
  };
10301
10301
  _ariaPopupDismiss = function(open, popup, close, els = []) {
10302
- let inside, onDown, onScroll;
10302
+ let get, onDown, onScroll;
10303
10303
  if (!open)
10304
10304
  return;
10305
- inside = [popup, ...els];
10306
- onDown = (e) => !inside.some(function(el) {
10305
+ get = function(x) {
10306
+ return typeof x === "function" ? x() : x;
10307
+ };
10308
+ onDown = (e) => ![get(popup), ...els.map(get)].some(function(el) {
10307
10309
  return el?.contains(e.target);
10308
10310
  }) ? close() : undefined;
10309
- onScroll = (e) => !popup?.contains(e.target) ? close() : undefined;
10311
+ onScroll = (e) => !get(popup)?.contains(e.target) ? close() : undefined;
10310
10312
  document.addEventListener("mousedown", onDown);
10311
10313
  window.addEventListener("scroll", onScroll, true);
10312
10314
  return function() {
@@ -719,7 +719,7 @@ globalThis.sleep ??= (ms) => new Promise(r => setTimeout(r, ms));
719
719
  globalThis.todo ??= (msg) => { throw new Error(msg || "Not implemented"); };
720
720
  globalThis.warn ??= console.warn;
721
721
  globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
722
- `}function J1(){return new x({}).getReactiveRuntime()}function K1(){return new x({}).getComponentRuntime()}var q2="3.13.93",P2="2026-03-12@00:12:28GMT";if(typeof globalThis<"u"){if(!globalThis.__rip)Function(J1())();if(!globalThis.__ripComponent)Function(K1())()}var r3=(f)=>{let U=f.match(/^[ \t]*(?=\S)/gm),W=Math.min(...(U||[]).map((F)=>F.length));return f.replace(RegExp(`^[ ]{${W}}`,"gm"),"").trim()};async function E2(){let f=[],U=document.querySelector('script[src$="rip.min.js"], script[src$="rip.js"]'),W=U?.getAttribute("data-src");if(W){for(let F of W.trim().split(/\s+/))if(F)f.push({url:F})}for(let F of document.querySelectorAll('script[type="text/rip"]'))if(F.src)f.push({url:F.src});else{let u=r3(F.textContent);if(u)f.push({code:u})}if(f.length>0){let F=await Promise.allSettled(f.map(async(A)=>{if(!A.url)return;let R=await fetch(A.url);if(!R.ok)throw Error(`${A.url} (${R.status})`);if(A.url.endsWith(".rip"))A.code=await R.text();else{let w=await R.json();A.bundle=w}}));for(let A of F)if(A.status==="rejected")console.warn("Rip: fetch failed:",A.reason.message);let u=[],$=[];for(let A of f)if(A.bundle)u.push(A.bundle);else if(A.code)$.push(A);let Y=U?.getAttribute("data-router");if(Y!=null&&u.length>0){let A={skipRuntimes:!0,skipExports:!0};if($.length>0){let w="";for(let z of $)try{w+=a(z.code,A)+`
722
+ `}function J1(){return new x({}).getReactiveRuntime()}function K1(){return new x({}).getComponentRuntime()}var q2="3.13.96",P2="2026-03-12@01:03:48GMT";if(typeof globalThis<"u"){if(!globalThis.__rip)Function(J1())();if(!globalThis.__ripComponent)Function(K1())()}var r3=(f)=>{let U=f.match(/^[ \t]*(?=\S)/gm),W=Math.min(...(U||[]).map((F)=>F.length));return f.replace(RegExp(`^[ ]{${W}}`,"gm"),"").trim()};async function E2(){let f=[],U=document.querySelector('script[src$="rip.min.js"], script[src$="rip.js"]'),W=U?.getAttribute("data-src");if(W){for(let F of W.trim().split(/\s+/))if(F)f.push({url:F})}for(let F of document.querySelectorAll('script[type="text/rip"]'))if(F.src)f.push({url:F.src});else{let u=r3(F.textContent);if(u)f.push({code:u})}if(f.length>0){let F=await Promise.allSettled(f.map(async(A)=>{if(!A.url)return;let R=await fetch(A.url);if(!R.ok)throw Error(`${A.url} (${R.status})`);if(A.url.endsWith(".rip"))A.code=await R.text();else{let w=await R.json();A.bundle=w}}));for(let A of F)if(A.status==="rejected")console.warn("Rip: fetch failed:",A.reason.message);let u=[],$=[];for(let A of f)if(A.bundle)u.push(A.bundle);else if(A.code)$.push(A);let Y=U?.getAttribute("data-router");if(Y!=null&&u.length>0){let A={skipRuntimes:!0,skipExports:!0};if($.length>0){let w="";for(let z of $)try{w+=a(z.code,A)+`
723
723
  `}catch(Q){console.error(`Rip compile error in ${z.url||"inline"}:`,Q.message)}if(w)try{await(0,eval)(`(async()=>{
724
724
  ${w}
725
725
  })()`)}catch(z){console.error("Rip runtime error:",z)}}let R=U1.modules?.["ui.rip"];if(R?.launch){let w=u[u.length-1],z=U.getAttribute("data-persist"),Q={bundle:w,hash:Y==="hash"};if(z!=null)Q.persist=z==="local"?"local":!0;await R.launch("",Q)}}else{let A=[];for(let z of u){for(let[Q,D]of Object.entries(z.components||{}))A.push({code:D,url:Q});if(z.data){let Q=U?.getAttribute("data-state"),D={};if(Q)try{D=JSON.parse(Q)}catch{}Object.assign(D,z.data),U?.setAttribute("data-state",JSON.stringify(D))}}A.push(...$);let R={skipRuntimes:!0,skipExports:!0},w=[];for(let z of A){if(!z.code)continue;try{let Q=a(z.code,R);w.push({js:Q,url:z.url||"inline"})}catch(Q){console.error(`Rip compile error in ${z.url||"inline"}:`,Q.message)}}if(!globalThis.__ripApp&&U){let z=globalThis.stash;if(z){let Q={},D=U.getAttribute("data-state");if(D)try{Q=JSON.parse(D)}catch(X){console.error("Rip: invalid data-state JSON:",X.message)}let J=z({data:Q});if(globalThis.__ripApp=J,typeof window<"u")window.app=J;let M=U.getAttribute("data-persist");if(M!=null&&globalThis.persistStash)globalThis.persistStash(J,{local:M==="local"})}}if(w.length>0){let z=w.map((D)=>D.js).join(`
@@ -732,4 +732,4 @@ ${J.js}
732
732
  `,u=new Blob([F+W],{type:"application/javascript"});return await import(URL.createObjectURL(u))}U1.modules={};function I2(f){try{let U=f.replace(/^/gm," "),F=a(`do ->
733
733
  ${U}`).replace(/^let\s+[^;]+;\s*\n\s*/m,"");F=F.replace(/^const\s+(\w+)\s*=/gm,"globalThis.$1 =");let u=(0,eval)(F);if(u&&typeof u.then==="function")return u.then(($)=>{if($!==void 0)globalThis._=$;return $});if(u!==void 0)globalThis._=u;return u}catch(U){console.error("Rip compilation error:",U.message);return}}if(typeof globalThis<"u")globalThis.rip=I2,globalThis.importRip=U1,globalThis.compileToJS=a,globalThis.__ripExports={compile:I1,compileToJS:a,formatSExpr:r,getStdlibCode:X1,VERSION:q2,BUILD_DATE:P2,getReactiveRuntime:J1,getComponentRuntime:K1};if(typeof document<"u")globalThis.__ripScriptsReady=new Promise((f)=>{let U=()=>E2().then(f);if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>queueMicrotask(U));else queueMicrotask(U)});var T1={};f2(T1,{throttle:()=>t3,stash:()=>n2,setContext:()=>x2,raw:()=>p1,persistStash:()=>p2,launch:()=>u7,isStash:()=>o3,hold:()=>e3,hasContext:()=>v2,getContext:()=>b2,delay:()=>d2,debounce:()=>s3,createRouter:()=>o2,createResource:()=>a3,createRenderer:()=>a2,createComponents:()=>r2});var B2,k1,d1,R1,u1,L1,N2,W1,v,L2,l,T2,S2,m1,H1,O1,r1,h2,V2,B1,N1,j2,C2,y2,i1,n1,b2,c2,o1,v2,M1,a1,g2,l2,x2,k2,m2,s1,i2;globalThis.abort??=(f)=>{if(f)console.error(f);process.exit(1)};globalThis.assert??=(f,U)=>{if(!f)throw Error(U||"Assertion failed")};globalThis.exit??=(f)=>process.exit(f||0);globalThis.kind??=(f)=>f!=null?(f.constructor?.name||Object.prototype.toString.call(f).slice(8,-1)).toLowerCase():String(f);globalThis.noop??=()=>{};globalThis.p??=console.log;globalThis.pp??=(f)=>{return console.log(JSON.stringify(f,null,2)),f};globalThis.raise??=(f,U)=>{throw U!==void 0?new f(U):Error(f)};globalThis.rand??=(f,U)=>U!==void 0?(f>U&&([f,U]=[U,f]),Math.floor(Math.random()*(U-f+1)+f)):f?Math.floor(Math.random()*f):Math.random();globalThis.sleep??=(f)=>new Promise((U)=>setTimeout(U,f));globalThis.todo??=(f)=>{throw Error(f||"Not implemented")};globalThis.warn??=console.warn;globalThis.zip??=(...f)=>f[0].map((U,W)=>f.map((F)=>F[W]));({__state:v,__effect:W1,__batch:N2}=globalThis.__rip);({setContext:x2,getContext:b2,hasContext:v2}=globalThis.__ripComponent||{});L1=Symbol("stash");u1=Symbol("signals");R1=Symbol("raw");k1=Symbol("persisted");d1=new WeakMap;m1=0;r1=v(0);o1=function(f,U){let W;if(!f[u1])Object.defineProperty(f,u1,{value:new Map,enumerable:!1});if(W=f[u1].get(U),!W)W=v(f[U]),f[u1].set(U,W);return W};M1=function(f){return o1(f,Symbol.for("keys"))};i2=function(f){let U;if(!(f!=null&&typeof f==="object"))return f;if(f[L1])return f;if(f instanceof Date||f instanceof RegExp||f instanceof Map||f instanceof Set||f instanceof Promise)return f;if(U=d1.get(f),U)return U;return a1(f)};a1=function(f){let U,W;return W=null,U={get:function(F,u){let $,Y;if(u===L1)return!0;if(u===R1)return F;if(typeof u==="symbol")return Reflect.get(F,u);if(u==="length"&&Array.isArray(F))return M1(F).value,F.length;if(u==="get")return function(_){return k2(W,_)};if(u==="set")return function(_,A){return m2(W,_,A)};if($=o1(F,u),Y=$.value,Y!=null&&typeof Y==="object")return i2(Y);return Y},set:function(F,u,$){let Y,_;if(Y=F[u],_=$?.[R1]?$[R1]:$,_===Y)return!0;if(F[u]=_,F[u1]?.has(u))F[u1].get(u).value=_;if(Y===void 0&&_!==void 0)M1(F).value=++m1;return r1.value++,!0},deleteProperty:function(F,u){let $;if(delete F[u],$=F[u1]?.get(u),$!=null)$.value=void 0;return M1(F).value=++m1,!0},ownKeys:function(F){return M1(F).value,Reflect.ownKeys(F)}},W=new Proxy(f,U),d1.set(f,W),W};B2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;s1=function(f){let U,W,F,u,$;F=("."+f).split(B2),F.shift(),$=[],W=0;while(W<F.length){if(u=F[W],U=u[0],U==="."||U==="/")$.push(u.slice(1));else if(U==="[")if(u[1]==='"'||u[1]==="'")$.push(u.slice(2,-2));else $.push(+u.slice(1,-1));W+=2}return $};k2=function(f,U){let W,F;F=s1(U),W=f;for(let u of F){if(W==null)return;W=W[u]}return W};m2=function(f,U,W){let F,u;u=s1(U),F=f;for(let $=0;$<u.length;$++){let Y=u[$];if($===u.length-1)F[Y]=W;else{if(F[Y]==null)F[Y]={};F=F[Y]}}return W};var n2=function(f={}){return a1(f)},p1=function(f){return f?.[R1]?f[R1]:f},o3=function(f){return f?.[L1]===!0},p2=function(f,U={}){let W,F,u,$,Y,_;if(_=p1(f)||f,_[k1])return;_[k1]=!0,$=U.local?localStorage:sessionStorage,Y=U.key||"__rip_app";try{if(F=$.getItem(Y),F){u=JSON.parse(F);for(let A in u){let R=u[A];f.data[A]=R}}}catch{}return W=function(){return(()=>{try{return $.setItem(Y,JSON.stringify(p1(f.data)))}catch{return null}})()},W1(function(){let A;return r1.value,A=setTimeout(W,2000),function(){return clearTimeout(A)}}),window.addEventListener("beforeunload",W)},a3=function(f,U={}){let W,F,u,$,Y;if(W=v(U.initial||null),u=v(!1),F=v(null),$=async function(){let _;return u.value=!0,F.value=null,(async()=>{try{return _=await f(),W.value=_}catch(A){return F.value=A}finally{u.value=!1}})()},Y={data:void 0,loading:void 0,error:void 0,refetch:$},Object.defineProperty(Y,"data",{get:function(){return W.value}}),Object.defineProperty(Y,"loading",{get:function(){return u.value}}),Object.defineProperty(Y,"error",{get:function(){return F.value}}),!U.lazy)$();return Y};O1=function(f){return typeof f==="function"?f:function(){return f.value}};H1=function(f,U){let W;return W={read:function(){return f.read()}},Object.defineProperty(W,"value",{get:function(){return f.value},set:function(F){return U.value=F}}),W};var d2=function(f,U){let W,F;return W=O1(U),F=v(!!W()),W1(function(){let u;if(W())return u=setTimeout(function(){return F.value=!0},f),function(){return clearTimeout(u)};else return F.value=!1}),typeof U!=="function"?H1(F,U):F},s3=function(f,U){let W,F;return W=O1(U),F=v(W()),W1(function(){let u,$;return $=W(),u=setTimeout(function(){return F.value=$},f),function(){return clearTimeout(u)}}),typeof U!=="function"?H1(F,U):F},t3=function(f,U){let W,F,u;return W=O1(U),u=v(W()),F=0,W1(function(){let $,Y,_,A;if(A=W(),$=Date.now(),Y=f-($-F),Y<=0)return u.value=A,F=$;else return _=setTimeout(function(){return u.value=W(),F=Date.now()},Y),function(){return clearTimeout(_)}}),typeof U!=="function"?H1(u,U):u},e3=function(f,U){let W,F;return W=O1(U),F=v(!!W()),W1(function(){let u;if(W())return F.value=!0;else return u=setTimeout(function(){return F.value=!1},f),function(){return clearTimeout(u)}}),typeof U!=="function"?H1(F,U):F},r2=function(){let f,U,W,F;return U=new Map,F=[],f=new Map,W=function(u,$){for(let Y of F)Y(u,$)},{read:function(u){return U.get(u)},write:function(u,$){let Y;return Y=!U.has(u),U.set(u,$),f.delete(u),W(Y?"create":"change",u)},del:function(u){return U.delete(u),f.delete(u),W("delete",u)},exists:function(u){return U.has(u)},size:function(){return U.size},list:function(u=""){let $,Y,_;_=[],$=u?u+"/":"";for(let[A]of U)if(A.startsWith($)){if(Y=A.slice($.length),Y.includes("/"))continue;_.push(A)}return _},listAll:function(u=""){let $,Y;Y=[],$=u?u+"/":"";for(let[_]of U)if(_.startsWith($))Y.push(_);return Y},load:function(u){for(let $ in u){let Y=u[$];U.set($,Y)}},watch:function(u){return F.push(u),function(){return F.splice(F.indexOf(u),1)}},getCompiled:function(u){return f.get(u)},setCompiled:function(u,$){return f.set(u,$)}}};y2=function(f){let U;if(U=f.replace(/\.rip$/,""),U=U.replace(/\[\.\.\.(\w+)\]/g,"*$1"),U=U.replace(/\[(\w+)\]/g,":$1"),U==="index")return"/";return U=U.replace(/\/index$/,""),"/"+U};l2=function(f){let U,W;return U=[],W=f.replace(/\*(\w+)/g,function(F,u){return U.push(u),"(.+)"}).replace(/:(\w+)/g,function(F,u){return U.push(u),"([^/]+)"}),{regex:new RegExp("^"+W+"$"),names:U}};g2=function(f,U){let W,F;for(let u of U)if(W=f.match(u.regex.regex),W){F={};for(let $=0;$<u.regex.names.length;$++){let Y=u.regex.names[$];F[Y]=decodeURIComponent(W[$+1])}return{route:u,params:F}}return null};B1=function(f,U="components"){let W,F,u,$,Y,_,A,R,w;A=[],u=new Map,W=f.listAll(U);for(let z of W){if(_=z.slice(U.length+1),!_.endsWith(".rip"))continue;if($=_.split("/").pop(),$==="_layout.rip"){F=_==="_layout.rip"?"":_.slice(0,-12),u.set(F,z);continue}if($.startsWith("_"))continue;if(R=_.split("/"),R.length>1&&R.some(function(Q,D){return D<R.length-1&&Q.startsWith("_")}))continue;w=y2(_),Y=l2(w),A.push({pattern:w,regex:Y,file:z,rel:_})}return A.sort(function(z,Q){let D,J,M,X;if(J=(z.pattern.match(/:/g)||[]).length,X=(Q.pattern.match(/:/g)||[]).length,D=z.pattern.includes("*")?1:0,M=Q.pattern.includes("*")?1:0,D!==M)return D-M;if(J!==X)return J-X;return z.pattern.localeCompare(Q.pattern)}),{routes:A,layouts:u}};c2=function(f,U,W){let F,u,$,Y;if(F=[],$=f.slice(U.length+1),Y=$.split("/"),u="",W.has(""))F.push(W.get(""));for(let _=0;_<Y.length;_++){let A=Y[_];if(_===Y.length-1)break;if(u=u?u+"/"+A:A,W.has(u))F.push(W.get(u))}return F};var o2=function(f,U={}){let W,F,u,$,Y,_,A,R,w,z,Q,D,J,M,X,Z,H,K,G,P,q;if(H=U.root||"components",w=U.base||"",z=U.hash||!1,J=U.onError||null,G=function(O){return w&&O.startsWith(w)?O.slice(w.length)||"/":O},R=function(O){return w?w+O:O},X=function(){let O;if(z){if(O=location.hash.slice(1),!O)return"/";return O[0]==="/"?O:"/"+O}else return location.pathname+location.search+location.hash},q=function(O){return z?O==="/"?location.pathname:"#"+O.slice(1):R(O)},Y=v(G(z?X():location.pathname)),$=v({}),A=v(null),F=v([]),_=v({}),W=v(""),u=d2(100,v(!1)),P=B1(f,H),Q=new Set,f.watch(function(O,E){if(!E.startsWith(H+"/"))return;return P=B1(f,H)}),Z=function(O){let E,I,N,T,B;if(T=O.split("?")[0].split("#")[0],I=G(T),I=I[0]==="/"?I:"/"+I,N=O.split("?")[1]?.split("#")[0]||"",E=O.includes("#")?O.split("#")[1]:"",B=g2(I,P.routes),B){N2(function(){return Y.value=I,$.value=B.params,A.value=B.route,F.value=c2(B.route.file,H,P.layouts),_.value=Object.fromEntries(new URLSearchParams(N)),W.value=E});for(let C of Q)C(K.current);return!0}if(J)J({status:404,path:I});return!1},M=function(){return Z(X())},typeof window<"u")window.addEventListener("popstate",M);if(D=function(O){let E,I,N;if(O.button!==0||O.metaKey||O.ctrlKey||O.shiftKey||O.altKey)return;I=O.target;while(I&&I.tagName!=="A")I=I.parentElement;if(!I?.href)return;if(N=new URL(I.href,location.origin),N.origin!==location.origin)return;if(I.target==="_blank"||I.hasAttribute("data-external"))return;return O.preventDefault(),E=z&&N.hash?N.hash.slice(1)||"/":N.pathname+N.search+N.hash,K.push(E)},typeof document<"u")document.addEventListener("click",D);return K={push:function(O){return Z(O)?history.pushState(null,"",q(Y.read())):void 0},replace:function(O){return Z(O)?history.replaceState(null,"",q(Y.read())):void 0},back:function(){return history.back()},forward:function(){return history.forward()},current:void 0,path:void 0,params:void 0,route:void 0,layouts:void 0,query:void 0,hash:void 0,navigating:void 0,onNavigate:function(O){return Q.add(O),function(){return Q.delete(O)}},rebuild:function(){return P=B1(f,H)},routes:void 0,init:function(){return Z(X()),K},destroy:function(){if(typeof window<"u")window.removeEventListener("popstate",M);if(typeof document<"u")document.removeEventListener("click",D);return Q.clear()}},Object.defineProperty(K,"current",{get:function(){return{path:Y.value,params:$.value,route:A.value,layouts:F.value,query:_.value,hash:W.value}}}),Object.defineProperty(K,"path",{get:function(){return Y.value}}),Object.defineProperty(K,"params",{get:function(){return $.value}}),Object.defineProperty(K,"route",{get:function(){return A.value}}),Object.defineProperty(K,"layouts",{get:function(){return F.value}}),Object.defineProperty(K,"query",{get:function(){return _.value}}),Object.defineProperty(K,"hash",{get:function(){return W.value}}),Object.defineProperty(K,"navigating",{get:function(){return u.value},set:function(O){return u.value=O}}),Object.defineProperty(K,"routes",{get:function(){return P.routes}}),K};h2=function(f,U){if(f.length!==U.length)return!1;for(let W=0;W<f.length;W++)if(f[W]!==U[W])return!1;return!0};n1=function(f){for(let U in f){let W=f[U];if(typeof W==="function"&&(W.prototype?.mount||W.prototype?._create))return W}return typeof f.default==="function"?f.default:void 0};i1=function(f){let U;U={};for(let W in f){let F=f[W];if(typeof F==="function"&&(F.prototype?.mount||F.prototype?._create))U[W]=F}return U};C2=function(f){let U;return U=f.split("/").pop().replace(/\.rip$/,""),U.replace(/(^|[-_])([a-z])/g,function(W,F,u){return u.toUpperCase()})};V2=function(f,U="components"){let W,F,u;F={};for(let $ of f.listAll(U)){if(!$.endsWith(".rip"))continue;if(W=$.split("/").pop(),W.startsWith("_"))continue;if(u=C2($),F[u])console.warn(`[Rip] Component name collision: ${u} (${F[u]} vs ${$})`);F[u]=$}return F};N1=async function(f,U,W=null,F=null,u=null){let $,Y,_,A,R,w,z,Q,D,J,M,X;if(W&&F){if(Y=W.getCompiled(F),Y)return Y}if(z=U(f),u){J={};for(let Z in u.map){let H=u.map[Z];if(H!==F&&z.includes(`new ${Z}(`)){if(!u.classes[Z]){if(A=W.read(H),A){_=await N1(A,U,W,H,u),R=i1(_);for(let K in R){let G=R[K];u.classes[K]=G}}}if(u.classes[Z])J[Z]=!0}}if(D=Object.keys(J),D.length>0)M=`const {${D.join(", ")}} = globalThis['${u.key}'];
734
734
  `,z=M+z}if(w=F?`// ${F}
735
- `:"",$=new Blob([w+z],{type:"application/javascript"}),X=URL.createObjectURL($),Q=await import(X),u){R=i1(Q);for(let Z in R){let H=R[Z];u.classes[Z]=H}}if(W&&F)W.setCompiled(F,Q);return Q};var a2=function(f={}){let U,W,F,u,$,Y,_,A,R,w,z,Q,D,J,M,X,Z,H,K,G,P,q;if({router:G,app:U,components:$,resolver:K,compile:F,target:P,onError:Z}=f,Y=typeof P==="string"?document.querySelector(P):P||document.getElementById("app"),!Y)Y=document.createElement("div"),Y.id="app",document.body.appendChild(Y);return Y.style.opacity="0",_=null,w=null,R=null,A=[],D=[],M=Y,Q=0,z=null,u=new Map,J=f.cacheSize||10,W=function(){let O,E;if(_&&w){if(_.beforeUnmount)_.beforeUnmount();if(u.set(w,_),u.size>J){if(E=u.keys().next().value,O=u.get(E),O.unmounted)O.unmounted();u.delete(E)}return _=null,w=null}},q=function(){W();for(let O=D.length-1;O>=0;O--){let E=D[O];if(E.beforeUnmount)E.beforeUnmount();if(E.unmounted)E.unmounted();E._target?.remove()}return D=[],M=Y},$.watch(function(O,E){let I;if(u.has(E)){if(I=u.get(E),I.unmounted)I.unmounted();return u.delete(E)}}),X=async function(O){let E,I,N,T,B,C,L,h,S,j,b,i,c,g,m,s,F1,S1,k,t1,h1,_1;if({route:k,params:s,layouts:h,query:S1}=O,!k)return;if(k.file===w&&JSON.stringify(s)===JSON.stringify(R))return;return R=s,T=++Q,G.navigating=!0,(async()=>{try{if(h1=$.read(k.file),!h1){if(Z)Z({status:404,message:`File not found: ${k.file}`});G.navigating=!1;return}if(i=await N1(h1,F,$,k.file,K),T!==Q){G.navigating=!1;return}if(E=n1(i),!E){if(Z)Z({status:500,message:`No component found in ${k.file}`});G.navigating=!1;return}if(b=!h2(h,A),g=_?._target,b)q();else W();if(c=b?Y:M,b&&h.length>0){Y.innerHTML="",c=Y;for(let p of h){if(j=$.read(p),!j)continue;if(S=await N1(j,F,$,p,K),T!==Q){G.navigating=!1;return}if(I=n1(S),!I)continue;if(C=new I({app:U,params:s,router:G}),C.beforeMount)C.beforeMount();_1=document.createElement("div"),_1.setAttribute("data-layout",p),c.appendChild(_1),C.mount(_1),D.push(C),t1=_1.querySelector("#content")||_1,c=t1}A=[...h],M=c}else if(b)Y.innerHTML="",A=[],M=Y;if(N=u.get(k.file),N)u.delete(k.file),c.appendChild(N._target),_=N,w=k.file;else{if(m=document.createElement("div"),m.setAttribute("data-component",k.file),c.appendChild(m),L=new E({app:U,params:s,query:S1,router:G}),L.beforeMount)L.beforeMount();if(L.mount(m),_=L,w=k.file,L.load)await L.load(s,S1)}return g?.remove(),G.navigating=!1,Y.style.opacity==="0"?document.fonts.ready.then(function(){return requestAnimationFrame(function(){return Y.style.transition="opacity 150ms ease-in",Y.style.opacity="1"})}):void 0}catch(p){if(G.navigating=!1,Y.style.opacity="1",console.error(`Renderer: error mounting ${k.file}:`,p),Z)Z({status:500,message:p.message,error:p});B=!1;for(let V1=D.length-1;V1>=0;V1--){let e1=D[V1];if(e1.onError)try{e1.onError(p),B=!0;break}catch(s2){console.error("Renderer: error boundary failed:",s2)}}return(()=>{if(!B)return F1=document.createElement("pre"),F1.style.cssText="color:red;padding:1em",F1.textContent=p.stack||p.message,Y.innerHTML="",Y.appendChild(F1)})()}})()},H={start:function(){return z=W1(function(){let O;return O=G.current,O.route?X(O):void 0}),G.init(),H},stop:function(){if(q(),z)z(),z=null;return Y.innerHTML=""},remount:function(){let O;return O=G.current,O.route?X(O):void 0},cache:u},H};j2=function(f){let U,W,F;return F=1000,W=30000,U=function(){let u;return u=new EventSource(f),u.addEventListener("connected",function(){return F=1000,console.log("[Rip] Hot reload connected")}),u.addEventListener("reload",function(){return console.log("[Rip] Reloading..."),location.reload()}),u.addEventListener("css",function(){for(let $ of document.querySelectorAll('link[rel="stylesheet"]'))f=new URL($.href),f.searchParams.set("_t",Date.now()),$.href=f.toString()}),u.onerror=function(){return u.close(),setTimeout(U,F),F=Math.min(F*2,W)}},U()};var u7=async function(f="",U={}){let W,F,u,$,Y,_,A,R,w,z,Q,D,J,M,X,Z,H;if(globalThis.__ripLaunched=!0,typeof f==="object")U=f,f="";if(f=f.replace(/\/+$/,""),H=U.target||"#app",_=U.compile||null,D=U.persist||!1,z=U.hash||!1,!_)_=globalThis?.compileToJS||null;if(typeof document<"u"&&!document.querySelector(H))A=document.createElement("div"),A.id=H.replace(/^#/,""),document.body.prepend(A);if(U.bundle)u=U.bundle;else if(U.bundleUrl){if(Q={},w=`__rip_etag_${U.bundleUrl}`,$=sessionStorage.getItem(w),$)Q["If-None-Match"]=$;if(M=await fetch(U.bundleUrl,{headers:Q}),M.status===304)u=JSON.parse(sessionStorage.getItem(`${w}_data`));else if(M.ok){if(u=await M.json(),R=M.headers.get("etag"),R)sessionStorage.setItem(w,R),sessionStorage.setItem(`${w}_data`,JSON.stringify(u))}else throw Error(`launch: ${U.bundleUrl} (${M.status})`)}else throw Error("launch: no bundle or bundleUrl provided");if(W=n2({components:{},routes:{},data:{}}),globalThis.__ripApp=W,u.data)W.data=u.data;if(u.routes)W.routes=u.routes;if(D&&typeof sessionStorage<"u")p2(W,{local:D==="local",key:`__rip_${f}`});if(F=r2(),u.components)F.load(u.components);if(Y=`__rip_${f.replace(/\//g,"_")||"app"}`,X={map:V2(F),classes:{},key:Y},typeof globalThis<"u")globalThis[Y]=X.classes;if(W.data.title&&typeof document<"u")document.title=W.data.title;if(Z=o2(F,{root:"components",base:f,hash:z,onError:function(K){return console.error(`[Rip] Error ${K.status}: ${K.message||K.path}`)}}),J=a2({router:Z,app:W,components:F,resolver:X,compile:_,target:H,onError:function(K){return console.error(`[Rip] ${K.message}`,K.error)}}),J.start(),u.data?.watch)j2(`${f}/watch`);if(typeof window<"u")window.app=W,window.__RIP__={app:W,components:F,router:Z,renderer:J,cache:J.cache,version:"0.3.0"};return{app:W,components:F,router:Z,renderer:J}};l=function(f,U){if(!U)return;return f.preventDefault(),f.stopPropagation(),U()};L2=function(f,U){if(f.which===229)return;return(()=>{switch(f.key){case"ArrowDown":return l(f,U.next);case"ArrowUp":return l(f,U.prev);case"Home":case"PageUp":return l(f,U.first);case"End":case"PageDown":return l(f,U.last);case"Enter":case" ":return l(f,U.select);case"Escape":return l(f,U.dismiss);case"Tab":return U.tab?.();default:return f.key.length===1?U.char?.(f.key):void 0}})()};T2=function(f,U,W,F=[]){let u,$,Y;if(!f)return;return u=[U,...F],$=(_)=>!u.some(function(A){return A?.contains(_.target)})?W():void 0,Y=(_)=>!U?.contains(_.target)?W():void 0,document.addEventListener("mousedown",$),window.addEventListener("scroll",Y,!0),function(){return document.removeEventListener("mousedown",$),window.removeEventListener("scroll",Y,!0)}};S2=function(f,U,W="vertical"){let F,u;if(f.which===229)return;return u=W!=="horizontal",F=W!=="vertical",(()=>{switch(f.key){case"ArrowDown":return u?l(f,U.next):void 0;case"ArrowUp":return u?l(f,U.prev):void 0;case"ArrowRight":return F?l(f,U.next):void 0;case"ArrowLeft":return F?l(f,U.prev):void 0;case"Home":case"PageUp":return l(f,U.first);case"End":case"PageDown":return l(f,U.last);case"Enter":case" ":return l(f,U.select);case"Escape":return l(f,U.dismiss)}})()};globalThis.__aria??={listNav:L2,rovingNav:S2,popupDismiss:T2};globalThis.ARIA??=globalThis.__aria;U1.modules["ui.rip"]=T1;for(let[f,U]of Object.entries(T1))if(typeof U==="function")globalThis[f]=U;})();
735
+ `:"",$=new Blob([w+z],{type:"application/javascript"}),X=URL.createObjectURL($),Q=await import(X),u){R=i1(Q);for(let Z in R){let H=R[Z];u.classes[Z]=H}}if(W&&F)W.setCompiled(F,Q);return Q};var a2=function(f={}){let U,W,F,u,$,Y,_,A,R,w,z,Q,D,J,M,X,Z,H,K,G,P,q;if({router:G,app:U,components:$,resolver:K,compile:F,target:P,onError:Z}=f,Y=typeof P==="string"?document.querySelector(P):P||document.getElementById("app"),!Y)Y=document.createElement("div"),Y.id="app",document.body.appendChild(Y);return Y.style.opacity="0",_=null,w=null,R=null,A=[],D=[],M=Y,Q=0,z=null,u=new Map,J=f.cacheSize||10,W=function(){let O,E;if(_&&w){if(_.beforeUnmount)_.beforeUnmount();if(u.set(w,_),u.size>J){if(E=u.keys().next().value,O=u.get(E),O.unmounted)O.unmounted();u.delete(E)}return _=null,w=null}},q=function(){W();for(let O=D.length-1;O>=0;O--){let E=D[O];if(E.beforeUnmount)E.beforeUnmount();if(E.unmounted)E.unmounted();E._target?.remove()}return D=[],M=Y},$.watch(function(O,E){let I;if(u.has(E)){if(I=u.get(E),I.unmounted)I.unmounted();return u.delete(E)}}),X=async function(O){let E,I,N,T,B,C,L,h,S,j,b,i,c,g,m,s,F1,S1,k,t1,h1,_1;if({route:k,params:s,layouts:h,query:S1}=O,!k)return;if(k.file===w&&JSON.stringify(s)===JSON.stringify(R))return;return R=s,T=++Q,G.navigating=!0,(async()=>{try{if(h1=$.read(k.file),!h1){if(Z)Z({status:404,message:`File not found: ${k.file}`});G.navigating=!1;return}if(i=await N1(h1,F,$,k.file,K),T!==Q){G.navigating=!1;return}if(E=n1(i),!E){if(Z)Z({status:500,message:`No component found in ${k.file}`});G.navigating=!1;return}if(b=!h2(h,A),g=_?._target,b)q();else W();if(c=b?Y:M,b&&h.length>0){Y.innerHTML="",c=Y;for(let p of h){if(j=$.read(p),!j)continue;if(S=await N1(j,F,$,p,K),T!==Q){G.navigating=!1;return}if(I=n1(S),!I)continue;if(C=new I({app:U,params:s,router:G}),C.beforeMount)C.beforeMount();_1=document.createElement("div"),_1.setAttribute("data-layout",p),c.appendChild(_1),C.mount(_1),D.push(C),t1=_1.querySelector("#content")||_1,c=t1}A=[...h],M=c}else if(b)Y.innerHTML="",A=[],M=Y;if(N=u.get(k.file),N)u.delete(k.file),c.appendChild(N._target),_=N,w=k.file;else{if(m=document.createElement("div"),m.setAttribute("data-component",k.file),c.appendChild(m),L=new E({app:U,params:s,query:S1,router:G}),L.beforeMount)L.beforeMount();if(L.mount(m),_=L,w=k.file,L.load)await L.load(s,S1)}return g?.remove(),G.navigating=!1,Y.style.opacity==="0"?document.fonts.ready.then(function(){return requestAnimationFrame(function(){return Y.style.transition="opacity 150ms ease-in",Y.style.opacity="1"})}):void 0}catch(p){if(G.navigating=!1,Y.style.opacity="1",console.error(`Renderer: error mounting ${k.file}:`,p),Z)Z({status:500,message:p.message,error:p});B=!1;for(let V1=D.length-1;V1>=0;V1--){let e1=D[V1];if(e1.onError)try{e1.onError(p),B=!0;break}catch(s2){console.error("Renderer: error boundary failed:",s2)}}return(()=>{if(!B)return F1=document.createElement("pre"),F1.style.cssText="color:red;padding:1em",F1.textContent=p.stack||p.message,Y.innerHTML="",Y.appendChild(F1)})()}})()},H={start:function(){return z=W1(function(){let O;return O=G.current,O.route?X(O):void 0}),G.init(),H},stop:function(){if(q(),z)z(),z=null;return Y.innerHTML=""},remount:function(){let O;return O=G.current,O.route?X(O):void 0},cache:u},H};j2=function(f){let U,W,F;return F=1000,W=30000,U=function(){let u;return u=new EventSource(f),u.addEventListener("connected",function(){return F=1000,console.log("[Rip] Hot reload connected")}),u.addEventListener("reload",function(){return console.log("[Rip] Reloading..."),location.reload()}),u.addEventListener("css",function(){for(let $ of document.querySelectorAll('link[rel="stylesheet"]'))f=new URL($.href),f.searchParams.set("_t",Date.now()),$.href=f.toString()}),u.onerror=function(){return u.close(),setTimeout(U,F),F=Math.min(F*2,W)}},U()};var u7=async function(f="",U={}){let W,F,u,$,Y,_,A,R,w,z,Q,D,J,M,X,Z,H;if(globalThis.__ripLaunched=!0,typeof f==="object")U=f,f="";if(f=f.replace(/\/+$/,""),H=U.target||"#app",_=U.compile||null,D=U.persist||!1,z=U.hash||!1,!_)_=globalThis?.compileToJS||null;if(typeof document<"u"&&!document.querySelector(H))A=document.createElement("div"),A.id=H.replace(/^#/,""),document.body.prepend(A);if(U.bundle)u=U.bundle;else if(U.bundleUrl){if(Q={},w=`__rip_etag_${U.bundleUrl}`,$=sessionStorage.getItem(w),$)Q["If-None-Match"]=$;if(M=await fetch(U.bundleUrl,{headers:Q}),M.status===304)u=JSON.parse(sessionStorage.getItem(`${w}_data`));else if(M.ok){if(u=await M.json(),R=M.headers.get("etag"),R)sessionStorage.setItem(w,R),sessionStorage.setItem(`${w}_data`,JSON.stringify(u))}else throw Error(`launch: ${U.bundleUrl} (${M.status})`)}else throw Error("launch: no bundle or bundleUrl provided");if(W=n2({components:{},routes:{},data:{}}),globalThis.__ripApp=W,u.data)W.data=u.data;if(u.routes)W.routes=u.routes;if(D&&typeof sessionStorage<"u")p2(W,{local:D==="local",key:`__rip_${f}`});if(F=r2(),u.components)F.load(u.components);if(Y=`__rip_${f.replace(/\//g,"_")||"app"}`,X={map:V2(F),classes:{},key:Y},typeof globalThis<"u")globalThis[Y]=X.classes;if(W.data.title&&typeof document<"u")document.title=W.data.title;if(Z=o2(F,{root:"components",base:f,hash:z,onError:function(K){return console.error(`[Rip] Error ${K.status}: ${K.message||K.path}`)}}),J=a2({router:Z,app:W,components:F,resolver:X,compile:_,target:H,onError:function(K){return console.error(`[Rip] ${K.message}`,K.error)}}),J.start(),u.data?.watch)j2(`${f}/watch`);if(typeof window<"u")window.app=W,window.__RIP__={app:W,components:F,router:Z,renderer:J,cache:J.cache,version:"0.3.0"};return{app:W,components:F,router:Z,renderer:J}};l=function(f,U){if(!U)return;return f.preventDefault(),f.stopPropagation(),U()};L2=function(f,U){if(f.which===229)return;return(()=>{switch(f.key){case"ArrowDown":return l(f,U.next);case"ArrowUp":return l(f,U.prev);case"Home":case"PageUp":return l(f,U.first);case"End":case"PageDown":return l(f,U.last);case"Enter":case" ":return l(f,U.select);case"Escape":return l(f,U.dismiss);case"Tab":return U.tab?.();default:return f.key.length===1?U.char?.(f.key):void 0}})()};T2=function(f,U,W,F=[]){let u,$,Y;if(!f)return;return u=function(_){return typeof _==="function"?_():_},$=(_)=>![u(U),...F.map(u)].some(function(A){return A?.contains(_.target)})?W():void 0,Y=(_)=>!u(U)?.contains(_.target)?W():void 0,document.addEventListener("mousedown",$),window.addEventListener("scroll",Y,!0),function(){return document.removeEventListener("mousedown",$),window.removeEventListener("scroll",Y,!0)}};S2=function(f,U,W="vertical"){let F,u;if(f.which===229)return;return u=W!=="horizontal",F=W!=="vertical",(()=>{switch(f.key){case"ArrowDown":return u?l(f,U.next):void 0;case"ArrowUp":return u?l(f,U.prev):void 0;case"ArrowRight":return F?l(f,U.next):void 0;case"ArrowLeft":return F?l(f,U.prev):void 0;case"Home":case"PageUp":return l(f,U.first);case"End":case"PageDown":return l(f,U.last);case"Enter":case" ":return l(f,U.select);case"Escape":return l(f,U.dismiss)}})()};globalThis.__aria??={listNav:L2,rovingNav:S2,popupDismiss:T2};globalThis.ARIA??=globalThis.__aria;U1.modules["ui.rip"]=T1;for(let[f,U]of Object.entries(T1))if(typeof U==="function")globalThis[f]=U;})();
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.96",
3
+ "version": "3.13.98",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/ui.rip CHANGED
@@ -1053,9 +1053,9 @@ _ariaListNav = (e, h) ->
1053
1053
 
1054
1054
  _ariaPopupDismiss = (open, popup, close, els = []) ->
1055
1055
  return unless open
1056
- inside = [popup, ...els]
1057
- onDown = (e) => close() unless inside.some (el) -> el?.contains(e.target)
1058
- onScroll = (e) => close() unless popup?.contains(e.target)
1056
+ get = (x) -> if typeof x is 'function' then x() else x
1057
+ onDown = (e) => close() unless [get(popup), ...els.map(get)].some (el) -> el?.contains(e.target)
1058
+ onScroll = (e) => close() unless get(popup)?.contains(e.target)
1059
1059
  document.addEventListener 'mousedown', onDown
1060
1060
  window.addEventListener 'scroll', onScroll, true
1061
1061
  ->