machinalayout 0.1.0 → 0.2.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.
- package/README.md +280 -49
- package/dist/chunk-BJOQRPPX.js +382 -0
- package/dist/chunk-HU6XYOH7.js +133 -0
- package/dist/chunk-KYWOCAHK.js +205 -0
- package/dist/chunk-RJYRJ3LD.js +0 -0
- package/dist/chunk-TR24ERZT.js +66 -0
- package/dist/dispatch/index.d.ts +49 -0
- package/dist/dispatch/index.js +217 -0
- package/dist/index.d.ts +15 -238
- package/dist/index.js +596 -591
- package/dist/react/index.d.ts +33 -0
- package/dist/react/index.js +7 -0
- package/dist/react-native/index.d.ts +30 -0
- package/dist/react-native/index.js +83 -0
- package/dist/text/index.d.ts +10 -0
- package/dist/text/index.js +9 -0
- package/dist/text/react/index.d.ts +14 -0
- package/dist/text/react/index.js +7 -0
- package/dist/text/react-native/index.d.ts +16 -0
- package/dist/text/react-native/index.js +155 -0
- package/dist/text/vue/index.d.ts +113 -0
- package/dist/text/vue/index.js +202 -0
- package/dist/types-BudfpzZX.d.ts +184 -0
- package/dist/types-C4poVJpR.d.ts +74 -0
- package/dist/vue/index.d.ts +173 -0
- package/dist/vue/index.js +111 -0
- package/docs/adapter-packaging-a0-plan.md +352 -0
- package/docs/adapters.md +19 -0
- package/docs/api-coherence-m8-audit.md +397 -0
- package/docs/error-codes.md +84 -0
- package/docs/grid-arrange-m5a-contract.md +480 -0
- package/docs/grid-arrange.md +51 -0
- package/docs/layout-interpolation.md +52 -0
- package/docs/machina-dispatch-d0-contract.md +496 -0
- package/docs/machina-dispatch.md +143 -0
- package/docs/named-layers.md +40 -0
- package/docs/react-adapter.md +51 -69
- package/docs/react-native-adapter.md +56 -0
- package/docs/react-native-text-renderer.md +50 -0
- package/docs/reference-alignment-m7a-contract.md +384 -0
- package/docs/reference-alignment.md +44 -0
- package/docs/responsive-variants.md +54 -0
- package/docs/vue-adapter.md +55 -0
- package/docs/vue-text-renderer.md +55 -0
- package/package.json +60 -5
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# API Coherence and Polish Audit (M8)
|
|
2
|
+
|
|
3
|
+
Date: 2026-05-11
|
|
4
|
+
Repository: `MachinaLayout.JS`
|
|
5
|
+
|
|
6
|
+
## 1) Executive summary
|
|
7
|
+
|
|
8
|
+
This pass audited exports, type surfaces, docs, samples, and package outputs for coherence after M5–M7 expansion.
|
|
9
|
+
|
|
10
|
+
High-level result:
|
|
11
|
+
|
|
12
|
+
- Core runtime API is coherent and functionally aligned with current features (`RootFrame`, `GridArrange`, `GuideFrame`, variants, layers, interpolation).
|
|
13
|
+
- React and MachinaText adapter boundaries are mostly clear and remain non-authoritative for layout geometry.
|
|
14
|
+
- Build/test/sample/package verification all pass.
|
|
15
|
+
- Main coherence risks are documentation drift in `README.md` and minor terminology consistency gaps (not runtime/API defects).
|
|
16
|
+
|
|
17
|
+
No runtime behavior or public API changes were made in this audit pass.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2) Public API inventory
|
|
22
|
+
|
|
23
|
+
Inventory source: `src/index.ts` and nested barrels.
|
|
24
|
+
|
|
25
|
+
### 2.1 Core types
|
|
26
|
+
|
|
27
|
+
Exported via `export * from "./types"`:
|
|
28
|
+
|
|
29
|
+
- Identity/base: `NodeId`, `LayerName`, `Rect`
|
|
30
|
+
- Frame specs: `RootFrame`, `AbsoluteFrame`, `AnchorFrame`, `GuideFrame`, `FixedFrame`, `FillFrame`, `CellFrame`, `FrameSpec`
|
|
31
|
+
- Length/offset/reference: `UiLength`, `OffsetSpec`, `RectEdge`, `EdgeRef`, `GuideLength`
|
|
32
|
+
- Arrange specs: `StackAxis`, `StackJustify`, `StackAlign`, `EdgeInsets`, `StackArrange`, `GridTrack`, `GridArrange`, `ArrangeSpec`
|
|
33
|
+
- Authoring rows/variants: `LayoutVariantCondition`, `LayoutRowVariant`, `LayoutRow`, `LayoutNode`, `LayoutDocument`
|
|
34
|
+
- Resolved output: `ResolvedLayoutNode`, `ResolvedLayoutDocument`, `ResolvedLayoutTree`
|
|
35
|
+
|
|
36
|
+
Exported from errors module:
|
|
37
|
+
|
|
38
|
+
- `MachinaLayoutErrorCode`
|
|
39
|
+
- `MachinaLayoutError`
|
|
40
|
+
|
|
41
|
+
### 2.2 Core functions
|
|
42
|
+
|
|
43
|
+
Exported from root barrel:
|
|
44
|
+
|
|
45
|
+
- Compile/select:
|
|
46
|
+
- `compileLayoutRows`
|
|
47
|
+
- `selectLayoutRowsForRoot`
|
|
48
|
+
- Resolve:
|
|
49
|
+
- `resolveFrame`
|
|
50
|
+
- `resolveLayoutDocument`
|
|
51
|
+
- `resolveLayoutRows`
|
|
52
|
+
- Helpers/utilities:
|
|
53
|
+
- validation helpers (`assertFiniteNumber`, etc.) via `validation`
|
|
54
|
+
- padding helpers via `padding`
|
|
55
|
+
- length helpers (`resolveUiLength`) via `length`
|
|
56
|
+
- offset helpers (`applyOffset`) via `offset`
|
|
57
|
+
- tree conversion helpers (`toResolvedTree`, `flattenResolvedTree`)
|
|
58
|
+
- formatting helper (`formatRect`)
|
|
59
|
+
- Interpolation:
|
|
60
|
+
- `lerpNumber`
|
|
61
|
+
- `lerpRect`
|
|
62
|
+
- `lerpResolvedLayouts`
|
|
63
|
+
|
|
64
|
+
### 2.3 React adapter
|
|
65
|
+
|
|
66
|
+
Exported from `src/react/index.ts` and re-exported from root:
|
|
67
|
+
|
|
68
|
+
- Component: `MachinaReactView`
|
|
69
|
+
- Props types: `MachinaReactViewProps`, `MachinaSlotProps`
|
|
70
|
+
|
|
71
|
+
Observed adapter-facing concepts in type surface/tests/docs:
|
|
72
|
+
|
|
73
|
+
- layer policy + named layer ordering
|
|
74
|
+
- slot/view rendering key (`view ?? slot` semantics)
|
|
75
|
+
- adapter data channels (`viewData`, `nodeData`)
|
|
76
|
+
- containment/content-visibility knobs
|
|
77
|
+
|
|
78
|
+
### 2.4 MachinaText
|
|
79
|
+
|
|
80
|
+
Exported from `src/text/index.ts` and `src/text/react/index.ts`:
|
|
81
|
+
|
|
82
|
+
- Source/spec/domain types:
|
|
83
|
+
- `MachinaTextSource`, `MachinaTextSpec`, `MachinaTextDocument`
|
|
84
|
+
- policy enums/aliases (`MachinaTextVariant`, `MachinaTextWrap`, etc.)
|
|
85
|
+
- AST/content types:
|
|
86
|
+
- `MachinaTextBlock`, `MachinaInline`, `MachinaBulletItem`
|
|
87
|
+
- Diagnostics:
|
|
88
|
+
- `MachinaTextDiagnostic`, `MachinaTextDiagnosticCode`, `MachinaTextDiagnosticLevel`
|
|
89
|
+
- `ParseMachinaTextResult`
|
|
90
|
+
- Parser:
|
|
91
|
+
- `parseMachinaText`
|
|
92
|
+
- `parseMachinaTextInline`
|
|
93
|
+
- React renderer:
|
|
94
|
+
- `MachinaTextView`
|
|
95
|
+
- `MachinaTextViewProps`
|
|
96
|
+
|
|
97
|
+
### 2.5 Public API coherence findings
|
|
98
|
+
|
|
99
|
+
- No clearly accidental/internal export was found in root barrel; exports are broad but intentional for current tests/docs usage.
|
|
100
|
+
- No documented major API appears missing from exports.
|
|
101
|
+
- A few exports (`formatRect`, `flattenResolvedTree`) are minimally documented in top-level README (discoverability issue, not API bug).
|
|
102
|
+
- Documentation is less explicit than code about root barrel re-exporting adapters (`react`, `text`) and may benefit from a short API index section.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 3) Concept taxonomy
|
|
107
|
+
|
|
108
|
+
Current taxonomy can be expressed cleanly as:
|
|
109
|
+
|
|
110
|
+
1. **Node identity + hierarchy**
|
|
111
|
+
- `id`: stable node key
|
|
112
|
+
- `parent`: coordinate owner relationship
|
|
113
|
+
- `order`: sibling sequence within parent
|
|
114
|
+
|
|
115
|
+
2. **Frame = node rectangle acquisition**
|
|
116
|
+
- `RootFrame`: root-only ownership from `rootRect`
|
|
117
|
+
- `AbsoluteFrame`: explicit parent-local rect
|
|
118
|
+
- `AnchorFrame`: edge/size constraints with `UiLength`
|
|
119
|
+
- `GuideFrame`: reference-assisted placement using resolved targets
|
|
120
|
+
- `FixedFrame`: stack-child explicit size
|
|
121
|
+
- `FillFrame`: stack-child weighted main-axis fill
|
|
122
|
+
- `CellFrame`: grid-child explicit track coordinates/spans
|
|
123
|
+
|
|
124
|
+
3. **Arrange = direct child placement**
|
|
125
|
+
- `StackArrange`: 1D ordered arithmetic placement
|
|
126
|
+
- `GridArrange`: 2D explicit track/cell placement
|
|
127
|
+
|
|
128
|
+
4. **Node metadata**
|
|
129
|
+
- semantic/view keys: `view`, `slot`
|
|
130
|
+
- diagnostics label: `debugLabel`
|
|
131
|
+
- paint ordering: `z` (bounded sibling-local), `layer` (named semantic layer)
|
|
132
|
+
- post-placement nudge: `offset`
|
|
133
|
+
|
|
134
|
+
5. **Authoring-time row features**
|
|
135
|
+
- `variants` on rows only, selected before compile/resolve
|
|
136
|
+
|
|
137
|
+
6. **Resolved output**
|
|
138
|
+
- flat: `ResolvedLayoutDocument`
|
|
139
|
+
- nested projection: `ResolvedLayoutTree`
|
|
140
|
+
|
|
141
|
+
7. **Renderer adapters**
|
|
142
|
+
- React adapter consumes resolved rectangles and paints wrappers in DOM
|
|
143
|
+
|
|
144
|
+
8. **Text subsystem**
|
|
145
|
+
- parser + diagnostics (MachinaText)
|
|
146
|
+
- React text renderer (`MachinaTextView`) inside already-owned rectangles
|
|
147
|
+
|
|
148
|
+
Taxonomy readability in current names is generally good; primary ambiguity is contextual validity of some frame kinds (`Fixed`/`Fill`/`Cell`/`Guide`) which relies on docs + errors rather than type-level separation.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 4) Naming consistency audit
|
|
153
|
+
|
|
154
|
+
### 4.1 `Frame` vs `Arrange`
|
|
155
|
+
- Consistent and clear: frame answers “this node rect,” arrange answers “direct child placement.”
|
|
156
|
+
|
|
157
|
+
### 4.2 `FillFrame` vs `GridTrack { kind: "fill" }`
|
|
158
|
+
- Potential overload but acceptable: both represent weighted distribution semantics in different contexts.
|
|
159
|
+
- Recommend doc callout clarifying **node-level fill (stack child)** vs **track-level fill (grid template)**.
|
|
160
|
+
|
|
161
|
+
### 4.3 `CellFrame`
|
|
162
|
+
- Reads as grid-only and aligns with behavior/erroring (`CellFrameWithoutGrid` / `GridChildMustBeCell`).
|
|
163
|
+
|
|
164
|
+
### 4.4 `GuideFrame`
|
|
165
|
+
- Mostly clear from reference docs; name can be interpreted as “helper reference” and does communicate non-ownership placement.
|
|
166
|
+
- Recommend one explicit phrase in top README: “GuideFrame reads other nodes; it does not reparent or portal.”
|
|
167
|
+
|
|
168
|
+
### 4.5 `view` vs `slot`
|
|
169
|
+
- Code/docs consistently use `view ?? slot` semantics.
|
|
170
|
+
- `slot` remains valid and adapter-facing; not marked legacy.
|
|
171
|
+
- Some top-level README examples still use only `slot`, reducing emphasis on preferred `view` naming.
|
|
172
|
+
|
|
173
|
+
### 4.6 `layer` vs `z`
|
|
174
|
+
- Coherent: semantic grouping (`layer`) then local order (`z`).
|
|
175
|
+
|
|
176
|
+
### 4.7 `OffsetSpec` and `UiLength`
|
|
177
|
+
- Names are coherent and sufficiently neutral (not overly CSS-like).
|
|
178
|
+
|
|
179
|
+
### 4.8 `variants`
|
|
180
|
+
- Reasonable name; docs mention responsive variants phase separation.
|
|
181
|
+
|
|
182
|
+
### 4.9 `lerpResolvedLayouts`
|
|
183
|
+
- Name is explicit and consistent with accompanying `lerpNumber`/`lerpRect`.
|
|
184
|
+
|
|
185
|
+
### 4.10 `MachinaText*`
|
|
186
|
+
- Consistent prefixing across parser, AST types, diagnostics, and renderer.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 5) Type consistency audit
|
|
191
|
+
|
|
192
|
+
### 5.1 Context-restricted frames
|
|
193
|
+
|
|
194
|
+
Status:
|
|
195
|
+
- `FixedFrame` and `FillFrame` stack-only: enforced at runtime/compile and documented.
|
|
196
|
+
- `CellFrame` grid-only: enforced and documented.
|
|
197
|
+
- `GuideFrame` document-level resolver only: `resolveFrame` throws `GuideTargetUnresolved` with explicit guidance.
|
|
198
|
+
- `RootFrame` root-only: compile rejects non-root root frame.
|
|
199
|
+
|
|
200
|
+
Coverage:
|
|
201
|
+
- Restrictions are covered by tests (`resolveFrame`, `compileLayoutRows`, `gridArrange`, `guideFrame`).
|
|
202
|
+
|
|
203
|
+
### 5.2 Metadata preservation
|
|
204
|
+
|
|
205
|
+
Checked `LayoutRow`, `LayoutNode`, `ResolvedLayoutNode`, `ResolvedLayoutTree`:
|
|
206
|
+
- `view`, `slot`, `debugLabel`, `z`, `layer`, `offset` are present and threaded consistently where appropriate.
|
|
207
|
+
|
|
208
|
+
### 5.3 Authoring-only fields
|
|
209
|
+
|
|
210
|
+
- `variants` exists only on `LayoutRow` and is absent from compiled/resolved node types.
|
|
211
|
+
- This matches intended phase separation.
|
|
212
|
+
|
|
213
|
+
### 5.4 Adapter-only props
|
|
214
|
+
|
|
215
|
+
- `viewData`, `nodeData`, `layers`, containment controls are in React adapter props surface, not in core layout types.
|
|
216
|
+
|
|
217
|
+
### 5.5 Text type isolation
|
|
218
|
+
|
|
219
|
+
- Text parser/renderer types are scoped under `src/text/*` and do not pollute core layout model types.
|
|
220
|
+
|
|
221
|
+
Finding: type surface is coherent; no corrective change needed in M8.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 6) Error code audit
|
|
226
|
+
|
|
227
|
+
### 6.1 `MachinaLayoutErrorCode` inventory by domain
|
|
228
|
+
|
|
229
|
+
- **Compile/row structure**: `EmptyRows`, `MissingRoot`, `MultipleRoots`, `DuplicateId`, `InvalidId`, `UnknownParent`, `SelfParent`, `Cycle`, `UnreachableNode`, `RootFrameNotRoot`
|
|
230
|
+
- **Numeric/validation**: `NonFiniteNumber`, `NegativeSize`, `NegativeGap`, `NegativePadding`, `InvalidLengthUnit`, `InvalidZ`
|
|
231
|
+
- **Anchor/frame resolution**: `InvalidAnchorHorizontal`, `InvalidAnchorVertical`, `NegativeResolvedSize`, `RootFrameWithoutRoot`
|
|
232
|
+
- **Stack**: `FixedFrameWithoutArranger`, `FillFrameWithoutArranger`, `InvalidFillWeight`, `StackChildMustBeFixed`, `StackContentNegative`, `StackOverflow`
|
|
233
|
+
- **Grid**: `CellFrameWithoutGrid`, `GridChildMustBeCell`, `InvalidGridTrack`, `InvalidGridCell`, `GridContentNegative`, `GridOverflow`
|
|
234
|
+
- **Guide/reference**: `GuideTargetNotFound`, `GuideSelfReference`, `GuideReferenceCycle`, `GuideInvalidEdgeForAxis`, `GuideTooManyReferencesPerAxis`, `InvalidGuideFrame`, `GuideTargetUnresolved`
|
|
235
|
+
- **Variants**: `InvalidVariantCondition`
|
|
236
|
+
- **Interpolation**: `IncompatibleLayouts`
|
|
237
|
+
|
|
238
|
+
### 6.2 Specificity/misuse/dead code check
|
|
239
|
+
|
|
240
|
+
- Codes are sufficiently specific for API-facing debugging.
|
|
241
|
+
- No declared layout error codes found obviously dead/unreachable in this pass.
|
|
242
|
+
- One naming sharp edge: `StackChildMustBeFixed` now allows `FillFrame` too; message string says fixed-or-fill, but code name is legacy-biased and slightly misleading.
|
|
243
|
+
- Recommendation: keep code for compatibility, improve docs note mapping.
|
|
244
|
+
|
|
245
|
+
### 6.3 MachinaText diagnostics audit
|
|
246
|
+
|
|
247
|
+
Declared codes:
|
|
248
|
+
- `unsupported_syntax`
|
|
249
|
+
- `heading_forbidden`
|
|
250
|
+
- `max_list_depth_exceeded`
|
|
251
|
+
- `malformed_link`
|
|
252
|
+
- `unclosed_inline`
|
|
253
|
+
- `invalid_escape`
|
|
254
|
+
|
|
255
|
+
Emitted paths inspected in parser:
|
|
256
|
+
- all declared codes are emitted in concrete branches.
|
|
257
|
+
- no obvious dead diagnostic code found (including `invalid_escape`, previously risky area).
|
|
258
|
+
|
|
259
|
+
Docs coverage:
|
|
260
|
+
- `docs/machina-text-parser.md` currently emphasizes escape behavior; broader code taxonomy documentation is thin.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## 7) Docs/examples consistency audit
|
|
265
|
+
|
|
266
|
+
Inspected: `README.md`, `docs/*.md`, sample READMEs.
|
|
267
|
+
|
|
268
|
+
### 7.1 Strong points
|
|
269
|
+
- Frame/arrange boundaries and restrictions documented in focused docs (`frames-and-stack`, `grid-arrange`, `reference-alignment`).
|
|
270
|
+
- Explicit boundary statements (“Machina places, CSS paints”) are present across docs.
|
|
271
|
+
- MachinaText ellipsis single-line policy documented.
|
|
272
|
+
|
|
273
|
+
### 7.2 Drift/inconsistency findings
|
|
274
|
+
|
|
275
|
+
1. **Top-level README still branded around “M0 scope” language** despite including later features; this can confuse maturity/state.
|
|
276
|
+
2. README docs index omits some key current docs from the main list (e.g., text docs are less discoverable in the principal section structure).
|
|
277
|
+
3. README quick examples rely mostly on `slot` terminology; current guidance prefers `view` with slot fallback.
|
|
278
|
+
4. README includes note “legacy root Absolute/Anchor remain accepted” (in deeper docs) which is okay for compatibility but should be cross-linked from root section for clarity.
|
|
279
|
+
|
|
280
|
+
No runtime-impacting docs contradiction found for:
|
|
281
|
+
- root via `RootFrame`
|
|
282
|
+
- stack-only fixed/fill
|
|
283
|
+
- grid-only cell
|
|
284
|
+
- guide reference semantics
|
|
285
|
+
- negative positional anchors allowed
|
|
286
|
+
- variants phase separation
|
|
287
|
+
- named layers non-portal semantics
|
|
288
|
+
- no intrinsic text sizing / no CSS geometry authority
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 8) Sample usage audit
|
|
293
|
+
|
|
294
|
+
Inspected `samples/control-room` and `samples/music-player` plus builds.
|
|
295
|
+
|
|
296
|
+
Findings:
|
|
297
|
+
- Both samples build successfully.
|
|
298
|
+
- Control-room README reflects modern concepts (`view ?? slot`, `UiLength`, `offset`, stable views, text view usage).
|
|
299
|
+
- Music-player README local file dependency instructions are accurate.
|
|
300
|
+
- No obvious sample pattern teaching unstable inline view factories.
|
|
301
|
+
- No evidence samples depend on CSS layout for Machina node placement authority.
|
|
302
|
+
- `package.json` `files` excludes `samples/` from npm tarball already (good).
|
|
303
|
+
|
|
304
|
+
No required sample code updates for M8.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 9) Package export/build audit
|
|
309
|
+
|
|
310
|
+
### 9.1 Export map/build outputs
|
|
311
|
+
- `package.json` exports only `.` with `types` and `import` pointed to `dist/index.d.ts` and `dist/index.js`.
|
|
312
|
+
- Build emits matching files in `dist/`.
|
|
313
|
+
- Peer dependencies retain React/ReactDOM as peer deps (correct for adapter).
|
|
314
|
+
|
|
315
|
+
### 9.2 Tarball contents (`npm pack --dry-run`)
|
|
316
|
+
- Includes: `dist`, `README`, `LICENSE`, `docs`, `package.json`.
|
|
317
|
+
- Excludes: `src`, `test`, `samples` (expected and desirable).
|
|
318
|
+
|
|
319
|
+
### 9.3 Dist/API coherence
|
|
320
|
+
- Dist typings generated successfully.
|
|
321
|
+
- Public root import surface validated by existing public API tests and successful build/test pipeline.
|
|
322
|
+
|
|
323
|
+
No package/export corrections required in this pass.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## 10) Proposed one-page mental model
|
|
328
|
+
|
|
329
|
+
> MachinaLayout in one page
|
|
330
|
+
|
|
331
|
+
1. **Author layout as flat rows (`LayoutRow[]`)**.
|
|
332
|
+
Each row is a node with `id`, optional `parent`, and optional `order`.
|
|
333
|
+
|
|
334
|
+
2. **Parent means coordinate ownership**.
|
|
335
|
+
A node’s rectangle is resolved in its parent’s coordinate space.
|
|
336
|
+
|
|
337
|
+
3. **Frame decides this node’s rectangle**.
|
|
338
|
+
Use one frame kind per node (`root`, `absolute`, `anchor`, `guide`, `fixed`, `fill`, `cell`) according to context.
|
|
339
|
+
|
|
340
|
+
4. **Arrange decides direct child placement**.
|
|
341
|
+
Parent `arrange` (`stack` or `grid`) places only immediate children.
|
|
342
|
+
|
|
343
|
+
5. **Metadata shapes rendering behavior, not geometry solving**.
|
|
344
|
+
`view/slot` map nodes to renderer views; `layer` + `z` control paint order; `offset` nudges after placement.
|
|
345
|
+
|
|
346
|
+
6. **Variants are authoring-time selection**.
|
|
347
|
+
`variants` are chosen against root size before compile/resolve.
|
|
348
|
+
|
|
349
|
+
7. **Resolver outputs deterministic rectangles**.
|
|
350
|
+
Core output is a resolved document/tree of numeric rects.
|
|
351
|
+
|
|
352
|
+
8. **Adapters render rectangles**.
|
|
353
|
+
React adapter paints absolute wrappers and injects node/view data.
|
|
354
|
+
|
|
355
|
+
9. **Text renders inside owned rectangles**.
|
|
356
|
+
MachinaText parses/paints content inside a rectangle; it does not drive outer layout sizing.
|
|
357
|
+
|
|
358
|
+
10. **CSS paints; Machina places**.
|
|
359
|
+
CSS can style internals, but Machina remains geometry authority for node placement.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## 11) Risks / confusing areas
|
|
364
|
+
|
|
365
|
+
1. **README lifecycle terminology drift** (“M0” framing with later feature reality).
|
|
366
|
+
2. **Error-code naming legacy**: `StackChildMustBeFixed` includes fill children now.
|
|
367
|
+
3. **Discoverability gap** for full API index and text docs from root README.
|
|
368
|
+
4. **Contextual frame validity is runtime-validated**, not type-encoded; this is intentional but requires clear docs examples.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## 12) Recommended M8 cleanup checklist
|
|
373
|
+
|
|
374
|
+
Concrete follow-up checklist based on findings:
|
|
375
|
+
|
|
376
|
+
- [ ] Refresh top-level README scope/lifecycle section to reflect current post-M7 capability set (remove or clearly contextualize old “M0 scope” framing).
|
|
377
|
+
- [ ] Add a compact “Public API index” in README (core / react / text) mapping names to docs.
|
|
378
|
+
- [ ] Prefer `view` in top README examples while retaining explicit `view ?? slot` compatibility note.
|
|
379
|
+
- [ ] Add short README callout: `GuideFrame` references resolved geometry and does not reparent/portal.
|
|
380
|
+
- [ ] Add error-code reference table in docs (code → when emitted), including note that `StackChildMustBeFixed` means fixed-or-fill for backward compatibility.
|
|
381
|
+
- [ ] Add one lightweight smoke test that imports from built `dist` in a temporary fixture (optional but useful for publish confidence).
|
|
382
|
+
|
|
383
|
+
No runtime/API changes required by this audit.
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## 13) Exact verification commands run
|
|
388
|
+
|
|
389
|
+
From repository root unless noted:
|
|
390
|
+
|
|
391
|
+
1. `npm test`
|
|
392
|
+
2. `npm run build`
|
|
393
|
+
3. `(cd samples/control-room && npm run build)`
|
|
394
|
+
4. `(cd samples/music-player && npm run build)`
|
|
395
|
+
5. `npm pack --dry-run`
|
|
396
|
+
|
|
397
|
+
All commands completed successfully in this environment.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Error code reference
|
|
2
|
+
|
|
3
|
+
This document summarizes public layout and text diagnostic codes.
|
|
4
|
+
|
|
5
|
+
## MachinaLayoutErrorCode
|
|
6
|
+
|
|
7
|
+
### Row/compile structure
|
|
8
|
+
|
|
9
|
+
- `EmptyRows` — no rows were provided. Typical cause: resolver/compile called with an empty array.
|
|
10
|
+
- `MissingRoot` — no root row exists. Typical cause: no `RootFrame` row in the selected row set.
|
|
11
|
+
- `MultipleRoots` — more than one root row exists. Typical cause: duplicate root definitions.
|
|
12
|
+
- `DuplicateId` — two rows share one id. Typical cause: authoring collision during merge/generation.
|
|
13
|
+
- `InvalidId` — id is blank/invalid. Typical cause: malformed row data.
|
|
14
|
+
- `MissingParent` — non-root row omitted `parent`. Typical cause: incomplete row authoring.
|
|
15
|
+
- `UnknownParent` — parent id does not exist. Typical cause: typo or variant mismatch.
|
|
16
|
+
- `SelfParent` — row points to itself as parent. Typical cause: authoring mistake.
|
|
17
|
+
- `Cycle` — parent graph contains a loop. Typical cause: circular parent references.
|
|
18
|
+
- `UnreachableNode` — node cannot be reached from root. Typical cause: disconnected subtree.
|
|
19
|
+
|
|
20
|
+
### Numeric/length validation
|
|
21
|
+
|
|
22
|
+
- `NonFiniteNumber` — numeric field is `NaN`/`Infinity`. Typical cause: bad arithmetic or unvalidated input.
|
|
23
|
+
- `InvalidLengthUnit` — unsupported `UiLength` unit. Typical cause: unit typo.
|
|
24
|
+
- `InvalidZ` — z metadata is invalid/out of bounds. Typical cause: non-integer or unsupported range.
|
|
25
|
+
- `NegativeSize` — width/height input is negative. Typical cause: invalid frame dimensions.
|
|
26
|
+
- `NegativeGap` — arranger gap is negative. Typical cause: invalid stack/grid config.
|
|
27
|
+
- `NegativePadding` — padding is negative. Typical cause: invalid arranger padding config.
|
|
28
|
+
|
|
29
|
+
### Root/frame context
|
|
30
|
+
|
|
31
|
+
- `RootFrameNotRoot` — `RootFrame` was used on a non-root node. Typical cause: wrong frame kind for child row.
|
|
32
|
+
- `RootFrameWithoutRoot` — root frame resolution lacked root context. Typical cause: incorrect direct frame resolution call.
|
|
33
|
+
- `FixedFrameWithoutArranger` — `FixedFrame` used where parent does not arrange children. Typical cause: fixed child under non-arranger parent.
|
|
34
|
+
- `FillFrameWithoutArranger` — `FillFrame` used where parent does not arrange children. Typical cause: fill child under non-arranger parent.
|
|
35
|
+
- `CellFrameWithoutGrid` — `CellFrame` used under non-grid arranger parent. Typical cause: cell child not placed in a grid container.
|
|
36
|
+
|
|
37
|
+
### Anchor/size resolution
|
|
38
|
+
|
|
39
|
+
- `InvalidAnchorHorizontal` — horizontal anchor constraints are inconsistent. Typical cause: missing/overconstrained left/right/width combination.
|
|
40
|
+
- `InvalidAnchorVertical` — vertical anchor constraints are inconsistent. Typical cause: missing/overconstrained top/bottom/height combination.
|
|
41
|
+
- `NegativeResolvedSize` — resolved width/height became negative. Typical cause: conflicting constraints relative to parent rect.
|
|
42
|
+
|
|
43
|
+
### Stack
|
|
44
|
+
|
|
45
|
+
- `InvalidFillWeight` — fill weight is invalid. Typical cause: zero/negative/non-finite fill weight.
|
|
46
|
+
- `StackChildMustBeFixed` — stack direct child frame kind is unsupported. Typical cause: child is neither `FixedFrame` nor `FillFrame`.
|
|
47
|
+
- Note: this code name is historical and stable; do not rename it.
|
|
48
|
+
- `StackContentNegative` — stack content space became negative. Typical cause: padding/gaps exceed container space.
|
|
49
|
+
- `StackOverflow` — stack children exceed available axis space. Typical cause: fixed sizes + gaps exceed container.
|
|
50
|
+
|
|
51
|
+
### Grid
|
|
52
|
+
|
|
53
|
+
- `GridChildMustBeCell` — direct grid child is not `CellFrame`. Typical cause: wrong frame kind under grid arranger.
|
|
54
|
+
- `InvalidGridTrack` — track definition is invalid. Typical cause: malformed `GridArrange` track settings.
|
|
55
|
+
- `InvalidGridCell` — cell coordinates/span are invalid. Typical cause: out-of-range row/col/span.
|
|
56
|
+
- `GridContentNegative` — grid content space became negative. Typical cause: padding/gaps exceed container space.
|
|
57
|
+
- `GridOverflow` — grid placement overflows available tracks/space. Typical cause: tracks/cells incompatible with container.
|
|
58
|
+
|
|
59
|
+
### Guide/reference alignment
|
|
60
|
+
|
|
61
|
+
- `GuideTargetNotFound` — guide target id is missing. Typical cause: typo or missing target row.
|
|
62
|
+
- `GuideSelfReference` — guide references its own node. Typical cause: self-targeting guide config.
|
|
63
|
+
- `GuideReferenceCycle` — guide references create a cycle. Typical cause: mutually dependent guide nodes.
|
|
64
|
+
- `GuideInvalidEdgeForAxis` — requested reference edge is invalid for chosen axis. Typical cause: axis/edge mismatch.
|
|
65
|
+
- `GuideTooManyReferencesPerAxis` — too many references were provided for one axis. Typical cause: overconstrained guide input.
|
|
66
|
+
- `InvalidGuideFrame` — guide frame declaration is malformed. Typical cause: incomplete or conflicting guide spec.
|
|
67
|
+
- `GuideTargetUnresolved` — guide target exists but was not resolved when needed. Typical cause: invalid dependency order/cycle.
|
|
68
|
+
|
|
69
|
+
### Variants
|
|
70
|
+
|
|
71
|
+
- `InvalidVariantCondition` — variant condition is invalid. Typical cause: unsupported operator/value shape.
|
|
72
|
+
|
|
73
|
+
### Interpolation
|
|
74
|
+
|
|
75
|
+
- `IncompatibleLayouts` — two resolved layouts cannot be interpolated safely. Typical cause: node identity/topology mismatch during `lerpResolvedLayouts`.
|
|
76
|
+
|
|
77
|
+
## MachinaText diagnostics
|
|
78
|
+
|
|
79
|
+
- `unsupported_syntax` — source includes unsupported markdown-like construct. Typical cause: blockquotes, task lists, ordered lists, fences, HTML, or unsupported source kind.
|
|
80
|
+
- `heading_forbidden` — heading syntax was used. Typical cause: `#`, `##`, etc. in MachinaText content.
|
|
81
|
+
- `max_list_depth_exceeded` — bullet nesting exceeds supported depth. Typical cause: lists nested deeper than policy allows.
|
|
82
|
+
- `malformed_link` — link syntax is invalid. Typical cause: missing delimiters or empty label/href shape.
|
|
83
|
+
- `unclosed_inline` — inline marker was not closed. Typical cause: unmatched `*`, `**`, or backtick markers.
|
|
84
|
+
- `invalid_escape` — escape sequence is unsupported or dangling. Typical cause: unknown escape like `\q` or trailing `\`.
|