diff --git a/package-lock.json b/package-lock.json index 4841e70..613607c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@koa/router": "^12.0.1", "@playwright/test": "^1.36.1", "@sealcode/jdd": "^0.2.10", - "@sealcode/sealgen": "^0.11.6", + "@sealcode/sealgen": "^0.11.7", "@sealcode/ts-predicates": "^0.4.3", "@types/kill-port": "^2.0.0", "get-port": "^7.0.0", @@ -1304,9 +1304,9 @@ } }, "node_modules/@sealcode/sealgen": { - "version": "0.11.6", - "resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.11.6.tgz", - "integrity": "sha512-6GGZi59aia7ou2bDmejQedDNLyzfoo05bFnGVlsWXuCOMCUhBXuWGlFe3wqkSr+340iyvZiXJvBSfXg3DatX2Q==", + "version": "0.11.7", + "resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.11.7.tgz", + "integrity": "sha512-JpvVkBCaO2eNTvdRB3J6gs6enYCzMWByaDAj+KmLSifOUqcN1M4DQ5nzF6mAA8q0Aabwe7KDxSHb3b9rPMtYnw==", "dependencies": { "@koa/router": "^12.0.1", "@sealcode/ts-predicates": "^0.4.3", @@ -1322,6 +1322,7 @@ "recursive-readdir": "^2.2.3", "tempstream": "^0.3.0", "tiny-glob": "^0.2.9", + "ws": "^8.16.0", "yargs": "^17.6.2" }, "bin": { @@ -11504,6 +11505,26 @@ "typedarray-to-buffer": "^3.1.5" } }, + "node_modules/ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 5369dc2..aa9b9f7 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@koa/router": "^12.0.1", "@playwright/test": "^1.36.1", "@sealcode/jdd": "^0.2.10", - "@sealcode/sealgen": "^0.11.6", + "@sealcode/sealgen": "^0.11.7", "@sealcode/ts-predicates": "^0.4.3", "@types/kill-port": "^2.0.0", "get-port": "^7.0.0", diff --git a/src/back/html.ts b/src/back/html.ts index 728d6fd..1dab02a 100644 --- a/src/back/html.ts +++ b/src/back/html.ts @@ -15,13 +15,14 @@ export type HTMLOptions = { preserveScroll?: boolean; morphing?: boolean; navbar?: (ctx: BaseContext) => FlatTemplatable; + autoRefreshCSS?: boolean; }; export default function html( ctx: BaseContext, title: string, body: Templatable, - { preserveScroll, morphing, navbar }: HTMLOptions = {}, + { preserveScroll, morphing, navbar, autoRefreshCSS }: HTMLOptions = {}, makeHead: (ctx: BaseContext, title: string) => Templatable = defaultHead ): Readable { ctx.set("content-type", "text/html;charset=utf-8"); @@ -36,6 +37,25 @@ export default function html(
${(navbar || default_navbar)(ctx)} ${body} + ${autoRefreshCSS + ? /* HTML */ `` + : ""}