@floless/app 0.137.3 → 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 +47890 -27033
- 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 +474 -58
- 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 +237 -151
- package/dist/web/steel-3d-view.js +366 -113
- package/dist/web/steel-catalog-picker.js +98 -15
- package/dist/web/steel-detail-refs.js +1 -1
- package/dist/web/steel-editor.html +6479 -921
- package/dist/web/steel-filter.html +404 -57
- package/dist/web/steel-model-adapter.js +1 -1
- package/dist/web/steel-model-commands.js +72 -66
- package/dist/web/steel-model-v2-client-validation.js +10 -3
- package/dist/web/steel-model-v2-commands.js +269 -77
- package/dist/web/steel-model-v2-projection.js +18 -17
- package/dist/web/steel-plan-transform.js +52 -9
- 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 +39 -0
- package/dist/web/steel-view-generation.js +21 -7
- package/dist/web/workspaces.js +2178 -497
- package/package.json +5 -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,
|
|
@@ -146,13 +148,12 @@
|
|
|
146
148
|
* previous version was stale within one PR, twice.
|
|
147
149
|
*/
|
|
148
150
|
|
|
149
|
-
const IN_MM = 25.4;
|
|
150
|
-
|
|
151
151
|
import { V2CommandError, dispatchV2ProjectionCommand } from './steel-model-v2-commands.js';
|
|
152
|
-
import {
|
|
152
|
+
import { IN_TO_MM as IN_MM } from './steel-units.js';
|
|
153
|
+
import { gridLabelPatch, sheetScaleMm } from './grid-core.js';
|
|
153
154
|
|
|
154
|
-
/** Display-pixel scale for one plan — the shared
|
|
155
|
-
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);
|
|
156
157
|
|
|
157
158
|
/** Kill float noise before it persists into `wp` — the same r6 the three inline call sites applied. */
|
|
158
159
|
const r6 = (n) => Math.round(n * 1e6) / 1e6;
|
|
@@ -199,16 +200,16 @@ export function deepFreezeProjection(value) {
|
|
|
199
200
|
*/
|
|
200
201
|
export function mmToDispOffsets(plan, offsMm) {
|
|
201
202
|
const k = scaleOf(plan);
|
|
202
|
-
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)
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
/** Normalise a member's optional metadata in place. Moved verbatim from steel-editor.html's `function ensureMeta`. */
|
|
206
207
|
export function ensureMeta(m) {
|
|
207
208
|
if (!m.role) m.role = 'beam';
|
|
208
209
|
const moment = /(^|[^A-Z])MF/i.test(m.profile || '') ? 'moment' : '';
|
|
209
|
-
if (!m.ends) m.ends = [{
|
|
210
|
-
{
|
|
211
|
-
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: '' };
|
|
212
213
|
return m;
|
|
213
214
|
}
|
|
214
215
|
|
|
@@ -227,9 +228,9 @@ export function retargetTos(m, srcDef, dstDef) {
|
|
|
227
228
|
if (dispatchV2ProjectionCommand(m, 'retargetTos', [srcDef, dstDef])) return m;
|
|
228
229
|
const d = dstDef - srcDef; ensureMeta(m);
|
|
229
230
|
if (m.role === 'column') {
|
|
230
|
-
if (m.col.tosDef !== false) m.col.
|
|
231
|
-
if (m.col.
|
|
232
|
-
} 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; }
|
|
233
234
|
return m;
|
|
234
235
|
}
|
|
235
236
|
|
|
@@ -238,7 +239,7 @@ export function retargetTos(m, srcDef, dstDef) {
|
|
|
238
239
|
* A SECOND AXIS, not more geometry. Everything P3a–P3b-2b closed writes `m.wp`; these write `tos`, `bos`
|
|
239
240
|
* and `tosDef` on `m.col` / `m.ends[i]`. They are free functions rather than methods on
|
|
240
241
|
* `createModelCommands` because not one of them needs the contract, the active plan or the id policy —
|
|
241
|
-
* 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`).
|
|
242
243
|
*
|
|
243
244
|
* One primitive per distinct WRITE SHAPE, not per call site. Consolidating further would unify behaviours
|
|
244
245
|
* that genuinely differ today, and reproducing those differences exactly is the point of a refactor.
|
|
@@ -257,9 +258,9 @@ export function elevTargets(m) {
|
|
|
257
258
|
* `tosDef=false` is NOT redundant with the checkbox having been unticked — a user can type into the field
|
|
258
259
|
* of an end that is still following the default, and that keystroke is what breaks the link.
|
|
259
260
|
*/
|
|
260
|
-
export function
|
|
261
|
-
if (dispatchV2ProjectionCommand(target, '
|
|
262
|
-
target.
|
|
261
|
+
export function setTosValueMm(target, mm) {
|
|
262
|
+
if (dispatchV2ProjectionCommand(target, 'setTosValueMm', [mm])) return;
|
|
263
|
+
target.tosMm = mm; target.tosDef = false;
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
/**
|
|
@@ -270,15 +271,15 @@ export function setTosValue(target, tos) {
|
|
|
270
271
|
* would be a feature, not this refactor. `applyTosAll` reuses this with `on=true` over every target,
|
|
271
272
|
* which is precisely its body.
|
|
272
273
|
*/
|
|
273
|
-
export function setTosDefault(target, on,
|
|
274
|
-
if (dispatchV2ProjectionCommand(target, 'setTosDefault', [on,
|
|
275
|
-
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;
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
/** A column's base elevation. The inspector BOS inputs, `_dpCommit`'s Bottom branch, and `onBasePick`. */
|
|
279
|
-
export function
|
|
280
|
-
if (dispatchV2ProjectionCommand(col, '
|
|
281
|
-
col.
|
|
280
|
+
export function setBosMm(col, mm) {
|
|
281
|
+
if (dispatchV2ProjectionCommand(col, 'setBosMm', [mm])) return;
|
|
282
|
+
col.bosMm = mm;
|
|
282
283
|
}
|
|
283
284
|
|
|
284
285
|
/**
|
|
@@ -289,56 +290,56 @@ export function setBos(col, bos) {
|
|
|
289
290
|
* - it re-datums only ends still FOLLOWING the default; an override survives. That is the whole
|
|
290
291
|
* difference from `applyTosAll`, which overwrites everything.
|
|
291
292
|
* - the `defTos != null` guard is LOCAL to this writer. The other elevation writers have no such guard,
|
|
292
|
-
* so hoisting it into `
|
|
293
|
-
* - 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`
|
|
294
295
|
* writes sit behind that guard.
|
|
295
296
|
*/
|
|
296
|
-
export function syncToDefault(m,
|
|
297
|
-
if (dispatchV2ProjectionCommand(m, 'syncToDefault', [
|
|
297
|
+
export function syncToDefault(m, defTosMm) {
|
|
298
|
+
if (dispatchV2ProjectionCommand(m, 'syncToDefault', [defTosMm])) return m;
|
|
298
299
|
ensureMeta(m);
|
|
299
300
|
if (m.role === 'column') {
|
|
300
|
-
if (m.col.tosDef !== false &&
|
|
301
|
-
if (m.col.
|
|
302
|
-
} 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;
|
|
303
304
|
return m;
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
/**
|
|
307
|
-
* Raise or lower by `
|
|
308
|
+
* Raise or lower by `dMm` MILLIMETRES — the 3D Alt-drag (`onElevateMember`).
|
|
308
309
|
*
|
|
309
310
|
* `base` IS INJECTED, and that is the single most important thing about this function. The caller reads
|
|
310
|
-
* the OWNING SHEET's `
|
|
311
|
+
* the OWNING SHEET's `default_tos_mm`; the boundary's own `defaultTosMm` is the editor GLOBAL, which
|
|
311
312
|
* `translate` uses. Those two datums disagree, the disagreement is pre-existing, and this module's header
|
|
312
313
|
* already records that reproducing it exactly — rather than quietly unifying it — is the job. Resolving
|
|
313
314
|
* `base` in here would unify them invisibly.
|
|
314
315
|
*
|
|
315
|
-
* A column rises RIGIDLY: `
|
|
316
|
+
* A column rises RIGIDLY: `bosMm` shifts too (null → `0 + dMm`), so the column is moved, not stretched.
|
|
316
317
|
*/
|
|
317
|
-
export function elevateBy(m,
|
|
318
|
-
if (dispatchV2ProjectionCommand(m, 'elevateBy', [
|
|
318
|
+
export function elevateBy(m, dMm, base) {
|
|
319
|
+
if (dispatchV2ProjectionCommand(m, 'elevateBy', [dMm, base])) return m;
|
|
319
320
|
ensureMeta(m);
|
|
320
321
|
if (m.role === 'column') {
|
|
321
|
-
m.col.
|
|
322
|
-
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;
|
|
323
324
|
m.col.tosDef = false;
|
|
324
|
-
} else m.ends.forEach(en => { en.
|
|
325
|
+
} else m.ends.forEach(en => { en.tosMm = (en.tosMm != null ? en.tosMm : base) + dMm; en.tosDef = false; });
|
|
325
326
|
return m;
|
|
326
327
|
}
|
|
327
328
|
|
|
328
329
|
/**
|
|
329
330
|
* Swap a column's top and bottom — the `m.col` half of `swapMemberEnds`.
|
|
330
331
|
*
|
|
331
|
-
* BOTH sides materialise first: `
|
|
332
|
+
* BOTH sides materialise first: `bosMm` null → 0 and `tosMm` null → `defTosMm`. Reading them before assigning
|
|
332
333
|
* either is what makes this a swap rather than a copy, and the temporaries are not stylistic.
|
|
333
334
|
* `tosDef` is forced false because a swapped top is by definition no longer the level default.
|
|
334
335
|
*
|
|
335
336
|
* Applied to ANY member carrying a `col`, which after `ensureMeta` is every member — a beam's vestigial
|
|
336
337
|
* `col` is swapped too. That is what the editor does today, and it is observable in the stored contract.
|
|
337
338
|
*/
|
|
338
|
-
export function swapColElevation(col,
|
|
339
|
-
if (dispatchV2ProjectionCommand(col, 'swapColElevation', [
|
|
340
|
-
const b = (col.
|
|
341
|
-
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;
|
|
342
343
|
return col;
|
|
343
344
|
}
|
|
344
345
|
|
|
@@ -367,7 +368,7 @@ export function reverseEnds(m) {
|
|
|
367
368
|
export function copyEndTo(m, from, to) {
|
|
368
369
|
if (dispatchV2ProjectionCommand(m, 'copyEndTo', [from, to])) return m;
|
|
369
370
|
const s = m.ends[from];
|
|
370
|
-
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 };
|
|
371
372
|
return m;
|
|
372
373
|
}
|
|
373
374
|
|
|
@@ -379,7 +380,7 @@ export function copyEndTo(m, from, to) {
|
|
|
379
380
|
* active one, and `setPlan` runs one of them mid-switch, when "active" is ambiguous.
|
|
380
381
|
*
|
|
381
382
|
* They are module-level exports, called as `ModelCmd.<fn>(…)`, exactly like the elevation set above: they
|
|
382
|
-
* need none of `createModelCommands`' captured `contract` / `activePlan` / `
|
|
383
|
+
* need none of `createModelCommands`' captured `contract` / `activePlan` / `defaultTosMm` / `mintId`.
|
|
383
384
|
*
|
|
384
385
|
* WRITES ONLY. A `planGrid(plan)` selector was drafted alongside these and cut before merge: it had no
|
|
385
386
|
* caller anywhere, and its docblock claimed a pairing with the mutators that did not exist in the code.
|
|
@@ -511,10 +512,10 @@ export function setGridLabels(grid, dir, labels) {
|
|
|
511
512
|
return patchGrid(grid, gridLabelPatch(grid, dir, labels));
|
|
512
513
|
}
|
|
513
514
|
|
|
514
|
-
/** The plan's own T.O.S datum. Distinct from the editor's GLOBAL `
|
|
515
|
-
export function
|
|
516
|
-
if (dispatchV2ProjectionCommand(plan, '
|
|
517
|
-
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;
|
|
518
519
|
}
|
|
519
520
|
|
|
520
521
|
/**
|
|
@@ -634,10 +635,14 @@ export function detachDimRefs(plan, ids) {
|
|
|
634
635
|
* module shim (`GC()`), so importing it here would fix a load order this module has no business owning —
|
|
635
636
|
* and the injection keeps the seam visible instead of hiding a second write surface behind an import.
|
|
636
637
|
*
|
|
637
|
-
* 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
|
|
638
639
|
* a *spacing string*. Centralising that conversion is the entire point of v2, and this wrapper is where
|
|
639
640
|
* the interception will have to go. It looks thin today and is load-bearing later.
|
|
640
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
|
+
*
|
|
641
646
|
* `base` MUST be forwarded, not recomputed: it is the drag-start positions, and it exists so one gesture
|
|
642
647
|
* quantises the string ONCE — re-reading the just-written string each move lets 1/16" rounding creep onto
|
|
643
648
|
* lines that never moved.
|
|
@@ -647,8 +652,8 @@ export function detachDimRefs(plan, ids) {
|
|
|
647
652
|
* the whole characterization baseline — green while the readout reports the raw pointer position instead
|
|
648
653
|
* of the clamped or snapped one.
|
|
649
654
|
*/
|
|
650
|
-
export function moveGridLine(gc, grid,
|
|
651
|
-
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);
|
|
652
657
|
}
|
|
653
658
|
|
|
654
659
|
/**
|
|
@@ -659,8 +664,8 @@ export function moveGridLine(gc, grid, ptPerFt, axis, i, np, base) {
|
|
|
659
664
|
* override left. No sweep or static guard shaped like `g.<key> =` can see any of that, which is exactly
|
|
660
665
|
* how this surface stayed invisible for three PRs.
|
|
661
666
|
*/
|
|
662
|
-
export function moveGridLineEnd(gc, grid,
|
|
663
|
-
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);
|
|
664
669
|
}
|
|
665
670
|
|
|
666
671
|
/**
|
|
@@ -669,14 +674,15 @@ export function moveGridLineEnd(gc, grid, ptPerFt, axis, i, end, np) {
|
|
|
669
674
|
* `activePlan` is the projected plan OBJECT, not a sheet label. The editor's own `P` is the exact active
|
|
670
675
|
* projection, so resolving by label would silently pick the first duplicate.
|
|
671
676
|
*
|
|
672
|
-
* `
|
|
673
|
-
* while the editor's `onElevateMember` reads the owning sheet's `
|
|
674
|
-
*
|
|
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.
|
|
675
681
|
*
|
|
676
682
|
* `mintId` keeps id policy in the editor, where the characterization harness pins `Date.now()`.
|
|
677
683
|
*/
|
|
678
|
-
export function createModelCommands(contract, { activePlan,
|
|
679
|
-
/** 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`. */
|
|
680
686
|
const translate = (members, off) => {
|
|
681
687
|
if (members.length && dispatchV2ProjectionCommand(members[0], 'translate', [members, off])) return;
|
|
682
688
|
const dz = off[2] || 0;
|
|
@@ -686,12 +692,12 @@ export function createModelCommands(contract, { activePlan, defaultTosIn, mintId
|
|
|
686
692
|
m.wp[1] = [m.wp[1][0] + off[0], m.wp[1][1] + off[1]];
|
|
687
693
|
if (dz) {
|
|
688
694
|
if (m.role === 'column') {
|
|
689
|
-
m.col.
|
|
690
|
-
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;
|
|
691
697
|
m.col.tosDef = false;
|
|
692
698
|
} else {
|
|
693
699
|
m.ends.forEach(en => {
|
|
694
|
-
en.
|
|
700
|
+
en.tosMm = (en.tosMm != null ? en.tosMm : defaultTosMm) + dz;
|
|
695
701
|
en.tosDef = false;
|
|
696
702
|
});
|
|
697
703
|
}
|
|
@@ -835,7 +841,7 @@ export function createModelCommands(contract, { activePlan, defaultTosIn, mintId
|
|
|
835
841
|
*
|
|
836
842
|
* Returning the ROUNDED offsets is what keeps the toast identical: it measures distance from these
|
|
837
843
|
* same numbers today — `cmApplyOffsets` measures via `Math.hypot(offs[0]…)` — and recomputing from
|
|
838
|
-
* 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`.
|
|
839
845
|
*/
|
|
840
846
|
toDisplayOffsets(offsMm) {
|
|
841
847
|
return mmToDispOffsets(activePlan, offsMm);
|
|
@@ -843,7 +849,7 @@ export function createModelCommands(contract, { activePlan, defaultTosIn, mintId
|
|
|
843
849
|
|
|
844
850
|
/**
|
|
845
851
|
* The 3D Ctrl+drag copy — the editor's `onCopyDrag3d:` entry on `view3dApi`. Each clone lands on ITS SOURCE's
|
|
846
|
-
* 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
|
|
847
853
|
* conversion.
|
|
848
854
|
*
|
|
849
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)) {
|