@wix/himalaya-cli 0.1688.0 → 0.1690.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.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/webview-embedded.d.ts +4 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +94 -8
- package/dist/cli.mjs +1608 -1378
- package/guides/branded-lite-site-binding.md +34 -2
- package/guides/component-reference.json +31 -18
- package/guides/component-reference.md +10 -2
- package/package.json +2 -2
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts
CHANGED
|
@@ -3721,6 +3721,10 @@ export interface WebViewProps {
|
|
|
3721
3721
|
fill?: boolean;
|
|
3722
3722
|
/** `$service:` number — live height in points/dp; beats `height`. */
|
|
3723
3723
|
heightPath?: string;
|
|
3724
|
+
/** `""` (default, an embedded widget — today's behaviour) | `"primary"` — the screen's one site page,
|
|
3725
|
+
* which takes the screen's identity and duties (RFC 0079 §5). At most one per screen; it fills and
|
|
3726
|
+
* owns its scrolling, so it never sits inside a LazyList, Pager or Carousel. */
|
|
3727
|
+
role?: "" | "primary";
|
|
3724
3728
|
}
|
|
3725
3729
|
/** RFC 0069 — `ScreenDescriptor.transcriptScroll`. */
|
|
3726
3730
|
export interface TranscriptScroll {
|
|
@@ -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";
|
|
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";
|
|
7
7
|
path: string;
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
@@ -14,12 +14,14 @@ export interface WebViewEmbeddedAppFinding extends WebViewEmbeddedFinding {
|
|
|
14
14
|
}
|
|
15
15
|
/** The wire values of the RFC 0073 string enums — what `WebViewBridge`, `WebOriginIsolation`,
|
|
16
16
|
* `WebFramePolicy` and `BridgeSecurityProfile` decode on iOS and Android. Anything else decodes
|
|
17
|
-
* leniently to the zero value, so `bridge: "Worker"` would silently mean no bridge.
|
|
17
|
+
* leniently to the zero value, so `bridge: "Worker"` would silently mean no bridge. RFC 0079's
|
|
18
|
+
* `role` follows the same rule: any value but `"primary"` is an embedded widget. */
|
|
18
19
|
export declare const WEBVIEW_EMBEDDED_ENUMS: {
|
|
19
20
|
readonly bridge: readonly ["", "worker"];
|
|
20
21
|
readonly originIsolation: readonly ["", "shared", "per_instance"];
|
|
21
22
|
readonly framePolicy: readonly ["", "content"];
|
|
22
23
|
readonly profile: readonly ["", "app_content"];
|
|
24
|
+
readonly role: readonly ["", "primary"];
|
|
23
25
|
};
|
|
24
26
|
/**
|
|
25
27
|
* `value` as canonical JSON, so two args that are equal as data produce one instance id — and two
|
|
@@ -14930,7 +14930,8 @@ var WEBVIEW_EMBEDDED_ENUMS = {
|
|
|
14930
14930
|
bridge: ["", "worker"],
|
|
14931
14931
|
originIsolation: ["", "shared", "per_instance"],
|
|
14932
14932
|
framePolicy: ["", "content"],
|
|
14933
|
-
profile: ["", "app_content"]
|
|
14933
|
+
profile: ["", "app_content"],
|
|
14934
|
+
role: ["", "primary"]
|
|
14934
14935
|
};
|
|
14935
14936
|
var isRec = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
14936
14937
|
var byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
@@ -14976,6 +14977,8 @@ function effectiveWebViewInstanceId(screenId, args, componentId, explicitInstanc
|
|
|
14976
14977
|
if (typeof explicitInstanceId === "string" && explicitInstanceId !== "") return explicitInstanceId;
|
|
14977
14978
|
return `${screenId}?${canonicalScreenArgs(args)}/${componentId}`;
|
|
14978
14979
|
}
|
|
14980
|
+
var PRIMARY_FORBIDDEN_ANCESTORS = /* @__PURE__ */ new Set(["LazyList", "Pager", "Carousel", "CollapsingHeader"]);
|
|
14981
|
+
var verticallyScrolls = (type, props) => type === "LazyList" && props.horizontal !== true || type === "CollapsingHeader";
|
|
14979
14982
|
var isComponent = (v) => isRec(v) && isRec(v.body) && typeof v.body.package === "string" && typeof v.body.type === "string";
|
|
14980
14983
|
var typeOf = (c) => {
|
|
14981
14984
|
const body = c.body;
|
|
@@ -15021,17 +15024,35 @@ function roots(descriptor) {
|
|
|
15021
15024
|
}
|
|
15022
15025
|
function collectWebViews(descriptor) {
|
|
15023
15026
|
const sites = [];
|
|
15024
|
-
const visit = (c, path, inTemplate) => {
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
+
const visit = (c, path, inTemplate, at) => {
|
|
15028
|
+
const type = typeOf(c);
|
|
15029
|
+
if (type === "WebView") {
|
|
15030
|
+
sites.push({
|
|
15031
|
+
path,
|
|
15032
|
+
id: typeof c.id === "string" ? c.id : "",
|
|
15033
|
+
props: propsOf(c),
|
|
15034
|
+
modifiers: isRec(c.modifiers) ? c.modifiers : {},
|
|
15035
|
+
inTemplate,
|
|
15036
|
+
...at
|
|
15037
|
+
});
|
|
15027
15038
|
}
|
|
15028
|
-
|
|
15039
|
+
const props = propsOf(c);
|
|
15040
|
+
const below = {
|
|
15041
|
+
parentType: type,
|
|
15042
|
+
scrollAncestor: type !== null && PRIMARY_FORBIDDEN_ANCESTORS.has(type) ? type === "LazyList" ? props.horizontal === true ? "a horizontal LazyList" : "a vertical LazyList" : `a ${type}` : at.scrollAncestor,
|
|
15043
|
+
inVerticalScroll: at.inVerticalScroll || verticallyScrolls(type, props)
|
|
15044
|
+
};
|
|
15045
|
+
for (const child of childrenOf(c, path, inTemplate)) visit(child.c, child.path, child.inTemplate, below);
|
|
15029
15046
|
};
|
|
15030
|
-
for (const r of roots(descriptor)) visit(r.c, r.path, false);
|
|
15047
|
+
for (const r of roots(descriptor)) visit(r.c, r.path, false, { parentType: null, scrollAncestor: null, inVerticalScroll: false });
|
|
15031
15048
|
return sites;
|
|
15032
15049
|
}
|
|
15033
15050
|
var isBridged = (props) => props.bridge === "worker";
|
|
15051
|
+
var isPrimary = (props) => props.role === "primary";
|
|
15034
15052
|
var configOf = (props) => isRec(props.config) ? props.config : {};
|
|
15053
|
+
var hasWeight = (modifiers) => typeof modifiers.weight === "number" && Number.isFinite(modifiers.weight) && modifiers.weight > 0;
|
|
15054
|
+
var SITE_CONFIG_FIELDS = ["hostedSiteAdapter", "sessionBridge", "hideHostedSiteHeader", "hideHostedSiteFooter", "hideHostedSiteMenu", "hideWixAds"];
|
|
15055
|
+
var siteConfigFields = (config) => SITE_CONFIG_FIELDS.filter((k) => config[k] === true || typeof config[k] === "string" && config[k] !== "");
|
|
15035
15056
|
var isPerInstance = (props) => configOf(props).originIsolation === "per_instance";
|
|
15036
15057
|
var isLiteral = (v) => typeof v === "string" && v !== "" && !v.startsWith("$");
|
|
15037
15058
|
var isItemDerived = (v) => typeof v === "string" && /\$item\.[A-Za-z0-9_]/.test(v);
|
|
@@ -15072,6 +15093,51 @@ function mountable(c, inTemplate = false) {
|
|
|
15072
15093
|
for (const child of childrenOf(c, "", inTemplate)) total += mountable(child.c, child.inTemplate);
|
|
15073
15094
|
return total;
|
|
15074
15095
|
}
|
|
15096
|
+
function primaryRules(s, config, out) {
|
|
15097
|
+
const { props, path } = s;
|
|
15098
|
+
const primary = isPrimary(props);
|
|
15099
|
+
if (primary && s.scrollAncestor !== null) {
|
|
15100
|
+
out.push({
|
|
15101
|
+
severity: "error",
|
|
15102
|
+
rule: "primary_in_scroll_container",
|
|
15103
|
+
path: `${path}.body.props.role`,
|
|
15104
|
+
message: `WebView "${s.id}" is the screen's primary WebView inside ${s.scrollAncestor} \u2014 a site page fills the space it is given and owns its own scrolling, so it cannot sit in a scrolling or paged container; put it at the screen root or in a VStack with modifiers.weight (RFC 0079 \xA75.3, \xA79)`
|
|
15105
|
+
});
|
|
15106
|
+
}
|
|
15107
|
+
if (primary && s.parentType === "VStack" && !hasWeight(s.modifiers)) {
|
|
15108
|
+
out.push({
|
|
15109
|
+
severity: "error",
|
|
15110
|
+
rule: "primary_without_weight",
|
|
15111
|
+
path: `${path}.modifiers.weight`,
|
|
15112
|
+
message: `WebView "${s.id}" is the screen's primary WebView in a VStack without modifiers.weight \u2014 fill alone takes the whole column and pushes its native siblings out on Android; give it weight: 1 so it takes only the height they leave (RFC 0079 \xA75.3, \xA79)`
|
|
15113
|
+
});
|
|
15114
|
+
}
|
|
15115
|
+
if (!primary && props.fill === true && s.inVerticalScroll) {
|
|
15116
|
+
out.push({
|
|
15117
|
+
severity: "warning",
|
|
15118
|
+
rule: "fill_in_vertical_scroll",
|
|
15119
|
+
path: `${path}.body.props.fill`,
|
|
15120
|
+
message: `WebView "${s.id}" sets fill inside a vertical LazyList \u2014 a scrolling list proposes no height, so the WebView has none to fill; give it a height, aspectRatio or heightPath instead (RFC 0079 \xA79)`
|
|
15121
|
+
});
|
|
15122
|
+
}
|
|
15123
|
+
if (config.internalLinksAsScreens === true) {
|
|
15124
|
+
out.push({
|
|
15125
|
+
severity: "error",
|
|
15126
|
+
rule: "internal_links_as_screens_on_node",
|
|
15127
|
+
path: `${path}.body.props.config.internalLinksAsScreens`,
|
|
15128
|
+
message: `WebView "${s.id}" sets config.internalLinksAsScreens \u2014 only a Tier-3 WebView screen pushes in-site links as screens; on an embedded WebView nothing is pushed and iOS cancels every in-site link after the first load. Remove it (RFC 0079 \xA78, \xA79)`
|
|
15129
|
+
});
|
|
15130
|
+
}
|
|
15131
|
+
const siteFields = siteConfigFields(config);
|
|
15132
|
+
if (isBridged(props) && !primary && siteFields.length > 0) {
|
|
15133
|
+
out.push({
|
|
15134
|
+
severity: "warning",
|
|
15135
|
+
rule: "bridged_site_without_primary",
|
|
15136
|
+
path: `${path}.body.props.bridge`,
|
|
15137
|
+
message: `WebView "${s.id}" sets bridge: "worker" with a site config (${siteFields.join(", ")}) but no role: "primary" \u2014 a bridged WebView that is not the screen's site page gets the strict bridge profile, which drops the site behaviours those fields ask for (RFC 0079 \xA77, \xA79)`
|
|
15138
|
+
});
|
|
15139
|
+
}
|
|
15140
|
+
}
|
|
15075
15141
|
function webViewEmbeddedFindings(descriptor) {
|
|
15076
15142
|
if (!isRec(descriptor)) return [];
|
|
15077
15143
|
const out = [];
|
|
@@ -15099,7 +15165,8 @@ function webViewEmbeddedFindings(descriptor) {
|
|
|
15099
15165
|
["bridge", props.bridge, "bridge"],
|
|
15100
15166
|
["originIsolation", config.originIsolation, "config.originIsolation"],
|
|
15101
15167
|
["framePolicy", config.framePolicy, "config.framePolicy"],
|
|
15102
|
-
["profile", security.profile, "config.bridgeSecurity.profile"]
|
|
15168
|
+
["profile", security.profile, "config.bridgeSecurity.profile"],
|
|
15169
|
+
["role", props.role, "role"]
|
|
15103
15170
|
]) {
|
|
15104
15171
|
const allowed = WEBVIEW_EMBEDDED_ENUMS[field];
|
|
15105
15172
|
if (value === void 0 || typeof value === "string" && allowed.includes(value)) continue;
|
|
@@ -15107,7 +15174,7 @@ function webViewEmbeddedFindings(descriptor) {
|
|
|
15107
15174
|
severity: "error",
|
|
15108
15175
|
rule: "unknown_enum_value",
|
|
15109
15176
|
path: `${path}.body.props.${prop}`,
|
|
15110
|
-
message: `WebView "${s.id}" sets ${prop}: ${JSON.stringify(value)} \u2014 not one of ${allowed.map((v) => JSON.stringify(v)).join(" | ")}; the hosts read an unknown value as ${JSON.stringify(allowed[0])} (RFC 0073 \xA74)`
|
|
15177
|
+
message: `WebView "${s.id}" sets ${prop}: ${JSON.stringify(value)} \u2014 not one of ${allowed.map((v) => JSON.stringify(v)).join(" | ")}; the hosts read an unknown value as ${JSON.stringify(allowed[0])} (${field === "role" ? "RFC 0079 \xA74" : "RFC 0073 \xA74"})`
|
|
15111
15178
|
});
|
|
15112
15179
|
}
|
|
15113
15180
|
if (bridged && (!lb || !caps.includes("webview"))) {
|
|
@@ -15167,6 +15234,7 @@ function webViewEmbeddedFindings(descriptor) {
|
|
|
15167
15234
|
message: `WebView "${s.id}" sets fill together with height / aspectRatio / heightPath \u2014 fill wins and the others are ignored (RFC 0073 \xA74)`
|
|
15168
15235
|
});
|
|
15169
15236
|
}
|
|
15237
|
+
primaryRules(s, config, out);
|
|
15170
15238
|
if (bridged && isLiteral(props.url)) {
|
|
15171
15239
|
const allowed = Array.isArray(config.allowedOrigins) ? config.allowedOrigins.filter((o) => typeof o === "string") : [];
|
|
15172
15240
|
if (allowed.length > 0 && !webViewOriginAllowed(props.url, allowed)) {
|
|
@@ -15179,6 +15247,24 @@ function webViewEmbeddedFindings(descriptor) {
|
|
|
15179
15247
|
}
|
|
15180
15248
|
}
|
|
15181
15249
|
}
|
|
15250
|
+
for (const s of sites) {
|
|
15251
|
+
if (!isPrimary(s.props) || !s.inTemplate) continue;
|
|
15252
|
+
out.push({
|
|
15253
|
+
severity: "error",
|
|
15254
|
+
rule: "primary_in_template",
|
|
15255
|
+
path: `${s.path}.body.props.role`,
|
|
15256
|
+
message: `WebView "${s.id}" sets role: "primary" inside a repeated item template, so every item would mount its own primary WebView \u2014 a screen has exactly one site page (RFC 0079 \xA75, \xA79). Move it out of the template or drop the role`
|
|
15257
|
+
});
|
|
15258
|
+
}
|
|
15259
|
+
const primaries = sites.filter((s) => isPrimary(s.props) && !s.inTemplate);
|
|
15260
|
+
for (const extra of primaries.slice(1)) {
|
|
15261
|
+
out.push({
|
|
15262
|
+
severity: "error",
|
|
15263
|
+
rule: "multiple_primary_webviews",
|
|
15264
|
+
path: `${extra.path}.body.props.role`,
|
|
15265
|
+
message: `WebView "${extra.id}" sets role: "primary", but ${primaries[0].path} already is this screen's primary WebView \u2014 a screen has one site page, which takes the screen's identity, back history and deep links (RFC 0079 \xA75, \xA79)`
|
|
15266
|
+
});
|
|
15267
|
+
}
|
|
15182
15268
|
let total = 0;
|
|
15183
15269
|
let crossedAt = "";
|
|
15184
15270
|
for (const r of roots(descriptor)) {
|