@wix/himalaya-cli 0.1771.0 → 0.1773.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/stdlib/flows/screens/src/one-app-page.d.ts +4 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +46 -8
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{7977d7340513225ef7609b9983b621e2b48c10deb7427e059e595d2fc66f7983.bin → 81b0921a25bdf01f44c9cc524e12b9ae379c49ec12d6238f114bc9f5e82faebf.bin} +1 -1
- package/dist/browser-plane/sw.js +6 -6
- package/dist/cli.mjs +112 -57
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/one-app-to-himi-app.md +7 -4
- package/package.json +2 -2
- package/stdlib/fonts/catalog.json +416 -0
|
@@ -7,6 +7,8 @@ export interface OneAppPage {
|
|
|
7
7
|
plainText: string;
|
|
8
8
|
empty: boolean;
|
|
9
9
|
normalizedWebsiteLinks: number;
|
|
10
|
+
/** What the document holds that the page leaves out, e.g. "video (2)": plugins the app cannot render yet. Empty when nothing is left out. */
|
|
11
|
+
gaps: string[];
|
|
10
12
|
}
|
|
11
13
|
export type OneAppPageContentError = Error & {
|
|
12
14
|
code: "invalid" | "unsupported";
|
|
@@ -15,7 +17,8 @@ export type OneAppPageContentError = Error & {
|
|
|
15
17
|
export declare function oneAppPageContentErrorCode(error: unknown): "invalid" | "unsupported" | undefined;
|
|
16
18
|
/** Validate a UUID source page selector before constructing a Pages read. */
|
|
17
19
|
export declare const isOneAppPageId: (value: unknown) => value is string;
|
|
18
|
-
/** Decode the exact Pages response; malformed, mismatched and unsupported documents throw.
|
|
20
|
+
/** Decode the exact Pages response; malformed, mismatched and unsupported documents throw. A legacy draft plugin the
|
|
21
|
+
* app cannot render does not: the page keeps the rest and lists the plugin in `gaps`.
|
|
19
22
|
* A real empty document succeeds with empty=true. Renderer media sizing and link sanitization
|
|
20
23
|
* use the existing bounded RichContent encoder on every format. */
|
|
21
24
|
export declare function decodeOneAppPage(response: unknown, expectedPageId: string): OneAppPage;
|
|
@@ -1599,7 +1599,20 @@ function normalizeWebsiteLinks(nodes) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
return changed;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function draftImageSrc(data) {
|
|
1603
|
+
const src = data.src ?? data.url;
|
|
1604
|
+
if (typeof src === "string") return src ? { url: src } : void 0;
|
|
1605
|
+
const media = object(src);
|
|
1606
|
+
if (typeof media.url === "string" && media.url) return { url: media.url };
|
|
1607
|
+
const id2 = media.id ?? media.file_name;
|
|
1608
|
+
return typeof id2 === "string" && id2 ? { id: id2 } : void 0;
|
|
1609
|
+
}
|
|
1610
|
+
var DRAFT_PLUGIN_LABELS = {
|
|
1611
|
+
"wix-draft-plugin-video": "video",
|
|
1612
|
+
"wix-draft-plugin-file-upload": "file download",
|
|
1613
|
+
"wix-draft-plugin-gallery": "gallery"
|
|
1614
|
+
};
|
|
1615
|
+
function draftDocument(value, skipped) {
|
|
1603
1616
|
const draft = object(value);
|
|
1604
1617
|
if (!Array.isArray(draft.blocks) || draft.blocks.length > 5e3) return invalid();
|
|
1605
1618
|
if (draft.entityMap !== void 0 && (!draft.entityMap || typeof draft.entityMap !== "object" || Array.isArray(draft.entityMap))) return invalid();
|
|
@@ -1621,10 +1634,22 @@ function draftDocument(value) {
|
|
|
1621
1634
|
if (ranges.length !== 1) return unsupported();
|
|
1622
1635
|
const entity = object(entities[String(object(ranges[0]).key)]);
|
|
1623
1636
|
const data = object(entity.data);
|
|
1624
|
-
if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image")
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1637
|
+
if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image") {
|
|
1638
|
+
const label = DRAFT_PLUGIN_LABELS[String(entity.type)] ?? `plugin ${String(entity.type)}`;
|
|
1639
|
+
skipped.set(label, (skipped.get(label) ?? 0) + 1);
|
|
1640
|
+
continue;
|
|
1641
|
+
}
|
|
1642
|
+
const src = draftImageSrc(data);
|
|
1643
|
+
if (!src) return invalid();
|
|
1644
|
+
const size = (key) => [data[key], object(data.src)[key]].find((v) => typeof v === "number");
|
|
1645
|
+
const [width, height] = [size("width"), size("height")];
|
|
1646
|
+
const alt = data.alt ?? object(data.metadata).alt;
|
|
1647
|
+
const link = object(object(data.config).link).url;
|
|
1648
|
+
nodes.push({ type: "IMAGE", imageData: {
|
|
1649
|
+
image: { src, ...width !== void 0 ? { width } : {}, ...height !== void 0 ? { height } : {} },
|
|
1650
|
+
...typeof alt === "string" ? { altText: alt } : {},
|
|
1651
|
+
...typeof link === "string" && link ? { link: { url: link } } : {}
|
|
1652
|
+
} });
|
|
1628
1653
|
continue;
|
|
1629
1654
|
}
|
|
1630
1655
|
const cuts = [.../* @__PURE__ */ new Set([0, text2.length, ...spans.flatMap((s2) => [Number(s2.offset), Number(s2.offset) + Number(s2.length)])])].sort((a, b) => a - b);
|
|
@@ -1651,6 +1676,8 @@ function draftDocument(value) {
|
|
|
1651
1676
|
const list = last?.type === type ? last : { type, nodes: [] };
|
|
1652
1677
|
if (last !== list) nodes.push(list);
|
|
1653
1678
|
list.nodes?.push({ type: "LIST_ITEM", nodes: [paragraph] });
|
|
1679
|
+
} else if (block2.type === "blockquote") {
|
|
1680
|
+
nodes.push({ type: "BLOCKQUOTE", nodes: [paragraph] });
|
|
1654
1681
|
} else if (/^header-(one|two|three|four|five|six)$/.test(String(block2.type))) {
|
|
1655
1682
|
nodes.push({ type: "HEADING", headingData: { level: ["one", "two", "three", "four", "five", "six"].indexOf(String(block2.type).slice(7)) + 1 }, nodes: runs });
|
|
1656
1683
|
} else if (block2.type === "unstyled" || block2.type === "paragraph" || block2.type === void 0) nodes.push(paragraph);
|
|
@@ -1664,6 +1691,7 @@ function decodeOneAppPage(response, expectedPageId) {
|
|
|
1664
1691
|
const raw = body.content;
|
|
1665
1692
|
if (richContentOverLimits(raw, null)) return invalid();
|
|
1666
1693
|
let document;
|
|
1694
|
+
const skipped = /* @__PURE__ */ new Map();
|
|
1667
1695
|
const contentType = body.contentType;
|
|
1668
1696
|
if (contentType === "PLAIN_TEXT") document = plainTextToRicos(raw);
|
|
1669
1697
|
else if (contentType === "RICH_CONTENT" || contentType === "DRAFTJS") {
|
|
@@ -1674,7 +1702,7 @@ function decodeOneAppPage(response, expectedPageId) {
|
|
|
1674
1702
|
return invalid();
|
|
1675
1703
|
}
|
|
1676
1704
|
if (richContentOverLimits(raw, parsed)) return invalid();
|
|
1677
|
-
if (contentType === "DRAFTJS") document = draftDocument(parsed);
|
|
1705
|
+
if (contentType === "DRAFTJS") document = draftDocument(parsed, skipped);
|
|
1678
1706
|
else {
|
|
1679
1707
|
if (!Array.isArray(object(parsed).nodes)) return invalid();
|
|
1680
1708
|
document = parsed;
|
|
@@ -1685,6 +1713,8 @@ function decodeOneAppPage(response, expectedPageId) {
|
|
|
1685
1713
|
return typeof n.type === "string" && n.type.length > 0 && (n.type !== "TEXT" || typeof object(n.textData).text === "string") && (n.nodes === void 0 || Array.isArray(n.nodes) && validNodes(n.nodes));
|
|
1686
1714
|
});
|
|
1687
1715
|
if (!validNodes(document.nodes)) return invalid();
|
|
1716
|
+
const authored = document.nodes.some((n) => n.type !== "PARAGRAPH" || (n.nodes ?? []).some((c) => c.type !== "TEXT" || !!c.textData?.text?.trim()));
|
|
1717
|
+
if (skipped.size && !authored) return unsupported();
|
|
1688
1718
|
const normalizedWebsiteLinks = normalizeWebsiteLinks(document.nodes);
|
|
1689
1719
|
let encoded;
|
|
1690
1720
|
try {
|
|
@@ -1694,9 +1724,17 @@ function decodeOneAppPage(response, expectedPageId) {
|
|
|
1694
1724
|
}
|
|
1695
1725
|
if (encoded.rejected) return invalid();
|
|
1696
1726
|
const plainText = ricosToPlainText(document);
|
|
1697
|
-
const authored = document.nodes.some((n) => n.type !== "PARAGRAPH" || (n.nodes ?? []).some((c) => c.type !== "TEXT" || !!c.textData?.text?.trim()));
|
|
1698
1727
|
if (!encoded.json && authored) return unsupported();
|
|
1699
|
-
return {
|
|
1728
|
+
return {
|
|
1729
|
+
pageId: expectedPageId,
|
|
1730
|
+
title: typeof content.title === "string" ? content.title : "",
|
|
1731
|
+
contentType,
|
|
1732
|
+
documentJson: encoded.json,
|
|
1733
|
+
plainText,
|
|
1734
|
+
empty: !authored,
|
|
1735
|
+
normalizedWebsiteLinks,
|
|
1736
|
+
gaps: [...skipped].map(([label, count]) => `${label} (${count})`)
|
|
1737
|
+
};
|
|
1700
1738
|
}
|
|
1701
1739
|
function oneAppPageSection(page2, options) {
|
|
1702
1740
|
if (!options.id) throw new Error("oneAppPageSection requires a stable placement id");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"files": [
|
|
3
3
|
{
|
|
4
4
|
"name": "sw.js",
|
|
5
|
-
"bytes":
|
|
5
|
+
"bytes": 2601532
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
"name": "host.html",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"bytes": 24320
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"name": "preview-deferred/
|
|
24
|
+
"name": "preview-deferred/81b0921a25bdf01f44c9cc524e12b9ae379c49ec12d6238f114bc9f5e82faebf.bin",
|
|
25
25
|
"bytes": 488215
|
|
26
26
|
},
|
|
27
27
|
{
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
],
|
|
80
80
|
"deferred": [
|
|
81
81
|
{
|
|
82
|
-
"key": "assets/pdf-
|
|
82
|
+
"key": "assets/pdf-wdJ1_6-Z.js",
|
|
83
83
|
"contentType": "application/javascript; charset=utf-8",
|
|
84
|
-
"sha256": "
|
|
85
|
-
"file": "preview-deferred/
|
|
84
|
+
"sha256": "81b0921a25bdf01f44c9cc524e12b9ae379c49ec12d6238f114bc9f5e82faebf",
|
|
85
|
+
"file": "preview-deferred/81b0921a25bdf01f44c9cc524e12b9ae379c49ec12d6238f114bc9f5e82faebf.bin"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"key": "assets/pdf.worker.min-BGnVRhRG.js",
|