ray-template/apps/admin/index.html

348 lines
9.4 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/ray.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= siteInfo.title %></title>
<meta name="description" content="<%= siteInfo.description %>" />
<meta name="color-scheme" content="light dark" />
<script>
// 入口依赖可能在 main.ts 执行前失败;捕获不冒泡的模块加载错误和窗口求值错误。
window.addEventListener(
'error',
function handleStartupError(event) {
const splash = document.getElementById('pre-loading-animation')
if (!splash) {
window.removeEventListener('error', handleStartupError, true)
return
}
if (
event instanceof ErrorEvent ||
(event.target instanceof HTMLScriptElement &&
event.target.type === 'module')
) {
splash.setAttribute('data-state', 'failed')
}
},
true,
)
try {
const settings = JSON.parse(
localStorage.getItem('<%= storageKeys.appPiniaSettingStore %>') ||
'null',
)
document.documentElement.dataset.bootStyle = [
'plain',
'naive',
'material',
].includes(settings?.themeStyle)
? settings.themeStyle
: 'modern'
const mode = settings?.appTheme
if (mode !== 'auto') {
const dark =
mode === 'dark' || (mode == null && settings?._appTheme === true)
document.documentElement.classList.add(
dark ? 'r-template--dark' : 'r-template--light',
)
}
} catch {}
try {
if (
localStorage.getItem('<%= storageKeys.localeLanguage %>') ===
'"en-US"'
) {
document.documentElement.lang = 'en-US'
}
} catch {}
</script>
<style>
html.r-template--dark {
color-scheme: dark;
}
html.r-template--light {
color-scheme: light;
}
.ray-boot {
--boot-canvas: light-dark(#f5f7fb, #101722);
--boot-surface: light-dark(#fff, #172131);
--boot-line: light-dark(#e4e9f1, #2c394d);
--boot-text: light-dark(#1d2a3e, #e9eef7);
--boot-muted: light-dark(#52647c, #b3c0d3);
--boot-accent: light-dark(#3b63d9, #aabaff);
--boot-radius: 20px;
--boot-shadow: 0 2px 6px rgb(0 0 0 / 3%);
position: fixed;
z-index: 1;
inset: 0;
display: grid;
place-items: center;
padding: 24px;
color: CanvasText;
color: var(--boot-text);
background: Canvas;
background: var(--boot-canvas);
font:
400 14px / 1.5 system-ui,
sans-serif;
text-align: center;
}
html[data-boot-style='plain'] .ray-boot {
--boot-canvas: light-dark(#f5f5f5, #161616);
--boot-surface: light-dark(#fff, #202020);
--boot-line: light-dark(#e0e0e0, #383838);
--boot-text: light-dark(#252525, #ededed);
--boot-muted: light-dark(#616161, #b9b9b9);
--boot-accent: light-dark(#454545, #d5d5d5);
--boot-radius: 2px;
--boot-shadow: none;
}
html[data-boot-style='naive'] .ray-boot {
--boot-canvas: light-dark(#fff, #101014);
--boot-surface: light-dark(#fff, #18181c);
--boot-line: light-dark(#efeff5, #343438);
--boot-text: light-dark(#333639, #f0f0f0);
--boot-muted: light-dark(#666970, #b5b5b8);
--boot-accent: light-dark(#18a058, #63e2b7);
--boot-radius: 4px;
--boot-shadow: none;
}
html[data-boot-style='material'] .ray-boot {
--boot-canvas: light-dark(#f5f1fa, #16121c);
--boot-surface: light-dark(#fffaff, #241e2c);
--boot-line: light-dark(#e1d8ea, #473c52);
--boot-text: light-dark(#201a29, #f1e7fa);
--boot-muted: light-dark(#433a50, #ded0e8);
--boot-accent: light-dark(#655292, #d6bbff);
--boot-radius: 28px;
}
.ray-boot__content {
animation: ray-boot-reveal 320ms ease-out both;
}
.ray-boot__brand {
display: grid;
place-items: center;
inline-size: 80px;
block-size: 80px;
margin: 0 auto 22px;
border: 1px solid var(--boot-line);
border-radius: var(--boot-radius);
background: var(--boot-surface);
box-shadow: var(--boot-shadow);
}
.ray-boot__mark {
display: block;
}
.ray-boot__title {
display: block;
font-size: 24px;
font-weight: 600;
letter-spacing: -0.035em;
}
.ray-boot__label {
margin: 14px 0 0;
color: inherit;
color: var(--boot-muted);
font-size: 12px;
letter-spacing: 0.015em;
}
.ray-boot__track {
display: block;
position: relative;
overflow: hidden;
inline-size: 112px;
block-size: 2px;
margin: 24px auto 0;
border-radius: 1px;
background: currentColor;
background: var(--boot-line);
}
.ray-boot__track::after {
position: absolute;
inset-block: 0;
inset-inline-start: 0;
inline-size: 40%;
border-radius: inherit;
background: Highlight;
background: var(--boot-accent);
animation: ray-boot-sweep 1.4s ease-in-out infinite alternate;
content: '';
}
@keyframes ray-boot-sweep {
from {
transform: translateX(0);
}
to {
transform: translateX(150%);
}
}
@keyframes ray-boot-reveal {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.ray-boot progress {
position: absolute;
inline-size: 1px;
block-size: 1px;
clip-path: inset(50%);
}
.ray-boot__failure,
.ray-boot [lang='en-US'] {
display: none;
}
html:lang(en) .ray-boot [lang='zh-CN'] {
display: none;
}
html:lang(en) .ray-boot [lang='en-US'] {
display: inline;
}
.ray-boot[data-state='failed'] .ray-boot__pending {
display: none;
}
.ray-boot[data-state='failed'] .ray-boot__failure {
display: block;
}
.ray-boot__retry {
margin-block-start: 12px;
padding: 5px 12px;
border: 1px solid currentColor;
border-radius: 6px;
background: transparent;
color: inherit;
font: inherit;
cursor: pointer;
}
.ray-boot__retry:focus-visible {
outline: 2px solid var(--boot-accent);
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.ray-boot__content {
animation: none;
}
.ray-boot__track::after {
animation-duration: 6s;
}
}
@media (forced-colors: active) {
.ray-boot {
color: CanvasText;
background: Canvas;
}
.ray-boot__brand {
border-color: ButtonBorder;
background: Canvas;
box-shadow: none;
}
.ray-boot__label {
color: CanvasText;
}
.ray-boot__track {
border-block-end: 2px solid GrayText;
}
.ray-boot__track::after {
border-block-end: 2px solid Highlight;
}
}
</style>
<noscript>
<style>
#pre-loading-animation {
display: none;
}
</style>
</noscript>
</head>
<body>
<div id="app"></div>
<noscript>
<main>
<h1><%= siteInfo.title %></h1>
<p><%= siteInfo.description %></p>
<p>启用 JavaScript 后可体验在线演示。</p>
<p>
<a href="<%= siteInfo.repository %>">GitHub 源码</a>
·
<a href="<%= siteInfo.repository %>/blob/main/README.zh-CN.md"
>中文使用指南</a
>
</p>
</main>
</noscript>
<div id="pre-loading-animation" class="ray-boot">
<div class="ray-boot__content">
<span class="ray-boot__brand">
<img
class="ray-boot__mark"
src="/ray.svg"
width="48"
height="48"
alt=""
/>
</span>
<strong class="ray-boot__title"><%= preloadingConfig.title %></strong>
<div class="ray-boot__pending">
<span class="ray-boot__track" aria-hidden="true"></span>
<p class="ray-boot__label" id="ray-boot-label">
<span lang="zh-CN">正在载入工作区</span>
<span lang="en-US">Loading your workspace</span>
</p>
<progress aria-labelledby="ray-boot-label"></progress>
</div>
<div class="ray-boot__failure" role="alert">
<p class="ray-boot__label">
<span lang="zh-CN">工作区未能启动</span>
<span lang="en-US">The workspace could not start</span>
</p>
<button
class="ray-boot__retry"
type="button"
onclick="location.reload()"
>
<span lang="zh-CN">重新加载</span>
<span lang="en-US">Reload</span>
</button>
</div>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>