ranuts 0.1.0-alpha.8 → 0.2.0-alpha.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 +164 -0
- package/README.md +116 -0
- package/{readme.md → README.zh-CN.md} +43 -12
- package/dist/bin/generate-api-docs.d.ts +1 -0
- package/dist/build/build.es.d.ts +2 -0
- package/dist/build/build.umd.d.ts +2 -0
- package/dist/build/build.umd.node.d.ts +2 -0
- package/dist/build/build.umd.utils.d.ts +2 -0
- package/dist/color-CRdlaDqQ.js +1 -0
- package/dist/examples/clone-deep-example.d.ts +1 -0
- package/dist/examples/is-equal-example.d.ts +1 -0
- package/dist/index.d.ts +5 -21
- package/dist/index.js +1 -2484
- package/dist/plugins/vite-plugins-banner.d.ts +2 -0
- package/dist/rolldown-runtime-I3TIJKkN.js +1 -0
- package/dist/src/node/appendFile.d.ts +7 -0
- package/dist/src/node/body.d.ts +9 -0
- package/dist/src/node/color.d.ts +7 -0
- package/dist/src/node/command.d.ts +8 -0
- package/dist/src/node/ctx2req.d.ts +5 -0
- package/dist/src/node/fileInfo.d.ts +7 -0
- package/dist/src/node/fs.d.ts +7 -0
- package/dist/src/node/get.d.ts +10 -0
- package/dist/src/node/getIPAdress.d.ts +1 -0
- package/dist/src/node/index.d.ts +25 -0
- package/dist/src/node/index.js +1 -0
- package/dist/src/node/isColorSupported.d.ts +2 -0
- package/dist/src/node/paresUrl.d.ts +19 -0
- package/dist/src/node/readDir.d.ts +6 -0
- package/dist/src/node/readFile.d.ts +9 -0
- package/dist/src/node/router.d.ts +42 -0
- package/dist/src/node/send.d.ts +7 -0
- package/dist/src/node/server.d.ts +18 -0
- package/dist/src/node/startTask.d.ts +2 -0
- package/dist/src/node/stream.d.ts +15 -0
- package/dist/src/node/taskEnd.d.ts +2 -0
- package/dist/src/node/traverse.d.ts +17 -0
- package/dist/src/node/watchFile.d.ts +8 -0
- package/dist/src/node/writeFile.d.ts +8 -0
- package/dist/src/node/ws.d.ts +8 -0
- package/dist/src/utils/audioRecorder.d.ts +16 -0
- package/dist/src/utils/behavior.d.ts +15 -0
- package/dist/src/utils/bom.d.ts +294 -0
- package/dist/src/utils/color.d.ts +71 -0
- package/dist/src/utils/compose.d.ts +10 -0
- package/dist/src/utils/console.d.ts +1 -0
- package/dist/src/utils/debounce.d.ts +7 -0
- package/dist/src/utils/device.d.ts +25 -0
- package/dist/src/utils/dom.d.ts +105 -0
- package/dist/src/utils/error.d.ts +1 -0
- package/dist/src/utils/func.d.ts +1 -0
- package/dist/src/utils/img.d.ts +16 -0
- package/dist/src/utils/index.d.ts +35 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/memoize.d.ts +7 -0
- package/dist/src/utils/mimeType.d.ts +9 -0
- package/dist/src/utils/monitor.d.ts +38 -0
- package/dist/src/utils/network.d.ts +39 -0
- package/dist/src/utils/noop.d.ts +2 -0
- package/dist/src/utils/number.d.ts +45 -0
- package/dist/src/utils/obj.d.ts +83 -0
- package/dist/src/utils/performance.d.ts +21 -0
- package/dist/src/utils/queue.d.ts +33 -0
- package/dist/src/utils/report.d.ts +8 -0
- package/dist/src/utils/request.d.ts +17 -0
- package/dist/src/utils/script.d.ts +7 -0
- package/dist/src/utils/signal.d.ts +6 -0
- package/dist/src/utils/storage.d.ts +2 -0
- package/dist/src/utils/str.d.ts +212 -0
- package/dist/src/utils/subscribe.d.ts +46 -0
- package/dist/src/utils/throttle.d.ts +15 -0
- package/dist/src/utils/time.d.ts +20 -0
- package/dist/src/utils/totp/sha/common.d.ts +151 -0
- package/dist/src/utils/totp/sha/converters.d.ts +88 -0
- package/dist/src/utils/totp/sha/custom_types.d.ts +60 -0
- package/dist/src/utils/totp/sha/primitives_32.d.ts +98 -0
- package/dist/src/utils/totp/sha/primitives_64.d.ts +116 -0
- package/dist/src/utils/totp/sha/sha.d.ts +103 -0
- package/dist/src/utils/totp/sha/sha1.d.ts +18 -0
- package/dist/src/utils/totp/sha/sha256.d.ts +20 -0
- package/dist/src/utils/totp/sha/sha3.d.ts +53 -0
- package/dist/src/utils/totp/sha/sha512.d.ts +21 -0
- package/dist/src/utils/totp/totp.d.ts +23 -0
- package/dist/src/utils/visual/application.d.ts +27 -0
- package/dist/src/utils/visual/enums.d.ts +27 -0
- package/dist/src/utils/visual/event/boundary.d.ts +22 -0
- package/dist/src/utils/visual/event/event.d.ts +14 -0
- package/dist/src/utils/visual/event/index.d.ts +6 -0
- package/dist/src/utils/visual/event/types.d.ts +32 -0
- package/dist/src/utils/visual/graphics/graphics.d.ts +81 -0
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +13 -0
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +35 -0
- package/dist/src/utils/visual/graphics/index.d.ts +4 -0
- package/dist/src/utils/visual/index.d.ts +7 -0
- package/dist/src/utils/visual/index.js +1 -0
- package/dist/src/utils/visual/math/bezier.d.ts +2 -0
- package/dist/src/utils/visual/math/enums.d.ts +3 -0
- package/dist/src/utils/visual/math/index.d.ts +5 -0
- package/dist/src/utils/visual/math/matrix.d.ts +113 -0
- package/dist/src/utils/visual/math/transform.d.ts +29 -0
- package/dist/src/utils/visual/render/batchRenderer.d.ts +78 -0
- package/dist/src/utils/visual/render/canvasRenderer.d.ts +10 -0
- package/dist/src/utils/visual/render/index.d.ts +3 -0
- package/dist/src/utils/visual/render/render.d.ts +11 -0
- package/dist/src/utils/visual/render/utils/batch/index.d.ts +90 -0
- package/dist/src/utils/visual/render/utils/batch/index.test.d.ts +1 -0
- package/dist/src/utils/visual/render/utils/float.d.ts +63 -0
- package/dist/src/utils/visual/render/utils/index.d.ts +3 -0
- package/dist/src/utils/visual/render/utils/index.test.d.ts +1 -0
- package/dist/src/utils/visual/render/utils/verticy.d.ts +13 -0
- package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +7 -0
- package/dist/src/utils/visual/render/utils/webgl/shaders.d.ts +2 -0
- package/dist/src/utils/visual/render/utils/webgpu/shaders.d.ts +8 -0
- package/dist/src/utils/visual/render/webGPURenderer.d.ts +49 -0
- package/dist/src/utils/visual/render/webGlRenderer.d.ts +14 -0
- package/dist/src/utils/visual/shape/circle.d.ts +11 -0
- package/dist/src/utils/visual/shape/ellipse.d.ts +12 -0
- package/dist/src/utils/visual/shape/index.d.ts +7 -0
- package/dist/src/utils/visual/shape/polygon.d.ts +11 -0
- package/dist/src/utils/visual/shape/rectangle.d.ts +12 -0
- package/dist/src/utils/visual/shape/roundedRectangle.d.ts +13 -0
- package/dist/src/utils/visual/shape/shape.d.ts +6 -0
- package/dist/src/utils/visual/style/fill.d.ts +8 -0
- package/dist/src/utils/visual/style/index.d.ts +3 -0
- package/dist/src/utils/visual/style/line.d.ts +10 -0
- package/dist/src/utils/visual/types.d.ts +18 -0
- package/dist/src/utils/visual/vertex/container.d.ts +74 -0
- package/dist/src/utils/visual/vertex/point.d.ts +18 -0
- package/dist/src/utils/visual/vertex/vertex.d.ts +36 -0
- package/dist/src/vnode/chainDom.d.ts +47 -0
- package/dist/src/vnode/h.d.ts +6 -0
- package/dist/src/vnode/hooks.d.ts +23 -0
- package/dist/src/vnode/htmlDomApi.d.ts +33 -0
- package/dist/src/vnode/index.d.ts +18 -0
- package/dist/src/vnode/index.js +1 -0
- package/dist/src/vnode/init.d.ts +2 -0
- package/dist/src/vnode/is.d.ts +5 -0
- package/dist/src/vnode/modules/attributes.d.ts +8 -0
- package/dist/src/vnode/modules/class.d.ts +8 -0
- package/dist/src/vnode/modules/index.d.ts +3 -0
- package/dist/src/vnode/modules/listeners.d.ts +12 -0
- package/dist/src/vnode/modules/props.d.ts +8 -0
- package/dist/src/vnode/modules/style.d.ts +14 -0
- package/dist/src/vnode/vnode.d.ts +31 -0
- package/dist/subscribe-CINWsor3.js +1 -0
- package/dist/test/bridge.test.d.ts +1 -0
- package/dist/test/clearBr.test.d.ts +1 -0
- package/dist/test/cloneDeep.test.d.ts +1 -0
- package/dist/test/command.test.d.ts +1 -0
- package/dist/test/encodeUrl.test.d.ts +1 -0
- package/dist/test/escapeHtml.test.d.ts +1 -0
- package/dist/test/is-equal.test.d.ts +1 -0
- package/dist/test/mimeType.test.d.ts +1 -0
- package/dist/test/package-exports.test.d.ts +1 -0
- package/dist/test/server.test.d.ts +1 -0
- package/dist/test/status.test.d.ts +1 -0
- package/dist/test/totp.test.d.ts +1 -0
- package/dist/test/utils/compose.test.d.ts +1 -0
- package/dist/test/utils/mergeObj.test.d.ts +1 -0
- package/dist/test/visual/math.test.d.ts +1 -0
- package/dist/test/visual-application.test.d.ts +1 -0
- package/dist/test/visual-batch.test.d.ts +1 -0
- package/dist/test/visual-math.test.d.ts +1 -0
- package/dist/test/vnode/index.d.ts +1 -0
- package/dist/test/vnode/server.d.ts +2 -0
- package/dist/test/vnode/vnode.d.ts +1 -0
- package/dist/test/vnode.test.d.ts +1 -0
- package/dist/test/websocket.test.d.ts +1 -0
- package/dist/test/writeFile.test.d.ts +1 -0
- package/dist/umd/index.umd.cjs +1 -0
- package/dist/umd/node/node.umd.cjs +1 -0
- package/dist/umd/utils/utils.umd.cjs +1 -0
- package/dist/utils-_OxsVZmz.js +1 -0
- package/dist/vite.config.d.ts +8 -0
- package/dist/vitest.config.d.ts +2 -0
- package/docs/API.md +305 -0
- package/package.json +49 -12
- package/typings.d.ts +28 -0
- package/dist/index.umd.cjs +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Int_64 is a object for 2 32-bit numbers emulating a 64-bit number.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Int_64 {
|
|
5
|
+
/**
|
|
6
|
+
* @param msint_32 The most significant 32-bits of a 64-bit number.
|
|
7
|
+
* @param lsint_32 The least significant 32-bits of a 64-bit number.
|
|
8
|
+
*/
|
|
9
|
+
readonly highOrder: number;
|
|
10
|
+
readonly lowOrder: number;
|
|
11
|
+
constructor(msint_32: number, lsint_32: number);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The 64-bit implementation of circular rotate left.
|
|
15
|
+
*
|
|
16
|
+
* This does not work for n >= 64 or n == 32 but those are never done.
|
|
17
|
+
*
|
|
18
|
+
* @param x The 64-bit integer argument.
|
|
19
|
+
* @param n The number of bits to shift.
|
|
20
|
+
* @returns `x` shifted left circularly by `n` bits.
|
|
21
|
+
*/
|
|
22
|
+
export declare function rotl_64(x: Int_64, n: number): Int_64;
|
|
23
|
+
/**
|
|
24
|
+
* The 64-bit implementation of the NIST specified Ch function.
|
|
25
|
+
*
|
|
26
|
+
* @param x The first 64-bit integer argument.
|
|
27
|
+
* @param y The second 64-bit integer argument.
|
|
28
|
+
* @param z The third 64-bit integer argument.
|
|
29
|
+
* @returns The NIST specified output of the function.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ch_64(x: Int_64, y: Int_64, z: Int_64): Int_64;
|
|
32
|
+
/**
|
|
33
|
+
* The 64-bit implementation of the NIST specified Maj function.
|
|
34
|
+
*
|
|
35
|
+
* @param x The first 64-bit integer argument.
|
|
36
|
+
* @param y The second 64-bit integer argument.
|
|
37
|
+
* @param z The third 64-bit integer argument.
|
|
38
|
+
* @returns The NIST specified output of the function.
|
|
39
|
+
*/
|
|
40
|
+
export declare function maj_64(x: Int_64, y: Int_64, z: Int_64): Int_64;
|
|
41
|
+
/**
|
|
42
|
+
* The 64-bit implementation of the NIST specified Sigma0 function.
|
|
43
|
+
*
|
|
44
|
+
* @param x The 64-bit integer argument.
|
|
45
|
+
* @returns The NIST specified output of the function.
|
|
46
|
+
*/
|
|
47
|
+
export declare function sigma0_64(x: Int_64): Int_64;
|
|
48
|
+
/**
|
|
49
|
+
* Add two 64-bit integers.
|
|
50
|
+
*
|
|
51
|
+
* @param x The first 64-bit integer argument to be added.
|
|
52
|
+
* @param y The second 64-bit integer argument to be added.
|
|
53
|
+
* @returns The sum of `x` + `y`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function safeAdd_64_2(x: Int_64, y: Int_64): Int_64;
|
|
56
|
+
/**
|
|
57
|
+
* Add four 64-bit integers.
|
|
58
|
+
*
|
|
59
|
+
* @param a The first 64-bit integer argument to be added.
|
|
60
|
+
* @param b The second 64-bit integer argument to be added.
|
|
61
|
+
* @param c The third 64-bit integer argument to be added.
|
|
62
|
+
* @param d The fouth 64-bit integer argument to be added.
|
|
63
|
+
* @returns The sum of `a` + `b` + `c` + `d`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function safeAdd_64_4(a: Int_64, b: Int_64, c: Int_64, d: Int_64): Int_64;
|
|
66
|
+
/**
|
|
67
|
+
* Add five 64-bit integers.
|
|
68
|
+
*
|
|
69
|
+
* @param a The first 64-bit integer argument to be added.
|
|
70
|
+
* @param b The second 64-bit integer argument to be added.
|
|
71
|
+
* @param c The third 64-bit integer argument to be added.
|
|
72
|
+
* @param d The fouth 64-bit integer argument to be added.
|
|
73
|
+
* @param e The fifth 64-bit integer argument to be added.
|
|
74
|
+
* @returns The sum of `a` + `b` + `c` + `d` + `e`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function safeAdd_64_5(a: Int_64, b: Int_64, c: Int_64, d: Int_64, e: Int_64): Int_64;
|
|
77
|
+
/**
|
|
78
|
+
* XORs two given arguments.
|
|
79
|
+
*
|
|
80
|
+
* @param a The first argument to be XORed.
|
|
81
|
+
* @param b The second argument to be XORed.
|
|
82
|
+
* @returns The The XOR `a` and `b`
|
|
83
|
+
*/
|
|
84
|
+
export declare function xor_64_2(a: Int_64, b: Int_64): Int_64;
|
|
85
|
+
/**
|
|
86
|
+
* XORs five given arguments.
|
|
87
|
+
*
|
|
88
|
+
* @param a The first argument to be XORed.
|
|
89
|
+
* @param b The second argument to be XORed.
|
|
90
|
+
* @param c The third argument to be XORed.
|
|
91
|
+
* @param d The fourth argument to be XORed.
|
|
92
|
+
* @param e The fifth argument to be XORed.
|
|
93
|
+
* @returns The XOR of `a`, `b`, `c`, `d`, and `e`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function xor_64_5(a: Int_64, b: Int_64, c: Int_64, d: Int_64, e: Int_64): Int_64;
|
|
96
|
+
/**
|
|
97
|
+
* The 64-bit implementation of the NIST specified Gamma1 function.
|
|
98
|
+
*
|
|
99
|
+
* @param x The 64-bit integer argument.
|
|
100
|
+
* @returns The NIST specified output of the function.
|
|
101
|
+
*/
|
|
102
|
+
export declare function gamma1_64(x: Int_64): Int_64;
|
|
103
|
+
/**
|
|
104
|
+
* The 64-bit implementation of the NIST specified Gamma0 function.
|
|
105
|
+
*
|
|
106
|
+
* @param x The 64-bit integer argument.
|
|
107
|
+
* @returns The NIST specified output of the function.
|
|
108
|
+
*/
|
|
109
|
+
export declare function gamma0_64(x: Int_64): Int_64;
|
|
110
|
+
/**
|
|
111
|
+
* The 64-bit implementation of the NIST specified Sigma1 function.
|
|
112
|
+
*
|
|
113
|
+
* @param x The 64-bit integer argument.
|
|
114
|
+
* @returns The NIST specified output of the function.
|
|
115
|
+
*/
|
|
116
|
+
export declare function sigma1_64(x: Int_64): Int_64;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { CSHAKEOptionsEncodingType, CSHAKEOptionsNoEncodingType, EncodingType, FixedLengthOptionsEncodingType, FixedLengthOptionsNoEncodingType, FormatNoTextType, KMACOptionsEncodingType, KMACOptionsNoEncodingType, SHAKEOptionsEncodingType, SHAKEOptionsNoEncodingType } from './custom_types';
|
|
2
|
+
type FixedLengthVariantType = 'SHA-1' | 'SHA-224' | 'SHA-256' | 'SHA-384' | 'SHA-512' | 'SHA3-224' | 'SHA3-256' | 'SHA3-384' | 'SHA3-512';
|
|
3
|
+
export default class jsSHA {
|
|
4
|
+
private readonly shaObj;
|
|
5
|
+
/**
|
|
6
|
+
* @param variant The desired SHA variant (SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-256,
|
|
7
|
+
* SHA3-384, SHA3-512, SHAKE128, SHAKE256, CSHAKE128, CSHAKE256, KMAC128, or KMAC256) as a string.
|
|
8
|
+
* @param inputFormat The input format to be used in future `update` calls (TEXT, HEX, B64, BYTES, ARRAYBUFFER,
|
|
9
|
+
* or UINT8ARRAY) as a string.
|
|
10
|
+
* @param options Options in the form of { encoding?: "UTF8" | "UTF16BE" | "UTF16LE"; numRounds?: number }.
|
|
11
|
+
* `encoding` is for only TEXT input (defaults to UTF8) and `numRounds` defaults to 1.
|
|
12
|
+
* `numRounds` is not valid for any of the MAC or CSHAKE variants.
|
|
13
|
+
* * If the variant supports HMAC, `options` may have an additional `hmacKey` key which must be in the form of
|
|
14
|
+
* {value: <INPUT>, format: <FORMAT>, encoding?: "UTF8" | "UTF16BE" | "UTF16LE"} where <FORMAT> takes the same
|
|
15
|
+
* values as `inputFormat` and <INPUT> can be a `string | ArrayBuffer | Uint8Array` depending on <FORMAT>.
|
|
16
|
+
* Supplying this key switches to HMAC calculation and replaces the now deprecated call to `setHMACKey`.
|
|
17
|
+
* * If the variant is CSHAKE128 or CSHAKE256, `options` may have two additional keys, `customization` and `funcName`,
|
|
18
|
+
* which are the NIST customization and function-name strings. Both must be in the same form as `hmacKey`.
|
|
19
|
+
* * If the variant is KMAC128 or KMAC256, `options` can include the `customization` key from CSHAKE variants and
|
|
20
|
+
* *must* have a `kmacKey` key that takes the same form as the `customization` key.
|
|
21
|
+
*/
|
|
22
|
+
constructor(variant: FixedLengthVariantType, inputFormat: 'TEXT', options?: FixedLengthOptionsEncodingType);
|
|
23
|
+
constructor(variant: FixedLengthVariantType, inputFormat: FormatNoTextType, options?: FixedLengthOptionsNoEncodingType);
|
|
24
|
+
constructor(variant: 'SHAKE128' | 'SHAKE256', inputFormat: 'TEXT', options?: SHAKEOptionsEncodingType);
|
|
25
|
+
constructor(variant: 'SHAKE128' | 'SHAKE256', inputFormat: FormatNoTextType, options?: SHAKEOptionsNoEncodingType);
|
|
26
|
+
constructor(variant: 'CSHAKE128' | 'CSHAKE256', inputFormat: 'TEXT', options?: CSHAKEOptionsEncodingType);
|
|
27
|
+
constructor(variant: 'CSHAKE128' | 'CSHAKE256', inputFormat: FormatNoTextType, options?: CSHAKEOptionsNoEncodingType);
|
|
28
|
+
constructor(variant: 'KMAC128' | 'KMAC256', inputFormat: 'TEXT', options: KMACOptionsEncodingType);
|
|
29
|
+
constructor(variant: 'KMAC128' | 'KMAC256', inputFormat: FormatNoTextType, options: KMACOptionsNoEncodingType);
|
|
30
|
+
/**
|
|
31
|
+
* Takes `input` and hashes as many blocks as possible. Stores the rest for either a future `update` or `getHash` call.
|
|
32
|
+
*
|
|
33
|
+
* @param input The input to be hashed.
|
|
34
|
+
* @returns A reference to the object.
|
|
35
|
+
*/
|
|
36
|
+
update(input: string | ArrayBuffer | Uint8Array): this;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the desired SHA or MAC (if a HMAC/KMAC key was specified) hash of the input fed in via `update` calls.
|
|
39
|
+
*
|
|
40
|
+
* @param format The desired output formatting (B64, HEX, BYTES, ARRAYBUFFER, or UINT8ARRAY) as a string.
|
|
41
|
+
* @param options Options in the form of { outputUpper?: boolean; b64Pad?: string; outputLen?: number; }.
|
|
42
|
+
* `outputLen` is required for variable length output variants (this option was previously called `shakeLen` which
|
|
43
|
+
* is now deprecated).
|
|
44
|
+
* `outputUpper` is only for HEX output (defaults to false) and b64pad is only for B64 output (defaults to "=").
|
|
45
|
+
* @returns The hash in the format specified.
|
|
46
|
+
*/
|
|
47
|
+
getHash(format: 'HEX', options?: {
|
|
48
|
+
outputUpper?: boolean;
|
|
49
|
+
outputLen?: number;
|
|
50
|
+
shakeLen?: number;
|
|
51
|
+
}): string;
|
|
52
|
+
getHash(format: 'B64', options?: {
|
|
53
|
+
b64Pad?: string;
|
|
54
|
+
outputLen?: number;
|
|
55
|
+
shakeLen?: number;
|
|
56
|
+
}): string;
|
|
57
|
+
getHash(format: 'BYTES', options?: {
|
|
58
|
+
outputLen?: number;
|
|
59
|
+
shakeLen?: number;
|
|
60
|
+
}): string;
|
|
61
|
+
getHash(format: 'UINT8ARRAY', options?: {
|
|
62
|
+
outputLen?: number;
|
|
63
|
+
shakeLen?: number;
|
|
64
|
+
}): Uint8Array;
|
|
65
|
+
getHash(format: 'ARRAYBUFFER', options?: {
|
|
66
|
+
outputLen?: number;
|
|
67
|
+
shakeLen?: number;
|
|
68
|
+
}): ArrayBuffer;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the HMAC key for an eventual `getHMAC` call. Must be called immediately after jsSHA object instantiation.
|
|
71
|
+
* Now deprecated in favor of setting the `hmacKey` at object instantiation.
|
|
72
|
+
*
|
|
73
|
+
* @param key The key used to calculate the HMAC
|
|
74
|
+
* @param inputFormat The format of key (HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY) as a string.
|
|
75
|
+
* @param options Options in the form of { encoding?: "UTF8" | "UTF16BE" | "UTF16LE }. `encoding` is only for TEXT
|
|
76
|
+
* and defaults to UTF8.
|
|
77
|
+
*/
|
|
78
|
+
setHMACKey(key: string, inputFormat: 'TEXT', options?: {
|
|
79
|
+
encoding?: EncodingType;
|
|
80
|
+
}): void;
|
|
81
|
+
setHMACKey(key: string, inputFormat: 'B64' | 'HEX' | 'BYTES'): void;
|
|
82
|
+
setHMACKey(key: ArrayBuffer, inputFormat: 'ARRAYBUFFER'): void;
|
|
83
|
+
setHMACKey(key: Uint8Array, inputFormat: 'UINT8ARRAY'): void;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the the HMAC in the specified format using the key given by a previous `setHMACKey` call. Now deprecated
|
|
86
|
+
* in favor of just calling `getHash`.
|
|
87
|
+
*
|
|
88
|
+
* @param format The desired output formatting (B64, HEX, BYTES, ARRAYBUFFER, or UINT8ARRAY) as a string.
|
|
89
|
+
* @param options Options in the form of { outputUpper?: boolean; b64Pad?: string }. `outputUpper` is only for HEX
|
|
90
|
+
* output (defaults to false) and `b64pad` is only for B64 output (defaults to "=").
|
|
91
|
+
* @returns The HMAC in the format specified.
|
|
92
|
+
*/
|
|
93
|
+
getHMAC(format: 'HEX', options?: {
|
|
94
|
+
outputUpper?: boolean;
|
|
95
|
+
}): string;
|
|
96
|
+
getHMAC(format: 'B64', options?: {
|
|
97
|
+
b64Pad?: string;
|
|
98
|
+
}): string;
|
|
99
|
+
getHMAC(format: 'BYTES'): string;
|
|
100
|
+
getHMAC(format: 'UINT8ARRAY'): Uint8Array;
|
|
101
|
+
getHMAC(format: 'ARRAYBUFFER'): ArrayBuffer;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsSHABase } from './common';
|
|
2
|
+
import type { FixedLengthOptionsEncodingType, FixedLengthOptionsNoEncodingType, FormatNoTextType, packedValue } from './custom_types';
|
|
3
|
+
export default class jsSHA extends jsSHABase<number[], 'SHA-1'> {
|
|
4
|
+
intermediateState: number[];
|
|
5
|
+
variantBlockSize: number;
|
|
6
|
+
bigEndianMod: -1 | 1;
|
|
7
|
+
outputBinLen: number;
|
|
8
|
+
isVariableLen: boolean;
|
|
9
|
+
HMACSupported: boolean;
|
|
10
|
+
converterFunc: (input: any, existingBin: number[], existingBinLen: number) => packedValue;
|
|
11
|
+
roundFunc: (block: number[], H: number[]) => number[];
|
|
12
|
+
finalizeFunc: (remainder: number[], remainderBinLen: number, processedBinLen: number, H: number[]) => number[];
|
|
13
|
+
stateCloneFunc: (state: number[]) => number[];
|
|
14
|
+
newStateFunc: (variant: 'SHA-1') => number[];
|
|
15
|
+
getMAC: () => number[];
|
|
16
|
+
constructor(variant: 'SHA-1', inputFormat: 'TEXT', options?: FixedLengthOptionsEncodingType);
|
|
17
|
+
constructor(variant: 'SHA-1', inputFormat: FormatNoTextType, options?: FixedLengthOptionsNoEncodingType);
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsSHABase } from './common';
|
|
2
|
+
import type { FixedLengthOptionsEncodingType, FixedLengthOptionsNoEncodingType, FormatNoTextType, packedValue } from './custom_types';
|
|
3
|
+
type VariantType = 'SHA-224' | 'SHA-256';
|
|
4
|
+
export default class jsSHA extends jsSHABase<number[], VariantType> {
|
|
5
|
+
intermediateState: number[];
|
|
6
|
+
variantBlockSize: number;
|
|
7
|
+
bigEndianMod: -1 | 1;
|
|
8
|
+
outputBinLen: number;
|
|
9
|
+
isVariableLen: boolean;
|
|
10
|
+
HMACSupported: boolean;
|
|
11
|
+
converterFunc: (input: any, existingBin: number[], existingBinLen: number) => packedValue;
|
|
12
|
+
roundFunc: (block: number[], H: number[]) => number[];
|
|
13
|
+
finalizeFunc: (remainder: number[], remainderBinLen: number, processedBinLen: number, H: number[]) => number[];
|
|
14
|
+
stateCloneFunc: (state: number[]) => number[];
|
|
15
|
+
newStateFunc: (variant: VariantType) => number[];
|
|
16
|
+
getMAC: () => number[];
|
|
17
|
+
constructor(variant: VariantType, inputFormat: 'TEXT', options?: FixedLengthOptionsEncodingType);
|
|
18
|
+
constructor(variant: VariantType, inputFormat: FormatNoTextType, options?: FixedLengthOptionsNoEncodingType);
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsSHABase } from './common';
|
|
2
|
+
import type { CSHAKEOptionsEncodingType, CSHAKEOptionsNoEncodingType, FixedLengthOptionsEncodingType, FixedLengthOptionsNoEncodingType, FormatNoTextType, KMACOptionsEncodingType, KMACOptionsNoEncodingType, SHAKEOptionsEncodingType, SHAKEOptionsNoEncodingType, packedValue } from './custom_types';
|
|
3
|
+
import { Int_64 } from './primitives_64';
|
|
4
|
+
type FixedLengthVariantType = 'SHA3-224' | 'SHA3-256' | 'SHA3-384' | 'SHA3-512' | 'SHAKE128' | 'SHAKE256';
|
|
5
|
+
type VariantType = FixedLengthVariantType | 'SHAKE128' | 'SHAKE256' | 'CSHAKE128' | 'CSHAKE256' | 'KMAC128' | 'KMAC256';
|
|
6
|
+
export default class jsSHA extends jsSHABase<Int_64[][], VariantType> {
|
|
7
|
+
intermediateState: Int_64[][];
|
|
8
|
+
variantBlockSize: number;
|
|
9
|
+
bigEndianMod: -1 | 1;
|
|
10
|
+
outputBinLen: number;
|
|
11
|
+
isVariableLen: boolean;
|
|
12
|
+
HMACSupported: boolean;
|
|
13
|
+
converterFunc: (input: any, existingBin: number[], existingBinLen: number) => packedValue;
|
|
14
|
+
roundFunc: (block: number[], H: Int_64[][]) => Int_64[][];
|
|
15
|
+
finalizeFunc: (remainder: number[], remainderBinLen: number, processedBinLen: number, H: Int_64[][], outputLen: number) => number[];
|
|
16
|
+
stateCloneFunc: (state: Int_64[][]) => Int_64[][];
|
|
17
|
+
newStateFunc: (variant: VariantType) => Int_64[][];
|
|
18
|
+
getMAC: ((options: {
|
|
19
|
+
outputLen: number;
|
|
20
|
+
}) => number[]) | null;
|
|
21
|
+
constructor(variant: FixedLengthVariantType, inputFormat: 'TEXT', options?: FixedLengthOptionsEncodingType);
|
|
22
|
+
constructor(variant: FixedLengthVariantType, inputFormat: FormatNoTextType, options?: FixedLengthOptionsNoEncodingType);
|
|
23
|
+
constructor(variant: 'SHAKE128' | 'SHAKE256', inputFormat: 'TEXT', options?: SHAKEOptionsEncodingType);
|
|
24
|
+
constructor(variant: 'SHAKE128' | 'SHAKE256', inputFormat: FormatNoTextType, options?: SHAKEOptionsNoEncodingType);
|
|
25
|
+
constructor(variant: 'CSHAKE128' | 'CSHAKE256', inputFormat: 'TEXT', options?: CSHAKEOptionsEncodingType);
|
|
26
|
+
constructor(variant: 'CSHAKE128' | 'CSHAKE256', inputFormat: FormatNoTextType, options?: CSHAKEOptionsNoEncodingType);
|
|
27
|
+
constructor(variant: 'KMAC128' | 'KMAC256', inputFormat: 'TEXT', options: KMACOptionsEncodingType);
|
|
28
|
+
constructor(variant: 'KMAC128' | 'KMAC256', inputFormat: FormatNoTextType, options: KMACOptionsNoEncodingType);
|
|
29
|
+
/**
|
|
30
|
+
* Initialize CSHAKE variants.
|
|
31
|
+
*
|
|
32
|
+
* @param options Options containing CSHAKE params.
|
|
33
|
+
* @param funcNameOverride Overrides any "funcName" present in `options` (used with KMAC)
|
|
34
|
+
* @returns The delimiter to be used
|
|
35
|
+
*/
|
|
36
|
+
protected _initializeCSHAKE(options?: CSHAKEOptionsNoEncodingType, funcNameOverride?: packedValue): number;
|
|
37
|
+
/**
|
|
38
|
+
* Initialize KMAC variants.
|
|
39
|
+
*
|
|
40
|
+
* @param options Options containing KMAC params.
|
|
41
|
+
*/
|
|
42
|
+
protected _initializeKMAC(options: KMACOptionsNoEncodingType): void;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the the KMAC in the specified format.
|
|
45
|
+
*
|
|
46
|
+
* @param options Hashmap of extra outputs options. `outputLen` must be specified.
|
|
47
|
+
* @returns The KMAC in the format specified.
|
|
48
|
+
*/
|
|
49
|
+
protected _getKMAC(options: {
|
|
50
|
+
outputLen: number;
|
|
51
|
+
}): number[];
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsSHABase } from './common';
|
|
2
|
+
import type { FixedLengthOptionsEncodingType, FixedLengthOptionsNoEncodingType, FormatNoTextType, packedValue } from './custom_types';
|
|
3
|
+
import { Int_64 } from './primitives_64';
|
|
4
|
+
type VariantType = 'SHA-384' | 'SHA-512';
|
|
5
|
+
export default class jsSHA extends jsSHABase<Int_64[], VariantType> {
|
|
6
|
+
intermediateState: Int_64[];
|
|
7
|
+
variantBlockSize: number;
|
|
8
|
+
bigEndianMod: -1 | 1;
|
|
9
|
+
outputBinLen: number;
|
|
10
|
+
isVariableLen: boolean;
|
|
11
|
+
HMACSupported: boolean;
|
|
12
|
+
converterFunc: (input: any, existingBin: number[], existingBinLen: number) => packedValue;
|
|
13
|
+
roundFunc: (block: number[], H: Int_64[]) => Int_64[];
|
|
14
|
+
finalizeFunc: (remainder: number[], remainderBinLen: number, processedBinLen: number, H: Int_64[]) => number[];
|
|
15
|
+
stateCloneFunc: (state: Int_64[]) => Int_64[];
|
|
16
|
+
newStateFunc: (variant: VariantType) => Int_64[];
|
|
17
|
+
getMAC: () => number[];
|
|
18
|
+
constructor(variant: VariantType, inputFormat: 'TEXT', options?: FixedLengthOptionsEncodingType);
|
|
19
|
+
constructor(variant: VariantType, inputFormat: FormatNoTextType, options?: FixedLengthOptionsNoEncodingType);
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} [digits=6]
|
|
3
|
+
* @param {string} [algorithm="SHA-1"]
|
|
4
|
+
* @param {string} [period=30]
|
|
5
|
+
* @param {string} [timestamp=Date.now()]
|
|
6
|
+
*/
|
|
7
|
+
type Options = {
|
|
8
|
+
digits?: number;
|
|
9
|
+
algorithm?: 'SHA-1' | 'SHA-224' | 'SHA-256' | 'SHA-384' | 'SHA-512' | 'SHA3-224' | 'SHA3-256' | 'SHA3-384' | 'SHA3-512';
|
|
10
|
+
period?: number;
|
|
11
|
+
timestamp?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare class TOTP {
|
|
14
|
+
static generate(key: string, options?: Options): {
|
|
15
|
+
otp: string;
|
|
16
|
+
expires: number;
|
|
17
|
+
};
|
|
18
|
+
private static hex2dec;
|
|
19
|
+
private static dec2hex;
|
|
20
|
+
private static base32tohex;
|
|
21
|
+
private static leftpad;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import { EventSystem } from '@/utils/visual/event';
|
|
3
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
4
|
+
export declare class Application {
|
|
5
|
+
private readonly renderer;
|
|
6
|
+
readonly stage: Container;
|
|
7
|
+
readonly view: HTMLCanvasElement;
|
|
8
|
+
private animationFrameId;
|
|
9
|
+
eventSystem: EventSystem;
|
|
10
|
+
constructor(options: IApplicationOptions);
|
|
11
|
+
/**
|
|
12
|
+
* 创建并初始化一个 Application。
|
|
13
|
+
*
|
|
14
|
+
* 推荐使用此异步工厂而非 `new Application()`:WebGPU 后端的设备初始化是异步的,
|
|
15
|
+
* 必须在首次 render 之前 await 完成。Canvas / WebGL 后端的 init 会立即 resolve,
|
|
16
|
+
* 因此该工厂对所有后端都是安全且一致的。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const app = await Application.create({ view, prefer: RENDERER_TYPE.WEB_GPU });
|
|
20
|
+
* app.stage.addChild(graphics);
|
|
21
|
+
* app.start();
|
|
22
|
+
*/
|
|
23
|
+
static create(options: IApplicationOptions): Promise<Application>;
|
|
24
|
+
render(): void;
|
|
25
|
+
start(): void;
|
|
26
|
+
stop(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum SHAPE_TYPE {
|
|
2
|
+
RECTANGLE = "rectangle",// 矩形
|
|
3
|
+
POLYGON = "polygon",// 多边形
|
|
4
|
+
CIRCLE = "circle",// 圆形
|
|
5
|
+
ELLIPSE = "ellipse",// 椭圆
|
|
6
|
+
ROUNDED_RECTANGLE = "rounded rectangle"
|
|
7
|
+
}
|
|
8
|
+
export declare enum LINE_CAP {
|
|
9
|
+
BUTT = "butt",
|
|
10
|
+
ROUND = "round",
|
|
11
|
+
SQUARE = "square"
|
|
12
|
+
}
|
|
13
|
+
export declare enum LINE_JOIN {
|
|
14
|
+
MITER = "miter",
|
|
15
|
+
BEVEL = "bevel",
|
|
16
|
+
ROUND = "round"
|
|
17
|
+
}
|
|
18
|
+
export declare enum RENDERER_TYPE {
|
|
19
|
+
WEB_GL = "webgl",
|
|
20
|
+
CANVAS = "canvas",
|
|
21
|
+
WEB_GPU = "webgpu"
|
|
22
|
+
}
|
|
23
|
+
export declare const MAX_VERTEX_COUNT = 65536;
|
|
24
|
+
export declare const BYTES_PER_VERTEX = 12;
|
|
25
|
+
export declare const CONTAINER = "container";
|
|
26
|
+
export declare const GRAPHICS = "graphics";
|
|
27
|
+
export declare const OBJECT = "object";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import type { Cursor, FederatedMouseEvent } from '@/utils/visual/event/types';
|
|
3
|
+
export declare class EventBoundary {
|
|
4
|
+
private rootContainer;
|
|
5
|
+
private hasFoundTarget;
|
|
6
|
+
private hitTarget;
|
|
7
|
+
cursor: Cursor;
|
|
8
|
+
private eventHandlerMap;
|
|
9
|
+
private pressTargetsMap;
|
|
10
|
+
overTargets: Container[];
|
|
11
|
+
constructor(stage: Container);
|
|
12
|
+
private hitTestRecursive;
|
|
13
|
+
private hitTest;
|
|
14
|
+
fireEvent: (event: FederatedMouseEvent) => void;
|
|
15
|
+
private fireMouseMove;
|
|
16
|
+
private fireMouseDown;
|
|
17
|
+
private fireMouseUp;
|
|
18
|
+
private notifyTarget;
|
|
19
|
+
private propagate;
|
|
20
|
+
private dispatchEvent;
|
|
21
|
+
private composePath;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
export declare class EventSystem {
|
|
3
|
+
private canvasEle;
|
|
4
|
+
private eventBoundary;
|
|
5
|
+
private rootEvent;
|
|
6
|
+
constructor(canvasEle: HTMLCanvasElement, stage: Container);
|
|
7
|
+
private addEvents;
|
|
8
|
+
private onPointerMove;
|
|
9
|
+
private onPointerLeave;
|
|
10
|
+
private onPointerDown;
|
|
11
|
+
private onPointerup;
|
|
12
|
+
private bootstrapEvent;
|
|
13
|
+
private setCursor;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventBoundary } from '@/utils/visual/event/boundary';
|
|
2
|
+
import { EventSystem } from '@/utils/visual/event/event';
|
|
3
|
+
import { EventPhase, FederatedMouseEvent } from '@/utils/visual/event/types';
|
|
4
|
+
import type { Cursor, FederatedEventMap } from '@/utils/visual/event/types';
|
|
5
|
+
export { EventBoundary, EventSystem, EventPhase, FederatedMouseEvent };
|
|
6
|
+
export type { FederatedEventMap, Cursor };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Point } from '@/utils/visual/vertex/point';
|
|
2
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
3
|
+
export declare enum EventPhase {
|
|
4
|
+
NONE = 0,
|
|
5
|
+
CAPTURING = 1,
|
|
6
|
+
AT_TARGET = 2,
|
|
7
|
+
BUBBLING = 3
|
|
8
|
+
}
|
|
9
|
+
export declare class FederatedMouseEvent {
|
|
10
|
+
isTrusted: boolean;
|
|
11
|
+
timeStamp: number;
|
|
12
|
+
type: keyof FederatedEventMap;
|
|
13
|
+
button: number;
|
|
14
|
+
buttons: number;
|
|
15
|
+
global: Point;
|
|
16
|
+
propagationStopped: boolean;
|
|
17
|
+
eventPhase: EventPhase;
|
|
18
|
+
target: Container;
|
|
19
|
+
currentTarget: Container;
|
|
20
|
+
stopPropagation(): void;
|
|
21
|
+
}
|
|
22
|
+
export type FederatedEventMap = {
|
|
23
|
+
mousedown: FederatedMouseEvent;
|
|
24
|
+
mouseup: FederatedMouseEvent;
|
|
25
|
+
click: FederatedMouseEvent;
|
|
26
|
+
mouseenter: FederatedMouseEvent;
|
|
27
|
+
mouseleave: FederatedMouseEvent;
|
|
28
|
+
mousemove: FederatedMouseEvent;
|
|
29
|
+
mouseout: FederatedMouseEvent;
|
|
30
|
+
mouseover: FederatedMouseEvent;
|
|
31
|
+
};
|
|
32
|
+
export type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ns-resize' | 'ew-resize' | 'nesw-resize' | 'col-resize' | 'nwse-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import { Polygon } from '@/utils/visual/shape/polygon';
|
|
3
|
+
import { GraphicsGeometry } from '@/utils/visual/graphics/graphicsGeometry';
|
|
4
|
+
import type { Shape } from '@/utils/visual/shape/shape';
|
|
5
|
+
import type { BatchRenderer } from '@/utils/visual/render/batchRenderer';
|
|
6
|
+
import type { ILineStyleOptions } from '@/utils/visual/types';
|
|
7
|
+
import type { CanvasRenderer } from '@/utils/visual/render/canvasRenderer';
|
|
8
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
9
|
+
export declare class Graphics extends Container {
|
|
10
|
+
private _lineStyle;
|
|
11
|
+
private _fillStyle;
|
|
12
|
+
geometry: GraphicsGeometry;
|
|
13
|
+
currentPath: Polygon;
|
|
14
|
+
type: string;
|
|
15
|
+
constructor();
|
|
16
|
+
lineStyle(width: number, color?: string, alpha?: number): Graphics;
|
|
17
|
+
lineStyle(options: ILineStyleOptions): Graphics;
|
|
18
|
+
resetLineStyle: () => void;
|
|
19
|
+
protected drawShape: (shape: Shape) => Graphics;
|
|
20
|
+
/**
|
|
21
|
+
* 清空已有的 path,开始新的 path
|
|
22
|
+
*/
|
|
23
|
+
protected startPoly: () => void;
|
|
24
|
+
beginFill: (color?: string, alpha?: number) => Graphics;
|
|
25
|
+
/**
|
|
26
|
+
* 结束填充模式
|
|
27
|
+
*/
|
|
28
|
+
endFill: () => Graphics;
|
|
29
|
+
/**
|
|
30
|
+
* 画矩形
|
|
31
|
+
* @param x x 坐标
|
|
32
|
+
* @param y y 坐标
|
|
33
|
+
* @param width 宽度
|
|
34
|
+
* @param height 高度
|
|
35
|
+
*/
|
|
36
|
+
drawRect: (x: number, y: number, width: number, height: number) => Graphics;
|
|
37
|
+
/**
|
|
38
|
+
* 画圆
|
|
39
|
+
* @param x 圆心 X 坐标
|
|
40
|
+
* @param y 圆心 Y 坐标
|
|
41
|
+
* @param radius 半径
|
|
42
|
+
*/
|
|
43
|
+
drawCircle: (x: number, y: number, radius: number) => Graphics;
|
|
44
|
+
/**
|
|
45
|
+
* 画圆角矩形
|
|
46
|
+
* @param x x 坐标
|
|
47
|
+
* @param y y 坐标
|
|
48
|
+
* @param width 宽度
|
|
49
|
+
* @param height 高度
|
|
50
|
+
* @param radius 圆角半径
|
|
51
|
+
*/
|
|
52
|
+
drawRoundedRect: (x: number, y: number, width: number, height: number, radius: number) => Graphics;
|
|
53
|
+
/**
|
|
54
|
+
* 画椭圆
|
|
55
|
+
* @param x 椭圆中心 x 坐标
|
|
56
|
+
* @param y 椭圆中心 y 坐标
|
|
57
|
+
* @param radiusX 椭圆 x 轴半径
|
|
58
|
+
* @param radiusY 椭圆 y 轴半径
|
|
59
|
+
*/
|
|
60
|
+
drawEllipse: (x: number, y: number, radiusX: number, radiusY: number) => Graphics;
|
|
61
|
+
/**
|
|
62
|
+
* 画多边形
|
|
63
|
+
* @param points 多边形顶点坐标数组,每 2 个元素算一组 (x,y)
|
|
64
|
+
*/
|
|
65
|
+
drawPolygon: (points: number[]) => Graphics;
|
|
66
|
+
moveTo: (x: number, y: number) => Graphics;
|
|
67
|
+
lineTo: (x: number, y: number) => Graphics;
|
|
68
|
+
closePath: () => Graphics;
|
|
69
|
+
containsPoint: (p: Point) => boolean;
|
|
70
|
+
quadraticCurveTo: (cpX: number, cpY: number, toX: number, toY: number) => Graphics;
|
|
71
|
+
bezierCurveTo: (cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number) => Graphics;
|
|
72
|
+
arc: (cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean) => Graphics;
|
|
73
|
+
arcTo: (x1: number, y1: number, x2: number, y2: number, radius: number) => Graphics;
|
|
74
|
+
clear: () => Graphics;
|
|
75
|
+
/**
|
|
76
|
+
* 调用 canvas API 绘制自身
|
|
77
|
+
*/
|
|
78
|
+
protected renderCanvas: (render: CanvasRenderer) => void;
|
|
79
|
+
buildBatches: (batchRenderer: BatchRenderer) => void;
|
|
80
|
+
updateBatches: (floatView: Float32Array) => void;
|
|
81
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import type { Fill } from '@/utils/visual/style/fill';
|
|
3
|
+
import type { Line } from '@/utils/visual/style/line';
|
|
4
|
+
export declare class GraphicsData {
|
|
5
|
+
shape: Shape;
|
|
6
|
+
lineStyle: Line;
|
|
7
|
+
fillStyle: Fill;
|
|
8
|
+
/**
|
|
9
|
+
* 顶点数组,每 2 个元素代表一个顶点
|
|
10
|
+
*/
|
|
11
|
+
vertices: number[];
|
|
12
|
+
constructor(shape: Shape, fillStyle: Fill, lineStyle: Line);
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GraphicsData } from '@/utils/visual/graphics/graphicsData';
|
|
2
|
+
import { CustomFloatArray, CustomIntArray } from '@/utils/visual/render/utils/float';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
import type { BatchPart } from '@/utils/visual/render/utils/batch';
|
|
5
|
+
import type { Shape } from '@/utils/visual/shape/shape';
|
|
6
|
+
import type { Fill } from '@/utils/visual/style/fill';
|
|
7
|
+
import type { Line } from '@/utils/visual/style/line';
|
|
8
|
+
export declare class GraphicsGeometry {
|
|
9
|
+
graphicsData: GraphicsData[];
|
|
10
|
+
private dirty;
|
|
11
|
+
shapeIndex: number;
|
|
12
|
+
/**
|
|
13
|
+
* 每个 batchPart 代表一个 fill 或者一个 stroke
|
|
14
|
+
*/
|
|
15
|
+
batchParts: BatchPart[];
|
|
16
|
+
/**
|
|
17
|
+
* 顶点数组,每 2 个元素代表一个顶点
|
|
18
|
+
*/
|
|
19
|
+
vertices: CustomFloatArray;
|
|
20
|
+
/**
|
|
21
|
+
* 顶点下标数组,每个元素代表一个顶点下标
|
|
22
|
+
*/
|
|
23
|
+
indices: CustomIntArray;
|
|
24
|
+
drawShape(shape: Shape, fillStyle: Fill, lineStyle: Line): void;
|
|
25
|
+
/**
|
|
26
|
+
* @param p 待检测点
|
|
27
|
+
* @returns {boolean} 待检测点是否落在某一个子图形内
|
|
28
|
+
*/
|
|
29
|
+
containsPoint(p: Point): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 将所有子图形都转化成顶点并且进行三角剖分
|
|
32
|
+
*/
|
|
33
|
+
buildVerticesAndTriangulate(): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Application } from '@/utils/visual/application';
|
|
2
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
3
|
+
import { Graphics } from '@/utils/visual/graphics/graphics';
|
|
4
|
+
import { BYTES_PER_VERTEX, LINE_CAP, LINE_JOIN, MAX_VERTEX_COUNT, RENDERER_TYPE, SHAPE_TYPE } from '@/utils/visual/enums';
|
|
5
|
+
import type { IApplicationOptions, IFillStyleOptions, ILineStyleOptions } from '@/utils/visual/types';
|
|
6
|
+
export { Application, Container, Graphics, SHAPE_TYPE, LINE_CAP, LINE_JOIN, RENDERER_TYPE, MAX_VERTEX_COUNT, BYTES_PER_VERTEX, };
|
|
7
|
+
export type { IApplicationOptions, IFillStyleOptions, ILineStyleOptions };
|