ranuts 0.1.0-alpha.11 → 0.1.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -3
- package/dist/index.js +25 -16
- package/dist/{mimeType-Clvz2Teb.js → mimeType-eRf1TlBb.js} +4 -9
- package/dist/{reactify-C4cesbXi.js → reactify-Z-V9Vblb.js} +3 -8
- package/dist/{ml.js → src/ml/index.js} +19 -24
- package/dist/src/node/body.d.ts +0 -1
- package/dist/src/node/command.d.ts +0 -1
- package/dist/src/node/ctx2req.d.ts +0 -1
- package/dist/src/node/fs.d.ts +0 -2
- package/dist/src/node/index.d.ts +3 -2
- package/dist/src/node/index.js +54 -0
- package/dist/src/node/paresUrl.d.ts +0 -1
- package/dist/src/node/readFile.d.ts +0 -1
- package/dist/src/node/server.d.ts +0 -1
- package/dist/src/node/stream.d.ts +0 -1
- package/dist/src/node/traverse.d.ts +0 -1
- package/dist/src/node/watchFile.d.ts +1 -1
- package/dist/src/node/websocket.d.ts +2 -6
- package/dist/src/node/ws.d.ts +0 -1
- package/dist/src/optimize/index.d.ts +3 -3
- package/dist/src/react/index.js +4 -0
- package/dist/src/utils/behavior.d.ts +1 -1
- package/dist/src/utils/bom.d.ts +7 -7
- package/dist/src/utils/device.d.ts +9 -3
- package/dist/src/utils/dom.d.ts +87 -2
- package/dist/src/utils/img.d.ts +1 -1
- package/dist/src/utils/index.d.ts +8 -4
- package/dist/src/utils/index.js +4021 -0
- package/dist/src/utils/number.d.ts +1 -1
- package/dist/src/utils/obj.d.ts +10 -3
- package/dist/src/utils/storage.d.ts +2 -0
- package/dist/src/utils/subscribe.d.ts +34 -4
- 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 +10 -0
- package/dist/src/utils/visual/demo/index.d.ts +1 -0
- package/dist/src/utils/visual/demo/sankey.d.ts +2 -0
- package/dist/src/utils/visual/enums.d.ts +21 -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 +3 -0
- package/dist/src/utils/visual/event/types.d.ts +32 -0
- package/dist/src/utils/visual/graphics/graphics.d.ts +19 -0
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +10 -0
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +10 -0
- package/dist/src/utils/visual/graphics/index.d.ts +3 -0
- package/dist/src/utils/visual/index.d.ts +4 -0
- package/dist/src/utils/visual/math/bezier.d.ts +2 -0
- package/dist/src/utils/visual/math/enums.d.ts +2 -0
- package/dist/src/utils/visual/math/index.d.ts +4 -0
- package/dist/src/utils/visual/math/matrix.d.ts +32 -0
- package/dist/src/utils/visual/math/transform.d.ts +27 -0
- package/dist/src/utils/visual/render/canvasRenderer.d.ts +9 -0
- package/dist/src/utils/visual/render/index.d.ts +3 -0
- package/dist/src/utils/visual/render/render.d.ts +10 -0
- package/dist/src/utils/visual/render/webGlRenderer.d.ts +7 -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 +5 -0
- package/dist/src/utils/visual/shape/polygon.d.ts +10 -0
- package/dist/src/utils/visual/shape/rectangle.d.ts +12 -0
- package/dist/src/utils/visual/shape/shape.d.ts +7 -0
- package/dist/src/utils/visual/style/fill.d.ts +8 -0
- package/dist/src/utils/visual/style/index.d.ts +2 -0
- package/dist/src/utils/visual/style/line.d.ts +9 -0
- package/dist/src/utils/visual/types.d.ts +6 -0
- package/dist/src/utils/visual/vertex/application.d.ts +13 -0
- package/dist/src/utils/visual/vertex/container.d.ts +38 -0
- package/dist/src/utils/visual/vertex/index.d.ts +4 -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/{wasm.js → src/wasm/index.js} +4 -8
- package/dist/test/writeFile.test.d.ts +1 -0
- package/dist/tsconfig.json +1 -0
- package/dist/umd/index.umd.cjs +1 -1
- package/dist/umd/ml/ml.umd.cjs +1 -1
- package/dist/umd/node/node.umd.cjs +1 -1
- package/dist/umd/react/react.umd.cjs +1 -1
- package/dist/umd/utils/utils.umd.cjs +1 -1
- package/dist/{ws-DoSbcWWZ.js → ws-CQA-0Bzm.js} +31 -53
- package/package.json +18 -16
- package/readme.md +6 -2
- package/typings.d.ts +4 -10
- package/dist/node.js +0 -27
- package/dist/react.js +0 -4
- package/dist/utils.js +0 -2092
- /package/dist/test/{server/encodeUrl.test.d.ts → encodeUrl.test.d.ts} +0 -0
- /package/dist/test/{server/escapeHtml.test.d.ts → escapeHtml.test.d.ts} +0 -0
- /package/dist/test/{server/mimeType.test.d.ts → mimeType.test.d.ts} +0 -0
- /package/dist/test/{server/server.test.d.ts → server.test.d.ts} +0 -0
- /package/dist/test/{server/status.test.d.ts → status.test.d.ts} +0 -0
- /package/dist/test/{file/writeFile.test.d.ts → totp.test.d.ts} +0 -0
- /package/dist/test/{server/websocket.test.d.ts → websocket.test.d.ts} +0 -0
|
@@ -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,10 @@
|
|
|
1
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
+
export declare class Application {
|
|
4
|
+
private renderer;
|
|
5
|
+
stage: Container;
|
|
6
|
+
view: HTMLCanvasElement;
|
|
7
|
+
constructor(options: IApplicationOptions);
|
|
8
|
+
private render;
|
|
9
|
+
private start;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/utils/visual/demo/sankey';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum ShapeType {
|
|
2
|
+
Rectangle = "rectangle",
|
|
3
|
+
Polygon = "polygon",
|
|
4
|
+
Circle = "circle",
|
|
5
|
+
Ellipse = "ellipse",
|
|
6
|
+
RoundedRectangle = "rounded rectangle"
|
|
7
|
+
}
|
|
8
|
+
export declare enum LineCap {
|
|
9
|
+
Butt = "butt",
|
|
10
|
+
Round = "round",
|
|
11
|
+
Square = "square"
|
|
12
|
+
}
|
|
13
|
+
export declare enum LineJoin {
|
|
14
|
+
Miter = "miter",
|
|
15
|
+
Bevel = "bevel",
|
|
16
|
+
Round = "round"
|
|
17
|
+
}
|
|
18
|
+
export declare enum RendererType {
|
|
19
|
+
WebGl = "webgl",
|
|
20
|
+
Canvas = "canvas"
|
|
21
|
+
}
|
|
@@ -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,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,19 @@
|
|
|
1
|
+
import { Container } from "@/utils/visual/vertex/container";
|
|
2
|
+
import { Polygon } from "@/utils/visual/shape/polygon";
|
|
3
|
+
import type { Shape } from "@/utils/visual/shape/shape";
|
|
4
|
+
import type { CanvasRenderer } from '@/utils/visual/render/canvasRenderer';
|
|
5
|
+
export declare class Graphics extends Container {
|
|
6
|
+
private _lineStyle;
|
|
7
|
+
private _fillStyle;
|
|
8
|
+
private _geometry;
|
|
9
|
+
currentPath: Polygon | null;
|
|
10
|
+
constructor();
|
|
11
|
+
protected drawShape(shape: Shape): Graphics;
|
|
12
|
+
/**
|
|
13
|
+
* 清空已有的 path,开始新的 path
|
|
14
|
+
*/
|
|
15
|
+
protected startPoly(): void;
|
|
16
|
+
beginFill(color?: string, alpha?: number): Graphics;
|
|
17
|
+
drawRect(x: number, y: number, width: number, height: number): Graphics;
|
|
18
|
+
protected renderCanvas(render: CanvasRenderer): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
points: number[];
|
|
9
|
+
constructor(shape: Shape, fillStyle: Fill, lineStyle: Line);
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import { GraphicsData } from '@/utils/visual/graphics/graphicsData';
|
|
5
|
+
export declare class GraphicsGeometry {
|
|
6
|
+
graphicsData: GraphicsData[];
|
|
7
|
+
constructor();
|
|
8
|
+
drawShape(shape: Shape, fillStyle: Fill, lineStyle: Line): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const getBezierLength: (P0X: number, P0Y: number, P1X: number, P1Y: number, P2X: number, P2Y: number, P3X: number, P3Y: number) => number;
|
|
2
|
+
export declare const getQuadraticBezierLength: (P0X: number, P0Y: number, P1X: number, P1Y: number, P2X: number, P2Y: number) => number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Point } from '@/utils/visual/vertex/point';
|
|
2
|
+
export declare class Matrix {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
c: number;
|
|
6
|
+
d: number;
|
|
7
|
+
tx: number;
|
|
8
|
+
ty: number;
|
|
9
|
+
constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
|
|
10
|
+
set(a: number, b: number, c: number, d: number, tx: number, ty: number): Matrix;
|
|
11
|
+
/**
|
|
12
|
+
* 将当前矩阵右乘一个矩阵
|
|
13
|
+
*/
|
|
14
|
+
append(m: Matrix): Matrix;
|
|
15
|
+
/**
|
|
16
|
+
* 对某个点应用当前的变换矩阵
|
|
17
|
+
* @param p 某个点
|
|
18
|
+
* @returns {Point} 点 p 应用当前变换矩阵后得到的一个新的点
|
|
19
|
+
*/
|
|
20
|
+
apply(p: Point): Point;
|
|
21
|
+
/**
|
|
22
|
+
* 对某个点应用当前的变换矩阵的逆矩阵
|
|
23
|
+
* @param p 某个点
|
|
24
|
+
* @returns {Point} 点 p 应用当前变换矩阵的逆矩阵后得到的一个新的点
|
|
25
|
+
*/
|
|
26
|
+
applyInverse(p: Point): Point;
|
|
27
|
+
/**
|
|
28
|
+
* 将当前矩阵左乘一个矩阵
|
|
29
|
+
*/
|
|
30
|
+
prepend(m: Matrix): Matrix;
|
|
31
|
+
clone(): Matrix;
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Matrix } from '@/utils/visual/math/matrix';
|
|
2
|
+
import { ObservablePoint } from '@/utils/visual/vertex/point';
|
|
3
|
+
export declare class Transform {
|
|
4
|
+
localTransform: Matrix;
|
|
5
|
+
worldTransform: Matrix;
|
|
6
|
+
position: ObservablePoint;
|
|
7
|
+
scale: ObservablePoint;
|
|
8
|
+
pivot: ObservablePoint;
|
|
9
|
+
skew: ObservablePoint;
|
|
10
|
+
_rotation: number;
|
|
11
|
+
private transformMatrix;
|
|
12
|
+
shouldUpdateLocalTransform: boolean;
|
|
13
|
+
shouldUpdateWorldTransform: boolean;
|
|
14
|
+
constructor();
|
|
15
|
+
get rotation(): number;
|
|
16
|
+
set rotation(r: number);
|
|
17
|
+
private onChange;
|
|
18
|
+
/**
|
|
19
|
+
* 更新 localTransform
|
|
20
|
+
*/
|
|
21
|
+
private updateLocalTransform;
|
|
22
|
+
/**
|
|
23
|
+
* @returns {boolean} true 说明 worldTransform 发生了改变,false 说明 worldTransform 没有发生改变
|
|
24
|
+
*/
|
|
25
|
+
updateTransform(parentTransform: Transform): boolean;
|
|
26
|
+
setFromMatrix(matrix: Matrix): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Renderer } from '@/utils/visual/render/render';
|
|
2
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
4
|
+
export declare class CanvasRenderer extends Renderer {
|
|
5
|
+
ctx: CanvasRenderingContext2D;
|
|
6
|
+
private background;
|
|
7
|
+
constructor(options: IApplicationOptions);
|
|
8
|
+
render(container: Container): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import { Rectangle } from '@/utils/visual/shape/rectangle';
|
|
3
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
4
|
+
export declare class Renderer {
|
|
5
|
+
canvasEle: HTMLCanvasElement;
|
|
6
|
+
screen: Rectangle;
|
|
7
|
+
constructor(options: IApplicationOptions);
|
|
8
|
+
resizeView(width: number, height: number): void;
|
|
9
|
+
render(container: Container): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Renderer } from '@/utils/visual/render/render';
|
|
2
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
4
|
+
export declare class WebGlRenderer extends Renderer {
|
|
5
|
+
constructor(options: IApplicationOptions);
|
|
6
|
+
render(container: Container): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Circle extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
radius: number;
|
|
8
|
+
readonly type = ShapeType.Circle;
|
|
9
|
+
constructor(x?: number, y?: number, radius?: number);
|
|
10
|
+
contains(point: Point): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Ellipse extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
radiusX: number;
|
|
8
|
+
radiusY: number;
|
|
9
|
+
readonly type = ShapeType.Ellipse;
|
|
10
|
+
constructor(x?: number, y?: number, radiusX?: number, radiusY?: number);
|
|
11
|
+
contains(p: Point): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Polygon extends Shape {
|
|
5
|
+
points: number[];
|
|
6
|
+
closeStroke: boolean;
|
|
7
|
+
type: ShapeType;
|
|
8
|
+
constructor();
|
|
9
|
+
contains(point: Point): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Rectangle extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
type: ShapeType;
|
|
10
|
+
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
11
|
+
contains(point: Point): boolean;
|
|
12
|
+
}
|