ranuts 0.4.1-alpha.1 → 0.5.0
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 +178 -26
- 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 -90
- package/README.pt.md +62 -0
- package/README.zh-CN.md +35 -89
- 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 +306 -1
- package/dist/src/_virtual/_rolldown/runtime/index.js +12 -0
- package/dist/src/conversation/engine.d.ts +109 -0
- package/dist/src/conversation/engine.js +101 -0
- package/dist/src/conversation/index.d.ts +12 -0
- package/dist/src/conversation/index.js +4 -0
- package/dist/src/conversation/types.d.ts +99 -0
- package/dist/src/stream/accumulator.d.ts +51 -0
- package/dist/src/stream/accumulator.js +79 -0
- package/dist/src/stream/budget.d.ts +89 -0
- package/dist/src/stream/budget.js +45 -0
- package/dist/src/stream/index.d.ts +25 -0
- package/dist/src/stream/index.js +11 -0
- package/dist/src/stream/sse.d.ts +51 -0
- package/dist/src/stream/sse.js +61 -0
- package/dist/src/stream/types.d.ts +106 -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.d.ts +1 -0
- package/dist/src/utils/canvas.js +103 -0
- package/dist/src/utils/chain.js +76 -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.d.ts +51 -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 +81 -77
- package/dist/src/utils/index.js +306 -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.d.ts +20 -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.d.ts +42 -5
- 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 +1 -1
- package/dist/src/utils/script.js +46 -0
- package/dist/src/utils/scroll.d.ts +93 -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 -6
- package/dist/src/utils/str.js +395 -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 +86 -65
- package/package.json +20 -15
- 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-B_KMM8UX.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-BJIS1fR1.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/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/encodeUrl.test.d.ts +0 -1
- package/dist/test/escapeHtml.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/server.test.d.ts +0 -1
- package/dist/test/status.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-BNwhohXq.js +0 -1
- package/dist/vite.config.d.ts +0 -8
- package/dist/vitest.config.d.ts +0 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
function c(t, n) {
|
|
2
|
+
return document.createElement(t, n);
|
|
3
|
+
}
|
|
4
|
+
function l(t, n, e) {
|
|
5
|
+
return document.createElementNS(t, n, e);
|
|
6
|
+
}
|
|
7
|
+
function m() {
|
|
8
|
+
return u(document.createDocumentFragment());
|
|
9
|
+
}
|
|
10
|
+
function a(t) {
|
|
11
|
+
return document.createTextNode(t);
|
|
12
|
+
}
|
|
13
|
+
function f(t) {
|
|
14
|
+
return document.createComment(t);
|
|
15
|
+
}
|
|
16
|
+
function s(t, n, e) {
|
|
17
|
+
if (r(t)) {
|
|
18
|
+
let i = t;
|
|
19
|
+
for (; i && r(i); ) i = u(i).parent;
|
|
20
|
+
t = i ?? t;
|
|
21
|
+
}
|
|
22
|
+
r(n) && (n = u(n, t)), e && r(e) && (e = u(e).firstChildNode), t.insertBefore(n, e);
|
|
23
|
+
}
|
|
24
|
+
function C(t, n) {
|
|
25
|
+
t.removeChild(n);
|
|
26
|
+
}
|
|
27
|
+
function h(t, n) {
|
|
28
|
+
r(n) && (n = u(n, t)), t.appendChild(n);
|
|
29
|
+
}
|
|
30
|
+
function o(t) {
|
|
31
|
+
if (r(t)) {
|
|
32
|
+
for (; t && r(t); ) t = u(t).parent;
|
|
33
|
+
return t ?? null;
|
|
34
|
+
}
|
|
35
|
+
return t.parentNode;
|
|
36
|
+
}
|
|
37
|
+
function p(t) {
|
|
38
|
+
if (r(t)) {
|
|
39
|
+
const n = u(t), e = o(n);
|
|
40
|
+
if (e && n.lastChildNode) {
|
|
41
|
+
const i = Array.from(e.childNodes);
|
|
42
|
+
return i[i.indexOf(n.lastChildNode) + 1] ?? null;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return t.nextSibling;
|
|
47
|
+
}
|
|
48
|
+
function x(t) {
|
|
49
|
+
return t.tagName;
|
|
50
|
+
}
|
|
51
|
+
function d(t, n) {
|
|
52
|
+
t.textContent = n;
|
|
53
|
+
}
|
|
54
|
+
function g(t) {
|
|
55
|
+
return t.textContent;
|
|
56
|
+
}
|
|
57
|
+
function T(t) {
|
|
58
|
+
return t.nodeType === 1;
|
|
59
|
+
}
|
|
60
|
+
function y(t) {
|
|
61
|
+
return t.nodeType === 3;
|
|
62
|
+
}
|
|
63
|
+
function E(t) {
|
|
64
|
+
return t.nodeType === 8;
|
|
65
|
+
}
|
|
66
|
+
function r(t) {
|
|
67
|
+
return t.nodeType === 11;
|
|
68
|
+
}
|
|
69
|
+
function u(t, n) {
|
|
70
|
+
const e = t;
|
|
71
|
+
return e.parent ??= n ?? null, e.firstChildNode ??= t.firstChild, e.lastChildNode ??= t.lastChild, e;
|
|
72
|
+
}
|
|
73
|
+
var D = {
|
|
74
|
+
createElement: c,
|
|
75
|
+
createElementNS: l,
|
|
76
|
+
createTextNode: a,
|
|
77
|
+
createDocumentFragment: m,
|
|
78
|
+
createComment: f,
|
|
79
|
+
insertBefore: s,
|
|
80
|
+
removeChild: C,
|
|
81
|
+
appendChild: h,
|
|
82
|
+
parentNode: o,
|
|
83
|
+
nextSibling: p,
|
|
84
|
+
tagName: x,
|
|
85
|
+
setTextContent: d,
|
|
86
|
+
getTextContent: g,
|
|
87
|
+
isElement: T,
|
|
88
|
+
isText: y,
|
|
89
|
+
isComment: E,
|
|
90
|
+
isDocumentFragment: r
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
D as htmlDomApi
|
|
94
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { init } from
|
|
2
|
-
import { addNS, h } from
|
|
3
|
-
import { vnode } from
|
|
4
|
-
import { Chain, create } from
|
|
5
|
-
import { htmlDomApi } from
|
|
6
|
-
import { modules } from
|
|
7
|
-
import { attributesModule } from
|
|
8
|
-
import { classModule } from
|
|
9
|
-
import { eventListenersModule } from
|
|
10
|
-
import { propsModule } from
|
|
11
|
-
import { styleModule } from
|
|
12
|
-
import * as is from
|
|
13
|
-
import type { ArrayOrElement, Key, VNode, VNodeChildElement, VNodeChildren, VNodeData, VNodes } from
|
|
14
|
-
import type { Hooks } from
|
|
15
|
-
import type { DOMAPI, Fragment } from
|
|
16
|
-
import type { ModuleHook, Modules } from
|
|
1
|
+
import { init } from "./init.js";
|
|
2
|
+
import { addNS, h } from "./h.js";
|
|
3
|
+
import { vnode } from "./vnode.js";
|
|
4
|
+
import { Chain, create } from "../utils/chain.js";
|
|
5
|
+
import { htmlDomApi } from "./htmlDomApi.js";
|
|
6
|
+
import { modules } from "./modules/index.js";
|
|
7
|
+
import { attributesModule } from "./modules/attributes.js";
|
|
8
|
+
import { classModule } from "./modules/class.js";
|
|
9
|
+
import { eventListenersModule } from "./modules/listeners.js";
|
|
10
|
+
import { propsModule } from "./modules/props.js";
|
|
11
|
+
import { styleModule } from "./modules/style.js";
|
|
12
|
+
import * as is from "./is.js";
|
|
13
|
+
import type { ArrayOrElement, Key, VNode, VNodeChildElement, VNodeChildren, VNodeData, VNodes } from "./vnode.js";
|
|
14
|
+
import type { Hooks } from "./hooks.js";
|
|
15
|
+
import type { DOMAPI, Fragment } from "./htmlDomApi.js";
|
|
16
|
+
import type { ModuleHook, Modules } from "./modules/index.js";
|
|
17
17
|
export { init, h, addNS, vnode, Chain, create, htmlDomApi, modules, attributesModule, classModule, eventListenersModule, propsModule, styleModule, is, };
|
|
18
18
|
export type { VNode, VNodeData, VNodes, VNodeChildren, VNodeChildElement, ArrayOrElement, Key, Hooks, DOMAPI, Fragment, Modules, ModuleHook, };
|
package/dist/src/vnode/index.js
CHANGED
|
@@ -1 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Chain as r, create as m } from "../utils/chain.js";
|
|
2
|
+
import { vnode as i } from "./vnode.js";
|
|
3
|
+
import { htmlDomApi as p } from "./htmlDomApi.js";
|
|
4
|
+
import { is_exports as s } from "./is.js";
|
|
5
|
+
import { attributesModule as l } from "./modules/attributes.js";
|
|
6
|
+
import { classModule as a } from "./modules/class.js";
|
|
7
|
+
import { eventListenersModule as M } from "./modules/listeners.js";
|
|
8
|
+
import { propsModule as c } from "./modules/props.js";
|
|
9
|
+
import { styleModule as x } from "./modules/style.js";
|
|
10
|
+
import { modules as y } from "./modules/index.js";
|
|
11
|
+
import { init as C } from "./init.js";
|
|
12
|
+
import { addNS as L, h as N } from "./h.js";
|
|
13
|
+
export {
|
|
14
|
+
r as Chain,
|
|
15
|
+
L as addNS,
|
|
16
|
+
l as attributesModule,
|
|
17
|
+
a as classModule,
|
|
18
|
+
m as create,
|
|
19
|
+
M as eventListenersModule,
|
|
20
|
+
N as h,
|
|
21
|
+
p as htmlDomApi,
|
|
22
|
+
C as init,
|
|
23
|
+
s as is,
|
|
24
|
+
y as modules,
|
|
25
|
+
c as propsModule,
|
|
26
|
+
x as styleModule,
|
|
27
|
+
i as vnode
|
|
28
|
+
};
|
package/dist/src/vnode/init.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { VNode } from
|
|
1
|
+
import type { VNode } from "./vnode.js";
|
|
2
2
|
export declare function init(): (oldVnode: VNode | Element, vnode: VNode) => VNode;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { vnode as T } from "./vnode.js";
|
|
2
|
+
import { htmlDomApi as $ } from "./htmlDomApi.js";
|
|
3
|
+
import { array as K, primitive as M } from "./is.js";
|
|
4
|
+
import { modules as I } from "./modules/index.js";
|
|
5
|
+
function g(r, c) {
|
|
6
|
+
return r.key === c.key && r.sel === c.sel;
|
|
7
|
+
}
|
|
8
|
+
function H(r) {
|
|
9
|
+
return r.sel !== void 0;
|
|
10
|
+
}
|
|
11
|
+
function L(r, c, k) {
|
|
12
|
+
const x = {};
|
|
13
|
+
for (let d = c; d <= k; ++d) {
|
|
14
|
+
const p = r[d]?.key;
|
|
15
|
+
p !== void 0 && (x[p] = d);
|
|
16
|
+
}
|
|
17
|
+
return x;
|
|
18
|
+
}
|
|
19
|
+
var R = T("", {}, [], void 0, void 0);
|
|
20
|
+
function G() {
|
|
21
|
+
const r = $, c = {
|
|
22
|
+
create: [],
|
|
23
|
+
update: [],
|
|
24
|
+
destroy: []
|
|
25
|
+
};
|
|
26
|
+
for (const e of Object.keys(c)) {
|
|
27
|
+
c[e] = [];
|
|
28
|
+
for (const t of Object.keys(I)) {
|
|
29
|
+
const i = I[t][e];
|
|
30
|
+
i !== void 0 && c[e].push(i);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function k(e) {
|
|
34
|
+
const t = e.id ? "#" + e.id : "", i = e.className ? "." + e.className.split(" ").join(".") : "";
|
|
35
|
+
return T(r.tagName(e).toLowerCase() + t + i, {}, [], void 0, e);
|
|
36
|
+
}
|
|
37
|
+
function x(e) {
|
|
38
|
+
return e === void 0;
|
|
39
|
+
}
|
|
40
|
+
function d(e) {
|
|
41
|
+
return e !== void 0;
|
|
42
|
+
}
|
|
43
|
+
function p(e) {
|
|
44
|
+
let t;
|
|
45
|
+
const i = e.children, l = e.sel;
|
|
46
|
+
if (l === "!")
|
|
47
|
+
x(e.text) && (e.text = ""), e.elm = r.createComment(`${e.text}`);
|
|
48
|
+
else if (l !== void 0) {
|
|
49
|
+
const f = l.indexOf("#"), n = l.indexOf(".", f), u = f > 0 ? f : l.length, o = n > 0 ? n : l.length, m = f !== -1 || n !== -1 ? l.slice(0, Math.min(u, o)) : l, s = e.elm = r.createElement(m);
|
|
50
|
+
for (u < o && s.setAttribute("id", l.slice(u + 1, o)), n > 0 && s.setAttribute("class", l.slice(o + 1).replace(/\./g, " ")), t = 0; t < c.create.length; ++t) c.create[t](R, e);
|
|
51
|
+
if (K(i)) for (t = 0; t < i.length; ++t) {
|
|
52
|
+
const a = i[t];
|
|
53
|
+
a != null && r.appendChild(s, p(a));
|
|
54
|
+
}
|
|
55
|
+
else M(e.text) && r.appendChild(s, r.createTextNode(`${e.text}`));
|
|
56
|
+
} else e.elm = r.createTextNode(`${e.text}`);
|
|
57
|
+
return e.elm;
|
|
58
|
+
}
|
|
59
|
+
function j(e, t, i, l, f) {
|
|
60
|
+
for (; l <= f; ++l) {
|
|
61
|
+
const n = i[l];
|
|
62
|
+
n != null && r.insertBefore(e, p(n), t);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function B(e) {
|
|
66
|
+
if (e.data !== void 0) {
|
|
67
|
+
for (let t = 0; t < c.destroy.length; ++t) c.destroy[t](e);
|
|
68
|
+
if (e.children !== void 0) for (let t = 0; t < e.children.length; ++t) {
|
|
69
|
+
const i = e.children[t];
|
|
70
|
+
i != null && typeof i != "string" && typeof i != "number" && B(i);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function A(e) {
|
|
75
|
+
return function() {
|
|
76
|
+
const i = r.parentNode(e);
|
|
77
|
+
r.removeChild(i, e);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function O(e, t, i, l) {
|
|
81
|
+
for (; i <= l; ++i) {
|
|
82
|
+
let f;
|
|
83
|
+
const n = t[i];
|
|
84
|
+
n != null && (d(n.sel) ? (B(n), f = A(n.elm), f()) : r.removeChild(e, n.elm));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function D(e, t, i) {
|
|
88
|
+
let l = 0, f = 0, n = t.length - 1, u = i.length - 1, o = t[0], m = t[n], s = i[0], a = i[u], N, h, b, S;
|
|
89
|
+
for (; l <= n && f <= u; ) o == null ? o = t[++l] : m == null ? m = t[--n] : s == null ? s = i[++f] : a == null ? a = i[--u] : g(o, s) ? (y(o, s), o = t[++l], s = i[++f]) : g(m, a) ? (y(m, a), m = t[--n], a = i[--u]) : g(o, a) ? (y(o, a), r.insertBefore(e, o.elm, r.nextSibling(m.elm)), o = t[++l], a = i[--u]) : g(m, s) ? (y(m, s), r.insertBefore(e, m.elm, o.elm), m = t[--n], s = i[++f]) : (N === void 0 && (N = L(t, l, n)), h = N[s.key], x(h) ? r.insertBefore(e, p(s), o.elm) : (b = t[h], b.sel !== s.sel ? r.insertBefore(e, p(s), o.elm) : (y(b, s), t[h] = void 0, r.insertBefore(e, b.elm, o.elm))), s = i[++f]);
|
|
90
|
+
(l <= n || f <= u) && (l > n ? (S = i[u + 1] == null ? null : i[u + 1].elm, j(e, S, i, f, u)) : O(e, t, l, n));
|
|
91
|
+
}
|
|
92
|
+
function y(e, t) {
|
|
93
|
+
if (t.data !== void 0) for (let n = 0; n < c.update.length; ++n) c.update[n](e, t);
|
|
94
|
+
const i = t.elm = e.elm, l = e.children, f = t.children;
|
|
95
|
+
e !== t && x(t.text) && d(l) && d(f) && l !== f && D(i, l, f);
|
|
96
|
+
}
|
|
97
|
+
return function(t, i) {
|
|
98
|
+
let l, f;
|
|
99
|
+
return H(t) || (t = k(t)), g(t, i) ? y(t, i) : (l = t.elm, f = r.parentNode(l), p(i), f != null && (r.insertBefore(f, i.elm, r.nextSibling(l)), O(f, [t], 0, 0))), i;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
G as init
|
|
104
|
+
};
|
package/dist/src/vnode/is.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @description: Type guards — array / string / primitive / VNode
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type { VNode } from
|
|
5
|
+
import type { VNode } from "./vnode.js";
|
|
6
6
|
export declare const array: (arg: any) => arg is any[];
|
|
7
7
|
export declare const isStr: (str: unknown) => str is string;
|
|
8
8
|
export declare function primitive(s: unknown): s is string | number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __exportAll as t } from "../_virtual/_rolldown/runtime/index.js";
|
|
2
|
+
var p = /* @__PURE__ */ t({
|
|
3
|
+
array: () => i,
|
|
4
|
+
isStr: () => e,
|
|
5
|
+
isVnode: () => o,
|
|
6
|
+
primitive: () => n
|
|
7
|
+
}), i = Array.isArray, e = (r) => typeof r == "string";
|
|
8
|
+
function n(r) {
|
|
9
|
+
return typeof r == "string" || typeof r == "number";
|
|
10
|
+
}
|
|
11
|
+
function o(r) {
|
|
12
|
+
return !!r?.sel;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
i as array,
|
|
16
|
+
e as isStr,
|
|
17
|
+
o as isVnode,
|
|
18
|
+
p as is_exports,
|
|
19
|
+
n as primitive
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var o = "http://www.w3.org/1999/xlink", A = "http://www.w3.org/XML/1998/namespace", u = 58, c = 120;
|
|
2
|
+
function f(l, s) {
|
|
3
|
+
let t;
|
|
4
|
+
const e = s.elm;
|
|
5
|
+
let i = l.data && l.data.attrs, r = s.data && s.data.attrs;
|
|
6
|
+
if (!(!i && !r) && i !== r) {
|
|
7
|
+
i = i || {}, r = r || {};
|
|
8
|
+
for (t in r) {
|
|
9
|
+
const a = r[t];
|
|
10
|
+
i[t] !== a && (a === !0 ? e.setAttribute(t, "") : a === !1 ? e.removeAttribute(t) : t.charCodeAt(0) !== c ? e.setAttribute(t, a) : t.charCodeAt(3) === u ? e.setAttributeNS(A, t, a) : t.charCodeAt(5) === u ? e.setAttributeNS(o, t, a) : e.setAttribute(t, `${a}`));
|
|
11
|
+
}
|
|
12
|
+
for (t in i) t in r || e.removeAttribute(t);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var n = {
|
|
16
|
+
create: f,
|
|
17
|
+
update: f
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
n as attributesModule
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function i(r, s) {
|
|
2
|
+
let l, a;
|
|
3
|
+
const c = s.elm;
|
|
4
|
+
let t = r.data && r.data.class, e = s.data && s.data.class;
|
|
5
|
+
if (!(!t && !e) && t !== e) {
|
|
6
|
+
t = t || {}, e = e || {};
|
|
7
|
+
for (a in t) t[a] && !Object.prototype.hasOwnProperty.call(e, a) && c.classList.remove(a);
|
|
8
|
+
for (a in e)
|
|
9
|
+
l = e[a], l !== t[a] && c.classList[l ? "add" : "remove"](a);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
var o = {
|
|
13
|
+
create: i,
|
|
14
|
+
update: i
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
o as classModule
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { attributesModule as o } from "./attributes.js";
|
|
2
|
+
import { classModule as r } from "./class.js";
|
|
3
|
+
import { eventListenersModule as e } from "./listeners.js";
|
|
4
|
+
import { propsModule as t } from "./props.js";
|
|
5
|
+
import { styleModule as m } from "./style.js";
|
|
6
|
+
var d = {
|
|
7
|
+
attributesModule: o,
|
|
8
|
+
classModule: r,
|
|
9
|
+
eventListenersModule: e,
|
|
10
|
+
propsModule: t,
|
|
11
|
+
styleModule: m
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
d as modules
|
|
15
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VNode } from
|
|
1
|
+
import type { VNode } from "../vnode.js";
|
|
2
2
|
type Listener<T> = (this: VNode, ev: T, vnode: VNode) => void;
|
|
3
3
|
export type On = {
|
|
4
4
|
[N in keyof HTMLElementEventMap]?: Listener<HTMLElementEventMap[N]> | Array<Listener<HTMLElementEventMap[N]>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var u = (e) => typeof e == "function";
|
|
2
|
+
function c(e, t, n) {
|
|
3
|
+
if (u(e)) e.call(t, n, t);
|
|
4
|
+
else if (typeof e == "object") for (let i = 0; i < e.length; i++) c(e[i], t, n);
|
|
5
|
+
}
|
|
6
|
+
function m(e, t) {
|
|
7
|
+
const n = e.type, i = t.data && t.data.on;
|
|
8
|
+
i && i[n] && c(i[n], t, e);
|
|
9
|
+
}
|
|
10
|
+
function L() {
|
|
11
|
+
return function e(t) {
|
|
12
|
+
m(t, e.vnode);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function f(e, t) {
|
|
16
|
+
const n = e?.data?.on, i = e?.listener, o = e.elm, r = t?.data?.on, a = t && t.elm;
|
|
17
|
+
let s;
|
|
18
|
+
if (n !== r) {
|
|
19
|
+
if (n && i)
|
|
20
|
+
if (r) for (s in n) r[s] || o.removeEventListener(s, i, !1);
|
|
21
|
+
else for (s in n) o.removeEventListener(s, i, !1);
|
|
22
|
+
if (r) {
|
|
23
|
+
const l = t.listener = e.listener || L();
|
|
24
|
+
if (n) for (s in r) n[s] || a.addEventListener(s, l, !1);
|
|
25
|
+
else for (s in r) a.addEventListener(s, l, !1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
var E = {
|
|
30
|
+
create: f,
|
|
31
|
+
update: f,
|
|
32
|
+
destroy: f
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
E as eventListenersModule
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function d(o, p) {
|
|
2
|
+
let t, a, l;
|
|
3
|
+
const u = p.elm;
|
|
4
|
+
let e = o.data ? o.data.props : void 0, r = p.data ? p.data.props : void 0;
|
|
5
|
+
if (!(!e && !r) && e !== r) {
|
|
6
|
+
e = e || {}, r = r || {};
|
|
7
|
+
for (t in r)
|
|
8
|
+
a = r[t], l = e[t], l !== a && (t !== "value" || u[t] !== a) && (u[t] = a);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
var i = {
|
|
12
|
+
create: d,
|
|
13
|
+
update: d
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
i as propsModule
|
|
17
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var f = !1;
|
|
2
|
+
function p(n, s) {
|
|
3
|
+
let t, e;
|
|
4
|
+
const l = s.elm;
|
|
5
|
+
let r = n.data.style, o = s.data.style;
|
|
6
|
+
if (!(!r && !o) && r !== o) {
|
|
7
|
+
r = r || {}, o = o || {};
|
|
8
|
+
for (e in r) o[e] || (e[0] === "-" && e[1] === "-" ? l.style.removeProperty(e) : l.style[e] = "");
|
|
9
|
+
for (e in o)
|
|
10
|
+
t = o[e], t !== r[e] && (e[0] === "-" && e[1] === "-" ? l.style.setProperty(e, t) : l.style[e] = t);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function u() {
|
|
14
|
+
f = !1;
|
|
15
|
+
}
|
|
16
|
+
function m(n) {
|
|
17
|
+
let s, t;
|
|
18
|
+
const e = n.elm, l = n.data.style;
|
|
19
|
+
if (!(!l || !(s = l.destroy)))
|
|
20
|
+
for (t in s) e.style[t] = s[t];
|
|
21
|
+
}
|
|
22
|
+
function d(n, s) {
|
|
23
|
+
const t = n.data.style;
|
|
24
|
+
if (!t || !t.remove) {
|
|
25
|
+
s();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
f || (f = !0);
|
|
29
|
+
let e;
|
|
30
|
+
const l = n.elm;
|
|
31
|
+
let r = 0;
|
|
32
|
+
const o = t.remove;
|
|
33
|
+
let i = 0;
|
|
34
|
+
const y = [];
|
|
35
|
+
for (e in o)
|
|
36
|
+
y.push(e), l.style[e] = o[e];
|
|
37
|
+
const a = getComputedStyle(l)["transition-property"].split(", ");
|
|
38
|
+
for (; r < a.length; ++r) y.indexOf(a[r]) !== -1 && i++;
|
|
39
|
+
l.addEventListener("transitionend", function(c) {
|
|
40
|
+
c.target === l && --i, i === 0 && s();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
var v = {
|
|
44
|
+
pre: u,
|
|
45
|
+
create: p,
|
|
46
|
+
update: p,
|
|
47
|
+
destroy: m,
|
|
48
|
+
remove: d
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
v as styleModule
|
|
52
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { On } from
|
|
2
|
-
import type { Attrs } from
|
|
3
|
-
import type { Classes } from
|
|
4
|
-
import type { Props } from
|
|
5
|
-
import type { VNodeStyle } from
|
|
6
|
-
import type { Hooks } from
|
|
1
|
+
import type { On } from "./modules/listeners.js";
|
|
2
|
+
import type { Attrs } from "./modules/attributes.js";
|
|
3
|
+
import type { Classes } from "./modules/class.js";
|
|
4
|
+
import type { Props } from "./modules/props.js";
|
|
5
|
+
import type { VNodeStyle } from "./modules/style.js";
|
|
6
|
+
import type { Hooks } from "./hooks.js";
|
|
7
7
|
export type VNodes = VNode[];
|
|
8
8
|
export type VNodeChildElement = VNode | string | number;
|
|
9
9
|
export type ArrayOrElement<T> = T | T[];
|