mancha 0.9.0 → 0.9.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.js +2 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/core.d.ts +0 -13
- package/dist/core.js +1 -26
- package/dist/dome.d.ts +13 -0
- package/dist/dome.js +25 -0
- package/dist/mancha.js +1 -1
- package/dist/plugins.js +1 -2
- package/package.json +1 -1
package/dist/browser.js
CHANGED
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
package/dist/core.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { ParserParams, RenderParams } from "./interfaces.js";
|
|
2
2
|
import { SignalStore } from "./store.js";
|
|
3
3
|
export type EvalListener = (result: any, dependencies: string[]) => any;
|
|
4
|
-
/**
|
|
5
|
-
* Returns the directory name from a given file path.
|
|
6
|
-
* @param fpath - The file path.
|
|
7
|
-
* @returns The directory name.
|
|
8
|
-
*/
|
|
9
|
-
export declare function dirname(fpath: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a given file path is a relative path.
|
|
12
|
-
*
|
|
13
|
-
* @param fpath - The file path to check.
|
|
14
|
-
* @returns A boolean indicating whether the file path is relative or not.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isRelativePath(fpath: string): boolean;
|
|
17
4
|
/**
|
|
18
5
|
* Creates an evaluation function based on the provided code and arguments.
|
|
19
6
|
* @param code The code to be evaluated.
|
package/dist/core.js
CHANGED
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
import { Iterator } from "./iterator.js";
|
|
2
2
|
import { RendererPlugins } from "./plugins.js";
|
|
3
|
-
import { nodeToString, traverse } from "./dome.js";
|
|
3
|
+
import { dirname, nodeToString, traverse } from "./dome.js";
|
|
4
4
|
import { SignalStore } from "./store.js";
|
|
5
|
-
/**
|
|
6
|
-
* Returns the directory name from a given file path.
|
|
7
|
-
* @param fpath - The file path.
|
|
8
|
-
* @returns The directory name.
|
|
9
|
-
*/
|
|
10
|
-
export function dirname(fpath) {
|
|
11
|
-
if (!fpath.includes("/")) {
|
|
12
|
-
return "";
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return fpath.split("/").slice(0, -1).join("/");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Checks if a given file path is a relative path.
|
|
20
|
-
*
|
|
21
|
-
* @param fpath - The file path to check.
|
|
22
|
-
* @returns A boolean indicating whether the file path is relative or not.
|
|
23
|
-
*/
|
|
24
|
-
export function isRelativePath(fpath) {
|
|
25
|
-
return (!fpath.includes("://") &&
|
|
26
|
-
!fpath.startsWith("/") &&
|
|
27
|
-
!fpath.startsWith("#") &&
|
|
28
|
-
!fpath.startsWith("data:"));
|
|
29
|
-
}
|
|
30
5
|
/**
|
|
31
6
|
* Creates an evaluation function based on the provided code and arguments.
|
|
32
7
|
* @param code The code to be evaluated.
|
package/dist/dome.d.ts
CHANGED
|
@@ -37,4 +37,17 @@ export declare function setNodeValue(node: Node | _Node, value: string | null):
|
|
|
37
37
|
export declare function createElement(tagName: string, document: Document | null): Element | _Element;
|
|
38
38
|
export declare function ellipsize(str: string | null, maxLength?: number): string;
|
|
39
39
|
export declare function nodeToString(node: Node | _Node, maxLength?: number): string;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the directory name from a given file path.
|
|
42
|
+
* @param fpath - The file path.
|
|
43
|
+
* @returns The directory name.
|
|
44
|
+
*/
|
|
45
|
+
export declare function dirname(fpath: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a given file path is a relative path.
|
|
48
|
+
*
|
|
49
|
+
* @param fpath - The file path to check.
|
|
50
|
+
* @returns A boolean indicating whether the file path is relative or not.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isRelativePath(fpath: string): boolean;
|
|
40
53
|
export {};
|
package/dist/dome.js
CHANGED
|
@@ -181,3 +181,28 @@ export function ellipsize(str, maxLength = 0) {
|
|
|
181
181
|
export function nodeToString(node, maxLength = 0) {
|
|
182
182
|
return ellipsize(node.outerHTML || getNodeValue(node) || String(node), maxLength);
|
|
183
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Returns the directory name from a given file path.
|
|
186
|
+
* @param fpath - The file path.
|
|
187
|
+
* @returns The directory name.
|
|
188
|
+
*/
|
|
189
|
+
export function dirname(fpath) {
|
|
190
|
+
if (!fpath.includes("/")) {
|
|
191
|
+
return "";
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
return fpath.split("/").slice(0, -1).join("/");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Checks if a given file path is a relative path.
|
|
199
|
+
*
|
|
200
|
+
* @param fpath - The file path to check.
|
|
201
|
+
* @returns A boolean indicating whether the file path is relative or not.
|
|
202
|
+
*/
|
|
203
|
+
export function isRelativePath(fpath) {
|
|
204
|
+
return (!fpath.includes("://") &&
|
|
205
|
+
!fpath.startsWith("/") &&
|
|
206
|
+
!fpath.startsWith("#") &&
|
|
207
|
+
!fpath.startsWith("data:"));
|
|
208
|
+
}
|
package/dist/mancha.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var t={654:(t,e,n)=>{n.d(e,{A:()=>a});var r=n(601),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([t.id,"html{max-width:70ch;padding:2em 1em;margin:auto;line-height:1.75;font-size:1.25em;font-family:sans-serif}h1,h2,h3,h4,h5,h6{margin:1em 0 .5em}ol,p,ul{margin-bottom:1em;color:#1d1d1d}",""]);const a=s},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<t.length;l++){var u=[].concat(t[l]);r&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),e.push(u))}},e}},601:t=>{t.exports=function(t){return t[1]}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,exports:{}};return t[r](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{class t{iterable;constructor(t){this.iterable=t}filter(e){return new t(t.filterGenerator(e,this.iterable))}map(e){return new t(t.mapGenerator(e,this.iterable))}find(t){for(const e of this.iterable)if(t(e))return e}array(){return Array.from(this.iterable)}*generator(){for(const t of this.iterable)yield t}static*filterGenerator(t,e){for(const n of e)t(n)&&(yield n)}static*mapGenerator(t,e){for(const n of e)yield t(n)}static equals(t,e){const n=t[Symbol.iterator](),r=e[Symbol.iterator]();let i=n.next(),o=r.next();for(;!i.done&&!o.done;){if(i.value!==o.value)return!1;i=n.next(),o=r.next()}return i.done===o.done}}var e,r;(r=e||(e={})).Root="root",r.Text="text",r.Directive="directive",r.Comment="comment",r.Script="script",r.Style="style",r.Tag="tag",r.CDATA="cdata",r.Doctype="doctype",e.Root,e.Text,e.Directive,e.Comment,e.Script,e.Style,e.Tag,e.CDATA,e.Doctype;class i{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return p(this,t)}}class o extends i{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class s extends o{constructor(){super(...arguments),this.type=e.Text}get nodeType(){return 3}}class a extends o{constructor(){super(...arguments),this.type=e.Comment}get nodeType(){return 8}}class c extends o{constructor(t,n){super(n),this.name=t,this.type=e.Directive}get nodeType(){return 1}}class l extends i{constructor(t){super(),this.children=t}get firstChild(){var t;return null!==(t=this.children[0])&&void 0!==t?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class u extends l{constructor(){super(...arguments),this.type=e.CDATA}get nodeType(){return 4}}class h extends l{constructor(){super(...arguments),this.type=e.Root}get nodeType(){return 9}}class d extends l{constructor(t,n,r=[],i=("script"===t?e.Script:"style"===t?e.Style:e.Tag)){super(r),this.name=t,this.attribs=n,this.type=i}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map((t=>{var e,n;return{name:t,value:this.attribs[t],namespace:null===(e=this["x-attribsNamespace"])||void 0===e?void 0:e[t],prefix:null===(n=this["x-attribsPrefix"])||void 0===n?void 0:n[t]}}))}}function p(t,n=!1){let r;if(function(t){return t.type===e.Text}(t))r=new s(t.data);else if(function(t){return t.type===e.Comment}(t))r=new a(t.data);else if(function(t){return(n=t).type===e.Tag||n.type===e.Script||n.type===e.Style;var n}(t)){const e=n?f(t.children):[],i=new d(t.name,{...t.attribs},e);e.forEach((t=>t.parent=i)),null!=t.namespace&&(i.namespace=t.namespace),t["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...t["x-attribsNamespace"]}),t["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...t["x-attribsPrefix"]}),r=i}else if(function(t){return t.type===e.CDATA}(t)){const e=n?f(t.children):[],i=new u(e);e.forEach((t=>t.parent=i)),r=i}else if(function(t){return t.type===e.Root}(t)){const e=n?f(t.children):[],i=new h(e);e.forEach((t=>t.parent=i)),t["x-mode"]&&(i["x-mode"]=t["x-mode"]),r=i}else{if(!function(t){return t.type===e.Directive}(t))throw new Error(`Not implemented yet: ${t.type}`);{const e=new c(t.name,t.data);null!=t["x-name"]&&(e["x-name"]=t["x-name"],e["x-publicId"]=t["x-publicId"],e["x-systemId"]=t["x-systemId"]),r=e}}return r.startIndex=t.startIndex,r.endIndex=t.endIndex,null!=t.sourceCodeLocation&&(r.sourceCodeLocation=t.sourceCodeLocation),r}function f(t){const e=t.map((t=>p(t,!0)));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}function*m(t,e=new Set){const n=new Set,r=Array.from(t.childNodes).filter((t=>!e.has(t)));for(yield t;r.length;){const t=r.shift();n.has(t)||(n.add(t),yield t),t.childNodes&&Array.from(t.childNodes).filter((t=>!e.has(t))).forEach((t=>r.push(t)))}}function $(t,e){return"function"==typeof t?.[e]}function b(t,e){return t instanceof d?t.attribs?.[e]:t.getAttribute?.(e)}function g(t,e,n){t instanceof d?t.attribs[e]=n:t.setAttribute?.(e,n)}function x(t,e){t instanceof d?delete t.attribs[e]:t.removeAttribute?.(e)}function y(t,e,n){if(t instanceof d&&e instanceof d)e.attribs[n]=t.attribs[n];else{const r=t?.getAttributeNode?.(n);e?.setAttributeNode?.(r?.cloneNode(!0))}}function v(t,...e){if($(t,"replaceWith"))return t.replaceWith(...e);{const n=t,r=n.parentNode,i=Array.from(r.childNodes).indexOf(n);e.forEach((t=>t.parentNode=r)),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,i)).concat(e).concat(Array.from(r.childNodes).slice(i+1))}}function w(t,e){return $(e,"appendChild")?t.appendChild(e):(t.childNodes.push(e),e.parentNode=t,e)}function N(t,e){if($(e,"removeChild"))return t.removeChild(e);{const n=e;return t.childNodes=t.children.filter((t=>t!==n)),n}}function A(t,e,n){return n?$(t,"insertBefore")?t.insertBefore(e,n):(v(n,e,n),e):w(t,e)}function j(t){return t instanceof i?t.data:t.nodeValue}function k(t,e=0){return t?t.length<=e?t:t.slice(0,e-1)+"…":""}function S(t,e=0){return k(t.outerHTML||j(t)||String(t),e)}window.htmlparser2;class C{timeouts=new Map;debounce(t,e){return new Promise(((n,r)=>{const i=this.timeouts.get(e);i&&clearTimeout(i),this.timeouts.set(e,setTimeout((()=>{try{n(e()),this.timeouts.delete(e)}catch(t){r(t)}}),t))}))}}class E extends C{evalkeys=["$elem","$event"];expressionCache=new Map;store=new Map;observers=new Map;_observer=null;_lock=Promise.resolve();constructor(t){super();for(let[e,n]of Object.entries(t||{}))this.set(e,n)}wrapFunction(t){return(...e)=>t.call(this.$,...e)}wrapObject(t,e){return null==t||(n=t)instanceof E||n.__is_proxy__||t.constructor!==Object&&!Array.isArray(t)?t:new Proxy(t,{deleteProperty:(t,n)=>n in t&&(delete t[n],e(),!0),set:(n,r,i,o)=>{"object"==typeof i&&null!=t&&(i=this.wrapObject(i,e));const s=Reflect.set(n,r,i,o);return e(),s},get:(t,e,n)=>"__is_proxy__"===e||Reflect.get(t,e,n)});var n}watch(t,e){this.observers.has(t)||this.observers.set(t,new Set),this.observers.get(t)?.has(e)||this.observers.get(t)?.add(e)}async notify(t,e=10){const n=Array.from(this.observers.get(t)||[]);await this.debounce(e,(()=>Promise.all(n.map((t=>t.call(this.proxify(t)))))))}get(t,e){return e&&this.watch(t,e),this.store.get(t)}async set(t,e){if(e===this.store.get(t))return;const n=()=>this.notify(t);e&&"function"==typeof e&&(e=this.wrapFunction(e)),e&&"object"==typeof e&&(e=this.wrapObject(e,n)),this.store.set(t,e),await n()}del(t){this.store.delete(t),this.observers.delete(t)}has(t){return this.store.has(t)}effect(t){return t.call(this.proxify(t))}proxify(t){const e=Array.from(this.store.entries()).map((([t])=>t)),n=Object.fromEntries(e.map((t=>[t,void 0])));return new Proxy(n,{get:(e,n,r)=>"string"==typeof n&&this.store.has(n)?this.get(n,t):"$"===n?this.proxify(t):Reflect.get(this,n,r),set:(t,e,n,r)=>("string"!=typeof e||e in this?Reflect.set(this,e,n,r):this.set(e,n),!0)})}get $(){return this.proxify()}cachedExpressionFunction(t){return this.expressionCache.has(t)||this.expressionCache.set(t,function(t,e=[]){return new Function(...e,`with (this) { return (${t}); }`)}(t,this.evalkeys)),this.expressionCache.get(t)}eval(t,e={}){const n=this._observer?this:this.$;if(this.store.has(t))return n[t];{const r=this.cachedExpressionFunction(t),i=this.evalkeys.map((t=>e[t]));if(Object.keys(e).some((t=>!this.evalkeys.includes(t))))throw new Error(`Invalid argument key, must be one of: ${this.evalkeys.join(", ")}`);return r.call(n,...i)}}}const _=new Set([":bind",":bind-events",":data",":for",":show","@watch","$html"]);var T;function M(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):""}function P(t){return!(t.includes("://")||t.startsWith("/")||t.startsWith("#")||t.startsWith("data:"))}!function(e){e.resolveIncludes=async function(t,e){const n=t;if("include"!==n.tagName?.toLocaleLowerCase())return;this.log("<include> tag found in:\n",S(t,128)),this.log("<include> params:",e);const r=b(n,"src");if(!r)throw new Error(`"src" attribute missing from ${t}.`);const i=e=>{const r=e.firstChild;for(const t of Array.from(n.attributes))r&&"src"!==t.name&&y(n,r,t.name);v(t,...e.childNodes)},o={...e,rootDocument:!1,maxdepth:e?.maxdepth-1};if(0===o.maxdepth)throw new Error("Maximum recursion depth reached.");if(r.includes("://")||r.startsWith("//"))this.log("Including remote file from absolute path:",r),await this.preprocessRemote(r,o).then(i);else if(e?.dirpath?.includes("://")||e?.dirpath?.startsWith("//")){const t=r.startsWith("/")?r:`${e.dirpath}/${r}`;this.log("Including remote file from relative path:",t),await this.preprocessRemote(t,o).then(i)}else if("/"===r.charAt(0))this.log("Including local file from absolute path:",r),await this.preprocessLocal(r,o).then(i);else{const t=e?.dirpath&&"."!==e?.dirpath?`${e?.dirpath}/${r}`:r;this.log("Including local file from relative path:",t),await this.preprocessLocal(t,o).then(i)}},e.rebaseRelativePaths=async function(t,e){const n=t,r=n.tagName?.toLowerCase();if(!e?.dirpath)return;const i=b(n,"src"),o=b(n,"href"),s=b(n,"data"),a=i||o||s;a&&(a&&P(a)&&this.log("Rebasing relative path as:",e.dirpath,"/",a),"img"===r&&i&&P(i)?g(n,"src",`${e.dirpath}/${i}`):"a"===r&&o&&P(o)||"link"===r&&o&&P(o)?g(n,"href",`${e.dirpath}/${o}`):"script"===r&&i&&P(i)||"source"===r&&i&&P(i)||"audio"===r&&i&&P(i)||"video"===r&&i&&P(i)||"track"===r&&i&&P(i)||"iframe"===r&&i&&P(i)?g(n,"src",`${e.dirpath}/${i}`):"object"===r&&s&&P(s)?g(n,"data",`${e.dirpath}/${s}`):"input"===r&&i&&P(i)?g(n,"src",`${e.dirpath}/${i}`):("area"===r&&o&&P(o)||"base"===r&&o&&P(o))&&g(n,"href",`${e.dirpath}/${o}`))},e.registerCustomElements=async function(t,e){const n=t;if("template"===n.tagName?.toLowerCase()&&b(n,"is")){const t=b(n,"is")?.toLowerCase();this._customElements.has(t)||(this.log(`Registering custom element: ${t}\n`,S(n,128)),this._customElements.set(t,n.cloneNode(!0)),N(n.parentNode,n))}},e.resolveCustomElements=async function(e,n){const r=e,i=r.tagName?.toLowerCase();if(this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,S(r,128));const n=this._customElements.get(i),o=(n.content||n).cloneNode(!0),s=function(t){return t instanceof d?t.children.find((t=>t instanceof d)):t.firstElementChild}(o);for(const t of Array.from(r.attributes))s&&y(r,s,t.name);const a=new t(m(o)).find((t=>"slot"===t.tagName?.toLowerCase()));a&&v(a,...r.childNodes),v(e,...o.childNodes)}},e.resolveTextNodeExpressions=async function(t,e){const n=j(t)||"";if(3!==t.nodeType||!n?.trim())return;this.log("Processing node content value:\n",k(n,128));const r=new RegExp(/{{ ([^}]+) }}/gm),o=Array.from(n.matchAll(r)).map((t=>t[1]));return this.effect((function(){let e=n;for(const n of o){const r=this.eval(n,{$elem:t});e=e.replace(`{{ ${n} }}`,String(r))}!function(t,e){t instanceof i?t.data=e:t.nodeValue=e}(t,e)}))},e.resolveDataAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":data");if(r){this.log(":data attribute found in:\n",S(t,128)),x(n,":data");const i=e?.rootNode===t?this:this.clone();t.renderer=i;const o=function(t,e=[]){return new Function(...e,`with (this) { return (async () => (${t}))(); }`)}(r,this.evalkeys),s=await o.call(i.$,{$elem:t});if(await Promise.all(Object.entries(s).map((([t,e])=>i.set(t,e)))),i!==this)for(const e of m(t,this._skipNodes))this._skipNodes.add(e);await i.mount(t,e)}},e.resolveWatchAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,"@watch");r&&(this.log("@watch attribute found in:\n",S(t,128)),x(n,"@watch"),await this.effect((function(){return this.eval(r,{$elem:t})})))},e.resolveTextAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,"$text");return r?(this.log("$text attribute found in:\n",S(t,128)),x(n,"$text"),this.effect((function(){!function(t,e){t instanceof d?t.children=[new s(e)]:t.textContent=e}(t,this.eval(r,{$elem:t}))}))):void 0},e.resolveHtmlAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,"$html");return r?(this.log("$html attribute found in:\n",S(t,128)),x(n,"$html"),this.effect((function(){const i=this.eval(r,{$elem:t});return new Promise((async t=>{const r=await this.preprocessString(i,e);await this.renderNode(r),function(t,...e){$(t,"replaceChildren")?t.replaceChildren(...e):(t.childNodes=e,e.forEach((e=>e.parentNode=t)))}(n,r),t()}))}))):void 0},e.resolvePropAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t;for(const e of Array.from(n.attributes||[]))if(e.name.startsWith("$")&&!_.has(e.name)){this.log(e.name,"attribute found in:\n",S(t,128)),x(n,e.name);const r=e.name.slice(1).replace(/-./g,(t=>t[1].toUpperCase()));await this.effect((function(){t[r]=this.eval(e.value,{$elem:t})}))}},e.resolveAttrAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t;for(const e of Array.from(n.attributes||[]))if(e.name.startsWith(":")&&!_.has(e.name)){this.log(e.name,"attribute found in:\n",S(t,128)),x(n,e.name);const r=e.name.slice(1);this.effect((function(){g(n,r,this.eval(e.value,{$elem:t}))}))}},e.resolveEventAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t;for(const e of Array.from(n.attributes||[]))e.name.startsWith("@")&&!_.has(e.name)&&(this.log(e.name,"attribute found in:\n",S(t,128)),x(n,e.name),t.addEventListener?.(e.name.substring(1),(n=>this.eval(e.value,{$elem:t,$event:n}))))},e.resolveForAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":for")?.trim();if(r){this.log(":for attribute found in:\n",S(t,128)),x(n,":for");for(const e of m(t,this._skipNodes))this._skipNodes.add(e);const i=t.parentNode,o=function(t,e){return e?e.createElement(t):new d(t,{})}("template",t.ownerDocument);A(i,o,t),N(i,t),w(o,t),this.log(":for template:\n",S(o,128));const s=r.split(" in ",2);if(2!==s.length)throw new Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);const a=[],[c,l]=s;await this.effect((function(){const n=this.eval(l,{$elem:t});if(this.log(":for list items:",n),a.splice(0,a.length).forEach((t=>{N(i,t),this._skipNodes.delete(t)})),!Array.isArray(n))return console.error(`Expression did not yield a list: \`${l}\` => \`${n}\``),Promise.resolve();const r=[];for(const i of n){const n=this.clone();n.set(c,i);const o=t.cloneNode(!0);a.push(o),this._skipNodes.add(o),r.push(n.mount(o,e)),this.log("Rendered list child:\n",S(o,128))}const s=o.nextSibling;for(const t of a)A(i,t,s);return Promise.all(r)}))}},e.resolveBindAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":bind");if(r){this.log(":bind attribute found in:\n",S(t,128));const e=["change","input"],i=b(n,":bind-events")?.split(",")||e;x(n,":bind"),x(n,":bind-events");const o="checkbox"===b(n,"type")?"checked":"value",s=`$elem.${o} = ${r}`;this.effect((function(){const e=this.eval(s,{$elem:t});n[o]=e}));const a=`${r} = $elem.${o}`;for(const e of i)t.addEventListener(e,(()=>this.eval(a,{$elem:t})))}},e.resolveShowAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":show");if(r){this.log(":show attribute found in:\n",S(t,128)),x(n,":show");const e="none"===n.style?.display?"":n.style?.display??b(n,"style")?.split(";")?.find((t=>"display"===t.split(":")[0]))?.split(":")?.at(1)?.trim();this.effect((function(){const i=this.eval(r,{$elem:t});n.style?n.style.display=i?e:"none":g(n,"style",`display: ${i?e:"none"};`)}))}}}(T||(T={}));class O extends E{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(t){return this.debugging=t,this}async fetchRemote(t,e){return fetch(t,{cache:e?.cache??"default"}).then((t=>t.text()))}async fetchLocal(t,e){return this.fetchRemote(t,e)}async preprocessString(t,e){this.log("Preprocessing string content with params:\n",e);const n=this.parseHTML(t,e);return await this.preprocessNode(n,e),n}async preprocessRemote(t,e){const n={};e?.cache&&(n.cache=e.cache);const r=await fetch(t,n).then((t=>t.text()));return this.preprocessString(r,{...e,dirpath:M(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}async preprocessLocal(t,e){const n=await this.fetchLocal(t,e);return this.preprocessString(n,{...e,dirpath:M(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}clone(){const t=Object.fromEntries(this.store.entries()),e=new this.constructor(t).debug(this.debugging);return e._customElements=this._customElements,Array.from(this.store.keys()).forEach((t=>this.watch(t,(()=>e.set(t,this.get(t)))))),e}log(...t){this.debugging&&console.debug(...t)}async preprocessNode(e,n){n={dirpath:this.dirpath,maxdepth:10,...n};const r=new t(m(e,this._skipNodes)).map((async t=>{this.log("Preprocessing node:\n",S(t,128)),await T.resolveIncludes.call(this,t,n),await T.rebaseRelativePaths.call(this,t,n),await T.registerCustomElements.call(this,t,n),await T.resolveCustomElements.call(this,t,n)}));return await Promise.all(r.generator()),e}async renderNode(t,e){for(const n of m(t,this._skipNodes))this.log("Rendering node:\n",S(n,128)),await T.resolveDataAttribute.call(this,n,e),await T.resolveForAttribute.call(this,n,e),await T.resolveTextAttributes.call(this,n,e),await T.resolveHtmlAttribute.call(this,n,e),await T.resolveShowAttribute.call(this,n,e),await T.resolveWatchAttribute.call(this,n,e),await T.resolveBindAttribute.call(this,n,e),await T.resolvePropAttributes.call(this,n,e),await T.resolveAttrAttributes.call(this,n,e),await T.resolveEventAttributes.call(this,n,e),await T.resolveTextNodeExpressions.call(this,n,e);return t}async mount(t,e){e={...e,rootNode:t},await this.preprocessNode(t,e),await this.renderNode(t,e),t.renderer=this}}var z=n(654);const L={sm:640,md:768,lg:1024,xl:1280},R=.25,D=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],I=[...D,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,112,128,144,160,192,224,256,288,320,384,448,512,...Object.values(L)],W=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],F=["hover","focus","disabled","focus","active"],H={margin:"m",padding:"p"},B={width:"w",height:"h"},G={top:"top",right:"right",bottom:"bottom",left:"left"},V={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},q={bold:{"font-weight":"bold"},semibold:{"font-weight":600},italic:{"font-style":"italic"},underline:{"text-decoration":"underline"},"no-underline":{"text-decoration":"none"},"decoration-none":{"text-decoration":"none"},"line-through":{"text-decoration":"line-through"},uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},"text-xs":{"font-size":".75rem"},"text-sm":{"font-size":".875rem"},"text-base":{"font-size":"1rem"},"text-lg":{"font-size":"1.125rem"},"text-xl":{"font-size":"1.25rem"},relative:{position:"relative"},fixed:{position:"fixed"},absolute:{position:"absolute"},sticky:{position:"sticky"},"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},block:{display:"block"},contents:{display:"contents"},hidden:{display:"none"},inline:{display:"inline"},"inline-block":{display:"inline-block"},visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"},"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},flex:{display:"flex"},"flex-1":{flex:"1 1 0%"},"flex-inline":{display:"inline-flex"},"flex-row":{"flex-direction":"row"},"flex-col":{"flex-direction":"column"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col-reverse":{"flex-direction":"column-reverse"},"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"},"justify-start":{"justify-content":"flex-start"},"justify-end":{"justify-content":"flex-end"},"justify-center":{"justify-content":"center"},"justify-between":{"justify-content":"space-between"},"justify-around":{"justify-content":"space-around"},"justify-evenly":{"justify-content":"space-evenly"},"justify-stretch":{"justify-content":"stretch"},"items-start":{"align-items":"flex-start"},"items-end":{"align-items":"flex-end"},"items-center":{"align-items":"center"},"items-stretch":{"align-items":"stretch"},"flex-grow":{"flex-grow":1},"flex-shrink":{"flex-shrink":1},"overflow-auto":{overflow:"auto"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-not-allowed":{cursor:"not-allowed"},"select-none":{"user-select":"none"},"select-all":{"user-select":"all"},"pointer-events-auto":{"pointer-events":"auto"},"pointer-events-none":{"pointer-events":"none"},"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"},resize:{resize:"both"},"resize-x":{resize:"horizontal"},"resize-y":{resize:"vertical"},"resize-none":{resize:"none"},border:{border:"1px solid"},"border-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"rounded-none":{"border-radius":"0"},rounded:{"border-radius":".25rem"},"rounded-sm":{"border-radius":".125rem"},"rounded-md":{"border-radius":".375rem"},"rounded-lg":{"border-radius":".5rem"},"rounded-xl":{"border-radius":".75rem"},"rounded-full":{"border-radius":"9999px"},"transition-none":{transition:"none"},transition:{transition:"all 150ms ease-in-out"},"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}},U=["@keyframes spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n }","@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n }","@keyframes pulse {\n 0%, 100% { opacity: 1 }\n 50% { opacity: .5 }\n }"],X={red:{50:16772078,100:16764370,200:15702682,300:15037299,400:15684432,500:16007990,600:15022389,700:13840175,800:12986408,900:12000284},pink:{50:16573676,100:16301008,200:16027569,300:15753874,400:15483002,500:15277667,600:14162784,700:12720219,800:11342935,900:8916559},purple:{50:15984117,100:14794471,200:13538264,300:12216520,400:11225020,500:10233776,600:9315498,700:8069026,800:6953882,900:4854924},"deep-purple":{50:15591414,100:13747433,200:11771355,300:9795021,400:8280002,500:6765239,600:6174129,700:5320104,800:4532128,900:3218322},indigo:{50:15264502,100:12962537,200:10463450,300:7964363,400:6056896,500:4149685,600:3754411,700:3162015,800:2635155,900:1713022},blue:{50:14938877,100:12312315,200:9489145,300:6600182,400:4367861,500:2201331,600:2001125,700:1668818,800:1402304,900:870305},"light-blue":{50:14808574,100:11789820,200:8508666,300:5227511,400:2733814,500:240116,600:236517,700:166097,800:161725,900:87963},cyan:{50:14743546,100:11725810,200:8445674,300:5099745,400:2541274,500:48340,600:44225,700:38823,800:33679,900:24676},teal:{50:14742257,100:11722715,200:8440772,300:5093036,400:2533018,500:38536,600:35195,700:31083,800:26972,900:19776},green:{50:15267305,100:13166281,200:10868391,300:8505220,400:6732650,500:5025616,600:4431943,700:3706428,800:3046706,900:1793568},"light-green":{50:15857897,100:14478792,200:12968357,300:11457921,400:10275941,500:9159498,600:8172354,700:6856504,800:5606191,900:3369246},lime:{50:16382951,100:15791299,200:15134364,300:14477173,400:13951319,500:13491257,600:12634675,700:11514923,800:10394916,900:8550167},yellow:{50:16776679,100:16775620,200:16774557,300:16773494,400:16772696,500:16771899,600:16635957,700:16498733,800:16361509,900:16088855},amber:{50:16775393,100:16772275,200:16769154,300:16766287,400:16763432,500:16761095,600:16757504,700:16752640,800:16748288,900:16740096},orange:{50:16774112,100:16769202,200:16764032,300:16758605,400:16754470,500:16750592,600:16485376,700:16088064,800:15690752,900:15094016},"deep-orange":{50:16509415,100:16764092,200:16755601,300:16747109,400:16740419,500:16733986,600:16011550,700:15092249,800:14172949,900:12531212},brown:{50:15723497,100:14142664,200:12364452,300:10586239,400:9268835,500:7951688,600:7162945,700:6111287,800:5125166,900:4073251},gray:{50:16448250,100:16119285,200:15658734,300:14737632,400:12434877,500:10395294,600:7697781,700:6381921,800:4342338,900:2171169},"blue-gray":{50:15527921,100:13621468,200:11583173,300:9479342,400:7901340,500:6323595,600:5533306,700:4545124,800:3622735,900:2503224}};function J(t){return F.map((e=>`.${e}\\:${t}:${e}`))}function K(t,e){return Object.entries(L).map((([n,r])=>`@media (min-width: ${r}px) { .${n}\\:${t} { ${e} } }`))}function Q(t,e){return t.includes("@media")&&!e.includes("@media")?1:!t.includes("@media")&&e.includes("@media")?-1:t.localeCompare(e)}function Y(t){return Object.entries(t).flatMap((([t,e])=>[[`${e}-0`,`${t}: 0`],[`${e}-screen`,`${t}: 100vw`],[`${e}-full`,`${t}: 100%`],...I.map((n=>[`${e}-${n}`,`${t}: ${n*R}rem`])),...I.map((n=>[`-${e}-${n}`,`${t}: -${n*R}rem`])),...I.map((n=>[`${e}-${n}px`,`${t}: ${n}px`])),...I.map((n=>[`-${e}-${n}px`,`${t}: -${n}px`])),...W.map((n=>[`${e}-${n}\\%`,`${t}: ${n}%`])),...W.map((n=>[`-${e}-${n}\\%`,` ${t}: -${n}%`]))])).flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))}function Z(t){return Object.entries(t).flatMap((([t,e])=>[`.${e}-auto { ${t}: auto; }`,`.${e}x-auto { ${t}-left: auto; ${t}-right: auto; }`,`.${e}y-auto { ${t}-top: auto; ${t}-bottom: auto; }`,`.${e}x-0 { ${t}-left: 0; ${t}-right: 0; }`,`.${e}y-0 { ${t}-top: 0; ${t}-bottom: 0; }`,...I.map((t=>[t,t*R])).map((([n,r])=>`.${e}x-${n} { ${t}-left: ${r}rem; ${t}-right: ${r}rem; }`)),...I.map((t=>[t,t*R])).map((([n,r])=>`.${e}y-${n} { ${t}-top: ${r}rem; ${t}-bottom: ${r}rem; }`)),...I.map((n=>`.${e}x-${n}px { ${t}-left: ${n}px; ${t}-right: ${n}px; }`)),...I.map((n=>`.${e}y-${n}px { ${t}-top: ${n}px; ${t}-bottom: ${n}px; }`)),...W.map((n=>`.${e}x-${n}\\% { ${t}-left: ${n}%; ${t}-right: ${n}%; }`)),...W.map((n=>`.${e}y-${n}\\% { ${t}-top: ${n}%; ${t}-bottom: ${n}%; }`))]))}function tt(){const t=[["white","#fff"],["black","#000"],["transparent","transparent"]].flatMap((([t,e])=>[[`text-${t}`,`color: ${e}`],[`fill-${t}`,`fill: ${e}`],[`bg-${t}`,`background-color: ${e}`],[`border-${t}`,`border-color: ${e}`]])),e=Object.entries(X).flatMap((([t,e])=>[[`text-${t}`,`color: #${e[500].toString(16)}`],[`fill-${t}`,`fill: #${e[500].toString(16)}`],[`bg-${t}`,`background-color: #${e[500].toString(16)}`],[`border-${t}`,`border-color: #${e[500].toString(16)}`]])),n=Object.entries(X).flatMap((([t,e])=>Object.entries(e).flatMap((([e,n])=>[[`text-${t}-${e}`,`color: #${n.toString(16)}`],[`fill-${t}-${e}`,`fill: #${n.toString(16)}`],[`bg-${t}-${e}`,`background-color: #${n.toString(16)}`],[`border-${t}-${e}`,`border-color: #${n.toString(16)}`]]))));return[].concat(t).concat(e).concat(n).flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))}const et=new class extends O{dirpath=M(self.location.href);parseHTML(t,e={rootDocument:!1}){if(e.rootDocument)return(new DOMParser).parseFromString(t,"text/html");{const e=document.createRange();return e.selectNodeContents(document.body),e.createContextualFragment(t)}}serializeHTML(t){return(new XMLSerializer).serializeToString(t).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(t,e){return this.preprocessRemote(t,e)}};self.Mancha=et;const nt=self.document?.currentScript;if(self.document?.currentScript?.hasAttribute("init")){const t=nt?.hasAttribute("debug"),e=nt?.getAttribute("cache"),n=nt?.getAttribute("target")?.split("+")||["body"];window.addEventListener("load",(()=>{n.map((async n=>{const r=self.document.querySelector(n);await et.debug(t).mount(r,{cache:e})}))}))}if(self.document?.currentScript?.hasAttribute("css")){const t=nt?.getAttribute("css")?.split("+");for(const e of t){const t=document.createElement("style");switch(e){case"basic":t.textContent=z.A;break;case"utils":t.textContent=(void 0,[...U,...Object.entries(q).flatMap((([t,e])=>Object.entries(e).flatMap((([e,n])=>[`.${t} { ${e}: ${n} }`,`${J(t).join(",")} { ${e}: ${n} }`,...K(t,`${e}: ${n}`)])))),...tt(),...[["opacity-0","opacity: 0"],...W.map((t=>[`opacity-${t}`,"opacity: "+t/100]))].flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)])),...Y(B),...Z(B),...Y(G),...Z(G),...(rt=H,Object.entries(rt).flatMap((([t,e])=>[[`${e}t-0`,`${t}-top: 0`],[`${e}b-0`,`${t}-bottom: 0`],[`${e}l-0`,`${t}-left: 0`],[`${e}r-0`,`${t}-right: 0`],[`${e}t-auto`,`${t}-top: auto`],[`${e}b-auto`,`${t}-bottom: auto`],[`${e}l-auto`,`${t}-left: auto`],[`${e}r-auto`,`${t}-right: auto`],...["","-"].flatMap((n=>[...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}t-${r}`,`${t}-top: ${n}${i}rem`])),...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}b-${r}`,`${t}-bottom: ${n}${i}rem`])),...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}l-${r}`,`${t}-left: ${n}${i}rem`])),...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}r-${r}`,`${t}-right: ${n}${i}rem`])),...I.map((r=>[`${n}${e}t-${r}px`,`${t}-top: ${n}${r}px`])),...I.map((r=>[`${n}${e}b-${r}px`,`${t}-bottom: ${n}${r}px`])),...I.map((r=>[`${n}${e}l-${r}px`,`${t}-left: ${n}${r}px`])),...I.map((r=>[`${n}${e}r-${r}px`,`${t}-right: ${n}${r}px`])),...W.map((r=>[`${n}${e}t-${r}\\%`,`${t}-top: ${n}${r}%`])),...W.map((r=>[`${n}${e}b-${r}\\%`,`${t}-bottom: ${n}${r}%;`])),...W.map((r=>[`${n}${e}l-${r}\\%`,`${t}-left: ${n}${r}%`])),...W.map((r=>[`${n}${e}r-${r}\\%`,`${t}-right: ${n}${r}%`]))]))])).flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))),...Y(H),...Z(H),".space-x-0 > * { margin-left: 0 }",".space-y-0 > * { margin-top: 0 }",...I.map((t=>`.space-x-${t} > :not(:first-child) { margin-left: ${t*R}rem }`)),...I.map((t=>`.space-y-${t} > :not(:first-child) { margin-top: ${t*R}rem }`)),...I.map((t=>`.space-x-${t}px > :not(:first-child) { margin-left: ${t}px }`)),...I.map((t=>`.space-y-${t}px > :not(:first-child) { margin-top: ${t}px }`)),".gap-0 { gap: 0 }",...I.map((t=>`.gap-${t} { gap: ${t*R}rem }`)),...I.map((t=>`.gap-${t}px { gap: ${t}px }`)),...I.map((t=>`.gap-x-${t} { column-gap: ${t*R}rem }`)),...I.map((t=>`.gap-y-${t} { row-gap: ${t*R}rem }`)),...I.map((t=>`.gap-x-${t}px { column-gap: ${t}px }`)),...I.map((t=>`.gap-y-${t}px { row-gap: ${t}px }`)),...Y(V),...[...D.map((t=>[`border-${t}`,`border-width: ${t}px`]))].flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))].sort(Q).join("\n"));break;default:console.error(`Unknown style name: "${e}"`)}self.document.head.appendChild(t)}}var rt})()})();
|
|
1
|
+
(()=>{"use strict";var t={654:(t,e,n)=>{n.d(e,{A:()=>a});var r=n(601),i=n.n(r),o=n(314),s=n.n(o)()(i());s.push([t.id,"html{max-width:70ch;padding:2em 1em;margin:auto;line-height:1.75;font-size:1.25em;font-family:sans-serif}h1,h2,h3,h4,h5,h6{margin:1em 0 .5em}ol,p,ul{margin-bottom:1em;color:#1d1d1d}",""]);const a=s},314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,i,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(s[c]=!0)}for(var l=0;l<t.length;l++){var u=[].concat(t[l]);r&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),e.push(u))}},e}},601:t=>{t.exports=function(t){return t[1]}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,exports:{}};return t[r](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{class t{iterable;constructor(t){this.iterable=t}filter(e){return new t(t.filterGenerator(e,this.iterable))}map(e){return new t(t.mapGenerator(e,this.iterable))}find(t){for(const e of this.iterable)if(t(e))return e}array(){return Array.from(this.iterable)}*generator(){for(const t of this.iterable)yield t}static*filterGenerator(t,e){for(const n of e)t(n)&&(yield n)}static*mapGenerator(t,e){for(const n of e)yield t(n)}static equals(t,e){const n=t[Symbol.iterator](),r=e[Symbol.iterator]();let i=n.next(),o=r.next();for(;!i.done&&!o.done;){if(i.value!==o.value)return!1;i=n.next(),o=r.next()}return i.done===o.done}}var e,r;(r=e||(e={})).Root="root",r.Text="text",r.Directive="directive",r.Comment="comment",r.Script="script",r.Style="style",r.Tag="tag",r.CDATA="cdata",r.Doctype="doctype",e.Root,e.Text,e.Directive,e.Comment,e.Script,e.Style,e.Tag,e.CDATA,e.Doctype;class i{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return p(this,t)}}class o extends i{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class s extends o{constructor(){super(...arguments),this.type=e.Text}get nodeType(){return 3}}class a extends o{constructor(){super(...arguments),this.type=e.Comment}get nodeType(){return 8}}class c extends o{constructor(t,n){super(n),this.name=t,this.type=e.Directive}get nodeType(){return 1}}class l extends i{constructor(t){super(),this.children=t}get firstChild(){var t;return null!==(t=this.children[0])&&void 0!==t?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class u extends l{constructor(){super(...arguments),this.type=e.CDATA}get nodeType(){return 4}}class h extends l{constructor(){super(...arguments),this.type=e.Root}get nodeType(){return 9}}class d extends l{constructor(t,n,r=[],i=("script"===t?e.Script:"style"===t?e.Style:e.Tag)){super(r),this.name=t,this.attribs=n,this.type=i}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map((t=>{var e,n;return{name:t,value:this.attribs[t],namespace:null===(e=this["x-attribsNamespace"])||void 0===e?void 0:e[t],prefix:null===(n=this["x-attribsPrefix"])||void 0===n?void 0:n[t]}}))}}function p(t,n=!1){let r;if(function(t){return t.type===e.Text}(t))r=new s(t.data);else if(function(t){return t.type===e.Comment}(t))r=new a(t.data);else if(function(t){return(n=t).type===e.Tag||n.type===e.Script||n.type===e.Style;var n}(t)){const e=n?f(t.children):[],i=new d(t.name,{...t.attribs},e);e.forEach((t=>t.parent=i)),null!=t.namespace&&(i.namespace=t.namespace),t["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...t["x-attribsNamespace"]}),t["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...t["x-attribsPrefix"]}),r=i}else if(function(t){return t.type===e.CDATA}(t)){const e=n?f(t.children):[],i=new u(e);e.forEach((t=>t.parent=i)),r=i}else if(function(t){return t.type===e.Root}(t)){const e=n?f(t.children):[],i=new h(e);e.forEach((t=>t.parent=i)),t["x-mode"]&&(i["x-mode"]=t["x-mode"]),r=i}else{if(!function(t){return t.type===e.Directive}(t))throw new Error(`Not implemented yet: ${t.type}`);{const e=new c(t.name,t.data);null!=t["x-name"]&&(e["x-name"]=t["x-name"],e["x-publicId"]=t["x-publicId"],e["x-systemId"]=t["x-systemId"]),r=e}}return r.startIndex=t.startIndex,r.endIndex=t.endIndex,null!=t.sourceCodeLocation&&(r.sourceCodeLocation=t.sourceCodeLocation),r}function f(t){const e=t.map((t=>p(t,!0)));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}function*m(t,e=new Set){const n=new Set,r=Array.from(t.childNodes).filter((t=>!e.has(t)));for(yield t;r.length;){const t=r.shift();n.has(t)||(n.add(t),yield t),t.childNodes&&Array.from(t.childNodes).filter((t=>!e.has(t))).forEach((t=>r.push(t)))}}function $(t,e){return"function"==typeof t?.[e]}function b(t,e){return t instanceof d?t.attribs?.[e]:t.getAttribute?.(e)}function g(t,e,n){t instanceof d?t.attribs[e]=n:t.setAttribute?.(e,n)}function x(t,e){t instanceof d?delete t.attribs[e]:t.removeAttribute?.(e)}function y(t,e,n){if(t instanceof d&&e instanceof d)e.attribs[n]=t.attribs[n];else{const r=t?.getAttributeNode?.(n);e?.setAttributeNode?.(r?.cloneNode(!0))}}function v(t,...e){if($(t,"replaceWith"))return t.replaceWith(...e);{const n=t,r=n.parentNode,i=Array.from(r.childNodes).indexOf(n);e.forEach((t=>t.parentNode=r)),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,i)).concat(e).concat(Array.from(r.childNodes).slice(i+1))}}function w(t,e){return $(e,"appendChild")?t.appendChild(e):(t.childNodes.push(e),e.parentNode=t,e)}function N(t,e){if($(e,"removeChild"))return t.removeChild(e);{const n=e;return t.childNodes=t.children.filter((t=>t!==n)),n}}function A(t,e,n){return n?$(t,"insertBefore")?t.insertBefore(e,n):(v(n,e,n),e):w(t,e)}function j(t){return t instanceof i?t.data:t.nodeValue}function k(t,e=0){return t?t.length<=e?t:t.slice(0,e-1)+"…":""}function S(t,e=0){return k(t.outerHTML||j(t)||String(t),e)}function C(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):""}function E(t){return!(t.includes("://")||t.startsWith("/")||t.startsWith("#")||t.startsWith("data:"))}window.htmlparser2;class _{timeouts=new Map;debounce(t,e){return new Promise(((n,r)=>{const i=this.timeouts.get(e);i&&clearTimeout(i),this.timeouts.set(e,setTimeout((()=>{try{n(e()),this.timeouts.delete(e)}catch(t){r(t)}}),t))}))}}class T extends _{evalkeys=["$elem","$event"];expressionCache=new Map;store=new Map;observers=new Map;_observer=null;_lock=Promise.resolve();constructor(t){super();for(let[e,n]of Object.entries(t||{}))this.set(e,n)}wrapFunction(t){return(...e)=>t.call(this.$,...e)}wrapObject(t,e){return null==t||(n=t)instanceof T||n.__is_proxy__||t.constructor!==Object&&!Array.isArray(t)?t:new Proxy(t,{deleteProperty:(t,n)=>n in t&&(delete t[n],e(),!0),set:(n,r,i,o)=>{"object"==typeof i&&null!=t&&(i=this.wrapObject(i,e));const s=Reflect.set(n,r,i,o);return e(),s},get:(t,e,n)=>"__is_proxy__"===e||Reflect.get(t,e,n)});var n}watch(t,e){this.observers.has(t)||this.observers.set(t,new Set),this.observers.get(t)?.has(e)||this.observers.get(t)?.add(e)}async notify(t,e=10){const n=Array.from(this.observers.get(t)||[]);await this.debounce(e,(()=>Promise.all(n.map((t=>t.call(this.proxify(t)))))))}get(t,e){return e&&this.watch(t,e),this.store.get(t)}async set(t,e){if(e===this.store.get(t))return;const n=()=>this.notify(t);e&&"function"==typeof e&&(e=this.wrapFunction(e)),e&&"object"==typeof e&&(e=this.wrapObject(e,n)),this.store.set(t,e),await n()}del(t){this.store.delete(t),this.observers.delete(t)}has(t){return this.store.has(t)}effect(t){return t.call(this.proxify(t))}proxify(t){const e=Array.from(this.store.entries()).map((([t])=>t)),n=Object.fromEntries(e.map((t=>[t,void 0])));return new Proxy(n,{get:(e,n,r)=>"string"==typeof n&&this.store.has(n)?this.get(n,t):"$"===n?this.proxify(t):Reflect.get(this,n,r),set:(t,e,n,r)=>("string"!=typeof e||e in this?Reflect.set(this,e,n,r):this.set(e,n),!0)})}get $(){return this.proxify()}cachedExpressionFunction(t){return this.expressionCache.has(t)||this.expressionCache.set(t,function(t,e=[]){return new Function(...e,`with (this) { return (${t}); }`)}(t,this.evalkeys)),this.expressionCache.get(t)}eval(t,e={}){const n=this._observer?this:this.$;if(this.store.has(t))return n[t];{const r=this.cachedExpressionFunction(t),i=this.evalkeys.map((t=>e[t]));if(Object.keys(e).some((t=>!this.evalkeys.includes(t))))throw new Error(`Invalid argument key, must be one of: ${this.evalkeys.join(", ")}`);return r.call(n,...i)}}}const M=new Set([":bind",":bind-events",":data",":for",":show","@watch","$html"]);var P;!function(e){e.resolveIncludes=async function(t,e){const n=t;if("include"!==n.tagName?.toLocaleLowerCase())return;this.log("<include> tag found in:\n",S(t,128)),this.log("<include> params:",e);const r=b(n,"src");if(!r)throw new Error(`"src" attribute missing from ${t}.`);const i=e=>{const r=e.firstChild;for(const t of Array.from(n.attributes))r&&"src"!==t.name&&y(n,r,t.name);v(t,...e.childNodes)},o={...e,rootDocument:!1,maxdepth:e?.maxdepth-1};if(0===o.maxdepth)throw new Error("Maximum recursion depth reached.");if(r.includes("://")||r.startsWith("//"))this.log("Including remote file from absolute path:",r),await this.preprocessRemote(r,o).then(i);else if(e?.dirpath?.includes("://")||e?.dirpath?.startsWith("//")){const t=r.startsWith("/")?r:`${e.dirpath}/${r}`;this.log("Including remote file from relative path:",t),await this.preprocessRemote(t,o).then(i)}else if("/"===r.charAt(0))this.log("Including local file from absolute path:",r),await this.preprocessLocal(r,o).then(i);else{const t=e?.dirpath&&"."!==e?.dirpath?`${e?.dirpath}/${r}`:r;this.log("Including local file from relative path:",t),await this.preprocessLocal(t,o).then(i)}},e.rebaseRelativePaths=async function(t,e){const n=t,r=n.tagName?.toLowerCase();if(!e?.dirpath)return;const i=b(n,"src"),o=b(n,"href"),s=b(n,"data"),a=i||o||s;a&&(a&&E(a)&&this.log("Rebasing relative path as:",e.dirpath,"/",a),"img"===r&&i&&E(i)?g(n,"src",`${e.dirpath}/${i}`):"a"===r&&o&&E(o)||"link"===r&&o&&E(o)?g(n,"href",`${e.dirpath}/${o}`):"script"===r&&i&&E(i)||"source"===r&&i&&E(i)||"audio"===r&&i&&E(i)||"video"===r&&i&&E(i)||"track"===r&&i&&E(i)||"iframe"===r&&i&&E(i)?g(n,"src",`${e.dirpath}/${i}`):"object"===r&&s&&E(s)?g(n,"data",`${e.dirpath}/${s}`):"input"===r&&i&&E(i)?g(n,"src",`${e.dirpath}/${i}`):("area"===r&&o&&E(o)||"base"===r&&o&&E(o))&&g(n,"href",`${e.dirpath}/${o}`))},e.registerCustomElements=async function(t,e){const n=t;if("template"===n.tagName?.toLowerCase()&&b(n,"is")){const t=b(n,"is")?.toLowerCase();this._customElements.has(t)||(this.log(`Registering custom element: ${t}\n`,S(n,128)),this._customElements.set(t,n.cloneNode(!0)),N(n.parentNode,n))}},e.resolveCustomElements=async function(e,n){const r=e,i=r.tagName?.toLowerCase();if(this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,S(r,128));const n=this._customElements.get(i),o=(n.content||n).cloneNode(!0),s=function(t){return t instanceof d?t.children.find((t=>t instanceof d)):t.firstElementChild}(o);for(const t of Array.from(r.attributes))s&&y(r,s,t.name);const a=new t(m(o)).find((t=>"slot"===t.tagName?.toLowerCase()));a&&v(a,...r.childNodes),v(e,...o.childNodes)}},e.resolveTextNodeExpressions=async function(t,e){const n=j(t)||"";if(3!==t.nodeType||!n?.trim())return;this.log("Processing node content value:\n",k(n,128));const r=new RegExp(/{{ ([^}]+) }}/gm),o=Array.from(n.matchAll(r)).map((t=>t[1]));return this.effect((function(){let e=n;for(const n of o){const r=this.eval(n,{$elem:t});e=e.replace(`{{ ${n} }}`,String(r))}!function(t,e){t instanceof i?t.data=e:t.nodeValue=e}(t,e)}))},e.resolveDataAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":data");if(r){this.log(":data attribute found in:\n",S(t,128)),x(n,":data");const i=e?.rootNode===t?this:this.clone();t.renderer=i;const o=function(t,e=[]){return new Function(...e,`with (this) { return (async () => (${t}))(); }`)}(r,this.evalkeys),s=await o.call(i.$,{$elem:t});if(await Promise.all(Object.entries(s).map((([t,e])=>i.set(t,e)))),i!==this)for(const e of m(t,this._skipNodes))this._skipNodes.add(e);await i.mount(t,e)}},e.resolveWatchAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,"@watch");r&&(this.log("@watch attribute found in:\n",S(t,128)),x(n,"@watch"),await this.effect((function(){return this.eval(r,{$elem:t})})))},e.resolveTextAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,"$text");return r?(this.log("$text attribute found in:\n",S(t,128)),x(n,"$text"),this.effect((function(){!function(t,e){t instanceof d?t.children=[new s(e)]:t.textContent=e}(t,this.eval(r,{$elem:t}))}))):void 0},e.resolveHtmlAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,"$html");return r?(this.log("$html attribute found in:\n",S(t,128)),x(n,"$html"),this.effect((function(){const i=this.eval(r,{$elem:t});return new Promise((async t=>{const r=await this.preprocessString(i,e);await this.renderNode(r),function(t,...e){$(t,"replaceChildren")?t.replaceChildren(...e):(t.childNodes=e,e.forEach((e=>e.parentNode=t)))}(n,r),t()}))}))):void 0},e.resolvePropAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t;for(const e of Array.from(n.attributes||[]))if(e.name.startsWith("$")&&!M.has(e.name)){this.log(e.name,"attribute found in:\n",S(t,128)),x(n,e.name);const r=e.name.slice(1).replace(/-./g,(t=>t[1].toUpperCase()));await this.effect((function(){t[r]=this.eval(e.value,{$elem:t})}))}},e.resolveAttrAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t;for(const e of Array.from(n.attributes||[]))if(e.name.startsWith(":")&&!M.has(e.name)){this.log(e.name,"attribute found in:\n",S(t,128)),x(n,e.name);const r=e.name.slice(1);this.effect((function(){g(n,r,this.eval(e.value,{$elem:t}))}))}},e.resolveEventAttributes=async function(t,e){if(this._skipNodes.has(t))return;const n=t;for(const e of Array.from(n.attributes||[]))e.name.startsWith("@")&&!M.has(e.name)&&(this.log(e.name,"attribute found in:\n",S(t,128)),x(n,e.name),t.addEventListener?.(e.name.substring(1),(n=>this.eval(e.value,{$elem:t,$event:n}))))},e.resolveForAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":for")?.trim();if(r){this.log(":for attribute found in:\n",S(t,128)),x(n,":for");for(const e of m(t,this._skipNodes))this._skipNodes.add(e);const i=t.parentNode,o=function(t,e){return e?e.createElement(t):new d(t,{})}("template",t.ownerDocument);A(i,o,t),N(i,t),w(o,t),this.log(":for template:\n",S(o,128));const s=r.split(" in ",2);if(2!==s.length)throw new Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);const a=[],[c,l]=s;await this.effect((function(){const n=this.eval(l,{$elem:t});if(this.log(":for list items:",n),a.splice(0,a.length).forEach((t=>{N(i,t),this._skipNodes.delete(t)})),!Array.isArray(n))return console.error(`Expression did not yield a list: \`${l}\` => \`${n}\``),Promise.resolve();const r=[];for(const i of n){const n=this.clone();n.set(c,i);const o=t.cloneNode(!0);a.push(o),this._skipNodes.add(o),r.push(n.mount(o,e)),this.log("Rendered list child:\n",S(o,128))}const s=o.nextSibling;for(const t of a)A(i,t,s);return Promise.all(r)}))}},e.resolveBindAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":bind");if(r){this.log(":bind attribute found in:\n",S(t,128));const e=["change","input"],i=b(n,":bind-events")?.split(",")||e;x(n,":bind"),x(n,":bind-events");const o="checkbox"===b(n,"type")?"checked":"value",s=`$elem.${o} = ${r}`;this.effect((function(){const e=this.eval(s,{$elem:t});n[o]=e}));const a=`${r} = $elem.${o}`;for(const e of i)t.addEventListener(e,(()=>this.eval(a,{$elem:t})))}},e.resolveShowAttribute=async function(t,e){if(this._skipNodes.has(t))return;const n=t,r=b(n,":show");if(r){this.log(":show attribute found in:\n",S(t,128)),x(n,":show");const e="none"===n.style?.display?"":n.style?.display??b(n,"style")?.split(";")?.find((t=>"display"===t.split(":")[0]))?.split(":")?.at(1)?.trim();this.effect((function(){const i=this.eval(r,{$elem:t});n.style?n.style.display=i?e:"none":g(n,"style",`display: ${i?e:"none"};`)}))}}}(P||(P={}));class O extends T{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(t){return this.debugging=t,this}async fetchRemote(t,e){return fetch(t,{cache:e?.cache??"default"}).then((t=>t.text()))}async fetchLocal(t,e){return this.fetchRemote(t,e)}async preprocessString(t,e){this.log("Preprocessing string content with params:\n",e);const n=this.parseHTML(t,e);return await this.preprocessNode(n,e),n}async preprocessRemote(t,e){const n={};e?.cache&&(n.cache=e.cache);const r=await fetch(t,n).then((t=>t.text()));return this.preprocessString(r,{...e,dirpath:C(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}async preprocessLocal(t,e){const n=await this.fetchLocal(t,e);return this.preprocessString(n,{...e,dirpath:C(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}clone(){const t=Object.fromEntries(this.store.entries()),e=new this.constructor(t).debug(this.debugging);return e._customElements=this._customElements,Array.from(this.store.keys()).forEach((t=>this.watch(t,(()=>e.set(t,this.get(t)))))),e}log(...t){this.debugging&&console.debug(...t)}async preprocessNode(e,n){n={dirpath:this.dirpath,maxdepth:10,...n};const r=new t(m(e,this._skipNodes)).map((async t=>{this.log("Preprocessing node:\n",S(t,128)),await P.resolveIncludes.call(this,t,n),await P.rebaseRelativePaths.call(this,t,n),await P.registerCustomElements.call(this,t,n),await P.resolveCustomElements.call(this,t,n)}));return await Promise.all(r.generator()),e}async renderNode(t,e){for(const n of m(t,this._skipNodes))this.log("Rendering node:\n",S(n,128)),await P.resolveDataAttribute.call(this,n,e),await P.resolveForAttribute.call(this,n,e),await P.resolveTextAttributes.call(this,n,e),await P.resolveHtmlAttribute.call(this,n,e),await P.resolveShowAttribute.call(this,n,e),await P.resolveWatchAttribute.call(this,n,e),await P.resolveBindAttribute.call(this,n,e),await P.resolvePropAttributes.call(this,n,e),await P.resolveAttrAttributes.call(this,n,e),await P.resolveEventAttributes.call(this,n,e),await P.resolveTextNodeExpressions.call(this,n,e);return t}async mount(t,e){e={...e,rootNode:t},await this.preprocessNode(t,e),await this.renderNode(t,e),t.renderer=this}}var z=n(654);const L={sm:640,md:768,lg:1024,xl:1280},R=.25,D=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],I=[...D,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,112,128,144,160,192,224,256,288,320,384,448,512,...Object.values(L)],W=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],F=["hover","focus","disabled","focus","active"],H={margin:"m",padding:"p"},B={width:"w",height:"h"},G={top:"top",right:"right",bottom:"bottom",left:"left"},V={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},q={bold:{"font-weight":"bold"},semibold:{"font-weight":600},italic:{"font-style":"italic"},underline:{"text-decoration":"underline"},"no-underline":{"text-decoration":"none"},"decoration-none":{"text-decoration":"none"},"line-through":{"text-decoration":"line-through"},uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},"text-xs":{"font-size":".75rem"},"text-sm":{"font-size":".875rem"},"text-base":{"font-size":"1rem"},"text-lg":{"font-size":"1.125rem"},"text-xl":{"font-size":"1.25rem"},relative:{position:"relative"},fixed:{position:"fixed"},absolute:{position:"absolute"},sticky:{position:"sticky"},"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},block:{display:"block"},contents:{display:"contents"},hidden:{display:"none"},inline:{display:"inline"},"inline-block":{display:"inline-block"},visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"},"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},flex:{display:"flex"},"flex-1":{flex:"1 1 0%"},"flex-inline":{display:"inline-flex"},"flex-row":{"flex-direction":"row"},"flex-col":{"flex-direction":"column"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col-reverse":{"flex-direction":"column-reverse"},"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"},"justify-start":{"justify-content":"flex-start"},"justify-end":{"justify-content":"flex-end"},"justify-center":{"justify-content":"center"},"justify-between":{"justify-content":"space-between"},"justify-around":{"justify-content":"space-around"},"justify-evenly":{"justify-content":"space-evenly"},"justify-stretch":{"justify-content":"stretch"},"items-start":{"align-items":"flex-start"},"items-end":{"align-items":"flex-end"},"items-center":{"align-items":"center"},"items-stretch":{"align-items":"stretch"},"flex-grow":{"flex-grow":1},"flex-shrink":{"flex-shrink":1},"overflow-auto":{overflow:"auto"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-not-allowed":{cursor:"not-allowed"},"select-none":{"user-select":"none"},"select-all":{"user-select":"all"},"pointer-events-auto":{"pointer-events":"auto"},"pointer-events-none":{"pointer-events":"none"},"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"},resize:{resize:"both"},"resize-x":{resize:"horizontal"},"resize-y":{resize:"vertical"},"resize-none":{resize:"none"},border:{border:"1px solid"},"border-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"rounded-none":{"border-radius":"0"},rounded:{"border-radius":".25rem"},"rounded-sm":{"border-radius":".125rem"},"rounded-md":{"border-radius":".375rem"},"rounded-lg":{"border-radius":".5rem"},"rounded-xl":{"border-radius":".75rem"},"rounded-full":{"border-radius":"9999px"},"transition-none":{transition:"none"},transition:{transition:"all 150ms ease-in-out"},"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}},U=["@keyframes spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n }","@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n }","@keyframes pulse {\n 0%, 100% { opacity: 1 }\n 50% { opacity: .5 }\n }"],X={red:{50:16772078,100:16764370,200:15702682,300:15037299,400:15684432,500:16007990,600:15022389,700:13840175,800:12986408,900:12000284},pink:{50:16573676,100:16301008,200:16027569,300:15753874,400:15483002,500:15277667,600:14162784,700:12720219,800:11342935,900:8916559},purple:{50:15984117,100:14794471,200:13538264,300:12216520,400:11225020,500:10233776,600:9315498,700:8069026,800:6953882,900:4854924},"deep-purple":{50:15591414,100:13747433,200:11771355,300:9795021,400:8280002,500:6765239,600:6174129,700:5320104,800:4532128,900:3218322},indigo:{50:15264502,100:12962537,200:10463450,300:7964363,400:6056896,500:4149685,600:3754411,700:3162015,800:2635155,900:1713022},blue:{50:14938877,100:12312315,200:9489145,300:6600182,400:4367861,500:2201331,600:2001125,700:1668818,800:1402304,900:870305},"light-blue":{50:14808574,100:11789820,200:8508666,300:5227511,400:2733814,500:240116,600:236517,700:166097,800:161725,900:87963},cyan:{50:14743546,100:11725810,200:8445674,300:5099745,400:2541274,500:48340,600:44225,700:38823,800:33679,900:24676},teal:{50:14742257,100:11722715,200:8440772,300:5093036,400:2533018,500:38536,600:35195,700:31083,800:26972,900:19776},green:{50:15267305,100:13166281,200:10868391,300:8505220,400:6732650,500:5025616,600:4431943,700:3706428,800:3046706,900:1793568},"light-green":{50:15857897,100:14478792,200:12968357,300:11457921,400:10275941,500:9159498,600:8172354,700:6856504,800:5606191,900:3369246},lime:{50:16382951,100:15791299,200:15134364,300:14477173,400:13951319,500:13491257,600:12634675,700:11514923,800:10394916,900:8550167},yellow:{50:16776679,100:16775620,200:16774557,300:16773494,400:16772696,500:16771899,600:16635957,700:16498733,800:16361509,900:16088855},amber:{50:16775393,100:16772275,200:16769154,300:16766287,400:16763432,500:16761095,600:16757504,700:16752640,800:16748288,900:16740096},orange:{50:16774112,100:16769202,200:16764032,300:16758605,400:16754470,500:16750592,600:16485376,700:16088064,800:15690752,900:15094016},"deep-orange":{50:16509415,100:16764092,200:16755601,300:16747109,400:16740419,500:16733986,600:16011550,700:15092249,800:14172949,900:12531212},brown:{50:15723497,100:14142664,200:12364452,300:10586239,400:9268835,500:7951688,600:7162945,700:6111287,800:5125166,900:4073251},gray:{50:16448250,100:16119285,200:15658734,300:14737632,400:12434877,500:10395294,600:7697781,700:6381921,800:4342338,900:2171169},"blue-gray":{50:15527921,100:13621468,200:11583173,300:9479342,400:7901340,500:6323595,600:5533306,700:4545124,800:3622735,900:2503224}};function J(t){return F.map((e=>`.${e}\\:${t}:${e}`))}function K(t,e){return Object.entries(L).map((([n,r])=>`@media (min-width: ${r}px) { .${n}\\:${t} { ${e} } }`))}function Q(t,e){return t.includes("@media")&&!e.includes("@media")?1:!t.includes("@media")&&e.includes("@media")?-1:t.localeCompare(e)}function Y(t){return Object.entries(t).flatMap((([t,e])=>[[`${e}-0`,`${t}: 0`],[`${e}-screen`,`${t}: 100vw`],[`${e}-full`,`${t}: 100%`],...I.map((n=>[`${e}-${n}`,`${t}: ${n*R}rem`])),...I.map((n=>[`-${e}-${n}`,`${t}: -${n*R}rem`])),...I.map((n=>[`${e}-${n}px`,`${t}: ${n}px`])),...I.map((n=>[`-${e}-${n}px`,`${t}: -${n}px`])),...W.map((n=>[`${e}-${n}\\%`,`${t}: ${n}%`])),...W.map((n=>[`-${e}-${n}\\%`,` ${t}: -${n}%`]))])).flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))}function Z(t){return Object.entries(t).flatMap((([t,e])=>[`.${e}-auto { ${t}: auto; }`,`.${e}x-auto { ${t}-left: auto; ${t}-right: auto; }`,`.${e}y-auto { ${t}-top: auto; ${t}-bottom: auto; }`,`.${e}x-0 { ${t}-left: 0; ${t}-right: 0; }`,`.${e}y-0 { ${t}-top: 0; ${t}-bottom: 0; }`,...I.map((t=>[t,t*R])).map((([n,r])=>`.${e}x-${n} { ${t}-left: ${r}rem; ${t}-right: ${r}rem; }`)),...I.map((t=>[t,t*R])).map((([n,r])=>`.${e}y-${n} { ${t}-top: ${r}rem; ${t}-bottom: ${r}rem; }`)),...I.map((n=>`.${e}x-${n}px { ${t}-left: ${n}px; ${t}-right: ${n}px; }`)),...I.map((n=>`.${e}y-${n}px { ${t}-top: ${n}px; ${t}-bottom: ${n}px; }`)),...W.map((n=>`.${e}x-${n}\\% { ${t}-left: ${n}%; ${t}-right: ${n}%; }`)),...W.map((n=>`.${e}y-${n}\\% { ${t}-top: ${n}%; ${t}-bottom: ${n}%; }`))]))}function tt(){const t=[["white","#fff"],["black","#000"],["transparent","transparent"]].flatMap((([t,e])=>[[`text-${t}`,`color: ${e}`],[`fill-${t}`,`fill: ${e}`],[`bg-${t}`,`background-color: ${e}`],[`border-${t}`,`border-color: ${e}`]])),e=Object.entries(X).flatMap((([t,e])=>[[`text-${t}`,`color: #${e[500].toString(16)}`],[`fill-${t}`,`fill: #${e[500].toString(16)}`],[`bg-${t}`,`background-color: #${e[500].toString(16)}`],[`border-${t}`,`border-color: #${e[500].toString(16)}`]])),n=Object.entries(X).flatMap((([t,e])=>Object.entries(e).flatMap((([e,n])=>[[`text-${t}-${e}`,`color: #${n.toString(16)}`],[`fill-${t}-${e}`,`fill: #${n.toString(16)}`],[`bg-${t}-${e}`,`background-color: #${n.toString(16)}`],[`border-${t}-${e}`,`border-color: #${n.toString(16)}`]]))));return[].concat(t).concat(e).concat(n).flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))}const et=new class extends O{dirpath=C(self.location.href);parseHTML(t,e={rootDocument:!1}){if(e.rootDocument)return(new DOMParser).parseFromString(t,"text/html");{const e=document.createRange();return e.selectNodeContents(document.body),e.createContextualFragment(t)}}serializeHTML(t){return(new XMLSerializer).serializeToString(t).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(t,e){return this.preprocessRemote(t,e)}};self.Mancha=et;const nt=self.document?.currentScript;if(self.document?.currentScript?.hasAttribute("init")){const t=nt?.hasAttribute("debug"),e=nt?.getAttribute("cache"),n=nt?.getAttribute("target")?.split("+")||["body"];window.addEventListener("load",(()=>{n.map((async n=>{const r=self.document.querySelector(n);await et.debug(t).mount(r,{cache:e})}))}))}if(self.document?.currentScript?.hasAttribute("css")){const t=nt?.getAttribute("css")?.split("+");for(const e of t){const t=document.createElement("style");switch(e){case"basic":t.textContent=z.A;break;case"utils":t.textContent=(void 0,[...U,...Object.entries(q).flatMap((([t,e])=>Object.entries(e).flatMap((([e,n])=>[`.${t} { ${e}: ${n} }`,`${J(t).join(",")} { ${e}: ${n} }`,...K(t,`${e}: ${n}`)])))),...tt(),...[["opacity-0","opacity: 0"],...W.map((t=>[`opacity-${t}`,"opacity: "+t/100]))].flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)])),...Y(B),...Z(B),...Y(G),...Z(G),...(rt=H,Object.entries(rt).flatMap((([t,e])=>[[`${e}t-0`,`${t}-top: 0`],[`${e}b-0`,`${t}-bottom: 0`],[`${e}l-0`,`${t}-left: 0`],[`${e}r-0`,`${t}-right: 0`],[`${e}t-auto`,`${t}-top: auto`],[`${e}b-auto`,`${t}-bottom: auto`],[`${e}l-auto`,`${t}-left: auto`],[`${e}r-auto`,`${t}-right: auto`],...["","-"].flatMap((n=>[...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}t-${r}`,`${t}-top: ${n}${i}rem`])),...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}b-${r}`,`${t}-bottom: ${n}${i}rem`])),...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}l-${r}`,`${t}-left: ${n}${i}rem`])),...I.map((t=>[t,t*R])).map((([r,i])=>[`${n}${e}r-${r}`,`${t}-right: ${n}${i}rem`])),...I.map((r=>[`${n}${e}t-${r}px`,`${t}-top: ${n}${r}px`])),...I.map((r=>[`${n}${e}b-${r}px`,`${t}-bottom: ${n}${r}px`])),...I.map((r=>[`${n}${e}l-${r}px`,`${t}-left: ${n}${r}px`])),...I.map((r=>[`${n}${e}r-${r}px`,`${t}-right: ${n}${r}px`])),...W.map((r=>[`${n}${e}t-${r}\\%`,`${t}-top: ${n}${r}%`])),...W.map((r=>[`${n}${e}b-${r}\\%`,`${t}-bottom: ${n}${r}%;`])),...W.map((r=>[`${n}${e}l-${r}\\%`,`${t}-left: ${n}${r}%`])),...W.map((r=>[`${n}${e}r-${r}\\%`,`${t}-right: ${n}${r}%`]))]))])).flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))),...Y(H),...Z(H),".space-x-0 > * { margin-left: 0 }",".space-y-0 > * { margin-top: 0 }",...I.map((t=>`.space-x-${t} > :not(:first-child) { margin-left: ${t*R}rem }`)),...I.map((t=>`.space-y-${t} > :not(:first-child) { margin-top: ${t*R}rem }`)),...I.map((t=>`.space-x-${t}px > :not(:first-child) { margin-left: ${t}px }`)),...I.map((t=>`.space-y-${t}px > :not(:first-child) { margin-top: ${t}px }`)),".gap-0 { gap: 0 }",...I.map((t=>`.gap-${t} { gap: ${t*R}rem }`)),...I.map((t=>`.gap-${t}px { gap: ${t}px }`)),...I.map((t=>`.gap-x-${t} { column-gap: ${t*R}rem }`)),...I.map((t=>`.gap-y-${t} { row-gap: ${t*R}rem }`)),...I.map((t=>`.gap-x-${t}px { column-gap: ${t}px }`)),...I.map((t=>`.gap-y-${t}px { row-gap: ${t}px }`)),...Y(V),...[...D.map((t=>[`border-${t}`,`border-width: ${t}px`]))].flatMap((([t,e])=>[`.${t} { ${e} }`,`${J(t).join(",")} { ${e} }`,...K(t,e)]))].sort(Q).join("\n"));break;default:console.error(`Unknown style name: "${e}"`)}self.document.head.appendChild(t)}}var rt})()})();
|
package/dist/plugins.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { appendChild, attributeNameToCamelCase, cloneAttribute, createElement, ellipsize, firstElementChild, getAttribute, getNodeValue, insertBefore, nodeToString, removeAttribute, removeChild, replaceChildren, replaceWith, setAttribute, setNodeValue, setTextContent, traverse, } from "./dome.js";
|
|
2
|
-
import { isRelativePath } from "./core.js";
|
|
1
|
+
import { appendChild, attributeNameToCamelCase, cloneAttribute, createElement, ellipsize, firstElementChild, getAttribute, getNodeValue, insertBefore, isRelativePath, nodeToString, removeAttribute, removeChild, replaceChildren, replaceWith, setAttribute, setNodeValue, setTextContent, traverse, } from "./dome.js";
|
|
3
2
|
import { Iterator } from "./iterator.js";
|
|
4
3
|
import { makeAsyncEvalFunction } from "./store.js";
|
|
5
4
|
const KW_ATTRIBUTES = new Set([
|