@risinghq/lienzo 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -2
- package/dist/shell/assets/index-Cna8wlzF.js +4 -0
- package/dist/shell/assets/index-CoJSASvW.css +2 -0
- package/dist/shell/index.html +13 -0
- package/package.json +76 -4
- package/src/bench/bench.ts +132 -0
- package/src/bridge/page.ts +443 -0
- package/src/bridge/protocol.ts +124 -0
- package/src/bridge/record.ts +75 -0
- package/src/bridge/script.ts +24 -0
- package/src/bridge/state.ts +143 -0
- package/src/capture/capture.ts +125 -0
- package/src/capture/compare.ts +46 -0
- package/src/capture/diff.ts +16 -0
- package/src/capture/manifest.ts +60 -0
- package/src/capture/refs.ts +20 -0
- package/src/capture/replay.ts +25 -0
- package/src/capture/review.ts +78 -0
- package/src/capture/serve.ts +32 -0
- package/src/capture/snap.ts +62 -0
- package/src/capture/store.ts +28 -0
- package/src/cli.ts +287 -0
- package/src/cloud/checkout.ts +33 -0
- package/src/cloud/credentials.ts +25 -0
- package/src/cloud/link.ts +60 -0
- package/src/cloud/login.ts +85 -0
- package/src/commands/canvas.ts +46 -0
- package/src/commands/change.ts +218 -0
- package/src/commands/class.ts +66 -0
- package/src/commands/command.ts +27 -0
- package/src/commands/create.ts +95 -0
- package/src/commands/element.ts +118 -0
- package/src/commands/file.ts +96 -0
- package/src/commands/frame.ts +58 -0
- package/src/commands/override.ts +38 -0
- package/src/commands/prop.ts +18 -0
- package/src/commands/registry.ts +76 -0
- package/src/commands/rule.ts +131 -0
- package/src/commands/stage.ts +52 -0
- package/src/commands/story.ts +112 -0
- package/src/commands/style.ts +123 -0
- package/src/commands/text.ts +17 -0
- package/src/commands/token.ts +60 -0
- package/src/commands/transaction.ts +66 -0
- package/src/job/docker.ts +109 -0
- package/src/job/job.ts +125 -0
- package/src/job/server.ts +62 -0
- package/src/mirror/apply.ts +121 -0
- package/src/mirror/entry.ts +7 -0
- package/src/mirror/host.ts +68 -0
- package/src/mirror/observe.ts +271 -0
- package/src/mirror/script.ts +18 -0
- package/src/mirror/transport.ts +7 -0
- package/src/mirror/wire.ts +25 -0
- package/src/project/config.ts +98 -0
- package/src/project/design.ts +59 -0
- package/src/project/detect.ts +184 -0
- package/src/project/files.ts +30 -0
- package/src/project/git.ts +68 -0
- package/src/project/github.ts +42 -0
- package/src/project/history.ts +89 -0
- package/src/project/project.ts +106 -0
- package/src/project/spawn.ts +23 -0
- package/src/project/step.ts +15 -0
- package/src/protocol.ts +125 -0
- package/src/sandbox/forward.ts +73 -0
- package/src/sandbox/install.ts +44 -0
- package/src/sandbox/sandbox.ts +57 -0
- package/src/serve/build.ts +49 -0
- package/src/serve/canvases.ts +65 -0
- package/src/serve/dev.ts +296 -0
- package/src/serve/env.ts +16 -0
- package/src/serve/mcp.ts +65 -0
- package/src/serve/middleware.ts +172 -0
- package/src/serve/next/config.ts +68 -0
- package/src/serve/next/hook.ts +74 -0
- package/src/serve/next/loader.ts +37 -0
- package/src/serve/nuxt.ts +14 -0
- package/src/serve/plugin.ts +95 -0
- package/src/serve/preload.ts +167 -0
- package/src/serve/resend.ts +29 -0
- package/src/serve/running.ts +115 -0
- package/src/serve/screenshot.ts +26 -0
- package/src/serve/sources.ts +46 -0
- package/src/serve/uncached.ts +25 -0
- package/src/serve/vite-build.ts +15 -0
- package/src/serve/vite.ts +19 -0
- package/src/session/session.ts +96 -0
- package/src/share/ask.ts +24 -0
- package/src/share/client.ts +140 -0
- package/src/share/consent.ts +39 -0
- package/src/share/frame.ts +26 -0
- package/src/source/astro/astro.ts +10 -0
- package/src/source/astro/elements.ts +60 -0
- package/src/source/blocks.ts +42 -0
- package/src/source/css.ts +48 -0
- package/src/source/estree.ts +55 -0
- package/src/source/extract.ts +68 -0
- package/src/source/insert.ts +189 -0
- package/src/source/jsx/elements.ts +136 -0
- package/src/source/jsx/jsx.ts +5 -0
- package/src/source/language.ts +176 -0
- package/src/source/location.ts +34 -0
- package/src/source/modules.ts +41 -0
- package/src/source/overrides.ts +35 -0
- package/src/source/page.ts +69 -0
- package/src/source/patch.ts +79 -0
- package/src/source/prop.ts +34 -0
- package/src/source/refusal.ts +7 -0
- package/src/source/rules.ts +298 -0
- package/src/source/stamp.ts +28 -0
- package/src/source/story-file.ts +40 -0
- package/src/source/story.ts +162 -0
- package/src/source/structure.ts +253 -0
- package/src/source/style.ts +143 -0
- package/src/source/svelte/elements.ts +154 -0
- package/src/source/svelte/svelte.ts +11 -0
- package/src/source/tag.ts +99 -0
- package/src/source/tailwind.ts +46 -0
- package/src/source/tokens.ts +56 -0
- package/src/source/vue/elements.ts +236 -0
- package/src/source/vue/vue.ts +11 -0
package/README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# lienzo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
lienzo is a design canvas over a project's real pages, for a Vite project that
|
|
4
|
+
writes JSX with React or Solid, Svelte 5 components, SvelteKit included, or Vue
|
|
5
|
+
single-file components, Nuxt included, and for a Next or Astro project. It draws
|
|
6
|
+
the pages your dev server renders, at several device widths, side by side. When
|
|
7
|
+
you change an element on the canvas, lienzo patches the source file that made
|
|
8
|
+
it, and the dev server updates the page. There is no design file, so the design
|
|
9
|
+
cannot drift from the code.
|
|
10
|
+
|
|
11
|
+
It edits a class list or a text that the source states as a literal, a rule of a
|
|
12
|
+
stylesheet that styles the element, and a design token in a stylesheet. When the
|
|
13
|
+
code computes the value in any other way, lienzo refuses and says why. The
|
|
14
|
+
spacing, text and radius scales need Tailwind classes.
|
|
15
|
+
|
|
16
|
+
A person uses the canvas. An agent uses the same commands through the CLI or an
|
|
17
|
+
MCP server.
|
|
18
|
+
|
|
19
|
+
## Run it
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
cd your-project
|
|
23
|
+
bunx @risinghq/lienzo dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
lienzo needs [Bun](https://bun.sh). A Next project also needs Node, because Next
|
|
27
|
+
runs under it. To work on lienzo itself, see [Development](docs/development.md).
|
|
28
|
+
|
|
29
|
+
`dev` starts your project's own dev server and prints two addresses: the site
|
|
30
|
+
and the canvas. It does not change your Vite config. It serves the script named
|
|
31
|
+
`dev`, or the one [lienzo.json](docs/configuration.md) names. When the project's
|
|
32
|
+
`dev` script is Vite's own command, such as `vite` or `vite dev`, or there is no
|
|
33
|
+
`dev` script, lienzo starts Vite from the project's config, without the script's
|
|
34
|
+
flags. A Nuxt project whose script is `nuxt dev`, or that has no script, gets
|
|
35
|
+
the project's own Nuxt CLI, also without the script's flags. A Next project
|
|
36
|
+
whose script is `next dev`, or that has no script, gets the project's own Next
|
|
37
|
+
under Node, with the script's flags, so Turbopack and `--webpack` both work. Any
|
|
38
|
+
other `dev` script renders the pages itself, and lienzo runs it with Bun. An
|
|
39
|
+
Astro project's `astro dev` is such a script, and Astro's server gets lienzo
|
|
40
|
+
through it. lienzo cannot reach Next through such a script, so a Next script
|
|
41
|
+
that runs more than one command, such as a migration before `next dev`, fails
|
|
42
|
+
after 60 seconds. Run the other commands first and give the project a plain
|
|
43
|
+
`next dev`.
|
|
44
|
+
|
|
45
|
+
## Edit from a terminal
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
bunx @risinghq/lienzo class.set --at src/App.tsx:10:7 --class p-8
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{ "ok": true, "changed": ["src/App.tsx"] }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`p-8` takes the place of `p-2` in that element's class list. `md:p-3` stays,
|
|
56
|
+
because Tailwind does not let one override the other.
|
|
57
|
+
|
|
58
|
+
## What it does
|
|
59
|
+
|
|
60
|
+
- Frames: any page of the project at 390, 768, 1280 or 1536 px, on a canvas that
|
|
61
|
+
pans and zooms.
|
|
62
|
+
- Select an element in a frame to see its tag, its source location and its
|
|
63
|
+
classes.
|
|
64
|
+
- A tree of the page's elements, to select a parent or a child the pointer
|
|
65
|
+
cannot reach.
|
|
66
|
+
- Change padding, gap, text size and radius from scales. Add or remove any class
|
|
67
|
+
by name.
|
|
68
|
+
- Edit CSS properties by group: layout, size, spacing, text and background. With
|
|
69
|
+
Tailwind, a value becomes the class the theme names, `16px` → `p-4`, and an
|
|
70
|
+
edit in a wide frame holds from that frame's breakpoint up.
|
|
71
|
+
- Edit the text of an element that holds only text.
|
|
72
|
+
- Edit the rules of the project's stylesheets that style an element, such as a
|
|
73
|
+
CSS module's `.card` or a plain `main > #plain`: change a declaration's value
|
|
74
|
+
or add a declaration.
|
|
75
|
+
- Change a design token, a variable in `@theme` or `:root`, and see every
|
|
76
|
+
element that uses it change.
|
|
77
|
+
- Undo and redo.
|
|
78
|
+
- The same edits as CLI commands and as MCP tools.
|
|
79
|
+
|
|
80
|
+
## More
|
|
81
|
+
|
|
82
|
+
- [Manual](docs/readme.md)
|
|
83
|
+
- [Architecture](docs/architecture.md)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-proxy`),a=typeof Proxy==`function`,o=Symbol(`solid-track`),s={equals:r},c=null,l=ye,u=1,d=2,f={owned:null,cleanups:null,context:null,owner:null},p={},m=null,h=null,g=null,_=null,v=null,y=0;function b(e,t){let n=g,r=m,i=e.length===0,a=t===void 0?r:t,o=i?f:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(ee(o));m=o,g=null;try{return A(s,!0)}finally{g=n,m=r}}function ee(e){return()=>E(()=>j(e))}function x(e,t){t=t?Object.assign({},s,t):s;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[pe.bind(n),e=>(typeof e==`function`&&(e=h&&h.running&&h.sources.has(n)?e(n.tValue):e(n.value)),me(n,e))]}function te(e,t,n){k(ge(e,t,!0,u))}function S(e,t,n){k(ge(e,t,!1,u))}function C(e,t,n){l=be;let r=ge(e,t,!1,u),i=de&&le(de);i&&(r.suspense=i),n&&n.render||(r.user=!0),v?v.push(r):k(r)}function w(e,t,n){n=n?Object.assign({},s,n):s;let r=ge(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,k(r),pe.bind(r)}function ne(e){return e&&typeof e==`object`&&`then`in e}function T(t,n,r){let i,a,o;typeof n==`function`?(i=t,a=n,o=r||{}):(i=!0,a=t,o=n||{});let s=null,c=p,l=null,u=!1,d=!1,f=`initialValue`in o,_=typeof i==`function`&&w(i),v=new Set,[y,b]=(o.storage||x)(o.initialValue),[ee,S]=x(void 0),[C,T]=x(void 0,{equals:!1}),[re,ie]=x(f?`ready`:`unresolved`);m&&O(()=>{for(let e of v.keys())e.decrement();v.clear(),h&&s&&h.promises.delete(s),s=null}),e.context&&(l=e.getNextContextId(),o.ssrLoadFrom===`initial`?c=o.initialValue:e.load&&e.has(l)&&(c=e.load(l)));function D(e,t,n,r){return s===e&&(s=null,r!==void 0&&(f=!0),(e===c||t===c)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(r,{value:t})),c=p,h&&e&&u?(h.promises.delete(e),u=!1,A(()=>{h.running=!0,ae(t,n)},!1)):ae(t,n)),t}function ae(e,t){A(()=>{t===void 0&&b(()=>e),ie(t===void 0?f?`ready`:`unresolved`:`errored`),S(t);for(let e of v.keys())e.decrement();v.clear()},!1)}function se(){let e=de&&le(de),t=y(),n=ee();if(n!==void 0&&!s)throw n;return g&&!g.user&&e&&te(()=>{C(),s&&(e.resolved&&h&&u?h.promises.add(s):v.has(e)||(e.increment(),v.add(e)))}),t}function ce(e=!0){if(e!==!1&&d)return;d=!1;let t=_?_():i;if(u=h&&h.running,t==null||t===!1){D(s,E(y));return}h&&s&&h.promises.delete(s);let n,r=c===p?E(()=>{try{return a(t,{value:y(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0)D(s,void 0,Te(n),t);else return ne(r)?(s=r,`v`in r?(r.s===1?D(s,r.v,void 0,t):D(s,void 0,Te(r.v),t),r):(d=!0,queueMicrotask(()=>d=!1),A(()=>{ie(f?`refreshing`:`pending`),T()},!1),r.then(e=>D(r,e,void 0,t),e=>D(r,void 0,Te(e),t)))):(D(s,r,void 0,t),r)}Object.defineProperties(se,{state:{get:()=>re()},error:{get:()=>ee()},loading:{get(){let e=re();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return se();let e=ee();if(e&&!s)throw e;return y()}}});let ue=m;return _?te(()=>(ue=m,ce(!1))):ce(!1),[se,{refetch:e=>oe(ue,()=>ce(e)),mutate:b}]}function re(e){return A(e,!1)}function E(e){if(g===null)return e();let t=g;g=null;try{return e()}finally{g=t}}function ie(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=E(()=>t(o,i,n));return i=o,s}}function D(e){C(()=>E(e))}function O(e){return m===null||(m.cleanups===null?m.cleanups=[e]:m.cleanups.push(e)),e}function ae(){return g}function oe(e,t){let n=m,r=g;m=e,g=null;try{return A(t,!0)}catch(e){De(e)}finally{m=n,g=r}}var[se,ce]=x(!1);function le(e){let t;return m&&m.context&&(t=m.context[e.id])!==void 0?t:e.defaultValue}function ue(e){let t=w(e),n=w(()=>Oe(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var de;function fe(e){e.observerSlots=e.observers.map((t,n)=>{let r=t.sources;if(!r)return-1;for(let i=r.length-1;i>=0;i--)if(r[i]===e&&t.sourceSlots&&t.sourceSlots[i]===n)return i;return r.lastIndexOf(e)})}function pe(){let e=h&&h.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===u)k(this);else{let e=_;_=null,A(()=>xe(this),!1),_=e}}if(g){let e=this.observers;if(!e||e[e.length-1]!==g){let t=e?e.length:0;if(g.sources)g.sources.push(this),g.sourceSlots.push(t);else{let e=[this],n=[t];g.sources=e,g.sourceSlots=n}if(e)this.observerSlots&&this.observerSlots.length===e.length||fe(this),e.push(g),this.observerSlots.push(g.sources.length-1);else{let e=[g],t=[g.sources.length-1];this.observers=e,this.observerSlots=t}}}return e&&h.sources.has(this)?this.tValue:this.value}function me(e,t,n){let r=h&&h.running&&h.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(h){let r=h.running;(r||!n&&h.sources.has(e))&&(h.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&A(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=h&&h.running;r&&h.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?_.push(n):v.push(n),n.observers&&Se(n)),r?n.tState=u:n.state=u)}if(_.length>1e6)throw _=[],Error()},!1)}return t}function k(e){if(!e.fn)return;j(e,!0);let t=y;he(e,h&&h.running&&h.sources.has(e)?e.tValue:e.value,t),h&&!h.running&&h.sources.has(e)&&queueMicrotask(()=>{A(()=>{h&&(h.running=!0),g=m=e,he(e,e.tValue,t),g=m=null},!1)})}function he(e,t,n){let r,i=m,a=g;g=m=e;try{r=e.fn(t)}catch(t){return e.pure&&(h&&h.running?(e.tState=u,e.tOwned&&e.tOwned.forEach(e=>j(e)),e.tOwned=void 0):(e.state=u,e.owned&&e.owned.forEach(e=>j(e)),e.owned=null)),e.updatedAt=n+1,De(t)}finally{g=a,m=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?me(e,r,!0):h&&h.running&&e.pure?(h.sources.has(e)||(e.value=r),h.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function ge(e,t,n,r=u,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:m,context:m?m.context:null,pure:n};return h&&h.running&&(a.state=0,a.tState=r),m===null||m!==f&&(h&&h.running&&m.pure?m.tOwned?m.tOwned.push(a):m.tOwned=[a]:m.owned?m.owned.push(a):m.owned=[a]),a}function _e(e){let t=h&&h.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===d)return xe(e);if(e.suspense&&E(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<y);){if(t&&h.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(h.disposed.has(t))return}if((t?e.tState:e.state)===u)k(e);else if((t?e.tState:e.state)===d){let t=_;_=null,A(()=>xe(e,n[0]),!1),_=t}}}function A(e,t){if(_)return e();let n=!1;t||(_=[]),v?n=!0:v=[],y++;try{let t=e();return ve(n),t}catch(e){n||(v=null),_=null,De(e)}}function ve(e){if(_&&=(ye(_),null),e)return;let t;if(h){if(!h.promises.size&&!h.queue.size){let e=h.sources,n=h.disposed;v.push.apply(v,h.effects),t=h.resolve;for(let e of v)`tState`in e&&(e.state=e.tState),delete e.tState;h=null,A(()=>{for(let e of n)j(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)j(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}ce(!1)},!1)}else if(h.running){h.running=!1,h.effects.push.apply(h.effects,v),v=null,ce(!0);return}}let n=v;v=null,n.length&&A(()=>l(n),!1),t&&t()}function ye(e){for(let t=0;t<e.length;t++)_e(e[t])}function be(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:_e(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)_e(t[r])}function xe(e,t){let n=h&&h.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===u?i!==t&&(!i.updatedAt||i.updatedAt<y)&&_e(i):e===d&&xe(i,t)}}}function Se(e){let t=h&&h.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=d:r.state=d,r.pure?_.push(r):v.push(r),r.observers&&Se(r))}}function Ce(e){h&&h.sources.has(e)&&(h.sources.delete(e),delete e.tValue)}function j(e,t){let n;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),r=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){n.observerSlots&&n.observerSlots.length===i.length||fe(n);let e=i.pop(),t=n.observerSlots.pop();r<i.length&&(e.sourceSlots[t]=r,i[r]=e,n.observerSlots[r]=t)}t||i&&i.length||!h||Ce(n)}if(e.tOwned){for(n=e.tOwned.length-1;n>=0;n--)j(e.tOwned[n]);delete e.tOwned}if(h&&h.running&&e.pure)we(e,!0);else if(e.owned){for(n=e.owned.length-1;n>=0;n--)j(e.owned[n]);e.owned=null}if(t||Ce(e),e.cleanups){for(n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}h&&h.running?e.tState=0:e.state=0}function we(e,t){if(t||(e.tState=0,h.disposed.add(e),Ce(e)),e.owned)for(let t=0;t<e.owned.length;t++)we(e.owned[t])}function Te(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function Ee(e,t,n){try{for(let n of t)n(e)}catch(e){De(e,n&&n.owner||null)}}function De(e,t=m){let n=c&&t&&t.context&&t.context[c],r=Te(e);if(!n)throw r;v?v.push({fn(){Ee(r,n,t)},state:u}):Ee(r,n,t)}function Oe(e){if(typeof e==`function`&&!e.length)return Oe(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Oe(e[n]);if(Array.isArray(r)){if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e])}else t.push(r)}return t}return e}var ke=Symbol(`fallback`);function Ae(e){for(let t=0;t<e.length;t++)e[t]()}function je(e,t,n={}){let r=[],i=[],a=[],s=0,c=t.length>1?[]:null;return O(()=>Ae(a)),()=>{let l=e()||[],u=l.length,d,f;return l[o],E(()=>{let e,t,o,m,h,g,_,v,y;if(u===0)s!==0&&(Ae(a),a=[],r=[],i=[],s=0,c&&=[]),n.fallback&&(r=[ke],i[0]=b(e=>(a[0]=e,n.fallback())),s=1);else if(s===0){for(i=Array(u),f=0;f<u;f++)r[f]=l[f],i[f]=b(p);s=u}else{for(o=Array(u),m=Array(u),c&&(h=Array(u)),g=0,_=Math.min(s,u);g<_&&r[g]===l[g];g++);for(_=s-1,v=u-1;_>=g&&v>=g&&r[_]===l[v];_--,v--)o[v]=i[_],m[v]=a[_],c&&(h[v]=c[_]);for(e=new Map,t=Array(v+1),f=v;f>=g;f--)y=l[f],d=e.get(y),t[f]=d===void 0?-1:d,e.set(y,f);for(d=g;d<=_;d++)y=r[d],f=e.get(y),f!==void 0&&f!==-1?(o[f]=i[d],m[f]=a[d],c&&(h[f]=c[d]),f=t[f],e.set(y,f)):a[d]();for(f=g;f<u;f++)f in o?(i[f]=o[f],a[f]=m[f],c&&(c[f]=h[f],c[f](f))):i[f]=b(p);i=i.slice(0,s=u),r=l.slice(0)}return i});function p(e){if(a[f]=e,c){let[e,n]=x(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function M(e,t){return E(()=>e(t||{}))}function Me(){return!0}var Ne={get(e,t,n){return t===i?n:e.get(t)},has(e,t){return t===i||e.has(t)},set:Me,deleteProperty:Me,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Me,deleteProperty:Me}},ownKeys(e){return e.keys()}};function Pe(e){return(e=typeof e==`function`?e():e)?e:{}}function Fe(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function Ie(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&i in r,e[n]=typeof r==`function`?(t=!0,w(r)):r}if(a&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=Pe(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in Pe(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(Pe(e[n])));return[...new Set(t)]}},Ne);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Fe.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let o={},s=Object.keys(r);for(let e=s.length-1;e>=0;e--){let t=s[e],n=r[t];n&&n.get?Object.defineProperty(o,t,n):o[t]=n?n.value:void 0}return o}function Le(e,...t){let n=t.length;if(a&&i in e){let r=n>1?t.flat():t[0],i=new Set,a=t.map(t=>{let n=t.filter(e=>!i.has(e)&&(i.add(e),!0));return new Proxy({get(t){return n.includes(t)?e[t]:void 0},has(t){return n.includes(t)&&t in e},keys(){return n.filter(t=>t in e)}},Ne)});return a.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Ne)),a}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var Re=e=>`Stale read from <${e}>.`;function N(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return w(je(()=>e.each,e.children,t||void 0))}function P(e){let t=e.keyed,n=w(()=>e.when,void 0,void 0),r=t?n:w(n,void 0,{equals:(e,t)=>!e==!t});return w(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?E(()=>a(t?i:()=>{if(!E(r))throw Re(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function ze(e){let t=ue(()=>e.children),n=w(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=w(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:w(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return w(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?E(()=>o(a.keyed?i():()=>{if(E(n)()?.[0]!==r)throw Re(`Match`);return i()})):o},void 0,void 0)}function Be(e){return e}var Ve=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),He=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Ue=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),We=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function Ge(e,t){let n=We[e];return typeof n==`object`?n[t]?n.$:void 0:n}var Ke=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),qe=new Set(`altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-src.font-face-uri.foreignObject.g.glyph.glyphRef.hkern.image.line.linearGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.set.stop.svg.switch.symbol.text.textPath.tref.tspan.use.view.vkern`.split(`.`)),Je={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},Ye=e=>w(()=>e());function Xe(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;)if(t[o]===n[s])o++,s++;else{for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)l&&l.has(t[o])||t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var Ze=`_$DX_DELEGATE`;function Qe(e,t,n,r={}){let i;return b(r=>{i=r,t===document?e():B(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function F(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>E(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function I(e,t=window.document){let n=t[Ze]||(t[Ze]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,dt))}}function L(e,t,n){V(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function $e(e,t,n,r){V(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function et(e,t,n){V(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function tt(e,t){V(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function nt(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function rt(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];r&&r!==`undefined`&&!t[r]&&(lt(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];i&&i!==`undefined`&&n[i]!==o&&o&&(lt(e,i,!0),n[i]=o)}return n}function it(e,t,n){if(!t)return n?L(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function R(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function at(e,t={},n,r){let i={};return r||S(()=>i.children=H(e,t.children,i.children)),S(()=>typeof t.ref==`function`&&z(t.ref,e)),S(()=>ot(e,t,n,!0,i,!0)),i}function z(e,t,n){return E(()=>e(t,n))}function B(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return H(e,t,r,n);S(r=>H(e,t(),r,n),r)}function ot(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=ut(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||H(e,t.children);continue}let s=t[o];i[o]=ut(e,o,s,i[o],n,a,t)}}function st(t){let n,r;return!V()||!(n=e.registry.get(r=ht()))?t():(e.completed&&e.completed.add(n),e.registry.delete(r),n)}function V(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function ct(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function lt(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function ut(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return it(e,n,r);if(t===`classList`)return rt(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=Ke.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(nt(e,i,n,a),a&&I([i]))}else if(t.slice(0,5)===`attr:`)L(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)et(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=He.has(t))||!i&&((u=Ge(t,e.tagName))||(c=Ve.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(V(e))return n;t===`class`||t===`className`?tt(e,n):s&&!c&&!l?e[ct(t)]=n:(t===`value`||t===`defaultValue`)&&(e.nodeName===`INPUT`||e.nodeName===`TEXTAREA`)?e[u||t]=n??``:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Je[t.split(`:`)[0]];r?$e(e,r,t,n):L(e,Ue[t]||t,n)}return n}function dt(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0);try{if(t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}finally{t=n=null}}function H(e,t,n,r,i){let a=V(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=mt(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=mt(e,n,r)}else if(o===`function`)return S(()=>{let i=t();for(;typeof i==`function`;)i=i();n=H(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(ft(o,t,n,i))return S(()=>n=H(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=mt(e,n,r),s)return n}else c?n.length===0?pt(e,o,r):Xe(e,n,o):(n&&mt(e),pt(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=mt(e,n,r,t);mt(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function ft(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=ft(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=ft(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function pt(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function mt(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}function ht(){return e.getNextContextId()}var gt=`http://www.w3.org/2000/svg`;function _t(e,t=!1,n=void 0){return t?document.createElementNS(gt,e):document.createElement(e,{is:n})}function vt(t,n){let r=w(t);return w(()=>{let t=r();switch(typeof t){case`function`:return E(()=>t(n));case`string`:let r=qe.has(t),i=e.context?st():_t(t,r,E(()=>n.is));return at(i,n,r),i}})}function yt(e){let[,t]=Le(e,[`component`]);return vt(()=>e.component,t)}var bt=Symbol(`store-raw`),xt=Symbol(`store-node`),U=Symbol(`store-has`),St=Symbol(`store-self`);function Ct(e){let t=e[i];if(!t&&(Object.defineProperty(e,i,{value:t=new Proxy(e,jt)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function wt(e){let t;return typeof e==`object`&&!!e&&(e[i]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Tt(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[bt])return n;if(!wt(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Tt(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],o[a].get||(i=e[a],(r=Tt(i,t))!==i&&(e[a]=r))}return e}function Et(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Dt(e,t,n){if(e[t])return e[t];let[r,i]=x(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Ot(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===i||t===xt||(delete n.value,delete n.writable,n.get=()=>e[i][t]),n}function kt(e){ae()&&Dt(Et(e,xt),St)()}function At(e){return kt(e),Reflect.ownKeys(e)}var jt={get(e,t,n){if(t===bt)return e;if(t===i)return n;if(t===o)return kt(e),n;let r=Et(e,xt),a=r[t],s=a?a():e[t];if(t===xt||t===U||t===`__proto__`)return s;if(!a){let n=Object.getOwnPropertyDescriptor(e,t);ae()&&(typeof s!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(s=Dt(r,t,s)())}return wt(s)?Ct(s):s},has(e,t){return t===bt||t===i||t===o||t===xt||t===U||t===`__proto__`||(ae()&&Dt(Et(e,U),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:At,getOwnPropertyDescriptor:Ot};function Mt(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[U]&&e[U][t]&&i!==void 0&&e[U][t].$()):(e[t]=n,e[U]&&e[U][t]&&i===void 0&&e[U][t].$());let o=Et(e,xt),s;if((s=Dt(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Dt(o,`length`,a))&&s.$(e.length)}(s=o[St])&&s.$()}function Nt(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];Pt(i)||Mt(e,i,t[i])}}function Pt(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function Ft(e,t){if(typeof t==`function`&&(t=t(e)),t=Tt(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&Mt(e,n,r)}Mt(e,`length`,r)}else Nt(e,t)}function It(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&Pt(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)It(e,[r[i]].concat(t),n);return}if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&It(e,[i].concat(t),n);return}if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)It(e,[r].concat(t),n);return}if(t.length>1){It(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||(r!==void 0||a!=null)&&(a=Tt(a),r===void 0||wt(i)&&wt(a)&&!Array.isArray(a)?Nt(i,a):Mt(e,r,a))}function Lt(...[e,t]){let n=Tt(e||{}),r=Array.isArray(n),i=Ct(n);function a(...e){re(()=>{r&&e.length===1?Ft(n,e[0]):It(n,e)})}return[i,a]}var Rt=`lienzo.frames`,zt=[{id:`a`,path:`/`,width:390,height:844},{id:`b`,path:`/`,width:1280,height:800}];function Bt(){try{let e=JSON.parse(localStorage.getItem(Rt)??`null`);return e?.length?e:zt}catch{return zt}}var[W,Vt]=Lt(Bt()),G=new Map;function Ht(){localStorage.setItem(Rt,JSON.stringify(W))}function Ut(e,t){let n=t<600?844:800;Vt(W.length,{id:crypto.randomUUID(),path:e,width:t,height:n}),Ht()}function Wt(e){Vt(t=>t.filter(t=>t.id!==e)),Ht()}var Gt=`/__lienzo/`,Kt=`${Gt}api/`,qt=`${Gt}bridge.js`,Jt=`files`;async function Yt(e,t){return await(await fetch(Kt+e,{method:`POST`,body:JSON.stringify(t)})).json()}function K(e,t){return Yt(`run`,{name:e,params:t})}function Xt(){return Yt(`undo`,{})}function Zt(){return Yt(`redo`,{})}async function Qt(){return await(await fetch(`${Kt}project`)).json()}var $t=Qt(),[en,tn]=x();$t.then(tn);var[nn,rn]=x(),an=nn;function on(e){rn(e===void 0?void 0:{text:e})}function sn(){rn(void 0)}function cn(e){rn({text:e,undoable:!0})}function ln(e,t){rn({text:e,handoff:t&&un(t,e)})}function un(e,t){let n=Object.entries(e.params).map(([e,t])=>`${e}: ${t}`);return[`lienzo refused this edit to ${en()?.name??`the project`}. Make it in the source by hand.`,`Command: ${e.name}`,...n,`Reason: ${t}`].join(`
|
|
2
|
+
`)}var[q,dn]=x(),[fn,pn]=x(),mn;function hn(e){return typeof e==`object`&&!!e&&`at`in e}function gn({at:e}){let t=q();t&&(mn={frame:t.frame,index:t.index}),dn(e===null||!mn?void 0:{...mn,at:e})}var[_n,vn]=x(0);async function yn(e,t){let n=await e;return n.ok&&hn(n.data)&&gn(n.data),n.ok?t?.name===`element.remove`?cn(`Element deleted.`):sn():ln(n.reason,t),vn(e=>e+1),n}function J(e,t){return yn(K(e,t),{name:e,params:t})}function bn(){return yn(Xt())}function xn(){return yn(Zt())}var[Sn,Cn]=x(!1);function wn(e){return!!e.target?.closest(`input, textarea`)}function Tn(e){wn(e)||Dn(e)}function En(e){On(e)}function Dn(e){let t=()=>e.preventDefault?.();e.key===`Escape`&&dn(void 0),e.key===` `&&(t(),Cn(!0));let n=e.ctrlKey||e.metaKey,r=e.key.toLowerCase();n&&r===`z`&&(t(),e.shiftKey?xn():bn());let i=q();if(i&&i.at!==``){if((e.key===`Delete`||e.key===`Backspace`)&&(t(),J(`element.remove`,{at:i.at})),e.altKey&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){t();let n=e.key===`ArrowUp`?`earlier`:`later`;J(`element.move`,{at:i.at,place:n})}n&&r===`d`&&(t(),J(`element.duplicate`,{at:i.at}))}}function On(e){e.key===` `&&Cn(!1)}var kn=96,[An,jn]=x({x:40,y:40,zoom:.5}),Mn={},Nn={dx:0,dy:0},Pn=!1;function Fn(e,t){Nn={dx:Nn.dx+e,dy:Nn.dy+t},Pn||(Pn=!0,requestAnimationFrame(()=>{let{dx:e,dy:t}=Nn;Nn={dx:0,dy:0},Pn=!1,jn(n=>({...n,x:n.x+e,y:n.y+t}))}))}function In(e,t,n){jn(r=>{let i=Math.min(4,Math.max(.05,r.zoom*n)),a=i/r.zoom;return{zoom:i,x:e-(e-r.x)*a,y:t-(t-r.y)*a}})}function Ln(e,t,n){In(e,t,Math.exp(-n/200))}function Rn(){let{surface:e,layer:t}=Mn;if(!e||!t)return;let n=e.getBoundingClientRect(),r=(n.width-kn)/t.offsetWidth,i=(n.height-kn)/t.offsetHeight,a=Math.min(1,r,i);jn({zoom:a,x:n.left+(n.width-t.offsetWidth*a)/2,y:n.top+(n.height-t.offsetHeight*a)/2})}var zn=`lienzo`,Bn=[`hover`,`focus`,`focus-visible`,`active`];function Vn(e){let t=e;return t?.channel===`lienzo`&&typeof t.id==`number`&&!(`method`in t)}function Hn(e){let t=e;return t?.channel===`lienzo`&&typeof t.event==`string`}var Un=new Map,Wn=0,Gn=e=>e.src?new URL(e.src).origin:location.origin;function Kn(e,t){let n=G.get(e);n?.contentWindow&&n.contentWindow.postMessage(t,Gn(n))}function Y(e,t,n){return new Promise((r,i)=>{let a=++Wn;Un.set(a,{frame:e,method:t,params:n,resolve:r,reject:i}),Kn(e,{channel:zn,id:a,method:t,params:n})})}function qn(e,t,n){Kn(e,{channel:zn,id:++Wn,method:t,params:n})}function Jn(e){for(let[t,n]of Un)n.frame===e&&Kn(e,{channel:zn,id:t,method:n.method,params:n.params})}function Yn(e){let t=Un.get(e.id);t&&(Un.delete(e.id),e.error===void 0?t.resolve(e.result):t.reject(Error(e.error)))}function Xn(e){for(let[t,n]of Un)n.frame===e&&(Un.delete(t),n.reject(Error(`the frame is gone`)))}var[Zn,Qn]=Lt({}),[$n,er]=Lt({}),tr=e=>$n[e]??[],nr=(e,t)=>tr(e).includes(t);function rr(e,t,n){let r=tr(e).filter(e=>e!==t);er(e,n?[...r,t]:r)}var[ir,ar]=x(0,{equals:!1}),or=ir;function sr(){ar(0)}var[cr,lr]=Lt({});function ur(e,t){return{target:{frame:e,...t.ref},tag:t.tag,children:t.children.map(t=>ur(e,t))}}function dr(e,t){lr(e,t.map(t=>ur(e,t)))}function fr(){return q()?.frame??W[0]?.id}function pr(e){return cr[e]??[]}function mr(e,t){for(let n of e){if(gr(n.target,t))return[n];let e=mr(n.children,t);if(e.length>0)return[n,...e]}return[]}function hr(e){return`${e.frame} ${e.at} ${e.index}`}function gr(e,t){return e!==void 0&&t!==void 0&&hr(e)===hr(t)}var[_r,vr]=x(),[yr,br]=Lt([]);function xr(e){br(yr.length,e)}function Sr(e){br(t=>t.filter((t,n)=>n!==e))}function Cr(e,t){let n=e+t;n<0||n>=yr.length||br(t=>{let r=[...t];return[r[e],r[n]]=[r[n],r[e]],r})}function wr(){br([])}function Tr(e){let t=e.nth===void 0?e.at:`${e.at} #${e.nth+1}`;return e.do===`fill`?`type "${e.value}" in ${t}`:e.do===`press`?`press ${e.key} in ${t}`:`${e.do===`click`?`click`:`hover`} ${t}`}var Er=new Map,Dr=(e,t)=>e?.frame===t?{at:e.at,index:e.index}:null;function Or(e,t=!1){let{hover:n,selected:r}=E(()=>({hover:Dr(fn(),e),selected:Dr(q(),e)})),i=JSON.stringify([n,r]);(t||Er.get(e)!==i)&&(Er.set(e,i),qn(e,`track`,{hover:n,selected:r}))}function kr(e){Er.delete(e),Qn(e,void 0)}function Ar(){C(ie(q,()=>{for(let e of Object.keys(Zn))Qn(e,`selected`,null)},{defer:!0})),C(()=>{fn(),q();for(let e of G.keys())Or(e)})}function jr(e){Xn(e),kr(e)}async function Mr(e){if(e===fr())try{dr(e,await Y(e,`layers`,{}))}catch{return}}function Nr(e){for(let[t,n]of G)if(n.contentWindow===e.source)return e.origin===Gn(n)?t:void 0}function Pr(e,t){let n=t.event,r=t.data;if(n===`ready`){Jn(e),Or(e,!0);for(let t of tr(e))Y(e,`hide`,{at:t,hidden:!0});_r()===e&&Y(e,`record`,{on:!0})}if(n===`step`&&xr(r),(n===`ready`||n===`changed`)&&(sr(),Mr(e)),n===`hover`){let t=r;pn(t?{frame:e,...t}:void 0)}if(n===`select`){let t=r;dn(t?{frame:e,...t}:void 0)}if(n===`boxes`&&Qn(e,r),n===`key`){let e=r;e.type===`keydown`?Dn(e):On(e)}if(n===`pan`){let{dx:e,dy:t}=r;Fn(e,t)}if(n===`wheel`){let{x:t,y:n,deltaY:i}=r,a=G.get(e),o=a.getBoundingClientRect(),s=o.width/a.offsetWidth;Ln(o.x+t*s,o.y+n*s,i)}}function Fr(e){let t=Nr(e);t&&(Vn(e.data)?Yn(e.data):Hn(e.data)&&Pr(t,e.data))}function Ir(){window.addEventListener(`message`,Fr),b(()=>{Ar(),C(()=>{let e=fr();e&&Mr(e)})})}var Lr=`/__lz/role`;async function Rr(){try{let e=await fetch(Lr);if(!e.ok)return`live`;let{role:t}=await e.json();return t===`viewer`?`snapshot`:`live`}catch{return`live`}}var zr=await Rr();function Br(){let[e,t]=x(!0);return{watch:e=>{let n=new IntersectionObserver(([e])=>t(e.isIntersecting),{rootMargin:`50%`});return n.observe(e),()=>n.disconnect()},parked:w(()=>!e()||An().zoom<.25)}}var Vr=`data-lz-keep`,Hr=`data-lz-adopted`,Ur=`http://www.w3.org/1999/xlink`;function Wr(e,t,n){t.startsWith(`xlink:`)?e.setAttributeNS(Ur,t,n):e.setAttribute(t,n),e instanceof HTMLInputElement&&t===`value`&&(e.value=n),e instanceof HTMLInputElement&&t===`checked`&&(e.checked=!0),e instanceof HTMLOptionElement&&t===`selected`&&(e.selected=!0)}function Gr(e,t){e.removeAttribute(t),e instanceof HTMLInputElement&&t===`checked`&&(e.checked=!1),e instanceof HTMLOptionElement&&t===`selected`&&(e.selected=!1)}var Kr=class{page;#e=new Map;constructor(e){this.page=e}apply(e){if(e.kind===`snapshot`)this.#t(e);else for(let t of e.ops)this.#s(t)}#t({root:e,adopted:t}){let n=this.page.documentElement;this.#e.clear(),this.#e.set(e.i,n);for(let{name:e}of[...n.attributes])n.removeAttribute(e);if(`t`in e){this.#r(n,e.a);for(let t of e.c)this.#n(t)}this.#o(t)}#n(e){if(!(`t`in e))return;let t=e.t===`head`?this.page.head:e.t===`body`?this.page.body:void 0;if(t){this.#e.set(e.i,t);for(let{name:e}of[...t.attributes])t.removeAttribute(e);this.#r(t,e.a),this.#a(t,e.c)}}#r(e,t){for(let[n,r]of t)Wr(e,n,r)}#i(e){if(`x`in e){let t=this.page.createTextNode(e.x);return this.#e.set(e.i,t),t}let t=e.n?this.page.createElementNS(e.n,e.t):this.page.createElement(e.t);return this.#e.set(e.i,t),this.#r(t,e.a),t.append(...e.c.map(e=>this.#i(e))),t}#a(e,t){let n=e===this.page.head?[...this.page.head.querySelectorAll(`:scope > [${Vr}]`)]:[],r=e===this.page.head?[...this.page.head.querySelectorAll(`:scope > [${Hr}]`)]:[];e.replaceChildren(...n,...t.map(e=>`ref`in e?this.#e.get(e.ref):this.#i(e)).filter(e=>e!==void 0),...r)}#o(e){for(let e of this.page.head.querySelectorAll(`:scope > [${Hr}]`))e.remove();for(let t of e){let e=this.page.createElement(`style`);e.setAttribute(Hr,``),e.textContent=t,this.page.head.append(e)}}#s(e){if(e.op===`adopted`)return this.#o(e.sheets);let t=this.#e.get(e.i);t&&(e.op===`children`?t instanceof Element&&this.#a(t,e.list):e.op===`text`||e.op===`css`?t.textContent=e.x:t instanceof Element&&(e.value===null?Gr(t,e.name):Wr(t,e.name,e.value)))}},qr=`/__lz/mirror`,Jr=1e3,Yr=({width:e,height:t,path:n})=>`${e}x${t}:${n}`,Xr=()=>`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="script-src 'self'; object-src 'none'; frame-src 'none'" ${Vr}></head><body></body></html>`;function Zr(e,t){t.setAttribute(Vr,``),e.head.append(t)}function Qr(e,t){let n=e.createElement(`base`);n.href=new URL(t.path,location.href).href,Zr(e,n);let r=e.createElement(`script`);r.src=qt,Zr(e,r)}function $r(e){let t=new URL(qr,location.href);return t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.searchParams.set(`frame`,Yr(e)),t.href}function ei(e,t){let n=e.contentDocument,r=new Kr(n),i,a=!1;Qr(n,t);let o=()=>{i=new WebSocket($r(t)),i.onmessage=e=>r.apply(JSON.parse(e.data).packet),i.onclose=()=>{a||setTimeout(o,Jr)}};return o(),()=>{a=!0,i?.close()}}var ti=F(`<div class=shrink-0><div class="group mb-2 flex items-center gap-2 text-muted"style=font-size:12px><span class="font-mono text-ink"></span><span> × </span><button type=button class="ml-auto rounded px-1 opacity-0 hover:bg-line group-hover:opacity-100"title="Remove frame"aria-label="Remove frame">×</button></div><iframe class="block bg-white shadow-[0_0_0_1px_rgb(255_255_255/0.08),0_16px_48px_rgb(0_0_0/0.5)]"style=border:0>`),ni=`data-lienzo-bridge`;function ri(e,t,n,r){let i=e.createElement(`script`);n&&(i.type=`module`),r&&i.setAttribute(r,``),i.src=t,e.head.append(i)}function ii(e,t){try{let n=e.contentDocument;if(!n?.head)return;n.querySelector(`script[${ni}]`)||ri(n,qt,!1,ni),t!==null&&!n.querySelector(`script[src="${t}"]`)&&ri(n,t,!0)}catch{return}}function ai(e){let t,n,r,i=Br();function a(){zr===`snapshot`?n??=ei(t,e.frame):$t.then(({client:e})=>ii(t,e))}function o(){q()?.frame===e.frame.id&&dn(void 0),Wt(e.frame.id)}return O(()=>{r?.(),G.delete(e.frame.id),jr(e.frame.id),n?.()}),(()=>{var n=ti(),s=n.firstChild,c=s.firstChild,l=c.nextSibling,u=l.firstChild,d=l.nextSibling,f=s.nextSibling;return B(c,()=>e.frame.path),B(l,()=>e.frame.width,u),B(l,()=>e.frame.height,null),d.$$click=o,f.addEventListener(`load`,a),z(n=>{t=n,G.set(e.frame.id,n),r=i.watch(n)},f),S(t=>{var n=`${e.frame.path} ${e.frame.width}`,r=zr===`live`?e.frame.path:void 0,a=zr===`snapshot`?Xr():void 0,o=`${e.frame.width}px`,s=`${e.frame.height}px`,c=i.parked()?`hidden`:`visible`;return n!==t.e&&L(f,`title`,t.e=n),r!==t.t&&L(f,`src`,t.t=r),a!==t.a&&L(f,`srcdoc`,t.a=a),o!==t.o&&R(f,`width`,t.o=o),s!==t.i&&R(f,`height`,t.i=s),c!==t.n&&R(f,`content-visibility`,t.n=c),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),n})()}I([`click`]);var oi=F(`<div class="fixed inset-0 z-10 cursor-grab">`),si=F(`<div class="relative min-w-0 flex-1 overflow-hidden"data-surface><div class="fixed top-0 left-0 flex w-max items-start gap-20"style="transform-origin:0 0">`);function ci(e){let t=e.currentTarget,n=e=>Fn(e.movementX,e.movementY);t.setPointerCapture(e.pointerId),t.addEventListener(`pointermove`,n),t.addEventListener(`pointerup`,()=>t.removeEventListener(`pointermove`,n),{once:!0})}function li(e){e.preventDefault(),e.ctrlKey||e.metaKey?Ln(e.clientX,e.clientY,e.deltaY):Fn(-e.deltaX,-e.deltaY)}function ui(){let e,t;function n(n){n.button===1?(n.preventDefault(),ci(n)):(n.target===e||n.target===t)&&(dn(void 0),ci(n))}return D(()=>{Mn.surface=e,Mn.layer=t,window.addEventListener(`keydown`,Tn),window.addEventListener(`keyup`,En),e.addEventListener(`wheel`,li,{passive:!1}),Rn()}),O(()=>{window.removeEventListener(`keydown`,Tn),window.removeEventListener(`keyup`,En)}),(()=>{var r=si(),i=r.firstChild;r.$$pointerdown=n;var a=e;typeof a==`function`?z(a,r):e=r;var o=t;return typeof o==`function`?z(o,i):t=i,B(i,M(N,{each:W,children:e=>M(ai,{frame:e})})),B(r,M(P,{get when(){return Sn()},get children(){var e=oi();return e.$$pointerdown=ci,e}}),null),S(e=>{var t=!!Sn(),n=`translate(${An().x}px, ${An().y}px) scale(${An().zoom})`;return t!==e.e&&r.classList.toggle(`cursor-grab`,e.e=t),n!==e.t&&R(i,`transform`,e.t=n),e},{e:void 0,t:void 0}),r})()}I([`pointerdown`]);var di=[`top`,`right`,`bottom`,`left`];function fi(e,t){let{x:n,y:r,width:i,height:a}=e,o=a-t.top-t.bottom;return{top:{x:n,y:r,width:i,height:t.top},right:{x:n+i-t.right,y:r+t.top,width:t.right,height:o},bottom:{x:n,y:r+a-t.bottom,width:i,height:t.bottom},left:{x:n,y:r+t.top,width:t.left,height:o}}}function pi(e,t,n){let r=fi(t,n);return di.map(t=>({kind:e,side:t,value:n[t],...r[t]})).filter(e=>e.width>0&&e.height>0)}function mi(e,t,n,r){let i={x:e.x-t.left,y:e.y-t.top,width:e.width+t.left+t.right,height:e.height+t.top+t.bottom},a={x:e.x+n.left,y:e.y+n.top,width:e.width-n.left-n.right,height:e.height-n.top-n.bottom};return[...pi(`margin`,i,t),...pi(`padding`,a,r)]}var hi=[`margin`,`border`,`padding`].flatMap(e=>di.map(t=>e===`border`?`border-${t}-width`:`${e}-${t}`));function gi(e,t){let n=n=>Number.parseFloat(e[t(n)]??`0`)||0;return{top:n(`top`),right:n(`right`),bottom:n(`bottom`),left:n(`left`)}}var[_i]=T(()=>{let e=q();return e?{target:e,page:or()}:void 0},async({target:e})=>{let t=await Y(e.frame,`computed`,{ref:e,properties:hi}).catch(()=>null);if(t)return{margin:gi(t,e=>`margin-${e}`),border:gi(t,e=>`border-${e}-width`),padding:gi(t,e=>`padding-${e}`)}}),vi=F(`<div class="pointer-events-none fixed inset-0 z-10"data-overlay>`),yi=F(`<div class="absolute overflow-hidden"data-spacing>`),bi=F(`<div class="absolute flex items-center justify-center overflow-hidden font-mono"style=font-size:10px>`),xi=F(`<div class="absolute outline outline-1 outline-accent/60">`),Si=F(`<div class="absolute outline outline-2 outline-accent"data-selection><span class="absolute left-0 bg-accent px-1 font-mono whitespace-nowrap text-on-accent"style=bottom:100%;font-size:10px;line-height:16px>`);function Ci(e,t){if(!e)return;let n=G.get(e.frame),r=Zn[e.frame]?.[t];if(!n||!r)return;let i=n.getBoundingClientRect(),a=i.width/n.offsetWidth,o=Math.max(i.left,i.left+r.x*a),s=Math.max(i.top,i.top+r.y*a),c=Math.min(i.right,i.left+(r.x+r.width)*a),l=Math.min(i.bottom,i.top+(r.y+r.height)*a);if(c<=o||l<=s)return;let u=`${Math.round(r.width)} × ${Math.round(r.height)}`,d=`${r.tag} ${u}`;return{x:o,y:s,width:c-o,height:l-s,label:d}}function wi(e){let t=_i.latest;if(!e||!t)return;let n=G.get(e.frame),r=Zn[e.frame]?.selected;if(!n||!r)return;let i=n.getBoundingClientRect(),a=i.width/n.offsetWidth,o=mi(r,t.margin,t.border,t.padding).map(e=>({...e,x:e.x*a,y:e.y*a,width:e.width*a,height:e.height*a}));return{frame:{x:i.left,y:i.top,width:i.width,height:i.height,label:``},bands:o}}function Ti(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ei(e,t){return e?.x===t?.x&&e?.y===t?.y&&e?.width===t?.width&&e?.height===t?.height}function Di(e){return{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`}}function Oi(){let[e,t]=x(void 0,{equals:Ei}),[n,r]=x(void 0,{equals:Ei}),[i,a]=x(void 0,{equals:Ti}),o=requestAnimationFrame(function e(){t(Ci(fn(),`hover`)),r(Ci(q(),`selected`)),a(wi(q())),o=requestAnimationFrame(e)});return O(()=>cancelAnimationFrame(o)),(()=>{var t=vi();return B(t,M(P,{get when(){return i()},children:e=>(()=>{var t=yi();return B(t,M(N,{get each(){return e().bands},children:e=>(()=>{var t=bi();return B(t,(()=>{var t=Ye(()=>e.height>=12&&e.width>=14);return()=>t()?e.value:``})()),S(n=>{var r=e.kind===`margin`,i=e.kind===`padding`,a=`${e.kind}-${e.side}`,o=`${e.x}px`,s=`${e.y}px`,c=`${e.width}px`,l=`${e.height}px`;return r!==n.e&&t.classList.toggle(`bg-orange-400/40`,n.e=r),i!==n.t&&t.classList.toggle(`bg-green-400/40`,n.t=i),a!==n.a&&L(t,`data-band`,n.a=a),o!==n.o&&R(t,`left`,n.o=o),s!==n.i&&R(t,`top`,n.i=s),c!==n.n&&R(t,`width`,n.n=c),l!==n.s&&R(t,`height`,n.s=l),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),t})()})),S(n=>it(t,Di(e().frame),n)),t})()}),null),B(t,M(P,{get when(){return e()},children:e=>(()=>{var t=xi();return S(n=>it(t,Di(e()),n)),t})()}),null),B(t,M(P,{get when(){return n()},children:e=>(()=>{var t=Si(),n=t.firstChild;return B(n,()=>e().label),S(n=>it(t,Di(e()),n)),t})()}),null),t})()}var ki=F(`<p>`);function X(e){return(()=>{var t=ki();return B(t,()=>e.children),S(()=>tt(t,`px-3 py-4 text-muted ${e.class??``}`.trim())),t})()}var Ai=F(`<section class="border-b border-line px-3 py-3"><h2 class="mb-2 text-muted"style=font-size:11px>`);function Z(e){return(()=>{var t=Ai(),n=t.firstChild;return B(n,()=>e.label),B(t,()=>e.children,null),t})()}var ji=F(`<input autocomplete=off>`),Mi=F(`<textarea>`),Ni=`w-full rounded border border-line bg-raised px-2 py-1.5 outline-none focus:border-accent`;function Pi(e,t){return[Ni,e.mono?`font-mono`:``,t??``].filter(Boolean).join(` `)}function Q(e){let[t,n]=Le(e,[`class`,`mono`]);return(()=>{var e=ji();return L(e,`spellcheck`,!1),at(e,Ie(n,{get class(){return Pi(t,t.class)}}),!1,!1),e})()}function Fi(e){let[t,n]=Le(e,[`class`,`mono`]);return(()=>{var e=Mi();return at(e,Ie(n,{get class(){return Pi(t,`resize-none ${t.class??``}`.trim())}}),!1,!1),e})()}var Ii=[{label:`Padding`,prefix:`p`,steps:[`0`,`1`,`2`,`3`,`4`,`6`,`8`,`12`]},{label:`Gap`,prefix:`gap`,steps:[`0`,`1`,`2`,`3`,`4`,`6`,`8`]},{label:`Text`,prefix:`text`,steps:[`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`4xl`]},{label:`Radius`,prefix:`rounded`,steps:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}],Li=F(`<div class="flex flex-wrap gap-1">`),Ri=F(`<button type=button class="min-w-7 rounded border px-1.5 py-1 font-mono"style=font-size:11px>`),zi=F(`<div class="mb-2 flex flex-wrap gap-1">`),Bi=F(`<span class="flex items-center gap-1 rounded bg-line/70 py-0.5 pr-1 pl-1.5 font-mono"style=font-size:11px><button type=button class="text-muted hover:text-ink">×`),Vi=F(`<form>`);function Hi(e){return(()=>{var t=Li();return B(t,M(N,{get each(){return e.scale.steps},children:t=>{let n=`${e.scale.prefix}-${t}`,r=()=>e.classes.includes(n);return(()=>{var i=Ri();return i.$$click=()=>r()?e.remove(n):e.set(n),L(i,`title`,n),B(i,t),S(e=>{var t={"border-accent bg-accent text-on-accent":r(),"border-line hover:border-muted":!r()},n=r();return e.e=rt(i,t,e.e),n!==e.t&&L(i,`aria-pressed`,e.t=n),e},{e:void 0,t:void 0}),i})()}})),t})()}function Ui(e){return(()=>{var t=zi();return B(t,M(N,{get each(){return e.classes},children:t=>(()=>{var n=Bi(),r=n.firstChild;return B(n,t,r),r.$$click=()=>e.remove(t),L(r,`title`,`Remove ${t}`),n})()})),t})()}function Wi(e){let t;function n(n){n.preventDefault();let r=t.value.trim();r&&(t.value=``,e.set(r))}return(()=>{var r=Vi();return r.addEventListener(`submit`,n),B(r,M(Q,{ref(e){var n=t;typeof n==`function`?n(e):t=e},mono:!0,name:`class`,get placeholder(){return`Add a class, for example ${e.example}`},style:{"font-size":`12px`}})),r})()}function Gi(e){let t=()=>e.list.split(/\s+/).filter(Boolean),n=t=>void J(`class.set`,{at:e.at,class:t}),r=t=>void J(`class.remove`,{at:e.at,class:t});return[M(P,{get when(){return en()?.tailwind},get children(){return M(N,{each:Ii,children:e=>M(Z,{get label(){return e.label},get children(){return M(Hi,{scale:e,get classes(){return t()},set:n,remove:r})}})})}}),M(Z,{label:`Classes`,get children(){return[M(Ui,{get classes(){return t()},remove:r}),M(Wi,{set:n,get example(){return en()?.tailwind?`md:p-8`:`card`}})]}})]}I([`click`]);var Ki=F(`<button type=button>`),qi=`rounded border border-line px-2 py-1 hover:border-muted disabled:opacity-50`;function $(e){let[t,n]=Le(e,[`class`]);return(()=>{var e=Ki();return at(e,Ie(n,{get class(){return Ye(()=>!!t.class)()?`${qi} ${t.class}`:qi}}),!1,!1),e})()}var Ji=F(`<p class="mt-2 text-muted">This tag renders <!> times here. A change reaches all of them.`),Yi=F(`<section class="border-b border-line px-3 py-3"><div class=font-mono style=font-size:13px><<!>></div><div class="mt-1 font-mono break-all text-muted"style=font-size:11px></div><div class="mt-2 flex gap-2">`);function Xi(e){let[t]=T(()=>({target:e.target,page:or()}),({target:e})=>Y(e.frame,`count`,{at:e.at}).catch(()=>0)),n=()=>t.latest??0,r=()=>e.target.at;return(()=>{var t=Yi(),i=t.firstChild,a=i.firstChild.nextSibling;a.nextSibling;var o=i.nextSibling,s=o.nextSibling;return B(i,()=>e.tag,a),B(o,()=>e.target.at),B(t,M(P,{get when(){return n()>1},get children(){var e=Ji(),t=e.firstChild.nextSibling;return t.nextSibling,B(e,n,t),e}}),s),B(s,M($,{title:`Ctrl+D`,onClick:()=>void J(`element.duplicate`,{at:r()}),children:`Duplicate`}),null),B(s,M($,{title:`Del`,onClick:()=>void J(`element.remove`,{at:r()}),children:`Delete`}),null),B(s,M($,{title:`Alt+↑`,onClick:()=>void J(`element.move`,{at:r(),place:`earlier`}),children:`Move up`}),null),B(s,M($,{title:`Alt+↓`,onClick:()=>void J(`element.move`,{at:r(),place:`later`}),children:`Move down`}),null),t})()}async function Zi(e){let t=(await Promise.all(e.map(e=>K(`rule.find`,e)))).flatMap(e=>e.ok?[e.data]:[]);return t.filter((e,n)=>t.findIndex(t=>$i(t,e))===n)}var Qi=e=>[e.file,e.selector,e.condition].join(`
|
|
3
|
+
`),$i=(e,t)=>Qi(e)===Qi(t);async function ea(e){let t=await K(`rule.get`,{at:e});return t.ok?[t.data]:[]}async function ta(e){let t=await K(`style.get`,{at:e});return t.ok?t.data:void 0}async function na(e){let t=await K(`element.get`,{at:e});if(!t.ok){on(t.reason);return}let n=t.data,[r,i]=await Promise.all([n.classes===null?ea(e):[],ta(e)]);return{at:e,data:n,module:r,style:i}}function ra(e){let t=e.filter(e=>e.condition===``).at(-1);return t&&{source:`rule`,file:t.file,selector:t.selector,declarations:[]}}function ia(e){let t=e.latest;return t&&t.at===q()?.at?t:void 0}var aa=F(`<div class="flex items-center gap-2 py-1"><span class="min-w-0 flex-1 truncate font-mono"style=font-size:11px>`),oa=F(`<input type=color class="h-6 w-6 shrink-0 cursor-pointer rounded border border-line bg-raised">`);function sa(e){let t=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return t?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:/^#[0-9a-f]{6}$/i.test(e)?e:void 0}function ca(e){return(()=>{var t=aa(),n=t.firstChild;return B(n,()=>e.label),B(t,M(P,{get when(){return sa(e.value)},children:t=>(()=>{var n=oa();return n.addEventListener(`change`,t=>e.set(t.currentTarget.value)),S(()=>L(n,`aria-label`,`Color of ${e.name}`)),S(()=>n.value=t()),n})()}),null),B(t,M(Q,{mono:!0,get name(){return e.name},get"aria-label"(){return`Value of ${e.name}`},get title(){return e.value},class:`w-24 shrink-0 px-1.5 py-1`,style:{"font-size":`11px`},get value(){return e.value},onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&(t.currentTarget.value=e.value,t.currentTarget.blur())},onBlur:t=>{let n=t.currentTarget.value;n!==e.value&&e.set(n)}}),null),S(()=>L(t,`title`,e.title??e.name)),t})()}var la=F(`<form class=mt-2>`),ua=F(`<div class="font-mono text-accent"data-condition style=font-size:11px>`),da=F(`<div class=font-mono style=font-size:12px>`),fa=F(`<div class="mt-1 mb-2 font-mono break-all text-muted"style=font-size:11px>`);function pa(e){let t=e.trim().replace(/;$/,``),n=t.indexOf(`:`);return n>0?[t.slice(0,n).trim(),t.slice(n+1).trim()]:void 0}function ma(e){let t;async function n(n){if(n.preventDefault(),!t.value.trim())return;let r=pa(t.value);r?(await e.set(...r)).ok&&(t.value=``):on(`Write the declaration as property: value, for example gap: 8px`)}return(()=>{var e=la();return e.addEventListener(`submit`,n),B(e,M(Q,{ref(e){var n=t;typeof n==`function`?n(e):t=e},mono:!0,name:`declaration`,"aria-label":`Add declaration`,placeholder:`Add, for example gap: 8px`,style:{"font-size":`12px`}})),e})()}function ha(e){let t=(t,n)=>J(`rule.set`,{file:e.rule.file,selector:e.rule.selector,condition:e.rule.condition,property:t,value:n}),n=t=>e.rule.declarations.find(e=>e.property===t)?.value??``;return M(Z,{label:`CSS rule`,get children(){return[M(P,{get when(){return e.rule.condition},get children(){var t=ua();return B(t,()=>e.rule.condition),t}}),(()=>{var t=da();return B(t,()=>e.rule.selector),t})(),(()=>{var t=fa();return B(t,()=>e.rule.file),t})(),M(N,{get each(){return e.rule.declarations.map(e=>e.property)},children:e=>M(ca,{name:e,label:e,get value(){return n(e)},set:n=>void t(e,n)})}),M(ma,{set:t})]}})}var ga=F(`<div class="flex flex-wrap gap-2">`),_a=F(`<div class="mt-3 flex items-center justify-between"><span class=text-muted> animations`),va=F(`<p class="mt-3 text-muted">No animation runs in this frame.`),ya=F(`<label class="mt-2 block"><span class="flex justify-between font-mono"style=font-size:11px><span class=truncate></span><span class=text-muted> ms</span></span><input type=range class=w-full min=0>`),ba=8;function xa(e){let[t,n]=x([]),r=e.target.frame;O(()=>void Y(r,`pseudo`,{ref:null,states:[]}).catch(()=>null));async function i(r){let i=t().includes(r)?t().filter(e=>e!==r):[...t(),r];await Y(e.target.frame,`pseudo`,{ref:e.target,states:i}),n(i)}return(()=>{var e=ga();return B(e,M(N,{each:Bn,children:e=>M($,{get classList(){return{"border-accent":t().includes(e)}},get"aria-pressed"(){return t().includes(e)},onClick:()=>void i(e),get children(){return[`:`,e]}})})),e})()}function Sa(e){let[t,{refetch:n}]=T(()=>({frame:e.frame,page:or()}),({frame:e})=>Y(e,`animations`,{}).catch(()=>[])),[r,i]=x(!1),a=()=>r()?t.latest:t.latest?.slice(0,ba),o=()=>r()?0:Math.max(0,(t.latest?.length??0)-ba),s=()=>(t.latest??[]).every(e=>e.paused);async function c(t,r){await Y(e.frame,`scrub`,{index:t,time:r}),n()}async function l(){await Y(e.frame,`playback`,{paused:!s()}),n()}return M(P,{get when(){return(t.latest??[]).length>0},get fallback(){return va()},get children(){return[(()=>{var e=_a(),n=e.firstChild,r=n.firstChild;return B(n,()=>t.latest?.length,r),B(e,M($,{onClick:()=>void l(),get children(){return s()?`Resume`:`Pause`}}),null),e})(),M(N,{get each(){return a()},children:e=>(()=>{var t=ya(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.firstChild,o=n.nextSibling;return B(r,()=>e.name),B(i,()=>Math.round(e.time),a),o.$$input=t=>void c(e.index,Number(t.currentTarget.value)),S(()=>L(o,`max`,Math.max(e.duration,e.time))),S(()=>o.value=e.time),t})()}),M(P,{get when(){return o()>0},get children(){return M($,{class:`mt-2`,onClick:()=>i(!0),get children(){return[`Show `,Ye(()=>o()),` more`]}})}})]}})}function Ca(e){return M(Z,{label:`State and animation`,get children(){return[M(P,{get when(){return`${e.target.at}#${e.target.index}`},keyed:!0,children:t=>M(xa,{get target(){return e.target}})}),M(Sa,{get frame(){return e.target.frame}})]}})}I([`input`]);var wa=F(`<datalist id=lienzo-tags>`),Ta=F(`<div class="mt-2 flex flex-wrap gap-2">`),Ea=F(`<option>`),Da=[`div`,`section`,`p`,`span`,`a`,`button`,`ul`,`li`,`h2`,`h3`,`img`];function Oa(e){let[t,n]=x(`div`);return M(Z,{label:`New tag`,get children(){return[M(Q,{mono:!0,name:`tag`,list:`lienzo-tags`,get value(){return t()},onInput:e=>n(e.currentTarget.value.trim())}),(()=>{var e=wa();return B(e,M(N,{each:Da,children:e=>(()=>{var t=Ea();return t.value=e,t})()})),e})(),(()=>{var n=Ta();return B(n,M($,{onClick:()=>void J(`element.wrap`,{at:e.at,tag:t()}),children:`Wrap`}),null),B(n,M($,{onClick:()=>void J(`element.insert`,{at:e.at,tag:t(),place:`inside`}),children:`Insert inside`}),null),B(n,M($,{onClick:()=>void J(`element.insert`,{at:e.at,tag:t(),place:`after`}),children:`Insert after`}),null),n})()]}})}var ka=[{label:`Layout`,properties:[`display`,`flex-direction`,`align-items`,`justify-content`,`gap`]},{label:`Size`,properties:[`width`,`height`]},{label:`Padding`,properties:[`padding-top`,`padding-right`,`padding-bottom`,`padding-left`]},{label:`Margin`,properties:[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`]},{label:`Text`,properties:[`font-size`,`font-weight`,`line-height`,`text-align`,`color`]},{label:`Background and border`,properties:[`background-color`,`border-radius`]}],Aa=ka.flatMap(e=>e.properties);function ja(e,t){return e.filter(e=>e.width<=t).at(-1)}var Ma=e=>Number(e).toString(16).padStart(2,`0`);function Na(e){let t=/^rgba?\((\d+), (\d+), (\d+)(?:, 1)?\)$/.exec(e);return t?`#${Ma(t[1])}${Ma(t[2])}${Ma(t[3])}`:e}var Pa=F(`<button type=button role=radio class="rounded border px-2 py-1">`),Fa=F(`<div role=radiogroup aria-label="Where it applies"class="flex flex-wrap gap-1">`),Ia=F(`<div data-style>`);function La(e){let[t]=T(()=>({target:e(),page:or(),revision:_n()}),({target:e})=>Y(e.frame,`computed`,{ref:e,properties:[...Aa]}).catch(()=>null));return()=>t.latest??{}}function Ra(e){let t=(t,n)=>(()=>{var r=Pa();return r.$$click=()=>e.setEverywhere(t),B(r,n),S(n=>{var i=e.everywhere===t,a={"border-accent bg-accent text-on-accent":e.everywhere===t,"border-line hover:border-muted":e.everywhere!==t};return i!==n.e&&L(r,`aria-checked`,n.e=i),n.t=rt(r,a,n.t),n},{e:void 0,t:void 0}),r})();return(()=>{var n=Fa();return B(n,()=>t(!1,e.narrow),null),B(n,()=>t(!0,`All screens`),null),n})()}function za(e){let t=La(()=>e.target),[n,r]=x(!1),i=()=>{let t=W.find(t=>t.id===e.target.frame),n=e.style;return n.source===`tailwind`&&t?ja(n.breakpoints,t.width):void 0},a=()=>n()?``:i()?.name??``,o=()=>{let t=e.style;if(t.source===`rule`)return e.rules.filter(e=>e.file===t.file&&e.selector===t.selector&&e.condition!==``).at(-1)?.condition},s=()=>{let e=i();if(e)return`From ${e.width} px (${e.name})`;let t=o();return t&&`Only with ${t}`},c=(t,r)=>{let i=e.style,s=n()?``:o()??``;i.source===`rule`?J(`rule.set`,{file:i.file,selector:i.selector,condition:s,property:t,value:r}):J(`style.set`,{at:e.target.at,property:t,value:r,variant:a()})};return(()=>{var e=Ia();return B(e,M(P,{get when(){return s()},children:e=>M(Z,{label:`Style`,get children(){return M(Ra,{get narrow(){return e()},get everywhere(){return n()},setEverywhere:r})}})}),null),B(e,M(N,{each:ka,children:e=>M(Z,{get label(){return e.label},get children(){return M(N,{get each(){return e.properties},children:e=>M(ca,{name:`style-${e}`,label:e,get value(){return Na(t()[e]??``)},title:`${e}, as the browser computes it in this frame`,set:t=>c(e,t)})})}})}),null),e})()}I([`click`]);function Ba(e){return M(Z,{label:`Element text`,get children(){return M(Fi,{name:`text`,rows:2,get value(){return e.text},onChange:t=>J(`text.set`,{at:e.at,text:t.currentTarget.value})})}})}function Va(e){let t=()=>e.read.data,n=w(()=>{let t=e.page,n=e=>t.some(t=>$i(t,e));return[...t,...e.read.module.filter(e=>!n(e))]}),r=()=>e.read.style??ra(n());return[M(Xi,{get target(){return e.target},get tag(){return t().tag}}),M(Oa,{get at(){return e.target.at}}),M(P,{get when(){return t().text!==null},get children(){return M(Ba,{get at(){return e.target.at},get text(){return t().text??``}})}}),M(P,{get when(){return t().classes!==null},get fallback(){return M(P,{get when(){return n().length===0},get children(){return M(X,{children:`Code computes this element's classes, so there is no single text to change. Ask an agent for the change with this location.`})}})},get children(){return M(Gi,{get at(){return e.target.at},get list(){return t().classes??``}})}}),M(N,{get each(){return n().map(Qi)},children:e=>M(ha,{get rule(){return n().find(t=>Qi(t)===e)}})}),M(P,{get when(){return r()},children:t=>M(za,{get target(){return e.target},get style(){return t()},get rules(){return n()}})}),M(Ca,{get target(){return e.target}})]}var Ha=F(`<section class="px-3 py-3"data-page-only><div class=font-mono style=font-size:13px><<!>></div><p class="mt-1 text-muted">No line of this project's code renders this element (a library renders it, or the page is not part of the project), so it is read-only.</p><dl class="mt-2 font-mono"style=font-size:11px>`),Ua=F(`<div class="flex justify-between gap-2"><dt class=text-muted></dt><dd class=truncate>`),Wa=[`display`,`width`,`height`,`color`,`background-color`,`font-size`];function Ga(e){let[t]=T(()=>({target:e.target,page:or()}),({target:e})=>Y(e.frame,`computed`,{ref:e,properties:Wa}).catch(()=>null)),n=()=>mr(pr(e.target.frame),e.target).at(-1)?.tag??`element`;return(()=>{var e=Ha(),r=e.firstChild,i=r.firstChild.nextSibling;i.nextSibling;var a=r.nextSibling.nextSibling;return B(r,n,i),B(a,M(N,{get each(){return Object.entries(t.latest??{})},children:([e,t])=>(()=>{var n=Ua(),r=n.firstChild,i=r.nextSibling;return B(r,e),B(i,t),n})()})),e})()}var Ka=F(`<aside class="z-20 w-72 shrink-0 overflow-y-auto border-l border-line bg-panel"data-inspector>`);function qa(){let[e]=T(()=>{let e=q();return e?.at?{at:e.at,revision:_n()}:void 0},({at:e})=>na(e)),[t]=T(()=>{let e=q();return e?.at?{target:e,revision:_n(),page:or()}:void 0},async({target:e})=>{let t=await Y(e.frame,`matched`,{ref:e}).catch(()=>null);return{at:e.at,rules:t?await Zi(t):[]}}),n=()=>{let n=ia(e),r=ia(t)?.rules;return n&&r&&{read:n,rules:r}};return(()=>{var e=Ka();return B(e,M(P,{get when(){return q()},get fallback(){return M(X,{children:`Select an element in a frame to edit it.`})},children:e=>M(P,{get when(){return e().at!==``},get fallback(){return M(Ga,{get target(){return e()}})},get children(){return M(P,{get when(){return n()},children:t=>M(Va,{get target(){return e()},get read(){return t().read},get page(){return t().rules}})})}})})),e})()}var Ja=F(`<button type=button class="mt-2 block rounded bg-ground/15 px-2 py-1 hover:bg-ground/25">`),Ya=F(`<pre data-handoff class="mt-2 whitespace-pre-wrap select-text">`);function Xa(e){let[t,n]=x(),r=()=>navigator.clipboard.writeText(e.text).then(()=>n(`yes`),()=>n(`no`));return[(()=>{var e=Ja();return e.$$click=()=>void r(),B(e,()=>t()===`yes`?`Copied`:`Copy for an agent`),e})(),M(P,{get when(){return t()===`no`},get children(){var t=Ya();return B(t,()=>e.text),t}})]}I([`click`]);var Za=F(`<button type=button class="ml-3 rounded bg-ground/15 px-2 py-0.5 hover:bg-ground/25">Restore`),Qa=F(`<div role=status class="fixed bottom-4 left-1/2 z-30 max-w-xl -translate-x-1/2 rounded bg-ink px-3 py-2 text-ground">`);function $a(){return M(P,{get when(){return an()},children:e=>(()=>{var t=Qa();return B(t,()=>e().text,null),B(t,M(P,{get when(){return e().undoable},get children(){var e=Za();return e.$$click=()=>void bn(),e}}),null),B(t,M(P,{get when(){return e().handoff},keyed:!0,children:e=>M(Xa,{text:e})}),null),t})()})}I([`click`]);var eo=F(`<section class="border-b border-line px-3 py-2"><div class="font-mono break-all"style=font-size:11px></div><pre class="mt-1 overflow-x-auto font-mono"style=font-size:11px>`),to=F(`<p class="mt-1 text-removed">`),no=F(`<div>`),ro=F(`<form class="border-b border-line px-3 py-2"><div class="mt-2 flex gap-2">`),io=F(`<div data-changes>`),ao=F(`<p class="border-b border-line px-3 py-2 text-muted">Commit <!>: <!> file(s).`),oo=F(`<p class="border-b border-line px-3 py-2 text-muted"> from <span class=font-mono></span>: <a class="text-accent underline"target=_blank rel=noreferrer>`);async function so(){let e=await K(`change.list`,{});return e.ok?e.data:[]}function co(e){return e.startsWith(`+++`)||e.startsWith(`---`)?`text-muted`:e.startsWith(`+`)?`bg-added/10 text-added`:e.startsWith(`-`)?`bg-removed/10 text-removed`:e.startsWith(`@@`)?`text-accent`:``}function lo(e){let t=e.trimEnd().split(`
|
|
4
|
+
`),n=t.findIndex(e=>e.startsWith(`@@`));return n<0?[]:t.slice(n)}function uo(e){return(()=>{var t=eo(),n=t.firstChild,r=n.nextSibling;return B(n,()=>e.change.file),B(t,M(P,{get when(){return e.change.foreign},children:e=>(()=>{var t=to();return B(t,e),t})()}),r),B(r,M(N,{get each(){return lo(e.change.diff)},children:e=>(()=>{var t=no();return B(t,e||` `),S(()=>tt(t,co(e))),t})()})),S(()=>L(t,`data-change`,e.change.file)),t})()}function fo(){let[e]=T(_n,so),[t,n]=x(``),[r,i]=x(),[a,o]=x(),s=()=>e.latest??[],c=()=>t().trim()===``||s().some(e=>e.foreign!==null);async function l(e){e.preventDefault();let r=await J(`change.commit`,{message:t()});r.ok&&(o(void 0),i(r.data),n(``))}async function u(){let e=await J(`change.propose`,{message:t()});e.ok&&(i(void 0),o(e.data),n(``))}return(()=>{var e=io();return B(e,M(P,{get when(){return r()},children:e=>(()=>{var t=ao(),n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;return r.nextSibling,B(t,()=>e().commit,n),B(t,()=>e().files.length,r),t})()}),null),B(e,M(P,{get when(){return a()},children:e=>(()=>{var t=oo(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.nextSibling;return B(t,()=>e().opened?`Pull request opened`:`Pull request updated`,n),B(r,()=>e().branch),B(i,()=>e().pull),S(()=>L(i,`href`,e().pull)),t})()}),null),B(e,M(P,{get when(){return s().length>0},get fallback(){return M(X,{children:`No changes since the last commit.`})},get children(){return[(()=>{var e=ro(),r=e.firstChild;return e.addEventListener(`submit`,e=>void l(e)),B(e,M(Q,{name:`message`,"aria-label":`Commit message`,placeholder:`Commit message`,get value(){return t()},onInput:e=>n(e.currentTarget.value)}),r),B(r,M($,{type:`submit`,get disabled(){return c()},children:`Create commit`}),null),B(r,M($,{get disabled(){return c()},onClick:()=>void u(),children:`Propose changes`}),null),e})(),M(N,{get each(){return s()},children:e=>M(uo,{change:e})})]}}),null),e})()}var po=F(`<ol class="border-b border-line">`),mo=F(`<form class="px-3 py-2">`),ho=F(`<div data-flow><div class="border-b border-line px-3 py-2"><select aria-label=Frame class="w-full rounded border border-line bg-raised px-2 py-1.5">`),go=F(`<option> <!>×`),_o=F(`<li data-step class="flex items-center gap-1 border-b border-line px-3 py-1.5"><span class="min-w-0 flex-1 break-all"></span><button type=button aria-label="Move up"class="px-1 disabled:opacity-30">↑</button><button type=button aria-label="Move down"class="px-1 disabled:opacity-30">↓</button><button type=button aria-label=Remove class=px-1>×`),vo=F(`<p class="mt-2 text-removed">`);function yo(){let[e,t]=x(),[n,r]=x(``),[i,a]=x(),[o,s]=x(!1),c=()=>W.find(t=>t.id===(_r()??e()??W[0]?.id));async function l(){let e=c();if(!e)return;let t=_r()===void 0;a(void 0),t&&wr(),vr(t?e.id:void 0),await Y(e.id,`record`,{on:t})}async function u(e){e.preventDefault();let t=c();if(!t)return;s(!0);let i=await J(`frame.add`,{id:n().trim(),path:t.path,steps:JSON.stringify(yr),width:String(t.width),height:String(t.height)});s(!1),i.ok?(r(``),wr()):a(i.reason)}return(()=>{var e=ho(),a=e.firstChild,s=a.firstChild;return s.addEventListener(`change`,e=>t(e.currentTarget.value)),B(s,M(N,{each:W,children:e=>(()=>{var t=go(),n=t.firstChild,r=n.nextSibling;return r.nextSibling,B(t,()=>e.path,n),B(t,()=>e.width,r),B(t,()=>e.height,null),S(()=>t.value=e.id),t})()})),B(a,M($,{class:`mt-2`,get disabled(){return!c()},onClick:()=>void l(),get children(){return _r()===void 0?`Record`:`Stop`}}),null),B(e,M(P,{get when(){return yr.length>0},get fallback(){return M(X,{children:`Press Record and use the page: each click, text and key is a step.`})},get children(){return[(()=>{var e=po();return B(e,M(N,{each:yr,children:(e,t)=>(()=>{var n=_o(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return B(r,()=>Tr(e)),i.$$click=()=>Cr(t(),-1),a.$$click=()=>Cr(t(),1),o.$$click=()=>Sr(t()),S(e=>{var n=t()===0,r=t()===yr.length-1;return n!==e.e&&(i.disabled=e.e=n),r!==e.t&&(a.disabled=e.t=r),e},{e:void 0,t:void 0}),n})()})),e})(),(()=>{var e=mo();return e.addEventListener(`submit`,e=>void u(e)),B(e,M(Q,{name:`id`,"aria-label":`Frame name`,placeholder:`Frame name`,get value(){return n()},onInput:e=>r(e.currentTarget.value)}),null),B(e,M($,{type:`submit`,class:`mt-2`,get disabled(){return o()||_r()!==void 0||n().trim()===``},children:`Save as frame`}),null),B(e,M(P,{get when(){return i()},children:e=>(()=>{var t=vo();return B(t,e),t})()}),null),e})()]}}),null),S(()=>s.disabled=_r()!==void 0),S(()=>s.value=c()?.id),e})()}I([`click`]);var bo=F(`<button type=button class="w-4 shrink-0 text-center">`),xo=F(`<div role=treeitem class="flex cursor-default items-center gap-1 py-0.5 pr-2 font-mono whitespace-nowrap"style=font-size:12px><button type=button class="w-3 shrink-0 text-center"></button><span></span><span class="flex-1 truncate">`),So=F(`<div role=tree aria-label=Layers class=pb-3>`),Co=F(`<div data-layers>`),wo=F(`<p class="px-3 py-2 text-muted"style=font-size:12px> at <!> px`);function To(e){if(e===``)return``;let t=e.split(`:`);return`${t.slice(0,-2).join(`:`).split(`/`).pop()}:${t.at(-2)}`}function Eo(e){let t,n=()=>hr(e.layer.target),r=()=>e.folding.isOpen(n()),i=()=>gr(q(),e.layer.target),a=()=>nr(e.layer.target.frame,e.layer.target.at);async function o(){let{frame:t,at:n}=e.layer.target,r=!a();try{await Y(t,`hide`,{at:n,hidden:r}),rr(t,n,r)}catch(e){on(e instanceof Error?e.message:String(e))}}return C(()=>{i()&&t.scrollIntoView({block:`nearest`})}),[(()=>{var s=xo(),c=s.firstChild,l=c.nextSibling,u=l.nextSibling;s.addEventListener(`mouseleave`,()=>pn(void 0)),s.addEventListener(`mouseenter`,()=>pn(e.layer.target)),s.$$click=()=>dn(e.layer.target);var d=t;return typeof d==`function`?z(d,s):t=s,c.$$click=t=>{t.stopPropagation(),e.folding.toggle(n())},B(c,()=>r()?`▾`:`▸`),B(l,()=>e.layer.tag),B(u,()=>To(e.layer.target.at)),B(s,M(P,{get when(){return e.layer.target.at!==``},get children(){var e=bo();return e.$$click=e=>{e.stopPropagation(),o()},B(e,()=>a()?`◌`:`●`),S(t=>{var n={"opacity-40 hover:opacity-100":!a()},r=a()?`Show`:`Hide`,i=a(),o=a()?`Show on the canvas`:`Hide on the canvas, without touching the code`;return t.e=rt(e,n,t.e),r!==t.t&&L(e,`aria-label`,t.t=r),i!==t.a&&L(e,`aria-pressed`,t.a=i),o!==t.o&&L(e,`title`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),e}}),null),S(t=>{var n=i(),o=e.layer.children.length>0?r():void 0,d=e.layer.target.at,f={"bg-accent text-on-accent":i(),"bg-line":!i()&&gr(fn(),e.layer.target)},p=`${8+e.depth*12}px`,m=e.layer.children.length===0,h=r()?`Collapse`:`Expand`,g=!!(e.layer.target.at===``||a()),_=!i(),v=!!a();return n!==t.e&&L(s,`aria-selected`,t.e=n),o!==t.t&&L(s,`aria-expanded`,t.t=o),d!==t.a&&L(s,`title`,t.a=d),t.o=rt(s,f,t.o),p!==t.i&&R(s,`padding-left`,t.i=p),m!==t.n&&c.classList.toggle(`invisible`,t.n=m),h!==t.s&&L(c,`aria-label`,t.s=h),g!==t.h&&l.classList.toggle(`opacity-60`,t.h=g),_!==t.r&&u.classList.toggle(`text-muted`,t.r=_),v!==t.d&&u.classList.toggle(`opacity-60`,t.d=v),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),s})(),M(P,{get when(){return r()},get children(){return M(N,{get each(){return e.layer.children},children:t=>M(Eo,{layer:t,get depth(){return e.depth+1},get folding(){return e.folding}})})}})]}function Do(){let e=()=>W.find(e=>e.id===fr()),t=w(()=>{let e=fr();return e?pr(e):[]}),[n,r]=x(new Set),i={isOpen:e=>!n().has(e),toggle:e=>r(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})};return C(()=>{let e=q();if(!e)return;let n=mr(t(),e).slice(0,-1).map(e=>hr(e.target));r(e=>{let t=new Set(e);for(let e of n)t.delete(e);return t})}),(()=>{var n=Co();return B(n,M(P,{get when(){return e()},children:e=>(()=>{var t=wo(),n=t.firstChild,r=n.nextSibling;return r.nextSibling,B(t,()=>e().path,n),B(t,()=>e().width,r),t})()}),null),B(n,M(P,{get when(){return t().length>0},get fallback(){return M(X,{class:`py-2`,children:`This page has no marked elements.`})},get children(){var e=So();return B(e,M(N,{get each(){return t()},children:e=>M(Eo,{layer:e,depth:0,folding:i})})),e}}),null),n})()}I([`click`]);var Oo=`/iframe.html`,[ko,Ao]=x([]);K(`story.list`,{}).then(e=>{e.ok&&Ao(e.data)});function jo(e){return`${Oo}?id=${encodeURIComponent(e)}&viewMode=story`}function Mo(e){let t=new URL(e,location.origin);if(t.pathname!==Oo)return;let n=t.searchParams.get(`id`);return ko().find(e=>e.id===n)}var No=F(`<div class="flex items-center gap-2 py-1"><span class="min-w-0 flex-1 truncate font-mono"style=font-size:11px></span><span class=text-muted>computed`),Po=F(`<label class="flex items-center gap-2 py-1"><span class="min-w-0 flex-1 truncate font-mono"style=font-size:11px></span><input type=checkbox>`),Fo=F(`<p class=text-muted>This story declares no literal args.`),Io=F(`<div data-stories>`);async function Lo(e){let t=await K(`args.get`,{file:e.file,export:e.export});return t.ok?t.data:[]}function Ro(e){let t=t=>J(`args.set`,{file:e.story.file,export:e.story.export,arg:e.arg.name,value:t}),n=`${e.arg.name} in ${e.story.file}`;return M(ze,{get children(){return[M(Be,{get when(){return e.arg.value===null},get children(){var t=No(),r=t.firstChild;return L(t,`title`,n),B(r,()=>e.arg.name),t}}),M(Be,{get when(){return typeof e.arg.value==`boolean`},get children(){var r=Po(),i=r.firstChild,a=i.nextSibling;return L(r,`title`,n),B(i,()=>e.arg.name),a.addEventListener(`change`,e=>t(String(e.currentTarget.checked))),S(()=>L(a,`name`,e.arg.name)),S(()=>a.checked=e.arg.value===!0),r}}),M(Be,{when:!0,get children(){return M(ca,{get name(){return e.arg.name},get label(){return e.arg.name},get value(){return String(e.arg.value)},title:n,set:n=>t(typeof e.arg.value==`string`?JSON.stringify(n):n)})}})]}})}function zo(e){let[t]=T(()=>[e.story,_n()],([e])=>Lo(e));return M(Z,{get label(){return`${e.story.title} / ${e.story.name}`},get children(){return M(P,{get when(){return(t.latest??[]).length>0},get fallback(){return M(P,{get when(){return!t.loading},get children(){return Fo()}})},get children(){return M(N,{get each(){return t.latest},children:t=>M(Ro,{get story(){return e.story},arg:t})})}})}})}function Bo(){let e=()=>[...new Set(W.flatMap(e=>Mo(e.path)??[]))];return(()=>{var t=Io();return B(t,M(P,{get when(){return e().length>0},get fallback(){return M(X,{children:`No frame shows a story.`})},get children(){return M(N,{get each(){return e()},children:e=>M(zo,{story:e})})}})),t})()}var Vo=/^--([^-]+)-(.+)$/;function Ho(e){return Vo.exec(e)?.[2]??e.slice(2)}function Uo(e){return Vo.exec(e)?.[1]??`other`}function Wo(e){let t=new Map;for(let n of e){let e=Uo(n.name);t.set(e,[...t.get(e)??[],n])}return[...t].map(([e,t])=>({name:e,tokens:t}))}var Go=F(`<div data-tokens>`);function Ko(e){return M(ca,{get name(){return e.token.name},get label(){return Ho(e.token.name)},get value(){return e.token.value},get title(){return`${e.token.name} in ${e.token.file}`},set:t=>J(`token.set`,{name:e.token.name,value:t,file:e.token.file})})}async function qo(){let e=await K(`token.list`,{});return e.ok?e.data:[]}function Jo(){let[e]=T(_n,qo),t=()=>Wo(e.latest??[]);return(()=>{var n=Go();return B(n,M(P,{get when(){return t().length>0},get fallback(){return M(P,{get when(){return!e.loading},get children(){return M(X,{children:`This project declares no variables in @theme or :root.`})}})},get children(){return M(N,{get each(){return t()},children:e=>M(Z,{get label(){return e.name},get children(){return M(N,{get each(){return e.tokens},children:e=>M(Ko,{token:e})})}})})}})),n})()}var Yo=F(`<aside class="z-20 flex w-64 shrink-0 flex-col border-r border-line bg-panel"><div role=tablist class="flex gap-1 border-b border-line px-2 py-1.5"></div><div class="min-h-0 flex-1 overflow-y-auto">`),Xo=F(`<button type=button role=tab class="rounded px-2 py-1 hover:bg-line">`),Zo={layers:{label:`Layers`,view:Do},tokens:{label:`Tokens`,view:Jo},stories:{label:`Stories`,view:Bo},flow:{label:`Flow`,view:yo},changes:{label:`Changes`,view:fo}};function Qo(){let[e,t]=x(`layers`),n=()=>Object.keys(Zo).filter(e=>e!==`stories`||ko().length>0);return(()=>{var r=Yo(),i=r.firstChild,a=i.nextSibling;return B(i,M(N,{get each(){return n()},children:n=>(()=>{var r=Xo();return r.$$click=()=>t(n),B(r,()=>Zo[n].label),S(t=>{var i=e()===n,a=e()===n;return i!==t.e&&L(r,`aria-selected`,t.e=i),a!==t.t&&r.classList.toggle(`font-semibold`,t.t=a),t},{e:void 0,t:void 0}),r})()})),B(a,M(yt,{get component(){return Zo[e()].view}})),r})()}I([`click`]);var $o=F(`<select name=story aria-label=Story class="w-44 rounded border border-line bg-raised px-1 py-1"><option value>Story…`),es=F(`<form class="ml-6 flex items-center gap-1"><select name=width aria-label="Frame width"class="rounded border border-line bg-raised px-1 py-1">`),ts=F(`<option> / `),ns=F(`<option> px`),rs=F(`<header class="z-20 flex h-11 shrink-0 items-center gap-3 border-b border-line bg-panel px-3"><span class=font-semibold>lienzo</span><span class=text-muted></span><div class="ml-auto flex items-center gap-1">`),is=[390,768,1280,1536];function as(){let e,t;function n(n){n.preventDefault(),Ut(e.value.trim()||`/`,Number(t.value)),queueMicrotask(Rn)}return(()=>{var r=es(),i=r.firstChild;r.addEventListener(`submit`,n),B(r,M(Q,{mono:!0,ref(t){var n=e;typeof n==`function`?n(t):e=t},name:`path`,value:`/`,"aria-label":`Page path`,class:`w-40 py-1`,style:{"font-size":`12px`}}),i),B(r,M(P,{get when(){return ko().length>0},get children(){var t=$o();return t.firstChild,t.addEventListener(`change`,t=>{let n=t.currentTarget.value;e.value=n===``?`/`:jo(n)}),B(t,M(N,{get each(){return ko()},children:e=>(()=>{var t=ts(),n=t.firstChild;return B(t,()=>e.title,n),B(t,()=>e.name,null),S(()=>t.value=e.id),t})()}),null),t}}),i);var a=t;return typeof a==`function`?z(a,i):t=i,B(i,M(N,{each:is,children:e=>(()=>{var t=ns(),n=t.firstChild;return t.value=e,B(t,e,n),t})()})),B(r,M($,{type:`submit`,children:`Add frame`}),null),r})()}var os=`rounded border-transparent hover:bg-line`;function ss(){return(()=>{var e=rs(),t=e.firstChild.nextSibling,n=t.nextSibling;return B(t,()=>en()?.name),B(e,M(as,{}),n),B(n,M($,{class:os,title:`Ctrl Z`,onClick:bn,children:`Undo`}),null),B(n,M($,{class:os,title:`Ctrl Shift Z`,onClick:xn,children:`Redo`}),null),B(n,M($,{class:`${os} font-mono`,title:`Fit to window`,onClick:Rn,get children(){return[Ye(()=>Math.round(An().zoom*100)),`%`]}}),null),e})()}var cs=F(`<div class="flex h-full flex-col"><div class="flex min-h-0 flex-1">`);function ls(){return(()=>{var e=cs(),t=e.firstChild;return B(e,M(ss,{}),t),B(t,M(Qo,{}),null),B(t,M(ui,{}),null),B(t,M(qa,{}),null),B(e,M(Oi,{}),null),B(e,M($a,{}),null),e})()}async function us(){let e=q();if(!e)return{ok:!1,reason:`nothing is selected`};let t=e.at===``?1:await Y(e.frame,`count`,{at:e.at}).catch(()=>0);return{ok:!0,changed:[],data:{...e,count:t}}}function ds(){return{ok:!0,changed:[],data:W.map(({id:e,path:t,width:n,height:r})=>({id:e,path:t,url:new URL(t,location.origin).href,width:n,height:r}))}}var fs={selection:us,frames:ds};function ps(){let e=new EventSource(`${Kt}events`);e.addEventListener(Jt,()=>vn(e=>e+1)),e.onmessage=async e=>{let{id:t,name:n}=JSON.parse(e.data),r=await fs[n]();await fetch(`${Kt}answer`,{method:`POST`,body:JSON.stringify({id:t,result:r})})}}Qe(()=>M(ls,{}),document.getElementById(`root`)),Ir(),ps();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:"Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:ui-monospace, "SF Mono", Menlo, monospace;--color-orange-400:oklch(75% .183 55.934);--color-green-400:oklch(79.2% .209 151.711);--color-white:#fff;--spacing:.25rem;--container-xl:36rem;--font-weight-semibold:600;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-ground:#08090a;--color-panel:#0f1011;--color-raised:#161718;--color-line:#ffffff14;--color-ink:#f7f8f8;--color-muted:#8a8f98;--color-accent:#7c8cff;--color-on-accent:#0b0c14;--color-added:#27a644;--color-removed:#f34e52}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.top-0{top:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-0{left:0}.left-1\/2{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.hidden{display:none}.h-6{height:calc(var(--spacing) * 6)}.h-11{height:calc(var(--spacing) * 11)}.h-full{height:100%}.min-h-0{min-height:0}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-6{width:calc(var(--spacing) * 6)}.w-24{width:calc(var(--spacing) * 24)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-full{width:100%}.w-max{width:max-content}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:0}.min-w-7{min-width:calc(var(--spacing) * 7)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-20{gap:calc(var(--spacing) * 20)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-accent{border-color:var(--color-accent)}.border-line{border-color:var(--color-line)}.border-transparent{border-color:#0000}.bg-accent{background-color:var(--color-accent)}.bg-added\/10{background-color:#27a6441a}@supports (color:color-mix(in lab, red, red)){.bg-added\/10{background-color:color-mix(in oklab, var(--color-added) 10%, transparent)}}.bg-green-400\/40{background-color:#05df7266}@supports (color:color-mix(in lab, red, red)){.bg-green-400\/40{background-color:color-mix(in oklab, var(--color-green-400) 40%, transparent)}}.bg-ground\/15{background-color:#08090a26}@supports (color:color-mix(in lab, red, red)){.bg-ground\/15{background-color:color-mix(in oklab, var(--color-ground) 15%, transparent)}}.bg-ink{background-color:var(--color-ink)}.bg-line{background-color:var(--color-line)}.bg-line\/70{background-color:#ffffff0e}@supports (color:color-mix(in lab, red, red)){.bg-line\/70{background-color:color-mix(in oklab, var(--color-line) 70%, transparent)}}.bg-orange-400\/40{background-color:#ff8b1a66}@supports (color:color-mix(in lab, red, red)){.bg-orange-400\/40{background-color:color-mix(in oklab, var(--color-orange-400) 40%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-raised{background-color:var(--color-raised)}.bg-removed\/10{background-color:#f34e521a}@supports (color:color-mix(in lab, red, red)){.bg-removed\/10{background-color:color-mix(in oklab, var(--color-removed) 10%, transparent)}}.bg-white{background-color:var(--color-white)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1\.5{padding-left:calc(var(--spacing) * 1.5)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-added{color:var(--color-added)}.text-ground{color:var(--color-ground)}.text-ink{color:var(--color-ink)}.text-muted{color:var(--color-muted)}.text-on-accent{color:var(--color-on-accent)}.text-removed{color:var(--color-removed)}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-\[0_0_0_1px_rgb\(255_255_255\/0\.08\)\,0_16px_48px_rgb\(0_0_0\/0\.5\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#ffffff14), 0 16px 48px var(--tw-shadow-color,#00000080);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline,.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-accent{outline-color:var(--color-accent)}.outline-accent\/60{outline-color:#7c8cff99}@supports (color:color-mix(in lab, red, red)){.outline-accent\/60{outline-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.outline-none{--tw-outline-style:none;outline-style:none}.select-text{-webkit-user-select:text;user-select:text}@media (hover:hover){:is(:where(.group):hover .group-hover\:opacity-100){opacity:1}.hover\:border-muted:hover{border-color:var(--color-muted)}.hover\:bg-ground\/25:hover{background-color:#08090a40}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ground\/25:hover{background-color:color-mix(in oklab, var(--color-ground) 25%, transparent)}}.hover\:bg-line:hover{background-color:var(--color-line)}.hover\:text-ink:hover{color:var(--color-ink)}.hover\:opacity-100:hover{opacity:1}}.focus\:border-accent:focus{border-color:var(--color-accent)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=48rem){.md\:p-8{padding:calc(var(--spacing) * 8)}}}html,body,#root{height:100%}html{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{background:var(--color-ground);color:var(--color-ink);font-family:var(--font-sans);overscroll-behavior:none;-webkit-font-smoothing:antialiased;font-size:13px;overflow:hidden}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="es">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>lienzo</title>
|
|
7
|
+
<script type="module" crossorigin src="/__lienzo/assets/index-Cna8wlzF.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/__lienzo/assets/index-CoJSASvW.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@risinghq/lienzo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A design canvas over your real pages. Move an element and the source file that drew it changes.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/risinghq/lienzo.git",
|
|
9
|
+
"directory": "packages/lienzo"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"lienzo": "src/cli.ts"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"dist/shell"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./vite": "./src/serve/plugin.ts",
|
|
21
|
+
"./config": "./src/project/config.ts",
|
|
22
|
+
"./detect": "./src/project/detect.ts",
|
|
23
|
+
"./capture/store": "./src/capture/store.ts",
|
|
24
|
+
"./capture/compare": "./src/capture/compare.ts",
|
|
25
|
+
"./share/frame": "./src/share/frame.ts",
|
|
26
|
+
"./mirror/transport": "./src/mirror/transport.ts",
|
|
27
|
+
"./protocol": "./src/protocol.ts"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "vite build --config shell/vite.config.ts --logLevel warn",
|
|
34
|
+
"prepack": "bun run build",
|
|
35
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p shell && tsc --noEmit -p fixture/solid",
|
|
36
|
+
"test": "bun test"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@astrojs/compiler-rs": "^0.5.3",
|
|
40
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
41
|
+
"@tailwindcss/node": "^4.3.5",
|
|
42
|
+
"@vue/compiler-sfc": "^3.5.46",
|
|
43
|
+
"html-tag-names": "^2.1.0",
|
|
44
|
+
"magic-string": "^1.4.5",
|
|
45
|
+
"oxc-parser": "^0.160.0",
|
|
46
|
+
"pixelmatch": "^8.0.0",
|
|
47
|
+
"playwright-core": "^1.65.1",
|
|
48
|
+
"pngjs": "^7.0.0",
|
|
49
|
+
"postcss": "^8.5.33",
|
|
50
|
+
"solid-js": "^1.9",
|
|
51
|
+
"svelte": "^5.59.1",
|
|
52
|
+
"tailwind-merge": "^3.7.1",
|
|
53
|
+
"vite": "^8.3.8",
|
|
54
|
+
"zod": "^4.6.7"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@storybook/react-vite": "^10.6.9",
|
|
58
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.2",
|
|
59
|
+
"@tailwindcss/vite": "^4.3.5",
|
|
60
|
+
"@types/bun": "^1.4.5",
|
|
61
|
+
"@types/node": "^26.6.11",
|
|
62
|
+
"@types/pngjs": "^6.0.5",
|
|
63
|
+
"@types/react": "^19.3.2",
|
|
64
|
+
"@types/react-dom": "^19.3.0",
|
|
65
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
66
|
+
"@vitejs/plugin-vue": "^6.0.11",
|
|
67
|
+
"astro": "^7.4.13",
|
|
68
|
+
"next": "^16.4.6",
|
|
69
|
+
"nuxt": "^4.7.0",
|
|
70
|
+
"react": "^19.3.1",
|
|
71
|
+
"react-dom": "^19.3.1",
|
|
72
|
+
"storybook": "^10.6.9",
|
|
73
|
+
"tailwindcss": "^4.3.5",
|
|
74
|
+
"typescript": "^7.0.2",
|
|
75
|
+
"vite-plugin-solid": "^2.11.17",
|
|
76
|
+
"vue": "^3.5.46"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Page } from "playwright-core";
|
|
2
|
+
import { launch } from "../capture/capture.ts";
|
|
3
|
+
|
|
4
|
+
export type Bench = {
|
|
5
|
+
frames: number;
|
|
6
|
+
load: { ms: number; nodes: number; heapMB: number };
|
|
7
|
+
pan: Motion;
|
|
8
|
+
zoom: Motion;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// What a gesture cost: the animation frames the page drew while it ran.
|
|
12
|
+
export type Motion = { fps: number; p95: number; worst: number; layouts: number; recalcs: number };
|
|
13
|
+
|
|
14
|
+
const FRAME_KEY = "lienzo.frames";
|
|
15
|
+
const STEPS = 120;
|
|
16
|
+
|
|
17
|
+
// An animation-frame clock the gesture reads back. A frame later than 50ms is
|
|
18
|
+
// a stall a person feels.
|
|
19
|
+
const CLOCK = `
|
|
20
|
+
window.__lz = { times: [] };
|
|
21
|
+
const tick = (now) => { window.__lz.times.push(now); requestAnimationFrame(tick); };
|
|
22
|
+
requestAnimationFrame(tick);
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
function seedFrames(path: string, count: number) {
|
|
26
|
+
const frames = Array.from({ length: count }, (_, index) => {
|
|
27
|
+
const phone = index % 2 === 0;
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
id: `bench-${index}`,
|
|
31
|
+
path,
|
|
32
|
+
width: phone ? 390 : 1280,
|
|
33
|
+
height: phone ? 844 : 800,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return `localStorage.setItem(${JSON.stringify(FRAME_KEY)}, ${JSON.stringify(JSON.stringify(frames))});`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function counters(page: Page) {
|
|
41
|
+
const cdp = await page.context().newCDPSession(page);
|
|
42
|
+
await cdp.send("Performance.enable");
|
|
43
|
+
|
|
44
|
+
return async () => {
|
|
45
|
+
const { metrics } = await cdp.send("Performance.getMetrics");
|
|
46
|
+
const by = (name: string) => metrics.find((metric) => metric.name === name)?.value ?? 0;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
layouts: by("LayoutCount"),
|
|
50
|
+
recalcs: by("RecalcStyleCount"),
|
|
51
|
+
nodes: by("Nodes"),
|
|
52
|
+
heap: by("JSHeapUsedSize"),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function gesture(
|
|
58
|
+
page: Page,
|
|
59
|
+
read: Awaited<ReturnType<typeof counters>>,
|
|
60
|
+
move: () => Promise<void>,
|
|
61
|
+
): Promise<Motion> {
|
|
62
|
+
await page.evaluate("window.__lz.times.length = 0");
|
|
63
|
+
const before = await read();
|
|
64
|
+
await move();
|
|
65
|
+
const after = await read();
|
|
66
|
+
const times = (await page.evaluate("window.__lz.times")) as number[];
|
|
67
|
+
|
|
68
|
+
const gaps = times.slice(1).map((time, index) => time - times[index]!);
|
|
69
|
+
const sorted = [...gaps].sort((a, b) => a - b);
|
|
70
|
+
const total = times.length > 1 ? times.at(-1)! - times[0]! : 1;
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
fps: Math.round((gaps.length / total) * 1000),
|
|
74
|
+
p95: Math.round(sorted[Math.floor(sorted.length * 0.95)] ?? 0),
|
|
75
|
+
worst: Math.round(sorted.at(-1) ?? 0),
|
|
76
|
+
layouts: after.layouts - before.layouts,
|
|
77
|
+
recalcs: after.recalcs - before.recalcs,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Opens `count` frames of `path` on the canvas at `canvas`, waits for them to
|
|
82
|
+
// load, then pans and zooms the way a person's hand does and reports what the
|
|
83
|
+
// browser drew.
|
|
84
|
+
export async function bench(canvas: string, path: string, count: number): Promise<Bench> {
|
|
85
|
+
const browser = await launch();
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
|
89
|
+
await page.addInitScript(seedFrames(path, count));
|
|
90
|
+
await page.addInitScript(CLOCK);
|
|
91
|
+
|
|
92
|
+
const read = await counters(page);
|
|
93
|
+
const started = Date.now();
|
|
94
|
+
await page.goto(canvas, { waitUntil: "load" });
|
|
95
|
+
await page.waitForFunction(
|
|
96
|
+
(want) => document.querySelectorAll("iframe").length === want,
|
|
97
|
+
count,
|
|
98
|
+
);
|
|
99
|
+
await page.waitForTimeout(4000);
|
|
100
|
+
|
|
101
|
+
const loaded = await read();
|
|
102
|
+
await page.mouse.move(720, 450);
|
|
103
|
+
|
|
104
|
+
const panned = await gesture(page, read, async () => {
|
|
105
|
+
for (let step = 0; step < STEPS; step++) {
|
|
106
|
+
await page.mouse.wheel(step % 2 ? 40 : -40, 30);
|
|
107
|
+
await page.evaluate("new Promise((done) => requestAnimationFrame(() => done()))");
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const zoomed = await gesture(page, read, async () => {
|
|
111
|
+
await page.keyboard.down("Control");
|
|
112
|
+
for (let step = 0; step < STEPS; step++) {
|
|
113
|
+
await page.mouse.wheel(0, step < STEPS / 2 ? -30 : 30);
|
|
114
|
+
await page.evaluate("new Promise((done) => requestAnimationFrame(() => done()))");
|
|
115
|
+
}
|
|
116
|
+
await page.keyboard.up("Control");
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
frames: count,
|
|
121
|
+
load: {
|
|
122
|
+
ms: Date.now() - started,
|
|
123
|
+
nodes: loaded.nodes,
|
|
124
|
+
heapMB: Math.round(loaded.heap / 1e6),
|
|
125
|
+
},
|
|
126
|
+
pan: panned,
|
|
127
|
+
zoom: zoomed,
|
|
128
|
+
};
|
|
129
|
+
} finally {
|
|
130
|
+
await browser.close();
|
|
131
|
+
}
|
|
132
|
+
}
|