@geolonia/embed 5.2.2 → 6.0.0-pre.2

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 (66) hide show
  1. package/.github/workflows/build.yml +25 -1
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +24 -1
  4. package/dist/embed +1 -1
  5. package/dist/embed-chunks/4ada77b78cc0cc5ccef9.js +1 -0
  6. package/dist/embed-chunks/8176630945512b29f294.js +2 -0
  7. package/dist/embed-chunks/c783fffcd28083f7d5cb.js +2 -0
  8. package/dist/embed-chunks/f2124097fda51d0079ee.js +1 -0
  9. package/dist/embed-core.d.ts +6 -7
  10. package/dist/embed-core.js +1 -1
  11. package/dist/embed.d.ts +2 -4
  12. package/dist/embed.js +1 -1
  13. package/dist/lib/parse-atts.d.ts +19 -0
  14. package/dist/lib/render.d.ts +1 -1
  15. package/dist/lib/util.d.ts +14 -55
  16. package/dist/types.d.ts +155 -1
  17. package/dist/version.d.ts +1 -1
  18. package/e2e/auto-render.spec.ts +44 -0
  19. package/e2e/basic.spec.ts +10 -74
  20. package/e2e/cleanup.spec.ts +43 -0
  21. package/e2e/data-attributes.spec.ts +56 -0
  22. package/e2e/globals.spec.ts +51 -0
  23. package/e2e/helper.ts +170 -4
  24. package/e2e/iframe.spec.ts +35 -0
  25. package/e2e/lazy-loading.spec.ts +32 -0
  26. package/e2e/legacy-constructor.spec.ts +102 -0
  27. package/e2e/plugin.spec.ts +25 -0
  28. package/e2e/pmtiles.spec.ts +13 -0
  29. package/package.json +8 -11
  30. package/playwright.config.ts +6 -32
  31. package/src/embed-core.ts +12 -14
  32. package/src/embed.ts +2 -4
  33. package/src/lib/parse-atts.test.ts +186 -18
  34. package/src/lib/parse-atts.ts +151 -5
  35. package/src/lib/render.ts +50 -12
  36. package/src/lib/util.ts +37 -350
  37. package/src/types.ts +155 -1
  38. package/src/version.ts +1 -1
  39. package/typedoc.json +13 -0
  40. package/vitest.config.ts +7 -0
  41. package/dist/embed-chunks/12cbd0d1cb4cf744c32f.js +0 -2
  42. package/dist/embed-chunks/8a521e8312a5b4da123d.js +0 -2
  43. package/dist/lib/CustomAttributionControl.d.ts +0 -47
  44. package/dist/lib/controls/geolonia-control.d.ts +0 -7
  45. package/dist/lib/geolonia-map.d.ts +0 -30
  46. package/dist/lib/geolonia-marker.d.ts +0 -9
  47. package/dist/lib/keyring.d.ts +0 -45
  48. package/dist/lib/maplibre-util.d.ts +0 -25
  49. package/dist/lib/simplestyle-vector.d.ts +0 -26
  50. package/dist/lib/simplestyle.d.ts +0 -31
  51. package/e2e/external-style.spec.ts +0 -25
  52. package/e2e/map.spec.ts +0 -69
  53. package/src/lib/CustomAttributionControl.ts +0 -394
  54. package/src/lib/controls/geolonia-control.ts +0 -38
  55. package/src/lib/geolonia-map.ts +0 -429
  56. package/src/lib/geolonia-marker.ts +0 -53
  57. package/src/lib/keyring.test.ts +0 -127
  58. package/src/lib/keyring.ts +0 -136
  59. package/src/lib/maplibre-util.ts +0 -137
  60. package/src/lib/marker.svg +0 -1
  61. package/src/lib/simplestyle-vector.ts +0 -257
  62. package/src/lib/simplestyle.test.ts +0 -289
  63. package/src/lib/simplestyle.ts +0 -435
  64. package/src/lib/util.test.ts +0 -364
  65. /package/dist/embed-chunks/{12cbd0d1cb4cf744c32f.js.LICENSE.txt → 8176630945512b29f294.js.LICENSE.txt} +0 -0
  66. /package/dist/embed-chunks/{8a521e8312a5b4da123d.js.LICENSE.txt → c783fffcd28083f7d5cb.js.LICENSE.txt} +0 -0
@@ -49,6 +49,29 @@ jobs:
49
49
  dist/
50
50
  docs/
51
51
 
52
+ e2e:
53
+ runs-on: ubuntu-latest
54
+ timeout-minutes: 30
55
+ needs: build
56
+ steps:
57
+ - uses: actions/checkout@v6
58
+ - uses: actions/setup-node@v6
59
+ with:
60
+ node-version: '22.x'
61
+ cache: 'npm'
62
+ - run: npm ci
63
+ - name: Install Playwright
64
+ run: npx playwright install --with-deps chromium
65
+ - name: Run e2e tests
66
+ run: npm run e2e
67
+ - name: Upload Playwright report
68
+ uses: actions/upload-artifact@v7
69
+ if: ${{ !cancelled() }}
70
+ with:
71
+ name: playwright-report
72
+ path: playwright-report/
73
+ retention-days: 7
74
+
52
75
  gh-pages:
53
76
  name: 'Host with GitHub Pages'
54
77
  runs-on: ubuntu-latest
@@ -87,6 +110,7 @@ jobs:
87
110
  contents: read
88
111
  needs:
89
112
  - build
113
+ - e2e
90
114
  - act-test
91
115
  if: startsWith(github.ref, 'refs/tags/v')
92
116
  steps:
@@ -113,7 +137,7 @@ jobs:
113
137
  run: npm publish --access=public --tag=next
114
138
 
115
139
  deploy:
116
- needs: build
140
+ needs: [build, e2e]
117
141
  runs-on: ubuntu-latest
118
142
  if: startsWith(github.ref, 'refs/tags/v')
119
143
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## @geolonia/embed
4
4
 
5
+ ### v6.0.0-pre.0
6
+
7
+ コア実装を `@geolonia/maps-core` に委譲し、embed は「HTML 埋め込みラッパー」に専念する構成へ移行しました。
8
+
9
+ - **Refactor**: 地図コア(`GeoloniaMap` / `GeoloniaMarker` / `SimpleStyle` / `SimpleStyleVector` / `keyring` / attribution・logo コントロール等)を [`@geolonia/maps-core`](https://github.com/geolonia/maps-core) に移管。embed 側には `data-*` 属性のパースと DOM 自動走査・遅延読み込み・プラグイン機構といったラッパー機能のみを残しました。
10
+ - **Breaking**: `GeoloniaMap` コンストラクタは `GeoloniaMapOptions` オブジェクトのみを受け取ります。DOM 要素や CSS セレクタ文字列の直接指定は廃止されました(`new geolonia.Map({ container })` を使用してください)。
11
+ - **Breaking**: `keyring.parse()`(DOM スキャン)は廃止されました。API キーは `<script src="...?geolonia-api-key=KEY">` から embed が読み取り、`keyring.setApiKey()` で maps-core に渡します(既存の script タグ方式は引き続き動作します)。
12
+ - **Internal**: maps-core が内包する依存(pmtiles / sanitize-html / tinycolor2 / turf / gesture-handling 等)を embed の直接依存から削除しました。
13
+
5
14
  ### nightly
6
15
 
7
16
  - **Feature**: Added support for external style.json URLs in `data-style` attribute
package/README.md CHANGED
@@ -51,7 +51,7 @@ npm install @geolonia/embed
51
51
  ```typescript
52
52
  import { GeoloniaMap, keyring } from "@geolonia/embed/core";
53
53
 
54
- keyring.apiKey = "YOUR-API-KEY";
54
+ keyring.setApiKey("YOUR-API-KEY");
55
55
 
56
56
  const map = new GeoloniaMap({
57
57
  container: "#map",
@@ -108,6 +108,29 @@ The `data-style` attribute accepts:
108
108
  - **Relative paths**: `./custom-style.json`, `/styles/my-style.json`
109
109
  - **Files ending in .json**: Automatically resolved to absolute URLs
110
110
 
111
+ #### data-lang attribute
112
+
113
+ The `data-lang` attribute controls the language of map labels:
114
+
115
+ - `ja` — Japanese labels
116
+ - `en` (or any other non-Japanese value) — English labels
117
+ - `auto` — follow the browser language (`navigator.languages`)
118
+ - **omitted** — same as `auto` (follows the browser language)
119
+
120
+ Only `ja` / `ja-jp` resolve to Japanese; every other value resolves to English.
121
+
122
+ **Important:** when neither `data-lang` nor `lang` is specified, the language follows the browser setting. On a non-Japanese browser this loads the English style (`en.json`). Set it explicitly to force a language:
123
+
124
+ ```html
125
+ <div class="geolonia" data-lang="ja" ...></div>
126
+ ```
127
+
128
+ When using the JavaScript API (`new GeoloniaMap({...})`), pass `lang` in the options instead of a `data-lang` attribute:
129
+
130
+ ```ts
131
+ const map = new GeoloniaMap({ container: "#map", lang: "ja" });
132
+ ```
133
+
111
134
  You can see more examples at [https://geolonia.github.io/embed/](https://geolonia.github.io/embed/).
112
135
 
113
136
  # Contributing