@vectoriox/iox-ui 5.162.0 → 5.163.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 +185 -2
- 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 +404 -163
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +56 -5
- 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 +80 -23
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +383 -10
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +46 -5
- package/harness-core/index.d.ts +132 -2
- package/index.d.ts +105 -3
- package/package.json +1 -1
- package/scene-core/index.d.ts +44 -12
- 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/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/pictures.ts +4 -3
- 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/scroll-driver.ts +97 -25
- package/styles/iox-design.css +121 -2
|
@@ -1269,10 +1269,11 @@ function scrubTextReveal(el, by, look = TextRevealLook.Rise, easing = 'linear')
|
|
|
1269
1269
|
* canvas's zoom the same rectangle divides by the same zoom, and the answer is the same at any scale.
|
|
1270
1270
|
*
|
|
1271
1271
|
* - The value is DAMPED: the scroll stops and the page settles a moment later. This is much of the prototype's weight,
|
|
1272
|
-
* and why this is not a CSS scroll timeline, which cannot do it. Smoothed ONCE (award plan "Reddottours", RT-D2):
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1272
|
+
* and why this is not a CSS scroll timeline, which cannot do it. Smoothed ONCE (award plan "Reddottours", RT-D2): while
|
|
1273
|
+
* Lenis is smoothing the page's scroll, the driver FOLLOWS it with no damping of its own (`follow`) — a second damping
|
|
1274
|
+
* on top made every picture trail the hand — and reads it where Lenis has it, not on the whole pixel the browser keeps
|
|
1275
|
+
* (a film turns that pixel into a visible step, vectoriox/iox-ui#140). A scroll Lenis does not smooth (a jump, the
|
|
1276
|
+
* keyboard, the scroll bar) is damped as on a page the browser scrolls natively, and so is the canvas (it pins).
|
|
1276
1277
|
* - The live site pins with `position: sticky`, on the compositor. The canvas cannot (its page never scrolls itself,
|
|
1277
1278
|
* its Lenis scrolls a wrapper around a zoomed frame), so `pin` holds the stage there with `translate` instead.
|
|
1278
1279
|
* `translate`, not `transform`: a Stage may carry tracks of its own.
|
|
@@ -1287,8 +1288,11 @@ const MAX_FRAME_SECONDS = 0.1;
|
|
|
1287
1288
|
const WAKING_FRAME_SECONDS = 1 / 60;
|
|
1288
1289
|
const STAGE_SELECTOR = `.iox-role-${SceneRole.Stage.replace(/\./g, '-')}, [${SceneAttribute.Stage}]`;
|
|
1289
1290
|
const TRANSFORM_WILL_CHANGE = 'transform, opacity';
|
|
1290
|
-
/** The class Lenis keeps on the element it scrolls
|
|
1291
|
-
|
|
1291
|
+
/** The class Lenis keeps on the element it scrolls only while it is SMOOTHING a scroll (a jump, the keyboard and the scroll
|
|
1292
|
+
* bar are not smoothed): what a driver with no named scroller reads. */
|
|
1293
|
+
const LENIS_SMOOTH_CLASS = 'lenis-smooth';
|
|
1294
|
+
/** The most the browser's rounding of the scroll can hide, page px; a larger gap is not rounding and is never added. */
|
|
1295
|
+
const MAX_SUBPIXEL = 1;
|
|
1292
1296
|
/** A crossing that moved less than this since the last frame has stopped moving (it is a 0–1 value). */
|
|
1293
1297
|
const CROSSING_SETTLED = 0.0001;
|
|
1294
1298
|
/**
|
|
@@ -1303,6 +1307,40 @@ const SCENE_WAKE_EVENT = 'iox-scene-wake';
|
|
|
1303
1307
|
* lets it go.
|
|
1304
1308
|
*/
|
|
1305
1309
|
const HELD = new WeakMap();
|
|
1310
|
+
const PAGE_SCROLLERS = new WeakMap();
|
|
1311
|
+
/**
|
|
1312
|
+
* Name (or, with null, forget) the scroller that smooths a window's DOCUMENT — the iox-ui page scroller does, when it
|
|
1313
|
+
* starts Lenis on the document. Every driver on that window reads it; a scroller of a wrapper is never named here.
|
|
1314
|
+
*/
|
|
1315
|
+
function setPageScroller(host, scroller) {
|
|
1316
|
+
if (scroller)
|
|
1317
|
+
PAGE_SCROLLERS.set(host, scroller);
|
|
1318
|
+
else
|
|
1319
|
+
PAGE_SCROLLERS.delete(host);
|
|
1320
|
+
}
|
|
1321
|
+
/** The scroller named for a window's document, if any. */
|
|
1322
|
+
function pageScroller(host) {
|
|
1323
|
+
return PAGE_SCROLLERS.get(host) ?? null;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Page px the scroller has the page past where the browser drew it (its whole pixel): what a driver adds back, so a film
|
|
1327
|
+
* never steps by the page's pixels. Read while smoothing AND after: a smoothing ends on its own unrounded value, and the
|
|
1328
|
+
* film rests there rather than stepping back onto the pixel. 0 with no scroller, or a gap larger than rounding makes.
|
|
1329
|
+
*/
|
|
1330
|
+
function scrollSubpixel(scroller) {
|
|
1331
|
+
if (!scroller)
|
|
1332
|
+
return 0;
|
|
1333
|
+
const gap = scroller.scroll - scroller.actualScroll;
|
|
1334
|
+
return Number.isFinite(gap) && Math.abs(gap) <= MAX_SUBPIXEL ? gap : 0;
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* One frame of a driver that FOLLOWS an already smoothed scroll (RT-D2): the scroll's own move since the last frame is
|
|
1338
|
+
* taken whole, and only a gap left from before (a damped jump the smoothing then continued) is damped away. With no gap
|
|
1339
|
+
* it stands exactly on the scroll; it never snaps across one.
|
|
1340
|
+
*/
|
|
1341
|
+
function followToward(current, previousTarget, target, seconds, rate = SCENE_DAMPING) {
|
|
1342
|
+
return dampToward(current + (target - previousTarget), target, seconds, rate);
|
|
1343
|
+
}
|
|
1306
1344
|
function sliderOf(stage) {
|
|
1307
1345
|
// The stage is the runway's child: the `.swiper` itself (both engine paths), or the canvas's shell around it.
|
|
1308
1346
|
const holder = (stage?.classList.contains('swiper') ? stage : stage?.querySelector('.swiper'));
|
|
@@ -1411,22 +1449,29 @@ class ScrollDriver {
|
|
|
1411
1449
|
const seconds = this.lastTime ? Math.min(MAX_FRAME_SECONDS, (now - this.lastTime) / 1000) : WAKING_FRAME_SECONDS;
|
|
1412
1450
|
this.lastTime = now;
|
|
1413
1451
|
const follow = this.following();
|
|
1414
|
-
|
|
1452
|
+
// Where the page's scroller has the page beyond the browser's whole pixel: read with it, so a film does not step by
|
|
1453
|
+
// pixels. Not when the host says outright how to follow (`follow`): it reads its own scroll.
|
|
1454
|
+
const subpixel = this.options.follow === undefined ? scrollSubpixel(this.scroller()) : 0;
|
|
1455
|
+
const reads = [...this.scenes.values()].map(scene => this.read(scene, subpixel));
|
|
1415
1456
|
// Each layer that moves over its own crossing is read with the rest, before any write: where its row stood after the
|
|
1416
1457
|
// last frame. A row that moved since is read again on the next frame, so the crossing lands where the row lands.
|
|
1417
1458
|
const crossed = reads.map(({ scene }) => this.readCrossings(scene)).some(Boolean);
|
|
1418
1459
|
const view = this.links.size ? this.viewBox() : null;
|
|
1419
|
-
const linkReads = [...this.links].map(state => this.readLink(state, view));
|
|
1460
|
+
const linkReads = [...this.links].map(state => this.readLink(state, view, subpixel));
|
|
1420
1461
|
let moving = crossed;
|
|
1421
1462
|
for (const { scene, local, along } of reads) {
|
|
1422
1463
|
if (this.options.pin && scene.stage)
|
|
1423
1464
|
scene.stage.style.setProperty('translate', `0 ${local}px`);
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1465
|
+
const next = scene.fresh ? along
|
|
1466
|
+
: follow ? followToward(scene.position, scene.along, along, seconds, this.options.damping)
|
|
1467
|
+
: dampToward(scene.position, along, seconds, this.options.damping);
|
|
1468
|
+
// The step onto the scroll is what is left: taken once it is under SETTLED_PX, so it never shows. Following, what
|
|
1469
|
+
// is left is the gap from before (the scroll's own move is taken whole).
|
|
1470
|
+
const gap = follow ? scene.along - scene.position : along - scene.position;
|
|
1471
|
+
const settled = scene.fresh || Math.abs(gap) < SETTLED_PX;
|
|
1428
1472
|
const before = scene.position;
|
|
1429
1473
|
scene.position = settled ? along : next;
|
|
1474
|
+
scene.along = along;
|
|
1430
1475
|
// A crossing was read before this frame moved its row: it is read again on the next frame, after the move.
|
|
1431
1476
|
if (scene.position !== before && scene.layers.some(layer => layer.crosses))
|
|
1432
1477
|
moving = true;
|
|
@@ -1439,9 +1484,12 @@ class ScrollDriver {
|
|
|
1439
1484
|
moving = moving || !settled;
|
|
1440
1485
|
}
|
|
1441
1486
|
for (const { state, target } of linkReads) {
|
|
1442
|
-
const immediate = state.fresh || !!state.link.immediate
|
|
1443
|
-
const next = immediate ? target
|
|
1444
|
-
|
|
1487
|
+
const immediate = state.fresh || !!state.link.immediate;
|
|
1488
|
+
const next = immediate ? target
|
|
1489
|
+
: follow ? followToward(state.progress, state.target, target, seconds, this.options.damping)
|
|
1490
|
+
: dampToward(state.progress, target, seconds, this.options.damping);
|
|
1491
|
+
const gap = follow ? state.target - state.progress : target - state.progress;
|
|
1492
|
+
const settled = immediate || Math.abs(gap) * Math.max(1, state.geometry.distance) < SETTLED_PX;
|
|
1445
1493
|
state.progress = settled ? target : next;
|
|
1446
1494
|
state.target = target;
|
|
1447
1495
|
state.fresh = false;
|
|
@@ -1468,7 +1516,7 @@ class ScrollDriver {
|
|
|
1468
1516
|
return false;
|
|
1469
1517
|
this.remove(root);
|
|
1470
1518
|
HELD.set(root, this);
|
|
1471
|
-
const scene = { root, stage: null, layers: [], progress: 0, target: 0, position: 0, height: 0, travel: 0, exit: 0, stick: 0, phone: false, inlineSign: 1, fresh: true, mutations: null };
|
|
1519
|
+
const scene = { root, stage: null, layers: [], progress: 0, target: 0, position: 0, along: 0, height: 0, travel: 0, exit: 0, stick: 0, phone: false, inlineSign: 1, fresh: true, mutations: null };
|
|
1472
1520
|
this.scenes.set(root, scene);
|
|
1473
1521
|
this.resize?.observe(root);
|
|
1474
1522
|
if (this.options.observe) {
|
|
@@ -1634,14 +1682,20 @@ class ScrollDriver {
|
|
|
1634
1682
|
for (const layer of scene.layers)
|
|
1635
1683
|
layer.stale = true;
|
|
1636
1684
|
}
|
|
1637
|
-
/** True when the scroll the driver reads is
|
|
1685
|
+
/** True when the scroll the driver reads is being smoothed right now: it follows it (RT-D2). */
|
|
1638
1686
|
following() {
|
|
1639
1687
|
const follow = this.options.follow;
|
|
1640
1688
|
if (typeof follow === 'function')
|
|
1641
1689
|
return follow();
|
|
1642
1690
|
if (typeof follow === 'boolean')
|
|
1643
1691
|
return follow;
|
|
1644
|
-
|
|
1692
|
+
if (this.options.pin)
|
|
1693
|
+
return false;
|
|
1694
|
+
const scroller = this.scroller();
|
|
1695
|
+
return scroller ? scroller.isSmooth : !!this.host.document?.documentElement?.classList.contains(LENIS_SMOOTH_CLASS);
|
|
1696
|
+
}
|
|
1697
|
+
scroller() {
|
|
1698
|
+
return this.options.pin ? null : pageScroller(this.host);
|
|
1645
1699
|
}
|
|
1646
1700
|
/**
|
|
1647
1701
|
* Where each crossing layer of a Scene stands in its crossing of the stage. Its box is read WITHOUT its own move (its
|
|
@@ -1672,8 +1726,10 @@ class ScrollDriver {
|
|
|
1672
1726
|
viewBox() {
|
|
1673
1727
|
return this.options.view?.() ?? { top: 0, height: this.host.innerHeight };
|
|
1674
1728
|
}
|
|
1675
|
-
readLink(state, view) {
|
|
1676
|
-
const
|
|
1729
|
+
readLink(state, view, subpixel = 0) {
|
|
1730
|
+
const measured = layoutBoxOnScreen(state.link.measured, state.link.within ?? null);
|
|
1731
|
+
const zoom = measured.zoom;
|
|
1732
|
+
const box = subpixel ? { top: measured.box.top - subpixel, height: measured.box.height } : measured.box;
|
|
1677
1733
|
const z = zoom || 1;
|
|
1678
1734
|
const target = rangeProgress(state.link.range, box, view);
|
|
1679
1735
|
state.geometry = { distance: rangeDistance(state.link.range, box, view) / z, viewHeight: view.height / z, opening: this.openingOf(state.link, box, view) };
|
|
@@ -1689,8 +1745,9 @@ class ScrollDriver {
|
|
|
1689
1745
|
const top = page.getBoundingClientRect().top;
|
|
1690
1746
|
return rangeProgress(link.range, { top: view.top + (box.top - top), height: box.height }, view);
|
|
1691
1747
|
}
|
|
1692
|
-
read(scene) {
|
|
1693
|
-
const
|
|
1748
|
+
read(scene, subpixel = 0) {
|
|
1749
|
+
const box = scene.root.getBoundingClientRect();
|
|
1750
|
+
const rect = { top: box.top - subpixel, height: box.height };
|
|
1694
1751
|
const origin = this.options.originOf?.(scene.root)?.getBoundingClientRect().top ?? 0;
|
|
1695
1752
|
const zoom = scene.height ? rect.height / scene.height : 1;
|
|
1696
1753
|
const { local } = sceneScrollState(rect.top, origin + scene.stick * zoom, zoom, scene.travel);
|
|
@@ -1826,5 +1883,5 @@ function attachSceneRoots(roots, options = {}) {
|
|
|
1826
1883
|
* Generated bundle index. Do not edit.
|
|
1827
1884
|
*/
|
|
1828
1885
|
|
|
1829
|
-
export {
|
|
1886
|
+
export { LENIS_SMOOTH_CLASS, LETTER_PIECE_CAP, LIGHT_UP_PIECE_CAP, LetterRefusal, PARALLAX_DEPTH_DEFAULT, PARALLAX_PHONE_FACTOR, PARALLAX_REST_DEFAULT, PARALLAX_SPEED, PROGRESS_BAR_FRAMES, ParallaxDepth, ParallaxPhone, REVEAL_PIECE_CAP, SCENE_BUDGET, SCENE_DAMPING, SCENE_FILM_SMOOTH, SCENE_FLOW_RULES, SCENE_LENGTH, SCENE_MAX_SCREENS, SCENE_MIN_SCREENS, SCENE_PHONE_LENGTH, SCENE_PHONE_MAX_WIDTH, SCENE_REDUCED_MOTION_CSS, SCENE_REVEAL_DEFAULT, SCENE_STAGE_HEIGHT, SCENE_TRACK_DEFS, SCENE_TRACK_EASE, SCENE_WAKE_EVENT, SCENE_WORDS, SCENE_WORD_DIM, SCROLL_RANGE_DEFAULT, SCRUB_PIECES_IN_FLIGHT, SLIDER_HOLD_SHARE, SLIDER_SCROLL_STEP_SCREENS, SceneAttribute, SceneEase, SceneProp, SceneRange, SceneRevealFrom, ScrollActionKind, ScrollDriver, ScrollPlay, ScrollRange, TextRevealBy, TextRevealLook, applySceneFirstFrame, attachSceneRoots, attachScenes, buildSceneRecipe, colourAt, crossesStage, crossingOf, dampToward, followToward, gentleFrames, heldProgress, isHoldTrack, layoutBoxOnScreen, letterCount, letterRefusalOf, lettersSplittable, lightMotionWanted, lineIndexes, movedSceneKey, normalizeParallaxDepth, normalizeParallaxPhone, normalizeScrollRange, normalizeTracks, outermostNodeOf, pageScroller, parallaxFrames, parallaxOffset, parallaxRest, parallaxShift, playTextReveal, rangeDistance, rangeEnds, rangeProgress, revealClipPath, revealStagger, sceneBudget, sceneColourKeyAt, sceneDisplayValue, sceneFilmDensity, sceneFirstFrame, sceneFrame, sceneFrameDeclarations, sceneHasKeyAt, sceneHeightForScreens, sceneKeyPosition, sceneLayersOf, sceneNodeAttributes, scenePlayed, sceneRevealFromOf, sceneRootOnPath, sceneRootsIn, sceneScreensOf, sceneScrollAlong, sceneScrollState, sceneTrackDef, sceneTrackSpan, sceneWordOpacity, sceneWordsLit, scenesIn, scrollPlayFor, scrollSubpixel, scrubPieceProgress, scrubTextReveal, setPageScroller, splitForReveal, splitText, syncSceneAttributes, textPieces, textRevealByOf, textRevealLookOf, trackColourAt, trackEase, trackProgress, trackRange, trackValueAt, unmovedBox, valueAt, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
1830
1887
|
//# sourceMappingURL=vectoriox-iox-ui-scene-core.mjs.map
|