@floless/app 0.137.4 → 0.138.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.
Files changed (47) hide show
  1. package/dist/floless-server.cjs +47618 -26808
  2. package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -0
  3. package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +32 -0
  4. package/dist/schemas/steel.model.v2.schema.json +218 -27
  5. package/dist/skills/floless-app-knowledge/SKILL.md +5 -2
  6. package/dist/skills/floless-app-rfi/SKILL.md +410 -0
  7. package/dist/skills/floless-app-routines/SKILL.md +7 -2
  8. package/dist/skills/floless-app-routines/references/routines-api.md +14 -5
  9. package/dist/skills/floless-app-steel-model/SKILL.md +34 -32
  10. package/dist/skills/floless-app-steel-takeoff/SKILL.md +498 -34
  11. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +6 -6
  12. package/dist/skills/floless-app-tweak-contract/SKILL.md +6 -2
  13. package/dist/templates/floless-workspace-knowledge.flo +20 -4
  14. package/dist/templates/steel-model.flo +27 -15
  15. package/dist/web/app.css +559 -131
  16. package/dist/web/app.js +216 -54
  17. package/dist/web/aware.js +982 -128
  18. package/dist/web/checkpoint-standard.js +218 -0
  19. package/dist/web/commands-filter.js +23 -0
  20. package/dist/web/commands-shell.js +237 -5
  21. package/dist/web/commands-steel.js +172 -47
  22. package/dist/web/connection-review-client.js +2 -2
  23. package/dist/web/display-units.js +243 -0
  24. package/dist/web/grid-core.js +470 -56
  25. package/dist/web/grid-display.js +344 -0
  26. package/dist/web/index.html +106 -66
  27. package/dist/web/instructor-reporter.js +5 -0
  28. package/dist/web/instructor.js +175 -33
  29. package/dist/web/json-schema-subset.js +145 -25
  30. package/dist/web/steel-3d-core.js +124 -140
  31. package/dist/web/steel-3d-view.js +352 -100
  32. package/dist/web/steel-catalog-picker.js +98 -15
  33. package/dist/web/steel-detail-refs.js +1 -1
  34. package/dist/web/steel-editor.html +6458 -915
  35. package/dist/web/steel-filter.html +404 -57
  36. package/dist/web/steel-model-adapter.js +1 -1
  37. package/dist/web/steel-model-commands.js +71 -64
  38. package/dist/web/steel-model-v2-client-validation.js +10 -3
  39. package/dist/web/steel-model-v2-commands.js +268 -76
  40. package/dist/web/steel-model-v2-projection.js +18 -17
  41. package/dist/web/steel-plan-transform.js +13 -13
  42. package/dist/web/steel-plan-view-id.js +1 -7
  43. package/dist/web/steel-read-confidence.js +454 -5
  44. package/dist/web/steel-units.js +17 -3
  45. package/dist/web/steel-view-generation.js +21 -7
  46. package/dist/web/workspaces.js +2178 -497
  47. package/package.json +4 -1
@@ -0,0 +1,344 @@
1
+ /*
2
+ * grid-display.js — the Grid pane's ONE boundary between canonical millimetres and text a person reads.
3
+ *
4
+ * WHY THIS FILE EXISTS. The pane prints roughly eight kinds of string, and a first attempt made each
5
+ * render site units-aware on its own. It cost three review rounds — 1 defect, then 5, then 3 — with the
6
+ * second and third rounds finding defects IN the previous round's fixes. Every one was the same class: a
7
+ * units-dependent value reaching somewhere it should not, or a seam threaded and then supplied by nobody.
8
+ * Eight sites is eight independent chances to leak display into storage, so the shape changed rather than
9
+ * the details.
10
+ *
11
+ * THE INVARIANT, AS A DIRECTION OF TRAVEL RATHER THAN A COUNT. The first draft of the rule said "one
12
+ * function produces every string the pane prints", and that phrasing was itself the hole: the pane also
13
+ * produces a STORAGE string (`normZ`) which looks exactly like a display string and is handed to
14
+ * persistence at two live call sites, so the rule as written pointed an implementer at the bug it was
15
+ * meant to prevent. What actually holds:
16
+ *
17
+ * DOWN Anything this file returns may be assigned to `el.value`, `textContent` or an attribute, and
18
+ * NOTHING else. It is never parsed, never compared against stored data, never given to
19
+ * `patchGrid`. Display output is write-only to the DOM.
20
+ * UP Every value the pane commits is re-derived: a number from a `read*` below, or a storage string
21
+ * from `grid-core`'s own writer. Never `el.value`.
22
+ *
23
+ * The storage writers deliberately live in `grid-core` and are NOT re-exported here, so "did this string
24
+ * come from the display side or the storage side" is answerable by looking at which module it came from.
25
+ *
26
+ * FT-IN CANNOT MOVE. On the imperial side every string is produced by the EXISTING `grid-core` speller —
27
+ * `fmtLen`, `formatSpacings`, `formatLevels` — never by `display-units.formatLength`. The two disagree at
28
+ * zero (`0'-0"` vs `0"`) and on a level that does not divide into sixteenths (`0'-0", 3000mm` vs
29
+ * `9'-10 1/8"`), and routing US text through the newer formatter is how the first attempt moved it twice.
30
+ * That is why this file imports both spellers and picks between them rather than having one.
31
+ *
32
+ * A LABEL IS FREE TEXT, FOREVER. `labels_z` holds whatever someone typed — "Ground Floor", "Roof — Plant".
33
+ * It is never parsed, never re-spelled, never assumed numeric. The trap a units-aware display layer walks
34
+ * into is noticing that a label like `3000` or `12'-0"` reads as a length and helpfully re-spelling it;
35
+ * the only place units may decide what a level is CALLED is when it has no label at all.
36
+ */
37
+
38
+ import * as gc from './grid-core.js';
39
+ import { MM, normalizeDisplayUnits, formatLength, formatElevation, parseElevationMm } from './display-units.js';
40
+
41
+ const metric = (units) => normalizeDisplayUnits(units) === MM;
42
+
43
+ /* ─── DOWN: canonical millimetres → text ──────────────────────────────────────────────────────────── */
44
+
45
+ /**
46
+ * An ELEVATION as the pane prints it: signed metres in a metric project, the architectural form in a US
47
+ * one. `gc.fmtLen` and not `formatLength`, per the ft-in rule above.
48
+ */
49
+ export function elevationText(mm, units) {
50
+ return metric(units) ? formatElevation(mm, MM) : gc.fmtLen(mm);
51
+ }
52
+
53
+ /** A LENGTH as the pane prints it — bare millimetres, or the architectural form. */
54
+ export function lengthText(mm, units) {
55
+ return metric(units) ? formatLength(mm, MM) : gc.fmtLen(mm);
56
+ }
57
+
58
+ /**
59
+ * What a level is CALLED — the single answer, used by the pane and by the 3D elevation tag.
60
+ *
61
+ * DELIBERATELY NOT the level row's `<span>`, its placeholder, or its "Label for level …" name. Those must
62
+ * stay the ELEVATION: a named level rendered through this function would read "Ground Floor" beside an
63
+ * input placeholdered "Ground Floor", with nothing anywhere in the row saying which height it is. The
64
+ * three sites this belongs to are the command instance key's first term, the "Show {name} at {elevation}"
65
+ * name slot, and the 3D tag.
66
+ *
67
+ * `authored` rather than `label`, because `label` already carries `fmtLen(mm)` as its fallback and would
68
+ * pin the tag to feet and inches forever. Reading `authored` is also what keeps a label that happens to
69
+ * parse as a number — `3000`, `12'-0"` — verbatim: it is never inspected, only tested for emptiness.
70
+ */
71
+ export function levelDisplayName(level, units) {
72
+ const authored = level && typeof level.authored === 'string' ? level.authored : '';
73
+ return authored || elevationText(level && level.mm, units);
74
+ }
75
+
76
+ /**
77
+ * Cumulative offsets (mm) → the spacing string the pane SHOWS. Storage is `grid-core`'s job, not this.
78
+ *
79
+ * THE RUN COMPRESSION READS THE CANONICAL MILLIMETRES, not the spelled tokens, and that is the whole
80
+ * reason this is not a one-liner. `formatSpacings` compresses over its tokens, which is right for it
81
+ * because `spacingToken` resolves to a sixteenth of an inch or to an exact millimetre value. A metric
82
+ * token resolves to a TENTH of a millimetre, so compressing over tokens would spell bays of 6000.75 and
83
+ * 6000.79 both as `6000.8` and then fuse them into `2*6000.8` — the pane asserting an equality that is
84
+ * false. Comparing the offsets first, on `grid-core`'s own dust tolerance, keeps a genuinely uniform run
85
+ * compressed (float dust across `[0, d, 2d, 3d, 4d]` is orders below it) while refusing to invent one.
86
+ */
87
+ export function spacingsText(offsets, units) {
88
+ // NORMALISED once, then handed on. `grid-core`'s speller takes `'mm'`/`'ft-in'` and throws on
89
+ // anything else (#1238), while this file's own contract accepts whatever a caller's preference
90
+ // holds — `normalizeDisplayUnits` is the seam between the two, and passing the raw value straight
91
+ // through would turn a display-layer shrug into a throw from storage.
92
+ const u = normalizeDisplayUnits(units);
93
+ if (u !== MM) return gc.formatSpacings(offsets, u);
94
+ const list = offsets || [];
95
+ if (!list.length) return '';
96
+ const bays = list.map((v, i) => v - (i ? list[i - 1] : 0));
97
+ const out = [];
98
+ for (let i = 0; i < bays.length;) {
99
+ let j = i + 1;
100
+ while (j < bays.length && Math.abs(bays[j] - bays[i]) <= gc.SPACING_DUST_MM) j++;
101
+ const n = j - i, tok = formatLength(bays[i], MM);
102
+ out.push(n > 1 ? n + '*' + tok : tok);
103
+ i = j;
104
+ }
105
+ return out.join(', ');
106
+ }
107
+
108
+ /** Canonical level elevations (mm) → the Levels string the pane SHOWS. */
109
+ export function levelsText(levels, units) {
110
+ if (!metric(units)) return gc.formatLevels(levels);
111
+ return (levels || []).map((mm) => formatElevation(mm, MM)).join(', ');
112
+ }
113
+
114
+ /* ─── UP: text → canonical millimetres ────────────────────────────────────────────────────────────── */
115
+
116
+ /**
117
+ * A typed SPACING string, and a typed EXTENSION. Both delegate, in both unit systems, and that is a
118
+ * finding rather than an oversight: `grid-core` already reads a bare number as millimetres, which is
119
+ * already the right answer for a metric project — so the field renders `0, 4*6000` and reads `0, 4*6000`
120
+ * back, a matched pair with nothing to change. Only the Levels field's grammar actually forks, because
121
+ * only it displays metres.
122
+ *
123
+ * They exist anyway, because the invariant is only enforceable if it is TOTAL. "Every committed number
124
+ * comes from a `read*`" is checkable; "…except the two that call grid-core directly" is a rule with a
125
+ * hole in exactly the place a future unit would land.
126
+ */
127
+ export const readSpacings = (text) => gc.parseSpacings(text);
128
+ export const readExtensionMm = (text) => gc.parseLen(text);
129
+
130
+ /** Each parsed level parse carries the tokens AS THE READER SAW THEM, plus their millimetres. */
131
+ const withTokenMm = (parsed, tokenMm) => ({ ...parsed, tokenMm });
132
+
133
+ /**
134
+ * The stored `grid.z`, parsed for RENDERING. Unit-neutral by construction — a stored string is storage
135
+ * grammar whatever the reader is displaying.
136
+ */
137
+ export function readStoredLevels(grid) {
138
+ const g = grid || {};
139
+ const parsed = gc.parseLevels(g.z, g.labels_z);
140
+ return withTokenMm(parsed, (parsed.tokens || []).map((t) => {
141
+ const mm = gc.parseLen(t);
142
+ return Number.isFinite(mm) ? mm : null;
143
+ }));
144
+ }
145
+
146
+ /**
147
+ * A TYPED Levels string → canonical millimetres. The true inverse of `levelsText`.
148
+ *
149
+ * In ft-in this is `gc.parseLevels` verbatim, so a US project's behaviour is byte-identical.
150
+ *
151
+ * In metric it REWRITES each token into storage grammar and hands the whole string back to
152
+ * `gc.parseLevels`: `+0.000, +4.200` becomes `0mm, 4200mm`. Token count and order are preserved, so label
153
+ * pairing, `sourceIndex`, de-duplication, sorting and every warning keep working untouched and no
154
+ * validation is reimplemented. Three details carry the weight:
155
+ *
156
+ * TOKENISE WITH `gc.lengthTokens`, not a hand-rolled split. It has three branches (comma-split,
157
+ * whole-string-single-token, whitespace-split) and a naive split diverges: `5 3/4` is REFUSED by
158
+ * grid-core with "Separate values with commas", but a whitespace split would turn it into two invented
159
+ * levels of 5000 mm and 19.05 mm.
160
+ *
161
+ * SPELL WITH `gc.millimetreToken`, not `String(mm)`. A metre parse multiplies by 1000, so `+1.005`
162
+ * arrives as 1004.9999999999999, and `String` goes exponential past ~1e21 where `parseLen` has no
163
+ * exponent in its grammar — which would not lose one value, it would make the WHOLE string unreadable,
164
+ * from a token that parsed FINE. `millimetreToken` heals the first and returns null for the second.
165
+ *
166
+ * REPORT A REFUSED TOKEN AS THE USER TYPED IT, mapped by index. The rewritten form is an internal
167
+ * detail and must never reach a message; and because the exponential case parses successfully, the map
168
+ * cannot key on "which token failed to parse".
169
+ */
170
+ export function readLevels(text, labels, units) {
171
+ if (!metric(units)) return readTypedImperial(text, labels);
172
+ const split = gc.lengthTokens(text, false);
173
+ if (split.err) return withTokenMm({ levels: [], err: split.err, warnings: [], tokens: [] }, []);
174
+ const tokens = split.tokens;
175
+ const tokenMm = [];
176
+ const rewritten = [];
177
+ for (const token of tokens) {
178
+ const mm = parseElevationMm(token, MM);
179
+ // `== null`, not `isFinite(...)`. Global `isFinite(null)` is TRUE, and the previous parser signalled
180
+ // failure with NaN where this one signals it with null — so an unreadable token used to survive as a
181
+ // level with `mm: null`, which then collided with zero and was reported to the user as a duplicate.
182
+ const spelled = mm == null ? null : gc.millimetreToken(mm);
183
+ if (spelled == null) {
184
+ return withTokenMm({ levels: [], err: 'can’t read “' + token + '”', warnings: [], tokens }, tokenMm);
185
+ }
186
+ tokenMm.push(mm);
187
+ rewritten.push(spelled);
188
+ }
189
+ const parsed = gc.parseLevels(rewritten.join(', '), labels);
190
+ // The tokens the CALLER saw, not the rewritten ones — every message downstream quotes these.
191
+ return withTokenMm({ ...parsed, tokens }, tokenMm);
192
+ }
193
+
194
+ function readTypedImperial(text, labels) {
195
+ const parsed = gc.parseLevels(text, labels);
196
+ return withTokenMm(parsed, (parsed.tokens || []).map((t) => {
197
+ const mm = gc.parseLen(t);
198
+ return Number.isFinite(mm) ? mm : null;
199
+ }));
200
+ }
201
+
202
+ /* ─── Readouts and warnings ───────────────────────────────────────────────────────────────────────── */
203
+
204
+ /**
205
+ * The duplicate / orphan sentence under the Levels field.
206
+ *
207
+ * SPELLS THE ELEVATION, rather than echoing the token it came from. Echoing is what the code did, and it
208
+ * is wrong on BOTH paths once units enter: on render the tokens are STORAGE notation, so a metric pane
209
+ * would say "Duplicate elevation 4200mm was ignored" under a field reading `+4.200`; on a keystroke the
210
+ * tokens would be the rewritten form, so someone who typed `13'-9 3/8"` would be told about a
211
+ * `4200.525mm` they never wrote. The token is kept only as the fallback for a value that has no
212
+ * millimetres to spell.
213
+ */
214
+ export function levelWarningText(parsed, units) {
215
+ const parts = [], seen = new Set();
216
+ const tokens = (parsed && parsed.tokens) || [], tokenMm = (parsed && parsed.tokenMm) || [];
217
+ const say = (i) => (tokenMm[i] == null ? (tokens[i] || 'this elevation') : elevationText(tokenMm[i], units));
218
+ for (const w of ((parsed && parsed.warnings) || [])) {
219
+ if (w.kind !== 'duplicate-label' && w.kind !== 'duplicate-level') continue;
220
+ if (seen.has(w.sourceIndex)) continue;
221
+ seen.add(w.sourceIndex);
222
+ parts.push(w.kind === 'duplicate-label'
223
+ ? `Duplicate elevation ${say(w.sourceIndex)}: the first label was kept; the later label remains saved as an extra.`
224
+ : `Duplicate elevation ${say(w.sourceIndex)} was ignored.`);
225
+ }
226
+ const orphan = ((parsed && parsed.warnings) || []).filter((w) => w.kind === 'orphan-label').length;
227
+ if (orphan) parts.push(`${orphan} saved label${orphan === 1 ? ' has' : 's have'} no matching elevation.`);
228
+ return parts.join(' ');
229
+ }
230
+
231
+ /**
232
+ * The grey line under an X or Y spacing field: how many lines, which names, how long the run is.
233
+ *
234
+ * Takes a PARSE and the resolved labels, never the DOM. On render the caller passes the parse of the
235
+ * stored grid; on a keystroke, the parse of what was typed. That split is the structural fix for the
236
+ * defect where the pane rendered metres and then re-read its own field with a millimetre grammar — the
237
+ * rendered text is never the input, because a display string is lossy (`+4.451` reads back 4451, not
238
+ * 4450.7) and the model is not.
239
+ */
240
+ export function spacingReadout(parsed, labels, units, emptyMsg) {
241
+ if (parsed.err) {
242
+ return { className: 'gerr', invalid: true,
243
+ text: parsed.err.replace(/^c/, 'C') + (parsed.err.indexOf('read') >= 0 ? gridPaneCopy(units).spacingErrHint : '') };
244
+ }
245
+ const offsets = parsed.offsets || [];
246
+ if (!offsets.length) return { className: 'gfb', invalid: false, text: emptyMsg };
247
+ const run = offsets[offsets.length - 1] - offsets[0];
248
+ const names = labels[0] + (offsets.length > 1 ? '–' + labels[labels.length - 1] : '');
249
+ // The suffix earns its space here and nowhere else in the pane: this is a value echoed back at someone
250
+ // who just typed into the field above it, and a bare `24000` cannot say whether it is a length, a
251
+ // coordinate or a count. The imperial form is self-labelling already, so it takes no suffix and does
252
+ // not move.
253
+ const total = run > 0 ? ' · ' + lengthText(run, units) + (metric(units) ? ' mm' : '') + ' total' : '';
254
+ return { className: 'gfb', invalid: false,
255
+ text: offsets.length + ' line' + (offsets.length === 1 ? '' : 's') + ' · ' + names + total };
256
+ }
257
+
258
+ /** The grey line under the Levels field. */
259
+ export function levelReadout(parsed, units) {
260
+ if (parsed.err) return { className: 'gerr', invalid: true, text: parsed.err };
261
+ const n = (parsed.levels || []).length;
262
+ const warning = levelWarningText(parsed, units);
263
+ const count = n ? (n + ' level' + (n === 1 ? '' : 's')) : 'No levels — grid draws at elevation 0 in 3D.';
264
+ return { className: warning ? 'gerr' : 'gfb', invalid: false, text: count + (warning ? ' · ' + warning : '') };
265
+ }
266
+
267
+ /* ─── Copy that depends on the units but not on the grid ──────────────────────────────────────────── */
268
+
269
+ /**
270
+ * Hints, placeholders and the one unit-bearing tooltip.
271
+ *
272
+ * SEPARATE FROM `gridPaneText` because the pane's NO-GRID branch needs it and has no grid to pass. The
273
+ * tokens hint exists as two literals — one per branch — and a review found only the first of them.
274
+ *
275
+ * The metric copy leads with the grammar a metric project actually uses and demotes the imperial tokens
276
+ * to "also accepted", rather than translating the imperial sentence word for word: a UK engineer typing
277
+ * into this field types bare millimetres, and `25'-6"` is there so an imported US detail still pastes.
278
+ */
279
+ export function gridPaneCopy(units) {
280
+ if (!metric(units)) {
281
+ return Object.freeze({
282
+ tokens: 'A plan reference — doesn\'t constrain members. <b>n*d</b> repeats a bay (e.g. <b>3*25\'</b>); tokens: <b>25\'-6"</b>, <b>6"</b>, <b>7.5m</b>, bare mm.',
283
+ tokensBlank: 'Spacing uses <b>n*d</b> to repeat (e.g. <b>3*25\'</b> = three 25\' bays). Tokens: <b>25\'-6"</b>, <b>6"</b>, <b>7.5m</b>, bare mm.',
284
+ xPlaceholder: 'e.g. 0\'-0", 3*25\'-0", 20\'-6 1/2"',
285
+ yPlaceholder: 'e.g. 0\'-0", 4*30\'-0"',
286
+ zPlaceholder: 'e.g. 0\'-0", 16\'-6", 33\'-0"',
287
+ blankTip: 'Start from a 4×4 grid of 30\' bays and edit the spacings. Undoable.',
288
+ // A US value carries its unit in its own punctuation, so the headers say nothing extra and stay
289
+ // byte-identical to what they have always been.
290
+ xUnit: '', yUnit: '', zUnit: '',
291
+ // The example inside a spacing PARSE ERROR. It lived as a literal inside `spacingReadout` and was
292
+ // the last imperial string a metric project could still be shown - reachable with no typing at all,
293
+ // by storing an unreadable `grid.x`.
294
+ spacingErrHint: " — expected n*distance, like 3*25'.",
295
+ });
296
+ }
297
+ return Object.freeze({
298
+ tokens: 'A plan reference — doesn\'t constrain members. <b>n*d</b> repeats a bay (e.g. <b>3*6000</b>); tokens: bare mm, <b>7.5m</b>, or imported <b>25\'-6"</b>, <b>6"</b>.',
299
+ tokensBlank: 'Spacing uses <b>n*d</b> to repeat (e.g. <b>3*6000</b> = three 6000 mm bays). Tokens: bare mm, <b>7.5m</b>, or imported <b>25\'-6"</b>, <b>6"</b>.',
300
+ xPlaceholder: 'e.g. 0, 3*6000, 8500',
301
+ yPlaceholder: 'e.g. 0, 4*7500',
302
+ zPlaceholder: 'e.g. +0.000, +4.200, +8.400',
303
+ blankTip: 'Start from a 4×4 grid of 6000 mm bays and edit the spacings. Undoable.',
304
+ // THE ONE THING THIS CHANGE COSTS A READER, repaid. `25'-6"` cannot be misread; a bare `6000` can,
305
+ // and the pane shows millimetres (spacings) beside metres (levels) with nothing marking the
306
+ // difference. A UK drawing declares that convention once per sheet; this pane never did.
307
+ xUnit: ' · mm', yUnit: ' · mm', zUnit: ' · m',
308
+ spacingErrHint: ' — expected n*distance, like 3*6000.',
309
+ });
310
+ }
311
+
312
+ /* ─── The pane's value-bearing strings ────────────────────────────────────────────────────────────── */
313
+
314
+ /**
315
+ * Every value-bearing string the has-grid branch prints, from the canonical grid.
316
+ *
317
+ * TAKES THE GRID, not pre-parsed offsets, so it can reproduce the pane's own parse-error fallback: an
318
+ * unreadable stored string is shown RAW, which is how a user can see and repair it. Signatures over
319
+ * `offsets` / `levels` cannot — those are `[]` on an error, and an unreadable grid would silently render
320
+ * as an empty one.
321
+ *
322
+ * Strings only, and frozen. There is nothing in here a `patchGrid` could want.
323
+ */
324
+ export function gridPaneText(grid, units) {
325
+ const g = grid || {};
326
+ const X = gc.parseSpacings(g.x), Y = gc.parseSpacings(g.y), Z = readStoredLevels(g);
327
+ // `isFinite`, NOT `Number.isFinite`, and the looseness is deliberate: `isFinite(null)` is true, so a
328
+ // null `ext` renders `0'-0"` in a US project today. Tightening it would fall through to the 1524
329
+ // default and render `5'-0"` instead — a US text move, which is the one thing this change may not do.
330
+ // `ext` is `type: "number"` in the schema, so null is not valid data anyway, and the identical
331
+ // expression in `gridGeometry` would then disagree with this one. `Number(...)` only so the metric
332
+ // side spells `0` rather than blank; `gc.fmtLen` already coerces, so ft-in is unaffected.
333
+ const extMm = isFinite(g.ext) ? Number(g.ext) : 1524;
334
+ return Object.freeze({
335
+ x: X.err ? String(g.x || '') : spacingsText(X.offsets, units),
336
+ y: Y.err ? String(g.y || '') : spacingsText(Y.offsets, units),
337
+ z: Z.err ? String(g.z || '') : levelsText(Z.levels.map((l) => l.mm), units),
338
+ ext: lengthText(extMm, units),
339
+ levels: Object.freeze((Z.err ? [] : Z.levels).map((lv) => Object.freeze({
340
+ elevation: elevationText(lv.mm, units),
341
+ name: levelDisplayName(lv, units),
342
+ }))),
343
+ });
344
+ }