@seatlayer/core 0.52.0 → 0.53.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.
Files changed (51) hide show
  1. package/LICENSE +16 -17
  2. package/README.md +8 -18
  3. package/dist/chunk-54A7LIL5.js +1 -0
  4. package/dist/chunk-IJI4WU57.js +1 -0
  5. package/dist/chunk-XPPT3OGQ.js +1 -0
  6. package/dist/core/seatConfidence.cjs +1 -76
  7. package/dist/core/seatConfidence.js +1 -51
  8. package/dist/de-75NWRKC5.js +1 -0
  9. package/dist/es-BM7EJ7PW.js +1 -0
  10. package/dist/fr-HPXQHIB4.js +1 -0
  11. package/dist/index.cjs +1 -12717
  12. package/dist/index.d.cts +38 -53
  13. package/dist/index.d.ts +38 -53
  14. package/dist/index.js +1 -10235
  15. package/dist/picker/minimapGeometry.cjs +1 -80
  16. package/dist/picker/minimapGeometry.js +1 -52
  17. package/dist/view/panoramaDelivery.cjs +1 -126
  18. package/dist/view/panoramaDelivery.js +1 -17
  19. package/dist/view3d/crossfade/panorama.cjs +1 -459
  20. package/dist/view3d/crossfade/panorama.d.cts +1 -3
  21. package/dist/view3d/crossfade/panorama.d.ts +1 -3
  22. package/dist/view3d/crossfade/panorama.js +1 -30
  23. package/dist/view3d/index.cjs +27 -7929
  24. package/dist/view3d/index.d.cts +62 -21
  25. package/dist/view3d/index.d.ts +62 -21
  26. package/dist/view3d/index.js +27 -7062
  27. package/package.json +2 -7
  28. package/dist/chunk-AZODENEL.js +0 -97
  29. package/dist/chunk-AZODENEL.js.map +0 -1
  30. package/dist/chunk-BE3F7CT3.js +0 -341
  31. package/dist/chunk-BE3F7CT3.js.map +0 -1
  32. package/dist/chunk-UID7KN44.js +0 -1569
  33. package/dist/chunk-UID7KN44.js.map +0 -1
  34. package/dist/core/seatConfidence.cjs.map +0 -1
  35. package/dist/core/seatConfidence.js.map +0 -1
  36. package/dist/de-YGODYJ3E.js +0 -292
  37. package/dist/de-YGODYJ3E.js.map +0 -1
  38. package/dist/es-VMBTGVFQ.js +0 -292
  39. package/dist/es-VMBTGVFQ.js.map +0 -1
  40. package/dist/fr-SLBE2ULB.js +0 -292
  41. package/dist/fr-SLBE2ULB.js.map +0 -1
  42. package/dist/index.cjs.map +0 -1
  43. package/dist/index.js.map +0 -1
  44. package/dist/picker/minimapGeometry.cjs.map +0 -1
  45. package/dist/picker/minimapGeometry.js.map +0 -1
  46. package/dist/view/panoramaDelivery.cjs.map +0 -1
  47. package/dist/view/panoramaDelivery.js.map +0 -1
  48. package/dist/view3d/crossfade/panorama.cjs.map +0 -1
  49. package/dist/view3d/crossfade/panorama.js.map +0 -1
  50. package/dist/view3d/index.cjs.map +0 -1
  51. package/dist/view3d/index.js.map +0 -1
@@ -1,80 +1 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/picker/minimapGeometry.ts
21
- var minimapGeometry_exports = {};
22
- __export(minimapGeometry_exports, {
23
- createMinimapTransform: () => createMinimapTransform,
24
- minimapPointToWorld: () => minimapPointToWorld,
25
- minimapViewportPlan: () => minimapViewportPlan,
26
- worldRectToMinimap: () => worldRectToMinimap
27
- });
28
- module.exports = __toCommonJS(minimapGeometry_exports);
29
- function createMinimapTransform(world, pixelWidth, pixelHeight, dpr, cssPadding = 6) {
30
- const padding = cssPadding * dpr;
31
- const scale = Math.min(
32
- (pixelWidth - padding * 2) / Math.max(1, world.width),
33
- (pixelHeight - padding * 2) / Math.max(1, world.height)
34
- );
35
- return {
36
- scale,
37
- offX: (pixelWidth - world.width * scale) / 2 - world.x * scale,
38
- offY: (pixelHeight - world.height * scale) / 2 - world.y * scale,
39
- dpr
40
- };
41
- }
42
- function worldRectToMinimap(rect, transform) {
43
- return {
44
- x: rect.x * transform.scale + transform.offX,
45
- y: rect.y * transform.scale + transform.offY,
46
- width: rect.width * transform.scale,
47
- height: rect.height * transform.scale
48
- };
49
- }
50
- function minimapViewportPlan(visible, transform, pixelWidth, pixelHeight, strokeInset = 2) {
51
- const raw = worldRectToMinimap(visible, transform);
52
- const left = Math.max(strokeInset, raw.x);
53
- const top = Math.max(strokeInset, raw.y);
54
- const right = Math.min(pixelWidth - strokeInset, raw.x + raw.width);
55
- const bottom = Math.min(pixelHeight - strokeInset, raw.y + raw.height);
56
- return {
57
- raw,
58
- clipped: right > left && bottom > top ? { x: left, y: top, width: right - left, height: bottom - top } : null,
59
- clippedEdges: {
60
- left: raw.x < strokeInset,
61
- top: raw.y < strokeInset,
62
- right: raw.x + raw.width > pixelWidth - strokeInset,
63
- bottom: raw.y + raw.height > pixelHeight - strokeInset
64
- }
65
- };
66
- }
67
- function minimapPointToWorld(pixel, transform) {
68
- return {
69
- x: (pixel.x - transform.offX) / transform.scale,
70
- y: (pixel.y - transform.offY) / transform.scale
71
- };
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- createMinimapTransform,
76
- minimapPointToWorld,
77
- minimapViewportPlan,
78
- worldRectToMinimap
79
- });
80
- //# sourceMappingURL=minimapGeometry.cjs.map
1
+ "use strict";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var x=(n,i)=>{for(var t in i)c(n,t,{get:i[t],enumerable:!0})},l=(n,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of f(i))!M.call(n,e)&&e!==t&&c(n,e,{get:()=>i[e],enumerable:!(o=b(i,e))||o.enumerable});return n};var y=n=>l(c({},"__esModule",{value:!0}),n);var R={};x(R,{createMinimapTransform:()=>g,minimapPointToWorld:()=>w,minimapViewportPlan:()=>d,worldRectToMinimap:()=>u});module.exports=y(R);function g(n,i,t,o,e=6){let a=e*o,m=Math.min((i-a*2)/Math.max(1,n.width),(t-a*2)/Math.max(1,n.height));return{scale:m,offX:(i-n.width*m)/2-n.x*m,offY:(t-n.height*m)/2-n.y*m,dpr:o}}function u(n,i){return{x:n.x*i.scale+i.offX,y:n.y*i.scale+i.offY,width:n.width*i.scale,height:n.height*i.scale}}function d(n,i,t,o,e=2){let a=u(n,i),m=Math.max(e,a.x),p=Math.max(e,a.y),h=Math.min(t-e,a.x+a.width),r=Math.min(o-e,a.y+a.height);return{raw:a,clipped:h>m&&r>p?{x:m,y:p,width:h-m,height:r-p}:null,clippedEdges:{left:a.x<e,top:a.y<e,right:a.x+a.width>t-e,bottom:a.y+a.height>o-e}}}function w(n,i){return{x:(n.x-i.offX)/i.scale,y:(n.y-i.offY)/i.scale}}0&&(module.exports={createMinimapTransform,minimapPointToWorld,minimapViewportPlan,worldRectToMinimap});
@@ -1,52 +1 @@
1
- // src/picker/minimapGeometry.ts
2
- function createMinimapTransform(world, pixelWidth, pixelHeight, dpr, cssPadding = 6) {
3
- const padding = cssPadding * dpr;
4
- const scale = Math.min(
5
- (pixelWidth - padding * 2) / Math.max(1, world.width),
6
- (pixelHeight - padding * 2) / Math.max(1, world.height)
7
- );
8
- return {
9
- scale,
10
- offX: (pixelWidth - world.width * scale) / 2 - world.x * scale,
11
- offY: (pixelHeight - world.height * scale) / 2 - world.y * scale,
12
- dpr
13
- };
14
- }
15
- function worldRectToMinimap(rect, transform) {
16
- return {
17
- x: rect.x * transform.scale + transform.offX,
18
- y: rect.y * transform.scale + transform.offY,
19
- width: rect.width * transform.scale,
20
- height: rect.height * transform.scale
21
- };
22
- }
23
- function minimapViewportPlan(visible, transform, pixelWidth, pixelHeight, strokeInset = 2) {
24
- const raw = worldRectToMinimap(visible, transform);
25
- const left = Math.max(strokeInset, raw.x);
26
- const top = Math.max(strokeInset, raw.y);
27
- const right = Math.min(pixelWidth - strokeInset, raw.x + raw.width);
28
- const bottom = Math.min(pixelHeight - strokeInset, raw.y + raw.height);
29
- return {
30
- raw,
31
- clipped: right > left && bottom > top ? { x: left, y: top, width: right - left, height: bottom - top } : null,
32
- clippedEdges: {
33
- left: raw.x < strokeInset,
34
- top: raw.y < strokeInset,
35
- right: raw.x + raw.width > pixelWidth - strokeInset,
36
- bottom: raw.y + raw.height > pixelHeight - strokeInset
37
- }
38
- };
39
- }
40
- function minimapPointToWorld(pixel, transform) {
41
- return {
42
- x: (pixel.x - transform.offX) / transform.scale,
43
- y: (pixel.y - transform.offY) / transform.scale
44
- };
45
- }
46
- export {
47
- createMinimapTransform,
48
- minimapPointToWorld,
49
- minimapViewportPlan,
50
- worldRectToMinimap
51
- };
52
- //# sourceMappingURL=minimapGeometry.js.map
1
+ function u(i,n,m,o,a=6){let e=a*o,t=Math.min((n-e*2)/Math.max(1,i.width),(m-e*2)/Math.max(1,i.height));return{scale:t,offX:(n-i.width*t)/2-i.x*t,offY:(m-i.height*t)/2-i.y*t,dpr:o}}function r(i,n){return{x:i.x*n.scale+n.offX,y:i.y*n.scale+n.offY,width:i.width*n.scale,height:i.height*n.scale}}function b(i,n,m,o,a=2){let e=r(i,n),t=Math.max(a,e.x),p=Math.max(a,e.y),c=Math.min(m-a,e.x+e.width),h=Math.min(o-a,e.y+e.height);return{raw:e,clipped:c>t&&h>p?{x:t,y:p,width:c-t,height:h-p}:null,clippedEdges:{left:e.x<a,top:e.y<a,right:e.x+e.width>m-a,bottom:e.y+e.height>o-a}}}function f(i,n){return{x:(i.x-n.offX)/n.scale,y:(i.y-n.offY)/n.scale}}export{u as createMinimapTransform,f as minimapPointToWorld,b as minimapViewportPlan,r as worldRectToMinimap};
@@ -1,126 +1 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/view/panoramaDelivery.ts
21
- var panoramaDelivery_exports = {};
22
- __export(panoramaDelivery_exports, {
23
- browserPanoramaConstraints: () => browserPanoramaConstraints,
24
- estimatePanoramaTextureBytes: () => estimatePanoramaTextureBytes,
25
- loadPanoramaImage: () => loadPanoramaImage,
26
- panoramaTextureBudgetBytes: () => panoramaTextureBudgetBytes,
27
- planPanoramaDelivery: () => planPanoramaDelivery,
28
- schedulePanoramaUpgrade: () => schedulePanoramaUpgrade
29
- });
30
- module.exports = __toCommonJS(panoramaDelivery_exports);
31
- function estimatePanoramaTextureBytes(width, height) {
32
- if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return 0;
33
- return Math.ceil(width * height * 4 * (4 / 3));
34
- }
35
- function panoramaTextureBudgetBytes(deviceMemoryGb) {
36
- const mib = deviceMemoryGb !== void 0 && deviceMemoryGb <= 2 ? 32 : deviceMemoryGb !== void 0 && deviceMemoryGb >= 8 ? 192 : 96;
37
- return mib * 1024 * 1024;
38
- }
39
- function browserPanoramaConstraints(maxTextureSize) {
40
- const nav = typeof navigator === "undefined" ? void 0 : navigator;
41
- return {
42
- saveData: nav?.connection?.saveData === true,
43
- maxTextureSize,
44
- maxDecodedBytes: panoramaTextureBudgetBytes(nav?.deviceMemory)
45
- };
46
- }
47
- function planPanoramaDelivery(source, constraints = {}) {
48
- const previewUrl = source.previewUrl?.trim();
49
- if (!previewUrl || previewUrl === source.url) {
50
- return {
51
- initialUrl: source.url,
52
- initialWidth: source.sourceWidth,
53
- initialHeight: source.sourceHeight,
54
- reason: "full-only"
55
- };
56
- }
57
- const initial = {
58
- initialUrl: previewUrl,
59
- initialWidth: source.previewWidth,
60
- initialHeight: source.previewHeight
61
- };
62
- if (constraints.saveData) return { ...initial, reason: "save-data" };
63
- if (constraints.maxTextureSize !== void 0 && source.sourceWidth !== void 0 && source.sourceHeight !== void 0 && Math.max(source.sourceWidth, source.sourceHeight) > constraints.maxTextureSize) {
64
- return { ...initial, reason: "texture-limit" };
65
- }
66
- if (constraints.maxDecodedBytes !== void 0 && source.sourceWidth !== void 0 && source.sourceHeight !== void 0 && estimatePanoramaTextureBytes(source.sourceWidth, source.sourceHeight) > constraints.maxDecodedBytes) {
67
- return { ...initial, reason: "memory-limit" };
68
- }
69
- return { ...initial, upgradeUrl: source.url, reason: "progressive" };
70
- }
71
- function abortError() {
72
- return new DOMException("Panorama image load aborted", "AbortError");
73
- }
74
- function loadPanoramaImage(url, signal) {
75
- return new Promise((resolve, reject) => {
76
- if (signal?.aborted) {
77
- reject(abortError());
78
- return;
79
- }
80
- const image = new Image();
81
- image.crossOrigin = "anonymous";
82
- let settled = false;
83
- const cleanup = () => {
84
- image.onload = null;
85
- image.onerror = null;
86
- signal?.removeEventListener("abort", onAbort);
87
- };
88
- const finish = (error) => {
89
- if (settled) return;
90
- settled = true;
91
- cleanup();
92
- if (error) reject(error);
93
- else resolve(image);
94
- };
95
- const onAbort = () => {
96
- image.src = "";
97
- finish(abortError());
98
- };
99
- image.onload = () => {
100
- const decoded = typeof image.decode === "function" ? image.decode() : Promise.resolve();
101
- void decoded.then(() => finish(), () => finish());
102
- };
103
- image.onerror = () => finish(new Error("panorama_image_failed"));
104
- signal?.addEventListener("abort", onAbort, { once: true });
105
- image.src = url;
106
- });
107
- }
108
- function schedulePanoramaUpgrade(work) {
109
- const host = globalThis;
110
- if (host.requestIdleCallback) {
111
- const id2 = host.requestIdleCallback(work, { timeout: 1200 });
112
- return () => host.cancelIdleCallback?.(id2);
113
- }
114
- const id = globalThis.setTimeout(work, 32);
115
- return () => globalThis.clearTimeout(id);
116
- }
117
- // Annotate the CommonJS export names for ESM import in node:
118
- 0 && (module.exports = {
119
- browserPanoramaConstraints,
120
- estimatePanoramaTextureBytes,
121
- loadPanoramaImage,
122
- panoramaTextureBudgetBytes,
123
- planPanoramaDelivery,
124
- schedulePanoramaUpgrade
125
- });
126
- //# sourceMappingURL=panoramaDelivery.cjs.map
1
+ "use strict";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(e,r)=>{for(var i in r)l(e,i,{get:r[i],enumerable:!0})},h=(e,r,i,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of f(r))!g.call(e,n)&&n!==i&&l(e,n,{get:()=>r[n],enumerable:!(t=v(r,n))||t.enumerable});return e};var x=e=>h(l({},"__esModule",{value:!0}),e);var T={};p(T,{browserPanoramaConstraints:()=>y,estimatePanoramaTextureBytes:()=>s,loadPanoramaImage:()=>P,panoramaTextureBudgetBytes:()=>c,planPanoramaDelivery:()=>D,schedulePanoramaUpgrade:()=>H});module.exports=x(T);function s(e,r){return!Number.isFinite(e)||!Number.isFinite(r)||e<=0||r<=0?0:Math.ceil(e*r*4*(4/3))}function c(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function y(e){let r=typeof navigator>"u"?void 0:navigator;return{saveData:r?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:c(r?.deviceMemory)}}function D(e,r={}){let i=e.previewUrl?.trim();if(!i||i===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let t={initialUrl:i,initialWidth:e.previewWidth,initialHeight:e.previewHeight};return r.saveData?{...t,reason:"save-data"}:r.maxTextureSize!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&Math.max(e.sourceWidth,e.sourceHeight)>r.maxTextureSize?{...t,reason:"texture-limit"}:r.maxDecodedBytes!==void 0&&e.sourceWidth!==void 0&&e.sourceHeight!==void 0&&s(e.sourceWidth,e.sourceHeight)>r.maxDecodedBytes?{...t,reason:"memory-limit"}:{...t,upgradeUrl:e.url,reason:"progressive"}}function m(){return new DOMException("Panorama image load aborted","AbortError")}function P(e,r){return new Promise((i,t)=>{if(r?.aborted){t(m());return}let n=new Image;n.crossOrigin="anonymous";let u=!1,b=()=>{n.onload=null,n.onerror=null,r?.removeEventListener("abort",d)},a=o=>{u||(u=!0,b(),o?t(o):i(n))},d=()=>{n.src="",a(m())};n.onload=()=>{(typeof n.decode=="function"?n.decode():Promise.resolve()).then(()=>a(),()=>a())},n.onerror=()=>a(new Error("panorama_image_failed")),r?.addEventListener("abort",d,{once:!0}),n.src=e})}function H(e){let r=globalThis;if(r.requestIdleCallback){let t=r.requestIdleCallback(e,{timeout:1200});return()=>r.cancelIdleCallback?.(t)}let i=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(i)}0&&(module.exports={browserPanoramaConstraints,estimatePanoramaTextureBytes,loadPanoramaImage,panoramaTextureBudgetBytes,planPanoramaDelivery,schedulePanoramaUpgrade});
@@ -1,17 +1 @@
1
- import {
2
- browserPanoramaConstraints,
3
- estimatePanoramaTextureBytes,
4
- loadPanoramaImage,
5
- panoramaTextureBudgetBytes,
6
- planPanoramaDelivery,
7
- schedulePanoramaUpgrade
8
- } from "../chunk-AZODENEL.js";
9
- export {
10
- browserPanoramaConstraints,
11
- estimatePanoramaTextureBytes,
12
- loadPanoramaImage,
13
- panoramaTextureBudgetBytes,
14
- planPanoramaDelivery,
15
- schedulePanoramaUpgrade
16
- };
17
- //# sourceMappingURL=panoramaDelivery.js.map
1
+ import{a,b,c,d,e,f}from"../chunk-IJI4WU57.js";export{c as browserPanoramaConstraints,a as estimatePanoramaTextureBytes,e as loadPanoramaImage,b as panoramaTextureBudgetBytes,d as planPanoramaDelivery,f as schedulePanoramaUpgrade};