@tileflow/react 0.1.0-alpha.33 → 0.1.0-alpha.35
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 +10 -6
- package/dist/index.js +11 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,8 +55,8 @@ hosted manifest.
|
|
|
55
55
|
In a Vite application's client entry, add this before mounting React:
|
|
56
56
|
|
|
57
57
|
```ts
|
|
58
|
-
import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
|
|
59
58
|
import {configureTileflowMapLibre} from '@tileflow/react';
|
|
59
|
+
import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
|
|
60
60
|
|
|
61
61
|
configureTileflowMapLibre({workerUrl});
|
|
62
62
|
```
|
|
@@ -73,8 +73,8 @@ Import MapLibre's CSS once in the application. After the worker and assets are r
|
|
|
73
73
|
<!-- docs:check -->
|
|
74
74
|
|
|
75
75
|
```tsx
|
|
76
|
-
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
77
76
|
import {Map} from '@tileflow/react';
|
|
77
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
78
78
|
|
|
79
79
|
export function App() {
|
|
80
80
|
return (
|
|
@@ -105,7 +105,8 @@ Maps without this capability ignore the option; omitting it keeps the selected t
|
|
|
105
105
|
Changing it uses the existing theme transition. `themeBlend` takes precedence. See the
|
|
106
106
|
[authoring contract](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/README.md#style-with-themes-and-semantic-modules).
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Theme and `timeOfDay` changes cross-fade over 450 ms by default, respecting reduced motion.
|
|
109
|
+
`themeTransition={{duration: 700}}` customizes the duration; use `duration: 0` for an immediate change.
|
|
109
110
|
`themeBlend={{themes: ['night', 'dusk', 'day'], position}}` shows a continuous blend of the map's
|
|
110
111
|
themes instead of `theme`: position 0 is the first theme and 1.5 is halfway from the second to the
|
|
111
112
|
third. Moving the position updates the map at once. See
|
|
@@ -127,6 +128,9 @@ take priority over `mapOptions`, then the manifest view, then shared defaults. `
|
|
|
127
128
|
a Tileflow map through its manifest; it has no renderer discriminator or direct-style mode.
|
|
128
129
|
Tileflow's styles are validated when they are compiled, so `validateStyle` defaults to `false`; pass
|
|
129
130
|
`true` to validate them again in the browser.
|
|
131
|
+
The map canvas is multisampled by default (`canvasContextAttributes.antialias` is `true`) so the
|
|
132
|
+
thin edges of 3D models stay continuous; other context attributes you pass are kept, and
|
|
133
|
+
`canvasContextAttributes: {antialias: false}` trades that smoothing for lower GPU cost.
|
|
130
134
|
The obsolete source fields `kind` and `style` are rejected. For a completely unmanaged map, use
|
|
131
135
|
`maplibre-gl` directly rather than a Tileflow component.
|
|
132
136
|
|
|
@@ -139,9 +143,9 @@ and memoize the values; each new object replaces the previous ones, and `null` c
|
|
|
139
143
|
<!-- docs:check -->
|
|
140
144
|
|
|
141
145
|
```tsx
|
|
146
|
+
import {Map, useBoundaryFeatureState} from '@tileflow/react';
|
|
142
147
|
import {useMemo, useState} from 'react';
|
|
143
148
|
import type {Map as MapLibreMap} from 'maplibre-gl';
|
|
144
|
-
import {Map, useBoundaryFeatureState} from '@tileflow/react';
|
|
145
149
|
|
|
146
150
|
export function Unemployment({rates}: {rates: {ine: string; rate: number}[]}) {
|
|
147
151
|
const [map, setMap] = useState<MapLibreMap | null>(null);
|
|
@@ -177,9 +181,9 @@ into hosts managed by the interaction runtime:
|
|
|
177
181
|
<!-- docs:check -->
|
|
178
182
|
|
|
179
183
|
```tsx
|
|
184
|
+
import {Map} from '@tileflow/react';
|
|
180
185
|
import {useState} from 'react';
|
|
181
186
|
import type {TileflowAnnotation, TileflowInteractionState} from '@tileflow/interactions';
|
|
182
|
-
import {Map} from '@tileflow/react';
|
|
183
187
|
|
|
184
188
|
type Property = {price: number; title: string};
|
|
185
189
|
|
|
@@ -257,8 +261,8 @@ Tileflow credentials on that server, not in React props or a browser bundle.
|
|
|
257
261
|
<!-- docs:check -->
|
|
258
262
|
|
|
259
263
|
```tsx
|
|
260
|
-
import {useState} from 'react';
|
|
261
264
|
import {StaticMap} from '@tileflow/react/static';
|
|
265
|
+
import {useState} from 'react';
|
|
262
266
|
import type {StaticMapAttributionEntry} from '@tileflow/static/client';
|
|
263
267
|
|
|
264
268
|
export function StaticPreview({idempotencyKey}: {idempotencyKey: string}) {
|
package/dist/index.js
CHANGED
|
@@ -41,8 +41,10 @@ import { createPortal } from "react-dom";
|
|
|
41
41
|
import {
|
|
42
42
|
attachTileflowAtmosphere,
|
|
43
43
|
attachTileflowFairUseNotice,
|
|
44
|
+
attachTileflowLabelPlacement,
|
|
44
45
|
attachTileflowMap3D,
|
|
45
46
|
attachTileflowMapLifecycle,
|
|
47
|
+
attachTileflowNauticalLights,
|
|
46
48
|
attachTileflowNotices,
|
|
47
49
|
createTileflowSessionStarter,
|
|
48
50
|
createTileflowThemeController,
|
|
@@ -52,7 +54,9 @@ import {
|
|
|
52
54
|
registerTileflowContourProtocol,
|
|
53
55
|
registerTileflowPmtilesProtocol,
|
|
54
56
|
registerTileflowWorldRequestBridge,
|
|
55
|
-
subscribeTileflowSystemColorScheme
|
|
57
|
+
subscribeTileflowSystemColorScheme,
|
|
58
|
+
tileflowCanvasContextAttributes,
|
|
59
|
+
tileflowMaxPitch
|
|
56
60
|
} from "@tileflow/core/browser";
|
|
57
61
|
import { normalizeTileflowCaptureId } from "@tileflow/core/capture";
|
|
58
62
|
import {
|
|
@@ -805,6 +809,9 @@ function Map2(props) {
|
|
|
805
809
|
});
|
|
806
810
|
const map = new maplibregl.Map({
|
|
807
811
|
...stableMapOptions,
|
|
812
|
+
canvasContextAttributes: tileflowCanvasContextAttributes(
|
|
813
|
+
stableMapOptions?.canvasContextAttributes
|
|
814
|
+
),
|
|
808
815
|
container,
|
|
809
816
|
style: initialRuntimeStyle.style,
|
|
810
817
|
bearing: bearingRef.current,
|
|
@@ -817,6 +824,7 @@ function Map2(props) {
|
|
|
817
824
|
},
|
|
818
825
|
// Tileflow's compiled styles are validated when they are built.
|
|
819
826
|
validateStyle: stableMapOptions?.validateStyle ?? false,
|
|
827
|
+
maxPitch: stableMapOptions?.maxPitch ?? tileflowMaxPitch,
|
|
820
828
|
transformRequest
|
|
821
829
|
});
|
|
822
830
|
mapRef.current = map;
|
|
@@ -824,6 +832,8 @@ function Map2(props) {
|
|
|
824
832
|
registerCleanup(() => map.remove());
|
|
825
833
|
registerCleanup(attachTileflowAtmosphere(map));
|
|
826
834
|
registerCleanup(attachTileflowNotices(map));
|
|
835
|
+
registerCleanup(attachTileflowNauticalLights(map));
|
|
836
|
+
registerCleanup(attachTileflowLabelPlacement(map));
|
|
827
837
|
const themeController = initialRuntimeStyle.theme === void 0 ? void 0 : createTileflowThemeController({
|
|
828
838
|
initial: initialRuntimeStyle,
|
|
829
839
|
map,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/react",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.35",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "React components for rendering Tileflow maps with MapLibre.",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tileflow/core": ">=0.1.0-alpha.
|
|
46
|
+
"@tileflow/core": ">=0.1.0-alpha.40 <0.1.0-beta.0",
|
|
47
47
|
"@tileflow/interactions": ">=0.1.0-alpha.6 <0.1.0-beta.0",
|
|
48
48
|
"@tileflow/static": ">=0.1.0-alpha.28 <0.1.0-beta.0"
|
|
49
49
|
},
|