@vectoriox/iox-ui 5.182.0 → 5.183.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.
@@ -4346,8 +4346,16 @@ interface StartingDesign {
4346
4346
  /** The reference colour was used as the seed (it passed AA in every mode the style offers). */
4347
4347
  referenceColour: boolean;
4348
4348
  }
4349
- /** The look a business starts from: its best-ranked style (with the references' boost), at its defaults. */
4350
- declare function startingDesign(input: (RankInput & MotionInput) | string | null, read?: StyleRead | null): StartingDesign | null;
4349
+ /**
4350
+ * The look a business starts from: its best-ranked style (with the references' boost), at its defaults.
4351
+ *
4352
+ * iox-ui#154 (the J10 re-score, award-ingredients-plan §7.18 SJ-D10): two sites of one studio with the same kind of
4353
+ * business STARTED from the same look (same preset, same seed). `worn` names the styles the studio's other sites already
4354
+ * wear (the fingerprints' `preset`); the start skips them and takes the next-ranked style that still fits (never a Poor
4355
+ * fit — one the kind of business or the owner advises against). A style the references' colour re-seeds is a look of its own and is
4356
+ * not skipped. When every fitting style is worn, the best-ranked one — the owner may always pick any look.
4357
+ */
4358
+ declare function startingDesign(input: (RankInput & MotionInput) | string | null, read?: StyleRead | null, worn?: ReadonlyArray<string>): StartingDesign | null;
4351
4359
 
4352
4360
  /**
4353
4361
  * The opening film, SUGGESTED (award-ingredients-plan §0b + §0b.7, AW-D26…AW-D32 — "the same moment, not the same
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.182.0",
3
+ "version": "5.183.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -1,5 +1,29 @@
1
1
  import { CompositeNode, CompositeNodeFactory } from '@vectoriox/iox-ui/composite-core';
2
2
 
3
+ /**
4
+ * When an element ARRIVES on the screen — the moment a viewport entrance (`viewportEnter`) plays and a word with no landing
5
+ * to wait for comes in (`onSceneLand`). ONE rule for every interaction runtime: the builder canvas, the engine and
6
+ * scene-core itself. Framework-free; it asks the host's IntersectionObserver.
7
+ *
8
+ * An element arrives once a tenth of IT shows — or a tenth of the SCREEN shows it, whichever comes first. The second
9
+ * half is what a tall element needs: a list of six cards stacked one under another on a phone is three screens tall, so a
10
+ * tenth of it is more than the space a page header leaves below itself, and an entrance waiting for that tenth never
11
+ * plays on the first screen — the visitor sees an empty band where the cards are (vectoriox/iox-ui#156). An element
12
+ * shorter than the screen arrives exactly as before (a tenth of it shows before a tenth of the screen does).
13
+ */
14
+ /** The share of an element — or of the screen — that must show before the element arrives. */
15
+ declare const ARRIVE_SHARE = 0.1;
16
+ /** The observer that asks "does a tenth of the element show". */
17
+ declare const ARRIVE_ELEMENT_OPTIONS: IntersectionObserverInit;
18
+ /** The observer that asks "does the element show in the screen less its last tenth" — its top a tenth of the screen up. */
19
+ declare const ARRIVE_SCREEN_OPTIONS: IntersectionObserverInit;
20
+ /**
21
+ * Watch `el` arrive and leave: `onChange(true)` as it arrives (either half of the rule), `onChange(false)` as it leaves
22
+ * (neither half holds), each only when the answer changes. Returns the way to let go — or null when the host has no
23
+ * IntersectionObserver (an old browser), so the caller keeps its own stand-in.
24
+ */
25
+ declare function watchArrival(el: Element, onChange: (arrived: boolean) => void, host?: Window): (() => void) | null;
26
+
3
27
  /**
4
28
  * A Scene's data and maths (premium-sites plan §5b). A Scene is a recipe of ordinary nodes — a tall Section, a pinned
5
29
  * stage inside it, ordinary nodes as layers — so every word stays real, bound and translatable, and all three render
@@ -919,5 +943,5 @@ interface TextScrub {
919
943
  */
920
944
  declare function scrubTextReveal(el: HTMLElement, by: TextRevealBy, look?: TextRevealLook, easing?: string): TextScrub | null;
921
945
 
922
- 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, 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, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
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 };
923
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 };
@@ -1,7 +1,7 @@
1
1
  import { DesignChoices, presetChoices, PRELOADER_LEVELS, SCRUB_LEVELS } from '@vectoriox/iox-ui/design-core';
2
2
 
3
3
  import { motionFor, MotionInput } from './motion';
4
- import { RankInput, rankWithReferences, StyleRead } from './rank';
4
+ import { PresetFit, RankedPreset, RankInput, rankWithReferences, StyleRead } from './rank';
5
5
  import { referenceSeed } from './reference-colour';
6
6
 
7
7
  /**
@@ -43,11 +43,31 @@ export interface StartingDesign {
43
43
  referenceColour: boolean;
44
44
  }
45
45
 
46
- /** The look a business starts from: its best-ranked style (with the references' boost), at its defaults. */
47
- export function startingDesign(input: (RankInput & MotionInput) | string | null, read: StyleRead | null = null): StartingDesign | null {
46
+ /**
47
+ * The look a business starts from: its best-ranked style (with the references' boost), at its defaults.
48
+ *
49
+ * iox-ui#154 (the J10 re-score, award-ingredients-plan §7.18 SJ-D10): two sites of one studio with the same kind of
50
+ * business STARTED from the same look (same preset, same seed). `worn` names the styles the studio's other sites already
51
+ * wear (the fingerprints' `preset`); the start skips them and takes the next-ranked style that still fits (never a Poor
52
+ * fit — one the kind of business or the owner advises against). A style the references' colour re-seeds is a look of its own and is
53
+ * not skipped. When every fitting style is worn, the best-ranked one — the owner may always pick any look.
54
+ */
55
+ export function startingDesign(
56
+ input: (RankInput & MotionInput) | string | null,
57
+ read: StyleRead | null = null,
58
+ worn: ReadonlyArray<string> = [],
59
+ ): StartingDesign | null {
48
60
  const rankInput: RankInput & MotionInput = typeof input === 'object' && input !== null ? input : { businessType: input as string | null };
49
- const top = rankWithReferences(rankInput, read)[0];
61
+ const ranked = rankWithReferences(rankInput, read);
62
+ const top = unwornStart(ranked, worn, read) ?? ranked[0];
50
63
  const design = top ? presetDesign(top.id, rankInput, {}, read) : null;
51
64
  if (!top || !design) return null;
52
65
  return { presetId: top.id, design, referenceColour: !!referenceSeed(read, top.id)?.used };
53
66
  }
67
+
68
+ /** The best-ranked style that fits and that no other site of the studio wears (a re-seeded one is its own look). */
69
+ function unwornStart(ranked: ReadonlyArray<RankedPreset>, worn: ReadonlyArray<string>, read: StyleRead | null): RankedPreset | undefined {
70
+ if (!worn.length) return ranked[0];
71
+ const taken = new Set(worn);
72
+ return ranked.find(r => r.fit !== PresetFit.Poor && (!taken.has(r.id) || !!referenceSeed(read, r.id)?.used));
73
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * When an element ARRIVES on the screen — the moment a viewport entrance (`viewportEnter`) plays and a word with no landing
3
+ * to wait for comes in (`onSceneLand`). ONE rule for every interaction runtime: the builder canvas, the engine and
4
+ * scene-core itself. Framework-free; it asks the host's IntersectionObserver.
5
+ *
6
+ * An element arrives once a tenth of IT shows — or a tenth of the SCREEN shows it, whichever comes first. The second
7
+ * half is what a tall element needs: a list of six cards stacked one under another on a phone is three screens tall, so a
8
+ * tenth of it is more than the space a page header leaves below itself, and an entrance waiting for that tenth never
9
+ * plays on the first screen — the visitor sees an empty band where the cards are (vectoriox/iox-ui#156). An element
10
+ * shorter than the screen arrives exactly as before (a tenth of it shows before a tenth of the screen does).
11
+ */
12
+
13
+ /** The share of an element — or of the screen — that must show before the element arrives. */
14
+ export const ARRIVE_SHARE = 0.1;
15
+
16
+ /** The observer that asks "does a tenth of the element show". */
17
+ export const ARRIVE_ELEMENT_OPTIONS: IntersectionObserverInit = { threshold: ARRIVE_SHARE };
18
+ /** The observer that asks "does the element show in the screen less its last tenth" — its top a tenth of the screen up. */
19
+ export const ARRIVE_SCREEN_OPTIONS: IntersectionObserverInit = { threshold: 0, rootMargin: `0px 0px -${ARRIVE_SHARE * 100}% 0px` };
20
+
21
+ /**
22
+ * Watch `el` arrive and leave: `onChange(true)` as it arrives (either half of the rule), `onChange(false)` as it leaves
23
+ * (neither half holds), each only when the answer changes. Returns the way to let go — or null when the host has no
24
+ * IntersectionObserver (an old browser), so the caller keeps its own stand-in.
25
+ */
26
+ export function watchArrival(el: Element, onChange: (arrived: boolean) => void, host: Window = window): (() => void) | null {
27
+ const Observer = (host as Window & { IntersectionObserver?: typeof IntersectionObserver }).IntersectionObserver;
28
+ if (!Observer) return null;
29
+ const seen = { element: false, screen: false };
30
+ let arrived = false;
31
+ const watch = (half: keyof typeof seen, options: IntersectionObserverInit): IntersectionObserver => {
32
+ const io = new Observer(entries => {
33
+ const entry = entries.filter(e => e.target === el).pop();
34
+ if (!entry) return;
35
+ seen[half] = entry.isIntersecting;
36
+ const now = seen.element || seen.screen;
37
+ if (now === arrived) return;
38
+ arrived = now;
39
+ onChange(now);
40
+ }, options);
41
+ io.observe(el);
42
+ return io;
43
+ };
44
+ const observers = [watch('element', ARRIVE_ELEMENT_OPTIONS), watch('screen', ARRIVE_SCREEN_OPTIONS)];
45
+ return () => observers.forEach(io => io.disconnect());
46
+ }
@@ -4,6 +4,7 @@
4
4
  * composer read the same tracks, frames and recipe; the driver is DOM-only and is the ONE scroll loop.
5
5
  * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, tsconfig paths.
6
6
  */
7
+ export * from './arrival';
7
8
  export * from './scene';
8
9
  export * from './scene-edit';
9
10
  export * from './scene-recipe';
@@ -1,6 +1,7 @@
1
1
  import { SceneRole } from '@vectoriox/iox-ui/composite-core';
2
2
  import { FramePlayer, normalizeFrameSequence, VideoAttribute } from '@vectoriox/iox-ui/media-core';
3
3
 
4
+ import { watchArrival } from './arrival';
4
5
  import { crossesStage, heldProgress, isHoldTrack, trackValueAt, normalizeTracks, SCENE_PHONE_MAX_WIDTH, SceneAttribute, sceneFrame, SceneFrame, scenePlayed, SceneProgress, SceneProp, sceneWordOpacity, sceneWordsLit, SceneTrack } from './scene';
5
6
  import { rangeDistance, rangeProgress, ScrollBox, ScrollRange } from './scroll-range';
6
7
  import { LIGHT_UP_PIECE_CAP, SplitText, splitText } from './split-text';
@@ -133,8 +134,6 @@ export const SCENE_LAND_TRIGGER = 'sceneLand';
133
134
  export const SCENE_LAND_EVENT = 'iox-scene-land';
134
135
  /** Progress short of a landing that still counts as landed: the damping settles onto the scroll, never past it. */
135
136
  const LANDED_SLACK = 1e-4;
136
- /** How much of an element must show before a word with no landing to wait for arrives (the runtimes' viewport entry). */
137
- const ARRIVE_THRESHOLD = 0.1;
138
137
 
139
138
  /**
140
139
  * Where a Scene of steps (each covering the one before once it lands) must stand for step `index` to be in FRONT, or null
@@ -998,14 +997,10 @@ export function onSceneLand(el: HTMLElement, run: () => void, host: Window = win
998
997
  layer.addEventListener(SCENE_LAND_EVENT, heard);
999
998
  offs.push(() => layer.removeEventListener(SCENE_LAND_EVENT, heard));
1000
999
  }
1001
- const Observer = (host as Window & { IntersectionObserver?: typeof IntersectionObserver }).IntersectionObserver;
1002
- if (Observer) {
1003
- const io = new Observer(entries => {
1004
- // Where a driver plays the travel it decides; the viewport only stands in where none does.
1005
- if (entries.some(entry => entry.isIntersecting) && !(layer && landingDriverOf(layer))) go();
1006
- }, { threshold: ARRIVE_THRESHOLD });
1007
- io.observe(el);
1008
- offs.push(() => io.disconnect());
1000
+ // Where a driver plays the travel it decides; the viewport only stands in where none does (`watchArrival`'s rule).
1001
+ const unwatch = watchArrival(el, arrived => { if (arrived && !(layer && landingDriverOf(layer))) go(); }, host);
1002
+ if (unwatch) {
1003
+ offs.push(unwatch);
1009
1004
  } else {
1010
1005
  // No observer to ask (an old browser): it stands in place on the next frame unless a driver will land it.
1011
1006
  const frame = host.requestAnimationFrame?.(() => { if (!(layer && landingDriverOf(layer))) go(); });