hono-decks 0.5.0 → 1.0.1
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.ja.md +1 -0
- package/README.md +1 -0
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +14 -7
- package/dist/bin.js +14 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +14 -4
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +5 -1
- package/dist/node.d.ts +4 -4
- package/dist/node.js +28 -11
- package/dist/vite.js +15 -5
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -253,6 +253,7 @@ export default defineDecksConfig({
|
|
|
253
253
|
- `hono-decks/advanced`: `defineDecks()`、`decksRouter()`、`deckContext()`、raw renderer など独自 pipeline 用
|
|
254
254
|
- `hono-decks/client`: browser hydration
|
|
255
255
|
- `hono-decks/node`: compiler と Node filesystem adapter
|
|
256
|
+
- `hono-decks/vite`: 開発中のcompileとwatchをViteへ組み込むintegration
|
|
256
257
|
- `hono-decks/cli`: programmatic CLI runner
|
|
257
258
|
|
|
258
259
|
通常の generated workflow では root entry だけを import します。`hono-decks/advanced` は custom `DeckSource` や router をゼロから組み立てる場合に限定してください。
|
package/README.md
CHANGED
|
@@ -259,6 +259,7 @@ Image generation is intentionally not part of the core package. The <code>exampl
|
|
|
259
259
|
- <code>hono-decks/advanced</code>: <code>defineDecks()</code>, <code>decksRouter()</code>, <code>deckContext()</code>, raw renderers, and other low-level pipeline APIs
|
|
260
260
|
- <code>hono-decks/client</code>: browser hydration
|
|
261
261
|
- <code>hono-decks/node</code>: the compiler and Node filesystem adapter
|
|
262
|
+
- <code>hono-decks/vite</code>: Vite integration that compiles and watches decks during development
|
|
262
263
|
- <code>hono-decks/cli</code>: the programmatic CLI runner
|
|
263
264
|
|
|
264
265
|
The generated workflow normally imports only the root entry. Use <code>hono-decks/advanced</code> only when assembling a custom <code>DeckSource</code> or router from the lower-level primitives.
|
package/dist/advanced.d.ts
CHANGED
|
@@ -616,4 +616,4 @@ declare function serveDecksClientEntry(clientEntry: string, options?: ServeDecks
|
|
|
616
616
|
//#region src/source/manifest-source.d.ts
|
|
617
617
|
declare function manifestDeckSource<E extends Env = any>(manifest: DeckManifest): DeckSource<E>;
|
|
618
618
|
//#endregion
|
|
619
|
-
export { type AssetRef, type CompileWarning, type CompiledDeck, type CompiledSlide, type ComponentPlaceholder, type ConfiguredDecks, type DeckBrowserRunBinding, type DeckBrowserRunPdfOptions, type DeckBrowserRunPngOptions, type DeckContextOptions, 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 DecksOptions, type DecksRouterConfig, type DecksRouterExtension, type DecksRouterOptions, type DecksRouterOverrides, type DecksRouterPagesOptions, type DecksRouterPresenterOptions, type DefinedDecks, type MaybePromise, type R2AssetKeyInput, type R2AssetSourceOptions, type R2BucketLike, type R2BucketResolver, type R2ObjectBodyLike, type R2ObjectHttpMetadataLike, type ResolvedDeckDocument, SLIDE_TRANSITIONS, type ServeDecksClientEntryOptions, type SlideComponent, type SlideComponentDefinition, type SlideComponentInput, type SlideComponentProps, type SlideComponentRegistry, type SlideFrontmatter, type SlideTransition, builtInSlideComponents, configureDecks, controlIconLabel, createDeckPaths, createDeckViewerEmbed, createDeckViewerParts, deckContext, decksRouter, defineDecks, defineDecksConfig, defineSlideComponents, manifestDeckSource, mergeDecksRouterOptions, renderCompiledDeck, renderCompiledDeckAsync, renderCompiledDeckPage, renderCompiledDeckPageAsync, renderCompiledSlide, renderCompiledSlideAsync, renderControlIcon, renderControlIconHtml, serveDecksClientEntry, withR2Assets };
|
|
619
|
+
export { type AssetRef, type CompileWarning, type CompiledDeck, type CompiledSlide, type ComponentPlaceholder, type ConfiguredDecks, type DeckBrowserRunBinding, type DeckBrowserRunPdfOptions, type DeckBrowserRunPngOptions, type DeckContextOptions, 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 DeckViewerOpenGraphInput, type DeckViewerOpenGraphOptions, type DeckViewerOptions, type DeckViewerPart, type DeckViewerParts, type DeckViewerRenderControlItem, type DeckViewerRenderInput, type DecksBuildConfig, type DecksConfig, type DecksOptions, type DecksRouterConfig, type DecksRouterExtension, type DecksRouterOptions, type DecksRouterOverrides, type DecksRouterPagesOptions, type DecksRouterPresenterOptions, type DefinedDecks, type MaybePromise, type R2AssetKeyInput, type R2AssetSourceOptions, type R2BucketLike, type R2BucketResolver, type R2ObjectBodyLike, type R2ObjectHttpMetadataLike, type ResolvedDeckDocument, SLIDE_TRANSITIONS, type ServeDecksClientEntryOptions, type SlideComponent, type SlideComponentDefinition, type SlideComponentInput, type SlideComponentProps, type SlideComponentRegistry, type SlideFrontmatter, type SlideTransition, builtInSlideComponents, configureDecks, controlIconLabel, createDeckPaths, createDeckViewerEmbed, createDeckViewerParts, deckContext, decksRouter, defineDecks, defineDecksConfig, defineSlideComponents, manifestDeckSource, mergeDecksRouterOptions, renderCompiledDeck, renderCompiledDeckAsync, renderCompiledDeckPage, renderCompiledDeckPageAsync, renderCompiledSlide, renderCompiledSlideAsync, renderControlIcon, renderControlIconHtml, serveDecksClientEntry, withR2Assets };
|
package/dist/advanced.js
CHANGED
|
@@ -333,10 +333,13 @@ function defineSlideComponents(input) {
|
|
|
333
333
|
}
|
|
334
334
|
function createMdxComponents(registry, input = {}) {
|
|
335
335
|
const components = {
|
|
336
|
-
img: (props) => jsx("img", rewriteAssetProps(props, input.assets)),
|
|
337
|
-
a: (props) => jsx("a", rewriteAssetProps(props, input.assets))
|
|
336
|
+
img: (props) => jsx("img", rewriteAssetProps(props ?? {}, input.assets)),
|
|
337
|
+
a: (props) => jsx("a", rewriteAssetProps(props ?? {}, input.assets))
|
|
338
|
+
};
|
|
339
|
+
for (const [name, definition] of Object.entries(registry)) components[name] = (props) => {
|
|
340
|
+
const resolvedProps = props ?? {};
|
|
341
|
+
return renderRegisteredComponent(name, definition, resolvedProps, resolvedProps.children, input.assets);
|
|
338
342
|
};
|
|
339
|
-
for (const [name, definition] of Object.entries(registry)) components[name] = (props = {}) => renderRegisteredComponent(name, definition, props, props.children, input.assets);
|
|
340
343
|
return components;
|
|
341
344
|
}
|
|
342
345
|
function heroImage(props) {
|
|
@@ -391,7 +394,11 @@ function codeBlockText(value) {
|
|
|
391
394
|
if (value === null || value === void 0 || typeof value === "boolean") return "";
|
|
392
395
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
393
396
|
if (isJsxValue(value)) return codeBlockText(value.props?.children);
|
|
394
|
-
|
|
397
|
+
try {
|
|
398
|
+
return JSON.stringify(value) ?? "";
|
|
399
|
+
} catch {
|
|
400
|
+
return "";
|
|
401
|
+
}
|
|
395
402
|
}
|
|
396
403
|
function renderSlideNodes(nodes, input = {}) {
|
|
397
404
|
return normalizeVoidElementSpacing(nodes.map((node) => String(renderSlideNode(node, input))).join(""));
|
|
@@ -749,10 +756,10 @@ function renderPresentationScript(nonce) {
|
|
|
749
756
|
const entries = slideFires(slide).map((fire) => {
|
|
750
757
|
const rawAt = fire.getAttribute("data-fire-at");
|
|
751
758
|
let position;
|
|
752
|
-
if (rawAt !== null &&
|
|
759
|
+
if (rawAt !== null && /^[0-9]+$/.test(rawAt)) {
|
|
753
760
|
position = Number(rawAt);
|
|
754
761
|
} else {
|
|
755
|
-
const offset = rawAt !== null && /^[+-]
|
|
762
|
+
const offset = rawAt !== null && /^[+-][0-9]+$/.test(rawAt) ? Number(rawAt) : 1;
|
|
756
763
|
cursor += offset;
|
|
757
764
|
position = cursor;
|
|
758
765
|
}
|
|
@@ -2168,7 +2175,7 @@ async function renderDeckViewerPage(input) {
|
|
|
2168
2175
|
${document.head}
|
|
2169
2176
|
</head>
|
|
2170
2177
|
<body>
|
|
2171
|
-
${await renderJsxValue(
|
|
2178
|
+
${await renderJsxValue(content)}
|
|
2172
2179
|
${renderViewerScript(document.nonce)}
|
|
2173
2180
|
</body>
|
|
2174
2181
|
</html>`;
|
package/dist/bin.js
CHANGED
|
@@ -262,7 +262,7 @@ function takeKnownStringWithWarning(attrs, key, values, fallback, warnings, code
|
|
|
262
262
|
if (typeof value === "string" && values.includes(value)) return value;
|
|
263
263
|
warnings.push({
|
|
264
264
|
code,
|
|
265
|
-
message: `Unknown ${key} value "${
|
|
265
|
+
message: `Unknown ${key} value "${formatFrontmatterValue(value)}"; using ${fallback}.`,
|
|
266
266
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
267
267
|
});
|
|
268
268
|
return fallback;
|
|
@@ -274,7 +274,7 @@ function takeTransitionDuration(attrs, warnings, slideIndex) {
|
|
|
274
274
|
if (typeof value === "string" && isValidTransitionDuration(value)) return value;
|
|
275
275
|
warnings.push({
|
|
276
276
|
code: "invalid-transition-duration",
|
|
277
|
-
message: `Invalid transitionDuration value "${
|
|
277
|
+
message: `Invalid transitionDuration value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
278
278
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
279
279
|
});
|
|
280
280
|
}
|
|
@@ -285,10 +285,20 @@ function takeTransitionEasing(attrs, warnings, slideIndex) {
|
|
|
285
285
|
if (typeof value === "string" && isValidTransitionEasing(value)) return value;
|
|
286
286
|
warnings.push({
|
|
287
287
|
code: "invalid-transition-easing",
|
|
288
|
-
message: `Invalid transitionEasing value "${
|
|
288
|
+
message: `Invalid transitionEasing value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
289
289
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
+
function formatFrontmatterValue(value) {
|
|
293
|
+
if (typeof value === "string") return value;
|
|
294
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
|
|
295
|
+
if (value === null) return "null";
|
|
296
|
+
try {
|
|
297
|
+
return JSON.stringify(value) ?? "";
|
|
298
|
+
} catch {
|
|
299
|
+
return "[unserializable value]";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
292
302
|
function isValidTransitionDuration(value) {
|
|
293
303
|
return value.split(",").map((item) => item.trim()).every((item) => /^(?:\d+|\d*\.\d+)(?:ms|s)$/.test(item));
|
|
294
304
|
}
|
|
@@ -1130,7 +1140,7 @@ function fireAtAttributeValue(value) {
|
|
|
1130
1140
|
function zennEmbedNode(node, input) {
|
|
1131
1141
|
if (node.type !== "paragraph" || !Array.isArray(node.children) || node.children.length !== 2) return void 0;
|
|
1132
1142
|
const [prefix, link] = node.children;
|
|
1133
|
-
if (prefix?.type !== "text" ||
|
|
1143
|
+
if (prefix?.type !== "text" || typeof prefix.value !== "string" || prefix.value.trim() !== "@") return void 0;
|
|
1134
1144
|
if (link?.type !== "link" || typeof link.url !== "string") return void 0;
|
|
1135
1145
|
const name = collectMarkdownText(link).trim().toLowerCase();
|
|
1136
1146
|
if (name === "youtube") return mdxElement("EmbedFrame", [
|
package/dist/cli.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface RunHonoDecksCliInput {
|
|
|
7
7
|
/** Stops a long-running `compile --watch` command. */
|
|
8
8
|
signal?: AbortSignal;
|
|
9
9
|
/** Test/tooling hook for filesystem watching. */
|
|
10
|
-
watchFileSystem?(path: string, options: {
|
|
10
|
+
watchFileSystem?(this: void, path: string, options: {
|
|
11
11
|
recursive: boolean;
|
|
12
12
|
}, listener: (eventType: "rename" | "change", filename: string | null) => void): {
|
|
13
13
|
close(): void;
|
package/dist/cli.js
CHANGED
|
@@ -261,7 +261,7 @@ function takeKnownStringWithWarning(attrs, key, values, fallback, warnings, code
|
|
|
261
261
|
if (typeof value === "string" && values.includes(value)) return value;
|
|
262
262
|
warnings.push({
|
|
263
263
|
code,
|
|
264
|
-
message: `Unknown ${key} value "${
|
|
264
|
+
message: `Unknown ${key} value "${formatFrontmatterValue(value)}"; using ${fallback}.`,
|
|
265
265
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
266
266
|
});
|
|
267
267
|
return fallback;
|
|
@@ -273,7 +273,7 @@ function takeTransitionDuration(attrs, warnings, slideIndex) {
|
|
|
273
273
|
if (typeof value === "string" && isValidTransitionDuration(value)) return value;
|
|
274
274
|
warnings.push({
|
|
275
275
|
code: "invalid-transition-duration",
|
|
276
|
-
message: `Invalid transitionDuration value "${
|
|
276
|
+
message: `Invalid transitionDuration value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
277
277
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
278
278
|
});
|
|
279
279
|
}
|
|
@@ -284,10 +284,20 @@ function takeTransitionEasing(attrs, warnings, slideIndex) {
|
|
|
284
284
|
if (typeof value === "string" && isValidTransitionEasing(value)) return value;
|
|
285
285
|
warnings.push({
|
|
286
286
|
code: "invalid-transition-easing",
|
|
287
|
-
message: `Invalid transitionEasing value "${
|
|
287
|
+
message: `Invalid transitionEasing value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
288
288
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
+
function formatFrontmatterValue(value) {
|
|
292
|
+
if (typeof value === "string") return value;
|
|
293
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
|
|
294
|
+
if (value === null) return "null";
|
|
295
|
+
try {
|
|
296
|
+
return JSON.stringify(value) ?? "";
|
|
297
|
+
} catch {
|
|
298
|
+
return "[unserializable value]";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
291
301
|
function isValidTransitionDuration(value) {
|
|
292
302
|
return value.split(",").map((item) => item.trim()).every((item) => /^(?:\d+|\d*\.\d+)(?:ms|s)$/.test(item));
|
|
293
303
|
}
|
|
@@ -1129,7 +1139,7 @@ function fireAtAttributeValue(value) {
|
|
|
1129
1139
|
function zennEmbedNode(node, input) {
|
|
1130
1140
|
if (node.type !== "paragraph" || !Array.isArray(node.children) || node.children.length !== 2) return void 0;
|
|
1131
1141
|
const [prefix, link] = node.children;
|
|
1132
|
-
if (prefix?.type !== "text" ||
|
|
1142
|
+
if (prefix?.type !== "text" || typeof prefix.value !== "string" || prefix.value.trim() !== "@") return void 0;
|
|
1133
1143
|
if (link?.type !== "link" || typeof link.url !== "string") return void 0;
|
|
1134
1144
|
const name = collectMarkdownText(link).trim().toLowerCase();
|
|
1135
1145
|
if (name === "youtube") return mdxElement("EmbedFrame", [
|
package/dist/mod.d.ts
CHANGED
|
@@ -521,4 +521,4 @@ interface R2AssetSourceOptions<E extends Env = any> {
|
|
|
521
521
|
}
|
|
522
522
|
declare function withR2Assets<E extends Env = any>(source: DeckSource<E>, options: R2AssetSourceOptions<E>): DeckSource<E>;
|
|
523
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 };
|
|
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 DeckViewerOpenGraphInput, type DeckViewerOpenGraphOptions, 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 };
|
package/dist/mod.js
CHANGED
|
@@ -292,7 +292,11 @@ function codeBlockText(value) {
|
|
|
292
292
|
if (value === null || value === void 0 || typeof value === "boolean") return "";
|
|
293
293
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
294
294
|
if (isJsxValue(value)) return codeBlockText(value.props?.children);
|
|
295
|
-
|
|
295
|
+
try {
|
|
296
|
+
return JSON.stringify(value) ?? "";
|
|
297
|
+
} catch {
|
|
298
|
+
return "";
|
|
299
|
+
}
|
|
296
300
|
}
|
|
297
301
|
async function renderJsxValue(value) {
|
|
298
302
|
const resolved = value instanceof Promise ? await value : value;
|
package/dist/node.d.ts
CHANGED
|
@@ -295,7 +295,7 @@ interface CompileDecksInput extends BuildDeckManifestFromFileSystemInput {
|
|
|
295
295
|
out: string;
|
|
296
296
|
ogpCacheFile?: string;
|
|
297
297
|
refreshOgp?: boolean;
|
|
298
|
-
resolveOgp?(url: string): Promise<LinkCardOgpMetadata | undefined>;
|
|
298
|
+
resolveOgp?(this: void, url: string): Promise<LinkCardOgpMetadata | undefined>;
|
|
299
299
|
}
|
|
300
300
|
declare function compileDecks(input: CompileDecksInput): Promise<DeckManifest>;
|
|
301
301
|
declare function buildDeckManifestFromFileSystem(input: BuildDeckManifestFromFileSystemInput): Promise<DeckManifest>;
|
|
@@ -307,8 +307,8 @@ declare function writeDecksRouterModule(input: WriteDecksRouterModuleInput): Pro
|
|
|
307
307
|
interface CreateLocalDeckIOInput {
|
|
308
308
|
cwd: string;
|
|
309
309
|
root: string;
|
|
310
|
-
pathExists?(path: string): boolean;
|
|
311
|
-
watchFileSystem?(path: string, options: {
|
|
310
|
+
pathExists?(this: void, path: string): boolean;
|
|
311
|
+
watchFileSystem?(this: void, path: string, options: {
|
|
312
312
|
recursive: boolean;
|
|
313
313
|
}, listener: (eventType: "rename" | "change", filename: string | null) => void): {
|
|
314
314
|
close(): void;
|
|
@@ -326,7 +326,7 @@ interface CreateLocalDevSlidesAppInput {
|
|
|
326
326
|
interface LocalDevSlidesApp {
|
|
327
327
|
app: Hono;
|
|
328
328
|
localDeckIO: LocalDeckIO;
|
|
329
|
-
stop()
|
|
329
|
+
stop: () => void;
|
|
330
330
|
}
|
|
331
331
|
declare function createLocalDevSlidesApp(input: CreateLocalDevSlidesAppInput): Promise<LocalDevSlidesApp>;
|
|
332
332
|
//#endregion
|
package/dist/node.js
CHANGED
|
@@ -275,7 +275,7 @@ function takeKnownStringWithWarning(attrs, key, values, fallback, warnings, code
|
|
|
275
275
|
if (typeof value === "string" && values.includes(value)) return value;
|
|
276
276
|
warnings.push({
|
|
277
277
|
code,
|
|
278
|
-
message: `Unknown ${key} value "${
|
|
278
|
+
message: `Unknown ${key} value "${formatFrontmatterValue(value)}"; using ${fallback}.`,
|
|
279
279
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
280
280
|
});
|
|
281
281
|
return fallback;
|
|
@@ -287,7 +287,7 @@ function takeTransitionDuration(attrs, warnings, slideIndex) {
|
|
|
287
287
|
if (typeof value === "string" && isValidTransitionDuration(value)) return value;
|
|
288
288
|
warnings.push({
|
|
289
289
|
code: "invalid-transition-duration",
|
|
290
|
-
message: `Invalid transitionDuration value "${
|
|
290
|
+
message: `Invalid transitionDuration value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
291
291
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
292
292
|
});
|
|
293
293
|
}
|
|
@@ -298,10 +298,20 @@ function takeTransitionEasing(attrs, warnings, slideIndex) {
|
|
|
298
298
|
if (typeof value === "string" && isValidTransitionEasing(value)) return value;
|
|
299
299
|
warnings.push({
|
|
300
300
|
code: "invalid-transition-easing",
|
|
301
|
-
message: `Invalid transitionEasing value "${
|
|
301
|
+
message: `Invalid transitionEasing value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
302
302
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
+
function formatFrontmatterValue(value) {
|
|
306
|
+
if (typeof value === "string") return value;
|
|
307
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
|
|
308
|
+
if (value === null) return "null";
|
|
309
|
+
try {
|
|
310
|
+
return JSON.stringify(value) ?? "";
|
|
311
|
+
} catch {
|
|
312
|
+
return "[unserializable value]";
|
|
313
|
+
}
|
|
314
|
+
}
|
|
305
315
|
function isValidTransitionDuration(value) {
|
|
306
316
|
return value.split(",").map((item) => item.trim()).every((item) => /^(?:\d+|\d*\.\d+)(?:ms|s)$/.test(item));
|
|
307
317
|
}
|
|
@@ -1328,7 +1338,7 @@ function fireAtAttributeValue(value) {
|
|
|
1328
1338
|
function zennEmbedNode(node, input) {
|
|
1329
1339
|
if (node.type !== "paragraph" || !Array.isArray(node.children) || node.children.length !== 2) return void 0;
|
|
1330
1340
|
const [prefix, link] = node.children;
|
|
1331
|
-
if (prefix?.type !== "text" ||
|
|
1341
|
+
if (prefix?.type !== "text" || typeof prefix.value !== "string" || prefix.value.trim() !== "@") return void 0;
|
|
1332
1342
|
if (link?.type !== "link" || typeof link.url !== "string") return void 0;
|
|
1333
1343
|
const name = collectMarkdownText(link).trim().toLowerCase();
|
|
1334
1344
|
if (name === "youtube") return mdxElement("EmbedFrame", [
|
|
@@ -2756,10 +2766,13 @@ function defineSlideComponents(input) {
|
|
|
2756
2766
|
}
|
|
2757
2767
|
function createMdxComponents(registry, input = {}) {
|
|
2758
2768
|
const components = {
|
|
2759
|
-
img: (props) => jsx("img", rewriteAssetProps(props, input.assets)),
|
|
2760
|
-
a: (props) => jsx("a", rewriteAssetProps(props, input.assets))
|
|
2769
|
+
img: (props) => jsx("img", rewriteAssetProps(props ?? {}, input.assets)),
|
|
2770
|
+
a: (props) => jsx("a", rewriteAssetProps(props ?? {}, input.assets))
|
|
2771
|
+
};
|
|
2772
|
+
for (const [name, definition] of Object.entries(registry)) components[name] = (props) => {
|
|
2773
|
+
const resolvedProps = props ?? {};
|
|
2774
|
+
return renderRegisteredComponent(name, definition, resolvedProps, resolvedProps.children, input.assets);
|
|
2761
2775
|
};
|
|
2762
|
-
for (const [name, definition] of Object.entries(registry)) components[name] = (props = {}) => renderRegisteredComponent(name, definition, props, props.children, input.assets);
|
|
2763
2776
|
return components;
|
|
2764
2777
|
}
|
|
2765
2778
|
function heroImage(props) {
|
|
@@ -2814,7 +2827,11 @@ function codeBlockText(value) {
|
|
|
2814
2827
|
if (value === null || value === void 0 || typeof value === "boolean") return "";
|
|
2815
2828
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
2816
2829
|
if (isJsxValue(value)) return codeBlockText(value.props?.children);
|
|
2817
|
-
|
|
2830
|
+
try {
|
|
2831
|
+
return JSON.stringify(value) ?? "";
|
|
2832
|
+
} catch {
|
|
2833
|
+
return "";
|
|
2834
|
+
}
|
|
2818
2835
|
}
|
|
2819
2836
|
function renderSlideNodes(nodes, input = {}) {
|
|
2820
2837
|
return normalizeVoidElementSpacing(nodes.map((node) => String(renderSlideNode(node, input))).join(""));
|
|
@@ -3172,10 +3189,10 @@ function renderPresentationScript(nonce) {
|
|
|
3172
3189
|
const entries = slideFires(slide).map((fire) => {
|
|
3173
3190
|
const rawAt = fire.getAttribute("data-fire-at");
|
|
3174
3191
|
let position;
|
|
3175
|
-
if (rawAt !== null &&
|
|
3192
|
+
if (rawAt !== null && /^[0-9]+$/.test(rawAt)) {
|
|
3176
3193
|
position = Number(rawAt);
|
|
3177
3194
|
} else {
|
|
3178
|
-
const offset = rawAt !== null && /^[+-]
|
|
3195
|
+
const offset = rawAt !== null && /^[+-][0-9]+$/.test(rawAt) ? Number(rawAt) : 1;
|
|
3179
3196
|
cursor += offset;
|
|
3180
3197
|
position = cursor;
|
|
3181
3198
|
}
|
|
@@ -4528,7 +4545,7 @@ async function renderDeckViewerPage(input) {
|
|
|
4528
4545
|
${document.head}
|
|
4529
4546
|
</head>
|
|
4530
4547
|
<body>
|
|
4531
|
-
${await renderJsxValue(
|
|
4548
|
+
${await renderJsxValue(content)}
|
|
4532
4549
|
${renderViewerScript(document.nonce)}
|
|
4533
4550
|
</body>
|
|
4534
4551
|
</html>`;
|
package/dist/vite.js
CHANGED
|
@@ -261,7 +261,7 @@ function takeKnownStringWithWarning(attrs, key, values, fallback, warnings, code
|
|
|
261
261
|
if (typeof value === "string" && values.includes(value)) return value;
|
|
262
262
|
warnings.push({
|
|
263
263
|
code,
|
|
264
|
-
message: `Unknown ${key} value "${
|
|
264
|
+
message: `Unknown ${key} value "${formatFrontmatterValue(value)}"; using ${fallback}.`,
|
|
265
265
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
266
266
|
});
|
|
267
267
|
return fallback;
|
|
@@ -273,7 +273,7 @@ function takeTransitionDuration(attrs, warnings, slideIndex) {
|
|
|
273
273
|
if (typeof value === "string" && isValidTransitionDuration(value)) return value;
|
|
274
274
|
warnings.push({
|
|
275
275
|
code: "invalid-transition-duration",
|
|
276
|
-
message: `Invalid transitionDuration value "${
|
|
276
|
+
message: `Invalid transitionDuration value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
277
277
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
278
278
|
});
|
|
279
279
|
}
|
|
@@ -284,10 +284,20 @@ function takeTransitionEasing(attrs, warnings, slideIndex) {
|
|
|
284
284
|
if (typeof value === "string" && isValidTransitionEasing(value)) return value;
|
|
285
285
|
warnings.push({
|
|
286
286
|
code: "invalid-transition-easing",
|
|
287
|
-
message: `Invalid transitionEasing value "${
|
|
287
|
+
message: `Invalid transitionEasing value "${formatFrontmatterValue(value)}"; ignoring it.`,
|
|
288
288
|
...slideIndex !== void 0 ? { slideIndex } : {}
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
+
function formatFrontmatterValue(value) {
|
|
292
|
+
if (typeof value === "string") return value;
|
|
293
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return value.toString();
|
|
294
|
+
if (value === null) return "null";
|
|
295
|
+
try {
|
|
296
|
+
return JSON.stringify(value) ?? "";
|
|
297
|
+
} catch {
|
|
298
|
+
return "[unserializable value]";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
291
301
|
function isValidTransitionDuration(value) {
|
|
292
302
|
return value.split(",").map((item) => item.trim()).every((item) => /^(?:\d+|\d*\.\d+)(?:ms|s)$/.test(item));
|
|
293
303
|
}
|
|
@@ -1129,7 +1139,7 @@ function fireAtAttributeValue(value) {
|
|
|
1129
1139
|
function zennEmbedNode(node, input) {
|
|
1130
1140
|
if (node.type !== "paragraph" || !Array.isArray(node.children) || node.children.length !== 2) return void 0;
|
|
1131
1141
|
const [prefix, link] = node.children;
|
|
1132
|
-
if (prefix?.type !== "text" ||
|
|
1142
|
+
if (prefix?.type !== "text" || typeof prefix.value !== "string" || prefix.value.trim() !== "@") return void 0;
|
|
1133
1143
|
if (link?.type !== "link" || typeof link.url !== "string") return void 0;
|
|
1134
1144
|
const name = collectMarkdownText(link).trim().toLowerCase();
|
|
1135
1145
|
if (name === "youtube") return mdxElement("EmbedFrame", [
|
|
@@ -1993,7 +2003,7 @@ function honoDecks(options = {}) {
|
|
|
1993
2003
|
if (!server) return;
|
|
1994
2004
|
const next = /* @__PURE__ */ new Set([deckRoot, configPath]);
|
|
1995
2005
|
const removed = [...watchedPaths].filter((path) => !next.has(path));
|
|
1996
|
-
if (removed.length > 0)
|
|
2006
|
+
if (removed.length > 0) server.watcher.unwatch(removed);
|
|
1997
2007
|
server.watcher.add([...next]);
|
|
1998
2008
|
watchedPaths = next;
|
|
1999
2009
|
};
|