CORE/CONTENT test5593 и адаптация UI

This commit is contained in:
AidarKC
2026-11-27 00:47:13 +03:00
parent 205b7ad971
commit 873535654e
1271 changed files with 219621 additions and 1900 deletions
+561
View File
@@ -0,0 +1,561 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover, interactive-widget=resizes-visual"
/>
<meta name="theme-color" content="#121419" />
<base href="/" />
<link rel="manifest" href="./manifest.webmanifest" />
<link rel="icon" type="image/jpeg" href="./img/logo.jpg" />
<link rel="apple-touch-icon" href="./img/logo.jpg" />
<title>СИЯНИЕ</title>
<script>
(function applySavedThemeBeforePaint() {
let mode = 'system';
try {
const saved = localStorage.getItem('shine-ui-theme-mode-v1');
if (saved === 'light' || saved === 'dark' || saved === 'system') mode = saved;
} catch {}
const resolved = mode === 'system'
? (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark')
: mode;
document.documentElement.dataset.themeMode = mode;
document.documentElement.dataset.theme = resolved;
document.documentElement.style.colorScheme = resolved;
// Своя палитра (см. js/services/theme-service.js) применяется до отрисовки, без вспышки.
try {
const applied = JSON.parse(localStorage.getItem('shine-ui-palette-applied-v1') || 'null');
const colors = applied && applied[resolved];
if (colors) {
Object.keys(colors).forEach(function (role) {
if (/^#[0-9a-f]{6}$/i.test(colors[role])) document.documentElement.style.setProperty('--' + role, colors[role]);
});
if (colors.accent) document.documentElement.style.setProperty('--focus-ring', colors.accent);
}
} catch {}
}());
</script>
<script>
window.__SHINE_BUILD_HASH__ = '20261119-graph-v4c';
window.__SHINE_CLIENT_VERSION__ = '1.20.9';
</script>
<script>
(function attachStylesWithBuildHash() {
const v = encodeURIComponent(window.__SHINE_BUILD_HASH__ || 'dev');
const cssFiles = ['./styles/main.css', './styles/layout.css', './styles/app-shell.css', './styles/buttons-white.css', './styles/components/topbar.css', './styles/components/dropdown-menu.css', './styles/components/primitives.css', './styles/components/feedback.css', './styles/components/tabs.css', './styles/components/chips.css', './styles/components/nav-list.css', './styles/components/palette-editor.css', './styles/components/avatar.css', './styles/components/modal.css', './styles/components/person-note.css', './styles/components/person-row.css', './styles/components/compose.css', './styles/components/attachments.css', './styles/components/media-viewer.css', './styles/components/channel-editor.css', './styles/components/emoji-picker.css', './styles/components/call-ui.css', './styles/components/scroll-to-bottom.css', './styles/components/overflow-dots.css', './styles/components/toolbar.css', './styles/features/preauth.css', './styles/features/messages.css', './styles/features/chat.css', './styles/features/channels-common.css', './styles/features/channels-list.css', './styles/features/channel.css', './styles/features/channel-thread.css', './styles/features/notifications.css', './styles/features/network.css', './styles/features/profile.css', './styles/features/profile-page.css', './styles/features/settings.css', './styles/features/devices.css', './styles/features/developer-tools.css', './styles/features/wallet-transfer.css', './styles/features/wallet-swap.css', './styles/network-graph.css', './styles/network-legacy.css'];
// Стили, добавленные скриптом, браузер не ждёт перед первой отрисовкой: без этого
// на долю секунды виден экран без CSS (логотип 640×640), а потом он «прыгает» на место.
const root = document.documentElement;
let pending = cssFiles.length;
const reveal = () => root.classList.add('shine-styles-ready');
const settle = () => { pending -= 1; if (pending <= 0) reveal(); };
cssFiles.forEach((file) => {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = `${file}?v=${v}`;
link.onload = settle;
link.onerror = settle;
document.head.appendChild(link);
});
setTimeout(reveal, 4000);
}());
</script>
<style>
html { background: var(--background, #121419); }
html[data-theme='light'] { background: var(--background, #f3f2f7); }
html:not(.shine-styles-ready) body { visibility: hidden; }
</style>
</head>
<body>
<!-- Заставка повторяет верх экрана входа (те же классы и раскладка): смена на него незаметна. -->
<div id="initial-splash" class="initial-splash">
<div class="initial-splash__frame">
<section class="auth-screen auth-screen--welcome">
<div class="auth-logo-wrap">
<img class="auth-logo" src="./img/shine-logo-transparent-final.png" alt="Логотип Сияние" />
</div>
<div class="stack auth-brand-block">
<h1 class="auth-brand"><svg class="shine-wordmark" viewBox="52 -722 7294 744" role="img" aria-label="Сияние"><path fill="currentColor" d="M721 -129Q619 -33 479 -33Q401 -33 341 -60Q281 -87 241 -132Q201 -177 180.5 -236Q160 -295 160 -359Q160 -427 181.5 -483.5Q203 -540 242 -581Q281 -622 334.5 -645Q388 -668 451 -668Q494 -668 529.5 -658Q565 -648 592.5 -632Q620 -616 637.5 -595.5Q655 -575 662 -554H736Q721 -588 697.5 -617Q674 -646 639 -667Q604 -688 557 -700Q510 -712 450 -712Q363 -712 291.5 -687Q220 -662 169 -615.5Q118 -569 90 -503.5Q62 -438 62 -357Q62 -287 84.5 -220.5Q107 -154 154 -102.5Q201 -51 274 -19.5Q347 12 448 12Q512 12 562.5 0Q613 -12 650.5 -29.5Q688 -47 713 -67Q738 -87 751 -102ZM1542 -82V-700H1451V0H1542L1957 -625V0H2048V-700H1957ZM3316 -700V0H3225V-309H3181Q3153 -309 3134.5 -304Q3116 -299 3101 -287Q3086 -275 3073 -256Q3060 -237 3042 -209L2963 -92Q2948 -69 2933.5 -50Q2919 -31 2902 -17.5Q2885 -4 2863.5 4Q2842 12 2812 12Q2790 12 2776 10Q2762 8 2748 0V-37Q2753 -36 2758 -35.5Q2763 -35 2768 -35Q2789 -35 2805 -41Q2821 -47 2835 -58.5Q2849 -70 2862 -86.5Q2875 -103 2889 -124Q2931 -185 2954 -221.5Q2977 -258 2990.5 -278Q3004 -298 3012.5 -307Q3021 -316 3033 -322L3043 -327V-331Q2995 -334 2960.5 -352Q2926 -370 2904 -397Q2882 -424 2872 -455.5Q2862 -487 2862 -517Q2862 -544 2872.5 -576Q2883 -608 2908.5 -635.5Q2934 -663 2978 -681.5Q3022 -700 3089 -700ZM3225 -656H3124Q3086 -656 3055.5 -645Q3025 -634 3003 -614.5Q2981 -595 2969.5 -568Q2958 -541 2958 -509Q2958 -482 2968.5 -454.5Q2979 -427 3000 -404.5Q3021 -382 3051.5 -368Q3082 -354 3122 -354H3225ZM4197 -348H4616V0H4707V-700H4616V-394H4197V-700H4106V0H4197ZM5588 -82V-700H5497V0H5588L6003 -625V0H6094V-700H6003ZM6884 -700V0H7336V-55H6975V-346H7285V-394H6975V-645H7336V-700Z"/></svg></h1>
<p class="meta-muted auth-site-name" id="initial-splash-host"></p>
</div>
<div class="auth-actions shine-actions initial-splash__actions" aria-hidden="true">
<span class="shine-btn"></span>
<span class="secondary-btn shine-btn--register"></span>
<span class="text-btn start-language-link"></span>
<span class="text-btn start-settings-link"></span>
</div>
</section>
</div>
<script>
document.getElementById('initial-splash-host').textContent = window.location.host || 'shineup.me';
</script>
</div>
<div class="app-shell">
<div id="topbar-slot" class="topbar-slot" hidden></div>
<main id="app-screen" class="screen-content"></main>
<div id="composer-slot" class="composer-slot" hidden></div>
<div id="toolbar-slot" class="toolbar-slot" hidden></div>
<div class="app-shell-fade app-shell-fade--top" aria-hidden="true"></div>
<div class="app-shell-fade app-shell-fade--bottom" aria-hidden="true"></div>
</div>
<div id="modal-root"></div>
<script>
// Public VAPID key for Web Push (Base64URL)
window.__SHINE_WEBPUSH_VAPID_PUBLIC_KEY__ = 'BOdoWZndZRaNe9kyUFsJ5-xEfFABXNKennAKg15Z7ycAwUIQ7yDV_sIWWYJCwJriN4g9oU-CyJPrn1U6lfxuDbI';
</script>
<script>
(function attachBootErrorOverlay() {
const stateKey = '__SHINE_BOOT_ERROR_STATE__';
const menuId = 'boot-error-action-sheet';
const escapeText = (value) => String(value == null ? '' : value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
const safeString = (value, maxLen = 1000) => {
const text = String(value == null ? '' : value).trim();
if (text.length <= maxLen) return text;
return `${text.slice(0, Math.max(0, maxLen - 3))}...`;
};
const setState = (next) => {
try {
window[stateKey] = next;
} catch {}
};
const getState = () => {
try {
return window[stateKey] || null;
} catch {
return null;
}
};
const getKnownClientError = () => {
try {
return typeof window.__SHINE_GET_LAST_CLIENT_ERROR__ === 'function'
? window.__SHINE_GET_LAST_CLIENT_ERROR__()
: null;
} catch {
return null;
}
};
const showFeedback = (message, kind = 'success') => {
try {
if (typeof window.__SHINE_SHOW_TOAST__ === 'function') {
window.__SHINE_SHOW_TOAST__(message, kind);
} else {
console.info(message);
}
} catch {}
};
const buildReport = () => {
const state = getState() || {};
const known = getKnownClientError();
const viewport = {
width: Math.round(window.innerWidth || 0),
height: Math.round(window.innerHeight || 0),
dpr: Number(window.devicePixelRatio || 1),
visualWidth: Math.round(window.visualViewport?.width || 0),
visualHeight: Math.round(window.visualViewport?.height || 0),
visualScale: Number(window.visualViewport?.scale || 1),
};
const screenInfo = window.screen ? {
width: Math.round(window.screen.width || 0),
height: Math.round(window.screen.height || 0),
availWidth: Math.round(window.screen.availWidth || 0),
availHeight: Math.round(window.screen.availHeight || 0),
pixelDepth: Number(window.screen.pixelDepth || 0),
} : null;
return {
kind: safeString(state.kind || 'boot_error', 64),
title: safeString(state.title || 'BOOT ERROR', 128),
message: safeString(state.message || '', 500),
stack: safeString(state.stack || '', 8000),
sourceUrl: safeString(state.sourceUrl || '', 240),
lineNumber: Number.isFinite(state.lineNumber) ? state.lineNumber : null,
columnNumber: Number.isFinite(state.columnNumber) ? state.columnNumber : null,
reasonType: safeString(state.reasonType || '', 64),
route: safeString(window.location.hash || window.location.pathname || '', 200),
href: safeString(window.location.href || '', 240),
pageTitle: safeString(document.title || '', 200),
pageVisibility: safeString(document.visibilityState || '', 32),
userAgent: safeString(navigator.userAgent || '', 240),
locale: safeString(navigator.language || '', 32),
clientTs: Number.isFinite(state.clientTs) ? state.clientTs : Date.now(),
viewport,
screenInfo,
lastKnownClientError: known || null,
contextJson: safeString(JSON.stringify({
bootState: state,
currentRoute: window.location.hash || window.location.pathname || '',
hasClientErrorSender: typeof window.__SHINE_SEND_CLIENT_ERROR__ === 'function',
}), 2000),
};
};
const buildSendPayload = (report) => {
const payload = {
kind: safeString(report?.kind || 'boot_error', 64),
message: safeString(report?.message || report?.title || 'Неизвестная ошибка', 500),
stack: safeString(report?.stack || '', 8000),
sourceUrl: safeString(report?.sourceUrl || '', 240),
lineNumber: Number.isFinite(report?.lineNumber) ? report.lineNumber : null,
columnNumber: Number.isFinite(report?.columnNumber) ? report.columnNumber : null,
route: safeString(report?.route || '', 200),
href: safeString(report?.href || '', 240),
userAgent: safeString(report?.userAgent || '', 240),
clientTs: Number.isFinite(report?.clientTs) ? report.clientTs : Date.now(),
requestOp: '',
requestIdRef: '',
contextJson: safeString(JSON.stringify({
...report,
contextJson: undefined,
}), 2000),
};
return payload;
};
const shareErrorText = async (report) => {
const text = formatReportText(report);
if (!text) throw new Error('Текст ошибки пуст');
if (!navigator.share) {
throw new Error('Отправка через системное меню недоступна в этом браузере');
}
try {
await navigator.share({
title: report?.title || 'Описание ошибки',
text,
});
} catch (error) {
if (error?.name === 'AbortError') return false;
throw error;
}
return true;
};
const formatReportText = (report) => {
const lines = [
`Ошибка: ${report.title || report.kind || 'unknown'}`,
`Описание: ${report.message || '–'}`,
`Окно: ${report.pageTitle || '–'}`,
`Маршрут: ${report.route || '–'}`,
`URL: ${report.href || '–'}`,
`Видимость: ${report.pageVisibility || '–'}`,
`Время: ${new Date(Number(report.clientTs || Date.now())).toISOString()}`,
`UA: ${report.userAgent || '–'}`,
`Экран: ${report.viewport ? `${report.viewport.width}x${report.viewport.height} @${report.viewport.dpr || 1}x` : '–'}`,
`Монитор: ${report.screenInfo ? `${report.screenInfo.width}x${report.screenInfo.height}` : '–'}`,
`Источник: ${report.sourceUrl || '–'}`,
`Строка: ${Number.isFinite(report.lineNumber) ? report.lineNumber : '–'}`,
`Колонка: ${Number.isFinite(report.columnNumber) ? report.columnNumber : '–'}`,
`Тип причины: ${report.reasonType || '–'}`,
];
if (report.stack) {
lines.push('Stack:', report.stack);
}
if (report.lastKnownClientError) {
lines.push('Последняя известная ошибка:', JSON.stringify(report.lastKnownClientError, null, 2));
}
if (report.contextJson) {
lines.push('Контекст:', report.contextJson);
}
return lines.join('\n');
};
const copyText = async (text) => {
const value = String(text || '');
if (!value) return false;
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(value);
return true;
}
const ta = document.createElement('textarea');
ta.value = value;
ta.setAttribute('readonly', 'readonly');
ta.style.position = 'fixed';
ta.style.opacity = '0';
ta.style.pointerEvents = 'none';
document.body.append(ta);
ta.focus();
ta.select();
const ok = document.execCommand('copy');
ta.remove();
return !!ok;
};
const removeMenu = () => {
try {
document.getElementById(menuId)?.remove();
} catch {}
};
const dismissError = () => {
removeMenu();
try {
document.getElementById('boot-error-overlay')?.remove();
setState(null);
} catch {}
};
const openMenu = () => {
try {
removeMenu();
document.dispatchEvent(new CustomEvent('shine:dropdown-open', { detail: { owner: 'boot-error' } }));
const report = buildReport();
const root = document.getElementById('modal-root') || document.body;
const shell = document.createElement('div');
shell.id = menuId;
shell.className = 'modal-shell boot-error-menu-shell';
// Меню диагностики должно быть над аварийным экраном.
shell.style.zIndex = '1000000';
shell.innerHTML = `
<div class="modal-backdrop" data-action="close"></div>
<div class="modal-dialog boot-error-menu-dialog" role="dialog" aria-modal="true" aria-labelledby="boot-error-menu-title" tabindex="-1">
<div class="modal-card stack boot-error-menu-card">
<strong class="modal-title" id="boot-error-menu-title">Описание ошибки</strong>
<p class="meta-muted boot-error-menu-message">${escapeText(report.message || report.title || 'Ошибка')}</p>
<button type="button" class="secondary-btn" data-action="copy">Скопировать текст ошибки</button>
<button type="button" class="secondary-btn" data-action="share">Отправить текст ошибки</button>
<button type="button" class="secondary-btn" data-action="send"${typeof window.__SHINE_SEND_CLIENT_ERROR_TO_SERVER__ === 'function' ? '' : ' disabled'}>Отправить в лог на сервере</button>
<button type="button" class="secondary-btn" data-action="dismiss">Закрыть</button>
</div>
</div>
`;
root.append(shell);
const dialog = shell.querySelector('.modal-dialog');
const close = () => {
window.removeEventListener('keydown', onKeyDown);
shell.remove();
};
const onKeyDown = (event) => {
if (event.key === 'Escape') {
event.preventDefault();
close();
}
};
shell.addEventListener('click', (event) => {
if (event.target === shell || event.target?.dataset?.action === 'close') {
close();
}
});
shell.querySelector('[data-action="copy"]')?.addEventListener('click', async () => {
try {
await copyText(formatReportText(report));
showFeedback('Описание ошибки скопировано');
} catch {
showFeedback('Не удалось скопировать описание ошибки', 'error');
}
close();
});
shell.querySelector('[data-action="share"]')?.addEventListener('click', async () => {
try {
const shared = await shareErrorText(report);
if (shared === false) return close();
showFeedback('Текст ошибки открыт для отправки');
} catch (error) {
showFeedback(error?.message || 'Не удалось открыть системное меню отправки', 'error');
}
close();
});
shell.querySelector('[data-action="send"]')?.addEventListener('click', async () => {
try {
const sender = window.__SHINE_SEND_CLIENT_ERROR_TO_SERVER__;
if (typeof sender !== 'function') {
throw new Error('Отправка в лог на сервере недоступна');
}
const ok = await sender(buildSendPayload(report));
if (!ok) {
throw new Error('Не удалось отправить ошибку в лог на сервере');
}
setState({ ...(getState() || {}), sentToServer: true });
updateBootOverlay();
showFeedback('Ошибка отправлена в лог на сервере');
} catch (error) {
showFeedback(error?.message || 'Не удалось отправить ошибку в лог на сервере', 'error');
}
close();
});
shell.querySelector('[data-action="dismiss"]')?.addEventListener('click', () => {
close();
try {
document.getElementById('boot-error-overlay')?.remove();
setState(null);
} catch {}
});
const onPeerDropdownOpen = (event) => {
if (event?.detail?.owner === 'boot-error') return;
close();
};
document.addEventListener('shine:dropdown-open', onPeerDropdownOpen, { once: true });
dialog?.focus?.();
window.addEventListener('keydown', onKeyDown);
} catch (error) {
console.warn('boot error menu failed', error);
}
};
// Краткая безопасная причина для скриншота. Исходный stack и произвольный
// текст исключения доступны в меню диагностики, но не на публичном экране.
const explainBootFailure = (state) => {
const message = String(state.message || '');
const reason = String(state.reasonType || '');
if (/failed to (fetch|load|import)|module script|importing a module|networkerror|loading chunk/i.test(message)) {
return 'Не удалось загрузить модуль приложения.';
}
if (/syntaxerror|unexpected token|unexpected identifier|unexpected end of input/i.test(`${reason} ${message}`)) {
return 'Ошибка синтаксиса JavaScript.';
}
if (/referenceerror|is not defined/i.test(`${reason} ${message}`)) {
return 'Отсутствует необходимая функция или переменная.';
}
if (/typeerror|cannot read properties|is not a function/i.test(`${reason} ${message}`)) {
return 'Ошибка выполнения JavaScript (TypeError).';
}
if (state.kind === 'unhandled_rejection') {
return 'Не удалось завершить операцию при запуске.';
}
return 'Техническая ошибка при запуске приложения.';
};
const bootSourceHint = (state) => {
let filename = '';
try {
const path = new URL(String(state.sourceUrl || ''), window.location.origin).pathname;
const candidate = path.split('/').pop() || '';
if (/^[a-zA-Z0-9_.-]{1,80}$/.test(candidate)) filename = candidate;
} catch {}
const line = Number.isSafeInteger(state.lineNumber) && state.lineNumber > 0
? state.lineNumber : null;
return filename ? `Источник: ${filename}${line ? `:${line}` : ''}` : '';
};
const updateBootOverlay = () => {
const el = document.getElementById('boot-error-overlay');
const state = getState();
if (!el || !state) return;
const cause = el.querySelector('[data-boot-error="cause"]');
const source = el.querySelector('[data-boot-error="source"]');
const status = el.querySelector('[data-boot-error="status"]');
if (cause) cause.textContent = `Причина: ${explainBootFailure(state)}`;
if (source) {
source.textContent = bootSourceHint(state);
source.hidden = !source.textContent;
}
if (status) status.textContent = state.sentToServer === true
? 'Отчёт об ошибке принят сервером.'
: 'Отправка отчёта не подтверждена. Пришлите скриншот этого окна.';
};
const show = (title, text, extra = {}) => {
try {
const reportState = {
kind: safeString(extra.kind || title || 'boot_error', 64),
title: safeString(title || 'BOOT ERROR', 128),
message: safeString(extra.message || text || '', 500),
stack: safeString(extra.stack || '', 8000),
sourceUrl: safeString(extra.sourceUrl || extra.filename || '', 240),
lineNumber: Number.isFinite(extra.lineNumber) ? extra.lineNumber : (Number.isFinite(extra.lineno) ? extra.lineno : null),
columnNumber: Number.isFinite(extra.columnNumber) ? extra.columnNumber : (Number.isFinite(extra.colno) ? extra.colno : null),
reasonType: safeString(extra.reasonType || '', 64),
clientTs: Number.isFinite(extra.clientTs) ? extra.clientTs : Date.now(),
sentToServer: false,
};
setState(reportState);
let el = document.getElementById('boot-error-overlay');
if (!el) {
const light = document.documentElement.dataset.theme === 'light';
const surface = light ? '#ffffff' : '#1c1f27';
const text = light ? '#20222c' : '#f1f1f5';
const secondary = light ? '#666977' : '#a8abb8';
const border = light ? '#dedee5' : '#303440';
const accent = light ? '#4d447c' : '#b8aef5';
const accentText = light ? '#ffffff' : '#211c34';
el = document.createElement('div');
el.id = 'boot-error-overlay';
el.setAttribute('role', 'alert');
el.setAttribute('aria-label', 'Ошибка запуска приложения');
// Стили встроены специально: аварийный экран виден даже без CSS.
el.style.cssText = 'position:fixed;inset:0;z-index:999999;box-sizing:border-box;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(0,0,0,.48);visibility:visible;font-family:system-ui,-apple-system,sans-serif;';
const card = document.createElement('section');
card.style.cssText = `box-sizing:border-box;width:min(100%,440px);max-height:calc(100dvh - 40px);overflow:auto;padding:22px;border:1px solid var(--border-subtle,${border});border-radius:14px;background:var(--surface,${surface});color:var(--text-primary,${text});box-shadow:0 14px 42px rgba(0,0,0,.20);`;
const heading = document.createElement('strong');
heading.textContent = 'Не удалось запустить SHiNE';
heading.style.cssText = 'display:block;font-size:18px;line-height:1.4;font-weight:600;margin-bottom:10px;';
const intro = document.createElement('p');
intro.textContent = 'При загрузке возникла ошибка. Попробуйте обновить страницу.';
intro.style.cssText = 'margin:0 0 12px;font-size:14px;line-height:1.5;';
const cause = document.createElement('p');
cause.dataset.bootError = 'cause';
cause.style.cssText = `margin:0 0 4px;font-size:13px;line-height:1.5;color:var(--text-secondary,${secondary});overflow-wrap:anywhere;`;
const source = document.createElement('p');
source.dataset.bootError = 'source';
source.style.cssText = `margin:0 0 12px;font-size:12px;line-height:1.5;color:var(--text-secondary,${secondary});overflow-wrap:anywhere;`;
const status = document.createElement('p');
status.dataset.bootError = 'status';
status.style.cssText = `margin:0 0 18px;font-size:12px;line-height:1.5;color:var(--text-secondary,${secondary});`;
const actions = document.createElement('div');
actions.style.cssText = 'display:flex;flex-wrap:wrap;gap:10px;';
const button = (label, primary) => {
const result = document.createElement('button');
result.type = 'button';
result.textContent = label;
result.style.cssText = `flex:1 1 130px;min-height:42px;padding:10px;border:1px solid var(--border-control,${border});border-radius:10px;font:inherit;font-size:14px;font-weight:600;cursor:pointer;background:${primary ? `var(--accent,${accent})` : `var(--surface,${surface})`};color:${primary ? `var(--on-accent,${accentText})` : `var(--text-primary,${text})`};`;
return result;
};
const retry = button('Обновить страницу', true);
retry.addEventListener('click', () => window.location.reload());
const details = button('Подробности', false);
details.addEventListener('click', openMenu);
actions.append(retry, details);
card.append(heading, intro, cause, source, status, actions);
el.appendChild(card);
document.body.appendChild(el);
}
updateBootOverlay();
} catch (error) {
console.warn('boot error overlay failed', error);
}
};
window.addEventListener('error', (e) => {
// После запуска приложения ошибки обрабатывает единый client-error-reporter.
if (window.__SHINE_APP_ERROR_HANDLERS_READY__ === true) return;
// Предупреждение браузера о переносе замеров ResizeObserver на следующий кадр – не ошибка
if (/^ResizeObserver loop/.test(String(e?.message || ''))) return;
show('window.error', `${e?.message || ''}\n${e?.filename || ''}:${e?.lineno || ''}:${e?.colno || ''}`, {
kind: 'window_error',
message: e?.message || '',
stack: e?.error?.stack || '',
sourceUrl: e?.filename || '',
lineNumber: e?.lineno,
columnNumber: e?.colno,
reasonType: e?.error?.constructor?.name || e?.constructor?.name || 'ErrorEvent',
});
});
window.addEventListener('unhandledrejection', (e) => {
if (window.__SHINE_APP_ERROR_HANDLERS_READY__ === true) return;
const reason = e?.reason;
show('unhandledrejection', reason?.stack || reason?.message || String(reason || 'unknown'), {
kind: 'unhandled_rejection',
message: reason?.message || String(reason || 'Unhandled promise rejection'),
stack: reason?.stack || '',
reasonType: reason?.constructor?.name || typeof reason,
});
});
}());
</script>
<script>
(async function attachAppWithBuildHash() {
const isLocalPreview = ['localhost', '127.0.0.1', '::1'].includes(String(window.location.hostname || '').toLowerCase());
if (isLocalPreview && 'serviceWorker' in navigator) {
try {
const registrations = await navigator.serviceWorker.getRegistrations();
await Promise.all(registrations.map((registration) => registration.unregister()));
} catch {}
}
const v = encodeURIComponent(window.__SHINE_BUILD_HASH__ || 'dev');
const script = document.createElement('script');
script.type = 'module';
script.src = isLocalPreview ? `./js/app.js?v=${v}&local=${Date.now()}` : `./js/app.js?v=${v}`;
document.body.appendChild(script);
}());
</script>
</body>
</html>