@aglyn/plugins-ai 1.7.0 → 1.9.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/package.json +17 -17
- package/src/lib/activity/ai-activity.js +4 -2
- package/src/lib/activity/ai-activity.js.map +1 -1
- package/src/lib/components/ai-credits-card.component.d.ts +4 -3
- package/src/lib/components/ai-credits-card.component.js +13 -12
- package/src/lib/components/ai-credits-card.component.js.map +1 -1
- package/src/lib/components/ai-site-import-job.component.js +14 -5
- package/src/lib/components/ai-site-import-job.component.js.map +1 -1
- package/src/lib/components/ai-upsell-dialog.component.d.ts +2 -2
- package/src/lib/components/ai-upsell-dialog.component.js +3 -3
- package/src/lib/components/ai-upsell-dialog.component.js.map +1 -1
- package/src/lib/components/staff-org-ai-card.component.js +2 -2
- package/src/lib/components/staff-org-ai-card.component.js.map +1 -1
- package/src/lib/declarations.d.ts +2 -2
- package/src/lib/declarations.js +10 -9
- package/src/lib/declarations.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +28 -2
- package/src/lib/jobs/ai-job-import-step.js +170 -14
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.js +2 -0
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.js +6 -2
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +13 -3
- package/src/lib/jobs/ai-site-import-compile.js +339 -27
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +3 -1
- package/src/lib/jobs/ai-site-import-document.js +42 -1
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-look.d.ts +9 -0
- package/src/lib/jobs/ai-site-import-look.js +89 -6
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +16 -0
- package/src/lib/layout-language/ai-layout-compiler.js +378 -56
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-source.d.ts +88 -2
- package/src/lib/layout-language/ai-layout-frame-source.js +591 -30
- package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.js +30 -18
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +74 -3
- package/src/lib/layout-language/ai-layout-language.js +5 -3
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/layout-language/ai-layout-store.d.ts +8 -0
- package/src/lib/layout-language/ai-layout-store.js +32 -6
- package/src/lib/layout-language/ai-layout-store.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +31 -1
- package/src/lib/model/ai-site-import-fidelity.js +347 -25
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-view.js +4 -3
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +205 -6
- package/src/lib/model/ai-site-import.js +161 -5
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +8 -1
- package/src/lib/model/ai-site-look.js +8 -5
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/model/ai-upsell-copy.js +4 -3
- package/src/lib/model/ai-upsell-copy.js.map +1 -1
- package/src/lib/plan-entitlements.d.ts +3 -3
- package/src/lib/plan-entitlements.js +1 -1
- package/src/lib/plan-entitlements.js.map +1 -1
- package/src/lib/providers/model-choice.d.ts +6 -3
- package/src/lib/providers/model-choice.js +8 -4
- package/src/lib/providers/model-choice.js.map +1 -1
- package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -1
- package/src/lib/runtime/ai-doctrine-validators.js +25 -2
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.js +19 -2
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/ai-page-links.d.ts +15 -0
- package/src/lib/runtime/ai-page-links.js +48 -0
- package/src/lib/runtime/ai-page-links.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +35 -6
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +9 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +24 -5
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-crawl.d.ts +3 -1
- package/src/lib/site-import/site-import-crawl.js +8 -3
- package/src/lib/site-import/site-import-crawl.js.map +1 -1
- package/src/lib/site-import/site-import-css.d.ts +20 -0
- package/src/lib/site-import/site-import-css.js +106 -0
- package/src/lib/site-import/site-import-css.js.map +1 -1
- package/src/lib/site-import/site-import-html.d.ts +39 -0
- package/src/lib/site-import/site-import-html.js +515 -5
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.d.ts +16 -6
- package/src/lib/site-import/site-import-layout.js +528 -52
- package/src/lib/site-import/site-import-layout.js.map +1 -1
- package/src/lib/site-import/site-import-nav.js +286 -24
- package/src/lib/site-import/site-import-nav.js.map +1 -1
- package/src/lib/site-import/site-import-page.js +3 -0
- package/src/lib/site-import/site-import-page.js.map +1 -1
- package/src/lib/usage/assist-credits.d.ts +5 -4
- package/src/lib/usage/assist-credits.js +5 -4
- package/src/lib/usage/assist-credits.js.map +1 -1
- package/src/lib/usage/staff-org-ai-view.js +6 -6
- package/src/lib/usage/staff-org-ai-view.js.map +1 -1
- package/src/lib/usage/staff-org-ai.d.ts +4 -4
- package/src/lib/usage/staff-org-ai.js +8 -7
- package/src/lib/usage/staff-org-ai.js.map +1 -1
- package/src/lib/usage/staff-org-usage-ai.js +2 -2
- package/src/lib/usage/staff-org-usage-ai.js.map +1 -1
|
@@ -20,7 +20,7 @@ import { CANVAS_ROOT_ELEMENT_ID } from "@aglyn/aglyn/foundation/constants/canvas
|
|
|
20
20
|
import { AI_ICON_COMPONENT_ID, aiIconOfWord, AI_ICON_LIBRARY } from "../runtime/ai-icon-library.js";
|
|
21
21
|
import { AI_INSTANCE_REF_PROP } from "../runtime/ai-node-tree.js";
|
|
22
22
|
import { AI_TEXT_LIMITS } from "../runtime/ai-palette.js";
|
|
23
|
-
import { aiPageScrollInteraction } from "../runtime/ai-page-links.js";
|
|
23
|
+
import { aiPagePlayVideoInteraction, aiPageScrollInteraction } from "../runtime/ai-page-links.js";
|
|
24
24
|
import { aiLayoutFitText, aiLayoutQuoteGap, aiLayoutWords } from "./ai-layout-copy.js";
|
|
25
25
|
import { AI_LAYOUT_GROUP_KINDS, AI_LAYOUT_MAX_ITEMS } from "./ai-layout-language.js";
|
|
26
26
|
import { AI_LAYOUT_HALF_HEROES, aiLayoutDesignChoices, aiLayoutFamily, aiLayoutGroupVariant } from "./ai-layout-design.js";
|
|
@@ -76,6 +76,7 @@ function formSectionOf(sections, plan, targets) {
|
|
|
76
76
|
return designed === -1 ? null : designed;
|
|
77
77
|
}
|
|
78
78
|
/** Compiles a page designed in the layout language into the tree it stores. */ export function aiCompileLayoutPage(designed, plan, targets, options) {
|
|
79
|
+
var _page_plays;
|
|
79
80
|
const tree = new AiLayoutTreeBuilder();
|
|
80
81
|
const formSection = formSectionOf(designed, plan, targets);
|
|
81
82
|
// The page a visitor opens to get in touch shows the phone and email the
|
|
@@ -117,8 +118,24 @@ function formSectionOf(sections, plan, targets) {
|
|
|
117
118
|
};
|
|
118
119
|
return compileSection(page, section, index);
|
|
119
120
|
});
|
|
121
|
+
// A button that plays a film of the page scrolls to it and presses play (AGL-4140), now every film is placed;
|
|
122
|
+
// one whose film was not placed keeps its words.
|
|
123
|
+
for (const play of (_page_plays = page.plays) != null ? _page_plays : []){
|
|
124
|
+
var _page_videos;
|
|
125
|
+
const target = (_page_videos = page.videos) == null ? void 0 : _page_videos[play.film];
|
|
126
|
+
if (target) tree.nodes[play.id].interactions = [
|
|
127
|
+
aiPagePlayVideoInteraction(target)
|
|
128
|
+
];
|
|
129
|
+
else tree.nodes[play.id] = {
|
|
130
|
+
componentId: 'muiTypography',
|
|
131
|
+
props: {
|
|
132
|
+
children: play.label,
|
|
133
|
+
variant: 'body1'
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
120
137
|
const rootId = tree.add('div', null, null, roots, 'page', CANVAS_ROOT_ELEMENT_ID);
|
|
121
|
-
return {
|
|
138
|
+
return _extends({
|
|
122
139
|
tree: {
|
|
123
140
|
rootId,
|
|
124
141
|
nodes: tree.nodes
|
|
@@ -128,7 +145,9 @@ function formSectionOf(sections, plan, targets) {
|
|
|
128
145
|
settled: page.settled,
|
|
129
146
|
itemIds: page.itemIds,
|
|
130
147
|
quotesOnly: page.quotesOnly
|
|
131
|
-
}
|
|
148
|
+
}, page.videos ? {
|
|
149
|
+
videoIds: Object.values(page.videos)
|
|
150
|
+
} : {});
|
|
132
151
|
}
|
|
133
152
|
/** The first icon the design names anywhere, else a sparkle: what an empty picture shows. */ function pageIconOf(sections) {
|
|
134
153
|
for (const section of sections){
|
|
@@ -827,14 +846,18 @@ function hasGroup(tree, ids) {
|
|
|
827
846
|
});
|
|
828
847
|
}
|
|
829
848
|
function compileBlock(scope, block, room) {
|
|
849
|
+
const verbatim = scope.page.options.verbatim === true;
|
|
830
850
|
switch(block.kind){
|
|
831
851
|
case 'eyebrow':
|
|
852
|
+
// A page brought in sets its eyebrows in the source's own pill and color (AGL-4138).
|
|
853
|
+
if (verbatim && (block.chip || block.color)) return importedEyebrow(scope, block);
|
|
832
854
|
return words(scope, block, 'eyebrow', 'overline', {
|
|
833
855
|
component: 'p'
|
|
834
856
|
}, accent(scope));
|
|
835
857
|
case 'heading':
|
|
836
858
|
return heading(scope, block);
|
|
837
859
|
case 'lede':
|
|
860
|
+
if (verbatim && block.style === 'large') return statement(scope, block);
|
|
838
861
|
return words(scope, block, 'lede', 'lede', {}, muted(scope));
|
|
839
862
|
case 'text':
|
|
840
863
|
return words(scope, block, 'text', 'body1', {}, muted(scope));
|
|
@@ -861,6 +884,8 @@ function compileBlock(scope, block, room) {
|
|
|
861
884
|
return tabs(scope, block, room);
|
|
862
885
|
case 'logos':
|
|
863
886
|
return logos(scope, block);
|
|
887
|
+
case 'video':
|
|
888
|
+
return block.video ? video(scope, block.video, block.picture) : null;
|
|
864
889
|
default:
|
|
865
890
|
return null;
|
|
866
891
|
}
|
|
@@ -936,13 +961,15 @@ function words(scope, block, place, variant, props, sx) {
|
|
|
936
961
|
return scope.frame ? 'p' : `h${itemLevel(scope)}`;
|
|
937
962
|
}
|
|
938
963
|
function compileButton(scope, block) {
|
|
939
|
-
var _block_style;
|
|
964
|
+
var _block_style, _scope_page, _plays;
|
|
940
965
|
const verbatim = scope.page.options.verbatim === true;
|
|
941
966
|
// Words that carry the phone or the email are kept whole (AGL-3979).
|
|
942
967
|
const asked = verbatim ? aiLayoutAsWritten(block.text) : aiLayoutContactLabel(block.text, scope.page.targets.contact) || aiLayoutFitText(block.text, 'label', scope.page.options.language);
|
|
943
968
|
if (!asked) return null;
|
|
944
|
-
|
|
945
|
-
|
|
969
|
+
// A button of a page brought in that plays one of its films (AGL-4140): its interaction is written once the film is placed.
|
|
970
|
+
const film = verbatim ? aiLayoutImportedFilm(block.to) : null;
|
|
971
|
+
const destination = film !== null ? null : verbatim ? aiLayoutImportedDestination(block.to, scope.page.plan.sections.length) : aiLayoutResolveLink(block.to, asked, scope.link, scope.page.targets);
|
|
972
|
+
if (!destination && film === null) {
|
|
946
973
|
// A page brought in keeps the words of a link that goes nowhere here (AGL-4107).
|
|
947
974
|
if (verbatim) return words(scope, block, 'text', 'body1', {}, muted(scope));
|
|
948
975
|
scope.page.settled.push({
|
|
@@ -953,9 +980,9 @@ function compileButton(scope, block) {
|
|
|
953
980
|
}
|
|
954
981
|
// A link of a page brought in longer than a button's label holds is its
|
|
955
982
|
// words, as a link (AGL-4107): every word kept, and it still goes there.
|
|
956
|
-
if (verbatim && asked.length > AI_TEXT_LIMITS.button) return linkedWords(scope, asked, destination);
|
|
983
|
+
if (verbatim && asked.length > AI_TEXT_LIMITS.button) return destination ? linkedWords(scope, asked, destination) : words(scope, block, 'text', 'body1', {}, muted(scope));
|
|
957
984
|
// A button to a page merged into the blog names the blog (AGL-3676).
|
|
958
|
-
const label = verbatim ? asked : aiLayoutRenamedLabel(asked, destination);
|
|
985
|
+
const label = verbatim || !destination ? asked : aiLayoutRenamedLabel(asked, destination);
|
|
959
986
|
if (label !== asked) scope.page.settled.push({
|
|
960
987
|
at: scope.at,
|
|
961
988
|
what: `the button "${asked}" named for the blog: "${label}"`
|
|
@@ -977,14 +1004,23 @@ function compileButton(scope, block) {
|
|
|
977
1004
|
children: label
|
|
978
1005
|
}, look, {
|
|
979
1006
|
size: scope.index === 0 || block.style === 'large' ? 'large' : 'medium'
|
|
980
|
-
}, destinationProps(destination)), // Sized to its words, never stretched across the column a Stack would
|
|
1007
|
+
}, destination ? destinationProps(destination) : {}), // Sized to its words, never stretched across the column a Stack would
|
|
981
1008
|
// stretch it over (AGL-3660), and aligned with its section.
|
|
982
1009
|
{
|
|
983
1010
|
alignSelf: scope.centered ? 'center' : 'flex-start'
|
|
984
1011
|
}, null, 'button');
|
|
985
|
-
linkTo(scope, id, destination);
|
|
1012
|
+
if (destination) linkTo(scope, id, destination);
|
|
1013
|
+
if (film !== null) ((_plays = (_scope_page = scope.page).plays) != null ? _plays : _scope_page.plays = []).push({
|
|
1014
|
+
id,
|
|
1015
|
+
film,
|
|
1016
|
+
label
|
|
1017
|
+
});
|
|
986
1018
|
return id;
|
|
987
1019
|
}
|
|
1020
|
+
/** The film a button of a page brought in plays (AGL-4140), `video:<n>`, by its index; `null` for any other destination. */ export function aiLayoutImportedFilm(to) {
|
|
1021
|
+
const match = /^video:(\d{1,3})$/.exec((to != null ? to : '').trim());
|
|
1022
|
+
return match ? Number(match[1]) : null;
|
|
1023
|
+
}
|
|
988
1024
|
/**
|
|
989
1025
|
* Where a link of a page brought in goes (AGL-4107), as its compile wrote it:
|
|
990
1026
|
* `page:<id>` a page of the site by its id — any page the import plans, which
|
|
@@ -1223,7 +1259,7 @@ function itemSize(perRow) {
|
|
|
1223
1259
|
if (perRow === 3) return 'xs:12 md:4';
|
|
1224
1260
|
return 'xs:12 sm:6 md:3';
|
|
1225
1261
|
}
|
|
1226
|
-
/** Items laid out side by side as a Grid of sized items, or stacked where they sit one to a row. */ function layOut(scope, items, perRow, spacing, role) {
|
|
1262
|
+
/** Items laid out side by side as a Grid of sized items, or stacked where they sit one to a row. */ function layOut(scope, items, perRow, spacing, role, /** The cells' size, where a page brought in sets its own tablet columns (AGL-4138). */ sized) {
|
|
1227
1263
|
const tree = scope.page.tree;
|
|
1228
1264
|
if (items.length === 1) return items[0];
|
|
1229
1265
|
if (perRow <= 1) {
|
|
@@ -1231,7 +1267,7 @@ function itemSize(perRow) {
|
|
|
1231
1267
|
spacing
|
|
1232
1268
|
}, null, items, role);
|
|
1233
1269
|
}
|
|
1234
|
-
const size = itemSize(perRow);
|
|
1270
|
+
const size = sized != null ? sized : itemSize(perRow);
|
|
1235
1271
|
const cells = items.map((id)=>tree.add('muiGrid', {
|
|
1236
1272
|
size
|
|
1237
1273
|
}, null, [
|
|
@@ -1629,19 +1665,54 @@ function instances(scope, placed, items, perRow) {
|
|
|
1629
1665
|
underHeader: true
|
|
1630
1666
|
} : {}), sx, children, 'section', (_ref = (_page_options_sectionIds = page.options.sectionIds) == null ? void 0 : _page_options_sectionIds[index]) != null ? _ref : sectionIdOf(index));
|
|
1631
1667
|
}
|
|
1668
|
+
/**
|
|
1669
|
+
* The frame a page brought in sets the source's own picture in (AGL-4138):
|
|
1670
|
+
* the picture's own shape, or the box the source crops it to, one shape on
|
|
1671
|
+
* every screen, with the source's rounded corners and its shadow. Filled at
|
|
1672
|
+
* its own shape a picture loses nothing: the 11/1 import's hero cut a sixth
|
|
1673
|
+
* off the top and bottom of a screenshot in a 16 / 7 box. Every other
|
|
1674
|
+
* picture takes `fallback`.
|
|
1675
|
+
*/ function ownFrame(scope, picture, fallback) {
|
|
1676
|
+
const fit = scope.page.options.verbatim === true && picture.given ? picture.fit : undefined;
|
|
1677
|
+
if (!fit || !fit.ratio && !fit.height) return fallback;
|
|
1678
|
+
return _extends({}, fit.height ? {
|
|
1679
|
+
height: fit.height
|
|
1680
|
+
} : {
|
|
1681
|
+
aspectRatio: fit.ratio
|
|
1682
|
+
}, {
|
|
1683
|
+
borderRadius: fit.rounded ? 3 : 2
|
|
1684
|
+
}, fit.shadow ? {
|
|
1685
|
+
boxShadow: 3
|
|
1686
|
+
} : {}, fit.measure ? {
|
|
1687
|
+
width: '100%',
|
|
1688
|
+
maxWidth: fit.measure,
|
|
1689
|
+
mx: 'auto'
|
|
1690
|
+
} : {});
|
|
1691
|
+
}
|
|
1632
1692
|
/**
|
|
1633
1693
|
* A picture the design places: the model's own where it described one, else
|
|
1634
1694
|
* a stand-in — marked decorative, since no one described it, with the
|
|
1635
1695
|
* section's words as what a stock search looks for. Either is filled by
|
|
1636
1696
|
* `ai-layout-pictures.ts` after the page is checked, as any slot is.
|
|
1637
1697
|
*/ function designPicture(scope, picture, frameSx, role = 'designFrame', imageSx = {}) {
|
|
1698
|
+
var _picture_fit;
|
|
1638
1699
|
const tree = scope.page.tree;
|
|
1639
1700
|
// The picture fills its frame by its own size props, so the frame alone
|
|
1640
1701
|
// carries a style: a page of many pictures repeats no inline style (rule 16).
|
|
1641
|
-
|
|
1702
|
+
// A source's own picture keeps the fit the source gives it (AGL-4138); a film's poster is its Video
|
|
1703
|
+
// element, filling the frame as the picture would (AGL-4140).
|
|
1704
|
+
const fit = scope.page.options.verbatim === true && picture.given ? (_picture_fit = picture.fit) == null ? void 0 : _picture_fit.objectFit : undefined;
|
|
1705
|
+
const image = picture.video ? video(scope, picture.video, picture.src ? {
|
|
1706
|
+
src: picture.src,
|
|
1707
|
+
alt: picture.alt
|
|
1708
|
+
} : undefined, 'heroVideo', _extends({}, imageSx, fit ? {
|
|
1709
|
+
objectFit: fit
|
|
1710
|
+
} : {})) : designImage(scope, picture, _extends({
|
|
1642
1711
|
width: '100%',
|
|
1643
1712
|
height: '100%'
|
|
1644
|
-
},
|
|
1713
|
+
}, fit ? {
|
|
1714
|
+
objectFit: fit
|
|
1715
|
+
} : {}), Object.keys(imageSx).length ? imageSx : null);
|
|
1645
1716
|
return tree.add('muiBox', null, _extends({
|
|
1646
1717
|
position: 'relative',
|
|
1647
1718
|
overflow: 'hidden',
|
|
@@ -1812,7 +1883,7 @@ function instances(scope, placed, items, perRow) {
|
|
|
1812
1883
|
scope.centered = false;
|
|
1813
1884
|
if (variant === 'split') {
|
|
1814
1885
|
const words = compileFlow(scope, flow, 'half');
|
|
1815
|
-
const photo = designPicture(scope, picture, {
|
|
1886
|
+
const photo = designPicture(scope, picture, ownFrame(scope, picture, {
|
|
1816
1887
|
aspectRatio: home ? {
|
|
1817
1888
|
xs: '4 / 3',
|
|
1818
1889
|
md: '4 / 5'
|
|
@@ -1821,7 +1892,7 @@ function instances(scope, placed, items, perRow) {
|
|
|
1821
1892
|
md: '1 / 1'
|
|
1822
1893
|
},
|
|
1823
1894
|
borderRadius: 2
|
|
1824
|
-
});
|
|
1895
|
+
}));
|
|
1825
1896
|
const right = design.choices.featureLeft;
|
|
1826
1897
|
const row = designRow(scope, [
|
|
1827
1898
|
_extends({
|
|
@@ -1879,7 +1950,7 @@ function instances(scope, placed, items, perRow) {
|
|
|
1879
1950
|
}
|
|
1880
1951
|
}
|
|
1881
1952
|
], '4', 'flex-end') : ledeId != null ? ledeId : actionsId;
|
|
1882
|
-
const photo = designPicture(scope, picture, {
|
|
1953
|
+
const photo = designPicture(scope, picture, ownFrame(scope, picture, {
|
|
1883
1954
|
aspectRatio: home ? {
|
|
1884
1955
|
xs: '4 / 3',
|
|
1885
1956
|
md: '21 / 9'
|
|
@@ -1888,7 +1959,7 @@ function instances(scope, placed, items, perRow) {
|
|
|
1888
1959
|
md: '3 / 1'
|
|
1889
1960
|
},
|
|
1890
1961
|
borderRadius: 2
|
|
1891
|
-
});
|
|
1962
|
+
}));
|
|
1892
1963
|
const stack = tree.add('muiStack', {
|
|
1893
1964
|
spacing: '6',
|
|
1894
1965
|
useFlexGap: true
|
|
@@ -2048,6 +2119,7 @@ function instances(scope, placed, items, perRow) {
|
|
|
2048
2119
|
* A masthead (AGL-3985): the words centered in a narrow column, as a journal
|
|
2049
2120
|
* or a quiet practice opens, and a wide photo under them.
|
|
2050
2121
|
*/ function columnHero(scope, flow, picture, home) {
|
|
2122
|
+
var _picture_after;
|
|
2051
2123
|
const tree = scope.page.tree;
|
|
2052
2124
|
const band = scope.band;
|
|
2053
2125
|
scope.centered = true;
|
|
@@ -2061,7 +2133,7 @@ function instances(scope, placed, items, perRow) {
|
|
|
2061
2133
|
}, [
|
|
2062
2134
|
words
|
|
2063
2135
|
], 'measure');
|
|
2064
|
-
const photo = designPicture(scope, picture, {
|
|
2136
|
+
const photo = designPicture(scope, picture, ownFrame(scope, picture, {
|
|
2065
2137
|
aspectRatio: home ? {
|
|
2066
2138
|
xs: '4 / 3',
|
|
2067
2139
|
md: '16 / 7'
|
|
@@ -2070,13 +2142,26 @@ function instances(scope, placed, items, perRow) {
|
|
|
2070
2142
|
md: '3 / 1'
|
|
2071
2143
|
},
|
|
2072
2144
|
borderRadius: 2
|
|
2073
|
-
});
|
|
2145
|
+
}));
|
|
2146
|
+
// What the source sets under its picture stays under it, centered as the words above are.
|
|
2147
|
+
const under = ((_picture_after = picture.after) == null ? void 0 : _picture_after.length) ? [
|
|
2148
|
+
tree.add('muiBox', null, {
|
|
2149
|
+
maxWidth: {
|
|
2150
|
+
xs: '100%',
|
|
2151
|
+
md: '72%'
|
|
2152
|
+
},
|
|
2153
|
+
mx: 'auto'
|
|
2154
|
+
}, [
|
|
2155
|
+
compileFlow(scope, picture.after, 'full')
|
|
2156
|
+
], 'measure')
|
|
2157
|
+
] : [];
|
|
2074
2158
|
const stack = tree.add('muiStack', {
|
|
2075
2159
|
spacing: '8',
|
|
2076
2160
|
useFlexGap: true
|
|
2077
2161
|
}, null, [
|
|
2078
2162
|
measure,
|
|
2079
|
-
photo
|
|
2163
|
+
photo,
|
|
2164
|
+
...under
|
|
2080
2165
|
], 'content');
|
|
2081
2166
|
const container = tree.add('muiContainer', {
|
|
2082
2167
|
maxWidth: 'lg'
|
|
@@ -3459,10 +3544,16 @@ function listingSection(scope, blocks, placed) {
|
|
|
3459
3544
|
// theme's tokens, as the rest of the compiler draws: a card is the theme's
|
|
3460
3545
|
// Card, a question the Accordion, a link the Button. One style key on each
|
|
3461
3546
|
// repeated element, so a page of many items repeats no inline style (rule 16).
|
|
3462
|
-
/**
|
|
3547
|
+
/**
|
|
3548
|
+
* The source's picture, at its own shape, rounded as the theme rounds a
|
|
3549
|
+
* frame, or more where the source rounds it more (AGL-4138); cropped only to
|
|
3550
|
+
* a box the source crops it to, and fitted as the source fits it.
|
|
3551
|
+
*/ function sourcePicture(scope, picture, role = 'image') {
|
|
3552
|
+
var _ref;
|
|
3463
3553
|
const { page } = scope;
|
|
3464
3554
|
page.images += 1;
|
|
3465
3555
|
const destination = picture.to ? aiLayoutImportedDestination(picture.to, page.plan.sections.length) : null;
|
|
3556
|
+
const fit = picture.small ? undefined : picture.fit;
|
|
3466
3557
|
return page.tree.add('image', _extends({
|
|
3467
3558
|
src: picture.src
|
|
3468
3559
|
}, picture.alt ? {
|
|
@@ -3470,20 +3561,81 @@ function listingSection(scope, blocks, placed) {
|
|
|
3470
3561
|
} : {
|
|
3471
3562
|
decorative: true
|
|
3472
3563
|
}, {
|
|
3473
|
-
objectFit: 'cover'
|
|
3564
|
+
objectFit: (_ref = fit == null ? void 0 : fit.objectFit) != null ? _ref : 'cover'
|
|
3474
3565
|
}, picture.small ? {
|
|
3475
3566
|
width: AI_LAYOUT_PORTRAIT_SIZE,
|
|
3476
3567
|
height: AI_LAYOUT_PORTRAIT_SIZE
|
|
3568
|
+
} : {}, (fit == null ? void 0 : fit.cropped) && fit.height ? {
|
|
3569
|
+
height: `${fit.height}px`
|
|
3477
3570
|
} : {}, page.images > 1 ? {
|
|
3478
3571
|
loading: 'lazy'
|
|
3479
|
-
} : {}, destination ? destinationProps(destination) : {}), {
|
|
3480
|
-
borderRadius: picture.small ? '50%' : 2
|
|
3481
|
-
}, null
|
|
3572
|
+
} : {}, destination ? destinationProps(destination) : {}), _extends({
|
|
3573
|
+
borderRadius: picture.small ? '50%' : (fit == null ? void 0 : fit.rounded) ? 3 : 2
|
|
3574
|
+
}, (fit == null ? void 0 : fit.cropped) && fit.ratio ? {
|
|
3575
|
+
aspectRatio: fit.ratio
|
|
3576
|
+
} : {}), null, role);
|
|
3482
3577
|
}
|
|
3483
3578
|
/** The size a byline's portrait is drawn at on a page brought in (AGL-4107): the Image element's own size field, as an author sets it. */ export const AI_LAYOUT_PORTRAIT_SIZE = '4rem';
|
|
3484
|
-
/**
|
|
3579
|
+
/**
|
|
3580
|
+
* A film of a page brought in (AGL-4140): the Video element where the
|
|
3581
|
+
* source's film sat, its poster first, playing from where the old page
|
|
3582
|
+
* played it — a video host's player once a visitor presses play, or the old
|
|
3583
|
+
* site's own file — with what a search engine reads of it. It plays when a
|
|
3584
|
+
* visitor asks: a film that starts on its own loads its file before anyone
|
|
3585
|
+
* plays it, which rule 16 refuses. In a frame (`frame`, a hero's) it fills
|
|
3586
|
+
* it, as a picture there does; elsewhere it is at its own shape, rounded as
|
|
3587
|
+
* the theme rounds a frame, one style key as every repeated element has. Its
|
|
3588
|
+
* id follows its section's, so a button that plays it can name it before the
|
|
3589
|
+
* page is stored.
|
|
3590
|
+
*/ function video(scope, film, poster, role = 'video', frame) {
|
|
3591
|
+
var _page_options_sectionIds, _page_videos, _poster_fit, _poster_fit1;
|
|
3592
|
+
const { page } = scope;
|
|
3593
|
+
// Its poster is the picture its place shows first: the page's pictures after it load as they are reached.
|
|
3594
|
+
if (poster == null ? void 0 : poster.src) page.images += 1;
|
|
3595
|
+
const section = (_page_options_sectionIds = page.options.sectionIds) == null ? void 0 : _page_options_sectionIds[scope.index];
|
|
3596
|
+
const fixed = section && !((_page_videos = page.videos) == null ? void 0 : _page_videos[film.index]) ? `${section}-video-${film.index + 1}` : undefined;
|
|
3597
|
+
const id = page.tree.add('video', _extends({
|
|
3598
|
+
src: film.src
|
|
3599
|
+
}, (poster == null ? void 0 : poster.src) ? {
|
|
3600
|
+
poster: poster.src
|
|
3601
|
+
} : {}, film.title ? {
|
|
3602
|
+
title: film.title
|
|
3603
|
+
} : {}, film.description ? {
|
|
3604
|
+
description: film.description
|
|
3605
|
+
} : {}, film.uploadDate ? {
|
|
3606
|
+
uploadDate: film.uploadDate
|
|
3607
|
+
} : {}, film.durationSeconds ? {
|
|
3608
|
+
durationSeconds: String(film.durationSeconds)
|
|
3609
|
+
} : {}, {
|
|
3610
|
+
controls: true
|
|
3611
|
+
}, frame ? {
|
|
3612
|
+
width: '100%',
|
|
3613
|
+
height: '100%'
|
|
3614
|
+
} : {}), // Rounded and shadowed as the source frames its poster (AGL-4138).
|
|
3615
|
+
frame ? _extends({
|
|
3616
|
+
objectFit: 'cover'
|
|
3617
|
+
}, frame) : _extends({
|
|
3618
|
+
borderRadius: (poster == null ? void 0 : (_poster_fit = poster.fit) == null ? void 0 : _poster_fit.rounded) ? 3 : 2
|
|
3619
|
+
}, film.shadow || (poster == null ? void 0 : (_poster_fit1 = poster.fit) == null ? void 0 : _poster_fit1.shadow) ? {
|
|
3620
|
+
boxShadow: 3
|
|
3621
|
+
} : {}), null, role, fixed);
|
|
3622
|
+
page.videos = _extends({}, page.videos, {
|
|
3623
|
+
[film.index]: id
|
|
3624
|
+
});
|
|
3625
|
+
return id;
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* An item's picture, over its words: the card's own top. Framed as the source
|
|
3629
|
+
* frames it (AGL-4138) — at the height or the box it crops it to, else at the
|
|
3630
|
+
* picture's own shape — and at 16 / 9 only where nothing says its shape.
|
|
3631
|
+
*/ function itemPicture(scope, picture) {
|
|
3632
|
+
var _ref, _ref1;
|
|
3633
|
+
// A film's poster plays it (AGL-4140).
|
|
3634
|
+
if (picture.video) return video(scope, picture.video, picture.src ? picture : undefined, 'itemVideo');
|
|
3485
3635
|
const { page } = scope;
|
|
3486
3636
|
page.images += 1;
|
|
3637
|
+
const fit = picture.fit;
|
|
3638
|
+
const height = (fit == null ? void 0 : fit.cropped) && fit.height ? fit.height : null;
|
|
3487
3639
|
return page.tree.add('image', _extends({
|
|
3488
3640
|
src: picture.src
|
|
3489
3641
|
}, picture.alt ? {
|
|
@@ -3491,11 +3643,13 @@ function listingSection(scope, blocks, placed) {
|
|
|
3491
3643
|
} : {
|
|
3492
3644
|
decorative: true
|
|
3493
3645
|
}, {
|
|
3494
|
-
objectFit: 'cover'
|
|
3495
|
-
},
|
|
3646
|
+
objectFit: (_ref = fit == null ? void 0 : fit.objectFit) != null ? _ref : 'cover'
|
|
3647
|
+
}, height ? {
|
|
3648
|
+
height: `${height}px`
|
|
3649
|
+
} : {}, page.images > 1 ? {
|
|
3496
3650
|
loading: 'lazy'
|
|
3497
|
-
} : {}), {
|
|
3498
|
-
aspectRatio: '16 / 9'
|
|
3651
|
+
} : {}), height ? null : {
|
|
3652
|
+
aspectRatio: (_ref1 = fit == null ? void 0 : fit.ratio) != null ? _ref1 : '16 / 9'
|
|
3499
3653
|
}, null, 'itemPicture');
|
|
3500
3654
|
}
|
|
3501
3655
|
/** An icon of a page brought in: the source's own drawing, else the library icon its word names. */ function sourceIcon(scope, own, size, sx, role = 'icon') {
|
|
@@ -3608,7 +3762,8 @@ function listingSection(scope, blocks, placed) {
|
|
|
3608
3762
|
* (`variant`): the theme's cards, open columns under a rule, open columns led
|
|
3609
3763
|
* by their icons, or pictures over their words.
|
|
3610
3764
|
*/ function importedGroup(scope, block, room) {
|
|
3611
|
-
var _block_items;
|
|
3765
|
+
var _block_items, _scope_page_ruled, _scope_page_ruled1;
|
|
3766
|
+
var _block_rule;
|
|
3612
3767
|
const items = ((_block_items = block.items) != null ? _block_items : []).filter(itemShows);
|
|
3613
3768
|
if (!items.length) return null;
|
|
3614
3769
|
if (block.inline) {
|
|
@@ -3622,8 +3777,17 @@ function listingSection(scope, blocks, placed) {
|
|
|
3622
3777
|
}, null, noted(scope, items.map((item)=>importedRow(scope, item))), 'rows');
|
|
3623
3778
|
}
|
|
3624
3779
|
const perRow = importedAcross(block, items.length, room);
|
|
3625
|
-
|
|
3626
|
-
|
|
3780
|
+
// Items that set their words apart from their section's: a centered heading over start-aligned cards (AGL-4138).
|
|
3781
|
+
const own = block.itemsAlign ? _extends({}, scope, {
|
|
3782
|
+
centered: block.itemsAlign === 'center'
|
|
3783
|
+
}) : scope;
|
|
3784
|
+
// A rule in the source's color while a page has no more than three like it (rule 16), in the words' own after.
|
|
3785
|
+
const colored = !!((_block_rule = block.rule) == null ? void 0 : _block_rule.color) && ((_scope_page_ruled = scope.page.ruled) != null ? _scope_page_ruled : 0) + items.length <= AI_LAYOUT_MAX_PILLS;
|
|
3786
|
+
if (colored) scope.page.ruled = ((_scope_page_ruled1 = scope.page.ruled) != null ? _scope_page_ruled1 : 0) + items.length;
|
|
3787
|
+
const ids = items.map((item)=>importedItem(own, block, item, colored));
|
|
3788
|
+
// The source's tablet columns, fewer than its wide ones (AGL-4138).
|
|
3789
|
+
const sm = block.columnsSm && block.columnsSm >= 2 && block.columnsSm < perRow && 12 % block.columnsSm === 0 && 12 % perRow === 0 ? `xs:12 sm:${12 / block.columnsSm} md:${12 / perRow}` : undefined;
|
|
3790
|
+
return layOut(scope, noted(scope, ids), perRow, block.kind === 'stats' ? '4' : '3', block.kind === 'cards' ? 'cards' : block.kind, sm);
|
|
3627
3791
|
}
|
|
3628
3792
|
/** The style an item of a group is drawn in: the design answer's, else the source's own box or none. */ function itemStyle(block) {
|
|
3629
3793
|
if (block.variant) return block.variant;
|
|
@@ -3671,11 +3835,12 @@ function listingSection(scope, blocks, placed) {
|
|
|
3671
3835
|
const tree = scope.page.tree;
|
|
3672
3836
|
const figure = aiLayoutAsWritten(item.figure);
|
|
3673
3837
|
if (!figure) return null;
|
|
3838
|
+
// A figure the source sets in its muted words' grey keeps it (AGL-4138): a step's "01".
|
|
3674
3839
|
const number = tree.add('muiTypography', _extends({
|
|
3675
3840
|
children: figure,
|
|
3676
3841
|
variant: 'h3',
|
|
3677
3842
|
component: 'p'
|
|
3678
|
-
}, align(scope)), accent(scope), null, role);
|
|
3843
|
+
}, align(scope)), item.figureMuted ? muted(scope) : accent(scope), null, role);
|
|
3679
3844
|
const period = aiLayoutAsWritten(item.period);
|
|
3680
3845
|
if (!period) return number;
|
|
3681
3846
|
return tree.add('muiStack', _extends({
|
|
@@ -3805,7 +3970,41 @@ function listingSection(scope, blocks, placed) {
|
|
|
3805
3970
|
], '3', 'center', 'ruledRow');
|
|
3806
3971
|
return wholeLink(scope, item, title, row);
|
|
3807
3972
|
}
|
|
3808
|
-
/**
|
|
3973
|
+
/**
|
|
3974
|
+
* An item's lead icon as the source sets it (AGL-4138): in the filled square
|
|
3975
|
+
* of its tile, the theme's surface rounded as the theme rounds one, and the
|
|
3976
|
+
* arrow at the end of its first row where the source draws one. One style
|
|
3977
|
+
* key on each element, so thirteen cards repeat no inline style (rule 16).
|
|
3978
|
+
*/ function leadRow(scope, item, style) {
|
|
3979
|
+
const tree = scope.page.tree;
|
|
3980
|
+
const tile = item.tile;
|
|
3981
|
+
const color = tile ? tile.color ? {
|
|
3982
|
+
color: tile.color
|
|
3983
|
+
} : null : style === 'cards' ? {
|
|
3984
|
+
color: 'primary.main'
|
|
3985
|
+
} : accent(scope);
|
|
3986
|
+
const icon = sourceIcon(scope, item, tile ? '24' : '32', color);
|
|
3987
|
+
const lead = icon && tile ? tree.add('muiPaper', {
|
|
3988
|
+
variant: 'elevation',
|
|
3989
|
+
elevation: '0'
|
|
3990
|
+
}, {
|
|
3991
|
+
bgcolor: tile.fill
|
|
3992
|
+
}, [
|
|
3993
|
+
tree.add('muiStack', null, {
|
|
3994
|
+
p: 1
|
|
3995
|
+
}, [
|
|
3996
|
+
icon
|
|
3997
|
+
], 'tileSpace')
|
|
3998
|
+
], 'tile') : icon;
|
|
3999
|
+
const mark = item.markPath ? sourceIcon(scope, {
|
|
4000
|
+
iconPath: item.markPath
|
|
4001
|
+
}, '20', muted(scope), 'mark') : null;
|
|
4002
|
+
return {
|
|
4003
|
+
lead,
|
|
4004
|
+
mark
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
4007
|
+
/** One item of a group of a page brought in, every part of it in the source's order. */ function importedItem(scope, block, item, colored = false) {
|
|
3809
4008
|
var _tree_nodes_shown_;
|
|
3810
4009
|
const tree = scope.page.tree;
|
|
3811
4010
|
const style = itemStyle(block);
|
|
@@ -3852,13 +4051,32 @@ function listingSection(scope, blocks, placed) {
|
|
|
3852
4051
|
var _item_more2;
|
|
3853
4052
|
var _item_list, _item_links;
|
|
3854
4053
|
if (item.picture) parts.push(itemPicture(scope, item.picture));
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
4054
|
+
const { lead, mark } = leadRow(scope, item, style);
|
|
4055
|
+
// The arrow sits at the end of the icon's row, or of the title's where the item has no icon (AGL-4138);
|
|
4056
|
+
// a tile sits in a row of its own too, sized to its icon rather than stretched across the item.
|
|
4057
|
+
const row = (ids, role)=>tree.add('muiStack', {
|
|
4058
|
+
direction: 'row',
|
|
4059
|
+
spacing: '1',
|
|
4060
|
+
justifyContent: ids.length > 1 ? 'space-between' : scope.centered ? 'center' : 'flex-start',
|
|
4061
|
+
alignItems: 'center'
|
|
4062
|
+
}, null, ids.filter((id)=>!!id), role);
|
|
4063
|
+
parts.push(lead && (mark || item.tile) ? row(mark ? [
|
|
4064
|
+
lead,
|
|
4065
|
+
mark
|
|
4066
|
+
] : [
|
|
4067
|
+
lead
|
|
4068
|
+
], 'leadRow') : lead);
|
|
4069
|
+
const named = ()=>{
|
|
4070
|
+
const own = titled(scope, titleNode(), item);
|
|
4071
|
+
return mark && !lead && own && !item.badge ? row([
|
|
4072
|
+
own,
|
|
4073
|
+
mark
|
|
4074
|
+
], 'titleRow') : own;
|
|
4075
|
+
};
|
|
3858
4076
|
const number = figured(scope, item, kind === 'steps' ? 'number' : 'figure');
|
|
3859
4077
|
// A step's number leads it; a plan's price follows its name.
|
|
3860
|
-
if (kind === 'steps') parts.push(number,
|
|
3861
|
-
else parts.push(
|
|
4078
|
+
if (kind === 'steps') parts.push(number, named());
|
|
4079
|
+
else parts.push(named(), number);
|
|
3862
4080
|
parts.push(...paragraphs(scope, [
|
|
3863
4081
|
item.text,
|
|
3864
4082
|
...(_item_more2 = item.more) != null ? _item_more2 : []
|
|
@@ -3890,11 +4108,19 @@ function listingSection(scope, blocks, placed) {
|
|
|
3890
4108
|
content
|
|
3891
4109
|
], kind === 'quotes' ? 'quoteCard' : 'card');
|
|
3892
4110
|
} else if (style === 'ruled') {
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
4111
|
+
var _ref, _ref1;
|
|
4112
|
+
// Under the source's own rule where it draws one (AGL-4138): a step's 3 px line in the brand's color, along its side.
|
|
4113
|
+
const rule = block.rule;
|
|
4114
|
+
const side = (_ref = rule == null ? void 0 : rule.side) != null ? _ref : 'top';
|
|
4115
|
+
const edge = side === 'left' ? 'borderLeft' : side === 'right' ? 'borderRight' : side === 'bottom' ? 'borderBottom' : 'borderTop';
|
|
4116
|
+
const inset = side === 'left' ? 'pl' : side === 'right' ? 'pr' : side === 'bottom' ? 'pb' : 'pt';
|
|
4117
|
+
drawn = tree.add('muiBox', null, _extends({
|
|
4118
|
+
[edge]: (_ref1 = rule == null ? void 0 : rule.width) != null ? _ref1 : 1
|
|
4119
|
+
}, colored && (rule == null ? void 0 : rule.color) ? {
|
|
4120
|
+
borderColor: rule.color
|
|
4121
|
+
} : {}), [
|
|
3896
4122
|
tree.add('muiBox', null, {
|
|
3897
|
-
|
|
4123
|
+
[inset]: 2.5
|
|
3898
4124
|
}, [
|
|
3899
4125
|
stack
|
|
3900
4126
|
], 'ruledWords')
|
|
@@ -4110,6 +4336,60 @@ function listingSection(scope, blocks, placed) {
|
|
|
4110
4336
|
spacing: '3'
|
|
4111
4337
|
}, null, parts, 'panel');
|
|
4112
4338
|
}
|
|
4339
|
+
/**
|
|
4340
|
+
* A large bold statement of a page brought in (AGL-4138), a paragraph its
|
|
4341
|
+
* source sets as big as a heading: a lede in the Text Style of a fourth-level
|
|
4342
|
+
* heading, as the Besigner's own Text Style field sets one, so a paragraph of
|
|
4343
|
+
* any length keeps every word and is no heading of the page's outline. A
|
|
4344
|
+
* page's fourth is drawn as a lede: a fourth like style is a repeat (rule 16).
|
|
4345
|
+
*/ function statement(scope, block) {
|
|
4346
|
+
var _page_statements, _page_statements1;
|
|
4347
|
+
const { page } = scope;
|
|
4348
|
+
const tone = muted(scope);
|
|
4349
|
+
if (((_page_statements = page.statements) != null ? _page_statements : 0) >= AI_LAYOUT_MAX_PILLS) return words(scope, block, 'lede', 'lede', {}, tone);
|
|
4350
|
+
page.statements = ((_page_statements1 = page.statements) != null ? _page_statements1 : 0) + 1;
|
|
4351
|
+
return words(scope, block, 'lede', 'lede', {
|
|
4352
|
+
component: 'p'
|
|
4353
|
+
}, _extends({
|
|
4354
|
+
typography: 'h4'
|
|
4355
|
+
}, tone != null ? tone : {}));
|
|
4356
|
+
}
|
|
4357
|
+
/**
|
|
4358
|
+
* An eyebrow of a page brought in (AGL-4138): in the color the source sets
|
|
4359
|
+
* it in, as a theme role, and in a pill where the source sets one — the
|
|
4360
|
+
* outlined surface a chip is, rounded to a pill and sized to its words. On a
|
|
4361
|
+
* brand band or over a photo it takes the band's own color, as any accent
|
|
4362
|
+
* does. A page's fourth pill is drawn as plain words: a fourth like style is
|
|
4363
|
+
* a repeat (rule 16).
|
|
4364
|
+
*/ function importedEyebrow(scope, block) {
|
|
4365
|
+
var _page_pills, _page_pills1;
|
|
4366
|
+
const { page } = scope;
|
|
4367
|
+
const color = scope.band === 'brand' || scope.overPhoto ? null : block.color ? {
|
|
4368
|
+
color: block.color
|
|
4369
|
+
} : accent(scope);
|
|
4370
|
+
if (!block.chip || ((_page_pills = page.pills) != null ? _page_pills : 0) >= AI_LAYOUT_MAX_PILLS) return words(scope, block, 'eyebrow', 'overline', {
|
|
4371
|
+
component: 'p'
|
|
4372
|
+
}, color);
|
|
4373
|
+
const text = say(scope, block.text, 'eyebrow');
|
|
4374
|
+
if (!text) return null;
|
|
4375
|
+
page.pills = ((_page_pills1 = page.pills) != null ? _page_pills1 : 0) + 1;
|
|
4376
|
+
const label = page.tree.add('muiTypography', _extends({
|
|
4377
|
+
children: text,
|
|
4378
|
+
variant: 'overline',
|
|
4379
|
+
component: 'p'
|
|
4380
|
+
}, align(scope)), _extends({
|
|
4381
|
+
px: 2
|
|
4382
|
+
}, color != null ? color : {}), null, 'eyebrow');
|
|
4383
|
+
return page.tree.add('muiPaper', {
|
|
4384
|
+
variant: 'outlined'
|
|
4385
|
+
}, {
|
|
4386
|
+
py: 0.5,
|
|
4387
|
+
borderRadius: 999,
|
|
4388
|
+
alignSelf: scope.centered ? 'center' : 'flex-start'
|
|
4389
|
+
}, [
|
|
4390
|
+
label
|
|
4391
|
+
], 'eyebrowChip');
|
|
4392
|
+
}
|
|
4113
4393
|
/** A short line on an outlined surface of the theme's own shape: a label, a tag, a tab the source draws as one. */ function chip(scope, words, role) {
|
|
4114
4394
|
const tree = scope.page.tree;
|
|
4115
4395
|
return tree.add('muiPaper', {
|
|
@@ -4156,9 +4436,22 @@ function listingSection(scope, blocks, placed) {
|
|
|
4156
4436
|
item.title,
|
|
4157
4437
|
item.text
|
|
4158
4438
|
].filter((part)=>part.trim()).join(' '));
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4439
|
+
if (!words) return [];
|
|
4440
|
+
// A tag the source links goes where it went (AGL-4138), the whole chip pressable.
|
|
4441
|
+
const destination = item.to ? aiLayoutImportedDestination(item.to, scope.page.plan.sections.length) : null;
|
|
4442
|
+
const drawn = chip(scope, words, 'chip');
|
|
4443
|
+
if (!destination || destination.kind === 'section') return [
|
|
4444
|
+
drawn
|
|
4445
|
+
];
|
|
4446
|
+
return [
|
|
4447
|
+
tree.add('muiLinkBox', _extends({}, destinationProps(destination), {
|
|
4448
|
+
ariaLabel: words.slice(0, AI_TEXT_LIMITS.label)
|
|
4449
|
+
}, destination.kind === 'href' ? {
|
|
4450
|
+
newTab: true
|
|
4451
|
+
} : {}), null, [
|
|
4452
|
+
drawn
|
|
4453
|
+
], 'chipLink')
|
|
4454
|
+
];
|
|
4162
4455
|
});
|
|
4163
4456
|
if (!ids.length) return null;
|
|
4164
4457
|
return tree.add('muiStack', _extends({
|
|
@@ -4177,12 +4470,29 @@ function listingSection(scope, blocks, placed) {
|
|
|
4177
4470
|
* the source's, nothing else. Any other opening is drawn as its source lays
|
|
4178
4471
|
* it out, its picture where the source placed it.
|
|
4179
4472
|
*/ function importedHero(scope, raw, blocks) {
|
|
4473
|
+
var _ref;
|
|
4180
4474
|
const { page } = scope;
|
|
4181
4475
|
if (!page.design || !raw.hero) return null;
|
|
4182
|
-
|
|
4476
|
+
// Its one picture, or its one film, poster first (AGL-4140).
|
|
4477
|
+
const pictures = blocks.filter((block)=>block.kind === 'image' && block.picture || block.kind === 'video' && block.video);
|
|
4183
4478
|
if (pictures.length !== 1) return null;
|
|
4184
|
-
const
|
|
4185
|
-
if (!
|
|
4479
|
+
const words = blocks.filter((block)=>block.kind !== 'image' && block.kind !== 'video');
|
|
4480
|
+
if (!words.length || !words.every((block)=>WORD_KINDS.has(block.kind))) return null;
|
|
4481
|
+
const film = pictures[0].kind === 'video' ? pictures[0].video : undefined;
|
|
4482
|
+
// A film a visitor presses plays where it sits, never behind the words, which would cover it.
|
|
4483
|
+
let asked = raw.hero;
|
|
4484
|
+
if (film && FILM_BEHIND_HEROES.has(asked)) {
|
|
4485
|
+
page.settled.push({
|
|
4486
|
+
at: scope.at,
|
|
4487
|
+
what: `the ${asked} hero set aside: the opening's film is pressed to play, so it sits under its words`
|
|
4488
|
+
});
|
|
4489
|
+
asked = 'column';
|
|
4490
|
+
}
|
|
4491
|
+
// The words the source sets under its picture, as a film's "Watch the film →" (AGL-4140): a
|
|
4492
|
+
// column hero draws them there, any other with its words, and the heading is never one of them.
|
|
4493
|
+
const after = asked === 'column' ? blocks.slice(blocks.indexOf(pictures[0]) + 1).filter((block)=>block.kind !== 'image' && block.kind !== 'video') : [];
|
|
4494
|
+
const under = after.length < words.length && !after.some((block)=>speaksHeading(scope, block)) ? after : [];
|
|
4495
|
+
const flow = words.slice(0, words.length - under.length);
|
|
4186
4496
|
if (!flow.some((block)=>speaksHeading(scope, block))) {
|
|
4187
4497
|
flow.unshift({
|
|
4188
4498
|
kind: 'heading',
|
|
@@ -4197,17 +4507,29 @@ function listingSection(scope, blocks, placed) {
|
|
|
4197
4507
|
const _flow_lead = flow[lead], { style: _style } = _flow_lead, title = _object_without_properties_loose(_flow_lead, [
|
|
4198
4508
|
"style"
|
|
4199
4509
|
]);
|
|
4200
|
-
flow[lead] = AI_LAYOUT_HALF_HEROES.has(
|
|
4510
|
+
flow[lead] = AI_LAYOUT_HALF_HEROES.has(asked) ? title : _extends({}, title, {
|
|
4201
4511
|
style: 'large'
|
|
4202
4512
|
});
|
|
4203
4513
|
const picture = pictures[0].picture;
|
|
4204
|
-
const opening = hero(scope, flow, {
|
|
4205
|
-
alt: picture.alt,
|
|
4206
|
-
given: true
|
|
4514
|
+
const opening = hero(scope, flow, _extends({
|
|
4515
|
+
alt: (_ref = picture == null ? void 0 : picture.alt) != null ? _ref : '',
|
|
4516
|
+
given: true
|
|
4517
|
+
}, (picture == null ? void 0 : picture.src) ? {
|
|
4207
4518
|
src: picture.src
|
|
4208
|
-
},
|
|
4519
|
+
} : {}, (picture == null ? void 0 : picture.fit) ? {
|
|
4520
|
+
fit: picture.fit
|
|
4521
|
+
} : {}, film ? {
|
|
4522
|
+
video: film
|
|
4523
|
+
} : {}, under.length ? {
|
|
4524
|
+
after: under
|
|
4525
|
+
} : {}), asked);
|
|
4209
4526
|
return opening && raw.width ? widened(page.tree, opening, raw.width) : opening;
|
|
4210
4527
|
}
|
|
4528
|
+
/** The heroes that lay their picture behind the words (AGL-4140): no place for a film a visitor presses. */ const FILM_BEHIND_HEROES = new Set([
|
|
4529
|
+
'cover',
|
|
4530
|
+
'poster',
|
|
4531
|
+
'panel'
|
|
4532
|
+
]);
|
|
4211
4533
|
/** A hero of a page brought in, its columns as wide as its source runs (AGL-4083): each Container that sets the section's width, not a reading measure inside it. */ function widened(tree, id, maxWidth) {
|
|
4212
4534
|
var _ref;
|
|
4213
4535
|
var _node_props;
|