@tileflow/core 0.1.0-alpha.39 → 0.1.0-alpha.40
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 +11 -10
- package/dist/{3d-BkaJjwfk.d.ts → 3d-CzLTD0RK.d.ts} +10 -1
- package/dist/3d.d.ts +1 -1
- package/dist/3d.js +199 -16
- package/dist/browser.d.ts +87 -11
- package/dist/browser.js +754 -178
- package/dist/build.d.ts +3 -3
- package/dist/build.js +3714 -3346
- package/dist/config-reference.json +4418 -2280
- package/dist/{icon-composition-Ivgoxz8d.d.ts → icon-composition-CcSHApUm.d.ts} +49 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5110 -4733
- package/dist/{manifest-types-DRy2980g.d.ts → manifest-types-DnhSJjCM.d.ts} +14 -3
- package/dist/manifest.d.ts +2 -2
- package/dist/native.js +3 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/worker/camera-tile-worker.global.js +2 -2
- package/docs/buildings-3d.md +33 -1
- package/docs/cartographic-defaults.md +69 -1
- package/docs/data-is-separate-from-design.md +5 -2
- package/docs/globe-atmosphere.md +46 -19
- package/docs/street-sky.md +3 -0
- package/docs/theme-transitions-and-blends.md +27 -20
- package/docs/trees-3d.md +7 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Start with the [@tileflow/core guide](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md) for installation and a complete first example.
|
|
4
4
|
|
|
5
|
-
A Tileflow map can
|
|
5
|
+
A Tileflow map can animate a theme change, or show any point between two or more of its
|
|
6
6
|
themes. Use a transition when people switch between appearances, such as light and dark. Use a
|
|
7
7
|
blend when the application controls the appearance continuously, such as a slider or a day that
|
|
8
8
|
passes from night to day.
|
|
@@ -12,9 +12,10 @@ map views, and request the same tiles as a map that does not change theme. The R
|
|
|
12
12
|
Svelte maps offer them with MapLibre GL JS, and the React Native map with MapLibre Native on iOS
|
|
13
13
|
and Android; see [React Native](#react-native) for what differs there.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Animate a theme change
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Theme and `timeOfDay` changes animate over 450 ms by default in React, Vue, and Svelte.
|
|
18
|
+
Pass `themeTransition` to customize the duration. This React example assumes a map named
|
|
18
19
|
`city` with `light` and `dark` themes in the published manifest:
|
|
19
20
|
|
|
20
21
|
```tsx
|
|
@@ -26,19 +27,23 @@ export function CityMap() {
|
|
|
26
27
|
return (
|
|
27
28
|
<>
|
|
28
29
|
<button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>Switch theme</button>
|
|
29
|
-
<Map source={{map: 'city'}} theme={theme}
|
|
30
|
+
<Map source={{map: 'city'}} theme={theme} />
|
|
30
31
|
</>
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
transition.
|
|
36
|
+
Compatible themes interpolate on the live map, including sky, lighting, buildings and vegetation.
|
|
37
|
+
The globe and 3D camera can keep moving throughout the change. Temporary blend layers are removed
|
|
38
|
+
when the destination theme is reached. No image of the previous map is projected over the scene.
|
|
39
|
+
`onThemeChange` reports `preloading`, `applying`, and finally `ready` after the transition.
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Structurally different styles, entering a blend, or leaving one use a stationary snapshot while
|
|
42
|
+
the new style loads, then fade it out. Moving the camera removes that cover immediately. A
|
|
43
|
+
`theme="system"` change follows the same rules as an explicit theme selection.
|
|
44
|
+
|
|
45
|
+
`duration` is in milliseconds, from 0 to 5000. It defaults to 450, including when `themeTransition`
|
|
46
|
+
is omitted or empty. Set `themeTransition={{duration: 0}}` to change the theme at once.
|
|
42
47
|
When the browser asks for reduced motion, every change happens at once.
|
|
43
48
|
|
|
44
49
|
## Blend themes
|
|
@@ -70,8 +75,8 @@ export function DayMap() {
|
|
|
70
75
|
```
|
|
71
76
|
|
|
72
77
|
The first blend of a set of themes loads each theme's style and fonts, prepares one style that
|
|
73
|
-
holds every theme, and replaces the map's style once,
|
|
74
|
-
map shows the theme nearest to the position. After that, changing `position` updates the map at
|
|
78
|
+
holds every theme, and replaces the map's style once, using the default or configured transition.
|
|
79
|
+
Until then the map shows the theme nearest to the position. After that, changing `position` updates the map at
|
|
75
80
|
once without loading anything, so it can follow a slider, a clock, or an animation frame by frame.
|
|
76
81
|
Changing `themes` prepares a new blend. Removing `themeBlend` returns to `theme`.
|
|
77
82
|
|
|
@@ -89,15 +94,15 @@ While a blend is shown, `data-tileflow-theme` names the theme nearest to the pos
|
|
|
89
94
|
Light lettering on a dark plate and dark lettering on a light plate would meet in the same grey
|
|
90
95
|
halfway, so symbols do not follow the position.
|
|
91
96
|
- A value that depends on feature state, such as a caption that changes colour when highlighted,
|
|
92
|
-
changes with the nearest theme. MapLibre lays its source out again for that change; a
|
|
93
|
-
covers it.
|
|
97
|
+
changes with the nearest theme. MapLibre lays its source out again for that change; a stationary
|
|
98
|
+
cross-fade covers it until the camera moves.
|
|
94
99
|
|
|
95
100
|
### Which themes can be blended
|
|
96
101
|
|
|
97
102
|
Blend themes of the same map. Every theme of a map exposes the same token keys, so its compiled
|
|
98
103
|
styles share sources, layers, filters, and expressions, and differ only in colours, numbers, and
|
|
99
104
|
image names. Up to eight themes can be blended. A blend fails, and the map keeps its current
|
|
100
|
-
appearance, when the styles differ in structure, sources, sprite, or
|
|
105
|
+
appearance, when the styles differ in structure, sources, sprite, glyphs, projection, or terrain.
|
|
101
106
|
|
|
102
107
|
Icon and pattern artwork is mixed in place of the first theme's image when every theme's version
|
|
103
108
|
has the same size. Otherwise that image changes with the nearest theme instead.
|
|
@@ -121,7 +126,8 @@ between changes.
|
|
|
121
126
|
|
|
122
127
|
## React Native
|
|
123
128
|
|
|
124
|
-
The `Map` of `@tileflow/react-native` accepts the same `themeTransition` and `themeBlend` props
|
|
129
|
+
The `Map` of `@tileflow/react-native` accepts the same `themeTransition` and `themeBlend` props.
|
|
130
|
+
Theme and `timeOfDay` changes also cross-fade over 450 ms by default:
|
|
125
131
|
|
|
126
132
|
```tsx
|
|
127
133
|
import {Map} from '@tileflow/react-native';
|
|
@@ -130,7 +136,6 @@ export function DayMap({position}: {position: number}) {
|
|
|
130
136
|
return (
|
|
131
137
|
<Map
|
|
132
138
|
source={{map: 'city', manifestUrl: 'https://maps.example.com/tileflow/manifest.json'}}
|
|
133
|
-
themeTransition={{duration: 450}}
|
|
134
139
|
themeBlend={{position, themes: ['night', 'dusk', 'day']}}
|
|
135
140
|
style={{flex: 1}}
|
|
136
141
|
/>
|
|
@@ -186,7 +191,7 @@ export async function moveThroughTheDay(map: MapLibreMap, manifestMap: TileflowR
|
|
|
186
191
|
// `initial` is the runtime style the map was created with.
|
|
187
192
|
const controller = createTileflowThemeController({initial: styleOf('day'), map});
|
|
188
193
|
|
|
189
|
-
await controller.setTheme(styleOf('night')
|
|
194
|
+
await controller.setTheme(styleOf('night'));
|
|
190
195
|
|
|
191
196
|
const themes = resolveTileflowRuntimeThemeBlend({
|
|
192
197
|
blend: {position: 0, themes: ['night', 'dusk', 'day']},
|
|
@@ -202,8 +207,10 @@ export async function moveThroughTheDay(map: MapLibreMap, manifestMap: TileflowR
|
|
|
202
207
|
```
|
|
203
208
|
|
|
204
209
|
`setTheme` and `setBlend` accept `{transition: {duration}}`;
|
|
205
|
-
`createTileflowThemeController({transition})`
|
|
206
|
-
|
|
210
|
+
`createTileflowThemeController({transition})` overrides the 450 ms default for themes and blends.
|
|
211
|
+
Sun, emphasis, and style-state changes remain immediate unless a transition is configured.
|
|
212
|
+
Requests are serialized and the latest wins. A failed change restores the previous appearance
|
|
213
|
+
and reports `failed` with its error.
|
|
207
214
|
|
|
208
215
|
The controller loads blended themes' style documents with the same request policy it uses for
|
|
209
216
|
style font metadata: same-origin credentials, no redirects, and a bounded size. Pass `loadStyle`
|
package/docs/trees-3d.md
CHANGED
|
@@ -192,6 +192,13 @@ bounds in degrees, the first region holding a tree applying. They are a choice o
|
|
|
192
192
|
they never change a tree whose data gives its form, and as mapping improves they apply to fewer
|
|
193
193
|
trees.
|
|
194
194
|
|
|
195
|
+
`minimumHeight` optionally sets a visual height floor in metres (0–20, default 0). It applies after
|
|
196
|
+
scaling, enlarging only smaller trees and their crowns proportionally; source measurements stay
|
|
197
|
+
unchanged. Hedges retain their measured height and segment length. Color, shadow and outline
|
|
198
|
+
passes use the same size. `materialVariation` (0–1, default 0)
|
|
199
|
+
adds stable brightness variation between trunks and uses authored lobe shades to vary foliage
|
|
200
|
+
within the theme palette. It does not add colors outside that palette.
|
|
201
|
+
|
|
195
202
|
## Your own trees
|
|
196
203
|
|
|
197
204
|
A map can draw a form with its own models. Put glTF binaries (`.glb`) in a directory, declare it in
|