@geolonia/embed 6.0.1 → 6.1.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.
- package/CHANGELOG.md +20 -0
- package/README.md +54 -6
- package/dist/embed +1 -1
- package/dist/embed-chunks/1b101382794d13cd280c.js +2 -0
- package/dist/embed-chunks/856a68e16ab05c382e6f.js +2 -0
- package/dist/embed-chunks/9a1056aa012055998dc3.js +1 -0
- package/dist/embed-chunks/{5f80e0235f4b38778d0d.js → bf6d08239720e38dacd6.js} +1 -1
- package/dist/embed-core.js +1 -1
- package/dist/embed.js +1 -1
- package/dist/types.d.ts +145 -7
- package/dist/version.d.ts +1 -1
- package/e2e/data-driven.spec.ts +9 -2
- package/e2e/mask.spec.ts +75 -0
- package/e2e/projection-raster-tiles.spec.ts +71 -0
- package/package.json +2 -2
- package/pnpm-workspace.yaml +6 -0
- package/src/lib/parse-atts.test.ts +531 -4
- package/src/lib/parse-atts.ts +261 -25
- package/src/types.ts +145 -7
- package/src/version.ts +1 -1
- package/dist/embed-chunks/9734b8bdf9fe84261b54.js +0 -2
- package/dist/embed-chunks/ae36f6b8e34f85ae3045.js +0 -2
- package/dist/embed-chunks/c83bb7c9a4a7ed9d5b23.js +0 -1
- /package/dist/embed-chunks/{9734b8bdf9fe84261b54.js.LICENSE.txt → 1b101382794d13cd280c.js.LICENSE.txt} +0 -0
- /package/dist/embed-chunks/{ae36f6b8e34f85ae3045.js.LICENSE.txt → 856a68e16ab05c382e6f.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
## @geolonia/embed
|
|
4
4
|
|
|
5
|
+
### v6.1.0
|
|
6
|
+
|
|
7
|
+
同梱する `@geolonia/maps-core` を 0.9.0 に上げ、0.9.0 で追加された機能を `data-*` 属性から使えるようにしました。既存の属性の扱いは変わりません。
|
|
8
|
+
|
|
9
|
+
- **Feature**: `data-projection="globe"` で、地図を地球儀(globe 投影)で表示できるようにしました([#580](https://github.com/geolonia/embed/pull/580))。
|
|
10
|
+
- **Feature**: `data-raster-tiles` で、他の配信元のラスタタイル(ハザードマップ、地理院タイルなど)を地図に 1 枚重ねられるようにしました([#580](https://github.com/geolonia/embed/pull/580))。出典は `data-raster-tiles-attribution`、不透明度は `-opacity`、タイルの大きさは `-size`、配信されているズームの範囲は `-min-zoom` と `-max-zoom` で指定します。
|
|
11
|
+
- **Note**: `data-raster-tiles-attribution` は HTML として表示されます。ページの作者が書いた値だけを入れ、URL のパラメータなど外から受け取った値を入れないでください。
|
|
12
|
+
- **Feature**: `data-choropleth-colors` と `data-circle-colors` に `normal:#3b82f6, danger:#ef4444` のような `値:色` の組を書くと、値ごとの色を指定できるようにしました([#582](https://github.com/geolonia/embed/pull/582))。色だけを並べた書き方は、これまでどおり使えます。
|
|
13
|
+
- **Feature**: `data-extrusion` で、`data-geojson` のポリゴンをプロパティの値に応じた高さで立体的に描けるようにしました([#583](https://github.com/geolonia/embed/pull/583))。高さは `-max-height`、`-height-scale`、`-height-range`、色は `-color`、`-colors`、`-color-range` で調整します。`-colors` にも `値:色` の組を書けます。立体に見せるには `data-pitch` も指定してください。
|
|
14
|
+
- **Feature**: `data-mask` で、境界の GeoJSON で指定した範囲の外側を暗くできるようにしました([#583](https://github.com/geolonia/embed/pull/583))。色は `-color`、不透明度は `-opacity`、境界線は `-outline="on"` で指定します。
|
|
15
|
+
- **Fix**: 地図の読み込みが終わる前に `remove()` した地図のローディング表示が、コンテナに残らないようにしました。あわせて、破棄した地図に `remove()` をもう一度呼んでも、同じコンテナに作り直した地図を壊さないようにしました(maps-core 0.9.0 の修正、[maps-core#173](https://github.com/geolonia/maps-core/pull/173))。
|
|
16
|
+
- **Docs**: `data-geojson` と `data-lang` の TSDoc と README を、実際の挙動に合わせました([#569](https://github.com/geolonia/embed/pull/569))。
|
|
17
|
+
|
|
18
|
+
#### 6.0.1 から更新する場合
|
|
19
|
+
|
|
20
|
+
- **`data-projection`、`data-raster-tiles`、`data-extrusion`、`data-mask` とその補助の属性を独自の用途で付けていたページでは、その値が地図の描き方に使われるようになります。**
|
|
21
|
+
- **対応**: 衝突する場合は属性名を変えてください。
|
|
22
|
+
- **TypeScript で、`@geolonia/embed` が再エクスポートする `GeoloniaMapOptions` の `choropleth` や `circle` の `colors` を読んでいる場合、その型が `string[]` から `string[] | ColorMap` に広がりました**(maps-core 0.9.0)。値を渡す側のコードはそのまま動きます。
|
|
23
|
+
- **対応**: 値を読む側では、値と色の対応表(`ColorMap`)の場合も扱ってください。
|
|
24
|
+
|
|
5
25
|
### v6.0.1
|
|
6
26
|
|
|
7
27
|
- **Fix**: API キーを付けない embed を別オリジンの iframe の中で読み込んだとき、`class="geolonia"` の要素が地図にならなかった問題を修正しました([#565](https://github.com/geolonia/embed/pull/565))。iframe の中かどうかで描画を止める判定を削除しました。API キーを付けない場合に表示できるのは、これまでどおり `data-style` で指定した Geolonia 以外のスタイルです。
|
package/README.md
CHANGED
|
@@ -119,14 +119,15 @@ The `data-style` attribute accepts:
|
|
|
119
119
|
|
|
120
120
|
#### data-lang attribute
|
|
121
121
|
|
|
122
|
-
The `data-lang` attribute controls the language of map labels:
|
|
122
|
+
The `data-lang` attribute controls the language of map labels (when `data-style` is omitted or a Geolonia style name) and of the gesture handling messages:
|
|
123
123
|
|
|
124
|
-
- `ja`
|
|
125
|
-
- `en` (or any other
|
|
126
|
-
- `auto
|
|
127
|
-
-
|
|
124
|
+
- `ja` / `ja-jp`: Japanese labels
|
|
125
|
+
- `en` (or any value other than `ja`, `ja-jp`, `auto` and an empty value): English labels
|
|
126
|
+
- `auto`: follow the browser language (`navigator.languages`)
|
|
127
|
+
- empty value: same as `auto`
|
|
128
|
+
- **omitted**: same as `auto` (follows the browser language)
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
`ja` / `ja-jp` always resolve to Japanese; `auto`, an empty value and an omitted attribute follow the browser language; every other value resolves to English. The match is case-sensitive, so `ja-JP` resolves to English. Values other than `ja`, `en`, `auto` and an empty value, including `ja-jp`, also disable the gesture handling control ([#571](https://github.com/geolonia/embed/issues/571)).
|
|
130
131
|
|
|
131
132
|
**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:
|
|
132
133
|
|
|
@@ -140,6 +141,53 @@ When using the JavaScript API (`new GeoloniaMap({...})`), pass `lang` in the opt
|
|
|
140
141
|
const map = new GeoloniaMap({ container: "#map", lang: "ja" });
|
|
141
142
|
```
|
|
142
143
|
|
|
144
|
+
#### data-raster-tiles attribute
|
|
145
|
+
|
|
146
|
+
The `data-raster-tiles` attribute overlays raster tiles from another provider (hazard maps, GSI tiles and so on). Give a URL template that contains `{z}`, `{x}` and `{y}`:
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<div
|
|
150
|
+
class="geolonia"
|
|
151
|
+
data-raster-tiles="https://example.com/tiles/{z}/{x}/{y}.png"
|
|
152
|
+
data-raster-tiles-attribution="Example tiles"
|
|
153
|
+
data-raster-tiles-opacity="0.7"
|
|
154
|
+
data-raster-tiles-max-zoom="17"
|
|
155
|
+
></div>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Important:** `data-raster-tiles-attribution` is rendered as HTML in the attribution control. Only put text you wrote yourself there, never a value taken from outside the page such as a URL parameter.
|
|
159
|
+
|
|
160
|
+
#### data-extrusion attribute
|
|
161
|
+
|
|
162
|
+
The `data-extrusion` attribute draws the polygons of `data-geojson` in 3D, with a height (and, unless `data-extrusion-color` names another property, a color) from the given property. It has no effect without `data-geojson`.
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<div
|
|
166
|
+
class="geolonia"
|
|
167
|
+
data-geojson="https://example.com/areas.geojson"
|
|
168
|
+
data-extrusion="population"
|
|
169
|
+
data-extrusion-max-height="3000"
|
|
170
|
+
data-pitch="60"
|
|
171
|
+
></div>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Important:** set `data-pitch` as well. With the default pitch of 0 the map is seen from straight above, so the polygons look flat.
|
|
175
|
+
|
|
176
|
+
#### data-mask attribute
|
|
177
|
+
|
|
178
|
+
The `data-mask` attribute darkens everything outside an area. Give the URL of a GeoJSON file with the boundary:
|
|
179
|
+
|
|
180
|
+
```html
|
|
181
|
+
<div
|
|
182
|
+
class="geolonia"
|
|
183
|
+
data-mask="https://example.com/city.geojson"
|
|
184
|
+
data-mask-opacity="0.5"
|
|
185
|
+
data-mask-outline="on"
|
|
186
|
+
></div>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
When the map has no center (`data-lat` and `data-lng`), no `data-geojson` and no `data-simple-vector`, it fits to the boundary.
|
|
190
|
+
|
|
143
191
|
You can see more examples at [https://geolonia.github.io/embed/](https://geolonia.github.io/embed/).
|
|
144
192
|
|
|
145
193
|
# Contributing
|