@chrtco/sdk 0.10.45 → 0.10.47
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 +35 -0
- package/README.md +29 -6
- package/dist/atlas/browser.cjs +478 -15
- package/dist/atlas/browser.cjs.map +1 -1
- package/dist/atlas/browser.d.cts +8 -3
- package/dist/atlas/browser.d.ts +8 -3
- package/dist/atlas/browser.js +478 -15
- package/dist/atlas/browser.js.map +1 -1
- package/dist/index.cjs +2293 -1603
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1272 -1045
- package/dist/index.d.ts +1272 -1045
- package/dist/index.js +2274 -1603
- package/dist/index.js.map +1 -1
- package/dist/symbol-families-De7sN-p5.d.cts +93 -0
- package/dist/symbol-families-De7sN-p5.d.ts +93 -0
- package/package.json +1 -1
- package/dist/symbol-families-D2Kx20HJ.d.cts +0 -47
- package/dist/symbol-families-D2Kx20HJ.d.ts +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to `@chrtco/sdk` will be documented in this file.
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
|
+
- **`EINK_NIGHT`** — the e-ink night palette (`theme=eink_night`, offline `palette=EINK_NIGHT`,
|
|
9
|
+
`EINK_COLOR_TABLES.night`): `EINK_MONO`'s four greys on a black page, for any e-ink screen at
|
|
10
|
+
night with the front light on, in place of red night. Water black; lines and labels `#aaaaaa`;
|
|
11
|
+
only the safety contour, dangers, lights, shoal soundings and white marks white; land `#555555`;
|
|
12
|
+
depth patterns drawn light; the chart background crosshatched so no-data never reads as black safe
|
|
13
|
+
water. `isEinkGreyTable` (mono or night), `S52_EINK_NIGHT`. In every e-ink palette, label halos
|
|
14
|
+
are now the page's own ground (`UIBCK`).
|
|
15
|
+
- **E-ink chart palettes: `EINK_COLOR` and `EINK_MONO`.** Two new `ColorTableName`s for
|
|
16
|
+
reflective e-ink screens — colour e-ink (E Ink Kaleido 3) and monochrome e-ink — usable
|
|
17
|
+
everywhere a palette is: `chrt.style({ palette: 'EINK_MONO' })`, `chrt.styleUrl({ theme:
|
|
18
|
+
'eink_mono' })` (`ChrtStyleTheme` gains `eink_color` / `eink_mono`), the offline style
|
|
19
|
+
(`palette: 'EINK_COLOR' | 'EINK_MONO'`), and every symbol-image loader. Same features, classes
|
|
20
|
+
and priorities as `DAY`; `generateStyle` runs an e-ink portrayal pass for them
|
|
21
|
+
(`applyEinkPortrayal`): lines ×1.5, text ×1.15 on paper halos, a heavy safety-contour line
|
|
22
|
+
(`safetyContourValues`), danger symbols ×1.35 and cross-hatched danger areas, depth in at most
|
|
23
|
+
four steps (mono: by fill pattern), no translucent washes, hillshade, glows or transitions.
|
|
24
|
+
`EINK_MONO` paints only the four `EINK_MONO_GREYS`. New exports: `EINK_COLOR_TABLES`,
|
|
25
|
+
`isEinkColorTable`, `EINK_MONO_GREYS`, `S52_EINK_COLOR`, `S52_EINK_MONO`,
|
|
26
|
+
`applyEinkPortrayal`, `safetyContourValues`, and the three pattern ids. The world-hatch image set
|
|
27
|
+
(`basePatternImageSpecs` / `loadBasePatternImages`) gains the three e-ink fill patterns in every
|
|
28
|
+
palette. `normalizeTheme` accepts `-` for `_`, and `resolveCustomTheme` serves the e-ink themes
|
|
29
|
+
even when a custom style has narrowed its palettes.
|
|
30
|
+
- **`isMapLive(map)`** — `false` once MapLibre's `map.remove()` has run (it
|
|
31
|
+
reads the `_removed` flag `remove()` sets last). After `remove()`, `hasImage`,
|
|
32
|
+
`addImage`, `getSource` and their siblings throw, so anything that awaits and
|
|
33
|
+
then writes to a map it was handed should ask this first and stop quietly on
|
|
34
|
+
`false`. Takes any object, so structural map stand-ins can be asked too.
|
|
8
35
|
- `MarineZoneRef.bbox` on `weather.marineForecast()` — `[west, south, east, north]` of the
|
|
9
36
|
forecast's zone, from the same build as the `NWS_MARINE_ZONES` tile source. A camera hint: fit
|
|
10
37
|
the map to it; draw the zone from the tiles, never the box. `west > east` crosses 180°.
|
|
@@ -14,6 +41,14 @@ All notable changes to `@chrtco/sdk` will be documented in this file.
|
|
|
14
41
|
source themselves, such as the tile-worker's TileJSON.
|
|
15
42
|
|
|
16
43
|
### Fixed
|
|
44
|
+
- **The image loaders threw on a map removed while they waited.**
|
|
45
|
+
`loadS52SymbolImagesCached`, `loadSymbolImageSpecs`, `rethemeSymbolImages`,
|
|
46
|
+
`loadSymbolImages` and `loadThemedBridgeImages` await a decode or an
|
|
47
|
+
IndexedDB read and then write to the map. If the map had been removed
|
|
48
|
+
meanwhile, the write threw "Cannot read properties of undefined (reading
|
|
49
|
+
'getImage')", usually from a promise nobody was awaiting. They now check
|
|
50
|
+
`isMapLive` after each wait and leave a removed map alone; a re-theme cut
|
|
51
|
+
short that way returns `aborted: true`.
|
|
17
52
|
- **A palette switch held the map's tile answers behind its own SVG decodes.**
|
|
18
53
|
`rethemeSymbolImages` decoded every symbol as its own SVG `<img>`, and each
|
|
19
54
|
is a whole browser document whose many small main-thread tasks queued ahead
|
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ const chrt = new Chrt(process.env.CHRT_API_KEY!);
|
|
|
150
150
|
// Locally generated style — no network, no custom style applied.
|
|
151
151
|
const map = new maplibregl.Map({
|
|
152
152
|
container: 'map',
|
|
153
|
-
style: chrt.style({ palette: 'DAY' }), // 'DAY' | 'DUSK' | 'NIGHT'
|
|
153
|
+
style: chrt.style({ palette: 'DAY' }), // 'DAY' | 'DUSK' | 'NIGHT' | 'EINK_COLOR' | 'EINK_MONO' | 'EINK_NIGHT'
|
|
154
154
|
center: [-70.25, 43.66],
|
|
155
155
|
zoom: 12,
|
|
156
156
|
transformRequest: chrt.transformRequest(),
|
|
@@ -162,7 +162,7 @@ Or use the **served** style, which honours the CHRTstyle custom style bound to y
|
|
|
162
162
|
```typescript
|
|
163
163
|
const map = new maplibregl.Map({
|
|
164
164
|
container: 'map',
|
|
165
|
-
style: await chrt.styleUrl({ theme: 'dusk' }), // 'day' | 'dusk' | 'night'
|
|
165
|
+
style: await chrt.styleUrl({ theme: 'dusk' }), // 'day' | 'dusk' | 'night' | 'eink_color' | 'eink_mono' | 'eink_night'
|
|
166
166
|
transformRequest: chrt.transformRequest(), // required — authenticates the style request too
|
|
167
167
|
});
|
|
168
168
|
```
|
|
@@ -174,14 +174,37 @@ Tiles are served from `tiles.chrt.co` and gated by a short-lived ES256 JWT. The
|
|
|
174
174
|
your key, attaches it as `Authorization: Bearer`, and refreshes it before expiry — you never handle
|
|
175
175
|
tokens directly.
|
|
176
176
|
|
|
177
|
+
### E-ink screens
|
|
178
|
+
|
|
179
|
+
Three palettes are for reflective e-ink (e-paper) screens, on every plan: **`EINK_COLOR`** for colour
|
|
180
|
+
e-ink (E Ink Kaleido 3 — Boox Note Air C, Go Color 7, Tab X C), **`EINK_MONO`** for monochrome
|
|
181
|
+
e-ink panels and monitors, or colour e-ink run in black and white, and **`EINK_NIGHT`** for any e-ink
|
|
182
|
+
screen at night with the front light on (mono inverted onto a black page, so the lit area stays
|
|
183
|
+
small — use it instead of a red night palette). Same features and meaning as
|
|
184
|
+
`DAY`; drawn for paper: black ink, heavier lines, a heavy safety-contour line, larger danger
|
|
185
|
+
symbols, depth in at most four steps (by fill pattern in mono, which uses only four greys), and no
|
|
186
|
+
translucency or transitions.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { EINK_COLOR_TABLES } from '@chrtco/sdk'; // { color, mono, night }
|
|
190
|
+
|
|
191
|
+
chrt.style({ palette: EINK_COLOR_TABLES.mono }); // local
|
|
192
|
+
await chrt.styleUrl({ theme: 'eink_mono' }); // served (wire names are lowercase)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
A locally generated e-ink style also needs `loadBasePatternImages(map, palette)` from
|
|
196
|
+
`@chrtco/sdk/atlas/browser` (the fill patterns); a served style declares its own sprite. Use these
|
|
197
|
+
rather than recolouring the chart, and set MapLibre's `fadeDuration: 0` — renderer animation is a
|
|
198
|
+
client setting the style cannot turn off.
|
|
199
|
+
|
|
177
200
|
### Symbol families
|
|
178
201
|
|
|
179
202
|
`style()`, `styleUrl()` and `fetchStyle()` all select symbol artwork, but **the option is spelled
|
|
180
203
|
differently** on the local and served paths:
|
|
181
204
|
|
|
182
205
|
```typescript
|
|
183
|
-
chrt.style({ symbolSet: 's101' }); // local — symbolSet, palette: 'DAY' | 'DUSK' | 'NIGHT'
|
|
184
|
-
await chrt.styleUrl({ symbols: 's101' }); // served — symbols, theme: 'day' | 'dusk' | 'night'
|
|
206
|
+
chrt.style({ symbolSet: 's101' }); // local — symbolSet, palette: 'DAY' | 'DUSK' | 'NIGHT' | 'EINK_COLOR' | 'EINK_MONO' | 'EINK_NIGHT'
|
|
207
|
+
await chrt.styleUrl({ symbols: 's101' }); // served — symbols, theme: 'day' | 'dusk' | 'night' | 'eink_color' | 'eink_mono' | 'eink_night'
|
|
185
208
|
```
|
|
186
209
|
|
|
187
210
|
| Value | Artwork |
|
|
@@ -482,14 +505,14 @@ valid — passing an agency name anywhere else silently matches nothing.
|
|
|
482
505
|
### `chrt.style(opts?)` — **JS-only**
|
|
483
506
|
Returns a ready-to-use MapLibre/Mapbox GL **S-52** style object. Generated locally: no network, works
|
|
484
507
|
offline, and **does not apply a custom style bound to your key**. Options: `palette`
|
|
485
|
-
(`'DAY' | 'DUSK' | 'NIGHT'`), `symbolSet`, `region`, `depthUnits`, `safetyContour`, `chartMode`, plus
|
|
508
|
+
(`'DAY' | 'DUSK' | 'NIGHT' | 'EINK_COLOR' | 'EINK_MONO' | 'EINK_NIGHT'`), `symbolSet`, `region`, `depthUnits`, `safetyContour`, `chartMode`, plus
|
|
486
509
|
the other atlas style options. Non-JS clients want `styleUrl()` instead.
|
|
487
510
|
|
|
488
511
|
### `chrt.styleUrl(opts?)`
|
|
489
512
|
URL of the **served** S-52 style — the CHRTstyle Style API at
|
|
490
513
|
`{tileBaseUrl}/v1/styles/{region}/style.json`. `async`: it pre-mints the tile token so the style
|
|
491
514
|
request (which MapLibre does not retry) carries auth. Options: `theme`
|
|
492
|
-
(`'day' | 'dusk' | 'night'`), `symbols`. Always pair with `transformRequest()`.
|
|
515
|
+
(`'day' | 'dusk' | 'night' | 'eink_color' | 'eink_mono' | 'eink_night'`), `symbols`. Always pair with `transformRequest()`.
|
|
493
516
|
|
|
494
517
|
The served document honours the CHRTstyle custom style bound to your key (a **Dev+** feature; Free
|
|
495
518
|
keys and keys with no bound style get the default themes). This is the style path for any client that
|