@phila/phila-ui-map-core 0.0.1-beta.2 → 0.0.1-beta.3

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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./components.js"),a=require("./index-K0bKFr5g.cjs");exports.BasemapDropdown=o.BasemapDropdown;exports.BasemapToggle=o.BasemapToggle;exports.DrawTool=o.DrawTool;exports.GeolocationButton=o.GeolocationButton;exports.Map=o.Map;exports.MapButton=o.MapButton;exports.MapFloatingPanel=o.MapFloatingPanel;exports.MapLayer=o.MapLayer;exports.MapMarker=o.MapMarker;exports.MapNavigationControl=o.MapNavigationControl;exports.MeasureButton=o.MeasureButton;exports.createButtonControl=a.createButtonControl;exports.useMapControl=a.useMapControl;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DrawTool.vue_vue_type_style_index_0_lang-CQSJOFuP.cjs"),r=require("./useMapControl-CGjWu6ME.cjs"),a=require("./utils.js");exports.BasemapDropdown=e._sfc_main$14;exports.BasemapToggle=e._sfc_main$13;exports.CircleLayer=e._sfc_main$5;exports.DrawTool=e._sfc_main$10;exports.FillLayer=e._sfc_main$3;exports.GeolocationButton=e._sfc_main$12;exports.LineLayer=e._sfc_main$4;exports.Map=e.Map;exports.MapButton=e._sfc_main$11;exports.MapFloatingPanel=e._sfc_main$9;exports.MapLayer=e._sfc_main$2;exports.MapMarker=e._sfc_main;exports.MapNavigationControl=e._sfc_main$8;exports.MapPopup=e._sfc_main$1;exports.MapSearchControl=e._sfc_main$15;exports.RasterLayer=e._sfc_main$7;exports.SymbolLayer=e._sfc_main$6;exports.defaultBasemapSource=e.defaultBasemapSource;exports.defaultImageryOptions=e.defaultImageryOptions;exports.defaultLabelsSource=e.defaultLabelsSource;exports.imageryLabelsSource=e.imageryLabelsSource;exports.imageryLabelsUrl=e.imageryLabelsUrl;exports.imageryParcelOutlinesSource=e.imageryParcelOutlinesSource;exports.imagerySources=e.imagerySources;exports.useMapControl=r.useMapControl;exports.fetchParcelGeometry=a.fetchParcelGeometry;exports.geocodeAddress=a.geocodeAddress;exports.queryParcelAtPoint=a.queryParcelAtPoint;
package/dist/index.mjs CHANGED
@@ -1,17 +1,33 @@
1
- import { BasemapDropdown as t, BasemapToggle as e, DrawTool as r, GeolocationButton as n, Map as p, MapButton as M, MapFloatingPanel as l, MapLayer as u, MapMarker as s, MapNavigationControl as B, MeasureButton as g } from "./components.mjs";
2
- import { q as m, u as C } from "./index-DJPTWX6O.js";
1
+ import { n as r, m as s, e as o, j as l, c as t, l as p, d as u, M as i, k as n, i as c, b as m, _ as y, h as g, a as M, o as L, g as d, f, p as S, r as P, q as b, t as B, v as C, u as h, s as x } from "./DrawTool.vue_vue_type_style_index_0_lang-DfokfULQ.js";
2
+ import { u as q } from "./useMapControl-CmoJ03wJ.js";
3
+ import { fetchParcelGeometry as w, geocodeAddress as A, queryParcelAtPoint as D } from "./utils.mjs";
3
4
  export {
4
- t as BasemapDropdown,
5
- e as BasemapToggle,
6
- r as DrawTool,
7
- n as GeolocationButton,
8
- p as Map,
9
- M as MapButton,
10
- l as MapFloatingPanel,
11
- u as MapLayer,
12
- s as MapMarker,
13
- B as MapNavigationControl,
14
- g as MeasureButton,
15
- m as createButtonControl,
16
- C as useMapControl
5
+ r as BasemapDropdown,
6
+ s as BasemapToggle,
7
+ o as CircleLayer,
8
+ l as DrawTool,
9
+ t as FillLayer,
10
+ p as GeolocationButton,
11
+ u as LineLayer,
12
+ i as Map,
13
+ n as MapButton,
14
+ c as MapFloatingPanel,
15
+ m as MapLayer,
16
+ y as MapMarker,
17
+ g as MapNavigationControl,
18
+ M as MapPopup,
19
+ L as MapSearchControl,
20
+ d as RasterLayer,
21
+ f as SymbolLayer,
22
+ S as defaultBasemapSource,
23
+ P as defaultImageryOptions,
24
+ b as defaultLabelsSource,
25
+ w as fetchParcelGeometry,
26
+ A as geocodeAddress,
27
+ B as imageryLabelsSource,
28
+ C as imageryLabelsUrl,
29
+ h as imageryParcelOutlinesSource,
30
+ x as imagerySources,
31
+ D as queryParcelAtPoint,
32
+ q as useMapControl
17
33
  };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("vue");function l(n,u){const o=t.inject("map"),a=t.inject("isLoaded");let e=null;t.watch(()=>a?.value,i=>{!i||!o?.value||(typeof u!="function"?e={onAdd(){return u.value},onRemove(){}}:e=u(),o.value.addControl(e,n.position))},{immediate:!0}),t.onBeforeUnmount(()=>{o?.value&&e&&o.value.removeControl(e)})}exports.useMapControl=l;
@@ -0,0 +1,23 @@
1
+ import { inject as u, watch as i, onBeforeUnmount as d } from "vue";
2
+ function f(n, t) {
3
+ const o = u("map"), a = u("isLoaded");
4
+ let e = null;
5
+ i(
6
+ () => a?.value,
7
+ (l) => {
8
+ !l || !o?.value || (typeof t != "function" ? e = {
9
+ onAdd() {
10
+ return t.value;
11
+ },
12
+ onRemove() {
13
+ }
14
+ } : e = t(), o.value.addControl(e, n.position));
15
+ },
16
+ { immediate: !0 }
17
+ ), d(() => {
18
+ o?.value && e && o.value.removeControl(e);
19
+ });
20
+ }
21
+ export {
22
+ f as u
23
+ };
package/dist/utils.d.ts CHANGED
@@ -1,122 +1,87 @@
1
- import { BaseProps } from '@phila/phila-ui-core';
2
- import { FilterSpecification } from 'maplibre-gl';
3
- import { LayerSpecification } from 'maplibre-gl';
4
- import { LngLatLike } from 'maplibre-gl';
5
- import { PointLike } from 'maplibre-gl';
6
- import { SourceSpecification } from 'maplibre-gl';
7
- import { StyleSpecification } from 'maplibre-gl';
8
-
9
- export declare interface BasemapOption {
10
- label: string;
11
- imageryUrl: string;
12
- imageryLabelsUrl: string;
13
- }
14
-
15
- export declare interface BasemapToggleProps extends BaseProps {
16
- position?: MapControlPosition;
17
- imageryUrl?: string;
18
- imageryLabelsUrl?: string;
19
- imageryLayerId?: string;
20
- imageryLabelsLayerId?: string;
21
- baseLayerId?: string | null;
22
- iconImage?: string | null;
23
- basemapImage?: string | null;
24
- title?: string;
25
- iconSize?: number;
26
- showDropdown?: boolean;
27
- dropdownOptions?: BasemapOption[];
28
- }
29
-
30
- export declare interface DrawToolProps extends BaseProps {
31
- icon?: string;
32
- position?: MapControlPosition;
33
- title?: string;
34
- iconSize?: number;
35
- }
36
-
37
- export declare interface GeolocationButtonProps extends BaseProps {
38
- position?: MapControlPosition;
39
- icon?: string;
40
- iconSize?: number;
41
- title?: string;
42
- trackUser?: boolean;
43
- showAccuracyCircle?: boolean;
44
- }
45
-
46
- /** Common layer type for MapLayer */
47
- export declare type LayerType = "fill" | "line" | "symbol" | "circle" | "fill-extrusion" | "raster" | "background" | "heatmap" | "hillshade";
48
-
49
- export declare interface MapButtonProps extends BaseProps {
50
- icon?: string;
51
- image?: string;
52
- position?: MapControlPosition;
53
- title?: string;
54
- iconSize?: number;
55
- toggleable?: boolean;
56
- active?: boolean;
57
- activeColor?: string;
1
+ /** AIS geocode result feature */
2
+ export declare interface AisGeocodeResult {
3
+ type: "Feature";
4
+ ais_feature_type: string;
5
+ match_type: string;
6
+ geometry: {
7
+ type: "Point";
8
+ coordinates: [number, number];
9
+ };
10
+ properties: {
11
+ street_address: string;
12
+ opa_account_num?: string;
13
+ opa_owners?: string[];
14
+ zip_code?: string;
15
+ pwd_parcel_id?: string;
16
+ [key: string]: unknown;
17
+ };
58
18
  }
59
19
 
60
- /** Common position type for map controls */
61
- export declare type MapControlPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
62
-
63
- export declare interface MapFloatingPanelProps extends BaseProps {
64
- position?: MapControlPosition;
65
- visible?: boolean;
66
- offset?: {
67
- x: number;
68
- y: number;
20
+ /** Full AIS API response */
21
+ export declare interface AisResponse {
22
+ search_type: string;
23
+ search_params: {
24
+ query: string;
25
+ [key: string]: unknown;
69
26
  };
70
- leaveRoomForControls?: boolean;
27
+ query: string;
28
+ normalized: string;
29
+ page: number;
30
+ page_count: number;
31
+ page_size: number;
32
+ total_size: number;
33
+ type: "FeatureCollection";
34
+ features: AisGeocodeResult[];
71
35
  }
72
36
 
73
- export declare interface MapLayerProps extends BaseProps {
74
- id: string;
75
- type: LayerType;
76
- source: string | SourceSpecification;
77
- sourceLayer?: string;
78
- paint?: LayerSpecification["paint"];
79
- layout?: LayerSpecification["layout"];
80
- filter?: FilterSpecification;
81
- minzoom?: number;
82
- maxzoom?: number;
83
- beforeId?: string;
84
- }
37
+ /**
38
+ * Fetch the geometry for a parcel by its ID.
39
+ * Returns a GeoJSON FeatureCollection, or null if not found.
40
+ */
41
+ export declare function fetchParcelGeometry(parcelId: string): Promise<ParcelFeatureCollection | null>;
85
42
 
86
- export declare interface MapMarkerProps extends BaseProps {
87
- lngLat: [number, number];
88
- color?: string;
89
- popup?: string;
90
- draggable?: boolean;
91
- rotation?: number;
92
- offset?: PointLike;
93
- icon?: string;
94
- iconSize?: number;
95
- iconColor?: string;
96
- }
43
+ /**
44
+ * Geocode an address string via Philadelphia AIS API.
45
+ * Returns the full AIS response object, or null if no results found.
46
+ */
47
+ export declare function geocodeAddress(address: string): Promise<AisResponse | null>;
97
48
 
98
- export declare interface MapNavigationControlProps extends BaseProps {
99
- position?: MapControlPosition;
49
+ /**
50
+ * GeoJSON FeatureCollection for parcel geometry
51
+ */
52
+ export declare interface ParcelFeatureCollection {
53
+ type: "FeatureCollection";
54
+ features: Array<{
55
+ type: "Feature";
56
+ geometry: PolygonGeometry;
57
+ properties: {
58
+ parcelid: string;
59
+ };
60
+ }>;
100
61
  }
101
62
 
102
- export declare interface MapProps extends BaseProps {
103
- center?: LngLatLike;
104
- zoom?: number;
105
- style?: string | StyleSpecification;
106
- minZoom?: number;
107
- maxZoom?: number;
108
- pitch?: number;
109
- bearing?: number;
63
+ /**
64
+ * Result from querying a parcel at a point
65
+ */
66
+ export declare interface ParcelQueryResult {
67
+ parcelId: string;
68
+ address: string | null;
110
69
  }
111
70
 
112
- export declare interface MeasureButtonProps extends BaseProps {
113
- position?: MapControlPosition;
114
- icon?: string;
115
- iconSize?: number;
116
- title?: string;
117
- unit?: "feet" | "meters" | "miles" | "kilometers";
71
+ /**
72
+ * GeoJSON Polygon geometry
73
+ */
74
+ declare interface PolygonGeometry {
75
+ type: "Polygon";
76
+ coordinates: number[][][];
118
77
  }
119
78
 
79
+ /**
80
+ * Query the PWD parcel layer at a given point.
81
+ * Returns parcel ID and address if found, or null if no parcel at that location.
82
+ */
83
+ export declare function queryParcelAtPoint(lng: number, lat: number): Promise<ParcelQueryResult | null>;
84
+
120
85
  export { }
121
86
 
122
87
 
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function o(r){if(!r.trim())return null;const t=await(await fetch(`https://api.phila.gov/ais/v1/search/${encodeURIComponent(r)}?include_units=false`)).json();return t.features&&t.features.length>0?t:null}function i(r,a,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=a||{},n.geometry=r,n}function u(r,a,t={}){for(const e of r){if(e.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(e[e.length-1].length!==e[0].length)throw new Error("First and last Position are not equivalent.");for(let s=0;s<e[e.length-1].length;s++)if(e[e.length-1][s]!==e[0][s])throw new Error("First and last Position are not equivalent.")}return i({type:"Polygon",coordinates:r},a,t)}async function c(r,a){const t=new URLSearchParams({geometry:JSON.stringify({x:r,y:a}),geometryType:"esriGeometryPoint",inSR:"4326",spatialRel:"esriSpatialRelIntersects",outFields:"parcelid,address",returnGeometry:"false",f:"json"}),e=await(await fetch(`https://services.arcgis.com/fLeGjb7u4uXqeF9q/ArcGIS/rest/services/PWD_PARCELS/FeatureServer/0/query?${t}`)).json();if(e.features&&e.features.length>0){const s=e.features[0].attributes;return{parcelId:s.parcelid||null,address:s.address||null}}return null}async function l(r){const a=new URLSearchParams({where:`parcelid = ${r}`,outFields:"parcelid",returnGeometry:"true",outSR:"4326",f:"json"}),n=await(await fetch(`https://services.arcgis.com/fLeGjb7u4uXqeF9q/ArcGIS/rest/services/PWD_PARCELS/FeatureServer/0/query?${a}`)).json();if(n.features&&n.features.length>0){const e=n.features[0],s=e.geometry.rings;return{type:"FeatureCollection",features:[u(s,{parcelid:e.attributes.parcelid})]}}return null}exports.fetchParcelGeometry=l;exports.geocodeAddress=o;exports.queryParcelAtPoint=c;
package/dist/utils.mjs CHANGED
@@ -1 +1,76 @@
1
-
1
+ async function c(r) {
2
+ if (!r.trim())
3
+ return null;
4
+ const t = await (await fetch(
5
+ `https://api.phila.gov/ais/v1/search/${encodeURIComponent(r)}?include_units=false`
6
+ )).json();
7
+ return t.features && t.features.length > 0 ? t : null;
8
+ }
9
+ function o(r, a, t = {}) {
10
+ const n = { type: "Feature" };
11
+ return (t.id === 0 || t.id) && (n.id = t.id), t.bbox && (n.bbox = t.bbox), n.properties = a || {}, n.geometry = r, n;
12
+ }
13
+ function i(r, a, t = {}) {
14
+ for (const e of r) {
15
+ if (e.length < 4)
16
+ throw new Error(
17
+ "Each LinearRing of a Polygon must have 4 or more Positions."
18
+ );
19
+ if (e[e.length - 1].length !== e[0].length)
20
+ throw new Error("First and last Position are not equivalent.");
21
+ for (let s = 0; s < e[e.length - 1].length; s++)
22
+ if (e[e.length - 1][s] !== e[0][s])
23
+ throw new Error("First and last Position are not equivalent.");
24
+ }
25
+ return o({
26
+ type: "Polygon",
27
+ coordinates: r
28
+ }, a, t);
29
+ }
30
+ async function l(r, a) {
31
+ const t = new URLSearchParams({
32
+ geometry: JSON.stringify({ x: r, y: a }),
33
+ geometryType: "esriGeometryPoint",
34
+ inSR: "4326",
35
+ spatialRel: "esriSpatialRelIntersects",
36
+ outFields: "parcelid,address",
37
+ returnGeometry: "false",
38
+ f: "json"
39
+ }), e = await (await fetch(
40
+ `https://services.arcgis.com/fLeGjb7u4uXqeF9q/ArcGIS/rest/services/PWD_PARCELS/FeatureServer/0/query?${t}`
41
+ )).json();
42
+ if (e.features && e.features.length > 0) {
43
+ const s = e.features[0].attributes;
44
+ return {
45
+ parcelId: s.parcelid || null,
46
+ address: s.address || null
47
+ };
48
+ }
49
+ return null;
50
+ }
51
+ async function f(r) {
52
+ const a = new URLSearchParams({
53
+ where: `parcelid = ${r}`,
54
+ outFields: "parcelid",
55
+ returnGeometry: "true",
56
+ outSR: "4326",
57
+ f: "json"
58
+ }), n = await (await fetch(
59
+ `https://services.arcgis.com/fLeGjb7u4uXqeF9q/ArcGIS/rest/services/PWD_PARCELS/FeatureServer/0/query?${a}`
60
+ )).json();
61
+ if (n.features && n.features.length > 0) {
62
+ const e = n.features[0], s = e.geometry.rings;
63
+ return {
64
+ type: "FeatureCollection",
65
+ features: [i(s, {
66
+ parcelid: e.attributes.parcelid
67
+ })]
68
+ };
69
+ }
70
+ return null;
71
+ }
72
+ export {
73
+ f as fetchParcelGeometry,
74
+ c as geocodeAddress,
75
+ l as queryParcelAtPoint
76
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-map-core",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.3",
4
4
  "type": "module",
5
5
  "description": "Core map utilities and styles for Phila UI library",
6
6
  "main": "./dist/index.js",
@@ -52,8 +52,8 @@
52
52
  "@turf/helpers": "^7.3.1",
53
53
  "clsx": "^2.0.0",
54
54
  "maplibre-gl": "^5.13.0",
55
- "@phila/phila-ui-core": "2.2.0-beta.2",
56
- "@phila/phila-ui-search": "1.0.5-beta.2"
55
+ "@phila/phila-ui-core": "2.2.0-beta.3",
56
+ "@phila/phila-ui-search": "1.0.5-beta.3"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "vite build && npm run copy-css",