From 15babe6d9642c3123151abcab73e348c5bedf696 Mon Sep 17 00:00:00 2001 From: RAX4096 Date: Wed, 22 Jul 2026 17:57:39 +0800 Subject: [PATCH 1/4] feat(docs): add vitepress-plugin-enhanced-readabilities and update theme styles --- docs/.vitepress/config.mts | 15 + docs/.vitepress/styles/palette.scss | 4 +- docs/.vitepress/theme/custom.css | 667 +++++++++++++++------------- docs/.vitepress/theme/index.ts | 22 +- docs/.vitepress/theme/var.css | 198 +++++++-- package-lock.json | 329 +++++++++++++- package.json | 1 + tests/test_object_stream.py | 36 +- 8 files changed, 918 insertions(+), 354 deletions(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index bfcc92a..edf2dec 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -4,6 +4,21 @@ import { withMermaid } from "vitepress-plugin-mermaid"; export default withMermaid({ lastUpdated: true, ignoreDeadLinks: true, + vite: { + optimizeDeps: { + exclude: [ + "@nolebase/vitepress-plugin-enhanced-readabilities/client", + "vitepress", + "@nolebase/ui", + ], + }, + ssr: { + noExternal: [ + "@nolebase/vitepress-plugin-enhanced-readabilities", + "@nolebase/ui", + ], + }, + }, sitemap: { hostname: "https://sense.amritabot.com", }, diff --git a/docs/.vitepress/styles/palette.scss b/docs/.vitepress/styles/palette.scss index b0eeb9a..4f023e4 100644 --- a/docs/.vitepress/styles/palette.scss +++ b/docs/.vitepress/styles/palette.scss @@ -1,3 +1,3 @@ /* .vitepress/styles/palette.scss */ -$navbar-height: 4rem !default; -$sidebar-width: 20rem !default; +$navbar-height: 3.25rem !default; +$sidebar-width: 260px !default; diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index ef71d59..2a95762 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -1,399 +1,468 @@ -@import "./var.css"; - -.dark { - --vp-c-brand-1: #4a88f4; - --vp-c-brand-2: #228bee; - --vp-c-brand-3: #026bb6; - --vp-c-brand-soft: rgba(74, 113, 255, 0.16); -} - -@keyframes spotlight { - from { - background-position: 0% 50%; - } - to { - background-position: 100% 50%; - } -} - -@keyframes gradientShift { - 0% { - background-position: 0% 50%; - } - 50% { - background-position: 100% 50%; - } - 100% { - background-position: 0% 50%; - } -} +/* + AmritaSense Custom UI + Brand: #0d2b4e / #F6F7FA / #e6C17A +*/ -@keyframes float { - 0% { - transform: translateY(0px); - } - 50% { - transform: translateY(-6px); - } - 100% { - transform: translateY(0px); - } -} - -@keyframes shine { - 0% { - left: -100%; - } - 20% { - left: 120%; - } - 100% { - left: 120%; - } -} +@import "./var.css"; +/* ----- Smooth scroll ----- */ @media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } } -:root { - --vp-c-default-2: var(--vp-c-gray-2); - --vp-c-default-3: var(--vp-c-gray-3); - --vp-c-default-soft: var(--vp-c-gray-soft); - - --vp-c-brand-2: var(--vp-c-indigo-2); - --vp-c-brand-3: var(--vp-c-indigo-3); - --vp-c-brand-soft: var(--vp-c-indigo-soft); - - --vp-c-tip-1: #3dd3d6; - --vp-c-tip-2: #3081a4; - --vp-c-tip-3: #296184; - --vp-c-tip-soft: rgba(16, 185, 129, 0.16); - - --vp-c-warning-1: var(--vp-c-yellow-1); - --vp-c-warning-2: var(--vp-c-yellow-2); - --vp-c-warning-3: var(--vp-c-yellow-3); - --vp-c-warning-soft: var(--vp-c-yellow-soft); - - --vp-c-danger-1: var(--vp-c-red-1); - --vp-c-danger-2: var(--vp-c-red-2); - --vp-c-danger-3: var(--vp-c-red-3); - --vp-c-danger-soft: var(--vp-c-red-soft); -} +/* + Buttons +*/ :root { --vp-button-brand-border: transparent; - --vp-button-brand-text: var(--vp-c-white); + --vp-button-brand-text: #ffffff; --vp-button-brand-bg: var(--vp-c-brand-3); --vp-button-brand-hover-border: transparent; - --vp-button-brand-hover-text: var(--vp-c-white); + --vp-button-brand-hover-text: #ffffff; --vp-button-brand-hover-bg: var(--vp-c-brand-2); --vp-button-brand-active-border: transparent; - --vp-button-brand-active-text: var(--vp-c-white); + --vp-button-brand-active-text: #ffffff; --vp-button-brand-active-bg: var(--vp-c-brand-1); } .VPButton { - border-radius: 40px !important; - font-weight: 600; - letter-spacing: 0.02em; - transition: all 0.3s cubic-bezier(0.2, 0, 0, 1) !important; + border-radius: 6px; + font-weight: 500; + letter-spacing: 0.01em; + transition: all 0.2s ease; position: relative; overflow: hidden; } .VPButton.brand { - background: linear-gradient( - 135deg, - var(--vp-c-brand-3), - var(--vp-c-brand-2), - var(--vp-c-brand-1) - ); - background-size: 200% 200%; - border: none; - box-shadow: 0 6px 20px rgba(27, 21, 214, 0.3); - transition: all 0.3s ease; + background: #0d2b4e; + border: 1px solid #0d2b4e; + box-shadow: 0 2px 6px rgba(13, 43, 78, 0.2); } .VPButton.brand:hover { - transform: translateY(-3px) scale(1.02); - box-shadow: 0 12px 28px rgba(24, 85, 164, 0.5); - background-position: 100% 0; -} - -.VPButton.brand::after { - content: ""; - position: absolute; - top: -50%; - left: -60%; - width: 200%; - height: 200%; - background: linear-gradient( - 90deg, - transparent, - rgba(255, 255, 255, 0.3), - transparent - ); - transform: rotate(30deg); - animation: shine 4s infinite; - pointer-events: none; + background: #143760; + border-color: #143760; + box-shadow: 0 4px 12px rgba(13, 43, 78, 0.3); + transform: translateY(-1px); } .VPButton.alt { background: transparent; - border: 2px solid var(--vp-c-brand-2); - color: var(--vp-c-brand-1); - backdrop-filter: blur(4px); + border: 1.5px solid #0d2b4e; + color: #0d2b4e; } .VPButton.alt:hover { - background: var(--vp-c-brand-soft); - border-color: var(--vp-c-brand-1); - transform: translateY(-3px) scale(1.02); - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); + background: rgba(13, 43, 78, 0.06); + border-color: #143760; + color: #143760; + transform: translateY(-1px); } -:root { - --vp-home-hero-name-color: transparent; - --vp-home-hero-name-background: linear-gradient( - 135deg, - #1e3c72 0%, - #2a5298 25%, - #1e90ff 60%, - #00bfff 100% - ); - --vp-home-hero-image-background: radial-gradient( - circle at 30% 50%, - rgba(25, 50, 100, 0.5) 0%, - rgba(40, 90, 150, 0.4) 30%, - rgba(70, 140, 210, 0.3) 60%, - rgba(120, 190, 250, 0.2) 90% - ); - --vp-home-hero-image-filter: blur(64px); - --vp-home-hero-image-background-image: linear-gradient( - 135deg, - #4534fe, - #78dcfe - ); +/* + Navigation — wide immersive +*/ + +.VPNavBar { + border-bottom: none; + box-shadow: 0 1px 0 var(--vp-c-divider); + backdrop-filter: saturate(180%) blur(16px) !important; + -webkit-backdrop-filter: saturate(180%) blur(16px); + background: var(--vp-nav-bg) !important; } +.VPNavBar.has-sidebar .divider { + display: none; +} + +.VPNavBar .wrapper { + padding: 0 24px; +} + +@media (min-width: 1440px) { + .VPNavBar .wrapper { + padding: 0 40px; + } +} + +.VPNavBarTitle { + display: flex; + align-items: center; + gap: 8px; +} + +.VPNavBarTitle .title { + font-weight: 700; + font-size: 1.05rem; + letter-spacing: -0.03em; + color: var(--vp-c-brand-3); +} + +.dark .VPNavBarTitle .title { + color: var(--vp-c-brand-1); +} + +.VPNavBarMenuLink { + font-weight: 450; + font-size: 0.92rem; + padding: 0 14px; + transition: color 0.15s ease; +} + +.VPNavBarMenuLink:hover, +.VPNavBarMenuLink.active { + color: var(--vp-c-brand-1); +} + +.VPNavBarMenuGroup .text { + font-weight: 450; + font-size: 0.92rem; +} + +/* + Sidebar — same glass as navbar +*/ + +.VPSidebar { + border-right: none; + box-shadow: 1px 0 0 var(--vp-c-divider); + backdrop-filter: saturate(180%) blur(16px) !important; + -webkit-backdrop-filter: saturate(180%) blur(16px); + background: var(--vp-nav-bg) !important; +} + +.VPSidebarItem.is-active > .item > .text, +.VPSidebarItem.is-active > .item > .link > .text { + color: var(--vp-c-brand-1); + font-weight: 600; +} + +.VPSidebarItem .item:hover .text { + color: var(--vp-c-brand-2); +} + +/* + Home Hero — full-viewport immersive +*/ + .VPHomeHero { position: relative; overflow: hidden; isolation: isolate; + padding: 96px 24px 80px; + text-align: left; +} + +@media (min-width: 768px) { + .VPHomeHero { + padding: 120px 48px 96px; + } +} + +@media (min-width: 1280px) { + .VPHomeHero { + padding: 160px 64px 120px; + } } + +/* Large ambient glow — pure blue, no gold */ .VPHomeHero::before { content: ""; position: absolute; - inset: -50%; - background: linear-gradient( - 45deg, - transparent 30%, - rgba(0, 160, 255, 0.06) 50%, - transparent 70% - ); - animation: gradientShift 15s ease-in-out infinite; + inset: -30%; + background: + radial-gradient( + ellipse 60% 50% at 20% 30%, + rgba(13, 43, 78, 0.14) 0%, + transparent 55% + ), + radial-gradient( + ellipse 40% 40% at 80% 50%, + rgba(27, 73, 114, 0.1) 0%, + transparent 55% + ); + pointer-events: none; z-index: -2; } +.dark .VPHomeHero::before { + background: + radial-gradient( + ellipse 60% 50% at 20% 30%, + rgba(141, 180, 216, 0.12) 0%, + transparent 55% + ), + radial-gradient( + ellipse 40% 40% at 80% 50%, + rgba(42, 95, 148, 0.1) 0%, + transparent 55% + ); +} + +/* Subtle dot-grid overlay */ .VPHomeHero::after { content: ""; position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: radial-gradient( - circle at 70% 30%, - rgba(255, 255, 255, 0.1) 0%, - transparent 50% + inset: 0; + background-image: radial-gradient( + rgba(13, 43, 78, 0.06) 1px, + transparent 1px ); + background-size: 32px 32px; pointer-events: none; z-index: -1; + mask-image: radial-gradient( + ellipse 70% 50% at 50% 40%, + black 30%, + transparent 70% + ); } -.VPHomeHero .name { - font-size: clamp(2.5rem, 8vw, 5.5rem); - font-weight: 800; - background: var(--vp-home-hero-name-background); - background-size: 200% 200%; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - animation: gradientShift 8s ease infinite; - text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); - line-height: 1.2; - margin-bottom: 0.2em; - position: relative; - display: inline-block; +.dark .VPHomeHero::after { + background-image: radial-gradient( + rgba(141, 180, 216, 0.05) 1px, + transparent 1px + ); } -.VPHomeHero .name::after { - content: ""; - position: absolute; - bottom: -0.15em; - left: 0; - width: 100%; - height: 0.1em; - background: linear-gradient(90deg, transparent, currentColor, transparent); - opacity: 0.3; - border-radius: 50%; +.VPHomeHero .container { + max-width: 1200px; + margin: 0 auto; +} + +.VPHomeHero .main { + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.VPHomeHero .name { + font-size: clamp(2.4rem, 6vw, 4rem); + font-weight: 800; + letter-spacing: -0.05em; + line-height: 1.1; + max-width: none; } .VPHomeHero .text { - font-size: clamp(1.5rem, 5vw, 2.5rem); - font-weight: 600; - margin-top: 0.5rem; - color: var(--vp-c-text-1); - opacity: 0.9; - letter-spacing: -0.01em; + color: var(--vp-c-text-2); + max-width: 640px; + font-size: clamp(1rem, 2vw, 1.25rem); + line-height: 1.75; + margin-top: 16px; } .VPHomeHero .tagline { - font-size: clamp(1rem, 3vw, 1.4rem); - margin-top: 0.5rem; - color: var(--vp-c-text-2); - opacity: 0.8; - max-width: 40rem; - margin-left: auto; - margin-right: auto; + font-size: 0.9rem; + color: var(--vp-c-text-3); + margin-top: 8px; } -.VPHomeFeatures { - margin-top: 4rem; +.VPHomeHero .actions { + margin-top: 32px; + gap: 14px; } +/* + Features section +*/ + .VPFeature { - background: color-mix(in srgb, var(--vp-c-bg-soft) 80%, transparent); - backdrop-filter: blur(12px); - -webkit-backdrop-filter: blur(12px); - border-radius: 24px; - padding: 2rem 1.8rem; - transition: all 0.4s cubic-bezier(0.2, 0, 0, 1); - border: 1px solid rgba(255, 255, 255, 0.1); - box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06); - position: relative; - overflow: hidden; - animation: float 6s ease-in-out infinite; - animation-delay: calc(var(--vp-feature-index, 0) * 0.15s); + background: var(--vp-c-bg-elv); + border: 1px solid var(--vp-c-border); + border-radius: 8px; + transition: + border-color 0.2s ease, + box-shadow 0.2s ease; } -.VPFeature:nth-child(odd) { - --vp-feature-index: 1; -} -.VPFeature:nth-child(even) { - --vp-feature-index: 2; +.VPFeature:hover { + border-color: var(--vp-c-brand-2); + box-shadow: var(--vp-shadow-2); } -.VPFeature::before { - content: ""; - position: absolute; - inset: 0; - background: linear-gradient( - 125deg, - transparent 0%, - rgba(255, 255, 255, 0.03) 30%, - transparent 60% - ); - opacity: 0; - transition: opacity 0.6s; - pointer-events: none; +.VPFeature .icon { + color: var(--vp-c-brand-1); } -.VPFeature:hover { - transform: translateY(-8px) scale(1.02); - box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12); - border-color: var(--vp-c-brand-2); - background: color-mix( - in srgb, - var(--vp-c-bg-soft) 90%, - var(--vp-c-brand-soft) 10% - ); +/* + Code blocks +*/ + +.vp-doc div[class*="language-"] { + background: var(--vp-code-block-bg); + border: 1px solid var(--vp-c-border); + border-radius: 8px; + box-shadow: none; } -.VPFeature:hover::before { - opacity: 1; +.vp-doc [class*="language-"] code { + font-size: 0.88em; } -.VPFeature .title { - font-size: 1.6rem; - font-weight: 700; - margin-bottom: 1rem; - background: linear-gradient(135deg, var(--vp-c-text-1), var(--vp-c-brand-1)); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - background-clip: text; - letter-spacing: -0.01em; +.vp-doc .highlight-lines .highlighted { + background: var(--vp-code-line-highlight); + border-left: 3px solid var(--vp-c-brand-1); } -.VPFeature .details { - font-size: 1rem; - line-height: 1.7; - color: var(--vp-c-text-2); +/* Inline code — gold warmth */ +.vp-doc :not(pre) > code { + background: rgba(230, 193, 122, 0.14); + border: 1px solid rgba(230, 193, 122, 0.3); + border-radius: 4px; + color: #8b6914; + font-size: 0.88em; + padding: 1px 6px; } -:root { - --vp-custom-block-tip-border: transparent; - --vp-custom-block-tip-text: var(--vp-c-text-1); - --vp-custom-block-tip-bg: var(--vp-c-brand-soft); - --vp-custom-block-tip-code-bg: var(--vp-c-brand-soft); +.dark .vp-doc :not(pre) > code { + background: rgba(230, 193, 122, 0.12); + border-color: rgba(230, 193, 122, 0.2); + color: #e6c17a; } +/* + Custom blocks +*/ + .custom-block { - border-radius: 20px; - backdrop-filter: blur(4px); - border: 1px solid rgba(255, 255, 255, 0.1); - box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05); + border-radius: 6px; + border-left-width: 3px; + font-size: 0.94rem; +} + +.custom-block.tip { + border-color: var(--vp-custom-block-tip-border); +} +.custom-block.info { + border-color: var(--vp-custom-block-info-border); +} +.custom-block.warning { + border-color: var(--vp-custom-block-warning-border); +} +.custom-block.danger { + border-color: var(--vp-custom-block-danger-border); +} + +.custom-block .custom-block-title { + font-weight: 600; + letter-spacing: 0.01em; +} + +/* + Tables +*/ + +.vp-doc table { + border-radius: 6px; + overflow: hidden; + border: 1px solid var(--vp-c-border); +} + +.vp-doc th { + background: var(--vp-c-bg-alt); + font-weight: 600; + color: var(--vp-c-text-1); +} + +.vp-doc tr:nth-child(even) { + background: var(--vp-c-bg-soft); +} + +/* + Scrollbar (dark minimal) +*/ + +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +::-webkit-scrollbar-track { + background: transparent; +} + +::-webkit-scrollbar-thumb { + background: var(--vp-c-text-3); + border-radius: 3px; +} + +::-webkit-scrollbar-thumb:hover { + background: var(--vp-c-text-2); +} + +/* + Focus ring +*/ + +:focus-visible { + outline: 2px solid var(--vp-c-brand-2); + outline-offset: 2px; + border-radius: 2px; +} + +/* + Links — gold accent on hover +*/ + +.vp-doc a { + text-decoration: none; + text-underline-offset: 3px; transition: - transform 0.2s, - box-shadow 0.2s; + color 0.2s ease, + text-decoration-color 0.2s ease; } -.custom-block:hover { - transform: translateY(-2px); - box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1); +.vp-doc a:hover { + text-decoration: underline; + text-decoration-color: #e6c17a; } -.custom-block.tip { - background: color-mix(in srgb, var(--vp-c-brand-soft) 70%, transparent); +/* + Blockquote — gold left border +*/ + +.vp-doc blockquote { + border-left: 3px solid #e6c17a; + background: rgba(230, 193, 122, 0.06); + border-radius: 0 6px 6px 0; } -@media (min-width: 640px) { - :root { - --vp-home-hero-image-filter: blur(72px); - } - .VPHomeHero .name { - font-size: 4rem; - } - .VPHomeHero .text { - font-size: 2rem; - } +.dark .vp-doc blockquote { + background: rgba(230, 193, 122, 0.05); } -@media (min-width: 960px) { - :root { - --vp-home-hero-image-filter: blur(88px); - } - .VPHomeHero .name { - font-size: 5rem; - } - .VPHomeHero .text { - font-size: 2.4rem; - } - .VPFeature { - padding: 2.4rem 2rem; - } +/* + Section headings — subtle gold underline +*/ + +.vp-doc h2 { + border-bottom: 1px solid var(--vp-c-divider); + padding-bottom: 0.3em; } -.light .VPFeature { - background: color-mix(in srgb, var(--vp-c-bg-soft) 70%, white); - border-color: rgba(0, 0, 0, 0.03); +/* + Selection — gold highlight +*/ + +::selection { + background: rgba(230, 193, 122, 0.3); + color: #0d2b4e; } -.light .VPFeature:hover { - background: color-mix( - in srgb, - var(--vp-c-bg-soft) 90%, - var(--vp-c-brand-soft) 10% - ); + +.dark ::selection { + background: rgba(230, 193, 122, 0.25); + color: #f6f7fa; +} + +/* + External link icon (subtle) +*/ + +.vp-doc a[href*="//"]:not([href*="sense.amritabot.com"])::after { + opacity: 0.35; } diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index c495bc1..0a1c225 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,24 @@ +import { h } from "vue"; import DefaultTheme from "vitepress/theme"; +import type { Theme as ThemeConfig } from "vitepress"; +import { + NolebaseEnhancedReadabilitiesMenu, + NolebaseEnhancedReadabilitiesScreenMenu, +} from "@nolebase/vitepress-plugin-enhanced-readabilities/client"; +import "@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css"; +/* 确保 @nolebase/ui 的组件样式也被直接加载 */ +import "@nolebase/ui/style.css"; import "./custom.css"; -export default DefaultTheme; +export const Theme: ThemeConfig = { + extends: DefaultTheme, + Layout: () => { + return h(DefaultTheme.Layout, null, { + "nav-bar-content-after": () => h(NolebaseEnhancedReadabilitiesMenu), + "nav-screen-content-after": () => + h(NolebaseEnhancedReadabilitiesScreenMenu), + }); + }, +}; + +export default Theme; diff --git a/docs/.vitepress/theme/var.css b/docs/.vitepress/theme/var.css index ec1727e..7cd774f 100644 --- a/docs/.vitepress/theme/var.css +++ b/docs/.vitepress/theme/var.css @@ -1,43 +1,181 @@ -.medium-zoom-overlay { - z-index: 30; -} +/* + AmritaSense Design Tokens + Brand: #0d2b4e / #F6F7FA / #e6C17A + Style: 暗夜极简 +*/ -.medium-zoom-image { - z-index: 114 !important; -} +/* ----- Light Mode (default) ----- */ +:root { + /* Background — #F6F7FA 系 */ + --vp-c-bg: #f6f7fa; + --vp-c-bg-alt: #eaecf0; + --vp-c-bg-elv: #ffffff; + --vp-c-bg-soft: #eef0f3; -.vp-doc a { - text-decoration: none; -} + /* Text */ + --vp-c-text-1: #0d1b2a; + --vp-c-text-2: #34495e; + --vp-c-text-3: #7f8c9b; -/* .vitepress\theme\style\var.css */ -/* 提示框背景颜色 */ -:root { - --vp-custom-block-tip-bg: var(--vp-c-green-soft); -} + /* Brand — #0d2b4e 系 */ + --vp-c-brand-1: #1b4972; + --vp-c-brand-2: #143760; + --vp-c-brand-3: #0d2b4e; + --vp-c-brand-soft: rgba(13, 43, 78, 0.06); -/* Info */ -.custom-block.info { - border-color: var(--vp-c-gray-2); -} + /* Borders */ + --vp-c-border: #dde0e5; + --vp-c-divider: #eaecf0; + --vp-c-gutter: #dde0e5; -/* 提示框 */ -.custom-block.tip { - border-color: var(--vp-c-indigo-2); -} + /* Shadow */ + --vp-shadow-1: 0 1px 2px rgba(13, 43, 78, 0.04); + --vp-shadow-2: 0 2px 8px rgba(13, 43, 78, 0.06); + --vp-shadow-3: 0 4px 16px rgba(13, 43, 78, 0.08); + + /* Code */ + --vp-code-block-bg: #eef0f4; + --vp-code-tab-bg: #e2e5ea; + --vp-code-line-highlight: rgba(13, 43, 78, 0.06); + + /* Custom blocks */ + --vp-custom-block-tip-bg: #faf7f0; + --vp-custom-block-info-bg: #f0f3f7; + --vp-custom-block-warning-bg: #fdf6ed; + --vp-custom-block-danger-bg: #fdf3f3; + --vp-custom-block-details-bg: #eef0f3; + + --vp-custom-block-tip-text: #6b5a34; + --vp-custom-block-info-text: #0d2b4e; + --vp-custom-block-warning-text: #7a5d28; + --vp-custom-block-danger-text: #991b1b; + + --vp-custom-block-tip-border: #e6c17a; + --vp-custom-block-info-border: #8a9bb5; + --vp-custom-block-warning-border: #f0d18a; + --vp-custom-block-danger-border: #f4b2b2; + + /* Nav */ + --vp-nav-bg: rgba(246, 247, 250, 0.84); + --vp-nav-height: 56px; + + /* Sidebar */ + --vp-sidebar-width: 260px; + + /* Home hero — bright blue glow on light bg */ + --vp-home-hero-name-color: transparent; + --vp-home-hero-name-background: linear-gradient(135deg, #0d2b4e, #1b4972); + --vp-home-hero-image-background-image: linear-gradient( + 135deg, + #4a90d9 0%, + #7bb8f0 100% + ); + --vp-home-hero-image-filter: blur(64px); + --vp-home-hero-image-background: radial-gradient( + circle at 50% 50%, + rgba(74, 144, 217, 0.3) 0%, + rgba(123, 184, 240, 0.16) 40%, + rgba(180, 210, 245, 0.08) 70%, + transparent 100% + ); -/* 警告框 */ -.custom-block.warning { - /* border-color: #d97706; */ - border-color: var(--vp-c-yellow-2); + /* Status colors */ + --vp-c-tip-1: #c8a454; + --vp-c-tip-2: #b3943a; + --vp-c-tip-3: #9a7d2e; + + --vp-c-warning-1: #e6c17a; + --vp-c-warning-2: #d4a84d; + --vp-c-warning-3: #b89030; + + --vp-c-danger-1: #e05555; + --vp-c-danger-2: #c44040; + --vp-c-danger-3: #a03030; + + --vp-c-default-1: var(--vp-c-gray-1); + --vp-c-default-2: var(--vp-c-gray-2); + --vp-c-default-3: var(--vp-c-gray-3); + --vp-c-default-soft: var(--vp-c-gray-soft); } -/* 危险框 */ -.custom-block.danger { - /* border-color: #f43f5e; */ - border-color: var(--vp-c-red-2); +/* ----- Dark Mode ----- */ +.dark { + /* Background — deep navy derivative */ + --vp-c-bg: #060e18; + --vp-c-bg-alt: #0b1522; + --vp-c-bg-elv: #101c2c; + --vp-c-bg-soft: #0d1826; + + /* Text */ + --vp-c-text-1: #f6f7fa; + --vp-c-text-2: #b0bec5; + --vp-c-text-3: #6b7d8e; + + /* Brand — lighter shades for dark bg readability */ + --vp-c-brand-1: #8db4d8; + --vp-c-brand-2: #5a8ebf; + --vp-c-brand-3: #2a5f94; + --vp-c-brand-soft: rgba(90, 142, 191, 0.12); + + /* Borders */ + --vp-c-border: #1a2a3c; + --vp-c-divider: #142030; + --vp-c-gutter: #1a2a3c; + + /* Shadow */ + --vp-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4); + --vp-shadow-2: 0 2px 8px rgba(0, 0, 0, 0.5); + --vp-shadow-3: 0 4px 16px rgba(0, 0, 0, 0.6); + + /* Code */ + --vp-code-block-bg: #0b1522; + --vp-code-tab-bg: #101c2c; + --vp-code-line-highlight: rgba(141, 180, 216, 0.08); + + /* Custom blocks */ + --vp-custom-block-tip-bg: rgba(230, 193, 122, 0.06); + --vp-custom-block-info-bg: rgba(13, 43, 78, 0.15); + --vp-custom-block-warning-bg: rgba(230, 193, 122, 0.08); + --vp-custom-block-danger-bg: rgba(224, 85, 85, 0.08); + --vp-custom-block-details-bg: rgba(141, 180, 216, 0.04); + + --vp-custom-block-tip-text: #e6c17a; + --vp-custom-block-info-text: #8db4d8; + --vp-custom-block-warning-text: #f0d18a; + --vp-custom-block-danger-text: #f4b2b2; + + --vp-custom-block-tip-border: rgba(230, 193, 122, 0.3); + --vp-custom-block-info-border: rgba(141, 180, 216, 0.25); + --vp-custom-block-warning-border: rgba(230, 193, 122, 0.35); + --vp-custom-block-danger-border: rgba(224, 85, 85, 0.3); + + /* Nav */ + --vp-nav-bg: rgba(6, 14, 24, 0.86); + + /* Home hero — pure blue even in dark */ + --vp-home-hero-name-background: linear-gradient(135deg, #8db4d8, #a0c4e8); + --vp-home-hero-image-background-image: linear-gradient( + 135deg, + #2a5f94 0%, + #4a8fc8 100% + ); + --vp-home-hero-image-filter: blur(72px); + --vp-home-hero-image-background: radial-gradient( + circle at 50% 50%, + rgba(141, 180, 216, 0.25) 0%, + rgba(90, 142, 191, 0.15) 40%, + rgba(42, 95, 148, 0.06) 70%, + transparent 100% + ); } +/* ----- Utility fixes ----- */ +.medium-zoom-overlay { + z-index: 30; +} +.medium-zoom-image { + z-index: 114 !important; +} .VPSocialLinks.VPNavBarSocialLinks.social-links { margin-right: 0; } diff --git a/package-lock.json b/package-lock.json index 841156c..90e7256 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,11 +4,13 @@ "requires": true, "packages": { "": { + "name": "AmritaSense", "dependencies": { "@vuepress/plugin-palette": "^2.0.0-rc.112", "vitepress-plugin-mermaid": "^2.0.17" }, "devDependencies": { + "@nolebase/vitepress-plugin-enhanced-readabilities": "^2.18.2", "vitepress": "^1.6.3" } }, @@ -832,6 +834,36 @@ "node": ">=18" } }, + "node_modules/@iconify-json/carbon": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@iconify-json/carbon/-/carbon-1.2.24.tgz", + "integrity": "sha512-b7u/eTWE3xFa7UXlRJBSEm6At1y6+F0P3imBEip5/8QeRzouxVjBf80Y2xnu1GYsFo9MYlHA0bZfxxMd5givfw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@iconify/types": "*" + } + }, + "node_modules/@iconify-json/icon-park-outline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@iconify-json/icon-park-outline/-/icon-park-outline-1.2.4.tgz", + "integrity": "sha512-NyZxXe2gD2TbTOyoRRMdtEJhr6i2KQCdDlYYoOn5oZLndQjwpIhw79hzeFhXvP38/o40D3gQ+l+IaSJgbB+0TQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@iconify/types": "*" + } + }, + "node_modules/@iconify-json/octicon": { + "version": "1.2.29", + "resolved": "https://registry.npmjs.org/@iconify-json/octicon/-/octicon-1.2.29.tgz", + "integrity": "sha512-yREprVAv+SiAO8dxGw40LMLou4eXDYJX9Cz4MB1Cki4d+peSCpQ4b99YaaRbwuJeyyjLM4Q03QzBcEfcf6xCcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@iconify/types": "*" + } + }, "node_modules/@iconify-json/simple-icons": { "version": "1.2.80", "resolved": "https://registry.npmjs.org/@iconify-json/simple-icons/-/simple-icons-1.2.80.tgz", @@ -1059,6 +1091,37 @@ "@chevrotain/types": "~11.1.1" } }, + "node_modules/@nolebase/ui": { + "version": "2.18.2", + "resolved": "https://registry.npmjs.org/@nolebase/ui/-/ui-2.18.2.tgz", + "integrity": "sha512-xxfRacF9cqQ5/umMhvhr0y2W4SkhzTmrrAHJ0UAAu/pIWfV/JPE9Hj0buH06bK7ZEUur+036gxkKlStI6UtDBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@iconify-json/octicon": "^1.2.10", + "less": "^4.4.0" + }, + "peerDependencies": { + "vitepress": "^1.5.0 || ^2.0.0-alpha.1", + "vue": ">= 3.5.18" + } + }, + "node_modules/@nolebase/vitepress-plugin-enhanced-readabilities": { + "version": "2.18.2", + "resolved": "https://registry.npmjs.org/@nolebase/vitepress-plugin-enhanced-readabilities/-/vitepress-plugin-enhanced-readabilities-2.18.2.tgz", + "integrity": "sha512-fDhdZBSJL2qs/1xac0PtJfU5UI7b36ffVPYgzM8Ig2NjqMJ7cBvrTTPGq03lUeMjK7GD7fItAKudaP+ZrtMg8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@iconify-json/carbon": "^1.2.11", + "@iconify-json/icon-park-outline": "^1.2.2", + "@nolebase/ui": "^2.18.2", + "less": "^4.4.0" + }, + "peerDependencies": { + "vitepress": "^1.5.0 || ^2.0.0-alpha.1" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.60.2", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.2.tgz", @@ -3477,6 +3540,20 @@ "node": ">=4" } }, + "node_modules/errno": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", + "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" + } + }, "node_modules/es-toolkit": { "version": "1.47.1", "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.47.1.tgz", @@ -3995,8 +4072,7 @@ "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/gray-matter": { "version": "4.0.3", @@ -4288,6 +4364,61 @@ "integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==", "license": "MIT" }, + "node_modules/less": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/less/-/less-4.7.0.tgz", + "integrity": "sha512-i7dAlT3+boO0mMh1G4cex0vz1lLAScmBbikm1VEDNv+cy0ore1CUo2UtX8m3N9QLE5WYDr4ISbiCRzHNGyFkrA==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "copy-anything": "^3.0.5", + "parse-node-version": "^1.0.1" + }, + "bin": { + "lessc": "bin/lessc" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "make-dir": "^5.1.0", + "mime": "^1.4.1", + "needle": "^3.1.0", + "probe-image-size": "^7.2.3", + "source-map": "~0.6.0" + } + }, + "node_modules/less/node_modules/copy-anything": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", + "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "is-what": "^4.1.8" + }, + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, + "node_modules/less/node_modules/is-what": { + "version": "4.1.16", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz", + "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/linkify-it": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz", @@ -4333,6 +4464,14 @@ "license": "MIT", "peer": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/log-symbols": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-7.0.1.tgz", @@ -4375,6 +4514,20 @@ "url": "https://github.com/sponsors/sxzz" } }, + "node_modules/make-dir": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-5.1.0.tgz", + "integrity": "sha512-IfpFq6UM39dUNiphpA6uDezNx/AvWyhwfICWPR3t1VspkgkMZrL+Rk1RbN1bx+aeNYwOrqGJgEgV3yotk+ZUVw==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mark.js": { "version": "8.11.1", "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", @@ -4594,6 +4747,20 @@ ], "license": "MIT" }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mimic-function": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", @@ -4655,8 +4822,7 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/muggle-string": { "version": "0.4.1", @@ -4683,6 +4849,24 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/needle": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/needle/-/needle-3.5.0.tgz", + "integrity": "sha512-jaQyPKKk2YokHrEg+vFDYxXIHTCBgiZwSHOoVx/8V3GIBS8/VN6NdVRmg8q1ERtPkMvmOvebsgga4sAj5hls/w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.3", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, "node_modules/non-layered-tidy-tree-layout": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz", @@ -4759,6 +4943,16 @@ "license": "MIT", "peer": true }, + "node_modules/parse-node-version": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", + "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/parse5": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", @@ -4915,6 +5109,73 @@ "url": "https://opencollective.com/preact" } }, + "node_modules/probe-image-size": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/probe-image-size/-/probe-image-size-7.3.0.tgz", + "integrity": "sha512-7CaDeBwiAbh6ohXsvLbAZhO7wzsZAmaevfxe39qvCwRh8LyaZfDlBGGLU1CCTgrTLtCOdwBBhjOrIHaIIimHfQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "optional": true, + "dependencies": { + "lodash.merge": "^4.6.2", + "needle": "^2.5.2", + "stream-parser": "~0.3.1" + } + }, + "node_modules/probe-image-size/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/probe-image-size/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/probe-image-size/node_modules/needle": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.9.1.tgz", + "integrity": "sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, "node_modules/property-information": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", @@ -4925,6 +5186,14 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/punycode.js": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", @@ -5087,6 +5356,17 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, + "node_modules/sax": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", + "dev": true, + "license": "BlueOak-1.0.0", + "optional": true, + "engines": { + "node": ">=11.0.0" + } + }, "node_modules/scule": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/scule/-/scule-1.3.0.tgz", @@ -5143,6 +5423,17 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -5190,6 +5481,36 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/stream-parser": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", + "integrity": "sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "2" + } + }, + "node_modules/stream-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/stream-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT", + "optional": true + }, "node_modules/string-width": { "version": "8.2.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.1.tgz", diff --git a/package.json b/package.json index 8997bed..a79773c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "devDependencies": { + "@nolebase/vitepress-plugin-enhanced-readabilities": "^2.18.2", "vitepress": "^1.6.3" }, "scripts": { diff --git a/tests/test_object_stream.py b/tests/test_object_stream.py index 6b2bf2f..7222a21 100644 --- a/tests/test_object_stream.py +++ b/tests/test_object_stream.py @@ -5,9 +5,9 @@ from amrita_sense.exceptions import StreamStateError from amrita_sense.streaming import SUSPEND_ON_YIELD, SuspendObjectStream -# ============================================================================ +# ============================== # Helpers -# ============================================================================ +# ============================== async def _consume_all(obj: SuspendObjectStream) -> list: @@ -70,9 +70,9 @@ async def suspend_func(): hd.cancel() -# ============================================================================ +# ============================== # A. suspend decorator (4 tests) -# ============================================================================ +# ============================== @pytest.mark.asyncio @@ -138,9 +138,9 @@ async def my_func(x: int) -> int: await my_func(42) -# ============================================================================ +# ============================== # B. Multi-waiter resume (1 test) -# ============================================================================ +# ============================== @pytest.mark.asyncio @@ -168,9 +168,9 @@ async def waiter(): assert counter[0] == 2 -# ============================================================================ +# ============================== # C. wait_to_suspend boundaries (2 tests) -# ============================================================================ +# ============================== @pytest.mark.asyncio @@ -216,9 +216,9 @@ async def worker(): await t2 -# ============================================================================ +# ============================== # D. resume no-op (1 test) -# ============================================================================ +# ============================== @pytest.mark.asyncio @@ -228,9 +228,9 @@ async def test_resume_noop(): obj.resume() # no error -# ============================================================================ +# ============================== # E. Queue operations (7 tests) -# ============================================================================ +# ============================== def test_queue_closed_initial(): @@ -313,9 +313,9 @@ async def my_callback(item): assert received == ["via-callback"] -# ============================================================================ +# ============================== # F. Callback settings (4 tests) -# ============================================================================ +# ============================== @pytest.mark.asyncio @@ -374,9 +374,9 @@ async def cb2(x): obj.set_callback_fun_sending(cb2) -# ============================================================================ +# ============================== # G. Generator lifecycle (5 tests) -# ============================================================================ +# ============================== def test_get_generator_already_consumed(): @@ -447,9 +447,9 @@ async def test_response_generator_done_marker(): assert results == ["x"] -# ============================================================================ +# ============================== # H. SUSPEND_ON_YIELD tag shortcut (1 test) -# ============================================================================ +# ============================== @pytest.mark.asyncio From b7f1a25db4b9be15199afd247ca580ad2425e3c2 Mon Sep 17 00:00:00 2001 From: RAX4096 Date: Wed, 22 Jul 2026 18:01:08 +0800 Subject: [PATCH 2/4] Styke: format code --- tests/test_object_stream.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tests/test_object_stream.py b/tests/test_object_stream.py index 7222a21..ae6fea0 100644 --- a/tests/test_object_stream.py +++ b/tests/test_object_stream.py @@ -5,9 +5,7 @@ from amrita_sense.exceptions import StreamStateError from amrita_sense.streaming import SUSPEND_ON_YIELD, SuspendObjectStream -# ============================== # Helpers -# ============================== async def _consume_all(obj: SuspendObjectStream) -> list: @@ -70,9 +68,7 @@ async def suspend_func(): hd.cancel() -# ============================== # A. suspend decorator (4 tests) -# ============================== @pytest.mark.asyncio @@ -138,9 +134,7 @@ async def my_func(x: int) -> int: await my_func(42) -# ============================== # B. Multi-waiter resume (1 test) -# ============================== @pytest.mark.asyncio @@ -168,9 +162,7 @@ async def waiter(): assert counter[0] == 2 -# ============================== # C. wait_to_suspend boundaries (2 tests) -# ============================== @pytest.mark.asyncio @@ -216,9 +208,7 @@ async def worker(): await t2 -# ============================== # D. resume no-op (1 test) -# ============================== @pytest.mark.asyncio @@ -228,9 +218,7 @@ async def test_resume_noop(): obj.resume() # no error -# ============================== # E. Queue operations (7 tests) -# ============================== def test_queue_closed_initial(): @@ -313,9 +301,7 @@ async def my_callback(item): assert received == ["via-callback"] -# ============================== # F. Callback settings (4 tests) -# ============================== @pytest.mark.asyncio @@ -374,9 +360,7 @@ async def cb2(x): obj.set_callback_fun_sending(cb2) -# ============================== # G. Generator lifecycle (5 tests) -# ============================== def test_get_generator_already_consumed(): @@ -447,9 +431,7 @@ async def test_response_generator_done_marker(): assert results == ["x"] -# ============================== # H. SUSPEND_ON_YIELD tag shortcut (1 test) -# ============================== @pytest.mark.asyncio From 6a0b99df4a487c9238159a0e07aa7b69560d7cd8 Mon Sep 17 00:00:00 2001 From: RAX4096 Date: Wed, 22 Jul 2026 18:04:31 +0800 Subject: [PATCH 3/4] Fix: docs issue --- docs/.vitepress/theme/var.css | 19 +++++++++++++++++++ docs/guide/advanced/event_system.md | 2 +- docs/zh/guide/advanced/event_system.md | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/.vitepress/theme/var.css b/docs/.vitepress/theme/var.css index 7cd774f..2188f08 100644 --- a/docs/.vitepress/theme/var.css +++ b/docs/.vitepress/theme/var.css @@ -83,14 +83,17 @@ --vp-c-tip-1: #c8a454; --vp-c-tip-2: #b3943a; --vp-c-tip-3: #9a7d2e; + --vp-c-tip-soft: rgba(230, 193, 122, 0.14); --vp-c-warning-1: #e6c17a; --vp-c-warning-2: #d4a84d; --vp-c-warning-3: #b89030; + --vp-c-warning-soft: rgba(230, 193, 122, 0.14); --vp-c-danger-1: #e05555; --vp-c-danger-2: #c44040; --vp-c-danger-3: #a03030; + --vp-c-danger-soft: rgba(224, 85, 85, 0.12); --vp-c-default-1: var(--vp-c-gray-1); --vp-c-default-2: var(--vp-c-gray-2); @@ -149,6 +152,22 @@ --vp-custom-block-warning-border: rgba(230, 193, 122, 0.35); --vp-custom-block-danger-border: rgba(224, 85, 85, 0.3); + /* Status colors — dark */ + --vp-c-tip-1: #e6C17A; + --vp-c-tip-2: #d4a84d; + --vp-c-tip-3: #c8a454; + --vp-c-tip-soft: rgba(230, 193, 122, 0.12); + + --vp-c-warning-1: #f0d18a; + --vp-c-warning-2: #e6C17A; + --vp-c-warning-3: #d4a84d; + --vp-c-warning-soft: rgba(230, 193, 122, 0.12); + + --vp-c-danger-1: #f4b2b2; + --vp-c-danger-2: #e05555; + --vp-c-danger-3: #c44040; + --vp-c-danger-soft: rgba(224, 85, 85, 0.12); + /* Nav */ --vp-nav-bg: rgba(6, 14, 24, 0.86); diff --git a/docs/guide/advanced/event_system.md b/docs/guide/advanced/event_system.md index fc32e08..c6f56fc 100644 --- a/docs/guide/advanced/event_system.md +++ b/docs/guide/advanced/event_system.md @@ -38,7 +38,7 @@ If interruption or suspension behavior is needed inside an event handler, **it m Event handlers **fully reuse** AmritaSense's dependency injection system. Handlers can declare arbitrary dependencies via `Depends(...)` — including `POINTER_DEPENDS` to obtain the current `WorkflowInterpreter` instance — and the runtime will automatically resolve and inject them before invocation. This means event handlers enjoy the same DI capabilities as `@Node()` functions: type safety, concurrent resolution, and termination when a `Depends` factory returns `None`. -> **Relationship with Core's Event System**: AmritaSense's event system is an independent mirror of Core's event system. Both share identical API design and DI contracts, yet operate independently. Core event handlers do not need to be aware of Sense, and Sense nodes do not need to depend on Core — they collaborate solely through the `DependencyMeta` data structure. +> **Relationship with Core's Event System**: AmritaSense is the runtime foundation of Core. Sense's event system serves as the underlying execution engine for Core's event system. Both share identical API design and DI contracts — Core's `@on_event()` handlers are directly dispatched by Sense's `MatcherFactory`. ## Custom Event Example diff --git a/docs/zh/guide/advanced/event_system.md b/docs/zh/guide/advanced/event_system.md index 9a8a4a5..5733c8d 100644 --- a/docs/zh/guide/advanced/event_system.md +++ b/docs/zh/guide/advanced/event_system.md @@ -38,7 +38,7 @@ AmritaSense 的事件系统是与工作流解释器**并行独立**的运行时 事件处理器**完全复用** AmritaSense 的依赖注入系统。处理器可以通过 `Depends(...)` 声明任意依赖——包括 `POINTER_DEPENDS` 获取当前 `WorkflowInterpreter` 实例——运行时会在调用前自动解析并注入。这意味着事件处理器享有和 `@Node()` 节点完全相同的 DI 能力:类型安全、并发解析、以及 `Depends` 返回 `None` 时终止执行的行为。 -> **与 Core 事件系统的关系**:AmritaSense 的事件系统是 Core 事件系统的独立镜像,两者共享完全相同的 API 设计与依赖注入契约,但各自独立运行。Core 的事件处理器不需要感知 Sense,Sense 的节点也不需要依赖 Core——它们只通过 `DependencyMeta` 这一通用数据结构进行协作。 +> **与 Core 事件系统的关系**:AmritaSense 是 Core 的运行时基石,Sense 的事件系统是 Core 事件系统的底层执行引擎。两者共享完全相同的 API 设计与依赖注入契约——Core 的 `@on_event()` 处理器直接被 Sense 的 `MatcherFactory` 调度执行。 ## 自定义事件示例 From e757d9d17e91a278b995adc91dfcf27965da6e80 Mon Sep 17 00:00:00 2001 From: RAX4096 Date: Wed, 22 Jul 2026 18:18:54 +0800 Subject: [PATCH 4/4] docs: Wrong usage of ARCHIVED_NODES --- docs/guide/practice/interrupt-routine.md | 3 ++- docs/zh/guide/practice/interrupt-routine.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/guide/practice/interrupt-routine.md b/docs/guide/practice/interrupt-routine.md index a6ae39d..128057d 100644 --- a/docs/guide/practice/interrupt-routine.md +++ b/docs/guide/practice/interrupt-routine.md @@ -117,8 +117,9 @@ async def handle_auth_failure() -> None: handler_library = ARCHIVED_NODES( ALIAS(handle_timeout, "timeout"), + INTERRUPT_RET(), ALIAS(handle_auth_failure, "auth"), - INTERRUPT_RET(), # shared return + INTERRUPT_RET(), ) comp = ( diff --git a/docs/zh/guide/practice/interrupt-routine.md b/docs/zh/guide/practice/interrupt-routine.md index f5d7b08..bf9ada8 100644 --- a/docs/zh/guide/practice/interrupt-routine.md +++ b/docs/zh/guide/practice/interrupt-routine.md @@ -117,8 +117,9 @@ async def handle_auth_failure() -> None: handler_library = ARCHIVED_NODES( ALIAS(handle_timeout, "timeout"), + INTERRUPT_RET(), ALIAS(handle_auth_failure, "auth"), - INTERRUPT_RET(), # 共享返回 + INTERRUPT_RET(), ) comp = (