@vectoriox/iox-ui 5.86.4 → 5.88.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 +17 -3
- package/composite-core/index.d.ts +208 -2
- package/design-core/index.d.ts +373 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +30 -4
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +656 -116
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +444 -3
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +28 -8
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +231 -7
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +603 -20
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +26 -2
- package/index.d.ts +196 -2
- package/package.json +1 -1
- package/scene-core/index.d.ts +158 -2
- package/src/actions-core/action.model.ts +3 -0
- package/src/actions-core/element-actions.ts +32 -3
- package/src/composite-core/marquee-runtime.ts +255 -0
- package/src/composite-core/marquee.ts +267 -0
- package/src/composite-core/public-api.ts +3 -0
- package/src/composite-core/scroll-recipes.ts +74 -0
- package/src/composite-core/structure.ts +7 -0
- package/src/design-core/contrast-audit.ts +6 -1
- package/src/design-core/flavor-spec.generated.ts +435 -1
- package/src/generation-core/ai-run.ts +9 -6
- package/src/generation-core/node-baselines.generated.ts +5 -1
- package/src/generation-core/pictures.ts +32 -0
- package/src/scene-core/public-api.ts +1 -0
- package/src/scene-core/scroll-driver.ts +98 -0
- package/src/scene-core/scroll-range.ts +195 -0
- package/styles/iox-design.css +49 -1
|
@@ -62,16 +62,16 @@ const SLIDER_SCROLL_STEP_SCREENS = 0.55;
|
|
|
62
62
|
function heldProgress(p, n) {
|
|
63
63
|
if (!(n >= 2) || !Number.isFinite(p))
|
|
64
64
|
return 0;
|
|
65
|
-
const s = clamp01(p) * (n - 1);
|
|
65
|
+
const s = clamp01$1(p) * (n - 1);
|
|
66
66
|
const i = Math.min(n - 2, Math.floor(s));
|
|
67
|
-
const f = clamp01((s - i - SLIDER_HOLD_SHARE) / (1 - 2 * SLIDER_HOLD_SHARE));
|
|
67
|
+
const f = clamp01$1((s - i - SLIDER_HOLD_SHARE) / (1 - 2 * SLIDER_HOLD_SHARE));
|
|
68
68
|
return round((i + smoothstep(f)) / (n - 1));
|
|
69
69
|
}
|
|
70
70
|
/** At or under this stage width a layer plays its phone tracks. The `mobile` breakpoint's width. */
|
|
71
71
|
const SCENE_PHONE_MAX_WIDTH = FRAMES_PHONE_MAX_WIDTH;
|
|
72
72
|
const DECIMALS = 10000;
|
|
73
73
|
const round = (v) => Math.round(v * DECIMALS) / DECIMALS;
|
|
74
|
-
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
74
|
+
const clamp01$1 = (v) => Math.min(1, Math.max(0, v));
|
|
75
75
|
const smoothstep = (t) => t * t * (3 - 2 * t);
|
|
76
76
|
/** A colour a track may hold: a hex, an rgb()/hsl() literal, or a design token. Anything else could break out of the
|
|
77
77
|
* inline style it lands in. */
|
|
@@ -137,7 +137,7 @@ function revealClipPath(showing, from = SCENE_REVEAL_DEFAULT, inlineSign = 1) {
|
|
|
137
137
|
const linear = (t) => t;
|
|
138
138
|
/** The two keys around `p` and how far between them it has come. */
|
|
139
139
|
function span(keys, p, ease = smoothstep) {
|
|
140
|
-
const at = clamp01(p);
|
|
140
|
+
const at = clamp01$1(p);
|
|
141
141
|
if (at <= keys[0][0])
|
|
142
142
|
return { a: keys[0], b: keys[0], f: 0 };
|
|
143
143
|
for (let i = 1; i < keys.length; i++) {
|
|
@@ -186,7 +186,7 @@ function sceneFrame(tracks, p, options = {}) {
|
|
|
186
186
|
if (prop in TRANSFORM_REST)
|
|
187
187
|
moves[prop] = valueAt(keys, p);
|
|
188
188
|
else if (prop === SceneProp.Opacity) {
|
|
189
|
-
const opacity = clamp01(valueAt(keys, p));
|
|
189
|
+
const opacity = clamp01$1(valueAt(keys, p));
|
|
190
190
|
frame.opacity = String(opacity);
|
|
191
191
|
frame.pointerEvents = opacity > 0 ? '' : 'none';
|
|
192
192
|
}
|
|
@@ -221,7 +221,7 @@ function scenePlayed(tracks, p) {
|
|
|
221
221
|
}
|
|
222
222
|
/** Word `index` of `count`, with `lit` % lit: words light one after the other, each easing in as the last finishes. */
|
|
223
223
|
function sceneWordOpacity(index, count, lit) {
|
|
224
|
-
return round(SCENE_WORD_DIM + (1 - SCENE_WORD_DIM) * clamp01((lit / PERCENT$1) * count - index));
|
|
224
|
+
return round(SCENE_WORD_DIM + (1 - SCENE_WORD_DIM) * clamp01$1((lit / PERCENT$1) * count - index));
|
|
225
225
|
}
|
|
226
226
|
const CSS_NAME = {
|
|
227
227
|
transform: 'transform',
|
|
@@ -618,6 +618,173 @@ function buildSceneRecipe(create, words = {}) {
|
|
|
618
618
|
return root;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Scroll-driven motion outside a Scene (premium components M6, N7 — Motion v2 V1). An element plays its actions by WHERE
|
|
623
|
+
* it stands in the page, not by time: a fade that follows the scroll, a layer that glides at its own depth, a bar that
|
|
624
|
+
* fills as the page is read. Every one of them rides the ONE `ScrollDriver` (its links), never a loop of its own.
|
|
625
|
+
*
|
|
626
|
+
* The ranges are CSS's named view-timeline ranges, so a `view()` timeline could take them over 1:1, plus the whole page
|
|
627
|
+
* (a reading-progress bar). The maths is pure: geometry in, progress out, the same at any canvas zoom because every length
|
|
628
|
+
* is in one space.
|
|
629
|
+
*/
|
|
630
|
+
var ScrollRange;
|
|
631
|
+
(function (ScrollRange) {
|
|
632
|
+
/** From the element's top edge at the bottom of the screen until it is wholly in (CSS `entry`). */
|
|
633
|
+
ScrollRange["Enter"] = "enter";
|
|
634
|
+
/** From the moment it starts to come in until it has wholly left (CSS `cover`). */
|
|
635
|
+
ScrollRange["Cover"] = "cover";
|
|
636
|
+
/** While it is wholly in view, or, when it is taller than the screen, while it fills it (CSS `contain`). */
|
|
637
|
+
ScrollRange["Contain"] = "contain";
|
|
638
|
+
/** From the moment it starts to leave until it has gone (CSS `exit`). */
|
|
639
|
+
ScrollRange["Exit"] = "exit";
|
|
640
|
+
/** The section the element stands in, while it is read: Contain, measured on the section (a section's reading bar). */
|
|
641
|
+
ScrollRange["Section"] = "section";
|
|
642
|
+
/** The whole page, from its top to its bottom: how much of it has been read. */
|
|
643
|
+
ScrollRange["Page"] = "page";
|
|
644
|
+
})(ScrollRange || (ScrollRange = {}));
|
|
645
|
+
const SCROLL_RANGE_DEFAULT = ScrollRange.Cover;
|
|
646
|
+
const RANGES = new Set(Object.values(ScrollRange));
|
|
647
|
+
/** The node element that holds `el` outermost — its section on the page — stopping below `stop`. A node element is one
|
|
648
|
+
* carrying its `iox-node-<id>` class, in every render path; a wrapper a renderer drew around nodes is never one. */
|
|
649
|
+
function outermostNodeOf(el, stop = null) {
|
|
650
|
+
let found = el;
|
|
651
|
+
for (let p = el.parentElement; p && p !== stop; p = p.parentElement) {
|
|
652
|
+
if (Array.from(p.classList).some(c => c.startsWith('iox-node-')))
|
|
653
|
+
found = p;
|
|
654
|
+
}
|
|
655
|
+
return found;
|
|
656
|
+
}
|
|
657
|
+
/** A saved range, or the default for anything else. */
|
|
658
|
+
function normalizeScrollRange(value) {
|
|
659
|
+
return typeof value === 'string' && RANGES.has(value) ? value : SCROLL_RANGE_DEFAULT;
|
|
660
|
+
}
|
|
661
|
+
const clamp01 = (v) => Math.min(1, Math.max(0, v));
|
|
662
|
+
/** Where a range starts and ends, as the element's top relative to the view's top. */
|
|
663
|
+
function rangeEnds(range, box, view) {
|
|
664
|
+
const vh = view.height;
|
|
665
|
+
const h = box.height;
|
|
666
|
+
const fit = vh - h;
|
|
667
|
+
switch (range) {
|
|
668
|
+
case ScrollRange.Enter: return { start: vh, end: Math.max(fit, 0) };
|
|
669
|
+
case ScrollRange.Contain:
|
|
670
|
+
case ScrollRange.Section: return { start: Math.max(fit, 0), end: Math.min(fit, 0) };
|
|
671
|
+
case ScrollRange.Exit: return { start: Math.min(fit, 0), end: -h };
|
|
672
|
+
default: return { start: vh, end: -h };
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
/** How far the scroll travels through a range, in the box's space: what a parallax depth is a share of. */
|
|
676
|
+
function rangeDistance(range, box, view) {
|
|
677
|
+
if (range === ScrollRange.Page)
|
|
678
|
+
return Math.max(0, box.height - view.height);
|
|
679
|
+
const { start, end } = rangeEnds(range, box, view);
|
|
680
|
+
return Math.abs(start - end);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* How far `box` has come through `range` of `view`, 0–1. For `Page`, `box` is the page itself: 0 at its top, 1 once its
|
|
684
|
+
* bottom reaches the bottom of the view. A range of no length is a step: 0 before it, 1 from it on.
|
|
685
|
+
*/
|
|
686
|
+
function rangeProgress(range, box, view) {
|
|
687
|
+
if (range === ScrollRange.Page) {
|
|
688
|
+
const travel = box.height - view.height;
|
|
689
|
+
return travel > 0 ? clamp01((view.top - box.top) / travel) : 0;
|
|
690
|
+
}
|
|
691
|
+
const { start, end } = rangeEnds(range, box, view);
|
|
692
|
+
const t = box.top - view.top;
|
|
693
|
+
if (start === end)
|
|
694
|
+
return t <= start ? 1 : 0;
|
|
695
|
+
return clamp01((start - t) / (start - end));
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* The parallax trio (round three's back · middle · front). Middle is the page's own speed, so it is no action at all.
|
|
699
|
+
* Back glides slower than the page, front faster: a share of the scroll it travels through.
|
|
700
|
+
*/
|
|
701
|
+
var ParallaxDepth;
|
|
702
|
+
(function (ParallaxDepth) {
|
|
703
|
+
ParallaxDepth["Back"] = "back";
|
|
704
|
+
ParallaxDepth["Front"] = "front";
|
|
705
|
+
})(ParallaxDepth || (ParallaxDepth = {}));
|
|
706
|
+
const PARALLAX_DEPTH_DEFAULT = ParallaxDepth.Back;
|
|
707
|
+
/** The share of the scroll a depth moves against the page. Round three moved its layers by about this much. */
|
|
708
|
+
const PARALLAX_SPEED = 0.3;
|
|
709
|
+
/** A phone's layers move half as far: on a narrow stack a glide reaches the next block sooner (round three's phone rule). */
|
|
710
|
+
const PARALLAX_PHONE_FACTOR = 0.5;
|
|
711
|
+
function normalizeParallaxDepth(value) {
|
|
712
|
+
return value === ParallaxDepth.Front ? ParallaxDepth.Front : PARALLAX_DEPTH_DEFAULT;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* How far a layer stands off its place at each end of its range, in the box's px: it runs from `-shift` to `+shift`
|
|
716
|
+
* (back) or the other way (front), and stands exactly in its place halfway. Never more than the share of one screen, so
|
|
717
|
+
* a tall layer never slides a screen away from what it belongs to.
|
|
718
|
+
*/
|
|
719
|
+
function parallaxShift(distance, viewHeight, options = {}) {
|
|
720
|
+
const speed = PARALLAX_SPEED * (options.phone ? PARALLAX_PHONE_FACTOR : 1);
|
|
721
|
+
const shift = speed * Math.min(Math.max(0, distance) / 2, Math.max(0, viewHeight));
|
|
722
|
+
return Math.round(shift * 10) / 10;
|
|
723
|
+
}
|
|
724
|
+
/** The frames of a parallax depth over its range: the individual `translate` property, so the element's own `transform`
|
|
725
|
+
* (a hover lift, an entrance) is never overwritten. */
|
|
726
|
+
function parallaxFrames(depth, shift) {
|
|
727
|
+
const sign = depth === ParallaxDepth.Front ? -1 : 1;
|
|
728
|
+
return [{ translate: `0 ${-sign * shift}px` }, { translate: `0 ${sign * shift}px` }];
|
|
729
|
+
}
|
|
730
|
+
/** A bar that fills along the reading direction: the individual `scale` property, from its reading start (iox-design.css). */
|
|
731
|
+
const PROGRESS_BAR_FRAMES = Object.freeze([{ scale: '0 1' }, { scale: '1 1' }]);
|
|
732
|
+
/** What a scroll-driven action is, for what each visitor gets of it (`scrollPlayFor`). */
|
|
733
|
+
var ScrollActionKind;
|
|
734
|
+
(function (ScrollActionKind) {
|
|
735
|
+
/** A glide at a depth: pure decoration. */
|
|
736
|
+
ScrollActionKind["Parallax"] = "parallax";
|
|
737
|
+
/** How much has been read: information, tied to the visitor's own scroll. */
|
|
738
|
+
ScrollActionKind["Progress"] = "progress";
|
|
739
|
+
/** Any entrance or exit, played by the scroll instead of the clock. */
|
|
740
|
+
ScrollActionKind["Scrub"] = "scrub";
|
|
741
|
+
})(ScrollActionKind || (ScrollActionKind = {}));
|
|
742
|
+
/** What a visitor gets of one scroll-driven action. */
|
|
743
|
+
var ScrollPlay;
|
|
744
|
+
(function (ScrollPlay) {
|
|
745
|
+
/** All of it. */
|
|
746
|
+
ScrollPlay["Full"] = "full";
|
|
747
|
+
/** Its opacity only: no movement (reduced motion, Emil 192: gentler, not zero). */
|
|
748
|
+
ScrollPlay["Gentle"] = "gentle";
|
|
749
|
+
/** Nothing: the element stands as it is, where it is. */
|
|
750
|
+
ScrollPlay["Rest"] = "rest";
|
|
751
|
+
})(ScrollPlay || (ScrollPlay = {}));
|
|
752
|
+
const PLAY = {
|
|
753
|
+
// Decoration goes first: reduced motion and a light device keep the layer in its place.
|
|
754
|
+
[ScrollActionKind.Parallax]: { reduced: ScrollPlay.Rest, light: ScrollPlay.Rest },
|
|
755
|
+
// A reading bar is the visitor's own scroll drawn: it stays, and under reduced motion it follows with no glide.
|
|
756
|
+
[ScrollActionKind.Progress]: { reduced: ScrollPlay.Full, light: ScrollPlay.Full },
|
|
757
|
+
// A scrubbed fade keeps its fade under reduced motion; a light device sees the element as it rests.
|
|
758
|
+
[ScrollActionKind.Scrub]: { reduced: ScrollPlay.Gentle, light: ScrollPlay.Rest },
|
|
759
|
+
};
|
|
760
|
+
/** THE degrade (motion-v2 §3d/§3e): one table, read by the canvas and both engine paths. */
|
|
761
|
+
function scrollPlayFor(kind, env) {
|
|
762
|
+
if (env.reducedMotion)
|
|
763
|
+
return PLAY[kind].reduced;
|
|
764
|
+
if (env.light)
|
|
765
|
+
return PLAY[kind].light;
|
|
766
|
+
return ScrollPlay.Full;
|
|
767
|
+
}
|
|
768
|
+
/** Properties a Gentle play keeps: what changes colour or opacity, never place. */
|
|
769
|
+
const GENTLE_PROPERTIES = new Set(['opacity', 'color', 'backgroundColor', 'offset', 'easing']);
|
|
770
|
+
/** A frame list cut down to what a Gentle play keeps; empty when nothing is left to play. */
|
|
771
|
+
function gentleFrames(frames) {
|
|
772
|
+
const cut = frames.map(frame => Object.fromEntries(Object.entries(frame).filter(([key]) => GENTLE_PROPERTIES.has(key))));
|
|
773
|
+
return cut.some(frame => Object.keys(frame).some(key => key !== 'offset' && key !== 'easing')) ? cut : [];
|
|
774
|
+
}
|
|
775
|
+
/** The least memory a device may report before decoration stays still. Not `hardwareConcurrency`: Safari caps it, and an
|
|
776
|
+
* iPhone would read as a weak device. */
|
|
777
|
+
const LIGHT_DEVICE_MEMORY_GB = 2;
|
|
778
|
+
/** True when the visitor asked to save data, or the device reports little memory: scrubs and depths rest. */
|
|
779
|
+
function lightMotionWanted(host = typeof window !== 'undefined' ? window : null) {
|
|
780
|
+
const nav = host?.navigator;
|
|
781
|
+
if (!nav)
|
|
782
|
+
return false;
|
|
783
|
+
if (nav.connection?.saveData)
|
|
784
|
+
return true;
|
|
785
|
+
return typeof nav.deviceMemory === 'number' && nav.deviceMemory <= LIGHT_DEVICE_MEMORY_GB;
|
|
786
|
+
}
|
|
787
|
+
|
|
621
788
|
/**
|
|
622
789
|
* Text into pieces, in the browser only (premium sites SC3, Motion v2 §3c). A saved node keeps its plain text and the
|
|
623
790
|
* server sends it whole, so every word is in the raw response, editing never meets a piece, and there is no markup for
|
|
@@ -828,6 +995,24 @@ function sceneScrollState(rootTop, originTop, zoom, travel) {
|
|
|
828
995
|
const local = Math.min(travel, Math.max(0, -(rootTop - originTop) / (zoom || 1)));
|
|
829
996
|
return { local, progress: local / travel };
|
|
830
997
|
}
|
|
998
|
+
/**
|
|
999
|
+
* Where an element's LAYOUT box stands on screen: its offsets up to the nearest box that has no offset parent, placed by
|
|
1000
|
+
* that box's own rectangle. Transforms on the element itself are not in it — a layer that glides is measured where it
|
|
1001
|
+
* stands in the flow, so what it is moved by never feeds back into how far it is moved. `zoom` undoes the canvas's scale.
|
|
1002
|
+
*/
|
|
1003
|
+
function layoutBoxOnScreen(el, within = null) {
|
|
1004
|
+
let offset = 0;
|
|
1005
|
+
let ref = el;
|
|
1006
|
+
// Never past `within` (the page): offsets inside the canvas's zoomed frame are its own px, and the box that places them
|
|
1007
|
+
// must be drawn at the same zoom.
|
|
1008
|
+
while (ref.offsetParent instanceof HTMLElement && (!within || within.contains(ref.offsetParent))) {
|
|
1009
|
+
offset += ref.offsetTop;
|
|
1010
|
+
ref = ref.offsetParent;
|
|
1011
|
+
}
|
|
1012
|
+
const rect = ref.getBoundingClientRect();
|
|
1013
|
+
const zoom = ref.offsetHeight > 0 && rect.height > 0 ? rect.height / ref.offsetHeight : 1;
|
|
1014
|
+
return { box: { top: rect.top + offset * zoom, height: el.offsetHeight * zoom }, zoom };
|
|
1015
|
+
}
|
|
831
1016
|
function parseTracks(raw) {
|
|
832
1017
|
if (!raw)
|
|
833
1018
|
return [];
|
|
@@ -842,6 +1027,7 @@ class ScrollDriver {
|
|
|
842
1027
|
constructor(options = {}) {
|
|
843
1028
|
this.options = options;
|
|
844
1029
|
this.scenes = new Map();
|
|
1030
|
+
this.links = new Set();
|
|
845
1031
|
this.frame = 0;
|
|
846
1032
|
this.lastTime = 0;
|
|
847
1033
|
this.wakeUp = () => this.wake();
|
|
@@ -856,6 +1042,8 @@ class ScrollDriver {
|
|
|
856
1042
|
const seconds = this.lastTime ? Math.min(MAX_FRAME_SECONDS, (now - this.lastTime) / 1000) : WAKING_FRAME_SECONDS;
|
|
857
1043
|
this.lastTime = now;
|
|
858
1044
|
const reads = [...this.scenes.values()].map(scene => this.read(scene));
|
|
1045
|
+
const view = this.links.size ? this.viewBox() : null;
|
|
1046
|
+
const linkReads = [...this.links].map(state => this.readLink(state, view));
|
|
859
1047
|
let moving = false;
|
|
860
1048
|
for (const { scene, local, target } of reads) {
|
|
861
1049
|
if (this.options.pin && scene.stage)
|
|
@@ -870,6 +1058,16 @@ class ScrollDriver {
|
|
|
870
1058
|
this.options.onFrame?.(scene.root, { target, progress: scene.progress });
|
|
871
1059
|
moving = moving || !settled;
|
|
872
1060
|
}
|
|
1061
|
+
for (const { state, target } of linkReads) {
|
|
1062
|
+
const immediate = state.fresh || !!state.link.immediate;
|
|
1063
|
+
const next = immediate ? target : dampToward(state.progress, target, seconds, this.options.damping);
|
|
1064
|
+
const settled = immediate || Math.abs(target - state.progress) * Math.max(1, state.geometry.distance) < SETTLED_PX;
|
|
1065
|
+
state.progress = settled ? target : next;
|
|
1066
|
+
state.target = target;
|
|
1067
|
+
state.fresh = false;
|
|
1068
|
+
state.link.write(state.progress, state.geometry);
|
|
1069
|
+
moving = moving || !settled;
|
|
1070
|
+
}
|
|
873
1071
|
if (moving)
|
|
874
1072
|
this.wake();
|
|
875
1073
|
else
|
|
@@ -964,6 +1162,20 @@ class ScrollDriver {
|
|
|
964
1162
|
scene.stage.style.setProperty('translate', `0 ${this.read(scene).local}px`);
|
|
965
1163
|
}
|
|
966
1164
|
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Follow where `link.measured` stands, on this loop. Returns the way to let go. A link that is added lands on its first
|
|
1167
|
+
* frame exactly where the scroll is, with no glide.
|
|
1168
|
+
*/
|
|
1169
|
+
addLink(link) {
|
|
1170
|
+
const state = { link, progress: 0, target: 0, fresh: true, geometry: { distance: 0, viewHeight: 0 } };
|
|
1171
|
+
this.links.add(state);
|
|
1172
|
+
this.wake();
|
|
1173
|
+
return () => { this.links.delete(state); };
|
|
1174
|
+
}
|
|
1175
|
+
/** True while it plays anything: a Scene or a link. */
|
|
1176
|
+
get busy() {
|
|
1177
|
+
return this.scenes.size > 0 || this.links.size > 0;
|
|
1178
|
+
}
|
|
967
1179
|
/** Something moved that no scroll or resize announces (the canvas's zoom). */
|
|
968
1180
|
wake() {
|
|
969
1181
|
if (this.frame)
|
|
@@ -979,6 +1191,7 @@ class ScrollDriver {
|
|
|
979
1191
|
this.host.removeEventListener(SCENE_WAKE_EVENT, this.onWakeEvent, { capture: true });
|
|
980
1192
|
for (const root of [...this.scenes.keys()])
|
|
981
1193
|
this.remove(root);
|
|
1194
|
+
this.links.clear();
|
|
982
1195
|
this.resize?.disconnect();
|
|
983
1196
|
}
|
|
984
1197
|
/** Read a root's stage and layers from its DOM: its own Scene's only, never a nested one's. */
|
|
@@ -1034,6 +1247,17 @@ class ScrollDriver {
|
|
|
1034
1247
|
for (const layer of scene.layers)
|
|
1035
1248
|
layer.stale = true;
|
|
1036
1249
|
}
|
|
1250
|
+
/** The part of the page on screen: the host's own, or the window. */
|
|
1251
|
+
viewBox() {
|
|
1252
|
+
return this.options.view?.() ?? { top: 0, height: this.host.innerHeight };
|
|
1253
|
+
}
|
|
1254
|
+
readLink(state, view) {
|
|
1255
|
+
const { box, zoom } = layoutBoxOnScreen(state.link.measured, state.link.within ?? null);
|
|
1256
|
+
const z = zoom || 1;
|
|
1257
|
+
const target = rangeProgress(state.link.range, box, view);
|
|
1258
|
+
state.geometry = { distance: rangeDistance(state.link.range, box, view) / z, viewHeight: view.height / z };
|
|
1259
|
+
return { state, target };
|
|
1260
|
+
}
|
|
1037
1261
|
read(scene) {
|
|
1038
1262
|
const rect = scene.root.getBoundingClientRect();
|
|
1039
1263
|
const origin = this.options.originOf?.(scene.root)?.getBoundingClientRect().top ?? 0;
|
|
@@ -1169,5 +1393,5 @@ function attachSceneRoots(roots, options = {}) {
|
|
|
1169
1393
|
* Generated bundle index. Do not edit.
|
|
1170
1394
|
*/
|
|
1171
1395
|
|
|
1172
|
-
export { LIGHT_UP_PIECE_CAP, 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_WAKE_EVENT, SCENE_WORDS, SCENE_WORD_DIM, SLIDER_HOLD_SHARE, SLIDER_SCROLL_STEP_SCREENS, SceneAttribute, SceneProp, SceneRevealFrom, ScrollDriver, TextRevealBy, applySceneFirstFrame, attachSceneRoots, attachScenes, buildSceneRecipe, colourAt, dampToward, heldProgress, lineIndexes, movedSceneKey, normalizeTracks, playTextReveal, revealClipPath, revealStagger, sceneBudget, sceneColourKeyAt, sceneDisplayValue, sceneFilmDensity, sceneFirstFrame, sceneFrame, sceneFrameDeclarations, sceneHasKeyAt, sceneHeightForScreens, sceneKeyPosition, sceneLayersOf, sceneNodeAttributes, scenePlayed, sceneRevealFromOf, sceneRootOnPath, sceneRootsIn, sceneScreensOf, sceneScrollState, sceneTrackDef, sceneTrackSpan, sceneWordOpacity, sceneWordsLit, scenesIn, splitText, syncSceneAttributes, textPieces, valueAt, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
1396
|
+
export { LIGHT_UP_PIECE_CAP, PARALLAX_DEPTH_DEFAULT, PARALLAX_PHONE_FACTOR, PARALLAX_SPEED, PROGRESS_BAR_FRAMES, ParallaxDepth, 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_WAKE_EVENT, SCENE_WORDS, SCENE_WORD_DIM, SCROLL_RANGE_DEFAULT, SLIDER_HOLD_SHARE, SLIDER_SCROLL_STEP_SCREENS, SceneAttribute, SceneProp, SceneRevealFrom, ScrollActionKind, ScrollDriver, ScrollPlay, ScrollRange, TextRevealBy, applySceneFirstFrame, attachSceneRoots, attachScenes, buildSceneRecipe, colourAt, dampToward, gentleFrames, heldProgress, layoutBoxOnScreen, lightMotionWanted, lineIndexes, movedSceneKey, normalizeParallaxDepth, normalizeScrollRange, normalizeTracks, outermostNodeOf, parallaxFrames, parallaxShift, playTextReveal, rangeDistance, rangeEnds, rangeProgress, revealClipPath, revealStagger, sceneBudget, sceneColourKeyAt, sceneDisplayValue, sceneFilmDensity, sceneFirstFrame, sceneFrame, sceneFrameDeclarations, sceneHasKeyAt, sceneHeightForScreens, sceneKeyPosition, sceneLayersOf, sceneNodeAttributes, scenePlayed, sceneRevealFromOf, sceneRootOnPath, sceneRootsIn, sceneScreensOf, sceneScrollState, sceneTrackDef, sceneTrackSpan, sceneWordOpacity, sceneWordsLit, scenesIn, scrollPlayFor, splitText, syncSceneAttributes, textPieces, valueAt, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
1173
1397
|
//# sourceMappingURL=vectoriox-iox-ui-scene-core.mjs.map
|