mancha 0.20.0 → 0.20.2
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-jIkOspb-.d.ts → interfaces-BnxInboi.d.ts} +2 -3
- package/dist/mancha.js +1 -1
- package/dist/{renderer-IXFn2ym1.js → renderer-gpXY5UCp.js} +1 -1
- package/dist/safe_browser.d.ts +1 -1
- package/dist/safe_browser.js +1 -1
- package/dist/store.d.ts +2 -3
- package/dist/store.js +26 -12
- package/dist/store.js.map +1 -1
- package/dist/test_utils.d.ts +4 -0
- package/dist/test_utils.js +7 -0
- package/dist/test_utils.js.map +1 -1
- package/docs/01_syntax.md +1 -1
- package/docs/03_reactivity.md +62 -0
- 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-BnxInboi.js";
|
|
2
2
|
import { SafeStyleSheet } from "safevalues";
|
|
3
3
|
|
|
4
4
|
//#region src/css_gen_basic.d.ts
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,t}from"./renderer-IXFn2ym1.js";import{safeStyleEl as n}from"safevalues/dom";import{concatStyleSheets as r,safeStyleSheet as i}from"safevalues";function a(){return r([i`*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}`,i`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}`,i`body{margin:0;line-height:inherit}`,i`hr{height:0;color:inherit;border-top-width:1px}`,i`abbr:where([title]){text-decoration:underline dotted}`,i`b,strong{font-weight:bolder}`,i`code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}`,i`small{font-size:80%}`,i`sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,i`sub{bottom:-0.25em}`,i`sup{top:-0.5em}`,i`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}`,i`button,select{text-transform:none}`,i`button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button;background-color:transparent;background-image:none;cursor:pointer}`,i`:-moz-focusring{outline:auto}`,i`:-moz-ui-invalid{box-shadow:none}`,i`progress{vertical-align:baseline}`,i`::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,i`[type='search']{-webkit-appearance:textfield;outline-offset:-2px}`,i`::-webkit-search-decoration{-webkit-appearance:none}`,i`::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,i`summary{display:list-item}`,i`blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,i`fieldset{margin:0;padding:0}`,i`legend{padding:0}`,i`ol,ul,menu{list-style:none;margin:0;padding:0}`,i`textarea{resize:vertical}`,i`::placeholder{opacity:1;color:#9ca3af}`,i`button,[role="button"]{cursor:pointer}`,i`:disabled{cursor:default;pointer-events:none;opacity:0.75}`,i`img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,i`img,video{max-width:100%;height:auto}`,i`[hidden]{display:none}`,i`dialog{padding:0}`,i`dialog::backdrop{background:rgba(0,0,0,0.5)}`])}function o(){return r([i`html{`,i`max-width: 70ch;`,i`padding: 2em 1em;`,i`margin: auto;`,i`line-height: 1.75;`,i`font-size: 1.25em;`,i`font-family: sans-serif;`,i`}`,i`h1,h2,h3,h4,h5,h6{`,i`margin: 1em 0 0.5em;`,i`}`,i`p,ul,ol{`,i`margin-bottom: 1em;`,i`color: #1d1d1d;`,i`}`])}const s={sm:640,md:768,lg:1024,xl:1280},c=Object.entries(s),l=.25,u=[...Array(15)].map((e,t)=>t+1),d=[16,20,24,28,32,36,40,48,56,64],f=[72,80,96,128,160,192,256,320,384,512],p=[...u,...d,...f,...Object.values(s)],m=Array.from({length:20},(e,t)=>(t+1)*5),h=[0,10,20,30,40,50,60,70,80,90,100],g=[25,50,75,100,150,200,300,500,700,1e3],_=[`hover`,`focus`,`disabled`],v={margin:`m`,padding:`p`},y={width:`w`,height:`h`},b={top:`top`,right:`right`,bottom:`bottom`,left:`left`},x={"min-width":`min-w`,"min-height":`min-h`,"max-width":`max-w`,"max-height":`max-h`},S={"font-mono":{"font-family":`monospace`},"font-sans":{"font-family":`sans-serif`},"font-serif":{"font-family":`serif`},"font-cursive":{"font-family":`cursive`},"text-xs":{"font-size":`.75rem`,"line-height":`calc(1 / 0.75)`},"text-sm":{"font-size":`.875rem`,"line-height":`calc(1.25 / 0.875)`},"text-base":{"font-size":`1rem`,"line-height":`calc(1.5 / 1)`},"text-lg":{"font-size":`1.125rem`,"line-height":`calc(1.75 / 1.125)`},"text-xl":{"font-size":`1.25rem`,"line-height":`calc(1.75 / 1.25)`},"text-2xl":{"font-size":`1.5rem`,"line-height":`calc(2 / 1.5)`},"text-3xl":{"font-size":`1.875rem`,"line-height":`calc(2.25 / 1.875)`},"text-4xl":{"font-size":`2.25rem`,"line-height":`calc(2.5 / 2.25)`},"text-5xl":{"font-size":`3rem`,"line-height":`1`},"text-6xl":{"font-size":`3.75rem`,"line-height":`1`},"text-7xl":{"font-size":`4.5rem`,"line-height":`1`},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":`italic`},"not-italic":{"font-style":`normal`},"w-max":{width:`max-content`},"w-min":{width:`min-content`},"w-fit":{width:`fit-content`},"h-max":{height:`max-content`},"h-min":{height:`min-content`},"h-fit":{height:`fit-content`},"size-auto":{width:`auto`,height:`auto`},"size-px":{width:`1px`,height:`1px`},"size-full":{width:`100%`,height:`100%`},"size-dvw":{width:`100dvw`,height:`100dvw`},"size-dvh":{width:`100dvh`,height:`100dvh`},"size-lvw":{width:`100lvw`,height:`100lvw`},"size-lvh":{width:`100lvh`,height:`100lvh`},"size-svw":{width:`100svw`,height:`100svw`},"size-svh":{width:`100svh`,height:`100svh`},"size-min":{width:`min-content`,height:`min-content`},"size-max":{width:`max-content`,height:`max-content`},"size-fit":{width:`fit-content`,height:`fit-content`},"tracking-tighter":{"letter-spacing":`-0.05em`},"tracking-tight":{"letter-spacing":`-0.025em`},"tracking-normal":{"letter-spacing":`0`},"tracking-wide":{"letter-spacing":`0.025em`},"tracking-wider":{"letter-spacing":`0.05em`},"tracking-widest":{"letter-spacing":`0.1em`},"leading-none":{"line-height":`1`},"leading-tight":{"line-height":`1.25`},"leading-snug":{"line-height":`1.375`},"leading-normal":{"line-height":`1.5`},"leading-relaxed":{"line-height":`1.625`},"leading-loose":{"line-height":`2`},"text-left":{"text-align":`left`},"text-right":{"text-align":`right`},"text-center":{"text-align":`center`},"text-justify":{"text-align":`justify`},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`},truncate:{"white-space":`nowrap`,overflow:`hidden`,"text-overflow":`ellipsis`},"text-elipsis":{"text-overflow":`ellipsis`},"text-clip":{"text-overflow":`clip`},"text-wrap":{"text-wrap":`wrap`},"text-nowrap":{"text-wrap":`nowrap`},"text-balance":{"text-wrap":`balance`},"text-pretty":{"text-wrap":`pretty`},"whitespace-normal":{"white-space":`normal`},"whitespace-nowrap":{"white-space":`nowrap`},"whitespace-pre":{"white-space":`pre`},"whitespace-pre-line":{"white-space":`pre-line`},"whitespace-pre-wrap":{"white-space":`pre-wrap`},"whitespace-break-spaces":{"white-space":`break-spaces`},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`},grid:{display:`grid`},"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},"align-baseline":{"vertical-align":`baseline`},"align-top":{"vertical-align":`top`},"align-middle":{"vertical-align":`middle`},"align-bottom":{"vertical-align":`bottom`},"align-text-top":{"vertical-align":`text-top`},"align-text-bottom":{"vertical-align":`text-bottom`},"overflow-auto":{overflow:`auto`},"overflow-x-auto":{"overflow-x":`auto`},"overflow-y-auto":{"overflow-y":`auto`},"overflow-hidden":{overflow:`hidden`},"overflow-x-hidden":{"overflow-x":`hidden`},"overflow-y-hidden":{"overflow-y":`hidden`},"overflow-visible":{overflow:`visible`},"overscroll-auto":{"overscroll-behavior":`auto`},"overscroll-contain":{"overscroll-behavior":`contain`},"overscroll-none":{"overscroll-behavior":`none`},"overscroll-x-auto":{"overscroll-behavior-x":`auto`},"overscroll-x-contain":{"overscroll-behavior-x":`contain`},"overscroll-x-none":{"overscroll-behavior-x":`none`},"overscroll-y-auto":{"overscroll-behavior-y":`auto`},"overscroll-y-contain":{"overscroll-behavior-y":`contain`},"overscroll-y-none":{"overscroll-behavior-y":`none`},"z-auto":{"z-index":`auto`},"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`},"appearance-none":{appearance:`none`,"-webkit-appearance":`none`,"-moz-appearance":`none`},border:{border:`1px solid`},"border-none":{border:`none`},"border-solid":{"border-style":`solid`},"border-dashed":{"border-style":`dashed`},"border-dotted":{"border-style":`dotted`},"border-collapse":{"border-collapse":`collapse`},"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`},"shadow-2xs":{"box-shadow":`0 1px rgb(0 0 0 / 0.05)`},"shadow-xs":{"box-shadow":`0 1px 2px 0 rgb(0 0 0 / 0.05)`},shadow:{"box-shadow":`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`},"shadow-sm":{"box-shadow":`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`},"shadow-md":{"box-shadow":`0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`},"shadow-lg":{"box-shadow":`0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`},"shadow-xl":{"box-shadow":`0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`},"shadow-2xl":{"box-shadow":`0 25px 50px -12px rgb(0 0 0 / 0.25)`},"shadow-inner":{"box-shadow":`inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`},"shadow-none":{"box-shadow":`0 0 #0000`},ring:{"box-shadow":`var(--ring-inset, ) 0 0 0 3px rgb(59 130 246 / 0.5)`},"ring-0":{"box-shadow":`var(--ring-inset, ) 0 0 0 0px rgb(59 130 246 / 0.5)`},"ring-1":{"box-shadow":`var(--ring-inset, ) 0 0 0 1px rgb(59 130 246 / 0.5)`},"ring-2":{"box-shadow":`var(--ring-inset, ) 0 0 0 2px rgb(59 130 246 / 0.5)`},"ring-4":{"box-shadow":`var(--ring-inset, ) 0 0 0 4px rgb(59 130 246 / 0.5)`},"ring-8":{"box-shadow":`var(--ring-inset, ) 0 0 0 8px rgb(59 130 246 / 0.5)`},"ring-inset":{"--ring-inset":`inset`},outline:{"outline-style":`solid`},"outline-none":{outline:`2px solid transparent`,"outline-offset":`2px`},"outline-dashed":{"outline-style":`dashed`},"outline-dotted":{"outline-style":`dotted`},"outline-double":{"outline-style":`double`},"outline-0":{"outline-width":`0px`},"outline-1":{"outline-width":`1px`},"outline-2":{"outline-width":`2px`},"outline-4":{"outline-width":`4px`},"outline-8":{"outline-width":`8px`},"outline-offset-0":{"outline-offset":`0px`},"outline-offset-1":{"outline-offset":`1px`},"outline-offset-2":{"outline-offset":`2px`},"outline-offset-4":{"outline-offset":`4px`},"outline-offset-8":{"outline-offset":`8px`},"aspect-auto":{"aspect-ratio":`auto`},"aspect-square":{"aspect-ratio":`1 / 1`},"aspect-video":{"aspect-ratio":`16 / 9`},"backdrop-blur-none":{"backdrop-filter":`blur(0)`},"backdrop-blur-sm":{"backdrop-filter":`blur(4px)`},"backdrop-blur":{"backdrop-filter":`blur(8px)`},"backdrop-blur-md":{"backdrop-filter":`blur(12px)`},"backdrop-blur-lg":{"backdrop-filter":`blur(16px)`},"backdrop-blur-xl":{"backdrop-filter":`blur(24px)`},"backdrop-blur-2xl":{"backdrop-filter":`blur(40px)`},"backdrop-blur-3xl":{"backdrop-filter":`blur(64px)`},"transition-none":{transition:`none`},transition:{"transition-property":`all`,"transition-timing-function":`ease-in-out`,"transition-duration":`var(--transition-duration, 150ms)`},"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`},"bg-auto":{"background-size":`auto`},"bg-cover":{"background-size":`cover`},"bg-contain":{"background-size":`contain`},"bg-no-repeat":{"background-repeat":`no-repeat`},"bg-fixed":{"background-attachment":`fixed`},"bg-local":{"background-attachment":`local`},"bg-scroll":{"background-attachment":`scroll`},"min-h-screen":{"min-height":`100vh`},"max-h-screen":{"max-height":`100vh`},"min-w-screen":{"min-width":`100vw`},"h-dvh":{height:`100dvh`},"h-svh":{height:`100svh`},"h-lvh":{height:`100lvh`},"w-dvw":{width:`100dvw`},"w-svw":{width:`100svw`},"w-lvw":{width:`100lvw`},"min-h-dvh":{"min-height":`100dvh`},"min-h-svh":{"min-height":`100svh`},"min-h-lvh":{"min-height":`100lvh`},"flex-none":{flex:`none`},"flex-auto":{flex:`1 1 auto`},"flex-initial":{flex:`0 1 auto`},grow:{"flex-grow":`1`},"grow-0":{"flex-grow":`0`},shrink:{"flex-shrink":`1`},"shrink-0":{"flex-shrink":`0`},"self-auto":{"align-self":`auto`},"self-start":{"align-self":`flex-start`},"self-end":{"align-self":`flex-end`},"self-center":{"align-self":`center`},"self-stretch":{"align-self":`stretch`},"self-baseline":{"align-self":`baseline`},"content-normal":{"align-content":`normal`},"content-start":{"align-content":`flex-start`},"content-end":{"align-content":`flex-end`},"content-center":{"align-content":`center`},"content-between":{"align-content":`space-between`},"content-around":{"align-content":`space-around`},"content-evenly":{"align-content":`space-evenly`},"content-stretch":{"align-content":`stretch`},"items-baseline":{"align-items":`baseline`},"inset-0":{inset:`0`},"inset-auto":{inset:`auto`},"inset-x-0":{left:`0`,right:`0`},"inset-y-0":{top:`0`,bottom:`0`},"inset-x-auto":{left:`auto`,right:`auto`},"inset-y-auto":{top:`auto`,bottom:`auto`},"sr-only":{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,"white-space":`nowrap`,"border-width":`0`},"not-sr-only":{position:`static`,width:`auto`,height:`auto`,padding:`0`,margin:`0`,overflow:`visible`,clip:`auto`,"white-space":`normal`}},C=[`@keyframes spin {
|
|
1
|
+
import{n as e,t}from"./renderer-gpXY5UCp.js";import{safeStyleEl as n}from"safevalues/dom";import{concatStyleSheets as r,safeStyleSheet as i}from"safevalues";function a(){return r([i`*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}`,i`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}`,i`body{margin:0;line-height:inherit}`,i`hr{height:0;color:inherit;border-top-width:1px}`,i`abbr:where([title]){text-decoration:underline dotted}`,i`b,strong{font-weight:bolder}`,i`code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}`,i`small{font-size:80%}`,i`sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,i`sub{bottom:-0.25em}`,i`sup{top:-0.5em}`,i`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}`,i`button,select{text-transform:none}`,i`button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button;background-color:transparent;background-image:none;cursor:pointer}`,i`:-moz-focusring{outline:auto}`,i`:-moz-ui-invalid{box-shadow:none}`,i`progress{vertical-align:baseline}`,i`::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,i`[type='search']{-webkit-appearance:textfield;outline-offset:-2px}`,i`::-webkit-search-decoration{-webkit-appearance:none}`,i`::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,i`summary{display:list-item}`,i`blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,i`fieldset{margin:0;padding:0}`,i`legend{padding:0}`,i`ol,ul,menu{list-style:none;margin:0;padding:0}`,i`textarea{resize:vertical}`,i`::placeholder{opacity:1;color:#9ca3af}`,i`button,[role="button"]{cursor:pointer}`,i`:disabled{cursor:default;pointer-events:none;opacity:0.75}`,i`img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,i`img,video{max-width:100%;height:auto}`,i`[hidden]{display:none}`,i`dialog{padding:0}`,i`dialog::backdrop{background:rgba(0,0,0,0.5)}`])}function o(){return r([i`html{`,i`max-width: 70ch;`,i`padding: 2em 1em;`,i`margin: auto;`,i`line-height: 1.75;`,i`font-size: 1.25em;`,i`font-family: sans-serif;`,i`}`,i`h1,h2,h3,h4,h5,h6{`,i`margin: 1em 0 0.5em;`,i`}`,i`p,ul,ol{`,i`margin-bottom: 1em;`,i`color: #1d1d1d;`,i`}`])}const s={sm:640,md:768,lg:1024,xl:1280},c=Object.entries(s),l=.25,u=[...Array(15)].map((e,t)=>t+1),d=[16,20,24,28,32,36,40,48,56,64],f=[72,80,96,128,160,192,256,320,384,512],p=[...u,...d,...f,...Object.values(s)],m=Array.from({length:20},(e,t)=>(t+1)*5),h=[0,10,20,30,40,50,60,70,80,90,100],g=[25,50,75,100,150,200,300,500,700,1e3],_=[`hover`,`focus`,`disabled`],v={margin:`m`,padding:`p`},y={width:`w`,height:`h`},b={top:`top`,right:`right`,bottom:`bottom`,left:`left`},x={"min-width":`min-w`,"min-height":`min-h`,"max-width":`max-w`,"max-height":`max-h`},S={"font-mono":{"font-family":`monospace`},"font-sans":{"font-family":`sans-serif`},"font-serif":{"font-family":`serif`},"font-cursive":{"font-family":`cursive`},"text-xs":{"font-size":`.75rem`,"line-height":`calc(1 / 0.75)`},"text-sm":{"font-size":`.875rem`,"line-height":`calc(1.25 / 0.875)`},"text-base":{"font-size":`1rem`,"line-height":`calc(1.5 / 1)`},"text-lg":{"font-size":`1.125rem`,"line-height":`calc(1.75 / 1.125)`},"text-xl":{"font-size":`1.25rem`,"line-height":`calc(1.75 / 1.25)`},"text-2xl":{"font-size":`1.5rem`,"line-height":`calc(2 / 1.5)`},"text-3xl":{"font-size":`1.875rem`,"line-height":`calc(2.25 / 1.875)`},"text-4xl":{"font-size":`2.25rem`,"line-height":`calc(2.5 / 2.25)`},"text-5xl":{"font-size":`3rem`,"line-height":`1`},"text-6xl":{"font-size":`3.75rem`,"line-height":`1`},"text-7xl":{"font-size":`4.5rem`,"line-height":`1`},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":`italic`},"not-italic":{"font-style":`normal`},"w-max":{width:`max-content`},"w-min":{width:`min-content`},"w-fit":{width:`fit-content`},"h-max":{height:`max-content`},"h-min":{height:`min-content`},"h-fit":{height:`fit-content`},"size-auto":{width:`auto`,height:`auto`},"size-px":{width:`1px`,height:`1px`},"size-full":{width:`100%`,height:`100%`},"size-dvw":{width:`100dvw`,height:`100dvw`},"size-dvh":{width:`100dvh`,height:`100dvh`},"size-lvw":{width:`100lvw`,height:`100lvw`},"size-lvh":{width:`100lvh`,height:`100lvh`},"size-svw":{width:`100svw`,height:`100svw`},"size-svh":{width:`100svh`,height:`100svh`},"size-min":{width:`min-content`,height:`min-content`},"size-max":{width:`max-content`,height:`max-content`},"size-fit":{width:`fit-content`,height:`fit-content`},"tracking-tighter":{"letter-spacing":`-0.05em`},"tracking-tight":{"letter-spacing":`-0.025em`},"tracking-normal":{"letter-spacing":`0`},"tracking-wide":{"letter-spacing":`0.025em`},"tracking-wider":{"letter-spacing":`0.05em`},"tracking-widest":{"letter-spacing":`0.1em`},"leading-none":{"line-height":`1`},"leading-tight":{"line-height":`1.25`},"leading-snug":{"line-height":`1.375`},"leading-normal":{"line-height":`1.5`},"leading-relaxed":{"line-height":`1.625`},"leading-loose":{"line-height":`2`},"text-left":{"text-align":`left`},"text-right":{"text-align":`right`},"text-center":{"text-align":`center`},"text-justify":{"text-align":`justify`},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`},truncate:{"white-space":`nowrap`,overflow:`hidden`,"text-overflow":`ellipsis`},"text-elipsis":{"text-overflow":`ellipsis`},"text-clip":{"text-overflow":`clip`},"text-wrap":{"text-wrap":`wrap`},"text-nowrap":{"text-wrap":`nowrap`},"text-balance":{"text-wrap":`balance`},"text-pretty":{"text-wrap":`pretty`},"whitespace-normal":{"white-space":`normal`},"whitespace-nowrap":{"white-space":`nowrap`},"whitespace-pre":{"white-space":`pre`},"whitespace-pre-line":{"white-space":`pre-line`},"whitespace-pre-wrap":{"white-space":`pre-wrap`},"whitespace-break-spaces":{"white-space":`break-spaces`},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`},grid:{display:`grid`},"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},"align-baseline":{"vertical-align":`baseline`},"align-top":{"vertical-align":`top`},"align-middle":{"vertical-align":`middle`},"align-bottom":{"vertical-align":`bottom`},"align-text-top":{"vertical-align":`text-top`},"align-text-bottom":{"vertical-align":`text-bottom`},"overflow-auto":{overflow:`auto`},"overflow-x-auto":{"overflow-x":`auto`},"overflow-y-auto":{"overflow-y":`auto`},"overflow-hidden":{overflow:`hidden`},"overflow-x-hidden":{"overflow-x":`hidden`},"overflow-y-hidden":{"overflow-y":`hidden`},"overflow-visible":{overflow:`visible`},"overscroll-auto":{"overscroll-behavior":`auto`},"overscroll-contain":{"overscroll-behavior":`contain`},"overscroll-none":{"overscroll-behavior":`none`},"overscroll-x-auto":{"overscroll-behavior-x":`auto`},"overscroll-x-contain":{"overscroll-behavior-x":`contain`},"overscroll-x-none":{"overscroll-behavior-x":`none`},"overscroll-y-auto":{"overscroll-behavior-y":`auto`},"overscroll-y-contain":{"overscroll-behavior-y":`contain`},"overscroll-y-none":{"overscroll-behavior-y":`none`},"z-auto":{"z-index":`auto`},"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`},"appearance-none":{appearance:`none`,"-webkit-appearance":`none`,"-moz-appearance":`none`},border:{border:`1px solid`},"border-none":{border:`none`},"border-solid":{"border-style":`solid`},"border-dashed":{"border-style":`dashed`},"border-dotted":{"border-style":`dotted`},"border-collapse":{"border-collapse":`collapse`},"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`},"shadow-2xs":{"box-shadow":`0 1px rgb(0 0 0 / 0.05)`},"shadow-xs":{"box-shadow":`0 1px 2px 0 rgb(0 0 0 / 0.05)`},shadow:{"box-shadow":`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`},"shadow-sm":{"box-shadow":`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`},"shadow-md":{"box-shadow":`0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`},"shadow-lg":{"box-shadow":`0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`},"shadow-xl":{"box-shadow":`0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`},"shadow-2xl":{"box-shadow":`0 25px 50px -12px rgb(0 0 0 / 0.25)`},"shadow-inner":{"box-shadow":`inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`},"shadow-none":{"box-shadow":`0 0 #0000`},ring:{"box-shadow":`var(--ring-inset, ) 0 0 0 3px rgb(59 130 246 / 0.5)`},"ring-0":{"box-shadow":`var(--ring-inset, ) 0 0 0 0px rgb(59 130 246 / 0.5)`},"ring-1":{"box-shadow":`var(--ring-inset, ) 0 0 0 1px rgb(59 130 246 / 0.5)`},"ring-2":{"box-shadow":`var(--ring-inset, ) 0 0 0 2px rgb(59 130 246 / 0.5)`},"ring-4":{"box-shadow":`var(--ring-inset, ) 0 0 0 4px rgb(59 130 246 / 0.5)`},"ring-8":{"box-shadow":`var(--ring-inset, ) 0 0 0 8px rgb(59 130 246 / 0.5)`},"ring-inset":{"--ring-inset":`inset`},outline:{"outline-style":`solid`},"outline-none":{outline:`2px solid transparent`,"outline-offset":`2px`},"outline-dashed":{"outline-style":`dashed`},"outline-dotted":{"outline-style":`dotted`},"outline-double":{"outline-style":`double`},"outline-0":{"outline-width":`0px`},"outline-1":{"outline-width":`1px`},"outline-2":{"outline-width":`2px`},"outline-4":{"outline-width":`4px`},"outline-8":{"outline-width":`8px`},"outline-offset-0":{"outline-offset":`0px`},"outline-offset-1":{"outline-offset":`1px`},"outline-offset-2":{"outline-offset":`2px`},"outline-offset-4":{"outline-offset":`4px`},"outline-offset-8":{"outline-offset":`8px`},"aspect-auto":{"aspect-ratio":`auto`},"aspect-square":{"aspect-ratio":`1 / 1`},"aspect-video":{"aspect-ratio":`16 / 9`},"backdrop-blur-none":{"backdrop-filter":`blur(0)`},"backdrop-blur-sm":{"backdrop-filter":`blur(4px)`},"backdrop-blur":{"backdrop-filter":`blur(8px)`},"backdrop-blur-md":{"backdrop-filter":`blur(12px)`},"backdrop-blur-lg":{"backdrop-filter":`blur(16px)`},"backdrop-blur-xl":{"backdrop-filter":`blur(24px)`},"backdrop-blur-2xl":{"backdrop-filter":`blur(40px)`},"backdrop-blur-3xl":{"backdrop-filter":`blur(64px)`},"transition-none":{transition:`none`},transition:{"transition-property":`all`,"transition-timing-function":`ease-in-out`,"transition-duration":`var(--transition-duration, 150ms)`},"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`},"bg-auto":{"background-size":`auto`},"bg-cover":{"background-size":`cover`},"bg-contain":{"background-size":`contain`},"bg-no-repeat":{"background-repeat":`no-repeat`},"bg-fixed":{"background-attachment":`fixed`},"bg-local":{"background-attachment":`local`},"bg-scroll":{"background-attachment":`scroll`},"min-h-screen":{"min-height":`100vh`},"max-h-screen":{"max-height":`100vh`},"min-w-screen":{"min-width":`100vw`},"h-dvh":{height:`100dvh`},"h-svh":{height:`100svh`},"h-lvh":{height:`100lvh`},"w-dvw":{width:`100dvw`},"w-svw":{width:`100svw`},"w-lvw":{width:`100lvw`},"min-h-dvh":{"min-height":`100dvh`},"min-h-svh":{"min-height":`100svh`},"min-h-lvh":{"min-height":`100lvh`},"flex-none":{flex:`none`},"flex-auto":{flex:`1 1 auto`},"flex-initial":{flex:`0 1 auto`},grow:{"flex-grow":`1`},"grow-0":{"flex-grow":`0`},shrink:{"flex-shrink":`1`},"shrink-0":{"flex-shrink":`0`},"self-auto":{"align-self":`auto`},"self-start":{"align-self":`flex-start`},"self-end":{"align-self":`flex-end`},"self-center":{"align-self":`center`},"self-stretch":{"align-self":`stretch`},"self-baseline":{"align-self":`baseline`},"content-normal":{"align-content":`normal`},"content-start":{"align-content":`flex-start`},"content-end":{"align-content":`flex-end`},"content-center":{"align-content":`center`},"content-between":{"align-content":`space-between`},"content-around":{"align-content":`space-around`},"content-evenly":{"align-content":`space-evenly`},"content-stretch":{"align-content":`stretch`},"items-baseline":{"align-items":`baseline`},"inset-0":{inset:`0`},"inset-auto":{inset:`auto`},"inset-x-0":{left:`0`,right:`0`},"inset-y-0":{top:`0`,bottom:`0`},"inset-x-auto":{left:`auto`,right:`auto`},"inset-y-auto":{top:`auto`,bottom:`auto`},"sr-only":{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,"white-space":`nowrap`,"border-width":`0`},"not-sr-only":{position:`static`,width:`auto`,height:`auto`,padding:`0`,margin:`0`,overflow:`visible`,clip:`auto`,"white-space":`normal`}},C=[`@keyframes spin {
|
|
2
2
|
from { transform: rotate(0deg) }
|
|
3
3
|
to { transform: rotate(360deg) }
|
|
4
4
|
}`,`@keyframes ping {
|
|
@@ -33,8 +33,9 @@ type SignalStoreProxy = SignalStore & InternalStoreState & {
|
|
|
33
33
|
};
|
|
34
34
|
type Observer<T> = (this: SignalStoreProxy) => T;
|
|
35
35
|
type KeyValueHandler = (this: SignalStoreProxy, key: string, value: unknown) => void;
|
|
36
|
+
type AnyFunction = (...args: unknown[]) => unknown;
|
|
36
37
|
declare abstract class IDebouncer {
|
|
37
|
-
timeouts: Map<
|
|
38
|
+
timeouts: Map<AnyFunction, ReturnType<typeof setTimeout>>;
|
|
38
39
|
debounce<T>(millis: number, callback: () => T | Promise<T>): Promise<T>;
|
|
39
40
|
}
|
|
40
41
|
/** Default debouncer time in millis. */
|
|
@@ -44,11 +45,9 @@ declare class SignalStore<T extends StoreState = StoreState> extends IDebouncer
|
|
|
44
45
|
protected readonly expressionCache: Map<string, EvalFunction>;
|
|
45
46
|
protected readonly observers: Map<string, Set<ObserverEntry>>;
|
|
46
47
|
protected readonly keyHandlers: Map<RegExp, Set<KeyValueHandler>>;
|
|
47
|
-
protected _observer: Observer<unknown> | null;
|
|
48
48
|
readonly _store: Map<string, unknown>;
|
|
49
49
|
_lock: Promise<void>;
|
|
50
50
|
constructor(data?: T);
|
|
51
|
-
private wrapFunction;
|
|
52
51
|
private wrapObject;
|
|
53
52
|
watch<T>(key: string, observer: Observer<T>): void;
|
|
54
53
|
addKeyHandler(pattern: RegExp, handler: KeyValueHandler): void;
|
package/dist/mancha.js
CHANGED
|
@@ -39,7 +39,7 @@ let Ce=new Set([`this`,`typeof`]),we=new Set([`in`]),Te=new Set([`+`,`-`,`!`,`ty
|
|
|
39
39
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
40
40
|
*/
|
|
41
41
|
let Ae=new Set([`==`,`!=`,`<=`,`>=`,`||`,`&&`,`??`,`?.`]),je=new Set([`===`,`!==`]),F=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}({}),I=(e,t,n=0)=>({kind:e,value:t,precedence:n}),Me=e=>e===9||e===10||e===13||e===32,Ne=e=>{if(e===95||e===36)return!0;let t=e&-33;return 65<=t&&t<=90},Pe=e=>Ne(e)||L(e),Fe=e=>Ce.has(e),Ie=e=>e===34||e===39,L=e=>48<=e&&e<=57,Le=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,Re=e=>e===40||e===41||e===91||e===93||e===123||e===125,ze=e=>e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
|
|
42
|
-
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var Be=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;Me(this._next??-1);)this._advance(!0);if(Ie(this._next??-1))return this._tokenizeString();if(Ne(this._next??-1))return this._tokenizeIdentOrKeyword();if(L(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(Le(this._next??-1))return this._tokenizeOperator();if(Re(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=I(F.STRING,ze(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(Pe(this._next??-1));let e=this._getValue();return I(Fe(e)?F.KEYWORD:we.has(e)?F.OPERATOR:F.IDENTIFIER,e,P[e]??0)}_tokenizeNumber(){do this._advance();while(L(this._next??-1));return this._next===46?this._tokenizeDot():I(F.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),L(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),I(F.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),I(F.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),I(F.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),I(F.COLON,`:`)}_tokenizeFraction(){do this._advance();while(L(this._next??-1));return I(F.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(je.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),I(F.ARROW,e);Ae.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?I(F.OPTIONAL_DOT,e,13):I(F.OPERATOR,e,P[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=I(F.GROUPER,e,P[e]);return this._advance(!0),t}};let Ve=(e,t)=>new He(e,t).parse();var He=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new Be(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(F.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(F.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(F.DOT)||this._matches(F.OPTIONAL_DOT)){let t=this._kind===F.OPTIONAL_DOT;if(this._advance(),t&&this._matches(F.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(F.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(F.KEYWORD))break;else if(this._matches(F.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(!Ee.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===F.OPERATOR||this._kind===F.DOT||this._kind===F.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(F.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(F.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(F.INTEGER))return this._parseInteger(e);if(this._matches(F.DECIMAL))return this._parseDecimal(e)}if(!e||!Te.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(F.OPERATOR,`?`);let t=this._parseExpression();this._advance(F.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case F.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw Ce.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case F.IDENTIFIER:return this._parseInvokeOrIdentifier();case F.STRING:return this._parseString();case F.INTEGER:return this._parseInteger();case F.DECIMAL:return this._parseDecimal();case F.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case F.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(F.GROUPER,`]`))break;if(this._matches(F.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(F.COMMA));return this._advance(F.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(F.GROUPER,`}`))break;if(this._matches(F.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(F.STRING)||this._matches(F.IDENTIFIER))&&this._advance(),this._matches(F.COLON)){this._advance(F.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(F.COMMA));return this._advance(F.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(F.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(F.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(F.GROUPER,`)`))break;if(this._matches(F.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(F.COMMA));return this._advance(F.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(F.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(F.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}},Ue=class{timeouts=new Map;debounce(e,t){return new Promise((n,r)=>{let i=this.timeouts.get(t);i&&clearTimeout(i),this.timeouts.set(t,setTimeout(()=>{try{n(t()),this.timeouts.delete(t)}catch(e){r(e)}},e))})}};let We=new ke,R=`__is_proxy__`;function Ge(e){return e instanceof Je||e[R]===!0}function Ke(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Ke(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 qe(e,t,n){let r=z(e,t);r?r._store.set(t,n):e._store.set(t,n)}var Je=class extends Ue{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_observer=null;_store=new Map;_lock=Promise.resolve();constructor(e){super();for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapFunction(e){return(...t)=>e.call(this.$,...t)}wrapObject(e,t){return e==null||Ge(e)||e.constructor!==Object&&!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)=>{typeof r==`object`&&r&&(r=this.wrapObject(r,t));let a=Reflect.set(e,n,r,i);return t(),a},get:(e,t,n)=>t===R?!0:Reflect.get(e,t,n)})}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)}async notify(e,t=10){let n=z(this,e),r=Array.from(n?.observers.get(e)||[]);await this.debounce(t,()=>Promise.all(r.map(e=>e.observer.call(e.store.proxify(e.observer)))))}get(e,t){return t&&this.watch(e,t),Ke(this,e)}async set(e,t){if(this._store.has(e)&&t===this._store.get(e))return;let n=()=>this.notify(e);t&&typeof t==`function`&&(t=this.wrapFunction(t)),t&&typeof t==`object`&&(t=this.wrapObject(t,n)),qe(this,e,t);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 n()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}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))}proxify(e){let t=Array.from(this._store.entries()).map(([e])=>e),n=Object.fromEntries(t.map(e=>[e,null]));return new Proxy(n,{has:(e,t)=>typeof t==`string`&&(z(this,t)||Reflect.has(this,t))?!0:Reflect.has(n,t),get:(t,n,r)=>{if(typeof n==`string`){if(z(this,n))return this.get(n,e);if(e&&n!==R&&!Reflect.has(this,n))return this.set(n,void 0),this.get(n,e)}return n===`$`?this.proxify(e):Reflect.get(this,n,r)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):this.set(t,n),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=Ve(e,We),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._observer?this: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}},Ye=class e extends Je{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];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)}resetPerfData(){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(`>`)}buildEffectId(e){let t=e?.directive??`unknown`,n=O(e?.expression??``,32),r=e?.element;return`${t}:${r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`}:${n}`}recordEffectExecution(e,t){let n=this.buildEffectId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}performanceReport(){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){if(!this.shouldLog(`lifecycle`))return super.effect(e,t);let n=performance.now(),r=super.effect(e,t),i=performance.now()-n;return t&&this.recordEffectExecution(t,i),i>16&&console.warn(`Slow effect (${i.toFixed(1)}ms):`,this.buildEffectId(t)),this.shouldLog(`effects`)&&console.debug(`Effect (${i.toFixed(2)}ms):`,this.buildEffectId(t)),r}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:
|
|
42
|
+
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var Be=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;Me(this._next??-1);)this._advance(!0);if(Ie(this._next??-1))return this._tokenizeString();if(Ne(this._next??-1))return this._tokenizeIdentOrKeyword();if(L(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(Le(this._next??-1))return this._tokenizeOperator();if(Re(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=I(F.STRING,ze(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(Pe(this._next??-1));let e=this._getValue();return I(Fe(e)?F.KEYWORD:we.has(e)?F.OPERATOR:F.IDENTIFIER,e,P[e]??0)}_tokenizeNumber(){do this._advance();while(L(this._next??-1));return this._next===46?this._tokenizeDot():I(F.INTEGER,this._getValue())}_tokenizeDot(){if(this._advance(),L(this._next??-1))return this._tokenizeFraction();if(this._next===46){if(this._advance(),this._next===46)return this._advance(),this._clearValue(),I(F.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),I(F.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),I(F.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),I(F.COLON,`:`)}_tokenizeFraction(){do this._advance();while(L(this._next??-1));return I(F.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(je.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),I(F.ARROW,e);Ae.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?I(F.OPTIONAL_DOT,e,13):I(F.OPERATOR,e,P[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=I(F.GROUPER,e,P[e]);return this._advance(!0),t}};let Ve=(e,t)=>new He(e,t).parse();var He=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new Be(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(F.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(F.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(F.DOT)||this._matches(F.OPTIONAL_DOT)){let t=this._kind===F.OPTIONAL_DOT;if(this._advance(),t&&this._matches(F.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(F.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(F.KEYWORD))break;else if(this._matches(F.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(!Ee.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===F.OPERATOR||this._kind===F.DOT||this._kind===F.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(F.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(F.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(F.INTEGER))return this._parseInteger(e);if(this._matches(F.DECIMAL))return this._parseDecimal(e)}if(!e||!Te.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(F.OPERATOR,`?`);let t=this._parseExpression();this._advance(F.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case F.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw Ce.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case F.IDENTIFIER:return this._parseInvokeOrIdentifier();case F.STRING:return this._parseString();case F.INTEGER:return this._parseInteger();case F.DECIMAL:return this._parseDecimal();case F.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case F.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(F.GROUPER,`]`))break;if(this._matches(F.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(F.COMMA));return this._advance(F.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(F.GROUPER,`}`))break;if(this._matches(F.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(F.STRING)||this._matches(F.IDENTIFIER))&&this._advance(),this._matches(F.COLON)){this._advance(F.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(F.COMMA));return this._advance(F.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(F.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(F.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(F.GROUPER,`)`))break;if(this._matches(F.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(F.COMMA));return this._advance(F.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(F.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(F.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}},Ue=class{timeouts=new Map;debounce(e,t){return new Promise((n,r)=>{let i=this.timeouts.get(t);i&&clearTimeout(i),this.timeouts.set(t,setTimeout(()=>{try{n(t()),this.timeouts.delete(t)}catch(e){r(e)}},e))})}};let We=new ke,R=`__is_proxy__`;function Ge(e){return e instanceof Je||e[R]===!0}function Ke(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Ke(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 qe(e,t,n){let r=z(e,t);r?r._store.set(t,n):e._store.set(t,n)}var Je=class e extends Ue{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();constructor(e){super();for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e,t){return e==null||Ge(e)||e.constructor!==Object&&!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,t,n)=>t===R?!0:Reflect.get(e,t,n)})}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)}async notify(e,t=10){let n=z(this,e),r=Array.from(n?.observers.get(e)||[]);await this.debounce(t,()=>Promise.all(r.map(e=>e.observer.call(e.store.proxify(e.observer)))))}get(e,t){return t&&this.watch(e,t),Ke(this,e)}async set(e,t){if(this._store.has(e)&&t===this._store.get(e))return;let n=()=>this.notify(e);t&&typeof t==`object`&&(t=this.wrapObject(t,n)),qe(this,e,t);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 n()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}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))}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!==R&&!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.set(t,n),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=Ve(e,We),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}},Ye=class e extends Je{_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];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)}resetPerfData(){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(`>`)}buildEffectId(e){let t=e?.directive??`unknown`,n=O(e?.expression??``,32),r=e?.element;return`${t}:${r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`}:${n}`}recordEffectExecution(e,t){let n=this.buildEffectId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}performanceReport(){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){if(!this.shouldLog(`lifecycle`))return super.effect(e,t);let n=performance.now(),r=super.effect(e,t),i=performance.now()-n;return t&&this.recordEffectExecution(t,i),i>16&&console.warn(`Slow effect (${i.toFixed(1)}ms):`,this.buildEffectId(t)),this.shouldLog(`effects`)&&console.debug(`Effect (${i.toFixed(2)}ms):`,this.buildEffectId(t)),r}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:
|
|
43
43
|
`,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:A(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:A(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 j(m(e,this._skipNodes)).map(async e=>{this.log(`Preprocessing node:
|
|
44
44
|
`,k(e,128)),await M.resolveIncludes.call(this,e,t),await M.rebaseRelativePaths.call(this,e,t),await M.registerCustomElements.call(this,e,t),await M.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:
|
|
45
45
|
`,k(n,128)),await M.resolveForAttribute.call(this,n,t),await M.resolveRenderAttribute.call(this,n,t),await M.resolveDataAttribute.call(this,n,t),await M.resolveTextAttributes.call(this,n,t),await M.resolveHtmlAttribute.call(this,n,t),await M.resolveIfAttribute.call(this,n,t),await M.resolveShowAttribute.call(this,n,t),await M.resolveClassAttribute.call(this,n,t),await M.resolveBindAttribute.call(this,n,t),await M.resolveEventAttributes.call(this,n,t),await M.resolveTextNodeExpressions.call(this,n,t),await M.resolveCustomAttribute.call(this,n,t),await M.resolveCustomProperty.call(this,n,t),await M.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.resetPerfData(),t={...t,rootNode:e},S(e,`renderer`,this),this._store.set(`$rootNode`,e),this.has(`$rootRenderer`)||this._store.set(`$rootRenderer`,this),this.get(`$rootRenderer`)===this&&await Se(this),await this.preprocessNode(e,t),await this.renderNode(e,t),n&&(this._perfData.lifecycle.mountTime=performance.now()-n)}};function Xe(){return oe([p`*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}`,p`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}`,p`body{margin:0;line-height:inherit}`,p`hr{height:0;color:inherit;border-top-width:1px}`,p`abbr:where([title]){text-decoration:underline dotted}`,p`b,strong{font-weight:bolder}`,p`code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:1em}`,p`small{font-size:80%}`,p`sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,p`sub{bottom:-0.25em}`,p`sup{top:-0.5em}`,p`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}`,p`button,select{text-transform:none}`,p`button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button;background-color:transparent;background-image:none;cursor:pointer}`,p`:-moz-focusring{outline:auto}`,p`:-moz-ui-invalid{box-shadow:none}`,p`progress{vertical-align:baseline}`,p`::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,p`[type='search']{-webkit-appearance:textfield;outline-offset:-2px}`,p`::-webkit-search-decoration{-webkit-appearance:none}`,p`::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,p`summary{display:list-item}`,p`blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,p`fieldset{margin:0;padding:0}`,p`legend{padding:0}`,p`ol,ul,menu{list-style:none;margin:0;padding:0}`,p`textarea{resize:vertical}`,p`::placeholder{opacity:1;color:#9ca3af}`,p`button,[role="button"]{cursor:pointer}`,p`:disabled{cursor:default;pointer-events:none;opacity:0.75}`,p`img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,p`img,video{max-width:100%;height:auto}`,p`[hidden]{display:none}`,p`dialog{padding:0}`,p`dialog::backdrop{background:rgba(0,0,0,0.5)}`])}function Ze(){return oe([p`html{`,p`max-width: 70ch;`,p`padding: 2em 1em;`,p`margin: auto;`,p`line-height: 1.75;`,p`font-size: 1.25em;`,p`font-family: sans-serif;`,p`}`,p`h1,h2,h3,h4,h5,h6{`,p`margin: 1em 0 0.5em;`,p`}`,p`p,ul,ol{`,p`margin-bottom: 1em;`,p`color: #1d1d1d;`,p`}`])}let Qe={sm:640,md:768,lg:1024,xl:1280},$e=Object.entries(Qe),B=.25,V=[...Array(15)].map((e,t)=>t+1),et=[16,20,24,28,32,36,40,48,56,64],tt=[72,80,96,128,160,192,256,320,384,512],H=[...V,...et,...tt,...Object.values(Qe)],U=Array.from({length:20},(e,t)=>(t+1)*5),nt=[0,10,20,30,40,50,60,70,80,90,100],rt=[25,50,75,100,150,200,300,500,700,1e3],it=[`hover`,`focus`,`disabled`],W={margin:`m`,padding:`p`},at={width:`w`,height:`h`},ot={top:`top`,right:`right`,bottom:`bottom`,left:`left`},st={"min-width":`min-w`,"min-height":`min-h`,"max-width":`max-w`,"max-height":`max-h`},ct={"font-mono":{"font-family":`monospace`},"font-sans":{"font-family":`sans-serif`},"font-serif":{"font-family":`serif`},"font-cursive":{"font-family":`cursive`},"text-xs":{"font-size":`.75rem`,"line-height":`calc(1 / 0.75)`},"text-sm":{"font-size":`.875rem`,"line-height":`calc(1.25 / 0.875)`},"text-base":{"font-size":`1rem`,"line-height":`calc(1.5 / 1)`},"text-lg":{"font-size":`1.125rem`,"line-height":`calc(1.75 / 1.125)`},"text-xl":{"font-size":`1.25rem`,"line-height":`calc(1.75 / 1.25)`},"text-2xl":{"font-size":`1.5rem`,"line-height":`calc(2 / 1.5)`},"text-3xl":{"font-size":`1.875rem`,"line-height":`calc(2.25 / 1.875)`},"text-4xl":{"font-size":`2.25rem`,"line-height":`calc(2.5 / 2.25)`},"text-5xl":{"font-size":`3rem`,"line-height":`1`},"text-6xl":{"font-size":`3.75rem`,"line-height":`1`},"text-7xl":{"font-size":`4.5rem`,"line-height":`1`},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":`italic`},"not-italic":{"font-style":`normal`},"w-max":{width:`max-content`},"w-min":{width:`min-content`},"w-fit":{width:`fit-content`},"h-max":{height:`max-content`},"h-min":{height:`min-content`},"h-fit":{height:`fit-content`},"size-auto":{width:`auto`,height:`auto`},"size-px":{width:`1px`,height:`1px`},"size-full":{width:`100%`,height:`100%`},"size-dvw":{width:`100dvw`,height:`100dvw`},"size-dvh":{width:`100dvh`,height:`100dvh`},"size-lvw":{width:`100lvw`,height:`100lvw`},"size-lvh":{width:`100lvh`,height:`100lvh`},"size-svw":{width:`100svw`,height:`100svw`},"size-svh":{width:`100svh`,height:`100svh`},"size-min":{width:`min-content`,height:`min-content`},"size-max":{width:`max-content`,height:`max-content`},"size-fit":{width:`fit-content`,height:`fit-content`},"tracking-tighter":{"letter-spacing":`-0.05em`},"tracking-tight":{"letter-spacing":`-0.025em`},"tracking-normal":{"letter-spacing":`0`},"tracking-wide":{"letter-spacing":`0.025em`},"tracking-wider":{"letter-spacing":`0.05em`},"tracking-widest":{"letter-spacing":`0.1em`},"leading-none":{"line-height":`1`},"leading-tight":{"line-height":`1.25`},"leading-snug":{"line-height":`1.375`},"leading-normal":{"line-height":`1.5`},"leading-relaxed":{"line-height":`1.625`},"leading-loose":{"line-height":`2`},"text-left":{"text-align":`left`},"text-right":{"text-align":`right`},"text-center":{"text-align":`center`},"text-justify":{"text-align":`justify`},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`},truncate:{"white-space":`nowrap`,overflow:`hidden`,"text-overflow":`ellipsis`},"text-elipsis":{"text-overflow":`ellipsis`},"text-clip":{"text-overflow":`clip`},"text-wrap":{"text-wrap":`wrap`},"text-nowrap":{"text-wrap":`nowrap`},"text-balance":{"text-wrap":`balance`},"text-pretty":{"text-wrap":`pretty`},"whitespace-normal":{"white-space":`normal`},"whitespace-nowrap":{"white-space":`nowrap`},"whitespace-pre":{"white-space":`pre`},"whitespace-pre-line":{"white-space":`pre-line`},"whitespace-pre-wrap":{"white-space":`pre-wrap`},"whitespace-break-spaces":{"white-space":`break-spaces`},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`},grid:{display:`grid`},"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},"align-baseline":{"vertical-align":`baseline`},"align-top":{"vertical-align":`top`},"align-middle":{"vertical-align":`middle`},"align-bottom":{"vertical-align":`bottom`},"align-text-top":{"vertical-align":`text-top`},"align-text-bottom":{"vertical-align":`text-bottom`},"overflow-auto":{overflow:`auto`},"overflow-x-auto":{"overflow-x":`auto`},"overflow-y-auto":{"overflow-y":`auto`},"overflow-hidden":{overflow:`hidden`},"overflow-x-hidden":{"overflow-x":`hidden`},"overflow-y-hidden":{"overflow-y":`hidden`},"overflow-visible":{overflow:`visible`},"overscroll-auto":{"overscroll-behavior":`auto`},"overscroll-contain":{"overscroll-behavior":`contain`},"overscroll-none":{"overscroll-behavior":`none`},"overscroll-x-auto":{"overscroll-behavior-x":`auto`},"overscroll-x-contain":{"overscroll-behavior-x":`contain`},"overscroll-x-none":{"overscroll-behavior-x":`none`},"overscroll-y-auto":{"overscroll-behavior-y":`auto`},"overscroll-y-contain":{"overscroll-behavior-y":`contain`},"overscroll-y-none":{"overscroll-behavior-y":`none`},"z-auto":{"z-index":`auto`},"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`},"appearance-none":{appearance:`none`,"-webkit-appearance":`none`,"-moz-appearance":`none`},border:{border:`1px solid`},"border-none":{border:`none`},"border-solid":{"border-style":`solid`},"border-dashed":{"border-style":`dashed`},"border-dotted":{"border-style":`dotted`},"border-collapse":{"border-collapse":`collapse`},"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`},"shadow-2xs":{"box-shadow":`0 1px rgb(0 0 0 / 0.05)`},"shadow-xs":{"box-shadow":`0 1px 2px 0 rgb(0 0 0 / 0.05)`},shadow:{"box-shadow":`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`},"shadow-sm":{"box-shadow":`0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)`},"shadow-md":{"box-shadow":`0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)`},"shadow-lg":{"box-shadow":`0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)`},"shadow-xl":{"box-shadow":`0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)`},"shadow-2xl":{"box-shadow":`0 25px 50px -12px rgb(0 0 0 / 0.25)`},"shadow-inner":{"box-shadow":`inset 0 2px 4px 0 rgb(0 0 0 / 0.05)`},"shadow-none":{"box-shadow":`0 0 #0000`},ring:{"box-shadow":`var(--ring-inset, ) 0 0 0 3px rgb(59 130 246 / 0.5)`},"ring-0":{"box-shadow":`var(--ring-inset, ) 0 0 0 0px rgb(59 130 246 / 0.5)`},"ring-1":{"box-shadow":`var(--ring-inset, ) 0 0 0 1px rgb(59 130 246 / 0.5)`},"ring-2":{"box-shadow":`var(--ring-inset, ) 0 0 0 2px rgb(59 130 246 / 0.5)`},"ring-4":{"box-shadow":`var(--ring-inset, ) 0 0 0 4px rgb(59 130 246 / 0.5)`},"ring-8":{"box-shadow":`var(--ring-inset, ) 0 0 0 8px rgb(59 130 246 / 0.5)`},"ring-inset":{"--ring-inset":`inset`},outline:{"outline-style":`solid`},"outline-none":{outline:`2px solid transparent`,"outline-offset":`2px`},"outline-dashed":{"outline-style":`dashed`},"outline-dotted":{"outline-style":`dotted`},"outline-double":{"outline-style":`double`},"outline-0":{"outline-width":`0px`},"outline-1":{"outline-width":`1px`},"outline-2":{"outline-width":`2px`},"outline-4":{"outline-width":`4px`},"outline-8":{"outline-width":`8px`},"outline-offset-0":{"outline-offset":`0px`},"outline-offset-1":{"outline-offset":`1px`},"outline-offset-2":{"outline-offset":`2px`},"outline-offset-4":{"outline-offset":`4px`},"outline-offset-8":{"outline-offset":`8px`},"aspect-auto":{"aspect-ratio":`auto`},"aspect-square":{"aspect-ratio":`1 / 1`},"aspect-video":{"aspect-ratio":`16 / 9`},"backdrop-blur-none":{"backdrop-filter":`blur(0)`},"backdrop-blur-sm":{"backdrop-filter":`blur(4px)`},"backdrop-blur":{"backdrop-filter":`blur(8px)`},"backdrop-blur-md":{"backdrop-filter":`blur(12px)`},"backdrop-blur-lg":{"backdrop-filter":`blur(16px)`},"backdrop-blur-xl":{"backdrop-filter":`blur(24px)`},"backdrop-blur-2xl":{"backdrop-filter":`blur(40px)`},"backdrop-blur-3xl":{"backdrop-filter":`blur(64px)`},"transition-none":{transition:`none`},transition:{"transition-property":`all`,"transition-timing-function":`ease-in-out`,"transition-duration":`var(--transition-duration, 150ms)`},"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`},"bg-auto":{"background-size":`auto`},"bg-cover":{"background-size":`cover`},"bg-contain":{"background-size":`contain`},"bg-no-repeat":{"background-repeat":`no-repeat`},"bg-fixed":{"background-attachment":`fixed`},"bg-local":{"background-attachment":`local`},"bg-scroll":{"background-attachment":`scroll`},"min-h-screen":{"min-height":`100vh`},"max-h-screen":{"max-height":`100vh`},"min-w-screen":{"min-width":`100vw`},"h-dvh":{height:`100dvh`},"h-svh":{height:`100svh`},"h-lvh":{height:`100lvh`},"w-dvw":{width:`100dvw`},"w-svw":{width:`100svw`},"w-lvw":{width:`100lvw`},"min-h-dvh":{"min-height":`100dvh`},"min-h-svh":{"min-height":`100svh`},"min-h-lvh":{"min-height":`100lvh`},"flex-none":{flex:`none`},"flex-auto":{flex:`1 1 auto`},"flex-initial":{flex:`0 1 auto`},grow:{"flex-grow":`1`},"grow-0":{"flex-grow":`0`},shrink:{"flex-shrink":`1`},"shrink-0":{"flex-shrink":`0`},"self-auto":{"align-self":`auto`},"self-start":{"align-self":`flex-start`},"self-end":{"align-self":`flex-end`},"self-center":{"align-self":`center`},"self-stretch":{"align-self":`stretch`},"self-baseline":{"align-self":`baseline`},"content-normal":{"align-content":`normal`},"content-start":{"align-content":`flex-start`},"content-end":{"align-content":`flex-end`},"content-center":{"align-content":`center`},"content-between":{"align-content":`space-between`},"content-around":{"align-content":`space-around`},"content-evenly":{"align-content":`space-evenly`},"content-stretch":{"align-content":`stretch`},"items-baseline":{"align-items":`baseline`},"inset-0":{inset:`0`},"inset-auto":{inset:`auto`},"inset-x-0":{left:`0`,right:`0`},"inset-y-0":{top:`0`,bottom:`0`},"inset-x-auto":{left:`auto`,right:`auto`},"inset-y-auto":{top:`auto`,bottom:`auto`},"sr-only":{position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,"white-space":`nowrap`,"border-width":`0`},"not-sr-only":{position:`static`,width:`auto`,height:`auto`,padding:`0`,margin:`0`,overflow:`visible`,clip:`auto`,"white-space":`normal`}},lt=[`@keyframes spin {
|
|
@@ -24,7 +24,7 @@ const R=new Set([`this`,`typeof`]),ne=new Set([`in`]),re=new Set([`+`,`-`,`!`,`t
|
|
|
24
24
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
25
25
|
*/
|
|
26
26
|
const U=new Set([`==`,`!=`,`<=`,`>=`,`||`,`&&`,`??`,`?.`]),W=new Set([`===`,`!==`]);let G=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 K=(e,t,n=0)=>({kind:e,value:t,precedence:n}),q=e=>e===9||e===10||e===13||e===32,J=e=>{if(e===95||e===36)return!0;let t=e&-33;return 65<=t&&t<=90},ae=e=>J(e)||Y(e),oe=e=>R.has(e),se=e=>e===34||e===39,Y=e=>48<=e&&e<=57,ce=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,le=e=>e===40||e===41||e===91||e===93||e===123||e===125,ue=e=>e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
|
|
27
|
-
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var de=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;q(this._next??-1);)this._advance(!0);if(se(this._next??-1))return this._tokenizeString();if(J(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(ce(this._next??-1))return this._tokenizeOperator();if(le(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=K(G.STRING,ue(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(ae(this._next??-1));let e=this._getValue();return K(oe(e)?G.KEYWORD:ne.has(e)?G.OPERATOR:G.IDENTIFIER,e,z[e]??0)}_tokenizeNumber(){do this._advance();while(Y(this._next??-1));return this._next===46?this._tokenizeDot():K(G.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(),K(G.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),K(G.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),K(G.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),K(G.COLON,`:`)}_tokenizeFraction(){do this._advance();while(Y(this._next??-1));return K(G.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(W.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),K(G.ARROW,e);U.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?K(G.OPTIONAL_DOT,e,13):K(G.OPERATOR,e,z[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=K(G.GROUPER,e,z[e]);return this._advance(!0),t}};const fe=(e,t)=>new pe(e,t).parse();var pe=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new de(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(G.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(G.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(G.DOT)||this._matches(G.OPTIONAL_DOT)){let t=this._kind===G.OPTIONAL_DOT;if(this._advance(),t&&this._matches(G.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(G.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(G.KEYWORD))break;else if(this._matches(G.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(!ie.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===G.OPERATOR||this._kind===G.DOT||this._kind===G.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(G.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(G.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(G.INTEGER))return this._parseInteger(e);if(this._matches(G.DECIMAL))return this._parseDecimal(e)}if(!e||!re.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(G.OPERATOR,`?`);let t=this._parseExpression();this._advance(G.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case G.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw R.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case G.IDENTIFIER:return this._parseInvokeOrIdentifier();case G.STRING:return this._parseString();case G.INTEGER:return this._parseInteger();case G.DECIMAL:return this._parseDecimal();case G.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case G.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(G.GROUPER,`]`))break;if(this._matches(G.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(G.COMMA));return this._advance(G.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(G.GROUPER,`}`))break;if(this._matches(G.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(G.STRING)||this._matches(G.IDENTIFIER))&&this._advance(),this._matches(G.COLON)){this._advance(G.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(G.COMMA));return this._advance(G.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(G.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(G.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(G.GROUPER,`)`))break;if(this._matches(G.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(G.COMMA));return this._advance(G.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(G.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(G.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}},me=class{timeouts=new Map;debounce(e,t){return new Promise((n,r)=>{let i=this.timeouts.get(t);i&&clearTimeout(i),this.timeouts.set(t,setTimeout(()=>{try{n(t()),this.timeouts.delete(t)}catch(e){r(e)}},e))})}};const he=new H,X=`__is_proxy__`;function ge(e){return e instanceof $||e[X]===!0}function Z(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Z(n.get(`$parent`),t)}function Q(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?Q(n.get(`$parent`),t):null}function _e(e,t,n){let r=Q(e,t);r?r._store.set(t,n):e._store.set(t,n)}var $=class extends me{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_observer=null;_store=new Map;_lock=Promise.resolve();constructor(e){super();for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapFunction(e){return(...t)=>e.call(this.$,...t)}wrapObject(e,t){return e==null||ge(e)||e.constructor!==Object&&!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)=>{typeof r==`object`&&r&&(r=this.wrapObject(r,t));let a=Reflect.set(e,n,r,i);return t(),a},get:(e,t,n)=>t===X?!0:Reflect.get(e,t,n)})}watch(e,t){let n=Q(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)}async notify(e,t=10){let n=Q(this,e),r=Array.from(n?.observers.get(e)||[]);await this.debounce(t,()=>Promise.all(r.map(e=>e.observer.call(e.store.proxify(e.observer)))))}get(e,t){return t&&this.watch(e,t),Z(this,e)}async set(e,t){if(this._store.has(e)&&t===this._store.get(e))return;let n=()=>this.notify(e);t&&typeof t==`function`&&(t=this.wrapFunction(t)),t&&typeof t==`object`&&(t=this.wrapObject(t,n)),_e(this,e,t);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 n()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}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))}proxify(e){let t=Array.from(this._store.entries()).map(([e])=>e),n=Object.fromEntries(t.map(e=>[e,null]));return new Proxy(n,{has:(e,t)=>typeof t==`string`&&(Q(this,t)||Reflect.has(this,t))?!0:Reflect.has(n,t),get:(t,n,r)=>{if(typeof n==`string`){if(Q(this,n))return this.get(n,e);if(e&&n!==X&&!Reflect.has(this,n))return this.set(n,void 0),this.get(n,e)}return n===`$`?this.proxify(e):Reflect.get(this,n,r)},set:(e,t,n,r)=>(typeof t!=`string`||t in this?Reflect.set(this,t,n,r):this.set(t,n),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=fe(e,he),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._observer?this: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}},ve=class e extends ${_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];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)}resetPerfData(){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(`>`)}buildEffectId(e){let t=e?.directive??`unknown`,n=T(e?.expression??``,32),r=e?.element;return`${t}:${r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`}:${n}`}recordEffectExecution(e,t){let n=this.buildEffectId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}performanceReport(){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){if(!this.shouldLog(`lifecycle`))return super.effect(e,t);let n=performance.now(),r=super.effect(e,t),i=performance.now()-n;return t&&this.recordEffectExecution(t,i),i>16&&console.warn(`Slow effect (${i.toFixed(1)}ms):`,this.buildEffectId(t)),this.shouldLog(`effects`)&&console.debug(`Effect (${i.toFixed(2)}ms):`,this.buildEffectId(t)),r}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:
|
|
27
|
+
`;case`r`:return`\r`;case`t`:return` `;case`b`:return`\b`;case`f`:return`\f`;default:return t}});var de=class{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;q(this._next??-1);)this._advance(!0);if(se(this._next??-1))return this._tokenizeString();if(J(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(ce(this._next??-1))return this._tokenizeOperator();if(le(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=K(G.STRING,ue(this._getValue()));return this._advance(),t}_tokenizeIdentOrKeyword(){do this._advance();while(ae(this._next??-1));let e=this._getValue();return K(oe(e)?G.KEYWORD:ne.has(e)?G.OPERATOR:G.IDENTIFIER,e,z[e]??0)}_tokenizeNumber(){do this._advance();while(Y(this._next??-1));return this._next===46?this._tokenizeDot():K(G.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(),K(G.SPREAD,`...`);throw Error(`Unexpected token ..`)}return this._clearValue(),K(G.DOT,`.`,13)}_tokenizeComma(){return this._advance(!0),K(G.COMMA,`,`)}_tokenizeColon(){return this._advance(!0),K(G.COLON,`:`)}_tokenizeFraction(){do this._advance();while(Y(this._next??-1));return K(G.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(W.has(e))this._advance(),this._advance();else{if(e=this._getValue(1),e===`=>`)return this._advance(),K(G.ARROW,e);U.has(e)&&this._advance()}return e=this._getValue(),e===`?.`?K(G.OPTIONAL_DOT,e,13):K(G.OPERATOR,e,z[e])}_tokenizeGrouper(){let e=String.fromCharCode(this._next??0),t=K(G.GROUPER,e,z[e]);return this._advance(!0),t}};const fe=(e,t)=>new pe(e,t).parse();var pe=class{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new de(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(G.GROUPER,`(`)){let t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(G.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(G.DOT)||this._matches(G.OPTIONAL_DOT)){let t=this._kind===G.OPTIONAL_DOT;if(this._advance(),t&&this._matches(G.GROUPER,`[`)){let t=this._parseIndex();e=this._ast.index(e,t,!0)}else if(t&&this._matches(G.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(G.KEYWORD))break;else if(this._matches(G.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(!ie.has(t.value))throw Error(`unknown operator: ${t.value}`);this._advance();let n=this._parseUnary();for(;(this._kind===G.OPERATOR||this._kind===G.DOT||this._kind===G.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(G.KEYWORD,`typeof`)){this._advance();let e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(`typeof`,e)}if(this._matches(G.OPERATOR)){let e=this._value;if(this._advance(),e===`+`||e===`-`){if(this._matches(G.INTEGER))return this._parseInteger(e);if(this._matches(G.DECIMAL))return this._parseDecimal(e)}if(!e||!re.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(G.OPERATOR,`?`);let t=this._parseExpression();this._advance(G.COLON);let n=this._parseExpression();return this._ast.ternary(e,t,n)}_parsePrimary(){switch(this._kind){case G.KEYWORD:{let e=this._value??``;if(e===`this`)return this._advance(),this._ast.id(e);throw R.has(e)?Error(`unexpected keyword: ${e}`):Error(`unrecognized keyword: ${e}`)}case G.IDENTIFIER:return this._parseInvokeOrIdentifier();case G.STRING:return this._parseString();case G.INTEGER:return this._parseInteger();case G.DECIMAL:return this._parseDecimal();case G.GROUPER:return this._value===`(`?this._parseParenOrFunction():this._value===`{`?this._parseMap():this._value===`[`?this._parseList():void 0;case G.COLON:throw Error(`unexpected token ":"`);default:return}}_parseList(){let e=[];do{if(this._advance(),this._matches(G.GROUPER,`]`))break;if(this._matches(G.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadElement(t))}else e.push(this._parseExpression())}while(this._matches(G.COMMA));return this._advance(G.GROUPER,`]`),this._ast.list(e)}_parseMap(){let e=[];do{if(this._advance(),this._matches(G.GROUPER,`}`))break;if(this._matches(G.SPREAD)){this._advance();let t=this._parseExpression();t&&e.push(this._ast.spreadProperty(t))}else{let t=this._value??``;if((this._matches(G.STRING)||this._matches(G.IDENTIFIER))&&this._advance(),this._matches(G.COLON)){this._advance(G.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(G.COMMA));return this._advance(G.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(G.IDENTIFIER))throw Error(`expected identifier: ${this._value}`);let e=this._value;return this._advance(),this._ast.id(e??``)}_parseArguments(){if(!this._matches(G.GROUPER,`(`))return;let e=[];do{if(this._advance(),this._matches(G.GROUPER,`)`))break;if(this._matches(G.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(G.COMMA));return this._advance(G.GROUPER,`)`),e}_parseIndex(){this._advance();let e=this._parseExpression();return this._advance(G.GROUPER,`]`),e}_parseParenOrFunction(){let e=this._parseArguments();if(this._matches(G.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}},me=class{timeouts=new Map;debounce(e,t){return new Promise((n,r)=>{let i=this.timeouts.get(t);i&&clearTimeout(i),this.timeouts.set(t,setTimeout(()=>{try{n(t()),this.timeouts.delete(t)}catch(e){r(e)}},e))})}};const he=new H,X=`__is_proxy__`;function ge(e){return e instanceof $||e[X]===!0}function Z(e,t){let n=e?._store;if(n?.has(t))return n.get(t);if(n?.has(`$parent`))return Z(n.get(`$parent`),t)}function Q(e,t){let n=e?._store;return n?.has(t)?e:n?.has(`$parent`)?Q(n.get(`$parent`),t):null}function _e(e,t,n){let r=Q(e,t);r?r._store.set(t,n):e._store.set(t,n)}var $=class e extends me{evalkeys=[`$elem`,`$event`];expressionCache=new Map;observers=new Map;keyHandlers=new Map;_store=new Map;_lock=Promise.resolve();constructor(e){super();for(let[t,n]of Object.entries(e||{}))this.set(t,n)}wrapObject(e,t){return e==null||ge(e)||e.constructor!==Object&&!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,t,n)=>t===X?!0:Reflect.get(e,t,n)})}watch(e,t){let n=Q(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)}async notify(e,t=10){let n=Q(this,e),r=Array.from(n?.observers.get(e)||[]);await this.debounce(t,()=>Promise.all(r.map(e=>e.observer.call(e.store.proxify(e.observer)))))}get(e,t){return t&&this.watch(e,t),Z(this,e)}async set(e,t){if(this._store.has(e)&&t===this._store.get(e))return;let n=()=>this.notify(e);t&&typeof t==`object`&&(t=this.wrapObject(t,n)),_e(this,e,t);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 n()}async del(e){await this.set(e,null),this._store.delete(e),this.observers.delete(e)}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))}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`&&(Q(this,t)||Reflect.has(this,t))?!0:Reflect.has(r,t),get:(n,r,a)=>{if(typeof r==`string`){if(Q(this,r)){let n=this.get(r,t);return t&&n instanceof e?n.proxify(t):i(n,r,a)}if(t&&r!==X&&!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.set(t,n),!0)})}get $(){return this.proxify()}makeEvalFunction(e){return(t,n)=>{let r=fe(e,he),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}},ve=class e extends ${_debugLevel=`off`;dirpath=``;_perfData={lifecycle:{},effects:new Map};static DEBUG_LEVELS=[`off`,`lifecycle`,`effects`,`verbose`];_skipNodes=new Set;_customElements=new Map;_pendingValueRetries=[];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)}resetPerfData(){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(`>`)}buildEffectId(e){let t=e?.directive??`unknown`,n=T(e?.expression??``,32),r=e?.element;return`${t}:${r?r.dataset?.perfid??r.id??r.dataset?.testid??this.getNodePath(r):`unknown`}:${n}`}recordEffectExecution(e,t){let n=this.buildEffectId(e),r=this._perfData.effects.get(n)??{count:0,totalTime:0};r.count++,r.totalTime+=t,this._perfData.effects.set(n,r)}performanceReport(){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){if(!this.shouldLog(`lifecycle`))return super.effect(e,t);let n=performance.now(),r=super.effect(e,t),i=performance.now()-n;return t&&this.recordEffectExecution(t,i),i>16&&console.warn(`Slow effect (${i.toFixed(1)}ms):`,this.buildEffectId(t)),this.shouldLog(`effects`)&&console.debug(`Effect (${i.toFixed(2)}ms):`,this.buildEffectId(t)),r}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:
|
|
28
28
|
`,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:D(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:D(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 k(a(e,this._skipNodes)).map(async e=>{this.log(`Preprocessing node:
|
|
29
29
|
`,E(e,128)),await A.resolveIncludes.call(this,e,t),await A.rebaseRelativePaths.call(this,e,t),await A.registerCustomElements.call(this,e,t),await A.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 a(e,this._skipNodes))this.log(`Rendering node:
|
|
30
30
|
`,E(n,128)),await A.resolveForAttribute.call(this,n,t),await A.resolveRenderAttribute.call(this,n,t),await A.resolveDataAttribute.call(this,n,t),await A.resolveTextAttributes.call(this,n,t),await A.resolveHtmlAttribute.call(this,n,t),await A.resolveIfAttribute.call(this,n,t),await A.resolveShowAttribute.call(this,n,t),await A.resolveClassAttribute.call(this,n,t),await A.resolveBindAttribute.call(this,n,t),await A.resolveEventAttributes.call(this,n,t),await A.resolveTextNodeExpressions.call(this,n,t),await A.resolveCustomAttribute.call(this,n,t),await A.resolveCustomProperty.call(this,n,t),await A.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.resetPerfData(),t={...t,rootNode:e},m(e,`renderer`,this),this._store.set(`$rootNode`,e),this.has(`$rootRenderer`)||this._store.set(`$rootRenderer`,this),this.get(`$rootRenderer`)===this&&await te(this),await this.preprocessNode(e,t),await this.renderNode(e,t),n&&(this._perfData.lifecycle.mountTime=performance.now()-n)}};export{D as n,ve 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-BnxInboi.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-gpXY5UCp.js";import{safeDomParser as n}from"safevalues/dom";import{HtmlSanitizerBuilder as r}from"safevalues";const i=`:data,:for,: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
|
@@ -33,8 +33,9 @@ type SignalStoreProxy = SignalStore & InternalStoreState & {
|
|
|
33
33
|
};
|
|
34
34
|
type Observer<T> = (this: SignalStoreProxy) => T;
|
|
35
35
|
type KeyValueHandler = (this: SignalStoreProxy, key: string, value: unknown) => void;
|
|
36
|
+
type AnyFunction = (...args: unknown[]) => unknown;
|
|
36
37
|
declare abstract class IDebouncer {
|
|
37
|
-
timeouts: Map<
|
|
38
|
+
timeouts: Map<AnyFunction, ReturnType<typeof setTimeout>>;
|
|
38
39
|
debounce<T>(millis: number, callback: () => T | Promise<T>): Promise<T>;
|
|
39
40
|
}
|
|
40
41
|
/** Default debouncer time in millis. */
|
|
@@ -48,11 +49,9 @@ export declare class SignalStore<T extends StoreState = StoreState> extends IDeb
|
|
|
48
49
|
protected readonly expressionCache: Map<string, EvalFunction>;
|
|
49
50
|
protected readonly observers: Map<string, Set<ObserverEntry>>;
|
|
50
51
|
protected readonly keyHandlers: Map<RegExp, Set<KeyValueHandler>>;
|
|
51
|
-
protected _observer: Observer<unknown> | null;
|
|
52
52
|
readonly _store: Map<string, unknown>;
|
|
53
53
|
_lock: Promise<void>;
|
|
54
54
|
constructor(data?: T);
|
|
55
|
-
private wrapFunction;
|
|
56
55
|
private wrapObject;
|
|
57
56
|
watch<T>(key: string, observer: Observer<T>): void;
|
|
58
57
|
addKeyHandler(pattern: RegExp, handler: KeyValueHandler): void;
|
package/dist/store.js
CHANGED
|
@@ -75,7 +75,6 @@ export class SignalStore extends IDebouncer {
|
|
|
75
75
|
expressionCache = new Map();
|
|
76
76
|
observers = new Map();
|
|
77
77
|
keyHandlers = new Map();
|
|
78
|
-
_observer = null;
|
|
79
78
|
_store = new Map();
|
|
80
79
|
_lock = Promise.resolve();
|
|
81
80
|
constructor(data) {
|
|
@@ -86,10 +85,6 @@ export class SignalStore extends IDebouncer {
|
|
|
86
85
|
this.set(key, value);
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
90
|
-
wrapFunction(fn) {
|
|
91
|
-
return (...args) => fn.call(this.$, ...args);
|
|
92
|
-
}
|
|
93
88
|
wrapObject(obj, callback) {
|
|
94
89
|
// If this object is already a proxy or not a plain object (or array), return it as-is.
|
|
95
90
|
if (obj == null || isProxified(obj) || (obj.constructor !== Object && !Array.isArray(obj))) {
|
|
@@ -105,6 +100,9 @@ export class SignalStore extends IDebouncer {
|
|
|
105
100
|
return false;
|
|
106
101
|
},
|
|
107
102
|
set: (target, prop, value, receiver) => {
|
|
103
|
+
// Skip if the value is unchanged.
|
|
104
|
+
if (Reflect.get(target, prop, receiver) === value)
|
|
105
|
+
return true;
|
|
108
106
|
if (typeof value === "object" && value !== null) {
|
|
109
107
|
value = this.wrapObject(value, callback);
|
|
110
108
|
}
|
|
@@ -157,9 +155,8 @@ export class SignalStore extends IDebouncer {
|
|
|
157
155
|
if (this._store.has(key) && value === this._store.get(key))
|
|
158
156
|
return;
|
|
159
157
|
const callback = () => this.notify(key);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
158
|
+
// Note: Functions are NOT wrapped here. They are wrapped dynamically at access
|
|
159
|
+
// time in proxify() to ensure the correct observer context is used.
|
|
163
160
|
if (value && typeof value === "object") {
|
|
164
161
|
value = this.wrapObject(value, callback);
|
|
165
162
|
}
|
|
@@ -214,6 +211,15 @@ export class SignalStore extends IDebouncer {
|
|
|
214
211
|
proxify(observer) {
|
|
215
212
|
const keys = Array.from(this._store.entries()).map(([key]) => key);
|
|
216
213
|
const keyval = Object.fromEntries(keys.map((key) => [key, null]));
|
|
214
|
+
// Wraps a function to use the receiver proxy as `this`, ensuring proper
|
|
215
|
+
// context and dependency tracking when the function accesses reactive properties.
|
|
216
|
+
// Skips "constructor" as it needs to be callable with `new`.
|
|
217
|
+
const wrapMaybeFunction = (value, prop, receiver) => {
|
|
218
|
+
if (typeof value === "function" && prop !== "constructor") {
|
|
219
|
+
return (...args) => value.call(receiver, ...args);
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
};
|
|
217
223
|
return new Proxy(keyval, {
|
|
218
224
|
has: (_, prop) => {
|
|
219
225
|
if (typeof prop === "string") {
|
|
@@ -228,7 +234,13 @@ export class SignalStore extends IDebouncer {
|
|
|
228
234
|
get: (_, prop, receiver) => {
|
|
229
235
|
if (typeof prop === "string") {
|
|
230
236
|
if (getAncestorKeyStore(this, prop)) {
|
|
231
|
-
|
|
237
|
+
const value = this.get(prop, observer);
|
|
238
|
+
// If the value is a SignalStore (e.g., $parent) and we have an
|
|
239
|
+
// observer, return it as a proxy for proper dependency tracking.
|
|
240
|
+
if (observer && value instanceof SignalStore) {
|
|
241
|
+
return value.proxify(observer);
|
|
242
|
+
}
|
|
243
|
+
return wrapMaybeFunction(value, prop, receiver);
|
|
232
244
|
}
|
|
233
245
|
// If the property is not found, but we are observing, we assume it's a
|
|
234
246
|
// state variable that hasn't been initialized yet. We initialize it to
|
|
@@ -242,7 +254,8 @@ export class SignalStore extends IDebouncer {
|
|
|
242
254
|
return this.proxify(observer);
|
|
243
255
|
}
|
|
244
256
|
else {
|
|
245
|
-
|
|
257
|
+
const value = Reflect.get(this, prop, receiver);
|
|
258
|
+
return wrapMaybeFunction(value, prop, receiver);
|
|
246
259
|
}
|
|
247
260
|
},
|
|
248
261
|
set: (_, prop, value, receiver) => {
|
|
@@ -313,8 +326,9 @@ export class SignalStore extends IDebouncer {
|
|
|
313
326
|
return fn;
|
|
314
327
|
}
|
|
315
328
|
eval(expr, args = {}) {
|
|
316
|
-
//
|
|
317
|
-
|
|
329
|
+
// Use this.$ which returns a proxy. When called through an effect's proxy,
|
|
330
|
+
// this.$ inherits the observer for proper dependency tracking.
|
|
331
|
+
const thisArg = this.$;
|
|
318
332
|
if (this._store.has(expr)) {
|
|
319
333
|
// Shortcut: if the expression is just an item from the value store, use that directly.
|
|
320
334
|
return thisArg[expr];
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AA2CtD,MAAe,UAAU;IACxB,QAAQ,GAAwE,IAAI,GAAG,EAAE,CAAC;IAE1F,QAAQ,CAAI,MAAc,EAAE,QAA8B;QACzD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,OAAO;gBAAE,YAAY,CAAC,OAAO,CAAC,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAChB,QAAQ,EACR,UAAU,CAAC,GAAG,EAAE;gBACf,IAAI,CAAC;oBACJ,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACpB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAChC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACd,MAAM,CAAC,GAAG,CAAC,CAAC;gBACb,CAAC;YACF,CAAC,EAAE,MAAM,CAAC,CACV,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAED,wCAAwC;AACxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE3C,0BAA0B;AAC1B,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,cAAc,EAAE,CAAC;AAEr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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/dist/test_utils.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** Time to sleep for reactive side effects to complete (1.1x debounce time). */
|
|
2
|
+
export declare const REACTIVE_SLEEP_MS: number;
|
|
3
|
+
/** Sleep for the reactive debounce period to allow side effects to complete. */
|
|
4
|
+
export declare function sleepForReactivity(): Promise<void>;
|
|
1
5
|
export declare function innerHTML(elem: Element): string;
|
|
2
6
|
export declare function setInnerHTML(elem: Element, html: string): void;
|
|
3
7
|
export declare function getTextContent(node: Element | unknown): string | null;
|
package/dist/test_utils.js
CHANGED
|
@@ -2,6 +2,13 @@ import * as chai from "chai";
|
|
|
2
2
|
import chaiAsPromised from "chai-as-promised";
|
|
3
3
|
import { DomUtils } from "htmlparser2";
|
|
4
4
|
import { hasProperty } from "./dome.js";
|
|
5
|
+
import { REACTIVE_DEBOUNCE_MILLIS } from "./store.js";
|
|
6
|
+
/** Time to sleep for reactive side effects to complete (1.1x debounce time). */
|
|
7
|
+
export const REACTIVE_SLEEP_MS = Math.ceil(REACTIVE_DEBOUNCE_MILLIS * 1.1);
|
|
8
|
+
/** Sleep for the reactive debounce period to allow side effects to complete. */
|
|
9
|
+
export function sleepForReactivity() {
|
|
10
|
+
return new Promise((resolve) => setTimeout(resolve, REACTIVE_SLEEP_MS));
|
|
11
|
+
}
|
|
5
12
|
export function innerHTML(elem) {
|
|
6
13
|
if (hasProperty(elem, "innerHTML"))
|
|
7
14
|
return elem.innerHTML;
|
package/dist/test_utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_utils.js","sourceRoot":"","sources":["../src/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"test_utils.js","sourceRoot":"","sources":["../src/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,wBAAwB,GAAG,GAAG,CAAC,CAAC;AAE3E,gFAAgF;AAChF,MAAM,UAAU,kBAAkB;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAa;IACtC,IAAI,WAAW,CAAC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AC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAmB,EAAE,OAAgB,EAAE,EAAE;QACxD,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC;IACzD,CAAC;CACD,CAAC"}
|
package/docs/01_syntax.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
```html
|
|
9
9
|
<div :data="{ name: 'Stranger' }"></div>
|
|
10
10
|
```
|
|
11
|
-
- `:for` clones the node and repeats it
|
|
11
|
+
- `:for` clones the node and repeats it. The loop re-renders when the array is mutated (e.g., `push`, `pop`, `splice`, or `items.length = 0` to clear).
|
|
12
12
|
```html
|
|
13
13
|
<div :for="item in ['a', 'b', 'c']">{{ item }}</div>
|
|
14
14
|
```
|
package/docs/03_reactivity.md
CHANGED
|
@@ -83,6 +83,68 @@ Renderers also have a `$parent`, `$rootRenderer` and `$rootNode` attributes. The
|
|
|
83
83
|
|
|
84
84
|
While evaluating expressions, there will also be an `$elem` attribute which references the current element being rendered or, in the case of events, the element dispatching the event as well as the corresponding `$event` attribute.
|
|
85
85
|
|
|
86
|
+
## Observer Triggering
|
|
87
|
+
|
|
88
|
+
Observers only trigger when a value actually changes. Setting a variable to the same value it already holds will not notify observers or cause re-renders:
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
const { $ } = Mancha;
|
|
92
|
+
$.count = 5;
|
|
93
|
+
$.count = 5; // No observer triggered - value unchanged
|
|
94
|
+
$.count = 6; // Observers triggered - value changed
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This optimization applies to both top-level variables and nested object/array properties:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
$.user = { name: "Alice" };
|
|
101
|
+
$.user.name = "Alice"; // No observer triggered - same value
|
|
102
|
+
$.user.name = "Bob"; // Observers triggered
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Working with Arrays
|
|
106
|
+
|
|
107
|
+
Arrays in `mancha` are wrapped in reactive proxies, so mutations like `push`, `pop`, `splice`, and direct index assignment will trigger observers:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
$.items = ["a", "b", "c"];
|
|
111
|
+
$.items.push("d"); // Observers triggered
|
|
112
|
+
$.items[0] = "x"; // Observers triggered
|
|
113
|
+
$.items.pop(); // Observers triggered
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
To clear an array while triggering observers, set its length to zero:
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
$.items.length = 0; // Clears the array, observers triggered
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Note that clearing an already-empty array will not trigger observers since the length is unchanged:
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
$.items = [];
|
|
126
|
+
$.items.length = 0; // No observer triggered - already empty
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Replacing vs. Mutating
|
|
130
|
+
|
|
131
|
+
When you assign a new array or object, observers always trigger because the reference changes:
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
$.items = [];
|
|
135
|
+
$.items = []; // Observers triggered - different array reference
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If you want to avoid triggering observers when the content is logically the same, mutate the existing array instead of replacing it:
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
// This always triggers (new reference):
|
|
142
|
+
$.items = [];
|
|
143
|
+
|
|
144
|
+
// This only triggers if the array wasn't already empty:
|
|
145
|
+
$.items.length = 0;
|
|
146
|
+
```
|
|
147
|
+
|
|
86
148
|
## URL Query Parameter Binding
|
|
87
149
|
|
|
88
150
|
`mancha` provides a convenient way to establish a two-way binding between the state of your application and the URL query parameters. This is useful for preserving state across page reloads and for sharing links that restore the application to a specific state.
|