@seatlayer/core 0.47.0 → 0.47.1
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/dist/view3d/index.cjs +19 -4
- package/dist/view3d/index.cjs.map +1 -1
- package/dist/view3d/index.d.cts +15 -2
- package/dist/view3d/index.d.ts +15 -2
- package/dist/view3d/index.js +19 -4
- package/dist/view3d/index.js.map +1 -1
- package/package.json +1 -1
package/dist/view3d/index.d.cts
CHANGED
|
@@ -377,11 +377,24 @@ declare function buildSceneModel(input: SceneModelInput): SceneModel;
|
|
|
377
377
|
* rendering. No DOM, no GL — unit-testable in isolation.
|
|
378
378
|
*/
|
|
379
379
|
type Analytics3DCallback = (event: string, props?: Record<string, unknown>) => void;
|
|
380
|
+
/**
|
|
381
|
+
* Where the CPU scene was compiled, as a closed enum (never free text).
|
|
382
|
+
* - `worker` — built off the UI thread by `prepareVenue3D`.
|
|
383
|
+
* - `main` — `prepareVenue3D` ran but the worker was unavailable or failed
|
|
384
|
+
* (no `Worker`, a host CSP blocking the module worker, a throw, or
|
|
385
|
+
* the 15s timeout) and the same pure compiler ran on the UI thread.
|
|
386
|
+
* - `inline` — the caller never used `prepareVenue3D`; the scene was compiled
|
|
387
|
+
* synchronously inside `mountVenue3D`. Kept distinct from `main`
|
|
388
|
+
* so worker uptake is not diluted by callers that never asked.
|
|
389
|
+
*/
|
|
390
|
+
type Scene3DPrepSource = 'worker' | 'main' | 'inline';
|
|
380
391
|
|
|
381
392
|
interface PreparedVenue3D {
|
|
382
393
|
model: SceneModel;
|
|
383
394
|
buildMs: number;
|
|
384
|
-
|
|
395
|
+
/** Reported on `3d_opened` as `prepSource`. `inline` is not reachable here —
|
|
396
|
+
* it is what `mountVenue3D` reports when no prepared scene was handed in. */
|
|
397
|
+
source: Exclude<Scene3DPrepSource, 'inline'>;
|
|
385
398
|
}
|
|
386
399
|
interface PrepareVenue3DInput {
|
|
387
400
|
doc: ChartDoc;
|
|
@@ -514,4 +527,4 @@ interface Venue3DHandle {
|
|
|
514
527
|
}
|
|
515
528
|
declare function mountVenue3D(container: HTMLElement, input: Venue3DInput, opts?: Venue3DOptions): Venue3DHandle;
|
|
516
529
|
|
|
517
|
-
export { type Analytics3DCallback, type SeatState3D, SeatView, type Venue3DHandle, type Venue3DInput, type Venue3DOptions, type Venue3DStats, buildSceneModel, mountVenue3D, prepareVenue3D };
|
|
530
|
+
export { type Analytics3DCallback, type Scene3DPrepSource, type SeatState3D, SeatView, type Venue3DHandle, type Venue3DInput, type Venue3DOptions, type Venue3DStats, buildSceneModel, mountVenue3D, prepareVenue3D };
|
package/dist/view3d/index.d.ts
CHANGED
|
@@ -377,11 +377,24 @@ declare function buildSceneModel(input: SceneModelInput): SceneModel;
|
|
|
377
377
|
* rendering. No DOM, no GL — unit-testable in isolation.
|
|
378
378
|
*/
|
|
379
379
|
type Analytics3DCallback = (event: string, props?: Record<string, unknown>) => void;
|
|
380
|
+
/**
|
|
381
|
+
* Where the CPU scene was compiled, as a closed enum (never free text).
|
|
382
|
+
* - `worker` — built off the UI thread by `prepareVenue3D`.
|
|
383
|
+
* - `main` — `prepareVenue3D` ran but the worker was unavailable or failed
|
|
384
|
+
* (no `Worker`, a host CSP blocking the module worker, a throw, or
|
|
385
|
+
* the 15s timeout) and the same pure compiler ran on the UI thread.
|
|
386
|
+
* - `inline` — the caller never used `prepareVenue3D`; the scene was compiled
|
|
387
|
+
* synchronously inside `mountVenue3D`. Kept distinct from `main`
|
|
388
|
+
* so worker uptake is not diluted by callers that never asked.
|
|
389
|
+
*/
|
|
390
|
+
type Scene3DPrepSource = 'worker' | 'main' | 'inline';
|
|
380
391
|
|
|
381
392
|
interface PreparedVenue3D {
|
|
382
393
|
model: SceneModel;
|
|
383
394
|
buildMs: number;
|
|
384
|
-
|
|
395
|
+
/** Reported on `3d_opened` as `prepSource`. `inline` is not reachable here —
|
|
396
|
+
* it is what `mountVenue3D` reports when no prepared scene was handed in. */
|
|
397
|
+
source: Exclude<Scene3DPrepSource, 'inline'>;
|
|
385
398
|
}
|
|
386
399
|
interface PrepareVenue3DInput {
|
|
387
400
|
doc: ChartDoc;
|
|
@@ -514,4 +527,4 @@ interface Venue3DHandle {
|
|
|
514
527
|
}
|
|
515
528
|
declare function mountVenue3D(container: HTMLElement, input: Venue3DInput, opts?: Venue3DOptions): Venue3DHandle;
|
|
516
529
|
|
|
517
|
-
export { type Analytics3DCallback, type SeatState3D, SeatView, type Venue3DHandle, type Venue3DInput, type Venue3DOptions, type Venue3DStats, buildSceneModel, mountVenue3D, prepareVenue3D };
|
|
530
|
+
export { type Analytics3DCallback, type Scene3DPrepSource, type SeatState3D, SeatView, type Venue3DHandle, type Venue3DInput, type Venue3DOptions, type Venue3DStats, buildSceneModel, mountVenue3D, prepareVenue3D };
|
package/dist/view3d/index.js
CHANGED
|
@@ -4988,11 +4988,12 @@ var Analytics3D = class {
|
|
|
4988
4988
|
} catch {
|
|
4989
4989
|
}
|
|
4990
4990
|
}
|
|
4991
|
-
opened(seats, hasHeights, buildMs) {
|
|
4991
|
+
opened(seats, hasHeights, buildMs, prepSource) {
|
|
4992
4992
|
this.emit("3d_opened", {
|
|
4993
4993
|
seats,
|
|
4994
4994
|
hasHeights,
|
|
4995
|
-
...buildMs === void 0 ? {} : { buildMs: Math.round(buildMs) }
|
|
4995
|
+
...buildMs === void 0 ? {} : { buildMs: Math.round(buildMs) },
|
|
4996
|
+
...prepSource === void 0 ? {} : { prepSource }
|
|
4996
4997
|
});
|
|
4997
4998
|
}
|
|
4998
4999
|
/** First user-driven orbit/dolly per mount only (the intro ease is not user
|
|
@@ -5306,10 +5307,11 @@ function mountVenue3D(container, input, opts = {}) {
|
|
|
5306
5307
|
orbit.camera.fov = FOV_END;
|
|
5307
5308
|
orbit.camera.updateProjectionMatrix();
|
|
5308
5309
|
};
|
|
5310
|
+
const isNarrow = () => (container.clientWidth || glctx.canvas.clientWidth) <= 520;
|
|
5309
5311
|
let arriveChip = null;
|
|
5310
5312
|
const layoutArriveChip = () => {
|
|
5311
5313
|
if (!arriveChip) return;
|
|
5312
|
-
const narrow = (
|
|
5314
|
+
const narrow = isNarrow();
|
|
5313
5315
|
Object.assign(arriveChip.style, narrow ? {
|
|
5314
5316
|
left: "12px",
|
|
5315
5317
|
right: "12px",
|
|
@@ -5489,6 +5491,10 @@ function mountVenue3D(container, input, opts = {}) {
|
|
|
5489
5491
|
zoomInButton.addEventListener("click", () => orbit.zoomBy(0.82));
|
|
5490
5492
|
setNavigationMode("orbit");
|
|
5491
5493
|
container.appendChild(navigationModeChip);
|
|
5494
|
+
const layoutNavigationChip = () => {
|
|
5495
|
+
navigationModeChip.style.display = isNarrow() ? "none" : "flex";
|
|
5496
|
+
};
|
|
5497
|
+
layoutNavigationChip();
|
|
5492
5498
|
const overviewChip = document.createElement("button");
|
|
5493
5499
|
overviewChip.type = "button";
|
|
5494
5500
|
overviewChip.textContent = "\u2302 Overview";
|
|
@@ -5809,6 +5815,7 @@ function mountVenue3D(container, input, opts = {}) {
|
|
|
5809
5815
|
const { width, height } = glctx.resize();
|
|
5810
5816
|
orbit.setAspect(width / Math.max(1, height));
|
|
5811
5817
|
layoutArriveChip();
|
|
5818
|
+
layoutNavigationChip();
|
|
5812
5819
|
loop.requestRender();
|
|
5813
5820
|
},
|
|
5814
5821
|
stats() {
|
|
@@ -5916,7 +5923,15 @@ function mountVenue3D(container, input, opts = {}) {
|
|
|
5916
5923
|
glctx.dispose();
|
|
5917
5924
|
}
|
|
5918
5925
|
};
|
|
5919
|
-
analytics.opened(
|
|
5926
|
+
analytics.opened(
|
|
5927
|
+
model.seatCount,
|
|
5928
|
+
hasHeights,
|
|
5929
|
+
input.prepared?.buildMs ?? performance.now() - buildStartedAt,
|
|
5930
|
+
// Known synchronously at mount: either the caller handed us a scene
|
|
5931
|
+
// prepared by `prepareVenue3D` (which reports worker vs. main-thread
|
|
5932
|
+
// fallback) or we compiled it inline here. Never delays the event.
|
|
5933
|
+
input.prepared?.source ?? "inline"
|
|
5934
|
+
);
|
|
5920
5935
|
return handle;
|
|
5921
5936
|
}
|
|
5922
5937
|
export {
|