@molecule/app-map-drawing-vue 0.0.0-stage → 0.0.1-stage
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 +202 -0
- package/README.md +550 -2
- package/dist/MapDrawing.d.ts +163 -0
- package/dist/MapDrawing.d.ts.map +1 -0
- package/dist/MapDrawing.js +533 -0
- package/dist/MapDrawing.js.map +1 -0
- package/dist/MapDrawingToolbar.d.ts +111 -0
- package/dist/MapDrawingToolbar.d.ts.map +1 -0
- package/dist/MapDrawingToolbar.js +110 -0
- package/dist/MapDrawingToolbar.js.map +1 -0
- package/dist/geometry.d.ts +50 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +94 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +140 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -4
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue map-drawing surface: a drawing toolbar over an interaction layer that
|
|
3
|
+
* authors geofence shapes (polygons, circles, pins, lines).
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-map-drawing-react`'s `MapDrawing` — the
|
|
6
|
+
* same props (React names), the same ClassMap classes and inline styles, the
|
|
7
|
+
* same SVG overlay, the same pointer semantics, and the same callback calls.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type PropType, type VNode, type VNodeChild } from 'vue';
|
|
12
|
+
import type { ActiveTool, DrawingTool, MapDrawingBackend, MapShape } from './types.js';
|
|
13
|
+
/** MapDrawing component props. */
|
|
14
|
+
export interface MapDrawingProps {
|
|
15
|
+
/** Initial shapes to seed the surface with. */
|
|
16
|
+
initialShapes?: MapShape[];
|
|
17
|
+
/** Called whenever the shape list changes (add / edit / delete). */
|
|
18
|
+
onChange: (shapes: MapShape[]) => void;
|
|
19
|
+
/** Drawing tools to expose. Defaults to the four built-in tools. */
|
|
20
|
+
tools?: DrawingTool[];
|
|
21
|
+
/** Externally controlled active tool. When omitted, the component manages tool state internally. */
|
|
22
|
+
activeTool?: ActiveTool;
|
|
23
|
+
/** Called when the active tool changes (drives the toolbar regardless of internal/external state). */
|
|
24
|
+
onActiveToolChange?: (tool: ActiveTool) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Map backend used to project between geographic and screen coordinates.
|
|
27
|
+
* Defaults to an identity backend that treats `lng → x`, `lat → y` so
|
|
28
|
+
* the component can be exercised in tests without a real map provider.
|
|
29
|
+
*/
|
|
30
|
+
mapBackend?: MapDrawingBackend;
|
|
31
|
+
/** Optional content for the map background (e.g. a `<MapView />`), prop or slot. */
|
|
32
|
+
mapSlot?: VNodeChild;
|
|
33
|
+
/** Width of the surface (CSS) — defaults to `100%`. */
|
|
34
|
+
width?: number | string;
|
|
35
|
+
/** Height of the surface (CSS) — defaults to `400`. */
|
|
36
|
+
height?: number | string;
|
|
37
|
+
/** Extra classes merged onto the root element. */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Map-drawing surface for geofence editing. Renders a toolbar plus an
|
|
42
|
+
* interaction layer overlaid on top of the (optional) map slot. The
|
|
43
|
+
* component handles four drawing tools — polygon, circle, pin, line —
|
|
44
|
+
* plus a select / delete action group.
|
|
45
|
+
*
|
|
46
|
+
* Drawing semantics:
|
|
47
|
+
* - **polygon / line**: click adds vertices; double-click finalises.
|
|
48
|
+
* - **circle**: pointer-down sets the center; pointer-up commits with
|
|
49
|
+
* radius equal to the great-circle distance from center to release.
|
|
50
|
+
* - **pin**: each pointer-down adds one new pin shape.
|
|
51
|
+
* - **select**: pointer-drag draws a marquee; any shape whose anchor
|
|
52
|
+
* point lies inside the marquee is added to the selection.
|
|
53
|
+
*
|
|
54
|
+
* @param props - Component props (see {@link MapDrawingProps}).
|
|
55
|
+
* @returns The map-drawing component.
|
|
56
|
+
*/
|
|
57
|
+
export declare const MapDrawing: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
58
|
+
/** Initial shapes to seed the surface with. */
|
|
59
|
+
initialShapes: {
|
|
60
|
+
type: PropType<MapShape[]>;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
/** Called whenever the shape list changes. */
|
|
64
|
+
onChange: {
|
|
65
|
+
type: PropType<MapDrawingProps["onChange"]>;
|
|
66
|
+
required: true;
|
|
67
|
+
};
|
|
68
|
+
/** Drawing tools to expose. */
|
|
69
|
+
tools: {
|
|
70
|
+
type: PropType<DrawingTool[]>;
|
|
71
|
+
default: () => DrawingTool[];
|
|
72
|
+
};
|
|
73
|
+
/** Externally controlled active tool. */
|
|
74
|
+
activeTool: {
|
|
75
|
+
type: PropType<ActiveTool | undefined>;
|
|
76
|
+
default: undefined;
|
|
77
|
+
};
|
|
78
|
+
/** Called when the active tool changes. */
|
|
79
|
+
onActiveToolChange: {
|
|
80
|
+
type: PropType<MapDrawingProps["onActiveToolChange"]>;
|
|
81
|
+
default: undefined;
|
|
82
|
+
};
|
|
83
|
+
/** Map backend used to project between geographic and screen coordinates. */
|
|
84
|
+
mapBackend: {
|
|
85
|
+
type: PropType<MapDrawingBackend>;
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
88
|
+
/** Optional content for the map background, prop or slot. */
|
|
89
|
+
mapSlot: null;
|
|
90
|
+
/** Width of the surface (CSS). */
|
|
91
|
+
width: {
|
|
92
|
+
type: PropType<number | string>;
|
|
93
|
+
default: string;
|
|
94
|
+
};
|
|
95
|
+
/** Height of the surface (CSS). */
|
|
96
|
+
height: {
|
|
97
|
+
type: PropType<number | string>;
|
|
98
|
+
default: number;
|
|
99
|
+
};
|
|
100
|
+
/** Extra classes merged onto the root element. */
|
|
101
|
+
className: {
|
|
102
|
+
type: PropType<string | undefined>;
|
|
103
|
+
default: undefined;
|
|
104
|
+
};
|
|
105
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
106
|
+
/** Initial shapes to seed the surface with. */
|
|
107
|
+
initialShapes: {
|
|
108
|
+
type: PropType<MapShape[]>;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
/** Called whenever the shape list changes. */
|
|
112
|
+
onChange: {
|
|
113
|
+
type: PropType<MapDrawingProps["onChange"]>;
|
|
114
|
+
required: true;
|
|
115
|
+
};
|
|
116
|
+
/** Drawing tools to expose. */
|
|
117
|
+
tools: {
|
|
118
|
+
type: PropType<DrawingTool[]>;
|
|
119
|
+
default: () => DrawingTool[];
|
|
120
|
+
};
|
|
121
|
+
/** Externally controlled active tool. */
|
|
122
|
+
activeTool: {
|
|
123
|
+
type: PropType<ActiveTool | undefined>;
|
|
124
|
+
default: undefined;
|
|
125
|
+
};
|
|
126
|
+
/** Called when the active tool changes. */
|
|
127
|
+
onActiveToolChange: {
|
|
128
|
+
type: PropType<MapDrawingProps["onActiveToolChange"]>;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
/** Map backend used to project between geographic and screen coordinates. */
|
|
132
|
+
mapBackend: {
|
|
133
|
+
type: PropType<MapDrawingBackend>;
|
|
134
|
+
default: undefined;
|
|
135
|
+
};
|
|
136
|
+
/** Optional content for the map background, prop or slot. */
|
|
137
|
+
mapSlot: null;
|
|
138
|
+
/** Width of the surface (CSS). */
|
|
139
|
+
width: {
|
|
140
|
+
type: PropType<number | string>;
|
|
141
|
+
default: string;
|
|
142
|
+
};
|
|
143
|
+
/** Height of the surface (CSS). */
|
|
144
|
+
height: {
|
|
145
|
+
type: PropType<number | string>;
|
|
146
|
+
default: number;
|
|
147
|
+
};
|
|
148
|
+
/** Extra classes merged onto the root element. */
|
|
149
|
+
className: {
|
|
150
|
+
type: PropType<string | undefined>;
|
|
151
|
+
default: undefined;
|
|
152
|
+
};
|
|
153
|
+
}>> & Readonly<{}>, {
|
|
154
|
+
onActiveToolChange: ((tool: ActiveTool) => void) | undefined;
|
|
155
|
+
tools: DrawingTool[];
|
|
156
|
+
activeTool: ActiveTool | undefined;
|
|
157
|
+
initialShapes: MapShape[];
|
|
158
|
+
mapBackend: MapDrawingBackend;
|
|
159
|
+
width: string | number;
|
|
160
|
+
height: string | number;
|
|
161
|
+
className: string | undefined;
|
|
162
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
163
|
+
//# sourceMappingURL=MapDrawing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapDrawing.d.ts","sourceRoot":"","sources":["../src/MapDrawing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,KAAK,EACV,KAAK,UAAU,EAEhB,MAAM,KAAK,CAAA;AAOZ,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAKX,iBAAiB,EACjB,QAAQ,EAGT,MAAM,YAAY,CAAA;AA8CnB,kCAAkC;AAClC,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAA;IAC1B,oEAAoE;IACpE,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAA;IACtC,oEAAoE;IACpE,KAAK,CAAC,EAAE,WAAW,EAAE,CAAA;IACrB,oGAAoG;IACpG,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,sGAAsG;IACtG,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IAC/C;;;;OAIG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,oFAAoF;IACpF,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,uDAAuD;IACvD,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