@simon-says-build/demo-player 0.14.1 → 0.14.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simon-says-build/demo-player",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "SimonSays mobile demo player: walks a preview's viewer through a job's change, inside the app. Renders nothing unless the bundle carries a demo.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,16 @@
18
18
  ],
19
19
  "peerDependencies": {
20
20
  "react": ">=18",
21
- "react-native": ">=0.76"
21
+ "react-native": ">=0.76",
22
+ "react-native-screens": ">=3"
22
23
  },
23
24
  "scripts": {
24
25
  "test": "node --test test/*.test.mjs"
25
26
  },
26
- "license": "UNLICENSED"
27
+ "license": "UNLICENSED",
28
+ "peerDependenciesMeta": {
29
+ "react-native-screens": {
30
+ "optional": true
31
+ }
32
+ }
27
33
  }
package/src/DemoHost.js CHANGED
@@ -15,7 +15,15 @@
15
15
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
16
16
  import { Linking, NativeModules, Platform, Settings, Pressable, ScrollView, StyleSheet, Text, TextInput, View, useWindowDimensions } from 'react-native';
17
17
  import { pageName } from './page-name.js';
18
- import { OVERLAY_ID, chapterOf, cardBox, pinnedBox, setTuckedDemo, overlayAnnounced, tapInside, currentDemo, demoConfig, findTarget, handlerFor, introBody, introOf, onDemo, phoneSteps, playDemo, releaseOf, reviewChangesOf, scalePoint, rescueNote, screenCandidates, stepTitle, targetOfKey } from './core.js';
18
+ // ABOVE NATIVE SHEETS (0.14.2, 2026-11-07): a profile that opens as a native
19
+ // sheet (react-native-screens formSheet) covered the card, so Connie Ho's review
20
+ // lost its card at "tap her photo" (demo 16D4S5HqugIonvUSdC5u). On iOS the
21
+ // overlay draws in react-native-screens' FullWindowOverlay — a window above the
22
+ // app's own, sheets and modals included; taps outside the card still reach the
23
+ // app (box-none). An app without react-native-screens keeps the in-tree layer.
24
+ let FullWindowOverlay = null;
25
+ try { FullWindowOverlay = require('react-native-screens').FullWindowOverlay || null; } catch { FullWindowOverlay = null; }
26
+ import { OVERLAY_ID, overlayLayer, pressableHost, rowBox, chapterOf, cardBox, pinnedBox, setTuckedDemo, overlayAnnounced, tapInside, currentDemo, demoConfig, findTarget, handlerFor, introBody, introOf, onDemo, phoneSteps, playDemo, releaseOf, reviewChangesOf, scalePoint, rescueNote, screenCandidates, stepTitle, targetOfKey } from './core.js';
19
27
  import { demoApi, tourOf } from './api.js';
20
28
  import { signInFirst, openInApp } from './signin.js';
21
29
  import { runEvent, fillStep } from './events.js';
@@ -149,7 +157,8 @@ function Player({ config, router, insets, onClose, children }) {
149
157
  const started = Date.now();
150
158
  const tick = async () => {
151
159
  const f = findTarget(fiberOf(rootRef.current), target);
152
- const r = f ? await measure(f) : null;
160
+ const host = f ? pressableHost(f) : null;
161
+ const r = f ? rowBox(await measure(f), host !== f ? await measure(host) : null, screen) : null;
153
162
  if (!live) return;
154
163
  setFound(f);
155
164
  setRect(r);
@@ -362,7 +371,9 @@ function Player({ config, router, insets, onClose, children }) {
362
371
  };
363
372
  return h(View, { ref: rootRef, style: s.root, collapsable: false, onTouchEnd },
364
373
  children,
365
- h(View, { pointerEvents: 'box-none', style: StyleSheet.absoluteFill, testID: OVERLAY_ID }, overlay));
374
+ overlayLayer(Platform.OS, FullWindowOverlay) === 'window'
375
+ ? h(FullWindowOverlay, null, h(View, { pointerEvents: 'box-none', style: StyleSheet.absoluteFill, testID: OVERLAY_ID }, overlay))
376
+ : h(View, { pointerEvents: 'box-none', style: StyleSheet.absoluteFill, testID: OVERLAY_ID }, overlay));
366
377
  }
367
378
 
368
379
  // The review card: every change of the demo, each approved here or discussed
package/src/core.js CHANGED
@@ -10,7 +10,7 @@ import { bubbleBox } from './step-place.js';
10
10
  // What this player is, said when the app registers for "Ready to see"
11
11
  // (packages/ssb-overlay sends it; functions/in-app-notify.mjs clientOf). Kept
12
12
  // equal to package.json by test/core.test.mjs.
13
- export const PLAYER_VERSION = '0.14.1';
13
+ export const PLAYER_VERSION = '0.14.3';
14
14
 
15
15
  export const HOST = 5;
16
16
  export const TEXT = 6;
@@ -144,6 +144,26 @@ export function handlerFor(f, name) {
144
144
  return null;
145
145
  }
146
146
 
147
+ /**
148
+ * THE THING A PERSON TAPS (0.14.3, 2026-11-07): a target found by its words is
149
+ * often a Text inside a pressable row. Ringing the Text put a small ring on a
150
+ * label at the row's edge, and a tap anywhere else on the row — what a person
151
+ * and SSB's check both do — was not seen as the try: Connie Ho's "Open Yane"
152
+ * opened her profile and the card kept asking (demo 16D4S5HqugIonvUSdC5u).
153
+ * → the first host view of the nearest ancestor with an onPress (the row), or
154
+ * `f` when there is none. Pure (walks fibers: return / child, tag 5 = host).
155
+ */
156
+ export function pressableHost(f) {
157
+ let p = f;
158
+ while (p && typeof p.memoizedProps?.onPress !== 'function') p = p.return;
159
+ if (!p) return f;
160
+ for (let q = p; q; q = q.child) if (q.tag === 5 && q.stateNode) return q;
161
+ return f;
162
+ }
163
+ /** Use the row's box only when it is a row, not a screen-sized wrapper. Pure. */
164
+ export const rowBox = (text, row, screen) =>
165
+ row && text && row.width * row.height <= 0.4 * screen.width * screen.height ? row : text;
166
+
147
167
  /** A recorded point, scaled from the recording screen to `screen`. */
148
168
  export function scalePoint(point, screen, from = RECORDED_SCREEN) {
149
169
  return {
@@ -205,6 +225,10 @@ export function cardBox(place, at, screen, insets, card) {
205
225
  // pinned at the TOP stays left of it; one pinned at the bottom is full width.
206
226
  export const DEV_FAB_CLEAR = 88;
207
227
 
228
+ // Where the overlay draws (0.14.2): iOS with react-native-screens → its own
229
+ // window above sheets and modals (DemoHost, FullWindowOverlay); else in-tree.
230
+ export const overlayLayer = (os, fwo) => (os === 'ios' && fwo ? 'window' : 'tree');
231
+
208
232
  export function pinnedBox(at, screen, insets, card) {
209
233
  const left = 12, full = screen.width - 24;
210
234
  const top = insets.top + 8;