@metoceanapi/wxtiles-leaflet 2.1.1 → 2.1.3

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 (58) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/es/controls/WxStyleEditorControl.d.ts +5 -0
  3. package/dist/es/customlayer/customlayer.d.ts +2 -0
  4. package/dist/es/index.d.ts +1 -0
  5. package/dist/es/index.js +2 -2
  6. package/dist/es/utils/tests_wxtools.d.ts +1 -0
  7. package/dist/es/utils/wxtools.d.ts +22 -2
  8. package/dist/es/wxlayer/WxImplementation.d.ts +0 -5
  9. package/dist/es/wxlayer/loader.d.ts +0 -2
  10. package/dist/es/wxlayer/wxlayer.d.ts +3 -0
  11. package/dist/web/index.js +2 -2
  12. package/docs/docs/assets/main.js +56 -52
  13. package/docs/docs/assets/search.js +1 -1
  14. package/docs/docs/assets/style.css +27 -5
  15. package/docs/docs/classes/CustomWxTilesLayer.html +68 -0
  16. package/docs/docs/classes/DataIntegral.html +13 -13
  17. package/docs/docs/classes/Loader.html +5 -12
  18. package/docs/docs/classes/WxAPI.html +2 -2
  19. package/docs/docs/classes/WxLayer.html +35 -16
  20. package/docs/docs/classes/WxLayerBaseImplementation.html +19 -19
  21. package/docs/docs/classes/WxTileSource.html +18 -18
  22. package/docs/docs/functions/WXLOG.html +3 -2
  23. package/docs/docs/functions/WxCreateLegend.html +2 -1
  24. package/docs/docs/functions/WxGetColorSchemes.html +3 -2
  25. package/docs/docs/functions/WxGetColorStyles.html +3 -2
  26. package/docs/docs/functions/WxTilesLogging.html +3 -2
  27. package/docs/docs/index.html +2 -1
  28. package/docs/docs/interfaces/ColorStylesIncomplete.html +2 -1
  29. package/docs/docs/interfaces/Converter.html +2 -2
  30. package/docs/docs/interfaces/DataPicture.html +5 -5
  31. package/docs/docs/interfaces/IntegralPare.html +3 -3
  32. package/docs/docs/interfaces/WxAPIOptions.html +3 -3
  33. package/docs/docs/interfaces/WxColorSchemes.html +2 -1
  34. package/docs/docs/interfaces/WxColorStyleStrict.html +22 -0
  35. package/docs/docs/interfaces/WxColorStyleWeak.html +23 -0
  36. package/docs/docs/interfaces/WxColorStylesStrict.html +2 -2
  37. package/docs/docs/interfaces/WxColorStylesWeakMixed.html +2 -1
  38. package/docs/docs/interfaces/WxTilesLibOptions.html +4 -4
  39. package/docs/docs/interfaces/WxUnits.html +2 -1
  40. package/docs/docs/interfaces/WxVariablesMetas.html +2 -1
  41. package/docs/docs/modules.html +3 -1
  42. package/docs/docs/types/DataIntegrals.html +3 -2
  43. package/docs/docs/types/DataPictures.html +3 -2
  44. package/docs/docs/types/SLine.html +2 -1
  45. package/docs/docs/types/SubTrees.html +2 -1
  46. package/docs/docs/types/SubTreesN.html +2 -1
  47. package/docs/docs/types/TreeN.html +2 -1
  48. package/docs/docs/types/UriLoaderPromiseFunc.html +3 -2
  49. package/docs/docs/types/WxDate.html +2 -1
  50. package/docs/docs/types/WxURIs.html +2 -1
  51. package/docs/docs/types/WxUnitTuple.html +2 -1
  52. package/docs/docs/types/WxVars.html +2 -1
  53. package/docs/examples/seaMaskAndAnimatedBlur.html +2 -2
  54. package/docs/examples/simpleDemo.html +2 -2
  55. package/docs/script/script.js +3 -3
  56. package/package.json +6 -7
  57. package/src_example/start.ts +12 -9
  58. package/watch-public.mjs +99 -0
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@metoceanapi/wxtiles-leaflet",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "WxTile JS lib to render wxtiles datalayers",
5
5
  "main": "dist/es/index.js",
6
6
  "types": "dist/es/index.d.ts",
7
7
  "scripts": {
8
8
  "build_DEMO_Docs": "npm run build && npm run buildDOCS && node build-for-docs.js",
9
- "start": "PORT=3002 node watch-public.js",
9
+ "start": "PORT=3002 node watch-public.mjs",
10
10
  "build": "rm -rf dist/ && node build.js && tsc",
11
11
  "buildDOCS": "./node_modules/.bin/typedoc --out docs/docs --excludeExternals -gitRevision main src",
12
12
  "preversion": "npm run build",
@@ -25,13 +25,12 @@
25
25
  },
26
26
  "homepage": "https://github.com/metoceanapi/wxtiles-leaflet#readme",
27
27
  "devDependencies": {
28
- "@types/leaflet": "^1.9.0",
28
+ "@types/leaflet": "^1.9.3",
29
29
  "changelogkeeper": "^1.2.0",
30
- "esbuild": "^0.15.15",
30
+ "esbuild": "^0.17.18",
31
31
  "esbuild-plugin-external-global": "^1.0.1",
32
- "express": "^4.18.2",
33
32
  "leaflet": "^1.9.3",
34
- "typedoc": "^0.23.21",
35
- "typescript": "^4.9.3"
33
+ "typedoc": "^0.23.28",
34
+ "typescript": "^4.9.5"
36
35
  }
37
36
  }
@@ -7,7 +7,7 @@ import { WxAPIControl } from '../src/controls/WxAPIControl';
7
7
  import { initFrameWork, addRaster, flyTo, setURL, addControl, removeLayer, addLayer, position } from './frwrkdeps';
8
8
 
9
9
  export const OPACITY = 0.8;
10
-
10
+ // new EventSource('/esbuild').addEventListener('change', () => location.reload());
11
11
  // this is universal function for Leaflet and Mapbox.
12
12
  // Functions below are just framework specific wrappers for this universal function
13
13
  // start() is the fully interchangable function for Leaflet and Mapbox
@@ -15,9 +15,10 @@ export async function start() {
15
15
  const map = await initFrameWork();
16
16
  addRaster(map, 'baseS', 'baseL', 'https://tiles.metoceanapi.com/base-lines/{z}/{x}/{y}', 5);
17
17
  // WxTilesLogging(console.trace);
18
- // const dataServerURL = 'http://localhost:9191/data/';
19
- // const dataServerURL = 'https://68.171.214.87/data/'
20
- const dataServerURL = 'https://tilestest.metoceanapi.com/data/';
18
+ const dataServerURL = 'data/'; // different sources manged in 'start' script in package.json
19
+ // const dataServerURL = 'https://68.171.214.87/data/'; // hihi1
20
+ // const dataServerURL = 'https://68.171.214.81/data/'; // hihi2
21
+ // const dataServerURL = 'https://tiles.metoceanapi.com/data/';
21
22
  // const dataServerURL = 'http://tiles3.metoceanapi.com/';
22
23
  const myHeaders = new Headers();
23
24
  // myHeaders.append('x-api-key', 'SpV3J1RypVrv2qkcJE91gG');
@@ -29,15 +30,17 @@ export async function start() {
29
30
  requestInit: { headers: myHeaders },
30
31
  });
31
32
 
32
- // let datasetName = 'gfs.global'; /* 'mercator.global/'; */ /* 'ecwmf.global/'; */ /* 'obs-radar.rain.nzl.national/'; */
33
- // let variable = 'air.temperature.at-2m';
34
- // let variables: WxVars = ['wind.speed.eastward.at-10m', 'wind.speed.northward.at-10m'];
33
+ let datasetName = 'gfs.global'; /* 'mercator.global/'; */ /* 'ecwmf.global/'; */ /* 'obs-radar.rain.nzl.national/'; */
34
+ // let variable = 'cloud.cover';
35
+ let variable = 'air.temperature.at-2m';
36
+ // let variable = 'wind.speed.eastward.at-10m';
37
+ // let variable = 'wave.direction.peak';
35
38
 
36
39
  // let datasetName = 'ww3-ecmwf.global';
37
40
  // let variable = 'wave.direction.mean';
38
41
 
39
- let datasetName = 'obs-radar.rain.nzl.national';
40
- let variable = 'reflectivity';
42
+ // let datasetName = 'obs-radar.rain.nzl.national';
43
+ // let variable = 'reflectivity';
41
44
 
42
45
  // get datasetName from URL
43
46
  const urlParams = window.location.toString().split('##')[1];
@@ -0,0 +1,99 @@
1
+ // import { type BuildOptions, context } from 'esbuild';
2
+ import * as esbuild from 'esbuild';
3
+ import http from 'node:http';
4
+
5
+ const PORT = +process.env.PORT || 3000;
6
+
7
+ const buildOptions = {
8
+ entryPoints: ['src_example/index.ts'],
9
+ bundle: true,
10
+ loader: {
11
+ '.png': 'base64',
12
+ '.woff': 'base64',
13
+ },
14
+ format: 'iife',
15
+ outfile: 'public/script/script.js',
16
+ sourcemap: true,
17
+ minify: false,
18
+ };
19
+
20
+ let ctx = await esbuild.context(buildOptions);
21
+ await ctx.watch();
22
+ console.log('watching...');
23
+
24
+ const { host, port } = await ctx.serve({ host: 'localhost', port: PORT + 1000, servedir: 'public' });
25
+ console.log(`Dev is running at ${host}:${PORT}`);
26
+
27
+ // Then start a proxy server on PORT
28
+ // https://esbuild.github.io/api/#serve-proxy
29
+ http
30
+ .createServer((req, res) => {
31
+ const options = {
32
+ hostname: host,
33
+ port: port,
34
+ path: req.url,
35
+ method: req.method,
36
+ headers: req.headers,
37
+ };
38
+
39
+ if (req.url.startsWith('/data/masks')) {
40
+ options.port = 9191; // all from local 'simple NGINX'
41
+ } else if (req.url.startsWith('/data')) {
42
+ // options.port = undefined;
43
+ // options.hostname = 'hihi2.metoceanapi.com';
44
+ // options.path = 'https://' + options.hostname + req.url;
45
+
46
+ // options.port = 9191; // local 'simple NGINX'
47
+
48
+ options.port = 5050; // wxtiles-http-server
49
+ }
50
+
51
+ // Forward each incoming request to esbuild
52
+ const proxyReq = http.request(options, (proxyRes) => {
53
+ res.writeHead(proxyRes.statusCode, proxyRes.headers);
54
+ proxyRes.pipe(res, { end: true });
55
+ });
56
+
57
+ // Forward the body of the request to esbuild
58
+ req.pipe(proxyReq, { end: true });
59
+ })
60
+ .listen(PORT);
61
+
62
+ /*
63
+ // OLD CODE using express. Works with esbuild 0.15, but not with 0.17
64
+ esbuild
65
+ .build({
66
+ entryPoints: ['src_example/index.ts'],
67
+ bundle: true,
68
+ plugins: [],
69
+ loader: {
70
+ '.png': 'base64',
71
+ '.woff': 'base64',
72
+ },
73
+ target: 'es2020',
74
+ format: 'iife',
75
+ outfile: 'public/script/script.js',
76
+ sourcemap: true,
77
+ minify: false,
78
+ watch: {
79
+ onRebuild(error, result) {
80
+ if (error) {
81
+ console.error('watch build failed:', error);
82
+ } else {
83
+ console.log('rebuilded', new Date());
84
+ }
85
+ },
86
+ },
87
+ })
88
+ .then((result) => {
89
+ const app = express();
90
+ app.use(express.static('public'));
91
+
92
+ const url = `http://localhost:${PORT}`;
93
+ app.listen(PORT, () => {
94
+ console.log(`Dev is running at ${url}`);
95
+ });
96
+ })
97
+ .catch((e) => console.error(e.message));
98
+
99
+ */