rip-lang 3.12.2 → 3.12.3

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.12.2-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.12.3-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%2C243%2F1%2C243-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/RIP-LANG.md CHANGED
@@ -1294,10 +1294,10 @@ Zero-build reactive framework. Ships the compiler to the browser and compiles `.
1294
1294
  ```coffee
1295
1295
  # Server setup (index.rip)
1296
1296
  import { get, use, start, notFound } from '@rip-lang/api'
1297
- import { ripApp } from '@rip-lang/api/app'
1297
+ import { serve } from '@rip-lang/api/serve'
1298
1298
 
1299
1299
  dir = import.meta.dir
1300
- use ripApp dir: dir, components: 'routes', includes: ['ui'], watch: true
1300
+ use serve dir: dir, watch: true
1301
1301
  get '/css/*' -> @send "#{dir}/css/#{@req.path.slice(5)}"
1302
1302
  notFound -> @send "#{dir}/index.html", 'text/html; charset=UTF-8'
1303
1303
  start port: 3000
@@ -515,10 +515,10 @@ if (typeof globalThis !== 'undefined') {
515
515
  `:"",$=U.slice(0,u).join(`
516
516
  `)}let Y=new p().tokenize($);if(this.options.showTokens)Y.forEach((Q)=>console.log(`${Q[0].padEnd(12)} ${JSON.stringify(Q[1])}`)),console.log();let F=null,_=null;if(this.options.types==="emit"||this.options.types==="check"||this.options.types===!0)_=[...Y];Y=Y.filter((Q)=>Q[0]!=="TYPE_DECL");while(Y.length>0&&Y[0][0]==="TERMINATOR")Y.shift();if(Y.every((Q)=>Q[0]==="TERMINATOR")){if(_)F=T1(_,["program"]);return{tokens:Y,sexpr:["program"],code:"",dts:F,data:A,reactiveVars:{}}}a.lexer={tokens:Y,pos:0,setInput:function(){},lex:function(){if(this.pos>=this.tokens.length)return 1;let Q=this.tokens[this.pos++],D=Q[1];if(Q.data)D=new String(D),Object.assign(D,Q.data);return this.text=D,this.loc=Q.loc,Q[0]}};let X;try{X=a.parse($)}catch(Q){if(/\?\s*\([^)]*\?[^)]*:[^)]*\)\s*:/.test($)||/\?\s+\w+\s+\?\s+/.test($))throw Error("Nested ternary operators are not supported. Use if/else statements instead.");throw Q}if(this.options.showSExpr)console.log(x(X,0,!0)),console.log();let R=null;if(this.options.sourceMap){let Q=(this.options.filename||"output")+".js",D=this.options.filename||"input.rip";R=new j1(Q,D,$)}let H=new y({dataSection:A,skipPreamble:this.options.skipPreamble,reactiveVars:this.options.reactiveVars,sourceMap:R}),w=H.compile(X),Z=R?R.toJSON():null,K=R?R.toReverseMap():null;if(Z&&this.options.sourceMap==="inline"){let Q=typeof Buffer<"u"?Buffer.from(Z).toString("base64"):btoa(Z);w+=`
517
517
  //# sourceMappingURL=data:application/json;base64,${Q}`}else if(Z&&this.options.filename)w+=`
518
- //# sourceMappingURL=${this.options.filename}.js.map`;if(_)F=T1(_,X);return{tokens:Y,sexpr:X,code:w,dts:F,map:Z,reverseMap:K,data:A,reactiveVars:H.reactiveVars}}compileToJS($){return this.compile($).code}compileToSExpr($){return this.compile($).sexpr}}X2(y,p);y.prototype.generateEnum=a1;function h1($,W={}){return new M1(W).compile($)}function d($,W={}){return new M1(W).compileToJS($)}function w1(){return new y({}).getReactiveRuntime()}function C1(){return new y({}).getComponentRuntime()}var T3="3.12.2",S3="2026-02-22@00:16:42GMT";if(typeof globalThis<"u"&&!globalThis.__rip)Function(w1())();var L3=($)=>{let W=$.match(/^[ \t]*(?=\S)/gm),A=Math.min(...(W||[]).map((U)=>U.length));return $.replace(RegExp(`^[ ]{${A}}`,"gm"),"").trim()};async function V3(){let $=document.querySelectorAll('script[type="text/rip"]');for(let W of $){if(W.hasAttribute("data-rip-processed"))continue;if(W.hasAttribute("data-name"))continue;try{let A;if(W.src){let u=await fetch(W.src);if(!u.ok){console.error(`Rip: failed to fetch ${W.src} (${u.status})`);continue}A=await u.text()}else A=L3(W.textContent);let U;try{U=d(A)}catch(u){console.error("Rip compile error:",u.message),console.error("Source:",A);continue}await(0,eval)(`(async()=>{
518
+ //# sourceMappingURL=${this.options.filename}.js.map`;if(_)F=T1(_,X);return{tokens:Y,sexpr:X,code:w,dts:F,map:Z,reverseMap:K,data:A,reactiveVars:H.reactiveVars}}compileToJS($){return this.compile($).code}compileToSExpr($){return this.compile($).sexpr}}X2(y,p);y.prototype.generateEnum=a1;function h1($,W={}){return new M1(W).compile($)}function d($,W={}){return new M1(W).compileToJS($)}function w1(){return new y({}).getReactiveRuntime()}function C1(){return new y({}).getComponentRuntime()}var T3="3.12.3",S3="2026-02-22@05:17:15GMT";if(typeof globalThis<"u"&&!globalThis.__rip)Function(w1())();var L3=($)=>{let W=$.match(/^[ \t]*(?=\S)/gm),A=Math.min(...(W||[]).map((U)=>U.length));return $.replace(RegExp(`^[ ]{${A}}`,"gm"),"").trim()};async function V3(){let $=document.querySelectorAll('script[type="text/rip"]');for(let W of $){if(W.hasAttribute("data-rip-processed"))continue;if(W.hasAttribute("data-name"))continue;try{let A;if(W.src){let u=await fetch(W.src);if(!u.ok){console.error(`Rip: failed to fetch ${W.src} (${u.status})`);continue}A=await u.text()}else A=L3(W.textContent);let U;try{U=d(A)}catch(u){console.error("Rip compile error:",u.message),console.error("Source:",A);continue}await(0,eval)(`(async()=>{
519
519
  ${U}
520
520
  })()`),W.setAttribute("data-rip-processed","true")}catch(A){console.error("Rip runtime error:",A)}}}async function t($){for(let[Y,F]of Object.entries(t.modules))if($.includes(Y))return F;let W=await fetch($).then((Y)=>{if(!Y.ok)throw Error(`importRip: ${$} (${Y.status})`);return Y.text()}),A=d(W),U=`// ${$}
521
521
  `,u=new Blob([U+A],{type:"application/javascript"});return await import(URL.createObjectURL(u))}t.modules={};function j3($){try{let W=$.replace(/^/gm," "),U=d(`do ->
522
- ${W}`).replace(/^let\s+[^;]+;\s*\n\s*/m,"");U=U.replace(/^const\s+(\w+)\s*=/gm,"globalThis.$1 =");let u=(0,eval)(U);if(u&&typeof u.then==="function")return u.then((f)=>{if(f!==void 0)globalThis._=f;return f});if(u!==void 0)globalThis._=u;return u}catch(W){console.error("Rip compilation error:",W.message);return}}if(typeof globalThis<"u")globalThis.rip=j3,globalThis.importRip=t,globalThis.compileToJS=d,globalThis.__ripExports={compile:h1,compileToJS:d,formatSExpr:x,VERSION:T3,BUILD_DATE:S3,getReactiveRuntime:w1,getComponentRuntime:C1};async function h3(){if(globalThis.__ripLaunched)return;let $=t.modules?.["app.rip"];if(!$?.launch)return;let W=document.querySelector("script[data-hash], script[data-url]"),A=W?.getAttribute("data-url")||"";if(!(document.querySelectorAll('script[type="text/rip"][data-name]').length>0)&&!A)return;let f={hash:W?.getAttribute("data-hash")!=="false"};await $.launch(A,f)}if(typeof document<"u")globalThis.__ripScriptsReady=new Promise(($)=>{let W=()=>V3().then(h3).then($);if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>queueMicrotask(W));else queueMicrotask(W)});var G1={};c2(G1,{throttle:()=>c3,stash:()=>S2,setContext:()=>E2,raw:()=>L2,launch:()=>g3,isStash:()=>C3,hold:()=>v3,hasContext:()=>G2,getContext:()=>q2,delay:()=>V2,debounce:()=>b3,createRouter:()=>h2,createResource:()=>y3,createRenderer:()=>C2,createComponents:()=>j2});var K2,v1,e,k,O1,J2,r,j,y1,F1,_1,g1,D2,H2,z1,q1,M2,w2,z2,b1,c1,q2,O2,x1,G2,Y1,l1,P2,I2,E2,B2,N2,k1,T2;({__state:j,__effect:r,__batch:J2}=globalThis.__rip);({setContext:E2,getContext:q2,hasContext:G2}=globalThis.__ripComponent||{});O1=Symbol("stash");k=Symbol("signals");e=Symbol("raw");v1=new WeakMap;y1=0;g1=j(0);x1=function($,W){let A;if(!$[k])Object.defineProperty($,k,{value:new Map,enumerable:!1});if(A=$[k].get(W),!A)A=j($[W]),$[k].set(W,A);return A};Y1=function($){return x1($,Symbol.for("keys"))};T2=function($){let W;if(!($!=null&&typeof $==="object"))return $;if($[O1])return $;if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Promise)return $;if(W=v1.get($),W)return W;return l1($)};l1=function($){let W,A;return A=null,W={get:function(U,u){let f,Y;if(u===O1)return!0;if(u===e)return U;if(typeof u==="symbol")return Reflect.get(U,u);if(u==="length"&&Array.isArray(U))return Y1(U).value,U.length;if(u==="get")return function(F){return B2(A,F)};if(u==="set")return function(F,_){return N2(A,F,_)};if(f=x1(U,u),Y=f.value,Y!=null&&typeof Y==="object")return T2(Y);return Y},set:function(U,u,f){let Y,F;if(Y=U[u],F=f?.[e]?f[e]:f,F===Y)return!0;if(U[u]=F,U[k]?.has(u))U[k].get(u).value=F;if(Y===void 0&&F!==void 0)Y1(U).value=++y1;return g1.value++,!0},deleteProperty:function(U,u){let f;if(delete U[u],f=U[k]?.get(u),f)f.value=void 0;return Y1(U).value=++y1,!0},ownKeys:function(U){return Y1(U).value,Reflect.ownKeys(U)}},A=new Proxy($,W),v1.set($,A),A};K2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;k1=function($){let W,A,U,u,f;U=("."+$).split(K2),U.shift(),f=[],A=0;while(A<U.length){if(u=U[A],W=u[0],W==="."||W==="/")f.push(u.slice(1));else if(W==="[")if(u[1]==='"'||u[1]==="'")f.push(u.slice(2,-2));else f.push(+u.slice(1,-1));A+=2}return f};B2=function($,W){let A,U;U=k1(W),A=$;for(let u of U){if(A==null)return;A=A[u]}return A};N2=function($,W,A){let U,u;u=k1(W),U=$;for(let f=0;f<u.length;f++){let Y=u[f];if(f===u.length-1)U[Y]=A;else{if(U[Y]==null)U[Y]={};U=U[Y]}}return A};_1=function($){return typeof $==="function"?$:function(){return $.value}};F1=function($,W){let A;return A={read:function(){return $.read()}},Object.defineProperty(A,"value",{get:function(){return $.value},set:function(U){return W.value=U}}),A};z2=function($){let W;if(W=$.replace(/\.rip$/,""),W=W.replace(/\[\.\.\.(\w+)\]/g,"*$1"),W=W.replace(/\[(\w+)\]/g,":$1"),W==="index")return"/";return W=W.replace(/\/index$/,""),"/"+W};I2=function($){let W,A;return W=[],A=$.replace(/\*(\w+)/g,function(U,u){return W.push(u),"(.+)"}).replace(/:(\w+)/g,function(U,u){return W.push(u),"([^/]+)"}),{regex:new RegExp("^"+A+"$"),names:W}};P2=function($,W){let A,U;for(let u of W)if(A=$.match(u.regex.regex),A){U={};for(let f=0;f<u.regex.names.length;f++){let Y=u.regex.names[f];U[Y]=decodeURIComponent(A[f+1])}return{route:u,params:U}}return null};z1=function($,W="components"){let A,U,u,f,Y,F,_,X,R;_=[],u=new Map,A=$.listAll(W);for(let H of A){if(F=H.slice(W.length+1),!F.endsWith(".rip"))continue;if(f=F.split("/").pop(),f==="_layout.rip"){U=F==="_layout.rip"?"":F.slice(0,-12),u.set(U,H);continue}if(f.startsWith("_"))continue;if(X=F.split("/"),X.length>1&&X.some(function(w,Z){return Z<X.length-1&&w.startsWith("_")}))continue;R=z2(F),Y=I2(R),_.push({pattern:R,regex:Y,file:H,rel:F})}return _.sort(function(H,w){let Z,K,Q,D;if(K=(H.pattern.match(/:/g)||[]).length,D=(w.pattern.match(/:/g)||[]).length,Z=H.pattern.includes("*")?1:0,Q=w.pattern.includes("*")?1:0,Z!==Q)return Z-Q;if(K!==D)return K-D;return H.pattern.localeCompare(w.pattern)}),{routes:_,layouts:u}};O2=function($,W,A){let U,u,f,Y;if(U=[],f=$.slice(W.length+1),Y=f.split("/"),u="",A.has(""))U.push(A.get(""));for(let F=0;F<Y.length;F++){let _=Y[F];if(F===Y.length-1)break;if(u=u?u+"/"+_:_,A.has(u))U.push(A.get(u))}return U};D2=function($,W){if($.length!==W.length)return!1;for(let A=0;A<$.length;A++)if($[A]!==W[A])return!1;return!0};c1=function($){for(let W in $){let A=$[W];if(typeof A==="function"&&(A.prototype?.mount||A.prototype?._create))return A}return typeof $.default==="function"?$.default:void 0};b1=function($){let W;W={};for(let A in $){let U=$[A];if(typeof U==="function"&&(U.prototype?.mount||U.prototype?._create))W[A]=U}return W};w2=function($){let W;return W=$.split("/").pop().replace(/\.rip$/,""),W.replace(/(^|[-_])([a-z])/g,function(A,U,u){return u.toUpperCase()})};H2=function($,W="components"){let A,U,u;U={};for(let f of $.listAll(W)){if(!f.endsWith(".rip"))continue;if(A=f.split("/").pop(),A.startsWith("_"))continue;if(u=w2(f),U[u])console.warn(`[Rip] Component name collision: ${u} (${U[u]} vs ${f})`);U[u]=f}return U};q1=async function($,W,A=null,U=null,u=null){let f,Y,F,_,X,R,H,w,Z,K,Q,D;if(A&&U){if(Y=A.getCompiled(U),Y)return Y}if(H=W($),u){K={};for(let M in u.map){let O=u.map[M];if(O!==U&&H.includes(`new ${M}(`)){if(!u.classes[M]){if(_=A.read(O),_){F=await q1(_,W,A,O,u),X=b1(F);for(let q in X){let z=X[q];u.classes[q]=z}}}if(u.classes[M])K[M]=!0}}if(Z=Object.keys(K),Z.length>0)Q=`const {${Z.join(", ")}} = globalThis['${u.key}'];
522
+ ${W}`).replace(/^let\s+[^;]+;\s*\n\s*/m,"");U=U.replace(/^const\s+(\w+)\s*=/gm,"globalThis.$1 =");let u=(0,eval)(U);if(u&&typeof u.then==="function")return u.then((f)=>{if(f!==void 0)globalThis._=f;return f});if(u!==void 0)globalThis._=u;return u}catch(W){console.error("Rip compilation error:",W.message);return}}if(typeof globalThis<"u")globalThis.rip=j3,globalThis.importRip=t,globalThis.compileToJS=d,globalThis.__ripExports={compile:h1,compileToJS:d,formatSExpr:x,VERSION:T3,BUILD_DATE:S3,getReactiveRuntime:w1,getComponentRuntime:C1};async function h3(){if(globalThis.__ripLaunched)return;let $=t.modules?.["app.rip"];if(!$?.launch)return;let W=document.querySelector("script[data-hash], script[data-url]"),A=W?.getAttribute("data-url")||"",u={hash:W?.getAttribute("data-hash")!=="false"};await $.launch(A,u)}if(typeof document<"u")globalThis.__ripScriptsReady=new Promise(($)=>{let W=()=>V3().then(h3).then($);if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>queueMicrotask(W));else queueMicrotask(W)});var G1={};c2(G1,{throttle:()=>c3,stash:()=>S2,setContext:()=>E2,raw:()=>L2,launch:()=>g3,isStash:()=>C3,hold:()=>v3,hasContext:()=>G2,getContext:()=>q2,delay:()=>V2,debounce:()=>b3,createRouter:()=>h2,createResource:()=>y3,createRenderer:()=>C2,createComponents:()=>j2});var K2,v1,e,k,O1,J2,r,j,y1,F1,_1,g1,D2,H2,z1,q1,M2,w2,z2,b1,c1,q2,O2,x1,G2,Y1,l1,P2,I2,E2,B2,N2,k1,T2;({__state:j,__effect:r,__batch:J2}=globalThis.__rip);({setContext:E2,getContext:q2,hasContext:G2}=globalThis.__ripComponent||{});O1=Symbol("stash");k=Symbol("signals");e=Symbol("raw");v1=new WeakMap;y1=0;g1=j(0);x1=function($,W){let A;if(!$[k])Object.defineProperty($,k,{value:new Map,enumerable:!1});if(A=$[k].get(W),!A)A=j($[W]),$[k].set(W,A);return A};Y1=function($){return x1($,Symbol.for("keys"))};T2=function($){let W;if(!($!=null&&typeof $==="object"))return $;if($[O1])return $;if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Promise)return $;if(W=v1.get($),W)return W;return l1($)};l1=function($){let W,A;return A=null,W={get:function(U,u){let f,Y;if(u===O1)return!0;if(u===e)return U;if(typeof u==="symbol")return Reflect.get(U,u);if(u==="length"&&Array.isArray(U))return Y1(U).value,U.length;if(u==="get")return function(F){return B2(A,F)};if(u==="set")return function(F,_){return N2(A,F,_)};if(f=x1(U,u),Y=f.value,Y!=null&&typeof Y==="object")return T2(Y);return Y},set:function(U,u,f){let Y,F;if(Y=U[u],F=f?.[e]?f[e]:f,F===Y)return!0;if(U[u]=F,U[k]?.has(u))U[k].get(u).value=F;if(Y===void 0&&F!==void 0)Y1(U).value=++y1;return g1.value++,!0},deleteProperty:function(U,u){let f;if(delete U[u],f=U[k]?.get(u),f)f.value=void 0;return Y1(U).value=++y1,!0},ownKeys:function(U){return Y1(U).value,Reflect.ownKeys(U)}},A=new Proxy($,W),v1.set($,A),A};K2=/([./][^./\[\s]+|\[[-+]?\d+\]|\[(?:"[^"]+"|'[^']+')\])/;k1=function($){let W,A,U,u,f;U=("."+$).split(K2),U.shift(),f=[],A=0;while(A<U.length){if(u=U[A],W=u[0],W==="."||W==="/")f.push(u.slice(1));else if(W==="[")if(u[1]==='"'||u[1]==="'")f.push(u.slice(2,-2));else f.push(+u.slice(1,-1));A+=2}return f};B2=function($,W){let A,U;U=k1(W),A=$;for(let u of U){if(A==null)return;A=A[u]}return A};N2=function($,W,A){let U,u;u=k1(W),U=$;for(let f=0;f<u.length;f++){let Y=u[f];if(f===u.length-1)U[Y]=A;else{if(U[Y]==null)U[Y]={};U=U[Y]}}return A};_1=function($){return typeof $==="function"?$:function(){return $.value}};F1=function($,W){let A;return A={read:function(){return $.read()}},Object.defineProperty(A,"value",{get:function(){return $.value},set:function(U){return W.value=U}}),A};z2=function($){let W;if(W=$.replace(/\.rip$/,""),W=W.replace(/\[\.\.\.(\w+)\]/g,"*$1"),W=W.replace(/\[(\w+)\]/g,":$1"),W==="index")return"/";return W=W.replace(/\/index$/,""),"/"+W};I2=function($){let W,A;return W=[],A=$.replace(/\*(\w+)/g,function(U,u){return W.push(u),"(.+)"}).replace(/:(\w+)/g,function(U,u){return W.push(u),"([^/]+)"}),{regex:new RegExp("^"+A+"$"),names:W}};P2=function($,W){let A,U;for(let u of W)if(A=$.match(u.regex.regex),A){U={};for(let f=0;f<u.regex.names.length;f++){let Y=u.regex.names[f];U[Y]=decodeURIComponent(A[f+1])}return{route:u,params:U}}return null};z1=function($,W="components"){let A,U,u,f,Y,F,_,X,R;_=[],u=new Map,A=$.listAll(W);for(let H of A){if(F=H.slice(W.length+1),!F.endsWith(".rip"))continue;if(f=F.split("/").pop(),f==="_layout.rip"){U=F==="_layout.rip"?"":F.slice(0,-12),u.set(U,H);continue}if(f.startsWith("_"))continue;if(X=F.split("/"),X.length>1&&X.some(function(w,Z){return Z<X.length-1&&w.startsWith("_")}))continue;R=z2(F),Y=I2(R),_.push({pattern:R,regex:Y,file:H,rel:F})}return _.sort(function(H,w){let Z,K,Q,D;if(K=(H.pattern.match(/:/g)||[]).length,D=(w.pattern.match(/:/g)||[]).length,Z=H.pattern.includes("*")?1:0,Q=w.pattern.includes("*")?1:0,Z!==Q)return Z-Q;if(K!==D)return K-D;return H.pattern.localeCompare(w.pattern)}),{routes:_,layouts:u}};O2=function($,W,A){let U,u,f,Y;if(U=[],f=$.slice(W.length+1),Y=f.split("/"),u="",A.has(""))U.push(A.get(""));for(let F=0;F<Y.length;F++){let _=Y[F];if(F===Y.length-1)break;if(u=u?u+"/"+_:_,A.has(u))U.push(A.get(u))}return U};D2=function($,W){if($.length!==W.length)return!1;for(let A=0;A<$.length;A++)if($[A]!==W[A])return!1;return!0};c1=function($){for(let W in $){let A=$[W];if(typeof A==="function"&&(A.prototype?.mount||A.prototype?._create))return A}return typeof $.default==="function"?$.default:void 0};b1=function($){let W;W={};for(let A in $){let U=$[A];if(typeof U==="function"&&(U.prototype?.mount||U.prototype?._create))W[A]=U}return W};w2=function($){let W;return W=$.split("/").pop().replace(/\.rip$/,""),W.replace(/(^|[-_])([a-z])/g,function(A,U,u){return u.toUpperCase()})};H2=function($,W="components"){let A,U,u;U={};for(let f of $.listAll(W)){if(!f.endsWith(".rip"))continue;if(A=f.split("/").pop(),A.startsWith("_"))continue;if(u=w2(f),U[u])console.warn(`[Rip] Component name collision: ${u} (${U[u]} vs ${f})`);U[u]=f}return U};q1=async function($,W,A=null,U=null,u=null){let f,Y,F,_,X,R,H,w,Z,K,Q,D;if(A&&U){if(Y=A.getCompiled(U),Y)return Y}if(H=W($),u){K={};for(let M in u.map){let O=u.map[M];if(O!==U&&H.includes(`new ${M}(`)){if(!u.classes[M]){if(_=A.read(O),_){F=await q1(_,W,A,O,u),X=b1(F);for(let q in X){let z=X[q];u.classes[q]=z}}}if(u.classes[M])K[M]=!0}}if(Z=Object.keys(K),Z.length>0)Q=`const {${Z.join(", ")}} = globalThis['${u.key}'];
523
523
  `,H=Q+H}if(R=U?`// ${U}
524
- `:"",f=new Blob([R+H],{type:"application/javascript"}),D=URL.createObjectURL(f),w=await import(D),u){X=b1(w);for(let M in X){let O=X[M];u.classes[M]=O}}if(A&&U)A.setCompiled(U,w);return w};M2=function($){let W,A,U;return U=1000,A=30000,W=function(){let u;return u=new EventSource($),u.addEventListener("connected",function(){return U=1000,console.log("[Rip] Hot reload connected")}),u.addEventListener("reload",function(){return console.log("[Rip] Reloading..."),location.reload()}),u.onerror=function(){return u.close(),setTimeout(W,U),U=Math.min(U*2,A)}},W()};var S2=function($={}){return l1($)},L2=function($){return $?.[e]?$[e]:$},C3=function($){return $?.[O1]===!0},y3=function($,W={}){let A,U,u,f,Y;if(A=j(W.initial||null),u=j(!1),U=j(null),f=async function(){let F;return u.value=!0,U.value=null,(async()=>{try{return F=await $(),A.value=F}catch(_){return U.value=_}finally{u.value=!1}})()},Y={data:void 0,loading:void 0,error:void 0,refetch:f},Object.defineProperty(Y,"data",{get:function(){return A.value}}),Object.defineProperty(Y,"loading",{get:function(){return u.value}}),Object.defineProperty(Y,"error",{get:function(){return U.value}}),!W.lazy)f();return Y},V2=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return u=setTimeout(function(){return U.value=!0},$),function(){return clearTimeout(u)};else return U.value=!1}),typeof W!=="function"?F1(U,W):U},b3=function($,W){let A,U;return A=_1(W),U=j(A()),r(function(){let u,f;return f=A(),u=setTimeout(function(){return U.value=f},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},c3=function($,W){let A,U,u;return A=_1(W),u=j(A()),U=0,r(function(){let f,Y,F,_;if(_=A(),f=Date.now(),Y=$-(f-U),Y<=0)return u.value=_,U=f;else return F=setTimeout(function(){return u.value=A(),U=Date.now()},Y),function(){return clearTimeout(F)}}),typeof W!=="function"?F1(u,W):u},v3=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return U.value=!0;else return u=setTimeout(function(){return U.value=!1},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},j2=function(){let $,W,A,U;return W=new Map,U=[],$=new Map,A=function(u,f){for(let Y of U)Y(u,f)},{read:function(u){return W.get(u)},write:function(u,f){let Y;return Y=!W.has(u),W.set(u,f),$.delete(u),A(Y?"create":"change",u)},del:function(u){return W.delete(u),$.delete(u),A("delete",u)},exists:function(u){return W.has(u)},size:function(){return W.size},list:function(u=""){let f,Y,F;F=[],f=u?u+"/":"";for(let[_]of W)if(_.startsWith(f)){if(Y=_.slice(f.length),Y.includes("/"))continue;F.push(_)}return F},listAll:function(u=""){let f,Y;Y=[],f=u?u+"/":"";for(let[F]of W)if(F.startsWith(f))Y.push(F);return Y},load:function(u){for(let f in u){let Y=u[f];W.set(f,Y)}},watch:function(u){return U.push(u),function(){return U.splice(U.indexOf(u),1)}},getCompiled:function(u){return $.get(u)},setCompiled:function(u,f){return $.set(u,f)}}},h2=function($,W={}){let A,U,u,f,Y,F,_,X,R,H,w,Z,K,Q,D,M,O,q,z,I,G;if(O=W.root||"components",R=W.base||"",H=W.hash||!1,K=W.onError||null,z=function(J){return R&&J.startsWith(R)?J.slice(R.length)||"/":J},X=function(J){return R?R+J:J},D=function(){let J;if(H){if(J=location.hash.slice(1),!J)return"/";return J[0]==="/"?J:"/"+J}else return location.pathname+location.search+location.hash},G=function(J){return H?J==="/"?location.pathname:"#"+J.slice(1):X(J)},Y=j(z(H?D():location.pathname)),f=j({}),_=j(null),U=j([]),F=j({}),A=j(""),u=V2(100,j(!1)),I=z1($,O),w=new Set,$.watch(function(J,P){if(!P.startsWith(O+"/"))return;return I=z1($,O)}),M=function(J){let P,E,B,N,T;if(N=J.split("?")[0].split("#")[0],E=z(N),E=E[0]==="/"?E:"/"+E,B=J.split("?")[1]?.split("#")[0]||"",P=J.includes("#")?J.split("#")[1]:"",T=P2(E,I.routes),T){J2(function(){return Y.value=E,f.value=T.params,_.value=T.route,U.value=O2(T.route.file,O,I.layouts),F.value=Object.fromEntries(new URLSearchParams(B)),A.value=P});for(let L of w)L(q.current);return!0}if(K)K({status:404,path:E});return!1},Q=function(){return M(D())},typeof window<"u")window.addEventListener("popstate",Q);if(Z=function(J){let P,E,B;if(J.button!==0||J.metaKey||J.ctrlKey||J.shiftKey||J.altKey)return;E=J.target;while(E&&E.tagName!=="A")E=E.parentElement;if(!E?.href)return;if(B=new URL(E.href,location.origin),B.origin!==location.origin)return;if(E.target==="_blank"||E.hasAttribute("data-external"))return;return J.preventDefault(),P=H&&B.hash?B.hash.slice(1)||"/":B.pathname+B.search+B.hash,q.push(P)},typeof document<"u")document.addEventListener("click",Z);return q={push:function(J){return M(J)?history.pushState(null,"",G(Y.read())):void 0},replace:function(J){return M(J)?history.replaceState(null,"",G(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(J){return w.add(J),function(){return w.delete(J)}},rebuild:function(){return I=z1($,O)},routes:void 0,init:function(){return M(D()),q},destroy:function(){if(typeof window<"u")window.removeEventListener("popstate",Q);if(typeof document<"u")document.removeEventListener("click",Z);return w.clear()}},Object.defineProperty(q,"current",{get:function(){return{path:Y.value,params:f.value,route:_.value,layouts:U.value,query:F.value,hash:A.value}}}),Object.defineProperty(q,"path",{get:function(){return Y.value}}),Object.defineProperty(q,"params",{get:function(){return f.value}}),Object.defineProperty(q,"route",{get:function(){return _.value}}),Object.defineProperty(q,"layouts",{get:function(){return U.value}}),Object.defineProperty(q,"query",{get:function(){return F.value}}),Object.defineProperty(q,"hash",{get:function(){return A.value}}),Object.defineProperty(q,"navigating",{get:function(){return u.value},set:function(J){return u.value=J}}),Object.defineProperty(q,"routes",{get:function(){return I.routes}}),q},C2=function($={}){let W,A,U,u,f,Y,F,_,X,R,H,w,Z,K,Q,D,M,O,q,z,I;if({router:q,app:W,components:f,resolver:O,compile:U,target:z,onError:D}=$,Y=typeof z==="string"?document.querySelector(z):z||document.getElementById("app"),!Y)Y=document.createElement("div"),Y.id="app",document.body.appendChild(Y);return Y.style.opacity="0",F=null,X=null,_=[],w=[],K=Y,H=0,R=null,u=new Map,Z=$.cacheSize||10,A=function(){let G,J;if(F&&X){if(F.beforeUnmount)F.beforeUnmount();if(u.set(X,F),u.size>Z){if(J=u.keys().next().value,G=u.get(J),G.unmounted)G.unmounted();u.delete(J)}return F=null,X=null}},I=function(){A();for(let G=w.length-1;G>=0;G--){let J=w[G];if(J.beforeUnmount)J.beforeUnmount();if(J.unmounted)J.unmounted();J._root?.remove()}return w=[],K=Y},f.watch(function(G,J){let P;if(u.has(J)){if(P=u.get(J),P.unmounted)P.unmounted();return u.delete(J)}}),Q=async function(G){let J,P,E,B,N,T,L,h,m,u1,f1,m1,n,n1,Z1,R1,Q1,P1,C,i1,I1,o;if({route:C,params:R1,layouts:h,query:P1}=G,!C)return;if(C.file===X)return;return B=++H,q.navigating=!0,(async()=>{try{if(I1=f.read(C.file),!I1){if(D)D({status:404,message:`File not found: ${C.file}`});q.navigating=!1;return}if(m1=await q1(I1,U,f,C.file,O),B!==H){q.navigating=!1;return}if(J=c1(m1),!J){if(D)D({status:500,message:`No component found in ${C.file}`});q.navigating=!1;return}if(f1=!D2(h,_),n1=F?._root,f1)I();else A();if(n=f1?Y:K,f1&&h.length>0){Y.innerHTML="",n=Y;for(let c of h){if(u1=f.read(c),!u1)continue;if(m=await q1(u1,U,f,c,O),B!==H){q.navigating=!1;return}if(P=c1(m),!P)continue;if(T=new P({app:W,params:R1,router:q}),T.beforeMount)T.beforeMount();o=document.createElement("div"),o.setAttribute("data-layout",c),n.appendChild(o),T.mount(o),w.push(T),i1=o.querySelector("#content")||o,n=i1}_=[...h],K=n}else if(f1)Y.innerHTML="",_=[],K=Y;if(E=u.get(C.file),E)u.delete(C.file),n.appendChild(E._root),F=E,X=C.file;else{if(Z1=document.createElement("div"),Z1.setAttribute("data-component",C.file),n.appendChild(Z1),L=new J({app:W,params:R1,query:P1,router:q}),L.beforeMount)L.beforeMount();if(L.mount(Z1),F=L,X=C.file,L.load)await L.load(R1,P1)}return n1?.remove(),q.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(c){if(q.navigating=!1,Y.style.opacity="1",console.error(`Renderer: error mounting ${C.file}:`,c),D)D({status:500,message:c.message,error:c});N=!1;for(let E1=w.length-1;E1>=0;E1--){let p1=w[E1];if(p1.onError)try{p1.onError(c),N=!0;break}catch(y2){console.error("Renderer: error boundary failed:",y2)}}return(()=>{if(!N)return Q1=document.createElement("pre"),Q1.style.cssText="color:red;padding:1em",Q1.textContent=c.stack||c.message,Y.innerHTML="",Y.appendChild(Q1)})()}})()},M={start:function(){return R=r(function(){let G;return G=q.current,G.route?Q(G):void 0}),q.init(),M},stop:function(){if(I(),R)R(),R=null;return Y.innerHTML=""},remount:function(){let G;return G=q.current,G.route?Q(G):void 0},cache:u},M},g3=async function($="",W={}){let A,U,u,f,Y,F,_,X,R,H,w,Z,K,Q,D,M,O,q,z,I,G;if(globalThis.__ripLaunched=!0,typeof $==="object")W=$,$="";if($=$.replace(/\/+$/,""),G=W.target||"#app",R=W.compile||null,Q=W.persist||!1,Z=W.hash||!1,!R)R=globalThis?.compileToJS||null;if(typeof document<"u"&&!document.querySelector(G))w=document.createElement("div"),w.id=G.replace(/^#/,""),document.body.prepend(w);if(W.bundle)F=W.bundle;else if(W.components&&Array.isArray(W.components)){H={};for(let J of W.components)if(M=await fetch(J),M.ok)K=J.split("/").pop(),H[`components/${K}`]=await M.text();F={components:H,data:{}}}else if(typeof document<"u"&&document.querySelectorAll('script[type="text/rip"][data-name]').length>0){H={};for(let J of document.querySelectorAll('script[type="text/rip"][data-name]'))K=J.getAttribute("data-name"),K+=!K.endsWith(".rip")?".rip":void 0,H[`components/${K}`]=J.textContent;F={components:H,data:{}}}else{if(_=`${$}/bundle`,M=await fetch(_),!M.ok)throw Error(`launch: ${_} (${M.status})`);F=await M.json()}if(f=S2({components:{},routes:{},data:{}}),F.data)f.data=F.data;if(F.routes)f.routes=F.routes;if(Q&&typeof sessionStorage<"u"){u=`__rip_${$}`,U=Q==="local"?localStorage:sessionStorage;try{if(z=U.getItem(u),z){I=JSON.parse(z);for(let J in I){let P=I[J];f.data[J]=P}}}catch{}A=function(){return(()=>{try{return U.setItem(u,JSON.stringify(L2(f.data)))}catch{return null}})()},r(function(){let J;return g1.value,J=setTimeout(A,2000),function(){return clearTimeout(J)}}),window.addEventListener("beforeunload",A)}if(Y=j2(),F.components)Y.load(F.components);if(X=`__rip_${$.replace(/\//g,"_")||"app"}`,O={map:H2(Y),classes:{},key:X},typeof globalThis<"u")globalThis[X]=O.classes;if(f.data.title&&typeof document<"u")document.title=f.data.title;if(q=h2(Y,{root:"components",base:$,hash:Z,onError:function(J){return console.error(`[Rip] Error ${J.status}: ${J.message||J.path}`)}}),D=C2({router:q,app:f,components:Y,resolver:O,compile:R,target:G,onError:function(J){return console.error(`[Rip] ${J.message}`,J.error)}}),D.start(),F.data?.watch)M2(`${$}/watch`);if(typeof window<"u")window.app=f,window.__RIP__={app:f,components:Y,router:q,renderer:D,cache:D.cache,version:"0.3.0"};return{app:f,components:Y,router:q,renderer:D}};t.modules["app.rip"]=G1;for(let[$,W]of Object.entries(G1))if(typeof W==="function")globalThis[$]=W;export{j3 as rip,V3 as processRipScripts,a as parser,t as importRip,w1 as getReactiveRuntime,C1 as getComponentRuntime,x as formatSExpr,d as compileToJS,h1 as compile,T3 as VERSION,p as Lexer,M1 as Compiler,y as CodeGenerator,S3 as BUILD_DATE};
524
+ `:"",f=new Blob([R+H],{type:"application/javascript"}),D=URL.createObjectURL(f),w=await import(D),u){X=b1(w);for(let M in X){let O=X[M];u.classes[M]=O}}if(A&&U)A.setCompiled(U,w);return w};M2=function($){let W,A,U;return U=1000,A=30000,W=function(){let u;return u=new EventSource($),u.addEventListener("connected",function(){return U=1000,console.log("[Rip] Hot reload connected")}),u.addEventListener("reload",function(){return console.log("[Rip] Reloading..."),location.reload()}),u.onerror=function(){return u.close(),setTimeout(W,U),U=Math.min(U*2,A)}},W()};var S2=function($={}){return l1($)},L2=function($){return $?.[e]?$[e]:$},C3=function($){return $?.[O1]===!0},y3=function($,W={}){let A,U,u,f,Y;if(A=j(W.initial||null),u=j(!1),U=j(null),f=async function(){let F;return u.value=!0,U.value=null,(async()=>{try{return F=await $(),A.value=F}catch(_){return U.value=_}finally{u.value=!1}})()},Y={data:void 0,loading:void 0,error:void 0,refetch:f},Object.defineProperty(Y,"data",{get:function(){return A.value}}),Object.defineProperty(Y,"loading",{get:function(){return u.value}}),Object.defineProperty(Y,"error",{get:function(){return U.value}}),!W.lazy)f();return Y},V2=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return u=setTimeout(function(){return U.value=!0},$),function(){return clearTimeout(u)};else return U.value=!1}),typeof W!=="function"?F1(U,W):U},b3=function($,W){let A,U;return A=_1(W),U=j(A()),r(function(){let u,f;return f=A(),u=setTimeout(function(){return U.value=f},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},c3=function($,W){let A,U,u;return A=_1(W),u=j(A()),U=0,r(function(){let f,Y,F,_;if(_=A(),f=Date.now(),Y=$-(f-U),Y<=0)return u.value=_,U=f;else return F=setTimeout(function(){return u.value=A(),U=Date.now()},Y),function(){return clearTimeout(F)}}),typeof W!=="function"?F1(u,W):u},v3=function($,W){let A,U;return A=_1(W),U=j(!!A()),r(function(){let u;if(A())return U.value=!0;else return u=setTimeout(function(){return U.value=!1},$),function(){return clearTimeout(u)}}),typeof W!=="function"?F1(U,W):U},j2=function(){let $,W,A,U;return W=new Map,U=[],$=new Map,A=function(u,f){for(let Y of U)Y(u,f)},{read:function(u){return W.get(u)},write:function(u,f){let Y;return Y=!W.has(u),W.set(u,f),$.delete(u),A(Y?"create":"change",u)},del:function(u){return W.delete(u),$.delete(u),A("delete",u)},exists:function(u){return W.has(u)},size:function(){return W.size},list:function(u=""){let f,Y,F;F=[],f=u?u+"/":"";for(let[_]of W)if(_.startsWith(f)){if(Y=_.slice(f.length),Y.includes("/"))continue;F.push(_)}return F},listAll:function(u=""){let f,Y;Y=[],f=u?u+"/":"";for(let[F]of W)if(F.startsWith(f))Y.push(F);return Y},load:function(u){for(let f in u){let Y=u[f];W.set(f,Y)}},watch:function(u){return U.push(u),function(){return U.splice(U.indexOf(u),1)}},getCompiled:function(u){return $.get(u)},setCompiled:function(u,f){return $.set(u,f)}}},h2=function($,W={}){let A,U,u,f,Y,F,_,X,R,H,w,Z,K,Q,D,M,O,q,z,I,G;if(O=W.root||"components",R=W.base||"",H=W.hash||!1,K=W.onError||null,z=function(J){return R&&J.startsWith(R)?J.slice(R.length)||"/":J},X=function(J){return R?R+J:J},D=function(){let J;if(H){if(J=location.hash.slice(1),!J)return"/";return J[0]==="/"?J:"/"+J}else return location.pathname+location.search+location.hash},G=function(J){return H?J==="/"?location.pathname:"#"+J.slice(1):X(J)},Y=j(z(H?D():location.pathname)),f=j({}),_=j(null),U=j([]),F=j({}),A=j(""),u=V2(100,j(!1)),I=z1($,O),w=new Set,$.watch(function(J,P){if(!P.startsWith(O+"/"))return;return I=z1($,O)}),M=function(J){let P,E,B,N,T;if(N=J.split("?")[0].split("#")[0],E=z(N),E=E[0]==="/"?E:"/"+E,B=J.split("?")[1]?.split("#")[0]||"",P=J.includes("#")?J.split("#")[1]:"",T=P2(E,I.routes),T){J2(function(){return Y.value=E,f.value=T.params,_.value=T.route,U.value=O2(T.route.file,O,I.layouts),F.value=Object.fromEntries(new URLSearchParams(B)),A.value=P});for(let L of w)L(q.current);return!0}if(K)K({status:404,path:E});return!1},Q=function(){return M(D())},typeof window<"u")window.addEventListener("popstate",Q);if(Z=function(J){let P,E,B;if(J.button!==0||J.metaKey||J.ctrlKey||J.shiftKey||J.altKey)return;E=J.target;while(E&&E.tagName!=="A")E=E.parentElement;if(!E?.href)return;if(B=new URL(E.href,location.origin),B.origin!==location.origin)return;if(E.target==="_blank"||E.hasAttribute("data-external"))return;return J.preventDefault(),P=H&&B.hash?B.hash.slice(1)||"/":B.pathname+B.search+B.hash,q.push(P)},typeof document<"u")document.addEventListener("click",Z);return q={push:function(J){return M(J)?history.pushState(null,"",G(Y.read())):void 0},replace:function(J){return M(J)?history.replaceState(null,"",G(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(J){return w.add(J),function(){return w.delete(J)}},rebuild:function(){return I=z1($,O)},routes:void 0,init:function(){return M(D()),q},destroy:function(){if(typeof window<"u")window.removeEventListener("popstate",Q);if(typeof document<"u")document.removeEventListener("click",Z);return w.clear()}},Object.defineProperty(q,"current",{get:function(){return{path:Y.value,params:f.value,route:_.value,layouts:U.value,query:F.value,hash:A.value}}}),Object.defineProperty(q,"path",{get:function(){return Y.value}}),Object.defineProperty(q,"params",{get:function(){return f.value}}),Object.defineProperty(q,"route",{get:function(){return _.value}}),Object.defineProperty(q,"layouts",{get:function(){return U.value}}),Object.defineProperty(q,"query",{get:function(){return F.value}}),Object.defineProperty(q,"hash",{get:function(){return A.value}}),Object.defineProperty(q,"navigating",{get:function(){return u.value},set:function(J){return u.value=J}}),Object.defineProperty(q,"routes",{get:function(){return I.routes}}),q},C2=function($={}){let W,A,U,u,f,Y,F,_,X,R,H,w,Z,K,Q,D,M,O,q,z,I;if({router:q,app:W,components:f,resolver:O,compile:U,target:z,onError:D}=$,Y=typeof z==="string"?document.querySelector(z):z||document.getElementById("app"),!Y)Y=document.createElement("div"),Y.id="app",document.body.appendChild(Y);return Y.style.opacity="0",F=null,X=null,_=[],w=[],K=Y,H=0,R=null,u=new Map,Z=$.cacheSize||10,A=function(){let G,J;if(F&&X){if(F.beforeUnmount)F.beforeUnmount();if(u.set(X,F),u.size>Z){if(J=u.keys().next().value,G=u.get(J),G.unmounted)G.unmounted();u.delete(J)}return F=null,X=null}},I=function(){A();for(let G=w.length-1;G>=0;G--){let J=w[G];if(J.beforeUnmount)J.beforeUnmount();if(J.unmounted)J.unmounted();J._root?.remove()}return w=[],K=Y},f.watch(function(G,J){let P;if(u.has(J)){if(P=u.get(J),P.unmounted)P.unmounted();return u.delete(J)}}),Q=async function(G){let J,P,E,B,N,T,L,h,m,u1,f1,m1,n,n1,Z1,R1,Q1,P1,C,i1,I1,o;if({route:C,params:R1,layouts:h,query:P1}=G,!C)return;if(C.file===X)return;return B=++H,q.navigating=!0,(async()=>{try{if(I1=f.read(C.file),!I1){if(D)D({status:404,message:`File not found: ${C.file}`});q.navigating=!1;return}if(m1=await q1(I1,U,f,C.file,O),B!==H){q.navigating=!1;return}if(J=c1(m1),!J){if(D)D({status:500,message:`No component found in ${C.file}`});q.navigating=!1;return}if(f1=!D2(h,_),n1=F?._root,f1)I();else A();if(n=f1?Y:K,f1&&h.length>0){Y.innerHTML="",n=Y;for(let c of h){if(u1=f.read(c),!u1)continue;if(m=await q1(u1,U,f,c,O),B!==H){q.navigating=!1;return}if(P=c1(m),!P)continue;if(T=new P({app:W,params:R1,router:q}),T.beforeMount)T.beforeMount();o=document.createElement("div"),o.setAttribute("data-layout",c),n.appendChild(o),T.mount(o),w.push(T),i1=o.querySelector("#content")||o,n=i1}_=[...h],K=n}else if(f1)Y.innerHTML="",_=[],K=Y;if(E=u.get(C.file),E)u.delete(C.file),n.appendChild(E._root),F=E,X=C.file;else{if(Z1=document.createElement("div"),Z1.setAttribute("data-component",C.file),n.appendChild(Z1),L=new J({app:W,params:R1,query:P1,router:q}),L.beforeMount)L.beforeMount();if(L.mount(Z1),F=L,X=C.file,L.load)await L.load(R1,P1)}return n1?.remove(),q.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(c){if(q.navigating=!1,Y.style.opacity="1",console.error(`Renderer: error mounting ${C.file}:`,c),D)D({status:500,message:c.message,error:c});N=!1;for(let E1=w.length-1;E1>=0;E1--){let p1=w[E1];if(p1.onError)try{p1.onError(c),N=!0;break}catch(y2){console.error("Renderer: error boundary failed:",y2)}}return(()=>{if(!N)return Q1=document.createElement("pre"),Q1.style.cssText="color:red;padding:1em",Q1.textContent=c.stack||c.message,Y.innerHTML="",Y.appendChild(Q1)})()}})()},M={start:function(){return R=r(function(){let G;return G=q.current,G.route?Q(G):void 0}),q.init(),M},stop:function(){if(I(),R)R(),R=null;return Y.innerHTML=""},remount:function(){let G;return G=q.current,G.route?Q(G):void 0},cache:u},M},g3=async function($="",W={}){let A,U,u,f,Y,F,_,X,R,H,w,Z,K,Q,D,M,O,q,z,I,G;if(globalThis.__ripLaunched=!0,typeof $==="object")W=$,$="";if($=$.replace(/\/+$/,""),G=W.target||"#app",R=W.compile||null,Q=W.persist||!1,Z=W.hash||!1,!R)R=globalThis?.compileToJS||null;if(typeof document<"u"&&!document.querySelector(G))w=document.createElement("div"),w.id=G.replace(/^#/,""),document.body.prepend(w);if(W.bundle)F=W.bundle;else if(W.components&&Array.isArray(W.components)){H={};for(let J of W.components)if(M=await fetch(J),M.ok)K=J.split("/").pop(),H[`components/${K}`]=await M.text();F={components:H,data:{}}}else if(typeof document<"u"&&document.querySelectorAll('script[type="text/rip"][data-name]').length>0){H={};for(let J of document.querySelectorAll('script[type="text/rip"][data-name]'))K=J.getAttribute("data-name"),K+=!K.endsWith(".rip")?".rip":void 0,H[`components/${K}`]=J.textContent;F={components:H,data:{}}}else{if(_=`${$}/bundle`,M=await fetch(_,{cache:"no-cache"}),!M.ok)throw Error(`launch: ${_} (${M.status})`);F=await M.json()}if(f=S2({components:{},routes:{},data:{}}),F.data)f.data=F.data;if(F.routes)f.routes=F.routes;if(Q&&typeof sessionStorage<"u"){u=`__rip_${$}`,U=Q==="local"?localStorage:sessionStorage;try{if(z=U.getItem(u),z){I=JSON.parse(z);for(let J in I){let P=I[J];f.data[J]=P}}}catch{}A=function(){return(()=>{try{return U.setItem(u,JSON.stringify(L2(f.data)))}catch{return null}})()},r(function(){let J;return g1.value,J=setTimeout(A,2000),function(){return clearTimeout(J)}}),window.addEventListener("beforeunload",A)}if(Y=j2(),F.components)Y.load(F.components);if(X=`__rip_${$.replace(/\//g,"_")||"app"}`,O={map:H2(Y),classes:{},key:X},typeof globalThis<"u")globalThis[X]=O.classes;if(f.data.title&&typeof document<"u")document.title=f.data.title;if(q=h2(Y,{root:"components",base:$,hash:Z,onError:function(J){return console.error(`[Rip] Error ${J.status}: ${J.message||J.path}`)}}),D=C2({router:q,app:f,components:Y,resolver:O,compile:R,target:G,onError:function(J){return console.error(`[Rip] ${J.message}`,J.error)}}),D.start(),F.data?.watch)M2(`${$}/watch`);if(typeof window<"u")window.app=f,window.__RIP__={app:f,components:Y,router:q,renderer:D,cache:D.cache,version:"0.3.0"};return{app:f,components:Y,router:q,renderer:D}};t.modules["app.rip"]=G1;for(let[$,W]of Object.entries(G1))if(typeof W==="function")globalThis[$]=W;export{j3 as rip,V3 as processRipScripts,a as parser,t as importRip,w1 as getReactiveRuntime,C1 as getComponentRuntime,x as formatSExpr,d as compileToJS,h1 as compile,T3 as VERSION,p as Lexer,M1 as Compiler,y as CodeGenerator,S3 as BUILD_DATE};
Binary file
@@ -926,10 +926,9 @@ export Summary = component
926
926
  "#{mo}/#{dy}/#{yr}"
927
927
 
928
928
  historyDate ~=
929
- return '' unless history?[0]?.date
930
- months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
931
- [yr, mo] = history[0].date.split('-')
932
- "#{months[parseInt(mo, 10) - 1]} #{yr}"
929
+ return '' unless history and history[0] and history[0].date
930
+ parts = history[0].date.split('-')
931
+ "#{parts[1]}/#{parts[0]}"
933
932
 
934
933
  checkIcon := '<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>'
935
934
  warnIcon := '<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>'
@@ -938,18 +937,28 @@ export Summary = component
938
937
  s = []
939
938
  s.push { label: 'Heart Health', keys: ['triglycerides', 'hdlCholesterol', 'totalCholesterol', 'cholesterolHdlRatio'] }
940
939
  s.push { label: 'Pancreas Health', keys: ['glucose', 'a1c'] }
941
- s.push { label: 'Physical Measurements', keys: ['waistCircumference', 'bloodPressure'] } if history?[0]?.waistCircumference
940
+ if history and history[0] and history[0].waistCircumference?
941
+ s.push { label: 'Physical Measurements', keys: ['waistCircumference', 'bloodPressure'] }
942
942
  s
943
943
 
944
- rowClass: (k) ->
945
- val = history[0]?[k]
946
- return '' unless val?
947
- if acceptable(k, val) is 'acceptable' then 'row-acceptable' else 'row-unacceptable'
948
-
949
- rowIcon: (k) ->
950
- val = history[0]?[k]
951
- return '' unless val?
952
- if acceptable(k, val) is 'acceptable' then checkIcon else warnIcon
944
+ rows ~=
945
+ result = []
946
+ for section in sections
947
+ for k in section.keys
948
+ ref = ranges[k]
949
+ continue unless ref
950
+ val = history[0]?[k]
951
+ continue unless val?
952
+ status = acceptable(k, val)
953
+ result.push
954
+ section: section.label
955
+ key: k
956
+ name: ref.name
957
+ desc: ref.desc
958
+ value: String(val)
959
+ rowClass: if status is 'acceptable' then 'row-acceptable' else 'row-unacceptable'
960
+ icon: if status is 'acceptable' then checkIcon else warnIcon
961
+ result
953
962
 
954
963
  render
955
964
  .('brochure__page page-summary')
@@ -969,27 +978,22 @@ export Summary = component
969
978
 
970
979
  .summary__copy "This report serves as an easy reference to review all of your testing results, including data from previous years. We encourage you to use this information in conjunction with an exam by your doctor, not as a replacement for one. We hope this summary will be a good starting point for conversations with your doctor about improving your overall health."
971
980
 
972
- for section, i in sections
973
- table.summary-table
974
- unless i
975
- thead
976
- tr
977
- th
978
- th historyDate
979
- tbody
981
+ table.summary-table
982
+ thead
983
+ tr
984
+ th ""
985
+ th historyDate
986
+ tbody
987
+ for row in rows
980
988
  tr
981
- td section.label
989
+ class: row.rowClass
982
990
  td
983
- for k in section.keys
984
- tr
985
- class: @rowClass(k)
986
- td
987
- .status-icon
988
- innerHTML: @rowIcon(k)
989
- div
990
- .name ranges[k].name
991
- .desc ranges[k].desc
992
- td.value history[0]?[k]
991
+ .status-icon
992
+ innerHTML: row.icon
993
+ div
994
+ .name row.name
995
+ .desc row.desc
996
+ td.value row.value
993
997
  </script>
994
998
 
995
999
  <script type="text/rip" data-name="detail-page">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.12.2",
3
+ "version": "3.12.3",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/app.rip CHANGED
@@ -919,7 +919,7 @@ export launch = (appBase = '', opts = {}) ->
919
919
  bundle = { components, data: {} }
920
920
  else
921
921
  bundleUrl = "#{appBase}/bundle"
922
- res = await fetch(bundleUrl)
922
+ res = await fetch(bundleUrl, cache: 'no-cache')
923
923
  throw new Error "launch: #{bundleUrl} (#{res.status})" unless res.ok
924
924
  bundle = res.json!
925
925
 
package/src/browser.js CHANGED
@@ -142,8 +142,6 @@ async function autoLaunch() {
142
142
  if (!ui?.launch) return;
143
143
  const cfg = document.querySelector('script[data-hash], script[data-url]');
144
144
  const url = cfg?.getAttribute('data-url') || '';
145
- const hasComponents = document.querySelectorAll('script[type="text/rip"][data-name]').length > 0;
146
- if (!hasComponents && !url) return;
147
145
  const hash = cfg?.getAttribute('data-hash');
148
146
  const opts = { hash: hash !== 'false' };
149
147
  await ui.launch(url, opts);