SilverBullet pivot to become an offline-first PWA (#403)

This commit is contained in:
Zef Hemel
2023-05-23 20:53:53 +02:00
committed by GitHub
parent b256269897
commit 5f484bed57
389 changed files with 4484 additions and 291129 deletions
+28 -4
View File
@@ -1,5 +1,26 @@
import { AppCommand } from "./hooks/command.ts";
import { FilterOption, PageMeta } from "../common/types.ts";
export type PageMeta = {
name: string;
lastModified: number;
lastOpened?: number;
perm: "ro" | "rw";
} & Record<string, any>;
export type AttachmentMeta = {
name: string;
contentType: string;
lastModified: number;
size: number;
perm: "ro" | "rw";
};
// Used by FilterBox
export type FilterOption = {
name: string;
orderId?: number;
hint?: string;
} & Record<string, any>;
export type Notification = {
id: number;
@@ -28,8 +49,9 @@ export type AppViewState = {
showCommandPalette: boolean;
showCommandPaletteContext?: string;
unsavedChanges: boolean;
synced: boolean;
panels: { [key: string]: PanelConfig };
allPages: Set<PageMeta>;
allPages: PageMeta[];
commands: Map<string, AppCommand>;
notifications: Notification[];
recentCommands: Map<string, Date>;
@@ -65,6 +87,7 @@ export const initialViewState: AppViewState = {
showPageNavigator: false,
showCommandPalette: false,
unsavedChanges: false,
synced: true,
uiOptions: {
vimMode: false,
darkMode: false,
@@ -76,7 +99,7 @@ export const initialViewState: AppViewState = {
bhs: {},
modal: {},
},
allPages: new Set(),
allPages: [],
commands: new Map(),
recentCommands: new Map(),
notifications: [],
@@ -94,9 +117,10 @@ export const initialViewState: AppViewState = {
export type Action =
| { type: "page-loaded"; meta: PageMeta }
| { type: "page-loading"; name: string }
| { type: "pages-listed"; pages: Set<PageMeta> }
| { type: "pages-listed"; pages: PageMeta[] }
| { type: "page-changed" }
| { type: "page-saved" }
| { type: "sync-change"; synced: boolean }
| { type: "start-navigate" }
| { type: "stop-navigate" }
| {