@twin.org/image 0.0.4-next.7 → 0.9.0-next.1

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/es/color.js CHANGED
@@ -32,6 +32,8 @@ export class Color {
32
32
  * @param red The red element of the color.
33
33
  * @param green The green element of the color.
34
34
  * @param blue The blue element of the color.
35
+ * @throws GuardError if the parameters are invalid.
36
+ * @throws GeneralError If the values are out of range.
35
37
  */
36
38
  constructor(alpha, red, green, blue) {
37
39
  Guards.number(Color.CLASS_NAME, "alpha", alpha);
@@ -1 +1 @@
1
- {"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/color.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,+BAA+B;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;GAEG;AACH,MAAM,OAAO,KAAK;IACjB;;OAEG;IACI,MAAM,CAAU,UAAU,WAA2B;IAE5D;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,IAAI,CAAS;IAE9B;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,KAAK,CAAS;IAE/B;;;;;;OAMG;IACH,YAAY,KAAa,EAAE,GAAW,EAAE,KAAa,EAAE,IAAY;QAClE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,UAAgB,IAAI,CAAC,CAAC;QAEpD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;YAC9B,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC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.\n/* eslint-disable no-bitwise */\n\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Class to represent a color.\n */\nexport class Color {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Color>();\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _alpha: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _red: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _green: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _blue: number;\n\n\t/**\n\t * Create a new instance of color.\n\t * @param alpha The alpha element of the color.\n\t * @param red The red element of the color.\n\t * @param green The green element of the color.\n\t * @param blue The blue element of the color.\n\t */\n\tconstructor(alpha: number, red: number, green: number, blue: number) {\n\t\tGuards.number(Color.CLASS_NAME, nameof(alpha), alpha);\n\t\tGuards.number(Color.CLASS_NAME, nameof(red), red);\n\t\tGuards.number(Color.CLASS_NAME, nameof(green), green);\n\t\tGuards.number(Color.CLASS_NAME, nameof(blue), blue);\n\n\t\tif (alpha < 0 || alpha > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(alpha),\n\t\t\t\tvalue: alpha\n\t\t\t});\n\t\t}\n\t\tif (red < 0 || red > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(red),\n\t\t\t\tvalue: red\n\t\t\t});\n\t\t}\n\t\tif (green < 0 || green > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(green),\n\t\t\t\tvalue: green\n\t\t\t});\n\t\t}\n\t\tif (blue < 0 || blue > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(blue),\n\t\t\t\tvalue: blue\n\t\t\t});\n\t\t}\n\n\t\tthis._alpha = alpha;\n\t\tthis._red = red;\n\t\tthis._green = green;\n\t\tthis._blue = blue;\n\t}\n\n\t/**\n\t * Construct a color from a hex string.\n\t * @param hex The hex string to parse.\n\t * @returns The color.\n\t * @throws Error if the format is incorrect.\n\t */\n\tpublic static fromHex(hex: string): Color {\n\t\tGuards.stringValue(Color.CLASS_NAME, nameof(hex), hex);\n\n\t\tlet alpha;\n\t\tlet red;\n\t\tlet green;\n\t\tlet blue;\n\t\tif (/^#[\\dA-Fa-f]{3}$/.test(hex)) {\n\t\t\t// #RGB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 2).repeat(2);\n\t\t\tgreen = hex.slice(2, 3).repeat(2);\n\t\t\tblue = hex.slice(3, 4).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{4}$/.test(hex)) {\n\t\t\t// #ARGB\n\t\t\talpha = hex.slice(1, 2).repeat(2);\n\t\t\tred = hex.slice(2, 3).repeat(2);\n\t\t\tgreen = hex.slice(3, 4).repeat(2);\n\t\t\tblue = hex.slice(4, 5).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{6}$/.test(hex)) {\n\t\t\t// #RRGGBB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 3);\n\t\t\tgreen = hex.slice(3, 5);\n\t\t\tblue = hex.slice(5, 7);\n\t\t} else if (/^#[\\dA-Fa-f]{8}$/.test(hex)) {\n\t\t\t// #AARRGGBB\n\t\t\talpha = hex.slice(1, 3);\n\t\t\tred = hex.slice(3, 5);\n\t\t\tgreen = hex.slice(5, 7);\n\t\t\tblue = hex.slice(7, 9);\n\t\t} else {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"hex\", { hex });\n\t\t}\n\t\treturn new Color(\n\t\t\tNumber.parseInt(alpha, 16),\n\t\t\tNumber.parseInt(red, 16),\n\t\t\tNumber.parseInt(green, 16),\n\t\t\tNumber.parseInt(blue, 16)\n\t\t);\n\t}\n\n\t/**\n\t * Coerce an unknown type to a color.\n\t * @param value The value to try and convert.\n\t * @returns The color if one can be created.\n\t */\n\tpublic static coerce(value: unknown): Color | undefined {\n\t\tif (\n\t\t\tIs.object<Color>(value) &&\n\t\t\tIs.number(value._alpha) &&\n\t\t\tIs.number(value._red) &&\n\t\t\tIs.number(value._green) &&\n\t\t\tIs.number(value._blue)\n\t\t) {\n\t\t\treturn new Color(value._alpha, value._red, value._green, value._blue);\n\t\t} else if (Is.stringValue(value) && value.startsWith(\"#\")) {\n\t\t\ttry {\n\t\t\t\treturn Color.fromHex(value);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\t/**\n\t * Get the alpha element.\n\t * @returns The alpha element.\n\t */\n\tpublic alpha(): number {\n\t\treturn this._alpha;\n\t}\n\n\t/**\n\t * Get the red element.\n\t * @returns The red element.\n\t */\n\tpublic red(): number {\n\t\treturn this._red;\n\t}\n\n\t/**\n\t * Get the green element.\n\t * @returns The green element.\n\t */\n\tpublic green(): number {\n\t\treturn this._green;\n\t}\n\n\t/**\n\t * Get the blue element.\n\t * @returns The blue element.\n\t */\n\tpublic blue(): number {\n\t\treturn this._blue;\n\t}\n\n\t/**\n\t * Get color as argb.\n\t * @returns The color as argb.\n\t */\n\tpublic argb(): number {\n\t\treturn ((this._alpha << 24) | (this._red << 16) | (this._green << 8) | this._blue) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgba.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgba(): number {\n\t\treturn ((this._red << 24) | (this._green << 16) | (this._blue << 8) | this._alpha) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgb text.\n\t * @returns The color as rgb.\n\t */\n\tpublic rgbText(): string {\n\t\treturn `rgb(${this._red},${this._green},${this._blue})`;\n\t}\n\n\t/**\n\t * Get color as rgba text.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgbaText(): string {\n\t\treturn `rgba(${this._red},${this._green},${this._blue},${Math.round((this._alpha / 255) * 100) / 100})`;\n\t}\n\n\t/**\n\t * Get color as hex no alpha.\n\t * @returns The color as hex with no alpha component.\n\t */\n\tpublic hex(): string {\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${red}${green}${blue}`.toUpperCase();\n\t}\n\n\t/**\n\t * Get color as hex with alpha.\n\t * @returns The color as hex with with alpha component.\n\t */\n\tpublic hexWithAlpha(): string {\n\t\tconst alpha = `00${this._alpha.toString(16)}`.slice(-2);\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${alpha}${red}${green}${blue}`.toUpperCase();\n\t}\n}\n"]}
1
+ {"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/color.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,+BAA+B;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG1D;;GAEG;AACH,MAAM,OAAO,KAAK;IACjB;;OAEG;IACI,MAAM,CAAU,UAAU,WAA2B;IAE5D;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,IAAI,CAAS;IAE9B;;OAEG;IACc,MAAM,CAAS;IAEhC;;OAEG;IACc,KAAK,CAAS;IAE/B;;;;;;;;OAQG;IACH,YAAY,KAAa,EAAE,GAAW,EAAE,KAAa,EAAE,IAAY;QAClE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,UAAgB,IAAI,CAAC,CA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GAAG,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACvD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/* eslint-disable no-bitwise */\n\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Class to represent a color.\n */\nexport class Color {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Color>();\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _alpha: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _red: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _green: number;\n\n\t/**\n\t * @internal\n\t */\n\tprivate readonly _blue: number;\n\n\t/**\n\t * Create a new instance of color.\n\t * @param alpha The alpha element of the color.\n\t * @param red The red element of the color.\n\t * @param green The green element of the color.\n\t * @param blue The blue element of the color.\n\t * @throws GuardError if the parameters are invalid.\n\t * @throws GeneralError If the values are out of range.\n\t */\n\tconstructor(alpha: number, red: number, green: number, blue: number) {\n\t\tGuards.number(Color.CLASS_NAME, nameof(alpha), alpha);\n\t\tGuards.number(Color.CLASS_NAME, nameof(red), red);\n\t\tGuards.number(Color.CLASS_NAME, nameof(green), green);\n\t\tGuards.number(Color.CLASS_NAME, nameof(blue), blue);\n\n\t\tif (alpha < 0 || alpha > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(alpha),\n\t\t\t\tvalue: alpha\n\t\t\t});\n\t\t}\n\t\tif (red < 0 || red > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(red),\n\t\t\t\tvalue: red\n\t\t\t});\n\t\t}\n\t\tif (green < 0 || green > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(green),\n\t\t\t\tvalue: green\n\t\t\t});\n\t\t}\n\t\tif (blue < 0 || blue > 255) {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"range\", {\n\t\t\t\tprop: nameof(blue),\n\t\t\t\tvalue: blue\n\t\t\t});\n\t\t}\n\n\t\tthis._alpha = alpha;\n\t\tthis._red = red;\n\t\tthis._green = green;\n\t\tthis._blue = blue;\n\t}\n\n\t/**\n\t * Construct a color from a hex string.\n\t * @param hex The hex string to parse.\n\t * @returns The color.\n\t * @throws Error if the format is incorrect.\n\t */\n\tpublic static fromHex(hex: string): Color {\n\t\tGuards.stringValue(Color.CLASS_NAME, nameof(hex), hex);\n\n\t\tlet alpha;\n\t\tlet red;\n\t\tlet green;\n\t\tlet blue;\n\t\tif (/^#[\\dA-Fa-f]{3}$/.test(hex)) {\n\t\t\t// #RGB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 2).repeat(2);\n\t\t\tgreen = hex.slice(2, 3).repeat(2);\n\t\t\tblue = hex.slice(3, 4).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{4}$/.test(hex)) {\n\t\t\t// #ARGB\n\t\t\talpha = hex.slice(1, 2).repeat(2);\n\t\t\tred = hex.slice(2, 3).repeat(2);\n\t\t\tgreen = hex.slice(3, 4).repeat(2);\n\t\t\tblue = hex.slice(4, 5).repeat(2);\n\t\t} else if (/^#[\\dA-Fa-f]{6}$/.test(hex)) {\n\t\t\t// #RRGGBB\n\t\t\talpha = \"0xFF\";\n\t\t\tred = hex.slice(1, 3);\n\t\t\tgreen = hex.slice(3, 5);\n\t\t\tblue = hex.slice(5, 7);\n\t\t} else if (/^#[\\dA-Fa-f]{8}$/.test(hex)) {\n\t\t\t// #AARRGGBB\n\t\t\talpha = hex.slice(1, 3);\n\t\t\tred = hex.slice(3, 5);\n\t\t\tgreen = hex.slice(5, 7);\n\t\t\tblue = hex.slice(7, 9);\n\t\t} else {\n\t\t\tthrow new GeneralError(Color.CLASS_NAME, \"hex\", { hex });\n\t\t}\n\t\treturn new Color(\n\t\t\tNumber.parseInt(alpha, 16),\n\t\t\tNumber.parseInt(red, 16),\n\t\t\tNumber.parseInt(green, 16),\n\t\t\tNumber.parseInt(blue, 16)\n\t\t);\n\t}\n\n\t/**\n\t * Coerce an unknown type to a color.\n\t * @param value The value to try and convert.\n\t * @returns The color if one can be created.\n\t */\n\tpublic static coerce(value: unknown): Color | undefined {\n\t\tif (\n\t\t\tIs.object<Color>(value) &&\n\t\t\tIs.number(value._alpha) &&\n\t\t\tIs.number(value._red) &&\n\t\t\tIs.number(value._green) &&\n\t\t\tIs.number(value._blue)\n\t\t) {\n\t\t\treturn new Color(value._alpha, value._red, value._green, value._blue);\n\t\t} else if (Is.stringValue(value) && value.startsWith(\"#\")) {\n\t\t\ttry {\n\t\t\t\treturn Color.fromHex(value);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\t/**\n\t * Get the alpha element.\n\t * @returns The alpha element.\n\t */\n\tpublic alpha(): number {\n\t\treturn this._alpha;\n\t}\n\n\t/**\n\t * Get the red element.\n\t * @returns The red element.\n\t */\n\tpublic red(): number {\n\t\treturn this._red;\n\t}\n\n\t/**\n\t * Get the green element.\n\t * @returns The green element.\n\t */\n\tpublic green(): number {\n\t\treturn this._green;\n\t}\n\n\t/**\n\t * Get the blue element.\n\t * @returns The blue element.\n\t */\n\tpublic blue(): number {\n\t\treturn this._blue;\n\t}\n\n\t/**\n\t * Get color as argb.\n\t * @returns The color as argb.\n\t */\n\tpublic argb(): number {\n\t\treturn ((this._alpha << 24) | (this._red << 16) | (this._green << 8) | this._blue) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgba.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgba(): number {\n\t\treturn ((this._red << 24) | (this._green << 16) | (this._blue << 8) | this._alpha) >>> 0;\n\t}\n\n\t/**\n\t * Get color as rgb text.\n\t * @returns The color as rgb.\n\t */\n\tpublic rgbText(): string {\n\t\treturn `rgb(${this._red},${this._green},${this._blue})`;\n\t}\n\n\t/**\n\t * Get color as rgba text.\n\t * @returns The color as rgba.\n\t */\n\tpublic rgbaText(): string {\n\t\treturn `rgba(${this._red},${this._green},${this._blue},${Math.round((this._alpha / 255) * 100) / 100})`;\n\t}\n\n\t/**\n\t * Get color as hex no alpha.\n\t * @returns The color as hex with no alpha component.\n\t */\n\tpublic hex(): string {\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${red}${green}${blue}`.toUpperCase();\n\t}\n\n\t/**\n\t * Get color as hex with alpha.\n\t * @returns The color as hex with with alpha component.\n\t */\n\tpublic hexWithAlpha(): string {\n\t\tconst alpha = `00${this._alpha.toString(16)}`.slice(-2);\n\t\tconst red = `00${this._red.toString(16)}`.slice(-2);\n\t\tconst green = `00${this._green.toString(16)}`.slice(-2);\n\t\tconst blue = `00${this._blue.toString(16)}`.slice(-2);\n\t\treturn `#${alpha}${red}${green}${blue}`.toUpperCase();\n\t}\n}\n"]}
@@ -12,6 +12,8 @@ export declare class Color {
12
12
  * @param red The red element of the color.
13
13
  * @param green The green element of the color.
14
14
  * @param blue The blue element of the color.
15
+ * @throws GuardError if the parameters are invalid.
16
+ * @throws GeneralError If the values are out of range.
15
17
  */
16
18
  constructor(alpha: number, red: number, green: number, blue: number);
17
19
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,201 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.0-next.1](https://github.com/iotaledger/twin-framework/compare/image-v0.9.0-next.0...image-v0.9.0-next.1) (2026-06-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#206](https://github.com/iotaledger/twin-framework/issues/206)) ([ef0d4ee](https://github.com/iotaledger/twin-framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
9
+ * eslint migration to flat config ([74427d7](https://github.com/iotaledger/twin-framework/commit/74427d78d342167f7850e49ab87269326355befe))
10
+ * locales validation ([#197](https://github.com/iotaledger/twin-framework/issues/197)) ([55fdadb](https://github.com/iotaledger/twin-framework/commit/55fdadb13595ce0047f787bd1d4135d429a99f12))
11
+ * relocate core packages from tools ([bcab8f3](https://github.com/iotaledger/twin-framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
12
+ * typescript 6 update ([1d10f31](https://github.com/iotaledger/twin-framework/commit/1d10f31e6516ec622773f45e88af82fe749b384a))
13
+ * update dependencies ([4da77ab](https://github.com/iotaledger/twin-framework/commit/4da77ab30f499e52825ac5a76f51436ceb59c26e))
14
+ * update dependencies ([f3bd015](https://github.com/iotaledger/twin-framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
15
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/iotaledger/twin-framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * ensure __decorate is defined for decorators ([103a563](https://github.com/iotaledger/twin-framework/commit/103a563ce01ebdef6240d2e590e7b026e8692684))
21
+
22
+
23
+ ### Dependencies
24
+
25
+ * The following workspace dependencies were updated
26
+ * dependencies
27
+ * @twin.org/core bumped from 0.9.0-next.0 to 0.9.0-next.1
28
+ * @twin.org/nameof bumped from 0.9.0-next.0 to 0.9.0-next.1
29
+ * devDependencies
30
+ * @twin.org/nameof-transformer bumped from 0.9.0-next.0 to 0.9.0-next.1
31
+ * @twin.org/nameof-vitest-plugin bumped from 0.9.0-next.0 to 0.9.0-next.1
32
+ * @twin.org/validate-locales bumped from 0.9.0-next.0 to 0.9.0-next.1
33
+
34
+ ## [0.0.4-next.15](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.14...image-v0.0.4-next.15) (2026-06-19)
35
+
36
+
37
+ ### Miscellaneous Chores
38
+
39
+ * **image:** Synchronize repo versions
40
+
41
+
42
+ ### Dependencies
43
+
44
+ * The following workspace dependencies were updated
45
+ * dependencies
46
+ * @twin.org/core bumped from 0.0.4-next.14 to 0.0.4-next.15
47
+ * @twin.org/nameof bumped from 0.0.4-next.14 to 0.0.4-next.15
48
+ * devDependencies
49
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.14 to 0.0.4-next.15
50
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.14 to 0.0.4-next.15
51
+ * @twin.org/validate-locales bumped from 0.0.4-next.14 to 0.0.4-next.15
52
+
53
+ ## [0.0.4-next.14](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.13...image-v0.0.4-next.14) (2026-06-18)
54
+
55
+
56
+ ### Miscellaneous Chores
57
+
58
+ * **image:** Synchronize repo versions
59
+
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @twin.org/core bumped from 0.0.4-next.13 to 0.0.4-next.14
66
+ * @twin.org/nameof bumped from 0.0.4-next.13 to 0.0.4-next.14
67
+ * devDependencies
68
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.13 to 0.0.4-next.14
69
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.13 to 0.0.4-next.14
70
+ * @twin.org/validate-locales bumped from 0.0.4-next.13 to 0.0.4-next.14
71
+
72
+ ## [0.0.4-next.13](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.12...image-v0.0.4-next.13) (2026-06-18)
73
+
74
+
75
+ ### Miscellaneous Chores
76
+
77
+ * **image:** Synchronize repo versions
78
+
79
+
80
+ ### Dependencies
81
+
82
+ * The following workspace dependencies were updated
83
+ * dependencies
84
+ * @twin.org/core bumped from 0.0.4-next.12 to 0.0.4-next.13
85
+ * @twin.org/nameof bumped from 0.0.4-next.12 to 0.0.4-next.13
86
+ * devDependencies
87
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.12 to 0.0.4-next.13
88
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.12 to 0.0.4-next.13
89
+ * @twin.org/validate-locales bumped from 0.0.4-next.12 to 0.0.4-next.13
90
+
91
+ ## [0.0.4-next.12](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.11...image-v0.0.4-next.12) (2026-06-18)
92
+
93
+
94
+ ### Miscellaneous Chores
95
+
96
+ * **image:** Synchronize repo versions
97
+
98
+
99
+ ### Dependencies
100
+
101
+ * The following workspace dependencies were updated
102
+ * dependencies
103
+ * @twin.org/core bumped from 0.0.4-next.11 to 0.0.4-next.12
104
+ * @twin.org/nameof bumped from 0.0.4-next.11 to 0.0.4-next.12
105
+ * devDependencies
106
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.11 to 0.0.4-next.12
107
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.11 to 0.0.4-next.12
108
+ * @twin.org/validate-locales bumped from 0.0.4-next.11 to 0.0.4-next.12
109
+
110
+ ## [0.0.4-next.11](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.10...image-v0.0.4-next.11) (2026-06-15)
111
+
112
+
113
+ ### Miscellaneous Chores
114
+
115
+ * **image:** Synchronize repo versions
116
+
117
+
118
+ ### Dependencies
119
+
120
+ * The following workspace dependencies were updated
121
+ * dependencies
122
+ * @twin.org/core bumped from 0.0.4-next.10 to 0.0.4-next.11
123
+ * @twin.org/nameof bumped from 0.0.4-next.10 to 0.0.4-next.11
124
+ * devDependencies
125
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.10 to 0.0.4-next.11
126
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.10 to 0.0.4-next.11
127
+ * @twin.org/validate-locales bumped from 0.0.4-next.10 to 0.0.4-next.11
128
+
129
+ ## [0.0.4-next.10](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.9...image-v0.0.4-next.10) (2026-06-15)
130
+
131
+
132
+ ### Features
133
+
134
+ * add context id features ([#206](https://github.com/iotaledger/twin-framework/issues/206)) ([ef0d4ee](https://github.com/iotaledger/twin-framework/commit/ef0d4ee11a4f5fc6cc6f52a4958ce905c04ee13b))
135
+ * add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/iotaledger/twin-framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
136
+ * eslint migration to flat config ([74427d7](https://github.com/iotaledger/twin-framework/commit/74427d78d342167f7850e49ab87269326355befe))
137
+ * locales validation ([#197](https://github.com/iotaledger/twin-framework/issues/197)) ([55fdadb](https://github.com/iotaledger/twin-framework/commit/55fdadb13595ce0047f787bd1d4135d429a99f12))
138
+ * relocate core packages from tools ([bcab8f3](https://github.com/iotaledger/twin-framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
139
+ * typescript 6 update ([1d10f31](https://github.com/iotaledger/twin-framework/commit/1d10f31e6516ec622773f45e88af82fe749b384a))
140
+ * update dependencies ([4da77ab](https://github.com/iotaledger/twin-framework/commit/4da77ab30f499e52825ac5a76f51436ceb59c26e))
141
+ * update dependencies ([f3bd015](https://github.com/iotaledger/twin-framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
142
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/iotaledger/twin-framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
143
+
144
+
145
+ ### Bug Fixes
146
+
147
+ * ensure __decorate is defined for decorators ([103a563](https://github.com/iotaledger/twin-framework/commit/103a563ce01ebdef6240d2e590e7b026e8692684))
148
+
149
+
150
+ ### Dependencies
151
+
152
+ * The following workspace dependencies were updated
153
+ * dependencies
154
+ * @twin.org/core bumped from 0.0.4-next.9 to 0.0.4-next.10
155
+ * @twin.org/nameof bumped from 0.0.4-next.9 to 0.0.4-next.10
156
+ * devDependencies
157
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.9 to 0.0.4-next.10
158
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.9 to 0.0.4-next.10
159
+ * @twin.org/validate-locales bumped from 0.0.4-next.9 to 0.0.4-next.10
160
+
161
+ ## [0.0.4-next.9](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.8...image-v0.0.4-next.9) (2026-06-15)
162
+
163
+
164
+ ### Miscellaneous Chores
165
+
166
+ * **image:** Synchronize repo versions
167
+
168
+
169
+ ### Dependencies
170
+
171
+ * The following workspace dependencies were updated
172
+ * dependencies
173
+ * @twin.org/core bumped from 0.0.4-next.8 to 0.0.4-next.9
174
+ * @twin.org/nameof bumped from 0.0.4-next.8 to 0.0.4-next.9
175
+ * devDependencies
176
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.8 to 0.0.4-next.9
177
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.8 to 0.0.4-next.9
178
+ * @twin.org/validate-locales bumped from 0.0.4-next.8 to 0.0.4-next.9
179
+
180
+ ## [0.0.4-next.8](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.7...image-v0.0.4-next.8) (2026-06-10)
181
+
182
+
183
+ ### Miscellaneous Chores
184
+
185
+ * **image:** Synchronize repo versions
186
+
187
+
188
+ ### Dependencies
189
+
190
+ * The following workspace dependencies were updated
191
+ * dependencies
192
+ * @twin.org/core bumped from 0.0.4-next.7 to 0.0.4-next.8
193
+ * @twin.org/nameof bumped from 0.0.4-next.7 to 0.0.4-next.8
194
+ * devDependencies
195
+ * @twin.org/nameof-transformer bumped from 0.0.4-next.7 to 0.0.4-next.8
196
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.4-next.7 to 0.0.4-next.8
197
+ * @twin.org/validate-locales bumped from 0.0.4-next.7 to 0.0.4-next.8
198
+
3
199
  ## [0.0.4-next.7](https://github.com/iotaledger/twin-framework/compare/image-v0.0.4-next.6...image-v0.0.4-next.7) (2026-06-10)
4
200
 
5
201
 
@@ -40,6 +40,14 @@ The blue element of the color.
40
40
 
41
41
  `Color`
42
42
 
43
+ #### Throws
44
+
45
+ GuardError if the parameters are invalid.
46
+
47
+ #### Throws
48
+
49
+ GeneralError If the values are out of range.
50
+
43
51
  ## Properties
44
52
 
45
53
  ### CLASS\_NAME {#class_name}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/image",
3
- "version": "0.0.4-next.7",
3
+ "version": "0.9.0-next.1",
4
4
  "description": "Classes for image manipulation",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.4-next.7",
18
- "@twin.org/nameof": "0.0.4-next.7"
17
+ "@twin.org/core": "0.9.0-next.1",
18
+ "@twin.org/nameof": "0.9.0-next.1"
19
19
  },
20
20
  "main": "./dist/es/index.js",
21
21
  "types": "./dist/types/index.d.ts",