@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.
Files changed (139) hide show
  1. package/_site/assets/highlight.css +57 -0
  2. package/_site/assets/main.js +59 -0
  3. package/_site/assets/navigation.js +1 -0
  4. package/_site/assets/search.js +1 -0
  5. package/_site/assets/style.css +1383 -0
  6. package/_site/classes/AbstractError.html +28 -0
  7. package/_site/classes/Canvas.html +44 -0
  8. package/_site/classes/InternalError.html +32 -0
  9. package/_site/classes/InvalidArgumentError.html +28 -0
  10. package/_site/classes/InvalidOperationError.html +28 -0
  11. package/_site/classes/NotImplementedError.html +27 -0
  12. package/_site/classes/PermissionViolationError.html +28 -0
  13. package/_site/classes/Random.html +43 -0
  14. package/_site/classes/RenderLoop.html +30 -0
  15. package/_site/classes/ResourceConflictError.html +27 -0
  16. package/_site/classes/UnexpectedNilError.html +15 -0
  17. package/_site/classes/UnknownError.html +31 -0
  18. package/_site/classes/Vector2.html +113 -0
  19. package/_site/classes/Vector3.html +28 -0
  20. package/_site/functions/addVector2.html +5 -0
  21. package/_site/functions/blend.html +8 -0
  22. package/_site/functions/blendAdditive.html +8 -0
  23. package/_site/functions/blendSubtractive.html +8 -0
  24. package/_site/functions/cosDeg.html +4 -0
  25. package/_site/functions/deg2rad.html +4 -0
  26. package/_site/functions/difference.html +7 -0
  27. package/_site/functions/distance.html +7 -0
  28. package/_site/functions/errorToJSON.html +4 -0
  29. package/_site/functions/errorToRecord.html +4 -0
  30. package/_site/functions/errorToSimpleSerializable.html +4 -0
  31. package/_site/functions/filterType.html +7 -0
  32. package/_site/functions/formatString.html +7 -0
  33. package/_site/functions/formatStringTemplate.html +7 -0
  34. package/_site/functions/fromRGB.html +7 -0
  35. package/_site/functions/fromRGBA.html +7 -0
  36. package/_site/functions/getA.html +4 -0
  37. package/_site/functions/getB.html +4 -0
  38. package/_site/functions/getDocumentElementTypeById.html +9 -0
  39. package/_site/functions/getG.html +4 -0
  40. package/_site/functions/getR.html +4 -0
  41. package/_site/functions/intersect.html +8 -0
  42. package/_site/functions/is.html +7 -0
  43. package/_site/functions/isError.html +4 -0
  44. package/_site/functions/isInteger.html +4 -0
  45. package/_site/functions/isNil.html +5 -0
  46. package/_site/functions/isqrt.html +4 -0
  47. package/_site/functions/multiplyVector2.html +5 -0
  48. package/_site/functions/mustExist.html +6 -0
  49. package/_site/functions/nextPalette.html +2 -0
  50. package/_site/functions/putPixel32.html +7 -0
  51. package/_site/functions/putPixel32Add.html +7 -0
  52. package/_site/functions/putPixel32Sub.html +7 -0
  53. package/_site/functions/putSubPixel32.html +8 -0
  54. package/_site/functions/rad2deg.html +4 -0
  55. package/_site/functions/randomRange.html +6 -0
  56. package/_site/functions/safeRGBComponent.html +4 -0
  57. package/_site/functions/seedFromString.html +5 -0
  58. package/_site/functions/shuffleArray.html +5 -0
  59. package/_site/functions/sinDeg.html +4 -0
  60. package/_site/functions/sleep.html +4 -0
  61. package/_site/functions/somecolor.html +4 -0
  62. package/_site/functions/subtractVector2.html +5 -0
  63. package/_site/functions/toGrayScale.html +4 -0
  64. package/_site/functions/unknownToError.html +6 -0
  65. package/_site/index.html +1 -0
  66. package/_site/modules.html +72 -0
  67. package/_site/types/AnyConstructor.html +2 -0
  68. package/_site/types/AnyFunction.html +2 -0
  69. package/_site/types/ConstructorOf.html +2 -0
  70. package/_site/types/FunctionReturning.html +2 -0
  71. package/_site/types/Maybe.html +2 -0
  72. package/_site/types/Mixin.html +3 -0
  73. package/_site/types/Nil.html +3 -0
  74. package/_site/types/RenderLoopCallback.html +2 -0
  75. package/_site/types/SerializedError.html +2 -0
  76. package/_site/variables/PALETTES.html +2 -0
  77. package/_site/variables/TWO_PI.html +2 -0
  78. package/_site/variables/random-1.html +2 -0
  79. package/lib/array.d.ts +8 -0
  80. package/lib/array.js +8 -0
  81. package/lib/array.js.map +1 -1
  82. package/lib/dom/core.d.ts +3 -2
  83. package/lib/dom/core.js +3 -2
  84. package/lib/dom/core.js.map +1 -1
  85. package/lib/error-serializer.d.ts +12 -6
  86. package/lib/error-serializer.js +10 -5
  87. package/lib/error-serializer.js.map +1 -1
  88. package/lib/errors/AbstractError.d.ts +4 -16
  89. package/lib/errors/AbstractError.js +4 -16
  90. package/lib/errors/AbstractError.js.map +1 -1
  91. package/lib/errors/InternalError.d.ts +6 -5
  92. package/lib/errors/InternalError.js +6 -7
  93. package/lib/errors/InternalError.js.map +1 -1
  94. package/lib/errors/InvalidArgumentError.d.ts +2 -1
  95. package/lib/errors/InvalidArgumentError.js +2 -1
  96. package/lib/errors/InvalidArgumentError.js.map +1 -1
  97. package/lib/errors/InvalidOperationError.d.ts +2 -1
  98. package/lib/errors/InvalidOperationError.js +2 -1
  99. package/lib/errors/InvalidOperationError.js.map +1 -1
  100. package/lib/errors/NotImplementedError.d.ts +2 -1
  101. package/lib/errors/NotImplementedError.js +2 -1
  102. package/lib/errors/NotImplementedError.js.map +1 -1
  103. package/lib/errors/PermissionViolationError.d.ts +2 -1
  104. package/lib/errors/PermissionViolationError.js +2 -1
  105. package/lib/errors/PermissionViolationError.js.map +1 -1
  106. package/lib/errors/ResourceConflictError.d.ts +2 -1
  107. package/lib/errors/ResourceConflictError.js +2 -1
  108. package/lib/errors/ResourceConflictError.js.map +1 -1
  109. package/lib/errors/UnknownError.d.ts +6 -5
  110. package/lib/errors/UnknownError.js +6 -5
  111. package/lib/errors/UnknownError.js.map +1 -1
  112. package/lib/graphics/canvas.d.ts +40 -25
  113. package/lib/graphics/canvas.js +51 -24
  114. package/lib/graphics/canvas.js.map +1 -1
  115. package/lib/graphics/core.d.ts +18 -0
  116. package/lib/graphics/core.js +18 -0
  117. package/lib/graphics/core.js.map +1 -1
  118. package/lib/graphics/render-loop.d.ts +14 -2
  119. package/lib/graphics/render-loop.js +13 -2
  120. package/lib/graphics/render-loop.js.map +1 -1
  121. package/lib/math/core.d.ts +12 -1
  122. package/lib/math/core.js +12 -1
  123. package/lib/math/core.js.map +1 -1
  124. package/lib/math/vector2.d.ts +32 -1
  125. package/lib/math/vector2.js +45 -1
  126. package/lib/math/vector2.js.map +1 -1
  127. package/lib/math/vector3.d.ts +2 -1
  128. package/lib/math/vector3.js +2 -1
  129. package/lib/math/vector3.js.map +1 -1
  130. package/lib/nil.d.ts +1 -0
  131. package/lib/nil.js +1 -0
  132. package/lib/nil.js.map +1 -1
  133. package/lib/random.d.ts +34 -1
  134. package/lib/random.js +160 -2
  135. package/lib/random.js.map +1 -1
  136. package/lib/string-formatter.d.ts +2 -0
  137. package/lib/string-formatter.js +2 -0
  138. package/lib/string-formatter.js.map +1 -1
  139. 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 {@link AbstractError}.
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 {@link AbstractError}, or one of its subclasses.
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 {@link AbstractError}, `false` otherwise.
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":"AAEA;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC;;;;OAIG;IACH,MAAM,CAAS;IAEf;;;OAGG;IACH,KAAK,CAAe;IAEpB;;;OAGG;IACH,IAAI,CAAgB;IAEpB;;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;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,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
+ {"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 `Error`-like object was caught and converted into an
4
- * implementation of `AbstractError` for further processing.
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 {@link InternalError}.
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 {@link InternalError}.
15
+ * Converts an error into an {@linkcode InternalError}.
15
16
  * @param error The error to convert.
16
- * @returns An {@link InternalError} that represents the given error.
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 `Error`-like object was caught and converted into an
4
- * implementation of `AbstractError` for further processing.
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 {@link InternalError}.
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 {@link InternalError}.
21
+ * Converts an error into an {@linkcode InternalError}.
21
22
  * @param error The error to convert.
22
- * @returns An {@link InternalError} that represents the given error.
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;;;GAGG;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,uBAAuB;QACvB,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAC5B,0CAA0C;QAC1C,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
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 {@link InvalidArgumentError}.
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 {@link InvalidArgumentError}.
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;;;GAGG;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"}
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 {@link InvalidOperationError}.
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 {@link InvalidOperationError}.
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;;;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
+ {"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 {@link NotImplementedError}.
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 {@link NotImplementedError}.
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;;GAEG;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"}
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 {@link PermissionViolationError}.
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 {@link PermissionViolationError}.
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;;;GAGG;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
+ {"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 {@link ResourceConflictError}.
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 {@link ResourceConflictError}.
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;;GAEG;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
+ {"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-`Error`-like object was caught and converted into a
4
- * real `Error` instance.
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 `UnknownError`.
7
- * To enrich an `Error`-like object that was caught, use the {@link InternalError}.
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 {@link UnknownError}.
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-`Error`-like object was caught and converted into a
4
- * real `Error` instance.
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 `UnknownError`.
7
- * To enrich an `Error`-like object that was caught, use the {@link InternalError}.
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 {@link UnknownError}.
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;;;;;;GAMG;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"}
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"}
@@ -1,12 +1,12 @@
1
1
  /// <reference types="@types/web" />
2
2
  /**
3
- * A wrapper around {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement HTMLCanvasElement}
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 https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement HTMLCanvasElement}
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 https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2 CanvasRenderingContext2D}
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 https://developer.mozilla.org/en-US/docs/Web/API/ImageData ImageData} object
25
+ * The {@linkcode !ImageData} object
27
26
  * that represents our frontbuffer, which is the canvas itself.
28
27
  */
29
- readonly pixMap: ImageData;
28
+ pixMap: ImageData;
30
29
  /**
31
- * Our backbuffer.
30
+ * Our back buffer.
32
31
  */
33
- readonly buffer: Uint8ClampedArray;
32
+ buffer: Uint8ClampedArray;
34
33
  /**
35
- * Constructs a new {@link Canvas}.
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 backbuffer onto the canvas.
49
+ * Draws the back buffer onto the canvas.
43
50
  */
44
51
  update(): void;
45
52
  /**
46
- * Returns the color of a pixel in the backbuffer.
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 backbuffer.
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 backbuffer with the given color.
61
- * @param color The color to fill the backbuffer with.
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 {@link Canvas}.
67
- * @param canvas The {@link Canvas} to interact with.
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 {@link Canvas}.
76
- * @param canvas The {@link Canvas} to interact with.
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 {@link Canvas}.
85
- * @param canvas The {@link Canvas} to interact with.
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 {@link Canvas}.
94
- * Compared to {@link putPixel32}, this function supports sub-pixel placement, but is dramatically slower.
95
- * @param canvas The {@link Canvas} to interact with.
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;