Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 33x 33x | /**
* @module generate-news-indexes/template/client-script
* @description Composer that emits the full inline `<script>` block — prelude
* declarations followed by the pure-literal runtime body.
*
* @author Hack23 AB
* @license Apache-2.0
*/
import type { ArticleDisplayData, LanguageConfig } from '../types.js';
import { buildPrelude } from './client-script-prelude.js';
import { CLIENT_RUNTIME_BODY } from './client-script-runtime.js';
export interface ClientScriptInput {
readonly langKey: string;
readonly lang: LanguageConfig;
readonly displayData: readonly ArticleDisplayData[];
readonly isRTL: boolean;
}
/** Render the full inline `<script>` body (prelude + runtime). */
export function renderClientScript(input: ClientScriptInput): string {
const prelude = buildPrelude({
langKey: input.langKey,
lang: input.lang,
displayData: input.displayData,
isRTL: input.isRTL,
});
return ` <script>
${prelude}
${CLIENT_RUNTIME_BODY} </script>`;
}
|