@geolonia/embed 5.2.1 → 5.2.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.
- package/.github/workflows/build.yml +52 -28
- package/CHANGELOG.md +8 -0
- package/README.md +27 -0
- package/dist/embed +1 -1
- package/dist/embed-core.js +1 -1
- package/dist/embed-core.js.LICENSE.txt +1 -1
- package/dist/embed.js +1 -1
- package/dist/embed.js.LICENSE.txt +1 -1
- package/dist/lib/geolonia-map.d.ts +6 -0
- package/dist/lib/sanitize-attribution.d.ts +15 -0
- package/dist/lib/util.d.ts +16 -1
- package/dist/types.d.ts +6 -0
- package/dist/version.d.ts +1 -1
- package/e2e/basic.spec.ts +23 -0
- package/e2e/webgl-error.spec.ts +105 -0
- package/package.json +2 -4
- package/src/lib/CustomAttributionControl.ts +12 -7
- package/src/lib/geolonia-map.ts +22 -2
- package/src/lib/parse-atts.test.ts +1 -0
- package/src/lib/parse-atts.ts +1 -0
- package/src/lib/sanitize-attribution.test.ts +122 -0
- package/src/lib/sanitize-attribution.ts +192 -0
- package/src/lib/util.test.ts +85 -0
- package/src/lib/util.ts +76 -7
- package/src/style.css +69 -4
- package/src/types.ts +6 -0
- package/src/version.ts +1 -0
|
@@ -5,10 +5,12 @@ name: build
|
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
8
|
-
|
|
8
|
+
# v5 は LTS なので GitHub Actions でリリースする。
|
|
9
|
+
# maintenance/v1 は手動リリースに移行したため、意図的に含めていない。
|
|
10
|
+
branches: [master, maintenance/v5]
|
|
9
11
|
tags: ['*']
|
|
10
12
|
pull_request:
|
|
11
|
-
branches: [master]
|
|
13
|
+
branches: [master, maintenance/v5]
|
|
12
14
|
|
|
13
15
|
jobs:
|
|
14
16
|
act-test:
|
|
@@ -29,22 +31,18 @@ jobs:
|
|
|
29
31
|
matrix:
|
|
30
32
|
node-version: ['22.x']
|
|
31
33
|
steps:
|
|
32
|
-
- uses: actions/checkout@
|
|
34
|
+
- uses: actions/checkout@v6
|
|
33
35
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
34
|
-
uses: actions/setup-node@
|
|
36
|
+
uses: actions/setup-node@v6
|
|
35
37
|
with:
|
|
36
38
|
node-version: ${{ matrix.node-version }}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
with:
|
|
40
|
-
path: node_modules
|
|
41
|
-
key: modules-cache-v1-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
|
|
42
|
-
- run: npm install
|
|
39
|
+
cache: 'npm'
|
|
40
|
+
- run: npm ci
|
|
43
41
|
- run: npm run lint
|
|
44
42
|
- run: npm run test
|
|
45
43
|
- run: npm run build
|
|
46
44
|
- name: save the built
|
|
47
|
-
uses: actions/upload-artifact@
|
|
45
|
+
uses: actions/upload-artifact@v7
|
|
48
46
|
if: "!failure()"
|
|
49
47
|
with:
|
|
50
48
|
retention-days: 1
|
|
@@ -61,8 +59,8 @@ jobs:
|
|
|
61
59
|
- act-test
|
|
62
60
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
63
61
|
steps:
|
|
64
|
-
- uses: actions/checkout@
|
|
65
|
-
- uses: actions/setup-node@
|
|
62
|
+
- uses: actions/checkout@v6
|
|
63
|
+
- uses: actions/setup-node@v6
|
|
66
64
|
with:
|
|
67
65
|
node-version: '22.x'
|
|
68
66
|
- name: Clean repo
|
|
@@ -70,7 +68,7 @@ jobs:
|
|
|
70
68
|
git checkout --orphan gh-pages
|
|
71
69
|
git rm -rf . > /dev/null 2>&1
|
|
72
70
|
- name: load the built
|
|
73
|
-
uses: actions/download-artifact@
|
|
71
|
+
uses: actions/download-artifact@v8
|
|
74
72
|
with:
|
|
75
73
|
name: the-built
|
|
76
74
|
- name: Setup and deploy Github Pages
|
|
@@ -83,6 +81,33 @@ jobs:
|
|
|
83
81
|
git commit -m "Deploy" > /dev/null 2>&1
|
|
84
82
|
git push --force origin gh-pages
|
|
85
83
|
|
|
84
|
+
check-tag:
|
|
85
|
+
name: 'Check the tag belongs to v5'
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
permissions:
|
|
88
|
+
contents: read
|
|
89
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
90
|
+
steps:
|
|
91
|
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
92
|
+
with:
|
|
93
|
+
persist-credentials: false
|
|
94
|
+
# maintenance/v5 は v5.x のタグだけを公開・配信する。npm の公開と S3 への配信の両方がこのジョブを待つ。
|
|
95
|
+
# タグの版が package.json の版と違うまま公開・配信しないことも確かめる。
|
|
96
|
+
- name: 'Check the tag'
|
|
97
|
+
env:
|
|
98
|
+
REF_NAME: ${{ github.ref_name }}
|
|
99
|
+
run: |
|
|
100
|
+
# v5 はメンテナンスモードなので、v5.X.Y 形式のタグだけを受け付ける (-pre. などの付いたタグは受け付けない)。
|
|
101
|
+
if ! printf '%s' "$REF_NAME" | grep -Eq '^v5\.[0-9]+\.[0-9]+$'; then
|
|
102
|
+
echo "maintenance/v5 only publishes v5.X.Y tags: $REF_NAME" >&2
|
|
103
|
+
exit 1
|
|
104
|
+
fi
|
|
105
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
106
|
+
if [ "${REF_NAME#v}" != "$PKG_VERSION" ]; then
|
|
107
|
+
echo "The tag $REF_NAME does not match package.json version $PKG_VERSION" >&2
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
|
|
86
111
|
publish:
|
|
87
112
|
name: 'Publish npm package'
|
|
88
113
|
runs-on: ubuntu-latest
|
|
@@ -92,33 +117,32 @@ jobs:
|
|
|
92
117
|
needs:
|
|
93
118
|
- build
|
|
94
119
|
- act-test
|
|
120
|
+
- check-tag
|
|
95
121
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
96
122
|
steps:
|
|
97
|
-
- uses: actions/checkout@
|
|
98
|
-
- uses: actions/setup-node@
|
|
123
|
+
- uses: actions/checkout@v6
|
|
124
|
+
- uses: actions/setup-node@v6
|
|
99
125
|
with:
|
|
100
|
-
tag_name: 'v%s'
|
|
101
126
|
node-version: '22.x'
|
|
102
127
|
registry-url: 'https://registry.npmjs.org'
|
|
103
128
|
scope: '@geolonia'
|
|
104
129
|
- name: load the built
|
|
105
|
-
uses: actions/download-artifact@
|
|
130
|
+
uses: actions/download-artifact@v8
|
|
106
131
|
with:
|
|
107
132
|
name: the-built
|
|
108
133
|
|
|
109
134
|
- name: Update npm
|
|
110
135
|
run: npm install -g npm@latest
|
|
111
136
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- name: 'Publish to NPM (next)'
|
|
117
|
-
if: "contains(github.ref, '-pre.')"
|
|
118
|
-
run: npm publish --access=public --tag=next
|
|
137
|
+
# v6 が npm の `latest` を使っているため、v5 の版は `latest` を動かさない別の dist-tag (`latest-5`) で公開する。
|
|
138
|
+
# `--tag` なしの `npm publish` は公開した版を `latest` にしてしまう。
|
|
139
|
+
- name: 'Publish to NPM (latest-5)'
|
|
140
|
+
run: npm publish --access=public --tag=latest-5
|
|
119
141
|
|
|
120
142
|
deploy:
|
|
121
|
-
needs:
|
|
143
|
+
needs:
|
|
144
|
+
- build
|
|
145
|
+
- check-tag
|
|
122
146
|
runs-on: ubuntu-latest
|
|
123
147
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
124
148
|
|
|
@@ -128,11 +152,11 @@ jobs:
|
|
|
128
152
|
contents: read
|
|
129
153
|
|
|
130
154
|
steps:
|
|
131
|
-
- uses: actions/checkout@
|
|
155
|
+
- uses: actions/checkout@v6
|
|
132
156
|
with:
|
|
133
157
|
fetch-depth: 0
|
|
134
158
|
|
|
135
|
-
- uses: actions/download-artifact@
|
|
159
|
+
- uses: actions/download-artifact@v8
|
|
136
160
|
with: { name: the-built, path: ./ }
|
|
137
161
|
|
|
138
162
|
- name: Read version
|
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## @geolonia/embed
|
|
4
4
|
|
|
5
|
+
### v5.2.3
|
|
6
|
+
|
|
7
|
+
- **Security**: Fixed the attribution control rendering attribution HTML without sanitizing it, and updated `maplibre-gl` to 5.24.1, which fixes the `DOM.sanitize()` bypass (GHSA-jrc7-96c5-q579 / CVE-2026-85061). Attribution is now filtered with an allow list of tags and attributes: elements outside the list (for example `<font>`) are removed together with their content, and attributes such as `style` and `on*` are removed ([#576](https://github.com/geolonia/embed/issues/576)).
|
|
8
|
+
|
|
5
9
|
### nightly
|
|
6
10
|
|
|
11
|
+
- **Improvement**: The message shown when the map fails to initialize (typically no WebGL) now tells the visitor what to try (restart the browser, restart the device, try another browser, update the graphics driver, contact the site owner). The developer-tools sentence was removed, and the message is shortened automatically on small map containers.
|
|
12
|
+
- **Feature**: `data-error-message` (`errorMessage` in the programmatic API) replaces that message with your own text, or disables the error display entirely with `off` (`false` in the programmatic API). The value is rendered as plain text.
|
|
13
|
+
- **Fix**: The loading animation is now removed when the map fails to initialize.
|
|
14
|
+
|
|
7
15
|
- **Feature**: Added support for external style.json URLs in `data-style` attribute
|
|
8
16
|
- You can now specify full URLs: `data-style="https://tile.openstreetmap.jp/styles/osm-bright/style.json"`
|
|
9
17
|
- Relative paths are also supported: `data-style="./custom-style.json"`
|
package/README.md
CHANGED
|
@@ -110,6 +110,33 @@ The `data-style` attribute accepts:
|
|
|
110
110
|
|
|
111
111
|
You can see more examples at [https://geolonia.github.io/embed/](https://geolonia.github.io/embed/).
|
|
112
112
|
|
|
113
|
+
### Error message when the map fails to initialize
|
|
114
|
+
|
|
115
|
+
When the map cannot be initialized (typically because WebGL is unavailable on the
|
|
116
|
+
device), the embed replaces the map with a message that tells the visitor what to
|
|
117
|
+
try: restart the browser, restart the device, try another browser, update the
|
|
118
|
+
graphics driver, and contact the site owner if it still fails. The message shrinks
|
|
119
|
+
to a shorter version, and finally to the headline alone, as the map container gets
|
|
120
|
+
smaller.
|
|
121
|
+
|
|
122
|
+
Use `data-error-message` to take over that message:
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<!-- Replace the wording -->
|
|
126
|
+
<div
|
|
127
|
+
class="geolonia"
|
|
128
|
+
data-error-message="Sorry, the map is unavailable. Please call 0120-000-000."
|
|
129
|
+
></div>
|
|
130
|
+
|
|
131
|
+
<!-- Show nothing at all, e.g. when the site renders its own fallback -->
|
|
132
|
+
<div class="geolonia" data-error-message="off"></div>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The value is rendered as plain text; HTML is not interpreted. The same option is
|
|
136
|
+
available to the programmatic API as `errorMessage`, which also accepts `false`
|
|
137
|
+
to disable the error display.
|
|
138
|
+
|
|
139
|
+
|
|
113
140
|
# Contributing
|
|
114
141
|
|
|
115
142
|
## Development
|