@liquidcars/atlas 0.1.13 → 0.1.14

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
@@ -52,6 +52,13 @@ atlas.model = model;
52
52
  atlas.select('distribution-agreement');
53
53
  atlas.setRelationMode('all'); // 'all' | 'selected' | 'none'
54
54
  atlas.setToolbarVisible(true); // también se puede usar toolbar="on" | "off"
55
+ atlas.zoomIn();
56
+ atlas.zoomOut();
57
+ atlas.fit();
58
+ atlas.frontView();
59
+ atlas.setShellLabels(true);
60
+ atlas.openAllContainers();
61
+ atlas.closeAllContainers();
55
62
  atlas.setTheme({
56
63
  background: { color: '#07121e', glow: '#20394b' },
57
64
  lighting: { ambient: 1.8, directional: 3.0 },
@@ -81,6 +88,8 @@ Geometrías incluidas en esta primera versión: `box`, `cylinder`, `sphere`, `co
81
88
 
82
89
  La paleta puede cambiarse después de cargar el modelo mediante `atlas.setPalette({ nombre: color })` o asignando `atlas.palette = { ... }`. El cambio actualiza las piezas, aristas y relaciones sin reconstruir el modelo.
83
90
 
91
+ Las acciones de navegación y exploración de la toolbar también están disponibles para la página anfitriona: `zoomIn()`, `zoomOut()`, `fit()`, `frontView()`, `setShellLabels()`, `toggleShellLabels()`, `openAllContainers()` y `closeAllContainers()`. Así se puede construir una barra de controles propia sin depender de la toolbar interna.
92
+
84
93
  ## Distribución
85
94
 
86
95
  El archivo `dist/liquidcars-atlas.js` es un módulo ESM autocontenido: Three.js se incluye dentro del bundle, por lo que el consumidor no necesita instalar otra dependencia para probarlo. El bundle no contiene ningún modelo de negocio ni datos de LiquidCars Atlas; los modelos se suministran aparte mediante `model`, `src` o un `<script type="application/json">`. Para una distribución privada se puede servir ese archivo desde un CDN propio o desde el mismo sitio. Para publicar en npm, después de revisar el API estable:
@@ -94,9 +103,9 @@ Una vez publicado, los consumidores podrán instalarlo con `npm install @liquidc
94
103
  Para probar el paquete sin publicarlo, basta con instalar el tarball generado:
95
104
 
96
105
  ```bash
97
- npm install ./liquidcars-atlas-0.1.13.tgz
106
+ npm install ./liquidcars-atlas-0.1.14.tgz
98
107
  ```
99
108
 
100
109
  ## Estado
101
110
 
102
- `0.1.13` mantiene la corrección del desplazamiento interno del texto y ancla las etiquetas a las dimensiones reales de las geometrías redondeadas. Además fija un margen superior absoluto para las etiquetas secundarias de contenedores abiertos, situado dentro del frontal del contenedor y sin depender de sus dimensiones. También corrige los sólidos truncados, normaliza sus dimensiones finales, refuerza la visibilidad de la toolbar con el atributo `toolbar="on"`/`"off"` y `setToolbarVisible()`, desacopla la paleta por defecto de nombres de dominio y añade actualización programática de la paleta con `setPalette`.
111
+ `0.1.14` mantiene la corrección del desplazamiento interno del texto y ancla las etiquetas a las dimensiones reales de las geometrías redondeadas. Además fija un margen superior absoluto para las etiquetas secundarias de contenedores abiertos, situado dentro del frontal del contenedor y sin depender de sus dimensiones. También corrige los sólidos truncados, normaliza sus dimensiones finales, refuerza la visibilidad de la toolbar con el atributo `toolbar="on"`/`"off"` y `setToolbarVisible()`, desacopla la paleta por defecto de nombres de dominio, añade actualización programática de la paleta con `setPalette` y expone las acciones de navegación para controles externos.
package/demo/index.html CHANGED
@@ -14,12 +14,12 @@
14
14
  liquidcars-atlas { display: block; width: 100%; max-width: 1480px; margin: 0 auto; }
15
15
  code { color: #85e5d3; }
16
16
  </style>
17
- <script type="module" src="../dist/liquidcars-atlas.js?v=0.1.13"></script>
17
+ <script type="module" src="../dist/liquidcars-atlas.js?v=0.1.14"></script>
18
18
  </head>
19
19
  <body>
20
20
  <header>
21
21
  <h1>LiquidCars Atlas</h1>
22
- <p>Prueba de distribución del componente <code>&lt;liquidcars-atlas&gt;</code> · v0.1.13</p>
22
+ <p>Prueba de distribución del componente <code>&lt;liquidcars-atlas&gt;</code> · v0.1.14</p>
23
23
  </header>
24
24
  <main>
25
25
  <liquidcars-atlas id="atlas" height="720" relation-mode="selected" shell-labels="on"></liquidcars-atlas>
@@ -1,4 +1,4 @@
1
- /*! LiquidCars Atlas 0.1.13 | MIT */
1
+ /*! LiquidCars Atlas 0.1.14 | MIT */
2
2
 
3
3
  // src/three.core.js
4
4
  var REVISION = "180";
@@ -29256,6 +29256,8 @@ var LiquidCarsAtlas = class extends HTMLElement {
29256
29256
  this.relations = [];
29257
29257
  this.animationFrame = 0;
29258
29258
  this.ready = false;
29259
+ this._toolbarVisible = this.getAttribute("toolbar") !== "off";
29260
+ this.toolbar = this.shadowRoot.querySelector(".toolbar");
29259
29261
  this._bindControls();
29260
29262
  this.resizeObserver = new ResizeObserver(() => this.resize());
29261
29263
  this.resizeObserver.observe(this.canvas);
@@ -29278,7 +29280,10 @@ var LiquidCarsAtlas = class extends HTMLElement {
29278
29280
  this.showShellLabels = value !== "false";
29279
29281
  this.invalidate();
29280
29282
  }
29281
- if (name === "toolbar" && this.ready) this._applyTheme();
29283
+ if (name === "toolbar") {
29284
+ this._toolbarVisible = value !== "off";
29285
+ if (this.ready) this._applyTheme();
29286
+ }
29282
29287
  }
29283
29288
  get model() {
29284
29289
  return this.modelData;
@@ -29305,11 +29310,63 @@ var LiquidCarsAtlas = class extends HTMLElement {
29305
29310
  return this;
29306
29311
  }
29307
29312
  get toolbarVisible() {
29308
- const value = this.getAttribute("toolbar");
29309
- return value === "off" ? false : value === "on" ? true : this.theme.ui.toolbar !== false;
29313
+ return this.hasAttribute("toolbar") ? this._toolbarVisible : this.theme.ui.toolbar !== false;
29310
29314
  }
29311
29315
  setToolbarVisible(value) {
29316
+ this._toolbarVisible = Boolean(value);
29312
29317
  this.setAttribute("toolbar", value ? "on" : "off");
29318
+ this._applyTheme();
29319
+ return this;
29320
+ }
29321
+ zoomIn() {
29322
+ this.targetZoom = Math.min(2.8, this.targetZoom * 1.18);
29323
+ this.invalidate();
29324
+ return this;
29325
+ }
29326
+ zoomOut() {
29327
+ this.targetZoom = Math.max(0.55, this.targetZoom / 1.18);
29328
+ this.invalidate();
29329
+ return this;
29330
+ }
29331
+ fit() {
29332
+ this.targetZoom = 1;
29333
+ this.targetFocus.set(0, 0, 0);
29334
+ this.invalidate();
29335
+ return this;
29336
+ }
29337
+ frontView() {
29338
+ this.yaw = 0;
29339
+ this.pitch = 0;
29340
+ this.invalidate();
29341
+ return this;
29342
+ }
29343
+ setShellLabels(value) {
29344
+ this.showShellLabels = Boolean(value);
29345
+ this.setAttribute("shell-labels", this.showShellLabels ? "on" : "false");
29346
+ const button = this.shadowRoot.querySelector('[data-action="labels"]');
29347
+ if (button) {
29348
+ button.classList.toggle("active", this.showShellLabels);
29349
+ button.setAttribute("aria-pressed", String(this.showShellLabels));
29350
+ }
29351
+ this.invalidate();
29352
+ return this;
29353
+ }
29354
+ toggleShellLabels() {
29355
+ return this.setShellLabels(!this.showShellLabels);
29356
+ }
29357
+ openAllContainers() {
29358
+ for (const node of this.nodes.values()) if (node.type === "shell") this.open.add(node.id);
29359
+ this._renderPanel();
29360
+ this._rebuildRelations();
29361
+ this.invalidate();
29362
+ return this;
29363
+ }
29364
+ closeAllContainers() {
29365
+ this.open.clear();
29366
+ this.selected = null;
29367
+ this._renderPanel();
29368
+ this._rebuildRelations();
29369
+ this.invalidate();
29313
29370
  return this;
29314
29371
  }
29315
29372
  get styles() {
@@ -29363,7 +29420,7 @@ var LiquidCarsAtlas = class extends HTMLElement {
29363
29420
  if (toolbar) {
29364
29421
  toolbar.dataset.hidden = String(!toolbarVisible);
29365
29422
  toolbar.hidden = !toolbarVisible;
29366
- toolbar.style.display = toolbarVisible ? "flex" : "none";
29423
+ toolbar.style.setProperty("display", toolbarVisible ? "flex" : "none", "important");
29367
29424
  }
29368
29425
  if (panel) {
29369
29426
  panel.dataset.hidden = String(!panelVisible);
@@ -29766,21 +29823,11 @@ var LiquidCarsAtlas = class extends HTMLElement {
29766
29823
  _bindControls() {
29767
29824
  this.shadowRoot.addEventListener("click", (event) => {
29768
29825
  const action = event.target.closest?.("[data-action]")?.dataset.action;
29769
- if (action === "minus") this.targetZoom = Math.max(0.55, this.targetZoom / 1.18);
29770
- if (action === "plus") this.targetZoom = Math.min(2.8, this.targetZoom * 1.18);
29771
- if (action === "fit") {
29772
- this.targetZoom = 1;
29773
- this.targetFocus.set(0, 0, 0);
29774
- }
29775
- if (action === "front") {
29776
- this.yaw = 0;
29777
- this.pitch = 0;
29778
- }
29779
- if (action === "labels") {
29780
- this.showShellLabels = !this.showShellLabels;
29781
- event.target.classList.toggle("active", this.showShellLabels);
29782
- event.target.setAttribute("aria-pressed", String(this.showShellLabels));
29783
- }
29826
+ if (action === "minus") this.zoomOut();
29827
+ if (action === "plus") this.zoomIn();
29828
+ if (action === "fit") this.fit();
29829
+ if (action === "front") this.frontView();
29830
+ if (action === "labels") this.toggleShellLabels();
29784
29831
  if (action === "relations-all") this.setRelationMode("all");
29785
29832
  if (action === "relations-selected") this.setRelationMode("selected");
29786
29833
  if (action === "relations-none") this.setRelationMode("none");
package/index.html CHANGED
@@ -14,12 +14,12 @@
14
14
  liquidcars-atlas { display: block; width: 100%; max-width: 1480px; margin: 0 auto; }
15
15
  code { color: #85e5d3; }
16
16
  </style>
17
- <script type="module" src="./dist/liquidcars-atlas.js?v=0.1.13"></script>
17
+ <script type="module" src="./dist/liquidcars-atlas.js?v=0.1.14"></script>
18
18
  </head>
19
19
  <body>
20
20
  <header>
21
21
  <h1>LiquidCars Atlas</h1>
22
- <p>Prueba de distribución del componente <code>&lt;liquidcars-atlas&gt;</code> · v0.1.13</p>
22
+ <p>Prueba de distribución del componente <code>&lt;liquidcars-atlas&gt;</code> · v0.1.14</p>
23
23
  </header>
24
24
  <main>
25
25
  <liquidcars-atlas id="atlas" height="720" relation-mode="selected" shell-labels="on"></liquidcars-atlas>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liquidcars/atlas",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Reusable 3D conceptual atlas Web Component for LiquidCars-style models",
5
5
  "type": "module",
6
6
  "main": "./dist/liquidcars-atlas.js",