@wix/himalaya-cli 0.1703.0 → 0.1704.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.
@@ -9,6 +9,8 @@ export declare function translate(node: unknown, tag: string): unknown;
9
9
  /** The same swap against a caller-supplied `source -> translation` map, for a build that applies an
10
10
  * app's OWN catalog rather than the repo-wide one `translate()` reads by tag. */
11
11
  export declare function translateWith(node: unknown, map: ReadonlyMap<string, string>): unknown;
12
+ /** The accessibility-copy half of {@link translateWith}, exported for a caller that walks copy itself. */
13
+ export declare function translateAccessibilityWith(node: unknown, map: ReadonlyMap<string, string>, atRoot?: boolean, inLogicBundle?: boolean): void;
12
14
  /** Test seam — drop the in-memory cache so reloading a catalog file in tests
13
15
  * takes effect on the next translate() call. */
14
16
  export declare function _resetCatalogCache(): void;
@@ -3789,7 +3789,10 @@ export interface ScreenDescriptor {
3789
3789
  screenId: string;
3790
3790
  renderer: RendererKind;
3791
3791
  title?: string;
3792
- /** Present when `renderer` is `sdui_intent` or `sdui_layout`. */
3792
+ /** Present when `renderer` is `sdui_intent` or `sdui_layout`. On a `webview_native_bridge` site screen it
3793
+ * may carry the screen's node form (RFC 0079 phase 3B): the root tree with the page as a `role: "primary"`
3794
+ * WebView, which a dual-form binary draws instead of the Tier-3 page and every older binary ignores
3795
+ * (`prefersPayloadNodeForm`, `dualFormSiteScreen`). */
3793
3796
  payload?: Component;
3794
3797
  /** A component pinned ABOVE the scrolling payload (sticky tab-header / toolbar).
3795
3798
  * Rendered by the host outside the screen scroll, so it stays put as content
@@ -0,0 +1,39 @@
1
+ type Rec = Record<string, unknown>;
2
+ /** The renderer of a Tier-3 WebView screen. */
3
+ export declare const DUAL_FORM_T3_RENDERER: "webview_native_bridge";
4
+ /** The renderer a binary draws a dual-form screen's node form with — what `desugarSiteScreen` gives
5
+ * the node form (`SITE_NODE_SCREEN_RENDERER` in `@himalaya/core/site-shell`). */
6
+ export declare const DUAL_FORM_NODE_RENDERER: "sdui_layout";
7
+ /**
8
+ * The screen's primary WebView node in `root` — the root itself, or a direct child of a root `VStack`,
9
+ * `HStack` or `ZStack` — or `null`. These are the placements every host gives up its scroller for
10
+ * (RFC 0079 §5.3: Android `PrimaryWebView.rootPrimary`, iOS `WebViewPrimaryRole.rootPrimary`, the web
11
+ * host's `screenHasPrimaryPage`). The first one wins; the validator rejects a second.
12
+ */
13
+ export declare function rootPrimaryWebView(root: unknown): Rec | null;
14
+ /**
15
+ * Whether two `capabilitiesRequired` scopes are the same native-bridge allowlist: both absent (the bridge
16
+ * falls back to the app's declared list either way), or the same SET of ids — the bridge reads the scope
17
+ * as a set (iOS `Set(scope)`, Android `toSet()`), so order and duplicates do not matter. An empty array is
18
+ * a scope of its own — no capability at all — and never equals an absent one.
19
+ */
20
+ export declare function sameCapabilityScope(a: unknown, b: unknown): boolean;
21
+ /**
22
+ * Whether a binary that ships the dual form draws this screen's NODE form: a Tier-3 screen
23
+ * (`renderer: "webview_native_bridge"`) with no `logicBundle` whose `payload` holds a `role: "primary"`
24
+ * WebView at its root ({@link rootPrimaryWebView}) scoped to the SAME native capabilities as the Tier-3
25
+ * page (`capabilitiesRequired`, {@link sameCapabilityScope}). The scope check is fail-safe: a node with no
26
+ * scope would get the app's whole declared list from the native bridge, where the Tier-3 page may have
27
+ * had none, so such a screen keeps its Tier-3 page instead. Anything else — no payload, a payload with no
28
+ * primary page, a worker-backed screen, a Tier-4 screen — keeps today's path too, so the preference
29
+ * degrades to nothing.
30
+ */
31
+ export declare function prefersPayloadNodeForm(descriptor: unknown): boolean;
32
+ /**
33
+ * The screen a dual-form binary renders: for a dual-form descriptor ({@link prefersPayloadNodeForm}), the
34
+ * same screen as an SDUI screen ({@link DUAL_FORM_NODE_RENDERER}) whose root is the payload, with the
35
+ * Tier-3 `url` and `webViewConfig` dropped (the primary node carries them). Any other descriptor comes
36
+ * back unchanged — the same object. Pure.
37
+ */
38
+ export declare function payloadNodeForm<T>(descriptor: T): T;
39
+ export {};
@@ -168,10 +168,14 @@ export interface SitePageNodeSpec {
168
168
  * primary node (RFC 0079 §9), so a fixed id is unique and stays a stable test id (invariant 27).
169
169
  * The node's WebView identity is the host screen's id (§5.1), never this. */
170
170
  export declare const SITE_PAGE_NODE_ID = "site_page_view";
171
- /** How {@link siteScreens} serves a site page: `"t3"` — a Tier-3 screen
172
- * (`renderer: "webview_native_bridge"`), what every shipped binary renders — or `"node"` — an SDUI
173
- * screen whose root is the primary WebView node (RFC 0079 §8), for a binary that ships RFC 0079 §5. */
174
- export type SiteScreenForm = "t3" | "node";
171
+ /** How {@link siteScreens} serves a site page:
172
+ * - `"both"` (the default) — the Tier-3 screen with its node form in `payload`
173
+ * ({@link dualFormSiteScreen}): every shipped binary renders the Tier-3 page and ignores `payload`;
174
+ * a binary that ships the dual form renders the node form (RFC 0079 §8, phase 3B);
175
+ * - `"t3"` — a Tier-3 screen only (`renderer: "webview_native_bridge"`);
176
+ * - `"node"` — an SDUI screen whose root is the primary WebView node, for a binary that ships RFC 0079
177
+ * §5. An older binary draws it as a plain embedded widget, so serve it only behind a binary floor. */
178
+ export type SiteScreenForm = "t3" | "node" | "both";
175
179
  export declare const SITE_SCREEN_FORMS: readonly SiteScreenForm[];
176
180
  /** The renderer a node-form site screen carries: an SDUI screen with a payload and no logic bundle.
177
181
  * `sdui_layout`, not `sdui_intent`: the payload is an exact layout (the page, and any native header
@@ -181,8 +185,9 @@ export declare const SITE_NODE_SCREEN_RENDERER: "sdui_layout";
181
185
  /**
182
186
  * One page of the site as an SDUI node — the `WebView` a screen puts its website in, with native UI
183
187
  * above, below or over it (RFC 0079 §3). The page URL is {@link sitePageUrl}`(site.origin, page.path)`
184
- * and the config is {@link siteWebViewPreset}`(site)` with `page.webView` merged over it — exactly
185
- * what {@link defineSiteTab} gives a Tier-3 tab, so a page moves between the two shapes unchanged.
188
+ * and the config is {@link siteWebViewPreset}`(site)` with `page.webView` merged over it, scoped to no
189
+ * native capability (`capabilitiesRequired: []`) — exactly what {@link defineSiteTab} gives a Tier-3
190
+ * tab, so a page moves between the two shapes unchanged.
186
191
  *
187
192
  * Put it at the screen root, or as a direct child of a root `VStack` (header / page / footer),
188
193
  * `HStack` or `ZStack`. Never inside a `LazyList`, `Pager`, `Carousel` or `CollapsingHeader`, and
@@ -202,21 +207,38 @@ export declare function isDesugarableSiteScreen(descriptor: ScreenDescriptor): b
202
207
  * The T3 → node desugar (RFC 0079 §3, §8). A desugarable Tier-3 site screen
203
208
  * ({@link isDesugarableSiteScreen}) comes back as an SDUI screen ({@link SITE_NODE_SCREEN_RENDERER})
204
209
  * whose `payload` is the primary WebView node: the screen's `url` and `webViewConfig` verbatim, with
205
- * `role: "primary"`, `fill` and scrolling on, and the screen's `title` (else the page's host) as the
206
- * node's accessible name. Every other screen field (id, title, cache control, top bar, …) is kept;
207
- * `url` and `webViewConfig` move into the node. Any other descriptor comes back unchanged — the same
208
- * object. Pure: the input is never mutated.
210
+ * `role: "primary"`, `fill` and scrolling on, the screen's `capabilitiesRequired` as the node's native
211
+ * capability scope, and the screen's `title` (else the page's host) as the node's accessible name. Every other screen field (id, title, cache control, top bar, …) is kept;
212
+ * `url` and `webViewConfig` move into the node. A dual-form screen ({@link dualFormSiteScreen}) desugars
213
+ * to the node form it carries — exactly what a dual-form binary renders. Any other descriptor comes back
214
+ * unchanged — the same object. Pure: the input is never mutated.
209
215
  */
210
216
  export declare function desugarSiteScreen(descriptor: ScreenDescriptor): ScreenDescriptor;
217
+ /**
218
+ * RFC 0079 phase 3B — one site screen carrying BOTH forms: the Tier-3 descriptor unchanged
219
+ * (`renderer: "webview_native_bridge"`, `url`, `webViewConfig` — what every shipped binary renders) plus
220
+ * its node form in `payload`, which a binary that ships the dual form renders instead. The serve plane
221
+ * cannot pick a form per binary (a screen read reports no binary, and a release stores one immutable body
222
+ * per screen), so the one body carries both: one hash, one ETag, one seed.
223
+ *
224
+ * `payload` defaults to the desugared primary node ({@link desugarSiteScreen}). Pass a tree of your own to
225
+ * put native UI around the page — a header / {@link sitePageNode} / footer column — whose primary
226
+ * WebView must load the same `url` with the same config and the same native capability scope
227
+ * (`capabilitiesRequired`; {@link sitePageNode} gives `[]`, as {@link defineSiteTab} does) — throws
228
+ * otherwise (the validator's `dual_form_mismatch`). A screen that does not desugar ({@link isDesugarableSiteScreen}: a
229
+ * `logicBundle`, which old binaries route to the worker-backed WebView screen, or
230
+ * `internalLinksAsScreens`) comes back unchanged — or throws when a `payload` was passed. Pure.
231
+ */
232
+ export declare function dualFormSiteScreen(descriptor: ScreenDescriptor, payload?: Component): ScreenDescriptor;
211
233
  /** Options for {@link siteScreens}. */
212
234
  export interface SiteScreensOptions extends SiteShellCheckOptions {
213
- /** Absent ⇒ `"t3"`. See {@link SiteScreenForm}. */
235
+ /** Absent ⇒ `"both"`. See {@link SiteScreenForm}. */
214
236
  form?: SiteScreenForm;
215
237
  }
216
- /** Every site page's descriptor plus the {@link SITE_PAGE_SCREEN_ID} fallback, keyed by
217
- * screen id. `form: "node"` serves each one through {@link desugarSiteScreen}: the same pages, as
218
- * SDUI screens whose root is the primary WebView node (RFC 0079 §8). The fallback keeps
219
- * `keepAlive: false` in both forms. */
238
+ /** Every site page's descriptor plus the {@link SITE_PAGE_SCREEN_ID} fallback, keyed by screen id. By
239
+ * default each one carries both forms ({@link dualFormSiteScreen}); `form: "node"` serves only the node
240
+ * form ({@link desugarSiteScreen}), `form: "t3"` only the Tier-3 one (RFC 0079 §8). The fallback keeps
241
+ * `keepAlive: false` in every form. */
220
242
  export declare function siteScreens(site: SiteShellConfig, opts?: SiteScreensOptions): Record<string, ScreenDescriptor>;
221
243
  /** `NavigationConfig.site` for a site shell (RFC 0062 site routing): the site's origins, one
222
244
  * route per page, and {@link SITE_PAGE_SCREEN_ID} as the fallback. Feed it to
@@ -235,6 +235,17 @@ export declare const screenDescriptorSchema: {
235
235
  };
236
236
  readonly then: {
237
237
  readonly required: readonly ["url"];
238
+ };
239
+ }, {
240
+ readonly if: {
241
+ readonly properties: {
242
+ readonly renderer: {
243
+ readonly const: "webview_ds";
244
+ };
245
+ };
246
+ readonly required: readonly ["renderer"];
247
+ };
248
+ readonly then: {
238
249
  readonly not: {
239
250
  readonly required: readonly ["payload"];
240
251
  };
@@ -3,7 +3,7 @@ export declare const MAX_SIMULTANEOUS_BRIDGED_WEBVIEWS = 4;
3
3
  export interface WebViewEmbeddedFinding {
4
4
  severity: "error" | "warning";
5
5
  /** Stable id of the §4.6 rule, for tests and tooling; never match on `message`. */
6
- rule: "bridge_requires_worker" | "template_instance_id" | "duplicate_instance_id" | "instance_id_reused_across_screens" | "storage_seed_requires_per_instance" | "per_instance_with_url" | "fill_with_height" | "too_many_bridged" | "bridged_url_not_allowed" | "unknown_enum_value" | "multiple_primary_webviews" | "primary_in_scroll_container" | "primary_in_template" | "primary_without_weight" | "fill_in_vertical_scroll" | "internal_links_as_screens_on_node" | "bridged_site_without_primary";
6
+ rule: "bridge_requires_worker" | "template_instance_id" | "duplicate_instance_id" | "instance_id_reused_across_screens" | "storage_seed_requires_per_instance" | "per_instance_with_url" | "fill_with_height" | "too_many_bridged" | "bridged_url_not_allowed" | "unknown_enum_value" | "multiple_primary_webviews" | "primary_in_scroll_container" | "primary_in_template" | "primary_without_weight" | "fill_in_vertical_scroll" | "internal_links_as_screens_on_node" | "bridged_site_without_primary" | "dual_form_without_primary" | "dual_form_mismatch" | "dual_form_logic_bundle";
7
7
  path: string;
8
8
  message: string;
9
9
  }
@@ -50,6 +50,7 @@ export declare function canonicalScreenArgs(args: Readonly<Record<string, unknow
50
50
  * default because one screen can be mounted twice with different args (RFC 0010).
51
51
  */
52
52
  export declare function effectiveWebViewInstanceId(screenId: string, args: Readonly<Record<string, unknown>> | undefined, componentId: string, explicitInstanceId?: string): string;
53
+ export { DUAL_FORM_NODE_RENDERER, DUAL_FORM_T3_RENDERER, payloadNodeForm, prefersPayloadNodeForm, rootPrimaryWebView, sameCapabilityScope } from "./site-screen-form.js";
53
54
  /**
54
55
  * The single-screen §4.6 rules over one screen descriptor. The cross-screen rule (an explicit
55
56
  * `per_instance` literal reused for different content) needs every screen, so it is