@yomotech/view-toolkit 1.0.50 → 1.0.52
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/fesm2022/yomotech-view-toolkit-catalog.mjs +922 -8
- package/fesm2022/yomotech-view-toolkit-catalog.mjs.map +1 -1
- package/fesm2022/yomotech-view-toolkit.mjs +325 -204
- package/fesm2022/yomotech-view-toolkit.mjs.map +1 -1
- package/package.json +1 -1
- package/types/yomotech-view-toolkit-catalog.d.ts +344 -7
- package/types/yomotech-view-toolkit.d.ts +88 -5
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
2
|
+
// - new: maxLinesOf (option.maxLines - a shown text ends with … after n lines), alignRowsOf (card list: the cards of a
|
|
3
|
+
// row equally high, buttons at the bottom; center.option.alignRows, on for new card lists)
|
|
4
|
+
// - new: ENTER_KEYS, enterKeyFor - the key at the bottom right of the app keyboard (option.enterKey: done, search, next)
|
|
1
5
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-29
|
|
2
6
|
// - new: CARD_LAYOUTS / cardLayoutOf - the card field in one, two or three rows (option.cardLayout, OFFENE-PUNKTE 103)
|
|
3
7
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-24
|
|
@@ -292,6 +296,17 @@ function cardLayoutOf(option) {
|
|
|
292
296
|
const value = option?.cardLayout;
|
|
293
297
|
return CARD_LAYOUTS.includes(value) ? value : 'oneRow';
|
|
294
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* The key at the bottom right of the app keyboard (option.enterKey), set in the Designer per field:
|
|
301
|
+
* done closes the keyboard (default), search sends Enter so the field's action runs (a search starts),
|
|
302
|
+
* next moves on to the next field. The header's search field has search as its default.
|
|
303
|
+
*/
|
|
304
|
+
const ENTER_KEYS = ['done', 'search', 'next'];
|
|
305
|
+
/** A field's key at the bottom right: its option.enterKey when known, else the given default. */
|
|
306
|
+
function enterKeyFor(option, fallback = 'done') {
|
|
307
|
+
const own = option?.enterKey;
|
|
308
|
+
return ENTER_KEYS.includes(own) ? own : fallback;
|
|
309
|
+
}
|
|
295
310
|
/** The toolkit keyboards a field can ask for (option.keyboardType). */
|
|
296
311
|
const KEYBOARD_TYPES = ['string', 'alpha', 'numeric', 'email', 'date', 'time'];
|
|
297
312
|
/** keyboardType values that keep the device's system keyboard. */
|
|
@@ -651,7 +666,47 @@ function assertFieldSettings(schema, fallback, option, context) {
|
|
|
651
666
|
if (errors.length)
|
|
652
667
|
throw new Error('Invalid field layout: ' + errors.join(' '));
|
|
653
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* A text shown in a list (card, grid) ends with … after this many lines (option.maxLines, set in the Designer: 1-20);
|
|
671
|
+
* 0 = no limit. The whole text stays on the detail page (user 2026-11-01).
|
|
672
|
+
*/
|
|
673
|
+
function maxLinesOf(option) {
|
|
674
|
+
const n = Math.floor(Number(option?.maxLines));
|
|
675
|
+
return Number.isFinite(n) && n >= 1 && n <= 20 ? n : 0;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* A card list's cards of a row are equally high and their buttons stand at the bottom, in line across the row
|
|
679
|
+
* (center.option.alignRows, set in the Designer; on for new card lists, user 2026-11-01).
|
|
680
|
+
*/
|
|
681
|
+
function alignRowsOf(center) {
|
|
682
|
+
return center?.option?.alignRows === true;
|
|
683
|
+
}
|
|
654
684
|
|
|
685
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
686
|
+
// - change: signIn takes true (the default test user) or a test user's name (Vault, test-signin.ts)
|
|
687
|
+
// - new: TEST_TEMPOS, tempoPause - how fast a run goes, chosen only at "Run tests" (fast, normal, slow)
|
|
688
|
+
// - new: layout rule align - with card.alignRows the buttons of a card row stand on one line
|
|
689
|
+
// - fix: overlap - a box scrolled under the fixed header is hidden, not covering (inBar)
|
|
690
|
+
// - new: layout rule header - a fixed header stays in sight; a note when the header scrolls along
|
|
691
|
+
// - new: layout - content in an area that scrolls sideways (a wide table) is reached, not beyond; layoutNotes;
|
|
692
|
+
// StepResult.notes
|
|
693
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-31
|
|
694
|
+
// - new: lists in one place (point 5): RTL_LANGUAGES with ckb and dv (the editor had them, sd was missing there),
|
|
695
|
+
// deviceChoices(), PLACEHOLDER_SOURCE and matchesTemplate (fallback {{x | y}} too, as validate.py)
|
|
696
|
+
// - new: StepResult.details - a failed step's measurements
|
|
697
|
+
// - change: the test device "phone" is called "mobile" (the preview's word); "phone" is still taken as old spelling
|
|
698
|
+
// - new: step signIn - signed in from here on (a person in the preview, the test user on the simulators)
|
|
699
|
+
// - change: expect shows takes a language key too - shown in the language of the run
|
|
700
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-31
|
|
701
|
+
// - new: languages and locale - a flow runs in each of its languages (languages: ["en","de"] or "all" = the app's
|
|
702
|
+
// left-to-right languages; right-to-left is left out until it is supported); step language (switch on the way),
|
|
703
|
+
// step reload; typed values may be language-neutral (2026-10-30, 14:00, 12.50) - localeKeys gives the keys in the
|
|
704
|
+
// language's order and form; expect formatted (date / time / datetime / number / currency in the language's form,
|
|
705
|
+
// localeRenderings) and translated (no text of the page missing in the language)
|
|
706
|
+
// - new: keyboard - expect fieldVisible (the field stays visible above an open keyboard) and restored (the page stands
|
|
707
|
+
// as before the keyboard opened); layout - expect layout and layoutProblems (rules on what the page shows: nothing
|
|
708
|
+
// beyond the frame, no sideways scrolling, no overlapping fields or buttons, no text squeezed into a narrow column,
|
|
709
|
+
// fields of one row on one line) - the runners measure, these rules judge (OFFENE-PUNKTE 143)
|
|
655
710
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-29
|
|
656
711
|
// - new: expect cardRows - the card field's rows (1-3), none of its parts wider than the field (OFFENE-PUNKTE 103)
|
|
657
712
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-29
|
|
@@ -680,16 +735,39 @@ const TESTS_DIR = '.liveforge/tests';
|
|
|
680
735
|
const RESULTS_DIR = '.liveforge/results';
|
|
681
736
|
/** The app's test data, shared by its tests: { customer: { firstName: "Max" }, card: { number: "4242…" } } */
|
|
682
737
|
const TEST_DATA_FILE = '.liveforge/test-data.json';
|
|
683
|
-
const TEST_DEVICES = ['
|
|
738
|
+
const TEST_DEVICES = ['mobile', 'tablet', 'laptop', 'desktop'];
|
|
739
|
+
/** Old spellings of a device, still taken: "phone" is "mobile" (2026-10-31, the preview's word). */
|
|
740
|
+
const OLD_DEVICE_NAMES = { phone: 'mobile' };
|
|
684
741
|
const ORIENTATIONS = ['portrait', 'landscape'];
|
|
685
|
-
const STEP_KINDS = ['open', 'menu', 'tap', 'type', 'pick', 'press', 'scroll', 'openRecord', 'close', 'cart', 'rotate', 'device', 'wait', 'expect'];
|
|
742
|
+
const STEP_KINDS = ['open', 'menu', 'tap', 'type', 'pick', 'press', 'scroll', 'openRecord', 'close', 'cart', 'rotate', 'device', 'wait', 'language', 'reload', 'signIn', 'expect'];
|
|
686
743
|
/** What an expect step can check - one of them per step. */
|
|
687
744
|
const EXPECT_KINDS = ['value', 'shows', 'keyboard', 'list', 'message', 'visible', 'hidden', 'locked', 'blocked', 'inFrame',
|
|
688
|
-
'page', 'records', 'recordsAtLeast', 'samePlace', 'cartCount', 'toast', 'checked', 'unchecked', 'cardRows'
|
|
745
|
+
'page', 'records', 'recordsAtLeast', 'samePlace', 'cartCount', 'toast', 'checked', 'unchecked', 'cardRows',
|
|
746
|
+
'formatted', 'translated', 'fieldVisible', 'restored', 'layout'];
|
|
747
|
+
/** How a value is shown in the language's form (expect formatted). */
|
|
748
|
+
const FORMATS = ['date', 'time', 'datetime', 'number', 'currency'];
|
|
749
|
+
/** Languages written right to left - not tested until right-to-left is supported (decision 2026-10-30). */
|
|
750
|
+
const RTL_LANGUAGES = ['ar', 'fa', 'he', 'ur', 'ps', 'sd', 'yi', 'ckb', 'dv'];
|
|
689
751
|
/** What has to stay inside the page frame (safe areas, top gap). */
|
|
690
752
|
const FRAME_PARTS = ['keyboard', 'dialog', 'calendar', 'list', 'menu'];
|
|
691
753
|
const LIST_STATES = ['open', 'closed'];
|
|
692
|
-
const DEFAULT_DEVICES = ['
|
|
754
|
+
const DEFAULT_DEVICES = ['mobile', 'tablet'];
|
|
755
|
+
/** Every device a test can name: each device, portrait and (for mobile and tablet) landscape - the editor's choices. */
|
|
756
|
+
function deviceChoices() {
|
|
757
|
+
return TEST_DEVICES.flatMap((d) => (d === 'mobile' || d === 'tablet' ? [d, `${d}:landscape`] : [d]));
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* A placeholder in a text: {{name}} or {{name | fallback}} (the same pattern as validate.py's, via the contract).
|
|
761
|
+
* As a source, so every runner and the Python validator build their own RegExp from it.
|
|
762
|
+
*/
|
|
763
|
+
const PLACEHOLDER_SOURCE = '\\{\\{\\s*([^}|]+?)\\s*(?:\\|[^}]*)?\\}\\}';
|
|
764
|
+
/** Whether a shown text is a text with placeholders filled in ("Order 4711 saved" for "Order {{id}} saved"). */
|
|
765
|
+
function matchesTemplate(text, template) {
|
|
766
|
+
const parts = String(template).split(new RegExp(PLACEHOLDER_SOURCE));
|
|
767
|
+
// split with a group keeps the names - every other part is a name
|
|
768
|
+
const fixed = parts.filter((_, i) => i % 2 === 0).map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
769
|
+
return new RegExp(fixed.join('.+?')).test(String(text));
|
|
770
|
+
}
|
|
693
771
|
/**
|
|
694
772
|
* How many runs the backend keeps in .liveforge/results - defaults, the project configuration can
|
|
695
773
|
* change them: at most `max` runs; while they together are bigger than `maxBytes` (mostly images of
|
|
@@ -710,7 +788,8 @@ function resultsToDelete(runs, keep = RESULTS_KEEP) {
|
|
|
710
788
|
}
|
|
711
789
|
/** "tablet:landscape" → { device: 'tablet', orientation: 'landscape' }; null when unknown. */
|
|
712
790
|
function parseDevice(text) {
|
|
713
|
-
const [
|
|
791
|
+
const [written, orientation = 'portrait'] = String(text || '').split(':');
|
|
792
|
+
const device = OLD_DEVICE_NAMES[written] ?? written;
|
|
714
793
|
if (!TEST_DEVICES.includes(device))
|
|
715
794
|
return null;
|
|
716
795
|
if (!ORIENTATIONS.includes(orientation))
|
|
@@ -719,7 +798,12 @@ function parseDevice(text) {
|
|
|
719
798
|
}
|
|
720
799
|
/** The devices a flow runs on. */
|
|
721
800
|
function flowDevices(flow) {
|
|
722
|
-
|
|
801
|
+
// an old spelling ("phone") as today's name ("mobile")
|
|
802
|
+
return (flow.devices?.length ? flow.devices : DEFAULT_DEVICES).map((d) => {
|
|
803
|
+
const [name, orientation] = String(d).split(':');
|
|
804
|
+
const now = OLD_DEVICE_NAMES[name] ?? name;
|
|
805
|
+
return orientation ? `${now}:${orientation}` : now;
|
|
806
|
+
});
|
|
723
807
|
}
|
|
724
808
|
/** The kind of a step - the first step key it has. */
|
|
725
809
|
function stepKind(step) {
|
|
@@ -729,6 +813,173 @@ const text = (v) => typeof v === 'string' && v.trim().length > 0;
|
|
|
729
813
|
/** The problems of a flow; an empty list means it can run. */
|
|
730
814
|
/** Step and check keys that hold a number. */
|
|
731
815
|
const NUMBER_KEYS = new Set(['scroll', 'openRecord', 'wait', 'records', 'recordsAtLeast', 'cartCount', 'cardRows']);
|
|
816
|
+
/** The languages a flow runs in: its own (right-to-left left out), "all" = the app's left-to-right ones, none = the main one. */
|
|
817
|
+
function flowLanguages(flow, appLanguages, main) {
|
|
818
|
+
const ltr = (codes) => [...new Set(codes.map((c) => String(c).slice(0, 2).toLowerCase()))].filter((c) => c && !RTL_LANGUAGES.includes(c));
|
|
819
|
+
if (flow.languages === 'all')
|
|
820
|
+
return ltr(appLanguages.length ? appLanguages : [main]);
|
|
821
|
+
if (Array.isArray(flow.languages) && flow.languages.length)
|
|
822
|
+
return ltr(flow.languages);
|
|
823
|
+
return ltr([main]);
|
|
824
|
+
}
|
|
825
|
+
const NEUTRAL_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
826
|
+
const NEUTRAL_TIME = /^(\d{2}):(\d{2})$/;
|
|
827
|
+
const NEUTRAL_DATETIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})$/;
|
|
828
|
+
const NEUTRAL_NUMBER = /^-?\d+\.\d+$/;
|
|
829
|
+
/** 12 hours with AM/PM in this language? */
|
|
830
|
+
function uses12Hours(lang) {
|
|
831
|
+
try {
|
|
832
|
+
return new Intl.DateTimeFormat(lang, { hour: 'numeric' }).resolvedOptions().hour12 === true;
|
|
833
|
+
}
|
|
834
|
+
catch {
|
|
835
|
+
return false;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
/** The order of day, month, year in the language's numeric date ("dmy", "mdy", "ymd"). */
|
|
839
|
+
function dateOrder(lang) {
|
|
840
|
+
try {
|
|
841
|
+
return new Intl.DateTimeFormat(lang, { year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(new Date(2026, 9, 30))
|
|
842
|
+
.filter((p) => p.type === 'day' || p.type === 'month' || p.type === 'year').map((p) => p.type[0]).join('');
|
|
843
|
+
}
|
|
844
|
+
catch {
|
|
845
|
+
return 'mdy';
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* The keys a person types for a language-neutral value in this language: a date's digits in the language's order
|
|
850
|
+
* (en 10302026, de 30102026), a time as digits with P/A in a 12-hour language (0200P) or 24 hours (1400), a number
|
|
851
|
+
* with the language's decimal sign (de 12,50). Any other text stays as it is - older flows typed the keys themselves.
|
|
852
|
+
*/
|
|
853
|
+
function localeKeys(value, lang) {
|
|
854
|
+
const text = String(value);
|
|
855
|
+
const date = (y, m, d) => dateOrder(lang).split('').map((k) => (k === 'd' ? d : k === 'm' ? m : y)).join('');
|
|
856
|
+
const time = (h, min) => {
|
|
857
|
+
if (!uses12Hours(lang))
|
|
858
|
+
return `${h}${min}`;
|
|
859
|
+
const hour = Number(h);
|
|
860
|
+
const h12 = String(hour % 12 === 0 ? 12 : hour % 12).padStart(2, '0');
|
|
861
|
+
return `${h12}${min}${hour < 12 ? 'A' : 'P'}`;
|
|
862
|
+
};
|
|
863
|
+
let m = NEUTRAL_DATETIME.exec(text);
|
|
864
|
+
if (m)
|
|
865
|
+
return `${date(m[1], m[2], m[3])}${time(m[4], m[5])}`;
|
|
866
|
+
m = NEUTRAL_DATE.exec(text);
|
|
867
|
+
if (m)
|
|
868
|
+
return date(m[1], m[2], m[3]);
|
|
869
|
+
m = NEUTRAL_TIME.exec(text);
|
|
870
|
+
if (m)
|
|
871
|
+
return time(m[1], m[2]);
|
|
872
|
+
if (NEUTRAL_NUMBER.test(text)) {
|
|
873
|
+
const sign = new Intl.NumberFormat(lang).formatToParts(1.5).find((p) => p.type === 'decimal')?.value || '.';
|
|
874
|
+
return text.replace('.', sign);
|
|
875
|
+
}
|
|
876
|
+
return text;
|
|
877
|
+
}
|
|
878
|
+
/** Every way the language writes this value (expect formatted) - the field must show one of them; spaces are made plain. */
|
|
879
|
+
function localeRenderings(value, as, lang, currency) {
|
|
880
|
+
const out = new Set();
|
|
881
|
+
const add = (s) => out.add(s.replace(/[\u00a0\u202f]/g, ' ').trim());
|
|
882
|
+
const d = NEUTRAL_DATETIME.exec(value) || NEUTRAL_DATE.exec(value);
|
|
883
|
+
const t = NEUTRAL_TIME.exec(value);
|
|
884
|
+
try {
|
|
885
|
+
if (as === 'date' && d) {
|
|
886
|
+
const day = new Date(Number(d[1]), Number(d[2]) - 1, Number(d[3]));
|
|
887
|
+
for (const style of [{ year: 'numeric', month: '2-digit', day: '2-digit' }, { year: 'numeric', month: 'numeric', day: 'numeric' },
|
|
888
|
+
{ dateStyle: 'medium' }, { dateStyle: 'long' }, { dateStyle: 'short' }])
|
|
889
|
+
add(new Intl.DateTimeFormat(lang, style).format(day));
|
|
890
|
+
}
|
|
891
|
+
else if ((as === 'time' && t) || (as === 'datetime' && d && d[4])) {
|
|
892
|
+
const at = t ? new Date(2026, 0, 1, Number(t[1]), Number(t[2])) : new Date(Number(d[1]), Number(d[2]) - 1, Number(d[3]), Number(d[4]), Number(d[5]));
|
|
893
|
+
for (const hour of ['2-digit', 'numeric']) {
|
|
894
|
+
const time = new Intl.DateTimeFormat(lang, { hour, minute: '2-digit' }).format(at);
|
|
895
|
+
if (as === 'time')
|
|
896
|
+
add(time);
|
|
897
|
+
else
|
|
898
|
+
for (const style of [{ year: 'numeric', month: '2-digit', day: '2-digit' }, { dateStyle: 'medium' }]) {
|
|
899
|
+
const date = new Intl.DateTimeFormat(lang, style).format(at);
|
|
900
|
+
add(`${date} ${time}`);
|
|
901
|
+
add(`${date}, ${time}`);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
else if (as === 'number' && /^-?\d+(\.\d+)?$/.test(value)) {
|
|
906
|
+
const n = Number(value), decimals = (value.split('.')[1] || '').length;
|
|
907
|
+
add(new Intl.NumberFormat(lang, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }).format(n));
|
|
908
|
+
add(new Intl.NumberFormat(lang).format(n));
|
|
909
|
+
}
|
|
910
|
+
else if (as === 'currency' && /^-?\d+(\.\d+)?$/.test(value) && currency) {
|
|
911
|
+
add(new Intl.NumberFormat(lang, { style: 'currency', currency }).format(Number(value)));
|
|
912
|
+
add(new Intl.NumberFormat(lang, { style: 'currency', currency, currencyDisplay: 'narrowSymbol' }).format(Number(value)));
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
catch { /* an unknown language or currency: no rendering - the check fails with the shown text */ }
|
|
916
|
+
return [...out];
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* The layout rules (OFFENE-PUNKTE 143), judged on what a runner measured: beyond (an element leaves the frame
|
|
920
|
+
* sideways), sideways (the page scrolls sideways), overlap (two fields / buttons cover each other), narrow (a text
|
|
921
|
+
* gets fewer than 3 characters a line), row (fields of one row do not stand on one line). Pixels tolerate 2.
|
|
922
|
+
*/
|
|
923
|
+
function layoutProblems(snap) {
|
|
924
|
+
const problems = [];
|
|
925
|
+
const tol = 2;
|
|
926
|
+
if (snap.scrollsSideways)
|
|
927
|
+
problems.push({ rule: 'sideways', detail: 'the page scrolls sideways' });
|
|
928
|
+
const boxes = snap.boxes.filter((b) => b.right - b.left > 0 && b.bottom - b.top > 0);
|
|
929
|
+
// a fixed header stays in sight however far the page is scrolled (user 2026-11-01)
|
|
930
|
+
const h = snap.header;
|
|
931
|
+
if (h && h.scroll === 'fixed' && (h.top < -tol || h.bottom <= 0))
|
|
932
|
+
problems.push({ rule: 'header', detail: `the header left the screen (${Math.round(h.top)}–${Math.round(h.bottom)}) although it is fixed` });
|
|
933
|
+
// aligned card rows (card.alignRows): the buttons of a row stand on one line (user 2026-11-01)
|
|
934
|
+
(snap.cardRows || []).forEach((tops, i) => {
|
|
935
|
+
if (Math.max(...tops) - Math.min(...tops) > tol)
|
|
936
|
+
problems.push({ rule: 'align', detail: `the buttons of card row ${i + 1} do not stand on one line (${tops.map((t) => Math.round(t)).join(', ')})` });
|
|
937
|
+
});
|
|
938
|
+
for (const s of snap.scrollers || []) {
|
|
939
|
+
if (s.left < -tol || s.right > snap.width + tol)
|
|
940
|
+
problems.push({ rule: 'beyond', detail: `area "${s.name}" leaves the frame (${Math.round(s.left)}–${Math.round(s.right)} of ${snap.width})` });
|
|
941
|
+
}
|
|
942
|
+
for (const b of boxes) {
|
|
943
|
+
// in an area that scrolls sideways (a wide table) it is reached by swiping there - not lost (user 2026-11-01)
|
|
944
|
+
if (!b.scroller && (b.left < -tol || b.right > snap.width + tol))
|
|
945
|
+
problems.push({ rule: 'beyond', detail: `${b.kind} "${b.name}" leaves the frame (${Math.round(b.left)}–${Math.round(b.right)} of ${snap.width})` });
|
|
946
|
+
if (b.kind === 'text' && b.charsPerLine !== undefined && b.charsPerLine < 3)
|
|
947
|
+
problems.push({ rule: 'narrow', detail: `text "${b.name}" gets ${b.charsPerLine} characters a line` });
|
|
948
|
+
}
|
|
949
|
+
// what the page scrolled under a fixed header is hidden by it, not covering it (user 2026-11-01): a box outside the
|
|
950
|
+
// top bar counts only below it
|
|
951
|
+
const barBottom = h && h.scroll !== 'scrollsAlong' ? h.bottom : 0;
|
|
952
|
+
// only the part below the header counts - the rest is hidden by it
|
|
953
|
+
const solid = boxes.filter((b) => (b.kind === 'field' || b.kind === 'button') && (b.inBar || b.bottom > barBottom + tol))
|
|
954
|
+
.map((b) => (b.inBar ? b : { ...b, top: Math.max(b.top, barBottom) }));
|
|
955
|
+
for (let i = 0; i < solid.length; i++) {
|
|
956
|
+
for (let j = i + 1; j < solid.length; j++) {
|
|
957
|
+
const a = solid[i], c = solid[j];
|
|
958
|
+
const w = Math.min(a.right, c.right) - Math.max(a.left, c.left);
|
|
959
|
+
const h = Math.min(a.bottom, c.bottom) - Math.max(a.top, c.top);
|
|
960
|
+
if (w > tol && h > tol)
|
|
961
|
+
problems.push({ rule: 'overlap', detail: `${a.kind} "${a.name}" and ${c.kind} "${c.name}" cover each other` });
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
const rows = new Map();
|
|
965
|
+
for (const b of boxes.filter((x) => x.kind === 'field' && x.row))
|
|
966
|
+
rows.set(b.row, [...(rows.get(b.row) || []), b]);
|
|
967
|
+
for (const [row, members] of rows) {
|
|
968
|
+
if (members.length < 2)
|
|
969
|
+
continue;
|
|
970
|
+
const tops = members.map((m) => m.top);
|
|
971
|
+
if (Math.max(...tops) - Math.min(...tops) > 8)
|
|
972
|
+
problems.push({ rule: 'row', detail: `fields of row "${row}" do not stand on one line (${members.map((m) => m.name).join(', ')})` });
|
|
973
|
+
}
|
|
974
|
+
return problems;
|
|
975
|
+
}
|
|
976
|
+
/** Hints that fail nothing: the areas that scroll sideways (a wide table) - shown with a passing layout check. */
|
|
977
|
+
function layoutNotes(snap) {
|
|
978
|
+
const notes = (snap.scrollers || []).map((s) => `${s.name} scrolls sideways (${Math.round(s.content)} of ${Math.round(s.shown)} px)`);
|
|
979
|
+
if (snap.header?.scroll === 'scrollsAlong')
|
|
980
|
+
notes.push('the header scrolls along - cart, search and the page X are out of reach after scrolling');
|
|
981
|
+
return notes;
|
|
982
|
+
}
|
|
732
983
|
/** {{data.customer.firstName}} - a value of the test data; anything else in braces is no test data. */
|
|
733
984
|
const DATA_REF = /\{\{\s*([^}]*?)\s*\}\}/g;
|
|
734
985
|
function stringsOf(node, out = []) {
|
|
@@ -815,6 +1066,9 @@ function checkTestFlow(flow, data) {
|
|
|
815
1066
|
add('nameMissing');
|
|
816
1067
|
if (flow.books !== undefined && typeof flow.books !== 'boolean')
|
|
817
1068
|
add('booksNotBoolean');
|
|
1069
|
+
if (flow.languages !== undefined && flow.languages !== 'all'
|
|
1070
|
+
&& !(Array.isArray(flow.languages) && flow.languages.every((l) => /^[a-z]{2}$/i.test(String(l)))))
|
|
1071
|
+
add('languagesInvalid');
|
|
818
1072
|
if (flow.devices !== undefined) {
|
|
819
1073
|
if (!Array.isArray(flow.devices))
|
|
820
1074
|
add('devicesNotList');
|
|
@@ -882,6 +1136,23 @@ function checkTestFlow(flow, data) {
|
|
|
882
1136
|
if (typeof step.wait !== 'number' || step.wait < 0 || step.wait > 60000)
|
|
883
1137
|
add('waitOutOfRange', n);
|
|
884
1138
|
break;
|
|
1139
|
+
case 'language':
|
|
1140
|
+
if (!/^[a-z]{2}$/i.test(String(step.language || '')))
|
|
1141
|
+
add('languageUnknown', n, { language: String(step.language) });
|
|
1142
|
+
break;
|
|
1143
|
+
case 'reload':
|
|
1144
|
+
if (step[kind] !== true)
|
|
1145
|
+
add('notTrue', n, { kind });
|
|
1146
|
+
break;
|
|
1147
|
+
case 'signIn':
|
|
1148
|
+
// true: the test user "default"; a name: that test user - both stand in the app's test data (testUsers, with
|
|
1149
|
+
// their Vault entry); nothing about them is in the code
|
|
1150
|
+
if (step.signIn !== true && !(typeof step.signIn === 'string' && /^[a-zA-Z0-9_-]{1,40}$/.test(step.signIn)))
|
|
1151
|
+
add('signInInvalid', n);
|
|
1152
|
+
else if (data !== undefined && !data?.testUsers?.[step.signIn === true ? 'default' : step.signIn]?.vault) {
|
|
1153
|
+
add('testUserUnknown', n, { user: step.signIn === true ? 'default' : String(step.signIn) });
|
|
1154
|
+
}
|
|
1155
|
+
break;
|
|
885
1156
|
case 'expect':
|
|
886
1157
|
checkExpect(step.expect, n, add);
|
|
887
1158
|
break;
|
|
@@ -894,7 +1165,8 @@ function checkExpect(e, n, add) {
|
|
|
894
1165
|
add('expectNotAnObject', n);
|
|
895
1166
|
return;
|
|
896
1167
|
}
|
|
897
|
-
|
|
1168
|
+
// formatted carries its value (the language-neutral one) - that value is no check of its own
|
|
1169
|
+
const kinds = EXPECT_KINDS.filter((k) => k in e && !(k === 'value' && 'formatted' in e));
|
|
898
1170
|
if (kinds.length !== 1) {
|
|
899
1171
|
add(kinds.length ? 'expectSeveralKinds' : 'expectUnknown', n, { keys: Object.keys(e).join(', ') });
|
|
900
1172
|
return;
|
|
@@ -922,10 +1194,113 @@ function checkExpect(e, n, add) {
|
|
|
922
1194
|
add('notTrue', n, { kind });
|
|
923
1195
|
if (kind === 'cardRows' && !(Number.isInteger(e.cardRows) && e.cardRows >= 1 && e.cardRows <= 3))
|
|
924
1196
|
add('countNotNumber', n, { kind });
|
|
1197
|
+
if (kind === 'formatted') {
|
|
1198
|
+
if (!text(e.field))
|
|
1199
|
+
add('fieldMissing', n, { kind });
|
|
1200
|
+
if (!FORMATS.includes(e.formatted))
|
|
1201
|
+
add('formatUnknown', n, { format: String(e.formatted) });
|
|
1202
|
+
if (typeof e.value !== 'string' && typeof e.value !== 'number')
|
|
1203
|
+
add('valueMissing', n, { kind });
|
|
1204
|
+
if (e.formatted === 'currency' && !/^[A-Z]{3}$/.test(String(e.currency || '')))
|
|
1205
|
+
add('currencyMissing', n);
|
|
1206
|
+
}
|
|
1207
|
+
if (kind === 'fieldVisible' && !text(e.fieldVisible))
|
|
1208
|
+
add('stepNameMissing', n, { kind });
|
|
1209
|
+
if ((kind === 'translated' || kind === 'restored' || kind === 'layout') && e[kind] !== true)
|
|
1210
|
+
add('notTrue', n, { kind });
|
|
925
1211
|
if (kind === 'cartCount' && !(Number.isInteger(e.cartCount) && e.cartCount >= 0) && !/^[+-]\d+$/.test(String(e.cartCount)))
|
|
926
1212
|
add('countNotNumber', n, { kind });
|
|
927
1213
|
}
|
|
1214
|
+
/**
|
|
1215
|
+
* How fast a run goes - chosen only where the run is started (preview: the choice beside "Run tests"; devices:
|
|
1216
|
+
* --tempo=…), never in a test (user 2026-11-01): fast (no pause), normal (a short pause before each step), slow
|
|
1217
|
+
* (a long pause, to watch it). The checks' time limits start after the pause.
|
|
1218
|
+
*/
|
|
1219
|
+
const TEST_TEMPOS = ['fast', 'normal', 'slow'];
|
|
1220
|
+
/** The pause before a step in ms; unknown tempo: fast. */
|
|
1221
|
+
function tempoPause(tempo) {
|
|
1222
|
+
return tempo === 'normal' ? 600 : tempo === 'slow' ? 1800 : 0;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
1226
|
+
// - new: the test sign-in without the ui-backend (user 2026-11-01: "stelle dir vor es existiert kein ui-backend für
|
|
1227
|
+
// die tests"): a runner signs in to Vault itself (a Vault token, or a JWT - the GitLab job's ID token, the
|
|
1228
|
+
// Designer person's Keycloak token), reads the test user of the app (liveforge/tenants/<tenant>/e2e/<app>/<name>)
|
|
1229
|
+
// - the sign-in data only: the app signs in at its Keycloak itself, the runner fills the app's own window like a
|
|
1230
|
+
// person (user 2026-11-01: "die App muss sich beim Keycloak authentifizieren und bekommt von uns nur die
|
|
1231
|
+
// Anmeldedaten"). totp gives the authenticator code. fetch and crypto.subtle are passed in or global.
|
|
1232
|
+
/** The test user a step names (signIn true -> "default") from the app's test data; null when the app has none. */
|
|
1233
|
+
function testUserEntry(data, name) {
|
|
1234
|
+
const key = name === true ? 'default' : String(name || 'default');
|
|
1235
|
+
const entry = data?.testUsers?.[key];
|
|
1236
|
+
return entry && typeof entry.vault === 'string' && entry.vault.includes('/') ? entry : null;
|
|
1237
|
+
}
|
|
1238
|
+
/** "liveforge/tenants/dev/e2e/tm-test/default" -> the KV v2 mount and the path inside it. */
|
|
1239
|
+
function vaultPlace(vault) {
|
|
1240
|
+
const [mount, ...rest] = String(vault).replace(/^\/+|\/+$/g, '').split('/');
|
|
1241
|
+
return { mount, path: rest.join('/') };
|
|
1242
|
+
}
|
|
1243
|
+
/** base32 (RFC 4648, the authenticator apps' form) to bytes. */
|
|
1244
|
+
function base32Bytes(secret) {
|
|
1245
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
1246
|
+
const clean = String(secret || '').toUpperCase().replace(/[^A-Z2-7]/g, '');
|
|
1247
|
+
const out = [];
|
|
1248
|
+
let bits = 0;
|
|
1249
|
+
let value = 0;
|
|
1250
|
+
for (const ch of clean) {
|
|
1251
|
+
value = (value << 5) | alphabet.indexOf(ch);
|
|
1252
|
+
bits += 5;
|
|
1253
|
+
if (bits >= 8) {
|
|
1254
|
+
out.push((value >>> (bits - 8)) & 0xff);
|
|
1255
|
+
bits -= 8;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
return new Uint8Array(out);
|
|
1259
|
+
}
|
|
1260
|
+
/** The authenticator code (TOTP, RFC 6238: HMAC-SHA1, 30 s, 6 digits) of a key at a time. */
|
|
1261
|
+
async function totp(secret, now = Date.now(), subtle = globalThis.crypto?.subtle) {
|
|
1262
|
+
const counter = Math.floor(now / 1000 / 30);
|
|
1263
|
+
const msg = new Uint8Array(8);
|
|
1264
|
+
let c = counter;
|
|
1265
|
+
for (let i = 7; i >= 0; i--) {
|
|
1266
|
+
msg[i] = c & 0xff;
|
|
1267
|
+
c = Math.floor(c / 256);
|
|
1268
|
+
}
|
|
1269
|
+
const key = await subtle.importKey('raw', base32Bytes(secret), { name: 'HMAC', hash: 'SHA-1' }, false, ['sign']);
|
|
1270
|
+
const mac = new Uint8Array(await subtle.sign('HMAC', key, msg));
|
|
1271
|
+
const offset = mac[mac.length - 1] & 0x0f;
|
|
1272
|
+
const code = ((mac[offset] & 0x7f) << 24) | (mac[offset + 1] << 16) | (mac[offset + 2] << 8) | mac[offset + 3];
|
|
1273
|
+
return String(code % 1_000_000).padStart(6, '0');
|
|
1274
|
+
}
|
|
1275
|
+
/** A Vault token from a JWT (auth/<mount>/login, role): the GitLab job's ID token or a person's Keycloak token. */
|
|
1276
|
+
async function vaultJwtLogin(fetchFn, addr, mount, role, jwt) {
|
|
1277
|
+
const answer = await fetchFn(`${addr.replace(/\/+$/, '')}/v1/auth/${mount}/login`, {
|
|
1278
|
+
method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ role, jwt }),
|
|
1279
|
+
});
|
|
1280
|
+
if (!answer.ok)
|
|
1281
|
+
throw new Error(`Vault sign-in refused (${answer.status})`);
|
|
1282
|
+
const token = (await answer.json())?.auth?.client_token;
|
|
1283
|
+
if (!token)
|
|
1284
|
+
throw new Error('Vault gave no token');
|
|
1285
|
+
return token;
|
|
1286
|
+
}
|
|
1287
|
+
/** A test user from Vault (KV v2 mount and path, vaultPlace of the test data entry). The values never leave this function but in the result. */
|
|
1288
|
+
async function readTestUser(fetchFn, addr, token, mount, path) {
|
|
1289
|
+
const answer = await fetchFn(`${addr.replace(/\/+$/, '')}/v1/${mount}/data/${path}`, { headers: { 'x-vault-token': token } });
|
|
1290
|
+
if (answer.status === 404)
|
|
1291
|
+
throw new Error(`no test user in Vault at ${mount}/${path}`);
|
|
1292
|
+
if (!answer.ok)
|
|
1293
|
+
throw new Error(`Vault refused reading the test user (${answer.status})`);
|
|
1294
|
+
const data = (await answer.json())?.data?.data || {};
|
|
1295
|
+
if (!data.username || !data.password)
|
|
1296
|
+
throw new Error(`the test user at ${mount}/${path} has no username or password`);
|
|
1297
|
+
return { username: String(data.username), password: String(data.password), otpSecret: data.otpSecret ? String(data.otpSecret) : undefined,
|
|
1298
|
+
tenantKey: data.tenantKey ? String(data.tenantKey) : undefined };
|
|
1299
|
+
}
|
|
928
1300
|
|
|
1301
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
1302
|
+
// - new: HEADER_SCROLLS, headerScrollOf - what the header does when the page scrolls (header.option.scroll):
|
|
1303
|
+
// fixed (default), hideOnScroll (away while scrolling down, back at once when scrolling up), scrollsAlong
|
|
929
1304
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-23
|
|
930
1305
|
// - new: start page, roles and storage of the sign-in (OFFENE-PUNKTE 109): the start page is center.option
|
|
931
1306
|
// and holds for every sign-in setting; a role may have its own start page (login.roles, in the
|
|
@@ -1452,7 +1827,546 @@ function appSettingsMenu(menu, center, context = {}) {
|
|
|
1452
1827
|
}
|
|
1453
1828
|
return [...items, { label: { caption }, icon: 'setting', option: { visible: true }, submenu: added }];
|
|
1454
1829
|
}
|
|
1830
|
+
// ---------------------------------------------------------------- finding a menu entry (2026-10-31)
|
|
1831
|
+
// One way for the app's test runner and the device runner (before: three, searching to different depths and
|
|
1832
|
+
// reading the caption differently - a page under elements / children was not found by the device runner).
|
|
1833
|
+
/** An entry's caption as written in Main: label.caption, a plain label, or caption. */
|
|
1834
|
+
function menuCaption(item) {
|
|
1835
|
+
const label = item?.label;
|
|
1836
|
+
return String((label && typeof label === 'object' ? label.caption : label) ?? item?.caption ?? '');
|
|
1837
|
+
}
|
|
1838
|
+
/** The page an entry opens as tests name it ("pages/sidemenu/books/layout_schema.json" -> "sidemenu/books"); '' without. */
|
|
1839
|
+
function menuPage(item) {
|
|
1840
|
+
return /^pages\/(.+)\/layout_schema\.json$/.exec(String(item?.option?.layout_url ?? ''))?.[1] ?? '';
|
|
1841
|
+
}
|
|
1842
|
+
/** Every entry of a menu, at any depth (submenu, elements, children), with its path of captions. */
|
|
1843
|
+
function menuEntries(items, path = []) {
|
|
1844
|
+
const out = [];
|
|
1845
|
+
for (const item of Array.isArray(items) ? items : []) {
|
|
1846
|
+
if (!item || typeof item !== 'object')
|
|
1847
|
+
continue;
|
|
1848
|
+
const caption = menuCaption(item);
|
|
1849
|
+
out.push({ item, caption, page: menuPage(item), path: [...path, caption] });
|
|
1850
|
+
for (const key of ['submenu', 'elements', 'children']) {
|
|
1851
|
+
if (Array.isArray(item[key]))
|
|
1852
|
+
out.push(...menuEntries(item[key], [...path, caption]));
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return out;
|
|
1856
|
+
}
|
|
1857
|
+
/** The entry that opens a page (its folder under pages/), at any depth. */
|
|
1858
|
+
function menuEntryForPage(items, page) {
|
|
1859
|
+
return menuEntries(items).find((e) => e.page === page)?.item ?? null;
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* The entry with this caption that opens a page, at any depth: the caption as written in Main, or - the app shows
|
|
1863
|
+
* it translated - the text the language file has for it (texts: written text -> shown text).
|
|
1864
|
+
*/
|
|
1865
|
+
function menuEntryByCaption(items, caption, texts = {}) {
|
|
1866
|
+
const want = [caption, texts[caption]].filter((t) => typeof t === 'string' && !!t);
|
|
1867
|
+
return menuEntries(items).find((e) => e.page && want.includes(e.caption))?.item ?? null;
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* What the header does when the page scrolls (main/layout_schema.json header.option.scroll, user 2026-11-01):
|
|
1871
|
+
* fixed - stays at the top (default, usual for shops and apps on every device); hideOnScroll - moves away while
|
|
1872
|
+
* scrolling down and comes back at once when scrolling up ("quick return", room on a phone); scrollsAlong - scrolls
|
|
1873
|
+
* away with the page: cart, search and the page X are out of reach after scrolling, and going back from them puts
|
|
1874
|
+
* a list at its top (found 2026-11-01, luv2shop a06).
|
|
1875
|
+
*/
|
|
1876
|
+
const HEADER_SCROLLS = ['fixed', 'hideOnScroll', 'scrollsAlong'];
|
|
1877
|
+
/** The header's behaviour when the page scrolls - its option.scroll when known, else fixed. */
|
|
1878
|
+
function headerScrollOf(header) {
|
|
1879
|
+
const own = header?.option?.scroll;
|
|
1880
|
+
return HEADER_SCROLLS.includes(own) ? own : 'fixed';
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-30
|
|
1884
|
+
// - new: rowAction (an icon of a grid row: any method, default GET - hotel approves with GET), OLD_CALL_KEYS and
|
|
1885
|
+
// successMessageOf (notifcation.success of older data)
|
|
1886
|
+
// - new: the action catalog - the ONE place that says what an element does with its records and which
|
|
1887
|
+
// attributes count for it (OFFENE-PUNKTE 144). Three questions, three places in an option:
|
|
1888
|
+
// what action / innerAction (get, save, delete, saveAll, submit, login …) - CALL_KIND_OF
|
|
1889
|
+
// where storageType: browser (localstorage / sessionstorage) or backend (database) - STORAGES
|
|
1890
|
+
// how only the attributes of that storage and that kind - CALL_KINDS[kind].browser / .backend
|
|
1891
|
+
// The older storageType "filter" is a backend that waits for its filter fields (database + loadOnFilter).
|
|
1892
|
+
// The library, the Designer (<app-call-settings>), the AI contract (capabilities.json) and validate.py read
|
|
1893
|
+
// it from here instead of keeping their own lists. No Angular, no texts.
|
|
1894
|
+
/** Where records are kept. The first two stay in the browser, database is the backend. */
|
|
1895
|
+
const STORAGES = ['localstorage', 'sessionstorage', 'database'];
|
|
1896
|
+
const BROWSER_STORAGES = ['localstorage', 'sessionstorage'];
|
|
1897
|
+
/** Storage values of older data and what they mean now. */
|
|
1898
|
+
const OLD_STORAGES = {
|
|
1899
|
+
filter: { storageType: 'database', loadOnFilter: true },
|
|
1900
|
+
};
|
|
1901
|
+
const MESSAGES = ['successMessage', 'errorMessage'];
|
|
1902
|
+
const CALL_KINDS = {
|
|
1903
|
+
load: {
|
|
1904
|
+
does: 'A menu entry or page shows records: from the browser storage, or loaded from the backend (optionally only once the filter fields are filled).',
|
|
1905
|
+
storages: ['localstorage', 'sessionstorage', 'database'], defaultStorage: 'database', addressKey: 'data_url',
|
|
1906
|
+
methods: ['GET', 'POST'],
|
|
1907
|
+
browser: ['data_url'],
|
|
1908
|
+
backend: ['data_url', 'proxy', 'method', 'passToken', 'params', 'body', 'dateFormat', 'dataKey', 'loadOnFilter', 'emptyMessage', 'errorMessage'],
|
|
1909
|
+
},
|
|
1910
|
+
link: {
|
|
1911
|
+
does: 'A button opens a detail page that loads its record from the address; the button itself calls nothing.',
|
|
1912
|
+
storages: ['database'], defaultStorage: 'database', addressKey: 'data_url',
|
|
1913
|
+
methods: [],
|
|
1914
|
+
browser: [],
|
|
1915
|
+
backend: ['data_url', 'proxy', 'dataKey'],
|
|
1916
|
+
},
|
|
1917
|
+
select: {
|
|
1918
|
+
does: 'A selection list loads its choices from the backend (option.autocomplete).',
|
|
1919
|
+
storages: ['database'], defaultStorage: 'database', addressKey: 'url',
|
|
1920
|
+
methods: ['POST', 'GET'],
|
|
1921
|
+
browser: [],
|
|
1922
|
+
// option.autocomplete writes url; a selection field of its own (luv2shop countries) data_url
|
|
1923
|
+
backend: ['url', 'data_url', 'proxy', 'method', 'passToken', 'params', 'body', 'dataKey', 'errorMessage'],
|
|
1924
|
+
},
|
|
1925
|
+
save: {
|
|
1926
|
+
does: 'A card button sends this one record to the backend.',
|
|
1927
|
+
storages: ['database'], defaultStorage: 'database', addressKey: 'data_url',
|
|
1928
|
+
methods: ['POST', 'PUT'],
|
|
1929
|
+
browser: [],
|
|
1930
|
+
backend: ['data_url', 'proxy', 'method', 'passToken', 'params', 'body', 'dateFormat', 'transform', 'afterSuccess', ...MESSAGES],
|
|
1931
|
+
},
|
|
1932
|
+
saveAll: {
|
|
1933
|
+
does: 'A header button sends all records of the page to the backend, one by one or in one call.',
|
|
1934
|
+
storages: ['database'], defaultStorage: 'database', addressKey: 'data_url',
|
|
1935
|
+
methods: ['POST', 'PUT'],
|
|
1936
|
+
browser: [],
|
|
1937
|
+
backend: ['data_url', 'proxy', 'method', 'passToken', 'params', 'body', 'dateFormat', 'transform', 'sendMode', 'afterSuccess', ...MESSAGES],
|
|
1938
|
+
},
|
|
1939
|
+
submit: {
|
|
1940
|
+
does: 'A form or dialog button keeps its record in the browser storage or sends it to the backend.',
|
|
1941
|
+
storages: ['localstorage', 'sessionstorage', 'database'], defaultStorage: 'localstorage', addressKey: 'data_url',
|
|
1942
|
+
methods: ['POST', 'PUT'],
|
|
1943
|
+
browser: ['data_url', 'afterSuccessPage', ...MESSAGES],
|
|
1944
|
+
backend: ['data_url', 'proxy', 'method', 'passToken', 'params', 'body', 'dateFormat', 'transform', 'afterSuccess', 'afterSuccessPage', ...MESSAGES],
|
|
1945
|
+
},
|
|
1946
|
+
delete: {
|
|
1947
|
+
does: 'A button deletes the record - from the browser storage or at the backend; it asks first.',
|
|
1948
|
+
storages: ['localstorage', 'sessionstorage', 'database'], defaultStorage: 'database', addressKey: 'data_url',
|
|
1949
|
+
methods: ['DELETE', 'POST'],
|
|
1950
|
+
browser: ['data_url', 'confirmDelete', 'deleteMessage', ...MESSAGES],
|
|
1951
|
+
backend: ['data_url', 'proxy', 'method', 'passToken', 'params', 'key', 'confirmDelete', 'deleteMessage', ...MESSAGES],
|
|
1952
|
+
},
|
|
1953
|
+
rowAction: {
|
|
1954
|
+
does: 'An icon of a grid row (action column save / delete) calls its address with the row\'s fields ({{field}}) and changes only this row after success - the answer, else afterSuccessSet. A key "{{field}}" with a value shows the icon only on rows where that field has that value (hotel: "{{reservationStatus}}": "PENDING").',
|
|
1955
|
+
storages: ['database'], defaultStorage: 'database', addressKey: 'data_url',
|
|
1956
|
+
methods: ['GET', 'POST', 'PUT', 'DELETE'],
|
|
1957
|
+
browser: [],
|
|
1958
|
+
backend: ['data_url', 'proxy', 'method', 'passToken', 'key', 'afterSuccessSet', ...MESSAGES],
|
|
1959
|
+
},
|
|
1960
|
+
login: {
|
|
1961
|
+
does: 'A sign-in form sends its fields to the backend and keeps the answer (loginResponse, userRoleMapping beside it).',
|
|
1962
|
+
storages: ['database'], defaultStorage: 'database', addressKey: 'url',
|
|
1963
|
+
methods: ['POST'],
|
|
1964
|
+
browser: [],
|
|
1965
|
+
backend: ['url', 'proxy', 'method', 'errorMessage'],
|
|
1966
|
+
},
|
|
1967
|
+
};
|
|
1968
|
+
/** Every attribute of storage and call - an option key outside this list is no business of the catalog. */
|
|
1969
|
+
const CALL_KEYS = [...new Set(['storageType',
|
|
1970
|
+
...Object.values(CALL_KINDS).flatMap((rule) => [...rule.browser, ...rule.backend])])];
|
|
1971
|
+
/** Keys of older data and what they are now - read as before, the Designer writes the new key. */
|
|
1972
|
+
const OLD_CALL_KEYS = {
|
|
1973
|
+
'notifcation.success': 'successMessage',
|
|
1974
|
+
'notification.success': 'successMessage',
|
|
1975
|
+
};
|
|
1976
|
+
/** The message after success: successMessage, else the older notification(s).success. */
|
|
1977
|
+
function successMessageOf(option) {
|
|
1978
|
+
return String(option?.successMessage ?? option?.notification?.success ?? option?.notifcation?.success ?? '').trim();
|
|
1979
|
+
}
|
|
1980
|
+
/** Actions that keep no records and call nothing - no storage, no attributes of this catalog. */
|
|
1981
|
+
const NO_CALL_ACTIONS = {
|
|
1982
|
+
'action:login': 'starts the Keycloak sign-in (a redirect, no call of the app)',
|
|
1983
|
+
'action:logout': 'signs out',
|
|
1984
|
+
'action:cart': 'shows the cart; its data_url is the browser key of the cart (cartInfo)',
|
|
1985
|
+
'innerAction:showModal': 'opens a dialog',
|
|
1986
|
+
'innerAction:cancel': 'closes a dialog',
|
|
1987
|
+
'innerAction:addToCart': 'adds to the cart in the browser',
|
|
1988
|
+
};
|
|
1989
|
+
/** The kind of an element by its action / innerAction and where it stands (a menu entry or page loads). */
|
|
1990
|
+
function callKindOf(option, place = 'button') {
|
|
1991
|
+
if (place === 'autocomplete')
|
|
1992
|
+
return 'select';
|
|
1993
|
+
const inner = String(option?.innerAction ?? '');
|
|
1994
|
+
const action = String(option?.action ?? '');
|
|
1995
|
+
if (inner === 'saveAll')
|
|
1996
|
+
return 'saveAll';
|
|
1997
|
+
if (inner === 'submit' || action === 'submit')
|
|
1998
|
+
return 'submit';
|
|
1999
|
+
if (inner === 'login')
|
|
2000
|
+
return 'login';
|
|
2001
|
+
if (inner && NO_CALL_ACTIONS[`innerAction:${inner}`])
|
|
2002
|
+
return null;
|
|
2003
|
+
if (action === 'save')
|
|
2004
|
+
return 'save';
|
|
2005
|
+
if (action === 'delete')
|
|
2006
|
+
return 'delete';
|
|
2007
|
+
if (action && NO_CALL_ACTIONS[`action:${action}`])
|
|
2008
|
+
return null;
|
|
2009
|
+
if (place === 'menu' || place === 'page')
|
|
2010
|
+
return 'load';
|
|
2011
|
+
if (action === 'get')
|
|
2012
|
+
return 'link';
|
|
2013
|
+
return null;
|
|
2014
|
+
}
|
|
2015
|
+
/** The storage an option means: its storageType (any case, an old value translated), else the kind's default. */
|
|
2016
|
+
function storageOf(option, kind) {
|
|
2017
|
+
const type = String(option?.storageType ?? '').trim().toLowerCase();
|
|
2018
|
+
if (STORAGES.includes(type))
|
|
2019
|
+
return type;
|
|
2020
|
+
if (OLD_STORAGES[type])
|
|
2021
|
+
return OLD_STORAGES[type].storageType;
|
|
2022
|
+
// older data: a method without storageType means the backend (luv2shop's purchase: method post, no storageType)
|
|
2023
|
+
if (!type && option?.method)
|
|
2024
|
+
return 'database';
|
|
2025
|
+
if (!type && option?.localStorage === true)
|
|
2026
|
+
return 'localstorage';
|
|
2027
|
+
if (!type && option?.sessionStorage === true)
|
|
2028
|
+
return 'sessionstorage';
|
|
2029
|
+
return CALL_KINDS[kind].defaultStorage;
|
|
2030
|
+
}
|
|
2031
|
+
/** True when the option waits for its filter fields before loading (loadOnFilter, or the older storageType "filter"). */
|
|
2032
|
+
function waitsForFilter(option) {
|
|
2033
|
+
const type = String(option?.storageType ?? '').trim().toLowerCase();
|
|
2034
|
+
return option?.loadOnFilter === true || OLD_STORAGES[type]?.loadOnFilter === true;
|
|
2035
|
+
}
|
|
2036
|
+
/** The attributes that count for this kind with this storage. */
|
|
2037
|
+
function callAttributes(kind, storage) {
|
|
2038
|
+
const rule = CALL_KINDS[kind];
|
|
2039
|
+
return BROWSER_STORAGES.includes(storage) ? rule.browser : rule.backend;
|
|
2040
|
+
}
|
|
2041
|
+
/** The method an option uses: its own (upper case), else the kind's default; '' when the kind has none. */
|
|
2042
|
+
function methodOf(option, kind) {
|
|
2043
|
+
return String(option?.method || CALL_KINDS[kind].methods[0] || '').toUpperCase();
|
|
2044
|
+
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Checks one option against its kind: a known storage the kind may use, only attributes of that storage, a method of
|
|
2047
|
+
* the kind, an address for the backend. Keys outside CALL_KEYS (style, visible, …) are not looked at.
|
|
2048
|
+
*/
|
|
2049
|
+
function checkCall(option, kind) {
|
|
2050
|
+
const problems = [];
|
|
2051
|
+
const rule = CALL_KINDS[kind];
|
|
2052
|
+
const raw = String(option?.storageType ?? '').trim().toLowerCase();
|
|
2053
|
+
if (raw && !STORAGES.includes(raw) && !OLD_STORAGES[raw]) {
|
|
2054
|
+
problems.push({ code: 'storage-unknown', key: 'storageType', message: `storageType "${option.storageType}" is unknown - ${STORAGES.join(' | ')}` });
|
|
2055
|
+
}
|
|
2056
|
+
if (OLD_STORAGES[raw]) {
|
|
2057
|
+
problems.push({ code: 'storage-old', key: 'storageType', message: `storageType "${raw}" is the older form of storageType "${OLD_STORAGES[raw].storageType}"${OLD_STORAGES[raw].loadOnFilter ? ' with loadOnFilter: true' : ''}` });
|
|
2058
|
+
}
|
|
2059
|
+
const storage = storageOf(option, kind);
|
|
2060
|
+
if (!rule.storages.includes(storage)) {
|
|
2061
|
+
problems.push({ code: 'storage-not-allowed', key: 'storageType', message: `${kind} keeps no records in "${storage}" - ${rule.storages.join(' | ')}` });
|
|
2062
|
+
// the attributes follow the storage - with a wrong one they say nothing more
|
|
2063
|
+
return problems;
|
|
2064
|
+
}
|
|
2065
|
+
const allowed = new Set(['storageType', ...callAttributes(kind, storage)]);
|
|
2066
|
+
for (const key of Object.keys(option ?? {})) {
|
|
2067
|
+
if (CALL_KEYS.includes(key) && !allowed.has(key) && option[key] !== undefined && option[key] !== null && option[key] !== '') {
|
|
2068
|
+
problems.push({ code: 'attribute-not-for-storage', key, message: `${key} means nothing for ${kind} with storage "${storage}"` });
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
if (option?.method && rule.methods.length && !rule.methods.includes(String(option.method).toUpperCase())) {
|
|
2072
|
+
problems.push({ code: 'method-unknown', key: 'method', message: `method "${option.method}" - ${kind} uses ${rule.methods.join(' | ')}` });
|
|
2073
|
+
}
|
|
2074
|
+
// a page without records (a form only) needs no address - only what sends or picks from the backend
|
|
2075
|
+
if (storage === 'database' && kind !== 'link' && kind !== 'load' && !String(option?.[rule.addressKey] ?? option?.data_url ?? option?.url ?? '').trim()) {
|
|
2076
|
+
problems.push({ code: 'address-missing', key: rule.addressKey, message: `${kind} with the backend needs an address (${rule.addressKey})` });
|
|
2077
|
+
}
|
|
2078
|
+
return problems;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-31
|
|
2082
|
+
// - new: one way to put a layout's texts into the app's language, for every container (form, card, grid, dialog,
|
|
2083
|
+
// header). Before, five walkers did it differently: the card skipped a button's own caption ("Add To Cart" stayed
|
|
2084
|
+
// English), the dialog skipped tooltips, form and grid changed the schema in place, so a second language switch
|
|
2085
|
+
// looked up texts that were already translated. Here the text a field was written with is remembered, so every
|
|
2086
|
+
// switch starts from it - in place or on a copy.
|
|
2087
|
+
/** The keys whose text is shown to a person: a caption (label.caption or an element's own), placeholder, tooltip, dialog title. */
|
|
2088
|
+
const SHOWN_TEXT_KEYS = ['caption', 'placeholder', 'tooltip', 'modalTitle'];
|
|
2089
|
+
/** object -> the texts it was written with, per key - a switch to another language starts from them. */
|
|
2090
|
+
const written = new WeakMap();
|
|
2091
|
+
function original(obj, key) {
|
|
2092
|
+
let seen = written.get(obj);
|
|
2093
|
+
if (!seen)
|
|
2094
|
+
written.set(obj, (seen = {}));
|
|
2095
|
+
if (!(key in seen))
|
|
2096
|
+
seen[key] = obj[key];
|
|
2097
|
+
return seen[key];
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* The texts of a layout (or property schema) in the language of `texts` (the language file: written text -> its
|
|
2101
|
+
* translation). With values: also a property's start value (a text without {{ }}), as the grid's footer needs.
|
|
2102
|
+
* inPlace: changes the given schema (its first texts are remembered); else works on a copy. Missing translation:
|
|
2103
|
+
* the written text.
|
|
2104
|
+
*/
|
|
2105
|
+
function translateCaptions(schema, texts, { inPlace = false, values = false } = {}) {
|
|
2106
|
+
if (!schema || typeof schema !== 'object')
|
|
2107
|
+
return schema;
|
|
2108
|
+
const target = inPlace ? schema : JSON.parse(JSON.stringify(schema));
|
|
2109
|
+
const dict = texts || {};
|
|
2110
|
+
const walk = (obj) => {
|
|
2111
|
+
if (!obj || typeof obj !== 'object')
|
|
2112
|
+
return;
|
|
2113
|
+
if (Array.isArray(obj)) {
|
|
2114
|
+
obj.forEach(walk);
|
|
2115
|
+
return;
|
|
2116
|
+
}
|
|
2117
|
+
for (const key of [...SHOWN_TEXT_KEYS, ...(values ? ['value'] : [])]) {
|
|
2118
|
+
if (typeof obj[key] !== 'string')
|
|
2119
|
+
continue;
|
|
2120
|
+
const first = original(obj, key);
|
|
2121
|
+
if (key === 'value' && first.includes('{{'))
|
|
2122
|
+
continue;
|
|
2123
|
+
const own = first.trim();
|
|
2124
|
+
obj[key] = (own && dict[own]) || first;
|
|
2125
|
+
}
|
|
2126
|
+
// records (data arrays, autocomplete lists) are data, not layout - not walked
|
|
2127
|
+
for (const [key, value] of Object.entries(obj))
|
|
2128
|
+
if (value && typeof value === 'object' && !(key === 'data' && Array.isArray(value)))
|
|
2129
|
+
walk(value);
|
|
2130
|
+
};
|
|
2131
|
+
walk(target);
|
|
2132
|
+
return target;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
2136
|
+
// - new: boxes say whether they stand in the top bar (inBar)
|
|
2137
|
+
// - new: cardRows - in a card list with aligned rows, per row the tops of the cards' button elements
|
|
2138
|
+
// - fix: probeFieldVisible - covered by the keyboard only where both overlap sideways too (landscape: keyboard beside)
|
|
2139
|
+
// - new: probeLayoutSnapshot measures the top bar (header.option.scroll, its place, the page's scroll)
|
|
2140
|
+
// - change: probeLayoutSnapshot names the areas that scroll sideways (scrollers) and what stands in them
|
|
2141
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-31
|
|
2142
|
+
// - new: what the test runners measure on the page, written once (before: the app's runner and the device runner
|
|
2143
|
+
// each had a copy, and they had drifted - the device runner flagged record values as untranslated, found fields
|
|
2144
|
+
// without the visibility check and never put the person's app data back). Every probe is self-contained: it uses
|
|
2145
|
+
// only the page's own objects, so the device runner can send it into the app's web view as it is
|
|
2146
|
+
// (driver.execute(probe, ...args)) and the app's runner calls it directly. Nothing outside a probe may be used in it.
|
|
2147
|
+
/** Storage keys kept when a flow starts with empty app data: sign-in, tenant, project, accepted terms, the recorder, the runner's own. */
|
|
2148
|
+
const APP_DATA_KEEP = 'token|expires|nonce|pkce|session_state|keycloak|logined|granted_scopes|id_token|okta|tenant|project|terms|networkLogs|vl-test';
|
|
2149
|
+
/** Texts on the page still in the main language although the language file has them, or raw keys ("termsShowAgain"). */
|
|
2150
|
+
function probeUntranslated(texts, lang, main) {
|
|
2151
|
+
const doc = globalThis.document;
|
|
2152
|
+
const shown = (el) => { const r = el.getBoundingClientRect(); const s = getComputedStyle(el); return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none'; };
|
|
2153
|
+
const found = new Set();
|
|
2154
|
+
const walker = doc.createTreeWalker(doc.body, 4 /* NodeFilter.SHOW_TEXT */);
|
|
2155
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
2156
|
+
const el = node.parentElement;
|
|
2157
|
+
const t = String(node.textContent || '').trim();
|
|
2158
|
+
// a record's value is data, not a text of the app
|
|
2159
|
+
if (!el || !t || !shown(el) || el.closest('[data-vl-record] [data-vl-field] .vl-control__value, [data-vl-record] td, input, textarea, script, style'))
|
|
2160
|
+
continue;
|
|
2161
|
+
if (/^[a-z]+(?:[A-Z][a-z0-9]+)+$/.test(t))
|
|
2162
|
+
found.add(t);
|
|
2163
|
+
else if (lang !== main && texts[t] !== undefined && texts[t] !== t)
|
|
2164
|
+
found.add(t);
|
|
2165
|
+
}
|
|
2166
|
+
return [...found];
|
|
2167
|
+
}
|
|
2168
|
+
/** What the page shows, measured for the layout rules (layoutProblems): fields, buttons, texts with their boxes. */
|
|
2169
|
+
function probeLayoutSnapshot() {
|
|
2170
|
+
const doc = globalThis.document;
|
|
2171
|
+
const win = globalThis;
|
|
2172
|
+
const shown = (el) => { const r = el.getBoundingClientRect(); const s = getComputedStyle(el); return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none'; };
|
|
2173
|
+
const rowOf = (el) => {
|
|
2174
|
+
const parent = el.parentElement;
|
|
2175
|
+
if (!parent)
|
|
2176
|
+
return undefined;
|
|
2177
|
+
const cs = getComputedStyle(parent);
|
|
2178
|
+
return cs.display.includes('flex') && !cs.flexDirection.startsWith('column') && !cs.flexWrap.startsWith('wrap')
|
|
2179
|
+
? `${parent.tagName.toLowerCase()}#${[...(parent.parentElement?.children || [])].indexOf(parent)}` : undefined;
|
|
2180
|
+
};
|
|
2181
|
+
// areas that scroll sideways on their own (a wide table): what stands in them is reached by swiping there
|
|
2182
|
+
const scrollers = [];
|
|
2183
|
+
const scrollerOf = (el) => {
|
|
2184
|
+
for (let p = el.parentElement; p && p !== doc.body; p = p.parentElement) {
|
|
2185
|
+
const s = getComputedStyle(p);
|
|
2186
|
+
if (/(auto|scroll)/.test(s.overflowX) && p.scrollWidth > p.clientWidth + 2) {
|
|
2187
|
+
let known = scrollers.find((x) => x.el === p);
|
|
2188
|
+
if (!known) {
|
|
2189
|
+
const r = p.getBoundingClientRect();
|
|
2190
|
+
const name = p.closest('[data-vl-container]')?.getAttribute('data-vl-container') || (p.querySelector('table') ? 'table' : 'area');
|
|
2191
|
+
known = { el: p, name: `${name} ${scrollers.length + 1}`, left: r.left, right: r.right, content: p.scrollWidth, shown: p.clientWidth };
|
|
2192
|
+
scrollers.push(known);
|
|
2193
|
+
}
|
|
2194
|
+
return known.name;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
return undefined;
|
|
2198
|
+
};
|
|
2199
|
+
const boxes = [];
|
|
2200
|
+
for (const el of [...doc.querySelectorAll('[data-vl-field]')]) {
|
|
2201
|
+
if (!shown(el) || el.closest('[data-vl-record]'))
|
|
2202
|
+
continue;
|
|
2203
|
+
const r = el.getBoundingClientRect();
|
|
2204
|
+
boxes.push({ kind: 'field', name: el.getAttribute('data-vl-field') || '', left: r.left, top: r.top, right: r.right, bottom: r.bottom, row: rowOf(el), scroller: scrollerOf(el), inBar: !!el.closest('.vl-top-bar') });
|
|
2205
|
+
}
|
|
2206
|
+
for (const el of [...doc.querySelectorAll('[data-vl-action], button')]) {
|
|
2207
|
+
if (!shown(el) || el.closest('[data-vl-field], section[data-vl-custom-keyboard], .left-wrap'))
|
|
2208
|
+
continue;
|
|
2209
|
+
const r = el.getBoundingClientRect();
|
|
2210
|
+
boxes.push({ kind: 'button', name: el.getAttribute('data-vl-action') || String(el.innerText || '').trim().slice(0, 20), left: r.left, top: r.top, right: r.right, bottom: r.bottom, scroller: scrollerOf(el), inBar: !!el.closest('.vl-top-bar') });
|
|
2211
|
+
}
|
|
2212
|
+
for (const el of [...doc.querySelectorAll('label, .vl-control__label, .vl-control__value')]) {
|
|
2213
|
+
const t = String(el.innerText || '').trim();
|
|
2214
|
+
if (!t || !shown(el))
|
|
2215
|
+
continue;
|
|
2216
|
+
const r = el.getBoundingClientRect();
|
|
2217
|
+
const size = parseFloat(getComputedStyle(el).fontSize) || 14;
|
|
2218
|
+
boxes.push({ kind: 'text', name: t.slice(0, 20), left: r.left, top: r.top, right: r.right, bottom: r.bottom, charsPerLine: Math.floor(r.width / (size * 0.55)), scroller: scrollerOf(el) });
|
|
2219
|
+
}
|
|
2220
|
+
// the top bar (header + page X): where it stands, what it should do, and whether the page is scrolled
|
|
2221
|
+
const bar = doc.querySelector('.vl-top-bar');
|
|
2222
|
+
const page = doc.querySelector('.center-wrap');
|
|
2223
|
+
const header = bar && shown(bar) ? { top: bar.getBoundingClientRect().top, bottom: bar.getBoundingClientRect().bottom,
|
|
2224
|
+
scroll: bar.getAttribute('data-vl-header-scroll') || 'fixed', pageTop: page ? page.scrollTop : 0 } : undefined;
|
|
2225
|
+
// card lists with aligned rows (alignRows): per row of cards, the top of each card's first element with buttons
|
|
2226
|
+
const cardRows = [];
|
|
2227
|
+
for (const grid of [...doc.querySelectorAll('.vl-cards--aligned')]) {
|
|
2228
|
+
const rows = new Map();
|
|
2229
|
+
for (const card of [...grid.children].filter((c) => shown(c))) {
|
|
2230
|
+
const action = card.querySelector('.card-layout-item--action');
|
|
2231
|
+
if (!action || !shown(action))
|
|
2232
|
+
continue;
|
|
2233
|
+
const top = Math.round(card.getBoundingClientRect().top);
|
|
2234
|
+
const key = [...rows.keys()].find((k) => Math.abs(k - top) <= 2) ?? top;
|
|
2235
|
+
rows.set(key, [...(rows.get(key) || []), action.getBoundingClientRect().top]);
|
|
2236
|
+
}
|
|
2237
|
+
for (const tops of rows.values())
|
|
2238
|
+
if (tops.length > 1)
|
|
2239
|
+
cardRows.push(tops);
|
|
2240
|
+
}
|
|
2241
|
+
return { width: win.innerWidth, height: win.innerHeight, scrollsSideways: doc.documentElement.scrollWidth > win.innerWidth + 2, boxes,
|
|
2242
|
+
scrollers: scrollers.map(({ el, ...s }) => s), header, cardRows };
|
|
2243
|
+
}
|
|
2244
|
+
/** Whether a field (data-vl-path with a dot, else data-vl-field) stands visible above an open keyboard: '' or why not. */
|
|
2245
|
+
function probeFieldVisible(key) {
|
|
2246
|
+
const doc = globalThis.document;
|
|
2247
|
+
const win = globalThis;
|
|
2248
|
+
const shown = (el) => { const r = el.getBoundingClientRect(); const s = getComputedStyle(el); return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none'; };
|
|
2249
|
+
const esc = (v) => String(v).replace(/["\\]/g, '\\$&');
|
|
2250
|
+
const all = [...doc.querySelectorAll(key.includes('.') ? `[data-vl-path="${esc(key)}"]` : `[data-vl-field="${esc(key)}"]`)].filter(shown);
|
|
2251
|
+
const w = all[all.length - 1];
|
|
2252
|
+
if (!w)
|
|
2253
|
+
return 'not there';
|
|
2254
|
+
const r = w.getBoundingClientRect();
|
|
2255
|
+
const kbEl = doc.querySelector('section[data-vl-custom-keyboard]');
|
|
2256
|
+
const kb = kbEl && shown(kbEl) ? kbEl.getBoundingClientRect() : null;
|
|
2257
|
+
if (r.top < 0)
|
|
2258
|
+
return `above the frame (${Math.round(r.top)})`;
|
|
2259
|
+
// covered only where field and keyboard overlap - in landscape the keyboard stands beside the page, not below it
|
|
2260
|
+
const overlapX = kb ? Math.min(r.right, kb.right) - Math.max(r.left, kb.left) > 1 : false;
|
|
2261
|
+
if (kb && overlapX && r.bottom > kb.top + 1)
|
|
2262
|
+
return `covered by the keyboard (field to ${Math.round(r.bottom)}, keyboard from ${Math.round(kb.top)})`;
|
|
2263
|
+
if (r.bottom > win.innerHeight + 1)
|
|
2264
|
+
return `below the frame (${Math.round(r.bottom)} of ${win.innerHeight})`;
|
|
2265
|
+
return '';
|
|
2266
|
+
}
|
|
2267
|
+
/** Where the page stands: the window's and the scrolling content's place, the page's height (expect restored). */
|
|
2268
|
+
function probePagePlace() {
|
|
2269
|
+
const doc = globalThis.document;
|
|
2270
|
+
const win = globalThis;
|
|
2271
|
+
const box = [...doc.querySelectorAll('.ant-layout-content, .layout-content, .center-wrap, main, .p-dialog-content')].find((el) => el.scrollHeight > el.clientHeight + 2);
|
|
2272
|
+
return { scrollY: win.scrollY, scrollTop: box ? box.scrollTop : 0, height: doc.documentElement.scrollHeight };
|
|
2273
|
+
}
|
|
2274
|
+
/** The app's data in the browser (local and session), without what is kept (keep: APP_DATA_KEEP) - put back after a flow. */
|
|
2275
|
+
function probeStorageSnapshot(keep) {
|
|
2276
|
+
const win = globalThis;
|
|
2277
|
+
const kept = new RegExp(keep, 'i');
|
|
2278
|
+
const copy = (store) => Object.keys(store).filter((k) => !kept.test(k)).map((k) => [k, store.getItem(k)]);
|
|
2279
|
+
return { local: copy(win.localStorage), session: copy(win.sessionStorage) };
|
|
2280
|
+
}
|
|
2281
|
+
/** Empties the app's data in the browser (not what is kept); true when something was removed. */
|
|
2282
|
+
function probeClearAppData(keep) {
|
|
2283
|
+
const win = globalThis;
|
|
2284
|
+
const kept = new RegExp(keep, 'i');
|
|
2285
|
+
let changed = false;
|
|
2286
|
+
for (const store of [win.localStorage, win.sessionStorage]) {
|
|
2287
|
+
for (const key of Object.keys(store)) {
|
|
2288
|
+
if (kept.test(key))
|
|
2289
|
+
continue;
|
|
2290
|
+
store.removeItem(key);
|
|
2291
|
+
changed = true;
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
return changed;
|
|
2295
|
+
}
|
|
2296
|
+
/** Puts the app's data back as it was before the flow (probeStorageSnapshot); true when something had changed. */
|
|
2297
|
+
function probeRestoreStorage(snapshot, keep) {
|
|
2298
|
+
const win = globalThis;
|
|
2299
|
+
const kept = new RegExp(keep, 'i');
|
|
2300
|
+
let changed = false;
|
|
2301
|
+
const put = (store, before) => {
|
|
2302
|
+
const was = new Map(before);
|
|
2303
|
+
for (const key of Object.keys(store)) {
|
|
2304
|
+
if (kept.test(key) || was.has(key))
|
|
2305
|
+
continue;
|
|
2306
|
+
store.removeItem(key);
|
|
2307
|
+
changed = true;
|
|
2308
|
+
}
|
|
2309
|
+
for (const [key, value] of was) {
|
|
2310
|
+
if (store.getItem(key) !== value) {
|
|
2311
|
+
store.setItem(key, value);
|
|
2312
|
+
changed = true;
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
put(win.localStorage, snapshot.local);
|
|
2317
|
+
put(win.sessionStorage, snapshot.session);
|
|
2318
|
+
return changed;
|
|
2319
|
+
}
|
|
2320
|
+
/** The parts that must stay inside the screen (expect inFrame), as selectors of the page. */
|
|
2321
|
+
const FRAME_SELECTORS = {
|
|
2322
|
+
keyboard: 'section[data-vl-custom-keyboard]',
|
|
2323
|
+
dialog: '.ant-modal-content, .p-dialog, .cdk-overlay-pane .modal-content',
|
|
2324
|
+
calendar: '.p-datepicker-panel, .p-datepicker:not(.p-datepicker-inline) .p-datepicker-calendar-container',
|
|
2325
|
+
list: '.p-autocomplete-overlay, .p-select-overlay',
|
|
2326
|
+
menu: '.left-wrap',
|
|
2327
|
+
};
|
|
2328
|
+
/** A frame part (its selector from FRAME_SELECTORS): null when not shown, else whether it stays inside the screen and its box. */
|
|
2329
|
+
function probeInFrame(selector) {
|
|
2330
|
+
const doc = globalThis.document;
|
|
2331
|
+
const win = globalThis;
|
|
2332
|
+
const shown = (el) => { const r = el.getBoundingClientRect(); const s = getComputedStyle(el); return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none'; };
|
|
2333
|
+
const all = [...doc.querySelectorAll(selector)].filter(shown);
|
|
2334
|
+
const el = all[all.length - 1];
|
|
2335
|
+
if (!el)
|
|
2336
|
+
return null;
|
|
2337
|
+
const b = el.getBoundingClientRect();
|
|
2338
|
+
return { in: b.top >= -1 && b.left >= -1 && b.bottom <= win.innerHeight + 1 && b.right <= win.innerWidth + 1,
|
|
2339
|
+
box: [Math.round(b.left), Math.round(b.top), Math.round(b.right), Math.round(b.bottom)], width: win.innerWidth, height: win.innerHeight };
|
|
2340
|
+
}
|
|
2341
|
+
/**
|
|
2342
|
+
* A field as tests name it (data-vl-path with a dot, else data-vl-field; only shown ones; a key in two DTOs on the page
|
|
2343
|
+
* is ambiguous): what it shows and whether it is locked. null when not there; { ambiguous } when the key is not enough.
|
|
2344
|
+
*/
|
|
2345
|
+
function probeField(key) {
|
|
2346
|
+
const doc = globalThis.document;
|
|
2347
|
+
const shown = (el) => { const r = el.getBoundingClientRect(); const s = getComputedStyle(el); return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none'; };
|
|
2348
|
+
const esc = (v) => String(v).replace(/["\\]/g, '\\$&');
|
|
2349
|
+
let w;
|
|
2350
|
+
if (key.includes('.')) {
|
|
2351
|
+
const all = [...doc.querySelectorAll(`[data-vl-path="${esc(key)}"]`)].filter(shown);
|
|
2352
|
+
w = all[all.length - 1];
|
|
2353
|
+
}
|
|
2354
|
+
else {
|
|
2355
|
+
const all = [...doc.querySelectorAll(`[data-vl-field="${esc(key)}"]`)].filter(shown);
|
|
2356
|
+
const paths = [...new Set(all.map((el) => el.getAttribute('data-vl-path')).filter(Boolean))];
|
|
2357
|
+
if (paths.length > 1)
|
|
2358
|
+
return { ambiguous: paths };
|
|
2359
|
+
w = all[all.length - 1];
|
|
2360
|
+
}
|
|
2361
|
+
if (!w)
|
|
2362
|
+
return null;
|
|
2363
|
+
const i = w.querySelector('input:not([type=hidden]), textarea');
|
|
2364
|
+
const locked = !i || i.disabled || i.readOnly || !!w.querySelector('.p-disabled, [aria-disabled=true]');
|
|
2365
|
+
return { text: i ? String(i.value) : String((w.querySelector('.p-select-label, .p-select') || w).innerText || '').trim(), locked };
|
|
2366
|
+
}
|
|
1455
2367
|
|
|
2368
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-30
|
|
2369
|
+
// - new: the action catalog - what / where / how of a storage or backend call (OFFENE-PUNKTE 144)
|
|
1456
2370
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-23
|
|
1457
2371
|
// - new: the app settings catalog - Login, Pagination, Terms & Conditions of Main (#166)
|
|
1458
2372
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-19
|
|
@@ -1465,5 +2379,5 @@ function appSettingsMenu(menu, center, context = {}) {
|
|
|
1465
2379
|
* Generated bundle index. Do not edit.
|
|
1466
2380
|
*/
|
|
1467
2381
|
|
|
1468
|
-
export { APP_SETTINGS, APP_SETTINGS_PATH, APP_SETTING_BLOCKS, BASIC_TYPES, CARD_LAYOUTS, CONTROLS, CONTROL_TYPES, DATA_FORMATS, DATA_OBJECT_KEYS, DATA_OBJECT_NAME_PLACES, DATA_OBJECT_PLACES, DEFAULT_DEVICES, DISPLAY_FORMATS, DOCUMENT_KINDS, EXPECT_KINDS, FRAME_PARTS, KEYBOARD_CONTROLS, KEYBOARD_TYPES, LIST_STATES, LOGIN_FLAGS, LOGIN_METHODS, LOGIN_STORAGES, LOGIN_WHEN, MENU_DECIDED_BY, MENU_ENTRY_KINDS, MENU_SWITCHABLE, NUMBER_STYLES, ORIENTATIONS, PAGINATION_ALIGNS, PAGINATION_PLACEMENTS, PAGINATION_TYPES, PLACEHOLDER_CONTROLS, RESULTS_DIR, RESULTS_KEEP, SETTING_MENU_TEXTS, START_PAGE_KEYS, START_PAGE_PATH, STEP_KINDS, SYSTEM_KEYBOARDS, TEMPORAL_TRANSFER, TERMS_DOCUMENTS, TESTS_DIR, TEST_DATA_FILE, TEST_DEVICES, TYPE_ALIASES, appSettingsMenu, assertFieldSettings, baseType, basicType, canonicalControl, cardLayoutOf, checkAppSettings, checkPagePagination, checkTestFlow, clone, controlChoicesFor, controlsFor, dataSettings, defaultKeyboard, displaySettings, effectiveControl, effectiveFormat, flowDevices, keyboardFor, languageName, loginMethod, normalizeFormat, pageOf, paginationFor, parseDevice, readAppSettings, renameDataObject, resolveProperty, resultsToDelete, rolesOf, rulesFor, startPage, startPageFor, stepKind, temporalPart, testDataRefs, validateSettings, validationSettings, withTestData };
|
|
2382
|
+
export { APP_DATA_KEEP, APP_SETTINGS, APP_SETTINGS_PATH, APP_SETTING_BLOCKS, BASIC_TYPES, BROWSER_STORAGES, CALL_KEYS, CALL_KINDS, CARD_LAYOUTS, CONTROLS, CONTROL_TYPES, DATA_FORMATS, DATA_OBJECT_KEYS, DATA_OBJECT_NAME_PLACES, DATA_OBJECT_PLACES, DEFAULT_DEVICES, DISPLAY_FORMATS, DOCUMENT_KINDS, ENTER_KEYS, EXPECT_KINDS, FORMATS, FRAME_PARTS, FRAME_SELECTORS, HEADER_SCROLLS, KEYBOARD_CONTROLS, KEYBOARD_TYPES, LIST_STATES, LOGIN_FLAGS, LOGIN_METHODS, LOGIN_STORAGES, LOGIN_WHEN, MENU_DECIDED_BY, MENU_ENTRY_KINDS, MENU_SWITCHABLE, NO_CALL_ACTIONS, NUMBER_STYLES, OLD_CALL_KEYS, OLD_DEVICE_NAMES, OLD_STORAGES, ORIENTATIONS, PAGINATION_ALIGNS, PAGINATION_PLACEMENTS, PAGINATION_TYPES, PLACEHOLDER_CONTROLS, PLACEHOLDER_SOURCE, RESULTS_DIR, RESULTS_KEEP, RTL_LANGUAGES, SETTING_MENU_TEXTS, SHOWN_TEXT_KEYS, START_PAGE_KEYS, START_PAGE_PATH, STEP_KINDS, STORAGES, SYSTEM_KEYBOARDS, TEMPORAL_TRANSFER, TERMS_DOCUMENTS, TESTS_DIR, TEST_DATA_FILE, TEST_DEVICES, TEST_TEMPOS, TYPE_ALIASES, alignRowsOf, appSettingsMenu, assertFieldSettings, base32Bytes, baseType, basicType, callAttributes, callKindOf, canonicalControl, cardLayoutOf, checkAppSettings, checkCall, checkPagePagination, checkTestFlow, clone, controlChoicesFor, controlsFor, dataSettings, dateOrder, defaultKeyboard, deviceChoices, displaySettings, effectiveControl, effectiveFormat, enterKeyFor, flowDevices, flowLanguages, headerScrollOf, keyboardFor, languageName, layoutNotes, layoutProblems, localeKeys, localeRenderings, loginMethod, matchesTemplate, maxLinesOf, menuCaption, menuEntries, menuEntryByCaption, menuEntryForPage, menuPage, methodOf, normalizeFormat, pageOf, paginationFor, parseDevice, probeClearAppData, probeField, probeFieldVisible, probeInFrame, probeLayoutSnapshot, probePagePlace, probeRestoreStorage, probeStorageSnapshot, probeUntranslated, readAppSettings, readTestUser, renameDataObject, resolveProperty, resultsToDelete, rolesOf, rulesFor, startPage, startPageFor, stepKind, storageOf, successMessageOf, tempoPause, temporalPart, testDataRefs, testUserEntry, totp, translateCaptions, uses12Hours, validateSettings, validationSettings, vaultJwtLogin, vaultPlace, waitsForFilter, withTestData };
|
|
1469
2383
|
//# sourceMappingURL=yomotech-view-toolkit-catalog.mjs.map
|