orz-slides-browser 1.2.0 → 1.4.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.
- package/README.md +3 -3
- package/docs/embedding.md +31 -2
- package/esm/orz-slides.browser.mjs +285 -239
- package/index.d.ts +59 -0
- package/orz-slides.browser.js +295 -249
- package/package.json +1 -1
- package/release.json +3 -3
package/index.d.ts
CHANGED
|
@@ -26,6 +26,19 @@ export interface AssembleOptions {
|
|
|
26
26
|
includes?: Record<string, string>;
|
|
27
27
|
/** (1.1) The host's twin-link naming: links to text twins point at these names, and the file keeps it (`#orz-shell` `"links"`, only when it is not the family naming). An invalid naming rejects. */
|
|
28
28
|
twinLinks?: TwinNaming;
|
|
29
|
+
/** (orz-markdown 2.9.0) A reader copy: `true` or `{ notice }` (plain text, 1–300 characters) — the file is published for readers (a website's page); opened there, its editor says edits can't be saved to the website and Save reads "Download a copy". Stored in `#orz-shell` as `"readerCopy"`. */
|
|
30
|
+
readerCopy?: boolean | { notice?: string };
|
|
31
|
+
/** (orz-markdown 2.10.0) Site navigation: the file's place in a set of pages — drawn as a slim bar above the read view (title → home, Previous / Next), outside the text, never printed. Plain-text title and labels; relative or absolute http(s) hrefs. Stored in `#orz-shell` as `"siteNav"`; every save and update keeps it. An invalid value rejects. */
|
|
32
|
+
siteNav?: SiteNav;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** (orz-markdown 2.10.0, FC-18 §8.2) A page's place in a set of pages. */
|
|
36
|
+
export interface SiteNav {
|
|
37
|
+
/** The set's title (plain text), linking to `home`. */
|
|
38
|
+
title: string;
|
|
39
|
+
home: string;
|
|
40
|
+
previous?: { href: string; label: string };
|
|
41
|
+
next?: { href: string; label: string };
|
|
29
42
|
}
|
|
30
43
|
|
|
31
44
|
export interface Extracted {
|
|
@@ -37,6 +50,10 @@ export interface Extracted {
|
|
|
37
50
|
includes?: Record<string, string>;
|
|
38
51
|
/** (1.1) The file's twin-link naming (`#orz-shell` `"links"`); absent: the family naming. */
|
|
39
52
|
twinLinks?: TwinNaming;
|
|
53
|
+
/** (orz-markdown 2.9.0) The file's reader-copy setting (`#orz-shell` `"readerCopy"`), when it has one. */
|
|
54
|
+
readerCopy?: { notice?: string };
|
|
55
|
+
/** (orz-markdown 2.10.0) The file's site navigation (`#orz-shell` `"siteNav"`), when it has one. */
|
|
56
|
+
siteNav?: SiteNav;
|
|
40
57
|
/**
|
|
41
58
|
* (1.1) An orz-slides 0.x file: `text` is what the Node `upgrade` writes (the deck block, title, metadata and the
|
|
42
59
|
* theme 0.x showed moved into one header; a fresh uid when it had none), `shell` is ''; what was converted.
|
|
@@ -64,6 +81,38 @@ export interface DocumentInfo {
|
|
|
64
81
|
export interface TextRange { from: number; to: number }
|
|
65
82
|
export interface AiOperation { id: string; title: string; selection: boolean }
|
|
66
83
|
|
|
84
|
+
/** (orz-markdown 2.7.0, FC-19 §3) How the save status's dot reads: `saved` green, `pending` neutral (a routine wait), `unsaved` amber, `error` red. */
|
|
85
|
+
export type SaveTone = 'saved' | 'pending' | 'unsaved' | 'error';
|
|
86
|
+
/** (orz-markdown 2.7.0) The save status a host supplies (`hooks.saveStatus`): its words and the dot's tone (default: `pending` while dirty, else `saved`). */
|
|
87
|
+
export interface SaveStatus { text: string; tone?: SaveTone }
|
|
88
|
+
/** (orz-markdown 2.7.0) What `hooks.saveStatus` is asked about. */
|
|
89
|
+
export interface SaveStatusState {
|
|
90
|
+
/** The text differs from the last saved one (`isDirty()`). */
|
|
91
|
+
readonly dirty: boolean;
|
|
92
|
+
/** A save the editor started (Save, Cmd/Ctrl+S, `save()`) is running. */
|
|
93
|
+
readonly saving: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** (orz-markdown 2.7.0) A place for `reveal`: exact offsets, a heading's words or `#id`, or `{ heading }`. */
|
|
96
|
+
export type RevealTarget = { from: number; to?: number } | string | { heading: string };
|
|
97
|
+
/** (orz-markdown 2.10.0) The save status's own words (`EditorWords.status`). */
|
|
98
|
+
export interface EditorStatusWords {
|
|
99
|
+
/** Replaces "Saved", with a neutral dot (never the green one); empty or null: the default. */
|
|
100
|
+
clean?: string | null;
|
|
101
|
+
/** Replaces "Unsaved changes" (amber); empty or null: the default. */
|
|
102
|
+
dirty?: string | null;
|
|
103
|
+
}
|
|
104
|
+
/** (orz-markdown 2.9.0, FC-19 §3/§4) Your words for the editor (plain text; `null`: back to the default; a key left out or `undefined`: kept). */
|
|
105
|
+
export interface EditorWords {
|
|
106
|
+
/** The Save button's label, accessible name and title (default "Save", or "Save now" with `hooks.saveStatus`). */
|
|
107
|
+
save?: string | null;
|
|
108
|
+
/** The toast after a save that went through your `hooks.save` or the host (default "Saved."; `''`: none). */
|
|
109
|
+
saved?: string | null;
|
|
110
|
+
/** A notice above the panes (role `status`, with Dismiss); empty or null: none. */
|
|
111
|
+
notice?: string | null;
|
|
112
|
+
/** (orz-markdown 2.10.0) The save status's words when the editor says them itself (no `hooks.saveStatus`); `null`: both defaults. */
|
|
113
|
+
status?: EditorStatusWords | null;
|
|
114
|
+
}
|
|
115
|
+
|
|
67
116
|
export interface EditorHooks {
|
|
68
117
|
/** App host: persist the text (absent: the standalone save). */
|
|
69
118
|
save?(text: string): Promise<void>;
|
|
@@ -75,6 +124,8 @@ export interface EditorHooks {
|
|
|
75
124
|
uploadAsset?(file: File): Promise<string>;
|
|
76
125
|
resolveLink?(href: string): string;
|
|
77
126
|
mintUid?(): Promise<string>;
|
|
127
|
+
/** (orz-markdown 2.7.0, FC-19 §3) The words of the toolbar's save status, for a host that saves on its own rhythm: asked at mount, when the dirty or saving state changes and on `refreshSaveStatus()`. A string (dot neutral while dirty, green when clean) or `{ text, tone }`; null, undefined or a throw: the defaults. With it, Save reads "Save now". */
|
|
128
|
+
saveStatus?(state: SaveStatusState): SaveStatus | string | null | undefined;
|
|
78
129
|
}
|
|
79
130
|
|
|
80
131
|
export interface PreferenceStore {
|
|
@@ -100,6 +151,8 @@ export interface EditorOptions {
|
|
|
100
151
|
fileName?: string;
|
|
101
152
|
/** (1.1) FC-19 §3 `twinLinks`: your twin-link naming — the preview and the live slide name links to text twins so, and a save without `hooks.save` stores it in the file. */
|
|
102
153
|
twinLinks?: TwinNaming;
|
|
154
|
+
/** FC-19 §3 `foldHeader` (orz-markdown 2.7.0): the document header shown as one folded "Document settings" line in the source view (a click or the caret opens it; the text is unchanged); default true. */
|
|
155
|
+
foldHeader?: boolean;
|
|
103
156
|
}
|
|
104
157
|
|
|
105
158
|
export type SaveVia = 'hook' | 'host' | 'file' | 'download';
|
|
@@ -195,6 +248,12 @@ export interface Editor {
|
|
|
195
248
|
readonly ready: Promise<{ engine: string; error?: unknown }>;
|
|
196
249
|
/** orz-slides' own tools: the caret's slide, lints and quick fixes, the live card, single-slide editing. */
|
|
197
250
|
readonly slides: SlidesTools;
|
|
251
|
+
/** (orz-markdown 2.7.0, FC-19 §4) Bring a place into view in the source and the preview and put the caret there (`select`: select it); its exact range, or null when not found. */
|
|
252
|
+
reveal(target: RevealTarget, options?: { select?: boolean }): TextRange | null;
|
|
253
|
+
/** (orz-markdown 2.7.0) Ask `hooks.saveStatus` again (your own save state changed). */
|
|
254
|
+
refreshSaveStatus(): void;
|
|
255
|
+
/** (orz-markdown 2.9.0) Your words: the Save button's label (`save`), the toast after a save (`saved`; `''`: none), a notice above the panes (`notice`) and (2.10.0) the save status's own words (`status`); `null`: back to the default, a key left out: kept. */
|
|
256
|
+
setWords(words: EditorWords): void;
|
|
198
257
|
}
|
|
199
258
|
|
|
200
259
|
export interface RenderPreviewOptions {
|