flexily 0.3.0 → 0.3.2

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 (73) hide show
  1. package/README.md +2 -0
  2. package/package.json +14 -22
  3. package/src/classic/layout.ts +2 -2
  4. package/src/layout-helpers.ts +2 -2
  5. package/dist/classic/layout.d.ts +0 -57
  6. package/dist/classic/layout.d.ts.map +0 -1
  7. package/dist/classic/layout.js +0 -1567
  8. package/dist/classic/layout.js.map +0 -1
  9. package/dist/classic/node.d.ts +0 -648
  10. package/dist/classic/node.d.ts.map +0 -1
  11. package/dist/classic/node.js +0 -1002
  12. package/dist/classic/node.js.map +0 -1
  13. package/dist/constants.d.ts +0 -59
  14. package/dist/constants.d.ts.map +0 -1
  15. package/dist/constants.js +0 -71
  16. package/dist/constants.js.map +0 -1
  17. package/dist/index-classic.d.ts +0 -30
  18. package/dist/index-classic.d.ts.map +0 -1
  19. package/dist/index-classic.js +0 -57
  20. package/dist/index-classic.js.map +0 -1
  21. package/dist/index.d.ts +0 -30
  22. package/dist/index.d.ts.map +0 -1
  23. package/dist/index.js +0 -57
  24. package/dist/index.js.map +0 -1
  25. package/dist/layout-flex-lines.d.ts +0 -77
  26. package/dist/layout-flex-lines.d.ts.map +0 -1
  27. package/dist/layout-flex-lines.js +0 -317
  28. package/dist/layout-flex-lines.js.map +0 -1
  29. package/dist/layout-helpers.d.ts +0 -45
  30. package/dist/layout-helpers.d.ts.map +0 -1
  31. package/dist/layout-helpers.js +0 -103
  32. package/dist/layout-helpers.js.map +0 -1
  33. package/dist/layout-measure.d.ts +0 -25
  34. package/dist/layout-measure.d.ts.map +0 -1
  35. package/dist/layout-measure.js +0 -231
  36. package/dist/layout-measure.js.map +0 -1
  37. package/dist/layout-stats.d.ts +0 -19
  38. package/dist/layout-stats.d.ts.map +0 -1
  39. package/dist/layout-stats.js +0 -37
  40. package/dist/layout-stats.js.map +0 -1
  41. package/dist/layout-traversal.d.ts +0 -28
  42. package/dist/layout-traversal.d.ts.map +0 -1
  43. package/dist/layout-traversal.js +0 -65
  44. package/dist/layout-traversal.js.map +0 -1
  45. package/dist/layout-zero.d.ts +0 -26
  46. package/dist/layout-zero.d.ts.map +0 -1
  47. package/dist/layout-zero.js +0 -1757
  48. package/dist/layout-zero.js.map +0 -1
  49. package/dist/logger.d.ts +0 -14
  50. package/dist/logger.d.ts.map +0 -1
  51. package/dist/logger.js +0 -61
  52. package/dist/logger.js.map +0 -1
  53. package/dist/node-zero.d.ts +0 -702
  54. package/dist/node-zero.d.ts.map +0 -1
  55. package/dist/node-zero.js +0 -1268
  56. package/dist/node-zero.js.map +0 -1
  57. package/dist/testing.d.ts +0 -69
  58. package/dist/testing.d.ts.map +0 -1
  59. package/dist/testing.js +0 -179
  60. package/dist/testing.js.map +0 -1
  61. package/dist/trace.d.ts +0 -74
  62. package/dist/trace.d.ts.map +0 -1
  63. package/dist/trace.js +0 -191
  64. package/dist/trace.js.map +0 -1
  65. package/dist/types.d.ts +0 -170
  66. package/dist/types.d.ts.map +0 -1
  67. package/dist/types.js +0 -43
  68. package/dist/types.js.map +0 -1
  69. package/dist/utils.d.ts +0 -49
  70. package/dist/utils.d.ts.map +0 -1
  71. package/dist/utils.js +0 -222
  72. package/dist/utils.js.map +0 -1
  73. package/src/beorn-logger.d.ts +0 -10
@@ -1,231 +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 * as C from "./constants.js";
13
- import { resolveValue, applyMinMax } from "./utils.js";
14
- import { resolveEdgeValue, resolveEdgeBorderValue, isRowDirection } from "./layout-helpers.js";
15
- import { incMeasureNodeCalls, incLayoutCacheHits } from "./layout-stats.js";
16
- /**
17
- * Measure a node to get its intrinsic size without computing positions.
18
- * This is a lightweight alternative to layoutNode for sizing-only passes.
19
- *
20
- * Sets layout.width and layout.height but NOT layout.left/top.
21
- *
22
- * @param node - The node to measure
23
- * @param availableWidth - Available width (NaN for unconstrained)
24
- * @param availableHeight - Available height (NaN for unconstrained)
25
- * @param direction - Layout direction (LTR or RTL)
26
- */
27
- export function measureNode(node, availableWidth, availableHeight, direction = C.DIRECTION_LTR) {
28
- incMeasureNodeCalls();
29
- const style = node.style;
30
- const layout = node.layout;
31
- // Handle display: none
32
- if (style.display === C.DISPLAY_NONE) {
33
- layout.width = 0;
34
- layout.height = 0;
35
- return;
36
- }
37
- // Calculate spacing
38
- const marginLeft = resolveEdgeValue(style.margin, 0, style.flexDirection, availableWidth, direction);
39
- const marginTop = resolveEdgeValue(style.margin, 1, style.flexDirection, availableWidth, direction);
40
- const marginRight = resolveEdgeValue(style.margin, 2, style.flexDirection, availableWidth, direction);
41
- const marginBottom = resolveEdgeValue(style.margin, 3, style.flexDirection, availableWidth, direction);
42
- const paddingLeft = resolveEdgeValue(style.padding, 0, style.flexDirection, availableWidth, direction);
43
- const paddingTop = resolveEdgeValue(style.padding, 1, style.flexDirection, availableWidth, direction);
44
- const paddingRight = resolveEdgeValue(style.padding, 2, style.flexDirection, availableWidth, direction);
45
- const paddingBottom = resolveEdgeValue(style.padding, 3, style.flexDirection, availableWidth, direction);
46
- const borderLeft = resolveEdgeBorderValue(style.border, 0, style.flexDirection, direction);
47
- const borderTop = resolveEdgeBorderValue(style.border, 1, style.flexDirection, direction);
48
- const borderRight = resolveEdgeBorderValue(style.border, 2, style.flexDirection, direction);
49
- const borderBottom = resolveEdgeBorderValue(style.border, 3, style.flexDirection, direction);
50
- // Calculate node dimensions
51
- let nodeWidth;
52
- if (style.width.unit === C.UNIT_POINT) {
53
- nodeWidth = style.width.value;
54
- }
55
- else if (style.width.unit === C.UNIT_PERCENT) {
56
- nodeWidth = resolveValue(style.width, availableWidth);
57
- }
58
- else if (Number.isNaN(availableWidth)) {
59
- nodeWidth = NaN;
60
- }
61
- else {
62
- nodeWidth = availableWidth - marginLeft - marginRight;
63
- }
64
- nodeWidth = applyMinMax(nodeWidth, style.minWidth, style.maxWidth, availableWidth);
65
- let nodeHeight;
66
- if (style.height.unit === C.UNIT_POINT) {
67
- nodeHeight = style.height.value;
68
- }
69
- else if (style.height.unit === C.UNIT_PERCENT) {
70
- nodeHeight = resolveValue(style.height, availableHeight);
71
- }
72
- else if (Number.isNaN(availableHeight)) {
73
- nodeHeight = NaN;
74
- }
75
- else {
76
- nodeHeight = availableHeight - marginTop - marginBottom;
77
- }
78
- // Apply aspect ratio (CSS aspect-ratio spec)
79
- // Re-apply min/max on the derived dimension to respect CSS box model.
80
- const aspectRatio = style.aspectRatio;
81
- if (!Number.isNaN(aspectRatio) && aspectRatio > 0) {
82
- const widthIsAuto = Number.isNaN(nodeWidth) || style.width.unit === C.UNIT_AUTO;
83
- const heightIsAuto = Number.isNaN(nodeHeight) || style.height.unit === C.UNIT_AUTO;
84
- if (widthIsAuto && !heightIsAuto && !Number.isNaN(nodeHeight)) {
85
- nodeWidth = nodeHeight * aspectRatio;
86
- nodeWidth = applyMinMax(nodeWidth, style.minWidth, style.maxWidth, availableWidth);
87
- }
88
- else if (heightIsAuto && !widthIsAuto && !Number.isNaN(nodeWidth)) {
89
- nodeHeight = nodeWidth / aspectRatio;
90
- }
91
- }
92
- nodeHeight = applyMinMax(nodeHeight, style.minHeight, style.maxHeight, availableHeight);
93
- // Content area
94
- const innerLeft = borderLeft + paddingLeft;
95
- const innerTop = borderTop + paddingTop;
96
- const innerRight = borderRight + paddingRight;
97
- const innerBottom = borderBottom + paddingBottom;
98
- const minInnerWidth = innerLeft + innerRight;
99
- const minInnerHeight = innerTop + innerBottom;
100
- if (!Number.isNaN(nodeWidth) && nodeWidth < minInnerWidth) {
101
- nodeWidth = minInnerWidth;
102
- }
103
- if (!Number.isNaN(nodeHeight) && nodeHeight < minInnerHeight) {
104
- nodeHeight = minInnerHeight;
105
- }
106
- const contentWidth = Number.isNaN(nodeWidth) ? NaN : Math.max(0, nodeWidth - innerLeft - innerRight);
107
- const contentHeight = Number.isNaN(nodeHeight) ? NaN : Math.max(0, nodeHeight - innerTop - innerBottom);
108
- // Handle measure function (text nodes)
109
- if (node.hasMeasureFunc() && node.children.length === 0) {
110
- const widthIsAuto = style.width.unit === C.UNIT_AUTO || style.width.unit === C.UNIT_UNDEFINED || Number.isNaN(nodeWidth);
111
- const heightIsAuto = style.height.unit === C.UNIT_AUTO || style.height.unit === C.UNIT_UNDEFINED || Number.isNaN(nodeHeight);
112
- const widthMode = widthIsAuto ? C.MEASURE_MODE_AT_MOST : C.MEASURE_MODE_EXACTLY;
113
- const heightMode = heightIsAuto ? C.MEASURE_MODE_UNDEFINED : C.MEASURE_MODE_EXACTLY;
114
- const measureWidth = Number.isNaN(contentWidth) ? Infinity : contentWidth;
115
- const measureHeight = Number.isNaN(contentHeight) ? Infinity : contentHeight;
116
- const measured = node.cachedMeasure(measureWidth, widthMode, measureHeight, heightMode);
117
- if (widthIsAuto) {
118
- nodeWidth = measured.width + innerLeft + innerRight;
119
- }
120
- if (heightIsAuto) {
121
- nodeHeight = measured.height + innerTop + innerBottom;
122
- }
123
- layout.width = Math.round(nodeWidth);
124
- layout.height = Math.round(nodeHeight);
125
- return;
126
- }
127
- // Handle leaf nodes without measureFunc
128
- if (node.children.length === 0) {
129
- if (Number.isNaN(nodeWidth)) {
130
- nodeWidth = innerLeft + innerRight;
131
- }
132
- if (Number.isNaN(nodeHeight)) {
133
- nodeHeight = innerTop + innerBottom;
134
- }
135
- layout.width = Math.round(nodeWidth);
136
- layout.height = Math.round(nodeHeight);
137
- return;
138
- }
139
- // For container nodes, we need to measure children to compute intrinsic size
140
- // Zero-alloc: iterate children directly without collecting into temporary array
141
- // First pass: count relative children (skip absolute/hidden)
142
- let relativeChildCount = 0;
143
- for (const c of node.children) {
144
- if (c.style.display === C.DISPLAY_NONE)
145
- continue;
146
- if (c.style.positionType !== C.POSITION_TYPE_ABSOLUTE) {
147
- relativeChildCount++;
148
- }
149
- }
150
- if (relativeChildCount === 0) {
151
- // No relative children - size is just padding+border
152
- if (Number.isNaN(nodeWidth))
153
- nodeWidth = minInnerWidth;
154
- if (Number.isNaN(nodeHeight))
155
- nodeHeight = minInnerHeight;
156
- layout.width = Math.round(nodeWidth);
157
- layout.height = Math.round(nodeHeight);
158
- return;
159
- }
160
- const isRow = isRowDirection(style.flexDirection);
161
- const mainAxisSize = isRow ? contentWidth : contentHeight;
162
- const crossAxisSize = isRow ? contentHeight : contentWidth;
163
- const mainGap = isRow ? style.gap[0] : style.gap[1];
164
- // Second pass: measure each child and sum for intrinsic size
165
- let totalMainSize = 0;
166
- let maxCrossSize = 0;
167
- let itemCount = 0;
168
- for (const child of node.children) {
169
- // Skip absolute/hidden children (same filter as count pass)
170
- if (child.style.display === C.DISPLAY_NONE)
171
- continue;
172
- if (child.style.positionType === C.POSITION_TYPE_ABSOLUTE)
173
- continue;
174
- const childStyle = child.style;
175
- // Get child margins
176
- const childMarginMain = isRow
177
- ? resolveEdgeValue(childStyle.margin, 0, style.flexDirection, contentWidth, direction) +
178
- resolveEdgeValue(childStyle.margin, 2, style.flexDirection, contentWidth, direction)
179
- : resolveEdgeValue(childStyle.margin, 1, style.flexDirection, contentWidth, direction) +
180
- resolveEdgeValue(childStyle.margin, 3, style.flexDirection, contentWidth, direction);
181
- const childMarginCross = isRow
182
- ? resolveEdgeValue(childStyle.margin, 1, style.flexDirection, contentWidth, direction) +
183
- resolveEdgeValue(childStyle.margin, 3, style.flexDirection, contentWidth, direction)
184
- : resolveEdgeValue(childStyle.margin, 0, style.flexDirection, contentWidth, direction) +
185
- resolveEdgeValue(childStyle.margin, 2, style.flexDirection, contentWidth, direction);
186
- // Measure child with appropriate constraints
187
- // For shrink-wrap: pass NaN for main axis, cross axis constraint for cross
188
- const childAvailW = isRow ? NaN : crossAxisSize;
189
- const childAvailH = isRow ? crossAxisSize : NaN;
190
- // Check cache first
191
- let measuredW = 0;
192
- let measuredH = 0;
193
- const cached = child.getCachedLayout(childAvailW, childAvailH);
194
- if (cached) {
195
- incLayoutCacheHits();
196
- }
197
- else {
198
- // Save/restore layout around measureNode — it overwrites node.layout
199
- const savedW = child.layout.width;
200
- const savedH = child.layout.height;
201
- measureNode(child, childAvailW, childAvailH, direction);
202
- measuredW = child.layout.width;
203
- measuredH = child.layout.height;
204
- child.layout.width = savedW;
205
- child.layout.height = savedH;
206
- child.setCachedLayout(childAvailW, childAvailH, measuredW, measuredH);
207
- }
208
- const childMainSize = cached ? (isRow ? cached.width : cached.height) : isRow ? measuredW : measuredH;
209
- const childCrossSize = cached ? (isRow ? cached.height : cached.width) : isRow ? measuredH : measuredW;
210
- totalMainSize += childMainSize + childMarginMain;
211
- maxCrossSize = Math.max(maxCrossSize, childCrossSize + childMarginCross);
212
- itemCount++;
213
- }
214
- // Add gaps
215
- if (itemCount > 1) {
216
- totalMainSize += mainGap * (itemCount - 1);
217
- }
218
- // Compute final node size
219
- if (Number.isNaN(nodeWidth)) {
220
- nodeWidth = (isRow ? totalMainSize : maxCrossSize) + innerLeft + innerRight;
221
- }
222
- if (Number.isNaN(nodeHeight)) {
223
- nodeHeight = (isRow ? maxCrossSize : totalMainSize) + innerTop + innerBottom;
224
- }
225
- // Apply min/max again after shrink-wrap
226
- nodeWidth = applyMinMax(nodeWidth, style.minWidth, style.maxWidth, availableWidth);
227
- nodeHeight = applyMinMax(nodeHeight, style.minHeight, style.maxHeight, availableHeight);
228
- layout.width = Math.round(nodeWidth);
229
- layout.height = Math.round(nodeHeight);
230
- }
231
- //# sourceMappingURL=layout-measure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-measure.js","sourceRoot":"","sources":["../src/layout-measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,CAAC,MAAM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,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAA;QACxE,SAAS,EAAE,CAAA;IACb,CAAC;IAED,WAAW;IACX,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,aAAa,IAAI,OAAO,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED,0BAA0B;IAC1B,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,SAAS,GAAG,UAAU,CAAA;IAC7E,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,QAAQ,GAAG,WAAW,CAAA;IAC9E,CAAC;IAED,wCAAwC;IACxC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAClF,UAAU,GAAG,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAA;IAEvF,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACpC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AACxC,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Layout Statistics Counters
3
- *
4
- * Mutable counters for debugging and benchmarking.
5
- * Separated to avoid circular dependencies between layout modules.
6
- */
7
- export declare let layoutNodeCalls: number;
8
- export declare let measureNodeCalls: number;
9
- export declare let resolveEdgeCalls: number;
10
- export declare let layoutSizingCalls: number;
11
- export declare let layoutPositioningCalls: number;
12
- export declare let layoutCacheHits: number;
13
- export declare function resetLayoutStats(): void;
14
- export declare function incLayoutNodeCalls(): void;
15
- export declare function incMeasureNodeCalls(): void;
16
- export declare function incLayoutSizingCalls(): void;
17
- export declare function incLayoutPositioningCalls(): void;
18
- export declare function incLayoutCacheHits(): void;
19
- //# sourceMappingURL=layout-stats.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-stats.d.ts","sourceRoot":"","sources":["../src/layout-stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,eAAO,IAAI,eAAe,QAAI,CAAA;AAC9B,eAAO,IAAI,gBAAgB,QAAI,CAAA;AAC/B,eAAO,IAAI,gBAAgB,QAAI,CAAA;AAC/B,eAAO,IAAI,iBAAiB,QAAI,CAAA;AAChC,eAAO,IAAI,sBAAsB,QAAI,CAAA;AACrC,eAAO,IAAI,eAAe,QAAI,CAAA;AAE9B,wBAAgB,gBAAgB,IAAI,IAAI,CAOvC;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Layout Statistics Counters
3
- *
4
- * Mutable counters for debugging and benchmarking.
5
- * Separated to avoid circular dependencies between layout modules.
6
- */
7
- // Layout statistics for debugging
8
- export let layoutNodeCalls = 0;
9
- export let measureNodeCalls = 0;
10
- export let resolveEdgeCalls = 0;
11
- export let layoutSizingCalls = 0; // Calls for intrinsic sizing (offset=0,0)
12
- export let layoutPositioningCalls = 0; // Calls for final positioning
13
- export let layoutCacheHits = 0;
14
- export function resetLayoutStats() {
15
- layoutNodeCalls = 0;
16
- measureNodeCalls = 0;
17
- resolveEdgeCalls = 0;
18
- layoutSizingCalls = 0;
19
- layoutPositioningCalls = 0;
20
- layoutCacheHits = 0;
21
- }
22
- export function incLayoutNodeCalls() {
23
- layoutNodeCalls++;
24
- }
25
- export function incMeasureNodeCalls() {
26
- measureNodeCalls++;
27
- }
28
- export function incLayoutSizingCalls() {
29
- layoutSizingCalls++;
30
- }
31
- export function incLayoutPositioningCalls() {
32
- layoutPositioningCalls++;
33
- }
34
- export function incLayoutCacheHits() {
35
- layoutCacheHits++;
36
- }
37
- //# sourceMappingURL=layout-stats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-stats.js","sourceRoot":"","sources":["../src/layout-stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kCAAkC;AAClC,MAAM,CAAC,IAAI,eAAe,GAAG,CAAC,CAAA;AAC9B,MAAM,CAAC,IAAI,gBAAgB,GAAG,CAAC,CAAA;AAC/B,MAAM,CAAC,IAAI,gBAAgB,GAAG,CAAC,CAAA;AAC/B,MAAM,CAAC,IAAI,iBAAiB,GAAG,CAAC,CAAA,CAAC,0CAA0C;AAC3E,MAAM,CAAC,IAAI,sBAAsB,GAAG,CAAC,CAAA,CAAC,8BAA8B;AACpE,MAAM,CAAC,IAAI,eAAe,GAAG,CAAC,CAAA;AAE9B,MAAM,UAAU,gBAAgB;IAC9B,eAAe,GAAG,CAAC,CAAA;IACnB,gBAAgB,GAAG,CAAC,CAAA;IACpB,gBAAgB,GAAG,CAAC,CAAA;IACpB,iBAAiB,GAAG,CAAC,CAAA;IACrB,sBAAsB,GAAG,CAAC,CAAA;IAC1B,eAAe,GAAG,CAAC,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,eAAe,EAAE,CAAA;AACnB,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,gBAAgB,EAAE,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,iBAAiB,EAAE,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,sBAAsB,EAAE,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,eAAe,EAAE,CAAA;AACnB,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Layout Tree Traversal Utilities
3
- *
4
- * Iterative tree traversal functions that avoid recursion
5
- * (prevents stack overflow on deep trees).
6
- * Uses shared traversalStack from utils.ts for zero-allocation.
7
- */
8
- import type { Node } from "./node-zero.js";
9
- /**
10
- * Mark subtree as having new layout and clear dirty flags (iterative to avoid stack overflow).
11
- * This is called after layout completes to reset dirty tracking for all nodes.
12
- */
13
- export declare function markSubtreeLayoutSeen(node: Node): void;
14
- /**
15
- * Count total nodes in tree (iterative to avoid stack overflow).
16
- */
17
- export declare function countNodes(node: Node): number;
18
- /**
19
- * Propagate position delta to all descendants (iterative to avoid stack overflow).
20
- * Used when parent position changes but layout is cached.
21
- *
22
- * Only updates the constraint fingerprint's lastOffset values, NOT layout.top/left.
23
- * layout.top/left store RELATIVE positions (relative to parent's border box),
24
- * so they don't change when an ancestor moves — only the absolute offset
25
- * (tracked via lastOffsetX/Y) changes.
26
- */
27
- export declare function propagatePositionDelta(node: Node, deltaX: number, deltaY: number): void;
28
- //# sourceMappingURL=layout-traversal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-traversal.d.ts","sourceRoot":"","sources":["../src/layout-traversal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAG1C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAYtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAY7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAcvF"}
@@ -1,65 +0,0 @@
1
- /**
2
- * Layout Tree Traversal Utilities
3
- *
4
- * Iterative tree traversal functions that avoid recursion
5
- * (prevents stack overflow on deep trees).
6
- * Uses shared traversalStack from utils.ts for zero-allocation.
7
- */
8
- import { traversalStack } from "./utils.js";
9
- /**
10
- * Mark subtree as having new layout and clear dirty flags (iterative to avoid stack overflow).
11
- * This is called after layout completes to reset dirty tracking for all nodes.
12
- */
13
- export function markSubtreeLayoutSeen(node) {
14
- traversalStack.length = 0;
15
- traversalStack.push(node);
16
- while (traversalStack.length > 0) {
17
- const current = traversalStack.pop();
18
- current["_isDirty"] = false;
19
- current["_hasNewLayout"] = true;
20
- for (const child of current.children) {
21
- traversalStack.push(child);
22
- }
23
- }
24
- }
25
- /**
26
- * Count total nodes in tree (iterative to avoid stack overflow).
27
- */
28
- export function countNodes(node) {
29
- let count = 0;
30
- traversalStack.length = 0;
31
- traversalStack.push(node);
32
- while (traversalStack.length > 0) {
33
- const current = traversalStack.pop();
34
- count++;
35
- for (const child of current.children) {
36
- traversalStack.push(child);
37
- }
38
- }
39
- return count;
40
- }
41
- /**
42
- * Propagate position delta to all descendants (iterative to avoid stack overflow).
43
- * Used when parent position changes but layout is cached.
44
- *
45
- * Only updates the constraint fingerprint's lastOffset values, NOT layout.top/left.
46
- * layout.top/left store RELATIVE positions (relative to parent's border box),
47
- * so they don't change when an ancestor moves — only the absolute offset
48
- * (tracked via lastOffsetX/Y) changes.
49
- */
50
- export function propagatePositionDelta(node, deltaX, deltaY) {
51
- traversalStack.length = 0;
52
- // Start with all children of the node
53
- for (const child of node.children) {
54
- traversalStack.push(child);
55
- }
56
- while (traversalStack.length > 0) {
57
- const current = traversalStack.pop();
58
- current.flex.lastOffsetX += deltaX;
59
- current.flex.lastOffsetY += deltaY;
60
- for (const child of current.children) {
61
- traversalStack.push(child);
62
- }
63
- }
64
- }
65
- //# sourceMappingURL=layout-traversal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-traversal.js","sourceRoot":"","sources":["../src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IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,EAAU,CAAA;QAC5C,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,MAAM,CAAA;QAClC,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,MAAM,CAAA;QAClC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Flexily Layout Algorithm — Main Entry Point
3
- *
4
- * Core flexbox layout computation. This file contains:
5
- * - computeLayout(): top-level entry point
6
- * - layoutNode(): recursive layout algorithm (11 phases)
7
- *
8
- * Helper modules (split for maintainability, zero-allocation preserved):
9
- * - layout-helpers.ts: Edge resolution (margins, padding, borders)
10
- * - layout-traversal.ts: Tree traversal (markSubtreeLayoutSeen, countNodes)
11
- * - layout-flex-lines.ts: Pre-allocated arrays, line breaking, flex distribution
12
- * - layout-measure.ts: Intrinsic sizing (measureNode)
13
- * - layout-stats.ts: Debug/benchmark counters
14
- *
15
- * Based on Planning-nl/flexbox.js reference implementation.
16
- */
17
- import type { Node } from "./node-zero.js";
18
- export { isRowDirection, isReverseDirection, resolveEdgeValue, isEdgeAuto, resolveEdgeBorderValue, } from "./layout-helpers.js";
19
- export { markSubtreeLayoutSeen, countNodes } from "./layout-traversal.js";
20
- export { layoutNodeCalls, measureNodeCalls, resolveEdgeCalls, layoutSizingCalls, layoutPositioningCalls, layoutCacheHits, resetLayoutStats, } from "./layout-stats.js";
21
- export { measureNode } from "./layout-measure.js";
22
- /**
23
- * Compute layout for a node tree.
24
- */
25
- export declare function computeLayout(root: Node, availableWidth: number, availableHeight: number, direction?: number): void;
26
- //# sourceMappingURL=layout-zero.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-zero.d.ts","sourceRoot":"","sources":["../src/layout-zero.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAM1C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AA8BjD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,SAAS,GAAE,MAAwB,GAClC,IAAI,CAON"}