@defra/interactive-map 0.0.8-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 (75) hide show
  1. package/dist/esm/im-core.js +1 -0
  2. package/dist/esm/im-shell.js +1 -0
  3. package/dist/esm/index.js +1 -2
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/button-definition.md +104 -3
  7. package/docs/api.md +21 -1
  8. package/docs/getting-started.md +78 -8
  9. package/package.json +31 -24
  10. package/plugins/beta/datasets/dist/css/index.css +50 -1
  11. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -0
  12. package/plugins/beta/datasets/dist/esm/index.js +1 -2
  13. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -0
  14. package/plugins/beta/draw-es/dist/esm/index.js +1 -2
  15. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
  16. package/plugins/beta/draw-ml/dist/esm/index.js +1 -2
  17. package/plugins/beta/frame/dist/css/index.css +11 -1
  18. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
  19. package/plugins/beta/frame/dist/esm/index.js +1 -2
  20. package/plugins/beta/map-styles/dist/css/index.css +79 -1
  21. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  22. package/plugins/beta/map-styles/dist/esm/index.js +1 -2
  23. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
  24. package/plugins/beta/scale-bar/dist/esm/index.js +1 -2
  25. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
  26. package/plugins/beta/use-location/dist/esm/index.js +1 -2
  27. package/plugins/beta/use-location/dist/umd/index.js +1 -1
  28. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -0
  29. package/plugins/interact/dist/esm/index.js +1 -2
  30. package/plugins/search/dist/esm/im-search-plugin.js +1 -0
  31. package/plugins/search/dist/esm/index.js +1 -2
  32. package/plugins/search/src/components/Suggestions/Suggestions.module.scss +1 -1
  33. package/plugins/search/src/search.scss +1 -1
  34. package/providers/beta/esri/dist/css/index.css +30 -1
  35. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -0
  36. package/providers/beta/esri/dist/esm/index.js +1 -2
  37. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -0
  38. package/providers/beta/open-names/dist/esm/index.js +1 -2
  39. package/providers/beta/open-names/src/utils/mapToLocationModel.test.js +61 -0
  40. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -0
  41. package/providers/maplibre/dist/esm/index.js +1 -2
  42. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  43. package/providers/maplibre/src/appEvents.test.js +44 -0
  44. package/providers/maplibre/src/index.test.js +60 -0
  45. package/providers/maplibre/src/mapEvents.test.js +115 -0
  46. package/providers/maplibre/src/maplibreProvider.test.js +205 -0
  47. package/providers/maplibre/src/utils/calculateLinearTextSize.test.js +31 -0
  48. package/providers/maplibre/src/utils/detectWebgl.test.js +63 -0
  49. package/providers/maplibre/src/utils/highlightFeatures.test.js +126 -0
  50. package/providers/maplibre/src/utils/labels.js +1 -3
  51. package/providers/maplibre/src/utils/labels.test.js +231 -0
  52. package/providers/maplibre/src/utils/maplibreFixes.test.js +66 -0
  53. package/providers/maplibre/src/utils/queryFeatures.test.js +60 -0
  54. package/providers/maplibre/src/utils/spatial.js +5 -4
  55. package/providers/maplibre/src/utils/spatial.test.js +96 -0
  56. package/rollup.esm.mjs +288 -0
  57. package/src/App/store/appActionsMap.js +1 -1
  58. package/src/InteractiveMap/InteractiveMap.js +3 -2
  59. package/webpack.dev.mjs +9 -1
  60. package/webpack.prod.mjs +8 -1
  61. package/webpack.umd.mjs +1 -2
  62. package/dist/esm/index.js.LICENSE.txt +0 -1
  63. package/plugins/beta/datasets/dist/esm/index.js.LICENSE.txt +0 -1
  64. package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +0 -1
  65. package/plugins/beta/draw-ml/dist/esm/index.js.LICENSE.txt +0 -1
  66. package/plugins/beta/frame/dist/esm/index.js.LICENSE.txt +0 -1
  67. package/plugins/beta/map-styles/dist/esm/index.js.LICENSE.txt +0 -1
  68. package/plugins/beta/scale-bar/dist/esm/index.js.LICENSE.txt +0 -1
  69. package/plugins/beta/use-location/dist/esm/index.js.LICENSE.txt +0 -1
  70. package/plugins/interact/dist/esm/index.js.LICENSE.txt +0 -1
  71. package/plugins/search/dist/esm/index.js.LICENSE.txt +0 -1
  72. package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +0 -1
  73. package/providers/beta/open-names/dist/esm/index.js.LICENSE.txt +0 -1
  74. package/providers/maplibre/dist/esm/index.js.LICENSE.txt +0 -6
  75. 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
- )