188 lines
4.9 KiB
TypeScript
188 lines
4.9 KiB
TypeScript
import type { NavigationDeclaration } from './navigation.types';
|
|
|
|
const MAIN_SCROLL = [
|
|
{ name: 'main', direction: 'vertical', description: '页面主内容区' },
|
|
] as const;
|
|
|
|
export const NAVIGATION_DECLARATION = {
|
|
app: 'notes',
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
component: 'NotesListPage',
|
|
params: {},
|
|
entryPoint: 'home',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.list.base', search: {}, description: '便签列表页' }],
|
|
queryParams: {},
|
|
description: '便签列表页',
|
|
},
|
|
{
|
|
path: '/todo',
|
|
component: 'TodoListPage',
|
|
params: {},
|
|
entryPoint: 'none',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.todo.base', search: {}, description: '待办页' }],
|
|
queryParams: {},
|
|
description: '待办页',
|
|
},
|
|
{
|
|
path: '/folders',
|
|
component: 'FoldersPage',
|
|
params: {},
|
|
entryPoint: 'none',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.folders.base', search: {}, description: '文件夹页' }],
|
|
queryParams: {},
|
|
description: '文件夹页',
|
|
},
|
|
{
|
|
path: '/settings',
|
|
component: 'NotesSettingsPage',
|
|
params: {},
|
|
entryPoint: 'none',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.settings.base', search: {}, description: '设置页' }],
|
|
queryParams: { tab: 'string' },
|
|
description: '设置页',
|
|
},
|
|
{
|
|
path: '/trash',
|
|
component: 'TrashPage',
|
|
params: {},
|
|
entryPoint: 'none',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.trash.base', search: {}, description: '回收站页' }],
|
|
queryParams: {},
|
|
description: '回收站页',
|
|
},
|
|
{
|
|
path: '/private',
|
|
component: 'PrivateNotesPage',
|
|
params: {},
|
|
entryPoint: 'none',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.private.base', search: {}, description: '私密便签页' }],
|
|
queryParams: {},
|
|
description: '私密便签页',
|
|
},
|
|
{
|
|
path: '/note/:id',
|
|
component: 'NoteEditorPage',
|
|
params: { id: 'string' },
|
|
entryPoint: 'deepLink',
|
|
scrollContainers: MAIN_SCROLL,
|
|
uiStates: [{ id: 'notes.editor.base', search: {}, description: '编辑页' }],
|
|
queryParams: {},
|
|
description: '编辑页',
|
|
},
|
|
],
|
|
transitions: [
|
|
{
|
|
id: 'tab.todo',
|
|
from: ['/', '/todo'],
|
|
to: '/todo',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'replace',
|
|
params: {},
|
|
label: '切换到待办页',
|
|
ui: { placement: 'tabbar', icon: 'todo', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'tab.notes',
|
|
from: '/todo',
|
|
to: '/',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'replace',
|
|
params: {},
|
|
label: '切换到便签页',
|
|
ui: { placement: 'tabbar', icon: 'notes', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'folders.open',
|
|
from: '/',
|
|
to: '/folders',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'push',
|
|
params: {},
|
|
label: '打开文件夹页',
|
|
ui: { placement: 'topbar', icon: 'folder', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'settings.open',
|
|
from: ['/', '/todo'],
|
|
to: '/settings',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'push',
|
|
params: {},
|
|
label: '打开设置页',
|
|
ui: { placement: 'topbar', icon: 'settings', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'private.open',
|
|
from: ['/folders', '/note/:id'],
|
|
to: '/private',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'push',
|
|
params: {},
|
|
label: '打开私密便签页',
|
|
ui: { placement: 'content', icon: 'lock', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'trash.open',
|
|
from: ['/folders', '/note/:id'],
|
|
to: '/trash',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'push',
|
|
params: {},
|
|
label: '打开回收站页',
|
|
ui: { placement: 'content', icon: 'trash', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'note.open',
|
|
from: ['/', '/private', '/trash'],
|
|
to: '/note/:id',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'push',
|
|
params: { id: 'string' },
|
|
label: '打开笔记编辑页',
|
|
ui: { placement: 'content', icon: 'note', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'note.new',
|
|
from: '/',
|
|
to: '/note/:id',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'push',
|
|
params: { id: 'string' },
|
|
label: '新建笔记',
|
|
ui: { placement: 'fab', icon: 'add', gesture: 'tap' },
|
|
},
|
|
{
|
|
id: 'home.open',
|
|
from: ['/folders', '/settings', '/trash', '/private', '/note/:id'],
|
|
to: '/',
|
|
search: {},
|
|
searchParams: {},
|
|
mode: 'replace',
|
|
params: {},
|
|
label: '返回便签首页',
|
|
ui: { placement: 'none', icon: 'home', gesture: 'tap' },
|
|
},
|
|
],
|
|
capabilities: {
|
|
historyBack: true,
|
|
},
|
|
} as const satisfies NavigationDeclaration;
|
|
|
|
export type TransitionId = typeof NAVIGATION_DECLARATION.transitions[number]['id'];
|