@unvt/charites 0.5.2 → 2.0.0

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 (84) hide show
  1. package/.github/workflows/build.yml +3 -5
  2. package/.mocharc.json +7 -0
  3. package/README.md +5 -2
  4. package/dist/cli/build.js +13 -24
  5. package/dist/cli/convert.js +7 -9
  6. package/dist/cli/init.js +7 -9
  7. package/dist/cli/serve.js +9 -21
  8. package/dist/cli.js +18 -16
  9. package/dist/commands/build.js +25 -38
  10. package/dist/commands/convert.js +14 -21
  11. package/dist/commands/init.js +6 -10
  12. package/dist/commands/serve.js +33 -65
  13. package/dist/lib/build-sprite.js +5 -12
  14. package/dist/lib/defaultValues.js +6 -31
  15. package/dist/lib/error.js +1 -5
  16. package/dist/lib/get-sprite-slug.js +6 -8
  17. package/dist/lib/tileinfo-importer/base-importer.js +2 -5
  18. package/dist/lib/tileinfo-importer/index.js +2 -7
  19. package/dist/lib/tileinfo-importer/metadata-importer.js +4 -11
  20. package/dist/lib/tileinfo-importer/tilejson-importer.js +4 -11
  21. package/dist/lib/validate-style.js +14 -16
  22. package/dist/lib/yaml-include/file.js +23 -0
  23. package/dist/lib/yaml-include/index.js +22 -0
  24. package/dist/lib/yaml-parser.js +8 -14
  25. package/dist/lib/yaml-writer.js +17 -23
  26. package/dist/types/index.js +3 -19
  27. package/dist/types/metadatajson.js +1 -2
  28. package/dist/types/tilejson.js +1 -2
  29. package/dist/types/vector_layers.js +1 -2
  30. package/docs/source/index.rst +4 -5
  31. package/docs/source/install/install.rst +1 -1
  32. package/docs/source/install/installation_guide_for_windows.rst +4 -4
  33. package/docs/source/install/recommended_environment.rst +1 -1
  34. package/docs/source/usage/commandline_interface.rst +3 -12
  35. package/docs/source/usage/examples.rst +0 -6
  36. package/docs/source/usage/index.rst +0 -1
  37. package/eslint.config.mjs +46 -0
  38. package/mocha-register.cjs +2 -0
  39. package/package.json +41 -38
  40. package/playwright.config.ts +1 -12
  41. package/provider/{default/shared.js → app.js} +36 -2
  42. package/provider/{default/index.html → index.html} +3 -3
  43. package/src/cli/build.ts +2 -15
  44. package/src/cli/convert.ts +2 -2
  45. package/src/cli/init.ts +2 -2
  46. package/src/cli/serve.ts +4 -20
  47. package/src/cli.ts +14 -5
  48. package/src/commands/build.ts +5 -12
  49. package/src/commands/convert.ts +1 -1
  50. package/src/commands/init.ts +2 -2
  51. package/src/commands/serve.ts +12 -49
  52. package/src/lib/build-sprite.ts +2 -1
  53. package/src/lib/defaultValues.ts +8 -34
  54. package/src/lib/get-sprite-slug.ts +6 -2
  55. package/src/lib/tileinfo-importer/index.ts +2 -2
  56. package/src/lib/tileinfo-importer/metadata-importer.ts +2 -2
  57. package/src/lib/tileinfo-importer/tilejson-importer.ts +2 -2
  58. package/src/lib/validate-style.ts +15 -15
  59. package/src/lib/yaml-include/file.ts +29 -0
  60. package/src/lib/yaml-include/index.ts +28 -0
  61. package/src/lib/yaml-parser.ts +3 -3
  62. package/test/build-sprite.spec.ts +5 -0
  63. package/test/build.spec.ts +10 -13
  64. package/test/command.build.spec.ts +2 -2
  65. package/test/convert.spec.ts +7 -1
  66. package/test/get-sprite-slug.spec.ts +4 -0
  67. package/test/init.spec.ts +5 -0
  68. package/test/playwright/provider/{default/e2e.spec.ts → e2e.spec.ts} +2 -2
  69. package/test/util/charitesCmd.ts +5 -0
  70. package/test/util/copyFixtures.ts +5 -0
  71. package/test/yaml-parser.spec.ts +4 -0
  72. package/tsconfig.json +11 -6
  73. package/.eslintignore +0 -2
  74. package/.eslintrc.js +0 -17
  75. package/docs/source/usage/global_options.rst +0 -21
  76. package/provider/default/app.js +0 -30
  77. package/provider/geolonia/app.js +0 -28
  78. package/provider/geolonia/index.html +0 -22
  79. package/provider/mapbox/app.js +0 -33
  80. package/provider/mapbox/index.html +0 -23
  81. package/test/playwright/provider/geolonia/e2e.spec.ts +0 -13
  82. package/test/playwright/provider/mapbox/e2e.spec.ts +0 -13
  83. /package/{.prettierrc.js → .prettierrc.cjs} +0 -0
  84. /package/provider/{default/app.css → app.css} +0 -0
@@ -1,30 +0,0 @@
1
- ;(async () => {
2
- const { style, center, zoom } = await window._charites.parseMapStyle()
3
- const options = {
4
- container: 'map',
5
- hash: true,
6
- style,
7
- }
8
- if (center) options.center = center
9
- if (zoom) options.zoom = zoom
10
- const map = new maplibregl.Map(options)
11
-
12
- window._charites.initializeWebSocket(map)
13
-
14
- map.addControl(new maplibregl.NavigationControl(), 'top-right')
15
-
16
- map.addControl(
17
- new MaplibreLegendControl.MaplibreLegendControl(
18
- {},
19
- {
20
- showDefault: true,
21
- showCheckbox: true,
22
- onlyRendered: true,
23
- reverseOrder: true,
24
- },
25
- ),
26
- 'bottom-left',
27
- )
28
-
29
- window._charites.setupDebugCheckboxes(map)
30
- })()
@@ -1,28 +0,0 @@
1
- ;(async () => {
2
- const { style, center, zoom } = await window._charites.parseMapStyle()
3
- const options = {
4
- container: 'map',
5
- hash: true,
6
- style,
7
- }
8
- if (center) options.center = center
9
- if (zoom) options.zoom = zoom
10
- const map = new geolonia.Map(options)
11
-
12
- window._charites.initializeWebSocket(map)
13
-
14
- map.addControl(
15
- new MaplibreLegendControl.MaplibreLegendControl(
16
- {},
17
- {
18
- showDefault: true,
19
- showCheckbox: true,
20
- onlyRendered: true,
21
- reverseOrder: true,
22
- },
23
- ),
24
- 'bottom-left',
25
- )
26
-
27
- window._charites.setupDebugCheckboxes(map)
28
- })()
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <html id="charites-geolonia">
3
- <head>
4
- <link rel="stylesheet" href="/app.css" />
5
- <title>Charites Live Preview</title>
6
- <link href='https://unpkg.com/@watergis/maplibre-gl-legend@2.0.0/dist/maplibre-gl-legend.css' rel='stylesheet' />
7
- </head>
8
- <body>
9
- <div class="overlay">
10
- <label><input type="checkbox" id="showTileBoundaries">show Tile Boundaries</label>
11
- <br>
12
- <label><input type="checkbox" id="showCollisionBoxes">show Collision Boxes</label>
13
- <br>
14
- <label><input type="checkbox" id="showPadding">show Padding</label>
15
- </div>
16
- <div id="map"></div>
17
- <script type="text/javascript" src="https://cdn.geolonia.com/v1/embed?geolonia-api-key=YOUR-API-KEY"></script>
18
- <script src="https://unpkg.com/@watergis/maplibre-gl-legend@2.0.0/dist/maplibre-gl-legend.umd.js"></script>
19
- <script type="text/javascript" src="/shared.js"></script>
20
- <script type="text/javascript" src="/app.js"></script>
21
- </body>
22
- </html>
@@ -1,33 +0,0 @@
1
- ;(async () => {
2
- mapboxgl.accessToken = '___MAPBOX_ACCESS_TOKEN___'
3
-
4
- const { style, center, zoom } = await window._charites.parseMapStyle()
5
- const options = {
6
- container: 'map',
7
- hash: true,
8
- style,
9
- }
10
- if (center) options.center = center
11
- if (zoom) options.zoom = zoom
12
- const map = new mapboxgl.Map(options)
13
-
14
- window._charites.initializeWebSocket(map)
15
-
16
- map.addControl(new mapboxgl.NavigationControl(), 'top-right')
17
-
18
- map.addControl(
19
- new MapboxLegendControl(
20
- {},
21
- {
22
- showDefault: true,
23
- showCheckbox: true,
24
- onlyRendered: true,
25
- reverseOrder: true,
26
- accesstoken: mapboxgl.accessToken,
27
- },
28
- ),
29
- 'bottom-left',
30
- )
31
-
32
- window._charites.setupDebugCheckboxes(map)
33
- })()
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html id="charites-mapbox">
3
- <head>
4
- <link rel="stylesheet" href="/app.css" />
5
- <link href='https://api.mapbox.com/mapbox-gl-js/v2.5.0/mapbox-gl.css' rel='stylesheet' />
6
- <link href='https://watergis.github.io/mapbox-gl-legend/mapbox-gl-legend.css' rel='stylesheet' />
7
- <title>Charites Live Preview</title>
8
- <script src='https://api.mapbox.com/mapbox-gl-js/v2.5.0/mapbox-gl.js'></script>
9
- <script src="https://watergis.github.io/mapbox-gl-legend/mapbox-gl-legend.js"></script>
10
- </head>
11
- <body>
12
- <div class="overlay">
13
- <label><input type="checkbox" id="showTileBoundaries">show Tile Boundaries</label>
14
- <br>
15
- <label><input type="checkbox" id="showCollisionBoxes">show Collision Boxes</label>
16
- <br>
17
- <label><input type="checkbox" id="showPadding">show Padding</label>
18
- </div>
19
- <div id="map"></div>
20
- <script type="text/javascript" src="/shared.js"></script>
21
- <script type="text/javascript" src="/app.js"></script>
22
- </body>
23
- </html>
@@ -1,13 +0,0 @@
1
- import { test, expect } from '@playwright/test'
2
-
3
- test('Charites Live Preview with geolonia', async ({ page }) => {
4
- // collect errors on the page
5
- const pageErrors: Error[] = []
6
- page.on('pageerror', (exception) => pageErrors.push(exception))
7
-
8
- await page.goto('http://localhost:8088/', { waitUntil: 'networkidle' })
9
- await page.waitForTimeout(1000)
10
- const title = await page.title()
11
- expect(title).toBe('Charites Live Preview')
12
- expect(pageErrors).toMatchObject([])
13
- })
@@ -1,13 +0,0 @@
1
- import { test, expect } from '@playwright/test'
2
-
3
- test('Charites Live Preview with mapbox', async ({ page }) => {
4
- // collect errors on the page
5
- const pageErrors: Error[] = []
6
- page.on('pageerror', (exception) => pageErrors.push(exception))
7
-
8
- await page.goto('http://localhost:8888/', { waitUntil: 'networkidle' })
9
- await page.waitForTimeout(1000)
10
- const title = await page.title()
11
- expect(title).toBe('Charites Live Preview')
12
- expect(pageErrors).toMatchObject([])
13
- })
File without changes
File without changes