@richpods/tiny-geojson-tool 0.1.1 → 0.3.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/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { EditorLocale } from "./l10n";
2
2
  /** GeoJSON RFC 7946 aligned types for the editor */
3
3
  export type Position = [number, number];
4
- export type BBox = [number, number, number, number];
4
+ export type GeoJsonBbox = [number, number, number, number] | [number, number, number, number, number, number];
5
+ export type BboxPadding = [number, number, number, number];
5
6
  export type PolygonCoordinates = Position[][];
6
7
  export type LineStringCoordinates = Position[];
7
8
  export type PointCoordinates = Position;
@@ -84,8 +85,8 @@ export type EditorFeature = EditorPolygonFeature | EditorLineStringFeature | Edi
84
85
  export type EditorProperties = BaseProperties & FillStyleProperties & StrokeStyleProperties & MarkerStyleProperties & PointStyleProperties & LabelProperties;
85
86
  export interface EditorFeatureCollection {
86
87
  type: "FeatureCollection";
88
+ bbox?: GeoJsonBbox;
87
89
  features: EditorFeature[];
88
- bbox?: BBox;
89
90
  }
90
91
  /** Tool modes */
91
92
  export type ToolMode = "select" | "draw-point" | "draw-polygon" | "draw-line" | "draw-marker" | "eraser";
@@ -96,6 +97,7 @@ export interface EditorProps {
96
97
  pointRadius?: number;
97
98
  center?: Position;
98
99
  zoom?: number;
100
+ bboxPadding?: BboxPadding;
99
101
  l10n?: Partial<EditorLocale>;
100
102
  }
101
103
  export type { EditorLocale } from "./l10n";
@@ -105,4 +107,5 @@ export interface ViewerProps {
105
107
  pmtilesUrl: string;
106
108
  center?: Position;
107
109
  zoom?: number;
110
+ bboxPadding?: BboxPadding;
108
111
  }
@@ -1,13 +1,17 @@
1
- import { type Map as MaplibreMap } from "maplibre-gl";
2
- import type { BBox, EditorFeature, EditorFeatureCollection, 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;
9
- export declare function computeBbox(fc: EditorFeatureCollection): BBox | undefined;
10
- export declare function fitMapToBbox(map: MaplibreMap, bbox: BBox, options?: {
11
- padding?: number;
12
- maxZoom?: number;
13
- }): void;
1
+ import { LngLatBounds } from "maplibre-gl";
2
+ import type { EditorFeatureCollection, BboxPadding } from "../types";
3
+ export interface MapPadding {
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ left: number;
8
+ }
9
+ export declare const DEFAULT_BBOX_PADDING: BboxPadding;
10
+ /**
11
+ * Returns bounds for initial map view.
12
+ * Priority:
13
+ * 1) GeoJSON bbox member (if present on FeatureCollection)
14
+ * 2) Calculated bounds from FeatureCollection.features
15
+ */
16
+ export declare function getBounds(modelValue?: EditorFeatureCollection): LngLatBounds | null;
17
+ export declare function getPadding(bboxPadding?: BboxPadding, extraPadding?: Partial<MapPadding>): MapPadding;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@richpods/tiny-geojson-tool",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
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
5
  "keywords": [
6
6
  "vue",
@@ -44,15 +44,16 @@
44
44
  ],
45
45
  "scripts": {
46
46
  "dev": "vite",
47
- "build": "vite build && npm run build:types",
47
+ "clean:dist": "rm -rf dist",
48
+ "build": "npm run clean:dist && vite build && npm run build:types",
48
49
  "build:demo": "vite build --config vite.demo.config.ts",
49
50
  "build:types": "vue-tsc -p tsconfig.build.json",
50
51
  "preview:demo": "vite preview --config vite.demo.config.ts",
51
52
  "typecheck": "vue-tsc --noEmit",
52
- "prepublishOnly": "npm run typecheck && npm run build"
53
+ "prepack": "npm run typecheck && npm run build"
53
54
  },
54
55
  "peerDependencies": {
55
- "maplibre-gl": "^5.18.0",
56
+ "maplibre-gl": "^5.19.0",
56
57
  "pmtiles": "^4.4.0",
57
58
  "vue": "^3.5.0"
58
59
  },