@pg-labs-incubator/cobweb 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/package.json +7 -4
  2. package/src/action/button.yaml +9 -0
  3. package/target/esbuild/action/action.css +1 -1
  4. package/target/esbuild/action/base.jsx +1 -1
  5. package/target/esbuild/action/button.jsx +6 -4
  6. package/target/esbuild/action/fab-menu-context.jsx +1 -1
  7. package/target/esbuild/action/fab-menu.jsx +3 -3
  8. package/target/esbuild/action/fab.jsx +3 -3
  9. package/target/esbuild/action/group.jsx +7 -7
  10. package/target/esbuild/action/icon-button.jsx +3 -3
  11. package/target/esbuild/action/index.jsx +1 -1
  12. package/target/esbuild/action/progress-button.css +1 -0
  13. package/target/esbuild/action/progress-button.jsx +4 -0
  14. package/target/esbuild/action/split-button.jsx +4 -4
  15. package/target/esbuild/color/contrast.jsx +1 -1
  16. package/target/esbuild/color/dynamic.jsx +1 -1
  17. package/target/esbuild/color/hct.jsx +1 -1
  18. package/target/esbuild/color/index.jsx +1 -1
  19. package/target/esbuild/color/palette.jsx +1 -1
  20. package/target/esbuild/color/scheme.jsx +1 -1
  21. package/target/esbuild/color/temperature.jsx +1 -1
  22. package/target/esbuild/container/card.jsx +1 -1
  23. package/target/esbuild/container/elevation-shadow.jsx +1 -1
  24. package/target/esbuild/container/index.jsx +1 -1
  25. package/target/esbuild/dom/client.jsx +1 -1
  26. package/target/esbuild/dom/index.jsx +1 -1
  27. package/target/esbuild/dom/server.jsx +1 -1
  28. package/target/esbuild/dom/types.jsx +1 -1
  29. package/target/esbuild/feedback/badge.jsx +6 -6
  30. package/target/esbuild/feedback/focus.jsx +1 -1
  31. package/target/esbuild/feedback/index.jsx +1 -1
  32. package/target/esbuild/feedback/loading.jsx +3 -3
  33. package/target/esbuild/feedback/observe.jsx +1 -1
  34. package/target/esbuild/feedback/progress.jsx +9 -9
  35. package/target/esbuild/feedback/snackbar.jsx +6 -6
  36. package/target/esbuild/feedback/tooltip.jsx +6 -6
  37. package/target/esbuild/icon/icon.jsx +1 -1
  38. package/target/esbuild/icon/index.jsx +1 -1
  39. package/target/esbuild/index.jsx +1 -1
  40. package/target/esbuild/input/autocomplete.jsx +2 -2
  41. package/target/esbuild/input/base.jsx +2 -2
  42. package/target/esbuild/input/date-picker.jsx +19 -19
  43. package/target/esbuild/input/date-time.jsx +3 -3
  44. package/target/esbuild/input/index.jsx +1 -1
  45. package/target/esbuild/input/paired-input.jsx +1 -1
  46. package/target/esbuild/input/picker-dialog.jsx +3 -3
  47. package/target/esbuild/input/select.jsx +4 -4
  48. package/target/esbuild/input/slider.jsx +7 -7
  49. package/target/esbuild/input/text-field.jsx +4 -4
  50. package/target/esbuild/input/time-picker.jsx +5 -5
  51. package/target/esbuild/motion/follow-height.jsx +1 -0
  52. package/target/esbuild/motion/frame.jsx +1 -1
  53. package/target/esbuild/motion/index.jsx +1 -1
  54. package/target/esbuild/motion/material.jsx +1 -1
  55. package/target/esbuild/motion/motion.jsx +1 -1
  56. package/target/esbuild/motion/spring.jsx +1 -1
  57. package/target/esbuild/motion/transition.jsx +1 -1
  58. package/target/esbuild/motion/velocity.jsx +1 -1
  59. package/target/esbuild/navigation/app-bar.jsx +8 -8
  60. package/target/esbuild/navigation/base.jsx +1 -1
  61. package/target/esbuild/navigation/drawer.jsx +7 -7
  62. package/target/esbuild/navigation/index.jsx +1 -1
  63. package/target/esbuild/navigation/navigation.jsx +12 -12
  64. package/target/esbuild/navigation/scroll.jsx +1 -1
  65. package/target/esbuild/navigation/search.jsx +4 -4
  66. package/target/esbuild/navigation/tabs.jsx +3 -3
  67. package/target/esbuild/navigation/toolbar.jsx +3 -3
  68. package/target/esbuild/selection/base.jsx +1 -1
  69. package/target/esbuild/selection/checkbox.jsx +4 -4
  70. package/target/esbuild/selection/chip.jsx +5 -5
  71. package/target/esbuild/selection/index.jsx +1 -1
  72. package/target/esbuild/selection/radio.jsx +3 -3
  73. package/target/esbuild/selection/segmented.jsx +4 -4
  74. package/target/esbuild/selection/switch.jsx +3 -3
  75. package/target/esbuild/shape/corner-rounding.jsx +1 -1
  76. package/target/esbuild/shape/cubic.jsx +1 -1
  77. package/target/esbuild/shape/index.jsx +1 -1
  78. package/target/esbuild/shape/material-shapes.jsx +1 -1
  79. package/target/esbuild/shape/morph.jsx +1 -1
  80. package/target/esbuild/shape/path.jsx +1 -1
  81. package/target/esbuild/shape/point.jsx +1 -1
  82. package/target/esbuild/shape/rounded-polygon.jsx +1 -1
  83. package/target/esbuild/shape/shapes.jsx +1 -1
  84. package/target/esbuild/spacing/index.jsx +1 -1
  85. package/target/esbuild/state/component.jsx +1 -1
  86. package/target/esbuild/state/controller.jsx +1 -1
  87. package/target/esbuild/state/index.jsx +1 -1
  88. package/target/esbuild/state/ripple.jsx +1 -1
  89. package/target/esbuild/state/state.jsx +1 -1
  90. package/target/esbuild/state/style.jsx +1 -1
  91. package/target/esbuild/surface/carousel-layout.jsx +1 -1
  92. package/target/esbuild/surface/carousel.jsx +2 -2
  93. package/target/esbuild/surface/dialog.jsx +5 -5
  94. package/target/esbuild/surface/divider.jsx +1 -1
  95. package/target/esbuild/surface/drag.jsx +1 -1
  96. package/target/esbuild/surface/gestures.jsx +3 -3
  97. package/target/esbuild/surface/index.jsx +1 -1
  98. package/target/esbuild/surface/interactive.jsx +1 -1
  99. package/target/esbuild/surface/list-patterns.jsx +3 -3
  100. package/target/esbuild/surface/list.jsx +2 -2
  101. package/target/esbuild/surface/menu.jsx +3 -3
  102. package/target/esbuild/surface/scaffold.jsx +7 -7
  103. package/target/esbuild/surface/sheet.jsx +5 -5
  104. package/target/esbuild/surface/side-sheet.jsx +2 -2
  105. package/target/esbuild/surface/slots.jsx +1 -1
  106. package/target/esbuild/surface/surface.jsx +1 -1
  107. package/target/esbuild/text/index.jsx +1 -1
  108. package/target/esbuild/text/text.jsx +2 -2
  109. package/target/esbuild/text/typography.jsx +1 -1
  110. package/target/esbuild/text/visually-hidden.css +1 -0
  111. package/target/esbuild/text/visually-hidden.jsx +1 -0
  112. package/target/esbuild/util/box-side.jsx +1 -1
  113. package/target/esbuild/util/debug.jsx +1 -1
  114. package/target/esbuild/util/dom.jsx +1 -1
  115. package/target/esbuild/util/environment.jsx +1 -0
  116. package/target/esbuild/util/event.jsx +1 -1
  117. package/target/esbuild/util/index.jsx +1 -1
  118. package/target/esbuild/util/preconditions.jsx +1 -1
  119. package/target/esbuild/util/reactive.jsx +1 -1
  120. package/target/node/color.js +1 -0
  121. package/target/node/shape.js +1 -0
  122. package/target/tsc/action/base.d.ts +27 -8
  123. package/target/tsc/action/index.d.ts +3 -1
  124. package/target/tsc/action/progress-button.css.d.ts +3 -0
  125. package/target/tsc/action/progress-button.d.ts +46 -0
  126. package/target/tsc/motion/follow-height.d.ts +51 -0
  127. package/target/tsc/motion/index.d.ts +7 -3
  128. package/target/tsc/motion/spring.d.ts +3 -3
  129. package/target/tsc/shape/index.d.ts +1 -1
  130. package/target/tsc/shape/material-shapes.d.ts +56 -0
  131. package/target/tsc/shape/path.d.ts +16 -0
  132. package/target/tsc/text/index.d.ts +5 -2
  133. package/target/tsc/text/visually-hidden.css.d.ts +3 -0
  134. package/target/tsc/text/visually-hidden.d.ts +33 -0
  135. package/target/tsc/util/environment.d.ts +14 -0
  136. package/target/tsc/util/index.d.ts +2 -1
  137. package/target/tsc/util/preconditions.d.ts +0 -14
@@ -0,0 +1 @@
1
+ var ye=.008856451679035631,pe=24389/27,He=1.02117770275752,Ae=.9863077294280124,Le=.9339605082802299,Q=.3884814537800353,be=29.980997194447333,q=1.0169191804458755,_e=1.3173270022537198,Ie=.759112960023724,Ne=.8834525670408592,Ke=1.1319226830134397,Be=5,ze=8,k=he(0,256),Ye=he(.5,255),je=new Float64Array(3),Ue=new Float64Array(3),Ce=new Float64Array(3);function Ge(e){let n=e/255;return n<=.040449936?n/12.92*100:Math.pow((n+.055)/1.055,2.4)*100}function he(e,n){let r=new Float64Array(n);for(let o=0;o<n;o++)r[o]=Ge(e+o);return r}function N(e){let n=e/100;return(n<=.0031308?n*12.92:1.055*Math.pow(n,1/2.4)-.055)*255}function X(e){return x(0,255,Math.round(N(e)))}function Se(e,n,r){return(4278190080|X(e)<<16|X(n)<<8|X(r))>>>0}function K(e){return e>ye?Math.pow(e,1/3):(pe*e+16)/116}function $e(e){let n=e*e*e;return n>ye?n:(116*e-16)/pe}function xe(e){return e<0?-1:e===0?0:1}function P(e){let n=Math.pow(Math.abs(e),.42);return xe(e)*400*n/(n+27.13)}function ee(e){let n=Math.abs(e);return xe(e)*Math.pow(Math.max(0,27.13*n/(400-n)),1/.42)}function fe(e,n,r){let o=P(.001200833568784504*e+.002389694492170889*n+.0002795742885861124*r),t=P(.0005891086651375999*e+.0029785502573438758*n+.0003270666104008398*r),a=P(.00010146692491640572*e+.0005364214359186694*n+.0032979401770712076*r);return Math.atan2((o+t-2*a)/9,(11*o-12*t+a)/11)}function me(e){return(e+Math.PI*8)%(Math.PI*2)}function re(e,n,r){return me(n-e)<me(r-e)}function We(e,n){let r=Ce,o=n%4<=1?0:100,t=n%2===0?0:100,a;return n<4?(a=(e-o*.7152-t*.0722)/.2126,r[0]=a,r[1]=o,r[2]=t):n<8?(a=(e-t*.2126-o*.0722)/.7152,r[0]=t,r[1]=a,r[2]=o):(a=(e-o*.2126-t*.7152)/.0722,r[0]=o,r[1]=t,r[2]=a),a>=0&&a<=100}function Xe(e,n,r){let o=3846.153846153846*(.25*(Math.cos(e+2)+3.8))*q,t=Math.sin(e),a=Math.cos(e),i=Math.sqrt(r)*11;for(let c=0;;c++){let u=i/100,s=n===0||i===0?0:n/Math.sqrt(u),d=Math.pow(s*Ke,1/.9),m=be*Math.pow(u,Ie)/q,y=23*(m+.305)*d/(23*o+11*d*a+108*d*t),b=y*a,C=y*t,f=ee((460*m+451*b+288*C)/1403),p=ee((460*m-891*b-261*C)/1403),M=ee((460*m-220*b-6300*C)/1403),V=1373.2198709594231*f-1100.4251190754821*p-7.278681089101213*M,G=-271.815969077903*f+559.6580465940733*p-32.46047482791194*M,$=1.9622899599665666*f-57.173814538844006*p+308.7233197812385*M;if(V<0||G<0||$<0)return 0;let W=.2126*V+.7152*G+.0722*$;if(W<=0)return 0;if(c===Be-1||Math.abs(W-r)<.002)return V>100.01||G>100.01||$>100.01?0:Se(V,G,$);i-=(W-r)*i/(2*W)}}function qe(e,n){let r=je,o=Ue,t=Ce,a=0,i=0,c=!1,u=!1;for(let s=0;s<12;s++){if(!We(n,s))continue;let d=fe(t[0],t[1],t[2]);c?(!u||re(a,d,i))&&(u=!0,re(a,e,d)?(o.set(t),i=d):(r.set(t),a=d)):(r.set(t),o.set(t),a=d,i=d,c=!0)}for(let s=0;s<3;s++){let d=r[s],m=o[s];if(d===m)continue;let y=d<m?Math.floor(N(d)-.5):Math.ceil(N(d)-.5),b=d<m?Math.ceil(N(m)-.5):Math.floor(N(m)-.5);for(let C=0;C<ze&&Math.abs(b-y)>1;C++){let f=Math.floor((y+b)/2),p=(Ye[f]-r[s])/(o[s]-r[s]);for(let V=0;V<3;V++)t[V]=r[V]+(o[V]-r[V])*p;let M=fe(t[0],t[1],t[2]);re(a,e,M)?(o.set(t),b=f):(r.set(t),a=M,y=f)}}return Se((r[0]+o[0])/2,(r[1]+o[1])/2,(r[2]+o[2])/2)}function x(e,n,r){return r<e?e:r>n?n:r}function S(e){let n=e%360;return n<0?n+360:n}function H(e){return 100*$e((e+16)/116)}function ne(e){return K(e/100)*116-16}function Re(e){let n=k[e>>16&255],r=k[e>>8&255],o=k[e&255],t=K((.41233895*n+.35762064*r+.18051042*o)/95.047),a=K((.2126*n+.7152*r+.0722*o)/100),i=K((.01932141*n+.11916382*r+.95034478*o)/108.883);return[116*a-16,500*(t-a),200*(a-i)]}function A(e){let n=k[e>>16&255],r=k[e>>8&255],o=k[e&255],t=.41233895*n+.35762064*r+.18051042*o,a=.2126*n+.7152*r+.0722*o,i=.01932141*n+.11916382*r+.95034478*o,c=P(Q*(He*(.401288*t+.650173*a-.051461*i))/100),u=P(Q*(Ae*(-.250268*t+1.204414*a+.045854*i))/100),s=P(Q*(Le*(-.002079*t+.048952*a+.953127*i))/100),d=(11*c-12*u+s)/11,m=(c+u-2*s)/9,y=S(Math.atan2(m,d)*180/Math.PI),b=100*Math.pow((40*c+20*u+s)/20*q/be,_e),C=.25*(Math.cos((y<20.14?y+360:y)*Math.PI/180+2)+3.8),f=5e4/13*C*q*Math.sqrt(d*d+m*m)/((20*c+20*u+21*s)/20+.305);return{argb:e,hue:y,chroma:Math.pow(f,.9)*Ne*Math.sqrt(b/100),tone:116*K(a/100)-16}}function T(e,n,r){let o=H(r);if(n<1e-4||r<1e-4||r>99.9999){let i=X(o);return(4278190080|i<<16|i<<8|i)>>>0}let t=S(e)/180*Math.PI,a=Xe(t,n,o);return a!==0?a:qe(t,o)}function w(e,n,r){return A(T(e,n,r))}function oe(e){return`#${(e&16777215).toString(16).padStart(6,"0")}`}var Fe=.04;function te(e,n){return e>n?(e+5)/(n+5):(n+5)/(e+5)}function E(e,n){return te(H(x(0,100,e)),H(x(0,100,n)))}function ae(e,n){if(e<0||e>100)return-1;let r=H(e),o=n*(r+5)-5,t=te(o,r);if(t<n&&Math.abs(t-n)>Fe)return-1;let a=ne(o)+.4;return a<0||a>100?-1:a}function ie(e,n){if(e<0||e>100)return-1;let r=H(e),o=(r+5)/n-5,t=te(r,o);if(t<n&&Math.abs(t-n)>Fe)return-1;let a=ne(o)-.4;return a<0||a>100?-1:a}function Z(e){return Math.round(e)<60}function B(e,n){let r=ae(e,n),o=ie(e,n),t=r<0?100:r,a=o<0?0:o,i=E(t,e),c=E(a,e);return Z(e)?i>=n||i>=c||Math.abs(i-c)<.1&&i<n&&c<n?t:a:c>=n||c>=i?a:t}function z(e){return e>=105&&e<125}function ce(e,n,r){if(r!==99||!z(e))return T(e,n,r);let o=T(e,n,98),t=T(e,n,100),a=4278190080;for(let i of[16,8,0])a|=Math.round(((o>>i&255)+(t>>i&255))/2)<<i;return a>>>0}function Ze(e){let n=Math.round(e.hue);return n>=90&&n<=111&&Math.round(e.chroma)>16&&Math.round(e.tone)<65}function le(e){return Ze(e)?w(e.hue,e.chroma,70):e}var D=361;function Je(e){let[,n,r]=Re(e),o=S(Math.atan2(r,n)*180/Math.PI),t=Math.sqrt(n*n+r*r);return-.5+.02*Math.pow(t,1.07)*Math.cos(S(o-50)*Math.PI/180)}function Ve(e){let n=new Uint32Array(D),r=new Float64Array(D+1),o=0,t=0;for(let a=0;a<D;a++)n[a]=T(a,e.chroma,e.tone);for(let a=0;a<=D;a++){let i=Je(a<D?n[a]:e.argb);r[a]=i,i<r[o]&&(o=a),i>=r[t]&&(t=a)}return{source:e,colors:n,temperatures:r,coldest:o,warmest:t}}function J(e,n){return n<D?A(e.colors[n]):e.source}function Y(e,n){let{temperatures:r,coldest:o,warmest:t}=e,a=r[t]-r[o];return a===0?.5:(r[n]-r[o])/a}function ge(e,n,r){return n<r?n<=e&&e<=r:n<=e||e<=r}function ve(e){let n=Ve(e),r=Math.round(e.hue),o=Y(n,r),t=0;for(let c=1;c<360;c++){let u=Y(n,(r+c)%360);t+=Math.abs(u-o),o=u}let a=t/6,i=0;o=Y(n,r);for(let c=1;;c++){let u=(r+c)%360,s=Y(n,u);if(i+=Math.abs(s-o),i>=a)return J(n,u);o=s}}function Te(e){let n=Ve(e),{temperatures:r,coldest:o,warmest:t}=n,a=J(n,o).hue,i=J(n,t).hue,c=ge(e.hue,a,i),u=c?i:a,s=c?a:i,d=1-Y(n,D),m=Math.round(e.hue),y=1e3;for(let b=0;b<=360;b++){let C=S(u+b);if(!ge(C,u,s))continue;let f=Math.round(C),p=Math.abs(d-(r[f]-r[o])/(r[t]-r[o]));p<y&&(y=p,m=f)}return J(n,m)}var j={error:["error","onError","errorContainer","onErrorContainer"],primary:["primary","onPrimary","primaryContainer","onPrimaryContainer","primaryFixed","primaryFixedDim","onPrimaryFixed","onPrimaryFixedVariant","inversePrimary"],secondary:["secondary","onSecondary","secondaryContainer","onSecondaryContainer","secondaryFixed","secondaryFixedDim","onSecondaryFixed","onSecondaryFixedVariant"],tertiary:["tertiary","onTertiary","tertiaryContainer","onTertiaryContainer","tertiaryFixed","tertiaryFixedDim","onTertiaryFixed","onTertiaryFixedVariant"]},Qe=dr(),L=10,er=[[0,18],[41,15],[61,10],[101,12],[131,15],[181,18],[251,15],[301,12]],rr=[[0,35],[41,30],[61,20],[101,25],[131,30],[181,35],[251,30],[301,25]],nr=[[0,45],[21,95],[51,45],[121,20],[151,45],[191,90],[271,45],[321,45]],or=[[0,120],[21,120],[51,20],[121,45],[151,20],[191,15],[271,20],[321,120]],tr=[[0,-40],[20,48],[71,-32],[161,40],[333,-32]],ar=[[0,-32],[38,26],[105,10],[161,-39],[204,24],[278,-15],[333,-32]],Oe=[[0,-14],[38,10],[105,-14],[140,10],[333,-14]],ir=[[0,-72],[38,35],[71,24],[105,-24],[140,62],[161,50],[253,62],[333,-72]],cr=[[0,-160],[105,155],[140,-100],[204,96],[253,-96],[278,-156],[300,-165],[333,-160]],lr=[[0,-165],[105,160],[140,-105],[204,101],[253,-101],[278,-160],[300,-170],[333,-165]],sr=[[0,10],[71,0],[124,10],[253,0],[278,10],[300,0]],ur=[[0,12],[3,22],[13,32],[23,12],[33,22],[43,32],[153,22],[273,12]];function dr(){let e=new Map;for(let n of Object.keys(j))j[n].forEach((r,o)=>e.set(r,[n,o]));return e}function fr(e){return e>=170&&e<207}function Ee(e){return e>=250&&e<270}function De(e,n){let r=0;for(let[o,t]of e)n>=o&&(r=t);return S(r)}function g(e,n){return S(n+De(e,n))}function l(e,n){return{hue:e,chroma:n,lightTone:void 0,darkTone:void 0}}function mr(e,n){let{hue:r,chroma:o}=e,t=l(25,84);switch(n){case"content":case"fidelity":{let a=le(n==="content"?ve(e):Te(e));return{primary:l(r,o),secondary:l(r,Math.max(o-32,o*.5)),tertiary:l(a.hue,a.chroma),error:t,neutral:l(r,o/8),neutralVariant:l(r,o/8+4)}}case"expressive":return{primary:l(S(r+240),40),secondary:l(g(nr,r),24),tertiary:l(g(or,r),32),error:t,neutral:l(S(r+15),8),neutralVariant:l(S(r+15),12)};case"fruitSalad":return{primary:l(S(r-50),48),secondary:l(S(r-50),36),tertiary:l(r,36),error:t,neutral:l(r,10),neutralVariant:l(r,16)};case"monochrome":return{primary:l(r,0),secondary:l(r,0),tertiary:l(r,0),error:t,neutral:l(r,0),neutralVariant:l(r,0)};case"neutral":return{primary:l(r,12),secondary:l(r,8),tertiary:l(r,16),error:t,neutral:l(r,2),neutralVariant:l(r,2)};case"rainbow":return{primary:l(r,48),secondary:l(r,16),tertiary:l(S(r+60),24),error:t,neutral:l(r,0),neutralVariant:l(r,0)};case"tonalSpot":return{primary:l(r,36),secondary:l(r,16),tertiary:l(S(r+60),24),error:t,neutral:l(r,6),neutralVariant:l(r,8)};case"vibrant":return{primary:l(r,200),secondary:l(g(er,r),24),tertiary:l(g(rr,r),32),error:t,neutral:l(r,10),neutralVariant:l(r,12)}}}function yr(e,n,r){let o=De(ur,e);switch(n){case"expressive":{let t=g(sr,e);return{primary:l(e,r?36:48),secondary:l(g(cr,e),r?16:24),tertiary:l(g(lr,e),48),error:l(o,64),neutral:l(t,r?z(t)?6:14:18)}}case"neutral":return{primary:l(e,Ee(e)?12:8),secondary:l(e,Ee(e)?6:4),tertiary:l(g(ar,e),20),error:l(o,50),neutral:l(e,1.4)};case"tonalSpot":return{primary:l(e,r?26:32),secondary:l(e,16),tertiary:l(g(tr,e),28),error:l(o,60),neutral:l(e,5)};case"vibrant":return{primary:l(e,74),secondary:l(g(Oe,e),56),tertiary:l(g(ir,e),56),error:l(o,80),neutral:l(g(Oe,e),28)}}}function se(e,n,r){return(1-r)*e+r*n}function v(e,n){let[r,o,t,a]=e;return n<=-1?r:n<0?se(r,o,n+1):n<.5?se(o,t,n/.5):n<1?se(t,a,(n-.5)/.5):a}function ue(e,n,r){let o=r?-1:1,t=r?100:0,a=w(e,n,t).chroma,i=t;for(;a<n&&t>=0&&t<=100;){t+=o;let c=w(e,n,t).chroma;a<c&&(a=c,i=t)}return i}function h(e,n,r){return e.lightTone??=ue(e.hue,e.chroma,!0),x(n,r,e.lightTone)}function _(e,n,r){return e.darkTone??=ue(e.hue,e.chroma,!1),x(n,r,e.darkTone)}function pr(e,n,r){let{hue:o,chroma:t}=n,a=e.isDark?1:-1,i=w(o,t,r).chroma,c=i,u=r;for(;i<t;){u+=a;let s=w(o,t,u).chroma;if(c>s||Math.abs(s-t)<.4)break;Math.abs(s-t)<Math.abs(i-t)&&(i=s),c=Math.max(c,s)}return u}function br(e){return e.fixed??=!e.isDark&&e.contrastLevel===0?e:{...e,isDark:!1,contrastLevel:0,definitions:new Map,tones:new Map,fixed:void 0},e.fixed}function F(e){return e.isDark?"surfaceBright":"surfaceDim"}function Cr(e,n,r){let{isDark:o,palettes:t,source:a,variant:i}=e,c=i==="monochrome",u=i==="content"||i==="fidelity",s=t[n],d=j[n];switch(r){case 0:return c&&n==="primary"?o?100:0:c&&n==="tertiary"?o?90:25:o?80:40;case 1:return c&&n==="secondary"?o?10:100:c&&n!=="error"?o?10:90:o?20:100;case 2:return u&&n==="primary"?a.tone:u&&n==="secondary"?pr(e,s,o?30:90):u&&n==="tertiary"?le(A(ce(s.hue,s.chroma,a.tone))).tone:c&&n==="primary"?o?85:25:c&&n==="secondary"?o?30:85:c&&n==="tertiary"?o?60:49:o?30:90;case 3:return u&&n!=="error"?B(O(e,d[2]).tone,4.5):c&&(n==="primary"||n==="tertiary")?o?0:100:c?o?90:10:o?90:30;case 4:return c?n==="secondary"?80:40:90;case 5:return c?n==="secondary"?70:30:80;case 6:return c&&n!=="secondary"?100:10;case 7:return c?n==="secondary"?25:90:30;case 8:return o?40:80}}function hr(e,n,r){let o=j[n],t=e.palettes[n],a=Cr(e,n,r);switch(r){case 0:case 2:return{palette:t,tone:a,background:F(e),curve:r===0?[3,4.5,7,7]:[1,1,3,4.5],pair:{nearer:o[2],farther:o[0],together:!1}};case 1:return{palette:t,tone:a,background:o[0],curve:[4.5,7,11,21]};case 3:return{palette:t,tone:a,background:o[2],curve:[3,4.5,7,11]};case 4:case 5:{let i=o[4],c=o[5];return{palette:t,tone:a,background:F(e),curve:[1,1,3,4.5],pair:{nearer:e.isDark?c:i,farther:e.isDark?i:c,together:!0}}}case 6:case 7:return{palette:t,tone:a,background:o[5],secondBackground:o[4],curve:r===6?[4.5,7,11,21]:[3,4.5,7,11]};case 8:return{palette:t,tone:a,background:"inverseSurface",curve:[3,4.5,7,7]}}}function Sr(e,n){let{contrastLevel:r,isDark:o}=e,{neutral:t,primary:a}=e.palettes,i=e.palettes.neutralVariant;switch(n){case"background":case"surface":return{palette:t,tone:o?6:98};case"surfaceDim":return{palette:t,tone:o?6:v([87,87,80,75],r)};case"surfaceBright":return{palette:t,tone:o?v([24,24,29,34],r):98};case"surfaceContainerLowest":return{palette:t,tone:o?v([4,4,2,0],r):100};case"surfaceContainerLow":return{palette:t,tone:v(o?[10,10,11,12]:[96,96,96,95],r)};case"surfaceContainer":return{palette:t,tone:v(o?[12,12,16,20]:[94,94,92,90],r)};case"surfaceContainerHigh":return{palette:t,tone:v(o?[17,17,21,25]:[92,92,88,85],r)};case"surfaceContainerHighest":return{palette:t,tone:v(o?[22,22,26,30]:[90,90,84,80],r)};case"surfaceVariant":return{palette:i,tone:o?30:90};case"inverseSurface":return{palette:t,tone:o?90:20};case"surfaceTint":return{palette:a,tone:o?80:40};case"onBackground":return{palette:t,tone:o?90:10,background:"background",curve:[3,3,4.5,7]};case"onSurface":return{palette:t,tone:o?90:10,background:F(e),curve:[4.5,7,11,21]};case"onSurfaceVariant":return{palette:i,tone:o?80:30,background:F(e),curve:[3,4.5,7,11]};case"inverseOnSurface":return{palette:t,tone:o?20:95,background:"inverseSurface",curve:[4.5,7,11,21]};case"outline":return{palette:i,tone:o?60:50,background:F(e),curve:[1.5,3,4.5,7]};case"outlineVariant":return{palette:i,tone:o?30:80,background:F(e),curve:[1,1,3,4.5]};default:return{palette:t,tone:0}}}function I(e,n,r,o,t){return e.variant==="neutral"?n:e.variant==="tonalSpot"?r:e.variant==="expressive"?o:t}function we(e,n,r){let{isDark:o,variant:t}=e,a=e.palettes[n],i=fr(a.hue);if(r===2)switch(n){case"error":return o?_(a,30,93):h(a,0,90);case"primary":return t==="neutral"?o?30:90:t==="tonalSpot"&&o?_(a,35,93):t==="tonalSpot"?h(a,0,90):t==="expressive"&&o?h(a,30,93):t==="expressive"?h(a,78,i?88:90):o?_(a,66,93):h(a,66,i?88:93);case"secondary":return t==="vibrant"&&o?_(a,30,40):t==="vibrant"?h(a,84,90):t==="expressive"?o?15:h(a,90,95):o?25:90;case"tertiary":return t==="neutral"?h(a,0,o?93:96):t==="tonalSpot"?h(a,0,o?93:100):t==="expressive"&&i?h(a,75,88):t==="expressive"?h(a,75,o?93:100):o?h(a,0,93):h(a,72,100)}switch(n){case"error":return o?_(a,0,98):h(a,0,100);case"primary":return t==="neutral"?o?80:40:t==="tonalSpot"?o?80:h(a,0,100):t==="expressive"&&z(a.hue)?h(a,0,25):h(a,0,i?88:98);case"secondary":return t==="neutral"&&o?_(a,0,98):t==="vibrant"?h(a,0,o?90:98):o?80:h(a,0,100);case"tertiary":return h(a,0,i&&(t==="expressive"||t==="vibrant")?88:o?98:100)}}function xr(e,n,r){let o=j[n],t=e.palettes[n],a=o[2],i=o[5];switch(r){case 0:{let c=we(e,n,0),u=R(e,a);return{palette:t,tone:e.isDark?x(u+5,100,c):x(0,u-5,c),background:F(e),curve:[4.5,4.5,7,11],isBackground:!0}}case 1:return{palette:t,tone:R(e,o[0]),background:o[0],curve:[6,6,7,11]};case 2:return{palette:t,tone:we(e,n,2),background:F(e),curve:e.contrastLevel>0?[1.5,1.5,3,5.5]:void 0,isBackground:!0};case 4:return{palette:t,tone:R(br(e),a),background:F(e),curve:e.contrastLevel>0?[1.5,1.5,3,5.5]:void 0,isBackground:!0};case 3:return{palette:t,tone:R(e,a),background:a,curve:n==="error"?[4.5,4.5,7,11]:[6,6,7,11]};case 5:return{palette:t,tone:x(0,100,R(e,o[4])-5)};case 6:case 7:return{palette:t,tone:R(e,i),background:i,curve:r===6?[7,7,11,21]:[4.5,4.5,7,11]};case 8:return{palette:t,tone:h(t,0,100),background:"inverseSurface",curve:[6,6,7,11]}}}function Rr(e,n){let{isDark:r,variant:o}=e,t=e.palettes.neutral,a=z(t.hue),i=o==="vibrant",c=I(e,2.2,1.7,a?r?3:2.3:1.6,1);switch(n){case"background":return O(e,"surface");case"surfaceVariant":return O(e,"surfaceContainerHighest");case"surfaceTint":return O(e,"primary");case"surface":return{palette:t,tone:r?4:a?99:i?97:98};case"surfaceDim":case"surfaceBright":{let u=I(e,2.5,1.7,a?2.7:1.75,1.36);return n==="surfaceDim"?{palette:t,chromaFactor:r?1:u,tone:r?4:a?90:i?85:87}:{palette:t,chromaFactor:r?u:1,tone:r?18:a?99:i?97:98}}case"surfaceContainerLowest":return{palette:t,tone:r?0:100};case"surfaceContainerLow":return{palette:t,chromaFactor:I(e,1.3,1.25,a?1.3:1.15,1.08),tone:r?6:a?98:i?95:96};case"surfaceContainer":return{palette:t,chromaFactor:I(e,1.6,1.4,a?1.6:1.3,1.15),tone:r?9:a?96:i?92:94};case"surfaceContainerHigh":return{palette:t,chromaFactor:I(e,1.9,1.5,a?1.95:1.45,1.22),tone:r?12:a?94:i?90:92};case"surfaceContainerHighest":return{palette:t,chromaFactor:I(e,2.2,1.7,a?2.3:1.6,1.29),tone:r?15:a?92:i?88:90};case"inverseSurface":return{palette:t,tone:r?98:4};case"onBackground":return{...O(e,"onSurface"),tone:R(e,"onSurface")};case"onSurface":{let u=i?x(0,100,ue(t.hue,t.chroma*1.1,!0)):R(e,F(e));return{palette:t,chromaFactor:c,tone:u,background:F(e),curve:r?[11,11,21,21]:[9,9,11,21]}}case"onSurfaceVariant":case"outline":case"outlineVariant":return{palette:t,chromaFactor:c,tone:R(e,F(e)),background:F(e),curve:n==="outline"?[3,3,4.5,7]:n==="outlineVariant"?[1.5,1.5,3,5.5]:r?[6,6,7,11]:[4.5,4.5,7,11]};case"inverseOnSurface":return{palette:t,tone:R(e,"inverseSurface"),background:"inverseSurface",curve:[7,7,11,21]};default:return{palette:t,tone:0}}}function O(e,n){let r=e.definitions.get(n);if(r===void 0){let o=Qe.get(n),t=e.specVersion==="2021";r=o===void 0&&t?Sr(e,n):o===void 0?Rr(e,n):t?hr(e,...o):xr(e,...o),e.definitions.set(n,r)}return r}function Fr(e,n,r,o){let{contrastLevel:t,isDark:a}=e,{nearer:i,farther:c,together:u}=o,s=a?1:-1,d=R(e,r.background),m=O(e,i),y=O(e,c),b=v(m.curve,t),C=v(y.curve,t),f=m.tone,p=y.tone;return(t<0||E(d,f)<b)&&(f=B(d,b)),(t<0||E(d,p)<C)&&(p=B(d,C)),(p-f)*s<L&&(p=x(0,100,f+L*s),(p-f)*s<L&&(f=x(0,100,p-L*s))),f>=50&&f<60||u&&p>=50&&p<60?(f=a?60:49,p=a?Math.max(p,f+L):Math.min(p,f-L)):p>=50&&p<60&&(p=a?60:49),n===i?f:p}function gr(e,n){let r=O(e,n),{background:o,curve:t,pair:a,secondBackground:i}=r,c=e.contrastLevel;if(a!==void 0)return Fr(e,n,r,a);if(o===void 0||t===void 0)return r.tone;let u=R(e,o),s=v(t,c),d=c<0||E(u,r.tone)<s?B(u,s):r.tone;if(r.isBackground&&(d=d>=57?x(65,100,d):x(0,49,d)),i!==void 0){let m=R(e,i),y=Math.max(u,m),b=Math.min(u,m);if(E(y,d)<s||E(b,d)<s){let C=ae(y,s),f=ie(b,s);d=Z(u)||Z(m)?C<0?100:C:C<0!=f<0?C<0?f:C:f<0?0:f}}return d}function R(e,n){let r=e.tones.get(n);return r===void 0&&(r=gr(e,n),e.tones.set(n,r)),r}function Me(e,n,r,o,t){let a=A(e),i=t==="2025"?yr(a.hue,n,r):void 0;return{specVersion:i!==void 0?"2025":"2021",variant:n,isDark:r,contrastLevel:o,source:a,palettes:i??mr(a,n),definitions:new Map,tones:new Map,fixed:void 0}}function ke(e,n){let{chromaFactor:r,palette:o}=O(e,n),t=R(e,n);return e.specVersion==="2021"?ce(o.hue,o.chroma,t):T(o.hue,o.chroma*(r??1),t)}var de=Object.freeze([{role:"primary",cssRole:"primary-fill"},{role:"onPrimary",cssRole:"primary-onFill"},{role:"primaryContainer",cssRole:"primary-container"},{role:"onPrimaryContainer",cssRole:"primary-onContainer"},{role:"inversePrimary",cssRole:"primary-inverseFill"},{role:"primaryFixed",cssRole:"primary-fixedFill"},{role:"primaryFixedDim",cssRole:"primary-fixedFillDim"},{role:"onPrimaryFixed",cssRole:"primary-onFixedFill"},{role:"onPrimaryFixedVariant",cssRole:"primary-onFixedFillVariant"},{role:"secondary",cssRole:"secondary-fill"},{role:"onSecondary",cssRole:"secondary-onFill"},{role:"secondaryContainer",cssRole:"secondary-container"},{role:"onSecondaryContainer",cssRole:"secondary-onContainer"},{role:"secondaryFixed",cssRole:"secondary-fixedFill"},{role:"secondaryFixedDim",cssRole:"secondary-fixedFillDim"},{role:"onSecondaryFixed",cssRole:"secondary-onFixedFill"},{role:"onSecondaryFixedVariant",cssRole:"secondary-onFixedFillVariant"},{role:"tertiary",cssRole:"tertiary-fill"},{role:"onTertiary",cssRole:"tertiary-onFill"},{role:"tertiaryContainer",cssRole:"tertiary-container"},{role:"onTertiaryContainer",cssRole:"tertiary-onContainer"},{role:"tertiaryFixed",cssRole:"tertiary-fixedFill"},{role:"tertiaryFixedDim",cssRole:"tertiary-fixedFillDim"},{role:"onTertiaryFixed",cssRole:"tertiary-onFixedFill"},{role:"onTertiaryFixedVariant",cssRole:"tertiary-onFixedFillVariant"},{role:"error",cssRole:"error-fill"},{role:"onError",cssRole:"error-onFill"},{role:"errorContainer",cssRole:"error-container"},{role:"onErrorContainer",cssRole:"error-onContainer"},{role:"background",cssRole:"background"},{role:"onBackground",cssRole:"onBackground"},{role:"surface",cssRole:"surface-fill"},{role:"onSurface",cssRole:"surface-onFill"},{role:"surfaceVariant",cssRole:"surface-fillVariant"},{role:"onSurfaceVariant",cssRole:"surface-onFillVariant"},{role:"surfaceTint",cssRole:"surface-tint"},{role:"inverseSurface",cssRole:"surface-inverseFill"},{role:"inverseOnSurface",cssRole:"surface-inverseOnFill"},{role:"surfaceBright",cssRole:"surface-fillBright"},{role:"surfaceDim",cssRole:"surface-fillDim"},{role:"surfaceContainer",cssRole:"surface-container"},{role:"surfaceContainerHigh",cssRole:"surface-containerHigh"},{role:"surfaceContainerHighest",cssRole:"surface-containerHighest"},{role:"surfaceContainerLow",cssRole:"surface-containerLow"},{role:"surfaceContainerLowest",cssRole:"surface-containerLowest"},{role:"outline",cssRole:"outline"},{role:"outlineVariant",cssRole:"outlineVariant"},{role:"scrim",cssRole:"scrim"},{role:"shadow",cssRole:"shadow"}].map(e=>Object.freeze(e))),Vr=Object.freeze(de.map(({cssRole:e})=>e)),vr=new Set(["tonalSpot","expressive","vibrant","fidelity","content","monochrome","neutral","rainbow","fruitSalad"]),Tr=/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,U=new WeakMap;function Or(e){if(typeof e=="number"){if(!Number.isFinite(e))throw new TypeError("sourceColor must be a CSS hexadecimal color or ARGB number");if(!Number.isInteger(e)||e<0||e>4294967295)throw new RangeError("sourceColor ARGB number must be an integer in [0, 0xffffffff]");return e>>>0}let n=typeof e=="string"?e.trim().replace(/^#/,""):"";if(!Tr.test(n))throw new TypeError("sourceColor must be a CSS hexadecimal color or ARGB number");let r=n.length<=4?n.replace(/./g,"$&$&"):n;return((r.length===8?parseInt(r.slice(6),16):255)<<24|parseInt(r.slice(0,6),16))>>>0}function Er(e,n,r){let o=e===void 0?{}:typeof e=="string"?{mode:e}:typeof e=="boolean"?{isDark:e}:e;if(typeof o!="object"||o===null||Array.isArray(o))throw new TypeError("color-scheme options must be an object");if(o.isDark!==void 0&&typeof o.isDark!="boolean")throw new TypeError("isDark must be a boolean");let t=o.isDark===void 0?o.mode??"light":o.isDark?"dark":"light",a=n??o.contrastLevel??0,i=r??o.variant??"tonalSpot",c=o.specVersion??"2025";if(o.mode!==void 0&&o.mode!==t)throw new RangeError("mode and isDark select different color-scheme modes");if(t!=="light"&&t!=="dark")throw new TypeError("mode must be 'light' or 'dark'");if(!Number.isFinite(a)||a<-1||a>1)throw new RangeError("contrastLevel must be a finite number in [-1, 1]");if(!vr.has(i))throw new TypeError("variant is not a supported Material 3 color style");if(c!=="2021"&&c!=="2025")throw new TypeError("specVersion must be '2021' or '2025'");return{mode:t,contrastLevel:a,variant:i,specVersion:c}}function wr(e,n,r,o){let t=Or(e),a=Er(n,r,o),i=Me(t,a.variant,a.mode==="dark",a.contrastLevel,a.specVersion),c={},u={},s={},d={},m="";for(let{role:y,cssRole:b}of de){let C=ke(i,y),f=oe(C);c[y]=C,u[y]=f,s[b]=f,d[`--cw-Color-${b}`]=f,m+=`--cw-Color-${b}:${f};`}return Object.freeze({...u,specVersion:i.specVersion,sourceColor:oe(t),sourceColorArgb:t,mode:a.mode,isDark:a.mode==="dark",contrastLevel:a.contrastLevel,variant:a.variant,argb:Object.freeze(c),values:Object.freeze(s),variables:Object.freeze(d),cssText:`${m}color-scheme:${a.mode}`})}function Pe(e,n){let{style:r}=e;for(let[o,t]of n.properties)r.getPropertyValue(o)!==t.applied||r.getPropertyPriority(o)!==""||(t.value===""?r.removeProperty(o):r.setProperty(o,t.value,t.priority));U.delete(e)}function Dr(e,n){if(typeof e?.style?.setProperty!="function")throw new TypeError("target must be an Element with inline CSS styles");if(typeof n?.variables!="object"||typeof n.cssText!="string")throw new TypeError("scheme must be a color scheme created by createColorScheme");let{style:r}=e,o=U.get(e),t=new Map,a={properties:t},i=[...Object.entries(n.variables),["color-scheme",n.mode]];for(let[c,u]of i){let s=o?.properties.get(c),d=s!==void 0&&r.getPropertyValue(c)===s.applied&&r.getPropertyPriority(c)==="";t.set(c,{value:d?s.value:r.getPropertyValue(c),priority:d?s.priority:r.getPropertyPriority(c),applied:u}),r.setProperty(c,u)}return U.set(e,a),()=>{U.get(e)===a&&Pe(e,a)}}function Mr(e){let n=U.get(e);n!==void 0&&Pe(e,n)}export{Vr as COLOR_SCHEME_CSS_ROLES,de as COLOR_SCHEME_ROLE_MAPPINGS,Dr as applyColorScheme,wr as createColorScheme,Mr as removeColorScheme};
@@ -0,0 +1 @@
1
+ function z(t,e){if(!t)throw new Error(e===void 0?"invalid state":`invalid state: ${e}`)}function b(t,e){if(!t)throw new Error(e===void 0?"invalid argument":`invalid argument: ${e}`)}var f=class t{static Unrounded=new t;radius;smoothing;constructor(e=0,n=0){b(Number.isFinite(e)&&e>=0,"corner radius must be at least 0"),b(n>=0&&n<=1,"corner smoothing must be in [0, 1]"),this.radius=e,this.smoothing=n,Object.freeze(this)}};function E(t,e){b(Number.isFinite(t)&&Number.isFinite(e),"point coordinates must be finite")}function v(t,e){return Math.sqrt(t*t+e*e)}var x=class t{static Zero=new t(0,0);x;y;constructor(e,n){E(e,n),this.x=e,this.y=n,Object.freeze(this)}static interpolate(e,n,o){return new t(e.x+(n.x-e.x)*o,e.y+(n.y-e.y)*o)}minus(e){return new t(this.x-e.x,this.y-e.y)}plus(e){return new t(this.x+e.x,this.y+e.y)}times(e){return new t(this.x*e,this.y*e)}div(e){return new t(this.x/e,this.y/e)}distanceSquared(){return this.x*this.x+this.y*this.y}distance(){return Math.sqrt(this.distanceSquared())}dot(e){return this.x*e.x+this.y*e.y}direction(){let e=this.distance();return z(e>0,"a zero-length vector has no direction"),this.div(e)}rotate90(){return new t(-this.y,this.x)}cross(e){return this.x*e.y-this.y*e.x}rotate(e,n=t.Zero){let o=e*Math.PI/180,r=Math.cos(o),u=Math.sin(o),s=this.x-n.x,i=this.y-n.y;return new t(s*r-i*u+n.x,s*u+i*r+n.y)}};function q(t,e){if(e===void 0)return new x(Math.cos(t),Math.sin(t));let n=v(t,e);return b(n>0,"a zero-length vector has no direction"),new x(t/n,e/n)}function gn(t,e){return t.minus(e).distance()}function Re(t,e,n){return(e.x-t.x)*(n.y-e.y)-(e.y-t.y)*(n.x-e.x)>0}var oe=1e-4,re,O=class t{points;constructor(e){let n=re;if(re=void 0,n==="frame"){this.points=e;return}b(e.length===8,"a cubic curve requires exactly eight coordinates"),b(n?fn(e):e.every(Number.isFinite),"cubic coordinates must be finite"),this.points=Object.freeze(n?e:Array.from(e)),Object.freeze(this)}get anchor0X(){return this.points[0]}get anchor0Y(){return this.points[1]}get control0X(){return this.points[2]}get control0Y(){return this.points[3]}get control1X(){return this.points[4]}get control1Y(){return this.points[5]}get anchor1X(){return this.points[6]}get anchor1Y(){return this.points[7]}static fromPoints(e,n,o,r){return N([e.x,e.y,n.x,n.y,o.x,o.y,r.x,r.y])}static straightLine(e,n,o,r){return N([e,n,e+(o-e)/3,n+(r-n)/3,e+2*(o-e)/3,n+2*(r-n)/3,o,r])}static circularArc(e,n,o,r,u,s){let i=o-e,c=r-n,a=q(i,c),l=q(u-e,s-n),d=a.dot(l);if(d>.999)return t.straightLine(o,r,u,s);let h=Math.sqrt(i*i+c*c)*4/3*(Math.sqrt(2*(1-d))-Math.sqrt(Math.max(0,1-d*d)))/(1-d)*(-a.y*(u-e)+a.x*(s-n)>=0?1:-1);return N([o,r,o-a.y*h,r+a.x*h,u+l.y*h,s-l.x*h,u,s])}static empty(e,n){return N([e,n,e,n,e,n,e,n])}static interpolate(e,n,o){let r=[];X(o);for(let u=0;u<8;u++)r.push(e.points[u]+(n.points[u]-e.points[u])*o);return Me(r)}pointAt(e){return new x(I(this.points,0,e),I(this.points,1,e))}zeroLength(){return Ke(this.points,0)}convexTo(e){let[n,o,,,,,r,u]=this.points;return Re(new x(n,o),new x(r,u),new x(e.points[6],e.points[7]))}calculateBounds(e=[0,0,0,0],n=!1){return j(e),U(e),H(e,this.points,0,n),e}split(e){return we(this.points,0,e).map(N)}reverse(){return N(Se(this.points))}transformed(e){let{points:n}=this;return t.fromPoints(e(n[0],n[1]),e(n[2],n[3]),e(n[4],n[5]),e(n[6],n[7]))}equals(e){return e instanceof t&&this.points.every((n,o)=>n===e.points[o])}toString(){let[e,n,o,r,u,s,i,c]=this.points;return`Cubic(${e},${n} ${o},${r} ${u},${s} ${i},${c})`}};function N(t){return re="frozen",new O(t)}function Me(t){return re="frame",new O(t)}function X(t){b(Number.isFinite(t),"interpolation progress must be finite")}function fn(t){let e=0;for(let n=0;n<8;n++)e+=t[n]*0;return e===0}function Se(t){return[t[6],t[7],t[4],t[5],t[2],t[3],t[0],t[1]]}function I(t,e,n){let o=1-n,r=o*o,u=n*n;return t[e]*r*o+t[e+2]*3*n*r+t[e+4]*3*u*o+t[e+6]*u*n}function we(t,e,n){let o=1-n,r=I(t,e,n),u=I(t,e+1,n),s=t[e],i=t[e+1],c=t[e+2],a=t[e+3],l=t[e+4],d=t[e+5],h=t[e+6],m=t[e+7];return E(r,u),[[s,i,s*o+c*n,i*o+a*n,s*o*o+c*2*o*n+l*n*n,i*o*o+a*2*o*n+d*n*n,r,u],[r,u,c*o*o+l*2*o*n+h*n*n,a*o*o+d*2*o*n+m*n*n,l*o+h*n,d*o+m*n,h,m]]}function Ke(t,e){for(let n=0;n<8;n++)if(!(Math.abs(t[e+n]-t[e+(n&1)])<oe))return!1;return!0}function ve(t,e){return Math.abs(t.points[6]-e.points[0])<=oe&&Math.abs(t.points[7]-e.points[1])<=oe}function j(t){b(t.length>=4,"bounds buffer must have at least four entries")}function U(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function H(t,e,n,o){let r=Ke(e,n);for(let u=0;u<2;u++){let s=e[n+u],i=e[n+u+2],c=e[n+u+4],a=e[n+u+6],l=s,d=s;if(!r)if(l=Math.min(s,a),d=Math.max(s,a),o)l=Math.min(l,i,c),d=Math.max(d,i,c);else{let h=-s+3*i-3*c+a,m=2*s-4*i+2*c,y=-s+i,R=m*m-4*h*y,w=[];Math.abs(h)>=1e-4?R>0&&w.push((-m+Math.sqrt(R))/(2*h),(-m-Math.sqrt(R))/(2*h)):Math.abs(m)>=1e-4&&w.push(-y/m);for(let M of w)if(M>0&&M<1){let k=1-M,S=s*k*k*k+3*i*M*k*k+3*c*M*M*k+a*M*M*M;l=Math.min(l,S),d=Math.max(d,S)}}t[u]=Math.min(t[u],l),t[u+2]=Math.max(t[u+2],d)}}var _=class t{cubics;kind;convex;constructor(e,n,o=!0){b(e.length>0,"a polygon feature requires at least one cubic");for(let r=1;r<e.length;r++)b(ve(e[r-1],e[r]),"polygon feature cubics must be contiguous");this.cubics=Object.freeze([...e]),this.kind=n,this.convex=n==="corner"?o:!0,Object.freeze(this)}get isEdge(){return this.kind==="edge"}get isCorner(){return this.kind==="corner"}get isIgnorableFeature(){return this.kind==="edge"}get isConvexCorner(){return this.kind==="corner"&&this.convex}get isConcaveCorner(){return this.kind==="corner"&&!this.convex}transformed(e){return new t(this.cubics.map(n=>n.transformed(e)),this.kind,this.convex)}reversed(){return new t(this.cubics.map(e=>e.reverse()).reverse(),this.kind,this.kind==="corner"?!this.convex:!0)}equals(e){return e instanceof t&&this.kind===e.kind&&this.convex===e.convex&&this.cubics.length===e.cubics.length&&this.cubics.every((n,o)=>n.equals(e.cubics[o]))}},A=class t{center;features;cubics;constructor(e,n){let o=[];for(let r=0;r<e.length;r++){let{cubics:u}=e[r];for(let s=0;s<u.length;s++)o.push(u[s])}b(e.length>=2,"a polygon requires at least two features");for(let r=0;r<o.length;r++)b(ve(o[(r||o.length)-1],o[r]),"polygon features must form a contiguous closed outline");this.center=n,this.features=Object.freeze([...e]),this.cubics=Object.freeze(Pn(e,o,n)),Object.freeze(this)}get centerX(){return this.center.x}get centerY(){return this.center.y}static fromVertices(e,n=f.Unrounded,o,r,u){b(e.length>=6&&e.length%2===0,"a polygon requires at least three x/y vertex pairs");let s=e.length/2,i=[],c=n instanceof f?{rounding:n,perVertexRounding:o,centerX:r,centerY:u}:n,a=c.perVertexRounding,l=0,d=0;b(a===void 0||a.length*2===e.length,"per-vertex rounding must have one entry per vertex");for(let m=0;m<s;m++)E(e[m*2],e[m*2+1]),l+=e[m*2],d+=e[m*2+1],i.push(a?.[m]??c.rounding??f.Unrounded);let h=pn(e,i);return new t(h,new x(c.centerX??l/s,c.centerY??d/s))}static fromFeatures(e,n,o){let r=0,u=0,s=0;for(let i=0;i<e.length;i++){let{cubics:c}=e[i];for(let a=0;a<c.length;a++)r+=c[a].points[0],u+=c[a].points[1],s++}return new t(e,new x(n??(s===0?0:r/s),o??(s===0?0:u/s)))}static fromNumVertices(e,n=1,o=0,r=0,u=f.Unrounded,s){return b(Number.isInteger(e)&&e>=3,"a polygon requires at least three vertices"),b(Number.isFinite(n)&&n>0,"polygon radius must be positive"),t.fromVertices(ke(e,o,r,n),u,s,o,r)}transformed(e){let n=this.features.map(o=>o.transformed(e));return new t(n,e(this.centerX,this.centerY))}normalized(){let e=this.calculateBounds(),n=e[0],o=e[1],r=e[2]-n,u=e[3]-o,s=Math.max(r,u),i=(s-r)/2-n,c=(s-u)/2-o;return b(s>0,"cannot normalize a zero-area polygon"),this.transformed((a,l)=>new x(Je((a+i)/s),Je((l+c)/s)))}calculateBounds(e=[0,0,0,0],n=!0){j(e),U(e);for(let o=0;o<this.cubics.length;o++)H(e,this.cubics[o].points,0,n);return e}calculateMaxBounds(e=[0,0,0,0]){let{x:n,y:o}=this.center,r=0;j(e);for(let u=0;u<this.cubics.length;u++){let s=this.cubics[u],i=s.pointAt(.5);r=Math.max(r,v(s.points[0]-n,s.points[1]-o),v(i.x-n,i.y-o))}return e[0]=n-r,e[1]=o-r,e[2]=n+r,e[3]=o+r,e}equals(e){return e instanceof t&&this.features.length===e.features.length&&this.features.every((n,o)=>n.equals(e.features[o]))}};function yn(t){return t instanceof A}function ke(t,e,n,...o){let r=[];for(let u=0;u<t;u++){let s=2*Math.PI*u/t,i=o[u%o.length];r.push(e+Math.cos(s)*i,n+Math.sin(s)*i)}return r}function Je(t){return t<0&&t>-1e-12?0:t>1&&t<1.000000000001?1:t}function pn(t,e){let n=e.length,o=[],r=[],u=[],s=[];for(let i=0;i<n;i++){let c=t[i*2],a=t[i*2+1],l=((i||n)-1)*2,d=(i+1)%n*2,h=t[l]-c,m=t[l+1]-a,y=t[d]-c,R=t[d+1]-a,w=v(h,m),M=v(y,R),k=w===0||M===0,S=k?[0,0,0,0]:[h/w,m/w,y/M,R/M],B=Math.max(-1,Math.min(1,S[0]*S[2]+S[1]*S[3])),$=Math.sqrt(1-B*B),{radius:W,smoothing:Z}=e[i],D=!k&&$>.001?W*(B+1)/$:0;S.push(D,(1+Z)*D,m*y-h*R),o.push(S)}for(let i=0;i<n;i++){let c=(i+1)%n,a=v(t[i*2]-t[c*2],t[i*2+1]-t[c*2+1]),l=o[i][4]+o[c][4],d=o[i][5]+o[c][5];r.push(l>a?[a/l,0]:d>a?[1,(a-l)/(d-l)]:[1,1])}for(let i=0;i<n;i++){let c=o[i],a=t[i*2],l=t[i*2+1],{radius:d,smoothing:h}=e[i],m=c[4],y=c[5],R=r[(i||n)-1],w=r[i],M=[m*R[0]+(y-m)*R[1],m*w[0]+(y-m)*w[1]],k=Math.min(M[0],M[1]),S=Math.min(k,m);if(!(m>=1e-4&&k>=1e-4&&d>=1e-4)){u.push([O.empty(a,l)]);continue}let B=d*S/m,$=(c[0]+c[2])/2,W=(c[1]+c[3])/2,Z=v($,W),D=v(B,S),K=a+$/Z*D,J=l+W/Z*D,Q=[a+c[0]*S,l+c[1]*S,a+c[2]*S,l+c[3]*S],ze=be=>{let V=be*2,ge=c[V],fe=c[V+1],ee=Q[V],ne=Q[V+1],qe=be===0?((i||n)-1)*2:(i+1)%n*2,je=t[qe],Ye=t[qe+1],ye=M[be],pe=ye>y?h:ye>m?h*(ye-m)/(y-m):0,$e=S*(1+pe),De=a+ge*$e,Xe=l+fe*$e,Ue=q(ee+((ee+Q[2-V])/2-ee)*pe-K,ne+((ne+Q[3-V])/2-ne)*pe-J),Pe=K+Ue.x*B,xe=J+Ue.y*B,He=-(Pe-K),_e=-(xe-J),te=ge*He+fe*_e,Ce=(Pe-je)*He+(xe-Ye)*_e,Ge=Math.abs(te)<1e-4||Math.abs(te)<1e-4*Math.abs(Ce),We=Ge?ee:je+ge*(Ce/te),Ze=Ge?ne:Ye+fe*(Ce/te);return[De,Xe,(De+We*2)/3,(Xe+Ze*2)/3,We,Ze,Pe,xe]},me=ze(0),he=ze(1);u.push([N(me),O.circularArc(K,J,me[6],me[7],he[6],he[7]),N(Se(he))])}for(let i=0;i<n;i++){let c=u[i][u[i].length-1].points,a=u[(i+1)%n][0].points;s.push(new _(u[i],"corner",o[i][6]>0),new _([O.straightLine(c[6],c[7],a[0],a[1])],"edge"))}return s}function Pn(t,e,n){let o=t[0].cubics,r=[],u=e;if(o.length===3){let i=o[1].split(.5);u=[i[1],o[2]].concat(e.slice(3),o[0],i[0])}for(let i=0;i<u.length;i++){let c=u[i];c.zeroLength()?r.length>0&&r.push(Qe(r.pop(),c.points,6)):r.push(c)}if(r.length===0)return[O.empty(n.x,n.y)];let s=r[0].points;return r.push(Qe(r.pop(),s,0)),r}function Qe(t,e,n){let o=[...t.points];return o[6]=e[n],o[7]=e[n+1],N(o)}var T=class t{static circle(e=8,n=1,o=0,r=0){return b(Number.isInteger(e)&&e>=3,"a circle requires at least three vertices"),b(Number.isFinite(n)&&n>0,"circle radius must be positive"),A.fromNumVertices(e,n/Math.cos(Math.PI/e),o,r,new f(n))}static rectangle(e=2,n=2,o=f.Unrounded,r,u=0,s=0){let i=u+e/2,c=s+n/2,a=u-e/2,l=s-n/2;return b(Number.isFinite(e)&&e>0&&Number.isFinite(n)&&n>0,"rectangle dimensions must be positive"),A.fromVertices([i,c,a,c,a,l,i,l],o,r,u,s)}static star(e,n=1,o=.5,r=f.Unrounded,u,s,i=0,c=0){return b(Number.isInteger(e)&&e>=2,"a star requires at least two outer vertices"),b(Number.isFinite(n)&&n>0&&Number.isFinite(o)&&o>0,"star radii must be positive"),b(o<n,"star inner radius must be less than its radius"),A.fromVertices(ke(e*2,i,c,n,o),r,s??Array.from({length:e*2},(a,l)=>l%2===0?r:u??r),i,c)}static pill(e=2,n=1,o=0,r=0,u=0){return b(Number.isFinite(e)&&e>0&&Number.isFinite(n)&&n>0,"pill dimensions must be positive"),t.rectangle(e,n,new f(Math.min(e,n)/2,o),void 0,r,u)}};var xn=new x(.5,.5),Cn=[];function P(t,e,n){let o=[],r=[],u=t.map(([,,i,c])=>new f(i,c)),s=(i,c,a)=>{o.push(i,c),r.push(u[a])};if(n){let i=e*2,c=2*Math.PI/i,a=t.map(([d,h])=>Math.atan2(h-.5,d-.5)),l=t.map(([d,h])=>v(d-.5,h-.5));for(let d=0;d<i;d++){let h=d%2===0;for(let m=0;m<t.length-(h?0:1);m++){let y=h?m:t.length-1-m,R=h?c*d+a[y]:c*d+(c-a[y]+2*a[0]);s(.5+Math.cos(R)*l[y],.5+Math.sin(R)*l[y],y)}}}else for(let i=0;i<e;i++)for(let c=0;c<t.length;c++){let a=new x(t[c][0],t[c][1]).rotate(i*360/e,xn);s(a.x,a.y,c)}return A.fromVertices(o,f.Unrounded,r,.5,.5)}function Y(t,e){return t.transformed((n,o)=>new x(n,o).rotate(e))}function en(t,e){return t.transformed((n,o)=>new x(n,o*e))}function g(t,e){return Cn[t]??=e().normalized()}function Rn(){return g(0,()=>T.circle(10))}function Mn(){return g(5,()=>Y(en(T.circle(),.64),-45))}function Sn(){return g(6,()=>P([[.961,.039,.426],[1.001,.428],[1,.609,1]],2,!0))}function wn(){return g(12,()=>P([[.5,-.009,.172],[1.03,.365,.164],[.828,.97,.169]],1,!0))}function vn(){return g(15,()=>T.star(8,1,.8,new f(.15)))}function kn(){return g(16,()=>P([[1.237,1.236,.258],[.5,.918,.233]],4))}function An(){return g(19,()=>Y(T.star(9,1,.8,new f(.5)),-90))}function Tn(){return g(24,()=>P([[.193,.277,.053],[.176,.055,.053]],10))}var ue=class t{static get Circle(){return Rn()}static get Square(){return g(1,()=>T.rectangle(1,1,new f(.3)))}static get Slanted(){return g(2,()=>P([[.926,.97,.189,.811],[-.021,.967,.187,.057]],2))}static get Arch(){return g(3,()=>Y(A.fromNumVertices(4,1,0,0,f.Unrounded,[new f(1),new f(1),new f(.2),new f(.2)]),-135))}static get SemiCircle(){return g(4,()=>T.rectangle(1.6,1,f.Unrounded,[new f(.2),new f(.2),new f(1),new f(1)]))}static get Oval(){return Mn()}static get Pill(){return Sn()}static get Triangle(){return g(7,()=>Y(A.fromNumVertices(3,1,0,0,new f(.2)),-90))}static get Arrow(){return g(8,()=>P([[.5,.892,.313],[-.216,1.05,.207],[.499,-.16,.215,1],[1.225,1.06,.211]],1))}static get Fan(){return g(9,()=>P([[1.004,1,.148,.417],[0,1,.151],[0,-.003,.148],[.978,.02,.803]],1))}static get Diamond(){return g(10,()=>P([[.5,1.096,.151,.524],[.04,.5,.159]],2))}static get ClamShell(){return g(11,()=>P([[.171,.841,.159],[-.02,.5,.14],[.17,.159,.159]],2))}static get Pentagon(){return wn()}static get Gem(){return g(13,()=>P([[.499,1.023,.241,.778],[-.005,.792,.208],[.073,.258,.228],[.433,0,.491]],1,!0))}static get VerySunny(){return g(14,()=>P([[.5,1.08,.085],[.358,.843,.085]],8))}static get Sunny(){return vn()}static get Cookie4Sided(){return kn()}static get Cookie6Sided(){return g(17,()=>P([[.723,.884,.394],[.5,1.099,.398]],6))}static get Cookie7Sided(){return g(18,()=>Y(T.star(7,1,.75,new f(.5)),-90))}static get Cookie9Sided(){return An()}static get Cookie12Sided(){return g(20,()=>Y(T.star(12,1,.8,new f(.5)),-90))}static get Clover4Leaf(){return g(21,()=>P([[.5,.074],[.725,-.099,.476]],4,!0))}static get Clover8Leaf(){return g(22,()=>P([[.5,.036],[.758,-.101,.209]],8))}static get Burst(){return g(23,()=>P([[.5,-.006,.006],[.592,.158,.006]],12))}static get SoftBurst(){return Tn()}static get Boom(){return g(25,()=>P([[.457,.296,.007],[.5,-.051,.007]],15))}static get SoftBoom(){return g(26,()=>P([[.733,.454],[.839,.437,.532],[.949,.449,.439,1],[.998,.478,.174]],16,!0))}static get Flower(){return g(27,()=>P([[.37,.187],[.416,.049,.381],[.479,.001,.095]],8,!0))}static get Puffy(){return g(28,()=>en(P([[.5,.053],[.545,-.04,.405],[.67,-.035,.426],[.717,.066,.574],[.722,.128],[.777,.002,.36],[.914,.149,.66],[.926,.289,.66],[.881,.346],[.94,.344,.126],[1.003,.437,.255]],2,!0),.742))}static get PuffyDiamond(){return g(29,()=>P([[.87,.13,.146],[.818,.357],[1,.332,.853]],4,!0))}static get Ghostish(){return g(30,()=>P([[.5,0,1],[1,0,1],[1,1.14,.254,.106],[.575,.906,.253]],1,!0))}static get PixelCircle(){return g(31,()=>P([[.5,0],[.704,0],[.704,.065],[.843,.065],[.843,.148],[.926,.148],[.926,.296],[1,.296]],2,!0))}static get PixelTriangle(){return g(32,()=>P([[.11,.5],[.113,0],[.287,0],[.287,.087],[.421,.087],[.421,.17],[.56,.17],[.56,.265],[.674,.265],[.675,.344],[.789,.344],[.789,.439],[.888,.439]],1,!0))}static get Bun(){return g(33,()=>P([[.796,.5],[.853,.518,1],[.992,.631,1],[.968,1,1]],2,!0))}static get Heart(){return g(34,()=>P([[.5,.268,.016],[.792,-.066,.958],[1.064,.276,1],[.501,.946,.129]],1,!0))}static byName(e){return b(Ae.includes(e),`unknown Material shape: ${e}`),t[e]}static all(){return Ae.map(e=>({name:e,polygon:t[e]}))}},Ae=Nn();function Nn(){return Object.freeze(Object.getOwnPropertyNames(ue).filter(t=>t<"a"))}var nn=new WeakMap,Ne=class{start;end;cubicCount;#e;#n;constructor(e,n){let o=[],r=[];En(on(e),on(n),o,r);for(let u of[o,r]){for(let s=8;s<u.length;s+=8)u[s]=u[s-2],u[s+1]=u[s-1];u[u.length-2]=u[0],u[u.length-1]=u[1]}for(let u=0;u<o.length;u++)r[u]=r[u]-o[u];this.start=e,this.end=n,this.cubicCount=o.length/8,this.#e=o,this.#n=r,Object.freeze(this)}asCubics(e){let n=[];X(e);for(let o=0;o<this.#e.length;o+=8)n.push(this.#t(o,e));return n}forEachCubic(e,n){X(e);for(let o=0;o<this.#e.length;o+=8)n(this.#t(o,e))}calculateBounds(e=[0,0,0,0],n=!0){return tn(e,this.start.calculateBounds([0,0,0,0],n),this.end.calculateBounds([0,0,0,0],n))}calculateMaxBounds(e=[0,0,0,0]){return tn(e,this.start.calculateMaxBounds(),this.end.calculateMaxBounds())}_frame(e,n){X(e);for(let o=0;o<this.#e.length;o++)n[o]=this.#e[o]+this.#n[o]*e;return n}#t(e,n){let o=this.#e,r=this.#n;return Me([o[e]+r[e]*n,o[e+1]+r[e+1]*n,o[e+2]+r[e+2]*n,o[e+3]+r[e+3]*n,o[e+4]+r[e+4]*n,o[e+5]+r[e+5]*n,o[e+6]+r[e+6]*n,o[e+7]+r[e+7]*n])}};function tn(t,e,n){return j(t),t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function F(t){let e=t-Math.floor(t);return e<1?e:0}function ie(t,e){return Math.min(Math.abs(t-e),1-Math.abs(t-e))}function rn(t,e,n){return n>=e?e<=t&&t<=n:t>=e||t<=n}function Oe(t){let e=t[0],n=t[1];for(let o=1;o<=3;o++){let r=I(t,0,o/3),u=I(t,1,o/3);E(r,u),t.push(v(r-e,u-n)),e=r,n=u}return t}function un(t){return t[8]+t[9]+t[10]}function sn(t,e){let n=[],o=0;for(let r=0;r<t.length;r++){let u=e[r+1];u-e[r]>1e-4&&(n.push({curve:t[r],start:o,end:u}),o=u)}return z(n.length>0,"a measured outline requires a curve of nonzero length"),n.push({...n.pop(),end:1}),n}function on(t){let{features:e}=t,n=nn.get(t);if(n===void 0){let o=[],r=[0],u=[],s=0,i=0;for(let c=0;c<e.length;c++){let{cubics:a}=e[c];for(let l=0;l<a.length;l++)o.push(Oe([...a[l].points])),s+=un(o[o.length-1]),r.push(s)}b(s>0&&Number.isFinite(s),"a polygon outline must have length");for(let c=0;c<r.length;c++)r[c]=r[c]/s;for(let c=0;c<e.length;c++){let{cubics:a,kind:l,convex:d}=e[c],h=i+(a.length>>1),m=a[0].points,y=a[a.length-1].points;l==="corner"&&u.push({convex:d,progress:F((r[h]+r[h+1])/2),x:(m[0]+y[6])/2,y:(m[1]+y[7])/2}),i+=a.length}n={segments:sn(o,r),corners:u},nn.set(t,n)}return n}function Fe({curve:t,start:e,end:n},o){let r=Math.max(e,Math.min(o,n)),u=(n-e===0?0:(r-e)/(n-e))*un(t),s=1;for(let c=8;c<11;c++){if(t[c]>=u){s=(c-7)/3-(1-u/t[c])/3;break}u-=t[c]}let i=we(t,0,s);return[{curve:Oe(i[0]),start:e,end:r},{curve:Oe(i[1]),start:r,end:n}]}function On(t,e){let n=t.find(({end:o})=>Math.abs(o-e)<=1e-6);return e<1e-4?0:n===void 0?e:n.end<1?n.end:0}function Fn(t,e){let n=t.findIndex(({start:s,end:i})=>s<=e&&e<=i),o=Fe(t[n],e),r=[o[1].curve],u=[0,o[1].end-e];for(let s=n+1;s<n+t.length;s++){let{curve:i,end:c}=t[s%t.length];r.push(i),u.push(c-e+(s<t.length?0:1))}return r.push(o[0].curve),u.push(1),sn(r,u)}function Te(t,e,n){let o=t.length-1,r=0;for(;r<o&&!rn(n,t[r],t[r+1]);)r++;let u=r===o?0:r+1,s=t[r],i=e[r],c=F(t[u]-s);return F(i+F(e[u]-i)*(c<.001?.5:F(n-s)/c))}function Bn(t,e){let n=[],o=new Set,r=[],u=[],s=0;for(let i=0;i<t.length;i++)for(let c=0;c<e.length;c++){let a=t[i],l=e[c],d=(a.x-l.x)*(a.x-l.x)+(a.y-l.y)*(a.y-l.y);a.convex===l.convex&&(n.push([a,l,d]),s=Math.max(s,d*1e-9))}for(let i=0;i<n.length;i++)n[i][2]=s>0?Math.round(n[i][2]/s):0;if(n.sort((i,c)=>i[2]-c[2]||i[0].progress-c[0].progress||i[1].progress-c[1].progress),n.length===1){let[{progress:i},{progress:c}]=n[0];return[[i,F(i+.5)],[c,F(c+.5)]]}for(let i=0;i<n.length;i++){let c=n[i][0],a=n[i][1],l=c.progress,d=a.progress;if(o.has(c)||o.has(a))continue;let h=r.findIndex(m=>m>l);if(h<0&&(h=r.length),r.length>0){let m=(h||r.length)-1,y=h%r.length;if(ie(l,r[m])<=1e-4||ie(l,r[y])<=1e-4||ie(d,u[m])<=1e-4||ie(d,u[y])<=1e-4||r.length>=2&&!rn(d,u[m],u[y]))continue}if(r.splice(h,0,l),u.splice(h,0,d),o.add(c).add(a),r.length===Math.min(t.length,e.length))break}return r.length>=2?[r,u]:[[0,.5],[0,.5]]}function se(t,e){for(let n=0;n<8;n++)t.push(e[n])}function En(t,e,n,o){let[r,u]=Bn(t.corners,e.corners),s=On(e.segments,Te(r,u,0)),i=t.segments,c=s===0?e.segments:Fn(e.segments,s),a=0,l=0,d=i[0],h=c[0];for(;d!==void 0&&h!==void 0;){let m=a===i.length-1?1:d.end,y=l===c.length-1?1:Te(u,r,F(h.end+s)),R=Math.min(m,y);if(m>R+1e-6){let w=Fe(d,R);se(n,w[0].curve),d=w[1]}else se(n,d.curve),d=i[++a];if(y>R+1e-6){let w=Fe(h,F(Te(r,u,R)-s));se(o,w[0].curve),h=w[1]}else se(o,h.curve),h=c[++l]}z(d===void 0&&h===void 0,"polygon outlines could not be fully matched")}var G=1e5,le=[1,0,0,1,0,0],C=new Uint8Array(0),p=0,cn,Be=new Float64Array(0);function Ie(t){return b(Number.isFinite(t),"path coordinates must be finite"),String(Math.round(t*G)/G)}var L=class{#e;constructor(){this.#e=""}moveTo(e,n){return this.#n("M",[e,n])}lineTo(e,n){return this.#n("L",[e,n])}cubicTo(e,n,o,r,u,s){return this.#n("C",[e,n,o,r,u,s])}close(){return this.#n("Z",[])}rewind(){return this._assign("")}toSvgPathData(){return this.#e}toString(){return this.#e}_assign(e){return this.#e=e,this}#n(e,n){return this._assign(this.#e+e+n.map(Ie).join(" "))}};function In(t,e=new L){return b(t.length>0,"a path requires at least one cubic"),de(e,Ve(t),t.length,le,!1)}function dn(t,e,n=new L){let o=Ve(t.cubics);return de(n,o,t.cubics.length,mn(o,t.centerX,t.centerY,e?.startAngle),e?.repeatPath===!0)}function Ln(t,e,n,o=new L){let r=t._frame(e,Le(t.cubicCount)),{start:u,end:s}=t;return de(o,r,t.cubicCount,mn(r,u.centerX+(s.centerX-u.centerX)*e,u.centerY+(s.centerY-u.centerY)*e,n?.startAngle),n?.repeatPath===!0)}var an=/[\s,]*/y,Vn=/[A-Za-z]/y,zn=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,qn=/[01]/y,jn=7,Yn=new Set([3,4]);function ce(t,e,n){return t.lastIndex=n,t.exec(e)?.[0]}function $n(t,e){let n="",o="",r=0,u=!1,s=ce(an,t,0)?.length??0;for(;s<t.length;){let i=ce(Vn,t,s),c=u&&Yn.has(r%jn),a=i??ce(c?qn:zn,t,s);if(b(a!==void 0,`invalid path data at ${s}: ${t}`),s+=a.length,s+=ce(an,t,s)?.length??0,i!==void 0){n+=i,o="",r=0,u=i==="A"||i==="a";continue}let l=String(Number(Number(a).toFixed(e))).replace(/^(-?)0\./,"$1."),d=o===""||l.startsWith("-")||l.startsWith(".")&&o.includes(".");n+=d?l:` ${l}`,o=l,r++}return n}function Dn(t){return dn(t).toSvgPathData()}function Xn(t,e,n=e){return hn(Ve(t.cubics),t.cubics.length,e,n)}function Un(t,e,n,o=n){return hn(t._frame(e,Le(t.cubicCount)),t.cubicCount,n,o)}function Le(t){return Be.length<t*8&&(Be=new Float64Array(t*16)),Be}function Ve(t){let e=Le(t.length);for(let n=0;n<t.length;n++){let o=t[n].points;for(let r=0;r<8;r++)e[n*8+r]=o[r]}return e}function mn(t,e,n,o){if(o===void 0)return le;let r=o*Math.PI/180-Math.atan2(t[1]-n,t[0]-e),u=Math.cos(r),s=Math.sin(r);return[u,s,-s,u,e-u*e+s*n,n-s*e-u*n]}function hn(t,e,n,o){b(Number.isFinite(n)&&n>0&&Number.isFinite(o)&&o>0,"a CSS path box must have a positive size");let r=[0,0,0,0];U(r);for(let l=0;l<e;l++)H(r,t,l*8,!0);let[u,s,i,c]=r,a=[n,0,0,o,(1-u-i)*n/2,(1-s-c)*o/2];return`path('${de(new L,t,e,a,!1)}')`}function Ee(t){if(p+t>C.length){let e=new Uint8Array(Math.max(C.length*2,p+t));e.set(C),C=e}}function ln(t){let e=Math.round(t*G);if(e>-2147483648&&e<2147483648){e<0&&(C[p++]=45,e=-e);let n=e%G;if(bn((e-n)/G),n>0){C[p]=46;for(let o=p+5,r=n;o>p;o--)C[o]=48+r%10,r=(r-r%10)/10;for(p+=6;C[p-1]===48;)p--}}else{let n=Ie(t);for(let o=0;o<n.length;o++)C[p++]=n.charCodeAt(o)}}function bn(t){t>=10&&bn((t-t%10)/10),C[p++]=48+t%10}function ae(t,e,n){ln(t===le?e:t[0]*e+t[2]*n+t[4]),C[p++]=32,ln(t===le?n:t[1]*e+t[3]*n+t[5])}function de(t,e,n,o,r){let u=p=0;try{Ee(200),C[p++]=77,ae(o,e[0],e[1]);for(let s=0;s<n*8;s+=8)u=p,Ee(200),C[p++]=67,ae(o,e[s+2],e[s+3]),C[p++]=32,ae(o,e[s+4],e[s+5]),C[p++]=32,ae(o,e[s+6],e[s+7]);if(r){let s=p;Ee(s),C[p++]=76,C.copyWithin(p,1,s),p+=s-1}C[p++]=90,u=p}finally{p=u,t._assign(Hn())}return t}function Hn(){return cn??=new TextDecoder,cn.decode(C.subarray(0,p))}export{oe as CUBIC_CONTINUITY_EPSILON,f as CornerRounding,O as Cubic,Ae as MATERIAL_SHAPE_NAMES,ue as MaterialShapes,Ne as Morph,L as Path,x as Point,_ as PolygonFeature,A as RoundedPolygon,T as Shapes,$n as compactSvgPath,In as cubicsToPath,q as directionVector,gn as distanceBetween,Ie as formatPathCoordinate,Re as isConvex,yn as isRoundedPolygon,Un as morphToCssPath,Ln as morphToPath,dn as roundedPolygonToPath,Xn as toCssPath,Dn as toSvgPath};
@@ -53,6 +53,21 @@ export type ActionButtonVariant = "elevated" | "filled" | "filled-tonal" | "outl
53
53
  * Action button sizes, from extra small (32px) to extra large (136px).
54
54
  */
55
55
  export type ActionButtonSize = "lg" | "md" | "sm" | "xl" | "xs";
56
+ /**
57
+ * Progress properties of action controls.
58
+ */
59
+ export type ActionProgressProps = {
60
+ /**
61
+ * Progress of the action: `"pending"` while it is under way, and `"done"` once it has finished,
62
+ * or `undefined` at rest.
63
+ *
64
+ * An action showing progress remains focusable, unlike a disabled action, and is exposed with
65
+ * `aria-disabled="true"`, and `aria-busy="true"` while pending. Its click is cancelled and its
66
+ * propagation stopped, so that it neither repeats the action nor submits a form: it reaches no
67
+ * `onClick` or `event:click` handler, and no listener of an ancestor.
68
+ */
69
+ progress?: "done" | "pending" | undefined;
70
+ };
56
71
  /**
57
72
  * Toggle state properties of action controls.
58
73
  *
@@ -136,18 +151,20 @@ export type ActionChangeHandler = (checked: boolean, controller: ActionButtonCon
136
151
  * | `<base>-disabled` | the button is disabled |
137
152
  * | `<base>-toggle` | the button is a toggle |
138
153
  * | `<base>-checked` | the toggle is checked |
154
+ * | `<base>-{pending,done}` | the action shows that progress |
139
155
  * | `<base>-{hover,focus,press}` | an interaction state is entered |
140
156
  *
141
157
  * Disabled buttons enter no interaction state. Read-only toggles enter only the focus state, so
142
- * that keyboard focus remains visible. A link has no `type`, and cannot be disabled natively: a
143
- * disabled link keeps its `href`, as a disabled tab or navigation destination does, is exposed with
144
- * `aria-disabled="true"`, and its activation by a click or <kbd>Enter</kbd> is cancelled. An
145
- * authored `attr:aria-pressed` or `attr:aria-disabled` replaces the respective managed attribute.
158
+ * that keyboard focus remains visible, and so do actions showing progress. A link has no `type`,
159
+ * and cannot be disabled natively: a disabled link keeps its `href`, as a disabled tab or
160
+ * navigation destination does, is exposed with `aria-disabled="true"`, and its activation by a
161
+ * click or <kbd>Enter</kbd> is cancelled. An authored `attr:aria-pressed` or `attr:aria-disabled`
162
+ * replaces the respective managed attribute.
146
163
  *
147
164
  * @typeParam P - component properties type, whose `ref` the bound omits, since its type is the type
148
165
  * of the function element
149
166
  */
150
- export declare abstract class ActionButtonController<P extends Omit<BaseActionButtonProps, "ref"> & ActionLinkProps> extends InteractableController<P> {
167
+ export declare abstract class ActionButtonController<P extends ActionLinkProps & ActionProgressProps & Omit<BaseActionButtonProps, "ref">> extends InteractableController<P> {
151
168
  #private;
152
169
  /**
153
170
  * Construct a new `ActionButtonController`.
@@ -201,9 +218,11 @@ export declare abstract class ActionButtonController<P extends Omit<BaseActionBu
201
218
  /**
202
219
  * Handle an interaction event, and request a new toggle state after a click.
203
220
  *
204
- * Events received by a disabled button are ignored. A click on a read-only toggle is cancelled.
205
- * Otherwise a click on a toggle requests the next state once the click has finished propagating
206
- * and was not cancelled; an uncontrolled toggle then commits that state.
221
+ * Events received by a disabled button are ignored. A click on an action showing progress is
222
+ * cancelled and stopped, as this runs in the capture phase, before any handler of the button. A
223
+ * click on a read-only toggle is cancelled. Otherwise a click on a toggle requests the next
224
+ * state once the click has finished propagating and was not cancelled; an uncontrolled toggle
225
+ * then commits that state.
207
226
  *
208
227
  * @param event - interaction event received
209
228
  */
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @packageDocumentation
10
10
  */
11
- export type { ActionButtonController, ActionButtonElementProps, ActionButtonSize, ActionButtonVariant, ActionChangeHandler, ActionLinkProps, ActionToggleProps, BaseActionButtonProps } from "./base";
11
+ export type { ActionButtonController, ActionButtonElementProps, ActionButtonSize, ActionButtonVariant, ActionChangeHandler, ActionLinkProps, ActionProgressProps, ActionToggleProps, BaseActionButtonProps } from "./base";
12
12
  export type { ButtonProps, ToggleButtonProps, ToggleButtonVariant } from "./button";
13
13
  export type { IconButtonProps, IconButtonSize, IconButtonVariant, IconToggleButtonProps } from "./icon-button";
14
14
  export type { FABProps, FABSize, FABVariant } from "./fab";
@@ -17,6 +17,8 @@ export type { SplitButtonProps } from "./split-button";
17
17
  export type { FABMenuItemProps, FABMenuProps, FABMenuTriggerFactory, FABMenuTriggerProps } from "./fab-menu";
18
18
  export type { FABMenuTriggerContextValue } from "./fab-menu-context";
19
19
  export { Button, ToggleButton } from "./button";
20
+ export type { ProgressButtonProps } from "./progress-button";
21
+ export { ProgressButton } from "./progress-button";
20
22
  export { IconButton, IconToggleButton } from "./icon-button";
21
23
  export { FAB } from "./fab";
22
24
  export { ButtonGroup } from "./group";
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+
3
+ export {};
@@ -0,0 +1,46 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { InteractableProps } from "../state";
3
+ import type { ActionButtonElementProps, ActionProgressProps } from "./base";
4
+ import type { ButtonProps } from "./button";
5
+ import "./progress-button.css";
6
+ /**
7
+ * Progress button properties.
8
+ *
9
+ * A progress button is always a native button, as a `ToggleButton` is: it stays where it is while
10
+ * its action runs, so it has neither an `href` nor the native attributes of a link.
11
+ */
12
+ export type ProgressButtonProps = ActionButtonElementProps & ActionProgressProps & Pick<ButtonProps, "leadingIcon" | "shape" | "size" | "trailingIcon" | "variant">;
13
+ /**
14
+ * Common button which shows the progress of the action it started.
15
+ *
16
+ * The button transitions to a circle holding a loading indicator while its {@link
17
+ * ActionProgressProps.progress | progress} is `"pending"`, and holding a check while it is
18
+ * `"done"`. Its label and icons fade out. Importing this component is what brings the loading
19
+ * indicator into a page: a page with common buttons alone has no use for it.
20
+ *
21
+ * The button has to have a definite inline size at rest to transition from, since a transition
22
+ * does not start from `auto`; a button sized by its content changes to the circle at once. Assign
23
+ * the size by a rule which does not apply to `cw-Button-pending` and `cw-Button-done`, and which
24
+ * does apply to them where motion is reduced, as the button then keeps the size assigned to it. A
25
+ * progress button in a connected `ButtonGroup` or a `SplitButton` is not supported, as its
26
+ * neighbors would move with it.
27
+ *
28
+ * # Design
29
+ *
30
+ * The button is designed as a {@link ./button#Button | common button}. The
31
+ * `cw-Button-progressIndicatorSize` role sizes the loading indicator.
32
+ *
33
+ * # Elements
34
+ *
35
+ * The button renders the elements of a common button, and the following element.
36
+ *
37
+ * | Class | Element |
38
+ * | -------------------------- | ------------- |
39
+ * | `cw-ActionButton-progress` | progress slot |
40
+ *
41
+ * The button applies `cw-Button-pending` and `cw-Button-done` while showing that progress.
42
+ *
43
+ * @param props - component properties
44
+ * @returns rendered component elements
45
+ */
46
+ export declare function ProgressButton(props: InteractableProps<ProgressButtonProps>): JSX.Element;
@@ -0,0 +1,51 @@
1
+ import type { SpringOptions } from "./spring";
2
+ /**
3
+ * Height of a container that follows its content.
4
+ *
5
+ * @see {@link followHeight}
6
+ */
7
+ export interface FollowedHeight {
8
+ /**
9
+ * Stop following. A spring under way stops where it is, and the height stays there.
10
+ */
11
+ cancel(): void;
12
+ /**
13
+ * Wait until the height of the container rests where its content last told it to.
14
+ *
15
+ * A change of the content reaches the container with the next rendering update, so wait for
16
+ * that update first. A hidden document gets none, and this would wait for ever on it.
17
+ *
18
+ * @returns promise resolved once no spring moves the height
19
+ */
20
+ settled(): Promise<void>;
21
+ }
22
+ /**
23
+ * Make the height of a container follow the height of its content.
24
+ *
25
+ * The content keeps its own height, laid out at the width of the container, and the container
26
+ * springs to it whenever it changes. A spring under way is retargeted, keeping its speed, so that
27
+ * content changing again does not jolt the container. The height changes at once while the
28
+ * container shows nothing, as before its entrance, and when the width of the content changed too,
29
+ * as when the window resizes, because the height that follows from a new width is not a motion.
30
+ * Under a hidden document or reduced motion, the spring settles at once, as every spring does.
31
+ *
32
+ * The container must clip what overflows it, as the content does while the container grows, and
33
+ * while an expressive spring overshoots as it shrinks. It holds nothing but its content, without
34
+ * padding or a border of its own. Height here is the block size, in a vertical writing mode too.
35
+ *
36
+ * ```tsx
37
+ * onMount(() => void followHeight(frame, content));
38
+ *
39
+ * <div ref={frame} style={{ overflow: "clip" }}><div ref={content}>{props.children}</div></div>
40
+ * ```
41
+ *
42
+ * @param container - element whose height follows
43
+ * @param content - child of the container, whose height it follows
44
+ * @param opts - spring characteristics, the default spatial spring unless named
45
+ * @returns the height followed
46
+ *
47
+ * @remarks
48
+ * Within a Solid owner, following stops as the owner is disposed. Otherwise, the caller must
49
+ * {@link FollowedHeight.cancel | cancel} it.
50
+ */
51
+ export declare function followHeight(container: HTMLElement, content: HTMLElement, opts?: Readonly<Omit<SpringOptions, "unit" | "velocity">>): FollowedHeight;
@@ -12,20 +12,24 @@
12
12
  * gesture drives or user input retargets mid-flight: it reads its stiffness and damping ratio from
13
13
  * the same roles, preserves its velocity when retargeted, and accepts the release velocity
14
14
  * estimated by a {@link VelocityTracker}. Runtime springs of a window share one animation-frame
15
- * callback, available to other per-frame motion through {@link subscribeMotionFrames}.
15
+ * callback, available to other per-frame motion through {@link subscribeMotionFrames}. {@link
16
+ * followHeight} springs the height of a container to its content.
16
17
  *
17
18
  * Web Animation motion completes without animating during server rendering or when the API is
18
19
  * unavailable. Runtime springs settle immediately during server rendering, without an animation
19
- * frame clock, or when reduced motion is requested. Both motion APIs honor reduced motion unless
20
- * explicitly configured otherwise. {@link SUPPORTS_MOTION} describes Web Animations support only.
20
+ * frame clock, in a hidden document, or when reduced motion is requested. Both motion APIs honor
21
+ * reduced motion unless explicitly configured otherwise. {@link SUPPORTS_MOTION} describes Web
22
+ * Animations support only.
21
23
  *
22
24
  * @packageDocumentation
23
25
  */
26
+ export type { FollowedHeight } from "./follow-height";
24
27
  export type { MotionFrameListener } from "./frame";
25
28
  export type { MaterialTransition, MaterialTransitionOptions, MaterialTransitionPattern } from "./material";
26
29
  export type { Motion, MotionDuration, MotionEasing, MotionKeyframe, MotionOptions } from "./motion";
27
30
  export type { SpringMotion, SpringOptions, SpringRole, SpringScheme, SpringSpeed } from "./spring";
28
31
  export type { TransitionElement, TransitionMotion, TransitionProps, TransitionState, TransitionTarget } from "./transition";
32
+ export { followHeight } from "./follow-height";
29
33
  export { subscribeMotionFrames } from "./frame";
30
34
  export { createMaterialTransition } from "./material";
31
35
  export { SUPPORTS_MOTION, applyMotion } from "./motion";
@@ -195,9 +195,9 @@ export interface SpringMotion {
195
195
  * SpringMotion.retarget | retargeting} it continues from its current value and velocity, and
196
196
  * {@link SpringOptions.velocity | `opts.velocity`} hands it the release velocity of a gesture.
197
197
  * All springs of a window share one animation-frame callback and frame clock. A spring settles
198
- * immediately during server rendering, without an animation-frame clock, or while reduced motion
199
- * is preferred (unless {@link SpringOptions.respectReducedMotion | `respectReducedMotion`} is
200
- * `false`). Its value remains applied after it settles.
198
+ * immediately during server rendering, without an animation-frame clock, while its document is
199
+ * hidden, or while reduced motion is preferred (unless {@link SpringOptions.respectReducedMotion |
200
+ * `respectReducedMotion`} is `false`). Its value remains applied after it settles.
201
201
  *
202
202
  * ```ts
203
203
  * const spring = applySpringMotion(thumb, "translate", 0, 20, { speed: "fast", unit: "px" });
@@ -29,7 +29,7 @@ export { CornerRounding } from "./corner-rounding";
29
29
  export { CUBIC_CONTINUITY_EPSILON, Cubic } from "./cubic";
30
30
  export { MATERIAL_SHAPE_NAMES, MaterialShapes } from "./material-shapes";
31
31
  export { Morph } from "./morph";
32
- export { Path, cubicsToPath, formatPathCoordinate, morphToCssPath, morphToPath, roundedPolygonToPath, toCssPath, toSvgPath } from "./path";
32
+ export { Path, compactSvgPath, cubicsToPath, formatPathCoordinate, morphToCssPath, morphToPath, roundedPolygonToPath, toCssPath, toSvgPath } from "./path";
33
33
  export { Point, directionVector, distanceBetween, isConvex } from "./point";
34
34
  export { PolygonFeature, RoundedPolygon, isRoundedPolygon } from "./rounded-polygon";
35
35
  export { Shapes } from "./shapes";
@@ -3,6 +3,62 @@ import { RoundedPolygon } from "./rounded-polygon";
3
3
  * Union of {@link MaterialShapes | Material shape} names.
4
4
  */
5
5
  export type MaterialShapeName = "Circle" | "Square" | "Slanted" | "Arch" | "SemiCircle" | "Oval" | "Pill" | "Triangle" | "Arrow" | "Fan" | "Diamond" | "ClamShell" | "Pentagon" | "Gem" | "VerySunny" | "Sunny" | "Cookie4Sided" | "Cookie6Sided" | "Cookie7Sided" | "Cookie9Sided" | "Cookie12Sided" | "Clover4Leaf" | "Clover8Leaf" | "Burst" | "SoftBurst" | "Boom" | "SoftBoom" | "Flower" | "Puffy" | "PuffyDiamond" | "Ghostish" | "PixelCircle" | "PixelTriangle" | "Bun" | "Heart";
6
+ /**
7
+ * Circle.
8
+ *
9
+ * @returns the shape
10
+ * @see {@link MaterialShapes.Circle}
11
+ */
12
+ export declare function circleShape(): RoundedPolygon;
13
+ /**
14
+ * Oval, tilted by 45 degrees counter-clockwise.
15
+ *
16
+ * @returns the shape
17
+ * @see {@link MaterialShapes.Oval}
18
+ */
19
+ export declare function ovalShape(): RoundedPolygon;
20
+ /**
21
+ * Diagonal pill, rising to the right.
22
+ *
23
+ * @returns the shape
24
+ * @see {@link MaterialShapes.Pill}
25
+ */
26
+ export declare function pillShape(): RoundedPolygon;
27
+ /**
28
+ * Rounded pentagon, pointing up.
29
+ *
30
+ * @returns the shape
31
+ * @see {@link MaterialShapes.Pentagon}
32
+ */
33
+ export declare function pentagonShape(): RoundedPolygon;
34
+ /**
35
+ * Rounded star of eight short rays.
36
+ *
37
+ * @returns the shape
38
+ * @see {@link MaterialShapes.Sunny}
39
+ */
40
+ export declare function sunnyShape(): RoundedPolygon;
41
+ /**
42
+ * Cookie of four lobes.
43
+ *
44
+ * @returns the shape
45
+ * @see {@link MaterialShapes.Cookie4Sided}
46
+ */
47
+ export declare function cookie4SidedShape(): RoundedPolygon;
48
+ /**
49
+ * Cookie of nine lobes.
50
+ *
51
+ * @returns the shape
52
+ * @see {@link MaterialShapes.Cookie9Sided}
53
+ */
54
+ export declare function cookie9SidedShape(): RoundedPolygon;
55
+ /**
56
+ * Burst of ten soft points.
57
+ *
58
+ * @returns the shape
59
+ * @see {@link MaterialShapes.SoftBurst}
60
+ */
61
+ export declare function softBurstShape(): RoundedPolygon;
6
62
  /**
7
63
  * Material 3 Expressive shapes.
8
64
  *
@@ -136,6 +136,22 @@ export declare function roundedPolygonToPath(polygon: RoundedPolygon, options?:
136
136
  * @throws {@link Error} `progress` or a coordinate is not finite
137
137
  */
138
138
  export declare function morphToPath(morph: Morph, progress: number, options?: PathOptions, path?: Path): Path;
139
+ /**
140
+ * Shorten SVG path data.
141
+ *
142
+ * This rounds coordinates to `precision` decimal places and leaves out the zeros and separators
143
+ * which they do not need: a minus sign always starts a coordinate, and a point does after a
144
+ * coordinate with a point. Rounding keeps every command, so both ends of a morph still
145
+ * interpolate. Paths written once, as those of an image or a build, are the ones worth shortening,
146
+ * since this takes longer than writing them.
147
+ *
148
+ * @param data - SVG path data
149
+ * @param precision - decimal places of a coordinate, an integer from 0 to 100
150
+ * @returns equivalent path data, as far as the rounding goes
151
+ * @throws {@link Error} `data` is not SVG path data
152
+ * @throws {@link RangeError} `precision` is out of range
153
+ */
154
+ export declare function compactSvgPath(data: string, precision: number): string;
139
155
  /**
140
156
  * Serialize polygon outline as SVG path data.
141
157
  *
@@ -2,9 +2,10 @@
2
2
  * Typography and typescale definitions.
3
3
  *
4
4
  * This module defines the {@link Text} component, which renders text according to the baseline
5
- * and emphasized styles of the [`cw-Typescale`](./typescale.yaml) design attribute, and the {@link
5
+ * and emphasized styles of the [`cw-Typescale`](./typescale.yaml) design attribute, the {@link
6
6
  * Typography} component, which selects the [`cw-LineHeight`](./line-height.yaml) category of a
7
- * subtree by language.
7
+ * subtree by language, and the {@link VisuallyHidden} component, which holds text for assistive
8
+ * technology alone.
8
9
  *
9
10
  * Fonts are named by the [`cw-Typeface`](./typeface.yaml) design attribute; Cobweb does not
10
11
  * bundle them, so applications load the named fonts, for example with `@font-face` rules. The
@@ -16,3 +17,5 @@ export type { TextEmphasis, TextProps, TextRole, TextSize, Typescale } from "./t
16
17
  export { Text } from "./text";
17
18
  export type { TypographyHeight, TypographyProps } from "./typography";
18
19
  export { Typography } from "./typography";
20
+ export type { VisuallyHiddenProps } from "./visually-hidden";
21
+ export { VisuallyHidden } from "./visually-hidden";
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+
3
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomComponent, DomProps } from "..";
3
+ import "./visually-hidden.css";
4
+ /**
5
+ * {@link VisuallyHidden} component properties.
6
+ */
7
+ export type VisuallyHiddenProps = DomProps<HTMLSpanElement, JSX.HTMLElementTags["span"]>;
8
+ /**
9
+ * Content for assistive technology alone.
10
+ *
11
+ * The content is clipped to a single pixel and positioned out of flow, so that it takes no room
12
+ * and is not painted, and unlike with `display: none` it remains in the accessibility tree. Use
13
+ * this for content which a page conveys visually in another way, such as a status region. Native
14
+ * attributes, such as `attr:role="status"`, apply to the rendered element.
15
+ *
16
+ * ```tsx
17
+ * import type { JSX, VoidProps } from "solid-js";
18
+ *
19
+ * import { VisuallyHidden } from "@pg-labs-incubator/cobweb/text";
20
+ *
21
+ * export default function(_props: VoidProps): JSX.Element {
22
+ * return <VisuallyHidden attr:role="status">Saved.</VisuallyHidden>;
23
+ * }
24
+ * ```
25
+ *
26
+ * # Design
27
+ *
28
+ * The rendered element applies `cw-VisuallyHidden`, and has no design roles.
29
+ *
30
+ * @param props - text properties
31
+ * @returns rendered element
32
+ */
33
+ export declare const VisuallyHidden: DomComponent<VisuallyHiddenProps>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Ensure execution is within a browser environment.
3
+ *
4
+ * @throws {@link Error} not executing within a browser environment
5
+ * @see {@link checkServer}
6
+ */
7
+ export declare function checkBrowser(): void;
8
+ /**
9
+ * Ensure execution is within a server environment.
10
+ *
11
+ * @throws {@link Error} not executing within a server environment
12
+ * @see {@link checkBrowser}
13
+ */
14
+ export declare function checkServer(): void;
@@ -7,6 +7,7 @@ export type { BoxSide, LogicalBoxSides } from "./box-side";
7
7
  export { BoxBottom, BoxLeft, BoxRight, BoxTop, axisOfBoxSide, logicalBoxSidesOf } from "./box-side";
8
8
  export { assertDebug, printDebug } from "./debug";
9
9
  export { attributeValueOf, setAttribute } from "./dom";
10
+ export { checkBrowser, checkServer } from "./environment";
10
11
  export { HAS_PASSIVE_EVENT_LISTENERS, deferAfterDelegatedCancellation, eventListenerOptionsOf } from "./event";
11
- export { checkArgument, checkArray, checkBoolean, checkBrowser, checkNumber, checkObject, checkServer, checkState, checkString, checkValueDefined } from "./preconditions";
12
+ export { checkArgument, checkArray, checkBoolean, checkNumber, checkObject, checkState, checkString, checkValueDefined } from "./preconditions";
12
13
  export { consumeProps, isPropReactive } from "./reactive";
@@ -6,20 +6,6 @@
6
6
  * @throws {@link Error} `valid` is `false`
7
7
  */
8
8
  export declare function checkState(valid: boolean, msg?: string): asserts valid;
9
- /**
10
- * Ensure execution is within a browser environment.
11
- *
12
- * @throws {@link Error} not executing within a browser environment
13
- * @see {@link checkServer}
14
- */
15
- export declare function checkBrowser(): void;
16
- /**
17
- * Ensure execution is within a server environment.
18
- *
19
- * @throws {@link Error} not executing within a server environment
20
- * @see {@link checkBrowser}
21
- */
22
- export declare function checkServer(): void;
23
9
  /**
24
10
  * Ensure an argument is valid.
25
11
  *