bible-note 0.4.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,32 @@
1
+ /**
2
+ * Where the editor keeps its own state — settings, comments, read-only mode,
3
+ * zoom, panel state — as string values under the keys in
4
+ * `BIBLE_NOTE_STORAGE_MANAGER_KEYS`. The note itself goes through
5
+ * `loadData` / `saveData` instead. Every key is read once, before the editor
6
+ * first renders; writes are fire-and-forget.
7
+ */
1
8
  export type BibleNoteStorageManager = {
9
+ /** Stores `value` (a string, or a value to `JSON.stringify`) under `key`. */
2
10
  setSetting(key: string, value: unknown): Promise<void>;
11
+ /** The value stored under `key`, or `null` when there is none. */
3
12
  getSetting<T = unknown>(key: string): Promise<T | null>;
13
+ /** Removes `key`. */
4
14
  deleteSetting(key: string): Promise<void>;
5
15
  };
6
16
  type BibleNoteStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
17
+ /**
18
+ * Every key the editor reads from its storage manager before it renders. A
19
+ * host-side store that needs to know its keys up front (to prefetch or migrate
20
+ * them) can use this list.
21
+ */
7
22
  export declare const BIBLE_NOTE_STORAGE_MANAGER_KEYS: readonly ["lexical-playground-settings", "lexical-playground-editor-state", "lexical-playground-comments", "lexical-playground-comments-panel-open", "lexical-playground-block-text-links", "lexical-playground-read-only-mode", "lexical-playground-insert-character-picker", "lexical-playground-editor-zoom-percent"];
8
23
  export declare function configureBibleNoteStorageManager(storageManager?: BibleNoteStorageManager): void;
9
24
  export declare function hydrateBibleNoteStorageManager(keys: ReadonlyArray<string>): Promise<void>;
10
25
  export declare function getBibleNoteStorage(): BibleNoteStorage | null;
26
+ /**
27
+ * A `BibleNoteStorageManager` backed by `window.localStorage`. Non-string
28
+ * values are stored as JSON; when `localStorage` is unavailable every call is
29
+ * a no-op.
30
+ */
11
31
  export declare function createBrowserStorageManager(): BibleNoteStorageManager;
12
32
  export {};
@@ -1,8 +1,15 @@
1
+ /** How a media file reached the editor: dropped/pasted, or picked in the media dialog. */
1
2
  export type FilePathSource = 'drop' | 'file-input';
3
+ /** Context passed to a `FilePathResolver`. */
2
4
  export type FilePathResolverContext = Readonly<{
3
5
  source: FilePathSource;
4
6
  }>;
7
+ /**
8
+ * Maps a media file to the path or URL the note should reference. Return
9
+ * `null` (or throw) to let the editor embed the file as a data URL instead.
10
+ */
5
11
  export type FilePathResolver = (file: File, context: FilePathResolverContext) => Promise<string | null> | string | null;
12
+ /** Shows a local media file to the user, e.g. in the system file manager. */
6
13
  export type FileRevealer = (filePath: string) => Promise<void> | void;
7
14
  export declare function getFallbackFilePath(file: File): string;
8
15
  export declare function resolveMediaFilePath(resolver: FilePathResolver | undefined, file: File, source: FilePathSource): Promise<string | null>;
@@ -5,11 +5,17 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ /** A font in the toolbar's font menu: `[fontFamily, label, languageCode]`. */
8
9
  export type FontFamilyOption = readonly [
9
10
  fontFamily: string,
10
11
  label: string,
11
12
  language: string
12
13
  ];
14
+ /**
15
+ * A host font added to the editor: `[fontFamily, languageCode]`, e.g.
16
+ * `['Battambang', 'km']`. The language code is what `getLangCode` returns
17
+ * for text that should use this font.
18
+ */
13
19
  export type ExtraFontFamilyOption = readonly [
14
20
  fontFamily: string,
15
21
  language: string