@nylas/react 1.1.0-canary.9 → 1.1.0

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 (156) hide show
  1. package/README.md +110 -2
  2. package/dist/add-circle-icon_2.entry-7165bd0e.js +25 -0
  3. package/dist/add-circle-icon_2.entry-f1ddca18.cjs +1 -0
  4. package/dist/archive-icon_7.entry-7411c224.js +75 -0
  5. package/dist/archive-icon_7.entry-e3df60ed.cjs +1 -0
  6. package/dist/arrow-icon.entry-280e18b0.cjs +1 -0
  7. package/dist/arrow-icon.entry-38949317.js +15 -0
  8. package/dist/bold-icon_3.entry-5963945c.js +35 -0
  9. package/dist/bold-icon_3.entry-5dffbedd.cjs +1 -0
  10. package/dist/button-component_2.entry-237733b4.js +26 -0
  11. package/dist/button-component_2.entry-b29d2873.cjs +1 -0
  12. package/dist/calendar-agenda-fill-icon_48.entry-9afba869.js +5105 -0
  13. package/dist/calendar-agenda-fill-icon_48.entry-d3830dbb.cjs +7 -0
  14. package/dist/calendar-cancel-icon.entry-77ccf227.cjs +1 -0
  15. package/dist/calendar-cancel-icon.entry-780723a6.js +15 -0
  16. package/dist/calendar-check-icon_2.entry-2c89c230.js +25 -0
  17. package/dist/calendar-check-icon_2.entry-b37ac7f0.cjs +1 -0
  18. package/dist/calendar-icon.entry-02dd3990.js +15 -0
  19. package/dist/calendar-icon.entry-ffc93569.cjs +1 -0
  20. package/dist/checkbox-component_2.entry-00b6a1e9.cjs +1 -0
  21. package/dist/checkbox-component_2.entry-ee9d0e6c.js +56 -0
  22. package/dist/chevron-icon_3.entry-468abc26.cjs +1 -0
  23. package/dist/chevron-icon_3.entry-f62e9ef1.js +129 -0
  24. package/dist/clock-icon_4.entry-766a1b23.js +45 -0
  25. package/dist/clock-icon_4.entry-7dc2cc4a.cjs +1 -0
  26. package/dist/constants-50c3e067-8a40a5fe.js +3883 -0
  27. package/dist/constants-50c3e067-9f2a6372.cjs +15 -0
  28. package/dist/copy-icon.entry-2a841508.js +15 -0
  29. package/dist/copy-icon.entry-e5251410.cjs +1 -0
  30. package/dist/core-js-38e53e34.cjs +4 -0
  31. package/dist/core-js-a9d3b6e1.js +3297 -0
  32. package/dist/delete-icon_2.entry-1a5c39dc.cjs +1 -0
  33. package/dist/delete-icon_2.entry-64555a2f.js +25 -0
  34. package/dist/document-refresh-icon.entry-4bf6398b.js +15 -0
  35. package/dist/document-refresh-icon.entry-fdc7ddda.cjs +1 -0
  36. package/dist/dom-68f08be9.cjs +15 -0
  37. package/dist/dom-86e17616.js +664 -0
  38. package/dist/{types/elements → elements}/index.d.ts +47 -1
  39. package/dist/elements-dc5b338e-2da1fe61.js +28031 -0
  40. package/dist/elements-dc5b338e-c8016c3d.cjs +16516 -0
  41. package/dist/flow-40ff9cea-6f8c30e2.cjs +9 -0
  42. package/dist/flow-40ff9cea-ee70fdf5.js +505 -0
  43. package/dist/focus-visible-e8093c16-0a38a184.cjs +1 -0
  44. package/dist/focus-visible-e8093c16-9d0c98c0.js +84 -0
  45. package/dist/forward-icon_6.entry-390ef70a.js +953 -0
  46. package/dist/forward-icon_6.entry-7238ef38.cjs +3 -0
  47. package/dist/globe-icon.entry-81f42f89.cjs +1 -0
  48. package/dist/globe-icon.entry-8d106260.js +15 -0
  49. package/dist/google-logo-icon_4.entry-aabd3886.js +680 -0
  50. package/dist/google-logo-icon_4.entry-fa2b8999.cjs +1 -0
  51. package/dist/index-53420959-5fc8ad2b.js +5 -0
  52. package/dist/index-53420959-fcf45780.cjs +1 -0
  53. package/dist/index-5ccfd9df.js +7859 -0
  54. package/dist/index-6d9eeb53-58c8980a.js +4971 -0
  55. package/dist/index-6d9eeb53-b2a6d09f.cjs +41 -0
  56. package/dist/index-eb33703c.cjs +42 -0
  57. package/dist/index.es-c9454237-00ccd1e6.js +3135 -0
  58. package/dist/index.es-c9454237-b64161d1.cjs +7 -0
  59. package/dist/info-icon_2.entry-b2e11336.cjs +1 -0
  60. package/dist/info-icon_2.entry-bb8ed71c.js +34 -0
  61. package/dist/input-component.entry-378b1ccc.cjs +1 -0
  62. package/dist/input-component.entry-cb86170f.js +65 -0
  63. package/dist/input-dropdown.entry-98954c93.cjs +1 -0
  64. package/dist/input-dropdown.entry-a76c339e.js +134 -0
  65. package/dist/mailbox-store-edc386fc-156b7236.cjs +1 -0
  66. package/dist/mailbox-store-edc386fc-8bc7558b.js +380 -0
  67. package/dist/multi-select-dropdown.entry-40b855e1.cjs +1 -0
  68. package/dist/multi-select-dropdown.entry-6b686695.js +91 -0
  69. package/dist/nylas-booked-event-card_12.entry-9d693125.cjs +1 -0
  70. package/dist/nylas-booked-event-card_12.entry-e861bb16.js +1134 -0
  71. package/dist/nylas-form-card.entry-b158d789.js +57 -0
  72. package/dist/nylas-form-card.entry-ca4a8746.cjs +1 -0
  73. package/dist/nylas-if-state.entry-8e4d922c.js +94 -0
  74. package/dist/nylas-if-state.entry-95fac42d.cjs +1 -0
  75. package/dist/nylas-list-folders.entry-83c39684.js +120 -0
  76. package/dist/nylas-list-folders.entry-8a22e0c8.cjs +1 -0
  77. package/dist/nylas-list-threads.entry-54c582af.cjs +1 -0
  78. package/dist/nylas-list-threads.entry-7ea370e1.js +70 -0
  79. package/dist/nylas-login.entry-9115fd81.js +73 -0
  80. package/dist/nylas-login.entry-fb627e40.cjs +1 -0
  81. package/dist/nylas-mailbox-pagination.entry-04626d27.cjs +1 -0
  82. package/dist/nylas-mailbox-pagination.entry-3ff02cf9.js +101 -0
  83. package/dist/nylas-mailbox-toolbar-button.entry-8d00c789.cjs +1 -0
  84. package/dist/nylas-mailbox-toolbar-button.entry-f752e925.js +82 -0
  85. package/dist/nylas-mailbox.entry-99c27b6c.js +134 -0
  86. package/dist/nylas-mailbox.entry-b3974f4e.cjs +1 -0
  87. package/dist/nylas-provider.entry-a3ad02a5.cjs +1 -0
  88. package/dist/nylas-provider.entry-c206aa32.js +145 -0
  89. package/dist/nylas-reminder-emails.entry-414ce6fe.js +129 -0
  90. package/dist/nylas-reminder-emails.entry-59c07bfe.cjs +4 -0
  91. package/dist/nylas-reminder-time_2.entry-197d83a0.js +105 -0
  92. package/dist/nylas-reminder-time_2.entry-d79dcd85.cjs +1 -0
  93. package/dist/nylas-scheduler-editor.entry-7f389982.js +1447 -0
  94. package/dist/nylas-scheduler-editor.entry-f1c6964a.cjs +2 -0
  95. package/dist/nylas-scheduling.entry-1a8bd6fc.cjs +1 -0
  96. package/dist/nylas-scheduling.entry-4fa5381d.js +345 -0
  97. package/dist/nylas-threads-refresh.entry-20602e7b.js +74 -0
  98. package/dist/nylas-threads-refresh.entry-56b53449.cjs +1 -0
  99. package/dist/nylas-threads-search.entry-8872473c.js +69 -0
  100. package/dist/nylas-threads-search.entry-8e0ec3ae.cjs +1 -0
  101. package/dist/nylas-time-window-picker.entry-9ac542b7.js +316 -0
  102. package/dist/nylas-time-window-picker.entry-ca47f721.cjs +1 -0
  103. package/dist/nylas-view-thread.entry-1f758e43.cjs +1 -0
  104. package/dist/nylas-view-thread.entry-dcd3d5be.js +203 -0
  105. package/dist/person-icon.entry-63b28ace.cjs +1 -0
  106. package/dist/person-icon.entry-93130c05.js +15 -0
  107. package/dist/play-icon_2.entry-6a99c32d.js +25 -0
  108. package/dist/play-icon_2.entry-b67fb649.cjs +1 -0
  109. package/dist/react.cjs +1 -0
  110. package/dist/react.js +144 -0
  111. package/dist/refresh-icon.entry-84783c91.js +15 -0
  112. package/dist/refresh-icon.entry-b49792fc.cjs +1 -0
  113. package/dist/register-component-887199a9-003f96c5.cjs +1 -0
  114. package/dist/register-component-887199a9-b41dfa7a.js +109 -0
  115. package/dist/scheduler-config-store-2a3b403d-73610089.js +27 -0
  116. package/dist/scheduler-config-store-2a3b403d-a5e3433a.cjs +1 -0
  117. package/dist/scheduler-store-fe281404-bddb1b6a.js +469 -0
  118. package/dist/scheduler-store-fe281404-c3e477f6.cjs +1 -0
  119. package/dist/textarea-component.entry-28c4bc05.cjs +1 -0
  120. package/dist/textarea-component.entry-40e959e5.js +36 -0
  121. package/dist/time-period-selector.entry-af71523a.cjs +1 -0
  122. package/dist/time-period-selector.entry-da5d8652.js +93 -0
  123. package/dist/translate-icon.entry-92b83635.js +15 -0
  124. package/dist/translate-icon.entry-a2ed4f76.cjs +1 -0
  125. package/dist/warning-icon.entry-19f721c3.js +15 -0
  126. package/dist/warning-icon.entry-3ab9a59e.cjs +1 -0
  127. package/package.json +12 -8
  128. package/dist/elements/index.js +0 -92
  129. package/dist/elements/index.js.map +0 -1
  130. package/dist/elements/react-component-lib/createComponent.js +0 -65
  131. package/dist/elements/react-component-lib/createComponent.js.map +0 -1
  132. package/dist/elements/react-component-lib/createOverlayComponent.js +0 -98
  133. package/dist/elements/react-component-lib/createOverlayComponent.js.map +0 -1
  134. package/dist/elements/react-component-lib/index.js +0 -3
  135. package/dist/elements/react-component-lib/index.js.map +0 -1
  136. package/dist/elements/react-component-lib/interfaces.js +0 -2
  137. package/dist/elements/react-component-lib/interfaces.js.map +0 -1
  138. package/dist/elements/react-component-lib/utils/attachProps.js +0 -92
  139. package/dist/elements/react-component-lib/utils/attachProps.js.map +0 -1
  140. package/dist/elements/react-component-lib/utils/case.js +0 -7
  141. package/dist/elements/react-component-lib/utils/case.js.map +0 -1
  142. package/dist/elements/react-component-lib/utils/dev.js +0 -13
  143. package/dist/elements/react-component-lib/utils/dev.js.map +0 -1
  144. package/dist/elements/react-component-lib/utils/index.js +0 -31
  145. package/dist/elements/react-component-lib/utils/index.js.map +0 -1
  146. package/dist/index.js +0 -29
  147. package/dist/index.js.map +0 -1
  148. /package/dist/{types/elements → elements}/react-component-lib/createComponent.d.ts +0 -0
  149. /package/dist/{types/elements → elements}/react-component-lib/createOverlayComponent.d.ts +0 -0
  150. /package/dist/{types/elements → elements}/react-component-lib/index.d.ts +0 -0
  151. /package/dist/{types/elements → elements}/react-component-lib/interfaces.d.ts +0 -0
  152. /package/dist/{types/elements → elements}/react-component-lib/utils/attachProps.d.ts +0 -0
  153. /package/dist/{types/elements → elements}/react-component-lib/utils/case.d.ts +0 -0
  154. /package/dist/{types/elements → elements}/react-component-lib/utils/dev.d.ts +0 -0
  155. /package/dist/{types/elements → elements}/react-component-lib/utils/index.d.ts +0 -0
  156. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */class g{constructor(i){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,(i==null?void 0:i.roundAverageSize)===!0&&(this._roundAverageSize=!0)}set(i,t){const s=this._map.get(i)||0;this._map.set(i,t),this.totalSize+=t-s}get averageSize(){if(this._map.size>0){const i=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(i):i}return 0}getSize(i){return this._map.get(i)}clear(){this._map.clear(),this.totalSize=0}}/**
6
+ * @license
7
+ * Copyright 2021 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */function f(o){return o==="horizontal"?"width":"height"}class d{_getDefaultConfig(){return{direction:"vertical"}}constructor(i,t){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=i,Promise.resolve().then(()=>this.config=t||this._getDefaultConfig())}set config(i){Object.assign(this,Object.assign({},this._getDefaultConfig(),i))}get config(){return{direction:this.direction}}get items(){return this._items}set items(i){this._setItems(i)}_setItems(i){i!==this._items&&(this._items=i,this._scheduleReflow())}get direction(){return this._direction}set direction(i){i=i==="horizontal"?i:"vertical",i!==this._direction&&(this._direction=i,this._sizeDim=i==="horizontal"?"width":"height",this._secondarySizeDim=i==="horizontal"?"height":"width",this._positionDim=i==="horizontal"?"left":"top",this._secondaryPositionDim=i==="horizontal"?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(i){const{_viewDim1:t,_viewDim2:s}=this;Object.assign(this._viewportSize,i),s!==this._viewDim2?this._scheduleLayoutUpdate():t!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(i){Object.assign(this._latestCoords,i);const t=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(t-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(i=!1){(i||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(i){this._pin=i,this._triggerReflow()}get pin(){if(this._pin!==null){const{index:i,block:t}=this._pin;return{index:Math.max(0,Math.min(i,this.items.length-1)),block:t}}return null}_clampScrollPosition(i){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(i,this.totalScrollSize[f(this.direction)]-this._viewDim1))}unpin(){this._pin!==null&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then(()=>this.reflowIfNeeded())}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(this.pin!==null){const i=this._scrollPosition,{index:t,block:s}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:t,block:s||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=i-this._scrollPosition}}_calculateScrollIntoViewPosition(i){const{block:t}=i,s=Math.min(this.items.length,Math.max(0,i.index)),h=this._getItemPosition(s)[this._positionDim];let n=h;if(t!=="start"){const l=this._getItemSize(s)[this._sizeDim];if(t==="center")n=h-.5*this._viewDim1+.5*l;else{const e=h-this._viewDim1+l;if(t==="end")n=e;else{const r=this._scrollPosition;n=Math.abs(r-h)<Math.abs(r-e)?h:e}}}return n+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(n)}getScrollIntoViewCoordinates(i){return{[this._positionDim]:this._calculateScrollIntoViewPosition(i)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){const i=new Map;if(this._first!==-1&&this._last!==-1)for(let s=this._first;s<=this._last;s++)i.set(s,this._getItemPosition(s));const t={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:i};this._scrollError&&(t.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(t)}get _num(){return this._first===-1||this._last===-1?0:this._last-this._first+1}_checkThresholds(){if(this._viewDim1===0&&this._num>0||this._pin!==null)this._scheduleReflow();else{const i=Math.max(0,this._scrollPosition-this._overhang),t=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>i||this._physicalMax<t?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(i){if(this._first===-1||this._last===-1)return;let t=this._first;for(;t<this._last&&Math.round(this._getItemPosition(t)[this._positionDim]+this._getItemSize(t)[this._sizeDim])<=Math.round(this._scrollPosition);)t++;let s=this._last;for(;s>this._first&&Math.round(this._getItemPosition(s)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)s--;(t!==this._firstVisible||s!==this._lastVisible)&&(this._firstVisible=t,this._lastVisible=s,i&&i.emit&&this._sendVisibilityChangedMessage())}}function m(o){return o==="horizontal"?"marginLeft":"marginTop"}function u(o){return o==="horizontal"?"marginRight":"marginBottom"}function S(o){return o==="horizontal"?"xOffset":"yOffset"}function z(o,i){const t=[o,i].sort();return t[1]<=0?Math.min(...t):t[0]>=0?Math.max(...t):t[0]+t[1]}class p{constructor(){this._childSizeCache=new g,this._marginSizeCache=new g,this._metricsCache=new Map}update(i,t){var h,n;const s=new Set;Object.keys(i).forEach(l=>{const e=Number(l);this._metricsCache.set(e,i[e]),this._childSizeCache.set(e,i[e][f(t)]),s.add(e),s.add(e+1)});for(const l of s){const e=((h=this._metricsCache.get(l))==null?void 0:h[m(t)])||0,r=((n=this._metricsCache.get(l-1))==null?void 0:n[u(t)])||0;this._marginSizeCache.set(l,z(e,r))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(i,t){var s;return((s=this._metricsCache.get(i))==null?void 0:s[m(t)])||0}getChildSize(i){return this._childSizeCache.getSize(i)}getMarginSize(i){return this._marginSizeCache.getSize(i)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}class M extends d{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new p,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(i){this._metricsCache.update(i,this.direction),this._scheduleReflow()}_getPhysicalItem(i){return this._newPhysicalItems.get(i)??this._physicalItems.get(i)}_getSize(i){return this._getPhysicalItem(i)&&this._metricsCache.getChildSize(i)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(i){const t=this._metricsCache;if(this._first===-1||this._last===-1)return t.averageMarginSize+i*(t.averageMarginSize+this._getAverageSize());if(i<this._first){const s=this._first-i;return this._getPhysicalItem(this._first).pos-(t.getMarginSize(this._first-1)||t.averageMarginSize)-(s*t.averageChildSize+(s-1)*t.averageMarginSize)}else{const s=i-this._last;return this._getPhysicalItem(this._last).pos+(t.getChildSize(this._last)||t.averageChildSize)+(t.getMarginSize(this._last)||t.averageMarginSize)+s*(t.averageChildSize+t.averageMarginSize)}}_getPosition(i){const t=this._getPhysicalItem(i),{averageMarginSize:s}=this._metricsCache;return i===0?this._metricsCache.getMarginSize(0)??s:t?t.pos:this._estimatePosition(i)}_calculateAnchor(i,t){return i<=0?0:t>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((i+t)/2/this._delta)))}_getAnchor(i,t){if(this._physicalItems.size===0)return this._calculateAnchor(i,t);if(this._first<0)return this._calculateAnchor(i,t);if(this._last<0)return this._calculateAnchor(i,t);const s=this._getPhysicalItem(this._first),h=this._getPhysicalItem(this._last),n=s.pos;if(h.pos+this._metricsCache.getChildSize(this._last)<i)return this._calculateAnchor(i,t);if(n>t)return this._calculateAnchor(i,t);let r=this._firstVisible-1,a=-1/0;for(;a<i;)a=this._getPhysicalItem(++r).pos+this._metricsCache.getChildSize(r);return r}_getActiveItems(){this._viewDim1===0||this.items.length===0?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;const i=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=i,this._stable=!0}_getItems(){const i=this._newPhysicalItems;this._stable=!0;let t,s;if(this.pin!==null){const{index:a}=this.pin;this._anchorIdx=a,this._anchorPos=this._getPosition(a)}if(t=this._scrollPosition-this._overhang,s=this._scrollPosition+this._viewDim1+this._overhang,s<0||t>this._scrollSize){this._clearItems();return}(this._anchorIdx===null||this._anchorPos===null)&&(this._anchorIdx=this._getAnchor(t,s),this._anchorPos=this._getPosition(this._anchorIdx));let h=this._getSize(this._anchorIdx);h===void 0&&(this._stable=!1,h=this._getAverageSize());const n=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,l=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;this._anchorIdx===0&&(this._anchorPos=n),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-l-h);let e=0;for(this._anchorPos+h+l<t&&(e=t-(this._anchorPos+h+l)),this._anchorPos-n>s&&(e=s-(this._anchorPos-n)),e&&(this._scrollPosition-=e,t-=e,s-=e,this._scrollError+=e),i.set(this._anchorIdx,{pos:this._anchorPos,size:h}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-n,this._physicalMax=this._anchorPos+h+l;this._physicalMin>t&&this._first>0;){let a=this._getSize(--this._first);a===void 0&&(this._stable=!1,a=this._getAverageSize());let _=this._metricsCache.getMarginSize(this._first);_===void 0&&(this._stable=!1,_=this._metricsCache.averageMarginSize),this._physicalMin-=a;const c=this._physicalMin;if(i.set(this._first,{pos:c,size:a}),this._physicalMin-=_,this._stable===!1&&this._estimate===!1)break}for(;this._physicalMax<s&&this._last<this.items.length-1;){let a=this._getSize(++this._last);a===void 0&&(this._stable=!1,a=this._getAverageSize());let _=this._metricsCache.getMarginSize(this._last);_===void 0&&(this._stable=!1,_=this._metricsCache.averageMarginSize);const c=this._physicalMax;if(i.set(this._last,{pos:c,size:a}),this._physicalMax+=a+_,!this._stable&&!this._estimate)break}const r=this._calculateError();r&&(this._physicalMin-=r,this._physicalMax-=r,this._anchorPos-=r,this._scrollPosition-=r,i.forEach(a=>a.pos-=r),this._scrollError+=r),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=i)}_calculateError(){return this._first===0?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){const{_first:i,_last:t}=this;super._reflow(),(this._first===-1&&this._last==-1||this._first===i&&this._last===t)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){const{averageMarginSize:i}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(i+this._getAverageSize())+i)}get _delta(){const{averageMarginSize:i}=this._metricsCache;return this._getAverageSize()+i}_getItemPosition(i){return{[this._positionDim]:this._getPosition(i),[this._secondaryPositionDim]:0,[S(this.direction)]:-(this._metricsCache.getLeadingMarginValue(i,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(i){return{[this._sizeDim]:this._getSize(i)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}exports.FlowLayout=M;
@@ -0,0 +1,505 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ class g {
7
+ constructor(i) {
8
+ this._map = /* @__PURE__ */ new Map(), this._roundAverageSize = !1, this.totalSize = 0, (i == null ? void 0 : i.roundAverageSize) === !0 && (this._roundAverageSize = !0);
9
+ }
10
+ set(i, t) {
11
+ const s = this._map.get(i) || 0;
12
+ this._map.set(i, t), this.totalSize += t - s;
13
+ }
14
+ get averageSize() {
15
+ if (this._map.size > 0) {
16
+ const i = this.totalSize / this._map.size;
17
+ return this._roundAverageSize ? Math.round(i) : i;
18
+ }
19
+ return 0;
20
+ }
21
+ getSize(i) {
22
+ return this._map.get(i);
23
+ }
24
+ clear() {
25
+ this._map.clear(), this.totalSize = 0;
26
+ }
27
+ }
28
+ /**
29
+ * @license
30
+ * Copyright 2021 Google LLC
31
+ * SPDX-License-Identifier: BSD-3-Clause
32
+ */
33
+ function f(o) {
34
+ return o === "horizontal" ? "width" : "height";
35
+ }
36
+ class d {
37
+ _getDefaultConfig() {
38
+ return {
39
+ direction: "vertical"
40
+ };
41
+ }
42
+ constructor(i, t) {
43
+ this._latestCoords = { left: 0, top: 0 }, this._direction = null, this._viewportSize = { width: 0, height: 0 }, this.totalScrollSize = { width: 0, height: 0 }, this.offsetWithinScroller = { left: 0, top: 0 }, this._pendingReflow = !1, this._pendingLayoutUpdate = !1, this._pin = null, this._firstVisible = 0, this._lastVisible = 0, this._physicalMin = 0, this._physicalMax = 0, this._first = -1, this._last = -1, this._sizeDim = "height", this._secondarySizeDim = "width", this._positionDim = "top", this._secondaryPositionDim = "left", this._scrollPosition = 0, this._scrollError = 0, this._items = [], this._scrollSize = 1, this._overhang = 1e3, this._hostSink = i, Promise.resolve().then(() => this.config = t || this._getDefaultConfig());
44
+ }
45
+ set config(i) {
46
+ Object.assign(this, Object.assign({}, this._getDefaultConfig(), i));
47
+ }
48
+ get config() {
49
+ return {
50
+ direction: this.direction
51
+ };
52
+ }
53
+ /**
54
+ * Maximum index of children + 1, to help estimate total height of the scroll
55
+ * space.
56
+ */
57
+ get items() {
58
+ return this._items;
59
+ }
60
+ set items(i) {
61
+ this._setItems(i);
62
+ }
63
+ _setItems(i) {
64
+ i !== this._items && (this._items = i, this._scheduleReflow());
65
+ }
66
+ /**
67
+ * Primary scrolling direction.
68
+ */
69
+ get direction() {
70
+ return this._direction;
71
+ }
72
+ set direction(i) {
73
+ i = i === "horizontal" ? i : "vertical", i !== this._direction && (this._direction = i, this._sizeDim = i === "horizontal" ? "width" : "height", this._secondarySizeDim = i === "horizontal" ? "height" : "width", this._positionDim = i === "horizontal" ? "left" : "top", this._secondaryPositionDim = i === "horizontal" ? "top" : "left", this._triggerReflow());
74
+ }
75
+ /**
76
+ * Height and width of the viewport.
77
+ */
78
+ get viewportSize() {
79
+ return this._viewportSize;
80
+ }
81
+ set viewportSize(i) {
82
+ const { _viewDim1: t, _viewDim2: s } = this;
83
+ Object.assign(this._viewportSize, i), s !== this._viewDim2 ? this._scheduleLayoutUpdate() : t !== this._viewDim1 && this._checkThresholds();
84
+ }
85
+ /**
86
+ * Scroll offset of the viewport.
87
+ */
88
+ get viewportScroll() {
89
+ return this._latestCoords;
90
+ }
91
+ set viewportScroll(i) {
92
+ Object.assign(this._latestCoords, i);
93
+ const t = this._scrollPosition;
94
+ this._scrollPosition = this._latestCoords[this._positionDim], Math.abs(t - this._scrollPosition) >= 1 && this._checkThresholds();
95
+ }
96
+ /**
97
+ * Perform a reflow if one has been scheduled.
98
+ */
99
+ reflowIfNeeded(i = !1) {
100
+ (i || this._pendingReflow) && (this._pendingReflow = !1, this._reflow());
101
+ }
102
+ set pin(i) {
103
+ this._pin = i, this._triggerReflow();
104
+ }
105
+ get pin() {
106
+ if (this._pin !== null) {
107
+ const { index: i, block: t } = this._pin;
108
+ return {
109
+ index: Math.max(0, Math.min(i, this.items.length - 1)),
110
+ block: t
111
+ };
112
+ }
113
+ return null;
114
+ }
115
+ _clampScrollPosition(i) {
116
+ return Math.max(-this.offsetWithinScroller[this._positionDim], Math.min(i, this.totalScrollSize[f(this.direction)] - this._viewDim1));
117
+ }
118
+ unpin() {
119
+ this._pin !== null && (this._sendUnpinnedMessage(), this._pin = null);
120
+ }
121
+ _updateLayout() {
122
+ }
123
+ // protected _viewDim2Changed(): void {
124
+ // this._scheduleLayoutUpdate();
125
+ // }
126
+ /**
127
+ * The height or width of the viewport, whichever corresponds to the scrolling direction.
128
+ */
129
+ get _viewDim1() {
130
+ return this._viewportSize[this._sizeDim];
131
+ }
132
+ /**
133
+ * The height or width of the viewport, whichever does NOT correspond to the scrolling direction.
134
+ */
135
+ get _viewDim2() {
136
+ return this._viewportSize[this._secondarySizeDim];
137
+ }
138
+ _scheduleReflow() {
139
+ this._pendingReflow = !0;
140
+ }
141
+ _scheduleLayoutUpdate() {
142
+ this._pendingLayoutUpdate = !0, this._scheduleReflow();
143
+ }
144
+ // For triggering a reflow based on incoming changes to
145
+ // the layout config.
146
+ _triggerReflow() {
147
+ this._scheduleLayoutUpdate(), Promise.resolve().then(() => this.reflowIfNeeded());
148
+ }
149
+ _reflow() {
150
+ this._pendingLayoutUpdate && (this._updateLayout(), this._pendingLayoutUpdate = !1), this._updateScrollSize(), this._setPositionFromPin(), this._getActiveItems(), this._updateVisibleIndices(), this._sendStateChangedMessage();
151
+ }
152
+ /**
153
+ * If we are supposed to be pinned to a particular
154
+ * item or set of coordinates, we set `_scrollPosition`
155
+ * accordingly and adjust `_scrollError` as needed
156
+ * so that the virtualizer can keep the scroll
157
+ * position in the DOM in sync
158
+ */
159
+ _setPositionFromPin() {
160
+ if (this.pin !== null) {
161
+ const i = this._scrollPosition, { index: t, block: s } = this.pin;
162
+ this._scrollPosition = this._calculateScrollIntoViewPosition({
163
+ index: t,
164
+ block: s || "start"
165
+ }) - this.offsetWithinScroller[this._positionDim], this._scrollError = i - this._scrollPosition;
166
+ }
167
+ }
168
+ /**
169
+ * Calculate the coordinates to scroll to, given
170
+ * a request to scroll to the element at a specific
171
+ * index.
172
+ *
173
+ * Supports the same positioning options (`start`,
174
+ * `center`, `end`, `nearest`) as the standard
175
+ * `Element.scrollIntoView()` method, but currently
176
+ * only considers the provided value in the `block`
177
+ * dimension, since we don't yet have any layouts
178
+ * that support virtualization in two dimensions.
179
+ */
180
+ _calculateScrollIntoViewPosition(i) {
181
+ const { block: t } = i, s = Math.min(this.items.length, Math.max(0, i.index)), h = this._getItemPosition(s)[this._positionDim];
182
+ let n = h;
183
+ if (t !== "start") {
184
+ const l = this._getItemSize(s)[this._sizeDim];
185
+ if (t === "center")
186
+ n = h - 0.5 * this._viewDim1 + 0.5 * l;
187
+ else {
188
+ const e = h - this._viewDim1 + l;
189
+ if (t === "end")
190
+ n = e;
191
+ else {
192
+ const r = this._scrollPosition;
193
+ n = Math.abs(r - h) < Math.abs(r - e) ? h : e;
194
+ }
195
+ }
196
+ }
197
+ return n += this.offsetWithinScroller[this._positionDim], this._clampScrollPosition(n);
198
+ }
199
+ getScrollIntoViewCoordinates(i) {
200
+ return {
201
+ [this._positionDim]: this._calculateScrollIntoViewPosition(i)
202
+ };
203
+ }
204
+ _sendUnpinnedMessage() {
205
+ this._hostSink({
206
+ type: "unpinned"
207
+ });
208
+ }
209
+ _sendVisibilityChangedMessage() {
210
+ this._hostSink({
211
+ type: "visibilityChanged",
212
+ firstVisible: this._firstVisible,
213
+ lastVisible: this._lastVisible
214
+ });
215
+ }
216
+ _sendStateChangedMessage() {
217
+ const i = /* @__PURE__ */ new Map();
218
+ if (this._first !== -1 && this._last !== -1)
219
+ for (let s = this._first; s <= this._last; s++)
220
+ i.set(s, this._getItemPosition(s));
221
+ const t = {
222
+ type: "stateChanged",
223
+ scrollSize: {
224
+ [this._sizeDim]: this._scrollSize,
225
+ [this._secondarySizeDim]: null
226
+ },
227
+ range: {
228
+ first: this._first,
229
+ last: this._last,
230
+ firstVisible: this._firstVisible,
231
+ lastVisible: this._lastVisible
232
+ },
233
+ childPositions: i
234
+ };
235
+ this._scrollError && (t.scrollError = {
236
+ [this._positionDim]: this._scrollError,
237
+ [this._secondaryPositionDim]: 0
238
+ }, this._scrollError = 0), this._hostSink(t);
239
+ }
240
+ /**
241
+ * Number of items to display.
242
+ */
243
+ get _num() {
244
+ return this._first === -1 || this._last === -1 ? 0 : this._last - this._first + 1;
245
+ }
246
+ _checkThresholds() {
247
+ if (this._viewDim1 === 0 && this._num > 0 || this._pin !== null)
248
+ this._scheduleReflow();
249
+ else {
250
+ const i = Math.max(0, this._scrollPosition - this._overhang), t = Math.min(this._scrollSize, this._scrollPosition + this._viewDim1 + this._overhang);
251
+ this._physicalMin > i || this._physicalMax < t ? this._scheduleReflow() : this._updateVisibleIndices({ emit: !0 });
252
+ }
253
+ }
254
+ /**
255
+ * Find the indices of the first and last items to intersect the viewport.
256
+ * Emit a visibleindiceschange event when either index changes.
257
+ */
258
+ _updateVisibleIndices(i) {
259
+ if (this._first === -1 || this._last === -1)
260
+ return;
261
+ let t = this._first;
262
+ for (; t < this._last && Math.round(this._getItemPosition(t)[this._positionDim] + this._getItemSize(t)[this._sizeDim]) <= Math.round(this._scrollPosition); )
263
+ t++;
264
+ let s = this._last;
265
+ for (; s > this._first && Math.round(this._getItemPosition(s)[this._positionDim]) >= Math.round(this._scrollPosition + this._viewDim1); )
266
+ s--;
267
+ (t !== this._firstVisible || s !== this._lastVisible) && (this._firstVisible = t, this._lastVisible = s, i && i.emit && this._sendVisibilityChangedMessage());
268
+ }
269
+ }
270
+ function m(o) {
271
+ return o === "horizontal" ? "marginLeft" : "marginTop";
272
+ }
273
+ function u(o) {
274
+ return o === "horizontal" ? "marginRight" : "marginBottom";
275
+ }
276
+ function S(o) {
277
+ return o === "horizontal" ? "xOffset" : "yOffset";
278
+ }
279
+ function z(o, i) {
280
+ const t = [o, i].sort();
281
+ return t[1] <= 0 ? Math.min(...t) : t[0] >= 0 ? Math.max(...t) : t[0] + t[1];
282
+ }
283
+ class p {
284
+ constructor() {
285
+ this._childSizeCache = new g(), this._marginSizeCache = new g(), this._metricsCache = /* @__PURE__ */ new Map();
286
+ }
287
+ update(i, t) {
288
+ var h, n;
289
+ const s = /* @__PURE__ */ new Set();
290
+ Object.keys(i).forEach((l) => {
291
+ const e = Number(l);
292
+ this._metricsCache.set(e, i[e]), this._childSizeCache.set(e, i[e][f(t)]), s.add(e), s.add(e + 1);
293
+ });
294
+ for (const l of s) {
295
+ const e = ((h = this._metricsCache.get(l)) == null ? void 0 : h[m(t)]) || 0, r = ((n = this._metricsCache.get(l - 1)) == null ? void 0 : n[u(t)]) || 0;
296
+ this._marginSizeCache.set(l, z(e, r));
297
+ }
298
+ }
299
+ get averageChildSize() {
300
+ return this._childSizeCache.averageSize;
301
+ }
302
+ get totalChildSize() {
303
+ return this._childSizeCache.totalSize;
304
+ }
305
+ get averageMarginSize() {
306
+ return this._marginSizeCache.averageSize;
307
+ }
308
+ get totalMarginSize() {
309
+ return this._marginSizeCache.totalSize;
310
+ }
311
+ getLeadingMarginValue(i, t) {
312
+ var s;
313
+ return ((s = this._metricsCache.get(i)) == null ? void 0 : s[m(t)]) || 0;
314
+ }
315
+ getChildSize(i) {
316
+ return this._childSizeCache.getSize(i);
317
+ }
318
+ getMarginSize(i) {
319
+ return this._marginSizeCache.getSize(i);
320
+ }
321
+ clear() {
322
+ this._childSizeCache.clear(), this._marginSizeCache.clear(), this._metricsCache.clear();
323
+ }
324
+ }
325
+ class M extends d {
326
+ constructor() {
327
+ super(...arguments), this._itemSize = { width: 100, height: 100 }, this._physicalItems = /* @__PURE__ */ new Map(), this._newPhysicalItems = /* @__PURE__ */ new Map(), this._metricsCache = new p(), this._anchorIdx = null, this._anchorPos = null, this._stable = !0, this._measureChildren = !0, this._estimate = !0;
328
+ }
329
+ // protected _defaultConfig: BaseLayoutConfig = Object.assign({}, super._defaultConfig, {
330
+ // })
331
+ // constructor(config: Layout1dConfig) {
332
+ // super(config);
333
+ // }
334
+ get measureChildren() {
335
+ return this._measureChildren;
336
+ }
337
+ /**
338
+ * Determine the average size of all children represented in the sizes
339
+ * argument.
340
+ */
341
+ updateItemSizes(i) {
342
+ this._metricsCache.update(i, this.direction), this._scheduleReflow();
343
+ }
344
+ /**
345
+ * Set the average item size based on the total length and number of children
346
+ * in range.
347
+ */
348
+ // _updateItemSize() {
349
+ // // Keep integer values.
350
+ // this._itemSize[this._sizeDim] = this._metricsCache.averageChildSize;
351
+ // }
352
+ _getPhysicalItem(i) {
353
+ return this._newPhysicalItems.get(i) ?? this._physicalItems.get(i);
354
+ }
355
+ _getSize(i) {
356
+ return this._getPhysicalItem(i) && this._metricsCache.getChildSize(i);
357
+ }
358
+ _getAverageSize() {
359
+ return this._metricsCache.averageChildSize || this._itemSize[this._sizeDim];
360
+ }
361
+ _estimatePosition(i) {
362
+ const t = this._metricsCache;
363
+ if (this._first === -1 || this._last === -1)
364
+ return t.averageMarginSize + i * (t.averageMarginSize + this._getAverageSize());
365
+ if (i < this._first) {
366
+ const s = this._first - i;
367
+ return this._getPhysicalItem(this._first).pos - (t.getMarginSize(this._first - 1) || t.averageMarginSize) - (s * t.averageChildSize + (s - 1) * t.averageMarginSize);
368
+ } else {
369
+ const s = i - this._last;
370
+ return this._getPhysicalItem(this._last).pos + (t.getChildSize(this._last) || t.averageChildSize) + (t.getMarginSize(this._last) || t.averageMarginSize) + s * (t.averageChildSize + t.averageMarginSize);
371
+ }
372
+ }
373
+ /**
374
+ * Returns the position in the scrolling direction of the item at idx.
375
+ * Estimates it if the item at idx is not in the DOM.
376
+ */
377
+ _getPosition(i) {
378
+ const t = this._getPhysicalItem(i), { averageMarginSize: s } = this._metricsCache;
379
+ return i === 0 ? this._metricsCache.getMarginSize(0) ?? s : t ? t.pos : this._estimatePosition(i);
380
+ }
381
+ _calculateAnchor(i, t) {
382
+ return i <= 0 ? 0 : t > this._scrollSize - this._viewDim1 ? this.items.length - 1 : Math.max(0, Math.min(this.items.length - 1, Math.floor((i + t) / 2 / this._delta)));
383
+ }
384
+ _getAnchor(i, t) {
385
+ if (this._physicalItems.size === 0)
386
+ return this._calculateAnchor(i, t);
387
+ if (this._first < 0)
388
+ return this._calculateAnchor(i, t);
389
+ if (this._last < 0)
390
+ return this._calculateAnchor(i, t);
391
+ const s = this._getPhysicalItem(this._first), h = this._getPhysicalItem(this._last), n = s.pos;
392
+ if (h.pos + this._metricsCache.getChildSize(this._last) < i)
393
+ return this._calculateAnchor(i, t);
394
+ if (n > t)
395
+ return this._calculateAnchor(i, t);
396
+ let r = this._firstVisible - 1, a = -1 / 0;
397
+ for (; a < i; )
398
+ a = this._getPhysicalItem(++r).pos + this._metricsCache.getChildSize(r);
399
+ return r;
400
+ }
401
+ /**
402
+ * Updates _first and _last based on items that should be in the current
403
+ * viewed range.
404
+ */
405
+ _getActiveItems() {
406
+ this._viewDim1 === 0 || this.items.length === 0 ? this._clearItems() : this._getItems();
407
+ }
408
+ /**
409
+ * Sets the range to empty.
410
+ */
411
+ _clearItems() {
412
+ this._first = -1, this._last = -1, this._physicalMin = 0, this._physicalMax = 0;
413
+ const i = this._newPhysicalItems;
414
+ this._newPhysicalItems = this._physicalItems, this._newPhysicalItems.clear(), this._physicalItems = i, this._stable = !0;
415
+ }
416
+ /*
417
+ * Updates _first and _last based on items that should be in the given range.
418
+ */
419
+ _getItems() {
420
+ const i = this._newPhysicalItems;
421
+ this._stable = !0;
422
+ let t, s;
423
+ if (this.pin !== null) {
424
+ const { index: a } = this.pin;
425
+ this._anchorIdx = a, this._anchorPos = this._getPosition(a);
426
+ }
427
+ if (t = this._scrollPosition - this._overhang, s = this._scrollPosition + this._viewDim1 + this._overhang, s < 0 || t > this._scrollSize) {
428
+ this._clearItems();
429
+ return;
430
+ }
431
+ (this._anchorIdx === null || this._anchorPos === null) && (this._anchorIdx = this._getAnchor(t, s), this._anchorPos = this._getPosition(this._anchorIdx));
432
+ let h = this._getSize(this._anchorIdx);
433
+ h === void 0 && (this._stable = !1, h = this._getAverageSize());
434
+ const n = this._metricsCache.getMarginSize(this._anchorIdx) ?? this._metricsCache.averageMarginSize, l = this._metricsCache.getMarginSize(this._anchorIdx + 1) ?? this._metricsCache.averageMarginSize;
435
+ this._anchorIdx === 0 && (this._anchorPos = n), this._anchorIdx === this.items.length - 1 && (this._anchorPos = this._scrollSize - l - h);
436
+ let e = 0;
437
+ for (this._anchorPos + h + l < t && (e = t - (this._anchorPos + h + l)), this._anchorPos - n > s && (e = s - (this._anchorPos - n)), e && (this._scrollPosition -= e, t -= e, s -= e, this._scrollError += e), i.set(this._anchorIdx, { pos: this._anchorPos, size: h }), this._first = this._last = this._anchorIdx, this._physicalMin = this._anchorPos - n, this._physicalMax = this._anchorPos + h + l; this._physicalMin > t && this._first > 0; ) {
438
+ let a = this._getSize(--this._first);
439
+ a === void 0 && (this._stable = !1, a = this._getAverageSize());
440
+ let _ = this._metricsCache.getMarginSize(this._first);
441
+ _ === void 0 && (this._stable = !1, _ = this._metricsCache.averageMarginSize), this._physicalMin -= a;
442
+ const c = this._physicalMin;
443
+ if (i.set(this._first, { pos: c, size: a }), this._physicalMin -= _, this._stable === !1 && this._estimate === !1)
444
+ break;
445
+ }
446
+ for (; this._physicalMax < s && this._last < this.items.length - 1; ) {
447
+ let a = this._getSize(++this._last);
448
+ a === void 0 && (this._stable = !1, a = this._getAverageSize());
449
+ let _ = this._metricsCache.getMarginSize(this._last);
450
+ _ === void 0 && (this._stable = !1, _ = this._metricsCache.averageMarginSize);
451
+ const c = this._physicalMax;
452
+ if (i.set(this._last, { pos: c, size: a }), this._physicalMax += a + _, !this._stable && !this._estimate)
453
+ break;
454
+ }
455
+ const r = this._calculateError();
456
+ r && (this._physicalMin -= r, this._physicalMax -= r, this._anchorPos -= r, this._scrollPosition -= r, i.forEach((a) => a.pos -= r), this._scrollError += r), this._stable && (this._newPhysicalItems = this._physicalItems, this._newPhysicalItems.clear(), this._physicalItems = i);
457
+ }
458
+ _calculateError() {
459
+ return this._first === 0 ? this._physicalMin : this._physicalMin <= 0 ? this._physicalMin - this._first * this._delta : this._last === this.items.length - 1 ? this._physicalMax - this._scrollSize : this._physicalMax >= this._scrollSize ? this._physicalMax - this._scrollSize + (this.items.length - 1 - this._last) * this._delta : 0;
460
+ }
461
+ _reflow() {
462
+ const { _first: i, _last: t } = this;
463
+ super._reflow(), (this._first === -1 && this._last == -1 || this._first === i && this._last === t) && this._resetReflowState();
464
+ }
465
+ _resetReflowState() {
466
+ this._anchorIdx = null, this._anchorPos = null, this._stable = !0;
467
+ }
468
+ _updateScrollSize() {
469
+ const { averageMarginSize: i } = this._metricsCache;
470
+ this._scrollSize = Math.max(1, this.items.length * (i + this._getAverageSize()) + i);
471
+ }
472
+ /**
473
+ * Returns the average size (precise or estimated) of an item in the scrolling direction,
474
+ * including any surrounding space.
475
+ */
476
+ get _delta() {
477
+ const { averageMarginSize: i } = this._metricsCache;
478
+ return this._getAverageSize() + i;
479
+ }
480
+ /**
481
+ * Returns the top and left positioning of the item at idx.
482
+ */
483
+ _getItemPosition(i) {
484
+ return {
485
+ [this._positionDim]: this._getPosition(i),
486
+ [this._secondaryPositionDim]: 0,
487
+ [S(this.direction)]: -(this._metricsCache.getLeadingMarginValue(i, this.direction) ?? this._metricsCache.averageMarginSize)
488
+ };
489
+ }
490
+ /**
491
+ * Returns the height and width of the item at idx.
492
+ */
493
+ _getItemSize(i) {
494
+ return {
495
+ [this._sizeDim]: this._getSize(i) || this._getAverageSize(),
496
+ [this._secondarySizeDim]: this._itemSize[this._secondarySizeDim]
497
+ };
498
+ }
499
+ _viewDim2Changed() {
500
+ this._metricsCache.clear(), this._scheduleReflow();
501
+ }
502
+ }
503
+ export {
504
+ M as FlowLayout
505
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./index-eb33703c.cjs");require("react");require("react-dom");var f={exports:{}};(function(V,A){(function(r,i){i()})(T.commonjsGlobal,function(){function r(n){var o=!0,u=!1,a=null,v={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function s(e){return!!(e&&e!==document&&e.nodeName!=="HTML"&&e.nodeName!=="BODY"&&"classList"in e&&"contains"in e.classList)}function b(e){var g=e.type,l=e.tagName;return!!(l==="INPUT"&&v[g]&&!e.readOnly||l==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function c(e){e.classList.contains("focus-visible")||(e.classList.add("focus-visible"),e.setAttribute("data-focus-visible-added",""))}function E(e){e.hasAttribute("data-focus-visible-added")&&(e.classList.remove("focus-visible"),e.removeAttribute("data-focus-visible-added"))}function L(e){e.metaKey||e.altKey||e.ctrlKey||(s(n.activeElement)&&c(n.activeElement),o=!0)}function d(e){o=!1}function y(e){s(e.target)&&(o||b(e.target))&&c(e.target)}function p(e){s(e.target)&&(e.target.classList.contains("focus-visible")||e.target.hasAttribute("data-focus-visible-added"))&&(u=!0,window.clearTimeout(a),a=window.setTimeout(function(){u=!1},100),E(e.target))}function w(e){document.visibilityState==="hidden"&&(u&&(o=!0),m())}function m(){document.addEventListener("mousemove",t),document.addEventListener("mousedown",t),document.addEventListener("mouseup",t),document.addEventListener("pointermove",t),document.addEventListener("pointerdown",t),document.addEventListener("pointerup",t),document.addEventListener("touchmove",t),document.addEventListener("touchstart",t),document.addEventListener("touchend",t)}function h(){document.removeEventListener("mousemove",t),document.removeEventListener("mousedown",t),document.removeEventListener("mouseup",t),document.removeEventListener("pointermove",t),document.removeEventListener("pointerdown",t),document.removeEventListener("pointerup",t),document.removeEventListener("touchmove",t),document.removeEventListener("touchstart",t),document.removeEventListener("touchend",t)}function t(e){e.target.nodeName&&e.target.nodeName.toLowerCase()==="html"||(o=!1,h())}document.addEventListener("keydown",L,!0),document.addEventListener("mousedown",d,!0),document.addEventListener("pointerdown",d,!0),document.addEventListener("touchstart",d,!0),document.addEventListener("visibilitychange",w,!0),m(),n.addEventListener("focus",y,!0),n.addEventListener("blur",p,!0),n.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&n.host?n.host.setAttribute("data-js-focus-visible",""):n.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window<"u"&&typeof document<"u"){window.applyFocusVisiblePolyfill=r;var i;try{i=new CustomEvent("focus-visible-polyfill-ready")}catch{i=document.createEvent("CustomEvent"),i.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(i)}typeof document<"u"&&r(document)})})();const N=f.exports,O=Object.freeze(Object.assign(Object.create(null),f.exports,{default:N}));exports.f=O;
@@ -0,0 +1,84 @@
1
+ import { i as T } from "./index-5ccfd9df.js";
2
+ import "react";
3
+ import "react-dom";
4
+ var f = { exports: {} };
5
+ (function(V, A) {
6
+ (function(r, i) {
7
+ i();
8
+ })(T, function() {
9
+ function r(n) {
10
+ var o = !0, u = !1, a = null, v = {
11
+ text: !0,
12
+ search: !0,
13
+ url: !0,
14
+ tel: !0,
15
+ email: !0,
16
+ password: !0,
17
+ number: !0,
18
+ date: !0,
19
+ month: !0,
20
+ week: !0,
21
+ time: !0,
22
+ datetime: !0,
23
+ "datetime-local": !0
24
+ };
25
+ function s(e) {
26
+ return !!(e && e !== document && e.nodeName !== "HTML" && e.nodeName !== "BODY" && "classList" in e && "contains" in e.classList);
27
+ }
28
+ function E(e) {
29
+ var g = e.type, l = e.tagName;
30
+ return !!(l === "INPUT" && v[g] && !e.readOnly || l === "TEXTAREA" && !e.readOnly || e.isContentEditable);
31
+ }
32
+ function c(e) {
33
+ e.classList.contains("focus-visible") || (e.classList.add("focus-visible"), e.setAttribute("data-focus-visible-added", ""));
34
+ }
35
+ function b(e) {
36
+ e.hasAttribute("data-focus-visible-added") && (e.classList.remove("focus-visible"), e.removeAttribute("data-focus-visible-added"));
37
+ }
38
+ function L(e) {
39
+ e.metaKey || e.altKey || e.ctrlKey || (s(n.activeElement) && c(n.activeElement), o = !0);
40
+ }
41
+ function d(e) {
42
+ o = !1;
43
+ }
44
+ function y(e) {
45
+ s(e.target) && (o || E(e.target)) && c(e.target);
46
+ }
47
+ function p(e) {
48
+ s(e.target) && (e.target.classList.contains("focus-visible") || e.target.hasAttribute("data-focus-visible-added")) && (u = !0, window.clearTimeout(a), a = window.setTimeout(function() {
49
+ u = !1;
50
+ }, 100), b(e.target));
51
+ }
52
+ function w(e) {
53
+ document.visibilityState === "hidden" && (u && (o = !0), m());
54
+ }
55
+ function m() {
56
+ document.addEventListener("mousemove", t), document.addEventListener("mousedown", t), document.addEventListener("mouseup", t), document.addEventListener("pointermove", t), document.addEventListener("pointerdown", t), document.addEventListener("pointerup", t), document.addEventListener("touchmove", t), document.addEventListener("touchstart", t), document.addEventListener("touchend", t);
57
+ }
58
+ function h() {
59
+ document.removeEventListener("mousemove", t), document.removeEventListener("mousedown", t), document.removeEventListener("mouseup", t), document.removeEventListener("pointermove", t), document.removeEventListener("pointerdown", t), document.removeEventListener("pointerup", t), document.removeEventListener("touchmove", t), document.removeEventListener("touchstart", t), document.removeEventListener("touchend", t);
60
+ }
61
+ function t(e) {
62
+ e.target.nodeName && e.target.nodeName.toLowerCase() === "html" || (o = !1, h());
63
+ }
64
+ document.addEventListener("keydown", L, !0), document.addEventListener("mousedown", d, !0), document.addEventListener("pointerdown", d, !0), document.addEventListener("touchstart", d, !0), document.addEventListener("visibilitychange", w, !0), m(), n.addEventListener("focus", y, !0), n.addEventListener("blur", p, !0), n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host ? n.host.setAttribute("data-js-focus-visible", "") : n.nodeType === Node.DOCUMENT_NODE && (document.documentElement.classList.add("js-focus-visible"), document.documentElement.setAttribute("data-js-focus-visible", ""));
65
+ }
66
+ if (typeof window < "u" && typeof document < "u") {
67
+ window.applyFocusVisiblePolyfill = r;
68
+ var i;
69
+ try {
70
+ i = new CustomEvent("focus-visible-polyfill-ready");
71
+ } catch {
72
+ i = document.createEvent("CustomEvent"), i.initCustomEvent("focus-visible-polyfill-ready", !1, !1, {});
73
+ }
74
+ window.dispatchEvent(i);
75
+ }
76
+ typeof document < "u" && r(document);
77
+ });
78
+ })();
79
+ const N = f.exports, M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), f.exports, {
80
+ default: N
81
+ }));
82
+ export {
83
+ M as f
84
+ };