@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.
@@ -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 change theme with a cross-fade, or show any point between two or more of its
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
- ## Cross-fade a theme change
15
+ ## Animate a theme change
16
16
 
17
- Pass `themeTransition` to the React, Vue, or Svelte map. This React example assumes a map named
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} themeTransition={{duration: 450}} />
30
+ <Map source={{map: 'city'}} theme={theme} />
30
31
  </>
31
32
  );
32
33
  }
33
34
  ```
34
35
 
35
- When the theme changes, a snapshot of the current frame covers the map. The snapshot follows the
36
- camera while people pan, zoom, rotate, or tilt, and fades out once the new theme is drawn. The map
37
- stays interactive throughout. `onThemeChange` reports `preloading`, `applying`, and finally `ready`
38
- after the fade. A `theme="system"` change, entering a blend, and leaving one use the same
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
- `duration` is in milliseconds, from 0 to 5000. It defaults to 0, which changes the theme at once.
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, with `themeTransition` if set. Until then the
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 cross-fade
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 glyphs.
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'), {transition: {duration: 450}});
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})` sets a default. Requests are serialized and the
206
- latest wins. A failed change restores the previous appearance and reports `failed` with its error.
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/core",
3
- "version": "0.1.0-alpha.39",
3
+ "version": "0.1.0-alpha.40",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Typed Tileflow config and MapLibre style compiler.",
6
6
  "type": "module",