@defra/interactive-map 0.0.7-alpha → 0.0.9-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.
Files changed (86) hide show
  1. package/assets/templates/map.njk +2 -2
  2. package/dist/esm/im-core.js +1 -2
  3. package/dist/esm/im-shell.js +1 -0
  4. package/dist/esm/index.js +1 -2
  5. package/dist/umd/im-core.js +1 -1
  6. package/dist/umd/index.js +1 -1
  7. package/docs/api/button-definition.md +104 -3
  8. package/docs/api.md +21 -1
  9. package/docs/getting-started.md +78 -8
  10. package/package.json +31 -24
  11. package/plugins/beta/datasets/dist/css/index.css +50 -1
  12. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -2
  13. package/plugins/beta/datasets/dist/esm/index.js +1 -2
  14. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -2
  15. package/plugins/beta/draw-es/dist/esm/index.js +1 -2
  16. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
  17. package/plugins/beta/draw-ml/dist/esm/index.js +1 -2
  18. package/plugins/beta/frame/dist/css/index.css +11 -1
  19. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
  20. package/plugins/beta/frame/dist/esm/index.js +1 -2
  21. package/plugins/beta/map-styles/dist/css/index.css +79 -1
  22. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
  23. package/plugins/beta/map-styles/dist/esm/index.js +1 -2
  24. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
  25. package/plugins/beta/scale-bar/dist/esm/index.js +1 -2
  26. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
  27. package/plugins/beta/use-location/dist/esm/index.js +1 -2
  28. package/plugins/beta/use-location/dist/umd/index.js +1 -1
  29. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  30. package/plugins/interact/dist/esm/index.js +1 -2
  31. package/plugins/search/dist/esm/im-search-plugin.js +1 -2
  32. package/plugins/search/dist/esm/index.js +1 -2
  33. package/plugins/search/src/components/Suggestions/Suggestions.module.scss +1 -1
  34. package/plugins/search/src/search.scss +1 -1
  35. package/providers/beta/esri/dist/css/index.css +30 -0
  36. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -2
  37. package/providers/beta/esri/dist/esm/index.js +1 -2
  38. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -2
  39. package/providers/beta/open-names/dist/esm/index.js +1 -2
  40. package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +61 -0
  41. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -2
  42. package/providers/maplibre/dist/esm/index.js +1 -2
  43. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  44. package/providers/maplibre/src/appEvents.test.js +44 -0
  45. package/providers/maplibre/src/index.test.js +60 -0
  46. package/providers/maplibre/src/mapEvents.test.js +115 -0
  47. package/providers/maplibre/src/maplibreProvider.test.js +205 -0
  48. package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +31 -0
  49. package/providers/maplibre/src/utils/detectWebgl.test.js +63 -0
  50. package/providers/maplibre/src/utils/highlightFeatures.test.js +126 -0
  51. package/providers/maplibre/src/utils/labels.js +1 -3
  52. package/providers/maplibre/src/utils/labels.test.js +231 -0
  53. package/providers/maplibre/src/utils/maplibreFixes.test.js +66 -0
  54. package/providers/maplibre/src/utils/queryFeatures.test.js +60 -0
  55. package/providers/maplibre/src/utils/spatial.js +5 -4
  56. package/providers/maplibre/src/utils/spatial.test.js +96 -0
  57. package/rollup.esm.mjs +288 -0
  58. package/src/App/store/appActionsMap.js +1 -1
  59. package/src/InteractiveMap/InteractiveMap.js +3 -2
  60. package/webpack.dev.mjs +9 -1
  61. package/webpack.prod.mjs +8 -1
  62. package/webpack.umd.mjs +1 -3
  63. package/dist/esm/im-core.js.LICENSE.txt +0 -1
  64. package/dist/esm/index.js.LICENSE.txt +0 -1
  65. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt +0 -1
  66. package/plugins/beta/datasets/dist/esm/index.js.LICENSE.txt +0 -1
  67. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js.LICENSE.txt +0 -1
  68. package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +0 -1
  69. package/plugins/beta/draw-ml/dist/esm/index.js.LICENSE.txt +0 -1
  70. package/plugins/beta/frame/dist/esm/index.js.LICENSE.txt +0 -1
  71. package/plugins/beta/map-styles/dist/esm/index.js.LICENSE.txt +0 -1
  72. package/plugins/beta/scale-bar/dist/esm/index.js.LICENSE.txt +0 -1
  73. package/plugins/beta/use-location/dist/esm/index.js.LICENSE.txt +0 -1
  74. package/plugins/interact/dist/esm/index.js.LICENSE.txt +0 -1
  75. package/plugins/search/dist/esm/im-search-plugin.js.LICENSE.txt +0 -1
  76. package/plugins/search/dist/esm/index.js.LICENSE.txt +0 -1
  77. package/providers/beta/esri/dist/css/im-esri-provider.css +0 -1
  78. package/providers/beta/esri/dist/esm/im-esri-provider.js.LICENSE.txt +0 -1
  79. package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +0 -1
  80. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -1
  81. package/providers/beta/open-names/dist/esm/index.js.LICENSE.txt +0 -1
  82. package/providers/maplibre/dist/esm/im-maplibre-framework.js +0 -2
  83. package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +0 -4
  84. package/providers/maplibre/dist/esm/im-maplibre-provider.js.LICENSE.txt +0 -1
  85. package/providers/maplibre/dist/esm/index.js.LICENSE.txt +0 -1
  86. package/webpack.esm.mjs +0 -153
@@ -1,4 +0,0 @@
1
- /**
2
- * MapLibre GL JS
3
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.17.0/LICENSE.txt
4
- */
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
@@ -1 +0,0 @@
1
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
package/webpack.esm.mjs DELETED
@@ -1,153 +0,0 @@
1
- import path, { dirname } from 'path'
2
- import { fileURLToPath } from 'url'
3
- import fs from 'fs'
4
-
5
- import MiniCssExtractPlugin from 'mini-css-extract-plugin'
6
- import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts'
7
- import RemoveFilesPlugin from 'remove-files-webpack-plugin'
8
-
9
- const __dirname = dirname(fileURLToPath(import.meta.url))
10
-
11
- const ensureFolder = folder => {
12
- if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true })
13
- }
14
-
15
- /**
16
- * Create ESM config for a single entry
17
- */
18
- const createESMConfig = (entryName, entryPath, outDir, isCore = false) => {
19
- const cssFolder = path.resolve(__dirname, outDir, '../css')
20
- ensureFolder(cssFolder)
21
-
22
- const plugins = [
23
- new RemoveEmptyScriptsPlugin(),
24
-
25
- new MiniCssExtractPlugin({
26
- filename: '../css/[name].css'
27
- }),
28
-
29
- // Clean only this plugin's ESM folder before build
30
- new RemoveFilesPlugin({
31
- before: { include: [path.resolve(__dirname, outDir)] }
32
- })
33
- ]
34
-
35
- if (isCore) {
36
- // Core: clean shared dist/css before build
37
- plugins.unshift(
38
- new RemoveFilesPlugin({
39
- before: { include: [path.resolve(__dirname, 'dist/css')] }
40
- })
41
- )
42
-
43
- // Remove -full.css after build
44
- plugins.push(
45
- new RemoveFilesPlugin({
46
- after: {
47
- test: [
48
- {
49
- folder: path.resolve(__dirname, 'dist/css'),
50
- method: p => p.endsWith('-full.css')
51
- }
52
- ]
53
- }
54
- })
55
- )
56
- }
57
-
58
- return {
59
- mode: 'production',
60
- entry: { [entryName]: entryPath }, // Keep entryName as "index"
61
- experiments: { outputModule: true },
62
-
63
- parallelism: 100,
64
-
65
- cache: {
66
- type: 'filesystem',
67
- buildDependencies: {
68
- config: [fileURLToPath(import.meta.url)]
69
- }
70
- },
71
- output: {
72
- path: path.resolve(__dirname, outDir, '../css'),
73
- filename: '../esm/[name].js',
74
- chunkFilename: '../esm/[name].js',
75
- library: { type: 'module' }
76
- },
77
- resolve: {
78
- extensions: ['.js', '.jsx'],
79
- alias: isCore
80
- ? {
81
- react: 'preact/compat',
82
- 'react-dom': 'preact/compat',
83
- 'react/jsx-runtime': 'preact/jsx-runtime'
84
- }
85
- : {}
86
- },
87
- externals: isCore
88
- ? {}
89
- : [
90
- {
91
- react: 'react',
92
- 'react-dom': 'react-dom',
93
- 'react/jsx-runtime': 'react/jsx-runtime',
94
- preact: 'preact',
95
- 'preact/compat': 'preact/compat',
96
- 'preact/hooks': 'preact/hooks',
97
- 'preact/jsx-runtime': 'preact/jsx-runtime'
98
- },
99
- ({ request }, callback) => {
100
- if (request.startsWith('@arcgis/core')) {
101
- return callback(null, `module ${request}`)
102
- }
103
- return callback()
104
- }
105
- ],
106
- module: {
107
- rules: [
108
- { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
109
- { test: /\.css$/i, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
110
- { test: /\.s[ac]ss$/, use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] }
111
- ]
112
- },
113
- plugins,
114
- optimization: {
115
- chunkIds: 'named',
116
- moduleIds: 'named',
117
- splitChunks: false
118
- }
119
- }
120
- }
121
-
122
- // === All builds ===
123
- const ALL_BUILDS = [
124
- // Core
125
- { entryPath: './src/index.js', outDir: 'dist/esm', isCore: true },
126
-
127
- // Providers
128
- { entryPath: './providers/maplibre/src/index.js', outDir: 'providers/maplibre/dist/esm' },
129
- { entryPath: './providers/beta/open-names/src/index.js', outDir: 'providers/beta/open-names/dist/esm' },
130
- { entryPath: './providers/beta/esri/src/index.js', outDir: 'providers/beta/esri/dist/esm' },
131
-
132
- // Plugins
133
- { entryPath: './plugins/beta/scale-bar/src/index.js', outDir: 'plugins/beta/scale-bar/dist/esm' },
134
- { entryPath: './plugins/beta/use-location/src/index.js', outDir: 'plugins/beta/use-location/dist/esm' },
135
- { entryPath: './plugins/search/src/index.js', outDir: 'plugins/search/dist/esm' },
136
- { entryPath: './plugins/interact/src/index.js', outDir: 'plugins/interact/dist/esm' },
137
- { entryPath: './plugins/beta/datasets/src/index.js', outDir: 'plugins/beta/datasets/dist/esm' },
138
- { entryPath: './plugins/beta/map-styles/src/index.js', outDir: 'plugins/beta/map-styles/dist/esm' },
139
- { entryPath: './plugins/beta/draw-ml/src/index.js', outDir: 'plugins/beta/draw-ml/dist/esm' },
140
- { entryPath: './plugins/beta/draw-es/src/index.js', outDir: 'plugins/beta/draw-es/dist/esm' },
141
- { entryPath: './plugins/beta/frame/src/index.js', outDir: 'plugins/beta/frame/dist/esm' }
142
- ]
143
-
144
- // === Filter via environment variable ===
145
- const BUILD_TARGET = process.env.BUILD_TARGET // e.g., 'scale-bar' or 'core'
146
- const buildsToRun = BUILD_TARGET
147
- ? ALL_BUILDS.filter(b => b.outDir.includes(BUILD_TARGET))
148
- : ALL_BUILDS
149
-
150
- // === Export final config ===
151
- export default buildsToRun.map(b =>
152
- createESMConfig('index', b.entryPath, b.outDir, b.isCore || false)
153
- )