partforge 0.89.0 → 0.90.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "partforge",
3
- "version": "0.89.0",
3
+ "version": "0.90.0",
4
4
  "description": "Turn a declarative part definition into a parametric-CAD web app (three.js + Manifold/Replicad). Requires a Vite-based consumer.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -444,15 +444,44 @@ export function mount(part, { createWorker, elements = {}, onBuild, onPick, onDo
444
444
  stage: els.viewer, tooltip, send: annotateSend,
445
445
  });
446
446
  cleanup.defer(() => sketchToolbar.detach());
447
- const viewbarForSketch = els.viewer.querySelector("#viewbar");
448
- let viewbarWasHidden = false;
447
+ // Chrome the sketch toolbar stands in for while the mode is on. #viewbar
448
+ // because the toolbar carries its own tools; the view tabs because the
449
+ // toolbar floats in THEIR slot — both are the stage's top centre — and the
450
+ // two are not the same width, so a part with several views left its tabs
451
+ // peeking out either side (78px each side for a five-view part on a
452
+ // 1400px stage). The toolbar paints over them at z 20, so this was only
453
+ // ever about what shows.
454
+ //
455
+ // Each element remembers whatever hidden state the host had set and gets
456
+ // it back on exit, rather than being forced visible: a host with its own
457
+ // reason to hide either one must see that reason survive a round-trip.
458
+ //
459
+ // `hidden` is set for the semantics AND `display` inline for the effect.
460
+ // The property alone is not enough: app.css gives both the viewbar and the
461
+ // tab pill an author-origin `display`, which beats the UA's [hidden] rule
462
+ // — #viewbar[hidden] already carries an explicit rule for exactly that.
463
+ // A rule cannot fix the tabs the same way, because a host that restyles
464
+ // the pill under its own id (partforge-cloud's `#viewer #part`) outranks
465
+ // anything this framework could ship, so the hide rides on the element
466
+ // itself for the same reason view-tabs.js's nowrap does.
467
+ const sketchHides = [els.viewer.querySelector("#viewbar"), els.tabs]
468
+ .filter(Boolean)
469
+ .map((el) => ({ el, wasHidden: false, wasDisplay: "" }));
449
470
  cleanup.defer(annotateMode.onModeChange(() => {
450
- if (!viewbarForSketch) return;
451
- if (annotateMode.isEnabled()) {
452
- viewbarWasHidden = viewbarForSketch.hidden;
453
- viewbarForSketch.hidden = true;
454
- } else {
455
- viewbarForSketch.hidden = viewbarWasHidden;
471
+ // setEnabled early-returns when the mode is unchanged, so this only ever
472
+ // runs on a real transition and the saved state cannot be overwritten
473
+ // with the state we just imposed.
474
+ const on = annotateMode.isEnabled();
475
+ for (const entry of sketchHides) {
476
+ if (on) {
477
+ entry.wasHidden = entry.el.hidden;
478
+ entry.wasDisplay = entry.el.style.display;
479
+ entry.el.hidden = true;
480
+ entry.el.style.display = "none";
481
+ } else {
482
+ entry.el.hidden = entry.wasHidden;
483
+ entry.el.style.display = entry.wasDisplay;
484
+ }
456
485
  }
457
486
  }));
458
487
  }