@richpods/tiny-geojson-tool 0.1.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/LICENSE.md +55 -0
- package/README.md +161 -0
- package/dist/components/EditorMap.vue.d.ts +22 -0
- package/dist/components/EditorToolbar.vue.d.ts +13 -0
- package/dist/components/GeoJsonEditor.vue.d.ts +23 -0
- package/dist/components/GeoJsonViewer.vue.d.ts +12 -0
- package/dist/components/LayerItem.vue.d.ts +29 -0
- package/dist/components/LayerPanel.vue.d.ts +23 -0
- package/dist/composables/useDrawing.d.ts +21 -0
- package/dist/composables/useGeoJson.d.ts +14 -0
- package/dist/composables/useMapStyle.d.ts +4 -0
- package/dist/constants.d.ts +30 -0
- package/dist/index.d.ts +15 -0
- package/dist/l10n.d.ts +42 -0
- package/dist/styles/editor.css +1 -0
- package/dist/tiny-geojson-tool.js +1961 -0
- package/dist/types.d.ts +106 -0
- package/dist/utils/icons.d.ts +9 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/layers.d.ts +20 -0
- package/dist/utils/mapView.d.ts +8 -0
- package/package.json +75 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { EditorLocale } from "./l10n";
|
|
2
|
+
/** GeoJSON RFC 7946 aligned types for the editor */
|
|
3
|
+
export type Position = [number, number];
|
|
4
|
+
export type PolygonCoordinates = Position[][];
|
|
5
|
+
export type LineStringCoordinates = Position[];
|
|
6
|
+
export type PointCoordinates = Position;
|
|
7
|
+
/** Style properties for polygon fills */
|
|
8
|
+
export interface FillStyleProperties {
|
|
9
|
+
"fill"?: string;
|
|
10
|
+
"fill-opacity"?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Style properties for lines/strokes (shared by polygons and linestrings) */
|
|
13
|
+
export interface StrokeStyleProperties {
|
|
14
|
+
"stroke"?: string;
|
|
15
|
+
"stroke-opacity"?: number;
|
|
16
|
+
"stroke-width"?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Style properties for circle points (extending simplestyle to Points) */
|
|
19
|
+
export interface PointStyleProperties {
|
|
20
|
+
"fill"?: string;
|
|
21
|
+
"fill-opacity"?: number;
|
|
22
|
+
"stroke"?: string;
|
|
23
|
+
"stroke-opacity"?: number;
|
|
24
|
+
"stroke-width"?: number;
|
|
25
|
+
"circle-radius"?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Label properties shared by points and markers */
|
|
28
|
+
export interface LabelProperties {
|
|
29
|
+
"marker-label"?: string;
|
|
30
|
+
"marker-label-position"?: "top" | "left" | "right" | "bottom";
|
|
31
|
+
}
|
|
32
|
+
/** Style properties for markers/points */
|
|
33
|
+
export interface MarkerStyleProperties {
|
|
34
|
+
"marker-color"?: string;
|
|
35
|
+
"marker-size"?: "small" | "medium" | "large";
|
|
36
|
+
"marker-symbol"?: string;
|
|
37
|
+
"marker-label"?: string;
|
|
38
|
+
"marker-label-position"?: "top" | "left" | "right" | "bottom";
|
|
39
|
+
}
|
|
40
|
+
/** Common properties shared by all features */
|
|
41
|
+
export interface BaseProperties {
|
|
42
|
+
id?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface EditorPolygonFeature {
|
|
47
|
+
type: "Feature";
|
|
48
|
+
id: string;
|
|
49
|
+
geometry: {
|
|
50
|
+
type: "Polygon";
|
|
51
|
+
coordinates: PolygonCoordinates;
|
|
52
|
+
};
|
|
53
|
+
properties: BaseProperties & FillStyleProperties & StrokeStyleProperties;
|
|
54
|
+
}
|
|
55
|
+
export interface EditorLineStringFeature {
|
|
56
|
+
type: "Feature";
|
|
57
|
+
id: string;
|
|
58
|
+
geometry: {
|
|
59
|
+
type: "LineString";
|
|
60
|
+
coordinates: LineStringCoordinates;
|
|
61
|
+
};
|
|
62
|
+
properties: BaseProperties & StrokeStyleProperties;
|
|
63
|
+
}
|
|
64
|
+
export interface EditorPointFeature {
|
|
65
|
+
type: "Feature";
|
|
66
|
+
id: string;
|
|
67
|
+
geometry: {
|
|
68
|
+
type: "Point";
|
|
69
|
+
coordinates: PointCoordinates;
|
|
70
|
+
};
|
|
71
|
+
properties: BaseProperties & PointStyleProperties & LabelProperties;
|
|
72
|
+
}
|
|
73
|
+
export interface EditorMarkerFeature {
|
|
74
|
+
type: "Feature";
|
|
75
|
+
id: string;
|
|
76
|
+
geometry: {
|
|
77
|
+
type: "Point";
|
|
78
|
+
coordinates: PointCoordinates;
|
|
79
|
+
};
|
|
80
|
+
properties: BaseProperties & MarkerStyleProperties;
|
|
81
|
+
}
|
|
82
|
+
export type EditorFeature = EditorPolygonFeature | EditorLineStringFeature | EditorPointFeature | EditorMarkerFeature;
|
|
83
|
+
export type EditorProperties = BaseProperties & FillStyleProperties & StrokeStyleProperties & MarkerStyleProperties & PointStyleProperties & LabelProperties;
|
|
84
|
+
export interface EditorFeatureCollection {
|
|
85
|
+
type: "FeatureCollection";
|
|
86
|
+
features: EditorFeature[];
|
|
87
|
+
}
|
|
88
|
+
/** Tool modes */
|
|
89
|
+
export type ToolMode = "select" | "draw-point" | "draw-polygon" | "draw-line" | "draw-marker" | "eraser";
|
|
90
|
+
/** Editor props */
|
|
91
|
+
export interface EditorProps {
|
|
92
|
+
modelValue?: EditorFeatureCollection;
|
|
93
|
+
pmtilesUrl: string;
|
|
94
|
+
pointRadius?: number;
|
|
95
|
+
center?: Position;
|
|
96
|
+
zoom?: number;
|
|
97
|
+
l10n?: Partial<EditorLocale>;
|
|
98
|
+
}
|
|
99
|
+
export type { EditorLocale } from "./l10n";
|
|
100
|
+
/** Viewer props (read-only map display) */
|
|
101
|
+
export interface ViewerProps {
|
|
102
|
+
modelValue?: EditorFeatureCollection;
|
|
103
|
+
pmtilesUrl: string;
|
|
104
|
+
center?: Position;
|
|
105
|
+
zoom?: number;
|
|
106
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Map as MaplibreMap } from "maplibre-gl";
|
|
2
|
+
/** Common icons available in the picker */
|
|
3
|
+
export declare const COMMON_ICONS: readonly ["marker-pin", "location", "pin", "flag", "star", "heart", "home", "business", "cafe", "restaurant", "car", "bus", "bicycle", "walk", "airplane", "boat", "train", "medical", "fitness", "school", "library", "cart", "basket", "gift", "camera", "musical-notes", "football", "basketball", "golf", "tennisball", "fish", "leaf", "flower", "paw", "water", "flame", "snow", "sunny", "moon", "cloudy", "thunderstorm", "warning", "information-circle", "help-circle", "checkmark-circle", "close-circle", "alert-circle", "wifi", "cellular", "globe", "compass", "navigate", "map", "trail-sign", "bed", "beer", "wine", "pizza", "ice-cream"];
|
|
4
|
+
/** Resolve an icon name to a displayable SVG URL (for UI previews). */
|
|
5
|
+
export declare function getIconUrl(name: string): Promise<string | null>;
|
|
6
|
+
export declare function loadIcon(map: MaplibreMap, name: string): Promise<void>;
|
|
7
|
+
export declare function loadIconsForFeatures(map: MaplibreMap, features: Array<{
|
|
8
|
+
properties: Record<string, unknown>;
|
|
9
|
+
}>): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateFeatureId(): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LayerSpecification, Map as MaplibreMap } from "maplibre-gl";
|
|
2
|
+
export type GeomType = "Polygon" | "LineString" | "Point";
|
|
3
|
+
export interface FeatureSummary {
|
|
4
|
+
id: string;
|
|
5
|
+
geomType: GeomType;
|
|
6
|
+
}
|
|
7
|
+
/** Return MapLibre layers for a single feature, ordered bottom-to-top within the feature. */
|
|
8
|
+
export declare function getFeatureLayers(featureId: string, geomType: GeomType): LayerSpecification[];
|
|
9
|
+
/** Return layer IDs for a single feature (all sub-layers). */
|
|
10
|
+
export declare function getFeatureLayerIds(featureId: string, geomType: GeomType): string[];
|
|
11
|
+
/** Return layer IDs suitable for queryRenderedFeatures (excludes labels). */
|
|
12
|
+
export declare function getQueryableLayerIds(features: FeatureSummary[]): string[];
|
|
13
|
+
/** Return the vertices overlay layer (always rendered on top). */
|
|
14
|
+
export declare function getVerticesLayer(selectedFeatureId: string | null): LayerSpecification;
|
|
15
|
+
/**
|
|
16
|
+
* Reconcile per-feature layers on the map to match the new features array.
|
|
17
|
+
* Adds/removes layers as needed and reorders to match array position.
|
|
18
|
+
*/
|
|
19
|
+
export declare function reconcileFeatureLayers(map: MaplibreMap, prev: FeatureSummary[], next: FeatureSummary[], ceilingLayerId?: string): void;
|
|
20
|
+
export declare function getDrawingLayers(): LayerSpecification[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Map as MaplibreMap } from "maplibre-gl";
|
|
2
|
+
import type { EditorFeature, Position } from "../types";
|
|
3
|
+
export declare function shouldAutoFitOnLoad(center?: Position, zoom?: number): boolean;
|
|
4
|
+
export declare function fitMapToFeatures(map: MaplibreMap, features: EditorFeature[], options?: {
|
|
5
|
+
padding?: number;
|
|
6
|
+
maxZoom?: number;
|
|
7
|
+
pointZoom?: number;
|
|
8
|
+
}): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@richpods/tiny-geojson-tool",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RichPods' GeoJSON editor and viewer for MapLibre GL JS with drawing tools (points, lines, polygons), simplestyle-spec property editing, hover popups, PMTiles basemap support, and typed v-model bindings for custom mapping workflows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vue",
|
|
7
|
+
"vue3",
|
|
8
|
+
"geojson",
|
|
9
|
+
"gis",
|
|
10
|
+
"simplestyle-spec",
|
|
11
|
+
"richpods"
|
|
12
|
+
],
|
|
13
|
+
"license": "BlueOak-1.0.0",
|
|
14
|
+
"author": "Philipp Naderer-Puiu",
|
|
15
|
+
"homepage": "https://github.com/richpods/tiny-geojson-tool#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/richpods/tiny-geojson-tool.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/richpods/tiny-geojson-tool/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"files": ["dist"],
|
|
28
|
+
"main": "./dist/tiny-geojson-tool.js",
|
|
29
|
+
"module": "./dist/tiny-geojson-tool.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/tiny-geojson-tool.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./styles": "./dist/styles/editor.css"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
40
|
+
},
|
|
41
|
+
"sideEffects": [
|
|
42
|
+
"**/*.css",
|
|
43
|
+
"**/*.scss"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "vite",
|
|
47
|
+
"build": "vite build && npm run build:types",
|
|
48
|
+
"build:demo": "vite build --config vite.demo.config.ts",
|
|
49
|
+
"build:types": "vue-tsc -p tsconfig.build.json",
|
|
50
|
+
"preview:demo": "vite preview --config vite.demo.config.ts",
|
|
51
|
+
"typecheck": "vue-tsc --noEmit",
|
|
52
|
+
"prepublishOnly": "npm run typecheck && npm run build"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"maplibre-gl": "^5.18.0",
|
|
56
|
+
"pmtiles": "^4.4.0",
|
|
57
|
+
"vue": "^3.5.0"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"ionicons": "8.0.13"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@tailwindcss/vite": "4.1.18",
|
|
64
|
+
"@types/node": "25.2.3",
|
|
65
|
+
"@vitejs/plugin-vue": "6.0.4",
|
|
66
|
+
"maplibre-gl": "5.18.0",
|
|
67
|
+
"pmtiles": "4.4.0",
|
|
68
|
+
"sass": "1.97.3",
|
|
69
|
+
"tailwindcss": "4.1.18",
|
|
70
|
+
"typescript": "5.9.3",
|
|
71
|
+
"vite": "7.3.1",
|
|
72
|
+
"vue": "3.5.28",
|
|
73
|
+
"vue-tsc": "3.2.4"
|
|
74
|
+
}
|
|
75
|
+
}
|