@xivdyetools/core 1.3.7

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 (103) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +400 -0
  3. package/dist/constants/index.d.ts +56 -0
  4. package/dist/constants/index.d.ts.map +1 -0
  5. package/dist/constants/index.js +103 -0
  6. package/dist/constants/index.js.map +1 -0
  7. package/dist/data/colors_xiv.json +3130 -0
  8. package/dist/data/locales/de.json +231 -0
  9. package/dist/data/locales/en.json +231 -0
  10. package/dist/data/locales/fr.json +231 -0
  11. package/dist/data/locales/ja.json +231 -0
  12. package/dist/data/locales/ko.json +233 -0
  13. package/dist/data/locales/zh.json +233 -0
  14. package/dist/data/presets.json +390 -0
  15. package/dist/index.d.ts +16 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +18 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/services/APIService.d.ts +246 -0
  20. package/dist/services/APIService.d.ts.map +1 -0
  21. package/dist/services/APIService.js +499 -0
  22. package/dist/services/APIService.js.map +1 -0
  23. package/dist/services/ColorService.d.ts +146 -0
  24. package/dist/services/ColorService.d.ts.map +1 -0
  25. package/dist/services/ColorService.js +209 -0
  26. package/dist/services/ColorService.js.map +1 -0
  27. package/dist/services/DyeService.d.ts +230 -0
  28. package/dist/services/DyeService.d.ts.map +1 -0
  29. package/dist/services/DyeService.js +326 -0
  30. package/dist/services/DyeService.js.map +1 -0
  31. package/dist/services/LocalizationService.d.ts +338 -0
  32. package/dist/services/LocalizationService.d.ts.map +1 -0
  33. package/dist/services/LocalizationService.js +449 -0
  34. package/dist/services/LocalizationService.js.map +1 -0
  35. package/dist/services/PaletteService.d.ts +137 -0
  36. package/dist/services/PaletteService.d.ts.map +1 -0
  37. package/dist/services/PaletteService.js +349 -0
  38. package/dist/services/PaletteService.js.map +1 -0
  39. package/dist/services/PresetService.d.ts +196 -0
  40. package/dist/services/PresetService.d.ts.map +1 -0
  41. package/dist/services/PresetService.js +261 -0
  42. package/dist/services/PresetService.js.map +1 -0
  43. package/dist/services/color/ColorAccessibility.d.ts +39 -0
  44. package/dist/services/color/ColorAccessibility.d.ts.map +1 -0
  45. package/dist/services/color/ColorAccessibility.js +71 -0
  46. package/dist/services/color/ColorAccessibility.js.map +1 -0
  47. package/dist/services/color/ColorConverter.d.ts +146 -0
  48. package/dist/services/color/ColorConverter.d.ts.map +1 -0
  49. package/dist/services/color/ColorConverter.js +393 -0
  50. package/dist/services/color/ColorConverter.js.map +1 -0
  51. package/dist/services/color/ColorManipulator.d.ts +36 -0
  52. package/dist/services/color/ColorManipulator.d.ts.map +1 -0
  53. package/dist/services/color/ColorManipulator.js +56 -0
  54. package/dist/services/color/ColorManipulator.js.map +1 -0
  55. package/dist/services/color/ColorblindnessSimulator.d.ts +35 -0
  56. package/dist/services/color/ColorblindnessSimulator.d.ts.map +1 -0
  57. package/dist/services/color/ColorblindnessSimulator.js +110 -0
  58. package/dist/services/color/ColorblindnessSimulator.js.map +1 -0
  59. package/dist/services/dye/DyeDatabase.d.ts +131 -0
  60. package/dist/services/dye/DyeDatabase.d.ts.map +1 -0
  61. package/dist/services/dye/DyeDatabase.js +367 -0
  62. package/dist/services/dye/DyeDatabase.js.map +1 -0
  63. package/dist/services/dye/DyeSearch.d.ts +55 -0
  64. package/dist/services/dye/DyeSearch.d.ts.map +1 -0
  65. package/dist/services/dye/DyeSearch.js +196 -0
  66. package/dist/services/dye/DyeSearch.js.map +1 -0
  67. package/dist/services/dye/HarmonyGenerator.d.ts +110 -0
  68. package/dist/services/dye/HarmonyGenerator.d.ts.map +1 -0
  69. package/dist/services/dye/HarmonyGenerator.js +221 -0
  70. package/dist/services/dye/HarmonyGenerator.js.map +1 -0
  71. package/dist/services/localization/LocaleLoader.d.ts +38 -0
  72. package/dist/services/localization/LocaleLoader.d.ts.map +1 -0
  73. package/dist/services/localization/LocaleLoader.js +83 -0
  74. package/dist/services/localization/LocaleLoader.js.map +1 -0
  75. package/dist/services/localization/LocaleRegistry.d.ts +73 -0
  76. package/dist/services/localization/LocaleRegistry.d.ts.map +1 -0
  77. package/dist/services/localization/LocaleRegistry.js +84 -0
  78. package/dist/services/localization/LocaleRegistry.js.map +1 -0
  79. package/dist/services/localization/TranslationProvider.d.ts +157 -0
  80. package/dist/services/localization/TranslationProvider.d.ts.map +1 -0
  81. package/dist/services/localization/TranslationProvider.js +289 -0
  82. package/dist/services/localization/TranslationProvider.js.map +1 -0
  83. package/dist/types/index.d.ts +409 -0
  84. package/dist/types/index.d.ts.map +1 -0
  85. package/dist/types/index.js +87 -0
  86. package/dist/types/index.js.map +1 -0
  87. package/dist/types/logger.d.ts +84 -0
  88. package/dist/types/logger.d.ts.map +1 -0
  89. package/dist/types/logger.js +54 -0
  90. package/dist/types/logger.js.map +1 -0
  91. package/dist/utils/index.d.ts +441 -0
  92. package/dist/utils/index.d.ts.map +1 -0
  93. package/dist/utils/index.js +577 -0
  94. package/dist/utils/index.js.map +1 -0
  95. package/dist/utils/kd-tree.d.ts +76 -0
  96. package/dist/utils/kd-tree.d.ts.map +1 -0
  97. package/dist/utils/kd-tree.js +195 -0
  98. package/dist/utils/kd-tree.js.map +1 -0
  99. package/dist/version.d.ts +11 -0
  100. package/dist/version.d.ts.map +1 -0
  101. package/dist/version.js +11 -0
  102. package/dist/version.js.map +1 -0
  103. package/package.json +84 -0
@@ -0,0 +1,409 @@
1
+ /**
2
+ * @xivdyetools/core - Shared Type Definitions
3
+ *
4
+ * Type definitions for color science and FFXIV dyes
5
+ *
6
+ * @module types
7
+ */
8
+ export type { Logger } from './logger.js';
9
+ export { NoOpLogger, ConsoleLogger } from './logger.js';
10
+ /**
11
+ * RGB color representation
12
+ * @example { r: 255, g: 0, b: 0 } // Red
13
+ */
14
+ export interface RGB {
15
+ r: number;
16
+ g: number;
17
+ b: number;
18
+ }
19
+ /**
20
+ * HSV color representation (Hue, Saturation, Value)
21
+ * @example { h: 0, s: 100, v: 100 } // Bright red
22
+ */
23
+ export interface HSV {
24
+ h: number;
25
+ s: number;
26
+ v: number;
27
+ }
28
+ /**
29
+ * Hexadecimal color string (branded type for type safety)
30
+ * Per R-1: Branded types prevent type confusion
31
+ * @example "#FF0000"
32
+ */
33
+ export type HexColor = string & {
34
+ readonly __brand: 'HexColor';
35
+ };
36
+ /**
37
+ * Helper to create branded HexColor type with validation
38
+ * Per R-1: Validates hex format before creating branded type
39
+ * @throws {Error} If hex format is invalid
40
+ */
41
+ export declare function createHexColor(hex: string): HexColor;
42
+ /**
43
+ * Dye ID (branded type for type safety)
44
+ * Per R-1: Prevents accidental mixing with other numbers
45
+ */
46
+ export type DyeId = number & {
47
+ readonly __brand: 'DyeId';
48
+ };
49
+ /**
50
+ * Helper to create branded DyeId type with validation
51
+ * Per R-1: Validates dye ID is in valid range (1-200)
52
+ */
53
+ export declare function createDyeId(id: number): DyeId | null;
54
+ /**
55
+ * Hue value (0-360 degrees, branded type)
56
+ * Per R-1: Prevents mixing with other angle values
57
+ */
58
+ export type Hue = number & {
59
+ readonly __brand: 'Hue';
60
+ };
61
+ /**
62
+ * Helper to create branded Hue type with normalization
63
+ * Per R-1: Normalizes hue to 0-360 range
64
+ */
65
+ export declare function createHue(hue: number): Hue;
66
+ /**
67
+ * Saturation value (0-100 percent, branded type)
68
+ * Per R-1: Prevents mixing with other percentage values
69
+ */
70
+ export type Saturation = number & {
71
+ readonly __brand: 'Saturation';
72
+ };
73
+ /**
74
+ * Helper to create branded Saturation type with clamping
75
+ * Per R-1: Clamps saturation to 0-100 range
76
+ */
77
+ export declare function createSaturation(saturation: number): Saturation;
78
+ /**
79
+ * Vision types supported by accessibility checker
80
+ */
81
+ export type VisionType = 'normal' | 'deuteranopia' | 'protanopia' | 'tritanopia' | 'achromatopsia';
82
+ /**
83
+ * 3x3 transformation matrix for colorblindness simulation
84
+ * [row][column] indexing for RGB to RGB transformation
85
+ */
86
+ export type Matrix3x3 = [
87
+ [
88
+ number,
89
+ number,
90
+ number
91
+ ],
92
+ [
93
+ number,
94
+ number,
95
+ number
96
+ ],
97
+ [
98
+ number,
99
+ number,
100
+ number
101
+ ]
102
+ ];
103
+ /**
104
+ * Colorblindness transformation matrices (Brettel 1997)
105
+ */
106
+ export interface ColorblindMatrices {
107
+ deuteranopia: Matrix3x3;
108
+ protanopia: Matrix3x3;
109
+ tritanopia: Matrix3x3;
110
+ achromatopsia: Matrix3x3;
111
+ }
112
+ /**
113
+ * FFXIV dye object with color and metadata
114
+ */
115
+ export interface Dye {
116
+ itemID: number;
117
+ id: number;
118
+ name: string;
119
+ hex: string;
120
+ rgb: RGB;
121
+ hsv: HSV;
122
+ category: string;
123
+ acquisition: string;
124
+ cost: number;
125
+ isMetallic: boolean;
126
+ isPastel: boolean;
127
+ isDark: boolean;
128
+ isCosmic: boolean;
129
+ }
130
+ /**
131
+ * Localized dye with optional translated name
132
+ */
133
+ export interface LocalizedDye extends Dye {
134
+ localizedName?: string;
135
+ }
136
+ /**
137
+ * Supported locale codes
138
+ */
139
+ export type LocaleCode = 'en' | 'ja' | 'de' | 'fr' | 'ko' | 'zh';
140
+ /**
141
+ * Translation keys for UI labels
142
+ */
143
+ export type TranslationKey = 'dye' | 'dark' | 'metallic' | 'pastel' | 'cosmic' | 'cosmicExploration' | 'cosmicFortunes';
144
+ /**
145
+ * Harmony type keys
146
+ */
147
+ export type HarmonyTypeKey = 'complementary' | 'analogous' | 'triadic' | 'splitComplementary' | 'tetradic' | 'square' | 'monochromatic' | 'compound' | 'shades';
148
+ /**
149
+ * FFXIV Job keys for localization
150
+ */
151
+ export type JobKey = 'paladin' | 'warrior' | 'darkKnight' | 'gunbreaker' | 'whiteMage' | 'scholar' | 'astrologian' | 'sage' | 'monk' | 'dragoon' | 'ninja' | 'samurai' | 'reaper' | 'viper' | 'bard' | 'machinist' | 'dancer' | 'blackMage' | 'summoner' | 'redMage' | 'pictomancer' | 'blueMage';
152
+ /**
153
+ * FFXIV Grand Company keys for localization
154
+ */
155
+ export type GrandCompanyKey = 'maelstrom' | 'twinAdder' | 'immortalFlames';
156
+ /**
157
+ * Locale data structure matching generated JSON files
158
+ */
159
+ export interface LocaleData {
160
+ locale: LocaleCode;
161
+ meta: {
162
+ version: string;
163
+ generated: string;
164
+ dyeCount: number;
165
+ };
166
+ labels: Record<TranslationKey, string>;
167
+ dyeNames: Record<string, string>;
168
+ categories: Record<string, string>;
169
+ acquisitions: Record<string, string>;
170
+ metallicDyeIds: number[];
171
+ harmonyTypes: Record<HarmonyTypeKey, string>;
172
+ visionTypes: Record<VisionType, string>;
173
+ jobNames: Record<JobKey, string>;
174
+ grandCompanyNames: Record<GrandCompanyKey, string>;
175
+ }
176
+ /**
177
+ * Locale preference for resolving user's preferred language
178
+ * Priority: explicit > guild > system > fallback
179
+ */
180
+ export interface LocalePreference {
181
+ /** Explicit user selection (highest priority) */
182
+ explicit?: LocaleCode;
183
+ /** Guild/server preference (Discord only) */
184
+ guild?: string;
185
+ /** User's system language */
186
+ system?: string;
187
+ /** Fallback locale (always 'en') */
188
+ fallback: LocaleCode;
189
+ }
190
+ /**
191
+ * Universalis API response for item prices
192
+ */
193
+ export interface PriceData {
194
+ itemID: number;
195
+ currentAverage: number;
196
+ currentMinPrice: number;
197
+ currentMaxPrice: number;
198
+ lastUpdate: number;
199
+ }
200
+ /**
201
+ * Cached API data with TTL and integrity checking
202
+ */
203
+ export interface CachedData<T> {
204
+ data: T;
205
+ timestamp: number;
206
+ ttl: number;
207
+ version?: string;
208
+ checksum?: string;
209
+ }
210
+ /**
211
+ * Preset palette category identifiers
212
+ */
213
+ export type PresetCategory = 'jobs' | 'grand-companies' | 'seasons' | 'events' | 'aesthetics' | 'community';
214
+ /**
215
+ * Metadata for a preset category
216
+ */
217
+ export interface CategoryMeta {
218
+ /** Category identifier */
219
+ id?: string;
220
+ /** Display name (localized) */
221
+ name: string;
222
+ /** Category description */
223
+ description: string;
224
+ /** Optional icon/emoji */
225
+ icon?: string;
226
+ }
227
+ /**
228
+ * A preset color palette
229
+ */
230
+ export interface PresetPalette {
231
+ /** Unique identifier (e.g., "job-rdm", "season-autumn") */
232
+ id: string;
233
+ /** Display name (e.g., "Red Mage") */
234
+ name: string;
235
+ /** Category this preset belongs to */
236
+ category: PresetCategory;
237
+ /** Brief description of the palette */
238
+ description: string;
239
+ /** Array of dye itemIDs (3-5 dyes) */
240
+ dyes: number[];
241
+ /** Searchable tags */
242
+ tags: string[];
243
+ /** Credit for community submissions */
244
+ author?: string;
245
+ /** Version for future updates */
246
+ version?: string;
247
+ }
248
+ /**
249
+ * Preset with resolved Dye objects
250
+ */
251
+ export interface ResolvedPreset extends PresetPalette {
252
+ /** Full Dye objects for each dye ID */
253
+ resolvedDyes: (Dye | null)[];
254
+ }
255
+ /**
256
+ * Full preset data structure
257
+ */
258
+ export interface PresetData {
259
+ /** Data format version */
260
+ version: string;
261
+ /** Last update timestamp */
262
+ lastUpdated: string;
263
+ /** Category metadata */
264
+ categories: Record<PresetCategory, CategoryMeta>;
265
+ /** All preset palettes */
266
+ palettes: PresetPalette[];
267
+ }
268
+ /**
269
+ * Status of a community preset submission
270
+ */
271
+ export type PresetStatus = 'pending' | 'approved' | 'rejected' | 'flagged';
272
+ /**
273
+ * Community preset with voting and moderation data
274
+ * Extended version of PresetPalette for API responses
275
+ */
276
+ export interface CommunityPreset {
277
+ /** Unique identifier (UUID) */
278
+ id: string;
279
+ /** Display name */
280
+ name: string;
281
+ /** Brief description */
282
+ description: string;
283
+ /** Category this preset belongs to */
284
+ category_id: PresetCategory;
285
+ /** Array of dye item IDs (2-5 dyes) */
286
+ dyes: number[];
287
+ /** Searchable tags */
288
+ tags: string[];
289
+ /** Discord user ID of author (null for curated) */
290
+ author_discord_id: string | null;
291
+ /** Display name of author at submission time */
292
+ author_name: string | null;
293
+ /** Number of votes */
294
+ vote_count: number;
295
+ /** Moderation status */
296
+ status: PresetStatus;
297
+ /** True for official/curated presets */
298
+ is_curated: boolean;
299
+ /** ISO 8601 creation timestamp */
300
+ created_at: string;
301
+ /** ISO 8601 last update timestamp */
302
+ updated_at: string;
303
+ }
304
+ /**
305
+ * Data required to submit a new preset
306
+ */
307
+ export interface PresetSubmission {
308
+ /** Name (2-50 characters) */
309
+ name: string;
310
+ /** Description (10-200 characters) */
311
+ description: string;
312
+ /** Category */
313
+ category_id: PresetCategory;
314
+ /** Array of dye item IDs (2-5 dyes) */
315
+ dyes: number[];
316
+ /** Tags (0-10 tags, max 30 chars each) */
317
+ tags: string[];
318
+ /** Submitter's Discord user ID */
319
+ author_discord_id: string;
320
+ /** Submitter's display name */
321
+ author_name: string;
322
+ }
323
+ /**
324
+ * Response when listing presets
325
+ */
326
+ export interface PresetListResponse {
327
+ /** Array of presets */
328
+ presets: CommunityPreset[];
329
+ /** Total count (for pagination) */
330
+ total: number;
331
+ /** Current page number */
332
+ page: number;
333
+ /** Results per page */
334
+ limit: number;
335
+ /** True if more pages available */
336
+ has_more: boolean;
337
+ }
338
+ /**
339
+ * Response when submitting a preset
340
+ */
341
+ export interface PresetSubmitResponse {
342
+ /** Whether the operation succeeded */
343
+ success: boolean;
344
+ /** The created preset (if new) */
345
+ preset?: CommunityPreset;
346
+ /** The existing preset (if duplicate) */
347
+ duplicate?: CommunityPreset;
348
+ /** Whether a vote was added to duplicate */
349
+ vote_added?: boolean;
350
+ /** Moderation result */
351
+ moderation_status?: 'approved' | 'pending';
352
+ }
353
+ /**
354
+ * Response when voting on a preset
355
+ */
356
+ export interface VoteResponse {
357
+ /** Whether the operation succeeded */
358
+ success: boolean;
359
+ /** Updated vote count */
360
+ new_vote_count: number;
361
+ /** True if user already voted */
362
+ already_voted?: boolean;
363
+ }
364
+ /**
365
+ * Filters for listing presets
366
+ */
367
+ export interface PresetFilters {
368
+ /** Filter by category */
369
+ category?: PresetCategory;
370
+ /** Search term */
371
+ search?: string;
372
+ /** Filter by status */
373
+ status?: PresetStatus;
374
+ /** Sort order */
375
+ sort?: 'popular' | 'recent' | 'name';
376
+ /** Page number */
377
+ page?: number;
378
+ /** Results per page */
379
+ limit?: number;
380
+ /** Filter by curated status */
381
+ is_curated?: boolean;
382
+ }
383
+ /**
384
+ * Severity levels for application errors
385
+ */
386
+ export type ErrorSeverity = 'critical' | 'error' | 'warning' | 'info';
387
+ /**
388
+ * Custom error class with severity and code
389
+ */
390
+ export declare class AppError extends Error {
391
+ code: string;
392
+ severity: ErrorSeverity;
393
+ constructor(code: string, message: string, severity?: ErrorSeverity);
394
+ toJSON(): Record<string, unknown>;
395
+ }
396
+ /**
397
+ * Error codes for different failure scenarios
398
+ */
399
+ export declare enum ErrorCode {
400
+ INVALID_HEX_COLOR = "INVALID_HEX_COLOR",
401
+ INVALID_RGB_VALUE = "INVALID_RGB_VALUE",
402
+ DYE_NOT_FOUND = "DYE_NOT_FOUND",
403
+ DATABASE_LOAD_FAILED = "DATABASE_LOAD_FAILED",
404
+ INVALID_INPUT = "INVALID_INPUT",
405
+ API_CALL_FAILED = "API_CALL_FAILED",
406
+ LOCALE_LOAD_FAILED = "LOCALE_LOAD_FAILED",
407
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
408
+ }
409
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMxD;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAA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GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAExB,IAAI,EAAE,MAAM;IAEZ,QAAQ,EAAE,aAAa;gBAFvB,IAAI,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACR,QAAQ,GAAE,aAAuB;IAO1C,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CASlC;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;IAC/B,oBAAoB,yBAAyB;IAC7C,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;CAChC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @xivdyetools/core - Shared Type Definitions
3
+ *
4
+ * Type definitions for color science and FFXIV dyes
5
+ *
6
+ * @module types
7
+ */
8
+ export { NoOpLogger, ConsoleLogger } from './logger.js';
9
+ /**
10
+ * Helper to create branded HexColor type with validation
11
+ * Per R-1: Validates hex format before creating branded type
12
+ * @throws {Error} If hex format is invalid
13
+ */
14
+ export function createHexColor(hex) {
15
+ // Basic validation - must be #RRGGBB or #RGB format
16
+ if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(hex)) {
17
+ throw new Error(`Invalid hex color format: ${hex}. Expected #RRGGBB or #RGB format.`);
18
+ }
19
+ // Normalize to uppercase #RRGGBB
20
+ const normalized = hex.length === 4
21
+ ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`.toUpperCase()
22
+ : hex.toUpperCase();
23
+ return normalized;
24
+ }
25
+ /**
26
+ * Helper to create branded DyeId type with validation
27
+ * Per R-1: Validates dye ID is in valid range (1-200)
28
+ */
29
+ export function createDyeId(id) {
30
+ if (!Number.isInteger(id) || id < 1 || id > 200) {
31
+ return null;
32
+ }
33
+ return id;
34
+ }
35
+ /**
36
+ * Helper to create branded Hue type with normalization
37
+ * Per R-1: Normalizes hue to 0-360 range
38
+ */
39
+ export function createHue(hue) {
40
+ // Normalize to 0-360 range
41
+ const normalized = ((hue % 360) + 360) % 360;
42
+ return normalized;
43
+ }
44
+ /**
45
+ * Helper to create branded Saturation type with clamping
46
+ * Per R-1: Clamps saturation to 0-100 range
47
+ */
48
+ export function createSaturation(saturation) {
49
+ const clamped = Math.max(0, Math.min(100, saturation));
50
+ return clamped;
51
+ }
52
+ /**
53
+ * Custom error class with severity and code
54
+ */
55
+ export class AppError extends Error {
56
+ constructor(code, message, severity = 'error') {
57
+ super(message);
58
+ this.code = code;
59
+ this.severity = severity;
60
+ this.name = 'AppError';
61
+ Object.setPrototypeOf(this, AppError.prototype);
62
+ }
63
+ toJSON() {
64
+ return {
65
+ name: this.name,
66
+ code: this.code,
67
+ message: this.message,
68
+ severity: this.severity,
69
+ stack: this.stack,
70
+ };
71
+ }
72
+ }
73
+ /**
74
+ * Error codes for different failure scenarios
75
+ */
76
+ export var ErrorCode;
77
+ (function (ErrorCode) {
78
+ ErrorCode["INVALID_HEX_COLOR"] = "INVALID_HEX_COLOR";
79
+ ErrorCode["INVALID_RGB_VALUE"] = "INVALID_RGB_VALUE";
80
+ ErrorCode["DYE_NOT_FOUND"] = "DYE_NOT_FOUND";
81
+ ErrorCode["DATABASE_LOAD_FAILED"] = "DATABASE_LOAD_FAILED";
82
+ ErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
83
+ ErrorCode["API_CALL_FAILED"] = "API_CALL_FAILED";
84
+ ErrorCode["LOCALE_LOAD_FAILED"] = "LOCALE_LOAD_FAILED";
85
+ ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
86
+ })(ErrorCode || (ErrorCode = {}));
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,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AAC;AAC/B,CAAC;AA+YD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YACS,IAAY,EACnB,OAAe,EACR,WAA0B,OAAO;QAExC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QAEZ,aAAQ,GAAR,QAAQ,CAAyB;QAGxC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SASX;AATD,WAAY,SAAS;IACnB,oDAAuC,CAAA;IACvC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,0DAA6C,CAAA;IAC7C,4CAA+B,CAAA;IAC/B,gDAAmC,CAAA;IACnC,sDAAyC,CAAA;IACzC,4CAA+B,CAAA;AACjC,CAAC,EATW,SAAS,KAAT,SAAS,QASpB"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @xivdyetools/core - Logger Interface
3
+ *
4
+ * Injectable logger interface for library consumers to customize logging behavior.
5
+ * Prevents library code from polluting consumer application logs.
6
+ *
7
+ * @module types/logger
8
+ */
9
+ /**
10
+ * Logger interface for customizable logging
11
+ *
12
+ * Implement this interface to control how the library logs messages.
13
+ * By default, the library uses a no-op logger that suppresses all output.
14
+ *
15
+ * @example Using the console logger
16
+ * ```typescript
17
+ * import { ConsoleLogger, DyeService } from 'xivdyetools-core';
18
+ *
19
+ * // Enable console logging for debugging
20
+ * const dyeService = new DyeService({ logger: ConsoleLogger });
21
+ * ```
22
+ *
23
+ * @example Creating a custom logger
24
+ * ```typescript
25
+ * const myLogger: Logger = {
26
+ * info: (msg) => myLoggingFramework.info(`[xivdyetools] ${msg}`),
27
+ * warn: (msg) => myLoggingFramework.warn(`[xivdyetools] ${msg}`),
28
+ * error: (msg, error) => myLoggingFramework.error(`[xivdyetools] ${msg}`, error),
29
+ * debug: (msg) => myLoggingFramework.debug(`[xivdyetools] ${msg}`),
30
+ * };
31
+ * ```
32
+ */
33
+ export interface Logger {
34
+ /**
35
+ * Log an informational message
36
+ * @param message - Message to log
37
+ */
38
+ info: (message: string) => void;
39
+ /**
40
+ * Log a warning message
41
+ * @param message - Message to log
42
+ */
43
+ warn: (message: string) => void;
44
+ /**
45
+ * Log an error message
46
+ * @param message - Message to log
47
+ * @param error - Optional error object for additional context
48
+ */
49
+ error: (message: string, error?: unknown) => void;
50
+ /**
51
+ * Log a debug message (optional, typically suppressed in production)
52
+ * @param message - Message to log
53
+ */
54
+ debug?: (message: string) => void;
55
+ }
56
+ /**
57
+ * No-op logger that suppresses all output
58
+ *
59
+ * This is the default logger used by the library to prevent
60
+ * polluting consumer application logs.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * // Default behavior - no console output
65
+ * const service = new DyeService();
66
+ * ```
67
+ */
68
+ export declare const NoOpLogger: Logger;
69
+ /**
70
+ * Console logger for development and debugging
71
+ *
72
+ * Use this when you want to see library log messages in the console.
73
+ * Prefixes all messages with [xivdyetools] for easy identification.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * import { ConsoleLogger, DyeService } from 'xivdyetools-core';
78
+ *
79
+ * // Enable verbose logging during development
80
+ * const dyeService = new DyeService({ logger: ConsoleLogger });
81
+ * ```
82
+ */
83
+ export declare const ConsoleLogger: Logger;
84
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,MAAM;IACrB;;;OAGG;IACH,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC;;;OAGG;IACH,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC;;;;OAIG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAElD;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,MAW3B,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @xivdyetools/core - Logger Interface
3
+ *
4
+ * Injectable logger interface for library consumers to customize logging behavior.
5
+ * Prevents library code from polluting consumer application logs.
6
+ *
7
+ * @module types/logger
8
+ */
9
+ /**
10
+ * No-op logger that suppresses all output
11
+ *
12
+ * This is the default logger used by the library to prevent
13
+ * polluting consumer application logs.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Default behavior - no console output
18
+ * const service = new DyeService();
19
+ * ```
20
+ */
21
+ export const NoOpLogger = {
22
+ info: () => { },
23
+ warn: () => { },
24
+ error: () => { },
25
+ debug: () => { },
26
+ };
27
+ /**
28
+ * Console logger for development and debugging
29
+ *
30
+ * Use this when you want to see library log messages in the console.
31
+ * Prefixes all messages with [xivdyetools] for easy identification.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * import { ConsoleLogger, DyeService } from 'xivdyetools-core';
36
+ *
37
+ * // Enable verbose logging during development
38
+ * const dyeService = new DyeService({ logger: ConsoleLogger });
39
+ * ```
40
+ */
41
+ export const ConsoleLogger = {
42
+ info: (message) => console.info(`[xivdyetools] ${message}`),
43
+ warn: (message) => console.warn(`[xivdyetools] ${message}`),
44
+ error: (message, error) => {
45
+ if (error) {
46
+ console.error(`[xivdyetools] ${message}`, error);
47
+ }
48
+ else {
49
+ console.error(`[xivdyetools] ${message}`);
50
+ }
51
+ },
52
+ debug: (message) => console.debug(`[xivdyetools] ${message}`),
53
+ };
54
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqDH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC;IACnE,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC;IACnE,KAAK,EAAE,CAAC,OAAe,EAAE,KAAe,EAAE,EAAE;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,iBAAiB,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,OAAO,EAAE,CAAC;CACtE,CAAC"}