@moku-labs/web 1.11.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/index.d.cts CHANGED
@@ -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, EmbedFacade, EmbedFacadeProps, EmbedOptions, 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.
@@ -2864,6 +2864,66 @@ type EmbedOptions = {
2864
2864
  */
2865
2865
  facade?: EmbedFacade;
2866
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
+ };
2867
2927
  /**
2868
2928
  * Options for the node filesystem provider {@link ContentProvider} `fileSystemContent`.
2869
2929
  * These are the markdown-pipeline + source concerns that used to live on the content
@@ -2908,6 +2968,17 @@ type FileSystemContentOptions = {
2908
2968
  * (the facade is raw HTML the sanitize pass would strip). Defaults to disabled.
2909
2969
  */
2910
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.
2980
+ */
2981
+ gallery?: boolean | GalleryOptions;
2911
2982
  };
2912
2983
  /**
2913
2984
  * Internal mutable state of the filesystem provider: the lazy unified processor and
@@ -3667,6 +3738,26 @@ declare function fileSystemContent(options: FileSystemContentOptions): ContentPr
3667
3738
  */
3668
3739
  declare function EmbedFacadeButton(props: EmbedFacadeProps): VNode;
3669
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
3670
3761
  //#region src/index.d.ts
3671
3762
  /**
3672
3763
  * Create and initialize a `@moku-labs/web` application — the Layer-3 entry point.
@@ -3773,4 +3864,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
3773
3864
  */
3774
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>]>>;
3775
3866
  //#endregion
3776
- 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, 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
@@ -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, EmbedFacade, EmbedFacadeProps, EmbedOptions, 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.
@@ -2864,6 +2864,66 @@ type EmbedOptions = {
2864
2864
  */
2865
2865
  facade?: EmbedFacade;
2866
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
+ };
2867
2927
  /**
2868
2928
  * Options for the node filesystem provider {@link ContentProvider} `fileSystemContent`.
2869
2929
  * These are the markdown-pipeline + source concerns that used to live on the content
@@ -2908,6 +2968,17 @@ type FileSystemContentOptions = {
2908
2968
  * (the facade is raw HTML the sanitize pass would strip). Defaults to disabled.
2909
2969
  */
2910
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.
2980
+ */
2981
+ gallery?: boolean | GalleryOptions;
2911
2982
  };
2912
2983
  /**
2913
2984
  * Internal mutable state of the filesystem provider: the lazy unified processor and
@@ -3667,6 +3738,26 @@ declare function fileSystemContent(options: FileSystemContentOptions): ContentPr
3667
3738
  */
3668
3739
  declare function EmbedFacadeButton(props: EmbedFacadeProps): VNode;
3669
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
3670
3761
  //#region src/index.d.ts
3671
3762
  /**
3672
3763
  * Create and initialize a `@moku-labs/web` application — the Layer-3 entry point.
@@ -3773,4 +3864,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
3773
3864
  */
3774
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>]>>;
3775
3866
  //#endregion
3776
- 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, 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 };