maplibre-gl-layers 0.14.0 → 0.16.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/dist/SpriteLayer.d.ts +5 -22
- package/dist/config.d.ts +2 -2
- package/dist/const.d.ts +7 -3
- package/dist/default.d.ts +2 -2
- package/dist/{atlas.d.ts → gl/atlas.d.ts} +3 -3
- package/dist/gl/hitTest.d.ts +54 -0
- package/dist/gl/shader.d.ts +115 -0
- package/dist/gl/text.d.ts +17 -0
- package/dist/{calculationHost.d.ts → host/calculationHost.d.ts} +27 -5
- package/dist/{mapLibreProjectionHost.d.ts → host/mapLibreProjectionHost.d.ts} +3 -3
- package/dist/{projectionHost.d.ts → host/projectionHost.d.ts} +10 -8
- package/dist/{runtime.d.ts → host/runtime.d.ts} +4 -3
- package/dist/{wasmCalculationHost.d.ts → host/wasmCalculationHost.d.ts} +18 -14
- package/dist/{wasmHost.d.ts → host/wasmHost.d.ts} +7 -5
- package/dist/{wasmProjectionHost.d.ts → host/wasmProjectionHost.d.ts} +3 -3
- package/dist/index.cjs +5185 -2836
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +5185 -2836
- package/dist/index.mjs.map +1 -1
- package/dist/internalTypes.d.ts +127 -23
- package/dist/{degreeInterpolation.d.ts → interpolation/degreeInterpolation.d.ts} +19 -4
- package/dist/interpolation/distanceInterpolation.d.ts +46 -0
- package/dist/interpolation/easing.d.ts +24 -0
- package/dist/{interpolation.d.ts → interpolation/interpolation.d.ts} +5 -27
- package/dist/{interpolationChannels.d.ts → interpolation/interpolationChannels.d.ts} +16 -7
- package/dist/{rotationInterpolation.d.ts → interpolation/rotationInterpolation.d.ts} +5 -10
- package/dist/types.d.ts +152 -29
- package/dist/utils/color.d.ts +25 -0
- package/dist/{image.d.ts → utils/image.d.ts} +3 -3
- package/dist/{looseQuadTree.d.ts → utils/looseQuadTree.d.ts} +2 -2
- package/dist/{math.d.ts → utils/math.d.ts} +28 -16
- package/dist/{utils.d.ts → utils/utils.d.ts} +3 -3
- package/dist/wasm/config.json.d.ts +2 -2
- package/dist/wasm/offloads-nosimd.wasm +0 -0
- package/dist/wasm/offloads-simd-mt.js +1 -1
- package/dist/wasm/offloads-simd-mt.wasm +0 -0
- package/dist/wasm/offloads-simd.wasm +0 -0
- package/package.json +6 -8
- package/dist/distanceInterpolation.d.ts +0 -33
- package/dist/easing.d.ts +0 -19
- package/dist/shader.d.ts +0 -101
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"git": {
|
|
3
3
|
"tags": [
|
|
4
|
-
"0.
|
|
4
|
+
"0.16.0"
|
|
5
5
|
],
|
|
6
6
|
"branches": [
|
|
7
7
|
"main"
|
|
8
8
|
],
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.16.0",
|
|
10
10
|
"commit": {
|
|
11
|
-
"hash": "
|
|
12
|
-
"shortHash": "
|
|
13
|
-
"date": "2025-11-
|
|
11
|
+
"hash": "8d2149a6811cac25ed9d8c1d97acde73e1a38e25",
|
|
12
|
+
"shortHash": "8d2149a",
|
|
13
|
+
"date": "2025-11-18T18:12:19+09:00Z",
|
|
14
14
|
"message": "Merge branch 'develop'"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "0.
|
|
17
|
+
"version": "0.16.0",
|
|
18
18
|
"description": "MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images",
|
|
19
19
|
"author": "Kouji Matsui (@kekyo@mi.kekyo.net)",
|
|
20
20
|
"license": "MIT",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"build": "node ./scripts/build-wasm.mjs && vite build",
|
|
57
57
|
"dev": "npm run build",
|
|
58
58
|
"test": "npm run build && vitest run",
|
|
59
|
-
"test:e2e": "npm run build && playwright test",
|
|
60
59
|
"pack": "npm run build && screw-up pack --pack-destination ../artifacts"
|
|
61
60
|
},
|
|
62
61
|
"dependencies": {
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
"maplibre-gl": ">=5.0.0"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
|
-
"@playwright/test": ">=1.56.0",
|
|
68
66
|
"@types/node": ">=24.9.0",
|
|
69
67
|
"prettier-max": ">=1.11.0",
|
|
70
68
|
"screw-up": ">=1.13.0",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.14.0
|
|
4
|
-
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
|
-
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
-
* license: MIT
|
|
7
|
-
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
-
* git.commit.hash: a531802b05777e1f54a8828a247254293df1415d
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { SpriteInterpolationOptions } from './types';
|
|
12
|
-
import { DistanceInterpolationState } from './internalTypes';
|
|
13
|
-
export interface CreateDistanceInterpolationStateParams {
|
|
14
|
-
currentValue: number;
|
|
15
|
-
targetValue: number;
|
|
16
|
-
previousCommandValue?: number;
|
|
17
|
-
options: SpriteInterpolationOptions;
|
|
18
|
-
}
|
|
19
|
-
export interface CreateDistanceInterpolationStateResult {
|
|
20
|
-
readonly state: DistanceInterpolationState;
|
|
21
|
-
readonly requiresInterpolation: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare const createDistanceInterpolationState: (params: CreateDistanceInterpolationStateParams) => CreateDistanceInterpolationStateResult;
|
|
24
|
-
export interface EvaluateDistanceInterpolationParams {
|
|
25
|
-
state: DistanceInterpolationState;
|
|
26
|
-
timestamp: number;
|
|
27
|
-
}
|
|
28
|
-
export interface EvaluateDistanceInterpolationResult {
|
|
29
|
-
readonly value: number;
|
|
30
|
-
readonly completed: boolean;
|
|
31
|
-
readonly effectiveStartTimestamp: number;
|
|
32
|
-
}
|
|
33
|
-
export declare const evaluateDistanceInterpolation: (params: EvaluateDistanceInterpolationParams) => EvaluateDistanceInterpolationResult;
|
package/dist/easing.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.14.0
|
|
4
|
-
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
|
-
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
-
* license: MIT
|
|
7
|
-
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
-
* git.commit.hash: a531802b05777e1f54a8828a247254293df1415d
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { EasingFunction } from './types';
|
|
12
|
-
/**
|
|
13
|
-
* Linear interpolation that clamps the value to the [0, 1] range.
|
|
14
|
-
*/
|
|
15
|
-
export declare const linearEasing: EasingFunction;
|
|
16
|
-
/**
|
|
17
|
-
* Returns the provided easing function or falls back to linear interpolation.
|
|
18
|
-
*/
|
|
19
|
-
export declare const resolveEasing: (easing?: EasingFunction) => EasingFunction;
|
package/dist/shader.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.14.0
|
|
4
|
-
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
|
-
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
-
* license: MIT
|
|
7
|
-
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
-
* git.commit.hash: a531802b05777e1f54a8828a247254293df1415d
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { SpriteAnchor, SpriteScreenPoint } from './types';
|
|
12
|
-
import { PreparedDrawSpriteImageParams, Releaseable } from './internalTypes';
|
|
13
|
-
/** Number of components per vertex (clipPosition.xyzw + uv.xy). */
|
|
14
|
-
export declare const VERTEX_COMPONENT_COUNT = 6;
|
|
15
|
-
/** Component count for clip-space position attributes. */
|
|
16
|
-
export declare const POSITION_COMPONENT_COUNT = 4;
|
|
17
|
-
/** Component count for UV attributes. */
|
|
18
|
-
export declare const UV_COMPONENT_COUNT = 2;
|
|
19
|
-
/** Byte size of a Float32. */
|
|
20
|
-
export declare const FLOAT_SIZE: number;
|
|
21
|
-
/** Stride per vertex in bytes. */
|
|
22
|
-
export declare const VERTEX_STRIDE: number;
|
|
23
|
-
/** Byte offset for the UV attribute. */
|
|
24
|
-
export declare const UV_OFFSET: number;
|
|
25
|
-
/** Vertex count required to draw one sprite as two triangles. */
|
|
26
|
-
export declare const QUAD_VERTEX_COUNT = 6;
|
|
27
|
-
/** Shared vertex shader that converts screen-space vertices when requested. */
|
|
28
|
-
export declare const VERTEX_SHADER_SOURCE: "\nattribute vec4 a_position;\nattribute vec2 a_uv;\nuniform vec2 u_screenToClipScale;\nuniform vec2 u_screenToClipOffset;\nuniform float u_billboardMode;\nuniform float u_surfaceMode;\nuniform vec2 u_billboardCenter;\nuniform vec2 u_billboardHalfSize;\nuniform vec2 u_billboardAnchor;\nuniform vec2 u_billboardSinCos;\nuniform float u_surfaceClipEnabled;\nuniform mat4 u_surfaceClipMatrix;\nuniform float u_surfaceDepthBias;\nvarying vec2 v_uv;\nvec2 computeBillboardCorner(vec2 baseCorner) {\n vec2 anchorShift = vec2(u_billboardAnchor.x * u_billboardHalfSize.x, u_billboardAnchor.y * u_billboardHalfSize.y);\n vec2 shifted = vec2(baseCorner.x * u_billboardHalfSize.x, baseCorner.y * u_billboardHalfSize.y) - anchorShift;\n float sinR = u_billboardSinCos.x;\n float cosR = u_billboardSinCos.y;\n vec2 rotated = vec2(\n shifted.x * cosR - shifted.y * sinR,\n shifted.x * sinR + shifted.y * cosR\n );\n return vec2(\n u_billboardCenter.x + rotated.x,\n u_billboardCenter.y - rotated.y\n );\n}\nvec4 computeSurfaceCorner(vec2 corner) {\n if (u_surfaceClipEnabled < 0.5) {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n vec4 clip = u_surfaceClipMatrix * vec4(1.0, corner.x, corner.y, 0.0);\n clip.z += u_surfaceDepthBias * clip.w;\n return clip;\n}\nvoid main() {\n v_uv = a_uv;\n vec4 position;\n if (u_billboardMode > 0.5) {\n vec2 screenPosition = computeBillboardCorner(a_position.xy);\n position = vec4(screenPosition, 0.0, 1.0);\n } else if (u_surfaceMode > 0.5) {\n vec2 baseCorner = vec2(a_position.x, a_position.y);\n position = computeSurfaceCorner(baseCorner);\n } else {\n position = a_position;\n }\n position.xy = position.xy * u_screenToClipScale + u_screenToClipOffset;\n gl_Position = position;\n}\n";
|
|
29
|
-
/** Fragment shader that applies texture sampling and opacity. */
|
|
30
|
-
export declare const FRAGMENT_SHADER_SOURCE: "\nprecision mediump float;\nuniform sampler2D u_texture;\nuniform float u_opacity;\nvarying vec2 v_uv;\nvoid main() {\n vec4 texel = texture2D(u_texture, v_uv);\n gl_FragColor = vec4(texel.rgb, texel.a) * u_opacity;\n}\n";
|
|
31
|
-
/** Initial vertex data for a unit quad. */
|
|
32
|
-
export declare const INITIAL_QUAD_VERTICES: Float32Array<ArrayBuffer>;
|
|
33
|
-
/** Scratch buffer rewritten for each draw call. */
|
|
34
|
-
export declare const QUAD_VERTEX_SCRATCH: Float32Array<ArrayBuffer>;
|
|
35
|
-
/** Vertex shader for debug hit-test outline rendering using screen coordinates. */
|
|
36
|
-
export declare const DEBUG_OUTLINE_VERTEX_SHADER_SOURCE: "\nattribute vec4 a_position;\nuniform vec2 u_screenToClipScale;\nuniform vec2 u_screenToClipOffset;\nvoid main() {\n vec4 position = a_position;\n position.xy = position.xy * u_screenToClipScale + u_screenToClipOffset;\n gl_Position = position;\n}\n";
|
|
37
|
-
/** Fragment shader emitting a solid color for debug outlines. */
|
|
38
|
-
export declare const DEBUG_OUTLINE_FRAGMENT_SHADER_SOURCE: "\nprecision mediump float;\nuniform vec4 u_color;\nvoid main() {\n gl_FragColor = u_color;\n}\n";
|
|
39
|
-
/** Number of vertices required to outline a quad using LINE_LOOP. */
|
|
40
|
-
export declare const DEBUG_OUTLINE_VERTEX_COUNT = 4;
|
|
41
|
-
/** Components per debug outline vertex (clipPosition.xyzw). */
|
|
42
|
-
export declare const DEBUG_OUTLINE_POSITION_COMPONENT_COUNT = 4;
|
|
43
|
-
/** Stride in bytes for debug outline vertices. */
|
|
44
|
-
export declare const DEBUG_OUTLINE_VERTEX_STRIDE: number;
|
|
45
|
-
/** Scratch buffer reused when emitting debug outlines. */
|
|
46
|
-
export declare const DEBUG_OUTLINE_VERTEX_SCRATCH: Float32Array<ArrayBuffer>;
|
|
47
|
-
/** Solid red RGBA color used for debug outlines. */
|
|
48
|
-
export declare const DEBUG_OUTLINE_COLOR: readonly [number, number, number, number];
|
|
49
|
-
/** Corner traversal order used when outlining a quad without crossing diagonals. */
|
|
50
|
-
export declare const DEBUG_OUTLINE_CORNER_ORDER: readonly [0, 1, 3, 2];
|
|
51
|
-
/** Base corner definitions used when expanding billboards in shaders. */
|
|
52
|
-
export declare const BILLBOARD_BASE_CORNERS: ReadonlyArray<readonly [number, number]>;
|
|
53
|
-
/** Base corner definitions used when expanding surface quads in shaders. */
|
|
54
|
-
export declare const SURFACE_BASE_CORNERS: ReadonlyArray<readonly [number, number]>;
|
|
55
|
-
export declare const computeBillboardCornersShaderModel: ({ center, halfWidth, halfHeight, anchor, rotationDeg, }: {
|
|
56
|
-
center: Readonly<SpriteScreenPoint>;
|
|
57
|
-
halfWidth: number;
|
|
58
|
-
halfHeight: number;
|
|
59
|
-
anchor?: Readonly<SpriteAnchor>;
|
|
60
|
-
rotationDeg: number;
|
|
61
|
-
}) => Array<{
|
|
62
|
-
x: number;
|
|
63
|
-
y: number;
|
|
64
|
-
u: number;
|
|
65
|
-
v: number;
|
|
66
|
-
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Compiles a shader from source, throwing if compilation fails.
|
|
69
|
-
* @param {WebGLRenderingContext} glContext - Active WebGL context.
|
|
70
|
-
* @param {number} type - Shader type (`VERTEX_SHADER` or `FRAGMENT_SHADER`).
|
|
71
|
-
* @param {string} source - GLSL source code.
|
|
72
|
-
* @returns {WebGLShader} Compiled shader object.
|
|
73
|
-
* @throws When shader creation or compilation fails.
|
|
74
|
-
*/
|
|
75
|
-
export declare const compileShader: (glContext: WebGLRenderingContext, type: number, source: string) => WebGLShader;
|
|
76
|
-
/**
|
|
77
|
-
* Links a vertex and fragment shader into a WebGL program.
|
|
78
|
-
* @param {WebGLRenderingContext} glContext - Active WebGL context.
|
|
79
|
-
* @param {string} vertexSource - Vertex shader GLSL source.
|
|
80
|
-
* @param {string} fragmentSource - Fragment shader GLSL source.
|
|
81
|
-
* @returns {WebGLProgram} Linked shader program ready for use.
|
|
82
|
-
* @throws When linking fails or a program cannot be created.
|
|
83
|
-
*/
|
|
84
|
-
export declare const createShaderProgram: (glContext: WebGLRenderingContext, vertexSource: string, fragmentSource: string) => WebGLProgram;
|
|
85
|
-
export interface SpriteDrawProgram<TTag> extends Releaseable {
|
|
86
|
-
beginFrame(): void;
|
|
87
|
-
uploadVertexBatch(items: PreparedDrawSpriteImageParams<TTag>[]): void;
|
|
88
|
-
draw(prepared: PreparedDrawSpriteImageParams<TTag>): boolean;
|
|
89
|
-
}
|
|
90
|
-
export declare const createSpriteDrawProgram: <TTag>(glContext: WebGLRenderingContext) => SpriteDrawProgram<TTag>;
|
|
91
|
-
export interface DebugOutlineRenderer extends Releaseable {
|
|
92
|
-
begin(screenToClipScaleX: number, screenToClipScaleY: number, screenToClipOffsetX: number, screenToClipOffsetY: number): void;
|
|
93
|
-
drawOutline(corners: readonly [
|
|
94
|
-
SpriteScreenPoint,
|
|
95
|
-
SpriteScreenPoint,
|
|
96
|
-
SpriteScreenPoint,
|
|
97
|
-
SpriteScreenPoint
|
|
98
|
-
]): void;
|
|
99
|
-
end(): void;
|
|
100
|
-
}
|
|
101
|
-
export declare const createDebugOutlineRenderer: (glContext: WebGLRenderingContext) => DebugOutlineRenderer;
|