import { L as LangCode } from './html-BlS5La9s.js';
export { T as TranslateHtmlOptions, t as translateHtml, a as translateHtmlToManyLangs } from './html-BlS5La9s.js';
import './validate.js';
/**
* Eleventy plugin entry: `@hyperscript-tools/i18n/eleventy`
*
* Adds:
* - `translateHs` filter: translate a hyperscript snippet to a target lang.
* {{ snippet | translateHs("ja") }}
* {{ snippet | translateHs("ja", "en") }} // explicit source
*
* - `translateHsAll` filter: produce { lang: translated } for an array of
* target langs. Useful for emitting per-language code blocks side by side.
* {% set variants = snippet | translateHsAll(["ja","es","ko"]) %}
*
* - `translateHsHtml` filter: rewrite every `_="..."` attribute in an HTML
* fragment. Useful for `{{ patternHtml | translateHsHtml("ja") | safe }}`.
*
* Usage:
* import hyperscriptI18n from '@hyperscript-tools/i18n/eleventy';
* export default function (eleventyConfig) {
* eleventyConfig.addPlugin(hyperscriptI18n);
* }
*
* The plugin is ASYNC: when `parseCheck` is on (the default), it awaits the
* canonical `hyperscript.org` parser before returning. Eleventy 3 awaits plugin
* callbacks passed to `addPlugin`, so the check is active before any template
* renders. All three filters are registered SYNCHRONOUSLY before that await, so
* an un-awaited caller (or Eleventy 2) still gets working filters — the check
* simply activates once the parser finishes loading.
*/
interface EleventyPluginOptions {
/** Default source locale for filters. Defaults to 'en'. */
defaultFrom?: LangCode;
/** Default lenient flag for HTML translation. Defaults to true. */
lenient?: boolean;
/**
* Canonical parse-check for the ENGLISH side (input when source is 'en';
* output when a target is 'en'):
* 'off' — no check
* 'warn' — print a deduped warning for invalid English (default)
* 'error' — throw, failing the build
*/
parseCheck?: 'off' | 'warn' | 'error';
/**
* A translation refused because it would lose part of the script:
* 'warn' — print a deduped warning naming what it would drop (default)
* 'error' — throw, failing the build
* The snippet keeps its source text (with `lenient`) either way.
*/
onRefused?: 'warn' | 'error';
/** Override filter names (in case of collisions in your config). */
filterNames?: {
snippet?: string;
snippetMany?: string;
html?: string;
};
}
interface EleventyConfig {
addFilter(name: string, fn: (...args: unknown[]) => unknown): void;
}
declare function hyperscriptI18nPlugin(eleventyConfig: EleventyConfig, options?: EleventyPluginOptions): Promise;
export { LangCode, hyperscriptI18nPlugin as default };
export type { EleventyPluginOptions };