flexily 0.3.0 → 0.3.1
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/README.md +2 -0
- package/package.json +16 -24
- package/src/classic/layout.ts +2 -2
- package/src/layout-helpers.ts +2 -2
- package/dist/classic/layout.d.ts +0 -57
- package/dist/classic/layout.d.ts.map +0 -1
- package/dist/classic/layout.js +0 -1567
- package/dist/classic/layout.js.map +0 -1
- package/dist/classic/node.d.ts +0 -648
- package/dist/classic/node.d.ts.map +0 -1
- package/dist/classic/node.js +0 -1002
- package/dist/classic/node.js.map +0 -1
- package/dist/constants.d.ts +0 -59
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -71
- package/dist/constants.js.map +0 -1
- package/dist/index-classic.d.ts +0 -30
- package/dist/index-classic.d.ts.map +0 -1
- package/dist/index-classic.js +0 -57
- package/dist/index-classic.js.map +0 -1
- package/dist/index.d.ts +0 -30
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -57
- package/dist/index.js.map +0 -1
- package/dist/layout-flex-lines.d.ts +0 -77
- package/dist/layout-flex-lines.d.ts.map +0 -1
- package/dist/layout-flex-lines.js +0 -317
- package/dist/layout-flex-lines.js.map +0 -1
- package/dist/layout-helpers.d.ts +0 -45
- package/dist/layout-helpers.d.ts.map +0 -1
- package/dist/layout-helpers.js +0 -103
- package/dist/layout-helpers.js.map +0 -1
- package/dist/layout-measure.d.ts +0 -25
- package/dist/layout-measure.d.ts.map +0 -1
- package/dist/layout-measure.js +0 -231
- package/dist/layout-measure.js.map +0 -1
- package/dist/layout-stats.d.ts +0 -19
- package/dist/layout-stats.d.ts.map +0 -1
- package/dist/layout-stats.js +0 -37
- package/dist/layout-stats.js.map +0 -1
- package/dist/layout-traversal.d.ts +0 -28
- package/dist/layout-traversal.d.ts.map +0 -1
- package/dist/layout-traversal.js +0 -65
- package/dist/layout-traversal.js.map +0 -1
- package/dist/layout-zero.d.ts +0 -26
- package/dist/layout-zero.d.ts.map +0 -1
- package/dist/layout-zero.js +0 -1757
- package/dist/layout-zero.js.map +0 -1
- package/dist/logger.d.ts +0 -14
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -61
- package/dist/logger.js.map +0 -1
- package/dist/node-zero.d.ts +0 -702
- package/dist/node-zero.d.ts.map +0 -1
- package/dist/node-zero.js +0 -1268
- package/dist/node-zero.js.map +0 -1
- package/dist/testing.d.ts +0 -69
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -179
- package/dist/testing.js.map +0 -1
- package/dist/trace.d.ts +0 -74
- package/dist/trace.d.ts.map +0 -1
- package/dist/trace.js +0 -191
- package/dist/trace.js.map +0 -1
- package/dist/types.d.ts +0 -170
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -43
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -49
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -222
- package/dist/utils.js.map +0 -1
- package/src/beorn-logger.d.ts +0 -10
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flex Line Breaking and Space Distribution
|
|
3
|
-
*
|
|
4
|
-
* Pre-allocated arrays for zero-allocation flex-wrap layout,
|
|
5
|
-
* plus the line-breaking and flex-distribution algorithms.
|
|
6
|
-
*
|
|
7
|
-
* IMPORTANT: Module-level pre-allocated arrays are NOT reentrant.
|
|
8
|
-
* Layout is single-threaded; concurrent calculateLayout() calls corrupt shared state.
|
|
9
|
-
*/
|
|
10
|
-
import * as C from "./constants.js";
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// Pre-allocated Arrays for Zero-Allocation Layout
|
|
13
|
-
// ============================================================================
|
|
14
|
-
//
|
|
15
|
-
// These module-level typed arrays enable zero-allocation flex-wrap layout.
|
|
16
|
-
// They store per-line metrics that would otherwise require FlexLine[] allocation.
|
|
17
|
-
//
|
|
18
|
-
// Trade-offs:
|
|
19
|
-
// - Pro: No heap allocation during layout passes (eliminates GC pressure)
|
|
20
|
-
// - Pro: Cache-friendly contiguous memory access
|
|
21
|
-
// - Con: Fixed maximum lines (grows dynamically if exceeded, rare allocation)
|
|
22
|
-
// - Con: Not reentrant (single layout calculation at a time)
|
|
23
|
-
//
|
|
24
|
-
// Memory usage: ~768 bytes total (32 lines x 8 bytes x 2 + 32 x 2 bytes)
|
|
25
|
-
/**
|
|
26
|
-
* Maximum number of flex lines supported without dynamic allocation.
|
|
27
|
-
* If a layout exceeds this, arrays grow automatically (rare edge case).
|
|
28
|
-
* 32 lines covers virtually all real-world layouts while using minimal memory.
|
|
29
|
-
*/
|
|
30
|
-
export let MAX_FLEX_LINES = 32;
|
|
31
|
-
/**
|
|
32
|
-
* Pre-allocated array for line cross sizes (reused across layout passes).
|
|
33
|
-
* Stores the computed cross-axis size of each flex line.
|
|
34
|
-
*/
|
|
35
|
-
export let _lineCrossSizes = new Float64Array(MAX_FLEX_LINES);
|
|
36
|
-
/**
|
|
37
|
-
* Pre-allocated array for line cross offsets (reused across layout passes).
|
|
38
|
-
* Stores the cross-axis position offset for each flex line.
|
|
39
|
-
*/
|
|
40
|
-
export let _lineCrossOffsets = new Float64Array(MAX_FLEX_LINES);
|
|
41
|
-
/**
|
|
42
|
-
* Pre-allocated array for line lengths (number of children per line).
|
|
43
|
-
* Uint16 supports up to 65535 children per line (more than sufficient).
|
|
44
|
-
*/
|
|
45
|
-
export let _lineLengths = new Uint16Array(MAX_FLEX_LINES);
|
|
46
|
-
/**
|
|
47
|
-
* Pre-allocated 2D array for children per line.
|
|
48
|
-
* Avoids O(n*m) iteration when processing multi-line flex layouts.
|
|
49
|
-
* Each slot holds array of Node references for that line.
|
|
50
|
-
*/
|
|
51
|
-
export let _lineChildren = Array.from({ length: MAX_FLEX_LINES }, () => []);
|
|
52
|
-
/**
|
|
53
|
-
* Pre-allocated array for per-line justify-content start offsets.
|
|
54
|
-
* Stores the main-axis starting position for each flex line.
|
|
55
|
-
*/
|
|
56
|
-
export let _lineJustifyStarts = new Float64Array(MAX_FLEX_LINES);
|
|
57
|
-
/**
|
|
58
|
-
* Pre-allocated array for per-line item spacing (justify-content gaps).
|
|
59
|
-
* Stores the spacing between items for each flex line.
|
|
60
|
-
*/
|
|
61
|
-
export let _lineItemSpacings = new Float64Array(MAX_FLEX_LINES);
|
|
62
|
-
/**
|
|
63
|
-
* Grow pre-allocated line arrays if needed.
|
|
64
|
-
* Called when a layout has more lines than current capacity.
|
|
65
|
-
* This is rare (>32 lines) and acceptable as a one-time allocation.
|
|
66
|
-
*/
|
|
67
|
-
export function growLineArrays(needed) {
|
|
68
|
-
const newSize = Math.max(needed, MAX_FLEX_LINES * 2);
|
|
69
|
-
MAX_FLEX_LINES = newSize;
|
|
70
|
-
_lineCrossSizes = new Float64Array(newSize);
|
|
71
|
-
_lineCrossOffsets = new Float64Array(newSize);
|
|
72
|
-
_lineLengths = new Uint16Array(newSize);
|
|
73
|
-
_lineJustifyStarts = new Float64Array(newSize);
|
|
74
|
-
_lineItemSpacings = new Float64Array(newSize);
|
|
75
|
-
// Grow _lineChildren array
|
|
76
|
-
while (_lineChildren.length < newSize) {
|
|
77
|
-
_lineChildren.push([]);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Epsilon value for floating point comparisons in flex distribution.
|
|
82
|
-
* Used to determine when remaining space is negligible and iteration should stop.
|
|
83
|
-
*/
|
|
84
|
-
const EPSILON_FLOAT = 0.001;
|
|
85
|
-
/**
|
|
86
|
-
* Break children into flex lines based on available main-axis space.
|
|
87
|
-
* Zero-allocation: Sets child.flex.lineIndex directly, uses pre-allocated _lineStarts/_lineLengths.
|
|
88
|
-
*
|
|
89
|
-
* @param parent - Parent node whose children to wrap
|
|
90
|
-
* @param relativeCount - Number of relative children (those with flex.relativeIndex >= 0)
|
|
91
|
-
* @param mainAxisSize - Available main-axis space (NaN for unconstrained)
|
|
92
|
-
* @param mainGap - Gap between items on main axis
|
|
93
|
-
* @param wrap - Wrap mode (WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE)
|
|
94
|
-
* @returns Number of lines created
|
|
95
|
-
*/
|
|
96
|
-
export function breakIntoLines(parent, relativeCount, mainAxisSize, mainGap, wrap) {
|
|
97
|
-
// No wrapping or unconstrained - all children on one line
|
|
98
|
-
if (wrap === C.WRAP_NO_WRAP || Number.isNaN(mainAxisSize) || relativeCount === 0) {
|
|
99
|
-
// All relative children on line 0, populate _lineChildren for O(n) access
|
|
100
|
-
// Use index-based assignment to avoid push() backing store growth
|
|
101
|
-
const lineArr = _lineChildren[0];
|
|
102
|
-
let idx = 0;
|
|
103
|
-
for (const child of parent.children) {
|
|
104
|
-
if (child.flex.relativeIndex >= 0) {
|
|
105
|
-
child.flex.lineIndex = 0;
|
|
106
|
-
lineArr[idx++] = child;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
lineArr.length = idx; // Trim to actual size
|
|
110
|
-
_lineLengths[0] = relativeCount;
|
|
111
|
-
_lineCrossSizes[0] = 0;
|
|
112
|
-
_lineCrossOffsets[0] = 0;
|
|
113
|
-
return 1;
|
|
114
|
-
}
|
|
115
|
-
let lineIndex = 0;
|
|
116
|
-
let lineMainSize = 0;
|
|
117
|
-
let lineChildCount = 0;
|
|
118
|
-
let lineChildIdx = 0; // Index within current line array
|
|
119
|
-
for (const child of parent.children) {
|
|
120
|
-
if (child.flex.relativeIndex < 0)
|
|
121
|
-
continue;
|
|
122
|
-
const flex = child.flex;
|
|
123
|
-
const childMainSize = flex.baseSize + flex.mainMargin;
|
|
124
|
-
const gapIfNotFirst = lineChildCount > 0 ? mainGap : 0;
|
|
125
|
-
// Check if child fits on current line
|
|
126
|
-
if (lineChildCount > 0 && lineMainSize + gapIfNotFirst + childMainSize > mainAxisSize) {
|
|
127
|
-
// Finalize current line: trim array to actual size
|
|
128
|
-
_lineChildren[lineIndex].length = lineChildIdx;
|
|
129
|
-
_lineLengths[lineIndex] = lineChildCount;
|
|
130
|
-
lineIndex++;
|
|
131
|
-
if (lineIndex >= MAX_FLEX_LINES) {
|
|
132
|
-
// Grow arrays dynamically (rare - only for >32 line layouts)
|
|
133
|
-
growLineArrays(lineIndex + 16);
|
|
134
|
-
}
|
|
135
|
-
lineChildIdx = 0; // Reset index for new line
|
|
136
|
-
lineMainSize = childMainSize;
|
|
137
|
-
lineChildCount = 1;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
lineMainSize += gapIfNotFirst + childMainSize;
|
|
141
|
-
lineChildCount++;
|
|
142
|
-
}
|
|
143
|
-
flex.lineIndex = lineIndex;
|
|
144
|
-
// Use index-based assignment to avoid push() backing store growth
|
|
145
|
-
_lineChildren[lineIndex][lineChildIdx++] = child;
|
|
146
|
-
}
|
|
147
|
-
// Finalize the last line
|
|
148
|
-
if (lineChildCount > 0) {
|
|
149
|
-
_lineChildren[lineIndex].length = lineChildIdx; // Trim to actual size
|
|
150
|
-
_lineLengths[lineIndex] = lineChildCount;
|
|
151
|
-
lineIndex++;
|
|
152
|
-
}
|
|
153
|
-
const numLines = lineIndex;
|
|
154
|
-
// Initialize cross sizes/offsets
|
|
155
|
-
for (let i = 0; i < numLines; i++) {
|
|
156
|
-
_lineCrossSizes[i] = 0;
|
|
157
|
-
_lineCrossOffsets[i] = 0;
|
|
158
|
-
}
|
|
159
|
-
// Handle wrap-reverse by reversing line CONTENTS (not references) to maintain pool stability
|
|
160
|
-
// Swapping array references would corrupt the global _lineChildren pool across layout calls
|
|
161
|
-
if (wrap === C.WRAP_WRAP_REVERSE && numLines > 1) {
|
|
162
|
-
// Swap contents between symmetric line pairs (element-by-element, zero allocation)
|
|
163
|
-
for (let i = 0; i < Math.floor(numLines / 2); i++) {
|
|
164
|
-
const j = numLines - 1 - i;
|
|
165
|
-
const lineI = _lineChildren[i];
|
|
166
|
-
const lineJ = _lineChildren[j];
|
|
167
|
-
const lenI = lineI.length;
|
|
168
|
-
const lenJ = lineJ.length;
|
|
169
|
-
// Swap elements up to max length (JS arrays auto-extend on assignment)
|
|
170
|
-
const maxLen = Math.max(lenI, lenJ);
|
|
171
|
-
for (let k = 0; k < maxLen; k++) {
|
|
172
|
-
const hasI = k < lenI;
|
|
173
|
-
const hasJ = k < lenJ;
|
|
174
|
-
const tmpI = hasI ? lineI[k] : null;
|
|
175
|
-
const tmpJ = hasJ ? lineJ[k] : null;
|
|
176
|
-
if (hasJ)
|
|
177
|
-
lineI[k] = tmpJ;
|
|
178
|
-
if (hasI)
|
|
179
|
-
lineJ[k] = tmpI;
|
|
180
|
-
}
|
|
181
|
-
// Set correct lengths (truncates or maintains as needed)
|
|
182
|
-
lineI.length = lenJ;
|
|
183
|
-
lineJ.length = lenI;
|
|
184
|
-
}
|
|
185
|
-
// Update lineIndex on each child to match new positions
|
|
186
|
-
for (let i = 0; i < numLines; i++) {
|
|
187
|
-
const lc = _lineChildren[i];
|
|
188
|
-
for (let c = 0; c < lc.length; c++) {
|
|
189
|
-
lc[c].flex.lineIndex = i;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return numLines;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Distribute flex space for a single line of children.
|
|
197
|
-
* Implements CSS Flexbox section 9.7: Resolving Flexible Lengths.
|
|
198
|
-
*
|
|
199
|
-
* Takes pre-collected children array to avoid O(n*m) iteration pattern.
|
|
200
|
-
* Previously iterated through ALL parent.children 8 times per line.
|
|
201
|
-
*
|
|
202
|
-
* @param lineChildren - Pre-collected children for this line (from _lineChildren)
|
|
203
|
-
* @param initialFreeSpace - Free space to distribute (positive=grow, negative=shrink)
|
|
204
|
-
*/
|
|
205
|
-
export function distributeFlexSpaceForLine(lineChildren, initialFreeSpace) {
|
|
206
|
-
const isGrowing = initialFreeSpace > 0;
|
|
207
|
-
if (initialFreeSpace === 0)
|
|
208
|
-
return;
|
|
209
|
-
const childCount = lineChildren.length;
|
|
210
|
-
if (childCount === 0)
|
|
211
|
-
return;
|
|
212
|
-
// Single-child fast path: skip iteration, direct assignment
|
|
213
|
-
if (childCount === 1) {
|
|
214
|
-
const flex = lineChildren[0].flex;
|
|
215
|
-
const canFlex = isGrowing ? flex.flexGrow > 0 : flex.flexShrink > 0;
|
|
216
|
-
if (canFlex) {
|
|
217
|
-
// Target = base + all free space, clamped by min/max
|
|
218
|
-
const target = flex.baseSize + initialFreeSpace;
|
|
219
|
-
flex.mainSize = Math.max(flex.minMain, Math.min(flex.maxMain, target));
|
|
220
|
-
}
|
|
221
|
-
// If can't flex, mainSize stays at baseSize (already set)
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
// Calculate container inner size
|
|
225
|
-
let totalBase = 0;
|
|
226
|
-
for (let i = 0; i < childCount; i++) {
|
|
227
|
-
totalBase += lineChildren[i].flex.baseSize;
|
|
228
|
-
}
|
|
229
|
-
const containerInner = initialFreeSpace + totalBase;
|
|
230
|
-
// Initialize: all items start unfrozen
|
|
231
|
-
for (let i = 0; i < childCount; i++) {
|
|
232
|
-
lineChildren[i].flex.frozen = false;
|
|
233
|
-
}
|
|
234
|
-
let freeSpace = initialFreeSpace;
|
|
235
|
-
let iterations = 0;
|
|
236
|
-
const maxIterations = childCount + 1;
|
|
237
|
-
while (iterations++ < maxIterations) {
|
|
238
|
-
let totalFlex = 0;
|
|
239
|
-
for (let i = 0; i < childCount; i++) {
|
|
240
|
-
const flex = lineChildren[i].flex;
|
|
241
|
-
if (flex.frozen)
|
|
242
|
-
continue;
|
|
243
|
-
if (isGrowing) {
|
|
244
|
-
totalFlex += flex.flexGrow;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
totalFlex += flex.flexShrink * flex.baseSize;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (totalFlex === 0)
|
|
251
|
-
break;
|
|
252
|
-
let effectiveFreeSpace = freeSpace;
|
|
253
|
-
if (isGrowing && totalFlex < 1) {
|
|
254
|
-
effectiveFreeSpace = freeSpace * totalFlex;
|
|
255
|
-
}
|
|
256
|
-
let totalViolation = 0;
|
|
257
|
-
for (let i = 0; i < childCount; i++) {
|
|
258
|
-
const flex = lineChildren[i].flex;
|
|
259
|
-
if (flex.frozen)
|
|
260
|
-
continue;
|
|
261
|
-
const flexFactor = isGrowing ? flex.flexGrow : flex.flexShrink * flex.baseSize;
|
|
262
|
-
const ratio = totalFlex > 0 ? flexFactor / totalFlex : 0;
|
|
263
|
-
const target = flex.baseSize + effectiveFreeSpace * ratio;
|
|
264
|
-
const clamped = Math.max(flex.minMain, Math.min(flex.maxMain, target));
|
|
265
|
-
totalViolation += clamped - target;
|
|
266
|
-
flex.mainSize = clamped;
|
|
267
|
-
}
|
|
268
|
-
let anyFrozen = false;
|
|
269
|
-
if (Math.abs(totalViolation) < EPSILON_FLOAT) {
|
|
270
|
-
for (let i = 0; i < childCount; i++) {
|
|
271
|
-
lineChildren[i].flex.frozen = true;
|
|
272
|
-
}
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
else if (totalViolation > 0) {
|
|
276
|
-
for (let i = 0; i < childCount; i++) {
|
|
277
|
-
const flex = lineChildren[i].flex;
|
|
278
|
-
if (flex.frozen)
|
|
279
|
-
continue;
|
|
280
|
-
const target = flex.baseSize +
|
|
281
|
-
((isGrowing ? flex.flexGrow : flex.flexShrink * flex.baseSize) / totalFlex) * effectiveFreeSpace;
|
|
282
|
-
if (flex.mainSize > target + EPSILON_FLOAT) {
|
|
283
|
-
flex.frozen = true;
|
|
284
|
-
anyFrozen = true;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
for (let i = 0; i < childCount; i++) {
|
|
290
|
-
const flex = lineChildren[i].flex;
|
|
291
|
-
if (flex.frozen)
|
|
292
|
-
continue;
|
|
293
|
-
const flexFactor = isGrowing ? flex.flexGrow : flex.flexShrink * flex.baseSize;
|
|
294
|
-
const target = flex.baseSize + (flexFactor / totalFlex) * effectiveFreeSpace;
|
|
295
|
-
if (flex.mainSize < target - EPSILON_FLOAT) {
|
|
296
|
-
flex.frozen = true;
|
|
297
|
-
anyFrozen = true;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (!anyFrozen)
|
|
302
|
-
break;
|
|
303
|
-
let frozenSpace = 0;
|
|
304
|
-
let unfrozenBase = 0;
|
|
305
|
-
for (let i = 0; i < childCount; i++) {
|
|
306
|
-
const flex = lineChildren[i].flex;
|
|
307
|
-
if (flex.frozen) {
|
|
308
|
-
frozenSpace += flex.mainSize;
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
unfrozenBase += flex.baseSize;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
freeSpace = containerInner - frozenSpace - unfrozenBase;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
//# sourceMappingURL=layout-flex-lines.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-flex-lines.js","sourceRoot":"","sources":["../src/layout-flex-lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAGnC,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAC/E,EAAE;AACF,2EAA2E;AAC3E,kFAAkF;AAClF,EAAE;AACF,cAAc;AACd,0EAA0E;AAC1E,iDAAiD;AACjD,8EAA8E;AAC9E,6DAA6D;AAC7D,EAAE;AACF,yEAAyE;AAEzE;;;;GAIG;AACH,MAAM,CAAC,IAAI,cAAc,GAAG,EAAE,CAAA;AAE9B;;;GAGG;AACH,MAAM,CAAC,IAAI,eAAe,GAAG,IAAI,YAAY,CAAC,cAAc,CAAC,CAAA;AAE7D;;;GAGG;AACH,MAAM,CAAC,IAAI,iBAAiB,GAAG,IAAI,YAAY,CAAC,cAAc,CAAC,CAAA;AAE/D;;;GAGG;AACH,MAAM,CAAC,IAAI,YAAY,GAAG,IAAI,WAAW,CAAC,cAAc,CAAC,CAAA;AAEzD;;;;GA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CAAC;YACpC,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAE,CAAC,IAAI,CAAA;YAClC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAA;YAC9B,CAAC;iBAAM,CAAC;gBACN,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAA;YAC/B,CAAC;QACH,CAAC;QACD,SAAS,GAAG,cAAc,GAAG,WAAW,GAAG,YAAY,CAAA;IACzD,CAAC;AACH,CAAC"}
|
package/dist/layout-helpers.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Layout Helper Functions
|
|
3
|
-
*
|
|
4
|
-
* Edge resolution helpers for margins, padding, borders.
|
|
5
|
-
* These are pure functions with no state — safe to extract.
|
|
6
|
-
*/
|
|
7
|
-
import type { Value } from "./types.js";
|
|
8
|
-
export { EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM } from "./constants.js";
|
|
9
|
-
/**
|
|
10
|
-
* Check if flex direction is row-oriented (horizontal main axis).
|
|
11
|
-
*/
|
|
12
|
-
export declare function isRowDirection(flexDirection: number): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Check if flex direction is reversed.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isReverseDirection(flexDirection: number): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Resolve logical (START/END) margins/padding to physical values.
|
|
19
|
-
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis:
|
|
20
|
-
* - LTR: START->left, END->right
|
|
21
|
-
* - RTL: START->right, END->left
|
|
22
|
-
*
|
|
23
|
-
* Physical edges (LEFT/RIGHT/TOP/BOTTOM) are used directly.
|
|
24
|
-
* When both physical and logical are set, logical takes precedence.
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolveEdgeValue(arr: [Value, Value, Value, Value, Value, Value], physicalIndex: number, // 0=left, 1=top, 2=right, 3=bottom
|
|
27
|
-
flexDirection: number, availableSize: number, direction?: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* Check if a logical edge margin is set to auto.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isEdgeAuto(arr: [Value, Value, Value, Value, Value, Value], physicalIndex: number, flexDirection: number, direction?: number): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Resolve logical (START/END) border widths to physical values.
|
|
34
|
-
* Border values are plain numbers (always points), so resolution is simpler
|
|
35
|
-
* than for margin/padding. Uses NaN as the "not set" sentinel for logical slots.
|
|
36
|
-
* When both physical and logical are set, logical takes precedence.
|
|
37
|
-
*
|
|
38
|
-
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis,
|
|
39
|
-
* regardless of flex direction. Direction (LTR/RTL) determines the mapping:
|
|
40
|
-
* - LTR: START->left, END->right
|
|
41
|
-
* - RTL: START->right, END->left
|
|
42
|
-
*/
|
|
43
|
-
export declare function resolveEdgeBorderValue(arr: [number, number, number, number, number, number], physicalIndex: number, // 0=left, 1=top, 2=right, 3=bottom
|
|
44
|
-
_flexDirection: number, direction?: number): number;
|
|
45
|
-
//# sourceMappingURL=layout-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-helpers.d.ts","sourceRoot":"","sources":["../src/layout-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAM7E;;GAEG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEjE;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAC/C,aAAa,EAAE,MAAM,EAAE,mCAAmC;AAC1D,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,GAAE,MAAwB,GAClC,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAC/C,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,GAAE,MAAwB,GAClC,OAAO,CAUT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACrD,aAAa,EAAE,MAAM,EAAE,mCAAmC;AAC1D,cAAc,EAAE,MAAM,EACtB,SAAS,GAAE,MAAwB,GAClC,MAAM,CAaR"}
|
package/dist/layout-helpers.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Layout Helper Functions
|
|
3
|
-
*
|
|
4
|
-
* Edge resolution helpers for margins, padding, borders.
|
|
5
|
-
* These are pure functions with no state — safe to extract.
|
|
6
|
-
*/
|
|
7
|
-
import * as C from "./constants.js";
|
|
8
|
-
import { resolveValue } from "./utils.js";
|
|
9
|
-
// Re-export edge constants (canonical definitions in constants.ts)
|
|
10
|
-
export { EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM } from "./constants.js";
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// Helper Functions
|
|
13
|
-
// ============================================================================
|
|
14
|
-
/**
|
|
15
|
-
* Check if flex direction is row-oriented (horizontal main axis).
|
|
16
|
-
*/
|
|
17
|
-
export function isRowDirection(flexDirection) {
|
|
18
|
-
return flexDirection === C.FLEX_DIRECTION_ROW || flexDirection === C.FLEX_DIRECTION_ROW_REVERSE;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Check if flex direction is reversed.
|
|
22
|
-
*/
|
|
23
|
-
export function isReverseDirection(flexDirection) {
|
|
24
|
-
return flexDirection === C.FLEX_DIRECTION_ROW_REVERSE || flexDirection === C.FLEX_DIRECTION_COLUMN_REVERSE;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get the logical edge value (START/END) for a given physical index.
|
|
28
|
-
* Returns undefined if no logical value applies to this physical edge.
|
|
29
|
-
*
|
|
30
|
-
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis,
|
|
31
|
-
* regardless of flex direction. Direction (LTR/RTL) determines the mapping:
|
|
32
|
-
* - LTR: START->left, END->right
|
|
33
|
-
* - RTL: START->right, END->left
|
|
34
|
-
*/
|
|
35
|
-
function getLogicalEdgeValue(arr, physicalIndex, _flexDirection, direction = C.DIRECTION_LTR) {
|
|
36
|
-
const isRTL = direction === C.DIRECTION_RTL;
|
|
37
|
-
// START/END always map to left/right (inline direction)
|
|
38
|
-
if (physicalIndex === 0) {
|
|
39
|
-
return isRTL ? arr[5] : arr[4]; // Left: START (LTR) or END (RTL)
|
|
40
|
-
}
|
|
41
|
-
else if (physicalIndex === 2) {
|
|
42
|
-
return isRTL ? arr[4] : arr[5]; // Right: END (LTR) or START (RTL)
|
|
43
|
-
}
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Resolve logical (START/END) margins/padding to physical values.
|
|
48
|
-
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis:
|
|
49
|
-
* - LTR: START->left, END->right
|
|
50
|
-
* - RTL: START->right, END->left
|
|
51
|
-
*
|
|
52
|
-
* Physical edges (LEFT/RIGHT/TOP/BOTTOM) are used directly.
|
|
53
|
-
* When both physical and logical are set, logical takes precedence.
|
|
54
|
-
*/
|
|
55
|
-
export function resolveEdgeValue(arr, physicalIndex, // 0=left, 1=top, 2=right, 3=bottom
|
|
56
|
-
flexDirection, availableSize, direction = C.DIRECTION_LTR) {
|
|
57
|
-
const logicalValue = getLogicalEdgeValue(arr, physicalIndex, flexDirection, direction);
|
|
58
|
-
// Logical takes precedence if defined
|
|
59
|
-
if (logicalValue && logicalValue.unit !== C.UNIT_UNDEFINED) {
|
|
60
|
-
return resolveValue(logicalValue, availableSize);
|
|
61
|
-
}
|
|
62
|
-
// Fall back to physical
|
|
63
|
-
return resolveValue(arr[physicalIndex], availableSize);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Check if a logical edge margin is set to auto.
|
|
67
|
-
*/
|
|
68
|
-
export function isEdgeAuto(arr, physicalIndex, flexDirection, direction = C.DIRECTION_LTR) {
|
|
69
|
-
const logicalValue = getLogicalEdgeValue(arr, physicalIndex, flexDirection, direction);
|
|
70
|
-
// Check logical first
|
|
71
|
-
if (logicalValue && logicalValue.unit !== C.UNIT_UNDEFINED) {
|
|
72
|
-
return logicalValue.unit === C.UNIT_AUTO;
|
|
73
|
-
}
|
|
74
|
-
// Fall back to physical
|
|
75
|
-
return arr[physicalIndex].unit === C.UNIT_AUTO;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Resolve logical (START/END) border widths to physical values.
|
|
79
|
-
* Border values are plain numbers (always points), so resolution is simpler
|
|
80
|
-
* than for margin/padding. Uses NaN as the "not set" sentinel for logical slots.
|
|
81
|
-
* When both physical and logical are set, logical takes precedence.
|
|
82
|
-
*
|
|
83
|
-
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis,
|
|
84
|
-
* regardless of flex direction. Direction (LTR/RTL) determines the mapping:
|
|
85
|
-
* - LTR: START->left, END->right
|
|
86
|
-
* - RTL: START->right, END->left
|
|
87
|
-
*/
|
|
88
|
-
export function resolveEdgeBorderValue(arr, physicalIndex, // 0=left, 1=top, 2=right, 3=bottom
|
|
89
|
-
_flexDirection, direction = C.DIRECTION_LTR) {
|
|
90
|
-
const isRTL = direction === C.DIRECTION_RTL;
|
|
91
|
-
// START/END always map to left/right (inline direction)
|
|
92
|
-
let logicalSlot;
|
|
93
|
-
if (physicalIndex === 0)
|
|
94
|
-
logicalSlot = isRTL ? 5 : 4;
|
|
95
|
-
else if (physicalIndex === 2)
|
|
96
|
-
logicalSlot = isRTL ? 4 : 5;
|
|
97
|
-
// Logical takes precedence if set (NaN = not set)
|
|
98
|
-
if (logicalSlot !== undefined && !Number.isNaN(arr[logicalSlot])) {
|
|
99
|
-
return arr[logicalSlot];
|
|
100
|
-
}
|
|
101
|
-
return arr[physicalIndex];
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=layout-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-helpers.js","sourceRoot":"","sources":["../src/layout-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,mEAAmE;AACnE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE7E,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,aAAqB;IAClD,OAAO,aAAa,KAAK,CAAC,CAAC,kBAAkB,IAAI,aAAa,KAAK,CAAC,CAAC,0BAA0B,CAAA;AACjG,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,aAAqB;IACtD,OAAO,aAAa,KAAK,CAAC,CAAC,0BAA0B,IAAI,aAAa,KAAK,CAAC,CAAC,6BAA6B,CAAA;AAC5G,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,mBAAmB,CAC1B,GAA+C,EAC/C,aAAqB,EACrB,cAAsB,EACtB,YAAoB,CAAC,CAAC,aAAa;IAEnC,MAAM,KAAK,GAAG,SAAS,K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3D,OAAO,YAAY,CAAC,IAAI,KAAK,CAAC,CAAC,SAAS,CAAA;IAC1C,CAAC;IAED,wBAAwB;IACxB,OAAO,GAAG,CAAC,aAAa,CAAE,CAAC,IAAI,KAAK,CAAC,CAAC,SAAS,CAAA;AACjD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CACpC,GAAqD,EACrD,aAAqB,EAAE,mCAAmC;AAC1D,cAAsB,EACtB,YAAoB,CAAC,CAAC,aAAa;IAEnC,MAAM,KAAK,GAAG,SAAS,KAAK,CAAC,CAAC,aAAa,CAAA;IAE3C,wDAAwD;IACxD,IAAI,WAA+B,CAAA;IACnC,IAAI,aAAa,KAAK,CAAC;QAAE,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;SAC/C,IAAI,aAAa,KAAK,CAAC;QAAE,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEzD,kDAAkD;IAClD,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,GAAG,CAAC,WAAW,CAAC,CAAA;IACzB,CAAC;IACD,OAAO,GAAG,CAAC,aAAa,CAAC,CAAA;AAC3B,CAAC"}
|
package/dist/layout-measure.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Node Measurement (Intrinsic Sizing)
|
|
3
|
-
*
|
|
4
|
-
* measureNode() computes a node's width and height without calculating positions.
|
|
5
|
-
* It's a lightweight alternative to layoutNode() used during Phase 5 for
|
|
6
|
-
* intrinsic sizing of auto-sized container children.
|
|
7
|
-
*
|
|
8
|
-
* IMPORTANT: measureNode() overwrites layout.width/layout.height as a side effect.
|
|
9
|
-
* Callers MUST save/restore these fields around calls to avoid corrupting
|
|
10
|
-
* the fingerprint cache (see "Bug 1: measureNode corruption" in CLAUDE.md).
|
|
11
|
-
*/
|
|
12
|
-
import type { Node } from "./node-zero.js";
|
|
13
|
-
/**
|
|
14
|
-
* Measure a node to get its intrinsic size without computing positions.
|
|
15
|
-
* This is a lightweight alternative to layoutNode for sizing-only passes.
|
|
16
|
-
*
|
|
17
|
-
* Sets layout.width and layout.height but NOT layout.left/top.
|
|
18
|
-
*
|
|
19
|
-
* @param node - The node to measure
|
|
20
|
-
* @param availableWidth - Available width (NaN for unconstrained)
|
|
21
|
-
* @param availableHeight - Available height (NaN for unconstrained)
|
|
22
|
-
* @param direction - Layout direction (LTR or RTL)
|
|
23
|
-
*/
|
|
24
|
-
export declare function measureNode(node: Node, availableWidth: number, availableHeight: number, direction?: number): void;
|
|
25
|
-
//# sourceMappingURL=layout-measure.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-measure.d.ts","sourceRoot":"","sources":["../src/layout-measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAK1C;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,SAAS,GAAE,MAAwB,GAClC,IAAI,CAgON"}
|