@wix/himalaya-cli 0.1818.0 → 0.1820.0

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.
Files changed (24) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/l10n-catalog.d.ts +18 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +7 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +14 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/tools/l10n/pseudo.d.ts +14 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +5 -2
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +2 -1
  7. package/dist/browser-plane/assets.json +5 -5
  8. package/dist/browser-plane/preview-deferred/{07b2e5e38ef6723989a20a92ad6fb8739a065fb1c1efda5414180c4d819f93a0.bin → c79b92a1e079fa690016cbfe1b407af2be8280da71314a65e1077c127b00f4c4.bin} +1 -1
  9. package/dist/browser-plane/sw.js +8 -8
  10. package/dist/cli.mjs +2410 -1531
  11. package/dist/preview-assets.generated.bin +0 -0
  12. package/guides/app-config.md +12 -4
  13. package/guides/capabilities.md +3 -0
  14. package/guides/component-reference.json +1 -1
  15. package/guides/component-reference.md +5 -0
  16. package/guides/designing-himi-screens.md +119 -2
  17. package/guides/himi-skill.md +17 -0
  18. package/guides/image-preview.md +1 -1
  19. package/guides/index.json +1 -0
  20. package/package.json +2 -2
  21. package/templates/branded-lite/dev/index.ts +6 -23
  22. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +29 -7
  23. package/templates/personal-fitness-trainer/dev/index.ts +4 -22
  24. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +29 -7
Binary file
@@ -67,7 +67,7 @@ Three layers, each narrowing the one above it:
67
67
  top screen (pushed, a tab root, or the content of a sheet / `full_screen` cover), its set replaces
68
68
  `navigation.orientation`, still inside the envelope. When it leaves, the app's set applies again
69
69
  and the device rotates back. Use it for one screen that may rotate while the rest of the app stays
70
- portrait — a full-screen game or video player:
70
+ portrait — a full-screen game:
71
71
 
72
72
  ```ts
73
73
  // config.ts
@@ -82,6 +82,12 @@ Three layers, each narrowing the one above it:
82
82
  never rotate there). On Android, Branded Lite and Owner Lite enforce orientation only once the
83
83
  app or the shown screen declares one; an app that declares neither rotates as it always did.
84
84
 
85
+ **A video in full screen needs none of this.** A `MediaPlayer` or `Video` in full screen turns to
86
+ landscape with the device and back, in every app, while the app itself stays in its own
87
+ orientations. Do not widen the envelope or give the screen an `orientation` for it. To change
88
+ it, set `orientationEnvelope.fullscreenMedia`: the orientations a full-screen video may also
89
+ take (default `["landscapeLeft", "landscapeRight"]`); `[]` keeps it in the app's own.
90
+
85
91
  ## Surfaces (platforms.json + navigation.surfaces)
86
92
 
87
93
  A Himalaya app is not just a phone app: the surface CATALOG is
@@ -162,9 +168,11 @@ loop — discover, declare, validate, ship — and `himi capabilities <id>` show
162
168
  shells' binaries serve it.
163
169
 
164
170
  Declared capabilities also decide which native modules link into the binary: a capability the build
165
- does not include answers `module_not_linked` on device. Some components need one — `Video`,
166
- `MediaPlayer` and `CarBrowse` need `media_playback`, `Lottie` and `Rive` need `animation` —
167
- and `himi validate` errors on a screen that uses one the app does not declare.
171
+ does not include answers `module_not_linked` on device. Some components need one — `MediaPlayer`
172
+ and `CarBrowse` need `media_playback`, `Video` needs `media_playback` or `video_playback` (in-app
173
+ only: no background audio declared), `Lottie` and `Rive` need `animation` — and `himi validate`
174
+ errors on a screen that uses one the app does not declare. Which media capability to declare, and
175
+ when to turn on background play or casting: §4d of the `designing-himi-screens` guide (its installed skill, or `himi docs designing-himi-screens`).
168
176
  `presigned_upload.putFile` also requires `files` on the calling screen.
169
177
 
170
178
  App-level capability vocabulary: `camera`, `barcode_scanner`, `biometrics`, `secure_storage`, `share`, `push`, `file_picker`, `files`, `open_url`, `pdf`, `clipboard`, `theme`, `l10n`, `photos`, `presigned_upload`, `ui`, `calendar`, `contacts`, `tasks`, `audio_record`, `audio_record_background`, `calls`, `location`, `location_background`, `motion`, `health`, `media_playback`, `webview`, `browser_auth`, `haptic`, `himi_apps`, `iap`, `keyboard`, `torch`, `network`, `wix_cashier`, `wix_chat`, `live_activity`, `local_database`, `speech`, `speaker_diarization`, `system_intents`, `on_device_ai`, `text_recognition`, `translation`, `image_labeling`, `barcode_detection`, `text_embedding`, `entity_extraction`, `app_info`, `release_control`, `legacy_import`, `godot`, `base44`, `animation`, `video_playback`, `apple_sign_in`, `google_sign_in`.
@@ -354,6 +354,9 @@ does not link that module would render a component whose library is not in the b
354
354
  | `Lottie` | `animation` | sized placeholder |
355
355
  | `Rive` | `animation` | sized placeholder |
356
356
 
357
+ Which of the two media capabilities to declare, when to turn on background play, and how Google
358
+ Cast is added on Android: `himi docs designing-himi-screens`, §4d.
359
+
357
360
  `animation` has no verbs and no permission: it exists only so the build links Lottie and Rive.
358
361
  Add it to `capabilityEnvelope` instead of `capabilities` if a later release may start using
359
362
  those components. A release whose screens use one of these components also requires the
@@ -1221,7 +1221,7 @@
1221
1221
  "note": "`allowCellular` is ignored. Skip buttons ignore `forwardSkipSeconds`/`backwardSkipSeconds`. `playbackRates` is ignored, and the queue/chapters/transcript panels never render."
1222
1222
  }
1223
1223
  ],
1224
- "propsSource": "export interface MediaPlayerProps {\n sessionId?: string;\n items?: MediaItem[];\n startIndex?: number;\n startPositionSeconds?: number;\n presentation?: MediaPresentation;\n controls?: MediaControls;\n autoplay?: MediaAutoplay;\n autoplayVisibilityThreshold?: number;\n muted?: boolean;\n loop?: MediaLoop;\n fullscreen?: Exclude<MediaPolicy, \"automatic\" | \"audioOnly\">;\n pictureInPicture?: Extract<MediaPolicy, \"disabled\" | \"allowed\" | \"automatic\">;\n backgroundPlayback?: Extract<MediaPolicy, \"disabled\" | \"allowed\" | \"audioOnly\">;\n externalPlayback?: Exclude<MediaPolicy, \"automatic\" | \"audioOnly\">;\n playbackRates?: number[];\n forwardSkipSeconds?: number;\n backwardSkipSeconds?: number;\n showQueue?: boolean;\n showChapters?: boolean;\n showTranscript?: boolean;\n height?: number;\n aspectRatio?: number;\n contentMode?: \"fit\" | \"fill\";\n posterUrl?: string;\n appearance?: MediaPlayerAppearance;\n slots?: MediaPlayerSlots;\n onReady?: Action;\n onPlay?: Action;\n onPause?: Action;\n onEnd?: Action;\n onError?: Action;\n onProgress?: Action;\n onFullscreenChange?: Action;\n onItemChange?: Action;\n allowCellular?: boolean;\n preload?: boolean;\n /**\n * `$service:` binding → a live `MediaItem[]`: the worker-driven QUEUE, resolved\n * through the same list-binding seam as `LazyList.itemsPath` / `Map.markersPath`.\n * `items` is `MediaItem[]`, so a value binding there is a type mismatch — this\n * companion string carries the binding and OVERRIDES the literal `items` when set.\n * Each resolved item's own scalar fields (url/title/artist/artworkUrl) still resolve\n * per-field through the media-source seam.\n */\n itemsPath?: string;\n}"
1224
+ "propsSource": "export interface MediaPlayerProps {\n sessionId?: string;\n items?: MediaItem[];\n startIndex?: number;\n startPositionSeconds?: number;\n presentation?: MediaPresentation;\n /** Absent or `builtIn` ⇒ the player's own controls (above). */\n controls?: MediaControls;\n autoplay?: MediaAutoplay;\n autoplayVisibilityThreshold?: number;\n muted?: boolean;\n loop?: MediaLoop;\n /** `disabled` ⇒ no full-screen button. Audio never has one. */\n fullscreen?: Exclude<MediaPolicy, \"automatic\" | \"audioOnly\">;\n /** `disabled` ⇒ no Picture in Picture button. Shown only where the device can. */\n pictureInPicture?: Extract<MediaPolicy, \"disabled\" | \"allowed\" | \"automatic\">;\n backgroundPlayback?: Extract<MediaPolicy, \"disabled\" | \"allowed\" | \"audioOnly\">;\n /** `disabled` ⇒ no cast button (AirPlay on iOS, Remote Playback on the web, Google Cast on Android). */\n externalPlayback?: Exclude<MediaPolicy, \"automatic\" | \"audioOnly\">;\n /** The speeds the speed menu offers. Absent ⇒ 0.5, 0.75, 1, 1.25, 1.5, 2. */\n playbackRates?: number[];\n forwardSkipSeconds?: number;\n backwardSkipSeconds?: number;\n showQueue?: boolean;\n showChapters?: boolean;\n showTranscript?: boolean;\n height?: number;\n aspectRatio?: number;\n contentMode?: \"fit\" | \"fill\";\n posterUrl?: string;\n appearance?: MediaPlayerAppearance;\n slots?: MediaPlayerSlots;\n onReady?: Action;\n onPlay?: Action;\n onPause?: Action;\n onEnd?: Action;\n onError?: Action;\n onProgress?: Action;\n onFullscreenChange?: Action;\n onItemChange?: Action;\n allowCellular?: boolean;\n preload?: boolean;\n /**\n * `$service:` binding → a live `MediaItem[]`: the worker-driven QUEUE, resolved\n * through the same list-binding seam as `LazyList.itemsPath` / `Map.markersPath`.\n * `items` is `MediaItem[]`, so a value binding there is a type mismatch — this\n * companion string carries the binding and OVERRIDES the literal `items` when set.\n * Each resolved item's own scalar fields (url/title/artist/artworkUrl) still resolve\n * per-field through the media-source seam.\n */\n itemsPath?: string;\n}"
1225
1225
  },
1226
1226
  {
1227
1227
  "name": "Lottie",
@@ -2263,15 +2263,20 @@ export interface MediaPlayerProps {
2263
2263
  startIndex?: number;
2264
2264
  startPositionSeconds?: number;
2265
2265
  presentation?: MediaPresentation;
2266
+ /** Absent or `builtIn` ⇒ the player's own controls (above). */
2266
2267
  controls?: MediaControls;
2267
2268
  autoplay?: MediaAutoplay;
2268
2269
  autoplayVisibilityThreshold?: number;
2269
2270
  muted?: boolean;
2270
2271
  loop?: MediaLoop;
2272
+ /** `disabled` ⇒ no full-screen button. Audio never has one. */
2271
2273
  fullscreen?: Exclude<MediaPolicy, "automatic" | "audioOnly">;
2274
+ /** `disabled` ⇒ no Picture in Picture button. Shown only where the device can. */
2272
2275
  pictureInPicture?: Extract<MediaPolicy, "disabled" | "allowed" | "automatic">;
2273
2276
  backgroundPlayback?: Extract<MediaPolicy, "disabled" | "allowed" | "audioOnly">;
2277
+ /** `disabled` ⇒ no cast button (AirPlay on iOS, Remote Playback on the web, Google Cast on Android). */
2274
2278
  externalPlayback?: Exclude<MediaPolicy, "automatic" | "audioOnly">;
2279
+ /** The speeds the speed menu offers. Absent ⇒ 0.5, 0.75, 1, 1.25, 1.5, 2. */
2275
2280
  playbackRates?: number[];
2276
2281
  forwardSkipSeconds?: number;
2277
2282
  backwardSkipSeconds?: number;
@@ -395,8 +395,8 @@ action id; anything richer is a descriptor overlay, not a snackbar.
395
395
  dense row); `ProgressBar` for determinate progress, `ActivityIndicator` for indeterminate; `Gauge` for
396
396
  a single dial metric. *Use a `Badge` for a count, a `Tag` for a category — they aren't interchangeable.*
397
397
 
398
- **Media** — `Image` (`fillWidth`, `height`, always `contentDescription`); `Video`/`Lottie`/`Rive` for
399
- motion media; `Map` for location; `Avatar` for a person; `QrCode` to share a link, ticket or invite
398
+ **Media** — `Image` (`fillWidth`, `height`, always `contentDescription`); `MediaPlayer` for video
399
+ and audio (§4c has the six rules for a screen with video, §4d says when to turn on background play and casting); `Lottie`/`Rive` for motion graphics; `Map` for location; `Avatar` for a person; `QrCode` to share a link, ticket or invite
400
400
  as a code generated on the device (bind `valuePath`; keep the payload short, since a literal over the
401
401
  level's capacity fails validation); `WebView` only when native can't express it. For a page of the
402
402
  customer's own website, use `sitePage(site, { path })` (see §4), not a hand-built `WebView`.
@@ -465,6 +465,99 @@ brief, then adapt it; each obeys the phone rules above.
465
465
  `button({ title: "Add to bag", style: "primary", fullWidth: true })`. It is the screen's only
466
466
  filled button.
467
467
 
468
+ ### 4c. Video in a screen
469
+
470
+ The player does the work. A screen that shows video follows these rules and adds nothing of its own.
471
+
472
+ 1. **Use `MediaPlayer`** (`Video` is the same player with one clip). Play, seek, skip, mute, speed,
473
+ captions, full screen, the turn to landscape in full screen and picture in picture are built in,
474
+ the same set on iOS, Android and the web, with cast where the platform has it (AirPlay on iOS,
475
+ Remote Playback on the web, Google Cast on Android when the app opts in with
476
+ `"media": { "cast": true }` in `distribution.json`). Add no buttons for any of them, and no shell
477
+ setup.
478
+ 2. **Bind the queue** with `itemsPath` to the worker's items, and give every item an `id`. With an
479
+ `id`, an address the worker signs again keeps playing instead of restarting. A `Video` needs
480
+ none: its one clip is the component's, so two addresses that differ only in their query are the
481
+ same clip. To switch between files by the query alone, use a `MediaPlayer` with item ids.
482
+ Mark a live stream `live: true`. A stream with no end shows LIVE without it once it has loaded,
483
+ but only the flag is right before that.
484
+ 3. **Keep the player on the screen while the worker loads.** Put no `hiddenPath` on it for the
485
+ loading state and no skeleton in its place: a player whose queue is empty draws its own loading
486
+ tile, at its final size. Hide it only when there is no video to play (no access, not found, an
487
+ error).
488
+ 4. **Let the width size it.** Full width in the screen's stack, no `height`. The default shape is
489
+ 16:9; set `aspectRatio` for another.
490
+ 5. **Show the heading from the first frame.** The row that opens the screen passes its `title` as a
491
+ navigation argument next to the `id`, and the worker shows it until its own arrives (§5, Loading
492
+ states).
493
+ 6. **In the worker, take a clip away by publishing an empty queue**, never by hiding the player. The
494
+ player stops and waits. Load once: a worker that loads at boot and again on the screen's first
495
+ appear makes the player load the clip twice.
496
+
497
+ To turn a feature off, say so on the component: `fullscreen: "disabled"`,
498
+ `pictureInPicture: "disabled"`, `externalPlayback: "disabled"`. To keep a full-screen video from
499
+ turning in a whole app, set `orientationEnvelope: { fullscreenMedia: [] }` in `config.ts`.
500
+
501
+ ### 4d. Background play and casting
502
+
503
+ Both are off until you turn them on, and both change what the app declares to the stores. Decide
504
+ them per app, before its first binary.
505
+
506
+ | The app plays | Component | Capability | `backgroundPlayback` |
507
+ |---|---|---|---|
508
+ | A clip in the page, and nothing once the screen is left | `Video` | `video_playback` | not set |
509
+ | A queue, lessons or chapters, in the app only | `MediaPlayer` | `media_playback` | not set, or `"disabled"` |
510
+ | Something people keep listening to: a podcast, music, radio, an audio lesson | `MediaPlayer` | `media_playback` | `"allowed"` |
511
+
512
+ **Background play** is playback that goes on after the person leaves the screen or the app, with
513
+ controls on the lock screen (iOS) and in a notification (Android).
514
+
515
+ 1. **Turn it on only for something people listen to.** A clip that is watched (a product video, a
516
+ welcome loop, a lesson video) stays off.
517
+ 2. **How:** `backgroundPlayback: "allowed"` on the `MediaPlayer`, and `media_playback` in the app's
518
+ `capabilities`. Not set, or `"disabled"`, the player stops when its screen is left.
519
+ 3. **Know what `media_playback` declares:** background audio on iOS and a media-playback foreground
520
+ service on Android. App Review may ask what plays in the background, and Play Console asks for a
521
+ foreground-service declaration. An app where nothing plays in the background should not declare
522
+ it: a clip in the page is a `Video` with `video_playback`, which declares neither. A
523
+ `MediaPlayer` needs `media_playback` whatever its `backgroundPlayback` says, and `himi validate`
524
+ reports one in an app without it.
525
+ 4. **Give every item a `title`, an `artist` and an `artworkUrl`.** The lock screen and the
526
+ notification show them.
527
+ 5. **Check access before the clip starts.** A worker takes a clip away by emptying its queue (§4c,
528
+ rule 6), and that works while a screen of the player is shown. Once the screen is left, what was
529
+ started goes on until the person stops it.
530
+ 6. **On Android, one at a time.** Players with background play share one player: the one that
531
+ loads last has it.
532
+ 7. **A podcast feed has a ready flow:** `podcastScreen` (`himi docs recipe-podcast`), with
533
+ background play included.
534
+
535
+ **Casting** sends what plays to a TV or a speaker.
536
+
537
+ 1. **iOS and the web need nothing.** AirPlay and Remote Playback come with the player, and its
538
+ controls show the button where there is a receiver.
539
+ 2. **Android (Google Cast) is an opt-in of the app's native build:** `"media": { "cast": true }` in
540
+ `distribution.json`, in an app that declares `media_playback` or `video_playback`. The build
541
+ refuses the opt-in without one of them. A `himi dist` build takes the opt-in from the shell it is
542
+ built with, and links Cast when the release declares one of those two capabilities.
543
+ 3. **Turn it on where people watch or listen long enough to want a TV or a speaker:** courses, a
544
+ video library, podcasts. Not for an app with one short clip. The opt-in links Google's Cast
545
+ library, which logs on its own, so the build adds a row to the app's Play data-safety draft: read
546
+ that draft before you submit.
547
+ 4. **A screen needs nothing.** The button appears in the player's controls when a receiver is on the
548
+ network. `externalPlayback: "disabled"` on a `MediaPlayer` removes it for that player, on every
549
+ platform.
550
+ 5. **A receiver plays what it can fetch by itself:** items with a direct address. Not a YouTube
551
+ item and not a live stream (a queue with either gets no cast button; mark a live item
552
+ `live: true`, or the button is there until the stream has loaded), and not an address that
553
+ only the phone can reach (a cookie, an address bound to the phone's network). Subtitles declared
554
+ on an item are not sent.
555
+ 6. **Casting does not need background play.** While a player casts, its `status`, its position and
556
+ `onProgress` follow the receiver, so a worker that saves progress keeps working.
557
+ 7. **Try it on a real phone, with a receiver on the same Wi-Fi, before you ship.** An emulator's
558
+ network does not see receivers, and Google Cast on Android has so far been tried against a
559
+ stand-in receiver only.
560
+
468
561
  ### 4b. Web-render layout caveats (the ones that cost the most iterations)
469
562
 
470
563
  These are the four that off-repo authors have hit repeatedly, each costing several
@@ -547,6 +640,29 @@ the user sees, and on a slow network it is the whole screen.
547
640
  - **Prefer a content-shaped `Skeleton`** when you know the loaded layout: the same sections, in
548
641
  the same order, at about the same sizes (`width`, `height`, `cornerRadius`, and `count` for
549
642
  repeated rows). It previews the layout, so nothing moves when the data arrives.
643
+ - **Nothing that is on both frames moves.** Compare the loading frame with the loaded one: every
644
+ element present in both sits in the same place. A screen that grows a block when the data lands
645
+ pushes everything under it, and the whole screen jumps. Three causes, all from one video screen
646
+ that showed a short skeleton and no title, then a title over a player of another height:
647
+ - *The title arrived with the data.* A heading bound to worker state with `collapseWhenEmpty`
648
+ is not there while the worker loads. A detail screen opened from a row already knows what the
649
+ row showed: pass it as navigation arguments (`title`, a cover) next to the `id`, and have the
650
+ worker show it in its loading state until its own value arrives.
651
+ - *A fixed-height skeleton stood in for a block sized by aspect ratio.* A player or a hero image
652
+ takes its height from the device's width, so no fixed height matches it. Keep the block's own
653
+ component on the screen while it loads, in its empty state (a `MediaPlayer` bound to
654
+ `itemsPath` draws its own loading tile, §4c; an `Image` with its `aspectRatio`). Do not
655
+ build a stand-in box from another component: on iOS the `aspectRatio` modifier did not size a
656
+ `VStack`, a `ZStack` or a `Skeleton`, and an `Image` with no `url` drew nothing, while Android
657
+ sized all four.
658
+ - *The block was hidden and shown again on every load.* A worker that returns to its loading
659
+ state on each load, with a `hiddenPath` on the block, takes the block away and puts it back:
660
+ the screen jumps twice, and a player is destroyed and built again mid-load. Empty the block's
661
+ data and keep the block on the screen.
662
+
663
+ `himi render` compares two still frames on the web renderer and does not show this. Record the
664
+ screen opening on iOS and on Android (the first open after launch, then a second visit) and step
665
+ through the frames.
550
666
  - **Use another existing loading component when it fits the behavior better.** `StatefulSection`
551
667
  suits a section that loads on its own; it can skip the skeleton for a load that settles quickly
552
668
  (`loadingGraceMs`) and holds a painted skeleton long enough not to flicker (`loadingFloorMs`).
@@ -838,6 +954,7 @@ Run this punch list on the screen (it's also a good reviewer checklist):
838
954
  - [ ] All four states designed — loading / empty / error / loaded (empty has a directive action; error has a recovery action when one exists)?
839
955
  - [ ] Errors classified (offline / server / sign-in / site membership / permission), each an `ErrorState` with user-facing copy — no raw error text? Empty results shown as empty, not as an error? A failed refresh keeps the content?
840
956
  - [ ] Loading state matches the loaded layout (a content-shaped `Skeleton` where the layout is known)? For a redesign, was the existing loading state reviewed against the new layout? A static screen has none?
957
+ - [ ] Nothing moves when the data lands — recorded on iOS and Android, first open and second visit? The heading is there while it loads (passed by the row), an aspect-sized block keeps its own component on screen, and no block is hidden and shown again across a reload?
841
958
  - [ ] Every value a token — zero literal hex / off-scale spacing / invented type sizes?
842
959
  - [ ] Is every user-facing string routed through a copy key with a sensible fallback (`copyOf(key, fallback)` backed by your own `COPY` map; worker strings via `onAppear` params) — none baked directly into the descriptor?
843
960
  - [ ] When a business book exists, do those fallbacks use the site's OWN words (`book.copy`) rather than stock phrases — and in `book.copy.language`?
@@ -614,6 +614,23 @@ Opt out with `modifiers.imagePreview: "off"` on an image or subtree that should
614
614
  `himi validate` warns on the first three (`paged_list_not_at_scroll_root`,
615
615
  `bound_rows_without_stable_id`, `declared_navigation_available`). Resolve them before preview.
616
616
 
617
+ ## Video, background play and casting
618
+
619
+ Read §4c and §4d of the `designing-himi-screens` guide (its installed skill, or `himi docs designing-himi-screens`) before a screen plays video or audio.
620
+
621
+ - The player is `MediaPlayer` (`Video` for one clip in the page). Its controls, full screen and
622
+ picture in picture are built in: add none of your own.
623
+ - Background play and casting are off until the app turns them on, and both change what the app
624
+ declares to the stores. Decide them before the first binary.
625
+ - Background play: `backgroundPlayback: "allowed"` on the `MediaPlayer`, only for something people
626
+ listen to (a podcast, music, radio), with `media_playback` in `capabilities`. That capability
627
+ declares background audio on iOS and a foreground service on Android. A clip that is only watched
628
+ in the page is a `Video` with `video_playback`, which declares neither.
629
+ - Casting: AirPlay (iOS) and Remote Playback (web) need nothing. Google Cast on Android is an opt-in
630
+ of the app's native build (`"media": { "cast": true }` in `distribution.json`), not a screen prop.
631
+ A receiver plays direct addresses it can fetch by itself: no YouTube items, no live streams
632
+ (mark a live item `live: true`).
633
+
617
634
  ## Native UX evidence gate
618
635
 
619
636
  Before declaring a multi-screen app ready, run `himi ux audit --content . --strict` and resolve its findings. After driving each available native shell, persist the actual checks with `himi ux record`; record an unavailable platform with its reason rather than claiming coverage.
@@ -73,7 +73,7 @@ Set `caption` on an `Image` to show one plain line under it in the viewer, for e
73
73
 
74
74
  Images support paging, pinch zoom, double-tap zoom, pan while zoomed, and dismissal. A multi-image gallery has a thumbnail strip for jumping between pages. Close, keyboard arrows/Escape on desktop, and accessibility paging remain available.
75
75
 
76
- An inline `Video` gets an expand control. Preview keeps its existing player, controls and playback position; video does not offer image zoom or image Save/Share. React Native's optional video adapter presents its own existing native player. The demo adapter supplies this through Expo AV's fullscreen API.
76
+ An inline `Video` goes full screen from its own controls (the player's Full screen button), with no expand control added over it. On iOS and Android full screen is this viewer, on the same player with its controls and playback position; on the web it is the browser's full screen. Video does not offer image zoom or image Save/Share. React Native's optional video adapter presents its own existing native player. The demo adapter supplies this through Expo AV's fullscreen API.
77
77
 
78
78
  ## Save and Share
79
79
 
package/guides/index.json CHANGED
@@ -27,6 +27,7 @@
27
27
  "A screen that loads data asynchronously ships a designed LOADING state with it — a `Skeleton` shaped like the loaded layout when that layout is known (`StatefulSection` or `ActivityIndicator` when they fit the behavior better) — and a REDESIGN of a data screen reviews and updates that loading state in the same change, so it never shows the old layout. Loading is its own state, never the empty or the error state; a static screen gets no loading state (`himi docs designing-himi-screens` §5).",
28
28
  "CLASSIFY every error before you show it: offline, server failure, sign-in, site membership and permission each show an `ErrorState` (gated by `hiddenPath`): `variantPath` bound to the worker's error kind switches the copy and glyph, but `cta`, `title`, `body` and `ctaLabel` apply to every variant, so offline and server share one node with the retry `cta` while sign-in, permission and membership (`variant: \"permission\"` with its own `title`/`body`) keep a node each; user-facing copy — never `e.message`, a status code or an API error string — and a `cta` ONLY for a real recovery (Try again for offline, server and failed writes; the app's auth flow for sign-in; the site's join flow for `NotSiteMember` when available; none for permission, empty results or field errors). Empty results are the empty state, not an error. A refresh that fails KEEPS the rows and adds a `Banner` with retry; a load-more that fails keeps the rows and ends the list with a \"Couldn't load more\" row that retries the SAME cursor (`himi docs recipe-dynamic-list`), never the Banner, which reloads page 1. A sign-in, membership or permission failure CLEARS the rows instead — they are no longer the user's to see. Field errors stay in the field's slot; a failed action shows next to the action. (`himi docs designing-himi-screens` §5, `himi docs recipe-four-state`).",
29
29
  "Images preview by default: a tap opens one full screen and pages through the screen's other images. Opt out with `modifiers.imagePreview: \"off\"` on an image or subtree that should not open (`himi docs image-preview`).",
30
+ "VIDEO and AUDIO use `MediaPlayer` (or `Video` for one clip in the page) and add no controls of their own (`himi docs designing-himi-screens`, §4c). BACKGROUND PLAY and CASTING are off until the app turns them on, and both change what the app declares to the stores (§4d): set `backgroundPlayback: \"allowed\"` only for something people listen to (a podcast, music, radio), with `media_playback` in `capabilities`, which declares background audio on iOS and a foreground service on Android; a clip that is only watched in the page is a `Video` with `video_playback`. Google Cast on Android is an opt-in of the app's native build (`\"media\": { \"cast\": true }` in `distribution.json`), not a screen prop; AirPlay on iOS and Remote Playback on the web need nothing.",
30
31
  "Workers are sandboxed: no DOM, no timers, no raw fetch. Produce state synchronously in actions; do not rely on an ambient refresh tick.",
31
32
  "Keep screens FAST (`himi docs designing-himi-screens`, §7b): put a long or paged list directly in the screen's root VStack, give every list item the worker returns a stable `id`, declare `nav` on an action whose tap always opens the same screen, keep horizontal rails short, and give row images a fixed size. Validation warns on the first three (`paged_list_not_at_scroll_root`, `bound_rows_without_stable_id`, `declared_navigation_available`).",
32
33
  "Declare every capability a worker uses in TWO places: the calling screen's logicBundle.declaredCapabilities (wix_platform, stream, camera, location, …) — undeclared calls are blocked — AND config.ts `capabilities`, the app-level list a binary is built with. The `capabilities` guide shows each id's import, what the binary needs and which shells serve it; validate flags an unknown id, an undeclared call, and (with `shell` in himalaya.content.json) an id that shell's binary does not serve. A capability with a native footprint (camera, location, push, …) only arrives with a new binary — an over-the-air push cannot add it. EXCEPTION: the Wix REST bridge (wix_api — the @himalaya/wix-* clients / wixApi.call) is ungated today (installed unconditionally), so it works WITHOUT a declaration; declaring wix_api is still recommended — it is where the platform is heading, and it documents what your worker touches.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1818.0",
3
+ "version": "0.1820.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "e411481c991b98895fe74498fef1ead055b65b32f008528c9770950e"
85
+ "falconPackageHash": "f86ef14b7e63993e482e8ad659f6dcdcab84bece25089e6e83108dbb"
86
86
  }
@@ -3459,7 +3459,8 @@ const SCREENS = runtimeSetting({
3459
3459
  "params": {
3460
3460
  "screenId": "himi_video",
3461
3461
  "id": "$item.id",
3462
- "channelId": "$item.channelId"
3462
+ "channelId": "$item.channelId",
3463
+ "title": "$item.title"
3463
3464
  }
3464
3465
  },
3465
3466
  "pressFeedback": "scale",
@@ -84433,7 +84434,8 @@ const SCREENS = runtimeSetting({
84433
84434
  "params": {
84434
84435
  "screenId": "himi_video",
84435
84436
  "id": "$item.id",
84436
- "channelId": "$item.channelId"
84437
+ "channelId": "$item.channelId",
84438
+ "title": "$item.title"
84437
84439
  }
84438
84440
  },
84439
84441
  "pressFeedback": "scale",
@@ -87009,7 +87011,8 @@ const SCREENS = runtimeSetting({
87009
87011
  "params": {
87010
87012
  "screenId": "himi_video",
87011
87013
  "id": "$item.id",
87012
- "channelId": "$item.channelId"
87014
+ "channelId": "$item.channelId",
87015
+ "title": "$item.title"
87013
87016
  }
87014
87017
  },
87015
87018
  "accessibilityLabel": "$item.title",
@@ -87256,26 +87259,6 @@ const SCREENS = runtimeSetting({
87256
87259
  }
87257
87260
  }
87258
87261
  },
87259
- {
87260
- "id": "himi_video.loading",
87261
- "body": {
87262
- "package": "himalaya",
87263
- "type": "Skeleton",
87264
- "props": {
87265
- "height": 180,
87266
- "cornerRadius": 8
87267
- }
87268
- },
87269
- "modifiers": {
87270
- "height": 180,
87271
- "background": {
87272
- "token": "surfaceSecondary"
87273
- },
87274
- "cornerRadius": 8,
87275
- "accessibilityRole": "decorative",
87276
- "hiddenPath": "$service:himiBrandedVideo.notLoading"
87277
- }
87278
- },
87279
87262
  {
87280
87263
  "id": "himi_video.player",
87281
87264
  "body": {
@@ -42,7 +42,7 @@ const initial: S = { ...LOADING, id: "", channelId: "", title: "", description:
42
42
  const SELLS_THROUGH_APPLE = videosAppleSalesEnabled();
43
43
  const commerce = createIapCommerce({ adapters: SELLS_THROUGH_APPLE ? [wixVideoOrders] : [], onChange: () => { void svc.publish(); } });
44
44
  const pricing = commerce.pricing;
45
- let shown: S = { ...initial };
45
+ let shown: S = opening();
46
46
  /** The item the detail prices: a locked video sold once. Rows carry their own. */
47
47
  let detailItem: IapCatalogItem | undefined;
48
48
  let rowItems: Array<IapCatalogItem | undefined> = [];
@@ -139,11 +139,15 @@ type Actions = {
139
139
  reset: (s: S) => S; publish: (s: S) => S; refreshPrice: (s: S) => Promise<undefined>; start: (s: S) => S; load: (s: S, arg?: unknown) => Promise<undefined>;
140
140
  buy: (s: S) => Promise<undefined>; iapPoll: (s: S) => Promise<undefined>;
141
141
  };
142
+ /** The loading state. Nothing on the screen moves when the video arrives: the title the row passed is shown from the
143
+ * start, and the player stays on the screen, empty (the item is taken away, so nothing plays while access is
144
+ * rechecked). Every state with no video to play hides the player. */
145
+ function opening(): S { return { ...initial, title: input("title"), hidePlayer: false }; }
142
146
  const svc = defineService<S, Actions>("himiBrandedVideo", {
143
- state: initial,
147
+ state: opening(),
144
148
  notHydrated: Object.keys(initial) as (keyof S & string)[],
145
149
  actions: {
146
- reset: () => { shown = { ...initial }; detailItem = undefined; rowItems = []; return { ...initial }; },
150
+ reset: () => { shown = opening(); detailItem = undefined; rowItems = []; return opening(); },
147
151
  publish: () => priced(shown),
148
152
  start: () => (SELLS_THROUGH_APPLE ? priced(shown) : { ...priced(shown), _poll: pricing.pollDirective("himiBrandedVideo.refreshPrice") } as S),
149
153
  refreshPrice: async () => { await priceContent(); return undefined; },
@@ -151,10 +155,30 @@ const svc = defineService<S, Actions>("himiBrandedVideo", {
151
155
  iapPoll: async () => { await commerce.poll(); void svc.publish(); return undefined; },
152
156
  load: async (_s, arg) => {
153
157
  stashCopy(arg);
158
+ const key = requestKey();
159
+ if (booting) { booting = false; const done = run(); boot = { key, done }; return done; }
160
+ const first = boot;
161
+ boot = undefined;
162
+ if (first?.key === key) {
163
+ await first.done;
164
+ if (shown.playbackState === "ready" && shown.items.length) { void svc.publish(); return undefined; }
165
+ }
166
+ return run();
167
+ },
168
+ },
169
+ });
170
+ // The worker loads at boot, before the screen's first appear asks for the same video. That appear takes the boot
171
+ // load's playable result instead of loading again: a second load revokes the item (the player leaves the screen),
172
+ // fetches a second signed address and publishes it, so the player loaded the clip twice within a second. Any later
173
+ // load, and a first appear that found nothing playable, rechecks access as before.
174
+ let booting = true;
175
+ let boot: { key: string; done: Promise<undefined> } | undefined;
176
+ function requestKey(): string { return [input("screenId"), input("id"), input("channelId")].join("\n"); }
177
+ async function run(): Promise<undefined> {
154
178
  const request = ++generation;
155
179
  // Revoke the previous item immediately while current access is rechecked.
156
180
  await svc.reset();
157
- let next: S = { ...initial, id: input("id"), channelId: input("channelId") };
181
+ let next: S = { ...opening(), id: input("id"), channelId: input("channelId") };
158
182
  let nextDetail: IapCatalogItem | undefined;
159
183
  let nextRows: Array<IapCatalogItem | undefined> = [];
160
184
  try {
@@ -217,9 +241,7 @@ const svc = defineService<S, Actions>("himiBrandedVideo", {
217
241
  void priceContent();
218
242
  void resumeCommerce();
219
243
  return undefined;
220
- },
221
- },
222
- });
244
+ }
223
245
  resetUnhydratedKeysOnOlderRuntime(svc, initial, Object.keys(initial) as (keyof S & string)[]);
224
246
  void svc.start();
225
247
  svc.load();
@@ -16575,7 +16575,8 @@ const SCREENS = runtimeSetting({
16575
16575
  "params": {
16576
16576
  "screenId": "himi_video",
16577
16577
  "id": "$item.id",
16578
- "channelId": "$item.channelId"
16578
+ "channelId": "$item.channelId",
16579
+ "title": "$item.title"
16579
16580
  }
16580
16581
  },
16581
16582
  "pressFeedback": "scale",
@@ -19139,7 +19140,8 @@ const SCREENS = runtimeSetting({
19139
19140
  "params": {
19140
19141
  "screenId": "himi_video",
19141
19142
  "id": "$item.id",
19142
- "channelId": "$item.channelId"
19143
+ "channelId": "$item.channelId",
19144
+ "title": "$item.title"
19143
19145
  }
19144
19146
  },
19145
19147
  "accessibilityLabel": "$item.title",
@@ -19483,26 +19485,6 @@ const SCREENS = runtimeSetting({
19483
19485
  }
19484
19486
  }
19485
19487
  },
19486
- {
19487
- "id": "himi_video.loading",
19488
- "body": {
19489
- "package": "himalaya",
19490
- "type": "Skeleton",
19491
- "props": {
19492
- "height": 180,
19493
- "cornerRadius": 8
19494
- }
19495
- },
19496
- "modifiers": {
19497
- "height": 180,
19498
- "background": {
19499
- "token": "surfaceSecondary"
19500
- },
19501
- "cornerRadius": 8,
19502
- "accessibilityRole": "decorative",
19503
- "hiddenPath": "$service:himiBrandedVideo.notLoading"
19504
- }
19505
- },
19506
19488
  {
19507
19489
  "id": "himi_video.player",
19508
19490
  "body": {
@@ -42,7 +42,7 @@ const initial: S = { ...LOADING, id: "", channelId: "", title: "", description:
42
42
  const SELLS_THROUGH_APPLE = videosAppleSalesEnabled();
43
43
  const commerce = createIapCommerce({ adapters: SELLS_THROUGH_APPLE ? [wixVideoOrders] : [], onChange: () => { void svc.publish(); } });
44
44
  const pricing = commerce.pricing;
45
- let shown: S = { ...initial };
45
+ let shown: S = opening();
46
46
  /** The item the detail prices: a locked video sold once. Rows carry their own. */
47
47
  let detailItem: IapCatalogItem | undefined;
48
48
  let rowItems: Array<IapCatalogItem | undefined> = [];
@@ -139,11 +139,15 @@ type Actions = {
139
139
  reset: (s: S) => S; publish: (s: S) => S; refreshPrice: (s: S) => Promise<undefined>; start: (s: S) => S; load: (s: S, arg?: unknown) => Promise<undefined>;
140
140
  buy: (s: S) => Promise<undefined>; iapPoll: (s: S) => Promise<undefined>;
141
141
  };
142
+ /** The loading state. Nothing on the screen moves when the video arrives: the title the row passed is shown from the
143
+ * start, and the player stays on the screen, empty (the item is taken away, so nothing plays while access is
144
+ * rechecked). Every state with no video to play hides the player. */
145
+ function opening(): S { return { ...initial, title: input("title"), hidePlayer: false }; }
142
146
  const svc = defineService<S, Actions>("himiBrandedVideo", {
143
- state: initial,
147
+ state: opening(),
144
148
  notHydrated: Object.keys(initial) as (keyof S & string)[],
145
149
  actions: {
146
- reset: () => { shown = { ...initial }; detailItem = undefined; rowItems = []; return { ...initial }; },
150
+ reset: () => { shown = opening(); detailItem = undefined; rowItems = []; return opening(); },
147
151
  publish: () => priced(shown),
148
152
  start: () => (SELLS_THROUGH_APPLE ? priced(shown) : { ...priced(shown), _poll: pricing.pollDirective("himiBrandedVideo.refreshPrice") } as S),
149
153
  refreshPrice: async () => { await priceContent(); return undefined; },
@@ -151,10 +155,30 @@ const svc = defineService<S, Actions>("himiBrandedVideo", {
151
155
  iapPoll: async () => { await commerce.poll(); void svc.publish(); return undefined; },
152
156
  load: async (_s, arg) => {
153
157
  stashCopy(arg);
158
+ const key = requestKey();
159
+ if (booting) { booting = false; const done = run(); boot = { key, done }; return done; }
160
+ const first = boot;
161
+ boot = undefined;
162
+ if (first?.key === key) {
163
+ await first.done;
164
+ if (shown.playbackState === "ready" && shown.items.length) { void svc.publish(); return undefined; }
165
+ }
166
+ return run();
167
+ },
168
+ },
169
+ });
170
+ // The worker loads at boot, before the screen's first appear asks for the same video. That appear takes the boot
171
+ // load's playable result instead of loading again: a second load revokes the item (the player leaves the screen),
172
+ // fetches a second signed address and publishes it, so the player loaded the clip twice within a second. Any later
173
+ // load, and a first appear that found nothing playable, rechecks access as before.
174
+ let booting = true;
175
+ let boot: { key: string; done: Promise<undefined> } | undefined;
176
+ function requestKey(): string { return [input("screenId"), input("id"), input("channelId")].join("\n"); }
177
+ async function run(): Promise<undefined> {
154
178
  const request = ++generation;
155
179
  // Revoke the previous item immediately while current access is rechecked.
156
180
  await svc.reset();
157
- let next: S = { ...initial, id: input("id"), channelId: input("channelId") };
181
+ let next: S = { ...opening(), id: input("id"), channelId: input("channelId") };
158
182
  let nextDetail: IapCatalogItem | undefined;
159
183
  let nextRows: Array<IapCatalogItem | undefined> = [];
160
184
  try {
@@ -217,9 +241,7 @@ const svc = defineService<S, Actions>("himiBrandedVideo", {
217
241
  void priceContent();
218
242
  void resumeCommerce();
219
243
  return undefined;
220
- },
221
- },
222
- });
244
+ }
223
245
  resetUnhydratedKeysOnOlderRuntime(svc, initial, Object.keys(initial) as (keyof S & string)[]);
224
246
  void svc.start();
225
247
  svc.load();