@defra/forms-engine-plugin 4.13.0 → 4.14.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.
Files changed (32) hide show
  1. package/.public/javascripts/shared.min.js +1 -1
  2. package/.public/javascripts/shared.min.js.map +1 -1
  3. package/.server/client/javascripts/geospatial-map.d.ts +14 -0
  4. package/.server/client/javascripts/geospatial-map.js +161 -70
  5. package/.server/client/javascripts/geospatial-map.js.map +1 -1
  6. package/.server/client/javascripts/map.d.ts +6 -0
  7. package/.server/client/javascripts/map.js +5 -0
  8. package/.server/client/javascripts/map.js.map +1 -1
  9. package/.server/client/javascripts/utils.d.ts +7 -0
  10. package/.server/client/javascripts/utils.js +21 -0
  11. package/.server/client/javascripts/utils.js.map +1 -0
  12. package/.server/server/forms/simple-form.yaml +9 -0
  13. package/.server/server/plugins/engine/components/GeospatialField.d.ts +1 -0
  14. package/.server/server/plugins/engine/components/GeospatialField.js +9 -5
  15. package/.server/server/plugins/engine/components/GeospatialField.js.map +1 -1
  16. package/.server/server/plugins/engine/components/helpers/geospatial.d.ts +2 -2
  17. package/.server/server/plugins/engine/components/helpers/geospatial.js +32 -5
  18. package/.server/server/plugins/engine/components/helpers/geospatial.js.map +1 -1
  19. package/.server/server/plugins/engine/components/helpers/geospatial.test.js +37 -6
  20. package/.server/server/plugins/engine/components/helpers/geospatial.test.js.map +1 -1
  21. package/.server/server/plugins/engine/pageControllers/validationOptions.js +4 -1
  22. package/.server/server/plugins/engine/pageControllers/validationOptions.js.map +1 -1
  23. package/.server/server/plugins/engine/views/components/geospatialfield.html +1 -1
  24. package/package.json +2 -2
  25. package/src/client/javascripts/geospatial-map.js +159 -53
  26. package/src/client/javascripts/map.js +5 -0
  27. package/src/client/javascripts/utils.js +23 -0
  28. package/src/server/forms/simple-form.yaml +9 -0
  29. package/src/server/plugins/engine/components/GeospatialField.ts +11 -7
  30. package/src/server/plugins/engine/components/helpers/geospatial.ts +49 -11
  31. package/src/server/plugins/engine/pageControllers/validationOptions.ts +4 -1
  32. package/src/server/plugins/engine/views/components/geospatialfield.html +1 -1
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @param {boolean} allowPoint
3
+ * @param {boolean} allowLine
4
+ * @param {boolean} allowShape
5
+ */
6
+ export function getHelpPanelHtml(allowPoint: boolean, allowLine: boolean, allowShape: boolean): string;
1
7
  /**
2
8
  * Extract and parses the GeoJSON from the textarea
3
9
  * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson
@@ -99,6 +105,10 @@ export type RenderValue = () => void;
99
105
  * Toggles the action button hidden state
100
106
  */
101
107
  export type ToggleActionButtons = (hidden: boolean) => void;
108
+ /**
109
+ * Returns the list of geometry types a user can create
110
+ */
111
+ export type GetAllowableGeometryTypes = () => string[];
102
112
  /**
103
113
  * Set focus to the last description input
104
114
  */
@@ -160,6 +170,10 @@ export type UIManager = {
160
170
  * - function that sets focus to a description input element
161
171
  */
162
172
  focusDescriptionInput: FocusDescriptionInput;
173
+ /**
174
+ * - function that returns the array of geometry types a user can create
175
+ */
176
+ getAllowableGeometryTypes: GetAllowableGeometryTypes;
163
177
  };
164
178
  export type Context = {
165
179
  /**
@@ -1,5 +1,6 @@
1
1
  import { bbox } from '@turf/bbox';
2
2
  import { EVENTS, createMap, defaultConfig, getCentroidGridRef, getCoordinateGridRef } from "./map.js";
3
+ import { formatDelimtedList } from "./utils.js";
3
4
  const helpPanelConfig = {
4
5
  showLabel: true,
5
6
  label: 'How to use this map',
@@ -20,9 +21,56 @@ const helpPanelConfig = {
20
21
  open: true,
21
22
  dismissible: true,
22
23
  modal: false
23
- },
24
- html: '<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points, shapes or lines to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line or shape</li><li>Give the location a name</li></ul>'
24
+ }
25
25
  };
26
+
27
+ /**
28
+ * @param {boolean} allowLine
29
+ * @param {boolean} allowShape
30
+ */
31
+ function getLineOrShapeText(allowLine, allowShape) {
32
+ if (allowLine && allowShape) {
33
+ return 'a line or shape';
34
+ }
35
+ if (allowLine) {
36
+ return 'a line';
37
+ }
38
+ if (allowShape) {
39
+ return 'a shape';
40
+ }
41
+ return '';
42
+ }
43
+
44
+ /**
45
+ * @param {boolean} allowPoint
46
+ * @param {boolean} allowLine
47
+ * @param {boolean} allowShape
48
+ */
49
+ function getAllowedTypesPhrase(allowPoint, allowLine, allowShape) {
50
+ const items = [];
51
+ if (allowPoint) {
52
+ items.push('points');
53
+ }
54
+ if (allowLine) {
55
+ items.push('lines');
56
+ }
57
+ if (allowShape) {
58
+ items.push('shapes');
59
+ }
60
+ return formatDelimtedList(items, ',', 'or');
61
+ }
62
+
63
+ /**
64
+ * @param {boolean} allowPoint
65
+ * @param {boolean} allowLine
66
+ * @param {boolean} allowShape
67
+ */
68
+ export function getHelpPanelHtml(allowPoint, allowLine, allowShape) {
69
+ const lineOrShapeText = getLineOrShapeText(allowLine, allowShape);
70
+ const doneExtra = lineOrShapeText ? `<li>Double‑click, or select 'Done', when you have finished drawing ${lineOrShapeText}</li>` : '';
71
+ const allowedTypesText = getAllowedTypesPhrase(allowPoint, allowLine, allowShape);
72
+ return `<p class="govuk-body-s govuk-!-margin-bottom-2">You can add ${allowedTypesText} to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li>${doneExtra}<li>Give the location a name</li></ul>`;
73
+ }
26
74
  const lineFeatureProperties = {
27
75
  stroke: 'rgba(0, 11, 112, 1)',
28
76
  fill: 'rgba(0, 11, 112, 0.2)',
@@ -138,7 +186,11 @@ export function processGeospatial(config, geospatial, index) {
138
186
  } = createMap(mapId, initConfig, config);
139
187
  const featuresManager = getFeaturesManager(geojson);
140
188
  const activeFeatureManager = getActiveFeatureManager();
141
- const uiManager = getUIManager(geojson, map, mapId, listEl, geospatialInput);
189
+ const geometryTypes = geospatial.dataset.geometrytypes ?? 'point,line,shape';
190
+ const options = {
191
+ geometryTypes
192
+ };
193
+ const uiManager = getUIManager(geojson, map, mapId, listEl, geospatialInput, options);
142
194
 
143
195
  /**
144
196
  * @type {Context}
@@ -454,16 +506,32 @@ function getValueRenderer(geojson, geospatialInput) {
454
506
  * @param {string} mapId - the ID of the map
455
507
  * @param {HTMLDivElement} listEl - where to render the feature list
456
508
  * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea
509
+ * @param {UIManagerOptions} options - extra options such as allowable geometry types
457
510
  */
458
- function getUIManager(geojson, map, mapId, listEl, geospatialInput) {
511
+ function getUIManager(geojson, map, mapId, listEl, geospatialInput, options) {
512
+ /**
513
+ * Get a CSV list of geometry types the user can create
514
+ * @returns {string[]}
515
+ */
516
+ function getAllowableGeometryTypes() {
517
+ return options.geometryTypes ? options.geometryTypes.split(',') : [];
518
+ }
519
+
459
520
  /**
460
521
  * Toggle the hidden state of the action buttons
461
522
  * @type {ToggleActionButtons}
462
523
  */
463
524
  function toggleActionButtons(hidden) {
464
- map.toggleButtonState('btnAddPoint', 'hidden', hidden);
465
- map.toggleButtonState('btnAddPolygon', 'hidden', hidden);
466
- map.toggleButtonState('btnAddLine', 'hidden', hidden);
525
+ const types = getAllowableGeometryTypes();
526
+ if (types.includes('point')) {
527
+ map.toggleButtonState('btnAddPoint', 'hidden', hidden);
528
+ }
529
+ if (types.includes('shape')) {
530
+ map.toggleButtonState('btnAddPolygon', 'hidden', hidden);
531
+ }
532
+ if (types.includes('line')) {
533
+ map.toggleButtonState('btnAddLine', 'hidden', hidden);
534
+ }
467
535
  }
468
536
 
469
537
  /**
@@ -487,7 +555,8 @@ function getUIManager(geojson, map, mapId, listEl, geospatialInput) {
487
555
  renderValue,
488
556
  listEl,
489
557
  toggleActionButtons,
490
- focusDescriptionInput
558
+ focusDescriptionInput,
559
+ getAllowableGeometryTypes
491
560
  };
492
561
  }
493
562
 
@@ -539,7 +608,8 @@ function onMapReadyFactory(context) {
539
608
  } = context;
540
609
  const {
541
610
  toggleActionButtons,
542
- renderList
611
+ renderList,
612
+ getAllowableGeometryTypes
543
613
  } = uiManager;
544
614
  const {
545
615
  resetActiveFeature
@@ -551,68 +621,82 @@ function onMapReadyFactory(context) {
551
621
  * @param {MapLibreMap} e.map - the map provider instance
552
622
  */
553
623
  return function onMapReady(e) {
624
+ const types = getAllowableGeometryTypes();
625
+ const allowPoint = types.includes('point');
626
+ const allowLine = types.includes('line');
627
+ const allowShape = types.includes('shape');
628
+
554
629
  // Add info panel
555
- map.addPanel('info', helpPanelConfig);
556
- map.addButton('btnAddPoint', {
557
- variant: 'tertiary',
558
- label: 'Add point',
559
- iconSvgContent: POINT_SVG,
560
- onClick: () => {
561
- resetActiveFeature();
562
- toggleActionButtons(true);
563
- renderList(true);
564
- interactPlugin.enable();
565
- },
566
- mobile: {
567
- slot: 'actions'
568
- },
569
- tablet: {
570
- slot: 'actions'
571
- },
572
- desktop: {
573
- slot: 'actions'
574
- }
575
- });
576
- map.addButton('btnAddPolygon', {
577
- variant: 'tertiary',
578
- label: 'Add shape',
579
- iconSvgContent: POLYGON_SVG,
580
- onClick: () => {
581
- resetActiveFeature();
582
- toggleActionButtons(true);
583
- renderList(true);
584
- drawPlugin.newPolygon(generateID(), polygonFeatureProperties);
585
- },
586
- mobile: {
587
- slot: 'actions'
588
- },
589
- tablet: {
590
- slot: 'actions'
591
- },
592
- desktop: {
593
- slot: 'actions'
594
- }
595
- });
596
- map.addButton('btnAddLine', {
597
- variant: 'tertiary',
598
- label: 'Add line',
599
- iconSvgContent: LINE_SVG,
600
- onClick: () => {
601
- resetActiveFeature();
602
- toggleActionButtons(true);
603
- renderList(true);
604
- drawPlugin.newLine(generateID(), lineFeatureProperties);
605
- },
606
- mobile: {
607
- slot: 'actions'
608
- },
609
- tablet: {
610
- slot: 'actions'
611
- },
612
- desktop: {
613
- slot: 'actions'
614
- }
630
+ map.addPanel('info', {
631
+ ...helpPanelConfig,
632
+ html: getHelpPanelHtml(allowPoint, allowLine, allowShape)
615
633
  });
634
+ if (allowPoint) {
635
+ map.addButton('btnAddPoint', {
636
+ variant: 'tertiary',
637
+ label: 'Add point',
638
+ iconSvgContent: POINT_SVG,
639
+ onClick: () => {
640
+ resetActiveFeature();
641
+ toggleActionButtons(true);
642
+ renderList(true);
643
+ interactPlugin.enable();
644
+ },
645
+ mobile: {
646
+ slot: 'actions'
647
+ },
648
+ tablet: {
649
+ slot: 'actions'
650
+ },
651
+ desktop: {
652
+ slot: 'actions'
653
+ }
654
+ });
655
+ }
656
+ if (allowShape) {
657
+ map.addButton('btnAddPolygon', {
658
+ variant: 'tertiary',
659
+ label: 'Add shape',
660
+ iconSvgContent: POLYGON_SVG,
661
+ onClick: () => {
662
+ resetActiveFeature();
663
+ toggleActionButtons(true);
664
+ renderList(true);
665
+ drawPlugin.newPolygon(generateID(), polygonFeatureProperties);
666
+ },
667
+ mobile: {
668
+ slot: 'actions'
669
+ },
670
+ tablet: {
671
+ slot: 'actions'
672
+ },
673
+ desktop: {
674
+ slot: 'actions'
675
+ }
676
+ });
677
+ }
678
+ if (allowLine) {
679
+ map.addButton('btnAddLine', {
680
+ variant: 'tertiary',
681
+ label: 'Add line',
682
+ iconSvgContent: LINE_SVG,
683
+ onClick: () => {
684
+ resetActiveFeature();
685
+ toggleActionButtons(true);
686
+ renderList(true);
687
+ drawPlugin.newLine(generateID(), lineFeatureProperties);
688
+ },
689
+ mobile: {
690
+ slot: 'actions'
691
+ },
692
+ tablet: {
693
+ slot: 'actions'
694
+ },
695
+ desktop: {
696
+ slot: 'actions'
697
+ }
698
+ });
699
+ }
616
700
 
617
701
  // Set the map provider on the context
618
702
  context.mapProvider = e.map;
@@ -1083,6 +1167,12 @@ function onListElKeydownFactory() {
1083
1167
  * @returns {void}
1084
1168
  */
1085
1169
 
1170
+ /**
1171
+ * Returns the list of geometry types a user can create
1172
+ * @callback GetAllowableGeometryTypes
1173
+ * @returns {string[]}
1174
+ */
1175
+
1086
1176
  /**
1087
1177
  * Set focus to the last description input
1088
1178
  * @callback FocusDescriptionInput
@@ -1112,6 +1202,7 @@ function onListElKeydownFactory() {
1112
1202
  * @property {HTMLDivElement} listEl - the summary list of features
1113
1203
  * @property {ToggleActionButtons} toggleActionButtons - function that toggles the action buttons
1114
1204
  * @property {FocusDescriptionInput} focusDescriptionInput - function that sets focus to a description input element
1205
+ * @property {GetAllowableGeometryTypes} getAllowableGeometryTypes - function that returns the array of geometry types a user can create
1115
1206
  */
1116
1207
 
1117
1208
  /**
@@ -1126,6 +1217,6 @@ function onListElKeydownFactory() {
1126
1217
  */
1127
1218
 
1128
1219
  /**
1129
- * @import { MapLibreMap } from '../../client/javascripts/map.js'
1220
+ * @import { MapLibreMap, UIManagerOptions } from '../../client/javascripts/map.js'
1130
1221
  */
1131
1222
  //# sourceMappingURL=geospatial-map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geospatial-map.js","names":["bbox","EVENTS","createMap","defaultConfig","getCentroidGridRef","getCoordinateGridRef","helpPanelConfig","showLabel","label","mobile","slot","open","dismissible","modal","tablet","desktop","html","lineFeatureProperties","stroke","fill","strokeWidth","polygonFeatureProperties","typeDescriptions","Point","LineString","Polygon","POINT_SVG","POLYGON_SVG","LINE_SVG","getGeoJSON","geospatialInput","value","trim","hasValue","features","JSON","parse","geojson","type","getBoundingBox","processGeospatial","config","geospatial","index","defra","window","HTMLDivElement","querySelector","HTMLTextAreaElement","listEl","mapId","createContainers","bounds","length","undefined","drawPlugin","drawMLPlugin","plugins","country","dataset","datasetsPlugin","datasetsMaplibrePlugin","datasets","id","apiPath","showInKey","showInMenu","style","push","initConfig","map","interactPlugin","featuresManager","getFeaturesManager","activeFeatureManager","getActiveFeatureManager","uiManager","getUIManager","context","addEventListeners","addFeatureToMap","feature","geometry","addFeature","addMarker","coordinates","createFeaturesHTML","disabled","readonly","createFeatureHTML","join","focusFeature","mapProvider","fitBounds","flattened","flat","points","i","slice","p","description","properties","changeAction","deleteAction","focusAction","links","actions","centroidGridReference","coordinateGridReference","generateID","crypto","randomUUID","activeFeature","getActiveFeature","setActiveFeature","resetActiveFeature","prepareGeometry","maxPrecision","formatPrecision","toFixed","forEach","getFeatures","getFeature","find","f","updateFeature","removeFeature","idx","findIndex","splice","getListRenderer","renderValue","renderList","innerHTML","getValueRenderer","stringify","toggleActionButtons","hidden","toggleButtonState","focusDescriptionInput","inputs","querySelectorAll","lastInput","item","focus","select","on","mapReady","onMapReadyFactory","mapEl","document","createElement","setAttribute","listId","after","classList","add","onMapReady","e","addPanel","addButton","variant","iconSvgContent","onClick","enable","newPolygon","newLine","drawReady","onDrawReadyFactory","drawCreated","onDrawCreatedFactory","drawEdited","onDrawEditedFactory","drawCancelled","onDrawCancelledFactory","interactMarkerChange","onInteractMarkerChangedFactory","addEventListener","onListElClickFactory","onListElChangeFactory","onListElKeydownFactory","onDrawReady","onDrawCreated","onDrawEdited","changedFeature","featureId","onDrawCancelled","onInteractMarkerChange","activeFeatureId","coords","removeMarker","disable","deleteFeature","editFeature","selectFeature","target","HTMLElement","preventDefault","stopPropagation","tagName","action","HTMLInputElement","code"],"sources":["../../../src/client/javascripts/geospatial-map.js"],"sourcesContent":["import { bbox } from '@turf/bbox'\n\nimport {\n EVENTS,\n createMap,\n defaultConfig,\n getCentroidGridRef,\n getCoordinateGridRef\n} from '~/src/client/javascripts/map.js'\n\nconst helpPanelConfig = {\n showLabel: true,\n label: 'How to use this map',\n mobile: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n tablet: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n desktop: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n html: '<p class=\"govuk-body-s govuk-!-margin-bottom-2\">You can add points, shapes or lines to the map.</p><ul class=\"govuk-list govuk-list--number govuk-body-s\"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \\'Done\\', when you have finished drawing a line or shape</li><li>Give the location a name</li></ul>'\n}\n\nconst lineFeatureProperties = {\n stroke: 'rgba(0, 11, 112, 1)',\n fill: 'rgba(0, 11, 112, 0.2)',\n strokeWidth: 2\n}\n\nconst polygonFeatureProperties = {\n stroke: 'rgb(0, 0, 0)',\n fill: 'rgba(255, 221, 0, 0.2)',\n strokeWidth: 2\n}\n\n/**\n * @type {Record<'Point' | 'LineString' | 'Polygon', string>}\n */\nconst typeDescriptions = {\n Point: 'Point',\n LineString: 'Line',\n Polygon: 'Shape'\n}\n\nconst POINT_SVG =\n '<path d=\"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\" /><circle cx=\"12\" cy=\"10\" r=\"3\" />'\nconst POLYGON_SVG =\n '<path d=\"M19.5 7v10M4.5 7v10M7 19.5h10M7 4.5h10\"/><path d=\"M22 18v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm0-15v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 18v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 3v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1z\"/>'\nconst LINE_SVG =\n '<path d=\"M5.706 16.294L16.294 5.706\"/><path d=\"M21 2v3c0 .549-.451 1-1 1h-3c-.549 0-1-.451-1-1V2c0-.549.451-1 1-1h3c.549 0 1 .451 1 1zM6 17v3c0 .549-.451 1-1 1H2c-.549 0-1-.451-1-1v-3c0-.549.451-1 1-1h3c.549 0 1 .451 1 1z\"/>'\n\n/**\n * Extract and parses the GeoJSON from the textarea\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n */\nexport function getGeoJSON(geospatialInput) {\n const value = geospatialInput.value.trim()\n const hasValue = !!value\n\n /** @type {FeatureCollection} */\n const features = hasValue ? JSON.parse(value) : []\n\n /** @type {GeoJSON} */\n const geojson = {\n type: 'FeatureCollection',\n features\n }\n\n return geojson\n}\n\n/**\n * Gets the bounding box covering a feature collection\n * @param {GeoJSON} geojson - the geojson\n */\nexport function getBoundingBox(geojson) {\n return bbox(geojson)\n}\n\n/**\n * Processes a geospatial field to add map capability\n * @param {MapsEnvironmentConfig} config - the geospatial field element\n * @param {Element} geospatial - the geospatial field element\n * @param {number} index - the 0-based index\n */\nexport function processGeospatial(config, geospatial, index) {\n // @ts-expect-error - Defra namespace currently comes from UMD support files\n const defra = window.defra\n\n if (!(geospatial instanceof HTMLDivElement)) {\n return\n }\n\n const geospatialInput = geospatial.querySelector('.govuk-textarea')\n if (!(geospatialInput instanceof HTMLTextAreaElement)) {\n return\n }\n\n const { listEl, mapId } = createContainers(geospatialInput, index)\n const geojson = getGeoJSON(geospatialInput)\n const bounds = geojson.features.length ? getBoundingBox(geojson) : undefined\n const drawPlugin = defra.drawMLPlugin()\n const plugins = [drawPlugin]\n const country = geospatial.dataset.country\n\n if (country) {\n // Add the country bounds as a dataset plugin to show the valid area on the map\n // and provide feedback to the user when they add features outside of the bounds.\n const datasetsPlugin = defra.datasetsMaplibrePlugin({\n datasets: [\n {\n id: 'invalid-area',\n label: 'Invalid areas',\n geojson: `${config.apiPath}/maps/countries.geojson?omit=${country}`,\n showInKey: false,\n showInMenu: false,\n style: {\n stroke: 'gray',\n strokeWidth: 1,\n fill: 'rgba(211,211,211,0.8)'\n }\n },\n {\n id: 'valid-area',\n label: 'Valid areas',\n geojson: `${config.apiPath}/maps/countries.geojson?only=${country}`,\n showInKey: false,\n showInMenu: false,\n style: {\n stroke: 'rgba(0,112,60,1)',\n strokeWidth: 1\n }\n }\n ]\n })\n\n plugins.push(datasetsPlugin)\n }\n\n const initConfig = {\n ...defaultConfig,\n bounds,\n plugins\n }\n\n const { map, interactPlugin } = createMap(mapId, initConfig, config)\n const featuresManager = getFeaturesManager(geojson)\n const activeFeatureManager = getActiveFeatureManager()\n const uiManager = getUIManager(geojson, map, mapId, listEl, geospatialInput)\n\n /**\n * @type {Context}\n */\n const context = {\n map,\n featuresManager,\n activeFeatureManager,\n uiManager,\n interactPlugin,\n drawPlugin\n }\n\n addEventListeners(context)\n}\n\n/**\n * Adds a feature to the map\n * @param {Feature} feature - the geojson feature\n * @param {any} drawPlugin - the map draw plugin\n * @param {InteractiveMap} map - the interactive map\n */\nexport function addFeatureToMap(feature, drawPlugin, map) {\n switch (feature.geometry.type) {\n case 'Polygon':\n drawPlugin.addFeature({ ...feature, ...polygonFeatureProperties })\n break\n case 'LineString':\n drawPlugin.addFeature({ ...feature, ...lineFeatureProperties })\n break\n case 'Point':\n map.addMarker(feature.id, feature.geometry.coordinates)\n break\n default:\n break\n }\n}\n\n/**\n * Returns HTML summary list for the features\n * @param {FeatureCollection} features - the features\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list in readonly mode\n */\nexport function createFeaturesHTML(\n features,\n mapId,\n disabled = false,\n readonly = false\n) {\n return `<dl class=\"govuk-summary-list\">\n ${features.map((feature, index) => createFeatureHTML(feature, index, mapId, disabled, readonly)).join('\\n')}\n </dl>`\n}\n\n/**\n * Focus feature\n * @param {Feature} feature - the feature\n * @param {MapLibreMap} mapProvider - the feature id\n */\nexport function focusFeature(feature, mapProvider) {\n mapProvider.fitBounds(bbox(feature))\n}\n\n/**\n * Returns HTML summary row for an single feature\n * @param {Feature} feature - the geo feature\n * @param {number} index - the feature index\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list item in readonly mode\n */\nexport function createFeatureHTML(\n feature,\n index,\n mapId,\n disabled = false,\n readonly = false\n) {\n const flattened = feature.geometry.coordinates.flat(2)\n\n const points = []\n for (let i = 0; i < flattened.length; i += 2) {\n points.push(flattened.slice(i, i + 2).join(', '))\n }\n const coordinates = points.map((p) => `<li>${p}</li>`).join('')\n\n const description = readonly\n ? `<p class=\"govuk-body govuk-!-margin-bottom-0\">${feature.properties.description}</p>`\n : `<input class=\"govuk-input govuk-!-width-two-thirds\" type=\"text\" id=\"description_${index}\" value=\"${feature.properties.description}\" data-id=\"${feature.id}\">`\n\n // Change action link\n const changeAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#${mapId}\" data-action=\"edit\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">Update<span class=\"govuk-visually-hidden\"> location</span></a>\n</li>`\n\n // Delete action link\n const deleteAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#\" data-action=\"delete\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">Delete<span class=\"govuk-visually-hidden\"> location</span></a>\n</li>`\n\n // Focus action link\n const focusAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state\" href=\"#${mapId}\" data-action=\"focus\" data-id=\"${feature.id}\">Show<span class=\"govuk-visually-hidden\"> location</span></a>\n</li>`\n\n const links = readonly ? focusAction() : `${changeAction()}${deleteAction()}`\n\n const actions = `<ul class=\"govuk-summary-list__actions-list\">${links}</ul>`\n\n return `<div class=\"govuk-summary-list__row govuk-summary-list__row--no-border\">\n <dt class=\"govuk-summary-list__key\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-label--s\" ${readonly ? '' : `for=\"description_${index}\"`}>Location ${index + 1} description</label>\n ${description}\n </div>\n </dt>\n <dd class=\"govuk-summary-list__actions\">\n ${actions}\n </dd>\n</div>\n<div class=\"govuk-summary-list__row\">\n <details class=\"govuk-details govuk-!-margin-bottom-2\">\n <summary class=\"govuk-details__summary\">\n <span class=\"govuk-details__summary-text\">Coordinates</span>\n </summary>\n <div class=\"govuk-details__text\">\n <dl class=\"govuk-summary-list\">\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">Type</dt>\n <dd class=\"govuk-summary-list__value\">${typeDescriptions[feature.geometry.type]}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">Centre grid reference</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.centroidGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">First point grid reference</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.coordinateGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">Detailed coordinates</dt>\n <dd class=\"govuk-summary-list__value\">\n <ol class=\"govuk-list govuk-list--number\">${coordinates}</ol>\n </dd>\n </div>\n </dl>\n </div>\n </details>\n</div>`\n}\n\n/**\n * Generate a random id\n */\nfunction generateID() {\n return window.crypto.randomUUID()\n}\n\n/**\n * Factory closure to track the active feature id\n * @returns {ActiveFeatureManager}\n */\nfunction getActiveFeatureManager() {\n /** @type {string | undefined} */\n let activeFeature\n\n /**\n * Returns the active feature id\n * @type {GetActiveFeature}\n */\n function getActiveFeature() {\n return activeFeature\n }\n\n /**\n * Sets the active feature id\n * @type {SetActiveFeature}\n */\n function setActiveFeature(id) {\n activeFeature = id\n }\n\n /**\n * Resets the active feature id\n * @type {ResetActiveFeature}\n */\n function resetActiveFeature() {\n activeFeature = undefined\n }\n\n return {\n getActiveFeature,\n setActiveFeature,\n resetActiveFeature\n }\n}\n\n/**\n * Reduce coordinate precision to 7 dps\n * @param {Feature} feature\n */\nfunction prepareGeometry(feature) {\n const { geometry } = feature\n const maxPrecision = 7\n\n /**\n * @param {Coordinates} coordinates\n */\n function formatPrecision(coordinates) {\n coordinates[0] = +coordinates[0].toFixed(maxPrecision)\n coordinates[1] = +coordinates[1].toFixed(maxPrecision)\n }\n\n if (geometry.type === 'Point') {\n formatPrecision(geometry.coordinates)\n } else if (geometry.type === 'LineString') {\n geometry.coordinates.forEach(formatPrecision)\n } else {\n geometry.coordinates.flat().forEach(formatPrecision)\n }\n}\n\n/**\n * Factory closure to return a features manager\n * @param {GeoJSON} geojson\n * @returns {FeaturesManager}\n */\nfunction getFeaturesManager(geojson) {\n /**\n * Get a feature from the geojson by id\n * @type {GetFeatures}\n */\n function getFeatures() {\n return geojson.features\n }\n\n /**\n * Get a feature from the geojson by id\n * @type {GetFeature}\n */\n function getFeature(id) {\n return geojson.features.find((f) => f.id === id)\n }\n\n /**\n * Add a feature to the geojson\n * @type {AddFeature}\n */\n function addFeature(feature) {\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n prepareGeometry(feature)\n\n geojson.features.push(feature)\n }\n\n /**\n * Updates a feature in the geojson\n * @type {UpdateFeature}\n */\n function updateFeature(id, geometry) {\n const feature = getFeature(id)\n\n // Ensure the feature exists in the geojson\n if (feature) {\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n feature.geometry = geometry\n prepareGeometry(feature)\n }\n\n return feature\n }\n\n /**\n * Removes a feature from the geojson\n * @type {RemoveFeature}\n */\n function removeFeature(id) {\n const idx = geojson.features.findIndex((f) => f.id === id)\n\n return idx > -1 ? geojson.features.splice(idx, 1) : undefined\n }\n\n return {\n getFeatures,\n getFeature,\n addFeature,\n updateFeature,\n removeFeature\n }\n}\n\n/**\n * Factory to render features into the list and hidden textarea\n * @param {GeoJSON} geojson - the geojson of features\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {Function} renderValue - function that renders the features JSON into the hidden textarea\n * @returns {RenderList}\n */\nfunction getListRenderer(geojson, mapId, listEl, renderValue) {\n return function renderList(disabled = false) {\n const html = createFeaturesHTML(geojson.features, mapId, disabled)\n\n listEl.innerHTML = html\n\n renderValue()\n }\n}\n\n/**\n * Factory to render features JSON into the hidden textarea\n * @param {GeoJSON} geojson - the features\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @returns {RenderValue}\n */\nfunction getValueRenderer(geojson, geospatialInput) {\n return function renderValue() {\n geospatialInput.value = JSON.stringify(geojson.features, null, 2)\n }\n}\n\n/**\n * Factory closure to manage the UI\n * @param {GeoJSON} geojson - the features\n * @param {InteractiveMap} map - the map\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n */\nfunction getUIManager(geojson, map, mapId, listEl, geospatialInput) {\n /**\n * Toggle the hidden state of the action buttons\n * @type {ToggleActionButtons}\n */\n function toggleActionButtons(hidden) {\n map.toggleButtonState('btnAddPoint', 'hidden', hidden)\n map.toggleButtonState('btnAddPolygon', 'hidden', hidden)\n map.toggleButtonState('btnAddLine', 'hidden', hidden)\n }\n\n /**\n * Set focus to the last description input\n * @type {FocusDescriptionInput}\n */\n function focusDescriptionInput() {\n const inputs = listEl.querySelectorAll('input')\n if (inputs.length) {\n const lastInput = /** @type {HTMLInputElement} */ inputs.item(\n inputs.length - 1\n )\n lastInput.focus()\n lastInput.select()\n }\n }\n\n const renderValue = getValueRenderer(geojson, geospatialInput)\n const renderList = getListRenderer(geojson, mapId, listEl, renderValue)\n\n /** @type {UIManager} */\n return {\n renderList,\n renderValue,\n listEl,\n toggleActionButtons,\n focusDescriptionInput\n }\n}\n\n/**\n * Setup the UI event listeners\n * @param {Context} context - the context\n */\nfunction addEventListeners(context) {\n const { map } = context\n\n map.on(EVENTS.mapReady, onMapReadyFactory(context))\n}\n\n/**\n * Create the map and list containers and adds them to the DOM\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n * @param {number} index - the 0 based index\n */\nfunction createContainers(geospatialInput, index) {\n const mapEl = document.createElement('div')\n const mapId = `geospatialmap_${index}`\n\n mapEl.setAttribute('id', mapId)\n mapEl.setAttribute('class', 'map-container')\n\n const listEl = document.createElement('div')\n const listId = `${mapId}_list`\n listEl.setAttribute('id', listId)\n\n geospatialInput.after(mapEl)\n mapEl.after(listEl)\n geospatialInput.classList.add('js-hidden')\n\n return { mapEl, listEl, mapId }\n}\n\n/**\n * Callback factory function which fires when the map is ready\n * @param {Context} context - the UI context\n */\nfunction onMapReadyFactory(context) {\n const { map, activeFeatureManager, uiManager, interactPlugin, drawPlugin } =\n context\n const { toggleActionButtons, renderList } = uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback function which fires when the map is ready\n * @param {object} e - the event\n * @param {MapLibreMap} e.map - the map provider instance\n */\n return function onMapReady(e) {\n // Add info panel\n map.addPanel('info', helpPanelConfig)\n\n map.addButton('btnAddPoint', {\n variant: 'tertiary',\n label: 'Add point',\n iconSvgContent: POINT_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n interactPlugin.enable()\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n\n map.addButton('btnAddPolygon', {\n variant: 'tertiary',\n label: 'Add shape',\n iconSvgContent: POLYGON_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newPolygon(generateID(), polygonFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n\n map.addButton('btnAddLine', {\n variant: 'tertiary',\n label: 'Add line',\n iconSvgContent: LINE_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newLine(generateID(), lineFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n\n // Set the map provider on the context\n context.mapProvider = e.map\n\n map.on(EVENTS.drawReady, onDrawReadyFactory(context))\n map.on(EVENTS.drawCreated, onDrawCreatedFactory(context))\n map.on(EVENTS.drawEdited, onDrawEditedFactory(context))\n map.on(EVENTS.drawCancelled, onDrawCancelledFactory(context))\n map.on(EVENTS.interactMarkerChange, onInteractMarkerChangedFactory(context))\n\n const { listEl } = uiManager\n listEl.addEventListener('click', onListElClickFactory(context), false)\n listEl.addEventListener('change', onListElChangeFactory(context), false)\n listEl.addEventListener('keydown', onListElKeydownFactory(), false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin is ready\n * @param {Context} context - the UI context\n */\nfunction onDrawReadyFactory(context) {\n const { featuresManager, uiManager, drawPlugin, map } = context\n const { renderList } = uiManager\n const { getFeatures } = featuresManager\n\n /**\n * Callback when the draw plugin is ready\n */\n return function onDrawReady() {\n getFeatures().forEach((feature) =>\n addFeatureToMap(feature, drawPlugin, map)\n )\n\n // Update the features\n renderList()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin creates a new feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCreatedFactory(context) {\n const { featuresManager, uiManager } = context\n const { addFeature } = featuresManager\n const { renderList, toggleActionButtons, focusDescriptionInput } = uiManager\n\n /**\n * Callback when a draw feature has been created\n * @param {Feature} e\n */\n return function onDrawCreated(e) {\n // New feature\n addFeature({\n ...e,\n properties: {\n description: ''\n }\n })\n\n // Update the features\n renderList()\n toggleActionButtons(false)\n focusDescriptionInput()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin edits a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawEditedFactory(context) {\n const { featuresManager, activeFeatureManager, uiManager } = context\n const { updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Callback when a draw feature has been edited\n * @param {{ id: string, geometry: Geometry }} e\n */\n return function onDrawEdited(e) {\n const changedFeature = e\n const featureId = changedFeature.id\n\n if (getActiveFeature() === featureId) {\n updateFeature(featureId, changedFeature.geometry)\n\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin cancels the editing of a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCancelledFactory(context) {\n const { uiManager, activeFeatureManager } = context\n const { toggleActionButtons, renderList } = uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback when a draw feature has been cancelled\n */\n return function onDrawCancelled() {\n toggleActionButtons(false)\n resetActiveFeature()\n renderList()\n }\n}\n\n/**\n * Callback factory function that fires when an interact marker has been changed\n * @param {Context} context - the UI context\n */\nfunction onInteractMarkerChangedFactory(context) {\n const {\n featuresManager,\n activeFeatureManager,\n map,\n interactPlugin,\n uiManager\n } = context\n const { addFeature, updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, focusDescriptionInput, toggleActionButtons } = uiManager\n\n /**\n * Callback when an interact marker has been changed\n * @param {{ coords: Coordinates }} e\n */\n return function onInteractMarkerChange(e) {\n const activeFeatureId = getActiveFeature()\n\n if (activeFeatureId) {\n // Editing an existing point\n const feature = updateFeature(activeFeatureId, {\n type: 'Point',\n coordinates: e.coords\n })\n\n map.addMarker(activeFeatureId, e.coords)\n\n if (feature) {\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n } else {\n // Adding a new point\n const id = generateID()\n addFeature({\n type: 'Feature',\n properties: {\n description: ''\n },\n geometry: {\n type: 'Point',\n coordinates: e.coords\n },\n id\n })\n\n map.addMarker(id, e.coords)\n\n // Update the features\n renderList()\n\n focusDescriptionInput()\n }\n map.removeMarker('location')\n\n interactPlugin.disable()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function that fires a 'click' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElClickFactory(context) {\n const {\n map,\n mapProvider,\n featuresManager,\n activeFeatureManager,\n interactPlugin,\n uiManager,\n drawPlugin\n } = context\n const { getFeature, removeFeature } = featuresManager\n const { getActiveFeature, setActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Delete a feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function deleteFeature(id, type) {\n if (type === 'Point') {\n map.removeMarker(id)\n removeFeature(id)\n } else {\n drawPlugin.deleteFeature(id)\n removeFeature(id)\n }\n\n renderList()\n }\n\n /**\n * Start editing feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function editFeature(id, type) {\n setActiveFeature(id)\n\n // \"Change\" feature link was clicked\n if (type === 'Point') {\n interactPlugin.selectFeature({ featureId: id })\n interactPlugin.enable()\n } else {\n drawPlugin.editFeature(id)\n }\n\n const feature = getFeature(id)\n if (feature && mapProvider) {\n focusFeature(feature, mapProvider)\n }\n\n toggleActionButtons(true)\n renderList(true)\n }\n\n /**\n * List container delegated 'click' events handler\n * @param {MouseEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n if (getActiveFeature()) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n\n if (\n target.tagName === 'A' &&\n target.dataset.action &&\n target.dataset.id &&\n target.dataset.type\n ) {\n const { action, id, type } = target.dataset\n\n if (action === 'edit') {\n // \"Update\" feature link was clicked\n editFeature(id, type)\n } else {\n e.preventDefault()\n e.stopPropagation()\n\n if (action === 'delete') {\n // \"Remove\" feature link was clicked\n deleteFeature(id, type)\n }\n }\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'change' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElChangeFactory(context) {\n const { featuresManager, uiManager } = context\n const { getFeature } = featuresManager\n const { renderValue } = uiManager\n\n /**\n * List container delegated 'change' events handler\n * Used to update the description of features\n * @param {Event} e\n */\n return function (e) {\n e.preventDefault()\n e.stopPropagation()\n\n const target = e.target\n if (!(target instanceof HTMLInputElement) || !target.dataset.id) {\n return\n }\n\n const { id } = target.dataset\n const feature = getFeature(id)\n\n if (feature) {\n feature.properties.description = target.value.trim()\n renderValue()\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'keydown' event is fired on the list container\n */\nfunction onListElKeydownFactory() {\n /**\n * List container delegated 'keydown' events handler\n * Fixes the issue of pressing \"Enter\" key in the description input triggering the map search\n * @param {KeyboardEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLInputElement)) {\n return\n }\n\n if (e.code === 'Enter' || e.code === 'NumpadEnter') {\n e.preventDefault()\n e.stopPropagation()\n }\n }\n}\n\n/**\n * @import { MapsEnvironmentConfig, InteractiveMap } from '~/src/client/javascripts/map.js'\n */\n\n/**\n * @import { Geometry, FeatureCollection, Feature, Coordinates } from '~/src/server/plugins/engine/types.js'\n */\n\n/**\n * @typedef {object} GeoJSON\n * @property {'FeatureCollection'} type - the GeoJSON type string\n * @property {FeatureCollection} features - the features\n */\n\n/**\n * Gets all the features\n * @callback GetFeatures\n * @returns {FeatureCollection}\n */\n\n/**\n * Gets a feature from the geojson by id\n * @callback GetFeature\n * @param {string} id - the feature id\n * @returns {Feature | undefined}\n */\n\n/**\n * Add a feature to the geojson\n * @callback AddFeature\n * @param {Feature} feature - the feature to add\n */\n\n/**\n * Update a feature in the geojson\n * @callback UpdateFeature\n * @param {string} id - the feature id\n * @param {Geometry} geometry - the feature geometry\n * @returns {Feature | undefined}\n */\n\n/**\n * Removes a feature from the geojson\n * @callback RemoveFeature\n * @param {string} id - the feature id\n */\n\n/**\n * Gets the active feature id\n * @callback GetActiveFeature\n * @returns {string | undefined}\n */\n\n/**\n * Set the active feature id\n * @callback SetActiveFeature\n * @param {string} id - the feature id\n * @returns {void}\n */\n\n/**\n * Resets the active feature id\n * @callback ResetActiveFeature\n * @returns {void}\n */\n\n/**\n * Renders the features into the list\n * @callback RenderList\n * @param {boolean} [disabled] - whether to render the list with disabled links\n * @returns {void}\n */\n\n/**\n * Renders the features JSON into the hidden textarea\n * @callback RenderValue\n * @returns {void}\n */\n\n/**\n * Toggles the action button hidden state\n * @callback ToggleActionButtons\n * @param {boolean} hidden - whether to hide the action buttons\n * @returns {void}\n */\n\n/**\n * Set focus to the last description input\n * @callback FocusDescriptionInput\n * @returns {void}\n */\n\n/**\n * @typedef {object} FeaturesManager\n * @property {GetFeatures} getFeatures - function that gets all the features\n * @property {GetFeature} getFeature - function that gets a feature from the geojson\n * @property {AddFeature} addFeature - function that adds feature to the geojson\n * @property {UpdateFeature} updateFeature - function that updates a feature in the geojson\n * @property {RemoveFeature} removeFeature - function that removes a feature from the geojson\n */\n\n/**\n * @typedef {object} ActiveFeatureManager\n * @property {GetActiveFeature} getActiveFeature - function that returns the current active feature id\n * @property {SetActiveFeature} setActiveFeature - function that sets the current active feature id\n * @property {ResetActiveFeature} resetActiveFeature - function that resets the current active feature id\n */\n\n/**\n * @typedef {object} UIManager\n * @property {RenderValue} renderValue - function that renders the features JSON into the hidden textarea\n * @property {RenderList} renderList - function that renders the features into the list\n * @property {HTMLDivElement} listEl - the summary list of features\n * @property {ToggleActionButtons} toggleActionButtons - function that toggles the action buttons\n * @property {FocusDescriptionInput} focusDescriptionInput - function that sets focus to a description input element\n */\n\n/**\n * @typedef {object} Context\n * @property {InteractiveMap} map - the interactive map\n * @property {MapLibreMap} [mapProvider] - the interactive map provider\n * @property {FeaturesManager} featuresManager - the features manager\n * @property {ActiveFeatureManager} activeFeatureManager - the active feature manager\n * @property {UIManager} uiManager - the UI manager\n * @property {any} interactPlugin - the map interact plugin\n * @property {any} drawPlugin - the map draw plugin\n */\n\n/**\n * @import { MapLibreMap } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AAEjC,SACEC,MAAM,EACNC,SAAS,EACTC,aAAa,EACbC,kBAAkB,EAClBC,oBAAoB;AAGtB,MAAMC,eAAe,GAAG;EACtBC,SAAS,EAAE,IAAI;EACfC,KAAK,EAAE,qBAAqB;EAC5BC,MAAM,EAAE;IACNC,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE,IAAI;IACVC,WAAW,EAAE,IAAI;IACjBC,KAAK,EAA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AACA;AACA;EACE,OAAO,UAAUtB,CAAC,EAAE;IAClB,MAAMqC,MAAM,GAAGrC,CAAC,CAACqC,MAAM;IAEvB,IAAI,EAAEA,MAAM,YAAYM,gBAAgB,CAAC,EAAE;MACzC;IACF;IAEA,IAAI3C,CAAC,CAAC4C,IAAI,KAAK,OAAO,IAAI5C,CAAC,CAAC4C,IAAI,KAAK,aAAa,EAAE;MAClD5C,CAAC,CAACuC,cAAc,CAAC,CAAC;MAClBvC,CAAC,CAACwC,eAAe,CAAC,CAAC;IACrB;EACF,CAAC;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"geospatial-map.js","names":["bbox","EVENTS","createMap","defaultConfig","getCentroidGridRef","getCoordinateGridRef","formatDelimtedList","helpPanelConfig","showLabel","label","mobile","slot","open","dismissible","modal","tablet","desktop","getLineOrShapeText","allowLine","allowShape","getAllowedTypesPhrase","allowPoint","items","push","getHelpPanelHtml","lineOrShapeText","doneExtra","allowedTypesText","lineFeatureProperties","stroke","fill","strokeWidth","polygonFeatureProperties","typeDescriptions","Point","LineString","Polygon","POINT_SVG","POLYGON_SVG","LINE_SVG","getGeoJSON","geospatialInput","value","trim","hasValue","features","JSON","parse","geojson","type","getBoundingBox","processGeospatial","config","geospatial","index","defra","window","HTMLDivElement","querySelector","HTMLTextAreaElement","listEl","mapId","createContainers","bounds","length","undefined","drawPlugin","drawMLPlugin","plugins","country","dataset","datasetsPlugin","datasetsMaplibrePlugin","datasets","id","apiPath","showInKey","showInMenu","style","initConfig","map","interactPlugin","featuresManager","getFeaturesManager","activeFeatureManager","getActiveFeatureManager","geometryTypes","geometrytypes","options","uiManager","getUIManager","context","addEventListeners","addFeatureToMap","feature","geometry","addFeature","addMarker","coordinates","createFeaturesHTML","disabled","readonly","createFeatureHTML","join","focusFeature","mapProvider","fitBounds","flattened","flat","points","i","slice","p","description","properties","changeAction","deleteAction","focusAction","links","actions","centroidGridReference","coordinateGridReference","generateID","crypto","randomUUID","activeFeature","getActiveFeature","setActiveFeature","resetActiveFeature","prepareGeometry","maxPrecision","formatPrecision","toFixed","forEach","getFeatures","getFeature","find","f","updateFeature","removeFeature","idx","findIndex","splice","getListRenderer","renderValue","renderList","html","innerHTML","getValueRenderer","stringify","getAllowableGeometryTypes","split","toggleActionButtons","hidden","types","includes","toggleButtonState","focusDescriptionInput","inputs","querySelectorAll","lastInput","item","focus","select","on","mapReady","onMapReadyFactory","mapEl","document","createElement","setAttribute","listId","after","classList","add","onMapReady","e","addPanel","addButton","variant","iconSvgContent","onClick","enable","newPolygon","newLine","drawReady","onDrawReadyFactory","drawCreated","onDrawCreatedFactory","drawEdited","onDrawEditedFactory","drawCancelled","onDrawCancelledFactory","interactMarkerChange","onInteractMarkerChangedFactory","addEventListener","onListElClickFactory","onListElChangeFactory","onListElKeydownFactory","onDrawReady","onDrawCreated","onDrawEdited","changedFeature","featureId","onDrawCancelled","onInteractMarkerChange","activeFeatureId","coords","removeMarker","disable","deleteFeature","editFeature","selectFeature","target","HTMLElement","preventDefault","stopPropagation","tagName","action","HTMLInputElement","code"],"sources":["../../../src/client/javascripts/geospatial-map.js"],"sourcesContent":["import { bbox } from '@turf/bbox'\n\nimport {\n EVENTS,\n createMap,\n defaultConfig,\n getCentroidGridRef,\n getCoordinateGridRef\n} from '~/src/client/javascripts/map.js'\nimport { formatDelimtedList } from '~/src/client/javascripts/utils.js'\n\nconst helpPanelConfig = {\n showLabel: true,\n label: 'How to use this map',\n mobile: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n tablet: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n },\n desktop: {\n slot: 'drawer',\n open: true,\n dismissible: true,\n modal: false\n }\n}\n\n/**\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nfunction getLineOrShapeText(allowLine, allowShape) {\n if (allowLine && allowShape) {\n return 'a line or shape'\n }\n if (allowLine) {\n return 'a line'\n }\n if (allowShape) {\n return 'a shape'\n }\n return ''\n}\n\n/**\n * @param {boolean} allowPoint\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nfunction getAllowedTypesPhrase(allowPoint, allowLine, allowShape) {\n const items = []\n\n if (allowPoint) {\n items.push('points')\n }\n if (allowLine) {\n items.push('lines')\n }\n if (allowShape) {\n items.push('shapes')\n }\n\n return formatDelimtedList(items, ',', 'or')\n}\n\n/**\n * @param {boolean} allowPoint\n * @param {boolean} allowLine\n * @param {boolean} allowShape\n */\nexport function getHelpPanelHtml(allowPoint, allowLine, allowShape) {\n const lineOrShapeText = getLineOrShapeText(allowLine, allowShape)\n const doneExtra = lineOrShapeText\n ? `<li>Double‑click, or select 'Done', when you have finished drawing ${lineOrShapeText}</li>`\n : ''\n const allowedTypesText = getAllowedTypesPhrase(\n allowPoint,\n allowLine,\n allowShape\n )\n return `<p class=\"govuk-body-s govuk-!-margin-bottom-2\">You can add ${allowedTypesText} to the map.</p><ul class=\"govuk-list govuk-list--number govuk-body-s\"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li>${doneExtra}<li>Give the location a name</li></ul>`\n}\n\nconst lineFeatureProperties = {\n stroke: 'rgba(0, 11, 112, 1)',\n fill: 'rgba(0, 11, 112, 0.2)',\n strokeWidth: 2\n}\n\nconst polygonFeatureProperties = {\n stroke: 'rgb(0, 0, 0)',\n fill: 'rgba(255, 221, 0, 0.2)',\n strokeWidth: 2\n}\n\n/**\n * @type {Record<'Point' | 'LineString' | 'Polygon', string>}\n */\nconst typeDescriptions = {\n Point: 'Point',\n LineString: 'Line',\n Polygon: 'Shape'\n}\n\nconst POINT_SVG =\n '<path d=\"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0\" /><circle cx=\"12\" cy=\"10\" r=\"3\" />'\nconst POLYGON_SVG =\n '<path d=\"M19.5 7v10M4.5 7v10M7 19.5h10M7 4.5h10\"/><path d=\"M22 18v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm0-15v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 18v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 3v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1z\"/>'\nconst LINE_SVG =\n '<path d=\"M5.706 16.294L16.294 5.706\"/><path d=\"M21 2v3c0 .549-.451 1-1 1h-3c-.549 0-1-.451-1-1V2c0-.549.451-1 1-1h3c.549 0 1 .451 1 1zM6 17v3c0 .549-.451 1-1 1H2c-.549 0-1-.451-1-1v-3c0-.549.451-1 1-1h3c.549 0 1 .451 1 1z\"/>'\n\n/**\n * Extract and parses the GeoJSON from the textarea\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n */\nexport function getGeoJSON(geospatialInput) {\n const value = geospatialInput.value.trim()\n const hasValue = !!value\n\n /** @type {FeatureCollection} */\n const features = hasValue ? JSON.parse(value) : []\n\n /** @type {GeoJSON} */\n const geojson = {\n type: 'FeatureCollection',\n features\n }\n\n return geojson\n}\n\n/**\n * Gets the bounding box covering a feature collection\n * @param {GeoJSON} geojson - the geojson\n */\nexport function getBoundingBox(geojson) {\n return bbox(geojson)\n}\n\n/**\n * Processes a geospatial field to add map capability\n * @param {MapsEnvironmentConfig} config - the geospatial field element\n * @param {Element} geospatial - the geospatial field element\n * @param {number} index - the 0-based index\n */\nexport function processGeospatial(config, geospatial, index) {\n // @ts-expect-error - Defra namespace currently comes from UMD support files\n const defra = window.defra\n\n if (!(geospatial instanceof HTMLDivElement)) {\n return\n }\n\n const geospatialInput = geospatial.querySelector('.govuk-textarea')\n if (!(geospatialInput instanceof HTMLTextAreaElement)) {\n return\n }\n\n const { listEl, mapId } = createContainers(geospatialInput, index)\n const geojson = getGeoJSON(geospatialInput)\n const bounds = geojson.features.length ? getBoundingBox(geojson) : undefined\n const drawPlugin = defra.drawMLPlugin()\n const plugins = [drawPlugin]\n const country = geospatial.dataset.country\n\n if (country) {\n // Add the country bounds as a dataset plugin to show the valid area on the map\n // and provide feedback to the user when they add features outside of the bounds.\n const datasetsPlugin = defra.datasetsMaplibrePlugin({\n datasets: [\n {\n id: 'invalid-area',\n label: 'Invalid areas',\n geojson: `${config.apiPath}/maps/countries.geojson?omit=${country}`,\n showInKey: false,\n showInMenu: false,\n style: {\n stroke: 'gray',\n strokeWidth: 1,\n fill: 'rgba(211,211,211,0.8)'\n }\n },\n {\n id: 'valid-area',\n label: 'Valid areas',\n geojson: `${config.apiPath}/maps/countries.geojson?only=${country}`,\n showInKey: false,\n showInMenu: false,\n style: {\n stroke: 'rgba(0,112,60,1)',\n strokeWidth: 1\n }\n }\n ]\n })\n\n plugins.push(datasetsPlugin)\n }\n\n const initConfig = {\n ...defaultConfig,\n bounds,\n plugins\n }\n\n const { map, interactPlugin } = createMap(mapId, initConfig, config)\n const featuresManager = getFeaturesManager(geojson)\n const activeFeatureManager = getActiveFeatureManager()\n const geometryTypes = geospatial.dataset.geometrytypes ?? 'point,line,shape'\n const options = {\n geometryTypes\n }\n const uiManager = getUIManager(\n geojson,\n map,\n mapId,\n listEl,\n geospatialInput,\n options\n )\n\n /**\n * @type {Context}\n */\n const context = {\n map,\n featuresManager,\n activeFeatureManager,\n uiManager,\n interactPlugin,\n drawPlugin\n }\n\n addEventListeners(context)\n}\n\n/**\n * Adds a feature to the map\n * @param {Feature} feature - the geojson feature\n * @param {any} drawPlugin - the map draw plugin\n * @param {InteractiveMap} map - the interactive map\n */\nexport function addFeatureToMap(feature, drawPlugin, map) {\n switch (feature.geometry.type) {\n case 'Polygon':\n drawPlugin.addFeature({ ...feature, ...polygonFeatureProperties })\n break\n case 'LineString':\n drawPlugin.addFeature({ ...feature, ...lineFeatureProperties })\n break\n case 'Point':\n map.addMarker(feature.id, feature.geometry.coordinates)\n break\n default:\n break\n }\n}\n\n/**\n * Returns HTML summary list for the features\n * @param {FeatureCollection} features - the features\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list in readonly mode\n */\nexport function createFeaturesHTML(\n features,\n mapId,\n disabled = false,\n readonly = false\n) {\n return `<dl class=\"govuk-summary-list\">\n ${features.map((feature, index) => createFeatureHTML(feature, index, mapId, disabled, readonly)).join('\\n')}\n </dl>`\n}\n\n/**\n * Focus feature\n * @param {Feature} feature - the feature\n * @param {MapLibreMap} mapProvider - the feature id\n */\nexport function focusFeature(feature, mapProvider) {\n mapProvider.fitBounds(bbox(feature))\n}\n\n/**\n * Returns HTML summary row for an single feature\n * @param {Feature} feature - the geo feature\n * @param {number} index - the feature index\n * @param {string} mapId - the ID of the map\n * @param {boolean} [disabled] - render the list with disabled links\n * @param {boolean} [readonly] - render the list item in readonly mode\n */\nexport function createFeatureHTML(\n feature,\n index,\n mapId,\n disabled = false,\n readonly = false\n) {\n const flattened = feature.geometry.coordinates.flat(2)\n\n const points = []\n for (let i = 0; i < flattened.length; i += 2) {\n points.push(flattened.slice(i, i + 2).join(', '))\n }\n const coordinates = points.map((p) => `<li>${p}</li>`).join('')\n\n const description = readonly\n ? `<p class=\"govuk-body govuk-!-margin-bottom-0\">${feature.properties.description}</p>`\n : `<input class=\"govuk-input govuk-!-width-two-thirds\" type=\"text\" id=\"description_${index}\" value=\"${feature.properties.description}\" data-id=\"${feature.id}\">`\n\n // Change action link\n const changeAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#${mapId}\" data-action=\"edit\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">Update<span class=\"govuk-visually-hidden\"> location</span></a>\n</li>`\n\n // Delete action link\n const deleteAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state ${disabled ? 'govuk-link--disabled' : ''}\" href=\"#\" data-action=\"delete\" data-id=\"${feature.id}\"\n data-type=\"${feature.geometry.type}\">Delete<span class=\"govuk-visually-hidden\"> location</span></a>\n</li>`\n\n // Focus action link\n const focusAction = () => `<li class=\"govuk-summary-list__actions-list-item\">\n <a class=\"govuk-link govuk-link--no-visited-state\" href=\"#${mapId}\" data-action=\"focus\" data-id=\"${feature.id}\">Show<span class=\"govuk-visually-hidden\"> location</span></a>\n</li>`\n\n const links = readonly ? focusAction() : `${changeAction()}${deleteAction()}`\n\n const actions = `<ul class=\"govuk-summary-list__actions-list\">${links}</ul>`\n\n return `<div class=\"govuk-summary-list__row govuk-summary-list__row--no-border\">\n <dt class=\"govuk-summary-list__key\">\n <div class=\"govuk-form-group\">\n <label class=\"govuk-label govuk-label--s\" ${readonly ? '' : `for=\"description_${index}\"`}>Location ${index + 1} description</label>\n ${description}\n </div>\n </dt>\n <dd class=\"govuk-summary-list__actions\">\n ${actions}\n </dd>\n</div>\n<div class=\"govuk-summary-list__row\">\n <details class=\"govuk-details govuk-!-margin-bottom-2\">\n <summary class=\"govuk-details__summary\">\n <span class=\"govuk-details__summary-text\">Coordinates</span>\n </summary>\n <div class=\"govuk-details__text\">\n <dl class=\"govuk-summary-list\">\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">Type</dt>\n <dd class=\"govuk-summary-list__value\">${typeDescriptions[feature.geometry.type]}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">Centre grid reference</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.centroidGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">First point grid reference</dt>\n <dd class=\"govuk-summary-list__value\">${feature.properties.coordinateGridReference}</dd>\n </div>\n <div class=\"govuk-summary-list__row\">\n <dt class=\"govuk-summary-list__key\">Detailed coordinates</dt>\n <dd class=\"govuk-summary-list__value\">\n <ol class=\"govuk-list govuk-list--number\">${coordinates}</ol>\n </dd>\n </div>\n </dl>\n </div>\n </details>\n</div>`\n}\n\n/**\n * Generate a random id\n */\nfunction generateID() {\n return window.crypto.randomUUID()\n}\n\n/**\n * Factory closure to track the active feature id\n * @returns {ActiveFeatureManager}\n */\nfunction getActiveFeatureManager() {\n /** @type {string | undefined} */\n let activeFeature\n\n /**\n * Returns the active feature id\n * @type {GetActiveFeature}\n */\n function getActiveFeature() {\n return activeFeature\n }\n\n /**\n * Sets the active feature id\n * @type {SetActiveFeature}\n */\n function setActiveFeature(id) {\n activeFeature = id\n }\n\n /**\n * Resets the active feature id\n * @type {ResetActiveFeature}\n */\n function resetActiveFeature() {\n activeFeature = undefined\n }\n\n return {\n getActiveFeature,\n setActiveFeature,\n resetActiveFeature\n }\n}\n\n/**\n * Reduce coordinate precision to 7 dps\n * @param {Feature} feature\n */\nfunction prepareGeometry(feature) {\n const { geometry } = feature\n const maxPrecision = 7\n\n /**\n * @param {Coordinates} coordinates\n */\n function formatPrecision(coordinates) {\n coordinates[0] = +coordinates[0].toFixed(maxPrecision)\n coordinates[1] = +coordinates[1].toFixed(maxPrecision)\n }\n\n if (geometry.type === 'Point') {\n formatPrecision(geometry.coordinates)\n } else if (geometry.type === 'LineString') {\n geometry.coordinates.forEach(formatPrecision)\n } else {\n geometry.coordinates.flat().forEach(formatPrecision)\n }\n}\n\n/**\n * Factory closure to return a features manager\n * @param {GeoJSON} geojson\n * @returns {FeaturesManager}\n */\nfunction getFeaturesManager(geojson) {\n /**\n * Get a feature from the geojson by id\n * @type {GetFeatures}\n */\n function getFeatures() {\n return geojson.features\n }\n\n /**\n * Get a feature from the geojson by id\n * @type {GetFeature}\n */\n function getFeature(id) {\n return geojson.features.find((f) => f.id === id)\n }\n\n /**\n * Add a feature to the geojson\n * @type {AddFeature}\n */\n function addFeature(feature) {\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n prepareGeometry(feature)\n\n geojson.features.push(feature)\n }\n\n /**\n * Updates a feature in the geojson\n * @type {UpdateFeature}\n */\n function updateFeature(id, geometry) {\n const feature = getFeature(id)\n\n // Ensure the feature exists in the geojson\n if (feature) {\n feature.properties.coordinateGridReference = getCoordinateGridRef(feature)\n feature.properties.centroidGridReference = getCentroidGridRef(feature)\n feature.geometry = geometry\n prepareGeometry(feature)\n }\n\n return feature\n }\n\n /**\n * Removes a feature from the geojson\n * @type {RemoveFeature}\n */\n function removeFeature(id) {\n const idx = geojson.features.findIndex((f) => f.id === id)\n\n return idx > -1 ? geojson.features.splice(idx, 1) : undefined\n }\n\n return {\n getFeatures,\n getFeature,\n addFeature,\n updateFeature,\n removeFeature\n }\n}\n\n/**\n * Factory to render features into the list and hidden textarea\n * @param {GeoJSON} geojson - the geojson of features\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {Function} renderValue - function that renders the features JSON into the hidden textarea\n * @returns {RenderList}\n */\nfunction getListRenderer(geojson, mapId, listEl, renderValue) {\n return function renderList(disabled = false) {\n const html = createFeaturesHTML(geojson.features, mapId, disabled)\n\n listEl.innerHTML = html\n\n renderValue()\n }\n}\n\n/**\n * Factory to render features JSON into the hidden textarea\n * @param {GeoJSON} geojson - the features\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @returns {RenderValue}\n */\nfunction getValueRenderer(geojson, geospatialInput) {\n return function renderValue() {\n geospatialInput.value = JSON.stringify(geojson.features, null, 2)\n }\n}\n\n/**\n * Factory closure to manage the UI\n * @param {GeoJSON} geojson - the features\n * @param {InteractiveMap} map - the map\n * @param {string} mapId - the ID of the map\n * @param {HTMLDivElement} listEl - where to render the feature list\n * @param {HTMLTextAreaElement} geospatialInput - the geospatial textarea\n * @param {UIManagerOptions} options - extra options such as allowable geometry types\n */\nfunction getUIManager(geojson, map, mapId, listEl, geospatialInput, options) {\n /**\n * Get a CSV list of geometry types the user can create\n * @returns {string[]}\n */\n function getAllowableGeometryTypes() {\n return options.geometryTypes ? options.geometryTypes.split(',') : []\n }\n\n /**\n * Toggle the hidden state of the action buttons\n * @type {ToggleActionButtons}\n */\n function toggleActionButtons(hidden) {\n const types = getAllowableGeometryTypes()\n if (types.includes('point')) {\n map.toggleButtonState('btnAddPoint', 'hidden', hidden)\n }\n if (types.includes('shape')) {\n map.toggleButtonState('btnAddPolygon', 'hidden', hidden)\n }\n if (types.includes('line')) {\n map.toggleButtonState('btnAddLine', 'hidden', hidden)\n }\n }\n\n /**\n * Set focus to the last description input\n * @type {FocusDescriptionInput}\n */\n function focusDescriptionInput() {\n const inputs = listEl.querySelectorAll('input')\n if (inputs.length) {\n const lastInput = /** @type {HTMLInputElement} */ inputs.item(\n inputs.length - 1\n )\n lastInput.focus()\n lastInput.select()\n }\n }\n\n const renderValue = getValueRenderer(geojson, geospatialInput)\n const renderList = getListRenderer(geojson, mapId, listEl, renderValue)\n\n /** @type {UIManager} */\n return {\n renderList,\n renderValue,\n listEl,\n toggleActionButtons,\n focusDescriptionInput,\n getAllowableGeometryTypes\n }\n}\n\n/**\n * Setup the UI event listeners\n * @param {Context} context - the context\n */\nfunction addEventListeners(context) {\n const { map } = context\n\n map.on(EVENTS.mapReady, onMapReadyFactory(context))\n}\n\n/**\n * Create the map and list containers and adds them to the DOM\n * @param {HTMLTextAreaElement} geospatialInput - the textarea containing the geojson\n * @param {number} index - the 0 based index\n */\nfunction createContainers(geospatialInput, index) {\n const mapEl = document.createElement('div')\n const mapId = `geospatialmap_${index}`\n\n mapEl.setAttribute('id', mapId)\n mapEl.setAttribute('class', 'map-container')\n\n const listEl = document.createElement('div')\n const listId = `${mapId}_list`\n listEl.setAttribute('id', listId)\n\n geospatialInput.after(mapEl)\n mapEl.after(listEl)\n geospatialInput.classList.add('js-hidden')\n\n return { mapEl, listEl, mapId }\n}\n\n/**\n * Callback factory function which fires when the map is ready\n * @param {Context} context - the UI context\n */\nfunction onMapReadyFactory(context) {\n const { map, activeFeatureManager, uiManager, interactPlugin, drawPlugin } =\n context\n const { toggleActionButtons, renderList, getAllowableGeometryTypes } =\n uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback function which fires when the map is ready\n * @param {object} e - the event\n * @param {MapLibreMap} e.map - the map provider instance\n */\n return function onMapReady(e) {\n const types = getAllowableGeometryTypes()\n const allowPoint = types.includes('point')\n const allowLine = types.includes('line')\n const allowShape = types.includes('shape')\n\n // Add info panel\n map.addPanel('info', {\n ...helpPanelConfig,\n html: getHelpPanelHtml(allowPoint, allowLine, allowShape)\n })\n\n if (allowPoint) {\n map.addButton('btnAddPoint', {\n variant: 'tertiary',\n label: 'Add point',\n iconSvgContent: POINT_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n interactPlugin.enable()\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n if (allowShape) {\n map.addButton('btnAddPolygon', {\n variant: 'tertiary',\n label: 'Add shape',\n iconSvgContent: POLYGON_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newPolygon(generateID(), polygonFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n if (allowLine) {\n map.addButton('btnAddLine', {\n variant: 'tertiary',\n label: 'Add line',\n iconSvgContent: LINE_SVG,\n onClick: () => {\n resetActiveFeature()\n toggleActionButtons(true)\n renderList(true)\n drawPlugin.newLine(generateID(), lineFeatureProperties)\n },\n mobile: { slot: 'actions' },\n tablet: { slot: 'actions' },\n desktop: { slot: 'actions' }\n })\n }\n\n // Set the map provider on the context\n context.mapProvider = e.map\n\n map.on(EVENTS.drawReady, onDrawReadyFactory(context))\n map.on(EVENTS.drawCreated, onDrawCreatedFactory(context))\n map.on(EVENTS.drawEdited, onDrawEditedFactory(context))\n map.on(EVENTS.drawCancelled, onDrawCancelledFactory(context))\n map.on(EVENTS.interactMarkerChange, onInteractMarkerChangedFactory(context))\n\n const { listEl } = uiManager\n listEl.addEventListener('click', onListElClickFactory(context), false)\n listEl.addEventListener('change', onListElChangeFactory(context), false)\n listEl.addEventListener('keydown', onListElKeydownFactory(), false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin is ready\n * @param {Context} context - the UI context\n */\nfunction onDrawReadyFactory(context) {\n const { featuresManager, uiManager, drawPlugin, map } = context\n const { renderList } = uiManager\n const { getFeatures } = featuresManager\n\n /**\n * Callback when the draw plugin is ready\n */\n return function onDrawReady() {\n getFeatures().forEach((feature) =>\n addFeatureToMap(feature, drawPlugin, map)\n )\n\n // Update the features\n renderList()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin creates a new feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCreatedFactory(context) {\n const { featuresManager, uiManager } = context\n const { addFeature } = featuresManager\n const { renderList, toggleActionButtons, focusDescriptionInput } = uiManager\n\n /**\n * Callback when a draw feature has been created\n * @param {Feature} e\n */\n return function onDrawCreated(e) {\n // New feature\n addFeature({\n ...e,\n properties: {\n description: ''\n }\n })\n\n // Update the features\n renderList()\n toggleActionButtons(false)\n focusDescriptionInput()\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin edits a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawEditedFactory(context) {\n const { featuresManager, activeFeatureManager, uiManager } = context\n const { updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Callback when a draw feature has been edited\n * @param {{ id: string, geometry: Geometry }} e\n */\n return function onDrawEdited(e) {\n const changedFeature = e\n const featureId = changedFeature.id\n\n if (getActiveFeature() === featureId) {\n updateFeature(featureId, changedFeature.geometry)\n\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function which fires when the map draw plugin cancels the editing of a feature\n * @param {Context} context - the UI context\n */\nfunction onDrawCancelledFactory(context) {\n const { uiManager, activeFeatureManager } = context\n const { toggleActionButtons, renderList } = uiManager\n const { resetActiveFeature } = activeFeatureManager\n\n /**\n * Callback when a draw feature has been cancelled\n */\n return function onDrawCancelled() {\n toggleActionButtons(false)\n resetActiveFeature()\n renderList()\n }\n}\n\n/**\n * Callback factory function that fires when an interact marker has been changed\n * @param {Context} context - the UI context\n */\nfunction onInteractMarkerChangedFactory(context) {\n const {\n featuresManager,\n activeFeatureManager,\n map,\n interactPlugin,\n uiManager\n } = context\n const { addFeature, updateFeature } = featuresManager\n const { getActiveFeature, resetActiveFeature } = activeFeatureManager\n const { renderList, focusDescriptionInput, toggleActionButtons } = uiManager\n\n /**\n * Callback when an interact marker has been changed\n * @param {{ coords: Coordinates }} e\n */\n return function onInteractMarkerChange(e) {\n const activeFeatureId = getActiveFeature()\n\n if (activeFeatureId) {\n // Editing an existing point\n const feature = updateFeature(activeFeatureId, {\n type: 'Point',\n coordinates: e.coords\n })\n\n map.addMarker(activeFeatureId, e.coords)\n\n if (feature) {\n // Update the features\n renderList()\n }\n\n resetActiveFeature()\n } else {\n // Adding a new point\n const id = generateID()\n addFeature({\n type: 'Feature',\n properties: {\n description: ''\n },\n geometry: {\n type: 'Point',\n coordinates: e.coords\n },\n id\n })\n\n map.addMarker(id, e.coords)\n\n // Update the features\n renderList()\n\n focusDescriptionInput()\n }\n map.removeMarker('location')\n\n interactPlugin.disable()\n toggleActionButtons(false)\n }\n}\n\n/**\n * Callback factory function that fires a 'click' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElClickFactory(context) {\n const {\n map,\n mapProvider,\n featuresManager,\n activeFeatureManager,\n interactPlugin,\n uiManager,\n drawPlugin\n } = context\n const { getFeature, removeFeature } = featuresManager\n const { getActiveFeature, setActiveFeature } = activeFeatureManager\n const { renderList, toggleActionButtons } = uiManager\n\n /**\n * Delete a feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function deleteFeature(id, type) {\n if (type === 'Point') {\n map.removeMarker(id)\n removeFeature(id)\n } else {\n drawPlugin.deleteFeature(id)\n removeFeature(id)\n }\n\n renderList()\n }\n\n /**\n * Start editing feature\n * @param {string} id - the feature id\n * @param {string} type - the feature type\n */\n function editFeature(id, type) {\n setActiveFeature(id)\n\n // \"Change\" feature link was clicked\n if (type === 'Point') {\n interactPlugin.selectFeature({ featureId: id })\n interactPlugin.enable()\n } else {\n drawPlugin.editFeature(id)\n }\n\n const feature = getFeature(id)\n if (feature && mapProvider) {\n focusFeature(feature, mapProvider)\n }\n\n toggleActionButtons(true)\n renderList(true)\n }\n\n /**\n * List container delegated 'click' events handler\n * @param {MouseEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n if (getActiveFeature()) {\n e.preventDefault()\n e.stopPropagation()\n return\n }\n\n if (\n target.tagName === 'A' &&\n target.dataset.action &&\n target.dataset.id &&\n target.dataset.type\n ) {\n const { action, id, type } = target.dataset\n\n if (action === 'edit') {\n // \"Update\" feature link was clicked\n editFeature(id, type)\n } else {\n e.preventDefault()\n e.stopPropagation()\n\n if (action === 'delete') {\n // \"Remove\" feature link was clicked\n deleteFeature(id, type)\n }\n }\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'change' event is fired on the list container\n * @param {Context} context - the UI context\n */\nfunction onListElChangeFactory(context) {\n const { featuresManager, uiManager } = context\n const { getFeature } = featuresManager\n const { renderValue } = uiManager\n\n /**\n * List container delegated 'change' events handler\n * Used to update the description of features\n * @param {Event} e\n */\n return function (e) {\n e.preventDefault()\n e.stopPropagation()\n\n const target = e.target\n if (!(target instanceof HTMLInputElement) || !target.dataset.id) {\n return\n }\n\n const { id } = target.dataset\n const feature = getFeature(id)\n\n if (feature) {\n feature.properties.description = target.value.trim()\n renderValue()\n }\n }\n}\n\n/**\n * Callback factory function that fires when a 'keydown' event is fired on the list container\n */\nfunction onListElKeydownFactory() {\n /**\n * List container delegated 'keydown' events handler\n * Fixes the issue of pressing \"Enter\" key in the description input triggering the map search\n * @param {KeyboardEvent} e\n */\n return function (e) {\n const target = e.target\n\n if (!(target instanceof HTMLInputElement)) {\n return\n }\n\n if (e.code === 'Enter' || e.code === 'NumpadEnter') {\n e.preventDefault()\n e.stopPropagation()\n }\n }\n}\n\n/**\n * @import { MapsEnvironmentConfig, InteractiveMap } from '~/src/client/javascripts/map.js'\n */\n\n/**\n * @import { Geometry, FeatureCollection, Feature, Coordinates } from '~/src/server/plugins/engine/types.js'\n */\n\n/**\n * @typedef {object} GeoJSON\n * @property {'FeatureCollection'} type - the GeoJSON type string\n * @property {FeatureCollection} features - the features\n */\n\n/**\n * Gets all the features\n * @callback GetFeatures\n * @returns {FeatureCollection}\n */\n\n/**\n * Gets a feature from the geojson by id\n * @callback GetFeature\n * @param {string} id - the feature id\n * @returns {Feature | undefined}\n */\n\n/**\n * Add a feature to the geojson\n * @callback AddFeature\n * @param {Feature} feature - the feature to add\n */\n\n/**\n * Update a feature in the geojson\n * @callback UpdateFeature\n * @param {string} id - the feature id\n * @param {Geometry} geometry - the feature geometry\n * @returns {Feature | undefined}\n */\n\n/**\n * Removes a feature from the geojson\n * @callback RemoveFeature\n * @param {string} id - the feature id\n */\n\n/**\n * Gets the active feature id\n * @callback GetActiveFeature\n * @returns {string | undefined}\n */\n\n/**\n * Set the active feature id\n * @callback SetActiveFeature\n * @param {string} id - the feature id\n * @returns {void}\n */\n\n/**\n * Resets the active feature id\n * @callback ResetActiveFeature\n * @returns {void}\n */\n\n/**\n * Renders the features into the list\n * @callback RenderList\n * @param {boolean} [disabled] - whether to render the list with disabled links\n * @returns {void}\n */\n\n/**\n * Renders the features JSON into the hidden textarea\n * @callback RenderValue\n * @returns {void}\n */\n\n/**\n * Toggles the action button hidden state\n * @callback ToggleActionButtons\n * @param {boolean} hidden - whether to hide the action buttons\n * @returns {void}\n */\n\n/**\n * Returns the list of geometry types a user can create\n * @callback GetAllowableGeometryTypes\n * @returns {string[]}\n */\n\n/**\n * Set focus to the last description input\n * @callback FocusDescriptionInput\n * @returns {void}\n */\n\n/**\n * @typedef {object} FeaturesManager\n * @property {GetFeatures} getFeatures - function that gets all the features\n * @property {GetFeature} getFeature - function that gets a feature from the geojson\n * @property {AddFeature} addFeature - function that adds feature to the geojson\n * @property {UpdateFeature} updateFeature - function that updates a feature in the geojson\n * @property {RemoveFeature} removeFeature - function that removes a feature from the geojson\n */\n\n/**\n * @typedef {object} ActiveFeatureManager\n * @property {GetActiveFeature} getActiveFeature - function that returns the current active feature id\n * @property {SetActiveFeature} setActiveFeature - function that sets the current active feature id\n * @property {ResetActiveFeature} resetActiveFeature - function that resets the current active feature id\n */\n\n/**\n * @typedef {object} UIManager\n * @property {RenderValue} renderValue - function that renders the features JSON into the hidden textarea\n * @property {RenderList} renderList - function that renders the features into the list\n * @property {HTMLDivElement} listEl - the summary list of features\n * @property {ToggleActionButtons} toggleActionButtons - function that toggles the action buttons\n * @property {FocusDescriptionInput} focusDescriptionInput - function that sets focus to a description input element\n * @property {GetAllowableGeometryTypes} getAllowableGeometryTypes - function that returns the array of geometry types a user can create\n */\n\n/**\n * @typedef {object} Context\n * @property {InteractiveMap} map - the interactive map\n * @property {MapLibreMap} [mapProvider] - the interactive map provider\n * @property {FeaturesManager} featuresManager - the features manager\n * @property {ActiveFeatureManager} activeFeatureManager - the active feature manager\n * @property {UIManager} uiManager - the UI manager\n * @property {any} interactPlugin - the map interact plugin\n * @property {any} drawPlugin - the map draw plugin\n */\n\n/**\n * @import { MapLibreMap, UIManagerOptions } from '~/src/client/javascripts/map.js'\n */\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AAEjC,SACEC,MAAM,EACNC,SAAS,EACTC,aAAa,EACbC,kBAAkB,EAClBC,oBAAoB;AAEtB,SAASC,kBAAkB;AAE3B,MAAMC,eAAe,GAAG;EACtBC,SAAS,EAAE,IAAI;EACfC,KAAK,EAAE,qBAAqB;EAC5BC,MAAM,EAAE;IACNC,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE,IAAI;IACVC,WAAW,EAAE,IAAI;IACjBC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE;IACNJ,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE,IAAI;IACVC,WAAW,EAAE,IAAI;IACjBC,KAAK,EAAE;EACT,CAAC;EACDE,OAAO,EAAE;IACPL,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE,IAAI;IACVC,WAAW,EAAE,IAAI;IACjBC,KAAK,EAAE;EACT;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,SAASG,kBAAkBA,CAACC,SAAS,EAAEC,UAAU,EAAE;EACjD,IAAID,SAAS,IAAIC,UAAU,EAAE;IAC3B,OAAO,iBAAiB;EAC1B;EACA,IAAID,SAAS,EAAE;IACb,OAAO,QAAQ;EACjB;EACA,IAAIC,UAAU,EAAE;IACd,OAAO,SAAS;EAClB;EACA,OAAO,EAAE;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASC,qBAAqBA,CAACC,UAAU,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E;MACXA,OAAO,CAACoB,UAAU,CAACD,WAAW,GAAGoG,MAAM,CAAC3K,KAAK,CAACC,IAAI,CAAC,CAAC;MACpDqG,WAAW,CAAC,CAAC;IACf;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,SAASsD,sBAAsBA,CAAA,EAAG;EAChC;AACF;AACA;AACA;AACA;EACE,OAAO,UAAUtB,CAAC,EAAE;IAClB,MAAMqC,MAAM,GAAGrC,CAAC,CAACqC,MAAM;IAEvB,IAAI,EAAEA,MAAM,YAAYM,gBAAgB,CAAC,EAAE;MACzC;IACF;IAEA,IAAI3C,CAAC,CAAC4C,IAAI,KAAK,OAAO,IAAI5C,CAAC,CAAC4C,IAAI,KAAK,aAAa,EAAE;MAClD5C,CAAC,CAACuC,cAAc,CAAC,CAAC;MAClBvC,CAAC,CAACwC,eAAe,CAAC,CAAC;IACrB;EACF,CAAC;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA","ignoreList":[]}
@@ -200,4 +200,10 @@ export type MapsEnvironmentConfig = {
200
200
  */
201
201
  data: TileData;
202
202
  };
203
+ export type UIManagerOptions = {
204
+ /**
205
+ * - the CSV list of geometry types that a user can create
206
+ */
207
+ geometryTypes?: string | undefined;
208
+ };
203
209
  import type { Feature } from '../../server/plugins/engine/types.js';
@@ -388,6 +388,11 @@ export function centerMap(map, mapProvider, center) {
388
388
  * @property {TileData} data - the tile data config
389
389
  */
390
390
 
391
+ /**
392
+ * @typedef {object} UIManagerOptions
393
+ * @property {string} [geometryTypes] - the CSV list of geometry types that a user can create
394
+ */
395
+
391
396
  /**
392
397
  * @import { Feature } from '../../server/plugins/engine/types.js'
393
398
  */