@simon-says-build/demo-player 0.14.3 → 0.14.4
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/index.js +1 -1
- package/package.json +1 -1
- package/src/DemoHost.js +11 -1
- package/src/core.js +16 -1
package/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { DemoHost } from './src/DemoHost.js';
|
|
2
|
-
export { demoConfig, findTarget, handlerFor, phoneSteps, scalePoint, playDemo, currentDemo, onDemo, reviewChangesOf, releaseOf, releaseReviewsOf, PLAYER_VERSION, tuckedDemo, announceOverlay } from './src/core.js';
|
|
2
|
+
export { demoConfig, findTarget, handlerFor, phoneSteps, scalePoint, playDemo, currentDemo, onDemo, reviewChangesOf, releaseOf, releaseReviewsOf, PLAYER_VERSION, tuckedDemo, announceOverlay, setCurrentRoute, currentRoute } from './src/core.js';
|
|
3
3
|
export { navigationRoute, navigationRouter, navigateArgs, pathOfState } from './src/navigation.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon-says-build/demo-player",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
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",
|
package/src/DemoHost.js
CHANGED
|
@@ -23,7 +23,7 @@ import { pageName } from './page-name.js';
|
|
|
23
23
|
// app (box-none). An app without react-native-screens keeps the in-tree layer.
|
|
24
24
|
let FullWindowOverlay = null;
|
|
25
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';
|
|
26
|
+
import { OVERLAY_ID, overlayLayer, pressableHost, rowBox, alreadyOn, currentRoute, 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';
|
|
27
27
|
import { demoApi, tourOf } from './api.js';
|
|
28
28
|
import { signInFirst, openInApp } from './signin.js';
|
|
29
29
|
import { runEvent, fillStep } from './events.js';
|
|
@@ -218,6 +218,16 @@ function Player({ config, router, insets, onClose, children }) {
|
|
|
218
218
|
advance();
|
|
219
219
|
}, [steps, step, router, advance, flash]);
|
|
220
220
|
|
|
221
|
+
// A GOTO TO WHERE THE PERSON ALREADY IS (0.14.4) is passed straight over —
|
|
222
|
+
// only when arriving forward, never after Back (Back onto it must stay, or
|
|
223
|
+
// it would bounce forward again).
|
|
224
|
+
const lastIndex = useRef(-1);
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
const forward = index > lastIndex.current;
|
|
227
|
+
lastIndex.current = index;
|
|
228
|
+
if (forward && step?.kind === 'goto' && step.path && !flash && alreadyOn(step.path, currentRoute())) advance();
|
|
229
|
+
}, [index]);
|
|
230
|
+
|
|
221
231
|
useEffect(() => {
|
|
222
232
|
if (!tried) return undefined;
|
|
223
233
|
setFlash('✓ That\'s it');
|
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.
|
|
13
|
+
export const PLAYER_VERSION = '0.14.4';
|
|
14
14
|
|
|
15
15
|
export const HOST = 5;
|
|
16
16
|
export const TEXT = 6;
|
|
@@ -225,6 +225,21 @@ export function cardBox(place, at, screen, insets, card) {
|
|
|
225
225
|
// pinned at the TOP stays left of it; one pinned at the bottom is full width.
|
|
226
226
|
export const DEV_FAB_CLEAR = 88;
|
|
227
227
|
|
|
228
|
+
// THE SCREEN THE PERSON IS ON (0.14.4, 2026-11-07): the in-app overlay knows
|
|
229
|
+
// it (expo-router's usePathname, passed to <SsbHost route>) and tells the
|
|
230
|
+
// player, so a `goto` to where the person already is isn't offered as a
|
|
231
|
+
// destination ("Your walks. Take me there" on the Walks screen — Michael).
|
|
232
|
+
let routeNow = null;
|
|
233
|
+
export const setCurrentRoute = (route) => { routeNow = typeof route === 'string' ? route : null; };
|
|
234
|
+
export const currentRoute = () => routeNow;
|
|
235
|
+
/** "/(app)/(tabs)/walks/" → "/walks": expo-router's groups, a query and trailing slashes are not the screen. Pure. */
|
|
236
|
+
export const screenOf = (path) => {
|
|
237
|
+
const p = String(path || '').split(/[?#]/)[0].split('/').filter((s) => s && !/^\(.*\)$/.test(s)).join('/');
|
|
238
|
+
return `/${p}`;
|
|
239
|
+
};
|
|
240
|
+
/** Is the person already on the screen this path opens? Unknown (no route told) is no. Pure. */
|
|
241
|
+
export const alreadyOn = (path, route) => typeof route === 'string' && !!path && screenOf(path) === screenOf(route);
|
|
242
|
+
|
|
228
243
|
// Where the overlay draws (0.14.2): iOS with react-native-screens → its own
|
|
229
244
|
// window above sheets and modals (DemoHost, FullWindowOverlay); else in-tree.
|
|
230
245
|
export const overlayLayer = (os, fwo) => (os === 'ios' && fwo ? 'window' : 'tree');
|