@arenarium/maps 1.0.187 → 1.0.189
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/api.cjs.js +1 -1
- package/dist/api.d.ts +4 -4
- package/dist/api.es.js +58 -50
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -2
- package/dist/main.cjs.js +2 -2
- package/dist/main.es.js +1349 -1321
- package/dist/states-DJiLxlPa.js +412 -0
- package/dist/states-Dj48QyzN.cjs +1 -0
- package/package.json +6 -6
- package/dist/states-CqXqpk4z.js +0 -454
- package/dist/states-D6BEdwDG.cjs +0 -1
package/dist/api.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var E=Object.defineProperty;var v=(
|
|
1
|
+
"use strict";var E=Object.defineProperty;var v=(d,o,n)=>o in d?E(d,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):d[o]=n;var a=(d,o,n)=>v(d,typeof o!="symbol"?o+"":o,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./states-Dj48QyzN.cjs");class B{constructor(o,n,s){a(this,"x");a(this,"y");a(this,"width");a(this,"height");a(this,"zoom");a(this,"angles");a(this,"expanded");a(this,"angle");a(this,"bounds");const r=b.Mercator.project(n.lat,n.lng,o.mapSize);this.x=r.x,this.y=r.y,this.width=n.width+2*n.margin,this.height=n.height+2*n.margin,this.zoom=s[0],this.angles=s[1].map(c=>[c[0],b.Angles.DEGREES[c[1]]]),this.expanded=!1,this.angle=0,this.bounds=void 0}getBounds(o,n){let s=b.Rectangle.getOffsets(this.width,this.height,n),r=-s.x,c=this.width-r,u=-s.y,f=this.height-u;return{x:this.x,y:this.y,distances:{left:r/o,right:c/o,top:u/o,bottom:f/o}}}}function M(d,o,n){var f;if(o.length!=n.length)throw new Error("Data and states length must be the same");const s=new Array(o.length);for(let i=0;i<o.length;i++){const g=n[i];if(isNaN(g[0]))throw new Error("State zoom is not a number");if(g[1]==null||g[1].length==0)throw new Error("State angles is empty");if(g[0]!=g[1][0][0])throw new Error("State expand zoom and start angles zoom are not the same");const l=new B(d,o[i],n[i]);s[i]=l}const r=d.zoomMin,c=d.zoomMax,u=1/d.zoomScale;for(let i=r;i<=c;i+=u){const g=Math.pow(2,i);for(let l=0;l<s.length;l++){const t=s[l];if(t.expanded=t.zoom<i,t.expanded==!1)continue;const h=(f=t.angles.findLast(e=>e[0]<i))==null?void 0:f[1];if(h==null)throw new Error("Angle not found");t.angle=h,t.bounds=t.getBounds(g,h)}for(let l=0;l<s.length;l++){const t=s[l];if(t.bounds!=null)for(let h=l+1;h<s.length;h++){const e=s[h];if(e.bounds!=null&&b.Bounds.areOverlaping(t.bounds,e.bounds)){console.log("OVERLAP",i,t,o[l],e,o[h]);const m=t.bounds.x-t.bounds.distances.left,x=t.bounds.x+t.bounds.distances.right,w=t.bounds.y-t.bounds.distances.top,y=t.bounds.y+t.bounds.distances.bottom;console.log(`B1: (${m}, ${w}), (${m}, ${y}), (${x}, ${w}), (${x}, ${y}), (${t.bounds.x}, ${t.bounds.y})`,t.angle);const $=e.bounds.x-e.bounds.distances.left,z=e.bounds.x+e.bounds.distances.right,S=e.bounds.y-e.bounds.distances.top,p=e.bounds.y+e.bounds.distances.bottom;throw console.log(`B2: (${$}, ${S}), (${$}, ${p}), (${z}, ${S}), (${z}, ${p}), (${e.bounds.x}, ${e.bounds.y})`,e.angle),new Error("Bounds overlaping")}}}}}exports.getStates=b.getStates;exports.testStates=M;
|
package/dist/api.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
export declare function getStates(parameters:
|
|
4
|
-
|
|
5
|
-
declare type MapProviderParameters = z.infer<typeof mapProviderParametersSchema>;
|
|
3
|
+
export declare function getStates(parameters: MapTooltipStatesParameters, data: Array<MapTooltipStateInput>): MapTooltipState[];
|
|
6
4
|
|
|
7
5
|
declare const mapProviderParametersSchema: z.ZodObject<{
|
|
8
6
|
mapSize: z.ZodNumber;
|
|
@@ -53,6 +51,8 @@ declare const mapTooltipStateInputSchema: z.ZodObject<{
|
|
|
53
51
|
|
|
54
52
|
declare const mapTooltipStateSchema: z.ZodTuple<[z.ZodNumber, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">], null>;
|
|
55
53
|
|
|
54
|
+
export declare type MapTooltipStatesParameters = z.infer<typeof mapProviderParametersSchema>;
|
|
55
|
+
|
|
56
56
|
export declare type MapTooltipStatesRequest = z.infer<typeof mapTooltipStatesRequestSchema>;
|
|
57
57
|
|
|
58
58
|
declare const mapTooltipStatesRequestSchema: z.ZodObject<{
|
|
@@ -134,6 +134,6 @@ declare const mapTooltipStatesRequestSchema: z.ZodObject<{
|
|
|
134
134
|
}[];
|
|
135
135
|
}>;
|
|
136
136
|
|
|
137
|
-
export declare function testStates(parameters:
|
|
137
|
+
export declare function testStates(parameters: MapTooltipStatesParameters, inputs: MapTooltipStateInput[], states: MapTooltipState[]): void;
|
|
138
138
|
|
|
139
139
|
export { }
|
package/dist/api.es.js
CHANGED
|
@@ -1,67 +1,75 @@
|
|
|
1
1
|
var E = Object.defineProperty;
|
|
2
|
-
var S = (
|
|
3
|
-
var
|
|
4
|
-
import { B as v, M as B, A, R as M } from "./states-
|
|
5
|
-
import { g as G } from "./states-
|
|
2
|
+
var S = (d, t, n) => t in d ? E(d, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : d[t] = n;
|
|
3
|
+
var l = (d, t, n) => S(d, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { B as v, M as B, A, R as M } from "./states-DJiLxlPa.js";
|
|
5
|
+
import { g as G } from "./states-DJiLxlPa.js";
|
|
6
6
|
class R {
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
this.x =
|
|
7
|
+
constructor(t, n, e) {
|
|
8
|
+
l(this, "x");
|
|
9
|
+
l(this, "y");
|
|
10
|
+
l(this, "width");
|
|
11
|
+
l(this, "height");
|
|
12
|
+
l(this, "zoom");
|
|
13
|
+
l(this, "angles");
|
|
14
|
+
l(this, "expanded");
|
|
15
|
+
l(this, "angle");
|
|
16
|
+
l(this, "bounds");
|
|
17
|
+
const r = B.project(n.lat, n.lng, t.mapSize);
|
|
18
|
+
this.x = r.x, this.y = r.y, this.width = n.width + 2 * n.margin, this.height = n.height + 2 * n.margin, this.zoom = e[0], this.angles = e[1].map((c) => [c[0], A.DEGREES[c[1]]]), this.expanded = !1, this.angle = 0, this.bounds = void 0;
|
|
19
19
|
}
|
|
20
|
-
getBounds(
|
|
21
|
-
let
|
|
20
|
+
getBounds(t, n) {
|
|
21
|
+
let e = M.getOffsets(this.width, this.height, n), r = -e.x, c = this.width - r, b = -e.y, u = this.height - b;
|
|
22
22
|
return {
|
|
23
23
|
x: this.x,
|
|
24
24
|
y: this.y,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
distances: {
|
|
26
|
+
left: r / t,
|
|
27
|
+
right: c / t,
|
|
28
|
+
top: b / t,
|
|
29
|
+
bottom: u / t
|
|
30
|
+
}
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
function D(
|
|
33
|
-
var
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
for (let
|
|
37
|
-
const g = n[
|
|
34
|
+
function D(d, t, n) {
|
|
35
|
+
var u;
|
|
36
|
+
if (t.length != n.length) throw new Error("Data and states length must be the same");
|
|
37
|
+
const e = new Array(t.length);
|
|
38
|
+
for (let i = 0; i < t.length; i++) {
|
|
39
|
+
const g = n[i];
|
|
38
40
|
if (isNaN(g[0])) throw new Error("State zoom is not a number");
|
|
39
41
|
if (g[1] == null || g[1].length == 0) throw new Error("State angles is empty");
|
|
40
42
|
if (g[0] != g[1][0][0]) throw new Error("State expand zoom and start angles zoom are not the same");
|
|
41
|
-
const
|
|
42
|
-
i
|
|
43
|
+
const a = new R(d, t[i], n[i]);
|
|
44
|
+
e[i] = a;
|
|
43
45
|
}
|
|
44
|
-
const
|
|
45
|
-
for (let
|
|
46
|
-
const g = Math.pow(2,
|
|
47
|
-
for (let
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
|
|
46
|
+
const r = d.zoomMin, c = d.zoomMax, b = 1 / d.zoomScale;
|
|
47
|
+
for (let i = r; i <= c; i += b) {
|
|
48
|
+
const g = Math.pow(2, i);
|
|
49
|
+
for (let a = 0; a < e.length; a++) {
|
|
50
|
+
const o = e[a];
|
|
51
|
+
if (o.expanded = o.zoom < i, o.expanded == !1) continue;
|
|
52
|
+
const h = (u = o.angles.findLast((s) => s[0] < i)) == null ? void 0 : u[1];
|
|
53
|
+
if (h == null) throw new Error("Angle not found");
|
|
54
|
+
o.angle = h, o.bounds = o.getBounds(g, h);
|
|
53
55
|
}
|
|
54
|
-
for (let
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
for (let
|
|
58
|
-
const s =
|
|
59
|
-
if (s.bounds != null && v.areOverlaping(
|
|
60
|
-
console.log("OVERLAP",
|
|
61
|
-
const
|
|
62
|
-
console.log(
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
for (let a = 0; a < e.length; a++) {
|
|
57
|
+
const o = e[a];
|
|
58
|
+
if (o.bounds != null)
|
|
59
|
+
for (let h = a + 1; h < e.length; h++) {
|
|
60
|
+
const s = e[h];
|
|
61
|
+
if (s.bounds != null && v.areOverlaping(o.bounds, s.bounds)) {
|
|
62
|
+
console.log("OVERLAP", i, o, t[a], s, t[h]);
|
|
63
|
+
const f = o.bounds.x - o.bounds.distances.left, m = o.bounds.x + o.bounds.distances.right, x = o.bounds.y - o.bounds.distances.top, w = o.bounds.y + o.bounds.distances.bottom;
|
|
64
|
+
console.log(
|
|
65
|
+
`B1: (${f}, ${x}), (${f}, ${w}), (${m}, ${x}), (${m}, ${w}), (${o.bounds.x}, ${o.bounds.y})`,
|
|
66
|
+
o.angle
|
|
67
|
+
);
|
|
68
|
+
const $ = s.bounds.x - s.bounds.distances.left, y = s.bounds.x + s.bounds.distances.right, p = s.bounds.y - s.bounds.distances.top, z = s.bounds.y + s.bounds.distances.bottom;
|
|
69
|
+
throw console.log(
|
|
70
|
+
`B2: (${$}, ${p}), (${$}, ${z}), (${y}, ${p}), (${y}, ${z}), (${s.bounds.x}, ${s.bounds.y})`,
|
|
71
|
+
s.angle
|
|
72
|
+
), new Error("Bounds overlaping");
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -344,7 +344,7 @@ declare const mapProviderSchema: z.ZodObject<{
|
|
|
344
344
|
export type MapBounds = z.infer<typeof mapBoundsSchema>;
|
|
345
345
|
export type MapProvider = z.infer<typeof mapProviderSchema>;
|
|
346
346
|
export type MapProviderMarker = z.infer<typeof mapProviderMarkerSchema>;
|
|
347
|
-
|
|
347
|
+
type MapProviderParameters = z.infer<typeof mapProviderParametersSchema>;
|
|
348
348
|
declare const mapMarkerSchema: z.ZodObject<{
|
|
349
349
|
id: z.ZodString;
|
|
350
350
|
rank: z.ZodNumber;
|
|
@@ -785,6 +785,10 @@ export declare const GoogleMapDarkStyle: ({
|
|
|
785
785
|
export declare function getStates(parameters: MapProviderParameters, data: Array<MapTooltipStateInput>): MapTooltipState[];
|
|
786
786
|
export declare function testStates(parameters: MapProviderParameters, inputs: MapTooltipStateInput[], states: MapTooltipState[]): void;
|
|
787
787
|
|
|
788
|
+
export {
|
|
789
|
+
MapProviderParameters as MapTooltipStatesParameters,
|
|
790
|
+
};
|
|
791
|
+
|
|
788
792
|
export as namespace arenarium;
|
|
789
793
|
|
|
790
794
|
export {};
|