@tileflow/vue 0.1.0-alpha.34 → 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 +6 -0
- package/dist/index.js +30 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,6 +16,12 @@ npm install @tileflow/vue@alpha @tileflow/core@alpha @tileflow/maps@alpha "mapli
|
|
|
16
16
|
npm install --save-dev --save-exact tileflow@alpha
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
Prepared styles may retain relative asset URLs. The component loads them through Core's shared
|
|
20
|
+
resource loader before creating the map and before changing or blending themes. Sprites, fonts,
|
|
21
|
+
data and model resources resolve against their declaring documents. Pending document loads are
|
|
22
|
+
cancelled when the map is replaced or unmounted; `mapOptions.transformRequest` also applies to
|
|
23
|
+
style and HTTP TileJSON requests.
|
|
24
|
+
|
|
19
25
|
## Prepare a map
|
|
20
26
|
|
|
21
27
|
Create `tileflow.config.ts` at the application root:
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
createTileflowThemeController,
|
|
27
27
|
createTileflowTransformRequest,
|
|
28
28
|
getTileflowSystemColorScheme,
|
|
29
|
+
loadTileflowRuntimeStyle,
|
|
29
30
|
loadTileflowStyleFonts,
|
|
30
31
|
registerTileflowContourProtocol,
|
|
31
32
|
registerTileflowPathGroundProtocol,
|
|
@@ -307,6 +308,7 @@ var TileflowMap = defineComponent({
|
|
|
307
308
|
let themeController = null;
|
|
308
309
|
let unsubscribeSystemColorScheme = null;
|
|
309
310
|
let mapLoadId = 0;
|
|
311
|
+
let resourceLifetime;
|
|
310
312
|
let manifestLoadId = 0;
|
|
311
313
|
let readinessRunId = 0;
|
|
312
314
|
let interactionReadinessRunId = 0;
|
|
@@ -643,6 +645,8 @@ var TileflowMap = defineComponent({
|
|
|
643
645
|
);
|
|
644
646
|
const destroyMap = () => {
|
|
645
647
|
mapLoadId += 1;
|
|
648
|
+
resourceLifetime?.abort();
|
|
649
|
+
resourceLifetime = void 0;
|
|
646
650
|
readinessRunId += 1;
|
|
647
651
|
invalidateInteractionReadiness();
|
|
648
652
|
const lifecycle = mapLifecycle;
|
|
@@ -767,16 +771,35 @@ var TileflowMap = defineComponent({
|
|
|
767
771
|
const loadId = mapLoadId;
|
|
768
772
|
const container = containerRef.value;
|
|
769
773
|
const runtime = runtimeStyle.value;
|
|
774
|
+
const session = createTileflowSessionController({ source: "vue" });
|
|
775
|
+
const lifetime = new AbortController();
|
|
776
|
+
resourceLifetime = lifetime;
|
|
777
|
+
const resourceTransform = createTileflowTransformRequest({
|
|
778
|
+
getAnalytics: () => resolvedAnalytics.value,
|
|
779
|
+
sessionController: session,
|
|
780
|
+
sessionId: session.sessionId,
|
|
781
|
+
transformRequest: props.mapOptions?.transformRequest ?? void 0
|
|
782
|
+
});
|
|
783
|
+
const styleLoadOptions = {
|
|
784
|
+
signal: lifetime.signal,
|
|
785
|
+
transformRequest: (url, type) => resourceTransform(
|
|
786
|
+
url,
|
|
787
|
+
type
|
|
788
|
+
)
|
|
789
|
+
};
|
|
770
790
|
let maplibregl;
|
|
791
|
+
let prepared;
|
|
771
792
|
try {
|
|
772
|
-
[maplibregl] = await Promise.all([
|
|
793
|
+
[maplibregl, prepared] = await Promise.all([
|
|
773
794
|
loadTileflowMapLibre(),
|
|
774
|
-
|
|
775
|
-
fontFaces:
|
|
795
|
+
loadTileflowRuntimeStyle(runtime, styleLoadOptions).then(async (loaded) => {
|
|
796
|
+
await loadTileflowStyleFonts(loaded.style, { fontFaces: loaded.fontFaces });
|
|
797
|
+
return loaded;
|
|
776
798
|
})
|
|
777
799
|
]);
|
|
778
800
|
} catch (error) {
|
|
779
801
|
if (loadId === mapLoadId) {
|
|
802
|
+
lifetime.abort();
|
|
780
803
|
console.error("Failed to load the Tileflow map runtime", error);
|
|
781
804
|
mapCaptureState.value = "error";
|
|
782
805
|
}
|
|
@@ -785,7 +808,6 @@ var TileflowMap = defineComponent({
|
|
|
785
808
|
if (loadId !== mapLoadId || containerRef.value !== container || isImageMode.value) {
|
|
786
809
|
return;
|
|
787
810
|
}
|
|
788
|
-
const session = createTileflowSessionController({ source: "vue" });
|
|
789
811
|
const sessionStarter = createTileflowSessionStarter({
|
|
790
812
|
getSessionId: () => session.sessionId,
|
|
791
813
|
sessionId: session.sessionId,
|
|
@@ -815,7 +837,7 @@ var TileflowMap = defineComponent({
|
|
|
815
837
|
container,
|
|
816
838
|
interactive: resolvedInteractive.value,
|
|
817
839
|
pitch: resolvedPitch.value,
|
|
818
|
-
style:
|
|
840
|
+
style: prepared.style,
|
|
819
841
|
transformRequest: createTileflowTransformRequest({
|
|
820
842
|
getAnalytics: () => resolvedAnalytics.value,
|
|
821
843
|
sessionController: session,
|
|
@@ -832,7 +854,9 @@ var TileflowMap = defineComponent({
|
|
|
832
854
|
attachTileflowLabelPlacement(map);
|
|
833
855
|
attachTileflowHorizonQueries(map);
|
|
834
856
|
themeController = runtime.theme === void 0 ? null : createTileflowThemeController({
|
|
835
|
-
initial: runtime,
|
|
857
|
+
initial: prepared.family ? prepared : runtime,
|
|
858
|
+
initialStyle: prepared.style,
|
|
859
|
+
styleLoadOptions,
|
|
836
860
|
map,
|
|
837
861
|
onTransition(transition) {
|
|
838
862
|
emit("themeChange", transition);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tileflow/vue",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.35",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Vue component for rendering Tileflow maps with MapLibre.",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@tileflow/core": ">=0.1.0-alpha.
|
|
41
|
+
"@tileflow/core": ">=0.1.0-alpha.45 <0.1.0-beta.0",
|
|
42
42
|
"@tileflow/interactions": ">=0.1.0-alpha.7 <0.1.0-beta.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@vue/server-renderer": "3.5.43",
|
|
50
|
-
"maplibre-gl": "6.
|
|
50
|
+
"maplibre-gl": "6.16.0",
|
|
51
51
|
"tsx": "^4.23.15",
|
|
52
52
|
"vue": "^3.5.43"
|
|
53
53
|
},
|