maplibre-gl-nightlayer 1.0.0-alpha.8 → 1.0.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 CHANGED
@@ -3,13 +3,14 @@
3
3
  Adds a simple night shadow (Earth's shadow) on the map.
4
4
  ![image](https://github.com/user-attachments/assets/425f58e0-66f6-4779-8c03-ff543972c59e)
5
5
 
6
- ## Install
6
+ ## Demo
7
+ [example](https://kikuchan.github.io/maplibre-gl-nightlayer/)
8
+
9
+ ## Usage
10
+ ### Module
7
11
  ```sh
8
12
  $ npm install --save-dev maplibre-gl-nightlayer
9
13
  ```
10
-
11
- ## Usage
12
-
13
14
  ```js
14
15
  import { NightLayer } from 'maplibre-gl-nightlayer';
15
16
 
@@ -20,25 +21,44 @@ map.on('load', () => {
20
21
  // These are the default values
21
22
  date: null,
22
23
  opacity: 0.5,
23
- color: [0, 0, 0],
24
+ color: [0, 0, 0, 255],
25
+ daytimeColor: [0, 0, 0, 0],
24
26
  twilightSteps: 0,
25
- twilightStepAngle: 6,
26
27
  twilightAttenuation: 0.5,
28
+ updateInterval: 10000,
29
+ }));
30
+ });
31
+ ```
32
+
33
+ ### via CDN
34
+
35
+ Load MapLibre GL JS first so that `maplibregl` is available globally.
36
+
37
+ ```html
38
+ <script src="https://unpkg.com/maplibre-gl-nightlayer@latest/dist/nightlayer.min.js"></script>
39
+ ```
40
+ ```js
41
+ map.on('load', () => {
42
+ map.addLayer(new nightLayer.NightLayer({
43
+ :
27
44
  }));
28
45
  });
29
46
  ```
30
47
 
31
48
  ## API
32
49
  ```ts
33
- type Color = [number, number, number];
50
+ type Color3 = [number, number, number];
51
+ type Color4 = [number, number, number, number];
52
+ type Color = Color3 | Color4;
34
53
 
35
54
  type Options = {
36
55
  date?: Date | null;
37
56
  opacity?: number;
38
57
  color?: Color;
58
+ daytimeColor?: Color;
39
59
  twilightSteps?: number;
40
- twilightStepAngle?: number;
41
60
  twilightAttenuation?: number;
61
+ updateInterval?: number;
42
62
  };
43
63
 
44
64
  export class NightLayer implements CustomLayerInterface {
@@ -55,22 +75,25 @@ export class NightLayer implements CustomLayerInterface {
55
75
  getOpacity(): number;
56
76
  setOpacity(opacity: number): void;
57
77
 
58
- getColor(): Color;
78
+ getColor(): Color4;
59
79
  setColor(color: Color): void;
60
80
 
81
+ getDaytimeColor(): Color4;
82
+ setDaytimeColor(color: Color): void;
83
+
61
84
  getTwilightSteps(): number;
62
85
  setTwilightSteps(steps: number): void;
63
86
 
64
- getTwilightStepAngle(): number;
65
- setTwilightStepAngle(angle: number): void;
66
-
67
87
  getTwilightAttenuation(): number;
68
88
  setTwilightAttenuation(attenuation: number): void;
69
89
 
90
+ getUpdateInterval(): number;
91
+ setUpdateInterval(interval: number): void;
92
+
70
93
  :
71
94
  };
72
95
 
73
- export function getSubsolarPoint(date?: Date): {
96
+ export function getSubsolarPoint(date?: Date | null): {
74
97
  lng: number;
75
98
  lat: number;
76
99
  };
package/dist/main.d.ts CHANGED
@@ -1,133 +1,157 @@
1
- import type { CustomLayerInterface, CustomRenderMethodInput, Map as MaplibreMap } from 'maplibre-gl';
2
- import type { mat4 } from 'gl-matrix';
1
+ import { CustomLayerInterface, CustomRenderMethodInput, Map } from "maplibre-gl";
2
+ //#region src/main.d.ts
3
3
  /**
4
4
  * Get the subsolar point (longitude and latitude) at the given date.
5
5
  * @param date If null, the current date is used.
6
6
  * @returns The subsolar point.
7
7
  */
8
- export declare function getSubsolarPoint(date?: Date): {
9
- lng: number;
10
- lat: number;
8
+ export declare function getSubsolarPoint(date?: Date | null): {
9
+ lng: number;
10
+ lat: number;
11
11
  };
12
- type Color = [number, number, number];
12
+ type Color3 = [number, number, number];
13
+ type Color4 = [number, number, number, number];
14
+ type Color = Color3 | Color4;
13
15
  /**
14
16
  * Options for the NightLayer.
15
17
  */
16
18
  type Options = {
17
- /**
18
- * Date for the shadow.
19
- * If null, the current date is used.
20
- */
21
- date?: Date | null;
22
- /**
23
- * Opacity of the shadow.
24
- * 0.0 means fully transparent, 1.0 means fully opaque
25
- */
26
- opacity?: number;
27
- /**
28
- * Color of the shadow.
29
- * Each value should be in the range [0, 255].
30
- */
31
- color?: Color;
32
- /**
33
- * Number of twilight steps.
34
- * 0 means no steps (gradation), 1 means one step (day/night), etc.
35
- */
36
- twilightSteps?: number;
37
- /**
38
- * Angle for each twilight step in degrees.
39
- */
40
- twilightStepAngle?: number;
41
- /**
42
- * Attenuation factor for each twilight step.
43
- * 0.0 means no attenuation, 1.0 means full attenuation
44
- */
45
- twilightAttenuation?: number;
19
+ /**
20
+ * Date for the shadow.
21
+ * If null, the current date is used.
22
+ */
23
+ date?: Date | null;
24
+ /**
25
+ * Opacity of the layer.
26
+ * 0.0 means fully transparent, 1.0 means fully opaque
27
+ * default: 0.5
28
+ */
29
+ opacity?: number;
30
+ /**
31
+ * Color of the shadow: [r, g, b, a]
32
+ * Each value should be in the range [0, 255].
33
+ * default: [0, 0, 0, 255]
34
+ */
35
+ color?: Color;
36
+ /**
37
+ * Color of the daytime: [r, g, b, a]
38
+ * Each value should be in the range [0, 255].
39
+ * default: [0, 0, 0, 0]
40
+ */
41
+ daytimeColor?: Color;
42
+ /**
43
+ * Number of twilight steps.
44
+ * 0 means no steps (gradation), 1 means one step (day/night), etc.
45
+ * default: 0
46
+ */
47
+ twilightSteps?: number;
48
+ /**
49
+ * Attenuation factor for each twilight step.
50
+ * 0.0 means no attenuation, 1.0 means full attenuation
51
+ * default: 0.5
52
+ */
53
+ twilightAttenuation?: number;
54
+ /**
55
+ * Update interval in milliseconds.
56
+ * Periodically triggers a repaint.
57
+ * default: 10000
58
+ */
59
+ updateInterval?: number;
46
60
  };
47
61
  /**
48
62
  * A custom Maplibre GL JS layer that renders the night side of the Earth.
49
63
  */
50
64
  export declare class NightLayer implements CustomLayerInterface {
51
- #private;
52
- id: string;
53
- type: "custom";
54
- renderingMode: "2d";
55
- /**
56
- * Create a new NightLayer instance. Intended to be passed to `map.addLayer`.
57
- * @param opts The options.
58
- */
59
- constructor(opts?: Options);
60
- /**
61
- * Get the current subsolar point (longitude and latitude)
62
- * @returns The subsolar point.
63
- */
64
- getSubsolarPoint(): {
65
- lng: number;
66
- lat: number;
67
- };
68
- /**
69
- * Get the date for the shadow.
70
- * @returns The date. If null, the current date is used.
71
- */
72
- getDate(): Date | null;
73
- /**
74
- * Set the date for the shadow.
75
- * @param date If null, the current date is used.
76
- */
77
- setDate(date: Date | null): void;
78
- /**
79
- * Get the opacity of the shadow.
80
- * @returns The opacity. 0.0 means fully transparent, 1.0 means fully opaque.
81
- */
82
- getOpacity(): number;
83
- /**
84
- * Set the opacity of the shadow.
85
- * @param opacity 0.0 means fully transparent, 1.0 means fully opaque.
86
- */
87
- setOpacity(opacity: number): void;
88
- /**
89
- * Get the color of the shadow.
90
- * @returns The color. Each value is in the range [0, 255].
91
- */
92
- getColor(): Color;
93
- /**
94
- * Set the color of the shadow.
95
- * @param color Each value should be in the range [0, 255].
96
- */
97
- setColor(color: Color): void;
98
- /**
99
- * Get the number of twilight steps.
100
- * @returns The steps. 0 means no steps (gradation), 1 means one step (day/night), etc.
101
- */
102
- getTwilightSteps(): number;
103
- /**
104
- * Set the number of twilight steps.
105
- * @param steps 0 means no steps (gradation), 1 means one step (day/night), etc.
106
- */
107
- setTwilightSteps(steps: number): void;
108
- /**
109
- * Get the angle for each twilight step.
110
- * @returns The angle in degrees.
111
- */
112
- getTwilightStepAngle(): number;
113
- /**
114
- * Set the angle for each twilight step.
115
- * @param angle in degrees.
116
- */
117
- setTwilightStepAngle(angle: number): void;
118
- /**
119
- * Get the attenuation factor for each twilight step.
120
- * @returns The attenuation. 0.0 means no attenuation, 1.0 means full attenuation.
121
- */
122
- getTwilightAttenuation(): number;
123
- /**
124
- * Set the attenuation factor for each twilight step.
125
- * @param attenuation 0.0 means no attenuation, 1.0 means full attenuation.
126
- */
127
- setTwilightAttenuation(attenuation: number): void;
128
- onAdd(map: MaplibreMap, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
129
- onRemove(): void;
130
- render(gl: WebGLRenderingContext | WebGL2RenderingContext, matrix: mat4, options: CustomRenderMethodInput): void;
131
- render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
65
+ #private;
66
+ id: string;
67
+ type: "custom";
68
+ renderingMode: "2d";
69
+ /**
70
+ * Create a new NightLayer instance. Intended to be passed to `map.addLayer`.
71
+ * @param opts The options.
72
+ */
73
+ constructor(opts?: Options);
74
+ /**
75
+ * Get the current subsolar point (longitude and latitude)
76
+ * @returns The subsolar point.
77
+ */
78
+ getSubsolarPoint(): {
79
+ lng: number;
80
+ lat: number;
81
+ };
82
+ /**
83
+ * Get the date for the shadow.
84
+ * @returns The date. If null, the current date is used.
85
+ */
86
+ getDate(): Date | null;
87
+ /**
88
+ * Set the date for the shadow.
89
+ * @param date If null, the current date is used.
90
+ */
91
+ setDate(date: Date | null): void;
92
+ /**
93
+ * Get the opacity of the shadow.
94
+ * @returns The opacity. 0.0 means fully transparent, 1.0 means fully opaque.
95
+ */
96
+ getOpacity(): number;
97
+ /**
98
+ * Set the opacity of the shadow.
99
+ * @param opacity 0.0 means fully transparent, 1.0 means fully opaque.
100
+ */
101
+ setOpacity(opacity: number): void;
102
+ /**
103
+ * Get the color of the shadow.
104
+ * @returns The color. Each value is in the range [0, 255].
105
+ */
106
+ getColor(): Color4;
107
+ /**
108
+ * Set the color of the shadow.
109
+ * @param color Each value should be in the range [0, 255].
110
+ */
111
+ setColor(color: Color): void;
112
+ /**
113
+ * Get the color of the daytime.
114
+ * @returns The color [r, g, b, a]. Each value is in the range [0, 255].
115
+ */
116
+ getDaytimeColor(): Color4;
117
+ /**
118
+ * Set the color of the daytime.
119
+ * @param color Each value should be in the range [0, 255].
120
+ */
121
+ setDaytimeColor(color: Color): void;
122
+ /**
123
+ * Get the number of twilight steps.
124
+ * @returns The steps. 0 means no steps (gradation), 1 means one step (day/night), etc.
125
+ */
126
+ getTwilightSteps(): number;
127
+ /**
128
+ * Set the number of twilight steps.
129
+ * @param steps 0 means no steps (gradation), 1 means one step (day/night), etc.
130
+ */
131
+ setTwilightSteps(steps: number): void;
132
+ /**
133
+ * Get the attenuation factor for each twilight step.
134
+ * @returns The attenuation. 0.0 means no attenuation, 1.0 means full attenuation.
135
+ */
136
+ getTwilightAttenuation(): number;
137
+ /**
138
+ * Set the attenuation factor for each twilight step.
139
+ * @param attenuation 0.0 means no attenuation, 1.0 means full attenuation.
140
+ */
141
+ setTwilightAttenuation(attenuation: number): void;
142
+ /**
143
+ * Get the update interval.
144
+ * @returns The interval in milliseconds.
145
+ */
146
+ getUpdateInterval(): number;
147
+ /**
148
+ * Set the update interval.
149
+ * @param interval The interval in milliseconds..
150
+ */
151
+ setUpdateInterval(interval: number): void;
152
+ onAdd(map: Map, _gl: WebGLRenderingContext | WebGL2RenderingContext): void;
153
+ onRemove(_map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
154
+ render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
132
155
  }
133
- export default NightLayer;
156
+ //#endregion
157
+ export { NightLayer as default };
package/dist/main.js CHANGED
@@ -1,68 +1,81 @@
1
- "use strict";import{MercatorCoordinate as f,createTileMesh as m}from"maplibre-gl";function p(o){return o*Math.PI/180}function d(o){return o/Math.PI*180}export function getSubsolarPoint(o){o=o||new Date;const t=(o.getTime()-Date.UTC(o.getUTCFullYear(),0,0))/864e5,r=2*Math.PI/365.24,u=p(23.44),s=.0167,n=(t+9)*r,e=n+2*s*Math.sin((t-3)*r),i=(n-Math.atan2(Math.sin(e),Math.cos(e)*Math.cos(u)))/Math.PI,a=720*(i-Math.trunc(i+.5)),h=-15*(o.getUTCHours()+o.getUTCMinutes()/60+o.getUTCSeconds()/3600-12+a/60),l=d(Math.asin(Math.sin(-u)*Math.cos(e)));return{lng:h,lat:l}}export class NightLayer{id="nightlayer";type="custom";renderingMode="2d";#n;#o;#a;#s;#u;#h;#e;#t;#i;#r;#c;#f;constructor(t={}){this.#n=t.date??null,this.#o=t.opacity??.5,this.#a=t.color??[0,0,0],this.#s=t.twilightSteps??0,this.#u=t.twilightStepAngle??6,this.#h=t.twilightAttenuation??.5}getSubsolarPoint(){return getSubsolarPoint(this.#n||new Date)}getDate(){return this.#n}setDate(t){this.#n=t,this.#t?.triggerRepaint()}getOpacity(){return this.#o}setOpacity(t){this.#o=t,this.#t?.triggerRepaint()}getColor(){return this.#a}setColor(t){this.#a=t,this.#t?.triggerRepaint()}getTwilightSteps(){return this.#s}setTwilightSteps(t){this.#s=t,this.#t?.triggerRepaint()}getTwilightStepAngle(){return this.#u}setTwilightStepAngle(t){this.#u=t,this.#t?.triggerRepaint()}getTwilightAttenuation(){return this.#h}setTwilightAttenuation(t){this.#h=t,this.#t?.triggerRepaint()}onAdd(t,r){this.#e=new Map,this.#i=r.createBuffer(),this.#r=r.createBuffer(),this.#t=t}onRemove(){this.#e=void 0,this.#t=void 0,this.#i=void 0,this.#r=void 0}#l(t,r){const s=`#version 300 es
1
+ import{createTileMesh as e}from"maplibre-gl";const t=Array.from({length:15},(e,t)=>Math.sin(n(t===0?-.8333333:-6*t)));function n(e){return e*Math.PI/180}function r(e){return e/Math.PI*180}function i(e){let[t,n,r,i]=e.map(e=>e/255);return[t*i,n*i,r*i,i]}function a(e){if(e??=/* @__PURE__ */ new Date,!Number.isFinite(e.getTime()))throw RangeError(`Invalid date`);let t=e.getUTCFullYear(),i=e.getUTCMonth(),a=+(i>1&&t%4==0&&(t%100!=0||t%400==0)),o=[0,31,59,90,120,151,181,212,243,273,304,334][i]+e.getUTCDate()+a,s=e.getUTCHours()+e.getUTCMinutes()/60+e.getUTCSeconds()/3600+e.getUTCMilliseconds()/36e5,c=o+s/24,l=2*Math.PI/365.24,u=n(23.44),d=(c+9)*l,f=d+.0334*Math.sin((c-3)*l),p=(d-Math.atan2(Math.sin(f),Math.cos(f)*Math.cos(u)))/Math.PI,m=720*(p-Math.trunc(p+.5));return{lng:-15*(s-12+m/60),lat:r(Math.asin(Math.sin(-u)*Math.cos(f)))}}var o=class{id=`nightlayer`;type=`custom`;renderingMode=`2d`;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e={}){this.#t=e.opacity??.5,this.#o=e.twilightSteps??0,this.#s=e.twilightAttenuation??.5,this.#a=e.updateInterval??1e4,this.setColor(e.color??[0,0,0,255]),this.setDaytimeColor(e.daytimeColor??[0,0,0,0]),this.setDate(e.date??null)}#d(){let e=this.#u!==void 0&&this.#e===null;this.#i&&=(clearInterval(this.#i),void 0),e&&this.#a>0&&(this.#i=setInterval(()=>this.#u?.triggerRepaint(),this.#a))}getSubsolarPoint(){return a(this.#e)}getDate(){return this.#e?new Date(this.#e.getTime()):null}setDate(e){if(e!==null&&!Number.isFinite(e.getTime()))throw RangeError(`Invalid date`);this.#e=e===null?null:new Date(e.getTime()),this.#d(),this.#u?.triggerRepaint()}getOpacity(){return this.#t}setOpacity(e){this.#t=e,this.#u?.triggerRepaint()}getColor(){return this.#n}setColor(e){this.#n=[...e.slice(0,3),e?.[3]??255],this.#u?.triggerRepaint()}getDaytimeColor(){return this.#r}setDaytimeColor(e){this.#r=[...e.slice(0,3),e?.[3]??255],this.#u?.triggerRepaint()}getTwilightSteps(){return this.#o}setTwilightSteps(e){this.#o=e,this.#u?.triggerRepaint()}getTwilightAttenuation(){return this.#s}setTwilightAttenuation(e){this.#s=e,this.#u?.triggerRepaint()}getUpdateInterval(){return this.#a}setUpdateInterval(e){this.#a=e,this.#d()}onAdd(e,t){this.#c=/* @__PURE__ */ new Map,this.#l=/* @__PURE__ */ new Map,this.#u=e,this.#d()}onRemove(e,t){if(this.#i!==void 0&&(clearInterval(this.#i),this.#i=void 0),this.#c)for(let e of this.#c.values())t.deleteProgram(e);if(this.#l)for(let e of this.#l.values())t.deleteBuffer(e.vertices),t.deleteBuffer(e.indices);this.#c=void 0,this.#l=void 0,this.#u=void 0}#f(e,t){let r=`#version 300 es
2
2
  precision highp float;
3
3
 
4
4
  in vec2 a_position;
5
5
  out vec2 v_position;
6
+ out float v_pole;
6
7
 
7
- ${!r.vertexShaderPrelude?`
8
- uniform mat4 u_matrix;
9
-
10
- vec4 projectTile(vec2 pos) {
11
- return u_matrix * vec4(pos, 0., 1.);
12
- }
13
- `:`
14
- ${r.vertexShaderPrelude}
15
- ${r.define}
16
- `}
8
+ ${t.vertexShaderPrelude}
9
+ ${t.define}
17
10
 
18
11
  void main() {
19
- gl_Position = projectTile(a_position);
20
- v_position = a_position;
12
+ gl_Position = projectTile(a_position, a_position);
13
+ v_position = vec2(a_position.x, clamp(a_position.y, 0.0, 8192.0)) / 8192.0 - 0.5;
14
+ v_pole = a_position.y < -32767.5 ? 1.0 : (a_position.y > 32766.5 ? -1.0 : 0.0);
21
15
  }
22
- `,n=`#version 300 es
16
+ `,i=`#version 300 es
23
17
  precision highp float;
24
18
 
25
19
  in vec2 v_position;
20
+ in float v_pole;
26
21
  out vec4 fragColor;
27
22
 
28
- uniform vec2 u_subsolar;
23
+ uniform vec4 u_tile; // exp(mercator latitude), sin(latitude), cos(latitude), tile size
24
+ uniform vec3 u_sun; // sin(solar latitude), cos(solar latitude) * cos/sin(relative longitude)
25
+ uniform float u_center_height;
26
+ uniform float u_thresholds[15];
29
27
  uniform float u_opacity;
30
- uniform float u_twilight_step_angle;
31
28
  uniform float u_twilight_steps;
32
29
  uniform float u_twilight_attenuation;
33
- uniform vec3 u_color;
34
-
35
- vec2 mercatorToLngLat(vec2 mercator) {
36
- // 0 <= x <= 1, 0 <= y <= 1
37
- float x = mercator.x;
38
- float y = mercator.y;
30
+ uniform vec4 u_daytime_color;
31
+ uniform vec4 u_night_color;
39
32
 
40
- float lng = x * 360.0 - 180.0;
41
- float lat = degrees(2.0 * atan(exp(${Math.PI} * (1.0 - 2.0 * y))) - ${Math.PI/2});
42
-
43
- return vec2(lng, lat);
33
+ float expMinusOne(float x) {
34
+ if (abs(x) < 0.001) return x * (1.0 + x * (0.5 + x * (1.0 / 6.0 + x / 24.0)));
35
+ return exp(x) - 1.0;
44
36
  }
45
37
 
46
38
  void main() {
47
- vec2 lnglat = mercatorToLngLat(v_position);
39
+ // Work with small tile-local differences, not rounded global coordinates.
40
+ float longitudeDelta = v_position.x * u_tile.w * ${2*Math.PI};
41
+ float e = expMinusOne(-v_position.y * u_tile.w * ${2*Math.PI});
42
+ float t = u_tile.x;
43
+ float denominator = t * t + 1.0;
44
+ float deltaSquared = t * t * e * (2.0 + e);
45
+ float product = denominator * (denominator + deltaSquared);
46
+ float sinDelta = 2.0 * deltaSquared / product;
47
+ float cosDelta = 2.0 * t * (e * denominator - deltaSquared) / product;
48
+
49
+ float poleAngle = v_pole * ${n(4.948871220193396)};
50
+ float poleCosDelta = -2.0 * pow(sin(poleAngle * 0.5), 2.0);
51
+ float poleSin = sin(poleAngle);
52
+ float latitudeSin = u_tile.y + sinDelta;
53
+ float latitudeCos = u_tile.z + cosDelta;
54
+ sinDelta += latitudeSin * poleCosDelta + latitudeCos * poleSin;
55
+ cosDelta += latitudeCos * poleCosDelta - latitudeSin * poleSin;
56
+ latitudeCos = u_tile.z + cosDelta;
48
57
 
49
- vec2 observer = radians(lnglat);
50
- vec2 subsolar = radians(u_subsolar);
51
- float A = sin(observer.y) * sin(subsolar.y);
52
- float B = cos(observer.y) * cos(subsolar.y) * cos(subsolar.x - observer.x);
53
- float altitude = degrees(asin(A + B));
54
- float twilightStepAngle = u_twilight_step_angle;
58
+ float longitudeCosDelta = -2.0 * pow(sin(longitudeDelta * 0.5), 2.0);
59
+ float heightDelta = u_sun.x * sinDelta + u_sun.y * cosDelta
60
+ + latitudeCos * (u_sun.y * longitudeCosDelta + u_sun.z * sin(longitudeDelta));
61
+ float twilightStepAngle = 6.0;
55
62
  float twilightSteps = u_twilight_steps;
56
63
 
57
64
  // Attenuation for each twilightStepAngle
58
65
  float att = u_twilight_attenuation;
59
- float twilightLevel = -altitude / twilightStepAngle;
66
+ float twilightLevel;
60
67
  if (twilightSteps > 0.) {
61
- twilightLevel = ceil(clamp(twilightLevel, 0., twilightSteps));
68
+ // Threshold residuals are computed in float64 on the CPU before upload.
69
+ twilightLevel = 1.0;
70
+ for (int i = 1; i < 15; i++) {
71
+ if (u_thresholds[i] + heightDelta < 0.0) twilightLevel += 1.0;
72
+ }
73
+ twilightLevel = ceil(min(twilightLevel, twilightSteps));
74
+ if (u_thresholds[0] + heightDelta > 0.0) twilightLevel = 0.0;
75
+ } else {
76
+ float altitude = degrees(asin(clamp(u_center_height + heightDelta, -1.0, 1.0)));
77
+ twilightLevel = -altitude / twilightStepAngle;
62
78
  }
63
79
  float brightness = clamp(pow(clamp(1. - att, 0., 1.), twilightLevel), 0., 1.);
64
- float darkness = (1. - brightness);
65
-
66
- fragColor = vec4(v_position, 0.0, 1.0);
67
- fragColor = vec4(u_color / 255., 1.0) * darkness * u_opacity;
68
- }`,e=t.createShader(t.VERTEX_SHADER);if(!e)throw new Error("failed to create vertex shader");t.shaderSource(e,s),t.compileShader(e);const i=t.createShader(t.FRAGMENT_SHADER);if(!i)throw new Error("failed to create fragment shader");t.shaderSource(i,n),t.compileShader(i);const a=t.createProgram();if(!a)throw new Error("failed to create program");return t.attachShader(a,e),t.attachShader(a,i),t.linkProgram(a),a}#m(t){if(!this.#t||!this.#i||!this.#r)return;const[r,u]=this.#t.getBounds().toArray(),s=Math.floor(f.fromLngLat(r).x),n=Math.ceil(f.fromLngLat(u).x),e=this.#t.style?.projection?.name==="globe"?"globe":[s,n].join(":");if(e===this.#f)return;let i;e==="globe"?(i=m({granularity:100,generateBorders:!1,extendToNorthPole:!0,extendToSouthPole:!0},"16bit"),i.vertices=new Float32Array(new Int16Array(i.vertices)).map(a=>a/8192).buffer):i={vertices:new Float32Array([s,0,n,0,s,1,s,1,n,0,n,1]).buffer,indices:new Uint16Array([0,1,2,3,4,5]).buffer,uses32bitIndices:!1},t.bindBuffer(t.ARRAY_BUFFER,this.#i),t.bufferData(t.ARRAY_BUFFER,i.vertices,t.DYNAMIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.#r),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i.indices,t.DYNAMIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),this.#c=i.indices.byteLength/2,this.#f=e}render(t,r,u){if(u||(u=r),!this.#e||!this.#i||!this.#r||!this.#t)return;const s=u.shaderData||{},n=s.variantName||"default";this.#e.has(n)||this.#e.set(n,this.#l(t,s));const e=this.#e.get(n);if(!e)return;const{lng:i,lat:a}=this.getSubsolarPoint();if(t.useProgram(e),t.uniform2fv(t.getUniformLocation(e,"u_subsolar"),[i,a]),t.uniform1f(t.getUniformLocation(e,"u_opacity"),this.#o),t.uniform3fv(t.getUniformLocation(e,"u_color"),this.#a),t.uniform1f(t.getUniformLocation(e,"u_twilight_steps"),this.#s),t.uniform1f(t.getUniformLocation(e,"u_twilight_step_angle"),this.#u),t.uniform1f(t.getUniformLocation(e,"u_twilight_attenuation"),this.#h),"getProjectionDataForCustomLayer"in this.#t.transform){const h=this.#t.transform.getProjectionDataForCustomLayer(!0);t.uniformMatrix4fv(t.getUniformLocation(e,"u_projection_fallback_matrix"),!1,h.fallbackMatrix),t.uniformMatrix4fv(t.getUniformLocation(e,"u_projection_matrix"),!1,h.mainMatrix),t.uniform4f(t.getUniformLocation(e,"u_projection_tile_mercator_coords"),...h.tileMercatorCoords),t.uniform4f(t.getUniformLocation(e,"u_projection_clipping_plane"),...h.clippingPlane),t.uniform1f(t.getUniformLocation(e,"u_projection_transition"),h.projectionTransition)}else t.uniformMatrix4fv(t.getUniformLocation(e,"u_matrix"),!1,r);this.#m(t),t.bindBuffer(t.ARRAY_BUFFER,this.#i),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.#r);const c=t.getAttribLocation(e,"a_position");t.enableVertexAttribArray(c),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.drawElements(t.TRIANGLES,this.#c,t.UNSIGNED_SHORT,0)}}export default NightLayer;
80
+ fragColor = mix(u_night_color, u_daytime_color, brightness) * u_opacity;
81
+ }`,a=e.createShader(e.VERTEX_SHADER);if(!a)throw Error(`failed to create vertex shader`);let o=e.createShader(e.FRAGMENT_SHADER);if(!o)throw e.deleteShader(a),Error(`failed to create fragment shader`);let s=null;try{if(e.shaderSource(a,r),e.compileShader(a),e.shaderSource(o,i),e.compileShader(o),s=e.createProgram(),!s)throw Error(`failed to create program`);if(e.attachShader(s,a),e.attachShader(s,o),e.linkProgram(s),!e.getProgramParameter(s,e.LINK_STATUS))throw Error(e.getProgramInfoLog(s)||`failed to link program`);return s}catch(t){throw s&&e.deleteProgram(s),s=null,t}finally{s&&(e.detachShader(s,a),e.detachShader(s,o)),e.deleteShader(a),e.deleteShader(o)}}#p(t,n,r,i){let a=`${n}:${r}:${i}`,o=this.#l.get(a);if(o)return o;let s=e({granularity:n,generateBorders:!1,extendToNorthPole:r,extendToSouthPole:i},`16bit`),c=t.createBuffer(),l=t.createBuffer();if(!c||!l)throw c&&t.deleteBuffer(c),l&&t.deleteBuffer(l),Error(`failed to create tile mesh buffers`);t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,s.vertices,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,l),t.bufferData(t.ELEMENT_ARRAY_BUFFER,s.indices,t.STATIC_DRAW);let u={vertices:c,indices:l,count:s.indices.byteLength/2};return this.#l.set(a,u),u}render(e,r){if(!this.#c||!this.#l||!this.#u)return;let a=r.shaderData,o=a.variantName;this.#c.has(o)||this.#c.set(o,this.#f(e,a));let s=this.#c.get(o);if(!s)return;let{lng:c,lat:l}=this.getSubsolarPoint(),u=n(c),d=n(l),f=Math.sin(d),p=Math.cos(d);e.useProgram(s),e.uniform1f(e.getUniformLocation(s,`u_opacity`),this.#t),e.uniform4fv(e.getUniformLocation(s,`u_night_color`),i(this.#n)),e.uniform4fv(e.getUniformLocation(s,`u_daytime_color`),i(this.#r)),e.uniform1f(e.getUniformLocation(s,`u_twilight_steps`),this.#o),e.uniform1f(e.getUniformLocation(s,`u_twilight_attenuation`),this.#s);let m=r.defaultProjectionData.projectionTransition>0,h=this.#u.coveringTiles({tileSize:256});e.disable(e.SCISSOR_TEST),e.disable(e.DEPTH_TEST),e.disable(e.STENCIL_TEST),e.enable(e.CULL_FACE),e.frontFace(e.CCW),e.cullFace(e.BACK),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);for(let i of h){let{x:a,y:o,z:c}=i.canonical,l=2**-c,d=r.getProjectionData({tileID:{canonical:{x:a,y:o,z:c},wrap:i.wrap},applyGlobeMatrix:!0});e.uniformMatrix4fv(e.getUniformLocation(s,`u_projection_matrix`),!1,d.mainMatrix),e.uniformMatrix4fv(e.getUniformLocation(s,`u_projection_fallback_matrix`),!1,d.fallbackMatrix),e.uniform4fv(e.getUniformLocation(s,`u_projection_tile_mercator_coords`),d.tileMercatorCoords),e.uniform4fv(e.getUniformLocation(s,`u_projection_clipping_plane`),d.clippingPlane),e.uniform1f(e.getUniformLocation(s,`u_projection_transition`),d.projectionTransition);let h=Math.exp(Math.PI*(1-2*(o+.5)*l)),g=(h*h-1)/(h*h+1),_=2*h/(h*h+1),v=u-n((a+.5)*l*360-180),y=[f,p*Math.cos(v),p*Math.sin(v)],b=y[0]*g+y[1]*_,x=t.map(e=>b-e);e.uniform4fv(e.getUniformLocation(s,`u_tile`),[h,g,_,l]),e.uniform3fv(e.getUniformLocation(s,`u_sun`),y),e.uniform1f(e.getUniformLocation(s,`u_center_height`),b),e.uniform1fv(e.getUniformLocation(s,`u_thresholds[0]`),x);let S=m?Math.max(Math.floor(128*l),32):1,C=this.#p(e,S,m&&o===0,m&&o===2**c-1);e.bindBuffer(e.ARRAY_BUFFER,C.vertices),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.indices);let w=e.getAttribLocation(s,`a_position`);e.enableVertexAttribArray(w),e.vertexAttribPointer(w,2,e.SHORT,!1,0,0),e.drawElements(e.TRIANGLES,C.count,e.UNSIGNED_SHORT,0)}}};export{o as NightLayer,o as default,a as getSubsolarPoint};
@@ -0,0 +1,81 @@
1
+ var nightLayer=(function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let n=Array.from({length:15},(e,t)=>Math.sin(r(t===0?-.8333333:-6*t)));function r(e){return e*Math.PI/180}function i(e){return e/Math.PI*180}function a(e){let[t,n,r,i]=e.map(e=>e/255);return[t*i,n*i,r*i,i]}function o(e){if(e??=/* @__PURE__ */ new Date,!Number.isFinite(e.getTime()))throw RangeError(`Invalid date`);let t=e.getUTCFullYear(),n=e.getUTCMonth(),a=+(n>1&&t%4==0&&(t%100!=0||t%400==0)),o=[0,31,59,90,120,151,181,212,243,273,304,334][n]+e.getUTCDate()+a,s=e.getUTCHours()+e.getUTCMinutes()/60+e.getUTCSeconds()/3600+e.getUTCMilliseconds()/36e5,c=o+s/24,l=2*Math.PI/365.24,u=r(23.44),d=(c+9)*l,f=d+.0334*Math.sin((c-3)*l),p=(d-Math.atan2(Math.sin(f),Math.cos(f)*Math.cos(u)))/Math.PI,m=720*(p-Math.trunc(p+.5));return{lng:-15*(s-12+m/60),lat:i(Math.asin(Math.sin(-u)*Math.cos(f)))}}var s=class{id=`nightlayer`;type=`custom`;renderingMode=`2d`;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e={}){this.#t=e.opacity??.5,this.#o=e.twilightSteps??0,this.#s=e.twilightAttenuation??.5,this.#a=e.updateInterval??1e4,this.setColor(e.color??[0,0,0,255]),this.setDaytimeColor(e.daytimeColor??[0,0,0,0]),this.setDate(e.date??null)}#d(){let e=this.#u!==void 0&&this.#e===null;this.#i&&=(clearInterval(this.#i),void 0),e&&this.#a>0&&(this.#i=setInterval(()=>this.#u?.triggerRepaint(),this.#a))}getSubsolarPoint(){return o(this.#e)}getDate(){return this.#e?new Date(this.#e.getTime()):null}setDate(e){if(e!==null&&!Number.isFinite(e.getTime()))throw RangeError(`Invalid date`);this.#e=e===null?null:new Date(e.getTime()),this.#d(),this.#u?.triggerRepaint()}getOpacity(){return this.#t}setOpacity(e){this.#t=e,this.#u?.triggerRepaint()}getColor(){return this.#n}setColor(e){this.#n=[...e.slice(0,3),e?.[3]??255],this.#u?.triggerRepaint()}getDaytimeColor(){return this.#r}setDaytimeColor(e){this.#r=[...e.slice(0,3),e?.[3]??255],this.#u?.triggerRepaint()}getTwilightSteps(){return this.#o}setTwilightSteps(e){this.#o=e,this.#u?.triggerRepaint()}getTwilightAttenuation(){return this.#s}setTwilightAttenuation(e){this.#s=e,this.#u?.triggerRepaint()}getUpdateInterval(){return this.#a}setUpdateInterval(e){this.#a=e,this.#d()}onAdd(e,t){this.#c=/* @__PURE__ */ new Map,this.#l=/* @__PURE__ */ new Map,this.#u=e,this.#d()}onRemove(e,t){if(this.#i!==void 0&&(clearInterval(this.#i),this.#i=void 0),this.#c)for(let e of this.#c.values())t.deleteProgram(e);if(this.#l)for(let e of this.#l.values())t.deleteBuffer(e.vertices),t.deleteBuffer(e.indices);this.#c=void 0,this.#l=void 0,this.#u=void 0}#f(e,t){let n=`#version 300 es
2
+ precision highp float;
3
+
4
+ in vec2 a_position;
5
+ out vec2 v_position;
6
+ out float v_pole;
7
+
8
+ ${t.vertexShaderPrelude}
9
+ ${t.define}
10
+
11
+ void main() {
12
+ gl_Position = projectTile(a_position, a_position);
13
+ v_position = vec2(a_position.x, clamp(a_position.y, 0.0, 8192.0)) / 8192.0 - 0.5;
14
+ v_pole = a_position.y < -32767.5 ? 1.0 : (a_position.y > 32766.5 ? -1.0 : 0.0);
15
+ }
16
+ `,i=`#version 300 es
17
+ precision highp float;
18
+
19
+ in vec2 v_position;
20
+ in float v_pole;
21
+ out vec4 fragColor;
22
+
23
+ uniform vec4 u_tile; // exp(mercator latitude), sin(latitude), cos(latitude), tile size
24
+ uniform vec3 u_sun; // sin(solar latitude), cos(solar latitude) * cos/sin(relative longitude)
25
+ uniform float u_center_height;
26
+ uniform float u_thresholds[15];
27
+ uniform float u_opacity;
28
+ uniform float u_twilight_steps;
29
+ uniform float u_twilight_attenuation;
30
+ uniform vec4 u_daytime_color;
31
+ uniform vec4 u_night_color;
32
+
33
+ float expMinusOne(float x) {
34
+ if (abs(x) < 0.001) return x * (1.0 + x * (0.5 + x * (1.0 / 6.0 + x / 24.0)));
35
+ return exp(x) - 1.0;
36
+ }
37
+
38
+ void main() {
39
+ // Work with small tile-local differences, not rounded global coordinates.
40
+ float longitudeDelta = v_position.x * u_tile.w * ${2*Math.PI};
41
+ float e = expMinusOne(-v_position.y * u_tile.w * ${2*Math.PI});
42
+ float t = u_tile.x;
43
+ float denominator = t * t + 1.0;
44
+ float deltaSquared = t * t * e * (2.0 + e);
45
+ float product = denominator * (denominator + deltaSquared);
46
+ float sinDelta = 2.0 * deltaSquared / product;
47
+ float cosDelta = 2.0 * t * (e * denominator - deltaSquared) / product;
48
+
49
+ float poleAngle = v_pole * ${r(4.948871220193396)};
50
+ float poleCosDelta = -2.0 * pow(sin(poleAngle * 0.5), 2.0);
51
+ float poleSin = sin(poleAngle);
52
+ float latitudeSin = u_tile.y + sinDelta;
53
+ float latitudeCos = u_tile.z + cosDelta;
54
+ sinDelta += latitudeSin * poleCosDelta + latitudeCos * poleSin;
55
+ cosDelta += latitudeCos * poleCosDelta - latitudeSin * poleSin;
56
+ latitudeCos = u_tile.z + cosDelta;
57
+
58
+ float longitudeCosDelta = -2.0 * pow(sin(longitudeDelta * 0.5), 2.0);
59
+ float heightDelta = u_sun.x * sinDelta + u_sun.y * cosDelta
60
+ + latitudeCos * (u_sun.y * longitudeCosDelta + u_sun.z * sin(longitudeDelta));
61
+ float twilightStepAngle = 6.0;
62
+ float twilightSteps = u_twilight_steps;
63
+
64
+ // Attenuation for each twilightStepAngle
65
+ float att = u_twilight_attenuation;
66
+ float twilightLevel;
67
+ if (twilightSteps > 0.) {
68
+ // Threshold residuals are computed in float64 on the CPU before upload.
69
+ twilightLevel = 1.0;
70
+ for (int i = 1; i < 15; i++) {
71
+ if (u_thresholds[i] + heightDelta < 0.0) twilightLevel += 1.0;
72
+ }
73
+ twilightLevel = ceil(min(twilightLevel, twilightSteps));
74
+ if (u_thresholds[0] + heightDelta > 0.0) twilightLevel = 0.0;
75
+ } else {
76
+ float altitude = degrees(asin(clamp(u_center_height + heightDelta, -1.0, 1.0)));
77
+ twilightLevel = -altitude / twilightStepAngle;
78
+ }
79
+ float brightness = clamp(pow(clamp(1. - att, 0., 1.), twilightLevel), 0., 1.);
80
+ fragColor = mix(u_night_color, u_daytime_color, brightness) * u_opacity;
81
+ }`,a=e.createShader(e.VERTEX_SHADER);if(!a)throw Error(`failed to create vertex shader`);let o=e.createShader(e.FRAGMENT_SHADER);if(!o)throw e.deleteShader(a),Error(`failed to create fragment shader`);let s=null;try{if(e.shaderSource(a,n),e.compileShader(a),e.shaderSource(o,i),e.compileShader(o),s=e.createProgram(),!s)throw Error(`failed to create program`);if(e.attachShader(s,a),e.attachShader(s,o),e.linkProgram(s),!e.getProgramParameter(s,e.LINK_STATUS))throw Error(e.getProgramInfoLog(s)||`failed to link program`);return s}catch(t){throw s&&e.deleteProgram(s),s=null,t}finally{s&&(e.detachShader(s,a),e.detachShader(s,o)),e.deleteShader(a),e.deleteShader(o)}}#p(e,n,r,i){let a=`${n}:${r}:${i}`,o=this.#l.get(a);if(o)return o;let s=(0,t.createTileMesh)({granularity:n,generateBorders:!1,extendToNorthPole:r,extendToSouthPole:i},`16bit`),c=e.createBuffer(),l=e.createBuffer();if(!c||!l)throw c&&e.deleteBuffer(c),l&&e.deleteBuffer(l),Error(`failed to create tile mesh buffers`);e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,s.vertices,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,l),e.bufferData(e.ELEMENT_ARRAY_BUFFER,s.indices,e.STATIC_DRAW);let u={vertices:c,indices:l,count:s.indices.byteLength/2};return this.#l.set(a,u),u}render(e,t){if(!this.#c||!this.#l||!this.#u)return;let i=t.shaderData,o=i.variantName;this.#c.has(o)||this.#c.set(o,this.#f(e,i));let s=this.#c.get(o);if(!s)return;let{lng:c,lat:l}=this.getSubsolarPoint(),u=r(c),d=r(l),f=Math.sin(d),p=Math.cos(d);e.useProgram(s),e.uniform1f(e.getUniformLocation(s,`u_opacity`),this.#t),e.uniform4fv(e.getUniformLocation(s,`u_night_color`),a(this.#n)),e.uniform4fv(e.getUniformLocation(s,`u_daytime_color`),a(this.#r)),e.uniform1f(e.getUniformLocation(s,`u_twilight_steps`),this.#o),e.uniform1f(e.getUniformLocation(s,`u_twilight_attenuation`),this.#s);let m=t.defaultProjectionData.projectionTransition>0,h=this.#u.coveringTiles({tileSize:256});e.disable(e.SCISSOR_TEST),e.disable(e.DEPTH_TEST),e.disable(e.STENCIL_TEST),e.enable(e.CULL_FACE),e.frontFace(e.CCW),e.cullFace(e.BACK),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);for(let i of h){let{x:a,y:o,z:c}=i.canonical,l=2**-c,d=t.getProjectionData({tileID:{canonical:{x:a,y:o,z:c},wrap:i.wrap},applyGlobeMatrix:!0});e.uniformMatrix4fv(e.getUniformLocation(s,`u_projection_matrix`),!1,d.mainMatrix),e.uniformMatrix4fv(e.getUniformLocation(s,`u_projection_fallback_matrix`),!1,d.fallbackMatrix),e.uniform4fv(e.getUniformLocation(s,`u_projection_tile_mercator_coords`),d.tileMercatorCoords),e.uniform4fv(e.getUniformLocation(s,`u_projection_clipping_plane`),d.clippingPlane),e.uniform1f(e.getUniformLocation(s,`u_projection_transition`),d.projectionTransition);let h=Math.exp(Math.PI*(1-2*(o+.5)*l)),g=(h*h-1)/(h*h+1),_=2*h/(h*h+1),v=u-r((a+.5)*l*360-180),y=[f,p*Math.cos(v),p*Math.sin(v)],b=y[0]*g+y[1]*_,x=n.map(e=>b-e);e.uniform4fv(e.getUniformLocation(s,`u_tile`),[h,g,_,l]),e.uniform3fv(e.getUniformLocation(s,`u_sun`),y),e.uniform1f(e.getUniformLocation(s,`u_center_height`),b),e.uniform1fv(e.getUniformLocation(s,`u_thresholds[0]`),x);let S=m?Math.max(Math.floor(128*l),32):1,C=this.#p(e,S,m&&o===0,m&&o===2**c-1);e.bindBuffer(e.ARRAY_BUFFER,C.vertices),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.indices);let w=e.getAttribLocation(s,`a_position`);e.enableVertexAttribArray(w),e.vertexAttribPointer(w,2,e.SHORT,!1,0,0),e.drawElements(e.TRIANGLES,C.count,e.UNSIGNED_SHORT,0)}}};return e.NightLayer=s,e.default=s,e.getSubsolarPoint=o,e})({},maplibregl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maplibre-gl-nightlayer",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0",
4
4
  "description": "A Night Layer for MapLibre GL JS",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -10,15 +10,11 @@
10
10
  "dist/"
11
11
  ],
12
12
  "scripts": {
13
- "dev": "vite playground/",
14
- "build": "pnpm run build:esm && pnpm run build:types",
15
- "build:esm": "esbuild src/main.ts --minify --outfile=dist/main.js",
16
- "build:types": "tsc --declaration --emitDeclarationOnly --declarationDir './dist'",
17
- "lint": "biome lint ./src",
18
- "lint:fix": "biome lint ./src --write",
19
- "format": "biome format ./src",
20
- "format:fix": "biome format ./src --write",
21
- "test": "echo \"Error: no test specified\" && exit 1"
13
+ "build": "tsdown",
14
+ "typecheck": "tsc --noEmit",
15
+ "lint": "oxlint ./src tsdown.config.ts",
16
+ "format": "oxfmt --check ./src tsdown.config.ts",
17
+ "format:fix": "oxfmt --write ./src tsdown.config.ts"
22
18
  },
23
19
  "keywords": [
24
20
  "maplibre",
@@ -29,13 +25,19 @@
29
25
  ],
30
26
  "author": "kikuchan98@gmail.com",
31
27
  "homepage": "https://github.com/kikuchan/maplibre-gl-nightlayer#readme",
28
+ "repository": {
29
+ "url": "https://github.com/kikuchan/maplibre-gl-nightlayer"
30
+ },
32
31
  "license": "MIT",
33
32
  "devDependencies": {
34
- "@biomejs/biome": "^1.9.4",
35
- "esbuild": "^0.24.0",
36
- "gl-matrix": "^3.4.3",
37
- "maplibre-gl": "5.0.0-pre.10",
38
- "typescript": "^5.7.2",
39
- "vite": "^6.0.3"
40
- }
33
+ "maplibre-gl": "^6.13.0",
34
+ "oxfmt": "^0.72.0",
35
+ "oxlint": "^1.87.0",
36
+ "tsdown": "^0.23.0",
37
+ "typescript": "^7.0.2"
38
+ },
39
+ "peerDependencies": {
40
+ "maplibre-gl": "^6.13.0"
41
+ },
42
+ "packageManager": "pnpm@12.10.1"
41
43
  }