takumi-js 2.4.2 → 2.5.1
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/dist/index.cjs +2 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.mts +17 -1
- package/dist/index.mjs +2 -2
- package/dist/{render-dwxU78no.mjs → render-CPSfpCxT.mjs} +31 -2
- package/dist/{render-B-wtWqlt.cjs → render-f5o4nsy9.cjs} +36 -1
- package/dist/response.cjs +1 -1
- package/dist/response.mjs +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_render = require("./render-
|
|
2
|
+
const require_render = require("./render-f5o4nsy9.cjs");
|
|
3
3
|
exports.render = require_render.render;
|
|
4
4
|
exports.renderAnimation = require_render.renderAnimation;
|
|
5
5
|
exports.renderSvg = require_render.renderSvg;
|
|
6
|
+
exports.setGlyphCacheMaxBytes = require_render.setGlyphCacheMaxBytes;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { a as RenderOptions, c as renderAnimation, i as RenderInput, l as renderSvg, n as ImagesInput, o as RenderSvgOptions, r as RenderAnimationOptions, s as render, t as AnimationScene } from "./render-sRfulirT.cjs";
|
|
2
2
|
import { AnimationOutputFormat, DitheringAlgorithm, Font, FontDetails, FontLoader, ImageSource, Keyframes, KeyframesMap, KeyframesRuleList, MeasuredNode, MeasuredTextRun, OutputFormat } from "@takumi-rs/core";
|
|
3
3
|
import { ContainerNode, FetchOptions, ImageNode, Node, NodeAttributes, NodeMetadata, ReactElementLike, RgbaImage, TextNode } from "@takumi-rs/helpers";
|
|
4
|
+
//#region src/glyph-cache.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Sets the byte budget shared by the resolved-glyph and glyph-mask caches; `0` stops
|
|
7
|
+
* caching. Defaults to 8 MiB.
|
|
8
|
+
*
|
|
9
|
+
* The caches belong to the backend rather than to a renderer, so this budget covers
|
|
10
|
+
* every render the process makes. The backend reads it when a cache is first used, so
|
|
11
|
+
* call this before the first render; a later call does not resize a cache already in
|
|
12
|
+
* use.
|
|
13
|
+
*
|
|
14
|
+
* Raise it for scripts with large glyph sets: a CJK outline runs a few kilobytes, so
|
|
15
|
+
* the default holds around a thousand of them and a page of Chinese re-rasterizes
|
|
16
|
+
* glyphs it evicted a moment earlier.
|
|
17
|
+
*/
|
|
18
|
+
declare function setGlyphCacheMaxBytes(bytes: number): void;
|
|
19
|
+
//#endregion
|
|
4
20
|
//#region src/index.d.ts
|
|
5
21
|
declare module "react" {
|
|
6
22
|
interface DOMAttributes<T> {
|
|
@@ -8,4 +24,4 @@ declare module "react" {
|
|
|
8
24
|
}
|
|
9
25
|
}
|
|
10
26
|
//#endregion
|
|
11
|
-
export { type AnimationOutputFormat, type AnimationScene, type ContainerNode, type DitheringAlgorithm, type FetchOptions, type Font, type FontDetails, type FontLoader, type ImageNode, type ImageSource, type ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeAttributes, type NodeMetadata, type OutputFormat, type ReactElementLike, type RenderAnimationOptions, type RenderInput, type RenderOptions, type RenderSvgOptions, type RgbaImage, type TextNode, render, renderAnimation, renderSvg };
|
|
27
|
+
export { type AnimationOutputFormat, type AnimationScene, type ContainerNode, type DitheringAlgorithm, type FetchOptions, type Font, type FontDetails, type FontLoader, type ImageNode, type ImageSource, type ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeAttributes, type NodeMetadata, type OutputFormat, type ReactElementLike, type RenderAnimationOptions, type RenderInput, type RenderOptions, type RenderSvgOptions, type RgbaImage, type TextNode, render, renderAnimation, renderSvg, setGlyphCacheMaxBytes };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { a as RenderOptions, c as renderAnimation, i as RenderInput, l as renderSvg, n as ImagesInput, o as RenderSvgOptions, r as RenderAnimationOptions, s as render, t as AnimationScene } from "./render-Cb_LVX55.mjs";
|
|
2
2
|
import { ContainerNode, FetchOptions, ImageNode, Node, NodeAttributes, NodeMetadata, ReactElementLike, RgbaImage, TextNode } from "@takumi-rs/helpers";
|
|
3
3
|
import { AnimationOutputFormat, DitheringAlgorithm, Font, FontDetails, FontLoader, ImageSource, Keyframes, KeyframesMap, KeyframesRuleList, MeasuredNode, MeasuredTextRun, OutputFormat } from "@takumi-rs/core";
|
|
4
|
+
//#region src/glyph-cache.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Sets the byte budget shared by the resolved-glyph and glyph-mask caches; `0` stops
|
|
7
|
+
* caching. Defaults to 8 MiB.
|
|
8
|
+
*
|
|
9
|
+
* The caches belong to the backend rather than to a renderer, so this budget covers
|
|
10
|
+
* every render the process makes. The backend reads it when a cache is first used, so
|
|
11
|
+
* call this before the first render; a later call does not resize a cache already in
|
|
12
|
+
* use.
|
|
13
|
+
*
|
|
14
|
+
* Raise it for scripts with large glyph sets: a CJK outline runs a few kilobytes, so
|
|
15
|
+
* the default holds around a thousand of them and a page of Chinese re-rasterizes
|
|
16
|
+
* glyphs it evicted a moment earlier.
|
|
17
|
+
*/
|
|
18
|
+
declare function setGlyphCacheMaxBytes(bytes: number): void;
|
|
19
|
+
//#endregion
|
|
4
20
|
//#region src/index.d.ts
|
|
5
21
|
declare module "react" {
|
|
6
22
|
interface DOMAttributes<T> {
|
|
@@ -8,4 +24,4 @@ declare module "react" {
|
|
|
8
24
|
}
|
|
9
25
|
}
|
|
10
26
|
//#endregion
|
|
11
|
-
export { type AnimationOutputFormat, type AnimationScene, type ContainerNode, type DitheringAlgorithm, type FetchOptions, type Font, type FontDetails, type FontLoader, type ImageNode, type ImageSource, type ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeAttributes, type NodeMetadata, type OutputFormat, type ReactElementLike, type RenderAnimationOptions, type RenderInput, type RenderOptions, type RenderSvgOptions, type RgbaImage, type TextNode, render, renderAnimation, renderSvg };
|
|
27
|
+
export { type AnimationOutputFormat, type AnimationScene, type ContainerNode, type DitheringAlgorithm, type FetchOptions, type Font, type FontDetails, type FontLoader, type ImageNode, type ImageSource, type ImagesInput, type Keyframes, type KeyframesMap, type KeyframesRuleList, type MeasuredNode, type MeasuredTextRun, type Node, type NodeAttributes, type NodeMetadata, type OutputFormat, type ReactElementLike, type RenderAnimationOptions, type RenderInput, type RenderOptions, type RenderSvgOptions, type RgbaImage, type TextNode, render, renderAnimation, renderSvg, setGlyphCacheMaxBytes };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as renderAnimation, r as renderSvg, t as render } from "./render-
|
|
2
|
-
export { render, renderAnimation, renderSvg };
|
|
1
|
+
import { i as setGlyphCacheMaxBytes, n as renderAnimation, r as renderSvg, t as render } from "./render-CPSfpCxT.mjs";
|
|
2
|
+
export { render, renderAnimation, renderSvg, setGlyphCacheMaxBytes };
|
|
@@ -3,6 +3,32 @@ import { prepareImages } from "@takumi-rs/helpers";
|
|
|
3
3
|
import { fromJsx } from "@takumi-rs/helpers/jsx";
|
|
4
4
|
import { loadBackend } from "#backend";
|
|
5
5
|
import { fromHtml } from "@takumi-rs/helpers/html";
|
|
6
|
+
//#region src/glyph-cache.ts
|
|
7
|
+
let maxBytes;
|
|
8
|
+
let loaded;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the byte budget shared by the resolved-glyph and glyph-mask caches; `0` stops
|
|
11
|
+
* caching. Defaults to 8 MiB.
|
|
12
|
+
*
|
|
13
|
+
* The caches belong to the backend rather than to a renderer, so this budget covers
|
|
14
|
+
* every render the process makes. The backend reads it when a cache is first used, so
|
|
15
|
+
* call this before the first render; a later call does not resize a cache already in
|
|
16
|
+
* use.
|
|
17
|
+
*
|
|
18
|
+
* Raise it for scripts with large glyph sets: a CJK outline runs a few kilobytes, so
|
|
19
|
+
* the default holds around a thousand of them and a page of Chinese re-rasterizes
|
|
20
|
+
* glyphs it evicted a moment earlier.
|
|
21
|
+
*/
|
|
22
|
+
function setGlyphCacheMaxBytes(bytes) {
|
|
23
|
+
maxBytes = bytes;
|
|
24
|
+
loaded?.setGlyphCacheMaxBytes(bytes);
|
|
25
|
+
}
|
|
26
|
+
/** Hands the recorded budget to a backend as it finishes loading. */
|
|
27
|
+
function applyGlyphCacheMaxBytes(backend) {
|
|
28
|
+
loaded = backend;
|
|
29
|
+
if (maxBytes !== void 0) backend.setGlyphCacheMaxBytes(maxBytes);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
6
32
|
//#region src/import.ts
|
|
7
33
|
let importPromise = null;
|
|
8
34
|
/**
|
|
@@ -12,7 +38,10 @@ let importPromise = null;
|
|
|
12
38
|
* Node target that can't load the native addon. A failed load clears the cache.
|
|
13
39
|
*/
|
|
14
40
|
function getImports(module) {
|
|
15
|
-
importPromise ??= (module === void 0 ? loadBackend() : import("./wasm-init-DzwbPAKW.mjs").then((n) => n.n).then(({ initWasm }) => initWasm(module))).
|
|
41
|
+
importPromise ??= (module === void 0 ? loadBackend() : import("./wasm-init-DzwbPAKW.mjs").then((n) => n.n).then(({ initWasm }) => initWasm(module))).then((backend) => {
|
|
42
|
+
applyGlyphCacheMaxBytes(backend);
|
|
43
|
+
return backend;
|
|
44
|
+
}).catch((error) => {
|
|
16
45
|
importPromise = null;
|
|
17
46
|
throw error;
|
|
18
47
|
});
|
|
@@ -183,4 +212,4 @@ async function renderAnimation(options) {
|
|
|
183
212
|
});
|
|
184
213
|
}
|
|
185
214
|
//#endregion
|
|
186
|
-
export { renderAnimation as n, renderSvg as r, render as t };
|
|
215
|
+
export { setGlyphCacheMaxBytes as i, renderAnimation as n, renderSvg as r, render as t };
|
|
@@ -3,6 +3,32 @@ let _takumi_rs_helpers = require("@takumi-rs/helpers");
|
|
|
3
3
|
let _takumi_rs_helpers_jsx = require("@takumi-rs/helpers/jsx");
|
|
4
4
|
let _backend = require("#backend");
|
|
5
5
|
let _takumi_rs_helpers_html = require("@takumi-rs/helpers/html");
|
|
6
|
+
//#region src/glyph-cache.ts
|
|
7
|
+
let maxBytes;
|
|
8
|
+
let loaded;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the byte budget shared by the resolved-glyph and glyph-mask caches; `0` stops
|
|
11
|
+
* caching. Defaults to 8 MiB.
|
|
12
|
+
*
|
|
13
|
+
* The caches belong to the backend rather than to a renderer, so this budget covers
|
|
14
|
+
* every render the process makes. The backend reads it when a cache is first used, so
|
|
15
|
+
* call this before the first render; a later call does not resize a cache already in
|
|
16
|
+
* use.
|
|
17
|
+
*
|
|
18
|
+
* Raise it for scripts with large glyph sets: a CJK outline runs a few kilobytes, so
|
|
19
|
+
* the default holds around a thousand of them and a page of Chinese re-rasterizes
|
|
20
|
+
* glyphs it evicted a moment earlier.
|
|
21
|
+
*/
|
|
22
|
+
function setGlyphCacheMaxBytes(bytes) {
|
|
23
|
+
maxBytes = bytes;
|
|
24
|
+
loaded?.setGlyphCacheMaxBytes(bytes);
|
|
25
|
+
}
|
|
26
|
+
/** Hands the recorded budget to a backend as it finishes loading. */
|
|
27
|
+
function applyGlyphCacheMaxBytes(backend) {
|
|
28
|
+
loaded = backend;
|
|
29
|
+
if (maxBytes !== void 0) backend.setGlyphCacheMaxBytes(maxBytes);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
6
32
|
//#region src/import.ts
|
|
7
33
|
let importPromise = null;
|
|
8
34
|
/**
|
|
@@ -12,7 +38,10 @@ let importPromise = null;
|
|
|
12
38
|
* Node target that can't load the native addon. A failed load clears the cache.
|
|
13
39
|
*/
|
|
14
40
|
function getImports(module) {
|
|
15
|
-
importPromise ??= (module === void 0 ? (0, _backend.loadBackend)() : Promise.resolve().then(() => require("./wasm-init-H65IoN11.cjs")).then((n) => n.wasm_init_exports).then(({ initWasm }) => initWasm(module))).
|
|
41
|
+
importPromise ??= (module === void 0 ? (0, _backend.loadBackend)() : Promise.resolve().then(() => require("./wasm-init-H65IoN11.cjs")).then((n) => n.wasm_init_exports).then(({ initWasm }) => initWasm(module))).then((backend) => {
|
|
42
|
+
applyGlyphCacheMaxBytes(backend);
|
|
43
|
+
return backend;
|
|
44
|
+
}).catch((error) => {
|
|
16
45
|
importPromise = null;
|
|
17
46
|
throw error;
|
|
18
47
|
});
|
|
@@ -201,3 +230,9 @@ Object.defineProperty(exports, "renderSvg", {
|
|
|
201
230
|
return renderSvg;
|
|
202
231
|
}
|
|
203
232
|
});
|
|
233
|
+
Object.defineProperty(exports, "setGlyphCacheMaxBytes", {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function() {
|
|
236
|
+
return setGlyphCacheMaxBytes;
|
|
237
|
+
}
|
|
238
|
+
});
|
package/dist/response.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_render = require("./render-
|
|
5
|
+
const require_render = require("./render-f5o4nsy9.cjs");
|
|
6
6
|
//#region src/response/index.ts
|
|
7
7
|
const contentTypeMap = {
|
|
8
8
|
png: "image/png",
|
package/dist/response.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "takumi-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "All-in-one Takumi package for Node.js and WebAssembly runtimes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -212,15 +212,15 @@
|
|
|
212
212
|
"publish-lint": "attw --pack . && publint --strict ."
|
|
213
213
|
},
|
|
214
214
|
"dependencies": {
|
|
215
|
-
"@takumi-rs/core": "2.
|
|
216
|
-
"@takumi-rs/helpers": "2.
|
|
217
|
-
"@takumi-rs/wasm": "2.
|
|
215
|
+
"@takumi-rs/core": "2.5.1",
|
|
216
|
+
"@takumi-rs/helpers": "2.5.1",
|
|
217
|
+
"@takumi-rs/wasm": "2.5.1"
|
|
218
218
|
},
|
|
219
219
|
"devDependencies": {
|
|
220
220
|
"@types/bun": "^1.3.14",
|
|
221
221
|
"@types/react": "19.2.17",
|
|
222
|
-
"react": "^19.2.
|
|
223
|
-
"tsdown": "0.22.
|
|
222
|
+
"react": "^19.2.8",
|
|
223
|
+
"tsdown": "0.22.14",
|
|
224
224
|
"unrun": "^0.3.1"
|
|
225
225
|
},
|
|
226
226
|
"engines": {
|