@floless/app 0.138.2 → 0.139.1
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/autostart.mjs +6 -2
- package/desktop-access-production-manifest.mjs +7 -0
- package/dist/floless-server.cjs +157207 -70887
- package/dist/schemas/model.continuation.v1.schema.json +19 -0
- package/dist/schemas/model.continuation.v2.schema.json +19 -0
- package/dist/schemas/model.query-response.v1.schema.json +95 -0
- package/dist/schemas/model.query-response.v2.schema.json +80 -0
- package/dist/schemas/model.query.v1.schema.json +87 -0
- package/dist/schemas/model.query.v2.schema.json +87 -0
- package/dist/schemas/model.snap-candidate.v1.schema.json +48 -0
- package/dist/schemas/model.snap-constraint.v1.schema.json +18 -0
- package/dist/schemas/model.snap-query.v1.schema.json +24 -0
- package/dist/schemas/model.snap-result.v1.schema.json +33 -0
- package/dist/schemas/model.snapshot.v1.schema.json +136 -0
- package/dist/schemas/revit.model.v1.schema.json +24 -0
- package/dist/schemas/steel.model.v2.schema.json +45 -6
- package/dist/skills/floless-app-approval/SKILL.md +19 -5
- package/dist/skills/floless-app-bridge/SKILL.md +19 -6
- package/dist/skills/floless-app-knowledge/SKILL.md +22 -1
- package/dist/skills/floless-app-new-workflow/SKILL.md +31 -27
- package/dist/skills/floless-app-new-workflow/references/build-and-verify.md +13 -12
- package/dist/skills/floless-app-onboarding/SKILL.md +3 -3
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +16 -9
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -2
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +95 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +142 -21
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +19 -0
- package/dist/skills/floless-app-tweak-contract/SKILL.md +42 -8
- package/dist/skills/floless-app-vectorize/SKILL.md +19 -6
- package/dist/skills/floless-app-workflows/SKILL.md +30 -3
- package/dist/skills/floless-app-workflows/references/workspace-data.md +77 -4
- package/dist/templates/floless-workspace-model-report.flo +77 -0
- package/dist/templates/revit-model.flo +111 -0
- package/dist/web/app.css +415 -177
- package/dist/web/app.js +302 -51
- package/dist/web/aware.js +1357 -1032
- package/dist/web/chat.css +692 -0
- package/dist/web/chat.js +2651 -0
- package/dist/web/commands-revit.js +42 -0
- package/dist/web/commands-shell.js +531 -70
- package/dist/web/commands-steel.js +344 -146
- package/dist/web/commands.js +1 -1
- package/dist/web/index.html +283 -77
- package/dist/web/instructor.js +217 -36
- package/dist/web/left-pane.js +636 -0
- package/dist/web/model-artifact-loader.js +75 -0
- package/dist/web/model-authoring-gestures.js +141 -0
- package/dist/web/model-cad-tools.js +20 -0
- package/dist/web/model-clip-gesture.js +148 -0
- package/dist/web/model-clip-list.js +156 -0
- package/dist/web/model-clip-session.js +274 -0
- package/dist/web/model-clip-three-overlay.js +295 -0
- package/dist/web/model-clip-three-preview.js +59 -0
- package/dist/web/model-editor-contract.js +519 -0
- package/dist/web/model-editor-revit-adapter.js +139 -0
- package/dist/web/model-editor-shell.js +271 -0
- package/dist/web/model-editor-state-recovery.js +44 -0
- package/dist/web/model-editor-steel-adapter.js +415 -0
- package/dist/web/model-editor.css +268 -0
- package/dist/web/model-frame.js +192 -0
- package/dist/web/model-inspector.js +128 -0
- package/dist/web/model-measure.js +390 -0
- package/dist/web/model-navigation-controls.js +246 -0
- package/dist/web/model-orientation-overlay.js +217 -0
- package/dist/web/model-panel-bridge.js +230 -0
- package/dist/web/model-pointer-dock.js +164 -0
- package/dist/web/model-revit-module.js +83 -0
- package/dist/web/model-selection-coordinator.js +151 -0
- package/dist/web/model-selection-tools.js +290 -0
- package/dist/web/model-snap-contract.js +267 -0
- package/dist/web/model-snapping.js +497 -0
- package/dist/web/model-spatial-panel.js +294 -0
- package/dist/web/model-spatial-tools.js +249 -0
- package/dist/web/model-tree.js +47 -0
- package/dist/web/model-viewport-lighting.js +166 -0
- package/dist/web/model-viewport-revit-adapter.js +1224 -0
- package/dist/web/model-viewport-state.js +505 -0
- package/dist/web/model-viewport-steel-adapter.js +150 -0
- package/dist/web/model-viewport-toolbar.js +516 -0
- package/dist/web/model-viewport.js +717 -0
- package/dist/web/panels.js +8 -15
- package/dist/web/renderers.js +3 -0
- package/dist/web/revit-editor.css +35 -0
- package/dist/web/revit-editor.html +74 -0
- package/dist/web/revit-editor.js +845 -0
- package/dist/web/steel-3d-core.js +16 -44
- package/dist/web/steel-3d-view.js +1384 -633
- package/dist/web/steel-canvas-guidance.js +3 -1
- package/dist/web/steel-editor.html +2145 -1255
- package/dist/web/steel-filter.html +5 -1
- package/dist/web/steel-model-v2-commands.js +80 -3
- package/dist/web/steel-split-view.js +5 -39
- package/dist/web/steel-view-generation.js +107 -17
- package/dist/web/vector-3d.html +12 -0
- package/dist/web/workspaces.js +2154 -283
- package/distribution-profile-active.mjs +2 -0
- package/distribution-profile-production.mjs +47 -0
- package/distribution-profile-shared.mjs +8 -0
- package/distribution-profile.mjs +18 -0
- package/distribution-resource-inventory.mjs +81 -0
- package/launch.mjs +18 -10
- package/log.mjs +2 -1
- package/managed-runtime-policy.mjs +104 -0
- package/model-reader-policy-active.mjs +7 -0
- package/network-policy-active.mjs +6 -0
- package/package.json +17 -2
- package/post-update-marker.mjs +3 -1
- package/rvt-production-uat-authority.mjs +60 -0
- package/teardown.mjs +4 -3
|
@@ -670,6 +670,9 @@ let saveInFlight = false; // parent checkpoint polling must not re-enable Save d
|
|
|
670
670
|
* never read by anything but this chip.
|
|
671
671
|
*/
|
|
672
672
|
let displayUnitsPref = null;
|
|
673
|
+
// This page is bound to one project whose steel environment is immutable. Remember the diagnostic in
|
|
674
|
+
// page state so cosmetic repaints (units loading and SSE) do not turn one bad value into log spam.
|
|
675
|
+
let unresolvableStandardWarned = false;
|
|
673
676
|
|
|
674
677
|
/**
|
|
675
678
|
* Repaint the chip. Safe to call at any time, including before the contract has loaded.
|
|
@@ -713,7 +716,8 @@ function renderStandardStat(){
|
|
|
713
716
|
// arm as one that states nothing. The sentence is deliberately written to be true of both, but the
|
|
714
717
|
// two are different facts and only one of them is a data problem -- so it leaves a trace here rather
|
|
715
718
|
// than being indistinguishable forever.
|
|
716
|
-
if(line.unstated && C && C.environment !== undefined){
|
|
719
|
+
if(line.unstated && C && C.environment !== undefined && !unresolvableStandardWarned){
|
|
720
|
+
unresolvableStandardWarned = true;
|
|
717
721
|
console.warn('steel-filter: this model states a steel environment the app cannot resolve', C.environment);
|
|
718
722
|
}
|
|
719
723
|
// `data-tip`, never `title` — a native tooltip renders in the light OS style against this dark theme,
|
|
@@ -201,6 +201,70 @@ function replaceInList(list, oldIds, replacements) {
|
|
|
201
201
|
return [...new Set(out)];
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
/*
|
|
205
|
+
* PROPERTY-LABEL SETS. Scope is per target: the root of `prop_labels` is the 2D plan, `scope3d` is 3D when
|
|
206
|
+
* no saved view is active, and `saved_views[<view id>]` is one saved 3D view (which also carries its own
|
|
207
|
+
* `vis`). `props` and `placement` stay shared. Every set pins members through `ids`, so every set is a
|
|
208
|
+
* member reference that split / merge / delete must rewrite.
|
|
209
|
+
*/
|
|
210
|
+
const plainObject = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
211
|
+
|
|
212
|
+
/** One scope, normalised to what `$defs.propLabelScope` permits: fresh object, fresh `ids` array. */
|
|
213
|
+
export function sanitizePropLabelScope(raw) {
|
|
214
|
+
const o = plainObject(raw) ? raw : {};
|
|
215
|
+
return {
|
|
216
|
+
for_all: typeof o.for_all === 'boolean' ? o.for_all : !(o.selected_only === true || o.on_selection === true),
|
|
217
|
+
selected_only: o.for_all === true ? false : o.selected_only === true,
|
|
218
|
+
on_selection: o.for_all === true ? false : o.on_selection === true,
|
|
219
|
+
ids: Array.isArray(o.ids) ? o.ids.filter((v) => typeof v === 'string' && v !== '') : [],
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** A saved view's set (`$defs.viewPropLabels`): its own visibility plus a scope. Absent `vis` means on. */
|
|
224
|
+
export function sanitizeViewPropLabels(raw) {
|
|
225
|
+
return { vis: !(plainObject(raw) && raw.vis === false), ...sanitizePropLabelScope(raw) };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Store a saved view's set under its id. `defineProperty`, never `map[id] = …`: a view id is arbitrary
|
|
230
|
+
* contract text, and assigning `__proto__` on an ordinary object would replace its prototype instead of
|
|
231
|
+
* adding a key.
|
|
232
|
+
*/
|
|
233
|
+
export function setSavedViewLabels(map, id, value) {
|
|
234
|
+
Object.defineProperty(map, id, { value, enumerable: true, writable: true, configurable: true });
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** `saved_views[id]` when it is an OWN entry — an inherited `constructor` is not a view's labels. */
|
|
238
|
+
export function savedViewLabels(propLabels, id) {
|
|
239
|
+
const map = propLabels?.saved_views;
|
|
240
|
+
return plainObject(map) && typeof id === 'string' && Object.hasOwn(map, id) && plainObject(map[id]) ? map[id] : null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Every pinned-member list in `prop_labels`: the 2D root, the 3D default, each saved view. */
|
|
244
|
+
function forEachPropLabelPinList(doc, fn) {
|
|
245
|
+
const pl = doc.prop_labels;
|
|
246
|
+
if (!plainObject(pl)) return;
|
|
247
|
+
const sets = [pl, pl.scope3d, ...(plainObject(pl.saved_views) ? Object.values(pl.saved_views) : [])];
|
|
248
|
+
for (const set of sets) if (plainObject(set) && Array.isArray(set.ids)) fn(set);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Drop every pin naming no member in `doc.members`, in every set. A pin to a member that does not exist has
|
|
253
|
+
* nothing to label, and the server refuses a document that carries one. Returns how many ids were dropped.
|
|
254
|
+
*/
|
|
255
|
+
export function prunePropLabelPins(doc) {
|
|
256
|
+
const present = new Set((doc.members || []).map((m) => m?.id));
|
|
257
|
+
const gone = new Set();
|
|
258
|
+
forEachPropLabelPinList(doc, (set) => { for (const id of set.ids) if (!present.has(id)) gone.add(id); });
|
|
259
|
+
if (gone.size) rewritePropLabelPins(doc, gone, []);
|
|
260
|
+
return gone.size;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Re-point (or, with no replacements, drop) retired member ids in every label pin list. */
|
|
264
|
+
export function rewritePropLabelPins(doc, oldIds, replacements) {
|
|
265
|
+
forEachPropLabelPinList(doc, (set) => { set.ids = replaceInList(set.ids, oldIds, replacements); });
|
|
266
|
+
}
|
|
267
|
+
|
|
204
268
|
function detachCopiedEngineeringReferences(member) {
|
|
205
269
|
// A copy is a new physical member. Connection/detail assignments belong to the source member's
|
|
206
270
|
// engineering identity, so carrying ends[] would silently assert that they were reviewed for the copy.
|
|
@@ -396,7 +460,7 @@ function splitMemberAt(doc, memberId, t, expect, mintId, { requireKnownElevation
|
|
|
396
460
|
for (const plan of doc.plans || []) {
|
|
397
461
|
plan.memberRefs = replaceInList(plan.memberRefs, new Set([memberId]), [first.id, second.id]);
|
|
398
462
|
}
|
|
399
|
-
|
|
463
|
+
rewritePropLabelPins(doc, new Set([memberId]), [first.id, second.id]);
|
|
400
464
|
doc.members = doc.members.filter((m) => m.id !== memberId);
|
|
401
465
|
doc.members.push(first, second);
|
|
402
466
|
return [first.id, second.id];
|
|
@@ -553,6 +617,7 @@ function mergeMemberGroup(doc, sheet, memberIds, mergedPx, mintId, resolveSectio
|
|
|
553
617
|
p.memberRefs = replaceInList(p.memberRefs, oldIds, [merged.id]);
|
|
554
618
|
}
|
|
555
619
|
rebindMergedObservations(doc, oldIds, merged.id);
|
|
620
|
+
rewritePropLabelPins(doc, oldIds, [merged.id]);
|
|
556
621
|
doc.members = doc.members.filter((m) => !oldIds.has(m.id));
|
|
557
622
|
doc.members.push(merged);
|
|
558
623
|
return merged.id;
|
|
@@ -575,6 +640,7 @@ function deleteMembersFromDocument(doc, ids) {
|
|
|
575
640
|
assertNoWholeMemberRefs(doc, selected);
|
|
576
641
|
if (blockers.length) throw new V2CommandError('delete-referenced', 'referenced members cannot be deleted', blockers);
|
|
577
642
|
doc.members = doc.members.filter((m) => !selected.has(m.id));
|
|
643
|
+
rewritePropLabelPins(doc, selected, []);
|
|
578
644
|
for (const plan of doc.plans || []) plan.memberRefs = (plan.memberRefs || []).filter((id) => !selected.has(id));
|
|
579
645
|
}
|
|
580
646
|
|
|
@@ -615,9 +681,15 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
615
681
|
plan.memberObservations = clone(row.memberObservations || []);
|
|
616
682
|
plan.frame = clone(row.frame || null);
|
|
617
683
|
// Registration controls, restored by PRESENCE: an absent `datum_ref` says "this control point
|
|
618
|
-
// is the model origin", so a missing key must delete rather than be skipped (#740).
|
|
684
|
+
// is the model origin", so a missing key must delete rather than be skipped (#740). An
|
|
685
|
+
// `undefined` VALUE is absent too (#1446): `memberEndSnapshot` maps `datum_ref: p.datum_ref`,
|
|
686
|
+
// so a plan with no datum control arrives as `{datum_ref: undefined}` — an own key with no
|
|
687
|
+
// value. Restoring that fabricates `datum_ref: undefined`, which the schema rejects
|
|
688
|
+
// (`expected object`), and the member-end extend that produced it then fails to load. The undo
|
|
689
|
+
// `snapshot()` has the same mapping but survives only because `JSON.stringify` drops the
|
|
690
|
+
// undefined key; treating undefined as absent here makes every producer safe.
|
|
619
691
|
for (const key of ['datum_ref', 'control2_ref']) {
|
|
620
|
-
if (Object.hasOwn(row, key)) plan[key] = clone(row[key]);
|
|
692
|
+
if (Object.hasOwn(row, key) && row[key] !== undefined) plan[key] = clone(row[key]);
|
|
621
693
|
else delete plan[key];
|
|
622
694
|
}
|
|
623
695
|
}
|
|
@@ -629,6 +701,11 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
629
701
|
if (Object.hasOwn(saved, 'dim_style')) draft.dim_style = clone(saved.dim_style || {});
|
|
630
702
|
if (Object.hasOwn(saved, 'member_styles')) draft.member_styles = clone(saved.member_styles || {});
|
|
631
703
|
if (Object.hasOwn(saved, 'reference_models')) draft.reference_models = clone(saved.reference_models || []);
|
|
704
|
+
// Label pins are NOT in the snapshot: switches and captures are not undoable, and restoring an old id
|
|
705
|
+
// list beside newer flags would rewind them. The members did change, though, so a pin naming a
|
|
706
|
+
// member this snapshot does not have is dropped here — undoing a split/merge/delete returns that
|
|
707
|
+
// member unpinned rather than committing a reference the server refuses.
|
|
708
|
+
prunePropLabelPins(draft);
|
|
632
709
|
return { structural: true };
|
|
633
710
|
});
|
|
634
711
|
},
|
|
@@ -16,10 +16,9 @@ export const VIEW_MODES = ['2d', '3d', 'split'];
|
|
|
16
16
|
/**
|
|
17
17
|
* The narrowest a pane may be, in CSS px.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* (which takes the same floor for symmetry) enough width to be worth looking at.
|
|
19
|
+
* Kept from when the 3D panel floated inside the 3D pane (it needed 222px); its tabs are the left Model
|
|
20
|
+
* section's now. 280 still gives each pane (the 2D one takes the same floor for symmetry) enough width to
|
|
21
|
+
* be worth looking at, and the bottom dock's per-pane layout is sized against it.
|
|
23
22
|
*/
|
|
24
23
|
export const MIN_PANE_PX = 280;
|
|
25
24
|
|
|
@@ -49,7 +48,7 @@ export function sanitizeRatio(ratio) {
|
|
|
49
48
|
* refusal is a property of the layout rule, and a test that asserts the rule should be able to assert
|
|
50
49
|
* the words the user actually reads.
|
|
51
50
|
*/
|
|
52
|
-
const TOO_NARROW = 'Not enough room to split — widen the window or collapse the
|
|
51
|
+
const TOO_NARROW = 'Not enough room to split — widen the window or collapse the Properties panel.';
|
|
53
52
|
|
|
54
53
|
/** Can this stage hold two minimum-width panes and the divider between them? */
|
|
55
54
|
export function canSplit(stageWidthPx) {
|
|
@@ -151,46 +150,13 @@ export function chromeVisibility({ mode, activePane } = {}) {
|
|
|
151
150
|
return {
|
|
152
151
|
zoombar: panes.two, // 2D zoom slider — addresses the plan canvas
|
|
153
152
|
planCombo: panes.two, // plan switcher — chooses what the plan canvas shows
|
|
154
|
-
m3dChrome: panes.three, // #m3dBar, #m3dCube, #m3dAxes
|
|
153
|
+
m3dChrome: panes.three, // #m3dBar, #m3dCube, #m3dAxes — painted over the 3D canvas
|
|
155
154
|
dim2d: active === '2d', // #dimB
|
|
156
155
|
dim3d: active === '3d', // #dim3dWrap
|
|
157
156
|
v3d: active === '3d', // body.v3d — gates 3D-only menu rows; follows view3d, unchanged
|
|
158
157
|
};
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
/** The bottom dock's three direct children, by element id, in the order the MARKUP declares them. */
|
|
162
|
-
const DOCK_ITEMS = ['m3dLegendLauncher', 'bottomDockLeft', 'ptrBars'];
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* The order the bottom dock's items should sit in the DOM — which is to say, left to right on screen.
|
|
166
|
-
*
|
|
167
|
-
* WHY THIS IS NOT JUST THE MARKUP ORDER. `#m3dLegendLauncher` is declared first because it is leftmost
|
|
168
|
-
* in three of the four arrangements (3D-active split, single 3D, and the stage-wide fallback). The
|
|
169
|
-
* fourth — 2D-active split with the per-pane dock on — pins it to the 3D pane's left edge
|
|
170
|
-
* (`position:absolute`, see the `body.split-view:not(.v3d) #bottomDock.dock-per-pane` rule in
|
|
171
|
-
* steel-editor.html) while `#bottomDockLeft` keeps the gesture hint at the dock's own left edge. There
|
|
172
|
-
* the markup reads the pair backwards, so a keyboard or screen-reader user reached "Expand 3D panel"
|
|
173
|
-
* before the hint sitting far to its left.
|
|
174
|
-
*
|
|
175
|
-
* WHY THE CALLER MOVES NODES RATHER THAN SETTING `order:`. A CSS `order:` swap fixes the visual/DOM
|
|
176
|
-
* mismatch for a sighted keyboard user and leaves the screen-reader one exactly where they were:
|
|
177
|
-
* `order` is a paint-time concern that assistive technology does not reliably follow. Positive
|
|
178
|
-
* `tabindex` is the other tempting one-liner, and it is worse — it lifts these three out of document
|
|
179
|
-
* order for the WHOLE page. So the honest fix is the node order itself, which is what this returns.
|
|
180
|
-
*
|
|
181
|
-
* `v3d` comes from chromeVisibility rather than being re-derived here, so the order and the CSS that
|
|
182
|
-
* pins the launcher can never key off different answers to "is the 3D pane the active one".
|
|
183
|
-
*
|
|
184
|
-
* @param {{mode?: string, activePane?: string, perPane?: boolean}} state — `perPane` is the live
|
|
185
|
-
* `#bottomDock.dock-per-pane` state, which is the fit gate's output and cannot be derived from here.
|
|
186
|
-
* @returns {string[]} element ids, first on screen first.
|
|
187
|
-
*/
|
|
188
|
-
export function dockOrder({ mode, activePane, perPane } = {}) {
|
|
189
|
-
const m = sanitizeMode(mode);
|
|
190
|
-
const pinned = m === 'split' && perPane === true && !chromeVisibility({ mode: m, activePane }).v3d;
|
|
191
|
-
return pinned ? ['bottomDockLeft', 'm3dLegendLauncher', 'ptrBars'] : [...DOCK_ITEMS];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
160
|
/**
|
|
195
161
|
* What a mode change has to DO, as data.
|
|
196
162
|
*
|
|
@@ -71,35 +71,125 @@ export function sourcesFromGrid(geo, mmPerDisplayPx, sheet, grid) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Parse
|
|
74
|
+
* Parse ONE authored depth into positive world mm, with a sentence that names the field.
|
|
75
75
|
*
|
|
76
|
-
* `fmt` RENDERS THE FLOOR IN THE READER'S OWN UNITS and is injected rather than imported, because this
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
76
|
+
* `fmt` RENDERS THE FLOOR IN THE READER'S OWN UNITS and is injected rather than imported, because this module is a
|
|
77
|
+
* leaf with no idea what the project displays; a caller must pass a formatter that does not round 0.5 mm away (the
|
|
78
|
+
* editor passes its echo formatter: 0.02" / 0.5 mm). The default keeps a bare millimetre string so a caller with no
|
|
79
|
+
* display context (the tests, a script) still gets a sentence rather than `undefined`. Only the refusal uses it.
|
|
80
|
+
*
|
|
81
|
+
* `parse` turns the typed text into mm (see below). Four refusals, four sentences: empty, unreadable, not above zero and
|
|
82
|
+
* below the floor. A word is not "too small", and "300 mm" or "10 ft" are in units a list of unit names would have
|
|
83
|
+
* promised, so the unreadable case gives examples instead.
|
|
81
84
|
*/
|
|
82
|
-
export function
|
|
85
|
+
export function parseDepthValue(label, raw, fmt, parse) {
|
|
83
86
|
const say = typeof fmt === 'function' ? fmt : (mm) => `${mm} mm`;
|
|
87
|
+
const text = String(raw ?? '').trim();
|
|
88
|
+
if (!text) return { ok: false, value: null, error: `${label} depth is empty. Type a length such as 2'-6", 750mm or 0.75m.` };
|
|
89
|
+
// `parse` is the editor's DISPLAY-AWARE parser, so a bare number is read in the project's units: 24 is 24 inches in
|
|
90
|
+
// an ft-in project and 24 mm in a metric one, as every other length field reads it. grid-core's parseLen, the
|
|
91
|
+
// default for callers with no display context, always reads a bare number as millimetres.
|
|
92
|
+
const read = typeof parse === 'function' ? parse(text) : parseLen(text);
|
|
93
|
+
const mm = read == null ? NaN : read;
|
|
94
|
+
if (!Number.isFinite(mm)) return { ok: false, value: null, error: `${label} depth isn't a length FloLess can read. Type it like 2'-6", 30", 750mm or 0.75m.` };
|
|
95
|
+
if (!positive(mm)) return { ok: false, value: null, error: `${label} depth must be more than zero.` };
|
|
96
|
+
// A NUMERIC floor: the level identity tolerance, the repo's one answer to "is this distance nothing". It is not a
|
|
97
|
+
// round trip through the imperial display lattice, which refused a perfectly good 1 mm depth.
|
|
98
|
+
if (mm < LEVEL_SAME_MM) return { ok: false, value: null, error: `${label} depth must be at least ${say(LEVEL_SAME_MM)}.` };
|
|
99
|
+
return { ok: true, value: mm, error: '' };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Parse the Generate views dialog's two depths. Its sentences name the field by key; the dialog capitalises them. */
|
|
103
|
+
export function parseDepths(kind, raw, fmt, parse) {
|
|
84
104
|
const keys = kind === 'level' ? ['above', 'below'] : ['ahead', 'behind'];
|
|
85
105
|
const values = {};
|
|
86
106
|
for (const key of keys) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// 1 mm depth was refused because it rounded to zero sixteenths of an inch. The floor is the level
|
|
91
|
-
// identity tolerance, which is the repo's one answer to "is this distance nothing".
|
|
92
|
-
if (!positive(mm) || mm < LEVEL_SAME_MM) return { ok: false, error: `${key} must be at least ${say(LEVEL_SAME_MM)}`, values: null };
|
|
93
|
-
values[key] = mm;
|
|
107
|
+
const r = parseDepthValue(key, raw?.[key], fmt, parse);
|
|
108
|
+
if (!r.ok) return { ok: false, error: r.error, values: null };
|
|
109
|
+
values[key] = r.value;
|
|
94
110
|
}
|
|
95
111
|
return { ok: true, error: '', values };
|
|
96
112
|
}
|
|
97
113
|
|
|
98
|
-
|
|
99
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Tidy the dialog's two depths for display once a field is left. The text is what Create parses, so the tidy text must
|
|
116
|
+
* read back as the same length: a display that rounds (1/16" in ft-in) would otherwise BECOME the depth, and 0.5mm
|
|
117
|
+
* would turn into 0" and be refused, 0.8mm into 1.5875 mm (#1405). So the formatted text replaces the typed text only
|
|
118
|
+
* when `parse` reads it back to the same millimetres; anything the display cannot show exactly stays as typed.
|
|
119
|
+
*/
|
|
120
|
+
export function normalizeDepths(kind, raw, fmt, parse) {
|
|
121
|
+
const parsed = parseDepths(kind, raw, fmt, parse);
|
|
100
122
|
if (!parsed.ok) return parsed;
|
|
101
123
|
const say = typeof fmt === 'function' ? fmt : fmtLen;
|
|
102
|
-
|
|
124
|
+
const read = typeof parse === 'function' ? parse : parseLen;
|
|
125
|
+
const tidy = (key, mm) => {
|
|
126
|
+
const text = say(mm), back = read(text);
|
|
127
|
+
return back != null && Math.abs(back - mm) < 1e-6 ? text : String(raw[key]).trim();
|
|
128
|
+
};
|
|
129
|
+
return { ...parsed, formatted: Object.fromEntries(Object.entries(parsed.values).map(([key, mm]) => [key, tidy(key, mm)])) };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ── Cut depth of a saved view ─────────────────────────────────────────────────────────────────────────────────────
|
|
133
|
+
* Depth is measured from a plane. A view generated from a grid line or level measures from that datum, and both its
|
|
134
|
+
* depths are required because they ARE its cut. A view saved by hand has no datum, so it has no cut depth here; giving
|
|
135
|
+
* it one (from the view's own plane) needs its own stored field and is deliberately left to a separate change. */
|
|
136
|
+
|
|
137
|
+
/** What a view's cut depth is measured from, which fields the panel shows, and its depths now (mm); null without a datum. */
|
|
138
|
+
export function viewDepthPlane(view) {
|
|
139
|
+
const g = view?.generated;
|
|
140
|
+
if (g && (g.kind === 'grid-x' || g.kind === 'grid-y')) {
|
|
141
|
+
return { kind: 'grid', fields: [{ key: 'ahead', label: 'Ahead' }, { key: 'behind', label: 'Behind' }], depths: { ahead: g.ahead, behind: g.behind } };
|
|
142
|
+
}
|
|
143
|
+
if (g && g.kind === 'level') {
|
|
144
|
+
return { kind: 'level', fields: [{ key: 'above', label: 'Above' }, { key: 'below', label: 'Below' }], depths: { above: g.above, below: g.below } };
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Read the panel's depth fields against what they showed. A field whose TEXT still reads what it showed is not an
|
|
151
|
+
* edit and keeps its exact stored depth: a depth authored in ft-in (915.9875 mm) shows as 916 in mm, and editing only
|
|
152
|
+
* the other field must not quietly save 916. A field whose text changed is parsed even when it displays like the old
|
|
153
|
+
* value (610mm over a 609.6 that shows as 2'-0"). `edited` lists every changed field, so a refusal can clear their
|
|
154
|
+
* echoes whatever the reason. `fmt` and `parse` are the caller's echo formatter and display-aware parser.
|
|
155
|
+
*/
|
|
156
|
+
export function readDepthEdits(plane, texts, shown, fmt, parse) {
|
|
157
|
+
const edited = [], depths = {};
|
|
158
|
+
for (let i = 0; i < plane.fields.length; i++) {
|
|
159
|
+
const { key } = plane.fields[i];
|
|
160
|
+
const text = String(texts?.[i] ?? '').trim();
|
|
161
|
+
if (text === String(shown?.[i] ?? '').trim()) { depths[key] = plane.depths[key]; continue; }
|
|
162
|
+
edited.push(key);
|
|
163
|
+
}
|
|
164
|
+
for (let i = 0; i < plane.fields.length; i++) {
|
|
165
|
+
const { key, label } = plane.fields[i];
|
|
166
|
+
if (!edited.includes(key)) continue;
|
|
167
|
+
const r = parseDepthValue(label, texts?.[i], fmt, parse);
|
|
168
|
+
if (!r.ok) return { ok: false, edited, depths: null, error: r.error, errorKey: key };
|
|
169
|
+
depths[key] = r.value;
|
|
170
|
+
}
|
|
171
|
+
return { ok: true, edited, depths, error: '', errorKey: null };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Same depths, to within float noise (3' and 36" differ by 1e-13 mm). */
|
|
175
|
+
export function depthsEqual(a, b) {
|
|
176
|
+
const keys = new Set([...Object.keys(a || {}), ...Object.keys(b || {})]);
|
|
177
|
+
for (const k of keys) if (!(Math.abs((a?.[k] ?? NaN) - (b?.[k] ?? NaN)) < 1e-6)) return false;
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A clip state reduced to what decides the cut, so "is the scene still showing this view" compares geometry, not
|
|
183
|
+
* bookkeeping (labels, selection, sequence): each clip's kind, on/off, box or plane, and the work area's on/off,
|
|
184
|
+
* whole-parts setting and box. Each is read the way the renderer reads it: `enabled` absent is off (applyClips
|
|
185
|
+
* filters on it), `whole` absent is on (setClipState restores `whole !== false`).
|
|
186
|
+
*/
|
|
187
|
+
export function clipsKey(state) {
|
|
188
|
+
const box = (b) => (b ? [b.min, b.max] : null), wa = state?.workArea;
|
|
189
|
+
return JSON.stringify([
|
|
190
|
+
(Array.isArray(state?.clips) ? state.clips : []).map((c) => [c?.id, c?.kind, !!c?.enabled, box(c?.box), c?.n || null, c?.point || null]),
|
|
191
|
+
wa ? [!!wa.enabled, wa.whole !== false, box(wa.box)] : null,
|
|
192
|
+
]);
|
|
103
193
|
}
|
|
104
194
|
|
|
105
195
|
/** Shift-range applies the target's next state inclusively and preserves choices outside the range. */
|
package/dist/web/vector-3d.html
CHANGED
|
@@ -163,6 +163,18 @@
|
|
|
163
163
|
steel-filter.html, steel-editor.html) so the four surfaces read as one family. */
|
|
164
164
|
#tooltip{position:fixed;z-index:80;background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:5px 8px;font-size:11.5px;line-height:1.35;color:var(--text);pointer-events:none;max-width:260px;box-shadow:var(--shadow-tip);opacity:0;transition:opacity .12s}
|
|
165
165
|
#tooltip.show{opacity:1}
|
|
166
|
+
input[type="range"]{appearance:none;-webkit-appearance:none;width:100%;height:18px;margin:0;background:transparent;cursor:pointer}
|
|
167
|
+
input[type="range"]::-webkit-slider-runnable-track{height:4px;border-radius:999px;background:var(--line)}
|
|
168
|
+
input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;margin-top:-6px;border:2px solid #0b1220;border-radius:50%;background:var(--brand);box-shadow:0 0 0 1px #60a5fa}
|
|
169
|
+
input[type="range"]::-moz-range-track{height:4px;border-radius:999px;background:var(--line)}
|
|
170
|
+
input[type="range"]::-moz-range-thumb{width:14px;height:14px;border:2px solid #0b1220;border-radius:50%;background:var(--brand);box-shadow:0 0 0 1px #60a5fa}
|
|
171
|
+
@media (forced-colors: active){
|
|
172
|
+
input[type="range"]{appearance:revert;-webkit-appearance:revert;width:revert;height:revert;margin:revert;background:revert}
|
|
173
|
+
input[type="range"]::-webkit-slider-runnable-track{height:revert;border-radius:revert;background:revert}
|
|
174
|
+
input[type="range"]::-webkit-slider-thumb{-webkit-appearance:revert;width:revert;height:revert;margin-top:revert;border:revert;border-radius:revert;background:revert;box-shadow:revert}
|
|
175
|
+
input[type="range"]::-moz-range-track{height:revert;border-radius:revert;background:revert}
|
|
176
|
+
input[type="range"]::-moz-range-thumb{width:revert;height:revert;border:revert;border-radius:revert;background:revert;box-shadow:revert}
|
|
177
|
+
}
|
|
166
178
|
</style>
|
|
167
179
|
</head>
|
|
168
180
|
<body>
|