Update Tempstream

This commit is contained in:
Kuba Orlik 2024-07-27 17:42:41 +02:00
parent 106fcc86c8
commit 33ad8760eb
8 changed files with 20 additions and 23 deletions

24
package-lock.json generated
View File

@ -30,7 +30,7 @@
"qs": "^6.12.0",
"sealious": "^0.19.9",
"stimulus": "^3.2.2",
"tempstream": "^0.3.16",
"tempstream": "^0.4.1",
"throttle-debounce": "^5.0.2",
"turndown": "^7.2.0"
},
@ -857,6 +857,14 @@
"version": "0.5.3",
"license": "ISC"
},
"node_modules/@sealcode/jdd/node_modules/tempstream": {
"version": "0.3.18",
"resolved": "https://registry.npmjs.org/tempstream/-/tempstream-0.3.18.tgz",
"integrity": "sha512-0V/efjocOnjQtBFC6tR8twlI+ygRNgpisOLneVd+Uma9Oic6fo67OqCwEdrIN2DHs3H72St4ACPqHmnlI1YRag==",
"dependencies": {
"classnames": "^2.5.1"
}
},
"node_modules/@sealcode/sealgen": {
"version": "0.15.45",
"resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.15.45.tgz",
@ -897,14 +905,6 @@
"resolved": "https://registry.npmjs.org/@sealcode/ts-predicates/-/ts-predicates-0.4.3.tgz",
"integrity": "sha512-UNSEacu7Ye8q0N8AJCJy37oJvv3w2OXKGkUnP7xO5lOY9DQviDPRDQhVaZdJ3/xMzXLm4UE3389ihctrPaov/A=="
},
"node_modules/@sealcode/sealgen/node_modules/tempstream": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/tempstream/-/tempstream-0.4.0.tgz",
"integrity": "sha512-NkO6l6LUvZEnxTicz143PbHHHLLJvp8yQy1UgIkNU5S0eGxyf0eKv2C81rAnyrff1Ehk8KzqDOhjaMTa6U0N4w==",
"dependencies": {
"classnames": "^2.5.1"
}
},
"node_modules/@sealcode/ts-predicates": {
"version": "0.6.2",
"license": "ISC",
@ -9539,9 +9539,9 @@
}
},
"node_modules/tempstream": {
"version": "0.3.18",
"resolved": "https://registry.npmjs.org/tempstream/-/tempstream-0.3.18.tgz",
"integrity": "sha512-0V/efjocOnjQtBFC6tR8twlI+ygRNgpisOLneVd+Uma9Oic6fo67OqCwEdrIN2DHs3H72St4ACPqHmnlI1YRag==",
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/tempstream/-/tempstream-0.4.1.tgz",
"integrity": "sha512-b+UkHLO4CVVgDH01aZzbJO8vEAQaGBizYwDt7vCxWJZU1YXay/Hz/4oIlEgANlfuyuKnJpo5aFFGONXto6fatg==",
"dependencies": {
"classnames": "^2.5.1"
}

View File

@ -61,7 +61,7 @@
"qs": "^6.12.0",
"sealious": "^0.19.9",
"stimulus": "^3.2.2",
"tempstream": "^0.3.16",
"tempstream": "^0.4.1",
"throttle-debounce": "^5.0.2",
"turndown": "^7.2.0"
},

View File

@ -1,5 +1,5 @@
import type { FlatTemplatable, Templatable } from "tempstream";
import { tempstream } from "tempstream";
import { tempstreamAsync } from "tempstream";
import type { Readable } from "stream";
import type { BaseContext } from "koa";
import { toKebabCase } from "js-convert-case";
@ -53,7 +53,7 @@ export default function html(
controllers.push("refresh-styles");
controllers.push("refresh-on-ts-changes");
}
return tempstream/* HTML */ ` <!DOCTYPE html>
return tempstreamAsync/* HTML */ ` <!DOCTYPE html>
<html
lang="${htmlOptions.language || DEFAULT_HTML_LANG}"
class="title--${toKebabCase(title)}"

View File

@ -1,7 +1,6 @@
import { TempstreamJSX } from "tempstream";
import type { ComponentToHTMLArgs } from "@sealcode/jdd";
import { Component, ComponentArguments } from "@sealcode/jdd";
import type { Readable } from "stream";
const component_arguments = {
title: new ComponentArguments.ShortText(),
@ -23,7 +22,7 @@ export class NiceBox extends Component<typeof component_arguments> {
args: { title, content, images },
classes,
jdd_context: { render_markdown, render_image, language },
}: ComponentToHTMLArgs<typeof component_arguments>): Promise<Readable> {
}: ComponentToHTMLArgs<typeof component_arguments>): Promise<string> {
return (
<div class={["nice-box", ...classes]}>
<h2>{title}</h2>

View File

@ -3,7 +3,6 @@ import { TempstreamJSX } from "tempstream";
import type { ComponentArgument, List } from "@sealcode/jdd";
import type { JDDPageState } from "./jdd-page.js";
import type { StatefulPage } from "@sealcode/sealgen";
import type { Readable } from "node:stream";
import { ComponentInput } from "./component-input.js";
import type { ComponentPreviewActions } from "./component-preview-actions.js";
@ -25,7 +24,7 @@ export async function ComponentInputList<
arg: List<T, any>;
value: T[];
page: StatefulPage<JDDPageState, typeof ComponentPreviewActions>;
}): Promise<Readable> {
}): Promise<string> {
if (!value) {
value = [];
}

View File

@ -21,7 +21,7 @@ export async function ComponentInputSingleReference<
arg: T;
value: string;
onchange?: string;
}): Promise<import("stream").Readable> {
}): Promise<string> {
return (
<div>
<label>

View File

@ -33,7 +33,7 @@ export async function ComponentInputTable<
arg: Table<CellType, HeaderType>;
value: TableData<CellType, HeaderType>;
page: StatefulPage<JDDPageState, typeof ComponentPreviewActions>;
}): Promise<import("stream").Readable> {
}): Promise<string> {
if (!value) {
value = await arg.getEmptyValue(makeJDDContext(ctx));
}

View File

@ -6,7 +6,6 @@ import { ComponentArguments, Enum, Image, List, Structured, Table } from "@sealc
import { ComponentInputStructured } from "./component-input-structured.js";
import type { StatefulPage } from "@sealcode/sealgen";
import type { ComponentPreviewActions } from "./component-preview-actions.js";
import type { Readable } from "node:stream";
import { ComponentInputList } from "./component-input-list.js";
import type { JDDPageState } from "./jdd-page.js";
import { ComponentInputEnum } from "./component-input-enum.js";
@ -35,7 +34,7 @@ export async function ComponentInput<State extends JDDPageState, T>({
arg: ComponentArgument<T>;
value: T;
page: StatefulPage<JDDPageState, typeof ComponentPreviewActions>;
}): Promise<Readable> {
}): Promise<string> {
if (value === undefined) {
value = await arg.getEmptyValue(makeJDDContext(ctx));
}