@luzmo/lucero 1.0.1-alpha.15 → 1.0.1-alpha.16
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.
- package/components/accordion/index.cjs +183 -6
- package/components/accordion/index.js +136 -88
- package/components/action-bar/index.cjs +85 -4
- package/components/action-bar/index.js +72 -50
- package/components/action-button/index.cjs +205 -3
- package/components/action-button/index.js +167 -93
- package/components/action-group/index.cjs +7 -1
- package/components/action-group/index.js +12 -8
- package/components/action-group-DHp8RHDf.js +392 -0
- package/components/action-group-MPf19RPV.cjs +391 -0
- package/components/action-menu/index.cjs +91 -11
- package/components/action-menu/index.js +66 -47
- package/components/avatar/index.cjs +63 -3
- package/components/avatar/index.js +54 -42
- package/components/base-COw9n7UR.cjs +119 -0
- package/components/base-DmeVy0cq.js +120 -0
- package/components/button/index.cjs +134 -2
- package/components/button/index.js +106 -72
- package/components/button-base-7Ak55xFd.cjs +206 -0
- package/components/button-base-C3kf6BTK.js +207 -0
- package/components/button-group/index.cjs +45 -1
- package/components/button-group/index.js +37 -25
- package/components/calendar/index.cjs +632 -1
- package/components/calendar/index.js +637 -7
- package/components/checkbox/index.cjs +111 -4
- package/components/checkbox/index.js +98 -53
- package/components/checkbox-mixin-8cL-vfDy.js +84 -0
- package/components/checkbox-mixin-CE7dJj3J.cjs +83 -0
- package/components/clear-button-Co6oKSgl.js +59 -0
- package/components/clear-button-X_HDY2eH.cjs +58 -0
- package/components/close-button-DPBK6Kpu.cjs +59 -0
- package/components/close-button-Miw9ZjoJ.js +60 -0
- package/components/color-area/index.cjs +440 -13
- package/components/color-area/index.js +322 -187
- package/components/color-controller-BjDZaxhX.js +491 -0
- package/components/color-controller-C3c_vb2P.cjs +490 -0
- package/components/color-field/index.cjs +95 -2
- package/components/color-field/index.js +77 -41
- package/components/color-handle/index.cjs +64 -3
- package/components/color-handle/index.js +58 -37
- package/components/color-loupe/index.cjs +7 -1
- package/components/color-loupe/index.js +12 -8
- package/components/color-loupe-BQqNR8YD.cjs +88 -0
- package/components/color-loupe-B_DDFv8l.js +89 -0
- package/components/color-menu/index.cjs +217 -12
- package/components/color-menu/index.js +187 -93
- package/components/color-palette/index.cjs +89 -1
- package/components/color-palette/index.js +78 -51
- package/components/color-palette-group/index.cjs +259 -3
- package/components/color-palette-group/index.js +193 -105
- package/components/color-picker/index.cjs +114 -6
- package/components/color-picker/index.js +92 -72
- package/components/color-slider/index.cjs +585 -1
- package/components/color-slider/index.js +590 -7
- package/components/{directive-oAbCiebi.js → condition-attribute-with-id-Cn815e9W.js} +22 -22
- package/components/condition-attribute-with-id-DEc2Yjne.cjs +43 -0
- package/components/date-time-picker/index.cjs +1357 -31
- package/components/date-time-picker/index.js +951 -637
- package/components/dependency-manger-CcIE1uvQ.cjs +63 -0
- package/components/{dependency-manger-CEXvGQUV.js → dependency-manger-XHpQjFgK.js} +24 -14
- package/components/divider/index.cjs +54 -1
- package/components/divider/index.js +49 -30
- package/components/divider.module-Cm5LcDRV.cjs +20 -0
- package/components/divider.module-DauH6k2_.js +21 -0
- package/components/element-resolution-DCsrhGZO.cjs +112 -0
- package/components/element-resolution-nMlmW4Jy.js +113 -0
- package/components/field-group/index.cjs +7 -1
- package/components/field-group/index.js +12 -8
- package/components/field-group-DNmY8W9v.cjs +86 -0
- package/components/field-group-DVdAWCQF.js +87 -0
- package/components/field-label/index.cjs +7 -1
- package/components/field-label/index.js +12 -8
- package/components/field-label-CKH9EXpR.cjs +156 -0
- package/components/field-label-Dpsecoc6.js +157 -0
- package/components/focus-group-BqDAk9Is.js +337 -0
- package/components/focus-group-DFzOlalL.cjs +336 -0
- package/components/focus-visible-B-B8-P9R.cjs +104 -0
- package/components/focus-visible-BUPRWlsh.js +105 -0
- package/components/focusable-BPrTcZPd.cjs +262 -0
- package/components/focusable-ChCLg1k4.js +263 -0
- package/components/{directive-C7oCP5Bh.cjs → focusable-selectors-D0t_5P7C.cjs} +16 -5
- package/components/{focusable-selectors-B4YgbghQ.js → focusable-selectors-IltOAOd9.js} +7 -4
- package/components/icon/index.cjs +90 -1
- package/components/icon/index.js +74 -46
- package/components/index.cjs +174 -1
- package/components/index.js +174 -172
- package/components/infield-button/index.cjs +46 -2
- package/components/infield-button/index.js +41 -30
- package/components/label/index.cjs +37 -1
- package/components/label/index.js +36 -24
- package/components/{language-resolution-8yZa5r_P.js → language-resolution-BSGJAWiQ.js} +21 -16
- package/components/language-resolution-iN9EImbb.cjs +57 -0
- package/components/like-anchor-D62faRNG.cjs +79 -0
- package/components/like-anchor-v3cJ9RWM.js +80 -0
- package/components/manage-help-text-BYx84zZR.cjs +125 -0
- package/components/manage-help-text-DOuMTGht.js +126 -0
- package/components/menu/index.cjs +1297 -29
- package/components/menu/index.js +954 -499
- package/components/multi-language-field/index.cjs +132 -2
- package/components/multi-language-field/index.js +118 -88
- package/components/number-field/index.cjs +613 -10
- package/components/number-field/index.js +442 -243
- package/components/observe-slot-presence-9AwLGUQ_.cjs +78 -0
- package/components/observe-slot-presence-DcMdoumP.js +79 -0
- package/components/observe-slot-text-CSofZeeF.cjs +104 -0
- package/components/observe-slot-text-CjnkkBPn.js +105 -0
- package/components/options/index.cjs +693 -60
- package/components/options/index.js +519 -953
- package/components/overlay/index.cjs +367 -21
- package/components/overlay/index.js +273 -189
- package/components/overlay-CN8ISP1F.js +2485 -0
- package/components/overlay-LViy9VWM.cjs +2484 -0
- package/components/{pending-state-DTX7ggyF.js → pending-state-CXbe-Xul.js} +28 -13
- package/components/pending-state-e4RbXe9u.cjs +75 -0
- package/components/picker/index.cjs +9 -1
- package/components/picker/index.js +15 -11
- package/components/picker-DNde3awt.cjs +672 -0
- package/components/picker-PfUAF05y.js +673 -0
- package/components/picker-button/index.cjs +56 -4
- package/components/picker-button/index.js +45 -34
- package/components/platform-CxDar3Dn.cjs +68 -0
- package/components/platform-Cxn0WbyT.js +69 -0
- package/components/popover/index.cjs +7 -1
- package/components/popover/index.js +12 -8
- package/components/popover-BkbYhl3i.js +74 -0
- package/components/popover-BkgUf0kL.cjs +74 -0
- package/components/progress-circle/index.cjs +7 -1
- package/components/progress-circle/index.js +12 -8
- package/components/progress-circle-Hu_ivPHf.js +133 -0
- package/components/progress-circle-_Etqsj9f.cjs +132 -0
- package/components/radio/index.cjs +244 -2
- package/components/radio/index.js +192 -110
- package/components/{when-CDK1Tt5Y.js → random-id-BE6HA503.cjs} +7 -10
- package/components/{random-id-ByCz1xaq.js → random-id-BEc6QIUL.js} +3 -3
- package/components/roving-tabindex-AsmAh2In.cjs +95 -0
- package/components/roving-tabindex-DPF9NmrH.js +96 -0
- package/components/search/index.cjs +115 -8
- package/components/search/index.js +96 -66
- package/components/select/index.cjs +720 -51
- package/components/select/index.js +563 -347
- package/components/sized-mixin-DmkrNdWB.js +80 -0
- package/components/sized-mixin-UaTVa-AE.cjs +79 -0
- package/components/slider/index.cjs +119 -1
- package/components/slider/index.js +100 -1113
- package/components/{condition-attribute-with-id-Dv4lSRbe.js → slottable-request-event-CANixJnR.cjs} +15 -13
- package/components/{slottable-request-event-DggLA4Rx.js → slottable-request-event-D9WzrdWv.js} +12 -9
- package/components/strategies-DlMlaSJR.cjs +317 -0
- package/components/strategies-DlPQoTFE.js +318 -0
- package/components/streaming-listener-D4sHaMub.cjs +145 -0
- package/components/streaming-listener-cAz5zJyk.js +146 -0
- package/components/swatch/index.cjs +436 -7
- package/components/swatch/index.js +350 -205
- package/components/switch/index.cjs +61 -2
- package/components/switch/index.js +51 -34
- package/components/tabs/index.cjs +693 -26
- package/components/tabs/index.js +521 -388
- package/components/tags/index.cjs +201 -4
- package/components/tags/index.js +152 -87
- package/components/text-field/index.cjs +49 -3
- package/components/text-field/index.js +44 -30
- package/components/text-field-11tcnftU.cjs +338 -0
- package/components/text-field-Chi9J2Cz.js +339 -0
- package/components/text-field.module-CMBS0jSL.js +21 -0
- package/components/text-field.module-DIJdV_sA.cjs +20 -0
- package/components/toast/index.cjs +177 -12
- package/components/toast/index.js +145 -73
- package/components/tooltip/index.cjs +221 -6
- package/components/tooltip/index.js +155 -131
- package/components/tooltip/tooltip.d.ts +1 -12
- package/components/unit-input/index.cjs +232 -8
- package/components/unit-input/index.js +201 -108
- package/components/utils.cjs +25 -1
- package/components/utils.js +22 -22
- package/custom-elements.json +1 -1
- package/package.json +1 -1
- package/components/NumberFormatter-DewVDY5w.cjs +0 -18
- package/components/NumberFormatter-DgOUVrge.js +0 -136
- package/components/NumberParser-Dik4a0h-.cjs +0 -18
- package/components/NumberParser-ci9J5EKv.js +0 -173
- package/components/action-group-DBImibFn.js +0 -258
- package/components/action-group-DJGMcRHb.cjs +0 -20
- package/components/async-directive-BX1T1e1_.cjs +0 -22
- package/components/async-directive-BfcqVjDp.js +0 -82
- package/components/base-BjTwmyRF.cjs +0 -22
- package/components/base-CBCg3yyw.cjs +0 -40
- package/components/base-D76d76ww.js +0 -26
- package/components/base-WsynuqaS.js +0 -677
- package/components/button-base-DbkDzb71.js +0 -144
- package/components/button-base-XgPLmwP-.cjs +0 -25
- package/components/checkbox-mixin-BDN0dBtS.cjs +0 -27
- package/components/checkbox-mixin-Do7EgtpQ.js +0 -70
- package/components/class-map-Di1D_rCm.cjs +0 -22
- package/components/class-map-NbVXqBU0.js +0 -51
- package/components/clear-button-BbVqNU-g.js +0 -53
- package/components/clear-button-DYdeFsS8.cjs +0 -18
- package/components/close-button-CpfKibqg.cjs +0 -18
- package/components/close-button-DzOZZmkY.js +0 -51
- package/components/color-controller-B0uX6Zso.js +0 -3230
- package/components/color-controller-CoUL5f9K.cjs +0 -18
- package/components/color-loupe-CaA_Lfkk.cjs +0 -56
- package/components/color-loupe-CmMsXbjT.js +0 -81
- package/components/condition-attribute-with-id-DrQYZzFS.cjs +0 -18
- package/components/dependency-manger-C5HCkMMB.cjs +0 -18
- package/components/directive-helpers-Cm6gitnu.js +0 -62
- package/components/directive-helpers-DyIRTWwA.cjs +0 -22
- package/components/divider.module-DDvBo9zo.cjs +0 -18
- package/components/divider.module-DoQWQEIJ.js +0 -21
- package/components/element-resolution-BvRLGqIU.cjs +0 -18
- package/components/element-resolution-FCUT-wql.js +0 -91
- package/components/field-group-DXfBWrkO.js +0 -66
- package/components/field-group-DkGst3r5.cjs +0 -23
- package/components/field-label-CZ2zzChK.js +0 -106
- package/components/field-label-mO1AkUgR.cjs +0 -25
- package/components/flow-D-0MTYCm.js +0 -527
- package/components/flow-DM3dNAKs.cjs +0 -30
- package/components/focus-group-DHeTq18L.js +0 -218
- package/components/focus-group-DnxZUBhQ.cjs +0 -18
- package/components/focus-visible-B0P9aY_G.cjs +0 -18
- package/components/focus-visible-DBlJGoEW.js +0 -74
- package/components/focusable-BxtpnzWp.js +0 -153
- package/components/focusable-EbipgXRh.cjs +0 -18
- package/components/focusable-selectors-BgFlyFcY.cjs +0 -18
- package/components/if-defined-C9YGdo33.cjs +0 -22
- package/components/if-defined-DOaE2coe.js +0 -27
- package/components/index-BQoI8AD3.cjs +0 -113
- package/components/index-BwxgAdzi.cjs +0 -57
- package/components/index-Cb9zsiz6.js +0 -1490
- package/components/index-HjQa8tew.js +0 -1174
- package/components/language-resolution-DJzmyzZq.cjs +0 -18
- package/components/like-anchor-Bvn_vLQ8.js +0 -69
- package/components/like-anchor-sod1C1fR.cjs +0 -32
- package/components/luzmo-icons-D47EGj-3.cjs +0 -29
- package/components/luzmo-icons-NEyaMpEM.js +0 -229
- package/components/manage-help-text-DhgARkZX.cjs +0 -30
- package/components/manage-help-text-syYnjKGL.js +0 -92
- package/components/mutation-controller-DH7YOCyj.js +0 -52
- package/components/mutation-controller-DkOMCW-c.cjs +0 -22
- package/components/observe-slot-presence-CmVi0zTc.js +0 -68
- package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
- package/components/observe-slot-text-BPfIQQtz.js +0 -87
- package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
- package/components/overlay-Cig9r6uU.js +0 -2747
- package/components/overlay-KSKMzzkh.cjs +0 -47
- package/components/pending-state-CaH1si5b.cjs +0 -26
- package/components/picker-CAYj4hBD.js +0 -461
- package/components/picker-apS0Zrly.cjs +0 -123
- package/components/platform-BM-uMWpX.js +0 -69
- package/components/platform-BiXhwqk3.cjs +0 -18
- package/components/popover-DjX0aAnY.js +0 -67
- package/components/popover-KFfO0IYL.cjs +0 -30
- package/components/progress-circle-BvRJNuNo.cjs +0 -33
- package/components/progress-circle-DXH9z8-6.js +0 -97
- package/components/query-BL-TJj7K.cjs +0 -22
- package/components/query-D_KR_GUc.js +0 -51
- package/components/query-assigned-elements-DjfhL1cl.js +0 -36
- package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
- package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
- package/components/query-assigned-nodes-C76XVPWY.js +0 -36
- package/components/random-id-CqvckpWe.cjs +0 -18
- package/components/roving-tabindex-By_fCy_e.cjs +0 -18
- package/components/roving-tabindex-DOg4z6ZU.js +0 -66
- package/components/sized-mixin-CPxE5C96.cjs +0 -18
- package/components/sized-mixin-D4ACoVUr.js +0 -63
- package/components/slottable-request-event-BfUUt1Mh.cjs +0 -18
- package/components/state-D8JEtYqe.cjs +0 -22
- package/components/state-Deh-vKYE.js +0 -29
- package/components/strategies-9indNIEb.js +0 -195
- package/components/strategies-BACP6MhR.cjs +0 -18
- package/components/streaming-listener-B00MvALi.cjs +0 -18
- package/components/streaming-listener-CP-JE6Fa.js +0 -91
- package/components/style-map-CeilmSgs.cjs +0 -22
- package/components/style-map-IgqIKvlE.js +0 -53
- package/components/text-field-BYF2RHY8.cjs +0 -85
- package/components/text-field-PYafEYeO.js +0 -314
- package/components/text-field.module-C2KVUJcX.js +0 -21
- package/components/text-field.module-DXhFA9G-.cjs +0 -18
- package/components/when-CDZyJPvd.cjs +0 -22
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
/*! * Lucero - The design system for Luzmo.
|
|
2
|
-
*
|
|
3
|
-
* Copyright © 2025 Luzmo
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
-
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
-
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
-
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
-
*
|
|
10
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
* SOFTWARE.
|
|
17
|
-
* */
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2021 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/
|
|
23
|
-
class g {
|
|
24
|
-
constructor(i) {
|
|
25
|
-
this._map = /* @__PURE__ */ new Map(), this._roundAverageSize = !1, this.totalSize = 0, (i == null ? void 0 : i.roundAverageSize) === !0 && (this._roundAverageSize = !0);
|
|
26
|
-
}
|
|
27
|
-
set(i, t) {
|
|
28
|
-
const s = this._map.get(i) || 0;
|
|
29
|
-
this._map.set(i, t), this.totalSize += t - s;
|
|
30
|
-
}
|
|
31
|
-
get averageSize() {
|
|
32
|
-
if (this._map.size > 0) {
|
|
33
|
-
const i = this.totalSize / this._map.size;
|
|
34
|
-
return this._roundAverageSize ? Math.round(i) : i;
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
getSize(i) {
|
|
39
|
-
return this._map.get(i);
|
|
40
|
-
}
|
|
41
|
-
clear() {
|
|
42
|
-
this._map.clear(), this.totalSize = 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @license
|
|
47
|
-
* Copyright 2021 Google LLC
|
|
48
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
-
*/
|
|
50
|
-
function f(o) {
|
|
51
|
-
return o === "horizontal" ? "width" : "height";
|
|
52
|
-
}
|
|
53
|
-
class d {
|
|
54
|
-
_getDefaultConfig() {
|
|
55
|
-
return {
|
|
56
|
-
direction: "vertical"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
constructor(i, t) {
|
|
60
|
-
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());
|
|
61
|
-
}
|
|
62
|
-
set config(i) {
|
|
63
|
-
Object.assign(this, Object.assign({}, this._getDefaultConfig(), i));
|
|
64
|
-
}
|
|
65
|
-
get config() {
|
|
66
|
-
return {
|
|
67
|
-
direction: this.direction
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Maximum index of children + 1, to help estimate total height of the scroll
|
|
72
|
-
* space.
|
|
73
|
-
*/
|
|
74
|
-
get items() {
|
|
75
|
-
return this._items;
|
|
76
|
-
}
|
|
77
|
-
set items(i) {
|
|
78
|
-
this._setItems(i);
|
|
79
|
-
}
|
|
80
|
-
_setItems(i) {
|
|
81
|
-
i !== this._items && (this._items = i, this._scheduleReflow());
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Primary scrolling direction.
|
|
85
|
-
*/
|
|
86
|
-
get direction() {
|
|
87
|
-
return this._direction;
|
|
88
|
-
}
|
|
89
|
-
set direction(i) {
|
|
90
|
-
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());
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Height and width of the viewport.
|
|
94
|
-
*/
|
|
95
|
-
get viewportSize() {
|
|
96
|
-
return this._viewportSize;
|
|
97
|
-
}
|
|
98
|
-
set viewportSize(i) {
|
|
99
|
-
const { _viewDim1: t, _viewDim2: s } = this;
|
|
100
|
-
Object.assign(this._viewportSize, i), s !== this._viewDim2 ? this._scheduleLayoutUpdate() : t !== this._viewDim1 && this._checkThresholds();
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Scroll offset of the viewport.
|
|
104
|
-
*/
|
|
105
|
-
get viewportScroll() {
|
|
106
|
-
return this._latestCoords;
|
|
107
|
-
}
|
|
108
|
-
set viewportScroll(i) {
|
|
109
|
-
Object.assign(this._latestCoords, i);
|
|
110
|
-
const t = this._scrollPosition;
|
|
111
|
-
this._scrollPosition = this._latestCoords[this._positionDim], Math.abs(t - this._scrollPosition) >= 1 && this._checkThresholds();
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Perform a reflow if one has been scheduled.
|
|
115
|
-
*/
|
|
116
|
-
reflowIfNeeded(i = !1) {
|
|
117
|
-
(i || this._pendingReflow) && (this._pendingReflow = !1, this._reflow());
|
|
118
|
-
}
|
|
119
|
-
set pin(i) {
|
|
120
|
-
this._pin = i, this._triggerReflow();
|
|
121
|
-
}
|
|
122
|
-
get pin() {
|
|
123
|
-
if (this._pin !== null) {
|
|
124
|
-
const { index: i, block: t } = this._pin;
|
|
125
|
-
return {
|
|
126
|
-
index: Math.max(0, Math.min(i, this.items.length - 1)),
|
|
127
|
-
block: t
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
_clampScrollPosition(i) {
|
|
133
|
-
return Math.max(-this.offsetWithinScroller[this._positionDim], Math.min(i, this.totalScrollSize[f(this.direction)] - this._viewDim1));
|
|
134
|
-
}
|
|
135
|
-
unpin() {
|
|
136
|
-
this._pin !== null && (this._sendUnpinnedMessage(), this._pin = null);
|
|
137
|
-
}
|
|
138
|
-
_updateLayout() {
|
|
139
|
-
}
|
|
140
|
-
// protected _viewDim2Changed(): void {
|
|
141
|
-
// this._scheduleLayoutUpdate();
|
|
142
|
-
// }
|
|
143
|
-
/**
|
|
144
|
-
* The height or width of the viewport, whichever corresponds to the scrolling direction.
|
|
145
|
-
*/
|
|
146
|
-
get _viewDim1() {
|
|
147
|
-
return this._viewportSize[this._sizeDim];
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* The height or width of the viewport, whichever does NOT correspond to the scrolling direction.
|
|
151
|
-
*/
|
|
152
|
-
get _viewDim2() {
|
|
153
|
-
return this._viewportSize[this._secondarySizeDim];
|
|
154
|
-
}
|
|
155
|
-
_scheduleReflow() {
|
|
156
|
-
this._pendingReflow = !0;
|
|
157
|
-
}
|
|
158
|
-
_scheduleLayoutUpdate() {
|
|
159
|
-
this._pendingLayoutUpdate = !0, this._scheduleReflow();
|
|
160
|
-
}
|
|
161
|
-
// For triggering a reflow based on incoming changes to
|
|
162
|
-
// the layout config.
|
|
163
|
-
_triggerReflow() {
|
|
164
|
-
this._scheduleLayoutUpdate(), Promise.resolve().then(() => this.reflowIfNeeded());
|
|
165
|
-
}
|
|
166
|
-
_reflow() {
|
|
167
|
-
this._pendingLayoutUpdate && (this._updateLayout(), this._pendingLayoutUpdate = !1), this._updateScrollSize(), this._setPositionFromPin(), this._getActiveItems(), this._updateVisibleIndices(), this._sendStateChangedMessage();
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* If we are supposed to be pinned to a particular
|
|
171
|
-
* item or set of coordinates, we set `_scrollPosition`
|
|
172
|
-
* accordingly and adjust `_scrollError` as needed
|
|
173
|
-
* so that the virtualizer can keep the scroll
|
|
174
|
-
* position in the DOM in sync
|
|
175
|
-
*/
|
|
176
|
-
_setPositionFromPin() {
|
|
177
|
-
if (this.pin !== null) {
|
|
178
|
-
const i = this._scrollPosition, { index: t, block: s } = this.pin;
|
|
179
|
-
this._scrollPosition = this._calculateScrollIntoViewPosition({
|
|
180
|
-
index: t,
|
|
181
|
-
block: s || "start"
|
|
182
|
-
}) - this.offsetWithinScroller[this._positionDim], this._scrollError = i - this._scrollPosition;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Calculate the coordinates to scroll to, given
|
|
187
|
-
* a request to scroll to the element at a specific
|
|
188
|
-
* index.
|
|
189
|
-
*
|
|
190
|
-
* Supports the same positioning options (`start`,
|
|
191
|
-
* `center`, `end`, `nearest`) as the standard
|
|
192
|
-
* `Element.scrollIntoView()` method, but currently
|
|
193
|
-
* only considers the provided value in the `block`
|
|
194
|
-
* dimension, since we don't yet have any layouts
|
|
195
|
-
* that support virtualization in two dimensions.
|
|
196
|
-
*/
|
|
197
|
-
_calculateScrollIntoViewPosition(i) {
|
|
198
|
-
const { block: t } = i, s = Math.min(this.items.length, Math.max(0, i.index)), h = this._getItemPosition(s)[this._positionDim];
|
|
199
|
-
let n = h;
|
|
200
|
-
if (t !== "start") {
|
|
201
|
-
const l = this._getItemSize(s)[this._sizeDim];
|
|
202
|
-
if (t === "center")
|
|
203
|
-
n = h - 0.5 * this._viewDim1 + 0.5 * l;
|
|
204
|
-
else {
|
|
205
|
-
const e = h - this._viewDim1 + l;
|
|
206
|
-
if (t === "end")
|
|
207
|
-
n = e;
|
|
208
|
-
else {
|
|
209
|
-
const r = this._scrollPosition;
|
|
210
|
-
n = Math.abs(r - h) < Math.abs(r - e) ? h : e;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return n += this.offsetWithinScroller[this._positionDim], this._clampScrollPosition(n);
|
|
215
|
-
}
|
|
216
|
-
getScrollIntoViewCoordinates(i) {
|
|
217
|
-
return {
|
|
218
|
-
[this._positionDim]: this._calculateScrollIntoViewPosition(i)
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
_sendUnpinnedMessage() {
|
|
222
|
-
this._hostSink({
|
|
223
|
-
type: "unpinned"
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
_sendVisibilityChangedMessage() {
|
|
227
|
-
this._hostSink({
|
|
228
|
-
type: "visibilityChanged",
|
|
229
|
-
firstVisible: this._firstVisible,
|
|
230
|
-
lastVisible: this._lastVisible
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
_sendStateChangedMessage() {
|
|
234
|
-
const i = /* @__PURE__ */ new Map();
|
|
235
|
-
if (this._first !== -1 && this._last !== -1)
|
|
236
|
-
for (let s = this._first; s <= this._last; s++)
|
|
237
|
-
i.set(s, this._getItemPosition(s));
|
|
238
|
-
const t = {
|
|
239
|
-
type: "stateChanged",
|
|
240
|
-
scrollSize: {
|
|
241
|
-
[this._sizeDim]: this._scrollSize,
|
|
242
|
-
[this._secondarySizeDim]: null
|
|
243
|
-
},
|
|
244
|
-
range: {
|
|
245
|
-
first: this._first,
|
|
246
|
-
last: this._last,
|
|
247
|
-
firstVisible: this._firstVisible,
|
|
248
|
-
lastVisible: this._lastVisible
|
|
249
|
-
},
|
|
250
|
-
childPositions: i
|
|
251
|
-
};
|
|
252
|
-
this._scrollError && (t.scrollError = {
|
|
253
|
-
[this._positionDim]: this._scrollError,
|
|
254
|
-
[this._secondaryPositionDim]: 0
|
|
255
|
-
}, this._scrollError = 0), this._hostSink(t);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Number of items to display.
|
|
259
|
-
*/
|
|
260
|
-
get _num() {
|
|
261
|
-
return this._first === -1 || this._last === -1 ? 0 : this._last - this._first + 1;
|
|
262
|
-
}
|
|
263
|
-
_checkThresholds() {
|
|
264
|
-
if (this._viewDim1 === 0 && this._num > 0 || this._pin !== null)
|
|
265
|
-
this._scheduleReflow();
|
|
266
|
-
else {
|
|
267
|
-
const i = Math.max(0, this._scrollPosition - this._overhang), t = Math.min(this._scrollSize, this._scrollPosition + this._viewDim1 + this._overhang);
|
|
268
|
-
this._physicalMin > i || this._physicalMax < t ? this._scheduleReflow() : this._updateVisibleIndices({ emit: !0 });
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Find the indices of the first and last items to intersect the viewport.
|
|
273
|
-
* Emit a visibleindiceschange event when either index changes.
|
|
274
|
-
*/
|
|
275
|
-
_updateVisibleIndices(i) {
|
|
276
|
-
if (this._first === -1 || this._last === -1)
|
|
277
|
-
return;
|
|
278
|
-
let t = this._first;
|
|
279
|
-
for (; t < this._last && Math.round(this._getItemPosition(t)[this._positionDim] + this._getItemSize(t)[this._sizeDim]) <= Math.round(this._scrollPosition); )
|
|
280
|
-
t++;
|
|
281
|
-
let s = this._last;
|
|
282
|
-
for (; s > this._first && Math.round(this._getItemPosition(s)[this._positionDim]) >= Math.round(this._scrollPosition + this._viewDim1); )
|
|
283
|
-
s--;
|
|
284
|
-
(t !== this._firstVisible || s !== this._lastVisible) && (this._firstVisible = t, this._lastVisible = s, i && i.emit && this._sendVisibilityChangedMessage());
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* @license
|
|
289
|
-
* Copyright 2021 Google LLC
|
|
290
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
291
|
-
*/
|
|
292
|
-
function m(o) {
|
|
293
|
-
return o === "horizontal" ? "marginLeft" : "marginTop";
|
|
294
|
-
}
|
|
295
|
-
function u(o) {
|
|
296
|
-
return o === "horizontal" ? "marginRight" : "marginBottom";
|
|
297
|
-
}
|
|
298
|
-
function S(o) {
|
|
299
|
-
return o === "horizontal" ? "xOffset" : "yOffset";
|
|
300
|
-
}
|
|
301
|
-
function z(o, i) {
|
|
302
|
-
const t = [o, i].sort();
|
|
303
|
-
return t[1] <= 0 ? Math.min(...t) : t[0] >= 0 ? Math.max(...t) : t[0] + t[1];
|
|
304
|
-
}
|
|
305
|
-
class p {
|
|
306
|
-
constructor() {
|
|
307
|
-
this._childSizeCache = new g(), this._marginSizeCache = new g(), this._metricsCache = /* @__PURE__ */ new Map();
|
|
308
|
-
}
|
|
309
|
-
update(i, t) {
|
|
310
|
-
var h, n;
|
|
311
|
-
const s = /* @__PURE__ */ new Set();
|
|
312
|
-
Object.keys(i).forEach((l) => {
|
|
313
|
-
const e = Number(l);
|
|
314
|
-
this._metricsCache.set(e, i[e]), this._childSizeCache.set(e, i[e][f(t)]), s.add(e), s.add(e + 1);
|
|
315
|
-
});
|
|
316
|
-
for (const l of s) {
|
|
317
|
-
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;
|
|
318
|
-
this._marginSizeCache.set(l, z(e, r));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
get averageChildSize() {
|
|
322
|
-
return this._childSizeCache.averageSize;
|
|
323
|
-
}
|
|
324
|
-
get totalChildSize() {
|
|
325
|
-
return this._childSizeCache.totalSize;
|
|
326
|
-
}
|
|
327
|
-
get averageMarginSize() {
|
|
328
|
-
return this._marginSizeCache.averageSize;
|
|
329
|
-
}
|
|
330
|
-
get totalMarginSize() {
|
|
331
|
-
return this._marginSizeCache.totalSize;
|
|
332
|
-
}
|
|
333
|
-
getLeadingMarginValue(i, t) {
|
|
334
|
-
var s;
|
|
335
|
-
return ((s = this._metricsCache.get(i)) == null ? void 0 : s[m(t)]) || 0;
|
|
336
|
-
}
|
|
337
|
-
getChildSize(i) {
|
|
338
|
-
return this._childSizeCache.getSize(i);
|
|
339
|
-
}
|
|
340
|
-
getMarginSize(i) {
|
|
341
|
-
return this._marginSizeCache.getSize(i);
|
|
342
|
-
}
|
|
343
|
-
clear() {
|
|
344
|
-
this._childSizeCache.clear(), this._marginSizeCache.clear(), this._metricsCache.clear();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
class M extends d {
|
|
348
|
-
constructor() {
|
|
349
|
-
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;
|
|
350
|
-
}
|
|
351
|
-
// protected _defaultConfig: BaseLayoutConfig = Object.assign({}, super._defaultConfig, {
|
|
352
|
-
// })
|
|
353
|
-
// constructor(config: Layout1dConfig) {
|
|
354
|
-
// super(config);
|
|
355
|
-
// }
|
|
356
|
-
get measureChildren() {
|
|
357
|
-
return this._measureChildren;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Determine the average size of all children represented in the sizes
|
|
361
|
-
* argument.
|
|
362
|
-
*/
|
|
363
|
-
updateItemSizes(i) {
|
|
364
|
-
this._metricsCache.update(i, this.direction), this._scheduleReflow();
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Set the average item size based on the total length and number of children
|
|
368
|
-
* in range.
|
|
369
|
-
*/
|
|
370
|
-
// _updateItemSize() {
|
|
371
|
-
// // Keep integer values.
|
|
372
|
-
// this._itemSize[this._sizeDim] = this._metricsCache.averageChildSize;
|
|
373
|
-
// }
|
|
374
|
-
_getPhysicalItem(i) {
|
|
375
|
-
return this._newPhysicalItems.get(i) ?? this._physicalItems.get(i);
|
|
376
|
-
}
|
|
377
|
-
_getSize(i) {
|
|
378
|
-
return this._getPhysicalItem(i) && this._metricsCache.getChildSize(i);
|
|
379
|
-
}
|
|
380
|
-
_getAverageSize() {
|
|
381
|
-
return this._metricsCache.averageChildSize || this._itemSize[this._sizeDim];
|
|
382
|
-
}
|
|
383
|
-
_estimatePosition(i) {
|
|
384
|
-
const t = this._metricsCache;
|
|
385
|
-
if (this._first === -1 || this._last === -1)
|
|
386
|
-
return t.averageMarginSize + i * (t.averageMarginSize + this._getAverageSize());
|
|
387
|
-
if (i < this._first) {
|
|
388
|
-
const s = this._first - i;
|
|
389
|
-
return this._getPhysicalItem(this._first).pos - (t.getMarginSize(this._first - 1) || t.averageMarginSize) - (s * t.averageChildSize + (s - 1) * t.averageMarginSize);
|
|
390
|
-
} else {
|
|
391
|
-
const s = i - this._last;
|
|
392
|
-
return this._getPhysicalItem(this._last).pos + (t.getChildSize(this._last) || t.averageChildSize) + (t.getMarginSize(this._last) || t.averageMarginSize) + s * (t.averageChildSize + t.averageMarginSize);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Returns the position in the scrolling direction of the item at idx.
|
|
397
|
-
* Estimates it if the item at idx is not in the DOM.
|
|
398
|
-
*/
|
|
399
|
-
_getPosition(i) {
|
|
400
|
-
const t = this._getPhysicalItem(i), { averageMarginSize: s } = this._metricsCache;
|
|
401
|
-
return i === 0 ? this._metricsCache.getMarginSize(0) ?? s : t ? t.pos : this._estimatePosition(i);
|
|
402
|
-
}
|
|
403
|
-
_calculateAnchor(i, t) {
|
|
404
|
-
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)));
|
|
405
|
-
}
|
|
406
|
-
_getAnchor(i, t) {
|
|
407
|
-
if (this._physicalItems.size === 0)
|
|
408
|
-
return this._calculateAnchor(i, t);
|
|
409
|
-
if (this._first < 0)
|
|
410
|
-
return this._calculateAnchor(i, t);
|
|
411
|
-
if (this._last < 0)
|
|
412
|
-
return this._calculateAnchor(i, t);
|
|
413
|
-
const s = this._getPhysicalItem(this._first), h = this._getPhysicalItem(this._last), n = s.pos;
|
|
414
|
-
if (h.pos + this._metricsCache.getChildSize(this._last) < i)
|
|
415
|
-
return this._calculateAnchor(i, t);
|
|
416
|
-
if (n > t)
|
|
417
|
-
return this._calculateAnchor(i, t);
|
|
418
|
-
let r = this._firstVisible - 1, a = -1 / 0;
|
|
419
|
-
for (; a < i; )
|
|
420
|
-
a = this._getPhysicalItem(++r).pos + this._metricsCache.getChildSize(r);
|
|
421
|
-
return r;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Updates _first and _last based on items that should be in the current
|
|
425
|
-
* viewed range.
|
|
426
|
-
*/
|
|
427
|
-
_getActiveItems() {
|
|
428
|
-
this._viewDim1 === 0 || this.items.length === 0 ? this._clearItems() : this._getItems();
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Sets the range to empty.
|
|
432
|
-
*/
|
|
433
|
-
_clearItems() {
|
|
434
|
-
this._first = -1, this._last = -1, this._physicalMin = 0, this._physicalMax = 0;
|
|
435
|
-
const i = this._newPhysicalItems;
|
|
436
|
-
this._newPhysicalItems = this._physicalItems, this._newPhysicalItems.clear(), this._physicalItems = i, this._stable = !0;
|
|
437
|
-
}
|
|
438
|
-
/*
|
|
439
|
-
* Updates _first and _last based on items that should be in the given range.
|
|
440
|
-
*/
|
|
441
|
-
_getItems() {
|
|
442
|
-
const i = this._newPhysicalItems;
|
|
443
|
-
this._stable = !0;
|
|
444
|
-
let t, s;
|
|
445
|
-
if (this.pin !== null) {
|
|
446
|
-
const { index: a } = this.pin;
|
|
447
|
-
this._anchorIdx = a, this._anchorPos = this._getPosition(a);
|
|
448
|
-
}
|
|
449
|
-
if (t = this._scrollPosition - this._overhang, s = this._scrollPosition + this._viewDim1 + this._overhang, s < 0 || t > this._scrollSize) {
|
|
450
|
-
this._clearItems();
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
(this._anchorIdx === null || this._anchorPos === null) && (this._anchorIdx = this._getAnchor(t, s), this._anchorPos = this._getPosition(this._anchorIdx));
|
|
454
|
-
let h = this._getSize(this._anchorIdx);
|
|
455
|
-
h === void 0 && (this._stable = !1, h = this._getAverageSize());
|
|
456
|
-
const n = this._metricsCache.getMarginSize(this._anchorIdx) ?? this._metricsCache.averageMarginSize, l = this._metricsCache.getMarginSize(this._anchorIdx + 1) ?? this._metricsCache.averageMarginSize;
|
|
457
|
-
this._anchorIdx === 0 && (this._anchorPos = n), this._anchorIdx === this.items.length - 1 && (this._anchorPos = this._scrollSize - l - h);
|
|
458
|
-
let e = 0;
|
|
459
|
-
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; ) {
|
|
460
|
-
let a = this._getSize(--this._first);
|
|
461
|
-
a === void 0 && (this._stable = !1, a = this._getAverageSize());
|
|
462
|
-
let _ = this._metricsCache.getMarginSize(this._first);
|
|
463
|
-
_ === void 0 && (this._stable = !1, _ = this._metricsCache.averageMarginSize), this._physicalMin -= a;
|
|
464
|
-
const c = this._physicalMin;
|
|
465
|
-
if (i.set(this._first, { pos: c, size: a }), this._physicalMin -= _, this._stable === !1 && this._estimate === !1)
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
for (; this._physicalMax < s && this._last < this.items.length - 1; ) {
|
|
469
|
-
let a = this._getSize(++this._last);
|
|
470
|
-
a === void 0 && (this._stable = !1, a = this._getAverageSize());
|
|
471
|
-
let _ = this._metricsCache.getMarginSize(this._last);
|
|
472
|
-
_ === void 0 && (this._stable = !1, _ = this._metricsCache.averageMarginSize);
|
|
473
|
-
const c = this._physicalMax;
|
|
474
|
-
if (i.set(this._last, { pos: c, size: a }), this._physicalMax += a + _, !this._stable && !this._estimate)
|
|
475
|
-
break;
|
|
476
|
-
}
|
|
477
|
-
const r = this._calculateError();
|
|
478
|
-
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);
|
|
479
|
-
}
|
|
480
|
-
_calculateError() {
|
|
481
|
-
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;
|
|
482
|
-
}
|
|
483
|
-
_reflow() {
|
|
484
|
-
const { _first: i, _last: t } = this;
|
|
485
|
-
super._reflow(), (this._first === -1 && this._last == -1 || this._first === i && this._last === t) && this._resetReflowState();
|
|
486
|
-
}
|
|
487
|
-
_resetReflowState() {
|
|
488
|
-
this._anchorIdx = null, this._anchorPos = null, this._stable = !0;
|
|
489
|
-
}
|
|
490
|
-
_updateScrollSize() {
|
|
491
|
-
const { averageMarginSize: i } = this._metricsCache;
|
|
492
|
-
this._scrollSize = Math.max(1, this.items.length * (i + this._getAverageSize()) + i);
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Returns the average size (precise or estimated) of an item in the scrolling direction,
|
|
496
|
-
* including any surrounding space.
|
|
497
|
-
*/
|
|
498
|
-
get _delta() {
|
|
499
|
-
const { averageMarginSize: i } = this._metricsCache;
|
|
500
|
-
return this._getAverageSize() + i;
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* Returns the top and left positioning of the item at idx.
|
|
504
|
-
*/
|
|
505
|
-
_getItemPosition(i) {
|
|
506
|
-
return {
|
|
507
|
-
[this._positionDim]: this._getPosition(i),
|
|
508
|
-
[this._secondaryPositionDim]: 0,
|
|
509
|
-
[S(this.direction)]: -(this._metricsCache.getLeadingMarginValue(i, this.direction) ?? this._metricsCache.averageMarginSize)
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Returns the height and width of the item at idx.
|
|
514
|
-
*/
|
|
515
|
-
_getItemSize(i) {
|
|
516
|
-
return {
|
|
517
|
-
[this._sizeDim]: this._getSize(i) || this._getAverageSize(),
|
|
518
|
-
[this._secondarySizeDim]: this._itemSize[this._secondarySizeDim]
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
_viewDim2Changed() {
|
|
522
|
-
this._metricsCache.clear(), this._scheduleReflow();
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
export {
|
|
526
|
-
M as FlowLayout
|
|
527
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*! * Lucero - The design system for Luzmo.
|
|
2
|
-
*
|
|
3
|
-
* Copyright © 2025 Luzmo
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
-
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
-
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
-
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
-
*
|
|
10
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
-
* SOFTWARE.
|
|
17
|
-
* */
|
|
18
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2021 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/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}}/**
|
|
23
|
-
* @license
|
|
24
|
-
* Copyright 2021 Google LLC
|
|
25
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
26
|
-
*/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())}}/**
|
|
27
|
-
* @license
|
|
28
|
-
* Copyright 2021 Google LLC
|
|
29
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
30
|
-
*/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;
|