@liquidcars/atlas 0.1.12 → 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
@@ -17,7 +17,7 @@ Después abre <http://localhost:4173/> (o <http://localhost:4173/demo/>). La dem
17
17
  ```html
18
18
  <script type="module" src="./dist/liquidcars-atlas.js"></script>
19
19
 
20
- <liquidcars-atlas height="720" relation-mode="selected" shell-labels="on">
20
+ <liquidcars-atlas height="720" relation-mode="selected" shell-labels="on" toolbar="on">
21
21
  <script type="application/json">
22
22
  {
23
23
  "palette": {
@@ -51,6 +51,14 @@ const atlas = document.querySelector('liquidcars-atlas');
51
51
  atlas.model = model;
52
52
  atlas.select('distribution-agreement');
53
53
  atlas.setRelationMode('all'); // 'all' | 'selected' | 'none'
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();
54
62
  atlas.setTheme({
55
63
  background: { color: '#07121e', glow: '#20394b' },
56
64
  lighting: { ambient: 1.8, directional: 3.0 },
@@ -80,6 +88,8 @@ Geometrías incluidas en esta primera versión: `box`, `cylinder`, `sphere`, `co
80
88
 
81
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.
82
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
+
83
93
  ## Distribución
84
94
 
85
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:
@@ -93,9 +103,9 @@ Una vez publicado, los consumidores podrán instalarlo con `npm install @liquidc
93
103
  Para probar el paquete sin publicarlo, basta con instalar el tarball generado:
94
104
 
95
105
  ```bash
96
- npm install ./liquidcars-atlas-0.1.10.tgz
106
+ npm install ./liquidcars-atlas-0.1.14.tgz
97
107
  ```
98
108
 
99
109
  ## Estado
100
110
 
101
- `0.1.12` 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, 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.12"></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.12</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.12 | MIT */
1
+ /*! LiquidCars Atlas 0.1.14 | MIT */
2
2
 
3
3
  // src/three.core.js
4
4
  var REVISION = "180";
@@ -29223,7 +29223,7 @@ function makeLabel(text, color, dimensions, type = "") {
29223
29223
  }
29224
29224
  var LiquidCarsAtlas = class extends HTMLElement {
29225
29225
  static get observedAttributes() {
29226
- return ["height", "relation-mode", "shell-labels"];
29226
+ return ["height", "relation-mode", "shell-labels", "toolbar"];
29227
29227
  }
29228
29228
  constructor() {
29229
29229
  super();
@@ -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,6 +29280,10 @@ var LiquidCarsAtlas = class extends HTMLElement {
29278
29280
  this.showShellLabels = value !== "false";
29279
29281
  this.invalidate();
29280
29282
  }
29283
+ if (name === "toolbar") {
29284
+ this._toolbarVisible = value !== "off";
29285
+ if (this.ready) this._applyTheme();
29286
+ }
29281
29287
  }
29282
29288
  get model() {
29283
29289
  return this.modelData;
@@ -29303,6 +29309,66 @@ var LiquidCarsAtlas = class extends HTMLElement {
29303
29309
  this.invalidate();
29304
29310
  return this;
29305
29311
  }
29312
+ get toolbarVisible() {
29313
+ return this.hasAttribute("toolbar") ? this._toolbarVisible : this.theme.ui.toolbar !== false;
29314
+ }
29315
+ setToolbarVisible(value) {
29316
+ this._toolbarVisible = Boolean(value);
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();
29370
+ return this;
29371
+ }
29306
29372
  get styles() {
29307
29373
  return this.theme;
29308
29374
  }
@@ -29348,13 +29414,13 @@ var LiquidCarsAtlas = class extends HTMLElement {
29348
29414
  const panel = this.shadowRoot.querySelector(".panel");
29349
29415
  const hint = this.shadowRoot.querySelector(".hint");
29350
29416
  if (atlas) atlas.dataset.panel = theme.ui.panel === false ? "hidden" : "visible";
29351
- const toolbarVisible = theme.ui.toolbar !== false;
29417
+ const toolbarVisible = this.toolbarVisible;
29352
29418
  const panelVisible = theme.ui.panel !== false;
29353
29419
  const hintVisible = theme.ui.hint !== false;
29354
29420
  if (toolbar) {
29355
29421
  toolbar.dataset.hidden = String(!toolbarVisible);
29356
29422
  toolbar.hidden = !toolbarVisible;
29357
- toolbar.style.display = toolbarVisible ? "flex" : "none";
29423
+ toolbar.style.setProperty("display", toolbarVisible ? "flex" : "none", "important");
29358
29424
  }
29359
29425
  if (panel) {
29360
29426
  panel.dataset.hidden = String(!panelVisible);
@@ -29757,21 +29823,11 @@ var LiquidCarsAtlas = class extends HTMLElement {
29757
29823
  _bindControls() {
29758
29824
  this.shadowRoot.addEventListener("click", (event) => {
29759
29825
  const action = event.target.closest?.("[data-action]")?.dataset.action;
29760
- if (action === "minus") this.targetZoom = Math.max(0.55, this.targetZoom / 1.18);
29761
- if (action === "plus") this.targetZoom = Math.min(2.8, this.targetZoom * 1.18);
29762
- if (action === "fit") {
29763
- this.targetZoom = 1;
29764
- this.targetFocus.set(0, 0, 0);
29765
- }
29766
- if (action === "front") {
29767
- this.yaw = 0;
29768
- this.pitch = 0;
29769
- }
29770
- if (action === "labels") {
29771
- this.showShellLabels = !this.showShellLabels;
29772
- event.target.classList.toggle("active", this.showShellLabels);
29773
- event.target.setAttribute("aria-pressed", String(this.showShellLabels));
29774
- }
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();
29775
29831
  if (action === "relations-all") this.setRelationMode("all");
29776
29832
  if (action === "relations-selected") this.setRelationMode("selected");
29777
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.12"></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.12</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.12",
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",