satoru-render 0.0.11 → 0.0.13

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/README.md CHANGED
@@ -12,6 +12,15 @@ By combining the **Skia** graphics engine with a custom **litehtml** layout core
12
12
 
13
13
  ![Sample Output](./document/sample01.webp)
14
14
 
15
+ ## Example
16
+
17
+ - Cloudflare Workers
18
+ https://github.com/SoraKumo001/satoru-cloudflare-ogp
19
+ - Deno Deploy
20
+ https://github.com/SoraKumo001/satoru-deno-ogp-image
21
+ - Next.js(Vercel)
22
+ https://github.com/SoraKumo001/next-satoru
23
+
15
24
  ---
16
25
 
17
26
  ## ✨ Key Features
package/dist/core.js CHANGED
@@ -5,6 +5,8 @@ export const DEFAULT_FONT_MAP = {
5
5
  monospace: "https://cdn.jsdelivr.net/npm/@fontsource/m-plus-1-code/files/m-plus-1-code-japanese-400-normal.woff2",
6
6
  cursive: "https://cdn.jsdelivr.net/npm/@fontsource/yuji-syuku/files/yuji-syuku-japanese-400-normal.woff2",
7
7
  fantasy: "https://cdn.jsdelivr.net/npm/@fontsource/reggae-one/files/reggae-one-japanese-400-normal.woff2",
8
+ emoji: "https://cdn.jsdelivr.net/npm/@fontsource/noto-color-emoji/files/noto-color-emoji-emoji-400-normal.woff2",
9
+ "Noto Color Emoji": "https://cdn.jsdelivr.net/npm/@fontsource/noto-color-emoji/files/noto-color-emoji-emoji-400-normal.woff2",
8
10
  };
9
11
  export async function resolveGoogleFonts(resource, userAgent) {
10
12
  if (!resource.url.startsWith("provider:google-fonts"))
package/dist/jsx.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import h from "vhtml";
2
+ export { h };
package/dist/jsx.js ADDED
@@ -0,0 +1,2 @@
1
+ import h from "vhtml";
2
+ export { h };
@@ -0,0 +1,10 @@
1
+ import { h, type VNode } from "preact";
2
+ export { h };
3
+ /**
4
+ * Converts a React element to a static HTML string.
5
+ * This is a thin wrapper around react-dom/server's renderToStaticMarkup.
6
+ *
7
+ * @param element - The React element to convert.
8
+ * @returns The resulting HTML string.
9
+ */
10
+ export declare function toHtml(element: VNode): string;
package/dist/preact.js ADDED
@@ -0,0 +1,13 @@
1
+ import { h } from "preact";
2
+ import render from "preact-render-to-string";
3
+ export { h };
4
+ /**
5
+ * Converts a React element to a static HTML string.
6
+ * This is a thin wrapper around react-dom/server's renderToStaticMarkup.
7
+ *
8
+ * @param element - The React element to convert.
9
+ * @returns The resulting HTML string.
10
+ */
11
+ export function toHtml(element) {
12
+ return render(element);
13
+ }
Binary file
package/dist/satoru.wasm CHANGED
Binary file
@@ -0,0 +1 @@
1
+ export declare const createCSS: (html: string) => Promise<string>;
@@ -0,0 +1,6 @@
1
+ import { createGenerator } from "@unocss/core";
2
+ import presetUno from "@unocss/preset-wind4";
3
+ export const createCSS = async (html) => {
4
+ const uno = await createGenerator({ presets: [presetUno()] });
5
+ return uno.generate(html).then((v) => v.css);
6
+ };