@goway.to/maps 0.1.1 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to `@goway.to/maps`. Semantic versioning with the 0.x rule:
4
4
  while the major version is 0, a MINOR release may break the API.
5
5
 
6
+ ## 0.1.2
7
+
8
+ - The map resolves its style through `@goway.to/sdk/map`, which has no HTTP
9
+ client and no zod, instead of the SDK's root entry. A web app no longer
10
+ bundles GoWay's whole contract to draw a map: in Homiio that was about
11
+ 170 KB of gzipped JavaScript. Needs `@goway.to/sdk` 0.7.0.
12
+
6
13
  ## 0.1.1
7
14
 
8
15
  - A `MapView` given a `height` keeps it. The root was `flex: 1`, a zero flex
@@ -40,7 +40,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
40
40
  import { memo, useCallback } from 'react';
41
41
  import { Linking, Pressable, StyleSheet, View, } from 'react-native';
42
42
  import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated';
43
- import { localizedLabel } from '@goway.to/sdk';
43
+ import { localizedLabel } from '@goway.to/sdk/map';
44
44
  import { useBloomLocale } from '@oxy.so/bloom/locale';
45
45
  import { useBottomEdgeInset } from '@oxy.so/bloom/layout';
46
46
  import { RiInformationLine } from '@oxy.so/bloom/icons/RiInformationLine';
package/dist/MapView.js CHANGED
@@ -39,14 +39,10 @@ const WORLD_VIEW = { latitude: 20, longitude: 0, zoom: 1.5 };
39
39
  export const MapView = forwardRef(function MapView(props, ref) {
40
40
  const { mapStyle = DEFAULT_MAP_STYLE, lightPreset, initialViewState, camera, light, interaction, credits, creditDisclosure, onPress, onCameraChanged, onLabelsChange, onReady, onError, style, testID, children, } = props;
41
41
  const theme = useTheme();
42
- let styleUrl = null;
43
- let styleError = null;
44
- try {
45
- styleUrl = resolveStyleUrl(mapStyle, lightPreset, theme.isDark);
46
- }
47
- catch (cause) {
48
- styleError = { reason: 'style', message: String(cause) };
49
- }
42
+ const styleUrl = resolveStyleUrl(mapStyle, lightPreset, theme.isDark);
43
+ const styleError = styleUrl === null
44
+ ? { reason: 'style', message: `not a published GoWay style: ${mapStyle}` }
45
+ : null;
50
46
  const mapRef = useRef(null);
51
47
  const cameraRef = useRef(null);
52
48
  const [error, setError] = useState(null);
@@ -57,14 +57,10 @@ export const MapView = forwardRef(function MapView(props, ref) {
57
57
  // bound once per engine: a new inline `onPress` must not rebuild the map.
58
58
  const latest = useRef(props);
59
59
  latest.current = props;
60
- let styleUrl = null;
61
- let styleError = null;
62
- try {
63
- styleUrl = resolveStyleUrl(mapStyle, lightPreset, theme.isDark);
64
- }
65
- catch (cause) {
66
- styleError = { reason: 'style', message: String(cause) };
67
- }
60
+ const styleUrl = resolveStyleUrl(mapStyle, lightPreset, theme.isDark);
61
+ const styleError = styleUrl === null
62
+ ? { reason: 'style', message: `not a published GoWay style: ${mapStyle}` }
63
+ : null;
68
64
  const [retry, setRetry] = useState(0);
69
65
  const [engine, setEngine] = useState(null);
70
66
  const [zoomLevel, setZoomLevel] = useState(() => Math.floor(openingZoom(props.initialViewState)));
package/dist/labels.js CHANGED
@@ -41,7 +41,7 @@
41
41
  * what the collision system actually PLACED, not with what the tiles
42
42
  * contain.
43
43
  */
44
- import { OPENMAPTILES_SOURCE_LAYERS as SL } from '@goway.to/sdk';
44
+ import { OPENMAPTILES_SOURCE_LAYERS as SL } from '@goway.to/sdk/map';
45
45
  import { isDrawableCoordinate } from './shared';
46
46
  /**
47
47
  * How far around the tap the engine is asked to look, in px (web) / dp (native).
@@ -7,13 +7,16 @@
7
7
  * app's theme — day in light mode, night in dark — unless the screen pins a
8
8
  * light. Any other URL is used as it is.
9
9
  */
10
- import { type MapLightPreset } from '@goway.to/sdk';
10
+ import { type MapLightPreset } from '@goway.to/sdk/map';
11
11
  /** The style a `MapView` draws when it is given none: GoWay Standard. */
12
12
  export declare const DEFAULT_MAP_STYLE: string;
13
13
  /**
14
14
  * The document URL for `mapStyle`, in `lightPreset` or the theme's light.
15
- * Throws `GoWayValidationError` for a `goway://` name that is not a published
16
- * style — the map reports that as a style failure rather than drawing a
17
- * different map than the one asked for.
15
+ * `null` for a `goway://` name that is not a published style — the map
16
+ * reports that as a style failure rather than drawing a different map than
17
+ * the one asked for.
18
+ *
19
+ * Through `@goway.to/sdk/map`, which has no HTTP client and no schema: a map
20
+ * resolving its style must not carry GoWay's whole contract into an app.
18
21
  */
19
- export declare function resolveStyleUrl(mapStyle: string, lightPreset: MapLightPreset | undefined, dark: boolean): string;
22
+ export declare function resolveStyleUrl(mapStyle: string, lightPreset: MapLightPreset | undefined, dark: boolean): string | null;
package/dist/styleUrl.js CHANGED
@@ -7,16 +7,18 @@
7
7
  * app's theme — day in light mode, night in dark — unless the screen pins a
8
8
  * light. Any other URL is used as it is.
9
9
  */
10
- import { createGoWayClient, gowayStyleUrl } from '@goway.to/sdk';
10
+ import { gowayStyleUrl, styleDocumentUrl } from '@goway.to/sdk/map';
11
11
  /** The style a `MapView` draws when it is given none: GoWay Standard. */
12
12
  export const DEFAULT_MAP_STYLE = gowayStyleUrl('standard');
13
- const links = createGoWayClient().links;
14
13
  /**
15
14
  * The document URL for `mapStyle`, in `lightPreset` or the theme's light.
16
- * Throws `GoWayValidationError` for a `goway://` name that is not a published
17
- * style — the map reports that as a style failure rather than drawing a
18
- * different map than the one asked for.
15
+ * `null` for a `goway://` name that is not a published style — the map
16
+ * reports that as a style failure rather than drawing a different map than
17
+ * the one asked for.
18
+ *
19
+ * Through `@goway.to/sdk/map`, which has no HTTP client and no schema: a map
20
+ * resolving its style must not carry GoWay's whole contract into an app.
19
21
  */
20
22
  export function resolveStyleUrl(mapStyle, lightPreset, dark) {
21
- return links.styleUrl(mapStyle, lightPreset ?? (dark ? 'night' : 'day'));
23
+ return styleDocumentUrl(mapStyle, lightPreset ?? (dark ? 'night' : 'day'));
22
24
  }
package/dist/types.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import type { ReactNode } from 'react';
11
11
  import type { StyleProp, ViewStyle } from 'react-native';
12
- import type { MapLightPreset } from '@goway.to/sdk';
12
+ import type { MapLightPreset } from '@goway.to/sdk/map';
13
13
  import type { GeoBoundingBox, GeoCoordinate } from '@goway.to/sdk/geo';
14
14
  export type { GeoBoundingBox, GeoCoordinate };
15
15
  /** Where the camera is. `bearing` and `pitch` are optional on input and always present on output. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goway.to/maps",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "GoWay's maps SDK for React and React Native: one declarative map for web and native — GoWay styles that follow your theme, Bloom markers with clustering, a camera framed by value, user location without a prompt on mount.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "The Oxy Collective, Inc.",
@@ -77,7 +77,7 @@
77
77
  "supercluster": "^8.0.1"
78
78
  },
79
79
  "peerDependencies": {
80
- "@goway.to/sdk": ">=0.6.0",
80
+ "@goway.to/sdk": ">=0.7.0",
81
81
  "@maplibre/maplibre-react-native": ">=11.4.0",
82
82
  "@oxy.so/bloom": ">=10.16.0",
83
83
  "expo-location": "*",
@@ -100,7 +100,7 @@
100
100
  }
101
101
  },
102
102
  "devDependencies": {
103
- "@goway.to/sdk": "0.6.0",
103
+ "@goway.to/sdk": "0.7.0",
104
104
  "@maplibre/maplibre-react-native": "^11.4.0",
105
105
  "@oxy.so/bloom": "^10.16.1",
106
106
  "@types/react": "^19.2.17",