@pg-labs-incubator/cobweb 0.0.4 → 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 (126) 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.css +1 -1
  83. package/target/esbuild/state/component.jsx +1 -1
  84. package/target/esbuild/state/controller.jsx +1 -1
  85. package/target/esbuild/state/index.jsx +1 -1
  86. package/target/esbuild/state/ripple.jsx +1 -1
  87. package/target/esbuild/state/state.jsx +1 -1
  88. package/target/esbuild/state/style.jsx +1 -1
  89. package/target/esbuild/surface/carousel-layout.jsx +1 -1
  90. package/target/esbuild/surface/carousel.jsx +2 -2
  91. package/target/esbuild/surface/dialog.jsx +5 -5
  92. package/target/esbuild/surface/divider.jsx +1 -1
  93. package/target/esbuild/surface/drag.jsx +1 -1
  94. package/target/esbuild/surface/gestures.jsx +3 -3
  95. package/target/esbuild/surface/index.jsx +1 -1
  96. package/target/esbuild/surface/interactive.jsx +1 -1
  97. package/target/esbuild/surface/list-patterns.jsx +3 -3
  98. package/target/esbuild/surface/list.jsx +2 -2
  99. package/target/esbuild/surface/menu.jsx +3 -3
  100. package/target/esbuild/surface/scaffold.jsx +7 -7
  101. package/target/esbuild/surface/sheet.jsx +5 -5
  102. package/target/esbuild/surface/side-sheet.jsx +2 -2
  103. package/target/esbuild/surface/slots.jsx +1 -1
  104. package/target/esbuild/surface/surface.jsx +1 -1
  105. package/target/esbuild/text/index.jsx +1 -1
  106. package/target/esbuild/text/text.jsx +2 -2
  107. package/target/esbuild/text/typography.jsx +1 -1
  108. package/target/esbuild/util/box-side.jsx +1 -1
  109. package/target/esbuild/util/debug.jsx +1 -1
  110. package/target/esbuild/util/dom.jsx +1 -1
  111. package/target/esbuild/util/environment.jsx +1 -0
  112. package/target/esbuild/util/event.jsx +1 -1
  113. package/target/esbuild/util/index.jsx +1 -1
  114. package/target/esbuild/util/preconditions.jsx +1 -1
  115. package/target/esbuild/util/reactive.jsx +1 -1
  116. package/target/node/color.js +1 -0
  117. package/target/node/shape.js +1 -0
  118. package/target/tsc/motion/follow-height.d.ts +51 -0
  119. package/target/tsc/motion/index.d.ts +7 -3
  120. package/target/tsc/motion/spring.d.ts +3 -3
  121. package/target/tsc/shape/index.d.ts +1 -1
  122. package/target/tsc/shape/material-shapes.d.ts +56 -0
  123. package/target/tsc/shape/path.d.ts +16 -0
  124. package/target/tsc/util/environment.d.ts +14 -0
  125. package/target/tsc/util/index.d.ts +2 -1
  126. package/target/tsc/util/preconditions.d.ts +0 -14
@@ -0,0 +1 @@
1
+ function z(t,e){if(!t)throw new Error(e===void 0?"invalid state":`invalid state: ${e}`)}function b(t,e){if(!t)throw new Error(e===void 0?"invalid argument":`invalid argument: ${e}`)}var f=class t{static Unrounded=new t;radius;smoothing;constructor(e=0,n=0){b(Number.isFinite(e)&&e>=0,"corner radius must be at least 0"),b(n>=0&&n<=1,"corner smoothing must be in [0, 1]"),this.radius=e,this.smoothing=n,Object.freeze(this)}};function E(t,e){b(Number.isFinite(t)&&Number.isFinite(e),"point coordinates must be finite")}function v(t,e){return Math.sqrt(t*t+e*e)}var x=class t{static Zero=new t(0,0);x;y;constructor(e,n){E(e,n),this.x=e,this.y=n,Object.freeze(this)}static interpolate(e,n,o){return new t(e.x+(n.x-e.x)*o,e.y+(n.y-e.y)*o)}minus(e){return new t(this.x-e.x,this.y-e.y)}plus(e){return new t(this.x+e.x,this.y+e.y)}times(e){return new t(this.x*e,this.y*e)}div(e){return new t(this.x/e,this.y/e)}distanceSquared(){return this.x*this.x+this.y*this.y}distance(){return Math.sqrt(this.distanceSquared())}dot(e){return this.x*e.x+this.y*e.y}direction(){let e=this.distance();return z(e>0,"a zero-length vector has no direction"),this.div(e)}rotate90(){return new t(-this.y,this.x)}cross(e){return this.x*e.y-this.y*e.x}rotate(e,n=t.Zero){let o=e*Math.PI/180,r=Math.cos(o),u=Math.sin(o),s=this.x-n.x,i=this.y-n.y;return new t(s*r-i*u+n.x,s*u+i*r+n.y)}};function q(t,e){if(e===void 0)return new x(Math.cos(t),Math.sin(t));let n=v(t,e);return b(n>0,"a zero-length vector has no direction"),new x(t/n,e/n)}function gn(t,e){return t.minus(e).distance()}function Re(t,e,n){return(e.x-t.x)*(n.y-e.y)-(e.y-t.y)*(n.x-e.x)>0}var oe=1e-4,re,O=class t{points;constructor(e){let n=re;if(re=void 0,n==="frame"){this.points=e;return}b(e.length===8,"a cubic curve requires exactly eight coordinates"),b(n?fn(e):e.every(Number.isFinite),"cubic coordinates must be finite"),this.points=Object.freeze(n?e:Array.from(e)),Object.freeze(this)}get anchor0X(){return this.points[0]}get anchor0Y(){return this.points[1]}get control0X(){return this.points[2]}get control0Y(){return this.points[3]}get control1X(){return this.points[4]}get control1Y(){return this.points[5]}get anchor1X(){return this.points[6]}get anchor1Y(){return this.points[7]}static fromPoints(e,n,o,r){return N([e.x,e.y,n.x,n.y,o.x,o.y,r.x,r.y])}static straightLine(e,n,o,r){return N([e,n,e+(o-e)/3,n+(r-n)/3,e+2*(o-e)/3,n+2*(r-n)/3,o,r])}static circularArc(e,n,o,r,u,s){let i=o-e,c=r-n,a=q(i,c),l=q(u-e,s-n),d=a.dot(l);if(d>.999)return t.straightLine(o,r,u,s);let h=Math.sqrt(i*i+c*c)*4/3*(Math.sqrt(2*(1-d))-Math.sqrt(Math.max(0,1-d*d)))/(1-d)*(-a.y*(u-e)+a.x*(s-n)>=0?1:-1);return N([o,r,o-a.y*h,r+a.x*h,u+l.y*h,s-l.x*h,u,s])}static empty(e,n){return N([e,n,e,n,e,n,e,n])}static interpolate(e,n,o){let r=[];X(o);for(let u=0;u<8;u++)r.push(e.points[u]+(n.points[u]-e.points[u])*o);return Me(r)}pointAt(e){return new x(I(this.points,0,e),I(this.points,1,e))}zeroLength(){return Ke(this.points,0)}convexTo(e){let[n,o,,,,,r,u]=this.points;return Re(new x(n,o),new x(r,u),new x(e.points[6],e.points[7]))}calculateBounds(e=[0,0,0,0],n=!1){return j(e),U(e),H(e,this.points,0,n),e}split(e){return we(this.points,0,e).map(N)}reverse(){return N(Se(this.points))}transformed(e){let{points:n}=this;return t.fromPoints(e(n[0],n[1]),e(n[2],n[3]),e(n[4],n[5]),e(n[6],n[7]))}equals(e){return e instanceof t&&this.points.every((n,o)=>n===e.points[o])}toString(){let[e,n,o,r,u,s,i,c]=this.points;return`Cubic(${e},${n} ${o},${r} ${u},${s} ${i},${c})`}};function N(t){return re="frozen",new O(t)}function Me(t){return re="frame",new O(t)}function X(t){b(Number.isFinite(t),"interpolation progress must be finite")}function fn(t){let e=0;for(let n=0;n<8;n++)e+=t[n]*0;return e===0}function Se(t){return[t[6],t[7],t[4],t[5],t[2],t[3],t[0],t[1]]}function I(t,e,n){let o=1-n,r=o*o,u=n*n;return t[e]*r*o+t[e+2]*3*n*r+t[e+4]*3*u*o+t[e+6]*u*n}function we(t,e,n){let o=1-n,r=I(t,e,n),u=I(t,e+1,n),s=t[e],i=t[e+1],c=t[e+2],a=t[e+3],l=t[e+4],d=t[e+5],h=t[e+6],m=t[e+7];return E(r,u),[[s,i,s*o+c*n,i*o+a*n,s*o*o+c*2*o*n+l*n*n,i*o*o+a*2*o*n+d*n*n,r,u],[r,u,c*o*o+l*2*o*n+h*n*n,a*o*o+d*2*o*n+m*n*n,l*o+h*n,d*o+m*n,h,m]]}function Ke(t,e){for(let n=0;n<8;n++)if(!(Math.abs(t[e+n]-t[e+(n&1)])<oe))return!1;return!0}function ve(t,e){return Math.abs(t.points[6]-e.points[0])<=oe&&Math.abs(t.points[7]-e.points[1])<=oe}function j(t){b(t.length>=4,"bounds buffer must have at least four entries")}function U(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function H(t,e,n,o){let r=Ke(e,n);for(let u=0;u<2;u++){let s=e[n+u],i=e[n+u+2],c=e[n+u+4],a=e[n+u+6],l=s,d=s;if(!r)if(l=Math.min(s,a),d=Math.max(s,a),o)l=Math.min(l,i,c),d=Math.max(d,i,c);else{let h=-s+3*i-3*c+a,m=2*s-4*i+2*c,y=-s+i,R=m*m-4*h*y,w=[];Math.abs(h)>=1e-4?R>0&&w.push((-m+Math.sqrt(R))/(2*h),(-m-Math.sqrt(R))/(2*h)):Math.abs(m)>=1e-4&&w.push(-y/m);for(let M of w)if(M>0&&M<1){let k=1-M,S=s*k*k*k+3*i*M*k*k+3*c*M*M*k+a*M*M*M;l=Math.min(l,S),d=Math.max(d,S)}}t[u]=Math.min(t[u],l),t[u+2]=Math.max(t[u+2],d)}}var _=class t{cubics;kind;convex;constructor(e,n,o=!0){b(e.length>0,"a polygon feature requires at least one cubic");for(let r=1;r<e.length;r++)b(ve(e[r-1],e[r]),"polygon feature cubics must be contiguous");this.cubics=Object.freeze([...e]),this.kind=n,this.convex=n==="corner"?o:!0,Object.freeze(this)}get isEdge(){return this.kind==="edge"}get isCorner(){return this.kind==="corner"}get isIgnorableFeature(){return this.kind==="edge"}get isConvexCorner(){return this.kind==="corner"&&this.convex}get isConcaveCorner(){return this.kind==="corner"&&!this.convex}transformed(e){return new t(this.cubics.map(n=>n.transformed(e)),this.kind,this.convex)}reversed(){return new t(this.cubics.map(e=>e.reverse()).reverse(),this.kind,this.kind==="corner"?!this.convex:!0)}equals(e){return e instanceof t&&this.kind===e.kind&&this.convex===e.convex&&this.cubics.length===e.cubics.length&&this.cubics.every((n,o)=>n.equals(e.cubics[o]))}},A=class t{center;features;cubics;constructor(e,n){let o=[];for(let r=0;r<e.length;r++){let{cubics:u}=e[r];for(let s=0;s<u.length;s++)o.push(u[s])}b(e.length>=2,"a polygon requires at least two features");for(let r=0;r<o.length;r++)b(ve(o[(r||o.length)-1],o[r]),"polygon features must form a contiguous closed outline");this.center=n,this.features=Object.freeze([...e]),this.cubics=Object.freeze(Pn(e,o,n)),Object.freeze(this)}get centerX(){return this.center.x}get centerY(){return this.center.y}static fromVertices(e,n=f.Unrounded,o,r,u){b(e.length>=6&&e.length%2===0,"a polygon requires at least three x/y vertex pairs");let s=e.length/2,i=[],c=n instanceof f?{rounding:n,perVertexRounding:o,centerX:r,centerY:u}:n,a=c.perVertexRounding,l=0,d=0;b(a===void 0||a.length*2===e.length,"per-vertex rounding must have one entry per vertex");for(let m=0;m<s;m++)E(e[m*2],e[m*2+1]),l+=e[m*2],d+=e[m*2+1],i.push(a?.[m]??c.rounding??f.Unrounded);let h=pn(e,i);return new t(h,new x(c.centerX??l/s,c.centerY??d/s))}static fromFeatures(e,n,o){let r=0,u=0,s=0;for(let i=0;i<e.length;i++){let{cubics:c}=e[i];for(let a=0;a<c.length;a++)r+=c[a].points[0],u+=c[a].points[1],s++}return new t(e,new x(n??(s===0?0:r/s),o??(s===0?0:u/s)))}static fromNumVertices(e,n=1,o=0,r=0,u=f.Unrounded,s){return b(Number.isInteger(e)&&e>=3,"a polygon requires at least three vertices"),b(Number.isFinite(n)&&n>0,"polygon radius must be positive"),t.fromVertices(ke(e,o,r,n),u,s,o,r)}transformed(e){let n=this.features.map(o=>o.transformed(e));return new t(n,e(this.centerX,this.centerY))}normalized(){let e=this.calculateBounds(),n=e[0],o=e[1],r=e[2]-n,u=e[3]-o,s=Math.max(r,u),i=(s-r)/2-n,c=(s-u)/2-o;return b(s>0,"cannot normalize a zero-area polygon"),this.transformed((a,l)=>new x(Je((a+i)/s),Je((l+c)/s)))}calculateBounds(e=[0,0,0,0],n=!0){j(e),U(e);for(let o=0;o<this.cubics.length;o++)H(e,this.cubics[o].points,0,n);return e}calculateMaxBounds(e=[0,0,0,0]){let{x:n,y:o}=this.center,r=0;j(e);for(let u=0;u<this.cubics.length;u++){let s=this.cubics[u],i=s.pointAt(.5);r=Math.max(r,v(s.points[0]-n,s.points[1]-o),v(i.x-n,i.y-o))}return e[0]=n-r,e[1]=o-r,e[2]=n+r,e[3]=o+r,e}equals(e){return e instanceof t&&this.features.length===e.features.length&&this.features.every((n,o)=>n.equals(e.features[o]))}};function yn(t){return t instanceof A}function ke(t,e,n,...o){let r=[];for(let u=0;u<t;u++){let s=2*Math.PI*u/t,i=o[u%o.length];r.push(e+Math.cos(s)*i,n+Math.sin(s)*i)}return r}function Je(t){return t<0&&t>-1e-12?0:t>1&&t<1.000000000001?1:t}function pn(t,e){let n=e.length,o=[],r=[],u=[],s=[];for(let i=0;i<n;i++){let c=t[i*2],a=t[i*2+1],l=((i||n)-1)*2,d=(i+1)%n*2,h=t[l]-c,m=t[l+1]-a,y=t[d]-c,R=t[d+1]-a,w=v(h,m),M=v(y,R),k=w===0||M===0,S=k?[0,0,0,0]:[h/w,m/w,y/M,R/M],B=Math.max(-1,Math.min(1,S[0]*S[2]+S[1]*S[3])),$=Math.sqrt(1-B*B),{radius:W,smoothing:Z}=e[i],D=!k&&$>.001?W*(B+1)/$:0;S.push(D,(1+Z)*D,m*y-h*R),o.push(S)}for(let i=0;i<n;i++){let c=(i+1)%n,a=v(t[i*2]-t[c*2],t[i*2+1]-t[c*2+1]),l=o[i][4]+o[c][4],d=o[i][5]+o[c][5];r.push(l>a?[a/l,0]:d>a?[1,(a-l)/(d-l)]:[1,1])}for(let i=0;i<n;i++){let c=o[i],a=t[i*2],l=t[i*2+1],{radius:d,smoothing:h}=e[i],m=c[4],y=c[5],R=r[(i||n)-1],w=r[i],M=[m*R[0]+(y-m)*R[1],m*w[0]+(y-m)*w[1]],k=Math.min(M[0],M[1]),S=Math.min(k,m);if(!(m>=1e-4&&k>=1e-4&&d>=1e-4)){u.push([O.empty(a,l)]);continue}let B=d*S/m,$=(c[0]+c[2])/2,W=(c[1]+c[3])/2,Z=v($,W),D=v(B,S),K=a+$/Z*D,J=l+W/Z*D,Q=[a+c[0]*S,l+c[1]*S,a+c[2]*S,l+c[3]*S],ze=be=>{let V=be*2,ge=c[V],fe=c[V+1],ee=Q[V],ne=Q[V+1],qe=be===0?((i||n)-1)*2:(i+1)%n*2,je=t[qe],Ye=t[qe+1],ye=M[be],pe=ye>y?h:ye>m?h*(ye-m)/(y-m):0,$e=S*(1+pe),De=a+ge*$e,Xe=l+fe*$e,Ue=q(ee+((ee+Q[2-V])/2-ee)*pe-K,ne+((ne+Q[3-V])/2-ne)*pe-J),Pe=K+Ue.x*B,xe=J+Ue.y*B,He=-(Pe-K),_e=-(xe-J),te=ge*He+fe*_e,Ce=(Pe-je)*He+(xe-Ye)*_e,Ge=Math.abs(te)<1e-4||Math.abs(te)<1e-4*Math.abs(Ce),We=Ge?ee:je+ge*(Ce/te),Ze=Ge?ne:Ye+fe*(Ce/te);return[De,Xe,(De+We*2)/3,(Xe+Ze*2)/3,We,Ze,Pe,xe]},me=ze(0),he=ze(1);u.push([N(me),O.circularArc(K,J,me[6],me[7],he[6],he[7]),N(Se(he))])}for(let i=0;i<n;i++){let c=u[i][u[i].length-1].points,a=u[(i+1)%n][0].points;s.push(new _(u[i],"corner",o[i][6]>0),new _([O.straightLine(c[6],c[7],a[0],a[1])],"edge"))}return s}function Pn(t,e,n){let o=t[0].cubics,r=[],u=e;if(o.length===3){let i=o[1].split(.5);u=[i[1],o[2]].concat(e.slice(3),o[0],i[0])}for(let i=0;i<u.length;i++){let c=u[i];c.zeroLength()?r.length>0&&r.push(Qe(r.pop(),c.points,6)):r.push(c)}if(r.length===0)return[O.empty(n.x,n.y)];let s=r[0].points;return r.push(Qe(r.pop(),s,0)),r}function Qe(t,e,n){let o=[...t.points];return o[6]=e[n],o[7]=e[n+1],N(o)}var T=class t{static circle(e=8,n=1,o=0,r=0){return b(Number.isInteger(e)&&e>=3,"a circle requires at least three vertices"),b(Number.isFinite(n)&&n>0,"circle radius must be positive"),A.fromNumVertices(e,n/Math.cos(Math.PI/e),o,r,new f(n))}static rectangle(e=2,n=2,o=f.Unrounded,r,u=0,s=0){let i=u+e/2,c=s+n/2,a=u-e/2,l=s-n/2;return b(Number.isFinite(e)&&e>0&&Number.isFinite(n)&&n>0,"rectangle dimensions must be positive"),A.fromVertices([i,c,a,c,a,l,i,l],o,r,u,s)}static star(e,n=1,o=.5,r=f.Unrounded,u,s,i=0,c=0){return b(Number.isInteger(e)&&e>=2,"a star requires at least two outer vertices"),b(Number.isFinite(n)&&n>0&&Number.isFinite(o)&&o>0,"star radii must be positive"),b(o<n,"star inner radius must be less than its radius"),A.fromVertices(ke(e*2,i,c,n,o),r,s??Array.from({length:e*2},(a,l)=>l%2===0?r:u??r),i,c)}static pill(e=2,n=1,o=0,r=0,u=0){return b(Number.isFinite(e)&&e>0&&Number.isFinite(n)&&n>0,"pill dimensions must be positive"),t.rectangle(e,n,new f(Math.min(e,n)/2,o),void 0,r,u)}};var xn=new x(.5,.5),Cn=[];function P(t,e,n){let o=[],r=[],u=t.map(([,,i,c])=>new f(i,c)),s=(i,c,a)=>{o.push(i,c),r.push(u[a])};if(n){let i=e*2,c=2*Math.PI/i,a=t.map(([d,h])=>Math.atan2(h-.5,d-.5)),l=t.map(([d,h])=>v(d-.5,h-.5));for(let d=0;d<i;d++){let h=d%2===0;for(let m=0;m<t.length-(h?0:1);m++){let y=h?m:t.length-1-m,R=h?c*d+a[y]:c*d+(c-a[y]+2*a[0]);s(.5+Math.cos(R)*l[y],.5+Math.sin(R)*l[y],y)}}}else for(let i=0;i<e;i++)for(let c=0;c<t.length;c++){let a=new x(t[c][0],t[c][1]).rotate(i*360/e,xn);s(a.x,a.y,c)}return A.fromVertices(o,f.Unrounded,r,.5,.5)}function Y(t,e){return t.transformed((n,o)=>new x(n,o).rotate(e))}function en(t,e){return t.transformed((n,o)=>new x(n,o*e))}function g(t,e){return Cn[t]??=e().normalized()}function Rn(){return g(0,()=>T.circle(10))}function Mn(){return g(5,()=>Y(en(T.circle(),.64),-45))}function Sn(){return g(6,()=>P([[.961,.039,.426],[1.001,.428],[1,.609,1]],2,!0))}function wn(){return g(12,()=>P([[.5,-.009,.172],[1.03,.365,.164],[.828,.97,.169]],1,!0))}function vn(){return g(15,()=>T.star(8,1,.8,new f(.15)))}function kn(){return g(16,()=>P([[1.237,1.236,.258],[.5,.918,.233]],4))}function An(){return g(19,()=>Y(T.star(9,1,.8,new f(.5)),-90))}function Tn(){return g(24,()=>P([[.193,.277,.053],[.176,.055,.053]],10))}var ue=class t{static get Circle(){return Rn()}static get Square(){return g(1,()=>T.rectangle(1,1,new f(.3)))}static get Slanted(){return g(2,()=>P([[.926,.97,.189,.811],[-.021,.967,.187,.057]],2))}static get Arch(){return g(3,()=>Y(A.fromNumVertices(4,1,0,0,f.Unrounded,[new f(1),new f(1),new f(.2),new f(.2)]),-135))}static get SemiCircle(){return g(4,()=>T.rectangle(1.6,1,f.Unrounded,[new f(.2),new f(.2),new f(1),new f(1)]))}static get Oval(){return Mn()}static get Pill(){return Sn()}static get Triangle(){return g(7,()=>Y(A.fromNumVertices(3,1,0,0,new f(.2)),-90))}static get Arrow(){return g(8,()=>P([[.5,.892,.313],[-.216,1.05,.207],[.499,-.16,.215,1],[1.225,1.06,.211]],1))}static get Fan(){return g(9,()=>P([[1.004,1,.148,.417],[0,1,.151],[0,-.003,.148],[.978,.02,.803]],1))}static get Diamond(){return g(10,()=>P([[.5,1.096,.151,.524],[.04,.5,.159]],2))}static get ClamShell(){return g(11,()=>P([[.171,.841,.159],[-.02,.5,.14],[.17,.159,.159]],2))}static get Pentagon(){return wn()}static get Gem(){return g(13,()=>P([[.499,1.023,.241,.778],[-.005,.792,.208],[.073,.258,.228],[.433,0,.491]],1,!0))}static get VerySunny(){return g(14,()=>P([[.5,1.08,.085],[.358,.843,.085]],8))}static get Sunny(){return vn()}static get Cookie4Sided(){return kn()}static get Cookie6Sided(){return g(17,()=>P([[.723,.884,.394],[.5,1.099,.398]],6))}static get Cookie7Sided(){return g(18,()=>Y(T.star(7,1,.75,new f(.5)),-90))}static get Cookie9Sided(){return An()}static get Cookie12Sided(){return g(20,()=>Y(T.star(12,1,.8,new f(.5)),-90))}static get Clover4Leaf(){return g(21,()=>P([[.5,.074],[.725,-.099,.476]],4,!0))}static get Clover8Leaf(){return g(22,()=>P([[.5,.036],[.758,-.101,.209]],8))}static get Burst(){return g(23,()=>P([[.5,-.006,.006],[.592,.158,.006]],12))}static get SoftBurst(){return Tn()}static get Boom(){return g(25,()=>P([[.457,.296,.007],[.5,-.051,.007]],15))}static get SoftBoom(){return g(26,()=>P([[.733,.454],[.839,.437,.532],[.949,.449,.439,1],[.998,.478,.174]],16,!0))}static get Flower(){return g(27,()=>P([[.37,.187],[.416,.049,.381],[.479,.001,.095]],8,!0))}static get Puffy(){return g(28,()=>en(P([[.5,.053],[.545,-.04,.405],[.67,-.035,.426],[.717,.066,.574],[.722,.128],[.777,.002,.36],[.914,.149,.66],[.926,.289,.66],[.881,.346],[.94,.344,.126],[1.003,.437,.255]],2,!0),.742))}static get PuffyDiamond(){return g(29,()=>P([[.87,.13,.146],[.818,.357],[1,.332,.853]],4,!0))}static get Ghostish(){return g(30,()=>P([[.5,0,1],[1,0,1],[1,1.14,.254,.106],[.575,.906,.253]],1,!0))}static get PixelCircle(){return g(31,()=>P([[.5,0],[.704,0],[.704,.065],[.843,.065],[.843,.148],[.926,.148],[.926,.296],[1,.296]],2,!0))}static get PixelTriangle(){return g(32,()=>P([[.11,.5],[.113,0],[.287,0],[.287,.087],[.421,.087],[.421,.17],[.56,.17],[.56,.265],[.674,.265],[.675,.344],[.789,.344],[.789,.439],[.888,.439]],1,!0))}static get Bun(){return g(33,()=>P([[.796,.5],[.853,.518,1],[.992,.631,1],[.968,1,1]],2,!0))}static get Heart(){return g(34,()=>P([[.5,.268,.016],[.792,-.066,.958],[1.064,.276,1],[.501,.946,.129]],1,!0))}static byName(e){return b(Ae.includes(e),`unknown Material shape: ${e}`),t[e]}static all(){return Ae.map(e=>({name:e,polygon:t[e]}))}},Ae=Nn();function Nn(){return Object.freeze(Object.getOwnPropertyNames(ue).filter(t=>t<"a"))}var nn=new WeakMap,Ne=class{start;end;cubicCount;#e;#n;constructor(e,n){let o=[],r=[];En(on(e),on(n),o,r);for(let u of[o,r]){for(let s=8;s<u.length;s+=8)u[s]=u[s-2],u[s+1]=u[s-1];u[u.length-2]=u[0],u[u.length-1]=u[1]}for(let u=0;u<o.length;u++)r[u]=r[u]-o[u];this.start=e,this.end=n,this.cubicCount=o.length/8,this.#e=o,this.#n=r,Object.freeze(this)}asCubics(e){let n=[];X(e);for(let o=0;o<this.#e.length;o+=8)n.push(this.#t(o,e));return n}forEachCubic(e,n){X(e);for(let o=0;o<this.#e.length;o+=8)n(this.#t(o,e))}calculateBounds(e=[0,0,0,0],n=!0){return tn(e,this.start.calculateBounds([0,0,0,0],n),this.end.calculateBounds([0,0,0,0],n))}calculateMaxBounds(e=[0,0,0,0]){return tn(e,this.start.calculateMaxBounds(),this.end.calculateMaxBounds())}_frame(e,n){X(e);for(let o=0;o<this.#e.length;o++)n[o]=this.#e[o]+this.#n[o]*e;return n}#t(e,n){let o=this.#e,r=this.#n;return Me([o[e]+r[e]*n,o[e+1]+r[e+1]*n,o[e+2]+r[e+2]*n,o[e+3]+r[e+3]*n,o[e+4]+r[e+4]*n,o[e+5]+r[e+5]*n,o[e+6]+r[e+6]*n,o[e+7]+r[e+7]*n])}};function tn(t,e,n){return j(t),t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function F(t){let e=t-Math.floor(t);return e<1?e:0}function ie(t,e){return Math.min(Math.abs(t-e),1-Math.abs(t-e))}function rn(t,e,n){return n>=e?e<=t&&t<=n:t>=e||t<=n}function Oe(t){let e=t[0],n=t[1];for(let o=1;o<=3;o++){let r=I(t,0,o/3),u=I(t,1,o/3);E(r,u),t.push(v(r-e,u-n)),e=r,n=u}return t}function un(t){return t[8]+t[9]+t[10]}function sn(t,e){let n=[],o=0;for(let r=0;r<t.length;r++){let u=e[r+1];u-e[r]>1e-4&&(n.push({curve:t[r],start:o,end:u}),o=u)}return z(n.length>0,"a measured outline requires a curve of nonzero length"),n.push({...n.pop(),end:1}),n}function on(t){let{features:e}=t,n=nn.get(t);if(n===void 0){let o=[],r=[0],u=[],s=0,i=0;for(let c=0;c<e.length;c++){let{cubics:a}=e[c];for(let l=0;l<a.length;l++)o.push(Oe([...a[l].points])),s+=un(o[o.length-1]),r.push(s)}b(s>0&&Number.isFinite(s),"a polygon outline must have length");for(let c=0;c<r.length;c++)r[c]=r[c]/s;for(let c=0;c<e.length;c++){let{cubics:a,kind:l,convex:d}=e[c],h=i+(a.length>>1),m=a[0].points,y=a[a.length-1].points;l==="corner"&&u.push({convex:d,progress:F((r[h]+r[h+1])/2),x:(m[0]+y[6])/2,y:(m[1]+y[7])/2}),i+=a.length}n={segments:sn(o,r),corners:u},nn.set(t,n)}return n}function Fe({curve:t,start:e,end:n},o){let r=Math.max(e,Math.min(o,n)),u=(n-e===0?0:(r-e)/(n-e))*un(t),s=1;for(let c=8;c<11;c++){if(t[c]>=u){s=(c-7)/3-(1-u/t[c])/3;break}u-=t[c]}let i=we(t,0,s);return[{curve:Oe(i[0]),start:e,end:r},{curve:Oe(i[1]),start:r,end:n}]}function On(t,e){let n=t.find(({end:o})=>Math.abs(o-e)<=1e-6);return e<1e-4?0:n===void 0?e:n.end<1?n.end:0}function Fn(t,e){let n=t.findIndex(({start:s,end:i})=>s<=e&&e<=i),o=Fe(t[n],e),r=[o[1].curve],u=[0,o[1].end-e];for(let s=n+1;s<n+t.length;s++){let{curve:i,end:c}=t[s%t.length];r.push(i),u.push(c-e+(s<t.length?0:1))}return r.push(o[0].curve),u.push(1),sn(r,u)}function Te(t,e,n){let o=t.length-1,r=0;for(;r<o&&!rn(n,t[r],t[r+1]);)r++;let u=r===o?0:r+1,s=t[r],i=e[r],c=F(t[u]-s);return F(i+F(e[u]-i)*(c<.001?.5:F(n-s)/c))}function Bn(t,e){let n=[],o=new Set,r=[],u=[],s=0;for(let i=0;i<t.length;i++)for(let c=0;c<e.length;c++){let a=t[i],l=e[c],d=(a.x-l.x)*(a.x-l.x)+(a.y-l.y)*(a.y-l.y);a.convex===l.convex&&(n.push([a,l,d]),s=Math.max(s,d*1e-9))}for(let i=0;i<n.length;i++)n[i][2]=s>0?Math.round(n[i][2]/s):0;if(n.sort((i,c)=>i[2]-c[2]||i[0].progress-c[0].progress||i[1].progress-c[1].progress),n.length===1){let[{progress:i},{progress:c}]=n[0];return[[i,F(i+.5)],[c,F(c+.5)]]}for(let i=0;i<n.length;i++){let c=n[i][0],a=n[i][1],l=c.progress,d=a.progress;if(o.has(c)||o.has(a))continue;let h=r.findIndex(m=>m>l);if(h<0&&(h=r.length),r.length>0){let m=(h||r.length)-1,y=h%r.length;if(ie(l,r[m])<=1e-4||ie(l,r[y])<=1e-4||ie(d,u[m])<=1e-4||ie(d,u[y])<=1e-4||r.length>=2&&!rn(d,u[m],u[y]))continue}if(r.splice(h,0,l),u.splice(h,0,d),o.add(c).add(a),r.length===Math.min(t.length,e.length))break}return r.length>=2?[r,u]:[[0,.5],[0,.5]]}function se(t,e){for(let n=0;n<8;n++)t.push(e[n])}function En(t,e,n,o){let[r,u]=Bn(t.corners,e.corners),s=On(e.segments,Te(r,u,0)),i=t.segments,c=s===0?e.segments:Fn(e.segments,s),a=0,l=0,d=i[0],h=c[0];for(;d!==void 0&&h!==void 0;){let m=a===i.length-1?1:d.end,y=l===c.length-1?1:Te(u,r,F(h.end+s)),R=Math.min(m,y);if(m>R+1e-6){let w=Fe(d,R);se(n,w[0].curve),d=w[1]}else se(n,d.curve),d=i[++a];if(y>R+1e-6){let w=Fe(h,F(Te(r,u,R)-s));se(o,w[0].curve),h=w[1]}else se(o,h.curve),h=c[++l]}z(d===void 0&&h===void 0,"polygon outlines could not be fully matched")}var G=1e5,le=[1,0,0,1,0,0],C=new Uint8Array(0),p=0,cn,Be=new Float64Array(0);function Ie(t){return b(Number.isFinite(t),"path coordinates must be finite"),String(Math.round(t*G)/G)}var L=class{#e;constructor(){this.#e=""}moveTo(e,n){return this.#n("M",[e,n])}lineTo(e,n){return this.#n("L",[e,n])}cubicTo(e,n,o,r,u,s){return this.#n("C",[e,n,o,r,u,s])}close(){return this.#n("Z",[])}rewind(){return this._assign("")}toSvgPathData(){return this.#e}toString(){return this.#e}_assign(e){return this.#e=e,this}#n(e,n){return this._assign(this.#e+e+n.map(Ie).join(" "))}};function In(t,e=new L){return b(t.length>0,"a path requires at least one cubic"),de(e,Ve(t),t.length,le,!1)}function dn(t,e,n=new L){let o=Ve(t.cubics);return de(n,o,t.cubics.length,mn(o,t.centerX,t.centerY,e?.startAngle),e?.repeatPath===!0)}function Ln(t,e,n,o=new L){let r=t._frame(e,Le(t.cubicCount)),{start:u,end:s}=t;return de(o,r,t.cubicCount,mn(r,u.centerX+(s.centerX-u.centerX)*e,u.centerY+(s.centerY-u.centerY)*e,n?.startAngle),n?.repeatPath===!0)}var an=/[\s,]*/y,Vn=/[A-Za-z]/y,zn=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,qn=/[01]/y,jn=7,Yn=new Set([3,4]);function ce(t,e,n){return t.lastIndex=n,t.exec(e)?.[0]}function $n(t,e){let n="",o="",r=0,u=!1,s=ce(an,t,0)?.length??0;for(;s<t.length;){let i=ce(Vn,t,s),c=u&&Yn.has(r%jn),a=i??ce(c?qn:zn,t,s);if(b(a!==void 0,`invalid path data at ${s}: ${t}`),s+=a.length,s+=ce(an,t,s)?.length??0,i!==void 0){n+=i,o="",r=0,u=i==="A"||i==="a";continue}let l=String(Number(Number(a).toFixed(e))).replace(/^(-?)0\./,"$1."),d=o===""||l.startsWith("-")||l.startsWith(".")&&o.includes(".");n+=d?l:` ${l}`,o=l,r++}return n}function Dn(t){return dn(t).toSvgPathData()}function Xn(t,e,n=e){return hn(Ve(t.cubics),t.cubics.length,e,n)}function Un(t,e,n,o=n){return hn(t._frame(e,Le(t.cubicCount)),t.cubicCount,n,o)}function Le(t){return Be.length<t*8&&(Be=new Float64Array(t*16)),Be}function Ve(t){let e=Le(t.length);for(let n=0;n<t.length;n++){let o=t[n].points;for(let r=0;r<8;r++)e[n*8+r]=o[r]}return e}function mn(t,e,n,o){if(o===void 0)return le;let r=o*Math.PI/180-Math.atan2(t[1]-n,t[0]-e),u=Math.cos(r),s=Math.sin(r);return[u,s,-s,u,e-u*e+s*n,n-s*e-u*n]}function hn(t,e,n,o){b(Number.isFinite(n)&&n>0&&Number.isFinite(o)&&o>0,"a CSS path box must have a positive size");let r=[0,0,0,0];U(r);for(let l=0;l<e;l++)H(r,t,l*8,!0);let[u,s,i,c]=r,a=[n,0,0,o,(1-u-i)*n/2,(1-s-c)*o/2];return`path('${de(new L,t,e,a,!1)}')`}function Ee(t){if(p+t>C.length){let e=new Uint8Array(Math.max(C.length*2,p+t));e.set(C),C=e}}function ln(t){let e=Math.round(t*G);if(e>-2147483648&&e<2147483648){e<0&&(C[p++]=45,e=-e);let n=e%G;if(bn((e-n)/G),n>0){C[p]=46;for(let o=p+5,r=n;o>p;o--)C[o]=48+r%10,r=(r-r%10)/10;for(p+=6;C[p-1]===48;)p--}}else{let n=Ie(t);for(let o=0;o<n.length;o++)C[p++]=n.charCodeAt(o)}}function bn(t){t>=10&&bn((t-t%10)/10),C[p++]=48+t%10}function ae(t,e,n){ln(t===le?e:t[0]*e+t[2]*n+t[4]),C[p++]=32,ln(t===le?n:t[1]*e+t[3]*n+t[5])}function de(t,e,n,o,r){let u=p=0;try{Ee(200),C[p++]=77,ae(o,e[0],e[1]);for(let s=0;s<n*8;s+=8)u=p,Ee(200),C[p++]=67,ae(o,e[s+2],e[s+3]),C[p++]=32,ae(o,e[s+4],e[s+5]),C[p++]=32,ae(o,e[s+6],e[s+7]);if(r){let s=p;Ee(s),C[p++]=76,C.copyWithin(p,1,s),p+=s-1}C[p++]=90,u=p}finally{p=u,t._assign(Hn())}return t}function Hn(){return cn??=new TextDecoder,cn.decode(C.subarray(0,p))}export{oe as CUBIC_CONTINUITY_EPSILON,f as CornerRounding,O as Cubic,Ae as MATERIAL_SHAPE_NAMES,ue as MaterialShapes,Ne as Morph,L as Path,x as Point,_ as PolygonFeature,A as RoundedPolygon,T as Shapes,$n as compactSvgPath,In as cubicsToPath,q as directionVector,gn as distanceBetween,Ie as formatPathCoordinate,Re as isConvex,yn as isRoundedPolygon,Un as morphToCssPath,Ln as morphToPath,dn as roundedPolygonToPath,Xn as toCssPath,Dn as toSvgPath};
@@ -0,0 +1,51 @@
1
+ import type { SpringOptions } from "./spring";
2
+ /**
3
+ * Height of a container that follows its content.
4
+ *
5
+ * @see {@link followHeight}
6
+ */
7
+ export interface FollowedHeight {
8
+ /**
9
+ * Stop following. A spring under way stops where it is, and the height stays there.
10
+ */
11
+ cancel(): void;
12
+ /**
13
+ * Wait until the height of the container rests where its content last told it to.
14
+ *
15
+ * A change of the content reaches the container with the next rendering update, so wait for
16
+ * that update first. A hidden document gets none, and this would wait for ever on it.
17
+ *
18
+ * @returns promise resolved once no spring moves the height
19
+ */
20
+ settled(): Promise<void>;
21
+ }
22
+ /**
23
+ * Make the height of a container follow the height of its content.
24
+ *
25
+ * The content keeps its own height, laid out at the width of the container, and the container
26
+ * springs to it whenever it changes. A spring under way is retargeted, keeping its speed, so that
27
+ * content changing again does not jolt the container. The height changes at once while the
28
+ * container shows nothing, as before its entrance, and when the width of the content changed too,
29
+ * as when the window resizes, because the height that follows from a new width is not a motion.
30
+ * Under a hidden document or reduced motion, the spring settles at once, as every spring does.
31
+ *
32
+ * The container must clip what overflows it, as the content does while the container grows, and
33
+ * while an expressive spring overshoots as it shrinks. It holds nothing but its content, without
34
+ * padding or a border of its own. Height here is the block size, in a vertical writing mode too.
35
+ *
36
+ * ```tsx
37
+ * onMount(() => void followHeight(frame, content));
38
+ *
39
+ * <div ref={frame} style={{ overflow: "clip" }}><div ref={content}>{props.children}</div></div>
40
+ * ```
41
+ *
42
+ * @param container - element whose height follows
43
+ * @param content - child of the container, whose height it follows
44
+ * @param opts - spring characteristics, the default spatial spring unless named
45
+ * @returns the height followed
46
+ *
47
+ * @remarks
48
+ * Within a Solid owner, following stops as the owner is disposed. Otherwise, the caller must
49
+ * {@link FollowedHeight.cancel | cancel} it.
50
+ */
51
+ export declare function followHeight(container: HTMLElement, content: HTMLElement, opts?: Readonly<Omit<SpringOptions, "unit" | "velocity">>): FollowedHeight;
@@ -12,20 +12,24 @@
12
12
  * gesture drives or user input retargets mid-flight: it reads its stiffness and damping ratio from
13
13
  * the same roles, preserves its velocity when retargeted, and accepts the release velocity
14
14
  * estimated by a {@link VelocityTracker}. Runtime springs of a window share one animation-frame
15
- * callback, available to other per-frame motion through {@link subscribeMotionFrames}.
15
+ * callback, available to other per-frame motion through {@link subscribeMotionFrames}. {@link
16
+ * followHeight} springs the height of a container to its content.
16
17
  *
17
18
  * Web Animation motion completes without animating during server rendering or when the API is
18
19
  * unavailable. Runtime springs settle immediately during server rendering, without an animation
19
- * frame clock, or when reduced motion is requested. Both motion APIs honor 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
  *
@@ -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
  *