@ishibashi0112/spreadsheet-grid-core 1.0.2 → 1.2.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 (152) hide show
  1. package/dist/controllers/activeRowFollowController.cjs +1 -0
  2. package/dist/controllers/activeRowFollowController.d.ts +18 -0
  3. package/dist/controllers/activeRowFollowController.js +68 -0
  4. package/dist/controllers/autoHeightMeasurer.cjs +1 -1
  5. package/dist/controllers/autoHeightMeasurer.js +17 -17
  6. package/dist/controllers/clipboardController.cjs +1 -1
  7. package/dist/controllers/clipboardController.d.ts +4 -0
  8. package/dist/controllers/clipboardController.js +82 -54
  9. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  10. package/dist/controllers/columnAutosizeRunner.d.ts +1 -0
  11. package/dist/controllers/columnAutosizeRunner.js +17 -16
  12. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  13. package/dist/controllers/columnHeaderDragController.js +169 -168
  14. package/dist/controllers/columnMenuController.cjs +1 -1
  15. package/dist/controllers/columnMenuController.js +71 -69
  16. package/dist/controllers/contextMenuController.cjs +1 -1
  17. package/dist/controllers/contextMenuController.d.ts +5 -1
  18. package/dist/controllers/contextMenuController.js +62 -40
  19. package/dist/controllers/editController.cjs +1 -1
  20. package/dist/controllers/editController.d.ts +1 -0
  21. package/dist/controllers/editController.js +106 -99
  22. package/dist/controllers/fillHandleController.cjs +1 -1
  23. package/dist/controllers/fillHandleController.d.ts +1 -0
  24. package/dist/controllers/fillHandleController.js +157 -157
  25. package/dist/controllers/filterPopoverController.cjs +1 -1
  26. package/dist/controllers/filterPopoverController.js +6 -6
  27. package/dist/controllers/findController.cjs +1 -1
  28. package/dist/controllers/findController.d.ts +1 -0
  29. package/dist/controllers/findController.js +16 -15
  30. package/dist/controllers/historyController.cjs +1 -1
  31. package/dist/controllers/historyController.d.ts +6 -0
  32. package/dist/controllers/historyController.js +79 -37
  33. package/dist/controllers/imeInputController.cjs +1 -1
  34. package/dist/controllers/imeInputController.js +65 -54
  35. package/dist/controllers/keyboardController.cjs +1 -1
  36. package/dist/controllers/keyboardController.d.ts +1 -0
  37. package/dist/controllers/keyboardController.js +46 -42
  38. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  39. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  40. package/dist/controllers/pointerInteractionsController.js +172 -172
  41. package/dist/controllers/popoverSupport.cjs +1 -1
  42. package/dist/controllers/popoverSupport.d.ts +1 -0
  43. package/dist/controllers/popoverSupport.js +9 -4
  44. package/dist/controllers/rowDragController.cjs +1 -1
  45. package/dist/controllers/rowDragController.d.ts +2 -0
  46. package/dist/controllers/rowDragController.js +160 -146
  47. package/dist/controllers/scrollSyncController.cjs +1 -1
  48. package/dist/controllers/scrollSyncController.js +45 -43
  49. package/dist/controllers/serverSideRowModel.cjs +1 -1
  50. package/dist/controllers/serverSideRowModel.js +19 -19
  51. package/dist/controllers/toolPanelController.cjs +1 -1
  52. package/dist/controllers/toolPanelController.js +26 -14
  53. package/dist/controllers/tooltipController.cjs +1 -1
  54. package/dist/controllers/tooltipController.js +74 -72
  55. package/dist/controllers/viewportSyncController.cjs +1 -1
  56. package/dist/controllers/viewportSyncController.d.ts +4 -1
  57. package/dist/controllers/viewportSyncController.js +66 -28
  58. package/dist/engine/columnCommands.cjs +1 -1
  59. package/dist/engine/columnCommands.js +113 -113
  60. package/dist/engine/createGridEngine.cjs +3 -3
  61. package/dist/engine/createGridEngine.d.ts +2 -0
  62. package/dist/engine/createGridEngine.js +72 -70
  63. package/dist/engine/exportCommands.cjs +1 -1
  64. package/dist/engine/exportCommands.js +18 -9
  65. package/dist/engine/fullFeatures.cjs +1 -1
  66. package/dist/engine/fullFeatures.js +6 -6
  67. package/dist/engine/gridApi.cjs +6 -6
  68. package/dist/engine/gridApi.d.ts +8 -2
  69. package/dist/engine/gridApi.js +197 -187
  70. package/dist/engine/notifiers.cjs +1 -1
  71. package/dist/engine/notifiers.d.ts +4 -0
  72. package/dist/engine/notifiers.js +7 -7
  73. package/dist/index.cjs +1 -1
  74. package/dist/index.d.ts +3 -1
  75. package/dist/index.js +7 -6
  76. package/dist/locales/en.cjs +1 -1
  77. package/dist/locales/en.js +5 -0
  78. package/dist/logic/autoScrollGeometry.cjs +1 -1
  79. package/dist/logic/autoScrollGeometry.d.ts +2 -0
  80. package/dist/logic/autoScrollGeometry.js +3 -3
  81. package/dist/logic/editorValues.cjs +1 -1
  82. package/dist/logic/editorValues.js +37 -34
  83. package/dist/logic/exportCsv.cjs +3 -3
  84. package/dist/logic/exportCsv.d.ts +4 -1
  85. package/dist/logic/exportCsv.js +22 -20
  86. package/dist/logic/exportData.cjs +1 -1
  87. package/dist/logic/exportData.d.ts +4 -1
  88. package/dist/logic/exportData.js +40 -36
  89. package/dist/logic/filtering.cjs +1 -1
  90. package/dist/logic/filtering.d.ts +2 -1
  91. package/dist/logic/filtering.js +16 -3
  92. package/dist/logic/geometry.cjs +1 -1
  93. package/dist/logic/geometry.d.ts +2 -0
  94. package/dist/logic/geometry.js +41 -20
  95. package/dist/logic/gridState.cjs +1 -1
  96. package/dist/logic/gridState.d.ts +3 -2
  97. package/dist/logic/gridState.js +32 -23
  98. package/dist/logic/groupExport.cjs +1 -1
  99. package/dist/logic/groupExport.js +28 -27
  100. package/dist/logic/grouping.cjs +1 -1
  101. package/dist/logic/grouping.d.ts +1 -0
  102. package/dist/logic/grouping.js +52 -41
  103. package/dist/logic/historyRebase.cjs +1 -0
  104. package/dist/logic/historyRebase.d.ts +5 -0
  105. package/dist/logic/historyRebase.js +36 -0
  106. package/dist/logic/imeInput.cjs +1 -1
  107. package/dist/logic/imeInput.js +6 -4
  108. package/dist/logic/localeTextFeatures.cjs +1 -1
  109. package/dist/logic/localeTextFeatures.d.ts +8 -0
  110. package/dist/logic/localeTextFeatures.js +11 -5
  111. package/dist/logic/localeTextPopups.cjs +1 -1
  112. package/dist/logic/localeTextPopups.d.ts +1 -0
  113. package/dist/logic/localeTextPopups.js +1 -0
  114. package/dist/logic/pasteFill.cjs +1 -0
  115. package/dist/logic/pasteFill.d.ts +2 -0
  116. package/dist/logic/pasteFill.js +25 -0
  117. package/dist/logic/selectEditorState.cjs +1 -1
  118. package/dist/logic/selectEditorState.d.ts +4 -1
  119. package/dist/logic/selectEditorState.js +14 -14
  120. package/dist/logic/selectLabels.cjs +1 -0
  121. package/dist/logic/selectLabels.d.ts +3 -0
  122. package/dist/logic/selectLabels.js +41 -0
  123. package/dist/logic/selectionAggregates.cjs +1 -1
  124. package/dist/logic/selectionAggregates.js +2 -3
  125. package/dist/logic/validation.cjs +1 -1
  126. package/dist/logic/validation.d.ts +1 -1
  127. package/dist/logic/validation.js +21 -21
  128. package/dist/logic/valueParsers.cjs +1 -0
  129. package/dist/logic/valueParsers.d.ts +14 -0
  130. package/dist/logic/valueParsers.js +23 -0
  131. package/dist/model/gridActions.cjs +1 -1
  132. package/dist/model/gridActions.d.ts +13 -0
  133. package/dist/model/gridActions.js +11 -0
  134. package/dist/model/gridReducer.cjs +1 -1
  135. package/dist/model/gridReducer.js +128 -65
  136. package/dist/model/gridTypes.core.d.ts +345 -43
  137. package/dist/utils/clipboard.cjs +4 -4
  138. package/dist/utils/clipboard.d.ts +14 -2
  139. package/dist/utils/clipboard.js +101 -49
  140. package/dist/utils/gridVisibleBand.cjs +1 -0
  141. package/dist/utils/gridVisibleBand.d.ts +4 -0
  142. package/dist/utils/gridVisibleBand.js +24 -0
  143. package/dist/utils/popupContainer.cjs +1 -0
  144. package/dist/utils/popupContainer.d.ts +8 -0
  145. package/dist/utils/popupContainer.js +60 -0
  146. package/dist/utils/scrollBottom.cjs +1 -0
  147. package/dist/utils/scrollBottom.d.ts +1 -0
  148. package/dist/utils/scrollBottom.js +4 -0
  149. package/dist/utils/topAlignedInput.cjs +1 -0
  150. package/dist/utils/topAlignedInput.d.ts +3 -0
  151. package/dist/utils/topAlignedInput.js +23 -0
  152. package/package.json +1 -1
@@ -1,17 +1,18 @@
1
1
  import { resolveMoveTargetIndex as e, resolveRowDropSlot as t, resolveRowDropSlotTop as n } from "../logic/rowReorder.js";
2
2
  import { isInsideDetailCardOf as r } from "../logic/detailRow.js";
3
- import { clampClientYAboveFooter as i, computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c } from "../logic/autoScrollGeometry.js";
4
- import { resolveElementScale as l } from "../logic/elementScale.js";
5
- import { beginEscapeCancelableDrag as u } from "./escapeClaimController.js";
6
- import { applySlotToElement as d } from "../logic/slotDom.js";
7
- import { syncPortalTokens as f } from "../utils/portalTokens.js";
3
+ import { clampClientYAboveFooter as i, clampClientYBelowHeader as a, computeNextScrollPosition as o, hasPointerLeftActivationRadius as s, resolveAutoScrollAxisDirection as c, resolveScrollContentBox as l, resolveTopAutoScrollStart as u } from "../logic/autoScrollGeometry.js";
4
+ import { resolveElementScale as d } from "../logic/elementScale.js";
5
+ import { beginEscapeCancelableDrag as f } from "./escapeClaimController.js";
6
+ import { applySlotToElement as p } from "../logic/slotDom.js";
7
+ import { syncPortalTokens as m } from "../utils/portalTokens.js";
8
+ import { appendToPopupContainer as ee, getPopupContainerFor as h } from "../utils/popupContainer.js";
8
9
  //#region src/controllers/rowDragController.ts
9
- var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"8 6 12 2 16 6\"/><polyline points=\"16 18 12 22 8 18\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", _ = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", v = 200, y = "cubic-bezier(0.2, 0.7, 0.3, 1)", b = `transform 160ms ${y}`, x = "data-ssg-row-dragging", S = (e) => e?.closest(".ssg-motion-off") != null, C = /translateY\((-?[\d.]+)px\)/, w = (e) => {
10
+ var g = 14, _ = 12, v = "0.5", y = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"8 6 12 2 16 6\"/><polyline points=\"16 18 12 22 8 18\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", te = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", ne = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", x = `transform 160ms ${b}`, S = "data-ssg-row-dragging", C = (e) => e?.closest(".ssg-motion-off") != null, w = /translateY\((-?[\d.]+)px\)/, T = (e) => {
10
11
  let t = [];
11
12
  return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
12
13
  r(e, n) || t.push(n);
13
14
  }), t;
14
- }, T = (e) => {
15
+ }, E = (e) => {
15
16
  let t = [], n = /* @__PURE__ */ new Map();
16
17
  return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
17
18
  if (r(e, i)) return;
@@ -22,22 +23,32 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
22
23
  key: `band|${o}|${a}`
23
24
  });
24
25
  }), t;
25
- }, E = (e) => {
26
+ }, D = (e) => {
26
27
  e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
27
- }, D = () => {
28
- let D = null, O = null, k = null, A = {
28
+ }, O = () => {
29
+ let O = null, k = null, A = null, j = null, M = (e, t) => {
30
+ let n = O?.canDropAt;
31
+ if (!n) return !0;
32
+ if (j !== null && j.from === e && j.slot === t) return j.allowed;
33
+ let r = n(e, t);
34
+ return j = {
35
+ from: e,
36
+ slot: t,
37
+ allowed: r
38
+ }, r;
39
+ }, N = {
29
40
  x: 0,
30
41
  y: 0
31
- }, j = null, M = !1, N = null, P = null, F = null, I = null, L = null, R = null, z = 0, B = null, V = () => D?.motion === "live", H = null, U = null, W = null, G = () => [
32
- D?.leftIndicatorRef.current ?? null,
33
- D?.centerIndicatorRef.current ?? null,
34
- D?.rightIndicatorRef.current ?? null
35
- ], K = () => {
36
- for (let e of G()) e && (e.style.display = "none");
37
- }, ee = (e) => {
38
- if (H) return;
42
+ }, P = null, F = !1, I = null, L = null, R = null, z = null, B = null, V = null, H = 0, U = null, W = () => O?.motion === "live", G = null, K = null, q = null, J = () => [
43
+ O?.leftIndicatorRef.current ?? null,
44
+ O?.centerIndicatorRef.current ?? null,
45
+ O?.rightIndicatorRef.current ?? null
46
+ ], Y = () => {
47
+ for (let e of J()) e && (e.style.display = "none");
48
+ }, re = (e) => {
49
+ if (G) return;
39
50
  let t = document.createElement("div");
40
- t.setAttribute("data-grid-drag-ghost", ""), D?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), D?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), D?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
51
+ t.setAttribute("data-grid-drag-ghost", ""), O?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), O?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), O?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
41
52
  "position:fixed",
42
53
  "top:0",
43
54
  "left:0",
@@ -62,53 +73,53 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
62
73
  "z-index:9999",
63
74
  "will-change:transform",
64
75
  "transform:translate(-9999px,-9999px)"
65
- ].join(";"), d(t, D?.ghostSlot);
76
+ ].join(";"), p(t, O?.ghostSlot);
66
77
  let n = document.createElement("span");
67
78
  n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
68
79
  let r = document.createElement("span");
69
- r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), f(D?.scrollContainerRef.current, t), H = t, U = n, W = null;
70
- }, te = (e) => {
71
- let t = H;
80
+ r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), ee(t, h(O?.scrollContainerRef.current)), m(O?.scrollContainerRef.current, t), G = t, K = n, q = null;
81
+ }, ie = (e) => {
82
+ let t = G;
72
83
  if (!t) return;
73
- t.style.transform = "translate(" + (A.x + p) + "px," + (A.y + m) + "px)";
84
+ t.style.transform = "translate(" + (N.x + g) + "px," + (N.y + _) + "px)";
74
85
  let n = e ? "move" : "out";
75
- if (W === n) return;
76
- W = n;
77
- let r = U;
78
- n === "out" ? (t.style.opacity = h, r && (r.innerHTML = _)) : (t.style.opacity = "1", r && (r.innerHTML = g));
79
- }, q = () => {
80
- H && H.parentNode && H.parentNode.removeChild(H), H = null, U = null, W = null;
81
- }, J = (e, t) => {
82
- let n = D?.scrollContainerRef.current ?? null;
83
- !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${x}]`).forEach((e) => {
84
- r(n, e) || (t ? e.setAttribute(x, V() ? "live" : "") : e.removeAttribute(x));
86
+ if (q === n) return;
87
+ q = n;
88
+ let r = K;
89
+ n === "out" ? (t.style.opacity = v, r && (r.innerHTML = te)) : (t.style.opacity = "1", r && (r.innerHTML = y));
90
+ }, X = () => {
91
+ G && G.parentNode && G.parentNode.removeChild(G), G = null, K = null, q = null;
92
+ }, Z = (e, t) => {
93
+ let n = O?.scrollContainerRef.current ?? null;
94
+ !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${S}]`).forEach((e) => {
95
+ r(n, e) || (t ? e.setAttribute(S, W() ? "live" : "") : e.removeAttribute(S));
85
96
  });
86
- }, ne = () => {
87
- let e = D?.scrollContainerRef.current ?? null;
97
+ }, ae = () => {
98
+ let e = O?.scrollContainerRef.current ?? null;
88
99
  if (!e) return null;
89
100
  let t = /* @__PURE__ */ new Map();
90
- for (let n of w(e)) {
91
- let e = C.exec(n.style.transform);
101
+ for (let n of T(e)) {
102
+ let e = w.exec(n.style.transform);
92
103
  e && t.set(n, {
93
104
  index: Number(n.getAttribute("data-row-index")),
94
105
  baseY: parseFloat(e[1])
95
106
  });
96
107
  }
97
108
  return t;
98
- }, re = (t) => {
99
- let n = R, r = O;
100
- if (!n || r === null || D === null) return;
101
- let i = D.scrollContainerRef.current;
109
+ }, oe = (t) => {
110
+ let n = V, r = k;
111
+ if (!n || r === null || O === null) return;
112
+ let i = O.scrollContainerRef.current;
102
113
  if (!i) return;
103
- for (let e of w(i)) {
114
+ for (let e of T(i)) {
104
115
  if (n.has(e)) continue;
105
- let t = C.exec(e.style.transform);
116
+ let t = w.exec(e.style.transform);
106
117
  t && n.set(e, {
107
118
  index: Number(e.getAttribute("data-row-index")),
108
119
  baseY: parseFloat(t[1])
109
120
  });
110
121
  }
111
- let a = D.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - z) * D.verticalScaleFactor, s = (j ? A.y - j.y : 0) + o, c = t === null ? null : e(r, t);
122
+ let a = O.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - H) * O.verticalScaleFactor, s = (P ? N.y - P.y : 0) + o, c = t === null ? null : e(r, t);
112
123
  n.forEach((e, t) => {
113
124
  let { index: i, baseY: o } = e;
114
125
  if (!t.isConnected) {
@@ -120,166 +131,169 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
120
131
  return;
121
132
  }
122
133
  let l = 0;
123
- c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = b, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
134
+ c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = x, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
124
135
  });
125
- let l = B ?? /* @__PURE__ */ new Set();
126
- B = l;
127
- for (let { el: e, index: t } of T(i)) {
136
+ let l = U ?? /* @__PURE__ */ new Set();
137
+ U = l;
138
+ for (let { el: e, index: t } of E(i)) {
128
139
  if (l.add(e), t === r) {
129
140
  e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
130
141
  continue;
131
142
  }
132
143
  let n = 0;
133
- c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = b, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
144
+ c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = x, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
134
145
  }
135
- }, ie = (e, r) => {
136
- if (D === null) return null;
137
- let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = D, d = a.current, f = o.current;
138
- if (!d || !f) return null;
139
- let p = d.getBoundingClientRect();
140
- if (e < p.left || e > p.right || r < p.top || r > p.bottom) return null;
141
- let m = i(r, p.top + d.clientTop + d.clientHeight, D.footerHeight ?? 0), h = f.getBoundingClientRect(), g = f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), _ = t(g, s), v = O, y = v !== null && V() ? s.detailHeight(v) : 0;
146
+ }, se = (e, r) => {
147
+ if (O === null) return null;
148
+ let { scrollContainerRef: o, bodyScrollRef: s, rowMetrics: c, headerHeight: l, verticalScaleFactor: u, windowBaseOffsetPx: d } = O, f = o.current, p = s.current;
149
+ if (!f || !p) return null;
150
+ let m = f.getBoundingClientRect();
151
+ if (e < m.left || e > m.right || r < m.top || r > m.bottom) return null;
152
+ let ee = a(i(r, m.top + f.clientTop + f.clientHeight, O.footerHeight ?? 0), m.top + f.clientTop, O.stickyTopHeight ?? 0), h = p.getBoundingClientRect(), g = p.scrollTop + ee - h.top - l - f.scrollTop * (1 - u), _ = t(g, c), v = k, y = v !== null && W() ? c.detailHeight(v) : 0;
142
153
  if (v !== null && y > 0) {
143
- let e = t(g + y, s);
154
+ let e = t(g + y, c);
144
155
  e > v + 1 && (_ = e);
145
156
  }
146
- let b = n(_, s);
157
+ let te = n(_, c);
147
158
  return {
148
159
  slot: _,
149
- top: c + b - u
160
+ top: l + te - d
150
161
  };
151
- }, Y = () => {
152
- let t = ie(A.x, A.y), n = O;
153
- if (V()) {
154
- t && n !== null && (k = e(n, t.slot) === null ? null : t.slot), K(), re(k);
162
+ }, Q = () => {
163
+ let t = se(N.x, N.y), n = k;
164
+ if (W()) {
165
+ t && n !== null && (e(n, t.slot) === null ? A = null : M(n, t.slot) && (A = t.slot)), Y(), oe(A);
155
166
  return;
156
167
  }
157
- if (te(t), !t || n === null || e(n, t.slot) === null) {
158
- k = null, K();
168
+ let r = t !== null && n !== null && e(n, t.slot) !== null && !M(n, t.slot);
169
+ if (ie(r ? null : t), !t || n === null || r || e(n, t.slot) === null) {
170
+ A = null, Y();
159
171
  return;
160
172
  }
161
- k = t.slot;
162
- for (let e of G()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
163
- }, X = () => {
164
- if (O === null) {
165
- F = null;
173
+ A = t.slot;
174
+ for (let e of J()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
175
+ }, ce = () => {
176
+ if (k === null) {
177
+ R = null;
166
178
  return;
167
179
  }
168
- let e = D?.scrollContainerRef.current ?? null;
169
- if (e && (M || (!j || o(j, A, 6)) && (M = !0), M)) {
170
- let t = e.getBoundingClientRect(), n = c({
180
+ let e = O?.scrollContainerRef.current ?? null;
181
+ if (e && (F || (!P || s(P, N, 6)) && (F = !0), F)) {
182
+ let t = e.getBoundingClientRect(), n = d(e, t), r = l({
171
183
  rectLeft: t.left,
172
184
  rectTop: t.top,
173
185
  clientLeft: e.clientLeft,
174
186
  clientTop: e.clientTop,
175
187
  clientWidth: e.clientWidth,
176
188
  clientHeight: e.clientHeight,
177
- scale: l(e, t)
178
- }), r = s(A.y, n.top, n.bottom - (D?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
179
- i !== e.scrollTop && e.scrollTo({
180
- top: i,
189
+ scale: n
190
+ }), i = c(N.y, u(r.top, (O?.stickyTopHeight ?? 0) * n.y, 24), r.bottom - (O?.footerHeight ?? 0), 24), a = o(e.scrollTop, i, 18, e.scrollHeight - e.clientHeight);
191
+ a !== e.scrollTop && e.scrollTo({
192
+ top: a,
181
193
  behavior: "auto"
182
194
  });
183
195
  }
184
- Y(), F = requestAnimationFrame(X);
185
- }, Z = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, Q = () => {
186
- let e = D?.scrollContainerRef.current ?? null;
196
+ Q(), R = requestAnimationFrame(ce);
197
+ }, le = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, ue = () => {
198
+ let e = O?.scrollContainerRef.current ?? null;
187
199
  if (!e) return null;
188
200
  let t = /* @__PURE__ */ new Map();
189
- for (let n of w(e)) t.set(Z(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
190
- for (let n of T(e)) t.set(n.key, n.el.getBoundingClientRect().top);
201
+ for (let n of T(e)) t.set(le(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
202
+ for (let n of E(e)) t.set(n.key, n.el.getBoundingClientRect().top);
191
203
  return t;
192
204
  }, $ = (t) => {
193
- F !== null && (cancelAnimationFrame(F), F = null), document.body.style.cursor = "", K(), q();
194
- let n = O, r = k, i = L;
195
- J(n, !1), O = null, L = null, k = null, j = null, P = null;
196
- let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && D !== null, s = R;
197
- R = null;
198
- let c = s && o && D !== null && !S(D.scrollContainerRef.current) ? Q() : null, l = B;
199
- if (B = null, l && (o ? l.forEach(E) : (l.forEach((e) => {
200
- e.isConnected && (e.style.transition = b, e.style.transform = "translateY(0px)", e.style.zIndex = "");
205
+ R !== null && (cancelAnimationFrame(R), R = null), document.body.style.cursor = "", Y(), X();
206
+ let n = k, r = A, i = B;
207
+ Z(n, !1), k = null, B = null, A = null, P = null, L = null;
208
+ let a = n === null || r === null ? null : e(n, r), o = a !== null && n !== null && r !== null && t && !M(n, r) ? null : a;
209
+ j = null;
210
+ let s = t && n !== null && o !== null && O !== null, c = V;
211
+ V = null;
212
+ let l = c && s && O !== null && !C(O.scrollContainerRef.current) ? ue() : null, u = U;
213
+ if (U = null, u && (s ? u.forEach(D) : (u.forEach((e) => {
214
+ e.isConnected && (e.style.transition = x, e.style.transform = "translateY(0px)", e.style.zIndex = "");
201
215
  }), window.setTimeout(() => {
202
- l.forEach((e) => {
203
- B?.has(e) || E(e);
216
+ u.forEach((e) => {
217
+ U?.has(e) || D(e);
204
218
  });
205
- }, 200))), s) if (o) s.forEach(({ baseY: e }, t) => {
219
+ }, 200))), c) if (s) c.forEach(({ baseY: e }, t) => {
206
220
  t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
207
221
  });
208
222
  else {
209
223
  let e = [];
210
- s.forEach(({ baseY: t }, n) => {
211
- n.isConnected && (n.style.transition = b, n.style.transform = `translateY(${t}px)`, e.push(n));
224
+ c.forEach(({ baseY: t }, n) => {
225
+ n.isConnected && (n.style.transition = x, n.style.transform = `translateY(${t}px)`, e.push(n));
212
226
  }), window.setTimeout(() => {
213
227
  for (let t of e) t.style.transition = "", t.style.willChange = "";
214
228
  }, 200);
215
229
  }
216
- if (!o || n === null || a === null || D === null) return;
217
- let u = c ?? (S(D.scrollContainerRef.current) ? null : Q()), d = u ? {
218
- tops: u,
230
+ if (!s || n === null || o === null || O === null) return;
231
+ let d = l ?? (C(O.scrollContainerRef.current) ? null : ue()), f = d ? {
232
+ tops: d,
219
233
  from: n,
220
- to: a,
234
+ to: o,
221
235
  row: i
222
236
  } : null;
223
- I = d, D.commitRowMove(n, a), d && requestAnimationFrame(() => {
224
- I === d && (I = null);
237
+ z = f, O.commitRowMove(n, o), f && requestAnimationFrame(() => {
238
+ z === f && (z = null);
225
239
  });
226
- }, ae = () => {
227
- let e = I;
228
- if (I = null, !e) return;
229
- let t = D?.scrollContainerRef.current ?? null;
240
+ }, de = () => {
241
+ let e = z;
242
+ if (z = null, !e) return;
243
+ let t = O?.scrollContainerRef.current ?? null;
230
244
  if (!t) return;
231
245
  let { tops: n, from: r, to: i } = e;
232
- if (D?.locateDragRow && e.row !== null && D.locateDragRow(e.row, i) !== i) return;
246
+ if (O?.locateDragRow && e.row !== null && O.locateDragRow(e.row, i) !== i) return;
233
247
  let a = (e) => e === i ? r : r < i && e >= r && e < i ? e + 1 : i < r && e > i && e <= r ? e - 1 : e, o = [], s = /* @__PURE__ */ new Map();
234
- w(t).forEach((e) => {
235
- let t = n.get(Z(e, a(Number(e.getAttribute("data-row-index")))));
248
+ T(t).forEach((e) => {
249
+ let t = n.get(le(e, a(Number(e.getAttribute("data-row-index")))));
236
250
  if (t === void 0) return;
237
251
  let r = t - e.getBoundingClientRect().top;
238
252
  if (Math.abs(r) < .5) return;
239
- let i = C.exec(e.style.transform);
253
+ let i = w.exec(e.style.transform);
240
254
  if (!i) return;
241
255
  let c = parseFloat(i[1]);
242
256
  s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
243
257
  });
244
258
  let c = [];
245
- if (T(t).forEach(({ el: e, index: t, key: r }) => {
259
+ if (E(t).forEach(({ el: e, index: t, key: r }) => {
246
260
  let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
247
261
  if (o === void 0) return;
248
262
  let s = o - e.getBoundingClientRect().top;
249
263
  Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
250
264
  }), !(o.length === 0 && c.length === 0)) {
251
265
  t.getBoundingClientRect();
252
- for (let e of o) e.style.transition = `transform ${v}ms ${y}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
253
- for (let e of c) e.style.transition = `transform ${v}ms ${y}`, e.style.transform = "translateY(0px)";
266
+ for (let e of o) e.style.transition = `transform ${ne}ms ${b}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
267
+ for (let e of c) e.style.transition = `transform ${ne}ms ${b}`, e.style.transform = "translateY(0px)";
254
268
  window.setTimeout(() => {
255
269
  for (let e of o) e.style.transition = "", e.style.willChange = "";
256
- for (let e of c) B?.has(e) || E(e);
270
+ for (let e of c) U?.has(e) || D(e);
257
271
  }, 280);
258
272
  }
259
- }, oe = (e, t) => {
260
- if (D === null || !D.enabled || t.button !== 0) return;
261
- if (t.stopPropagation(), t.preventDefault(), D.gridRootRef?.current?.focus({ preventScroll: !0 }), O !== null) {
262
- if (t.pointerId !== P) return;
263
- N?.(), $(!1);
273
+ }, fe = (e, t) => {
274
+ if (O === null || !O.enabled || t.button !== 0) return;
275
+ if (t.stopPropagation(), t.preventDefault(), O.gridRootRef?.current?.focus({ preventScroll: !0 }), k !== null) {
276
+ if (t.pointerId !== L) return;
277
+ I?.(), $(!1);
264
278
  }
265
- O = e, L = D.getDragRow?.(e) ?? null, P = t.pointerId, k = null, A = {
279
+ k = e, B = O.getDragRow?.(e) ?? null, L = t.pointerId, A = null, N = {
266
280
  x: t.clientX,
267
281
  y: t.clientY
268
- }, j = {
282
+ }, P = {
269
283
  x: t.clientX,
270
284
  y: t.clientY
271
- }, M = !1, document.body.style.cursor = "grabbing", V() ? (R = ne(), z = D.scrollContainerRef.current?.scrollTop ?? 0) : ee(D.getRowDragLabel(e)), J(e, !0);
285
+ }, F = !1, document.body.style.cursor = "grabbing", W() ? (V = ae(), H = O.scrollContainerRef.current?.scrollTop ?? 0) : re(O.getRowDragLabel(e)), Z(e, !0);
272
286
  let n = t.currentTarget, r = t.pointerId;
273
287
  try {
274
288
  n.setPointerCapture(r);
275
289
  } catch {}
276
290
  let i = (e) => {
277
- e.pointerId === r && (A = {
291
+ e.pointerId === r && (N = {
278
292
  x: e.clientX,
279
293
  y: e.clientY
280
- }, Y());
281
- }, a = u(), o = () => {
282
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur", d), a(), N = null;
294
+ }, Q());
295
+ }, a = f(), o = () => {
296
+ window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur", u), a(), I = null;
283
297
  try {
284
298
  n.releasePointerCapture(r);
285
299
  } catch {}
@@ -293,46 +307,46 @@ var p = 14, m = 12, h = "0.5", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
293
307
  function l(e) {
294
308
  e.key === "Escape" && (o(), $(!1));
295
309
  }
296
- function d() {
310
+ function u() {
297
311
  o(), $(!1);
298
312
  }
299
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", d), N = o, Y(), F = requestAnimationFrame(X);
300
- }, se = (e) => {
301
- if (O === null || L == null || D?.locateDragRow === void 0) return;
302
- let t = D.locateDragRow(L, O);
303
- if (R && R.forEach((e, t) => {
313
+ window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", u), I = o, Q(), R = requestAnimationFrame(ce);
314
+ }, pe = (e) => {
315
+ if (k === null || B == null || O?.locateDragRow === void 0) return;
316
+ let t = O.locateDragRow(B, k);
317
+ if (V && V.forEach((e, t) => {
304
318
  if (!t.isConnected) {
305
- R?.delete(t);
319
+ V?.delete(t);
306
320
  return;
307
321
  }
308
322
  let n = Number(t.getAttribute("data-row-index"));
309
323
  if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
310
- let r = C.exec(t.style.transform);
324
+ let r = w.exec(t.style.transform);
311
325
  if (!r) {
312
- R?.delete(t);
326
+ V?.delete(t);
313
327
  return;
314
328
  }
315
329
  e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
316
330
  }), t === null) {
317
- N?.(), $(!1);
331
+ I?.(), $(!1);
318
332
  return;
319
333
  }
320
- R && t !== O && j !== null && e !== null && (j = {
321
- x: j.x,
322
- y: j.y + D.rowMetrics.rowTop(t) - e.rowTop(O)
323
- }), t !== O && (J(null, !1), O = t, J(t, !0)), Y();
334
+ V && t !== k && P !== null && e !== null && (P = {
335
+ x: P.x,
336
+ y: P.y + O.rowMetrics.rowTop(t) - e.rowTop(k)
337
+ }), t !== k && (Z(null, !1), k = t, Z(t, !0)), Q();
324
338
  };
325
339
  return {
326
340
  update: (e) => {
327
- let t = D;
328
- D = e, O !== null && t !== null && t.locateDragRow !== e.locateDragRow && se(t.rowMetrics);
341
+ let t = O;
342
+ O = e, t?.canDropAt !== e.canDropAt && (j = null), k !== null && t !== null && t.locateDragRow !== e.locateDragRow && pe(t.rowMetrics);
329
343
  },
330
- onRowDragHandlePointerDown: oe,
331
- applyReorderSettle: ae,
344
+ onRowDragHandlePointerDown: fe,
345
+ applyReorderSettle: de,
332
346
  dispose: () => {
333
- N?.(), N = null, F !== null && (cancelAnimationFrame(F), F = null), document.body.style.cursor = "", q(), J(O, !1), O = null, L = null, k = null, R = null, B?.forEach(E), B = null, I = null;
347
+ I?.(), I = null, R !== null && (cancelAnimationFrame(R), R = null), document.body.style.cursor = "", X(), Z(k, !1), k = null, B = null, A = null, j = null, V = null, U?.forEach(D), U = null, z = null;
334
348
  }
335
349
  };
336
350
  };
337
351
  //#endregion
338
- export { D as createRowDragController };
352
+ export { O as createRowDragController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`ssg-scroll-container--scrolling`,t=120,n=()=>{let t=null,n=null,r=!1,i=null,a=null,o=null,s=null,c=()=>{a=null;let e=i;i=null,e&&t?.onScroll?.(e)},l=e=>Math.max(e.clientHeight-(t?.footerHeight??0),0),u=u=>{s=u,t?.setViewState({scrollTop:u.scrollTop,viewportHeight:l(u),viewportWidth:u.clientWidth});let d=()=>{t?.setViewState({scrollTop:u.scrollTop}),u.classList.add(e),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,u.classList.remove(e)},120);let n=r?`api`:`user`;r=!1;let s=i;i={top:u.scrollTop,left:u.scrollLeft,source:s?.source===`user`?`user`:n},t?.onScroll&&a===null&&(a=requestAnimationFrame(c))};u.addEventListener(`scroll`,d,{passive:!0});let f=null,p=new ResizeObserver(()=>{f??=requestAnimationFrame(()=>{f=null,u.clientWidth!==0&&t?.setViewState({viewportHeight:l(u),viewportWidth:u.clientWidth})})});p.observe(u),n=()=>{u.removeEventListener(`scroll`,d),a!==null&&(cancelAnimationFrame(a),a=null),o!==null&&(clearTimeout(o),o=null),u.classList.remove(e),p.disconnect(),f!==null&&cancelAnimationFrame(f),s=null}};return{update:e=>{let r=t?.footerHeight??0;if(t=e,n===null){let t=e.scrollContainerRef.current;t&&u(t);return}let i=e.footerHeight??0;if(i!==r&&s?.clientWidth){let t=s,n=i-r;if(n>0){let e=t.scrollHeight-n-t.clientHeight;e>0&&t.scrollTop>=e-1&&(t.scrollTop=t.scrollHeight-t.clientHeight)}e.setViewState({viewportHeight:l(t)})}},markApiScroll:()=>{let e=r;return r=!0,()=>{r=e}},dispose:()=>{n?.(),n=null}}};exports.SCROLLING_CLASS_NAME=e,exports.SCROLLING_IDLE_MS=t,exports.createScrollSyncController=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/scrollBottom.cjs");var t=`ssg-scroll-container--scrolling`,n=120,r=()=>{let n=null,r=null,i=!1,a=null,o=null,s=null,c=null,l=()=>{o=null;let e=a;a=null,e&&n?.onScroll?.(e)},u=e=>Math.max(e.clientHeight-(n?.footerHeight??0),0),d=d=>{c=d,n?.setViewState({scrollTop:d.scrollTop,viewportHeight:u(d),viewportWidth:d.clientWidth});let f=()=>{n?.setViewState({scrollTop:d.scrollTop}),d.classList.add(t),s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,d.classList.remove(t)},120);let r=i?`api`:`user`;i=!1;let c=a;a={top:d.scrollTop,left:d.scrollLeft,source:c?.source===`user`?`user`:r,atBottom:e.isScrolledToBottom(d)},n?.onScroll&&o===null&&(o=requestAnimationFrame(l))};d.addEventListener(`scroll`,f,{passive:!0});let p=null,m=new ResizeObserver(()=>{p??=requestAnimationFrame(()=>{p=null,d.clientWidth!==0&&n?.setViewState({viewportHeight:u(d),viewportWidth:d.clientWidth})})});m.observe(d),r=()=>{d.removeEventListener(`scroll`,f),o!==null&&(cancelAnimationFrame(o),o=null),s!==null&&(clearTimeout(s),s=null),d.classList.remove(t),m.disconnect(),p!==null&&cancelAnimationFrame(p),c=null}};return{update:e=>{let t=n?.footerHeight??0;if(n=e,r===null){let t=e.scrollContainerRef.current;t&&d(t);return}let i=e.footerHeight??0;if(i!==t&&c?.clientWidth){let n=c,r=i-t;if(r>0){let e=n.scrollHeight-r-n.clientHeight;e>0&&n.scrollTop>=e-1&&(n.scrollTop=n.scrollHeight-n.clientHeight)}e.setViewState({viewportHeight:u(n)})}},markApiScroll:()=>{let e=i;return i=!0,()=>{i=e}},dispose:()=>{r?.(),r=null}}};exports.SCROLLING_CLASS_NAME=t,exports.SCROLLING_IDLE_MS=n,exports.createScrollSyncController=r;
@@ -1,69 +1,71 @@
1
+ import { isScrolledToBottom as e } from "../utils/scrollBottom.js";
1
2
  //#region src/controllers/scrollSyncController.ts
2
- var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
3
- let t = null, n = null, r = !1, i = null, a = null, o = null, s = null, c = () => {
4
- a = null;
5
- let e = i;
6
- i = null, e && t?.onScroll?.(e);
7
- }, l = (e) => Math.max(e.clientHeight - (t?.footerHeight ?? 0), 0), u = (u) => {
8
- s = u, t?.setViewState({
9
- scrollTop: u.scrollTop,
10
- viewportHeight: l(u),
11
- viewportWidth: u.clientWidth
3
+ var t = "ssg-scroll-container--scrolling", n = 120, r = () => {
4
+ let n = null, r = null, i = !1, a = null, o = null, s = null, c = null, l = () => {
5
+ o = null;
6
+ let e = a;
7
+ a = null, e && n?.onScroll?.(e);
8
+ }, u = (e) => Math.max(e.clientHeight - (n?.footerHeight ?? 0), 0), d = (d) => {
9
+ c = d, n?.setViewState({
10
+ scrollTop: d.scrollTop,
11
+ viewportHeight: u(d),
12
+ viewportWidth: d.clientWidth
12
13
  });
13
- let d = () => {
14
- t?.setViewState({ scrollTop: u.scrollTop }), u.classList.add(e), o !== null && clearTimeout(o), o = setTimeout(() => {
15
- o = null, u.classList.remove(e);
14
+ let f = () => {
15
+ n?.setViewState({ scrollTop: d.scrollTop }), d.classList.add(t), s !== null && clearTimeout(s), s = setTimeout(() => {
16
+ s = null, d.classList.remove(t);
16
17
  }, 120);
17
- let n = r ? "api" : "user";
18
- r = !1;
19
- let s = i;
20
- i = {
21
- top: u.scrollTop,
22
- left: u.scrollLeft,
23
- source: s?.source === "user" ? "user" : n
24
- }, t?.onScroll && a === null && (a = requestAnimationFrame(c));
18
+ let r = i ? "api" : "user";
19
+ i = !1;
20
+ let c = a;
21
+ a = {
22
+ top: d.scrollTop,
23
+ left: d.scrollLeft,
24
+ source: c?.source === "user" ? "user" : r,
25
+ atBottom: e(d)
26
+ }, n?.onScroll && o === null && (o = requestAnimationFrame(l));
25
27
  };
26
- u.addEventListener("scroll", d, { passive: !0 });
27
- let f = null, p = new ResizeObserver(() => {
28
- f ??= requestAnimationFrame(() => {
29
- f = null, u.clientWidth !== 0 && t?.setViewState({
30
- viewportHeight: l(u),
31
- viewportWidth: u.clientWidth
28
+ d.addEventListener("scroll", f, { passive: !0 });
29
+ let p = null, m = new ResizeObserver(() => {
30
+ p ??= requestAnimationFrame(() => {
31
+ p = null, d.clientWidth !== 0 && n?.setViewState({
32
+ viewportHeight: u(d),
33
+ viewportWidth: d.clientWidth
32
34
  });
33
35
  });
34
36
  });
35
- p.observe(u), n = () => {
36
- u.removeEventListener("scroll", d), a !== null && (cancelAnimationFrame(a), a = null), o !== null && (clearTimeout(o), o = null), u.classList.remove(e), p.disconnect(), f !== null && cancelAnimationFrame(f), s = null;
37
+ m.observe(d), r = () => {
38
+ d.removeEventListener("scroll", f), o !== null && (cancelAnimationFrame(o), o = null), s !== null && (clearTimeout(s), s = null), d.classList.remove(t), m.disconnect(), p !== null && cancelAnimationFrame(p), c = null;
37
39
  };
38
40
  };
39
41
  return {
40
42
  update: (e) => {
41
- let r = t?.footerHeight ?? 0;
42
- if (t = e, n === null) {
43
+ let t = n?.footerHeight ?? 0;
44
+ if (n = e, r === null) {
43
45
  let t = e.scrollContainerRef.current;
44
- t && u(t);
46
+ t && d(t);
45
47
  return;
46
48
  }
47
49
  let i = e.footerHeight ?? 0;
48
- if (i !== r && s?.clientWidth) {
49
- let t = s, n = i - r;
50
- if (n > 0) {
51
- let e = t.scrollHeight - n - t.clientHeight;
52
- e > 0 && t.scrollTop >= e - 1 && (t.scrollTop = t.scrollHeight - t.clientHeight);
50
+ if (i !== t && c?.clientWidth) {
51
+ let n = c, r = i - t;
52
+ if (r > 0) {
53
+ let e = n.scrollHeight - r - n.clientHeight;
54
+ e > 0 && n.scrollTop >= e - 1 && (n.scrollTop = n.scrollHeight - n.clientHeight);
53
55
  }
54
- e.setViewState({ viewportHeight: l(t) });
56
+ e.setViewState({ viewportHeight: u(n) });
55
57
  }
56
58
  },
57
59
  markApiScroll: () => {
58
- let e = r;
59
- return r = !0, () => {
60
- r = e;
60
+ let e = i;
61
+ return i = !0, () => {
62
+ i = e;
61
63
  };
62
64
  },
63
65
  dispose: () => {
64
- n?.(), n = null;
66
+ r?.(), r = null;
65
67
  }
66
68
  };
67
69
  };
68
70
  //#endregion
69
- export { e as SCROLLING_CLASS_NAME, t as SCROLLING_IDLE_MS, n as createScrollSyncController };
71
+ export { t as SCROLLING_CLASS_NAME, n as SCROLLING_IDLE_MS, r as createScrollSyncController };