Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

Polish Narratage docs and interactive demos

rpone1fe82b3c0559
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 54e8ac40..ed8703da 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -1,5 +1,27 @@
import { defineConfig } from "vitepress";
+const noctisBordo = {
+ name: "narratage-noctis-bordo",
+ type: "dark" as const,
+ colors: {
+ "editor.background": "#322A2D",
+ "editor.foreground": "#CBBEC2",
+ },
+ settings: [
+ { settings: { background: "#322A2D", foreground: "#CBBEC2" } },
+ { scope: ["comment", "punctuation.definition.comment"], settings: { foreground: "#715B63" } },
+ { scope: ["string", "string.quoted", "punctuation.definition.string"], settings: { foreground: "#49E9A6" } },
+ { scope: ["keyword", "storage", "storage.type", "storage.modifier"], settings: { foreground: "#E66533" } },
+ { scope: ["entity.name.tag", "punctuation.definition.tag", "meta.tag punctuation"], settings: { foreground: "#E66533" } },
+ { scope: ["entity.other.attribute-name", "support.type.property-name", "variable.other.property"], settings: { foreground: "#D5971A" } },
+ { scope: ["constant", "constant.numeric", "constant.language", "constant.character"], settings: { foreground: "#E4B781" } },
+ { scope: ["entity.name.function", "support.function", "meta.function-call"], settings: { foreground: "#49D6E9" } },
+ { scope: ["entity.name.type", "entity.name.class", "support.class", "support.type"], settings: { foreground: "#7060EB" } },
+ { scope: ["variable", "identifier"], settings: { foreground: "#CBBEC2" } },
+ { scope: ["invalid", "invalid.illegal"], settings: { foreground: "#FFB3CD" } },
+ ],
+};
+
export default defineConfig({
base: "/docs/",
title: "Narratage",
@@ -7,6 +29,10 @@ export default defineConfig({
appearance: false,
cleanUrls: true,
markdown: {
+ theme: {
+ light: noctisBordo,
+ dark: noctisBordo,
+ },
languageAlias: {
svml: "xml",
svk: "xml",
@@ -15,18 +41,26 @@ export default defineConfig({
},
},
head: [
- ["meta", { name: "theme-color", content: "#4A2E25" }],
+ ["meta", { name: "theme-color", content: "#2C2126" }],
["link", { rel: "preconnect", href: "https://fonts.googleapis.com" }],
["link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "" }],
[
"link",
{
rel: "stylesheet",
- href: "https://fonts.googleapis.com/css2?family=Cutive+Mono&family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700&family=Newsreader:opsz,[email protected],400;6..72,500;6..72,600;6..72,700&display=swap",
+ href: "https://fonts.googleapis.com/css2?family=Cutive+Mono&family=Google+Sans+Code:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&family=Newsreader:opsz,[email protected],400;6..72,500;6..72,600;6..72,700&display=swap",
+ },
+ ],
+ [
+ "link",
+ {
+ rel: "stylesheet",
+ href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20,400,0,0",
},
],
],
themeConfig: {
+ siteTitle: "NARRATAGE",
nav: [
{ text: "快速开始", link: "/quickstart" },
{ text: "开发指南", link: "/guide/components" },
diff --git a/docs/.vitepress/theme/components/SemanticVideoDemo.vue b/docs/.vitepress/theme/components/SemanticVideoDemo.vue
index 59946ea0..8eddbcfc 100644
--- a/docs/.vitepress/theme/components/SemanticVideoDemo.vue
+++ b/docs/.vitepress/theme/components/SemanticVideoDemo.vue
@@ -2,6 +2,7 @@
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
import {
demoAudioEnabled as audioEnabled,
+ demoAudioPlaybackEnabled as audioPlaybackEnabled,
enableDemoAudioAfterInteraction,
initializeDemoAudio,
toggleDemoAudio,
@@ -98,6 +99,7 @@ const rangeGeometry = ref<Record<string, { path: string; depth: number }>>({});
const baseVideos: HTMLVideoElement[] = [];
const overlayVideos: HTMLVideoElement[] = [];
let resizeObserver: ResizeObserver | null = null;
+let rangeMutationObserver: MutationObserver | null = null;
let animationFrame = 0;
let previousTimestamp = 0;
let programTime = 0;
@@ -239,6 +241,8 @@ function updateRangeGeometry() {
if (!container) return;
const containerRect = container.getBoundingClientRect();
const width = container.clientWidth;
+ const scaleX = container.offsetWidth ? containerRect.width / container.offsetWidth : 1;
+ const scaleY = container.offsetHeight ? containerRect.height / container.offsetHeight : 1;
const renderedLines = Array.from(container.querySelectorAll<HTMLElement>(":scope > .code-line"));
const lastLine = renderedLines.at(-1);
const height = Math.max(container.clientHeight, lastLine ? lastLine.offsetTop + lastLine.offsetHeight : container.clientHeight);
@@ -251,18 +255,18 @@ function updateRangeGeometry() {
const startLine = startMarker?.closest<HTMLElement>(".code-line");
const endLine = endMarker?.closest<HTMLElement>(".code-line");
if (!startMarker || !endMarker || !startLine || !endLine) continue;
- const startRect = startMarker.getBoundingClientRect();
- const endRect = endMarker.getBoundingClientRect();
- const offsetX = container.scrollLeft - containerRect.left;
- const offsetY = container.scrollTop - containerRect.top;
+ const startFragments = Array.from(startMarker.getClientRects());
+ const endFragments = Array.from(endMarker.getClientRects());
+ const startRect = startFragments[0] ?? startMarker.getBoundingClientRect();
+ const endRect = endFragments.at(-1) ?? endMarker.getBoundingClientRect();
const lineHeight = Number.parseFloat(getComputedStyle(startLine).lineHeight) || 26;
const blockPadding = 0;
- const startCenter = (startRect.top + startRect.bottom) / 2 + offsetY;
- const endCenter = (endRect.top + endRect.bottom) / 2 + offsetY;
+ const startCenter = ((startRect.top + startRect.bottom) / 2 - containerRect.top) / scaleY + container.scrollTop;
+ const endCenter = ((endRect.top + endRect.bottom) / 2 - containerRect.top) / scaleY + container.scrollTop;
const inlinePadding = 3;
const edgeOverhang = 3;
- const startX = Math.max(3, Math.min(width - 3, startRect.left + offsetX - inlinePadding));
- const endX = Math.max(3, Math.min(width - 3, endRect.right + offsetX + inlinePadding));
+ const startX = Math.max(3, Math.min(width - 3, (startRect.left - containerRect.left) / scaleX + container.scrollLeft - inlinePadding));
+ const endX = Math.max(3, Math.min(width - 3, (endRect.right - containerRect.left) / scaleX + container.scrollLeft + inlinePadding));
const left = 44 - edgeOverhang;
const right = width - 12 + edgeOverhang;
const top = startCenter - lineHeight / 2 - blockPadding;
@@ -326,7 +330,7 @@ function syncBaseVideos(force = false) {
const sceneChanged = playbackSceneIndex !== activeIndex;
baseVideos.forEach((video, index) => {
if (!video) return;
- video.muted = !audioEnabled.value || index !== activeIndex;
+ video.muted = !audioPlaybackEnabled.value || index !== activeIndex;
if (index !== activeIndex) {
video.pause();
return;
@@ -397,13 +401,13 @@ function inspectLine(line: DemoSourceLine, index: number) {
return;
}
const selection = config.selections.find((candidate) => candidate.id === id);
- if (selection) seekTo(selection, index);
+ if (selection && pinnedSelection.value !== selection.id) seekTo(selection, index);
}
function inspectToken(event: Event, index: number) {
const target = event.target instanceof Element ? event.target.closest<HTMLElement>("[data-selection]") : null;
const selection = config.selections.find((candidate) => candidate.id === target?.dataset.selection);
- if (selection) seekTo(selection, index);
+ if (selection && pinnedSelection.value !== selection.id) seekTo(selection, index);
}
function clearInspection() {
@@ -545,7 +549,13 @@ const {
watch(
[() => displayedLines.value.map((entry) => entry.key).join("|"), sourceFollowEnabled, sourceSelections],
- () => void nextTick().then(updateLayoutGeometry),
+ () => void nextTick().then(() => {
+ updateSourceViewportRows();
+ void nextTick().then(() => {
+ updateLayoutGeometry();
+ requestAnimationFrame(updateLayoutGeometry);
+ });
+ }),
{ flush: "post" },
);
@@ -571,6 +581,8 @@ onMounted(() => {
if (codeScrollElement.value) {
resizeObserver = new ResizeObserver(updateLayoutGeometry);
resizeObserver.observe(codeScrollElement.value);
+ rangeMutationObserver = new MutationObserver(() => requestAnimationFrame(updateRangeGeometry));
+ rangeMutationObserver.observe(codeScrollElement.value, { childList: true, subtree: true });
}
});
});
@@ -581,6 +593,7 @@ onBeforeUnmount(() => {
window.removeEventListener("keydown", enableAudio, true);
window.removeEventListener("resize", updateLayoutGeometry);
resizeObserver?.disconnect();
+ rangeMutationObserver?.disconnect();
});
</script>
@@ -617,7 +630,7 @@ onBeforeUnmount(() => {
? (sourceFollowEnabled ? "移入查看所有源码" : "移出查看精简视图")
: (sourceFollowEnabled ? "点击代码查看所有源码" : "点击空白处返回精简视图") }}
</div>
- <div ref="codeScrollElement" class="code-scroll" aria-label="SVML source code">
+ <div ref="codeScrollElement" class="code-scroll" aria-label="SVML source code" @scroll="updateRangeGeometry">
<svg
v-if="rangeCanvas.width && rangeCanvas.height"
class="semantic-range-canvas"
@@ -647,6 +660,7 @@ onBeforeUnmount(() => {
:class="{
'binding-active': bindingDepth(entry.line) >= 0,
'binding-depth-1': bindingDepth(entry.line) === 1,
+ 'binding-depth-2': bindingDepth(entry.line) === 2,
}"
@mouseover="inspectLine(entry.line, entry.index!)"
>
@@ -672,7 +686,7 @@ onBeforeUnmount(() => {
:ref="(element) => setBaseVideo(element, index)"
:class="{ active: currentSceneIndex === index }"
:src="resolveDemoMedia(scene.src)"
- :muted="!audioEnabled || currentSceneIndex !== index"
+ :muted="!audioPlaybackEnabled || currentSceneIndex !== index"
playsinline
preload="auto"
@loadedmetadata="syncBaseVideos(true)"
@@ -735,8 +749,7 @@ onBeforeUnmount(() => {
:title="audioEnabled ? '静音' : '取消静音'"
@click.stop="toggleAudio"
>
- <svg v-if="audioEnabled" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9v6h4l5 4V5L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.25-3.9v7.8A4.5 4.5 0 0 0 16.5 12zm-2.25-8.6v2.1a7 7 0 0 1 0 13v2.1a9 9 0 0 0 0-17.2z"/></svg>
- <svg v-else viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9v6h4l5 4V5L8 9H4zm12.6 3 2.7-2.7-1.4-1.4-2.7 2.7-2.7-2.7-1.4 1.4 2.7 2.7-2.7 2.7 1.4 1.4-2.7-2.7z"/></svg>
+ <span class="material-symbols-rounded" aria-hidden="true">{{ audioEnabled ? "volume_up" : "volume_off" }}</span>
</button>
</div>
</div>
@@ -777,7 +790,7 @@ onBeforeUnmount(() => {
.street-broll { position: absolute; inset: 0; z-index: 10; display: none; width: 100%; height: 100%; object-fit: cover; }
.street-broll.active { display: block; }
.visual-outline { position: absolute; z-index: 24; pointer-events: none; }
-.street-scene-outline { inset: 4px; border: 1px solid rgba(200,95,125,.92); }
+.street-scene-outline { inset: 4px; border: 1px solid rgba(238,123,98,.92); }
.street-broll-outline { inset: 9px; border: 1px solid rgba(99,216,255,.95); }
.gbb-header { position: absolute; z-index: 8; top: 8.9%; left: 5.8%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7.2%; width: 88.4%; }
.gbb-slot { position: relative; display: grid; justify-items: center; opacity: 1; }
@@ -787,7 +800,7 @@ onBeforeUnmount(() => {
.slot-good strong { color: #ff1749; }
.slot-better strong { color: #ffb300; }
.slot-best strong { color: #00b96b; }
-.gbb-slot.selected::after { content: ""; position: absolute; inset: -4px -2px -5px; border: 1px solid #C85F7D; pointer-events: none; }
+.gbb-slot.selected::after { content: ""; position: absolute; inset: -4px -2px -5px; border: 1px solid #EE7B62; pointer-events: none; }
.gbb-deck { position: absolute; z-index: 12; top: 61.7%; left: 11%; width: 78%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; box-shadow: 0 9px 28px rgba(0,0,0,.28); }
.gbb-deck.selected { outline: 1px solid #63d8ff; outline-offset: 3px; }
.demo-caption { position: absolute; z-index: 30; left: 5%; display: flex; align-items: baseline; justify-content: center; width: 90%; column-gap: 4px; color: #fff; font-family: Arial Black, Poppins, Inter, sans-serif; font-size: 16px; font-weight: 900; line-height: 1.08; text-align: center; white-space: nowrap; pointer-events: none; -webkit-text-stroke: .75px #000; paint-order: stroke fill; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
@@ -797,14 +810,14 @@ onBeforeUnmount(() => {
.demo-caption span.active { color: #ffd34d; transform: scale(1.08); }
.demo-progress-track { display: flex; grid-template-columns: none; gap: 0; background: transparent; }
.demo-progress-labels { gap: 2px; }
-.demo-progress-track .segment { min-width: 0; height: 100%; flex-basis: 0; border-radius: 0; box-shadow: inset -1px 0 rgba(11,13,16,.55); transition: filter .2s ease; }
+.demo-progress-track .segment { min-width: 0; height: 100%; flex-basis: 0; border-radius: 0; box-shadow: inset -1px 0 #1F191B; transition: box-shadow .2s ease; }
.demo-progress-track .segment:first-child { border-radius: 3px 0 0 3px; }
.demo-progress-track .segment:nth-child(4) { border-radius: 0 3px 3px 0; box-shadow: none; }
-.demo-progress-track .segment:nth-child(1) { background: #31add0; }
-.demo-progress-track .segment:nth-child(2) { background: rgb(132,198,84); }
-.demo-progress-track .segment:nth-child(3) { background: rgb(234,220,42); }
-.demo-progress-track .segment:nth-child(4) { background: #ff3f56; }
-.demo-progress-track .segment.active { filter: brightness(1.2); }
+.demo-progress-track .segment:nth-child(1) { background: var(--demo-segment-cyan); }
+.demo-progress-track .segment:nth-child(2) { background: var(--demo-segment-green); }
+.demo-progress-track .segment:nth-child(3) { background: var(--demo-segment-gold); }
+.demo-progress-track .segment:nth-child(4) { background: var(--demo-segment-pink); }
+.demo-progress-track .segment.active { box-shadow: inset 0 -2px var(--demo-cursor), inset -1px 0 #1F191B; }
@media (max-width: 900px) {
.semantic-live-stage { height: 520px; }
diff --git a/docs/.vitepress/theme/components/SvmlDemoCarousel.vue b/docs/.vitepress/theme/components/SvmlDemoCarousel.vue
index e836f2dc..8f9b3afe 100644
--- a/docs/.vitepress/theme/components/SvmlDemoCarousel.vue
+++ b/docs/.vitepress/theme/components/SvmlDemoCarousel.vue
@@ -194,45 +194,48 @@ onBeforeUnmount(() => { activationId += 1; });
</template>
<style scoped>
-.svml-demo-carousel { width: 100%; }
-.demo-carousel-stage { display: grid; width: 100%; overflow: hidden; perspective: 1600px; }
-.carousel-heading { width: calc(100% - 64px); margin-right: 64px; margin-left: 0; }
-.demo-card { position: relative; grid-area: 1 / 1; justify-self: center; width: calc(100% - 64px); overflow: hidden; border-radius: 2px; transform-origin: center center; will-change: transform, opacity, filter; transition: transform 850ms cubic-bezier(.16,1,.3,1), opacity 650ms cubic-bezier(.16,1,.3,1), filter 650ms cubic-bezier(.16,1,.3,1); }
+.svml-demo-carousel { width: calc(100% - 128px); max-width: 1180px; margin: 0 auto; padding: 48px 32px 96px; overflow: visible; box-sizing: border-box; }
+.demo-carousel-stage { display: grid; width: min(100%, 1000px); overflow: visible; perspective: 1600px; }
+.carousel-heading { width: min(100%, 1000px); margin-right: 0; margin-left: 0; }
+.demo-card { position: relative; grid-area: 1 / 1; justify-self: center; width: 100%; overflow: hidden; border-radius: 2px; background: #272022; transform-origin: center center; will-change: transform, opacity, filter; transition: transform 850ms cubic-bezier(.16,1,.3,1), opacity 850ms cubic-bezier(.16,1,.3,1), filter 850ms cubic-bezier(.16,1,.3,1); }
.demo-card.is-center { z-index: 3; opacity: 1; filter: brightness(1); transform: translateX(0) scale(1); }
-.demo-card.is-left { z-index: 1; opacity: .46; filter: sepia(.18) brightness(.82); transform: translateX(calc(-100% + 58px)) scale(.955); }
-.demo-card.is-right { z-index: 1; opacity: .46; filter: sepia(.18) brightness(.82); transform: translateX(calc(100% - 58px)) scale(.955); }
+.demo-card.is-left { z-index: 1; opacity: .5; filter: brightness(.82) saturate(.68); transform: translateX(calc(-100% + 58px)) scale(.93); }
+.demo-card.is-right { z-index: 1; opacity: .5; filter: brightness(.82) saturate(.68); transform: translateX(calc(100% - 58px)) scale(.93); }
.demo-card-select { position: absolute; z-index: 10; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; cursor: pointer; }
.demo-card-select:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; border-radius: 2px; }
.demo-card-content { min-width: 0; }
.demo-card-content :deep(.svml-demo) { margin-top: 0; }
.demo-card-content :deep(.demo-shell) { box-shadow: none; }
-.demo-loading { display: grid; place-content: center; justify-items: center; gap: 14px; min-height: 720px; border: 1px solid var(--ink); border-radius: 2px; background: var(--paper-light); color: var(--ink-muted); font-family: var(--font-ui); font-size: 12px; letter-spacing: .04em; }
-.demo-loading-spinner { width: 30px; height: 30px; border: 2px solid rgba(74,46,37,.18); border-top-color: var(--accent); border-radius: 50%; animation: demo-loading-spin .7s linear infinite; }
+.demo-card.is-left :deep(.real-preview-body) { justify-items: end; padding-right: 0; }
+.demo-loading { display: grid; place-content: center; justify-items: center; gap: 14px; min-height: 720px; border: 0; border-radius: 2px; background: #272022; color: #BBAAB0; font-family: var(--font-ui); font-size: 12px; letter-spacing: .04em; }
+.demo-loading-spinner { width: 30px; height: 30px; border: 2px solid #EB609133; border-top-color: #49D6E9; border-radius: 50%; animation: demo-loading-spin .7s linear infinite; }
.demo-carousel-controls { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 22px 0 2px; }
.demo-carousel-controls button { padding: 0; cursor: pointer; }
-.arrow-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--ink); border-radius: 2px; background: transparent; color: var(--ink); transition: color .18s ease, background-color .18s ease, transform .18s ease; }
+.arrow-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--rule); border-radius: 2px; background: transparent; color: var(--ink); transition: color .18s ease, background-color .18s ease; }
.arrow-button:hover { background: var(--ink); color: var(--paper); }
.demo-carousel-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.arrow-button svg { width: 21px; height: 21px; fill: currentColor; }
.demo-carousel-dots { display: flex; align-items: center; gap: 8px; }
-.demo-carousel-dots button { width: 7px; height: 7px; border: 0; border-radius: 50%; background: rgba(74,46,37,.42); transition: background-color 160ms ease; }
+.demo-carousel-dots button { width: 7px; height: 7px; border: 0; border-radius: 50%; background: rgba(233,178,166,.34); transition: background-color 160ms ease; }
.demo-carousel-dots button.active { background: var(--accent); }
@keyframes demo-loading-spin { to { transform: rotate(360deg); } }
-@media (max-width: 900px) {
- .carousel-heading { width: calc(100% - 40px); margin-right: 40px; margin-left: 0; }
- .demo-card { width: calc(100% - 40px); }
- .demo-card.is-left { transform: translateX(calc(-100% + 34px)) scale(.97); }
- .demo-card.is-right { transform: translateX(calc(100% - 34px)) scale(.97); }
+@media (max-width: 959px) {
+ .svml-demo-carousel { width: calc(100% - 96px); }
+ .demo-card.is-left { transform: translateX(calc(-100% + 34px)) scale(.95); }
+ .demo-card.is-right { transform: translateX(calc(100% - 34px)) scale(.95); }
.demo-loading { min-height: 990px; }
}
+@media (max-width: 639px) {
+ .svml-demo-carousel { width: 100%; padding-inline: 24px; }
+}
+
@media (max-width: 520px) {
- .carousel-heading { width: calc(100% - 20px); margin-right: 20px; margin-left: 0; }
- .demo-card { width: calc(100% - 20px); }
- .demo-card.is-left { transform: translateX(calc(-100% + 20px)) scale(.98); }
- .demo-card.is-right { transform: translateX(calc(100% - 20px)) scale(.98); }
+ .svml-demo-carousel { padding: 48px 24px 72px; }
+ .demo-card.is-left { transform: translateX(calc(-100% + 20px)) scale(.96); }
+ .demo-card.is-right { transform: translateX(calc(100% - 20px)) scale(.96); }
}
@media (prefers-reduced-motion: reduce) {
diff --git a/docs/.vitepress/theme/components/SvmlPlayground.vue b/docs/.vitepress/theme/components/SvmlPlayground.vue
index c1a549cf..69e43fce 100644
--- a/docs/.vitepress/theme/components/SvmlPlayground.vue
+++ b/docs/.vitepress/theme/components/SvmlPlayground.vue
@@ -2,6 +2,7 @@
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
import {
demoAudioEnabled as audioEnabled,
+ demoAudioPlaybackEnabled as audioPlaybackEnabled,
enableDemoAudioAfterInteraction,
initializeDemoAudio,
toggleDemoAudio,
@@ -223,6 +224,7 @@ const automaticSourceSelections = ref<TimelineSelection[]>([selections[0]]);
const activeRuntimeItem = ref<RankingSelection | null>(null);
const settledIds = ref<Set<RankingSelectionId>>(new Set());
let rangeResizeObserver: ResizeObserver | null = null;
+let rangeMutationObserver: MutationObserver | null = null;
let animationFrame = 0;
let previousTimestamp = 0;
let programTime = 0;
@@ -335,6 +337,8 @@ function updateRangeGeometry() {
if (!container) return;
const containerRect = container.getBoundingClientRect();
const width = container.clientWidth;
+ const scaleX = container.offsetWidth ? containerRect.width / container.offsetWidth : 1;
+ const scaleY = container.offsetHeight ? containerRect.height / container.offsetHeight : 1;
const renderedLines = Array.from(container.querySelectorAll<HTMLElement>(":scope > .code-line"));
const lastRenderedLine = renderedLines.at(-1);
const paddingBottom = Number.parseFloat(getComputedStyle(container).paddingBottom) || 0;
@@ -356,20 +360,20 @@ function updateRangeGeometry() {
const endLine = endMarker?.closest<HTMLElement>(".code-line");
if (!startMarker || !endMarker || !startLine || !endLine) continue;
- const startRect = startMarker.getBoundingClientRect();
- const endRect = endMarker.getBoundingClientRect();
- const offsetX = container.scrollLeft - containerRect.left;
- const offsetY = container.scrollTop - containerRect.top;
+ const startFragments = Array.from(startMarker.getClientRects());
+ const endFragments = Array.from(endMarker.getClientRects());
+ const startRect = startFragments[0] ?? startMarker.getBoundingClientRect();
+ const endRect = endFragments.at(-1) ?? endMarker.getBoundingClientRect();
const inlinePadding = 3;
const edgeOverhang = 3;
const left = 44 - edgeOverhang;
const right = width - 12 + edgeOverhang;
- const startX = Math.max(3, Math.min(width - 3, startRect.left + offsetX - inlinePadding));
- const endX = Math.max(3, Math.min(width - 3, endRect.right + offsetX + inlinePadding));
+ const startX = Math.max(3, Math.min(width - 3, (startRect.left - containerRect.left) / scaleX + container.scrollLeft - inlinePadding));
+ const endX = Math.max(3, Math.min(width - 3, (endRect.right - containerRect.left) / scaleX + container.scrollLeft + inlinePadding));
const lineHeight = Number.parseFloat(getComputedStyle(startLine).lineHeight) || 26;
const blockPadding = 0;
- const startCenter = (startRect.top + startRect.bottom) / 2 + offsetY;
- const endCenter = (endRect.top + endRect.bottom) / 2 + offsetY;
+ const startCenter = ((startRect.top + startRect.bottom) / 2 - containerRect.top) / scaleY + container.scrollTop;
+ const endCenter = ((endRect.top + endRect.bottom) / 2 - containerRect.top) / scaleY + container.scrollTop;
const top = startCenter - lineHeight / 2 - blockPadding;
const startBottom = startCenter + lineHeight / 2;
const endTop = endCenter - lineHeight / 2;
@@ -566,7 +570,7 @@ function syncBaseVideos(force = false) {
baseVideos.forEach((video, index) => {
if (!video) return;
- video.muted = !audioEnabled.value || index !== activeIndex;
+ video.muted = !audioPlaybackEnabled.value || index !== activeIndex;
if (index !== activeIndex) {
video.pause();
return;
@@ -784,7 +788,11 @@ watch(
[() => displayedLines.value.map((entry) => entry.key).join("|"), sourceFollowEnabled],
() => {
void nextTick().then(() => {
- updateLayoutGeometry();
+ updateSourceViewportRows();
+ void nextTick().then(() => {
+ updateLayoutGeometry();
+ requestAnimationFrame(updateLayoutGeometry);
+ });
});
},
{ flush: "post" },
@@ -811,6 +819,8 @@ onMounted(() => {
if (codeScrollElement.value) {
rangeResizeObserver = new ResizeObserver(updateLayoutGeometry);
rangeResizeObserver.observe(codeScrollElement.value);
+ rangeMutationObserver = new MutationObserver(() => requestAnimationFrame(updateRangeGeometry));
+ rangeMutationObserver.observe(codeScrollElement.value, { childList: true, subtree: true });
}
});
window.addEventListener("resize", updateLayoutGeometry);
@@ -821,6 +831,7 @@ onBeforeUnmount(() => {
window.removeEventListener("keydown", enableAudio, true);
window.removeEventListener("resize", updateLayoutGeometry);
rangeResizeObserver?.disconnect();
+ rangeMutationObserver?.disconnect();
});
</script>
@@ -861,7 +872,7 @@ onBeforeUnmount(() => {
? (sourceFollowEnabled ? "移入查看所有源码" : "移出查看精简视图")
: (sourceFollowEnabled ? "点击代码查看所有源码" : "点击空白处返回精简视图") }}
</div>
- <div ref="codeScrollElement" class="code-scroll" aria-label="SVML source code">
+ <div ref="codeScrollElement" class="code-scroll" aria-label="SVML source code" @scroll="updateRangeGeometry">
<svg
v-if="rangeCanvas.width && rangeCanvas.height"
class="semantic-range-canvas"
@@ -893,6 +904,7 @@ onBeforeUnmount(() => {
:class="{
'binding-active': bindingDepth(entry.line) >= 0,
'binding-depth-1': bindingDepth(entry.line) === 1,
+ 'binding-depth-2': bindingDepth(entry.line) === 2,
}"
@mouseover="inspectLine(entry.line, entry.index)"
>
@@ -920,7 +932,7 @@ onBeforeUnmount(() => {
:ref="(element) => setBaseVideo(element, index)"
:class="{ active: currentSceneIndex === index }"
:src="resolveDemoMedia(scene.src)"
- :muted="!audioEnabled || currentSceneIndex !== index"
+ :muted="!audioPlaybackEnabled || currentSceneIndex !== index"
playsinline
preload="auto"
@loadedmetadata="syncBaseVideos(true)"
@@ -980,12 +992,7 @@ onBeforeUnmount(() => {
:title="audioEnabled ? '静音' : '取消静音'"
@click.stop="toggleAudio"
>
- <svg v-if="audioEnabled" viewBox="0 0 24 24" aria-hidden="true">
- <path d="M4 9v6h4l5 4V5L8 9H4zm12.5 3a4.5 4.5 0 0 0-2.25-3.9v7.8A4.5 4.5 0 0 0 16.5 12zm-2.25-8.6v2.1a7 7 0 0 1 0 13v2.1a9 9 0 0 0 0-17.2z"/>
- </svg>
- <svg v-else viewBox="0 0 24 24" aria-hidden="true">
- <path d="M4 9v6h4l5 4V5L8 9H4zm12.6 3 2.7-2.7-1.4-1.4-2.7 2.7-2.7-2.7-1.4 1.4 2.7 2.7-2.7 2.7 1.4 1.4 2.7-2.7 2.7 2.7 1.4-1.4-2.7-2.7z"/>
- </svg>
+ <span class="material-symbols-rounded" aria-hidden="true">{{ audioEnabled ? "volume_up" : "volume_off" }}</span>
</button>
</div>
</div>
@@ -1021,7 +1028,7 @@ onBeforeUnmount(() => {
<style scoped>
.live-active-icon.semantic-selected,
.live-rank-cell.semantic-selected {
- outline: 1px solid #C85F7D;
+ outline: 1px solid #EE7B62;
outline-offset: 3px;
}
diff --git a/docs/.vitepress/theme/components/demo-audio.ts b/docs/.vitepress/theme/components/demo-audio.ts
index 2c6cac39..8c3be054 100644
--- a/docs/.vitepress/theme/components/demo-audio.ts
+++ b/docs/.vitepress/theme/components/demo-audio.ts
@@ -3,9 +3,9 @@ import { ref } from "vue";
const STORAGE_KEY = "svml-demo-audio-enabled";
export const demoAudioEnabled = ref(false);
+export const demoAudioPlaybackEnabled = ref(false);
let initialized = false;
-let storedPreference: boolean | null = null;
function savePreference(value: boolean) {
try {
@@ -19,35 +19,31 @@ export function initializeDemoAudio() {
if (initialized || typeof window === "undefined") return;
initialized = true;
+ let storedPreference = false;
try {
const storedValue = window.localStorage.getItem(STORAGE_KEY);
if (storedValue === "true" || storedValue === "false") {
storedPreference = storedValue === "true";
}
- } catch {
- storedPreference = null;
- }
+ } catch {}
- if (storedPreference === true && navigator.userActivation?.hasBeenActive) {
- demoAudioEnabled.value = true;
- }
+ demoAudioEnabled.value = storedPreference;
+ demoAudioPlaybackEnabled.value = storedPreference && Boolean(navigator.userActivation?.hasBeenActive);
}
export function enableDemoAudioAfterInteraction() {
initializeDemoAudio();
- if (storedPreference === false || demoAudioEnabled.value) return false;
+ if (!demoAudioEnabled.value || demoAudioPlaybackEnabled.value) return false;
- storedPreference = true;
- demoAudioEnabled.value = true;
- savePreference(true);
+ demoAudioPlaybackEnabled.value = true;
return true;
}
export function toggleDemoAudio() {
initializeDemoAudio();
const nextValue = !demoAudioEnabled.value;
- storedPreference = nextValue;
demoAudioEnabled.value = nextValue;
+ demoAudioPlaybackEnabled.value = nextValue;
savePreference(nextValue);
return nextValue;
}
diff --git a/docs/.vitepress/theme/style.css b/docs/.vitepress/theme/style.css
index 5cf8ae79..22c33aca 100644
--- a/docs/.vitepress/theme/style.css
+++ b/docs/.vitepress/theme/style.css
@@ -1,36 +1,47 @@
:root,
.dark {
- --paper: #F2D1C5;
- --paper-light: #F8E5DE;
- --paper-deep: #E6BDB0;
- --ink: #4A2E25;
- --ink-muted: #76554A;
- --accent: #C85F7D;
- --rule: rgba(74, 46, 37, .24);
+ --paper: #2C2126;
+ --paper-light: #3D2A33;
+ --paper-deep: #3D2A33;
+ --ink: #E9B2A6;
+ --ink-muted: rgba(233, 178, 166, .72);
+ --accent: #EE7B62;
+ --accent-hover: #F59B88;
+ --accent-pressed: #FCBDB0;
+ --button-gold: #9B7948;
+ --button-gold-hover: #8F6F42;
+ --button-gold-pressed: #8F7249;
+ --rule: rgba(233, 178, 166, .2);
--font-editorial: "Newsreader", "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
--font-ui: "Manrope", ui-sans-serif, system-ui, sans-serif;
- --font-code: "Cutive Mono", ui-monospace, SFMono-Regular, monospace;
- --vp-font-family-base: var(--font-editorial);
+ --font-wordmark: "Cutive Mono", ui-monospace, SFMono-Regular, monospace;
+ --font-code: "Google Sans Code", ui-monospace, SFMono-Regular, monospace;
+ --vp-font-family-base: var(--font-ui);
--vp-font-family-mono: var(--font-code);
--vp-c-brand-1: var(--accent);
- --vp-c-brand-2: #B64E6C;
- --vp-c-brand-3: #963E57;
- --vp-c-brand-soft: rgba(200, 95, 125, .14);
+ --vp-c-brand-2: var(--accent-hover);
+ --vp-c-brand-3: var(--accent-pressed);
+ --vp-c-brand-soft: rgba(238, 123, 98, .16);
--vp-c-bg: var(--paper);
--vp-c-bg-alt: var(--paper-light);
- --vp-c-bg-elv: #F9E8E1;
- --vp-c-bg-soft: rgba(74, 46, 37, .055);
+ --vp-c-bg-elv: var(--paper-light);
+ --vp-c-bg-soft: rgba(233, 178, 166, .06);
--vp-c-text-1: var(--ink);
--vp-c-text-2: var(--ink-muted);
- --vp-c-text-3: #987368;
+ --vp-c-text-3: rgba(233, 178, 166, .54);
--vp-c-divider: var(--rule);
--vp-c-gutter: var(--rule);
- --vp-nav-bg-color: var(--ink);
+ --vp-nav-bg-color: #272022;
--vp-sidebar-bg-color: var(--paper-light);
- --vp-code-block-bg: var(--ink);
- --vp-code-line-highlight-color: rgba(200, 95, 125, .18);
- --vp-code-copy-code-bg: rgba(242, 209, 197, .1);
- --vp-code-copy-code-hover-bg: rgba(242, 209, 197, .17);
+ --vp-code-block-bg: #322A2D;
+ --vp-code-block-color: #CBBEC2;
+ --vp-code-line-highlight-color: #007F9933;
+ --vp-code-line-number-color: #715B63;
+ --vp-code-copy-code-border-color: #715B63;
+ --vp-code-copy-code-bg: #272022;
+ --vp-code-copy-code-hover-border-color: #49D6E9;
+ --vp-code-copy-code-hover-bg: #272022;
+ --vp-code-copy-code-active-text: #49E9A6;
}
html { background: var(--paper); }
@@ -40,43 +51,73 @@ body {
font-optical-sizing: auto;
letter-spacing: 0;
}
-.VPHome { margin-bottom: 0 !important; }
-.VPNav { border-bottom: 1px solid rgba(242,209,197,.18); background: var(--ink); }
+* { scrollbar-width: auto; scrollbar-color: #EB609155 transparent; }
+*::-webkit-scrollbar { width: 12px; height: 12px; }
+*::-webkit-scrollbar-track { border-radius: 0; background: transparent; }
+*::-webkit-scrollbar-thumb { border: 0; border-radius: 0; background: #EB609155; }
+*::-webkit-scrollbar-thumb:hover { background: #EB609177; }
+.VPHome { margin-bottom: 0 !important; overflow-x: clip; }
+.VPNav { border-bottom: 0; background: #272022; }
.VPNavBar { border-bottom: 0 !important; }
+.VPNavBarTitle { display: flex; align-items: center; height: 64px; }
.VPNavBarTitle .title {
- padding-right: .16em;
- color: var(--paper-light);
- font-family: var(--font-code);
- font-size: 19px;
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ width: auto;
+ height: 32px;
+ padding: 0;
+ color: var(--ink);
+ font-family: var(--font-wordmark);
+ font-size: 30px;
font-weight: 700;
+ font-synthesis: weight;
letter-spacing: -.055em;
- text-transform: uppercase;
+ line-height: 30px;
+ -webkit-text-stroke: .2px currentColor;
+ paint-order: stroke fill;
+}
+.VPNavBarTitle .title::before {
+ content: "cinematic_blur";
+ display: block;
+ flex: 0 0 30px;
+ width: 30px;
+ height: 30px;
+ font-family: "Material Symbols Rounded";
+ font-size: 30px;
+ font-style: normal;
+ font-weight: 400;
+ font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
+ letter-spacing: normal;
+ line-height: 30px;
+ text-align: center;
+ -webkit-text-stroke: 0;
}
.VPNavBarMenuLink,
.VPNavBarMenuGroup .text,
.VPNavScreenMenuLink,
.VPNavScreenMenuGroup .button {
- color: var(--paper) !important;
+ color: var(--ink-muted) !important;
font-family: var(--font-ui);
font-size: 13px;
font-weight: 600;
}
.VPNavBarMenuLink:hover,
.VPNavBarMenuLink.active,
-.VPNavScreenMenuLink:hover { color: #F2A9BA !important; }
+.VPNavScreenMenuLink:hover { color: var(--accent) !important; }
.VPNavBarSocialLinks .VPSocialLink,
-.VPNavBarHamburger .container { color: var(--paper) !important; }
-.VPNavScreen { background: var(--ink) !important; }
+.VPNavBarHamburger .container { color: var(--ink) !important; }
+.VPNavScreen { background: #272022 !important; }
.VPNav .DocSearch-Button,
.VPNav .VPNavBarSearchButton {
- border-color: rgba(242,209,197,.24) !important;
- background: rgba(242,209,197,.08) !important;
- color: var(--paper) !important;
+ border-color: var(--rule) !important;
+ background: rgba(233,178,166,.06) !important;
+ color: var(--ink) !important;
font-family: var(--font-ui);
}
.VPNav .DocSearch-Button-Placeholder,
.VPNav .DocSearch-Button-Key {
- color: #E4C3B8 !important;
+ color: var(--ink-muted) !important;
}
.VPButton {
min-height: 42px !important;
@@ -87,20 +128,28 @@ body {
font-weight: 700 !important;
letter-spacing: .02em;
}
-.VPButton.brand { border-color: var(--accent) !important; background: var(--accent) !important; color: #fff !important; }
-.VPButton.brand:hover { border-color: #A94460 !important; background: #A94460 !important; }
-.VPButton.alt { border-color: var(--ink) !important; background: transparent !important; color: var(--ink) !important; }
-.VPButton.alt:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
+.VPButton.brand { border-color: var(--button-gold) !important; background: var(--button-gold) !important; color: #FAF7F5 !important; }
+.VPButton.brand:hover { border-color: var(--button-gold-hover) !important; background: var(--button-gold-hover) !important; }
+.VPButton.brand:active { border-color: var(--button-gold-pressed) !important; background: var(--button-gold-pressed) !important; }
+.VPButton.alt { border-color: var(--button-gold) !important; background: transparent !important; color: var(--ink) !important; }
+.VPButton.alt:hover { border-color: var(--button-gold-hover) !important; color: var(--ink) !important; }
+.VPButton.alt:active { border-color: var(--button-gold-pressed) !important; }
-.VPHero { padding-top: 112px !important; padding-bottom: 58px !important; }
+.VPHero { padding-top: 112px !important; padding-bottom: 0 !important; }
.VPHero .name,
.VPHero .text { color: var(--ink) !important; }
-.hero-statement { width: 100%; }
+.hero-statement {
+ --hero-rhythm: 48px;
+ --hero-zh-gap: 8px;
+ --hero-zh-line: 30.4px;
+ width: 100%;
+ margin-bottom: var(--hero-rhythm);
+}
.hero-wordmark {
position: relative;
width: fit-content;
max-width: 100%;
- margin: 0 -30px 0 0;
+ margin: 0 -30px var(--hero-rhythm) 0;
padding: 0 30px 0 0;
overflow: visible;
}
@@ -110,15 +159,18 @@ body {
width: fit-content;
margin: 0;
border: 0;
- padding: 0 .18em .06em .02em;
+ padding: 0 .18em 0 .02em;
color: var(--ink);
- font-family: var(--font-code);
+ font-family: var(--font-wordmark);
font-size: clamp(52px,7vw,88px);
font-weight: 700;
+ font-synthesis: weight;
line-height: .96;
letter-spacing: -.055em;
text-rendering: geometricPrecision;
text-transform: uppercase;
+ -webkit-text-stroke: .2px currentColor;
+ paint-order: stroke fill;
}
.wordmark-reveal {
display: inline-block;
@@ -126,22 +178,42 @@ body {
overflow: hidden;
vertical-align: bottom;
white-space: nowrap;
- animation: wordmark-type 1.2s steps(9,end) .18s forwards;
+ animation: wordmark-type .7s steps(9,end) .18s forwards;
}
.wordmark-cursor {
display: inline-block;
margin-left: -.02em;
color: var(--accent);
- animation: wordmark-cursor-blink .48s step-end 1.42s infinite;
+ animation: wordmark-cursor-blink .48s step-end .92s infinite;
+ -webkit-text-stroke: 0;
}
@keyframes wordmark-type { to { width: calc(9ch - .495em); } }
@keyframes wordmark-cursor-blink { 50% { opacity: 0; } }
.hero-statement-viewport { position: relative; width: min(100%,900px); overflow: hidden; }
-.hero-statement-viewport-en { height: clamp(102px,11vw,132px); margin-top: -8px; }
-.hero-statement-viewport-zh { height: 64px; margin-top: -22px; }
-.hero-statement-en, .hero-statement-zh { position: absolute; inset: 0; display: flex; align-items: center; margin: 0; padding-block: 20px; will-change: transform,opacity; }
+.hero-statement-viewport-en { height: clamp(61.2px,8.16vw,106.08px); }
+.hero-statement-viewport-zh { height: var(--hero-zh-line); margin-top: var(--hero-zh-gap); }
+.hero-statement-viewport-en,
+.hero-statement-viewport-zh,
+.VPHome .VPHero .actions,
+.VPHome .carousel-heading,
+.VPHome .demo-carousel-stage,
+.VPHome .demo-carousel-controls {
+ opacity: 0;
+ transform: translateY(12px);
+ animation: hero-content-rise .4s cubic-bezier(.22,1,.36,1) forwards;
+}
+.hero-statement-viewport-en { animation-delay: 1.03s; }
+.hero-statement-viewport-zh { animation-delay: 1.17s; }
+.VPHome .VPHero .actions { animation-delay: 1.31s; }
+.VPHome .carousel-heading { animation-delay: 1.45s; }
+.VPHome .demo-carousel-stage { animation-delay: 1.59s; }
+.VPHome .demo-carousel-controls { animation-delay: 1.73s; }
+@keyframes hero-content-rise {
+ to { opacity: 1; transform: translateY(0); }
+}
+.hero-statement-en, .hero-statement-zh { position: absolute; inset: 0; display: block; margin: 0; padding: 0; will-change: transform,opacity; }
.hero-statement-en { color: var(--ink); font-family: var(--font-editorial); font-size: clamp(30px,4vw,52px); font-weight: 500; line-height: 1.02; letter-spacing: -.025em; }
-.hero-statement-zh { color: var(--ink-muted); font-family: var(--font-editorial); font-size: 19px; font-weight: 500; line-height: 1.6; }
+.hero-statement-zh { color: var(--ink-muted); font-family: var(--font-ui); font-size: 19px; font-weight: 500; line-height: 1.6; }
.hero-statement-line { display: inline; }
.hero-statement-accent { color: var(--vp-c-brand-1); }
.hero-statement-swap-enter-active, .hero-statement-swap-leave-active { transition: transform .9s cubic-bezier(.22,1,.36,1), opacity .72s cubic-bezier(.22,1,.36,1); }
@@ -149,57 +221,82 @@ body {
.hero-statement-swap-leave-to { opacity: 0; transform: translateY(-72%); }
.VPHome .VPHomeHero .container { max-width: 1180px; padding-inline: 32px; }
.VPHome .VPHomeHero .main { max-width: 1000px; }
-.VPHome .vp-doc.container { width: calc(100% - 128px); max-width: 1180px; margin-inline: auto; padding: 0 32px 32px; box-sizing: border-box; }
+.VPHome .VPHero .actions { gap: 16px; margin: 0; padding-top: 0; }
+.VPHome .VPHero .action { padding: 0; }
+.VPHome .vp-doc.container { width: 100%; max-width: none; margin-inline: 0; padding: 0; background: var(--paper); box-sizing: border-box; }
-.svml-demo { width: 100%; margin: 16px auto 0; }
-.demo-heading { margin: 0 0 22px; }
-.vp-doc .demo-heading h2 { margin: 0; border: 0; padding: 0; color: var(--ink); font-family: var(--font-ui); font-size: clamp(28px, 3.2vw, 42px); font-weight: 700; line-height: 1.08; letter-spacing: -.045em; }
+.svml-demo {
+ --demo-card-bg: #272022;
+ --demo-code-bg: #322A2D;
+ --demo-preview-bg: #272022;
+ --demo-text: #CBBEC2;
+ --demo-text-muted: #BBAAB0;
+ --demo-line-number: #715B63;
+ --demo-tag: #E66533;
+ --demo-attr: #D5971A;
+ --demo-string: #49E9A6;
+ --demo-expression: #E4B781;
+ --demo-marker: #49D6E9;
+ --demo-marker-bg: #007F9933;
+ --demo-marker-border: #49D6E9;
+ --demo-segment-cyan: #49D6E9;
+ --demo-segment-green: #49E9A6;
+ --demo-segment-gold: #E4B781;
+ --demo-segment-pink: #DF769B;
+ --demo-segment-violet: #7060EB;
+ --demo-cursor: #FFB3CD;
+ width: 100%;
+ margin: 0 auto;
+}
+.demo-heading { margin: 0 0 28px; }
+.vp-doc .demo-heading h2 { margin: 0; border: 0; padding: 0; color: var(--ink); font-family: var(--font-ui); font-size: clamp(20px, 2vw, 26px); font-weight: 600; line-height: 1.2; letter-spacing: -.025em; }
+.VPHome .vp-doc .demo-heading h2 { font-size: 19px; }
.touch-interaction-copy { display: none; }
-.demo-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); min-height: 670px; overflow: hidden; border: 1px solid var(--ink); border-radius: 2px; background: var(--ink); }
+.demo-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); min-height: 670px; overflow: hidden; border: 0; border-radius: 2px; background: var(--demo-card-bg); }
.source-panel, .preview-panel { min-width: 0; }
-.source-panel { position: relative; border-right: 1px solid rgba(242,209,197,.22); background: var(--ink); }
-.preview-panel { display: flex; flex-direction: column; background: var(--accent); }
-.source-follow-hint { position: absolute; z-index: 10; top: 8px; right: 10px; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid rgba(242,209,197,.32); border-radius: 1px; background: rgba(74,46,37,.94); color: #D8B6AA; font-family: var(--font-ui); font-size: 10px; line-height: 16px; pointer-events: none; }
-.source-follow-hint::before { content: "↳"; color: var(--accent); font-family: var(--font-code); font-size: 13px; font-weight: 700; line-height: 1; }
+.source-panel { position: relative; border: 0; background: var(--demo-code-bg); }
+.preview-panel { display: flex; flex-direction: column; background: var(--demo-preview-bg); }
+.source-follow-hint { position: absolute; z-index: 10; top: 8px; right: 10px; display: block; padding: 5px 8px; border: 0; border-radius: 1px; background: #272022; color: var(--demo-text-muted); font-family: var(--font-ui); font-size: 10px; line-height: 16px; pointer-events: none; }
.source-measure { position: absolute; z-index: -1; top: 0; left: 0; visibility: hidden; width: 100%; pointer-events: none; }
-.code-scroll { position: relative; height: 621px; overflow-x: hidden; overflow-y: auto; padding: var(--source-vertical-padding, 9px) 0; scrollbar-width: thin; scrollbar-color: #9C7468 transparent; }
-.code-line { position: relative; display: grid; grid-template-columns: 44px minmax(0,1fr); width: 100%; min-width: 0; min-height: 26px; margin: 0; padding: 0 18px 0 0; border: 0; background: transparent; color: #F7E4DC; text-align: left; font-family: var(--font-code); font-size: 14.5px; font-weight: 400; letter-spacing: -.055em; line-height: 26px; }
-.line-number { padding-right: 13px; color: #9E776B; text-align: right; font-weight: 400; user-select: none; }
-.code-line.active .line-number { color: var(--paper); }
+.code-scroll { position: relative; height: 621px; overflow-x: hidden; overflow-y: auto; overflow-anchor: none; padding: var(--source-vertical-padding, 9px) 0; scrollbar-color: #EB609155 transparent; }
+.code-line { position: relative; display: grid; grid-template-columns: 44px minmax(0,1fr); width: 100%; min-width: 0; min-height: 26px; margin: 0; padding: 0 18px 0 0; border: 0; outline: 0; background: transparent; color: var(--demo-text); text-align: left; font-family: var(--font-code); font-size: 14.5px; font-weight: 400; letter-spacing: normal; line-height: 26px; }
+.line-number { padding-right: 13px; color: var(--demo-line-number); text-align: right; font-weight: 400; user-select: none; }
+.code-line.active .line-number { color: var(--demo-text); }
.code-line code { min-width: 0; padding: 0; color: inherit; background: none; font-family: inherit; font-size: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
-.svml-demo .code-line code { padding: 0 !important; border-radius: 0 !important; background: transparent !important; }
-.syn-tag { color: #F5B7A5; }.syn-attr { color: #E8A4B6; }.syn-string { color: #E5C789; }.syn-expr { color: #EED7CA; }.syn-marker { color: #FFF6F1; font-weight: 700; background: rgba(200,95,125,.2); box-shadow: inset 0 0 0 1px rgba(242,169,186,.3); text-shadow: none; }
+.svml-demo .code-line code { padding: 0 !important; border: 0 !important; border-radius: 0 !important; outline: 0 !important; background: transparent !important; box-shadow: none !important; letter-spacing: normal !important; }
+.syn-tag { color: var(--demo-tag); }.syn-attr { color: var(--demo-attr); }.syn-string { color: var(--demo-string); }.syn-expr { color: var(--demo-expression); }.syn-marker { color: var(--demo-marker); font-weight: 700; background: var(--demo-marker-bg); box-shadow: inset 0 0 0 1px var(--demo-marker-border); text-shadow: none; }
.semantic-token { margin: -3px; padding: 3px; border-radius: 4px; cursor: pointer; }
-.semantic-token:hover, .semantic-token:focus { outline: none; background: rgba(200,95,125,.32); box-shadow: 0 0 0 1px #F2A9BA; }
+.semantic-token:hover, .semantic-token:focus { outline: none; background: #007F9966; box-shadow: 0 0 0 1px var(--demo-marker); }
.semantic-range-canvas { position: absolute; z-index: 0; top: 0; left: 0; overflow: visible; pointer-events: none; }
-.semantic-range-canvas path { fill: rgba(200,95,125,.04); stroke: #EFA0B4; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
-.semantic-range-canvas path.depth-1 { fill: rgba(218,161,111,.05); stroke: #DDA978; }
-.semantic-range-canvas path.depth-2 { fill: rgba(242,209,197,.04); stroke: #C9A59A; }
+.semantic-range-canvas path { fill: #49D6E922; stroke: #49D6E9; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
+.semantic-range-canvas path.depth-1 { fill: #CC990033; stroke: #D5971A; }
+.semantic-range-canvas path.depth-2 { fill: #9D92F222; stroke: #7060EB; }
.code-line code, .code-line .line-number { position: relative; z-index: 1; }
-.code-fold { display: flex; align-items: center; justify-content: center; min-height: 26px; height: 26px; padding: 0; border-block: 1px solid rgba(242,209,197,.1); background: rgba(242,209,197,.06); }
-.code-fold code { display: flex; align-items: center; justify-content: center; width: 100%; height: 26px; color: #DAB9AE !important; text-align: center; font-size: 16px !important; font-weight: 700 !important; letter-spacing: 0 !important; line-height: 1 !important; }
+.code-fold { display: flex; align-items: center; justify-content: center; min-height: 26px; height: 26px; padding: 0; border: 0; background: var(--demo-preview-bg); }
+.code-fold code { display: flex; align-items: center; justify-content: center; width: 100%; height: 26px; color: var(--demo-line-number) !important; text-align: center; font-size: 16px !important; font-weight: 700 !important; letter-spacing: 0 !important; line-height: 1 !important; }
.code-spacer { height: 26px; }
-.semantic-token.semantic-active { --semantic-color: #9B405A; background: var(--semantic-color); color: #fff; font-weight: 700; text-shadow: none; box-shadow: 0 0 0 1.5px #F2A9BA; }
-.semantic-token.semantic-active.semantic-depth-1 { --semantic-color: #9A623E; }
-.semantic-token.semantic-active.semantic-depth-2 { --semantic-color: #75554B; }
-.code-line.binding-active { background: linear-gradient(90deg, transparent 0 44px, rgba(200,95,125,.1) 44px); }
-.code-line.binding-active.binding-depth-1 { background: linear-gradient(90deg, transparent 0 44px, rgba(218,161,111,.09) 44px); }
+.semantic-token.semantic-active { --semantic-color: #007F99; --semantic-ring: #49D6E9; background: var(--semantic-color); color: #EDEBFF; font-weight: 700; text-shadow: none; box-shadow: 0 0 0 1.5px var(--semantic-ring); }
+.semantic-token.semantic-active.semantic-depth-1 { --semantic-color: #D5971A; --semantic-ring: #FFC180; color: #1F191B; }
+.semantic-token.semantic-active.semantic-depth-2 { --semantic-color: #7060EB; --semantic-ring: #9D92F2; color: #EDEBFF; }
+.code-line.binding-active,
+.code-line.binding-active.binding-depth-1,
+.code-line.binding-active.binding-depth-2 { background: transparent; }
.script-word { border-radius: 3px; transition: color .08s linear, background-color .08s linear; }
-.script-word.active { background: rgba(255,211,77,.18); color: #ffd34d; box-shadow: 0 0 0 1px rgba(255,211,77,.28); }
+.script-word.active { background: #CC990033; color: #FFC180; box-shadow: 0 0 0 1px #D5971A; }
.semantic-timeline { min-width: 0; }
-.timeline-labels { display: grid; grid-template-columns: 31fr 44fr 25fr; margin-bottom: 5px; color: #5f6860; font-family: var(--vp-font-family-mono); font-size: 7px; }
+.timeline-labels { display: grid; grid-template-columns: 31fr 44fr 25fr; margin-bottom: 5px; color: var(--ink-muted); font-family: var(--vp-font-family-mono); font-size: 7px; }
.timeline-labels span:nth-child(2) { text-align: center; }.timeline-labels span:nth-child(3) { text-align: right; }
.timeline-labels .current { color: #b8c1b7; }
.timeline-track { position: relative; display: grid; grid-template-columns: 31fr 44fr 25fr; gap: 3px; height: 5px; }
.timeline-track .segment { border-radius: 3px; background: #303731; }.timeline-track .point { background: #394139; }
-.playhead { position: absolute; top: 50%; width: 2px; height: 15px; border-radius: 0; background: var(--ink); transform: translate(-1px,-50%); }
+.playhead { position: absolute; top: 50%; width: 2px; height: 15px; border-radius: 0; background: var(--demo-cursor); transform: translate(-1px,-50%); }
/* Real video version of the source-to-preview demo. */
.real-demo-shell { min-height: 720px; }
.real-demo-shell .code-scroll { height: 720px; }
-.real-preview-body { display: grid; place-items: center; flex: 1; min-height: 0; padding: 28px 20px 18px; background: var(--accent); }
-.real-video-frame { position: relative; justify-self: center; height: 490px; aspect-ratio: 9/16; overflow: hidden; border: 1px solid var(--ink); border-radius: 2px; background: #161820; }
+.real-preview-body { display: grid; place-items: center; flex: 1; min-height: 0; padding: 28px 20px 18px; background: var(--demo-preview-bg); }
+.real-video-frame { position: relative; justify-self: center; height: 490px; aspect-ratio: 9/16; overflow: hidden; border: 1px solid var(--rule); border-radius: 2px; background: #161820; }
.real-video-frame video { display: block; width: 100%; height: 100%; object-fit: cover; background: #191b22; }
-.live-ranking-stage { position: relative; justify-self: center; height: 540px; aspect-ratio: 9/16; overflow: hidden; border: 1px solid var(--ink); background: #000; isolation: isolate; }
+.live-ranking-stage { position: relative; justify-self: center; height: 540px; aspect-ratio: 9/16; overflow: hidden; border: 1px solid var(--rule); background: #000; isolation: isolate; }
.live-base-layer { position: absolute; inset: 0; z-index: 0; background: #000; }
.live-base-layer video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.live-base-layer video.active { opacity: 1; }
@@ -217,24 +314,24 @@ body {
.live-audio-toggle { position: absolute; top: 10px; right: 10px; z-index: 40; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(0,0,0,.58); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }
.live-audio-toggle:hover { background: rgba(0,0,0,.78); }
.live-audio-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
-.live-audio-toggle svg { width: 16px; height: 16px; fill: currentColor; }
+.live-audio-toggle .material-symbols-rounded { font-size: 18px; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20; line-height: 1; }
.live-caption { position: absolute; top: 54%; left: 37%; z-index: 30; display: flex; align-items: baseline; justify-content: center; width: 64%; column-gap: 4px; color: #fff; font-family: Poppins, Inter, Arial, sans-serif; font-size: 14px; font-weight: 800; line-height: 1.15; letter-spacing: -.3px; text-align: center; white-space: nowrap; pointer-events: none; -webkit-text-stroke: .55px rgba(0,0,0,.82); paint-order: stroke fill; text-shadow: 0 1px 4px rgba(0,0,0,.72); }
.live-caption span { display: inline-block; transition: color .08s linear, transform .08s linear; }
.live-caption span.active { color: #ffd34d; transform: scale(1.08); }
-.ranking-board-outline, .ranking-stage-outline { position: absolute; z-index: 3; border: 2px solid #C85F7D; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
+.ranking-board-outline, .ranking-stage-outline { position: absolute; z-index: 3; border: 2px solid var(--accent); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.ranking-board-outline.visible, .ranking-stage-outline.visible { opacity: 1; }
.ranking-board-outline { left: .6%; top: 15.8%; width: 33.5%; height: 44.2%; border-radius: 5px; }
.ranking-stage-outline { left: 49.3%; top: 63.4%; width: 33.5%; aspect-ratio: 1; border-radius: 12%; }
-.ranking-board-outline span, .ranking-stage-outline span { position: absolute; top: -13px; left: -1px; padding: 2px 4px; border-radius: 2px 2px 0 0; background: #C85F7D; color: #fff; font-family: var(--vp-font-family-mono); font-size: 6px; line-height: 10px; }
-.real-semantic-controls { display: grid; grid-template-columns: minmax(0,1fr); align-items: center; margin: 0 28px 26px; padding: 12px 0 0; border-top: 1px solid rgba(74,46,37,.28); }
+.ranking-board-outline span, .ranking-stage-outline span { position: absolute; top: -13px; left: -1px; padding: 2px 4px; border-radius: 2px 2px 0 0; background: var(--accent); color: #fff; font-family: var(--vp-font-family-mono); font-size: 6px; line-height: 10px; }
+.real-semantic-controls { display: grid; grid-template-columns: minmax(0,1fr); align-items: center; margin: 0 28px 26px; padding: 12px 0 0; border-top: 0; }
.ranking-labels { display: flex; gap: 0; }
-.ranking-labels button { min-width: 0; flex-basis: 0; overflow: hidden; padding: 4px 2px; border: 0; background: none; color: var(--ink-muted); text-align: center; font-family: var(--font-code); font-size: 11px; letter-spacing: -.045em; text-overflow: ellipsis; cursor: pointer; }.ranking-labels button.current { color: #9B405A; font-weight: 700; }
+.ranking-labels button { min-width: 0; flex-basis: 0; overflow: hidden; padding: 4px 2px; border: 0; background: none; color: #997582; text-align: center; font-family: var(--font-code); font-size: 11px; letter-spacing: normal; text-overflow: ellipsis; cursor: pointer; }.ranking-labels button.current { color: #F18EB0; font-weight: 700; }
.ranking-track { display: flex; gap: 0; }
.ranking-track .segment { min-width: 0; flex-basis: 0; }
-.ranking-track .segment { border-radius: 0; box-shadow: inset -1px 0 rgba(11,13,16,.55); }
+.ranking-track .segment { border-radius: 0; box-shadow: inset -1px 0 #1F191B; }
.ranking-track .segment:first-child { border-radius: 3px 0 0 3px; }
.ranking-track .segment:nth-child(5) { border-radius: 0 3px 3px 0; box-shadow: none; }
-.ranking-track .segment:nth-child(1) { background: #31add0; }.ranking-track .segment:nth-child(2) { background: rgb(132,198,84); }.ranking-track .segment:nth-child(3) { background: rgb(234,220,42); }.ranking-track .segment:nth-child(4) { background: rgb(255,167,45); }.ranking-track .segment:nth-child(5) { background: #ff3f56; }
+.ranking-track .segment:nth-child(1) { background: var(--demo-segment-cyan); }.ranking-track .segment:nth-child(2) { background: var(--demo-segment-green); }.ranking-track .segment:nth-child(3) { background: var(--demo-segment-gold); }.ranking-track .segment:nth-child(4) { background: var(--demo-segment-pink); }.ranking-track .segment:nth-child(5) { background: var(--demo-segment-violet); }
.demo-provenance { margin: 12px 4px 0 !important; color: var(--ink-muted); font-size: 11px; text-align: right; }.demo-provenance code { color: var(--accent); background: transparent; }
/* Editorial documentation surfaces. */
@@ -269,98 +366,104 @@ body {
.vp-doc h3,
.vp-doc h4 {
color: var(--ink);
- font-family: var(--font-editorial);
- font-weight: 500;
- letter-spacing: -.025em;
+ font-family: var(--font-ui);
+ font-weight: 600;
+ letter-spacing: -.035em;
}
-.vp-doc h1 { font-size: clamp(42px, 6vw, 64px); line-height: 1; }
+.vp-doc h1 { font-size: clamp(42px, 6vw, 64px); font-weight: 700; line-height: 1; }
.vp-doc h2 { margin-top: 54px; padding-top: 18px; border-top-color: var(--rule); font-size: 34px; line-height: 1.08; }
.vp-doc h3 { font-size: 25px; }
.vp-doc p,
.vp-doc li { color: var(--ink-muted); }
.vp-doc strong { color: var(--ink); }
-.vp-doc a { color: #A94460; text-decoration-color: rgba(169,68,96,.38); text-underline-offset: .18em; }
+.vp-doc a { color: var(--accent); text-decoration-color: rgba(238,123,98,.42); text-underline-offset: .18em; }
.vp-doc a:hover { color: var(--accent); }
.vp-doc :not(pre) > code {
- border: 1px solid rgba(74,46,37,.15);
+ border: 0;
border-radius: 1px;
- background: rgba(255,255,255,.24);
- color: #8E3852;
+ background: #322A2D;
+ color: #E4B781;
font-family: var(--font-code);
font-size: .94em;
- letter-spacing: -.055em;
+ letter-spacing: normal;
}
.vp-doc div[class*="language-"] {
- border: 1px solid var(--ink);
+ border: 0;
border-radius: 2px;
- background: var(--ink) !important;
+ background: #322A2D !important;
+ box-shadow: none;
+}
+.vp-doc div[class*="language-"] pre {
+ padding-block: 18px;
+ background: transparent !important;
}
.vp-doc div[class*="language-"] code,
.vp-doc pre code {
- color: var(--paper-light);
+ color: #CBBEC2;
font-family: var(--font-code);
- font-size: 15px;
- letter-spacing: -.055em;
- line-height: 1.62;
+ font-size: 14.5px;
+ letter-spacing: normal;
+ line-height: 26px;
}
.vp-doc div[class*="language-"] span[style*="--shiki-light"] {
color: var(--shiki-dark) !important;
}
.vp-doc div[class*="language-"] > span.lang {
- color: #D8B6AA;
+ color: #715B63;
font-family: var(--font-ui);
}
+.vp-doc .line-numbers-wrapper { color: #715B63; }
+.vp-doc div[class*="language-"] > button.copy { border-radius: 1px; }
.vp-doc blockquote {
border-left: 2px solid var(--accent);
- background: rgba(255,255,255,.14);
+ background: rgba(233,178,166,.06);
color: var(--ink-muted);
- font-style: italic;
+ font-style: normal;
}
-.vp-doc table { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
-.vp-doc th { background: rgba(74,46,37,.07); color: var(--ink); font-family: var(--font-ui); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
+.vp-doc table { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
+.vp-doc th { background: rgba(233,178,166,.06); color: var(--ink); font-family: var(--font-ui); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.vp-doc tr { border-top-color: var(--rule); }
.vp-doc th,
.vp-doc td { border-color: var(--rule); }
.pager-link {
- border-color: var(--ink) !important;
+ border-color: var(--rule) !important;
border-radius: 2px !important;
background: transparent !important;
}
.pager-link:hover { border-color: var(--accent) !important; }
-.VPLocalSearchBox .shell { border-color: var(--ink) !important; border-radius: 2px !important; background: var(--paper-light) !important; }
+.VPLocalSearchBox .shell { border-color: var(--rule) !important; border-radius: 2px !important; background: var(--paper-light) !important; }
.VPLocalSearchBox .search-input { color: var(--ink) !important; font-family: var(--font-ui); }
.VPLocalSearchBox .result { border-radius: 2px !important; }
@media (max-width: 900px) {
.VPHero { padding-top: 96px !important; }
- .VPHome .vp-doc.container { width: calc(100% - 96px); }
.demo-shell { grid-template-columns: 1fr; }
- .source-panel { border-right: 0; border-bottom: 1px solid rgba(242,209,197,.22); }
+ .source-panel { border-right: 0; border-bottom: 1px solid var(--rule); }
.code-scroll { height: 390px; }
.real-demo-shell .code-scroll { height: 430px; }
.real-preview-body { min-height: 560px; }
}
-@media (max-width: 639px) {
- .VPHome .vp-doc.container { width: calc(100% - 48px); }
-}
-
@media (hover: none), (pointer: coarse) {
.hover-interaction-copy { display: none; }
.touch-interaction-copy { display: inline; }
}
+@media (max-width: 639px) {
+ .VPHome .VPHomeHero { padding-inline: 0 !important; }
+ .VPHome .VPHomeHero .container { padding-inline: 24px; }
+}
+
@media (max-width: 520px) {
- .VPHome .VPHomeHero .container, .VPHome .vp-doc.container { padding-inline: 16px; }
- .VPHome .vp-doc.container { width: calc(100% - 48px); }
.VPHero .name { font-size: 50px !important; }
.VPHero .text { font-size: 29px !important; }
.hero-statement-name { font-size: 50px; }
- .hero-statement-viewport-en { height: 126px; margin-top: -12px; }
- .hero-statement-viewport-zh { height: 62px; margin-top: -18px; }
+ .hero-statement { --hero-rhythm: 40px; --hero-zh-gap: 8px; --hero-zh-line: 25.6px; }
+ .hero-statement-viewport-en { height: 88.74px; }
.hero-statement-en { font-size: 29px; }
.hero-statement-zh { font-size: 16px; }
- .vp-doc .demo-heading h2 { font-size: 26px; }
+ .vp-doc .demo-heading h2 { font-size: 20px; }
+ .VPHome .vp-doc .demo-heading h2 { font-size: 16px; }
.demo-shell { margin-inline: 0; border-radius: 2px; }
.real-preview-body { grid-template-columns: 1fr; gap: 16px; padding: 16px 12px; }
.real-video-frame { height: 480px; }
@@ -372,5 +475,11 @@ body {
*, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
.wordmark-reveal { width: calc(9ch - .495em); animation: none !important; }
.wordmark-cursor { display: none; animation: none !important; }
+ .hero-statement-viewport-en,
+ .hero-statement-viewport-zh,
+ .VPHome .VPHero .actions,
+ .VPHome .carousel-heading,
+ .VPHome .demo-carousel-stage,
+ .VPHome .demo-carousel-controls { opacity: 1; transform: none; animation: none !important; }
.hero-statement-swap-enter-from, .hero-statement-swap-leave-to { filter: none; transform: none; }
}