@vectoriox/iox-ui 5.140.0 → 5.142.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/assist-core/index.d.ts +19 -2
- package/design-core/index.d.ts +171 -2
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +29 -3
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +358 -172
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1671 -861
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +49 -18
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +32 -9
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +85 -4
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +525 -144
- package/harness-core/index.d.ts +18 -18
- package/index.d.ts +92 -2
- package/package.json +1 -1
- package/scene-core/index.d.ts +17 -1
- package/src/assist-core/assist-turn.ts +34 -2
- package/src/design-core/flavor-spec.generated.ts +141 -0
- package/src/design-core/ink-on-ground.ts +36 -0
- package/src/design-core/list-classes.ts +37 -0
- package/src/design-core/node-classes.ts +3 -2
- package/src/design-core/public-api.ts +2 -0
- package/src/generation-core/check-layout.ts +23 -1
- package/src/generation-core/check-list.ts +144 -5
- package/src/generation-core/compose-layout.ts +188 -23
- package/src/generation-core/compose-site.ts +14 -2
- package/src/generation-core/header-edit.ts +15 -11
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +10 -0
- package/src/generation-core/layout-wire.ts +64 -24
- package/src/generation-core/list-panel.ts +122 -0
- package/src/generation-core/list-space.ts +205 -0
- package/src/generation-core/list-table.ts +101 -0
- package/src/generation-core/node-baselines.generated.ts +3 -1
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/serialized-node.ts +2 -0
- package/src/generation-core/site-plan.model.ts +6 -0
- package/src/generation-core/site-spec.generated.ts +188 -70
- package/src/generation-core/validate-site-plan.ts +8 -4
- package/src/harness-core/harness-spec.generated.ts +49 -18
- package/src/scene-core/split-text.ts +31 -7
- package/styles/iox-design.css +438 -4
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
buildCardRecipe, buildMarqueeRecipe, CardLayout, CardPart, CardRole, CompositeNode, CompositeNodeSpec, findByRole,
|
|
2
|
+
buildCardRecipe, buildMarqueeRecipe, CardLayout, CardPart, CardRole, CompositeNode, CompositeNodeSpec, findByRole, MarqueeDirection, MarqueeRole, MarqueeSpeed,
|
|
3
|
+
NO_ELEMENT_STYLE, SceneRole, setMarqueeSettings,
|
|
3
4
|
SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderRole, syncSliderParts, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
|
|
4
5
|
} from '@vectoriox/iox-ui/composite-core';
|
|
5
6
|
|
|
6
|
-
import { ColorScheme, DesignChoices, LinkType, scrubOfChoices, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
7
|
+
import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
7
8
|
import { TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
8
9
|
import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
|
|
9
10
|
import { composeNavHeader, composePresetForm } from './compose-site';
|
|
10
11
|
import { drawnHeaderMix, headerMixOfNavKind } from './header-mix';
|
|
11
|
-
import { listWait } from './list-table';
|
|
12
|
+
import { LIST_RULES, LIST_RHYTHMS, listWait } from './list-table';
|
|
13
|
+
import { listMixWords } from './layout-wire';
|
|
12
14
|
import {
|
|
13
15
|
LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_GUTTER, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHOTO_ASPECT, LAYOUT_TOOLTIP_TRAIT,
|
|
14
16
|
LAYOUT_PHONE_PADDING, LAYOUT_RISE, LAYOUT_TEXT_KINDS, LayoutBleed, LayoutColour, LayoutEase, LayoutEnter, LayoutForm, LayoutGallery, LayoutLayer,
|
|
@@ -18,6 +20,7 @@ import {
|
|
|
18
20
|
} from './layout-language';
|
|
19
21
|
import { layoutGlideDepth } from './layout-drift';
|
|
20
22
|
import { isLayoutRule, layoutRuleEdge } from './layout-space';
|
|
23
|
+
import { LIST_DECK_MAX_PX, LIST_DECK_SHARE, listOverhang } from './list-space';
|
|
21
24
|
import { layoutDesignOf, layoutElementStyle, layoutTextWidthEm, screenWordColumns } from './layout-type';
|
|
22
25
|
import { ComposeError, createSerializedNode, SerializedNode, setStyleProps, assertStyleSlots, walkSerialized } from './serialized-node';
|
|
23
26
|
import { BUTTON_LINK_PROPS, CarryKind, PageCarry } from './carry';
|
|
@@ -136,7 +139,33 @@ export enum LayoutListRole {
|
|
|
136
139
|
StripsSwipe = 'list.strips-swipe',
|
|
137
140
|
StripItem = 'list.strip-item',
|
|
138
141
|
Item = 'list.item',
|
|
139
|
-
|
|
142
|
+
// AW11 (board award-lists): the round-two arrangements — a Repeater's role, drawn by iox-design.css from each row's
|
|
143
|
+
// index (no runtime), each with its phone variant.
|
|
144
|
+
Hang = 'list.hang',
|
|
145
|
+
HangTwo = 'list.hang-two',
|
|
146
|
+
Bento = 'list.bento',
|
|
147
|
+
Rows = 'list.rows',
|
|
148
|
+
Stage = 'list.stage',
|
|
149
|
+
Fan = 'list.fan',
|
|
150
|
+
FanStack = 'list.fan-stack',
|
|
151
|
+
Tilted = 'list.tilted',
|
|
152
|
+
TiltedTwo = 'list.tilted-two',
|
|
153
|
+
/** AW11-D16: a band of drifting picture rows (two Marquees), its rows' Repeaters. */
|
|
154
|
+
DriftRows = 'list.drift',
|
|
155
|
+
DriftRow = 'list.drift-row',
|
|
156
|
+
/** AW11-D12: an item's second picture (swap, unveil), over the first inside its frame. */
|
|
157
|
+
Second = 'list.second',
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** A round-two arrangement's Repeater role, by the phone the mix asks for (AW11). */
|
|
161
|
+
const ARRANGE_ROLE: Readonly<Partial<Record<`${LayoutListArrange}`, Readonly<Record<`${LayoutListPhone}`, LayoutListRole>>>>> = {
|
|
162
|
+
hang: { stack: LayoutListRole.Hang, swipe: LayoutListRole.Hang, 'two-up': LayoutListRole.HangTwo },
|
|
163
|
+
bento: { stack: LayoutListRole.Bento, swipe: LayoutListRole.Bento, 'two-up': LayoutListRole.Bento },
|
|
164
|
+
rows: { stack: LayoutListRole.Rows, swipe: LayoutListRole.Rows, 'two-up': LayoutListRole.Rows },
|
|
165
|
+
stage: { stack: LayoutListRole.Stage, swipe: LayoutListRole.Stage, 'two-up': LayoutListRole.Stage },
|
|
166
|
+
fan: { stack: LayoutListRole.FanStack, swipe: LayoutListRole.Fan, 'two-up': LayoutListRole.Fan },
|
|
167
|
+
tilted: { stack: LayoutListRole.Tilted, swipe: LayoutListRole.Tilted, 'two-up': LayoutListRole.TiltedTwo },
|
|
168
|
+
};
|
|
140
169
|
|
|
141
170
|
/** A strips list's Repeater role by the phone the mix asks for. */
|
|
142
171
|
const STRIPS_ROLE: Readonly<Record<`${LayoutListPhone}`, LayoutListRole>> = {
|
|
@@ -742,8 +771,16 @@ function galleryLayer(id: string, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): Seria
|
|
|
742
771
|
/** The width a row's card takes: three across a laptop, most of a phone's width with the next one peeking. */
|
|
743
772
|
const LIST_ROW_SLIDE = `calc((100% - ${2 * SLIDE_GAP}px) / 3)`;
|
|
744
773
|
const LIST_ROW_SLIDE_PHONE = '82%';
|
|
745
|
-
/** A deck is one card wide (LI4): a laptop's card, most of a phone. */
|
|
746
|
-
const LIST_DECK_WIDTH =
|
|
774
|
+
/** A deck is one card wide (LI4): a laptop's card, most of a phone — the width the list judge reads (list-space). */
|
|
775
|
+
const LIST_DECK_WIDTH = `min(${LIST_DECK_MAX_PX}px, ${LIST_DECK_SHARE * 100}%)`;
|
|
776
|
+
/** LI7: a deck's card turns in this share of the look's pace (Normal 650ms → 455ms): a card thrown, never a slide crawling. */
|
|
777
|
+
const LIST_DECK_TURN = 0.7;
|
|
778
|
+
/** LI7: the corner a list item wears — a card's the look's card radius, a picture's its image radius; a deck's slide and a
|
|
779
|
+
* strip wear it too, so a peeking card, its shading and a closed strip keep the item's own corners. */
|
|
780
|
+
const LIST_CARD_RADIUS = 'var(--iox-card-radius)';
|
|
781
|
+
const LIST_PHOTO_RADIUS = 'var(--iox-image-radius)';
|
|
782
|
+
/** A picture's deck slide carries the look's card shadow (a card carries its own). */
|
|
783
|
+
const LIST_PHOTO_SHADOW = 'var(--iox-card-shadow)';
|
|
747
784
|
const LIST_GAP = 'var(--iox-space-gap)';
|
|
748
785
|
const LIST_PHOTO_ASPECT = '4 / 3';
|
|
749
786
|
/** A row or a deck turns by itself this often (the wire's autoplay). */
|
|
@@ -773,11 +810,14 @@ function listArriveInteraction(nodeId: string, arrive: `${LayoutListArrive}`, ct
|
|
|
773
810
|
const action =
|
|
774
811
|
arrive === LayoutListArrive.Together ? { type: 'fadeIn', params: {} }
|
|
775
812
|
: arrive === LayoutListArrive.SlideIn ? { type: ctx.rtl ? 'moveRight' : 'moveLeft', params: { distance: LIST_SLIDE_DISTANCE, stagger, cap: LIST_STAGGER_CAP } }
|
|
776
|
-
:
|
|
813
|
+
// AW11-D15: each card opens from its bottom edge — the ONE keyframe map's clipReveal, with the shrinking stagger.
|
|
814
|
+
: arrive === LayoutListArrive.ClipUp ? { type: 'clipReveal', params: { from: LayoutSide.Bottom, stagger, cap: LIST_STAGGER_CAP } }
|
|
815
|
+
: { type: 'moveUp', params: { distance: LAYOUT_RISE[LayoutRole.Support], stagger, cap: LIST_STAGGER_CAP } };
|
|
816
|
+
const clip = arrive === LayoutListArrive.ClipUp;
|
|
777
817
|
return {
|
|
778
818
|
id: `${nodeId}-enter`,
|
|
779
819
|
trigger: 'viewportEnter',
|
|
780
|
-
actions: [{ type: action.type, target: 'self', duration, delay: 0, easing: ctx.ease, once: true, ...(Object.keys(action.params).length ? { params: action.params } : {}) }],
|
|
820
|
+
actions: [{ type: action.type, target: 'self', duration: clip ? Math.round(duration * CLIP_DURATION) : duration, delay: 0, easing: ctx.ease, once: true, ...(Object.keys(action.params).length ? { params: action.params } : {}) }],
|
|
781
821
|
};
|
|
782
822
|
}
|
|
783
823
|
|
|
@@ -807,6 +847,8 @@ function listCard(id: string, mix: LayoutListMix, source: string, list: LayoutLi
|
|
|
807
847
|
if (!part || !f) return part;
|
|
808
848
|
const node = role === CardRole.Media ? part.children?.find(c => c.type === T.Image) : part;
|
|
809
849
|
node?.bindings.push({ prop, source, path: f });
|
|
850
|
+
// iox-ui#111: bound words are the row's — never the recipe's own ("Category"), which a row with no value showed live.
|
|
851
|
+
if (node && prop === 'content') node.props['content'] = '';
|
|
810
852
|
return node;
|
|
811
853
|
};
|
|
812
854
|
const title = list.roles['title'];
|
|
@@ -875,6 +917,15 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
875
917
|
phone(frame, { height: 'auto' });
|
|
876
918
|
const scheme = layoutBandScheme(lc.section.ground);
|
|
877
919
|
if (scheme) setColorScheme(frame, scheme);
|
|
920
|
+
// AW11: the mix rides on the frame (design-core LIST_MIX_PROP) — the shared CSS draws its item and hover words from
|
|
921
|
+
// the classes it becomes, and Bindings ▸ List reads it back.
|
|
922
|
+
frame.props[LIST_MIX_PROP] = listMixWords(mix).join(' ');
|
|
923
|
+
// AW11 rule 2 (never cut): what leans, hangs or turns keeps its room inside the frame — its section clips.
|
|
924
|
+
const room = listOverhang(mix);
|
|
925
|
+
if (room.blockStart || room.blockEnd || room.inline) {
|
|
926
|
+
setStyleProps(frame, { padding: `${room.blockStart}px ${room.inline}px ${room.blockEnd}px ${room.inline}px` });
|
|
927
|
+
phone(frame, { padding: `${Math.round(room.blockStart / 2)}px ${Math.round(room.inline / 2)}px ${Math.round(room.blockEnd / 2)}px ${Math.round(room.inline / 2)}px` });
|
|
928
|
+
}
|
|
878
929
|
|
|
879
930
|
// A word the product does not draw yet (the contract's list table): drawn as its stand-in, and said.
|
|
880
931
|
let arrange = mix.arrange;
|
|
@@ -890,24 +941,28 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
890
941
|
if (standout && standWait) {
|
|
891
942
|
gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.standout`, `standing out (${standout.who}${standout.how ? ` · ${standout.how}` : ''}) is drawn in ${standWait.phase}`);
|
|
892
943
|
}
|
|
893
|
-
const masonry = arrange === LayoutListArrange.Masonry;
|
|
894
|
-
const item = mix.
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
if (
|
|
944
|
+
const masonry = arrange === LayoutListArrange.Masonry || arrange === LayoutListArrange.Hang;
|
|
945
|
+
const item = listItem(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips);
|
|
946
|
+
if (strips) return composeStrips(id, frame, item, mix, source, ctx, listItemRadius(mix));
|
|
947
|
+
// AW11-D16: drifting picture rows — the Marquee holding the list's pictures, twice.
|
|
948
|
+
if (mix.move.includes(LayoutListMove.Rows) && arrange === LayoutListArrange.Row && !lc.held) return composeDriftRows(id, frame, item, source, l);
|
|
898
949
|
item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
|
|
950
|
+
if (mix.arrive === LayoutListArrive.ClipUp) riseInside(item, ctx);
|
|
899
951
|
// LI4: the one that stands out — a deck's top card IS its standing out; strips draw their own (wider).
|
|
900
952
|
const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
|
|
901
953
|
|
|
902
|
-
|
|
954
|
+
const fanDragged = arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag);
|
|
955
|
+
if (arrange === LayoutListArrange.Row || deck || fanDragged) {
|
|
903
956
|
const scrollPlays = mix.move.includes(LayoutListMove.Page) && !lc.held;
|
|
904
957
|
const played = scrollPlays || lc.held;
|
|
905
958
|
const drag = mix.move.includes(LayoutListMove.Drag);
|
|
906
959
|
const slider = create(`${id}-slider`, T.Slider, {
|
|
907
960
|
// A deck (LI4) is Swiper's cards: one card on top, the rest waiting behind, dragged away or stepped.
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
961
|
+
// AW11-D1: a fan you drag is Swiper's creative effect, set by the ONE planSwiperOptions (`creativePreset: fan`).
|
|
962
|
+
dir: ctx.rtl ? 'rtl' : 'ltr', effect: deck ? 'cards' : fanDragged ? 'creative' : 'slide', slidesPerView: deck || fanDragged ? 1 : 'auto',
|
|
963
|
+
spaceBetween: deck || fanDragged ? 0 : SLIDE_GAP, ...(fanDragged ? { creativePreset: SLIDER_FAN_PRESET } : {}),
|
|
964
|
+
centeredSlides: !deck && !fanDragged && standout?.who === LayoutListWho.Middle, loop: 'off', freeMode: !deck && !fanDragged && drag && !played, grabCursor: drag && !played,
|
|
965
|
+
speed: deck ? Math.round(ctx.pace.support * LIST_DECK_TURN) : GALLERY_SPEED, enableParallax: false, enableAutoplay: mix.move.includes(LayoutListMove.Auto) && !played,
|
|
911
966
|
autoplayDelay: LIST_AUTOPLAY_MS, autoplayDisableOnInteraction: true, enableKeyboard: true, scrollPlays,
|
|
912
967
|
enableCaption: false, enableCount: false, enableNavigation: mix.move.includes(LayoutListMove.Arrows) && !played,
|
|
913
968
|
[SLIDER_PLACEMENT_TRAIT]: SliderPlacement.Under, ariaLabel: l.text ?? '',
|
|
@@ -923,18 +978,34 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
923
978
|
phone(slider, scrollPlays || deck ? { height: 'auto' } : { position: 'relative', height: 'auto' });
|
|
924
979
|
// A row keeps its own slide width on a phone (most of the screen, the next item peeking): the slider's phone
|
|
925
980
|
// default is one slide the full width, unless the phone layer names its slides per view. A deck stays a deck.
|
|
926
|
-
if (!deck) slider.responsive![LAYOUT_PHONE_BREAKPOINT]!.inputs = { slidesPerView: 'auto' };
|
|
981
|
+
if (!deck && !fanDragged) slider.responsive![LAYOUT_PHONE_BREAKPOINT]!.inputs = { slidesPerView: 'auto' };
|
|
927
982
|
if (mix.phone !== LayoutListPhone.Swipe) gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.phone`, `a ${arrange} stays one you swipe on a phone (${mix.phone} is a grid's)`);
|
|
928
983
|
const slide = create(`${id}-slide`, T.Slide, { caption: '' }, NO_ELEMENT_STYLE);
|
|
929
|
-
|
|
930
|
-
|
|
984
|
+
const oneWide = deck || fanDragged;
|
|
985
|
+
setStyleProps(slide, { width: oneWide ? FULL : LIST_ROW_SLIDE, height: FULL, display: 'flex', aspectRatio: 'auto' });
|
|
986
|
+
// LI7: a deck's peeking cards and Swiper's shading over them wear the item's corner (the shared CSS rounds the
|
|
987
|
+
// shading to the slide's), and a picture's card the look's shadow.
|
|
988
|
+
if (oneWide) setStyleProps(slide, { borderRadius: listItemRadius(mix), ...(mix.item !== LayoutListItem.Card ? { boxShadow: LIST_PHOTO_SHADOW } : {}) });
|
|
989
|
+
if (!oneWide) phone(slide, { width: LIST_ROW_SLIDE_PHONE });
|
|
931
990
|
slide.children = [shown];
|
|
932
991
|
slider.children = [slide];
|
|
933
992
|
syncSliderParts(slider as unknown as CompositeNode, partFactory(`${id}-slider`));
|
|
934
993
|
walkSerialized([slider], node => {
|
|
935
994
|
if (node.role === SliderRole.Prev || node.role === SliderRole.Next) node.props[LAYOUT_TOOLTIP_TRAIT] = node.props['ariaLabel'];
|
|
936
995
|
});
|
|
937
|
-
frame.children = [
|
|
996
|
+
frame.children = [oneWide ? deckHolder(`${id}-deck`, slider) : slider];
|
|
997
|
+
return frame;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// AW11: a round-two arrangement is a Repeater whose role the shared CSS draws from each row's index (D1).
|
|
1001
|
+
const roundTwo = ARRANGE_ROLE[arrange];
|
|
1002
|
+
if (roundTwo) {
|
|
1003
|
+
const items = create(`${id}-items`, 'Repeater', {}, 'box');
|
|
1004
|
+
items.role = roundTwo[mix.phone];
|
|
1005
|
+
items.bindings.push({ prop: 'source', source, path: '' });
|
|
1006
|
+
setStyleProps(items, { display: 'block', width: FULL });
|
|
1007
|
+
items.children = [shown];
|
|
1008
|
+
frame.children = [items];
|
|
938
1009
|
return frame;
|
|
939
1010
|
}
|
|
940
1011
|
|
|
@@ -956,6 +1027,11 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
956
1027
|
return frame;
|
|
957
1028
|
}
|
|
958
1029
|
|
|
1030
|
+
/** The corner a list's items wear (LI7). */
|
|
1031
|
+
function listItemRadius(mix: LayoutListMix): string {
|
|
1032
|
+
return mix.item === LayoutListItem.Card ? LIST_CARD_RADIUS : LIST_PHOTO_RADIUS;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
959
1035
|
/**
|
|
960
1036
|
* A deck (LI4) is a card wide, centred in its cell. The width sits on a holder, never the slider: the slider's own
|
|
961
1037
|
* scoped `.swiper { width: 100% }` out-ranks a node's width class. On a phone the holder is the cell's width and the
|
|
@@ -992,10 +1068,11 @@ function standWrap(id: string, item: SerializedNode, standout: NonNullable<Layou
|
|
|
992
1068
|
* the scrim) or the picture. Everything strips DO — the open one wider, pointing and focus, the phone — is the shared
|
|
993
1069
|
* CSS's (iox-design.css, by the Repeater's role), so the canvas and the live site draw the same strips with no runtime.
|
|
994
1070
|
*/
|
|
995
|
-
function composeStrips(id: string, frame: SerializedNode, item: SerializedNode, mix: LayoutListMix, source: string, ctx: Ctx): SerializedNode {
|
|
1071
|
+
function composeStrips(id: string, frame: SerializedNode, item: SerializedNode, mix: LayoutListMix, source: string, ctx: Ctx, radius: string): SerializedNode {
|
|
996
1072
|
const strip = create(`${id}-strip`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
997
1073
|
strip.role = LayoutListRole.StripItem;
|
|
998
|
-
|
|
1074
|
+
// LI7: the strip's clip is the item's own corner — a closed strip is a rounded strip, never a square cut of a card.
|
|
1075
|
+
setStyleProps(strip, { position: 'relative', display: 'block', width: FULL, height: FULL, minHeight: ZERO, overflow: 'hidden', borderRadius: radius });
|
|
999
1076
|
setStyleProps(item, { width: FULL, height: FULL, minHeight: ZERO });
|
|
1000
1077
|
if (item.role === LayoutListRole.Item) {
|
|
1001
1078
|
const image = item.children?.[0];
|
|
@@ -1013,6 +1090,94 @@ function composeStrips(id: string, frame: SerializedNode, item: SerializedNode,
|
|
|
1013
1090
|
return frame;
|
|
1014
1091
|
}
|
|
1015
1092
|
|
|
1093
|
+
// ── AW11 (board award-lists): the round-two items, the second picture, the clip-up's inside, the drifting rows ──────
|
|
1094
|
+
|
|
1095
|
+
/** The fan's Swiper preset (AW11-D1): planSwiperOptions draws a dragged fan from it — the ONE slider planner. */
|
|
1096
|
+
const SLIDER_FAN_PRESET = 'fan';
|
|
1097
|
+
/** A colour block's ground and ink, set per row from its own colour (AW11-D10) — `style:` bindings the renderers apply
|
|
1098
|
+
* through iox-ui `boundStyleOf`, the shared CSS's fallback the look's ramp. */
|
|
1099
|
+
const ITEM_GROUND = 'style:--list-item-ground';
|
|
1100
|
+
const ITEM_INK = 'style:--list-item-ink';
|
|
1101
|
+
const GROUND_PIPE = 'aaGround';
|
|
1102
|
+
const INK_PIPE = 'inkOnGround';
|
|
1103
|
+
/** The parts a name set on its picture keeps (AW11-D8). */
|
|
1104
|
+
const TITLE_ON_PHOTO_PARTS: ReadonlySet<string> = new Set(['image', 'title', 'meta', 'date']);
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* One list item by the mix's item word: a picture, a card (Card v2 — the palette's recipe), a card whose name is set on
|
|
1108
|
+
* its picture (the Overlay layout, title + a short detail), or a card the shared CSS dresses by the frame's mix classes
|
|
1109
|
+
* (a packshot's even tile, a colour block's own ground, a numeral). Hover words that need a second picture get it here.
|
|
1110
|
+
*/
|
|
1111
|
+
function listItem(id: string, mix: LayoutListMix, source: string, list: LayoutListBinding, masonry: boolean, path: string, ctx: Ctx, strips: boolean): SerializedNode {
|
|
1112
|
+
if (mix.item === LayoutListItem.Photo) return listPhoto(id, source, list, masonry);
|
|
1113
|
+
const onPhoto = mix.item === LayoutListItem.TitleOnPhoto;
|
|
1114
|
+
const shown = onPhoto ? { ...mix, parts: mix.parts.filter(p => TITLE_ON_PHOTO_PARTS.has(p)) } : mix;
|
|
1115
|
+
const card = listCard(id, shown, source, list, masonry && !onPhoto, path, ctx, strips || onPhoto ? CardLayout.Overlay : CardLayout.Top);
|
|
1116
|
+
if (mix.hover.some(h => h === LayoutListHover.Swap || h === LayoutListHover.Unveil)) secondPicture(card, source, list);
|
|
1117
|
+
if (mix.item === LayoutListItem.ColourBlock && list.roles['colour']) {
|
|
1118
|
+
card.bindings.push({ prop: ITEM_GROUND, source, path: list.roles['colour'], pipes: [{ name: GROUND_PIPE }] });
|
|
1119
|
+
card.bindings.push({ prop: ITEM_INK, source, path: list.roles['colour'], pipes: [{ name: INK_PIPE }] });
|
|
1120
|
+
}
|
|
1121
|
+
return card;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/** The item's second picture (swap, unveil — AW11-D12): the gallery's second, over the first inside its frame. The first
|
|
1125
|
+
* stays drawn under it, so a second still loading shows the first, never a hole. */
|
|
1126
|
+
function secondPicture(card: SerializedNode, source: string, list: LayoutListBinding): void {
|
|
1127
|
+
const gallery = list.roles['gallery'];
|
|
1128
|
+
const media = findByRole(card as unknown as CompositeNode, CardRole.Media) as SerializedNode | undefined;
|
|
1129
|
+
if (!gallery || !media) return;
|
|
1130
|
+
const second = create(`${card.id}-second`, T.Image, { src: '', alt: '' }, NO_ELEMENT_STYLE);
|
|
1131
|
+
second.role = LayoutListRole.Second;
|
|
1132
|
+
setStyleProps(second, { position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: FULL, height: FULL, maxWidth: 'none', objectFit: 'cover' });
|
|
1133
|
+
second.bindings.push({ prop: 'src', source, path: `${gallery}.1` });
|
|
1134
|
+
if (list.roles['title']) second.bindings.push({ prop: 'alt', source, path: list.roles['title'] });
|
|
1135
|
+
setStyleProps(media, { position: 'relative', overflow: 'hidden' });
|
|
1136
|
+
media.children = [...(media.children ?? []), second];
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/** The clip-up's inside (AW11-D15): the card's words rise the contract's distance as the card opens from its bottom edge. */
|
|
1140
|
+
function riseInside(item: SerializedNode, ctx: Ctx): void {
|
|
1141
|
+
const content = findByRole(item as unknown as CompositeNode, CardRole.Content) as SerializedNode | undefined;
|
|
1142
|
+
if (!content) return;
|
|
1143
|
+
const stagger = Math.round(LIST_STAGGER * ctx.pace.gap);
|
|
1144
|
+
content.interactions = [...content.interactions, {
|
|
1145
|
+
id: `${content.id}-enter`,
|
|
1146
|
+
trigger: 'viewportEnter',
|
|
1147
|
+
actions: [{ type: 'moveUp', target: 'self', duration: ctx.pace.support, delay: Math.round(ctx.pace.support / 3), easing: ctx.ease, once: true,
|
|
1148
|
+
params: { distance: LIST_RHYTHMS.clipUpRise, stagger, cap: LIST_STAGGER_CAP } }],
|
|
1149
|
+
}];
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Drifting picture rows (AW11-D16): two Marquees (the M6 recipe — a pause control first, still under reduced motion and a
|
|
1154
|
+
* look whose motion is Off, the ends faded), each holding the list's pictures, at different speeds and opposite ways.
|
|
1155
|
+
*/
|
|
1156
|
+
function composeDriftRows(id: string, frame: SerializedNode, item: SerializedNode, source: string, l: LayoutLayer): SerializedNode {
|
|
1157
|
+
frame.role = LayoutListRole.DriftRows;
|
|
1158
|
+
const rows: SerializedNode[] = [
|
|
1159
|
+
{ speed: MarqueeSpeed.Normal, direction: MarqueeDirection.Start },
|
|
1160
|
+
{ speed: MarqueeSpeed.Slow, direction: MarqueeDirection.End },
|
|
1161
|
+
].map((how, k) => {
|
|
1162
|
+
const band = buildMarqueeRecipe(partFactory(`${id}-row${k + 1}`), { words: [] }) as unknown as SerializedNode;
|
|
1163
|
+
setMarqueeSettings(band as unknown as CompositeNode, { ...how, fade: true });
|
|
1164
|
+
const track = findByRole(band as unknown as CompositeNode, MarqueeRole.Track) as SerializedNode | undefined;
|
|
1165
|
+
const items = create(`${id}-row${k + 1}-items`, 'Repeater', {}, 'box');
|
|
1166
|
+
items.role = LayoutListRole.DriftRow;
|
|
1167
|
+
items.bindings.push({ prop: 'source', source, path: '' });
|
|
1168
|
+
setStyleProps(items, { display: 'block', width: 'auto' });
|
|
1169
|
+
const copy = structuredClone(item);
|
|
1170
|
+
walkSerialized([copy], n => { n.id = n.id.replace(`${id}-item`, `${id}-row${k + 1}-item`); });
|
|
1171
|
+
items.children = [copy];
|
|
1172
|
+
if (track) track.children = [items];
|
|
1173
|
+
if (l.text) band.props['ariaLabel'] = l.text;
|
|
1174
|
+
return band;
|
|
1175
|
+
});
|
|
1176
|
+
setStyleProps(frame, { display: 'flex', flexDirection: 'column', gap: LIST_GAP });
|
|
1177
|
+
frame.children = rows;
|
|
1178
|
+
return frame;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1016
1181
|
/** Recipe parts stamped with this composer's ids (`<id>-<key>`). */
|
|
1017
1182
|
function partFactory(id: string): (spec: CompositeNodeSpec) => CompositeNode {
|
|
1018
1183
|
return spec => create(`${id}-${spec.key}`, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as unknown as CompositeNode;
|
|
@@ -531,7 +531,7 @@ export function layoutGalleryLists(plan: SitePlan): LayoutGalleryList[] {
|
|
|
531
531
|
/** The words a list's roles are called in the brief — what a visitor would see, never the field name. */
|
|
532
532
|
export const LIST_ROLE_WORDS: Readonly<Record<`${ContentRole}`, string>> = {
|
|
533
533
|
title: 'name', summary: 'summary', image: 'picture', meta: 'detail', date: 'date', gallery: 'pictures',
|
|
534
|
-
logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', price: 'price', compareAt: 'earlier price',
|
|
534
|
+
logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', colour: 'colour', price: 'price', compareAt: 'earlier price',
|
|
535
535
|
};
|
|
536
536
|
/** A text role whose planned samples run past this many words (median) is called long: a small card would cut it. */
|
|
537
537
|
export const LIST_LONG_WORDS = 20;
|
|
@@ -556,7 +556,13 @@ export function layoutListShapes(plan: SitePlan): LayoutListShape[] {
|
|
|
556
556
|
});
|
|
557
557
|
// A shop list holds the plan's sample products (the build writes them unless the shop has its own).
|
|
558
558
|
const count = d.type === PlanDataSourceType.Shop ? plan.shop?.products?.length : type?.seed?.count;
|
|
559
|
-
|
|
559
|
+
// AW11: how long the planned names run (a long one is not set on its picture).
|
|
560
|
+
const titleField = roleField(type, ContentRole.Title);
|
|
561
|
+
const titles = titleField ? (perItem[titleField] ?? []).filter(s => typeof s === 'string') : [];
|
|
562
|
+
return {
|
|
563
|
+
alias: d.alias, label: type?.label ?? d.alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
|
|
564
|
+
...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
|
|
565
|
+
};
|
|
560
566
|
});
|
|
561
567
|
}
|
|
562
568
|
|
|
@@ -601,12 +607,18 @@ export function layoutGallerySources(plan: SitePlan): string[] {
|
|
|
601
607
|
return layoutGalleryLists(plan).filter(l => l.pictures).map(l => l.alias);
|
|
602
608
|
}
|
|
603
609
|
|
|
610
|
+
/** The prop a node's words live in (iox-ui#111: emptied when it is bound). */
|
|
611
|
+
const BOUND_WORDS_PROP = 'content';
|
|
612
|
+
|
|
604
613
|
function addBinding(node: SerializedNode, binding: SerializedBinding): void {
|
|
605
614
|
const declared = NODE_BASELINES[node.type]?.traits ?? [];
|
|
606
615
|
if (!declared.includes(binding.prop) && !binding.prop.startsWith('routeParam:')) {
|
|
607
616
|
throw new ComposeError(`${node.type} has no trait "${binding.prop}" to bind`);
|
|
608
617
|
}
|
|
609
618
|
node.bindings.push(binding);
|
|
619
|
+
// iox-ui#111: bound words are the row's — never the recipe's or the type's own ("Category", "Card title", "Enter text
|
|
620
|
+
// here"): a renderer keeps the static words when the row has no value there, and they reached the live site.
|
|
621
|
+
if (binding.prop === BOUND_WORDS_PROP) node.props[BOUND_WORDS_PROP] = '';
|
|
610
622
|
}
|
|
611
623
|
|
|
612
624
|
function assertTraits(type: string, names: ReadonlyArray<string>): void {
|
|
@@ -31,8 +31,8 @@ const STORE_SLOT_ROLES: ReadonlySet<string> = new Set([ShopRole.CartButton, Acco
|
|
|
31
31
|
/** The roles that link to one of the site's pages (the bar's row, the drawer's list, the bottom bar's items). */
|
|
32
32
|
const PAGE_LINK_ROLES: ReadonlySet<string> = new Set([NavRole.Link, NavRole.DrawerLink, NavRole.BarItem]);
|
|
33
33
|
|
|
34
|
-
/** The pages a header and its companions link to, in their order, once each — what the header is recomposed with
|
|
35
|
-
*
|
|
34
|
+
/** The pages a header and its companions link to, in their order, once each — what the header is recomposed with: a mix
|
|
35
|
+
* change never takes the owner's links away, nor adds the studio's other pages (CC1's `phoneMenuPages`; iox-cms-client#82). */
|
|
36
36
|
function pagesOfHeader(current: SerializedNode, companions: ReadonlyArray<SerializedNode>): HeaderSite['pages'] {
|
|
37
37
|
const out: { name: string; route: string }[] = [];
|
|
38
38
|
const walk = (n: SerializedNode): void => {
|
|
@@ -44,14 +44,18 @@ function pagesOfHeader(current: SerializedNode, companions: ReadonlyArray<Serial
|
|
|
44
44
|
return out;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The site a header is read, recomposed and advised for (`readHeader`, `applyHeaderMix`, and the studio's `headerAdvice`):
|
|
49
|
+
* the pages are the ones the header links to — every ingredient is HOW the header shows its pages, never WHICH (the
|
|
50
|
+
* Pages word is inline / menu / menu-pinned), so an Apply keeps the bar's links exactly (iox-cms-client#82: changing only
|
|
51
|
+
* "Its colours follow" re-made the bar with every page the studio ever had — drafts, archived `-previous` copies, legal
|
|
52
|
+
* pages). Only a header that links to no page takes the studio's. A header that holds the bag or the account entry is a
|
|
53
|
+
* selling site's (unless the site says). Pure.
|
|
54
|
+
*/
|
|
55
|
+
export function headerSiteFor(site: HeaderSite, current: SerializedNode, companions: ReadonlyArray<SerializedNode> = []): HeaderSite {
|
|
50
56
|
let at = site;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (own.length) at = { ...at, pages: own };
|
|
54
|
-
}
|
|
57
|
+
const own = pagesOfHeader(current, companions);
|
|
58
|
+
if (own.length) at = { ...at, pages: own };
|
|
55
59
|
if (at.storeSlots !== undefined) return at;
|
|
56
60
|
let sells = false;
|
|
57
61
|
const walk = (n: SerializedNode): void => { if (n.role && STORE_SLOT_ROLES.has(n.role)) sells = true; (n.children ?? []).forEach(walk); };
|
|
@@ -189,7 +193,7 @@ function compose(mix: HeaderMix, site: HeaderSite, id: string, options: HeaderEd
|
|
|
189
193
|
export function readHeader(root: SerializedNode, site: HeaderSite, options: HeaderEditOptions = {}): HeaderReading {
|
|
190
194
|
const stored = storedHeaderMix(root);
|
|
191
195
|
const mix = stored ?? nearestHeaderMix(root, options.companions ?? []);
|
|
192
|
-
const custom = headerShape(root) !== headerShape(compose(mix,
|
|
196
|
+
const custom = headerShape(root) !== headerShape(compose(mix, headerSiteFor(site, root, options.companions), root.id, options).header);
|
|
193
197
|
return { mix, stored: !!stored, custom, galleryId: headerGalleryIdOf(mix) };
|
|
194
198
|
}
|
|
195
199
|
|
|
@@ -240,7 +244,7 @@ function wordsOf(n: SerializedNode): string {
|
|
|
240
244
|
export function applyHeaderMix(current: SerializedNode, next: HeaderMix, site: HeaderSite, options: HeaderEditOptions = {}): HeaderApplied {
|
|
241
245
|
const curCompanions = options.companions ?? [];
|
|
242
246
|
const baseMix = storedHeaderMix(current) ?? nearestHeaderMix(current, curCompanions);
|
|
243
|
-
const at =
|
|
247
|
+
const at = headerSiteFor(site, current, curCompanions);
|
|
244
248
|
const baseComposed = compose(baseMix, at, current.id, options);
|
|
245
249
|
const composed = compose(next, at, current.id, options);
|
|
246
250
|
const freshGroup = clone(grouped(composed.header, composed.companions));
|
|
@@ -4,6 +4,7 @@ import { layoutPresetColours, splitSide } from './check-layout';
|
|
|
4
4
|
import { LayoutColour, LayoutEnter, LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutListMix, LayoutListWho, LayoutPage, LayoutRole, LayoutSection, LayoutSectionKind, LayoutSize, LayoutTrackProp } from './layout-language';
|
|
5
5
|
import { FooterMix, footerMixOfPlan, footerTokenOf } from './footer-mix';
|
|
6
6
|
import { HeaderMix, headerTokenOf, wornHeaderOfPlan } from './header-mix';
|
|
7
|
+
import { listWordTier } from './list-table';
|
|
7
8
|
import { PHOTO_LIGHT_LUMINANCE, PhotoTone } from './photo-inventory';
|
|
8
9
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
9
10
|
|
|
@@ -101,7 +102,10 @@ export const LAYOUT_LIST_TOKEN = 'list';
|
|
|
101
102
|
export function listTokenOf(mix: LayoutListMix): string {
|
|
102
103
|
const who = mix.standout && mix.standout.who !== LayoutListWho.None ? `${mix.standout.who}${mix.standout.how ? `-${mix.standout.how}` : ''}` : 'none';
|
|
103
104
|
const moves = Array.isArray(mix.move) && mix.move.length ? [...new Set(mix.move)].sort().join('+') : 'still';
|
|
104
|
-
|
|
105
|
+
// AW11-D18: a round-two item (a name on its picture, a packshot, a colour block, a numeral) is seen at once too — it
|
|
106
|
+
// joins the token; a round-one item adds nothing, so every fingerprint stored before AW11 reads as it did.
|
|
107
|
+
const item = typeof mix.item === 'string' && listWordTier('item', mix.item) === 'pro' ? `/${mix.item}` : '';
|
|
108
|
+
return `${LAYOUT_LIST_TOKEN}:${mix.arrange}/${who}/${moves}${item}`;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
/** A section's token in the sequence: a list section's mix, else its kind (`sequenceTokenOf`). */
|
|
@@ -470,6 +470,10 @@ export enum LayoutMendKind {
|
|
|
470
470
|
/** A list section's mix that breaks a list rule the composer can settle (list-ingredients §6, `checkList`): the layer
|
|
471
471
|
* takes the repaired mix — every repair of one list carries the same one. */
|
|
472
472
|
List = 'list',
|
|
473
|
+
/** LI7: a list section that reads empty — the list beside an empty side of its section, or on its own with nothing that
|
|
474
|
+
* reads (`layoutListBare`): its words are set beside it, the list's own name as its heading where none reads
|
|
475
|
+
* (`layoutListPair`). Places change, words never (the name is the plan's). */
|
|
476
|
+
ListWords = 'list-words',
|
|
473
477
|
/** A carried part whose action points at a node the new page no longer has (RD1 — a scroll link to a section that
|
|
474
478
|
* left): the action is dropped from the carry and the drop is said (`mendCarry`), never refused. */
|
|
475
479
|
Link = 'link',
|
|
@@ -512,6 +516,11 @@ export interface LayoutListShape {
|
|
|
512
516
|
roles: ReadonlyArray<string>;
|
|
513
517
|
/** Text roles whose planned samples run long (median over LIST_LONG_WORDS words). */
|
|
514
518
|
long: ReadonlyArray<string>;
|
|
519
|
+
/** AW11: the planned titles' median word count — a long name is not set on its picture (absent: not measured). */
|
|
520
|
+
titleWords?: number | null;
|
|
521
|
+
/** AW11-D9: every picture of the list stands on a plain, even ground (`assets.plainEdge`, measured at upload) — a
|
|
522
|
+
* packshot needs it; false: drawn as cards. Absent or null: not measured (the planned samples are). */
|
|
523
|
+
plainPictures?: boolean | null;
|
|
515
524
|
}
|
|
516
525
|
|
|
517
526
|
/** An accent band the accent mend may move, and the ground it takes. */
|
|
@@ -531,6 +540,7 @@ export type LayoutMend =
|
|
|
531
540
|
| { kind: LayoutMendKind.Unpin; section: number }
|
|
532
541
|
| { kind: LayoutMendKind.Screens; sections: ReadonlyArray<{ section: number; screens: number }> }
|
|
533
542
|
| { kind: LayoutMendKind.List; layer: string; mix: LayoutListMix }
|
|
543
|
+
| { kind: LayoutMendKind.ListWords; section: number; layer: number; side: 'start' | 'end'; heading?: string }
|
|
534
544
|
| { kind: LayoutMendKind.Link; handle: string; from: string; to: string }
|
|
535
545
|
| { kind: LayoutMendKind.ShowList; layer: string; source: string; mix: LayoutListMix };
|
|
536
546
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutTrack,
|
|
7
7
|
} from './layout-language';
|
|
8
8
|
import { isPlainObject, PlainObject } from './shape-check';
|
|
9
|
-
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords } from './list-table';
|
|
9
|
+
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords, listWordOffered, listWordRefusal } from './list-table';
|
|
10
10
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
11
11
|
import type { LayoutListNever } from './check-list';
|
|
12
12
|
|
|
@@ -50,12 +50,16 @@ export enum LayoutMixIngredient {
|
|
|
50
50
|
Phone = 'phone',
|
|
51
51
|
}
|
|
52
52
|
const MIX_SEPARATOR = ':';
|
|
53
|
+
const BASIC = 'basic';
|
|
54
|
+
const AWARD = 'award';
|
|
53
55
|
const PART_SEPARATOR = '.';
|
|
54
56
|
/** Every word a stored mix may hold, ingredient by ingredient (a waiting word too: a stored answer still reads). */
|
|
55
57
|
export const LAYOUT_MIX_WORDS: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listIngredientWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
56
|
-
/** The words the wire OFFERS — the built ones only (ingredients.md §3.3
|
|
57
|
-
* site that asked for it. */
|
|
58
|
-
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
58
|
+
/** The words the wire OFFERS a site below the award tier — the built ones only (ingredients.md §3.3: a waiting word would
|
|
59
|
+
* put its stand-in on every site that asked for it), less the award tier's (AW-D23, AW11). */
|
|
60
|
+
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).filter(w => listWordOffered(k, w, BASIC)).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
61
|
+
/** AW11: every built word, the award tier's included — what the wire offers an award site before the lists are read. */
|
|
62
|
+
export const LAYOUT_MIX_OFFERED_AWARD: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
59
63
|
|
|
60
64
|
/** A list a composed page may show, as the wire's parts enum needs it (`layoutListShapes` gives these). */
|
|
61
65
|
export interface LayoutWireList { alias: string; roles: ReadonlyArray<string> }
|
|
@@ -66,6 +70,9 @@ export interface LayoutWireOptions {
|
|
|
66
70
|
lists?: ReadonlyArray<LayoutWireList>;
|
|
67
71
|
/** L-D12: what this business type's lists never do — those words are not offered (the check repairs one anyway). */
|
|
68
72
|
never?: LayoutListNever | null;
|
|
73
|
+
/** AW-D23 (AW11): the tier the site is built at — the award tier alone is offered the round-two list words. Absent:
|
|
74
|
+
* below it (no property changes either way). */
|
|
75
|
+
tier?: string | null;
|
|
69
76
|
/** A redesign (site-redesign RD2, H3): THIS page's carry handles (`carryHandles`) — given, every layer carries `carry`,
|
|
70
77
|
* closed to these handles: a model can place only the page's own parts (one property: 38, 40 with lists). */
|
|
71
78
|
carry?: ReadonlyArray<string>;
|
|
@@ -98,10 +105,28 @@ export function isSectionCarryHandle(handle: string): boolean {
|
|
|
98
105
|
return SECTION_HANDLE.test(handle);
|
|
99
106
|
}
|
|
100
107
|
|
|
101
|
-
/**
|
|
102
|
-
|
|
108
|
+
/** AW11: what else decides a word's offer — the tier (absent: below the award tier) and the plan's lists (absent: not
|
|
109
|
+
* judged). */
|
|
110
|
+
export interface LayoutMixOfferOptions {
|
|
111
|
+
readonly tier?: string | null;
|
|
112
|
+
readonly lists?: ReadonlyArray<LayoutWireList>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The mix words offered to a business whose lists never do `never` (L-D12): the built words less the forbidden ones —
|
|
117
|
+
* and since AW11, the award tier's only to an award site, and a word NO list of the plan can carry (a second picture, a
|
|
118
|
+
* picture at all) never (R-H-AW11-7: the one table, `listWordRefusal`; `checkList` judges each list).
|
|
119
|
+
*/
|
|
120
|
+
export function layoutMixOffered(never?: LayoutListNever | null, options: LayoutMixOfferOptions = {}): string[] {
|
|
103
121
|
const banned = new Set([...(never?.arranges ?? []).map(w => `arrange${MIX_SEPARATOR}${w}`), ...(never?.moves ?? []).map(w => `move${MIX_SEPARATOR}${w}`)]);
|
|
104
|
-
|
|
122
|
+
const offered = options.tier === AWARD ? LAYOUT_MIX_OFFERED_AWARD : LAYOUT_MIX_OFFERED;
|
|
123
|
+
const lists = options.lists;
|
|
124
|
+
return offered.filter(w => {
|
|
125
|
+
if (banned.has(w)) return false;
|
|
126
|
+
if (!lists?.length) return true;
|
|
127
|
+
const [k, word] = w.split(MIX_SEPARATOR) as [typeof LIST_INGREDIENTS[number], string];
|
|
128
|
+
return lists.some(l => listWordRefusal(k, word, l) === null);
|
|
129
|
+
});
|
|
105
130
|
}
|
|
106
131
|
const mixHint = (offered: ReadonlyArray<string>) => LIST_INGREDIENTS.map(k => {
|
|
107
132
|
const words = offered.filter(w => w.startsWith(`${k}${MIX_SEPARATOR}`)).map(w => w.slice(k.length + MIX_SEPARATOR.length));
|
|
@@ -140,9 +165,11 @@ const closed = (properties: Record<string, JsonSchema>, d?: string) => jsonClose
|
|
|
140
165
|
/** The strict format for one composed page — with the list ingredients when `options.lists` is given. */
|
|
141
166
|
export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchema {
|
|
142
167
|
const partWords = options.lists ? layoutWirePartWords(options.lists) : [];
|
|
168
|
+
// A list (round one) keeps today's offer exactly: the plan's lists narrow only what the award tier adds.
|
|
169
|
+
const mixOffered = options.tier === AWARD ? layoutMixOffered(options.never, { tier: AWARD, lists: options.lists }) : layoutMixOffered(options.never);
|
|
143
170
|
const lists: Record<string, JsonSchema> = options.lists
|
|
144
171
|
? {
|
|
145
|
-
mix: listOf(jsonOneOf(
|
|
172
|
+
mix: listOf(jsonOneOf(mixOffered), `gallery showing a list (source): how its items are shown, one word per choice — ${mixHint(mixOffered)}; [] for none`),
|
|
146
173
|
parts: listOf(jsonOneOf(partWords.length ? partWords : [NONE]), "gallery showing a list as cards: the list's fields each card shows, <list>.<role>, the source's own; [] for none"),
|
|
147
174
|
}
|
|
148
175
|
: {};
|
|
@@ -236,6 +263,21 @@ function expandGallery(l: PlainObject, flags: ReadonlySet<string>, variant: stri
|
|
|
236
263
|
* parts of another list than the gallery's are left out, and the first part names the list when `source` is empty. */
|
|
237
264
|
function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix | null {
|
|
238
265
|
const words = strings(l['mix']);
|
|
266
|
+
if (!words.length) return null;
|
|
267
|
+
const parts = strings(l['parts']).filter(p => p !== NONE).map(p => {
|
|
268
|
+
const at = p.lastIndexOf(PART_SEPARATOR);
|
|
269
|
+
return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
|
|
270
|
+
}).filter((p): p is { list: string; role: string } => !!p);
|
|
271
|
+
if (!gallery.source && parts[0]) gallery.source = parts[0].list;
|
|
272
|
+
return listMixFromWords(words, parts.filter(p => p.list === gallery.source).map(p => p.role));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* `<ingredient>:<word>` words (the wire's `mix`, or what a composed list's frame stores — design-core `LIST_MIX_PROP`)
|
|
277
|
+
* and the roles each item shows → a list mix, or null when there are no words. Words are kept as written (`checkList`
|
|
278
|
+
* judges them); what is not named takes the wire's defaults. Bindings ▸ List reads a list back through this.
|
|
279
|
+
*/
|
|
280
|
+
export function listMixFromWords(words: ReadonlyArray<string>, parts: ReadonlyArray<string> = []): LayoutListMix | null {
|
|
239
281
|
if (!words.length) return null;
|
|
240
282
|
const picked = new Map<string, string[]>();
|
|
241
283
|
for (const w of words) {
|
|
@@ -243,12 +285,7 @@ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix |
|
|
|
243
285
|
if (at > 0) (picked.get(w.slice(0, at)) ?? picked.set(w.slice(0, at), []).get(w.slice(0, at))!).push(w.slice(at + 1));
|
|
244
286
|
}
|
|
245
287
|
const one = (k: LayoutMixIngredient) => picked.get(k)?.[0];
|
|
246
|
-
const
|
|
247
|
-
const at = p.lastIndexOf(PART_SEPARATOR);
|
|
248
|
-
return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
|
|
249
|
-
}).filter((p): p is { list: string; role: string } => !!p);
|
|
250
|
-
if (!gallery.source && parts[0]) gallery.source = parts[0].list;
|
|
251
|
-
const own = parts.filter(p => p.list === gallery.source).map(p => p.role);
|
|
288
|
+
const own = [...parts];
|
|
252
289
|
const arrange = (one(LayoutMixIngredient.Arrange) ?? LayoutListArrange.Row) as LayoutListMix['arrange'];
|
|
253
290
|
const who = one(LayoutMixIngredient.Who);
|
|
254
291
|
const how = one(LayoutMixIngredient.How);
|
|
@@ -264,18 +301,21 @@ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix |
|
|
|
264
301
|
};
|
|
265
302
|
}
|
|
266
303
|
|
|
304
|
+
/** A list mix's words, `<ingredient>:<word>` — the wire's `mix`, and what a composed list's frame stores (AW11,
|
|
305
|
+
* design-core `LIST_MIX_PROP`) for Bindings ▸ List and the shared CSS. */
|
|
306
|
+
export function listMixWords(mix: LayoutListMix): string[] {
|
|
307
|
+
const w = (k: LayoutMixIngredient, v: string) => `${k}${MIX_SEPARATOR}${v}`;
|
|
308
|
+
return [
|
|
309
|
+
w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
|
|
310
|
+
...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
|
|
311
|
+
...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
|
|
312
|
+
w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
|
|
267
316
|
/** A list mix → the wire's `mix` words and `parts`. */
|
|
268
317
|
function listMixToWire(mix: LayoutListMix, source: string): { mix: string[]; parts: string[] } {
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
mix: [
|
|
272
|
-
w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
|
|
273
|
-
...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
|
|
274
|
-
...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
|
|
275
|
-
w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
|
|
276
|
-
],
|
|
277
|
-
parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`),
|
|
278
|
-
};
|
|
318
|
+
return { mix: listMixWords(mix), parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`) };
|
|
279
319
|
}
|
|
280
320
|
|
|
281
321
|
function expandTrack(t: PlainObject): LayoutTrack {
|