@yomotech/view-toolkit 1.0.58 → 1.0.64
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 +481 -6
- package/fesm2022/yomotech-view-toolkit-catalog.mjs.map +1 -1
- package/fesm2022/yomotech-view-toolkit.mjs +857 -113
- package/fesm2022/yomotech-view-toolkit.mjs.map +1 -1
- package/package.json +1 -1
- package/types/yomotech-view-toolkit-catalog.d.ts +148 -3
- package/types/yomotech-view-toolkit.d.ts +113 -13
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-09
|
|
2
|
+
// - new: control price for a text field - a price as data (option.amount, currency, from; 213/36)
|
|
3
|
+
// - new: control map for a text field - where the business is (option.lat, option.lon, option.address, option.zoom;
|
|
4
|
+
// point 213 worklist 42, 2026-11-09)
|
|
5
|
+
// - new: control openingHours for a text field - the week's opening times (option.hours, option.timeZone)
|
|
6
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-07
|
|
7
|
+
// - new: control textBlock for a text - its caption (and value) as a paragraph, no box (point 213 worklist 15a)
|
|
1
8
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-02
|
|
2
9
|
// - new: display style iso for date fields - 2026-10-30 (with time 14:00) in every language (OFFENE-PUNKTE 80)
|
|
3
10
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
@@ -91,6 +98,9 @@ function controlsFor(schema, fallback, option) {
|
|
|
91
98
|
// a period from - to, stored as the pair [from, to] (#166 E4)
|
|
92
99
|
else if (declared === 'daterange')
|
|
93
100
|
values = ['dateRangepicker'];
|
|
101
|
+
// a picture, or several changing by themselves (2026-11-07, worklist 213 15c)
|
|
102
|
+
else if (declared === 'media' || declared === 'image')
|
|
103
|
+
values = ['image', 'slideshow'];
|
|
94
104
|
else if (f === 'flag' || t === 'boolean')
|
|
95
105
|
values = ['checkbox', 'switch', 'radiobutton'];
|
|
96
106
|
else if (f === 'iso-date')
|
|
@@ -106,12 +116,12 @@ function controlsFor(schema, fallback, option) {
|
|
|
106
116
|
else if (r.enum)
|
|
107
117
|
values = ['dropdown', 'radiobutton', 'combobox', 'autocomplete'];
|
|
108
118
|
else if (t === 'string')
|
|
109
|
-
values = ['textInput', 'textArea', 'password', 'combobox', 'autocomplete', 'email'];
|
|
119
|
+
values = ['textInput', 'textArea', 'password', 'combobox', 'autocomplete', 'email', 'textBlock', 'openingHours', 'map', 'price'];
|
|
110
120
|
else if (t === 'integer' || t === 'number')
|
|
111
121
|
values = ['textInput', 'spinner', 'slider'];
|
|
112
122
|
if (values.length)
|
|
113
123
|
values.push('output');
|
|
114
|
-
const labels = { textInput: 'Text field', textArea: 'Text area', dateTimepicker: 'Date and time picker', dateRangepicker: 'Date range picker', radiobutton: 'Radio buttons', datepicker: 'Date picker', timepicker: 'Time picker', output: 'Read-only output', creditCard: 'Credit card', quantity: 'Quantity' };
|
|
124
|
+
const labels = { textInput: 'Text field', textArea: 'Text area', dateTimepicker: 'Date and time picker', dateRangepicker: 'Date range picker', radiobutton: 'Radio buttons', datepicker: 'Date picker', timepicker: 'Time picker', output: 'Read-only output', creditCard: 'Credit card', quantity: 'Quantity', textBlock: 'Text block', image: 'Image', slideshow: 'Slideshow', openingHours: 'Opening hours', map: 'Map', price: 'Price' };
|
|
115
125
|
return values.map(value => ({ value, label: labels[value] || value[0].toUpperCase() + value.slice(1) }));
|
|
116
126
|
}
|
|
117
127
|
/**
|
|
@@ -145,7 +155,7 @@ function controlChoicesFor(schema, fallback, option) {
|
|
|
145
155
|
}
|
|
146
156
|
/** A control with its label as the catalog names it. */
|
|
147
157
|
function controlLabel(value) {
|
|
148
|
-
const labels = { textInput: 'Text field', textArea: 'Text area', dateTimepicker: 'Date and time picker', dateRangepicker: 'Date range picker', radiobutton: 'Radio buttons', datepicker: 'Date picker', timepicker: 'Time picker', output: 'Read-only output', creditCard: 'Credit card', quantity: 'Quantity' };
|
|
158
|
+
const labels = { textInput: 'Text field', textArea: 'Text area', dateTimepicker: 'Date and time picker', dateRangepicker: 'Date range picker', radiobutton: 'Radio buttons', datepicker: 'Date picker', timepicker: 'Time picker', output: 'Read-only output', creditCard: 'Credit card', quantity: 'Quantity', textBlock: 'Text block', image: 'Image', slideshow: 'Slideshow', openingHours: 'Opening hours', map: 'Map', price: 'Price' };
|
|
149
159
|
return { value, label: labels[value] || value[0].toUpperCase() + value.slice(1) };
|
|
150
160
|
}
|
|
151
161
|
const canonicalControl = (c) => ({ textfield: 'textInput', textarea: 'textArea', radioButton: 'radiobutton', datetimepicker: 'dateTimepicker', daterangepicker: 'dateRangepicker', date: 'datepicker', time: 'timepicker' }[c] || c);
|
|
@@ -273,6 +283,9 @@ function effectiveControl(option, schema = {}, fallback = '') {
|
|
|
273
283
|
const o = option || {};
|
|
274
284
|
if (o.control)
|
|
275
285
|
return canonicalControl(o.control);
|
|
286
|
+
// a picture without a control stays as before (''): the slideshow only when chosen
|
|
287
|
+
if (['media', 'image'].includes(String(schema?.type || fallback || '').toLowerCase()))
|
|
288
|
+
return '';
|
|
276
289
|
const allowed = controlsFor(schema || {}, fallback, o).map(c => c.value);
|
|
277
290
|
const legacy = o.password ? 'password' : o.email ? 'email' : o.timeOnly ? 'timepicker' : '';
|
|
278
291
|
if (legacy && allowed.includes(legacy))
|
|
@@ -685,6 +698,8 @@ function alignRowsOf(center) {
|
|
|
685
698
|
return center?.option?.alignRows === true;
|
|
686
699
|
}
|
|
687
700
|
|
|
701
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-07
|
|
702
|
+
// - new: simulatorOnly - a flow that only the simulators run, the preview leaves it out (point 204, user)
|
|
688
703
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-05
|
|
689
704
|
// - new: step goToPage - a list with page numbers (point 186)
|
|
690
705
|
// - new: step ifRecords, checks listLoaded and pdf - a list of live data may be empty, the PDF viewer (point 186)
|
|
@@ -1127,6 +1142,8 @@ function checkTestFlow(flow, data) {
|
|
|
1127
1142
|
add('nameMissing');
|
|
1128
1143
|
if (flow.books !== undefined && typeof flow.books !== 'boolean')
|
|
1129
1144
|
add('booksNotBoolean');
|
|
1145
|
+
if (flow.simulatorOnly !== undefined && typeof flow.simulatorOnly !== 'boolean')
|
|
1146
|
+
add('simulatorOnlyNotBoolean');
|
|
1130
1147
|
if (flow.languages !== undefined && flow.languages !== 'all'
|
|
1131
1148
|
&& !(Array.isArray(flow.languages) && flow.languages.every((l) => /^[a-z]{2}$/i.test(String(l)))))
|
|
1132
1149
|
add('languagesInvalid');
|
|
@@ -1378,6 +1395,9 @@ async function readTestUser(fetchFn, addr, token, mount, path) {
|
|
|
1378
1395
|
tenantKey: data.tenantKey ? String(data.tenantKey) : undefined };
|
|
1379
1396
|
}
|
|
1380
1397
|
|
|
1398
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-08
|
|
1399
|
+
// - new: appSettings.menu.style - folder (default) or footer: languages as buttons, imprint / privacy / terms as links
|
|
1400
|
+
// and the version at the foot of the side menu (appSettingsFooter); the rest stays in the folder (point 213)
|
|
1381
1401
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-01
|
|
1382
1402
|
// - new: HEADER_SCROLLS, headerScrollOf - what the header does when the page scrolls (header.option.scroll):
|
|
1383
1403
|
// fixed (default), hideOnScroll (away while scrolling down, back at once when scrolling up), scrollsAlong
|
|
@@ -1421,6 +1441,8 @@ async function readTestUser(fetchFn, addr, token, mount, path) {
|
|
|
1421
1441
|
// center.option (keycloakLogin / oktaLogin / jwtLogin) when the sign-in is required at the start
|
|
1422
1442
|
// It only describes, reads and checks; nothing renders from it yet.
|
|
1423
1443
|
/** The building blocks of the app settings in Main, in the order they are shown. */
|
|
1444
|
+
/** How the setting entries stand in the side menu: a folder at the end, or a foot of the menu. */
|
|
1445
|
+
const MENU_STYLES = ['folder', 'footer'];
|
|
1424
1446
|
const APP_SETTING_BLOCKS = ['startPage', 'login', 'pagination', 'terms', 'menu'];
|
|
1425
1447
|
/** The entries the library may add to the side menu, in their default order (appSettings.menu.entries). */
|
|
1426
1448
|
const MENU_ENTRY_KINDS = ['home', 'languages', 'login', 'paginationType', 'terms', 'projectVersion'];
|
|
@@ -1489,6 +1511,7 @@ const APP_SETTINGS = [
|
|
|
1489
1511
|
{ block: 'terms', key: 'terms.backend.acceptUrl', kind: 'text', default: '' },
|
|
1490
1512
|
// the folder of the entries the library adds - its caption is a text of the app like any caption
|
|
1491
1513
|
{ block: 'menu', key: 'menu.caption', kind: 'text', default: 'Setting' },
|
|
1514
|
+
{ block: 'menu', key: 'menu.style', kind: 'choice', values: MENU_STYLES, default: 'folder' },
|
|
1492
1515
|
{ block: 'menu', key: 'menu.entries', kind: 'entries', values: MENU_ENTRY_KINDS, default: MENU_ENTRY_KINDS.map(kind => ({ kind, on: true, caption: '' })) },
|
|
1493
1516
|
];
|
|
1494
1517
|
const defaultOf = (key) => APP_SETTINGS.find(s => s.key === key)?.default;
|
|
@@ -1666,7 +1689,7 @@ function readMenu(raw) {
|
|
|
1666
1689
|
for (const kind of MENU_ENTRY_KINDS)
|
|
1667
1690
|
if (!entries.some(e => e.kind === kind))
|
|
1668
1691
|
entries.push({ kind, on: true, caption: '' });
|
|
1669
|
-
return { caption, entries };
|
|
1692
|
+
return { caption, style: isIn(MENU_STYLES, raw?.style) ? raw.style : 'folder', entries };
|
|
1670
1693
|
}
|
|
1671
1694
|
const LAYOUT_URL = /^pages\/.+\/layout_schema\.json$/;
|
|
1672
1695
|
/** What is wrong with a page description (start page, role page, page before the sign-in). */
|
|
@@ -1805,6 +1828,8 @@ function checkAppSettings(layout, environment) {
|
|
|
1805
1828
|
problems.push({ code: 'notAText', key: 'menu.caption' });
|
|
1806
1829
|
if (menu.entries !== undefined && !Array.isArray(menu.entries))
|
|
1807
1830
|
problems.push({ code: 'notAList', key: 'menu.entries' });
|
|
1831
|
+
if (menu.style !== undefined && !isIn(MENU_STYLES, menu.style))
|
|
1832
|
+
problems.push({ code: 'unknownValue', key: 'menu.style' });
|
|
1808
1833
|
const seen = new Set();
|
|
1809
1834
|
for (const [i, entry] of (Array.isArray(menu.entries) ? menu.entries : []).entries()) {
|
|
1810
1835
|
const key = `menu.entries.${i}`;
|
|
@@ -1893,7 +1918,10 @@ function appSettingsMenu(menu, center, context = {}) {
|
|
|
1893
1918
|
projectVersion: () => entry(t.projectVersion, 'info-circle', { projectVersion: true }),
|
|
1894
1919
|
};
|
|
1895
1920
|
// an entry's own caption (Main) wins over the fixed text; it is a text of the app like any caption
|
|
1896
|
-
|
|
1921
|
+
// footer: languages, terms and the version stand at the foot of the menu (appSettingsFooter); home is the menu's
|
|
1922
|
+
// own start entry there - only sign-in and paging stay in the folder, when they apply
|
|
1923
|
+
const inFooter = new Set(settings.menu.style === 'footer' ? ['languages', 'terms', 'projectVersion', 'home'] : []);
|
|
1924
|
+
const added = settings.menu.entries.filter(e => e.on && !inFooter.has(e.kind)).map(e => {
|
|
1897
1925
|
const item = build[e.kind]();
|
|
1898
1926
|
return item && e.caption ? { ...item, label: { ...item.label, caption: e.caption } } : item;
|
|
1899
1927
|
}).filter(Boolean);
|
|
@@ -1907,6 +1935,24 @@ function appSettingsMenu(menu, center, context = {}) {
|
|
|
1907
1935
|
}
|
|
1908
1936
|
return [...items, { label: { caption }, icon: 'setting', option: { visible: true }, submenu: added }];
|
|
1909
1937
|
}
|
|
1938
|
+
/** The foot of the side menu for menu.style footer; null for the folder or without app settings. */
|
|
1939
|
+
function appSettingsFooter(center, context = {}) {
|
|
1940
|
+
if (!isObject(center?.appSettings))
|
|
1941
|
+
return null;
|
|
1942
|
+
const settings = readAppSettings({ center });
|
|
1943
|
+
if (settings.menu.style !== 'footer')
|
|
1944
|
+
return null;
|
|
1945
|
+
const on = (kind) => settings.menu.entries.find(e => e.kind === kind)?.on !== false;
|
|
1946
|
+
const own = (kind) => settings.menu.entries.find(e => e.kind === kind)?.caption || '';
|
|
1947
|
+
const languages = on('languages') ? [...new Set(context.languages ?? [])] : [];
|
|
1948
|
+
const t = SETTING_MENU_TEXTS;
|
|
1949
|
+
return {
|
|
1950
|
+
languages: languages.length > 1 ? languages.map(code => ({ code, name: languageName(code), option: { changeLang: true, data_url: `${code}.json` } })) : [],
|
|
1951
|
+
documents: settings.terms.enabled ? TERMS_DOCUMENTS.filter(name => settings.terms.documents[name])
|
|
1952
|
+
.map(name => ({ name, caption: t[name], option: { terms: true, document: { ...settings.terms.documents[name] } } })) : [],
|
|
1953
|
+
version: on('projectVersion'),
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1910
1956
|
// ---------------------------------------------------------------- finding a menu entry (2026-10-31)
|
|
1911
1957
|
// One way for the app's test runner and the device runner (before: three, searching to different depths and
|
|
1912
1958
|
// reading the caption differently - a page under elements / children was not found by the device runner).
|
|
@@ -1960,6 +2006,10 @@ function headerScrollOf(header) {
|
|
|
1960
2006
|
return HEADER_SCROLLS.includes(own) ? own : 'fixed';
|
|
1961
2007
|
}
|
|
1962
2008
|
|
|
2009
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-07
|
|
2010
|
+
// - change: route opens the directions from where the user is, not only the place (point 213 worklist 41, 2026-11-09)
|
|
2011
|
+
// - new: innerAction contact - phone, WhatsApp, e-mail, SMS, route, web on the user's device (contactLink, CONTACT_KINDS;
|
|
2012
|
+
// point 213 worklist 16)
|
|
1963
2013
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-03
|
|
1964
2014
|
// - new: convertOlderForms - an app's pages and Main written in the new form (OFFENE-PUNKTE 105/145 step 5): every
|
|
1965
2015
|
// element's action as withElementAction writes it, a menu entry's call moved into its page (dataSource) when that
|
|
@@ -2172,7 +2222,46 @@ const INNER_ACTIONS = {
|
|
|
2172
2222
|
cart: { does: 'Shows the cart.', places: ['button', 'menu'], keys: [] },
|
|
2173
2223
|
copy: { does: 'Copies the values of one data object into another, e.g. the shipping address into the billing address.', places: ['field'], keys: ['from', 'to'] },
|
|
2174
2224
|
calculate: { does: 'Shows a value calculated from fields of the record, e.g. quantity × price.', places: ['column'], keys: ['operator', 'fields'] },
|
|
2225
|
+
contact: { does: 'Opens the phone, WhatsApp, e-mail, SMS, a route in the maps app or a web page on the user\'s device - the app sends nothing itself. contactKind: phone | whatsapp | email | sms | route | web; contactValue: the number (WhatsApp with its country code, e.g. +49 221 1234567), the e-mail address, the street address or the web address; contactText (optional): a prepared message or subject.', places: ['button', 'menu'], keys: ['contactKind', 'contactValue', 'contactText'] },
|
|
2226
|
+
};
|
|
2227
|
+
/** The kinds of the action contact (2026-11-07, point 213 worklist 16). */
|
|
2228
|
+
const CONTACT_KINDS = ['phone', 'whatsapp', 'email', 'sms', 'route', 'web'];
|
|
2229
|
+
/** The icon a contact button shows when it names none itself (ant-design names; the app registers them). */
|
|
2230
|
+
const CONTACT_ICONS = {
|
|
2231
|
+
phone: 'phone', whatsapp: 'whats-app', email: 'mail', sms: 'message', route: 'environment', web: 'global',
|
|
2175
2232
|
};
|
|
2233
|
+
/**
|
|
2234
|
+
* The link the action contact opens, or '' when the value does not fit the kind:
|
|
2235
|
+
* phone tel:, whatsapp https://wa.me/<digits> (country code needed), email mailto:, sms sms:, route the directions in the maps app (from where the user is),
|
|
2236
|
+
* web an http(s) address. A message (contactText) goes with WhatsApp, e-mail (subject) and SMS.
|
|
2237
|
+
*/
|
|
2238
|
+
function contactLink(kind, value, text) {
|
|
2239
|
+
const v = String(value ?? '').trim();
|
|
2240
|
+
const t = String(text ?? '').trim();
|
|
2241
|
+
if (!v)
|
|
2242
|
+
return '';
|
|
2243
|
+
const digits = v.replace(/[^\d+]/g, '');
|
|
2244
|
+
switch (kind) {
|
|
2245
|
+
case 'phone':
|
|
2246
|
+
return /^\+?\d{3,}$/.test(digits) ? `tel:${digits}` : '';
|
|
2247
|
+
case 'sms':
|
|
2248
|
+
return /^\+?\d{3,}$/.test(digits) ? `sms:${digits}${t ? `?&body=${encodeURIComponent(t)}` : ''}` : '';
|
|
2249
|
+
case 'whatsapp': {
|
|
2250
|
+
// wa.me takes the international number without + and without leading zeros: +49 221 … -> 49221…
|
|
2251
|
+
const intl = digits.startsWith('+') ? digits.slice(1) : digits.startsWith('00') ? digits.slice(2) : '';
|
|
2252
|
+
return /^\d{6,}$/.test(intl) ? `https://wa.me/${intl}${t ? `?text=${encodeURIComponent(t)}` : ''}` : '';
|
|
2253
|
+
}
|
|
2254
|
+
case 'email':
|
|
2255
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) ? `mailto:${v}${t ? `?subject=${encodeURIComponent(t)}` : ''}` : '';
|
|
2256
|
+
case 'route':
|
|
2257
|
+
// directions from where the user is (point 213 / 41): the maps app on the phone, Google Maps in a browser
|
|
2258
|
+
return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(v)}`;
|
|
2259
|
+
case 'web':
|
|
2260
|
+
return /^https?:\/\/[^\s]+$/i.test(v) ? v : '';
|
|
2261
|
+
default:
|
|
2262
|
+
return '';
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2176
2265
|
/** Actions that call the backend - each with its kind of call (CALL_KINDS). */
|
|
2177
2266
|
const BACKEND_ACTIONS = {
|
|
2178
2267
|
save: { does: 'Saves the record.', places: ['button'], keys: [], kind: 'save' },
|
|
@@ -2855,6 +2944,392 @@ function visitStyles(node, path, visit) {
|
|
|
2855
2944
|
}
|
|
2856
2945
|
}
|
|
2857
2946
|
|
|
2947
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-09
|
|
2948
|
+
// - fix: an app's own menu colours bring the derived ones (muted text, hover, divider) - the theme's stayed on a light menu
|
|
2949
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-08
|
|
2950
|
+
// - new: THEME_FONTS - the fonts an app brings along (latin, no loading from Google - user 2026-11-08), themeFontKnown -
|
|
2951
|
+
// font.family / font.heading-family name one of them first (point 213, worklist 22 step 2)
|
|
2952
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-07
|
|
2953
|
+
// - new: an app's own design values over its theme (themeVariables(id, own), safeDesignValues, isSafeDesignValue)
|
|
2954
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-06
|
|
2955
|
+
// - new: four seasonal standard themes: autumn 2026, winter 2026, spring 2027, summer 2027 (point 173)
|
|
2956
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-05
|
|
2957
|
+
// - new: the design values of an app's look (point 173) - the one list for the library's styles, the Designer and the
|
|
2958
|
+
// AI contract. Two levels: "basic" is what a person chooses, "advanced" follows from the basic values (from) unless
|
|
2959
|
+
// a theme sets it. A style uses var(--vl-..., today's value): without a theme an app looks as before.
|
|
2960
|
+
// - new: STANDARD_THEMES, themeVariables - the platform's themes; an app names one in center.theme of Main
|
|
2961
|
+
const value = (key, group, kind, from) => ({
|
|
2962
|
+
key,
|
|
2963
|
+
cssVar: `--vl-${key.replace(/\./g, '-')}`,
|
|
2964
|
+
group,
|
|
2965
|
+
kind,
|
|
2966
|
+
level: from ? 'advanced' : 'basic',
|
|
2967
|
+
...(from ? { from } : {}),
|
|
2968
|
+
});
|
|
2969
|
+
const DESIGN_VALUES = [
|
|
2970
|
+
value('color.primary', 'colors', 'color'),
|
|
2971
|
+
value('color.text', 'colors', 'color'),
|
|
2972
|
+
value('color.background', 'colors', 'color'),
|
|
2973
|
+
value('color.surface', 'colors', 'color'),
|
|
2974
|
+
value('color.on-primary', 'colors', 'color', 'color.surface'),
|
|
2975
|
+
value('color.text-muted', 'colors', 'color', 'color.text'),
|
|
2976
|
+
value('color.border', 'colors', 'color', 'color.text-muted'),
|
|
2977
|
+
value('color.success', 'status', 'color', 'color.primary'),
|
|
2978
|
+
value('color.warning', 'status', 'color', 'color.primary'),
|
|
2979
|
+
value('color.danger', 'status', 'color', 'color.primary'),
|
|
2980
|
+
value('color.info', 'status', 'color', 'color.primary'),
|
|
2981
|
+
value('header.background', 'header', 'color', 'color.surface'),
|
|
2982
|
+
value('header.text', 'header', 'color', 'color.text'),
|
|
2983
|
+
value('menu.background', 'menu', 'color', 'color.primary'),
|
|
2984
|
+
value('menu.text', 'menu', 'color', 'color.on-primary'),
|
|
2985
|
+
value('menu.text-muted', 'menu', 'color', 'menu.text'),
|
|
2986
|
+
value('menu.hover', 'menu', 'color', 'menu.background'),
|
|
2987
|
+
value('menu.divider', 'menu', 'color', 'menu.text-muted'),
|
|
2988
|
+
value('button.level1-background', 'buttons', 'color', 'color.primary'),
|
|
2989
|
+
value('button.level1-text', 'buttons', 'color', 'color.on-primary'),
|
|
2990
|
+
value('button.level2-background', 'buttons', 'color', 'color.surface'),
|
|
2991
|
+
value('button.level2-text', 'buttons', 'color', 'color.primary'),
|
|
2992
|
+
value('button.level3-text', 'buttons', 'color', 'color.primary'),
|
|
2993
|
+
value('font.family', 'fonts', 'font'),
|
|
2994
|
+
value('font.heading-family', 'fonts', 'font', 'font.family'),
|
|
2995
|
+
value('font.size', 'fonts', 'size'),
|
|
2996
|
+
value('shape.radius', 'shape', 'size'),
|
|
2997
|
+
value('shape.button-radius', 'shape', 'size', 'shape.radius'),
|
|
2998
|
+
value('space.small', 'spacing', 'size'),
|
|
2999
|
+
value('space.medium', 'spacing', 'size', 'space.small'),
|
|
3000
|
+
value('space.large', 'spacing', 'size', 'space.medium'),
|
|
3001
|
+
value('shadow.small', 'depth', 'shadow'),
|
|
3002
|
+
value('shadow.large', 'depth', 'shadow', 'shadow.small'),
|
|
3003
|
+
];
|
|
3004
|
+
/** The value of a key, or undefined. */
|
|
3005
|
+
function designValue(key) {
|
|
3006
|
+
return DESIGN_VALUES.find((item) => item.key === key);
|
|
3007
|
+
}
|
|
3008
|
+
/**
|
|
3009
|
+
* The CSS variables of a theme's values: what the theme leaves out follows its "from" chain; a value nothing leads to
|
|
3010
|
+
* stays out, so the style's own fallback - today's look - applies.
|
|
3011
|
+
*/
|
|
3012
|
+
function designVariables(values) {
|
|
3013
|
+
const resolve = (item) => {
|
|
3014
|
+
if (!item)
|
|
3015
|
+
return undefined;
|
|
3016
|
+
return values[item.key] ?? resolve(item.from ? designValue(item.from) : undefined);
|
|
3017
|
+
};
|
|
3018
|
+
const variables = {};
|
|
3019
|
+
for (const item of DESIGN_VALUES) {
|
|
3020
|
+
const resolved = resolve(item);
|
|
3021
|
+
if (resolved !== undefined)
|
|
3022
|
+
variables[item.cssVar] = resolved;
|
|
3023
|
+
}
|
|
3024
|
+
return variables;
|
|
3025
|
+
}
|
|
3026
|
+
/** Where Main names the app's theme. */
|
|
3027
|
+
const THEME_PATH = 'center.theme';
|
|
3028
|
+
const lightStatus = { 'color.success': '#2e7d32', 'color.warning': '#b26a00', 'color.danger': '#c62828', 'color.info': '#0277bd' };
|
|
3029
|
+
const STANDARD_THEMES = [
|
|
3030
|
+
{
|
|
3031
|
+
id: 'clear', name: { en: 'Clear', de: 'Klar', fr: 'Clair' }, style: 'clean', background: 'light',
|
|
3032
|
+
values: {
|
|
3033
|
+
...lightStatus, 'color.primary': '#2f6fed', 'color.text': '#1f2937', 'color.text-muted': '#6b7280', 'color.background': '#f7f8fa',
|
|
3034
|
+
'color.surface': '#ffffff', 'color.border': '#e2e6ec', 'menu.background': '#16243a', 'menu.text': '#f2f5fa',
|
|
3035
|
+
'menu.text-muted': '#b6c2d3', 'menu.hover': '#223552', 'menu.divider': '#2d4262',
|
|
3036
|
+
},
|
|
3037
|
+
},
|
|
3038
|
+
{
|
|
3039
|
+
id: 'forest', name: { en: 'Forest', de: 'Wald', fr: 'Forêt' }, style: 'natural', background: 'light',
|
|
3040
|
+
values: {
|
|
3041
|
+
...lightStatus, 'color.primary': '#2f7d5b', 'color.text': '#1d2a24', 'color.text-muted': '#66756d', 'color.background': '#f5f7f4',
|
|
3042
|
+
'color.surface': '#ffffff', 'color.border': '#dfe6e0', 'menu.background': '#1f3a2f', 'menu.text': '#f1f6f3',
|
|
3043
|
+
'menu.text-muted': '#b5c7bd', 'menu.hover': '#2b4b3e', 'menu.divider': '#37594b',
|
|
3044
|
+
},
|
|
3045
|
+
},
|
|
3046
|
+
{
|
|
3047
|
+
id: 'copper', name: { en: 'Copper', de: 'Kupfer', fr: 'Cuivre' }, style: 'elegant', background: 'light',
|
|
3048
|
+
values: {
|
|
3049
|
+
...lightStatus, 'color.primary': '#b4552d', 'color.text': '#2b2320', 'color.text-muted': '#776a63', 'color.background': '#faf6f1',
|
|
3050
|
+
'color.surface': '#ffffff', 'color.border': '#ebe2d8', 'menu.background': '#3b2a22', 'menu.text': '#fbf4ec',
|
|
3051
|
+
'menu.text-muted': '#d2c2b4', 'menu.hover': '#4e3a30', 'menu.divider': '#5e483c',
|
|
3052
|
+
},
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
id: 'night', name: { en: 'Night', de: 'Nacht', fr: 'Nuit' }, style: 'dark', background: 'dark',
|
|
3056
|
+
values: {
|
|
3057
|
+
'color.success': '#66bb6a', 'color.warning': '#ffb74d', 'color.danger': '#ef5350', 'color.info': '#4fc3f7',
|
|
3058
|
+
'color.primary': '#5aa9ff', 'color.on-primary': '#0d1420', 'color.text': '#e8edf4', 'color.text-muted': '#9fb0c3',
|
|
3059
|
+
'color.background': '#10151c', 'color.surface': '#1a212b', 'color.border': '#33404f', 'menu.background': '#0b1016',
|
|
3060
|
+
'menu.text': '#e8edf4', 'menu.text-muted': '#9fb0c3', 'menu.hover': '#1a212b', 'menu.divider': '#2a3543',
|
|
3061
|
+
},
|
|
3062
|
+
},
|
|
3063
|
+
{
|
|
3064
|
+
id: 'autumn-2026', name: { en: 'Autumn 2026', de: 'Herbst 2026', fr: 'Automne 2026' }, style: 'natural', background: 'light',
|
|
3065
|
+
values: {
|
|
3066
|
+
...lightStatus, 'color.primary': '#a4471c', 'color.text': '#2e231c', 'color.text-muted': '#75655a', 'color.background': '#faf4ec',
|
|
3067
|
+
'color.surface': '#ffffff', 'color.border': '#eadfd2', 'menu.background': '#3a2418', 'menu.text': '#fbf3ea',
|
|
3068
|
+
'menu.text-muted': '#d4c1b1', 'menu.hover': '#4d3325', 'menu.divider': '#5f4332',
|
|
3069
|
+
},
|
|
3070
|
+
},
|
|
3071
|
+
{
|
|
3072
|
+
id: 'winter-2026', name: { en: 'Winter 2026', de: 'Winter 2026', fr: 'Hiver 2026' }, style: 'clean', background: 'light',
|
|
3073
|
+
values: {
|
|
3074
|
+
...lightStatus, 'color.primary': '#1f5f8b', 'color.text': '#1b2a36', 'color.text-muted': '#5f7180', 'color.background': '#f1f5f9',
|
|
3075
|
+
'color.surface': '#ffffff', 'color.border': '#dbe3ea', 'menu.background': '#14283a', 'menu.text': '#eef4f9',
|
|
3076
|
+
'menu.text-muted': '#b4c6d6', 'menu.hover': '#1f3a52', 'menu.divider': '#2c4a64',
|
|
3077
|
+
},
|
|
3078
|
+
},
|
|
3079
|
+
{
|
|
3080
|
+
id: 'spring-2027', name: { en: 'Spring 2027', de: 'Frühjahr 2027', fr: 'Printemps 2027' }, style: 'natural', background: 'light',
|
|
3081
|
+
values: {
|
|
3082
|
+
...lightStatus, 'color.primary': '#2f7d4f', 'color.text': '#22302a', 'color.text-muted': '#5f7268', 'color.background': '#f5faf3',
|
|
3083
|
+
'color.surface': '#ffffff', 'color.border': '#dde8dc', 'menu.background': '#1e3b2b', 'menu.text': '#f1f7f2',
|
|
3084
|
+
'menu.text-muted': '#b8cdbf', 'menu.hover': '#2a4e3a', 'menu.divider': '#365f48',
|
|
3085
|
+
},
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
id: 'summer-2027', name: { en: 'Summer 2027', de: 'Sommer 2027', fr: 'Été 2027' }, style: 'clean', background: 'light',
|
|
3089
|
+
values: {
|
|
3090
|
+
...lightStatus, 'color.primary': '#0a7c86', 'color.text': '#1f2d33', 'color.text-muted': '#5c6f76', 'color.background': '#fffaf0',
|
|
3091
|
+
'color.surface': '#ffffff', 'color.border': '#efe5d3', 'menu.background': '#0f3a42', 'menu.text': '#effafa',
|
|
3092
|
+
'menu.text-muted': '#b3d0d3', 'menu.hover': '#1a4d56', 'menu.divider': '#285f68',
|
|
3093
|
+
},
|
|
3094
|
+
},
|
|
3095
|
+
];
|
|
3096
|
+
/** The theme of an id, or undefined (no theme: the app keeps its own look). */
|
|
3097
|
+
function appTheme(id) {
|
|
3098
|
+
return STANDARD_THEMES.find((theme) => theme.id === id);
|
|
3099
|
+
}
|
|
3100
|
+
/** The fonts of the platform - a theme or an app's own look takes font.family / font.heading-family from these. */
|
|
3101
|
+
const THEME_FONTS = [
|
|
3102
|
+
{ name: 'Roboto', css: "Roboto, sans-serif", use: ['heading', 'text'] },
|
|
3103
|
+
{ name: 'Oswald', css: "'Oswald', sans-serif", use: ['heading'] },
|
|
3104
|
+
{ name: 'Bebas Neue', css: "'Bebas Neue', sans-serif", use: ['heading'] },
|
|
3105
|
+
{ name: 'Playfair Display', css: "'Playfair Display', serif", use: ['heading'] },
|
|
3106
|
+
{ name: 'Montserrat', css: "'Montserrat', sans-serif", use: ['heading', 'text'] },
|
|
3107
|
+
{ name: 'Poppins', css: "'Poppins', sans-serif", use: ['heading', 'text'] },
|
|
3108
|
+
{ name: 'Inter', css: "'Inter', sans-serif", use: ['text', 'heading'] },
|
|
3109
|
+
{ name: 'Lato', css: "'Lato', sans-serif", use: ['text'] },
|
|
3110
|
+
{ name: 'Open Sans', css: "'Open Sans', sans-serif", use: ['text'] },
|
|
3111
|
+
{ name: 'Nunito', css: "'Nunito', sans-serif", use: ['text'] },
|
|
3112
|
+
{ name: 'Lora', css: "'Lora', serif", use: ['text', 'heading'] },
|
|
3113
|
+
];
|
|
3114
|
+
/** Whether a font value names a font the app has first (or only a generic family such as sans-serif). */
|
|
3115
|
+
function themeFontKnown(raw) {
|
|
3116
|
+
const first = String(raw ?? '').split(',')[0].trim().replace(/^['"]|['"]$/g, '').toLowerCase();
|
|
3117
|
+
if (!first)
|
|
3118
|
+
return false;
|
|
3119
|
+
if (['sans-serif', 'serif', 'system-ui', 'monospace', 'inherit'].includes(first))
|
|
3120
|
+
return true;
|
|
3121
|
+
return THEME_FONTS.some((font) => font.name.toLowerCase() === first);
|
|
3122
|
+
}
|
|
3123
|
+
/**
|
|
3124
|
+
* Whether a design value may go on the page: a colour (#rgb, #rrggbb, #rrggbbaa, rgb()/rgba()/hsl()), a size
|
|
3125
|
+
* (px, rem, em, % or 0), a font list (letters, digits, spaces, commas, quotes, hyphens) or a shadow made of
|
|
3126
|
+
* those - never anything that ends a CSS declaration (; { } < >) or loads something (url, expression, @).
|
|
3127
|
+
*/
|
|
3128
|
+
function isSafeDesignValue(key, raw) {
|
|
3129
|
+
const item = designValue(key);
|
|
3130
|
+
const v = String(raw ?? '').trim();
|
|
3131
|
+
if (!item || !v || v.length > 200 || /[;{}<>\\@]|url\(|expression|javascript:/i.test(v))
|
|
3132
|
+
return false;
|
|
3133
|
+
const color = /^(#[0-9a-f]{3,4}|#[0-9a-f]{6}|#[0-9a-f]{8}|(rgb|rgba|hsl|hsla)\([0-9.,%\s/]+\))$/i;
|
|
3134
|
+
const size = /^(0|-?[0-9.]+(px|rem|em|%))$/i;
|
|
3135
|
+
if (item.kind === 'color')
|
|
3136
|
+
return color.test(v);
|
|
3137
|
+
if (item.kind === 'size')
|
|
3138
|
+
return size.test(v);
|
|
3139
|
+
if (item.kind === 'font')
|
|
3140
|
+
return /^[\w\s,'"-]+$/.test(v);
|
|
3141
|
+
return /^[\w\s#.,%()/-]+$/.test(v);
|
|
3142
|
+
}
|
|
3143
|
+
/** The app's own design values (Main center.themeValues) that pass isSafeDesignValue - the others are left out. */
|
|
3144
|
+
function safeDesignValues(own) {
|
|
3145
|
+
if (!own || typeof own !== 'object')
|
|
3146
|
+
return {};
|
|
3147
|
+
return Object.fromEntries(Object.entries(own)
|
|
3148
|
+
.filter(([key, v]) => isSafeDesignValue(key, v)).map(([key, v]) => [key, String(v).trim()]));
|
|
3149
|
+
}
|
|
3150
|
+
/**
|
|
3151
|
+
* The CSS variables of a theme and the app's own values over it (point 213 worklist 13: the AI or the customer gives
|
|
3152
|
+
* an app its own look as design values, never as CSS); {} when neither gives anything.
|
|
3153
|
+
*/
|
|
3154
|
+
function themeVariables(id, own) {
|
|
3155
|
+
const theme = appTheme(id);
|
|
3156
|
+
const mine = safeDesignValues(own);
|
|
3157
|
+
if (!theme && !Object.keys(mine).length)
|
|
3158
|
+
return {};
|
|
3159
|
+
// the app's own menu colours: what the theme derives from them (muted text, hover, divider) follows them, unless the app
|
|
3160
|
+
// gives those too - the theme's were made for its own menu (a dark one) and stayed on a light menu (2026-11-09)
|
|
3161
|
+
const derived = {};
|
|
3162
|
+
if (mine['menu.background'] || mine['menu.text']) {
|
|
3163
|
+
const bg = mine['menu.background'] ?? theme?.values?.['menu.background'];
|
|
3164
|
+
const text = mine['menu.text'] ?? theme?.values?.['menu.text'];
|
|
3165
|
+
if (bg && text) {
|
|
3166
|
+
derived['menu.text-muted'] = `color-mix(in srgb, ${text} 72%, ${bg})`;
|
|
3167
|
+
derived['menu.hover'] = `color-mix(in srgb, ${text} 8%, ${bg})`;
|
|
3168
|
+
derived['menu.divider'] = `color-mix(in srgb, ${text} 18%, ${bg})`;
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
return designVariables({ ...(theme?.values ?? {}), ...derived, ...mine });
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-09
|
|
3175
|
+
// - new: opening hours as data (point 213 worklist 29, user decision A): a week of times per day (day, from, to; a day
|
|
3176
|
+
// without a time is closed; several times a day for a lunch break; to after midnight = into the next day) and the
|
|
3177
|
+
// business's time zone. openingStatus says whether it is open now and when it closes or opens again - always in
|
|
3178
|
+
// the business's time zone (summer time from the device's time zone rules, Intl), not the phone's.
|
|
3179
|
+
const WEEK_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
|
|
3180
|
+
const minutes = (hhmm) => {
|
|
3181
|
+
const m = /^(\d{1,2}):(\d{2})$/.exec(String(hhmm ?? '').trim());
|
|
3182
|
+
if (!m)
|
|
3183
|
+
return null;
|
|
3184
|
+
const h = Number(m[1]), min = Number(m[2]);
|
|
3185
|
+
return h <= 24 && min < 60 && h * 60 + min <= 1440 ? h * 60 + min : null;
|
|
3186
|
+
};
|
|
3187
|
+
/** What is wrong with opening times: unknown day, a time not "HH:MM", from equal to. Empty: fine. */
|
|
3188
|
+
function openingProblems(times, timeZone) {
|
|
3189
|
+
const problems = [];
|
|
3190
|
+
if (!Array.isArray(times))
|
|
3191
|
+
return [{ index: -1, code: 'notAList' }];
|
|
3192
|
+
times.forEach((t, index) => {
|
|
3193
|
+
if (!WEEK_DAYS.includes(t?.day))
|
|
3194
|
+
problems.push({ index, code: 'unknownDay' });
|
|
3195
|
+
const from = minutes(t?.from), to = minutes(t?.to);
|
|
3196
|
+
if (from === null || to === null)
|
|
3197
|
+
problems.push({ index, code: 'notATime' });
|
|
3198
|
+
else if (from === to)
|
|
3199
|
+
problems.push({ index, code: 'emptyTime' });
|
|
3200
|
+
});
|
|
3201
|
+
if (timeZone !== undefined && !validTimeZone(timeZone))
|
|
3202
|
+
problems.push({ index: -1, code: 'unknownTimeZone' });
|
|
3203
|
+
return problems;
|
|
3204
|
+
}
|
|
3205
|
+
/** Whether the device knows the time zone (IANA name such as Europe/Berlin). */
|
|
3206
|
+
function validTimeZone(zone) {
|
|
3207
|
+
try {
|
|
3208
|
+
new Intl.DateTimeFormat('en', { timeZone: String(zone) });
|
|
3209
|
+
return typeof zone === 'string' && zone.length > 0;
|
|
3210
|
+
}
|
|
3211
|
+
catch {
|
|
3212
|
+
return false;
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
/** The day of the week and the minute of the day in a time zone. */
|
|
3216
|
+
function zonedNow(now, timeZone) {
|
|
3217
|
+
const parts = new Intl.DateTimeFormat('en-US', { timeZone, weekday: 'short', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' })
|
|
3218
|
+
.formatToParts(now);
|
|
3219
|
+
const get = (type) => parts.find((p) => p.type === type)?.value ?? '';
|
|
3220
|
+
const day = get('weekday').slice(0, 3).toLowerCase();
|
|
3221
|
+
return { day: WEEK_DAYS.includes(day) ? day : 'mon', minute: Number(get('hour')) * 60 + Number(get('minute')) };
|
|
3222
|
+
}
|
|
3223
|
+
/** Open now? And when does it close, or open next - in the business's time zone. */
|
|
3224
|
+
function openingStatus(times, timeZone = 'Europe/Berlin', now = new Date()) {
|
|
3225
|
+
const { day, minute } = zonedNow(now, validTimeZone(timeZone) ? timeZone : 'Europe/Berlin');
|
|
3226
|
+
const todayIndex = WEEK_DAYS.indexOf(day);
|
|
3227
|
+
// the week as intervals in minutes from Monday 00:00 (an end before its start runs into the next day)
|
|
3228
|
+
const week = 7 * 1440;
|
|
3229
|
+
const spans = (Array.isArray(times) ? times : []).flatMap((t) => {
|
|
3230
|
+
const from = minutes(t.from), to = minutes(t.to);
|
|
3231
|
+
const d = WEEK_DAYS.indexOf(t.day);
|
|
3232
|
+
if (from === null || to === null || d < 0 || from === to)
|
|
3233
|
+
return [];
|
|
3234
|
+
const start = d * 1440 + from;
|
|
3235
|
+
const end = d * 1440 + (to > from ? to : to + 1440);
|
|
3236
|
+
return [{ start, end }];
|
|
3237
|
+
});
|
|
3238
|
+
const at = todayIndex * 1440 + minute;
|
|
3239
|
+
const label = (abs) => {
|
|
3240
|
+
const m = ((abs % week) + week) % week;
|
|
3241
|
+
const d = Math.floor(m / 1440), rest = m % 1440;
|
|
3242
|
+
const time = `${String(Math.floor(rest / 60)).padStart(2, '0')}:${String(rest % 60).padStart(2, '0')}`;
|
|
3243
|
+
const ahead = Math.floor(abs / 1440) - todayIndex;
|
|
3244
|
+
return { day: WEEK_DAYS[d], time, today: ahead === 0, tomorrow: ahead === 1 };
|
|
3245
|
+
};
|
|
3246
|
+
// open: inside a span (this week, or a span of last Sunday running past midnight)
|
|
3247
|
+
for (const s of spans) {
|
|
3248
|
+
for (const shift of [0, -week]) {
|
|
3249
|
+
if (at >= s.start + shift && at < s.end + shift) {
|
|
3250
|
+
// a span ending exactly where the next starts (24:00 then 00:00) counts as one
|
|
3251
|
+
let end = s.end + shift;
|
|
3252
|
+
for (let more = true; more;) {
|
|
3253
|
+
more = false;
|
|
3254
|
+
for (const t of spans)
|
|
3255
|
+
for (const sh of [0, week])
|
|
3256
|
+
if (t.start + sh === end) {
|
|
3257
|
+
end = t.end + sh;
|
|
3258
|
+
more = true;
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
return { open: true, next: label(end), today: day };
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
if (!spans.length)
|
|
3266
|
+
return { open: false, next: null, today: day };
|
|
3267
|
+
const starts = spans.flatMap((s) => [s.start, s.start + week]).filter((x) => x > at).sort((a, b) => a - b);
|
|
3268
|
+
return { open: false, next: label(starts[0]), today: day };
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-09
|
|
3272
|
+
// - new: the place of a map as data (point 213 worklist 42): lat/lon in degrees (WGS84), checked; the OpenStreetMap
|
|
3273
|
+
// embed link with a pin, the section around it fitting the zoom. Used by the app (vl-map), the Designer and the checks.
|
|
3274
|
+
/** Whether lat and lon are a place on earth (numbers, lat -90..90, lon -180..180, not both 0). */
|
|
3275
|
+
function validPlace(lat, lon) {
|
|
3276
|
+
if (lat === null || lat === undefined || lat === '' || lon === null || lon === undefined || lon === '')
|
|
3277
|
+
return false;
|
|
3278
|
+
const a = Number(lat), o = Number(lon);
|
|
3279
|
+
return Number.isFinite(a) && Number.isFinite(o) && a >= -90 && a <= 90 && o >= -180 && o <= 180 && !(a === 0 && o === 0);
|
|
3280
|
+
}
|
|
3281
|
+
/** The OpenStreetMap embed address with a pin at lat/lon; zoom 1..19 (16: a few streets around). '' for no place. */
|
|
3282
|
+
function mapEmbedUrl(lat, lon, zoom = 16) {
|
|
3283
|
+
if (!validPlace(lat, lon))
|
|
3284
|
+
return '';
|
|
3285
|
+
const z = Math.min(19, Math.max(1, Math.round(Number(zoom) || 16)));
|
|
3286
|
+
// half the width in degrees at this zoom (a 256-px tile spans 360 / 2^z degrees); the height follows the latitude
|
|
3287
|
+
const dLon = (360 / 2 ** z) * 0.8;
|
|
3288
|
+
const dLat = dLon * Math.cos((lat * Math.PI) / 180) * 0.6;
|
|
3289
|
+
const f = (n) => n.toFixed(6);
|
|
3290
|
+
const bbox = [f(lon - dLon), f(lat - dLat), f(lon + dLon), f(lat + dLat)].join('%2C');
|
|
3291
|
+
return `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${f(lat)}%2C${f(lon)}`;
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3294
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-09
|
|
3295
|
+
// - new: a price as data (point 213 worklist 36, user decision): amount (a number), currency (ISO 4217, e.g. EUR) and
|
|
3296
|
+
// from ("from 70 €"). The app writes it in the reader's language (32 € in German, €32 in English), whole amounts
|
|
3297
|
+
// without cents. Used by the app (vl-price), the Designer and the checks.
|
|
3298
|
+
const PRICE_CURRENCIES = ['EUR', 'CHF', 'USD', 'GBP'];
|
|
3299
|
+
/** Whether the amount is a price: a number from 0 up. */
|
|
3300
|
+
function validAmount(amount) {
|
|
3301
|
+
return typeof amount === 'number' && Number.isFinite(amount) && amount >= 0;
|
|
3302
|
+
}
|
|
3303
|
+
/** Whether the code is a currency the device can write (three letters, known to Intl). */
|
|
3304
|
+
function validCurrency(code) {
|
|
3305
|
+
if (typeof code !== 'string' || !/^[A-Z]{3}$/.test(code))
|
|
3306
|
+
return false;
|
|
3307
|
+
try {
|
|
3308
|
+
new Intl.NumberFormat('en', { style: 'currency', currency: code });
|
|
3309
|
+
return true;
|
|
3310
|
+
}
|
|
3311
|
+
catch {
|
|
3312
|
+
return false;
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
/** The price in a language: "32 €" (de), "€32" (en), with the word for "from" before it; '' for no amount. */
|
|
3316
|
+
function formatPrice(amount, currency, lang, fromWord = '') {
|
|
3317
|
+
if (!validAmount(amount))
|
|
3318
|
+
return '';
|
|
3319
|
+
const code = validCurrency(currency) ? String(currency) : 'EUR';
|
|
3320
|
+
const whole = Number.isInteger(amount);
|
|
3321
|
+
let text;
|
|
3322
|
+
try {
|
|
3323
|
+
text = new Intl.NumberFormat(lang || 'en', { style: 'currency', currency: code, minimumFractionDigits: whole ? 0 : 2, maximumFractionDigits: 2 }).format(amount);
|
|
3324
|
+
}
|
|
3325
|
+
catch {
|
|
3326
|
+
text = `${amount} ${code}`;
|
|
3327
|
+
}
|
|
3328
|
+
return fromWord ? `${fromWord} ${text}` : text;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-05
|
|
3332
|
+
// - new: the design values of an app's look (point 173)
|
|
2858
3333
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-11-02
|
|
2859
3334
|
// - new: style-keys - one spelling for style properties (CSS: font-size)
|
|
2860
3335
|
// Faramarz Yousefian and Agent Toni (Claude Opus 5.5) 2026-10-30
|
|
@@ -2871,5 +3346,5 @@ function visitStyles(node, path, visit) {
|
|
|
2871
3346
|
* Generated bundle index. Do not edit.
|
|
2872
3347
|
*/
|
|
2873
3348
|
|
|
2874
|
-
export { APP_DATA_KEEP, APP_KEYBOARD_DEVICES, APP_SETTINGS, APP_SETTINGS_PATH, APP_SETTING_BLOCKS, BACKEND_ACTIONS, BASIC_TYPES, BROWSER_STORAGES, CALCULATE_OPERATORS, CALL_KEYS, CALL_KINDS, CARD_LAYOUTS, CONTROLS, CONTROL_TYPES, DATA_FORMATS, DATA_OBJECT_KEYS, DATA_OBJECT_NAME_PLACES, DATA_OBJECT_PLACES, DEFAULT_DEVICES, DEFAULT_TEMPO_SECONDS, DISPLAY_FORMATS, DOCUMENT_KINDS, ENTER_KEYS, EXPECT_KINDS, FORMATS, FRAME_PARTS, FRAME_SELECTORS, HEADER_SCROLLS, INNER_ACTIONS, 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, STRIPE_TEST_CARDS, SYSTEM_KEYBOARDS, TEMPORAL_TRANSFER, TERMS_DOCUMENTS, TESTS_DIR, TEST_DATA_FILE, TEST_DEVICES, TEST_TEMPOS, TYPE_ALIASES, actionName, actionParams, alignRowsOf, appSettingsMenu, assertFieldSettings, base32Bytes, baseType, basicType, callAttributes, callKindOf, camelStyleKey, canonicalControl, cardLayoutOf, checkAppSettings, checkCall, checkElementAction, checkPagePagination, checkTestFlow, clone, controlChoicesFor, controlsFor, convertOlderForms, cssStyle, cssStyleKey, dataSettings, dateOrder, defaultKeyboard, deviceChoices, displaySettings, effectiveControl, effectiveFormat, elementAction, enterKeyFor, flowDevices, flowLanguages, hasAppKeyboard, headerScrollOf, isKeyboardCheck, isStyleHolder, keyboardFor, languageName, layoutNotes, layoutProblems, localeKeys, localeRenderings, loginMethod, matchesTemplate, maxLinesOf, menuCaption, menuEntries, menuEntryByCaption, menuEntryForPage, menuPage, methodOf, normalizeFormat, normalizeStyleSpelling, pageOf, paginationFor, parseDevice, probeClearAppData, probeField, probeFieldVisible, probeInFrame, probeLayoutSnapshot, probePagePlace, probeRestoreStorage, probeStorageSnapshot, probeUntranslated, readAppSettings, readTestUser, renameDataObject, resolveProperty, resultsToDelete, rolesOf, rulesFor, startPage, startPageFor, stepKind, storageOf, stripeTestPaymentMethod, styleSpellingFindings, styleValue, successMessageOf, tempoPause, temporalPart, testDataRefs, testUserEntry, totp, translateCaptions, uses12Hours, validateSettings, validationSettings, vaultJwtLogin, vaultPlace, waitsForFilter, withElementAction, withPageSource, withTestData };
|
|
3349
|
+
export { APP_DATA_KEEP, APP_KEYBOARD_DEVICES, APP_SETTINGS, APP_SETTINGS_PATH, APP_SETTING_BLOCKS, BACKEND_ACTIONS, BASIC_TYPES, BROWSER_STORAGES, CALCULATE_OPERATORS, CALL_KEYS, CALL_KINDS, CARD_LAYOUTS, CONTACT_ICONS, CONTACT_KINDS, CONTROLS, CONTROL_TYPES, DATA_FORMATS, DATA_OBJECT_KEYS, DATA_OBJECT_NAME_PLACES, DATA_OBJECT_PLACES, DEFAULT_DEVICES, DEFAULT_TEMPO_SECONDS, DESIGN_VALUES, DISPLAY_FORMATS, DOCUMENT_KINDS, ENTER_KEYS, EXPECT_KINDS, FORMATS, FRAME_PARTS, FRAME_SELECTORS, HEADER_SCROLLS, INNER_ACTIONS, KEYBOARD_CONTROLS, KEYBOARD_TYPES, LIST_STATES, LOGIN_FLAGS, LOGIN_METHODS, LOGIN_STORAGES, LOGIN_WHEN, MENU_DECIDED_BY, MENU_ENTRY_KINDS, MENU_STYLES, 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, PRICE_CURRENCIES, RESULTS_DIR, RESULTS_KEEP, RTL_LANGUAGES, SETTING_MENU_TEXTS, SHOWN_TEXT_KEYS, STANDARD_THEMES, START_PAGE_KEYS, START_PAGE_PATH, STEP_KINDS, STORAGES, STRIPE_TEST_CARDS, SYSTEM_KEYBOARDS, TEMPORAL_TRANSFER, TERMS_DOCUMENTS, TESTS_DIR, TEST_DATA_FILE, TEST_DEVICES, TEST_TEMPOS, THEME_FONTS, THEME_PATH, TYPE_ALIASES, WEEK_DAYS, actionName, actionParams, alignRowsOf, appSettingsFooter, appSettingsMenu, appTheme, assertFieldSettings, base32Bytes, baseType, basicType, callAttributes, callKindOf, camelStyleKey, canonicalControl, cardLayoutOf, checkAppSettings, checkCall, checkElementAction, checkPagePagination, checkTestFlow, clone, contactLink, controlChoicesFor, controlsFor, convertOlderForms, cssStyle, cssStyleKey, dataSettings, dateOrder, defaultKeyboard, designValue, designVariables, deviceChoices, displaySettings, effectiveControl, effectiveFormat, elementAction, enterKeyFor, flowDevices, flowLanguages, formatPrice, hasAppKeyboard, headerScrollOf, isKeyboardCheck, isSafeDesignValue, isStyleHolder, keyboardFor, languageName, layoutNotes, layoutProblems, localeKeys, localeRenderings, loginMethod, mapEmbedUrl, matchesTemplate, maxLinesOf, menuCaption, menuEntries, menuEntryByCaption, menuEntryForPage, menuPage, methodOf, normalizeFormat, normalizeStyleSpelling, openingProblems, openingStatus, pageOf, paginationFor, parseDevice, probeClearAppData, probeField, probeFieldVisible, probeInFrame, probeLayoutSnapshot, probePagePlace, probeRestoreStorage, probeStorageSnapshot, probeUntranslated, readAppSettings, readTestUser, renameDataObject, resolveProperty, resultsToDelete, rolesOf, rulesFor, safeDesignValues, startPage, startPageFor, stepKind, storageOf, stripeTestPaymentMethod, styleSpellingFindings, styleValue, successMessageOf, tempoPause, temporalPart, testDataRefs, testUserEntry, themeFontKnown, themeVariables, totp, translateCaptions, uses12Hours, validAmount, validCurrency, validPlace, validTimeZone, validateSettings, validationSettings, vaultJwtLogin, vaultPlace, waitsForFilter, withElementAction, withPageSource, withTestData, zonedNow };
|
|
2875
3350
|
//# sourceMappingURL=yomotech-view-toolkit-catalog.mjs.map
|