@octostar/map-component 0.7.1 → 0.8.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/README.md +49 -0
- package/dist/index.mjs +1287 -834
- package/dist/index.mjs.map +1 -1
- package/dist/types/components/action-panel.d.ts.map +1 -1
- package/dist/types/components/cluster-pie-chart.d.ts +1 -1
- package/dist/types/components/cluster-pie-chart.d.ts.map +1 -1
- package/dist/types/components/drawing-toolbar.d.ts.map +1 -1
- package/dist/types/components/icon-picker.d.ts.map +1 -1
- package/dist/types/components/ingest-progress-overlay.d.ts.map +1 -1
- package/dist/types/components/layers-panel.d.ts +3 -0
- package/dist/types/components/layers-panel.d.ts.map +1 -1
- package/dist/types/components/map-drop-zone.d.ts.map +1 -1
- package/dist/types/components/map-editor-canvas.d.ts.map +1 -1
- package/dist/types/components/properties-panel.d.ts +1 -1
- package/dist/types/components/properties-panel.d.ts.map +1 -1
- package/dist/types/components/status-indicator.d.ts.map +1 -1
- package/dist/types/components/timebar.d.ts +3 -7
- package/dist/types/components/timebar.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/custom-layer-stack.d.ts +2 -0
- package/dist/types/lib/custom-layer-stack.d.ts.map +1 -1
- package/dist/types/lib/feature-cap.d.ts +25 -1
- package/dist/types/lib/feature-cap.d.ts.map +1 -1
- package/dist/types/lib/feature-stack.d.ts +0 -2
- package/dist/types/lib/feature-stack.d.ts.map +1 -1
- package/dist/types/lib/icon-catalog.d.ts +654 -0
- package/dist/types/lib/icon-catalog.d.ts.map +1 -1
- package/dist/types/lib/ingest-client.d.ts +9 -0
- package/dist/types/lib/ingest-client.d.ts.map +1 -1
- package/dist/types/lib/ingest-progress.d.ts +4 -3
- package/dist/types/lib/ingest-progress.d.ts.map +1 -1
- package/dist/types/lib/label-pinning.d.ts +1 -1
- package/dist/types/lib/label-pinning.d.ts.map +1 -1
- package/dist/types/lib/map-editor-api.d.ts +12 -1
- package/dist/types/lib/map-editor-api.d.ts.map +1 -1
- package/dist/types/lib/map-endpoints.d.ts +2 -1
- package/dist/types/lib/map-endpoints.d.ts.map +1 -1
- package/dist/types/lib/map-labels.d.ts +890 -0
- package/dist/types/lib/map-labels.d.ts.map +1 -0
- package/dist/types/lib/selection-overlay.d.ts +1 -1
- package/dist/types/lib/selection-overlay.d.ts.map +1 -1
- package/dist/types/lib/shard-registry.d.ts +2 -0
- package/dist/types/lib/shard-registry.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,55 @@ Host requirements:
|
|
|
141
141
|
/>
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
### Translating the map: `labels`
|
|
145
|
+
|
|
146
|
+
Every string the map draws itself (panels, toolbar, menus, tooltips, toasts,
|
|
147
|
+
confirm dialogs, icon names) comes from the `labels` prop. Without it the map
|
|
148
|
+
is in English. A host that localizes passes a complete `MapLabels` object;
|
|
149
|
+
`DEFAULT_MAP_LABELS` holds the English text and lists every key.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { MapEditorCanvas, type MapLabels } from '@octostar/map-component';
|
|
153
|
+
|
|
154
|
+
const labels: MapLabels = {
|
|
155
|
+
layersPanel: {
|
|
156
|
+
title: t('Layers'),
|
|
157
|
+
groupLayerCount: count => t('{count, plural, one {# layer} other {# layers}}', { count }),
|
|
158
|
+
// ...the group's other keys
|
|
159
|
+
},
|
|
160
|
+
// ...every other group
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
<MapEditorCanvas labels={labels} />;
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
- Keys are grouped by surface (`layersPanel`, `drawingToolbar`, `toasts`,
|
|
167
|
+
`iconNames`, ...). The type requires every key, so when the map adds a
|
|
168
|
+
string the host's typecheck fails until it supplies it. Don't spread
|
|
169
|
+
`DEFAULT_MAP_LABELS` into it: that silences the check.
|
|
170
|
+
- Text with runtime values is a function that returns the whole sentence;
|
|
171
|
+
plurals are the host's to handle.
|
|
172
|
+
- Each key has one meaning. Two keys can share English text
|
|
173
|
+
(`navigate.searchAddress` and `navigate.goToCoordinates` are both "Go") and
|
|
174
|
+
still take different translations.
|
|
175
|
+
- `iconNames` is keyed by icon id. The icon picker searches the shown name as
|
|
176
|
+
well as the English name and the id.
|
|
177
|
+
- Layer names the map creates are stored in English whatever `labels` says:
|
|
178
|
+
"Default Layer", "New Layer", "Loaded from workspace" and "N workspace
|
|
179
|
+
features". Hosts match layers by name across users' maps (share links), so
|
|
180
|
+
a stored name must not depend on who created it. Only the display follows
|
|
181
|
+
the host: any layer whose stored name is "Default Layer" shows
|
|
182
|
+
`labels.canvas.defaultLayerName` (matched by name, since restoring a saved
|
|
183
|
+
map gives layers new ids); once renamed it shows its own name.
|
|
184
|
+
- Feature text the map writes when a feature is created (a new text label's
|
|
185
|
+
"New Label") takes `labels` at that moment and is kept as written.
|
|
186
|
+
- **Breaking for `Timebar` hosts:** `TimebarLabels` is now `MapLabels['timebar']`,
|
|
187
|
+
with 9 required keys (it had 4: `play`, `pause`, `reset`, `cumulative`). A
|
|
188
|
+
host that declares a full `TimebarLabels` must add `toggle`, `featureCount`,
|
|
189
|
+
`selectedCount`, `binEvents` and `binEventsWithSelection` before it
|
|
190
|
+
compiles. The `Timebar` prop itself is still `labels?: Partial<TimebarLabels>`,
|
|
191
|
+
and inside the map the Timebar uses `labels.timebar`.
|
|
192
|
+
|
|
144
193
|
## License
|
|
145
194
|
|
|
146
195
|
Proprietary - Octostar Limited. See [LICENSE](./LICENSE) for details.
|