File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313//= link static-error-pages.js
1414
1515//= link_tree ../builds
16- //= link_tree ../../javascript .js
17- //= link_tree ../../../vendor/javascript .js
16+
17+ //= link @defra/interactive-map/dist/esm/index.js
18+ //= link @defra/interactive-map/providers/maplibre/dist/esm/index.js
19+ //= link @defra/interactive-map/plugins/interact/dist/esm/index.js
Original file line number Diff line number Diff line change 22window . GOVUK = window . GOVUK || { }
33window . GOVUK . Modules = window . GOVUK . Modules || { } ;
44
5+ import InteractiveMap from '@defra/interactive-map'
6+ import maplibreProvider from '@defra/interactive-map/providers/maplibre'
7+
58( function ( Modules ) {
69 class Map {
710 constructor ( $module ) {
@@ -15,7 +18,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
1518 } )
1619
1720 const config = {
18- mapProvider : defra . maplibreProvider ( { workerUrl : cspWorker } ) ,
21+ mapProvider : maplibreProvider ( { workerUrl : cspWorker } ) ,
1922 behaviour : 'inline' ,
2023 mapStyle : {
2124 url : window . GOVUK . mapComponentStyles ,
@@ -54,7 +57,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
5457 this . map_element . setAttribute ( 'id' , id )
5558 this . map_element . classList . add ( 'app-c-map--enabled' )
5659
57- this . map = new defra . InteractiveMap ( this . map_id , this . config )
60+ this . map = new InteractiveMap ( this . map_id , this . config )
5861
5962 /* istanbul ignore next */
6063 this . map . on ( 'map:ready' , ( ) => {
Original file line number Diff line number Diff line change 3737 @include_script ||= OpenStruct.new(script_included: false)
3838%>
3939<% if heading_text && ((map_config[:center] && map_config[:zoom]) || (markers || !geojson.nil?)) %>
40+ <%= javascript_importmap_tags %>
4041 <%= render "govuk_publishing_components/components/heading", heading_obj %>
4142 <% if description %>
4243 <%= render "govuk_publishing_components/components/govspeak", {} do %>
6465 <% end %>
6566
6667 <% unless @include_script [ :script_included ] %>
67- <%= javascript_include_tag "components/map/defra-map.js" , integrity : false %>
6868 <%= javascript_include_tag "components/map.js" , integrity : false , type : "module" %>
69- <%= javascript_include_tag "components/map/map-style-liberty.js" , integrity : false %>
7069 <% @include_script [ :script_included ] = true %>
7170 <% end %>
7271
Original file line number Diff line number Diff line change 11# Pin npm packages by running ./bin/importmap
22
3- pin "application"
3+ pin "@defra/interactive-map" , to : "@defra/interactive-map/dist/esm/index.js"
4+ pin "@defra/interactive-map/providers/maplibre" , to : "@defra/interactive-map/providers/maplibre/dist/esm/index.js"
5+ pin "@defra/interactive-map/plugins/interact" , to : "@defra/interactive-map/plugins/interact/dist/esm/index.js"
6+ pin "components/map" , to : "components/map.js"
You can’t perform that action at this time.
0 commit comments