Skip to content

Commit 2f6e763

Browse files
committed
chore(masonry): fix doc linting errors
Signed-off-by: Justin Charles <[email protected]>
1 parent 4042477 commit 2f6e763

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

modules/masonry/docs/technical-specification/Algorithm_Tree.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Tower Parsing & Layout Algorithm
22

3-
This document describes a **stack-based post-order traversal** that computes each brick’s SVG path, bounding box, and notch‐connection points **after** all of its children have been measured. It handles arbitrarily deep nesting, distinguishes **expression** vs. **simple** vs. **compound** bricks, and avoids JavaScript call‐stack limits.
3+
This document describes a **stack-based post-order traversal** that computes each brick’s SVG path,
4+
bounding box, and notch‐connection points **after** all of its children have been measured. It
5+
handles arbitrarily deep nesting, distinguishes **expression** vs. **simple** vs. **compound**
6+
bricks, and avoids JavaScript call‐stack limits.
47

58
---
69

@@ -85,7 +88,8 @@ measureLabel(text, fontSize): { w: number; h: number; ascent: number; descent: n
8588
stack.push({ node: { uuid: rootUuid }, visited: false })
8689
```
8790

88-
We mark `visited = false` on first encounter (“children not yet handled”) and will re-push the same node with `visited = true` (“ready to compute”) after its children.
91+
We mark `visited = false` on first encounter (“children not yet handled”) and will re-push the
92+
same node with `visited = true` (“ready to compute”) after its children.
8993

9094
2. **Process Frames Until Done**
9195

@@ -146,7 +150,8 @@ measureLabel(text, fontSize): { w: number; h: number; ascent: number; descent: n
146150
metricsMap[currentNode.uuid] = { path, bbox, connectionPoints }
147151
```
148152

149-
**Key invariant**: When a node’s frame is popped with `visited = true`, all of its children (and their entire subtrees) have already been computed and stored in `metricsMap`.
153+
**Key invariant**: When a node’s frame is popped with `visited = true`, all of its children (and
154+
their entire subtrees) have already been computed and stored in `metricsMap`.
150155

151156
3. **Completion**
152157

@@ -156,16 +161,19 @@ measureLabel(text, fontSize): { w: number; h: number; ascent: number; descent: n
156161
- Dimensions (`bbox`)
157162
- Notch coordinates (`connectionPoints`)
158163

159-
You can now feed these into your React components or canvas renderer in a single, child‐first batch.
164+
You can now feed these into your React components or canvas renderer in a single, child‐first
165+
batch.
160166

161167
---
162168

163169
## Why This Approach
164170

165-
- **Post‐order traversal** ensures each statement/compound block sizes itself around fully measured plugged‐in bricks.
171+
- **Post‐order traversal** ensures each statement/compound block sizes itself around fully measured
172+
plugged‐in bricks.
166173
- **Explicit stack** avoids recursion limits—safe for arbitrary nesting depth.
167174
- **Type‐aware child selection** respects the two “directions” of plug‐ins:
168175
- Expression bricks never act as parents (no children).
169176
- Simple bricks only host expression‐slot arguments (and top/bottom chain).
170177
- Compound bricks first nest entire inner‐blocks, then expression args, then statement chaining.
171-
- **No extra bookkeeping**: the “two‐push visited‐flag” trick implicitly tracks when children are done without counters or complex state.
178+
- **No extra bookkeeping**: the “two‐push visited‐flag” trick implicitly tracks when children are
179+
done without counters or complex state.

0 commit comments

Comments
 (0)