@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/browser.d.mts +72 -1
- package/dist/index.cjs +1108 -9
- package/dist/index.d.cts +93 -2
- package/dist/index.d.mts +93 -2
- package/dist/index.mjs +1110 -12
- package/package.json +1 -1
package/dist/browser.d.mts
CHANGED
|
@@ -1927,7 +1927,7 @@ type DataProvider = {
|
|
|
1927
1927
|
*/
|
|
1928
1928
|
declare const dataPlugin: import("@moku-labs/core").PluginInstance<"data", DataConfig, DataState, DataProvider, {}> & Record<never, never>;
|
|
1929
1929
|
declare namespace types_d_exports {
|
|
1930
|
-
export { Api, Article, ArticleCard, ComputedFields, Config, ContentApiContext, ContentEvents, ContentProvider, ContentProviderState, EmbedFacade, EmbedFacadeProps, EmbedOptions, FileSystemContentOptions, Frontmatter, LoadAllOptions, MermaidDiagramOptions, State };
|
|
1930
|
+
export { Api, Article, ArticleCard, ComputedFields, Config, ContentApiContext, ContentEvents, ContentProvider, ContentProviderState, EmbedFacade, EmbedFacadeProps, EmbedOptions, FileSystemContentOptions, Frontmatter, GalleryComponent, GalleryOptions, GalleryProps, GallerySlide, GalleryTransformOptions, LoadAllOptions, MermaidDiagramOptions, State };
|
|
1931
1931
|
}
|
|
1932
1932
|
/**
|
|
1933
1933
|
* YAML frontmatter parsed from each article file.
|
|
@@ -2120,6 +2120,66 @@ type EmbedOptions = {
|
|
|
2120
2120
|
*/
|
|
2121
2121
|
facade?: EmbedFacade;
|
|
2122
2122
|
};
|
|
2123
|
+
/** One resolved gallery slide handed to a {@link GalleryComponent}. */
|
|
2124
|
+
type GallerySlide = {
|
|
2125
|
+
/** 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`). */
|
|
2126
|
+
alt: string;
|
|
2127
|
+
};
|
|
2128
|
+
/**
|
|
2129
|
+
* Props handed to a `::gallery` component (the swipeable image set the framework
|
|
2130
|
+
* renders to static markup at build time). The framework resolves the directive's
|
|
2131
|
+
* `src` folder to the sorted, URL-rewritten {@link GallerySlide} list; `caption` is
|
|
2132
|
+
* the directive's `caption` attribute; `attributes` is the full raw directive
|
|
2133
|
+
* attribute bag, so a custom component can read arbitrary extra options
|
|
2134
|
+
* (e.g. `::gallery{… layout="dots"}`).
|
|
2135
|
+
*
|
|
2136
|
+
* @example
|
|
2137
|
+
* ```tsx
|
|
2138
|
+
* const Gallery = ({ slides, caption }: GalleryProps) => (
|
|
2139
|
+
* <div class="gallery-track">
|
|
2140
|
+
* {slides.map(s => <img src={s.src} alt={s.alt} />)}
|
|
2141
|
+
* </div>
|
|
2142
|
+
* );
|
|
2143
|
+
* ```
|
|
2144
|
+
*/
|
|
2145
|
+
type GalleryProps = {
|
|
2146
|
+
/** The resolved slides, in folder order. */slides: readonly GallerySlide[]; /** The directive's `caption` attribute (empty string when unset). */
|
|
2147
|
+
caption: string; /** The full raw directive attribute bag (custom options live here). */
|
|
2148
|
+
attributes: Readonly<Record<string, string>>;
|
|
2149
|
+
};
|
|
2150
|
+
/**
|
|
2151
|
+
* A consumer-supplied gallery component: a Preact function component over
|
|
2152
|
+
* {@link GalleryProps}, rendered (at build time, to static markup) as the inner
|
|
2153
|
+
* content — inside the framework-owned `<div data-component="gallery">` that carries
|
|
2154
|
+
* the island hook. Defaults to the built-in `GalleryTrack`.
|
|
2155
|
+
*/
|
|
2156
|
+
type GalleryComponent = FunctionComponent<GalleryProps>;
|
|
2157
|
+
/**
|
|
2158
|
+
* Options for the `::gallery` feature (the `gallery` key of
|
|
2159
|
+
* {@link FileSystemContentOptions}). `gallery: true` uses the default component;
|
|
2160
|
+
* `gallery: { component }` swaps in a consumer Preact component.
|
|
2161
|
+
*
|
|
2162
|
+
* @example
|
|
2163
|
+
* ```ts
|
|
2164
|
+
* fileSystemContent({ contentDir: "./content", trustedContent: true, gallery: { component: MyGallery } });
|
|
2165
|
+
* ```
|
|
2166
|
+
*/
|
|
2167
|
+
type GalleryOptions = {
|
|
2168
|
+
/**
|
|
2169
|
+
* Consumer Preact component rendering the gallery's inner content (SSR'd to
|
|
2170
|
+
* static markup at build). Receives {@link GalleryProps}. Defaults to the
|
|
2171
|
+
* built-in `GalleryTrack`.
|
|
2172
|
+
*/
|
|
2173
|
+
component?: GalleryComponent;
|
|
2174
|
+
};
|
|
2175
|
+
/**
|
|
2176
|
+
* Resolved gallery transform inputs — {@link GalleryOptions} plus the provider's
|
|
2177
|
+
* `contentDir` (needed to read the directive's `src` folder from disk). Assembled
|
|
2178
|
+
* by the pipeline wiring; not part of the public config surface.
|
|
2179
|
+
*/
|
|
2180
|
+
type GalleryTransformOptions = GalleryOptions & {
|
|
2181
|
+
/** The provider's content directory (folder reads resolve against it). */contentDir: string;
|
|
2182
|
+
};
|
|
2123
2183
|
/**
|
|
2124
2184
|
* Options for the node filesystem provider {@link ContentProvider} `fileSystemContent`.
|
|
2125
2185
|
* These are the markdown-pipeline + source concerns that used to live on the content
|
|
@@ -2164,6 +2224,17 @@ type FileSystemContentOptions = {
|
|
|
2164
2224
|
* (the facade is raw HTML the sanitize pass would strip). Defaults to disabled.
|
|
2165
2225
|
*/
|
|
2166
2226
|
embed?: boolean | EmbedOptions;
|
|
2227
|
+
/**
|
|
2228
|
+
* Folder galleries: rewrite `::gallery{src="./images/dir/" caption="…"}` leaf
|
|
2229
|
+
* directives into a swipeable image set. The framework reads the co-located
|
|
2230
|
+
* `src` folder, sorts its images, rewrites each to its shared `/<slug>/…` URL,
|
|
2231
|
+
* and renders them through a consumer Preact component (pair it with a gallery
|
|
2232
|
+
* SPA island for swipe/keyboard/lightbox). `true` enables with the default
|
|
2233
|
+
* component; an object passes {@link GalleryOptions} (e.g. a consumer
|
|
2234
|
+
* `component`). Requires `trustedContent: true` (the markup is raw HTML the
|
|
2235
|
+
* sanitize pass would strip). Defaults to disabled.
|
|
2236
|
+
*/
|
|
2237
|
+
gallery?: boolean | GalleryOptions;
|
|
2167
2238
|
};
|
|
2168
2239
|
/**
|
|
2169
2240
|
* Internal mutable state of the filesystem provider: the lazy unified processor and
|