@liquidcars/atlas 0.2.0 → 0.2.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/README.md CHANGED
@@ -548,3 +548,5 @@ presentation as well as its history.
548
548
  Interactive 2D now draws the independently calculated diagram using an orthographic WebGL camera. The orientation cube, pseudo-camera, focus, item/relationship filters and layout spacing remain available. Pan and zoom do not recalculate layout. Containers are packed bottom-up with their complete subtrees: unrelated bounds remain separate and descendants stay within their parents. Light/dark backgrounds, a dotted grid, flat geometry and cached captions preserve the diagram style.
549
549
 
550
550
  `computeDiagramLayout(atlas, options)` returns layout data without generating SVG. `renderDiagramSvg` / `exportDiagramSvg` remain explicit vector exports using the same layout and reusable geometry symbols. Canonical model positions remain unchanged. Interactive diagrams require WebGL; hosts should offer a list/tree alternative if it is unavailable. Detached geometry building and vector export remain available without a GPU. Camera and diagram state are distinct and retain their existing APIs.
551
+
552
+ 0.2.1 also tolerates empty camera/diagram snapshots when restoring navigation after replacing a model; a missing camera leaves the current framing intact.
@@ -17170,7 +17170,7 @@ var Oh = class {
17170
17170
  }
17171
17171
  }, kh = {
17172
17172
  name: "@liquidcars/atlas",
17173
- version: "0.2.0",
17173
+ version: "0.2.1",
17174
17174
  description: "Reusable 3D conceptual atlas Web Component for LiquidCars-style models",
17175
17175
  type: "module",
17176
17176
  scripts: {
@@ -18787,7 +18787,7 @@ function _g(e, t, n, r) {
18787
18787
  let e = this.ownerDocument.createElement("style");
18788
18788
  e.textContent = ":host([data-planar=\"true\"]) .viewport>canvas{visibility:visible!important;pointer-events:auto!important}\n :host([data-planar=\"true\"]) .diagram-view{display:none!important}\n :host([data-planar=\"true\"]) [data-toolbar-group=\"camera\"]{display:none!important}\n :host([data-planar=\"true\"]) [data-toolbar-group=\"copy\"]{display:flex!important}\n .diagram-toolbar .toolbar-popover{max-height:min(420px,calc(100dvh - 160px),var(--lc-menu-height,420px));overflow-y:auto}\n .diagram-appearance{padding:6px 9px;display:grid;gap:8px;color:#dbe7ec;font-size:12px}.diagram-appearance label{display:flex;gap:8px;align-items:center}", this.shadowRoot.append(e);
18789
18789
  let t = this.diagramView, n = t.setState.bind(t), r = t.action.bind(t);
18790
- t.setState = (e = {}) => n(gg(e, this._canonicalDiagramCenter(), e.orbitId ? this._diagramOrbitTarget(e.orbitId) : null)), t.refresh = () => this._webglPlanar ? (this._scheduleDiagram(), !0) : !1, t.scheduleRefresh = () => {
18790
+ t.setState = (e = {}) => n(gg(e, this._canonicalDiagramCenter(), e?.orbitId ? this._diagramOrbitTarget(e.orbitId) : null)), t.refresh = () => this._webglPlanar ? (this._scheduleDiagram(), !0) : !1, t.scheduleRefresh = () => {
18791
18791
  this._webglPlanar && this._scheduleDiagram();
18792
18792
  }, t.focusSelection = () => this.focusSelection(), t.action = (e, t) => e === "diagram-plus" ? (this.zoomIn(), !0) : e === "diagram-minus" ? (this.zoomOut(), !0) : e === "diagram-fit" ? (this.fit(), !0) : r(e, t), this.toolbar.querySelector("[data-toolbar-menu=\"diagram-options\"] .toolbar-popover")?.insertAdjacentHTML("beforeend", "<div class=\"diagram-appearance\"><label><input type=\"checkbox\" data-diagram-light checked>Fondo claro</label><label><input type=\"checkbox\" data-diagram-grid checked>Cuadrícula de puntos</label></div>"), this.toolbar.addEventListener("change", (e) => {
18793
18793
  e.target.matches("[data-diagram-light]") && t.setConfig({ theme: e.target.checked ? "light" : "dark" }), e.target.matches("[data-diagram-grid]") && t.setConfig({ grid: e.target.checked });
@@ -18939,7 +18939,7 @@ function _g(e, t, n, r) {
18939
18939
  projection: "orthographic"
18940
18940
  } : a.getCameraView.call(this);
18941
18941
  }, i.setCameraView = function(e = {}, t = {}) {
18942
- return this._webglPlanar ? (this._diagramFitted = !1, e.target?.length === 3 && e.target.every(Number.isFinite) && this.targetFocus.set(e.target[0], e.target[1], 0), Number.isFinite(e.zoom) && e.zoom > 0 && (this.targetZoom = Math.max(.001, Math.min(6, e.zoom))), t.animate === !1 && (this.focus.copy(this.targetFocus), this.zoom = this.targetZoom), this.invalidate(), this) : a.setCameraView.call(this, e, t);
18942
+ return !e || typeof e != "object" ? this : this._webglPlanar ? (this._diagramFitted = !1, e.target?.length === 3 && e.target.every(Number.isFinite) && this.targetFocus.set(e.target[0], e.target[1], 0), Number.isFinite(e.zoom) && e.zoom > 0 && (this.targetZoom = Math.max(.001, Math.min(6, e.zoom))), t.animate === !1 && (this.focus.copy(this.targetFocus), this.zoom = this.targetZoom), this.invalidate(), this) : a.setCameraView.call(this, e, t);
18943
18943
  }, i._panByPixels = function(e, t) {
18944
18944
  if (!this._webglPlanar) return a._panByPixels.call(this, e, t);
18945
18945
  this._diagramFitted = !1;
@@ -18998,7 +18998,7 @@ function _g(e, t, n, r) {
18998
18998
  }, i.captureDiagramView = function() {
18999
18999
  return this.getDiagramView();
19000
19000
  }, i.setDiagramView = function(e = {}) {
19001
- return this.diagramView.setState(e), this._webglPlanar && e.viewport?.projection === "orthographic" && (this._diagramFitted = !1, this.setCameraView(e.viewport, { animate: !1 }), this._diagramFitted = e.viewport.fitted === !0), this;
19001
+ return e ??= {}, this.diagramView.setState(e), this._webglPlanar && e.viewport?.projection === "orthographic" && (this._diagramFitted = !1, this.setCameraView(e.viewport, { animate: !1 }), this._diagramFitted = e.viewport.fitted === !0), this;
19002
19002
  }, i._renderFrame = function(e) {
19003
19003
  let t = performance.now(), n = a._renderFrame.call(this, e);
19004
19004
  return this._webglPlanar && (this.dataset.frameMs = (performance.now() - t).toFixed(2), this.dataset.frames = String((Number(this.dataset.frames) || 0) + 1), this.dataset.drawCalls = String(this.renderer?.info.render.calls || 0)), n;
@@ -21292,6 +21292,7 @@ var gv = class extends HTMLElement {
21292
21292
  };
21293
21293
  }
21294
21294
  setCameraView(e = {}, t = {}) {
21295
+ if (!e || typeof e != "object") return this;
21295
21296
  let n = Array.isArray(e.position) && e.position.length === 3 && e.position.every(Number.isFinite) ? new W().fromArray(e.position) : null, r = Array.isArray(e.target) && e.target.length === 3 && e.target.every(Number.isFinite) ? new W().fromArray(e.target) : new W();
21296
21297
  if (!n) return this;
21297
21298
  let i = n.clone().sub(r), a = i.length();