|
| 1 | +/// <reference no-default-lib="true"/> |
| 2 | +/// <reference lib="esnext"/> |
| 3 | +/// <reference lib="dom" /> |
| 4 | + |
| 5 | +import { BaseStore } from "../../deps/scrapbox.ts"; |
| 6 | +import { Page as PageData } from "../../deps/scrapbox-rest.ts"; |
| 7 | + |
| 8 | +export interface SetPositionOptions { |
| 9 | + /** カーソルが画面外に移動したとき、カーソルが見える位置までページをスクロールするかどうか |
| 10 | + * |
| 11 | + * @default true |
| 12 | + */ |
| 13 | + scrollInView?: boolean; |
| 14 | + |
| 15 | + /** カーソル移動イベントの発生箇所? |
| 16 | + * |
| 17 | + * コード内だと、"mouse"が指定されていた場合があった。詳細は不明 |
| 18 | + */ |
| 19 | + source?: "mouse"; |
| 20 | +} |
| 21 | + |
| 22 | +export interface ApiUrlForFetch { |
| 23 | + projectName: string; |
| 24 | + title: string; |
| 25 | + titleHint: string; |
| 26 | + followRename: boolean; |
| 27 | + search: string; |
| 28 | +} |
| 29 | + |
| 30 | +export interface ApplySnapshotInit { |
| 31 | + page: Pick<PageData, "title" | "lines" | "created">; |
| 32 | + prevPage?: Pick<PageData, "created">; |
| 33 | + nextPage?: Pick<PageData, "lines">; |
| 34 | +} |
| 35 | + |
| 36 | +export type PageWithCache = PageData & { cachedAt: number | undefined }; |
| 37 | + |
| 38 | +/** Scrapboxのページデータを管理する内部クラス |
| 39 | + * |
| 40 | + * 一部型定義は書きかけ |
| 41 | + */ |
| 42 | +export declare class Page extends BaseStore< |
| 43 | + { source: "mouse" | undefined } | "focusTextInput" | "scroll" | undefined |
| 44 | +> { |
| 45 | + public initialize(): void; |
| 46 | + |
| 47 | + private data: PageWithCache; |
| 48 | + |
| 49 | + public get(): PageWithCache; |
| 50 | + |
| 51 | + public apiUrlForFetch(init: ApiUrlForFetch): string; |
| 52 | + public apiUrlForUpdatePageAccessed(pageId: string): string; |
| 53 | + public fetch(): Promise<PageWithCache>; |
| 54 | + |
| 55 | + public set(page: PageWithCache): void; |
| 56 | + public reset(): void; |
| 57 | + public applySnapshot(init: ApplySnapshotInit): void; |
| 58 | + setTitle(title: string, init?: { from: string }): void; |
| 59 | + get fromCacheStorage(): boolean; |
| 60 | + public setPin(pin: number): void; |
| 61 | + public delete(): void; |
| 62 | + public patch(t: unknown): void; |
| 63 | + public patchChanges( |
| 64 | + t: unknown, |
| 65 | + init?: { from: string }, |
| 66 | + ): Promise<unknown>; |
| 67 | + get hasSelfBackLink(): boolean; |
| 68 | + public requestFetchApiCacheToServiceWorker(): unknown; |
| 69 | +} |
0 commit comments