@goway.to/maps 0.1.0 → 0.1.1

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,18 @@
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.1
7
+
8
+ - A `MapView` given a `height` keeps it. The root was `flex: 1`, a zero flex
9
+ basis on both platforms, which overrode the caller's height: a map inside a
10
+ scroll view (an address picker in a form) rendered 0 tall. It now grows from
11
+ its own size, so it still fills a bounded parent when given no size.
12
+ - The GoWay mark has an accessible name on the web. `react-native-svg` hands
13
+ its props to the DOM `<svg>` unchanged, so the logo's React Native
14
+ accessibility props landed there as unknown attributes — no name in a
15
+ browser, and a React warning about `accessible` on every map. The web now
16
+ gets `role="img"` and `aria-label`; iOS and Android are unchanged.
17
+
6
18
  ## 0.1.0
7
19
 
8
20
  The first release: GoWay's map as an SDK, with GoWay's own app as its first
package/dist/MapView.js CHANGED
@@ -415,6 +415,11 @@ function createNativeMapApi(mapRef, cameraRef, reports) {
415
415
  return api;
416
416
  }
417
417
  const styles = StyleSheet.create({
418
- root: { flex: 1, position: 'relative', overflow: 'hidden' },
418
+ // `flexGrow`, not `flex: 1`: `flex: 1` is a zero flex BASIS (react-native-web
419
+ // writes `flex: 1 1 0%`, and Yoga reads it the same way), which overrides a
420
+ // caller's `height` and collapses a map in a scroll view or any parent of
421
+ // auto height to nothing. Growing from its own size, the map fills a bounded
422
+ // parent when given no size and keeps the one it is given.
423
+ root: { flexGrow: 1, position: 'relative', overflow: 'hidden' },
419
424
  fill: { flex: 1 },
420
425
  });
@@ -408,6 +408,11 @@ function labelAt(map, point, coordinate, layers) {
408
408
  });
409
409
  }
410
410
  const styles = StyleSheet.create({
411
- root: { flex: 1, position: 'relative', overflow: 'hidden' },
411
+ // `flexGrow`, not `flex: 1`: `flex: 1` is a zero flex BASIS (react-native-web
412
+ // writes `flex: 1 1 0%`, and Yoga reads it the same way), which overrides a
413
+ // caller's `height` and collapses a map in a scroll view or any parent of
414
+ // auto height to nothing. Growing from its own size, the map fills a bounded
415
+ // parent when given no size and keeps the one it is given.
416
+ root: { flexGrow: 1, position: 'relative', overflow: 'hidden' },
412
417
  engine: { flex: 1 },
413
418
  });
@@ -24,8 +24,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  * every call site instead of cropping in some of them.
25
25
  */
26
26
  import { memo } from 'react';
27
+ import { Platform } from 'react-native';
27
28
  import Svg, { Path } from 'react-native-svg';
28
29
  import { GOWAY_INK, GOWAY_MARK, GOWAY_WORDMARK, aspectRatio } from './artwork';
30
+ import { logoAccessibility } from './logoAccessibility';
29
31
  const ARTWORK = {
30
32
  wordmark: GOWAY_WORDMARK,
31
33
  mark: GOWAY_MARK,
@@ -37,10 +39,7 @@ export function gowayLogoHeight(width, variant = 'wordmark') {
37
39
  function GowayLogoComponent({ width, variant = 'wordmark', label = 'GoWay', testID, }) {
38
40
  const artwork = ARTWORK[variant];
39
41
  const height = gowayLogoHeight(width, variant);
40
- return (_jsx(Svg, { width: width, height: height, viewBox: artwork.viewBox,
41
- // A decorative logo beside its own name is noise in a screen reader, so
42
- // an empty label hides it rather than forcing callers to wrap it.
43
- accessible: label !== '', accessibilityRole: "image", accessibilityLabel: label || undefined, testID: testID, children: artwork.paths.map((path, index) => (
42
+ return (_jsx(Svg, { width: width, height: height, viewBox: artwork.viewBox, ...logoAccessibility(label, Platform.OS), testID: testID, children: artwork.paths.map((path, index) => (
44
43
  // Index keys: the array is a fixed, ordered drawing, never reordered
45
44
  // and never filtered by anything but `part`. Draw order is the artwork
46
45
  // (see `artwork.ts`), so a key that survived a reorder would be a bug.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The logo's accessible name, in each platform's own vocabulary.
3
+ *
4
+ * `react-native-svg` on the web hands its props to the DOM `<svg>` as they
5
+ * are, so React Native's `accessible` / `accessibilityRole` /
6
+ * `accessibilityLabel` landed there as unknown attributes: the logo had no
7
+ * accessible name in a browser, and React warned about `accessible` on every
8
+ * map. The web gets ARIA; iOS and Android keep React Native's props, which
9
+ * the native SVG view does read.
10
+ *
11
+ * An empty label hides the logo from assistive technology on both: a
12
+ * decorative logo beside its own name is noise in a screen reader.
13
+ */
14
+ export type LogoAccessibility = {
15
+ role: 'img';
16
+ 'aria-label': string;
17
+ } | {
18
+ 'aria-hidden': true;
19
+ } | {
20
+ accessible: true;
21
+ accessibilityRole: 'image';
22
+ accessibilityLabel: string;
23
+ } | {
24
+ accessible: false;
25
+ };
26
+ export declare function logoAccessibility(label: string, os: string): LogoAccessibility;
@@ -0,0 +1,7 @@
1
+ export function logoAccessibility(label, os) {
2
+ if (os === 'web')
3
+ return label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };
4
+ return label
5
+ ? { accessible: true, accessibilityRole: 'image', accessibilityLabel: label }
6
+ : { accessible: false };
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goway.to/maps",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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.",