@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.
- package/dist/floless-server.cjs +47618 -26808
- package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -0
- package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +32 -0
- package/dist/schemas/steel.model.v2.schema.json +218 -27
- package/dist/skills/floless-app-knowledge/SKILL.md +5 -2
- package/dist/skills/floless-app-rfi/SKILL.md +410 -0
- package/dist/skills/floless-app-routines/SKILL.md +7 -2
- package/dist/skills/floless-app-routines/references/routines-api.md +14 -5
- package/dist/skills/floless-app-steel-model/SKILL.md +34 -32
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +498 -34
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +6 -6
- package/dist/skills/floless-app-tweak-contract/SKILL.md +6 -2
- package/dist/templates/floless-workspace-knowledge.flo +20 -4
- package/dist/templates/steel-model.flo +27 -15
- package/dist/web/app.css +559 -131
- package/dist/web/app.js +216 -54
- package/dist/web/aware.js +982 -128
- package/dist/web/checkpoint-standard.js +218 -0
- package/dist/web/commands-filter.js +23 -0
- package/dist/web/commands-shell.js +237 -5
- package/dist/web/commands-steel.js +172 -47
- package/dist/web/connection-review-client.js +2 -2
- package/dist/web/display-units.js +243 -0
- package/dist/web/grid-core.js +470 -56
- package/dist/web/grid-display.js +344 -0
- package/dist/web/index.html +106 -66
- package/dist/web/instructor-reporter.js +5 -0
- package/dist/web/instructor.js +175 -33
- package/dist/web/json-schema-subset.js +145 -25
- package/dist/web/steel-3d-core.js +124 -140
- package/dist/web/steel-3d-view.js +352 -100
- package/dist/web/steel-catalog-picker.js +98 -15
- package/dist/web/steel-detail-refs.js +1 -1
- package/dist/web/steel-editor.html +6458 -915
- package/dist/web/steel-filter.html +404 -57
- package/dist/web/steel-model-adapter.js +1 -1
- package/dist/web/steel-model-commands.js +71 -64
- package/dist/web/steel-model-v2-client-validation.js +10 -3
- package/dist/web/steel-model-v2-commands.js +268 -76
- package/dist/web/steel-model-v2-projection.js +18 -17
- package/dist/web/steel-plan-transform.js +13 -13
- package/dist/web/steel-plan-view-id.js +1 -7
- package/dist/web/steel-read-confidence.js +454 -5
- package/dist/web/steel-units.js +17 -3
- package/dist/web/steel-view-generation.js +21 -7
- package/dist/web/workspaces.js +2178 -497
- package/package.json +4 -1
|
@@ -89,7 +89,7 @@ function createModelAdapterV2(contract) {
|
|
|
89
89
|
* A v2 plan still carries `frame`, stored in that plan's display space by design. The transform that
|
|
90
90
|
* would carry it into world mm is not persisted in the native model.
|
|
91
91
|
*
|
|
92
|
-
* So scaling by `
|
|
92
|
+
* So scaling by `mm_per_px` and flipping Y would
|
|
93
93
|
* yield a SHEET-LOCAL mm frame published under a WORLD-mm contract. That is the same fabrication this
|
|
94
94
|
* boundary refuses when it reports null instead of substituting `default_tos` for an unreadable
|
|
95
95
|
* elevation, and it would be harder to notice: a plausible frame, silently in the wrong space.
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* P3b-2b closed the last four: `swapMemberEnds` (member reverse), `_dpCommit` (the inspector's
|
|
19
19
|
* definition-point coordinate fields), `dimEditCommit` (a typed dimension value driving a pinned member),
|
|
20
20
|
* and the dim-grip drag inside the `dimend` pointermove. All four reused the primitives above; none needed
|
|
21
|
-
* a new one.
|
|
21
|
+
* a new one. The brace inspector's type, floor, offset and flip controls likewise route through
|
|
22
|
+
* `patchMemberBrace`; the v2 session merges those display-only fields into the canonical brace object.
|
|
22
23
|
*
|
|
23
24
|
* SO: NO MEMBER WORK-POINT WRITER BYPASSES THIS SEAM ANY MORE. A sweep of `web/steel-editor.html` for
|
|
24
25
|
* `.wp =` / `.wp[i] =` now returns exactly three hits, and none is a live geometry write:
|
|
@@ -31,13 +32,14 @@
|
|
|
31
32
|
* the `m.col` swap this module's previous header called out as unclaimed), `syncDefaults`, the "reset all
|
|
32
33
|
* ends to default" button, BOTH inspectors' TOS checkbox + input handlers, BOTH inspectors' BOS inputs,
|
|
33
34
|
* BOTH `matchEnds` buttons, `_dpCommit`'s three `zChg` branches, `onElevateMember` and `onBasePick`.
|
|
34
|
-
* A sweep for `.
|
|
35
|
+
* A sweep for `.tosMm =` / `.bosMm =` / `.tosDef =` now returns ZERO hits.
|
|
35
36
|
*
|
|
36
37
|
* The remaining `.ends =` / `.col =` writes are all MEMBER CONSTRUCTION, deliberately out of scope:
|
|
37
38
|
* `doSplit`'s fresh end objects on the two halves, `onAddMember3d` building a new member's initial shape,
|
|
38
39
|
* and `mergeCollinearJS` on its detached copy. Building a member and re-elevating one are different
|
|
39
40
|
* operations; a member constructor is its own unit, and P3c-3's review round 2 (D7) confirmed it is NOT
|
|
40
|
-
* P3c-3's — an earlier version of this line labelled it so.
|
|
41
|
+
* P3c-3's — an earlier version of this line labelled it so. Brace inspector edits are no longer in that
|
|
42
|
+
* unclaimed set: they route through `patchMemberBrace`, as noted above.
|
|
41
43
|
*
|
|
42
44
|
* P3c-2a GREW THE FIRST PLAN-LEVEL SURFACE — the first thing this boundary owns that is not addressed by
|
|
43
45
|
* member. Fifteen statements routed: the grid OBJECT's identity (`gridEnsureForLine`'s construction,
|
|
@@ -148,10 +150,10 @@
|
|
|
148
150
|
|
|
149
151
|
import { V2CommandError, dispatchV2ProjectionCommand } from './steel-model-v2-commands.js';
|
|
150
152
|
import { IN_TO_MM as IN_MM } from './steel-units.js';
|
|
151
|
-
import { gridLabelPatch,
|
|
153
|
+
import { gridLabelPatch, sheetScaleMm } from './grid-core.js';
|
|
152
154
|
|
|
153
|
-
/** Display-pixel scale for one plan — the shared
|
|
154
|
-
const scaleOf = (plan) =>
|
|
155
|
+
/** Display-pixel scale for one plan — the shared guard, not a fourth copy to keep in lock-step. */
|
|
156
|
+
const scaleOf = (plan) => sheetScaleMm(plan && plan.mm_per_px);
|
|
155
157
|
|
|
156
158
|
/** Kill float noise before it persists into `wp` — the same r6 the three inline call sites applied. */
|
|
157
159
|
const r6 = (n) => Math.round(n * 1e6) / 1e6;
|
|
@@ -198,16 +200,16 @@ export function deepFreezeProjection(value) {
|
|
|
198
200
|
*/
|
|
199
201
|
export function mmToDispOffsets(plan, offsMm) {
|
|
200
202
|
const k = scaleOf(plan);
|
|
201
|
-
return offsMm.map(o => [r6(o[0] / k), r6(-o[1] / k), r6(
|
|
203
|
+
return offsMm.map(o => [r6(o[0] / k), r6(-o[1] / k), r6(o[2] || 0)]); // x/y to display px; Z stays WORLD MM (it used to be divided into inches for the editor's old sub-world)
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
/** Normalise a member's optional metadata in place. Moved verbatim from steel-editor.html's `function ensureMeta`. */
|
|
205
207
|
export function ensureMeta(m) {
|
|
206
208
|
if (!m.role) m.role = 'beam';
|
|
207
209
|
const moment = /(^|[^A-Z])MF/i.test(m.profile || '') ? 'moment' : '';
|
|
208
|
-
if (!m.ends) m.ends = [{
|
|
209
|
-
{
|
|
210
|
-
if (!m.col) m.col = {
|
|
210
|
+
if (!m.ends) m.ends = [{ tosMm: null, note: moment, tosDef: true, detail: '' },
|
|
211
|
+
{ tosMm: null, note: moment, tosDef: true, detail: '' }];
|
|
212
|
+
if (!m.col) m.col = { bosMm: null, tosMm: null, note: moment, tosDef: true, detail: '' };
|
|
211
213
|
return m;
|
|
212
214
|
}
|
|
213
215
|
|
|
@@ -226,9 +228,9 @@ export function retargetTos(m, srcDef, dstDef) {
|
|
|
226
228
|
if (dispatchV2ProjectionCommand(m, 'retargetTos', [srcDef, dstDef])) return m;
|
|
227
229
|
const d = dstDef - srcDef; ensureMeta(m);
|
|
228
230
|
if (m.role === 'column') {
|
|
229
|
-
if (m.col.tosDef !== false) m.col.
|
|
230
|
-
if (m.col.
|
|
231
|
-
} else for (const en of m.ends) { if (en.tosDef !== false) en.
|
|
231
|
+
if (m.col.tosDef !== false) m.col.tosMm = dstDef; else if (m.col.tosMm != null) m.col.tosMm += d;
|
|
232
|
+
if (m.col.bosMm != null) m.col.bosMm += d;
|
|
233
|
+
} else for (const en of m.ends) { if (en.tosDef !== false) en.tosMm = dstDef; else if (en.tosMm != null) en.tosMm += d; }
|
|
232
234
|
return m;
|
|
233
235
|
}
|
|
234
236
|
|
|
@@ -237,7 +239,7 @@ export function retargetTos(m, srcDef, dstDef) {
|
|
|
237
239
|
* A SECOND AXIS, not more geometry. Everything P3a–P3b-2b closed writes `m.wp`; these write `tos`, `bos`
|
|
238
240
|
* and `tosDef` on `m.col` / `m.ends[i]`. They are free functions rather than methods on
|
|
239
241
|
* `createModelCommands` because not one of them needs the contract, the active plan or the id policy —
|
|
240
|
-
* and `onElevateMember` in particular must NOT reach for the boundary's `
|
|
242
|
+
* and `onElevateMember` in particular must NOT reach for the boundary's `defaultTosMm` (see `elevateBy`).
|
|
241
243
|
*
|
|
242
244
|
* One primitive per distinct WRITE SHAPE, not per call site. Consolidating further would unify behaviours
|
|
243
245
|
* that genuinely differ today, and reproducing those differences exactly is the point of a refactor.
|
|
@@ -256,9 +258,9 @@ export function elevTargets(m) {
|
|
|
256
258
|
* `tosDef=false` is NOT redundant with the checkbox having been unticked — a user can type into the field
|
|
257
259
|
* of an end that is still following the default, and that keystroke is what breaks the link.
|
|
258
260
|
*/
|
|
259
|
-
export function
|
|
260
|
-
if (dispatchV2ProjectionCommand(target, '
|
|
261
|
-
target.
|
|
261
|
+
export function setTosValueMm(target, mm) {
|
|
262
|
+
if (dispatchV2ProjectionCommand(target, 'setTosValueMm', [mm])) return;
|
|
263
|
+
target.tosMm = mm; target.tosDef = false;
|
|
262
264
|
}
|
|
263
265
|
|
|
264
266
|
/**
|
|
@@ -269,15 +271,15 @@ export function setTosValue(target, tos) {
|
|
|
269
271
|
* would be a feature, not this refactor. `applyTosAll` reuses this with `on=true` over every target,
|
|
270
272
|
* which is precisely its body.
|
|
271
273
|
*/
|
|
272
|
-
export function setTosDefault(target, on,
|
|
273
|
-
if (dispatchV2ProjectionCommand(target, 'setTosDefault', [on,
|
|
274
|
-
target.tosDef = on; if (on) target.
|
|
274
|
+
export function setTosDefault(target, on, defTosMm) {
|
|
275
|
+
if (dispatchV2ProjectionCommand(target, 'setTosDefault', [on, defTosMm])) return;
|
|
276
|
+
target.tosDef = on; if (on) target.tosMm = defTosMm;
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
/** A column's base elevation. The inspector BOS inputs, `_dpCommit`'s Bottom branch, and `onBasePick`. */
|
|
278
|
-
export function
|
|
279
|
-
if (dispatchV2ProjectionCommand(col, '
|
|
280
|
-
col.
|
|
280
|
+
export function setBosMm(col, mm) {
|
|
281
|
+
if (dispatchV2ProjectionCommand(col, 'setBosMm', [mm])) return;
|
|
282
|
+
col.bosMm = mm;
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
/**
|
|
@@ -288,56 +290,56 @@ export function setBos(col, bos) {
|
|
|
288
290
|
* - it re-datums only ends still FOLLOWING the default; an override survives. That is the whole
|
|
289
291
|
* difference from `applyTosAll`, which overwrites everything.
|
|
290
292
|
* - the `defTos != null` guard is LOCAL to this writer. The other elevation writers have no such guard,
|
|
291
|
-
* so hoisting it into `
|
|
292
|
-
* - it materialises `col.
|
|
293
|
+
* so hoisting it into `setTosValueMm` would change three other call sites.
|
|
294
|
+
* - it materialises `col.bosMm = 0` when null, and does so even when `defTosMm` IS null. Only the `tosMm`
|
|
293
295
|
* writes sit behind that guard.
|
|
294
296
|
*/
|
|
295
|
-
export function syncToDefault(m,
|
|
296
|
-
if (dispatchV2ProjectionCommand(m, 'syncToDefault', [
|
|
297
|
+
export function syncToDefault(m, defTosMm) {
|
|
298
|
+
if (dispatchV2ProjectionCommand(m, 'syncToDefault', [defTosMm])) return m;
|
|
297
299
|
ensureMeta(m);
|
|
298
300
|
if (m.role === 'column') {
|
|
299
|
-
if (m.col.tosDef !== false &&
|
|
300
|
-
if (m.col.
|
|
301
|
-
} else for (const en of m.ends) if (en.tosDef !== false &&
|
|
301
|
+
if (m.col.tosDef !== false && defTosMm != null) m.col.tosMm = defTosMm;
|
|
302
|
+
if (m.col.bosMm == null) m.col.bosMm = 0;
|
|
303
|
+
} else for (const en of m.ends) if (en.tosDef !== false && defTosMm != null) en.tosMm = defTosMm;
|
|
302
304
|
return m;
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
/**
|
|
306
|
-
* Raise or lower by `
|
|
308
|
+
* Raise or lower by `dMm` MILLIMETRES — the 3D Alt-drag (`onElevateMember`).
|
|
307
309
|
*
|
|
308
310
|
* `base` IS INJECTED, and that is the single most important thing about this function. The caller reads
|
|
309
|
-
* the OWNING SHEET's `
|
|
311
|
+
* the OWNING SHEET's `default_tos_mm`; the boundary's own `defaultTosMm` is the editor GLOBAL, which
|
|
310
312
|
* `translate` uses. Those two datums disagree, the disagreement is pre-existing, and this module's header
|
|
311
313
|
* already records that reproducing it exactly — rather than quietly unifying it — is the job. Resolving
|
|
312
314
|
* `base` in here would unify them invisibly.
|
|
313
315
|
*
|
|
314
|
-
* A column rises RIGIDLY: `
|
|
316
|
+
* A column rises RIGIDLY: `bosMm` shifts too (null → `0 + dMm`), so the column is moved, not stretched.
|
|
315
317
|
*/
|
|
316
|
-
export function elevateBy(m,
|
|
317
|
-
if (dispatchV2ProjectionCommand(m, 'elevateBy', [
|
|
318
|
+
export function elevateBy(m, dMm, base) {
|
|
319
|
+
if (dispatchV2ProjectionCommand(m, 'elevateBy', [dMm, base])) return m;
|
|
318
320
|
ensureMeta(m);
|
|
319
321
|
if (m.role === 'column') {
|
|
320
|
-
m.col.
|
|
321
|
-
m.col.
|
|
322
|
+
m.col.tosMm = (m.col.tosMm != null ? m.col.tosMm : base) + dMm;
|
|
323
|
+
m.col.bosMm = (m.col.bosMm != null ? m.col.bosMm : 0) + dMm;
|
|
322
324
|
m.col.tosDef = false;
|
|
323
|
-
} else m.ends.forEach(en => { en.
|
|
325
|
+
} else m.ends.forEach(en => { en.tosMm = (en.tosMm != null ? en.tosMm : base) + dMm; en.tosDef = false; });
|
|
324
326
|
return m;
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
/**
|
|
328
330
|
* Swap a column's top and bottom — the `m.col` half of `swapMemberEnds`.
|
|
329
331
|
*
|
|
330
|
-
* BOTH sides materialise first: `
|
|
332
|
+
* BOTH sides materialise first: `bosMm` null → 0 and `tosMm` null → `defTosMm`. Reading them before assigning
|
|
331
333
|
* either is what makes this a swap rather than a copy, and the temporaries are not stylistic.
|
|
332
334
|
* `tosDef` is forced false because a swapped top is by definition no longer the level default.
|
|
333
335
|
*
|
|
334
336
|
* Applied to ANY member carrying a `col`, which after `ensureMeta` is every member — a beam's vestigial
|
|
335
337
|
* `col` is swapped too. That is what the editor does today, and it is observable in the stored contract.
|
|
336
338
|
*/
|
|
337
|
-
export function swapColElevation(col,
|
|
338
|
-
if (dispatchV2ProjectionCommand(col, 'swapColElevation', [
|
|
339
|
-
const b = (col.
|
|
340
|
-
col.
|
|
339
|
+
export function swapColElevation(col, defTosMm) {
|
|
340
|
+
if (dispatchV2ProjectionCommand(col, 'swapColElevation', [defTosMm])) return col;
|
|
341
|
+
const b = (col.bosMm != null ? col.bosMm : 0), t = (col.tosMm != null ? col.tosMm : defTosMm);
|
|
342
|
+
col.bosMm = t; col.tosMm = b; col.tosDef = false;
|
|
341
343
|
return col;
|
|
342
344
|
}
|
|
343
345
|
|
|
@@ -366,7 +368,7 @@ export function reverseEnds(m) {
|
|
|
366
368
|
export function copyEndTo(m, from, to) {
|
|
367
369
|
if (dispatchV2ProjectionCommand(m, 'copyEndTo', [from, to])) return m;
|
|
368
370
|
const s = m.ends[from];
|
|
369
|
-
m.ends[to] = {
|
|
371
|
+
m.ends[to] = { tosMm: s.tosMm, note: s.note, tosDef: s.tosDef, detail: s.detail, conn: s.conn, connVerified: s.connVerified };
|
|
370
372
|
return m;
|
|
371
373
|
}
|
|
372
374
|
|
|
@@ -378,7 +380,7 @@ export function copyEndTo(m, from, to) {
|
|
|
378
380
|
* active one, and `setPlan` runs one of them mid-switch, when "active" is ambiguous.
|
|
379
381
|
*
|
|
380
382
|
* They are module-level exports, called as `ModelCmd.<fn>(…)`, exactly like the elevation set above: they
|
|
381
|
-
* need none of `createModelCommands`' captured `contract` / `activePlan` / `
|
|
383
|
+
* need none of `createModelCommands`' captured `contract` / `activePlan` / `defaultTosMm` / `mintId`.
|
|
382
384
|
*
|
|
383
385
|
* WRITES ONLY. A `planGrid(plan)` selector was drafted alongside these and cut before merge: it had no
|
|
384
386
|
* caller anywhere, and its docblock claimed a pairing with the mutators that did not exist in the code.
|
|
@@ -510,10 +512,10 @@ export function setGridLabels(grid, dir, labels) {
|
|
|
510
512
|
return patchGrid(grid, gridLabelPatch(grid, dir, labels));
|
|
511
513
|
}
|
|
512
514
|
|
|
513
|
-
/** The plan's own T.O.S datum. Distinct from the editor's GLOBAL `
|
|
514
|
-
export function
|
|
515
|
-
if (dispatchV2ProjectionCommand(plan, '
|
|
516
|
-
plan.
|
|
515
|
+
/** The plan's own T.O.S datum, in world MILLIMETRES. Distinct from the editor's GLOBAL `defaultTosMm` — see `elevateBy`. */
|
|
516
|
+
export function setPlanDefaultTosMm(plan, mm) {
|
|
517
|
+
if (dispatchV2ProjectionCommand(plan, 'setPlanDefaultTosMm', [mm])) return plan;
|
|
518
|
+
plan.default_tos_mm = mm; return plan;
|
|
517
519
|
}
|
|
518
520
|
|
|
519
521
|
/**
|
|
@@ -633,10 +635,14 @@ export function detachDimRefs(plan, ids) {
|
|
|
633
635
|
* module shim (`GC()`), so importing it here would fix a load order this module has no business owning —
|
|
634
636
|
* and the injection keeps the seam visible instead of hiding a second write surface behind an import.
|
|
635
637
|
*
|
|
636
|
-
* WHY A PASS-THROUGH IS NOT CEREMONY: `moveGridLine` converts px→mm inline (`mmPerPx
|
|
638
|
+
* WHY A PASS-THROUGH IS NOT CEREMONY: `moveGridLine` converts px→mm inline (`sheetScaleMm(mmPerPx)`) and emits
|
|
637
639
|
* a *spacing string*. Centralising that conversion is the entire point of v2, and this wrapper is where
|
|
638
640
|
* the interception will have to go. It looks thin today and is load-bearing later.
|
|
639
641
|
*
|
|
642
|
+
* `units` MUST be forwarded too, and for the same reason `base` must: it decides the authoring quantum
|
|
643
|
+
* the string is written at, and `grid-core` THROWS rather than defaulting when it is missing (#1148) —
|
|
644
|
+
* so a wrapper that drops it fails loudly here instead of silently writing a US grid into a metric job.
|
|
645
|
+
*
|
|
640
646
|
* `base` MUST be forwarded, not recomputed: it is the drag-start positions, and it exists so one gesture
|
|
641
647
|
* quantises the string ONCE — re-reading the just-written string each move lets 1/16" rounding creep onto
|
|
642
648
|
* lines that never moved.
|
|
@@ -646,8 +652,8 @@ export function detachDimRefs(plan, ids) {
|
|
|
646
652
|
* the whole characterization baseline — green while the readout reports the raw pointer position instead
|
|
647
653
|
* of the clamped or snapped one.
|
|
648
654
|
*/
|
|
649
|
-
export function moveGridLine(gc, grid,
|
|
650
|
-
return gc.moveGridLine(grid,
|
|
655
|
+
export function moveGridLine(gc, grid, mmPerPx, axis, i, np, units, base) {
|
|
656
|
+
return gc.moveGridLine(grid, mmPerPx, axis, i, np, units, base);
|
|
651
657
|
}
|
|
652
658
|
|
|
653
659
|
/**
|
|
@@ -658,8 +664,8 @@ export function moveGridLine(gc, grid, ptPerFt, axis, i, np, base) {
|
|
|
658
664
|
* override left. No sweep or static guard shaped like `g.<key> =` can see any of that, which is exactly
|
|
659
665
|
* how this surface stayed invisible for three PRs.
|
|
660
666
|
*/
|
|
661
|
-
export function moveGridLineEnd(gc, grid,
|
|
662
|
-
return gc.moveGridLineEnd(grid,
|
|
667
|
+
export function moveGridLineEnd(gc, grid, mmPerPx, axis, i, end, np) {
|
|
668
|
+
return gc.moveGridLineEnd(grid, mmPerPx, axis, i, end, np);
|
|
663
669
|
}
|
|
664
670
|
|
|
665
671
|
/**
|
|
@@ -668,14 +674,15 @@ export function moveGridLineEnd(gc, grid, ptPerFt, axis, i, end, np) {
|
|
|
668
674
|
* `activePlan` is the projected plan OBJECT, not a sheet label. The editor's own `P` is the exact active
|
|
669
675
|
* projection, so resolving by label would silently pick the first duplicate.
|
|
670
676
|
*
|
|
671
|
-
* `
|
|
672
|
-
* while the editor's `onElevateMember` reads the owning sheet's `
|
|
673
|
-
*
|
|
677
|
+
* `defaultTosMm` is the editor's GLOBAL default T.O.S, in world MILLIMETRES. `translateMembers` reads
|
|
678
|
+
* that global while the editor's `onElevateMember` reads the owning sheet's `default_tos_mm` (and
|
|
679
|
+
* documents why it does). The inconsistency is pre-existing; reproducing it exactly is the point of a
|
|
680
|
+
* refactor, and fixing it is a behaviour change that needs its own PR and its own baseline diff.
|
|
674
681
|
*
|
|
675
682
|
* `mintId` keeps id policy in the editor, where the characterization harness pins `Date.now()`.
|
|
676
683
|
*/
|
|
677
|
-
export function createModelCommands(contract, { activePlan,
|
|
678
|
-
/** Translate in DISPLAY PIXELS with dz in
|
|
684
|
+
export function createModelCommands(contract, { activePlan, defaultTosMm, mintId } = {}) {
|
|
685
|
+
/** Translate in DISPLAY PIXELS with dz in MILLIMETRES — the moved `translateMembers`. */
|
|
679
686
|
const translate = (members, off) => {
|
|
680
687
|
if (members.length && dispatchV2ProjectionCommand(members[0], 'translate', [members, off])) return;
|
|
681
688
|
const dz = off[2] || 0;
|
|
@@ -685,12 +692,12 @@ export function createModelCommands(contract, { activePlan, defaultTosIn, mintId
|
|
|
685
692
|
m.wp[1] = [m.wp[1][0] + off[0], m.wp[1][1] + off[1]];
|
|
686
693
|
if (dz) {
|
|
687
694
|
if (m.role === 'column') {
|
|
688
|
-
m.col.
|
|
689
|
-
m.col.
|
|
695
|
+
m.col.tosMm = (m.col.tosMm != null ? m.col.tosMm : defaultTosMm) + dz;
|
|
696
|
+
m.col.bosMm = (m.col.bosMm != null ? m.col.bosMm : 0) + dz;
|
|
690
697
|
m.col.tosDef = false;
|
|
691
698
|
} else {
|
|
692
699
|
m.ends.forEach(en => {
|
|
693
|
-
en.
|
|
700
|
+
en.tosMm = (en.tosMm != null ? en.tosMm : defaultTosMm) + dz;
|
|
694
701
|
en.tosDef = false;
|
|
695
702
|
});
|
|
696
703
|
}
|
|
@@ -834,7 +841,7 @@ export function createModelCommands(contract, { activePlan, defaultTosIn, mintId
|
|
|
834
841
|
*
|
|
835
842
|
* Returning the ROUNDED offsets is what keeps the toast identical: it measures distance from these
|
|
836
843
|
* same numbers today — `cmApplyOffsets` measures via `Math.hypot(offs[0]…)` — and recomputing from
|
|
837
|
-
* world mm would differ near a rounding threshold and for a missing or zero `
|
|
844
|
+
* world mm would differ near a rounding threshold and for a missing or zero `mm_per_px`.
|
|
838
845
|
*/
|
|
839
846
|
toDisplayOffsets(offsMm) {
|
|
840
847
|
return mmToDispOffsets(activePlan, offsMm);
|
|
@@ -842,7 +849,7 @@ export function createModelCommands(contract, { activePlan, defaultTosIn, mintId
|
|
|
842
849
|
|
|
843
850
|
/**
|
|
844
851
|
* The 3D Ctrl+drag copy — the editor's `onCopyDrag3d:` entry on `view3dApi`. Each clone lands on ITS SOURCE's
|
|
845
|
-
* plane, converted at THAT plane's scale — two sheets at different `
|
|
852
|
+
* plane, converted at THAT plane's scale — two sheets at different `mm_per_px` must not share one
|
|
846
853
|
* conversion.
|
|
847
854
|
*
|
|
848
855
|
* `planeOf` is INJECTED and must be the editor's own `const planeOf=id=>{…}` — NOT the adjacent `byId` or
|
|
@@ -25,13 +25,20 @@ export function validateClientSteelModelV2(doc, schema) {
|
|
|
25
25
|
const issues = shape.errors.map((e) => `${e.path}: ${e.message}`);
|
|
26
26
|
if (!object(doc)) return issues;
|
|
27
27
|
const members = rows(doc.members);
|
|
28
|
+
const provisionalMembers = rows(doc.provisional_members);
|
|
28
29
|
const memberCounts = new Map();
|
|
30
|
+
const entityCounts = new Map();
|
|
29
31
|
for (const member of members) memberCounts.set(member?.id, (memberCounts.get(member?.id) || 0) + 1);
|
|
32
|
+
for (const member of [...members, ...provisionalMembers]) entityCounts.set(member?.id, (entityCounts.get(member?.id) || 0) + 1);
|
|
30
33
|
const memberRef = (id, path) => {
|
|
31
34
|
const count = memberCounts.get(id) || 0;
|
|
32
35
|
if (count !== 1) issues.push(`${count ? 'member-ref-ambiguous' : 'member-ref-unresolved'} at ${path}`);
|
|
33
36
|
};
|
|
34
|
-
|
|
37
|
+
const entityRef = (id, path) => {
|
|
38
|
+
const count = entityCounts.get(id) || 0;
|
|
39
|
+
if (count !== 1) issues.push(`${count ? 'entity-ref-ambiguous' : 'member-ref-unresolved'} at ${path}`);
|
|
40
|
+
};
|
|
41
|
+
for (const [id, count] of entityCounts) if (!id || count !== 1) issues.push(`member-id-${id ? 'duplicate' : 'empty'} at $.members/provisional_members`);
|
|
35
42
|
|
|
36
43
|
const plans = rows(doc.plans);
|
|
37
44
|
const viewIds = new Map();
|
|
@@ -106,14 +113,14 @@ export function validateClientSteelModelV2(doc, schema) {
|
|
|
106
113
|
controlRef(plan.datum_ref, `$.plans[${pi}].datum_ref`);
|
|
107
114
|
controlRef(plan.control2_ref, `$.plans[${pi}].control2_ref`);
|
|
108
115
|
for (const id of rows(plan.memberRefs)) {
|
|
109
|
-
|
|
116
|
+
entityRef(id, `$.plans[${pi}].memberRefs`);
|
|
110
117
|
presented.add(id);
|
|
111
118
|
}
|
|
112
119
|
for (const obs of rows(plan.memberObservations)) {
|
|
113
120
|
const bound = rows(obs?.binding?.memberIds);
|
|
114
121
|
if (obs?.binding?.status === 'active') {
|
|
115
122
|
if (!bound.length) issues.push(`observation-cardinality at $.plans[${pi}].memberObservations`);
|
|
116
|
-
for (const id of bound) {
|
|
123
|
+
for (const id of bound) { entityRef(id, `$.plans[${pi}].memberObservations`); presented.add(id); }
|
|
117
124
|
} else if (bound.length) issues.push(`observation-cardinality at $.plans[${pi}].memberObservations`);
|
|
118
125
|
}
|
|
119
126
|
for (const dim of rows(plan.dims)) {
|