@vectoriox/iox-ui 5.136.0 → 5.138.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/assist-core/index.d.ts +22 -4
- package/composite-core/index.d.ts +10 -2
- package/design-core/index.d.ts +257 -21
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +12 -2
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +29 -5
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +18 -2
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +431 -61
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +999 -259
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +5 -4
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +197 -28
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +538 -11
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1118 -732
- package/harness-core/index.d.ts +2 -2
- package/index.d.ts +150 -4
- package/package.json +1 -1
- package/scene-core/index.d.ts +69 -13
- package/src/actions-core/element-actions.ts +14 -4
- package/src/assist-core/assist-turn.ts +3 -1
- package/src/assist-core/route-schema.ts +20 -5
- package/src/assist-core/surfaces.ts +12 -0
- package/src/composite-core/header.ts +18 -1
- package/src/design-core/design-settings.ts +14 -3
- package/src/design-core/design-token.model.ts +3 -0
- package/src/design-core/flavor-spec.generated.ts +64 -25
- package/src/design-core/graphemes.ts +16 -0
- package/src/design-core/header-behaviour.ts +20 -2
- package/src/design-core/motion-language.ts +11 -7
- package/src/design-core/node-classes.ts +10 -4
- package/src/design-core/preloader-of.ts +26 -0
- package/src/design-core/preloader.ts +49 -5
- package/src/design-core/public-api.ts +4 -0
- package/src/design-core/scrub.ts +37 -0
- package/src/design-core/section-edge.ts +223 -0
- package/src/design-core/style-presets.ts +2 -0
- package/src/generation-core/body-mix.ts +443 -0
- package/src/generation-core/check-layout.ts +42 -4
- package/src/generation-core/compose-layout.ts +28 -6
- package/src/generation-core/compose-site.ts +26 -8
- package/src/generation-core/header-mix.ts +4 -0
- package/src/generation-core/layout-fingerprint.ts +19 -1
- package/src/generation-core/layout-language.ts +21 -1
- package/src/generation-core/layout-wire.ts +27 -2
- package/src/generation-core/node-baselines.generated.ts +7 -2
- package/src/generation-core/opening-mix.ts +32 -0
- package/src/generation-core/plan-wire.ts +1 -0
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/redesign-run.ts +69 -2
- package/src/generation-core/site-build-run.ts +29 -7
- package/src/generation-core/site-plan.model.ts +2 -0
- package/src/generation-core/site-spec.generated.ts +120 -86
- package/src/generation-core/text-scroll.ts +179 -0
- package/src/generation-core/validate-site-plan.ts +4 -2
- package/src/harness-core/starting-design.ts +6 -5
- package/src/scene-core/scroll-range.ts +4 -0
- package/src/scene-core/split-text.ts +216 -28
- package/styles/iox-design.css +87 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SceneRole, makeCompositePart, NO_ELEMENT_STYLE, writeLayerStyles, writeStyles } from '@vectoriox/iox-ui/composite-core';
|
|
2
2
|
import { FRAMES_PHONE_MAX_WIDTH, VideoAttribute, VideoClass, FILM_SMOOTH_PER_SCREEN, normalizeFrameSequence, FramePlayer } from '@vectoriox/iox-ui/media-core';
|
|
3
|
+
import { graphemes } from '@vectoriox/iox-ui/design-core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* A Scene's data and maths (premium-sites plan §5b). A Scene is a recipe of ordinary nodes — a tall Section, a pinned
|
|
@@ -768,6 +769,8 @@ var ScrollActionKind;
|
|
|
768
769
|
ScrollActionKind["Progress"] = "progress";
|
|
769
770
|
/** Any entrance or exit, played by the scroll instead of the clock. */
|
|
770
771
|
ScrollActionKind["Scrub"] = "scrub";
|
|
772
|
+
/** AW10: a text whose pieces (lines, words, letters) the scroll plays. */
|
|
773
|
+
ScrollActionKind["Text"] = "text";
|
|
771
774
|
})(ScrollActionKind || (ScrollActionKind = {}));
|
|
772
775
|
/** What a visitor gets of one scroll-driven action. */
|
|
773
776
|
var ScrollPlay;
|
|
@@ -786,6 +789,8 @@ const PLAY = {
|
|
|
786
789
|
[ScrollActionKind.Progress]: { reduced: ScrollPlay.Full, light: ScrollPlay.Full },
|
|
787
790
|
// A scrubbed fade keeps its fade under reduced motion; a light device sees the element as it rests.
|
|
788
791
|
[ScrollActionKind.Scrub]: { reduced: ScrollPlay.Gentle, light: ScrollPlay.Rest },
|
|
792
|
+
// AW10 (MOTION.reduced `scrubbedText: 'whole'`, `splitLetters: false`): a text the scroll would play stands whole.
|
|
793
|
+
[ScrollActionKind.Text]: { reduced: ScrollPlay.Rest, light: ScrollPlay.Rest },
|
|
789
794
|
};
|
|
790
795
|
/** THE degrade (motion-v2 §3d/§3e): one table, read by the canvas and both engine paths. */
|
|
791
796
|
function scrollPlayFor(kind, env) {
|
|
@@ -825,27 +830,59 @@ var TextRevealBy;
|
|
|
825
830
|
(function (TextRevealBy) {
|
|
826
831
|
TextRevealBy["Line"] = "line";
|
|
827
832
|
TextRevealBy["Word"] = "word";
|
|
833
|
+
/** AW10: letter by letter. Display words only (`LETTER_PIECE_CAP`), never a script whose letters join. */
|
|
834
|
+
TextRevealBy["Letter"] = "letter";
|
|
828
835
|
})(TextRevealBy || (TextRevealBy = {}));
|
|
836
|
+
/** How a reveal's pieces arrive (AW10): rising out of their masks, or lighting from dim (a Scene's words track's look). */
|
|
837
|
+
var TextRevealLook;
|
|
838
|
+
(function (TextRevealLook) {
|
|
839
|
+
TextRevealLook["Rise"] = "rise";
|
|
840
|
+
TextRevealLook["Light"] = "light";
|
|
841
|
+
})(TextRevealLook || (TextRevealLook = {}));
|
|
829
842
|
/** Past these a text is plainly no heading: it fades whole, and lights up whole. */
|
|
830
843
|
const REVEAL_PIECE_CAP = 120;
|
|
831
844
|
const LIGHT_UP_PIECE_CAP = 300;
|
|
845
|
+
/** AW10: past this many letters a text is no display line — it splits by word instead (the waiting word's stand-in). */
|
|
846
|
+
const LETTER_PIECE_CAP = 80;
|
|
847
|
+
const REVEAL_BYS = new Set(Object.values(TextRevealBy));
|
|
848
|
+
/** A saved `params.by`: a reveal's pieces, line by default (what `mask-rise` has always been). */
|
|
849
|
+
function textRevealByOf(value) {
|
|
850
|
+
return typeof value === 'string' && REVEAL_BYS.has(value) ? value : TextRevealBy.Line;
|
|
851
|
+
}
|
|
852
|
+
/** A saved `params.look`: rising by default. */
|
|
853
|
+
function textRevealLookOf(value) {
|
|
854
|
+
return value === TextRevealLook.Light ? TextRevealLook.Light : TextRevealLook.Rise;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Scripts whose letters change shape with their neighbours (Arabic joins, an Indic consonant takes its vowel): pulled
|
|
858
|
+
* apart, every letter would show its isolated form, so they never split by letter — they split by word.
|
|
859
|
+
*/
|
|
860
|
+
const JOINED_SCRIPTS = /[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Mongolian}\p{Script=Devanagari}\p{Script=Bengali}\p{Script=Gurmukhi}\p{Script=Gujarati}\p{Script=Oriya}\p{Script=Tamil}\p{Script=Telugu}\p{Script=Kannada}\p{Script=Malayalam}\p{Script=Sinhala}\p{Script=Thai}\p{Script=Lao}\p{Script=Tibetan}\p{Script=Myanmar}\p{Script=Khmer}]/u;
|
|
861
|
+
/** True when `text` may come apart letter by letter without a letter changing its shape (Hebrew, Latin, Cyrillic…). */
|
|
862
|
+
function lettersSplittable(text) {
|
|
863
|
+
return !JOINED_SCRIPTS.test(text);
|
|
864
|
+
}
|
|
832
865
|
const SKIPPED_TAGS = new Set(['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'SELECT', 'OPTION']);
|
|
833
866
|
const SHOW_TEXT = 4;
|
|
834
867
|
/** Hebrew through Arabic Extended, and their presentation forms. */
|
|
835
868
|
const RTL_LETTER = /[-ࣿיִ-﷿ﹰ-]/;
|
|
836
869
|
/**
|
|
837
|
-
* A string as words and the space between them. With `keepLtrRuns` a run of words holding no
|
|
838
|
-
*
|
|
870
|
+
* A string as words and the space between them. With `keepLtrRuns` (a right-to-left element) a run of words holding no
|
|
871
|
+
* RTL letter stays ONE word; with `keepRtlRuns` (a left-to-right element) a run of words holding an RTL letter does: an
|
|
872
|
+
* inline-block is neutral to the bidi algorithm, so "Studio Alma" inside a Hebrew heading, split, would read reversed —
|
|
873
|
+
* and so would a Hebrew name inside an English one.
|
|
839
874
|
*/
|
|
840
|
-
function textPieces(text, keepLtrRuns = false) {
|
|
875
|
+
function textPieces(text, keepLtrRuns = false, keepRtlRuns = false) {
|
|
841
876
|
const pieces = (text.match(/\s+|\S+/g) ?? []).map(part => ({ text: part, word: /\S/.test(part) }));
|
|
842
|
-
if (!keepLtrRuns)
|
|
877
|
+
if (!keepLtrRuns && !keepRtlRuns)
|
|
843
878
|
return pieces;
|
|
879
|
+
const against = (word) => (RTL_LETTER.test(word) ? keepRtlRuns : keepLtrRuns);
|
|
844
880
|
const merged = [];
|
|
845
881
|
for (const piece of pieces) {
|
|
846
882
|
const space = merged[merged.length - 1];
|
|
847
883
|
const word = merged[merged.length - 2];
|
|
848
|
-
if (piece.word &&
|
|
884
|
+
if (piece.word && against(piece.text) && space && !space.word && word?.word && against(word.text)
|
|
885
|
+
&& RTL_LETTER.test(word.text) === RTL_LETTER.test(piece.text)) {
|
|
849
886
|
word.text += space.text + piece.text;
|
|
850
887
|
merged.pop();
|
|
851
888
|
}
|
|
@@ -855,6 +892,11 @@ function textPieces(text, keepLtrRuns = false) {
|
|
|
855
892
|
}
|
|
856
893
|
return merged;
|
|
857
894
|
}
|
|
895
|
+
/** The direction a word reads in: its first letter's. */
|
|
896
|
+
function wordDirection(text) {
|
|
897
|
+
const first = text.match(/\p{L}/u)?.[0] ?? '';
|
|
898
|
+
return RTL_LETTER.test(first) ? 'rtl' : 'ltr';
|
|
899
|
+
}
|
|
858
900
|
function textNodesOf(root) {
|
|
859
901
|
const walker = root.ownerDocument.createTreeWalker(root, SHOW_TEXT);
|
|
860
902
|
const found = [];
|
|
@@ -865,6 +907,8 @@ function textNodesOf(root) {
|
|
|
865
907
|
}
|
|
866
908
|
return found;
|
|
867
909
|
}
|
|
910
|
+
/** A clip-path and not overflow, which would move the box's baseline. The negative sides leave descenders and italics. */
|
|
911
|
+
const MASK_CLIP = 'inset(-0.1em -0.1em -0.18em -0.1em)';
|
|
868
912
|
function pieceOf(doc, text, mask) {
|
|
869
913
|
const moving = doc.createElement('span');
|
|
870
914
|
moving.textContent = text;
|
|
@@ -873,8 +917,7 @@ function pieceOf(doc, text, mask) {
|
|
|
873
917
|
moving.style.display = 'inline-block';
|
|
874
918
|
const outer = doc.createElement('span');
|
|
875
919
|
outer.style.display = 'inline-block';
|
|
876
|
-
|
|
877
|
-
outer.style.clipPath = 'inset(-0.1em -0.1em -0.18em -0.1em)';
|
|
920
|
+
outer.style.clipPath = MASK_CLIP;
|
|
878
921
|
outer.appendChild(moving);
|
|
879
922
|
return { outer, moving };
|
|
880
923
|
}
|
|
@@ -882,18 +925,29 @@ function pieceOf(doc, text, mask) {
|
|
|
882
925
|
function splitText(root, options) {
|
|
883
926
|
const doc = root.ownerDocument;
|
|
884
927
|
const mask = !!options.mask;
|
|
885
|
-
const
|
|
886
|
-
const
|
|
928
|
+
const letters = !!options.letters;
|
|
929
|
+
const texts = textNodesOf(root);
|
|
930
|
+
if (letters && texts.some(text => !lettersSplittable(text.nodeValue ?? '')))
|
|
931
|
+
return null;
|
|
932
|
+
// Words of letters in a mask are inline-blocks too: a run against the element's direction stays one.
|
|
933
|
+
const keepRuns = mask;
|
|
934
|
+
const planned = texts.map(original => ({
|
|
935
|
+
original, parts: textPieces(original.nodeValue ?? '', keepRuns && !!options.rtl, keepRuns && !options.rtl),
|
|
936
|
+
}));
|
|
937
|
+
const pieceCount = (part) => (!part.word ? 0 : letters ? graphemes(part.text.replace(/\s+/g, '')).length : 1);
|
|
938
|
+
const count = planned.reduce((sum, { parts }) => sum + parts.reduce((n, part) => n + pieceCount(part), 0), 0);
|
|
887
939
|
if (!count || count > options.cap)
|
|
888
940
|
return null;
|
|
889
941
|
const pieces = [];
|
|
890
942
|
const replacements = planned.map(({ original, parts }) => {
|
|
891
|
-
const nodes = parts.
|
|
943
|
+
const nodes = parts.flatMap((part) => {
|
|
892
944
|
if (!part.word)
|
|
893
|
-
return doc.createTextNode(part.text);
|
|
945
|
+
return [doc.createTextNode(part.text)];
|
|
946
|
+
if (letters)
|
|
947
|
+
return lettersOf(doc, part.text, mask, pieces);
|
|
894
948
|
const { outer, moving } = pieceOf(doc, part.text, mask);
|
|
895
949
|
pieces.push(moving);
|
|
896
|
-
return outer;
|
|
950
|
+
return [outer];
|
|
897
951
|
});
|
|
898
952
|
const parent = original.parentNode;
|
|
899
953
|
for (const node of nodes)
|
|
@@ -915,6 +969,34 @@ function splitText(root, options) {
|
|
|
915
969
|
},
|
|
916
970
|
};
|
|
917
971
|
}
|
|
972
|
+
/**
|
|
973
|
+
* A word as letters (AW10). Unmasked, each letter is a plain inline span: the line breaks, the bidi order and the
|
|
974
|
+
* shaping are the text's own. Masked, the WORD is the mask — an inline-block that never breaks inside, reading in its
|
|
975
|
+
* own direction (an inline-block's letters would otherwise take the element's) — and each letter an inline-block that
|
|
976
|
+
* rises inside it.
|
|
977
|
+
*/
|
|
978
|
+
function lettersOf(doc, word, mask, pieces) {
|
|
979
|
+
const letterOf = (letter) => {
|
|
980
|
+
const span = doc.createElement('span');
|
|
981
|
+
span.textContent = letter;
|
|
982
|
+
if (mask)
|
|
983
|
+
span.style.display = 'inline-block';
|
|
984
|
+
pieces.push(span);
|
|
985
|
+
return span;
|
|
986
|
+
};
|
|
987
|
+
// A run of words held together (`textPieces`) keeps its spaces as bare text.
|
|
988
|
+
const parts = (word.match(/\s+|\S+/g) ?? []).flatMap((part) => (/\S/.test(part) ? graphemes(part).map(letterOf) : [doc.createTextNode(part)]));
|
|
989
|
+
if (!mask)
|
|
990
|
+
return parts;
|
|
991
|
+
const outer = doc.createElement('span');
|
|
992
|
+
outer.style.display = 'inline-block';
|
|
993
|
+
outer.style.whiteSpace = 'nowrap';
|
|
994
|
+
outer.style.clipPath = MASK_CLIP;
|
|
995
|
+
outer.dir = wordDirection(word);
|
|
996
|
+
for (const part of parts)
|
|
997
|
+
outer.appendChild(part);
|
|
998
|
+
return [outer];
|
|
999
|
+
}
|
|
918
1000
|
/** The line each piece stands on: 0, 0, 1, 1, 1, 2… Read once, as a reveal starts. */
|
|
919
1001
|
function lineIndexes(tops, heights) {
|
|
920
1002
|
let line = 0;
|
|
@@ -929,37 +1011,64 @@ function lineIndexes(tops, heights) {
|
|
|
929
1011
|
}
|
|
930
1012
|
const LINE_STAGGER_MS = 90;
|
|
931
1013
|
const WORD_STAGGER_MS = 40;
|
|
1014
|
+
/** AW10: letters follow one another closely — a word assembles, it is not spelled out. */
|
|
1015
|
+
const LETTER_STAGGER_MS = 24;
|
|
932
1016
|
/** However long the heading, the last piece starts within this. */
|
|
933
1017
|
const STAGGER_BUDGET_MS = 1000;
|
|
1018
|
+
const STAGGER_MS = {
|
|
1019
|
+
[TextRevealBy.Line]: LINE_STAGGER_MS,
|
|
1020
|
+
[TextRevealBy.Word]: WORD_STAGGER_MS,
|
|
1021
|
+
[TextRevealBy.Letter]: LETTER_STAGGER_MS,
|
|
1022
|
+
};
|
|
934
1023
|
function revealStagger(groups, by) {
|
|
935
|
-
|
|
936
|
-
return groups > 1 ? Math.min(step, STAGGER_BUDGET_MS / (groups - 1)) : 0;
|
|
1024
|
+
return groups > 1 ? Math.min(STAGGER_MS[by], STAGGER_BUDGET_MS / (groups - 1)) : 0;
|
|
937
1025
|
}
|
|
938
1026
|
/** Past the mask's negative inset, so nothing shows before a piece's turn. */
|
|
939
1027
|
const PIECE_FRAMES = [{ transform: 'translateY(120%)' }, { transform: 'translateY(0)' }];
|
|
1028
|
+
/** A lit piece goes from the Scene words track's dim to whole: it never moves. */
|
|
1029
|
+
const LIGHT_FRAMES = [{ opacity: SCENE_WORD_DIM }, { opacity: 1 }];
|
|
940
1030
|
const DEFAULT_PIECE_MS = 700;
|
|
941
|
-
const playing = new WeakMap();
|
|
942
1031
|
/**
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
* is put back whole, which leaves nothing for a screen reader to stumble on and nothing to re-split on a resize. Null
|
|
946
|
-
* when there is nothing to split or it is being edited: the caller plays its plain fade.
|
|
1032
|
+
* Split `el` for a reveal by `by` in `look`, or null when there is nothing to split or it is being edited (the caller
|
|
1033
|
+
* plays its plain fade). Letters a text cannot give (too many, a joined script) are words instead.
|
|
947
1034
|
*/
|
|
948
|
-
function
|
|
949
|
-
playing.get(el)?.cancel();
|
|
1035
|
+
function splitForReveal(el, by, look = TextRevealLook.Rise) {
|
|
950
1036
|
if (el.isContentEditable)
|
|
951
1037
|
return null;
|
|
952
1038
|
const rtl = el.ownerDocument.defaultView?.getComputedStyle(el).direction === 'rtl';
|
|
953
|
-
const
|
|
1039
|
+
const mask = look === TextRevealLook.Rise;
|
|
1040
|
+
let used = by;
|
|
1041
|
+
let split = by === TextRevealBy.Letter ? splitText(el, { cap: LETTER_PIECE_CAP, mask, rtl, letters: true }) : null;
|
|
1042
|
+
if (!split) {
|
|
1043
|
+
if (used === TextRevealBy.Letter)
|
|
1044
|
+
used = TextRevealBy.Word;
|
|
1045
|
+
split = splitText(el, { cap: REVEAL_PIECE_CAP, mask, rtl });
|
|
1046
|
+
}
|
|
954
1047
|
if (!split)
|
|
955
1048
|
return null;
|
|
956
|
-
const boxes =
|
|
957
|
-
const order =
|
|
958
|
-
|
|
959
|
-
|
|
1049
|
+
const boxes = used === TextRevealBy.Line ? split.pieces.map(piece => (mask ? piece.parentElement : piece).getBoundingClientRect()) : [];
|
|
1050
|
+
const order = used === TextRevealBy.Line ? lineIndexes(boxes.map(box => box.top), boxes.map(box => box.height)) : split.pieces.map((_, i) => i);
|
|
1051
|
+
return { split, by: used, order, groups: Math.max(...order) + 1 };
|
|
1052
|
+
}
|
|
1053
|
+
const playing = new WeakMap();
|
|
1054
|
+
/**
|
|
1055
|
+
* Play a text reveal: each piece rises out of its mask (or lights from dim), line by line, word by word or letter by
|
|
1056
|
+
* letter. Returns ONE animation for the whole, so a runtime treats it as any other: it finishes when the last piece
|
|
1057
|
+
* lands, and on finish or cancel the text is put back whole, which leaves nothing for a screen reader to stumble on and
|
|
1058
|
+
* nothing to re-split on a resize. Null when there is nothing to split or it is being edited: the caller plays its plain
|
|
1059
|
+
* fade.
|
|
1060
|
+
*/
|
|
1061
|
+
function playTextReveal(el, by, timing, look = TextRevealLook.Rise) {
|
|
1062
|
+
playing.get(el)?.cancel();
|
|
1063
|
+
const planned = splitForReveal(el, by, look);
|
|
1064
|
+
if (!planned)
|
|
1065
|
+
return null;
|
|
1066
|
+
const { split, order, groups } = planned;
|
|
1067
|
+
const step = revealStagger(groups, planned.by);
|
|
960
1068
|
const duration = Number(timing.duration) || DEFAULT_PIECE_MS;
|
|
961
1069
|
const delay = timing.delay ?? 0;
|
|
962
|
-
const
|
|
1070
|
+
const frames = look === TextRevealLook.Light ? LIGHT_FRAMES : PIECE_FRAMES;
|
|
1071
|
+
const pieces = split.pieces.map((piece, i) => piece.animate(frames, { duration, delay: delay + order[i] * step, easing: timing.easing, fill: 'both' }));
|
|
963
1072
|
// The element itself just stands visible: its entrance's first frame had hidden it whole.
|
|
964
1073
|
const whole = el.animate([{ opacity: 1 }, { opacity: 1 }], { duration: delay + duration + step * (groups - 1), fill: timing.fill ?? 'both' });
|
|
965
1074
|
playing.set(el, whole);
|
|
@@ -974,6 +1083,66 @@ function playTextReveal(el, by, timing) {
|
|
|
974
1083
|
whole.addEventListener('cancel', finished, { once: true });
|
|
975
1084
|
return whole;
|
|
976
1085
|
}
|
|
1086
|
+
/** AW10: how many pieces are on their way at once while the scroll plays a text — a wave, not one piece at a time. */
|
|
1087
|
+
const SCRUB_PIECES_IN_FLIGHT = 3;
|
|
1088
|
+
/**
|
|
1089
|
+
* Where piece group `group` of `groups` stands when the scroll has played `progress` (0–1) of its text: each group plays
|
|
1090
|
+
* over its own window, `inFlight` groups overlapping, the first starting at 0 and the last ending at 1. Pure.
|
|
1091
|
+
*/
|
|
1092
|
+
function scrubPieceProgress(progress, group, groups, inFlight = SCRUB_PIECES_IN_FLIGHT) {
|
|
1093
|
+
const n = Math.max(1, groups);
|
|
1094
|
+
const k = Math.max(1, Math.min(inFlight, n));
|
|
1095
|
+
const slots = n + k - 1;
|
|
1096
|
+
const start = group / slots;
|
|
1097
|
+
const local = (progress - start) / (k / slots);
|
|
1098
|
+
return Math.min(1, Math.max(0, local));
|
|
1099
|
+
}
|
|
1100
|
+
/** A paused timeline this long is moved to the progress. */
|
|
1101
|
+
const SCRUB_TIMELINE_MS = 1000;
|
|
1102
|
+
/**
|
|
1103
|
+
* Split `el` once and let the scroll play its pieces (AW10, mode `scrubbed`): `seek` moves every piece to where the
|
|
1104
|
+
* progress puts it — rising out of its mask or lighting from dim, `SCRUB_PIECES_IN_FLIGHT` at a time — and `release`
|
|
1105
|
+
* puts the text back whole. Null when there is nothing to split or it is being edited: the caller scrubs its plain fade.
|
|
1106
|
+
* Transform and opacity only; nothing changes a box.
|
|
1107
|
+
*/
|
|
1108
|
+
function scrubTextReveal(el, by, look = TextRevealLook.Rise, easing = 'linear') {
|
|
1109
|
+
playing.get(el)?.cancel();
|
|
1110
|
+
const planned = splitForReveal(el, by, look);
|
|
1111
|
+
if (!planned)
|
|
1112
|
+
return null;
|
|
1113
|
+
const { split, order, groups } = planned;
|
|
1114
|
+
const frames = look === TextRevealLook.Light ? LIGHT_FRAMES : PIECE_FRAMES;
|
|
1115
|
+
const anims = split.pieces.map(piece => {
|
|
1116
|
+
const anim = piece.animate(frames, { duration: SCRUB_TIMELINE_MS, fill: 'both', easing });
|
|
1117
|
+
anim.pause();
|
|
1118
|
+
anim.currentTime = 0;
|
|
1119
|
+
return anim;
|
|
1120
|
+
});
|
|
1121
|
+
const at = anims.map(() => 0);
|
|
1122
|
+
let released = false;
|
|
1123
|
+
return {
|
|
1124
|
+
by: planned.by,
|
|
1125
|
+
seek: (progress) => {
|
|
1126
|
+
if (released)
|
|
1127
|
+
return;
|
|
1128
|
+
anims.forEach((anim, i) => {
|
|
1129
|
+
const time = scrubPieceProgress(progress, order[i], groups) * SCRUB_TIMELINE_MS;
|
|
1130
|
+
if (time === at[i])
|
|
1131
|
+
return;
|
|
1132
|
+
anim.currentTime = time;
|
|
1133
|
+
at[i] = time;
|
|
1134
|
+
});
|
|
1135
|
+
},
|
|
1136
|
+
release: () => {
|
|
1137
|
+
if (released)
|
|
1138
|
+
return;
|
|
1139
|
+
released = true;
|
|
1140
|
+
for (const anim of anims)
|
|
1141
|
+
anim.cancel();
|
|
1142
|
+
split.restore();
|
|
1143
|
+
},
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
977
1146
|
|
|
978
1147
|
/**
|
|
979
1148
|
* The ONE scroll loop (premium-sites plan §5b, SC0). Every Scene on a page reads one progress value from it, on the
|
|
@@ -1433,5 +1602,5 @@ function attachSceneRoots(roots, options = {}) {
|
|
|
1433
1602
|
* Generated bundle index. Do not edit.
|
|
1434
1603
|
*/
|
|
1435
1604
|
|
|
1436
|
-
export { LIGHT_UP_PIECE_CAP, 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_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, 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, sceneScrollState, sceneTrackDef, sceneTrackSpan, sceneWordOpacity, sceneWordsLit, scenesIn, scrollPlayFor, splitText, syncSceneAttributes, textPieces, valueAt, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
1605
|
+
export { LETTER_PIECE_CAP, LIGHT_UP_PIECE_CAP, 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_WAKE_EVENT, SCENE_WORDS, SCENE_WORD_DIM, SCROLL_RANGE_DEFAULT, SCRUB_PIECES_IN_FLIGHT, SLIDER_HOLD_SHARE, SLIDER_SCROLL_STEP_SCREENS, SceneAttribute, SceneProp, SceneRevealFrom, ScrollActionKind, ScrollDriver, ScrollPlay, ScrollRange, TextRevealBy, TextRevealLook, applySceneFirstFrame, attachSceneRoots, attachScenes, buildSceneRecipe, colourAt, dampToward, gentleFrames, heldProgress, layoutBoxOnScreen, 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, sceneScrollState, sceneTrackDef, sceneTrackSpan, sceneWordOpacity, sceneWordsLit, scenesIn, scrollPlayFor, scrubPieceProgress, scrubTextReveal, splitForReveal, splitText, syncSceneAttributes, textPieces, textRevealByOf, textRevealLookOf, valueAt, withSceneKey, withScenePlayback, withSceneRevealFrom, withoutSceneKey, withoutScenePlayback };
|
|
1437
1606
|
//# sourceMappingURL=vectoriox-iox-ui-scene-core.mjs.map
|