@vectoriox/iox-ui 5.162.0 → 5.164.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/actions-core/index.d.ts +171 -3
- package/assist-core/index.d.ts +3 -2
- package/composite-core/index.d.ts +195 -3
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +243 -2
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -5
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +413 -163
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +456 -27
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +140 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +83 -23
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +387 -11
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +87 -12
- package/harness-core/index.d.ts +132 -2
- package/index.d.ts +108 -3
- package/package.json +1 -1
- package/scene-core/index.d.ts +45 -13
- package/src/actions-core/popup-arrival.ts +328 -0
- package/src/actions-core/public-api.ts +1 -0
- package/src/assist-core/media-generate.ts +6 -5
- package/src/composite-core/composite-kinds.ts +9 -0
- package/src/composite-core/popup.ts +285 -0
- package/src/composite-core/public-api.ts +1 -0
- package/src/generation-core/ai-run.ts +65 -2
- package/src/generation-core/check-layout.ts +34 -4
- package/src/generation-core/compose-layout.ts +211 -10
- package/src/generation-core/compose-site.ts +2 -0
- package/src/generation-core/layout-drawers.ts +106 -0
- package/src/generation-core/layout-fingerprint.ts +3 -0
- package/src/generation-core/layout-language.ts +4 -0
- package/src/generation-core/layout-space.ts +3 -2
- package/src/generation-core/layout-wire.ts +15 -3
- package/src/generation-core/patterns.ts +4 -0
- package/src/generation-core/pictures.ts +4 -3
- package/src/generation-core/site-spec.generated.ts +57 -5
- package/src/harness-core/business-types.ts +2 -0
- package/src/harness-core/harness-spec.generated.ts +83 -0
- package/src/harness-core/popup-stance.ts +111 -0
- package/src/harness-core/public-api.ts +1 -0
- package/src/scene-core/scene.ts +3 -0
- package/src/scene-core/scroll-driver.ts +97 -25
- package/styles/iox-design.css +141 -2
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from '@vectoriox/iox-ui/composite-core';
|
|
6
6
|
|
|
7
7
|
import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
8
|
-
import { SCENE_TRACK_EASE, SceneEase, SceneProp, TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
8
|
+
import { SCENE_TRACK_EASE, SceneEase, SceneProp, SceneRange, SceneRevealFrom, TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
9
9
|
import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
|
|
10
10
|
import { composeNavHeader, composePresetForm } from './compose-site';
|
|
11
11
|
import { drawnHeaderMix, headerMixOfNavKind } from './header-mix';
|
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
screenFontSize,
|
|
22
22
|
} from './layout-language';
|
|
23
23
|
import { layoutGlideDepth } from './layout-drift';
|
|
24
|
+
import { DRAWER_SPINE, drawerRamp, drawerRestX, drawersTiming, drawerSteps, drawerWidth, isDrawers } from './layout-drawers';
|
|
25
|
+
import { LayoutSignatureId, signatureOf } from './layout-fingerprint';
|
|
24
26
|
import {
|
|
25
27
|
LAYOUT_BLEED_END_LINE, LAYOUT_BLEED_START_LINE, LAYOUT_INSET, layoutBledBarInset, layoutColumnPx, layoutColumnStart, layoutColumnWord, layoutGapPx,
|
|
26
28
|
layoutGridColumns, layoutGridLine, layoutGridPx,
|
|
@@ -82,6 +84,9 @@ export enum LayoutGapCode {
|
|
|
82
84
|
/** AW10: a layer saying `scrub` that the look's By the scroll does not take, or in the first screen — it plays once
|
|
83
85
|
* (`checkLayout` mends it before; a stored layout is composed as is and said). */
|
|
84
86
|
Scrub = 'scrub',
|
|
87
|
+
/** AW10: a drawers step's words stand still as the step slides in — their arrival when it lands is AW10's (an entrance
|
|
88
|
+
* played at a key). The layout's entrance on them is dropped. */
|
|
89
|
+
DrawerWords = 'drawer-words',
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
export interface LayoutGap {
|
|
@@ -521,7 +526,39 @@ function depthInteraction(nodeId: string, depth: string): unknown {
|
|
|
521
526
|
|
|
522
527
|
const TRACK_REST: Readonly<Record<string, number>> = { x: 0, y: 0, scale: 1, rotate: 0, opacity: 1, clip: 100, words: 100 };
|
|
523
528
|
|
|
524
|
-
interface SceneTrackOut { prop: string; keys: Array<[number, number]>; from?: string; ease?: SceneEase }
|
|
529
|
+
interface SceneTrackOut { prop: string; keys: Array<[number, number]>; from?: string; ease?: SceneEase; range?: SceneRange }
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* AW9 gap 4 (award plan "Reddottours" S1, the window that opens): a held picture that opens by its clip opens from a
|
|
533
|
+
* FRAME — 60% showing from the centre, the section's ground around it (theirs: `inset(20%)`) — never from a slit.
|
|
534
|
+
*/
|
|
535
|
+
const FRAMED_SHOWING = 60;
|
|
536
|
+
/** …and sinks as the Scene leaves: 30% of the stage over the root's leaving, so the next band rises over it (theirs:
|
|
537
|
+
* `yPercent 30`). Measured over the exit range, after the hold. */
|
|
538
|
+
const WINDOW_SINK: Readonly<SceneTrackOut> = { prop: SceneProp.Y, range: SceneRange.Exit, keys: [[0, 0], [1, 30]] };
|
|
539
|
+
/** Reddottours S3: a walk's picture is over-scaled ×1.2 inside its frame and drifts against the row while it crosses the
|
|
540
|
+
* screen (theirs: `xPercent 0 → 20` over its own crossing). The drift's reach, as a share of the frame's width, keeps
|
|
541
|
+
* inside the over-scale's slack on both sides (0.08 × 1.2 < 0.1). */
|
|
542
|
+
const WALK_DRIFT_SCALE = 0.2;
|
|
543
|
+
const WALK_DRIFT_SHARE = 0.08;
|
|
544
|
+
|
|
545
|
+
/** The framed window: a held picture's opening clip, from the centre and from a frame, never from less. */
|
|
546
|
+
function framedWindow(track: SceneTrackOut): SceneTrackOut {
|
|
547
|
+
const keys = track.keys.map(([at, v], i): [number, number] => [at, i === 0 ? Math.max(FRAMED_SHOWING, v) : v]);
|
|
548
|
+
return { ...track, from: SceneRevealFrom.Centre, keys };
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/** Does this held layer open the section's window (`photo-unveiled`): a picture whose clip grows to showing it whole? */
|
|
552
|
+
function opensWindow(l: LayoutLayer, lc: LayerCtx): boolean {
|
|
553
|
+
if (l.kind !== LayoutLayerKind.Photo || lc.track > 1 || signatureOf(lc.section) !== LayoutSignatureId.PhotoUnveiled) return false;
|
|
554
|
+
return (l.motion ?? []).some(t => t.prop === LayoutTrackProp.Clip && Number(t.to) >= 100 && Number(t.to) > Number(t.from));
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** A walk's picture drifting inside its frame as it crosses the screen: ± its share of the frame's width, in cqw. */
|
|
558
|
+
function walkDrift(l: LayoutLayer): SceneTrackOut {
|
|
559
|
+
const reach = Math.round(((l.col[1] - l.col[0]) / GRID_COLUMNS) * 100 * WALK_DRIFT_SHARE * 100) / 100;
|
|
560
|
+
return { prop: SceneProp.X, range: SceneRange.CrossInline, keys: [[0, -reach], [1, reach]] };
|
|
561
|
+
}
|
|
525
562
|
|
|
526
563
|
/** The layout's eases the product's tracks can run (RT-D1); anything else is drawn as the property's own. */
|
|
527
564
|
const TRACK_EASE: Readonly<Partial<Record<LayoutEase, SceneEase>>> = { [LayoutEase.Linear]: SceneEase.Linear, [LayoutEase.InOut]: SceneEase.Smooth };
|
|
@@ -669,7 +706,7 @@ function listLayer(id: string, l: LayoutLayer, ctx: Ctx): SerializedNode {
|
|
|
669
706
|
return frame;
|
|
670
707
|
}
|
|
671
708
|
|
|
672
|
-
function photoLayer(id: string, l: LayoutLayer, ctx: Ctx, path: string): { frame: SerializedNode; image: SerializedNode } {
|
|
709
|
+
function photoLayer(id: string, l: LayoutLayer, ctx: Ctx, path: string, walking = false): { frame: SerializedNode; image: SerializedNode } {
|
|
673
710
|
const photoId = l.photo?.id ?? '';
|
|
674
711
|
const frame = create(id, T.Container, {}, NO_ELEMENT_STYLE);
|
|
675
712
|
// Its cell gives it both sides (the shape is ignored there); where it stacks, its width and its shape give it a height.
|
|
@@ -683,7 +720,8 @@ function photoLayer(id: string, l: LayoutLayer, ctx: Ctx, path: string): { frame
|
|
|
683
720
|
// A picture with room to drift is over-scaled inside its frame (M8-G5: the drift itself has no speed of its own). The
|
|
684
721
|
// scale sits on a box between them: an Image's own size is capped at its frame (vectoriox/iox-ui#8), and its
|
|
685
722
|
// transform belongs to its entrance (zoomOut).
|
|
686
|
-
const
|
|
723
|
+
const inner = INNER_SCALE * Math.max(0, Math.min(3, l.inner ?? 0));
|
|
724
|
+
const k = walking ? Math.max(inner, WALK_DRIFT_SCALE) : inner;
|
|
687
725
|
if (!k) {
|
|
688
726
|
frame.children = [image];
|
|
689
727
|
return { frame, image };
|
|
@@ -692,7 +730,11 @@ function photoLayer(id: string, l: LayoutLayer, ctx: Ctx, path: string): { frame
|
|
|
692
730
|
const scale = String(Math.round((1 + k) * 1000) / 1000);
|
|
693
731
|
setStyleProps(drift, { width: FULL, height: FULL, scaleX: scale, scaleY: scale });
|
|
694
732
|
drift.children = [image];
|
|
695
|
-
|
|
733
|
+
if (walking) {
|
|
734
|
+
// On a phone the walk is a row the visitor swipes (RT-D4): the picture rests in its frame there.
|
|
735
|
+
image.sceneTracks = [walkDrift(l)];
|
|
736
|
+
image.scenePhoneTracks = restingTracks(image.sceneTracks as SceneTrackOut[]);
|
|
737
|
+
} else gap(ctx, LayoutGapCode.DepthSpeed, path, `inner ${l.inner}: over-scaled ×${(1 + k).toFixed(2)}, no drift`);
|
|
696
738
|
frame.children = [drift];
|
|
697
739
|
return { frame, image };
|
|
698
740
|
}
|
|
@@ -1473,7 +1515,7 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1473
1515
|
ctx.keptArrangement.push(part.handle);
|
|
1474
1516
|
} else switch (l.kind) {
|
|
1475
1517
|
case LayoutLayerKind.Photo: {
|
|
1476
|
-
const made = photoLayer(id, l, ctx, lc.path);
|
|
1518
|
+
const made = photoLayer(id, l, ctx, lc.path, lc.held && lc.track > 1 && l.role !== LayoutRole.Decoration);
|
|
1477
1519
|
outer = entering = made.frame;
|
|
1478
1520
|
image = made.image;
|
|
1479
1521
|
break;
|
|
@@ -1500,10 +1542,12 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1500
1542
|
// Held: the layer moves by tracks; a kinetic heading lights word by word as the section is read.
|
|
1501
1543
|
const tracks: SceneTrackOut[] = [];
|
|
1502
1544
|
if (lc.held) {
|
|
1545
|
+
const framed = opensWindow(l, lc);
|
|
1503
1546
|
for (const t of l.motion ?? []) {
|
|
1504
1547
|
const track = sceneTrackOf(t, l, lc.section.rows, ctx, lc.path);
|
|
1505
|
-
if (track) tracks.push(track);
|
|
1548
|
+
if (track) tracks.push(framed && track.prop === SceneProp.Clip ? framedWindow(track) : track);
|
|
1506
1549
|
}
|
|
1550
|
+
if (framed) tracks.push({ ...WINDOW_SINK, keys: WINDOW_SINK.keys.map(([at, v]): [number, number] => [at, v]) });
|
|
1507
1551
|
if (l.kinetic && textual) tracks.push({ prop: 'words', keys: [[0, 0], [KINETIC_ALL_LIT, 100]] });
|
|
1508
1552
|
if (tracks.length) {
|
|
1509
1553
|
outer.sceneTracks = tracks;
|
|
@@ -1520,7 +1564,7 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1520
1564
|
if (!(lc.held && l.kinetic && textual) && !itemsArrive) {
|
|
1521
1565
|
const enter = enterInteraction(entering.id, l, ctx, lc.path, textual, 1, lc.si === 0);
|
|
1522
1566
|
if (enter) entering.interactions = [...entering.interactions, enter];
|
|
1523
|
-
if (image && l.enter === LayoutEnter.ClipReveal && l.role !== LayoutRole.Decoration) image.interactions = [...image.interactions, zoomInteraction(image.id, l, ctx)];
|
|
1567
|
+
if (image && !image.sceneTracks?.length && l.enter === LayoutEnter.ClipReveal && l.role !== LayoutRole.Decoration) image.interactions = [...image.interactions, zoomInteraction(image.id, l, ctx)];
|
|
1524
1568
|
}
|
|
1525
1569
|
const depth = layoutGlideDepth(lc.section, l);
|
|
1526
1570
|
if (depth) {
|
|
@@ -1583,6 +1627,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1583
1627
|
const track = Math.max(1, s.track ?? 1);
|
|
1584
1628
|
const ground = String(s.ground ?? LayoutColour.Ground);
|
|
1585
1629
|
ctx.sections[s.id] = id;
|
|
1630
|
+
if (isDrawers(s)) return composeDrawers(s, si, ctx);
|
|
1586
1631
|
if (track > 1 && !held) gap(ctx, LayoutGapCode.UnheldMotion, `sections[${si}]`, 'a sideways section that is not held cannot travel');
|
|
1587
1632
|
|
|
1588
1633
|
const order = Array.isArray(s.phone) && s.phone.length ? s.phone : s.layers.map((_, i) => i);
|
|
@@ -1649,11 +1694,12 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1649
1694
|
phone(root, { height: 'auto' });
|
|
1650
1695
|
const wide = create(`${id}-track`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1651
1696
|
wide.label = `${s.id} · ${track} screens wide`;
|
|
1697
|
+
wide.role = SceneRole.Walk;
|
|
1652
1698
|
setStyleProps(wide, { ...gridLayout(s.rows, track), width: `${track * 100}%`, height: FULL, minHeight: ZERO });
|
|
1653
|
-
phone(wide,
|
|
1699
|
+
phone(wide, walkSwipe(si === 0));
|
|
1654
1700
|
wide.sceneTracks = [{ prop: 'x', keys: [[0, 0], [1, -(track - 1) * 100]] }];
|
|
1655
1701
|
wide.scenePhoneTracks = [{ prop: 'x', keys: [[0, 0]] }];
|
|
1656
|
-
wide.children = layers;
|
|
1702
|
+
wide.children = walkScreens(s, layers, track, id);
|
|
1657
1703
|
stage.children = [wide];
|
|
1658
1704
|
}
|
|
1659
1705
|
if (transition) {
|
|
@@ -1667,6 +1713,161 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1667
1713
|
return root;
|
|
1668
1714
|
}
|
|
1669
1715
|
|
|
1716
|
+
// ── The sideways walk on a phone (AW9, RT-D4) ───────────────────────────────────────────────────────────
|
|
1717
|
+
|
|
1718
|
+
/** A walk card's share of the phone's width: the next one peeks, so the row says it swipes. */
|
|
1719
|
+
const WALK_CARD_SHARE = '85%';
|
|
1720
|
+
const WALK_CARD_GAP = '16px';
|
|
1721
|
+
|
|
1722
|
+
/** The wide row on a phone: a row the visitor swipes, one screen of the walk to a card (`phoneWalk.swipe`) — never a
|
|
1723
|
+
* stack, which turned a walk into a long plain column (award plan "Reddottours" S3: theirs swaps to a card carousel). The
|
|
1724
|
+
* snapping is shared CSS (`.iox-role-scene-walk`): a node has no style for it. */
|
|
1725
|
+
function walkSwipe(first: boolean): Record<string, string> {
|
|
1726
|
+
return {
|
|
1727
|
+
width: FULL,
|
|
1728
|
+
height: 'auto',
|
|
1729
|
+
display: 'flex',
|
|
1730
|
+
flexDirection: 'row',
|
|
1731
|
+
alignItems: 'stretch',
|
|
1732
|
+
overflow: 'auto',
|
|
1733
|
+
gap: WALK_CARD_GAP,
|
|
1734
|
+
padding: `${first ? PHONE_FIRST_TOP : LAYOUT_PHONE_PADDING} ${LAYOUT_INSET} ${LAYOUT_PHONE_PADDING} ${LAYOUT_INSET}`,
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
/** The screen of a walk a layer stands on (from its first column). */
|
|
1739
|
+
const walkScreenOf = (l: LayoutLayer, track: number): number => Math.max(0, Math.min(track - 1, Math.floor((l.col[0] - 1) / GRID_COLUMNS)));
|
|
1740
|
+
|
|
1741
|
+
/**
|
|
1742
|
+
* A walk's layers, one holder per screen they stand on. On the wide layout a holder draws no box (`display: contents`), so
|
|
1743
|
+
* every layer keeps its place on the wide grid and its own crossing; on a phone it is a card of the swiped row, its
|
|
1744
|
+
* layers in the section's phone order. A screen with no layer gets no card.
|
|
1745
|
+
*/
|
|
1746
|
+
function walkScreens(s: LayoutSection, layers: SerializedNode[], track: number, id: string): SerializedNode[] {
|
|
1747
|
+
const by = new Map<number, SerializedNode[]>();
|
|
1748
|
+
s.layers.forEach((l, li) => {
|
|
1749
|
+
const at = walkScreenOf(l, track);
|
|
1750
|
+
by.set(at, [...(by.get(at) ?? []), layers[li]]);
|
|
1751
|
+
});
|
|
1752
|
+
return [...by.keys()].sort((a, b) => a - b).map(at => {
|
|
1753
|
+
const card = create(`${id}-w${at}`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1754
|
+
card.role = SceneRole.WalkScreen;
|
|
1755
|
+
card.label = `${s.id} · screen ${at + 1}`;
|
|
1756
|
+
setStyleProps(card, { display: 'contents' });
|
|
1757
|
+
phone(card, { display: 'flex', flexDirection: 'column', flexGrow: '0', flexShrink: '0', flexBasis: WALK_CARD_SHARE, minWidth: ZERO, gap: ZERO });
|
|
1758
|
+
card.children = by.get(at) ?? [];
|
|
1759
|
+
return card;
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
// ── Drawers (AW9) ───────────────────────────────────────────────────────────────────────────────────────
|
|
1764
|
+
|
|
1765
|
+
/** The longest heading a spine stands on end whole; a longer one is cut at a word with an ellipsis. */
|
|
1766
|
+
const SPINE_MAX_LETTERS = 40;
|
|
1767
|
+
const SPINE_PADDING = '24px';
|
|
1768
|
+
|
|
1769
|
+
/** A spine's words: the step's number and its heading, cut to what stands on the stage's height. */
|
|
1770
|
+
function spineWords(i: number, heading: string | undefined): string {
|
|
1771
|
+
const number = String(i + 1).padStart(2, '0');
|
|
1772
|
+
const words = (heading ?? '').replace(/\s+/g, ' ').trim();
|
|
1773
|
+
if (!words) return number;
|
|
1774
|
+
if (words.length <= SPINE_MAX_LETTERS) return `${number} · ${words}`;
|
|
1775
|
+
const cut = words.slice(0, SPINE_MAX_LETTERS);
|
|
1776
|
+
const at = cut.lastIndexOf(' ');
|
|
1777
|
+
return `${number} · ${(at > SPINE_MAX_LETTERS / 2 ? cut.slice(0, at) : cut).trim()}…`;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
/** A drawer's ground: its scheme's section fill — the page's own ground on Default, whose section fill is transparent and
|
|
1781
|
+
* would show the step under it. */
|
|
1782
|
+
const drawerPaint = (scheme: ColorScheme): string => scheme === ColorScheme.Default ? 'var(--iox-bg)' : 'var(--iox-section-bg)';
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* AW9 `drawers` (award plan "Reddottours" S4): a held section whose steps slide in from the inline end, one after another,
|
|
1786
|
+
* straight with the scroll (RT-D1), each stopping one spine after the step before — the stack builds a row of titled
|
|
1787
|
+
* spines — while their grounds deepen through the look's schemes to the brand (`drawerRamp`, AA-gated as schemes are).
|
|
1788
|
+
* A step is a panel on the stage: its spine (number and heading, decorative — the step's heading is read) and its body
|
|
1789
|
+
* (the step's layers on the section's grid, still). On a phone it stacks, each spine a label above its step. A step's
|
|
1790
|
+
* words arriving as it lands is AW10 (an entrance at a key): the layout's entrances on them are dropped and said.
|
|
1791
|
+
*/
|
|
1792
|
+
function composeDrawers(s: LayoutSection, si: number, ctx: Ctx): SerializedNode {
|
|
1793
|
+
const id = `${ctx.p}-s${si}`;
|
|
1794
|
+
const steps = drawerSteps(s.layers);
|
|
1795
|
+
const n = steps.length;
|
|
1796
|
+
const timing = drawersTiming(n);
|
|
1797
|
+
// Outside 3–5 `checkLayout` refuses it; a stored layout is composed as is, the ramp's deepest schemes last.
|
|
1798
|
+
const ramp = drawerRamp(Math.max(3, Math.min(5, n))) ?? [ColorScheme.Accent];
|
|
1799
|
+
const schemeOf = (i: number): ColorScheme => ramp[Math.max(0, Math.min(ramp.length - 1, ramp.length - n + i))];
|
|
1800
|
+
const side = ctx.rtl ? 'right' : 'left';
|
|
1801
|
+
|
|
1802
|
+
const root = create(id, T.Section, {}, NO_ELEMENT_STYLE);
|
|
1803
|
+
root.role = SceneRole.Scene;
|
|
1804
|
+
root.label = `${s.id} · drawers`;
|
|
1805
|
+
setStyleProps(root, {
|
|
1806
|
+
position: 'relative', width: FULL, minHeight: ZERO, height: `${timing.screens * 100}svh`, display: 'block', padding: ZERO, margin: ZERO,
|
|
1807
|
+
backgroundColor: groundPaint(String(s.ground ?? LayoutColour.Ground)), color: 'var(--iox-text)', ...(ctx.rtl ? { textDirection: 'rtl' } : {}),
|
|
1808
|
+
});
|
|
1809
|
+
phone(root, { height: 'auto' });
|
|
1810
|
+
const stage = create(`${id}-stage`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1811
|
+
stage.role = SceneRole.Stage;
|
|
1812
|
+
stage.label = `${s.id} · stage`;
|
|
1813
|
+
setStyleProps(stage, { position: 'sticky', top: ZERO, width: FULL, height: '100svh', minHeight: ZERO, overflow: 'hidden', zIndex: '1', display: 'block' });
|
|
1814
|
+
phone(stage, { display: 'contents' });
|
|
1815
|
+
|
|
1816
|
+
stage.children = steps.map((indices, i) => {
|
|
1817
|
+
const scheme = schemeOf(i);
|
|
1818
|
+
const panel = create(`${id}-d${i}`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1819
|
+
panel.role = SceneRole.Drawer;
|
|
1820
|
+
panel.label = `${s.id} · step ${i + 1}`;
|
|
1821
|
+
setColorScheme(panel, scheme);
|
|
1822
|
+
setStyleProps(panel, {
|
|
1823
|
+
position: 'absolute', top: ZERO, [side]: ZERO, width: i ? `${drawerWidth(n)}%` : FULL, height: FULL, minHeight: ZERO,
|
|
1824
|
+
display: 'flex', flexDirection: 'row', backgroundColor: drawerPaint(scheme), color: 'var(--iox-text)', zIndex: String(i + 1), overflow: 'hidden',
|
|
1825
|
+
});
|
|
1826
|
+
phone(panel, { position: 'relative', top: 'auto', [side]: 'auto', width: FULL, height: 'auto', flexDirection: 'column' });
|
|
1827
|
+
const slide = timing.windows[i];
|
|
1828
|
+
if (slide) {
|
|
1829
|
+
// Waits off the stage at its inline end, slides in over its screen, rests a spine past the one before.
|
|
1830
|
+
panel.sceneTracks = [{ prop: SceneProp.X, keys: [[0, 100], [slide[0], 100], [slide[1], drawerRestX(i)]] }];
|
|
1831
|
+
panel.scenePhoneTracks = [{ prop: SceneProp.X, keys: [[0, 0]] }];
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
const spine = create(`${id}-d${i}-spine`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1835
|
+
spine.role = SceneRole.DrawerSpine;
|
|
1836
|
+
setStyleProps(spine, {
|
|
1837
|
+
width: `${DRAWER_SPINE}cqw`, flexShrink: '0', height: FULL, minHeight: ZERO, display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
1838
|
+
padding: `${SPINE_PADDING} ${ZERO}`, overflow: 'hidden',
|
|
1839
|
+
});
|
|
1840
|
+
phone(spine, {
|
|
1841
|
+
width: FULL, height: 'auto', justifyContent: 'flex-start',
|
|
1842
|
+
padding: `${i === 0 && si === 0 ? PHONE_FIRST_TOP : LAYOUT_PHONE_PADDING} ${LAYOUT_INSET} ${ZERO} ${LAYOUT_INSET}`,
|
|
1843
|
+
});
|
|
1844
|
+
const head = s.layers[indices[0]];
|
|
1845
|
+
const title = create(`${id}-d${i}-spine-t`, T.Text, { content: spineWords(i, head?.kind === LayoutLayerKind.Heading ? head.text : undefined), tag: 'span' }, 'eyebrow');
|
|
1846
|
+
setStyleProps(title, { color: 'inherit', margin: ZERO });
|
|
1847
|
+
spine.children = [title];
|
|
1848
|
+
|
|
1849
|
+
const body = create(`${id}-d${i}-body`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1850
|
+
setStyleProps(body, { position: 'relative', flexGrow: '1', minWidth: ZERO, height: FULL, minHeight: ZERO, ...gridLayout(s.rows, 1) });
|
|
1851
|
+
phone(body, { ...phoneStack(false), padding: `${SPINE_PADDING} ${LAYOUT_INSET} ${LAYOUT_PHONE_PADDING} ${LAYOUT_INSET}` });
|
|
1852
|
+
const phoneAlign = indices.every(li => s.layers[li].align === 'center') ? 'center' : 'start';
|
|
1853
|
+
body.children = indices.map((li, at) => {
|
|
1854
|
+
const l = s.layers[li];
|
|
1855
|
+
if (l.enter && l.enter !== LayoutEnter.None) gap(ctx, LayoutGapCode.DrawerWords, `sections[${si}].layers[${li}]`, 'stands still as its step slides in (arriving on landing is AW10)');
|
|
1856
|
+
const still: LayoutLayer = { ...l, enter: LayoutEnter.None, motion: undefined, kinetic: undefined, depth: undefined, scrub: undefined };
|
|
1857
|
+
const prev = at > 0 ? s.layers[indices[at - 1]] : null;
|
|
1858
|
+
const lc: LayerCtx = {
|
|
1859
|
+
section: s, si, li, path: `sections[${si}].layers[${li}]`, held: true, track: 1,
|
|
1860
|
+
order: at, phoneGap: phoneGapBefore(prev, l), phoneAlign,
|
|
1861
|
+
};
|
|
1862
|
+
return composeLayer(still, lc, ctx);
|
|
1863
|
+
});
|
|
1864
|
+
panel.children = [spine, body];
|
|
1865
|
+
return panel;
|
|
1866
|
+
});
|
|
1867
|
+
root.children = [stage];
|
|
1868
|
+
return root;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1670
1871
|
// ── The header ──────────────────────────────────────────────────────────────────────────────────────────
|
|
1671
1872
|
|
|
1672
1873
|
const NAV_ROUTE = '/';
|
|
@@ -1501,6 +1501,8 @@ const cloneTrack = (track: PatternTrack): Record<string, unknown> => ({
|
|
|
1501
1501
|
prop: track.prop,
|
|
1502
1502
|
keys: track.keys.map(([at, value]) => [at, value]),
|
|
1503
1503
|
...(track.from ? { from: track.from } : {}),
|
|
1504
|
+
...(track.ease ? { ease: track.ease } : {}),
|
|
1505
|
+
...(track.range ? { range: track.range } : {}),
|
|
1504
1506
|
});
|
|
1505
1507
|
|
|
1506
1508
|
interface SectionMotion {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
|
|
3
|
+
import { LayoutLayer, LayoutLayerKind, LayoutSection, LayoutSectionKind } from './layout-language';
|
|
4
|
+
import { GenerationTier } from './site-plan.model';
|
|
5
|
+
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* AW9 `drawers` (award plan "Reddottours" S4, RT-D1): a held section whose STEPS slide in from the inline end, one after
|
|
9
|
+
* the other, linearly with the scroll, and stop one spine after the step before — so the stack builds a row of titled
|
|
10
|
+
* spines — while their grounds deepen through the look's schemes to the brand. Pure: what a drawers section is, how long
|
|
11
|
+
* it holds and when each step moves; `composeLayout` stamps it and `checkLayout` holds it. The words arriving as a step
|
|
12
|
+
* lands is AW10, not here.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const D = SPEC_SITE_LAYOUT.drawers;
|
|
16
|
+
/** How many steps a drawers section holds (one heading each): fewer or more is refused. */
|
|
17
|
+
export const DRAWER_STEPS: readonly [number, number] = [SPEC_SITE_LAYOUT.limits.drawerSteps[0], SPEC_SITE_LAYOUT.limits.drawerSteps[1]];
|
|
18
|
+
/** A spine's width, in % of the stage's width (cqw). */
|
|
19
|
+
export const DRAWER_SPINE: number = D.spine;
|
|
20
|
+
|
|
21
|
+
/** The kinds a step may hold: words and buttons — a step is the owner's words, never a picture (the award plan: "it needs
|
|
22
|
+
* no photos"). */
|
|
23
|
+
export const DRAWER_KINDS: ReadonlySet<string> = new Set([
|
|
24
|
+
LayoutLayerKind.Heading, LayoutLayerKind.Word, LayoutLayerKind.Text, LayoutLayerKind.Label, LayoutLayerKind.Number,
|
|
25
|
+
LayoutLayerKind.List, LayoutLayerKind.Button,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** Is this section the drawers signature? */
|
|
29
|
+
export const isDrawers = (s: Pick<LayoutSection, 'kind'> | null | undefined): boolean => s?.kind === LayoutSectionKind.Drawers;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A drawers section's steps, as indices into its layers: each heading starts a step and holds the layers written after it,
|
|
33
|
+
* up to the next heading. Layers written before the first heading belong to the first step.
|
|
34
|
+
*/
|
|
35
|
+
export function drawerSteps(layers: ReadonlyArray<Pick<LayoutLayer, 'kind'>>): number[][] {
|
|
36
|
+
const steps: number[][] = [];
|
|
37
|
+
layers.forEach((l, i) => {
|
|
38
|
+
if (l.kind === LayoutLayerKind.Heading || !steps.length) steps.push([i]);
|
|
39
|
+
else steps[steps.length - 1].push(i);
|
|
40
|
+
});
|
|
41
|
+
// A first step opened by a non-heading and followed by a heading: the heading opened a step of its own above; the
|
|
42
|
+
// words before it are its own step only when there was no heading at all.
|
|
43
|
+
if (steps.length > 1 && layers[steps[0][0]]?.kind !== LayoutLayerKind.Heading) {
|
|
44
|
+
const [lead, next, ...rest] = steps;
|
|
45
|
+
return [[...lead, ...next], ...rest];
|
|
46
|
+
}
|
|
47
|
+
return steps;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** How many steps a drawers section holds: its headings (at least one step when it has any layer). */
|
|
51
|
+
export function drawerStepCount(layers: ReadonlyArray<Pick<LayoutLayer, 'kind'>>): number {
|
|
52
|
+
return drawerSteps(layers).length;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DrawersTiming {
|
|
56
|
+
/** Screens of scroll the stage holds. */
|
|
57
|
+
hold: number;
|
|
58
|
+
/** The root's height, in screens (the hold and the stage). */
|
|
59
|
+
screens: number;
|
|
60
|
+
/** Each step's slide, as `[start, end]` of the hold's progress (0–1); the first step's is null — it is there from the start. */
|
|
61
|
+
windows: Array<[number, number] | null>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const round = (v: number): number => Math.round(v * 10000) / 10000;
|
|
65
|
+
|
|
66
|
+
/** How long `n` steps hold and when each slides: a rest, one slide per step after the first, a rest (theirs: ½ · 1 · ½). */
|
|
67
|
+
export function drawersTiming(n: number): DrawersTiming {
|
|
68
|
+
const count = Math.max(1, Math.round(n));
|
|
69
|
+
const hold = D.rest * 2 + D.slide * (count - 1);
|
|
70
|
+
const windows = Array.from({ length: count }, (_, i): [number, number] | null => {
|
|
71
|
+
if (i === 0 || hold <= 0) return null;
|
|
72
|
+
const start = D.rest + D.slide * (i - 1);
|
|
73
|
+
return [round(start / hold), round((start + D.slide) / hold)];
|
|
74
|
+
});
|
|
75
|
+
return { hold, screens: hold + 1, windows };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Where step `i` of `n` rests once landed, in % of the stage's width from the inline start: one spine per step before it. */
|
|
79
|
+
export const drawerRestX = (i: number): number => round(i * DRAWER_SPINE);
|
|
80
|
+
|
|
81
|
+
/** A step's width: the stage less the spines of every step after the first. */
|
|
82
|
+
export const drawerWidth = (n: number): number => round(100 - (Math.max(1, n) - 1) * DRAWER_SPINE);
|
|
83
|
+
|
|
84
|
+
/** The schemes `n` steps wear, first to last — the look's own, deepening to the brand. Null outside the steps allowed. */
|
|
85
|
+
export function drawerRamp(n: number): ColorScheme[] | null {
|
|
86
|
+
const ramp = (D.ramp as Readonly<Record<string, ReadonlyArray<string>>>)[String(n)];
|
|
87
|
+
return ramp ? ramp.map(id => id as ColorScheme) : null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A signature of the contract offered to a build at `tier`: a `pro` row to the award tier alone (AW-D23). */
|
|
91
|
+
export function layoutSignatureOffered(id: string, tier: `${GenerationTier}` | string | null | undefined): boolean {
|
|
92
|
+
const row = SPEC_SITE_LAYOUT.signatures.find(s => s.id === id);
|
|
93
|
+
return !!row && (row.tier !== 'pro' || tier === GenerationTier.Award);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The section kinds the layout wire offers a build at `tier`: content · inhale · signature, and a signature kind
|
|
97
|
+
* (`drawers`) only where its signature is offered. */
|
|
98
|
+
export function layoutSectionKindsOffered(tier: `${GenerationTier}` | string | null | undefined): string[] {
|
|
99
|
+
return (SPEC_SITE_LAYOUT.vocab.sectionKinds as ReadonlyArray<string>)
|
|
100
|
+
.filter(k => !SPEC_SITE_LAYOUT.signatures.some(s => s.id === k) || layoutSignatureOffered(k, tier));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The signatures a build at `tier` may be told of (the layout prompt's list). */
|
|
104
|
+
export function layoutSignaturesOffered(tier: `${GenerationTier}` | string | null | undefined): Array<{ id: string; label: string; how: string }> {
|
|
105
|
+
return SPEC_SITE_LAYOUT.signatures.filter(s => layoutSignatureOffered(s.id, tier)).map(s => ({ id: s.id, label: s.label, how: s.how }));
|
|
106
|
+
}
|
|
@@ -39,6 +39,8 @@ export enum LayoutSignatureId {
|
|
|
39
39
|
HalvesApart = 'halves-apart',
|
|
40
40
|
SidewaysWalk = 'sideways-walk',
|
|
41
41
|
ObjectTurning = 'object-turning',
|
|
42
|
+
/** AW9: steps sliding in from the end and stacking by their spines (the award tier's). */
|
|
43
|
+
Drawers = 'drawers',
|
|
42
44
|
HeldScreen = 'held-screen',
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -133,6 +135,7 @@ const SIGNATURE_BY_TRACK: ReadonlyArray<[LayoutTrackProp, LayoutSignatureId]> =
|
|
|
133
135
|
|
|
134
136
|
export function signatureOf(s: LayoutSection | undefined): LayoutSignatureId {
|
|
135
137
|
if (!s) return LayoutSignatureId.HeldScreen;
|
|
138
|
+
if (s.kind === LayoutSectionKind.Drawers) return LayoutSignatureId.Drawers;
|
|
136
139
|
const layers = s.layers ?? [];
|
|
137
140
|
if (layers.some(l => l.kinetic)) return LayoutSignatureId.WordsLit;
|
|
138
141
|
if (layers.some(l => l.gallery?.scroll)) return LayoutSignatureId.ScrollReel;
|
|
@@ -143,6 +143,10 @@ export const LAYOUT_PHOTO_ASPECT: Readonly<Record<LayoutPhotoShape, string>> = {
|
|
|
143
143
|
export enum LayoutSectionKind {
|
|
144
144
|
Content = 'content',
|
|
145
145
|
Inhale = 'inhale',
|
|
146
|
+
/** AW9 (award plan "Reddottours" S4): the drawers signature — a held section whose steps (a heading each, then its words
|
|
147
|
+
* and buttons) slide in from the inline end and stack, each keeping its titled spine. Award tier only; it is the page's
|
|
148
|
+
* signature (`signature: true`), its length is its steps' (`drawersOf`). */
|
|
149
|
+
Drawers = 'drawers',
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
export enum LayoutButtonVariant {
|
|
@@ -100,9 +100,10 @@ export function layoutShapeHasPurpose(s: LayoutSection, li: number): boolean {
|
|
|
100
100
|
return !!l.motion?.length || (!!l.depth && l.depth !== LayoutDepth.Mid);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
/** A held section where nothing moves by the scroll: no track, no kinetic line, no gallery the scroll turns.
|
|
103
|
+
/** A held section where nothing moves by the scroll: no track, no kinetic line, no gallery the scroll turns. Drawers
|
|
104
|
+
* (AW9) are never still: their steps slide. */
|
|
104
105
|
export function layoutHeldStill(s: LayoutSection): boolean {
|
|
105
|
-
if (!s.pin || (s.track ?? 1) > 1 || s.readyMade || s.carry) return false;
|
|
106
|
+
if (!s.pin || (s.track ?? 1) > 1 || s.readyMade || s.carry || s.kind === LayoutSectionKind.Drawers) return false;
|
|
106
107
|
return !(s.layers ?? []).some(l => !!l.motion?.length || !!l.kinetic || (l.kind === LayoutLayerKind.Gallery && !!l.gallery?.scroll));
|
|
107
108
|
}
|
|
108
109
|
|
|
@@ -3,8 +3,9 @@ import { columnWordOf, isScrubId, ScrubId, SPEC_AXES } from '@vectoriox/iox-ui/d
|
|
|
3
3
|
import { JsonSchema, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonText } from './json-schema';
|
|
4
4
|
import {
|
|
5
5
|
LAYOUT_BEAT_DELAY, LayoutDial, LayoutForm, LayoutGallery, LayoutIssue, LayoutIssueCode, LayoutLayer, LayoutListArrange, LayoutListArrive,
|
|
6
|
-
LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutTrack,
|
|
6
|
+
LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutSectionKind, LayoutTrack,
|
|
7
7
|
} from './layout-language';
|
|
8
|
+
import { DRAWER_STEPS, layoutSectionKindsOffered } from './layout-drawers';
|
|
8
9
|
import { isPlainObject, PlainObject } from './shape-check';
|
|
9
10
|
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords, listWordOffered, listWordRefusal } from './list-table';
|
|
10
11
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
@@ -24,6 +25,8 @@ const GALLERY_EFFECTS: ReadonlyArray<string> = V.galleryEffects;
|
|
|
24
25
|
const FORM_PRESETS: ReadonlyArray<string> = V.formPresets;
|
|
25
26
|
const BUTTON_VARIANTS: ReadonlyArray<string> = V.buttonVariants;
|
|
26
27
|
const NONE = 'none';
|
|
28
|
+
/** AW9: the section kind that is the drawers signature. */
|
|
29
|
+
const DRAWERS = LayoutSectionKind.Drawers as string;
|
|
27
30
|
const CLIP = 'clipReveal';
|
|
28
31
|
const CLIP_SIDE = `${CLIP}-`;
|
|
29
32
|
/** A gallery the wire marks `autoplay` turns every 5 s — what the proof sites' autoplaying galleries do. */
|
|
@@ -227,7 +230,9 @@ export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchem
|
|
|
227
230
|
});
|
|
228
231
|
const section = closed({
|
|
229
232
|
id: text('a short slug, unique on the page'),
|
|
230
|
-
kind: oneOf(
|
|
233
|
+
kind: oneOf(layoutSectionKindsOffered(options.tier), layoutSectionKindsOffered(options.tier).includes(DRAWERS)
|
|
234
|
+
? `content · inhale (a breath: ≤ 2 small layers, no photo) · signature (exactly ONE) · drawers (the signature as ${DRAWER_STEPS[0]}–${DRAWER_STEPS[1]} steps sliding in and stacking: each step a heading, then its words and buttons; held, no photos)`
|
|
235
|
+
: 'content · inhale (a breath: ≤ 2 small layers, no photo) · signature (exactly ONE)'),
|
|
231
236
|
screens: integer('1..5 screen heights'),
|
|
232
237
|
hold: integer('0 flows · 1 held (the page stops while its layers move) · 2..4 held and carried sideways that many screens'),
|
|
233
238
|
ground: text("a colour name, or photo:<id>"),
|
|
@@ -420,6 +425,13 @@ function expandSection(s: PlainObject): LayoutSection {
|
|
|
420
425
|
if (kind === 'signature') out.signature = true;
|
|
421
426
|
if (hold >= 1) out.pin = true;
|
|
422
427
|
if (hold >= 2) out.track = hold;
|
|
428
|
+
// AW9: drawers IS the page's signature, and held — its steps say how long; it never walks sideways.
|
|
429
|
+
if (kind === DRAWERS) {
|
|
430
|
+
out.kind = LayoutSectionKind.Drawers;
|
|
431
|
+
out.signature = true;
|
|
432
|
+
out.pin = true;
|
|
433
|
+
delete out.track;
|
|
434
|
+
}
|
|
423
435
|
return out;
|
|
424
436
|
}
|
|
425
437
|
|
|
@@ -504,7 +516,7 @@ export function layoutToWire(page: Pick<LayoutPage, 'sections'> & Partial<Pick<L
|
|
|
504
516
|
...(columnWordOf(page.column) ? { column: page.column } : {}),
|
|
505
517
|
sections: page.sections.map(s => (s.carry ? carryPlaceToWire(s) : {
|
|
506
518
|
id: s.id,
|
|
507
|
-
kind: s.signature ? 'signature' : s.kind ?? 'content',
|
|
519
|
+
kind: s.kind === LayoutSectionKind.Drawers ? DRAWERS : s.signature ? 'signature' : s.kind ?? 'content',
|
|
508
520
|
screens: s.screens,
|
|
509
521
|
hold: s.pin ? s.track ?? 1 : 0,
|
|
510
522
|
ground: s.ground ?? 'ground',
|
|
@@ -113,6 +113,10 @@ export interface PatternTrack {
|
|
|
113
113
|
readonly prop: string;
|
|
114
114
|
readonly keys: ReadonlyArray<readonly [number, number | string]>;
|
|
115
115
|
readonly from?: string;
|
|
116
|
+
/** How it runs between keys when not its property's own (`linear` · `smooth`, AW9 RT-D1). */
|
|
117
|
+
readonly ease?: string;
|
|
118
|
+
/** What its progress is measured over when not the hold (`exit` · `cross-inline` · `cross-block`, AW9). */
|
|
119
|
+
readonly range?: string;
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compositeOver, parseCssColour, relativeLuminance, Rgb, wcagContrastRatio } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
|
-
import { AiStep, AiTokenPrice, creditsOfUsd, estimateStepCredits } from './ai-run';
|
|
3
|
+
import { AiStep, AiTokenPrice, creditsOfUsd, estimateStepCredits, typicalStepTokens } from './ai-run';
|
|
4
4
|
import { ArtDirection, artDirectionPreamble } from './art-direction';
|
|
5
5
|
import { ComposedSite } from './compose-site';
|
|
6
6
|
import { jsonBoolean, jsonClosedObject, JsonSchema, jsonText } from './json-schema';
|
|
@@ -309,9 +309,10 @@ export interface PicturesEstimate {
|
|
|
309
309
|
* The cost shown before the owner says yes (I-D4): each picture and its review at the vetted list's prices, plus one
|
|
310
310
|
* second try (a picture and its review) for every `PICTURE_REROLL_EVERY` pictures. The run never spends past `total` —
|
|
311
311
|
* a second try that would cross it is not made — so the shown cost is a ceiling met exactly when every try is used.
|
|
312
|
+
* `model` = the picture model: one picture is counted as its maker bills it at most (iox-ui#138); absent, the default's.
|
|
312
313
|
*/
|
|
313
|
-
export function estimatePictures(count: number, prices: { image: AiTokenPrice; review: AiTokenPrice }): PicturesEstimate {
|
|
314
|
-
const picture = estimateStepCredits(AiStep.MakePictures, prices.image);
|
|
314
|
+
export function estimatePictures(count: number, prices: { image: AiTokenPrice; review: AiTokenPrice }, model?: string | null): PicturesEstimate {
|
|
315
|
+
const picture = estimateStepCredits(AiStep.MakePictures, prices.image, typicalStepTokens(AiStep.MakePictures, undefined, model));
|
|
315
316
|
const review = estimateStepCredits(AiStep.CheckPictures, prices.review);
|
|
316
317
|
const rerolls = pictureRerolls(count);
|
|
317
318
|
return { count, rerolls, picture, review, total: creditsOfUsd(((count + rerolls) * (picture + review)) / 100) };
|