@vectoriox/iox-ui 5.184.0 → 5.185.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/package.json
CHANGED
package/scene-core/index.d.ts
CHANGED
|
@@ -23,6 +23,17 @@ declare const ARRIVE_SCREEN_OPTIONS: IntersectionObserverInit;
|
|
|
23
23
|
* IntersectionObserver (an old browser), so the caller keeps its own stand-in.
|
|
24
24
|
*/
|
|
25
25
|
declare function watchArrival(el: Element, onChange: (arrived: boolean) => void, host?: Window): (() => void) | null;
|
|
26
|
+
/** A box on the screen, top and bottom only (a `DOMRect` is one). */
|
|
27
|
+
interface ArrivalBox {
|
|
28
|
+
top: number;
|
|
29
|
+
bottom: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The same rule read off two boxes, for a runtime that measures instead of observing (the builder canvas checks it as its
|
|
33
|
+
* scaled page scrolls, where an observer can miss an element): `el` has arrived in `root` once a tenth of `el` shows in
|
|
34
|
+
* `root`, or it shows in `root` less root's last tenth. Pure; a box with no height has nothing to show.
|
|
35
|
+
*/
|
|
36
|
+
declare function arrivedWithin(el: ArrivalBox, root: ArrivalBox): boolean;
|
|
26
37
|
|
|
27
38
|
/**
|
|
28
39
|
* A Scene's data and maths (premium-sites plan §5b). A Scene is a recipe of ordinary nodes — a tall Section, a pinned
|
|
@@ -943,5 +954,5 @@ interface TextScrub {
|
|
|
943
954
|
*/
|
|
944
955
|
declare function scrubTextReveal(el: HTMLElement, by: TextRevealBy, look?: TextRevealLook, easing?: string): TextScrub | null;
|
|
945
956
|
|
|
946
|
-
export { ARRIVE_ELEMENT_OPTIONS, ARRIVE_SCREEN_OPTIONS, ARRIVE_SHARE, 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, REVEAL_STAGGER_MAX_MS, SCENE_BUDGET, SCENE_DAMPING, SCENE_FILM_SMOOTH, SCENE_FLOW_RULES, SCENE_LAND_EVENT, SCENE_LAND_TRIGGER, 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, boxInside, buildSceneRecipe, colourAt, crossesStage, crossingOf, dampToward, followToward, gentleFrames, heldProgress, holdLookAt, isHoldTrack, layoutBoxOnScreen, letterCount, letterRefusalOf, lettersSplittable, lightMotionWanted, lineIndexes, movedSceneKey, normalizeParallaxDepth, normalizeParallaxPhone, normalizeScrollRange, normalizeTracks, onSceneLand, outermostNodeOf, pageScroller, parallaxFrames, parallaxOffset, parallaxRest, parallaxShift, playTextReveal, progressShowingFocus, progressShowingStep, 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, stepLanding, syncSceneAttributes, textPieces, textRevealByOf, textRevealLookOf, textRevealStaggerOf, trackColourAt, trackEase, trackProgress, trackRange, trackValueAt, travellingLayerOf, unmovedBox, valueAt, watchArrival, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
947
|
-
export type { RevealSplit, SceneBox, SceneBudget, SceneFilmDensity, SceneFrame, SceneFrameOptions, SceneFrameState, SceneKey, SceneLayerNode, SceneNodeSource, SceneProgress, SceneTrack, SceneTrackDef, SceneTreeNode, SceneWords, ScrollBox, ScrollDriverOptions, ScrollLink, ScrollLinkGeometry, ScrollMotionEnv, SmoothScroller, SplitText, SplitTextOptions, TextPiece, TextScrub };
|
|
957
|
+
export { ARRIVE_ELEMENT_OPTIONS, ARRIVE_SCREEN_OPTIONS, ARRIVE_SHARE, 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, REVEAL_STAGGER_MAX_MS, SCENE_BUDGET, SCENE_DAMPING, SCENE_FILM_SMOOTH, SCENE_FLOW_RULES, SCENE_LAND_EVENT, SCENE_LAND_TRIGGER, 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, arrivedWithin, attachSceneRoots, attachScenes, boxInside, buildSceneRecipe, colourAt, crossesStage, crossingOf, dampToward, followToward, gentleFrames, heldProgress, holdLookAt, isHoldTrack, layoutBoxOnScreen, letterCount, letterRefusalOf, lettersSplittable, lightMotionWanted, lineIndexes, movedSceneKey, normalizeParallaxDepth, normalizeParallaxPhone, normalizeScrollRange, normalizeTracks, onSceneLand, outermostNodeOf, pageScroller, parallaxFrames, parallaxOffset, parallaxRest, parallaxShift, playTextReveal, progressShowingFocus, progressShowingStep, 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, stepLanding, syncSceneAttributes, textPieces, textRevealByOf, textRevealLookOf, textRevealStaggerOf, trackColourAt, trackEase, trackProgress, trackRange, trackValueAt, travellingLayerOf, unmovedBox, valueAt, watchArrival, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
958
|
+
export type { ArrivalBox, RevealSplit, SceneBox, SceneBudget, SceneFilmDensity, SceneFrame, SceneFrameOptions, SceneFrameState, SceneKey, SceneLayerNode, SceneNodeSource, SceneProgress, SceneTrack, SceneTrackDef, SceneTreeNode, SceneWords, ScrollBox, ScrollDriverOptions, ScrollLink, ScrollLinkGeometry, ScrollMotionEnv, SmoothScroller, SplitText, SplitTextOptions, TextPiece, TextScrub };
|
|
@@ -44,3 +44,24 @@ export function watchArrival(el: Element, onChange: (arrived: boolean) => void,
|
|
|
44
44
|
const observers = [watch('element', ARRIVE_ELEMENT_OPTIONS), watch('screen', ARRIVE_SCREEN_OPTIONS)];
|
|
45
45
|
return () => observers.forEach(io => io.disconnect());
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
/** A box on the screen, top and bottom only (a `DOMRect` is one). */
|
|
49
|
+
export interface ArrivalBox {
|
|
50
|
+
top: number;
|
|
51
|
+
bottom: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The same rule read off two boxes, for a runtime that measures instead of observing (the builder canvas checks it as its
|
|
56
|
+
* scaled page scrolls, where an observer can miss an element): `el` has arrived in `root` once a tenth of `el` shows in
|
|
57
|
+
* `root`, or it shows in `root` less root's last tenth. Pure; a box with no height has nothing to show.
|
|
58
|
+
*/
|
|
59
|
+
export function arrivedWithin(el: ArrivalBox, root: ArrivalBox): boolean {
|
|
60
|
+
const height = el.bottom - el.top;
|
|
61
|
+
const rootHeight = root.bottom - root.top;
|
|
62
|
+
if (height <= 0 || rootHeight <= 0) return false;
|
|
63
|
+
const shown = Math.min(el.bottom, root.bottom) - Math.max(el.top, root.top);
|
|
64
|
+
if (shown / height >= ARRIVE_SHARE) return true;
|
|
65
|
+
const screenBottom = root.bottom - rootHeight * ARRIVE_SHARE;
|
|
66
|
+
return Math.min(el.bottom, screenBottom) - Math.max(el.top, root.top) > 0;
|
|
67
|
+
}
|