@pg-labs-incubator/cobweb 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/package.json +7 -4
  2. package/target/esbuild/action/action.css +1 -1
  3. package/target/esbuild/action/base.jsx +1 -1
  4. package/target/esbuild/action/button.jsx +3 -3
  5. package/target/esbuild/action/fab-menu-context.jsx +1 -1
  6. package/target/esbuild/action/fab-menu.jsx +3 -3
  7. package/target/esbuild/action/fab.jsx +3 -3
  8. package/target/esbuild/action/group.jsx +7 -7
  9. package/target/esbuild/action/icon-button.jsx +3 -3
  10. package/target/esbuild/action/index.jsx +1 -1
  11. package/target/esbuild/action/split-button.jsx +4 -4
  12. package/target/esbuild/color/contrast.jsx +1 -1
  13. package/target/esbuild/color/dynamic.jsx +1 -1
  14. package/target/esbuild/color/hct.jsx +1 -1
  15. package/target/esbuild/color/index.jsx +1 -1
  16. package/target/esbuild/color/palette.jsx +1 -1
  17. package/target/esbuild/color/scheme.jsx +1 -1
  18. package/target/esbuild/color/temperature.jsx +1 -1
  19. package/target/esbuild/container/card.jsx +1 -1
  20. package/target/esbuild/container/elevation-shadow.jsx +1 -1
  21. package/target/esbuild/container/index.jsx +1 -1
  22. package/target/esbuild/dom/client.jsx +1 -1
  23. package/target/esbuild/dom/index.jsx +1 -1
  24. package/target/esbuild/dom/server.jsx +1 -1
  25. package/target/esbuild/dom/types.jsx +1 -1
  26. package/target/esbuild/feedback/badge.jsx +6 -6
  27. package/target/esbuild/feedback/focus.jsx +1 -1
  28. package/target/esbuild/feedback/index.jsx +1 -1
  29. package/target/esbuild/feedback/loading.jsx +3 -3
  30. package/target/esbuild/feedback/observe.jsx +1 -1
  31. package/target/esbuild/feedback/progress.jsx +9 -9
  32. package/target/esbuild/feedback/snackbar.jsx +6 -6
  33. package/target/esbuild/feedback/tooltip.jsx +6 -6
  34. package/target/esbuild/icon/icon.jsx +1 -1
  35. package/target/esbuild/icon/index.jsx +1 -1
  36. package/target/esbuild/index.jsx +1 -1
  37. package/target/esbuild/input/autocomplete.jsx +2 -2
  38. package/target/esbuild/input/base.jsx +2 -2
  39. package/target/esbuild/input/date-picker.jsx +19 -19
  40. package/target/esbuild/input/date-time.jsx +3 -3
  41. package/target/esbuild/input/index.jsx +1 -1
  42. package/target/esbuild/input/paired-input.jsx +1 -1
  43. package/target/esbuild/input/picker-dialog.jsx +3 -3
  44. package/target/esbuild/input/select.jsx +4 -4
  45. package/target/esbuild/input/slider.jsx +7 -7
  46. package/target/esbuild/input/text-field.jsx +4 -4
  47. package/target/esbuild/input/time-picker.jsx +5 -5
  48. package/target/esbuild/motion/follow-height.jsx +1 -0
  49. package/target/esbuild/motion/frame.jsx +1 -1
  50. package/target/esbuild/motion/index.jsx +1 -1
  51. package/target/esbuild/motion/material.jsx +1 -1
  52. package/target/esbuild/motion/motion.jsx +1 -1
  53. package/target/esbuild/motion/spring.jsx +1 -1
  54. package/target/esbuild/motion/transition.jsx +1 -1
  55. package/target/esbuild/motion/velocity.jsx +1 -1
  56. package/target/esbuild/navigation/app-bar.jsx +8 -8
  57. package/target/esbuild/navigation/base.jsx +1 -1
  58. package/target/esbuild/navigation/drawer.jsx +7 -7
  59. package/target/esbuild/navigation/index.jsx +1 -1
  60. package/target/esbuild/navigation/navigation.jsx +12 -12
  61. package/target/esbuild/navigation/scroll.jsx +1 -1
  62. package/target/esbuild/navigation/search.jsx +4 -4
  63. package/target/esbuild/navigation/tabs.jsx +3 -3
  64. package/target/esbuild/navigation/toolbar.jsx +3 -3
  65. package/target/esbuild/selection/base.jsx +1 -1
  66. package/target/esbuild/selection/checkbox.jsx +4 -4
  67. package/target/esbuild/selection/chip.jsx +5 -5
  68. package/target/esbuild/selection/index.jsx +1 -1
  69. package/target/esbuild/selection/radio.jsx +3 -3
  70. package/target/esbuild/selection/segmented.jsx +4 -4
  71. package/target/esbuild/selection/switch.jsx +3 -3
  72. package/target/esbuild/shape/corner-rounding.jsx +1 -1
  73. package/target/esbuild/shape/cubic.jsx +1 -1
  74. package/target/esbuild/shape/index.jsx +1 -1
  75. package/target/esbuild/shape/material-shapes.jsx +1 -1
  76. package/target/esbuild/shape/morph.jsx +1 -1
  77. package/target/esbuild/shape/path.jsx +1 -1
  78. package/target/esbuild/shape/point.jsx +1 -1
  79. package/target/esbuild/shape/rounded-polygon.jsx +1 -1
  80. package/target/esbuild/shape/shapes.jsx +1 -1
  81. package/target/esbuild/spacing/index.jsx +1 -1
  82. package/target/esbuild/state/component.jsx +1 -1
  83. package/target/esbuild/state/controller.jsx +1 -1
  84. package/target/esbuild/state/index.jsx +1 -1
  85. package/target/esbuild/state/ripple.jsx +1 -1
  86. package/target/esbuild/state/state.jsx +1 -1
  87. package/target/esbuild/state/style.jsx +1 -1
  88. package/target/esbuild/surface/carousel-layout.jsx +1 -1
  89. package/target/esbuild/surface/carousel.jsx +2 -2
  90. package/target/esbuild/surface/dialog.jsx +5 -5
  91. package/target/esbuild/surface/divider.jsx +1 -1
  92. package/target/esbuild/surface/drag.jsx +1 -1
  93. package/target/esbuild/surface/gestures.jsx +3 -3
  94. package/target/esbuild/surface/index.jsx +1 -1
  95. package/target/esbuild/surface/interactive.jsx +1 -1
  96. package/target/esbuild/surface/list-patterns.jsx +3 -3
  97. package/target/esbuild/surface/list.jsx +2 -2
  98. package/target/esbuild/surface/menu.jsx +3 -3
  99. package/target/esbuild/surface/scaffold.jsx +7 -7
  100. package/target/esbuild/surface/sheet.jsx +5 -5
  101. package/target/esbuild/surface/side-sheet.jsx +2 -2
  102. package/target/esbuild/surface/slots.jsx +1 -1
  103. package/target/esbuild/surface/surface.jsx +1 -1
  104. package/target/esbuild/text/index.jsx +1 -1
  105. package/target/esbuild/text/text.jsx +2 -2
  106. package/target/esbuild/text/typography.jsx +1 -1
  107. package/target/esbuild/util/box-side.jsx +1 -1
  108. package/target/esbuild/util/debug.jsx +1 -1
  109. package/target/esbuild/util/dom.jsx +1 -1
  110. package/target/esbuild/util/environment.jsx +1 -0
  111. package/target/esbuild/util/event.jsx +1 -1
  112. package/target/esbuild/util/index.jsx +1 -1
  113. package/target/esbuild/util/preconditions.jsx +1 -1
  114. package/target/esbuild/util/reactive.jsx +1 -1
  115. package/target/node/color.js +1 -0
  116. package/target/node/shape.js +1 -0
  117. package/target/tsc/motion/follow-height.d.ts +51 -0
  118. package/target/tsc/motion/index.d.ts +7 -3
  119. package/target/tsc/motion/spring.d.ts +3 -3
  120. package/target/tsc/shape/index.d.ts +1 -1
  121. package/target/tsc/shape/material-shapes.d.ts +56 -0
  122. package/target/tsc/shape/path.d.ts +16 -0
  123. package/target/tsc/util/environment.d.ts +14 -0
  124. package/target/tsc/util/index.d.ts +2 -1
  125. package/target/tsc/util/preconditions.d.ts +0 -14
@@ -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};
@@ -1 +1 @@
1
- import{children as M,createUniqueId as L,mergeProps as x}from"solid-js";import{DragVelocity as A}from"../surface/drag";import{deferAfterDelegatedCancellation as B}from"../util/event";const u=new WeakMap,d=new WeakMap,g=":modal, :popover-open",h=/[^a-zA-Z0-9_-]+/g,D=50,m=8,E=.5,S=["lostpointercapture","pointercancel","pointerdown","pointermove","pointerup"];function N(t,e,n){const r=t,o={},i=new Set(["children",...n]),s=l=>{const T=M(()=>l==="children"&&e!==void 0?e:r[l]);Object.defineProperty(o,l,{enumerable:!0,get:T})};for(const l of Object.keys(r))i.delete(l)&&s(l);for(const l of i)l==="children"?s(l):o[l]=void 0;return x(t,o)}function H(t,e){const n=L().replace(h,"-");return e===void 0||e===""?`${t}-${n}`:`${t}-${e.replace(h,"-")}-${n}`}function X(t){return"value"in t?t.value:"selectedValue"in t?t.selectedValue:t.defaultValue}function y(t){return t.matches(":disabled")||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}function C(t,e){const n=[];let r=!0;for(let o=t;o!==null;o=o.parentElement){const i=e?.get(o);if(i!==void 0){r=i;break}if(n.push(o),o.hasAttribute("hidden")||o.hasAttribute("inert")){r=!1;break}const s=p(o);if(s.display==="none"||s.visibility==="hidden"||s.visibility==="collapse"){r=!1;break}}for(const o of n)e?.set(o,r);return r}function P(t){const e=t.getAttribute("popover");return e===null||e===""||e==="auto"}function R(t){const e=t.ownerDocument,n=u.get(e)??[];let r=d.get(e);if(r===void 0){const i={order:new WeakMap,sequence:0,onToggle(s){!f(s.target)||!("newState"in s)||(s.newState==="open"?i.order.set(s.target,++i.sequence):n.includes(s.target)||i.order.delete(s.target))}};r=i,d.set(e,i),e.addEventListener("beforetoggle",i.onToggle,!0)}try{for(const i of Array.from(e.querySelectorAll(g)))r.order.has(i)||r.order.set(i,++r.sequence)}catch{}r.order.set(t,++r.sequence),n.push(t),u.set(e,n);const o=r;return()=>{const i=n.lastIndexOf(t);i>=0&&n.splice(i,1),n.length===0&&u.get(e)===n&&(e.removeEventListener("beforetoggle",o.onToggle,!0),d.delete(e),u.delete(e))}}function _(t){const e=t.ownerDocument,n=u.get(e),r=d.get(e);let o;if(n===void 0||r===void 0)return!1;try{o=Array.from(e.querySelectorAll(g))}catch{return n.at(-1)===t}for(const a of o)r.order.has(a)||r.order.set(a,++r.sequence);const i=n.filter(a=>o.some(l=>l.contains(a))),s=r.order.get(t)??0;return(i.length>0?i:n).at(-1)!==t?!1:o.every(a=>a.contains(t)||n.includes(a)||!P(a)||(r.order.get(a)??0)<s)}function f(t){return typeof t=="object"&&t!==null&&t.nodeType===1}function v(t){return f(t)&&t.localName==="a"}function q(t){return f(t)&&t.localName==="button"}function I(){throw new Error("server renderer requested on the client")}function V(t,e){return v(e)&&(t.button!==0||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}function W(t,e){v(e)&&y(e)&&(t.key==="Enter"||t.key===" ")&&t.preventDefault()}function c(t){return(t?.nodeType===9?t:t?.ownerDocument)?.defaultView}function p(t){return c(t)?.getComputedStyle(t)??getComputedStyle(t)}function J(t){return c(t)?.MutationObserver??globalThis.MutationObserver}function b(t){const e=Number.parseFloat(t);return Number.isFinite(e)?t.trim().endsWith("ms")?e:e*1e3:0}function w(t,e){const n=p(t),r=n.transitionDuration.split(","),o=n.transitionDelay.split(",");let i=0;return n.transitionProperty.split(",").forEach((s,a)=>{(e.includes(s.trim())||s.trim()==="all")&&(i=Math.max(0,b(r[a%r.length]??"0s")+b(o[a%o.length]??"0s")))}),i}function K(t,e,n){const r=c(t),o=w(t,e);let i;const s=()=>{t.removeEventListener("transitionend",a),i!==void 0&&r?.clearTimeout(i),i=void 0},a=l=>{l.target!==t||!e.includes(l.propertyName)||(s(),n())};return o===0||r===void 0?(n(),()=>{}):(t.addEventListener("transitionend",a),i=r.setTimeout(()=>{s(),n()},o+D),s)}function Y(t,e=!1){return Array.from(t.querySelectorAll("button, a[href], input, select, textarea, [role=button], [tabindex]")).filter(n=>n.closest("[role=toolbar]")===t&&!y(n)&&(n.matches("button, a[href], input, select, textarea")||n.tabIndex>=0||e&&n.matches("[role=button], [tabindex]")))}function j(t,...e){const n=new Set;for(const r of t)r!==void 0&&!n.has(r)&&(n.add(r),r(...e))}function $(t,e,n){return Math.abs(e)>=n?e>0:e>0?t>=E:t>E}class F{#s;#n;#l;#u;#r;#t;#d;#i;#e;#a;#o;constructor(e){this.#s=e,this.#n=new A,this.#l=n=>this.#f(n),this.#u=n=>{this.#o&&(this.#o=!1,n.preventDefault(),n.stopPropagation())},this.#r=null,this.#t=null,this.#d=0,this.#i=0,this.#e=0,this.#a=-1,this.#o=!1}attach(e){const n=this.#r;if(n!==e){this.#t=null,this.#e=0;for(const r of S)n?.removeEventListener(r,this.#l),e?.addEventListener(r,this.#l);n?.removeEventListener("click",this.#u,!0),e?.addEventListener("click",this.#u,!0),this.#r=e}}#f(e){const n=this.#t;if(e.type==="pointerdown"){n===null&&e.isPrimary&&e.button===0&&(this.#t=e,this.#i=e.clientX,this.#n.reset(),this.#n.track(e,r=>r.clientX));return}if(!(n===null||e.pointerId!==n.pointerId)){if(e.type!=="pointermove"){e.type==="pointerup"&&(this.#i=e.clientX),this.#h(e);return}this.#n.track(e,r=>r.clientX),this.#i=e.clientX,this.#e===0&&this.#p(n,e),this.#e>0&&this.#s.update(this.#c())}}#p(e,n){const r=this.#r,o=n.clientX-e.clientX,i=n.clientY-e.clientY;if(r===null||Math.max(Math.abs(o),Math.abs(i))<=m)return;if(Math.abs(i)>=Math.abs(o)){this.#t=null;return}const s=this.#s.begin(e);if(s===null||s<=0){this.#t=null;return}this.#e=s,this.#a=p(r).direction==="rtl"?1:-1,this.#d=e.clientX+Math.sign(o)*m;try{r.setPointerCapture(n.pointerId)}catch{}}#h(e){const n=this.#e,r=c(this.#r);if(this.#t=null,n===0)return;const o=this.#c(),i=e.type==="pointerup"?this.#n.release(e)*this.#a/n:0;this.#e=0,this.#o=!0,r?.setTimeout(()=>this.#o=!1,0),this.#s.end(o,i,e)}#c(){return(this.#i-this.#d)*this.#a/this.#e}}export{F as DismissDrag,K as afterTransition,p as computedStyleOf,j as dedupeCallbacks,B as deferAfterDelegatedCancellation,Y as directActionableChildren,V as isAlternateLinkActivation,v as isAnchorElement,q as isButtonElement,y as isDisabledElement,$ as isDismissedAt,f as isElementNode,_ as isTopModalLayer,C as isVisibleElement,J as mutationObserverOf,c as ownerWindow,W as preventDisabledLinkKey,R as registerModalLayer,N as resolveNavigationSlots,X as selectedValueOf,w as transitionTimeOf,H as uniqueId,I as unreachableServerRender};
1
+ import{children as M,createUniqueId as L,mergeProps as x}from"solid-js";import{DragVelocity as A}from"../surface/drag";import{deferAfterDelegatedCancellation as B}from"../util/event";const u=/* @__PURE__ */new WeakMap(),d=/* @__PURE__ */new WeakMap(),g=":modal, :popover-open",h=/[^a-zA-Z0-9_-]+/g,D=50,m=8,E=0.5,S=["lostpointercapture","pointercancel","pointerdown","pointermove","pointerup"];function N(t,e,n){const r=t,o={},i=/* @__PURE__ */new Set(["children",...n]),s=l=>{const T=M(()=>l==="children"&&e!==void 0?e:r[l]);Object.defineProperty(o,l,{enumerable:!0,get:T});};for(const l of Object.keys(r))i.delete(l)&&s(l);for(const l of i)l==="children"?s(l):o[l]=void 0;return x(t,o);}function H(t,e){const n=L().replace(h,"-");return e===void 0||e===""?`${t}-${n}`:`${t}-${e.replace(h,"-")}-${n}`;}function X(t){return"value"in t?t.value:"selectedValue"in t?t.selectedValue:t.defaultValue;}function y(t){return t.matches(":disabled")||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true";}function C(t,e){const n=[];let r=!0;for(let o=t;o!==null;o=o.parentElement){const i=e?.get(o);if(i!==void 0){r=i;break;}if(n.push(o),o.hasAttribute("hidden")||o.hasAttribute("inert")){r=!1;break;}const s=p(o);if(s.display==="none"||s.visibility==="hidden"||s.visibility==="collapse"){r=!1;break;}}for(const o of n)e?.set(o,r);return r;}function P(t){const e=t.getAttribute("popover");return e===null||e===""||e==="auto";}function R(t){const e=t.ownerDocument,n=u.get(e)??[];let r=d.get(e);if(r===void 0){const i={order:/* @__PURE__ */new WeakMap(),sequence:0,onToggle(s){!f(s.target)||!("newState"in s)||(s.newState==="open"?i.order.set(s.target,++i.sequence):n.includes(s.target)||i.order.delete(s.target));}};r=i,d.set(e,i),e.addEventListener("beforetoggle",i.onToggle,!0);}try{for(const i of Array.from(e.querySelectorAll(g)))r.order.has(i)||r.order.set(i,++r.sequence);}catch{}r.order.set(t,++r.sequence),n.push(t),u.set(e,n);const o=r;return()=>{const i=n.lastIndexOf(t);i>=0&&n.splice(i,1),n.length===0&&u.get(e)===n&&(e.removeEventListener("beforetoggle",o.onToggle,!0),d.delete(e),u.delete(e));};}function _(t){const e=t.ownerDocument,n=u.get(e),r=d.get(e);let o;if(n===void 0||r===void 0)return!1;try{o=Array.from(e.querySelectorAll(g));}catch{return n.at(-1)===t;}for(const a of o)r.order.has(a)||r.order.set(a,++r.sequence);const i=n.filter(a=>o.some(l=>l.contains(a))),s=r.order.get(t)??0;return(i.length>0?i:n).at(-1)!==t?!1:o.every(a=>a.contains(t)||n.includes(a)||!P(a)||(r.order.get(a)??0)<s);}function f(t){return typeof t=="object"&&t!==null&&t.nodeType===1;}function v(t){return f(t)&&t.localName==="a";}function q(t){return f(t)&&t.localName==="button";}function I(){throw new Error("server renderer requested on the client");}function V(t,e){return v(e)&&(t.button!==0||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey);}function W(t,e){v(e)&&y(e)&&(t.key==="Enter"||t.key===" ")&&t.preventDefault();}function c(t){return(t?.nodeType===9?t:t?.ownerDocument)?.defaultView;}function p(t){return c(t)?.getComputedStyle(t)??getComputedStyle(t);}function J(t){return c(t)?.MutationObserver??globalThis.MutationObserver;}function b(t){const e=Number.parseFloat(t);return Number.isFinite(e)?t.trim().endsWith("ms")?e:e*1e3:0;}function w(t,e){const n=p(t),r=n.transitionDuration.split(","),o=n.transitionDelay.split(",");let i=0;return n.transitionProperty.split(",").forEach((s,a)=>{(e.includes(s.trim())||s.trim()==="all")&&(i=Math.max(0,b(r[a%r.length]??"0s")+b(o[a%o.length]??"0s")));}),i;}function K(t,e,n){const r=c(t),o=w(t,e);let i;const s=()=>{t.removeEventListener("transitionend",a),i!==void 0&&r?.clearTimeout(i),i=void 0;},a=l=>{l.target!==t||!e.includes(l.propertyName)||(s(),n());};return o===0||r===void 0?(n(),()=>{}):(t.addEventListener("transitionend",a),i=r.setTimeout(()=>{s(),n();},o+D),s);}function Y(t,e=!1){return Array.from(t.querySelectorAll("button, a[href], input, select, textarea, [role=button], [tabindex]")).filter(n=>n.closest("[role=toolbar]")===t&&!y(n)&&(n.matches("button, a[href], input, select, textarea")||n.tabIndex>=0||e&&n.matches("[role=button], [tabindex]")));}function j(t,...e){const n=/* @__PURE__ */new Set();for(const r of t)r!==void 0&&!n.has(r)&&(n.add(r),r(...e));}function $(t,e,n){return Math.abs(e)>=n?e>0:e>0?t>=E:t>E;}class F{#s;#n;#l;#u;#r;#t;#d;#i;#e;#a;#o;constructor(e){this.#s=e,this.#n=new A(),this.#l=n=>this.#f(n),this.#u=n=>{this.#o&&(this.#o=!1,n.preventDefault(),n.stopPropagation());},this.#r=null,this.#t=null,this.#d=0,this.#i=0,this.#e=0,this.#a=-1,this.#o=!1;}attach(e){const n=this.#r;if(n!==e){this.#t=null,this.#e=0;for(const r of S)n?.removeEventListener(r,this.#l),e?.addEventListener(r,this.#l);n?.removeEventListener("click",this.#u,!0),e?.addEventListener("click",this.#u,!0),this.#r=e;}}#f(e){const n=this.#t;if(e.type==="pointerdown"){n===null&&e.isPrimary&&e.button===0&&(this.#t=e,this.#i=e.clientX,this.#n.reset(),this.#n.track(e,r=>r.clientX));return;}if(!(n===null||e.pointerId!==n.pointerId)){if(e.type!=="pointermove"){e.type==="pointerup"&&(this.#i=e.clientX),this.#h(e);return;}this.#n.track(e,r=>r.clientX),this.#i=e.clientX,this.#e===0&&this.#p(n,e),this.#e>0&&this.#s.update(this.#c());}}#p(e,n){const r=this.#r,o=n.clientX-e.clientX,i=n.clientY-e.clientY;if(r===null||Math.max(Math.abs(o),Math.abs(i))<=m)return;if(Math.abs(i)>=Math.abs(o)){this.#t=null;return;}const s=this.#s.begin(e);if(s===null||s<=0){this.#t=null;return;}this.#e=s,this.#a=p(r).direction==="rtl"?1:-1,this.#d=e.clientX+Math.sign(o)*m;try{r.setPointerCapture(n.pointerId);}catch{}}#h(e){const n=this.#e,r=c(this.#r);if(this.#t=null,n===0)return;const o=this.#c(),i=e.type==="pointerup"?this.#n.release(e)*this.#a/n:0;this.#e=0,this.#o=!0,r?.setTimeout(()=>this.#o=!1,0),this.#s.end(o,i,e);}#c(){return(this.#i-this.#d)*this.#a/this.#e;}}export{F as DismissDrag,K as afterTransition,p as computedStyleOf,j as dedupeCallbacks,B as deferAfterDelegatedCancellation,Y as directActionableChildren,V as isAlternateLinkActivation,v as isAnchorElement,q as isButtonElement,y as isDisabledElement,$ as isDismissedAt,f as isElementNode,_ as isTopModalLayer,C as isVisibleElement,J as mutationObserverOf,c as ownerWindow,W as preventDisabledLinkKey,R as registerModalLayer,N as resolveNavigationSlots,X as selectedValueOf,w as transitionTimeOf,H as uniqueId,I as unreachableServerRender};
@@ -1,11 +1,11 @@
1
- import{splitProps as R,untrack as p}from"solid-js";import{isServer as D}from"solid-js/web";import{defineDomComponent as E}from"..";import{DomController as b}from"../dom/client";import{applySpringMotion as M}from"../motion";import{DismissDrag as T,afterTransition as k,computedStyleOf as A,deferAfterDelegatedCancellation as g,isDisabledElement as H,isDismissedAt as O,isElementNode as d,isTopModalLayer as u,isVisibleElement as x,ownerWindow as f,registerModalLayer as V,resolveNavigationSlots as N,uniqueId as y,unreachableServerRender as S}from"./base";import{NAVIGATION_KIND_ATTRIBUTE as I,NavigationSelection as F,provideNavigationSelection as _}from"./navigation";import"../container/elevation-shadow.css";import"./navigation.css";const C="cw-NavigationDrawer-open",h="Close navigation menu",r="--_CW-NAVIGATION-DRAWER_PROGRESS",w="_cw-NavigationDrawer-dragging",J=400,X=["headline","drawerContent","content"],K=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", ");function L(o){return o.variant??o.mode??"modal"}function P(o){return`_cw-NavigationDrawer-${o}`}function m(o){return"value"in o||"selectedValue"in o||"defaultValue"in o}class q extends b{#o;#l;#D;#E;#b;#N;#v;#p;#s;#y;#e;#t;#d;#S;#g;#n;#h;#i;#u;#m;#a;#c;#f;#C;#w;constructor(e){super(e),this.#o="open"in e,this.#l=m(e)?new F(e):null,this.#D=new T({begin:t=>this.#F(t),update:t=>this.#M(t),end:(t,n,i)=>this.#_(t,n,i)}),this.#E=t=>this.#J(t),this.#b=t=>this.#x(t),this.#N=()=>this.#R(),this.#v=t=>{const n=super.styleElement;t.key==="Escape"&&n!==null&&t.composedPath().includes(n)&&this.#x(t)},this.#p=t=>this.#X(t),this.#s=null,this.#y=null,this.#e=p(()=>L(e)),this.#t=p(()=>(this.#o?e.open:e.defaultOpen)===!0),this.#d=!1,this.#S=!1,this.#g=!1,this.#n=!0,this.#h=null,this.#i=null,this.#u=!1,this.#m=null,this.#a=null,this.#c=null,this.#f=null,this.#C=null,this.#w=()=>{},this.#l!==null&&super.setAttribute(I,"NavigationDrawer")}#r(){return this.#e==="modal"&&this.#t}#L(){const e=super.functionElement,t=this.#s,n=new Map;if(e===null)return[];const i=Array.from(e.querySelectorAll(K)).filter(s=>s.tabIndex>=0&&!H(s)&&x(s,n));return t!==null&&!t.hidden&&this.#n&&i.push(t),i}#T(){const e=super.styleElement,t=this.#e==="permanent"||this.#t;e===null||super.functionElement===null||((t!==this.#S||!this.#g)&&(this.#w(),this.#S=t,super.setClass(C,t),this.#i?.retarget(t?1:0),t||!this.#g?this.#d=t:this.#h===null&&(this.#w=k(e,[r],()=>{this.#d=!1,this.#P()}))),this.#g=!0,this.#P(),this.#V(this.#r()))}#P(){const e=this.#s,t=this.#y,n=this.#d,i=this.#e==="modal"&&n,s=n&&!this.#t&&this.#e!=="permanent";super.setAttribute("hidden",!n),super.setAttribute("aria-hidden",n?void 0:"true"),super.setAttribute("inert",s),e!==null&&(e.hidden=!i,e.inert=s||!this.#n,e.tabIndex=this.#n?0:-1,this.#n?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")),t!==null&&(t.inert=this.#r())}#V(e){const t=super.styleElement;if(t===null||e===this.#u)return;if(this.#u=e,!e){this.#k(),this.#I(t);return}const n=t.getRootNode().activeElement;this.#f=d(n)&&n!==t.ownerDocument.body?n:null,(f(t)?.queueMicrotask??queueMicrotask)(()=>{!this.#u||super.styleElement!==t||!t.isConnected||(this.#R(),u(t)&&(this.#L()[0]??super.functionElement)?.focus())})}#I(e){const t=this.#f;this.#f=null,t!==null&&(f(e)?.queueMicrotask??queueMicrotask)(()=>{const n=e.getRootNode(),i=n.activeElement;!this.#r()&&t.isConnected&&t.getRootNode()===n&&(i===null||i===e.ownerDocument.body||e.contains(i))&&t.focus()})}#R(){const e=super.styleElement;if(e===null||!this.#u||!e.isConnected)return;const t=e.getRootNode(),n=t.nodeType===11?t:e.ownerDocument;n!==this.#c&&(this.#c?.removeEventListener("focusin",this.#p,!0),this.#c=n,n.addEventListener("focusin",this.#p,!0)),e.ownerDocument!==this.#a&&(this.#a?.removeEventListener("keydown",this.#v,!0),this.#a=e.ownerDocument,this.#a.addEventListener("keydown",this.#v,!0),this.#m?.(),this.#m=V(e))}#k(){this.#m?.(),this.#m=null,this.#c?.removeEventListener("focusin",this.#p,!0),this.#c=null,this.#a?.removeEventListener("keydown",this.#v,!0),this.#a=null}#A(e,t){this.#e==="permanent"||!this.#n||(this.#o||(this.#t=e,this.#T()),this.props.onOpenChange?.(e,t))}#H(e){const t=super.styleElement;g(e,t,()=>{super.styleElement===t&&t?.isConnected===!0&&this.#A(!1,e)})}#F(e){const t=super.styleElement,n=super.functionElement,i=e.target;if(t===null||n===null||!this.#r()||!this.#n||!u(t)||!d(i)||!(n.contains(i)||i===this.#s))return null;const s=Number.parseFloat(A(t).getPropertyValue(r));return this.#i?.cancel(),this.#i=null,this.#h=Number.isFinite(s)?s:1,super.setClass(w,!0),this.#M(0),n.getBoundingClientRect().width}#M(e){const t=super.styleElement,n=Math.min(1,Math.max(0,(this.#h??1)-e));return t?.style.setProperty(r,String(n)),n}#_(e,t,n){const i=super.styleElement,s=super.functionElement,a=this.#M(e),l=s?.getBoundingClientRect().width??0;if(i===null||l===0){this.#O();return}O(1-a,t,J/l)&&this.#A(!1,n);const c=M(i,r,a,this.#t?1:0,{velocity:-t});this.#i=c,c.finished.then(()=>{this.#i===c&&this.#O()},()=>{})}#O(){const e=super.styleElement;this.#i?.cancel(),this.#i=null,this.#h=null,e?.style.removeProperty(r),super.setClass(w,!1),this.#d&&this.#e!=="permanent"&&!this.#t&&(this.#d=!1,this.#P())}#J(e){e.target===this.#s&&this.#n&&this.#H(e)}#x(e){const t=super.styleElement;if(e===this.#C||t===null||(this.#C=e,this.#R(),this.#e==="modal"&&(!this.#t||!u(t))))return;if(e.key==="Escape"){this.#t&&this.#n&&!e.defaultPrevented&&this.#H(e);return}if(e.key!=="Tab"||!this.#r())return;const n=this.#L(),i=t.getRootNode().activeElement,s=d(i)?n.indexOf(i):-1;(e.shiftKey?s>0:s>=0&&s<n.length-1)||g(e,t,()=>{const l=n[e.shiftKey?n.length-1:0];super.styleElement===t&&t.isConnected&&this.#r()&&(l??super.functionElement)?.focus()})}#X(e){const t=super.styleElement,n=e.composedPath()[0]??e.target;!this.#r()||t===null||!d(n)||t.contains(n)||!u(t)||t.getRootNode().activeElement===n&&(this.#L()[0]??super.functionElement)?.focus()}applyComponentProps(){const e=super.readProps(["dismissible","mode","open","scrimLabel","selectedValue","value","variant"]);(e.variantChanged||e.modeChanged)&&(this.#e=e.variant??e.mode??"modal",super.setClass("variant",P(this.#e))),e.openChanged&&this.#o&&(this.#t=e.open===!0),e.dismissibleChanged&&(this.#n=e.dismissible!==!1),e.scrimLabelChanged&&this.#s?.setAttribute("aria-label",e.scrimLabel??h),(e.valueChanged||e.selectedValueChanged)&&this.#l?.update(),this.#T(),this.#l?.sync()}onStyleElementChanged(e){const t=super.styleElement;super.onStyleElementChanged(e),t?.removeEventListener("click",this.#E),t?.removeEventListener("keydown",this.#b),t?.removeEventListener("focusin",this.#N),e?.addEventListener("click",this.#E),e?.addEventListener("keydown",this.#b),e?.addEventListener("focusin",this.#N),this.#D.attach(e)}onFunctionElementChanged(e){super.onFunctionElementChanged(e),this.#l?.attach(e)}onControllerCleanup(){this.#w(),this.#i?.cancel(),this.#D.attach(null),this.#u=!1,this.#k(),this.#l?.dispose(),super.onControllerCleanup()}render(e,t){return<div class="cw-NavigationDrawer">
1
+ import{splitProps as R,untrack as p}from"solid-js";import{isServer as D}from"solid-js/web";import{defineDomComponent as E}from"..";import{DomController as b}from"../dom/client";import{applySpringMotion as M}from"../motion";import{DismissDrag as T,afterTransition as k,computedStyleOf as A,deferAfterDelegatedCancellation as g,isDisabledElement as H,isDismissedAt as O,isElementNode as d,isTopModalLayer as u,isVisibleElement as x,ownerWindow as f,registerModalLayer as V,resolveNavigationSlots as N,uniqueId as y,unreachableServerRender as S}from"./base";import{NAVIGATION_KIND_ATTRIBUTE as I,NavigationSelection as F,provideNavigationSelection as _}from"./navigation";import"../container/elevation-shadow.css";import"./navigation.css";const C="cw-NavigationDrawer-open",h="Close navigation menu",r="--_CW-NAVIGATION-DRAWER_PROGRESS",w="_cw-NavigationDrawer-dragging",J=400,X=["headline","drawerContent","content"],K=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", ");function L(o){return o.variant??o.mode??"modal";}function P(o){return`_cw-NavigationDrawer-${o}`;}function m(o){return"value"in o||"selectedValue"in o||"defaultValue"in o;}class q extends b{#o;#l;#D;#E;#b;#N;#v;#p;#s;#y;#e;#t;#d;#S;#g;#n;#h;#i;#u;#m;#a;#c;#f;#C;#w;constructor(e){super(e),this.#o="open"in e,this.#l=m(e)?new F(e):null,this.#D=new T({begin:t=>this.#F(t),update:t=>this.#M(t),end:(t,n,i)=>this.#_(t,n,i)}),this.#E=t=>this.#J(t),this.#b=t=>this.#x(t),this.#N=()=>this.#R(),this.#v=t=>{const n=super.styleElement;t.key==="Escape"&&n!==null&&t.composedPath().includes(n)&&this.#x(t);},this.#p=t=>this.#X(t),this.#s=null,this.#y=null,this.#e=p(()=>L(e)),this.#t=p(()=>(this.#o?e.open:e.defaultOpen)===!0),this.#d=!1,this.#S=!1,this.#g=!1,this.#n=!0,this.#h=null,this.#i=null,this.#u=!1,this.#m=null,this.#a=null,this.#c=null,this.#f=null,this.#C=null,this.#w=()=>{},this.#l!==null&&super.setAttribute(I,"NavigationDrawer");}#r(){return this.#e==="modal"&&this.#t;}#L(){const e=super.functionElement,t=this.#s,n=/* @__PURE__ */new Map();if(e===null)return[];const i=Array.from(e.querySelectorAll(K)).filter(s=>s.tabIndex>=0&&!H(s)&&x(s,n));return t!==null&&!t.hidden&&this.#n&&i.push(t),i;}#T(){const e=super.styleElement,t=this.#e==="permanent"||this.#t;e===null||super.functionElement===null||((t!==this.#S||!this.#g)&&(this.#w(),this.#S=t,super.setClass(C,t),this.#i?.retarget(t?1:0),t||!this.#g?this.#d=t:this.#h===null&&(this.#w=k(e,[r],()=>{this.#d=!1,this.#P();}))),this.#g=!0,this.#P(),this.#V(this.#r()));}#P(){const e=this.#s,t=this.#y,n=this.#d,i=this.#e==="modal"&&n,s=n&&!this.#t&&this.#e!=="permanent";super.setAttribute("hidden",!n),super.setAttribute("aria-hidden",n?void 0:"true"),super.setAttribute("inert",s),e!==null&&(e.hidden=!i,e.inert=s||!this.#n,e.tabIndex=this.#n?0:-1,this.#n?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")),t!==null&&(t.inert=this.#r());}#V(e){const t=super.styleElement;if(t===null||e===this.#u)return;if(this.#u=e,!e){this.#k(),this.#I(t);return;}const n=t.getRootNode().activeElement;this.#f=d(n)&&n!==t.ownerDocument.body?n:null,(f(t)?.queueMicrotask??queueMicrotask)(()=>{!this.#u||super.styleElement!==t||!t.isConnected||(this.#R(),u(t)&&(this.#L()[0]??super.functionElement)?.focus());});}#I(e){const t=this.#f;this.#f=null,t!==null&&(f(e)?.queueMicrotask??queueMicrotask)(()=>{const n=e.getRootNode(),i=n.activeElement;!this.#r()&&t.isConnected&&t.getRootNode()===n&&(i===null||i===e.ownerDocument.body||e.contains(i))&&t.focus();});}#R(){const e=super.styleElement;if(e===null||!this.#u||!e.isConnected)return;const t=e.getRootNode(),n=t.nodeType===11?t:e.ownerDocument;n!==this.#c&&(this.#c?.removeEventListener("focusin",this.#p,!0),this.#c=n,n.addEventListener("focusin",this.#p,!0)),e.ownerDocument!==this.#a&&(this.#a?.removeEventListener("keydown",this.#v,!0),this.#a=e.ownerDocument,this.#a.addEventListener("keydown",this.#v,!0),this.#m?.(),this.#m=V(e));}#k(){this.#m?.(),this.#m=null,this.#c?.removeEventListener("focusin",this.#p,!0),this.#c=null,this.#a?.removeEventListener("keydown",this.#v,!0),this.#a=null;}#A(e,t){this.#e==="permanent"||!this.#n||(this.#o||(this.#t=e,this.#T()),this.props.onOpenChange?.(e,t));}#H(e){const t=super.styleElement;g(e,t,()=>{super.styleElement===t&&t?.isConnected===!0&&this.#A(!1,e);});}#F(e){const t=super.styleElement,n=super.functionElement,i=e.target;if(t===null||n===null||!this.#r()||!this.#n||!u(t)||!d(i)||!(n.contains(i)||i===this.#s))return null;const s=Number.parseFloat(A(t).getPropertyValue(r));return this.#i?.cancel(),this.#i=null,this.#h=Number.isFinite(s)?s:1,super.setClass(w,!0),this.#M(0),n.getBoundingClientRect().width;}#M(e){const t=super.styleElement,n=Math.min(1,Math.max(0,(this.#h??1)-e));return t?.style.setProperty(r,String(n)),n;}#_(e,t,n){const i=super.styleElement,s=super.functionElement,a=this.#M(e),l=s?.getBoundingClientRect().width??0;if(i===null||l===0){this.#O();return;}O(1-a,t,J/l)&&this.#A(!1,n);const c=M(i,r,a,this.#t?1:0,{velocity:-t});this.#i=c,c.finished.then(()=>{this.#i===c&&this.#O();},()=>{});}#O(){const e=super.styleElement;this.#i?.cancel(),this.#i=null,this.#h=null,e?.style.removeProperty(r),super.setClass(w,!1),this.#d&&this.#e!=="permanent"&&!this.#t&&(this.#d=!1,this.#P());}#J(e){e.target===this.#s&&this.#n&&this.#H(e);}#x(e){const t=super.styleElement;if(e===this.#C||t===null||(this.#C=e,this.#R(),this.#e==="modal"&&(!this.#t||!u(t))))return;if(e.key==="Escape"){this.#t&&this.#n&&!e.defaultPrevented&&this.#H(e);return;}if(e.key!=="Tab"||!this.#r())return;const n=this.#L(),i=t.getRootNode().activeElement,s=d(i)?n.indexOf(i):-1;(e.shiftKey?s>0:s>=0&&s<n.length-1)||g(e,t,()=>{const l=n[e.shiftKey?n.length-1:0];super.styleElement===t&&t.isConnected&&this.#r()&&(l??super.functionElement)?.focus();});}#X(e){const t=super.styleElement,n=e.composedPath()[0]??e.target;!this.#r()||t===null||!d(n)||t.contains(n)||!u(t)||t.getRootNode().activeElement===n&&(this.#L()[0]??super.functionElement)?.focus();}applyComponentProps(){const e=super.readProps(["dismissible","mode","open","scrimLabel","selectedValue","value","variant"]);(e.variantChanged||e.modeChanged)&&(this.#e=e.variant??e.mode??"modal",super.setClass("variant",P(this.#e))),e.openChanged&&this.#o&&(this.#t=e.open===!0),e.dismissibleChanged&&(this.#n=e.dismissible!==!1),e.scrimLabelChanged&&this.#s?.setAttribute("aria-label",e.scrimLabel??h),(e.valueChanged||e.selectedValueChanged)&&this.#l?.update(),this.#T(),this.#l?.sync();}onStyleElementChanged(e){const t=super.styleElement;super.onStyleElementChanged(e),t?.removeEventListener("click",this.#E),t?.removeEventListener("keydown",this.#b),t?.removeEventListener("focusin",this.#N),e?.addEventListener("click",this.#E),e?.addEventListener("keydown",this.#b),e?.addEventListener("focusin",this.#N),this.#D.attach(e);}onFunctionElementChanged(e){super.onFunctionElementChanged(e),this.#l?.attach(e);}onControllerCleanup(){this.#w(),this.#i?.cancel(),this.#D.attach(null),this.#u=!1,this.#k(),this.#l?.dispose(),super.onControllerCleanup();}render(e,t){return<div class="cw-NavigationDrawer">
2
2
  <nav class="cw-NavigationDrawer-panel cw-elevationShadow"ref={t}role="navigation"tabIndex={-1}>
3
3
  <div class="cw-NavigationDrawer-headline">{this.props.headline}</div>
4
4
  <div class="cw-NavigationDrawer-items">{this.props.drawerContent??e}</div>
5
5
  </nav>
6
- <button aria-label={h}class="cw-NavigationDrawer-scrim"ref={n=>{this.#s=n}}type="button"/>
7
- <div class="cw-NavigationDrawer-content"ref={n=>{this.#y=n}}>{this.props.content}</div>
8
- </div>}}function B(o,e){const[t,n]=R(o,["children","class","classList","style"]),i=L(e),s=i==="permanent"||("open"in e?e.open:e.defaultOpen)===!0,a=e.dismissible!==!1;return<div class={t.class}classList={{...t.classList,[P(i)]:!0,[C]:s,"cw-NavigationDrawer":!0}}style={t.style}>
6
+ <button aria-label={h}class="cw-NavigationDrawer-scrim"ref={n=>{this.#s=n;}}type="button"/>
7
+ <div class="cw-NavigationDrawer-content"ref={n=>{this.#y=n;}}>{this.props.content}</div>
8
+ </div>;}}function B(o,e){const[t,n]=R(o,["children","class","classList","style"]),i=L(e),s=i==="permanent"||("open"in e?e.open:e.defaultOpen)===!0,a=e.dismissible!==!1;return<div class={t.class}classList={{...t.classList,[P(i)]:!0,[C]:s,"cw-NavigationDrawer":!0}}style={t.style}>
9
9
  <nav{...n}aria-hidden={s?void 0:"true"}class="cw-NavigationDrawer-panel cw-elevationShadow"data-cw-navigation-kind={m(e)?"NavigationDrawer":void 0}hidden={!s}role="navigation"tabIndex={-1}>
10
10
  <div class="cw-NavigationDrawer-headline">{e.headline}</div>
11
11
  <div class="cw-NavigationDrawer-items">
@@ -16,10 +16,10 @@ import{splitProps as R,untrack as p}from"solid-js";import{isServer as D}from"sol
16
16
  <div class="cw-NavigationDrawer-content"inert={i==="modal"&&s}>
17
17
  {e.content}
18
18
  </div>
19
- </div>}const G=E(D?()=>B:S,()=>q),W=o=>_(o,m(o),()=>G(N(o,void 0,X)));function v(o){return e=><W{...e}variant={o}/>}const se=v("modal"),ae=v("dismissible"),re=v("permanent");class U extends b{#o;constructor(e){super(e,{styleElementIsFunction:!0}),this.#o=y("cw-drawer-section")}applyComponentProps(){const e=super.readProps(["label"]);e.labelChanged&&super.setAttribute("aria-labelledby",e.label===void 0?void 0:this.#o)}render(e){const t=this.#o;return<div class="cw-NavigationDrawerSection"role="group">
19
+ </div>;}const G=/* @__PURE__ */E(D?()=>B:S,()=>q),W=o=>_(o,m(o),()=>G(N(o,void 0,X)));function v(o){return e=><W{...e}variant={o}/>;}const se=/* @__PURE__ */v("modal"),ae=/* @__PURE__ */v("dismissible"),re=/* @__PURE__ */v("permanent");class U extends b{#o;constructor(e){super(e,{styleElementIsFunction:!0}),this.#o=y("cw-drawer-section");}applyComponentProps(){const e=super.readProps(["label"]);e.labelChanged&&super.setAttribute("aria-labelledby",e.label===void 0?void 0:this.#o);}render(e){const t=this.#o;return<div class="cw-NavigationDrawerSection"role="group">
20
20
  <div class="cw-NavigationDrawerSection-label"id={t}>{this.props.label}</div>
21
21
  {e}
22
- </div>}}function j(o,e){const t=y("cw-drawer-section");return<div{...o}aria-labelledby={e.label===void 0?void 0:t}classList={{...o.classList,"cw-NavigationDrawerSection":!0}}role="group">
22
+ </div>;}}function j(o,e){const t=y("cw-drawer-section");return<div{...o}aria-labelledby={e.label===void 0?void 0:t}classList={{...o.classList,"cw-NavigationDrawerSection":!0}}role="group">
23
23
  <div class="cw-NavigationDrawerSection-label"id={t}>{e.label}</div>
24
24
  {o.children}
25
- </div>}const Y=E(D?()=>j:S,()=>U),le=o=>Y(N(o,void 0,["label"]));export{ae as DismissibleNavigationDrawer,se as ModalNavigationDrawer,W as NavigationDrawer,q as NavigationDrawerController,le as NavigationDrawerSection,U as NavigationDrawerSectionController,re as PermanentNavigationDrawer};
25
+ </div>;}const Y=/* @__PURE__ */E(D?()=>j:S,()=>U),le=o=>Y(N(o,void 0,["label"]));export{ae as DismissibleNavigationDrawer,se as ModalNavigationDrawer,W as NavigationDrawer,q as NavigationDrawerController,le as NavigationDrawerSection,U as NavigationDrawerSectionController,re as PermanentNavigationDrawer};
@@ -1 +1 @@
1
- import"./navigation.css";import{LeadingIconTab as t,PrimaryTabRow as e,SecondaryTabRow as i,Tab as p,TabController as l,TabList as n,TabListController as g,TabPanel as b,TabPanelController as m,TabRow as T,Tabs as B,TabsController as s}from"./tabs";import{NavigationBar as c,FlexibleNavigationBar as N,NavigationBarItem as A,NavigationController as P,NavigationDrawerItem as S,NavigationItem as C,NavigationItemController as w,NavigationRail as x,NavigationRailItem as d,ShortNavigationBar as f,ShortNavigationBarItem as D,WideNavigationRailItem as F,WideNavigationRail as h}from"./navigation";import{DismissibleNavigationDrawer as y,ModalNavigationDrawer as R,NavigationDrawer as L,NavigationDrawerController as u,NavigationDrawerSection as V,NavigationDrawerSectionController as H,PermanentNavigationDrawer as M}from"./drawer";import{AppBarColumn as z,AppBarItem as E,AppBarLayoutController as O,AppBarRow as W,BottomAppBar as j,BottomAppBarController as q,CenterAlignedTopAppBar as G,LargeFlexibleTopAppBar as J,LargeTopAppBar as K,MediumFlexibleTopAppBar as Q,MediumTopAppBar as U,SmallTopAppBar as X,TopAppBar as Y,TopAppBarController as Z,TwoRowsTopAppBar as _}from"./app-bar";import{DockedToolbar as oo,FloatingToolbar as ro,FloatingToolbarController as ao,FloatingToolbarItem as to,HorizontalFloatingToolbar as eo,VerticalFloatingToolbar as io}from"./toolbar";import{DockedSearchBar as lo,SearchAppBar as no,SearchBar as go,SearchBarController as bo,SearchView as mo}from"./search";import{HorizontalScrollbar as Bo,Scrollbar as so,ScrollbarController as vo,ScrollField as co,ScrollFieldController as No,VerticalScrollbar as Ao}from"./scroll";export{z as AppBarColumn,E as AppBarItem,O as AppBarLayoutController,W as AppBarRow,j as BottomAppBar,q as BottomAppBarController,G as CenterAlignedTopAppBar,y as DismissibleNavigationDrawer,lo as DockedSearchBar,oo as DockedToolbar,N as FlexibleNavigationBar,ro as FloatingToolbar,ao as FloatingToolbarController,to as FloatingToolbarItem,eo as HorizontalFloatingToolbar,Bo as HorizontalScrollbar,J as LargeFlexibleTopAppBar,K as LargeTopAppBar,t as LeadingIconTab,Q as MediumFlexibleTopAppBar,U as MediumTopAppBar,R as ModalNavigationDrawer,c as NavigationBar,A as NavigationBarItem,P as NavigationController,L as NavigationDrawer,u as NavigationDrawerController,S as NavigationDrawerItem,V as NavigationDrawerSection,H as NavigationDrawerSectionController,C as NavigationItem,w as NavigationItemController,x as NavigationRail,d as NavigationRailItem,M as PermanentNavigationDrawer,e as PrimaryTabRow,co as ScrollField,No as ScrollFieldController,so as Scrollbar,vo as ScrollbarController,no as SearchAppBar,go as SearchBar,bo as SearchBarController,mo as SearchView,i as SecondaryTabRow,f as ShortNavigationBar,D as ShortNavigationBarItem,X as SmallTopAppBar,p as Tab,l as TabController,n as TabList,g as TabListController,b as TabPanel,m as TabPanelController,T as TabRow,B as Tabs,s as TabsController,Y as TopAppBar,Z as TopAppBarController,_ as TwoRowsTopAppBar,io as VerticalFloatingToolbar,Ao as VerticalScrollbar,h as WideNavigationRail,F as WideNavigationRailItem};
1
+ import"./navigation.css";import{LeadingIconTab as t,PrimaryTabRow as e,SecondaryTabRow as i,Tab as p,TabController as l,TabList as n,TabListController as g,TabPanel as b,TabPanelController as m,TabRow as T,Tabs as B,TabsController as s}from"./tabs";import{NavigationBar as c,FlexibleNavigationBar as N,NavigationBarItem as A,NavigationController as P,NavigationDrawerItem as S,NavigationItem as C,NavigationItemController as w,NavigationRail as x,NavigationRailItem as d,ShortNavigationBar as f,ShortNavigationBarItem as D,WideNavigationRailItem as F,WideNavigationRail as h}from"./navigation";import{DismissibleNavigationDrawer as y,ModalNavigationDrawer as R,NavigationDrawer as L,NavigationDrawerController as u,NavigationDrawerSection as V,NavigationDrawerSectionController as H,PermanentNavigationDrawer as M}from"./drawer";import{AppBarColumn as z,AppBarItem as E,AppBarLayoutController as O,AppBarRow as W,BottomAppBar as j,BottomAppBarController as q,CenterAlignedTopAppBar as G,LargeFlexibleTopAppBar as J,LargeTopAppBar as K,MediumFlexibleTopAppBar as Q,MediumTopAppBar as U,SmallTopAppBar as X,TopAppBar as Y,TopAppBarController as Z,TwoRowsTopAppBar as _}from"./app-bar";import{DockedToolbar as oo,FloatingToolbar as ro,FloatingToolbarController as ao,FloatingToolbarItem as to,HorizontalFloatingToolbar as eo,VerticalFloatingToolbar as io}from"./toolbar";import{DockedSearchBar as lo,SearchAppBar as no,SearchBar as go,SearchBarController as bo,SearchView as mo}from"./search";import{HorizontalScrollbar as Bo,Scrollbar as so,ScrollbarController as vo,ScrollField as co,ScrollFieldController as No,VerticalScrollbar as Ao}from"./scroll";export{z as AppBarColumn,E as AppBarItem,O as AppBarLayoutController,W as AppBarRow,j as BottomAppBar,q as BottomAppBarController,G as CenterAlignedTopAppBar,y as DismissibleNavigationDrawer,lo as DockedSearchBar,oo as DockedToolbar,N as FlexibleNavigationBar,ro as FloatingToolbar,ao as FloatingToolbarController,to as FloatingToolbarItem,eo as HorizontalFloatingToolbar,Bo as HorizontalScrollbar,J as LargeFlexibleTopAppBar,K as LargeTopAppBar,t as LeadingIconTab,Q as MediumFlexibleTopAppBar,U as MediumTopAppBar,R as ModalNavigationDrawer,c as NavigationBar,A as NavigationBarItem,P as NavigationController,L as NavigationDrawer,u as NavigationDrawerController,S as NavigationDrawerItem,V as NavigationDrawerSection,H as NavigationDrawerSectionController,C as NavigationItem,w as NavigationItemController,x as NavigationRail,d as NavigationRailItem,M as PermanentNavigationDrawer,e as PrimaryTabRow,co as ScrollField,No as ScrollFieldController,so as Scrollbar,vo as ScrollbarController,no as SearchAppBar,go as SearchBar,bo as SearchBarController,mo as SearchView,i as SecondaryTabRow,f as ShortNavigationBar,D as ShortNavigationBarItem,X as SmallTopAppBar,p as Tab,l as TabController,n as TabList,g as TabListController,b as TabPanel,m as TabPanelController,T as TabRow,B as Tabs,s as TabsController,Y as TopAppBar,Z as TopAppBarController,_ as TwoRowsTopAppBar,io as VerticalFloatingToolbar,Ao as VerticalScrollbar,h as WideNavigationRail,F as WideNavigationRailItem};