@liquidcars/atlas 0.1.41 → 0.1.42

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
@@ -169,6 +169,7 @@ componente aplica `break-inside: avoid` durante la impresión.
169
169
  - `theme` (opcional): configuración de `background`, `lighting`, `panel`, `toolbar`, `breadcrumbs`, `hint` y `ui`. `ui` permite mostrar u ocultar `panel`, `toolbar`, `breadcrumbs` y `hint`.
170
170
  - `render.camera` (opcional): vista inicial con `position`, `target` y `zoom`. Las coordenadas pertenecen al espacio del modelo; `zoom` conserva el encuadre relativo entre tamaños de visor.
171
171
  - `render.focus` (opcional): filtrado visual por selección. `mode` acepta `all` o `connected`, `effect` acepta `dim` o `hide`, y `layout` distingue posiciones estables (`preserve`) de una proyección recompilada (`reflow`).
172
+ - `style.label.anchor` (opcional): posición predeterminada de las etiquetas de los elementos (`auto`, `top`, `bottom`, `left` o `right`). Si se omite, los elementos usan `bottom`; una entidad puede sobrescribirlo con su propio `style.label.anchor`. Los títulos de contenedores mantienen su colocación automática salvo override explícito.
172
173
  - `entities`: objetos con `id`, `name`, `p`, `s`, `c`, `type`, `text`, `url` y opcionalmente `parent`, `geometry`, `radius`, `segments`, `frontLabel`, `anchor` y `ports`. Un contenedor puede declarar `open: true` para comenzar abierto; el valor predeterminado es cerrado y se omite al serializar. Las URL HTTP(S) se abren en una pestaña nueva desde el panel de información.
173
174
  - `p` es la posición local respecto a `parent`; una entidad sin `parent` usa coordenadas de escena.
174
175
  - `s` son dimensiones absolutas locales `[x, y, z]`.
@@ -11890,7 +11890,7 @@ var Qc = class {
11890
11890
  }
11891
11891
  }, $c = {
11892
11892
  name: "@liquidcars/atlas",
11893
- version: "0.1.41",
11893
+ version: "0.1.42",
11894
11894
  description: "Reusable 3D conceptual atlas Web Component for LiquidCars-style models",
11895
11895
  type: "module",
11896
11896
  scripts: {
@@ -12673,7 +12673,11 @@ function iu(e) {
12673
12673
  let t = String(e || "auto").trim().toLowerCase();
12674
12674
  return ru.includes(t) ? t : "auto";
12675
12675
  }
12676
- function au(e, t, n, r, i = .025) {
12676
+ function au(e = {}, t = {}) {
12677
+ let n = e.style?.label?.anchor ?? e.labelAnchor ?? e.label_anchor, r = xl(e.type) ? "auto" : t?.label?.anchor ?? "bottom";
12678
+ return iu(n ?? r);
12679
+ }
12680
+ function ou(e, t, n, r, i = .025) {
12677
12681
  let a = iu(e);
12678
12682
  if (a === "auto") return null;
12679
12683
  let o = Math.max(0, Number(t?.x) || 0), s = Math.max(0, Number(t?.y) || 0);
@@ -12701,7 +12705,7 @@ function au(e, t, n, r, i = .025) {
12701
12705
  backRotation: Math.PI / 2
12702
12706
  };
12703
12707
  }
12704
- function ou(e, t, n, r = "", i = !0) {
12708
+ function su(e, t, n, r = "", i = !0) {
12705
12709
  let a = document.createElement("canvas"), o = a.getContext("2d"), s = n.x * .88, c = Math.min(.82, n.y * .64);
12706
12710
  a.width = Math.ceil(s * 320), a.height = Math.ceil(c * 320), o.imageSmoothingEnabled = !0, o.imageSmoothingQuality = "high", o.clearRect(0, 0, a.width, a.height);
12707
12711
  let l = a.height * .62;
@@ -12746,7 +12750,7 @@ function ou(e, t, n, r = "", i = !0) {
12746
12750
  ]) e.renderOrder = 20, e.frustumCulled = !1, e.material.depthTest = !0, e.material.depthWrite = !1, e.material.transparent = !0;
12747
12751
  return x.renderOrder = 20, x.frustumCulled = !1, x.userData.front = S, x.userData.back = C, x.userData.top = w, x.userData.height = c, x.userData.width = s, x.userData.textOffsetX = h, x.userData.textOffsetY = g, x.userData.nodeLabel = !0, x;
12748
12752
  }
12749
- function su(e, t, n, r = globalThis.document) {
12753
+ function cu(e, t, n, r = globalThis.document) {
12750
12754
  if (!e || !t || !n || !r?.createElement) return null;
12751
12755
  try {
12752
12756
  e.render(t, n);
@@ -12768,7 +12772,7 @@ function su(e, t, n, r = globalThis.document) {
12768
12772
  return null;
12769
12773
  }
12770
12774
  }
12771
- var cu = class extends HTMLElement {
12775
+ var lu = class extends HTMLElement {
12772
12776
  static version = $c;
12773
12777
  static get observedAttributes() {
12774
12778
  return [
@@ -12857,7 +12861,7 @@ var cu = class extends HTMLElement {
12857
12861
  this.setPalette(e);
12858
12862
  }
12859
12863
  captureFrame() {
12860
- return su(this.renderer, this.scene, this.camera, this.ownerDocument);
12864
+ return cu(this.renderer, this.scene, this.camera, this.ownerDocument);
12861
12865
  }
12862
12866
  prepareForPrint() {
12863
12867
  if (this._printState) return this;
@@ -13586,7 +13590,7 @@ var cu = class extends HTMLElement {
13586
13590
  1
13587
13591
  ] : e.s), t.group.add(t.edge);
13588
13592
  }
13589
- t.label = ou(e.name, a, t.labelSize, e.type, this.showShellLabels), t.labelAnchor = iu(e.style?.label?.anchor ?? e.labelAnchor ?? e.label_anchor), t.label.userData.node = t, t.label.traverse((e) => {
13593
+ t.label = su(e.name, a, t.labelSize, e.type, this.showShellLabels), t.labelAnchor = au(e, this.modelData.style), t.label.userData.node = t, t.label.traverse((e) => {
13590
13594
  e.userData.node = t;
13591
13595
  }), t.group.add(t.label), this.scene.add(t.group);
13592
13596
  }
@@ -13780,7 +13784,7 @@ var cu = class extends HTMLElement {
13780
13784
  e.edge?.material && (e.edge.material.opacity = (e === this.selected ? 1 : .65) * t);
13781
13785
  let o = xl(e.type) && r, s = o, c = e.label.userData.front, l = e.label.userData.back, u = e.label.userData.top, d = e.label.userData.height, f = e.label.userData.width, p = e.label.userData.textOffsetX || 0;
13782
13786
  e.label.userData.textOffsetY;
13783
- let m = e.labelSize || new U().fromArray(e.s), h = au(e.labelAnchor, m, f, d);
13787
+ let m = e.labelSize || new U().fromArray(e.s), h = ou(e.labelAnchor, m, f, d);
13784
13788
  e.label.visible = n;
13785
13789
  let g = this._worldPosition(e), _ = this.itemFacing === "camera" && !xl(e.type) || this.camera.position.z >= g.z, v = this.camera.position.y > g.y + .25;
13786
13790
  if (h) c.visible = _, l.visible = !_, u.visible = !1, c.scale.setScalar(1), l.scale.setScalar(1), c.position.set(h.x, h.y, m.z / 2 + .025), l.position.set(h.x, h.y, -m.z / 2 - .025), c.rotation.z = h.frontRotation, l.rotation.z = h.backRotation, c.material.color.set(15923964), l.material.color.set(15923964), c.material.opacity = t, l.material.opacity = t;
@@ -13955,8 +13959,8 @@ var cu = class extends HTMLElement {
13955
13959
  n ? n.textContent = e : t.insertAdjacentHTML("beforeend", "<div class=\"error\" role=\"alert\">" + Rl(e) + "</div>");
13956
13960
  }
13957
13961
  };
13958
- customElements.get("liquidcars-atlas") || customElements.define("liquidcars-atlas", cu);
13962
+ customElements.get("liquidcars-atlas") || customElements.define("liquidcars-atlas", lu);
13959
13963
  //#endregion
13960
- export { $c as ATLAS_VERSION, cu as LiquidCarsAtlas, su as captureRendererFrame, eu as createSvgExtrudeGeometry, vl as getGeometryCatalog, yl as getGeometryPackCatalog, au as labelPlacementForAnchor, iu as normalizeLabelAnchor, Bl as normalizeModel, gl as registerGeometryPack, _l as unregisterGeometryPack };
13964
+ export { $c as ATLAS_VERSION, lu as LiquidCarsAtlas, cu as captureRendererFrame, eu as createSvgExtrudeGeometry, vl as getGeometryCatalog, yl as getGeometryPackCatalog, ou as labelPlacementForAnchor, iu as normalizeLabelAnchor, Bl as normalizeModel, gl as registerGeometryPack, au as resolveEntityLabelAnchor, _l as unregisterGeometryPack };
13961
13965
 
13962
13966
  //# sourceMappingURL=liquidcars-atlas.js.map