@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/README.md +66 -104
- package/dist/{components.css → DrawTool.css} +1 -1
- package/dist/DrawTool.vue_vue_type_style_index_0_lang-CQSJOFuP.cjs +621 -0
- package/dist/DrawTool.vue_vue_type_style_index_0_lang-DfokfULQ.js +5977 -0
- package/dist/components.d.ts +941 -229
- package/dist/components.js +1 -866
- package/dist/components.mjs +31 -25345
- package/dist/composables.d.ts +36 -21
- package/dist/composables.js +1 -1
- package/dist/composables.mjs +1 -2
- package/dist/index.d.ts +936 -215
- package/dist/index.js +1 -1
- package/dist/index.mjs +31 -15
- package/dist/useMapControl-CGjWu6ME.cjs +1 -0
- package/dist/useMapControl-CmoJ03wJ.js +23 -0
- package/dist/utils.d.ts +71 -106
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +76 -1
- package/package.json +3 -3
- package/dist/index-DJPTWX6O.js +0 -2223
- package/dist/index-K0bKFr5g.cjs +0 -5
package/dist/composables.d.ts
CHANGED
|
@@ -1,30 +1,45 @@
|
|
|
1
1
|
import { IControl } from 'maplibre-gl';
|
|
2
|
-
import { Map as Map_2 } from 'maplibre-gl';
|
|
3
2
|
import { Ref } from 'vue';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_container?: HTMLDivElement;
|
|
8
|
-
_button?: HTMLButtonElement;
|
|
9
|
-
}
|
|
4
|
+
/** Common position type for map controls */
|
|
5
|
+
declare type MapControlPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
10
6
|
|
|
11
7
|
/**
|
|
12
|
-
*
|
|
8
|
+
* Composable for adding MapLibre controls to the map.
|
|
9
|
+
*
|
|
10
|
+
* This composable handles positioning controls in MapLibre's corner containers
|
|
11
|
+
* (top-left, top-right, etc.) and automatic cleanup on unmount.
|
|
12
|
+
*
|
|
13
|
+
* ## What is IControl?
|
|
14
|
+
*
|
|
15
|
+
* IControl is MapLibre's interface for map controls. It's not a class you extend -
|
|
16
|
+
* it's a TypeScript interface that uses "duck typing": any object with the right
|
|
17
|
+
* methods qualifies. The required methods are:
|
|
18
|
+
*
|
|
19
|
+
* - onAdd(map): Called when control is added. Must return an HTMLElement.
|
|
20
|
+
* - onRemove(): Called when control is removed. Handle any cleanup here.
|
|
21
|
+
*
|
|
22
|
+
* So this plain object is a valid IControl:
|
|
23
|
+
*
|
|
24
|
+
* { onAdd() { return myDiv; }, onRemove() {} }
|
|
25
|
+
*
|
|
26
|
+
* ## Usage
|
|
27
|
+
*
|
|
28
|
+
* For Vue template-based controls (MapButton, MapSearchControl, BasemapDropdown),
|
|
29
|
+
* pass a ref to the container element. The composable creates the IControl internally,
|
|
30
|
+
* returning your Vue template's DOM element from onAdd():
|
|
31
|
+
*
|
|
32
|
+
* const containerRef = ref<HTMLElement | null>(null);
|
|
33
|
+
* useMapControl(props, containerRef);
|
|
34
|
+
*
|
|
35
|
+
* For MapLibre's built-in controls (like NavigationControl), pass a function that
|
|
36
|
+
* returns the control. These already implement IControl internally:
|
|
37
|
+
*
|
|
38
|
+
* useMapControl(props, () => new maplibregl.NavigationControl());
|
|
13
39
|
*/
|
|
14
|
-
export declare function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Composable for creating MapLibre IControl components
|
|
22
|
-
* Handles the boilerplate of adding/removing controls
|
|
23
|
-
*/
|
|
24
|
-
export declare function useMapControl(props: MapControlProps, createControlFn: (map: Map_2) => IControl | Promise<IControl>): {
|
|
25
|
-
map: Ref<Map_2 | null, Map_2 | null> | undefined;
|
|
26
|
-
control: null;
|
|
27
|
-
};
|
|
40
|
+
export declare function useMapControl(props: {
|
|
41
|
+
position?: MapControlPosition;
|
|
42
|
+
}, controlOrContainer: Ref<HTMLElement | null> | (() => IControl)): void;
|
|
28
43
|
|
|
29
44
|
export { }
|
|
30
45
|
|
package/dist/composables.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useMapControl-CGjWu6ME.cjs");exports.useMapControl=e.useMapControl;
|
package/dist/composables.mjs
CHANGED