ranuts 0.4.1-alpha.2 → 0.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/CLAUDE.md +23 -16
- package/README.de.md +62 -0
- package/README.es.md +62 -0
- package/README.fa.md +62 -0
- package/README.ja.md +62 -0
- package/README.ko.md +62 -0
- package/README.md +35 -92
- package/README.pt.md +62 -0
- package/README.zh-CN.md +35 -91
- package/dist/iife/index.iife.js +4 -0
- package/dist/iife/utils.iife.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +307 -1
- package/dist/src/_virtual/_rolldown/runtime/index.js +12 -0
- package/dist/src/conversation/engine.d.ts +1 -1
- package/dist/src/conversation/engine.js +101 -0
- package/dist/src/conversation/index.d.ts +3 -3
- package/dist/src/conversation/index.js +4 -1
- package/dist/src/stream/accumulator.d.ts +1 -1
- package/dist/src/stream/accumulator.js +79 -0
- package/dist/src/stream/budget.d.ts +1 -1
- package/dist/src/stream/budget.js +45 -0
- package/dist/src/stream/index.d.ts +7 -7
- package/dist/src/stream/index.js +11 -1
- package/dist/src/stream/sse.d.ts +1 -1
- package/dist/src/stream/sse.js +61 -0
- package/dist/src/sw/index.js +52 -1
- package/dist/src/utils/async.js +49 -0
- package/dist/src/utils/audioRecorder.js +1121 -0
- package/dist/src/utils/behavior.js +9 -0
- package/dist/src/utils/binary.js +89 -0
- package/dist/src/utils/bom.d.ts +31 -9
- package/dist/src/utils/bom.js +165 -0
- package/dist/src/utils/bridge.js +310 -0
- package/dist/src/utils/canvas.js +103 -0
- package/dist/src/utils/chain.js +76 -0
- package/dist/src/utils/charset.d.ts +15 -0
- package/dist/src/utils/charset.js +21 -0
- package/dist/src/utils/color.d.ts +0 -1
- package/dist/src/utils/color.js +312 -0
- package/dist/src/utils/compose.js +22 -0
- package/dist/src/utils/console.js +22 -0
- package/dist/src/utils/debounce.js +18 -0
- package/dist/src/utils/device.d.ts +0 -9
- package/dist/src/utils/device.js +31 -0
- package/dist/src/utils/diff.js +110 -0
- package/dist/src/utils/dom.d.ts +1 -1
- package/dist/src/utils/dom.js +89 -0
- package/dist/src/utils/error.js +11 -0
- package/dist/src/utils/event.d.ts +3 -3
- package/dist/src/utils/event.js +39 -0
- package/dist/src/utils/file.js +14 -0
- package/dist/src/utils/func.js +4 -0
- package/dist/src/utils/i18n/index.js +79 -1
- package/dist/src/utils/idb.js +177 -0
- package/dist/src/utils/img.d.ts +1 -1
- package/dist/src/utils/img.js +68 -0
- package/dist/src/utils/index.d.ts +82 -80
- package/dist/src/utils/index.js +307 -1
- package/dist/src/utils/lang.d.ts +23 -6
- package/dist/src/utils/lang.js +42 -0
- package/dist/src/utils/localePath.js +48 -0
- package/dist/src/utils/memoize.d.ts +1 -7
- package/dist/src/utils/memoize.js +16 -0
- package/dist/src/utils/mimeType.js +841 -0
- package/dist/src/utils/monitor.js +84 -0
- package/dist/src/utils/network.js +117 -0
- package/dist/src/utils/noop.js +5 -0
- package/dist/src/utils/number.js +185 -0
- package/dist/src/utils/obj.d.ts +2 -2
- package/dist/src/utils/obj.js +140 -0
- package/dist/src/utils/paginate.js +93 -0
- package/dist/src/utils/performance.js +26 -0
- package/dist/src/utils/placement.js +37 -0
- package/dist/src/utils/prefetch.js +69 -0
- package/dist/src/utils/queue.js +46 -0
- package/dist/src/utils/report.js +44 -0
- package/dist/src/utils/request.js +35 -0
- package/dist/src/utils/script.d.ts +4 -2
- package/dist/src/utils/script.js +45 -0
- package/dist/src/utils/scroll.d.ts +2 -0
- package/dist/src/utils/scroll.js +62 -0
- package/dist/src/utils/secure.js +36 -0
- package/dist/src/utils/segment.js +43 -0
- package/dist/src/utils/signal.d.ts +1 -1
- package/dist/src/utils/signal.js +13 -0
- package/dist/src/utils/speech.js +59 -0
- package/dist/src/utils/storage.js +53 -0
- package/dist/src/utils/str.d.ts +0 -21
- package/dist/src/utils/str.js +377 -0
- package/dist/src/utils/style.js +29 -0
- package/dist/src/utils/subscribe.js +58 -0
- package/dist/src/utils/throttle.js +17 -0
- package/dist/src/utils/time.d.ts +0 -21
- package/dist/src/utils/time.js +97 -0
- package/dist/src/utils/totp/sha/common.d.ts +1 -1
- package/dist/src/utils/totp/sha/common.js +201 -0
- package/dist/src/utils/totp/sha/converters.d.ts +1 -1
- package/dist/src/utils/totp/sha/converters.js +188 -0
- package/dist/src/utils/totp/sha/primitives_32.js +55 -0
- package/dist/src/utils/totp/sha/primitives_64.js +85 -0
- package/dist/src/utils/totp/sha/sha.d.ts +1 -1
- package/dist/src/utils/totp/sha/sha.js +30 -0
- package/dist/src/utils/totp/sha/sha1.d.ts +2 -2
- package/dist/src/utils/totp/sha/sha1.js +51 -0
- package/dist/src/utils/totp/sha/sha256.d.ts +2 -2
- package/dist/src/utils/totp/sha/sha256.js +56 -0
- package/dist/src/utils/totp/sha/sha3.d.ts +3 -3
- package/dist/src/utils/totp/sha/sha3.js +253 -0
- package/dist/src/utils/totp/sha/sha512.d.ts +3 -3
- package/dist/src/utils/totp/sha/sha512.js +177 -0
- package/dist/src/utils/totp/totp.js +49 -0
- package/dist/src/utils/tween.js +59 -0
- package/dist/src/utils/visual/application.d.ts +4 -4
- package/dist/src/utils/visual/application.js +42 -0
- package/dist/src/utils/visual/enums.js +19 -0
- package/dist/src/utils/visual/event/boundary.d.ts +2 -2
- package/dist/src/utils/visual/event/boundary.js +93 -0
- package/dist/src/utils/visual/event/event.d.ts +1 -1
- package/dist/src/utils/visual/event/event.js +34 -0
- package/dist/src/utils/visual/event/index.d.ts +4 -4
- package/dist/src/utils/visual/event/types.d.ts +2 -2
- package/dist/src/utils/visual/event/types.js +23 -0
- package/dist/src/utils/visual/graphics/graphics.d.ts +8 -8
- package/dist/src/utils/visual/graphics/graphics.js +168 -0
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +3 -3
- package/dist/src/utils/visual/graphics/graphicsData.js +12 -0
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +7 -7
- package/dist/src/utils/visual/graphics/graphicsGeometry.js +39 -0
- package/dist/src/utils/visual/graphics/index.d.ts +3 -3
- package/dist/src/utils/visual/index.d.ts +8 -8
- package/dist/src/utils/visual/index.js +20 -1
- package/dist/src/utils/visual/math/bezier.js +15 -0
- package/dist/src/utils/visual/math/enums.js +6 -0
- package/dist/src/utils/visual/math/index.d.ts +4 -4
- package/dist/src/utils/visual/math/matrix.d.ts +1 -1
- package/dist/src/utils/visual/math/matrix.js +59 -0
- package/dist/src/utils/visual/math/transform.d.ts +2 -2
- package/dist/src/utils/visual/math/transform.js +50 -0
- package/dist/src/utils/visual/render/batchRenderer.d.ts +4 -4
- package/dist/src/utils/visual/render/batchRenderer.js +59 -0
- package/dist/src/utils/visual/render/canvasRenderer.d.ts +3 -3
- package/dist/src/utils/visual/render/canvasRenderer.js +17 -0
- package/dist/src/utils/visual/render/filter.d.ts +1 -1
- package/dist/src/utils/visual/render/filter.js +92 -0
- package/dist/src/utils/visual/render/index.d.ts +2 -2
- package/dist/src/utils/visual/render/index.js +20 -0
- package/dist/src/utils/visual/render/render.d.ts +4 -4
- package/dist/src/utils/visual/render/render.js +19 -0
- package/dist/src/utils/visual/render/renderTarget.js +28 -0
- package/dist/src/utils/visual/render/utils/batch/index.d.ts +4 -4
- package/dist/src/utils/visual/render/utils/batch/index.js +88 -0
- package/dist/src/utils/visual/render/utils/earcut.js +328 -0
- package/dist/src/utils/visual/render/utils/float.js +65 -0
- package/dist/src/utils/visual/render/utils/index.js +50 -0
- package/dist/src/utils/visual/render/utils/verticy.d.ts +2 -2
- package/dist/src/utils/visual/render/utils/verticy.js +162 -0
- package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +1 -1
- package/dist/src/utils/visual/render/utils/webgl/initShader.js +31 -0
- package/dist/src/utils/visual/render/utils/webgl/shaders.js +22 -0
- package/dist/src/utils/visual/render/utils/webgpu/shaders.js +32 -0
- package/dist/src/utils/visual/render/webGPURenderer.d.ts +2 -2
- package/dist/src/utils/visual/render/webGPURenderer.js +185 -0
- package/dist/src/utils/visual/render/webGlRenderer.d.ts +2 -2
- package/dist/src/utils/visual/render/webGlRenderer.js +88 -0
- package/dist/src/utils/visual/shape/circle.d.ts +3 -3
- package/dist/src/utils/visual/shape/circle.js +17 -0
- package/dist/src/utils/visual/shape/ellipse.d.ts +3 -3
- package/dist/src/utils/visual/shape/ellipse.js +18 -0
- package/dist/src/utils/visual/shape/index.d.ts +6 -6
- package/dist/src/utils/visual/shape/polygon.d.ts +3 -3
- package/dist/src/utils/visual/shape/polygon.js +29 -0
- package/dist/src/utils/visual/shape/rectangle.d.ts +3 -3
- package/dist/src/utils/visual/shape/rectangle.js +18 -0
- package/dist/src/utils/visual/shape/roundedRectangle.d.ts +3 -3
- package/dist/src/utils/visual/shape/roundedRectangle.js +32 -0
- package/dist/src/utils/visual/shape/shape.d.ts +2 -2
- package/dist/src/utils/visual/shape/shape.js +5 -0
- package/dist/src/utils/visual/style/fill.js +18 -0
- package/dist/src/utils/visual/style/index.d.ts +2 -2
- package/dist/src/utils/visual/style/line.d.ts +2 -2
- package/dist/src/utils/visual/style/line.js +18 -0
- package/dist/src/utils/visual/types.d.ts +1 -1
- package/dist/src/utils/visual/vertex/container.d.ts +5 -5
- package/dist/src/utils/visual/vertex/container.js +54 -0
- package/dist/src/utils/visual/vertex/point.js +37 -0
- package/dist/src/utils/visual/vertex/vertex.d.ts +7 -7
- package/dist/src/utils/visual/vertex/vertex.js +76 -0
- package/dist/src/utils/worker.js +89 -0
- package/dist/src/utils/zip.js +161 -0
- package/dist/src/vnode/h.d.ts +1 -1
- package/dist/src/vnode/h.js +22 -0
- package/dist/src/vnode/hooks.d.ts +1 -1
- package/dist/src/vnode/htmlDomApi.js +94 -0
- package/dist/src/vnode/index.d.ts +16 -16
- package/dist/src/vnode/index.js +28 -1
- package/dist/src/vnode/init.d.ts +1 -1
- package/dist/src/vnode/init.js +104 -0
- package/dist/src/vnode/is.d.ts +1 -1
- package/dist/src/vnode/is.js +20 -0
- package/dist/src/vnode/modules/attributes.d.ts +1 -1
- package/dist/src/vnode/modules/attributes.js +21 -0
- package/dist/src/vnode/modules/class.d.ts +1 -1
- package/dist/src/vnode/modules/class.js +18 -0
- package/dist/src/vnode/modules/index.js +15 -0
- package/dist/src/vnode/modules/listeners.d.ts +1 -1
- package/dist/src/vnode/modules/listeners.js +36 -0
- package/dist/src/vnode/modules/props.d.ts +1 -1
- package/dist/src/vnode/modules/props.js +17 -0
- package/dist/src/vnode/modules/style.d.ts +1 -1
- package/dist/src/vnode/modules/style.js +52 -0
- package/dist/src/vnode/vnode.d.ts +6 -6
- package/dist/src/vnode/vnode.js +13 -0
- package/dist/third-party/jschardet/LICENSE.txt +504 -0
- package/dist/third-party/jschardet/NOTICE.txt +33 -0
- package/docs/API.md +8 -64
- package/package.json +14 -18
- package/dist/bin/generate-api-docs.d.ts +0 -1
- package/dist/build/build.es.d.ts +0 -2
- package/dist/build/build.umd.d.ts +0 -2
- package/dist/build/build.umd.node.d.ts +0 -2
- package/dist/build/build.umd.utils.d.ts +0 -2
- package/dist/chain-CTywmh_H.js +0 -1
- package/dist/color-BTvZUuf-.js +0 -1
- package/dist/enums-BAgbyGdH.js +0 -1
- package/dist/examples/clone-deep-example.d.ts +0 -1
- package/dist/examples/is-equal-example.d.ts +0 -1
- package/dist/i18n-DW21b_DJ.js +0 -1
- package/dist/plugins/vite-plugins-banner.d.ts +0 -2
- package/dist/rolldown-runtime-I3TIJKkN.js +0 -1
- package/dist/src/node/appendFile.d.ts +0 -7
- package/dist/src/node/body.d.ts +0 -9
- package/dist/src/node/color.d.ts +0 -7
- package/dist/src/node/command.d.ts +0 -8
- package/dist/src/node/ctx2req.d.ts +0 -5
- package/dist/src/node/fileInfo.d.ts +0 -7
- package/dist/src/node/fs.d.ts +0 -7
- package/dist/src/node/get.d.ts +0 -10
- package/dist/src/node/getIPAdress.d.ts +0 -1
- package/dist/src/node/index.d.ts +0 -25
- package/dist/src/node/index.js +0 -1
- package/dist/src/node/isColorSupported.d.ts +0 -2
- package/dist/src/node/paresUrl.d.ts +0 -19
- package/dist/src/node/readDir.d.ts +0 -6
- package/dist/src/node/readFile.d.ts +0 -9
- package/dist/src/node/router.d.ts +0 -42
- package/dist/src/node/send.d.ts +0 -7
- package/dist/src/node/server.d.ts +0 -18
- package/dist/src/node/startTask.d.ts +0 -2
- package/dist/src/node/stream.d.ts +0 -15
- package/dist/src/node/taskEnd.d.ts +0 -2
- package/dist/src/node/traverse.d.ts +0 -17
- package/dist/src/node/watchFile.d.ts +0 -8
- package/dist/src/node/writeFile.d.ts +0 -8
- package/dist/src/node/ws.d.ts +0 -8
- package/dist/src/utils/visual/render/utils/batch/index.test.d.ts +0 -1
- package/dist/src/utils/visual/render/utils/index.test.d.ts +0 -1
- package/dist/test/binary.test.d.ts +0 -1
- package/dist/test/bridge.test.d.ts +0 -1
- package/dist/test/budget.test.d.ts +0 -1
- package/dist/test/canvas.test.d.ts +0 -1
- package/dist/test/clearBr.test.d.ts +0 -1
- package/dist/test/cloneDeep.test.d.ts +0 -1
- package/dist/test/color.test.d.ts +0 -1
- package/dist/test/command.test.d.ts +0 -1
- package/dist/test/conversation.test.d.ts +0 -1
- package/dist/test/diff.test.d.ts +0 -1
- package/dist/test/encodeUrl.test.d.ts +0 -1
- package/dist/test/escapeHtml.test.d.ts +0 -1
- package/dist/test/formatBytes.test.d.ts +0 -1
- package/dist/test/is-equal.test.d.ts +0 -1
- package/dist/test/mimeType.test.d.ts +0 -1
- package/dist/test/package-exports.test.d.ts +0 -1
- package/dist/test/scroll.test.d.ts +0 -1
- package/dist/test/server.test.d.ts +0 -1
- package/dist/test/status.test.d.ts +0 -1
- package/dist/test/stream.test.d.ts +0 -1
- package/dist/test/sw.test.d.ts +0 -1
- package/dist/test/totp.test.d.ts +0 -1
- package/dist/test/tween.test.d.ts +0 -1
- package/dist/test/utils/async.test.d.ts +0 -1
- package/dist/test/utils/autosize.test.d.ts +0 -1
- package/dist/test/utils/color-grade.test.d.ts +0 -1
- package/dist/test/utils/compose.test.d.ts +0 -1
- package/dist/test/utils/event.test.d.ts +0 -1
- package/dist/test/utils/file-read.test.d.ts +0 -1
- package/dist/test/utils/format.test.d.ts +0 -1
- package/dist/test/utils/i18n.test.d.ts +0 -1
- package/dist/test/utils/idb-collection.test.d.ts +0 -1
- package/dist/test/utils/idb.test.d.ts +0 -1
- package/dist/test/utils/instrumentation.test.d.ts +0 -1
- package/dist/test/utils/interp.test.d.ts +0 -1
- package/dist/test/utils/lang.test.d.ts +0 -1
- package/dist/test/utils/locale-path.test.d.ts +0 -1
- package/dist/test/utils/media-query.test.d.ts +0 -1
- package/dist/test/utils/mergeObj.test.d.ts +0 -1
- package/dist/test/utils/number-parse.test.d.ts +0 -1
- package/dist/test/utils/paginate.test.d.ts +0 -1
- package/dist/test/utils/placement.test.d.ts +0 -1
- package/dist/test/utils/prefetch.test.d.ts +0 -1
- package/dist/test/utils/query-storage.test.d.ts +0 -1
- package/dist/test/utils/queue.test.d.ts +0 -1
- package/dist/test/utils/report-config.test.d.ts +0 -1
- package/dist/test/utils/report-image.test.d.ts +0 -1
- package/dist/test/utils/secure.test.d.ts +0 -1
- package/dist/test/utils/segment.test.d.ts +0 -1
- package/dist/test/utils/signal-once.test.d.ts +0 -1
- package/dist/test/utils/single-flight.test.d.ts +0 -1
- package/dist/test/utils/speech.test.d.ts +0 -1
- package/dist/test/utils/text-boundary.test.d.ts +0 -1
- package/dist/test/utils/time.test.d.ts +0 -1
- package/dist/test/utils/timing.test.d.ts +0 -1
- package/dist/test/utils/truncate.test.d.ts +0 -1
- package/dist/test/utils/visual/filter.test.d.ts +0 -1
- package/dist/test/utils/worker-client.test.d.ts +0 -1
- package/dist/test/utils/worker-serve.test.d.ts +0 -1
- package/dist/test/utils/zip.test.d.ts +0 -1
- package/dist/test/visual/math.test.d.ts +0 -1
- package/dist/test/visual-application.test.d.ts +0 -1
- package/dist/test/visual-batch.test.d.ts +0 -1
- package/dist/test/visual-math.test.d.ts +0 -1
- package/dist/test/vnode/index.d.ts +0 -1
- package/dist/test/vnode/server.d.ts +0 -2
- package/dist/test/vnode/vnode.d.ts +0 -1
- package/dist/test/vnode.test.d.ts +0 -1
- package/dist/test/websocket.test.d.ts +0 -1
- package/dist/test/writeFile.test.d.ts +0 -1
- package/dist/umd/index.umd.cjs +0 -1
- package/dist/umd/node/node.umd.cjs +0 -1
- package/dist/umd/utils/utils.umd.cjs +0 -1
- package/dist/utils-B4FnyUzW.js +0 -1
- package/dist/vite.config.d.ts +0 -8
- package/dist/vitest.config.d.ts +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Shape } from
|
|
2
|
-
import { SHAPE_TYPE } from
|
|
3
|
-
import type { Point } from
|
|
1
|
+
import { Shape } from "./shape.js";
|
|
2
|
+
import { SHAPE_TYPE } from "../enums.js";
|
|
3
|
+
import type { Point } from "../vertex/point.js";
|
|
4
4
|
export declare class Rectangle extends Shape {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SHAPE_TYPE as e } from "../enums.js";
|
|
2
|
+
import { Shape as r } from "./shape.js";
|
|
3
|
+
var n = class extends r {
|
|
4
|
+
x;
|
|
5
|
+
y;
|
|
6
|
+
width;
|
|
7
|
+
height;
|
|
8
|
+
type = e.RECTANGLE;
|
|
9
|
+
constructor(t = 0, h = 0, i = 0, s = 0) {
|
|
10
|
+
super(), this.x = t, this.y = h, this.width = i, this.height = s;
|
|
11
|
+
}
|
|
12
|
+
contains(t) {
|
|
13
|
+
return t.x > this.x && t.x < this.x + this.width && t.y > this.y && t.y < this.y + this.height;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
n as Rectangle
|
|
18
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Shape } from
|
|
2
|
-
import { SHAPE_TYPE } from
|
|
3
|
-
import type { Point } from
|
|
1
|
+
import { Shape } from "./shape.js";
|
|
2
|
+
import { SHAPE_TYPE } from "../enums.js";
|
|
3
|
+
import type { Point } from "../vertex/point.js";
|
|
4
4
|
export declare class RoundedRectangle extends Shape {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SHAPE_TYPE as y } from "../enums.js";
|
|
2
|
+
import { Shape as n } from "./shape.js";
|
|
3
|
+
var o = class extends n {
|
|
4
|
+
x;
|
|
5
|
+
y;
|
|
6
|
+
width;
|
|
7
|
+
height;
|
|
8
|
+
radius;
|
|
9
|
+
type = y.ROUNDED_RECTANGLE;
|
|
10
|
+
constructor(t = 0, e = 0, s = 0, i = 0, h = 20) {
|
|
11
|
+
super(), this.x = t, this.y = e, this.width = s, this.height = i;
|
|
12
|
+
const r = Math.min(s, i) / 2;
|
|
13
|
+
this.radius = h > r ? r : h;
|
|
14
|
+
}
|
|
15
|
+
contains(t) {
|
|
16
|
+
if (!(t.x > this.x && t.x < this.x + this.width && t.y > this.y && t.y < this.y + this.height)) return !1;
|
|
17
|
+
const e = this.x + this.radius, s = this.y + this.radius;
|
|
18
|
+
if (t.x < e && t.y < s)
|
|
19
|
+
return (t.x - e) * (t.x - e) + (t.y - s) * (t.y - s) < this.radius * this.radius;
|
|
20
|
+
const i = this.x + this.radius, h = this.y + this.height - this.radius;
|
|
21
|
+
if (t.x < i && t.y > h)
|
|
22
|
+
return (t.x - i) * (t.x - i) + (t.y - h) * (t.y - h) < this.radius * this.radius;
|
|
23
|
+
const r = this.x + this.width - this.radius, u = this.y + this.radius;
|
|
24
|
+
if (t.x > r && t.y < u)
|
|
25
|
+
return (t.x - r) * (t.x - r) + (t.y - u) * (t.y - u) < this.radius * this.radius;
|
|
26
|
+
const a = this.x + this.width - this.radius, x = this.y + this.height - this.radius;
|
|
27
|
+
return t.x > a && t.y < x ? (t.x - a) * (t.x - a) + (t.y - x) * (t.y - x) < this.radius * this.radius : !0;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
o as RoundedRectangle
|
|
32
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SHAPE_TYPE } from
|
|
2
|
-
import type { Point } from
|
|
1
|
+
import type { SHAPE_TYPE } from "../enums.js";
|
|
2
|
+
import type { Point } from "../vertex/point.js";
|
|
3
3
|
export declare abstract class Shape {
|
|
4
4
|
abstract type: SHAPE_TYPE;
|
|
5
5
|
abstract contains(point: Point): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var i = class s {
|
|
2
|
+
color = "#ffffff";
|
|
3
|
+
alpha = 1;
|
|
4
|
+
visible = !1;
|
|
5
|
+
constructor() {
|
|
6
|
+
this.reset();
|
|
7
|
+
}
|
|
8
|
+
clone() {
|
|
9
|
+
const l = new s();
|
|
10
|
+
return l.color = this.color, l.alpha = this.alpha, l.visible = this.visible, l;
|
|
11
|
+
}
|
|
12
|
+
reset() {
|
|
13
|
+
this.color = "#ffffff", this.alpha = 1, this.visible = !1;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
i as Fill
|
|
18
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Fill } from
|
|
2
|
-
import { Line } from
|
|
1
|
+
import { Fill } from "./fill.js";
|
|
2
|
+
import { Line } from "./line.js";
|
|
3
3
|
export { Fill, Line };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LINE_CAP, LINE_JOIN } from
|
|
2
|
-
import { Fill } from
|
|
1
|
+
import { LINE_CAP, LINE_JOIN } from "../enums.js";
|
|
2
|
+
import { Fill } from "./fill.js";
|
|
3
3
|
export declare class Line extends Fill {
|
|
4
4
|
width: number;
|
|
5
5
|
cap: LINE_CAP;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LINE_CAP as t, LINE_JOIN as s } from "../enums.js";
|
|
2
|
+
import { Fill as h } from "./fill.js";
|
|
3
|
+
var m = class e extends h {
|
|
4
|
+
width = 0;
|
|
5
|
+
cap = t.BUTT;
|
|
6
|
+
join = s.MITER;
|
|
7
|
+
miterLimit = 10;
|
|
8
|
+
clone() {
|
|
9
|
+
const i = new e();
|
|
10
|
+
return i.color = this.color, i.alpha = this.alpha, i.visible = this.visible, i.width = this.width, i.cap = this.cap, i.join = this.join, i.miterLimit = this.miterLimit, i;
|
|
11
|
+
}
|
|
12
|
+
reset() {
|
|
13
|
+
super.reset(), this.color = "#ffffff", this.width = 0, this.cap = t.BUTT, this.join = s.MITER, this.miterLimit = 10;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
m as Line
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LINE_CAP, LINE_JOIN, RENDERER_TYPE } from
|
|
1
|
+
import type { LINE_CAP, LINE_JOIN, RENDERER_TYPE } from "./enums.js";
|
|
2
2
|
export interface IApplicationOptions {
|
|
3
3
|
prefer?: RENDERER_TYPE.CANVAS | RENDERER_TYPE.WEB_GL | RENDERER_TYPE.WEB_GPU;
|
|
4
4
|
view?: HTMLCanvasElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Vertex } from
|
|
2
|
-
import type { CanvasRenderer } from
|
|
3
|
-
import type { Point } from
|
|
4
|
-
import type { BatchRenderer } from
|
|
5
|
-
import type { Batch } from
|
|
1
|
+
import { Vertex } from "./vertex.js";
|
|
2
|
+
import type { CanvasRenderer } from "../render/canvasRenderer.js";
|
|
3
|
+
import type { Point } from "./point.js";
|
|
4
|
+
import type { BatchRenderer } from "../render/batchRenderer.js";
|
|
5
|
+
import type { Batch } from "../render/utils/batch/index.js";
|
|
6
6
|
export declare class Container extends Vertex {
|
|
7
7
|
isSort: boolean;
|
|
8
8
|
type: string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CONTAINER as e } from "../enums.js";
|
|
2
|
+
import { Transform as i } from "../math/transform.js";
|
|
3
|
+
import { Vertex as s } from "./vertex.js";
|
|
4
|
+
var o = class extends s {
|
|
5
|
+
isSort = !1;
|
|
6
|
+
type = e;
|
|
7
|
+
children = [];
|
|
8
|
+
worldId = 0;
|
|
9
|
+
batches = [];
|
|
10
|
+
batchCount = 0;
|
|
11
|
+
structureVersion = 0;
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
markStructureDirty = () => {
|
|
16
|
+
let r = this.parent ?? this;
|
|
17
|
+
for (; r.parent; ) r = r.parent;
|
|
18
|
+
r.structureVersion++;
|
|
19
|
+
};
|
|
20
|
+
addChild = (r) => {
|
|
21
|
+
r.parent?.removeChild(r), this.children.push(r), r.parent = this, this.isSort = !0, this.markStructureDirty();
|
|
22
|
+
};
|
|
23
|
+
removeChild = (r) => {
|
|
24
|
+
for (let t = 0; t < this.children.length; t++) if (this.children[t] === r) {
|
|
25
|
+
this.children.splice(t, 1), r.parent = void 0, this.markStructureDirty();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
sortChildren = () => {
|
|
30
|
+
this.isSort && (this.children.sort((r, t) => r.zIndex - t.zIndex), this.isSort = !1);
|
|
31
|
+
};
|
|
32
|
+
renderCanvas(r) {
|
|
33
|
+
}
|
|
34
|
+
renderCanvasRecursive = (r) => {
|
|
35
|
+
if (!(this.worldAlpha <= 0 || !this.visible)) {
|
|
36
|
+
this.renderCanvas(r);
|
|
37
|
+
for (let t = 0; t < this.children.length; t++) this.children[t].renderCanvasRecursive(r);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
updateTransform = () => {
|
|
41
|
+
this.sortChildren();
|
|
42
|
+
const r = this.parent?.transform || new i();
|
|
43
|
+
if (this.transform.updateTransform(r), this.worldAlpha = (this.parent?.worldAlpha || 1) * this.alpha, !(this.worldAlpha <= 0 || !this.visible))
|
|
44
|
+
for (let t = 0; t < this.children.length; t++) this.children[t].updateTransform();
|
|
45
|
+
};
|
|
46
|
+
containsPoint = (r) => this.hitArea ? this.hitArea.contains(r) : !1;
|
|
47
|
+
buildBatches(r) {
|
|
48
|
+
}
|
|
49
|
+
updateBatches(r) {
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
o as Container
|
|
54
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var _ = class h {
|
|
2
|
+
x;
|
|
3
|
+
y;
|
|
4
|
+
constructor(s = 0, i = 0) {
|
|
5
|
+
this.x = s, this.y = i;
|
|
6
|
+
}
|
|
7
|
+
set(s = 0, i = s) {
|
|
8
|
+
this.x = s, this.y = i;
|
|
9
|
+
}
|
|
10
|
+
clone = () => new h(this.x, this.y);
|
|
11
|
+
}, y = class {
|
|
12
|
+
_x;
|
|
13
|
+
_y;
|
|
14
|
+
cb;
|
|
15
|
+
constructor(t, s = 0, i = 0) {
|
|
16
|
+
this._x = s, this._y = i, this.cb = t;
|
|
17
|
+
}
|
|
18
|
+
set(t = 0, s = t) {
|
|
19
|
+
this._x = t, this._y = s, this.cb(this._x, this._y);
|
|
20
|
+
}
|
|
21
|
+
get x() {
|
|
22
|
+
return this._x;
|
|
23
|
+
}
|
|
24
|
+
set x(t) {
|
|
25
|
+
this._x !== t && (this._x = t, this.cb(this._x, this._y));
|
|
26
|
+
}
|
|
27
|
+
get y() {
|
|
28
|
+
return this._y;
|
|
29
|
+
}
|
|
30
|
+
set y(t) {
|
|
31
|
+
this._y !== t && (this._y = t, this.cb(this._x, this._y));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
y as ObservablePoint,
|
|
36
|
+
_ as Point
|
|
37
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SyncHook } from
|
|
2
|
-
import { Transform } from
|
|
3
|
-
import type { Container } from
|
|
4
|
-
import type { ObservablePoint } from
|
|
5
|
-
import type { Matrix } from
|
|
6
|
-
import type { Cursor, FederatedEventMap } from
|
|
7
|
-
import type { Shape } from
|
|
1
|
+
import { SyncHook } from "../../subscribe.js";
|
|
2
|
+
import { Transform } from "../math/transform.js";
|
|
3
|
+
import type { Container } from "./container.js";
|
|
4
|
+
import type { ObservablePoint } from "./point.js";
|
|
5
|
+
import type { Matrix } from "../math/matrix.js";
|
|
6
|
+
import type { Cursor, FederatedEventMap } from "../event/index.js";
|
|
7
|
+
import type { Shape } from "../shape/index.js";
|
|
8
8
|
export declare abstract class Vertex extends SyncHook {
|
|
9
9
|
protected _zIndex: number;
|
|
10
10
|
parent: Container | undefined;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { SyncHook as n } from "../../subscribe.js";
|
|
2
|
+
import { DEG_TO_RAD as a, RAD_TO_DEG as i } from "../math/enums.js";
|
|
3
|
+
import { Transform as s } from "../math/transform.js";
|
|
4
|
+
var p = class extends n {
|
|
5
|
+
_zIndex = 0;
|
|
6
|
+
parent = void 0;
|
|
7
|
+
visible = !0;
|
|
8
|
+
transform = new s();
|
|
9
|
+
alpha = 1;
|
|
10
|
+
worldAlpha = 1;
|
|
11
|
+
hitArea = null;
|
|
12
|
+
cursor = "auto";
|
|
13
|
+
get zIndex() {
|
|
14
|
+
return this._zIndex;
|
|
15
|
+
}
|
|
16
|
+
set zIndex(t) {
|
|
17
|
+
this._zIndex = t, this.parent && (this.parent.isSort = !0);
|
|
18
|
+
}
|
|
19
|
+
get position() {
|
|
20
|
+
return this.transform.position;
|
|
21
|
+
}
|
|
22
|
+
get localTransform() {
|
|
23
|
+
return this.transform.localTransform;
|
|
24
|
+
}
|
|
25
|
+
get worldTransform() {
|
|
26
|
+
return this.transform.worldTransform;
|
|
27
|
+
}
|
|
28
|
+
get x() {
|
|
29
|
+
return this.position.x;
|
|
30
|
+
}
|
|
31
|
+
set x(t) {
|
|
32
|
+
this.transform.position.x = t;
|
|
33
|
+
}
|
|
34
|
+
get y() {
|
|
35
|
+
return this.position.y;
|
|
36
|
+
}
|
|
37
|
+
set y(t) {
|
|
38
|
+
this.transform.position.y = t;
|
|
39
|
+
}
|
|
40
|
+
get scale() {
|
|
41
|
+
return this.transform.scale;
|
|
42
|
+
}
|
|
43
|
+
get pivot() {
|
|
44
|
+
return this.transform.pivot;
|
|
45
|
+
}
|
|
46
|
+
get skew() {
|
|
47
|
+
return this.transform.skew;
|
|
48
|
+
}
|
|
49
|
+
get rotation() {
|
|
50
|
+
return this.transform.rotation;
|
|
51
|
+
}
|
|
52
|
+
set rotation(t) {
|
|
53
|
+
this.transform.rotation = t;
|
|
54
|
+
}
|
|
55
|
+
get angle() {
|
|
56
|
+
return this.transform.rotation * i;
|
|
57
|
+
}
|
|
58
|
+
set angle(t) {
|
|
59
|
+
this.transform.rotation = t * a;
|
|
60
|
+
}
|
|
61
|
+
updateTransform() {
|
|
62
|
+
const t = this.parent?.transform || new s();
|
|
63
|
+
this.transform.updateTransform(t), this.worldAlpha = this.alpha * (this.parent?.worldAlpha || 1);
|
|
64
|
+
}
|
|
65
|
+
addEventListener = (t, e, r) => {
|
|
66
|
+
const o = typeof r == "boolean" && r || typeof r == "object" && r.capture ? `${t}capture` : t;
|
|
67
|
+
typeof r == "object" && r.once ? this.once(o, e) : this.tap(o, e);
|
|
68
|
+
};
|
|
69
|
+
removeEventListener = (t, e, r) => {
|
|
70
|
+
const o = r ? `${t}capture` : t;
|
|
71
|
+
this.off(o, e);
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
p as Vertex
|
|
76
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var c = class {
|
|
2
|
+
worker = null;
|
|
3
|
+
nextOperationId = 1;
|
|
4
|
+
pending = /* @__PURE__ */ new Map();
|
|
5
|
+
options;
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.options = e;
|
|
8
|
+
}
|
|
9
|
+
get active() {
|
|
10
|
+
return this.worker !== null;
|
|
11
|
+
}
|
|
12
|
+
get pendingCount() {
|
|
13
|
+
return this.pending.size;
|
|
14
|
+
}
|
|
15
|
+
send = (e, t, r) => {
|
|
16
|
+
const n = this.nextOperationId++;
|
|
17
|
+
return new Promise((a, i) => {
|
|
18
|
+
const o = {
|
|
19
|
+
resolve: a,
|
|
20
|
+
reject: i,
|
|
21
|
+
onProgress: t
|
|
22
|
+
};
|
|
23
|
+
this.options.timeout && (o.timer = setTimeout(() => {
|
|
24
|
+
this.pending.delete(n), i(/* @__PURE__ */ new Error(`worker request timed out after ${this.options.timeout}ms`));
|
|
25
|
+
}, this.options.timeout)), this.pending.set(n, o);
|
|
26
|
+
try {
|
|
27
|
+
this.getWorker().postMessage({
|
|
28
|
+
...e,
|
|
29
|
+
operationId: n
|
|
30
|
+
}, r ?? []);
|
|
31
|
+
} catch (g) {
|
|
32
|
+
this.settle(n), i(g instanceof Error ? g : new Error(String(g)));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
dispose = () => {
|
|
37
|
+
this.worker?.terminate(), this.worker = null, this.rejectAll(/* @__PURE__ */ new Error("worker disposed"));
|
|
38
|
+
};
|
|
39
|
+
getWorker = () => (this.worker || (this.worker = this.options.create(), this.worker.onmessage = (e) => this.handleMessage(e.data), this.worker.onerror = (e) => this.rejectAll(new Error(e.message || "worker crashed"))), this.worker);
|
|
40
|
+
settle = (e) => {
|
|
41
|
+
const t = this.pending.get(e);
|
|
42
|
+
return t?.timer && clearTimeout(t.timer), this.pending.delete(e), t;
|
|
43
|
+
};
|
|
44
|
+
handleMessage = (e) => {
|
|
45
|
+
const t = this.pending.get(e.operationId);
|
|
46
|
+
if (!t) return;
|
|
47
|
+
const { isProgress: r, getProgress: n, isError: a, getErrorMessage: i } = this.options;
|
|
48
|
+
if (r ? r(e) : e.type === "progress") {
|
|
49
|
+
const o = n ? n(e) : e.progress;
|
|
50
|
+
t.onProgress?.(o);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (this.settle(e.operationId), a ? a(e) : e.type === "error") {
|
|
54
|
+
const o = i ? i(e) : e.message;
|
|
55
|
+
t.reject(new Error(o || "worker error"));
|
|
56
|
+
} else t.resolve(e);
|
|
57
|
+
};
|
|
58
|
+
rejectAll = (e) => {
|
|
59
|
+
for (const [t, r] of this.pending)
|
|
60
|
+
r.timer && clearTimeout(r.timer), r.reject(e), this.pending.delete(t);
|
|
61
|
+
};
|
|
62
|
+
}, d = (e, t = {}) => {
|
|
63
|
+
const r = t.scope ?? globalThis;
|
|
64
|
+
if (!r || typeof r.addEventListener != "function") return () => {
|
|
65
|
+
};
|
|
66
|
+
const n = t.resultType ?? "result", a = (i) => {
|
|
67
|
+
const o = i.data;
|
|
68
|
+
if (!o || typeof o.operationId != "number") return;
|
|
69
|
+
const { operationId: g } = o, p = (s) => r.postMessage({
|
|
70
|
+
...s,
|
|
71
|
+
operationId: g
|
|
72
|
+
}), h = { progress: (s) => p({
|
|
73
|
+
type: "progress",
|
|
74
|
+
progress: s
|
|
75
|
+
}) };
|
|
76
|
+
Promise.resolve().then(() => e(o, h)).then((s) => p(typeof s == "object" && s !== null ? s : {
|
|
77
|
+
type: n,
|
|
78
|
+
result: s
|
|
79
|
+
}), (s) => p({
|
|
80
|
+
type: "error",
|
|
81
|
+
message: s instanceof Error ? s.message : String(s)
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
return r.addEventListener("message", a), () => r.removeEventListener("message", a);
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
c as WorkerClient,
|
|
88
|
+
d as serveWorker
|
|
89
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
var H = 67324752, I = 33639248, B = 101010256, A = 30, S = 46, O = 22, z = 65558, G = 0, M = 8, U = (t, e) => t[e] | t[e + 1] << 8, v = (t, e) => (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0, V = /* @__PURE__ */ (() => {
|
|
2
|
+
const t = /* @__PURE__ */ new Uint32Array(256);
|
|
3
|
+
for (let e = 0; e < 256; e++) {
|
|
4
|
+
let n = e;
|
|
5
|
+
for (let c = 0; c < 8; c++) n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
|
|
6
|
+
t[e] = n;
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
})(), T = (t) => {
|
|
10
|
+
let e = 4294967295;
|
|
11
|
+
for (let n = 0; n < t.length; n++) e = (V[(e ^ t[n]) & 255] ?? 0) ^ e >>> 8;
|
|
12
|
+
return (e ^ 4294967295) >>> 0;
|
|
13
|
+
}, N = async (t) => {
|
|
14
|
+
if (typeof DecompressionStream > "u") throw new Error("DecompressionStream is not available in this runtime");
|
|
15
|
+
const e = new DecompressionStream("deflate-raw"), n = e.writable.getWriter(), c = e.readable.getReader();
|
|
16
|
+
n.write(t), n.close();
|
|
17
|
+
const o = [];
|
|
18
|
+
for (; ; ) {
|
|
19
|
+
const { done: l, value: s } = await c.read();
|
|
20
|
+
if (l) break;
|
|
21
|
+
s && o.push(s);
|
|
22
|
+
}
|
|
23
|
+
return Z(o);
|
|
24
|
+
}, Z = (t) => {
|
|
25
|
+
let e = 0;
|
|
26
|
+
for (const o of t) e += o.length;
|
|
27
|
+
const n = new Uint8Array(e);
|
|
28
|
+
let c = 0;
|
|
29
|
+
for (const o of t)
|
|
30
|
+
n.set(o, c), c += o.length;
|
|
31
|
+
return n;
|
|
32
|
+
}, j = (t) => {
|
|
33
|
+
const e = Math.max(0, t.length - z);
|
|
34
|
+
for (let n = t.length - O; n >= e; n--) if (v(t, n) === B) return n;
|
|
35
|
+
return -1;
|
|
36
|
+
}, k = (t) => {
|
|
37
|
+
const e = j(t);
|
|
38
|
+
if (e === -1) return [];
|
|
39
|
+
const n = U(t, e + 10), c = [];
|
|
40
|
+
let o = v(t, e + 16);
|
|
41
|
+
for (let l = 0; l < n && !(o + S > t.length || v(t, o) !== I); l++) {
|
|
42
|
+
const s = U(t, o + 10), i = U(t, o + 12), f = U(t, o + 14), g = v(t, o + 16), h = v(t, o + 20), E = v(t, o + 24), D = U(t, o + 28), L = U(t, o + 30), _ = U(t, o + 32), m = v(t, o + 42), r = t.slice(o + S, o + S + D), a = new TextDecoder("utf-8", { fatal: !1 }).decode(r), d = m + A <= t.length, u = d ? U(t, m + 26) : 0, w = d ? U(t, m + 28) : 0, p = o;
|
|
43
|
+
o += S + D + L + _, c.push({
|
|
44
|
+
name: a,
|
|
45
|
+
compression: s,
|
|
46
|
+
crc: g,
|
|
47
|
+
compressedSize: h,
|
|
48
|
+
uncompressedSize: E,
|
|
49
|
+
modTime: i,
|
|
50
|
+
modDate: f,
|
|
51
|
+
directory: a.endsWith("/"),
|
|
52
|
+
dataStart: m + A + u + w,
|
|
53
|
+
nameBytes: r,
|
|
54
|
+
localOffset: m,
|
|
55
|
+
centralStart: p,
|
|
56
|
+
centralEnd: o
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return c;
|
|
60
|
+
}, P = (t, e) => k(t).some((n) => n.name === e), y = async (t, e) => {
|
|
61
|
+
const n = typeof e == "string" ? k(t).find((o) => o.name === e) : e;
|
|
62
|
+
if (!n || n.directory || n.dataStart + n.compressedSize > t.length) return null;
|
|
63
|
+
const c = t.slice(n.dataStart, n.dataStart + n.compressedSize);
|
|
64
|
+
if (n.compression === 0) return c;
|
|
65
|
+
if (n.compression !== 8) return null;
|
|
66
|
+
try {
|
|
67
|
+
return await N(c);
|
|
68
|
+
} catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}, R = (t, e, n, c = 0, o = 0) => {
|
|
72
|
+
const l = new Uint8Array(A + t.length), s = new DataView(l.buffer);
|
|
73
|
+
return s.setUint32(0, H, !0), s.setUint16(4, 20, !0), s.setUint16(6, 0, !0), s.setUint16(8, 0, !0), s.setUint16(10, c, !0), s.setUint16(12, o, !0), s.setUint32(14, n, !0), s.setUint32(18, e, !0), s.setUint32(22, e, !0), s.setUint16(26, t.length, !0), l.set(t, A), l;
|
|
74
|
+
}, C = (t, e, n, c, o = 0, l = 0) => {
|
|
75
|
+
const s = new Uint8Array(S + t.length), i = new DataView(s.buffer);
|
|
76
|
+
return i.setUint32(0, I, !0), i.setUint16(4, 20, !0), i.setUint16(6, 20, !0), i.setUint16(8, 0, !0), i.setUint16(10, 0, !0), i.setUint16(12, o, !0), i.setUint16(14, l, !0), i.setUint32(16, n, !0), i.setUint32(20, e, !0), i.setUint32(24, e, !0), i.setUint16(28, t.length, !0), i.setUint32(42, c, !0), s.set(t, S), s;
|
|
77
|
+
}, x = (t) => typeof t == "string" ? new TextEncoder().encode(t) : t, W = async (t, e = {}) => {
|
|
78
|
+
const { filter: n, transform: c, inject: o } = e, l = k(t);
|
|
79
|
+
if (l.length === 0) return t;
|
|
80
|
+
const s = /* @__PURE__ */ new Map();
|
|
81
|
+
if (c) {
|
|
82
|
+
for (const r of l)
|
|
83
|
+
if (!r.directory && !(n && !n(r)))
|
|
84
|
+
try {
|
|
85
|
+
const a = await y(t, r);
|
|
86
|
+
if (!a) continue;
|
|
87
|
+
const d = await c(a, r);
|
|
88
|
+
if (d == null) continue;
|
|
89
|
+
const u = x(d);
|
|
90
|
+
if (u.length === a.length && u.every((w, p) => w === a[p])) continue;
|
|
91
|
+
s.set(r, u);
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const i = (o ?? []).map(({ name: r, data: a }) => ({
|
|
96
|
+
nameBytes: new TextEncoder().encode(r),
|
|
97
|
+
data: x(a)
|
|
98
|
+
}));
|
|
99
|
+
if (s.size === 0 && i.length === 0) return t;
|
|
100
|
+
const f = [], g = [];
|
|
101
|
+
let h = 0;
|
|
102
|
+
for (const r of l) {
|
|
103
|
+
g.push(h);
|
|
104
|
+
const a = s.get(r);
|
|
105
|
+
if (a) {
|
|
106
|
+
const p = R(r.nameBytes, a.length, T(a), r.modTime, r.modDate);
|
|
107
|
+
f.push(p, a), h += p.length + a.length;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const d = new Uint8Array(A + r.nameBytes.length), u = new DataView(d.buffer);
|
|
111
|
+
u.setUint32(0, H, !0), u.setUint16(4, 20, !0), u.setUint16(6, 0, !0), u.setUint16(8, r.compression, !0), u.setUint16(10, r.modTime, !0), u.setUint16(12, r.modDate, !0), u.setUint32(14, r.crc, !0), u.setUint32(18, r.compressedSize, !0), u.setUint32(22, r.uncompressedSize, !0), u.setUint16(26, r.nameBytes.length, !0), d.set(r.nameBytes, A);
|
|
112
|
+
const w = t.slice(r.dataStart, r.dataStart + r.compressedSize);
|
|
113
|
+
f.push(d, w), h += d.length + w.length;
|
|
114
|
+
}
|
|
115
|
+
const E = [];
|
|
116
|
+
for (const r of i) {
|
|
117
|
+
E.push(h);
|
|
118
|
+
const a = R(r.nameBytes, r.data.length, T(r.data));
|
|
119
|
+
f.push(a, r.data), h += a.length + r.data.length;
|
|
120
|
+
}
|
|
121
|
+
const D = h;
|
|
122
|
+
for (let r = 0; r < l.length; r++) {
|
|
123
|
+
const a = l[r], d = s.get(a);
|
|
124
|
+
if (d) {
|
|
125
|
+
const p = C(a.nameBytes, d.length, T(d), g[r], a.modTime, a.modDate);
|
|
126
|
+
f.push(p), h += p.length;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const u = new Uint8Array(t.slice(a.centralStart, a.centralEnd)), w = new DataView(u.buffer);
|
|
130
|
+
w.setUint16(8, U(u, 8) & -9, !0), w.setUint32(42, g[r], !0), f.push(u), h += u.length;
|
|
131
|
+
}
|
|
132
|
+
for (let r = 0; r < i.length; r++) {
|
|
133
|
+
const a = i[r], d = C(a.nameBytes, a.data.length, T(a.data), E[r]);
|
|
134
|
+
f.push(d), h += d.length;
|
|
135
|
+
}
|
|
136
|
+
const L = l.length + i.length, _ = new Uint8Array(O), m = new DataView(_.buffer);
|
|
137
|
+
return m.setUint32(0, B, !0), m.setUint16(8, L, !0), m.setUint16(10, L, !0), m.setUint32(12, h - D, !0), m.setUint32(16, D, !0), f.push(_), Z(f);
|
|
138
|
+
}, F = (t) => {
|
|
139
|
+
const e = [], n = [];
|
|
140
|
+
let c = 0;
|
|
141
|
+
for (const i of t) {
|
|
142
|
+
const f = new TextEncoder().encode(i.name), g = x(i.data), h = T(g), E = R(f, g.length, h);
|
|
143
|
+
n.push(C(f, g.length, h, c)), e.push(E, g), c += E.length + g.length;
|
|
144
|
+
}
|
|
145
|
+
const o = c;
|
|
146
|
+
for (const i of n)
|
|
147
|
+
e.push(i), c += i.length;
|
|
148
|
+
const l = new Uint8Array(O), s = new DataView(l.buffer);
|
|
149
|
+
return s.setUint32(0, B, !0), s.setUint16(8, t.length, !0), s.setUint16(10, t.length, !0), s.setUint32(12, c - o, !0), s.setUint32(16, o, !0), e.push(l), Z(e);
|
|
150
|
+
};
|
|
151
|
+
export {
|
|
152
|
+
M as ZIP_DEFLATE,
|
|
153
|
+
G as ZIP_STORED,
|
|
154
|
+
T as crc32,
|
|
155
|
+
F as createZip,
|
|
156
|
+
N as inflateRaw,
|
|
157
|
+
k as readZipEntries,
|
|
158
|
+
y as readZipEntry,
|
|
159
|
+
W as rewriteZip,
|
|
160
|
+
P as zipHasEntry
|
|
161
|
+
};
|
package/dist/src/vnode/h.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VNode, VNodeChildren, VNodeData } from
|
|
1
|
+
import type { VNode, VNodeChildren, VNodeData } from "./vnode.js";
|
|
2
2
|
export declare function addNS(data: VNodeData, children: Array<VNode | string | number> | undefined, sel: string | undefined): void;
|
|
3
3
|
export declare function h(sel: string): VNode;
|
|
4
4
|
export declare function h(sel: string, data: VNodeData | null): VNode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { vnode as v } from "./vnode.js";
|
|
2
|
+
import { array as s, isVnode as g, primitive as r } from "./is.js";
|
|
3
|
+
function a(e, t, o) {
|
|
4
|
+
if (e.ns = "http://www.w3.org/2000/svg", o !== "foreignObject" && t !== void 0) for (let f = 0; f < t.length; ++f) {
|
|
5
|
+
const i = t[f];
|
|
6
|
+
if (typeof i == "string" || typeof i == "number") continue;
|
|
7
|
+
const n = i.data;
|
|
8
|
+
n !== void 0 && a(n, i.children, i.sel);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function h(e, t, o) {
|
|
12
|
+
let f = {}, i, n, d;
|
|
13
|
+
if (o !== void 0 ? (t != null && (f = t), s(o) ? i = o : r(o) ? n = o : o && o.sel && (i = [o])) : t !== void 0 && t != null && (s(t) ? i = t : r(t) ? n = t : g(t) ? i = [t] : f = t), typeof i < "u") for (d = 0; d < i.length; ++d) {
|
|
14
|
+
const l = i[d];
|
|
15
|
+
r(l) && (i[d] = v(void 0, void 0, void 0, l, void 0));
|
|
16
|
+
}
|
|
17
|
+
return e[0] === "s" && e[1] === "v" && e[2] === "g" && (e.length === 3 || e[3] === "." || e[3] === "#") && a(f, i, e), v(e, f, i, n, void 0);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
a as addNS,
|
|
21
|
+
h
|
|
22
|
+
};
|