@defra/interactive-map 0.0.41-alpha → 0.0.42-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +7 -8
- package/docs/api/control-definition.md +8 -0
- package/docs/api/panel-definition.md +5 -0
- package/docs/api/slots.md +24 -1
- package/docs/examples/add-polygons.mdx +8 -2
- package/docs/examples/add-symbols.mdx +8 -2
- package/docs/plugins/datasets.md +23 -15
- package/docs/plugins/map-key.md +147 -0
- package/docs/plugins.md +5 -1
- package/package.json +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/src/manifest.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/api/createNewShape.js +41 -0
- package/plugins/draw/src/api/createNewShape.test.js +63 -0
- package/plugins/draw/src/api/newLine.js +2 -40
- package/plugins/draw/src/api/newPolygon.js +2 -40
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/manifest.js +1 -1
- package/plugins/map-key/dist/css/index.css +6 -0
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/src/components/Key/Key.jsx +5 -3
- package/plugins/map-key/src/components/Key/Key.module.scss +6 -0
- package/plugins/map-key/src/components/Key/KeyItem.jsx +5 -8
- package/plugins/map-key/src/components/Key/KeySvg.jsx +21 -22
- package/plugins/map-key/src/components/Key/KeySvgLine.jsx +3 -9
- package/plugins/map-key/src/components/Key/KeySvgPattern.jsx +2 -7
- package/plugins/map-key/src/components/Key/KeySvgPattern.test.jsx +6 -0
- package/plugins/map-key/src/components/Key/KeySvgRect.jsx +4 -11
- package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +5 -11
- package/plugins/map-key/src/components/Key/KeySvgSymbol.test.jsx +12 -0
- package/plugins/map-key/src/components/Key/MapKey.jsx +5 -2
- package/plugins/map-key/src/components/Key/MapKey.test.jsx +28 -11
- package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +25 -23
- package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +22 -5
- package/src/App/components/Panel/Panel.jsx +50 -8
- package/src/App/components/Panel/Panel.module.scss +31 -7
- package/src/App/components/Panel/Panel.test.jsx +81 -2
- package/src/App/components/Tabs/Tabs.jsx +43 -17
- package/src/App/components/Tabs/Tabs.module.scss +32 -5
- package/src/App/components/Tabs/Tabs.test.jsx +40 -10
- package/src/App/renderer/groupByKey.js +28 -0
- package/src/App/renderer/groupByKey.test.js +39 -0
- package/src/App/renderer/groupIntoTabs.js +42 -0
- package/src/App/renderer/groupIntoTabs.test.js +95 -0
- package/src/App/renderer/mapButtons.js +74 -122
- package/src/App/renderer/mapButtons.test.js +51 -80
- package/src/App/renderer/mapControls.js +1 -0
- package/src/App/renderer/mapControls.test.js +16 -0
- package/src/App/renderer/mapPanels.js +26 -19
- package/src/App/renderer/mapPanels.test.js +44 -0
- package/src/config/appConfig.js +2 -2
- package/src/types.js +20 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Map Key Plugin
|
|
2
|
+
|
|
3
|
+
Renders a key of symbols present on the map, in a key panel.
|
|
4
|
+
|
|
5
|
+
Today, the [Datasets](./datasets.md) plugin is wired up to it via a dedicated hook — datasets and sublayers configured with `showInKey: true` feed their styled symbols into the key panel automatically. Other plugins may hook into the key panel in future, but that isn't built yet; Datasets is currently the only integration.
|
|
6
|
+
|
|
7
|
+
The plugin holds no dataset-specific config itself — when paired with the Datasets plugin, it reads dataset styling from that plugin's registry at runtime via that hook. There's nothing to configure to make that connection; both plugins just need to be present in `plugins`.
|
|
8
|
+
|
|
9
|
+
> [!NOTE]
|
|
10
|
+
> Buttons render in the shared `top-left` slot in the order their plugins appear in the `plugins` array — list `datasetsPlugin` before `mapKeyPlugin` to get Layers before Key.
|
|
11
|
+
|
|
12
|
+
## ESM usage
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'
|
|
16
|
+
import createMapKeyPlugin from '@defra/interactive-map/plugins/map-key'
|
|
17
|
+
|
|
18
|
+
const datasetsPlugin = createDatasetsPlugin({
|
|
19
|
+
datasets: [
|
|
20
|
+
{
|
|
21
|
+
id: 'my-parcels',
|
|
22
|
+
label: 'My parcels',
|
|
23
|
+
geojson: 'https://example.com/api/parcels',
|
|
24
|
+
showInKey: true,
|
|
25
|
+
showInMenu: true,
|
|
26
|
+
style: {
|
|
27
|
+
stroke: '#d4351c',
|
|
28
|
+
strokeWidth: 2,
|
|
29
|
+
fill: 'transparent'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const mapKeyPlugin = createMapKeyPlugin()
|
|
36
|
+
|
|
37
|
+
const interactiveMap = new InteractiveMap({
|
|
38
|
+
plugins: [datasetsPlugin, mapKeyPlugin]
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## UMD usage
|
|
43
|
+
|
|
44
|
+
Copy the entire `plugins/map-key/dist/umd/` directory to `/your-assets-path/plugins/map-key/umd/`. The plugin uses dynamic imports, so all files in the directory must be served from the same location. Then add the script tag alongside the Datasets plugin's:
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<script defer src="/your-assets-path/plugins/datasets/umd/index.js"></script>
|
|
48
|
+
<script defer src="/your-assets-path/plugins/map-key/umd/index.js"></script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const datasetsPlugin = defra.datasetsPlugin({
|
|
53
|
+
datasets: [
|
|
54
|
+
{
|
|
55
|
+
id: 'my-parcels',
|
|
56
|
+
label: 'My parcels',
|
|
57
|
+
geojson: 'https://example.com/api/parcels',
|
|
58
|
+
showInKey: true,
|
|
59
|
+
showInMenu: true,
|
|
60
|
+
style: {
|
|
61
|
+
stroke: '#d4351c',
|
|
62
|
+
strokeWidth: 2,
|
|
63
|
+
fill: 'transparent'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const mapKeyPlugin = defra.mapKeyPlugin()
|
|
70
|
+
|
|
71
|
+
const interactiveMap = new defra.InteractiveMap('map', {
|
|
72
|
+
mapProvider: defra.maplibreProvider(),
|
|
73
|
+
plugins: [datasetsPlugin, mapKeyPlugin]
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> [!NOTE]
|
|
78
|
+
> **GOV.UK Prototype Kit** — skip the copy step. All files are served automatically. Use this path instead:
|
|
79
|
+
> ```html
|
|
80
|
+
> <script defer src="/plugin-assets/%40defra%2Finteractive-map/plugins/map-key/dist/umd/index.js"></script>
|
|
81
|
+
> ```
|
|
82
|
+
|
|
83
|
+
## Options
|
|
84
|
+
|
|
85
|
+
Options are passed to the factory function when creating the plugin.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### `noKeyItemText`
|
|
90
|
+
|
|
91
|
+
**Type:** `string`
|
|
92
|
+
**Default:** `'No features displayed'`
|
|
93
|
+
|
|
94
|
+
Text shown in the key panel when it has no visible entries to display — for example, no datasets or sublayers configured with `showInKey: true` currently have visible features on the map.
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
createMapKeyPlugin({ noKeyItemText: 'No layers to show' })
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### `includeModes`
|
|
103
|
+
|
|
104
|
+
**Type:** `string[]`
|
|
105
|
+
|
|
106
|
+
When set, the plugin only initialises when the app is in one of the specified modes.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### `excludeModes`
|
|
111
|
+
|
|
112
|
+
**Type:** `string[]`
|
|
113
|
+
|
|
114
|
+
When set, the plugin does not initialise when the app is in one of the specified modes.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Key display properties
|
|
119
|
+
|
|
120
|
+
These properties control how an entry looks in the key panel — they have no effect on how a feature renders on the map itself. Today the only way to set them is via a dataset's [`style`](./datasets.md#style) object, since Datasets is the only plugin feeding this key panel.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### `keySymbolShape`
|
|
125
|
+
|
|
126
|
+
**Type:** `'polygon' | 'line'`
|
|
127
|
+
**Default:** `'polygon'`
|
|
128
|
+
|
|
129
|
+
Overrides the shape used to render a polygon/line entry's symbol in the key.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### `symbolDescription`
|
|
134
|
+
|
|
135
|
+
**Type:** `string | Record<string, string>`
|
|
136
|
+
|
|
137
|
+
Accessible description of the symbol shown alongside its key entry.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Methods
|
|
142
|
+
|
|
143
|
+
This plugin does not expose any public methods.
|
|
144
|
+
|
|
145
|
+
## Events
|
|
146
|
+
|
|
147
|
+
This plugin does not emit any custom events.
|
package/docs/plugins.md
CHANGED
|
@@ -30,7 +30,11 @@ The following plugins are in early development. APIs and features may change.
|
|
|
30
30
|
|
|
31
31
|
### [Datasets](./plugins/datasets.md)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Render GeoJSON and vector tile datasets on the map, with a menu for toggling layer visibility. Pair with the [Map Key](./plugins/map-key.md) plugin to render a key of symbols.
|
|
34
|
+
|
|
35
|
+
### [Map Key](./plugins/map-key.md)
|
|
36
|
+
|
|
37
|
+
Renders a key of symbols in a panel. Currently sourced from the Datasets plugin.
|
|
34
38
|
|
|
35
39
|
### [Draw](./plugins/draw.md)
|
|
36
40
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[657],{
|
|
1
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[657],{47(e,t,i){i.r(t),i.d(t,{manifest:()=>u});var s=i(738),r="app:ready",a=i(287);new Map;var l=Object.freeze({SIDE:"side",HEADER:"header",BANNER:"banner",TOP_LEFT:"top-left",TOP_MIDDLE:"top-middle",TOP_RIGHT:"top-right",LEFT_TOP:"left-top",LEFT_BOTTOM:"left-bottom",MIDDLE:"middle",RIGHT_TOP:"right-top",RIGHT_BOTTOM:"right-bottom",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",DRAWER:"drawer",ACTIONS:"actions",MODAL:"modal"});function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function m(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach(function(t){c(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function c(e,t,i){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Object.freeze({control:[l.HEADER,l.BANNER,l.TOP_LEFT,l.TOP_RIGHT,l.MIDDLE,l.RIGHT_TOP,l.RIGHT_BOTTOM,l.BOTTOM_RIGHT,l.DRAWER,l.ACTIONS],panel:[l.SIDE,l.HEADER,l.BANNER,l.LEFT_TOP,l.LEFT_BOTTOM,l.MIDDLE,l.RIGHT_TOP,l.RIGHT_BOTTOM,l.DRAWER,l.MODAL],button:[l.TOP_LEFT,l.TOP_MIDDLE,l.TOP_RIGHT,l.LEFT_TOP,l.LEFT_BOTTOM,l.RIGHT_TOP,l.RIGHT_BOTTOM,l.BOTTOM_LEFT,l.BOTTOM_RIGHT,l.ACTIONS]});var p={slot:"middle",open:!1,dismissible:!0,modal:!0},d=(m({},p),m(m({},p),{},{width:"500px"}),m(m({},p),{},{width:"500px"}),{small:1,medium:1.5,large:2}),u={InitComponent:function(e){var t=e.pluginConfig,i=e.services.eventBus,l=function(){i.emit("map:initmapstyles",t.mapStyles)};return(0,s.useEffect)(function(){return i.on(r,l),function(){return i.off(r,l)}},[]),(0,a.jsx)(a.Fragment,{})},panels:[{id:"mapStyles",label:"Map styles",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",modal:!0,width:"400px",dismissible:!0},desktop:{slot:"left-top",modal:!0,width:"400px",dismissible:!0},render:function(e){var t=e.mapState,i=e.pluginConfig,s=e.services,r=e.mapProvider,l=t.mapStyle,n=t.mapSize,o=i.mapStyles,m=s.eventBus,c=r.capabilities.supportsMapSizes;return(0,a.jsxs)("div",{className:"im-c-map-styles",children:[(0,a.jsx)("div",{className:"im-c-map-styles__group",children:(0,a.jsx)("div",{className:"im-c-map-styles__inner",children:o.filter(function(e){return e.url}).map(function(e){return(0,a.jsx)("div",{className:"im-c-map-styles__item",children:(0,a.jsxs)("button",{className:"im-c-map-styles__button","aria-pressed":e.id===l.id,onClick:function(){return t=e,void m.emit("map:setstyle",t);var t},children:[(0,a.jsx)("div",{className:"im-c-map-styles__image",children:(0,a.jsx)("img",{src:e.thumbnail||void 0,alt:"",height:"60",width:"60"})}),e.label]})},e.id)})})}),c&&(0,a.jsxs)("div",{className:"im-c-map-styles__group",children:[(0,a.jsx)("h3",{className:"im-c-map-styles__heading",id:"map-text-sizes",children:"Map size"}),(0,a.jsx)("div",{className:"im-c-map-styles__inner",children:["small","medium","large"].map(function(e){return(0,a.jsx)("div",{className:"im-c-map-styles__item",children:(0,a.jsxs)("button",{className:"im-c-map-styles__button",onClick:function(){return t=e,m.emit("map:setsize",t),void m.emit("map:setpixelratio",window.devicePixelRatio*d[t]);var t},"aria-pressed":e===n,children:[(0,a.jsx)("div",{className:"im-c-map-styles__image",children:(0,a.jsxs)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fillRule:"evenodd",children:[(0,a.jsx)("rect",{className:"im-c-map-styles__image-bg",width:"100%",height:"100%"}),(0,a.jsx)("g",{style:{transform:"scale(".concat(d[e],")"),transformOrigin:"8px 52px"},children:(0,a.jsx)("path",{d:"M8 51.785L12.948 38.9h1.837l5.274 12.885h-1.943l-1.503-3.903h-5.387l-1.415 3.903H8zm3.718-5.291h4.368l-1.345-3.569-.914-2.671c-.164.826-.395 1.646-.694 2.46l-1.415 3.78zm15.592 4.139c-3.698 3.143-7.836.271-6.315-2.562.963-1.794 5.529-1.982 6.183-2.21.022-.825.052-2.27-2.241-2.312-1.751-.031-2.242 1.025-2.435 1.776l-1.547-.211c.234-1.102.963-2.856 4.21-2.874 4.037-.022 3.612 2.962 3.612 3.524v2.11c0 .315 0 3.012.501 3.911h-1.652c-.164-.328-.27-.712-.316-1.152zm-.132-3.533c-.907.37-3.444.694-3.964.914-1.293.548-.911 2.399.225 2.637.639.134 3.739.476 3.739-2.971v-.58z"})})]})}),e[0].toUpperCase()+e.slice(1)]})},e)})})]})]})}}],buttons:[{id:"mapStyles",label:"Styles",panelId:"mapStyles",iconId:"map",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"map",svgContent:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>'}]}}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.mapStylesPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-map-styles-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.mapStylesPlugin:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==a)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+a){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+a),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=a);var i=o.p+o.u(t),u=new Error;o.l(i,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,u,c]=r,f=0;if(i.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<i.length;f++)a=i[f],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function i(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var i=n&&n.prototype instanceof f?n:f,p=Object.create(i.prototype);return u(p,"_invoke",function(r,n,o){var a,i,u,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,i=0,u=e,s.n=r,c}};function d(r,n){for(i=r,u=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,a=p[t],d=s.p,v=a[2];r>3?(o=v===n)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(i=0,s.v=n,s.n=a[1]):d<v&&(o=r<3||a[0]>n||n>v)&&(a[4]=r,a[5]=n,s.n=v,i=0))}if(o||r>1)return c;throw l=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,v),i=p,u=v;(t=i<2?e:u)||!l;){a||(i?i<3?(i>1&&(s.n=-1),d(i,u)):s.n=u:s.v=u);try{if(f=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(l=s.n<0)?u:r.call(n,s))!==c)break}catch(t){a=e,i=1,u=t}finally{f=1}}return{value:t,done:l}}}(r,o,a),!0),p}var c={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,u(d,"constructor",l),u(l,"constructor",p),p.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function a(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:r.manifest,mapStyles:r.mapStyles,load:(e=i().m(function e(){var t;return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(657).then(o.bind(o,
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.mapStylesPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-map-styles-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.mapStylesPlugin:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==a)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+a){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+a),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=a);var i=o.p+o.u(t),u=new Error;o.l(i,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,u,c]=r,f=0;if(i.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<i.length;f++)a=i[f],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function i(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var i=n&&n.prototype instanceof f?n:f,p=Object.create(i.prototype);return u(p,"_invoke",function(r,n,o){var a,i,u,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,i=0,u=e,s.n=r,c}};function d(r,n){for(i=r,u=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,a=p[t],d=s.p,v=a[2];r>3?(o=v===n)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(i=0,s.v=n,s.n=a[1]):d<v&&(o=r<3||a[0]>n||n>v)&&(a[4]=r,a[5]=n,s.n=v,i=0))}if(o||r>1)return c;throw l=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,v),i=p,u=v;(t=i<2?e:u)||!l;){a||(i?i<3?(i>1&&(s.n=-1),d(i,u)):s.n=u:s.v=u);try{if(f=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(l=s.n<0)?u:r.call(n,s))!==c)break}catch(t){a=e,i=1,u=t}finally{f=1}}return{value:t,done:l}}}(r,o,a),!0),p}var c={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,u(d,"constructor",l),u(l,"constructor",p),p.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function a(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:r.manifest,mapStyles:r.mapStyles,load:(e=i().m(function e(){var t;return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(657).then(o.bind(o,47));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,u,"next",e)}function u(e){c(a,n,o,i,u,"throw",e)}i(void 0)})},function(){return t.apply(this,arguments)}),handlesMapStyle:!0,api:{}}}return o.d(a,{default:()=>f}),a.default})());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e}from"preact/compat";import{jsx as t}from"preact/jsx-runtime";import o from"@babel/runtime/helpers/defineProperty";function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var i={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."};var a={slot:"right-top",showLabel:!1},l={InitComponent:function(t){var{appConfig:o,appState:r,pluginState:n,mapState:a,mapProvider:l,buttonConfig:c}=t,{useLocation:s}=c;return e(()=>{if(a.isMapReady)return function(e){var{appState:t,pluginState:o,mapProvider:r,useLocationButton:n}=e,{dispatch:a,buttonRefs:l}=t,{dispatch:c}=o,s=e=>e&&"number"==typeof e.code&&i[e.code]||i.FALLBACK;n.onClick=()=>{navigator.geolocation.getCurrentPosition(e=>{var{latitude:t,longitude:o}=e.coords;try{r.setView({center:[o,t],zoom:12})}catch(e){console.log("Map provider failed to pan:",e)}},e=>{var t=s(e),o=l.current[n.id];c({type:"SET_ERROR_MESSAGE",payload:t}),a({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:o}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})};var p=null}({appState:r,pluginState:n,mapProvider:l,useLocationButton:s}),()=>{s.onClick=null}},[a.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:{SET_ERROR_MESSAGE:(e,t)=>n(n({},e),{},{errorMessage:t})}},buttons:[{id:"useLocation",group:{
|
|
1
|
+
import{useEffect as e}from"preact/compat";import{jsx as t}from"preact/jsx-runtime";import o from"@babel/runtime/helpers/defineProperty";function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var i={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."};var a={slot:"right-top",showLabel:!1},l={InitComponent:function(t){var{appConfig:o,appState:r,pluginState:n,mapState:a,mapProvider:l,buttonConfig:c}=t,{useLocation:s}=c;return e(()=>{if(a.isMapReady)return function(e){var{appState:t,pluginState:o,mapProvider:r,useLocationButton:n}=e,{dispatch:a,buttonRefs:l}=t,{dispatch:c}=o,s=e=>e&&"number"==typeof e.code&&i[e.code]||i.FALLBACK;n.onClick=()=>{navigator.geolocation.getCurrentPosition(e=>{var{latitude:t,longitude:o}=e.coords;try{r.setView({center:[o,t],zoom:12})}catch(e){console.log("Map provider failed to pan:",e)}},e=>{var t=s(e),o=l.current[n.id];c({type:"SET_ERROR_MESSAGE",payload:t}),a({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:o}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})};var p=null}({appState:r,pluginState:n,mapProvider:l,useLocationButton:s}),()=>{s.onClick=null}},[a.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:{SET_ERROR_MESSAGE:(e,t)=>n(n({},e),{},{errorMessage:t})}},buttons:[{id:"useLocation",group:{label:"Location",slotOrder:0},label:"Use your location",iconId:"locateFixed",keepFocus:!0,hiddenWhen:()=>!navigator.geolocation,mobile:a,tablet:a,desktop:a}],panels:[{id:"useLocation",label:"Problem getting your location",mobile:{slot:"banner",open:!1,dismissible:!0,modal:!0},tablet:{slot:"banner",open:!1,dismissible:!0,modal:!0},desktop:{slot:"banner",open:!1,dismissible:!0,modal:!0},render:e=>{var{pluginState:o}=e,{errorMessage:r}=o;return t("div",{className:"im-c-use-location",children:t("p",{children:r})})}}],icons:[{id:"locateFixed",svgContent:'<line x1="2" x2="5" y1="12" y2="12"/><line x1="19" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="5"/><line x1="12" x2="12" y1="19" y2="22"/><circle cx="12" cy="12" r="7"/><circle cx="12" cy="12" r="3"/>'}]};export{l as manifest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[419],{528(e,t,o){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function i(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach(function(t){a(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function a(e,t,o){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}o.r(t),o.d(t,{manifest:()=>b});var c={SET_ERROR_MESSAGE:function(e,t){return i(i({},e),{},{errorMessage:t})}},l=o(738),u={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."},s=o(287),p={slot:"right-top",showLabel:!1},b={InitComponent:function(e){e.appConfig;var t=e.appState,o=e.pluginState,n=e.mapState,r=e.mapProvider,i=e.buttonConfig.useLocation;return(0,l.useEffect)(function(){if(n.isMapReady)return function(e){var t=e.appState,o=e.pluginState,n=e.mapProvider,r=e.useLocationButton,i=t.dispatch,a=t.buttonRefs,c=o.dispatch;r.onClick=function(){navigator.geolocation.getCurrentPosition(function(e){var t=e.coords,o=t.latitude,r=t.longitude;try{n.setView({center:[r,o],zoom:12})}catch(e){console.log("Map provider failed to pan:",e)}},function(e){var t=function(e){return e&&"number"==typeof e.code&&u[e.code]||u.FALLBACK}(e),o=a.current[r.id];c({type:"SET_ERROR_MESSAGE",payload:t}),i({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:o}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})}}({appState:t,pluginState:o,mapProvider:r,useLocationButton:i}),function(){i.onClick=null}},[n.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:c},buttons:[{id:"useLocation",group:{
|
|
1
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[419],{528(e,t,o){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function i(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach(function(t){a(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function a(e,t,o){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}o.r(t),o.d(t,{manifest:()=>b});var c={SET_ERROR_MESSAGE:function(e,t){return i(i({},e),{},{errorMessage:t})}},l=o(738),u={PERMISSION_DENIED:"Location permission denied. Please enable it in your browser settings.",POSITION_UNAVAILABLE:"Location information is unavailable.",TIMEOUT:"The location request timed out. Please try again.",FALLBACK:"Unable to get your location."},s=o(287),p={slot:"right-top",showLabel:!1},b={InitComponent:function(e){e.appConfig;var t=e.appState,o=e.pluginState,n=e.mapState,r=e.mapProvider,i=e.buttonConfig.useLocation;return(0,l.useEffect)(function(){if(n.isMapReady)return function(e){var t=e.appState,o=e.pluginState,n=e.mapProvider,r=e.useLocationButton,i=t.dispatch,a=t.buttonRefs,c=o.dispatch;r.onClick=function(){navigator.geolocation.getCurrentPosition(function(e){var t=e.coords,o=t.latitude,r=t.longitude;try{n.setView({center:[r,o],zoom:12})}catch(e){console.log("Map provider failed to pan:",e)}},function(e){var t=function(e){return e&&"number"==typeof e.code&&u[e.code]||u.FALLBACK}(e),o=a.current[r.id];c({type:"SET_ERROR_MESSAGE",payload:t}),i({type:"OPEN_PANEL",payload:{panelId:"useLocation",props:{triggeringElement:o}}})},{enableHighAccuracy:!0,maximumAge:0,timeout:1e4})}}({appState:t,pluginState:o,mapProvider:r,useLocationButton:i}),function(){i.onClick=null}},[n.isMapReady]),null},reducer:{initialState:{errorMessage:null},actions:c},buttons:[{id:"useLocation",group:{label:"Location",slotOrder:0},label:"Use your location",iconId:"locateFixed",keepFocus:!0,hiddenWhen:function(){return!navigator.geolocation},mobile:p,tablet:p,desktop:p}],panels:[{id:"useLocation",label:"Problem getting your location",mobile:{slot:"banner",open:!1,dismissible:!0,modal:!0},tablet:{slot:"banner",open:!1,dismissible:!0,modal:!0},desktop:{slot:"banner",open:!1,dismissible:!0,modal:!0},render:function(e){var t=e.pluginState.errorMessage;return(0,s.jsx)("div",{className:"im-c-use-location",children:(0,s.jsx)("p",{children:t})})}}],icons:[{id:"locateFixed",svgContent:'<line x1="2" x2="5" y1="12" y2="12"/><line x1="19" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="5"/><line x1="12" x2="12" y1="19" y2="22"/><circle cx="12" cy="12" r="7"/><circle cx="12" cy="12" r="3"/>'}]}}}]);
|