@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.
Files changed (47) hide show
  1. package/actions-core/index.d.ts +171 -3
  2. package/assist-core/index.d.ts +3 -2
  3. package/composite-core/index.d.ts +195 -3
  4. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +243 -2
  5. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  6. package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -5
  7. package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +413 -163
  9. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +456 -27
  11. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  12. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +140 -1
  13. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  14. package/fesm2022/vectoriox-iox-ui-scene-core.mjs +83 -23
  15. package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
  16. package/fesm2022/vectoriox-iox-ui.mjs +387 -11
  17. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  18. package/generation-core/index.d.ts +87 -12
  19. package/harness-core/index.d.ts +132 -2
  20. package/index.d.ts +108 -3
  21. package/package.json +1 -1
  22. package/scene-core/index.d.ts +45 -13
  23. package/src/actions-core/popup-arrival.ts +328 -0
  24. package/src/actions-core/public-api.ts +1 -0
  25. package/src/assist-core/media-generate.ts +6 -5
  26. package/src/composite-core/composite-kinds.ts +9 -0
  27. package/src/composite-core/popup.ts +285 -0
  28. package/src/composite-core/public-api.ts +1 -0
  29. package/src/generation-core/ai-run.ts +65 -2
  30. package/src/generation-core/check-layout.ts +34 -4
  31. package/src/generation-core/compose-layout.ts +211 -10
  32. package/src/generation-core/compose-site.ts +2 -0
  33. package/src/generation-core/layout-drawers.ts +106 -0
  34. package/src/generation-core/layout-fingerprint.ts +3 -0
  35. package/src/generation-core/layout-language.ts +4 -0
  36. package/src/generation-core/layout-space.ts +3 -2
  37. package/src/generation-core/layout-wire.ts +15 -3
  38. package/src/generation-core/patterns.ts +4 -0
  39. package/src/generation-core/pictures.ts +4 -3
  40. package/src/generation-core/site-spec.generated.ts +57 -5
  41. package/src/harness-core/business-types.ts +2 -0
  42. package/src/harness-core/harness-spec.generated.ts +83 -0
  43. package/src/harness-core/popup-stance.ts +111 -0
  44. package/src/harness-core/public-api.ts +1 -0
  45. package/src/scene-core/scene.ts +3 -0
  46. package/src/scene-core/scroll-driver.ts +97 -25
  47. package/styles/iox-design.css +141 -2
@@ -392,6 +392,9 @@ const SCENE_FLOW_RULES = `.iox-role-scene{height:auto!important}`
392
392
  + `[${SceneAttribute.Tracks}]{transform:none!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important}`
393
393
  // A row the scroll slid sideways has no scroll to slide it now: it wraps, or its last items run off the side of a phone.
394
394
  + `[${SceneAttribute.Tracks}]{max-width:100%!important;flex-wrap:wrap!important}`
395
+ // Drawers (AW9) flow as the phone draws them: each step full width, its spine a label above its words.
396
+ + `.iox-role-scene-drawer{width:100%!important;height:auto!important;flex-direction:column!important}`
397
+ + `.iox-role-scene-drawer-spine{writing-mode:horizontal-tb!important;rotate:none!important;width:auto!important;height:auto!important}`
395
398
  // A Video the scroll plays stands as its poster, at the poster's own height: a percent of a stage that now flows is nothing.
396
399
  + `[${VideoAttribute.Frames}]{height:auto!important}`
397
400
  // On the component path it stands inside a host that took no height from it, so the host steps out of the layout.
@@ -1269,10 +1272,11 @@ function scrubTextReveal(el, by, look = TextRevealLook.Rise, easing = 'linear')
1269
1272
  * canvas's zoom the same rectangle divides by the same zoom, and the answer is the same at any scale.
1270
1273
  *
1271
1274
  * - 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): when
1273
- * the page itself scrolls through Lenis its scroll is already smoothed, so the driver FOLLOWS it with no damping of
1274
- * its own (`follow`) — a second damping on top made every picture trail the hand. The canvas (its Lenis scrolls a
1275
- * wrapper the driver pins against) and a page the browser scrolls natively keep the driver's damping.
1275
+ * and why this is not a CSS scroll timeline, which cannot do it. Smoothed ONCE (award plan "Reddottours", RT-D2): while
1276
+ * Lenis is smoothing the page's scroll, the driver FOLLOWS it with no damping of its own (`follow`) — a second damping
1277
+ * on top made every picture trail the hand — and reads it where Lenis has it, not on the whole pixel the browser keeps
1278
+ * (a film turns that pixel into a visible step, vectoriox/iox-ui#140). A scroll Lenis does not smooth (a jump, the
1279
+ * keyboard, the scroll bar) is damped as on a page the browser scrolls natively, and so is the canvas (it pins).
1276
1280
  * - The live site pins with `position: sticky`, on the compositor. The canvas cannot (its page never scrolls itself,
1277
1281
  * its Lenis scrolls a wrapper around a zoomed frame), so `pin` holds the stage there with `translate` instead.
1278
1282
  * `translate`, not `transform`: a Stage may carry tracks of its own.
@@ -1287,8 +1291,11 @@ const MAX_FRAME_SECONDS = 0.1;
1287
1291
  const WAKING_FRAME_SECONDS = 1 / 60;
1288
1292
  const STAGE_SELECTOR = `.iox-role-${SceneRole.Stage.replace(/\./g, '-')}, [${SceneAttribute.Stage}]`;
1289
1293
  const TRANSFORM_WILL_CHANGE = 'transform, opacity';
1290
- /** The class Lenis keeps on the element it scrolls (the document's root, on the live site) for as long as it runs. */
1291
- const LENIS_ROOT_CLASS = 'lenis';
1294
+ /** The class Lenis keeps on the element it scrolls only while it is SMOOTHING a scroll (a jump, the keyboard and the scroll
1295
+ * bar are not smoothed): what a driver with no named scroller reads. */
1296
+ const LENIS_SMOOTH_CLASS = 'lenis-smooth';
1297
+ /** The most the browser's rounding of the scroll can hide, page px; a larger gap is not rounding and is never added. */
1298
+ const MAX_SUBPIXEL = 1;
1292
1299
  /** A crossing that moved less than this since the last frame has stopped moving (it is a 0–1 value). */
1293
1300
  const CROSSING_SETTLED = 0.0001;
1294
1301
  /**
@@ -1303,6 +1310,40 @@ const SCENE_WAKE_EVENT = 'iox-scene-wake';
1303
1310
  * lets it go.
1304
1311
  */
1305
1312
  const HELD = new WeakMap();
1313
+ const PAGE_SCROLLERS = new WeakMap();
1314
+ /**
1315
+ * Name (or, with null, forget) the scroller that smooths a window's DOCUMENT — the iox-ui page scroller does, when it
1316
+ * starts Lenis on the document. Every driver on that window reads it; a scroller of a wrapper is never named here.
1317
+ */
1318
+ function setPageScroller(host, scroller) {
1319
+ if (scroller)
1320
+ PAGE_SCROLLERS.set(host, scroller);
1321
+ else
1322
+ PAGE_SCROLLERS.delete(host);
1323
+ }
1324
+ /** The scroller named for a window's document, if any. */
1325
+ function pageScroller(host) {
1326
+ return PAGE_SCROLLERS.get(host) ?? null;
1327
+ }
1328
+ /**
1329
+ * Page px the scroller has the page past where the browser drew it (its whole pixel): what a driver adds back, so a film
1330
+ * never steps by the page's pixels. Read while smoothing AND after: a smoothing ends on its own unrounded value, and the
1331
+ * film rests there rather than stepping back onto the pixel. 0 with no scroller, or a gap larger than rounding makes.
1332
+ */
1333
+ function scrollSubpixel(scroller) {
1334
+ if (!scroller)
1335
+ return 0;
1336
+ const gap = scroller.scroll - scroller.actualScroll;
1337
+ return Number.isFinite(gap) && Math.abs(gap) <= MAX_SUBPIXEL ? gap : 0;
1338
+ }
1339
+ /**
1340
+ * One frame of a driver that FOLLOWS an already smoothed scroll (RT-D2): the scroll's own move since the last frame is
1341
+ * taken whole, and only a gap left from before (a damped jump the smoothing then continued) is damped away. With no gap
1342
+ * it stands exactly on the scroll; it never snaps across one.
1343
+ */
1344
+ function followToward(current, previousTarget, target, seconds, rate = SCENE_DAMPING) {
1345
+ return dampToward(current + (target - previousTarget), target, seconds, rate);
1346
+ }
1306
1347
  function sliderOf(stage) {
1307
1348
  // The stage is the runway's child: the `.swiper` itself (both engine paths), or the canvas's shell around it.
1308
1349
  const holder = (stage?.classList.contains('swiper') ? stage : stage?.querySelector('.swiper'));
@@ -1411,22 +1452,29 @@ class ScrollDriver {
1411
1452
  const seconds = this.lastTime ? Math.min(MAX_FRAME_SECONDS, (now - this.lastTime) / 1000) : WAKING_FRAME_SECONDS;
1412
1453
  this.lastTime = now;
1413
1454
  const follow = this.following();
1414
- const reads = [...this.scenes.values()].map(scene => this.read(scene));
1455
+ // Where the page's scroller has the page beyond the browser's whole pixel: read with it, so a film does not step by
1456
+ // pixels. Not when the host says outright how to follow (`follow`): it reads its own scroll.
1457
+ const subpixel = this.options.follow === undefined ? scrollSubpixel(this.scroller()) : 0;
1458
+ const reads = [...this.scenes.values()].map(scene => this.read(scene, subpixel));
1415
1459
  // Each layer that moves over its own crossing is read with the rest, before any write: where its row stood after the
1416
1460
  // last frame. A row that moved since is read again on the next frame, so the crossing lands where the row lands.
1417
1461
  const crossed = reads.map(({ scene }) => this.readCrossings(scene)).some(Boolean);
1418
1462
  const view = this.links.size ? this.viewBox() : null;
1419
- const linkReads = [...this.links].map(state => this.readLink(state, view));
1463
+ const linkReads = [...this.links].map(state => this.readLink(state, view, subpixel));
1420
1464
  let moving = crossed;
1421
1465
  for (const { scene, local, along } of reads) {
1422
1466
  if (this.options.pin && scene.stage)
1423
1467
  scene.stage.style.setProperty('translate', `0 ${local}px`);
1424
- const immediate = scene.fresh || follow;
1425
- const next = immediate ? along : dampToward(scene.position, along, seconds, this.options.damping);
1426
- // The step onto the scroll is what is left: taken once it is under SETTLED_PX, so it never shows.
1427
- const settled = immediate || Math.abs(along - scene.position) < SETTLED_PX;
1468
+ const next = scene.fresh ? along
1469
+ : follow ? followToward(scene.position, scene.along, along, seconds, this.options.damping)
1470
+ : dampToward(scene.position, along, seconds, this.options.damping);
1471
+ // The step onto the scroll is what is left: taken once it is under SETTLED_PX, so it never shows. Following, what
1472
+ // is left is the gap from before (the scroll's own move is taken whole).
1473
+ const gap = follow ? scene.along - scene.position : along - scene.position;
1474
+ const settled = scene.fresh || Math.abs(gap) < SETTLED_PX;
1428
1475
  const before = scene.position;
1429
1476
  scene.position = settled ? along : next;
1477
+ scene.along = along;
1430
1478
  // A crossing was read before this frame moved its row: it is read again on the next frame, after the move.
1431
1479
  if (scene.position !== before && scene.layers.some(layer => layer.crosses))
1432
1480
  moving = true;
@@ -1439,9 +1487,12 @@ class ScrollDriver {
1439
1487
  moving = moving || !settled;
1440
1488
  }
1441
1489
  for (const { state, target } of linkReads) {
1442
- const immediate = state.fresh || !!state.link.immediate || follow;
1443
- const next = immediate ? target : dampToward(state.progress, target, seconds, this.options.damping);
1444
- const settled = immediate || Math.abs(target - state.progress) * Math.max(1, state.geometry.distance) < SETTLED_PX;
1490
+ const immediate = state.fresh || !!state.link.immediate;
1491
+ const next = immediate ? target
1492
+ : follow ? followToward(state.progress, state.target, target, seconds, this.options.damping)
1493
+ : dampToward(state.progress, target, seconds, this.options.damping);
1494
+ const gap = follow ? state.target - state.progress : target - state.progress;
1495
+ const settled = immediate || Math.abs(gap) * Math.max(1, state.geometry.distance) < SETTLED_PX;
1445
1496
  state.progress = settled ? target : next;
1446
1497
  state.target = target;
1447
1498
  state.fresh = false;
@@ -1468,7 +1519,7 @@ class ScrollDriver {
1468
1519
  return false;
1469
1520
  this.remove(root);
1470
1521
  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 };
1522
+ 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
1523
  this.scenes.set(root, scene);
1473
1524
  this.resize?.observe(root);
1474
1525
  if (this.options.observe) {
@@ -1634,14 +1685,20 @@ class ScrollDriver {
1634
1685
  for (const layer of scene.layers)
1635
1686
  layer.stale = true;
1636
1687
  }
1637
- /** True when the scroll the driver reads is already smoothed: it follows it exactly (RT-D2). */
1688
+ /** True when the scroll the driver reads is being smoothed right now: it follows it (RT-D2). */
1638
1689
  following() {
1639
1690
  const follow = this.options.follow;
1640
1691
  if (typeof follow === 'function')
1641
1692
  return follow();
1642
1693
  if (typeof follow === 'boolean')
1643
1694
  return follow;
1644
- return !this.options.pin && !!this.host.document?.documentElement?.classList.contains(LENIS_ROOT_CLASS);
1695
+ if (this.options.pin)
1696
+ return false;
1697
+ const scroller = this.scroller();
1698
+ return scroller ? scroller.isSmooth : !!this.host.document?.documentElement?.classList.contains(LENIS_SMOOTH_CLASS);
1699
+ }
1700
+ scroller() {
1701
+ return this.options.pin ? null : pageScroller(this.host);
1645
1702
  }
1646
1703
  /**
1647
1704
  * 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 +1729,10 @@ class ScrollDriver {
1672
1729
  viewBox() {
1673
1730
  return this.options.view?.() ?? { top: 0, height: this.host.innerHeight };
1674
1731
  }
1675
- readLink(state, view) {
1676
- const { box, zoom } = layoutBoxOnScreen(state.link.measured, state.link.within ?? null);
1732
+ readLink(state, view, subpixel = 0) {
1733
+ const measured = layoutBoxOnScreen(state.link.measured, state.link.within ?? null);
1734
+ const zoom = measured.zoom;
1735
+ const box = subpixel ? { top: measured.box.top - subpixel, height: measured.box.height } : measured.box;
1677
1736
  const z = zoom || 1;
1678
1737
  const target = rangeProgress(state.link.range, box, view);
1679
1738
  state.geometry = { distance: rangeDistance(state.link.range, box, view) / z, viewHeight: view.height / z, opening: this.openingOf(state.link, box, view) };
@@ -1689,8 +1748,9 @@ class ScrollDriver {
1689
1748
  const top = page.getBoundingClientRect().top;
1690
1749
  return rangeProgress(link.range, { top: view.top + (box.top - top), height: box.height }, view);
1691
1750
  }
1692
- read(scene) {
1693
- const rect = scene.root.getBoundingClientRect();
1751
+ read(scene, subpixel = 0) {
1752
+ const box = scene.root.getBoundingClientRect();
1753
+ const rect = { top: box.top - subpixel, height: box.height };
1694
1754
  const origin = this.options.originOf?.(scene.root)?.getBoundingClientRect().top ?? 0;
1695
1755
  const zoom = scene.height ? rect.height / scene.height : 1;
1696
1756
  const { local } = sceneScrollState(rect.top, origin + scene.stick * zoom, zoom, scene.travel);
@@ -1826,5 +1886,5 @@ function attachSceneRoots(roots, options = {}) {
1826
1886
  * Generated bundle index. Do not edit.
1827
1887
  */
1828
1888
 
1829
- export { LENIS_ROOT_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, gentleFrames, heldProgress, isHoldTrack, layoutBoxOnScreen, letterCount, letterRefusalOf, lettersSplittable, lightMotionWanted, lineIndexes, movedSceneKey, normalizeParallaxDepth, normalizeParallaxPhone, normalizeScrollRange, normalizeTracks, outermostNodeOf, 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, scrubPieceProgress, scrubTextReveal, splitForReveal, splitText, syncSceneAttributes, textPieces, textRevealByOf, textRevealLookOf, trackColourAt, trackEase, trackProgress, trackRange, trackValueAt, unmovedBox, valueAt, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
1889
+ 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
1890
  //# sourceMappingURL=vectoriox-iox-ui-scene-core.mjs.map