hono-decks 0.2.0 → 0.2.2
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/dist/advanced.d.ts +603 -46
- package/dist/advanced.js +2034 -1910
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +1826 -1910
- package/dist/cli.d.ts +16 -15
- package/dist/cli.js +1829 -1915
- package/dist/client.d.ts +14 -8
- package/dist/client.js +13 -16
- package/dist/mod.d.ts +512 -27
- package/dist/mod.js +812 -759
- package/dist/node.d.ts +670 -111
- package/dist/node.js +3831 -3940
- package/dist/vite.d.ts +8 -8
- package/dist/vite.js +1709 -1805
- package/package.json +3 -3
- package/dist/define-decks-U4NxIs66.d.ts +0 -587
- package/dist/jsx-renderer-BO-N4tMZ.d.ts +0 -20
package/dist/client.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Child } from "hono/jsx";
|
|
2
|
+
import { HtmlEscapedString } from "hono/utils/html";
|
|
3
|
+
//#region src/renderer/jsx-renderer.d.ts
|
|
4
|
+
type DeckRenderable = Child | HtmlEscapedString;
|
|
5
|
+
type SlideComponentProps = Record<string, unknown> & {
|
|
6
|
+
children?: DeckRenderable;
|
|
7
|
+
};
|
|
8
|
+
type SlideComponent = (props: SlideComponentProps) => DeckRenderable;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/client/islands.d.ts
|
|
5
11
|
type ClientSlideComponentRegistry = Record<string, SlideComponent>;
|
|
6
12
|
interface HydrateSlideIslandsInput {
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
root?: ParentNode;
|
|
14
|
+
components: ClientSlideComponentRegistry;
|
|
9
15
|
}
|
|
10
16
|
declare function hydrateSlideIslands(input: HydrateSlideIslandsInput): void;
|
|
11
|
-
|
|
12
|
-
export { type ClientSlideComponentRegistry, type HydrateSlideIslandsInput, hydrateSlideIslands };
|
|
17
|
+
//#endregion
|
|
18
|
+
export { type ClientSlideComponentRegistry, type HydrateSlideIslandsInput, hydrateSlideIslands };
|
package/dist/client.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
// src/client/islands.ts
|
|
2
1
|
import { render } from "hono/jsx/dom";
|
|
3
2
|
import { jsx } from "hono/jsx/dom/jsx-runtime";
|
|
3
|
+
//#region src/client/islands.ts
|
|
4
4
|
function hydrateSlideIslands(input) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
render(jsx(component, props), island);
|
|
14
|
-
}
|
|
5
|
+
const islands = (input.root ?? document).querySelectorAll("[data-hono-decks-island]");
|
|
6
|
+
for (const island of islands) {
|
|
7
|
+
const name = island.dataset.honoDecksIsland;
|
|
8
|
+
if (!name) continue;
|
|
9
|
+
const component = input.components[name];
|
|
10
|
+
if (!component) continue;
|
|
11
|
+
render(jsx(component, parseIslandProps(island.dataset.honoDecksProps)), island);
|
|
12
|
+
}
|
|
15
13
|
}
|
|
16
14
|
function parseIslandProps(value) {
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
if (!value) return {};
|
|
16
|
+
return JSON.parse(value);
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { hydrateSlideIslands };
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,39 +1,524 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Context, Env, Hono, MiddlewareHandler } from "hono";
|
|
2
|
+
import { HtmlEscapedString } from "hono/utils/html";
|
|
3
|
+
import { Child } from "hono/jsx";
|
|
4
|
+
//#region src/shared/types.d.ts
|
|
5
|
+
type SlideNode = {
|
|
6
|
+
type: "text";
|
|
7
|
+
value: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "element";
|
|
10
|
+
tag: string;
|
|
11
|
+
props: Record<string, unknown>;
|
|
12
|
+
children: SlideNode[];
|
|
13
|
+
} | {
|
|
14
|
+
type: "code";
|
|
15
|
+
lang?: string;
|
|
16
|
+
value: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "component";
|
|
19
|
+
name: string;
|
|
20
|
+
props: Record<string, unknown>;
|
|
21
|
+
children: SlideNode[];
|
|
22
|
+
source?: string;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/renderer/jsx-renderer.d.ts
|
|
26
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
27
|
+
type DeckRenderable = Child | HtmlEscapedString;
|
|
28
|
+
type SlideComponentProps = Record<string, unknown> & {
|
|
29
|
+
children?: DeckRenderable;
|
|
30
|
+
};
|
|
31
|
+
type SlideComponent = (props: SlideComponentProps) => DeckRenderable;
|
|
32
|
+
interface SlideComponentDefinition {
|
|
33
|
+
component: SlideComponent;
|
|
34
|
+
client?: boolean;
|
|
35
|
+
clientId?: string;
|
|
36
|
+
}
|
|
37
|
+
type SlideComponentInput = SlideComponent | SlideComponentDefinition;
|
|
38
|
+
type SlideComponentRegistry = Record<string, SlideComponentDefinition>;
|
|
39
|
+
declare function defineSlideComponents(input: Record<string, SlideComponentInput>): SlideComponentRegistry;
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/server/document.d.ts
|
|
42
|
+
type DeckDocumentSurface = "index" | "viewer" | "render" | "print" | "presentation" | "presenter" | "embed";
|
|
43
|
+
interface DeckDocumentRenderInput<E extends Env = any> {
|
|
44
|
+
c: Context<E>;
|
|
45
|
+
surface: DeckDocumentSurface;
|
|
46
|
+
deck?: CompiledDeck;
|
|
47
|
+
slug?: string;
|
|
48
|
+
mountPath: string;
|
|
49
|
+
title: string;
|
|
50
|
+
}
|
|
51
|
+
interface DeckDocumentPageOptions<E extends Env = any> {
|
|
52
|
+
lang?: string | ((input: DeckDocumentRenderInput<E>) => MaybePromise<string | undefined>);
|
|
53
|
+
nonce?: string | ((input: DeckDocumentRenderInput<E>) => MaybePromise<string | undefined>);
|
|
54
|
+
head?: MaybePromise<DeckRenderable> | ((input: DeckDocumentRenderInput<E>) => MaybePromise<DeckRenderable>);
|
|
55
|
+
}
|
|
56
|
+
interface DeckDocumentOptions<E extends Env = any> extends DeckDocumentPageOptions<E> {
|
|
57
|
+
surfaces?: Partial<Record<DeckDocumentSurface, DeckDocumentPageOptions<E>>>;
|
|
58
|
+
}
|
|
59
|
+
interface ResolvedDeckDocument {
|
|
60
|
+
lang: string;
|
|
61
|
+
nonce?: string;
|
|
62
|
+
head: string;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/deck/model.d.ts
|
|
66
|
+
type DeckKind = "directory" | "single-file";
|
|
67
|
+
declare const SLIDE_TRANSITIONS: readonly ["none", "fade", "fade-out", "slide-left", "slide-right", "slide-up", "slide-down", "view-transition"];
|
|
68
|
+
type SlideTransition = (typeof SLIDE_TRANSITIONS)[number];
|
|
69
|
+
interface DeckFrontmatter {
|
|
70
|
+
title?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
author?: string;
|
|
73
|
+
tags?: string[];
|
|
74
|
+
date?: string;
|
|
75
|
+
theme?: string;
|
|
76
|
+
transition?: SlideTransition;
|
|
77
|
+
transitionDuration?: string;
|
|
78
|
+
transitionEasing?: string;
|
|
79
|
+
draft?: boolean;
|
|
80
|
+
assets?: string | string[];
|
|
81
|
+
presenter?: boolean;
|
|
82
|
+
meta: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
interface SlideFrontmatter {
|
|
85
|
+
title?: string;
|
|
86
|
+
layout?: string;
|
|
87
|
+
className?: string;
|
|
88
|
+
notes?: string;
|
|
89
|
+
background?: string;
|
|
90
|
+
transition?: SlideTransition;
|
|
91
|
+
transitionDuration?: string;
|
|
92
|
+
transitionEasing?: string;
|
|
93
|
+
meta: Record<string, unknown>;
|
|
94
|
+
}
|
|
95
|
+
interface ComponentPlaceholder {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
props: Record<string, unknown>;
|
|
99
|
+
source: string;
|
|
100
|
+
}
|
|
101
|
+
interface AssetRef {
|
|
102
|
+
sourcePath: string;
|
|
103
|
+
publicPath: string;
|
|
104
|
+
type: "local" | "remote" | "r2" | "public";
|
|
105
|
+
contentType?: string;
|
|
106
|
+
cacheControl?: string | false;
|
|
107
|
+
r2Key?: string;
|
|
108
|
+
body?: BodyInit;
|
|
109
|
+
}
|
|
110
|
+
interface CompileWarning {
|
|
111
|
+
code: string;
|
|
112
|
+
message: string;
|
|
113
|
+
slideIndex?: number;
|
|
114
|
+
}
|
|
115
|
+
interface CompiledSlide {
|
|
116
|
+
index: number;
|
|
117
|
+
meta: SlideFrontmatter;
|
|
118
|
+
html: string;
|
|
119
|
+
nodes?: SlideNode[];
|
|
120
|
+
render?: (props?: {
|
|
121
|
+
components?: Record<string, unknown>;
|
|
122
|
+
}) => MaybePromise<DeckRenderable>;
|
|
123
|
+
components: ComponentPlaceholder[];
|
|
124
|
+
notes?: string;
|
|
125
|
+
}
|
|
126
|
+
interface CompiledDeck {
|
|
127
|
+
slug: string;
|
|
128
|
+
sourcePath: string;
|
|
129
|
+
kind: DeckKind;
|
|
130
|
+
meta: DeckFrontmatter;
|
|
131
|
+
themeStyle?: string;
|
|
132
|
+
themeSourcePath?: string;
|
|
133
|
+
slides: CompiledSlide[];
|
|
134
|
+
assets: AssetRef[];
|
|
135
|
+
componentRegistry?: Record<string, SlideComponentInput>;
|
|
136
|
+
warnings: CompileWarning[];
|
|
137
|
+
}
|
|
138
|
+
interface DeckEntry {
|
|
139
|
+
slug: string;
|
|
140
|
+
title?: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
draft?: boolean;
|
|
143
|
+
sourcePath: string;
|
|
144
|
+
}
|
|
145
|
+
type DeckRequestContext<E extends Env = any> = Context<E>;
|
|
146
|
+
interface DeckSource<E extends Env = any> {
|
|
147
|
+
listDecks<RequestEnv extends E>(c: Context<RequestEnv>): Promise<DeckEntry[]>;
|
|
148
|
+
getCompiledDeck<RequestEnv extends E>(c: Context<RequestEnv>, slug: string): Promise<CompiledDeck | null>;
|
|
149
|
+
getAsset?<RequestEnv extends E>(c: Context<RequestEnv>, slug: string, assetPath: string): Promise<Response | null>;
|
|
150
|
+
}
|
|
151
|
+
interface DeckManifest {
|
|
152
|
+
decks: CompiledDeck[];
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/renderer/control-icons.d.ts
|
|
156
|
+
type DeckControlIconName = "deck-list" | "home" | "viewer" | "projection" | "presenter" | "previous" | "next" | "fullscreen" | "print" | "details" | "export-pdf" | "export-png";
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/server/paths.d.ts
|
|
159
|
+
/** All public URLs for one deck. */
|
|
160
|
+
interface DeckPaths {
|
|
161
|
+
viewer: string;
|
|
162
|
+
render: string;
|
|
163
|
+
print: string;
|
|
164
|
+
presentation: string;
|
|
165
|
+
presenter: string;
|
|
166
|
+
embed: string;
|
|
167
|
+
exportPdf: string;
|
|
168
|
+
exportPng: string;
|
|
169
|
+
ogImage: string;
|
|
170
|
+
assets: string;
|
|
171
|
+
}
|
|
172
|
+
/** Creates the canonical route map used by routers, controls, and app code. */
|
|
173
|
+
declare function createDeckPaths(mountPath: string, slug: string): DeckPaths;
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/server/browser-export.d.ts
|
|
176
|
+
interface DeckBrowserRunBinding {
|
|
177
|
+
quickAction(action: "pdf" | "screenshot", input: Record<string, unknown>): MaybePromise<Response>;
|
|
178
|
+
}
|
|
179
|
+
interface DeckBrowserRunPdfOptions {
|
|
180
|
+
filename?: string | ((deck: CompiledDeck) => string);
|
|
181
|
+
request?: Record<string, unknown>;
|
|
182
|
+
}
|
|
183
|
+
interface DeckBrowserRunPngOptions {
|
|
184
|
+
filename?: string | ((deck: CompiledDeck) => string);
|
|
185
|
+
request?: Record<string, unknown>;
|
|
186
|
+
}
|
|
187
|
+
/** Request data passed to Browser Rendering binding and authorization resolvers. */
|
|
188
|
+
interface DeckExportResolverInput<E extends Env = any> {
|
|
189
|
+
c: Context<E>;
|
|
190
|
+
deck: CompiledDeck;
|
|
191
|
+
slug: string;
|
|
192
|
+
mountPath: string;
|
|
193
|
+
paths: DeckPaths;
|
|
194
|
+
format: "pdf" | "png";
|
|
195
|
+
}
|
|
196
|
+
interface DeckExportOptions<E extends Env = any> {
|
|
197
|
+
browser(input: DeckExportResolverInput<E>): MaybePromise<DeckBrowserRunBinding | null | undefined>;
|
|
198
|
+
authorize?(input: DeckExportResolverInput<E>): MaybePromise<boolean>;
|
|
199
|
+
pdf?: boolean | DeckBrowserRunPdfOptions;
|
|
200
|
+
png?: boolean | DeckBrowserRunPngOptions;
|
|
201
|
+
}
|
|
202
|
+
interface DeckViewerExportPaths {
|
|
203
|
+
pdf?: boolean;
|
|
204
|
+
png?: boolean;
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/server/viewer.d.ts
|
|
208
|
+
interface DeckViewerOptions<E extends Env = any> {
|
|
209
|
+
controls?: false | DeckViewerControlsOptions;
|
|
210
|
+
openGraph?: boolean | DeckViewerOpenGraphOptions;
|
|
211
|
+
style?: string;
|
|
212
|
+
head?: MaybePromise<DeckRenderable> | ((input: DeckViewerRenderInput<E>) => MaybePromise<DeckRenderable>);
|
|
213
|
+
lang?: string | ((input: DeckViewerRenderInput<E>) => MaybePromise<string>);
|
|
214
|
+
nonce?: string | ((input: DeckViewerRenderInput<E>) => MaybePromise<string | undefined>);
|
|
215
|
+
render?(input: DeckViewerRenderInput<E>): MaybePromise<DeckRenderable>;
|
|
216
|
+
}
|
|
217
|
+
interface DeckViewerOpenGraphOptions {
|
|
218
|
+
/** Public image URL. Defaults to `paths.ogImage` when Open Graph metadata is enabled. */
|
|
219
|
+
imagePath?: string | ((input: DeckViewerOpenGraphInput) => MaybePromise<string | undefined>);
|
|
220
|
+
}
|
|
221
|
+
interface DeckViewerOpenGraphInput {
|
|
222
|
+
deck: CompiledDeck;
|
|
223
|
+
paths: DeckPaths;
|
|
224
|
+
}
|
|
225
|
+
type DeckViewerControlKey = "back" | "previous" | "position" | "next" | "fullscreen" | "print" | "exportPdf" | "exportPng";
|
|
226
|
+
interface DeckViewerControlsOptions {
|
|
227
|
+
className?: string;
|
|
228
|
+
itemClassName?: string;
|
|
229
|
+
attributes?: Record<string, string | boolean | undefined>;
|
|
230
|
+
ariaLabel?: string;
|
|
231
|
+
hidden?: DeckViewerControlKey[];
|
|
232
|
+
labels?: Partial<Record<DeckViewerControlKey, string>>;
|
|
233
|
+
before?: DeckViewerControlSlotItems;
|
|
234
|
+
after?: DeckViewerControlSlotItems;
|
|
235
|
+
items?: DeckViewerControlItem[] | DeckViewerControlsItemsResolver;
|
|
236
|
+
renderItem?: DeckViewerControlItemRenderer;
|
|
237
|
+
}
|
|
238
|
+
type DeckViewerControlsItemsResolver = (defaults: DeckViewerControlDefaults, context: DeckViewerControlsContext) => DeckViewerControlItem[];
|
|
239
|
+
type DeckViewerControlSlotItems = DeckViewerControlItem[] | ((context: DeckViewerControlsContext) => DeckViewerControlItem[]);
|
|
240
|
+
interface DeckViewerControlRenderInput {
|
|
241
|
+
context: DeckViewerControlsContext;
|
|
242
|
+
}
|
|
243
|
+
type DeckViewerControlItemRenderer = (item: Exclude<DeckViewerControlItem, null | false | undefined>, context: DeckViewerControlsContext, renderDefault: () => DeckRenderable) => DeckRenderable;
|
|
244
|
+
interface DeckViewerControlDefaults {
|
|
245
|
+
back: DeckViewerDefaultControlItem;
|
|
246
|
+
previous: DeckViewerDefaultControlItem;
|
|
247
|
+
position: DeckViewerDefaultControlItem;
|
|
248
|
+
next: DeckViewerDefaultControlItem;
|
|
249
|
+
fullscreen: DeckViewerDefaultControlItem;
|
|
250
|
+
print: DeckViewerDefaultControlItem | null;
|
|
251
|
+
exportPdf: DeckViewerDefaultControlItem | null;
|
|
252
|
+
exportPng: DeckViewerDefaultControlItem | null;
|
|
253
|
+
}
|
|
254
|
+
interface DeckViewerAvailablePages {
|
|
255
|
+
print: boolean;
|
|
256
|
+
}
|
|
257
|
+
interface DeckViewerControlsContext {
|
|
258
|
+
slug: string;
|
|
259
|
+
title: string;
|
|
260
|
+
mountPath: string;
|
|
261
|
+
meta: DeckPageMeta;
|
|
262
|
+
slides: DeckTocItem[];
|
|
263
|
+
}
|
|
264
|
+
type DeckViewerControlItem = DeckViewerDefaultControlItem | DeckViewerLinkControlItem | DeckViewerRenderControlItem | null | false | undefined;
|
|
265
|
+
interface DeckViewerDefaultControlItem {
|
|
266
|
+
type: "default";
|
|
267
|
+
key: DeckViewerControlKey;
|
|
268
|
+
label?: string;
|
|
269
|
+
className?: string;
|
|
270
|
+
attributes?: Record<string, string | boolean | undefined>;
|
|
271
|
+
}
|
|
272
|
+
interface DeckViewerLinkControlItem {
|
|
273
|
+
type: "link";
|
|
274
|
+
key?: string;
|
|
275
|
+
href: string;
|
|
276
|
+
label: string;
|
|
277
|
+
icon?: DeckControlIconName;
|
|
278
|
+
download?: string;
|
|
279
|
+
className?: string;
|
|
280
|
+
attributes?: Record<string, string | boolean | undefined>;
|
|
281
|
+
}
|
|
282
|
+
interface DeckViewerRenderControlItem {
|
|
283
|
+
type: "render";
|
|
284
|
+
key?: string;
|
|
285
|
+
render(input: DeckViewerControlRenderInput): DeckRenderable;
|
|
286
|
+
}
|
|
287
|
+
interface DeckTocItem {
|
|
288
|
+
index: number;
|
|
289
|
+
title?: string;
|
|
290
|
+
label: string;
|
|
291
|
+
}
|
|
292
|
+
/** Metadata and complete public route map for a viewer page. */
|
|
293
|
+
interface DeckPageMeta {
|
|
294
|
+
title: string;
|
|
295
|
+
description?: string;
|
|
296
|
+
paths: DeckPaths;
|
|
297
|
+
availablePages: DeckViewerAvailablePages;
|
|
298
|
+
availableExports: DeckViewerExportPaths;
|
|
299
|
+
imagePath?: string;
|
|
300
|
+
}
|
|
301
|
+
interface DeckViewerParts {
|
|
302
|
+
slug: string;
|
|
303
|
+
title: string;
|
|
304
|
+
renderUrl: string;
|
|
305
|
+
frame: DeckViewerPart;
|
|
306
|
+
controls: DeckViewerPart | null;
|
|
307
|
+
toc: DeckViewerPart;
|
|
308
|
+
slides: DeckTocItem[];
|
|
309
|
+
meta: DeckPageMeta;
|
|
310
|
+
}
|
|
311
|
+
/** One viewer part in both composable JSX form and pre-rendered HTML form. */
|
|
312
|
+
interface DeckViewerPart {
|
|
313
|
+
content: DeckRenderable;
|
|
314
|
+
html: string;
|
|
315
|
+
}
|
|
316
|
+
interface DeckViewerRenderInput<E extends Env = any> extends DeckViewerParts {
|
|
317
|
+
c: Context<E>;
|
|
318
|
+
deck: CompiledDeck;
|
|
319
|
+
mountPath: string;
|
|
320
|
+
}
|
|
321
|
+
interface DeckViewerEmbedOptions {
|
|
322
|
+
deck: CompiledDeck;
|
|
323
|
+
mountPath: string;
|
|
324
|
+
viewerStateQuery?: string;
|
|
325
|
+
controls?: false | DeckViewerControlsOptions;
|
|
326
|
+
availablePages?: Partial<DeckViewerAvailablePages>;
|
|
327
|
+
exportPaths?: DeckViewerExportPaths;
|
|
328
|
+
style?: string;
|
|
329
|
+
toc?: boolean;
|
|
330
|
+
className?: string;
|
|
331
|
+
nonce?: string;
|
|
332
|
+
}
|
|
333
|
+
interface DeckViewerEmbed extends DeckViewerParts {
|
|
334
|
+
embed: DeckRenderable;
|
|
335
|
+
embedHtml: string;
|
|
336
|
+
}
|
|
337
|
+
declare function createDeckViewerEmbed(input: DeckViewerEmbedOptions): Promise<DeckViewerEmbed>;
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/server/external-embed.d.ts
|
|
340
|
+
interface DeckExternalEmbedContext<E extends Env = any> {
|
|
341
|
+
c: Context<E>;
|
|
342
|
+
deck: CompiledDeck;
|
|
343
|
+
slug: string;
|
|
344
|
+
mountPath: string;
|
|
345
|
+
}
|
|
346
|
+
type DeckExternalEmbedViewerOptions = Omit<DeckViewerEmbedOptions, "deck" | "mountPath" | "nonce">;
|
|
347
|
+
interface DeckExternalEmbedRenderInput<E extends Env = any> extends DeckExternalEmbedContext<E> {
|
|
348
|
+
viewer: DeckViewerEmbed;
|
|
349
|
+
document: ResolvedDeckDocument;
|
|
350
|
+
}
|
|
351
|
+
interface DeckExternalEmbedOptions<E extends Env = any> {
|
|
352
|
+
enabled?: boolean | ((input: DeckExternalEmbedContext<E>) => MaybePromise<boolean>);
|
|
353
|
+
frameAncestors?: string | string[] | ((input: DeckExternalEmbedContext<E>) => MaybePromise<string | string[] | undefined>);
|
|
354
|
+
document?: DeckDocumentPageOptions<E>;
|
|
355
|
+
viewer?: DeckExternalEmbedViewerOptions | ((input: DeckExternalEmbedContext<E>) => MaybePromise<DeckExternalEmbedViewerOptions>);
|
|
356
|
+
pageStyle?: string;
|
|
357
|
+
robots?: string | false;
|
|
358
|
+
render?(input: DeckExternalEmbedRenderInput<E>): MaybePromise<DeckRenderable>;
|
|
359
|
+
}
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/server/router.d.ts
|
|
362
|
+
interface DecksRouterExtension<E extends Env = any> {
|
|
363
|
+
path: string;
|
|
364
|
+
router: Hono<E>;
|
|
365
|
+
}
|
|
366
|
+
interface DecksRouterOptions<E extends Env = any> {
|
|
367
|
+
source: DeckSource<E>;
|
|
368
|
+
/**
|
|
369
|
+
* Enables development-only deck behavior. When omitted, Vite and Wrangler
|
|
370
|
+
* development commands are detected from NODE_ENV. Explicit values and
|
|
371
|
+
* resolvers always take precedence.
|
|
372
|
+
*/
|
|
373
|
+
dev?: boolean | DeckDevResolver<E>;
|
|
374
|
+
extensions?: DecksRouterExtension<E>[];
|
|
375
|
+
liveReloadPath?(slug: string, mountPath: string): string | undefined;
|
|
376
|
+
style?: string;
|
|
377
|
+
components?: SlideComponentRegistry | Record<string, SlideComponentInput>;
|
|
378
|
+
clientEntry?: string;
|
|
379
|
+
clientEntryAsset?: string;
|
|
380
|
+
clientEntryAssetPath?: string;
|
|
381
|
+
document?: DeckDocumentOptions<E>;
|
|
382
|
+
pages?: DecksRouterPagesOptions<E>;
|
|
383
|
+
embed?: false | DeckExternalEmbedOptions<E>;
|
|
384
|
+
viewer?: DeckViewerOptions<E>;
|
|
385
|
+
presenter?: false | DecksRouterPresenterOptions<E>;
|
|
386
|
+
export?: false | DeckExportOptions<E>;
|
|
387
|
+
}
|
|
388
|
+
type DeckRouteSurface = "index" | "viewer" | "render" | "print" | "presentation" | "presenter";
|
|
389
|
+
interface DeckRouteSurfaceInput<E extends Env = any> {
|
|
390
|
+
c: Context<E>;
|
|
391
|
+
surface: DeckRouteSurface;
|
|
392
|
+
mountPath: string;
|
|
393
|
+
dev: boolean;
|
|
394
|
+
deck?: CompiledDeck;
|
|
395
|
+
slug?: string;
|
|
396
|
+
}
|
|
397
|
+
type DeckRouteEnabledResolver<E extends Env = any> = (input: DeckRouteSurfaceInput<E>) => MaybePromise<boolean>;
|
|
398
|
+
type DeckRouteEnabled<E extends Env = any> = boolean | DeckRouteEnabledResolver<E>;
|
|
399
|
+
interface DeckIndexPageInput<E extends Env = any> extends DeckRouteSurfaceInput<E> {
|
|
400
|
+
surface: "index";
|
|
401
|
+
decks: DeckEntry[];
|
|
402
|
+
}
|
|
403
|
+
interface DeckIndexRenderInput<E extends Env = any> extends DeckIndexPageInput<E> {
|
|
404
|
+
title: string;
|
|
405
|
+
document: ResolvedDeckDocument;
|
|
406
|
+
defaultContent: DeckRenderable;
|
|
407
|
+
}
|
|
408
|
+
interface DeckIndexPageOptions<E extends Env = any> {
|
|
409
|
+
enabled?: DeckRouteEnabled<E>;
|
|
410
|
+
title?: string | ((input: DeckIndexPageInput<E>) => MaybePromise<string>);
|
|
411
|
+
render?(input: DeckIndexRenderInput<E>): MaybePromise<DeckRenderable>;
|
|
412
|
+
}
|
|
413
|
+
interface DecksRouterPagesOptions<E extends Env = any> {
|
|
414
|
+
index?: false | DeckIndexPageOptions<E>;
|
|
415
|
+
viewer?: DeckRouteEnabled<E>;
|
|
416
|
+
render?: DeckRouteEnabled<E>;
|
|
417
|
+
print?: DeckRouteEnabled<E>;
|
|
418
|
+
presentation?: DeckRouteEnabled<E>;
|
|
419
|
+
presenter?: DeckRouteEnabled<E>;
|
|
420
|
+
}
|
|
421
|
+
/** Request data passed to the development-mode resolver. */
|
|
422
|
+
interface DeckDevResolverInput<E extends Env = any> {
|
|
423
|
+
c: Context<E>;
|
|
424
|
+
}
|
|
425
|
+
type DeckDevResolver<E extends Env = any> = (input: DeckDevResolverInput<E>) => MaybePromise<boolean>;
|
|
426
|
+
interface DecksRouterPresenterOptions<E extends Env = any> {
|
|
427
|
+
enabled?: boolean | DeckPresenterEnabledResolver<E>;
|
|
428
|
+
viewerControl?: boolean | DeckPresenterViewerControlOptions;
|
|
429
|
+
}
|
|
430
|
+
type DeckPresenterEnabledResolver<E extends Env = any> = (input: DeckPresenterEnabledInput<E>) => MaybePromise<boolean>;
|
|
431
|
+
interface DeckPresenterEnabledInput<E extends Env = any> {
|
|
432
|
+
c: Context<E>;
|
|
433
|
+
deck: CompiledDeck;
|
|
434
|
+
slug: string;
|
|
435
|
+
mountPath: string;
|
|
436
|
+
dev: boolean;
|
|
437
|
+
presenterPath: string;
|
|
438
|
+
presentationPath: string;
|
|
439
|
+
}
|
|
440
|
+
interface DeckPresenterViewerControlOptions {
|
|
441
|
+
key?: string;
|
|
442
|
+
label?: string;
|
|
443
|
+
icon?: DeckControlIconName;
|
|
444
|
+
className?: string;
|
|
445
|
+
attributes?: Record<string, string | boolean | undefined>;
|
|
446
|
+
placement?: "before" | "after";
|
|
447
|
+
}
|
|
448
|
+
interface DeckContextVariables {
|
|
449
|
+
deck: CompiledDeck;
|
|
450
|
+
deckViewer: DeckViewerParts;
|
|
451
|
+
deckToc: DeckTocItem[];
|
|
452
|
+
deckMeta: DeckPageMeta;
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/server/define-decks.d.ts
|
|
456
|
+
/** Per-mount overrides merged on top of generated defaults and app config. */
|
|
457
|
+
type DecksRouterOverrides<E extends Env = any> = Partial<Omit<DecksRouterOptions<E>, "components" | "clientEntryAsset">> & {
|
|
458
|
+
components?: SlideComponentRegistry | Record<string, SlideComponentInput>;
|
|
459
|
+
};
|
|
460
|
+
/** Runtime options that keep the configured kit on its single transformed source. */
|
|
461
|
+
type DecksRouterConfig<E extends Env = any> = Omit<DecksRouterOverrides<E>, "source">;
|
|
462
|
+
/** File-system settings consumed by the CLI. */
|
|
463
|
+
interface DecksBuildConfig {
|
|
464
|
+
/** Deck source directory. @default "decks" */
|
|
465
|
+
root?: string;
|
|
466
|
+
/** Generated module directory. @default "src/generated" */
|
|
467
|
+
outDir?: string;
|
|
468
|
+
/** Optional deterministic Open Graph metadata cache. */
|
|
469
|
+
ogpCacheFile?: string;
|
|
470
|
+
}
|
|
471
|
+
/** Shared configuration consumed by both the CLI and the generated runtime kit. */
|
|
472
|
+
interface DecksConfig<E extends Env = any> {
|
|
473
|
+
/** Public route where the configured router is mounted. */
|
|
474
|
+
mountPath: string;
|
|
475
|
+
build?: DecksBuildConfig;
|
|
476
|
+
source?(source: DeckSource<E>): DeckSource<E>;
|
|
477
|
+
router?: DecksRouterConfig<E>;
|
|
478
|
+
}
|
|
479
|
+
/** A generated deck collection configured for one application. */
|
|
480
|
+
interface ConfiguredDecks<E extends Env = any> {
|
|
481
|
+
mountPath: string;
|
|
482
|
+
source: DeckSource<E>;
|
|
483
|
+
router(overrides?: DecksRouterConfig<E>): Hono<E>;
|
|
484
|
+
context(overrides?: Pick<DecksRouterOptions<E>, "dev" | "pages" | "viewer">): MiddlewareHandler<E & {
|
|
485
|
+
Variables: DeckContextVariables;
|
|
486
|
+
}>;
|
|
487
|
+
paths(slug: string): DeckPaths;
|
|
488
|
+
}
|
|
489
|
+
/** Defines the single configuration consumed by the CLI and runtime. */
|
|
490
|
+
declare function defineDecksConfig<E extends Env = any>(config: DecksConfig<E>): DecksConfig<E>;
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/source/r2-assets.d.ts
|
|
8
493
|
interface R2ObjectHttpMetadataLike {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
494
|
+
contentType?: string;
|
|
495
|
+
cacheControl?: string;
|
|
496
|
+
contentDisposition?: string;
|
|
497
|
+
contentEncoding?: string;
|
|
498
|
+
contentLanguage?: string;
|
|
14
499
|
}
|
|
15
500
|
interface R2ObjectBodyLike {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
501
|
+
body?: BodyInit | null;
|
|
502
|
+
httpMetadata?: R2ObjectHttpMetadataLike;
|
|
503
|
+
arrayBuffer?(): Promise<ArrayBuffer>;
|
|
504
|
+
writeHttpMetadata?(headers: Headers): void;
|
|
20
505
|
}
|
|
21
506
|
interface R2BucketLike {
|
|
22
|
-
|
|
507
|
+
get(key: string): Promise<R2ObjectBodyLike | null>;
|
|
23
508
|
}
|
|
24
509
|
type R2BucketResolver<E extends Env = any> = R2BucketLike | (<RequestEnv extends E>(c: Context<RequestEnv>) => R2BucketLike | undefined | Promise<R2BucketLike | undefined>);
|
|
25
510
|
interface R2AssetKeyInput {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
511
|
+
deck: CompiledDeck;
|
|
512
|
+
asset: AssetRef;
|
|
513
|
+
slug: string;
|
|
514
|
+
assetPath: string;
|
|
30
515
|
}
|
|
31
516
|
interface R2AssetSourceOptions<E extends Env = any> {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
517
|
+
bucket: R2BucketResolver<E>;
|
|
518
|
+
keyPrefix?: string;
|
|
519
|
+
key?(input: R2AssetKeyInput): string;
|
|
520
|
+
cacheControl?: string | false | ((input: R2AssetKeyInput) => string | false | undefined);
|
|
36
521
|
}
|
|
37
522
|
declare function withR2Assets<E extends Env = any>(source: DeckSource<E>, options: R2AssetSourceOptions<E>): DeckSource<E>;
|
|
38
|
-
|
|
39
|
-
export { AssetRef, CompiledDeck, DeckSource, type R2AssetKeyInput, type R2AssetSourceOptions, type R2BucketLike, type R2BucketResolver, type R2ObjectBodyLike, type R2ObjectHttpMetadataLike, withR2Assets };
|
|
523
|
+
//#endregion
|
|
524
|
+
export { type AssetRef, type CompileWarning, type CompiledDeck, type CompiledSlide, type ComponentPlaceholder, type ConfiguredDecks, type DeckBrowserRunBinding, type DeckBrowserRunPdfOptions, type DeckBrowserRunPngOptions, type DeckContextVariables, type DeckControlIconName, type DeckDevResolver, type DeckDevResolverInput, type DeckDocumentOptions, type DeckDocumentPageOptions, type DeckDocumentRenderInput, type DeckDocumentSurface, type DeckEntry, type DeckExportOptions, type DeckExportResolverInput, type DeckExternalEmbedContext, type DeckExternalEmbedOptions, type DeckExternalEmbedRenderInput, type DeckExternalEmbedViewerOptions, type DeckFrontmatter, type DeckIndexPageInput, type DeckIndexPageOptions, type DeckIndexRenderInput, type DeckKind, type DeckManifest, type DeckPageMeta, type DeckPaths, type DeckPresenterEnabledInput, type DeckPresenterEnabledResolver, type DeckPresenterViewerControlOptions, type DeckRenderable, type DeckRequestContext, type DeckRouteEnabled, type DeckRouteEnabledResolver, type DeckRouteSurface, type DeckRouteSurfaceInput, type DeckSource, type DeckTocItem, type DeckViewerAvailablePages, type DeckViewerControlDefaults, type DeckViewerControlItem, type DeckViewerControlItemRenderer, type DeckViewerControlKey, type DeckViewerControlRenderInput, type DeckViewerControlSlotItems, type DeckViewerControlsContext, type DeckViewerControlsItemsResolver, type DeckViewerControlsOptions, type DeckViewerDefaultControlItem, type DeckViewerEmbed, type DeckViewerEmbedOptions, type DeckViewerExportPaths, type DeckViewerLinkControlItem, type DeckViewerOptions, type DeckViewerPart, type DeckViewerParts, type DeckViewerRenderControlItem, type DeckViewerRenderInput, type DecksBuildConfig, type DecksConfig, type DecksRouterConfig, type DecksRouterExtension, type DecksRouterOptions, type DecksRouterPagesOptions, type DecksRouterPresenterOptions, type MaybePromise, type R2AssetKeyInput, type R2AssetSourceOptions, type R2BucketLike, type R2BucketResolver, type R2ObjectBodyLike, type R2ObjectHttpMetadataLike, type ResolvedDeckDocument, SLIDE_TRANSITIONS, type SlideComponent, type SlideComponentDefinition, type SlideComponentInput, type SlideComponentProps, type SlideComponentRegistry, type SlideFrontmatter, type SlideTransition, createDeckPaths, createDeckViewerEmbed, defineDecksConfig, defineSlideComponents, withR2Assets };
|