@simon-says-build/demo-player 0.8.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simon-says-build/demo-player",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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
@@ -14,7 +14,7 @@
14
14
  // No JSX, so it needs nothing from the app's Babel setup beyond React Native's.
15
15
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
16
16
  import { Linking, Pressable, ScrollView, StyleSheet, Text, TextInput, View, useWindowDimensions } from 'react-native';
17
- import { cardBox, currentDemo, demoConfig, findTarget, handlerFor, onDemo, phoneSteps, playDemo, releaseOf, reviewChangesOf, scalePoint } from './core.js';
17
+ import { cardBox, currentDemo, demoConfig, findTarget, handlerFor, onDemo, phoneSteps, playDemo, releaseOf, reviewChangesOf, scalePoint, stepTitle } from './core.js';
18
18
  import { demoApi, tourOf } from './api.js';
19
19
  import { signInFirst, openInApp } from './signin.js';
20
20
  import { runEvent, fillStep } from './events.js';
@@ -212,7 +212,7 @@ function Player({ config, router, insets, onClose, children }) {
212
212
  rect ? h(View, { pointerEvents: 'none', style: [s.ring, { left: rect.left - 6, top: rect.top - 6, width: rect.width + 12, height: rect.height + 12 }] }) : null,
213
213
  h(Card, {
214
214
  at: rect, place: step.place, screen, insets, card, setCard,
215
- title: `${index + 1} of ${steps.length}`, body: step.caption,
215
+ title: stepTitle(step, index, steps.length), body: step.caption,
216
216
  actions: [
217
217
  { label: 'Hide', onPress: () => setTucked(true) },
218
218
  index > 0 && steps[index - 1].kind !== 'signin' ? { label: 'Back', onPress: () => setIndex(index - 1) } : null,
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.8.0';
13
+ export const PLAYER_VERSION = '0.8.1';
14
14
 
15
15
  export const HOST = 5;
16
16
  export const TEXT = 6;
@@ -103,6 +103,11 @@ export function scalePoint(point, screen, from = RECORDED_SCREEN) {
103
103
  };
104
104
  }
105
105
 
106
+ /** A step card's title: where it is in the demo, and whether SSB only set it up (a best-effort step: the state seeded and the screen opened, the change not driven). */
107
+ export function stepTitle(step, index, total) {
108
+ return `${index + 1} of ${total}${step?.bestEffort === true ? ' · set up by SSB' : ''}`;
109
+ }
110
+
106
111
  /** The steps of a tour a phone can play, in order. A step with no caption says nothing and is dropped. */
107
112
  export function phoneSteps(steps) {
108
113
  return (steps || []).filter((s) => s && PHONE_KINDS.has(s.kind) && String(s.caption || '').trim());