@xivdyetools/core 1.3.7 → 1.4.0
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/data/locales/de.json +1 -1
- package/dist/data/locales/en.json +1 -1
- package/dist/data/locales/fr.json +1 -1
- package/dist/data/locales/ja.json +1 -1
- package/dist/types/index.d.ts +47 -374
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +17 -72
- package/dist/types/index.js.map +1 -1
- package/dist/types/logger.d.ts +10 -71
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/logger.js +7 -43
- package/dist/types/logger.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -1,409 +1,82 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @xivdyetools/core - Shared Type Definitions
|
|
3
3
|
*
|
|
4
|
-
* Type definitions for color science and FFXIV dyes
|
|
4
|
+
* Type definitions for color science and FFXIV dyes.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: These types are now re-exported from @xivdyetools/types for consistency
|
|
7
|
+
* across the xivdyetools ecosystem. For new projects, consider importing
|
|
8
|
+
* directly from @xivdyetools/types.
|
|
5
9
|
*
|
|
6
10
|
* @module types
|
|
7
11
|
*/
|
|
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
12
|
/**
|
|
215
|
-
*
|
|
13
|
+
* @deprecated Import directly from '@xivdyetools/logger/library' instead.
|
|
14
|
+
* These re-exports will be removed in the next major version.
|
|
216
15
|
*/
|
|
217
|
-
export
|
|
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
|
-
}
|
|
16
|
+
export type { Logger } from '@xivdyetools/logger/library';
|
|
227
17
|
/**
|
|
228
|
-
*
|
|
18
|
+
* @deprecated Import directly from '@xivdyetools/logger/library' instead.
|
|
19
|
+
* These re-exports will be removed in the next major version.
|
|
229
20
|
*/
|
|
230
|
-
export
|
|
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
|
-
}
|
|
21
|
+
export { NoOpLogger, ConsoleLogger } from '@xivdyetools/logger/library';
|
|
248
22
|
/**
|
|
249
|
-
*
|
|
23
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
24
|
+
* These re-exports will be removed in the next major version.
|
|
250
25
|
*/
|
|
251
|
-
export
|
|
252
|
-
/** Full Dye objects for each dye ID */
|
|
253
|
-
resolvedDyes: (Dye | null)[];
|
|
254
|
-
}
|
|
26
|
+
export type { RGB, HSV, HexColor, DyeId, Hue, Saturation } from '@xivdyetools/types';
|
|
255
27
|
/**
|
|
256
|
-
*
|
|
28
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
29
|
+
* These re-exports will be removed in the next major version.
|
|
257
30
|
*/
|
|
258
|
-
export
|
|
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
|
-
}
|
|
31
|
+
export { createHexColor, createDyeId, createHue, createSaturation } from '@xivdyetools/types';
|
|
268
32
|
/**
|
|
269
|
-
*
|
|
33
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
34
|
+
* These re-exports will be removed in the next major version.
|
|
270
35
|
*/
|
|
271
|
-
export type
|
|
36
|
+
export type { VisionType, Matrix3x3, ColorblindMatrices } from '@xivdyetools/types';
|
|
272
37
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
38
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
39
|
+
* These re-exports will be removed in the next major version.
|
|
275
40
|
*/
|
|
276
|
-
export
|
|
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
|
-
}
|
|
41
|
+
export type { Dye, LocalizedDye, DyeWithDistance, DyeDatabase } from '@xivdyetools/types';
|
|
304
42
|
/**
|
|
305
|
-
*
|
|
43
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
44
|
+
* These re-exports will be removed in the next major version.
|
|
306
45
|
*/
|
|
307
|
-
export
|
|
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
|
-
}
|
|
46
|
+
export type { PresetCategory, PresetStatus, PresetSortOption, CategoryMeta, PresetPalette, ResolvedPreset, PresetData, CommunityPreset, PresetSubmission, AuthenticatedPresetSubmission, PresetFilters, PresetEditRequest, PresetListResponse, PresetSubmitResponse, PresetEditResponse, VoteResponse, ModerationResponse, CategoryListResponse, } from '@xivdyetools/types';
|
|
323
47
|
/**
|
|
324
|
-
*
|
|
48
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
49
|
+
* These re-exports will be removed in the next major version.
|
|
325
50
|
*/
|
|
326
|
-
export
|
|
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
|
-
}
|
|
51
|
+
export type { AuthProvider, AuthSource, AuthContext, PrimaryCharacter, JWTPayload, OAuthState, DiscordTokenResponse, DiscordUser, XIVAuthTokenResponse, XIVAuthCharacter, XIVAuthCharacterRegistration, XIVAuthSocialIdentity, XIVAuthUser, AuthUser, AuthResponse, RefreshResponse, UserInfoResponse, } from '@xivdyetools/types';
|
|
338
52
|
/**
|
|
339
|
-
*
|
|
53
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
54
|
+
* These re-exports will be removed in the next major version.
|
|
340
55
|
*/
|
|
341
|
-
export
|
|
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
|
-
}
|
|
56
|
+
export type { APIResponse, CachedData, ModerationResult, ModerationLogEntry, ModerationStats, PriceData, RateLimitResult, } from '@xivdyetools/types';
|
|
353
57
|
/**
|
|
354
|
-
*
|
|
58
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
59
|
+
* These re-exports will be removed in the next major version.
|
|
355
60
|
*/
|
|
356
|
-
export
|
|
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
|
-
}
|
|
61
|
+
export type { LocaleCode, TranslationKey, HarmonyTypeKey, JobKey, GrandCompanyKey, LocaleData, LocalePreference, } from '@xivdyetools/types';
|
|
364
62
|
/**
|
|
365
|
-
*
|
|
63
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
64
|
+
* These re-exports will be removed in the next major version.
|
|
366
65
|
*/
|
|
367
|
-
export
|
|
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
|
-
}
|
|
66
|
+
export { ErrorCode, AppError } from '@xivdyetools/types';
|
|
383
67
|
/**
|
|
384
|
-
*
|
|
68
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
69
|
+
* These re-exports will be removed in the next major version.
|
|
385
70
|
*/
|
|
386
|
-
export type ErrorSeverity
|
|
71
|
+
export type { ErrorSeverity } from '@xivdyetools/types';
|
|
387
72
|
/**
|
|
388
|
-
*
|
|
73
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
74
|
+
* These re-exports will be removed in the next major version.
|
|
389
75
|
*/
|
|
390
|
-
export
|
|
391
|
-
code: string;
|
|
392
|
-
severity: ErrorSeverity;
|
|
393
|
-
constructor(code: string, message: string, severity?: ErrorSeverity);
|
|
394
|
-
toJSON(): Record<string, unknown>;
|
|
395
|
-
}
|
|
76
|
+
export type { Result, AsyncResult, Nullable, Optional } from '@xivdyetools/types';
|
|
396
77
|
/**
|
|
397
|
-
*
|
|
78
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
79
|
+
* These re-exports will be removed in the next major version.
|
|
398
80
|
*/
|
|
399
|
-
export
|
|
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
|
-
}
|
|
81
|
+
export { isOk, isErr } from '@xivdyetools/types';
|
|
409
82
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAMxE;;;GAGG;AACH,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrF;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC9F;;;GAGG;AACH,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;;GAGG;AACH,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1F;;;GAGG;AACH,YAAY,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,YAAY,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,YAAY,EACV,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,YAAY,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,MAAM,EACN,eAAe,EACf,UAAU,EACV,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACzD;;;GAGG;AACH,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;GAGG;AACH,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClF;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,87 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @xivdyetools/core - Shared Type Definitions
|
|
3
3
|
*
|
|
4
|
-
* Type definitions for color science and FFXIV dyes
|
|
4
|
+
* Type definitions for color science and FFXIV dyes.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: These types are now re-exported from @xivdyetools/types for consistency
|
|
7
|
+
* across the xivdyetools ecosystem. For new projects, consider importing
|
|
8
|
+
* directly from @xivdyetools/types.
|
|
5
9
|
*
|
|
6
10
|
* @module types
|
|
7
11
|
*/
|
|
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
12
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
13
|
+
* @deprecated Import directly from '@xivdyetools/logger/library' instead.
|
|
14
|
+
* These re-exports will be removed in the next major version.
|
|
38
15
|
*/
|
|
39
|
-
export
|
|
40
|
-
// Normalize to 0-360 range
|
|
41
|
-
const normalized = ((hue % 360) + 360) % 360;
|
|
42
|
-
return normalized;
|
|
43
|
-
}
|
|
16
|
+
export { NoOpLogger, ConsoleLogger } from '@xivdyetools/logger/library';
|
|
44
17
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
18
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
19
|
+
* These re-exports will be removed in the next major version.
|
|
47
20
|
*/
|
|
48
|
-
export
|
|
49
|
-
const clamped = Math.max(0, Math.min(100, saturation));
|
|
50
|
-
return clamped;
|
|
51
|
-
}
|
|
21
|
+
export { createHexColor, createDyeId, createHue, createSaturation } from '@xivdyetools/types';
|
|
52
22
|
/**
|
|
53
|
-
*
|
|
23
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
24
|
+
* These re-exports will be removed in the next major version.
|
|
54
25
|
*/
|
|
55
|
-
export
|
|
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
|
-
}
|
|
26
|
+
export { ErrorCode, AppError } from '@xivdyetools/types';
|
|
73
27
|
/**
|
|
74
|
-
*
|
|
28
|
+
* @deprecated Import directly from '@xivdyetools/types' instead.
|
|
29
|
+
* These re-exports will be removed in the next major version.
|
|
75
30
|
*/
|
|
76
|
-
export
|
|
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 = {}));
|
|
31
|
+
export { isOk, isErr } from '@xivdyetools/types';
|
|
87
32
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAWxE;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA0F9F;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAYzD;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/types/logger.d.ts
CHANGED
|
@@ -4,81 +4,20 @@
|
|
|
4
4
|
* Injectable logger interface for library consumers to customize logging behavior.
|
|
5
5
|
* Prevents library code from polluting consumer application logs.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
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
|
-
* ```
|
|
7
|
+
* NOTE: This file now re-exports from @xivdyetools/logger/library for consistency
|
|
8
|
+
* across the xivdyetools ecosystem. For new projects, consider importing
|
|
9
|
+
* directly from @xivdyetools/logger/library.
|
|
22
10
|
*
|
|
23
|
-
* @
|
|
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
|
-
* ```
|
|
11
|
+
* @module types/logger
|
|
32
12
|
*/
|
|
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
13
|
/**
|
|
57
|
-
*
|
|
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
|
-
* ```
|
|
14
|
+
* @deprecated Import directly from '@xivdyetools/logger/library' instead.
|
|
15
|
+
* These re-exports will be removed in the next major version.
|
|
67
16
|
*/
|
|
68
|
-
export
|
|
17
|
+
export type { Logger } from '@xivdyetools/logger/library';
|
|
69
18
|
/**
|
|
70
|
-
*
|
|
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
|
-
* ```
|
|
19
|
+
* @deprecated Import directly from '@xivdyetools/logger/library' instead.
|
|
20
|
+
* These re-exports will be removed in the next major version.
|
|
82
21
|
*/
|
|
83
|
-
export
|
|
22
|
+
export { NoOpLogger, ConsoleLogger, createLibraryLogger } from '@xivdyetools/logger/library';
|
|
84
23
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/types/logger.js
CHANGED
|
@@ -4,51 +4,15 @@
|
|
|
4
4
|
* Injectable logger interface for library consumers to customize logging behavior.
|
|
5
5
|
* Prevents library code from polluting consumer application logs.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
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.
|
|
7
|
+
* NOTE: This file now re-exports from @xivdyetools/logger/library for consistency
|
|
8
|
+
* across the xivdyetools ecosystem. For new projects, consider importing
|
|
9
|
+
* directly from @xivdyetools/logger/library.
|
|
14
10
|
*
|
|
15
|
-
* @
|
|
16
|
-
* ```typescript
|
|
17
|
-
* // Default behavior - no console output
|
|
18
|
-
* const service = new DyeService();
|
|
19
|
-
* ```
|
|
11
|
+
* @module types/logger
|
|
20
12
|
*/
|
|
21
|
-
export const NoOpLogger = {
|
|
22
|
-
info: () => { },
|
|
23
|
-
warn: () => { },
|
|
24
|
-
error: () => { },
|
|
25
|
-
debug: () => { },
|
|
26
|
-
};
|
|
27
13
|
/**
|
|
28
|
-
*
|
|
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
|
-
* ```
|
|
14
|
+
* @deprecated Import directly from '@xivdyetools/logger/library' instead.
|
|
15
|
+
* These re-exports will be removed in the next major version.
|
|
40
16
|
*/
|
|
41
|
-
export
|
|
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
|
-
};
|
|
17
|
+
export { NoOpLogger, ConsoleLogger, createLibraryLogger } from '@xivdyetools/logger/library';
|
|
54
18
|
//# sourceMappingURL=logger.js.map
|
package/dist/types/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xivdyetools/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Core color algorithms and dye database for XIV Dye Tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"url": "git+https://github.com/FlashGalatine/xivdyetools-core.git"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^22.10.2",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
61
61
|
"@typescript-eslint/parser": "^6.15.0",
|
|
62
62
|
"@vitest/coverage-v8": "^4.0.14",
|
|
@@ -68,13 +68,17 @@
|
|
|
68
68
|
"tsx": "^4.7.0",
|
|
69
69
|
"typedoc": "^0.28.14",
|
|
70
70
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
71
|
-
"typescript": "^5.3
|
|
71
|
+
"typescript": "^5.9.3",
|
|
72
72
|
"vitest": "^4.0.13",
|
|
73
73
|
"yaml": "^2.3.4"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=18.0.0"
|
|
77
77
|
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@xivdyetools/types": "^1.0.0",
|
|
80
|
+
"@xivdyetools/logger": "^1.0.0"
|
|
81
|
+
},
|
|
78
82
|
"lint-staged": {
|
|
79
83
|
"*.ts": [
|
|
80
84
|
"eslint --fix",
|