@unvt/charites 0.5.4 → 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 (79) 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 +7 -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 +1 -5
  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 +3 -17
  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/usage/commandline_interface.rst +0 -12
  32. package/docs/source/usage/examples.rst +0 -6
  33. package/docs/source/usage/index.rst +0 -1
  34. package/eslint.config.mjs +46 -0
  35. package/mocha-register.cjs +2 -0
  36. package/package.json +40 -37
  37. package/playwright.config.ts +1 -12
  38. package/provider/{default/shared.js → app.js} +30 -0
  39. package/provider/{default/index.html → index.html} +3 -3
  40. package/src/cli/build.ts +2 -15
  41. package/src/cli/convert.ts +2 -2
  42. package/src/cli/init.ts +2 -2
  43. package/src/cli/serve.ts +2 -20
  44. package/src/cli.ts +14 -5
  45. package/src/commands/build.ts +5 -12
  46. package/src/commands/convert.ts +1 -1
  47. package/src/commands/init.ts +2 -2
  48. package/src/commands/serve.ts +10 -48
  49. package/src/lib/defaultValues.ts +8 -34
  50. package/src/lib/tileinfo-importer/index.ts +2 -2
  51. package/src/lib/tileinfo-importer/metadata-importer.ts +2 -2
  52. package/src/lib/tileinfo-importer/tilejson-importer.ts +2 -2
  53. package/src/lib/validate-style.ts +5 -13
  54. package/src/lib/yaml-include/file.ts +29 -0
  55. package/src/lib/yaml-include/index.ts +28 -0
  56. package/src/lib/yaml-parser.ts +3 -3
  57. package/test/build-sprite.spec.ts +5 -0
  58. package/test/build.spec.ts +10 -13
  59. package/test/command.build.spec.ts +2 -2
  60. package/test/convert.spec.ts +7 -1
  61. package/test/get-sprite-slug.spec.ts +4 -0
  62. package/test/init.spec.ts +5 -0
  63. package/test/playwright/provider/{default/e2e.spec.ts → e2e.spec.ts} +2 -2
  64. package/test/util/charitesCmd.ts +5 -0
  65. package/test/util/copyFixtures.ts +5 -0
  66. package/test/yaml-parser.spec.ts +4 -0
  67. package/tsconfig.json +11 -6
  68. package/.eslintignore +0 -2
  69. package/.eslintrc.js +0 -17
  70. package/docs/source/usage/global_options.rst +0 -21
  71. package/provider/default/app.js +0 -30
  72. package/provider/geolonia/app.js +0 -28
  73. package/provider/geolonia/index.html +0 -22
  74. package/provider/mapbox/app.js +0 -33
  75. package/provider/mapbox/index.html +0 -23
  76. package/test/playwright/provider/geolonia/e2e.spec.ts +0 -13
  77. package/test/playwright/provider/mapbox/e2e.spec.ts +0 -13
  78. /package/{.prettierrc.js → .prettierrc.cjs} +0 -0
  79. /package/provider/{default/app.css → app.css} +0 -0
@@ -1,10 +1,10 @@
1
1
  import axios from 'axios'
2
- import { MetadataJSON, VectorLayer } from '../../types'
2
+ import { MetadataJSON, VectorLayer } from '../../types/index.js'
3
3
  import {
4
4
  LayerSpecification,
5
5
  VectorSourceSpecification,
6
6
  } from '@maplibre/maplibre-gl-style-spec'
7
- import { BaseImporter, TileInfoJSONResponse } from './base-importer'
7
+ import { BaseImporter, TileInfoJSONResponse } from './base-importer.js'
8
8
 
9
9
  export class MetadataJSONImporter extends BaseImporter {
10
10
  async getJSON(url: string): Promise<TileInfoJSONResponse> {
@@ -1,10 +1,10 @@
1
1
  import axios from 'axios'
2
- import { TileJSON } from '../../types'
2
+ import { TileJSON } from '../../types/index.js'
3
3
  import {
4
4
  SourceSpecification,
5
5
  LayerSpecification,
6
6
  } from '@maplibre/maplibre-gl-style-spec'
7
- import { BaseImporter, TileInfoJSONResponse } from './base-importer'
7
+ import { BaseImporter, TileInfoJSONResponse } from './base-importer.js'
8
8
 
9
9
  export class TileJSONImporter extends BaseImporter {
10
10
  async getJSON(url: string): Promise<TileInfoJSONResponse> {
@@ -1,17 +1,9 @@
1
- import maplibreStyleSpec from '@maplibre/maplibre-gl-style-spec'
2
- const mapboxStyleSpec = require('@mapbox/mapbox-gl-style-spec')
3
- import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec'
1
+ import maplibreStyleSpec, {
2
+ StyleSpecification,
3
+ } from '@maplibre/maplibre-gl-style-spec'
4
4
 
5
- export function validateStyle(
6
- style: StyleSpecification,
7
- provider = 'default',
8
- ): void {
9
- let result = []
10
- if ('mapbox' === provider) {
11
- result = mapboxStyleSpec.validate(style)
12
- } else {
13
- result = maplibreStyleSpec.validateStyleMin(style)
14
- }
5
+ export function validateStyle(style: StyleSpecification): void {
6
+ const result = maplibreStyleSpec.validateStyleMin(style)
15
7
 
16
8
  const errors = []
17
9
  for (let i = 0; i < result.length; i++) {
@@ -0,0 +1,29 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import yaml from 'js-yaml'
4
+ import * as yamlinc from './index.js'
5
+
6
+ function construct(data: string): unknown {
7
+ const basepath = yamlinc.getBasePath()
8
+ const fullpath = path.join(basepath, data)
9
+
10
+ yamlinc.YAML_VISITED_FILES.push(fullpath.replace(basepath + path.sep, ''))
11
+
12
+ const src = fs.readFileSync(fullpath, 'utf8')
13
+ const included = yaml.load(src, {
14
+ schema: yamlinc.YAML_INCLUDE_SCHEMA,
15
+ filename: fullpath,
16
+ })
17
+
18
+ return included
19
+ }
20
+
21
+ function resolve(data: unknown): boolean {
22
+ return typeof data === 'string'
23
+ }
24
+
25
+ export default new yaml.Type('tag:yaml.org,2002:inc/file', {
26
+ kind: 'scalar',
27
+ resolve: resolve,
28
+ construct: construct,
29
+ })
@@ -0,0 +1,28 @@
1
+ import yaml from 'js-yaml'
2
+ import path from 'path'
3
+
4
+ // import YamlIncludeDirType from './lib/dir';
5
+ import YamlIncludeFileType from './file.js'
6
+
7
+ export const YAML_VISITED_FILES: string[] = []
8
+ export const YAML_TYPES = [
9
+ // YamlIncludeDirType,
10
+ YamlIncludeFileType,
11
+ ]
12
+ export const YAML_INCLUDE_SCHEMA = yaml.DEFAULT_SCHEMA.extend(YAML_TYPES)
13
+ export let basefile = ''
14
+
15
+ // so we know where to find files referenced relative to the base file
16
+ export function setBaseFile(file: string): void {
17
+ YAML_VISITED_FILES.push(file)
18
+ basefile = file
19
+ }
20
+
21
+ export function getBasePath(): string {
22
+ return path.dirname(basefile)
23
+ }
24
+
25
+ export {
26
+ // YamlIncludeDirType,
27
+ YamlIncludeFileType,
28
+ }
@@ -1,8 +1,7 @@
1
1
  import fs from 'fs'
2
2
  import YAML from 'js-yaml'
3
3
  import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec'
4
-
5
- const yamlinc = require('yaml-include')
4
+ import * as yamlinc from './yaml-include/index.js'
6
5
 
7
6
  interface StyleObject {
8
7
  [key: string]: string
@@ -10,10 +9,11 @@ interface StyleObject {
10
9
 
11
10
  export function parser(file: string): StyleSpecification {
12
11
  yamlinc.setBaseFile(file)
12
+ const schema = yamlinc.YAML_INCLUDE_SCHEMA
13
13
  const yaml = fs.readFileSync(file, 'utf8')
14
14
 
15
15
  const obj: StyleObject = YAML.load(yaml, {
16
- schema: yamlinc.YAML_INCLUDE_SCHEMA,
16
+ schema,
17
17
  filename: file,
18
18
  json: true,
19
19
  }) as StyleObject
@@ -1,8 +1,13 @@
1
+ import { fileURLToPath } from 'url'
2
+ import { dirname } from 'path'
1
3
  import { assert } from 'chai'
2
4
  import path from 'path'
3
5
  import fs from 'fs'
4
6
  import os from 'os'
5
7
 
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = dirname(__filename)
10
+
6
11
  import { buildSprite } from '../src/lib/build-sprite'
7
12
  const iconsPath = path.join(__dirname, 'data/icons')
8
13
  let tmpdir = ''
@@ -1,15 +1,19 @@
1
- import chai from 'chai'
1
+ import { fileURLToPath } from 'url'
2
+ import { dirname } from 'path'
3
+ import * as chai from 'chai'
2
4
  import chaiAsPromised from 'chai-as-promised'
3
5
  import path from 'path'
4
6
  import fs from 'fs'
5
7
  import os from 'os'
6
8
 
7
9
  import { build, buildWatch } from '../src/commands/build'
8
- import { defaultValues } from '../src/lib/defaultValues'
10
+
11
+ const __filename = fileURLToPath(import.meta.url)
12
+ const __dirname = dirname(__filename)
9
13
 
10
14
  chai.use(chaiAsPromised)
11
15
  chai.should()
12
- const assert = chai.assert
16
+ const assert: Chai.AssertStatic = chai.assert
13
17
 
14
18
  describe('Test for the `build.ts`.', () => {
15
19
  const styleYaml = path.join(__dirname, 'data/style.yml')
@@ -39,7 +43,7 @@ describe('Test for the `build.ts`.', () => {
39
43
  })
40
44
 
41
45
  it('Should convert `data/style.yml` to JSON.', async () => {
42
- await build(styleYaml, styleJson, { provider: defaultValues.provider })
46
+ await build(styleYaml, styleJson, {})
43
47
 
44
48
  // The file should exists.
45
49
  assert.deepEqual(true, !!fs.statSync(styleJson))
@@ -53,7 +57,6 @@ describe('Test for the `build.ts`.', () => {
53
57
 
54
58
  it('Should minify `data/style.yml` to JSON.', async () => {
55
59
  await build(styleYaml, styleJson, {
56
- provider: defaultValues.provider,
57
60
  compactOutput: true,
58
61
  })
59
62
 
@@ -67,7 +70,6 @@ describe('Test for the `build.ts`.', () => {
67
70
  const expectedUrl = 'http://localhost:8080/icons'
68
71
 
69
72
  await build(styleYaml, styleJson, {
70
- provider: defaultValues.provider,
71
73
  spriteUrl: expectedUrl,
72
74
  spriteInput: iconSource,
73
75
  spriteOutput: tmpdir,
@@ -85,7 +87,6 @@ describe('Test for the `build.ts`.', () => {
85
87
  const expectedJson = path.join(tmpdir, `${expectedIconName}.json`)
86
88
 
87
89
  build(styleYaml, styleJson, {
88
- provider: defaultValues.provider,
89
90
  spriteUrl: `http://localhost:8080/${expectedIconName}`,
90
91
  spriteInput: iconSource,
91
92
  spriteOutput: tmpdir,
@@ -101,7 +102,6 @@ describe('Test for the `build.ts`.', () => {
101
102
  const expectedJson = path.join(tmpdir, `${expectedIconName}.json`)
102
103
 
103
104
  build(styleYaml, styleJson, {
104
- provider: defaultValues.provider,
105
105
  spriteInput: iconSource,
106
106
  spriteOutput: tmpdir,
107
107
  }).then(() => {
@@ -115,7 +115,6 @@ describe('Test for the `build.ts`.', () => {
115
115
  const noExistInputDir = path.join(__dirname, 'data/hellooooo')
116
116
 
117
117
  const promise = build(styleYaml, styleJson, {
118
- provider: defaultValues.provider,
119
118
  spriteInput: noExistInputDir,
120
119
  spriteOutput: tmpdir,
121
120
  })
@@ -128,15 +127,13 @@ describe('Test for the `build.ts`.', () => {
128
127
  it('Should watch `*.yml` and convert it to JSON', async () => {
129
128
  const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms))
130
129
 
131
- const watcher = buildWatch(styleYaml, styleJson, {
132
- provider: defaultValues.provider,
133
- })
130
+ const watcher = buildWatch(styleYaml, styleJson, {})
134
131
  await sleep(500)
135
132
  const yamlData1 = fs
136
133
  .readFileSync(styleYaml, 'utf-8')
137
134
  .replace('metadata: {}', 'metadata: aaa')
138
135
  fs.writeFileSync(styleYaml, yamlData1)
139
- await sleep(500)
136
+ await sleep(1000)
140
137
  await watcher.close()
141
138
  assert.deepEqual(true, !!fs.statSync(styleJson))
142
139
  assert.deepEqual(
@@ -1,4 +1,4 @@
1
- import chai from 'chai'
1
+ import * as chai from 'chai'
2
2
  import chaiAsPromised from 'chai-as-promised'
3
3
  import path from 'path'
4
4
  import fs from 'fs'
@@ -10,7 +10,7 @@ import charites from './util/charitesCmd'
10
10
  let tmpdir = ''
11
11
  chai.use(chaiAsPromised)
12
12
  chai.should()
13
- const assert = chai.assert
13
+ const assert: Chai.AssertStatic = chai.assert
14
14
 
15
15
  describe('Test for the `charites build`', () => {
16
16
  beforeEach(async function () {
@@ -6,6 +6,12 @@ import os from 'os'
6
6
  import { convert } from '../src/commands/convert'
7
7
  import { build } from '../src/commands/build'
8
8
 
9
+ import { fileURLToPath } from 'url'
10
+ import { dirname } from 'path'
11
+
12
+ const __filename = fileURLToPath(import.meta.url)
13
+ const __dirname = dirname(__filename)
14
+
9
15
  let tmp: string
10
16
 
11
17
  describe('Test for the `convert.ts`.', () => {
@@ -46,7 +52,7 @@ id: example
46
52
 
47
53
  const outJsonPath = path.join(tmp, 'converted-back.json')
48
54
  // This will throw an error if the outputted YAML was invalid
49
- await build(yamlPath, outJsonPath, { provider: 'default' })
55
+ await build(yamlPath, outJsonPath, {})
50
56
  assert.isTrue(fs.existsSync(outJsonPath))
51
57
  })
52
58
 
@@ -2,7 +2,11 @@ import { assert } from 'chai'
2
2
  import path from 'path'
3
3
  import fs from 'fs'
4
4
  import { getSpriteSlug } from '../src/lib/get-sprite-slug'
5
+ import { fileURLToPath } from 'url'
6
+ import { dirname } from 'path'
5
7
 
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = dirname(__filename)
6
10
  const stylePath = path.join(__dirname, 'data/style.json')
7
11
  const styleJson = fs.readFileSync(stylePath, 'utf-8')
8
12
 
package/test/init.spec.ts CHANGED
@@ -6,6 +6,11 @@ import YAML from 'js-yaml'
6
6
 
7
7
  import { init, initOptions } from '../src/commands/init'
8
8
 
9
+ import { fileURLToPath } from 'url'
10
+ import { dirname } from 'path'
11
+ const __filename = fileURLToPath(import.meta.url)
12
+ const __dirname = dirname(__filename)
13
+
9
14
  describe('Test for the `init.ts`.', () => {
10
15
  it('Should initialize default style.yml.', async () => {
11
16
  const tempStylePath = path.join(__dirname, 'data/init/init.yml')
@@ -1,6 +1,6 @@
1
- import { test, expect } from '@playwright/test'
1
+ import { test, expect } from '@playwright/test/index.mjs'
2
2
 
3
- test('Charites Live Preview with maplibre', async ({ page }) => {
3
+ test('Charites Live Preview', async ({ page }) => {
4
4
  // collect errors on the page
5
5
  const pageErrors: Error[] = []
6
6
  page.on('pageerror', (exception) => pageErrors.push(exception))
@@ -1,5 +1,10 @@
1
+ import { fileURLToPath } from 'url'
2
+ import { dirname } from 'path'
1
3
  import path from 'path'
2
4
 
5
+ const __filename = fileURLToPath(import.meta.url)
6
+ const __dirname = dirname(__filename)
7
+
3
8
  export const charitesCliJs = path.join(__dirname, '..', '..', 'dist', 'cli.js')
4
9
 
5
10
  export default `"${process.execPath}" "${charitesCliJs}"`
@@ -1,6 +1,11 @@
1
1
  import path from 'path'
2
2
  import fs from 'fs'
3
3
  import fse from 'fs-extra'
4
+ import { fileURLToPath } from 'url'
5
+ import { dirname } from 'path'
6
+
7
+ const __filename = fileURLToPath(import.meta.url)
8
+ const __dirname = dirname(__filename)
4
9
 
5
10
  export const copyFixturesFile = (file: string, destDir: string) => {
6
11
  fs.copyFileSync(
@@ -2,7 +2,11 @@ import { assert } from 'chai'
2
2
  import path from 'path'
3
3
 
4
4
  import { parser } from '../src/lib/yaml-parser'
5
+ import { fileURLToPath } from 'url'
6
+ import { dirname } from 'path'
5
7
 
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = dirname(__filename)
6
10
  describe('Test for the `yaml-parser.ts`.', () => {
7
11
  it('should parse `data/example.yml`.', () => {
8
12
  const yamlPath = path.join(__dirname, 'data/example.yml')
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2018",
3
+ "target": "ESNext",
4
4
  "declaration": false,
5
5
  "declarationMap": false,
6
6
  "sourceMap": false,
@@ -12,10 +12,15 @@
12
12
  "esModuleInterop": true,
13
13
  "experimentalDecorators": true,
14
14
  "emitDecoratorMetadata": true,
15
- "module": "commonjs",
16
- "outDir": "./dist"
15
+ "resolveJsonModule": true,
16
+ "module": "ESNext",
17
+ "moduleResolution": "node",
18
+ "outDir": "./dist",
19
+ "baseUrl": ".",
20
+ "paths": {
21
+ "*": ["node_modules/*", "src/types/*"]
22
+ }
17
23
  },
18
- "include": [
19
- "src/cli.ts"
20
- ]
24
+ "include": ["src/**/*"],
25
+ "exclude": ["node_modules", "dist"]
21
26
  }
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- /node_modules/
2
- /dist
package/.eslintrc.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- ecmaVersion: 2020,
5
- sourceType: 'module',
6
- },
7
- extends: [
8
- 'plugin:@typescript-eslint/recommended',
9
- 'plugin:prettier/recommended',
10
- 'prettier',
11
- ],
12
- rules: {
13
- '@typescript-eslint/explicit-module-boundary-types': 0,
14
- '@typescript-eslint/ban-ts-comment': 0,
15
- '@typescript-eslint/no-var-requires': 0,
16
- },
17
- }
@@ -1,21 +0,0 @@
1
- Global configuration
2
- ====================
3
-
4
- Some options for Charites can be stored in a configuration file written in YAML.
5
-
6
- The config file will be automatically created to the following path the first time the charites command is executed.
7
-
8
- .. code-block:: bash
9
-
10
- ~/.charites/config.yml
11
-
12
-
13
- Global options can be specified as follows:
14
-
15
- .. code-block:: bash
16
-
17
- provider: mapbox
18
- mapboxAccessToken: xxxx
19
-
20
-
21
- With the example above, you get the same result as `charites serve --provider mapbox --mapbox-access-token xxxx`.
@@ -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