@oliversalzburg/js-utils 0.0.8 → 0.0.9
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/_site/assets/highlight.css +57 -0
- package/_site/assets/main.js +59 -0
- package/_site/assets/navigation.js +1 -0
- package/_site/assets/search.js +1 -0
- package/_site/assets/style.css +1383 -0
- package/_site/classes/AbstractError.html +28 -0
- package/_site/classes/Canvas.html +44 -0
- package/_site/classes/InternalError.html +32 -0
- package/_site/classes/InvalidArgumentError.html +28 -0
- package/_site/classes/InvalidOperationError.html +28 -0
- package/_site/classes/NotImplementedError.html +27 -0
- package/_site/classes/PermissionViolationError.html +28 -0
- package/_site/classes/Random.html +43 -0
- package/_site/classes/RenderLoop.html +30 -0
- package/_site/classes/ResourceConflictError.html +27 -0
- package/_site/classes/UnexpectedNilError.html +15 -0
- package/_site/classes/UnknownError.html +31 -0
- package/_site/classes/Vector2.html +113 -0
- package/_site/classes/Vector3.html +28 -0
- package/_site/functions/addVector2.html +5 -0
- package/_site/functions/blend.html +8 -0
- package/_site/functions/blendAdditive.html +8 -0
- package/_site/functions/blendSubtractive.html +8 -0
- package/_site/functions/cosDeg.html +4 -0
- package/_site/functions/deg2rad.html +4 -0
- package/_site/functions/difference.html +7 -0
- package/_site/functions/distance.html +7 -0
- package/_site/functions/errorToJSON.html +4 -0
- package/_site/functions/errorToRecord.html +4 -0
- package/_site/functions/errorToSimpleSerializable.html +4 -0
- package/_site/functions/filterType.html +7 -0
- package/_site/functions/formatString.html +7 -0
- package/_site/functions/formatStringTemplate.html +7 -0
- package/_site/functions/fromRGB.html +7 -0
- package/_site/functions/fromRGBA.html +7 -0
- package/_site/functions/getA.html +4 -0
- package/_site/functions/getB.html +4 -0
- package/_site/functions/getDocumentElementTypeById.html +9 -0
- package/_site/functions/getG.html +4 -0
- package/_site/functions/getR.html +4 -0
- package/_site/functions/intersect.html +8 -0
- package/_site/functions/is.html +7 -0
- package/_site/functions/isError.html +4 -0
- package/_site/functions/isInteger.html +4 -0
- package/_site/functions/isNil.html +5 -0
- package/_site/functions/isqrt.html +4 -0
- package/_site/functions/multiplyVector2.html +5 -0
- package/_site/functions/mustExist.html +6 -0
- package/_site/functions/nextPalette.html +2 -0
- package/_site/functions/putPixel32.html +7 -0
- package/_site/functions/putPixel32Add.html +7 -0
- package/_site/functions/putPixel32Sub.html +7 -0
- package/_site/functions/putSubPixel32.html +8 -0
- package/_site/functions/rad2deg.html +4 -0
- package/_site/functions/randomRange.html +6 -0
- package/_site/functions/safeRGBComponent.html +4 -0
- package/_site/functions/seedFromString.html +5 -0
- package/_site/functions/shuffleArray.html +5 -0
- package/_site/functions/sinDeg.html +4 -0
- package/_site/functions/sleep.html +4 -0
- package/_site/functions/somecolor.html +4 -0
- package/_site/functions/subtractVector2.html +5 -0
- package/_site/functions/toGrayScale.html +4 -0
- package/_site/functions/unknownToError.html +6 -0
- package/_site/index.html +1 -0
- package/_site/modules.html +72 -0
- package/_site/types/AnyConstructor.html +2 -0
- package/_site/types/AnyFunction.html +2 -0
- package/_site/types/ConstructorOf.html +2 -0
- package/_site/types/FunctionReturning.html +2 -0
- package/_site/types/Maybe.html +2 -0
- package/_site/types/Mixin.html +3 -0
- package/_site/types/Nil.html +3 -0
- package/_site/types/RenderLoopCallback.html +2 -0
- package/_site/types/SerializedError.html +2 -0
- package/_site/variables/PALETTES.html +2 -0
- package/_site/variables/TWO_PI.html +2 -0
- package/_site/variables/random-1.html +2 -0
- package/lib/array.d.ts +8 -0
- package/lib/array.js +8 -0
- package/lib/array.js.map +1 -1
- package/lib/dom/core.d.ts +3 -2
- package/lib/dom/core.js +3 -2
- package/lib/dom/core.js.map +1 -1
- package/lib/error-serializer.d.ts +12 -6
- package/lib/error-serializer.js +10 -5
- package/lib/error-serializer.js.map +1 -1
- package/lib/errors/AbstractError.d.ts +4 -16
- package/lib/errors/AbstractError.js +4 -16
- package/lib/errors/AbstractError.js.map +1 -1
- package/lib/errors/InternalError.d.ts +6 -5
- package/lib/errors/InternalError.js +6 -7
- package/lib/errors/InternalError.js.map +1 -1
- package/lib/errors/InvalidArgumentError.d.ts +2 -1
- package/lib/errors/InvalidArgumentError.js +2 -1
- package/lib/errors/InvalidArgumentError.js.map +1 -1
- package/lib/errors/InvalidOperationError.d.ts +2 -1
- package/lib/errors/InvalidOperationError.js +2 -1
- package/lib/errors/InvalidOperationError.js.map +1 -1
- package/lib/errors/NotImplementedError.d.ts +2 -1
- package/lib/errors/NotImplementedError.js +2 -1
- package/lib/errors/NotImplementedError.js.map +1 -1
- package/lib/errors/PermissionViolationError.d.ts +2 -1
- package/lib/errors/PermissionViolationError.js +2 -1
- package/lib/errors/PermissionViolationError.js.map +1 -1
- package/lib/errors/ResourceConflictError.d.ts +2 -1
- package/lib/errors/ResourceConflictError.js +2 -1
- package/lib/errors/ResourceConflictError.js.map +1 -1
- package/lib/errors/UnknownError.d.ts +6 -5
- package/lib/errors/UnknownError.js +6 -5
- package/lib/errors/UnknownError.js.map +1 -1
- package/lib/graphics/canvas.d.ts +40 -25
- package/lib/graphics/canvas.js +51 -24
- package/lib/graphics/canvas.js.map +1 -1
- package/lib/graphics/core.d.ts +18 -0
- package/lib/graphics/core.js +18 -0
- package/lib/graphics/core.js.map +1 -1
- package/lib/graphics/render-loop.d.ts +14 -2
- package/lib/graphics/render-loop.js +13 -2
- package/lib/graphics/render-loop.js.map +1 -1
- package/lib/math/core.d.ts +12 -1
- package/lib/math/core.js +12 -1
- package/lib/math/core.js.map +1 -1
- package/lib/math/vector2.d.ts +32 -1
- package/lib/math/vector2.js +45 -1
- package/lib/math/vector2.js.map +1 -1
- package/lib/math/vector3.d.ts +2 -1
- package/lib/math/vector3.js +2 -1
- package/lib/math/vector3.js.map +1 -1
- package/lib/nil.d.ts +1 -0
- package/lib/nil.js +1 -0
- package/lib/nil.js.map +1 -1
- package/lib/random.d.ts +34 -1
- package/lib/random.js +160 -2
- package/lib/random.js.map +1 -1
- package/lib/string-formatter.d.ts +2 -0
- package/lib/string-formatter.js +2 -0
- package/lib/string-formatter.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Base class for all errors.
|
|
3
|
+
* @group Errors
|
|
3
4
|
*/
|
|
4
5
|
export class AbstractError extends Error {
|
|
5
6
|
/**
|
|
6
7
|
* The HTTP status code to associate with this error.
|
|
7
|
-
* @deprecated We no longer respond to HTTP requests with error-specifc
|
|
8
|
-
* status codes.
|
|
9
8
|
*/
|
|
10
9
|
status;
|
|
11
|
-
/**
|
|
12
|
-
* Another error that should be transported with this error.
|
|
13
|
-
* @deprecated We don't make use of this or interpret nested errors at all.
|
|
14
|
-
*/
|
|
15
|
-
inner;
|
|
16
|
-
/**
|
|
17
|
-
* A user-friendly error message that may be transported to the client.
|
|
18
|
-
* @deprecated User-friendly errors should be read from `extensions`.
|
|
19
|
-
*/
|
|
20
|
-
info;
|
|
21
10
|
/**
|
|
22
11
|
* An application-unique, readable error code.
|
|
23
12
|
*/
|
|
24
13
|
code;
|
|
25
14
|
/**
|
|
26
|
-
* Constructs a new {@
|
|
15
|
+
* Constructs a new {@linkcode AbstractError}.
|
|
27
16
|
* @param code The main identification code for the error.
|
|
28
17
|
* @param message The main error message.
|
|
29
18
|
* @param status The HTTP status code to return.
|
|
@@ -33,18 +22,17 @@ export class AbstractError extends Error {
|
|
|
33
22
|
this.code = code;
|
|
34
23
|
this.name = "AbstractError";
|
|
35
24
|
this.status = status;
|
|
36
|
-
this.inner = null;
|
|
37
25
|
// Capture a new stacktrace, otherwise it will include our base-class constructor instead of the code
|
|
38
26
|
// location we're actually interested in.
|
|
39
27
|
Error.captureStackTrace(this, AbstractError);
|
|
40
28
|
}
|
|
41
29
|
/**
|
|
42
|
-
* Checks if an object is an instance of {@
|
|
30
|
+
* Checks if an object is an instance of {@linkcode AbstractError}, or one of its subclasses.
|
|
43
31
|
* @param error The object to check.
|
|
44
32
|
* @param allowForeignModule Only check for similar looking error codes.
|
|
45
33
|
* You're going to want to use this if you're dealing with a setup where
|
|
46
34
|
* multiple versions of js-utils are loaded.
|
|
47
|
-
* @returns `true` if the object is an {@
|
|
35
|
+
* @returns `true` if the object is an {@linkcode AbstractError}, `false` otherwise.
|
|
48
36
|
*/
|
|
49
37
|
static isAbstractError(error, allowForeignModule = true) {
|
|
50
38
|
if (error instanceof AbstractError) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractError.js","sourceRoot":"","sources":["../../source/errors/AbstractError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AbstractError.js","sourceRoot":"","sources":["../../source/errors/AbstractError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC;;OAEG;IACH,MAAM,CAAS;IAEf;;OAEG;IACH,IAAI,CAAS;IAEb;;;;;OAKG;IACH,YAAY,IAAY,EAAE,OAAe,EAAE,MAAc;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,qGAAqG;QACrG,yCAAyC;QACzC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,eAAe,CAAC,KAAc,EAAE,kBAAkB,GAAG,IAAI;QAC9D,IAAI,KAAK,YAAY,aAAa,EAAE;YAClC,OAAO,IAAI,CAAC;SACb;QAED,gEAAgE;QAChE,sEAAsE;QACtE,cAAc;QACd,IAAI,kBAAkB,EAAE;YACtB,MAAM,WAAW,GAAG,KAAgC,CAAC;YACrD,IACE,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK;gBACvB,MAAM,IAAI,WAAW;gBACrB,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,EACpC;gBACA,MAAM,UAAU,GAAG,KAAyB,CAAC;gBAC7C,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;oBACrC,OAAO,IAAI,CAAC;iBACb;aACF;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
|
-
* Used when an
|
|
4
|
-
* implementation of
|
|
3
|
+
* Used when an {@linkcode !Error}-like object was caught and converted into an
|
|
4
|
+
* implementation of {@linkcode AbstractError} for further processing.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export declare class InternalError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode InternalError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
12
13
|
constructor(message: string, status?: number);
|
|
13
14
|
/**
|
|
14
|
-
* Converts an error into an {@
|
|
15
|
+
* Converts an error into an {@linkcode InternalError}.
|
|
15
16
|
* @param error The error to convert.
|
|
16
|
-
* @returns An {@
|
|
17
|
+
* @returns An {@linkcode InternalError} that represents the given error.
|
|
17
18
|
*/
|
|
18
19
|
static fromError(error: Error): InternalError;
|
|
19
20
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
|
-
* Used when an
|
|
4
|
-
* implementation of
|
|
3
|
+
* Used when an {@linkcode !Error}-like object was caught and converted into an
|
|
4
|
+
* implementation of {@linkcode AbstractError} for further processing.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export class InternalError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode InternalError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -17,9 +18,9 @@ export class InternalError extends AbstractError {
|
|
|
17
18
|
Error.captureStackTrace(this, InternalError);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
|
-
* Converts an error into an {@
|
|
21
|
+
* Converts an error into an {@linkcode InternalError}.
|
|
21
22
|
* @param error The error to convert.
|
|
22
|
-
* @returns An {@
|
|
23
|
+
* @returns An {@linkcode InternalError} that represents the given error.
|
|
23
24
|
*/
|
|
24
25
|
static fromError(error) {
|
|
25
26
|
// Create a _real_ `InternalError` instance, which we will return later.
|
|
@@ -28,8 +29,6 @@ export class InternalError extends AbstractError {
|
|
|
28
29
|
// Then assign another `InternalError` to replace key fields, like:
|
|
29
30
|
// name, code, status, ...
|
|
30
31
|
Object.assign(internalError, error, new InternalError(error.message));
|
|
31
|
-
// Set the inner error.
|
|
32
|
-
internalError.inner = error;
|
|
33
32
|
// Inherit the original error stack again.
|
|
34
33
|
internalError.stack = error.stack;
|
|
35
34
|
return internalError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../source/errors/InternalError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../source/errors/InternalError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,iBAAiB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAE5B,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,KAAY;QAC3B,wEAAwE;QACxE,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvD,kEAAkE;QAClE,mEAAmE;QACnE,0BAA0B;QAC1B,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACtE,0CAA0C;QAC1C,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -2,10 +2,11 @@ import { AbstractError } from "./AbstractError.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Used when the user supplied an argument that is not valid in the current
|
|
4
4
|
* context.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export declare class InvalidArgumentError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode InvalidArgumentError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -2,10 +2,11 @@ import { AbstractError } from "./AbstractError.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Used when the user supplied an argument that is not valid in the current
|
|
4
4
|
* context.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export class InvalidArgumentError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode InvalidArgumentError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidArgumentError.js","sourceRoot":"","sources":["../../source/errors/InvalidArgumentError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"InvalidArgumentError.js","sourceRoot":"","sources":["../../source/errors/InvalidArgumentError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QAEnC,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -2,10 +2,11 @@ import { AbstractError } from "./AbstractError.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Used when an operation was attempted that can not be completed in the current
|
|
4
4
|
* context.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export declare class InvalidOperationError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode InvalidOperationError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -2,10 +2,11 @@ import { AbstractError } from "./AbstractError.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Used when an operation was attempted that can not be completed in the current
|
|
4
4
|
* context.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export class InvalidOperationError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode InvalidOperationError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvalidOperationError.js","sourceRoot":"","sources":["../../source/errors/InvalidOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"InvalidOperationError.js","sourceRoot":"","sources":["../../source/errors/InvalidOperationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IACtD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEnD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QAEpC,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
3
|
* Used when a called method actually hasn't been implemented yet (whoops).
|
|
4
|
+
* @group Errors
|
|
4
5
|
*/
|
|
5
6
|
export declare class NotImplementedError extends AbstractError {
|
|
6
7
|
/**
|
|
7
|
-
* Constructs a new {@
|
|
8
|
+
* Constructs a new {@linkcode NotImplementedError}.
|
|
8
9
|
* @param message The main error message.
|
|
9
10
|
* @param status The HTTP status code to return.
|
|
10
11
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
3
|
* Used when a called method actually hasn't been implemented yet (whoops).
|
|
4
|
+
* @group Errors
|
|
4
5
|
*/
|
|
5
6
|
export class NotImplementedError extends AbstractError {
|
|
6
7
|
/**
|
|
7
|
-
* Constructs a new {@
|
|
8
|
+
* Constructs a new {@linkcode NotImplementedError}.
|
|
8
9
|
* @param message The main error message.
|
|
9
10
|
* @param status The HTTP status code to return.
|
|
10
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotImplementedError.js","sourceRoot":"","sources":["../../source/errors/NotImplementedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"NotImplementedError.js","sourceRoot":"","sources":["../../source/errors/NotImplementedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IACpD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,wBAAwB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAElC,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -2,10 +2,11 @@ import { AbstractError } from "./AbstractError.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* An error used when access to a resource was requested, but the required
|
|
4
4
|
* permissions were not available.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export declare class PermissionViolationError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode PermissionViolationError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -2,10 +2,11 @@ import { AbstractError } from "./AbstractError.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* An error used when access to a resource was requested, but the required
|
|
4
4
|
* permissions were not available.
|
|
5
|
+
* @group Errors
|
|
5
6
|
*/
|
|
6
7
|
export class PermissionViolationError extends AbstractError {
|
|
7
8
|
/**
|
|
8
|
-
* Constructs a new {@
|
|
9
|
+
* Constructs a new {@linkcode PermissionViolationError}.
|
|
9
10
|
* @param message The main error message.
|
|
10
11
|
* @param status The HTTP status code to return.
|
|
11
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionViolationError.js","sourceRoot":"","sources":["../../source/errors/PermissionViolationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"PermissionViolationError.js","sourceRoot":"","sources":["../../source/errors/PermissionViolationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IACzD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,6BAA6B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEtD,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QAEvC,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
3
|
* Used when a resource conflict was detected.
|
|
4
|
+
* @group Errors
|
|
4
5
|
*/
|
|
5
6
|
export declare class ResourceConflictError extends AbstractError {
|
|
6
7
|
/**
|
|
7
|
-
* Constructs a new {@
|
|
8
|
+
* Constructs a new {@linkcode ResourceConflictError}.
|
|
8
9
|
* @param message The main error message.
|
|
9
10
|
* @param status The HTTP status code to return.
|
|
10
11
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
3
|
* Used when a resource conflict was detected.
|
|
4
|
+
* @group Errors
|
|
4
5
|
*/
|
|
5
6
|
export class ResourceConflictError extends AbstractError {
|
|
6
7
|
/**
|
|
7
|
-
* Constructs a new {@
|
|
8
|
+
* Constructs a new {@linkcode ResourceConflictError}.
|
|
8
9
|
* @param message The main error message.
|
|
9
10
|
* @param status The HTTP status code to return.
|
|
10
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceConflictError.js","sourceRoot":"","sources":["../../source/errors/ResourceConflictError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"ResourceConflictError.js","sourceRoot":"","sources":["../../source/errors/ResourceConflictError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IACtD;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEnD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QAEpC,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
|
-
* Used when an unknown, non
|
|
4
|
-
* real
|
|
3
|
+
* Used when an unknown, non-{@linkcode !Error}-like object was caught and converted into a
|
|
4
|
+
* real {@linkcode !Error} instance.
|
|
5
5
|
* Like when you catch a `throw "boom"`, we will convert the caught `"boom"`
|
|
6
|
-
* into an
|
|
7
|
-
* To enrich an
|
|
6
|
+
* into an {@linkcode UnknownError}.
|
|
7
|
+
* To enrich an {@linkcode !Error}-like object that was caught, use the {@linkcode InternalError}.
|
|
8
|
+
* @group Errors
|
|
8
9
|
*/
|
|
9
10
|
export declare class UnknownError extends AbstractError {
|
|
10
11
|
/**
|
|
11
|
-
* Constructs a new {@
|
|
12
|
+
* Constructs a new {@linkcode UnknownError}.
|
|
12
13
|
* @param message The main error message.
|
|
13
14
|
* @param status The HTTP status code to return.
|
|
14
15
|
*/
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AbstractError } from "./AbstractError.js";
|
|
2
2
|
/**
|
|
3
|
-
* Used when an unknown, non
|
|
4
|
-
* real
|
|
3
|
+
* Used when an unknown, non-{@linkcode !Error}-like object was caught and converted into a
|
|
4
|
+
* real {@linkcode !Error} instance.
|
|
5
5
|
* Like when you catch a `throw "boom"`, we will convert the caught `"boom"`
|
|
6
|
-
* into an
|
|
7
|
-
* To enrich an
|
|
6
|
+
* into an {@linkcode UnknownError}.
|
|
7
|
+
* To enrich an {@linkcode !Error}-like object that was caught, use the {@linkcode InternalError}.
|
|
8
|
+
* @group Errors
|
|
8
9
|
*/
|
|
9
10
|
export class UnknownError extends AbstractError {
|
|
10
11
|
/**
|
|
11
|
-
* Constructs a new {@
|
|
12
|
+
* Constructs a new {@linkcode UnknownError}.
|
|
12
13
|
* @param message The main error message.
|
|
13
14
|
* @param status The HTTP status code to return.
|
|
14
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnknownError.js","sourceRoot":"","sources":["../../source/errors/UnknownError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"UnknownError.js","sourceRoot":"","sources":["../../source/errors/UnknownError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,OAAO,YAAa,SAAQ,aAAa;IAC7C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAM,GAAG,GAAG;QACvC,KAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,qEAAqE;QACrE,yEAAyE;QACzE,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/lib/graphics/canvas.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="@types/web" />
|
|
2
2
|
/**
|
|
3
|
-
* A wrapper around {@linkcode
|
|
3
|
+
* A wrapper around {@linkcode !HTMLCanvasElement}
|
|
4
4
|
* to provide some convience for double-buffered drawing.
|
|
5
|
+
* @group Graphics
|
|
5
6
|
*/
|
|
6
7
|
export declare class Canvas {
|
|
7
8
|
/**
|
|
8
|
-
* The {@linkcode
|
|
9
|
-
* we're interacting with.
|
|
9
|
+
* The {@linkcode !HTMLCanvasElement} we're interacting with.
|
|
10
10
|
*/
|
|
11
11
|
readonly canvas: HTMLCanvasElement;
|
|
12
12
|
/**
|
|
@@ -18,84 +18,99 @@ export declare class Canvas {
|
|
|
18
18
|
*/
|
|
19
19
|
readonly height: number;
|
|
20
20
|
/**
|
|
21
|
-
* The {@linkcode
|
|
22
|
-
* we're using to draw to the canvas.
|
|
21
|
+
* The {@linkcode !CanvasRenderingContext2D} we're using to draw to the canvas.
|
|
23
22
|
*/
|
|
24
23
|
readonly context: CanvasRenderingContext2D;
|
|
25
24
|
/**
|
|
26
|
-
* The {@linkcode
|
|
25
|
+
* The {@linkcode !ImageData} object
|
|
27
26
|
* that represents our frontbuffer, which is the canvas itself.
|
|
28
27
|
*/
|
|
29
|
-
|
|
28
|
+
pixMap: ImageData;
|
|
30
29
|
/**
|
|
31
|
-
* Our
|
|
30
|
+
* Our back buffer.
|
|
32
31
|
*/
|
|
33
|
-
|
|
32
|
+
buffer: Uint8ClampedArray;
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
34
|
+
* Was this {@linkcode Canvas} created with the ability to copy the front buffer back into
|
|
35
|
+
* the back buffer?
|
|
36
|
+
*/
|
|
37
|
+
readonly supportReadBack: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Constructs a new {@linkcode Canvas}.
|
|
36
40
|
* @param canvas The canvas to wrap.
|
|
37
41
|
* @param width The width of the canvas.
|
|
38
42
|
* @param height The height of the canvas.
|
|
43
|
+
* @param supportReadBack Should this canvas support reading back from the front buffer?
|
|
44
|
+
* You will need this, if you plan to use regular canvas drawing on the front buffer, and
|
|
45
|
+
* read the results back into the back buffer.
|
|
39
46
|
*/
|
|
40
|
-
constructor(canvas: HTMLCanvasElement, width: number, height: number);
|
|
47
|
+
constructor(canvas: HTMLCanvasElement, width: number, height: number, supportReadBack?: boolean);
|
|
41
48
|
/**
|
|
42
|
-
* Draws the
|
|
49
|
+
* Draws the back buffer onto the canvas.
|
|
43
50
|
*/
|
|
44
51
|
update(): void;
|
|
45
52
|
/**
|
|
46
|
-
*
|
|
53
|
+
* Reads the front buffer back into the back buffer.
|
|
54
|
+
*/
|
|
55
|
+
bufferReadBack(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the color of a pixel in the back buffer.
|
|
47
58
|
* @param x The X coordinate to retrieve.
|
|
48
59
|
* @param y The X coordinate to retrieve.
|
|
49
60
|
* @returns The color of the pixel at the given local.
|
|
50
61
|
*/
|
|
51
62
|
getPixel32(x: number, y: number): number;
|
|
52
63
|
/**
|
|
53
|
-
* Colors a pixel in the
|
|
64
|
+
* Colors a pixel in the back buffer.
|
|
54
65
|
* @param x The X coordinate to color.
|
|
55
66
|
* @param y The Y coordinate to color.
|
|
56
67
|
* @param color The color to place at the coordinate.
|
|
57
68
|
*/
|
|
58
69
|
setPixel32(x: number, y: number, color: number): void;
|
|
59
70
|
/**
|
|
60
|
-
* Fills the entire
|
|
61
|
-
* @param color The color to fill the
|
|
71
|
+
* Fills the entire back buffer with the given color.
|
|
72
|
+
* @param color The color to fill the back buffer with.
|
|
62
73
|
*/
|
|
63
74
|
clearWith(color: number): void;
|
|
64
75
|
}
|
|
65
76
|
/**
|
|
66
|
-
* Linearly blends a new pixel with an existing color value in a {@
|
|
67
|
-
* @param canvas The {@
|
|
77
|
+
* Linearly blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
78
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
68
79
|
* @param x The X coordinate at which to place the pixel.
|
|
69
80
|
* @param y The Y coordinate at which to place the pixel.
|
|
70
81
|
* @param color The color of the pixel.
|
|
71
82
|
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
83
|
+
* @group Graphics
|
|
72
84
|
*/
|
|
73
85
|
export declare const putPixel32: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
74
86
|
/**
|
|
75
|
-
* Additively blends a new pixel with an existing color value in a {@
|
|
76
|
-
* @param canvas The {@
|
|
87
|
+
* Additively blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
88
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
77
89
|
* @param x The X coordinate at which to place the pixel.
|
|
78
90
|
* @param y The Y coordinate at which to place the pixel.
|
|
79
91
|
* @param color The color of the pixel.
|
|
80
92
|
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
93
|
+
* @group Graphics
|
|
81
94
|
*/
|
|
82
95
|
export declare const putPixel32Add: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
83
96
|
/**
|
|
84
|
-
* Subtractively blends a new pixel with an existing color value in a {@
|
|
85
|
-
* @param canvas The {@
|
|
97
|
+
* Subtractively blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
98
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
86
99
|
* @param x The X coordinate at which to place the pixel.
|
|
87
100
|
* @param y The Y coordinate at which to place the pixel.
|
|
88
101
|
* @param color The color of the pixel.
|
|
89
102
|
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
103
|
+
* @group Graphics
|
|
90
104
|
*/
|
|
91
105
|
export declare const putPixel32Sub: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|
|
92
106
|
/**
|
|
93
|
-
* Linearly blends a new pixel with an existing color value in a {@
|
|
94
|
-
* Compared to {@
|
|
95
|
-
* @param canvas The {@
|
|
107
|
+
* Linearly blends a new pixel with an existing color value in a {@linkcode Canvas}.
|
|
108
|
+
* Compared to {@linkcode putPixel32}, this function supports sub-pixel placement, but is dramatically slower.
|
|
109
|
+
* @param canvas The {@linkcode Canvas} to interact with.
|
|
96
110
|
* @param x The X coordinate at which to place the pixel.
|
|
97
111
|
* @param y The Y coordinate at which to place the pixel.
|
|
98
112
|
* @param color The color of the pixel.
|
|
99
113
|
* @param alpha The alpha value to use to blend the pixel with existing color at the location.
|
|
114
|
+
* @group Graphics
|
|
100
115
|
*/
|
|
101
116
|
export declare const putSubPixel32: (canvas: Canvas, x: number, y: number, color: number, alpha: number) => void;
|