mancha 0.23.0 → 0.23.1
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/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/{interfaces-4UqEBAXK.d.ts → interfaces-DhL-_vL-.d.ts} +5 -22
- package/dist/mancha.js +2 -2
- package/dist/{renderer-ZW6Iyyzj.js → renderer-1jqgJa7K.js} +23 -23
- package/dist/safe_browser.d.ts +1 -1
- package/dist/safe_browser.js +1 -1
- package/dist/store.d.ts +9 -29
- package/dist/store.js +33 -68
- package/dist/store.js.map +1 -1
- package/docs/03_reactivity.md +12 -29
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as StoreState, i as IRenderer, n as RenderParams, r as RendererPlugin, t as ParserParams } from "./interfaces-
|
|
1
|
+
import { a as StoreState, i as IRenderer, n as RenderParams, r as RendererPlugin, t as ParserParams } from "./interfaces-DhL-_vL-.js";
|
|
2
2
|
import { SafeStyleSheet } from "safevalues";
|
|
3
3
|
|
|
4
4
|
//#region src/css_custom.d.ts
|
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as i}from"./renderer-
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./renderer-1jqgJa7K.js";import{safeStyleEl as a}from"safevalues/dom";import{concatStyleSheets as o,safeStyleSheet as s}from"safevalues";function c(){return o([s`*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}`,s`html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}`,s`body{margin:0;line-height:inherit}`,s`hr{height:0;color:inherit;border-top-width:1px}`,s`abbr:where([title]){text-decoration:underline dotted}`,s`b,strong{font-weight:bolder}`,s`code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}`,s`small{font-size:80%}`,s`sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,s`sub{bottom:-0.25em}`,s`sup{top:-0.5em}`,s`button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}`,s`button,select{text-transform:none}`,s`button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button;background-color:transparent;background-image:none;cursor:pointer}`,s`:-moz-focusring{outline:auto}`,s`:-moz-ui-invalid{box-shadow:none}`,s`progress{vertical-align:baseline}`,s`::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,s`[type='search']{-webkit-appearance:textfield;outline-offset:-2px}`,s`::-webkit-search-decoration{-webkit-appearance:none}`,s`::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,s`summary{display:list-item}`,s`blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,s`fieldset{margin:0;padding:0}`,s`legend{padding:0}`,s`ol,ul,menu{list-style:none;margin:0;padding:0}`,s`textarea{resize:vertical}`,s`::placeholder{opacity:1;color:#9ca3af}`,s`button,[role="button"]{cursor:pointer}`,s`:disabled{cursor:default;pointer-events:none;opacity:0.75}`,s`img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,s`img,video{max-width:100%;height:auto}`,s`[hidden]{display:none}`,s`dialog{padding:0}`,s`dialog::backdrop{background:rgba(0,0,0,0.5)}`])}function l(){return o([s`html{`,s`max-width: 70ch;`,s`padding: 2em 1em;`,s`margin: auto;`,s`line-height: 1.75;`,s`font-size: 1.25em;`,s`font-family: sans-serif;`,s`}`,s`h1,h2,h3,h4,h5,h6{`,s`margin: 1em 0 0.5em;`,s`}`,s`p,ul,ol{`,s`margin-bottom: 1em;`,s`color: #1d1d1d;`,s`}`])}var u=class extends i{impl=`browser`;dirpath=n(globalThis.location?.href??`http://localhost/`);parseHTML(e,t={rootDocument:!1}){if(t.rootDocument)return new DOMParser().parseFromString(e,`text/html`);{let t=document.createRange();return t.selectNodeContents(document.body),t.createContextualFragment(e)}}serializeHTML(e){return new XMLSerializer().serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,``)}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}createComment(e,t){return(t||document).createComment(e)}textContent(e,t){e.textContent=t}};const d=new u;function f(n){for(let r of n){r=r.trim();let n=document.createElement(`style`);switch(r){case`minimal`:a.setTextContent(n,l());break;case`basic`:case`custom`:console.warn(`css="${r}" is deprecated; use css="utils" instead.`);continue;case`utils`:{a.setTextContent(n,c()),n.setAttribute(`data-mancha`,`basic`),globalThis.document.head.appendChild(n);let r=document.createElement(`style`);r.textContent=e(),r.setAttribute(`data-mancha`,`utils`),globalThis.document.head.appendChild(r),t(document);continue}default:console.error(`Unknown style name: "${r}"`);continue}globalThis.document.head.appendChild(n)}}const p=`mancha-cloak`;function m(e,t){let n=`${e.join(`, `)} { opacity: 0 !important; ${t>0?`transition: opacity ${t}ms ease-in-out !important;`:``} }`,r=document.getElementById(p);r||(r=document.createElement(`style`),r.id=p,document.head.appendChild(r)),r.textContent=n}function h(e){let t=!1;return async()=>{if(t)return;t=!0;let n=document.getElementById(p);if(n){if(e!==!1){let t=n.sheet;t&&t.cssRules.length>0&&t.cssRules[0].style.setProperty(`opacity`,`1`,`important`),await new Promise(t=>setTimeout(t,e))}typeof globalThis.requestAnimationFrame==`function`&&(await new Promise(e=>globalThis.requestAnimationFrame(e)),await new Promise(e=>globalThis.requestAnimationFrame(e))),n.remove()}}}async function g(e={}){let t;document.documentElement.classList.add(`mancha-loading`);let n=e.cloak?e.cloak===!0?{}:e.cloak:void 0;if(n){let r=e.target?Array.isArray(e.target)?e.target:[e.target]:[`body`],i=n.selector&&(Array.isArray(n.selector)||typeof n.selector==`string`)?Array.isArray(n.selector)?n.selector:[n.selector]:r,a=n.duration??0;m(i,a),t=h(a>0?a:!1)}else t=h(!1);document.readyState===`loading`&&await new Promise(e=>{window.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0})});let r=e.renderer??new u;if(e.css&&e.css.length>0&&f(e.css),e.debug&&r.debug(!0),e.state)for(let[t,n]of Object.entries(e.state))await r.set(t,n);try{if(e.callback)await e.callback(r);else if(e.target){let t=Array.isArray(e.target)?e.target:[e.target];for(let n of t){let t=globalThis.document.querySelector(n);t?await r.mount(t,{cache:e.cache}):console.error(`Target element not found: "${n}"`)}}}finally{document.documentElement.classList.remove(`mancha-loading`),t&&await t()}return r}export{i as IRenderer,d as Mancha,u as Renderer,r as _resetCustomCssForTesting,c as basicCssRules,g as initMancha,f as injectCss,l as minimalCssRules,e as utilsCssRules};
|
|
@@ -43,12 +43,6 @@ type KeyValueHandler = (this: SignalStoreProxy, key: string, value: unknown) =>
|
|
|
43
43
|
|
|
44
44
|
/** Function type for computed value definitions. Receives reactive context as `$` parameter. */
|
|
45
45
|
type ComputedFn<T extends StoreState, R> = (this: ReactiveContext<T>, $: ReactiveContext<T>) => R;
|
|
46
|
-
/**
|
|
47
|
-
* How a key's notifications are scheduled: a debounce in millis, or "raf" for one
|
|
48
|
-
* flush per animation frame, which is the right clock for observers that end in a
|
|
49
|
-
* DOM write and is cheaper than a timer.
|
|
50
|
-
*/
|
|
51
|
-
type NotifyPolicy = number | "raf";
|
|
52
46
|
declare class SignalStore<T extends StoreState = StoreState> {
|
|
53
47
|
protected readonly evalkeys: string[];
|
|
54
48
|
protected readonly expressionCache: Map<string, EvalFunction>;
|
|
@@ -56,17 +50,12 @@ declare class SignalStore<T extends StoreState = StoreState> {
|
|
|
56
50
|
protected readonly keyHandlers: Map<RegExp, Set<KeyValueHandler>>;
|
|
57
51
|
readonly _store: Map<string, unknown>;
|
|
58
52
|
_lock: Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/** Per-key scheduling overrides, set via debounce(). */
|
|
65
|
-
private readonly _policy;
|
|
66
|
-
/** Keys written while their own observers were mid-flush, to notify afterwards. */
|
|
53
|
+
/** Keys with a scheduled observer run. */
|
|
54
|
+
private readonly _pending;
|
|
55
|
+
/** Keys whose observers are running right now. */
|
|
56
|
+
private readonly _executing;
|
|
57
|
+
/** Keys written while their own observers were running, to notify afterwards. */
|
|
67
58
|
private readonly _dirty;
|
|
68
|
-
/** When the current pending debounce burst started, per key. Bounds the trailing wait. */
|
|
69
|
-
private readonly _burstStart;
|
|
70
59
|
/**
|
|
71
60
|
* Tracks nested computed evaluation depth. When > 0, we're inside a computed
|
|
72
61
|
* function and writes to reactive properties should trigger a warning.
|
|
@@ -88,12 +77,6 @@ declare class SignalStore<T extends StoreState = StoreState> {
|
|
|
88
77
|
* then A is also marked dirty).
|
|
89
78
|
*/
|
|
90
79
|
private markDependentComputedsDirty;
|
|
91
|
-
/**
|
|
92
|
-
* Overrides how a key's notifications are scheduled. The default debounce suits a
|
|
93
|
-
* view object republished wholesale, where coalescing is the point, but not a
|
|
94
|
-
* per-frame scalar; this opts a single key out without affecting the rest.
|
|
95
|
-
*/
|
|
96
|
-
debounce(key: string, policy: NotifyPolicy): void;
|
|
97
80
|
notify(key: string, debounceMillis?: number): Promise<void>;
|
|
98
81
|
get<T>(key: string, observer?: Observer<T>): unknown;
|
|
99
82
|
private setupComputed;
|
package/dist/mancha.js
CHANGED
|
@@ -52,7 +52,7 @@ let ft=new Set([`this`,`typeof`]),pt=new Set([`in`]),mt=new Set([`+`,`-`,`!`,`ty
|
|
|
52
52
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
53
53
|
*/
|
|
54
54
|
let bt=new Set([`==`,`!=`,`<=`,`>=`,`||`,`&&`,`??`,`?.`]),xt=new Set([`===`,`!==`]),q=function(e){return e[e.STRING=1]=`STRING`,e[e.IDENTIFIER=2]=`IDENTIFIER`,e[e.DOT=3]=`DOT`,e[e.COMMA=4]=`COMMA`,e[e.COLON=5]=`COLON`,e[e.INTEGER=6]=`INTEGER`,e[e.DECIMAL=7]=`DECIMAL`,e[e.OPERATOR=8]=`OPERATOR`,e[e.GROUPER=9]=`GROUPER`,e[e.KEYWORD=10]=`KEYWORD`,e[e.ARROW=11]=`ARROW`,e[e.OPTIONAL_DOT=12]=`OPTIONAL_DOT`,e[e.SPREAD=13]=`SPREAD`,e}({}),J=(e,t,n=0)=>({kind:e,value:t,precedence:n}),St=e=>e===9||e===10||e===13||e===32,Ct=e=>{if(e===95||e===36)return!0;let t=e&-33;return 65<=t&&t<=90},wt=e=>Ct(e)||Y(e),Tt=e=>ft.has(e),Et=e=>e===34||e===39,Y=e=>48<=e&&e<=57,Dt=e=>e===43||e===45||e===42||e===47||e===33||e===38||e===37||e===60||e===61||e===62||e===63||e===94||e===124,Ot=e=>e===40||e===41||e===91||e===93||e===123||e===125,kt=e=>e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
|
|
55
|
-
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var At=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;St(this._next??-1);)this._advance(!0);if(Et(this._next??-1))return this._tokenizeString();if(Ct(this._next??-1))return this._tokenizeIdentOrKeyword();if(Y(this._next??-1))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(Dt(this._next??-1))return this._tokenizeOperator();if(Ot(this._next??-1))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0||this._next===92&&(this._advance(),this._next===void 0))throw Error(`unterminated string`);this._advance()}let t=J(q.STRING,kt(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(wt(this._next??-1));let e=this._getValue();return J(Tt(e)?q.KEYWORD:pt.has(e)?q.OPERATOR:q.IDENTIFIER,e,gt[e]??0)}_tokenizeNumber(){do this._advance();while(Y(this._next??-1));return this._next===46?this._tokenizeDot():J(q.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),Y(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),J(q.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),J(q.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),J(q.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),J(q.COLON,`:`)}_tokenizeFraction(){do this._advance();while(Y(this._next??-1));return J(q.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(xt.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),J(q.ARROW,e);bt.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?J(q.OPTIONAL_DOT,e,13):J(q.OPERATOR,e,gt[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=J(q.GROUPER,e,gt[e]);return this._advance(!0),t}};let jt=(e,t)=>new Mt(e,t).parse();var Mt=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new At(e),this._ast=t}parse(){this._advance();let e=this._parseExpression();if(this._token)throw Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let n=this._tokenizer.nextToken();this._token=n,this._kind=n?.kind,this._value=n?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw Error(`Expected left to be defined.`);for(;this._token;)if(this._matches(q.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(q.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(q.DOT)||this._matches(q.OPTIONAL_DOT)){let t=this._kind===q.OPTIONAL_DOT;if(this._advance(),t&&this._matches(q.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(q.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{let n=this._parseUnary();e=this._makeInvokeOrGetter(e,n,t)}}else if(this._matches(q.KEYWORD))break;else if(this._matches(q.OPERATOR)&&this._token.precedence>=t)e=this._value===`?`?this._parseTernary(e):this._parseBinary(e,this._token);else break;return e}_makeInvokeOrGetter(e,t,n){if(t===void 0)throw Error(`expected identifier`);if(t.type===`ID`)return this._ast.getter(e,t.value,n);if(t.type===`Invoke`&&t.receiver.type===`ID`){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,n)}else throw Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!ht.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===q.OPERATOR||this._kind===q.DOT||this._kind===q.GROUPER)&&this._token&&(this._token.precedence??0)>t.precedence;)n=this._parsePrecedence(n,this._token?.precedence??0);if(n===void 0)throw Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,n)}_parseUnary(){if(this._matches(q.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(q.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(q.INTEGER))return this._parseInteger(e);if(this._matches(q.DECIMAL))return this._parseDecimal(e)}if(!e||!mt.has(e))throw Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(q.OPERATOR,`?`);let t=this._parseExpression();this._advance(q.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case q.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw ft.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case q.IDENTIFIER:return this._parseInvokeOrIdentifier();case q.STRING:return this._parseString();case q.INTEGER:return this._parseInteger();case q.DECIMAL:return this._parseDecimal();case q.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case q.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(q.GROUPER,`]`))break;if(this._matches(q.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(q.COMMA));return this._advance(q.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(q.GROUPER,`}`))break;if(this._matches(q.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(q.STRING)||this._matches(q.IDENTIFIER))&&this._advance(),this._matches(q.COLON)){this._advance(q.COLON);let n=this._parseExpression();n&&e.push(this._ast.property(t,n))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(q.COMMA));return this._advance(q.GROUPER,`}`),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e===`true`)return this._advance(),this._ast.literal(!0);if(e===`false`)return this._advance(),this._ast.literal(!1);if(e===`null`)return this._advance(),this._ast.literal(null);if(e===`undefined`)return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),n=this._parseArguments();return n?this._ast.invoke(t,void 0,n):t}_parseIdentifier(){if(!this._matches(q.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(q.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(q.GROUPER,`)`))break;if(this._matches(q.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{let t=this._parseExpression();e.push(t)}}while(this._matches(q.COMMA));return this._advance(q.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(q.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(q.ARROW)){this._advance();let t=this._parseExpression(),n=e?.map(e=>e.value)??[];return this._ast.arrowFunction(n,t)}else return this._ast.paren(e?.[0])}_parseString(){let e=this._ast.literal(this._value??``);return this._advance(),e}_parseInteger(e=``){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=``){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};let X=Symbol(`__computed__`);function Nt(e){return typeof e==`object`&&!!e&&X in e&&e[X]===!0}function Pt(e,t){if(e===`raf`&&typeof globalThis.requestAnimationFrame==`function`){let e=globalThis.requestAnimationFrame(()=>t());return{cancel:()=>globalThis.cancelAnimationFrame?.(e)}}let n=setTimeout(t,e===`raf`?0:e);return{cancel:()=>clearTimeout(n)}}let Ft=new yt,It=`__is_proxy__`;function Lt(e){return e instanceof Bt||e[It]===!0}function Rt(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Rt(n.get(`$parent`),t)}function Z(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?Z(n.get(`$parent`),t):null}function zt(e,t,n){let r=Z(e,t);r?r._store.set(t,n):e._store.set(t,n)}var Bt=class e{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();_notify=new Map;_policy=new Map;_dirty=new Set;_burstStart=new Map;_computedDepth=0;constructor(e){for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e,t){if(e==null||Lt(e)||Object.isFrozen(e)||Object.isSealed(e))return e;let n=Object.getPrototypeOf(e);return!(n===Object.prototype||n===null)&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,n)=>typeof n==`string`&&n in e?(delete e[n],t(),!0):!1,set:(e,n,r,i)=>{if(Reflect.get(e,n,i)===r)return!0;typeof r==`object`&&r&&(r=this.wrapObject(r,t));let a=Reflect.set(e,n,r,i);return t(),a},get:(e,n,r)=>{if(n===It)return!0;let i=Reflect.get(e,n,r);if(typeof i==`object`&&i&&!Lt(i)){let a=this.wrapObject(i,t);if(a!==i)return Reflect.set(e,n,a,r),a}return i}})}watch(e,t){let n=Z(this,e);if(!n)throw Error(`Cannot watch key "${e}" as it does not exist in the store.`);n.observers.has(e)||n.observers.set(e,new Set),Array.from(n.observers.get(e)||[]).some(e=>e.observer===t)||n.observers.get(e)?.add({observer:t,store:this})}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e)?.add(t)}tagObserversForComputed(e,t){for(let n of this.observers.values())for(let r of n)r.observer===e&&r.store===this&&(r.computedKey=t);let n=this._store.get(`$parent`);for(;n;){for(let r of n.observers.values())for(let n of r)n.observer===e&&n.store===this&&(n.computedKey=t);n=n._store.get(`$parent`)}}markDependentComputedsDirty(e){let t=Z(this,e)?.observers.get(e);if(t){for(let e of t)if(e.computedKey){let t=e.store._store.get(e.computedKey);Nt(t)&&!t.dirty&&(t.dirty=!0,e.store.markDependentComputedsDirty(e.computedKey))}}}debounce(e,t){this._policy.set(e,t)}async notify(e,t){let n=Z(this,e),r=Array.from(n?.observers.get(e)||[]),i=this._notify.get(e);if(i===`executing`){this._dirty.add(e);return}let a=t??this._policy.get(e)??10,o=a;if(a!==`raf`){let t=Date.now(),n=this._burstStart.get(e)??t;this._burstStart.set(e,n);let r=Math.max(a,16);o=Math.min(a,Math.max(0,r-(t-n)))}return i&&i.cancel(),new Promise(i=>{this._notify.set(e,Pt(o,async()=>{this._burstStart.delete(e);try{this._notify.set(e,`executing`);let t=r.map(e=>e.observer.call(e.store.proxify(e.observer)));this._dirty.delete(e),await Promise.all(t)}finally{this._notify.delete(e),this._dirty.delete(e)&&this.notify(e,t)}let a=n?.observers.get(e);if(a)for(let e of r){let t=e.store._store.has(`$parent`),n=e.store._store.get(`$rootNode`);t&&n&&!n.isConnected&&!n.parentNode&&a.delete(e)}i()}))})}get(e,t){t&&this.watch(e,t);let n=Rt(this,e);if(Nt(n)){if(n.dirty){this._computedDepth++;try{let t=this.proxify(n.effectFn);n.value=n.fn.call(t,t),n.dirty=!1,n.effectFn&&this.tagObserversForComputed(n.effectFn,e),this.markDependentComputedsDirty(e)}finally{this._computedDepth--}}return n.value}return n}setupComputed(e,t){let n=this,r={[X]:!0,fn:t,dirty:!0};this._store.set(e,r);let i=function(){n._computedDepth++;try{let i=t.call(this,this);if(r.value!==i){r.value=i;let t=Z(n,e),a=Array.from(t?.observers.get(e)||[]);for(let e of a)e.observer.call(e.store.proxify(e.observer))}r.dirty=!1}finally{n._computedDepth--}};r.effectFn=i,this.effect(i,{directive:`computed`,id:e}),this.tagObserversForComputed(i,e)}async set(e,t,n){if(Nt(t)){this.setupComputed(e,t.fn);return}if(this._store.has(e)&&t===this._store.get(e))return;let r=()=>(this.markDependentComputedsDirty(e),this.notify(e));if(t&&typeof t==`object`&&(t=this.wrapObject(t,r)),n?this._store.set(e,t):zt(this,e,t),!n){for(let[n,r]of this.keyHandlers.entries())if(n.test(e))for(let n of r)await Promise.resolve(n.call(this.$,e,t))}await r()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}dispose(){for(let e of this.observers.values())e.clear();this.observers.clear();let e=this._store.get(`$parent`);for(;e;){for(let t of e.observers.values())for(let e of t)e.store===this&&t.delete(e);e=e._store.get(`$parent`)}}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}getObserverStats(){let e={},t=0;for(let[n,r]of this.observers)e[n]=r.size,t+=r.size;return{totalKeys:this.observers.size,totalObservers:t,byKey:e}}effect(e,t){return e.call(this.proxify(e))}$computed(e){return{[X]:!0,fn:e,dirty:!0}}proxify(t){let n=Array.from(this._store.entries()).map(([e])=>e),r=Object.fromEntries(n.map(e=>[e,null])),i=(e,t,n)=>typeof e==`function`&&t!==`constructor`?(...t)=>e.call(n,...t):e;return new Proxy(r,{has:(e,t)=>typeof t==`string`&&(Z(this,t)||Reflect.has(this,t))?!0:Reflect.has(r,t),get:(n,r,a)=>{if(typeof r==`string`){if(Z(this,r)){let n=this.get(r,t);return t&&n instanceof e?n.proxify(t):i(n,r,a)}if(t&&r!==It&&!Reflect.has(this,r))return this.set(r,void 0),this.get(r,t)}return r===`$`?this.proxify(t):i(Reflect.get(this,r,a),r,a)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):(this._computedDepth>0&&console.warn(`[mancha] Computed wrote to '${t}'. Computeds should be pure; use $effect for side effects.`),this.set(t,n)),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=jt(e,Ft),i=new Proxy(n,{has(e,n){return n in e||n in t||n in globalThis},get(e,n){if(typeof n==`string`)return n in e?e[n]:n in t?t[n]:n in globalThis?globalThis[n]:t[n]},set(e,n,r){return typeof n==`string`?n in e?(e[n]=r,!0):(t[n]=r,!0):!1}});return r?.evaluate(i)}}cachedExpressionFunction(e){e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e));let t=this.expressionCache.get(e);if(!t)throw Error(`Failed to retrieve cached expression: ${e}`);return t}eval(e,t={}){let n=this.$;if(this._store.has(e))return n[e];{let r=this.cachedExpressionFunction(e);try{return r(n,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}$resolve(e,t){let n={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{n.$result=e}).catch(e=>{n.$error=e instanceof Error?e:Error(String(e))}).finally(()=>{n.$pending=!1}),n}};let Vt=`data-m-cloak`,Ht=`mancha-runtime-cloak`,Ut=j`[data-m-cloak]{display:none!important}`;var Wt=class e extends Bt{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];cloakElement(e){let t=e.ownerDocument??globalThis.document;if(t?.head&&!t.getElementById(Ht)){let e=t.createElement(`style`);e.id=Ht,_(e,Ut),t.head.appendChild(e)}L(e,Vt,``)}uncloakElement(e){B(e,Vt)}debug(e){return typeof e==`boolean`?this._debugLevel=e?`lifecycle`:`off`:this._debugLevel=e,this}get debugging(){return this._debugLevel!==`off`}shouldLog(t){return e.DEBUG_LEVELS.indexOf(this._debugLevel)>=e.DEBUG_LEVELS.indexOf(t)}clearPerformanceReport(){this._perfData={lifecycle:{},effects:new Map}}getNodePath(e){let t=[],n=e;for(;n?.tagName;){let e=n.tagName.toLowerCase(),r=n.parentElement;if(r){let i=Array.from(r.children).filter(t=>t.tagName.toLowerCase()===e);if(i.length>1){let r=i.indexOf(n)+1;t.unshift(`${e}:nth-child(${r})`)}else t.unshift(e)}else t.unshift(e);n=r}return t.join(`>`)}buildObserverId(e){let t=e?.directive??`unknown`,n=$e(e?.expression??``,32),r=e?.element,i=e?.id??(r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`);return n?`${t}:${i}:${n}`:`${t}:${i}`}recordObserverExecution(e,t){let n=this.buildObserverId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}getPerformanceReport(){let e=Array.from(this._perfData.effects.entries()),t={};for(let[n,r]of e){let e=n.split(`:`)[0];t[e]||(t[e]={count:0,totalTime:0}),t[e].count+=r.count,t[e].totalTime+=r.totalTime}let n=e.map(([e,t])=>({id:e,executionCount:t.count,totalTime:t.totalTime,avgTime:t.count>0?t.totalTime/t.count:0})).sort((e,t)=>t.totalTime-e.totalTime).slice(0,10);return{lifecycle:this._perfData.lifecycle,effects:{total:e.length,byDirective:t,slowest:n},observers:this.getObserverStats()}}effect(e,t){let n=this;function r(){if(!n.shouldLog(`lifecycle`))return e.call(this);let r=performance.now(),i=e.call(this),a=performance.now()-r;return t&&n.recordObserverExecution(t,a),a>16&&console.warn(`[mancha] Slow observer (${a.toFixed(1)}ms):`,n.buildObserverId(t)),n.shouldLog(`effects`)&&console.debug(`[mancha] Observer (${a.toFixed(2)}ms):`,n.buildObserverId(t)),i}return super.effect(r,t)}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??`default`}).then(e=>e.text())}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log(`Preprocessing string content with params:
|
|
55
|
+
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var At=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;St(this._next??-1);)this._advance(!0);if(Et(this._next??-1))return this._tokenizeString();if(Ct(this._next??-1))return this._tokenizeIdentOrKeyword();if(Y(this._next??-1))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(Dt(this._next??-1))return this._tokenizeOperator();if(Ot(this._next??-1))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0||this._next===92&&(this._advance(),this._next===void 0))throw Error(`unterminated string`);this._advance()}let t=J(q.STRING,kt(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(wt(this._next??-1));let e=this._getValue();return J(Tt(e)?q.KEYWORD:pt.has(e)?q.OPERATOR:q.IDENTIFIER,e,gt[e]??0)}_tokenizeNumber(){do this._advance();while(Y(this._next??-1));return this._next===46?this._tokenizeDot():J(q.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),Y(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),J(q.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),J(q.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),J(q.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),J(q.COLON,`:`)}_tokenizeFraction(){do this._advance();while(Y(this._next??-1));return J(q.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(xt.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),J(q.ARROW,e);bt.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?J(q.OPTIONAL_DOT,e,13):J(q.OPERATOR,e,gt[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=J(q.GROUPER,e,gt[e]);return this._advance(!0),t}};let jt=(e,t)=>new Mt(e,t).parse();var Mt=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new At(e),this._ast=t}parse(){this._advance();let e=this._parseExpression();if(this._token)throw Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let n=this._tokenizer.nextToken();this._token=n,this._kind=n?.kind,this._value=n?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw Error(`Expected left to be defined.`);for(;this._token;)if(this._matches(q.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(q.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(q.DOT)||this._matches(q.OPTIONAL_DOT)){let t=this._kind===q.OPTIONAL_DOT;if(this._advance(),t&&this._matches(q.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(q.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{let n=this._parseUnary();e=this._makeInvokeOrGetter(e,n,t)}}else if(this._matches(q.KEYWORD))break;else if(this._matches(q.OPERATOR)&&this._token.precedence>=t)e=this._value===`?`?this._parseTernary(e):this._parseBinary(e,this._token);else break;return e}_makeInvokeOrGetter(e,t,n){if(t===void 0)throw Error(`expected identifier`);if(t.type===`ID`)return this._ast.getter(e,t.value,n);if(t.type===`Invoke`&&t.receiver.type===`ID`){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,n)}else throw Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!ht.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===q.OPERATOR||this._kind===q.DOT||this._kind===q.GROUPER)&&this._token&&(this._token.precedence??0)>t.precedence;)n=this._parsePrecedence(n,this._token?.precedence??0);if(n===void 0)throw Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,n)}_parseUnary(){if(this._matches(q.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(q.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(q.INTEGER))return this._parseInteger(e);if(this._matches(q.DECIMAL))return this._parseDecimal(e)}if(!e||!mt.has(e))throw Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(q.OPERATOR,`?`);let t=this._parseExpression();this._advance(q.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case q.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw ft.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case q.IDENTIFIER:return this._parseInvokeOrIdentifier();case q.STRING:return this._parseString();case q.INTEGER:return this._parseInteger();case q.DECIMAL:return this._parseDecimal();case q.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case q.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(q.GROUPER,`]`))break;if(this._matches(q.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(q.COMMA));return this._advance(q.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(q.GROUPER,`}`))break;if(this._matches(q.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(q.STRING)||this._matches(q.IDENTIFIER))&&this._advance(),this._matches(q.COLON)){this._advance(q.COLON);let n=this._parseExpression();n&&e.push(this._ast.property(t,n))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(q.COMMA));return this._advance(q.GROUPER,`}`),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e===`true`)return this._advance(),this._ast.literal(!0);if(e===`false`)return this._advance(),this._ast.literal(!1);if(e===`null`)return this._advance(),this._ast.literal(null);if(e===`undefined`)return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),n=this._parseArguments();return n?this._ast.invoke(t,void 0,n):t}_parseIdentifier(){if(!this._matches(q.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(q.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(q.GROUPER,`)`))break;if(this._matches(q.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{let t=this._parseExpression();e.push(t)}}while(this._matches(q.COMMA));return this._advance(q.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(q.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(q.ARROW)){this._advance();let t=this._parseExpression(),n=e?.map(e=>e.value)??[];return this._ast.arrowFunction(n,t)}else return this._ast.paren(e?.[0])}_parseString(){let e=this._ast.literal(this._value??``);return this._advance(),e}_parseInteger(e=``){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=``){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};let X=Symbol(`__computed__`);function Nt(e){return typeof e==`object`&&!!e&&X in e&&e[X]===!0}let Pt=new yt,Ft=`__is_proxy__`;function It(e){return e instanceof zt||e[Ft]===!0}function Lt(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Lt(n.get(`$parent`),t)}function Z(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?Z(n.get(`$parent`),t):null}function Rt(e,t,n){let r=Z(e,t);r?r._store.set(t,n):e._store.set(t,n)}var zt=class e{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();_pending=new Map;_executing=new Set;_dirty=new Set;_computedDepth=0;constructor(e){for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e,t){if(e==null||It(e)||Object.isFrozen(e)||Object.isSealed(e))return e;let n=Object.getPrototypeOf(e);return!(n===Object.prototype||n===null)&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,n)=>typeof n==`string`&&n in e?(delete e[n],t(),!0):!1,set:(e,n,r,i)=>{if(Reflect.get(e,n,i)===r)return!0;typeof r==`object`&&r&&(r=this.wrapObject(r,t));let a=Reflect.set(e,n,r,i);return t(),a},get:(e,n,r)=>{if(n===Ft)return!0;let i=Reflect.get(e,n,r);if(typeof i==`object`&&i&&!It(i)){let a=this.wrapObject(i,t);if(a!==i)return Reflect.set(e,n,a,r),a}return i}})}watch(e,t){let n=Z(this,e);if(!n)throw Error(`Cannot watch key "${e}" as it does not exist in the store.`);n.observers.has(e)||n.observers.set(e,new Set),Array.from(n.observers.get(e)||[]).some(e=>e.observer===t)||n.observers.get(e)?.add({observer:t,store:this})}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e)?.add(t)}tagObserversForComputed(e,t){for(let n of this.observers.values())for(let r of n)r.observer===e&&r.store===this&&(r.computedKey=t);let n=this._store.get(`$parent`);for(;n;){for(let r of n.observers.values())for(let n of r)n.observer===e&&n.store===this&&(n.computedKey=t);n=n._store.get(`$parent`)}}markDependentComputedsDirty(e){let t=Z(this,e)?.observers.get(e);if(t){for(let e of t)if(e.computedKey){let t=e.store._store.get(e.computedKey);Nt(t)&&!t.dirty&&(t.dirty=!0,e.store.markDependentComputedsDirty(e.computedKey))}}}async notify(e,t=10){let n=Z(this,e),r=Array.from(n?.observers.get(e)||[]);if(this._executing.has(e)){this._dirty.add(e);return}let i=this._pending.get(e);if(i){for(let e of r)i.entries.includes(e)||i.entries.push(e);return i.done}let a=new Promise(i=>{setTimeout(async()=>{this._pending.delete(e);try{this._executing.add(e);let t=r.map(e=>e.observer.call(e.store.proxify(e.observer)));this._dirty.delete(e),await Promise.all(t)}finally{this._executing.delete(e),this._dirty.delete(e)&&this.notify(e,t)}let a=n?.observers.get(e);if(a)for(let e of r){let t=e.store._store.has(`$parent`),n=e.store._store.get(`$rootNode`);t&&n&&!n.isConnected&&!n.parentNode&&a.delete(e)}i()},t)});return this._pending.set(e,{done:a,entries:r}),a}get(e,t){t&&this.watch(e,t);let n=Lt(this,e);if(Nt(n)){if(n.dirty){this._computedDepth++;try{let t=this.proxify(n.effectFn);n.value=n.fn.call(t,t),n.dirty=!1,n.effectFn&&this.tagObserversForComputed(n.effectFn,e),this.markDependentComputedsDirty(e)}finally{this._computedDepth--}}return n.value}return n}setupComputed(e,t){let n=this,r={[X]:!0,fn:t,dirty:!0};this._store.set(e,r);let i=function(){n._computedDepth++;try{let i=t.call(this,this);if(r.value!==i){r.value=i;let t=Z(n,e),a=Array.from(t?.observers.get(e)||[]);for(let e of a)e.observer.call(e.store.proxify(e.observer))}r.dirty=!1}finally{n._computedDepth--}};r.effectFn=i,this.effect(i,{directive:`computed`,id:e}),this.tagObserversForComputed(i,e)}async set(e,t,n){if(Nt(t)){this.setupComputed(e,t.fn);return}if(this._store.has(e)&&t===this._store.get(e))return;let r=()=>(this.markDependentComputedsDirty(e),this.notify(e));if(t&&typeof t==`object`&&(t=this.wrapObject(t,r)),n?this._store.set(e,t):Rt(this,e,t),!n){for(let[n,r]of this.keyHandlers.entries())if(n.test(e))for(let n of r)await Promise.resolve(n.call(this.$,e,t))}await r()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}dispose(){for(let e of this.observers.values())e.clear();this.observers.clear();let e=this._store.get(`$parent`);for(;e;){for(let t of e.observers.values())for(let e of t)e.store===this&&t.delete(e);e=e._store.get(`$parent`)}}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}getObserverStats(){let e={},t=0;for(let[n,r]of this.observers)e[n]=r.size,t+=r.size;return{totalKeys:this.observers.size,totalObservers:t,byKey:e}}effect(e,t){return e.call(this.proxify(e))}$computed(e){return{[X]:!0,fn:e,dirty:!0}}proxify(t){let n=Array.from(this._store.entries()).map(([e])=>e),r=Object.fromEntries(n.map(e=>[e,null])),i=(e,t,n)=>typeof e==`function`&&t!==`constructor`?(...t)=>e.call(n,...t):e;return new Proxy(r,{has:(e,t)=>typeof t==`string`&&(Z(this,t)||Reflect.has(this,t))?!0:Reflect.has(r,t),get:(n,r,a)=>{if(typeof r==`string`){if(Z(this,r)){let n=this.get(r,t);return t&&n instanceof e?n.proxify(t):i(n,r,a)}if(t&&r!==Ft&&!Reflect.has(this,r))return this.set(r,void 0),this.get(r,t)}return r===`$`?this.proxify(t):i(Reflect.get(this,r,a),r,a)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):(this._computedDepth>0&&console.warn(`[mancha] Computed wrote to '${t}'. Computeds should be pure; use $effect for side effects.`),this.set(t,n)),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=jt(e,Pt),i=new Proxy(n,{has(e,n){return n in e||n in t||n in globalThis},get(e,n){if(typeof n==`string`)return n in e?e[n]:n in t?t[n]:n in globalThis?globalThis[n]:t[n]},set(e,n,r){return typeof n==`string`?n in e?(e[n]=r,!0):(t[n]=r,!0):!1}});return r?.evaluate(i)}}cachedExpressionFunction(e){e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e));let t=this.expressionCache.get(e);if(!t)throw Error(`Failed to retrieve cached expression: ${e}`);return t}eval(e,t={}){let n=this.$;if(this._store.has(e))return n[e];{let r=this.cachedExpressionFunction(e);try{return r(n,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}$resolve(e,t){let n={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{n.$result=e}).catch(e=>{n.$error=e instanceof Error?e:Error(String(e))}).finally(()=>{n.$pending=!1}),n}};let Bt=`data-m-cloak`,Vt=`mancha-runtime-cloak`,Ht=j`[data-m-cloak]{display:none!important}`;var Ut=class e extends zt{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];cloakElement(e){let t=e.ownerDocument??globalThis.document;if(t?.head&&!t.getElementById(Vt)){let e=t.createElement(`style`);e.id=Vt,_(e,Ht),t.head.appendChild(e)}L(e,Bt,``)}uncloakElement(e){B(e,Bt)}debug(e){return typeof e==`boolean`?this._debugLevel=e?`lifecycle`:`off`:this._debugLevel=e,this}get debugging(){return this._debugLevel!==`off`}shouldLog(t){return e.DEBUG_LEVELS.indexOf(this._debugLevel)>=e.DEBUG_LEVELS.indexOf(t)}clearPerformanceReport(){this._perfData={lifecycle:{},effects:new Map}}getNodePath(e){let t=[],n=e;for(;n?.tagName;){let e=n.tagName.toLowerCase(),r=n.parentElement;if(r){let i=Array.from(r.children).filter(t=>t.tagName.toLowerCase()===e);if(i.length>1){let r=i.indexOf(n)+1;t.unshift(`${e}:nth-child(${r})`)}else t.unshift(e)}else t.unshift(e);n=r}return t.join(`>`)}buildObserverId(e){let t=e?.directive??`unknown`,n=$e(e?.expression??``,32),r=e?.element,i=e?.id??(r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`);return n?`${t}:${i}:${n}`:`${t}:${i}`}recordObserverExecution(e,t){let n=this.buildObserverId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}getPerformanceReport(){let e=Array.from(this._perfData.effects.entries()),t={};for(let[n,r]of e){let e=n.split(`:`)[0];t[e]||(t[e]={count:0,totalTime:0}),t[e].count+=r.count,t[e].totalTime+=r.totalTime}let n=e.map(([e,t])=>({id:e,executionCount:t.count,totalTime:t.totalTime,avgTime:t.count>0?t.totalTime/t.count:0})).sort((e,t)=>t.totalTime-e.totalTime).slice(0,10);return{lifecycle:this._perfData.lifecycle,effects:{total:e.length,byDirective:t,slowest:n},observers:this.getObserverStats()}}effect(e,t){let n=this;function r(){if(!n.shouldLog(`lifecycle`))return e.call(this);let r=performance.now(),i=e.call(this),a=performance.now()-r;return t&&n.recordObserverExecution(t,a),a>16&&console.warn(`[mancha] Slow observer (${a.toFixed(1)}ms):`,n.buildObserverId(t)),n.shouldLog(`effects`)&&console.debug(`[mancha] Observer (${a.toFixed(2)}ms):`,n.buildObserverId(t)),i}return super.effect(r,t)}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??`default`}).then(e=>e.text())}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log(`Preprocessing string content with params:
|
|
56
56
|
`,t);let n=this.parseHTML(e,t);return await this.preprocessNode(n,t),n}async preprocessRemote(e,t){let n={};t?.cache&&(n.cache=t.cache);let r=await fetch(e,n).then(e=>e.text());return this.preprocessString(r,{...t,dirpath:et(e),rootDocument:t?.rootDocument??!e.endsWith(`.tpl.html`)})}async preprocessLocal(e,t){let n=await this.fetchLocal(e,t);return this.preprocessString(n,{...t,dirpath:et(e),rootDocument:t?.rootDocument??!e.endsWith(`.tpl.html`)})}subrenderer(){let e=new this.constructor().debug(this.debugging);return e._store.set(`$parent`,this),e._store.set(`$rootRenderer`,this.get(`$rootRenderer`)??this),e._customElements=this._customElements,e}log(...e){this.shouldLog(`verbose`)&&console.debug(...e)}async preprocessNode(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;t={dirpath:this.dirpath,maxdepth:10,...t};let r=new nt(M(e,this._skipNodes)).map(async e=>{this.log(`Preprocessing node:
|
|
57
57
|
`,G(e,128)),await K.resolveIncludes.call(this,e,t),await K.rebaseRelativePaths.call(this,e,t),await K.registerCustomElements.call(this,e,t),await K.resolveCustomElements.call(this,e,t)});return await Promise.all(r.generator()),n&&(this._perfData.lifecycle.preprocessTime=(this._perfData.lifecycle.preprocessTime??0)+(performance.now()-n)),e}async renderNode(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;for(let n of M(e,this._skipNodes))this.log(`Rendering node:
|
|
58
|
-
`,G(n,128)),await K.resolveForAttribute.call(this,n,t),await K.resolveRenderAttribute.call(this,n,t),await K.resolveDataAttribute.call(this,n,t),await K.resolveTextAttributes.call(this,n,t),await K.resolveHtmlAttribute.call(this,n,t),await K.resolveIfAttribute.call(this,n,t),await K.resolveShowAttribute.call(this,n,t),await K.resolveClassAttribute.call(this,n,t),await K.resolveBindAttribute.call(this,n,t),await K.resolveEventAttributes.call(this,n,t),await K.resolveTextNodeExpressions.call(this,n,t),await K.resolveCustomAttribute.call(this,n,t),await K.resolveCustomProperty.call(this,n,t),await K.stripTypes.call(this,n,t);for(let e of this._pendingValueRetries.splice(0))e();return n&&(this._perfData.lifecycle.renderTime=(this._perfData.lifecycle.renderTime??0)+(performance.now()-n)),e}async mount(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;n&&this.clearPerformanceReport(),t={...t,rootNode:e},z(e,`renderer`,this),this._store.set(`$rootNode`,e),this.has(`$rootRenderer`)||this._store.set(`$rootRenderer`,this),this.get(`$rootRenderer`)===this&&await dt(this),await this.preprocessNode(e,t),await this.renderNode(e,t),Be(e),n&&(this._perfData.lifecycle.mountTime=performance.now()-n)}};function
|
|
58
|
+
`,G(n,128)),await K.resolveForAttribute.call(this,n,t),await K.resolveRenderAttribute.call(this,n,t),await K.resolveDataAttribute.call(this,n,t),await K.resolveTextAttributes.call(this,n,t),await K.resolveHtmlAttribute.call(this,n,t),await K.resolveIfAttribute.call(this,n,t),await K.resolveShowAttribute.call(this,n,t),await K.resolveClassAttribute.call(this,n,t),await K.resolveBindAttribute.call(this,n,t),await K.resolveEventAttributes.call(this,n,t),await K.resolveTextNodeExpressions.call(this,n,t),await K.resolveCustomAttribute.call(this,n,t),await K.resolveCustomProperty.call(this,n,t),await K.stripTypes.call(this,n,t);for(let e of this._pendingValueRetries.splice(0))e();return n&&(this._perfData.lifecycle.renderTime=(this._perfData.lifecycle.renderTime??0)+(performance.now()-n)),e}async mount(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;n&&this.clearPerformanceReport(),t={...t,rootNode:e},z(e,`renderer`,this),this._store.set(`$rootNode`,e),this.has(`$rootRenderer`)||this._store.set(`$rootRenderer`,this),this.get(`$rootRenderer`)===this&&await dt(this),await this.preprocessNode(e,t),await this.renderNode(e,t),Be(e),n&&(this._perfData.lifecycle.mountTime=performance.now()-n)}};function Wt(){return Ue([j`*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}`,j`html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}`,j`body{margin:0;line-height:inherit}`,j`hr{height:0;color:inherit;border-top-width:1px}`,j`abbr:where([title]){text-decoration:underline dotted}`,j`b,strong{font-weight:bolder}`,j`code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}`,j`small{font-size:80%}`,j`sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,j`sub{bottom:-0.25em}`,j`sup{top:-0.5em}`,j`button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}`,j`button,select{text-transform:none}`,j`button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button;background-color:transparent;background-image:none;cursor:pointer}`,j`:-moz-focusring{outline:auto}`,j`:-moz-ui-invalid{box-shadow:none}`,j`progress{vertical-align:baseline}`,j`::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,j`[type='search']{-webkit-appearance:textfield;outline-offset:-2px}`,j`::-webkit-search-decoration{-webkit-appearance:none}`,j`::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,j`summary{display:list-item}`,j`blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,j`fieldset{margin:0;padding:0}`,j`legend{padding:0}`,j`ol,ul,menu{list-style:none;margin:0;padding:0}`,j`textarea{resize:vertical}`,j`::placeholder{opacity:1;color:#9ca3af}`,j`button,[role="button"]{cursor:pointer}`,j`:disabled{cursor:default;pointer-events:none;opacity:0.75}`,j`img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,j`img,video{max-width:100%;height:auto}`,j`[hidden]{display:none}`,j`dialog{padding:0}`,j`dialog::backdrop{background:rgba(0,0,0,0.5)}`])}function Gt(){return Ue([j`html{`,j`max-width: 70ch;`,j`padding: 2em 1em;`,j`margin: auto;`,j`line-height: 1.75;`,j`font-size: 1.25em;`,j`font-family: sans-serif;`,j`}`,j`h1,h2,h3,h4,h5,h6{`,j`margin: 1em 0 0.5em;`,j`}`,j`p,ul,ol{`,j`margin-bottom: 1em;`,j`color: #1d1d1d;`,j`}`])}var Kt=class extends Ut{impl=`browser`;dirpath=et(globalThis.location?.href??`http://localhost/`);parseHTML(e,t={rootDocument:!1}){if(t.rootDocument)return new DOMParser().parseFromString(e,`text/html`);{let t=document.createRange();return t.selectNodeContents(document.body),t.createContextualFragment(e)}}serializeHTML(e){return new XMLSerializer().serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,``)}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}createComment(e,t){return(t||document).createComment(e)}textContent(e,t){e.textContent=t}};new Kt;function qt(e){for(let t of e){t=t.trim();let e=document.createElement(`style`);switch(t){case`minimal`:_(e,Gt());break;case`basic`:case`custom`:console.warn(`css="${t}" is deprecated; use css="utils" instead.`);continue;case`utils`:{_(e,Wt()),e.setAttribute(`data-mancha`,`basic`),globalThis.document.head.appendChild(e);let t=document.createElement(`style`);t.textContent=Ce(),t.setAttribute(`data-mancha`,`utils`),globalThis.document.head.appendChild(t),Re(document);continue}default:console.error(`Unknown style name: "${t}"`);continue}globalThis.document.head.appendChild(e)}}let Jt=`mancha-cloak`;function Yt(e,t){let n=`${e.join(`, `)} { opacity: 0 !important; ${t>0?`transition: opacity ${t}ms ease-in-out !important;`:``} }`,r=document.getElementById(Jt);r||(r=document.createElement(`style`),r.id=Jt,document.head.appendChild(r)),r.textContent=n}function Xt(e){let t=!1;return async()=>{if(t)return;t=!0;let n=document.getElementById(Jt);if(n){if(e!==!1){let t=n.sheet;t&&t.cssRules.length>0&&t.cssRules[0].style.setProperty(`opacity`,`1`,`important`),await new Promise(t=>setTimeout(t,e))}typeof globalThis.requestAnimationFrame==`function`&&(await new Promise(e=>globalThis.requestAnimationFrame(e)),await new Promise(e=>globalThis.requestAnimationFrame(e))),n.remove()}}}async function Zt(e={}){let t;document.documentElement.classList.add(`mancha-loading`);let n=e.cloak?e.cloak===!0?{}:e.cloak:void 0;if(n){let r=e.target?Array.isArray(e.target)?e.target:[e.target]:[`body`],i=n.selector&&(Array.isArray(n.selector)||typeof n.selector==`string`)?Array.isArray(n.selector)?n.selector:[n.selector]:r,a=n.duration??0;Yt(i,a),t=Xt(a>0?a:!1)}else t=Xt(!1);document.readyState===`loading`&&await new Promise(e=>{window.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0})});let r=e.renderer??new Kt;if(e.css&&e.css.length>0&&qt(e.css),e.debug&&r.debug(!0),e.state)for(let[t,n]of Object.entries(e.state))await r.set(t,n);try{if(e.callback)await e.callback(r);else if(e.target){let t=Array.isArray(e.target)?e.target:[e.target];for(let n of t){let t=globalThis.document.querySelector(n);t?await r.mount(t,{cache:e.cache}):console.error(`Target element not found: "${n}"`)}}}finally{document.documentElement.classList.remove(`mancha-loading`),t&&await t()}return r}let Q=globalThis.document?.currentScript,$=new Kt;if($.initMancha=Zt,globalThis.Mancha=$,Q?.hasAttribute(`init`)){let e=Q.hasAttribute(`debug`),t=Q.getAttribute(`cache`)||void 0,n=Q.getAttribute(`target`)?.split(`+`).map(e=>e.trim())||[`body`],r=Q.getAttribute(`css`)?.split(`+`).map(e=>e.trim()).filter(e=>e!==``),i,a=Q.getAttribute(`cloak`);if(a===`false`)i=void 0;else if(a&&!Number.isNaN(parseInt(a,10))){let e=parseInt(a,10);i=e>0?{duration:e}:!0}else i=!0;Zt({renderer:$,css:r,target:n,debug:e,cache:t,cloak:i})}else if(Q?.hasAttribute(`css`)){let e=Q.getAttribute(`css`)?.split(`+`).map(e=>e.trim()).filter(e=>e!==``);Zt({css:e})}return $})();
|
|
@@ -10,34 +10,34 @@ import{safeAnchorEl as e,safeAreaEl as t,safeElement as n,safeStyleEl as r}from"
|
|
|
10
10
|
0%, 100% { opacity: 1 }
|
|
11
11
|
50% { opacity: .5 }
|
|
12
12
|
}`],y={red:{50:`#ffebee`,100:`#ffcdd2`,200:`#ef9a9a`,300:`#e57373`,400:`#ef5350`,500:`#f44336`,600:`#e53935`,700:`#d32f2f`,800:`#c62828`,900:`#b71c1c`},pink:{50:`#fce4ec`,100:`#f8bbd0`,200:`#f48fb1`,300:`#f06292`,400:`#ec407a`,500:`#e91e63`,600:`#d81b60`,700:`#c2185b`,800:`#ad1457`,900:`#880e4f`},purple:{50:`#f3e5f5`,100:`#e1bee7`,200:`#ce93d8`,300:`#ba68c8`,400:`#ab47bc`,500:`#9c27b0`,600:`#8e24aa`,700:`#7b1fa2`,800:`#6a1b9a`,900:`#4a148c`},"deep-purple":{50:`#ede7f6`,100:`#d1c4e9`,200:`#b39ddb`,300:`#9575cd`,400:`#7e57c2`,500:`#673ab7`,600:`#5e35b1`,700:`#512da8`,800:`#4527a0`,900:`#311b92`},indigo:{50:`#e8eaf6`,100:`#c5cae9`,200:`#9fa8da`,300:`#7986cb`,400:`#5c6bc0`,500:`#3f51b5`,600:`#3949ab`,700:`#303f9f`,800:`#283593`,900:`#1a237e`},blue:{50:`#e3f2fd`,100:`#bbdefb`,200:`#90caf9`,300:`#64b5f6`,400:`#42a5f5`,500:`#2196f3`,600:`#1e88e5`,700:`#1976d2`,800:`#1565c0`,900:`#0d47a1`},"light-blue":{50:`#e1f5fe`,100:`#b3e5fc`,200:`#81d4fa`,300:`#4fc3f7`,400:`#29b6f6`,500:`#03a9f4`,600:`#039be5`,700:`#0288d1`,800:`#0277bd`,900:`#01579b`},cyan:{50:`#e0f7fa`,100:`#b2ebf2`,200:`#80deea`,300:`#4dd0e1`,400:`#26c6da`,500:`#00bcd4`,600:`#00acc1`,700:`#0097a7`,800:`#00838f`,900:`#006064`},teal:{50:`#e0f2f1`,100:`#b2dfdb`,200:`#80cbc4`,300:`#4db6ac`,400:`#26a69a`,500:`#009688`,600:`#00897b`,700:`#00796b`,800:`#00695c`,900:`#004d40`},green:{50:`#e8f5e9`,100:`#c8e6c9`,200:`#a5d6a7`,300:`#81c784`,400:`#66bb6a`,500:`#4caf50`,600:`#43a047`,700:`#388e3c`,800:`#2e7d32`,900:`#1b5e20`},"light-green":{50:`#f1f8e9`,100:`#dcedc8`,200:`#c5e1a5`,300:`#aed581`,400:`#9ccc65`,500:`#8bc34a`,600:`#7cb342`,700:`#689f38`,800:`#558b2f`,900:`#33691e`},lime:{50:`#f9fbe7`,100:`#f0f4c3`,200:`#e6ee9c`,300:`#dce775`,400:`#d4e157`,500:`#cddc39`,600:`#c0ca33`,700:`#afb42b`,800:`#9e9d24`,900:`#827717`},yellow:{50:`#fffde7`,100:`#fff9c4`,200:`#fff59d`,300:`#fff176`,400:`#ffee58`,500:`#ffeb3b`,600:`#fdd835`,700:`#fbc02d`,800:`#f9a825`,900:`#f57f17`},amber:{50:`#fff8e1`,100:`#ffecb3`,200:`#ffe082`,300:`#ffd54f`,400:`#ffca28`,500:`#ffc107`,600:`#ffb300`,700:`#ffa000`,800:`#ff8f00`,900:`#ff6f00`},orange:{50:`#fff3e0`,100:`#ffe0b2`,200:`#ffcc80`,300:`#ffb74d`,400:`#ffa726`,500:`#ff9800`,600:`#fb8c00`,700:`#f57c00`,800:`#ef6c00`,900:`#e65100`},"deep-orange":{50:`#fbe9e7`,100:`#ffccbc`,200:`#ffab91`,300:`#ff8a65`,400:`#ff7043`,500:`#ff5722`,600:`#f4511e`,700:`#e64a19`,800:`#d84315`,900:`#bf360c`},brown:{50:`#efebe9`,100:`#d7ccc8`,200:`#bcaaa4`,300:`#a1887f`,400:`#8d6e63`,500:`#795548`,600:`#6d4c41`,700:`#5d4037`,800:`#4e342e`,900:`#3e2723`},gray:{50:`#fafafa`,100:`#f5f5f5`,200:`#eeeeee`,300:`#e0e0e0`,400:`#bdbdbd`,500:`#9e9e9e`,600:`#757575`,700:`#616161`,800:`#424242`,900:`#212121`},"blue-gray":{50:`#eceff1`,100:`#cfd8dc`,200:`#b0bec5`,300:`#90a4ae`,400:`#78909c`,500:`#607d8b`,600:`#546e7a`,700:`#455a64`,800:`#37474f`,900:`#263238`}};function b(e){return e.map(([e,t])=>`.${e} { ${t} }`)}function x(e){return b(Object.entries(e).flatMap(([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100v${e.includes(`height`)?`h`:`w`}`],[`${t}-full`,`${e}: 100%`],...f.map(n=>[`${t}-${n}`,`${e}: ${n*c}rem`]),...f.map(n=>[`-${t}-${n}`,`${e}: -${n*c}rem`]),...f.map(n=>[`${t}-${n}px`,`${e}: ${n}px`]),...f.map(n=>[`-${t}-${n}px`,`${e}: -${n}px`]),...p.map(n=>[`${t}-${n}\\%`,`${e}: ${n}%`]),...p.map(n=>[`-${t}-${n}\\%`,`${e}: -${n}%`]),...s.map(([n,r])=>[`${t}-${n}`,`${e}: ${r}px`])]))}function re(e){return b(Object.entries(e).flatMap(([e,t])=>[[`${t}-auto`,`${e}: auto`],[`${t}x-auto`,`${e}-left: auto; ${e}-right: auto;`],[`${t}y-auto`,`${e}-top: auto; ${e}-bottom: auto;`],[`${t}x-0`,`${e}-left: 0; ${e}-right: 0;`],[`${t}y-0`,`${e}-top: 0; ${e}-bottom: 0;`],...f.map(n=>[`${t}x-${n}`,`${e}-left: ${n*c}rem; ${e}-right: ${n*c}rem;`]),...f.map(n=>[`${t}y-${n}`,`${e}-top: ${n*c}rem; ${e}-bottom: ${n*c}rem;`]),...f.map(n=>[`${t}x-${n}px`,`${e}-left: ${n}px; ${e}-right: ${n}px;`]),...f.map(n=>[`${t}y-${n}px`,`${e}-top: ${n}px; ${e}-bottom: ${n}px;`]),...p.map(n=>[`${t}x-${n}\\%`,`${e}-left: ${n}%; ${e}-right: ${n}%;`]),...p.map(n=>[`${t}y-${n}\\%`,`${e}-top: ${n}%; ${e}-bottom: ${n}%;`])]))}function ie(e){return b(Object.entries(e).flatMap(([e,t])=>[[`${t}t-0`,`${e}-top: 0`],[`${t}b-0`,`${e}-bottom: 0`],[`${t}l-0`,`${e}-left: 0`],[`${t}r-0`,`${e}-right: 0`],[`${t}t-auto`,`${e}-top: auto`],[`${t}b-auto`,`${e}-bottom: auto`],[`${t}l-auto`,`${e}-left: auto`],[`${t}r-auto`,`${e}-right: auto`],...[``,`-`].flatMap(n=>[...f.map(r=>[`${n}${t}t-${r}`,`${e}-top: ${n}${r*c}rem`]),...f.map(r=>[`${n}${t}b-${r}`,`${e}-bottom: ${n}${r*c}rem`]),...f.map(r=>[`${n}${t}l-${r}`,`${e}-left: ${n}${r*c}rem`]),...f.map(r=>[`${n}${t}r-${r}`,`${e}-right: ${n}${r*c}rem`]),...f.map(r=>[`${n}${t}t-${r}px`,`${e}-top: ${n}${r}px`]),...f.map(r=>[`${n}${t}b-${r}px`,`${e}-bottom: ${n}${r}px`]),...f.map(r=>[`${n}${t}l-${r}px`,`${e}-left: ${n}${r}px`]),...f.map(r=>[`${n}${t}r-${r}px`,`${e}-right: ${n}${r}px`]),...p.map(r=>[`${n}${t}t-${r}\\%`,`${e}-top: ${n}${r}%`]),...p.map(r=>[`${n}${t}b-${r}\\%`,`${e}-bottom: ${n}${r}%`]),...p.map(r=>[`${n}${t}l-${r}\\%`,`${e}-left: ${n}${r}%`]),...p.map(r=>[`${n}${t}r-${r}\\%`,`${e}-right: ${n}${r}%`])])]))}function ae(){return b([[`border`,`border-width: 1px`],[`border-x`,`border-inline-width: 1px`],[`border-y`,`border-block-width: 1px`],...[0,...l].map(e=>[`border-${e}`,`border-width: ${e}px`]),...[0,...l].map(e=>[`border-x-${e}`,`border-inline-width: ${e}px;`]),...[0,...l].map(e=>[`border-y-${e}`,`border-block-width: ${e}px;`]),...[`top`,`bottom`,`left`,`right`].flatMap(e=>[[`border-${e.slice(0,1)}`,`border-${e}-width: 1px`],...[0,...l].map(t=>[`border-${e.slice(0,1)}-${t}`,`border-${e}-width: ${t}px`])])])}function oe(){return b(p.map(e=>[`z-${e}`,`z-index: ${e}`]))}function se(){return b(m.map(e=>[`duration-${e}`,`--transition-duration: ${e}ms; transition-duration: ${e}ms`]))}function ce(){return b([[`space-x-0 > *`,`margin-left: 0`],[`space-y-0 > *`,`margin-top: 0`],...f.map(e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*c}rem`]),...f.map(e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*c}rem`]),...f.map(e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`]),...f.map(e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`]),[`gap-0`,`gap: 0`],...f.map(e=>[`gap-${e}`,`gap: ${e*c}rem`]),...f.map(e=>[`gap-${e}px`,`gap: ${e}px`]),...f.map(e=>[`gap-x-${e}`,`column-gap: ${e*c}rem`]),...f.map(e=>[`gap-y-${e}`,`row-gap: ${e*c}rem`]),...f.map(e=>[`gap-x-${e}px`,`column-gap: ${e}px`]),...f.map(e=>[`gap-y-${e}px`,`row-gap: ${e}px`]),[`divide-x > :not(:last-child)`,`border-inline-end-width: 1px`],[`divide-y > :not(:last-child)`,`border-bottom-width: 1px`],[`divide-x-0 > :not(:last-child)`,`border-inline-end-width: 0px`],[`divide-y-0 > :not(:last-child)`,`border-bottom-width: 0px`],...[2,4,8].map(e=>[`divide-x-${e} > :not(:last-child)`,`border-inline-end-width: ${e}px`]),...[2,4,8].map(e=>[`divide-y-${e} > :not(:last-child)`,`border-bottom-width: ${e}px`]),[`divide-solid > :not(:last-child)`,`border-style: solid`],[`divide-dashed > :not(:last-child)`,`border-style: dashed`],[`divide-dotted > :not(:last-child)`,`border-style: dotted`],[`divide-none > :not(:last-child)`,`border-style: none`]])}function le(){return b([...Array.from({length:100},(e,t)=>[`text-${t}px`,`font-size: ${t}px`]),...Array.from({length:100},(e,t)=>[`text-${t*c}rem`,`font-size: ${t*c}rem`])])}function ue(){return b([`column`,`row`].flatMap(e=>{let t=e.slice(0,3);return[...Array.from({length:12},(e,t)=>t+1).map(n=>[`grid-${t}s-${n}`,`grid-template-${e}s: repeat(${n}, minmax(0, 1fr))`]),[`grid-${t}s-none`,`grid-template-${e}s: none`],...Array.from({length:12},(e,t)=>t+1).map(n=>[`${t}-span-${n}`,`grid-${e}: span ${n} / span ${n}`]),[`${t}-span-full`,`grid-${e}: 1 / -1`],...Array.from({length:13},(e,t)=>t+1).map(n=>[`${t}-start-${n}`,`grid-${e}-start: ${n}`]),[`${t}-start-auto`,`grid-${e}-start: auto`],...Array.from({length:13},(e,t)=>t+1).map(n=>[`${t}-end-${n}`,`grid-${e}-end: ${n}`]),[`${t}-end-auto`,`grid-${e}-end: auto`]]}))}function de(){return Object.entries(te).map(([e,t])=>`.${e} { ${Object.entries(t).map(([e,t])=>`${e}: ${t}`).join(`; `)} }`)}function fe(e){let t=0,n=0,r=0;return e.length===4?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):e.length===7&&(t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16)),`${t} ${n} ${r}`}function pe(){let e=(e,t)=>[[`text-${e}`,`color: ${t}`],[`fill-${e}`,`fill: ${t}`],[`bg-${e}`,`background-color: ${t}`],[`border-${e}`,`border-color: ${t}`],[`divide-${e} > :not(:last-child)`,`border-color: ${t}`]];return b([...e(`white`,`#fff`),...e(`black`,`#000`),...e(`transparent`,`transparent`),...Object.entries(y).flatMap(([t,n])=>[...e(t,n[500]),...Object.entries(n).flatMap(([n,r])=>e(`${t}-${n}`,r))])])}function me(){return b([[`opacity-0`,`opacity: 0`],...p.map(e=>[`opacity-${e}`,`opacity: ${e/100}`])])}let S=null;function he(){return S===null&&(S=[...ne,...de(),...pe(),...me(),...oe(),...se(),...x(_),...x(g),...re(g),...x(h),...re(h),...ie(h),...ce(),...x(ee),...ae(),...le(),...ue()].join(`
|
|
13
|
-
`)),S}const ge={text:`color`,bg:`background-color`,border:`border-color`,fill:`fill`,divide:`border-color`},_e=/^(text|bg|border|fill|divide)-([\w-]+)\/(\d+)$/,ve={w:`width`,h:`height`,"min-w":`min-width`,"min-h":`min-height`,"max-w":`max-width`,"max-h":`max-height`,m:`margin`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,mx:`margin-inline`,my:`margin-block`,p:`padding`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,px:`padding-inline`,py:`padding-block`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,z:`z-index`,bg:`background-color`,border:`border-color`},ye=/^(-?)([\w-]+)-\[(.+)\]$/,be=/^(hover|focus|disabled|sm|md|lg|xl|dark|landscape|portrait):(.+)$/,xe=[`hover`,`focus`,`disabled`],Se=[`landscape`,`portrait`],C=new Set;let w=null;function Ce(e){if(typeof document>`u`)return null;let t=`.${e}`;for(let e of document.styleSheets)try{for(let n of e.cssRules)if(n instanceof CSSStyleRule&&n.selectorText===t)return n.style.cssText}catch{}return null}function
|
|
14
|
-
`,
|
|
15
|
-
`,
|
|
16
|
-
`,
|
|
17
|
-
`,
|
|
18
|
-
`,
|
|
19
|
-
`,
|
|
20
|
-
`,
|
|
21
|
-
`,
|
|
22
|
-
`,
|
|
23
|
-
`,
|
|
24
|
-
`,
|
|
25
|
-
`,
|
|
26
|
-
`,
|
|
27
|
-
`,
|
|
28
|
-
`,
|
|
29
|
-
`,
|
|
13
|
+
`)),S}const ge={text:`color`,bg:`background-color`,border:`border-color`,fill:`fill`,divide:`border-color`},_e=/^(text|bg|border|fill|divide)-([\w-]+)\/(\d+)$/,ve={w:`width`,h:`height`,"min-w":`min-width`,"min-h":`min-height`,"max-w":`max-width`,"max-h":`max-height`,m:`margin`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,mx:`margin-inline`,my:`margin-block`,p:`padding`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,px:`padding-inline`,py:`padding-block`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,z:`z-index`,bg:`background-color`,border:`border-color`},ye=/^(-?)([\w-]+)-\[(.+)\]$/,be=/^(hover|focus|disabled|sm|md|lg|xl|dark|landscape|portrait):(.+)$/,xe=[`hover`,`focus`,`disabled`],Se=[`landscape`,`portrait`],C=new Set;let w=null;function Ce(e){if(typeof document>`u`)return null;let t=`.${e}`;for(let e of document.styleSheets)try{for(let n of e.cssRules)if(n instanceof CSSStyleRule&&n.selectorText===t)return n.style.cssText}catch{}return null}function T(){return typeof document<`u`&&typeof CSSStyleSheet<`u`&&typeof document.createElement==`function`}function we(e){return e.replace(/[[\]#.:>+~()'"/]/g,`\\$&`)}function Te(){if(!T())return null;if(w&&!w.ownerNode?.isConnected&&(w=null),w)return w;let e=document.createElement(`style`);return e.setAttribute(`data-mancha`,`custom`),document.head.appendChild(e),e.sheet?(w=e.sheet,w):null}function Ee(e){let t=e.match(ye);if(!t)return null;let[,n,r,i]=t,a=ve[r];if(!a)return null;let o=i.replace(/_/g,` `);return{property:a,value:n?`-${o}`:o}}function De(e){let t=e.match(_e);if(!t)return null;let[,n,r,i]=t,a=ge[n];if(!a)return null;let o=Number.parseInt(i,10);if(o<0||o>100)return null;let s=null;if(r===`white`)s=`#fff`;else if(r===`black`)s=`#000`;else{let e=r.lastIndexOf(`-`);if(e>0){let t=r.substring(0,e),n=Number.parseInt(r.substring(e+1),10);s=y[t]?.[n]??null}s||=y[r]?.[500]??null}return s?{property:a,value:`rgb(${fe(s)} / ${o/100})`}:null}function Oe(e,t){let n=t?`${t.name}:${e}`:e;if(C.has(n))return!0;let r=Te();if(!r)return!1;let i=we(n),a=Ee(e)??De(e),s=a?`${a.property}: ${a.value};`:Ce(e);if(!s)return!1;let c=e.startsWith(`divide-`)?` > :not(:last-child)`:``,l;l=t?t.type===`pseudo`?`.${i}${c}:${t.name} { ${s} }`:t.name===`dark`?`@media (prefers-color-scheme: dark) { .${i}${c} { ${s} } }`:Se.includes(t.name)?`@media (orientation: ${t.name}) { .${i}${c} { ${s} } }`:`@media (min-width: ${o[t.name]}px) { .${i}${c} { ${s} } }`:`.${i}${c} { ${s} }`;try{return r.insertRule(l,r.cssRules.length),C.add(n),!0}catch(e){return console.warn(`Failed to inject CSS rule: ${l}`,e),!1}}function E(e){return e.includes(`[`)||e.includes(`:`)||e.includes(`/`)}function D(e){if(!(!e||!E(e)))for(let t of e.trim().split(/\s+/)){let e=t.match(be);if(e){let[,t,n]=e,r=xe.includes(t),i=t in o,a=t===`dark`,s=Se.includes(t);if(r||i||a||s){Oe(n,{type:r?`pseudo`:`media`,name:t});continue}}E(t)&&Oe(t)}}function ke(e=document){if(!T())return;if(e instanceof Element){let t=e.getAttribute(`class`);t&&D(t)}let t=e.querySelectorAll(`[class]`);for(let e of t){let t=e.getAttribute(`class`);t&&D(t)}}function Ae(){return T()&&document.querySelector(`style[data-mancha="utils"]`)!==null}function je(e){if(!Ae())return;let t=e;typeof t.querySelectorAll==`function`&&ke(t)}function Me(e){!e||!E(e)||Ae()&&D(e)}function Ne(){C.clear(),w?.ownerNode&&w.ownerNode.remove(),w=null}function O(e){let t=e.childNodes;for(let e=0;e<t.length;e++){let n=t[e];n.prev=e>0?t[e-1]:null,n.next=e<t.length-1?t[e+1]:null}}const Pe=[i`:`,i`style`,i`class`];function*k(e,t=new Set){let n=new Set,r=Array.from(e.childNodes).filter(e=>!t.has(e));for(yield e;r.length;){let e=r.shift();n.has(e)||(n.add(e),yield e),e.childNodes&&Array.from(e.childNodes).filter(e=>!t.has(e)).forEach(e=>{r.push(e)})}}function A(e,t){return e?.[t]!==void 0}function j(e,t){return typeof e?.[t]==`function`}function M(e){return e.replace(/-./g,e=>e[1].toUpperCase())}function N(e,t){return e.attribs?e.attribs[t]??null:e.getAttribute?.(t)??null}function Fe(e,t){return e.attribs?t in e.attribs:e.hasAttribute?.(t)??!1}function P(e,t,n=``){return N(e,n+t)||N(e,`data-${t}`)||(e.dataset?.[M(t)]??null)}function F(e,t,n){e.attribs?e.attribs[t]=n:e.setAttribute?.(t,n)}function I(e,t,r){e.attribs?e.attribs[t]=r:n.setPrefixedAttribute(Pe,e,t,r)}function L(e,t,n){switch(t){case`disabled`:e.disabled=n;return;case`selected`:e.selected=n;return;case`checked`:e.checked=n;return;default:e[t]=n}}function R(e,t){e.attribs?delete e.attribs[t]:e.removeAttribute?.(t)}function Ie(e,t,n,r=``){Fe(e,`${r}${t}`)?F(e,`${r}${t}`,n):Fe(e,`data-${t}`)?F(e,`data-${t}`,n):F(e,`${r}${t}`,n)}function z(e,t,n=``){R(e,`${n}${t}`),R(e,`data-${t}`)}function Le(e,t,n){if(e.attribs&&t.attribs)t.attribs[n]=e.attribs[n];else if(n.startsWith(`data-`)){let r=M(n.slice(5));t.dataset&&e.dataset&&(t.dataset[r]=e.dataset[r])}else{let r=e?.getAttribute?.(n);I(t,n,r||``)}}function Re(e){return A(e,`firstElementChild`)?e.firstElementChild:Array.from(e.children).find(e=>e.nodeType===1)}function B(e,...t){if(j(e,`replaceWith`)){e.replaceWith(...t);return}else{let n=e,r=n.parentNode;if(!r)return;let i=Array.from(r.childNodes).indexOf(n);n.parentNode=null,t.forEach(e=>{e.parentNode=r}),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,i),t,Array.from(r.childNodes).slice(i+1)),O(r)}}function ze(e,...t){j(e,`replaceChildren`)?e.replaceChildren(...t):(e.childNodes=t,t.forEach(t=>{t.parentNode=e}),O(e))}function V(e,t){return j(t,`appendChild`)?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,O(e),t)}function H(e,t){return j(t,`removeChild`)?e.removeChild(t):(ze(e,...Array.from(e.childNodes).filter(e=>e!==t)),t)}function U(e,t,n){return n?j(e,`insertBefore`)?e.insertBefore(t,n):(t.parentNode&&H(t.parentNode,t),B(n,t,n),t):V(e,t)}function W(e,t=0){return e?e.length<=t?e:`${e.slice(0,t-1)}…`:``}function G(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map(e=>G(e,t)).join(``):W(e.outerHTML||e.nodeValue||String(e),t)}function K(e){return e.includes(`/`)?e.split(`/`).slice(0,-1).join(`/`):``}function Be(e){return!e.includes(`://`)&&!e.startsWith(`/`)&&!e.startsWith(`#`)&&!e.startsWith(`data:`)}var Ve=class e{iterable;constructor(e){this.iterable=e}filter(t){return new e(e.filterGenerator(t,this.iterable))}map(t){return new e(e.mapGenerator(t,this.iterable))}find(e){for(let t of this.iterable)if(e(t))return t}array(){return Array.from(this.iterable)}*generator(){for(let e of this.iterable)yield e}static*filterGenerator(e,t){for(let n of t)e(n)&&(yield n)}static*mapGenerator(e,t){for(let n of t)yield e(n)}static equals(e,t){let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(i.value!==a.value)return!1;i=n.next(),a=r.next()}return i.done===a.done}};let q;(function(n){n.resolveIncludes=async function(e,t){let n=e,r=n.tagName?.toLowerCase();if(![`include`,`link`].includes(r)||r===`link`&&N(n,`rel`)!==`subresource`)return;this.log(`include directive found in:
|
|
14
|
+
`,G(e,128)),this.log(`include params:`,t);let i=n.tagName.toLocaleLowerCase()===`link`?`href`:`src`,a=N(n,i);if(!a)throw Error(`"${i}" attribute missing from ${G(e,128)}.`);let o=[];r===`include`&&o.push(`src`),r===`link`&&o.push(`rel`,`href`);let s=t=>{let r=Re(t);for(let e of Array.from(n.attributes))r&&!o.includes(e.name)&&Le(n,r,e.name);B(e,...t.childNodes)},c={...t,rootDocument:!1,maxdepth:(t?.maxdepth??100)-1};if(c.maxdepth===0)throw Error(`Maximum recursion depth reached.`);if(a.includes(`://`)||a.startsWith(`//`))this.log(`Including remote file from absolute path:`,a),await this.preprocessRemote(a,c).then(s);else if(t?.dirpath?.includes(`://`)||t?.dirpath?.startsWith(`//`)){let e=a.startsWith(`/`)?a:`${t.dirpath}/${a}`;this.log(`Including remote file from relative path:`,e),await this.preprocessRemote(e,c).then(s)}else if(a.charAt(0)===`/`)this.log(`Including local file from absolute path:`,a),await this.preprocessLocal(a,c).then(s);else{let e=t?.dirpath&&t?.dirpath!==`.`?`${t?.dirpath}/${a}`:a;this.log(`Including local file from relative path:`,e),await this.preprocessLocal(e,c).then(s)}},n.rebaseRelativePaths=function(n,r){let i=n,a=i.tagName?.toLowerCase();if(!r?.dirpath)return;let o=N(i,`src`),s=N(i,`href`),c=P(i,`render`,`:`),l=o||s||c;if(!l||!Be(l))return;let u=`${r.dirpath}/${l}`;this.log(`Rebasing relative path as:`,u),c?Ie(i,`render`,u,`:`):A(i,`attribs`)?I(i,o?`src`:`href`,u):a===`img`?i.src=u:a===`a`?e.setHref(i,u):a===`source`||a===`audio`||a===`video`||a===`track`||a===`input`?i.src=u:a===`area`?t.setHref(i,u):this.log(`Unable to rebase relative path for element:`,a)},n.registerCustomElements=function(e,t){let n=e,r=n.tagName?.toLowerCase(),i=(N(n,`is`)||N(n,`alt`))?.toLowerCase();if([`template`,`div`].includes(r)&&i){if(r===`div`&&N(n,`role`)!==`template`)return;if(!this._customElements.has(i)){this.log(`Registering custom element: ${i}\n`,G(n,128));let e=n.content||n,r=Array.from(k(e));for(let e=1;e<r.length;e++)q.rebaseRelativePaths.call(this,r[e],t);this._customElements.set(i,n),n?.parentNode&&H(n.parentNode,n)}}},n.resolveCustomElements=function(e,t){let n=e,r=n.tagName?.toLowerCase(),i=r;if(i===`div`&&(i=N(n,`role`)?.toLowerCase()||i),i&&this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,G(n,128));let t=this._customElements.get(i),a=(t.content||t).cloneNode(!0),o=Re(a);if(o)for(let e of Array.from(n.attributes))(r!==`div`||e.name!==`role`)&&Le(n,o,e.name);let s=new Ve(k(a)).find(e=>e.tagName?.toLowerCase()===`slot`);s&&B(s,...n.childNodes),B(e,...a.childNodes)}},n.resolveTextNodeExpressions=function(e,t){let n=e.nodeValue||``;if(e.nodeType!==3||!n?.trim())return;this.log(`Processing node content value:
|
|
15
|
+
`,W(n,128));let r=new RegExp(/{{ ([^}]+) }}/gm),i=Array.from(n.matchAll(r)).map(e=>e[1]);return this.effect(function(){let t=n;for(let n of i){let r=this.eval(n,{$elem:e});t=t.replace(`{{ ${n} }}`,r==null?``:String(r))}e.nodeValue=t},{directive:`text`,element:e.parentElement??void 0,expression:i.join(`, `)})},n.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`data`,`:`);if(r){this.log(`:data attribute found in:
|
|
16
|
+
`,G(e,128)),z(n,`data`,`:`);let i;A(e,`renderer`)?(i=e.renderer,this.log(`Reusing existing subrenderer for node:`,G(e,64))):(i=this.subrenderer(),L(e,`renderer`,i),this.log(`Created and attached new subrenderer for node:`,G(e,64)));let a=i.eval(r,{$elem:e});if(await Promise.all(Object.entries(a).map(([e,t])=>e.startsWith(`$$`)?(i._store.get(`$rootRenderer`)||i).set(e,t):i.set(e,t,!0))),i===this)return;for(let t of k(e,this._skipNodes))this._skipNodes.add(t);await i.mount(e,t)}},n.resolveClassAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`class`,`:`);if(r){this.log(`:class attribute found in:
|
|
17
|
+
`,G(e,128)),z(n,`class`,`:`);let t=N(n,`class`)||``;return this.effect(function(){let i=this.eval(r,{$elem:e}),a=(i?`${t} ${i}`:t).trim();I(n,`class`,a),Me(a)},{directive:`class`,element:n,expression:r})}},n.resolveTextAttributes=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`text`,`:`);if(r){this.log(`:text attribute found in:
|
|
18
|
+
`,G(e,128)),z(n,`text`,`:`);let t=t=>this.textContent(e,t);return this.effect(function(){let n=this.eval(r,{$elem:e});t(n==null?``:String(n))},{directive:`:text`,element:n,expression:r})}},n.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`html`,`:`);if(r){this.log(`:html attribute found in:
|
|
19
|
+
`,G(e,128)),z(n,`html`,`:`);let i=null;return this.effect(function(){let a=this.eval(r,{$elem:e});return new Promise(e=>{(async()=>{i&&=(i.dispose(),null);let r=this.subrenderer();i=r;let o=await r.preprocessString(a,t);await r.renderNode(o),ze(n,o),r._store.set(`$rootNode`,n),e()})()})},{directive:`:html`,element:n,expression:r})}},n.resolveEventAttributes=function(e,t){if(this._skipNodes.has(e))return;let n=e;for(let t of Array.from(n.attributes||[]))if(t.name.startsWith(`:on:`)||t.name.startsWith(`data-on-`)){let r=``,i=[];if(t.name.startsWith(`:on:`)?[r,...i]=t.name.substring(4).split(`.`):t.name.startsWith(`data-on-`)&&([r,...i]=t.name.substring(8).split(`.`)),!r)throw Error(`Invalid event attribute: ${t.name}`);this.log(t.name,`attribute found in:
|
|
20
|
+
`,G(e,128)),z(n,t.name);let a=r===`submit`&&n.tagName.toUpperCase()===`FORM`;e.addEventListener?.(r,n=>((i.includes(`prevent`)||a)&&n.preventDefault(),this.eval(t.value,{$elem:e,$event:n})))}},n.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`for`,`:`)?.trim();if(r){this.log(`:for attribute found in:
|
|
21
|
+
`,G(e,128)),z(n,`for`,`:`);let i=P(n,`key`,`:`);i&&z(n,`key`,`:`);for(let t of k(e,this._skipNodes))this._skipNodes.add(t);let a=e.parentNode;if(!a)return;this.cloakElement(n);let o=this.createElement(`template`,e.ownerDocument);U(a,o,e),H(a,e),`content`in o?V(o.content,e):V(o,e),this.log(`:for template:
|
|
22
|
+
`,G(o,128));let s=r.split(` in `,2);if(s.length!==2)throw Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);let c=i?P(n,`data`,`:`):null,l=new Map,u=[],d=[],[f,p]=s;await this.effect(function(){let n=this.eval(p,{$elem:e});if(this.log(`:for list items:`,n),!Array.isArray(n)){console.error(`Expression did not yield a list: \`${p}\` => \`${n}\``);return}if(i){let r=new Set,s=new Map,u=[],d=o.nextSibling;for(let o=0;o<n.length;o++){let p=n[o],m=this.eval(i,{[f]:p,$index:o});r.has(m)&&console.warn(`:for duplicate key detected: ${m}. Using last item.`),r.add(m);let h,g,_=l.get(m);if(_){if(h=_.node,g=_.subrenderer,u.push(g.set(f,p,!0)),u.push(g.set(`$index`,o,!0)),c&&A(h,`renderer`)){let e=h.renderer,t=e.eval(c,{$elem:h});u.push(...Object.entries(t).map(([t,n])=>e.set(t,n,!0)))}h===d||h.nextSibling===d||U(a,h,d)}else{g=this.subrenderer(),g.set(f,p,!0),g.set(`$index`,o,!0);let n=e.cloneNode(!0);this.cloakElement(n),U(a,n,d),this._skipNodes.add(n),u.push(g.mount(n,t).then(()=>{this.uncloakElement(n)})),h=n,this.log(`Rendered list child:
|
|
23
|
+
`,G(n,128))}s.set(m,{node:h,subrenderer:g}),d=h.nextSibling}for(let[e,{node:t,subrenderer:n}]of l)r.has(e)||(n.dispose(),t.parentNode&&H(t.parentNode,t),this._skipNodes.delete(t));l.clear();for(let[e,t]of s)l.set(e,t);return Promise.all(u).then(()=>{})}else{d.splice(0,d.length).forEach(e=>{e.dispose()}),u.splice(0,u.length).forEach(e=>{e.parentNode&&H(e.parentNode,e),this._skipNodes.delete(e)});let r=o.nextSibling,i=[];for(let o=0;o<n.length;o++){let s=n[o],c=this.subrenderer();c.set(f,s,!0),c.set(`$index`,o,!0);let l=e.cloneNode(!0);this.cloakElement(l),U(a,l,r),u.push(l),d.push(c),this._skipNodes.add(l),i.push(c.mount(l,t).then(()=>{this.uncloakElement(l)})),this.log(`Rendered list child:
|
|
24
|
+
`,G(l,128))}return Promise.all(i).then(()=>{})}},{directive:`:for`,element:n,expression:r})}},n.resolveBindAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`bind`,`:`);if(r){this.log(`:bind attribute found in:
|
|
25
|
+
`,G(e,128));let t=N(n,`:bind:on`)?.split(`,`)||n.dataset?.bindOn?.split(`,`)||[`change`,`input`];z(n,`bind`,`:`),R(n,`:bind:on`),R(n,`data-bind-on`);let i=N(n,`type`)===`checkbox`?`checked`:`value`;!r.includes(`.`)&&!this.has(r)&&this.set(r,``);let a=this;this.effect(function(){let t=this.eval(r,{$elem:e});i===`checked`?n.checked=!!t:(n.value=t,n.value!==t&&t!=null&&a._pendingValueRetries.push(()=>{n.value=t}))},{directive:`:bind`,element:n,expression:r});let o=`${r} = $elem.${i}`;for(let n of t)e.addEventListener(n,()=>this.eval(o,{$elem:e}))}},n.resolveIfAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`if`,`:`);if(r){this.log(`:if attribute found in:
|
|
26
|
+
`,G(e,128)),z(n,`if`,`:`);let t=this.createComment(` :if placeholder `,e.ownerDocument);this.effect(function(){this.eval(r,{$elem:e})?!n.parentNode&&t.parentNode&&B(t,n):n.parentNode&&B(n,t)},{directive:`:if`,element:n,expression:r})}},n.resolveShowAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`show`,`:`);if(r){this.log(`:show attribute found in:
|
|
27
|
+
`,G(e,128)),z(n,`show`,`:`);let t=n.style?.display===`none`?``:n.style?.display??N(n,`style`)?.split(`;`)?.find(e=>e.split(`:`)[0]===`display`)?.split(`:`)?.at(1)?.trim();this.effect(function(){let i=this.eval(r,{$elem:e});n.style?n.style.display=i?t:`none`:I(n,`style`,`display: ${i?t:`none`};`)},{directive:`:show`,element:n,expression:r})}},n.resolveCustomAttribute=function(e,t){if(this._skipNodes.has(e))return;let n=e;for(let t of Array.from(n.attributes||[])){let r=`:attr:`,i=`data-attr-`;if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,`attribute found in:
|
|
28
|
+
`,G(e,128)),R(n,t.name);let a=(t.name.split(r,2).at(-1)||``).split(i,2).at(-1)??``;this.effect(function(){F(n,a,this.eval(t.value,{$elem:e}))},{directive:`:attr:${a}`,element:n,expression:t.value})}}},n.resolveCustomProperty=function(e,t){if(this._skipNodes.has(e))return;let n=e;for(let t of Array.from(n.attributes||[])){let r=`:prop:`,i=`data-prop-`;if(t.name.startsWith(r)||t.name.startsWith(i)){this.log(t.name,`property found in:
|
|
29
|
+
`,G(e,128)),R(n,t.name);let a=M((t.name.split(r,2).at(-1)||``).split(i,2).at(-1)??``);this.effect(function(){L(n,a,this.eval(t.value,{$elem:e}))},{directive:`:prop:${a}`,element:n,expression:t.value})}}},n.stripTypes=(e,t)=>{let n=e;N(n,`:types`)&&R(n,`:types`),N(n,`data-types`)&&R(n,`data-types`)},n.resolveRenderAttribute=async function(e,t){if(this._skipNodes.has(e))return;let n=e,r=P(n,`render`,`:`);if(!r)return;this.log(`:render attribute found: ${r}`),z(n,`render`,`:`);let i;A(e,`renderer`)?(i=e.renderer,this.log(`Reusing existing subrenderer for :render:`,G(e,64))):(i=this.subrenderer(),L(n,`renderer`,i)),await i.mount(e,t);for(let t of k(e,this._skipNodes))this._skipNodes.add(t);try{let e=await import(r);typeof e.default==`function`?await e.default(n,i):e.default!==void 0&&console.warn(`Module ${r} default export is not a function`)}catch(e){console.error(`Failed to execute render init from ${r}:`,e)}}})(q||={});function He(){return new URL(globalThis.window?.location?.href||`http://localhost/`)}function Ue(e){return e.substring(2)}function We(e){return`\$\$${e}`}function Ge(e){return e.keys().filter(e=>e.startsWith(`$$`))}async function Ke(e,t){for(let[n,r]of t.searchParams.entries()){let t=We(n);e.get(t)!==r&&await e.set(t,r)}}function qe(e,t,n){let r=Ue(t),i=!1;if(!n)e.searchParams.has(r)&&(e.searchParams.delete(r),i=!0);else{let t=String(n);e.searchParams.get(r)!==t&&(e.searchParams.set(r,t),i=!0)}return i}function Je(e,t){let n=!1;for(let r of Ge(t))qe(e,r,t.get(r))&&(n=!0);n&&globalThis.window?.history?.replaceState({},``,e.toString())}function Ye(e){return async()=>{let t=He(),n=new Set;for(let[r,i]of t.searchParams.entries()){let t=We(r);n.add(t),e.get(t)!==i&&e.set(t,i)}let r=Ge(e);for(let t of r)n.has(t)||e.del(t)}}async function Xe(e){let t=He();await Ke(e,t),Je(t,e),e.addKeyHandler(/^\$\$/,(e,t)=>{let n=He();qe(n,e,t)&&globalThis.window?.history?.replaceState({},``,n.toString())}),globalThis.window?.addEventListener(`popstate`,Ye(e))}
|
|
30
30
|
/*
|
|
31
31
|
* @license
|
|
32
32
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
33
33
|
*/
|
|
34
|
-
const Ze=new Set([`this`,`typeof`]),Qe=new Set([`in`]),$e=new Set([`+`,`-`,`!`,`typeof`]),et=new Set([`=`,`+`,`-`,`*`,`/`,`%`,`^`,`==`,`!=`,`>`,`<`,`>=`,`<=`,`||`,`&&`,`??`,`&`,`===`,`!==`,`|`,`in`]),
|
|
34
|
+
const Ze=new Set([`this`,`typeof`]),Qe=new Set([`in`]),$e=new Set([`+`,`-`,`!`,`typeof`]),et=new Set([`=`,`+`,`-`,`*`,`/`,`%`,`^`,`==`,`!=`,`>`,`<`,`>=`,`<=`,`||`,`&&`,`??`,`&`,`===`,`!==`,`|`,`in`]),tt={"!":0,":":0,",":0,")":0,"]":0,"}":0,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,in:10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"?.":13,"{":13},nt={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),in:(e,t)=>e in t},rt={"+":e=>e,"-":e=>-e,"!":e=>!e,typeof:e=>typeof e};var it=class{empty(){return{type:`Empty`,evaluate(e){return e},getIds(e){return e}}}literal(e){return{type:`Literal`,value:e,evaluate(e){return this.value},getIds(e){return e}}}id(e){return{type:`ID`,value:e,evaluate(e){return this.value===`this`?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(e,t){let n=rt[e];return{type:`Unary`,operator:e,child:t,evaluate(e){return n(this.child.evaluate(e))},getIds(e){return this.child.getIds(e)}}}binary(e,t,n){let r=nt[t];return{type:`Binary`,operator:t,left:e,right:n,evaluate(e){if(this.operator===`=`){if(this.left.type!==`ID`&&this.left.type!==`Getter`&&this.left.type!==`Index`)throw Error(`Invalid assignment target: ${this.left}`);let t=this.right.evaluate(e),n,r;return this.left.type===`Getter`?(n=this.left.receiver.evaluate(e),r=this.left.name):this.left.type===`Index`?(n=this.left.receiver.evaluate(e),r=String(this.left.argument.evaluate(e))):this.left.type===`ID`&&(n=e,r=this.left.value),n===void 0?void 0:(n[r]=t,t)}return r(this.left.evaluate(e),this.right.evaluate(e))},getIds(e){return this.left.getIds(e),this.right.getIds(e),e}}}getter(e,t,n){return{type:`Getter`,receiver:e,name:t,optional:n,evaluate(e){let t=this.receiver.evaluate(e);if(!(this.optional&&t==null))return t?.[this.name]},getIds(e){return this.receiver.getIds(e),e}}}invoke(e,t,n,r){if(t!=null&&typeof t!=`string`)throw Error(`method not a string`);return{type:`Invoke`,receiver:e,method:t,arguments:n,optional:r,evaluate(e){let t=this.receiver.evaluate(e);if(this.optional&&t==null)return;let n=this.method?t:e?.this??e,r=this.method?t?.[this.method]:t,i=this.arguments??[],a=[];for(let t of i)if(t?.type===`SpreadElement`){let n=t.evaluate(e);n&&typeof n[Symbol.iterator]==`function`&&a.push(...n)}else a.push(t?.evaluate(e));return r?.apply?.(n,a)},getIds(e){return this.receiver.getIds(e),this.arguments?.forEach(t=>{t?.getIds(e)}),e}}}paren(e){return e}index(e,t,n){return{type:`Index`,receiver:e,argument:t,optional:n,evaluate(e){let t=this.receiver.evaluate(e);if(this.optional&&t==null)return;let n=this.argument.evaluate(e);return t?.[n]},getIds(e){return this.receiver.getIds(e),e}}}ternary(e,t,n){return{type:`Ternary`,condition:e,trueExpr:t,falseExpr:n,evaluate(e){return this.condition.evaluate(e)?this.trueExpr.evaluate(e):this.falseExpr.evaluate(e)},getIds(e){return this.condition.getIds(e),this.trueExpr.getIds(e),this.falseExpr.getIds(e),e}}}map(e){return{type:`Map`,properties:e,evaluate(t){let n={};if(e&&this.properties)for(let e of this.properties)e.type===`SpreadProperty`?Object.assign(n,e.evaluate(t)):n[e.key]=e.value.evaluate(t);return n},getIds(t){if(e&&this.properties)for(let e of this.properties)e.type===`SpreadProperty`?e.expression.getIds(t):e.value.getIds(t);return t}}}property(e,t){return{type:`Property`,key:e,value:t,evaluate(e){return this.value.evaluate(e)},getIds(e){return this.value.getIds(e)}}}list(e){return{type:`List`,items:e,evaluate(e){if(!this.items)return[];let t=[];for(let n of this.items)if(n?.type===`SpreadElement`){let r=n.evaluate(e);r&&typeof r[Symbol.iterator]==`function`&&t.push(...r)}else t.push(n?.evaluate(e));return t},getIds(e){return this.items?.forEach(t=>{t?.getIds(e)}),e}}}arrowFunction(e,t){return{type:`ArrowFunction`,params:e,body:t,evaluate(e){let t=this.params,n=this.body;return function(...r){let i=Object.fromEntries(t.map((e,t)=>[e,r[t]])),a=this??e??{},o=new Proxy(a,{set(e,t,n){return Object.hasOwn(i,t)&&(i[t]=n),e[t]=n,n},get(e,t){return Object.hasOwn(i,t)?i[t]:e[t]}});return n.evaluate(o)}},getIds(e){return this.body.getIds(e).filter(e=>!this.params.includes(e))}}}spreadProperty(e){return{type:`SpreadProperty`,expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}spreadElement(e){return{type:`SpreadElement`,expression:e,evaluate(e){return this.expression.evaluate(e)},getIds(e){return this.expression.getIds(e)}}}};
|
|
35
35
|
/*
|
|
36
36
|
* @license
|
|
37
37
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
38
38
|
*/
|
|
39
|
-
const
|
|
40
|
-
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var mt=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;ot(this._next??-1);)this._advance(!0);if(ut(this._next??-1))return this._tokenizeString();if(st(this._next??-1))return this._tokenizeIdentOrKeyword();if(Z(this._next??-1))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(dt(this._next??-1))return this._tokenizeOperator();if(ft(this._next??-1))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0||this._next===92&&(this._advance(),this._next===void 0))throw Error(`unterminated string`);this._advance()}let t=X(Y.STRING,pt(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(ct(this._next??-1));let e=this._getValue();return X(lt(e)?Y.KEYWORD:Qe.has(e)?Y.OPERATOR:Y.IDENTIFIER,e,J[e]??0)}_tokenizeNumber(){do this._advance();while(Z(this._next??-1));return this._next===46?this._tokenizeDot():X(Y.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),Z(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),X(Y.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),X(Y.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),X(Y.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),X(Y.COLON,`:`)}_tokenizeFraction(){do this._advance();while(Z(this._next??-1));return X(Y.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(at.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),X(Y.ARROW,e);it.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?X(Y.OPTIONAL_DOT,e,13):X(Y.OPERATOR,e,J[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=X(Y.GROUPER,e,J[e]);return this._advance(!0),t}};const ht=(e,t)=>new gt(e,t).parse();var gt=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new mt(e),this._ast=t}parse(){this._advance();let e=this._parseExpression();if(this._token)throw Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let n=this._tokenizer.nextToken();this._token=n,this._kind=n?.kind,this._value=n?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw Error(`Expected left to be defined.`);for(;this._token;)if(this._matches(Y.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(Y.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(Y.DOT)||this._matches(Y.OPTIONAL_DOT)){let t=this._kind===Y.OPTIONAL_DOT;if(this._advance(),t&&this._matches(Y.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(Y.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{let n=this._parseUnary();e=this._makeInvokeOrGetter(e,n,t)}}else if(this._matches(Y.KEYWORD))break;else if(this._matches(Y.OPERATOR)&&this._token.precedence>=t)e=this._value===`?`?this._parseTernary(e):this._parseBinary(e,this._token);else break;return e}_makeInvokeOrGetter(e,t,n){if(t===void 0)throw Error(`expected identifier`);if(t.type===`ID`)return this._ast.getter(e,t.value,n);if(t.type===`Invoke`&&t.receiver.type===`ID`){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,n)}else throw Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!et.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===Y.OPERATOR||this._kind===Y.DOT||this._kind===Y.GROUPER)&&this._token&&(this._token.precedence??0)>t.precedence;)n=this._parsePrecedence(n,this._token?.precedence??0);if(n===void 0)throw Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,n)}_parseUnary(){if(this._matches(Y.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(Y.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(Y.INTEGER))return this._parseInteger(e);if(this._matches(Y.DECIMAL))return this._parseDecimal(e)}if(!e||!$e.has(e))throw Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(Y.OPERATOR,`?`);let t=this._parseExpression();this._advance(Y.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case Y.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw Ze.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case Y.IDENTIFIER:return this._parseInvokeOrIdentifier();case Y.STRING:return this._parseString();case Y.INTEGER:return this._parseInteger();case Y.DECIMAL:return this._parseDecimal();case Y.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case Y.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(Y.GROUPER,`]`))break;if(this._matches(Y.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(Y.COMMA));return this._advance(Y.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(Y.GROUPER,`}`))break;if(this._matches(Y.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(Y.STRING)||this._matches(Y.IDENTIFIER))&&this._advance(),this._matches(Y.COLON)){this._advance(Y.COLON);let n=this._parseExpression();n&&e.push(this._ast.property(t,n))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(Y.COMMA));return this._advance(Y.GROUPER,`}`),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e===`true`)return this._advance(),this._ast.literal(!0);if(e===`false`)return this._advance(),this._ast.literal(!1);if(e===`null`)return this._advance(),this._ast.literal(null);if(e===`undefined`)return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),n=this._parseArguments();return n?this._ast.invoke(t,void 0,n):t}_parseIdentifier(){if(!this._matches(Y.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(Y.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(Y.GROUPER,`)`))break;if(this._matches(Y.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{let t=this._parseExpression();e.push(t)}}while(this._matches(Y.COMMA));return this._advance(Y.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(Y.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(Y.ARROW)){this._advance();let t=this._parseExpression(),n=e?.map(e=>e.value)??[];return this._ast.arrowFunction(n,t)}else return this._ast.paren(e?.[0])}_parseString(){let e=this._ast.literal(this._value??``);return this._advance(),e}_parseInteger(e=``){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=``){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};const Q=Symbol(`__computed__`);function _t(e){return typeof e==`object`&&!!e&&Q in e&&e[Q]===!0}function vt(e,t){if(e===`raf`&&typeof globalThis.requestAnimationFrame==`function`){let e=globalThis.requestAnimationFrame(()=>t());return{cancel:()=>globalThis.cancelAnimationFrame?.(e)}}let n=setTimeout(t,e===`raf`?0:e);return{cancel:()=>clearTimeout(n)}}const yt=new rt,bt=`__is_proxy__`;function xt(e){return e instanceof wt||e[bt]===!0}function St(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return St(n.get(`$parent`),t)}function $(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?$(n.get(`$parent`),t):null}function Ct(e,t,n){let r=$(e,t);r?r._store.set(t,n):e._store.set(t,n)}var wt=class e{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();_notify=new Map;_policy=new Map;_dirty=new Set;_burstStart=new Map;_computedDepth=0;constructor(e){for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e,t){if(e==null||xt(e)||Object.isFrozen(e)||Object.isSealed(e))return e;let n=Object.getPrototypeOf(e);return!(n===Object.prototype||n===null)&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,n)=>typeof n==`string`&&n in e?(delete e[n],t(),!0):!1,set:(e,n,r,i)=>{if(Reflect.get(e,n,i)===r)return!0;typeof r==`object`&&r&&(r=this.wrapObject(r,t));let a=Reflect.set(e,n,r,i);return t(),a},get:(e,n,r)=>{if(n===bt)return!0;let i=Reflect.get(e,n,r);if(typeof i==`object`&&i&&!xt(i)){let a=this.wrapObject(i,t);if(a!==i)return Reflect.set(e,n,a,r),a}return i}})}watch(e,t){let n=$(this,e);if(!n)throw Error(`Cannot watch key "${e}" as it does not exist in the store.`);n.observers.has(e)||n.observers.set(e,new Set),Array.from(n.observers.get(e)||[]).some(e=>e.observer===t)||n.observers.get(e)?.add({observer:t,store:this})}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e)?.add(t)}tagObserversForComputed(e,t){for(let n of this.observers.values())for(let r of n)r.observer===e&&r.store===this&&(r.computedKey=t);let n=this._store.get(`$parent`);for(;n;){for(let r of n.observers.values())for(let n of r)n.observer===e&&n.store===this&&(n.computedKey=t);n=n._store.get(`$parent`)}}markDependentComputedsDirty(e){let t=$(this,e)?.observers.get(e);if(t){for(let e of t)if(e.computedKey){let t=e.store._store.get(e.computedKey);_t(t)&&!t.dirty&&(t.dirty=!0,e.store.markDependentComputedsDirty(e.computedKey))}}}debounce(e,t){this._policy.set(e,t)}async notify(e,t){let n=$(this,e),r=Array.from(n?.observers.get(e)||[]),i=this._notify.get(e);if(i===`executing`){this._dirty.add(e);return}let a=t??this._policy.get(e)??10,o=a;if(a!==`raf`){let t=Date.now(),n=this._burstStart.get(e)??t;this._burstStart.set(e,n);let r=Math.max(a,16);o=Math.min(a,Math.max(0,r-(t-n)))}return i&&i.cancel(),new Promise(i=>{this._notify.set(e,vt(o,async()=>{this._burstStart.delete(e);try{this._notify.set(e,`executing`);let t=r.map(e=>e.observer.call(e.store.proxify(e.observer)));this._dirty.delete(e),await Promise.all(t)}finally{this._notify.delete(e),this._dirty.delete(e)&&this.notify(e,t)}let a=n?.observers.get(e);if(a)for(let e of r){let t=e.store._store.has(`$parent`),n=e.store._store.get(`$rootNode`);t&&n&&!n.isConnected&&!n.parentNode&&a.delete(e)}i()}))})}get(e,t){t&&this.watch(e,t);let n=St(this,e);if(_t(n)){if(n.dirty){this._computedDepth++;try{let t=this.proxify(n.effectFn);n.value=n.fn.call(t,t),n.dirty=!1,n.effectFn&&this.tagObserversForComputed(n.effectFn,e),this.markDependentComputedsDirty(e)}finally{this._computedDepth--}}return n.value}return n}setupComputed(e,t){let n=this,r={[Q]:!0,fn:t,dirty:!0};this._store.set(e,r);let i=function(){n._computedDepth++;try{let i=t.call(this,this);if(r.value!==i){r.value=i;let t=$(n,e),a=Array.from(t?.observers.get(e)||[]);for(let e of a)e.observer.call(e.store.proxify(e.observer))}r.dirty=!1}finally{n._computedDepth--}};r.effectFn=i,this.effect(i,{directive:`computed`,id:e}),this.tagObserversForComputed(i,e)}async set(e,t,n){if(_t(t)){this.setupComputed(e,t.fn);return}if(this._store.has(e)&&t===this._store.get(e))return;let r=()=>(this.markDependentComputedsDirty(e),this.notify(e));if(t&&typeof t==`object`&&(t=this.wrapObject(t,r)),n?this._store.set(e,t):Ct(this,e,t),!n){for(let[n,r]of this.keyHandlers.entries())if(n.test(e))for(let n of r)await Promise.resolve(n.call(this.$,e,t))}await r()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}dispose(){for(let e of this.observers.values())e.clear();this.observers.clear();let e=this._store.get(`$parent`);for(;e;){for(let t of e.observers.values())for(let e of t)e.store===this&&t.delete(e);e=e._store.get(`$parent`)}}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}getObserverStats(){let e={},t=0;for(let[n,r]of this.observers)e[n]=r.size,t+=r.size;return{totalKeys:this.observers.size,totalObservers:t,byKey:e}}effect(e,t){return e.call(this.proxify(e))}$computed(e){return{[Q]:!0,fn:e,dirty:!0}}proxify(t){let n=Array.from(this._store.entries()).map(([e])=>e),r=Object.fromEntries(n.map(e=>[e,null])),i=(e,t,n)=>typeof e==`function`&&t!==`constructor`?(...t)=>e.call(n,...t):e;return new Proxy(r,{has:(e,t)=>typeof t==`string`&&($(this,t)||Reflect.has(this,t))?!0:Reflect.has(r,t),get:(n,r,a)=>{if(typeof r==`string`){if($(this,r)){let n=this.get(r,t);return t&&n instanceof e?n.proxify(t):i(n,r,a)}if(t&&r!==bt&&!Reflect.has(this,r))return this.set(r,void 0),this.get(r,t)}return r===`$`?this.proxify(t):i(Reflect.get(this,r,a),r,a)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):(this._computedDepth>0&&console.warn(`[mancha] Computed wrote to '${t}'. Computeds should be pure; use $effect for side effects.`),this.set(t,n)),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=ht(e,yt),i=new Proxy(n,{has(e,n){return n in e||n in t||n in globalThis},get(e,n){if(typeof n==`string`)return n in e?e[n]:n in t?t[n]:n in globalThis?globalThis[n]:t[n]},set(e,n,r){return typeof n==`string`?n in e?(e[n]=r,!0):(t[n]=r,!0):!1}});return r?.evaluate(i)}}cachedExpressionFunction(e){e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e));let t=this.expressionCache.get(e);if(!t)throw Error(`Failed to retrieve cached expression: ${e}`);return t}eval(e,t={}){let n=this.$;if(this._store.has(e))return n[e];{let r=this.cachedExpressionFunction(e);try{return r(n,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}$resolve(e,t){let n={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{n.$result=e}).catch(e=>{n.$error=e instanceof Error?e:Error(String(e))}).finally(()=>{n.$pending=!1}),n}};const Tt=`data-m-cloak`,Et=`mancha-runtime-cloak`,Dt=a`[data-m-cloak]{display:none!important}`;var Ot=class e extends wt{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];cloakElement(e){let t=e.ownerDocument??globalThis.document;if(t?.head&&!t.getElementById(Et)){let e=t.createElement(`style`);e.id=Et,r.setTextContent(e,Dt),t.head.appendChild(e)}P(e,Tt,``)}uncloakElement(e){L(e,Tt)}debug(e){return typeof e==`boolean`?this._debugLevel=e?`lifecycle`:`off`:this._debugLevel=e,this}get debugging(){return this._debugLevel!==`off`}shouldLog(t){return e.DEBUG_LEVELS.indexOf(this._debugLevel)>=e.DEBUG_LEVELS.indexOf(t)}clearPerformanceReport(){this._perfData={lifecycle:{},effects:new Map}}getNodePath(e){let t=[],n=e;for(;n?.tagName;){let e=n.tagName.toLowerCase(),r=n.parentElement;if(r){let i=Array.from(r.children).filter(t=>t.tagName.toLowerCase()===e);if(i.length>1){let r=i.indexOf(n)+1;t.unshift(`${e}:nth-child(${r})`)}else t.unshift(e)}else t.unshift(e);n=r}return t.join(`>`)}buildObserverId(e){let t=e?.directive??`unknown`,n=U(e?.expression??``,32),r=e?.element,i=e?.id??(r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`);return n?`${t}:${i}:${n}`:`${t}:${i}`}recordObserverExecution(e,t){let n=this.buildObserverId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}getPerformanceReport(){let e=Array.from(this._perfData.effects.entries()),t={};for(let[n,r]of e){let e=n.split(`:`)[0];t[e]||(t[e]={count:0,totalTime:0}),t[e].count+=r.count,t[e].totalTime+=r.totalTime}let n=e.map(([e,t])=>({id:e,executionCount:t.count,totalTime:t.totalTime,avgTime:t.count>0?t.totalTime/t.count:0})).sort((e,t)=>t.totalTime-e.totalTime).slice(0,10);return{lifecycle:this._perfData.lifecycle,effects:{total:e.length,byDirective:t,slowest:n},observers:this.getObserverStats()}}effect(e,t){let n=this;function r(){if(!n.shouldLog(`lifecycle`))return e.call(this);let r=performance.now(),i=e.call(this),a=performance.now()-r;return t&&n.recordObserverExecution(t,a),a>16&&console.warn(`[mancha] Slow observer (${a.toFixed(1)}ms):`,n.buildObserverId(t)),n.shouldLog(`effects`)&&console.debug(`[mancha] Observer (${a.toFixed(2)}ms):`,n.buildObserverId(t)),i}return super.effect(r,t)}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??`default`}).then(e=>e.text())}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log(`Preprocessing string content with params:
|
|
41
|
-
`,t);let n=this.parseHTML(e,t);return await this.preprocessNode(n,t),n}async preprocessRemote(e,t){let n={};t?.cache&&(n.cache=t.cache);let r=await fetch(e,n).then(e=>e.text());return this.preprocessString(r,{...t,dirpath:
|
|
42
|
-
`,
|
|
43
|
-
`,
|
|
39
|
+
const at=new Set([`==`,`!=`,`<=`,`>=`,`||`,`&&`,`??`,`?.`]),ot=new Set([`===`,`!==`]);let J=function(e){return e[e.STRING=1]=`STRING`,e[e.IDENTIFIER=2]=`IDENTIFIER`,e[e.DOT=3]=`DOT`,e[e.COMMA=4]=`COMMA`,e[e.COLON=5]=`COLON`,e[e.INTEGER=6]=`INTEGER`,e[e.DECIMAL=7]=`DECIMAL`,e[e.OPERATOR=8]=`OPERATOR`,e[e.GROUPER=9]=`GROUPER`,e[e.KEYWORD=10]=`KEYWORD`,e[e.ARROW=11]=`ARROW`,e[e.OPTIONAL_DOT=12]=`OPTIONAL_DOT`,e[e.SPREAD=13]=`SPREAD`,e}({});const Y=(e,t,n=0)=>({kind:e,value:t,precedence:n}),st=e=>e===9||e===10||e===13||e===32,ct=e=>{if(e===95||e===36)return!0;let t=e&-33;return 65<=t&&t<=90},lt=e=>ct(e)||X(e),ut=e=>Ze.has(e),dt=e=>e===34||e===39,X=e=>48<=e&&e<=57,ft=e=>e===43||e===45||e===42||e===47||e===33||e===38||e===37||e===60||e===61||e===62||e===63||e===94||e===124,pt=e=>e===40||e===41||e===91||e===93||e===123||e===125,mt=e=>e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
|
|
40
|
+
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var ht=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;st(this._next??-1);)this._advance(!0);if(dt(this._next??-1))return this._tokenizeString();if(ct(this._next??-1))return this._tokenizeIdentOrKeyword();if(X(this._next??-1))return this._tokenizeNumber();if(this._next===46)return this._tokenizeDot();if(this._next===44)return this._tokenizeComma();if(this._next===58)return this._tokenizeColon();if(ft(this._next??-1))return this._tokenizeOperator();if(pt(this._next??-1))return this._tokenizeGrouper();if(this._advance(),this._next!==void 0)throw Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),e===!0&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){let t=this._input.substring(this._tokenStart,this._index+e);return e===0&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){let e=this._next;for(this._advance(!0);this._next!==e;){if(this._next===void 0||this._next===92&&(this._advance(),this._next===void 0))throw Error(`unterminated string`);this._advance()}let t=Y(J.STRING,mt(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(lt(this._next??-1));let e=this._getValue();return Y(ut(e)?J.KEYWORD:Qe.has(e)?J.OPERATOR:J.IDENTIFIER,e,tt[e]??0)}_tokenizeNumber(){do this._advance();while(X(this._next??-1));return this._next===46?this._tokenizeDot():Y(J.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),X(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),Y(J.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),Y(J.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),Y(J.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),Y(J.COLON,`:`)}_tokenizeFraction(){do this._advance();while(X(this._next??-1));return Y(J.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(ot.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),Y(J.ARROW,e);at.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?Y(J.OPTIONAL_DOT,e,13):Y(J.OPERATOR,e,tt[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=Y(J.GROUPER,e,tt[e]);return this._advance(!0),t}};const gt=(e,t)=>new _t(e,t).parse();var _t=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new ht(e),this._ast=t}parse(){this._advance();let e=this._parseExpression();if(this._token)throw Error(`Unexpected token: ${this._token.value}`);return e}_advance(e,t){if(!this._matches(e,t))throw Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);let n=this._tokenizer.nextToken();this._token=n,this._kind=n?.kind,this._value=n?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();let e=this._parseUnary();return e===void 0?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(e===void 0)throw Error(`Expected left to be defined.`);for(;this._token;)if(this._matches(J.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(J.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(J.DOT)||this._matches(J.OPTIONAL_DOT)){let t=this._kind===J.OPTIONAL_DOT;if(this._advance(),t&&this._matches(J.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(J.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t,!0)}else{let n=this._parseUnary();e=this._makeInvokeOrGetter(e,n,t)}}else if(this._matches(J.KEYWORD))break;else if(this._matches(J.OPERATOR)&&this._token.precedence>=t)e=this._value===`?`?this._parseTernary(e):this._parseBinary(e,this._token);else break;return e}_makeInvokeOrGetter(e,t,n){if(t===void 0)throw Error(`expected identifier`);if(t.type===`ID`)return this._ast.getter(e,t.value,n);if(t.type===`Invoke`&&t.receiver.type===`ID`){let r=t.receiver;return this._ast.invoke(e,r.value,t.arguments,n)}else throw Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(!et.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===J.OPERATOR||this._kind===J.DOT||this._kind===J.GROUPER)&&this._token&&(this._token.precedence??0)>t.precedence;)n=this._parsePrecedence(n,this._token?.precedence??0);if(n===void 0)throw Error(`Expected expression after ${t.value}`);return this._ast.binary(e,t.value,n)}_parseUnary(){if(this._matches(J.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(J.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(J.INTEGER))return this._parseInteger(e);if(this._matches(J.DECIMAL))return this._parseDecimal(e)}if(!e||!$e.has(e))throw Error(`unexpected token: ${e}`);let t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(J.OPERATOR,`?`);let t=this._parseExpression();this._advance(J.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case J.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw Ze.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case J.IDENTIFIER:return this._parseInvokeOrIdentifier();case J.STRING:return this._parseString();case J.INTEGER:return this._parseInteger();case J.DECIMAL:return this._parseDecimal();case J.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case J.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(J.GROUPER,`]`))break;if(this._matches(J.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(J.COMMA));return this._advance(J.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(J.GROUPER,`}`))break;if(this._matches(J.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(J.STRING)||this._matches(J.IDENTIFIER))&&this._advance(),this._matches(J.COLON)){this._advance(J.COLON);let n=this._parseExpression();n&&e.push(this._ast.property(t,n))}else e.push(this._ast.property(t,this._ast.id(t)))}}while(this._matches(J.COMMA));return this._advance(J.GROUPER,`}`),this._ast.map(e)}_parseInvokeOrIdentifier(){let e=this._value;if(e===`true`)return this._advance(),this._ast.literal(!0);if(e===`false`)return this._advance(),this._ast.literal(!1);if(e===`null`)return this._advance(),this._ast.literal(null);if(e===`undefined`)return this._advance(),this._ast.literal(void 0);let t=this._parseIdentifier(),n=this._parseArguments();return n?this._ast.invoke(t,void 0,n):t}_parseIdentifier(){if(!this._matches(J.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(J.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(J.GROUPER,`)`))break;if(this._matches(J.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else{let t=this._parseExpression();e.push(t)}}while(this._matches(J.COMMA));return this._advance(J.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(J.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(J.ARROW)){this._advance();let t=this._parseExpression(),n=e?.map(e=>e.value)??[];return this._ast.arrowFunction(n,t)}else return this._ast.paren(e?.[0])}_parseString(){let e=this._ast.literal(this._value??``);return this._advance(),e}_parseInteger(e=``){let t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=``){let t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}};const Z=Symbol(`__computed__`);function vt(e){return typeof e==`object`&&!!e&&Z in e&&e[Z]===!0}const yt=new it,Q=`__is_proxy__`;function bt(e){return e instanceof Ct||e[Q]===!0}function xt(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return xt(n.get(`$parent`),t)}function $(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?$(n.get(`$parent`),t):null}function St(e,t,n){let r=$(e,t);r?r._store.set(t,n):e._store.set(t,n)}var Ct=class e{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();_pending=new Map;_executing=new Set;_dirty=new Set;_computedDepth=0;constructor(e){for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e,t){if(e==null||bt(e)||Object.isFrozen(e)||Object.isSealed(e))return e;let n=Object.getPrototypeOf(e);return!(n===Object.prototype||n===null)&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,n)=>typeof n==`string`&&n in e?(delete e[n],t(),!0):!1,set:(e,n,r,i)=>{if(Reflect.get(e,n,i)===r)return!0;typeof r==`object`&&r&&(r=this.wrapObject(r,t));let a=Reflect.set(e,n,r,i);return t(),a},get:(e,n,r)=>{if(n===Q)return!0;let i=Reflect.get(e,n,r);if(typeof i==`object`&&i&&!bt(i)){let a=this.wrapObject(i,t);if(a!==i)return Reflect.set(e,n,a,r),a}return i}})}watch(e,t){let n=$(this,e);if(!n)throw Error(`Cannot watch key "${e}" as it does not exist in the store.`);n.observers.has(e)||n.observers.set(e,new Set),Array.from(n.observers.get(e)||[]).some(e=>e.observer===t)||n.observers.get(e)?.add({observer:t,store:this})}addKeyHandler(e,t){this.keyHandlers.has(e)||this.keyHandlers.set(e,new Set),this.keyHandlers.get(e)?.add(t)}tagObserversForComputed(e,t){for(let n of this.observers.values())for(let r of n)r.observer===e&&r.store===this&&(r.computedKey=t);let n=this._store.get(`$parent`);for(;n;){for(let r of n.observers.values())for(let n of r)n.observer===e&&n.store===this&&(n.computedKey=t);n=n._store.get(`$parent`)}}markDependentComputedsDirty(e){let t=$(this,e)?.observers.get(e);if(t){for(let e of t)if(e.computedKey){let t=e.store._store.get(e.computedKey);vt(t)&&!t.dirty&&(t.dirty=!0,e.store.markDependentComputedsDirty(e.computedKey))}}}async notify(e,t=10){let n=$(this,e),r=Array.from(n?.observers.get(e)||[]);if(this._executing.has(e)){this._dirty.add(e);return}let i=this._pending.get(e);if(i){for(let e of r)i.entries.includes(e)||i.entries.push(e);return i.done}let a=new Promise(i=>{setTimeout(async()=>{this._pending.delete(e);try{this._executing.add(e);let t=r.map(e=>e.observer.call(e.store.proxify(e.observer)));this._dirty.delete(e),await Promise.all(t)}finally{this._executing.delete(e),this._dirty.delete(e)&&this.notify(e,t)}let a=n?.observers.get(e);if(a)for(let e of r){let t=e.store._store.has(`$parent`),n=e.store._store.get(`$rootNode`);t&&n&&!n.isConnected&&!n.parentNode&&a.delete(e)}i()},t)});return this._pending.set(e,{done:a,entries:r}),a}get(e,t){t&&this.watch(e,t);let n=xt(this,e);if(vt(n)){if(n.dirty){this._computedDepth++;try{let t=this.proxify(n.effectFn);n.value=n.fn.call(t,t),n.dirty=!1,n.effectFn&&this.tagObserversForComputed(n.effectFn,e),this.markDependentComputedsDirty(e)}finally{this._computedDepth--}}return n.value}return n}setupComputed(e,t){let n=this,r={[Z]:!0,fn:t,dirty:!0};this._store.set(e,r);let i=function(){n._computedDepth++;try{let i=t.call(this,this);if(r.value!==i){r.value=i;let t=$(n,e),a=Array.from(t?.observers.get(e)||[]);for(let e of a)e.observer.call(e.store.proxify(e.observer))}r.dirty=!1}finally{n._computedDepth--}};r.effectFn=i,this.effect(i,{directive:`computed`,id:e}),this.tagObserversForComputed(i,e)}async set(e,t,n){if(vt(t)){this.setupComputed(e,t.fn);return}if(this._store.has(e)&&t===this._store.get(e))return;let r=()=>(this.markDependentComputedsDirty(e),this.notify(e));if(t&&typeof t==`object`&&(t=this.wrapObject(t,r)),n?this._store.set(e,t):St(this,e,t),!n){for(let[n,r]of this.keyHandlers.entries())if(n.test(e))for(let n of r)await Promise.resolve(n.call(this.$,e,t))}await r()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}dispose(){for(let e of this.observers.values())e.clear();this.observers.clear();let e=this._store.get(`$parent`);for(;e;){for(let t of e.observers.values())for(let e of t)e.store===this&&t.delete(e);e=e._store.get(`$parent`)}}keys(){return Array.from(this._store.keys())}has(e){return this._store.has(e)}getObserverStats(){let e={},t=0;for(let[n,r]of this.observers)e[n]=r.size,t+=r.size;return{totalKeys:this.observers.size,totalObservers:t,byKey:e}}effect(e,t){return e.call(this.proxify(e))}$computed(e){return{[Z]:!0,fn:e,dirty:!0}}proxify(t){let n=Array.from(this._store.entries()).map(([e])=>e),r=Object.fromEntries(n.map(e=>[e,null])),i=(e,t,n)=>typeof e==`function`&&t!==`constructor`?(...t)=>e.call(n,...t):e;return new Proxy(r,{has:(e,t)=>typeof t==`string`&&($(this,t)||Reflect.has(this,t))?!0:Reflect.has(r,t),get:(n,r,a)=>{if(typeof r==`string`){if($(this,r)){let n=this.get(r,t);return t&&n instanceof e?n.proxify(t):i(n,r,a)}if(t&&r!==Q&&!Reflect.has(this,r))return this.set(r,void 0),this.get(r,t)}return r===`$`?this.proxify(t):i(Reflect.get(this,r,a),r,a)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):(this._computedDepth>0&&console.warn(`[mancha] Computed wrote to '${t}'. Computeds should be pure; use $effect for side effects.`),this.set(t,n)),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=gt(e,yt),i=new Proxy(n,{has(e,n){return n in e||n in t||n in globalThis},get(e,n){if(typeof n==`string`)return n in e?e[n]:n in t?t[n]:n in globalThis?globalThis[n]:t[n]},set(e,n,r){return typeof n==`string`?n in e?(e[n]=r,!0):(t[n]=r,!0):!1}});return r?.evaluate(i)}}cachedExpressionFunction(e){e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e));let t=this.expressionCache.get(e);if(!t)throw Error(`Failed to retrieve cached expression: ${e}`);return t}eval(e,t={}){let n=this.$;if(this._store.has(e))return n[e];{let r=this.cachedExpressionFunction(e);try{return r(n,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}$resolve(e,t){let n={$pending:!0,$result:null,$error:null};return Promise.resolve().then(()=>e(t)).then(e=>{n.$result=e}).catch(e=>{n.$error=e instanceof Error?e:Error(String(e))}).finally(()=>{n.$pending=!1}),n}};const wt=`data-m-cloak`,Tt=`mancha-runtime-cloak`,Et=a`[data-m-cloak]{display:none!important}`;var Dt=class e extends Ct{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];cloakElement(e){let t=e.ownerDocument??globalThis.document;if(t?.head&&!t.getElementById(Tt)){let e=t.createElement(`style`);e.id=Tt,r.setTextContent(e,Et),t.head.appendChild(e)}F(e,wt,``)}uncloakElement(e){R(e,wt)}debug(e){return typeof e==`boolean`?this._debugLevel=e?`lifecycle`:`off`:this._debugLevel=e,this}get debugging(){return this._debugLevel!==`off`}shouldLog(t){return e.DEBUG_LEVELS.indexOf(this._debugLevel)>=e.DEBUG_LEVELS.indexOf(t)}clearPerformanceReport(){this._perfData={lifecycle:{},effects:new Map}}getNodePath(e){let t=[],n=e;for(;n?.tagName;){let e=n.tagName.toLowerCase(),r=n.parentElement;if(r){let i=Array.from(r.children).filter(t=>t.tagName.toLowerCase()===e);if(i.length>1){let r=i.indexOf(n)+1;t.unshift(`${e}:nth-child(${r})`)}else t.unshift(e)}else t.unshift(e);n=r}return t.join(`>`)}buildObserverId(e){let t=e?.directive??`unknown`,n=W(e?.expression??``,32),r=e?.element,i=e?.id??(r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`);return n?`${t}:${i}:${n}`:`${t}:${i}`}recordObserverExecution(e,t){let n=this.buildObserverId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}getPerformanceReport(){let e=Array.from(this._perfData.effects.entries()),t={};for(let[n,r]of e){let e=n.split(`:`)[0];t[e]||(t[e]={count:0,totalTime:0}),t[e].count+=r.count,t[e].totalTime+=r.totalTime}let n=e.map(([e,t])=>({id:e,executionCount:t.count,totalTime:t.totalTime,avgTime:t.count>0?t.totalTime/t.count:0})).sort((e,t)=>t.totalTime-e.totalTime).slice(0,10);return{lifecycle:this._perfData.lifecycle,effects:{total:e.length,byDirective:t,slowest:n},observers:this.getObserverStats()}}effect(e,t){let n=this;function r(){if(!n.shouldLog(`lifecycle`))return e.call(this);let r=performance.now(),i=e.call(this),a=performance.now()-r;return t&&n.recordObserverExecution(t,a),a>16&&console.warn(`[mancha] Slow observer (${a.toFixed(1)}ms):`,n.buildObserverId(t)),n.shouldLog(`effects`)&&console.debug(`[mancha] Observer (${a.toFixed(2)}ms):`,n.buildObserverId(t)),i}return super.effect(r,t)}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??`default`}).then(e=>e.text())}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log(`Preprocessing string content with params:
|
|
41
|
+
`,t);let n=this.parseHTML(e,t);return await this.preprocessNode(n,t),n}async preprocessRemote(e,t){let n={};t?.cache&&(n.cache=t.cache);let r=await fetch(e,n).then(e=>e.text());return this.preprocessString(r,{...t,dirpath:K(e),rootDocument:t?.rootDocument??!e.endsWith(`.tpl.html`)})}async preprocessLocal(e,t){let n=await this.fetchLocal(e,t);return this.preprocessString(n,{...t,dirpath:K(e),rootDocument:t?.rootDocument??!e.endsWith(`.tpl.html`)})}subrenderer(){let e=new this.constructor().debug(this.debugging);return e._store.set(`$parent`,this),e._store.set(`$rootRenderer`,this.get(`$rootRenderer`)??this),e._customElements=this._customElements,e}log(...e){this.shouldLog(`verbose`)&&console.debug(...e)}async preprocessNode(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;t={dirpath:this.dirpath,maxdepth:10,...t};let r=new Ve(k(e,this._skipNodes)).map(async e=>{this.log(`Preprocessing node:
|
|
42
|
+
`,G(e,128)),await q.resolveIncludes.call(this,e,t),await q.rebaseRelativePaths.call(this,e,t),await q.registerCustomElements.call(this,e,t),await q.resolveCustomElements.call(this,e,t)});return await Promise.all(r.generator()),n&&(this._perfData.lifecycle.preprocessTime=(this._perfData.lifecycle.preprocessTime??0)+(performance.now()-n)),e}async renderNode(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;for(let n of k(e,this._skipNodes))this.log(`Rendering node:
|
|
43
|
+
`,G(n,128)),await q.resolveForAttribute.call(this,n,t),await q.resolveRenderAttribute.call(this,n,t),await q.resolveDataAttribute.call(this,n,t),await q.resolveTextAttributes.call(this,n,t),await q.resolveHtmlAttribute.call(this,n,t),await q.resolveIfAttribute.call(this,n,t),await q.resolveShowAttribute.call(this,n,t),await q.resolveClassAttribute.call(this,n,t),await q.resolveBindAttribute.call(this,n,t),await q.resolveEventAttributes.call(this,n,t),await q.resolveTextNodeExpressions.call(this,n,t),await q.resolveCustomAttribute.call(this,n,t),await q.resolveCustomProperty.call(this,n,t),await q.stripTypes.call(this,n,t);for(let e of this._pendingValueRetries.splice(0))e();return n&&(this._perfData.lifecycle.renderTime=(this._perfData.lifecycle.renderTime??0)+(performance.now()-n)),e}async mount(e,t){let n=this.shouldLog(`lifecycle`)?performance.now():0;n&&this.clearPerformanceReport(),t={...t,rootNode:e},L(e,`renderer`,this),this._store.set(`$rootNode`,e),this.has(`$rootRenderer`)||this._store.set(`$rootRenderer`,this),this.get(`$rootRenderer`)===this&&await Xe(this),await this.preprocessNode(e,t),await this.renderNode(e,t),je(e),n&&(this._perfData.lifecycle.mountTime=performance.now()-n)}};export{he as a,ke as i,K as n,Ne as r,Dt as t};
|
package/dist/safe_browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as StoreState, i as IRenderer, n as RenderParams, t as ParserParams } from "./interfaces-
|
|
1
|
+
import { a as StoreState, i as IRenderer, n as RenderParams, t as ParserParams } from "./interfaces-DhL-_vL-.js";
|
|
2
2
|
|
|
3
3
|
//#region src/safe_browser.d.ts
|
|
4
4
|
declare class Renderer<T extends StoreState = StoreState> extends IRenderer<T> {
|
package/dist/safe_browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./renderer-
|
|
1
|
+
import{n as e,t}from"./renderer-1jqgJa7K.js";import{safeDomParser as n}from"safevalues/dom";import{HtmlSanitizerBuilder as r}from"safevalues";const i=`:data,:for,:key,:text,:html,:show,:if,:class,:bind,:render,:on:click,:on:click.prevent,:on:input,:on:input.prevent,:on:change,:on:change.prevent,:on:submit,:on:submit.prevent,:attr:src,:attr:href,:attr:title,:attr:data-testid,:prop:src,:prop:href,:prop:checked,:prop:selected,:prop:disabled`.split(`,`),a=e=>`data-${e.slice(1).replace(`:`,`-`)}`,o=i.map(e=>a(e)),s=[`data-testid`,`data-perfid`],c=[...o,...s];var l=class extends t{impl=`safe_browser`;dirpath=e(globalThis.location?.href??`http://localhost/`);parseHTML(e,t={rootDocument:!1}){for(let t of i)e=e.replace(RegExp(`\\s:${t.slice(1)}=`,`g`),` data-${t.slice(1).replace(`:`,`-`)}=`);e=e.replace(/<include(.*) src="([^"]+)"(.*)><\/include>/g,`<link $1 rel="subresource" href="$2" $3>`),e=e.replace(/<template is="([^"]+)">([\s\S]*)<\/template>/g,`<div role="template" alt="$1">$2</div>`),e=e.replace(/<(\w+)-(\w+)(.*)>([\s\S]*)<\/(\w+)-(\w+)>/g,`<div role="$1-$2" $3>$4</div>`);let a=new r().allowDataAttributes(c).allowClassAttributes().allowStyleAttributes().build();if(this.log(`parseHTML`,e),this.log(`sanitized`,String(a.sanitize(e))),t.rootDocument){let t=new DOMParser;return n.parseFromString(t,a.sanitize(e),`text/html`)}else return a.sanitizeToFragment(e)}serializeHTML(e){return new XMLSerializer().serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,``)}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}createComment(e,t){return(t||document).createComment(e)}textContent(e,t){e.textContent=t}};const u=new l;export{u as Mancha,l as Renderer};
|
package/dist/store.d.ts
CHANGED
|
@@ -51,21 +51,12 @@ export interface ComputedMarker<R> {
|
|
|
51
51
|
dirty: boolean;
|
|
52
52
|
effectFn?: Observer<unknown>;
|
|
53
53
|
}
|
|
54
|
-
/** Default notification debounce time in millis. */
|
|
55
|
-
export declare const REACTIVE_DEBOUNCE_MILLIS = 10;
|
|
56
|
-
/**
|
|
57
|
-
* Upper bound on how long a key can be held back by the trailing debounce.
|
|
58
|
-
* A key written more often than the debounce window would otherwise keep pushing
|
|
59
|
-
* its own deadline back and never notify at all. One 60Hz frame, since the
|
|
60
|
-
* observers that care about this rate are the ones that end in a DOM write.
|
|
61
|
-
*/
|
|
62
|
-
export declare const REACTIVE_MAX_WAIT_MILLIS = 16;
|
|
63
54
|
/**
|
|
64
|
-
* How
|
|
65
|
-
*
|
|
66
|
-
*
|
|
55
|
+
* How long observers wait after a key is written before they run. Writes arriving
|
|
56
|
+
* during that window are free: they join the already-scheduled run instead of
|
|
57
|
+
* postponing it, so a key written continuously still notifies every this often.
|
|
67
58
|
*/
|
|
68
|
-
export
|
|
59
|
+
export declare const REACTIVE_DEBOUNCE_MILLIS = 10;
|
|
69
60
|
export declare function getAncestorValue(store: SignalStore | null, key: string): unknown;
|
|
70
61
|
export declare function getAncestorKeyStore(store: SignalStore | null, key: string): SignalStore | null;
|
|
71
62
|
export declare function setAncestorValue(store: SignalStore, key: string, value: unknown): void;
|
|
@@ -77,17 +68,12 @@ export declare class SignalStore<T extends StoreState = StoreState> {
|
|
|
77
68
|
protected readonly keyHandlers: Map<RegExp, Set<KeyValueHandler>>;
|
|
78
69
|
readonly _store: Map<string, unknown>;
|
|
79
70
|
_lock: Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/** Per-key scheduling overrides, set via debounce(). */
|
|
86
|
-
private readonly _policy;
|
|
87
|
-
/** Keys written while their own observers were mid-flush, to notify afterwards. */
|
|
71
|
+
/** Keys with a scheduled observer run. */
|
|
72
|
+
private readonly _pending;
|
|
73
|
+
/** Keys whose observers are running right now. */
|
|
74
|
+
private readonly _executing;
|
|
75
|
+
/** Keys written while their own observers were running, to notify afterwards. */
|
|
88
76
|
private readonly _dirty;
|
|
89
|
-
/** When the current pending debounce burst started, per key. Bounds the trailing wait. */
|
|
90
|
-
private readonly _burstStart;
|
|
91
77
|
/**
|
|
92
78
|
* Tracks nested computed evaluation depth. When > 0, we're inside a computed
|
|
93
79
|
* function and writes to reactive properties should trigger a warning.
|
|
@@ -109,12 +95,6 @@ export declare class SignalStore<T extends StoreState = StoreState> {
|
|
|
109
95
|
* then A is also marked dirty).
|
|
110
96
|
*/
|
|
111
97
|
private markDependentComputedsDirty;
|
|
112
|
-
/**
|
|
113
|
-
* Overrides how a key's notifications are scheduled. The default debounce suits a
|
|
114
|
-
* view object republished wholesale, where coalescing is the point, but not a
|
|
115
|
-
* per-frame scalar; this opts a single key out without affecting the rest.
|
|
116
|
-
*/
|
|
117
|
-
debounce(key: string, policy: NotifyPolicy): void;
|
|
118
98
|
notify(key: string, debounceMillis?: number): Promise<void>;
|
|
119
99
|
get<T>(key: string, observer?: Observer<T>): unknown;
|
|
120
100
|
private setupComputed;
|
package/dist/store.js
CHANGED
|
@@ -8,27 +8,12 @@ function isComputedMarker(value) {
|
|
|
8
8
|
COMPUTED_MARKER in value &&
|
|
9
9
|
value[COMPUTED_MARKER] === true);
|
|
10
10
|
}
|
|
11
|
-
/** Default notification debounce time in millis. */
|
|
12
|
-
export const REACTIVE_DEBOUNCE_MILLIS = 10;
|
|
13
|
-
/**
|
|
14
|
-
* Upper bound on how long a key can be held back by the trailing debounce.
|
|
15
|
-
* A key written more often than the debounce window would otherwise keep pushing
|
|
16
|
-
* its own deadline back and never notify at all. One 60Hz frame, since the
|
|
17
|
-
* observers that care about this rate are the ones that end in a DOM write.
|
|
18
|
-
*/
|
|
19
|
-
export const REACTIVE_MAX_WAIT_MILLIS = 16;
|
|
20
11
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
12
|
+
* How long observers wait after a key is written before they run. Writes arriving
|
|
13
|
+
* during that window are free: they join the already-scheduled run instead of
|
|
14
|
+
* postponing it, so a key written continuously still notifies every this often.
|
|
23
15
|
*/
|
|
24
|
-
|
|
25
|
-
if (policy === "raf" && typeof globalThis.requestAnimationFrame === "function") {
|
|
26
|
-
const handle = globalThis.requestAnimationFrame(() => flush());
|
|
27
|
-
return { cancel: () => globalThis.cancelAnimationFrame?.(handle) };
|
|
28
|
-
}
|
|
29
|
-
const handle = setTimeout(flush, policy === "raf" ? 0 : policy);
|
|
30
|
-
return { cancel: () => clearTimeout(handle) };
|
|
31
|
-
}
|
|
16
|
+
export const REACTIVE_DEBOUNCE_MILLIS = 10;
|
|
32
17
|
/** Shared AST factory. */
|
|
33
18
|
const AST_FACTORY = new expressions.EvalAstFactory();
|
|
34
19
|
/** Symbol used to identify proxified objects. */
|
|
@@ -86,17 +71,12 @@ export class SignalStore {
|
|
|
86
71
|
keyHandlers = new Map();
|
|
87
72
|
_store = new Map();
|
|
88
73
|
_lock = Promise.resolve();
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/** Per-key scheduling overrides, set via debounce(). */
|
|
95
|
-
_policy = new Map();
|
|
96
|
-
/** Keys written while their own observers were mid-flush, to notify afterwards. */
|
|
74
|
+
/** Keys with a scheduled observer run. */
|
|
75
|
+
_pending = new Map();
|
|
76
|
+
/** Keys whose observers are running right now. */
|
|
77
|
+
_executing = new Set();
|
|
78
|
+
/** Keys written while their own observers were running, to notify afterwards. */
|
|
97
79
|
_dirty = new Set();
|
|
98
|
-
/** When the current pending debounce burst started, per key. Bounds the trailing wait. */
|
|
99
|
-
_burstStart = new Map();
|
|
100
80
|
/**
|
|
101
81
|
* Tracks nested computed evaluation depth. When > 0, we're inside a computed
|
|
102
82
|
* function and writes to reactive properties should trigger a warning.
|
|
@@ -233,64 +213,47 @@ export class SignalStore {
|
|
|
233
213
|
}
|
|
234
214
|
}
|
|
235
215
|
}
|
|
236
|
-
|
|
237
|
-
* Overrides how a key's notifications are scheduled. The default debounce suits a
|
|
238
|
-
* view object republished wholesale, where coalescing is the point, but not a
|
|
239
|
-
* per-frame scalar; this opts a single key out without affecting the rest.
|
|
240
|
-
*/
|
|
241
|
-
debounce(key, policy) {
|
|
242
|
-
this._policy.set(key, policy);
|
|
243
|
-
}
|
|
244
|
-
async notify(key, debounceMillis) {
|
|
216
|
+
async notify(key, debounceMillis = REACTIVE_DEBOUNCE_MILLIS) {
|
|
245
217
|
// Capture observers NOW (at call time). This ensures constructor calls
|
|
246
218
|
// don't trigger effects registered later.
|
|
247
219
|
const owner = getAncestorKeyStore(this, key);
|
|
248
220
|
const entries = Array.from(owner?.observers.get(key) || []);
|
|
249
|
-
const current = this._notify.get(key);
|
|
250
221
|
// Record writes that arrive while this key's observers are running, rather than
|
|
251
|
-
// dropping them, and flush them once the in-flight
|
|
252
|
-
//
|
|
253
|
-
if (
|
|
222
|
+
// dropping them, and flush them once the in-flight run finishes. The observers'
|
|
223
|
+
// own writes are filtered out below, not here.
|
|
224
|
+
if (this._executing.has(key)) {
|
|
254
225
|
this._dirty.add(key);
|
|
255
226
|
return;
|
|
256
227
|
}
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// Never shorten a caller's own debounce: the bound only caps how far a burst of
|
|
268
|
-
// writes can push an already-pending notification back.
|
|
269
|
-
const maxWait = Math.max(policy, REACTIVE_MAX_WAIT_MILLIS);
|
|
270
|
-
scheduleAt = Math.min(policy, Math.max(0, maxWait - (now - burstStart)));
|
|
228
|
+
// Observers are already scheduled and will read the value this write just set,
|
|
229
|
+
// so join that run rather than scheduling another. Leaving the existing deadline
|
|
230
|
+
// alone is what keeps a continuously-written key from postponing itself forever.
|
|
231
|
+
const scheduled = this._pending.get(key);
|
|
232
|
+
if (scheduled) {
|
|
233
|
+
for (const entry of entries) {
|
|
234
|
+
if (!scheduled.entries.includes(entry))
|
|
235
|
+
scheduled.entries.push(entry);
|
|
236
|
+
}
|
|
237
|
+
return scheduled.done;
|
|
271
238
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
// Schedule the notification.
|
|
276
|
-
return new Promise((resolve) => {
|
|
277
|
-
this._notify.set(key, scheduleFlush(scheduleAt, async () => {
|
|
278
|
-
this._burstStart.delete(key);
|
|
239
|
+
const done = new Promise((resolve) => {
|
|
240
|
+
setTimeout(async () => {
|
|
241
|
+
this._pending.delete(key);
|
|
279
242
|
try {
|
|
280
|
-
this.
|
|
243
|
+
this._executing.add(key);
|
|
281
244
|
// Invoking an observer runs its body up to its first await, so nothing
|
|
282
245
|
// else can interleave here: any write recorded during this line came
|
|
283
246
|
// from the observers themselves. Discarding those stops an observer
|
|
284
247
|
// whose body writes its own key from rescheduling itself forever.
|
|
285
248
|
// A self-write from an observer's awaited tail is indistinguishable
|
|
286
249
|
// from an outside one, so that remains a cycle the caller must avoid.
|
|
287
|
-
const
|
|
250
|
+
const running = entries.map((entry) => entry.observer.call(entry.store.proxify(entry.observer)));
|
|
288
251
|
this._dirty.delete(key);
|
|
289
252
|
// Anything recorded from here on arrived from outside, and is honored.
|
|
290
|
-
await Promise.all(
|
|
253
|
+
await Promise.all(running);
|
|
291
254
|
}
|
|
292
255
|
finally {
|
|
293
|
-
this.
|
|
256
|
+
this._executing.delete(key);
|
|
294
257
|
// Flush any write that arrived while the observers were awaiting. In the
|
|
295
258
|
// finally block so a throwing observer still can't swallow the write.
|
|
296
259
|
if (this._dirty.delete(key))
|
|
@@ -313,8 +276,10 @@ export class SignalStore {
|
|
|
313
276
|
}
|
|
314
277
|
}
|
|
315
278
|
resolve();
|
|
316
|
-
})
|
|
279
|
+
}, debounceMillis);
|
|
317
280
|
});
|
|
281
|
+
this._pending.set(key, { done, entries });
|
|
282
|
+
return done;
|
|
318
283
|
}
|
|
319
284
|
get(key, observer) {
|
|
320
285
|
if (observer)
|
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I,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC;gBACJ,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC1B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;gBACxD,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CACP,EAA+B,EAC/B,OAAW;QAEX,2BAA2B;QAC3B,MAAM,KAAK,GAAG;YACb,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAgB;YACzB,MAAM,EAAE,IAAoB;SAC5B,CAAC;QAEF,uFAAuF;QACvF,OAAO,CAAC,OAAO,EAAE;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;aACvB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACd,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACd,KAAK,CAAC,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACb,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;QAEJ,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
|
package/docs/03_reactivity.md
CHANGED
|
@@ -181,45 +181,28 @@ $.items.length = 0;
|
|
|
181
181
|
|
|
182
182
|
## Notification Scheduling
|
|
183
183
|
|
|
184
|
-
Observers do not run on the same tick as the write.
|
|
185
|
-
|
|
184
|
+
Observers do not run on the same tick as the write. Writing a key schedules its
|
|
185
|
+
observers to run once, about 10ms later; any further writes in that window join
|
|
186
|
+
the run already scheduled instead of postponing it:
|
|
186
187
|
|
|
187
188
|
```js
|
|
188
|
-
$.view = buildView(); //
|
|
189
|
-
$.view = buildView(); // ...
|
|
189
|
+
$.view = buildView(); // Schedules the run...
|
|
190
|
+
$.view = buildView(); // ...joins it. Observers run once, with the latest value.
|
|
190
191
|
```
|
|
191
192
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
Two things follow from that. Observers see only the final value of a burst, so
|
|
194
|
+
they never run against an intermediate state. And a key written continuously
|
|
195
|
+
still notifies every ~10ms rather than being held back indefinitely, so a value
|
|
196
|
+
updated on every pointer move keeps its observers running throughout the drag.
|
|
196
197
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// Notify on the next tick instead of waiting out the debounce.
|
|
201
|
-
$.debounce("pointerX", 0);
|
|
202
|
-
|
|
203
|
-
// Or flush once per animation frame, aligned with when the browser paints.
|
|
204
|
-
// This is the right choice when the observer ends in a DOM write.
|
|
205
|
-
$.debounce("pointerX", "raf");
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Where `requestAnimationFrame` is unavailable (server-side rendering, workers),
|
|
209
|
-
`"raf"` falls back to a timer automatically. Note that browsers do not run
|
|
210
|
-
animation frames for a backgrounded tab, so a `"raf"` key stops notifying until
|
|
211
|
-
the tab is visible again; keep it for values that only matter while painting.
|
|
212
|
-
|
|
213
|
-
A continuously-written key is never starved: no matter how often it is written,
|
|
214
|
-
its observers run at least once per frame rather than having the debounce
|
|
215
|
-
deadline pushed back indefinitely.
|
|
198
|
+
Timing depends only on when a key is first written, not on how often, and is the
|
|
199
|
+
same in the browser, on the server, and in workers.
|
|
216
200
|
|
|
217
201
|
> **Note:** An observer must not write the key it observes after an `await`.
|
|
218
202
|
> Writes made by an observer's synchronous body are ignored, so the common case
|
|
219
203
|
> of incidental self-writes is safe, but a write from an observer's asynchronous
|
|
220
204
|
> tail is indistinguishable from an outside write and will re-trigger that
|
|
221
|
-
> observer in a loop.
|
|
222
|
-
> proportionally faster, so fix the cycle rather than tuning the schedule.
|
|
205
|
+
> observer in a loop.
|
|
223
206
|
|
|
224
207
|
## Computed Values
|
|
225
208
|
|