@tileflow/svelte 0.1.0-alpha.24 → 0.1.0-alpha.26

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 CHANGED
@@ -73,7 +73,7 @@ The worker and shared module must match the application's installed MapLibre ver
73
73
  </script>
74
74
 
75
75
  <TileflowMap
76
- source={{kind: 'tileflow', map: 'madrid'}}
76
+ source={{map: 'madrid'}}
77
77
  theme="system"
78
78
  center={[-3.7038, 40.4168]}
79
79
  zoom={12}
@@ -81,18 +81,20 @@ The worker and shared module must match the application's installed MapLibre ver
81
81
  />
82
82
  ```
83
83
 
84
- Coordinates are `[longitude, latitude]`. `source.map` matches the config's portable ID, not a hosted
85
- `map_...` identifier. The default manifest URL is exactly `/tileflow/manifest.json`. Set
86
- `source.manifestUrl` for a subpath or external host; the browser does not infer bundler configuration.
84
+ Coordinates are `[longitude, latitude]`. `source` is one object, `{map, manifestUrl?}`.
85
+ `source.map` matches the config's portable ID, not a hosted `map_...` identifier. The default
86
+ manifest URL is exactly `/tileflow/manifest.json`. Set `source.manifestUrl` for a subpath or external
87
+ host; the browser does not infer bundler configuration.
87
88
 
88
89
  Omitting `theme` uses `defaultTheme`. `system` needs an explicit light/dark mapping, which Streets
89
90
  supplies. Theme changes keep the MapLibre instance, camera, and interactions, and roll back on
90
91
  failure. `onThemeChange` reports transitions.
91
92
 
92
93
  `mapOptions` accepts native MapLibre options except `container` and `style`. Direct props win over
93
- those options, then the manifest view, then shared defaults. An unmanaged source with
94
- `{kind: 'maplibre', style: styleUrl}` loads one style without Tileflow themes or manifest identity;
95
- do not pass a Tileflow theme with it.
94
+ those options, then the manifest view, then shared defaults. `TileflowMap` always selects a Tileflow
95
+ map through its manifest; it has no renderer discriminator or direct-style mode. The obsolete
96
+ source fields `kind` and `style` are rejected. For a completely unmanaged map, use `maplibre-gl`
97
+ directly rather than a Tileflow component.
96
98
 
97
99
  ## Add annotations and native popup UI
98
100
 
@@ -137,7 +139,7 @@ This Svelte 5 component uses the worker and CSS setup above:
137
139
  {/snippet}
138
140
 
139
141
  <TileflowMap
140
- source={{kind: 'tileflow', map: 'madrid'}}
142
+ source={{map: 'madrid'}}
141
143
  {annotations}
142
144
  interactionState={state}
143
145
  onInteractionStateChange={(next) => (state = next)}
@@ -164,9 +166,10 @@ HTML. Keep tooltips non-interactive and put buttons, links, and forms in popups.
164
166
 
165
167
  ## Display an existing image
166
168
 
167
- `mode="image"` displays an explicit `imageUrl` or a published manifest image without loading
168
- MapLibre. A local style build does not generate that image. This mode does not submit or poll a
169
- Static Maps operation; use the server-side
169
+ `mode="image"` displays an explicit `imageUrl` or derives an image URL from the selected manifest
170
+ map's `mapId`, `apiUrl`, concrete theme and view, without loading MapLibre. It still requires a valid
171
+ Tileflow source. A local style build does not generate that image. This mode does not submit or poll
172
+ a Static Maps operation; use the server-side
170
173
  [Static Maps client](https://github.com/tileflow/tileflow-sdk/blob/main/packages/static/README.md)
171
174
  for new renders, keeping privileged credentials off the browser.
172
175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/svelte",
3
- "version": "0.1.0-alpha.24",
3
+ "version": "0.1.0-alpha.26",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Svelte component for rendering Tileflow maps with MapLibre.",
6
6
  "type": "module",
@@ -44,7 +44,7 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@tileflow/core": ">=0.1.0-alpha.25 <0.1.0-beta.0",
47
+ "@tileflow/core": ">=0.1.0-alpha.29 <0.1.0-beta.0",
48
48
  "@tileflow/interactions": ">=0.1.0-alpha.4 <0.1.0-beta.0"
49
49
  },
50
50
  "peerDependencies": {
@@ -23,10 +23,10 @@
23
23
  resolveTileflowRuntimeTheme,
24
24
  resolveTileflowRuntimeView,
25
25
  resolveTileflowStaticImageUrl,
26
- shouldLoadTileflowManifest,
27
26
  type TileflowRuntimeManifestMap,
28
27
  } from '@tileflow/core/runtime';
29
28
  import {
29
+ attachTileflowAtmosphere,
30
30
  attachTileflowFairUseNotice,
31
31
  attachTileflowMapLifecycle,
32
32
  createTileflowSessionStarter,
@@ -144,7 +144,7 @@
144
144
  let manifestMap: TileflowRuntimeManifestMap | null = null;
145
145
  let manifestLoadId = 0;
146
146
  let manifestResolutionKey = '';
147
- let manifestResolutionState: 'error' | 'loading' | 'not-needed' | 'ready' = 'loading';
147
+ let manifestResolutionState: 'error' | 'loading' | 'ready' = 'loading';
148
148
  let mapLoadId = 0;
149
149
  let mounted = false;
150
150
  let refreshRunId = 0;
@@ -170,23 +170,11 @@
170
170
  $: assertTileflowMapStyleInputs({source, theme});
171
171
  $: resolvedCaptureId = normalizeTileflowCaptureId(captureId);
172
172
  $: isImageMode = resolvedMode === 'image';
173
- $: mapName = source?.kind === 'tileflow' ? source.map : undefined;
174
- $: manifestUrl =
175
- source?.kind === 'tileflow'
176
- ? (source.manifestUrl ?? defaultTileflowManifestUrl)
177
- : defaultTileflowManifestUrl;
178
- $: shouldLoadManifest = shouldLoadTileflowManifest({
179
- source,
180
- });
181
- $: manifestRequestKey = shouldLoadManifest
182
- ? JSON.stringify([manifestUrl, mapName])
183
- : 'not-needed';
173
+ $: mapName = source.map;
174
+ $: manifestUrl = source.manifestUrl ?? defaultTileflowManifestUrl;
175
+ $: manifestRequestKey = JSON.stringify([manifestUrl, mapName]);
184
176
  $: currentManifestResolutionState =
185
- manifestResolutionKey === manifestRequestKey
186
- ? manifestResolutionState
187
- : shouldLoadManifest
188
- ? 'loading'
189
- : 'not-needed';
177
+ manifestResolutionKey === manifestRequestKey ? manifestResolutionState : 'loading';
190
178
  $: manifestMap =
191
179
  manifestResolutionKey === manifestRequestKey && manifestResolutionState === 'ready'
192
180
  ? loadedManifestMap
@@ -194,7 +182,6 @@
194
182
  $: themeResolution = resolveThemeSelection({
195
183
  colorScheme: systemColorScheme,
196
184
  manifestMap,
197
- source,
198
185
  theme,
199
186
  });
200
187
  $: resolvedThemeName = themeResolution.name;
@@ -237,7 +224,6 @@
237
224
  isImageMode,
238
225
  runtimeImageUrl,
239
226
  runtimeStyle,
240
- shouldLoadManifest,
241
227
  themeResolutionError: themeResolution.error,
242
228
  });
243
229
  $: currentMapCaptureState =
@@ -384,17 +370,7 @@
384
370
  }
385
371
 
386
372
  async function refreshManifest() {
387
- const shouldLoad = shouldLoadManifest;
388
373
  const requestKey = manifestRequestKey;
389
-
390
- if (!shouldLoad) {
391
- manifestLoadId += 1;
392
- loadedManifestMap = null;
393
- manifestResolutionKey = requestKey;
394
- manifestResolutionState = 'not-needed';
395
- return;
396
- }
397
-
398
374
  const loadId = ++manifestLoadId;
399
375
  loadedManifestMap = null;
400
376
  manifestResolutionKey = requestKey;
@@ -599,6 +575,7 @@
599
575
  });
600
576
 
601
577
  mapInstance = maplibreMap;
578
+ attachTileflowAtmosphere(maplibreMap);
602
579
  themeController =
603
580
  runtime.theme === undefined
604
581
  ? null
@@ -1228,16 +1205,12 @@
1228
1205
  function resolveThemeSelection(input: {
1229
1206
  colorScheme: 'dark' | 'light';
1230
1207
  manifestMap: TileflowRuntimeManifestMap | null;
1231
- source: TileflowMapProps['source'];
1232
1208
  theme: TileflowMapProps['theme'];
1233
1209
  }): Readonly<{error: boolean; name: string | undefined}> {
1234
- if (!input.manifestMap || input.source.kind !== 'tileflow') {
1210
+ if (!input.manifestMap) {
1235
1211
  return {
1236
1212
  error: false,
1237
- name:
1238
- input.source.kind === 'tileflow' && input.theme && input.theme !== 'system'
1239
- ? input.theme
1240
- : undefined,
1213
+ name: input.theme && input.theme !== 'system' ? input.theme : undefined,
1241
1214
  };
1242
1215
  }
1243
1216
 
@@ -1252,16 +1225,15 @@
1252
1225
  }
1253
1226
 
1254
1227
  function resolveRuntimeResolutionState(input: {
1255
- currentManifestResolutionState: 'error' | 'loading' | 'not-needed' | 'ready';
1228
+ currentManifestResolutionState: 'error' | 'loading' | 'ready';
1256
1229
  imageSize: {height: number; width: number} | null;
1257
1230
  imageUrl: string | undefined;
1258
1231
  isImageMode: boolean;
1259
1232
  runtimeImageUrl: string | undefined;
1260
1233
  runtimeStyle: ReturnType<typeof resolveTileflowRuntimeStyle>;
1261
- shouldLoadManifest: boolean;
1262
1234
  themeResolutionError: boolean;
1263
1235
  }): 'error' | 'idle' | 'loading' {
1264
- if (input.shouldLoadManifest && input.currentManifestResolutionState !== 'ready') {
1236
+ if (input.currentManifestResolutionState !== 'ready') {
1265
1237
  return input.currentManifestResolutionState === 'error' ? 'error' : 'loading';
1266
1238
  }
1267
1239
  if (input.themeResolutionError) return 'error';
@@ -16,12 +16,6 @@ export function validateTileflowMapStyleInputs(input) {
16
16
  if (input.theme !== undefined && !validateTileflowThemeSelection(input.theme)) {
17
17
  return {error: 'theme must be a concrete portable theme name or "system"', ok: false};
18
18
  }
19
- if (
20
- input.theme !== undefined &&
21
- /** @type {{kind?: unknown}} */ (input.source).kind !== 'tileflow'
22
- ) {
23
- return {error: 'theme is only valid with a tileflow source', ok: false};
24
- }
25
19
  return {ok: true};
26
20
  }
27
21