@defra/interactive-map 0.0.8-alpha → 0.0.10-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 (104) hide show
  1. package/DOCS_README.md +39 -0
  2. package/dist/esm/im-core.js +1 -0
  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 +22 -2
  9. package/docs/architecture/architecture-diagrams.md +1 -3
  10. package/docs/architecture/diagrams-viewer.mdx +12 -0
  11. package/docs/getting-started.md +78 -8
  12. package/docs/govuk-prototype.md +23 -0
  13. package/docs/index.md +23 -0
  14. package/docusaurus.config.cjs +106 -0
  15. package/mise.toml +2 -0
  16. package/package.json +51 -27
  17. package/plugins/beta/datasets/dist/css/index.css +50 -1
  18. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -0
  19. package/plugins/beta/datasets/dist/esm/index.js +1 -2
  20. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -0
  21. package/plugins/beta/draw-es/dist/esm/index.js +1 -2
  22. package/plugins/beta/draw-es/src/api/newPolygon.js +1 -3
  23. package/plugins/beta/draw-es/src/events.js +2 -2
  24. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
  25. package/plugins/beta/draw-ml/dist/esm/index.js +1 -2
  26. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
  27. package/plugins/beta/draw-ml/src/api/newLine.js +2 -2
  28. package/plugins/beta/draw-ml/src/api/newPolygon.js +2 -2
  29. package/plugins/beta/draw-ml/src/events.js +18 -10
  30. package/plugins/beta/frame/dist/css/index.css +11 -1
  31. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
  32. package/plugins/beta/frame/dist/esm/index.js +1 -2
  33. package/plugins/beta/map-styles/dist/css/index.css +79 -1
  34. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  35. package/plugins/beta/map-styles/dist/esm/index.js +1 -2
  36. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
  37. package/plugins/beta/scale-bar/dist/esm/index.js +1 -2
  38. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
  39. package/plugins/beta/use-location/dist/esm/index.js +1 -2
  40. package/plugins/beta/use-location/dist/umd/index.js +1 -1
  41. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -0
  42. package/plugins/interact/dist/esm/index.js +1 -2
  43. package/plugins/search/dist/esm/im-search-plugin.js +1 -0
  44. package/plugins/search/dist/esm/index.js +1 -2
  45. package/plugins/search/src/Search.test.jsx +170 -0
  46. package/plugins/search/src/components/CloseButton/CloseButton.test.jsx +67 -0
  47. package/plugins/search/src/components/Form/Form.test.jsx +158 -0
  48. package/plugins/search/src/components/OpenButton/OpenButton.test.jsx +47 -0
  49. package/plugins/search/src/components/Suggestions/Suggestions.module.scss +1 -1
  50. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +79 -0
  51. package/plugins/search/src/datasets.test.js +46 -0
  52. package/plugins/search/src/events/fetchSuggestions.test.js +212 -0
  53. package/plugins/search/src/events/formHandlers.test.js +232 -0
  54. package/plugins/search/src/events/index.test.js +118 -0
  55. package/plugins/search/src/events/inputHandlers.test.js +104 -0
  56. package/plugins/search/src/events/suggestionHandlers.test.js +166 -0
  57. package/plugins/search/src/index.test.js +47 -0
  58. package/plugins/search/src/reducer.test.js +80 -0
  59. package/plugins/search/src/search.scss +1 -1
  60. package/plugins/search/src/utils/parseOsNamesResults.js +2 -1
  61. package/plugins/search/src/utils/parseOsNamesResults.test.js +140 -0
  62. package/plugins/search/src/utils/updateMap.test.js +52 -0
  63. package/providers/beta/esri/dist/css/index.css +30 -1
  64. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -0
  65. package/providers/beta/esri/dist/esm/index.js +1 -2
  66. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -0
  67. package/providers/beta/open-names/dist/esm/index.js +1 -2
  68. package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +61 -0
  69. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -0
  70. package/providers/maplibre/dist/esm/index.js +1 -2
  71. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  72. package/providers/maplibre/src/appEvents.test.js +44 -0
  73. package/providers/maplibre/src/index.test.js +60 -0
  74. package/providers/maplibre/src/mapEvents.test.js +115 -0
  75. package/providers/maplibre/src/maplibreProvider.test.js +205 -0
  76. package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +31 -0
  77. package/providers/maplibre/src/utils/detectWebgl.test.js +63 -0
  78. package/providers/maplibre/src/utils/highlightFeatures.test.js +126 -0
  79. package/providers/maplibre/src/utils/labels.js +1 -3
  80. package/providers/maplibre/src/utils/labels.test.js +231 -0
  81. package/providers/maplibre/src/utils/maplibreFixes.test.js +66 -0
  82. package/providers/maplibre/src/utils/queryFeatures.test.js +60 -0
  83. package/providers/maplibre/src/utils/spatial.js +5 -4
  84. package/providers/maplibre/src/utils/spatial.test.js +96 -0
  85. package/rollup.esm.mjs +288 -0
  86. package/src/App/store/appActionsMap.js +1 -1
  87. package/src/InteractiveMap/InteractiveMap.js +3 -2
  88. package/webpack.dev.mjs +9 -1
  89. package/webpack.prod.mjs +8 -1
  90. package/webpack.umd.mjs +1 -2
  91. package/dist/esm/index.js.LICENSE.txt +0 -1
  92. package/plugins/beta/datasets/dist/esm/index.js.LICENSE.txt +0 -1
  93. package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +0 -1
  94. package/plugins/beta/draw-ml/dist/esm/index.js.LICENSE.txt +0 -1
  95. package/plugins/beta/frame/dist/esm/index.js.LICENSE.txt +0 -1
  96. package/plugins/beta/map-styles/dist/esm/index.js.LICENSE.txt +0 -1
  97. package/plugins/beta/scale-bar/dist/esm/index.js.LICENSE.txt +0 -1
  98. package/plugins/beta/use-location/dist/esm/index.js.LICENSE.txt +0 -1
  99. package/plugins/interact/dist/esm/index.js.LICENSE.txt +0 -1
  100. package/plugins/search/dist/esm/index.js.LICENSE.txt +0 -1
  101. package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +0 -1
  102. package/providers/beta/open-names/dist/esm/index.js.LICENSE.txt +0 -1
  103. package/providers/maplibre/dist/esm/index.js.LICENSE.txt +0 -6
  104. package/webpack.esm.mjs +0 -154
package/webpack.esm.mjs DELETED
@@ -1,154 +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
- asyncChunks: false
77
- },
78
- resolve: {
79
- extensions: ['.js', '.jsx'],
80
- alias: isCore
81
- ? {
82
- react: 'preact/compat',
83
- 'react-dom': 'preact/compat',
84
- 'react/jsx-runtime': 'preact/jsx-runtime'
85
- }
86
- : {}
87
- },
88
- externals: isCore
89
- ? {}
90
- : [
91
- {
92
- react: 'react',
93
- 'react-dom': 'react-dom',
94
- 'react/jsx-runtime': 'react/jsx-runtime',
95
- preact: 'preact',
96
- 'preact/compat': 'preact/compat',
97
- 'preact/hooks': 'preact/hooks',
98
- 'preact/jsx-runtime': 'preact/jsx-runtime'
99
- },
100
- ({ request }, callback) => {
101
- if (request.startsWith('@arcgis/core')) {
102
- return callback(null, `module ${request}`)
103
- }
104
- return callback()
105
- }
106
- ],
107
- module: {
108
- rules: [
109
- { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
110
- { test: /\.css$/i, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
111
- { test: /\.s[ac]ss$/, use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] }
112
- ]
113
- },
114
- plugins,
115
- optimization: {
116
- chunkIds: 'named',
117
- moduleIds: 'named',
118
- splitChunks: false
119
- }
120
- }
121
- }
122
-
123
- // === All builds ===
124
- const ALL_BUILDS = [
125
- // Core
126
- { entryPath: './src/index.js', outDir: 'dist/esm', isCore: true },
127
-
128
- // Providers
129
- { entryPath: './providers/maplibre/src/index.js', outDir: 'providers/maplibre/dist/esm' },
130
- { entryPath: './providers/beta/open-names/src/index.js', outDir: 'providers/beta/open-names/dist/esm' },
131
- { entryPath: './providers/beta/esri/src/index.js', outDir: 'providers/beta/esri/dist/esm' },
132
-
133
- // Plugins
134
- { entryPath: './plugins/beta/scale-bar/src/index.js', outDir: 'plugins/beta/scale-bar/dist/esm' },
135
- { entryPath: './plugins/beta/use-location/src/index.js', outDir: 'plugins/beta/use-location/dist/esm' },
136
- { entryPath: './plugins/search/src/index.js', outDir: 'plugins/search/dist/esm' },
137
- { entryPath: './plugins/interact/src/index.js', outDir: 'plugins/interact/dist/esm' },
138
- { entryPath: './plugins/beta/datasets/src/index.js', outDir: 'plugins/beta/datasets/dist/esm' },
139
- { entryPath: './plugins/beta/map-styles/src/index.js', outDir: 'plugins/beta/map-styles/dist/esm' },
140
- { entryPath: './plugins/beta/draw-ml/src/index.js', outDir: 'plugins/beta/draw-ml/dist/esm' },
141
- { entryPath: './plugins/beta/draw-es/src/index.js', outDir: 'plugins/beta/draw-es/dist/esm' },
142
- { entryPath: './plugins/beta/frame/src/index.js', outDir: 'plugins/beta/frame/dist/esm' }
143
- ]
144
-
145
- // === Filter via environment variable ===
146
- const BUILD_TARGET = process.env.BUILD_TARGET // e.g., 'scale-bar' or 'core'
147
- const buildsToRun = BUILD_TARGET
148
- ? ALL_BUILDS.filter(b => b.outDir.includes(BUILD_TARGET))
149
- : ALL_BUILDS
150
-
151
- // === Export final config ===
152
- export default buildsToRun.map(b =>
153
- createESMConfig('index', b.entryPath, b.outDir, b.isCore || false)
154
- )