1
- import { AttributeTrait , ActionTrait , District } from "../core/constants" ;
2
- import BladesItem from "../BladesItem" ;
1
+ // #region IMPORTS ~
3
2
import BladesActor from "../BladesActor" ;
4
- import BladesChat from "../classes/BladesChat " ;
3
+ import BladesItem from "../BladesItem " ;
5
4
import BladesActorSheet from "../sheets/actor/BladesActorSheet" ;
6
5
import BladesItemSheet from "../sheets/item/BladesItemSheet" ;
7
- // import BladesClockKey, {BladesClock} from "../classes/BladesClockKey";
8
- // import BladesConsequence from "../classes/BladesConsequence";
9
- // import BladesRoll, {BladesRollMod} from "../classes/BladesRoll";
10
- import { gsap } from "gsap/all" ;
11
6
7
+ import BladesActiveEffect from "../documents/BladesActiveEffect" ;
8
+ import BladesChatMessage from "../classes/BladesChatMessage" ;
9
+ import BladesDialog from "../classes/BladesDialog" ;
10
+ import BladesRoll from "../classes/BladesRoll" ;
11
+ import BladesScene from "../classes/BladesScene" ;
12
+
13
+ import { gsap } from "gsap/all" ;
14
+ // #endregion
15
+
16
+ // #region CONFIGURATION OF SYSTEM CLASSES
17
+ type ActorDoc = BladesActor ; // Actor;
18
+ type ItemDoc = BladesItem ; // Item;
19
+ type ActorSheetDoc = BladesActorSheet ; // ActorSheet;
20
+ type ItemSheetDoc = BladesItemSheet ; // ItemSheet;
21
+
22
+ type ActiveEffectDoc = BladesActiveEffect ; // ActiveEffect;
23
+ type ChatMessageDoc = BladesChatMessage ; // Chat;
24
+ type DialogDoc = BladesDialog ; // Dialog;
25
+ type RollDoc = BladesRoll ; // Roll;
26
+ type SceneDoc = BladesScene ; // Scene;
27
+ type UserDoc = User ; // User;
28
+ // #endregion
29
+
30
+ // #region UTILITY TYPES
31
+ type HexDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" ;
32
+ type MaybeSpace = " " | "" ;
33
+ type FlexComma = `${MaybeSpace } ,${MaybeSpace } `;
34
+ // #endregion
12
35
13
36
declare global {
14
37
// #region MISCELLANEOUS TYPE ALIASES (nonfunctional; for clarity) ~
@@ -31,18 +54,6 @@ declare global {
31
54
// Represents any class constructor with an unknown number of parameters
32
55
type AnyClass < T = unknown > = new ( ...args : unknown [ ] ) => T ;
33
56
34
- // Represents an integer
35
- type int = number ;
36
-
37
- // Represents a floating point number
38
- type float = number ;
39
-
40
- // Represents a positive integer
41
- type posInt = number ;
42
-
43
- // Represents a positive floating point number
44
- type posFloat = number ;
45
-
46
57
// Represents a key which can be a string, number, or symbol
47
58
type key = string | number | symbol ;
48
59
@@ -53,13 +64,13 @@ declare global {
53
64
type StringLike = string | number | boolean | null | undefined ;
54
65
55
66
// Represents a number represented as a string
56
- type NumString = string ;
67
+ type NumString = `${ number } ` ;
57
68
58
69
// Represents an object with number-strings as keys
59
70
type StringArray < T > = Record < NumString , T > ;
60
71
61
72
// Represents "true" or "false" as a string
62
- type BoolString = string ;
73
+ type BoolString = `${ boolean } ` ;
63
74
64
75
// Represents falsy values and empty objects to be pruned when cleaning list of values
65
76
type UncleanValues = false | null | undefined | "" | 0 | Record < string , never > | never [ ] ;
@@ -79,13 +90,14 @@ declare global {
79
90
type StringCase = "upper" | "lower" | "sentence" | "title" ;
80
91
81
92
// Represents HTML code as a string
82
- type HTMLCode = string ;
93
+ type HTMLCode = string & { __htmlStringBrand : never } ;
83
94
84
- // Represents a HEX color as a string
85
- type HEXColor = string ;
95
+ // Represents a HEX color as a string, allowing for six (RGB) or eight (RGBA) uppercase hexadecimal digits
96
+ type HexColor = `#${ HexDigit } ${ HexDigit } ${ HexDigit } ` | `#${ HexDigit } ${ HexDigit } ${ HexDigit } ${ HexDigit } ` ;
86
97
87
98
// Represents an RGB color as a string
88
- type RGBColor = string ;
99
+ type RGBColor = `rgb(${number } ${FlexComma } ${number } ${FlexComma } ${number } )` |
100
+ `rgba(${number } ${FlexComma } ${number } ${FlexComma } ${number } ${FlexComma } ${number } )`;
89
101
90
102
// Represents a key of a certain type
91
103
type KeyOf < T > = keyof T ;
@@ -107,32 +119,30 @@ declare global {
107
119
108
120
// Represents a check test
109
121
type checkTest = ( ( ...args : unknown [ ] ) => unknown ) | testFunc < keyFunc > | testFunc < valFunc > | RegExp | number | string ;
110
-
111
122
// #endregion
112
123
113
-
114
124
// Represents a document id as a string
115
- type IDString = string & { __idStringBrand : never } ;
125
+ type IDString = string & { __idStringBrand : never } ;
116
126
117
127
// Represents a UUID string, of the form /^[A-Za-z]+\.[A-Za-z0-9]{16}$/
118
- type UUIDString = string & { __uuidStringBrand : never } ; // This type is compatible with string, but requires explicit casting, enforcing the UUID pattern.
128
+ type UUIDString = string & { __uuidStringBrand : never } ; // This type is compatible with string, but requires explicit casting, enforcing the UUID pattern.
119
129
120
130
// Represents a dotkey
121
- type DotKey = string & { __dotKeyBrand : never } ;
131
+ type DotKey = string & { __dotKeyBrand : never } ;
122
132
123
133
// Represents a dotkey appropriate for an update() data object
124
- type TargetKey = string & DotKey & { __targetKeyBrand : never } ;
134
+ type TargetKey = string & DotKey & { __targetKeyBrand : never } ;
125
135
126
136
// Represents a dotkey point to a a flag instead of the document schema
127
- type TargetFlagKey = string & DotKey & { __targetFlagKeyBrand : never } ;
137
+ type TargetFlagKey = string & DotKey & { __targetFlagKeyBrand : never } ;
128
138
129
139
// Represents a jQuery text term
130
140
type jQueryTextTerm = string | number | boolean | (
131
141
( this : Element , index : number , text : string ) => string | number | boolean
132
142
) ;
133
143
134
144
// Represents an object describing dimensions of an HTML element, of form {x: number, y: number, width: number, height: number}
135
- type ElemPosData = { x : number , y : number , width : number , height : number } ;
145
+ interface ElemPosData { x : number , y : number , width : number , height : number }
136
146
137
147
// Represents an object describing dimensions of an HTML element, in the form of a DOMRect object with mutable properties.
138
148
type MutableRect = Omit < Mutable < DOMRect > , "toJSON" > ;
@@ -164,99 +174,44 @@ declare global {
164
174
- readonly [ P in keyof T ] : T [ P ] ;
165
175
} ;
166
176
177
+ export type gsapConfig = gsap . TweenVars & {
178
+ duration : number ,
179
+ targets : Record < string , JQuery | JQuery [ ] >
180
+ }
181
+
182
+ export interface GSAPEffect < Defaults extends gsap . TweenVars > {
183
+ effect : (
184
+ targets : gsap . TweenTarget ,
185
+ config : Defaults
186
+ ) => gsap . core . Timeline | gsap . core . Tween ,
187
+ defaults : Defaults ,
188
+ extendTimeline ?: boolean
189
+ }
190
+
167
191
// Represents a gsap animation
168
192
type gsapAnim = gsap . core . Tween | gsap . core . Timeline ;
169
193
170
194
// Represents a generic Blades document
171
- type BladesDoc = BladesActor | BladesItem ;
195
+ type EntityDoc = ActorDoc | ItemDoc ;
172
196
173
197
// Represents any Blades document sheet
174
- type BladesSheet = BladesActorSheet | BladesItemSheet ;
198
+ type EntitySheet = ActorSheetDoc | ItemSheetDoc ;
175
199
176
200
// Represents any document that can be the target of a BladesTargetLink subclass.
177
- type BladesLinkDoc = BladesDoc | BladesChat | User ;
201
+ type TargetLinkDoc = EntityDoc | ChatMessageDoc | UserDoc ;
178
202
179
203
// Represents a reference to a Blades document
180
- type DocRef = string | BladesDoc ;
204
+ type DocRef = string | EntityDoc ;
181
205
182
206
// Represents a reference to a Blades actor
183
- type ActorRef = string | BladesActor ;
207
+ type ActorRef = string | ActorDoc ;
184
208
185
209
// Represents a reference to a Blades item
186
- type ItemRef = string | BladesItem ;
210
+ type ItemRef = string | ItemDoc ;
187
211
188
212
// Utility Types for Variable Template Values
189
- type ValueMax = { max : number , value : number } ;
213
+ interface ValueMax { max : number , value : number }
190
214
type NamedValueMax = ValueMax & { name : string } ;
191
- type RollableStat = AttributeTrait | ActionTrait ;
192
-
193
- // Component Types for Sheets
194
- type BladesSelectOption < displayType , valueType = string > = {
195
- value : valueType ,
196
- display : displayType
197
- } ;
198
215
199
- type BladesCompData = {
200
- class ?: string ,
201
- label ?: string ,
202
- labelClass ?: string ,
203
- tooltip ?: string ,
204
- tooltipClass ?: string ,
205
-
206
- checkLabel ?: string ,
207
- checkClasses ?: {
208
- active : string ,
209
- inactive : string
210
- } ,
211
- checkTarget ?: string ,
212
- checkValue ?: boolean ,
213
-
214
- dotline ?: BladesDotlineData ,
215
- dotlines ?: BladesDotlineData [ ] ,
216
-
217
- compContainer ?: {
218
- class ?: string ,
219
- blocks : Array < Array < Omit < BladesCompData , "compContainer" > > >
220
- }
221
- }
222
- type BladesDotlineData = {
223
- data : ValueMax ,
224
- dotlineClass ?: string ,
225
- dotlineLabel ?: string ,
226
-
227
- target ?: string ,
228
- isLocked ?: boolean ,
229
-
230
- svgKey ?: string ,
231
- svgFull ?: string ,
232
- svgEmpty ?: string ,
233
-
234
- iconEmpty ?: string ,
235
- iconEmptyHover ?: string ,
236
- iconFull ?: string ,
237
- iconFullHover ?: string ,
238
- altIconFull ?: string ,
239
- altIconFullHover ?: string ,
240
- altIconStep ?: number ,
241
-
242
- advanceButton ?: string
243
- }
244
- type BladesRandomizer < T extends string = string > = { isLocked : boolean , value : T }
245
-
246
- // Claims Data for Turf Representation
247
- type BladesClaimData = {
248
- name : string ,
249
- flavor ?: string ,
250
- description : string ,
251
- district ?: District ,
252
- value : boolean ,
253
- isTurf : boolean ,
254
- connects : {
255
- left : boolean ,
256
- right : boolean ,
257
- top : boolean ,
258
- bottom : boolean
259
- }
260
- }
261
216
export declare function randomID ( length ?: number ) : IDString ;
262
217
}
0 commit comments