@thoughts-on-things/vantage-mc 0.3.0 → 0.4.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.
- package/README.md +20 -1
- package/dist/{biome-CPP37ieY.d.ts → biome-uodZHCCI.d.ts} +9 -0
- package/dist/{chunk-C7GIMQYZ.js → chunk-HGHIERQW.js} +353 -32
- package/dist/{chunk-M6KVJXCR.js → chunk-ILHVIGCI.js} +7 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/react/index.d.ts +24 -7
- package/dist/react/index.js +246 -9
- package/dist/three/index.d.ts +3 -3
- package/dist/three/index.js +2 -2
- package/dist/{viewer-GsEn9RpF.d.ts → viewer-Ba31QN1M.d.ts} +93 -7
- package/package.json +2 -1
|
@@ -565,6 +565,11 @@ function parseManifest(data) {
|
|
|
565
565
|
if (typeof s === "object" && s !== null && typeof s["x"] === "number" && typeof s["y"] === "number" && typeof s["z"] === "number") {
|
|
566
566
|
spawn = { x: s["x"], y: s["y"], z: s["z"] };
|
|
567
567
|
}
|
|
568
|
+
let yRange;
|
|
569
|
+
const yr = m["yRange"];
|
|
570
|
+
if (typeof yr === "object" && yr !== null && typeof yr["min"] === "number" && typeof yr["max"] === "number" && yr["min"] < yr["max"]) {
|
|
571
|
+
yRange = { min: yr["min"], max: yr["max"] };
|
|
572
|
+
}
|
|
568
573
|
const maxSectionVerts = m["maxSectionVerts"];
|
|
569
574
|
return {
|
|
570
575
|
format,
|
|
@@ -573,6 +578,8 @@ function parseManifest(data) {
|
|
|
573
578
|
textures,
|
|
574
579
|
...typeof maxSectionVerts === "number" && maxSectionVerts > 0 ? { maxSectionVerts } : {},
|
|
575
580
|
...spawn ? { spawn } : {},
|
|
581
|
+
...m["caves"] === true ? { caves: true } : {},
|
|
582
|
+
...yRange ? { yRange } : {},
|
|
576
583
|
...lowres ? { lowres } : {},
|
|
577
584
|
biomes,
|
|
578
585
|
tiles: parsedTiles
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BiomeEntry, b as ByteReader, a as DecodedTextureArray, D as DecodedTile, L as Lightmap, c as LowresLevel, M as ManifestTile, d as MeshSection, e as QuantizedSection, Q as QuantizedTile, R as Rgb, S as SurfaceMap, T as TEXTURE_MAGIC, f as TILE_MAGIC, g as TextureAnimation, h as TileMagic, U as UV_SCALE, W as WorldFetch, i as WorldManifest, j as WorldSource, k as biomePalette, l as canonicalQuadIndices, p as parseManifest, m as parseTextureArray, n as parseTile, o as parseTileQuantized, s as stripNamespace, q as summarizeBiomes, r as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, u as worldFromFiles, v as worldFromUrl } from '../biome-
|
|
1
|
+
export { B as BiomeEntry, b as ByteReader, a as DecodedTextureArray, D as DecodedTile, L as Lightmap, c as LowresLevel, M as ManifestTile, d as MeshSection, e as QuantizedSection, Q as QuantizedTile, R as Rgb, S as SurfaceMap, T as TEXTURE_MAGIC, f as TILE_MAGIC, g as TextureAnimation, h as TileMagic, U as UV_SCALE, W as WorldFetch, i as WorldManifest, j as WorldSource, k as biomePalette, l as canonicalQuadIndices, p as parseManifest, m as parseTextureArray, n as parseTile, o as parseTileQuantized, s as stripNamespace, q as summarizeBiomes, r as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, u as worldFromFiles, v as worldFromUrl } from '../biome-uodZHCCI.js';
|
|
2
2
|
|
|
3
3
|
declare const LOWRES_MAGIC = "VLR1";
|
|
4
4
|
/** Height sentinel for samples with no terrain (unpopulated chunks). */
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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, worldFromUrl } from '../chunk-
|
|
1
|
+
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, worldFromUrl } from '../chunk-ILHVIGCI.js';
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { j as WorldSource, B as BiomeEntry } from '../biome-
|
|
4
|
-
export { D as DecodedTile } from '../biome-
|
|
5
|
-
import { g as TileSource, T as TextureSource, S as StreamingSettings, k as ViewMode, L as LightSettings, a as DisplaySettings, d as TileInfo, i as VantageViewer$1 } from '../viewer-
|
|
6
|
-
export { D as DEFAULT_ORBIT_ANGLE, V as VANILLA_DISPLAY } from '../viewer-
|
|
3
|
+
import { j as WorldSource, B as BiomeEntry } from '../biome-uodZHCCI.js';
|
|
4
|
+
export { D as DecodedTile } from '../biome-uodZHCCI.js';
|
|
5
|
+
import { g as TileSource, T as TextureSource, S as StreamingSettings, k as ViewMode, L as LightSettings, a as DisplaySettings, d as TileInfo, i as VantageViewer$1 } from '../viewer-Ba31QN1M.js';
|
|
6
|
+
export { D as DEFAULT_ORBIT_ANGLE, V as VANILLA_DISPLAY } from '../viewer-Ba31QN1M.js';
|
|
7
7
|
import 'three';
|
|
8
8
|
|
|
9
9
|
interface VantageViewerProps {
|
|
@@ -126,9 +126,26 @@ interface MapNavProps {
|
|
|
126
126
|
home?: boolean;
|
|
127
127
|
/** Show the centred-coordinate readout. Default `true`. */
|
|
128
128
|
coords?: boolean;
|
|
129
|
+
/** Show the cave-view (depth slice) toggle. Default `true` — hidden
|
|
130
|
+
* automatically unless the world was baked with `--caves full`. */
|
|
131
|
+
caves?: boolean;
|
|
132
|
+
/** Show the screenshot (PNG download) button. Default `true`. */
|
|
133
|
+
screenshot?: boolean;
|
|
134
|
+
/** Show the fullscreen toggle. Default `true` (hidden automatically where
|
|
135
|
+
* the Fullscreen API is unavailable, e.g. iPhone Safari). */
|
|
136
|
+
fullscreen?: boolean;
|
|
129
137
|
className?: string;
|
|
130
138
|
}
|
|
131
|
-
declare function MapNav({ compass, tilt, fly, zoom, home, coords, className }: MapNavProps): react.JSX.Element | null;
|
|
139
|
+
declare function MapNav({ compass, tilt, fly, zoom, home, coords, caves, screenshot, fullscreen, className, }: MapNavProps): react.JSX.Element | null;
|
|
140
|
+
|
|
141
|
+
interface DepthSliderProps {
|
|
142
|
+
/** Key that toggles the cave view. Default `'c'`; pass `null` to disable. */
|
|
143
|
+
toggleKey?: string | null;
|
|
144
|
+
/** World-Y step for the `[` / `]` nudge keys. Default `4`. */
|
|
145
|
+
step?: number;
|
|
146
|
+
className?: string;
|
|
147
|
+
}
|
|
148
|
+
declare function DepthSlider({ toggleKey, step, className }: DepthSliderProps): react.JSX.Element | null;
|
|
132
149
|
|
|
133
150
|
interface ReticleProps {
|
|
134
151
|
className?: string;
|
|
@@ -153,8 +170,8 @@ interface VantageContextValue {
|
|
|
153
170
|
/** Access the viewer engine and live state. Must be used under `<VantageViewer>`. */
|
|
154
171
|
declare function useVantage(): VantageContextValue;
|
|
155
172
|
|
|
156
|
-
declare const CSS = "\n.vtg-root {\n position: relative; width: 100%; height: 100%; overflow: hidden;\n background: #0d1015; color-scheme: dark;\n --vtg-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n --vtg-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n --vtg-accent: #5b9bff;\n --vtg-text: #e6eefb;\n --vtg-muted: #93a9cc;\n --vtg-dim: #6f86ab;\n --vtg-line: rgba(132, 170, 230, 0.16);\n}\n.vtg-canvas { position: absolute; inset: 0; }\n/* Constrain the GL canvas to its container. The renderer keeps a high-res\n drawing buffer (devicePixelRatio \u00D7 renderScale) via setSize(\u2026, false), which\n leaves the canvas's intrinsic attribute size large; without an explicit\n display size that size leaks into layout and overflows. width/height:100%\n pins the *displayed* size to the container while the buffer stays crisp. */\n.vtg-canvas > canvas { display: block; width: 100%; height: 100%; }\n\n.vtg-glass {\n background: linear-gradient(180deg, rgba(18, 24, 35, 0.72), rgba(11, 15, 22, 0.7));\n border: 1px solid rgba(140, 178, 238, 0.18);\n border-radius: 13px;\n backdrop-filter: blur(16px) saturate(1.3);\n -webkit-backdrop-filter: blur(16px) saturate(1.3);\n box-shadow: 0 10px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);\n}\n\n.vtg-status {\n position: absolute; inset: 0; display: grid; place-content: center; text-align: center;\n font: 13px var(--vtg-sans); color: var(--vtg-muted); padding: 2rem;\n}\n.vtg-status.vtg-error { color: #ffb4b4; }\n\n/* --- panels --------------------------------------------------------------- */\n.vtg-panel {\n position: absolute; top: 16px; right: 16px; width: 240px; max-height: calc(100% - 32px);\n display: flex; flex-direction: column; overflow: hidden;\n font: 13px/1.45 var(--vtg-sans); color: var(--vtg-text);\n animation: vtg-rise 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;\n}\n.vtg-panel header {\n padding: 11px 13px; display: flex; align-items: center; gap: 9px;\n user-select: none; flex: none;\n}\n.vtg-panel:not(.vtg-collapsed) header { border-bottom: 1px solid var(--vtg-line); }\n.vtg-panel header.vtg-click { cursor: pointer; }\n.vtg-panel header.vtg-click:hover .vtg-title { color: #fff; }\n.vtg-chev {\n font-size: 9px; color: var(--vtg-dim); width: 10px; flex: none; text-align: center;\n transition: transform 0.18s ease, color 0.16s;\n}\n.vtg-panel header.vtg-click:hover .vtg-chev { color: var(--vtg-muted); }\n.vtg-title {\n display: flex; align-items: center; gap: 7px;\n font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;\n color: var(--vtg-text); transition: color 0.16s;\n}\n.vtg-title .vtg-ico { color: var(--vtg-accent); font-size: 12px; opacity: 0.9; }\n.vtg-head-extra { margin-left: auto; display: flex; align-items: center; gap: 6px; }\n.vtg-body { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }\n\n.vtg-toggle {\n font: 600 11px var(--vtg-sans); padding: 3px 12px; border-radius: 999px;\n border: 1px solid rgba(132, 170, 230, 0.38); background: rgba(40, 60, 90, 0.4);\n color: var(--vtg-muted); cursor: pointer;\n transition: background 0.16s, color 0.16s, border-color 0.16s;\n}\n.vtg-toggle:hover { border-color: rgba(132, 170, 230, 0.7); color: var(--vtg-text); }\n.vtg-toggle.vtg-on { background: var(--vtg-accent); border-color: var(--vtg-accent); color: #07101f; }\n\n/* --- biome legend --------------------------------------------------------- */\n.vtg-legend { overflow-y: auto; padding: 7px; scrollbar-width: thin; scrollbar-color: rgba(132,170,230,0.3) transparent; }\n.vtg-row {\n display: flex; align-items: center; gap: 9px; padding: 5px 8px;\n border-radius: 7px; cursor: pointer; white-space: nowrap;\n transition: background 0.16s, opacity 0.16s, box-shadow 0.16s;\n}\n.vtg-row:hover { background: rgba(132, 170, 230, 0.12); }\n.vtg-row.vtg-sel { background: rgba(91, 155, 255, 0.26); }\n.vtg-row.vtg-hover { box-shadow: inset 0 0 0 1px rgba(143, 182, 232, 0.75); }\n.vtg-row.vtg-dim { opacity: 0.34; }\n.vtg-chip { width: 13px; height: 13px; border-radius: 4px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45); }\n.vtg-name { overflow: hidden; text-overflow: ellipsis; }\n.vtg-pct { margin-left: auto; color: var(--vtg-dim); font: 11px var(--vtg-mono); font-variant-numeric: tabular-nums; }\n\n/* --- segmented toggle (render mode) --------------------------------------- */\n.vtg-seg { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(40, 60, 90, 0.4); border: 1px solid rgba(132, 170, 230, 0.28); }\n.vtg-seg button {\n font: 600 10px var(--vtg-sans); letter-spacing: 0.04em; text-transform: uppercase;\n padding: 3px 10px; border-radius: 999px; border: none; background: transparent; color: var(--vtg-muted);\n cursor: pointer; transition: background 0.16s, color 0.16s;\n}\n.vtg-seg button:hover { color: var(--vtg-text); }\n.vtg-seg button.vtg-seg-on { background: var(--vtg-accent); color: #07101f; }\n.vtg-seg-full { display: flex; }\n.vtg-seg-full button { flex: 1; text-align: center; padding: 4px 0; }\n\n/* --- sliders -------------------------------------------------------------- */\n.vtg-sliders { padding: 13px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(132,170,230,0.3) transparent; }\n.vtg-slider { display: flex; flex-direction: column; gap: 7px; cursor: pointer; }\n.vtg-slider-row { display: flex; justify-content: space-between; align-items: baseline; color: var(--vtg-muted); font-size: 12px; }\n.vtg-slider-row b { color: var(--vtg-text); font: 600 11px var(--vtg-mono); font-variant-numeric: tabular-nums; }\n.vtg-slider input[type=range] {\n -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px;\n background: rgba(132, 170, 230, 0.25); outline: none; cursor: pointer;\n}\n.vtg-slider input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;\n background: var(--vtg-accent); cursor: pointer; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);\n transition: transform 0.12s;\n}\n.vtg-slider input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }\n.vtg-slider input[type=range]::-moz-range-thumb {\n width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--vtg-accent);\n cursor: pointer; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);\n}\n\n/* --- hover-to-identify tooltip -------------------------------------------- */\n.vtg-tip {\n position: fixed; display: flex; align-items: center; gap: 8px;\n padding: 6px 10px; pointer-events: none; z-index: 10;\n font: 12px/1 var(--vtg-sans); color: var(--vtg-text);\n background: rgba(13, 17, 25, 0.88); border: 1px solid var(--vtg-line); border-radius: 8px;\n backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);\n}\n.vtg-tip .vtg-chip { width: 12px; height: 12px; border-radius: 3px; }\n\n/* --- navigation cluster (compass \u00B7 zoom \u00B7 home \u00B7 coords) ------------------ */\n.vtg-nav {\n position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);\n display: flex; align-items: center; gap: 6px; padding: 6px;\n animation: vtg-rise 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;\n}\n.vtg-navbtn {\n width: 30px; height: 30px; flex: none; display: grid; place-items: center;\n border-radius: 9px; border: 1px solid transparent; background: transparent;\n color: var(--vtg-muted); cursor: pointer; padding: 0;\n transition: background 0.15s, color 0.15s, border-color 0.15s;\n}\n.vtg-navbtn:hover { background: rgba(132, 170, 230, 0.14); color: var(--vtg-text); border-color: var(--vtg-line); }\n.vtg-navbtn:active { background: rgba(91, 155, 255, 0.26); }\n.vtg-navbtn svg { width: 16px; height: 16px; display: block; }\n.vtg-navbtn-text { width: auto; min-width: 30px; padding: 0 8px; font: 700 11px var(--vtg-mono); letter-spacing: 0.03em; }\n.vtg-navbtn.vtg-on { background: var(--vtg-accent); border-color: var(--vtg-accent); color: #07101f; }\n.vtg-navbtn.vtg-on:hover { background: var(--vtg-accent); color: #07101f; }\n.vtg-nav-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--vtg-line); }\n\n.vtg-compass {\n position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%;\n border: 1px solid var(--vtg-line); background: rgba(20, 28, 40, 0.5);\n cursor: pointer; display: grid; place-items: center;\n transition: border-color 0.16s, background 0.16s;\n}\n.vtg-compass:hover { border-color: rgba(132, 170, 230, 0.5); background: rgba(30, 42, 60, 0.6); }\n.vtg-compass svg { width: 30px; height: 30px; }\n.vtg-compass .vtg-n { fill: #ff6a6a; }\n.vtg-compass .vtg-s { fill: #c2d2ee; }\n.vtg-compass .vtg-cn { fill: var(--vtg-dim); font: 700 6px var(--vtg-sans); }\n\n.vtg-coords {\n display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px;\n font: 11px var(--vtg-mono); color: var(--vtg-muted); font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n.vtg-coords b { color: var(--vtg-dim); font-weight: 600; margin-right: 1px; }\n\n/* --- centre reticle (navigation reference) -------------------------------- */\n.vtg-reticle {\n position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;\n transform: translate(-50%, -50%); pointer-events: none; z-index: 4;\n}\n.vtg-ret-ring {\n position: absolute; inset: 0; border-radius: 50%;\n border: 1.5px solid rgba(180, 205, 240, 0.28); transform: scale(0.62);\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);\n transition: border-color 0.2s ease, transform 0.2s ease;\n}\n.vtg-ret-dot {\n position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px;\n border-radius: 50%; background: rgba(238, 244, 255, 0.85);\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 6px rgba(0, 0, 0, 0.55);\n transition: background 0.2s ease;\n}\n.vtg-reticle-on .vtg-ret-ring { border-color: rgba(143, 182, 232, 0.85); transform: scale(1); }\n.vtg-reticle-on .vtg-ret-dot { background: #fff; }\n\n@keyframes vtg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n.vtg-nav { animation-name: vtg-rise-x; }\n@keyframes vtg-rise-x { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }\n";
|
|
173
|
+
declare const CSS = "\n.vtg-root {\n position: relative; width: 100%; height: 100%; overflow: hidden;\n background: #0d1015; color-scheme: dark;\n --vtg-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n --vtg-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n --vtg-accent: #5b9bff;\n --vtg-text: #e6eefb;\n --vtg-muted: #93a9cc;\n --vtg-dim: #6f86ab;\n --vtg-line: rgba(132, 170, 230, 0.16);\n}\n.vtg-canvas { position: absolute; inset: 0; }\n/* Constrain the GL canvas to its container. The renderer keeps a high-res\n drawing buffer (devicePixelRatio \u00D7 renderScale) via setSize(\u2026, false), which\n leaves the canvas's intrinsic attribute size large; without an explicit\n display size that size leaks into layout and overflows. width/height:100%\n pins the *displayed* size to the container while the buffer stays crisp. */\n.vtg-canvas > canvas { display: block; width: 100%; height: 100%; }\n\n.vtg-glass {\n background: linear-gradient(180deg, rgba(18, 24, 35, 0.72), rgba(11, 15, 22, 0.7));\n border: 1px solid rgba(140, 178, 238, 0.18);\n border-radius: 13px;\n backdrop-filter: blur(16px) saturate(1.3);\n -webkit-backdrop-filter: blur(16px) saturate(1.3);\n box-shadow: 0 10px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);\n}\n\n.vtg-status {\n position: absolute; inset: 0; display: grid; place-content: center; text-align: center;\n font: 13px var(--vtg-sans); color: var(--vtg-muted); padding: 2rem;\n}\n.vtg-status.vtg-error { color: #ffb4b4; }\n\n/* --- panels --------------------------------------------------------------- */\n.vtg-panel {\n position: absolute; top: 16px; right: 16px; width: 240px; max-height: calc(100% - 32px);\n display: flex; flex-direction: column; overflow: hidden;\n font: 13px/1.45 var(--vtg-sans); color: var(--vtg-text);\n animation: vtg-rise 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;\n}\n.vtg-panel header {\n padding: 11px 13px; display: flex; align-items: center; gap: 9px;\n user-select: none; flex: none;\n}\n.vtg-panel:not(.vtg-collapsed) header { border-bottom: 1px solid var(--vtg-line); }\n.vtg-panel header.vtg-click { cursor: pointer; }\n.vtg-panel header.vtg-click:hover .vtg-title { color: #fff; }\n.vtg-chev {\n font-size: 9px; color: var(--vtg-dim); width: 10px; flex: none; text-align: center;\n transition: transform 0.18s ease, color 0.16s;\n}\n.vtg-panel header.vtg-click:hover .vtg-chev { color: var(--vtg-muted); }\n.vtg-title {\n display: flex; align-items: center; gap: 7px;\n font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;\n color: var(--vtg-text); transition: color 0.16s;\n}\n.vtg-title .vtg-ico { color: var(--vtg-accent); font-size: 12px; opacity: 0.9; }\n.vtg-head-extra { margin-left: auto; display: flex; align-items: center; gap: 6px; }\n.vtg-body { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }\n\n.vtg-toggle {\n font: 600 11px var(--vtg-sans); padding: 3px 12px; border-radius: 999px;\n border: 1px solid rgba(132, 170, 230, 0.38); background: rgba(40, 60, 90, 0.4);\n color: var(--vtg-muted); cursor: pointer;\n transition: background 0.16s, color 0.16s, border-color 0.16s;\n}\n.vtg-toggle:hover { border-color: rgba(132, 170, 230, 0.7); color: var(--vtg-text); }\n.vtg-toggle.vtg-on { background: var(--vtg-accent); border-color: var(--vtg-accent); color: #07101f; }\n\n/* --- biome legend --------------------------------------------------------- */\n.vtg-legend { overflow-y: auto; padding: 7px; scrollbar-width: thin; scrollbar-color: rgba(132,170,230,0.3) transparent; }\n.vtg-row {\n display: flex; align-items: center; gap: 9px; padding: 5px 8px;\n border-radius: 7px; cursor: pointer; white-space: nowrap;\n transition: background 0.16s, opacity 0.16s, box-shadow 0.16s;\n}\n.vtg-row:hover { background: rgba(132, 170, 230, 0.12); }\n.vtg-row.vtg-sel { background: rgba(91, 155, 255, 0.26); }\n.vtg-row.vtg-hover { box-shadow: inset 0 0 0 1px rgba(143, 182, 232, 0.75); }\n.vtg-row.vtg-dim { opacity: 0.34; }\n.vtg-chip { width: 13px; height: 13px; border-radius: 4px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45); }\n.vtg-name { overflow: hidden; text-overflow: ellipsis; }\n.vtg-pct { margin-left: auto; color: var(--vtg-dim); font: 11px var(--vtg-mono); font-variant-numeric: tabular-nums; }\n\n/* --- segmented toggle (render mode) --------------------------------------- */\n.vtg-seg { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(40, 60, 90, 0.4); border: 1px solid rgba(132, 170, 230, 0.28); }\n.vtg-seg button {\n font: 600 10px var(--vtg-sans); letter-spacing: 0.04em; text-transform: uppercase;\n padding: 3px 10px; border-radius: 999px; border: none; background: transparent; color: var(--vtg-muted);\n cursor: pointer; transition: background 0.16s, color 0.16s;\n}\n.vtg-seg button:hover { color: var(--vtg-text); }\n.vtg-seg button.vtg-seg-on { background: var(--vtg-accent); color: #07101f; }\n.vtg-seg-full { display: flex; }\n.vtg-seg-full button { flex: 1; text-align: center; padding: 4px 0; }\n\n/* --- sliders -------------------------------------------------------------- */\n.vtg-sliders { padding: 13px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(132,170,230,0.3) transparent; }\n.vtg-slider { display: flex; flex-direction: column; gap: 7px; cursor: pointer; }\n.vtg-slider-row { display: flex; justify-content: space-between; align-items: baseline; color: var(--vtg-muted); font-size: 12px; }\n.vtg-slider-row b { color: var(--vtg-text); font: 600 11px var(--vtg-mono); font-variant-numeric: tabular-nums; }\n.vtg-slider input[type=range] {\n -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px;\n background: rgba(132, 170, 230, 0.25); outline: none; cursor: pointer;\n}\n.vtg-slider input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;\n background: var(--vtg-accent); cursor: pointer; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);\n transition: transform 0.12s;\n}\n.vtg-slider input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.18); }\n.vtg-slider input[type=range]::-moz-range-thumb {\n width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--vtg-accent);\n cursor: pointer; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);\n}\n\n/* --- hover-to-identify tooltip -------------------------------------------- */\n.vtg-tip {\n position: fixed; display: flex; align-items: center; gap: 8px;\n padding: 6px 10px; pointer-events: none; z-index: 10;\n font: 12px/1 var(--vtg-sans); color: var(--vtg-text);\n background: rgba(13, 17, 25, 0.88); border: 1px solid var(--vtg-line); border-radius: 8px;\n backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);\n}\n.vtg-tip .vtg-chip { width: 12px; height: 12px; border-radius: 3px; }\n\n/* --- navigation cluster (compass \u00B7 zoom \u00B7 home \u00B7 coords) ------------------ */\n.vtg-nav {\n position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);\n display: flex; align-items: center; gap: 6px; padding: 6px;\n animation: vtg-rise 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;\n}\n.vtg-navbtn {\n width: 30px; height: 30px; flex: none; display: grid; place-items: center;\n border-radius: 9px; border: 1px solid transparent; background: transparent;\n color: var(--vtg-muted); cursor: pointer; padding: 0;\n transition: background 0.15s, color 0.15s, border-color 0.15s;\n}\n.vtg-navbtn:hover { background: rgba(132, 170, 230, 0.14); color: var(--vtg-text); border-color: var(--vtg-line); }\n.vtg-navbtn:active { background: rgba(91, 155, 255, 0.26); }\n.vtg-navbtn svg { width: 16px; height: 16px; display: block; }\n.vtg-navbtn-text { width: auto; min-width: 30px; padding: 0 8px; font: 700 11px var(--vtg-mono); letter-spacing: 0.03em; }\n.vtg-navbtn.vtg-on { background: var(--vtg-accent); border-color: var(--vtg-accent); color: #07101f; }\n.vtg-navbtn.vtg-on:hover { background: var(--vtg-accent); color: #07101f; }\n.vtg-nav-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--vtg-line); }\n\n.vtg-compass {\n position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%;\n border: 1px solid var(--vtg-line); background: rgba(20, 28, 40, 0.5);\n cursor: pointer; display: grid; place-items: center;\n transition: border-color 0.16s, background 0.16s;\n}\n.vtg-compass:hover { border-color: rgba(132, 170, 230, 0.5); background: rgba(30, 42, 60, 0.6); }\n.vtg-compass svg { width: 30px; height: 30px; }\n.vtg-compass .vtg-n { fill: #ff6a6a; }\n.vtg-compass .vtg-s { fill: #c2d2ee; }\n.vtg-compass .vtg-cn { fill: var(--vtg-dim); font: 700 6px var(--vtg-sans); }\n\n.vtg-coords {\n display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px;\n font: 11px var(--vtg-mono); color: var(--vtg-muted); font-variant-numeric: tabular-nums;\n white-space: nowrap;\n}\n.vtg-coords b { color: var(--vtg-dim); font-weight: 600; margin-right: 1px; }\n\n/* --- cave-view depth gauge ------------------------------------------------- */\n.vtg-depth {\n position: absolute; left: 16px; top: 50%; transform: translateY(-50%);\n display: flex; flex-direction: column; align-items: center; gap: 8px;\n padding: 10px 8px; width: 58px;\n animation: vtg-rise-y 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;\n}\n.vtg-depth-val {\n font: 11px var(--vtg-mono); color: var(--vtg-text); font-variant-numeric: tabular-nums;\n display: flex; flex-direction: column; align-items: center; line-height: 1.3;\n}\n.vtg-depth-val b { color: var(--vtg-dim); font-weight: 600; font-size: 9px; letter-spacing: 0.08em; }\n/* The interactive rail: the thumb and landmark labels hang outside the track,\n so the rail stays unclipped while the track clips its own paint. */\n.vtg-depth-rail {\n position: relative; width: 14px; height: min(320px, 38vh);\n cursor: ns-resize; touch-action: none;\n}\n.vtg-depth-rail:focus-visible { outline: 2px solid var(--vtg-accent); outline-offset: 4px; border-radius: 7px; }\n.vtg-depth-track {\n position: absolute; inset: 0; border-radius: 7px; overflow: hidden; pointer-events: none;\n /* A core sample: sky, grass, stone, deepslate, bedrock. */\n background: linear-gradient(180deg, #6f9bce 0%, #6e9150 12%, #6e6f74 48%, #3e424b 76%, #16181d 100%);\n border: 1px solid var(--vtg-line);\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);\n}\n/* The stratum the slice removed: struck through with hazard stripes. */\n.vtg-depth-cut {\n position: absolute; inset: 0 0 auto 0;\n background: repeating-linear-gradient(-45deg, rgba(10, 13, 19, 0.75) 0 4px, rgba(24, 30, 42, 0.55) 4px 8px);\n}\n.vtg-depth-thumb {\n position: absolute; left: -3px; right: -3px; height: 0; pointer-events: none;\n}\n.vtg-depth-thumb::before {\n content: ''; position: absolute; left: 0; right: 0; top: -1.5px; height: 3px;\n background: var(--vtg-accent); border-radius: 2px;\n box-shadow: 0 0 6px rgba(91, 155, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);\n}\n.vtg-depth-mark {\n position: absolute; left: 0; right: 0; height: 0; pointer-events: none;\n}\n.vtg-depth-mark i { position: absolute; left: -4px; width: 4px; top: -0.5px; height: 1px; background: rgba(230, 238, 251, 0.55); }\n.vtg-depth-mark span {\n position: absolute; left: 17px; top: -5px; font: 9px var(--vtg-mono); color: var(--vtg-dim);\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);\n}\n.vtg-depth-close {\n width: 24px; height: 24px; flex: none; display: grid; place-items: center;\n border-radius: 7px; border: 1px solid transparent; background: transparent;\n color: var(--vtg-muted); cursor: pointer; padding: 0;\n transition: background 0.15s, color 0.15s, border-color 0.15s;\n}\n.vtg-depth-close:hover { background: rgba(132, 170, 230, 0.14); color: var(--vtg-text); border-color: var(--vtg-line); }\n.vtg-depth-close svg { width: 13px; height: 13px; display: block; }\n@keyframes vtg-rise-y { from { opacity: 0; transform: translate(-8px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }\n\n/* --- centre reticle (navigation reference) -------------------------------- */\n.vtg-reticle {\n position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;\n transform: translate(-50%, -50%); pointer-events: none; z-index: 4;\n}\n.vtg-ret-ring {\n position: absolute; inset: 0; border-radius: 50%;\n border: 1.5px solid rgba(180, 205, 240, 0.28); transform: scale(0.62);\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);\n transition: border-color 0.2s ease, transform 0.2s ease;\n}\n.vtg-ret-dot {\n position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px;\n border-radius: 50%; background: rgba(238, 244, 255, 0.85);\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 6px rgba(0, 0, 0, 0.55);\n transition: background 0.2s ease;\n}\n.vtg-reticle-on .vtg-ret-ring { border-color: rgba(143, 182, 232, 0.85); transform: scale(1); }\n.vtg-reticle-on .vtg-ret-dot { background: #fff; }\n\n@keyframes vtg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n.vtg-nav { animation-name: vtg-rise-x; }\n@keyframes vtg-rise-x { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }\n";
|
|
157
174
|
/** Inject the component stylesheet once. No-op on the server or after the first call. */
|
|
158
175
|
declare function injectStyles(): void;
|
|
159
176
|
|
|
160
|
-
export { BiomeEntry, BiomeLayer, type BiomeLayerProps, CSS, DisplaySettings, LightPanel, type LightPanelProps, LightSettings, MapNav, type MapNavProps, Panel, type PanelProps, QUALITY_PRESETS, type QualityPreset, Reticle, type ReticleProps, SettingsPanel, type SettingsPanelProps, StreamingSettings, TextureSource, TileInfo, TileSource, type VantageContextValue, VantageViewer$1 as VantageEngine, type VantageStatus, VantageViewer, type VantageViewerProps, ViewMode, injectStyles, useVantage };
|
|
177
|
+
export { BiomeEntry, BiomeLayer, type BiomeLayerProps, CSS, DepthSlider, type DepthSliderProps, DisplaySettings, LightPanel, type LightPanelProps, LightSettings, MapNav, type MapNavProps, Panel, type PanelProps, QUALITY_PRESETS, type QualityPreset, Reticle, type ReticleProps, SettingsPanel, type SettingsPanelProps, StreamingSettings, TextureSource, TileInfo, TileSource, type VantageContextValue, VantageViewer$1 as VantageEngine, type VantageStatus, VantageViewer, type VantageViewerProps, ViewMode, injectStyles, useVantage };
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-
|
|
2
|
-
export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { VantageViewer, DEFAULT_ORBIT_ANGLE } from '../chunk-HGHIERQW.js';
|
|
2
|
+
export { DEFAULT_ORBIT_ANGLE, VANILLA_DISPLAY } from '../chunk-HGHIERQW.js';
|
|
3
|
+
import '../chunk-ILHVIGCI.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
|
|
|
@@ -181,6 +181,63 @@ var CSS = `
|
|
|
181
181
|
}
|
|
182
182
|
.vtg-coords b { color: var(--vtg-dim); font-weight: 600; margin-right: 1px; }
|
|
183
183
|
|
|
184
|
+
/* --- cave-view depth gauge ------------------------------------------------- */
|
|
185
|
+
.vtg-depth {
|
|
186
|
+
position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
|
|
187
|
+
display: flex; flex-direction: column; align-items: center; gap: 8px;
|
|
188
|
+
padding: 10px 8px; width: 58px;
|
|
189
|
+
animation: vtg-rise-y 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
|
|
190
|
+
}
|
|
191
|
+
.vtg-depth-val {
|
|
192
|
+
font: 11px var(--vtg-mono); color: var(--vtg-text); font-variant-numeric: tabular-nums;
|
|
193
|
+
display: flex; flex-direction: column; align-items: center; line-height: 1.3;
|
|
194
|
+
}
|
|
195
|
+
.vtg-depth-val b { color: var(--vtg-dim); font-weight: 600; font-size: 9px; letter-spacing: 0.08em; }
|
|
196
|
+
/* The interactive rail: the thumb and landmark labels hang outside the track,
|
|
197
|
+
so the rail stays unclipped while the track clips its own paint. */
|
|
198
|
+
.vtg-depth-rail {
|
|
199
|
+
position: relative; width: 14px; height: min(320px, 38vh);
|
|
200
|
+
cursor: ns-resize; touch-action: none;
|
|
201
|
+
}
|
|
202
|
+
.vtg-depth-rail:focus-visible { outline: 2px solid var(--vtg-accent); outline-offset: 4px; border-radius: 7px; }
|
|
203
|
+
.vtg-depth-track {
|
|
204
|
+
position: absolute; inset: 0; border-radius: 7px; overflow: hidden; pointer-events: none;
|
|
205
|
+
/* A core sample: sky, grass, stone, deepslate, bedrock. */
|
|
206
|
+
background: linear-gradient(180deg, #6f9bce 0%, #6e9150 12%, #6e6f74 48%, #3e424b 76%, #16181d 100%);
|
|
207
|
+
border: 1px solid var(--vtg-line);
|
|
208
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
|
|
209
|
+
}
|
|
210
|
+
/* The stratum the slice removed: struck through with hazard stripes. */
|
|
211
|
+
.vtg-depth-cut {
|
|
212
|
+
position: absolute; inset: 0 0 auto 0;
|
|
213
|
+
background: repeating-linear-gradient(-45deg, rgba(10, 13, 19, 0.75) 0 4px, rgba(24, 30, 42, 0.55) 4px 8px);
|
|
214
|
+
}
|
|
215
|
+
.vtg-depth-thumb {
|
|
216
|
+
position: absolute; left: -3px; right: -3px; height: 0; pointer-events: none;
|
|
217
|
+
}
|
|
218
|
+
.vtg-depth-thumb::before {
|
|
219
|
+
content: ''; position: absolute; left: 0; right: 0; top: -1.5px; height: 3px;
|
|
220
|
+
background: var(--vtg-accent); border-radius: 2px;
|
|
221
|
+
box-shadow: 0 0 6px rgba(91, 155, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
|
|
222
|
+
}
|
|
223
|
+
.vtg-depth-mark {
|
|
224
|
+
position: absolute; left: 0; right: 0; height: 0; pointer-events: none;
|
|
225
|
+
}
|
|
226
|
+
.vtg-depth-mark i { position: absolute; left: -4px; width: 4px; top: -0.5px; height: 1px; background: rgba(230, 238, 251, 0.55); }
|
|
227
|
+
.vtg-depth-mark span {
|
|
228
|
+
position: absolute; left: 17px; top: -5px; font: 9px var(--vtg-mono); color: var(--vtg-dim);
|
|
229
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
|
|
230
|
+
}
|
|
231
|
+
.vtg-depth-close {
|
|
232
|
+
width: 24px; height: 24px; flex: none; display: grid; place-items: center;
|
|
233
|
+
border-radius: 7px; border: 1px solid transparent; background: transparent;
|
|
234
|
+
color: var(--vtg-muted); cursor: pointer; padding: 0;
|
|
235
|
+
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
|
236
|
+
}
|
|
237
|
+
.vtg-depth-close:hover { background: rgba(132, 170, 230, 0.14); color: var(--vtg-text); border-color: var(--vtg-line); }
|
|
238
|
+
.vtg-depth-close svg { width: 13px; height: 13px; display: block; }
|
|
239
|
+
@keyframes vtg-rise-y { from { opacity: 0; transform: translate(-8px, -50%); } to { opacity: 1; transform: translate(0, -50%); } }
|
|
240
|
+
|
|
184
241
|
/* --- centre reticle (navigation reference) -------------------------------- */
|
|
185
242
|
.vtg-reticle {
|
|
186
243
|
position: absolute; left: 50%; top: 50%; width: 30px; height: 30px;
|
|
@@ -604,19 +661,64 @@ var Icon = {
|
|
|
604
661
|
fly: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
605
662
|
/* @__PURE__ */ jsx("path", { d: "M14.5 1.5 1.2 6.6l5 1.7 1.7 5z" }),
|
|
606
663
|
/* @__PURE__ */ jsx("path", { d: "M14.5 1.5 7.9 8.1" })
|
|
664
|
+
] }),
|
|
665
|
+
camera: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
666
|
+
/* @__PURE__ */ jsx("path", { d: "M2 5h2.2L6 3h4l1.8 2H14v8H2z" }),
|
|
667
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "9", r: "2.4" })
|
|
668
|
+
] }),
|
|
669
|
+
layers: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
670
|
+
/* @__PURE__ */ jsx("path", { d: "M8 2.2 14 5.4 8 8.6 2 5.4z" }),
|
|
671
|
+
/* @__PURE__ */ jsx("path", { d: "M2.8 8.5 8 11.3l5.2-2.8" }),
|
|
672
|
+
/* @__PURE__ */ jsx("path", { d: "M2.8 11.3 8 14.1l5.2-2.8" })
|
|
673
|
+
] }),
|
|
674
|
+
expand: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
675
|
+
/* @__PURE__ */ jsx("path", { d: "M6 2.5H2.5V6" }),
|
|
676
|
+
/* @__PURE__ */ jsx("path", { d: "M10 2.5h3.5V6" }),
|
|
677
|
+
/* @__PURE__ */ jsx("path", { d: "M6 13.5H2.5V10" }),
|
|
678
|
+
/* @__PURE__ */ jsx("path", { d: "M10 13.5h3.5V10" })
|
|
679
|
+
] }),
|
|
680
|
+
compress: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
681
|
+
/* @__PURE__ */ jsx("path", { d: "M2.5 6H6V2.5" }),
|
|
682
|
+
/* @__PURE__ */ jsx("path", { d: "M13.5 6H10V2.5" }),
|
|
683
|
+
/* @__PURE__ */ jsx("path", { d: "M2.5 10H6v3.5" }),
|
|
684
|
+
/* @__PURE__ */ jsx("path", { d: "M13.5 10H10v3.5" })
|
|
607
685
|
] })
|
|
608
686
|
};
|
|
609
|
-
function MapNav({
|
|
610
|
-
|
|
687
|
+
function MapNav({
|
|
688
|
+
compass = true,
|
|
689
|
+
tilt = true,
|
|
690
|
+
fly = true,
|
|
691
|
+
zoom = true,
|
|
692
|
+
home = true,
|
|
693
|
+
coords = true,
|
|
694
|
+
caves = true,
|
|
695
|
+
screenshot = true,
|
|
696
|
+
fullscreen = true,
|
|
697
|
+
className
|
|
698
|
+
}) {
|
|
699
|
+
const { viewer, info } = useVantage();
|
|
700
|
+
const navRef = useRef(null);
|
|
611
701
|
const needleRef = useRef(null);
|
|
612
702
|
const coordRef = useRef(null);
|
|
613
703
|
const tiltRef = useRef(null);
|
|
614
704
|
const [flying, setFlying] = useState(false);
|
|
705
|
+
const [isFs, setIsFs] = useState(false);
|
|
706
|
+
const [sliced, setSliced] = useState(false);
|
|
615
707
|
useEffect(() => {
|
|
616
708
|
if (!viewer) return;
|
|
617
709
|
setFlying(viewer.isFlying);
|
|
618
710
|
return viewer.on("mode", ({ fly: fly2 }) => setFlying(fly2));
|
|
619
711
|
}, [viewer]);
|
|
712
|
+
useEffect(() => {
|
|
713
|
+
if (!viewer) return;
|
|
714
|
+
setSliced(viewer.slice !== null);
|
|
715
|
+
return viewer.on("slice", ({ y }) => setSliced(y !== null));
|
|
716
|
+
}, [viewer]);
|
|
717
|
+
useEffect(() => {
|
|
718
|
+
const sync = () => setIsFs(document.fullscreenElement != null);
|
|
719
|
+
document.addEventListener("fullscreenchange", sync);
|
|
720
|
+
return () => document.removeEventListener("fullscreenchange", sync);
|
|
721
|
+
}, []);
|
|
620
722
|
useEffect(() => {
|
|
621
723
|
if (!viewer) return;
|
|
622
724
|
let raf = 0;
|
|
@@ -653,7 +755,23 @@ function MapNav({ compass = true, tilt = true, fly = true, zoom = true, home = t
|
|
|
653
755
|
}, [viewer]);
|
|
654
756
|
if (!viewer) return null;
|
|
655
757
|
const toggleTilt = () => viewer.tilt > TILT_THRESHOLD ? viewer.flatten() : viewer.setTilt(DEFAULT_ORBIT_ANGLE);
|
|
656
|
-
|
|
758
|
+
const takeScreenshot = () => {
|
|
759
|
+
const p = viewer.controls.position;
|
|
760
|
+
const a = document.createElement("a");
|
|
761
|
+
a.href = viewer.screenshot();
|
|
762
|
+
a.download = `vantage_${Math.round(p.x)}_${Math.round(p.z)}.png`;
|
|
763
|
+
a.click();
|
|
764
|
+
};
|
|
765
|
+
const showCaves = caves && info !== null && (viewer.hasCaves || sliced);
|
|
766
|
+
const canFullscreen = typeof document !== "undefined" && document.fullscreenEnabled;
|
|
767
|
+
const toggleFullscreen = () => {
|
|
768
|
+
if (document.fullscreenElement != null) document.exitFullscreen().catch(() => {
|
|
769
|
+
});
|
|
770
|
+
else
|
|
771
|
+
(navRef.current?.closest(".vtg-root") ?? document.documentElement).requestFullscreen().catch(() => {
|
|
772
|
+
});
|
|
773
|
+
};
|
|
774
|
+
return /* @__PURE__ */ jsxs("div", { ref: navRef, className: className ? `vtg-nav vtg-glass ${className}` : "vtg-nav vtg-glass", role: "group", "aria-label": "map navigation", children: [
|
|
657
775
|
compass && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-compass", title: "Face north", "aria-label": "Face north", onClick: () => viewer.resetNorth(), children: /* @__PURE__ */ jsxs("svg", { viewBox: "-16 -16 32 32", "aria-hidden": "true", children: [
|
|
658
776
|
/* @__PURE__ */ jsx("circle", { cx: "0", cy: "0", r: "14.5", fill: "none", stroke: "rgba(140,178,238,0.18)", strokeWidth: "1" }),
|
|
659
777
|
/* @__PURE__ */ jsxs("g", { ref: needleRef, children: [
|
|
@@ -675,16 +793,135 @@ function MapNav({ compass = true, tilt = true, fly = true, zoom = true, home = t
|
|
|
675
793
|
children: Icon.fly
|
|
676
794
|
}
|
|
677
795
|
),
|
|
796
|
+
showCaves && /* @__PURE__ */ jsx(
|
|
797
|
+
"button",
|
|
798
|
+
{
|
|
799
|
+
type: "button",
|
|
800
|
+
className: sliced ? "vtg-navbtn vtg-on" : "vtg-navbtn",
|
|
801
|
+
title: sliced ? "Close the cave view (C)" : "Cave view \u2014 slice into the world (C)",
|
|
802
|
+
"aria-label": "Toggle cave view",
|
|
803
|
+
"aria-pressed": sliced,
|
|
804
|
+
onClick: () => viewer.toggleSlice(),
|
|
805
|
+
children: Icon.layers
|
|
806
|
+
}
|
|
807
|
+
),
|
|
678
808
|
coords && /* @__PURE__ */ jsxs("span", { className: "vtg-coords", title: "World X, Z at view centre", children: [
|
|
679
809
|
/* @__PURE__ */ jsx("b", { children: "xz" }),
|
|
680
810
|
/* @__PURE__ */ jsx("span", { ref: coordRef, children: "0, 0" })
|
|
681
811
|
] }),
|
|
682
|
-
!flying && (zoom || home) && /* @__PURE__ */ jsx("span", { className: "vtg-nav-sep" }),
|
|
812
|
+
(screenshot || fullscreen && canFullscreen || !flying && (zoom || home)) && /* @__PURE__ */ jsx("span", { className: "vtg-nav-sep" }),
|
|
683
813
|
zoom && !flying && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
684
814
|
/* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Zoom out", "aria-label": "Zoom out", onClick: () => viewer.zoomBy(-1), children: Icon.minus }),
|
|
685
815
|
/* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Zoom in", "aria-label": "Zoom in", onClick: () => viewer.zoomBy(1), children: Icon.plus })
|
|
686
816
|
] }),
|
|
687
|
-
home && !flying && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Reset view", "aria-label": "Reset view", onClick: () => viewer.resetView(), children: Icon.home })
|
|
817
|
+
home && !flying && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Reset view", "aria-label": "Reset view", onClick: () => viewer.resetView(), children: Icon.home }),
|
|
818
|
+
screenshot && /* @__PURE__ */ jsx("button", { type: "button", className: "vtg-navbtn", title: "Save a screenshot (PNG)", "aria-label": "Save a screenshot", onClick: takeScreenshot, children: Icon.camera }),
|
|
819
|
+
fullscreen && canFullscreen && /* @__PURE__ */ jsx(
|
|
820
|
+
"button",
|
|
821
|
+
{
|
|
822
|
+
type: "button",
|
|
823
|
+
className: isFs ? "vtg-navbtn vtg-on" : "vtg-navbtn",
|
|
824
|
+
title: isFs ? "Exit fullscreen" : "Fullscreen",
|
|
825
|
+
"aria-label": "Toggle fullscreen",
|
|
826
|
+
"aria-pressed": isFs,
|
|
827
|
+
onClick: toggleFullscreen,
|
|
828
|
+
children: isFs ? Icon.compress : Icon.expand
|
|
829
|
+
}
|
|
830
|
+
)
|
|
831
|
+
] });
|
|
832
|
+
}
|
|
833
|
+
function isTypingTarget2(t) {
|
|
834
|
+
if (!(t instanceof HTMLElement)) return false;
|
|
835
|
+
return t.isContentEditable || t.tagName === "INPUT" || t.tagName === "TEXTAREA";
|
|
836
|
+
}
|
|
837
|
+
function DepthSlider({ toggleKey = "c", step = 4, className }) {
|
|
838
|
+
const { viewer, info } = useVantage();
|
|
839
|
+
const trackRef = useRef(null);
|
|
840
|
+
const [sliceY, setSliceY] = useState(null);
|
|
841
|
+
useEffect(() => {
|
|
842
|
+
if (!viewer) return;
|
|
843
|
+
setSliceY(viewer.slice);
|
|
844
|
+
return viewer.on("slice", ({ y }) => setSliceY(y));
|
|
845
|
+
}, [viewer]);
|
|
846
|
+
useEffect(() => {
|
|
847
|
+
if (!viewer) return;
|
|
848
|
+
const onKey = (e) => {
|
|
849
|
+
if (isTypingTarget2(e.target)) return;
|
|
850
|
+
if (toggleKey && e.key.toLowerCase() === toggleKey.toLowerCase()) {
|
|
851
|
+
if (viewer.hasCaves || viewer.slice !== null) viewer.toggleSlice();
|
|
852
|
+
} else if (viewer.slice !== null && (e.key === "[" || e.key === "]")) {
|
|
853
|
+
viewer.setSlice(viewer.slice + (e.key === "]" ? step : -step));
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
window.addEventListener("keydown", onKey);
|
|
857
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
858
|
+
}, [viewer, toggleKey, step]);
|
|
859
|
+
if (!viewer || !info || sliceY === null) return null;
|
|
860
|
+
const { min, max } = viewer.sliceRange;
|
|
861
|
+
const frac = (y) => Math.min(Math.max((max - y) / (max - min), 0), 1);
|
|
862
|
+
const thumbTop = frac(sliceY) * 100;
|
|
863
|
+
const setFromPointer = (e) => {
|
|
864
|
+
const track = trackRef.current;
|
|
865
|
+
if (!track) return;
|
|
866
|
+
const r = track.getBoundingClientRect();
|
|
867
|
+
const t = Math.min(Math.max((e.clientY - r.top) / r.height, 0), 1);
|
|
868
|
+
viewer.setSlice(Math.round(max - t * (max - min)));
|
|
869
|
+
};
|
|
870
|
+
const onPointerDown = (e) => {
|
|
871
|
+
e.preventDefault();
|
|
872
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
873
|
+
setFromPointer(e);
|
|
874
|
+
};
|
|
875
|
+
const marks = [];
|
|
876
|
+
if (63 > min && 63 < max) marks.push({ y: 63, label: "sea" });
|
|
877
|
+
if (0 > min && 0 < max) marks.push({ y: 0, label: "0" });
|
|
878
|
+
return /* @__PURE__ */ jsxs("div", { className: className ? `vtg-depth vtg-glass ${className}` : "vtg-depth vtg-glass", role: "group", "aria-label": "cave view depth", children: [
|
|
879
|
+
/* @__PURE__ */ jsxs("div", { className: "vtg-depth-val", title: "Slice depth (world Y)", children: [
|
|
880
|
+
/* @__PURE__ */ jsx("b", { children: "Y" }),
|
|
881
|
+
Math.round(sliceY)
|
|
882
|
+
] }),
|
|
883
|
+
/* @__PURE__ */ jsxs(
|
|
884
|
+
"div",
|
|
885
|
+
{
|
|
886
|
+
ref: trackRef,
|
|
887
|
+
className: "vtg-depth-rail",
|
|
888
|
+
role: "slider",
|
|
889
|
+
"aria-label": "Slice depth",
|
|
890
|
+
"aria-valuemin": min,
|
|
891
|
+
"aria-valuemax": max,
|
|
892
|
+
"aria-valuenow": Math.round(sliceY),
|
|
893
|
+
"aria-orientation": "vertical",
|
|
894
|
+
tabIndex: 0,
|
|
895
|
+
onPointerDown,
|
|
896
|
+
onPointerMove: (e) => e.buttons === 1 && setFromPointer(e),
|
|
897
|
+
onKeyDown: (e) => {
|
|
898
|
+
if (e.key === "ArrowUp") viewer.setSlice(sliceY + 1);
|
|
899
|
+
else if (e.key === "ArrowDown") viewer.setSlice(sliceY - 1);
|
|
900
|
+
},
|
|
901
|
+
children: [
|
|
902
|
+
/* @__PURE__ */ jsx("div", { className: "vtg-depth-track", children: /* @__PURE__ */ jsx("div", { className: "vtg-depth-cut", style: { height: `${thumbTop}%` } }) }),
|
|
903
|
+
marks.map((m) => /* @__PURE__ */ jsxs("div", { className: "vtg-depth-mark", style: { top: `${frac(m.y) * 100}%` }, children: [
|
|
904
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
905
|
+
/* @__PURE__ */ jsx("span", { children: m.label })
|
|
906
|
+
] }, m.label)),
|
|
907
|
+
/* @__PURE__ */ jsx("div", { className: "vtg-depth-thumb", style: { top: `${thumbTop}%` } })
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
),
|
|
911
|
+
/* @__PURE__ */ jsx(
|
|
912
|
+
"button",
|
|
913
|
+
{
|
|
914
|
+
type: "button",
|
|
915
|
+
className: "vtg-depth-close",
|
|
916
|
+
title: "Close the cave view",
|
|
917
|
+
"aria-label": "Close the cave view",
|
|
918
|
+
onClick: () => viewer.setSlice(null),
|
|
919
|
+
children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", children: [
|
|
920
|
+
/* @__PURE__ */ jsx("path", { d: "M4.5 4.5 11.5 11.5" }),
|
|
921
|
+
/* @__PURE__ */ jsx("path", { d: "M11.5 4.5 4.5 11.5" })
|
|
922
|
+
] })
|
|
923
|
+
}
|
|
924
|
+
)
|
|
688
925
|
] });
|
|
689
926
|
}
|
|
690
927
|
function Reticle({ className }) {
|
|
@@ -712,4 +949,4 @@ function Reticle({ className }) {
|
|
|
712
949
|
] });
|
|
713
950
|
}
|
|
714
951
|
|
|
715
|
-
export { BiomeLayer, CSS, LightPanel, MapNav, Panel, QUALITY_PRESETS, Reticle, SettingsPanel, VantageViewer2 as VantageViewer, injectStyles, useVantage };
|
|
952
|
+
export { BiomeLayer, CSS, DepthSlider, LightPanel, MapNav, Panel, QUALITY_PRESETS, Reticle, SettingsPanel, VantageViewer2 as VantageViewer, injectStyles, useVantage };
|
package/dist/three/index.d.ts
CHANGED
|
@@ -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-
|
|
3
|
-
export { B as BiomeEntry, b as ByteReader, 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, W as WorldFetch, i as WorldManifest, j as WorldSource, k as biomePalette, l as canonicalQuadIndices, p as parseManifest, m as parseTextureArray, n as parseTile, o as parseTileQuantized, s as stripNamespace, q as summarizeBiomes, r as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, u as worldFromFiles, v as worldFromUrl } from '../biome-
|
|
2
|
+
import { R as Rgb, Q as QuantizedTile, D as DecodedTile, a as DecodedTextureArray, S as SurfaceMap } from '../biome-uodZHCCI.js';
|
|
3
|
+
export { B as BiomeEntry, b as ByteReader, 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, W as WorldFetch, i as WorldManifest, j as WorldSource, k as biomePalette, l as canonicalQuadIndices, p as parseManifest, m as parseTextureArray, n as parseTile, o as parseTileQuantized, s as stripNamespace, q as summarizeBiomes, r as summarizeSurfaceBiomes, t as tileKey, w as worldFromDirectory, u as worldFromFiles, v as worldFromUrl } from '../biome-uodZHCCI.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-
|
|
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-Ba31QN1M.js';
|
|
7
7
|
|
|
8
8
|
/** The objects and metadata produced from a tile. */
|
|
9
9
|
interface TerrainObjects {
|
package/dist/three/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DEFAULT_ORBIT_ANGLE, MapControls, SKY_HORIZON, SKY_TOP, TileManager, VANILLA_DISPLAY, VantageViewer, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome } from '../chunk-
|
|
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, worldFromUrl } from '../chunk-
|
|
1
|
+
export { DEFAULT_ORBIT_ANGLE, MapControls, SKY_HORIZON, SKY_TOP, TileManager, VANILLA_DISPLAY, VantageViewer, buildLowresMesh, buildQuantizedTileMeshes, buildTerrain, buildTileMeshes, createLowresMaterial, createSky, createTerrainMaterial, createWaterMaterial, pickBiome } from '../chunk-HGHIERQW.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, worldFromUrl } from '../chunk-ILHVIGCI.js';
|