ranuts 0.4.1-alpha.2 → 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 +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 +306 -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/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 +80 -80
- 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.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 +1 -1
- package/dist/src/utils/script.js +46 -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 +8 -64
- package/package.json +12 -16
- 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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { DEG_TO_RAD as m } from "./visual/math/enums.js";
|
|
2
|
+
var p = (t) => m * t, T = (t, e) => [+(Math.cos(t) * e).toFixed(8), +(Math.sin(t) * e).toFixed(8)], A = (t, e) => {
|
|
3
|
+
const n = -t / e;
|
|
4
|
+
return [n, -n * t + e];
|
|
5
|
+
}, I = (t, e, n, o, l) => {
|
|
6
|
+
t.beginPath();
|
|
7
|
+
const a = p(90 / Math.PI / e * l), d = n + a, s = o - a;
|
|
8
|
+
t.arc(0, 0, e, d, s, !1), t.lineTo(...T((n + o) / 2, l / 2 / Math.abs(Math.sin((n - o) / 2)))), t.closePath();
|
|
9
|
+
}, b = (t, ...[e, n, o, l, a]) => {
|
|
10
|
+
const d = Math.min(o, l), s = Math.PI;
|
|
11
|
+
a > d / 2 && (a = d / 2), t.beginPath(), t.moveTo(e + a, n), t.lineTo(e + a, n), t.lineTo(e + o - a, n), t.arc(e + o - a, n + a, a, -s / 2, 0), t.lineTo(e + o, n + l - a), t.arc(e + o - a, n + l - a, a, 0, s / 2), t.lineTo(e + a, n + l), t.arc(e + a, n + l - a, a, s / 2, s), t.lineTo(e, n + a), t.arc(e + a, n + a, a, s, -s / 2), t.closePath();
|
|
12
|
+
}, v = "linear-gradient(", P = (t) => {
|
|
13
|
+
const e = t.indexOf(v), n = t.lastIndexOf(")");
|
|
14
|
+
if (e === -1 || n <= e + 16) throw new TypeError("getLinearGradient: background must be a linear-gradient(...) value");
|
|
15
|
+
return t.slice(e + 16, n);
|
|
16
|
+
}, G = (t, e, n, o, l, a) => {
|
|
17
|
+
const d = P(a).split(",").map((i) => i.trim());
|
|
18
|
+
let s = d.shift(), r = [
|
|
19
|
+
0,
|
|
20
|
+
0,
|
|
21
|
+
0,
|
|
22
|
+
0
|
|
23
|
+
];
|
|
24
|
+
if (s.includes("deg")) {
|
|
25
|
+
const i = Number(s.slice(0, -3)) % 360;
|
|
26
|
+
s = `${i}`;
|
|
27
|
+
const f = (c) => Math.tan(c / 180 * Math.PI);
|
|
28
|
+
i >= 0 && i < 45 ? r = [
|
|
29
|
+
e,
|
|
30
|
+
n + l,
|
|
31
|
+
e + o,
|
|
32
|
+
n + l - o * f(i - 0)
|
|
33
|
+
] : i >= 45 && i < 90 ? r = [
|
|
34
|
+
e,
|
|
35
|
+
n + l,
|
|
36
|
+
e + o - l * f(i - 45),
|
|
37
|
+
n
|
|
38
|
+
] : i >= 90 && i < 135 ? r = [
|
|
39
|
+
e + o,
|
|
40
|
+
n + l,
|
|
41
|
+
e + o - l * f(i - 90),
|
|
42
|
+
n
|
|
43
|
+
] : i >= 135 && i < 180 ? r = [
|
|
44
|
+
e + o,
|
|
45
|
+
n + l,
|
|
46
|
+
e,
|
|
47
|
+
n + o * f(i - 135)
|
|
48
|
+
] : i >= 180 && i < 225 ? r = [
|
|
49
|
+
e + o,
|
|
50
|
+
n,
|
|
51
|
+
e,
|
|
52
|
+
n + o * f(i - 180)
|
|
53
|
+
] : i >= 225 && i < 270 ? r = [
|
|
54
|
+
e + o,
|
|
55
|
+
n,
|
|
56
|
+
e + l * f(i - 225),
|
|
57
|
+
n + l
|
|
58
|
+
] : i >= 270 && i < 315 ? r = [
|
|
59
|
+
e,
|
|
60
|
+
n,
|
|
61
|
+
e + l * f(i - 270),
|
|
62
|
+
n + l
|
|
63
|
+
] : i >= 315 && i < 360 && (r = [
|
|
64
|
+
e,
|
|
65
|
+
n,
|
|
66
|
+
e + o,
|
|
67
|
+
n + l - o * f(i - 315)
|
|
68
|
+
]);
|
|
69
|
+
} else s.includes("top") ? r = [
|
|
70
|
+
e,
|
|
71
|
+
n + l,
|
|
72
|
+
e,
|
|
73
|
+
n
|
|
74
|
+
] : s.includes("bottom") ? r = [
|
|
75
|
+
e,
|
|
76
|
+
n,
|
|
77
|
+
e,
|
|
78
|
+
n + l
|
|
79
|
+
] : s.includes("left") ? r = [
|
|
80
|
+
e + o,
|
|
81
|
+
n,
|
|
82
|
+
e,
|
|
83
|
+
n
|
|
84
|
+
] : s.includes("right") && (r = [
|
|
85
|
+
e,
|
|
86
|
+
n,
|
|
87
|
+
e + o,
|
|
88
|
+
n
|
|
89
|
+
]);
|
|
90
|
+
const u = t.createLinearGradient(...r.map((i) => i >> 0));
|
|
91
|
+
return d.reduce((i, f, c) => {
|
|
92
|
+
const g = f.split(" ");
|
|
93
|
+
return g.length === 1 ? i.addColorStop(c, g[0]) : g.length === 2 && i.addColorStop(Number(g[1]), g[0]), i;
|
|
94
|
+
}, u);
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
I as fanShapedByArc,
|
|
98
|
+
p as getAngle,
|
|
99
|
+
T as getArcPointerByDeg,
|
|
100
|
+
G as getLinearGradient,
|
|
101
|
+
A as getTangentByPointer,
|
|
102
|
+
b as roundRectByArc
|
|
103
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var a = "http://www.w3.org/2000/svg", h = [
|
|
2
|
+
"svg",
|
|
3
|
+
"path",
|
|
4
|
+
"g",
|
|
5
|
+
"circle",
|
|
6
|
+
"rect",
|
|
7
|
+
"line",
|
|
8
|
+
"polyline",
|
|
9
|
+
"polygon",
|
|
10
|
+
"ellipse",
|
|
11
|
+
"text",
|
|
12
|
+
"tspan",
|
|
13
|
+
"textPath",
|
|
14
|
+
"defs",
|
|
15
|
+
"marker",
|
|
16
|
+
"radialGradient",
|
|
17
|
+
"stop",
|
|
18
|
+
"linearGradient",
|
|
19
|
+
"clipPath",
|
|
20
|
+
"mask",
|
|
21
|
+
"pattern",
|
|
22
|
+
"image",
|
|
23
|
+
"use",
|
|
24
|
+
"symbol",
|
|
25
|
+
"foreignObject",
|
|
26
|
+
"feGaussianBlur",
|
|
27
|
+
"feColorMatrix"
|
|
28
|
+
], o = class i {
|
|
29
|
+
listener;
|
|
30
|
+
element;
|
|
31
|
+
constructor(e, t) {
|
|
32
|
+
this.element = this.create(e, t), this.listener = /* @__PURE__ */ new Map();
|
|
33
|
+
}
|
|
34
|
+
create = (e, t) => h.includes(e) ? document.createElementNS(a, e, t) : document.createElement(e, t);
|
|
35
|
+
setAttribute = (e, t) => (this.element.setAttribute(e, t), this);
|
|
36
|
+
removeAttribute = (e) => (this.element.removeAttribute(e), this);
|
|
37
|
+
append = (e) => (this.element.appendChild(e), this);
|
|
38
|
+
remove = (e) => (this.element.removeChild(e), this);
|
|
39
|
+
setTextContent = (e) => (this.element.textContent = e, this);
|
|
40
|
+
setStyle = (e, t) => (this.element.style.setProperty(e, t), this);
|
|
41
|
+
addElementByType = (e, t) => {
|
|
42
|
+
e instanceof i && t.appendChild(e.element), e instanceof HTMLElement && t.appendChild(e);
|
|
43
|
+
};
|
|
44
|
+
addChild = (e) => {
|
|
45
|
+
if (Array.isArray(e)) {
|
|
46
|
+
const t = document.createDocumentFragment();
|
|
47
|
+
e.forEach((r) => {
|
|
48
|
+
this.addElementByType(r, t);
|
|
49
|
+
}), this.element.appendChild(t);
|
|
50
|
+
} else this.addElementByType(e, this.element);
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
listen = (e, t, r) => {
|
|
54
|
+
let n = this.listener.get(e);
|
|
55
|
+
n || (n = /* @__PURE__ */ new Map(), this.listener.set(e, n));
|
|
56
|
+
const s = n.get(t.name);
|
|
57
|
+
return s === t && console.warn(`${s.name} listener has been added to ${e} event, please remove it first.`), this.element.addEventListener(e, t, r), n.set(t.name, t), this;
|
|
58
|
+
};
|
|
59
|
+
clearListener = (e, t, r) => {
|
|
60
|
+
this.element.removeEventListener(e, t, r);
|
|
61
|
+
const n = this.listener.get(e);
|
|
62
|
+
return n ? n.delete(t.name) : console.warn(`No ${e} event listener has been added.`), this;
|
|
63
|
+
};
|
|
64
|
+
clearAllListener = () => {
|
|
65
|
+
for (const [e, t] of this.listener) {
|
|
66
|
+
for (const [r, n] of t)
|
|
67
|
+
this.element.removeEventListener(e, n), t.delete(r);
|
|
68
|
+
this.listener.delete(e);
|
|
69
|
+
}
|
|
70
|
+
return this;
|
|
71
|
+
};
|
|
72
|
+
}, d = (l, e) => new o(l, e);
|
|
73
|
+
export {
|
|
74
|
+
o as Chain,
|
|
75
|
+
d as create
|
|
76
|
+
};
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
var u = Math.round, p = class {
|
|
2
|
+
r;
|
|
3
|
+
g;
|
|
4
|
+
b;
|
|
5
|
+
constructor(t) {
|
|
6
|
+
this.r = t[0], this.g = t[1], this.b = t[2];
|
|
7
|
+
}
|
|
8
|
+
toString() {
|
|
9
|
+
return `rgb(${this.r},${this.g},${this.b})`;
|
|
10
|
+
}
|
|
11
|
+
}, R = class extends p {
|
|
12
|
+
a;
|
|
13
|
+
constructor(t) {
|
|
14
|
+
super(t), this.a = t[3];
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
return `rgba(${this.r},${this.g},${this.b},${this.a})`;
|
|
18
|
+
}
|
|
19
|
+
}, H = class {
|
|
20
|
+
h;
|
|
21
|
+
s;
|
|
22
|
+
l;
|
|
23
|
+
constructor(t) {
|
|
24
|
+
this.h = t[0], this.s = t[1], this.l = t[2];
|
|
25
|
+
}
|
|
26
|
+
toString() {
|
|
27
|
+
return `hsl(${this.h},${this.s}%,${this.l}%)`;
|
|
28
|
+
}
|
|
29
|
+
}, w = class extends H {
|
|
30
|
+
a;
|
|
31
|
+
constructor(t) {
|
|
32
|
+
super(t), this.a = t[3];
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
return `hsla(${this.h},${this.s}%,${this.l}%,${this.a})`;
|
|
36
|
+
}
|
|
37
|
+
}, c = class {
|
|
38
|
+
r;
|
|
39
|
+
g;
|
|
40
|
+
b;
|
|
41
|
+
a;
|
|
42
|
+
rgb;
|
|
43
|
+
rgba;
|
|
44
|
+
hex;
|
|
45
|
+
hsl;
|
|
46
|
+
hsla;
|
|
47
|
+
h;
|
|
48
|
+
s;
|
|
49
|
+
l;
|
|
50
|
+
constructor(t, s = 0, r = 0, i = 1) {
|
|
51
|
+
if (typeof t == "string") {
|
|
52
|
+
let e = t;
|
|
53
|
+
e.charAt(0) !== "#" && (e = "#" + e), e.length < 7 && (e = "#" + e[1] + e[1] + e[2] + e[2] + e[3] + e[3]);
|
|
54
|
+
const a = $(e);
|
|
55
|
+
a && ([t, s, r] = a);
|
|
56
|
+
} else t instanceof Array && (i = t[3] || i, r = t[2], s = t[1], t = t[0]);
|
|
57
|
+
this.r = Number(t), this.g = Number(s), this.b = Number(r), this.a = i, this.rgb = new p([
|
|
58
|
+
this.r,
|
|
59
|
+
this.g,
|
|
60
|
+
this.b
|
|
61
|
+
]), this.rgba = new R([
|
|
62
|
+
this.r,
|
|
63
|
+
this.g,
|
|
64
|
+
this.b,
|
|
65
|
+
this.a
|
|
66
|
+
]), this.hex = v(this.r, this.g, this.b), this.hsl = new H(x(this.r, this.g, this.b)), this.h = this.hsl.h, this.s = this.hsl.s, this.l = this.hsl.l, this.hsla = new w([
|
|
67
|
+
this.h,
|
|
68
|
+
this.s,
|
|
69
|
+
this.l,
|
|
70
|
+
this.a
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
setHue(t) {
|
|
74
|
+
this.h = t, this.hsl.h = t, this.hsla.h = t, this.updateFromHsl();
|
|
75
|
+
}
|
|
76
|
+
setSat(t) {
|
|
77
|
+
this.s = t, this.hsl.s = t, this.hsla.s = t, this.updateFromHsl();
|
|
78
|
+
}
|
|
79
|
+
setLum(t) {
|
|
80
|
+
this.l = t, this.hsl.l = t, this.hsla.l = t, this.updateFromHsl();
|
|
81
|
+
}
|
|
82
|
+
setAlpha(t) {
|
|
83
|
+
this.a = t, this.hsla.a = t, this.rgba.a = t;
|
|
84
|
+
}
|
|
85
|
+
updateFromHsl() {
|
|
86
|
+
this.rgb = new p(m(this.h, this.s, this.l)), this.r = this.rgb.r, this.g = this.rgb.g, this.b = this.rgb.b, this.rgba.r = this.rgb.r, this.rgba.g = this.rgb.g, this.rgba.b = this.rgb.b, this.hex = v([
|
|
87
|
+
this.r,
|
|
88
|
+
this.g,
|
|
89
|
+
this.b
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
}, C = function() {
|
|
93
|
+
const t = "#" + Math.random().toString(16).slice(2, 8);
|
|
94
|
+
return new c(t);
|
|
95
|
+
}, $ = function(t) {
|
|
96
|
+
const s = t[0] === "#" ? t.slice(1) : t;
|
|
97
|
+
if (/^[a-f\d]{3}$/i.test(s)) return [
|
|
98
|
+
parseInt(s[0] + s[0], 16),
|
|
99
|
+
parseInt(s[1] + s[1], 16),
|
|
100
|
+
parseInt(s[2] + s[2], 16)
|
|
101
|
+
];
|
|
102
|
+
const r = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);
|
|
103
|
+
return r ? [
|
|
104
|
+
parseInt(r[1], 16),
|
|
105
|
+
parseInt(r[2], 16),
|
|
106
|
+
parseInt(r[3], 16)
|
|
107
|
+
] : null;
|
|
108
|
+
}, f = function(t) {
|
|
109
|
+
const s = t.toString(16);
|
|
110
|
+
return s.length === 1 ? "0" + s : s;
|
|
111
|
+
}, v = function(t, s = 0, r = 0) {
|
|
112
|
+
return t instanceof Array && (r = t[2], s = t[1], t = t[0]), "#" + f(t) + f(s) + f(r);
|
|
113
|
+
}, x = function(t, s = 0, r = 0) {
|
|
114
|
+
t instanceof Array && (r = t[2], s = t[1], t = t[0]);
|
|
115
|
+
let i, e, a, n = 0;
|
|
116
|
+
t /= 255, s /= 255, r /= 255;
|
|
117
|
+
const h = Math.max(t, s, r), o = Math.min(t, s, r);
|
|
118
|
+
if (e = (h + o) / 2, h === o) n = i = 0;
|
|
119
|
+
else {
|
|
120
|
+
switch (a = h - o, i = e > 0.5 ? a / (2 - h - o) : a / (h + o), h) {
|
|
121
|
+
case t:
|
|
122
|
+
n = (s - r) / a + (s < r ? 6 : 0);
|
|
123
|
+
break;
|
|
124
|
+
case s:
|
|
125
|
+
n = (r - t) / a + 2;
|
|
126
|
+
break;
|
|
127
|
+
case r:
|
|
128
|
+
n = (t - s) / a + 4;
|
|
129
|
+
}
|
|
130
|
+
n /= 6;
|
|
131
|
+
}
|
|
132
|
+
return n = u(n * 360), i = u(i * 100), e = u(e * 100), [
|
|
133
|
+
n,
|
|
134
|
+
i,
|
|
135
|
+
e
|
|
136
|
+
];
|
|
137
|
+
}, g = function(t, s, r) {
|
|
138
|
+
return r < 0 && (r += 1), r > 1 && (r -= 1), r < 1 / 6 ? t + (s - t) * 6 * r : r < 1 / 2 ? s : r < 2 / 3 ? t + (s - t) * (2 / 3 - r) * 6 : t;
|
|
139
|
+
}, m = function(t, s, r) {
|
|
140
|
+
t instanceof Array && (r = t[2], s = t[1], t = t[0]), t = Number(t) / 360, s = Number(s) / 100, r = Number(r) / 100;
|
|
141
|
+
let i, e, a, n, h;
|
|
142
|
+
return s === 0 ? i = e = a = r : (n = r < 0.5 ? r * (1 + s) : r + s - r * s, h = 2 * r - n, i = g(h, n, t + 1 / 3), e = g(h, n, t), a = g(h, n, t - 1 / 3)), [
|
|
143
|
+
u(i * 255),
|
|
144
|
+
u(e * 255),
|
|
145
|
+
u(a * 255)
|
|
146
|
+
];
|
|
147
|
+
}, d = function(t, s, r) {
|
|
148
|
+
let i = 0, e, a;
|
|
149
|
+
t = t / 255, s = s / 255, r = r / 255;
|
|
150
|
+
const n = Math.max(t, s, r), h = Math.min(t, s, r);
|
|
151
|
+
a = n;
|
|
152
|
+
const o = n - h;
|
|
153
|
+
if (e = n === 0 ? 0 : o / n, n === h) i = 0;
|
|
154
|
+
else {
|
|
155
|
+
switch (n) {
|
|
156
|
+
case t:
|
|
157
|
+
i = (s - r) / o + (s < r ? 6 : 0);
|
|
158
|
+
break;
|
|
159
|
+
case s:
|
|
160
|
+
i = (r - t) / o + 2;
|
|
161
|
+
break;
|
|
162
|
+
case r:
|
|
163
|
+
i = (t - s) / o + 4;
|
|
164
|
+
}
|
|
165
|
+
i /= 6;
|
|
166
|
+
}
|
|
167
|
+
return i = u(i * 360), e = u(e * 100), a = u(a * 100), [
|
|
168
|
+
i,
|
|
169
|
+
e,
|
|
170
|
+
a
|
|
171
|
+
];
|
|
172
|
+
}, M = function(t, s, r) {
|
|
173
|
+
let i = 0, e = 0, a = 0;
|
|
174
|
+
if (r === 0) return [
|
|
175
|
+
0,
|
|
176
|
+
0,
|
|
177
|
+
0
|
|
178
|
+
];
|
|
179
|
+
s = s / 100, r = r / 100, t = t / 60;
|
|
180
|
+
const n = Math.floor(t), h = t - n, o = r * (1 - s), l = r * (1 - s * h), b = r * (1 - s * (1 - h));
|
|
181
|
+
return n === 0 ? (i = r, e = b, a = o) : n === 1 ? (i = l, e = r, a = o) : n === 2 ? (i = o, e = r, a = b) : n === 3 ? (i = o, e = l, a = r) : n === 4 ? (i = b, e = o, a = r) : n === 5 && (i = r, e = o, a = l), i = u(i * 255), e = u(e * 255), a = u(a * 255), [
|
|
182
|
+
i,
|
|
183
|
+
e,
|
|
184
|
+
a
|
|
185
|
+
];
|
|
186
|
+
}, F = M, S = function(t, s, r) {
|
|
187
|
+
return x(M(t, s, r));
|
|
188
|
+
}, I = S, E = d, y = function(t) {
|
|
189
|
+
const s = $(t);
|
|
190
|
+
return s ? d(s[0], s[1], s[2]) : null;
|
|
191
|
+
}, O = y, N = function(t, s, r) {
|
|
192
|
+
const [i, e, a] = m(t, s, r);
|
|
193
|
+
return d(i, e, a);
|
|
194
|
+
}, G = N, k = function(t) {
|
|
195
|
+
return u(parseInt(t, 16) / 255 * 100);
|
|
196
|
+
}, P = function(t, s, r, i) {
|
|
197
|
+
return "rgba(" + [
|
|
198
|
+
t,
|
|
199
|
+
s,
|
|
200
|
+
r,
|
|
201
|
+
i / 100
|
|
202
|
+
].join(",") + ")";
|
|
203
|
+
}, A = function(t, s, r, i) {
|
|
204
|
+
const e = i / 100;
|
|
205
|
+
return [
|
|
206
|
+
Math.trunc((1 - e) * 255 + e * t),
|
|
207
|
+
Math.trunc((1 - e) * 255 + e * s),
|
|
208
|
+
Math.trunc((1 - e) * 255 + e * r)
|
|
209
|
+
];
|
|
210
|
+
}, X = function(t, s, r, i) {
|
|
211
|
+
const e = A(t, s, r, i);
|
|
212
|
+
return v(e[0], e[1], e[2]);
|
|
213
|
+
}, _ = /^#([\da-f]{6}|[\da-f]{3})$/i, j = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/, B = /^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3}(\.\d+)?)\)$/, L = class {
|
|
214
|
+
palette;
|
|
215
|
+
constructor(t, s) {
|
|
216
|
+
this.palette = [], s === void 0 && t instanceof Array ? this.createFromColors(t) : this.createFromAngles(t, s);
|
|
217
|
+
}
|
|
218
|
+
createFromColors(t) {
|
|
219
|
+
for (const s in t) Object.prototype.hasOwnProperty.call(t, s) && this.palette.push(new c(t[s]));
|
|
220
|
+
return this.palette;
|
|
221
|
+
}
|
|
222
|
+
createFromAngles(t, s) {
|
|
223
|
+
this.palette.push(new c(t));
|
|
224
|
+
for (const r in s) if (Object.prototype.hasOwnProperty.call(s, r)) {
|
|
225
|
+
const i = (Number(this.palette[0].h) + s[r]) % 360;
|
|
226
|
+
this.palette.push(new c(m(i, Number(this.palette[0].s), Number(this.palette[0].l))));
|
|
227
|
+
}
|
|
228
|
+
return this.palette;
|
|
229
|
+
}
|
|
230
|
+
static Compl(t) {
|
|
231
|
+
return new this(t, [180]);
|
|
232
|
+
}
|
|
233
|
+
static Triad(t) {
|
|
234
|
+
return new this(t, [120, 240]);
|
|
235
|
+
}
|
|
236
|
+
static Tetrad(t) {
|
|
237
|
+
return new this(t, [
|
|
238
|
+
60,
|
|
239
|
+
180,
|
|
240
|
+
240
|
|
241
|
+
]);
|
|
242
|
+
}
|
|
243
|
+
static Analog(t) {
|
|
244
|
+
return new this(t, [-45, 45]);
|
|
245
|
+
}
|
|
246
|
+
static Split(t) {
|
|
247
|
+
return new this(t, [150, 210]);
|
|
248
|
+
}
|
|
249
|
+
static Accent(t) {
|
|
250
|
+
return new this(t, [
|
|
251
|
+
-45,
|
|
252
|
+
45,
|
|
253
|
+
180
|
|
254
|
+
]);
|
|
255
|
+
}
|
|
256
|
+
}, q = (t) => t <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4, z = (t) => t <= 31308e-7 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - 0.055, D = (t, s, r) => 0.299 * t + 0.587 * s + 0.114 * r, T = (t, s, r) => [
|
|
257
|
+
r(t[0], s[0]),
|
|
258
|
+
r(t[1], s[1]),
|
|
259
|
+
r(t[2], s[2])
|
|
260
|
+
], J = (t, s) => T(t, s, (r, i) => 1 - (1 - r) * (1 - i)), K = (t, s) => T(t, s, (r, i) => r * i), Q = (t, s) => T(t, s, (r, i) => r < 0.5 ? 2 * r * i : 1 - 2 * (1 - r) * (1 - i)), U = (t, s, r) => t.map((i) => (i - 0.5) * r + 0.5 + s), W = (t, s) => {
|
|
261
|
+
const r = 0.2125 * t[0] + 0.7154 * t[1] + 0.0721 * t[2];
|
|
262
|
+
return t.map((i) => r + (i - r) * s);
|
|
263
|
+
}, Y = (t, s) => {
|
|
264
|
+
const r = (t[0] + t[1] + t[2]) / 3, i = Math.max(t[0], t[1], t[2]), e = (i - r) * (-s * 3);
|
|
265
|
+
return t.map((a) => a + (i - a) * e);
|
|
266
|
+
}, Z = (t, s, r, i, e) => [
|
|
267
|
+
0,
|
|
268
|
+
1,
|
|
269
|
+
2
|
|
270
|
+
].map((a) => s[a] + r[a] * Math.cos(2 * Math.PI * (i[a] * t + e[a])));
|
|
271
|
+
export {
|
|
272
|
+
c as Color,
|
|
273
|
+
L as ColorScheme,
|
|
274
|
+
_ as HEX_COLOR_REGEX,
|
|
275
|
+
H as Hsl,
|
|
276
|
+
w as Hsla,
|
|
277
|
+
B as RGBA_REGEX,
|
|
278
|
+
j as RGB_REGEX,
|
|
279
|
+
p as Rgb,
|
|
280
|
+
R as Rgba,
|
|
281
|
+
K as blendMultiply,
|
|
282
|
+
Q as blendOverlay,
|
|
283
|
+
J as blendScreen,
|
|
284
|
+
U as brightnessContrast,
|
|
285
|
+
f as componentToHex,
|
|
286
|
+
Z as cosinePalette,
|
|
287
|
+
k as hexToAlpha,
|
|
288
|
+
y as hexToHsb,
|
|
289
|
+
O as hexToHsv,
|
|
290
|
+
$ as hexToRgb,
|
|
291
|
+
S as hsbToHsl,
|
|
292
|
+
M as hsbToRgb,
|
|
293
|
+
N as hslToHsb,
|
|
294
|
+
G as hslToHsv,
|
|
295
|
+
m as hslToRgb,
|
|
296
|
+
I as hsvToHsl,
|
|
297
|
+
F as hsvToRgb,
|
|
298
|
+
g as hue2rgb,
|
|
299
|
+
z as linearToSrgb,
|
|
300
|
+
D as luma,
|
|
301
|
+
C as randomColor,
|
|
302
|
+
v as rgbToHex,
|
|
303
|
+
d as rgbToHsb,
|
|
304
|
+
x as rgbToHsl,
|
|
305
|
+
E as rgbToHsv,
|
|
306
|
+
P as rgbaString,
|
|
307
|
+
X as rgbaToHex,
|
|
308
|
+
A as rgbaToRgb,
|
|
309
|
+
W as saturation,
|
|
310
|
+
q as srgbToLinear,
|
|
311
|
+
Y as vibrance
|
|
312
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function i(e) {
|
|
2
|
+
if (!Array.isArray(e)) throw new TypeError("Middleware stack must be an array!");
|
|
3
|
+
for (const t of e) if (typeof t != "function") throw new TypeError("Middleware must be composed of functions!");
|
|
4
|
+
return function(t, o) {
|
|
5
|
+
let f = -1;
|
|
6
|
+
return s(0);
|
|
7
|
+
function s(r) {
|
|
8
|
+
if (r <= f) return Promise.reject(/* @__PURE__ */ new Error("next() called multiple times"));
|
|
9
|
+
f = r;
|
|
10
|
+
let n = e[r];
|
|
11
|
+
if (r === e.length && o && (n = o), !n) return Promise.resolve();
|
|
12
|
+
try {
|
|
13
|
+
return Promise.resolve(n(t, s.bind(null, r + 1)));
|
|
14
|
+
} catch (c) {
|
|
15
|
+
return Promise.reject(c);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
i as compose
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { noop as e } from "./noop.js";
|
|
2
|
+
import { replaceOld as i } from "./obj.js";
|
|
3
|
+
var p = [
|
|
4
|
+
"log",
|
|
5
|
+
"info",
|
|
6
|
+
"warn",
|
|
7
|
+
"error",
|
|
8
|
+
"assert"
|
|
9
|
+
], s = (t = e) => {
|
|
10
|
+
if (typeof console > "u") return e;
|
|
11
|
+
const f = p.map((o) => i(console, o, (r) => {
|
|
12
|
+
if (typeof r != "function") return;
|
|
13
|
+
const c = r;
|
|
14
|
+
return function(...n) {
|
|
15
|
+
t(o, ...n), c.apply(console, n);
|
|
16
|
+
};
|
|
17
|
+
}));
|
|
18
|
+
return () => f.forEach((o) => o());
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
s as handleConsole
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var s = (o, r = 500) => {
|
|
2
|
+
let l = null, e, n = null;
|
|
3
|
+
const i = () => {
|
|
4
|
+
if (l = null, !n) return;
|
|
5
|
+
const u = n, c = e;
|
|
6
|
+
n = null, e = void 0, o.apply(c, u);
|
|
7
|
+
}, t = function(...u) {
|
|
8
|
+
e = this, n = u, l !== null && clearTimeout(l), l = setTimeout(i, r);
|
|
9
|
+
};
|
|
10
|
+
return t.cancel = () => {
|
|
11
|
+
l !== null && clearTimeout(l), l = null, n = null, e = void 0;
|
|
12
|
+
}, t.flush = () => {
|
|
13
|
+
l !== null && (clearTimeout(l), i());
|
|
14
|
+
}, t.pending = () => l !== null, t;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
s as debounce
|
|
18
|
+
};
|
|
@@ -11,15 +11,6 @@ export declare enum DEVICE {
|
|
|
11
11
|
}
|
|
12
12
|
export type CurrentDevice = 'ipad' | 'android' | 'iphone' | 'pc';
|
|
13
13
|
export declare const currentDevice: () => CurrentDevice;
|
|
14
|
-
/**
|
|
15
|
-
* @description: Whether a `window` existed **when this module was first imported**.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated Evaluated once at module load, so it is stuck at `false` for the life of the
|
|
18
|
-
* process in any SSR-then-hydrate flow, and cannot be stubbed in a test. New code checks
|
|
19
|
-
* `typeof window === 'undefined'` inside the function that needs it. Kept exported so
|
|
20
|
-
* existing callers keep compiling.
|
|
21
|
-
*/
|
|
22
|
-
export declare const isClient: boolean;
|
|
23
14
|
/** Viewport breakpoint, matching where the mobile layout takes over */
|
|
24
15
|
export declare const MOBILE_MEDIA_QUERY = "(max-width: 768px)";
|
|
25
16
|
/**
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var o = /* @__PURE__ */ (function(e) {
|
|
2
|
+
return e.IPAD = "ipad", e.ANDROID = "android", e.IPhONE = "iphone", e.PC = "pc", e;
|
|
3
|
+
})({}), d = () => {
|
|
4
|
+
if (typeof window < "u") {
|
|
5
|
+
const e = navigator.userAgent.toLowerCase();
|
|
6
|
+
return /ipad|ipod/.test(e) ? "ipad" : /android/.test(e) ? "android" : /iphone/.test(e) ? "iphone" : "pc";
|
|
7
|
+
}
|
|
8
|
+
return "pc";
|
|
9
|
+
}, a = () => typeof window < "u", u = "(max-width: 768px)", s = (e) => typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia(e).matches, f = (e, t) => {
|
|
10
|
+
if (typeof window > "u" || typeof window.matchMedia != "function")
|
|
11
|
+
return t(!1), () => {
|
|
12
|
+
};
|
|
13
|
+
const n = window.matchMedia(e), r = () => t(n.matches);
|
|
14
|
+
if (r(), typeof n.addEventListener == "function")
|
|
15
|
+
return n.addEventListener("change", r), () => n.removeEventListener("change", r);
|
|
16
|
+
const i = n;
|
|
17
|
+
return i.addListener(r), () => i.removeListener(r);
|
|
18
|
+
}, c = () => a() ? window.navigator.userAgent.toLowerCase().includes("micromessenger") : !1, w = () => {
|
|
19
|
+
if (!a()) return !1;
|
|
20
|
+
const e = window.navigator.userAgent;
|
|
21
|
+
return !!/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(e);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
o as DEVICE,
|
|
25
|
+
u as MOBILE_MEDIA_QUERY,
|
|
26
|
+
d as currentDevice,
|
|
27
|
+
w as isMobile,
|
|
28
|
+
c as isWeiXin,
|
|
29
|
+
s as matchMediaQuery,
|
|
30
|
+
f as watchMediaQuery
|
|
31
|
+
};
|