@richpods/tiny-geojson-tool 0.1.0 → 0.2.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,6 +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 GeoJsonBbox = [number, number, number, number] | [number, number, number, number, number, number];
5
+ export type BboxPadding = [number, number, number, number];
4
6
  export type PolygonCoordinates = Position[][];
5
7
  export type LineStringCoordinates = Position[];
6
8
  export type PointCoordinates = Position;
@@ -83,6 +85,7 @@ export type EditorFeature = EditorPolygonFeature | EditorLineStringFeature | Edi
83
85
  export type EditorProperties = BaseProperties & FillStyleProperties & StrokeStyleProperties & MarkerStyleProperties & PointStyleProperties & LabelProperties;
84
86
  export interface EditorFeatureCollection {
85
87
  type: "FeatureCollection";
88
+ bbox?: GeoJsonBbox;
86
89
  features: EditorFeature[];
87
90
  }
88
91
  /** Tool modes */
@@ -94,6 +97,7 @@ export interface EditorProps {
94
97
  pointRadius?: number;
95
98
  center?: Position;
96
99
  zoom?: number;
100
+ bboxPadding?: BboxPadding;
97
101
  l10n?: Partial<EditorLocale>;
98
102
  }
99
103
  export type { EditorLocale } from "./l10n";
@@ -103,4 +107,5 @@ export interface ViewerProps {
103
107
  pmtilesUrl: string;
104
108
  center?: Position;
105
109
  zoom?: number;
110
+ bboxPadding?: BboxPadding;
106
111
  }
@@ -1,8 +1,17 @@
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;
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.0",
3
+ "version": "0.2.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,12 +44,13 @@
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
56
  "maplibre-gl": "^5.18.0",