@fabriquerdemain/map-shared 1.0.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.
@@ -0,0 +1,258 @@
1
+ /**
2
+ * @repcartes/map-shared
3
+ * Types et utilitaires partagés entre les packages Vue et React
4
+ */
5
+ /**
6
+ * Marqueur de base sur la carte
7
+ */
8
+ export interface MapMarker {
9
+ /** Identifiant unique du marqueur */
10
+ id: string;
11
+ /** Latitude */
12
+ lat: number;
13
+ /** Longitude */
14
+ lng: number;
15
+ /** Titre affiché dans la popup/panneau */
16
+ title?: string;
17
+ /** Sous-titre optionnel */
18
+ subtitle?: string;
19
+ /** Description longue */
20
+ description?: string;
21
+ /** Icône (emoji ou classe CSS) */
22
+ icon?: string;
23
+ /** Couleur du marqueur (hex) */
24
+ color?: string;
25
+ /** Type de deal/action */
26
+ type?: string;
27
+ /** Stage/étape dans le pipeline */
28
+ stage?: string;
29
+ /** Label du stage */
30
+ stageLabel?: string;
31
+ /** Couleur du stage */
32
+ stageColor?: string;
33
+ /** Nom du lieu */
34
+ venueName?: string;
35
+ /** Adresse structurée */
36
+ address?: MarkerAddress;
37
+ /** Contact associé */
38
+ contact?: MarkerContact;
39
+ /** Organisation associée */
40
+ organisation?: MarkerOrganisation;
41
+ /** Date prévue (ISO string) */
42
+ date?: string;
43
+ /** Valeur monétaire */
44
+ value?: number;
45
+ /** Devise */
46
+ currency?: string;
47
+ /** URL de détail */
48
+ detailUrl?: string;
49
+ /** URL externe */
50
+ externalUrl?: string;
51
+ /** Données supplémentaires libres */
52
+ metadata?: Record<string, unknown>;
53
+ }
54
+ export interface MarkerAddress {
55
+ /** Numéro de rue */
56
+ streetNumber?: string;
57
+ /** Nom de rue */
58
+ streetName?: string;
59
+ /** Rue complète (alternative à streetNumber + streetName) */
60
+ street?: string;
61
+ /** Code postal */
62
+ zipCode?: string;
63
+ /** Code postal (alias) */
64
+ postalCode?: string;
65
+ /** Ville */
66
+ city?: string;
67
+ /** Pays */
68
+ country?: string;
69
+ }
70
+ export interface MarkerContact {
71
+ id?: string;
72
+ /** Nom complet */
73
+ name?: string;
74
+ /** Prénom */
75
+ firstName?: string;
76
+ /** Nom de famille */
77
+ lastName?: string;
78
+ /** Rôle/fonction */
79
+ role?: string;
80
+ /** Email */
81
+ email?: string;
82
+ /** Téléphone */
83
+ phone?: string;
84
+ }
85
+ export interface MarkerOrganisation {
86
+ id?: string;
87
+ /** Nom de l'organisation */
88
+ name?: string;
89
+ /** Site web */
90
+ website?: string;
91
+ }
92
+ /**
93
+ * Options de configuration de la carte
94
+ */
95
+ export interface MapConfig {
96
+ /** Centre initial de la carte */
97
+ center?: {
98
+ lat: number;
99
+ lng: number;
100
+ };
101
+ /** Zoom initial */
102
+ zoom?: number;
103
+ /** Zoom minimum */
104
+ minZoom?: number;
105
+ /** Zoom maximum */
106
+ maxZoom?: number;
107
+ /** Type de fond de carte */
108
+ tileSource?: 'ign' | 'osm' | 'hybrid' | 'ortho';
109
+ /** Couche IGN spécifique */
110
+ ignLayer?: 'planign' | 'ortho' | 'topo' | 'parcellaire';
111
+ /** Activer le clustering */
112
+ clustering?: boolean;
113
+ /** Rayon de clustering (pixels) */
114
+ clusterRadius?: number;
115
+ /** Zoom à partir duquel désactiver le clustering */
116
+ disableClusteringAtZoom?: number;
117
+ /** Afficher les contrôles de zoom */
118
+ zoomControl?: boolean;
119
+ /** Afficher l'échelle */
120
+ showScaleControl?: boolean;
121
+ /** Afficher l'attribution */
122
+ showAttribution?: boolean;
123
+ /** Ajuster la vue aux marqueurs au chargement */
124
+ fitBoundsOnLoad?: boolean;
125
+ /** Padding pour fitBounds (pixels) */
126
+ fitBoundsPadding?: number;
127
+ /** Afficher les popups au clic */
128
+ showPopup?: boolean;
129
+ /** Afficher le titre dans la popup */
130
+ showPopupTitle?: boolean;
131
+ /** Afficher le sous-titre dans la popup */
132
+ showPopupSubtitle?: boolean;
133
+ /** Afficher l'adresse dans la popup */
134
+ showPopupAddress?: boolean;
135
+ /** Afficher le stage dans la popup */
136
+ showPopupStage?: boolean;
137
+ }
138
+ /**
139
+ * Configuration par défaut
140
+ */
141
+ export declare const DEFAULT_MAP_CONFIG: Required<MapConfig>;
142
+ export interface DetailPanelConfig {
143
+ /** Position du panneau */
144
+ position?: 'left' | 'right' | 'bottom';
145
+ /** Largeur du panneau (CSS) */
146
+ width?: string;
147
+ /** Afficher le bouton de fermeture */
148
+ showCloseButton?: boolean;
149
+ /** Sections à afficher */
150
+ sections?: DetailPanelSections;
151
+ }
152
+ export interface DetailPanelSections {
153
+ header?: boolean;
154
+ contact?: boolean;
155
+ organisation?: boolean;
156
+ location?: boolean;
157
+ date?: boolean;
158
+ description?: boolean;
159
+ value?: boolean;
160
+ }
161
+ export declare const DEFAULT_PANEL_CONFIG: Required<DetailPanelConfig>;
162
+ export interface FiltersConfig {
163
+ /** Filtres à afficher */
164
+ filters?: FilterType[];
165
+ /** Position des filtres */
166
+ position?: 'top' | 'inline';
167
+ /** Afficher le champ de recherche */
168
+ showSearch?: boolean;
169
+ /** Placeholder du champ de recherche */
170
+ searchPlaceholder?: string;
171
+ /** Afficher le filtre par type */
172
+ showTypeFilter?: boolean;
173
+ /** Afficher le filtre par stage */
174
+ showStageFilter?: boolean;
175
+ /** Afficher le filtre par ville */
176
+ showCityFilter?: boolean;
177
+ }
178
+ export type FilterType = 'type' | 'stage' | 'city' | 'search';
179
+ export interface FilterState {
180
+ type?: string;
181
+ stage?: string;
182
+ city?: string;
183
+ search?: string;
184
+ }
185
+ export declare const DEFAULT_FILTERS_CONFIG: Required<FiltersConfig>;
186
+ export interface DealTypeConfig {
187
+ label: string;
188
+ icon: string;
189
+ color?: string;
190
+ stages?: Record<string, DealStageConfig>;
191
+ }
192
+ export interface DealStageConfig {
193
+ label: string;
194
+ color: string;
195
+ order?: number;
196
+ }
197
+ export type DealTypesConfig = Record<string, DealTypeConfig>;
198
+ export interface MapEvents {
199
+ /** Clic sur un marqueur */
200
+ 'marker-click': MapMarker;
201
+ /** Survol d'un marqueur */
202
+ 'marker-hover': MapMarker | null;
203
+ /** Clic sur la carte (pas sur un marqueur) */
204
+ 'map-click': {
205
+ lat: number;
206
+ lng: number;
207
+ };
208
+ /** Changement des limites visibles */
209
+ 'bounds-change': MapBounds;
210
+ /** Changement de zoom */
211
+ 'zoom-change': number;
212
+ /** Fermeture du panneau */
213
+ 'panel-close': void;
214
+ /** Changement de filtres */
215
+ 'filter-change': FilterState;
216
+ }
217
+ export interface MapBounds {
218
+ north: number;
219
+ south: number;
220
+ east: number;
221
+ west: number;
222
+ }
223
+ /** Limites de la France métropolitaine */
224
+ export declare const FRANCE_BOUNDS: {
225
+ north: number;
226
+ south: number;
227
+ west: number;
228
+ east: number;
229
+ };
230
+ /**
231
+ * Vérifie si une coordonnée est en France métropolitaine
232
+ */
233
+ export declare function isInFrance(lat: number, lng: number): boolean;
234
+ /**
235
+ * URLs des tuiles cartographiques
236
+ */
237
+ export declare const TILE_URLS: {
238
+ ign: string;
239
+ ignPlan: string;
240
+ ortho: string;
241
+ osm: string;
242
+ };
243
+ export declare const TILE_ATTRIBUTIONS: {
244
+ ign: string;
245
+ ortho: string;
246
+ osm: string;
247
+ };
248
+ /**
249
+ * Formate une adresse en une chaîne lisible
250
+ */
251
+ export declare function formatAddress(address?: MarkerAddress): string;
252
+ /**
253
+ * Formate un nom complet
254
+ * @param firstNameOrContact - Prénom ou objet contact
255
+ * @param lastName - Nom de famille (optionnel si contact fourni)
256
+ */
257
+ export declare function formatName(firstNameOrContact?: string | MarkerContact, lastName?: string): string;
258
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,eAAe;IACf,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB;IAChB,G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,2BAA2B;IAC3B,cAAc,EAAE,SAAS,CAAA;IACzB,2BAA2B;IAC3B,cAAc,EAAE,SAAS,GAAG,IAAI,CAAA;IAChC,8CAA8C;IAC9C,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,sCAAsC;IACtC,eAAe,EAAE,SAAS,CAAA;IAC1B,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,2BAA2B;IAC3B,aAAa,EAAE,IAAI,CAAA;IACnB,4BAA4B;IAC5B,eAAe,EAAE,WAAW,CAAA;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAMD,0CAA0C;AAC1C,eAAO,MAAM,aAAa;;;;;CAKzB,CAAA;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAO5D;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAKrB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,aAAa,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAYjG"}
package/dist/index.js ADDED
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @repcartes/map-shared
3
+ * Types et utilitaires partagés entre les packages Vue et React
4
+ */
5
+ /**
6
+ * Configuration par défaut
7
+ */
8
+ export const DEFAULT_MAP_CONFIG = {
9
+ center: { lat: 46.603354, lng: 1.888334 }, // France
10
+ zoom: 6,
11
+ minZoom: 2,
12
+ maxZoom: 19,
13
+ tileSource: 'hybrid',
14
+ ignLayer: 'planign',
15
+ clustering: true,
16
+ clusterRadius: 40,
17
+ disableClusteringAtZoom: 12,
18
+ zoomControl: true,
19
+ showScaleControl: false,
20
+ showAttribution: true,
21
+ fitBoundsOnLoad: true,
22
+ fitBoundsPadding: 50,
23
+ showPopup: true,
24
+ showPopupTitle: true,
25
+ showPopupSubtitle: true,
26
+ showPopupAddress: true,
27
+ showPopupStage: true,
28
+ };
29
+ export const DEFAULT_PANEL_CONFIG = {
30
+ position: 'right',
31
+ width: '350px',
32
+ showCloseButton: true,
33
+ sections: {
34
+ header: true,
35
+ contact: true,
36
+ organisation: true,
37
+ location: true,
38
+ date: true,
39
+ description: true,
40
+ value: false,
41
+ },
42
+ };
43
+ export const DEFAULT_FILTERS_CONFIG = {
44
+ filters: ['type', 'stage', 'search'],
45
+ position: 'top',
46
+ showSearch: true,
47
+ searchPlaceholder: 'Rechercher...',
48
+ showTypeFilter: true,
49
+ showStageFilter: true,
50
+ showCityFilter: true,
51
+ };
52
+ // ============================================
53
+ // UTILITAIRES
54
+ // ============================================
55
+ /** Limites de la France métropolitaine */
56
+ export const FRANCE_BOUNDS = {
57
+ north: 51.5,
58
+ south: 41.0,
59
+ west: -5.5,
60
+ east: 10.0,
61
+ };
62
+ /**
63
+ * Vérifie si une coordonnée est en France métropolitaine
64
+ */
65
+ export function isInFrance(lat, lng) {
66
+ return (lat >= FRANCE_BOUNDS.south &&
67
+ lat <= FRANCE_BOUNDS.north &&
68
+ lng >= FRANCE_BOUNDS.west &&
69
+ lng <= FRANCE_BOUNDS.east);
70
+ }
71
+ /**
72
+ * URLs des tuiles cartographiques
73
+ */
74
+ export const TILE_URLS = {
75
+ ign: 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
76
+ ignPlan: 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
77
+ ortho: 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
78
+ osm: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
79
+ };
80
+ export const TILE_ATTRIBUTIONS = {
81
+ ign: '<a href="https://www.ign.fr/">IGN</a>',
82
+ ortho: '<a href="https://www.ign.fr/">IGN</a>',
83
+ osm: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
84
+ };
85
+ /**
86
+ * Formate une adresse en une chaîne lisible
87
+ */
88
+ export function formatAddress(address) {
89
+ if (!address)
90
+ return '';
91
+ const street = address.street || [address.streetNumber, address.streetName].filter(Boolean).join(' ');
92
+ const postal = address.postalCode || address.zipCode;
93
+ const parts = [street, postal, address.city].filter(Boolean);
94
+ return parts.join(', ');
95
+ }
96
+ /**
97
+ * Formate un nom complet
98
+ * @param firstNameOrContact - Prénom ou objet contact
99
+ * @param lastName - Nom de famille (optionnel si contact fourni)
100
+ */
101
+ export function formatName(firstNameOrContact, lastName) {
102
+ if (!firstNameOrContact)
103
+ return '';
104
+ // Si c'est un objet contact
105
+ if (typeof firstNameOrContact === 'object') {
106
+ const contact = firstNameOrContact;
107
+ if (contact.name)
108
+ return contact.name;
109
+ return [contact.firstName, contact.lastName].filter(Boolean).join(' ');
110
+ }
111
+ // Si ce sont des strings
112
+ return [firstNameOrContact, lastName].filter(Boolean).join(' ');
113
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@fabriquerdemain/map-shared",
3
+ "version": "1.0.0",
4
+ "description": "Types et utilitaires partagés pour les packages de carte RepCartes",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsc --watch"
21
+ },
22
+ "devDependencies": {
23
+ "typescript": "^5.3.0"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "license": "MIT"
29
+ }