@geolonia/embed 5.2.2 → 6.0.0-pre.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 (66) hide show
  1. package/.github/workflows/build.yml +25 -1
  2. package/CHANGELOG.md +15 -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
package/e2e/helper.ts CHANGED
@@ -1,12 +1,178 @@
1
1
  import { Page } from '@playwright/test';
2
- // テスト用の設定
2
+
3
3
  export const TEST_URL = 'http://localhost:3000/e2e';
4
4
  export const LOAD_TIMEOUT = 5000;
5
5
 
6
- // ヘルパー関数
6
+ /** 地図コンテナと canvas の出現を待つ。既存テスト互換。 */
7
7
  export async function waitForMapLoad(page: Page, selector = '.geolonia') {
8
- // 地図コンテナの存在を確認
9
8
  await page.waitForSelector(selector);
10
- // Maplibreのcanvasが表示されるまで待機
11
9
  await page.waitForSelector(`${selector} canvas`, { timeout: LOAD_TIMEOUT });
12
10
  }
11
+
12
+ /** Maplibre Map の load + isStyleLoaded を待つ。スタイル依存テスト向け。 */
13
+ export async function waitForStyleLoad(page: Page, selector = '#map') {
14
+ await page.waitForFunction(
15
+ (sel) => {
16
+ const el = document.querySelector(sel) as any;
17
+ return !!(el && el.geoloniaMap && el.geoloniaMap.loaded() && el.geoloniaMap.isStyleLoaded());
18
+ },
19
+ selector,
20
+ { timeout: LOAD_TIMEOUT },
21
+ );
22
+ }
23
+
24
+ /** container.geoloniaMap が生成済みか確認。 */
25
+ export async function hasMapInstance(page: Page, selector = '#map'): Promise<boolean> {
26
+ return page.evaluate((sel) => {
27
+ const el = document.querySelector(sel) as any;
28
+ return !!(el && el.geoloniaMap);
29
+ }, selector);
30
+ }
31
+
32
+ export async function getCenter(page: Page, selector = '#map'): Promise<{ lat: number; lng: number }> {
33
+ return page.evaluate((sel) => {
34
+ const el = document.querySelector(sel) as any;
35
+ const c = el.geoloniaMap.getCenter();
36
+ return { lat: c.lat, lng: c.lng };
37
+ }, selector);
38
+ }
39
+
40
+ export async function getZoom(page: Page, selector = '#map'): Promise<number> {
41
+ return page.evaluate((sel) => {
42
+ const el = document.querySelector(sel) as any;
43
+ return el.geoloniaMap.getZoom();
44
+ }, selector);
45
+ }
46
+
47
+ export async function getBearing(page: Page, selector = '#map'): Promise<number> {
48
+ return page.evaluate((sel) => {
49
+ const el = document.querySelector(sel) as any;
50
+ return el.geoloniaMap.getBearing();
51
+ }, selector);
52
+ }
53
+
54
+ export async function getPitch(page: Page, selector = '#map'): Promise<number> {
55
+ return page.evaluate((sel) => {
56
+ const el = document.querySelector(sel) as any;
57
+ return el.geoloniaMap.getPitch();
58
+ }, selector);
59
+ }
60
+
61
+ export async function getStyleLayerIds(page: Page, selector = '#map'): Promise<string[]> {
62
+ return page.evaluate((sel) => {
63
+ const el = document.querySelector(sel) as any;
64
+ return el.geoloniaMap.getStyle().layers.map((l: any) => l.id);
65
+ }, selector);
66
+ }
67
+
68
+ export async function hasLayer(page: Page, layerId: string, selector = '#map'): Promise<boolean> {
69
+ return page.evaluate(
70
+ ({ sel, id }) => {
71
+ const el = document.querySelector(sel) as any;
72
+ return !!el.geoloniaMap.getLayer(id);
73
+ },
74
+ { sel: selector, id: layerId },
75
+ );
76
+ }
77
+
78
+ export async function hasSource(page: Page, sourceId: string, selector = '#map'): Promise<boolean> {
79
+ return page.evaluate(
80
+ ({ sel, id }) => {
81
+ const el = document.querySelector(sel) as any;
82
+ return !!el.geoloniaMap.getSource(id);
83
+ },
84
+ { sel: selector, id: sourceId },
85
+ );
86
+ }
87
+
88
+ // Geolonia ベクトルタイルのホスト。TileJSON で返す URL とリクエスト捕捉用 regex の両方が
89
+ // この定数から派生するので、両者が乖離することは構造上ありえない。
90
+ const GEOLONIA_TILE_HOST = 'tiles.geolonia.com';
91
+ const GEOLONIA_TILE_URL_TEMPLATE = `https://${GEOLONIA_TILE_HOST}/{z}/{x}/{y}.pbf`;
92
+ // サブドメイン付き (`osm.v3.tiles.geolonia.com` 等) もサブドメイン無しも同一 regex で捕捉。
93
+ const GEOLONIA_TILE_PBF_REGEX = new RegExp(
94
+ String.raw`(?:[^/]+\.)?` + GEOLONIA_TILE_HOST.replace(/\./g, String.raw`\.`) + String.raw`\/.*\.pbf`,
95
+ );
96
+
97
+ /**
98
+ * Geolonia のスタイル/タイル/スプライト等を最小レスポンスでモックする。
99
+ * テスト先頭の beforeEach で呼ぶ前提。
100
+ *
101
+ * 返すスタイルは maps-core の sample-basic-style.json (PR #81) に揃えた
102
+ * minimal style v8。具体的には:
103
+ * - `glyphs` フィールド (symbol layer が silently skip されないため必須)
104
+ * - dummy `fixture` source + attribution (attribution テストで集計対象を作る)
105
+ * - background + fixture fill レイヤ
106
+ *
107
+ * 認証URL検証など transformRequest の挙動は実リクエスト前にここで握る。
108
+ */
109
+ export async function mockGeoloniaTiles(page: Page) {
110
+ // スタイル JSON (cdn.geolonia.com/style/...)
111
+ await page.route(/cdn\.geolonia\.com\/style\/.+\.json/, (route) =>
112
+ route.fulfill({
113
+ status: 200,
114
+ contentType: 'application/json',
115
+ body: JSON.stringify({
116
+ version: 8,
117
+ glyphs: '/glyphs/{fontstack}/{range}.pbf',
118
+ sources: {
119
+ fixture: {
120
+ type: 'geojson',
121
+ data: { type: 'FeatureCollection', features: [] },
122
+ attribution: '<a href="https://example.com">Test fixture</a>',
123
+ },
124
+ },
125
+ layers: [
126
+ { id: 'background', type: 'background', paint: { 'background-color': '#cccccc' } },
127
+ { id: 'fixture', type: 'fill', source: 'fixture', paint: { 'fill-color': '#cccccc' } },
128
+ ],
129
+ }),
130
+ }),
131
+ );
132
+
133
+ // スプライト / グリフ / フォント関連は 404 でよい (実体は不要だが minimal style 内の
134
+ // glyphs path に対するリクエストが net error にならないよう route で握る)
135
+ await page.route(/cdn\.geolonia\.com\/(sprite|glyph|font)/, (route) =>
136
+ route.fulfill({ status: 404, body: '' }),
137
+ );
138
+
139
+ // TileJSON
140
+ await page.route(/tileserver\.geolonia\.com\/.*/, (route) =>
141
+ route.fulfill({
142
+ status: 200,
143
+ contentType: 'application/json',
144
+ body: JSON.stringify({
145
+ tilejson: '2.2.0',
146
+ tiles: [GEOLONIA_TILE_URL_TEMPLATE],
147
+ minzoom: 0,
148
+ maxzoom: 14,
149
+ }),
150
+ }),
151
+ );
152
+
153
+ // ベクトルタイル (上記 TileJSON が返した URL を必ず捕捉)
154
+ await page.route(GEOLONIA_TILE_PBF_REGEX, (route) =>
155
+ route.fulfill({ status: 204, body: '' }),
156
+ );
157
+
158
+ // api.geolonia.com (legacy / permission check 等)
159
+ await page.route(/api\.geolonia\.com\/.*/, (route) =>
160
+ route.fulfill({ status: 200, contentType: 'application/json', body: '{}' }),
161
+ );
162
+ }
163
+
164
+ /**
165
+ * 指定 predicate にマッチしたリクエスト URL を記録する。
166
+ * 呼び出し時点で配列を返し、以降の page 操作中に push される。
167
+ * 認証パラメータ注入の検証などに使用。
168
+ */
169
+ export function recordRequests(
170
+ page: Page,
171
+ predicate: (url: string) => boolean = () => true,
172
+ ): string[] {
173
+ const urls: string[] = [];
174
+ page.on('request', (req) => {
175
+ if (predicate(req.url())) urls.push(req.url());
176
+ });
177
+ return urls;
178
+ }
@@ -0,0 +1,35 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import { TEST_URL, mockGeoloniaTiles, waitForMapLoad, hasMapInstance } from './helper';
3
+
4
+ // embed (wrapper) 固有: checkPermission() による iframe 埋め込み制限。
5
+ // maps-core にこのゲートは無い。
6
+ //
7
+ // 拒否される側 (iframe + API key 無し + 非特例 origin) の E2E 再現は難しいため skip し、
8
+ // ここでは「非 iframe では拒否されず描画される」= 許可側の経路のみを守る。
9
+ test.describe('iframe 許可チェック / checkPermission (wrapper-only)', () => {
10
+ test('非 iframe では拒否されず地図が描画される (iframe 拒否メッセージが出ない)', async ({ page }) => {
11
+ const consoleErrors: string[] = [];
12
+ page.on('console', (msg) => {
13
+ if (msg.type() === 'error') consoleErrors.push(msg.text());
14
+ });
15
+
16
+ await mockGeoloniaTiles(page);
17
+ await page.goto(`${TEST_URL}/basic.html`);
18
+ await waitForMapLoad(page);
19
+
20
+ // 描画されている = checkPermission が許可した
21
+ expect(await hasMapInstance(page, '#map')).toBe(true);
22
+
23
+ // iframe 拒否のメッセージは出ていないこと
24
+ expect(consoleErrors.some((t) => t.includes("can't display our map in iframe"))).toBe(false);
25
+ });
26
+
27
+ // 拒否ケース (iframe + API key 無し → console.error) は E2E では再現が難しい:
28
+ // - ローカルでは特例 origin (codepen 等) + referrer を満たせない
29
+ // - child frame の console は親フレームから capture しにくい
30
+ // このゲートは checkPermission() のユニットテスト (window.self/parent/location をモック) で
31
+ // 検証する方が現実的。E2E では skip する (silent に落とさず明示)。
32
+ test.skip('iframe + API key 無し → 拒否される (ユニットテストで担保)', async () => {
33
+ // intentionally skipped — see comment above
34
+ });
35
+ });
@@ -0,0 +1,32 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import { TEST_URL, mockGeoloniaTiles, waitForStyleLoad, hasMapInstance } from './helper';
3
+
4
+ // embed (wrapper) 固有: IntersectionObserver による遅延読み込み。
5
+ // maps-core は new GeoloniaMap() の明示初期化のみで、この lazy 機構を持たない。
6
+ test.describe('遅延読み込み / IntersectionObserver (wrapper-only)', () => {
7
+ test.beforeEach(async ({ page }) => {
8
+ await mockGeoloniaTiles(page);
9
+ });
10
+
11
+ test('data-lazy-loading="off" は viewport 外でも即時初期化される', async ({ page }) => {
12
+ await page.goto(`${TEST_URL}/lazy-loading.html`);
13
+ // スクロールせずとも初期化済み
14
+ await waitForStyleLoad(page, '#eager-map');
15
+ expect(await hasMapInstance(page, '#eager-map')).toBe(true);
16
+ });
17
+
18
+ test('デフォルト (lazy) は viewport 外では未初期化、スクロールで初期化される', async ({ page }) => {
19
+ await page.goto(`${TEST_URL}/lazy-loading.html`);
20
+
21
+ // スクロール前: lazy-map はまだ初期化されていない
22
+ // (IntersectionObserver の callback は非同期なので、誤発火しないことも含め少し待つ)
23
+ await page.waitForTimeout(300);
24
+ expect(await hasMapInstance(page, '#lazy-map')).toBe(false);
25
+
26
+ // viewport に入れる
27
+ await page.locator('#lazy-map').scrollIntoViewIfNeeded();
28
+ await waitForStyleLoad(page, '#lazy-map');
29
+
30
+ expect(await hasMapInstance(page, '#lazy-map')).toBe(true);
31
+ });
32
+ });
@@ -0,0 +1,102 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import { Geolonia } from '../src/embed';
3
+ import {
4
+ TEST_URL,
5
+ mockGeoloniaTiles,
6
+ waitForStyleLoad,
7
+ getCenter,
8
+ getZoom,
9
+ hasMapInstance,
10
+ } from './helper';
11
+
12
+ declare global {
13
+ interface Window {
14
+ geolonia: Geolonia;
15
+ }
16
+ }
17
+
18
+ /**
19
+ * maps-core#90 を embed 経由で検証する。embed は `window.geolonia.Map` に
20
+ * maps-core の GeoloniaMap をそのまま公開しているため、旧 embed 由来の呼び出し
21
+ * 規約 —— CSS セレクタ文字列 / HTMLElement / options オブジェクト —— が
22
+ * wrapper 越しに壊れていないことをここで守る。
23
+ *
24
+ * legacy 形式 (文字列 / 要素) のときにコンテナの data-* を読むのは maps-core#90 の
25
+ * legacy パスの責務で、embed 側の parse-atts (auto-scan 経路) とは別。よって
26
+ * コンテナには `.geolonia` を付けず、auto-render と混ざらない状態で構築する。
27
+ */
28
+ test.describe('legacy コンストラクタ引数 (maps-core#90, wrapper 経由)', () => {
29
+ test.beforeEach(async ({ page }) => {
30
+ await mockGeoloniaTiles(page);
31
+ await page.goto(`${TEST_URL}/legacy-constructor.html`);
32
+ // embed バンドルのロード (window.geolonia.Map の公開) を待つ。
33
+ await page.waitForFunction(
34
+ () => typeof window.geolonia?.Map === 'function',
35
+ );
36
+ });
37
+
38
+ test('CSS セレクタ文字列で構築し、その要素の data-* を反映する', async ({
39
+ page,
40
+ }) => {
41
+ await page.evaluate(() => {
42
+ const map = new window.geolonia.Map('#map-selector');
43
+ return map.getContainer().id;
44
+ });
45
+ await waitForStyleLoad(page, '#map-selector');
46
+
47
+ expect(await hasMapInstance(page, '#map-selector')).toBe(true);
48
+ const center = await getCenter(page, '#map-selector');
49
+ expect(center.lat).toBeCloseTo(35, 4);
50
+ expect(center.lng).toBeCloseTo(139, 4);
51
+ expect(await getZoom(page, '#map-selector')).toBeCloseTo(10, 4);
52
+ });
53
+
54
+ test('HTMLElement で構築し、その要素の data-* を反映する', async ({ page }) => {
55
+ await page.evaluate(() => {
56
+ const el = document.getElementById('map-element');
57
+ if (!el) throw new Error('fixture #map-element missing');
58
+ const map = new window.geolonia.Map(el);
59
+ return map.getContainer().id;
60
+ });
61
+ await waitForStyleLoad(page, '#map-element');
62
+
63
+ const center = await getCenter(page, '#map-element');
64
+ expect(center.lat).toBeCloseTo(34, 4);
65
+ expect(center.lng).toBeCloseTo(135, 4);
66
+ expect(await getZoom(page, '#map-element')).toBeCloseTo(8, 4);
67
+ });
68
+
69
+ test('options オブジェクトは data-* を読まず、options が優先される', async ({
70
+ page,
71
+ }) => {
72
+ // #map-options には decoy の data-zoom="2" があるが、object 形式では読まれず
73
+ // options.center / zoom が使われる (maps-core#90 の「object 素通し」契約)。
74
+ await page.evaluate(() => {
75
+ const map = new window.geolonia.Map({
76
+ container: '#map-options',
77
+ center: [140, 36],
78
+ zoom: 7,
79
+ });
80
+ return map.getContainer().id;
81
+ });
82
+ await waitForStyleLoad(page, '#map-options');
83
+
84
+ const center = await getCenter(page, '#map-options');
85
+ expect(center.lat).toBeCloseTo(36, 4);
86
+ expect(center.lng).toBeCloseTo(140, 4);
87
+ // data-zoom="2" ではなく options.zoom=7 が効く。
88
+ expect(await getZoom(page, '#map-options')).toBeCloseTo(7, 4);
89
+ });
90
+
91
+ test('存在しないセレクタは Geolonia のエラーを投げる', async ({ page }) => {
92
+ const message = await page.evaluate(() => {
93
+ try {
94
+ const map = new window.geolonia.Map('#no-such-container');
95
+ return map.getContainer().id;
96
+ } catch (e) {
97
+ return (e as Error).message;
98
+ }
99
+ });
100
+ expect(message).toMatch(/No HTML elements found/);
101
+ });
102
+ });
@@ -0,0 +1,25 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import { TEST_URL, mockGeoloniaTiles, waitForStyleLoad } from './helper';
3
+
4
+ // embed (wrapper) 固有: registerPlugin で登録した callback が auto-render された全 map に対し
5
+ // (map, target, atts) 付きで呼ばれる。maps-core にプラグイン機構は無い。
6
+ test.describe('プラグインシステム (wrapper-only)', () => {
7
+ test('registerPlugin の callback が各 map に対し正しい引数で呼ばれる', async ({ page }) => {
8
+ await mockGeoloniaTiles(page);
9
+ await page.goto(`${TEST_URL}/plugin.html`);
10
+
11
+ await waitForStyleLoad(page, '#map-1');
12
+ await waitForStyleLoad(page, '#map-2');
13
+
14
+ // plugin は DOMContentLoaded 時に登録 → キューされた全 map に対して実行される
15
+ await page.waitForFunction(() => (window as any).__pluginCalls?.length === 2, undefined, {
16
+ timeout: 2000,
17
+ });
18
+
19
+ const calls = await page.evaluate(() => (window as any).__pluginCalls);
20
+ expect(calls).toHaveLength(2);
21
+ expect(calls.map((c: any) => c.targetId).sort()).toEqual(['map-1', 'map-2']);
22
+ // atts は parse-atts が container.dataset を spread したもの。data-lat は文字列で渡る。
23
+ expect(calls.find((c: any) => c.targetId === 'map-1').lat).toBe('35');
24
+ });
25
+ });
@@ -0,0 +1,13 @@
1
+ import { test } from '@playwright/test';
2
+
3
+ // embed (wrapper) 固有: renderGeoloniaMap() 内で pmtiles プロトコルを登録する
4
+ // (maplibregl.addProtocol('pmtiles', ...))。maps-core では import 時に登録され、
5
+ // 登録タイミングが異なる。
6
+ //
7
+ // E2E で「登録タイミング」を堅牢に検証するのは難しく (グローバルな protocol 登録は
8
+ // 観測しづらく、実 pmtiles ソースの用意も要る)、得られる回帰検知の価値が低い。
9
+ // 実 pmtiles ソースを用いた描画検証は maps-core 側 / ユニットで担保する想定。
10
+ // 取りこぼしを明示するため、ここでは skip として残す (silent に落とさない)。
11
+ test.skip('renderGeoloniaMap 内で pmtiles プロトコルが登録される (maps-core/ユニットで担保)', async () => {
12
+ // intentionally skipped — see comment above
13
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/embed",
3
- "version": "5.2.2",
3
+ "version": "6.0.0-pre.3",
4
4
  "description": "Geolonia embed JS API",
5
5
  "main": "dist/embed.js",
6
6
  "types": "dist/src/embed.d.ts",
@@ -23,7 +23,8 @@
23
23
  "format": "prettier \"./src/**/*.ts\" --write",
24
24
  "lint": "eslint .",
25
25
  "test": "vitest run",
26
- "e2e": "playwright test"
26
+ "e2e": "playwright test",
27
+ "docs:api": "typedoc"
27
28
  },
28
29
  "author": "Geolonia (https://geolonia.com)",
29
30
  "repository": {
@@ -58,6 +59,8 @@
58
59
  "style-loader": "^3.3.1",
59
60
  "svg-inline-loader": "^0.8.2",
60
61
  "ts-loader": "^9.4.3",
62
+ "typedoc": "^0.28.20",
63
+ "typedoc-plugin-markdown": "^4.12.0",
61
64
  "typescript": "^5.1.3",
62
65
  "vitest": "^4.1.1",
63
66
  "webpack": "^5.75.0",
@@ -66,14 +69,8 @@
66
69
  "webpack-dev-server": "^4.11.1"
67
70
  },
68
71
  "dependencies": {
69
- "@geolonia/mbgl-gesture-handling": "^1.0.15",
70
- "@mapbox/geojson-extent": "^1.0.0",
71
- "@mapbox/point-geometry": "^0.1.0",
72
- "@playwright/test": "^1.53.1",
73
- "@turf/center": "^6.0.1",
74
- "maplibre-gl": "5.19.0",
75
- "pmtiles": "^3.0.6",
76
- "sanitize-html": "^2.8.0",
77
- "tinycolor2": "^1.4.1"
72
+ "@geolonia/maps-core": "^0.5.1",
73
+ "@playwright/test": "^1.61.1",
74
+ "maplibre-gl": "5.19.0"
78
75
  }
79
76
  }
@@ -22,7 +22,7 @@ export default defineConfig({
22
22
  /* Opt out of parallel tests on CI. */
23
23
  workers: process.env.CI ? 1 : undefined,
24
24
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
25
- reporter: 'html',
25
+ reporter: 'list',
26
26
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
27
27
  use: {
28
28
  /* Base URL to use in actions like `await page.goto('/')`. */
@@ -32,42 +32,16 @@ export default defineConfig({
32
32
  trace: 'on-first-retry',
33
33
  },
34
34
 
35
- /* Configure projects for major browsers */
35
+ /*
36
+ * embed は maplibre-gl の薄いラッパーであり、クロスブラウザ互換は
37
+ * maplibre 本体のテストに委ねる。embed 側の E2E は chromium のみで
38
+ * 回し、iteration 速度を優先する。
39
+ */
36
40
  projects: [
37
41
  {
38
42
  name: 'chromium',
39
43
  use: { ...devices['Desktop Chrome'] },
40
44
  },
41
-
42
- {
43
- name: 'firefox',
44
- use: { ...devices['Desktop Firefox'] },
45
- },
46
-
47
- {
48
- name: 'webkit',
49
- use: { ...devices['Desktop Safari'] },
50
- },
51
-
52
- /* Test against mobile viewports. */
53
- // {
54
- // name: 'Mobile Chrome',
55
- // use: { ...devices['Pixel 5'] },
56
- // },
57
- // {
58
- // name: 'Mobile Safari',
59
- // use: { ...devices['iPhone 12'] },
60
- // },
61
-
62
- /* Test against branded browsers. */
63
- // {
64
- // name: 'Microsoft Edge',
65
- // use: { ...devices['Desktop Edge'], channel: 'msedge' },
66
- // },
67
- // {
68
- // name: 'Google Chrome',
69
- // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
70
- // },
71
45
  ],
72
46
 
73
47
  /* Run your local dev server before starting the tests */
package/src/embed-core.ts CHANGED
@@ -1,22 +1,20 @@
1
1
  /**
2
2
  * @file Side-effect-free entry point for programmatic use (e.g. React wrapper).
3
3
  * Does NOT call renderGeoloniaMap() or set window.geolonia.
4
- * Only registers the PMTiles protocol, which is required for all users.
4
+ *
5
+ * The Geolonia core (map, marker, simplestyle, keyring, PMTiles protocol
6
+ * registration, ...) now lives in `@geolonia/maps-core`; this entry simply
7
+ * re-exports it alongside embed-specific helpers (registerPlugin, version).
5
8
  */
6
9
 
7
- import maplibregl from 'maplibre-gl';
8
- import { Protocol } from 'pmtiles';
9
-
10
- // PMTiles protocol registration (required side effect)
11
- const protocol = new Protocol();
12
- maplibregl.addProtocol('pmtiles', protocol.tile);
13
-
14
- export { default as GeoloniaMap } from './lib/geolonia-map';
15
- export { default as GeoloniaMarker } from './lib/geolonia-marker';
16
- export { SimpleStyle } from './lib/simplestyle';
17
- export { default as SimpleStyleVector } from './lib/simplestyle-vector';
18
- export { keyring } from './lib/keyring';
10
+ export {
11
+ GeoloniaMap,
12
+ GeoloniaMarker,
13
+ SimpleStyle,
14
+ SimpleStyleVector,
15
+ keyring,
16
+ } from '@geolonia/maps-core';
19
17
  export { registerPlugin } from './lib/render';
20
18
  export { VERSION as embedVersion } from './version';
21
19
  export type { EmbedAttributes, EmbedPlugin } from './types';
22
- export type { GeoloniaMapOptions } from './lib/geolonia-map';
20
+ export type { GeoloniaMapOptions } from '@geolonia/maps-core';
package/src/embed.ts CHANGED
@@ -3,13 +3,11 @@
3
3
  */
4
4
 
5
5
  import * as maplibregl from 'maplibre-gl';
6
- import GeoloniaMap from './lib/geolonia-map';
7
- import GeoloniaMarker from './lib/geolonia-marker';
8
- import { SimpleStyle } from './lib/simplestyle';
6
+ import { GeoloniaMap, GeoloniaMarker, SimpleStyle } from '@geolonia/maps-core';
9
7
  import { VERSION as embedVersion } from './version';
10
8
  import { registerPlugin, renderGeoloniaMap } from './lib/render';
11
9
 
12
- export type { GeoloniaMapOptions } from './lib/geolonia-map';
10
+ export type { GeoloniaMapOptions } from '@geolonia/maps-core';
13
11
 
14
12
  export type Popup = maplibregl.Popup;
15
13