@pg-labs-incubator/cobweb 0.0.5 → 0.0.7

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.
Files changed (137) hide show
  1. package/package.json +7 -4
  2. package/src/action/button.yaml +9 -0
  3. package/target/esbuild/action/action.css +1 -1
  4. package/target/esbuild/action/base.jsx +1 -1
  5. package/target/esbuild/action/button.jsx +6 -4
  6. package/target/esbuild/action/fab-menu-context.jsx +1 -1
  7. package/target/esbuild/action/fab-menu.jsx +3 -3
  8. package/target/esbuild/action/fab.jsx +3 -3
  9. package/target/esbuild/action/group.jsx +7 -7
  10. package/target/esbuild/action/icon-button.jsx +3 -3
  11. package/target/esbuild/action/index.jsx +1 -1
  12. package/target/esbuild/action/progress-button.css +1 -0
  13. package/target/esbuild/action/progress-button.jsx +4 -0
  14. package/target/esbuild/action/split-button.jsx +4 -4
  15. package/target/esbuild/color/contrast.jsx +1 -1
  16. package/target/esbuild/color/dynamic.jsx +1 -1
  17. package/target/esbuild/color/hct.jsx +1 -1
  18. package/target/esbuild/color/index.jsx +1 -1
  19. package/target/esbuild/color/palette.jsx +1 -1
  20. package/target/esbuild/color/scheme.jsx +1 -1
  21. package/target/esbuild/color/temperature.jsx +1 -1
  22. package/target/esbuild/container/card.jsx +1 -1
  23. package/target/esbuild/container/elevation-shadow.jsx +1 -1
  24. package/target/esbuild/container/index.jsx +1 -1
  25. package/target/esbuild/dom/client.jsx +1 -1
  26. package/target/esbuild/dom/index.jsx +1 -1
  27. package/target/esbuild/dom/server.jsx +1 -1
  28. package/target/esbuild/dom/types.jsx +1 -1
  29. package/target/esbuild/feedback/badge.jsx +6 -6
  30. package/target/esbuild/feedback/focus.jsx +1 -1
  31. package/target/esbuild/feedback/index.jsx +1 -1
  32. package/target/esbuild/feedback/loading.jsx +3 -3
  33. package/target/esbuild/feedback/observe.jsx +1 -1
  34. package/target/esbuild/feedback/progress.jsx +9 -9
  35. package/target/esbuild/feedback/snackbar.jsx +6 -6
  36. package/target/esbuild/feedback/tooltip.jsx +6 -6
  37. package/target/esbuild/icon/icon.jsx +1 -1
  38. package/target/esbuild/icon/index.jsx +1 -1
  39. package/target/esbuild/index.jsx +1 -1
  40. package/target/esbuild/input/autocomplete.jsx +2 -2
  41. package/target/esbuild/input/base.jsx +2 -2
  42. package/target/esbuild/input/date-picker.jsx +19 -19
  43. package/target/esbuild/input/date-time.jsx +3 -3
  44. package/target/esbuild/input/index.jsx +1 -1
  45. package/target/esbuild/input/paired-input.jsx +1 -1
  46. package/target/esbuild/input/picker-dialog.jsx +3 -3
  47. package/target/esbuild/input/select.jsx +4 -4
  48. package/target/esbuild/input/slider.jsx +7 -7
  49. package/target/esbuild/input/text-field.jsx +4 -4
  50. package/target/esbuild/input/time-picker.jsx +5 -5
  51. package/target/esbuild/motion/follow-height.jsx +1 -0
  52. package/target/esbuild/motion/frame.jsx +1 -1
  53. package/target/esbuild/motion/index.jsx +1 -1
  54. package/target/esbuild/motion/material.jsx +1 -1
  55. package/target/esbuild/motion/motion.jsx +1 -1
  56. package/target/esbuild/motion/spring.jsx +1 -1
  57. package/target/esbuild/motion/transition.jsx +1 -1
  58. package/target/esbuild/motion/velocity.jsx +1 -1
  59. package/target/esbuild/navigation/app-bar.jsx +8 -8
  60. package/target/esbuild/navigation/base.jsx +1 -1
  61. package/target/esbuild/navigation/drawer.jsx +7 -7
  62. package/target/esbuild/navigation/index.jsx +1 -1
  63. package/target/esbuild/navigation/navigation.jsx +12 -12
  64. package/target/esbuild/navigation/scroll.jsx +1 -1
  65. package/target/esbuild/navigation/search.jsx +4 -4
  66. package/target/esbuild/navigation/tabs.jsx +3 -3
  67. package/target/esbuild/navigation/toolbar.jsx +3 -3
  68. package/target/esbuild/selection/base.jsx +1 -1
  69. package/target/esbuild/selection/checkbox.jsx +4 -4
  70. package/target/esbuild/selection/chip.jsx +5 -5
  71. package/target/esbuild/selection/index.jsx +1 -1
  72. package/target/esbuild/selection/radio.jsx +3 -3
  73. package/target/esbuild/selection/segmented.jsx +4 -4
  74. package/target/esbuild/selection/switch.jsx +3 -3
  75. package/target/esbuild/shape/corner-rounding.jsx +1 -1
  76. package/target/esbuild/shape/cubic.jsx +1 -1
  77. package/target/esbuild/shape/index.jsx +1 -1
  78. package/target/esbuild/shape/material-shapes.jsx +1 -1
  79. package/target/esbuild/shape/morph.jsx +1 -1
  80. package/target/esbuild/shape/path.jsx +1 -1
  81. package/target/esbuild/shape/point.jsx +1 -1
  82. package/target/esbuild/shape/rounded-polygon.jsx +1 -1
  83. package/target/esbuild/shape/shapes.jsx +1 -1
  84. package/target/esbuild/spacing/index.jsx +1 -1
  85. package/target/esbuild/state/component.jsx +1 -1
  86. package/target/esbuild/state/controller.jsx +1 -1
  87. package/target/esbuild/state/index.jsx +1 -1
  88. package/target/esbuild/state/ripple.jsx +1 -1
  89. package/target/esbuild/state/state.jsx +1 -1
  90. package/target/esbuild/state/style.jsx +1 -1
  91. package/target/esbuild/surface/carousel-layout.jsx +1 -1
  92. package/target/esbuild/surface/carousel.jsx +2 -2
  93. package/target/esbuild/surface/dialog.jsx +5 -5
  94. package/target/esbuild/surface/divider.jsx +1 -1
  95. package/target/esbuild/surface/drag.jsx +1 -1
  96. package/target/esbuild/surface/gestures.jsx +3 -3
  97. package/target/esbuild/surface/index.jsx +1 -1
  98. package/target/esbuild/surface/interactive.jsx +1 -1
  99. package/target/esbuild/surface/list-patterns.jsx +3 -3
  100. package/target/esbuild/surface/list.jsx +2 -2
  101. package/target/esbuild/surface/menu.jsx +3 -3
  102. package/target/esbuild/surface/scaffold.jsx +7 -7
  103. package/target/esbuild/surface/sheet.jsx +5 -5
  104. package/target/esbuild/surface/side-sheet.jsx +2 -2
  105. package/target/esbuild/surface/slots.jsx +1 -1
  106. package/target/esbuild/surface/surface.jsx +1 -1
  107. package/target/esbuild/text/index.jsx +1 -1
  108. package/target/esbuild/text/text.jsx +2 -2
  109. package/target/esbuild/text/typography.jsx +1 -1
  110. package/target/esbuild/text/visually-hidden.css +1 -0
  111. package/target/esbuild/text/visually-hidden.jsx +1 -0
  112. package/target/esbuild/util/box-side.jsx +1 -1
  113. package/target/esbuild/util/debug.jsx +1 -1
  114. package/target/esbuild/util/dom.jsx +1 -1
  115. package/target/esbuild/util/environment.jsx +1 -0
  116. package/target/esbuild/util/event.jsx +1 -1
  117. package/target/esbuild/util/index.jsx +1 -1
  118. package/target/esbuild/util/preconditions.jsx +1 -1
  119. package/target/esbuild/util/reactive.jsx +1 -1
  120. package/target/node/color.js +1 -0
  121. package/target/node/shape.js +1 -0
  122. package/target/tsc/action/base.d.ts +27 -8
  123. package/target/tsc/action/index.d.ts +3 -1
  124. package/target/tsc/action/progress-button.css.d.ts +3 -0
  125. package/target/tsc/action/progress-button.d.ts +46 -0
  126. package/target/tsc/motion/follow-height.d.ts +51 -0
  127. package/target/tsc/motion/index.d.ts +7 -3
  128. package/target/tsc/motion/spring.d.ts +3 -3
  129. package/target/tsc/shape/index.d.ts +1 -1
  130. package/target/tsc/shape/material-shapes.d.ts +56 -0
  131. package/target/tsc/shape/path.d.ts +16 -0
  132. package/target/tsc/text/index.d.ts +5 -2
  133. package/target/tsc/text/visually-hidden.css.d.ts +3 -0
  134. package/target/tsc/text/visually-hidden.d.ts +33 -0
  135. package/target/tsc/util/environment.d.ts +14 -0
  136. package/target/tsc/util/index.d.ts +2 -1
  137. package/target/tsc/util/preconditions.d.ts +0 -14
@@ -1,6 +1,6 @@
1
- import{createUniqueId as x,onCleanup as H,onMount as se}from"solid-js";import{insert as p}from"solid-js/web";import{defineDomComponent as G}from"..";import{DomController as ae}from"../dom/client";import{dedupeCallbacks as de}from"../navigation/base";import{firstInputSlot as m,hasInputError as B,observeFormReset as z,supportingSlot as A}from"./base";import{NO_SUPPORTING_CONTENT as oe,PairedInputController as le,createSupportingContent as ue,pairedInputAttributes as ce,resolveInputPair as pe,splitFieldProps as U,supportingChangesOf as he}from"./paired-input";import"./slider.css";const b="cw-Slider",L="cw-RangeSlider",k=0,j=100,X=8,W=["Minimum","Maximum"],Y={start:["startValue","start"],end:["endValue","end"]};function g(i,e){const n=typeof i=="number"?i:Number(i);return Number.isFinite(n)?n:e}function f(i,e,n){return Math.min(n,Math.max(e,Number.isFinite(i)?i:e))}function K(i){const e=i.map(r=>{const[s,a="0"]=r.toString().split("e"),d=s.split(".")[1]?.length??0;return[BigInt(s.replace(".","")),Number(a)-d]}),n=Math.min(...e.map(([,r])=>r));return{coefficients:e.map(([r,s])=>r*10n**BigInt(s-n)),exponent:n}}function h(i){const e=g(i.min,k),n=Math.max(e,g(i.max,j)),t=i.step==="any"||typeof i.step=="number"&&Number.isFinite(i.step)&&i.step>0?i.step:void 0;if(typeof t!="number")return{min:e,max:n,step:t,steps:0};const{coefficients:[r,s,a]}=K([e,n,t]),d=Number((s-r)/a);return{min:e,max:n,step:t,steps:d>=2?d:0}}function R(i,e){const n=f(e,i.min,i.max),t=i.step??1;if(t==="any")return n;const{coefficients:[r,s,a,d],exponent:o}=K([i.min,i.max,t,n]),l=(s-r)/a,u=((d-r)*2n+a)/(a*2n);return+`${r+(u>l?l:u)*a}e${o}`}function D(i){return i.steps===0?i.max:R(i,i.max)}function E(i,e){const n=D(i);return n===i.min?0:(f(e,i.min,n)-i.min)/(n-i.min)}function V(i,e){return i.steps!==0&&e>i.min&&e<D(i)?1:0}function Q(i,e,n,t){const r=V(i,e);return E(i,e)*(n-2*t*r)+t*r}function me(i,e,n,t){const r=D(i);if(n<=0)return i.min;if(i.steps===0)return i.min+f(e/n,0,1)*(r-i.min);const s=(n-2*t)/i.steps,a=s>0?Math.round((e-t)/s):1,d=f(a,1,i.steps-1),o=[[0,0],[d,t+d*s],[i.steps,n]],[l]=o.reduce((u,c)=>Math.abs(c[1]-e)<Math.abs(u[1]-e)?c:u);return R(i,i.min+l*i.step)}function v(i){return i.vertical===!0?"vertical":i.orientation??"horizontal"}function Z(i,e){const n=E(i,e);return n<.5?"_cw-Slider-belowCenter":n>.5?"_cw-Slider-aboveCenter":void 0}function ee(i,e,n){if(n===void 0)return{inactive:E(i,e)<.5,hidden:!1};const t=Q(i,e,n.length,n.corner),r=n.iconSize+2*n.iconPadding+n.gap,s=t>=r;return{inactive:!s,hidden:!s&&n.length-t<r}}function N(i,e){const n=e.length===2?e[0]:i.min,t=e[e.length-1];return{"--cw-slider-start":`${E(i,n)}`,"--cw-slider-end":`${E(i,t)}`,"--cw-slider-start-inset":`${V(i,n)}`,"--cw-slider-end-inset":`${V(i,t)}`,"--cw-slider-steps":`${Math.max(1,i.steps)}`}}function ne(i,e,n,t,r){const s=e.centered===!0?Z(n,t):void 0;return{[i]:!0,[`${i}-${v(e)}`]:!0,[`${i}-disabled`]:e.disabled===!0,[`${i}-error`]:r,[`${i}-readOnly`]:e.readOnly===!0,[`_${i}-${e.size??"xs"}`]:!0,[`_${i}-${e.shape??"standard"}`]:!0,"_cw-Slider-discrete":n.steps!==0,"_cw-Slider-noValueIndicator":e.valueIndicator===!1,"cw-Slider-centered":e.centered===!0,"_cw-Slider-belowCenter":s==="_cw-Slider-belowCenter","_cw-Slider-aboveCenter":s==="_cw-Slider-aboveCenter"}}function J(i){return<span class={`cw-Slider-handle cw-Slider-handle-${i}`}>
1
+ import{createUniqueId as x,onCleanup as H,onMount as se}from"solid-js";import{insert as p}from"solid-js/web";import{defineDomComponent as G}from"..";import{DomController as ae}from"../dom/client";import{dedupeCallbacks as de}from"../navigation/base";import{firstInputSlot as m,hasInputError as B,observeFormReset as z,supportingSlot as A}from"./base";import{NO_SUPPORTING_CONTENT as oe,PairedInputController as le,createSupportingContent as ue,pairedInputAttributes as ce,resolveInputPair as pe,splitFieldProps as U,supportingChangesOf as he}from"./paired-input";import"./slider.css";const b="cw-Slider",L="cw-RangeSlider",k=0,j=100,X=8,W=["Minimum","Maximum"],Y={start:["startValue","start"],end:["endValue","end"]};function g(i,e){const n=typeof i=="number"?i:Number(i);return Number.isFinite(n)?n:e;}function f(i,e,n){return Math.min(n,Math.max(e,Number.isFinite(i)?i:e));}function K(i){const e=i.map(r=>{const[s,a="0"]=r.toString().split("e"),d=s.split(".")[1]?.length??0;return[BigInt(s.replace(".","")),Number(a)-d];}),n=Math.min(...e.map(([,r])=>r));return{coefficients:e.map(([r,s])=>r*10n**BigInt(s-n)),exponent:n};}function h(i){const e=g(i.min,k),n=Math.max(e,g(i.max,j)),t=i.step==="any"||typeof i.step=="number"&&Number.isFinite(i.step)&&i.step>0?i.step:void 0;if(typeof t!="number")return{min:e,max:n,step:t,steps:0};const{coefficients:[r,s,a]}=K([e,n,t]),d=Number((s-r)/a);return{min:e,max:n,step:t,steps:d>=2?d:0};}function R(i,e){const n=f(e,i.min,i.max),t=i.step??1;if(t==="any")return n;const{coefficients:[r,s,a,d],exponent:o}=K([i.min,i.max,t,n]),l=(s-r)/a,u=((d-r)*2n+a)/(a*2n);return+`${r+(u>l?l:u)*a}e${o}`;}function D(i){return i.steps===0?i.max:R(i,i.max);}function E(i,e){const n=D(i);return n===i.min?0:(f(e,i.min,n)-i.min)/(n-i.min);}function V(i,e){return i.steps!==0&&e>i.min&&e<D(i)?1:0;}function Q(i,e,n,t){const r=V(i,e);return E(i,e)*(n-2*t*r)+t*r;}function me(i,e,n,t){const r=D(i);if(n<=0)return i.min;if(i.steps===0)return i.min+f(e/n,0,1)*(r-i.min);const s=(n-2*t)/i.steps,a=s>0?Math.round((e-t)/s):1,d=f(a,1,i.steps-1),o=[[0,0],[d,t+d*s],[i.steps,n]],[l]=o.reduce((u,c)=>Math.abs(c[1]-e)<Math.abs(u[1]-e)?c:u);return R(i,i.min+l*i.step);}function v(i){return i.vertical===!0?"vertical":i.orientation??"horizontal";}function Z(i,e){const n=E(i,e);return n<0.5?"_cw-Slider-belowCenter":n>0.5?"_cw-Slider-aboveCenter":void 0;}function ee(i,e,n){if(n===void 0)return{inactive:E(i,e)<0.5,hidden:!1};const t=Q(i,e,n.length,n.corner),r=n.iconSize+2*n.iconPadding+n.gap,s=t>=r;return{inactive:!s,hidden:!s&&n.length-t<r};}function N(i,e){const n=e.length===2?e[0]:i.min,t=e[e.length-1];return{"--cw-slider-start":`${E(i,n)}`,"--cw-slider-end":`${E(i,t)}`,"--cw-slider-start-inset":`${V(i,n)}`,"--cw-slider-end-inset":`${V(i,t)}`,"--cw-slider-steps":`${Math.max(1,i.steps)}`};}function ne(i,e,n,t,r){const s=e.centered===!0?Z(n,t):void 0;return{[i]:!0,[`${i}-${v(e)}`]:!0,[`${i}-disabled`]:e.disabled===!0,[`${i}-error`]:r,[`${i}-readOnly`]:e.readOnly===!0,[`_${i}-${e.size??"xs"}`]:!0,[`_${i}-${e.shape??"standard"}`]:!0,"_cw-Slider-discrete":n.steps!==0,"_cw-Slider-noValueIndicator":e.valueIndicator===!1,"cw-Slider-centered":e.centered===!0,"_cw-Slider-belowCenter":s==="_cw-Slider-belowCenter","_cw-Slider-aboveCenter":s==="_cw-Slider-aboveCenter"};}function J(i){return<span class={`cw-Slider-handle cw-Slider-handle-${i}`}>
2
2
  <span class="cw-Slider-value"/>
3
- </span>}function M(i,e,n){const t=i?J("start"):void 0,r=J("end");return<span class="cw-Slider-control">
3
+ </span>;}function M(i,e,n){const t=i?J("start"):void 0,r=J("end");return<span class="cw-Slider-control">
4
4
  {e}
5
5
  <span class="cw-Slider-rail"aria-hidden="true">
6
6
  <span class="_cw-Slider-segment cw-Slider-inactiveBefore"/>
@@ -10,7 +10,7 @@ import{createUniqueId as x,onCleanup as H,onMount as se}from"solid-js";import{in
10
10
  {t}
11
11
  {r}
12
12
  </span>
13
- </span>}function _(i,e){i.min=`${e.min}`,i.max=`${e.max}`,e.step===void 0?i.removeAttribute("step"):i.step=`${e.step}`}function $(i,e,n){const t=e.formatValue?.(n);t===void 0?i.removeAttribute("aria-valuetext"):i.setAttribute("aria-valuetext",t)}function te(i,e,n,t){const r=i.styleElement?.querySelectorAll(".cw-Slider-value")??[],s=t[t.length-1];for(const[a,d]of Object.entries(N(n,t)))i.setStyle(a,d);i.setClass("center",e.centered===!0?Z(n,s):void 0),i.setClass("_cw-Slider-discrete",n.steps!==0);for(const[a,d]of Array.from(r).entries()){const o=e.formatValue?.(t[a])??`${t[a]}`;d.textContent!==o&&(d.textContent=o)}}function q(i,e){const n=i.ownerDocument.defaultView?.Event??Event;i.dispatchEvent(new n(e,{bubbles:!0}))}class ie{#e;#l;#u;#f;#a;#t;#n;#d;#o;#i;constructor(e){this.#e=e,this.#l=n=>this.#r(n),this.#u=n=>{n.pointerId===this.#t&&this.#s(n)},this.#f=n=>{n.pointerId===this.#t&&this.#g(n.type==="pointerup"?n:void 0)},this.#a=null,this.#t=void 0,this.#n=void 0,this.#d=0,this.#o=[],this.#i=void 0}attach(e){const n=this.#a;if(n!==e){this.#g(void 0);for(const t of["pointerup","pointercancel","lostpointercapture"])n?.removeEventListener(t,this.#f),e?.addEventListener(t,this.#f);n?.removeEventListener("pointerdown",this.#l),n?.removeEventListener("pointermove",this.#u),e?.addEventListener("pointerdown",this.#l),e?.addEventListener("pointermove",this.#u),this.#a=e}}#c(){return!this.#e.readOnly()&&!this.#e.inputs().some(e=>e.matches(":disabled"))}#p(e){const n=this.#i,t=n.vertical?e.clientY:e.clientX;return n.reversed?n.origin-t:t-n.origin}#h(e){const n=this.#i,t=Number(this.#e.inputs()[e].value);return Q(this.#e.scale(),t,n.length,n.corner)}#b(e){if(this.#e.inputs().length===1)return 0;const n=this.#h(0),t=this.#h(1),r=Math.abs(n-e)-Math.abs(t-e);return r<0?0:r>0||n!==t?1:Math.abs(e-n)>X?e<n?0:1:void 0}#m(e,n){const t=this.#i,r=this.#e.inputs()[e],s=r.value,a=this.#p(n),d=me(this.#e.scale(),a,t.length,t.corner);r.value=`${d}`,r.value!==s&&q(r,"input")}#S(e){this.#e.inputs()[e].focus({preventScroll:!0}),this.#e.setPressed(e)}#r(e){const n=this.#a,t=n?.querySelector(".cw-Slider-rail")??null,r=this.#e.inputs();if(n===null||t===null||r.length===0||this.#t!==void 0||e.button!==0||!e.isPrimary||e.defaultPrevented||!this.#c())return;const s=t.getBoundingClientRect(),a=t.ownerDocument.defaultView.getComputedStyle(t),d=a.writingMode.startsWith("vertical"),o=!d&&a.direction==="rtl";e.preventDefault(),this.#i={vertical:d,reversed:d||o,origin:d?s.bottom:o?s.right:s.left,length:d?s.height:s.width,corner:Number.parseFloat(a.borderTopLeftRadius)||0},this.#o=r.map(l=>l.value),this.#t=e.pointerId,this.#d=this.#p(e),this.#n=this.#b(this.#d);try{n.setPointerCapture(e.pointerId)}catch{}this.#S(this.#n??r.length-1),this.#n!==void 0&&this.#m(this.#n,e)}#s(e){if(!this.#c()){this.#g(void 0);return}if(this.#n===void 0){const n=this.#p(e)-this.#d;if(Math.abs(n)<=X)return;this.#n=n<0?0:1,this.#S(this.#n)}this.#m(this.#n,e)}#g(e){const n=this.#t,t=this.#a;if(n!==void 0){e!==void 0&&this.#n!==void 0&&this.#c()&&this.#m(this.#n,e),this.#t=void 0,this.#i=void 0,this.#n=void 0,this.#e.setPressed(void 0),t?.hasPointerCapture(n)===!0&&t.releasePointerCapture(n);for(const[r,s]of this.#e.inputs().entries())s.value!==this.#o[r]&&q(s,"change")}}}function fe(i,e){const n=x(),t=x(),r=U(i),s=r.input,a=h(e),d=R(a,g("value"in e?e.value:e.defaultValue,a.min)),o=(F,re)=>F in s?s[F]:re,l=<span class="cw-Slider-label"id={n}>
13
+ </span>;}function _(i,e){i.min=`${e.min}`,i.max=`${e.max}`,e.step===void 0?i.removeAttribute("step"):i.step=`${e.step}`;}function $(i,e,n){const t=e.formatValue?.(n);t===void 0?i.removeAttribute("aria-valuetext"):i.setAttribute("aria-valuetext",t);}function te(i,e,n,t){const r=i.styleElement?.querySelectorAll(".cw-Slider-value")??[],s=t[t.length-1];for(const[a,d]of Object.entries(N(n,t)))i.setStyle(a,d);i.setClass("center",e.centered===!0?Z(n,s):void 0),i.setClass("_cw-Slider-discrete",n.steps!==0);for(const[a,d]of Array.from(r).entries()){const o=e.formatValue?.(t[a])??`${t[a]}`;d.textContent!==o&&(d.textContent=o);}}function q(i,e){const n=i.ownerDocument.defaultView?.Event??Event;i.dispatchEvent(new n(e,{bubbles:!0}));}class ie{#e;#l;#u;#f;#a;#t;#n;#d;#o;#i;constructor(e){this.#e=e,this.#l=n=>this.#r(n),this.#u=n=>{n.pointerId===this.#t&&this.#s(n);},this.#f=n=>{n.pointerId===this.#t&&this.#g(n.type==="pointerup"?n:void 0);},this.#a=null,this.#t=void 0,this.#n=void 0,this.#d=0,this.#o=[],this.#i=void 0;}attach(e){const n=this.#a;if(n!==e){this.#g(void 0);for(const t of["pointerup","pointercancel","lostpointercapture"])n?.removeEventListener(t,this.#f),e?.addEventListener(t,this.#f);n?.removeEventListener("pointerdown",this.#l),n?.removeEventListener("pointermove",this.#u),e?.addEventListener("pointerdown",this.#l),e?.addEventListener("pointermove",this.#u),this.#a=e;}}#c(){return!this.#e.readOnly()&&!this.#e.inputs().some(e=>e.matches(":disabled"));}#p(e){const n=this.#i,t=n.vertical?e.clientY:e.clientX;return n.reversed?n.origin-t:t-n.origin;}#h(e){const n=this.#i,t=Number(this.#e.inputs()[e].value);return Q(this.#e.scale(),t,n.length,n.corner);}#b(e){if(this.#e.inputs().length===1)return 0;const n=this.#h(0),t=this.#h(1),r=Math.abs(n-e)-Math.abs(t-e);return r<0?0:r>0||n!==t?1:Math.abs(e-n)>X?e<n?0:1:void 0;}#m(e,n){const t=this.#i,r=this.#e.inputs()[e],s=r.value,a=this.#p(n),d=me(this.#e.scale(),a,t.length,t.corner);r.value=`${d}`,r.value!==s&&q(r,"input");}#S(e){this.#e.inputs()[e].focus({preventScroll:!0}),this.#e.setPressed(e);}#r(e){const n=this.#a,t=n?.querySelector(".cw-Slider-rail")??null,r=this.#e.inputs();if(n===null||t===null||r.length===0||this.#t!==void 0||e.button!==0||!e.isPrimary||e.defaultPrevented||!this.#c())return;const s=t.getBoundingClientRect(),a=t.ownerDocument.defaultView.getComputedStyle(t),d=a.writingMode.startsWith("vertical"),o=!d&&a.direction==="rtl";e.preventDefault(),this.#i={vertical:d,reversed:d||o,origin:d?s.bottom:o?s.right:s.left,length:d?s.height:s.width,corner:Number.parseFloat(a.borderTopLeftRadius)||0},this.#o=r.map(l=>l.value),this.#t=e.pointerId,this.#d=this.#p(e),this.#n=this.#b(this.#d);try{n.setPointerCapture(e.pointerId);}catch{}this.#S(this.#n??r.length-1),this.#n!==void 0&&this.#m(this.#n,e);}#s(e){if(!this.#c()){this.#g(void 0);return;}if(this.#n===void 0){const n=this.#p(e)-this.#d;if(Math.abs(n)<=X)return;this.#n=n<0?0:1,this.#S(this.#n);}this.#m(this.#n,e);}#g(e){const n=this.#t,t=this.#a;if(n!==void 0){e!==void 0&&this.#n!==void 0&&this.#c()&&this.#m(this.#n,e),this.#t=void 0,this.#i=void 0,this.#n=void 0,this.#e.setPressed(void 0),t?.hasPointerCapture(n)===!0&&t.releasePointerCapture(n);for(const[r,s]of this.#e.inputs().entries())s.value!==this.#o[r]&&q(s,"change");}}}function fe(i,e){const n=x(),t=x(),r=U(i),s=r.input,a=h(e),d=R(a,g("value"in e?e.value:e.defaultValue,a.min)),o=(F,re)=>F in s?s[F]:re,l=<span class="cw-Slider-label"id={n}>
14
14
  {m(e.label)??i.children}
15
15
  </span>,u=<span class="cw-Slider-leading">
16
16
  {m(e.leading,e.leadingIcon)}
@@ -22,11 +22,11 @@ import{createUniqueId as x,onCleanup as H,onMount as se}from"solid-js";import{in
22
22
  {l}
23
23
  <span class="cw-Slider-track">{u}{c}{C}{S}{P}</span>
24
24
  {I}
25
- </label>}class Se extends ae{#e;#l;#u;#f;#a;#t;#n;#d;#o;#i;#c;#p;#h;#b;#m;#S;#r;#s;constructor(e){super(e),this.#e="value"in e,this.#l=x(),this.#u=x(),this.#f="attr:aria-label"in e||"attr:aria-labelledby"in e,this.#a="attr:aria-describedby"in e,this.#t="attr:aria-invalid"in e,this.#n="attr:aria-readonly"in e,this.#d=new ie({inputs:()=>{const n=this.functionElement;return n===null?[]:[n]},scale:()=>h(this.props),readOnly:()=>this.props.readOnly===!0,setPressed:n=>this.setClass("_cw-Slider-endPressed",n!==void 0)}),this.#o=n=>this.#C(n),this.#i=()=>this.#y(),this.#c=()=>oe,this.#p=void 0,this.#h=null,this.#b=null,this.#m=void 0,this.#S=!1,this.#r=k,this.#s=()=>{},se(()=>{const n=this.functionElement,t=this.#h,s=t?.ownerDocument.defaultView?.ResizeObserver;if(n!==null&&(this.#s(),this.#s=z(n,this.#i)),t!==null&&s!==void 0){const a=new s(()=>this.#g());a.observe(t),H(()=>a.disconnect())}}),H(()=>{this.#s(),this.#d.attach(null),this.functionElement?.removeEventListener("input",this.#o)})}#g(){const e=this.#h,n=this.#b,t=e?.ownerDocument.defaultView;if(e===null||n===null||t===null||t===void 0||!e.isConnected)return;const r=t.getComputedStyle(e),s=t.getComputedStyle(n),a=e.getBoundingClientRect(),d=o=>Number.parseFloat(s.getPropertyValue(o))||0;this.#m={length:r.writingMode.startsWith("vertical")?a.height:a.width,corner:Number.parseFloat(r.borderTopLeftRadius)||0,gap:d("--cw-slider-handle-gap")+d("--cw-slider-handle-width")/2,iconSize:d("--cw-slider-inset-icon-size"),iconPadding:d("--cw-slider-inset-icon-padding")},this.#w()}#w(){const e=ee(h(this.props),this.#r,this.#m);this.setClass("_cw-Slider-iconInactive",e.inactive),this.setClass("_cw-Slider-iconHidden",e.hidden)}#v(){const e=this.functionElement;e!==null&&(te(this,this.props,h(this.props),[this.#r]),$(e,this.props,this.#r),this.#w())}#y(){const e=this.functionElement,n=h(this.props);e!==null&&(e.value=`${f(this.#e?g(this.props.value,n.min):Number(e.value),n.min,n.max)}`,this.#r=Number(e.value),this.#v())}#C(e){const n=this.functionElement,t=h(this.props);if(!(n===null||n.disabled)){if(this.props.readOnly===!0){n.value=`${this.#r}`;return}this.#r=f(Number(n.value),t.min,t.max),this.#v(),de([this.props.onValueChange,this.props.onChange],this.#r,e),this.#e&&this.#y()}}#x(e){const n=this.#c(),t=he(this.#p,n,this.props.invalid===!0,e);if(this.#p=n,t.error!==void 0&&(this.setClass(`${b}-error`,t.error),this.#t||this.setAttribute("aria-invalid",t.error?"true":void 0)),t.described!==void 0&&!this.#a){const r=t.described?this.#u:void 0;this.setAttribute("aria-describedby",r)}}applyComponentProps(){const e=super.readProps(["attr:id","centered","defaultValue","disabled","formatValue","id","invalid","max","min","name","orientation","readOnly","required","shape","size","step","value","valueIndicator","vertical"]),n=this.functionElement,t=h(this.props),r=e.id??e["attr:id"];if(n!==null){if((e.minChanged||e.maxChanged||e.stepChanged)&&_(n,t),!this.#S){const s=g(e.defaultValue,t.min);this.#S=!0,n.defaultValue=`${f(s,t.min,t.max)}`,this.#e||(n.value=n.defaultValue)}e.valueChanged||e.minChanged||e.maxChanged||e.stepChanged?this.#y():(e.centeredChanged||e.formatValueChanged)&&this.#v(),e.disabledChanged&&(n.disabled=e.disabled===!0,this.setClass(`${b}-disabled`,e.disabled===!0)),e.readOnlyChanged&&(this.setClass(`${b}-readOnly`,e.readOnly===!0),this.#n||this.setAttribute("aria-readonly",e.readOnly===!0?"true":void 0)),e.requiredChanged&&(n.required=e.required===!0),e.nameChanged&&this.setAttribute("name",e.name===""?void 0:e.name),"id"in this.props&&n.getAttribute("id")!==(r??null)&&this.setAttribute("id",r),(e.orientationChanged||e.verticalChanged)&&(this.setClass("orientation",`${b}-${v(this.props)}`),this.setAttribute("aria-orientation",v(this.props))),e.sizeChanged&&this.setClass("size",`_cw-Slider-${e.size??"xs"}`),e.shapeChanged&&(this.setClass("shape",`_cw-Slider-${e.shape??"standard"}`),this.#g()),e.centeredChanged&&this.setClass("cw-Slider-centered",e.centered===!0),e.valueIndicatorChanged&&this.setClass("_cw-Slider-noValueIndicator",e.valueIndicator===!1),this.#x(e.invalidChanged)}}onFunctionElementChanged(e){const n=this.functionElement;this.#s(),super.onFunctionElementChanged(e),n?.removeEventListener("input",this.#o),e?.addEventListener("input",this.#o),this.#s=()=>{},e!==null&&(this.#s=z(e,this.#i))}render(e,n){const t=<span class="cw-Slider-label"id={this.#l}/>;p(t,()=>m(this.props.label)??e);const r=<span class="cw-Slider-leading"/>;p(r,()=>m(this.props.leading,this.props.leadingIcon));const s=<span class="cw-Slider-prefix"/>;p(s,()=>this.props.prefix);const a=<span class="cw-Slider-suffix"/>;p(a,()=>this.props.suffix);const d=<span class="cw-Slider-trailing"/>;p(d,()=>m(this.props.trailing,this.props.trailingIcon));const o=<span class="cw-Slider-supporting"aria-live="polite"id={this.#u}/>,l=ue(this.props);this.#c=l,p(o,()=>l().content);const u=<input aria-labelledby={this.#f?void 0:this.#l}class="cw-Slider-input _cw-Slider-end"ref={n}type="range"/>,c=<span class="cw-Slider-insetIcon"><span/></span>;p(c.firstChild,()=>this.props.insetIcon);const S=M(!1,u,c);return this.#h=S.querySelector(".cw-Slider-rail"),this.#b=c,this.#d.attach(S),<label class={b}>
25
+ </label>;}class Se extends ae{#e;#l;#u;#f;#a;#t;#n;#d;#o;#i;#c;#p;#h;#b;#m;#S;#r;#s;constructor(e){super(e),this.#e="value"in e,this.#l=x(),this.#u=x(),this.#f="attr:aria-label"in e||"attr:aria-labelledby"in e,this.#a="attr:aria-describedby"in e,this.#t="attr:aria-invalid"in e,this.#n="attr:aria-readonly"in e,this.#d=new ie({inputs:()=>{const n=this.functionElement;return n===null?[]:[n];},scale:()=>h(this.props),readOnly:()=>this.props.readOnly===!0,setPressed:n=>this.setClass("_cw-Slider-endPressed",n!==void 0)}),this.#o=n=>this.#C(n),this.#i=()=>this.#y(),this.#c=()=>oe,this.#p=void 0,this.#h=null,this.#b=null,this.#m=void 0,this.#S=!1,this.#r=k,this.#s=()=>{},se(()=>{const n=this.functionElement,t=this.#h,s=t?.ownerDocument.defaultView?.ResizeObserver;if(n!==null&&(this.#s(),this.#s=z(n,this.#i)),t!==null&&s!==void 0){const a=new s(()=>this.#g());a.observe(t),H(()=>a.disconnect());}}),H(()=>{this.#s(),this.#d.attach(null),this.functionElement?.removeEventListener("input",this.#o);});}#g(){const e=this.#h,n=this.#b,t=e?.ownerDocument.defaultView;if(e===null||n===null||t===null||t===void 0||!e.isConnected)return;const r=t.getComputedStyle(e),s=t.getComputedStyle(n),a=e.getBoundingClientRect(),d=o=>Number.parseFloat(s.getPropertyValue(o))||0;this.#m={length:r.writingMode.startsWith("vertical")?a.height:a.width,corner:Number.parseFloat(r.borderTopLeftRadius)||0,gap:d("--cw-slider-handle-gap")+d("--cw-slider-handle-width")/2,iconSize:d("--cw-slider-inset-icon-size"),iconPadding:d("--cw-slider-inset-icon-padding")},this.#w();}#w(){const e=ee(h(this.props),this.#r,this.#m);this.setClass("_cw-Slider-iconInactive",e.inactive),this.setClass("_cw-Slider-iconHidden",e.hidden);}#v(){const e=this.functionElement;e!==null&&(te(this,this.props,h(this.props),[this.#r]),$(e,this.props,this.#r),this.#w());}#y(){const e=this.functionElement,n=h(this.props);e!==null&&(e.value=`${f(this.#e?g(this.props.value,n.min):Number(e.value),n.min,n.max)}`,this.#r=Number(e.value),this.#v());}#C(e){const n=this.functionElement,t=h(this.props);if(!(n===null||n.disabled)){if(this.props.readOnly===!0){n.value=`${this.#r}`;return;}this.#r=f(Number(n.value),t.min,t.max),this.#v(),de([this.props.onValueChange,this.props.onChange],this.#r,e),this.#e&&this.#y();}}#x(e){const n=this.#c(),t=he(this.#p,n,this.props.invalid===!0,e);if(this.#p=n,t.error!==void 0&&(this.setClass(`${b}-error`,t.error),this.#t||this.setAttribute("aria-invalid",t.error?"true":void 0)),t.described!==void 0&&!this.#a){const r=t.described?this.#u:void 0;this.setAttribute("aria-describedby",r);}}applyComponentProps(){const e=super.readProps(["attr:id","centered","defaultValue","disabled","formatValue","id","invalid","max","min","name","orientation","readOnly","required","shape","size","step","value","valueIndicator","vertical"]),n=this.functionElement,t=h(this.props),r=e.id??e["attr:id"];if(n!==null){if((e.minChanged||e.maxChanged||e.stepChanged)&&_(n,t),!this.#S){const s=g(e.defaultValue,t.min);this.#S=!0,n.defaultValue=`${f(s,t.min,t.max)}`,this.#e||(n.value=n.defaultValue);}e.valueChanged||e.minChanged||e.maxChanged||e.stepChanged?this.#y():(e.centeredChanged||e.formatValueChanged)&&this.#v(),e.disabledChanged&&(n.disabled=e.disabled===!0,this.setClass(`${b}-disabled`,e.disabled===!0)),e.readOnlyChanged&&(this.setClass(`${b}-readOnly`,e.readOnly===!0),this.#n||this.setAttribute("aria-readonly",e.readOnly===!0?"true":void 0)),e.requiredChanged&&(n.required=e.required===!0),e.nameChanged&&this.setAttribute("name",e.name===""?void 0:e.name),"id"in this.props&&n.getAttribute("id")!==(r??null)&&this.setAttribute("id",r),(e.orientationChanged||e.verticalChanged)&&(this.setClass("orientation",`${b}-${v(this.props)}`),this.setAttribute("aria-orientation",v(this.props))),e.sizeChanged&&this.setClass("size",`_cw-Slider-${e.size??"xs"}`),e.shapeChanged&&(this.setClass("shape",`_cw-Slider-${e.shape??"standard"}`),this.#g()),e.centeredChanged&&this.setClass("cw-Slider-centered",e.centered===!0),e.valueIndicatorChanged&&this.setClass("_cw-Slider-noValueIndicator",e.valueIndicator===!1),this.#x(e.invalidChanged);}}onFunctionElementChanged(e){const n=this.functionElement;this.#s(),super.onFunctionElementChanged(e),n?.removeEventListener("input",this.#o),e?.addEventListener("input",this.#o),this.#s=()=>{},e!==null&&(this.#s=z(e,this.#i));}render(e,n){const t=<span class="cw-Slider-label"id={this.#l}/>;p(t,()=>m(this.props.label)??e);const r=<span class="cw-Slider-leading"/>;p(r,()=>m(this.props.leading,this.props.leadingIcon));const s=<span class="cw-Slider-prefix"/>;p(s,()=>this.props.prefix);const a=<span class="cw-Slider-suffix"/>;p(a,()=>this.props.suffix);const d=<span class="cw-Slider-trailing"/>;p(d,()=>m(this.props.trailing,this.props.trailingIcon));const o=<span class="cw-Slider-supporting"aria-live="polite"id={this.#u}/>,l=ue(this.props);this.#c=l,p(o,()=>l().content);const u=<input aria-labelledby={this.#f?void 0:this.#l}class="cw-Slider-input _cw-Slider-end"ref={n}type="range"/>,c=<span class="cw-Slider-insetIcon"><span/></span>;p(c.firstChild,()=>this.props.insetIcon);const S=M(!1,u,c);return this.#h=S.querySelector(".cw-Slider-rail"),this.#b=c,this.#d.attach(S),<label class={b}>
26
26
  {t}
27
27
  <span class="cw-Slider-track">{r}{s}{S}{a}{d}</span>
28
28
  {o}
29
- </label>}}const Re=G(()=>fe,()=>Se);function ge(i,e){const n=x(),t=U(i),r=h(e),[s,a]=pe(e,Y,!0,[void 0,void 0],(w,C)=>R(r,g(w,C===0?r.min:r.max)),(w,C)=>w-C),d=<legend class="cw-RangeSlider-label">
29
+ </label>;}}const Re=/* @__PURE__ */G(()=>fe,()=>Se);function ge(i,e){const n=x(),t=U(i),r=h(e),[s,a]=pe(e,Y,!0,[void 0,void 0],(w,C)=>R(r,g(w,C===0?r.min:r.max)),(w,C)=>w-C),d=<legend class="cw-RangeSlider-label">
30
30
  {m(e.label)??i.children}
31
31
  </legend>,o=<span class="cw-RangeSlider-leading">
32
32
  {m(e.leading,e.leadingIcon)}
@@ -41,11 +41,11 @@ import{createUniqueId as x,onCleanup as H,onMount as se}from"solid-js";import{in
41
41
  {d}
42
42
  <span class="cw-RangeSlider-track">{o}{l}{O}{u}{c}</span>
43
43
  {S}
44
- </fieldset>}class be extends le{#e;constructor(e){super(e,L,W,Y,{parse:n=>Number(n.value),compare:(n,t)=>n-t},[k,j]),this.#e=new ie({inputs:()=>{const n=this.functionElement,t=this.endInput;return n===null||t===null?[]:[n,t]},scale:()=>h(this.props),readOnly:()=>this.props.readOnly===!0,setPressed:n=>{this.setClass("_cw-Slider-startPressed",n===0),this.setClass("_cw-Slider-endPressed",n===1)}}),H(()=>this.#e.attach(null))}normalize(e,n){const t=h(this.props),r=n===0?t.min:t.max;return f(g(e,r),t.min,t.max)}applyConstraints(e,n){const t=super.readProps(["max","min","step"]),r=h(this.props);return!t.minChanged&&!t.maxChanged&&!t.stepChanged?!1:(_(e,r),_(n,r),!0)}changeCallbacks(){return[this.props.onValueChange,this.props.onRangeChange,this.props.onChange]}onPairApplied(e){const n=this.functionElement,t=this.endInput,r=h(this.props);n===null||t===null||(n.setAttribute("aria-valuemin",`${r.min}`),n.setAttribute("aria-valuemax",`${e[1]}`),t.setAttribute("aria-valuemin",`${e[0]}`),t.setAttribute("aria-valuemax",`${r.max}`),$(n,this.props,e[0]),$(t,this.props,e[1]),te(this,this.props,r,e))}applyComponentProps(){super.applyComponentProps();const e=super.readProps(["formatValue","orientation","shape","size","valueIndicator","vertical"]),n=this.endInput,t=v(this.props);(e.orientationChanged||e.verticalChanged)&&(this.setClass("orientation",`${L}-${t}`),this.setAttribute("aria-orientation",t),n?.setAttribute("aria-orientation",t)),e.sizeChanged&&this.setClass("size",`_cw-RangeSlider-${e.size??"xs"}`),e.shapeChanged&&this.setClass("shape",`_cw-RangeSlider-${e.shape??"standard"}`),e.valueIndicatorChanged&&this.setClass("_cw-Slider-noValueIndicator",e.valueIndicator===!1),e.formatValueChanged&&this.onPairApplied(this.values)}render(e,n){const t=<legend class="cw-RangeSlider-label"/>;p(t,()=>m(this.props.label)??e);const r=<span class="cw-RangeSlider-leading"/>;p(r,()=>m(this.props.leading,this.props.leadingIcon));const s=<span class="cw-RangeSlider-prefix"/>;p(s,()=>this.props.prefix);const a=<span class="cw-RangeSlider-suffix"/>;p(a,()=>this.props.suffix);const d=<span class="cw-RangeSlider-trailing"/>;p(d,()=>m(this.props.trailing,this.props.trailingIcon));const o=<span class="cw-RangeSlider-supporting"aria-live="polite"id={this.supportingId}/>;this.insertSupporting(o);const l=<>
44
+ </fieldset>;}class be extends le{#e;constructor(e){super(e,L,W,Y,{parse:n=>Number(n.value),compare:(n,t)=>n-t},[k,j]),this.#e=new ie({inputs:()=>{const n=this.functionElement,t=this.endInput;return n===null||t===null?[]:[n,t];},scale:()=>h(this.props),readOnly:()=>this.props.readOnly===!0,setPressed:n=>{this.setClass("_cw-Slider-startPressed",n===0),this.setClass("_cw-Slider-endPressed",n===1);}}),H(()=>this.#e.attach(null));}normalize(e,n){const t=h(this.props),r=n===0?t.min:t.max;return f(g(e,r),t.min,t.max);}applyConstraints(e,n){const t=super.readProps(["max","min","step"]),r=h(this.props);return!t.minChanged&&!t.maxChanged&&!t.stepChanged?!1:(_(e,r),_(n,r),!0);}changeCallbacks(){return[this.props.onValueChange,this.props.onRangeChange,this.props.onChange];}onPairApplied(e){const n=this.functionElement,t=this.endInput,r=h(this.props);n===null||t===null||(n.setAttribute("aria-valuemin",`${r.min}`),n.setAttribute("aria-valuemax",`${e[1]}`),t.setAttribute("aria-valuemin",`${e[0]}`),t.setAttribute("aria-valuemax",`${r.max}`),$(n,this.props,e[0]),$(t,this.props,e[1]),te(this,this.props,r,e));}applyComponentProps(){super.applyComponentProps();const e=super.readProps(["formatValue","orientation","shape","size","valueIndicator","vertical"]),n=this.endInput,t=v(this.props);(e.orientationChanged||e.verticalChanged)&&(this.setClass("orientation",`${L}-${t}`),this.setAttribute("aria-orientation",t),n?.setAttribute("aria-orientation",t)),e.sizeChanged&&this.setClass("size",`_cw-RangeSlider-${e.size??"xs"}`),e.shapeChanged&&this.setClass("shape",`_cw-RangeSlider-${e.shape??"standard"}`),e.valueIndicatorChanged&&this.setClass("_cw-Slider-noValueIndicator",e.valueIndicator===!1),e.formatValueChanged&&this.onPairApplied(this.values);}render(e,n){const t=<legend class="cw-RangeSlider-label"/>;p(t,()=>m(this.props.label)??e);const r=<span class="cw-RangeSlider-leading"/>;p(r,()=>m(this.props.leading,this.props.leadingIcon));const s=<span class="cw-RangeSlider-prefix"/>;p(s,()=>this.props.prefix);const a=<span class="cw-RangeSlider-suffix"/>;p(a,()=>this.props.suffix);const d=<span class="cw-RangeSlider-trailing"/>;p(d,()=>m(this.props.trailing,this.props.trailingIcon));const o=<span class="cw-RangeSlider-supporting"aria-live="polite"id={this.supportingId}/>;this.insertSupporting(o);const l=<>
45
45
  <input class="cw-RangeSlider-input _cw-Slider-start"ref={n}type="range"/>
46
46
  <input class="cw-RangeSlider-input _cw-Slider-end"ref={c=>this.setEndInput(c)}type="range"/>
47
47
  </>,u=M(!0,l);return this.#e.attach(u),<fieldset class={L}>
48
48
  {t}
49
49
  <span class="cw-RangeSlider-track">{r}{s}{u}{a}{d}</span>
50
50
  {o}
51
- </fieldset>}}const Me=G(()=>ge,()=>be);export{Me as RangeSlider,be as RangeSliderController,Re as Slider,Se as SliderController};
51
+ </fieldset>;}}const Me=/* @__PURE__ */G(()=>ge,()=>be);export{Me as RangeSlider,be as RangeSliderController,Re as Slider,Se as SliderController};
@@ -1,4 +1,4 @@
1
- import{createMemo as w,createUniqueId as p,mergeProps as I,onCleanup as N,onMount as ee,untrack as o}from"solid-js";import{defineDomComponent as te}from"..";import{DomController as ne}from"../dom/client";import{Icon as T}from"../icon";import{createFieldLabel as J,firstInputSlotOf as c,idReferencesOf as P,inputErrorOf as q,observeFormReset as ie,observeLabelInlineSize as se,splitInputElementProps as re,supportingSlotOf as B}from"./base";import"./text-field.css";const m="cw-TextField",z="cw-TextField-disabled",$="cw-TextField-error",Y="cw-TextField-readOnly",U="_cw-TextField-noAsterisk",y="cw-TextField-input",W=" ",j="Show password",K="visibility",G="visibility_off",Q="--_cw-TextField-rows",de="a[href], button, input, select, textarea, [contenteditable], [tabindex]";let V;function le(){return V??=typeof CSS<"u"&&CSS.supports("field-sizing","content"),V}function Z(i){return`_cw-TextField-${i??"filled"}`}function E(i){const{multiline:e,revealPassword:t,secure:n,type:s}=i;return e===!0||t===!1?!1:t===!0||n===!0||s==="password"}function L(i,e){const t=i.type??(i.secure===!0?"password":"text");return e&&E(i)?"text":t}function A(i,e){return e===void 0||e<=0?void 0:`${i} / ${e}`}function X(i){return i.localName==="textarea"}function ae(i){return typeof i=="function"?i():i}function oe(i,e,t){const n=p(),s=p(),r=p(),l=q(e),u=B(e,l),a=t?.(),f=re(i),{containerProps:h,elementProps:d}=f,k=e.invalid===!0||l!==void 0,S=("value"in e?e.value:e.defaultValue)??"",O=A(S.length,e.maxLength),F=e.disabled===!0,M=e.readOnly===!0,C=e.id??d.id??n,R={...d,"aria-describedby":P(d["aria-describedby"],u===void 0?void 0:s,O===void 0?void 0:r),"aria-invalid":"aria-invalid"in d?d["aria-invalid"]:k?"true":void 0,class:y,disabled:F,id:C,maxLength:e.maxLength,minLength:e.minLength,name:e.name,placeholder:e.placeholder??W,readOnly:M||void 0,required:e.required===!0,spellcheck:e.spellCheck},D=e.multiline===!0,H=J(m);return<div{...h}classList={{...h.classList,[Z(e.variant)]:!0,[z]:F,[$]:k,[U]:e.noAsterisk===!0,[Y]:M,[m]:!0,...a===void 0?void 0:{[a.className]:!0}}}style={D?{...h.style,[Q]:`${e.rows??1}`}:h.style}>
1
+ import{createMemo as w,createUniqueId as p,mergeProps as I,onCleanup as N,onMount as ee,untrack as o}from"solid-js";import{defineDomComponent as te}from"..";import{DomController as ne}from"../dom/client";import{Icon as T}from"../icon";import{createFieldLabel as J,firstInputSlotOf as c,idReferencesOf as P,inputErrorOf as q,observeFormReset as ie,observeLabelInlineSize as se,splitInputElementProps as re,supportingSlotOf as B}from"./base";import"./text-field.css";const m="cw-TextField",z="cw-TextField-disabled",$="cw-TextField-error",Y="cw-TextField-readOnly",U="_cw-TextField-noAsterisk",y="cw-TextField-input",W=" ",j="Show password",K="visibility",G="visibility_off",Q="--_cw-TextField-rows",de="a[href], button, input, select, textarea, [contenteditable], [tabindex]";let V;function le(){return V??=typeof CSS<"u"&&CSS.supports("field-sizing","content"),V;}function Z(i){return`_cw-TextField-${i??"filled"}`;}function E(i){const{multiline:e,revealPassword:t,secure:n,type:s}=i;return e===!0||t===!1?!1:t===!0||n===!0||s==="password";}function L(i,e){const t=i.type??(i.secure===!0?"password":"text");return e&&E(i)?"text":t;}function A(i,e){return e===void 0||e<=0?void 0:`${i} / ${e}`;}function X(i){return i.localName==="textarea";}function ae(i){return typeof i=="function"?i():i;}function oe(i,e,t){const n=p(),s=p(),r=p(),l=q(e),u=B(e,l),a=t?.(),f=re(i),{containerProps:h,elementProps:d}=f,k=e.invalid===!0||l!==void 0,S=("value"in e?e.value:e.defaultValue)??"",O=A(S.length,e.maxLength),F=e.disabled===!0,M=e.readOnly===!0,C=e.id??d.id??n,R={...d,"aria-describedby":P(d["aria-describedby"],u===void 0?void 0:s,O===void 0?void 0:r),"aria-invalid":"aria-invalid"in d?d["aria-invalid"]:k?"true":void 0,class:y,disabled:F,id:C,maxLength:e.maxLength,minLength:e.minLength,name:e.name,placeholder:e.placeholder??W,readOnly:M||void 0,required:e.required===!0,spellcheck:e.spellCheck},D=e.multiline===!0,H=J(m);return<div{...h}classList={{...h.classList,[Z(e.variant)]:!0,[z]:F,[$]:k,[U]:e.noAsterisk===!0,[Y]:M,[m]:!0,...(a===void 0?void 0:{[a.className]:!0})}}style={D?{...h.style,[Q]:`${e.rows??1}`}:h.style}>
2
2
  <div class="cw-TextField-control">
3
3
  <span class="cw-TextField-leading">
4
4
  {c(()=>e.leading,()=>e.leadingIcon)}
@@ -34,10 +34,10 @@ import{createMemo as w,createUniqueId as p,mergeProps as I,onCleanup as N,onMoun
34
34
  <span class="cw-TextField-counter"id={r}>{O}</span>
35
35
  </div>
36
36
  {a?.content()}
37
- </div>}class ue extends ne{#d;#x;#a;#o;#u;#p;#n;#c;#i;#e;#s;#r;constructor(e){super(e),this.#d="value"in e,this.#x=p(),this.#a=p(),this.#o=p(),this.#u=w(()=>q(e)),this.#p=w(()=>B(e,this.#u())),this.#n=null,this.#c=null,this.#i=null,this.#e=!1,this.#s=!1,this.#r=()=>{},ee(()=>{const t=this.#t();t!==null&&this.#b(t),N(se(this,m))}),N(()=>this.#r())}#t(){return this.functionElement}#f(e){const t=`attr:${e}`;return t in this.props?[super.readProp(t)[0],!0]:[void 0,!1]}#v(){const[e]=this.#f("id");return this.props.id??e??this.#x}#b(e){this.#r(),this.#r=ie(e,this.#h)}#g(e,t){const{onChange:n,onTextChange:s,onValueChange:r}=this.props;r?.(e,t),s!==r&&s?.(e,t),n!==r&&n!==s&&n?.(e,t)}#l(){const e=this.#t();if(!(e===null||this.#s)){if(this.#d){const t=o(()=>this.props.value)??"";e.defaultValue!==t&&(e.defaultValue=t),e.value!==t&&(e.value=t)}this.#h()}}#h=()=>{const e=this.#t(),t=this.#c;if(e!==null){if(t!==null){const n=o(()=>this.props.maxLength);t.textContent=A(e.value.length,n)??""}X(e)&&!le()&&(e.style.blockSize="auto",e.style.blockSize=`${e.scrollHeight}px`)}};commitValue(e,t){const n=this.#t();n!==null&&(this.#d||(n.value=e),this.#g(e,t),this.#l())}#T=e=>{const t=e.currentTarget;this.#g(t.value,e),e.isComposing?this.#h():this.#l()};#E=()=>{this.#s=!0};#S=()=>{this.#s=!1,setTimeout(()=>this.#l(),0)};#F=e=>{const t=this.#t();t===null||e.button!==0||e.target.closest(de)!==null||(e.preventDefault(),t.focus())};#C=e=>{e.preventDefault()};#w=()=>{this.#e=!this.#e,this.#y(),this.#m()};#y(){const e=this.#t();if(e===null||X(e))return;const t=L(o(()=>this.props),this.#e),n=e.getRootNode().activeElement===e,{selectionDirection:s,selectionEnd:r,selectionStart:l}=e;e.type!==t&&(super.setAttribute("type",t),n&&l!==null&&r!==null&&(e.offsetWidth,e.setSelectionRange(l,r,s??void 0)))}#m(){const e=this.#i;e!==null&&(o(()=>{e.disabled=this.props.disabled===!0,e.setAttribute("aria-controls",this.#v()),e.setAttribute("aria-label",this.props.revealPasswordLabel??j)}),e.setAttribute("aria-pressed",this.#e?"true":"false"))}applyComponentProps(){const e=super.readProps(["autocomplete","cols","disabled","id","inputMode","invalid","max","maxLength","min","minLength","multiline","name","noAsterisk","pattern","placeholder","readOnly","required","revealPassword","revealPasswordLabel","rows","secure","spellCheck","step","type","value","variant"]),t=e.multiline===!0,n=e.multilineChanged||void 0,[s]=this.#f("aria-describedby"),[,r]=this.#f("aria-invalid"),l=e.invalid===!0||this.#u()!==void 0,u=A(0,e.maxLength)!==void 0,a=this.#v();e.variantChanged&&super.setClass("variant",Z(e.variant)),e.disabledChanged&&(super.setClass(z,e.disabled===!0),super.setAttribute("disabled",e.disabled===!0)),e.readOnlyChanged&&(super.setClass(Y,e.readOnly===!0),super.setAttribute("readonly",e.readOnly===!0)),super.setClass($,l),r||super.setAttribute("aria-invalid",l?"true":void 0),super.setAttribute("aria-describedby",P(s,this.#p()===void 0?void 0:this.#a,u?this.#o:void 0)),super.setAttribute("id",a),this.#n!==null&&(this.#n.htmlFor=a),e.requiredChanged&&super.setAttribute("required",e.required===!0),e.noAsteriskChanged&&super.setClass(U,e.noAsterisk===!0),e.nameChanged&&super.setAttribute("name",e.name),e.placeholderChanged&&super.setAttribute("placeholder",e.placeholder??W),e.maxLengthChanged&&super.setAttribute("maxlength",e.maxLength),e.minLengthChanged&&super.setAttribute("minlength",e.minLength),e.spellCheckChanged&&super.setAttribute("spellcheck",e.spellCheck),(e.autocompleteChanged||n)&&super.setAttribute("autocomplete",t?void 0:e.autocomplete),(e.inputModeChanged||n)&&super.setAttribute("inputmode",t?void 0:e.inputMode),(e.patternChanged||n)&&super.setAttribute("pattern",t?void 0:e.pattern),(e.minChanged||n)&&super.setAttribute("min",t?void 0:e.min),(e.maxChanged||n)&&super.setAttribute("max",t?void 0:e.max),(e.stepChanged||n)&&super.setAttribute("step",t?void 0:e.step),(e.colsChanged||n)&&super.setAttribute("cols",t?e.cols:void 0),(e.rowsChanged||n)&&(super.setAttribute("rows",t?e.rows??1:void 0),super.setStyle(Q,t?e.rows??1:void 0)),(e.typeChanged||e.secureChanged||e.revealPasswordChanged||n)&&(E(e)||(this.#e=!1),super.setAttribute("type",t?void 0:L(e,this.#e))),(e.valueChanged||e.maxLengthChanged||n)&&this.#l(),this.#m()}onFunctionElementChanged(e){const t=e,n=this.#t();super.onFunctionElementChanged(e),this.#r(),n?.removeEventListener("input",this.#T),n?.removeEventListener("compositionstart",this.#E),n?.removeEventListener("compositionend",this.#S),this.#s=!1,t!==null&&(t.addEventListener("input",this.#T),t.addEventListener("compositionstart",this.#E),t.addEventListener("compositionend",this.#S),o(()=>{n!==null?(t.defaultValue=n.defaultValue,t.value=n.value):this.#d?(t.defaultValue=this.props.value??"",t.value=this.props.value??""):this.props.defaultValue!==void 0&&(t.defaultValue=this.props.defaultValue)}),this.#b(t))}render(e,t){const n=t,s=w(()=>E(this.props)),r=()=>{const d=this.props.multiline===!0;return o(()=>d?<textarea class={y}ref={n}/>:<input class={y}ref={n}/>)},l=()=>{if(!s()){this.#i=null;return}return this.#i=<button aria-pressed="false"class="cw-TextField-reveal"on:click={this.#w}on:mousedown={this.#C}type="button">
37
+ </div>;}class ue extends ne{#d;#x;#a;#o;#u;#p;#n;#c;#i;#e;#s;#r;constructor(e){super(e),this.#d="value"in e,this.#x=p(),this.#a=p(),this.#o=p(),this.#u=w(()=>q(e)),this.#p=w(()=>B(e,this.#u())),this.#n=null,this.#c=null,this.#i=null,this.#e=!1,this.#s=!1,this.#r=()=>{},ee(()=>{const t=this.#t();t!==null&&this.#b(t),N(se(this,m));}),N(()=>this.#r());}#t(){return this.functionElement;}#f(e){const t=`attr:${e}`;return t in this.props?[super.readProp(t)[0],!0]:[void 0,!1];}#v(){const[e]=this.#f("id");return this.props.id??e??this.#x;}#b(e){this.#r(),this.#r=ie(e,this.#h);}#g(e,t){const{onChange:n,onTextChange:s,onValueChange:r}=this.props;r?.(e,t),s!==r&&s?.(e,t),n!==r&&n!==s&&n?.(e,t);}#l(){const e=this.#t();if(!(e===null||this.#s)){if(this.#d){const t=o(()=>this.props.value)??"";e.defaultValue!==t&&(e.defaultValue=t),e.value!==t&&(e.value=t);}this.#h();}}#h=()=>{const e=this.#t(),t=this.#c;if(e!==null){if(t!==null){const n=o(()=>this.props.maxLength);t.textContent=A(e.value.length,n)??"";}X(e)&&!le()&&(e.style.blockSize="auto",e.style.blockSize=`${e.scrollHeight}px`);}};commitValue(e,t){const n=this.#t();n!==null&&(this.#d||(n.value=e),this.#g(e,t),this.#l());}#T=e=>{const t=e.currentTarget;this.#g(t.value,e),e.isComposing?this.#h():this.#l();};#E=()=>{this.#s=!0;};#S=()=>{this.#s=!1,setTimeout(()=>this.#l(),0);};#F=e=>{const t=this.#t();t===null||e.button!==0||e.target.closest(de)!==null||(e.preventDefault(),t.focus());};#C=e=>{e.preventDefault();};#w=()=>{this.#e=!this.#e,this.#y(),this.#m();};#y(){const e=this.#t();if(e===null||X(e))return;const t=L(o(()=>this.props),this.#e),n=e.getRootNode().activeElement===e,{selectionDirection:s,selectionEnd:r,selectionStart:l}=e;e.type!==t&&(super.setAttribute("type",t),n&&l!==null&&r!==null&&(e.offsetWidth,e.setSelectionRange(l,r,s??void 0)));}#m(){const e=this.#i;e!==null&&(o(()=>{e.disabled=this.props.disabled===!0,e.setAttribute("aria-controls",this.#v()),e.setAttribute("aria-label",this.props.revealPasswordLabel??j);}),e.setAttribute("aria-pressed",this.#e?"true":"false"));}applyComponentProps(){const e=super.readProps(["autocomplete","cols","disabled","id","inputMode","invalid","max","maxLength","min","minLength","multiline","name","noAsterisk","pattern","placeholder","readOnly","required","revealPassword","revealPasswordLabel","rows","secure","spellCheck","step","type","value","variant"]),t=e.multiline===!0,n=e.multilineChanged||void 0,[s]=this.#f("aria-describedby"),[,r]=this.#f("aria-invalid"),l=e.invalid===!0||this.#u()!==void 0,u=A(0,e.maxLength)!==void 0,a=this.#v();e.variantChanged&&super.setClass("variant",Z(e.variant)),e.disabledChanged&&(super.setClass(z,e.disabled===!0),super.setAttribute("disabled",e.disabled===!0)),e.readOnlyChanged&&(super.setClass(Y,e.readOnly===!0),super.setAttribute("readonly",e.readOnly===!0)),super.setClass($,l),r||super.setAttribute("aria-invalid",l?"true":void 0),super.setAttribute("aria-describedby",P(s,this.#p()===void 0?void 0:this.#a,u?this.#o:void 0)),super.setAttribute("id",a),this.#n!==null&&(this.#n.htmlFor=a),e.requiredChanged&&super.setAttribute("required",e.required===!0),e.noAsteriskChanged&&super.setClass(U,e.noAsterisk===!0),e.nameChanged&&super.setAttribute("name",e.name),e.placeholderChanged&&super.setAttribute("placeholder",e.placeholder??W),e.maxLengthChanged&&super.setAttribute("maxlength",e.maxLength),e.minLengthChanged&&super.setAttribute("minlength",e.minLength),e.spellCheckChanged&&super.setAttribute("spellcheck",e.spellCheck),(e.autocompleteChanged||n)&&super.setAttribute("autocomplete",t?void 0:e.autocomplete),(e.inputModeChanged||n)&&super.setAttribute("inputmode",t?void 0:e.inputMode),(e.patternChanged||n)&&super.setAttribute("pattern",t?void 0:e.pattern),(e.minChanged||n)&&super.setAttribute("min",t?void 0:e.min),(e.maxChanged||n)&&super.setAttribute("max",t?void 0:e.max),(e.stepChanged||n)&&super.setAttribute("step",t?void 0:e.step),(e.colsChanged||n)&&super.setAttribute("cols",t?e.cols:void 0),(e.rowsChanged||n)&&(super.setAttribute("rows",t?e.rows??1:void 0),super.setStyle(Q,t?e.rows??1:void 0)),(e.typeChanged||e.secureChanged||e.revealPasswordChanged||n)&&(E(e)||(this.#e=!1),super.setAttribute("type",t?void 0:L(e,this.#e))),(e.valueChanged||e.maxLengthChanged||n)&&this.#l(),this.#m();}onFunctionElementChanged(e){const t=e,n=this.#t();super.onFunctionElementChanged(e),this.#r(),n?.removeEventListener("input",this.#T),n?.removeEventListener("compositionstart",this.#E),n?.removeEventListener("compositionend",this.#S),this.#s=!1,t!==null&&(t.addEventListener("input",this.#T),t.addEventListener("compositionstart",this.#E),t.addEventListener("compositionend",this.#S),o(()=>{n!==null?(t.defaultValue=n.defaultValue,t.value=n.value):this.#d?(t.defaultValue=this.props.value??"",t.value=this.props.value??""):this.props.defaultValue!==void 0&&(t.defaultValue=this.props.defaultValue);}),this.#b(t));}render(e,t){const n=t,s=w(()=>E(this.props)),r=()=>{const d=this.props.multiline===!0;return o(()=>d?<textarea class={y}ref={n}/>:<input class={y}ref={n}/>);},l=()=>{if(!s()){this.#i=null;return;}return this.#i=<button aria-pressed="false"class="cw-TextField-reveal"on:click={this.#w}on:mousedown={this.#C}type="button">
38
38
  <T class="_cw-TextField-revealEye"name={K}/>
39
39
  <T class="_cw-TextField-revealSlash"name={G}/>
40
- </button>,o(()=>this.#m()),this.#i},u=this.#o,a=this.#a,f=J(m);return<div class={m}>
40
+ </button>,o(()=>this.#m()),this.#i;},u=this.#o,a=this.#a,f=J(m);return<div class={m}>
41
41
  <div class="cw-TextField-control"on:mousedown={this.#F}>
42
42
  <span class="cw-TextField-leading">
43
43
  {c(()=>this.props.leading,()=>this.props.leadingIcon)}
@@ -70,4 +70,4 @@ import{createMemo as w,createUniqueId as p,mergeProps as I,onCleanup as N,onMoun
70
70
  <span class="cw-TextField-counter"id={u}ref={d=>this.#c=d}/>
71
71
  </div>
72
72
  {this.renderExtension()}
73
- </div>}get labelElement(){return this.#n}renderExtension(){}}const _=te(()=>oe,()=>ue);function be(i){return _(I({variant:"outlined"},i))}function ge(i){return _(I({variant:"filled"},i))}function pe(i){return _(I({secure:!0,type:"password"},i))}const Te=pe;export{ge as FilledTextField,be as OutlinedTextField,pe as PasswordField,Te as SecureField,_ as TextField,ue as TextFieldController,oe as renderTextField};
73
+ </div>;}get labelElement(){return this.#n;}renderExtension(){}}const _=/* @__PURE__ */te(()=>oe,()=>ue);function be(i){return _(I({variant:"outlined"},i));}function ge(i){return _(I({variant:"filled"},i));}function pe(i){return _(I({secure:!0,type:"password"},i));}const Te=pe;export{ge as FilledTextField,be as OutlinedTextField,pe as PasswordField,Te as SecureField,_ as TextField,ue as TextFieldController,oe as renderTextField};
@@ -1,4 +1,4 @@
1
- import{createUniqueId as S,onCleanup as Ve,onMount as Je,untrack as Ge}from"solid-js";import{insert as be}from"solid-js/web";import{defineDomComponent as ze}from"..";import{DomController as qe}from"../dom/client";import{Icon as K}from"../icon";import{applySpringMotion as je}from"../motion";import{FocusState as We,HoverState as Qe,PressState as Ze,defineInteractableComponent as et}from"../state";import{setAttribute as m}from"../util";import{observeFormReset as tt}from"./base";import"./time-picker.css";const Te="cw-TimePicker",ge="cw-TimePicker-landscape",Pe="cw-TimePicker-inputMode",ye="cw-TimePicker-disabled",Ee="cw-TimePicker-readOnly",ve="_cw-TimePicker-h23",Me="_cw-TimePicker-inner",k="_cw-TimePicker-option",Se=`cw-TimePicker-selector ${k}`,ke=`cw-TimePicker-number ${k}`,we=`cw-TimePicker-mode ${k}`,le=We|Qe|Ze,it={selectTime:"Select time",hour:"Hour",minute:"Minute",am:"AM",pm:"PM",selectPeriod:"Select AM or PM",hourError:"Hour must be 1\u201312",hour24Error:"Hour must be 0\u201323",minuteError:"Minute must be 0\u201359",switchToInput:"Switch to time input",switchToClock:"Switch to clock"},v=[0,1],W=["hour","minute"],nt="en-US",rt=/^(?:[01]\d|2[0-3]):[0-5]\d$/u,Fe=10,o=60,L=24,d=12,q=L*o,T=5,$=o/T,y=360,se=y/d,Ce=y/o,st=74/256,ot=8,at=100,Le=2,ue="data-cw-initial-focus",U="--cw-time-picker-angle",lt="--cw-time-picker-option-angle",ut={role:"spatial",speed:"default",unit:"deg"},Q=new Set(["ArrowDown","ArrowRight"]),Z=new Set(["ArrowLeft","ArrowUp"]);function ee(r){return r===void 0||!rt.test(r)?0:Number(r.slice(0,2))*o+Number(r.slice(3))}function te(r){const e=`${Math.floor(r/o)}`,t=`${r%o}`;return`${e.padStart(2,"0")}:${t.padStart(2,"0")}`}function g(r,e){return r?.[e]??it[e]}function ie(r,e){const t=r??nt,i=new Intl.NumberFormat(t,{useGrouping:!1}),n=e??new Intl.DateTimeFormat(t,{hour:"numeric"}).resolvedOptions().hourCycle,s=new Map;for(let a=0;a<Fe;a++)s.set(`${a}`,a),s.set(i.format(a),a);return{h23:n==="h23"||n==="h24",numeral:i,twoDigits:new Intl.NumberFormat(t,{minimumIntegerDigits:2,useGrouping:!1}),digits:s}}function de(r,e){let t;for(const i of r)t=(t??0)*Fe+(e.digits.get(i)??Number.NaN);return t}function X(r,e,t){const i=Math.floor(t/o);return e===1?t%o:r.h23?i:i%d===0?d:i%d}function ce(r,e,t){return e===1?t<o:r.h23?t<L:t>=1&&t<=d}function me(r,e,t,i){const n=Math.floor(i/o),s=n-n%d;return e===1?n*o+t:(r.h23?t:s+t%d)*o+i%o}function dt(r,e){return e===1?"minuteError":r.h23?"hour24Error":"hourError"}function ne(r,e,t){return r.h23||t<d?e:e+d}function C(r,e){return r.h23?e:e%d}function re(r){return Math.round(r/T)%$}function Ie(r,e){return r.h23?e===0?r.twoDigits.format(e):r.numeral.format(e):r.numeral.format(e===0?d:e)}function De(r,e){return r.twoDigits.format(e*T)}function He(r){return{[lt]:`${r%d*se}deg`}}function Oe(r,e){return r===0?Math.floor(e/o)%d*se:e%o*Ce}function oe(r){return(r%y+y)%y}function he(r,e){const t=oe(e-r);return t>=y/2?t-y:t}function fe(r,e){return oe(Math.atan2(r,-e)*y/(2*Math.PI))}function _e(r,e,t){return r.h23&&e===0&&t>=d*o}function ct(r,e,t,i){const n=Math.floor(t/o),s=t%o,a=e===1?$:r.h23?L:d,c=i==="Home"?0:i==="End"?a-1:e===1&&Q.has(i)?Math.floor(s/T)+1:e===1&&Z.has(i)?Math.ceil(s/T)-1:Q.has(i)?C(r,n)+1:Z.has(i)?C(r,n)-1:void 0;if(c===void 0)return;const l=(c+a)%a;return e===1?n*o+l*T:ne(r,l,n)*o+s}function pe(r){return(Q.has(r.key)||Z.has(r.key))&&!r.altKey&&!r.ctrlKey&&!r.metaKey}function M(r,e){r.textContent!==e&&(r.textContent=e)}function j(r){return r.map(e=>e.button)}const P=et(()=>(r,e)=><button{...r}disabled={e.disabled===!0}type="button"/>,r=>class extends r{constructor(e){super(e,{baseInteractionCssClassName:k,enabledInteractionStates:le,styleElementIsFunction:!0})}applyComponentProps(){const e=super.readProps(["disabled"]);e.disabledChanged&&(super.setAttribute("disabled",e.disabled===!0),super.setEnabledInteractionStates(e.disabled===!0?0:le))}render(e){const t=<button type="button"/>;return be(t,e),t}});function mt(r,e){const t=S(),i=[S(),S()],n=ie(e.locale,e.hourCycle),s=ee("value"in e?e.value:e.defaultValue),a=Math.floor(s/o),c=a>=d,l=e.disabled===!0,b=e.readOnly===!0,E=e.defaultDisplayMode==="input",p=f=>g(e.labels,f),I=f=>{const h=p(W[f]),B=n.twoDigits.format(X(n,f,s)),G=<P attr:aria-checked={f===0}attr:aria-label={h}attr:data-cw-initial-focus={f===0&&!E}attr:role="radio"attr:tabindex={f===0?0:-1}class={Se}disabled={l}>{B}</P>,z=<input aria-label={h}autocomplete="off"class="cw-TimePicker-input"data-cw-initial-focus={f===0&&E?"":void 0}disabled={l}inputmode="numeric"maxLength={Le}readOnly={b}type="text"value={B}/>,Ye=<span aria-live="polite"class="cw-TimePicker-supporting"id={i[f]}>{h}</span>;return<div class="cw-TimePicker-field">{G}{z}{Ye}</div>},D=(f,h)=><P attr:aria-checked={f}attr:role="radio"attr:tabindex={f?0:-1}class={k}disabled={l}>{h}</P>,H=(f,h,B,G,z)=><P attr:aria-checked={G}attr:aria-label={`${B} ${h}`}attr:role="radio"attr:tabindex={z?0:-1}class={ke}disabled={l}style={He(f)}>
1
+ import{createUniqueId as S,onCleanup as Ve,onMount as Je,untrack as Ge}from"solid-js";import{insert as be}from"solid-js/web";import{defineDomComponent as ze}from"..";import{DomController as qe}from"../dom/client";import{Icon as K}from"../icon";import{applySpringMotion as je}from"../motion";import{FocusState as We,HoverState as Qe,PressState as Ze,defineInteractableComponent as et}from"../state";import{setAttribute as m}from"../util";import{observeFormReset as tt}from"./base";import"./time-picker.css";const Te="cw-TimePicker",ge="cw-TimePicker-landscape",Pe="cw-TimePicker-inputMode",ye="cw-TimePicker-disabled",Ee="cw-TimePicker-readOnly",ve="_cw-TimePicker-h23",Me="_cw-TimePicker-inner",k="_cw-TimePicker-option",Se=`cw-TimePicker-selector ${k}`,ke=`cw-TimePicker-number ${k}`,we=`cw-TimePicker-mode ${k}`,le=We|Qe|Ze,it={selectTime:"Select time",hour:"Hour",minute:"Minute",am:"AM",pm:"PM",selectPeriod:"Select AM or PM",hourError:"Hour must be 1\u201312",hour24Error:"Hour must be 0\u201323",minuteError:"Minute must be 0\u201359",switchToInput:"Switch to time input",switchToClock:"Switch to clock"},v=[0,1],W=["hour","minute"],nt="en-US",rt=/^(?:[01]\d|2[0-3]):[0-5]\d$/u,Fe=10,o=60,L=24,d=12,q=L*o,T=5,$=o/T,y=360,se=y/d,Ce=y/o,st=74/256,ot=8,at=100,Le=2,ue="data-cw-initial-focus",U="--cw-time-picker-angle",lt="--cw-time-picker-option-angle",ut={role:"spatial",speed:"default",unit:"deg"},Q=/* @__PURE__ */new Set(["ArrowDown","ArrowRight"]),Z=/* @__PURE__ */new Set(["ArrowLeft","ArrowUp"]);function ee(r){return r===void 0||!rt.test(r)?0:Number(r.slice(0,2))*o+Number(r.slice(3));}function te(r){const e=`${Math.floor(r/o)}`,t=`${r%o}`;return`${e.padStart(2,"0")}:${t.padStart(2,"0")}`;}function g(r,e){return r?.[e]??it[e];}function ie(r,e){const t=r??nt,i=new Intl.NumberFormat(t,{useGrouping:!1}),n=e??new Intl.DateTimeFormat(t,{hour:"numeric"}).resolvedOptions().hourCycle,s=/* @__PURE__ */new Map();for(let a=0;a<Fe;a++)s.set(`${a}`,a),s.set(i.format(a),a);return{h23:n==="h23"||n==="h24",numeral:i,twoDigits:new Intl.NumberFormat(t,{minimumIntegerDigits:2,useGrouping:!1}),digits:s};}function de(r,e){let t;for(const i of r)t=(t??0)*Fe+(e.digits.get(i)??Number.NaN);return t;}function X(r,e,t){const i=Math.floor(t/o);return e===1?t%o:r.h23?i:i%d===0?d:i%d;}function ce(r,e,t){return e===1?t<o:r.h23?t<L:t>=1&&t<=d;}function me(r,e,t,i){const n=Math.floor(i/o),s=n-n%d;return e===1?n*o+t:(r.h23?t:s+t%d)*o+i%o;}function dt(r,e){return e===1?"minuteError":r.h23?"hour24Error":"hourError";}function ne(r,e,t){return r.h23||t<d?e:e+d;}function C(r,e){return r.h23?e:e%d;}function re(r){return Math.round(r/T)%$;}function Ie(r,e){return r.h23?e===0?r.twoDigits.format(e):r.numeral.format(e):r.numeral.format(e===0?d:e);}function De(r,e){return r.twoDigits.format(e*T);}function He(r){return{[lt]:`${r%d*se}deg`};}function Oe(r,e){return r===0?Math.floor(e/o)%d*se:e%o*Ce;}function oe(r){return(r%y+y)%y;}function he(r,e){const t=oe(e-r);return t>=y/2?t-y:t;}function fe(r,e){return oe(Math.atan2(r,-e)*y/(2*Math.PI));}function _e(r,e,t){return r.h23&&e===0&&t>=d*o;}function ct(r,e,t,i){const n=Math.floor(t/o),s=t%o,a=e===1?$:r.h23?L:d,c=i==="Home"?0:i==="End"?a-1:e===1&&Q.has(i)?Math.floor(s/T)+1:e===1&&Z.has(i)?Math.ceil(s/T)-1:Q.has(i)?C(r,n)+1:Z.has(i)?C(r,n)-1:void 0;if(c===void 0)return;const l=(c+a)%a;return e===1?n*o+l*T:ne(r,l,n)*o+s;}function pe(r){return(Q.has(r.key)||Z.has(r.key))&&!r.altKey&&!r.ctrlKey&&!r.metaKey;}function M(r,e){r.textContent!==e&&(r.textContent=e);}function j(r){return r.map(e=>e.button);}const P=/* @__PURE__ */et(()=>(r,e)=><button{...r}disabled={e.disabled===!0}type="button"/>,r=>class extends r{constructor(e){super(e,{baseInteractionCssClassName:k,enabledInteractionStates:le,styleElementIsFunction:!0});}applyComponentProps(){const e=super.readProps(["disabled"]);e.disabledChanged&&(super.setAttribute("disabled",e.disabled===!0),super.setEnabledInteractionStates(e.disabled===!0?0:le));}render(e){const t=<button type="button"/>;return be(t,e),t;}});function mt(r,e){const t=S(),i=[S(),S()],n=ie(e.locale,e.hourCycle),s=ee("value"in e?e.value:e.defaultValue),a=Math.floor(s/o),c=a>=d,l=e.disabled===!0,b=e.readOnly===!0,E=e.defaultDisplayMode==="input",p=f=>g(e.labels,f),I=f=>{const h=p(W[f]),B=n.twoDigits.format(X(n,f,s)),G=<P attr:aria-checked={f===0}attr:aria-label={h}attr:data-cw-initial-focus={f===0&&!E}attr:role="radio"attr:tabindex={f===0?0:-1}class={Se}disabled={l}>{B}</P>,z=<input aria-label={h}autocomplete="off"class="cw-TimePicker-input"data-cw-initial-focus={f===0&&E?"":void 0}disabled={l}inputmode="numeric"maxLength={Le}readOnly={b}type="text"value={B}/>,Ye=<span aria-live="polite"class="cw-TimePicker-supporting"id={i[f]}>{h}</span>;return<div class="cw-TimePicker-field">{G}{z}{Ye}</div>;},D=(f,h)=><P attr:aria-checked={f}attr:role="radio"attr:tabindex={f?0:-1}class={k}disabled={l}>{h}</P>,H=(f,h,B,G,z)=><P attr:aria-checked={G}attr:aria-label={`${B} ${h}`}attr:role="radio"attr:tabindex={z?0:-1}class={ke}disabled={l}style={He(f)}>
2
2
  <span class="cw-TimePicker-label">{h}</span>
3
3
  </P>,Y=<div class="cw-TimePicker-title"id={t}>{p("selectTime")}</div>,O=I(0),_=I(1),V=<div aria-labelledby={t}class="cw-TimePicker-time"role={E?"group":"radiogroup"}>
4
4
  {O}
@@ -11,11 +11,11 @@ import{createUniqueId as S,onCleanup as Ve,onMount as Je,untrack as Ge}from"soli
11
11
  <K class="_cw-TimePicker-inputIcon"name="keyboard"/>
12
12
  </P>,$e=<input disabled={l||(e.name??"")===""}form={e.form}name={e.name}type="hidden"value={te(s)}/>;return<div{...r}classList={{...r.classList,[Te]:!0,[ye]:l,[ve]:n.h23,[Me]:_e(n,0,s),[Pe]:E,[ge]:e.orientation==="landscape",[Ee]:b}}>
13
13
  {Y}{R}{Xe}{Ke}{$e}{r.children}
14
- </div>}class ht extends qe{#c;#E;#v;#m;#M;#e;#i;#h;#b;#t;#n;#r;#s;#l;#o;#a;#d;#S;constructor(e){super(e,{styleElementIsFunction:!0}),this.#c="value"in e,this.#E=S(),this.#v=[S(),S()],this.#m=[!1,!1],this.#M=[Number.NaN,Number.NaN],this.#e=null,this.#i=Ge(()=>ie(e.locale,e.hourCycle)),this.#h=!1,this.#b=0,this.#t=0,this.#n=0,this.#r=e.defaultDisplayMode==="input",this.#s=Number.NaN,this.#l=void 0,this.#o=!1,this.#a=void 0,this.#d=void 0,this.#S=()=>{},Je(()=>{const t=this.#e?.value;t!==void 0&&(this.#S=tt(t,()=>this.#$()))}),Ve(()=>{this.#S(),this.#T(),this.#l?.cancel()})}#f(){const e=this.#e?.fields[0].input;return this.props.readOnly!==!0&&e?.matches(":disabled")===!1}#u(e,t,i){const n=(e%q+q)%q;if(!(!this.#f()||n===this.#t)){this.#o=i;try{this.#c||(this.#t=n,this.#w()),this.props.onChange?.(te(n),t)}finally{this.#o=!1}}}#C(e,t){const i=Math.floor(this.#t/o)%d+(e?d:0);this.#u(i*o+this.#t%o,t,!1)}#p(e,t){const i=this.#e;if(i===null||e===this.#n)return;const n=i.faces[this.#n].contains(i.dial.ownerDocument.activeElement);this.#T(),this.#n=e,this.#o=t,this.#O(),this.#o=!1,n&&this.#I(e).focus()}#L(){const e=this.#e?.dial.ownerDocument.defaultView;this.#T(),e!=null&&(this.#d=e.setTimeout(()=>{this.#d=void 0,this.#p(1,!0)},at))}#T(){this.#d!==void 0&&(this.#e?.dial.ownerDocument.defaultView?.clearTimeout(this.#d),this.#d=void 0)}#K(){this.#r=!this.#r,this.#_(),this.#F()}#$(){this.#c||(this.#t=this.#b),this.#w(),this.#F()}#I(e){const t=this.#e,i=Math.floor(this.#t/o);return e===0?t.hours[C(this.#i,i)].button:t.minutes[re(this.#t%o)].button}#Y(e){const t=Math.floor(this.#t/o);return this.#n===1?t*o+e*T:ne(this.#i,e,t)*o+this.#t%o}#D(e,t,i){const n=Math.floor(this.#t/o),s=i?T:1,a=Math.round(e/se)%d,c=this.#i.h23&&t<st;return this.#n===1?n*o+Math.round(e/Ce/s)*s%o:ne(this.#i,c?a+d:a,n)*o+this.#t%o}#V(e){const t=this.#l,i=t?.playState==="running"?t.value:this.#s;t?.cancel(),this.#l=void 0,this.#s=i+he(i,e),this.#e.dial.style.setProperty(U,`${this.#s}deg`)}#H(e){if(e&&this.#n===0){this.#p(1,!0);return}this.#o=!0,this.#k(),this.#o=!1}#k(){const e=this.#e.dial,t=Oe(this.#n,this.#t),i=this.#l,n=i?.playState==="running"?i.value:this.#s,s=n+he(n,t),a=_e(this.#i,this.#n,this.#t);if(super.setClass(Me,a),!(this.#a?.dragging===!0||oe(this.#s)===t)){if(this.#o&&Number.isFinite(n)){i?.playState==="running"?i.retarget(s):this.#l=je(e,U,n,s,ut),this.#s=s;return}i?.cancel(),this.#l=void 0,this.#s=t,e.style.setProperty(U,`${t}deg`)}}#w(){const e=this.#e,t=this.#i,i=Math.floor(this.#t/o),n=this.#t%o,s=C(t,i),a=re(n);for(const c of v){const l=X(t,c,this.#t);M(e.fields[c].selector,t.twoDigits.format(l)),this.#P(c,!1)}for(const[c,l]of e.periods.entries()){const b=i>=d==(c===1);m(l,"aria-checked",b),m(l,"tabindex",b?0:-1)}for(const[c,l]of e.hours.entries())m(l.button,"aria-checked",c===s),m(l.button,"tabindex",c===s?0:-1);for(const[c,l]of e.minutes.entries())m(l.button,"aria-checked",c*T===n),m(l.button,"tabindex",c===a?0:-1);e.value.value=te(this.#t),this.#k()}#O(){const e=this.#e;for(const t of v){const i=t===this.#n;m(e.fields[t].selector,"aria-checked",i),m(e.fields[t].selector,"tabindex",i?0:-1),m(e.faces[t],"inert",!i)}this.#N(),this.#k()}#_(){super.setClass(Pe,this.#r),m(this.#e.time,"role",this.#r?"group":"radiogroup"),this.#N(),this.#A()}#N(){for(const e of v){const{input:t,selector:i}=this.#e.fields[e],n=e===this.#n;m(i,ue,n&&!this.#r),m(t,ue,n&&this.#r)}}#A(){m(this.#e.mode,"aria-label",g(this.props.labels,this.#r?"switchToClock":"switchToInput"))}#J(){const e=this.#e,t=this.props.labels,i=this.#i;M(e.title,g(t,"selectTime"));for(const n of v){const s=g(t,W[n]),a=n===0?e.hours:e.minutes;m(e.fields[n].selector,"aria-label",s),m(e.fields[n].input,"aria-label",s),m(e.faces[n],"aria-label",s);for(const[c,l]of a.entries()){const b=n===0?Ie(i,c):De(i,c);M(l.label,b),m(l.button,"aria-label",`${s} ${b}`)}this.#R(n)}m(e.period,"aria-label",g(t,"selectPeriod")),M(e.periods[0],g(t,"am")),M(e.periods[1],g(t,"pm")),this.#A()}#R(e){const t=this.#m[e]?dt(this.#i,e):W[e];M(this.#e.fields[e].supporting,g(this.props.labels,t))}#g(e,t){const i=this.#e.fields[e].input;this.#m[e]!==t&&(this.#m[e]=t,m(i,"aria-invalid",t||void 0),m(i,"aria-describedby",t?this.#v[e]:void 0),this.#R(e))}#P(e,t){const i=this.#e.fields[e].input,n=X(this.#i,e,this.#t);!t&&n===this.#M[e]||(this.#M[e]=n,!(!t&&!this.#m[e]&&de(i.value,this.#i)===n)&&(i.value=this.#i.twoDigits.format(n),this.#g(e,!1)))}#F(){for(const e of v)this.#P(e,!0)}#x(e){const t=this.#e.fields[e].input,i=this.#i,n=Array.from(t.value).filter(s=>i.digits.has(s)).join("");return n!==t.value&&(t.value=n),de(n,i)}#G(e,t){const i=this.#x(e);if(i===void 0||!ce(this.#i,e,i)){this.#g(e,i!==void 0);return}this.#g(e,!1),this.#u(me(this.#i,e,i,this.#t),t,!1),X(this.#i,e,this.#t)!==i&&this.#P(e,!0)}#z(e,t){const i=this.#x(e);if(i!==void 0&&!ce(this.#i,e,i)){this.#g(e,!0);return}i!==void 0&&this.#u(me(this.#i,e,i,this.#t),t,!1),this.#P(e,!0)}#q(e){const t=this.#e,i=v.find(n=>t.fields[n].selector===e.target);i!==void 0&&this.#p(i,!0)}#j(e){const t=this.#e,i=v.find(s=>t.fields[s].selector===e.target),n=i===0?1:0;i===void 0||e.defaultPrevented||!pe(e)||(e.preventDefault(),this.#p(n,!0),t.fields[n].selector.focus())}#W(e){const t=this.#e.periods.findIndex(i=>i===e.target);t>=0&&!e.defaultPrevented&&this.#C(t===1,e)}#Q(e){const t=this.#e.periods,i=t.findIndex(n=>n===e.target);i<0||e.defaultPrevented||!pe(e)||(e.preventDefault(),this.#C(i===0,e),t[this.#t>=d*o?1:0].focus())}#Z(e){const t=this.#e.dial;if(e.button!==0||!e.isPrimary||e.defaultPrevented||!this.#f())return;const i=t.getBoundingClientRect();this.#a={centerX:i.left+i.width/2,centerY:i.top+i.height/2,dragging:!1,pointerId:e.pointerId,size:i.width,x:e.clientX,y:e.clientY};try{e.target.setPointerCapture(e.pointerId)}catch{}}#ee(e){const t=this.#a;if(t===void 0||e.pointerId!==t.pointerId)return;if(!this.#f()){this.#y(e);return}if(!t.dragging){if(Math.hypot(e.clientX-t.x,e.clientY-t.y)<ot)return;t.dragging=!0,this.#T();try{this.#e.dial.setPointerCapture(e.pointerId)}catch{}}const i=e.clientX-t.centerX,n=e.clientY-t.centerY,s=fe(i,n);this.#V(s),this.#u(this.#D(s,Math.hypot(i,n)/t.size,!1),e,!1)}#te(e){const t=this.#a,i=this.#e.dial;if(t===void 0||e.pointerId!==t.pointerId)return;if(!this.#f()){this.#y(e);return}if(this.#a=void 0,i.hasPointerCapture(e.pointerId)&&i.releasePointerCapture(e.pointerId),t.dragging){this.#H(!0);return}const n=e.clientX-t.centerX,s=e.clientY-t.centerY,a=this.#D(fe(n,s),Math.hypot(n,s)/t.size,!0);this.#u(a,e,!0),this.#n===0&&this.#L()}#y(e){const t=this.#a;t===void 0||e.pointerId!==t.pointerId||(this.#a=void 0,t.dragging&&this.#H(!1))}#ie(e){this.#e.dial.hasPointerCapture(e.pointerId)||this.#y(e)}#ne(e){const t=this.#e,n=(this.#n===0?t.hours:t.minutes).findIndex(s=>s.button===e.target||s.label===e.target);e.detail!==0||n<0||e.defaultPrevented||!this.#f()||(this.#u(this.#Y(n),e,!0),this.#n===0&&this.#L())}#re(e){const t=ct(this.#i,this.#n,this.#t,e.key);t===void 0||e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||(e.preventDefault(),this.#u(t,e,!0),this.#I(this.#n).focus())}applyComponentProps(){const e=super.readProps(["defaultValue","disabled","form","hourCycle","labels","locale","name","orientation","readOnly","value"]),t=this.#e,i=e.disabled===!0,n=e.readOnly===!0,s=e.localeChanged||e.hourCycleChanged;if(t!==null){if(s&&(this.#h&&(this.#i=ie(e.locale,e.hourCycle)),super.setClass(ve,this.#i.h23)),this.#h||(this.#b=ee(e.defaultValue),this.#c||(this.#t=this.#b)),this.#c&&e.valueChanged&&(this.#t=ee(e.value)),e.orientationChanged&&super.setClass(ge,e.orientation==="landscape"),e.disabledChanged){super.setClass(ye,i);for(const{input:a}of t.fields)a.disabled=i}if(e.readOnlyChanged){super.setClass(Ee,n);for(const{input:a}of t.fields)a.readOnly=n;for(const a of[t.period,...t.faces])m(a,"aria-readonly",n||void 0)}(e.nameChanged||e.formChanged||e.disabledChanged)&&(m(t.value,"form",e.form),m(t.value,"name",e.name),t.value.disabled=i||(e.name??"")===""),(e.labelsChanged||s)&&this.#J(),this.#h||(this.#h=!0,this.#_(),this.#O()),(e.valueChanged||s)&&this.#w(),s&&this.#F()}}#B(e){const t=<P attr:role="radio"class={Se}disabled={this.props.disabled===!0}/>,i=<input autocomplete="off"class="cw-TimePicker-input"inputmode="numeric"maxLength={Le}onChange={a=>this.#z(e,a)}onFocus={()=>this.#p(e,!1)}onInput={a=>this.#G(e,a)}type="text"/>,n=<span aria-live="polite"class="cw-TimePicker-supporting"id={this.#v[e]}/>,s=<div class="cw-TimePicker-field">
14
+ </div>;}class ht extends qe{#c;#E;#v;#m;#M;#e;#i;#h;#b;#t;#n;#r;#s;#l;#o;#a;#d;#S;constructor(e){super(e,{styleElementIsFunction:!0}),this.#c="value"in e,this.#E=S(),this.#v=[S(),S()],this.#m=[!1,!1],this.#M=[Number.NaN,Number.NaN],this.#e=null,this.#i=Ge(()=>ie(e.locale,e.hourCycle)),this.#h=!1,this.#b=0,this.#t=0,this.#n=0,this.#r=e.defaultDisplayMode==="input",this.#s=Number.NaN,this.#l=void 0,this.#o=!1,this.#a=void 0,this.#d=void 0,this.#S=()=>{},Je(()=>{const t=this.#e?.value;t!==void 0&&(this.#S=tt(t,()=>this.#$()));}),Ve(()=>{this.#S(),this.#T(),this.#l?.cancel();});}#f(){const e=this.#e?.fields[0].input;return this.props.readOnly!==!0&&e?.matches(":disabled")===!1;}#u(e,t,i){const n=(e%q+q)%q;if(!(!this.#f()||n===this.#t)){this.#o=i;try{this.#c||(this.#t=n,this.#w()),this.props.onChange?.(te(n),t);}finally{this.#o=!1;}}}#C(e,t){const i=Math.floor(this.#t/o)%d+(e?d:0);this.#u(i*o+this.#t%o,t,!1);}#p(e,t){const i=this.#e;if(i===null||e===this.#n)return;const n=i.faces[this.#n].contains(i.dial.ownerDocument.activeElement);this.#T(),this.#n=e,this.#o=t,this.#O(),this.#o=!1,n&&this.#I(e).focus();}#L(){const e=this.#e?.dial.ownerDocument.defaultView;this.#T(),e!=null&&(this.#d=e.setTimeout(()=>{this.#d=void 0,this.#p(1,!0);},at));}#T(){this.#d!==void 0&&(this.#e?.dial.ownerDocument.defaultView?.clearTimeout(this.#d),this.#d=void 0);}#K(){this.#r=!this.#r,this.#_(),this.#F();}#$(){this.#c||(this.#t=this.#b),this.#w(),this.#F();}#I(e){const t=this.#e,i=Math.floor(this.#t/o);return e===0?t.hours[C(this.#i,i)].button:t.minutes[re(this.#t%o)].button;}#Y(e){const t=Math.floor(this.#t/o);return this.#n===1?t*o+e*T:ne(this.#i,e,t)*o+this.#t%o;}#D(e,t,i){const n=Math.floor(this.#t/o),s=i?T:1,a=Math.round(e/se)%d,c=this.#i.h23&&t<st;return this.#n===1?n*o+Math.round(e/Ce/s)*s%o:ne(this.#i,c?a+d:a,n)*o+this.#t%o;}#V(e){const t=this.#l,i=t?.playState==="running"?t.value:this.#s;t?.cancel(),this.#l=void 0,this.#s=i+he(i,e),this.#e.dial.style.setProperty(U,`${this.#s}deg`);}#H(e){if(e&&this.#n===0){this.#p(1,!0);return;}this.#o=!0,this.#k(),this.#o=!1;}#k(){const e=this.#e.dial,t=Oe(this.#n,this.#t),i=this.#l,n=i?.playState==="running"?i.value:this.#s,s=n+he(n,t),a=_e(this.#i,this.#n,this.#t);if(super.setClass(Me,a),!(this.#a?.dragging===!0||oe(this.#s)===t)){if(this.#o&&Number.isFinite(n)){i?.playState==="running"?i.retarget(s):this.#l=je(e,U,n,s,ut),this.#s=s;return;}i?.cancel(),this.#l=void 0,this.#s=t,e.style.setProperty(U,`${t}deg`);}}#w(){const e=this.#e,t=this.#i,i=Math.floor(this.#t/o),n=this.#t%o,s=C(t,i),a=re(n);for(const c of v){const l=X(t,c,this.#t);M(e.fields[c].selector,t.twoDigits.format(l)),this.#P(c,!1);}for(const[c,l]of e.periods.entries()){const b=i>=d==(c===1);m(l,"aria-checked",b),m(l,"tabindex",b?0:-1);}for(const[c,l]of e.hours.entries())m(l.button,"aria-checked",c===s),m(l.button,"tabindex",c===s?0:-1);for(const[c,l]of e.minutes.entries())m(l.button,"aria-checked",c*T===n),m(l.button,"tabindex",c===a?0:-1);e.value.value=te(this.#t),this.#k();}#O(){const e=this.#e;for(const t of v){const i=t===this.#n;m(e.fields[t].selector,"aria-checked",i),m(e.fields[t].selector,"tabindex",i?0:-1),m(e.faces[t],"inert",!i);}this.#N(),this.#k();}#_(){super.setClass(Pe,this.#r),m(this.#e.time,"role",this.#r?"group":"radiogroup"),this.#N(),this.#A();}#N(){for(const e of v){const{input:t,selector:i}=this.#e.fields[e],n=e===this.#n;m(i,ue,n&&!this.#r),m(t,ue,n&&this.#r);}}#A(){m(this.#e.mode,"aria-label",g(this.props.labels,this.#r?"switchToClock":"switchToInput"));}#J(){const e=this.#e,t=this.props.labels,i=this.#i;M(e.title,g(t,"selectTime"));for(const n of v){const s=g(t,W[n]),a=n===0?e.hours:e.minutes;m(e.fields[n].selector,"aria-label",s),m(e.fields[n].input,"aria-label",s),m(e.faces[n],"aria-label",s);for(const[c,l]of a.entries()){const b=n===0?Ie(i,c):De(i,c);M(l.label,b),m(l.button,"aria-label",`${s} ${b}`);}this.#R(n);}m(e.period,"aria-label",g(t,"selectPeriod")),M(e.periods[0],g(t,"am")),M(e.periods[1],g(t,"pm")),this.#A();}#R(e){const t=this.#m[e]?dt(this.#i,e):W[e];M(this.#e.fields[e].supporting,g(this.props.labels,t));}#g(e,t){const i=this.#e.fields[e].input;this.#m[e]!==t&&(this.#m[e]=t,m(i,"aria-invalid",t||void 0),m(i,"aria-describedby",t?this.#v[e]:void 0),this.#R(e));}#P(e,t){const i=this.#e.fields[e].input,n=X(this.#i,e,this.#t);!t&&n===this.#M[e]||(this.#M[e]=n,!(!t&&!this.#m[e]&&de(i.value,this.#i)===n)&&(i.value=this.#i.twoDigits.format(n),this.#g(e,!1)));}#F(){for(const e of v)this.#P(e,!0);}#x(e){const t=this.#e.fields[e].input,i=this.#i,n=Array.from(t.value).filter(s=>i.digits.has(s)).join("");return n!==t.value&&(t.value=n),de(n,i);}#G(e,t){const i=this.#x(e);if(i===void 0||!ce(this.#i,e,i)){this.#g(e,i!==void 0);return;}this.#g(e,!1),this.#u(me(this.#i,e,i,this.#t),t,!1),X(this.#i,e,this.#t)!==i&&this.#P(e,!0);}#z(e,t){const i=this.#x(e);if(i!==void 0&&!ce(this.#i,e,i)){this.#g(e,!0);return;}i!==void 0&&this.#u(me(this.#i,e,i,this.#t),t,!1),this.#P(e,!0);}#q(e){const t=this.#e,i=v.find(n=>t.fields[n].selector===e.target);i!==void 0&&this.#p(i,!0);}#j(e){const t=this.#e,i=v.find(s=>t.fields[s].selector===e.target),n=i===0?1:0;i===void 0||e.defaultPrevented||!pe(e)||(e.preventDefault(),this.#p(n,!0),t.fields[n].selector.focus());}#W(e){const t=this.#e.periods.findIndex(i=>i===e.target);t>=0&&!e.defaultPrevented&&this.#C(t===1,e);}#Q(e){const t=this.#e.periods,i=t.findIndex(n=>n===e.target);i<0||e.defaultPrevented||!pe(e)||(e.preventDefault(),this.#C(i===0,e),t[this.#t>=d*o?1:0].focus());}#Z(e){const t=this.#e.dial;if(e.button!==0||!e.isPrimary||e.defaultPrevented||!this.#f())return;const i=t.getBoundingClientRect();this.#a={centerX:i.left+i.width/2,centerY:i.top+i.height/2,dragging:!1,pointerId:e.pointerId,size:i.width,x:e.clientX,y:e.clientY};try{e.target.setPointerCapture(e.pointerId);}catch{}}#ee(e){const t=this.#a;if(t===void 0||e.pointerId!==t.pointerId)return;if(!this.#f()){this.#y(e);return;}if(!t.dragging){if(Math.hypot(e.clientX-t.x,e.clientY-t.y)<ot)return;t.dragging=!0,this.#T();try{this.#e.dial.setPointerCapture(e.pointerId);}catch{}}const i=e.clientX-t.centerX,n=e.clientY-t.centerY,s=fe(i,n);this.#V(s),this.#u(this.#D(s,Math.hypot(i,n)/t.size,!1),e,!1);}#te(e){const t=this.#a,i=this.#e.dial;if(t===void 0||e.pointerId!==t.pointerId)return;if(!this.#f()){this.#y(e);return;}if(this.#a=void 0,i.hasPointerCapture(e.pointerId)&&i.releasePointerCapture(e.pointerId),t.dragging){this.#H(!0);return;}const n=e.clientX-t.centerX,s=e.clientY-t.centerY,a=this.#D(fe(n,s),Math.hypot(n,s)/t.size,!0);this.#u(a,e,!0),this.#n===0&&this.#L();}#y(e){const t=this.#a;t===void 0||e.pointerId!==t.pointerId||(this.#a=void 0,t.dragging&&this.#H(!1));}#ie(e){this.#e.dial.hasPointerCapture(e.pointerId)||this.#y(e);}#ne(e){const t=this.#e,n=(this.#n===0?t.hours:t.minutes).findIndex(s=>s.button===e.target||s.label===e.target);e.detail!==0||n<0||e.defaultPrevented||!this.#f()||(this.#u(this.#Y(n),e,!0),this.#n===0&&this.#L());}#re(e){const t=ct(this.#i,this.#n,this.#t,e.key);t===void 0||e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||(e.preventDefault(),this.#u(t,e,!0),this.#I(this.#n).focus());}applyComponentProps(){const e=super.readProps(["defaultValue","disabled","form","hourCycle","labels","locale","name","orientation","readOnly","value"]),t=this.#e,i=e.disabled===!0,n=e.readOnly===!0,s=e.localeChanged||e.hourCycleChanged;if(t!==null){if(s&&(this.#h&&(this.#i=ie(e.locale,e.hourCycle)),super.setClass(ve,this.#i.h23)),this.#h||(this.#b=ee(e.defaultValue),this.#c||(this.#t=this.#b)),this.#c&&e.valueChanged&&(this.#t=ee(e.value)),e.orientationChanged&&super.setClass(ge,e.orientation==="landscape"),e.disabledChanged){super.setClass(ye,i);for(const{input:a}of t.fields)a.disabled=i;}if(e.readOnlyChanged){super.setClass(Ee,n);for(const{input:a}of t.fields)a.readOnly=n;for(const a of[t.period,...t.faces])m(a,"aria-readonly",n||void 0);}(e.nameChanged||e.formChanged||e.disabledChanged)&&(m(t.value,"form",e.form),m(t.value,"name",e.name),t.value.disabled=i||(e.name??"")===""),(e.labelsChanged||s)&&this.#J(),this.#h||(this.#h=!0,this.#_(),this.#O()),(e.valueChanged||s)&&this.#w(),s&&this.#F();}}#B(e){const t=<P attr:role="radio"class={Se}disabled={this.props.disabled===!0}/>,i=<input autocomplete="off"class="cw-TimePicker-input"inputmode="numeric"maxLength={Le}onChange={a=>this.#z(e,a)}onFocus={()=>this.#p(e,!1)}onInput={a=>this.#G(e,a)}type="text"/>,n=<span aria-live="polite"class="cw-TimePicker-supporting"id={this.#v[e]}/>,s=<div class="cw-TimePicker-field">
15
15
  {t}{i}{n}
16
- </div>;return{input:i,root:s,selector:t,supporting:n}}#U(){return<P attr:role="radio"class={k}disabled={this.props.disabled===!0}/>}#X(e){let t;return{button:<P attr:role="radio"class={ke}disabled={this.props.disabled===!0}style={He(e)}>
16
+ </div>;return{input:i,root:s,selector:t,supporting:n};}#U(){return<P attr:role="radio"class={k}disabled={this.props.disabled===!0}/>;}#X(e){let t;return{button:<P attr:role="radio"class={ke}disabled={this.props.disabled===!0}style={He(e)}>
17
17
  <span class="cw-TimePicker-label"ref={t}/>
18
- </P>,label:t}}render(e){const t=<div class="cw-TimePicker-title"id={this.#E}/>,i=this.#B(0),n=this.#B(1),s=<div aria-labelledby={this.#E}class="cw-TimePicker-time"onClick={u=>this.#q(u)}onKeyDown={u=>this.#j(u)}>
18
+ </P>,label:t};}render(e){const t=<div class="cw-TimePicker-title"id={this.#E}/>,i=this.#B(0),n=this.#B(1),s=<div aria-labelledby={this.#E}class="cw-TimePicker-time"onClick={u=>this.#q(u)}onKeyDown={u=>this.#j(u)}>
19
19
  {i.root}
20
20
  <span aria-hidden="true"class="cw-TimePicker-separator">:</span>
21
21
  {n.root}
@@ -26,4 +26,4 @@ import{createUniqueId as S,onCleanup as Ve,onMount as Je,untrack as Ge}from"soli
26
26
  <K class="_cw-TimePicker-inputIcon"name="keyboard"/>
27
27
  </P>,x=<input type="hidden"/>,w=<div class={Te}>
28
28
  {t}{b}{A}{R}{x}
29
- </div>;return be(w,e,null),this.#e={dial:A,faces:[O,N],fields:[i,n],hours:p,minutes:_,mode:R,period:l,periods:[a,c],time:s,title:t,value:x},w}}const St=ze(()=>mt,()=>ht);export{St as TimePicker};
29
+ </div>;return be(w,e,null),this.#e={dial:A,faces:[O,N],fields:[i,n],hours:p,minutes:_,mode:R,period:l,periods:[a,c],time:s,title:t,value:x},w;}}const St=/* @__PURE__ */ze(()=>mt,()=>ht);export{St as TimePicker};
@@ -0,0 +1 @@
1
+ import{getOwner as a,onCleanup as f}from"solid-js";import{applySpringMotion as b}from"./spring";const g=0.5;function m(o,s,p={}){let i,t;const n=new ResizeObserver(([d])=>{const e=d?.borderBoxSize[0];if(e===void 0)return;const r=getComputedStyle(o),c=Number.parseFloat(r.blockSize);e.inlineSize!==t||r.opacity==="0"?(i?.cancel(),o.style.blockSize=`${e.blockSize}px`):i?.playState==="running"?i.retarget(e.blockSize):Math.abs(e.blockSize-c)>=g&&(i=b(o,"block-size",c,e.blockSize,{role:"spatial",speed:"default",...p,unit:"px"})),t=e.inlineSize;}),l={cancel(){n.disconnect(),i?.cancel();},async settled(){await i?.finished.catch(()=>{});}};return n.observe(s,{box:"border-box"}),a()!==null&&f(l.cancel),l;}export{m as followHeight};
@@ -1 +1 @@
1
- import{checkArgument as r}from"../util";class o{#t;#e;#n;#i;constructor(e){this.#t=e,this.#e=new Set,this.#n=i=>this.#r(i),this.#i=void 0}subscribe(e){return this.#e.add(e),this.#i??=this.#t.requestAnimationFrame(this.#n),()=>this.#s(e)}#s(e){!this.#e.delete(e)||this.#e.size!==0||this.#i===void 0||(this.#t.cancelAnimationFrame(this.#i),this.#i=void 0)}#r(e){this.#i=void 0;for(const i of[...this.#e])if(this.#e.has(i))try{i(e)}catch(s){this.#t.reportError(s)}this.#e.size!==0&&(this.#i??=this.#t.requestAnimationFrame(this.#n))}}const n=new WeakMap;function d(t,e){let i=n.get(t);return r(typeof t.requestAnimationFrame=="function","window does not provide animation frames"),i===void 0&&(i=new o(t),n.set(t,i)),i.subscribe(e)}export{d as subscribeMotionFrames};
1
+ import{checkArgument as r}from"../util";class o{#t;#e;#n;#i;constructor(e){this.#t=e,this.#e=/* @__PURE__ */new Set(),this.#n=i=>this.#r(i),this.#i=void 0;}subscribe(e){return this.#e.add(e),this.#i??=this.#t.requestAnimationFrame(this.#n),()=>this.#s(e);}#s(e){!this.#e.delete(e)||this.#e.size!==0||this.#i===void 0||(this.#t.cancelAnimationFrame(this.#i),this.#i=void 0);}#r(e){this.#i=void 0;for(const i of[...this.#e])if(this.#e.has(i))try{i(e);}catch(s){this.#t.reportError(s);}this.#e.size!==0&&(this.#i??=this.#t.requestAnimationFrame(this.#n));}}const n=/* @__PURE__ */new WeakMap();function d(t,e){let i=n.get(t);return r(typeof t.requestAnimationFrame=="function","window does not provide animation frames"),i===void 0&&(i=new o(t),n.set(t,i)),i.subscribe(e);}export{d as subscribeMotionFrames};
@@ -1 +1 @@
1
- import{subscribeMotionFrames as t}from"./frame";import{createMaterialTransition as r}from"./material";import{SUPPORTS_MOTION as a,applyMotion as p}from"./motion";import{applySpringMotion as m}from"./spring";import{EnterSequenceBegin as T,EnterSequenceEnd as S,ExitSequenceBegin as f,ExitSequenceEnd as x,Transition as g,TransitionBegin as l,TransitionEnd as c}from"./transition";import{VelocityTracker as E}from"./velocity";export{T as EnterSequenceBegin,S as EnterSequenceEnd,f as ExitSequenceBegin,x as ExitSequenceEnd,a as SUPPORTS_MOTION,g as Transition,l as TransitionBegin,c as TransitionEnd,E as VelocityTracker,p as applyMotion,m as applySpringMotion,r as createMaterialTransition,t as subscribeMotionFrames};
1
+ import{followHeight as e}from"./follow-height";import{subscribeMotionFrames as r}from"./frame";import{createMaterialTransition as a}from"./material";import{SUPPORTS_MOTION as s,applyMotion as m}from"./motion";import{applySpringMotion as l}from"./spring";import{EnterSequenceBegin as T,EnterSequenceEnd as g,ExitSequenceBegin as x,ExitSequenceEnd as S,Transition as y,TransitionBegin as c,TransitionEnd as E}from"./transition";import{VelocityTracker as O}from"./velocity";export{T as EnterSequenceBegin,g as EnterSequenceEnd,x as ExitSequenceBegin,S as ExitSequenceEnd,s as SUPPORTS_MOTION,y as Transition,c as TransitionBegin,E as TransitionEnd,O as VelocityTracker,m as applyMotion,l as applySpringMotion,a as createMaterialTransition,e as followHeight,r as subscribeMotionFrames};
@@ -1 +1 @@
1
- import{isServer as L}from"solid-js/web";import{checkArgument as b}from"../util";import{applyMotion as G}from"./motion";const S="--cw-Motion-transition-easing-emphasized-uniform",U=30,W=.8,X=1.1,O=.35,V=.92,Y=.8,Z=.3,P=82/255,A=new WeakMap,j={fade:[0,.25],scaleMask:[0,1],shapeMask:[0,.75]},q={fade:[.6,.9],scaleMask:[0,.9],shapeMask:[.3,.9]},H=10;function M(e,o,i,n){const[t,a]=i;return n<=t?e:n>=a?o:e+(o-e)*(n-t)/(a-t)}function l(e){return`${Math.round(e*1e3)/1e3}px`}function v(e,o){const i=e.borderTopLeftRadius.trim().split(/\s+/)[0]??"",n=Number.parseFloat(i);return Number.isFinite(n)?i.endsWith("%")?n/100*Math.min(o.width,o.height):n:0}function I(e,o,i,n,t,a){const s=(t.top-n)/o,c=(t.left-i)/o,r=e.width-(t.left+t.width-i)/o,d=e.height-(t.top+t.height-n)/o,m=(u,g)=>l(u<-.5||g<-.5?0:a/o);return{clipPath:`inset(${l(Math.max(0,s))} ${l(Math.max(0,r))} ${l(Math.max(0,d))} ${l(Math.max(0,c))} round ${m(s,c)} ${m(s,r)} ${m(d,r)} ${m(d,c)})`,scale:`${Math.round(o*1e5)/1e5}`,transformOrigin:"0 0",translate:`${l(i-e.left)} ${l(n-e.top)}`}}function J(e,o,i){const n=e.getBoundingClientRect(),t=o.getBoundingClientRect(),a=o.ownerDocument.defaultView,s=a===null?0:v(a.getComputedStyle(e),n),c=a===null?0:v(a.getComputedStyle(o),t),r=i?j:q,d=[0,1],m=[...new Set([...Array.from({length:H+1},(f,h)=>h/H),...r.fade,...r.scaleMask,...r.shapeMask])].sort((f,h)=>f-h),u=i?t.height*n.width/t.width>=n.height:n.height*t.width/n.width>=t.height,g=u?n.width:n.height,B=u?n.height:n.width,C=u?t.width:t.height,z=u?t.height:t.width,_=[],N=[];for(const f of m){const h=M(0,1,r.scaleMask,f),E=M(n.left+n.width/2,t.left+t.width/2,d,f),x=M(n.top,t.top,d,f),y=M(g,C,d,f),R=y/g,w=y/C,T=B*R,p=z*w,D=T>p?T-(T-p)*h:p-(p-T)*(1-h),F=u?y:D,K=u?D:y,$={left:E-F/2,top:x,width:F,height:K},k=M(s,c,r.shapeMask,f);_.push({...I(n,R,E-n.width*R/2,x,$,k),offset:f}),N.push({...I(t,w,E-t.width*w/2,x,$,k),offset:f,opacity:M(0,1,r.fade,f)})}return{exiting:e,exitFrames:_,enterFrames:N}}function Q(e,o,i,n){if(e.parentNode===null)return;const t=e.ownerDocument.createElement("div");t.setAttribute("aria-hidden","true"),t.style.cssText="background-color:var(--cw-Color-scrim,#000);inset:0;opacity:0;pointer-events:none;position:fixed",e.before(t),G(t,[{opacity:o?0:P},{opacity:o?P:0}],{duration:i,easing:n}).finished.then(()=>t.remove(),()=>t.remove())}function tt(e,o,i,n){const[t,a]=e;let s=a===void 0?void 0:A.get(a);if(L||t===void 0||a===void 0)return o?["fade-in"]:["fade-out"];if(s?.exiting===t)A.delete(a);else{const c=t.getBoundingClientRect(),r=a.getBoundingClientRect();if(c.width===0||c.height===0||r.width===0||r.height===0)return o?["fade-in"]:["fade-out"];s=J(t,a,i),A.set(a,s),Q(t,i,n,S)}return o?s.enterFrames:s.exitFrames}function nt(e,o,i,n,t,a){const s=!L&&n==="x"&&o!==void 0&&o.ownerDocument.defaultView?.getComputedStyle(o).direction==="rtl",c=(t===i?1:-1)*(s?-1:1),r=n==="x"?`${c*a}px 0px`:`0px ${c*a}px`,d=t===i?W:X;return e==="fade"?i?[{offset:0,opacity:0,scale:`${Y}`},{offset:Z,opacity:1},{offset:1,opacity:1,scale:"1"}]:[{opacity:1},{opacity:0}]:i?[{offset:0,opacity:0,...e==="fadeThrough"?{scale:`${V}`}:n==="z"?{scale:`${d}`}:{translate:r}},{offset:O,opacity:0},{offset:1,opacity:1,...e==="fadeThrough"||n==="z"?{scale:"1"}:{translate:"0px 0px"}}]:[{offset:0,opacity:1,...e==="fadeThrough"?{}:n==="z"?{scale:"1"}:{translate:"0px 0px"}},{offset:O,opacity:0},{offset:1,opacity:0,...e==="fadeThrough"?{}:n==="z"?{scale:`${d}`}:{translate:r}}]}function at(e,o={}){const i=o.axis??"x",n=o.distance??U,t=o.forward!==!1;b(e==="containerTransform"||e==="fade"||e==="fadeThrough"||e==="sharedAxis","invalid Material transition pattern"),b(i==="x"||i==="y"||i==="z","invalid shared axis"),b(Number.isFinite(n)&&n>=0,"invalid shared-axis distance");const a=o.duration??(e==="fade"?"--cw-Motion-transition-duration-medium-4":e!=="containerTransform"?"--cw-Motion-transition-duration-long-1":t?"--cw-Motion-transition-duration-long-2":"--cw-Motion-transition-duration-medium-4"),s=o.duration??(e==="fade"?"--cw-Motion-transition-duration-short-3":a),c=(r,d)=>e==="containerTransform"?tt(r,d,t,a):nt(e,r[d?1:0],d,i,t,n);return{enterMotion:{duration:a,easing:e==="fade"?"--cw-Motion-transition-easing-emphasized-decelerate":S,keyframes:r=>c(r,!0)},exitMotion:{duration:s,easing:e==="fade"?"--cw-Motion-transition-easing-emphasized-accelerate":S,keyframes:r=>c(r,!1)}}}export{at as createMaterialTransition};
1
+ import{isServer as L}from"solid-js/web";import{checkArgument as b}from"../util";import{applyMotion as G}from"./motion";const S="--cw-Motion-transition-easing-emphasized-uniform",U=30,W=0.8,X=1.1,O=0.35,V=0.92,Y=0.8,Z=0.3,P=82/255,A=/* @__PURE__ */new WeakMap(),j={fade:[0,0.25],scaleMask:[0,1],shapeMask:[0,0.75]},q={fade:[0.6,0.9],scaleMask:[0,0.9],shapeMask:[0.3,0.9]},H=10;function M(e,o,i,n){const[t,a]=i;return n<=t?e:n>=a?o:e+(o-e)*(n-t)/(a-t);}function l(e){return`${Math.round(e*1e3)/1e3}px`;}function v(e,o){const i=e.borderTopLeftRadius.trim().split(/\s+/)[0]??"",n=Number.parseFloat(i);return Number.isFinite(n)?i.endsWith("%")?n/100*Math.min(o.width,o.height):n:0;}function I(e,o,i,n,t,a){const s=(t.top-n)/o,c=(t.left-i)/o,r=e.width-(t.left+t.width-i)/o,d=e.height-(t.top+t.height-n)/o,m=(u,g)=>l(u<-0.5||g<-0.5?0:a/o);return{clipPath:`inset(${l(Math.max(0,s))} ${l(Math.max(0,r))} ${l(Math.max(0,d))} ${l(Math.max(0,c))} round ${m(s,c)} ${m(s,r)} ${m(d,r)} ${m(d,c)})`,scale:`${Math.round(o*1e5)/1e5}`,transformOrigin:"0 0",translate:`${l(i-e.left)} ${l(n-e.top)}`};}function J(e,o,i){const n=e.getBoundingClientRect(),t=o.getBoundingClientRect(),a=o.ownerDocument.defaultView,s=a===null?0:v(a.getComputedStyle(e),n),c=a===null?0:v(a.getComputedStyle(o),t),r=i?j:q,d=[0,1],m=[.../* @__PURE__ */new Set([...Array.from({length:H+1},(f,h)=>h/H),...r.fade,...r.scaleMask,...r.shapeMask])].sort((f,h)=>f-h),u=i?t.height*n.width/t.width>=n.height:n.height*t.width/n.width>=t.height,g=u?n.width:n.height,B=u?n.height:n.width,C=u?t.width:t.height,z=u?t.height:t.width,_=[],N=[];for(const f of m){const h=M(0,1,r.scaleMask,f),E=M(n.left+n.width/2,t.left+t.width/2,d,f),x=M(n.top,t.top,d,f),y=M(g,C,d,f),R=y/g,w=y/C,T=B*R,p=z*w,D=T>p?T-(T-p)*h:p-(p-T)*(1-h),F=u?y:D,K=u?D:y,$={left:E-F/2,top:x,width:F,height:K},k=M(s,c,r.shapeMask,f);_.push({...I(n,R,E-n.width*R/2,x,$,k),offset:f}),N.push({...I(t,w,E-t.width*w/2,x,$,k),offset:f,opacity:M(0,1,r.fade,f)});}return{exiting:e,exitFrames:_,enterFrames:N};}function Q(e,o,i,n){if(e.parentNode===null)return;const t=e.ownerDocument.createElement("div");t.setAttribute("aria-hidden","true"),t.style.cssText="background-color:var(--cw-Color-scrim,#000);inset:0;opacity:0;pointer-events:none;position:fixed",e.before(t),G(t,[{opacity:o?0:P},{opacity:o?P:0}],{duration:i,easing:n}).finished.then(()=>t.remove(),()=>t.remove());}function tt(e,o,i,n){const[t,a]=e;let s=a===void 0?void 0:A.get(a);if(L||t===void 0||a===void 0)return o?["fade-in"]:["fade-out"];if(s?.exiting===t)A.delete(a);else{const c=t.getBoundingClientRect(),r=a.getBoundingClientRect();if(c.width===0||c.height===0||r.width===0||r.height===0)return o?["fade-in"]:["fade-out"];s=J(t,a,i),A.set(a,s),Q(t,i,n,S);}return o?s.enterFrames:s.exitFrames;}function nt(e,o,i,n,t,a){const s=!L&&n==="x"&&o!==void 0&&o.ownerDocument.defaultView?.getComputedStyle(o).direction==="rtl",c=(t===i?1:-1)*(s?-1:1),r=n==="x"?`${c*a}px 0px`:`0px ${c*a}px`,d=t===i?W:X;return e==="fade"?i?[{offset:0,opacity:0,scale:`${Y}`},{offset:Z,opacity:1},{offset:1,opacity:1,scale:"1"}]:[{opacity:1},{opacity:0}]:i?[{offset:0,opacity:0,...(e==="fadeThrough"?{scale:`${V}`}:n==="z"?{scale:`${d}`}:{translate:r})},{offset:O,opacity:0},{offset:1,opacity:1,...(e==="fadeThrough"||n==="z"?{scale:"1"}:{translate:"0px 0px"})}]:[{offset:0,opacity:1,...(e==="fadeThrough"?{}:n==="z"?{scale:"1"}:{translate:"0px 0px"})},{offset:O,opacity:0},{offset:1,opacity:0,...(e==="fadeThrough"?{}:n==="z"?{scale:`${d}`}:{translate:r})}];}function at(e,o={}){const i=o.axis??"x",n=o.distance??U,t=o.forward!==!1;b(e==="containerTransform"||e==="fade"||e==="fadeThrough"||e==="sharedAxis","invalid Material transition pattern"),b(i==="x"||i==="y"||i==="z","invalid shared axis"),b(Number.isFinite(n)&&n>=0,"invalid shared-axis distance");const a=o.duration??(e==="fade"?"--cw-Motion-transition-duration-medium-4":e!=="containerTransform"?"--cw-Motion-transition-duration-long-1":t?"--cw-Motion-transition-duration-long-2":"--cw-Motion-transition-duration-medium-4"),s=o.duration??(e==="fade"?"--cw-Motion-transition-duration-short-3":a),c=(r,d)=>e==="containerTransform"?tt(r,d,t,a):nt(e,r[d?1:0],d,i,t,n);return{enterMotion:{duration:a,easing:e==="fade"?"--cw-Motion-transition-easing-emphasized-decelerate":S,keyframes:r=>c(r,!0)},exitMotion:{duration:s,easing:e==="fade"?"--cw-Motion-transition-easing-emphasized-accelerate":S,keyframes:r=>c(r,!1)}};}export{at as createMaterialTransition};
@@ -1 +1 @@
1
- import{isServer as p}from"solid-js/web";import{BoxBottom as $,BoxLeft as b,BoxRight as w,BoxTop as h,axisOfBoxSide as D,checkArgument as s,checkState as k,logicalBoxSidesOf as O,printDebug as M}from"../util";const y=new WeakMap,R=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(ms|s)?$/i,T=/^[a-z][-a-z0-9]*(?:\([^()]*\))?$/i,C="(prefers-reduced-motion: reduce)";function S(n){const t=p?!1:y.get(n);if(t!==void 0)return t;const e=n.createElement("div");let i=!1,o;try{if(e.style.cssText="width:0px;height:0px;display:none",n.documentElement.appendChild(e),typeof e.animate!="function"||typeof e.getAnimations!="function")throw new Error("Web Animations API unavailable");o=e.animate([{backgroundColor:"red"},{backgroundColor:"blue"}],{duration:1e3}),o.finished.catch(()=>{}),i=o.pending&&o.playState==="running"&&typeof o.finished.then=="function"&&e.getAnimations({subtree:!0}).includes(o)}catch(r){M("motion not supported, web animation api unavailable",r)}finally{o?.cancel(),e.remove()}return y.set(n,i),i}const F=!p&&S(document);function A(n){let t=n.memo["$$logical-sides"];return t===void 0&&(t=O(n.element,n.pseudoElement),n.memo["$$logical-sides"]=t),t}function v(n,t,e){let i=n.memo[t];if(i!==void 0)return i;const o=n.element.ownerDocument.defaultView;k(o!==null,"element owner document has no browsing context"),i=o.getComputedStyle(n.element,n.pseudoElement??null).getPropertyValue(t),s(i!=="",`element does not style '${t}'`);try{i=e(i)}catch(r){throw new Error(`failed to parse style property '${t}': ${i}`,{cause:r})}return n.memo[t]=i,i}function m(n,t){const e=t===void 0?0:typeof t=="number"?t:v(n,t,B);return s(Number.isFinite(e),"invalid duration"),e}function B(n){const t=R.exec((n.split(",").at(-1)??"").trim()),e=Number(t?.[1]);return s(t!==null&&Number.isFinite(e),"invalid duration"),e*(t[2]?.toLowerCase()==="s"?1e3:1)}function N(n){let t=0,e=0;for(let o=0;o<n.length;o++)n[o]==="("?t++:n[o]===")"?t--:n[o]===","&&t===0&&(e=o+1);const i=n.slice(e).trim();return s(T.test(i),"invalid easing function"),i}function x(n,t){return t===void 0||!t.startsWith("--")&&t!=="animation-timing-function"&&t!=="transition-timing-function"?t:v(n,t,N)}function K(n,t){s(t==="block"||t==="inline","invalid motion axis");const e=A(n);return(t==="block"?[h,$]:[b,w]).map(i=>e[i])}function z(n,t,e){const{axis:i,dir:o,name:r}=/^(?<name>[a-z]+)-(?<dir>in|out)(?:-(?<axis>block|inline))?$/.exec(e)?.groups??{};s(r!==void 0&&(o==="in"||o==="out"),`invalid predefined motion name: ${e}`);const[a,l]=o==="in"?n:[n[1],n[0]];if(r==="fade"||r==="zoom"){s(i===void 0,`predefined motion ${e} does not operate on an axis`),r==="fade"?a.opacity=0:a.scale=0;return}const[d,c]=K(t,i);(r==="clip"||r==="slide")&&(a.clipPath??=[0,0,0,0],l.clipPath??=[0,0,0,0]),r==="clip"?a.clipPath[c]=100:r==="expand"?i==="block"?a.blockSize=0:a.inlineSize=0:(s(r==="slide",`${e} is not a predefined motion`),a.translate??=[0,0],l.translate??=[0,0],a.clipPath[d]=100,a.translate[D(d)]=d===b||d===h?-100:100)}function g(n,t,e){const i={};let o=!1;for(const[r,a]of Object.entries(t)){if(typeof r!="string")continue;let l=Array.isArray(a)?a.map(d=>`${d}%`).join(" "):typeof a=="number"?a.toString():"";l!==""&&(r==="clipPath"&&(l=`inset(${l})`),i[r]=l,o=!0)}return o?(e!==void 0&&(i.offset=e),n.push(i)-1):-1}function I(n,t){const e=[],i={};let o=-1;for(let r=0;r<t.length;){let a=t[r];if(typeof a=="object"){e.push(a.easing===void 0?a:{...a,easing:x(n,a.easing)}),r++;continue}const l={};do z([l,i],n,a);while(++r<t.length&&typeof(a=t[r])!="object");o=g(e,l,e.length===0?0:void 0)}return g(e,i,1)===-1&&o!==-1&&o===e.length-1&&e[o].offset===void 0&&e.push({offset:1}),e}function E(){return{pending:!1,playState:"finished",get finished(){return Promise.resolve(this)},get ready(){return Promise.resolve(this)},updatePlaybackRate(n){},cancel(){}}}function L(n,t){const e=()=>{t.matches&&(n.effect?.updateTiming({iterations:1}),n.playbackRate=n.playbackRate===0?1:n.playbackRate,n.finish())},i=()=>t.removeEventListener("change",e);t.addEventListener("change",e),n.finished.then(i,i)}function _(n,t,e){const i={element:n,pseudoElement:e.pseudoElement,memo:e.cache??{}},o=I(i,t),r=m(i,e.startDelay),a=m(i,e.duration),l=m(i,e.endDelay),d=e.iterations??1,c=e.respectReducedMotion===!1?void 0:n.ownerDocument.defaultView?.matchMedia?.(C),f=c?.matches===!0;s(a>=0,"invalid duration"),s(d===1/0||Number.isFinite(d)&&d>=0,"invalid iteration count");const P={delay:f?0:r,direction:e.direction??"normal",duration:f?0:a,easing:x(i,e.easing)??"linear",endDelay:f?0:l,fill:e.fill??"none",iterations:f?1:d,composite:e.composite??"replace",pseudoElement:e.pseudoElement};try{const u=n.animate(o,P);if(!u||!("finished"in u)||!("playState"in u))throw u?.cancel(),new Error("invalid animate implementation");return c!==void 0&&L(u,c),u}catch(u){return M("failed to animate element",{cause:u}),E()}}function W(n,t,e){return p||typeof n.animate!="function"||!S(n.ownerDocument)?E():_(n,t,e)}export{F as SUPPORTS_MOTION,W as applyMotion};
1
+ import{isServer as p}from"solid-js/web";import{BoxBottom as $,BoxLeft as b,BoxRight as w,BoxTop as h,axisOfBoxSide as D,checkArgument as s,checkState as k,logicalBoxSidesOf as O,printDebug as M}from"../util";const y=/* @__PURE__ */new WeakMap(),R=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(ms|s)?$/i,T=/^[a-z][-a-z0-9]*(?:\([^()]*\))?$/i,C="(prefers-reduced-motion: reduce)";function S(n){const t=p?!1:y.get(n);if(t!==void 0)return t;const e=n.createElement("div");let i=!1,o;try{if(e.style.cssText="width:0px;height:0px;display:none",n.documentElement.appendChild(e),typeof e.animate!="function"||typeof e.getAnimations!="function")throw new Error("Web Animations API unavailable");o=e.animate([{backgroundColor:"red"},{backgroundColor:"blue"}],{duration:1e3}),o.finished.catch(()=>{}),i=o.pending&&o.playState==="running"&&typeof o.finished.then=="function"&&e.getAnimations({subtree:!0}).includes(o);}catch(r){M("motion not supported, web animation api unavailable",r);}finally{o?.cancel(),e.remove();}return y.set(n,i),i;}const F=!p&&/* @__PURE__ */S(document);function A(n){let t=n.memo["$$logical-sides"];return t===void 0&&(t=O(n.element,n.pseudoElement),n.memo["$$logical-sides"]=t),t;}function v(n,t,e){let i=n.memo[t];if(i!==void 0)return i;const o=n.element.ownerDocument.defaultView;k(o!==null,"element owner document has no browsing context"),i=o.getComputedStyle(n.element,n.pseudoElement??null).getPropertyValue(t),s(i!=="",`element does not style '${t}'`);try{i=e(i);}catch(r){throw new Error(`failed to parse style property '${t}': ${i}`,{cause:r});}return n.memo[t]=i,i;}function m(n,t){const e=t===void 0?0:typeof t=="number"?t:v(n,t,B);return s(Number.isFinite(e),"invalid duration"),e;}function B(n){const t=R.exec((n.split(",").at(-1)??"").trim()),e=Number(t?.[1]);return s(t!==null&&Number.isFinite(e),"invalid duration"),e*(t[2]?.toLowerCase()==="s"?1e3:1);}function N(n){let t=0,e=0;for(let o=0;o<n.length;o++)n[o]==="("?t++:n[o]===")"?t--:n[o]===","&&t===0&&(e=o+1);const i=n.slice(e).trim();return s(T.test(i),"invalid easing function"),i;}function x(n,t){return t===void 0||!t.startsWith("--")&&t!=="animation-timing-function"&&t!=="transition-timing-function"?t:v(n,t,N);}function K(n,t){s(t==="block"||t==="inline","invalid motion axis");const e=A(n);return(t==="block"?[h,$]:[b,w]).map(i=>e[i]);}function z(n,t,e){const{axis:i,dir:o,name:r}=/^(?<name>[a-z]+)-(?<dir>in|out)(?:-(?<axis>block|inline))?$/.exec(e)?.groups??{};s(r!==void 0&&(o==="in"||o==="out"),`invalid predefined motion name: ${e}`);const[a,l]=o==="in"?n:[n[1],n[0]];if(r==="fade"||r==="zoom"){s(i===void 0,`predefined motion ${e} does not operate on an axis`),r==="fade"?a.opacity=0:a.scale=0;return;}const[d,c]=K(t,i);(r==="clip"||r==="slide")&&(a.clipPath??=[0,0,0,0],l.clipPath??=[0,0,0,0]),r==="clip"?a.clipPath[c]=100:r==="expand"?i==="block"?a.blockSize=0:a.inlineSize=0:(s(r==="slide",`${e} is not a predefined motion`),a.translate??=[0,0],l.translate??=[0,0],a.clipPath[d]=100,a.translate[D(d)]=d===b||d===h?-100:100);}function g(n,t,e){const i={};let o=!1;for(const[r,a]of Object.entries(t)){if(typeof r!="string")continue;let l=Array.isArray(a)?a.map(d=>`${d}%`).join(" "):typeof a=="number"?a.toString():"";l!==""&&(r==="clipPath"&&(l=`inset(${l})`),i[r]=l,o=!0);}return o?(e!==void 0&&(i.offset=e),n.push(i)-1):-1;}function I(n,t){const e=[],i={};let o=-1;for(let r=0;r<t.length;){let a=t[r];if(typeof a=="object"){e.push(a.easing===void 0?a:{...a,easing:x(n,a.easing)}),r++;continue;}const l={};do z([l,i],n,a);while(++r<t.length&&typeof(a=t[r])!="object");o=g(e,l,e.length===0?0:void 0);}return g(e,i,1)===-1&&o!==-1&&o===e.length-1&&e[o].offset===void 0&&e.push({offset:1}),e;}function E(){return{pending:!1,playState:"finished",get finished(){return Promise.resolve(this);},get ready(){return Promise.resolve(this);},updatePlaybackRate(n){},cancel(){}};}function L(n,t){const e=()=>{t.matches&&(n.effect?.updateTiming({iterations:1}),n.playbackRate=n.playbackRate===0?1:n.playbackRate,n.finish());},i=()=>t.removeEventListener("change",e);t.addEventListener("change",e),n.finished.then(i,i);}function _(n,t,e){const i={element:n,pseudoElement:e.pseudoElement,memo:e.cache??{}},o=I(i,t),r=m(i,e.startDelay),a=m(i,e.duration),l=m(i,e.endDelay),d=e.iterations??1,c=e.respectReducedMotion===!1?void 0:n.ownerDocument.defaultView?.matchMedia?.(C),f=c?.matches===!0;s(a>=0,"invalid duration"),s(d===1/0||Number.isFinite(d)&&d>=0,"invalid iteration count");const P={delay:f?0:r,direction:e.direction??"normal",duration:f?0:a,easing:x(i,e.easing)??"linear",endDelay:f?0:l,fill:e.fill??"none",iterations:f?1:d,composite:e.composite??"replace",pseudoElement:e.pseudoElement};try{const u=n.animate(o,P);if(!u||!("finished"in u)||!("playState"in u))throw u?.cancel(),new Error("invalid animate implementation");return c!==void 0&&L(u,c),u;}catch(u){return M("failed to animate element",{cause:u}),E();}}function W(n,t,e){return p||typeof n.animate!="function"||!S(n.ownerDocument)?E():_(n,t,e);}export{F as SUPPORTS_MOTION,W as applyMotion};
@@ -1 +1 @@
1
- import{getOwner as x,onCleanup as P}from"solid-js";import{isServer as R}from"solid-js/web";import{checkArgument as d}from"../util";import{subscribeMotionFrames as T}from"./frame";const F={expressive:{effect:{default:[1600,1],fast:[3800,1],slow:[800,1]},spatial:{default:[380,.8],fast:[800,.6],slow:[200,.8]}},standard:{effect:{default:[1600,1],fast:[3800,1],slow:[800,1]},spatial:{default:[700,.9],fast:[1400,.9],slow:[300,.9]}}},L={"%":.1,deg:.1,px:.4},N=.002,O=1e3/16,C="(prefers-reduced-motion: reduce)";function D(l,n,e,s,i,t){const o=Math.sqrt(s),r=l-e,a=i*o;if(i===1){const p=n+o*r,m=r+p*t,f=Math.exp(-o*t);return[e+m*f,(p-o*m)*f]}if(i<1){const p=o*Math.sqrt(1-i*i),m=(n+a*r)/p,f=Math.sin(p*t),v=Math.cos(p*t),b=r*v+m*f,M=Math.exp(-a*t);return[e+b*M,(p*(m*v-r*f)-a*b)*M]}const h=o*Math.sqrt(i*i-1),u=-s/(a+h),c=-a-h,g=(n-c*r)/(u-c),S=g*Math.exp(u*t),y=(r-g)*Math.exp(c*t);return[e+S+y,u*S+c*y]}function E(l,n){const e=l?.getPropertyValue(n).trim()??"",s=e===""?NaN:Number(e);return Number.isFinite(s)&&s>0?s:void 0}function _(l,n,e){const s=e.scheme??"standard",i=e.role??"spatial",t=e.speed??"default";d(s==="expressive"||s==="standard","invalid spring scheme"),d(i==="effect"||i==="spatial","invalid spring role"),d(t==="default"||t==="fast"||t==="slow","invalid spring speed");const[o,r]=F[s][i][t],a=e.scheme!==void 0||n===null||e.stiffness!==void 0&&e.damping!==void 0?void 0:n.getComputedStyle(l),h=`--cw-Motion-spring-${i}-${t}`;return[e.stiffness??E(a,`${h}-stiffness`)??o,e.damping??E(a,`${h}-damping`)??r]}function w(){let l,n;const e=new Promise((s,i)=>{l=s,n=i});return e.catch(()=>{}),{promise:e,resolve:l,reject:n}}class H{#m;#f;#g;#e;#r;#S;#y;#h;#v;#u;#n;#i;#s;#o;#t;#a;#d;constructor(n,e,s,i,t){const o=R?null:n.ownerDocument.defaultView,[r,a]=_(n,o,t),h=t.unit??"",u=t.threshold??L[h]??N,c=t.velocity??0;d(Number.isFinite(s)&&Number.isFinite(i),"invalid spring value"),d(Number.isFinite(c),"invalid spring velocity"),d(Number.isFinite(r)&&r>0,"invalid spring stiffness"),d(Number.isFinite(a)&&a>0,"invalid spring damping"),d(Number.isFinite(u)&&u>0,"invalid spring threshold"),this.#m=n,this.#f=e,this.#g=h,this.#e=typeof o?.requestAnimationFrame=="function"?o:null,this.#r=t.respectReducedMotion===!1?void 0:this.#e?.matchMedia?.(C),this.#S=r,this.#y=a,this.#h=u,this.#v=g=>this.#R(g),this.#u=()=>this.#E(),this.#n=s,this.#i=c,this.#s=i,this.#o=0,this.#t="idle",this.#a=w(),this.#d=void 0,this.#b()}get value(){return this.#n}get velocity(){return this.#i}get playState(){return this.#t}get finished(){return this.#a.promise}retarget(n){if(d(Number.isFinite(n),"invalid spring value"),this.#t==="running"&&this.#e!==null){this.#c(this.#e.performance.now()),this.#s=n,this.#l();return}this.#s=n,this.#a=w(),this.#b()}cancel(){this.#t==="running"&&(this.#e!==null&&this.#c(this.#e.performance.now()),this.#M(),this.#l(),this.#t="idle",this.#a.reject(new DOMException("Spring motion cancelled","AbortError")))}#b(){if(this.#t="running",this.#e===null||this.#r?.matches===!0){this.#p();return}this.#o=this.#e.performance.now(),this.#r?.addEventListener("change",this.#u),this.#l(),this.#d=T(this.#e,this.#v)}#c(n){const e=Math.max(this.#o,n);[this.#n,this.#i]=D(this.#n,this.#i,this.#s,this.#S,this.#y,(e-this.#o)/1e3),this.#o=e}#R(n){this.#c(n),Math.abs(this.#n-this.#s)<this.#h&&Math.abs(this.#i)<this.#h*O?this.#p():this.#l()}#E(){this.#r?.matches===!0&&this.#p()}#p(){this.#M(),this.#t="finished",this.#n=this.#s,this.#i=0,this.#l(),this.#a.resolve(this)}#M(){this.#d?.(),this.#d=void 0,this.#r?.removeEventListener("change",this.#u)}#l(){R||this.#m.style.setProperty(this.#f,`${this.#n}${this.#g}`)}}function A(l,n,e,s,i={}){const t=new H(l,n,e,s,i);return x()!==null&&P(()=>t.cancel()),t}export{A as applySpringMotion};
1
+ import{getOwner as x,onCleanup as L}from"solid-js";import{isServer as E}from"solid-js/web";import{checkArgument as d}from"../util";import{subscribeMotionFrames as P}from"./frame";const T={expressive:{effect:{default:[1600,1],fast:[3800,1],slow:[800,1]},spatial:{default:[380,0.8],fast:[800,0.6],slow:[200,0.8]}},standard:{effect:{default:[1600,1],fast:[3800,1],slow:[800,1]},spatial:{default:[700,0.9],fast:[1400,0.9],slow:[300,0.9]}}},F={"%":0.1,deg:0.1,px:0.4},N=2e-3,O=1e3/16,C="(prefers-reduced-motion: reduce)";function D(l,e,t,s,i,n){const o=Math.sqrt(s),r=l-t,a=i*o;if(i===1){const m=e+o*r,p=r+m*n,f=Math.exp(-o*n);return[t+p*f,(m-o*p)*f];}if(i<1){const m=o*Math.sqrt(1-i*i),p=(e+a*r)/m,f=Math.sin(m*n),v=Math.cos(m*n),b=r*v+p*f,M=Math.exp(-a*n);return[t+b*M,(m*(p*v-r*f)-a*b)*M];}const h=o*Math.sqrt(i*i-1),u=-s/(a+h),c=-a-h,g=(e-c*r)/(u-c),S=g*Math.exp(u*n),y=(r-g)*Math.exp(c*n);return[t+S+y,u*S+c*y];}function R(l,e){const t=l?.getPropertyValue(e).trim()??"",s=t===""?NaN:Number(t);return Number.isFinite(s)&&s>0?s:void 0;}function _(l,e,t){const s=t.scheme??"standard",i=t.role??"spatial",n=t.speed??"default";d(s==="expressive"||s==="standard","invalid spring scheme"),d(i==="effect"||i==="spatial","invalid spring role"),d(n==="default"||n==="fast"||n==="slow","invalid spring speed");const[o,r]=T[s][i][n],a=t.scheme!==void 0||e===null||t.stiffness!==void 0&&t.damping!==void 0?void 0:e.getComputedStyle(l),h=`--cw-Motion-spring-${i}-${n}`;return[t.stiffness??R(a,`${h}-stiffness`)??o,t.damping??R(a,`${h}-damping`)??r];}function w(){let l,e;const t=new Promise((s,i)=>{l=s,e=i;});return t.catch(()=>{}),{promise:t,resolve:l,reject:e};}class H{#p;#f;#g;#e;#d;#S;#y;#u;#v;#r;#t;#i;#s;#o;#n;#a;#h;constructor(e,t,s,i,n){const o=E?null:e.ownerDocument.defaultView,[r,a]=_(e,o,n),h=n.unit??"",u=n.threshold??F[h]??N,c=n.velocity??0;d(Number.isFinite(s)&&Number.isFinite(i),"invalid spring value"),d(Number.isFinite(c),"invalid spring velocity"),d(Number.isFinite(r)&&r>0,"invalid spring stiffness"),d(Number.isFinite(a)&&a>0,"invalid spring damping"),d(Number.isFinite(u)&&u>0,"invalid spring threshold"),this.#p=e,this.#f=t,this.#g=h,this.#e=typeof o?.requestAnimationFrame=="function"?o:null,this.#d=n.respectReducedMotion===!1?void 0:this.#e?.matchMedia?.(C),this.#S=r,this.#y=a,this.#u=u,this.#v=g=>this.#R(g),this.#r=()=>this.#w(),this.#t=s,this.#i=c,this.#s=i,this.#o=0,this.#n="idle",this.#a=w(),this.#h=void 0,this.#b();}get value(){return this.#t;}get velocity(){return this.#i;}get playState(){return this.#n;}get finished(){return this.#a.promise;}retarget(e){if(d(Number.isFinite(e),"invalid spring value"),this.#n==="running"&&this.#e!==null){this.#c(this.#e.performance.now()),this.#s=e,this.#l();return;}this.#s=e,this.#a=w(),this.#b();}cancel(){this.#n==="running"&&(this.#e!==null&&this.#c(this.#e.performance.now()),this.#E(),this.#l(),this.#n="idle",this.#a.reject(new DOMException("Spring motion cancelled","AbortError")));}#b(){const e=this.#e;if(this.#n="running",e===null||this.#M(e)){this.#m();return;}this.#o=e.performance.now(),this.#d?.addEventListener("change",this.#r),e.document.addEventListener("visibilitychange",this.#r),this.#l(),this.#h=P(e,this.#v);}#M(e){return e.document.hidden||this.#d?.matches===!0;}#c(e){const t=Math.max(this.#o,e);[this.#t,this.#i]=D(this.#t,this.#i,this.#s,this.#S,this.#y,(t-this.#o)/1e3),this.#o=t;}#R(e){this.#c(e),Math.abs(this.#t-this.#s)<this.#u&&Math.abs(this.#i)<this.#u*O?this.#m():this.#l();}#w(){this.#e!==null&&this.#M(this.#e)&&this.#m();}#m(){this.#E(),this.#n="finished",this.#t=this.#s,this.#i=0,this.#l(),this.#a.resolve(this);}#E(){this.#h?.(),this.#h=void 0,this.#d?.removeEventListener("change",this.#r),this.#e?.document.removeEventListener("visibilitychange",this.#r);}#l(){E||this.#p.style.setProperty(this.#f,`${this.#t}${this.#g}`);}}function A(l,e,t,s,i={}){const n=new H(l,e,t,s,i);return x()!==null&&L(()=>n.cancel()),n;}export{A as applySpringMotion};
@@ -1 +1 @@
1
- import{createComputed as $,createSignal as F,onCleanup as L,onMount as I,untrack as d,useTransition as J}from"solid-js";import{isServer as X}from"solid-js/web";import{assertDebug as m,checkState as B,consumeProps as P}from"../util";import{applyMotion as O}from"./motion";import"./transition.css";const b=0,p=1,A=2,D=3,K=4,g=5;function v(e){L(()=>{e.lifetime.abort();for(const n of e.cancellations)n();e.cancellations.clear();for(const n of e.pending)C(n);e.pending.length=0})}function C(e){e.entering!==void 0&&s(e.entering,e.enterClass,e.enterStartClass,e.enterMotionClass),e.exiting!==void 0&&s(e.exiting,e.exitClass,e.exitStartClass,e.exitMotionClass)}function y(e,n,t=!1){const i=e.context.lifetime.signal,r=t?i:e.cancellation.signal;return new Promise((o,a)=>{const f=()=>{i.removeEventListener("abort",u),r.removeEventListener("abort",u)},u=()=>{f(),a(i.reason??r.reason)};if(i.aborted||r.aborted){Promise.resolve(n).catch(()=>{}),a(i.reason??r.reason);return}i.addEventListener("abort",u,{once:!0}),r.addEventListener("abort",u,{once:!0}),Promise.resolve(n).then(o,a).finally(f)})}function k(e){return e.flat().filter(n=>(n??"")!=="")}function c(e,...n){e.classList.add(...k(n))}function s(e,...n){e.classList.remove(...k(n))}function w(e,n){const t=e.ownerDocument.defaultView;return t===null||typeof t.requestAnimationFrame!="function"?Promise.resolve():y(n,new Promise(i=>{let r=t.requestAnimationFrame(()=>{r=t.requestAnimationFrame(()=>{n.context.cancellations.delete(o),i()})});const o=()=>t.cancelAnimationFrame(r);n.context.cancellations.add(o)}))}function M(e){const t=e.effect?.target?.ownerDocument;return!e.pending&&t!==void 0&&e.timeline===t.timeline&&e.playState==="running"&&e.effect!==null&&Number.isFinite(e.playbackRate)&&e.playbackRate!==0&&Number.isFinite(e.effect.getComputedTiming().endTime)}function E(e){return typeof e.getAnimations!="function"?Promise.resolve():Promise.allSettled(e.getAnimations({subtree:!0}).map(n=>M(n)?n.finished:n.pending||n.playState==="pending"?n.ready.then(t=>M(t)?t.finished:t):void 0).filter(n=>n!==void 0))}function q(e){return[e.exiting,e.entering]}function S(e,n,t,i=!1){if(t===void 0)return;let r=t.keyframes;if(typeof r=="function")try{r=r(q(e))}catch(o){console.warn("failed to compute keyframes of inline motion",o);return}e.context.lifetime.signal.throwIfAborted(),e.cancellation.signal.throwIfAborted();try{if(r.length!==0){const o=O(n,r,i&&t.fill===void 0?{...t,fill:"forwards"}:t),a=()=>{e.context.cancellations.delete(a),o.cancel()};return e.context.cancellations.add(a),i||o.finished.then(()=>e.context.cancellations.delete(a),()=>e.context.cancellations.delete(a)),a}}catch(o){console.warn("failed to apply inline motion",o)}}async function l(e,n){e.context.lifetime.signal.throwIfAborted(),n!==g&&e.cancellation.signal.throwIfAborted();const t=e.context.props.onStateChange;if(t!==void 0){const i=t(q(e),n);i!==null&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function"&&await y(e,i,n===g)}e.context.lifetime.signal.throwIfAborted(),n!==g&&e.cancellation.signal.throwIfAborted()}async function x(e){const n=e.entering;if(n!==void 0){if(c(n,e.enterClass,e.enterStartClass),e.order==="enter-exit")e.context.setRenderedElement(e.exiting===void 0?n:[e.exiting,n]);else if(e.order!=="exit-enter"){const t=e.context.renderedElement();Array.isArray(t)?m(t.length===2&&t[0]===e.exiting&&t[1]===n):t!==n&&(m(t===e.exiting),e.context.setRenderedElement(t===void 0?n:[t,n]))}await Promise.resolve(),await l(e,p),S(e,n,e.enterMotion),await w(n,e),s(n,e.enterStartClass),c(n,e.enterMotionClass),await y(e,E(n)),s(n,e.enterMotionClass),await l(e,A),s(n,e.enterClass)}}async function T(e){const n=e.exiting;if(n===void 0)return;c(n,e.exitClass,e.exitStartClass),await l(e,D);const t=S(e,n,e.exitMotion,!0);await w(n,e),s(n,e.exitStartClass),c(n,e.exitMotionClass),await y(e,E(n)),s(n,e.exitMotionClass),await l(e,K),s(n,e.exitClass),m(()=>{const i=e.context.renderedElement();return e.order==="exit-enter"?i===n:e.order==="enter-exit"?Array.isArray(i)&&i.length===2&&i[0]===n&&i[1]===e.entering:i===n||Array.isArray(i)&&i.length===2&&i[0]===n&&i[1]===e.entering}),e.context.setRenderedElement(e.entering),t?.()}function R(e,n){const t=n.name??"cw-transition";e.enterClass=n.enterClass??`${t}-enter`,e.enterMotion=n.enterMotion,e.enterMotionClass=n.enterMotionClass??`${t}-enterMotion`,e.enterStartClass=n.enterStartClass??`${t}-enterStart`,e.exitClass=n.exitClass??`${t}-exit`,e.exitMotion=n.exitMotion,e.exitMotionClass=n.exitMotionClass??`${t}-exitMotion`,e.exitStartClass=n.exitStartClass??`${t}-exitStart`,e.order=e.entering===void 0?"exit-enter":e.exiting===void 0?"enter-exit":n.order}async function N(e){const n=e.pending;for(;n.length>0;){const t=n[0];m(t.entering!==t.exiting&&t.context===e),R(t,e.props);try{try{switch(await l(t,b),t.order??"parallel"){case"enter-exit":await x(t),await T(t);break;case"exit-enter":await T(t),await x(t);break;default:{const i=[x(t),T(t)];try{await Promise.all(i)}catch(r){throw t.cancellation.abort(r),await Promise.allSettled(i),r}break}}}finally{await l(t,g)}}catch(i){for(const r of e.cancellations)r();if(e.cancellations.clear(),C(t),e.lifetime.signal.aborted)return;console.warn("failed to apply transition sequence",i),e.setRenderedElement(t.entering),t.entering!==void 0&&s(t.entering,t.enterClass,t.enterMotionClass,t.enterStartClass)}B(n.shift()===t,"pending transition queue corrupt"),m(()=>e.renderedElement()===t.entering)}}function h(e){if(e!==void 0&&(typeof e!="object"||e===null||e.nodeType!==1))throw new TypeError(`not a transition element: ${e}`)}function j(e,n){const[t]=J();if(d(t))return t(),n;const i=e.nextElement();if(h(i),i===n)return i;for(let a=0;a<e.pending.length;a++)if(e.pending[a].entering===i)return e.pending.splice(a+1),i;const r=e.pending.length===0?d(e.renderedElement):e.pending[e.pending.length-1].entering,o={cancellation:new AbortController,context:e,entering:i,exiting:Array.isArray(r)?r[1]:r};return o.exiting!==o.entering&&e.pending.push(o)===1&&d(()=>N(e)),i}function z(e,n){if(h(e),e===void 0)return;const t={lifetime:new AbortController,cancellations:new Set,nextElement:()=>{},pending:[],renderedElement:()=>{},setRenderedElement:(a=>{}),props:n};v(t);const i={cancellation:new AbortController,context:t,entering:e,exiting:void 0};d(()=>R(i,n)),t.pending.push(i);let r=d(()=>l(i,b));r===void 0?c(e,i.enterClass,i.enterStartClass):r=r.then(()=>{t.lifetime.signal.throwIfAborted(),c(e,i.enterClass,i.enterStartClass)}),r?.catch(()=>{});const o=async()=>{await l(i,p),S(i,i.entering,i.enterMotion),await w(e,i),s(e,i.enterStartClass),c(e,i.enterMotionClass),await y(i,E(e)),s(e,i.enterMotionClass),await l(i,A),s(e,i.enterClass),await l(i,g)};return I(()=>d(()=>{(r!==void 0?r.then(o):o()).catch(f=>{for(const u of t.cancellations)u();t.cancellations.clear(),C(i),!t.lifetime.signal.aborted&&(console.warn("appear transition failed",f),s(e,i.enterClass,i.enterMotionClass,i.enterStartClass))})})),e}const Q=X?e=>{const{children:n}=P(e,[],["children"]);return n}:e=>{const{appear:n,children:t}=P(e,[],["appear","children"]);if(typeof t!="function")return n?z(t,e):t;const i=n?void 0:d(t);h(i);const[r,o]=F(i,{equals:!1}),a={lifetime:new AbortController,cancellations:new Set,nextElement:t,pending:[],props:e,renderedElement:r,setRenderedElement:o};return v(a),$(f=>j(a,f),i),a.renderedElement};export{p as EnterSequenceBegin,A as EnterSequenceEnd,D as ExitSequenceBegin,K as ExitSequenceEnd,Q as Transition,b as TransitionBegin,g as TransitionEnd};
1
+ import{createComputed as $,createSignal as F,onCleanup as L,onMount as I,untrack as d,useTransition as J}from"solid-js";import{isServer as X}from"solid-js/web";import{assertDebug as m,checkState as B,consumeProps as P}from"../util";import{applyMotion as O}from"./motion";import"./transition.css";const b=0,p=1,A=2,D=3,K=4,g=5;function v(e){L(()=>{e.lifetime.abort();for(const n of e.cancellations)n();e.cancellations.clear();for(const n of e.pending)C(n);e.pending.length=0;});}function C(e){e.entering!==void 0&&s(e.entering,e.enterClass,e.enterStartClass,e.enterMotionClass),e.exiting!==void 0&&s(e.exiting,e.exitClass,e.exitStartClass,e.exitMotionClass);}function y(e,n,t=!1){const i=e.context.lifetime.signal,r=t?i:e.cancellation.signal;return new Promise((o,a)=>{const f=()=>{i.removeEventListener("abort",u),r.removeEventListener("abort",u);},u=()=>{f(),a(i.reason??r.reason);};if(i.aborted||r.aborted){Promise.resolve(n).catch(()=>{}),a(i.reason??r.reason);return;}i.addEventListener("abort",u,{once:!0}),r.addEventListener("abort",u,{once:!0}),Promise.resolve(n).then(o,a).finally(f);});}function k(e){return e.flat().filter(n=>(n??"")!=="");}function c(e,...n){e.classList.add(...k(n));}function s(e,...n){e.classList.remove(...k(n));}function w(e,n){const t=e.ownerDocument.defaultView;return t===null||typeof t.requestAnimationFrame!="function"?Promise.resolve():y(n,new Promise(i=>{let r=t.requestAnimationFrame(()=>{r=t.requestAnimationFrame(()=>{n.context.cancellations.delete(o),i();});});const o=()=>t.cancelAnimationFrame(r);n.context.cancellations.add(o);}));}function M(e){const t=e.effect?.target?.ownerDocument;return!e.pending&&t!==void 0&&e.timeline===t.timeline&&e.playState==="running"&&e.effect!==null&&Number.isFinite(e.playbackRate)&&e.playbackRate!==0&&Number.isFinite(e.effect.getComputedTiming().endTime);}function E(e){return typeof e.getAnimations!="function"?Promise.resolve():Promise.allSettled(e.getAnimations({subtree:!0}).map(n=>M(n)?n.finished:(n.pending||n.playState==="pending"?n.ready.then(t=>M(t)?t.finished:t):void 0)).filter(n=>n!==void 0));}function q(e){return[e.exiting,e.entering];}function S(e,n,t,i=!1){if(t===void 0)return;let r=t.keyframes;if(typeof r=="function")try{r=r(q(e));}catch(o){console.warn("failed to compute keyframes of inline motion",o);return;}e.context.lifetime.signal.throwIfAborted(),e.cancellation.signal.throwIfAborted();try{if(r.length!==0){const o=O(n,r,i&&t.fill===void 0?{...t,fill:"forwards"}:t),a=()=>{e.context.cancellations.delete(a),o.cancel();};return e.context.cancellations.add(a),i||o.finished.then(()=>e.context.cancellations.delete(a),()=>e.context.cancellations.delete(a)),a;}}catch(o){console.warn("failed to apply inline motion",o);}}async function l(e,n){e.context.lifetime.signal.throwIfAborted(),n!==g&&e.cancellation.signal.throwIfAborted();const t=e.context.props.onStateChange;if(t!==void 0){const i=t(q(e),n);i!==null&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function"&&(await y(e,i,n===g));}e.context.lifetime.signal.throwIfAborted(),n!==g&&e.cancellation.signal.throwIfAborted();}async function x(e){const n=e.entering;if(n!==void 0){if(c(n,e.enterClass,e.enterStartClass),e.order==="enter-exit")e.context.setRenderedElement(e.exiting===void 0?n:[e.exiting,n]);else if(e.order!=="exit-enter"){const t=e.context.renderedElement();Array.isArray(t)?m(t.length===2&&t[0]===e.exiting&&t[1]===n):t!==n&&(m(t===e.exiting),e.context.setRenderedElement(t===void 0?n:[t,n]));}await Promise.resolve(),await l(e,p),S(e,n,e.enterMotion),await w(n,e),s(n,e.enterStartClass),c(n,e.enterMotionClass),await y(e,E(n)),s(n,e.enterMotionClass),await l(e,A),s(n,e.enterClass);}}async function T(e){const n=e.exiting;if(n===void 0)return;c(n,e.exitClass,e.exitStartClass),await l(e,D);const t=S(e,n,e.exitMotion,!0);await w(n,e),s(n,e.exitStartClass),c(n,e.exitMotionClass),await y(e,E(n)),s(n,e.exitMotionClass),await l(e,K),s(n,e.exitClass),m(()=>{const i=e.context.renderedElement();return e.order==="exit-enter"?i===n:e.order==="enter-exit"?Array.isArray(i)&&i.length===2&&i[0]===n&&i[1]===e.entering:i===n||Array.isArray(i)&&i.length===2&&i[0]===n&&i[1]===e.entering;}),e.context.setRenderedElement(e.entering),t?.();}function R(e,n){const t=n.name??"cw-transition";e.enterClass=n.enterClass??`${t}-enter`,e.enterMotion=n.enterMotion,e.enterMotionClass=n.enterMotionClass??`${t}-enterMotion`,e.enterStartClass=n.enterStartClass??`${t}-enterStart`,e.exitClass=n.exitClass??`${t}-exit`,e.exitMotion=n.exitMotion,e.exitMotionClass=n.exitMotionClass??`${t}-exitMotion`,e.exitStartClass=n.exitStartClass??`${t}-exitStart`,e.order=e.entering===void 0?"exit-enter":e.exiting===void 0?"enter-exit":n.order;}async function N(e){const n=e.pending;for(;n.length>0;){const t=n[0];m(t.entering!==t.exiting&&t.context===e),R(t,e.props);try{try{switch(await l(t,b),t.order??"parallel"){case"enter-exit":await x(t),await T(t);break;case"exit-enter":await T(t),await x(t);break;default:{const i=[x(t),T(t)];try{await Promise.all(i);}catch(r){throw t.cancellation.abort(r),await Promise.allSettled(i),r;}break;}}}finally{await l(t,g);}}catch(i){for(const r of e.cancellations)r();if(e.cancellations.clear(),C(t),e.lifetime.signal.aborted)return;console.warn("failed to apply transition sequence",i),e.setRenderedElement(t.entering),t.entering!==void 0&&s(t.entering,t.enterClass,t.enterMotionClass,t.enterStartClass);}B(n.shift()===t,"pending transition queue corrupt"),m(()=>e.renderedElement()===t.entering);}}function h(e){if(e!==void 0&&(typeof e!="object"||e===null||e.nodeType!==1))throw new TypeError(`not a transition element: ${e}`);}function j(e,n){const[t]=J();if(d(t))return t(),n;const i=e.nextElement();if(h(i),i===n)return i;for(let a=0;a<e.pending.length;a++)if(e.pending[a].entering===i)return e.pending.splice(a+1),i;const r=e.pending.length===0?d(e.renderedElement):e.pending[e.pending.length-1].entering,o={cancellation:new AbortController(),context:e,entering:i,exiting:Array.isArray(r)?r[1]:r};return o.exiting!==o.entering&&e.pending.push(o)===1&&d(()=>N(e)),i;}function z(e,n){if(h(e),e===void 0)return;const t={lifetime:new AbortController(),cancellations:/* @__PURE__ */new Set(),nextElement:()=>{},pending:[],renderedElement:()=>{},setRenderedElement:a=>{},props:n};v(t);const i={cancellation:new AbortController(),context:t,entering:e,exiting:void 0};d(()=>R(i,n)),t.pending.push(i);let r=d(()=>l(i,b));r===void 0?c(e,i.enterClass,i.enterStartClass):r=r.then(()=>{t.lifetime.signal.throwIfAborted(),c(e,i.enterClass,i.enterStartClass);}),r?.catch(()=>{});const o=async()=>{await l(i,p),S(i,i.entering,i.enterMotion),await w(e,i),s(e,i.enterStartClass),c(e,i.enterMotionClass),await y(i,E(e)),s(e,i.enterMotionClass),await l(i,A),s(e,i.enterClass),await l(i,g);};return I(()=>d(()=>{(r!==void 0?r.then(o):o()).catch(f=>{for(const u of t.cancellations)u();t.cancellations.clear(),C(i),!t.lifetime.signal.aborted&&(console.warn("appear transition failed",f),s(e,i.enterClass,i.enterMotionClass,i.enterStartClass));});})),e;}const Q=X?e=>{const{children:n}=P(e,[],["children"]);return n;}:e=>{const{appear:n,children:t}=P(e,[],["appear","children"]);if(typeof t!="function")return n?z(t,e):t;const i=n?void 0:d(t);h(i);const[r,o]=F(i,{equals:!1}),a={lifetime:new AbortController(),cancellations:/* @__PURE__ */new Set(),nextElement:t,pending:[],props:e,renderedElement:r,setRenderedElement:o};return v(a),$(f=>j(a,f),i),a.renderedElement;};export{p as EnterSequenceBegin,A as EnterSequenceEnd,D as ExitSequenceBegin,K as ExitSequenceEnd,Q as Transition,b as TransitionBegin,g as TransitionEnd};
@@ -1 +1 @@
1
- import{checkArgument as L}from"../util";const m=20,D=100,G=40,q=.01,H=3,j=.5;function A(a){return new Float64Array(a)}const w=A(m),g=A(m),N=A(m),u=A(11),d=A(16),M=A(4),b=A(16),i=A(4),P=A(4*m);function T(a,e){let r=1;for(let t=0;t<7;t++)u[t]+=r,t<4&&(u[7+t]+=r*e),r*=a}function _(a){for(let e=0;e<a;e++){for(let t=0;t<e;t++){let c=u[e+t];for(let l=0;l<t;l++)c-=d[e*4+l]*d[t*4+l]*M[l];d[e*4+t]=c/M[t]}let r=u[2*e];for(let t=0;t<e;t++)r-=d[e*4+t]*d[e*4+t]*M[t];if(!(r>0))return e;M[e]=r}return a}function R(a){b[0]=0,b[1]=1,b[2]=-d[9],b[3]=-d[13]-d[14]*b[2];for(let e=1;e<=a;e++){let r=0;for(let t=e;t>=0;t--){let c=b[t]/M[t];for(let l=t+1;l<=e;l++)c-=d[l*4+t]*b[e*4+l];b[e*4+t]=c,r+=c*u[7+t]}i[e]=r}}function W(a,e){if(i[0]=NaN,e<4)return;u.fill(0);let r=0;for(let o=0;o<e;o++)T(w[o],a[o]),r+=a[o]**2;if(_(3)<3)return;const t=u[8]-d[4]*u[7],c=(u[9]-d[8]*u[7]-d[9]*t)/M[2],l=t/M[1]-d[9]*c,F=u[7]/M[0]-d[4]*l-d[8]*c;i[0]=(r-(F*u[7]+l*u[8]+c*u[9]))/(e-3)}function k(a,e,r,t){return(a-r)*(a-t)/((e-r)*(e-t))}function z(a,e){const r=w,t=(a[0]-a[1])/(r[0]-r[1]);if(i[0]=t,e<=3)return;if(u.fill(0),e===4){for(let n=0;n<4;n++)T(r[n],a[n]);_(3)===3&&(R(2),i[0]=(t+i[2])/2);return}let c=0,l=0;for(let n=1;n+2<e;n++){const s=r[n],f=r[n-1],S=r[n+1],I=r[n+2],v=k(s,f,S,I),p=k(s,S,f,I),C=k(s,I,f,S),x=(a[n]-v*a[n-1]-p*a[n+1]-C*a[n+2])**2/(1+v**2+p**2+C**2);x<1/0&&(c+=x,l++)}const F=Math.max(q**2,c/l||0),o=H*F;let E=0,y=1/0;T(r[0],a[0]),T(r[1],a[1]);for(let n=3;n<=e;n++){T(r[n-1],a[n-1]);const s=_(Math.min(n,4))-1;if(!(s<2)){R(s);for(let f=s-1;f>0;f--){let S=0;for(let v=f+1;v<=s;v++)S=Math.max(S,(i[f]-i[v])**2-o*(b[v*4+1]-b[f*4+1]));const I=S+F*b[f*4+1];P[E++]=I,P[E++]=i[f],y=Math.min(y,I)}}}let O=0,h=0;for(let n=0;n<E;n+=2){const s=Math.exp((y-P[n])/(j*y));O+=s,h+=s*P[n+1]}E!==0&&(i[0]=h/O)}class X{#r;#t;#e;constructor(){this.#r=A(2*m),this.#t=0,this.#e=0}addDataPoint(e,r){L(Number.isFinite(e)&&Number.isFinite(r),"invalid data point");const t=this.#t;this.#r[t]=e,this.#r[t+m]=r,this.#t=t===m-1?0:t+1,this.#e<m&&this.#e++}calculateVelocity(e){L(e===void 0||e>0,"invalid maximum velocity"),this.#n();const r=i[0],t=Number.isFinite(r)?r:0;return e===void 0?t:Math.max(-e,Math.min(t,e))}resetTracking(){this.#t=0,this.#e=0}#n(){const e=this.#r,r=this.#t===0?m-1:this.#t-1,t=e[r],c=e[r+m];let l=t,F=0,o=0,E=!1;for(let h=r,n=0;n<this.#e;n++){const s=e[h],f=s-t,S=e[h+m]-c;if(t-s>D||Math.abs(s-l)>G)break;o!==0&&f===w[o-1]?(N[o-1]=S,E=!0):(w[o]=f,g[o]=S,N[o++]=S),F=Math.max(F,Math.abs(f)),l=s,h=h===0?m-1:h-1}if(i[0]=0,F===0)return;const y=2**-Math.ceil(Math.log2(F));let O=g;for(let h=0;h<o;h++)w[h]*=y;if(E){W(g,o);const h=i[0];W(N,o),i[0]<h&&(O=N)}z(O,o),i[0]=1e3*y*i[0]}}export{X as VelocityTracker};
1
+ import{checkArgument as L}from"../util";const m=20,D=100,G=40,q=0.01,H=3,j=0.5;function A(a){return new Float64Array(a);}const w=A(m),g=A(m),N=A(m),u=A(11),d=A(16),M=A(4),b=A(16),i=A(4),P=A(4*m);function T(a,e){let r=1;for(let t=0;t<7;t++)u[t]+=r,t<4&&(u[7+t]+=r*e),r*=a;}function _(a){for(let e=0;e<a;e++){for(let t=0;t<e;t++){let c=u[e+t];for(let l=0;l<t;l++)c-=d[e*4+l]*d[t*4+l]*M[l];d[e*4+t]=c/M[t];}let r=u[2*e];for(let t=0;t<e;t++)r-=d[e*4+t]*d[e*4+t]*M[t];if(!(r>0))return e;M[e]=r;}return a;}function R(a){b[0]=0,b[1]=1,b[2]=-d[9],b[3]=-d[13]-d[14]*b[2];for(let e=1;e<=a;e++){let r=0;for(let t=e;t>=0;t--){let c=b[t]/M[t];for(let l=t+1;l<=e;l++)c-=d[l*4+t]*b[e*4+l];b[e*4+t]=c,r+=c*u[7+t];}i[e]=r;}}function W(a,e){if(i[0]=NaN,e<4)return;u.fill(0);let r=0;for(let o=0;o<e;o++)T(w[o],a[o]),r+=a[o]**2;if(_(3)<3)return;const t=u[8]-d[4]*u[7],c=(u[9]-d[8]*u[7]-d[9]*t)/M[2],l=t/M[1]-d[9]*c,F=u[7]/M[0]-d[4]*l-d[8]*c;i[0]=(r-(F*u[7]+l*u[8]+c*u[9]))/(e-3);}function k(a,e,r,t){return(a-r)*(a-t)/((e-r)*(e-t));}function z(a,e){const r=w,t=(a[0]-a[1])/(r[0]-r[1]);if(i[0]=t,e<=3)return;if(u.fill(0),e===4){for(let n=0;n<4;n++)T(r[n],a[n]);_(3)===3&&(R(2),i[0]=(t+i[2])/2);return;}let c=0,l=0;for(let n=1;n+2<e;n++){const s=r[n],f=r[n-1],S=r[n+1],I=r[n+2],v=k(s,f,S,I),p=k(s,S,f,I),C=k(s,I,f,S),x=(a[n]-v*a[n-1]-p*a[n+1]-C*a[n+2])**2/(1+v**2+p**2+C**2);x<1/0&&(c+=x,l++);}const F=Math.max(q**2,c/l||0),o=H*F;let E=0,y=1/0;T(r[0],a[0]),T(r[1],a[1]);for(let n=3;n<=e;n++){T(r[n-1],a[n-1]);const s=_(Math.min(n,4))-1;if(!(s<2)){R(s);for(let f=s-1;f>0;f--){let S=0;for(let v=f+1;v<=s;v++)S=Math.max(S,(i[f]-i[v])**2-o*(b[v*4+1]-b[f*4+1]));const I=S+F*b[f*4+1];P[E++]=I,P[E++]=i[f],y=Math.min(y,I);}}}let O=0,h=0;for(let n=0;n<E;n+=2){const s=Math.exp((y-P[n])/(j*y));O+=s,h+=s*P[n+1];}E!==0&&(i[0]=h/O);}class X{#r;#t;#e;constructor(){this.#r=A(2*m),this.#t=0,this.#e=0;}addDataPoint(e,r){L(Number.isFinite(e)&&Number.isFinite(r),"invalid data point");const t=this.#t;this.#r[t]=e,this.#r[t+m]=r,this.#t=t===m-1?0:t+1,this.#e<m&&this.#e++;}calculateVelocity(e){L(e===void 0||e>0,"invalid maximum velocity"),this.#n();const r=i[0],t=Number.isFinite(r)?r:0;return e===void 0?t:Math.max(-e,Math.min(t,e));}resetTracking(){this.#t=0,this.#e=0;}#n(){const e=this.#r,r=this.#t===0?m-1:this.#t-1,t=e[r],c=e[r+m];let l=t,F=0,o=0,E=!1;for(let h=r,n=0;n<this.#e;n++){const s=e[h],f=s-t,S=e[h+m]-c;if(t-s>D||Math.abs(s-l)>G)break;o!==0&&f===w[o-1]?(N[o-1]=S,E=!0):(w[o]=f,g[o]=S,N[o++]=S),F=Math.max(F,Math.abs(f)),l=s,h=h===0?m-1:h-1;}if(i[0]=0,F===0)return;const y=2**-Math.ceil(Math.log2(F));let O=g;for(let h=0;h<o;h++)w[h]*=y;if(E){W(g,o);const h=i[0];W(N,o),i[0]<h&&(O=N);}z(O,o),i[0]=1e3*y*i[0];}}export{X as VelocityTracker};
@@ -1,4 +1,4 @@
1
- import{children as C,createComponent as O,createContext as M,createSignal as L,onCleanup as V,untrack as I,useContext as f}from"solid-js";import{insert as c}from"solid-js/web";import{defineDomComponent as T}from"..";import{IconButton as R}from"../action/icon-button";import{DomController as g}from"../dom/client";import{Menu as W,MenuItem as G}from"../surface/menu";import{isElementNode as b,mutationObserverOf as Y,resolveNavigationSlots as y}from"./base";import{BarScrollState as D,resizeObserverOf as E}from"./scroll";import"./navigation.css";const v=new Set(["medium","large","medium-flexible","large-flexible"]),U=["title","subtitle","navigationIcon","actions","avatar"],$=["actions","floatingActionButton"],j={role:"effect",speed:"default"},Z={role:"spatial",speed:"fast"},_=.5,H="More options",P=48,w=M(),A=M();function N(o){if(!(o===void 0||!Number.isFinite(o)))return Math.min(1,Math.max(0,o))}function z(o){return typeof o!="number"?o:Number.isFinite(o)&&o>=0?`${o}px`:void 0}function q(o){return typeof o=="function"?o():o}function J(o){return o.borderBoxSize[0]?.blockSize??o.contentRect.height}function x(o,e){e?o.setAttribute("aria-hidden","true"):o.removeAttribute("aria-hidden")}function K(o,e,t){const n=t.variant??o,r=v.has(n),s=t.collapsed===!0?1:N(t.scrollProgress)??0,a=s<_,m=f(w);let h;const d=()=>r?h??=m?.():void 0;return<div{...e}classList={{...e.classList,"cw-TopAppBar":!0,[`_cw-TopAppBar-${n}`]:!0,"_cw-TopAppBar-twoRows":r}}data-cw-app-bar-scrolled={t.scrolled===!0?"true":void 0}data-cw-top-app-bar-variant={n}data-cw-title-alignment={t.titleAlignment??(n==="center"?"center":"start")}style={{...e.style,"--cw-TopAppBar-expanded-height":z(t.expandedHeight),"--cw-TopAppBar-scroll-progress":s}}>
1
+ import{children as C,createComponent as O,createContext as M,createSignal as L,onCleanup as V,untrack as I,useContext as f}from"solid-js";import{insert as c}from"solid-js/web";import{defineDomComponent as T}from"..";import{IconButton as R}from"../action/icon-button";import{DomController as g}from"../dom/client";import{Menu as W,MenuItem as G}from"../surface/menu";import{isElementNode as b,mutationObserverOf as Y,resolveNavigationSlots as y}from"./base";import{BarScrollState as D,resizeObserverOf as E}from"./scroll";import"./navigation.css";const v=/* @__PURE__ */new Set(["medium","large","medium-flexible","large-flexible"]),U=["title","subtitle","navigationIcon","actions","avatar"],$=["actions","floatingActionButton"],j={role:"effect",speed:"default"},Z={role:"spatial",speed:"fast"},_=0.5,H="More options",P=48,w=M(),A=M();function N(o){if(!(o===void 0||!Number.isFinite(o)))return Math.min(1,Math.max(0,o));}function z(o){return typeof o!="number"?o:Number.isFinite(o)&&o>=0?`${o}px`:void 0;}function q(o){return typeof o=="function"?o():o;}function J(o){return o.borderBoxSize[0]?.blockSize??o.contentRect.height;}function x(o,e){e?o.setAttribute("aria-hidden","true"):o.removeAttribute("aria-hidden");}function K(o,e,t){const n=t.variant??o,r=v.has(n),s=t.collapsed===!0?1:N(t.scrollProgress)??0,a=s<_,m=f(w);let h;const d=()=>r?h??=m?.():void 0;return<div{...e}classList={{...e.classList,"cw-TopAppBar":!0,[`_cw-TopAppBar-${n}`]:!0,"_cw-TopAppBar-twoRows":r}}data-cw-app-bar-scrolled={t.scrolled===!0?"true":void 0}data-cw-top-app-bar-variant={n}data-cw-title-alignment={t.titleAlignment??(n==="center"?"center":"start")}style={{...e.style,"--cw-TopAppBar-expanded-height":z(t.expandedHeight),"--cw-TopAppBar-scroll-progress":s}}>
2
2
  <div class="cw-TopAppBar-row">
3
3
  <span class="cw-TopAppBar-navigation">{t.navigationIcon}</span>
4
4
  <span aria-hidden={r&&a?"true":void 0}class="cw-TopAppBar-titleGroup">
@@ -16,7 +16,7 @@ import{children as C,createComponent as O,createContext as M,createSignal as L,o
16
16
  <span class="cw-TopAppBar-subtitle">{d()?.subtitle()}</span>
17
17
  </span>
18
18
  </div>
19
- </div>}class Q extends g{#n;#t;#e;#o;#l;#a;#i;#s;#r;#c;#p;#u;#m;constructor(e,t="small"){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#t=f(w),this.#e=t,this.#o=null,this.#l=null,this.#a=null,this.#i=null,this.#s=null,this.#r=null,this.#c=null,this.#p=void 0,this.#u=!1,this.#m=!1}#d(){return v.has(this.#e)}#h(){const e=this.#p??(!this.#d()&&this.#u);super.setAttribute("data-cw-app-bar-scrolled",e?"true":void 0)}#f(e){const t=this.#d(),n=e<_;this.#a!==null&&x(this.#a,t&&n),this.#i!==null&&x(this.#i,t&&!n)}#A(){const e=this.#d()?this.#s:this.#l;if(e===this.#c||(this.#r?.disconnect(),this.#r=null,this.#c=e,e===null))return;const t=E(e);t!==void 0&&(this.#r=new t(n=>{for(const r of n)this.#B(J(r))}),this.#r.observe(e))}#B(e){this.#o?.setRange(e),super.setStyle("--cw-TopAppBar-collapse-range",`${e}px`)}applyComponentProps(){const e=super.readProps(["collapsed","expandedHeight","scrollBehavior","scrollProgress","scrollTarget","scrolled","titleAlignment","variant"]),t=this.#o,n=N(e.scrollProgress);if(e.variantChanged&&(this.#e=e.variant??this.#n,super.setClass("variant",`_cw-TopAppBar-${this.#e}`),super.setClass("_cw-TopAppBar-twoRows",this.#d()),super.setAttribute("data-cw-top-app-bar-variant",this.#e),this.#A()),(e.variantChanged||e.titleAlignmentChanged)&&super.setAttribute("data-cw-title-alignment",e.titleAlignment??(this.#e==="center"?"center":"start")),e.expandedHeightChanged&&super.setStyle("--cw-TopAppBar-expanded-height",z(e.expandedHeight)),(e.variantChanged||e.scrolledChanged)&&(this.#p=e.scrolled,this.#h()),t!==null){const r=e.scrollProgressChanged||e.collapsedChanged||e.scrollBehaviorChanged||e.scrollTargetChanged;e.collapsed===void 0&&n===void 0?r&&t.bind(e.scrollBehavior,e.scrollTarget):(r&&t.bind(void 0,void 0),e.collapsed!==!0&&n!==void 0?t.setFraction(n):this.#m?r&&t.animateFraction(e.collapsed===!0?1:0):t.setFraction(e.collapsed===!0?1:0)),e.variantChanged&&this.#f(t.fraction)}this.#m=!0}onStyleElementChanged(e){super.onStyleElementChanged(e),!(!b(e)||this.#o!==null)&&(this.#o=new D(e,{property:"--cw-TopAppBar-scroll-progress",spring:j,onOverlapChange:t=>{this.#u=t,this.#h()},onFractionChange:t=>this.#f(t)}))}onControllerCleanup(){this.#o?.dispose(),this.#r?.disconnect(),this.#r=null,super.onControllerCleanup()}render(e){let t,n,r,s,a,m,h,d,l,i,p;const B=<div class="cw-TopAppBar">
19
+ </div>;}class Q extends g{#n;#t;#e;#o;#l;#a;#i;#s;#r;#c;#p;#u;#m;constructor(e,t="small"){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#t=f(w),this.#e=t,this.#o=null,this.#l=null,this.#a=null,this.#i=null,this.#s=null,this.#r=null,this.#c=null,this.#p=void 0,this.#u=!1,this.#m=!1;}#d(){return v.has(this.#e);}#h(){const e=this.#p??(!this.#d()&&this.#u);super.setAttribute("data-cw-app-bar-scrolled",e?"true":void 0);}#f(e){const t=this.#d(),n=e<_;this.#a!==null&&x(this.#a,t&&n),this.#i!==null&&x(this.#i,t&&!n);}#A(){const e=this.#d()?this.#s:this.#l;if(e===this.#c||(this.#r?.disconnect(),this.#r=null,this.#c=e,e===null))return;const t=E(e);t!==void 0&&(this.#r=new t(n=>{for(const r of n)this.#B(J(r));}),this.#r.observe(e));}#B(e){this.#o?.setRange(e),super.setStyle("--cw-TopAppBar-collapse-range",`${e}px`);}applyComponentProps(){const e=super.readProps(["collapsed","expandedHeight","scrollBehavior","scrollProgress","scrollTarget","scrolled","titleAlignment","variant"]),t=this.#o,n=N(e.scrollProgress);if(e.variantChanged&&(this.#e=e.variant??this.#n,super.setClass("variant",`_cw-TopAppBar-${this.#e}`),super.setClass("_cw-TopAppBar-twoRows",this.#d()),super.setAttribute("data-cw-top-app-bar-variant",this.#e),this.#A()),(e.variantChanged||e.titleAlignmentChanged)&&super.setAttribute("data-cw-title-alignment",e.titleAlignment??(this.#e==="center"?"center":"start")),e.expandedHeightChanged&&super.setStyle("--cw-TopAppBar-expanded-height",z(e.expandedHeight)),(e.variantChanged||e.scrolledChanged)&&(this.#p=e.scrolled,this.#h()),t!==null){const r=e.scrollProgressChanged||e.collapsedChanged||e.scrollBehaviorChanged||e.scrollTargetChanged;e.collapsed===void 0&&n===void 0?r&&t.bind(e.scrollBehavior,e.scrollTarget):(r&&t.bind(void 0,void 0),e.collapsed!==!0&&n!==void 0?t.setFraction(n):this.#m?r&&t.animateFraction(e.collapsed===!0?1:0):t.setFraction(e.collapsed===!0?1:0)),e.variantChanged&&this.#f(t.fraction);}this.#m=!0;}onStyleElementChanged(e){super.onStyleElementChanged(e),!(!b(e)||this.#o!==null)&&(this.#o=new D(e,{property:"--cw-TopAppBar-scroll-progress",spring:j,onOverlapChange:t=>{this.#u=t,this.#h();},onFractionChange:t=>this.#f(t)}));}onControllerCleanup(){this.#o?.dispose(),this.#r?.disconnect(),this.#r=null,super.onControllerCleanup();}render(e){let t,n,r,s,a,m,h,d,l,i,p;const B=<div class="cw-TopAppBar">
20
20
  <div class="cw-TopAppBar-row"ref={t}>
21
21
  <span class="cw-TopAppBar-navigation"ref={n}/>
22
22
  <span class="cw-TopAppBar-titleGroup"ref={r}>
@@ -34,18 +34,18 @@ import{children as C,createComponent as O,createContext as M,createSignal as L,o
34
34
  <span class="cw-TopAppBar-subtitle"ref={p}/>
35
35
  </span>
36
36
  </div>
37
- </div>;let k;const S=()=>v.has(this.props.variant??this.#n)?k??=I(()=>this.#t?.()):void 0;return this.#l=t,this.#a=r,this.#i=d,this.#s=l,c(n,()=>this.props.navigationIcon),c(s,()=>this.props.title??e),c(a,()=>this.props.subtitle),c(m,()=>this.props.actions),c(h,()=>this.props.avatar),c(i,()=>S()?.title()),c(p,()=>S()?.subtitle()),B}}function u(o){const e=T(()=>(t,n)=>K(o,t,n),()=>class extends Q{constructor(t){super(t,o)}});return t=>O(w.Provider,{value:()=>({title:C(()=>q(t.title??t.children)),subtitle:C(()=>t.subtitle)}),get children(){return e(y(t,void 0,U))}})}const Ae=u("small"),Be=u("small"),ve=u("center"),Te=u("medium"),ee=u("large"),ge=u("medium-flexible"),be=u("large-flexible"),ye=ee;function te(o,e){return<div{...o}classList={{...o.classList,"cw-BottomAppBar":!0}}>
37
+ </div>;let k;const S=()=>v.has(this.props.variant??this.#n)?k??=I(()=>this.#t?.()):void 0;return this.#l=t,this.#a=r,this.#i=d,this.#s=l,c(n,()=>this.props.navigationIcon),c(s,()=>this.props.title??e),c(a,()=>this.props.subtitle),c(m,()=>this.props.actions),c(h,()=>this.props.avatar),c(i,()=>S()?.title()),c(p,()=>S()?.subtitle()),B;}}function u(o){const e=T(()=>(t,n)=>K(o,t,n),()=>class extends Q{constructor(t){super(t,o);}});return t=>O(w.Provider,{value:()=>({title:C(()=>q(t.title??t.children)),subtitle:C(()=>t.subtitle)}),get children(){return e(y(t,void 0,U));}});}const Ae=/* @__PURE__ */u("small"),Be=/* @__PURE__ */u("small"),ve=/* @__PURE__ */u("center"),Te=/* @__PURE__ */u("medium"),ee=/* @__PURE__ */u("large"),ge=/* @__PURE__ */u("medium-flexible"),be=/* @__PURE__ */u("large-flexible"),ye=ee;function te(o,e){return<div{...o}classList={{...o.classList,"cw-BottomAppBar":!0}}>
38
38
  <span class="cw-BottomAppBar-actions">{e.actions??o.children}</span>
39
39
  <span class="cw-BottomAppBar-fab">{e.floatingActionButton}</span>
40
- </div>}class ne extends g{#n;#t;constructor(e){super(e,{styleElementIsFunction:!0}),this.#n=null,this.#t=null}applyComponentProps(){const e=super.readProps(["scrollBehavior","scrollTarget"]);(e.scrollBehaviorChanged||e.scrollTargetChanged)&&this.#n?.bind(e.scrollBehavior,e.scrollTarget)}onStyleElementChanged(e){if(super.onStyleElementChanged(e),!b(e)||this.#n!==null)return;const t=new D(e,{property:"--cw-BottomAppBar-scroll-progress",spring:Z,onFractionChange:r=>{e.inert!==r>0&&(e.inert=r>0)}}),n=E(e);this.#n=t,n!==void 0&&(this.#t=new n(r=>{for(const s of r)t.setRange(J(s))}),this.#t.observe(e))}onControllerCleanup(){this.#n?.dispose(),this.#t?.disconnect(),this.#t=null,super.onControllerCleanup()}render(e){let t,n;const r=<div class="cw-BottomAppBar">
40
+ </div>;}class ne extends g{#n;#t;constructor(e){super(e,{styleElementIsFunction:!0}),this.#n=null,this.#t=null;}applyComponentProps(){const e=super.readProps(["scrollBehavior","scrollTarget"]);(e.scrollBehaviorChanged||e.scrollTargetChanged)&&this.#n?.bind(e.scrollBehavior,e.scrollTarget);}onStyleElementChanged(e){if(super.onStyleElementChanged(e),!b(e)||this.#n!==null)return;const t=new D(e,{property:"--cw-BottomAppBar-scroll-progress",spring:Z,onFractionChange:r=>{e.inert!==r>0&&(e.inert=r>0);}}),n=E(e);this.#n=t,n!==void 0&&(this.#t=new n(r=>{for(const s of r)t.setRange(J(s));}),this.#t.observe(e));}onControllerCleanup(){this.#n?.dispose(),this.#t?.disconnect(),this.#t=null,super.onControllerCleanup();}render(e){let t,n;const r=<div class="cw-BottomAppBar">
41
41
  <span class="cw-BottomAppBar-actions"ref={t}/>
42
42
  <span class="cw-BottomAppBar-fab"ref={n}/>
43
- </div>;return c(t,()=>this.props.actions??e),c(n,()=>this.props.floatingActionButton),r}}function oe(){const o=T(()=>te,()=>ne);return e=>o(y(e,void 0,$))}const Ee=oe();function re(){const[o,e]=L([]),[t,n]=L([]);return{entries:o,overflowed:t,setOverflowed:n,register(r){return e(s=>[...s,r]),()=>{e(s=>s.filter(a=>a!==r)),n(s=>s.filter(a=>a!==r))}}}}function X(o,e,t){const n=<R attr:aria-label={e()}name="more_vert"size="sm"/>;return<W label={e()}placement={t==="horizontal"?"bottom-end":"inline-end"}trigger={n}>
43
+ </div>;return c(t,()=>this.props.actions??e),c(n,()=>this.props.floatingActionButton),r;}}function oe(){const o=T(()=>te,()=>ne);return e=>o(y(e,void 0,$));}const Ee=/* @__PURE__ */oe();function re(){const[o,e]=L([]),[t,n]=L([]);return{entries:o,overflowed:t,setOverflowed:n,register(r){return e(s=>[...s,r]),()=>{e(s=>s.filter(a=>a!==r)),n(s=>s.filter(a=>a!==r));};}};}function X(o,e,t){const n=<R attr:aria-label={e()}name="more_vert"size="sm"/>;return<W label={e()}placement={t==="horizontal"?"bottom-end":"inline-end"}trigger={n}>
44
44
  {()=>(o?.overflowed()??[]).map(r=><G disabled={r.disabled()}label={r.label()}leading={r.renderIcon()}onSelect={s=>r.activate(s)}/>)}
45
- </W>}function se(o,e,t){const n=f(A);return<div{...e}classList={{...e.classList,[o==="horizontal"?"cw-AppBarRow":"cw-AppBarColumn"]:!0}}>
45
+ </W>;}function se(o,e,t){const n=f(A);return<div{...e}classList={{...e.classList,[o==="horizontal"?"cw-AppBarRow":"cw-AppBarColumn"]:!0}}>
46
46
  <span class="cw-AppBarLayout-items">{e.children}</span>
47
47
  <span class="cw-AppBarLayout-overflow"hidden>{X(n,()=>t.overflowLabel??H,o)}</span>
48
- </div>}class ie extends g{#n;#t;#e;#o;#l;#a;#i;#s;#r;#c;#p;constructor(e,t){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#t=f(A),this.#e=null,this.#o=null,this.#l=new WeakMap,this.#a=new WeakMap,this.#i=null,this.#s=null,this.#r=P,this.#c=Number.POSITIVE_INFINITY,this.#p=Number.POSITIVE_INFINITY}#u(e){const t=e.borderBoxSize[0];return this.#n==="horizontal"?t?.inlineSize??e.contentRect.width:t?.blockSize??e.contentRect.height}#m(e){const t=new Set(this.#t?.entries().map(n=>n.element));for(const n of e){const r=this.#u(n);n.target===this.styleElement?this.#c=r:n.target===this.#s?this.#r=r>0?r:this.#r:t.has(n.target)?r>0&&this.#l.set(n.target,r):this.#a.set(n.target,r)}this.#d()}#d(){const e=this.#t,t=this.#i,n=this.#s;if(e===void 0||t===null||n===null)return;const r=(i,p)=>(i.element.compareDocumentPosition(p.element)&Node.DOCUMENT_POSITION_FOLLOWING)!==0,s=[...e.entries()].sort((i,p)=>r(i,p)?-1:1),a=s.map(i=>this.#l.get(i.element)??P),m=a.reduce((i,p)=>i+p,0),h=Array.from(t.children).reduce((i,p)=>s.some(B=>p.contains(B.element))?i:i+(this.#a.get(p)??0),0),d=this.#c-h;let l=s.length;if(m>d||s.length>this.#p){let i=this.#r;for(l=0;l<s.length&&l+1<this.#p&&i+a[l]<=d;)i+=a[l++]}s.forEach((i,p)=>{i.element.hidden=p>=l}),n.hidden=l===s.length,e.setOverflowed(s.slice(l))}#h(){const e=this.styleElement,t=this.#i;if(!b(e)||t===null||this.#s===null)return;this.#e?.disconnect();const n=E(e);if(n!==void 0){this.#e=new n(r=>this.#m(r)),this.#e.observe(e),this.#e.observe(this.#s);for(const r of Array.from(t.children))this.#e.observe(r);for(const r of this.#t?.entries()??[])this.#e.observe(r.element)}}applyComponentProps(){const[e,t]=super.readProp("maxItemCount");this.#t?.entries(),t&&(this.#p=e!==void 0&&Number.isFinite(e)&&e>=1?Math.floor(e):Number.POSITIVE_INFINITY),I(()=>{this.#h(),this.#d()})}onControllerCleanup(){this.#e?.disconnect(),this.#e=null,this.#o?.disconnect(),this.#o=null,super.onControllerCleanup()}render(e){let t,n;const r=this.#n==="horizontal"?"cw-AppBarRow":"cw-AppBarColumn",s=<div class={r}>
48
+ </div>;}class ie extends g{#n;#t;#e;#o;#l;#a;#i;#s;#r;#c;#p;constructor(e,t){super(e,{styleElementIsFunction:!0}),this.#n=t,this.#t=f(A),this.#e=null,this.#o=null,this.#l=/* @__PURE__ */new WeakMap(),this.#a=/* @__PURE__ */new WeakMap(),this.#i=null,this.#s=null,this.#r=P,this.#c=Number.POSITIVE_INFINITY,this.#p=Number.POSITIVE_INFINITY;}#u(e){const t=e.borderBoxSize[0];return this.#n==="horizontal"?t?.inlineSize??e.contentRect.width:t?.blockSize??e.contentRect.height;}#m(e){const t=new Set(this.#t?.entries().map(n=>n.element));for(const n of e){const r=this.#u(n);n.target===this.styleElement?this.#c=r:n.target===this.#s?this.#r=r>0?r:this.#r:t.has(n.target)?r>0&&this.#l.set(n.target,r):this.#a.set(n.target,r);}this.#d();}#d(){const e=this.#t,t=this.#i,n=this.#s;if(e===void 0||t===null||n===null)return;const r=(i,p)=>(i.element.compareDocumentPosition(p.element)&Node.DOCUMENT_POSITION_FOLLOWING)!==0,s=[...e.entries()].sort((i,p)=>r(i,p)?-1:1),a=s.map(i=>this.#l.get(i.element)??P),m=a.reduce((i,p)=>i+p,0),h=Array.from(t.children).reduce((i,p)=>s.some(B=>p.contains(B.element))?i:i+(this.#a.get(p)??0),0),d=this.#c-h;let l=s.length;if(m>d||s.length>this.#p){let i=this.#r;for(l=0;l<s.length&&l+1<this.#p&&i+a[l]<=d;)i+=a[l++];}s.forEach((i,p)=>{i.element.hidden=p>=l;}),n.hidden=l===s.length,e.setOverflowed(s.slice(l));}#h(){const e=this.styleElement,t=this.#i;if(!b(e)||t===null||this.#s===null)return;this.#e?.disconnect();const n=E(e);if(n!==void 0){this.#e=new n(r=>this.#m(r)),this.#e.observe(e),this.#e.observe(this.#s);for(const r of Array.from(t.children))this.#e.observe(r);for(const r of this.#t?.entries()??[])this.#e.observe(r.element);}}applyComponentProps(){const[e,t]=super.readProp("maxItemCount");this.#t?.entries(),t&&(this.#p=e!==void 0&&Number.isFinite(e)&&e>=1?Math.floor(e):Number.POSITIVE_INFINITY),I(()=>{this.#h(),this.#d();});}onControllerCleanup(){this.#e?.disconnect(),this.#e=null,this.#o?.disconnect(),this.#o=null,super.onControllerCleanup();}render(e){let t,n;const r=this.#n==="horizontal"?"cw-AppBarRow":"cw-AppBarColumn",s=<div class={r}>
49
49
  <span class="cw-AppBarLayout-items"ref={t}/>
50
50
  <span class="cw-AppBarLayout-overflow"hidden ref={n}/>
51
- </div>;this.#i=t,this.#s=n;const a=Y(t);return a!==void 0&&(this.#o=new a(()=>this.#h()),this.#o.observe(t,{childList:!0})),c(t,e),c(n,X(this.#t,()=>this.props.overflowLabel??H,this.#n)),s}}function F(o){const e=T(()=>(t,n)=>se(o,t,n),()=>class extends ie{constructor(t){super(t,o)}});return t=>O(A.Provider,{value:re(),get children(){return e(y(t,void 0,[]))}})}const we=F("horizontal"),Se=F("vertical");function Ce(o){const e=f(A),t=<R attr:aria-label={o.label}disabled={o.disabled===!0}onClick={r=>o.onActivate?.(r)}size="sm">{o.icon}</R>,n=<span class="cw-AppBarItem">{t}</span>;return e!==void 0&&V(e.register({element:n,label:()=>o.label,disabled:()=>o.disabled===!0,renderIcon:()=>o.icon,activate:r=>o.onActivate?.(r)})),n}export{Se as AppBarColumn,Ce as AppBarItem,ie as AppBarLayoutController,we as AppBarRow,Ee as BottomAppBar,ne as BottomAppBarController,ve as CenterAlignedTopAppBar,be as LargeFlexibleTopAppBar,ee as LargeTopAppBar,ge as MediumFlexibleTopAppBar,Te as MediumTopAppBar,Be as SmallTopAppBar,Ae as TopAppBar,Q as TopAppBarController,ye as TwoRowsTopAppBar};
51
+ </div>;this.#i=t,this.#s=n;const a=Y(t);return a!==void 0&&(this.#o=new a(()=>this.#h()),this.#o.observe(t,{childList:!0})),c(t,e),c(n,X(this.#t,()=>this.props.overflowLabel??H,this.#n)),s;}}function F(o){const e=T(()=>(t,n)=>se(o,t,n),()=>class extends ie{constructor(t){super(t,o);}});return t=>O(A.Provider,{value:re(),get children(){return e(y(t,void 0,[]));}});}const we=/* @__PURE__ */F("horizontal"),Se=/* @__PURE__ */F("vertical");function Ce(o){const e=f(A),t=<R attr:aria-label={o.label}disabled={o.disabled===!0}onClick={r=>o.onActivate?.(r)}size="sm">{o.icon}</R>,n=<span class="cw-AppBarItem">{t}</span>;return e!==void 0&&V(e.register({element:n,label:()=>o.label,disabled:()=>o.disabled===!0,renderIcon:()=>o.icon,activate:r=>o.onActivate?.(r)})),n;}export{Se as AppBarColumn,Ce as AppBarItem,ie as AppBarLayoutController,we as AppBarRow,Ee as BottomAppBar,ne as BottomAppBarController,ve as CenterAlignedTopAppBar,be as LargeFlexibleTopAppBar,ee as LargeTopAppBar,ge as MediumFlexibleTopAppBar,Te as MediumTopAppBar,Be as SmallTopAppBar,Ae as TopAppBar,Q as TopAppBarController,ye as TwoRowsTopAppBar};