react-x11 2.47.4 → 2.47.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/nodes/window/floors.js +26 -1
- package/src/nodes/window/spine.js +21 -3
package/package.json
CHANGED
|
@@ -333,7 +333,8 @@ export function dirtyOutside(node, boundaries, paths) {
|
|
|
333
333
|
* Undefined where it cannot be summed: a child with no extent on hand, a
|
|
334
334
|
* negative margin (the boxes would overlap, and the last would not have to
|
|
335
335
|
* be the lowest), or nothing in flow at all — a leaf's answer, which is
|
|
336
|
-
* `contentSpan`'s to give.
|
|
336
|
+
* `contentSpan`'s to give. All but the first are the column's own, and a
|
|
337
|
+
* spine never sums a column that has them (`columnSums`).
|
|
337
338
|
*/
|
|
338
339
|
export function columnHeightSpan(node) {
|
|
339
340
|
const yoga = node.yoga;
|
|
@@ -363,6 +364,30 @@ export function columnHeightSpan(node) {
|
|
|
363
364
|
);
|
|
364
365
|
}
|
|
365
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Whether `columnHeightSpan` has an answer for this column once its children
|
|
369
|
+
* carry extents: everything else it asks — something in flow, margins down
|
|
370
|
+
* that are lengths and pull no box over the one before it, a gap that is a
|
|
371
|
+
* length — asked ahead of the measurement, from the same readings.
|
|
372
|
+
*
|
|
373
|
+
* A spine asks it before it sums a column (`isSummableColumn`), because once
|
|
374
|
+
* the measurement is under way a sum with no answer has nowhere to go: it is
|
|
375
|
+
* written as the column's extent, an extent of none writes the style's own
|
|
376
|
+
* minimum, and the column — and every column summed above it — lost its
|
|
377
|
+
* floor to a label that changed beside a block with `marginTop: -4`.
|
|
378
|
+
*/
|
|
379
|
+
export function columnSums(node) {
|
|
380
|
+
if (columnGap(node) === undefined) return false;
|
|
381
|
+
let count = 0;
|
|
382
|
+
for (const child of node.children) {
|
|
383
|
+
if (!inFlow(child)) continue;
|
|
384
|
+
const { top, bottom } = marginsDown(child);
|
|
385
|
+
if (!(top >= 0 && bottom >= 0)) return false;
|
|
386
|
+
count += 1;
|
|
387
|
+
}
|
|
388
|
+
return count !== 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
366
391
|
/**
|
|
367
392
|
* `marginDown` for both edges of a box, kept on the box with the style object
|
|
368
393
|
* it was read under. A margin reaches yoga only from the style
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
// length — is not a spine, and the tree is measured whole.
|
|
37
37
|
|
|
38
38
|
import {
|
|
39
|
+
columnSums,
|
|
39
40
|
declaresOwnMinimum,
|
|
40
41
|
inFlow,
|
|
41
42
|
mainAxisOf,
|
|
@@ -74,7 +75,9 @@ const PADDINGS = [
|
|
|
74
75
|
* main axis without wrapping, and with a height that is its content's —
|
|
75
76
|
* nothing named on the height axis (`declaresOwnMinimum`), so neither a
|
|
76
77
|
* size, a floor, a ceiling nor a clip stands between its children and its
|
|
77
|
-
* extent.
|
|
78
|
+
* extent. And one the sum has an answer for (`columnSums`): a column with a
|
|
79
|
+
* block pulled up over the one before it is measured, as a root, rather
|
|
80
|
+
* than summed into no extent and no floor.
|
|
78
81
|
*/
|
|
79
82
|
export function isSummableColumn(node) {
|
|
80
83
|
const style = node.style;
|
|
@@ -86,7 +89,8 @@ export function isSummableColumn(node) {
|
|
|
86
89
|
mainAxisOf(node) === 'height' &&
|
|
87
90
|
style.flexDirection !== 'column-reverse' &&
|
|
88
91
|
(style.flexWrap == null || style.flexWrap === 'nowrap') &&
|
|
89
|
-
!declaresOwnMinimum(node, 'height')
|
|
92
|
+
!declaresOwnMinimum(node, 'height') &&
|
|
93
|
+
columnSums(node)
|
|
90
94
|
);
|
|
91
95
|
}
|
|
92
96
|
|
|
@@ -129,6 +133,17 @@ export function spineScope(root, sources, listOnly) {
|
|
|
129
133
|
const spine = new Set();
|
|
130
134
|
const stops = new Set();
|
|
131
135
|
const offered = new OfferedWidths(root);
|
|
136
|
+
// asked once a column: a dozen rows that arrive in one column of a
|
|
137
|
+
// thousand ask it of that column a dozen times (`columnSums`)
|
|
138
|
+
const summable = new Map();
|
|
139
|
+
const sums = (column) => {
|
|
140
|
+
let answer = summable.get(column);
|
|
141
|
+
if (answer === undefined) {
|
|
142
|
+
answer = isSummableColumn(column);
|
|
143
|
+
summable.set(column, answer);
|
|
144
|
+
}
|
|
145
|
+
return answer;
|
|
146
|
+
};
|
|
132
147
|
for (const source of sources) {
|
|
133
148
|
const list = listOnly(source);
|
|
134
149
|
// the way up to where the change stops mattering
|
|
@@ -148,7 +163,7 @@ export function spineScope(root, sources, listOnly) {
|
|
|
148
163
|
let top = -1;
|
|
149
164
|
for (let i = path.length - 1; i >= 0; i--) {
|
|
150
165
|
const summed = i > 0 || list;
|
|
151
|
-
if (!summed || !
|
|
166
|
+
if (!summed || !sums(path[i])) {
|
|
152
167
|
top = i;
|
|
153
168
|
break;
|
|
154
169
|
}
|
|
@@ -379,6 +394,9 @@ function rootWidths(node, offered, stop) {
|
|
|
379
394
|
if (!stretched(node)) return null;
|
|
380
395
|
if (MARGINS.some((key) => typeof style[key] === 'string')) return null;
|
|
381
396
|
if (PADDINGS.some((key) => typeof style[key] === 'string')) return null;
|
|
397
|
+
// …nor a gap that is a share of something: laid out alone, it is a share
|
|
398
|
+
// of something else
|
|
399
|
+
if (typeof (style.rowGap ?? style.gap) === 'string') return null;
|
|
382
400
|
return offered.in(parent, stop);
|
|
383
401
|
}
|
|
384
402
|
|