@pg-labs-incubator/cobweb 0.0.5 → 0.0.6
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/package.json +7 -4
- package/target/esbuild/action/action.css +1 -1
- package/target/esbuild/action/base.jsx +1 -1
- package/target/esbuild/action/button.jsx +3 -3
- package/target/esbuild/action/fab-menu-context.jsx +1 -1
- package/target/esbuild/action/fab-menu.jsx +3 -3
- package/target/esbuild/action/fab.jsx +3 -3
- package/target/esbuild/action/group.jsx +7 -7
- package/target/esbuild/action/icon-button.jsx +3 -3
- package/target/esbuild/action/index.jsx +1 -1
- package/target/esbuild/action/split-button.jsx +4 -4
- package/target/esbuild/color/contrast.jsx +1 -1
- package/target/esbuild/color/dynamic.jsx +1 -1
- package/target/esbuild/color/hct.jsx +1 -1
- package/target/esbuild/color/index.jsx +1 -1
- package/target/esbuild/color/palette.jsx +1 -1
- package/target/esbuild/color/scheme.jsx +1 -1
- package/target/esbuild/color/temperature.jsx +1 -1
- package/target/esbuild/container/card.jsx +1 -1
- package/target/esbuild/container/elevation-shadow.jsx +1 -1
- package/target/esbuild/container/index.jsx +1 -1
- package/target/esbuild/dom/client.jsx +1 -1
- package/target/esbuild/dom/index.jsx +1 -1
- package/target/esbuild/dom/server.jsx +1 -1
- package/target/esbuild/dom/types.jsx +1 -1
- package/target/esbuild/feedback/badge.jsx +6 -6
- package/target/esbuild/feedback/focus.jsx +1 -1
- package/target/esbuild/feedback/index.jsx +1 -1
- package/target/esbuild/feedback/loading.jsx +3 -3
- package/target/esbuild/feedback/observe.jsx +1 -1
- package/target/esbuild/feedback/progress.jsx +9 -9
- package/target/esbuild/feedback/snackbar.jsx +6 -6
- package/target/esbuild/feedback/tooltip.jsx +6 -6
- package/target/esbuild/icon/icon.jsx +1 -1
- package/target/esbuild/icon/index.jsx +1 -1
- package/target/esbuild/index.jsx +1 -1
- package/target/esbuild/input/autocomplete.jsx +2 -2
- package/target/esbuild/input/base.jsx +2 -2
- package/target/esbuild/input/date-picker.jsx +19 -19
- package/target/esbuild/input/date-time.jsx +3 -3
- package/target/esbuild/input/index.jsx +1 -1
- package/target/esbuild/input/paired-input.jsx +1 -1
- package/target/esbuild/input/picker-dialog.jsx +3 -3
- package/target/esbuild/input/select.jsx +4 -4
- package/target/esbuild/input/slider.jsx +7 -7
- package/target/esbuild/input/text-field.jsx +4 -4
- package/target/esbuild/input/time-picker.jsx +5 -5
- package/target/esbuild/motion/follow-height.jsx +1 -0
- package/target/esbuild/motion/frame.jsx +1 -1
- package/target/esbuild/motion/index.jsx +1 -1
- package/target/esbuild/motion/material.jsx +1 -1
- package/target/esbuild/motion/motion.jsx +1 -1
- package/target/esbuild/motion/spring.jsx +1 -1
- package/target/esbuild/motion/transition.jsx +1 -1
- package/target/esbuild/motion/velocity.jsx +1 -1
- package/target/esbuild/navigation/app-bar.jsx +8 -8
- package/target/esbuild/navigation/base.jsx +1 -1
- package/target/esbuild/navigation/drawer.jsx +7 -7
- package/target/esbuild/navigation/index.jsx +1 -1
- package/target/esbuild/navigation/navigation.jsx +12 -12
- package/target/esbuild/navigation/scroll.jsx +1 -1
- package/target/esbuild/navigation/search.jsx +4 -4
- package/target/esbuild/navigation/tabs.jsx +3 -3
- package/target/esbuild/navigation/toolbar.jsx +3 -3
- package/target/esbuild/selection/base.jsx +1 -1
- package/target/esbuild/selection/checkbox.jsx +4 -4
- package/target/esbuild/selection/chip.jsx +5 -5
- package/target/esbuild/selection/index.jsx +1 -1
- package/target/esbuild/selection/radio.jsx +3 -3
- package/target/esbuild/selection/segmented.jsx +4 -4
- package/target/esbuild/selection/switch.jsx +3 -3
- package/target/esbuild/shape/corner-rounding.jsx +1 -1
- package/target/esbuild/shape/cubic.jsx +1 -1
- package/target/esbuild/shape/index.jsx +1 -1
- package/target/esbuild/shape/material-shapes.jsx +1 -1
- package/target/esbuild/shape/morph.jsx +1 -1
- package/target/esbuild/shape/path.jsx +1 -1
- package/target/esbuild/shape/point.jsx +1 -1
- package/target/esbuild/shape/rounded-polygon.jsx +1 -1
- package/target/esbuild/shape/shapes.jsx +1 -1
- package/target/esbuild/spacing/index.jsx +1 -1
- package/target/esbuild/state/component.jsx +1 -1
- package/target/esbuild/state/controller.jsx +1 -1
- package/target/esbuild/state/index.jsx +1 -1
- package/target/esbuild/state/ripple.jsx +1 -1
- package/target/esbuild/state/state.jsx +1 -1
- package/target/esbuild/state/style.jsx +1 -1
- package/target/esbuild/surface/carousel-layout.jsx +1 -1
- package/target/esbuild/surface/carousel.jsx +2 -2
- package/target/esbuild/surface/dialog.jsx +5 -5
- package/target/esbuild/surface/divider.jsx +1 -1
- package/target/esbuild/surface/drag.jsx +1 -1
- package/target/esbuild/surface/gestures.jsx +3 -3
- package/target/esbuild/surface/index.jsx +1 -1
- package/target/esbuild/surface/interactive.jsx +1 -1
- package/target/esbuild/surface/list-patterns.jsx +3 -3
- package/target/esbuild/surface/list.jsx +2 -2
- package/target/esbuild/surface/menu.jsx +3 -3
- package/target/esbuild/surface/scaffold.jsx +7 -7
- package/target/esbuild/surface/sheet.jsx +5 -5
- package/target/esbuild/surface/side-sheet.jsx +2 -2
- package/target/esbuild/surface/slots.jsx +1 -1
- package/target/esbuild/surface/surface.jsx +1 -1
- package/target/esbuild/text/index.jsx +1 -1
- package/target/esbuild/text/text.jsx +2 -2
- package/target/esbuild/text/typography.jsx +1 -1
- package/target/esbuild/util/box-side.jsx +1 -1
- package/target/esbuild/util/debug.jsx +1 -1
- package/target/esbuild/util/dom.jsx +1 -1
- package/target/esbuild/util/environment.jsx +1 -0
- package/target/esbuild/util/event.jsx +1 -1
- package/target/esbuild/util/index.jsx +1 -1
- package/target/esbuild/util/preconditions.jsx +1 -1
- package/target/esbuild/util/reactive.jsx +1 -1
- package/target/node/color.js +1 -0
- package/target/node/shape.js +1 -0
- package/target/tsc/motion/follow-height.d.ts +51 -0
- package/target/tsc/motion/index.d.ts +7 -3
- package/target/tsc/motion/spring.d.ts +3 -3
- package/target/tsc/shape/index.d.ts +1 -1
- package/target/tsc/shape/material-shapes.d.ts +56 -0
- package/target/tsc/shape/path.d.ts +16 -0
- package/target/tsc/util/environment.d.ts +14 -0
- package/target/tsc/util/index.d.ts +2 -1
- package/target/tsc/util/preconditions.d.ts +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createSignal as b,getOwner as C,onCleanup as E}from"solid-js";import{isServer as L}from"solid-js/web";import{defineDomComponent as i}from"..";import{DomController as d}from"../dom/client";import{resolveSurfaceSlots as r}from"./slots";import"./surface.css";const c=[[600,"medium"],[840,"expanded"],[1200,"large"],[1600,"extraLarge"]],f=["bottomBar","bottomSheet","children","content","floatingActionButton","snackbarHost","topBar"],p=["children","detail","extra","list","main","supporting"],S="--_cw-Scaffold-sheetPeekHeight";function W(t){let e="compact";for(const[o,a]of c)t>=o&&(e=a);return e}function I(t=L?void 0:window){const e=t===void 0?[]:c.map(([n])=>t.matchMedia(`(min-width: ${n}px)`)),o=()=>{const n=e.filter(y=>y.matches).length;return n===0?"compact":c[n-1][1]},[a,h]=b(o()),l=()=>{h(o())};for(const n of e)n.addEventListener("change",l);return C()!==null&&E(()=>{for(const n of e)n.removeEventListener("change",l)}),a}function m(t){return typeof t!="number"?t:Number.isFinite(t)?`${Math.max(0,t)}px`:void 0}function u(t){return`_cw-Scaffold-fab-${t??"end"}
|
|
1
|
+
import{createSignal as b,getOwner as C,onCleanup as E}from"solid-js";import{isServer as L}from"solid-js/web";import{defineDomComponent as i}from"..";import{DomController as d}from"../dom/client";import{resolveSurfaceSlots as r}from"./slots";import"./surface.css";const c=[[600,"medium"],[840,"expanded"],[1200,"large"],[1600,"extraLarge"]],f=["bottomBar","bottomSheet","children","content","floatingActionButton","snackbarHost","topBar"],p=["children","detail","extra","list","main","supporting"],S="--_cw-Scaffold-sheetPeekHeight";function W(t){let e="compact";for(const[o,a]of c)t>=o&&(e=a);return e;}function I(t=L?void 0:window){const e=t===void 0?[]:c.map(([n])=>t.matchMedia(`(min-width: ${n}px)`)),o=()=>{const n=e.filter(y=>y.matches).length;return n===0?"compact":c[n-1][1];},[a,h]=b(o()),l=()=>{h(o());};for(const n of e)n.addEventListener("change",l);return C()!==null&&E(()=>{for(const n of e)n.removeEventListener("change",l);}),a;}function m(t){return typeof t!="number"?t:Number.isFinite(t)?`${Math.max(0,t)}px`:void 0;}function u(t){return`_cw-Scaffold-fab-${t??"end"}`;}function P(t,e,o){return<div{...e}classList={{...e.classList,[u(o.floatingActionButtonPosition)]:!0,[t]:!0,"cw-Scaffold":!0,"cw-Scaffold-safeArea":o.safeArea===!0}}style={{...e.style,[S]:m(o.sheetPeekHeight)}}>
|
|
2
2
|
<div class="cw-Scaffold-topBar">{o.topBar}</div>
|
|
3
3
|
<div aria-label={o.contentLabel}class="cw-Scaffold-content"role={o.contentRole}tabIndex={0}>{o.content??e.children}</div>
|
|
4
4
|
<div class="cw-Scaffold-bottomBar">{o.bottomBar}</div>
|
|
@@ -9,7 +9,7 @@ import{createSignal as b,getOwner as C,onCleanup as E}from"solid-js";import{isSe
|
|
|
9
9
|
</div>
|
|
10
10
|
<div class="cw-Scaffold-sheet">{o.bottomSheet}</div>
|
|
11
11
|
</div>
|
|
12
|
-
</div
|
|
12
|
+
</div>;}class v extends d{#t;#e;constructor(e,o="cw-Scaffold"){super(e,{styleElementIsFunction:!0}),this.#t=o,this.#e=null;}#o(){const e=this.#e,o=this.props.contentRole,a=this.props.contentLabel;o===void 0?e?.removeAttribute("role"):e?.setAttribute("role",o),a===void 0?e?.removeAttribute("aria-label"):e?.setAttribute("aria-label",a);}applyComponentProps(){const e=super.readProps(["contentLabel","contentRole","floatingActionButtonPosition","safeArea","sheetPeekHeight"]);(e.contentLabelChanged||e.contentRoleChanged)&&this.#o(),e.floatingActionButtonPositionChanged&&super.setClass("fabPosition",u(e.floatingActionButtonPosition)),e.safeAreaChanged&&super.setClass("cw-Scaffold-safeArea",e.safeArea===!0),e.sheetPeekHeightChanged&&super.setStyle(S,m(e.sheetPeekHeight));}onStyleElementChanged(e){super.onStyleElementChanged(e),this.#e=e?.querySelector(":scope > .cw-Scaffold-content")??null,this.#o();}render(e){const o=this.props;return<div class={`cw-Scaffold ${this.#t}`}>
|
|
13
13
|
<div class="cw-Scaffold-topBar">{o.topBar}</div>
|
|
14
14
|
<div class="cw-Scaffold-content"tabIndex={0}>{o.content??e}</div>
|
|
15
15
|
<div class="cw-Scaffold-bottomBar">{o.bottomBar}</div>
|
|
@@ -20,28 +20,28 @@ import{createSignal as b,getOwner as C,onCleanup as E}from"solid-js";import{isSe
|
|
|
20
20
|
</div>
|
|
21
21
|
<div class="cw-Scaffold-sheet">{o.bottomSheet}</div>
|
|
22
22
|
</div>
|
|
23
|
-
</div
|
|
23
|
+
</div>;}}const D=/* @__PURE__ */i(()=>(t,e)=>P("cw-Scaffold",t,e),()=>v),N=t=>D(r(t,f));class x extends v{constructor(e){super(e,"cw-BottomSheetScaffold");}}const B=/* @__PURE__ */i(()=>(t,e)=>P("cw-BottomSheetScaffold",t,e),()=>x),$=t=>B(r(t,f));function s(t){return`_cw-PaneScaffold-active-${t}`;}function w(t){return t==="detail"?"primary":t==="extra"?"tertiary":"secondary";}function g(t){return t==="supporting"?"secondary":t==="extra"?"tertiary":"primary";}function A(t,e){return<div{...t}classList={{...t.classList,[s(w(e.activePane))]:!0,"cw-ListDetailPaneScaffold":!0,"cw-PaneScaffold":!0}}>
|
|
24
24
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-secondary">{e.list}</div>
|
|
25
25
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-primary">
|
|
26
26
|
{e.detail??t.children}
|
|
27
27
|
</div>
|
|
28
28
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-tertiary">{e.extra}</div>
|
|
29
|
-
</div
|
|
29
|
+
</div>;}class J extends d{constructor(e){super(e,{styleElementIsFunction:!0});}applyComponentProps(){const e=super.readProps(["activePane"]);e.activePaneChanged&&super.setClass("activePane",s(w(e.activePane)));}render(e){const o=this.props;return<div class="cw-PaneScaffold cw-ListDetailPaneScaffold">
|
|
30
30
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-secondary">{o.list}</div>
|
|
31
31
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-primary">
|
|
32
32
|
{o.detail??e}
|
|
33
33
|
</div>
|
|
34
34
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-tertiary">{o.extra}</div>
|
|
35
|
-
</div
|
|
35
|
+
</div>;}}const X=/* @__PURE__ */i(()=>A,()=>J),q=t=>X(r(t,p));function H(t,e){return<div{...t}classList={{...t.classList,[s(g(e.activePane))]:!0,"cw-PaneScaffold":!0,"cw-SupportingPaneScaffold":!0}}>
|
|
36
36
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-primary">
|
|
37
37
|
{e.main??t.children}
|
|
38
38
|
</div>
|
|
39
39
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-secondary">{e.supporting}</div>
|
|
40
40
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-tertiary">{e.extra}</div>
|
|
41
|
-
</div
|
|
41
|
+
</div>;}class _ extends d{constructor(e){super(e,{styleElementIsFunction:!0});}applyComponentProps(){const e=super.readProps(["activePane"]);e.activePaneChanged&&super.setClass("activePane",s(g(e.activePane)));}render(e){const o=this.props;return<div class="cw-PaneScaffold cw-SupportingPaneScaffold">
|
|
42
42
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-primary">
|
|
43
43
|
{o.main??e}
|
|
44
44
|
</div>
|
|
45
45
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-secondary">{o.supporting}</div>
|
|
46
46
|
<div class="cw-PaneScaffold-pane _cw-PaneScaffold-tertiary">{o.extra}</div>
|
|
47
|
-
</div
|
|
47
|
+
</div>;}}const k=/* @__PURE__ */i(()=>H,()=>_),j=t=>k(r(t,p));export{$ as BottomSheetScaffold,q as ListDetailPaneScaffold,J as ListDetailPaneScaffoldController,N as Scaffold,v as ScaffoldController,j as SupportingPaneScaffold,_ as SupportingPaneScaffoldController,I as createWindowSizeClass,W as windowSizeClassOf};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{untrack as b}from"solid-js";import{defineDomComponent as L}from"..";import{ELEVATION_SHADOW_CSS_CLASS as c}from"../container/elevation-shadow";import{DomController as k}from"../dom/client";import{applySpringMotion as _}from"../motion/spring";import{VelocityTracker as I}from"../motion/velocity";import{computedStyleOf as E,ownerWindow as v}from"../navigation/base";import{deferAfterDelegatedCancellation as y}from"../util/event";import{DialogController as A,activeElementOf as p,dialogAttributesOf as R,isInitiallyOpen as B}from"./dialog";import{coalescedEventsOf as N}from"./drag";import{isElementNode as u}from"./interactive";import{resolveSurfaceSlots as x}from"./slots";import"../container/elevation-shadow.css";import"./surface.css";const X=8,F=40,Y=56,g=125,G=8e3,S=125,h="cw-BottomSheet-dragging",M="_cw-BottomSheet-tracking",l="_cw-ModalBottomSheet-hiding",m="cw-BottomSheet-noDragHandle",f="--_cw-BottomSheet-offset",C="--_cw-BottomSheet-height",J
|
|
1
|
+
import{untrack as b}from"solid-js";import{defineDomComponent as L}from"..";import{ELEVATION_SHADOW_CSS_CLASS as c}from"../container/elevation-shadow";import{DomController as k}from"../dom/client";import{applySpringMotion as _}from"../motion/spring";import{VelocityTracker as I}from"../motion/velocity";import{computedStyleOf as E,ownerWindow as v}from"../navigation/base";import{deferAfterDelegatedCancellation as y}from"../util/event";import{DialogController as A,activeElementOf as p,dialogAttributesOf as R,isInitiallyOpen as B}from"./dialog";import{coalescedEventsOf as N}from"./drag";import{isElementNode as u}from"./interactive";import{resolveSurfaceSlots as x}from"./slots";import"../container/elevation-shadow.css";import"./surface.css";const X=8,F=40,Y=56,g=125,G=8e3,S=125,h="cw-BottomSheet-dragging",M="_cw-BottomSheet-tracking",l="_cw-ModalBottomSheet-hiding",m="cw-BottomSheet-noDragHandle",f="--_cw-BottomSheet-offset",C="--_cw-BottomSheet-height",J=0.4,D="--_cw-BottomSheet-peekHeight",q="input, textarea, select, [contenteditable]:not([contenteditable=false])";function H(i){return typeof i!="number"?i:Number.isFinite(i)?`${Math.max(0,i)}px`:void 0;}function V(i,e){for(let t=i;t!==null&&t!==e;t=t.parentElement){const s=E(t).overflowY;if(t.scrollHeight>t.clientHeight&&(s==="auto"||s==="scroll"))return t;}return null;}function d(i,e,t){let s=i[0]??0,n=1/0;for(const o of i){const r=t===0?Math.abs(o-e):(o-e)*t;r>=0&&r<n&&(s=o,n=r);}return s;}function P(i,e,t){const s=Math.sign(t);if(s===0)return d(i,e,0);if(Math.abs(t)>=g)return d(i,e,s);const n=d(i,e,-s);return Math.abs(e-n)<Y?n:d(i,e,s);}function $(i,e,t){const s=Math.max(0,t-e);if(i<=0||s>=S)return i;const n=s/S,o=i*n*n;return i>=g?Math.max(o,g):o;}class w{#t;#s;#e;#o;#a;#n;#r;#i;#l;#c;#m;#d;#h;constructor(e){this.#t=e,this.#s=new I(),this.#e=null,this.#o=null,this.#a=void 0,this.#n=void 0,this.#r=0,this.#i=0,this.#l=0,this.#c=!1,this.#m=!1,this.#d=null,this.#h=!1;}attach(e,t){this.reset(),this.#e?.removeEventListener("touchstart",this.#L),this.#e?.removeEventListener("touchmove",this.#b),this.#e?.removeEventListener("touchend",this.#g),this.#e?.removeEventListener("touchcancel",this.#g),this.#e?.removeEventListener("wheel",this.#y),this.#o?.removeEventListener("pointerdown",this.#v),this.#o?.removeEventListener("pointermove",this.#u),this.#o?.removeEventListener("pointerup",this.#E),this.#o?.removeEventListener("pointercancel",this.#E),this.#o?.removeEventListener("lostpointercapture",this.#E),this.#e=e,this.#o=t,e?.addEventListener("touchstart",this.#L,{passive:!0}),e?.addEventListener("touchmove",this.#b,{passive:!1}),e?.addEventListener("touchend",this.#g),e?.addEventListener("touchcancel",this.#g),e?.addEventListener("wheel",this.#y,{passive:!1}),t?.addEventListener("pointerdown",this.#v),t?.addEventListener("pointermove",this.#u),t?.addEventListener("pointerup",this.#E),t?.addEventListener("pointercancel",this.#E),t?.addEventListener("lostpointercapture",this.#E);}consumeClick(){const e=this.#h;return this.#h=!1,e;}reset(){const e=this.#a;this.#a=void 0,this.#n=void 0,this.#c=!1,this.#m=!1,this.#d=null,this.#s.resetTracking(),e!==void 0&&this.#o?.hasPointerCapture(e)===!0&&this.#o.releasePointerCapture(e);}#C(e,t){this.#r=t,this.#i=0,this.#l=e,this.#s.resetTracking(),this.#s.addDataPoint(e,t);}#f(e,t){if(this.#i=t-this.#r,this.#l=e,this.#s.addDataPoint(e,t),!this.#c){if(Math.abs(this.#i)<X)return;this.#c=!0,this.#t.dragStarted();}this.#t.dragMoved(this.#i);}#p(e,t){const s=this.#c;let n=0;s&&t&&e.timeStamp-this.#l<=F&&(n=this.#s.calculateVelocity(G)),this.reset(),s&&this.#t.dragEnded(this.#i,n,e);}#v=e=>{this.#h=!1,!(!e.isPrimary||e.pointerType==="mouse"&&e.button!==0||this.#a!==void 0||this.#n!==void 0||!this.#t.canDrag())&&(this.#a=e.pointerId,this.#C(e.timeStamp,e.clientY),this.#o?.setPointerCapture(e.pointerId));};#u=e=>{if(e.pointerId===this.#a){for(const t of N(e).slice(0,-1))this.#s.addDataPoint(t.timeStamp,t.clientY);this.#f(e.timeStamp,e.clientY);}};#E=e=>{const t=e.type==="pointerup";e.pointerId===this.#a&&(this.#h=this.#c&&t,this.#p(e,t));};#L=e=>{const t=e.changedTouches[0],s=e.target;t===void 0||e.touches.length!==1||this.#a!==void 0||this.#n!==void 0||this.#e===null||!u(s)||this.#o?.contains(s)===!0||s.closest(q)!==null||!this.#t.canDrag()||(this.#n=t.identifier,this.#m=!1,this.#d=V(s,this.#e),this.#C(e.timeStamp,t.clientY));};#b=e=>{const t=Array.from(e.changedTouches).find(s=>s.identifier===this.#n);if(t!==void 0){if(!this.#m){const s=t.clientY-this.#r,n=this.#d;if(s===0)return;if(this.#m=!0,!e.cancelable||n!==null&&(s>0?n.scrollTop>0:!this.#t.canExpand())){this.reset();return;}}e.preventDefault(),this.#f(e.timeStamp,t.clientY);}};#g=e=>{Array.from(e.changedTouches).some(t=>t.identifier===this.#n)&&this.#p(e,e.type==="touchend");};#y=e=>{e.deltaY<=0||e.ctrlKey||e.defaultPrevented||this.#c||!this.#t.canDrag()||!this.#t.canExpand()||(e.preventDefault(),this.#t.expand(e));};}class T{#t;#s;#e;constructor(){this.#t=null,this.#s=void 0,this.#e=void 0;}attach(e){this.clear(),this.#t=e;}track(e,t){this.#t?.style.setProperty(C,`${e}`),this.set(t);}set(e){this.#t?.style.setProperty(f,`${e}`);}interrupt(){const e=this.#s;return this.#s=void 0,this.#e=void 0,e?.cancel(),e?.value;}settle(e,t,s,n){const o=this.#t;if(this.interrupt(),o===null){n();return;}const r=_(o,f,e,t,{role:"spatial",speed:"default",threshold:J,velocity:s});this.#s=r,this.#e=n,r.finished.then(()=>this.#o(r),()=>{});}retarget(e){this.#s?.playState==="running"&&this.#s.retarget(e);}clear(){this.interrupt(),this.#t?.style.removeProperty(f),this.#t?.style.removeProperty(C);}#o(e){const t=this.#e,s=this.#t;e===this.#s&&(this.#s=void 0,this.#e=void 0,s!==null&&E(s).getPropertyValue("translate"),t?.());}}function z(i,e){const t=e.skipPartiallyExpanded===!0;return<dialog{...R(i,e,{classes:{[c]:!0,[m]:e.dragHandle===!1,"cw-ModalBottomSheet":!0,"cw-ModalBottomSheet-expanded":t,"cw-ModalBottomSheet-open":B(e)},label:"Bottom sheet",role:"dialog"})}>
|
|
2
2
|
<section class="cw-BottomSheet-surface"tabIndex={-1}>
|
|
3
3
|
<button aria-label={t?e.closeLabel??"Close bottom sheet":e.expandLabel??"Expand bottom sheet"}class="cw-BottomSheet-dragHandle"data-cw-sheet-handle="true"type="button">{e.dragHandleContent}</button>
|
|
4
4
|
<div class="cw-BottomSheet-content">{i.children}</div>
|
|
5
5
|
</section>
|
|
6
|
-
</dialog
|
|
6
|
+
</dialog>;}class W extends A{#t;#s;#e;#o;#a;#n;#r;#i;#l;#c;#m;#d;constructor(e){super(e,"cw-ModalBottomSheet"),this.#t=super.consumeProps([],["onDismiss"]).onDismiss,this.#e=new T(),this.#o=void 0,this.#a=null,this.#n=b(()=>e.skipPartiallyExpanded===!0),this.#r=!1,this.#i=!1,this.#l=void 0,this.#c=0,this.#m=0,this.#d=[],this.#s=new w({canDrag:()=>this.isOpen(),canExpand:()=>!this.#n&&this.#f()>0,dragEnded:(t,s,n)=>this.#x(t,s,n),dragMoved:t=>this.#y(t),dragStarted:()=>this.#g(),expand:()=>this.#u(!0)});}defaultLabel(){return this.props.label??"Bottom sheet";}allowDismiss(e,t){return this.props.dismissible===!1?!1:(this.#t?.(t),t?.defaultPrevented!==!0);}requestDismiss(e,t){e==="cancel"&&this.#n&&this.#f()>0?this.#u(!1):super.requestDismiss(e,t);}onOpenStateChanged(e){const t=e?this.#C():void 0;this.#b(),this.#i=e,this.#l=t,e&&(this.#u(this.props.skipPartiallyExpanded===!0,!1),this.#v());}onShown(){const e=this.#l;this.#i&&(this.#i=!1,this.#l=void 0,this.#E(e??this.#h()));}#h(){return this.styleElement?.getBoundingClientRect().height??0;}#C(){const e=this.styleElement;return e===null||e.getClientRects().length===0?void 0:e.getBoundingClientRect().top-e.offsetTop;}#f(){const e=v(this.styleElement);return this.props.skipPartiallyExpanded===!0||e===void 0?0:Math.max(0,this.#h()-e.innerHeight/2);}#p(){return this.#n?0:this.#f();}#v(){this.isOpen()&&!this.#n&&this.#h()>0&&this.#f()===0&&this.#u(!0,!1);}#u(e,t=!0){let s;t&&!this.#r&&e!==this.#n&&this.isOpen()&&(s=this.#p()),this.#n=e,super.setClass("cw-ModalBottomSheet-expanded",e),this.#a?.setAttribute("aria-label",e?this.props.closeLabel??"Close bottom sheet":this.props.expandLabel??"Expand bottom sheet"),this.#r?this.#e.retarget(this.#p()):s!==void 0&&this.#E(s);}#E(e){const t=this.#h(),s=this.#p();t===0||e===s||(this.#e.track(t,e),this.#L(!0),this.#e.settle(e,s,0,()=>this.#b()));}#L(e){this.#r=e,super.setClass(M,e);}#b(){this.#s.reset(),this.#e.clear(),this.#L(!1),super.setClass(h,!1),super.setClass(l,!1);}#g(){const e=this.#e.interrupt(),t=this.#f();t===0&&!this.#n&&this.#u(!0,!1),this.#m=this.#h(),this.#d=t>0?[0,t,this.#m]:[0,this.#m],this.#c=e??this.#p(),this.#e.track(this.#m,this.#c),this.#L(!0),super.setClass(h,!0),super.setClass(l,!1);}#y(e){this.#e.set(Math.min(Math.max(this.#c+e,0),this.#m));}#x(e,t,s){const n=this.#m,o=Math.min(Math.max(this.#c+e,0),n),r=$(t,o,n),a=P(this.#d,o,r);if(super.setClass(h,!1),a===n&&n>0&&this.allowDismiss("dismiss",s)){super.setClass(l,!0),this.#e.settle(o,n,r,()=>{this.close("dismiss",s),this.isOpen()&&(super.setClass(l,!1),this.#e.settle(n,this.#p(),0,()=>this.#b()));});return;}a!==n&&a!==this.#p()&&this.#u(a===0),this.#e.settle(o,this.#p(),r,()=>this.#b());}#S=e=>{const t=this.#a;this.#s.consumeClick()||y(e,t,()=>{this.#a!==t||!this.isOpen()||(!this.#n&&this.#f()>0?this.#u(!0):this.requestDismiss("dismiss",e));},!1);};applyComponentProps(){const e=super.readProps(["closeLabel","dragHandle","expandLabel"]);super.applyComponentProps(),(e.closeLabelChanged||e.expandLabelChanged)&&this.#u(this.#n,!1),e.dragHandleChanged&&super.setClass(m,e.dragHandle===!1);}onStyleElementChanged(e){const t=e===null?void 0:v(e);this.#a?.removeEventListener("click",this.#S),this.#o?.disconnect(),this.#b(),this.#a=e?.querySelector("[data-cw-sheet-handle]")??null,this.#s.attach(e?.querySelector(".cw-BottomSheet-surface")??null,this.#a),this.#e.attach(e),this.#a?.addEventListener("click",this.#S),this.#o=void 0,e!==null&&t?.ResizeObserver!==void 0&&(this.#o=new t.ResizeObserver(()=>this.#v()),this.#o.observe(e)),super.onStyleElementChanged(e);}render(e){const t=this.props;return<dialog class={`cw-ModalBottomSheet ${c}`}>
|
|
7
7
|
<section class="cw-BottomSheet-surface"tabIndex={-1}>
|
|
8
8
|
<button class="cw-BottomSheet-dragHandle"data-cw-sheet-handle="true"type="button">{t.dragHandleContent}</button>
|
|
9
9
|
<div class="cw-BottomSheet-content">{e}</div>
|
|
10
10
|
</section>
|
|
11
|
-
</dialog
|
|
11
|
+
</dialog>;}onControllerCleanup(){this.#a?.removeEventListener("click",this.#S),this.#o?.disconnect(),this.#s.attach(null,null),this.#e.attach(null),super.onControllerCleanup();}}const O=["children","dragHandleContent"],K=/* @__PURE__ */L(()=>z,()=>W),me=i=>K(x(i,O));function j(i,e){const t=B(e),s=("expanded"in e?e.expanded:e.defaultExpanded)===!0;return<div aria-label={e.label??"Bottom sheet"}{...i}aria-hidden={t?void 0:"true"}classList={{...i.classList,[m]:e.dragHandle===!1,"cw-BottomSheet":!0,"cw-BottomSheet-expanded":s,"cw-BottomSheet-open":t}}role="region"style={{...i.style,[D]:H(e.peekHeight)}}>
|
|
12
12
|
<section class={`cw-BottomSheet-surface ${c}`}tabIndex={-1}>
|
|
13
13
|
<button aria-expanded={s?"true":"false"}aria-label={s?e.collapseLabel??"Collapse bottom sheet":e.expandLabel??"Expand bottom sheet"}class="cw-BottomSheet-dragHandle"data-cw-sheet-handle="true"type="button">{e.dragHandleContent}</button>
|
|
14
14
|
<div class="cw-BottomSheet-content">{i.children}</div>
|
|
15
15
|
</section>
|
|
16
|
-
</div
|
|
16
|
+
</div>;}class U extends k{#t;#s;#e;#o;#a;#n;#r;#i;#l;#c;#m;#d;#h;#C;#f;#p;constructor(e){super(e,{styleElementIsFunction:!0}),this.#t="open"in e,this.#s="expanded"in e,this.#r=new T(),this.#i=null,this.#l=null,this.#c=null,this.#m=null,this.#d=b(()=>(this.#t?e.open:e.defaultOpen)===!0),this.#h=b(()=>(this.#s?e.expanded:e.defaultExpanded)===!0),this.#C=!1,this.#f=0,this.#p=[],this.#n=new w({canDrag:()=>this.#d,canExpand:()=>!this.#h,dragEnded:(s,n,o)=>this.#O(s,n,o),dragMoved:s=>this.#T(s),dragStarted:()=>this.#w(),expand:s=>this.#u(!0,!0,s)});const t=super.consumeProps([],["onOpenChange","onDismiss","onExpandedChange"]);this.#e=t.onOpenChange,this.#o=t.onDismiss,this.#a=t.onExpandedChange;}open(){this.#v(!0,!0);}close(e){this.#v(!1,!0,e);}expand(e){this.#u(!0,!0,e);}collapse(e){this.#u(!1,!0,e);}#v(e,t,s){let n;if(e!==this.#d){if(t&&this.#t){this.#e?.(e,s);return;}e&&(n=this.#y()),this.#d=e,this.#B(),e||this.#L(),super.setClass("cw-BottomSheet-open",e),super.setAttribute("aria-hidden",e?void 0:"true"),e&&this.#P(n??this.#g()),t&&this.#e?.(e,s);}}#u(e,t,s){const n=this.#c;let o;if(e!==this.#h){if(t&&this.#s){this.#a?.(e,s);return;}!this.#C&&this.#d&&(o=this.#S()),this.#h=e,super.setClass("cw-BottomSheet-expanded",e),this.#b(),!e&&n!==null&&n.contains(p(n))&&this.#l?.focus(),this.#C?this.#r.retarget(this.#S()):o!==void 0&&this.#P(o),t&&this.#a?.(e,s);}}#E(e){return!this.#d||this.props.dismissible!==!0?!1:(this.#o?.(e),e?.defaultPrevented!==!0);}#L(){const e=this.#i,t=e===null?null:p(e),s=this.#m;this.#m=null,!(e===null||t===null||!e.contains(t))&&(s?.isConnected===!0&&s.focus(),p(e)===t&&t.blur());}#b(){this.#l?.setAttribute("aria-expanded",this.#h?"true":"false"),this.#l?.setAttribute("aria-label",this.#h?this.props.collapseLabel??"Collapse bottom sheet":this.props.expandLabel??"Expand bottom sheet");}#g(){return this.#i?.getBoundingClientRect().height??0;}#y(){const e=this.#i,t=e?.offsetParent;return e===null||!u(t)?void 0:e.getBoundingClientRect().top-t.getBoundingClientRect().top-e.offsetTop;}#x(){const e=this.#i,t=e===null?void 0:E(e),s=Number.parseFloat(t?.minBlockSize??"");return Math.max(0,this.#g()-(Number.isFinite(s)?s:0));}#S(){return this.#d?this.#h?0:this.#x():this.#g();}#M(e){this.#C=e,super.setClass(M,e);}#P(e){const t=this.#g(),s=this.#S();t===0||e===s||(this.#r.track(t,e),this.#M(!0),this.#r.settle(e,s,0,()=>this.#B()));}#B(){this.#n.reset(),this.#r.clear(),this.#M(!1),super.setClass(h,!1);}#w(){const e=this.#r.interrupt(),t=this.#x(),s=this.#g();this.#p=this.props.dismissible===!0?[0,t,s]:[0,t],this.#f=e??this.#S(),this.#r.track(s,this.#f),this.#M(!0),super.setClass(h,!0);}#T(e){this.#r.set(Math.min(Math.max(this.#f+e,0),this.#p.at(-1)??0));}#O(e,t,s){const n=this.#p.length===3,o=this.#p.at(-1)??0,r=Math.min(Math.max(this.#f+e,0),o),a=P(this.#p,r,t);if(super.setClass(h,!1),n&&a===o&&this.#E(s)){this.#r.settle(r,o,t,()=>{this.#v(!1,!0,s),this.#d&&this.#r.settle(o,this.#S(),0,()=>this.#B());});return;}(!n||a!==o)&&this.#u(a===0,!0,s),this.#r.settle(r,this.#S(),t,()=>this.#B());}#D=e=>{const t=this.#l;this.#n.consumeClick()||y(e,t,()=>{this.#l===t&&this.#d&&this.#u(!this.#h,!0,e);},!1);};#H=e=>{const t=this.#i,s=e.relatedTarget;t===null||!u(e.target)||(u(s)&&!t.contains(s)&&(this.#m=s),!this.#h&&this.#d&&this.#c?.contains(e.target)===!0&&this.#u(!0,!0,e));};applyComponentProps(){const e=super.readProps(["attr:aria-label","collapseLabel","dragHandle","expandLabel","expanded","label","open","peekHeight"]),t=e["attr:aria-label"]??e.label??"Bottom sheet";e.openChanged&&this.#t&&this.#v(e.open===!0,!1),e.expandedChanged&&this.#s&&this.#u(e.expanded===!0,!1),this.styleElement?.getAttribute("aria-label")!==t&&super.setAttribute("aria-label",t),(e.collapseLabelChanged||e.expandLabelChanged)&&this.#b(),e.dragHandleChanged&&super.setClass(m,e.dragHandle===!1),e.peekHeightChanged&&super.setStyle(D,H(e.peekHeight));}onStyleElementChanged(e){super.onStyleElementChanged(e),this.#l?.removeEventListener("click",this.#D),this.#i?.removeEventListener("focusin",this.#H),this.#B(),this.#i=e?.querySelector(".cw-BottomSheet-surface")??null,this.#l=e?.querySelector("[data-cw-sheet-handle]")??null,this.#c=e?.querySelector(".cw-BottomSheet-content")??null,this.#n.attach(this.#i,this.#l),this.#r.attach(this.#i),this.#l?.addEventListener("click",this.#D),this.#i?.addEventListener("focusin",this.#H),super.setClass("cw-BottomSheet-open",this.#d),super.setClass("cw-BottomSheet-expanded",this.#h),super.setAttribute("aria-hidden",this.#d?void 0:"true"),this.#b();}render(e){const t=this.props;return<div class="cw-BottomSheet"role="region">
|
|
17
17
|
<section class={`cw-BottomSheet-surface ${c}`}tabIndex={-1}>
|
|
18
18
|
<button class="cw-BottomSheet-dragHandle"data-cw-sheet-handle="true"type="button">{t.dragHandleContent}</button>
|
|
19
19
|
<div class="cw-BottomSheet-content">{e}</div>
|
|
20
20
|
</section>
|
|
21
|
-
</div
|
|
21
|
+
</div>;}onControllerCleanup(){this.#l?.removeEventListener("click",this.#D),this.#i?.removeEventListener("focusin",this.#H),this.#n.attach(null,null),this.#r.attach(null),super.onControllerCleanup();}}const Z=/* @__PURE__ */L(()=>j,()=>U),pe=i=>Z(x(i,O));export{pe as BottomSheet,U as BottomSheetController,me as ModalBottomSheet,W as ModalBottomSheetController};
|
|
@@ -6,7 +6,7 @@ import{createUniqueId as d,mergeProps as f}from"solid-js";import{defineDomCompon
|
|
|
6
6
|
</header>
|
|
7
7
|
<div class="cw-SideSheet-body">{e.body??i.children}</div>
|
|
8
8
|
<footer class="cw-SideSheet-actions">{e.actions}</footer>
|
|
9
|
-
</dialog
|
|
9
|
+
</dialog>;}class P extends C{#e;constructor(e){super(e,"cw-SideSheet"),this.#e=d();}defaultLabel(){return this.props.label??(this.props.header===void 0?"Side sheet":void 0);}defaultLabelledBy(){return this.props.label===void 0&&this.props.header!==void 0?this.#e:void 0;}allowDismiss(e,t){return this.props.dismissible!==!1;}#t=e=>{E(this.styleElement,e)==="dismiss"&&this.requestDismiss("dismiss",e);};applyComponentProps(){const e=super.readProps(["detached","dismissible","edge","modal"]);super.applyComponentProps(),e.detachedChanged&&super.setClass("cw-SideSheet-detached",e.detached===!0),e.dismissibleChanged&&super.setClass(m,e.dismissible===!1),e.edgeChanged&&super.setAttribute(y,e.edge??"end"),e.modalChanged&&super.setClass("cw-SideSheet-modal",e.modal);}onStyleElementChanged(e){this.styleElement?.removeEventListener("click",this.#t),super.onStyleElementChanged(e),e?.addEventListener("click",this.#t);}render(e){const t=this.props,u=this.#e;return<dialog class={`cw-SideSheet ${h}`}>
|
|
10
10
|
<header class="cw-SideSheet-header">
|
|
11
11
|
<div class="cw-SideSheet-icon">{t.leadingIcon}</div>
|
|
12
12
|
<h2 class="cw-SideSheet-title"id={u}>{t.header}</h2>
|
|
@@ -14,4 +14,4 @@ import{createUniqueId as d,mergeProps as f}from"solid-js";import{defineDomCompon
|
|
|
14
14
|
</header>
|
|
15
15
|
<div class="cw-SideSheet-body">{t.body??e}</div>
|
|
16
16
|
<footer class="cw-SideSheet-actions">{t.actions}</footer>
|
|
17
|
-
</dialog
|
|
17
|
+
</dialog>;}onControllerCleanup(){this.styleElement?.removeEventListener("click",this.#t),super.onControllerCleanup();}}function c(i,e){return f(w(i,D),{modal:e});}const p=/* @__PURE__ */g(()=>L,()=>P),T=i=>p(c(i,!1)),x=i=>p(c(i,!0));export{x as ModalSideSheet,P as SideSheetController,T as StandardSideSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{children as c,createMemo as i,mergeProps as u}from"solid-js";function d(e,t){return t?i(e):c(e)}function a(e,t,n=[]){const r=e,s={};for(const o of Object.keys(e).filter(l=>t.includes(l)))Object.defineProperty(s,o,{enumerable:!0,get:d(()=>r[o],n.includes(o))});return u(e,s)}export{a as resolveSurfaceSlots};
|
|
1
|
+
import{children as c,createMemo as i,mergeProps as u}from"solid-js";function d(e,t){return t?i(e):c(e);}function a(e,t,n=[]){const r=e,s={};for(const o of Object.keys(e).filter(l=>t.includes(l)))Object.defineProperty(s,o,{enumerable:!0,get:d(()=>r[o],n.includes(o))});return u(e,s);}export{a as resolveSurfaceSlots};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{untrack as E}from"solid-js";import{insert as v}from"solid-js/web";import{ELEVATION_SHADOW_CSS_CLASS as l}from"../container/elevation-shadow";import{FocusState as g,HoverState as y,PressState as L,defineInteractableComponent as k}from"../state";import{InteractableController as I}from"../state/controller";import{deferAfterDelegatedCancellation as i}from"../util/event";import{hasNestedInteractive as w,isElementNode as A}from"./interactive";import"../container/elevation-shadow.css";import"./surface.css";const P=g|y|L,c
|
|
1
|
+
import{untrack as E}from"solid-js";import{insert as v}from"solid-js/web";import{ELEVATION_SHADOW_CSS_CLASS as l}from"../container/elevation-shadow";import{FocusState as g,HoverState as y,PressState as L,defineInteractableComponent as k}from"../state";import{InteractableController as I}from"../state/controller";import{deferAfterDelegatedCancellation as i}from"../util/event";import{hasNestedInteractive as w,isElementNode as A}from"./interactive";import"../container/elevation-shadow.css";import"./surface.css";const P=g|y|L,c=/* @__PURE__ */new Set(["none","extra-small","small","medium","large","extra-large","full"]),d="cw-Surface-clickable",u="cw-Surface-disabled",f="cw-Surface-selectable",p="cw-Surface-selected";function h(r){return`_cw-Surface-${r??"surface-container"}`;}function S(r){return`_cw-Surface-elevation-${r??0}`;}function b(r){return r!==void 0&&c.has(r)?`_cw-Surface-shape-${r}`:void 0;}function m(r){return r!==void 0&&!c.has(r)?r:void 0;}function C(r,e,t){return r?e?-1:t??0:t;}function x(r,e){const t=e.disabled===!0,s=e.selectable===!0,a=e.clickable===!0||s,n=s&&("selected"in e?e.selected:e.defaultSelected)===!0,o=b(e.shape);return<div{...r}aria-disabled={t?"true":void 0}aria-pressed={s?n?"true":"false":void 0}classList={{...r.classList,[l]:!0,[d]:e.clickable===!0,[u]:t,[f]:s,[p]:n,[h(e.color)]:!0,[S(e.elevation)]:!0,[o??""]:o!==void 0,"cw-Surface":!0}}data-cw-surface="true"role={a?"button":void 0}style={{...r.style,"--_cw-Surface-shape":m(e.shape)}}tabIndex={C(a,t,e.tabIndex)}/>;}class D extends I{#s;#a;#t;#e;#n;constructor(e){super(e,{baseInteractionCssClassName:"cw-Surface",enabledInteractionStates:0,styleElementIsFunction:!0}),this.#s="selected"in e,this.#t=E(()=>(this.#s?e.selected:e.defaultSelected)===!0),this.#a=super.consumeProps([],["onSelectedChange"]).onSelectedChange,this.#e=!1,this.#n=null;}#r(){return!this.isControllerDisposed&&this.props.disabled!==!0&&(this.props.clickable===!0||this.props.selectable===!0);}#i(e){const t=this.#n;t!==e&&(t!==null&&(t.removeEventListener("keydown",this.#c),t.removeEventListener("keyup",this.#d),t.removeEventListener("blur",this.#u),t.removeEventListener("click",this.#l,!0)),this.#n=e,e!==null&&(e.addEventListener("keydown",this.#c),e.addEventListener("keyup",this.#d),e.addEventListener("blur",this.#u),e.addEventListener("click",this.#l,!0)));}#o(e){super.setClass(p,e&&this.#t),super.setAttribute("aria-pressed",e?this.#t?"true":"false":void 0);}#l=e=>{this.props.disabled===!0&&(e.preventDefault(),e.stopImmediatePropagation());};#c=e=>{const t=this.functionElement;e.defaultPrevented||e.target!==t||!this.#r()||(e.key==="Enter"?i(e,t,()=>{!e.repeat&&this.#r()&&t?.matches(":focus")===!0&&t.click();}):e.key===" "&&i(e,t,()=>{!e.repeat&&this.#r()&&t?.matches(":focus")===!0&&(this.#e=!0);}));};#d=e=>{const t=this.functionElement,s=this.#e;e.target!==t||e.key!==" "||(this.#e=!1,s&&this.#r()&&i(e,t,()=>{this.#r()&&t?.matches(":focus")===!0&&t.click();}));};#u=()=>{this.#e=!1;};applyComponentProps(){const e=super.readProps(["clickable","color","disabled","elevation","selectable","selected","shape","tabIndex"]),t=e.clickable===!0,s=e.disabled===!0,a=e.selectable===!0,n=t||a;e.colorChanged&&super.setClass("color",h(e.color)),e.elevationChanged&&super.setClass("elevation",S(e.elevation)),e.shapeChanged&&(super.setClass("shape",b(e.shape)),super.setStyle("--_cw-Surface-shape",m(e.shape))),e.disabledChanged&&(super.setClass(u,s),super.setAttribute("aria-disabled",s?"true":void 0)),(e.clickableChanged||e.selectableChanged||e.disabledChanged)&&((!n||s)&&(this.#e=!1),super.setClass(d,t),super.setClass(f,a),super.setAttribute("role",n?"button":void 0),super.setEnabledInteractionStates(!n||s?0:P),this.#i(n?super.functionElement:null),e.tabIndexChanged=!0),(e.selectedChanged||e.selectableChanged)&&(this.#s&&e.selectedChanged&&(this.#t=e.selected===!0),this.#o(a)),e.tabIndexChanged&&super.setAttribute("tabindex",C(n,s,e.tabIndex));}onEvent(e){const t=super.functionElement;if(this.isControllerDisposed||this.props.disabled===!0||(super.onEvent(e),e.type!=="click"||e.defaultPrevented||this.props.selectable!==!0)||t!==null&&A(e.target)&&e.target!==t&&(e.target.closest("[data-cw-surface]")!==t||w(e.target,t,e.composedPath())))return;const s=!this.#t;this.#a?.(s,e),this.#s||(this.#t=s,this.#o(!0));}render(e){const t=<div class={`cw-Surface ${l}`}data-cw-surface="true"/>;return v(t,e),t;}onControllerCleanup(){this.#e=!1,this.#i(null),super.onControllerCleanup();}}const X=/* @__PURE__ */k(()=>x,()=>D);export{X as Surface,D as SurfaceController};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Text as o}from"./text";import{Typography as r}from"./typography";export{o as Text,r as Typography};
|
|
1
|
+
import{Text as o}from"./text";import{Typography as r}from"./typography";export{o as Text,r as Typography};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{defineDomComponent as a}from"..";import"./text.css";function s(e){return`_cw-Text-${e??"body-large"}
|
|
1
|
+
import{defineDomComponent as a}from"..";import"./text.css";function s(e){return`_cw-Text-${e??"body-large"}`;}const i=/* @__PURE__ */a(()=>(e,t)=><span{...e}classList={{...e.classList,[s(t.scale)]:!0,"cw-Text":!0}}>
|
|
2
2
|
{t.value??""}
|
|
3
|
-
</span>,e=>class extends e{constructor(t){super(t,{styleElementIsFunction:!0})}applyComponentProps(){const[t,o]=super.readProp("scale");o&&super.setClass("scale",s(t));const[p,r]=super.readProp("value");r&&(super.styleElement.textContent=p??"")}render(){return<span class="cw-Text"
|
|
3
|
+
</span>,e=>class extends e{constructor(t){super(t,{styleElementIsFunction:!0});}applyComponentProps(){const[t,o]=super.readProp("scale");o&&super.setClass("scale",s(t));const[p,r]=super.readProp("value");r&&(super.styleElement.textContent=p??"");}render(){return<span class="cw-Text"/>;}});export{i as Text};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{insert as p}from"solid-js/web";import{defineDomComponent as s}from"..";import"./typography.css";function r(o){return`_cw-Typography-${o??"auto"}
|
|
1
|
+
import{insert as p}from"solid-js/web";import{defineDomComponent as s}from"..";import"./typography.css";function r(o){return`_cw-Typography-${o??"auto"}`;}const h=/* @__PURE__ */s(()=>(o,e)=><div{...o}classList={{...o.classList,[r(e.height)]:!0,"cw-Typography":!0}}/>,o=>class extends o{constructor(e){super(e,{styleElementIsFunction:!0});}applyComponentProps(){const[e,t]=super.readProp("height");t&&super.setClass("height",r(e));}render(e){const t=<div class="cw-Typography"/>;return p(t,e),t;}});export{h as Typography};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isServer as a}from"solid-js/web";const e=0,r=1,o=2,i=3;function B(l){return l===i||l===r?0:1}function d(l,x){const n=a?null:l.ownerDocument.defaultView;if(n===null)return[e,r,o,i];const s=n.getComputedStyle(l,x??null),c=s.getPropertyValue("writing-mode"),t=s.getPropertyValue("direction")==="rtl";switch(c){case"sideways-rl":case"tb":case"tb-rl":case"vertical-rl":return[r,t?e:o,i,t?o:e];case"tb-lr":case"vertical-lr":return[i,t?e:o,r,t?o:e];case"sideways-lr":return[i,t?o:e,r,t?e:o];case"horizontal-tb":default:return[e,t?i:r,o,t?r:i]}}export{o as BoxBottom,i as BoxLeft,r as BoxRight,e as BoxTop,B as axisOfBoxSide,d as logicalBoxSidesOf};
|
|
1
|
+
import{isServer as a}from"solid-js/web";const e=0,r=1,o=2,i=3;function B(l){return l===i||l===r?0:1;}function d(l,x){const n=a?null:l.ownerDocument.defaultView;if(n===null)return[e,r,o,i];const s=n.getComputedStyle(l,x??null),c=s.getPropertyValue("writing-mode"),t=s.getPropertyValue("direction")==="rtl";switch(c){case"sideways-rl":case"tb":case"tb-rl":case"vertical-rl":return[r,t?e:o,i,t?o:e];case"tb-lr":case"vertical-lr":return[i,t?e:o,r,t?o:e];case"sideways-lr":return[i,t?o:e,r,t?e:o];case"horizontal-tb":default:return[e,t?i:r,o,t?r:i];}}export{o as BoxBottom,i as BoxLeft,r as BoxRight,e as BoxTop,B as axisOfBoxSide,d as logicalBoxSidesOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEV as e}from"solid-js";function r(n,o){if(e&&(typeof n=="function"&&(n=n()),!n))throw new Error(o===void 0?"assertion failed":`assertion failed: ${o}`)}function t(n,...o){e&&console.log(n,...o)}export{r as assertDebug,t as printDebug};
|
|
1
|
+
import{DEV as e}from"solid-js";function r(n,o){if(e&&(typeof n=="function"&&(n=n()),!n))throw new Error(o===void 0?"assertion failed":`assertion failed: ${o}`);}function t(n,...o){e&&console.log(n,...o);}export{r as assertDebug,t as printDebug};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const i
|
|
1
|
+
const i=/* @__PURE__ */new Map([["contenteditable",["true","false"]],["draggable",["true","false"]],["spellcheck",["true","false"]],["translate",["yes","no"]]]);function o(e,t){return t==null?null:typeof t!="boolean"||e.startsWith("aria-")?t.toString():i.get(e)?.[t?0:1]??(t?"":null);}function s(e,t,n){const r=n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"?o(t,n):void 0;r===null?e.removeAttribute(t):r!==void 0&&e.setAttribute(t,r);}export{o as attributeValueOf,s as setAttribute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isServer as e}from"solid-js/web";import{checkState as r}from"./preconditions";function c(){r(!e,"expected browser environment");}function n(){r(e,"expected server environment");}export{c as checkBrowser,n as checkServer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isServer as d}from"solid-js/web";import{printDebug as l}from"./debug";const i=["stopPropagation","stopImmediatePropagation"],a
|
|
1
|
+
import{isServer as d}from"solid-js/web";import{printDebug as l}from"./debug";const i=["stopPropagation","stopImmediatePropagation"],a=/* @__PURE__ */new WeakMap(),u=!d&&(()=>{let t=!1;const e={get passive(){return t=!0,!1;}},o=()=>{};try{try{window.addEventListener("test",o,e);}finally{window.removeEventListener("test",o,e);}return l(`passive event listeners are${t?"":" not"} supported`),t;}catch(n){return l("passive event listeners are not supported",n),!1;}})();function h(t,e){return u?t:t.capture??!1;}function c(t){for(const e of t.composedPath())if(e.nodeType===Node.DOCUMENT_NODE)return e;return null;}function f(t,e){const o=i.map(n=>Object.getOwnPropertyDescriptor(t,n));for(const n of i){const r=t[n];Object.defineProperty(t,n,{configurable:!0,writable:!0,value(){r.call(this),e();}});}return()=>i.forEach((n,r)=>{const s=o[r];s===void 0?Reflect.deleteProperty(t,n):Object.defineProperty(t,n,s);});}class p{#i;#e;#t;#n;#o;#r;#a;#l;#s;constructor(e){const o=e.bubbles&&!e.cancelBubble?c(e):null,n=()=>this.#d();this.#i=e,this.#e=[],this.#t=o,this.#n=o?.defaultView??null,this.#o=r=>{r===e&&e.cancelBubble&&n();},this.#r=r=>{r===e&&n();},this.#a=o===null?null:f(e,()=>queueMicrotask(n)),this.#l=o!==null&&e.isTrusted?setTimeout(n,0):void 0,this.#s=!1,this.#t?.addEventListener(e.type,this.#o),this.#n?.addEventListener(e.type,this.#r),(o===null||!e.isTrusted)&&queueMicrotask(n);}request(e,o){this.#e.push({action:e,preventDefault:o});}#d(){const e=this.#i,o=e.eventPhase!==Event.NONE;let n=e.defaultPrevented;if(!this.#s){this.#s=!0,a.delete(e),this.#t?.removeEventListener(e.type,this.#o),this.#n?.removeEventListener(e.type,this.#r),this.#a?.(),clearTimeout(this.#l);for(const{action:r,preventDefault:s}of this.#e){if(n)return;s&&(n=!0,o&&e.preventDefault()),queueMicrotask(r);}}}}function y(t,e,o,n=!0){let r=a.get(t);t.defaultPrevented||(r===void 0&&(r=new p(t),a.set(t,r)),r.request(o,n));}function m(t,e){const o=t.relatedTarget;return o?.nodeType===Node.ELEMENT_NODE&&e.contains(o);}export{u as HAS_PASSIVE_EVENT_LISTENERS,y as deferAfterDelegatedCancellation,h as eventListenerOptionsOf,m as isLeaveWithin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BoxBottom as
|
|
1
|
+
import{BoxBottom as r,BoxLeft as t,BoxRight as c,BoxTop as i,axisOfBoxSide as x,logicalBoxSidesOf as f}from"./box-side";import{assertDebug as p,printDebug as s}from"./debug";import{attributeValueOf as S,setAttribute as h}from"./dom";import{checkBrowser as B,checkServer as k}from"./environment";import{HAS_PASSIVE_EVENT_LISTENERS as u,deferAfterDelegatedCancellation as d,eventListenerOptionsOf as g}from"./event";import{checkArgument as A,checkArray as O,checkBoolean as E,checkNumber as D,checkObject as L,checkState as V,checkString as v,checkValueDefined as N}from"./preconditions";import{consumeProps as R,isPropReactive as T}from"./reactive";export{r as BoxBottom,t as BoxLeft,c as BoxRight,i as BoxTop,u as HAS_PASSIVE_EVENT_LISTENERS,p as assertDebug,S as attributeValueOf,x as axisOfBoxSide,A as checkArgument,O as checkArray,E as checkBoolean,B as checkBrowser,D as checkNumber,L as checkObject,k as checkServer,V as checkState,v as checkString,N as checkValueDefined,R as consumeProps,d as deferAfterDelegatedCancellation,g as eventListenerOptionsOf,T as isPropReactive,f as logicalBoxSidesOf,s as printDebug,h as setAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function i(n,e){if(!n)throw new Error(e===void 0?"invalid state":`invalid state: ${e}`);}function o(n,e){if(!n)throw new Error(e===void 0?"invalid argument":`invalid argument: ${e}`);}function s(n,e){if(n==null)throw new ReferenceError(`${e??"value"} is 'null' or 'undefined'`);}function r(n,e,t){if(typeof e!==n)throw new TypeError(`${t??"value"} is not a ${n}`);}function a(n,e){r("boolean",n,e);}function u(n,e){r("number",n,e);}function c(n,e){r("string",n,e);}function l(n,e){r("object",n,e);}function f(n,e){if(!Array.isArray(n))throw new TypeError(`${e??"value"} is not an array`);}export{o as checkArgument,f as checkArray,a as checkBoolean,u as checkNumber,l as checkObject,i as checkState,c as checkString,s as checkValueDefined};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$PROXY as i,untrack as c}from"solid-js";function u(e,t){return i in e||Object.getOwnPropertyDescriptor(e,t)?.get!==void 0}function d(e,t,P){const r={};if(!(i in e))for(const n of t){const o=Object.getOwnPropertyDescriptor(e,n);o?.get===void 0&&(r[n]=o?.value)}return P!==void 0&&P.length>0&&c(()=>{for(const n of P)r[n]=e[n]}),r}export{d as consumeProps,u as isPropReactive};
|
|
1
|
+
import{$PROXY as i,untrack as c}from"solid-js";function u(e,t){return i in e||Object.getOwnPropertyDescriptor(e,t)?.get!==void 0;}function d(e,t,P){const r={};if(!(i in e))for(const n of t){const o=Object.getOwnPropertyDescriptor(e,n);o?.get===void 0&&(r[n]=o?.value);}return P!==void 0&&P.length>0&&c(()=>{for(const n of P)r[n]=e[n];}),r;}export{d as consumeProps,u as isPropReactive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ye=.008856451679035631,pe=24389/27,He=1.02117770275752,Ae=.9863077294280124,Le=.9339605082802299,Q=.3884814537800353,be=29.980997194447333,q=1.0169191804458755,_e=1.3173270022537198,Ie=.759112960023724,Ne=.8834525670408592,Ke=1.1319226830134397,Be=5,ze=8,k=he(0,256),Ye=he(.5,255),je=new Float64Array(3),Ue=new Float64Array(3),Ce=new Float64Array(3);function Ge(e){let n=e/255;return n<=.040449936?n/12.92*100:Math.pow((n+.055)/1.055,2.4)*100}function he(e,n){let r=new Float64Array(n);for(let o=0;o<n;o++)r[o]=Ge(e+o);return r}function N(e){let n=e/100;return(n<=.0031308?n*12.92:1.055*Math.pow(n,1/2.4)-.055)*255}function X(e){return x(0,255,Math.round(N(e)))}function Se(e,n,r){return(4278190080|X(e)<<16|X(n)<<8|X(r))>>>0}function K(e){return e>ye?Math.pow(e,1/3):(pe*e+16)/116}function $e(e){let n=e*e*e;return n>ye?n:(116*e-16)/pe}function xe(e){return e<0?-1:e===0?0:1}function P(e){let n=Math.pow(Math.abs(e),.42);return xe(e)*400*n/(n+27.13)}function ee(e){let n=Math.abs(e);return xe(e)*Math.pow(Math.max(0,27.13*n/(400-n)),1/.42)}function fe(e,n,r){let o=P(.001200833568784504*e+.002389694492170889*n+.0002795742885861124*r),t=P(.0005891086651375999*e+.0029785502573438758*n+.0003270666104008398*r),a=P(.00010146692491640572*e+.0005364214359186694*n+.0032979401770712076*r);return Math.atan2((o+t-2*a)/9,(11*o-12*t+a)/11)}function me(e){return(e+Math.PI*8)%(Math.PI*2)}function re(e,n,r){return me(n-e)<me(r-e)}function We(e,n){let r=Ce,o=n%4<=1?0:100,t=n%2===0?0:100,a;return n<4?(a=(e-o*.7152-t*.0722)/.2126,r[0]=a,r[1]=o,r[2]=t):n<8?(a=(e-t*.2126-o*.0722)/.7152,r[0]=t,r[1]=a,r[2]=o):(a=(e-o*.2126-t*.7152)/.0722,r[0]=o,r[1]=t,r[2]=a),a>=0&&a<=100}function Xe(e,n,r){let o=3846.153846153846*(.25*(Math.cos(e+2)+3.8))*q,t=Math.sin(e),a=Math.cos(e),i=Math.sqrt(r)*11;for(let c=0;;c++){let u=i/100,s=n===0||i===0?0:n/Math.sqrt(u),d=Math.pow(s*Ke,1/.9),m=be*Math.pow(u,Ie)/q,y=23*(m+.305)*d/(23*o+11*d*a+108*d*t),b=y*a,C=y*t,f=ee((460*m+451*b+288*C)/1403),p=ee((460*m-891*b-261*C)/1403),M=ee((460*m-220*b-6300*C)/1403),V=1373.2198709594231*f-1100.4251190754821*p-7.278681089101213*M,G=-271.815969077903*f+559.6580465940733*p-32.46047482791194*M,$=1.9622899599665666*f-57.173814538844006*p+308.7233197812385*M;if(V<0||G<0||$<0)return 0;let W=.2126*V+.7152*G+.0722*$;if(W<=0)return 0;if(c===Be-1||Math.abs(W-r)<.002)return V>100.01||G>100.01||$>100.01?0:Se(V,G,$);i-=(W-r)*i/(2*W)}}function qe(e,n){let r=je,o=Ue,t=Ce,a=0,i=0,c=!1,u=!1;for(let s=0;s<12;s++){if(!We(n,s))continue;let d=fe(t[0],t[1],t[2]);c?(!u||re(a,d,i))&&(u=!0,re(a,e,d)?(o.set(t),i=d):(r.set(t),a=d)):(r.set(t),o.set(t),a=d,i=d,c=!0)}for(let s=0;s<3;s++){let d=r[s],m=o[s];if(d===m)continue;let y=d<m?Math.floor(N(d)-.5):Math.ceil(N(d)-.5),b=d<m?Math.ceil(N(m)-.5):Math.floor(N(m)-.5);for(let C=0;C<ze&&Math.abs(b-y)>1;C++){let f=Math.floor((y+b)/2),p=(Ye[f]-r[s])/(o[s]-r[s]);for(let V=0;V<3;V++)t[V]=r[V]+(o[V]-r[V])*p;let M=fe(t[0],t[1],t[2]);re(a,e,M)?(o.set(t),b=f):(r.set(t),a=M,y=f)}}return Se((r[0]+o[0])/2,(r[1]+o[1])/2,(r[2]+o[2])/2)}function x(e,n,r){return r<e?e:r>n?n:r}function S(e){let n=e%360;return n<0?n+360:n}function H(e){return 100*$e((e+16)/116)}function ne(e){return K(e/100)*116-16}function Re(e){let n=k[e>>16&255],r=k[e>>8&255],o=k[e&255],t=K((.41233895*n+.35762064*r+.18051042*o)/95.047),a=K((.2126*n+.7152*r+.0722*o)/100),i=K((.01932141*n+.11916382*r+.95034478*o)/108.883);return[116*a-16,500*(t-a),200*(a-i)]}function A(e){let n=k[e>>16&255],r=k[e>>8&255],o=k[e&255],t=.41233895*n+.35762064*r+.18051042*o,a=.2126*n+.7152*r+.0722*o,i=.01932141*n+.11916382*r+.95034478*o,c=P(Q*(He*(.401288*t+.650173*a-.051461*i))/100),u=P(Q*(Ae*(-.250268*t+1.204414*a+.045854*i))/100),s=P(Q*(Le*(-.002079*t+.048952*a+.953127*i))/100),d=(11*c-12*u+s)/11,m=(c+u-2*s)/9,y=S(Math.atan2(m,d)*180/Math.PI),b=100*Math.pow((40*c+20*u+s)/20*q/be,_e),C=.25*(Math.cos((y<20.14?y+360:y)*Math.PI/180+2)+3.8),f=5e4/13*C*q*Math.sqrt(d*d+m*m)/((20*c+20*u+21*s)/20+.305);return{argb:e,hue:y,chroma:Math.pow(f,.9)*Ne*Math.sqrt(b/100),tone:116*K(a/100)-16}}function T(e,n,r){let o=H(r);if(n<1e-4||r<1e-4||r>99.9999){let i=X(o);return(4278190080|i<<16|i<<8|i)>>>0}let t=S(e)/180*Math.PI,a=Xe(t,n,o);return a!==0?a:qe(t,o)}function w(e,n,r){return A(T(e,n,r))}function oe(e){return`#${(e&16777215).toString(16).padStart(6,"0")}`}var Fe=.04;function te(e,n){return e>n?(e+5)/(n+5):(n+5)/(e+5)}function E(e,n){return te(H(x(0,100,e)),H(x(0,100,n)))}function ae(e,n){if(e<0||e>100)return-1;let r=H(e),o=n*(r+5)-5,t=te(o,r);if(t<n&&Math.abs(t-n)>Fe)return-1;let a=ne(o)+.4;return a<0||a>100?-1:a}function ie(e,n){if(e<0||e>100)return-1;let r=H(e),o=(r+5)/n-5,t=te(r,o);if(t<n&&Math.abs(t-n)>Fe)return-1;let a=ne(o)-.4;return a<0||a>100?-1:a}function Z(e){return Math.round(e)<60}function B(e,n){let r=ae(e,n),o=ie(e,n),t=r<0?100:r,a=o<0?0:o,i=E(t,e),c=E(a,e);return Z(e)?i>=n||i>=c||Math.abs(i-c)<.1&&i<n&&c<n?t:a:c>=n||c>=i?a:t}function z(e){return e>=105&&e<125}function ce(e,n,r){if(r!==99||!z(e))return T(e,n,r);let o=T(e,n,98),t=T(e,n,100),a=4278190080;for(let i of[16,8,0])a|=Math.round(((o>>i&255)+(t>>i&255))/2)<<i;return a>>>0}function Ze(e){let n=Math.round(e.hue);return n>=90&&n<=111&&Math.round(e.chroma)>16&&Math.round(e.tone)<65}function le(e){return Ze(e)?w(e.hue,e.chroma,70):e}var D=361;function Je(e){let[,n,r]=Re(e),o=S(Math.atan2(r,n)*180/Math.PI),t=Math.sqrt(n*n+r*r);return-.5+.02*Math.pow(t,1.07)*Math.cos(S(o-50)*Math.PI/180)}function Ve(e){let n=new Uint32Array(D),r=new Float64Array(D+1),o=0,t=0;for(let a=0;a<D;a++)n[a]=T(a,e.chroma,e.tone);for(let a=0;a<=D;a++){let i=Je(a<D?n[a]:e.argb);r[a]=i,i<r[o]&&(o=a),i>=r[t]&&(t=a)}return{source:e,colors:n,temperatures:r,coldest:o,warmest:t}}function J(e,n){return n<D?A(e.colors[n]):e.source}function Y(e,n){let{temperatures:r,coldest:o,warmest:t}=e,a=r[t]-r[o];return a===0?.5:(r[n]-r[o])/a}function ge(e,n,r){return n<r?n<=e&&e<=r:n<=e||e<=r}function ve(e){let n=Ve(e),r=Math.round(e.hue),o=Y(n,r),t=0;for(let c=1;c<360;c++){let u=Y(n,(r+c)%360);t+=Math.abs(u-o),o=u}let a=t/6,i=0;o=Y(n,r);for(let c=1;;c++){let u=(r+c)%360,s=Y(n,u);if(i+=Math.abs(s-o),i>=a)return J(n,u);o=s}}function Te(e){let n=Ve(e),{temperatures:r,coldest:o,warmest:t}=n,a=J(n,o).hue,i=J(n,t).hue,c=ge(e.hue,a,i),u=c?i:a,s=c?a:i,d=1-Y(n,D),m=Math.round(e.hue),y=1e3;for(let b=0;b<=360;b++){let C=S(u+b);if(!ge(C,u,s))continue;let f=Math.round(C),p=Math.abs(d-(r[f]-r[o])/(r[t]-r[o]));p<y&&(y=p,m=f)}return J(n,m)}var j={error:["error","onError","errorContainer","onErrorContainer"],primary:["primary","onPrimary","primaryContainer","onPrimaryContainer","primaryFixed","primaryFixedDim","onPrimaryFixed","onPrimaryFixedVariant","inversePrimary"],secondary:["secondary","onSecondary","secondaryContainer","onSecondaryContainer","secondaryFixed","secondaryFixedDim","onSecondaryFixed","onSecondaryFixedVariant"],tertiary:["tertiary","onTertiary","tertiaryContainer","onTertiaryContainer","tertiaryFixed","tertiaryFixedDim","onTertiaryFixed","onTertiaryFixedVariant"]},Qe=dr(),L=10,er=[[0,18],[41,15],[61,10],[101,12],[131,15],[181,18],[251,15],[301,12]],rr=[[0,35],[41,30],[61,20],[101,25],[131,30],[181,35],[251,30],[301,25]],nr=[[0,45],[21,95],[51,45],[121,20],[151,45],[191,90],[271,45],[321,45]],or=[[0,120],[21,120],[51,20],[121,45],[151,20],[191,15],[271,20],[321,120]],tr=[[0,-40],[20,48],[71,-32],[161,40],[333,-32]],ar=[[0,-32],[38,26],[105,10],[161,-39],[204,24],[278,-15],[333,-32]],Oe=[[0,-14],[38,10],[105,-14],[140,10],[333,-14]],ir=[[0,-72],[38,35],[71,24],[105,-24],[140,62],[161,50],[253,62],[333,-72]],cr=[[0,-160],[105,155],[140,-100],[204,96],[253,-96],[278,-156],[300,-165],[333,-160]],lr=[[0,-165],[105,160],[140,-105],[204,101],[253,-101],[278,-160],[300,-170],[333,-165]],sr=[[0,10],[71,0],[124,10],[253,0],[278,10],[300,0]],ur=[[0,12],[3,22],[13,32],[23,12],[33,22],[43,32],[153,22],[273,12]];function dr(){let e=new Map;for(let n of Object.keys(j))j[n].forEach((r,o)=>e.set(r,[n,o]));return e}function fr(e){return e>=170&&e<207}function Ee(e){return e>=250&&e<270}function De(e,n){let r=0;for(let[o,t]of e)n>=o&&(r=t);return S(r)}function g(e,n){return S(n+De(e,n))}function l(e,n){return{hue:e,chroma:n,lightTone:void 0,darkTone:void 0}}function mr(e,n){let{hue:r,chroma:o}=e,t=l(25,84);switch(n){case"content":case"fidelity":{let a=le(n==="content"?ve(e):Te(e));return{primary:l(r,o),secondary:l(r,Math.max(o-32,o*.5)),tertiary:l(a.hue,a.chroma),error:t,neutral:l(r,o/8),neutralVariant:l(r,o/8+4)}}case"expressive":return{primary:l(S(r+240),40),secondary:l(g(nr,r),24),tertiary:l(g(or,r),32),error:t,neutral:l(S(r+15),8),neutralVariant:l(S(r+15),12)};case"fruitSalad":return{primary:l(S(r-50),48),secondary:l(S(r-50),36),tertiary:l(r,36),error:t,neutral:l(r,10),neutralVariant:l(r,16)};case"monochrome":return{primary:l(r,0),secondary:l(r,0),tertiary:l(r,0),error:t,neutral:l(r,0),neutralVariant:l(r,0)};case"neutral":return{primary:l(r,12),secondary:l(r,8),tertiary:l(r,16),error:t,neutral:l(r,2),neutralVariant:l(r,2)};case"rainbow":return{primary:l(r,48),secondary:l(r,16),tertiary:l(S(r+60),24),error:t,neutral:l(r,0),neutralVariant:l(r,0)};case"tonalSpot":return{primary:l(r,36),secondary:l(r,16),tertiary:l(S(r+60),24),error:t,neutral:l(r,6),neutralVariant:l(r,8)};case"vibrant":return{primary:l(r,200),secondary:l(g(er,r),24),tertiary:l(g(rr,r),32),error:t,neutral:l(r,10),neutralVariant:l(r,12)}}}function yr(e,n,r){let o=De(ur,e);switch(n){case"expressive":{let t=g(sr,e);return{primary:l(e,r?36:48),secondary:l(g(cr,e),r?16:24),tertiary:l(g(lr,e),48),error:l(o,64),neutral:l(t,r?z(t)?6:14:18)}}case"neutral":return{primary:l(e,Ee(e)?12:8),secondary:l(e,Ee(e)?6:4),tertiary:l(g(ar,e),20),error:l(o,50),neutral:l(e,1.4)};case"tonalSpot":return{primary:l(e,r?26:32),secondary:l(e,16),tertiary:l(g(tr,e),28),error:l(o,60),neutral:l(e,5)};case"vibrant":return{primary:l(e,74),secondary:l(g(Oe,e),56),tertiary:l(g(ir,e),56),error:l(o,80),neutral:l(g(Oe,e),28)}}}function se(e,n,r){return(1-r)*e+r*n}function v(e,n){let[r,o,t,a]=e;return n<=-1?r:n<0?se(r,o,n+1):n<.5?se(o,t,n/.5):n<1?se(t,a,(n-.5)/.5):a}function ue(e,n,r){let o=r?-1:1,t=r?100:0,a=w(e,n,t).chroma,i=t;for(;a<n&&t>=0&&t<=100;){t+=o;let c=w(e,n,t).chroma;a<c&&(a=c,i=t)}return i}function h(e,n,r){return e.lightTone??=ue(e.hue,e.chroma,!0),x(n,r,e.lightTone)}function _(e,n,r){return e.darkTone??=ue(e.hue,e.chroma,!1),x(n,r,e.darkTone)}function pr(e,n,r){let{hue:o,chroma:t}=n,a=e.isDark?1:-1,i=w(o,t,r).chroma,c=i,u=r;for(;i<t;){u+=a;let s=w(o,t,u).chroma;if(c>s||Math.abs(s-t)<.4)break;Math.abs(s-t)<Math.abs(i-t)&&(i=s),c=Math.max(c,s)}return u}function br(e){return e.fixed??=!e.isDark&&e.contrastLevel===0?e:{...e,isDark:!1,contrastLevel:0,definitions:new Map,tones:new Map,fixed:void 0},e.fixed}function F(e){return e.isDark?"surfaceBright":"surfaceDim"}function Cr(e,n,r){let{isDark:o,palettes:t,source:a,variant:i}=e,c=i==="monochrome",u=i==="content"||i==="fidelity",s=t[n],d=j[n];switch(r){case 0:return c&&n==="primary"?o?100:0:c&&n==="tertiary"?o?90:25:o?80:40;case 1:return c&&n==="secondary"?o?10:100:c&&n!=="error"?o?10:90:o?20:100;case 2:return u&&n==="primary"?a.tone:u&&n==="secondary"?pr(e,s,o?30:90):u&&n==="tertiary"?le(A(ce(s.hue,s.chroma,a.tone))).tone:c&&n==="primary"?o?85:25:c&&n==="secondary"?o?30:85:c&&n==="tertiary"?o?60:49:o?30:90;case 3:return u&&n!=="error"?B(O(e,d[2]).tone,4.5):c&&(n==="primary"||n==="tertiary")?o?0:100:c?o?90:10:o?90:30;case 4:return c?n==="secondary"?80:40:90;case 5:return c?n==="secondary"?70:30:80;case 6:return c&&n!=="secondary"?100:10;case 7:return c?n==="secondary"?25:90:30;case 8:return o?40:80}}function hr(e,n,r){let o=j[n],t=e.palettes[n],a=Cr(e,n,r);switch(r){case 0:case 2:return{palette:t,tone:a,background:F(e),curve:r===0?[3,4.5,7,7]:[1,1,3,4.5],pair:{nearer:o[2],farther:o[0],together:!1}};case 1:return{palette:t,tone:a,background:o[0],curve:[4.5,7,11,21]};case 3:return{palette:t,tone:a,background:o[2],curve:[3,4.5,7,11]};case 4:case 5:{let i=o[4],c=o[5];return{palette:t,tone:a,background:F(e),curve:[1,1,3,4.5],pair:{nearer:e.isDark?c:i,farther:e.isDark?i:c,together:!0}}}case 6:case 7:return{palette:t,tone:a,background:o[5],secondBackground:o[4],curve:r===6?[4.5,7,11,21]:[3,4.5,7,11]};case 8:return{palette:t,tone:a,background:"inverseSurface",curve:[3,4.5,7,7]}}}function Sr(e,n){let{contrastLevel:r,isDark:o}=e,{neutral:t,primary:a}=e.palettes,i=e.palettes.neutralVariant;switch(n){case"background":case"surface":return{palette:t,tone:o?6:98};case"surfaceDim":return{palette:t,tone:o?6:v([87,87,80,75],r)};case"surfaceBright":return{palette:t,tone:o?v([24,24,29,34],r):98};case"surfaceContainerLowest":return{palette:t,tone:o?v([4,4,2,0],r):100};case"surfaceContainerLow":return{palette:t,tone:v(o?[10,10,11,12]:[96,96,96,95],r)};case"surfaceContainer":return{palette:t,tone:v(o?[12,12,16,20]:[94,94,92,90],r)};case"surfaceContainerHigh":return{palette:t,tone:v(o?[17,17,21,25]:[92,92,88,85],r)};case"surfaceContainerHighest":return{palette:t,tone:v(o?[22,22,26,30]:[90,90,84,80],r)};case"surfaceVariant":return{palette:i,tone:o?30:90};case"inverseSurface":return{palette:t,tone:o?90:20};case"surfaceTint":return{palette:a,tone:o?80:40};case"onBackground":return{palette:t,tone:o?90:10,background:"background",curve:[3,3,4.5,7]};case"onSurface":return{palette:t,tone:o?90:10,background:F(e),curve:[4.5,7,11,21]};case"onSurfaceVariant":return{palette:i,tone:o?80:30,background:F(e),curve:[3,4.5,7,11]};case"inverseOnSurface":return{palette:t,tone:o?20:95,background:"inverseSurface",curve:[4.5,7,11,21]};case"outline":return{palette:i,tone:o?60:50,background:F(e),curve:[1.5,3,4.5,7]};case"outlineVariant":return{palette:i,tone:o?30:80,background:F(e),curve:[1,1,3,4.5]};default:return{palette:t,tone:0}}}function I(e,n,r,o,t){return e.variant==="neutral"?n:e.variant==="tonalSpot"?r:e.variant==="expressive"?o:t}function we(e,n,r){let{isDark:o,variant:t}=e,a=e.palettes[n],i=fr(a.hue);if(r===2)switch(n){case"error":return o?_(a,30,93):h(a,0,90);case"primary":return t==="neutral"?o?30:90:t==="tonalSpot"&&o?_(a,35,93):t==="tonalSpot"?h(a,0,90):t==="expressive"&&o?h(a,30,93):t==="expressive"?h(a,78,i?88:90):o?_(a,66,93):h(a,66,i?88:93);case"secondary":return t==="vibrant"&&o?_(a,30,40):t==="vibrant"?h(a,84,90):t==="expressive"?o?15:h(a,90,95):o?25:90;case"tertiary":return t==="neutral"?h(a,0,o?93:96):t==="tonalSpot"?h(a,0,o?93:100):t==="expressive"&&i?h(a,75,88):t==="expressive"?h(a,75,o?93:100):o?h(a,0,93):h(a,72,100)}switch(n){case"error":return o?_(a,0,98):h(a,0,100);case"primary":return t==="neutral"?o?80:40:t==="tonalSpot"?o?80:h(a,0,100):t==="expressive"&&z(a.hue)?h(a,0,25):h(a,0,i?88:98);case"secondary":return t==="neutral"&&o?_(a,0,98):t==="vibrant"?h(a,0,o?90:98):o?80:h(a,0,100);case"tertiary":return h(a,0,i&&(t==="expressive"||t==="vibrant")?88:o?98:100)}}function xr(e,n,r){let o=j[n],t=e.palettes[n],a=o[2],i=o[5];switch(r){case 0:{let c=we(e,n,0),u=R(e,a);return{palette:t,tone:e.isDark?x(u+5,100,c):x(0,u-5,c),background:F(e),curve:[4.5,4.5,7,11],isBackground:!0}}case 1:return{palette:t,tone:R(e,o[0]),background:o[0],curve:[6,6,7,11]};case 2:return{palette:t,tone:we(e,n,2),background:F(e),curve:e.contrastLevel>0?[1.5,1.5,3,5.5]:void 0,isBackground:!0};case 4:return{palette:t,tone:R(br(e),a),background:F(e),curve:e.contrastLevel>0?[1.5,1.5,3,5.5]:void 0,isBackground:!0};case 3:return{palette:t,tone:R(e,a),background:a,curve:n==="error"?[4.5,4.5,7,11]:[6,6,7,11]};case 5:return{palette:t,tone:x(0,100,R(e,o[4])-5)};case 6:case 7:return{palette:t,tone:R(e,i),background:i,curve:r===6?[7,7,11,21]:[4.5,4.5,7,11]};case 8:return{palette:t,tone:h(t,0,100),background:"inverseSurface",curve:[6,6,7,11]}}}function Rr(e,n){let{isDark:r,variant:o}=e,t=e.palettes.neutral,a=z(t.hue),i=o==="vibrant",c=I(e,2.2,1.7,a?r?3:2.3:1.6,1);switch(n){case"background":return O(e,"surface");case"surfaceVariant":return O(e,"surfaceContainerHighest");case"surfaceTint":return O(e,"primary");case"surface":return{palette:t,tone:r?4:a?99:i?97:98};case"surfaceDim":case"surfaceBright":{let u=I(e,2.5,1.7,a?2.7:1.75,1.36);return n==="surfaceDim"?{palette:t,chromaFactor:r?1:u,tone:r?4:a?90:i?85:87}:{palette:t,chromaFactor:r?u:1,tone:r?18:a?99:i?97:98}}case"surfaceContainerLowest":return{palette:t,tone:r?0:100};case"surfaceContainerLow":return{palette:t,chromaFactor:I(e,1.3,1.25,a?1.3:1.15,1.08),tone:r?6:a?98:i?95:96};case"surfaceContainer":return{palette:t,chromaFactor:I(e,1.6,1.4,a?1.6:1.3,1.15),tone:r?9:a?96:i?92:94};case"surfaceContainerHigh":return{palette:t,chromaFactor:I(e,1.9,1.5,a?1.95:1.45,1.22),tone:r?12:a?94:i?90:92};case"surfaceContainerHighest":return{palette:t,chromaFactor:I(e,2.2,1.7,a?2.3:1.6,1.29),tone:r?15:a?92:i?88:90};case"inverseSurface":return{palette:t,tone:r?98:4};case"onBackground":return{...O(e,"onSurface"),tone:R(e,"onSurface")};case"onSurface":{let u=i?x(0,100,ue(t.hue,t.chroma*1.1,!0)):R(e,F(e));return{palette:t,chromaFactor:c,tone:u,background:F(e),curve:r?[11,11,21,21]:[9,9,11,21]}}case"onSurfaceVariant":case"outline":case"outlineVariant":return{palette:t,chromaFactor:c,tone:R(e,F(e)),background:F(e),curve:n==="outline"?[3,3,4.5,7]:n==="outlineVariant"?[1.5,1.5,3,5.5]:r?[6,6,7,11]:[4.5,4.5,7,11]};case"inverseOnSurface":return{palette:t,tone:R(e,"inverseSurface"),background:"inverseSurface",curve:[7,7,11,21]};default:return{palette:t,tone:0}}}function O(e,n){let r=e.definitions.get(n);if(r===void 0){let o=Qe.get(n),t=e.specVersion==="2021";r=o===void 0&&t?Sr(e,n):o===void 0?Rr(e,n):t?hr(e,...o):xr(e,...o),e.definitions.set(n,r)}return r}function Fr(e,n,r,o){let{contrastLevel:t,isDark:a}=e,{nearer:i,farther:c,together:u}=o,s=a?1:-1,d=R(e,r.background),m=O(e,i),y=O(e,c),b=v(m.curve,t),C=v(y.curve,t),f=m.tone,p=y.tone;return(t<0||E(d,f)<b)&&(f=B(d,b)),(t<0||E(d,p)<C)&&(p=B(d,C)),(p-f)*s<L&&(p=x(0,100,f+L*s),(p-f)*s<L&&(f=x(0,100,p-L*s))),f>=50&&f<60||u&&p>=50&&p<60?(f=a?60:49,p=a?Math.max(p,f+L):Math.min(p,f-L)):p>=50&&p<60&&(p=a?60:49),n===i?f:p}function gr(e,n){let r=O(e,n),{background:o,curve:t,pair:a,secondBackground:i}=r,c=e.contrastLevel;if(a!==void 0)return Fr(e,n,r,a);if(o===void 0||t===void 0)return r.tone;let u=R(e,o),s=v(t,c),d=c<0||E(u,r.tone)<s?B(u,s):r.tone;if(r.isBackground&&(d=d>=57?x(65,100,d):x(0,49,d)),i!==void 0){let m=R(e,i),y=Math.max(u,m),b=Math.min(u,m);if(E(y,d)<s||E(b,d)<s){let C=ae(y,s),f=ie(b,s);d=Z(u)||Z(m)?C<0?100:C:C<0!=f<0?C<0?f:C:f<0?0:f}}return d}function R(e,n){let r=e.tones.get(n);return r===void 0&&(r=gr(e,n),e.tones.set(n,r)),r}function Me(e,n,r,o,t){let a=A(e),i=t==="2025"?yr(a.hue,n,r):void 0;return{specVersion:i!==void 0?"2025":"2021",variant:n,isDark:r,contrastLevel:o,source:a,palettes:i??mr(a,n),definitions:new Map,tones:new Map,fixed:void 0}}function ke(e,n){let{chromaFactor:r,palette:o}=O(e,n),t=R(e,n);return e.specVersion==="2021"?ce(o.hue,o.chroma,t):T(o.hue,o.chroma*(r??1),t)}var de=Object.freeze([{role:"primary",cssRole:"primary-fill"},{role:"onPrimary",cssRole:"primary-onFill"},{role:"primaryContainer",cssRole:"primary-container"},{role:"onPrimaryContainer",cssRole:"primary-onContainer"},{role:"inversePrimary",cssRole:"primary-inverseFill"},{role:"primaryFixed",cssRole:"primary-fixedFill"},{role:"primaryFixedDim",cssRole:"primary-fixedFillDim"},{role:"onPrimaryFixed",cssRole:"primary-onFixedFill"},{role:"onPrimaryFixedVariant",cssRole:"primary-onFixedFillVariant"},{role:"secondary",cssRole:"secondary-fill"},{role:"onSecondary",cssRole:"secondary-onFill"},{role:"secondaryContainer",cssRole:"secondary-container"},{role:"onSecondaryContainer",cssRole:"secondary-onContainer"},{role:"secondaryFixed",cssRole:"secondary-fixedFill"},{role:"secondaryFixedDim",cssRole:"secondary-fixedFillDim"},{role:"onSecondaryFixed",cssRole:"secondary-onFixedFill"},{role:"onSecondaryFixedVariant",cssRole:"secondary-onFixedFillVariant"},{role:"tertiary",cssRole:"tertiary-fill"},{role:"onTertiary",cssRole:"tertiary-onFill"},{role:"tertiaryContainer",cssRole:"tertiary-container"},{role:"onTertiaryContainer",cssRole:"tertiary-onContainer"},{role:"tertiaryFixed",cssRole:"tertiary-fixedFill"},{role:"tertiaryFixedDim",cssRole:"tertiary-fixedFillDim"},{role:"onTertiaryFixed",cssRole:"tertiary-onFixedFill"},{role:"onTertiaryFixedVariant",cssRole:"tertiary-onFixedFillVariant"},{role:"error",cssRole:"error-fill"},{role:"onError",cssRole:"error-onFill"},{role:"errorContainer",cssRole:"error-container"},{role:"onErrorContainer",cssRole:"error-onContainer"},{role:"background",cssRole:"background"},{role:"onBackground",cssRole:"onBackground"},{role:"surface",cssRole:"surface-fill"},{role:"onSurface",cssRole:"surface-onFill"},{role:"surfaceVariant",cssRole:"surface-fillVariant"},{role:"onSurfaceVariant",cssRole:"surface-onFillVariant"},{role:"surfaceTint",cssRole:"surface-tint"},{role:"inverseSurface",cssRole:"surface-inverseFill"},{role:"inverseOnSurface",cssRole:"surface-inverseOnFill"},{role:"surfaceBright",cssRole:"surface-fillBright"},{role:"surfaceDim",cssRole:"surface-fillDim"},{role:"surfaceContainer",cssRole:"surface-container"},{role:"surfaceContainerHigh",cssRole:"surface-containerHigh"},{role:"surfaceContainerHighest",cssRole:"surface-containerHighest"},{role:"surfaceContainerLow",cssRole:"surface-containerLow"},{role:"surfaceContainerLowest",cssRole:"surface-containerLowest"},{role:"outline",cssRole:"outline"},{role:"outlineVariant",cssRole:"outlineVariant"},{role:"scrim",cssRole:"scrim"},{role:"shadow",cssRole:"shadow"}].map(e=>Object.freeze(e))),Vr=Object.freeze(de.map(({cssRole:e})=>e)),vr=new Set(["tonalSpot","expressive","vibrant","fidelity","content","monochrome","neutral","rainbow","fruitSalad"]),Tr=/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,U=new WeakMap;function Or(e){if(typeof e=="number"){if(!Number.isFinite(e))throw new TypeError("sourceColor must be a CSS hexadecimal color or ARGB number");if(!Number.isInteger(e)||e<0||e>4294967295)throw new RangeError("sourceColor ARGB number must be an integer in [0, 0xffffffff]");return e>>>0}let n=typeof e=="string"?e.trim().replace(/^#/,""):"";if(!Tr.test(n))throw new TypeError("sourceColor must be a CSS hexadecimal color or ARGB number");let r=n.length<=4?n.replace(/./g,"$&$&"):n;return((r.length===8?parseInt(r.slice(6),16):255)<<24|parseInt(r.slice(0,6),16))>>>0}function Er(e,n,r){let o=e===void 0?{}:typeof e=="string"?{mode:e}:typeof e=="boolean"?{isDark:e}:e;if(typeof o!="object"||o===null||Array.isArray(o))throw new TypeError("color-scheme options must be an object");if(o.isDark!==void 0&&typeof o.isDark!="boolean")throw new TypeError("isDark must be a boolean");let t=o.isDark===void 0?o.mode??"light":o.isDark?"dark":"light",a=n??o.contrastLevel??0,i=r??o.variant??"tonalSpot",c=o.specVersion??"2025";if(o.mode!==void 0&&o.mode!==t)throw new RangeError("mode and isDark select different color-scheme modes");if(t!=="light"&&t!=="dark")throw new TypeError("mode must be 'light' or 'dark'");if(!Number.isFinite(a)||a<-1||a>1)throw new RangeError("contrastLevel must be a finite number in [-1, 1]");if(!vr.has(i))throw new TypeError("variant is not a supported Material 3 color style");if(c!=="2021"&&c!=="2025")throw new TypeError("specVersion must be '2021' or '2025'");return{mode:t,contrastLevel:a,variant:i,specVersion:c}}function wr(e,n,r,o){let t=Or(e),a=Er(n,r,o),i=Me(t,a.variant,a.mode==="dark",a.contrastLevel,a.specVersion),c={},u={},s={},d={},m="";for(let{role:y,cssRole:b}of de){let C=ke(i,y),f=oe(C);c[y]=C,u[y]=f,s[b]=f,d[`--cw-Color-${b}`]=f,m+=`--cw-Color-${b}:${f};`}return Object.freeze({...u,specVersion:i.specVersion,sourceColor:oe(t),sourceColorArgb:t,mode:a.mode,isDark:a.mode==="dark",contrastLevel:a.contrastLevel,variant:a.variant,argb:Object.freeze(c),values:Object.freeze(s),variables:Object.freeze(d),cssText:`${m}color-scheme:${a.mode}`})}function Pe(e,n){let{style:r}=e;for(let[o,t]of n.properties)r.getPropertyValue(o)!==t.applied||r.getPropertyPriority(o)!==""||(t.value===""?r.removeProperty(o):r.setProperty(o,t.value,t.priority));U.delete(e)}function Dr(e,n){if(typeof e?.style?.setProperty!="function")throw new TypeError("target must be an Element with inline CSS styles");if(typeof n?.variables!="object"||typeof n.cssText!="string")throw new TypeError("scheme must be a color scheme created by createColorScheme");let{style:r}=e,o=U.get(e),t=new Map,a={properties:t},i=[...Object.entries(n.variables),["color-scheme",n.mode]];for(let[c,u]of i){let s=o?.properties.get(c),d=s!==void 0&&r.getPropertyValue(c)===s.applied&&r.getPropertyPriority(c)==="";t.set(c,{value:d?s.value:r.getPropertyValue(c),priority:d?s.priority:r.getPropertyPriority(c),applied:u}),r.setProperty(c,u)}return U.set(e,a),()=>{U.get(e)===a&&Pe(e,a)}}function Mr(e){let n=U.get(e);n!==void 0&&Pe(e,n)}export{Vr as COLOR_SCHEME_CSS_ROLES,de as COLOR_SCHEME_ROLE_MAPPINGS,Dr as applyColorScheme,wr as createColorScheme,Mr as removeColorScheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function z(t,e){if(!t)throw new Error(e===void 0?"invalid state":`invalid state: ${e}`)}function b(t,e){if(!t)throw new Error(e===void 0?"invalid argument":`invalid argument: ${e}`)}var f=class t{static Unrounded=new t;radius;smoothing;constructor(e=0,n=0){b(Number.isFinite(e)&&e>=0,"corner radius must be at least 0"),b(n>=0&&n<=1,"corner smoothing must be in [0, 1]"),this.radius=e,this.smoothing=n,Object.freeze(this)}};function E(t,e){b(Number.isFinite(t)&&Number.isFinite(e),"point coordinates must be finite")}function v(t,e){return Math.sqrt(t*t+e*e)}var x=class t{static Zero=new t(0,0);x;y;constructor(e,n){E(e,n),this.x=e,this.y=n,Object.freeze(this)}static interpolate(e,n,o){return new t(e.x+(n.x-e.x)*o,e.y+(n.y-e.y)*o)}minus(e){return new t(this.x-e.x,this.y-e.y)}plus(e){return new t(this.x+e.x,this.y+e.y)}times(e){return new t(this.x*e,this.y*e)}div(e){return new t(this.x/e,this.y/e)}distanceSquared(){return this.x*this.x+this.y*this.y}distance(){return Math.sqrt(this.distanceSquared())}dot(e){return this.x*e.x+this.y*e.y}direction(){let e=this.distance();return z(e>0,"a zero-length vector has no direction"),this.div(e)}rotate90(){return new t(-this.y,this.x)}cross(e){return this.x*e.y-this.y*e.x}rotate(e,n=t.Zero){let o=e*Math.PI/180,r=Math.cos(o),u=Math.sin(o),s=this.x-n.x,i=this.y-n.y;return new t(s*r-i*u+n.x,s*u+i*r+n.y)}};function q(t,e){if(e===void 0)return new x(Math.cos(t),Math.sin(t));let n=v(t,e);return b(n>0,"a zero-length vector has no direction"),new x(t/n,e/n)}function gn(t,e){return t.minus(e).distance()}function Re(t,e,n){return(e.x-t.x)*(n.y-e.y)-(e.y-t.y)*(n.x-e.x)>0}var oe=1e-4,re,O=class t{points;constructor(e){let n=re;if(re=void 0,n==="frame"){this.points=e;return}b(e.length===8,"a cubic curve requires exactly eight coordinates"),b(n?fn(e):e.every(Number.isFinite),"cubic coordinates must be finite"),this.points=Object.freeze(n?e:Array.from(e)),Object.freeze(this)}get anchor0X(){return this.points[0]}get anchor0Y(){return this.points[1]}get control0X(){return this.points[2]}get control0Y(){return this.points[3]}get control1X(){return this.points[4]}get control1Y(){return this.points[5]}get anchor1X(){return this.points[6]}get anchor1Y(){return this.points[7]}static fromPoints(e,n,o,r){return N([e.x,e.y,n.x,n.y,o.x,o.y,r.x,r.y])}static straightLine(e,n,o,r){return N([e,n,e+(o-e)/3,n+(r-n)/3,e+2*(o-e)/3,n+2*(r-n)/3,o,r])}static circularArc(e,n,o,r,u,s){let i=o-e,c=r-n,a=q(i,c),l=q(u-e,s-n),d=a.dot(l);if(d>.999)return t.straightLine(o,r,u,s);let h=Math.sqrt(i*i+c*c)*4/3*(Math.sqrt(2*(1-d))-Math.sqrt(Math.max(0,1-d*d)))/(1-d)*(-a.y*(u-e)+a.x*(s-n)>=0?1:-1);return N([o,r,o-a.y*h,r+a.x*h,u+l.y*h,s-l.x*h,u,s])}static empty(e,n){return N([e,n,e,n,e,n,e,n])}static interpolate(e,n,o){let r=[];X(o);for(let u=0;u<8;u++)r.push(e.points[u]+(n.points[u]-e.points[u])*o);return Me(r)}pointAt(e){return new x(I(this.points,0,e),I(this.points,1,e))}zeroLength(){return Ke(this.points,0)}convexTo(e){let[n,o,,,,,r,u]=this.points;return Re(new x(n,o),new x(r,u),new x(e.points[6],e.points[7]))}calculateBounds(e=[0,0,0,0],n=!1){return j(e),U(e),H(e,this.points,0,n),e}split(e){return we(this.points,0,e).map(N)}reverse(){return N(Se(this.points))}transformed(e){let{points:n}=this;return t.fromPoints(e(n[0],n[1]),e(n[2],n[3]),e(n[4],n[5]),e(n[6],n[7]))}equals(e){return e instanceof t&&this.points.every((n,o)=>n===e.points[o])}toString(){let[e,n,o,r,u,s,i,c]=this.points;return`Cubic(${e},${n} ${o},${r} ${u},${s} ${i},${c})`}};function N(t){return re="frozen",new O(t)}function Me(t){return re="frame",new O(t)}function X(t){b(Number.isFinite(t),"interpolation progress must be finite")}function fn(t){let e=0;for(let n=0;n<8;n++)e+=t[n]*0;return e===0}function Se(t){return[t[6],t[7],t[4],t[5],t[2],t[3],t[0],t[1]]}function I(t,e,n){let o=1-n,r=o*o,u=n*n;return t[e]*r*o+t[e+2]*3*n*r+t[e+4]*3*u*o+t[e+6]*u*n}function we(t,e,n){let o=1-n,r=I(t,e,n),u=I(t,e+1,n),s=t[e],i=t[e+1],c=t[e+2],a=t[e+3],l=t[e+4],d=t[e+5],h=t[e+6],m=t[e+7];return E(r,u),[[s,i,s*o+c*n,i*o+a*n,s*o*o+c*2*o*n+l*n*n,i*o*o+a*2*o*n+d*n*n,r,u],[r,u,c*o*o+l*2*o*n+h*n*n,a*o*o+d*2*o*n+m*n*n,l*o+h*n,d*o+m*n,h,m]]}function Ke(t,e){for(let n=0;n<8;n++)if(!(Math.abs(t[e+n]-t[e+(n&1)])<oe))return!1;return!0}function ve(t,e){return Math.abs(t.points[6]-e.points[0])<=oe&&Math.abs(t.points[7]-e.points[1])<=oe}function j(t){b(t.length>=4,"bounds buffer must have at least four entries")}function U(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function H(t,e,n,o){let r=Ke(e,n);for(let u=0;u<2;u++){let s=e[n+u],i=e[n+u+2],c=e[n+u+4],a=e[n+u+6],l=s,d=s;if(!r)if(l=Math.min(s,a),d=Math.max(s,a),o)l=Math.min(l,i,c),d=Math.max(d,i,c);else{let h=-s+3*i-3*c+a,m=2*s-4*i+2*c,y=-s+i,R=m*m-4*h*y,w=[];Math.abs(h)>=1e-4?R>0&&w.push((-m+Math.sqrt(R))/(2*h),(-m-Math.sqrt(R))/(2*h)):Math.abs(m)>=1e-4&&w.push(-y/m);for(let M of w)if(M>0&&M<1){let k=1-M,S=s*k*k*k+3*i*M*k*k+3*c*M*M*k+a*M*M*M;l=Math.min(l,S),d=Math.max(d,S)}}t[u]=Math.min(t[u],l),t[u+2]=Math.max(t[u+2],d)}}var _=class t{cubics;kind;convex;constructor(e,n,o=!0){b(e.length>0,"a polygon feature requires at least one cubic");for(let r=1;r<e.length;r++)b(ve(e[r-1],e[r]),"polygon feature cubics must be contiguous");this.cubics=Object.freeze([...e]),this.kind=n,this.convex=n==="corner"?o:!0,Object.freeze(this)}get isEdge(){return this.kind==="edge"}get isCorner(){return this.kind==="corner"}get isIgnorableFeature(){return this.kind==="edge"}get isConvexCorner(){return this.kind==="corner"&&this.convex}get isConcaveCorner(){return this.kind==="corner"&&!this.convex}transformed(e){return new t(this.cubics.map(n=>n.transformed(e)),this.kind,this.convex)}reversed(){return new t(this.cubics.map(e=>e.reverse()).reverse(),this.kind,this.kind==="corner"?!this.convex:!0)}equals(e){return e instanceof t&&this.kind===e.kind&&this.convex===e.convex&&this.cubics.length===e.cubics.length&&this.cubics.every((n,o)=>n.equals(e.cubics[o]))}},A=class t{center;features;cubics;constructor(e,n){let o=[];for(let r=0;r<e.length;r++){let{cubics:u}=e[r];for(let s=0;s<u.length;s++)o.push(u[s])}b(e.length>=2,"a polygon requires at least two features");for(let r=0;r<o.length;r++)b(ve(o[(r||o.length)-1],o[r]),"polygon features must form a contiguous closed outline");this.center=n,this.features=Object.freeze([...e]),this.cubics=Object.freeze(Pn(e,o,n)),Object.freeze(this)}get centerX(){return this.center.x}get centerY(){return this.center.y}static fromVertices(e,n=f.Unrounded,o,r,u){b(e.length>=6&&e.length%2===0,"a polygon requires at least three x/y vertex pairs");let s=e.length/2,i=[],c=n instanceof f?{rounding:n,perVertexRounding:o,centerX:r,centerY:u}:n,a=c.perVertexRounding,l=0,d=0;b(a===void 0||a.length*2===e.length,"per-vertex rounding must have one entry per vertex");for(let m=0;m<s;m++)E(e[m*2],e[m*2+1]),l+=e[m*2],d+=e[m*2+1],i.push(a?.[m]??c.rounding??f.Unrounded);let h=pn(e,i);return new t(h,new x(c.centerX??l/s,c.centerY??d/s))}static fromFeatures(e,n,o){let r=0,u=0,s=0;for(let i=0;i<e.length;i++){let{cubics:c}=e[i];for(let a=0;a<c.length;a++)r+=c[a].points[0],u+=c[a].points[1],s++}return new t(e,new x(n??(s===0?0:r/s),o??(s===0?0:u/s)))}static fromNumVertices(e,n=1,o=0,r=0,u=f.Unrounded,s){return b(Number.isInteger(e)&&e>=3,"a polygon requires at least three vertices"),b(Number.isFinite(n)&&n>0,"polygon radius must be positive"),t.fromVertices(ke(e,o,r,n),u,s,o,r)}transformed(e){let n=this.features.map(o=>o.transformed(e));return new t(n,e(this.centerX,this.centerY))}normalized(){let e=this.calculateBounds(),n=e[0],o=e[1],r=e[2]-n,u=e[3]-o,s=Math.max(r,u),i=(s-r)/2-n,c=(s-u)/2-o;return b(s>0,"cannot normalize a zero-area polygon"),this.transformed((a,l)=>new x(Je((a+i)/s),Je((l+c)/s)))}calculateBounds(e=[0,0,0,0],n=!0){j(e),U(e);for(let o=0;o<this.cubics.length;o++)H(e,this.cubics[o].points,0,n);return e}calculateMaxBounds(e=[0,0,0,0]){let{x:n,y:o}=this.center,r=0;j(e);for(let u=0;u<this.cubics.length;u++){let s=this.cubics[u],i=s.pointAt(.5);r=Math.max(r,v(s.points[0]-n,s.points[1]-o),v(i.x-n,i.y-o))}return e[0]=n-r,e[1]=o-r,e[2]=n+r,e[3]=o+r,e}equals(e){return e instanceof t&&this.features.length===e.features.length&&this.features.every((n,o)=>n.equals(e.features[o]))}};function yn(t){return t instanceof A}function ke(t,e,n,...o){let r=[];for(let u=0;u<t;u++){let s=2*Math.PI*u/t,i=o[u%o.length];r.push(e+Math.cos(s)*i,n+Math.sin(s)*i)}return r}function Je(t){return t<0&&t>-1e-12?0:t>1&&t<1.000000000001?1:t}function pn(t,e){let n=e.length,o=[],r=[],u=[],s=[];for(let i=0;i<n;i++){let c=t[i*2],a=t[i*2+1],l=((i||n)-1)*2,d=(i+1)%n*2,h=t[l]-c,m=t[l+1]-a,y=t[d]-c,R=t[d+1]-a,w=v(h,m),M=v(y,R),k=w===0||M===0,S=k?[0,0,0,0]:[h/w,m/w,y/M,R/M],B=Math.max(-1,Math.min(1,S[0]*S[2]+S[1]*S[3])),$=Math.sqrt(1-B*B),{radius:W,smoothing:Z}=e[i],D=!k&&$>.001?W*(B+1)/$:0;S.push(D,(1+Z)*D,m*y-h*R),o.push(S)}for(let i=0;i<n;i++){let c=(i+1)%n,a=v(t[i*2]-t[c*2],t[i*2+1]-t[c*2+1]),l=o[i][4]+o[c][4],d=o[i][5]+o[c][5];r.push(l>a?[a/l,0]:d>a?[1,(a-l)/(d-l)]:[1,1])}for(let i=0;i<n;i++){let c=o[i],a=t[i*2],l=t[i*2+1],{radius:d,smoothing:h}=e[i],m=c[4],y=c[5],R=r[(i||n)-1],w=r[i],M=[m*R[0]+(y-m)*R[1],m*w[0]+(y-m)*w[1]],k=Math.min(M[0],M[1]),S=Math.min(k,m);if(!(m>=1e-4&&k>=1e-4&&d>=1e-4)){u.push([O.empty(a,l)]);continue}let B=d*S/m,$=(c[0]+c[2])/2,W=(c[1]+c[3])/2,Z=v($,W),D=v(B,S),K=a+$/Z*D,J=l+W/Z*D,Q=[a+c[0]*S,l+c[1]*S,a+c[2]*S,l+c[3]*S],ze=be=>{let V=be*2,ge=c[V],fe=c[V+1],ee=Q[V],ne=Q[V+1],qe=be===0?((i||n)-1)*2:(i+1)%n*2,je=t[qe],Ye=t[qe+1],ye=M[be],pe=ye>y?h:ye>m?h*(ye-m)/(y-m):0,$e=S*(1+pe),De=a+ge*$e,Xe=l+fe*$e,Ue=q(ee+((ee+Q[2-V])/2-ee)*pe-K,ne+((ne+Q[3-V])/2-ne)*pe-J),Pe=K+Ue.x*B,xe=J+Ue.y*B,He=-(Pe-K),_e=-(xe-J),te=ge*He+fe*_e,Ce=(Pe-je)*He+(xe-Ye)*_e,Ge=Math.abs(te)<1e-4||Math.abs(te)<1e-4*Math.abs(Ce),We=Ge?ee:je+ge*(Ce/te),Ze=Ge?ne:Ye+fe*(Ce/te);return[De,Xe,(De+We*2)/3,(Xe+Ze*2)/3,We,Ze,Pe,xe]},me=ze(0),he=ze(1);u.push([N(me),O.circularArc(K,J,me[6],me[7],he[6],he[7]),N(Se(he))])}for(let i=0;i<n;i++){let c=u[i][u[i].length-1].points,a=u[(i+1)%n][0].points;s.push(new _(u[i],"corner",o[i][6]>0),new _([O.straightLine(c[6],c[7],a[0],a[1])],"edge"))}return s}function Pn(t,e,n){let o=t[0].cubics,r=[],u=e;if(o.length===3){let i=o[1].split(.5);u=[i[1],o[2]].concat(e.slice(3),o[0],i[0])}for(let i=0;i<u.length;i++){let c=u[i];c.zeroLength()?r.length>0&&r.push(Qe(r.pop(),c.points,6)):r.push(c)}if(r.length===0)return[O.empty(n.x,n.y)];let s=r[0].points;return r.push(Qe(r.pop(),s,0)),r}function Qe(t,e,n){let o=[...t.points];return o[6]=e[n],o[7]=e[n+1],N(o)}var T=class t{static circle(e=8,n=1,o=0,r=0){return b(Number.isInteger(e)&&e>=3,"a circle requires at least three vertices"),b(Number.isFinite(n)&&n>0,"circle radius must be positive"),A.fromNumVertices(e,n/Math.cos(Math.PI/e),o,r,new f(n))}static rectangle(e=2,n=2,o=f.Unrounded,r,u=0,s=0){let i=u+e/2,c=s+n/2,a=u-e/2,l=s-n/2;return b(Number.isFinite(e)&&e>0&&Number.isFinite(n)&&n>0,"rectangle dimensions must be positive"),A.fromVertices([i,c,a,c,a,l,i,l],o,r,u,s)}static star(e,n=1,o=.5,r=f.Unrounded,u,s,i=0,c=0){return b(Number.isInteger(e)&&e>=2,"a star requires at least two outer vertices"),b(Number.isFinite(n)&&n>0&&Number.isFinite(o)&&o>0,"star radii must be positive"),b(o<n,"star inner radius must be less than its radius"),A.fromVertices(ke(e*2,i,c,n,o),r,s??Array.from({length:e*2},(a,l)=>l%2===0?r:u??r),i,c)}static pill(e=2,n=1,o=0,r=0,u=0){return b(Number.isFinite(e)&&e>0&&Number.isFinite(n)&&n>0,"pill dimensions must be positive"),t.rectangle(e,n,new f(Math.min(e,n)/2,o),void 0,r,u)}};var xn=new x(.5,.5),Cn=[];function P(t,e,n){let o=[],r=[],u=t.map(([,,i,c])=>new f(i,c)),s=(i,c,a)=>{o.push(i,c),r.push(u[a])};if(n){let i=e*2,c=2*Math.PI/i,a=t.map(([d,h])=>Math.atan2(h-.5,d-.5)),l=t.map(([d,h])=>v(d-.5,h-.5));for(let d=0;d<i;d++){let h=d%2===0;for(let m=0;m<t.length-(h?0:1);m++){let y=h?m:t.length-1-m,R=h?c*d+a[y]:c*d+(c-a[y]+2*a[0]);s(.5+Math.cos(R)*l[y],.5+Math.sin(R)*l[y],y)}}}else for(let i=0;i<e;i++)for(let c=0;c<t.length;c++){let a=new x(t[c][0],t[c][1]).rotate(i*360/e,xn);s(a.x,a.y,c)}return A.fromVertices(o,f.Unrounded,r,.5,.5)}function Y(t,e){return t.transformed((n,o)=>new x(n,o).rotate(e))}function en(t,e){return t.transformed((n,o)=>new x(n,o*e))}function g(t,e){return Cn[t]??=e().normalized()}function Rn(){return g(0,()=>T.circle(10))}function Mn(){return g(5,()=>Y(en(T.circle(),.64),-45))}function Sn(){return g(6,()=>P([[.961,.039,.426],[1.001,.428],[1,.609,1]],2,!0))}function wn(){return g(12,()=>P([[.5,-.009,.172],[1.03,.365,.164],[.828,.97,.169]],1,!0))}function vn(){return g(15,()=>T.star(8,1,.8,new f(.15)))}function kn(){return g(16,()=>P([[1.237,1.236,.258],[.5,.918,.233]],4))}function An(){return g(19,()=>Y(T.star(9,1,.8,new f(.5)),-90))}function Tn(){return g(24,()=>P([[.193,.277,.053],[.176,.055,.053]],10))}var ue=class t{static get Circle(){return Rn()}static get Square(){return g(1,()=>T.rectangle(1,1,new f(.3)))}static get Slanted(){return g(2,()=>P([[.926,.97,.189,.811],[-.021,.967,.187,.057]],2))}static get Arch(){return g(3,()=>Y(A.fromNumVertices(4,1,0,0,f.Unrounded,[new f(1),new f(1),new f(.2),new f(.2)]),-135))}static get SemiCircle(){return g(4,()=>T.rectangle(1.6,1,f.Unrounded,[new f(.2),new f(.2),new f(1),new f(1)]))}static get Oval(){return Mn()}static get Pill(){return Sn()}static get Triangle(){return g(7,()=>Y(A.fromNumVertices(3,1,0,0,new f(.2)),-90))}static get Arrow(){return g(8,()=>P([[.5,.892,.313],[-.216,1.05,.207],[.499,-.16,.215,1],[1.225,1.06,.211]],1))}static get Fan(){return g(9,()=>P([[1.004,1,.148,.417],[0,1,.151],[0,-.003,.148],[.978,.02,.803]],1))}static get Diamond(){return g(10,()=>P([[.5,1.096,.151,.524],[.04,.5,.159]],2))}static get ClamShell(){return g(11,()=>P([[.171,.841,.159],[-.02,.5,.14],[.17,.159,.159]],2))}static get Pentagon(){return wn()}static get Gem(){return g(13,()=>P([[.499,1.023,.241,.778],[-.005,.792,.208],[.073,.258,.228],[.433,0,.491]],1,!0))}static get VerySunny(){return g(14,()=>P([[.5,1.08,.085],[.358,.843,.085]],8))}static get Sunny(){return vn()}static get Cookie4Sided(){return kn()}static get Cookie6Sided(){return g(17,()=>P([[.723,.884,.394],[.5,1.099,.398]],6))}static get Cookie7Sided(){return g(18,()=>Y(T.star(7,1,.75,new f(.5)),-90))}static get Cookie9Sided(){return An()}static get Cookie12Sided(){return g(20,()=>Y(T.star(12,1,.8,new f(.5)),-90))}static get Clover4Leaf(){return g(21,()=>P([[.5,.074],[.725,-.099,.476]],4,!0))}static get Clover8Leaf(){return g(22,()=>P([[.5,.036],[.758,-.101,.209]],8))}static get Burst(){return g(23,()=>P([[.5,-.006,.006],[.592,.158,.006]],12))}static get SoftBurst(){return Tn()}static get Boom(){return g(25,()=>P([[.457,.296,.007],[.5,-.051,.007]],15))}static get SoftBoom(){return g(26,()=>P([[.733,.454],[.839,.437,.532],[.949,.449,.439,1],[.998,.478,.174]],16,!0))}static get Flower(){return g(27,()=>P([[.37,.187],[.416,.049,.381],[.479,.001,.095]],8,!0))}static get Puffy(){return g(28,()=>en(P([[.5,.053],[.545,-.04,.405],[.67,-.035,.426],[.717,.066,.574],[.722,.128],[.777,.002,.36],[.914,.149,.66],[.926,.289,.66],[.881,.346],[.94,.344,.126],[1.003,.437,.255]],2,!0),.742))}static get PuffyDiamond(){return g(29,()=>P([[.87,.13,.146],[.818,.357],[1,.332,.853]],4,!0))}static get Ghostish(){return g(30,()=>P([[.5,0,1],[1,0,1],[1,1.14,.254,.106],[.575,.906,.253]],1,!0))}static get PixelCircle(){return g(31,()=>P([[.5,0],[.704,0],[.704,.065],[.843,.065],[.843,.148],[.926,.148],[.926,.296],[1,.296]],2,!0))}static get PixelTriangle(){return g(32,()=>P([[.11,.5],[.113,0],[.287,0],[.287,.087],[.421,.087],[.421,.17],[.56,.17],[.56,.265],[.674,.265],[.675,.344],[.789,.344],[.789,.439],[.888,.439]],1,!0))}static get Bun(){return g(33,()=>P([[.796,.5],[.853,.518,1],[.992,.631,1],[.968,1,1]],2,!0))}static get Heart(){return g(34,()=>P([[.5,.268,.016],[.792,-.066,.958],[1.064,.276,1],[.501,.946,.129]],1,!0))}static byName(e){return b(Ae.includes(e),`unknown Material shape: ${e}`),t[e]}static all(){return Ae.map(e=>({name:e,polygon:t[e]}))}},Ae=Nn();function Nn(){return Object.freeze(Object.getOwnPropertyNames(ue).filter(t=>t<"a"))}var nn=new WeakMap,Ne=class{start;end;cubicCount;#e;#n;constructor(e,n){let o=[],r=[];En(on(e),on(n),o,r);for(let u of[o,r]){for(let s=8;s<u.length;s+=8)u[s]=u[s-2],u[s+1]=u[s-1];u[u.length-2]=u[0],u[u.length-1]=u[1]}for(let u=0;u<o.length;u++)r[u]=r[u]-o[u];this.start=e,this.end=n,this.cubicCount=o.length/8,this.#e=o,this.#n=r,Object.freeze(this)}asCubics(e){let n=[];X(e);for(let o=0;o<this.#e.length;o+=8)n.push(this.#t(o,e));return n}forEachCubic(e,n){X(e);for(let o=0;o<this.#e.length;o+=8)n(this.#t(o,e))}calculateBounds(e=[0,0,0,0],n=!0){return tn(e,this.start.calculateBounds([0,0,0,0],n),this.end.calculateBounds([0,0,0,0],n))}calculateMaxBounds(e=[0,0,0,0]){return tn(e,this.start.calculateMaxBounds(),this.end.calculateMaxBounds())}_frame(e,n){X(e);for(let o=0;o<this.#e.length;o++)n[o]=this.#e[o]+this.#n[o]*e;return n}#t(e,n){let o=this.#e,r=this.#n;return Me([o[e]+r[e]*n,o[e+1]+r[e+1]*n,o[e+2]+r[e+2]*n,o[e+3]+r[e+3]*n,o[e+4]+r[e+4]*n,o[e+5]+r[e+5]*n,o[e+6]+r[e+6]*n,o[e+7]+r[e+7]*n])}};function tn(t,e,n){return j(t),t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function F(t){let e=t-Math.floor(t);return e<1?e:0}function ie(t,e){return Math.min(Math.abs(t-e),1-Math.abs(t-e))}function rn(t,e,n){return n>=e?e<=t&&t<=n:t>=e||t<=n}function Oe(t){let e=t[0],n=t[1];for(let o=1;o<=3;o++){let r=I(t,0,o/3),u=I(t,1,o/3);E(r,u),t.push(v(r-e,u-n)),e=r,n=u}return t}function un(t){return t[8]+t[9]+t[10]}function sn(t,e){let n=[],o=0;for(let r=0;r<t.length;r++){let u=e[r+1];u-e[r]>1e-4&&(n.push({curve:t[r],start:o,end:u}),o=u)}return z(n.length>0,"a measured outline requires a curve of nonzero length"),n.push({...n.pop(),end:1}),n}function on(t){let{features:e}=t,n=nn.get(t);if(n===void 0){let o=[],r=[0],u=[],s=0,i=0;for(let c=0;c<e.length;c++){let{cubics:a}=e[c];for(let l=0;l<a.length;l++)o.push(Oe([...a[l].points])),s+=un(o[o.length-1]),r.push(s)}b(s>0&&Number.isFinite(s),"a polygon outline must have length");for(let c=0;c<r.length;c++)r[c]=r[c]/s;for(let c=0;c<e.length;c++){let{cubics:a,kind:l,convex:d}=e[c],h=i+(a.length>>1),m=a[0].points,y=a[a.length-1].points;l==="corner"&&u.push({convex:d,progress:F((r[h]+r[h+1])/2),x:(m[0]+y[6])/2,y:(m[1]+y[7])/2}),i+=a.length}n={segments:sn(o,r),corners:u},nn.set(t,n)}return n}function Fe({curve:t,start:e,end:n},o){let r=Math.max(e,Math.min(o,n)),u=(n-e===0?0:(r-e)/(n-e))*un(t),s=1;for(let c=8;c<11;c++){if(t[c]>=u){s=(c-7)/3-(1-u/t[c])/3;break}u-=t[c]}let i=we(t,0,s);return[{curve:Oe(i[0]),start:e,end:r},{curve:Oe(i[1]),start:r,end:n}]}function On(t,e){let n=t.find(({end:o})=>Math.abs(o-e)<=1e-6);return e<1e-4?0:n===void 0?e:n.end<1?n.end:0}function Fn(t,e){let n=t.findIndex(({start:s,end:i})=>s<=e&&e<=i),o=Fe(t[n],e),r=[o[1].curve],u=[0,o[1].end-e];for(let s=n+1;s<n+t.length;s++){let{curve:i,end:c}=t[s%t.length];r.push(i),u.push(c-e+(s<t.length?0:1))}return r.push(o[0].curve),u.push(1),sn(r,u)}function Te(t,e,n){let o=t.length-1,r=0;for(;r<o&&!rn(n,t[r],t[r+1]);)r++;let u=r===o?0:r+1,s=t[r],i=e[r],c=F(t[u]-s);return F(i+F(e[u]-i)*(c<.001?.5:F(n-s)/c))}function Bn(t,e){let n=[],o=new Set,r=[],u=[],s=0;for(let i=0;i<t.length;i++)for(let c=0;c<e.length;c++){let a=t[i],l=e[c],d=(a.x-l.x)*(a.x-l.x)+(a.y-l.y)*(a.y-l.y);a.convex===l.convex&&(n.push([a,l,d]),s=Math.max(s,d*1e-9))}for(let i=0;i<n.length;i++)n[i][2]=s>0?Math.round(n[i][2]/s):0;if(n.sort((i,c)=>i[2]-c[2]||i[0].progress-c[0].progress||i[1].progress-c[1].progress),n.length===1){let[{progress:i},{progress:c}]=n[0];return[[i,F(i+.5)],[c,F(c+.5)]]}for(let i=0;i<n.length;i++){let c=n[i][0],a=n[i][1],l=c.progress,d=a.progress;if(o.has(c)||o.has(a))continue;let h=r.findIndex(m=>m>l);if(h<0&&(h=r.length),r.length>0){let m=(h||r.length)-1,y=h%r.length;if(ie(l,r[m])<=1e-4||ie(l,r[y])<=1e-4||ie(d,u[m])<=1e-4||ie(d,u[y])<=1e-4||r.length>=2&&!rn(d,u[m],u[y]))continue}if(r.splice(h,0,l),u.splice(h,0,d),o.add(c).add(a),r.length===Math.min(t.length,e.length))break}return r.length>=2?[r,u]:[[0,.5],[0,.5]]}function se(t,e){for(let n=0;n<8;n++)t.push(e[n])}function En(t,e,n,o){let[r,u]=Bn(t.corners,e.corners),s=On(e.segments,Te(r,u,0)),i=t.segments,c=s===0?e.segments:Fn(e.segments,s),a=0,l=0,d=i[0],h=c[0];for(;d!==void 0&&h!==void 0;){let m=a===i.length-1?1:d.end,y=l===c.length-1?1:Te(u,r,F(h.end+s)),R=Math.min(m,y);if(m>R+1e-6){let w=Fe(d,R);se(n,w[0].curve),d=w[1]}else se(n,d.curve),d=i[++a];if(y>R+1e-6){let w=Fe(h,F(Te(r,u,R)-s));se(o,w[0].curve),h=w[1]}else se(o,h.curve),h=c[++l]}z(d===void 0&&h===void 0,"polygon outlines could not be fully matched")}var G=1e5,le=[1,0,0,1,0,0],C=new Uint8Array(0),p=0,cn,Be=new Float64Array(0);function Ie(t){return b(Number.isFinite(t),"path coordinates must be finite"),String(Math.round(t*G)/G)}var L=class{#e;constructor(){this.#e=""}moveTo(e,n){return this.#n("M",[e,n])}lineTo(e,n){return this.#n("L",[e,n])}cubicTo(e,n,o,r,u,s){return this.#n("C",[e,n,o,r,u,s])}close(){return this.#n("Z",[])}rewind(){return this._assign("")}toSvgPathData(){return this.#e}toString(){return this.#e}_assign(e){return this.#e=e,this}#n(e,n){return this._assign(this.#e+e+n.map(Ie).join(" "))}};function In(t,e=new L){return b(t.length>0,"a path requires at least one cubic"),de(e,Ve(t),t.length,le,!1)}function dn(t,e,n=new L){let o=Ve(t.cubics);return de(n,o,t.cubics.length,mn(o,t.centerX,t.centerY,e?.startAngle),e?.repeatPath===!0)}function Ln(t,e,n,o=new L){let r=t._frame(e,Le(t.cubicCount)),{start:u,end:s}=t;return de(o,r,t.cubicCount,mn(r,u.centerX+(s.centerX-u.centerX)*e,u.centerY+(s.centerY-u.centerY)*e,n?.startAngle),n?.repeatPath===!0)}var an=/[\s,]*/y,Vn=/[A-Za-z]/y,zn=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,qn=/[01]/y,jn=7,Yn=new Set([3,4]);function ce(t,e,n){return t.lastIndex=n,t.exec(e)?.[0]}function $n(t,e){let n="",o="",r=0,u=!1,s=ce(an,t,0)?.length??0;for(;s<t.length;){let i=ce(Vn,t,s),c=u&&Yn.has(r%jn),a=i??ce(c?qn:zn,t,s);if(b(a!==void 0,`invalid path data at ${s}: ${t}`),s+=a.length,s+=ce(an,t,s)?.length??0,i!==void 0){n+=i,o="",r=0,u=i==="A"||i==="a";continue}let l=String(Number(Number(a).toFixed(e))).replace(/^(-?)0\./,"$1."),d=o===""||l.startsWith("-")||l.startsWith(".")&&o.includes(".");n+=d?l:` ${l}`,o=l,r++}return n}function Dn(t){return dn(t).toSvgPathData()}function Xn(t,e,n=e){return hn(Ve(t.cubics),t.cubics.length,e,n)}function Un(t,e,n,o=n){return hn(t._frame(e,Le(t.cubicCount)),t.cubicCount,n,o)}function Le(t){return Be.length<t*8&&(Be=new Float64Array(t*16)),Be}function Ve(t){let e=Le(t.length);for(let n=0;n<t.length;n++){let o=t[n].points;for(let r=0;r<8;r++)e[n*8+r]=o[r]}return e}function mn(t,e,n,o){if(o===void 0)return le;let r=o*Math.PI/180-Math.atan2(t[1]-n,t[0]-e),u=Math.cos(r),s=Math.sin(r);return[u,s,-s,u,e-u*e+s*n,n-s*e-u*n]}function hn(t,e,n,o){b(Number.isFinite(n)&&n>0&&Number.isFinite(o)&&o>0,"a CSS path box must have a positive size");let r=[0,0,0,0];U(r);for(let l=0;l<e;l++)H(r,t,l*8,!0);let[u,s,i,c]=r,a=[n,0,0,o,(1-u-i)*n/2,(1-s-c)*o/2];return`path('${de(new L,t,e,a,!1)}')`}function Ee(t){if(p+t>C.length){let e=new Uint8Array(Math.max(C.length*2,p+t));e.set(C),C=e}}function ln(t){let e=Math.round(t*G);if(e>-2147483648&&e<2147483648){e<0&&(C[p++]=45,e=-e);let n=e%G;if(bn((e-n)/G),n>0){C[p]=46;for(let o=p+5,r=n;o>p;o--)C[o]=48+r%10,r=(r-r%10)/10;for(p+=6;C[p-1]===48;)p--}}else{let n=Ie(t);for(let o=0;o<n.length;o++)C[p++]=n.charCodeAt(o)}}function bn(t){t>=10&&bn((t-t%10)/10),C[p++]=48+t%10}function ae(t,e,n){ln(t===le?e:t[0]*e+t[2]*n+t[4]),C[p++]=32,ln(t===le?n:t[1]*e+t[3]*n+t[5])}function de(t,e,n,o,r){let u=p=0;try{Ee(200),C[p++]=77,ae(o,e[0],e[1]);for(let s=0;s<n*8;s+=8)u=p,Ee(200),C[p++]=67,ae(o,e[s+2],e[s+3]),C[p++]=32,ae(o,e[s+4],e[s+5]),C[p++]=32,ae(o,e[s+6],e[s+7]);if(r){let s=p;Ee(s),C[p++]=76,C.copyWithin(p,1,s),p+=s-1}C[p++]=90,u=p}finally{p=u,t._assign(Hn())}return t}function Hn(){return cn??=new TextDecoder,cn.decode(C.subarray(0,p))}export{oe as CUBIC_CONTINUITY_EPSILON,f as CornerRounding,O as Cubic,Ae as MATERIAL_SHAPE_NAMES,ue as MaterialShapes,Ne as Morph,L as Path,x as Point,_ as PolygonFeature,A as RoundedPolygon,T as Shapes,$n as compactSvgPath,In as cubicsToPath,q as directionVector,gn as distanceBetween,Ie as formatPathCoordinate,Re as isConvex,yn as isRoundedPolygon,Un as morphToCssPath,Ln as morphToPath,dn as roundedPolygonToPath,Xn as toCssPath,Dn as toSvgPath};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SpringOptions } from "./spring";
|
|
2
|
+
/**
|
|
3
|
+
* Height of a container that follows its content.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link followHeight}
|
|
6
|
+
*/
|
|
7
|
+
export interface FollowedHeight {
|
|
8
|
+
/**
|
|
9
|
+
* Stop following. A spring under way stops where it is, and the height stays there.
|
|
10
|
+
*/
|
|
11
|
+
cancel(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Wait until the height of the container rests where its content last told it to.
|
|
14
|
+
*
|
|
15
|
+
* A change of the content reaches the container with the next rendering update, so wait for
|
|
16
|
+
* that update first. A hidden document gets none, and this would wait for ever on it.
|
|
17
|
+
*
|
|
18
|
+
* @returns promise resolved once no spring moves the height
|
|
19
|
+
*/
|
|
20
|
+
settled(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Make the height of a container follow the height of its content.
|
|
24
|
+
*
|
|
25
|
+
* The content keeps its own height, laid out at the width of the container, and the container
|
|
26
|
+
* springs to it whenever it changes. A spring under way is retargeted, keeping its speed, so that
|
|
27
|
+
* content changing again does not jolt the container. The height changes at once while the
|
|
28
|
+
* container shows nothing, as before its entrance, and when the width of the content changed too,
|
|
29
|
+
* as when the window resizes, because the height that follows from a new width is not a motion.
|
|
30
|
+
* Under a hidden document or reduced motion, the spring settles at once, as every spring does.
|
|
31
|
+
*
|
|
32
|
+
* The container must clip what overflows it, as the content does while the container grows, and
|
|
33
|
+
* while an expressive spring overshoots as it shrinks. It holds nothing but its content, without
|
|
34
|
+
* padding or a border of its own. Height here is the block size, in a vertical writing mode too.
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* onMount(() => void followHeight(frame, content));
|
|
38
|
+
*
|
|
39
|
+
* <div ref={frame} style={{ overflow: "clip" }}><div ref={content}>{props.children}</div></div>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param container - element whose height follows
|
|
43
|
+
* @param content - child of the container, whose height it follows
|
|
44
|
+
* @param opts - spring characteristics, the default spatial spring unless named
|
|
45
|
+
* @returns the height followed
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* Within a Solid owner, following stops as the owner is disposed. Otherwise, the caller must
|
|
49
|
+
* {@link FollowedHeight.cancel | cancel} it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function followHeight(container: HTMLElement, content: HTMLElement, opts?: Readonly<Omit<SpringOptions, "unit" | "velocity">>): FollowedHeight;
|
|
@@ -12,20 +12,24 @@
|
|
|
12
12
|
* gesture drives or user input retargets mid-flight: it reads its stiffness and damping ratio from
|
|
13
13
|
* the same roles, preserves its velocity when retargeted, and accepts the release velocity
|
|
14
14
|
* estimated by a {@link VelocityTracker}. Runtime springs of a window share one animation-frame
|
|
15
|
-
* callback, available to other per-frame motion through {@link subscribeMotionFrames}.
|
|
15
|
+
* callback, available to other per-frame motion through {@link subscribeMotionFrames}. {@link
|
|
16
|
+
* followHeight} springs the height of a container to its content.
|
|
16
17
|
*
|
|
17
18
|
* Web Animation motion completes without animating during server rendering or when the API is
|
|
18
19
|
* unavailable. Runtime springs settle immediately during server rendering, without an animation
|
|
19
|
-
* frame clock, or when reduced motion is requested. Both motion APIs honor
|
|
20
|
-
* explicitly configured otherwise. {@link SUPPORTS_MOTION} describes Web
|
|
20
|
+
* frame clock, in a hidden document, or when reduced motion is requested. Both motion APIs honor
|
|
21
|
+
* reduced motion unless explicitly configured otherwise. {@link SUPPORTS_MOTION} describes Web
|
|
22
|
+
* Animations support only.
|
|
21
23
|
*
|
|
22
24
|
* @packageDocumentation
|
|
23
25
|
*/
|
|
26
|
+
export type { FollowedHeight } from "./follow-height";
|
|
24
27
|
export type { MotionFrameListener } from "./frame";
|
|
25
28
|
export type { MaterialTransition, MaterialTransitionOptions, MaterialTransitionPattern } from "./material";
|
|
26
29
|
export type { Motion, MotionDuration, MotionEasing, MotionKeyframe, MotionOptions } from "./motion";
|
|
27
30
|
export type { SpringMotion, SpringOptions, SpringRole, SpringScheme, SpringSpeed } from "./spring";
|
|
28
31
|
export type { TransitionElement, TransitionMotion, TransitionProps, TransitionState, TransitionTarget } from "./transition";
|
|
32
|
+
export { followHeight } from "./follow-height";
|
|
29
33
|
export { subscribeMotionFrames } from "./frame";
|
|
30
34
|
export { createMaterialTransition } from "./material";
|
|
31
35
|
export { SUPPORTS_MOTION, applyMotion } from "./motion";
|
|
@@ -195,9 +195,9 @@ export interface SpringMotion {
|
|
|
195
195
|
* SpringMotion.retarget | retargeting} it continues from its current value and velocity, and
|
|
196
196
|
* {@link SpringOptions.velocity | `opts.velocity`} hands it the release velocity of a gesture.
|
|
197
197
|
* All springs of a window share one animation-frame callback and frame clock. A spring settles
|
|
198
|
-
* immediately during server rendering, without an animation-frame clock,
|
|
199
|
-
* is preferred (unless {@link SpringOptions.respectReducedMotion |
|
|
200
|
-
* `false`). Its value remains applied after it settles.
|
|
198
|
+
* immediately during server rendering, without an animation-frame clock, while its document is
|
|
199
|
+
* hidden, or while reduced motion is preferred (unless {@link SpringOptions.respectReducedMotion |
|
|
200
|
+
* `respectReducedMotion`} is `false`). Its value remains applied after it settles.
|
|
201
201
|
*
|
|
202
202
|
* ```ts
|
|
203
203
|
* const spring = applySpringMotion(thumb, "translate", 0, 20, { speed: "fast", unit: "px" });
|
|
@@ -29,7 +29,7 @@ export { CornerRounding } from "./corner-rounding";
|
|
|
29
29
|
export { CUBIC_CONTINUITY_EPSILON, Cubic } from "./cubic";
|
|
30
30
|
export { MATERIAL_SHAPE_NAMES, MaterialShapes } from "./material-shapes";
|
|
31
31
|
export { Morph } from "./morph";
|
|
32
|
-
export { Path, cubicsToPath, formatPathCoordinate, morphToCssPath, morphToPath, roundedPolygonToPath, toCssPath, toSvgPath } from "./path";
|
|
32
|
+
export { Path, compactSvgPath, cubicsToPath, formatPathCoordinate, morphToCssPath, morphToPath, roundedPolygonToPath, toCssPath, toSvgPath } from "./path";
|
|
33
33
|
export { Point, directionVector, distanceBetween, isConvex } from "./point";
|
|
34
34
|
export { PolygonFeature, RoundedPolygon, isRoundedPolygon } from "./rounded-polygon";
|
|
35
35
|
export { Shapes } from "./shapes";
|