@ishibashi0112/spreadsheet-grid-core 0.62.0 → 0.63.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 (101) hide show
  1. package/dist/controllers/autoHeightMeasurer.cjs +1 -1
  2. package/dist/controllers/autoHeightMeasurer.d.ts +1 -0
  3. package/dist/controllers/autoHeightMeasurer.js +59 -48
  4. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  5. package/dist/controllers/columnHeaderDragController.js +119 -115
  6. package/dist/controllers/columnMenuController.cjs +1 -1
  7. package/dist/controllers/columnMenuController.js +2 -0
  8. package/dist/controllers/contextMenuController.cjs +1 -1
  9. package/dist/controllers/contextMenuController.js +2 -0
  10. package/dist/controllers/detailTabOrder.cjs +1 -0
  11. package/dist/controllers/detailTabOrder.d.ts +4 -0
  12. package/dist/controllers/detailTabOrder.js +33 -0
  13. package/dist/controllers/fillHandleController.cjs +1 -1
  14. package/dist/controllers/fillHandleController.js +119 -117
  15. package/dist/controllers/filterPopoverController.cjs +1 -1
  16. package/dist/controllers/filterPopoverController.d.ts +1 -0
  17. package/dist/controllers/filterPopoverController.js +4 -2
  18. package/dist/controllers/imeInputController.cjs +1 -1
  19. package/dist/controllers/imeInputController.js +1 -1
  20. package/dist/controllers/keyboardController.cjs +1 -1
  21. package/dist/controllers/keyboardController.d.ts +2 -0
  22. package/dist/controllers/keyboardController.js +71 -68
  23. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  24. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  25. package/dist/controllers/pointerInteractionsController.js +22 -15
  26. package/dist/controllers/popoverSupport.cjs +1 -1
  27. package/dist/controllers/popoverSupport.d.ts +2 -0
  28. package/dist/controllers/popoverSupport.js +11 -3
  29. package/dist/controllers/rowDragController.cjs +1 -1
  30. package/dist/controllers/rowDragController.js +120 -119
  31. package/dist/controllers/toolPanelController.cjs +1 -1
  32. package/dist/controllers/toolPanelController.js +2 -0
  33. package/dist/controllers/tooltipController.cjs +1 -1
  34. package/dist/controllers/tooltipController.js +54 -53
  35. package/dist/controllers/viewportSyncController.cjs +1 -1
  36. package/dist/controllers/viewportSyncController.d.ts +3 -1
  37. package/dist/controllers/viewportSyncController.js +4 -4
  38. package/dist/engine/columnCommands.cjs +1 -1
  39. package/dist/engine/columnCommands.d.ts +2 -0
  40. package/dist/engine/columnCommands.js +71 -31
  41. package/dist/engine/columnLayout.cjs +1 -1
  42. package/dist/engine/columnLayout.js +15 -14
  43. package/dist/engine/createGridEngine.cjs +1 -1
  44. package/dist/engine/createGridEngine.d.ts +3 -1
  45. package/dist/engine/createGridEngine.js +71 -49
  46. package/dist/engine/exportCommands.cjs +1 -1
  47. package/dist/engine/exportCommands.d.ts +2 -1
  48. package/dist/engine/exportCommands.js +117 -92
  49. package/dist/engine/features.d.ts +3 -1
  50. package/dist/engine/fullFeatures.cjs +1 -1
  51. package/dist/engine/fullFeatures.js +23 -21
  52. package/dist/engine/gridApi.cjs +1 -1
  53. package/dist/engine/gridApi.d.ts +6 -1
  54. package/dist/engine/gridApi.js +378 -332
  55. package/dist/engine/rowPipeline.cjs +1 -1
  56. package/dist/engine/rowPipeline.d.ts +2 -0
  57. package/dist/engine/rowPipeline.js +6 -6
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +7 -6
  61. package/dist/logic/columnAutosize.cjs +1 -1
  62. package/dist/logic/columnAutosize.js +84 -84
  63. package/dist/logic/columnWidthState.cjs +1 -1
  64. package/dist/logic/columnWidthState.js +25 -20
  65. package/dist/logic/detailRow.cjs +1 -1
  66. package/dist/logic/detailRow.d.ts +11 -0
  67. package/dist/logic/detailRow.js +34 -1
  68. package/dist/logic/exportCsv.cjs +2 -2
  69. package/dist/logic/exportCsv.d.ts +3 -1
  70. package/dist/logic/exportCsv.js +15 -10
  71. package/dist/logic/exportData.cjs +1 -1
  72. package/dist/logic/exportData.d.ts +3 -1
  73. package/dist/logic/exportData.js +23 -15
  74. package/dist/logic/gridState.cjs +1 -1
  75. package/dist/logic/gridState.d.ts +5 -0
  76. package/dist/logic/gridState.js +27 -22
  77. package/dist/logic/groupExport.cjs +1 -0
  78. package/dist/logic/groupExport.d.ts +15 -0
  79. package/dist/logic/groupExport.js +40 -0
  80. package/dist/logic/grouping.cjs +1 -1
  81. package/dist/logic/grouping.d.ts +2 -2
  82. package/dist/logic/grouping.js +58 -40
  83. package/dist/logic/localeText.cjs +1 -0
  84. package/dist/logic/localeText.d.ts +4 -0
  85. package/dist/logic/localeText.js +45 -0
  86. package/dist/logic/scrollTargets.cjs +1 -1
  87. package/dist/logic/scrollTargets.d.ts +6 -1
  88. package/dist/logic/scrollTargets.js +8 -8
  89. package/dist/logic/theme.cjs +1 -1
  90. package/dist/logic/theme.d.ts +2 -0
  91. package/dist/logic/theme.js +2 -2
  92. package/dist/model/gridActions.cjs +1 -1
  93. package/dist/model/gridActions.d.ts +4 -2
  94. package/dist/model/gridActions.js +12 -4
  95. package/dist/model/gridReducer.cjs +1 -1
  96. package/dist/model/gridReducer.js +2 -2
  97. package/dist/model/gridTypes.core.d.ts +158 -27
  98. package/dist/utils/portalTokens.cjs +1 -0
  99. package/dist/utils/portalTokens.d.ts +3 -0
  100. package/dist/utils/portalTokens.js +65 -0
  101. package/package.json +1 -1
@@ -2,13 +2,14 @@ import { resolveMoveTargetIndex as e, resolveRowDropSlot as t, resolveRowDropSlo
2
2
  import { isInsideDetailCardOf as r } from "../logic/detailRow.js";
3
3
  import { clampClientYAboveFooter as i, computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c } from "../logic/autoScrollGeometry.js";
4
4
  import { applySlotToElement as l } from "../logic/slotDom.js";
5
+ import { syncPortalTokens as u } from "../utils/portalTokens.js";
5
6
  //#region src/controllers/rowDragController.ts
6
- var u = 14, d = 12, f = "0.5", p = "<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>", m = "<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>", h = 200, g = "cubic-bezier(0.2, 0.7, 0.3, 1)", _ = `transform 160ms ${g}`, v = "data-ssg-row-dragging", y = (e) => e?.closest(".ssg-motion-off") != null, b = /translateY\((-?[\d.]+)px\)/, x = (e) => {
7
+ var d = 14, f = 12, p = "0.5", m = "<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>", h = "<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>", g = 200, _ = "cubic-bezier(0.2, 0.7, 0.3, 1)", v = `transform 160ms ${_}`, y = "data-ssg-row-dragging", b = (e) => e?.closest(".ssg-motion-off") != null, x = /translateY\((-?[\d.]+)px\)/, S = (e) => {
7
8
  let t = [];
8
9
  return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
9
10
  r(e, n) || t.push(n);
10
11
  }), t;
11
- }, S = (e) => {
12
+ }, C = (e) => {
12
13
  let t = [], n = /* @__PURE__ */ new Map();
13
14
  return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
14
15
  if (r(e, i)) return;
@@ -19,22 +20,22 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
19
20
  key: `band|${o}|${a}`
20
21
  });
21
22
  }), t;
22
- }, C = (e) => {
23
+ }, w = (e) => {
23
24
  e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
24
- }, w = () => {
25
- let w = null, T = null, E = null, D = {
25
+ }, T = () => {
26
+ let T = null, E = null, D = null, O = {
26
27
  x: 0,
27
28
  y: 0
28
- }, O = null, k = !1, A = null, j = null, M = null, N = null, P = null, F = null, I = 0, L = null, R = () => w?.motion === "live", z = null, B = null, V = null, H = () => [
29
- w?.leftIndicatorRef.current ?? null,
30
- w?.centerIndicatorRef.current ?? null,
31
- w?.rightIndicatorRef.current ?? null
32
- ], U = () => {
33
- for (let e of H()) e && (e.style.display = "none");
34
- }, W = (e) => {
35
- if (z) return;
29
+ }, k = null, A = !1, j = null, M = null, N = null, P = null, F = null, I = null, L = 0, R = null, z = () => T?.motion === "live", B = null, V = null, H = null, U = () => [
30
+ T?.leftIndicatorRef.current ?? null,
31
+ T?.centerIndicatorRef.current ?? null,
32
+ T?.rightIndicatorRef.current ?? null
33
+ ], W = () => {
34
+ for (let e of U()) e && (e.style.display = "none");
35
+ }, G = (e) => {
36
+ if (B) return;
36
37
  let t = document.createElement("div");
37
- t.setAttribute("data-grid-drag-ghost", ""), w?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), w?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
38
+ t.setAttribute("data-grid-drag-ghost", ""), T?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), T?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), T?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
38
39
  "position:fixed",
39
40
  "top:0",
40
41
  "left:0",
@@ -59,53 +60,53 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
59
60
  "z-index:9999",
60
61
  "will-change:transform",
61
62
  "transform:translate(-9999px,-9999px)"
62
- ].join(";"), l(t, w?.ghostSlot);
63
+ ].join(";"), l(t, T?.ghostSlot);
63
64
  let n = document.createElement("span");
64
65
  n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
65
66
  let r = document.createElement("span");
66
- r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), z = t, B = n, V = null;
67
- }, G = (e) => {
68
- let t = z;
67
+ r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), u(T?.scrollContainerRef.current, t), B = t, V = n, H = null;
68
+ }, K = (e) => {
69
+ let t = B;
69
70
  if (!t) return;
70
- t.style.transform = "translate(" + (D.x + u) + "px," + (D.y + d) + "px)";
71
+ t.style.transform = "translate(" + (O.x + d) + "px," + (O.y + f) + "px)";
71
72
  let n = e ? "move" : "out";
72
- if (V === n) return;
73
- V = n;
74
- let r = B;
75
- n === "out" ? (t.style.opacity = f, r && (r.innerHTML = m)) : (t.style.opacity = "1", r && (r.innerHTML = p));
76
- }, K = () => {
77
- z && z.parentNode && z.parentNode.removeChild(z), z = null, B = null, V = null;
78
- }, q = (e, t) => {
79
- let n = w?.scrollContainerRef.current ?? null;
80
- !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${v}]`).forEach((e) => {
81
- r(n, e) || (t ? e.setAttribute(v, R() ? "live" : "") : e.removeAttribute(v));
73
+ if (H === n) return;
74
+ H = n;
75
+ let r = V;
76
+ n === "out" ? (t.style.opacity = p, r && (r.innerHTML = h)) : (t.style.opacity = "1", r && (r.innerHTML = m));
77
+ }, q = () => {
78
+ B && B.parentNode && B.parentNode.removeChild(B), B = null, V = null, H = null;
79
+ }, J = (e, t) => {
80
+ let n = T?.scrollContainerRef.current ?? null;
81
+ !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${y}]`).forEach((e) => {
82
+ r(n, e) || (t ? e.setAttribute(y, z() ? "live" : "") : e.removeAttribute(y));
82
83
  });
83
- }, J = () => {
84
- let e = w?.scrollContainerRef.current ?? null;
84
+ }, ee = () => {
85
+ let e = T?.scrollContainerRef.current ?? null;
85
86
  if (!e) return null;
86
87
  let t = /* @__PURE__ */ new Map();
87
- for (let n of x(e)) {
88
- let e = b.exec(n.style.transform);
88
+ for (let n of S(e)) {
89
+ let e = x.exec(n.style.transform);
89
90
  e && t.set(n, {
90
91
  index: Number(n.getAttribute("data-row-index")),
91
92
  baseY: parseFloat(e[1])
92
93
  });
93
94
  }
94
95
  return t;
95
- }, ee = (t) => {
96
- let n = F, r = T;
97
- if (!n || r === null || w === null) return;
98
- let i = w.scrollContainerRef.current;
96
+ }, te = (t) => {
97
+ let n = I, r = E;
98
+ if (!n || r === null || T === null) return;
99
+ let i = T.scrollContainerRef.current;
99
100
  if (!i) return;
100
- for (let e of x(i)) {
101
+ for (let e of S(i)) {
101
102
  if (n.has(e)) continue;
102
- let t = b.exec(e.style.transform);
103
+ let t = x.exec(e.style.transform);
103
104
  t && n.set(e, {
104
105
  index: Number(e.getAttribute("data-row-index")),
105
106
  baseY: parseFloat(t[1])
106
107
  });
107
108
  }
108
- let a = w.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - I) * w.verticalScaleFactor, s = (O ? D.y - O.y : 0) + o, c = t === null ? null : e(r, t);
109
+ let a = T.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - L) * T.verticalScaleFactor, s = (k ? O.y - k.y : 0) + o, c = t === null ? null : e(r, t);
109
110
  n.forEach((e, t) => {
110
111
  let { index: i, baseY: o } = e;
111
112
  if (!t.isConnected) {
@@ -117,25 +118,25 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
117
118
  return;
118
119
  }
119
120
  let l = 0;
120
- c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = _, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
121
+ c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = v, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
121
122
  });
122
- let l = L ?? /* @__PURE__ */ new Set();
123
- L = l;
124
- for (let { el: e, index: t } of S(i)) {
123
+ let l = R ?? /* @__PURE__ */ new Set();
124
+ R = l;
125
+ for (let { el: e, index: t } of C(i)) {
125
126
  if (l.add(e), t === r) {
126
127
  e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
127
128
  continue;
128
129
  }
129
130
  let n = 0;
130
- c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = _, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
131
+ c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = v, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
131
132
  }
132
- }, te = (e, r) => {
133
- if (w === null) return null;
134
- let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = w, d = a.current, f = o.current;
133
+ }, ne = (e, r) => {
134
+ if (T === null) return null;
135
+ let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = T, d = a.current, f = o.current;
135
136
  if (!d || !f) return null;
136
137
  let p = d.getBoundingClientRect();
137
138
  if (e < p.left || e > p.right || r < p.top || r > p.bottom) return null;
138
- let m = i(r, p.top + d.clientTop + d.clientHeight, w.footerHeight ?? 0), h = f.getBoundingClientRect(), g = f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), _ = t(g, s), v = T, y = v !== null && R() ? s.detailHeight(v) : 0;
139
+ let m = i(r, p.top + d.clientTop + d.clientHeight, T.footerHeight ?? 0), h = f.getBoundingClientRect(), g = f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), _ = t(g, s), v = E, y = v !== null && z() ? s.detailHeight(v) : 0;
139
140
  if (v !== null && y > 0) {
140
141
  let e = t(g + y, s);
141
142
  e > v + 1 && (_ = e);
@@ -146,24 +147,24 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
146
147
  top: c + b - u
147
148
  };
148
149
  }, Y = () => {
149
- let t = te(D.x, D.y), n = T;
150
- if (R()) {
151
- t && n !== null && (E = e(n, t.slot) === null ? null : t.slot), U(), ee(E);
150
+ let t = ne(O.x, O.y), n = E;
151
+ if (z()) {
152
+ t && n !== null && (D = e(n, t.slot) === null ? null : t.slot), W(), te(D);
152
153
  return;
153
154
  }
154
- if (G(t), !t || n === null || e(n, t.slot) === null) {
155
- E = null, U();
155
+ if (K(t), !t || n === null || e(n, t.slot) === null) {
156
+ D = null, W();
156
157
  return;
157
158
  }
158
- E = t.slot;
159
- for (let e of H()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
159
+ D = t.slot;
160
+ for (let e of U()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
160
161
  }, X = () => {
161
- if (T === null) {
162
- M = null;
162
+ if (E === null) {
163
+ N = null;
163
164
  return;
164
165
  }
165
- let e = w?.scrollContainerRef.current ?? null;
166
- if (e && (k || (!O || o(O, D, 6)) && (k = !0), k)) {
166
+ let e = T?.scrollContainerRef.current ?? null;
167
+ if (e && (A || (!k || o(k, O, 6)) && (A = !0), A)) {
167
168
  let t = e.getBoundingClientRect(), n = c({
168
169
  rectLeft: t.left,
169
170
  rectTop: t.top,
@@ -171,32 +172,32 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
171
172
  clientTop: e.clientTop,
172
173
  clientWidth: e.clientWidth,
173
174
  clientHeight: e.clientHeight
174
- }), r = s(D.y, n.top, n.bottom - (w?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
175
+ }), r = s(O.y, n.top, n.bottom - (T?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
175
176
  i !== e.scrollTop && e.scrollTo({
176
177
  top: i,
177
178
  behavior: "auto"
178
179
  });
179
180
  }
180
- Y(), M = requestAnimationFrame(X);
181
+ Y(), N = requestAnimationFrame(X);
181
182
  }, Z = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, Q = () => {
182
- let e = w?.scrollContainerRef.current ?? null;
183
+ let e = T?.scrollContainerRef.current ?? null;
183
184
  if (!e) return null;
184
185
  let t = /* @__PURE__ */ new Map();
185
- for (let n of x(e)) t.set(Z(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
186
- for (let n of S(e)) t.set(n.key, n.el.getBoundingClientRect().top);
186
+ for (let n of S(e)) t.set(Z(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
187
+ for (let n of C(e)) t.set(n.key, n.el.getBoundingClientRect().top);
187
188
  return t;
188
189
  }, $ = (t) => {
189
- M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", U(), K();
190
- let n = T, r = E, i = P;
191
- q(n, !1), T = null, P = null, E = null, O = null, j = null;
192
- let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && w !== null, s = F;
193
- F = null;
194
- let c = s && o && w !== null && !y(w.scrollContainerRef.current) ? Q() : null, l = L;
195
- if (L = null, l && (o ? l.forEach(C) : (l.forEach((e) => {
196
- e.isConnected && (e.style.transition = _, e.style.transform = "translateY(0px)", e.style.zIndex = "");
190
+ N !== null && (cancelAnimationFrame(N), N = null), document.body.style.cursor = "", W(), q();
191
+ let n = E, r = D, i = F;
192
+ J(n, !1), E = null, F = null, D = null, k = null, M = null;
193
+ let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && T !== null, s = I;
194
+ I = null;
195
+ let c = s && o && T !== null && !b(T.scrollContainerRef.current) ? Q() : null, l = R;
196
+ if (R = null, l && (o ? l.forEach(w) : (l.forEach((e) => {
197
+ e.isConnected && (e.style.transition = v, e.style.transform = "translateY(0px)", e.style.zIndex = "");
197
198
  }), window.setTimeout(() => {
198
199
  l.forEach((e) => {
199
- L?.has(e) || C(e);
200
+ R?.has(e) || w(e);
200
201
  });
201
202
  }, 200))), s) if (o) s.forEach(({ baseY: e }, t) => {
202
203
  t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
@@ -204,78 +205,78 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
204
205
  else {
205
206
  let e = [];
206
207
  s.forEach(({ baseY: t }, n) => {
207
- n.isConnected && (n.style.transition = _, n.style.transform = `translateY(${t}px)`, e.push(n));
208
+ n.isConnected && (n.style.transition = v, n.style.transform = `translateY(${t}px)`, e.push(n));
208
209
  }), window.setTimeout(() => {
209
210
  for (let t of e) t.style.transition = "", t.style.willChange = "";
210
211
  }, 200);
211
212
  }
212
- if (!o || n === null || a === null || w === null) return;
213
- let u = c ?? (y(w.scrollContainerRef.current) ? null : Q()), d = u ? {
213
+ if (!o || n === null || a === null || T === null) return;
214
+ let u = c ?? (b(T.scrollContainerRef.current) ? null : Q()), d = u ? {
214
215
  tops: u,
215
216
  from: n,
216
217
  to: a,
217
218
  row: i
218
219
  } : null;
219
- N = d, w.commitRowMove(n, a), d && requestAnimationFrame(() => {
220
- N === d && (N = null);
220
+ P = d, T.commitRowMove(n, a), d && requestAnimationFrame(() => {
221
+ P === d && (P = null);
221
222
  });
222
- }, ne = () => {
223
- let e = N;
224
- if (N = null, !e) return;
225
- let t = w?.scrollContainerRef.current ?? null;
223
+ }, re = () => {
224
+ let e = P;
225
+ if (P = null, !e) return;
226
+ let t = T?.scrollContainerRef.current ?? null;
226
227
  if (!t) return;
227
228
  let { tops: n, from: r, to: i } = e;
228
- if (w?.locateDragRow && e.row !== null && w.locateDragRow(e.row, i) !== i) return;
229
+ if (T?.locateDragRow && e.row !== null && T.locateDragRow(e.row, i) !== i) return;
229
230
  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();
230
- x(t).forEach((e) => {
231
+ S(t).forEach((e) => {
231
232
  let t = n.get(Z(e, a(Number(e.getAttribute("data-row-index")))));
232
233
  if (t === void 0) return;
233
234
  let r = t - e.getBoundingClientRect().top;
234
235
  if (Math.abs(r) < .5) return;
235
- let i = b.exec(e.style.transform);
236
+ let i = x.exec(e.style.transform);
236
237
  if (!i) return;
237
238
  let c = parseFloat(i[1]);
238
239
  s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
239
240
  });
240
241
  let c = [];
241
- if (S(t).forEach(({ el: e, index: t, key: r }) => {
242
+ if (C(t).forEach(({ el: e, index: t, key: r }) => {
242
243
  let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
243
244
  if (o === void 0) return;
244
245
  let s = o - e.getBoundingClientRect().top;
245
246
  Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
246
247
  }), !(o.length === 0 && c.length === 0)) {
247
248
  t.getBoundingClientRect();
248
- for (let e of o) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
249
- for (let e of c) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = "translateY(0px)";
249
+ for (let e of o) e.style.transition = `transform ${g}ms ${_}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
250
+ for (let e of c) e.style.transition = `transform ${g}ms ${_}`, e.style.transform = "translateY(0px)";
250
251
  window.setTimeout(() => {
251
252
  for (let e of o) e.style.transition = "", e.style.willChange = "";
252
- for (let e of c) L?.has(e) || C(e);
253
+ for (let e of c) R?.has(e) || w(e);
253
254
  }, 280);
254
255
  }
255
- }, re = (e, t) => {
256
- if (w === null || !w.enabled || t.button !== 0) return;
257
- if (t.stopPropagation(), t.preventDefault(), T !== null) {
258
- if (t.pointerId !== j) return;
259
- A?.(), $(!1);
256
+ }, ie = (e, t) => {
257
+ if (T === null || !T.enabled || t.button !== 0) return;
258
+ if (t.stopPropagation(), t.preventDefault(), E !== null) {
259
+ if (t.pointerId !== M) return;
260
+ j?.(), $(!1);
260
261
  }
261
- T = e, P = w.getDragRow?.(e) ?? null, j = t.pointerId, E = null, D = {
262
+ E = e, F = T.getDragRow?.(e) ?? null, M = t.pointerId, D = null, O = {
262
263
  x: t.clientX,
263
264
  y: t.clientY
264
- }, O = {
265
+ }, k = {
265
266
  x: t.clientX,
266
267
  y: t.clientY
267
- }, k = !1, document.body.style.cursor = "grabbing", R() ? (F = J(), I = w.scrollContainerRef.current?.scrollTop ?? 0) : W(w.getRowDragLabel(e)), q(e, !0);
268
+ }, A = !1, document.body.style.cursor = "grabbing", z() ? (I = ee(), L = T.scrollContainerRef.current?.scrollTop ?? 0) : G(T.getRowDragLabel(e)), J(e, !0);
268
269
  let n = t.currentTarget, r = t.pointerId;
269
270
  try {
270
271
  n.setPointerCapture(r);
271
272
  } catch {}
272
273
  let i = (e) => {
273
- e.pointerId === r && (D = {
274
+ e.pointerId === r && (O = {
274
275
  x: e.clientX,
275
276
  y: e.clientY
276
277
  }, Y());
277
278
  }, a = () => {
278
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), A = null;
279
+ window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), j = null;
279
280
  try {
280
281
  n.releasePointerCapture(r);
281
282
  } catch {}
@@ -292,43 +293,43 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
292
293
  function l() {
293
294
  a(), $(!1);
294
295
  }
295
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), A = a, Y(), M = requestAnimationFrame(X);
296
- }, ie = (e) => {
297
- if (T === null || P == null || w?.locateDragRow === void 0) return;
298
- let t = w.locateDragRow(P, T);
299
- if (F && F.forEach((e, t) => {
296
+ window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), j = a, Y(), N = requestAnimationFrame(X);
297
+ }, ae = (e) => {
298
+ if (E === null || F == null || T?.locateDragRow === void 0) return;
299
+ let t = T.locateDragRow(F, E);
300
+ if (I && I.forEach((e, t) => {
300
301
  if (!t.isConnected) {
301
- F?.delete(t);
302
+ I?.delete(t);
302
303
  return;
303
304
  }
304
305
  let n = Number(t.getAttribute("data-row-index"));
305
306
  if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
306
- let r = b.exec(t.style.transform);
307
+ let r = x.exec(t.style.transform);
307
308
  if (!r) {
308
- F?.delete(t);
309
+ I?.delete(t);
309
310
  return;
310
311
  }
311
312
  e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
312
313
  }), t === null) {
313
- A?.(), $(!1);
314
+ j?.(), $(!1);
314
315
  return;
315
316
  }
316
- F && t !== T && O !== null && e !== null && (O = {
317
- x: O.x,
318
- y: O.y + w.rowMetrics.rowTop(t) - e.rowTop(T)
319
- }), t !== T && (q(null, !1), T = t, q(t, !0)), Y();
317
+ I && t !== E && k !== null && e !== null && (k = {
318
+ x: k.x,
319
+ y: k.y + T.rowMetrics.rowTop(t) - e.rowTop(E)
320
+ }), t !== E && (J(null, !1), E = t, J(t, !0)), Y();
320
321
  };
321
322
  return {
322
323
  update: (e) => {
323
- let t = w;
324
- w = e, T !== null && t !== null && t.locateDragRow !== e.locateDragRow && ie(t.rowMetrics);
324
+ let t = T;
325
+ T = e, E !== null && t !== null && t.locateDragRow !== e.locateDragRow && ae(t.rowMetrics);
325
326
  },
326
- onRowDragHandlePointerDown: re,
327
- applyReorderSettle: ne,
327
+ onRowDragHandlePointerDown: ie,
328
+ applyReorderSettle: re,
328
329
  dispose: () => {
329
- A?.(), A = null, M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", K(), q(T, !1), T = null, P = null, E = null, F = null, L?.forEach(C), L = null, N = null;
330
+ j?.(), j = null, N !== null && (cancelAnimationFrame(N), N = null), document.body.style.cursor = "", q(), J(E, !1), E = null, F = null, D = null, I = null, R?.forEach(w), R = null, P = null;
330
331
  }
331
332
  };
332
333
  };
333
334
  //#endregion
334
- export { w as createRowDragController };
335
+ export { T as createRowDragController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs"),n=require("../logic/panelDragGeometry.cjs");var r=360,i=8,a=12,o=[`filter`,`columns`,`sort`],s=e=>{let t={filter:e.canUseFilterTab,columns:e.canUseColumnsTab,sort:e.canUseSortTab};return o.filter(e=>t[e])},c=(e,t)=>e===null?null:t.includes(e)?e:t[0]??null,l=()=>{let o=null,l=e.createValueStore({requestedTab:null,layout:null,flashTick:0}),u={current:null},d=null,f=e=>{l.setSnapshot({...l.getSnapshot(),...e})},p=e=>{let t=l.getSnapshot().layout;t===e||t!==null&&e!==null&&t.top===e.top&&t.left===e.left&&t.width===e.width||f({layout:e})},m=e=>n.clampPanelDragPosition({top:e.top,left:e.left,panelWidth:r,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}),h=()=>{if(d){let e=m(d);p({top:e.top,left:e.left,width:r});return}let e=o?.gridRootRef.current??null;if(!e){p(null);return}let t=e.getBoundingClientRect(),n=t.right-r-a,s=t.top+a;n=Math.max(i,n),n=Math.min(n,window.innerWidth-r-i),s=Math.max(i,s),p({top:s,left:n,width:r})},g=()=>o!==null&&c(l.getSnapshot().requestedTab,s(o))!==null,_=e=>{f({requestedTab:null,layout:null}),b(),o!==null&&e&&t.restoreGridFocus(o.gridRootRef)},v=()=>_(!0),y=t.createPopoverWindowBindings({onResize:h,onScroll:h,isInside:e=>u.current?.contains(e)===!0||o?.alliedRef?.current?.contains(e)===!0,onOutsidePointerDown:e=>_(o!==null&&t.isInsideGridRoot(o.gridRootRef,e)),onKeyDown:e=>{if(e.key===`Escape`){if(o?.suppressEscape){o.onSuppressedEscape?.();return}e.preventDefault(),v()}}}),b=()=>{let e=g();e&&!y.isAttached()?(h(),y.attach()):!e&&y.isAttached()&&y.detach()};return{update:e=>{o=e,b()},subscribe:l.subscribe,getSnapshot:l.getSnapshot,panelRef:u,open:e=>{if(o===null||!s(o).includes(e))return;let n=l.getSnapshot();t.blurForPopover(o.gridRootRef.current),f({requestedTab:e,flashTick:n.requestedTab===null?n.flashTick:n.flashTick+1}),b()},close:v,move:(e,t)=>{let n=m({top:e,left:t});d=n,f({layout:{top:n.top,left:n.left,width:r}})},dispose:()=>{y.detach()}}};exports.createToolPanelController=l,exports.resolveActiveToolPanelTab=c,exports.resolveAvailableToolPanelTabs=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs"),n=require("../logic/panelDragGeometry.cjs");var r=360,i=8,a=12,o=[`filter`,`columns`,`sort`],s=e=>{let t={filter:e.canUseFilterTab,columns:e.canUseColumnsTab,sort:e.canUseSortTab};return o.filter(e=>t[e])},c=(e,t)=>e===null?null:t.includes(e)?e:t[0]??null,l=()=>{let o=null,l=e.createValueStore({requestedTab:null,layout:null,flashTick:0}),u={current:null},d=null,f=e=>{l.setSnapshot({...l.getSnapshot(),...e})},p=e=>{let t=l.getSnapshot().layout;t===e||t!==null&&e!==null&&t.top===e.top&&t.left===e.left&&t.width===e.width||f({layout:e})},m=e=>n.clampPanelDragPosition({top:e.top,left:e.left,panelWidth:r,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}),h=()=>{if(d){let e=m(d);p({top:e.top,left:e.left,width:r});return}let e=o?.gridRootRef.current??null;if(!e){p(null);return}let t=e.getBoundingClientRect(),n=t.right-r-a,s=t.top+a;n=Math.max(i,n),n=Math.min(n,window.innerWidth-r-i),s=Math.max(i,s),p({top:s,left:n,width:r})},g=()=>o!==null&&c(l.getSnapshot().requestedTab,s(o))!==null,_=e=>{f({requestedTab:null,layout:null}),b(),o!==null&&e&&t.restoreGridFocus(o.gridRootRef)},v=()=>_(!0),y=t.createPopoverWindowBindings({onResize:h,onScroll:h,isInside:e=>u.current?.contains(e)===!0||o?.alliedRef?.current?.contains(e)===!0,onOutsidePointerDown:e=>_(o!==null&&t.isInsideGridRoot(o.gridRootRef,e)),getGridRoot:()=>o?.gridRootRef.current??null,onGridHidden:()=>_(!1),onKeyDown:e=>{if(e.key===`Escape`){if(o?.suppressEscape){o.onSuppressedEscape?.();return}e.preventDefault(),v()}}}),b=()=>{let e=g();e&&!y.isAttached()?(h(),y.attach()):!e&&y.isAttached()&&y.detach()};return{update:e=>{o=e,b()},subscribe:l.subscribe,getSnapshot:l.getSnapshot,panelRef:u,open:e=>{if(o===null||!s(o).includes(e))return;let n=l.getSnapshot();t.blurForPopover(o.gridRootRef.current),f({requestedTab:e,flashTick:n.requestedTab===null?n.flashTick:n.flashTick+1}),b()},close:v,move:(e,t)=>{let n=m({top:e,left:t});d=n,f({layout:{top:n.top,left:n.left,width:r}})},dispose:()=>{y.detach()}}};exports.createToolPanelController=l,exports.resolveActiveToolPanelTab=c,exports.resolveAvailableToolPanelTabs=s;
@@ -63,6 +63,8 @@ var o = 360, s = 8, c = 12, l = [
63
63
  onScroll: v,
64
64
  isInside: (e) => p.current?.contains(e) === !0 || l?.alliedRef?.current?.contains(e) === !0,
65
65
  onOutsidePointerDown: (e) => b(l !== null && r(l.gridRootRef, e)),
66
+ getGridRoot: () => l?.gridRootRef.current ?? null,
67
+ onGridHidden: () => b(!1),
66
68
  onKeyDown: (e) => {
67
69
  if (e.key === "Escape") {
68
70
  if (l?.suppressEscape) {
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../logic/tooltipGeometry.cjs");var n=`data-ssg-tooltip`,r=`data-ssg-tooltip-overflow`,i=`[${n}], [${r}]`,a=350,o=800,s=0,c=null,l=null,u=0,d=null,f,p;function m(t){p=e.applySlotToElement(t,f,p)}function h(){if(c!==null)return c;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),p=void 0,m(e),document.body.appendChild(e),c=e,e}function g(){l!==null&&(window.clearTimeout(l),l=null)}var _=null;function v(){_!==null&&(cancelAnimationFrame(_),_=null)}function y(){if(v(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(_=null,d!==null){if(!d.isConnected){b();return}_=requestAnimationFrame(e)}};_=requestAnimationFrame(e)}function b(){g(),v(),d!==null&&(u=Date.now()+o),d=null,c!==null&&c.classList.remove(`ssg-tooltip--visible`)}function x(e){if(!e.isConnected)return;let i=e.getAttribute(n),a=e.getAttribute(r),o=i!==null&&i!==``?i:a!==null&&a!==``?a:(e.textContent??``).trim();if(o===``)return;let s=h();s.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),s.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),s.textContent=o,s.style.left=`0px`,s.style.top=`0px`;let c=t.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:s.offsetWidth,tipHeight:s.offsetHeight,viewportWidth:window.innerWidth});s.style.left=`${c.left}px`,s.style.top=`${c.top}px`,s.classList.add(`ssg-tooltip--visible`),d=e,y()}function S(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let r=t.closest(i);if(r===null||r===d||!r.hasAttribute(n)&&r.scrollWidth<=r.clientWidth+1)return;let o=d!==null;b(),o||Date.now()<u?x(r):l=window.setTimeout(()=>{l=null,x(r)},a)}function C(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(i);if(n===null)return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||b()}function w(){b()}function T(e){e.key===`Escape`&&b()}function E(){window.addEventListener(`pointerover`,S,!0),window.addEventListener(`pointerout`,C,!0),window.addEventListener(`focusin`,S,!0),window.addEventListener(`focusout`,C,!0),window.addEventListener(`pointerdown`,w,!0),window.addEventListener(`scroll`,w,!0),window.addEventListener(`keydown`,T,!0)}function D(){window.removeEventListener(`pointerover`,S,!0),window.removeEventListener(`pointerout`,C,!0),window.removeEventListener(`focusin`,S,!0),window.removeEventListener(`focusout`,C,!0),window.removeEventListener(`pointerdown`,w,!0),window.removeEventListener(`scroll`,w,!0),window.removeEventListener(`keydown`,T,!0)}function O(e){s+=1,s===1&&E();let t=!1,n=e=>{f=e,c!==null&&m(c)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--s,s===0&&(D(),g(),v(),d=null,c!==null&&(c.remove(),c=null)))}}}exports.acquireTooltipController=O;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../utils/portalTokens.cjs"),n=require("../logic/tooltipGeometry.cjs");var r=`data-ssg-tooltip`,i=`data-ssg-tooltip-overflow`,a=`[${r}], [${i}]`,o=350,s=800,c=0,l=null,u=null,d=0,f=null,p,m;function h(t){m=e.applySlotToElement(t,p,m)}function g(){if(l!==null)return l;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),m=void 0,h(e),document.body.appendChild(e),l=e,e}function _(){u!==null&&(window.clearTimeout(u),u=null)}var v=null;function y(){v!==null&&(cancelAnimationFrame(v),v=null)}function b(){if(y(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(v=null,f!==null){if(!f.isConnected){x();return}v=requestAnimationFrame(e)}};v=requestAnimationFrame(e)}function x(){_(),y(),f!==null&&(d=Date.now()+s),f=null,l!==null&&l.classList.remove(`ssg-tooltip--visible`)}function S(e){if(!e.isConnected)return;let a=e.getAttribute(r),o=e.getAttribute(i),s=a!==null&&a!==``?a:o!==null&&o!==``?o:(e.textContent??``).trim();if(s===``)return;let c=g();c.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),c.classList.toggle(`ssg-theme-class`,e.closest(`.ssg-theme-class`)!==null),c.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),t.syncPortalTokens(e,c),c.textContent=s,c.style.left=`0px`,c.style.top=`0px`;let l=n.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:c.offsetWidth,tipHeight:c.offsetHeight,viewportWidth:window.innerWidth});c.style.left=`${l.left}px`,c.style.top=`${l.top}px`,c.classList.add(`ssg-tooltip--visible`),f=e,b()}function C(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let n=t.closest(a);if(n===null||n===f||!n.hasAttribute(r)&&n.scrollWidth<=n.clientWidth+1)return;let i=f!==null;x(),i||Date.now()<d?S(n):u=window.setTimeout(()=>{u=null,S(n)},o)}function w(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(a);if(n===null)return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||x()}function T(){x()}function E(e){e.key===`Escape`&&x()}function D(){window.addEventListener(`pointerover`,C,!0),window.addEventListener(`pointerout`,w,!0),window.addEventListener(`focusin`,C,!0),window.addEventListener(`focusout`,w,!0),window.addEventListener(`pointerdown`,T,!0),window.addEventListener(`scroll`,T,!0),window.addEventListener(`keydown`,E,!0)}function O(){window.removeEventListener(`pointerover`,C,!0),window.removeEventListener(`pointerout`,w,!0),window.removeEventListener(`focusin`,C,!0),window.removeEventListener(`focusout`,w,!0),window.removeEventListener(`pointerdown`,T,!0),window.removeEventListener(`scroll`,T,!0),window.removeEventListener(`keydown`,E,!0)}function k(e){c+=1,c===1&&D();let t=!1,n=e=>{p=e,l!==null&&h(l)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--c,c===0&&(O(),_(),y(),f=null,l!==null&&(l.remove(),l=null)))}}}exports.acquireTooltipController=k;
@@ -1,93 +1,94 @@
1
1
  import { applySlotToElement as e } from "../logic/slotDom.js";
2
- import { computeTooltipPlacement as t } from "../logic/tooltipGeometry.js";
2
+ import { syncPortalTokens as t } from "../utils/portalTokens.js";
3
+ import { computeTooltipPlacement as n } from "../logic/tooltipGeometry.js";
3
4
  //#region src/controllers/tooltipController.ts
4
- var n = "data-ssg-tooltip", r = "data-ssg-tooltip-overflow", i = `[${n}], [${r}]`, a = 350, o = 800, s = 0, c = null, l = null, u = 0, d = null, f, p;
5
- function m(t) {
6
- p = e(t, f, p);
7
- }
8
- function h() {
9
- if (c !== null) return c;
10
- let e = document.createElement("div");
11
- return e.className = "ssg-tooltip", e.setAttribute("aria-hidden", "true"), p = void 0, m(e), document.body.appendChild(e), c = e, e;
5
+ var r = "data-ssg-tooltip", i = "data-ssg-tooltip-overflow", a = `[${r}], [${i}]`, o = 350, s = 800, c = 0, l = null, u = null, d = 0, f = null, p, m;
6
+ function h(t) {
7
+ m = e(t, p, m);
12
8
  }
13
9
  function g() {
14
- l !== null && (window.clearTimeout(l), l = null);
10
+ if (l !== null) return l;
11
+ let e = document.createElement("div");
12
+ return e.className = "ssg-tooltip", e.setAttribute("aria-hidden", "true"), m = void 0, h(e), document.body.appendChild(e), l = e, e;
15
13
  }
16
- var _ = null;
17
- function v() {
18
- _ !== null && (cancelAnimationFrame(_), _ = null);
14
+ function _() {
15
+ u !== null && (window.clearTimeout(u), u = null);
19
16
  }
17
+ var v = null;
20
18
  function y() {
21
- if (v(), typeof requestAnimationFrame != "function") return;
19
+ v !== null && (cancelAnimationFrame(v), v = null);
20
+ }
21
+ function b() {
22
+ if (y(), typeof requestAnimationFrame != "function") return;
22
23
  let e = () => {
23
- if (_ = null, d !== null) {
24
- if (!d.isConnected) {
25
- b();
24
+ if (v = null, f !== null) {
25
+ if (!f.isConnected) {
26
+ x();
26
27
  return;
27
28
  }
28
- _ = requestAnimationFrame(e);
29
+ v = requestAnimationFrame(e);
29
30
  }
30
31
  };
31
- _ = requestAnimationFrame(e);
32
+ v = requestAnimationFrame(e);
32
33
  }
33
- function b() {
34
- g(), v(), d !== null && (u = Date.now() + o), d = null, c !== null && c.classList.remove("ssg-tooltip--visible");
34
+ function x() {
35
+ _(), y(), f !== null && (d = Date.now() + s), f = null, l !== null && l.classList.remove("ssg-tooltip--visible");
35
36
  }
36
- function x(e) {
37
+ function S(e) {
37
38
  if (!e.isConnected) return;
38
- let i = e.getAttribute(n), a = e.getAttribute(r), o = i !== null && i !== "" ? i : a !== null && a !== "" ? a : (e.textContent ?? "").trim();
39
- if (o === "") return;
40
- let s = h();
41
- s.classList.toggle("ssg-theme-dark", e.closest(".ssg-theme-dark") !== null), s.classList.toggle("ssg-motion-off", e.closest(".ssg-motion-off") !== null), s.textContent = o, s.style.left = "0px", s.style.top = "0px";
42
- let c = t({
39
+ let a = e.getAttribute(r), o = e.getAttribute(i), s = a !== null && a !== "" ? a : o !== null && o !== "" ? o : (e.textContent ?? "").trim();
40
+ if (s === "") return;
41
+ let c = g();
42
+ c.classList.toggle("ssg-theme-dark", e.closest(".ssg-theme-dark") !== null), c.classList.toggle("ssg-theme-class", e.closest(".ssg-theme-class") !== null), c.classList.toggle("ssg-motion-off", e.closest(".ssg-motion-off") !== null), t(e, c), c.textContent = s, c.style.left = "0px", c.style.top = "0px";
43
+ let l = n({
43
44
  targetRect: e.getBoundingClientRect(),
44
- tipWidth: s.offsetWidth,
45
- tipHeight: s.offsetHeight,
45
+ tipWidth: c.offsetWidth,
46
+ tipHeight: c.offsetHeight,
46
47
  viewportWidth: window.innerWidth
47
48
  });
48
- s.style.left = `${c.left}px`, s.style.top = `${c.top}px`, s.classList.add("ssg-tooltip--visible"), d = e, y();
49
+ c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"), f = e, b();
49
50
  }
50
- function S(e) {
51
+ function C(e) {
51
52
  let t = e.target;
52
53
  if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
53
- let r = t.closest(i);
54
- if (r === null || r === d || !r.hasAttribute(n) && r.scrollWidth <= r.clientWidth + 1) return;
55
- let o = d !== null;
56
- b(), o || Date.now() < u ? x(r) : l = window.setTimeout(() => {
57
- l = null, x(r);
58
- }, a);
54
+ let n = t.closest(a);
55
+ if (n === null || n === f || !n.hasAttribute(r) && n.scrollWidth <= n.clientWidth + 1) return;
56
+ let i = f !== null;
57
+ x(), i || Date.now() < d ? S(n) : u = window.setTimeout(() => {
58
+ u = null, S(n);
59
+ }, o);
59
60
  }
60
- function C(e) {
61
+ function w(e) {
61
62
  let t = e.target;
62
63
  if (!(t instanceof Element)) return;
63
- let n = t.closest(i);
64
+ let n = t.closest(a);
64
65
  if (n === null) return;
65
66
  let r = e.relatedTarget;
66
- r instanceof Node && n.contains(r) || b();
67
- }
68
- function w() {
69
- b();
67
+ r instanceof Node && n.contains(r) || x();
70
68
  }
71
- function T(e) {
72
- e.key === "Escape" && b();
69
+ function T() {
70
+ x();
73
71
  }
74
- function E() {
75
- window.addEventListener("pointerover", S, !0), window.addEventListener("pointerout", C, !0), window.addEventListener("focusin", S, !0), window.addEventListener("focusout", C, !0), window.addEventListener("pointerdown", w, !0), window.addEventListener("scroll", w, !0), window.addEventListener("keydown", T, !0);
72
+ function E(e) {
73
+ e.key === "Escape" && x();
76
74
  }
77
75
  function D() {
78
- window.removeEventListener("pointerover", S, !0), window.removeEventListener("pointerout", C, !0), window.removeEventListener("focusin", S, !0), window.removeEventListener("focusout", C, !0), window.removeEventListener("pointerdown", w, !0), window.removeEventListener("scroll", w, !0), window.removeEventListener("keydown", T, !0);
76
+ window.addEventListener("pointerover", C, !0), window.addEventListener("pointerout", w, !0), window.addEventListener("focusin", C, !0), window.addEventListener("focusout", w, !0), window.addEventListener("pointerdown", T, !0), window.addEventListener("scroll", T, !0), window.addEventListener("keydown", E, !0);
77
+ }
78
+ function O() {
79
+ window.removeEventListener("pointerover", C, !0), window.removeEventListener("pointerout", w, !0), window.removeEventListener("focusin", C, !0), window.removeEventListener("focusout", w, !0), window.removeEventListener("pointerdown", T, !0), window.removeEventListener("scroll", T, !0), window.removeEventListener("keydown", E, !0);
79
80
  }
80
- function O(e) {
81
- s += 1, s === 1 && E();
81
+ function k(e) {
82
+ c += 1, c === 1 && D();
82
83
  let t = !1, n = (e) => {
83
- f = e, c !== null && m(c);
84
+ p = e, l !== null && h(l);
84
85
  };
85
86
  return n(e), {
86
87
  setSlot: n,
87
88
  dispose: () => {
88
- t || (t = !0, --s, s === 0 && (D(), g(), v(), d = null, c !== null && (c.remove(), c = null)));
89
+ t || (t = !0, --c, c === 0 && (O(), _(), y(), f = null, l !== null && (l.remove(), l = null)));
89
90
  }
90
91
  };
91
92
  }
92
93
  //#endregion
93
- export { O as acquireTooltipController };
94
+ export { k as acquireTooltipController };