@operato/utils 10.7.0 → 10.15.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 (31) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/coverage/lcov-report/base.css +224 -0
  3. package/coverage/lcov-report/block-navigation.js +87 -0
  4. package/coverage/lcov-report/favicon.png +0 -0
  5. package/coverage/lcov-report/index.html +131 -0
  6. package/coverage/lcov-report/prettify.css +1 -0
  7. package/coverage/lcov-report/prettify.js +2 -0
  8. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  9. package/coverage/lcov-report/sorter.js +210 -0
  10. package/coverage/lcov.info +429 -0
  11. package/dist/src/has-overflow.js +23 -1
  12. package/dist/src/has-overflow.js.map +1 -1
  13. package/dist/src/list-state.d.ts +47 -0
  14. package/dist/src/list-state.js +50 -0
  15. package/dist/src/list-state.js.map +1 -0
  16. package/dist/src/reactive-controllers/tooltip-reactive-controller.js +16 -3
  17. package/dist/src/reactive-controllers/tooltip-reactive-controller.js.map +1 -1
  18. package/dist/test/has-overflow.test.d.ts +1 -0
  19. package/dist/test/has-overflow.test.js +49 -0
  20. package/dist/test/has-overflow.test.js.map +1 -0
  21. package/dist/test/list-state.test.d.ts +1 -0
  22. package/dist/test/list-state.test.js +53 -0
  23. package/dist/test/list-state.test.js.map +1 -0
  24. package/dist/test/tooltip-reactive-controller.test.d.ts +1 -0
  25. package/dist/test/tooltip-reactive-controller.test.js +78 -0
  26. package/dist/test/tooltip-reactive-controller.test.js.map +1 -0
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +7 -3
  29. package/test/has-overflow.test.ts +61 -0
  30. package/test/list-state.test.ts +62 -0
  31. package/test/tooltip-reactive-controller.test.ts +88 -0
@@ -0,0 +1,210 @@
1
+ /* eslint-disable */
2
+ var addSorting = (function() {
3
+ 'use strict';
4
+ var cols,
5
+ currentSort = {
6
+ index: 0,
7
+ desc: false
8
+ };
9
+
10
+ // returns the summary table element
11
+ function getTable() {
12
+ return document.querySelector('.coverage-summary');
13
+ }
14
+ // returns the thead element of the summary table
15
+ function getTableHeader() {
16
+ return getTable().querySelector('thead tr');
17
+ }
18
+ // returns the tbody element of the summary table
19
+ function getTableBody() {
20
+ return getTable().querySelector('tbody');
21
+ }
22
+ // returns the th element for nth column
23
+ function getNthColumn(n) {
24
+ return getTableHeader().querySelectorAll('th')[n];
25
+ }
26
+
27
+ function onFilterInput() {
28
+ const searchValue = document.getElementById('fileSearch').value;
29
+ const rows = document.getElementsByTagName('tbody')[0].children;
30
+
31
+ // Try to create a RegExp from the searchValue. If it fails (invalid regex),
32
+ // it will be treated as a plain text search
33
+ let searchRegex;
34
+ try {
35
+ searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
36
+ } catch (error) {
37
+ searchRegex = null;
38
+ }
39
+
40
+ for (let i = 0; i < rows.length; i++) {
41
+ const row = rows[i];
42
+ let isMatch = false;
43
+
44
+ if (searchRegex) {
45
+ // If a valid regex was created, use it for matching
46
+ isMatch = searchRegex.test(row.textContent);
47
+ } else {
48
+ // Otherwise, fall back to the original plain text search
49
+ isMatch = row.textContent
50
+ .toLowerCase()
51
+ .includes(searchValue.toLowerCase());
52
+ }
53
+
54
+ row.style.display = isMatch ? '' : 'none';
55
+ }
56
+ }
57
+
58
+ // loads the search box
59
+ function addSearchBox() {
60
+ var template = document.getElementById('filterTemplate');
61
+ var templateClone = template.content.cloneNode(true);
62
+ templateClone.getElementById('fileSearch').oninput = onFilterInput;
63
+ template.parentElement.appendChild(templateClone);
64
+ }
65
+
66
+ // loads all columns
67
+ function loadColumns() {
68
+ var colNodes = getTableHeader().querySelectorAll('th'),
69
+ colNode,
70
+ cols = [],
71
+ col,
72
+ i;
73
+
74
+ for (i = 0; i < colNodes.length; i += 1) {
75
+ colNode = colNodes[i];
76
+ col = {
77
+ key: colNode.getAttribute('data-col'),
78
+ sortable: !colNode.getAttribute('data-nosort'),
79
+ type: colNode.getAttribute('data-type') || 'string'
80
+ };
81
+ cols.push(col);
82
+ if (col.sortable) {
83
+ col.defaultDescSort = col.type === 'number';
84
+ colNode.innerHTML =
85
+ colNode.innerHTML + '<span class="sorter"></span>';
86
+ }
87
+ }
88
+ return cols;
89
+ }
90
+ // attaches a data attribute to every tr element with an object
91
+ // of data values keyed by column name
92
+ function loadRowData(tableRow) {
93
+ var tableCols = tableRow.querySelectorAll('td'),
94
+ colNode,
95
+ col,
96
+ data = {},
97
+ i,
98
+ val;
99
+ for (i = 0; i < tableCols.length; i += 1) {
100
+ colNode = tableCols[i];
101
+ col = cols[i];
102
+ val = colNode.getAttribute('data-value');
103
+ if (col.type === 'number') {
104
+ val = Number(val);
105
+ }
106
+ data[col.key] = val;
107
+ }
108
+ return data;
109
+ }
110
+ // loads all row data
111
+ function loadData() {
112
+ var rows = getTableBody().querySelectorAll('tr'),
113
+ i;
114
+
115
+ for (i = 0; i < rows.length; i += 1) {
116
+ rows[i].data = loadRowData(rows[i]);
117
+ }
118
+ }
119
+ // sorts the table using the data for the ith column
120
+ function sortByIndex(index, desc) {
121
+ var key = cols[index].key,
122
+ sorter = function(a, b) {
123
+ a = a.data[key];
124
+ b = b.data[key];
125
+ return a < b ? -1 : a > b ? 1 : 0;
126
+ },
127
+ finalSorter = sorter,
128
+ tableBody = document.querySelector('.coverage-summary tbody'),
129
+ rowNodes = tableBody.querySelectorAll('tr'),
130
+ rows = [],
131
+ i;
132
+
133
+ if (desc) {
134
+ finalSorter = function(a, b) {
135
+ return -1 * sorter(a, b);
136
+ };
137
+ }
138
+
139
+ for (i = 0; i < rowNodes.length; i += 1) {
140
+ rows.push(rowNodes[i]);
141
+ tableBody.removeChild(rowNodes[i]);
142
+ }
143
+
144
+ rows.sort(finalSorter);
145
+
146
+ for (i = 0; i < rows.length; i += 1) {
147
+ tableBody.appendChild(rows[i]);
148
+ }
149
+ }
150
+ // removes sort indicators for current column being sorted
151
+ function removeSortIndicators() {
152
+ var col = getNthColumn(currentSort.index),
153
+ cls = col.className;
154
+
155
+ cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
156
+ col.className = cls;
157
+ }
158
+ // adds sort indicators for current column being sorted
159
+ function addSortIndicators() {
160
+ getNthColumn(currentSort.index).className += currentSort.desc
161
+ ? ' sorted-desc'
162
+ : ' sorted';
163
+ }
164
+ // adds event listeners for all sorter widgets
165
+ function enableUI() {
166
+ var i,
167
+ el,
168
+ ithSorter = function ithSorter(i) {
169
+ var col = cols[i];
170
+
171
+ return function() {
172
+ var desc = col.defaultDescSort;
173
+
174
+ if (currentSort.index === i) {
175
+ desc = !currentSort.desc;
176
+ }
177
+ sortByIndex(i, desc);
178
+ removeSortIndicators();
179
+ currentSort.index = i;
180
+ currentSort.desc = desc;
181
+ addSortIndicators();
182
+ };
183
+ };
184
+ for (i = 0; i < cols.length; i += 1) {
185
+ if (cols[i].sortable) {
186
+ // add the click event handler on the th so users
187
+ // dont have to click on those tiny arrows
188
+ el = getNthColumn(i).querySelector('.sorter').parentElement;
189
+ if (el.addEventListener) {
190
+ el.addEventListener('click', ithSorter(i));
191
+ } else {
192
+ el.attachEvent('onclick', ithSorter(i));
193
+ }
194
+ }
195
+ }
196
+ }
197
+ // adds sorting functionality to the UI
198
+ return function() {
199
+ if (!getTable()) {
200
+ return;
201
+ }
202
+ cols = loadColumns();
203
+ loadData();
204
+ addSearchBox();
205
+ addSortIndicators();
206
+ enableUI();
207
+ };
208
+ })();
209
+
210
+ window.addEventListener('load', addSorting);
@@ -0,0 +1,429 @@
1
+ TN:
2
+ SF:src/has-overflow.ts
3
+ FN:7,hasOverflow
4
+ FNF:1
5
+ FNH:1
6
+ FNDA:7,hasOverflow
7
+ DA:1,2
8
+ DA:2,2
9
+ DA:3,2
10
+ DA:4,2
11
+ DA:5,2
12
+ DA:6,2
13
+ DA:7,2
14
+ DA:8,7
15
+ DA:9,7
16
+ DA:10,7
17
+ DA:11,7
18
+ DA:12,0
19
+ DA:13,0
20
+ DA:14,7
21
+ DA:15,7
22
+ DA:16,7
23
+ DA:17,7
24
+ DA:18,0
25
+ DA:19,0
26
+ DA:20,7
27
+ DA:21,7
28
+ DA:22,1
29
+ DA:23,1
30
+ DA:24,6
31
+ DA:25,6
32
+ DA:26,6
33
+ DA:27,6
34
+ DA:28,6
35
+ DA:29,6
36
+ DA:30,6
37
+ DA:31,6
38
+ DA:32,6
39
+ DA:33,6
40
+ DA:34,6
41
+ DA:35,6
42
+ DA:36,6
43
+ DA:37,7
44
+ DA:38,1
45
+ DA:39,1
46
+ DA:40,5
47
+ DA:41,5
48
+ DA:42,5
49
+ DA:43,5
50
+ DA:44,5
51
+ DA:45,5
52
+ DA:46,5
53
+ DA:47,5
54
+ LF:47
55
+ LH:43
56
+ BRDA:7,0,0,7
57
+ BRDA:11,1,0,0
58
+ BRDA:15,2,0,6
59
+ BRDA:17,3,0,0
60
+ BRDA:21,4,0,1
61
+ BRDA:24,5,0,6
62
+ BRDA:37,6,0,1
63
+ BRDA:40,7,0,5
64
+ BRF:8
65
+ BRH:6
66
+ end_of_record
67
+ TN:
68
+ SF:src/list-state.ts
69
+ FN:32,listPhase
70
+ FN:40,hasMore
71
+ FN:54,listCountLabel
72
+ FNF:3
73
+ FNH:3
74
+ FNDA:5,listPhase
75
+ FNDA:4,hasMore
76
+ FNDA:4,listCountLabel
77
+ DA:1,1
78
+ DA:2,1
79
+ DA:3,1
80
+ DA:4,1
81
+ DA:5,1
82
+ DA:6,1
83
+ DA:7,1
84
+ DA:8,1
85
+ DA:9,1
86
+ DA:10,1
87
+ DA:11,1
88
+ DA:12,1
89
+ DA:13,1
90
+ DA:14,1
91
+ DA:15,1
92
+ DA:16,1
93
+ DA:17,1
94
+ DA:18,1
95
+ DA:19,1
96
+ DA:20,1
97
+ DA:21,1
98
+ DA:22,1
99
+ DA:23,1
100
+ DA:24,1
101
+ DA:25,1
102
+ DA:26,1
103
+ DA:27,1
104
+ DA:28,1
105
+ DA:29,1
106
+ DA:30,1
107
+ DA:31,1
108
+ DA:32,1
109
+ DA:33,5
110
+ DA:34,5
111
+ DA:35,5
112
+ DA:36,1
113
+ DA:37,1
114
+ DA:38,1
115
+ DA:39,1
116
+ DA:40,1
117
+ DA:41,4
118
+ DA:42,2
119
+ DA:43,2
120
+ DA:44,1
121
+ DA:45,1
122
+ DA:46,1
123
+ DA:47,1
124
+ DA:48,1
125
+ DA:49,1
126
+ DA:50,1
127
+ DA:51,1
128
+ DA:52,1
129
+ DA:53,1
130
+ DA:54,1
131
+ DA:55,4
132
+ DA:56,1
133
+ DA:57,1
134
+ DA:58,4
135
+ DA:59,1
136
+ DA:60,1
137
+ DA:61,4
138
+ DA:62,1
139
+ DA:63,1
140
+ DA:64,1
141
+ DA:65,1
142
+ LF:65
143
+ LH:65
144
+ BRDA:32,0,0,5
145
+ BRDA:33,1,0,1
146
+ BRDA:34,2,0,4
147
+ BRDA:34,3,0,2
148
+ BRDA:34,4,0,1
149
+ BRDA:35,5,0,3
150
+ BRDA:35,6,0,2
151
+ BRDA:35,7,0,2
152
+ BRDA:35,8,0,2
153
+ BRDA:36,9,0,1
154
+ BRDA:40,10,0,4
155
+ BRDA:41,11,0,2
156
+ BRDA:54,12,0,4
157
+ BRDA:55,13,0,1
158
+ BRDA:55,14,0,1
159
+ BRDA:58,15,0,3
160
+ BRDA:58,16,0,1
161
+ BRDA:58,17,0,1
162
+ BRDA:61,18,0,2
163
+ BRDA:61,19,0,1
164
+ BRDA:61,20,0,1
165
+ BRF:21
166
+ BRH:21
167
+ end_of_record
168
+ TN:
169
+ SF:src/reactive-controllers/tooltip-reactive-controller.ts
170
+ FN:32,TooltipReactiveController
171
+ FN:116,TooltipReactiveController.handleMouseOver
172
+ FN:203,TooltipReactiveController.handleMouseOut
173
+ FN:69,ensureContainer
174
+ FN:104,hostConnected
175
+ FN:110,hostDisconnected
176
+ FN:150,cancelPending
177
+ FN:157,show
178
+ FNF:8
179
+ FNH:7
180
+ FNDA:4,TooltipReactiveController
181
+ FNDA:4,TooltipReactiveController.handleMouseOver
182
+ FNDA:0,TooltipReactiveController.handleMouseOut
183
+ FNDA:4,ensureContainer
184
+ FNDA:4,hostConnected
185
+ FNDA:4,hostDisconnected
186
+ FNDA:3,cancelPending
187
+ FNDA:3,show
188
+ DA:1,1
189
+ DA:2,1
190
+ DA:3,1
191
+ DA:4,1
192
+ DA:5,1
193
+ DA:6,1
194
+ DA:7,1
195
+ DA:8,1
196
+ DA:9,1
197
+ DA:10,1
198
+ DA:11,1
199
+ DA:12,1
200
+ DA:13,1
201
+ DA:14,1
202
+ DA:15,1
203
+ DA:16,1
204
+ DA:17,1
205
+ DA:18,1
206
+ DA:19,1
207
+ DA:20,1
208
+ DA:21,1
209
+ DA:22,1
210
+ DA:23,1
211
+ DA:24,1
212
+ DA:25,1
213
+ DA:26,1
214
+ DA:27,1
215
+ DA:28,1
216
+ DA:29,1
217
+ DA:30,1
218
+ DA:31,1
219
+ DA:32,1
220
+ DA:33,4
221
+ DA:34,4
222
+ DA:35,4
223
+ DA:36,4
224
+ DA:37,4
225
+ DA:38,4
226
+ DA:39,4
227
+ DA:40,4
228
+ DA:41,4
229
+ DA:42,4
230
+ DA:43,4
231
+ DA:44,4
232
+ DA:45,4
233
+ DA:46,4
234
+ DA:47,4
235
+ DA:48,4
236
+ DA:49,4
237
+ DA:50,4
238
+ DA:51,4
239
+ DA:52,1
240
+ DA:53,1
241
+ DA:54,1
242
+ DA:55,1
243
+ DA:56,1
244
+ DA:57,1
245
+ DA:58,1
246
+ DA:59,1
247
+ DA:60,1
248
+ DA:61,1
249
+ DA:62,1
250
+ DA:63,1
251
+ DA:64,1
252
+ DA:65,1
253
+ DA:66,1
254
+ DA:67,1
255
+ DA:68,1
256
+ DA:69,1
257
+ DA:70,4
258
+ DA:71,3
259
+ DA:72,3
260
+ DA:73,1
261
+ DA:74,1
262
+ DA:75,1
263
+ DA:76,1
264
+ DA:77,1
265
+ DA:78,1
266
+ DA:79,1
267
+ DA:80,1
268
+ DA:81,1
269
+ DA:82,1
270
+ DA:83,1
271
+ DA:84,1
272
+ DA:85,1
273
+ DA:86,1
274
+ DA:87,1
275
+ DA:88,1
276
+ DA:89,1
277
+ DA:90,1
278
+ DA:91,1
279
+ DA:92,1
280
+ DA:93,1
281
+ DA:94,1
282
+ DA:95,1
283
+ DA:96,1
284
+ DA:97,1
285
+ DA:98,1
286
+ DA:99,1
287
+ DA:100,1
288
+ DA:101,1
289
+ DA:102,1
290
+ DA:103,1
291
+ DA:104,1
292
+ DA:105,4
293
+ DA:106,4
294
+ DA:107,4
295
+ DA:108,4
296
+ DA:109,1
297
+ DA:110,1
298
+ DA:111,4
299
+ DA:112,4
300
+ DA:113,4
301
+ DA:114,4
302
+ DA:115,1
303
+ DA:116,1
304
+ DA:117,4
305
+ DA:118,4
306
+ DA:119,4
307
+ DA:120,4
308
+ DA:121,4
309
+ DA:122,4
310
+ DA:123,4
311
+ DA:124,4
312
+ DA:125,4
313
+ DA:126,4
314
+ DA:127,4
315
+ DA:128,4
316
+ DA:129,4
317
+ DA:130,4
318
+ DA:131,4
319
+ DA:132,4
320
+ DA:133,1
321
+ DA:134,1
322
+ DA:135,3
323
+ DA:136,3
324
+ DA:137,3
325
+ DA:138,3
326
+ DA:139,4
327
+ DA:140,3
328
+ DA:141,3
329
+ DA:142,3
330
+ DA:143,0
331
+ DA:144,0
332
+ DA:145,0
333
+ DA:146,0
334
+ DA:147,0
335
+ DA:148,0
336
+ DA:149,1
337
+ DA:150,1
338
+ DA:151,3
339
+ DA:152,0
340
+ DA:153,0
341
+ DA:154,0
342
+ DA:155,3
343
+ DA:156,1
344
+ DA:157,1
345
+ DA:158,3
346
+ DA:159,3
347
+ DA:160,3
348
+ DA:161,3
349
+ DA:162,3
350
+ DA:163,3
351
+ DA:164,3
352
+ DA:165,3
353
+ DA:166,3
354
+ DA:167,3
355
+ DA:168,3
356
+ DA:169,3
357
+ DA:170,3
358
+ DA:171,3
359
+ DA:172,3
360
+ DA:173,3
361
+ DA:174,3
362
+ DA:175,3
363
+ DA:176,3
364
+ DA:177,3
365
+ DA:178,3
366
+ DA:179,3
367
+ DA:180,3
368
+ DA:181,3
369
+ DA:182,3
370
+ DA:183,3
371
+ DA:184,3
372
+ DA:185,3
373
+ DA:186,3
374
+ DA:187,3
375
+ DA:188,3
376
+ DA:189,0
377
+ DA:190,0
378
+ DA:191,3
379
+ DA:192,3
380
+ DA:193,0
381
+ DA:194,0
382
+ DA:195,3
383
+ DA:196,3
384
+ DA:197,3
385
+ DA:198,3
386
+ DA:199,3
387
+ DA:200,3
388
+ DA:201,3
389
+ DA:202,1
390
+ DA:203,1
391
+ DA:204,0
392
+ DA:205,0
393
+ DA:206,0
394
+ DA:207,0
395
+ DA:208,0
396
+ DA:209,0
397
+ DA:210,0
398
+ DA:211,0
399
+ DA:212,0
400
+ DA:213,1
401
+ LF:213
402
+ LH:191
403
+ BRDA:32,0,0,4
404
+ BRDA:41,1,0,0
405
+ BRDA:46,2,0,0
406
+ BRDA:116,3,0,4
407
+ BRDA:130,4,0,0
408
+ BRDA:132,5,0,3
409
+ BRDA:132,6,0,1
410
+ BRDA:135,7,0,3
411
+ BRDA:139,8,0,1
412
+ BRDA:139,9,0,3
413
+ BRDA:143,10,0,0
414
+ BRDA:69,11,0,4
415
+ BRDA:70,12,0,3
416
+ BRDA:73,13,0,1
417
+ BRDA:104,14,0,4
418
+ BRDA:105,15,0,0
419
+ BRDA:110,16,0,4
420
+ BRDA:111,17,0,0
421
+ BRDA:150,18,0,3
422
+ BRDA:151,19,0,0
423
+ BRDA:157,20,0,3
424
+ BRDA:162,21,0,0
425
+ BRDA:188,22,0,0
426
+ BRDA:192,23,0,0
427
+ BRF:24
428
+ BRH:14
429
+ end_of_record
@@ -14,6 +14,28 @@ export function hasOverflow(el) {
14
14
  if (originalOverflow === 'visible') {
15
15
  el.style.overflow = '';
16
16
  }
17
- return isOverflowing;
17
+ if (isOverflowing) {
18
+ return true;
19
+ }
20
+ /*
21
+ * A flex box reports no overflow even when its text is cut.
22
+ *
23
+ * scrollWidth measures what the box laid out, and flex lays its items out to fit — so a row
24
+ * whose title is ellipsised still answers scrollWidth === clientWidth. Measured on the plant
25
+ * calendar 2026-09-11: rows at client 114 with text 121, 123, 139 and 148 wide, every one
26
+ * visibly cut, every one reported as not overflowing. The tooltip that gates on this never
27
+ * appeared, on any row.
28
+ *
29
+ * Blocks are unaffected — they keep the fast answer above. Only a flex container pays for the
30
+ * second measurement, and only when the first says no.
31
+ */
32
+ if (!computedStyle.display.includes('flex')) {
33
+ return false;
34
+ }
35
+ const range = document.createRange();
36
+ range.selectNodeContents(el);
37
+ const content = range.getBoundingClientRect().width;
38
+ range.detach();
39
+ return content > el.clientWidth + 1;
18
40
  }
19
41
  //# sourceMappingURL=has-overflow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"has-overflow.js","sourceRoot":"","sources":["../../src/has-overflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,EAAe;IACzC,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAA;IAC1C,MAAM,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAA;IAE/C,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC9B,CAAC;IAED,MAAM,aAAa,GAAG,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAA;IAE1F,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAA;IACxB,CAAC;IAED,OAAO,aAAa,CAAA;AACtB,CAAC","sourcesContent":["/**\n * Detects if the content of an HTMLElement overflows its boundaries.\n *\n * @param {HTMLElement} el - The HTMLElement to check for overflow.\n * @returns {boolean} - `true` if overflow is detected, `false` otherwise.\n */\nexport function hasOverflow(el: HTMLElement): boolean {\n const computedStyle = getComputedStyle(el)\n const originalOverflow = computedStyle.overflow\n\n if (originalOverflow === 'visible') {\n el.style.overflow = 'hidden'\n }\n\n const isOverflowing = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight\n\n if (originalOverflow === 'visible') {\n el.style.overflow = ''\n }\n\n return isOverflowing\n}\n"]}
1
+ {"version":3,"file":"has-overflow.js","sourceRoot":"","sources":["../../src/has-overflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,EAAe;IACzC,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAA;IAC1C,MAAM,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAA;IAE/C,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC9B,CAAC;IAED,MAAM,aAAa,GAAG,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAA;IAE1F,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAA;IACxB,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAA;IACpC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAA;IACnD,KAAK,CAAC,MAAM,EAAE,CAAA;IAEd,OAAO,OAAO,GAAG,EAAE,CAAC,WAAW,GAAG,CAAC,CAAA;AACrC,CAAC","sourcesContent":["/**\n * Detects if the content of an HTMLElement overflows its boundaries.\n *\n * @param {HTMLElement} el - The HTMLElement to check for overflow.\n * @returns {boolean} - `true` if overflow is detected, `false` otherwise.\n */\nexport function hasOverflow(el: HTMLElement): boolean {\n const computedStyle = getComputedStyle(el)\n const originalOverflow = computedStyle.overflow\n\n if (originalOverflow === 'visible') {\n el.style.overflow = 'hidden'\n }\n\n const isOverflowing = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight\n\n if (originalOverflow === 'visible') {\n el.style.overflow = ''\n }\n\n if (isOverflowing) {\n return true\n }\n\n /*\n * A flex box reports no overflow even when its text is cut.\n *\n * scrollWidth measures what the box laid out, and flex lays its items out to fit — so a row\n * whose title is ellipsised still answers scrollWidth === clientWidth. Measured on the plant\n * calendar 2026-09-11: rows at client 114 with text 121, 123, 139 and 148 wide, every one\n * visibly cut, every one reported as not overflowing. The tooltip that gates on this never\n * appeared, on any row.\n *\n * Blocks are unaffected — they keep the fast answer above. Only a flex container pays for the\n * second measurement, and only when the first says no.\n */\n if (!computedStyle.display.includes('flex')) {\n return false\n }\n\n const range = document.createRange()\n range.selectNodeContents(el)\n const content = range.getBoundingClientRect().width\n range.detach()\n\n return content > el.clientWidth + 1\n}\n"]}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * What a list has to say about itself - pure, so a screen and a grid can share one rule.
3
+ *
4
+ * Lists used to draw "whatever arrived". But the server cut at `limit` and the client cut again with
5
+ * `slice()`, and neither left a mark on the screen (operato-twin, 2026-07-31: ledger limit 120 + slice
6
+ * 120, entity 360 slice 40). A cut list cannot be told apart from "there is no more": people believe
7
+ * what is missing does not exist. A failed load looked the same as an empty one.
8
+ *
9
+ * So the rule lives here, once: loading, failed, empty, empty-because-narrowed and ready never mix,
10
+ * and a cut list says it was cut.
11
+ *
12
+ * Moved from operato-twin (client/list/list-model.ts), the most capable of the three list-state forks.
13
+ */
14
+ /** A list's size - the input that decides what a screen has to say. */
15
+ export interface ListScale {
16
+ /** Rows drawn now, after narrowing. */
17
+ shown: number;
18
+ /** Rows the client holds, before narrowing. */
19
+ loaded: number;
20
+ /** Everything the server knows of. Undefined when unknown - never replaced by 0 (missing is not zero). */
21
+ total?: number;
22
+ /** The server hit its own cap. Then `loaded` is a lower bound, not the whole. */
23
+ capped?: boolean;
24
+ /** A search or filter is applied - it tells the two kinds of empty apart. */
25
+ filtered?: boolean;
26
+ }
27
+ /** What the screen shows. These do not mix. */
28
+ export type ListPhase = 'loading' | 'error' | 'empty' | 'empty-filtered' | 'ready';
29
+ export declare function listPhase(scale: ListScale, opts?: {
30
+ loading?: boolean;
31
+ error?: unknown;
32
+ }): ListPhase;
33
+ /** Is there more to fetch - when the total is unknown, a capped list says yes (unknown is not "none"). */
34
+ export declare function hasMore(scale: ListScale): boolean;
35
+ /**
36
+ * The count, as an i18n key and its parameters - the sentence is not built here.
37
+ *
38
+ * Four cases, and telling them apart is the point:
39
+ * everything is here, nothing narrowed the count
40
+ * narrowed, part of what is held "shown of loaded"
41
+ * the server has more (total known) "shown of total"
42
+ * the server's cap was hit (total unknown) "first N - narrow to see the rest"
43
+ */
44
+ export declare function listCountLabel(scale: ListScale): {
45
+ key: string;
46
+ params: Record<string, number>;
47
+ };