@xivdyetools/types 1.0.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.
Files changed (115) hide show
  1. package/LICENSE +37 -0
  2. package/README.md +272 -0
  3. package/dist/api/index.d.ts +11 -0
  4. package/dist/api/index.d.ts.map +1 -0
  5. package/dist/api/index.js +9 -0
  6. package/dist/api/index.js.map +1 -0
  7. package/dist/api/moderation.d.ts +53 -0
  8. package/dist/api/moderation.d.ts.map +1 -0
  9. package/dist/api/moderation.js +9 -0
  10. package/dist/api/moderation.js.map +1 -0
  11. package/dist/api/price.d.ts +38 -0
  12. package/dist/api/price.d.ts.map +1 -0
  13. package/dist/api/price.js +9 -0
  14. package/dist/api/price.js.map +1 -0
  15. package/dist/api/response.d.ts +41 -0
  16. package/dist/api/response.d.ts.map +1 -0
  17. package/dist/api/response.js +9 -0
  18. package/dist/api/response.js.map +1 -0
  19. package/dist/auth/discord.d.ts +60 -0
  20. package/dist/auth/discord.d.ts.map +1 -0
  21. package/dist/auth/discord.js +9 -0
  22. package/dist/auth/discord.js.map +1 -0
  23. package/dist/auth/index.d.ts +13 -0
  24. package/dist/auth/index.d.ts.map +1 -0
  25. package/dist/auth/index.js +9 -0
  26. package/dist/auth/index.js.map +1 -0
  27. package/dist/auth/jwt.d.ts +68 -0
  28. package/dist/auth/jwt.d.ts.map +1 -0
  29. package/dist/auth/jwt.js +9 -0
  30. package/dist/auth/jwt.js.map +1 -0
  31. package/dist/auth/provider.d.ts +37 -0
  32. package/dist/auth/provider.d.ts.map +1 -0
  33. package/dist/auth/provider.js +9 -0
  34. package/dist/auth/provider.js.map +1 -0
  35. package/dist/auth/response.d.ts +74 -0
  36. package/dist/auth/response.d.ts.map +1 -0
  37. package/dist/auth/response.js +9 -0
  38. package/dist/auth/response.js.map +1 -0
  39. package/dist/auth/xivauth.d.ts +90 -0
  40. package/dist/auth/xivauth.d.ts.map +1 -0
  41. package/dist/auth/xivauth.js +9 -0
  42. package/dist/auth/xivauth.js.map +1 -0
  43. package/dist/color/branded.d.ts +108 -0
  44. package/dist/color/branded.d.ts.map +1 -0
  45. package/dist/color/branded.js +94 -0
  46. package/dist/color/branded.js.map +1 -0
  47. package/dist/color/colorblind.d.ts +57 -0
  48. package/dist/color/colorblind.d.ts.map +1 -0
  49. package/dist/color/colorblind.js +9 -0
  50. package/dist/color/colorblind.js.map +1 -0
  51. package/dist/color/index.d.ts +12 -0
  52. package/dist/color/index.d.ts.map +1 -0
  53. package/dist/color/index.js +9 -0
  54. package/dist/color/index.js.map +1 -0
  55. package/dist/color/rgb.d.ts +32 -0
  56. package/dist/color/rgb.d.ts.map +1 -0
  57. package/dist/color/rgb.js +9 -0
  58. package/dist/color/rgb.js.map +1 -0
  59. package/dist/dye/database.d.ts +23 -0
  60. package/dist/dye/database.d.ts.map +1 -0
  61. package/dist/dye/database.js +9 -0
  62. package/dist/dye/database.js.map +1 -0
  63. package/dist/dye/dye.d.ts +66 -0
  64. package/dist/dye/dye.d.ts.map +1 -0
  65. package/dist/dye/dye.js +9 -0
  66. package/dist/dye/dye.js.map +1 -0
  67. package/dist/dye/index.d.ts +10 -0
  68. package/dist/dye/index.d.ts.map +1 -0
  69. package/dist/dye/index.js +9 -0
  70. package/dist/dye/index.js.map +1 -0
  71. package/dist/error/app-error.d.ts +52 -0
  72. package/dist/error/app-error.d.ts.map +1 -0
  73. package/dist/error/app-error.js +56 -0
  74. package/dist/error/app-error.js.map +1 -0
  75. package/dist/error/codes.d.ts +37 -0
  76. package/dist/error/codes.d.ts.map +1 -0
  77. package/dist/error/codes.js +40 -0
  78. package/dist/error/codes.js.map +1 -0
  79. package/dist/error/index.d.ts +11 -0
  80. package/dist/error/index.d.ts.map +1 -0
  81. package/dist/error/index.js +10 -0
  82. package/dist/error/index.js.map +1 -0
  83. package/dist/index.d.ts +29 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +22 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/localization/index.d.ts +78 -0
  88. package/dist/localization/index.d.ts.map +1 -0
  89. package/dist/localization/index.js +9 -0
  90. package/dist/localization/index.js.map +1 -0
  91. package/dist/preset/community.d.ts +90 -0
  92. package/dist/preset/community.d.ts.map +1 -0
  93. package/dist/preset/community.js +9 -0
  94. package/dist/preset/community.js.map +1 -0
  95. package/dist/preset/core.d.ts +87 -0
  96. package/dist/preset/core.d.ts.map +1 -0
  97. package/dist/preset/core.js +9 -0
  98. package/dist/preset/core.js.map +1 -0
  99. package/dist/preset/index.d.ts +12 -0
  100. package/dist/preset/index.d.ts.map +1 -0
  101. package/dist/preset/index.js +9 -0
  102. package/dist/preset/index.js.map +1 -0
  103. package/dist/preset/request.d.ts +43 -0
  104. package/dist/preset/request.d.ts.map +1 -0
  105. package/dist/preset/request.js +9 -0
  106. package/dist/preset/request.js.map +1 -0
  107. package/dist/preset/response.d.ts +92 -0
  108. package/dist/preset/response.d.ts.map +1 -0
  109. package/dist/preset/response.js +9 -0
  110. package/dist/preset/response.js.map +1 -0
  111. package/dist/utility/index.d.ts +71 -0
  112. package/dist/utility/index.d.ts.map +1 -0
  113. package/dist/utility/index.js +20 -0
  114. package/dist/utility/index.js.map +1 -0
  115. package/package.json +73 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @xivdyetools/types - JWT Types
3
+ *
4
+ * JWT payload and related types.
5
+ *
6
+ * @module auth/jwt
7
+ */
8
+ import type { AuthProvider } from './provider.js';
9
+ /**
10
+ * Primary FFXIV character info (for XIVAuth users)
11
+ *
12
+ * Included in JWT for users who authenticated via XIVAuth
13
+ * and have a verified character.
14
+ */
15
+ export interface PrimaryCharacter {
16
+ /** Character name */
17
+ name: string;
18
+ /** Server/World name */
19
+ server: string;
20
+ /** True if character is verified on XIVAuth */
21
+ verified: boolean;
22
+ }
23
+ /**
24
+ * JWT payload structure
25
+ *
26
+ * Contains both standard JWT claims and custom claims
27
+ * for user identification.
28
+ */
29
+ export interface JWTPayload {
30
+ /** Subject - Internal user ID */
31
+ sub: string;
32
+ /** Issued at timestamp */
33
+ iat: number;
34
+ /** Expiration timestamp */
35
+ exp: number;
36
+ /** Issuer (worker URL) */
37
+ iss: string;
38
+ /** JWT ID for revocation (optional for backward compat) */
39
+ jti?: string;
40
+ /** Display username */
41
+ username: string;
42
+ /** Discord global display name (if available) */
43
+ global_name: string | null;
44
+ /** Avatar hash or URL */
45
+ avatar: string | null;
46
+ /** Which provider was used to authenticate */
47
+ auth_provider: AuthProvider;
48
+ /** Discord snowflake ID (if Discord auth or linked) */
49
+ discord_id?: string;
50
+ /** XIVAuth UUID (if XIVAuth auth) */
51
+ xivauth_id?: string;
52
+ /** Primary FFXIV character info (if XIVAuth user) */
53
+ primary_character?: PrimaryCharacter;
54
+ }
55
+ /**
56
+ * OAuth state stored during authentication flow
57
+ *
58
+ * Stored temporarily while user is redirected to OAuth provider.
59
+ */
60
+ export interface OAuthState {
61
+ /** PKCE code verifier */
62
+ code_verifier: string;
63
+ /** Redirect URI used in the flow */
64
+ redirect_uri: string;
65
+ /** Path to redirect to after auth completes */
66
+ return_path?: string;
67
+ }
68
+ //# sourceMappingURL=jwt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IAEb,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IAEf,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAEzB,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IAEZ,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IAEZ,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IAEZ,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IAEZ,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IAEjB,iDAAiD;IACjD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,yBAAyB;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,8CAA8C;IAC9C,aAAa,EAAE,YAAY,CAAC;IAE5B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IAEtB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IAErB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - JWT Types
3
+ *
4
+ * JWT payload and related types.
5
+ *
6
+ * @module auth/jwt
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=jwt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @xivdyetools/types - Auth Provider Types
3
+ *
4
+ * Authentication provider and context types.
5
+ *
6
+ * @module auth/provider
7
+ */
8
+ /**
9
+ * Supported authentication providers
10
+ */
11
+ export type AuthProvider = 'discord' | 'xivauth';
12
+ /**
13
+ * Source of authentication in API requests
14
+ *
15
+ * - `none`: Unauthenticated request
16
+ * - `bot`: Request from Discord bot (via service binding or API key)
17
+ * - `web`: Request from web app (via JWT)
18
+ */
19
+ export type AuthSource = 'none' | 'bot' | 'web';
20
+ /**
21
+ * Authentication context for API requests
22
+ *
23
+ * Attached to requests after authentication middleware runs.
24
+ */
25
+ export interface AuthContext {
26
+ /** True if the request is authenticated */
27
+ isAuthenticated: boolean;
28
+ /** True if the user has moderator privileges */
29
+ isModerator: boolean;
30
+ /** Discord user ID (if authenticated) */
31
+ userDiscordId?: string;
32
+ /** Display name (if authenticated) */
33
+ userName?: string;
34
+ /** How the user authenticated */
35
+ authSource: AuthSource;
36
+ }
37
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/auth/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,eAAe,EAAE,OAAO,CAAC;IAEzB,gDAAgD;IAChD,WAAW,EAAE,OAAO,CAAC;IAErB,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,iCAAiC;IACjC,UAAU,EAAE,UAAU,CAAC;CACxB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Auth Provider Types
3
+ *
4
+ * Authentication provider and context types.
5
+ *
6
+ * @module auth/provider
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/auth/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @xivdyetools/types - Auth Response Types
3
+ *
4
+ * API response types for authentication endpoints.
5
+ *
6
+ * @module auth/response
7
+ */
8
+ import type { AuthProvider } from './provider.js';
9
+ import type { PrimaryCharacter } from './jwt.js';
10
+ /**
11
+ * User info included in auth responses
12
+ */
13
+ export interface AuthUser {
14
+ /** Internal user ID */
15
+ id: string;
16
+ /** Display username */
17
+ username: string;
18
+ /** Discord global display name */
19
+ global_name: string | null;
20
+ /** Avatar hash */
21
+ avatar: string | null;
22
+ /** Full avatar URL */
23
+ avatar_url: string | null;
24
+ /** Which provider was used to authenticate */
25
+ auth_provider?: AuthProvider;
26
+ /** Primary FFXIV character (if XIVAuth user) */
27
+ primary_character?: PrimaryCharacter;
28
+ }
29
+ /**
30
+ * Response from authentication endpoints
31
+ */
32
+ export interface AuthResponse {
33
+ /** Whether authentication succeeded */
34
+ success: boolean;
35
+ /** JWT token (if successful) */
36
+ token?: string;
37
+ /** User information (if successful) */
38
+ user?: AuthUser;
39
+ /** Token expiration timestamp (ms since epoch) */
40
+ expires_at?: number;
41
+ /** Error message (if unsuccessful) */
42
+ error?: string;
43
+ }
44
+ /**
45
+ * Response from token refresh endpoint
46
+ */
47
+ export interface RefreshResponse {
48
+ /** Whether refresh succeeded */
49
+ success: boolean;
50
+ /** New JWT token (if successful) */
51
+ token?: string;
52
+ /** New token expiration timestamp */
53
+ expires_at?: number;
54
+ /** Error message (if unsuccessful) */
55
+ error?: string;
56
+ }
57
+ /**
58
+ * Response from user info endpoint
59
+ */
60
+ export interface UserInfoResponse {
61
+ /** Whether request succeeded */
62
+ success: boolean;
63
+ /** User information (if successful) */
64
+ user?: {
65
+ id: string;
66
+ username: string;
67
+ global_name: string | null;
68
+ avatar: string | null;
69
+ avatar_url: string | null;
70
+ };
71
+ /** Error message (if unsuccessful) */
72
+ error?: string;
73
+ }
74
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/auth/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAA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B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,CAAC;IAEF,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Auth Response Types
3
+ *
4
+ * API response types for authentication endpoints.
5
+ *
6
+ * @module auth/response
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/auth/response.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @xivdyetools/types - XIVAuth OAuth Types
3
+ *
4
+ * XIVAuth OAuth and user types.
5
+ *
6
+ * @module auth/xivauth
7
+ */
8
+ /**
9
+ * XIVAuth OAuth token response
10
+ */
11
+ export interface XIVAuthTokenResponse {
12
+ /** OAuth access token */
13
+ access_token: string;
14
+ /** Token type (usually "Bearer") */
15
+ token_type: string;
16
+ /** Token lifetime in seconds */
17
+ expires_in: number;
18
+ /** Refresh token for obtaining new access tokens */
19
+ refresh_token: string;
20
+ /** Granted scopes (space-separated) */
21
+ scope: string;
22
+ }
23
+ /**
24
+ * XIVAuth character object from /api/v1/characters
25
+ */
26
+ export interface XIVAuthCharacter {
27
+ /** Lodestone character ID */
28
+ id: number;
29
+ /** Character name */
30
+ name: string;
31
+ /** Home world/server name */
32
+ home_world: string;
33
+ /** True if character is verified */
34
+ verified: boolean;
35
+ }
36
+ /**
37
+ * XIVAuth character registration (full response)
38
+ */
39
+ export interface XIVAuthCharacterRegistration {
40
+ /** Lodestone character ID */
41
+ lodestone_id: number;
42
+ /** Character name */
43
+ name: string;
44
+ /** Home world/server name */
45
+ home_world: string;
46
+ /** Data center name */
47
+ data_center: string;
48
+ /** True if character is verified */
49
+ verified: boolean;
50
+ }
51
+ /**
52
+ * XIVAuth social identity from /api/v1/user
53
+ *
54
+ * Represents a linked external account (Discord, etc.)
55
+ */
56
+ export interface XIVAuthSocialIdentity {
57
+ /** Provider name (e.g., 'discord') */
58
+ provider: string;
59
+ /** External ID (e.g., Discord snowflake) */
60
+ external_id: string;
61
+ /** Display name on the external service */
62
+ name: string | null;
63
+ /** Nickname on the external service */
64
+ nickname: string | null;
65
+ /** When the link was created */
66
+ created_at: string;
67
+ /** When the link was last updated */
68
+ updated_at: string;
69
+ }
70
+ /**
71
+ * XIVAuth user object from /api/v1/user
72
+ *
73
+ * NOTE: This is the ACTUAL response structure from XIVAuth.
74
+ * XIVAuth does NOT return username or avatar_url in user endpoint.
75
+ */
76
+ export interface XIVAuthUser {
77
+ /** XIVAuth UUID */
78
+ id: string;
79
+ /** Array of linked accounts (Discord, etc.) */
80
+ social_identities?: XIVAuthSocialIdentity[];
81
+ /** True if user has MFA enabled */
82
+ mfa_enabled: boolean;
83
+ /** True if user has any verified characters */
84
+ verified_characters: boolean;
85
+ /** Account creation timestamp */
86
+ created_at: string;
87
+ /** Last update timestamp */
88
+ updated_at: string;
89
+ }
90
+ //# sourceMappingURL=xivauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xivauth.d.ts","sourceRoot":"","sources":["../../src/auth/xivauth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IAEnB,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;IAEtB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IAEX,qBAAqB;IACrB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appingURL=xivauth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xivauth.js","sourceRoot":"","sources":["../../src/auth/xivauth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @xivdyetools/types - Branded Color Types
3
+ *
4
+ * Branded types prevent accidental type confusion between similar types.
5
+ * For example, a DyeId cannot be accidentally used where a plain number is expected.
6
+ *
7
+ * @module color/branded
8
+ */
9
+ /**
10
+ * Hexadecimal color string (branded type for type safety)
11
+ *
12
+ * Prevents accidental use of arbitrary strings as hex colors.
13
+ * Use `createHexColor()` to create validated instances.
14
+ *
15
+ * @example "#FF0000"
16
+ */
17
+ export type HexColor = string & {
18
+ readonly __brand: 'HexColor';
19
+ };
20
+ /**
21
+ * Helper to create branded HexColor type with validation
22
+ *
23
+ * Validates hex format and normalizes to uppercase #RRGGBB format.
24
+ *
25
+ * @param hex - Input hex string (#RGB or #RRGGBB format)
26
+ * @returns Normalized HexColor in #RRGGBB format
27
+ * @throws {Error} If hex format is invalid
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const red = createHexColor('#f00'); // Returns "#FF0000"
32
+ * const blue = createHexColor('#0000ff'); // Returns "#0000FF"
33
+ * createHexColor('invalid'); // Throws Error
34
+ * ```
35
+ */
36
+ export declare function createHexColor(hex: string): HexColor;
37
+ /**
38
+ * Dye ID (branded type for type safety)
39
+ *
40
+ * Prevents accidental mixing of dye IDs with other numeric values.
41
+ * Valid dye IDs range from 1 to 200 in FFXIV.
42
+ */
43
+ export type DyeId = number & {
44
+ readonly __brand: 'DyeId';
45
+ };
46
+ /**
47
+ * Helper to create branded DyeId type with validation
48
+ *
49
+ * @param id - Numeric dye ID (must be 1-200)
50
+ * @returns Branded DyeId or null if invalid
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const dyeId = createDyeId(1); // Returns 1 as DyeId
55
+ * const invalid = createDyeId(0); // Returns null
56
+ * const bad = createDyeId(999); // Returns null
57
+ * ```
58
+ */
59
+ export declare function createDyeId(id: number): DyeId | null;
60
+ /**
61
+ * Hue value (0-360 degrees, branded type)
62
+ *
63
+ * Prevents mixing with other angle or degree values.
64
+ */
65
+ export type Hue = number & {
66
+ readonly __brand: 'Hue';
67
+ };
68
+ /**
69
+ * Helper to create branded Hue type with normalization
70
+ *
71
+ * Normalizes hue to 0-360 range (wraps around).
72
+ *
73
+ * @param hue - Input hue value (any number, will be normalized)
74
+ * @returns Normalized Hue in 0-360 range
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * createHue(45); // Returns 45
79
+ * createHue(400); // Returns 40 (wrapped)
80
+ * createHue(-30); // Returns 330 (wrapped)
81
+ * ```
82
+ */
83
+ export declare function createHue(hue: number): Hue;
84
+ /**
85
+ * Saturation value (0-100 percent, branded type)
86
+ *
87
+ * Prevents mixing with other percentage values.
88
+ */
89
+ export type Saturation = number & {
90
+ readonly __brand: 'Saturation';
91
+ };
92
+ /**
93
+ * Helper to create branded Saturation type with clamping
94
+ *
95
+ * Clamps saturation to 0-100 range.
96
+ *
97
+ * @param saturation - Input saturation value
98
+ * @returns Clamped Saturation in 0-100 range
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * createSaturation(50); // Returns 50
103
+ * createSaturation(150); // Returns 100 (clamped)
104
+ * createSaturation(-10); // Returns 0 (clamped)
105
+ * ```
106
+ */
107
+ export declare function createSaturation(saturation: number): Saturation;
108
+ //# sourceMappingURL=branded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branded.d.ts","sourceRoot":"","sources":["../../src/color/branded.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAWpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAKpD;AAED;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAI1C;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AAErE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAG/D"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @xivdyetools/types - Branded Color Types
3
+ *
4
+ * Branded types prevent accidental type confusion between similar types.
5
+ * For example, a DyeId cannot be accidentally used where a plain number is expected.
6
+ *
7
+ * @module color/branded
8
+ */
9
+ /**
10
+ * Helper to create branded HexColor type with validation
11
+ *
12
+ * Validates hex format and normalizes to uppercase #RRGGBB format.
13
+ *
14
+ * @param hex - Input hex string (#RGB or #RRGGBB format)
15
+ * @returns Normalized HexColor in #RRGGBB format
16
+ * @throws {Error} If hex format is invalid
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const red = createHexColor('#f00'); // Returns "#FF0000"
21
+ * const blue = createHexColor('#0000ff'); // Returns "#0000FF"
22
+ * createHexColor('invalid'); // Throws Error
23
+ * ```
24
+ */
25
+ export function createHexColor(hex) {
26
+ // Validate format: must be #RGB or #RRGGBB
27
+ if (!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(hex)) {
28
+ throw new Error(`Invalid hex color format: ${hex}. Expected #RRGGBB or #RGB format.`);
29
+ }
30
+ // Normalize short hex (#RGB) to long hex (#RRGGBB) and uppercase
31
+ const normalized = hex.length === 4
32
+ ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`.toUpperCase()
33
+ : hex.toUpperCase();
34
+ return normalized;
35
+ }
36
+ /**
37
+ * Helper to create branded DyeId type with validation
38
+ *
39
+ * @param id - Numeric dye ID (must be 1-200)
40
+ * @returns Branded DyeId or null if invalid
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const dyeId = createDyeId(1); // Returns 1 as DyeId
45
+ * const invalid = createDyeId(0); // Returns null
46
+ * const bad = createDyeId(999); // Returns null
47
+ * ```
48
+ */
49
+ export function createDyeId(id) {
50
+ if (!Number.isInteger(id) || id < 1 || id > 200) {
51
+ return null;
52
+ }
53
+ return id;
54
+ }
55
+ /**
56
+ * Helper to create branded Hue type with normalization
57
+ *
58
+ * Normalizes hue to 0-360 range (wraps around).
59
+ *
60
+ * @param hue - Input hue value (any number, will be normalized)
61
+ * @returns Normalized Hue in 0-360 range
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * createHue(45); // Returns 45
66
+ * createHue(400); // Returns 40 (wrapped)
67
+ * createHue(-30); // Returns 330 (wrapped)
68
+ * ```
69
+ */
70
+ export function createHue(hue) {
71
+ // Normalize to 0-360 range
72
+ const normalized = ((hue % 360) + 360) % 360;
73
+ return normalized;
74
+ }
75
+ /**
76
+ * Helper to create branded Saturation type with clamping
77
+ *
78
+ * Clamps saturation to 0-100 range.
79
+ *
80
+ * @param saturation - Input saturation value
81
+ * @returns Clamped Saturation in 0-100 range
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * createSaturation(50); // Returns 50
86
+ * createSaturation(150); // Returns 100 (clamped)
87
+ * createSaturation(-10); // Returns 0 (clamped)
88
+ * ```
89
+ */
90
+ export function createSaturation(saturation) {
91
+ const clamped = Math.max(0, Math.min(100, saturation));
92
+ return clamped;
93
+ }
94
+ //# sourceMappingURL=branded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branded.js","sourceRoot":"","sources":["../../src/color/branded.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,2CAA2C;IAC3C,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,oCAAoC,CAAC,CAAC;IACxF,CAAC;IACD,iEAAiE;IACjE,MAAM,UAAU,GACd,GAAG,CAAC,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE;QACzE,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IACxB,OAAO,UAAsB,CAAC;AAChC,CAAC;AAUD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAW,CAAC;AACrB,CAAC;AASD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,2BAA2B;IAC3B,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC7C,OAAO,UAAiB,CAAC;AAC3B,CAAC;AASD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IACvD,OAAO,OAAqB,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @xivdyetools/types - Colorblindness Types
3
+ *
4
+ * Types for colorblindness simulation and accessibility checking.
5
+ *
6
+ * @module color/colorblind
7
+ */
8
+ /**
9
+ * Vision types supported by accessibility checker
10
+ *
11
+ * - `normal`: Standard color vision
12
+ * - `deuteranopia`: Red-green colorblindness (green cone deficiency)
13
+ * - `protanopia`: Red-green colorblindness (red cone deficiency)
14
+ * - `tritanopia`: Blue-yellow colorblindness (blue cone deficiency)
15
+ * - `achromatopsia`: Complete colorblindness (monochromacy)
16
+ */
17
+ export type VisionType = 'normal' | 'deuteranopia' | 'protanopia' | 'tritanopia' | 'achromatopsia';
18
+ /**
19
+ * 3x3 transformation matrix for colorblindness simulation
20
+ *
21
+ * Used for RGB to RGB transformation using matrix multiplication.
22
+ * [row][column] indexing: result[r] = matrix[0] * input, etc.
23
+ */
24
+ export type Matrix3x3 = [
25
+ [
26
+ number,
27
+ number,
28
+ number
29
+ ],
30
+ [
31
+ number,
32
+ number,
33
+ number
34
+ ],
35
+ [
36
+ number,
37
+ number,
38
+ number
39
+ ]
40
+ ];
41
+ /**
42
+ * Colorblindness transformation matrices (Brettel 1997)
43
+ *
44
+ * These matrices simulate how colors appear to people with different
45
+ * types of color vision deficiency.
46
+ */
47
+ export interface ColorblindMatrices {
48
+ /** Matrix for deuteranopia simulation */
49
+ deuteranopia: Matrix3x3;
50
+ /** Matrix for protanopia simulation */
51
+ protanopia: Matrix3x3;
52
+ /** Matrix for tritanopia simulation */
53
+ tritanopia: Matrix3x3;
54
+ /** Matrix for achromatopsia simulation */
55
+ achromatopsia: Matrix3x3;
56
+ }
57
+ //# sourceMappingURL=colorblind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorblind.d.ts","sourceRoot":"","sources":["../../src/color/colorblind.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,eAAe,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;IACxB;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;IACxB;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,YAAY,EAAE,SAAS,CAAC;IACxB,uCAAuC;IACvC,UAAU,EAAE,SAAS,CAAC;IACtB,uCAAuC;IACvC,UAAU,EAAE,SAAS,CAAC;IACtB,0CAA0C;IAC1C,aAAa,EAAE,SAAS,CAAC;CAC1B"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Colorblindness Types
3
+ *
4
+ * Types for colorblindness simulation and accessibility checking.
5
+ *
6
+ * @module color/colorblind
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=colorblind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorblind.js","sourceRoot":"","sources":["../../src/color/colorblind.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @xivdyetools/types - Color Module
3
+ *
4
+ * Color type definitions including RGB/HSV, branded types, and colorblindness.
5
+ *
6
+ * @module color
7
+ */
8
+ export type { RGB, HSV } from './rgb.js';
9
+ export type { HexColor, DyeId, Hue, Saturation } from './branded.js';
10
+ export { createHexColor, createDyeId, createHue, createSaturation } from './branded.js';
11
+ export type { VisionType, Matrix3x3, ColorblindMatrices } from './colorblind.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGzC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGxF,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @xivdyetools/types - Color Module
3
+ *
4
+ * Color type definitions including RGB/HSV, branded types, and colorblindness.
5
+ *
6
+ * @module color
7
+ */
8
+ export { createHexColor, createDyeId, createHue, createSaturation } from './branded.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}