@thoughts-on-things/vantage-mc 0.10.0 → 0.12.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.
@@ -1,6 +1,6 @@
1
- import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-E7Y7K6NH.js';
2
- export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-E7Y7K6NH.js';
3
- import '../chunk-LZCXJU4U.js';
1
+ import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-QV6SDOVV.js';
2
+ export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-QV6SDOVV.js';
3
+ import '../chunk-GKNIX375.js';
4
4
  import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useContext } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
 
@@ -146,8 +146,12 @@ var CSS = `
146
146
  .vtg-nav {
147
147
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
148
148
  display: flex; align-items: center; gap: 6px; padding: 6px;
149
+ /* On a phone the cluster is wider than the screen; it scrolls inside its own
150
+ glass rather than running off the edge. */
151
+ max-width: calc(100% - 32px); overflow-x: auto; scrollbar-width: none;
149
152
  animation: vtg-rise 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
150
153
  }
154
+ .vtg-nav::-webkit-scrollbar { display: none; }
151
155
  .vtg-navbtn {
152
156
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
153
157
  border-radius: 9px; border: 1px solid transparent; background: transparent;
@@ -160,7 +164,7 @@ var CSS = `
160
164
  .vtg-navbtn-text { width: auto; min-width: 30px; padding: 0 8px; font: 700 11px var(--vtg-mono); letter-spacing: 0.03em; }
161
165
  .vtg-navbtn.vtg-on { background: var(--vtg-accent); border-color: var(--vtg-accent); color: #07101f; }
162
166
  .vtg-navbtn.vtg-on:hover { background: var(--vtg-accent); color: #07101f; }
163
- .vtg-nav-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--vtg-line); }
167
+ .vtg-nav-sep { width: 1px; flex: none; align-self: stretch; margin: 4px 2px; background: var(--vtg-line); }
164
168
 
165
169
  .vtg-compass {
166
170
  position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%;
@@ -175,7 +179,7 @@ var CSS = `
175
179
  .vtg-compass .vtg-cn { fill: var(--vtg-dim); font: 700 6px var(--vtg-sans); }
176
180
 
177
181
  .vtg-coords {
178
- display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px;
182
+ display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px; flex: none;
179
183
  font: 11px var(--vtg-mono); color: var(--vtg-muted); font-variant-numeric: tabular-nums;
180
184
  white-space: nowrap;
181
185
  }
@@ -238,6 +242,66 @@ var CSS = `
238
242
  .vtg-depth-close svg { width: 13px; height: 13px; display: block; }
239
243
  @keyframes vtg-rise-y { from { opacity: 0; transform: translate(-8px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
240
244
 
245
+ /* --- dimension picker ------------------------------------------------------ */
246
+ .vtg-dims {
247
+ position: absolute; display: flex; align-items: center; gap: 3px; padding: 4px;
248
+ /* Many dimensions (a data-pack world) scroll rather than push the row past
249
+ the viewport edge; the bar keeps its own scrollbar out of the way. */
250
+ max-width: calc(100% - 32px); overflow-x: auto; scrollbar-width: none;
251
+ /* The centred variant carries its own translate, so it opts out of the
252
+ shared rise animation's transform rather than fighting it. */
253
+ animation: vtg-fade 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
254
+ }
255
+ .vtg-dims::-webkit-scrollbar { display: none; }
256
+ .vtg-dims-tc { top: 16px; left: 50%; transform: translateX(-50%); }
257
+ .vtg-dims-tl { top: 16px; left: 16px; }
258
+ .vtg-dims-tr { top: 16px; right: 16px; }
259
+ .vtg-dims-bl { bottom: 16px; left: 16px; }
260
+ .vtg-dims-br { bottom: 16px; right: 16px; }
261
+ @keyframes vtg-fade { from { opacity: 0; } to { opacity: 1; } }
262
+ .vtg-dim-btn {
263
+ /* Each dimension carries a restrained accent of its own \u2014 the glyph wears it
264
+ when idle, the whole pill when current. */
265
+ --vtg-k: var(--vtg-accent);
266
+ display: flex; align-items: center; gap: 7px; padding: 5px 11px; flex: none;
267
+ border-radius: 9px; border: 1px solid transparent; background: transparent;
268
+ font: 600 11px var(--vtg-sans); letter-spacing: 0.03em; color: var(--vtg-muted);
269
+ cursor: pointer; white-space: nowrap;
270
+ transition: background 0.15s, color 0.15s, border-color 0.15s;
271
+ }
272
+ .vtg-dim-btn.vtg-k-nether { --vtg-k: #ff8b4a; }
273
+ .vtg-dim-btn.vtg-k-end { --vtg-k: #b39bff; }
274
+ .vtg-dim-btn.vtg-k-custom { --vtg-k: #6fd6bd; }
275
+ .vtg-dim-btn:hover:not(:disabled) { background: rgba(132, 170, 230, 0.14); color: var(--vtg-text); border-color: var(--vtg-line); }
276
+ .vtg-dim-btn:active:not(:disabled) { background: rgba(91, 155, 255, 0.26); }
277
+ .vtg-dim-btn.vtg-on { background: var(--vtg-k); border-color: var(--vtg-k); color: #07101f; }
278
+ .vtg-dim-btn.vtg-on:hover { background: var(--vtg-k); color: #07101f; }
279
+ .vtg-dim-btn:disabled { opacity: 0.38; cursor: default; }
280
+ .vtg-dim-btn:focus-visible { outline: 2px solid var(--vtg-accent); outline-offset: 1px; }
281
+ .vtg-dim-btn.vtg-on:focus-visible { outline-color: var(--vtg-text); }
282
+ /* Fixed slot so swapping glyph \u2192 spinner never resizes the pill. */
283
+ .vtg-dim-ico { width: 15px; height: 15px; flex: none; display: grid; place-items: center; color: var(--vtg-k); }
284
+ .vtg-dim-ico svg { width: 15px; height: 15px; display: block; }
285
+ .vtg-dim-btn.vtg-on .vtg-dim-ico { color: inherit; }
286
+ .vtg-dim-spin {
287
+ width: 11px; height: 11px; border-radius: 50%; border: 1.6px solid currentColor;
288
+ border-top-color: transparent; animation: vtg-spin 0.7s linear infinite;
289
+ }
290
+ @keyframes vtg-spin { to { transform: rotate(360deg); } }
291
+ /* Tight viewports: only the current dimension keeps its name, the rest stay
292
+ glyphs \u2014 the row still reads, and it stops crowding the corner panels. */
293
+ @media (max-width: 900px) {
294
+ .vtg-dim-btn { padding: 6px 8px; }
295
+ .vtg-dim-btn:not(.vtg-on) .vtg-dim-label { display: none; }
296
+ }
297
+ /* Phone width: both top corners are taken, so the row joins the bottom stack,
298
+ sitting just above the navigation cluster. */
299
+ @media (max-width: 640px) {
300
+ .vtg-dims-tc, .vtg-dims-tl, .vtg-dims-tr, .vtg-dims-bl, .vtg-dims-br {
301
+ top: auto; bottom: 64px; left: 50%; right: auto; transform: translateX(-50%);
302
+ }
303
+ }
304
+
241
305
  /* --- centre reticle (navigation reference) -------------------------------- */
242
306
  .vtg-reticle {
243
307
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
@@ -261,6 +325,26 @@ var CSS = `
261
325
  @keyframes vtg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
262
326
  .vtg-nav { animation-name: vtg-rise-x; }
263
327
  @keyframes vtg-rise-x { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
328
+
329
+ /* --- keyboard focus -------------------------------------------------------- */
330
+ /* One ring for every control, drawn only for keyboard users. */
331
+ .vtg-navbtn:focus-visible,
332
+ .vtg-compass:focus-visible,
333
+ .vtg-depth-close:focus-visible,
334
+ .vtg-toggle:focus-visible,
335
+ .vtg-seg button:focus-visible {
336
+ outline: 2px solid var(--vtg-accent); outline-offset: 1px;
337
+ }
338
+ .vtg-navbtn.vtg-on:focus-visible, .vtg-toggle.vtg-on:focus-visible { outline-color: var(--vtg-text); }
339
+
340
+ /* --- reduced motion -------------------------------------------------------- */
341
+ @media (prefers-reduced-motion: reduce) {
342
+ .vtg-panel, .vtg-nav, .vtg-dims, .vtg-depth { animation: none; }
343
+ .vtg-slider input[type=range]::-webkit-slider-thumb:hover { transform: none; }
344
+ /* The spinner still has to read as "working", so it breathes instead of turns. */
345
+ .vtg-dim-spin { animation: vtg-pulse 1.4s ease-in-out infinite; }
346
+ }
347
+ @keyframes vtg-pulse { 50% { opacity: 0.3; } }
264
348
  `;
265
349
  function injectStyles() {
266
350
  if (typeof document === "undefined") return;
@@ -280,7 +364,9 @@ var INITIAL = {
280
364
  biomes: [],
281
365
  biomeLayerEnabled: false,
282
366
  highlightedBiome: null,
283
- hoveredBiome: null
367
+ hoveredBiome: null,
368
+ dimensions: [],
369
+ dimension: null
284
370
  };
285
371
  var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
286
372
  const {
@@ -341,6 +427,7 @@ var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
341
427
  });
342
428
  }),
343
429
  v.on("biomes", (biomes) => setS((p) => ({ ...p, biomes }))),
430
+ v.on("dimension", ({ dimensions, current }) => setS((p) => ({ ...p, dimensions, dimension: current }))),
344
431
  v.on("hover", (id) => setS((p) => p.hoveredBiome === id ? p : { ...p, hoveredBiome: id })),
345
432
  v.on(
346
433
  "biomelayer",
@@ -387,7 +474,9 @@ var VantageViewer2 = forwardRef(function VantageViewer3(props, ref) {
387
474
  biomes: s.biomes,
388
475
  biomeLayerEnabled: s.biomeLayerEnabled,
389
476
  highlightedBiome: s.highlightedBiome,
390
- hoveredBiome: s.hoveredBiome
477
+ hoveredBiome: s.hoveredBiome,
478
+ dimensions: s.dimensions,
479
+ dimension: s.dimension
391
480
  }),
392
481
  [engine, s]
393
482
  );
@@ -836,12 +925,37 @@ function MapNav({
836
925
  )
837
926
  ] });
838
927
  }
928
+ var CORE = {
929
+ overworld: {
930
+ gradient: "linear-gradient(180deg, #6f9bce 0%, #6e9150 12%, #6e6f74 48%, #3e424b 76%, #16181d 100%)",
931
+ marks: [
932
+ { y: 63, label: "sea" },
933
+ { y: 0, label: "0" }
934
+ ]
935
+ },
936
+ nether: {
937
+ // Roof crust, netherrack, then the lava sea the caverns bottom out in.
938
+ gradient: "linear-gradient(180deg, #3a2320 0%, #6b3330 22%, #7a3a38 62%, #b4471d 88%, #d9691f 100%)",
939
+ marks: [
940
+ { y: 31, label: "lava" },
941
+ { y: 4, label: "floor" }
942
+ ]
943
+ },
944
+ end: {
945
+ gradient: "linear-gradient(180deg, #17131f 0%, #2a2338 34%, #ded8a5 62%, #b8b183 82%, #17131f 100%)",
946
+ marks: [{ y: 49, label: "gate" }]
947
+ },
948
+ custom: {
949
+ gradient: "linear-gradient(180deg, #6f9bce 0%, #6e9150 12%, #6e6f74 48%, #3e424b 76%, #16181d 100%)",
950
+ marks: [{ y: 0, label: "0" }]
951
+ }
952
+ };
839
953
  function isTypingTarget2(t) {
840
954
  if (!(t instanceof HTMLElement)) return false;
841
955
  return t.isContentEditable || t.tagName === "INPUT" || t.tagName === "TEXTAREA";
842
956
  }
843
957
  function DepthSlider({ toggleKey = "c", step = 4, className }) {
844
- const { viewer, info } = useVantage();
958
+ const { viewer, info, dimension } = useVantage();
845
959
  const trackRef = useRef(null);
846
960
  const [sliceY, setSliceY] = useState(null);
847
961
  useEffect(() => {
@@ -878,9 +992,8 @@ function DepthSlider({ toggleKey = "c", step = 4, className }) {
878
992
  e.currentTarget.setPointerCapture(e.pointerId);
879
993
  setFromPointer(e);
880
994
  };
881
- const marks = [];
882
- if (63 > min && 63 < max) marks.push({ y: 63, label: "sea" });
883
- if (0 > min && 0 < max) marks.push({ y: 0, label: "0" });
995
+ const core = CORE[dimension?.kind ?? "overworld"];
996
+ const marks = core.marks.filter((m) => m.y > min && m.y < max);
884
997
  return /* @__PURE__ */ jsxs("div", { className: className ? `vtg-depth vtg-glass ${className}` : "vtg-depth vtg-glass", role: "group", "aria-label": "cave view depth", children: [
885
998
  /* @__PURE__ */ jsxs("div", { className: "vtg-depth-val", title: "Slice depth (world Y)", children: [
886
999
  /* @__PURE__ */ jsx("b", { children: "Y" }),
@@ -905,7 +1018,7 @@ function DepthSlider({ toggleKey = "c", step = 4, className }) {
905
1018
  else if (e.key === "ArrowDown") viewer.setSlice(sliceY - 1);
906
1019
  },
907
1020
  children: [
908
- /* @__PURE__ */ jsx("div", { className: "vtg-depth-track", children: /* @__PURE__ */ jsx("div", { className: "vtg-depth-cut", style: { height: `${thumbTop}%` } }) }),
1021
+ /* @__PURE__ */ jsx("div", { className: "vtg-depth-track", style: { background: core.gradient }, children: /* @__PURE__ */ jsx("div", { className: "vtg-depth-cut", style: { height: `${thumbTop}%` } }) }),
909
1022
  marks.map((m) => /* @__PURE__ */ jsxs("div", { className: "vtg-depth-mark", style: { top: `${frac(m.y) * 100}%` }, children: [
910
1023
  /* @__PURE__ */ jsx("i", {}),
911
1024
  /* @__PURE__ */ jsx("span", { children: m.label })
@@ -930,6 +1043,104 @@ function DepthSlider({ toggleKey = "c", step = 4, className }) {
930
1043
  )
931
1044
  ] });
932
1045
  }
1046
+ var ICON = {
1047
+ overworld: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
1048
+ /* @__PURE__ */ jsx("circle", { cx: "11.7", cy: "4.3", r: "1.9" }),
1049
+ /* @__PURE__ */ jsx("path", { d: "M1.6 12.6 5.3 7.4l2.4 3.1 1.6-1.9 3.6 4z" })
1050
+ ] }),
1051
+ nether: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
1052
+ /* @__PURE__ */ jsx("path", { d: "M8 14.2c2.4 0 4.2-1.7 4.2-4 0-3.6-2.6-5.2-4.2-8.4C6.4 5 3.8 6.6 3.8 10.2c0 2.3 1.8 4 4.2 4z" }),
1053
+ /* @__PURE__ */ jsx("path", { d: "M8 14.2c1.2 0 2-.9 2-2 0-1.4-1.1-2.1-2-3.4-.9 1.3-2 2-2 3.4 0 1.1.8 2 2 2z" })
1054
+ ] }),
1055
+ end: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M8 2.2c.6 3.3 2.5 5.2 5.8 5.8-3.3.6-5.2 2.5-5.8 5.8-.6-3.3-2.5-5.2-5.8-5.8C5.5 7.4 7.4 5.5 8 2.2z" }) }),
1056
+ custom: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
1057
+ /* @__PURE__ */ jsx("path", { d: "M8 2.2 13.8 8 8 13.8 2.2 8z" }),
1058
+ /* @__PURE__ */ jsx("path", { d: "M8 5.6 10.4 8 8 10.4 5.6 8z" })
1059
+ ] })
1060
+ };
1061
+ var POSITIONS = {
1062
+ "top-center": "vtg-dims-tc",
1063
+ "top-left": "vtg-dims-tl",
1064
+ "top-right": "vtg-dims-tr",
1065
+ "bottom-left": "vtg-dims-bl",
1066
+ "bottom-right": "vtg-dims-br"
1067
+ };
1068
+ function DimensionPicker({ className, position = "top-center" }) {
1069
+ const { viewer, dimensions, dimension } = useVantage();
1070
+ const [switching, setSwitching] = useState(null);
1071
+ const [roving, setRoving] = useState(null);
1072
+ const btns = useRef([]);
1073
+ if (!viewer || dimensions.length < 2) return null;
1074
+ const activeIndex = Math.max(
1075
+ 0,
1076
+ dimensions.findIndex((d) => d.slug === dimension?.slug)
1077
+ );
1078
+ const anchor = dimensions[activeIndex].tiles > 0 ? activeIndex : Math.max(0, dimensions.findIndex((d) => d.tiles > 0));
1079
+ const stop = roving ?? anchor;
1080
+ const select = (d) => {
1081
+ if (d.slug === dimension?.slug || switching) return;
1082
+ setSwitching(d.slug);
1083
+ void viewer.setDimension(d.slug).catch(() => {
1084
+ }).finally(() => setSwitching(null));
1085
+ };
1086
+ const move = (from, step) => {
1087
+ const n = dimensions.length;
1088
+ for (let k = 1; k <= n; k++) {
1089
+ const i = ((from + step * k) % n + n) % n;
1090
+ if (dimensions[i].tiles > 0) {
1091
+ setRoving(i);
1092
+ btns.current[i]?.focus();
1093
+ return;
1094
+ }
1095
+ }
1096
+ };
1097
+ const onKeyDown = (e) => {
1098
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") move(stop, 1);
1099
+ else if (e.key === "ArrowLeft" || e.key === "ArrowUp") move(stop, -1);
1100
+ else if (e.key === "Home") move(-1, 1);
1101
+ else if (e.key === "End") move(dimensions.length, -1);
1102
+ else return;
1103
+ e.preventDefault();
1104
+ };
1105
+ return /* @__PURE__ */ jsx(
1106
+ "div",
1107
+ {
1108
+ className: `vtg-dims vtg-glass ${POSITIONS[position]}${className ? ` ${className}` : ""}`,
1109
+ role: "toolbar",
1110
+ "aria-orientation": "horizontal",
1111
+ "aria-label": "Dimensions",
1112
+ "aria-busy": switching !== null,
1113
+ onKeyDown,
1114
+ children: dimensions.map((d, i) => {
1115
+ const active = d.slug === dimension?.slug;
1116
+ const empty = d.tiles === 0;
1117
+ const busy = switching === d.slug;
1118
+ return /* @__PURE__ */ jsxs(
1119
+ "button",
1120
+ {
1121
+ ref: (el) => {
1122
+ btns.current[i] = el;
1123
+ },
1124
+ type: "button",
1125
+ className: `vtg-dim-btn vtg-k-${d.kind}${active ? " vtg-on" : ""}`,
1126
+ "aria-pressed": active,
1127
+ "aria-busy": busy,
1128
+ tabIndex: i === stop ? 0 : -1,
1129
+ disabled: empty,
1130
+ title: empty ? `${d.label} \u2014 nothing generated yet` : active ? d.label : `${d.label} \u2014 ${d.tiles.toLocaleString()} tiles`,
1131
+ onFocus: () => setRoving(i),
1132
+ onClick: () => select(d),
1133
+ children: [
1134
+ /* @__PURE__ */ jsx("span", { className: "vtg-dim-ico", "aria-hidden": "true", children: busy ? /* @__PURE__ */ jsx("i", { className: "vtg-dim-spin" }) : ICON[d.kind] }),
1135
+ /* @__PURE__ */ jsx("span", { className: "vtg-dim-label", children: d.label })
1136
+ ]
1137
+ },
1138
+ d.slug
1139
+ );
1140
+ })
1141
+ }
1142
+ );
1143
+ }
933
1144
  function Reticle({ className }) {
934
1145
  const { viewer } = useVantage();
935
1146
  const ref = useRef(null);
@@ -955,4 +1166,4 @@ function Reticle({ className }) {
955
1166
  ] });
956
1167
  }
957
1168
 
958
- export { BiomeLayer, CSS, DepthSlider, LightPanel, MapNav, Panel, QUALITY_PRESETS, Reticle, SettingsPanel, VantageViewer2 as VantageViewer, injectStyles, useVantage };
1169
+ export { BiomeLayer, CSS, DepthSlider, DimensionPicker, LightPanel, MapNav, Panel, QUALITY_PRESETS, Reticle, SettingsPanel, VantageViewer2 as VantageViewer, injectStyles, useVantage };
@@ -1,9 +1,9 @@
1
1
  import * as THREE from 'three';
2
- import { R as Rgb, Q as QuantizedTile, D as DecodedTile, a as DecodedTextureArray, S as SurfaceMap } from '../biome-B6l-1yx4.js';
3
- export { B as BiomeEntry, b as ByteReader, H as HttpWorldOptions, L as Lightmap, c as LowresLevel, M as ManifestTile, d as MeshSection, e as QuantizedSection, T as TEXTURE_MAGIC, f as TILE_MAGIC, g as TextureAnimation, h as TileMagic, U as UV_SCALE, V as VantageServerOptions, W as WorldConditionalFetch, i as WorldFetch, j as WorldHttpFetch, k as WorldManifest, l as WorldSource, m as biomePalette, n as canonicalQuadIndices, p as parseManifest, o as parseTextureArray, q as parseTile, r as parseTileQuantized, s as stripNamespace, t as summarizeBiomes, u as summarizeSurfaceBiomes, v as tileKey, w as worldFromDirectory, x as worldFromFiles, y as worldFromHttp, z as worldFromUrl, A as worldFromVantageServer } from '../biome-B6l-1yx4.js';
2
+ import { R as Rgb, Q as QuantizedTile, D as DecodedTile, a as DecodedTextureArray, S as SurfaceMap } from '../biome-CcJerc-b.js';
3
+ export { B as BiomeEntry, b as ByteReader, H as HttpWorldOptions, L as Lightmap, c as LowresLevel, M as ManifestAtmosphere, d as ManifestDimension, e as ManifestTile, f as MeshSection, g as QuantizedSection, T as TEXTURE_MAGIC, h as TILE_MAGIC, i as TextureAnimation, j as TileMagic, U as UV_SCALE, V as VantageServerOptions, W as WorldConditionalFetch, k as WorldDimension, l as WorldFetch, m as WorldHttpFetch, n as WorldIndex, o as WorldManifest, p as WorldSource, q as biomePalette, r as canonicalQuadIndices, s as isWorldIndex, t as parseManifest, u as parseTextureArray, v as parseTile, w as parseTileQuantized, x as parseWorldIndex, y as pickDimension, z as resolveManifestPath, A as stripNamespace, C as summarizeBiomes, E as summarizeSurfaceBiomes, F as tileKey, G as worldFromDirectory, I as worldFromFiles, J as worldFromHttp, K as worldFromIndexEntry, N as worldFromUrl, O as worldFromVantageServer } from '../biome-CcJerc-b.js';
4
4
  import { LowresTile } from '../core/index.js';
5
5
  export { LOWRES_EMPTY, LOWRES_MAGIC, isGzip, maybeInflate, parseLowresTile } from '../core/index.js';
6
- export { D as DEFAULT_ORBIT_ANGLE, a as DisplaySettings, H as HeightSampler, L as LightSettings, b as LoadOptions, M as MapControls, c as MapControlsOptions, S as StreamingSettings, T as TextureSource, d as TileInfo, e as TileManager, f as TileManagerOptions, g as TileSource, h as TileStats, V as VANILLA_DISPLAY, i as VantageViewer, j as VantageViewerOptions, k as ViewMode } from '../viewer-BgXAqYhr.js';
6
+ export { D as DEFAULT_ORBIT_ANGLE, a as DisplaySettings, H as HeightSampler, L as LightSettings, b as LoadOptions, M as MapControls, c as MapControlsOptions, S as StreamingSettings, T as TextureSource, d as TileInfo, e as TileManager, f as TileManagerOptions, g as TileSource, h as TileStats, V as VANILLA_DISPLAY, i as VantageViewer, j as VantageViewerOptions, k as ViewMode } from '../viewer-Cy9oGJ-F.js';
7
7
 
8
8
  /** The objects and metadata produced from a tile. */
9
9
  interface TerrainObjects {
@@ -106,6 +106,12 @@ declare function createWaterMaterial(terrain: THREE.ShaderMaterial): THREE.Shade
106
106
  * radial fog centre track the hires terrain exactly.
107
107
  */
108
108
  declare function createLowresMaterial(terrain: THREE.ShaderMaterial): THREE.ShaderMaterial;
109
+ /**
110
+ * Repaint a sky dome built by {@link createSky} — how a dimension switch turns
111
+ * the overworld's blue gradient into the nether's crimson murk or the end's
112
+ * near-black void. Colours are linear-ish sRGB triples in 0..1.
113
+ */
114
+ declare function setSkyColors(sky: THREE.Mesh, top: readonly [number, number, number], horizon: readonly [number, number, number]): void;
109
115
  /**
110
116
  * A camera-locked gradient sky dome (depth-test off, drawn first) so the
111
117
  * background reads as sky from any zoom, with the horizon matching the fog.
@@ -120,4 +126,4 @@ declare function createSky(): THREE.Mesh;
120
126
  */
121
127
  declare function pickBiome(ray: THREE.Ray, surf: SurfaceMap, bounds: THREE.Box3): number;
122
128
 
123
- export { DecodedTextureArray, DecodedTile, LowresTile, QuantizedTile, Rgb, SKY_HORIZON, SKY_TOP, SurfaceMap, type TerrainMaterialOptions, type TerrainObjects, type TileMeshes, applyCaveRange, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome };
129
+ export { DecodedTextureArray, DecodedTile, LowresTile, QuantizedTile, Rgb, SKY_HORIZON, SKY_TOP, SurfaceMap, type TerrainMaterialOptions, type TerrainObjects, type TileMeshes, applyCaveRange, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome, setSkyColors };
@@ -1,2 +1,2 @@
1
- export { DEFAULT_ORBIT_ANGLE, MapControls, SKY_HORIZON, SKY_TOP, TileManager, VANILLA_DISPLAY, VantageViewer, applyCaveRange, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome } from '../chunk-E7Y7K6NH.js';
2
- export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, UV_SCALE, biomePalette, canonicalQuadIndices, isGzip, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromHttp, worldFromUrl, worldFromVantageServer } from '../chunk-LZCXJU4U.js';
1
+ export { DEFAULT_ORBIT_ANGLE, MapControls, SKY_HORIZON, SKY_TOP, TileManager, VANILLA_DISPLAY, VantageViewer, applyCaveRange, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome, setSkyColors } from '../chunk-QV6SDOVV.js';
2
+ export { ByteReader, LOWRES_EMPTY, LOWRES_MAGIC, TEXTURE_MAGIC, TILE_MAGIC, UV_SCALE, biomePalette, canonicalQuadIndices, isGzip, isWorldIndex, maybeInflate, parseLowresTile, parseManifest, parseTextureArray, parseTile, parseTileQuantized, parseWorldIndex, pickDimension, resolveManifestPath, stripNamespace, summarizeBiomes, summarizeSurfaceBiomes, tileKey, worldFromDirectory, worldFromFiles, worldFromHttp, worldFromIndexEntry, worldFromUrl, worldFromVantageServer } from '../chunk-GKNIX375.js';
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { k as WorldManifest, i as WorldFetch, R as Rgb, M as ManifestTile, c as LowresLevel, B as BiomeEntry, a as DecodedTextureArray, D as DecodedTile, l as WorldSource } from './biome-B6l-1yx4.js';
2
+ import { o as WorldManifest, l as WorldFetch, R as Rgb, e as ManifestTile, c as LowresLevel, B as BiomeEntry, a as DecodedTextureArray, D as DecodedTile, p as WorldSource, k as WorldDimension } from './biome-CcJerc-b.js';
3
3
 
4
4
  interface TileManagerOptions {
5
5
  manifest: WorldManifest;
@@ -611,6 +611,12 @@ interface TileInfo {
611
611
  interface ViewerEvents extends Record<string, unknown> {
612
612
  /** Fired after a tile/world is loaded and framed. */
613
613
  load: TileInfo;
614
+ /** The loaded dimension changed (or a multi-dimension world finished
615
+ * loading): the full list, and which one is showing. */
616
+ dimension: {
617
+ dimensions: WorldDimension[];
618
+ current: WorldDimension | null;
619
+ };
614
620
  /** Streaming totals changed (tiles loaded/unloaded). Streamed worlds only. */
615
621
  stats: TileStats;
616
622
  /** The aggregated biome legend changed as tiles streamed in/out. */
@@ -659,6 +665,14 @@ declare class VantageViewer {
659
665
  private _biomes;
660
666
  private tiles;
661
667
  private manifest;
668
+ private worldIndex;
669
+ private indexSource;
670
+ private currentDimension;
671
+ /** Per-dimension camera hashes, so switching back returns where you were. */
672
+ private readonly dimensionViews;
673
+ /** The view mode the loaded world was framed with — a `load({ view })` may
674
+ * differ from the constructor default, and switching dimensions keeps it. */
675
+ private loadedView;
662
676
  private waterShader;
663
677
  private lowresShader;
664
678
  /** Populated world extent (max of X/Z spans), for whole-world zoom limits. */
@@ -686,6 +700,10 @@ declare class VantageViewer {
686
700
  private caveMode;
687
701
  private cavesShown;
688
702
  private light;
703
+ /** Light fields the embedder set explicitly (constructor option or
704
+ * `setLight`). A dimension's atmosphere fills in the rest, so switching
705
+ * worlds re-lights the map without overriding a deliberate choice. */
706
+ private lightOverrides;
689
707
  private display;
690
708
  private readonly raycaster;
691
709
  private readonly ndc;
@@ -710,10 +728,29 @@ declare class VantageViewer {
710
728
  static mount(container: HTMLElement | string, options: VantageViewerOptions & LoadOptions): Promise<VantageViewer>;
711
729
  /** Load (fetch/decode as needed), build, and frame a tile or a streamed world. */
712
730
  load(opts: LoadOptions): Promise<void>;
713
- /** Stream a tiled world render from its `manifest.json`. Tiles load around
714
- * the camera as it moves and unload behind it; the whole world is reachable
731
+ /** Stream a tiled world render from its `manifest.json` — or from a
732
+ * `world.json` index, in which case one of its dimensions is opened and the
733
+ * rest become available through {@link setDimension}. Tiles load around the
734
+ * camera as it moves and unload behind it; the whole world is reachable
715
735
  * without ever holding more than the streaming budget in memory. */
716
736
  private loadWorld;
737
+ /** Every dimension of the loaded world (empty for a single-manifest world). */
738
+ get dimensions(): WorldDimension[];
739
+ /** The dimension currently showing, or null when the world isn't indexed. */
740
+ get dimension(): WorldDimension | null;
741
+ /**
742
+ * Switch to another dimension of the loaded world by slug or resource id.
743
+ *
744
+ * Each dimension is a self-contained render, so this is a full world reload —
745
+ * but the camera you left behind is remembered per dimension, and coming back
746
+ * returns to it. Resolves once the new world is framed and streaming; a slug
747
+ * the world doesn't have throws.
748
+ */
749
+ setDimension(slug: string): Promise<void>;
750
+ /** Paint the dimension's atmosphere: sky dome, fog colour, and the light
751
+ * defaults. Explicit `light` options from the embedder always win — a page
752
+ * that set its own ambient/daylight keeps them across dimension switches. */
753
+ private applyAtmosphere;
717
754
  /** Emit a `progress` event from a manifest (falling back to the tile count
718
755
  * when the generator didn't include a `progress` block). Deduplicated: a
719
756
  * continuous server reports the same numbers poll after poll, and repeating
@@ -847,13 +884,19 @@ declare class VantageViewer {
847
884
  * range follow) and persists for future loads. The fidelity dial: raise
848
885
  * viewDistance/maxTiles/maxBytes to see farther, lower them on weak hardware. */
849
886
  setStreaming(settings: StreamingSettings): void;
850
- /** The current view serialized as a `#@x,y,z,dist,rot,tilt[,sliceY]` hash
851
- * fragment — paste-able into any URL serving the same world. The trailing
852
- * component appears only while the cave view is open, so those deep links
853
- * reopen sliced at the same depth. */
887
+ /** The current view serialized as a `#[dimension]@x,y,z,dist,rot,tilt[,sliceY]`
888
+ * hash fragment — paste-able into any URL serving the same world. The
889
+ * dimension prefix appears only for multi-dimension worlds, so overworld-only
890
+ * links keep their old shape; the trailing component appears only while the
891
+ * cave view is open, so those deep links reopen sliced at the same depth. */
854
892
  getViewHash(): string;
855
- /** Apply a `#@x,y,z,dist,rot,tilt[,sliceY]` hash to the camera (leading `#`
856
- * optional). Returns whether the hash parsed. */
893
+ /** The dimension slug in the current URL hash, if it names one. Read before
894
+ * a world index picks which dimension to open. */
895
+ private hashDimension;
896
+ /** Apply a `#[dimension]@x,y,z,dist,rot,tilt[,sliceY]` hash to the camera
897
+ * (leading `#` optional). The dimension prefix is ignored here — it is
898
+ * consumed at load time; this only moves the camera. Returns whether the
899
+ * hash parsed. */
857
900
  applyViewHash(hash: string): boolean;
858
901
  /** Debounced camera→hash sync plus hashchange→camera (pasted links apply
859
902
  * live). `history.replaceState` avoids history spam and hashchange echo. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughts-on-things/vantage-mc",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Render a Minecraft (Java) world as a fast, beautiful 3D web map. The web frontend for the Vantage generator.",
5
5
  "type": "module",
6
6
  "license": "MIT",