From 16cbe8ee7b802aa18c6403d7b5c63e528c8529bc Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Fri, 17 May 2024 01:32:10 -0700 Subject: [PATCH] Move util/Color to data/color/Color --- src/js/stendhal/Client.ts | 3 ++- src/js/stendhal/{util => data/color}/Color.ts | 20 +++++++++---------- src/js/stendhal/entity/Chest.ts | 11 +++++----- src/js/stendhal/entity/Creature.ts | 2 +- src/js/stendhal/entity/DomesticAnimal.ts | 4 ++-- src/js/stendhal/entity/NPC.ts | 2 +- src/js/stendhal/entity/Player.ts | 2 +- src/js/stendhal/entity/Portal.ts | 4 ++-- src/js/stendhal/entity/RPEntity.ts | 4 +++- src/js/stendhal/entity/User.ts | 3 ++- src/js/stendhal/sprite/NotificationBubble.ts | 4 +++- src/js/stendhal/sprite/SpeechBubble.ts | 3 ++- src/js/stendhal/sprite/TextBubble.ts | 2 +- .../stendhal/ui/component/MiniMapComponent.ts | 2 +- .../stendhal/ui/component/StatBarComponent.ts | 2 +- src/js/stendhal/util/NotificationType.ts | 2 +- 16 files changed, 38 insertions(+), 32 deletions(-) rename src/js/stendhal/{util => data/color}/Color.ts (96%) diff --git a/src/js/stendhal/Client.ts b/src/js/stendhal/Client.ts index f6c25da61b0..18afe03a8d8 100644 --- a/src/js/stendhal/Client.ts +++ b/src/js/stendhal/Client.ts @@ -17,6 +17,8 @@ import { singletons } from "./SingletonRepo"; import { Paths } from "./data/Paths"; +import { Color } from "./data/color/Color"; + import { Ground } from "./entity/Ground"; import { RPObject } from "./entity/RPObject"; @@ -36,7 +38,6 @@ import { DesktopUserInterfaceFactory } from "./ui/factory/DesktopUserInterfaceFa import { SingletonFloatingWindow } from "./ui/toolkit/SingletonFloatingWindow"; import { Chat } from "./util/Chat"; -import { Color } from "./util/Color"; import { DialogHandler } from "./util/DialogHandler"; diff --git a/src/js/stendhal/util/Color.ts b/src/js/stendhal/data/color/Color.ts similarity index 96% rename from src/js/stendhal/util/Color.ts rename to src/js/stendhal/data/color/Color.ts index 436f9da4a1c..47adce7dca3 100644 --- a/src/js/stendhal/util/Color.ts +++ b/src/js/stendhal/data/color/Color.ts @@ -10,11 +10,9 @@ * * ***************************************************************************/ -import { MathUtil } from "./MathUtil"; +import { MathUtil } from "../../util/MathUtil"; -// TODO: move to `data/color` directory - /** * Color representation class. */ @@ -228,7 +226,7 @@ export class Color { * * @param n {number} * Value to be converted. - * @return {util.Color.RGBColor} + * @return {data.color.Color.RGBColor} * RGB color representation. */ static numToRGB(n: number): RGBColor { @@ -243,7 +241,7 @@ export class Color { * * @param n {number} * Value to be converted. - * @return {util.Color.HSLColor} + * @return {data.color.Color.HSLColor} * HSL color representation. */ static numToHSL(n: number): HSLColor { @@ -257,7 +255,7 @@ export class Color { * * @param h {string} * Hex value to be converted. - * @return {util.Color.RGBColor} + * @return {data.color.Color.RGBColor} * RGB color representation. */ static hexToRGB(h: string): RGBColor { @@ -276,7 +274,7 @@ export class Color { * * @param h {string} * Hex value to be converted. - * @return {util.Color.HSLColor} + * @return {data.color.Color.HSLColor} * HSL color representation. */ static hexToHSL(h: string): HSLColor { @@ -288,9 +286,9 @@ export class Color { * * https://css-tricks.com/converting-color-spaces-in-javascript/ * - * @param rgb {util.Color.RGBColor} + * @param rgb {data.color.Color.RGBColor} * RGB color representation. - * @return {util.Color.HSLColor} + * @return {data.color.Color.HSLColor} * HSL color representation. */ static RGBToHSL(rgb: RGBColor): HSLColor { @@ -338,7 +336,7 @@ export class Color { * * @param rbg {string} * RGB formatted string. - * @return {util.Color.RGBColor} + * @return {data.color.Color.RGBColor} * Object with R/G/B numerical values. */ static parseRGB(rgb: string): RGBColor { @@ -351,7 +349,7 @@ export class Color { * * @parm hsl (strong} * HSL formatted string. - * @return {util.Color.HSLColor} + * @return {data.color.Color.HSLColor} * Object with H/S/L numerical values. */ static parseHSL(hsl: string): HSLColor { diff --git a/src/js/stendhal/entity/Chest.ts b/src/js/stendhal/entity/Chest.ts index af5a1f0b0ff..f6a9b7f63b7 100644 --- a/src/js/stendhal/entity/Chest.ts +++ b/src/js/stendhal/entity/Chest.ts @@ -9,15 +9,16 @@ * * ***************************************************************************/ +import { PopupInventory } from "./PopupInventory"; + +import { MenuItem } from "../action/MenuItem"; + +import { Color } from "../data/color/Color"; + import { FloatingWindow } from "../ui/toolkit/FloatingWindow"; import { ItemInventoryComponent } from "../ui/component/ItemInventoryComponent"; -import { PopupInventory } from "./PopupInventory"; - import { Chat } from "../util/Chat"; -import { Color } from "../util/Color"; - -import { MenuItem } from "../action/MenuItem"; declare var marauroa: any; declare var stendhal: any; diff --git a/src/js/stendhal/entity/Creature.ts b/src/js/stendhal/entity/Creature.ts index 385a0937293..79d3d55cb28 100644 --- a/src/js/stendhal/entity/Creature.ts +++ b/src/js/stendhal/entity/Creature.ts @@ -11,7 +11,7 @@ import { RPEntity } from "./RPEntity"; -import { Color } from "../util/Color"; +import { Color } from "../data/color/Color"; declare var marauroa: any; declare var stendhal: any; diff --git a/src/js/stendhal/entity/DomesticAnimal.ts b/src/js/stendhal/entity/DomesticAnimal.ts index af43252a4ad..137bdc52fee 100644 --- a/src/js/stendhal/entity/DomesticAnimal.ts +++ b/src/js/stendhal/entity/DomesticAnimal.ts @@ -1,5 +1,5 @@ /*************************************************************************** - * (C) Copyright 2003-2023 - Stendhal * + * (C) Copyright 2003-2024 - Stendhal * *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * @@ -12,7 +12,7 @@ import { RPEntity } from "./RPEntity"; import { MenuItem} from "../action/MenuItem"; -import { Color } from "../util/Color"; +import { Color } from "../data/color/Color"; declare var marauroa: any; declare var stendhal: any; diff --git a/src/js/stendhal/entity/NPC.ts b/src/js/stendhal/entity/NPC.ts index cc8fcf623bd..c614db4f97d 100644 --- a/src/js/stendhal/entity/NPC.ts +++ b/src/js/stendhal/entity/NPC.ts @@ -11,7 +11,7 @@ import { RPEntity } from "./RPEntity"; -import { Color } from "../util/Color"; +import { Color } from "../data/color/Color"; declare var stendhal: any; diff --git a/src/js/stendhal/entity/Player.ts b/src/js/stendhal/entity/Player.ts index 28ad3fc1d06..2a07d865204 100644 --- a/src/js/stendhal/entity/Player.ts +++ b/src/js/stendhal/entity/Player.ts @@ -21,7 +21,7 @@ import { UIComponentEnum } from "../ui/UIComponentEnum"; import { GroupPanelComponent } from "../ui/component/GroupPanelComponent"; -import { Color } from "../util/Color"; +import { Color } from "../data/color/Color"; export class Player extends RPEntity { diff --git a/src/js/stendhal/entity/Portal.ts b/src/js/stendhal/entity/Portal.ts index 00e3be2fef6..27a62d3ea7e 100644 --- a/src/js/stendhal/entity/Portal.ts +++ b/src/js/stendhal/entity/Portal.ts @@ -9,10 +9,10 @@ * * ***************************************************************************/ -import { MenuItem } from "../action/MenuItem"; import { Entity } from "./Entity"; +import { MenuItem } from "../action/MenuItem"; -import { Color } from "../util/Color"; +import { Color } from "../data/color/Color"; declare var marauroa: any; declare var stendhal: any; diff --git a/src/js/stendhal/entity/RPEntity.ts b/src/js/stendhal/entity/RPEntity.ts index aed8df4e07a..cc82e86f91c 100644 --- a/src/js/stendhal/entity/RPEntity.ts +++ b/src/js/stendhal/entity/RPEntity.ts @@ -16,8 +16,10 @@ import { ActiveEntity } from "./ActiveEntity"; import { Entity } from "./Entity"; import { singletons } from "../SingletonRepo"; import { MenuItem } from "../action/MenuItem"; + +import { Color } from "../data/color/Color"; + import { Chat } from "../util/Chat"; -import { Color } from "../util/Color"; import { Nature } from "../util/Nature"; import { Floater } from "../sprite/Floater"; diff --git a/src/js/stendhal/entity/User.ts b/src/js/stendhal/entity/User.ts index a5d59719651..5715cab6ff7 100644 --- a/src/js/stendhal/entity/User.ts +++ b/src/js/stendhal/entity/User.ts @@ -19,6 +19,8 @@ import { singletons } from "../SingletonRepo"; import { MenuItem } from "../action/MenuItem"; +import { Color } from "../data/color/Color"; + import { ui } from "../ui/UI"; import { UIComponentEnum } from "../ui/UIComponentEnum"; @@ -30,7 +32,6 @@ import { OutfitDialog } from "../ui/dialog/outfit/OutfitDialog"; import { FloatingWindow } from "../ui/toolkit/FloatingWindow"; -import { Color } from "../util/Color"; import { Direction } from "../util/Direction"; diff --git a/src/js/stendhal/sprite/NotificationBubble.ts b/src/js/stendhal/sprite/NotificationBubble.ts index 788a08d3541..df6d04b6ca1 100644 --- a/src/js/stendhal/sprite/NotificationBubble.ts +++ b/src/js/stendhal/sprite/NotificationBubble.ts @@ -13,8 +13,10 @@ declare var stendhal: any; import { TextBubble } from "./TextBubble"; + +import { Color } from "../data/color/Color"; + import { NotificationType } from "../util/NotificationType"; -import { Color } from "../util/Color"; import { Speech } from "../util/Speech"; diff --git a/src/js/stendhal/sprite/SpeechBubble.ts b/src/js/stendhal/sprite/SpeechBubble.ts index fafc1d411bc..2e8b71fc75c 100644 --- a/src/js/stendhal/sprite/SpeechBubble.ts +++ b/src/js/stendhal/sprite/SpeechBubble.ts @@ -13,9 +13,10 @@ declare var stendhal: any; import { TextBubble } from "./TextBubble"; +import { Color } from "../data/color/Color"; + import { RPEntity } from "../entity/RPEntity"; -import { Color } from "../util/Color"; import { Pair } from "../util/Pair"; import { Speech } from "../util/Speech"; diff --git a/src/js/stendhal/sprite/TextBubble.ts b/src/js/stendhal/sprite/TextBubble.ts index 7367dbe792a..97f4c1cc0fb 100644 --- a/src/js/stendhal/sprite/TextBubble.ts +++ b/src/js/stendhal/sprite/TextBubble.ts @@ -11,7 +11,7 @@ declare var stendhal: any; -import { Color } from "../util/Color"; +import { Color } from "../data/color/Color"; import { Pair } from "../util/Pair"; diff --git a/src/js/stendhal/ui/component/MiniMapComponent.ts b/src/js/stendhal/ui/component/MiniMapComponent.ts index 7837c2da768..ea0a5d464e8 100644 --- a/src/js/stendhal/ui/component/MiniMapComponent.ts +++ b/src/js/stendhal/ui/component/MiniMapComponent.ts @@ -16,7 +16,7 @@ import { Component } from "../toolkit/Component"; import { Player } from "../../entity/Player"; -import { Color } from "../../util/Color"; +import { Color } from "../../data/color/Color"; /** diff --git a/src/js/stendhal/ui/component/StatBarComponent.ts b/src/js/stendhal/ui/component/StatBarComponent.ts index 7b4fb591052..b25b384ca1b 100644 --- a/src/js/stendhal/ui/component/StatBarComponent.ts +++ b/src/js/stendhal/ui/component/StatBarComponent.ts @@ -10,7 +10,7 @@ ***************************************************************************/ import { Component } from "../toolkit/Component"; -import { Color } from "../../util/Color"; +import { Color } from "../../data/color/Color"; /** * TODO: move this to `ui.toolkit`. diff --git a/src/js/stendhal/util/NotificationType.ts b/src/js/stendhal/util/NotificationType.ts index ab7e813492b..a668c3a704a 100644 --- a/src/js/stendhal/util/NotificationType.ts +++ b/src/js/stendhal/util/NotificationType.ts @@ -10,7 +10,7 @@ * * ***************************************************************************/ -import { Color } from "./Color"; +import { Color } from "../data/color/Color"; export const NotificationType = {