mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const workbenchViewIconNameSchema = z.enum([
|
|
'trash',
|
|
'allDocs',
|
|
'collection',
|
|
'tag',
|
|
'doc', // refers to a doc whose mode is not yet being resolved
|
|
'page',
|
|
'edgeless',
|
|
'journal',
|
|
'attachment',
|
|
'pdf',
|
|
]);
|
|
|
|
export const workbenchViewMetaSchema = z.object({
|
|
id: z.string(),
|
|
path: z
|
|
.object({
|
|
pathname: z.string().optional(),
|
|
hash: z.string().optional(),
|
|
search: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
// todo: move title/module to cached stated
|
|
title: z.string().optional(),
|
|
iconName: workbenchViewIconNameSchema.optional(),
|
|
});
|
|
|
|
export const workbenchMetaSchema = z.object({
|
|
id: z.string(),
|
|
activeViewIndex: z.number(),
|
|
pinned: z.boolean().optional(),
|
|
basename: z.string(),
|
|
views: z.array(workbenchViewMetaSchema),
|
|
});
|
|
|
|
export const tabViewsMetaSchema = z.object({
|
|
activeWorkbenchId: z.string().optional(),
|
|
workbenches: z.array(workbenchMetaSchema).default([]),
|
|
});
|
|
|
|
export const TabViewsMetaKey = 'tabViewsMetaSchema';
|
|
export type TabViewsMetaSchema = z.infer<typeof tabViewsMetaSchema>;
|
|
export type WorkbenchMeta = z.infer<typeof workbenchMetaSchema>;
|
|
export type WorkbenchViewMeta = z.infer<typeof workbenchViewMetaSchema>;
|
|
export type WorkbenchViewModule = z.infer<typeof workbenchViewIconNameSchema>;
|
|
|
|
export const SpellCheckStateSchema = z.object({
|
|
enabled: z.boolean().optional(),
|
|
});
|
|
|
|
export const SpellCheckStateKey = 'spellCheckState' as const;
|
|
// eslint-disable-next-line no-redeclare
|
|
export type SpellCheckStateSchema = z.infer<typeof SpellCheckStateSchema>;
|