@moku-labs/web 1.10.0 → 1.12.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/dist/browser.d.mts +127 -6
- package/dist/browser.mjs +8 -3
- package/dist/index.cjs +1340 -62
- package/dist/index.d.cts +167 -6
- package/dist/index.d.mts +167 -6
- package/dist/index.mjs +1341 -65
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentChildren, VNode } from "preact";
|
|
1
|
+
import { ComponentChildren, FunctionComponent, VNode } from "preact";
|
|
2
2
|
import { EmitFn } from "@moku-labs/core";
|
|
3
3
|
import { BundledTheme, ThemeRegistrationAny } from "shiki";
|
|
4
4
|
import { Pluggable, Processor } from "unified";
|
|
@@ -2671,7 +2671,7 @@ type Api$1 = {
|
|
|
2671
2671
|
*/
|
|
2672
2672
|
declare const cliPlugin: import("@moku-labs/core").PluginInstance<"cli", Config$1, State$1, Api$1, {}> & Record<never, never>;
|
|
2673
2673
|
declare namespace types_d_exports$2 {
|
|
2674
|
-
export { Api, Article, ArticleCard, ComputedFields, Config, ContentApiContext, ContentEvents, ContentProvider, ContentProviderState, FileSystemContentOptions, Frontmatter, LoadAllOptions, MermaidDiagramOptions, State };
|
|
2674
|
+
export { Api, Article, ArticleCard, ComputedFields, Config, ContentApiContext, ContentEvents, ContentProvider, ContentProviderState, EmbedFacade, EmbedFacadeProps, EmbedOptions, FileSystemContentOptions, Frontmatter, GalleryComponent, GalleryOptions, GalleryProps, GallerySlide, GalleryTransformOptions, LoadAllOptions, MermaidDiagramOptions, State };
|
|
2675
2675
|
}
|
|
2676
2676
|
/**
|
|
2677
2677
|
* YAML frontmatter parsed from each article file.
|
|
@@ -2815,6 +2815,115 @@ type MermaidDiagramOptions = {
|
|
|
2815
2815
|
*/
|
|
2816
2816
|
renderDiagrams?: (sources: readonly string[], mermaidConfig?: Record<string, unknown>) => Promise<readonly string[]>;
|
|
2817
2817
|
};
|
|
2818
|
+
/**
|
|
2819
|
+
* Props handed to an `::embed` facade component (the click-to-activate placeholder
|
|
2820
|
+
* the framework renders to static markup at build time). `width`/`height` are the
|
|
2821
|
+
* parsed pixel dimensions when the directive set them; `attributes` is the full raw
|
|
2822
|
+
* directive attribute bag, so a custom facade can read arbitrary extra options
|
|
2823
|
+
* (e.g. `::embed{… poster="/p.jpg" label="Play"}`).
|
|
2824
|
+
*
|
|
2825
|
+
* @example
|
|
2826
|
+
* ```tsx
|
|
2827
|
+
* const Facade = ({ title, attributes }: EmbedFacadeProps) => (
|
|
2828
|
+
* <button type="button" class="lazy-embed-button">
|
|
2829
|
+
* {attributes.poster ? <img src={attributes.poster} alt="" /> : null}
|
|
2830
|
+
* <span class="lazy-embed-title">{title}</span>
|
|
2831
|
+
* </button>
|
|
2832
|
+
* );
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
type EmbedFacadeProps = {
|
|
2836
|
+
/** The embed target exactly as written in the directive (the provider resolves it later). */src: string; /** The human-readable embed title (default label + iframe title). */
|
|
2837
|
+
title: string; /** Reserved-box width in pixels, when the directive set `width`/`height`. */
|
|
2838
|
+
width?: number; /** Reserved-box height in pixels, when the directive set `width`/`height`. */
|
|
2839
|
+
height?: number; /** The full raw directive attribute bag (custom options live here). */
|
|
2840
|
+
attributes: Readonly<Record<string, string>>;
|
|
2841
|
+
};
|
|
2842
|
+
/**
|
|
2843
|
+
* A consumer-supplied facade component: a Preact function component over
|
|
2844
|
+
* {@link EmbedFacadeProps}, rendered (at build time, to static markup) as the
|
|
2845
|
+
* facade's inner content — inside the framework-owned `<figure>` that carries the
|
|
2846
|
+
* island hooks + reserved-box sizing. Defaults to the built-in `EmbedFacadeButton`.
|
|
2847
|
+
*/
|
|
2848
|
+
type EmbedFacade = FunctionComponent<EmbedFacadeProps>;
|
|
2849
|
+
/**
|
|
2850
|
+
* Options for the `::embed` lazy-iframe feature (the `embed` key of
|
|
2851
|
+
* {@link FileSystemContentOptions}). `embed: true` uses the default facade;
|
|
2852
|
+
* `embed: { facade }` swaps in a consumer Preact component for the placeholder.
|
|
2853
|
+
*
|
|
2854
|
+
* @example
|
|
2855
|
+
* ```ts
|
|
2856
|
+
* fileSystemContent({ contentDir: "./content", trustedContent: true, embed: { facade: MyFacade } });
|
|
2857
|
+
* ```
|
|
2858
|
+
*/
|
|
2859
|
+
type EmbedOptions = {
|
|
2860
|
+
/**
|
|
2861
|
+
* Consumer Preact component rendering the facade's inner content (SSR'd to
|
|
2862
|
+
* static markup at build — no client JS). Receives {@link EmbedFacadeProps}.
|
|
2863
|
+
* Defaults to the built-in `EmbedFacadeButton`.
|
|
2864
|
+
*/
|
|
2865
|
+
facade?: EmbedFacade;
|
|
2866
|
+
};
|
|
2867
|
+
/** One resolved gallery slide handed to a {@link GalleryComponent}. */
|
|
2868
|
+
type GallerySlide = {
|
|
2869
|
+
/** Shared absolute image URL (`/<slug>/<dir>/<file>`), identical from every locale page. */src: string; /** Per-slide alt text (the directive `caption` with a ` · N` index suffix, or just `N`). */
|
|
2870
|
+
alt: string;
|
|
2871
|
+
};
|
|
2872
|
+
/**
|
|
2873
|
+
* Props handed to a `::gallery` component (the swipeable image set the framework
|
|
2874
|
+
* renders to static markup at build time). The framework resolves the directive's
|
|
2875
|
+
* `src` folder to the sorted, URL-rewritten {@link GallerySlide} list; `caption` is
|
|
2876
|
+
* the directive's `caption` attribute; `attributes` is the full raw directive
|
|
2877
|
+
* attribute bag, so a custom component can read arbitrary extra options
|
|
2878
|
+
* (e.g. `::gallery{… layout="dots"}`).
|
|
2879
|
+
*
|
|
2880
|
+
* @example
|
|
2881
|
+
* ```tsx
|
|
2882
|
+
* const Gallery = ({ slides, caption }: GalleryProps) => (
|
|
2883
|
+
* <div class="gallery-track">
|
|
2884
|
+
* {slides.map(s => <img src={s.src} alt={s.alt} />)}
|
|
2885
|
+
* </div>
|
|
2886
|
+
* );
|
|
2887
|
+
* ```
|
|
2888
|
+
*/
|
|
2889
|
+
type GalleryProps = {
|
|
2890
|
+
/** The resolved slides, in folder order. */slides: readonly GallerySlide[]; /** The directive's `caption` attribute (empty string when unset). */
|
|
2891
|
+
caption: string; /** The full raw directive attribute bag (custom options live here). */
|
|
2892
|
+
attributes: Readonly<Record<string, string>>;
|
|
2893
|
+
};
|
|
2894
|
+
/**
|
|
2895
|
+
* A consumer-supplied gallery component: a Preact function component over
|
|
2896
|
+
* {@link GalleryProps}, rendered (at build time, to static markup) as the inner
|
|
2897
|
+
* content — inside the framework-owned `<div data-component="gallery">` that carries
|
|
2898
|
+
* the island hook. Defaults to the built-in `GalleryTrack`.
|
|
2899
|
+
*/
|
|
2900
|
+
type GalleryComponent = FunctionComponent<GalleryProps>;
|
|
2901
|
+
/**
|
|
2902
|
+
* Options for the `::gallery` feature (the `gallery` key of
|
|
2903
|
+
* {@link FileSystemContentOptions}). `gallery: true` uses the default component;
|
|
2904
|
+
* `gallery: { component }` swaps in a consumer Preact component.
|
|
2905
|
+
*
|
|
2906
|
+
* @example
|
|
2907
|
+
* ```ts
|
|
2908
|
+
* fileSystemContent({ contentDir: "./content", trustedContent: true, gallery: { component: MyGallery } });
|
|
2909
|
+
* ```
|
|
2910
|
+
*/
|
|
2911
|
+
type GalleryOptions = {
|
|
2912
|
+
/**
|
|
2913
|
+
* Consumer Preact component rendering the gallery's inner content (SSR'd to
|
|
2914
|
+
* static markup at build). Receives {@link GalleryProps}. Defaults to the
|
|
2915
|
+
* built-in `GalleryTrack`.
|
|
2916
|
+
*/
|
|
2917
|
+
component?: GalleryComponent;
|
|
2918
|
+
};
|
|
2919
|
+
/**
|
|
2920
|
+
* Resolved gallery transform inputs — {@link GalleryOptions} plus the provider's
|
|
2921
|
+
* `contentDir` (needed to read the directive's `src` folder from disk). Assembled
|
|
2922
|
+
* by the pipeline wiring; not part of the public config surface.
|
|
2923
|
+
*/
|
|
2924
|
+
type GalleryTransformOptions = GalleryOptions & {
|
|
2925
|
+
/** The provider's content directory (folder reads resolve against it). */contentDir: string;
|
|
2926
|
+
};
|
|
2818
2927
|
/**
|
|
2819
2928
|
* Options for the node filesystem provider {@link ContentProvider} `fileSystemContent`.
|
|
2820
2929
|
* These are the markdown-pipeline + source concerns that used to live on the content
|
|
@@ -2854,10 +2963,22 @@ type FileSystemContentOptions = {
|
|
|
2854
2963
|
* into static click-to-activate facades (no iframe — and none of the target's
|
|
2855
2964
|
* network/JS cost — until the reader clicks). Pair with the `lazyEmbed` SPA
|
|
2856
2965
|
* island, which swaps the facade for the real `<iframe loading="lazy">`.
|
|
2857
|
-
*
|
|
2858
|
-
*
|
|
2966
|
+
* `true` enables with the default facade; an object passes {@link EmbedOptions}
|
|
2967
|
+
* (e.g. a consumer `facade` Preact component). Requires `trustedContent: true`
|
|
2968
|
+
* (the facade is raw HTML the sanitize pass would strip). Defaults to disabled.
|
|
2969
|
+
*/
|
|
2970
|
+
embed?: boolean | EmbedOptions;
|
|
2971
|
+
/**
|
|
2972
|
+
* Folder galleries: rewrite `::gallery{src="./images/dir/" caption="…"}` leaf
|
|
2973
|
+
* directives into a swipeable image set. The framework reads the co-located
|
|
2974
|
+
* `src` folder, sorts its images, rewrites each to its shared `/<slug>/…` URL,
|
|
2975
|
+
* and renders them through a consumer Preact component (pair it with a gallery
|
|
2976
|
+
* SPA island for swipe/keyboard/lightbox). `true` enables with the default
|
|
2977
|
+
* component; an object passes {@link GalleryOptions} (e.g. a consumer
|
|
2978
|
+
* `component`). Requires `trustedContent: true` (the markup is raw HTML the
|
|
2979
|
+
* sanitize pass would strip). Defaults to disabled.
|
|
2859
2980
|
*/
|
|
2860
|
-
|
|
2981
|
+
gallery?: boolean | GalleryOptions;
|
|
2861
2982
|
};
|
|
2862
2983
|
/**
|
|
2863
2984
|
* Internal mutable state of the filesystem provider: the lazy unified processor and
|
|
@@ -3597,6 +3718,46 @@ declare function cloudflareBindings(): EnvProvider;
|
|
|
3597
3718
|
*/
|
|
3598
3719
|
declare function fileSystemContent(options: FileSystemContentOptions): ContentProvider;
|
|
3599
3720
|
//#endregion
|
|
3721
|
+
//#region src/plugins/content/pipeline/embed-facade.d.ts
|
|
3722
|
+
/**
|
|
3723
|
+
* Default `::embed` facade inner content: a single labelled `<button>` carrying
|
|
3724
|
+
* the embed title. The companion `lazyEmbed` island activates the embed on a
|
|
3725
|
+
* click anywhere in the facade, so the button is the keyboard-accessible
|
|
3726
|
+
* control. Provided as the default and as a composable building block for custom
|
|
3727
|
+
* facades.
|
|
3728
|
+
*
|
|
3729
|
+
* @param props - The embed facade props (only `title` is used by the default).
|
|
3730
|
+
* @returns The facade inner-content VNode.
|
|
3731
|
+
* @example
|
|
3732
|
+
* ```tsx
|
|
3733
|
+
* // Compose the default inside a richer custom facade:
|
|
3734
|
+
* const MyFacade = (p: EmbedFacadeProps) => (
|
|
3735
|
+
* <div class="poster"><img src={p.attributes.poster} alt="" /><EmbedFacadeButton {...p} /></div>
|
|
3736
|
+
* );
|
|
3737
|
+
* ```
|
|
3738
|
+
*/
|
|
3739
|
+
declare function EmbedFacadeButton(props: EmbedFacadeProps): VNode;
|
|
3740
|
+
//#endregion
|
|
3741
|
+
//#region src/plugins/content/pipeline/gallery-default.d.ts
|
|
3742
|
+
/**
|
|
3743
|
+
* Default `::gallery` inner content: a single track holding every slide `<img>`
|
|
3744
|
+
* in folder order. A companion gallery island (consumer-provided) can enhance
|
|
3745
|
+
* the track with swipe/keyboard/lightbox; with no island and no CSS it is still
|
|
3746
|
+
* a plain horizontally-scrollable image strip. Provided as the default and as a
|
|
3747
|
+
* composable building block for custom galleries.
|
|
3748
|
+
*
|
|
3749
|
+
* @param props - The gallery props (the resolved `slides`).
|
|
3750
|
+
* @returns The gallery inner-content VNode.
|
|
3751
|
+
* @example
|
|
3752
|
+
* ```tsx
|
|
3753
|
+
* // Compose the default inside a richer custom gallery:
|
|
3754
|
+
* const MyGallery = (p: GalleryProps) => (
|
|
3755
|
+
* <figure><GalleryTrack {...p} /><figcaption>{p.caption}</figcaption></figure>
|
|
3756
|
+
* );
|
|
3757
|
+
* ```
|
|
3758
|
+
*/
|
|
3759
|
+
declare function GalleryTrack(props: GalleryProps): VNode;
|
|
3760
|
+
//#endregion
|
|
3600
3761
|
//#region src/index.d.ts
|
|
3601
3762
|
/**
|
|
3602
3763
|
* Create and initialize a `@moku-labs/web` application — the Layer-3 entry point.
|
|
@@ -3703,4 +3864,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
3703
3864
|
*/
|
|
3704
3865
|
declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config$8, Events, import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", LogConfig, LogState, LogApi>, import("@moku-labs/core").CorePluginInstance<"env", EnvConfig, EnvState, EnvApi>]>>;
|
|
3705
3866
|
//#endregion
|
|
3706
|
-
export { types_d_exports as Build, types_d_exports$1 as Cli, types_d_exports$2 as Content, types_d_exports$3 as Data, types_d_exports$4 as Deploy, types_d_exports$5 as Env, types_d_exports$6 as Head, types_d_exports$7 as Log, types_d_exports$8 as Router, types_d_exports$9 as Spa, browserEnv, buildArticleHead, buildPlugin, canonical, cliPlugin, cloudflareBindings, contentPlugin, createApp, createComponent, createPlugin, createUrls, dataPlugin, defineRoutes, deployPlugin, dotenv, envPlugin, feedLink, fileSystemContent, headPlugin, hreflang, i18nPlugin, jsonLd, lazyEmbed, logPlugin, meta, og, processEnv, route, routerPlugin, sitePlugin, spaPlugin, twitter };
|
|
3867
|
+
export { types_d_exports as Build, types_d_exports$1 as Cli, types_d_exports$2 as Content, types_d_exports$3 as Data, types_d_exports$4 as Deploy, type EmbedFacade, EmbedFacadeButton, type EmbedFacadeProps, type EmbedOptions, types_d_exports$5 as Env, type GalleryComponent, type GalleryOptions, type GalleryProps, type GallerySlide, GalleryTrack, types_d_exports$6 as Head, types_d_exports$7 as Log, types_d_exports$8 as Router, types_d_exports$9 as Spa, browserEnv, buildArticleHead, buildPlugin, canonical, cliPlugin, cloudflareBindings, contentPlugin, createApp, createComponent, createPlugin, createUrls, dataPlugin, defineRoutes, deployPlugin, dotenv, envPlugin, feedLink, fileSystemContent, headPlugin, hreflang, i18nPlugin, jsonLd, lazyEmbed, logPlugin, meta, og, processEnv, route, routerPlugin, sitePlugin, spaPlugin, twitter };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmitFn } from "@moku-labs/core";
|
|
2
|
-
import { ComponentChildren, VNode } from "preact";
|
|
2
|
+
import { ComponentChildren, FunctionComponent, VNode } from "preact";
|
|
3
3
|
import { Pluggable, Processor } from "unified";
|
|
4
4
|
import { BundledTheme, ThemeRegistrationAny } from "shiki";
|
|
5
5
|
|
|
@@ -2671,7 +2671,7 @@ type Api$1 = {
|
|
|
2671
2671
|
*/
|
|
2672
2672
|
declare const cliPlugin: import("@moku-labs/core").PluginInstance<"cli", Config$1, State$1, Api$1, {}> & Record<never, never>;
|
|
2673
2673
|
declare namespace types_d_exports$2 {
|
|
2674
|
-
export { Api, Article, ArticleCard, ComputedFields, Config, ContentApiContext, ContentEvents, ContentProvider, ContentProviderState, FileSystemContentOptions, Frontmatter, LoadAllOptions, MermaidDiagramOptions, State };
|
|
2674
|
+
export { Api, Article, ArticleCard, ComputedFields, Config, ContentApiContext, ContentEvents, ContentProvider, ContentProviderState, EmbedFacade, EmbedFacadeProps, EmbedOptions, FileSystemContentOptions, Frontmatter, GalleryComponent, GalleryOptions, GalleryProps, GallerySlide, GalleryTransformOptions, LoadAllOptions, MermaidDiagramOptions, State };
|
|
2675
2675
|
}
|
|
2676
2676
|
/**
|
|
2677
2677
|
* YAML frontmatter parsed from each article file.
|
|
@@ -2815,6 +2815,115 @@ type MermaidDiagramOptions = {
|
|
|
2815
2815
|
*/
|
|
2816
2816
|
renderDiagrams?: (sources: readonly string[], mermaidConfig?: Record<string, unknown>) => Promise<readonly string[]>;
|
|
2817
2817
|
};
|
|
2818
|
+
/**
|
|
2819
|
+
* Props handed to an `::embed` facade component (the click-to-activate placeholder
|
|
2820
|
+
* the framework renders to static markup at build time). `width`/`height` are the
|
|
2821
|
+
* parsed pixel dimensions when the directive set them; `attributes` is the full raw
|
|
2822
|
+
* directive attribute bag, so a custom facade can read arbitrary extra options
|
|
2823
|
+
* (e.g. `::embed{… poster="/p.jpg" label="Play"}`).
|
|
2824
|
+
*
|
|
2825
|
+
* @example
|
|
2826
|
+
* ```tsx
|
|
2827
|
+
* const Facade = ({ title, attributes }: EmbedFacadeProps) => (
|
|
2828
|
+
* <button type="button" class="lazy-embed-button">
|
|
2829
|
+
* {attributes.poster ? <img src={attributes.poster} alt="" /> : null}
|
|
2830
|
+
* <span class="lazy-embed-title">{title}</span>
|
|
2831
|
+
* </button>
|
|
2832
|
+
* );
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
type EmbedFacadeProps = {
|
|
2836
|
+
/** The embed target exactly as written in the directive (the provider resolves it later). */src: string; /** The human-readable embed title (default label + iframe title). */
|
|
2837
|
+
title: string; /** Reserved-box width in pixels, when the directive set `width`/`height`. */
|
|
2838
|
+
width?: number; /** Reserved-box height in pixels, when the directive set `width`/`height`. */
|
|
2839
|
+
height?: number; /** The full raw directive attribute bag (custom options live here). */
|
|
2840
|
+
attributes: Readonly<Record<string, string>>;
|
|
2841
|
+
};
|
|
2842
|
+
/**
|
|
2843
|
+
* A consumer-supplied facade component: a Preact function component over
|
|
2844
|
+
* {@link EmbedFacadeProps}, rendered (at build time, to static markup) as the
|
|
2845
|
+
* facade's inner content — inside the framework-owned `<figure>` that carries the
|
|
2846
|
+
* island hooks + reserved-box sizing. Defaults to the built-in `EmbedFacadeButton`.
|
|
2847
|
+
*/
|
|
2848
|
+
type EmbedFacade = FunctionComponent<EmbedFacadeProps>;
|
|
2849
|
+
/**
|
|
2850
|
+
* Options for the `::embed` lazy-iframe feature (the `embed` key of
|
|
2851
|
+
* {@link FileSystemContentOptions}). `embed: true` uses the default facade;
|
|
2852
|
+
* `embed: { facade }` swaps in a consumer Preact component for the placeholder.
|
|
2853
|
+
*
|
|
2854
|
+
* @example
|
|
2855
|
+
* ```ts
|
|
2856
|
+
* fileSystemContent({ contentDir: "./content", trustedContent: true, embed: { facade: MyFacade } });
|
|
2857
|
+
* ```
|
|
2858
|
+
*/
|
|
2859
|
+
type EmbedOptions = {
|
|
2860
|
+
/**
|
|
2861
|
+
* Consumer Preact component rendering the facade's inner content (SSR'd to
|
|
2862
|
+
* static markup at build — no client JS). Receives {@link EmbedFacadeProps}.
|
|
2863
|
+
* Defaults to the built-in `EmbedFacadeButton`.
|
|
2864
|
+
*/
|
|
2865
|
+
facade?: EmbedFacade;
|
|
2866
|
+
};
|
|
2867
|
+
/** One resolved gallery slide handed to a {@link GalleryComponent}. */
|
|
2868
|
+
type GallerySlide = {
|
|
2869
|
+
/** Shared absolute image URL (`/<slug>/<dir>/<file>`), identical from every locale page. */src: string; /** Per-slide alt text (the directive `caption` with a ` · N` index suffix, or just `N`). */
|
|
2870
|
+
alt: string;
|
|
2871
|
+
};
|
|
2872
|
+
/**
|
|
2873
|
+
* Props handed to a `::gallery` component (the swipeable image set the framework
|
|
2874
|
+
* renders to static markup at build time). The framework resolves the directive's
|
|
2875
|
+
* `src` folder to the sorted, URL-rewritten {@link GallerySlide} list; `caption` is
|
|
2876
|
+
* the directive's `caption` attribute; `attributes` is the full raw directive
|
|
2877
|
+
* attribute bag, so a custom component can read arbitrary extra options
|
|
2878
|
+
* (e.g. `::gallery{… layout="dots"}`).
|
|
2879
|
+
*
|
|
2880
|
+
* @example
|
|
2881
|
+
* ```tsx
|
|
2882
|
+
* const Gallery = ({ slides, caption }: GalleryProps) => (
|
|
2883
|
+
* <div class="gallery-track">
|
|
2884
|
+
* {slides.map(s => <img src={s.src} alt={s.alt} />)}
|
|
2885
|
+
* </div>
|
|
2886
|
+
* );
|
|
2887
|
+
* ```
|
|
2888
|
+
*/
|
|
2889
|
+
type GalleryProps = {
|
|
2890
|
+
/** The resolved slides, in folder order. */slides: readonly GallerySlide[]; /** The directive's `caption` attribute (empty string when unset). */
|
|
2891
|
+
caption: string; /** The full raw directive attribute bag (custom options live here). */
|
|
2892
|
+
attributes: Readonly<Record<string, string>>;
|
|
2893
|
+
};
|
|
2894
|
+
/**
|
|
2895
|
+
* A consumer-supplied gallery component: a Preact function component over
|
|
2896
|
+
* {@link GalleryProps}, rendered (at build time, to static markup) as the inner
|
|
2897
|
+
* content — inside the framework-owned `<div data-component="gallery">` that carries
|
|
2898
|
+
* the island hook. Defaults to the built-in `GalleryTrack`.
|
|
2899
|
+
*/
|
|
2900
|
+
type GalleryComponent = FunctionComponent<GalleryProps>;
|
|
2901
|
+
/**
|
|
2902
|
+
* Options for the `::gallery` feature (the `gallery` key of
|
|
2903
|
+
* {@link FileSystemContentOptions}). `gallery: true` uses the default component;
|
|
2904
|
+
* `gallery: { component }` swaps in a consumer Preact component.
|
|
2905
|
+
*
|
|
2906
|
+
* @example
|
|
2907
|
+
* ```ts
|
|
2908
|
+
* fileSystemContent({ contentDir: "./content", trustedContent: true, gallery: { component: MyGallery } });
|
|
2909
|
+
* ```
|
|
2910
|
+
*/
|
|
2911
|
+
type GalleryOptions = {
|
|
2912
|
+
/**
|
|
2913
|
+
* Consumer Preact component rendering the gallery's inner content (SSR'd to
|
|
2914
|
+
* static markup at build). Receives {@link GalleryProps}. Defaults to the
|
|
2915
|
+
* built-in `GalleryTrack`.
|
|
2916
|
+
*/
|
|
2917
|
+
component?: GalleryComponent;
|
|
2918
|
+
};
|
|
2919
|
+
/**
|
|
2920
|
+
* Resolved gallery transform inputs — {@link GalleryOptions} plus the provider's
|
|
2921
|
+
* `contentDir` (needed to read the directive's `src` folder from disk). Assembled
|
|
2922
|
+
* by the pipeline wiring; not part of the public config surface.
|
|
2923
|
+
*/
|
|
2924
|
+
type GalleryTransformOptions = GalleryOptions & {
|
|
2925
|
+
/** The provider's content directory (folder reads resolve against it). */contentDir: string;
|
|
2926
|
+
};
|
|
2818
2927
|
/**
|
|
2819
2928
|
* Options for the node filesystem provider {@link ContentProvider} `fileSystemContent`.
|
|
2820
2929
|
* These are the markdown-pipeline + source concerns that used to live on the content
|
|
@@ -2854,10 +2963,22 @@ type FileSystemContentOptions = {
|
|
|
2854
2963
|
* into static click-to-activate facades (no iframe — and none of the target's
|
|
2855
2964
|
* network/JS cost — until the reader clicks). Pair with the `lazyEmbed` SPA
|
|
2856
2965
|
* island, which swaps the facade for the real `<iframe loading="lazy">`.
|
|
2857
|
-
*
|
|
2858
|
-
*
|
|
2966
|
+
* `true` enables with the default facade; an object passes {@link EmbedOptions}
|
|
2967
|
+
* (e.g. a consumer `facade` Preact component). Requires `trustedContent: true`
|
|
2968
|
+
* (the facade is raw HTML the sanitize pass would strip). Defaults to disabled.
|
|
2969
|
+
*/
|
|
2970
|
+
embed?: boolean | EmbedOptions;
|
|
2971
|
+
/**
|
|
2972
|
+
* Folder galleries: rewrite `::gallery{src="./images/dir/" caption="…"}` leaf
|
|
2973
|
+
* directives into a swipeable image set. The framework reads the co-located
|
|
2974
|
+
* `src` folder, sorts its images, rewrites each to its shared `/<slug>/…` URL,
|
|
2975
|
+
* and renders them through a consumer Preact component (pair it with a gallery
|
|
2976
|
+
* SPA island for swipe/keyboard/lightbox). `true` enables with the default
|
|
2977
|
+
* component; an object passes {@link GalleryOptions} (e.g. a consumer
|
|
2978
|
+
* `component`). Requires `trustedContent: true` (the markup is raw HTML the
|
|
2979
|
+
* sanitize pass would strip). Defaults to disabled.
|
|
2859
2980
|
*/
|
|
2860
|
-
|
|
2981
|
+
gallery?: boolean | GalleryOptions;
|
|
2861
2982
|
};
|
|
2862
2983
|
/**
|
|
2863
2984
|
* Internal mutable state of the filesystem provider: the lazy unified processor and
|
|
@@ -3597,6 +3718,46 @@ declare function cloudflareBindings(): EnvProvider;
|
|
|
3597
3718
|
*/
|
|
3598
3719
|
declare function fileSystemContent(options: FileSystemContentOptions): ContentProvider;
|
|
3599
3720
|
//#endregion
|
|
3721
|
+
//#region src/plugins/content/pipeline/embed-facade.d.ts
|
|
3722
|
+
/**
|
|
3723
|
+
* Default `::embed` facade inner content: a single labelled `<button>` carrying
|
|
3724
|
+
* the embed title. The companion `lazyEmbed` island activates the embed on a
|
|
3725
|
+
* click anywhere in the facade, so the button is the keyboard-accessible
|
|
3726
|
+
* control. Provided as the default and as a composable building block for custom
|
|
3727
|
+
* facades.
|
|
3728
|
+
*
|
|
3729
|
+
* @param props - The embed facade props (only `title` is used by the default).
|
|
3730
|
+
* @returns The facade inner-content VNode.
|
|
3731
|
+
* @example
|
|
3732
|
+
* ```tsx
|
|
3733
|
+
* // Compose the default inside a richer custom facade:
|
|
3734
|
+
* const MyFacade = (p: EmbedFacadeProps) => (
|
|
3735
|
+
* <div class="poster"><img src={p.attributes.poster} alt="" /><EmbedFacadeButton {...p} /></div>
|
|
3736
|
+
* );
|
|
3737
|
+
* ```
|
|
3738
|
+
*/
|
|
3739
|
+
declare function EmbedFacadeButton(props: EmbedFacadeProps): VNode;
|
|
3740
|
+
//#endregion
|
|
3741
|
+
//#region src/plugins/content/pipeline/gallery-default.d.ts
|
|
3742
|
+
/**
|
|
3743
|
+
* Default `::gallery` inner content: a single track holding every slide `<img>`
|
|
3744
|
+
* in folder order. A companion gallery island (consumer-provided) can enhance
|
|
3745
|
+
* the track with swipe/keyboard/lightbox; with no island and no CSS it is still
|
|
3746
|
+
* a plain horizontally-scrollable image strip. Provided as the default and as a
|
|
3747
|
+
* composable building block for custom galleries.
|
|
3748
|
+
*
|
|
3749
|
+
* @param props - The gallery props (the resolved `slides`).
|
|
3750
|
+
* @returns The gallery inner-content VNode.
|
|
3751
|
+
* @example
|
|
3752
|
+
* ```tsx
|
|
3753
|
+
* // Compose the default inside a richer custom gallery:
|
|
3754
|
+
* const MyGallery = (p: GalleryProps) => (
|
|
3755
|
+
* <figure><GalleryTrack {...p} /><figcaption>{p.caption}</figcaption></figure>
|
|
3756
|
+
* );
|
|
3757
|
+
* ```
|
|
3758
|
+
*/
|
|
3759
|
+
declare function GalleryTrack(props: GalleryProps): VNode;
|
|
3760
|
+
//#endregion
|
|
3600
3761
|
//#region src/index.d.ts
|
|
3601
3762
|
/**
|
|
3602
3763
|
* Create and initialize a `@moku-labs/web` application — the Layer-3 entry point.
|
|
@@ -3703,4 +3864,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
3703
3864
|
*/
|
|
3704
3865
|
declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config$8, Events, import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", LogConfig, LogState, LogApi>, import("@moku-labs/core").CorePluginInstance<"env", EnvConfig, EnvState, EnvApi>]>>;
|
|
3705
3866
|
//#endregion
|
|
3706
|
-
export { types_d_exports as Build, types_d_exports$1 as Cli, types_d_exports$2 as Content, types_d_exports$3 as Data, types_d_exports$4 as Deploy, types_d_exports$5 as Env, types_d_exports$6 as Head, types_d_exports$7 as Log, types_d_exports$8 as Router, types_d_exports$9 as Spa, browserEnv, buildArticleHead, buildPlugin, canonical, cliPlugin, cloudflareBindings, contentPlugin, createApp, createComponent, createPlugin, createUrls, dataPlugin, defineRoutes, deployPlugin, dotenv, envPlugin, feedLink, fileSystemContent, headPlugin, hreflang, i18nPlugin, jsonLd, lazyEmbed, logPlugin, meta, og, processEnv, route, routerPlugin, sitePlugin, spaPlugin, twitter };
|
|
3867
|
+
export { types_d_exports as Build, types_d_exports$1 as Cli, types_d_exports$2 as Content, types_d_exports$3 as Data, types_d_exports$4 as Deploy, type EmbedFacade, EmbedFacadeButton, type EmbedFacadeProps, type EmbedOptions, types_d_exports$5 as Env, type GalleryComponent, type GalleryOptions, type GalleryProps, type GallerySlide, GalleryTrack, types_d_exports$6 as Head, types_d_exports$7 as Log, types_d_exports$8 as Router, types_d_exports$9 as Spa, browserEnv, buildArticleHead, buildPlugin, canonical, cliPlugin, cloudflareBindings, contentPlugin, createApp, createComponent, createPlugin, createUrls, dataPlugin, defineRoutes, deployPlugin, dotenv, envPlugin, feedLink, fileSystemContent, headPlugin, hreflang, i18nPlugin, jsonLd, lazyEmbed, logPlugin, meta, og, processEnv, route, routerPlugin, sitePlugin, spaPlugin, twitter };
|