@maplibre-yaml/core 0.1.0-alpha.0 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maplibre-yaml/core",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.1",
4
4
  "description": "Core library for declarative MapLibre maps with YAML",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,6 +11,10 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js"
13
13
  },
14
+ "./register": {
15
+ "types": "./dist/register.d.ts",
16
+ "import": "./dist/register.js"
17
+ },
14
18
  "./schemas": {
15
19
  "types": "./dist/schemas/index.d.ts",
16
20
  "import": "./dist/schemas/index.js"
@@ -24,6 +28,15 @@
24
28
  "dist",
25
29
  "README.md"
26
30
  ],
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "dev": "tsup --watch",
34
+ "test": "vitest run",
35
+ "test:watch": "vitest",
36
+ "test:coverage": "vitest run --coverage",
37
+ "typecheck": "tsc --noEmit",
38
+ "clean": "rm -rf dist *.tsbuildinfo"
39
+ },
27
40
  "dependencies": {
28
41
  "maplibre-gl": "^4.1.0",
29
42
  "yaml": "^2.4.0",
@@ -56,7 +69,8 @@
56
69
  ],
57
70
  "license": "MIT",
58
71
  "publishConfig": {
59
- "access": "public"
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org"
60
74
  },
61
75
  "repository": {
62
76
  "type": "git",
@@ -66,14 +80,5 @@
66
80
  "bugs": {
67
81
  "url": "https://github.com/design-practices/maplibre-yaml/issues"
68
82
  },
69
- "homepage": "https://github.com/design-practices/maplibre-yaml#readme",
70
- "scripts": {
71
- "build": "tsup",
72
- "dev": "tsup --watch",
73
- "test": "vitest run",
74
- "test:watch": "vitest",
75
- "test:coverage": "vitest run --coverage",
76
- "typecheck": "tsc --noEmit",
77
- "clean": "rm -rf dist *.tsbuildinfo"
78
- }
79
- }
83
+ "homepage": "https://github.com/design-practices/maplibre-yaml#readme"
84
+ }
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 mariogiampieri
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,149 +0,0 @@
1
- import maplibregl, { Map } from 'maplibre-gl';
2
- import { z } from 'zod';
3
- import { L as LayerSchema, a as LegendConfigSchema, M as MapConfigSchema, C as ControlsConfigSchema } from './map.schema-EnZRrtIh.js';
4
-
5
- /**
6
- * @file Legend builder for map layers
7
- * @module @maplibre-yaml/core/renderer
8
- */
9
-
10
- type Layer$1 = z.infer<typeof LayerSchema>;
11
- type LegendConfig$1 = z.infer<typeof LegendConfigSchema>;
12
- /**
13
- * Builds legend HTML from layer configurations
14
- */
15
- declare class LegendBuilder {
16
- /**
17
- * Build legend in container from layers
18
- */
19
- build(container: string | HTMLElement, layers: Layer$1[], config?: Partial<LegendConfig$1>): void;
20
- /**
21
- * Render a single legend item
22
- */
23
- private renderItem;
24
- /**
25
- * Extract legend items from layers
26
- */
27
- private extractItems;
28
- /**
29
- * Escape HTML to prevent XSS
30
- */
31
- private escapeHtml;
32
- }
33
-
34
- /**
35
- * @file Main map renderer for MapLibre YAML
36
- * @module @maplibre-yaml/core/renderer
37
- */
38
-
39
- type MapConfig = z.infer<typeof MapConfigSchema>;
40
- type Layer = z.infer<typeof LayerSchema>;
41
- type ControlsConfig = z.infer<typeof ControlsConfigSchema>;
42
- type LegendConfig = z.infer<typeof LegendConfigSchema>;
43
- /**
44
- * Options for MapRenderer
45
- */
46
- interface MapRendererOptions {
47
- onLoad?: () => void;
48
- onError?: (error: Error) => void;
49
- }
50
- /**
51
- * Events emitted by MapRenderer
52
- */
53
- interface MapRendererEvents {
54
- load: void;
55
- 'layer:added': {
56
- layerId: string;
57
- };
58
- 'layer:removed': {
59
- layerId: string;
60
- };
61
- 'layer:data-loading': {
62
- layerId: string;
63
- };
64
- 'layer:data-loaded': {
65
- layerId: string;
66
- featureCount: number;
67
- };
68
- 'layer:data-error': {
69
- layerId: string;
70
- error: Error;
71
- };
72
- 'layer:click': {
73
- layerId: string;
74
- feature: any;
75
- lngLat: maplibregl.LngLat;
76
- };
77
- 'layer:hover': {
78
- layerId: string;
79
- feature: any;
80
- lngLat: maplibregl.LngLat;
81
- };
82
- }
83
- /**
84
- * Main class for rendering maps from configuration
85
- */
86
- declare class MapRenderer {
87
- private map;
88
- private layerManager;
89
- private eventHandler;
90
- private legendBuilder;
91
- private controlsManager;
92
- private eventListeners;
93
- private isLoaded;
94
- constructor(container: string | HTMLElement, config: MapConfig, layers?: Layer[], options?: MapRendererOptions);
95
- /**
96
- * Get the underlying MapLibre map instance
97
- */
98
- getMap(): Map;
99
- /**
100
- * Check if map is loaded
101
- */
102
- isMapLoaded(): boolean;
103
- /**
104
- * Add a layer to the map
105
- */
106
- addLayer(layer: Layer): Promise<void>;
107
- /**
108
- * Remove a layer from the map
109
- */
110
- removeLayer(layerId: string): void;
111
- /**
112
- * Set layer visibility
113
- */
114
- setLayerVisibility(layerId: string, visible: boolean): void;
115
- /**
116
- * Update layer data
117
- */
118
- updateLayerData(layerId: string, data: GeoJSON.GeoJSON): void;
119
- /**
120
- * Add controls to the map
121
- */
122
- addControls(config: ControlsConfig): void;
123
- /**
124
- * Build legend in container
125
- */
126
- buildLegend(container: string | HTMLElement, layers: Layer[], config?: LegendConfig): void;
127
- /**
128
- * Get the legend builder instance
129
- */
130
- getLegendBuilder(): LegendBuilder;
131
- /**
132
- * Register an event listener
133
- */
134
- on<K extends keyof MapRendererEvents>(event: K, callback: (data: MapRendererEvents[K]) => void): void;
135
- /**
136
- * Unregister an event listener
137
- */
138
- off<K extends keyof MapRendererEvents>(event: K, callback: Function): void;
139
- /**
140
- * Emit an event
141
- */
142
- private emit;
143
- /**
144
- * Destroy the map and clean up resources
145
- */
146
- destroy(): void;
147
- }
148
-
149
- export { LegendBuilder as L, MapRenderer as M, type MapRendererOptions as a, type MapRendererEvents as b };