Skip to main content

Module notes

Module notes 

Source
Expand description

笔记:列表 /notes、笔记本目录 /notes/book/:id 与阅读页 /notes/:slug?book=。

列表与阅读页共用 880px 容器内的「200px 左栏 + 内容」布局:列表页左栏是筛选, 阅读页左栏是所在笔记本的目录,进入阅读时布局不跳。

数据加载:三个路由在 LazyRoute::data() 里建 Resource 取 SSR 数据,view() 在 Suspense 内消费。会刷新的数据(筛选切换、加载更多、重试)一律走 Effect / 事件处理里的 spawn_local 写镜像信号,不再触碰 Resource, 否则外层 Suspense 会把整页退回骨架屏。

Structs§

DayGroup 🔒
按天分组的笔记流。列表已按时间降序;相邻同一天的笔记归为一组。
DaySectionProps 🔒
Props for the DaySection component.
MomentEntryProps 🔒
Props for the MomentEntry component.
NoteDocumentProps
Props for the NoteDocument component.
NoteRailProps 🔒
Props for the NoteRail component.
NoteRoute
笔记阅读路由,对应 /notes/:slug。book 来自 ?book=,指明一条属于多个笔记本的 笔记在哪本里读;无法解析时按未指明处理。
NoteSectionsProps 🔒
Props for the NoteSections component.
NoteSheetBodyProps 🔒
Props for the NoteSheetBody component.
NoteStreamProps 🔒
Props for the NoteStream component.
NotebookBackProps 🔒
Props for the NotebookBack component.
NotebookContentProps 🔒
Props for the NotebookContent component.
NotebookDirectoryProps 🔒
Props for the NotebookDirectory component.
NotebookEntryProps 🔒
Props for the [NotebookEntry] component.
NotebookPageProps 🔒
Props for the NotebookPage component.
NotebookRoute
笔记本目录路由,对应 /notes/book/:id。
NotesBodyProps 🔒
Props for the NotesBody component.
NotesRoute
笔记列表路由,对应 /notes。
NotesSideProps 🔒
Props for the NotesSide component.
OlderPages 🔒
「更早的记录」追加的页:属于哪个筛选、已加载到第几页。筛选变化后自然作废。
ShownNotes 🔒
当前显示的笔记列表及其筛选;与请求中的筛选不同时表示新结果仍在加载。
TopicCardProps 🔒
Props for the TopicCard component.

Constants§

FILTER_DEBOUNCE_MS 🔒
筛选框输入停顿多久后查询。
KINDS 🔒
笔记类型筛选:全部、随记、主题笔记。
PAGE_SIZE 🔒
列表一页的条数,与服务端 store::list 一致。
SIDE_TAGS 🔒
左栏常用标签数。

Functions§

DaySection 🔒
一天的笔记:日期标题(浏览器端再补相对日期)加该天的随记与主题卡片。
MomentEntry 🔒
随记:无卡片,「时间 + 正文」两列;正文直接渲染,悬停时出现「链接」。
NoteDocument
笔记正文:类型与篇序、衬线标题、时间与标签、正文,以及笔记本内的上一篇 / 下一篇。 后台编辑器的预览(preview)只显示正文部分。
NoteRail 🔒
阅读页左栏:所在笔记本的目录,当前篇浮起并展开本篇小节;不在公开笔记本中时 只有返回链接与本篇小节。小节的当前位置由 yggdrasil-core 的目录 scroll-spy 标出。
NoteSections 🔒
本篇小节(目录 HTML 的一级)。spy 为真时挂上 scroll-spy;抽屉里的副本不挂。
NoteSheetBody 🔒
手机抽屉里的目录:选中一篇或一个小节后收起。锚点点击会被全局处理拦下,收不到 click,所以改听 pointerup 与 Enter。
NoteStream 🔒
按天分组的笔记流,底部「更早的记录」按页追加。
NotebookBack 🔒
NotebookContent 🔒
Required Props
NotebookDirectory 🔒
笔记本目录的编号列表;当前篇浮起,其下展开本篇小节。
NotebookEntry 🔒
Required Props
NotebookPage 🔒
笔记本页:目录请求失败时如实提示并可重试,不误报「笔记本不存在」。 重试与加载更多都是事件处理里的后台请求,结果写进本组件的镜像信号。
NotesBody 🔒
Required Props
NotesSide 🔒
左栏:筛选框、类型、笔记本与常用标签。窄屏只留筛选框与横排类型。
TopicCard 🔒
主题笔记:浮起卡片,衬线标题、两行摘要与「N 节 · 更新于」。
__NoteRoute_View 🔒
__NotebookRoute_View 🔒
__NotesRoute_View 🔒
book_param 🔒
?book= 参数:非数字按没有处理。data() 与悬停预取共用。
fetch_note 🔒
fetch_note_context 🔒
fetch_note_page 🔒
fetch_note_stats 🔒
fetch_notebooks 🔒
公开笔记本目录;列表页与笔记本页共用。
first_filter 🔒
列表页首屏随 SSR 预取的筛选:第一页、无筛选条件。
first_note_page 🔒
列表页首屏数据;无参,便于 unit 包成可作预取键的取数函数。
group_by_day 🔒
note_context 🔒
笔记所在笔记本的上下文。
note_route 🔒
阅读页地址;有笔记本上下文时带上 ?book=。
note_time 🔒
notebook_books 🔒
笔记本目录页的笔记本列表;source 是笔记本 id,仅用于与 notes 共用刷新节奏。
notebook_id 🔒
笔记本 id 参数:非数字为 None(渲染 404)。data() 与悬停预取共用。
notebook_notes 🔒
笔记本目录页的第一页笔记。
notebook_title 🔒
relative_day 🔒
组标题旁的相对日期:今天、昨天、一周内的星期几;跨年时写年份。
use_note_page 🔒
首屏随 SSR 预取挂载;之后的筛选切换在后台请求,结果返回前继续显示当前列表。 不能重新触发 Resource:外层 Suspense 会再次挂起回骨架屏,页面高度坍缩并带动 滚动位置跳动。回到首屏筛选直接复用预取结果。
use_today 🔒
今天的日期只在浏览器挂载后取得:服务端渲染不写相对日期,避免水合不一致与缓存过期。