first commit

This commit is contained in:
cnluminous committed 2026-10-27 11:53:04 +08:00
commit f88225469b
20 files changed
+1474

No files matched your search

+190
View File
@@ -0,0 +1,190 @@
import './style.css'
import { escapeHtml, resolveSiteConfig } from './site-config.js'
const site = resolveSiteConfig(import.meta.env, window.__SITE_CONFIG__)
document.title = site.title
for (const [selector, content] of [
['meta[name="description"]', site.metaDescription],
['meta[property="og:title"]', site.title],
['meta[property="og:description"]', site.metaDescription],
]) {
document.querySelector(selector).content = content
}
function registrationItem(number, url) {
if (!number) return ''
return url
? `<a href="${escapeHtml(url)}" target="_blank" rel="noopener noreferrer">${escapeHtml(number)}</a>`
: `<span>${escapeHtml(number)}</span>`
}
const registrationItems = registrationItem(site.icpNumber, site.icpUrl)
+ registrationItem(site.publicSecurityNumber, site.publicSecurityUrl)
const arrow = '<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'
const spark = '<svg viewBox="0 0 40 40" fill="none" aria-hidden="true"><path d="M20 2v36M2 20h36M7.3 7.3l25.4 25.4M7.3 32.7 32.7 7.3" stroke="currentColor" stroke-width="6"/></svg>'
document.querySelector('#app').innerHTML = `
<a class="skip-link" href="#main">跳至主要内容</a>
<div class="page-shell">
<header class="site-header">
<a class="brand" href="#" aria-label="${escapeHtml(site.projectName)},首页" title="${escapeHtml(site.projectName)}">
<span class="brand-symbol">${spark}</span>
<span class="brand-name">${escapeHtml(site.projectName)}${site.projectNameEn ? `<span>${escapeHtml(site.projectNameEn)}</span>` : ''}</span>
</a>
<span class="header-note">${escapeHtml(site.headerNote)}</span>
<div class="availability"><span class="status-dot"></span>即将上线 · 敬请期待</div>
</header>
<main id="main">
<section class="hero" aria-labelledby="hero-title">
<div class="hero-copy">
<p class="eyebrow"><span></span> A LITTLE PATIENCE. A LOT TO LOOK FORWARD TO.</p>
<h1 id="hero-title">美好的事,<br>即将<span class="headline-accent">发生<svg viewBox="0 0 240 17" fill="none" aria-hidden="true"><path d="M3 11C60 0 154-1 237 8M24 15c53-6 121-9 186-5" stroke="currentColor" stroke-width="3" stroke-linecap="round"/></svg></span>。</h1>
<p class="hero-description">${escapeHtml(site.description).replace(/\r?\n/g, '<br>')}</p>
<div class="hero-actions">
<button class="share-button" id="share-button" type="button"><span>分享这份期待</span>${arrow}</button>
<a class="progress-link" href="#progress">看看我们在做什么<span aria-hidden="true">↘</span></a>
</div>
<div class="hero-footnote"><span class="tiny-star">✳</span><span>好东西,值得等一等。</span></div>
</div>
<figure class="artwork" aria-label="一颗被椭圆轨道环绕的橙色星球,象征正在酝酿的新想法">
<div class="artwork-coordinate coordinate-top" aria-hidden="true">IDEAS IN ORBIT</div>
<div class="orbital-system" aria-hidden="true">
<div class="orbit orbit-back"></div>
<div class="planet">
<div class="planet-lines"></div>
<div class="planet-grain"></div>
</div>
<div class="orbit orbit-front"></div>
<div class="satellite-track"><span class="satellite"></span></div>
<span class="artwork-spark spark-one">${spark}</span>
<span class="artwork-spark spark-two">+</span>
<span class="artwork-dot dot-one"></span>
<span class="artwork-dot dot-two"></span>
</div>
<figcaption><span class="figure-number">FIG. 001</span><span>让想象,慢慢成形。</span><span class="figure-plus" aria-hidden="true">+</span></figcaption>
</figure>
</section>
<section class="progress-section" id="progress" aria-labelledby="progress-title">
<div class="progress-intro"><span class="section-index">01 / WHAT'S NEXT</span><h2 id="progress-title">每一步,都离见面更近。</h2></div>
<ol class="milestones">
<li class="milestone milestone-complete"><span class="milestone-icon" aria-hidden="true"><svg viewBox="0 0 20 20" fill="none"><path d="m5 10 3.3 3.3L15 6.7" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></span><div><h3>从一个想法开始</h3><p>让灵感有了方向</p></div><span class="milestone-tag">已启程</span></li>
<li class="milestone milestone-current"><span class="milestone-icon" aria-hidden="true"><span></span></span><div><h3>把细节变成惊喜</h3><p>用心打磨,渐入佳境</p></div><span class="milestone-tag"><span class="status-dot"></span>进行中</span></li>
<li class="milestone milestone-next"><span class="milestone-icon" aria-hidden="true">${arrow}</span><div><h3>然后,与你相遇</h3><p>敬请期待正式上线</p></div><span class="milestone-tag">即将到来</span></li>
</ol>
</section>
</main>
<footer class="site-footer">
<div class="footer-info">
<span class="footer-copyright">${escapeHtml(site.copyright)}${site.copyright && site.footerNote ? '<span class="footer-divider">/</span>' : ''}${escapeHtml(site.footerNote)}</span>
${registrationItems ? `<div class="footer-registration" aria-label="网站备案信息">${registrationItems}</div>` : ''}
</div>
<span class="footer-message">保持好奇。<span class="footer-spark">${spark}</span>我们很快见。</span>
<div class="local-clock"><span class="status-dot"></span><span>北京时间</span><time id="clock" aria-label="当前北京时间"></time></div>
</footer>
</div>
<div class="toast" id="toast" role="status" aria-live="polite" aria-atomic="true"></div>
<dialog class="share-dialog" id="share-dialog" aria-labelledby="share-title">
<button class="dialog-close" id="dialog-close" type="button" aria-label="关闭分享窗口">×</button>
<span class="dialog-spark">${spark}</span>
<h2 id="share-title">把期待,传递出去。</h2>
<p>复制下方链接,分享给同样保持好奇的人。</p>
<label for="share-url">页面链接</label>
<input id="share-url" type="url" readonly>
<button class="share-button" id="dialog-copy" type="button"><span>复制链接</span>${arrow}</button>
<p class="dialog-hint" id="dialog-hint" role="status" aria-live="polite"></p>
</dialog>
`
const clock = document.querySelector('#clock')
const timeFormatter = new Intl.DateTimeFormat('en-GB', {
timeZone: 'Asia/Shanghai',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
})
function updateClock() {
const now = new Date()
clock.textContent = timeFormatter.format(now)
clock.dateTime = now.toISOString()
}
updateClock()
setInterval(updateClock, 1000)
let toastTimeout
function showToast(message) {
const toast = document.querySelector('#toast')
clearTimeout(toastTimeout)
toast.textContent = message
toast.classList.add('is-visible')
toastTimeout = setTimeout(() => toast.classList.remove('is-visible'), 3500)
}
const shareDialog = document.querySelector('#share-dialog')
const shareInput = document.querySelector('#share-url')
const shareUrl = new URL(window.location.href)
shareUrl.hash = ''
shareInput.value = shareUrl.href
async function copyLink() {
if (!navigator.clipboard?.writeText) return false
try {
await navigator.clipboard.writeText(shareUrl.href)
return true
} catch {
return false
}
}
document.querySelector('#share-button').addEventListener('click', async () => {
if (navigator.share) {
try {
await navigator.share({
title: site.title,
text: site.metaDescription,
url: shareUrl.href,
})
return
} catch (error) {
if (error.name === 'AbortError') return
}
}
if (await copyLink()) {
showToast('链接已复制,把这份期待分享出去吧。')
} else {
document.querySelector('#dialog-hint').textContent = ''
shareDialog.showModal()
shareInput.focus()
shareInput.select()
}
})
document.querySelector('#dialog-copy').addEventListener('click', async () => {
if (await copyLink()) {
shareDialog.close()
showToast('链接已复制,把这份期待分享出去吧。')
} else {
shareInput.focus()
shareInput.select()
const shortcut = /Mac|iPhone|iPad/.test(navigator.userAgent) ? '⌘ C' : 'Ctrl + C'
document.querySelector('#dialog-hint').textContent = `链接已选中,请按 ${shortcut} 或长按链接复制。`
}
})
document.querySelector('#dialog-close').addEventListener('click', () => shareDialog.close())
shareDialog.addEventListener('click', (event) => {
if (event.target !== shareDialog) return
const rect = shareDialog.getBoundingClientRect()
if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) {
shareDialog.close()
}
})