Skip to content

Commit 36b6e39

Browse files
committed
Pre-checkout of earlier commit
1 parent 733612a commit 36b6e39

29 files changed

+1651
-584
lines changed

.eslintrc.cjs

Lines changed: 892 additions & 34 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
"private": true,
1515
"devDependencies": {
1616
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
17+
"@types/yaireo__tagify": "^4.17.0",
1718
"@sveltejs/vite-plugin-svelte": "^3.0.2",
1819
"@tsconfig/node21": "^21.0.1",
1920
"@tsconfig/svelte": "^5.0.2",
2021
"@types/jquery": "^3.5.29",
2122
"@types/node": "^20.11.22",
2223
"@typescript-eslint/eslint-plugin": "^7.0.2",
2324
"@typescript-eslint/parser": "^7.0.2",
24-
"@yaireo/tagify": "^4.21.1",
2525
"chokidar": "^3.6.0",
2626
"eslint": "^8.57.0",
2727
"eslint-import-resolver-node": "^0.3.9",
@@ -51,7 +51,7 @@
5151
"vite-plugin-copy": "^0.1.6"
5252
},
5353
"dependencies": {
54-
"@types/yaireo__tagify": "^4.17.0",
54+
"@yaireo/tagify": "^4.21.1",
5555
"axios": "^1.5.1",
5656
"form-data": "^4.0.0",
5757
"gsap": "^3.12.5",

src/ts/@types/blades-actor.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ declare global {
1212
// }
1313

1414
// Basic & Utility Types for BladesActors
15-
type BladesRandomizer<T extends string = string> = { isLocked: boolean, value: T }
1615
type SubActorData = Partial<BladesActor["system"]>
1716
type AdvancementTrait = ActionTrait|"Ability"|"Upgrade"|"Cohort"|"CohortType"
1817
type Loadout = "heavy"|"normal"|"light"|"encumbered"

src/ts/@types/blades-chat.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import BladesPC from "../documents/actors/BladesPC";
66
import BladesNPC from "../documents/actors/BladesNPC";
77
import BladesFaction from "../documents/actors/BladesFaction";
88
import BladesCrew from "../documents/actors/BladesCrew";
9-
import BladesChat from "../classes/BladesChat";
9+
import BladesChatMessage from "../classes/BladesChatMessage";
1010
import {ChatMessageDataSchema} from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/data/data.mjs/chatMessageData";
1111
/* eslint-enable @typescript-eslint/no-unused-vars */
1212
// #endregion

src/ts/@types/blades-consequence.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ declare global {
3333

3434
export type DisplayType = "base"|"accept"|ResistanceType;
3535

36-
export type ResistSubSchema = {
36+
export interface ResistSubSchema {
3737
name: string,
3838
type: ConsequenceType,
3939
resistSchema?: {
@@ -42,7 +42,7 @@ declare global {
4242
}
4343
}
4444

45-
export type Schema = {
45+
export interface Schema {
4646
name: string,
4747
type: ConsequenceType,
4848
actionRollData?: BladesRoll.Data,

src/ts/@types/blades-document.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare global {
1212
static get All(): T extends Actor ? BladesActor[] : BladesItem[];
1313
static Get(docRef: DocRef): (T extends Actor ? BladesActor[] : BladesItem[]) | undefined;
1414
static GetTypeWithTags(type: BladesActorType | BladesItemType, ...tags: BladesTag[]): T extends Actor ? BladesActor[] : BladesItem[];
15-
static IsType<T extends BladesActorType|BladesItemType>(doc: BladesDoc, ...types: T[]): boolean;
15+
static IsType<T extends BladesActorType|BladesItemType>(doc: EntityDoc, ...types: T[]): boolean;
1616

1717
tags: BladesTag[];
1818
hasTag(...tags: BladesTag[]): boolean
Lines changed: 64 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
1-
import {AttributeTrait, ActionTrait, District} from "../core/constants";
2-
import BladesItem from "../BladesItem";
1+
// #region IMPORTS ~
32
import BladesActor from "../BladesActor";
4-
import BladesChat from "../classes/BladesChat";
3+
import BladesItem from "../BladesItem";
54
import BladesActorSheet from "../sheets/actor/BladesActorSheet";
65
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";
116

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
1235

1336
declare global {
1437
// #region MISCELLANEOUS TYPE ALIASES (nonfunctional; for clarity) ~
@@ -31,18 +54,6 @@ declare global {
3154
// Represents any class constructor with an unknown number of parameters
3255
type AnyClass<T = unknown> = new (...args: unknown[]) => T;
3356

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-
4657
// Represents a key which can be a string, number, or symbol
4758
type key = string | number | symbol;
4859

@@ -53,13 +64,13 @@ declare global {
5364
type StringLike = string | number | boolean | null | undefined;
5465

5566
// Represents a number represented as a string
56-
type NumString = string;
67+
type NumString = `${number}`;
5768

5869
// Represents an object with number-strings as keys
5970
type StringArray<T> = Record<NumString, T>;
6071

6172
// Represents "true" or "false" as a string
62-
type BoolString = string;
73+
type BoolString = `${boolean}`;
6374

6475
// Represents falsy values and empty objects to be pruned when cleaning list of values
6576
type UncleanValues = false | null | undefined | "" | 0 | Record<string, never> | never[];
@@ -79,13 +90,14 @@ declare global {
7990
type StringCase = "upper" | "lower" | "sentence" | "title";
8091

8192
// Represents HTML code as a string
82-
type HTMLCode = string;
93+
type HTMLCode = string & {__htmlStringBrand: never};
8394

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}`;
8697

8798
// 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})`;
89101

90102
// Represents a key of a certain type
91103
type KeyOf<T> = keyof T;
@@ -107,32 +119,30 @@ declare global {
107119

108120
// Represents a check test
109121
type checkTest = ((...args: unknown[]) => unknown) | testFunc<keyFunc> | testFunc<valFunc> | RegExp | number | string;
110-
111122
// #endregion
112123

113-
114124
// Represents a document id as a string
115-
type IDString = string & { __idStringBrand: never };
125+
type IDString = string & {__idStringBrand: never};
116126

117127
// 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.
119129

120130
// Represents a dotkey
121-
type DotKey = string & { __dotKeyBrand: never };
131+
type DotKey = string & {__dotKeyBrand: never};
122132

123133
// Represents a dotkey appropriate for an update() data object
124-
type TargetKey = string & DotKey & { __targetKeyBrand: never };
134+
type TargetKey = string & DotKey & {__targetKeyBrand: never};
125135

126136
// 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};
128138

129139
// Represents a jQuery text term
130140
type jQueryTextTerm = string | number | boolean | (
131141
(this: Element, index: number, text: string) => string | number | boolean
132142
);
133143

134144
// 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}
136146

137147
// Represents an object describing dimensions of an HTML element, in the form of a DOMRect object with mutable properties.
138148
type MutableRect = Omit<Mutable<DOMRect>, "toJSON">;
@@ -164,99 +174,44 @@ declare global {
164174
-readonly [P in keyof T]: T[P];
165175
};
166176

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+
167191
// Represents a gsap animation
168192
type gsapAnim = gsap.core.Tween | gsap.core.Timeline;
169193

170194
// Represents a generic Blades document
171-
type BladesDoc = BladesActor | BladesItem;
195+
type EntityDoc = ActorDoc | ItemDoc;
172196

173197
// Represents any Blades document sheet
174-
type BladesSheet = BladesActorSheet | BladesItemSheet;
198+
type EntitySheet = ActorSheetDoc | ItemSheetDoc;
175199

176200
// Represents any document that can be the target of a BladesTargetLink subclass.
177-
type BladesLinkDoc = BladesDoc | BladesChat | User;
201+
type TargetLinkDoc = EntityDoc | ChatMessageDoc | UserDoc;
178202

179203
// Represents a reference to a Blades document
180-
type DocRef = string | BladesDoc;
204+
type DocRef = string | EntityDoc;
181205

182206
// Represents a reference to a Blades actor
183-
type ActorRef = string | BladesActor;
207+
type ActorRef = string | ActorDoc;
184208

185209
// Represents a reference to a Blades item
186-
type ItemRef = string | BladesItem;
210+
type ItemRef = string | ItemDoc;
187211

188212
// Utility Types for Variable Template Values
189-
type ValueMax = {max: number, value: number};
213+
interface ValueMax {max: number, value: number}
190214
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-
};
198215

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-
}
261216
export declare function randomID(length?: number): IDString;
262217
}

0 commit comments

Comments
 (0)