@scml-dol-maplebirch/types 4.3.1
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/README.md +79 -0
- package/index.d.ts +29 -0
- package/maplebirch.d.ts +3250 -0
- package/package.json +44 -0
package/maplebirch.d.ts
ADDED
|
@@ -0,0 +1,3250 @@
|
|
|
1
|
+
import { Passage } from '@scml/types/sugarcube-2-ModLoader/SugarCube2';
|
|
2
|
+
import { ModBootJson, ModInfo } from '@scml/types/sugarcube-2-ModLoader/ModLoader';
|
|
3
|
+
import { JSZipLikeReadOnlyInterface } from '@scml/types/sugarcube-2-ModLoader/JSZipLikeReadOnlyInterface';
|
|
4
|
+
import { ModZipReader } from '@scml/types/sugarcube-2-ModLoader/ModZipReader';
|
|
5
|
+
import { SC2DataManager } from '@scml/types/sugarcube-2-ModLoader/SC2DataManager';
|
|
6
|
+
import { ModUtils } from '@scml/types/sugarcube-2-ModLoader/Utils';
|
|
7
|
+
import { BrowserAPI } from '@scml/sc2-verlnir/src/browser';
|
|
8
|
+
import { ConfigAPI } from '@scml/sc2-verlnir/src/config';
|
|
9
|
+
import { DebugBarAPI } from '@scml/sc2-verlnir/src/debugbar';
|
|
10
|
+
import { DialogAPI } from '@scml/sc2-verlnir/src/dialog';
|
|
11
|
+
import { EngineAPI } from '@scml/sc2-verlnir/src/engine';
|
|
12
|
+
import { FullscreenAPI } from '@scml/sc2-verlnir/src/fullscreen';
|
|
13
|
+
import { HasAPI } from '@scml/sc2-verlnir/src/has';
|
|
14
|
+
import { IdbAPI } from '@scml/sc2-verlnir/src/idb';
|
|
15
|
+
import { L10nAPI } from '@scml/sc2-verlnir/src/l10n';
|
|
16
|
+
import { LinksAPI } from '@scml/sc2-verlnir/src/links';
|
|
17
|
+
import { LoadScreenAPI } from '@scml/sc2-verlnir/src/loadscreen';
|
|
18
|
+
import { MacroAPI } from '@scml/sc2-verlnir/src/macro';
|
|
19
|
+
import { PassageConstructor } from '@scml/sc2-verlnir/src/passage';
|
|
20
|
+
import { SaveAPI } from '@scml/sc2-verlnir/src/save';
|
|
21
|
+
import { ScriptingAPI } from '@scml/sc2-verlnir/src/scripting';
|
|
22
|
+
import { SettingAPI } from '@scml/sc2-verlnir/src/setting';
|
|
23
|
+
import { SimpleAudioAPI } from '@scml/sc2-verlnir/src/simpleaudio';
|
|
24
|
+
import { SimpleStoreAPI, SimpleStoreInstanceAPI } from '@scml/sc2-verlnir/src/simplestore';
|
|
25
|
+
import { StateAPI } from '@scml/sc2-verlnir/src/state';
|
|
26
|
+
import { StoryAPI } from '@scml/sc2-verlnir/src/story';
|
|
27
|
+
import { TemplateAPI } from '@scml/sc2-verlnir/src/template';
|
|
28
|
+
import { UIAPI } from '@scml/sc2-verlnir/src/ui';
|
|
29
|
+
import { UIBarAPI } from '@scml/sc2-verlnir/src/uibar';
|
|
30
|
+
import { UtilAPI } from '@scml/sc2-verlnir/src/util';
|
|
31
|
+
import { VersionInfo } from '@scml/sc2-verlnir/src/version';
|
|
32
|
+
import { VisibilityAPI } from '@scml/sc2-verlnir/src/visibility';
|
|
33
|
+
import { WikifierAPI } from '@scml/sc2-verlnir/src/wikifier';
|
|
34
|
+
import { Gui } from '@scml/types/Mod_LoaderGui/Gui';
|
|
35
|
+
import jsyaml from 'js-yaml';
|
|
36
|
+
import { Howl, Howler } from 'howler';
|
|
37
|
+
import * as marked from 'marked';
|
|
38
|
+
import { MacroContext } from 'twine-sugarcube';
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region types/twine-sugarcube.d.ts
|
|
41
|
+
declare module 'twine-sugarcube/userdata' {
|
|
42
|
+
export interface SugarCubeSetupObject {
|
|
43
|
+
[x: string]: any;
|
|
44
|
+
}
|
|
45
|
+
export interface SugarCubeStoryVariables {
|
|
46
|
+
[x: string]: any;
|
|
47
|
+
}
|
|
48
|
+
export interface SugarCubeTemporaryVariables {
|
|
49
|
+
[x: string]: any;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
declare module 'twine-sugarcube' {
|
|
53
|
+
export interface WikifierAPI {
|
|
54
|
+
wikifyEval(
|
|
55
|
+
text: string,
|
|
56
|
+
passageObj?: {
|
|
57
|
+
title: string;
|
|
58
|
+
},
|
|
59
|
+
passageTitle?: string
|
|
60
|
+
): DocumentFragment;
|
|
61
|
+
}
|
|
62
|
+
export interface MacroDefinition {
|
|
63
|
+
isAsync?: boolean;
|
|
64
|
+
isWidget?: boolean;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
interface DolStateAPI extends StateAPI {
|
|
68
|
+
show(): void;
|
|
69
|
+
}
|
|
70
|
+
interface DolSaveAPI extends SaveAPI {
|
|
71
|
+
serialize(metadata?: any): string;
|
|
72
|
+
deserialize(saveStr: string): any;
|
|
73
|
+
}
|
|
74
|
+
type WikifierAPI$1 = WikifierAPI & {
|
|
75
|
+
wikifyEval(
|
|
76
|
+
text: string,
|
|
77
|
+
passageObj?: {
|
|
78
|
+
title: string;
|
|
79
|
+
},
|
|
80
|
+
passageTitle?: string
|
|
81
|
+
): DocumentFragment;
|
|
82
|
+
};
|
|
83
|
+
interface SugarCubeUtilAPI extends UtilAPI {
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
86
|
+
interface TwineSugarCube {
|
|
87
|
+
Browser: BrowserAPI;
|
|
88
|
+
Config: ConfigAPI;
|
|
89
|
+
Dialog: DialogAPI;
|
|
90
|
+
Engine: EngineAPI;
|
|
91
|
+
Fullscreen: FullscreenAPI;
|
|
92
|
+
Has: HasAPI;
|
|
93
|
+
L10n: L10nAPI;
|
|
94
|
+
Links: LinksAPI;
|
|
95
|
+
LoadScreen: LoadScreenAPI;
|
|
96
|
+
Macro: MacroAPI;
|
|
97
|
+
Passage: PassageConstructor;
|
|
98
|
+
Save: DolSaveAPI;
|
|
99
|
+
Scripting: ScriptingAPI;
|
|
100
|
+
Setting: SettingAPI;
|
|
101
|
+
SimpleAudio: SimpleAudioAPI;
|
|
102
|
+
SimpleStore: SimpleStoreAPI;
|
|
103
|
+
State: DolStateAPI;
|
|
104
|
+
Story: StoryAPI;
|
|
105
|
+
Template: TemplateAPI;
|
|
106
|
+
UI: UIAPI;
|
|
107
|
+
UIBar: UIBarAPI;
|
|
108
|
+
DebugBar: DebugBarAPI;
|
|
109
|
+
Util: SugarCubeUtilAPI;
|
|
110
|
+
Visibility: VisibilityAPI;
|
|
111
|
+
Wikifier: WikifierAPI$1;
|
|
112
|
+
idb: IdbAPI;
|
|
113
|
+
session: SimpleStoreInstanceAPI | null;
|
|
114
|
+
settings: Record<string, unknown>;
|
|
115
|
+
setup: Record<string, unknown>;
|
|
116
|
+
storage: SimpleStoreInstanceAPI | null;
|
|
117
|
+
version: VersionInfo;
|
|
118
|
+
}
|
|
119
|
+
declare global {
|
|
120
|
+
const V: Record<string, any>;
|
|
121
|
+
const C: Record<string, any>;
|
|
122
|
+
const T: Record<string, any>;
|
|
123
|
+
interface DateTimeData {
|
|
124
|
+
year: number;
|
|
125
|
+
month: number;
|
|
126
|
+
day: number;
|
|
127
|
+
hour?: number;
|
|
128
|
+
minute?: number;
|
|
129
|
+
second?: number;
|
|
130
|
+
timeStamp: number;
|
|
131
|
+
}
|
|
132
|
+
interface DateTimeDiff {
|
|
133
|
+
years: number;
|
|
134
|
+
months: number;
|
|
135
|
+
days: number;
|
|
136
|
+
hours: number;
|
|
137
|
+
minutes: number;
|
|
138
|
+
seconds: number;
|
|
139
|
+
}
|
|
140
|
+
interface DateTimeConstructor {
|
|
141
|
+
readonly MIN_DATE: DateTime;
|
|
142
|
+
readonly MAX_DATE: DateTime;
|
|
143
|
+
new (timestamp?: number): DateTime;
|
|
144
|
+
new (date: DateTimeData): DateTime;
|
|
145
|
+
new (year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number): DateTime;
|
|
146
|
+
toSerialYear(year: number): number;
|
|
147
|
+
fromSerialYear(serialYear: number): number;
|
|
148
|
+
getTotalDaysSinceStart(year: number): number;
|
|
149
|
+
isLeapYear(year: number): boolean;
|
|
150
|
+
getDaysOfMonthFromYear(year: number): readonly number[];
|
|
151
|
+
getDaysOfYear(year: number): number;
|
|
152
|
+
}
|
|
153
|
+
class DateTime implements DateTimeData {
|
|
154
|
+
static readonly MIN_DATE: DateTime;
|
|
155
|
+
static readonly MAX_DATE: DateTime;
|
|
156
|
+
constructor(timestamp?: number);
|
|
157
|
+
constructor(date: DateTimeData);
|
|
158
|
+
constructor(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number);
|
|
159
|
+
year: number;
|
|
160
|
+
month: number;
|
|
161
|
+
day: number;
|
|
162
|
+
hour: number;
|
|
163
|
+
minute: number;
|
|
164
|
+
second: number;
|
|
165
|
+
timeStamp: number;
|
|
166
|
+
static toSerialYear(year: number): number;
|
|
167
|
+
static fromSerialYear(serialYear: number): number;
|
|
168
|
+
static getTotalDaysSinceStart(year: number): number;
|
|
169
|
+
static isLeapYear(year: number): boolean;
|
|
170
|
+
static getDaysOfMonthFromYear(year: number): readonly number[];
|
|
171
|
+
static getDaysOfYear(year: number): number;
|
|
172
|
+
toTimestamp(year: number, month: number, day: number, hour: number, minute: number, second: number): this;
|
|
173
|
+
fromTimestamp(timestamp: number): this;
|
|
174
|
+
compareWith(otherDateTime: DateTime, getSeconds?: boolean): number | DateTimeDiff;
|
|
175
|
+
dayDifference(otherDateTime: DateTime): number;
|
|
176
|
+
getFirstWeekdayOfMonth(weekDay: number): DateTime;
|
|
177
|
+
getNextWeekdayDate(weekDay: number): DateTime;
|
|
178
|
+
getPreviousWeekdayDate(weekDay: number): DateTime;
|
|
179
|
+
addYears(years: number): this;
|
|
180
|
+
addMonths(months: number): this;
|
|
181
|
+
addDays(days: number): this;
|
|
182
|
+
addHours(hours: number): this;
|
|
183
|
+
addMinutes(minutes: number): this;
|
|
184
|
+
addSeconds(seconds: number): this;
|
|
185
|
+
isLastDayOfMonth(): boolean;
|
|
186
|
+
isFirstDayOfMonth(): boolean;
|
|
187
|
+
between(startDate: DateTime, endDate: DateTime): boolean;
|
|
188
|
+
readonly midnight: DateTime;
|
|
189
|
+
readonly dayState: string;
|
|
190
|
+
readonly weekDay: number;
|
|
191
|
+
readonly weekDayName: string;
|
|
192
|
+
readonly monthName: string;
|
|
193
|
+
readonly weekEnd: boolean;
|
|
194
|
+
readonly lastDayOfMonth: number;
|
|
195
|
+
readonly yearDay: number;
|
|
196
|
+
readonly moonPhaseFraction: number;
|
|
197
|
+
readonly fractionOfDay: number;
|
|
198
|
+
readonly fractionOfDayFromNoon: number;
|
|
199
|
+
readonly simplifiedDayFactor: number;
|
|
200
|
+
readonly fractionOfYear: number;
|
|
201
|
+
readonly seasonFactor: number;
|
|
202
|
+
}
|
|
203
|
+
interface MoonPhase {
|
|
204
|
+
start: number;
|
|
205
|
+
end: number;
|
|
206
|
+
endAlt?: number;
|
|
207
|
+
description: string;
|
|
208
|
+
}
|
|
209
|
+
interface TimeAPI {
|
|
210
|
+
readonly date: DateTime;
|
|
211
|
+
readonly holidayMonths: number[];
|
|
212
|
+
readonly second: number;
|
|
213
|
+
readonly minute: number;
|
|
214
|
+
readonly hour: number;
|
|
215
|
+
readonly weekDay: number;
|
|
216
|
+
readonly weekDayName: string;
|
|
217
|
+
readonly monthDay: number;
|
|
218
|
+
readonly month: number;
|
|
219
|
+
readonly monthName: string;
|
|
220
|
+
readonly year: number;
|
|
221
|
+
readonly days: number;
|
|
222
|
+
readonly season: string;
|
|
223
|
+
readonly tomorrow: DateTime;
|
|
224
|
+
readonly yesterday: DateTime;
|
|
225
|
+
readonly schoolTerm: boolean;
|
|
226
|
+
readonly schoolDay: boolean;
|
|
227
|
+
readonly schoolTime: boolean;
|
|
228
|
+
readonly dayState: string;
|
|
229
|
+
readonly nextSchoolTermStartDate: DateTime;
|
|
230
|
+
readonly nextSchoolTermEndDate: DateTime;
|
|
231
|
+
readonly lastDayOfMonth: number;
|
|
232
|
+
readonly dayOfYear: number;
|
|
233
|
+
readonly secondsSinceMidnight: number;
|
|
234
|
+
readonly currentMoonPhase: string;
|
|
235
|
+
startDate: DateTime;
|
|
236
|
+
monthNames: string[];
|
|
237
|
+
daysOfWeek: string[];
|
|
238
|
+
moonPhases: Record<string, MoonPhase>;
|
|
239
|
+
set(time?: number | DateTime): void;
|
|
240
|
+
setDate(date: DateTime): void;
|
|
241
|
+
setTime(hour: number, minute?: number): void;
|
|
242
|
+
setTimeRelative(hour?: number, minute?: number): void;
|
|
243
|
+
pass(seconds: number): any;
|
|
244
|
+
timeTravel(date: DateTime): any;
|
|
245
|
+
isSchoolTerm(date: DateTime): boolean;
|
|
246
|
+
isSchoolDay(date: DateTime): boolean;
|
|
247
|
+
isSchoolTime(date: DateTime): boolean;
|
|
248
|
+
getDayOfYear(date: DateTime): number;
|
|
249
|
+
getSecondsSinceMidnight(date: DateTime): number;
|
|
250
|
+
nextMoonPhase(targetPhase: string): DateTime;
|
|
251
|
+
previousMoonPhase(targetPhase: string): DateTime;
|
|
252
|
+
isBloodMoon(date?: DateTime): boolean;
|
|
253
|
+
getSeason(date: DateTime): string;
|
|
254
|
+
getNextSchoolTermStartDate(date: DateTime): DateTime;
|
|
255
|
+
getNextSchoolTermEndDate(date: DateTime): DateTime;
|
|
256
|
+
getNextWeekdayDate(weekDay: number): DateTime;
|
|
257
|
+
getPreviousWeekdayDate(weekDay: number): DateTime;
|
|
258
|
+
isWeekEnd(): boolean;
|
|
259
|
+
hasDatePassed(month: number, day: number): boolean;
|
|
260
|
+
betweenHours(from: number, to: number, pass?: number): boolean;
|
|
261
|
+
openingHours(minutes?: number): boolean;
|
|
262
|
+
readonly oxygenResaturationDuration: number;
|
|
263
|
+
}
|
|
264
|
+
const Time: TimeAPI;
|
|
265
|
+
type CanvasLayerMap = Record<string, LayerConfig>;
|
|
266
|
+
type CanvasLayerFilter = string | Record<string, any>;
|
|
267
|
+
type CanvasLayerSrc = string | string[] | undefined;
|
|
268
|
+
type CanvasLayerValueFn<T = any> = (options: any) => T;
|
|
269
|
+
interface CanvasModelOptionsData {
|
|
270
|
+
filters?: Record<string, any>;
|
|
271
|
+
generatedLayers?: CanvasLayerMap;
|
|
272
|
+
[key: string]: any;
|
|
273
|
+
}
|
|
274
|
+
interface LayerConfig {
|
|
275
|
+
name?: string;
|
|
276
|
+
model?: CanvasModel;
|
|
277
|
+
defaultOptions?: LayerConfig;
|
|
278
|
+
show?: boolean;
|
|
279
|
+
src?: CanvasLayerSrc;
|
|
280
|
+
z?: number;
|
|
281
|
+
alpha?: number;
|
|
282
|
+
maskAlpha?: number;
|
|
283
|
+
brightness?: number;
|
|
284
|
+
contrast?: number;
|
|
285
|
+
blend?: string;
|
|
286
|
+
blendMode?: string;
|
|
287
|
+
maskBlendMode?: string;
|
|
288
|
+
compositeOperation?: string;
|
|
289
|
+
desaturate?: boolean;
|
|
290
|
+
masksrc?: CanvasLayerSrc;
|
|
291
|
+
animation?: any;
|
|
292
|
+
filters?: CanvasLayerFilter[];
|
|
293
|
+
dx?: number;
|
|
294
|
+
dy?: number;
|
|
295
|
+
width?: number;
|
|
296
|
+
height?: number;
|
|
297
|
+
worn?: string;
|
|
298
|
+
scale?: boolean | number;
|
|
299
|
+
frameDx?: number;
|
|
300
|
+
frameDy?: number;
|
|
301
|
+
showfn?: CanvasLayerValueFn<boolean>;
|
|
302
|
+
srcfn?: CanvasLayerValueFn<CanvasLayerSrc>;
|
|
303
|
+
zfn?: CanvasLayerValueFn<number>;
|
|
304
|
+
alphafn?: CanvasLayerValueFn<number>;
|
|
305
|
+
maskAlphafn?: CanvasLayerValueFn<number>;
|
|
306
|
+
brightnessfn?: CanvasLayerValueFn<number>;
|
|
307
|
+
contrastfn?: CanvasLayerValueFn<number>;
|
|
308
|
+
blendfn?: CanvasLayerValueFn<string | undefined>;
|
|
309
|
+
blendModefn?: CanvasLayerValueFn<string | undefined>;
|
|
310
|
+
maskBlendModefn?: CanvasLayerValueFn<string | undefined>;
|
|
311
|
+
compositeOperationfn?: CanvasLayerValueFn<string | undefined>;
|
|
312
|
+
desaturatefn?: CanvasLayerValueFn<boolean>;
|
|
313
|
+
masksrcfn?: CanvasLayerValueFn<CanvasLayerSrc>;
|
|
314
|
+
animationfn?: CanvasLayerValueFn<any>;
|
|
315
|
+
filtersfn?: CanvasLayerValueFn<CanvasLayerFilter[] | undefined>;
|
|
316
|
+
dxfn?: CanvasLayerValueFn<number>;
|
|
317
|
+
dyfn?: CanvasLayerValueFn<number>;
|
|
318
|
+
widthfn?: CanvasLayerValueFn<number>;
|
|
319
|
+
heightfn?: CanvasLayerValueFn<number>;
|
|
320
|
+
wornfn?: CanvasLayerValueFn<string | undefined>;
|
|
321
|
+
scalefn?: CanvasLayerValueFn<boolean | number | undefined>;
|
|
322
|
+
[key: string]: any;
|
|
323
|
+
}
|
|
324
|
+
interface CanvasModelOptions {
|
|
325
|
+
name: string;
|
|
326
|
+
width: number;
|
|
327
|
+
height: number;
|
|
328
|
+
layers: CanvasLayerMap;
|
|
329
|
+
frames?: number;
|
|
330
|
+
metadata?: Record<string, any>;
|
|
331
|
+
scale?: boolean | number;
|
|
332
|
+
generatedOptions?: (this: CanvasModel) => any[];
|
|
333
|
+
defaultOptions?: (this: CanvasModel) => CanvasModelOptionsData;
|
|
334
|
+
preprocess?: (this: CanvasModel, options: any) => void;
|
|
335
|
+
postprocess?: (this: CanvasModel, options: any) => void;
|
|
336
|
+
[key: string]: any;
|
|
337
|
+
}
|
|
338
|
+
interface CanvasModelConstructor {
|
|
339
|
+
new (...args: any[]): CanvasModel;
|
|
340
|
+
create(id: string, slot?: string): CanvasModel;
|
|
341
|
+
}
|
|
342
|
+
class CanvasModel {
|
|
343
|
+
static create(id: string, slot?: string): CanvasModel;
|
|
344
|
+
constructor(...args: any[]);
|
|
345
|
+
name: string;
|
|
346
|
+
width: number;
|
|
347
|
+
height: number;
|
|
348
|
+
frames: number;
|
|
349
|
+
metadata: Record<string, any>;
|
|
350
|
+
scale: boolean | number;
|
|
351
|
+
layers: CanvasLayerMap;
|
|
352
|
+
layerList: LayerConfig[];
|
|
353
|
+
options: CanvasModelOptionsData;
|
|
354
|
+
animated: boolean;
|
|
355
|
+
canvas: CanvasRenderingContext2D | null;
|
|
356
|
+
listener?: any;
|
|
357
|
+
rendererListener?: any;
|
|
358
|
+
generatedOptions(): any[];
|
|
359
|
+
defaultOptions(): CanvasModelOptionsData;
|
|
360
|
+
createCanvas(cssAnimated?: boolean): CanvasRenderingContext2D;
|
|
361
|
+
reset(): void;
|
|
362
|
+
showLayer(name: string, filters: CanvasLayerFilter[]): void;
|
|
363
|
+
hideLayer(name: string): void;
|
|
364
|
+
render(canvas: CanvasRenderingContext2D, options?: any, listener?: any): void;
|
|
365
|
+
animate(canvas: CanvasRenderingContext2D, options?: any, listener?: any): any;
|
|
366
|
+
redraw(): any;
|
|
367
|
+
preprocess(options: any): void;
|
|
368
|
+
postprocess(options: any): void;
|
|
369
|
+
compile(options?: any): LayerConfig[];
|
|
370
|
+
}
|
|
371
|
+
export interface JQueryAriaClickOptions {
|
|
372
|
+
role?: string;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/constants.d.ts
|
|
377
|
+
type LanguageCode = (typeof Languages)[number];
|
|
378
|
+
declare const Languages: readonly ['EN', 'CN'];
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/utils/object.d.ts
|
|
381
|
+
type MergeFilterFn = (key: string, value: any, depth: number, targetValue: any) => boolean;
|
|
382
|
+
declare function clone(source: any, deep?: boolean, proto?: boolean, map?: WeakMap<object, any>): any;
|
|
383
|
+
declare function equal(a: any, b: any): boolean;
|
|
384
|
+
declare function merge(target: any, ...sources: any[]): any;
|
|
385
|
+
declare function append(target: any, ...sources: any[]): any;
|
|
386
|
+
declare function cover(target: any, ...sources: any[]): any;
|
|
387
|
+
declare function mergeFn(target: any, filterFn: MergeFilterFn | null, ...sources: any[]): any;
|
|
388
|
+
declare function appendFn(target: any, filterFn: MergeFilterFn | null, ...sources: any[]): any;
|
|
389
|
+
declare function coverFn(target: any, filterFn: MergeFilterFn | null, ...sources: any[]): any;
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/utils/array.d.ts
|
|
392
|
+
type ContainsMode = 'all' | 'any' | 'none';
|
|
393
|
+
type ContainsOptions = {
|
|
394
|
+
case?: boolean;
|
|
395
|
+
compare?: (item: unknown, value: unknown) => boolean;
|
|
396
|
+
deep?: boolean;
|
|
397
|
+
};
|
|
398
|
+
declare function contains(array: readonly unknown[], value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
|
|
399
|
+
declare function randomNumber(min?: number, max?: number, float?: boolean): number;
|
|
400
|
+
declare function randomPick<T>(items: readonly T[], weights?: readonly number[] | null, allowNull?: boolean): T | null | undefined;
|
|
401
|
+
declare function clamp(value: any, min: number, max: number, fallback?: number): number;
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/utils/string.d.ts
|
|
404
|
+
type ConvertMode$1 = 'lower' | 'upper' | 'capitalize' | 'title' | 'camel' | 'pascal' | 'snake' | 'kebab' | 'constant';
|
|
405
|
+
declare function convert(
|
|
406
|
+
value: string,
|
|
407
|
+
mode?: ConvertMode$1,
|
|
408
|
+
options?: {
|
|
409
|
+
delimiter?: string;
|
|
410
|
+
acronym?: boolean;
|
|
411
|
+
}
|
|
412
|
+
): string;
|
|
413
|
+
declare function escapeHtmlText(value: string): string;
|
|
414
|
+
declare function widgets(content: string): string;
|
|
415
|
+
declare function widgets(...contents: string[]): string[];
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/utils/binary.d.ts
|
|
418
|
+
declare function textToBytes(value: string): Uint8Array;
|
|
419
|
+
declare function jsonToBytes(value: unknown): Uint8Array;
|
|
420
|
+
declare function bytesToJson<T = any>(bytes: Uint8Array | ArrayBuffer): T;
|
|
421
|
+
declare function toArrayBuffer(bytes: Uint8Array): ArrayBuffer;
|
|
422
|
+
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
423
|
+
declare function base64ToBytes(value: string): Uint8Array;
|
|
424
|
+
declare function base64ToArrayBuffer(value: string): ArrayBuffer;
|
|
425
|
+
declare function basicAuth(username: string, password: string): string;
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/utils/path.d.ts
|
|
428
|
+
declare function joinEncodedPath(...parts: string[]): string;
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/utils/selector.d.ts
|
|
431
|
+
declare class SelectCase {
|
|
432
|
+
private cases;
|
|
433
|
+
private defaultResult;
|
|
434
|
+
private valueType;
|
|
435
|
+
private allowMixedTypes;
|
|
436
|
+
case(condition: string | number, result: any): this;
|
|
437
|
+
case(condition: (input: any, meta?: any) => boolean, result: any): this;
|
|
438
|
+
casePredicate(fn: (input: any, meta?: any) => boolean, result: any): this;
|
|
439
|
+
caseRange(min: number, max: number, result: any): this;
|
|
440
|
+
caseIn(values: any[], result: any): this;
|
|
441
|
+
caseIncludes(values: string | string[], result: any): this;
|
|
442
|
+
caseRegex(regex: RegExp, result: any): this;
|
|
443
|
+
caseCompare(operator: '<' | '<=' | '>' | '>=', value: number, result: any): this;
|
|
444
|
+
else(result: any): this;
|
|
445
|
+
match(input: any, meta?: any): any;
|
|
446
|
+
private validateType;
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/utils/image.d.ts
|
|
450
|
+
declare function loadImage(src: string): string | boolean | Promise<string | boolean>;
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/utils/prototype.d.ts
|
|
453
|
+
declare global {
|
|
454
|
+
interface ObjectConstructor {
|
|
455
|
+
merge<T extends object = any>(...sources: any[]): T;
|
|
456
|
+
append<T extends object = any>(...sources: any[]): T;
|
|
457
|
+
cover<T extends object = any>(...sources: any[]): T;
|
|
458
|
+
mergefn<T extends object = any>(filterFn: MergeFilterFn | null, ...sources: any[]): T;
|
|
459
|
+
appendfn<T extends object = any>(filterFn: MergeFilterFn | null, ...sources: any[]): T;
|
|
460
|
+
coverfn<T extends object = any>(filterFn: MergeFilterFn | null, ...sources: any[]): T;
|
|
461
|
+
}
|
|
462
|
+
interface Array<T> {
|
|
463
|
+
contains(value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
|
|
464
|
+
either(weights?: number[], allowNull?: boolean): T | null | undefined;
|
|
465
|
+
}
|
|
466
|
+
interface ArrayConstructor {
|
|
467
|
+
merge<T = any>(...sources: any[]): T[];
|
|
468
|
+
append<T = any>(...sources: any[]): T[];
|
|
469
|
+
cover<T = any>(...sources: any[]): T[];
|
|
470
|
+
}
|
|
471
|
+
interface ReadonlyArray<T> {
|
|
472
|
+
contains(value: unknown, mode?: ContainsMode, options?: ContainsOptions): boolean;
|
|
473
|
+
either(weights?: number[], allowNull?: boolean): T | null | undefined;
|
|
474
|
+
}
|
|
475
|
+
interface String {
|
|
476
|
+
contains(
|
|
477
|
+
value: string,
|
|
478
|
+
options?: {
|
|
479
|
+
case?: boolean;
|
|
480
|
+
}
|
|
481
|
+
): boolean;
|
|
482
|
+
convert(
|
|
483
|
+
mode?: ConvertMode$1,
|
|
484
|
+
options?: {
|
|
485
|
+
delimiter?: string;
|
|
486
|
+
acronym?: boolean;
|
|
487
|
+
}
|
|
488
|
+
): string;
|
|
489
|
+
}
|
|
490
|
+
interface Math {
|
|
491
|
+
random(): number;
|
|
492
|
+
random(max: number): number;
|
|
493
|
+
random(min: number, max: number, float?: boolean): number;
|
|
494
|
+
clamp(value: any, min: number, max: number, fallback?: number): number;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
declare function prototypeUtils(): void;
|
|
498
|
+
declare namespace index_d_exports {
|
|
499
|
+
export {
|
|
500
|
+
SelectCase,
|
|
501
|
+
append,
|
|
502
|
+
appendFn as appendfn,
|
|
503
|
+
base64ToArrayBuffer,
|
|
504
|
+
base64ToBytes,
|
|
505
|
+
basicAuth,
|
|
506
|
+
bytesToBase64,
|
|
507
|
+
bytesToJson,
|
|
508
|
+
clamp,
|
|
509
|
+
clone,
|
|
510
|
+
contains,
|
|
511
|
+
convert,
|
|
512
|
+
cover,
|
|
513
|
+
coverFn as coverfn,
|
|
514
|
+
randomPick as either,
|
|
515
|
+
equal,
|
|
516
|
+
escapeHtmlText,
|
|
517
|
+
joinEncodedPath,
|
|
518
|
+
jsonToBytes,
|
|
519
|
+
loadImage,
|
|
520
|
+
merge,
|
|
521
|
+
mergeFn as mergefn,
|
|
522
|
+
prototypeUtils,
|
|
523
|
+
publicUtils,
|
|
524
|
+
randomNumber as random,
|
|
525
|
+
textToBytes,
|
|
526
|
+
toArrayBuffer,
|
|
527
|
+
widgets
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
declare const publicUtils: Readonly<{
|
|
531
|
+
clone: typeof clone;
|
|
532
|
+
equal: typeof equal;
|
|
533
|
+
merge: typeof merge;
|
|
534
|
+
append: typeof append;
|
|
535
|
+
cover: typeof cover;
|
|
536
|
+
mergefn: typeof mergeFn;
|
|
537
|
+
appendfn: typeof appendFn;
|
|
538
|
+
coverfn: typeof coverFn;
|
|
539
|
+
contains: typeof contains;
|
|
540
|
+
random: typeof randomNumber;
|
|
541
|
+
either: typeof randomPick;
|
|
542
|
+
SelectCase: typeof SelectCase;
|
|
543
|
+
convert: typeof convert;
|
|
544
|
+
clamp: typeof clamp;
|
|
545
|
+
loadImage: typeof loadImage;
|
|
546
|
+
}>;
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/services/Logger.d.ts
|
|
549
|
+
declare class Logger {
|
|
550
|
+
readonly core: MaplebirchCore;
|
|
551
|
+
private static readonly LEVELS;
|
|
552
|
+
private static readonly CONFIG;
|
|
553
|
+
private level;
|
|
554
|
+
constructor(core: MaplebirchCore);
|
|
555
|
+
fromIDB(): Promise<void>;
|
|
556
|
+
log(message: string, levelName?: string | number, ...objects: unknown[]): void;
|
|
557
|
+
set LevelName(levelName: string);
|
|
558
|
+
get LevelName(): string;
|
|
559
|
+
}
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region src/services/EventEmitter.d.ts
|
|
562
|
+
type EventCallback = (...args: any[]) => unknown;
|
|
563
|
+
declare class EventEmitter {
|
|
564
|
+
readonly core: MaplebirchCore;
|
|
565
|
+
private readonly events;
|
|
566
|
+
private readonly afters;
|
|
567
|
+
private readonly stickyEvents;
|
|
568
|
+
private readonly stickyArgs;
|
|
569
|
+
constructor(core: MaplebirchCore);
|
|
570
|
+
on(eventName: string, callback: EventCallback, description?: string): boolean;
|
|
571
|
+
off(eventName: string, identifier: EventCallback | string): boolean;
|
|
572
|
+
once(eventName: string, callback: EventCallback, description?: string): boolean;
|
|
573
|
+
trigger(eventName: string, ...args: any[]): Promise<void>;
|
|
574
|
+
after(eventName: string, callback: EventCallback): void;
|
|
575
|
+
private callSticky;
|
|
576
|
+
private error;
|
|
577
|
+
}
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region node_modules/idb/build/entry.d.ts
|
|
580
|
+
type KeyToKeyNoIndex<T> = { [K in keyof T]: string extends K ? never : number extends K ? never : K };
|
|
581
|
+
type ValuesOf<T> = T extends { [K in keyof T]: infer U } ? U : never;
|
|
582
|
+
type KnownKeys<T> = ValuesOf<KeyToKeyNoIndex<T>>;
|
|
583
|
+
type Omit$1<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
584
|
+
interface DBSchema {
|
|
585
|
+
[s: string]: DBSchemaValue;
|
|
586
|
+
}
|
|
587
|
+
interface IndexKeys {
|
|
588
|
+
[s: string]: IDBValidKey;
|
|
589
|
+
}
|
|
590
|
+
interface DBSchemaValue {
|
|
591
|
+
key: IDBValidKey;
|
|
592
|
+
value: any;
|
|
593
|
+
indexes?: IndexKeys;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Extract known object store names from the DB schema type.
|
|
597
|
+
*
|
|
598
|
+
* @template DBTypes DB schema type, or unknown if the DB isn't typed.
|
|
599
|
+
*/
|
|
600
|
+
type StoreNames<DBTypes extends DBSchema | unknown> = DBTypes extends DBSchema ? KnownKeys<DBTypes> : string;
|
|
601
|
+
/**
|
|
602
|
+
* Extract database value types from the DB schema type.
|
|
603
|
+
*
|
|
604
|
+
* @template DBTypes DB schema type, or unknown if the DB isn't typed.
|
|
605
|
+
* @template StoreName Names of the object stores to get the types of.
|
|
606
|
+
*/
|
|
607
|
+
type StoreValue<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>> = DBTypes extends DBSchema ? DBTypes[StoreName]['value'] : any;
|
|
608
|
+
/**
|
|
609
|
+
* Extract database key types from the DB schema type.
|
|
610
|
+
*
|
|
611
|
+
* @template DBTypes DB schema type, or unknown if the DB isn't typed.
|
|
612
|
+
* @template StoreName Names of the object stores to get the types of.
|
|
613
|
+
*/
|
|
614
|
+
type StoreKey<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>> = DBTypes extends DBSchema ? DBTypes[StoreName]['key'] : IDBValidKey;
|
|
615
|
+
/**
|
|
616
|
+
* Extract the names of indexes in certain object stores from the DB schema type.
|
|
617
|
+
*
|
|
618
|
+
* @template DBTypes DB schema type, or unknown if the DB isn't typed.
|
|
619
|
+
* @template StoreName Names of the object stores to get the types of.
|
|
620
|
+
*/
|
|
621
|
+
type IndexNames<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>> = DBTypes extends DBSchema ? keyof DBTypes[StoreName]['indexes'] & string : string;
|
|
622
|
+
/**
|
|
623
|
+
* Extract the types of indexes in certain object stores from the DB schema type.
|
|
624
|
+
*
|
|
625
|
+
* @template DBTypes DB schema type, or unknown if the DB isn't typed.
|
|
626
|
+
* @template StoreName Names of the object stores to get the types of.
|
|
627
|
+
* @template IndexName Names of the indexes to get the types of.
|
|
628
|
+
*/
|
|
629
|
+
type IndexKey<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, StoreName>> = DBTypes extends DBSchema
|
|
630
|
+
? IndexName extends keyof DBTypes[StoreName]['indexes']
|
|
631
|
+
? DBTypes[StoreName]['indexes'][IndexName]
|
|
632
|
+
: IDBValidKey
|
|
633
|
+
: IDBValidKey;
|
|
634
|
+
type CursorSource<
|
|
635
|
+
DBTypes extends DBSchema | unknown,
|
|
636
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>>,
|
|
637
|
+
StoreName extends StoreNames<DBTypes>,
|
|
638
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown,
|
|
639
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
640
|
+
> = IndexName extends IndexNames<DBTypes, StoreName> ? IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode> : IDBPObjectStore<DBTypes, TxStores, StoreName, Mode>;
|
|
641
|
+
type CursorKey<DBTypes extends DBSchema | unknown, StoreName extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, StoreName> | unknown> =
|
|
642
|
+
IndexName extends IndexNames<DBTypes, StoreName> ? IndexKey<DBTypes, StoreName, IndexName> : StoreKey<DBTypes, StoreName>;
|
|
643
|
+
type IDBPDatabaseExtends = Omit$1<IDBDatabase, 'createObjectStore' | 'deleteObjectStore' | 'transaction' | 'objectStoreNames'>;
|
|
644
|
+
type DOMStringListSymbolIteratorType = DOMStringList extends {
|
|
645
|
+
[Symbol.iterator](): infer R;
|
|
646
|
+
}
|
|
647
|
+
? R
|
|
648
|
+
: IterableIterator<string>;
|
|
649
|
+
/**
|
|
650
|
+
* A variation of DOMStringList with precise string types
|
|
651
|
+
*/
|
|
652
|
+
interface TypedDOMStringList<T extends string> extends DOMStringList {
|
|
653
|
+
contains(string: T): boolean;
|
|
654
|
+
item(index: number): T | null;
|
|
655
|
+
[index: number]: T;
|
|
656
|
+
/**
|
|
657
|
+
* To resolve https://github.com/jakearchibald/idb/issues/327,
|
|
658
|
+
* and for compatibility with TypeScript >= 5.6 with ArrayIterator.
|
|
659
|
+
*/
|
|
660
|
+
[Symbol.iterator](): IterableIterator<string> extends DOMStringListSymbolIteratorType ? IterableIterator<T> : DOMStringListSymbolIteratorType & Iterator<T>;
|
|
661
|
+
}
|
|
662
|
+
interface IDBTransactionOptions {
|
|
663
|
+
/**
|
|
664
|
+
* The durability of the transaction.
|
|
665
|
+
*
|
|
666
|
+
* The default is "default". Using "relaxed" provides better performance, but with fewer
|
|
667
|
+
* guarantees. Web applications are encouraged to use "relaxed" for ephemeral data such as caches
|
|
668
|
+
* or quickly changing records, and "strict" in cases where reducing the risk of data loss
|
|
669
|
+
* outweighs the impact to performance and power.
|
|
670
|
+
*/
|
|
671
|
+
durability?: 'default' | 'strict' | 'relaxed';
|
|
672
|
+
}
|
|
673
|
+
interface IDBPDatabase<DBTypes extends DBSchema | unknown = unknown> extends IDBPDatabaseExtends {
|
|
674
|
+
/**
|
|
675
|
+
* The names of stores in the database.
|
|
676
|
+
*/
|
|
677
|
+
readonly objectStoreNames: TypedDOMStringList<StoreNames<DBTypes>>;
|
|
678
|
+
/**
|
|
679
|
+
* Creates a new object store.
|
|
680
|
+
*
|
|
681
|
+
* Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
|
|
682
|
+
*/
|
|
683
|
+
createObjectStore<Name extends StoreNames<DBTypes>>(name: Name, optionalParameters?: IDBObjectStoreParameters): IDBPObjectStore<DBTypes, ArrayLike<StoreNames<DBTypes>>, Name, 'versionchange'>;
|
|
684
|
+
/**
|
|
685
|
+
* Deletes the object store with the given name.
|
|
686
|
+
*
|
|
687
|
+
* Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
|
|
688
|
+
*/
|
|
689
|
+
deleteObjectStore(name: StoreNames<DBTypes>): void;
|
|
690
|
+
/**
|
|
691
|
+
* Start a new transaction.
|
|
692
|
+
*
|
|
693
|
+
* @param storeNames The object store(s) this transaction needs.
|
|
694
|
+
* @param mode
|
|
695
|
+
* @param options
|
|
696
|
+
*/
|
|
697
|
+
transaction<Name extends StoreNames<DBTypes>, Mode extends IDBTransactionMode = 'readonly'>(storeNames: Name, mode?: Mode, options?: IDBTransactionOptions): IDBPTransaction<DBTypes, [Name], Mode>;
|
|
698
|
+
transaction<Names extends ArrayLike<StoreNames<DBTypes>>, Mode extends IDBTransactionMode = 'readonly'>(
|
|
699
|
+
storeNames: Names,
|
|
700
|
+
mode?: Mode,
|
|
701
|
+
options?: IDBTransactionOptions
|
|
702
|
+
): IDBPTransaction<DBTypes, Names, Mode>;
|
|
703
|
+
/**
|
|
704
|
+
* Add a value to a store.
|
|
705
|
+
*
|
|
706
|
+
* Rejects if an item of a given key already exists in the store.
|
|
707
|
+
*
|
|
708
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
709
|
+
* than one action, create a transaction instead.
|
|
710
|
+
*
|
|
711
|
+
* @param storeName Name of the store.
|
|
712
|
+
* @param value
|
|
713
|
+
* @param key
|
|
714
|
+
*/
|
|
715
|
+
add<Name extends StoreNames<DBTypes>>(storeName: Name, value: StoreValue<DBTypes, Name>, key?: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreKey<DBTypes, Name>>;
|
|
716
|
+
/**
|
|
717
|
+
* Deletes all records in a store.
|
|
718
|
+
*
|
|
719
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
720
|
+
* than one action, create a transaction instead.
|
|
721
|
+
*
|
|
722
|
+
* @param storeName Name of the store.
|
|
723
|
+
*/
|
|
724
|
+
clear(name: StoreNames<DBTypes>): Promise<void>;
|
|
725
|
+
/**
|
|
726
|
+
* Retrieves the number of records matching the given query in a store.
|
|
727
|
+
*
|
|
728
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
729
|
+
* than one action, create a transaction instead.
|
|
730
|
+
*
|
|
731
|
+
* @param storeName Name of the store.
|
|
732
|
+
* @param key
|
|
733
|
+
*/
|
|
734
|
+
count<Name extends StoreNames<DBTypes>>(storeName: Name, key?: StoreKey<DBTypes, Name> | IDBKeyRange | null): Promise<number>;
|
|
735
|
+
/**
|
|
736
|
+
* Retrieves the number of records matching the given query in an index.
|
|
737
|
+
*
|
|
738
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
739
|
+
* than one action, create a transaction instead.
|
|
740
|
+
*
|
|
741
|
+
* @param storeName Name of the store.
|
|
742
|
+
* @param indexName Name of the index within the store.
|
|
743
|
+
* @param key
|
|
744
|
+
*/
|
|
745
|
+
countFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
|
|
746
|
+
storeName: Name,
|
|
747
|
+
indexName: IndexName,
|
|
748
|
+
key?: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange | null
|
|
749
|
+
): Promise<number>;
|
|
750
|
+
/**
|
|
751
|
+
* Deletes records in a store matching the given query.
|
|
752
|
+
*
|
|
753
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
754
|
+
* than one action, create a transaction instead.
|
|
755
|
+
*
|
|
756
|
+
* @param storeName Name of the store.
|
|
757
|
+
* @param key
|
|
758
|
+
*/
|
|
759
|
+
delete<Name extends StoreNames<DBTypes>>(storeName: Name, key: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<void>;
|
|
760
|
+
/**
|
|
761
|
+
* Retrieves the value of the first record in a store matching the query.
|
|
762
|
+
*
|
|
763
|
+
* Resolves with undefined if no match is found.
|
|
764
|
+
*
|
|
765
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
766
|
+
* than one action, create a transaction instead.
|
|
767
|
+
*
|
|
768
|
+
* @param storeName Name of the store.
|
|
769
|
+
* @param query
|
|
770
|
+
*/
|
|
771
|
+
get<Name extends StoreNames<DBTypes>>(storeName: Name, query: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreValue<DBTypes, Name> | undefined>;
|
|
772
|
+
/**
|
|
773
|
+
* Retrieves the value of the first record in an index matching the query.
|
|
774
|
+
*
|
|
775
|
+
* Resolves with undefined if no match is found.
|
|
776
|
+
*
|
|
777
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
778
|
+
* than one action, create a transaction instead.
|
|
779
|
+
*
|
|
780
|
+
* @param storeName Name of the store.
|
|
781
|
+
* @param indexName Name of the index within the store.
|
|
782
|
+
* @param query
|
|
783
|
+
*/
|
|
784
|
+
getFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
|
|
785
|
+
storeName: Name,
|
|
786
|
+
indexName: IndexName,
|
|
787
|
+
query: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange
|
|
788
|
+
): Promise<StoreValue<DBTypes, Name> | undefined>;
|
|
789
|
+
/**
|
|
790
|
+
* Retrieves all values in a store that match the query.
|
|
791
|
+
*
|
|
792
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
793
|
+
* than one action, create a transaction instead.
|
|
794
|
+
*
|
|
795
|
+
* @param storeName Name of the store.
|
|
796
|
+
* @param query
|
|
797
|
+
* @param count Maximum number of values to return.
|
|
798
|
+
*/
|
|
799
|
+
getAll<Name extends StoreNames<DBTypes>>(storeName: Name, query?: StoreKey<DBTypes, Name> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, Name>[]>;
|
|
800
|
+
/**
|
|
801
|
+
* Retrieves all values in an index that match the query.
|
|
802
|
+
*
|
|
803
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
804
|
+
* than one action, create a transaction instead.
|
|
805
|
+
*
|
|
806
|
+
* @param storeName Name of the store.
|
|
807
|
+
* @param indexName Name of the index within the store.
|
|
808
|
+
* @param query
|
|
809
|
+
* @param count Maximum number of values to return.
|
|
810
|
+
*/
|
|
811
|
+
getAllFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
|
|
812
|
+
storeName: Name,
|
|
813
|
+
indexName: IndexName,
|
|
814
|
+
query?: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange | null,
|
|
815
|
+
count?: number
|
|
816
|
+
): Promise<StoreValue<DBTypes, Name>[]>;
|
|
817
|
+
/**
|
|
818
|
+
* Retrieves the keys of records in a store matching the query.
|
|
819
|
+
*
|
|
820
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
821
|
+
* than one action, create a transaction instead.
|
|
822
|
+
*
|
|
823
|
+
* @param storeName Name of the store.
|
|
824
|
+
* @param query
|
|
825
|
+
* @param count Maximum number of keys to return.
|
|
826
|
+
*/
|
|
827
|
+
getAllKeys<Name extends StoreNames<DBTypes>>(storeName: Name, query?: StoreKey<DBTypes, Name> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, Name>[]>;
|
|
828
|
+
/**
|
|
829
|
+
* Retrieves the keys of records in an index matching the query.
|
|
830
|
+
*
|
|
831
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
832
|
+
* than one action, create a transaction instead.
|
|
833
|
+
*
|
|
834
|
+
* @param storeName Name of the store.
|
|
835
|
+
* @param indexName Name of the index within the store.
|
|
836
|
+
* @param query
|
|
837
|
+
* @param count Maximum number of keys to return.
|
|
838
|
+
*/
|
|
839
|
+
getAllKeysFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
|
|
840
|
+
storeName: Name,
|
|
841
|
+
indexName: IndexName,
|
|
842
|
+
query?: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange | null,
|
|
843
|
+
count?: number
|
|
844
|
+
): Promise<StoreKey<DBTypes, Name>[]>;
|
|
845
|
+
/**
|
|
846
|
+
* Retrieves the key of the first record in a store that matches the query.
|
|
847
|
+
*
|
|
848
|
+
* Resolves with undefined if no match is found.
|
|
849
|
+
*
|
|
850
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
851
|
+
* than one action, create a transaction instead.
|
|
852
|
+
*
|
|
853
|
+
* @param storeName Name of the store.
|
|
854
|
+
* @param query
|
|
855
|
+
*/
|
|
856
|
+
getKey<Name extends StoreNames<DBTypes>>(storeName: Name, query: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreKey<DBTypes, Name> | undefined>;
|
|
857
|
+
/**
|
|
858
|
+
* Retrieves the key of the first record in an index that matches the query.
|
|
859
|
+
*
|
|
860
|
+
* Resolves with undefined if no match is found.
|
|
861
|
+
*
|
|
862
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
863
|
+
* than one action, create a transaction instead.
|
|
864
|
+
*
|
|
865
|
+
* @param storeName Name of the store.
|
|
866
|
+
* @param indexName Name of the index within the store.
|
|
867
|
+
* @param query
|
|
868
|
+
*/
|
|
869
|
+
getKeyFromIndex<Name extends StoreNames<DBTypes>, IndexName extends IndexNames<DBTypes, Name>>(
|
|
870
|
+
storeName: Name,
|
|
871
|
+
indexName: IndexName,
|
|
872
|
+
query: IndexKey<DBTypes, Name, IndexName> | IDBKeyRange
|
|
873
|
+
): Promise<StoreKey<DBTypes, Name> | undefined>;
|
|
874
|
+
/**
|
|
875
|
+
* Put an item in the database.
|
|
876
|
+
*
|
|
877
|
+
* Replaces any item with the same key.
|
|
878
|
+
*
|
|
879
|
+
* This is a shortcut that creates a transaction for this single action. If you need to do more
|
|
880
|
+
* than one action, create a transaction instead.
|
|
881
|
+
*
|
|
882
|
+
* @param storeName Name of the store.
|
|
883
|
+
* @param value
|
|
884
|
+
* @param key
|
|
885
|
+
*/
|
|
886
|
+
put<Name extends StoreNames<DBTypes>>(storeName: Name, value: StoreValue<DBTypes, Name>, key?: StoreKey<DBTypes, Name> | IDBKeyRange): Promise<StoreKey<DBTypes, Name>>;
|
|
887
|
+
}
|
|
888
|
+
type IDBPTransactionExtends = Omit$1<IDBTransaction, 'db' | 'objectStore' | 'objectStoreNames'>;
|
|
889
|
+
interface IDBPTransaction<
|
|
890
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
891
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
892
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
893
|
+
> extends IDBPTransactionExtends {
|
|
894
|
+
/**
|
|
895
|
+
* The transaction's mode.
|
|
896
|
+
*/
|
|
897
|
+
readonly mode: Mode;
|
|
898
|
+
/**
|
|
899
|
+
* The names of stores in scope for this transaction.
|
|
900
|
+
*/
|
|
901
|
+
readonly objectStoreNames: TypedDOMStringList<TxStores[number]>;
|
|
902
|
+
/**
|
|
903
|
+
* The transaction's connection.
|
|
904
|
+
*/
|
|
905
|
+
readonly db: IDBPDatabase<DBTypes>;
|
|
906
|
+
/**
|
|
907
|
+
* Promise for the completion of this transaction.
|
|
908
|
+
*/
|
|
909
|
+
readonly done: Promise<void>;
|
|
910
|
+
/**
|
|
911
|
+
* The associated object store, if the transaction covers a single store, otherwise undefined.
|
|
912
|
+
*/
|
|
913
|
+
readonly store: TxStores[1] extends undefined ? IDBPObjectStore<DBTypes, TxStores, TxStores[0], Mode> : undefined;
|
|
914
|
+
/**
|
|
915
|
+
* Returns an IDBObjectStore in the transaction's scope.
|
|
916
|
+
*/
|
|
917
|
+
objectStore<StoreName extends TxStores[number]>(name: StoreName): IDBPObjectStore<DBTypes, TxStores, StoreName, Mode>;
|
|
918
|
+
}
|
|
919
|
+
type IDBPObjectStoreExtends = Omit$1<
|
|
920
|
+
IDBObjectStore,
|
|
921
|
+
'transaction' | 'add' | 'clear' | 'count' | 'createIndex' | 'delete' | 'get' | 'getAll' | 'getAllKeys' | 'getKey' | 'index' | 'openCursor' | 'openKeyCursor' | 'put' | 'indexNames'
|
|
922
|
+
>;
|
|
923
|
+
interface IDBPObjectStore<
|
|
924
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
925
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
926
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
927
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
928
|
+
> extends IDBPObjectStoreExtends {
|
|
929
|
+
/**
|
|
930
|
+
* The names of indexes in the store.
|
|
931
|
+
*/
|
|
932
|
+
readonly indexNames: TypedDOMStringList<IndexNames<DBTypes, StoreName>>;
|
|
933
|
+
/**
|
|
934
|
+
* The associated transaction.
|
|
935
|
+
*/
|
|
936
|
+
readonly transaction: IDBPTransaction<DBTypes, TxStores, Mode>;
|
|
937
|
+
/**
|
|
938
|
+
* Add a value to the store.
|
|
939
|
+
*
|
|
940
|
+
* Rejects if an item of a given key already exists in the store.
|
|
941
|
+
*/
|
|
942
|
+
add: Mode extends 'readonly' ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>;
|
|
943
|
+
/**
|
|
944
|
+
* Deletes all records in store.
|
|
945
|
+
*/
|
|
946
|
+
clear: Mode extends 'readonly' ? undefined : () => Promise<void>;
|
|
947
|
+
/**
|
|
948
|
+
* Retrieves the number of records matching the given query.
|
|
949
|
+
*/
|
|
950
|
+
count(key?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null): Promise<number>;
|
|
951
|
+
/**
|
|
952
|
+
* Creates a new index in store.
|
|
953
|
+
*
|
|
954
|
+
* Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
|
|
955
|
+
*/
|
|
956
|
+
createIndex: Mode extends 'versionchange'
|
|
957
|
+
? <IndexName extends IndexNames<DBTypes, StoreName>>(name: IndexName, keyPath: string | string[], options?: IDBIndexParameters) => IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>
|
|
958
|
+
: undefined;
|
|
959
|
+
/**
|
|
960
|
+
* Deletes records in store matching the given query.
|
|
961
|
+
*/
|
|
962
|
+
delete: Mode extends 'readonly' ? undefined : (key: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<void>;
|
|
963
|
+
/**
|
|
964
|
+
* Retrieves the value of the first record matching the query.
|
|
965
|
+
*
|
|
966
|
+
* Resolves with undefined if no match is found.
|
|
967
|
+
*/
|
|
968
|
+
get(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreValue<DBTypes, StoreName> | undefined>;
|
|
969
|
+
/**
|
|
970
|
+
* Retrieves all values that match the query.
|
|
971
|
+
*
|
|
972
|
+
* @param query
|
|
973
|
+
* @param count Maximum number of values to return.
|
|
974
|
+
*/
|
|
975
|
+
getAll(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, StoreName>[]>;
|
|
976
|
+
/**
|
|
977
|
+
* Retrieves the keys of records matching the query.
|
|
978
|
+
*
|
|
979
|
+
* @param query
|
|
980
|
+
* @param count Maximum number of keys to return.
|
|
981
|
+
*/
|
|
982
|
+
getAllKeys(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, StoreName>[]>;
|
|
983
|
+
/**
|
|
984
|
+
* Retrieves the key of the first record that matches the query.
|
|
985
|
+
*
|
|
986
|
+
* Resolves with undefined if no match is found.
|
|
987
|
+
*/
|
|
988
|
+
getKey(query: StoreKey<DBTypes, StoreName> | IDBKeyRange): Promise<StoreKey<DBTypes, StoreName> | undefined>;
|
|
989
|
+
/**
|
|
990
|
+
* Get a query of a given name.
|
|
991
|
+
*/
|
|
992
|
+
index<IndexName extends IndexNames<DBTypes, StoreName>>(name: IndexName): IDBPIndex<DBTypes, TxStores, StoreName, IndexName, Mode>;
|
|
993
|
+
/**
|
|
994
|
+
* Opens a cursor over the records matching the query.
|
|
995
|
+
*
|
|
996
|
+
* Resolves with null if no matches are found.
|
|
997
|
+
*
|
|
998
|
+
* @param query If null, all records match.
|
|
999
|
+
* @param direction
|
|
1000
|
+
*/
|
|
1001
|
+
openCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursorWithValue<DBTypes, TxStores, StoreName, unknown, Mode> | null>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Opens a cursor over the keys matching the query.
|
|
1004
|
+
*
|
|
1005
|
+
* Resolves with null if no matches are found.
|
|
1006
|
+
*
|
|
1007
|
+
* @param query If null, all records match.
|
|
1008
|
+
* @param direction
|
|
1009
|
+
*/
|
|
1010
|
+
openKeyCursor(query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursor<DBTypes, TxStores, StoreName, unknown, Mode> | null>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Put an item in the store.
|
|
1013
|
+
*
|
|
1014
|
+
* Replaces any item with the same key.
|
|
1015
|
+
*/
|
|
1016
|
+
put: Mode extends 'readonly' ? undefined : (value: StoreValue<DBTypes, StoreName>, key?: StoreKey<DBTypes, StoreName> | IDBKeyRange) => Promise<StoreKey<DBTypes, StoreName>>;
|
|
1017
|
+
/**
|
|
1018
|
+
* Iterate over the store.
|
|
1019
|
+
*/
|
|
1020
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Iterate over the records matching the query.
|
|
1023
|
+
*
|
|
1024
|
+
* @param query If null, all records match.
|
|
1025
|
+
* @param direction
|
|
1026
|
+
*/
|
|
1027
|
+
iterate(
|
|
1028
|
+
query?: StoreKey<DBTypes, StoreName> | IDBKeyRange | null,
|
|
1029
|
+
direction?: IDBCursorDirection
|
|
1030
|
+
): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, unknown, Mode>>;
|
|
1031
|
+
}
|
|
1032
|
+
type IDBPIndexExtends = Omit$1<IDBIndex, 'objectStore' | 'count' | 'get' | 'getAll' | 'getAllKeys' | 'getKey' | 'openCursor' | 'openKeyCursor'>;
|
|
1033
|
+
interface IDBPIndex<
|
|
1034
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1035
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1036
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1037
|
+
IndexName extends IndexNames<DBTypes, StoreName> = IndexNames<DBTypes, StoreName>,
|
|
1038
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1039
|
+
> extends IDBPIndexExtends {
|
|
1040
|
+
/**
|
|
1041
|
+
* The IDBObjectStore the index belongs to.
|
|
1042
|
+
*/
|
|
1043
|
+
readonly objectStore: IDBPObjectStore<DBTypes, TxStores, StoreName, Mode>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Retrieves the number of records matching the given query.
|
|
1046
|
+
*/
|
|
1047
|
+
count(key?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null): Promise<number>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Retrieves the value of the first record matching the query.
|
|
1050
|
+
*
|
|
1051
|
+
* Resolves with undefined if no match is found.
|
|
1052
|
+
*/
|
|
1053
|
+
get(query: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange): Promise<StoreValue<DBTypes, StoreName> | undefined>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Retrieves all values that match the query.
|
|
1056
|
+
*
|
|
1057
|
+
* @param query
|
|
1058
|
+
* @param count Maximum number of values to return.
|
|
1059
|
+
*/
|
|
1060
|
+
getAll(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, count?: number): Promise<StoreValue<DBTypes, StoreName>[]>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Retrieves the keys of records matching the query.
|
|
1063
|
+
*
|
|
1064
|
+
* @param query
|
|
1065
|
+
* @param count Maximum number of keys to return.
|
|
1066
|
+
*/
|
|
1067
|
+
getAllKeys(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, count?: number): Promise<StoreKey<DBTypes, StoreName>[]>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Retrieves the key of the first record that matches the query.
|
|
1070
|
+
*
|
|
1071
|
+
* Resolves with undefined if no match is found.
|
|
1072
|
+
*/
|
|
1073
|
+
getKey(query: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange): Promise<StoreKey<DBTypes, StoreName> | undefined>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Opens a cursor over the records matching the query.
|
|
1076
|
+
*
|
|
1077
|
+
* Resolves with null if no matches are found.
|
|
1078
|
+
*
|
|
1079
|
+
* @param query If null, all records match.
|
|
1080
|
+
* @param direction
|
|
1081
|
+
*/
|
|
1082
|
+
openCursor(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursorWithValue<DBTypes, TxStores, StoreName, IndexName, Mode> | null>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Opens a cursor over the keys matching the query.
|
|
1085
|
+
*
|
|
1086
|
+
* Resolves with null if no matches are found.
|
|
1087
|
+
*
|
|
1088
|
+
* @param query If null, all records match.
|
|
1089
|
+
* @param direction
|
|
1090
|
+
*/
|
|
1091
|
+
openKeyCursor(query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null, direction?: IDBCursorDirection): Promise<IDBPCursor<DBTypes, TxStores, StoreName, IndexName, Mode> | null>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Iterate over the index.
|
|
1094
|
+
*/
|
|
1095
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Iterate over the records matching the query.
|
|
1098
|
+
*
|
|
1099
|
+
* Resolves with null if no matches are found.
|
|
1100
|
+
*
|
|
1101
|
+
* @param query If null, all records match.
|
|
1102
|
+
* @param direction
|
|
1103
|
+
*/
|
|
1104
|
+
iterate(
|
|
1105
|
+
query?: IndexKey<DBTypes, StoreName, IndexName> | IDBKeyRange | null,
|
|
1106
|
+
direction?: IDBCursorDirection
|
|
1107
|
+
): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
|
|
1108
|
+
}
|
|
1109
|
+
type IDBPCursorExtends = Omit$1<IDBCursor, 'key' | 'primaryKey' | 'source' | 'advance' | 'continue' | 'continuePrimaryKey' | 'delete' | 'update'>;
|
|
1110
|
+
interface IDBPCursor<
|
|
1111
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1112
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1113
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1114
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
|
|
1115
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1116
|
+
> extends IDBPCursorExtends {
|
|
1117
|
+
/**
|
|
1118
|
+
* The key of the current index or object store item.
|
|
1119
|
+
*/
|
|
1120
|
+
readonly key: CursorKey<DBTypes, StoreName, IndexName>;
|
|
1121
|
+
/**
|
|
1122
|
+
* The key of the current object store item.
|
|
1123
|
+
*/
|
|
1124
|
+
readonly primaryKey: StoreKey<DBTypes, StoreName>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Returns the IDBObjectStore or IDBIndex the cursor was opened from.
|
|
1127
|
+
*/
|
|
1128
|
+
readonly source: CursorSource<DBTypes, TxStores, StoreName, IndexName, Mode>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Advances the cursor a given number of records.
|
|
1131
|
+
*
|
|
1132
|
+
* Resolves to null if no matching records remain.
|
|
1133
|
+
*/
|
|
1134
|
+
advance<T>(this: T, count: number): Promise<T | null>;
|
|
1135
|
+
/**
|
|
1136
|
+
* Advance the cursor by one record (unless 'key' is provided).
|
|
1137
|
+
*
|
|
1138
|
+
* Resolves to null if no matching records remain.
|
|
1139
|
+
*
|
|
1140
|
+
* @param key Advance to the index or object store with a key equal to or greater than this value.
|
|
1141
|
+
*/
|
|
1142
|
+
continue<T>(this: T, key?: CursorKey<DBTypes, StoreName, IndexName>): Promise<T | null>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Advance the cursor by given keys.
|
|
1145
|
+
*
|
|
1146
|
+
* The operation is 'and' – both keys must be satisfied.
|
|
1147
|
+
*
|
|
1148
|
+
* Resolves to null if no matching records remain.
|
|
1149
|
+
*
|
|
1150
|
+
* @param key Advance to the index or object store with a key equal to or greater than this value.
|
|
1151
|
+
* @param primaryKey and where the object store has a key equal to or greater than this value.
|
|
1152
|
+
*/
|
|
1153
|
+
continuePrimaryKey<T>(this: T, key: CursorKey<DBTypes, StoreName, IndexName>, primaryKey: StoreKey<DBTypes, StoreName>): Promise<T | null>;
|
|
1154
|
+
/**
|
|
1155
|
+
* Delete the current record.
|
|
1156
|
+
*/
|
|
1157
|
+
delete: Mode extends 'readonly' ? undefined : () => Promise<void>;
|
|
1158
|
+
/**
|
|
1159
|
+
* Updated the current record.
|
|
1160
|
+
*/
|
|
1161
|
+
update: Mode extends 'readonly' ? undefined : (value: StoreValue<DBTypes, StoreName>) => Promise<StoreKey<DBTypes, StoreName>>;
|
|
1162
|
+
/**
|
|
1163
|
+
* Iterate over the cursor.
|
|
1164
|
+
*/
|
|
1165
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
|
|
1166
|
+
}
|
|
1167
|
+
type IDBPCursorIteratorValueExtends<
|
|
1168
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1169
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1170
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1171
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
|
|
1172
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1173
|
+
> = Omit$1<IDBPCursor<DBTypes, TxStores, StoreName, IndexName, Mode>, 'advance' | 'continue' | 'continuePrimaryKey'>;
|
|
1174
|
+
interface IDBPCursorIteratorValue<
|
|
1175
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1176
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1177
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1178
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
|
|
1179
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1180
|
+
> extends IDBPCursorIteratorValueExtends<DBTypes, TxStores, StoreName, IndexName, Mode> {
|
|
1181
|
+
/**
|
|
1182
|
+
* Advances the cursor a given number of records.
|
|
1183
|
+
*/
|
|
1184
|
+
advance<T>(this: T, count: number): void;
|
|
1185
|
+
/**
|
|
1186
|
+
* Advance the cursor by one record (unless 'key' is provided).
|
|
1187
|
+
*
|
|
1188
|
+
* @param key Advance to the index or object store with a key equal to or greater than this value.
|
|
1189
|
+
*/
|
|
1190
|
+
continue<T>(this: T, key?: CursorKey<DBTypes, StoreName, IndexName>): void;
|
|
1191
|
+
/**
|
|
1192
|
+
* Advance the cursor by given keys.
|
|
1193
|
+
*
|
|
1194
|
+
* The operation is 'and' – both keys must be satisfied.
|
|
1195
|
+
*
|
|
1196
|
+
* @param key Advance to the index or object store with a key equal to or greater than this value.
|
|
1197
|
+
* @param primaryKey and where the object store has a key equal to or greater than this value.
|
|
1198
|
+
*/
|
|
1199
|
+
continuePrimaryKey<T>(this: T, key: CursorKey<DBTypes, StoreName, IndexName>, primaryKey: StoreKey<DBTypes, StoreName>): void;
|
|
1200
|
+
}
|
|
1201
|
+
interface IDBPCursorWithValue<
|
|
1202
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1203
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1204
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1205
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
|
|
1206
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1207
|
+
> extends IDBPCursor<DBTypes, TxStores, StoreName, IndexName, Mode> {
|
|
1208
|
+
/**
|
|
1209
|
+
* The value of the current item.
|
|
1210
|
+
*/
|
|
1211
|
+
readonly value: StoreValue<DBTypes, StoreName>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Iterate over the cursor.
|
|
1214
|
+
*/
|
|
1215
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<IDBPCursorWithValueIteratorValue<DBTypes, TxStores, StoreName, IndexName, Mode>>;
|
|
1216
|
+
}
|
|
1217
|
+
type IDBPCursorWithValueIteratorValueExtends<
|
|
1218
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1219
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1220
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1221
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
|
|
1222
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1223
|
+
> = Omit$1<IDBPCursorWithValue<DBTypes, TxStores, StoreName, IndexName, Mode>, 'advance' | 'continue' | 'continuePrimaryKey'>;
|
|
1224
|
+
interface IDBPCursorWithValueIteratorValue<
|
|
1225
|
+
DBTypes extends DBSchema | unknown = unknown,
|
|
1226
|
+
TxStores extends ArrayLike<StoreNames<DBTypes>> = ArrayLike<StoreNames<DBTypes>>,
|
|
1227
|
+
StoreName extends StoreNames<DBTypes> = StoreNames<DBTypes>,
|
|
1228
|
+
IndexName extends IndexNames<DBTypes, StoreName> | unknown = unknown,
|
|
1229
|
+
Mode extends IDBTransactionMode = 'readonly'
|
|
1230
|
+
> extends IDBPCursorWithValueIteratorValueExtends<DBTypes, TxStores, StoreName, IndexName, Mode> {
|
|
1231
|
+
/**
|
|
1232
|
+
* Advances the cursor a given number of records.
|
|
1233
|
+
*/
|
|
1234
|
+
advance<T>(this: T, count: number): void;
|
|
1235
|
+
/**
|
|
1236
|
+
* Advance the cursor by one record (unless 'key' is provided).
|
|
1237
|
+
*
|
|
1238
|
+
* @param key Advance to the index or object store with a key equal to or greater than this value.
|
|
1239
|
+
*/
|
|
1240
|
+
continue<T>(this: T, key?: CursorKey<DBTypes, StoreName, IndexName>): void;
|
|
1241
|
+
/**
|
|
1242
|
+
* Advance the cursor by given keys.
|
|
1243
|
+
*
|
|
1244
|
+
* The operation is 'and' – both keys must be satisfied.
|
|
1245
|
+
*
|
|
1246
|
+
* @param key Advance to the index or object store with a key equal to or greater than this value.
|
|
1247
|
+
* @param primaryKey and where the object store has a key equal to or greater than this value.
|
|
1248
|
+
*/
|
|
1249
|
+
continuePrimaryKey<T>(this: T, key: CursorKey<DBTypes, StoreName, IndexName>, primaryKey: StoreKey<DBTypes, StoreName>): void;
|
|
1250
|
+
}
|
|
1251
|
+
//#endregion
|
|
1252
|
+
//#region src/services/IndexedDBService.d.ts
|
|
1253
|
+
interface StoreIndex {
|
|
1254
|
+
name: string;
|
|
1255
|
+
keyPath: string | string[];
|
|
1256
|
+
options?: IDBIndexParameters;
|
|
1257
|
+
}
|
|
1258
|
+
type Transaction<Mode extends IDBTransactionMode = IDBTransactionMode> = IDBPTransaction<unknown, string[], Mode>;
|
|
1259
|
+
declare class IndexedDBService {
|
|
1260
|
+
readonly core: MaplebirchCore;
|
|
1261
|
+
static readonly DATABASE_NAME = 'maplebirch';
|
|
1262
|
+
static readonly DATABASE_VERSION: number;
|
|
1263
|
+
private db;
|
|
1264
|
+
private opening;
|
|
1265
|
+
private readonly stores;
|
|
1266
|
+
constructor(core: MaplebirchCore);
|
|
1267
|
+
register(name: string, options?: IDBObjectStoreParameters, indexes?: StoreIndex[]): void;
|
|
1268
|
+
init(): Promise<void>;
|
|
1269
|
+
private open;
|
|
1270
|
+
withTransaction<T, Mode extends IDBTransactionMode>(storeNames: string | string[], mode: Mode, callback: (tx: Transaction<Mode>) => T | Promise<T>): Promise<T>;
|
|
1271
|
+
clearStore(storeName: string): Promise<void>;
|
|
1272
|
+
deleteDatabase(): Promise<boolean>;
|
|
1273
|
+
private error;
|
|
1274
|
+
}
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/services/CloudSaveService.d.ts
|
|
1277
|
+
type CloudSaveSlot = number;
|
|
1278
|
+
type PanelAction = 'connectRemote' | 'uploadSlot' | 'downloadSlot' | 'refreshRemoteList' | 'deleteRemoteSlot' | 'exportCurrentCode' | 'exportSlotCode' | 'uploadCode' | 'downloadCode' | 'importCode';
|
|
1279
|
+
interface CloudSaveConfig {
|
|
1280
|
+
endpoint: string;
|
|
1281
|
+
token: string;
|
|
1282
|
+
}
|
|
1283
|
+
interface CloudSaveRecord {
|
|
1284
|
+
slot: CloudSaveSlot;
|
|
1285
|
+
details: any;
|
|
1286
|
+
save: any;
|
|
1287
|
+
exportedAt: number;
|
|
1288
|
+
gameId?: string;
|
|
1289
|
+
}
|
|
1290
|
+
interface CloudSaveCodeRecord {
|
|
1291
|
+
code: string;
|
|
1292
|
+
exportedAt: number;
|
|
1293
|
+
gameId?: string;
|
|
1294
|
+
}
|
|
1295
|
+
interface CloudSaveRemoteItem {
|
|
1296
|
+
slot: CloudSaveSlot;
|
|
1297
|
+
updatedAt: number;
|
|
1298
|
+
payload?: CloudSaveRecord;
|
|
1299
|
+
}
|
|
1300
|
+
interface CloudSaveRemoteCode {
|
|
1301
|
+
updatedAt: number;
|
|
1302
|
+
payload?: CloudSaveCodeRecord;
|
|
1303
|
+
}
|
|
1304
|
+
declare class CloudSaveService {
|
|
1305
|
+
readonly core: MaplebirchCore;
|
|
1306
|
+
private static readonly PANEL_STORAGE_KEY;
|
|
1307
|
+
private config;
|
|
1308
|
+
constructor(core: MaplebirchCore);
|
|
1309
|
+
configure(config: CloudSaveConfig): this;
|
|
1310
|
+
/** 验证 Worker 与 Token 是否可用。 */
|
|
1311
|
+
connect(): Promise<void>;
|
|
1312
|
+
/** 从 DoL 原生 IndexedDB 读取本地存档。 */
|
|
1313
|
+
exportSlot(slot: CloudSaveSlot): Promise<CloudSaveRecord>;
|
|
1314
|
+
/** 将云端存档写回 DoL 原生 IndexedDB。 */
|
|
1315
|
+
importSlot(record: CloudSaveRecord, targetSlot?: CloudSaveSlot): Promise<boolean>;
|
|
1316
|
+
/** 上传本地存档。 */
|
|
1317
|
+
upload(slot: CloudSaveSlot): Promise<CloudSaveRemoteItem>;
|
|
1318
|
+
/** 下载云端存档。 */
|
|
1319
|
+
download(slot: CloudSaveSlot, targetSlot?: CloudSaveSlot): Promise<boolean>;
|
|
1320
|
+
/** 获取远端存档列表。 */
|
|
1321
|
+
listRemote(): Promise<CloudSaveRemoteItem[]>;
|
|
1322
|
+
/** 删除远端存档。 */
|
|
1323
|
+
deleteRemote(slot: CloudSaveSlot): Promise<void>;
|
|
1324
|
+
/** 导出当前 SugarCube 存档码。 */
|
|
1325
|
+
exportCode(): string;
|
|
1326
|
+
/** 将指定本地槽位转换为 SugarCube 存档码。 */
|
|
1327
|
+
exportSlotCode(slot: CloudSaveSlot): Promise<string>;
|
|
1328
|
+
/** 导入 SugarCube 存档码。 */
|
|
1329
|
+
importCode(code: string): boolean;
|
|
1330
|
+
/** 上传 SugarCube 存档码。 */
|
|
1331
|
+
uploadCode(code?: string): Promise<CloudSaveRemoteCode>;
|
|
1332
|
+
/** 下载 SugarCube 存档码。 */
|
|
1333
|
+
downloadCode(): Promise<string>;
|
|
1334
|
+
/** 初始化云存档面板。 */
|
|
1335
|
+
mountPanel(): void;
|
|
1336
|
+
/** Twee 面板动作入口。 */
|
|
1337
|
+
panelAction(action: PanelAction, slot?: CloudSaveSlot): Promise<void>;
|
|
1338
|
+
private runPanelAction;
|
|
1339
|
+
private done;
|
|
1340
|
+
private refreshPanel;
|
|
1341
|
+
private remoteRow;
|
|
1342
|
+
private readPanel;
|
|
1343
|
+
private loadPanelConfig;
|
|
1344
|
+
private savePanelConfig;
|
|
1345
|
+
/** Worker 请求统一入口。 */
|
|
1346
|
+
private request;
|
|
1347
|
+
/** SugarCube delta 存档还原为完整 history。 */
|
|
1348
|
+
private normalizeSave;
|
|
1349
|
+
private field;
|
|
1350
|
+
private setField;
|
|
1351
|
+
private panelSlot;
|
|
1352
|
+
private status;
|
|
1353
|
+
private error;
|
|
1354
|
+
private get saveDB();
|
|
1355
|
+
private get panel();
|
|
1356
|
+
private get current();
|
|
1357
|
+
private get endpoint();
|
|
1358
|
+
private get token();
|
|
1359
|
+
}
|
|
1360
|
+
//#endregion
|
|
1361
|
+
//#region src/services/LanguageManager.d.ts
|
|
1362
|
+
type Translation = Record<string, string>;
|
|
1363
|
+
interface ImportProgress {
|
|
1364
|
+
type: 'process' | 'complete' | 'error' | 'not_found';
|
|
1365
|
+
language: LanguageCode;
|
|
1366
|
+
progress?: number;
|
|
1367
|
+
current?: number;
|
|
1368
|
+
total?: number;
|
|
1369
|
+
count?: number;
|
|
1370
|
+
error?: Error | null;
|
|
1371
|
+
}
|
|
1372
|
+
declare class LanguageManager {
|
|
1373
|
+
readonly core: MaplebirchCore;
|
|
1374
|
+
static readonly DEFAULT_LANGS: readonly LanguageCode[];
|
|
1375
|
+
static readonly BATCH_SIZE = 500;
|
|
1376
|
+
language: LanguageCode;
|
|
1377
|
+
private readonly STORE;
|
|
1378
|
+
private readonly translations;
|
|
1379
|
+
private readonly cache;
|
|
1380
|
+
private readonly sourceOrders;
|
|
1381
|
+
private preloaded;
|
|
1382
|
+
constructor(core: MaplebirchCore);
|
|
1383
|
+
private initDB;
|
|
1384
|
+
setLanguage(language?: string): Promise<LanguageCode>;
|
|
1385
|
+
import(modName: string, languages?: readonly LanguageCode[]): AsyncGenerator<ImportProgress>;
|
|
1386
|
+
importFile(modName: string, language: LanguageCode, path: string): AsyncGenerator<ImportProgress>;
|
|
1387
|
+
t(translationKey: string, space?: boolean): string;
|
|
1388
|
+
auto(text: string): string;
|
|
1389
|
+
has(translationKey: string): boolean;
|
|
1390
|
+
set(translationKey: string, translations: Record<string, unknown>): boolean;
|
|
1391
|
+
preload(): Promise<void>;
|
|
1392
|
+
clearStorage(): Promise<void>;
|
|
1393
|
+
private loadBundledTranslations;
|
|
1394
|
+
private writeTranslations;
|
|
1395
|
+
private writeBatch;
|
|
1396
|
+
private removeOldTranslations;
|
|
1397
|
+
private updateSource;
|
|
1398
|
+
private syncTranslation;
|
|
1399
|
+
private readFileRecord;
|
|
1400
|
+
private writeFileRecord;
|
|
1401
|
+
private loadTranslation;
|
|
1402
|
+
private parseTranslations;
|
|
1403
|
+
private computeHash;
|
|
1404
|
+
private getModFile;
|
|
1405
|
+
private rebuild;
|
|
1406
|
+
private error;
|
|
1407
|
+
}
|
|
1408
|
+
//#endregion
|
|
1409
|
+
//#region src/services/ModuleSystem.d.ts
|
|
1410
|
+
interface Module {
|
|
1411
|
+
dependencies?: string[];
|
|
1412
|
+
exposed?: boolean;
|
|
1413
|
+
preInit?(): void | Promise<void>;
|
|
1414
|
+
Init?(): void;
|
|
1415
|
+
loadInit?(): void;
|
|
1416
|
+
postInit?(): void;
|
|
1417
|
+
[key: string]: unknown;
|
|
1418
|
+
}
|
|
1419
|
+
interface ModuleRegistry {
|
|
1420
|
+
modules: Map<string, Module>;
|
|
1421
|
+
states: Map<string, string | number>;
|
|
1422
|
+
sources: Map<string, string>;
|
|
1423
|
+
dependencies: Map<string, Set<string>>;
|
|
1424
|
+
dependents: Map<string, Set<string>>;
|
|
1425
|
+
}
|
|
1426
|
+
interface DependencyInfo {
|
|
1427
|
+
protected: boolean;
|
|
1428
|
+
mounted: boolean;
|
|
1429
|
+
early: boolean;
|
|
1430
|
+
exposed: boolean;
|
|
1431
|
+
lifecycle: boolean;
|
|
1432
|
+
dependencies: string[];
|
|
1433
|
+
dependents: string[];
|
|
1434
|
+
allDependencies: string[];
|
|
1435
|
+
state: string;
|
|
1436
|
+
source: string;
|
|
1437
|
+
}
|
|
1438
|
+
type DependencyGraph = Record<string, DependencyInfo>;
|
|
1439
|
+
declare class ModuleSystem {
|
|
1440
|
+
readonly core: MaplebirchCore;
|
|
1441
|
+
readonly registry: ModuleRegistry;
|
|
1442
|
+
readonly initPhase: {
|
|
1443
|
+
preInitCompleted: boolean;
|
|
1444
|
+
mainInitCompleted: boolean;
|
|
1445
|
+
};
|
|
1446
|
+
private readonly sourceStack;
|
|
1447
|
+
private readonly preInitialized;
|
|
1448
|
+
private disabledNames;
|
|
1449
|
+
private preInitTask;
|
|
1450
|
+
private late;
|
|
1451
|
+
private preRunning;
|
|
1452
|
+
private preQueued;
|
|
1453
|
+
constructor(core: MaplebirchCore);
|
|
1454
|
+
static traverse(roots: Iterable<string>, links: ReadonlyMap<string, Iterable<string>>, excluded?: ReadonlySet<string>): Set<string>;
|
|
1455
|
+
with<T>(source: string, callback: () => T | Promise<T>): Promise<T>;
|
|
1456
|
+
register(name: string, module: Module, dependencies?: string[]): boolean;
|
|
1457
|
+
get(name: string): Module | undefined;
|
|
1458
|
+
get dependencyGraph(): DependencyGraph;
|
|
1459
|
+
run(phase: 'pre'): Promise<void>;
|
|
1460
|
+
run(phase: 'init' | 'load' | 'post'): void;
|
|
1461
|
+
private preInit;
|
|
1462
|
+
private queuePre;
|
|
1463
|
+
private disable;
|
|
1464
|
+
private pre;
|
|
1465
|
+
private init;
|
|
1466
|
+
private phase;
|
|
1467
|
+
private callHook;
|
|
1468
|
+
private ready;
|
|
1469
|
+
private flushEarly;
|
|
1470
|
+
private topologicalOrder;
|
|
1471
|
+
private collect;
|
|
1472
|
+
private circular;
|
|
1473
|
+
private lifecycle;
|
|
1474
|
+
private promiseLike;
|
|
1475
|
+
private error;
|
|
1476
|
+
}
|
|
1477
|
+
//#endregion
|
|
1478
|
+
//#region src/services/GUIControl.d.ts
|
|
1479
|
+
type ModuleType = 'protected' | 'mounted' | 'exposed' | 'module';
|
|
1480
|
+
interface ModuleInfo {
|
|
1481
|
+
name: string;
|
|
1482
|
+
type: ModuleType;
|
|
1483
|
+
source: string;
|
|
1484
|
+
protected: boolean;
|
|
1485
|
+
lifecycle: boolean;
|
|
1486
|
+
dependencies: string[];
|
|
1487
|
+
}
|
|
1488
|
+
interface ModulesSettings {
|
|
1489
|
+
enabled: ModuleInfo[];
|
|
1490
|
+
disabled: ModuleInfo[];
|
|
1491
|
+
}
|
|
1492
|
+
declare class GUIControl {
|
|
1493
|
+
readonly core: MaplebirchCore;
|
|
1494
|
+
enabledModules: ModuleInfo[];
|
|
1495
|
+
disabledModules: ModuleInfo[];
|
|
1496
|
+
enabledScripts: string[];
|
|
1497
|
+
disabledScripts: string[];
|
|
1498
|
+
private modSubUiAngularJsService;
|
|
1499
|
+
constructor(core: MaplebirchCore);
|
|
1500
|
+
private initSettings;
|
|
1501
|
+
init(): Promise<void>;
|
|
1502
|
+
private loadSettings;
|
|
1503
|
+
private modNames;
|
|
1504
|
+
private currentModules;
|
|
1505
|
+
typeLabel(type: ModuleType): string;
|
|
1506
|
+
private modulesStore;
|
|
1507
|
+
private scriptsStore;
|
|
1508
|
+
saveModules(enabled: ModuleInfo[], disabled: ModuleInfo[]): Promise<void>;
|
|
1509
|
+
saveScripts(enabled: string[], disabled: string[]): Promise<void>;
|
|
1510
|
+
cascadeModules(action: 'enable' | 'disable', moduleName: string, modules: ModulesSettings): string[];
|
|
1511
|
+
private moduleLinks;
|
|
1512
|
+
get moduleList(): string;
|
|
1513
|
+
private whenCreate;
|
|
1514
|
+
}
|
|
1515
|
+
//#endregion
|
|
1516
|
+
//#region src/modules/TimeStateWeather/Event.d.ts
|
|
1517
|
+
interface EventOptions {
|
|
1518
|
+
priority?: number;
|
|
1519
|
+
once?: boolean;
|
|
1520
|
+
}
|
|
1521
|
+
//#endregion
|
|
1522
|
+
//#region src/modules/TimeStateWeather/TimeEvents.d.ts
|
|
1523
|
+
type TimeEventType = 'onSec' | 'onMin' | 'onHour' | 'onDay' | 'onWeek' | 'onMonth' | 'onYear' | 'onBefore' | 'onThread' | 'onAfter' | 'onTimeTravel';
|
|
1524
|
+
type TimeUnit = 'sec' | 'min' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
1525
|
+
interface DateLike {
|
|
1526
|
+
hour: number;
|
|
1527
|
+
day: number;
|
|
1528
|
+
month: number;
|
|
1529
|
+
year: number;
|
|
1530
|
+
timeStamp: number;
|
|
1531
|
+
minute?: number;
|
|
1532
|
+
second?: number;
|
|
1533
|
+
}
|
|
1534
|
+
interface AccumulateConfig {
|
|
1535
|
+
unit: TimeUnit;
|
|
1536
|
+
target?: number;
|
|
1537
|
+
}
|
|
1538
|
+
interface TimeData {
|
|
1539
|
+
prevDate?: DateLike;
|
|
1540
|
+
currentDate?: DateLike;
|
|
1541
|
+
changes?: Record<TimeUnit, number>;
|
|
1542
|
+
triggeredByAccumulator?: {
|
|
1543
|
+
unit: TimeUnit;
|
|
1544
|
+
target: number;
|
|
1545
|
+
count: number;
|
|
1546
|
+
};
|
|
1547
|
+
exactPoints?: {
|
|
1548
|
+
hour: boolean;
|
|
1549
|
+
day: boolean;
|
|
1550
|
+
week: boolean;
|
|
1551
|
+
month: boolean;
|
|
1552
|
+
year: boolean;
|
|
1553
|
+
};
|
|
1554
|
+
passed?: number;
|
|
1555
|
+
sec?: number;
|
|
1556
|
+
min?: number;
|
|
1557
|
+
hour?: number;
|
|
1558
|
+
day?: number;
|
|
1559
|
+
week?: number;
|
|
1560
|
+
month?: number;
|
|
1561
|
+
year?: number;
|
|
1562
|
+
weekday?: [number, number];
|
|
1563
|
+
detailedDiff?: any;
|
|
1564
|
+
timeStamp?: number;
|
|
1565
|
+
prev?: DateTime;
|
|
1566
|
+
current?: DateTime;
|
|
1567
|
+
diffSeconds?: number;
|
|
1568
|
+
direction?: 'forward' | 'backward';
|
|
1569
|
+
isLeap?: boolean;
|
|
1570
|
+
}
|
|
1571
|
+
interface TimeEventOptions extends EventOptions {
|
|
1572
|
+
action?: (data: TimeData) => void;
|
|
1573
|
+
cond?: (data: TimeData) => boolean;
|
|
1574
|
+
accumulate?: AccumulateConfig;
|
|
1575
|
+
exact?: boolean;
|
|
1576
|
+
}
|
|
1577
|
+
interface TimeTravelOptions {
|
|
1578
|
+
target?: DateTime;
|
|
1579
|
+
year?: number;
|
|
1580
|
+
month?: number;
|
|
1581
|
+
day?: number;
|
|
1582
|
+
hour?: number;
|
|
1583
|
+
minute?: number;
|
|
1584
|
+
second?: number;
|
|
1585
|
+
addYears?: number;
|
|
1586
|
+
addMonths?: number;
|
|
1587
|
+
addDays?: number;
|
|
1588
|
+
addHours?: number;
|
|
1589
|
+
addMinutes?: number;
|
|
1590
|
+
addSeconds?: number;
|
|
1591
|
+
}
|
|
1592
|
+
declare class TimeManager {
|
|
1593
|
+
private readonly manager;
|
|
1594
|
+
private readonly eventTypes;
|
|
1595
|
+
private readonly timeEvents;
|
|
1596
|
+
private readonly sortedEventsCache;
|
|
1597
|
+
readonly log: (message: string, level?: string, ...objects: any[]) => void;
|
|
1598
|
+
readonly TimeConstants: Readonly<{
|
|
1599
|
+
secondsPerDay: 86400;
|
|
1600
|
+
secondsPerHour: 3600;
|
|
1601
|
+
secondsPerMinute: 60;
|
|
1602
|
+
minutesPerHour: 60;
|
|
1603
|
+
standardYearMonths: readonly number[];
|
|
1604
|
+
leapYearMonths: readonly number[];
|
|
1605
|
+
synodicMonth: 29.53058867;
|
|
1606
|
+
MIN_DATE: Readonly<{
|
|
1607
|
+
timeStamp: -315537984000;
|
|
1608
|
+
year: -9999;
|
|
1609
|
+
month: 1;
|
|
1610
|
+
day: 1;
|
|
1611
|
+
hour: 0;
|
|
1612
|
+
minute: 0;
|
|
1613
|
+
second: 0;
|
|
1614
|
+
}>;
|
|
1615
|
+
MAX_DATE: Readonly<{
|
|
1616
|
+
timeStamp: 315537897599;
|
|
1617
|
+
year: 9999;
|
|
1618
|
+
month: 12;
|
|
1619
|
+
day: 31;
|
|
1620
|
+
hour: 23;
|
|
1621
|
+
minute: 59;
|
|
1622
|
+
second: 59;
|
|
1623
|
+
}>;
|
|
1624
|
+
}>;
|
|
1625
|
+
constructor(manager: DynamicManager);
|
|
1626
|
+
init(): void;
|
|
1627
|
+
patchDateTime(DateTimeClass: typeof DateTime): typeof DateTime;
|
|
1628
|
+
patchTime(TimeObject: typeof Time): void;
|
|
1629
|
+
register(type: TimeEventType, eventId: string, options: TimeEventOptions): boolean;
|
|
1630
|
+
unregister(type: string, eventId: string): boolean;
|
|
1631
|
+
timeTravel(options?: TimeTravelOptions): boolean;
|
|
1632
|
+
updateTimeLanguage(choice?: 'JournalTime'): string | boolean;
|
|
1633
|
+
private handleTimePass;
|
|
1634
|
+
private handleTimeTravel;
|
|
1635
|
+
private targetDate;
|
|
1636
|
+
private timeData;
|
|
1637
|
+
private triggerUnitEvents;
|
|
1638
|
+
private trigger;
|
|
1639
|
+
}
|
|
1640
|
+
//#endregion
|
|
1641
|
+
//#region src/modules/TimeStateWeather/StateEvents.d.ts
|
|
1642
|
+
interface StateEventOptions extends EventOptions {
|
|
1643
|
+
output?: string;
|
|
1644
|
+
action?: () => void;
|
|
1645
|
+
cond?: () => boolean;
|
|
1646
|
+
forceExit?: boolean | (() => boolean);
|
|
1647
|
+
extra?: {
|
|
1648
|
+
passage?: string[];
|
|
1649
|
+
exclude?: string[];
|
|
1650
|
+
match?: RegExp;
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
declare class StateManager {
|
|
1654
|
+
private readonly manager;
|
|
1655
|
+
private readonly stateEvents;
|
|
1656
|
+
private readonly log;
|
|
1657
|
+
constructor(manager: DynamicManager);
|
|
1658
|
+
trigger(type: 'gate' | 'append'): string;
|
|
1659
|
+
private processGateEvents;
|
|
1660
|
+
private processAppendEvents;
|
|
1661
|
+
register(type: 'gate' | 'append', eventId: string, options: StateEventOptions): boolean;
|
|
1662
|
+
unregister(type: 'gate' | 'append', eventId: string): boolean;
|
|
1663
|
+
init(): void;
|
|
1664
|
+
}
|
|
1665
|
+
//#endregion
|
|
1666
|
+
//#region src/modules/TimeStateWeather/WeatherEvents.d.ts
|
|
1667
|
+
interface WeatherEventOptions extends EventOptions {
|
|
1668
|
+
condition?: () => boolean;
|
|
1669
|
+
onEnter?: () => void;
|
|
1670
|
+
onExit?: () => void;
|
|
1671
|
+
[key: string]: any;
|
|
1672
|
+
}
|
|
1673
|
+
interface WeatherTypeConfig {
|
|
1674
|
+
name: string;
|
|
1675
|
+
iconType?: string | (() => string);
|
|
1676
|
+
value: number;
|
|
1677
|
+
probability: {
|
|
1678
|
+
summer: number;
|
|
1679
|
+
winter: number;
|
|
1680
|
+
spring: number;
|
|
1681
|
+
autumn: number;
|
|
1682
|
+
};
|
|
1683
|
+
cloudCount: {
|
|
1684
|
+
small: () => number;
|
|
1685
|
+
large: () => number;
|
|
1686
|
+
};
|
|
1687
|
+
tanningModifier: number;
|
|
1688
|
+
overcast: number | (() => number);
|
|
1689
|
+
precipitationIntensity: number;
|
|
1690
|
+
visibility: number;
|
|
1691
|
+
}
|
|
1692
|
+
interface WeatherException {
|
|
1693
|
+
date: () => DateTime;
|
|
1694
|
+
duration: number;
|
|
1695
|
+
weatherType: string;
|
|
1696
|
+
temperature?: number;
|
|
1697
|
+
}
|
|
1698
|
+
declare class WeatherManager {
|
|
1699
|
+
private readonly manager;
|
|
1700
|
+
private readonly weatherEvents;
|
|
1701
|
+
private readonly activeEvents;
|
|
1702
|
+
private sortedEventsCache;
|
|
1703
|
+
private readonly Exceptions;
|
|
1704
|
+
private readonly WeatherTypes;
|
|
1705
|
+
private readonly layerModifications;
|
|
1706
|
+
private readonly effectModifications;
|
|
1707
|
+
private weatherTriggered;
|
|
1708
|
+
private readonly log;
|
|
1709
|
+
constructor(manager: DynamicManager);
|
|
1710
|
+
private checkEvents;
|
|
1711
|
+
register(eventId: string, options: WeatherEventOptions): boolean;
|
|
1712
|
+
unregister(eventId: string): boolean;
|
|
1713
|
+
addLayer(layerName: string, patch: any, mode?: 'concat' | 'replace' | 'merge'): this;
|
|
1714
|
+
addEffect(effectName: string, patch: any, mode?: 'concat' | 'replace' | 'merge'): this;
|
|
1715
|
+
applyModifications(params: any): any;
|
|
1716
|
+
addWeatherData(data: WeatherException | WeatherTypeConfig): boolean | void;
|
|
1717
|
+
init(): void;
|
|
1718
|
+
modifyWeatherJavaScript(manager: AddonPlugin): void;
|
|
1719
|
+
}
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region src/modules/Dynamic.d.ts
|
|
1722
|
+
declare class DynamicManager {
|
|
1723
|
+
readonly core: MaplebirchCore;
|
|
1724
|
+
readonly Time: TimeManager;
|
|
1725
|
+
readonly State: StateManager;
|
|
1726
|
+
readonly Weather: WeatherManager;
|
|
1727
|
+
readonly log: ReturnType<typeof createlog>;
|
|
1728
|
+
constructor(core: MaplebirchCore);
|
|
1729
|
+
regTimeEvent(type: TimeEventType, eventId: string, options: TimeEventOptions): boolean;
|
|
1730
|
+
delTimeEvent(type: TimeEventType, eventId: string): boolean;
|
|
1731
|
+
timeTravel(options?: TimeTravelOptions): boolean;
|
|
1732
|
+
get TimeEvents(): any;
|
|
1733
|
+
regStateEvent(type: 'gate' | 'append', eventId: string, options: StateEventOptions): boolean;
|
|
1734
|
+
delStateEvent(type: 'gate' | 'append', eventId: string): boolean;
|
|
1735
|
+
trigger(type: 'gate' | 'append'): string;
|
|
1736
|
+
get StateEvents(): any;
|
|
1737
|
+
regWeatherEvent(eventId: string, options: WeatherEventOptions): boolean;
|
|
1738
|
+
delWeatherEvent(eventId: string): boolean;
|
|
1739
|
+
addWeather(data: WeatherException | WeatherTypeConfig): boolean | void;
|
|
1740
|
+
Init(): void;
|
|
1741
|
+
}
|
|
1742
|
+
//#endregion
|
|
1743
|
+
//#region src/modules/Frameworks/TimeTravelCheat.d.ts
|
|
1744
|
+
declare class TimeTravelCheat {
|
|
1745
|
+
private readonly core;
|
|
1746
|
+
private readonly ids;
|
|
1747
|
+
constructor(core: MaplebirchCore);
|
|
1748
|
+
fragment(): DocumentFragment;
|
|
1749
|
+
private createRoot;
|
|
1750
|
+
private bind;
|
|
1751
|
+
private render;
|
|
1752
|
+
private fieldInput;
|
|
1753
|
+
private setFields;
|
|
1754
|
+
private readFields;
|
|
1755
|
+
private syncDayLimit;
|
|
1756
|
+
private travel;
|
|
1757
|
+
private status;
|
|
1758
|
+
}
|
|
1759
|
+
//#endregion
|
|
1760
|
+
//#region src/modules/Frameworks/ConsoleCheat.d.ts
|
|
1761
|
+
interface JSExecutionResult {
|
|
1762
|
+
success: boolean;
|
|
1763
|
+
result?: any;
|
|
1764
|
+
error?: string;
|
|
1765
|
+
message: string;
|
|
1766
|
+
globals?: Record<string, any>;
|
|
1767
|
+
}
|
|
1768
|
+
interface TwineExecutionResult {
|
|
1769
|
+
success: boolean;
|
|
1770
|
+
error?: string;
|
|
1771
|
+
message: string;
|
|
1772
|
+
hasNavigation?: boolean;
|
|
1773
|
+
parsedContent?: string;
|
|
1774
|
+
}
|
|
1775
|
+
interface ExecutionResult {
|
|
1776
|
+
success: boolean;
|
|
1777
|
+
result?: any;
|
|
1778
|
+
error?: string;
|
|
1779
|
+
message: string;
|
|
1780
|
+
globals?: Record<string, any>;
|
|
1781
|
+
hasNavigation?: boolean;
|
|
1782
|
+
parsedContent?: string;
|
|
1783
|
+
}
|
|
1784
|
+
declare class CheatConsole {
|
|
1785
|
+
readonly manager: ToolCollection;
|
|
1786
|
+
private readonly log;
|
|
1787
|
+
private readonly core;
|
|
1788
|
+
private readonly globals;
|
|
1789
|
+
readonly timeTravel: TimeTravelCheat;
|
|
1790
|
+
private readonly jsStatus;
|
|
1791
|
+
private readonly twineStatus;
|
|
1792
|
+
private readonly twineOutputs;
|
|
1793
|
+
constructor(manager: ToolCollection);
|
|
1794
|
+
executeJS(code?: string): JSExecutionResult;
|
|
1795
|
+
executeTwine(code?: string): TwineExecutionResult;
|
|
1796
|
+
execute(type: 'javascript' | 'twine', code?: string): ExecutionResult;
|
|
1797
|
+
private runJavaScript;
|
|
1798
|
+
private linkTarget;
|
|
1799
|
+
private html;
|
|
1800
|
+
private format;
|
|
1801
|
+
private showStatus;
|
|
1802
|
+
}
|
|
1803
|
+
//#endregion
|
|
1804
|
+
//#region src/modules/Frameworks/migration.d.ts
|
|
1805
|
+
interface Step {
|
|
1806
|
+
from: string;
|
|
1807
|
+
to: string;
|
|
1808
|
+
apply: (data: Record<string, any>, utils: Utils) => void;
|
|
1809
|
+
}
|
|
1810
|
+
interface PathRef {
|
|
1811
|
+
parent: Record<string, any>;
|
|
1812
|
+
key: string;
|
|
1813
|
+
}
|
|
1814
|
+
interface Utils {
|
|
1815
|
+
readonly log: ReturnType<typeof createlog>;
|
|
1816
|
+
path: (obj: Record<string, any>, path: string, create?: boolean) => PathRef | null;
|
|
1817
|
+
move: (data: Record<string, any>, from: string, to: string) => boolean;
|
|
1818
|
+
remove: (data: Record<string, any>, path: string) => boolean;
|
|
1819
|
+
transform: (data: Record<string, any>, path: string, fn: (value: any) => any) => boolean;
|
|
1820
|
+
fill: (target: Record<string, any>, defaults: Record<string, any>, mode?: 'merge' | 'cover') => void;
|
|
1821
|
+
}
|
|
1822
|
+
declare class migration {
|
|
1823
|
+
static readonly log: (message: string, level?: string, ...objects: any[]) => void;
|
|
1824
|
+
static create(): migration;
|
|
1825
|
+
readonly log: (message: string, level?: string, ...objects: any[]) => void;
|
|
1826
|
+
readonly utils: Utils;
|
|
1827
|
+
steps: Step[];
|
|
1828
|
+
private readonly unsafeKeys;
|
|
1829
|
+
constructor();
|
|
1830
|
+
add(from: string, to: string, apply: Step['apply']): void;
|
|
1831
|
+
run(data: Record<string, any>, targetVersion: string): void;
|
|
1832
|
+
private path;
|
|
1833
|
+
private move;
|
|
1834
|
+
private compare;
|
|
1835
|
+
}
|
|
1836
|
+
//#endregion
|
|
1837
|
+
//#region src/modules/Frameworks/RandSystem.d.ts
|
|
1838
|
+
interface RandState {
|
|
1839
|
+
seed: number | null;
|
|
1840
|
+
history: number[];
|
|
1841
|
+
index: number;
|
|
1842
|
+
}
|
|
1843
|
+
declare class randSystem {
|
|
1844
|
+
static readonly log: (message: string, level?: string, ...objects: any[]) => void;
|
|
1845
|
+
static create(state?: Partial<RandState>): randSystem;
|
|
1846
|
+
readonly log: (message: string, level?: string, ...objects: any[]) => void;
|
|
1847
|
+
readonly state: RandState;
|
|
1848
|
+
private readonly maxHistory;
|
|
1849
|
+
private readonly modulus;
|
|
1850
|
+
constructor(state?: Partial<RandState>);
|
|
1851
|
+
reset(seed?: number): void;
|
|
1852
|
+
int(max: number): number;
|
|
1853
|
+
percent(): number;
|
|
1854
|
+
back(steps?: number): void;
|
|
1855
|
+
forward(steps?: number): void;
|
|
1856
|
+
get seed(): number | null;
|
|
1857
|
+
set seed(value: number);
|
|
1858
|
+
get history(): number[];
|
|
1859
|
+
get index(): number;
|
|
1860
|
+
private next;
|
|
1861
|
+
private normalize;
|
|
1862
|
+
}
|
|
1863
|
+
//#endregion
|
|
1864
|
+
//#region src/macros/helpers.d.ts
|
|
1865
|
+
declare const CONVERT_MODES: readonly ['lower', 'upper', 'capitalize', 'title', 'camel', 'pascal', 'snake', 'kebab', 'constant'];
|
|
1866
|
+
type ConvertMode = (typeof CONVERT_MODES)[number];
|
|
1867
|
+
interface MacroPayload {
|
|
1868
|
+
name: string;
|
|
1869
|
+
args: any;
|
|
1870
|
+
contents?: string;
|
|
1871
|
+
}
|
|
1872
|
+
interface MacroContext$1 extends Omit<MacroContext, 'createShadowWrapper' | 'error' | 'payload'> {
|
|
1873
|
+
payload?: MacroPayload[] | null;
|
|
1874
|
+
error(msg: string): any;
|
|
1875
|
+
createShadowWrapper(callback: Function, doneCallback?: Function, startCallback?: Function): (...args: any[]) => void;
|
|
1876
|
+
passageObj?: any;
|
|
1877
|
+
lanListboxCache?: Record<
|
|
1878
|
+
string,
|
|
1879
|
+
{
|
|
1880
|
+
options: ListboxOption[];
|
|
1881
|
+
selectedIdx: number;
|
|
1882
|
+
}
|
|
1883
|
+
>;
|
|
1884
|
+
}
|
|
1885
|
+
interface ListboxOption {
|
|
1886
|
+
label: string;
|
|
1887
|
+
value: any;
|
|
1888
|
+
type: 'static' | 'dynamic';
|
|
1889
|
+
exprIndex?: number;
|
|
1890
|
+
convertMode: ConvertMode | null;
|
|
1891
|
+
}
|
|
1892
|
+
//#endregion
|
|
1893
|
+
//#region src/modules/Frameworks/macros.d.ts
|
|
1894
|
+
type MacroFunction = (this: MacroContext$1, ...args: any[]) => any;
|
|
1895
|
+
type SimpleMacroFunction = (this: MacroContext$1 | null, ...args: any[]) => any;
|
|
1896
|
+
type StatFunction = (...args: any[]) => DocumentFragment;
|
|
1897
|
+
type MacroTags = string[] | null | undefined;
|
|
1898
|
+
type SkipArgs = string[] | boolean | null | undefined;
|
|
1899
|
+
declare class defineMacros {
|
|
1900
|
+
readonly manager: ToolCollection;
|
|
1901
|
+
readonly log: ReturnType<typeof createlog>;
|
|
1902
|
+
readonly macros: string[];
|
|
1903
|
+
readonly statFunctions: Record<string, StatFunction>;
|
|
1904
|
+
constructor(manager: ToolCollection);
|
|
1905
|
+
get Macro(): MaplebirchCore['SugarCube']['Macro'];
|
|
1906
|
+
define(macroName: string, macroFunction: MacroFunction, tags?: MacroTags, skipArgs?: SkipArgs, isAsync?: boolean): void;
|
|
1907
|
+
defineS(macroName: string, macroFunction: SimpleMacroFunction, tags?: MacroTags, skipArgs?: SkipArgs, maintainContext?: boolean): void;
|
|
1908
|
+
statChange(statType: string, amount: number, colorClass: string, condition?: () => boolean): DocumentFragment;
|
|
1909
|
+
grace(amount: number, expectedRank?: string): DocumentFragment;
|
|
1910
|
+
create(name: string, fn: StatFunction): void;
|
|
1911
|
+
callStatFunction(name: string, ...args: any[]): DocumentFragment;
|
|
1912
|
+
}
|
|
1913
|
+
//#endregion
|
|
1914
|
+
//#region src/modules/Frameworks/HtmlTools.d.ts
|
|
1915
|
+
type TextContent = string | number | boolean | null | undefined;
|
|
1916
|
+
type RawContent = TextContent | Node;
|
|
1917
|
+
declare class Builder {
|
|
1918
|
+
readonly parent: htmlTools;
|
|
1919
|
+
readonly auto: (text: string) => string;
|
|
1920
|
+
readonly fragment: DocumentFragment;
|
|
1921
|
+
readonly context: Record<string, any>;
|
|
1922
|
+
constructor(parent: htmlTools, fragment: DocumentFragment, context?: Record<string, any>);
|
|
1923
|
+
text(content: TextContent, style?: string): this;
|
|
1924
|
+
line(content?: TextContent, style?: string): this;
|
|
1925
|
+
wikify(content: TextContent): this;
|
|
1926
|
+
raw(content: RawContent): this;
|
|
1927
|
+
box(content: RawContent, style?: string): this;
|
|
1928
|
+
}
|
|
1929
|
+
declare class htmlTools {
|
|
1930
|
+
readonly core: ToolCollection['core'];
|
|
1931
|
+
readonly log: ReturnType<typeof createlog>;
|
|
1932
|
+
private uid;
|
|
1933
|
+
private readonly store;
|
|
1934
|
+
constructor(manager: ToolCollection);
|
|
1935
|
+
get Wikifier(): any;
|
|
1936
|
+
replaceText(oldText: string, newText: string): void;
|
|
1937
|
+
replaceLink(oldLink: string, newLink: string): void;
|
|
1938
|
+
add(key: string, handler: (tools: Builder) => void, id?: string): string | false;
|
|
1939
|
+
delete(key: string, idOrHandler?: string | ((tools: Builder) => void)): boolean;
|
|
1940
|
+
clear(): void;
|
|
1941
|
+
renderFragment(keys: string | string[], context?: Record<string, any>): DocumentFragment;
|
|
1942
|
+
render(macro: any, keys: string | string[]): void;
|
|
1943
|
+
makeTextOutput(options?: { CSV?: boolean }): MacroFunction;
|
|
1944
|
+
}
|
|
1945
|
+
//#endregion
|
|
1946
|
+
//#region src/modules/Frameworks/ZonesManager.d.ts
|
|
1947
|
+
interface ZoneWidgetConfig {
|
|
1948
|
+
exclude?: string[];
|
|
1949
|
+
match?: RegExp;
|
|
1950
|
+
passage?: string | string[];
|
|
1951
|
+
widget: string;
|
|
1952
|
+
type?: 'function';
|
|
1953
|
+
func?: () => any;
|
|
1954
|
+
}
|
|
1955
|
+
interface CustomLinkZoneItem {
|
|
1956
|
+
position: number;
|
|
1957
|
+
widget: string | ZoneWidgetConfig;
|
|
1958
|
+
}
|
|
1959
|
+
interface PatchSet {
|
|
1960
|
+
src?: string;
|
|
1961
|
+
srcmatch?: RegExp;
|
|
1962
|
+
srcmatchgroup?: RegExp;
|
|
1963
|
+
to?: string;
|
|
1964
|
+
applyafter?: string;
|
|
1965
|
+
applybefore?: string;
|
|
1966
|
+
}
|
|
1967
|
+
type ZoneItem = string | ZoneWidgetConfig | CustomLinkZoneItem;
|
|
1968
|
+
type InitObject =
|
|
1969
|
+
| {
|
|
1970
|
+
init: Function;
|
|
1971
|
+
}
|
|
1972
|
+
| {
|
|
1973
|
+
name: string;
|
|
1974
|
+
func: Function;
|
|
1975
|
+
};
|
|
1976
|
+
type InitFunction = string | Function | InitObject;
|
|
1977
|
+
declare class zonesManager {
|
|
1978
|
+
readonly log: ReturnType<typeof createlog>;
|
|
1979
|
+
readonly core: ToolCollection['core'];
|
|
1980
|
+
data: Record<string, ZoneItem[]>;
|
|
1981
|
+
initFunction: InitFunction[];
|
|
1982
|
+
specialWidget: (string | Function)[];
|
|
1983
|
+
defaultData: Record<string, string | Function>;
|
|
1984
|
+
locationPassage: Record<string, PatchSet[]>;
|
|
1985
|
+
widgetPassage: Record<string, PatchSet[]>;
|
|
1986
|
+
widgethtml: string;
|
|
1987
|
+
private functions;
|
|
1988
|
+
constructor(manager: ToolCollection);
|
|
1989
|
+
inject(...databases: Partial<Pick<zonesManager, 'specialWidget' | 'defaultData' | 'locationPassage' | 'widgetPassage'>>[]): void;
|
|
1990
|
+
onInit(...widgets: InitFunction[]): void;
|
|
1991
|
+
addTo(zone: string, ...widgets: (string | Function | ZoneWidgetConfig | [number, string | ZoneWidgetConfig])[]): void;
|
|
1992
|
+
storyInit(): void;
|
|
1993
|
+
call(name: string): any;
|
|
1994
|
+
play(zone: string, passageTitle?: string): any;
|
|
1995
|
+
patchModToGame(manager: AddonPlugin, type: 'before' | 'after'): void;
|
|
1996
|
+
private get widgets();
|
|
1997
|
+
private get specials();
|
|
1998
|
+
private defaultContent;
|
|
1999
|
+
private render;
|
|
2000
|
+
private shouldRender;
|
|
2001
|
+
private customLinkItem;
|
|
2002
|
+
private matchAndApply;
|
|
2003
|
+
private applyPatch;
|
|
2004
|
+
private wrapSpecialPassage;
|
|
2005
|
+
private applyContentPatches;
|
|
2006
|
+
private patchPassage;
|
|
2007
|
+
private widgetInit;
|
|
2008
|
+
private hash;
|
|
2009
|
+
}
|
|
2010
|
+
//#endregion
|
|
2011
|
+
//#region src/modules/Frameworks/ApplyLinkZone.d.ts
|
|
2012
|
+
interface CustomZone {
|
|
2013
|
+
position: number;
|
|
2014
|
+
macro: string;
|
|
2015
|
+
}
|
|
2016
|
+
interface LinkZoneConfig {
|
|
2017
|
+
containerId: string;
|
|
2018
|
+
linkSelector: string;
|
|
2019
|
+
beforeMacro: () => string;
|
|
2020
|
+
afterMacro: () => string;
|
|
2021
|
+
customMacro: () => CustomZone[];
|
|
2022
|
+
zoneStyle: Partial<CSSStyleDeclaration>;
|
|
2023
|
+
onBeforeApply?: (() => void) | null;
|
|
2024
|
+
onAfterApply?: ((result: boolean, config: LinkZoneConfig) => void) | null;
|
|
2025
|
+
debug: boolean;
|
|
2026
|
+
}
|
|
2027
|
+
declare const log: (message: string, level?: string, ...objects: any[]) => void;
|
|
2028
|
+
declare class LinkZoneManager {
|
|
2029
|
+
readonly containerId: string;
|
|
2030
|
+
readonly linkSelector: string;
|
|
2031
|
+
firstLink: Element | null;
|
|
2032
|
+
lastLink: Element | null;
|
|
2033
|
+
links: Element[];
|
|
2034
|
+
breakBeforeFirst: ChildNode | null;
|
|
2035
|
+
readonly log: ReturnType<typeof createlog>;
|
|
2036
|
+
constructor(containerId?: string, linkSelector?: string, logger?: typeof log);
|
|
2037
|
+
detect(): boolean;
|
|
2038
|
+
applyZones(config: LinkZoneConfig, customZones: CustomZone[]): boolean;
|
|
2039
|
+
private applyBefore;
|
|
2040
|
+
private applyAfter;
|
|
2041
|
+
private applyCustom;
|
|
2042
|
+
private zone;
|
|
2043
|
+
private insertAfterBreak;
|
|
2044
|
+
private findBreakBefore;
|
|
2045
|
+
private isBreak;
|
|
2046
|
+
private visible;
|
|
2047
|
+
}
|
|
2048
|
+
declare const applyLinkZone: typeof LinkZoneManager;
|
|
2049
|
+
//#endregion
|
|
2050
|
+
//#region src/modules/Frameworks/OtherTools/Traits.d.ts
|
|
2051
|
+
interface TraitCategory {
|
|
2052
|
+
title: string;
|
|
2053
|
+
traits: Trait[];
|
|
2054
|
+
}
|
|
2055
|
+
interface Trait {
|
|
2056
|
+
name: string;
|
|
2057
|
+
colour: string;
|
|
2058
|
+
has: boolean;
|
|
2059
|
+
text: string;
|
|
2060
|
+
}
|
|
2061
|
+
interface TraitConfig {
|
|
2062
|
+
title: string;
|
|
2063
|
+
name: string | (() => string);
|
|
2064
|
+
colour: string | (() => string);
|
|
2065
|
+
has: boolean | (() => boolean);
|
|
2066
|
+
text: string | (() => string);
|
|
2067
|
+
}
|
|
2068
|
+
//#endregion
|
|
2069
|
+
//#region src/modules/Frameworks/OtherTools/Location.d.ts
|
|
2070
|
+
interface LocationConfigOptions {
|
|
2071
|
+
overwrite?: boolean;
|
|
2072
|
+
layer?: string;
|
|
2073
|
+
element?: string;
|
|
2074
|
+
}
|
|
2075
|
+
interface LocationConfig {
|
|
2076
|
+
condition?: (...object: any[]) => boolean;
|
|
2077
|
+
folder?: string;
|
|
2078
|
+
base?: Record<string, any>;
|
|
2079
|
+
emissive?: Record<string, any>;
|
|
2080
|
+
reflective?: Record<string, any>;
|
|
2081
|
+
layerTop?: Record<string, any>;
|
|
2082
|
+
customMapping?: any;
|
|
2083
|
+
[key: string]: any;
|
|
2084
|
+
}
|
|
2085
|
+
interface LocationUpdate {
|
|
2086
|
+
overwrite: boolean;
|
|
2087
|
+
config: LocationConfig;
|
|
2088
|
+
customMapping: any;
|
|
2089
|
+
}
|
|
2090
|
+
//#endregion
|
|
2091
|
+
//#region src/modules/Frameworks/OtherTools/Bodywriting.d.ts
|
|
2092
|
+
interface BodywritingConfig {
|
|
2093
|
+
writing?: string;
|
|
2094
|
+
writ_cn?: string;
|
|
2095
|
+
type?: 'text' | 'object';
|
|
2096
|
+
arrow?: 0 | 1;
|
|
2097
|
+
special?: string;
|
|
2098
|
+
gender?: 'n' | 'f' | 'm' | 'h';
|
|
2099
|
+
lewd?: 0 | 1;
|
|
2100
|
+
degree?: number;
|
|
2101
|
+
featSkip?: boolean;
|
|
2102
|
+
sprites?: string[];
|
|
2103
|
+
index?: number;
|
|
2104
|
+
key?: string;
|
|
2105
|
+
}
|
|
2106
|
+
interface BodywritingData {
|
|
2107
|
+
operation: 'add' | 'del';
|
|
2108
|
+
config?: BodywritingConfig;
|
|
2109
|
+
}
|
|
2110
|
+
//#endregion
|
|
2111
|
+
//#region src/modules/Frameworks/OtherTools/Foodstuff.d.ts
|
|
2112
|
+
type FoodstuffSeason = 'spring' | 'summer' | 'autumn' | 'winter';
|
|
2113
|
+
type FoodstuffPlantingBed = 'earth' | 'water';
|
|
2114
|
+
type FoodstuffStallSize = 'small' | 'large';
|
|
2115
|
+
interface FoodstuffConfig {
|
|
2116
|
+
key?: string;
|
|
2117
|
+
index?: number;
|
|
2118
|
+
name?: string;
|
|
2119
|
+
singular?: string;
|
|
2120
|
+
plural?: string;
|
|
2121
|
+
icon?: string;
|
|
2122
|
+
category?: string;
|
|
2123
|
+
kitchen_item_type_icon?: string;
|
|
2124
|
+
prop_folder?: string;
|
|
2125
|
+
ingredient_alternatives?: Record<string, string[]>;
|
|
2126
|
+
tending?: {
|
|
2127
|
+
planting_bed?: FoodstuffPlantingBed;
|
|
2128
|
+
growth_days?: number;
|
|
2129
|
+
yield_multiplier?: number;
|
|
2130
|
+
has_seeds?: boolean;
|
|
2131
|
+
seed_name?: string;
|
|
2132
|
+
seasons?: FoodstuffSeason[];
|
|
2133
|
+
affected_by_tending_skill?: boolean;
|
|
2134
|
+
tags?: string[];
|
|
2135
|
+
[key: string]: any;
|
|
2136
|
+
};
|
|
2137
|
+
shop?: {
|
|
2138
|
+
sell_price?: number;
|
|
2139
|
+
available_in?: string[];
|
|
2140
|
+
bought_in_bulk?: number;
|
|
2141
|
+
stall_size?: FoodstuffStallSize;
|
|
2142
|
+
[key: string]: any;
|
|
2143
|
+
};
|
|
2144
|
+
recipe?: {
|
|
2145
|
+
recipe_name?: string;
|
|
2146
|
+
difficulty?: number;
|
|
2147
|
+
cook_minutes?: number;
|
|
2148
|
+
servings?: number;
|
|
2149
|
+
ingredients?: string[];
|
|
2150
|
+
ingredient_alternatives?: Record<string, string[]>;
|
|
2151
|
+
tags?: string[];
|
|
2152
|
+
[key: string]: any;
|
|
2153
|
+
};
|
|
2154
|
+
food?: {
|
|
2155
|
+
handheld_gift?: boolean;
|
|
2156
|
+
tags?: string[];
|
|
2157
|
+
[key: string]: any;
|
|
2158
|
+
};
|
|
2159
|
+
[key: string]: any;
|
|
2160
|
+
}
|
|
2161
|
+
//#endregion
|
|
2162
|
+
//#region src/modules/Frameworks/OtherTools/Antiques.d.ts
|
|
2163
|
+
interface AntiqueConfig {
|
|
2164
|
+
hint: string;
|
|
2165
|
+
museum: string;
|
|
2166
|
+
name: string;
|
|
2167
|
+
cn_name?: string;
|
|
2168
|
+
journal: string;
|
|
2169
|
+
journalName?: string;
|
|
2170
|
+
icon: string;
|
|
2171
|
+
key?: string;
|
|
2172
|
+
}
|
|
2173
|
+
//#endregion
|
|
2174
|
+
//#region src/modules/Frameworks/patch.d.ts
|
|
2175
|
+
type AddTraits = (...traits: Partial<TraitConfig>[]) => void;
|
|
2176
|
+
type InjectTraits = (data: TraitCategory[]) => TraitCategory[];
|
|
2177
|
+
type ConfigureLocation = (locationId: string, config: LocationConfig, options?: LocationConfigOptions) => boolean;
|
|
2178
|
+
type ApplyLocation = () => void;
|
|
2179
|
+
type AddBodywriting = (key: string, config: BodywritingConfig) => void;
|
|
2180
|
+
type ApplyBodywriting = () => void;
|
|
2181
|
+
type AddFoodstuff = (key: string, config: FoodstuffConfig) => void;
|
|
2182
|
+
type ApplyFoodstuff = () => void;
|
|
2183
|
+
type AddAntiques = (key: string, config: AntiqueConfig) => void;
|
|
2184
|
+
type InjectAntiques = (data: Record<string, AntiqueConfig>) => Record<string, AntiqueConfig>;
|
|
2185
|
+
declare class Patch {
|
|
2186
|
+
readonly traitsData: TraitConfig[];
|
|
2187
|
+
readonly locationData: Record<string, LocationUpdate>;
|
|
2188
|
+
readonly bodywritingData: Record<string, BodywritingData>;
|
|
2189
|
+
readonly foodstuffData: Record<string, FoodstuffConfig>;
|
|
2190
|
+
readonly antiquesData: Record<string, AntiqueConfig>;
|
|
2191
|
+
addTraits: AddTraits;
|
|
2192
|
+
injectTraits: InjectTraits;
|
|
2193
|
+
configureLocation: ConfigureLocation;
|
|
2194
|
+
applyLocation: ApplyLocation;
|
|
2195
|
+
addBodywriting: AddBodywriting;
|
|
2196
|
+
applyBodywriting: ApplyBodywriting;
|
|
2197
|
+
addFoodstuff: AddFoodstuff;
|
|
2198
|
+
applyFoodstuff: ApplyFoodstuff;
|
|
2199
|
+
addAntiques: AddAntiques;
|
|
2200
|
+
injectAntiques: InjectAntiques;
|
|
2201
|
+
}
|
|
2202
|
+
declare const _default: Patch;
|
|
2203
|
+
//#endregion
|
|
2204
|
+
//#region src/modules/ToolCollection.d.ts
|
|
2205
|
+
declare class ToolCollection {
|
|
2206
|
+
readonly core: MaplebirchCore;
|
|
2207
|
+
readonly console: CheatConsole;
|
|
2208
|
+
readonly migration: typeof migration;
|
|
2209
|
+
readonly rand: typeof randSystem;
|
|
2210
|
+
readonly macro: defineMacros;
|
|
2211
|
+
readonly text: htmlTools;
|
|
2212
|
+
readonly zone: zonesManager;
|
|
2213
|
+
readonly link: typeof applyLinkZone;
|
|
2214
|
+
readonly patch: typeof _default;
|
|
2215
|
+
readonly createlog: typeof createlog;
|
|
2216
|
+
constructor(core: MaplebirchCore);
|
|
2217
|
+
onInit(...widgets: InitFunction[]): void;
|
|
2218
|
+
addTo(zone: string, ...widgets: (string | Function | ZoneWidgetConfig | [number, string | ZoneWidgetConfig])[]): void;
|
|
2219
|
+
preInit(): void;
|
|
2220
|
+
private config;
|
|
2221
|
+
private loadConfig;
|
|
2222
|
+
private addTrait;
|
|
2223
|
+
private addKeyedConfig;
|
|
2224
|
+
private error;
|
|
2225
|
+
}
|
|
2226
|
+
//#endregion
|
|
2227
|
+
//#region src/modules/AudioAddon/Track.d.ts
|
|
2228
|
+
type AudioFormat = 'mp3' | 'wav' | 'ogg' | 'm4a' | 'flac' | 'webm';
|
|
2229
|
+
interface TrackMeta {
|
|
2230
|
+
title?: string;
|
|
2231
|
+
artist?: string;
|
|
2232
|
+
}
|
|
2233
|
+
declare class Track {
|
|
2234
|
+
readonly audioName: string;
|
|
2235
|
+
readonly modName: string;
|
|
2236
|
+
title: string;
|
|
2237
|
+
artist: string;
|
|
2238
|
+
duration: number;
|
|
2239
|
+
format: AudioFormat;
|
|
2240
|
+
constructor(audioName: string, modName: string, meta?: TrackMeta);
|
|
2241
|
+
}
|
|
2242
|
+
//#endregion
|
|
2243
|
+
//#region src/modules/AudioAddon/Playlist.d.ts
|
|
2244
|
+
declare const PlayMode: {
|
|
2245
|
+
readonly SEQUENTIAL: 'sequential';
|
|
2246
|
+
readonly LOOP_ALL: 'loop_all';
|
|
2247
|
+
readonly LOOP_ONE: 'loop_one';
|
|
2248
|
+
readonly SHUFFLE: 'shuffle';
|
|
2249
|
+
};
|
|
2250
|
+
type PlayModeType = (typeof PlayMode)[keyof typeof PlayMode];
|
|
2251
|
+
declare class Playlist {
|
|
2252
|
+
readonly name: string;
|
|
2253
|
+
tracks: Track[];
|
|
2254
|
+
currentIndex: number;
|
|
2255
|
+
playMode: PlayModeType;
|
|
2256
|
+
private shuffleOrder;
|
|
2257
|
+
private shuffleIndex;
|
|
2258
|
+
constructor(name: string);
|
|
2259
|
+
add(input: Track | Track[]): void;
|
|
2260
|
+
removeAt(index: number): boolean;
|
|
2261
|
+
remove(audioName: string): boolean;
|
|
2262
|
+
clear(): void;
|
|
2263
|
+
setMode(mode: PlayModeType): void;
|
|
2264
|
+
select(index: number): Track | null;
|
|
2265
|
+
next(): Track | null;
|
|
2266
|
+
previous(): Track | null;
|
|
2267
|
+
get length(): number;
|
|
2268
|
+
private resetShuffle;
|
|
2269
|
+
private shuffle;
|
|
2270
|
+
}
|
|
2271
|
+
//#endregion
|
|
2272
|
+
//#region src/modules/Audio.d.ts
|
|
2273
|
+
declare const PlayState: {
|
|
2274
|
+
readonly IDLE: 'idle';
|
|
2275
|
+
readonly LOADING: 'loading';
|
|
2276
|
+
readonly PLAYING: 'playing';
|
|
2277
|
+
readonly PAUSED: 'paused';
|
|
2278
|
+
readonly STOPPED: 'stopped';
|
|
2279
|
+
};
|
|
2280
|
+
type PlayStateType = (typeof PlayState)[keyof typeof PlayState];
|
|
2281
|
+
interface AudioEventData {
|
|
2282
|
+
type: string;
|
|
2283
|
+
data?: any[];
|
|
2284
|
+
[key: string]: any;
|
|
2285
|
+
}
|
|
2286
|
+
type AudioEventHandler = (eventData: AudioEventData) => void;
|
|
2287
|
+
interface AudioProgress {
|
|
2288
|
+
currentTime: number;
|
|
2289
|
+
duration: number;
|
|
2290
|
+
percent: number;
|
|
2291
|
+
}
|
|
2292
|
+
interface AudioSnapshot {
|
|
2293
|
+
state: PlayStateType;
|
|
2294
|
+
track: Track | null;
|
|
2295
|
+
playlist: string;
|
|
2296
|
+
index: number;
|
|
2297
|
+
length: number;
|
|
2298
|
+
mode: PlayModeType;
|
|
2299
|
+
volume: number;
|
|
2300
|
+
muted: boolean;
|
|
2301
|
+
progress: AudioProgress;
|
|
2302
|
+
}
|
|
2303
|
+
declare class AudioManager {
|
|
2304
|
+
readonly core: MaplebirchCore;
|
|
2305
|
+
readonly log: ReturnType<typeof createlog>;
|
|
2306
|
+
private readonly STORE;
|
|
2307
|
+
private readonly playlists;
|
|
2308
|
+
private readonly eventListeners;
|
|
2309
|
+
private readonly cache;
|
|
2310
|
+
private readonly pendingLoads;
|
|
2311
|
+
private activePlaylist;
|
|
2312
|
+
private currentTrack;
|
|
2313
|
+
private loadingTrack;
|
|
2314
|
+
private currentHowl;
|
|
2315
|
+
private state;
|
|
2316
|
+
private volume;
|
|
2317
|
+
private muted;
|
|
2318
|
+
private autoNext;
|
|
2319
|
+
private maxCache;
|
|
2320
|
+
private cacheCount;
|
|
2321
|
+
private playRequestId;
|
|
2322
|
+
private progressTimer;
|
|
2323
|
+
private progressBindings;
|
|
2324
|
+
constructor(core: MaplebirchCore);
|
|
2325
|
+
private initDB;
|
|
2326
|
+
protected on(event: string, handler: AudioEventHandler): void;
|
|
2327
|
+
protected off(event: string, handler: AudioEventHandler): boolean;
|
|
2328
|
+
protected once(event: string, handler: AudioEventHandler): void;
|
|
2329
|
+
play(track: Track): Promise<boolean>;
|
|
2330
|
+
pause(): boolean;
|
|
2331
|
+
resume(): boolean;
|
|
2332
|
+
stop(): boolean;
|
|
2333
|
+
togglePlayPause(): void;
|
|
2334
|
+
next(): Promise<boolean>;
|
|
2335
|
+
previous(): Promise<boolean>;
|
|
2336
|
+
playAt(modName: string, index: number): Promise<boolean>;
|
|
2337
|
+
seek(percent: number): boolean;
|
|
2338
|
+
seekTo(seconds: number): boolean;
|
|
2339
|
+
getPlaylist(modName: string): Promise<Playlist>;
|
|
2340
|
+
playFromMod(modName: string, audioName?: string): Promise<boolean | string>;
|
|
2341
|
+
import(modName: string, audioFolder?: string): Promise<boolean>;
|
|
2342
|
+
addFile(file: File, modName?: string): Promise<boolean | string>;
|
|
2343
|
+
delete(modName: string, audioName: string): Promise<boolean>;
|
|
2344
|
+
clearAudio(modName: string): Promise<boolean | string>;
|
|
2345
|
+
clearCache(): void;
|
|
2346
|
+
destroy(): void;
|
|
2347
|
+
playlist(modName: string): Playlist;
|
|
2348
|
+
get Mute(): boolean;
|
|
2349
|
+
set Mute(value: boolean);
|
|
2350
|
+
get Volume(): number;
|
|
2351
|
+
set Volume(value: number);
|
|
2352
|
+
get PlayMode(): PlayModeType;
|
|
2353
|
+
set PlayMode(mode: PlayModeType);
|
|
2354
|
+
cyclePlayMode(): PlayModeType;
|
|
2355
|
+
get AutoNext(): boolean;
|
|
2356
|
+
set AutoNext(value: boolean);
|
|
2357
|
+
get State(): PlayStateType;
|
|
2358
|
+
get CurrentTrack(): Track | null;
|
|
2359
|
+
get ActivePlaylist(): Playlist | null;
|
|
2360
|
+
get currentTime(): number;
|
|
2361
|
+
get duration(): number;
|
|
2362
|
+
get progress(): AudioProgress;
|
|
2363
|
+
get snapshot(): AudioSnapshot;
|
|
2364
|
+
formatTime(seconds: number): string;
|
|
2365
|
+
bindProgress(sliderId: string, timeId: string, interval?: number): void;
|
|
2366
|
+
unbindProgress(sliderId: string, timeId: string): void;
|
|
2367
|
+
preInit(): Promise<void>;
|
|
2368
|
+
private load;
|
|
2369
|
+
private save;
|
|
2370
|
+
private readRecords;
|
|
2371
|
+
private cacheAudio;
|
|
2372
|
+
private unloadCache;
|
|
2373
|
+
private trimCache;
|
|
2374
|
+
private release;
|
|
2375
|
+
private stopCurrent;
|
|
2376
|
+
private get outputVolume();
|
|
2377
|
+
private startProgressTimer;
|
|
2378
|
+
private stopProgressTimer;
|
|
2379
|
+
private handleTrackEnd;
|
|
2380
|
+
private dispatch;
|
|
2381
|
+
private emit;
|
|
2382
|
+
}
|
|
2383
|
+
//#endregion
|
|
2384
|
+
//#region src/modules/Variables.d.ts
|
|
2385
|
+
declare class Options {
|
|
2386
|
+
define(...args: any[]): any;
|
|
2387
|
+
}
|
|
2388
|
+
interface HairGradientsReturn {
|
|
2389
|
+
fringe: Record<string, string[]>;
|
|
2390
|
+
sides: Record<string, string[]>;
|
|
2391
|
+
}
|
|
2392
|
+
declare function hairgradients(): HairGradientsReturn;
|
|
2393
|
+
declare class Variables {
|
|
2394
|
+
readonly core: MaplebirchCore;
|
|
2395
|
+
private static readonly OPTIONS_STORAGE_KEY;
|
|
2396
|
+
private static moduleOptions;
|
|
2397
|
+
static add(key: string, value: any): void;
|
|
2398
|
+
static get options(): Record<string, any>;
|
|
2399
|
+
version: string;
|
|
2400
|
+
readonly tool: MaplebirchCore['tool'];
|
|
2401
|
+
readonly log: ReturnType<typeof createlog>;
|
|
2402
|
+
readonly migration: migration;
|
|
2403
|
+
readonly options: Options;
|
|
2404
|
+
constructor(core: MaplebirchCore);
|
|
2405
|
+
hairgradients: typeof hairgradients;
|
|
2406
|
+
optionsStorage(action: 'save' | 'restore' | 'reset' | 'load'): any | null;
|
|
2407
|
+
check(): void;
|
|
2408
|
+
Init(): void;
|
|
2409
|
+
loadInit(): void;
|
|
2410
|
+
postInit(): void;
|
|
2411
|
+
}
|
|
2412
|
+
//#endregion
|
|
2413
|
+
//#region src/modules/CharacterAddon/Pet.d.ts
|
|
2414
|
+
interface PetOptions {
|
|
2415
|
+
mask?: number;
|
|
2416
|
+
rotation?: number;
|
|
2417
|
+
animated?: boolean;
|
|
2418
|
+
floating?: boolean;
|
|
2419
|
+
scale?: number;
|
|
2420
|
+
}
|
|
2421
|
+
type PetTarget = string | HTMLElement;
|
|
2422
|
+
declare class Pet {
|
|
2423
|
+
private manager;
|
|
2424
|
+
readonly modelName: string;
|
|
2425
|
+
private canvas?;
|
|
2426
|
+
private model?;
|
|
2427
|
+
private container?;
|
|
2428
|
+
private options;
|
|
2429
|
+
private readonly layers;
|
|
2430
|
+
private cleanupDrag?;
|
|
2431
|
+
private syncing;
|
|
2432
|
+
private rendering;
|
|
2433
|
+
private syncFrame;
|
|
2434
|
+
constructor(manager: Character);
|
|
2435
|
+
sync(): boolean;
|
|
2436
|
+
use(layers: CanvasLayerMap): this;
|
|
2437
|
+
capture(mainModel?: CanvasModelOptions): void;
|
|
2438
|
+
render(target: PetTarget, options?: PetOptions): boolean;
|
|
2439
|
+
unmount(): void;
|
|
2440
|
+
refresh(): boolean;
|
|
2441
|
+
configure(options?: PetOptions): this;
|
|
2442
|
+
private cancel;
|
|
2443
|
+
private get displaySize();
|
|
2444
|
+
private readSettings;
|
|
2445
|
+
private draw;
|
|
2446
|
+
private clearBox;
|
|
2447
|
+
private enableDrag;
|
|
2448
|
+
private stopAnimation;
|
|
2449
|
+
}
|
|
2450
|
+
//#endregion
|
|
2451
|
+
//#region src/modules/CharacterAddon/TransformationConfig.d.ts
|
|
2452
|
+
type DecayCondition = () => boolean;
|
|
2453
|
+
type SuppressCondition = (sourceName: string) => boolean;
|
|
2454
|
+
type BuildUpdater = (change: number) => void;
|
|
2455
|
+
//#endregion
|
|
2456
|
+
//#region src/modules/CharacterAddon/Transformation.d.ts
|
|
2457
|
+
interface Part {
|
|
2458
|
+
name: string;
|
|
2459
|
+
tfRequired: number;
|
|
2460
|
+
default?: string;
|
|
2461
|
+
[key: string]: any;
|
|
2462
|
+
}
|
|
2463
|
+
type TransformHook = (options: any, model?: CanvasModel) => void;
|
|
2464
|
+
type TransformMessage = Record<
|
|
2465
|
+
string,
|
|
2466
|
+
{
|
|
2467
|
+
up: string[];
|
|
2468
|
+
down: string[];
|
|
2469
|
+
}
|
|
2470
|
+
>;
|
|
2471
|
+
type TranslationInput$1 = Record<string, Translation> | Map<string, Translation>;
|
|
2472
|
+
interface EntryOptions {
|
|
2473
|
+
build?: number;
|
|
2474
|
+
level?: number;
|
|
2475
|
+
update?: number[];
|
|
2476
|
+
icon?: string;
|
|
2477
|
+
message?: TransformMessage;
|
|
2478
|
+
decay?: boolean;
|
|
2479
|
+
decayConditions?: DecayCondition[];
|
|
2480
|
+
suppress?: boolean;
|
|
2481
|
+
suppressConditions?: SuppressCondition[];
|
|
2482
|
+
pre?: TransformHook;
|
|
2483
|
+
post?: TransformHook;
|
|
2484
|
+
layers?: CanvasLayerMap;
|
|
2485
|
+
translations?: TranslationInput$1;
|
|
2486
|
+
}
|
|
2487
|
+
interface TransformationOption extends EntryOptions {
|
|
2488
|
+
parts: Part[];
|
|
2489
|
+
traits?: Part[];
|
|
2490
|
+
}
|
|
2491
|
+
declare class Transformation {
|
|
2492
|
+
private manager;
|
|
2493
|
+
private log;
|
|
2494
|
+
private config;
|
|
2495
|
+
readonly decayConditions: Record<string, DecayCondition[]>;
|
|
2496
|
+
readonly suppressConditions: Record<string, SuppressCondition[]>;
|
|
2497
|
+
readonly buildUpdaters: Record<string, BuildUpdater>;
|
|
2498
|
+
constructor(manager: Character);
|
|
2499
|
+
private isDoLP;
|
|
2500
|
+
private get animalTransforms();
|
|
2501
|
+
private get animalMacros();
|
|
2502
|
+
private get historyTransforms();
|
|
2503
|
+
wikifier(widget: string, ...args: any[]): any;
|
|
2504
|
+
modifyEffect(manager: AddonPlugin): void;
|
|
2505
|
+
add(name: string, type: string, options: TransformationOption): this;
|
|
2506
|
+
inject(): void;
|
|
2507
|
+
private _update;
|
|
2508
|
+
private _clear;
|
|
2509
|
+
private suppress;
|
|
2510
|
+
_transform(name: string, change: number): void;
|
|
2511
|
+
updateTransform(name: string): void;
|
|
2512
|
+
_updateParts(name: string, oldLevel: number, newLevel: number): void;
|
|
2513
|
+
_transformationAlteration(): void;
|
|
2514
|
+
_transformationStateUpdate(): void;
|
|
2515
|
+
private handleHiddenTransformParts;
|
|
2516
|
+
message(
|
|
2517
|
+
key: string,
|
|
2518
|
+
tools: {
|
|
2519
|
+
element: (tag: string, text: any, className?: string) => void;
|
|
2520
|
+
wikifier: (macro: string, param: string) => void;
|
|
2521
|
+
}
|
|
2522
|
+
): boolean;
|
|
2523
|
+
get icon(): string;
|
|
2524
|
+
setTransform(name: string, level: number | null): void;
|
|
2525
|
+
part(partName: string): boolean;
|
|
2526
|
+
}
|
|
2527
|
+
//#endregion
|
|
2528
|
+
//#region src/modules/Character.d.ts
|
|
2529
|
+
type ProcessType = 'pre' | 'post';
|
|
2530
|
+
type ModelTarget<TModel = CanvasModel | CanvasModelOptions> = string | string[] | ((modelName: string, model?: TModel) => boolean);
|
|
2531
|
+
type ProcessHandler = (options: any, model?: CanvasModel) => void;
|
|
2532
|
+
interface LayerUseOptions {
|
|
2533
|
+
pet?: boolean;
|
|
2534
|
+
}
|
|
2535
|
+
declare function mask(x?: number, rotation?: number, swap?: boolean, width?: number, height?: number): string;
|
|
2536
|
+
declare class Character {
|
|
2537
|
+
readonly core: MaplebirchCore;
|
|
2538
|
+
readonly log: ReturnType<typeof createlog>;
|
|
2539
|
+
readonly mask: typeof mask;
|
|
2540
|
+
readonly faceStyleMap: Map<string, string[]>;
|
|
2541
|
+
private readonly handlers;
|
|
2542
|
+
private readonly layers;
|
|
2543
|
+
readonly pet: Pet;
|
|
2544
|
+
readonly transformation: Transformation;
|
|
2545
|
+
constructor(core: MaplebirchCore);
|
|
2546
|
+
get ZIndices(): {
|
|
2547
|
+
[key: string]: number;
|
|
2548
|
+
};
|
|
2549
|
+
modifyFaceStyle(manager: AddonPlugin): void;
|
|
2550
|
+
faceStyleImagePaths(files: Record<string, unknown>): void;
|
|
2551
|
+
private faceStyleSetupOption;
|
|
2552
|
+
modifyCanvasModel(manager: AddonPlugin): void;
|
|
2553
|
+
patchCanvasModel<T extends CanvasModelConstructor>(BaseCanvasModel: T): T;
|
|
2554
|
+
use(type: ProcessType, handler: ProcessHandler, target?: ModelTarget<CanvasModel>): this;
|
|
2555
|
+
use(layers: CanvasLayerMap, target?: ModelTarget<CanvasModelOptions>, options?: LayerUseOptions): this;
|
|
2556
|
+
process(type: ProcessType, options: CanvasModelOptionsData, model?: CanvasModel): void;
|
|
2557
|
+
preInit(): void;
|
|
2558
|
+
Init(): void;
|
|
2559
|
+
loadInit(): void;
|
|
2560
|
+
}
|
|
2561
|
+
//#endregion
|
|
2562
|
+
//#region src/modules/NamedNPCAddon/NPCSchedules.d.ts
|
|
2563
|
+
interface ScheduleCondition {
|
|
2564
|
+
(date: EnhancedDate): boolean;
|
|
2565
|
+
}
|
|
2566
|
+
type ScheduleTime = number | [number, number?];
|
|
2567
|
+
type ScheduleLocation = string | ((date: EnhancedDate) => string | Schedule | void | null | undefined);
|
|
2568
|
+
type ScheduleBuilder = (schedule: Schedule) => void | Schedule;
|
|
2569
|
+
interface SpecialSchedule {
|
|
2570
|
+
id: string | number;
|
|
2571
|
+
condition: ScheduleCondition;
|
|
2572
|
+
location: ScheduleLocation;
|
|
2573
|
+
before?: string | number;
|
|
2574
|
+
after?: string | number;
|
|
2575
|
+
insteadOf?: string | number;
|
|
2576
|
+
override?: boolean;
|
|
2577
|
+
}
|
|
2578
|
+
interface DailyScheduleConfig {
|
|
2579
|
+
time: ScheduleTime;
|
|
2580
|
+
location: string;
|
|
2581
|
+
}
|
|
2582
|
+
interface SpecialScheduleConfig extends Partial<Omit<SpecialSchedule, 'condition' | 'location'>> {
|
|
2583
|
+
condition: ScheduleCondition;
|
|
2584
|
+
location: ScheduleLocation;
|
|
2585
|
+
}
|
|
2586
|
+
interface ScheduleConfig {
|
|
2587
|
+
daily?: DailyScheduleConfig[];
|
|
2588
|
+
special?: SpecialScheduleConfig[];
|
|
2589
|
+
}
|
|
2590
|
+
interface EnhancedDate extends DateTime {
|
|
2591
|
+
schedule: Schedule;
|
|
2592
|
+
schoolDay: boolean;
|
|
2593
|
+
spring: boolean;
|
|
2594
|
+
summer: boolean;
|
|
2595
|
+
autumn: boolean;
|
|
2596
|
+
winter: boolean;
|
|
2597
|
+
dawn: boolean;
|
|
2598
|
+
daytime: boolean;
|
|
2599
|
+
dusk: boolean;
|
|
2600
|
+
night: boolean;
|
|
2601
|
+
weekEnd: boolean;
|
|
2602
|
+
isAt(time: ScheduleTime): boolean;
|
|
2603
|
+
isAfter(time: ScheduleTime): boolean;
|
|
2604
|
+
isBefore(time: ScheduleTime): boolean;
|
|
2605
|
+
isBetween(start: ScheduleTime, end: ScheduleTime): boolean;
|
|
2606
|
+
isHour(...hours: number[]): boolean;
|
|
2607
|
+
isHourBetween(start: number, end: number): boolean;
|
|
2608
|
+
isMinuteBetween(start: number, end: number): boolean;
|
|
2609
|
+
[key: string]: any;
|
|
2610
|
+
}
|
|
2611
|
+
declare class Schedule {
|
|
2612
|
+
daily: string[];
|
|
2613
|
+
specials: SpecialSchedule[];
|
|
2614
|
+
sortedSpecials: SpecialSchedule[] | null;
|
|
2615
|
+
at(scheduleConfig: ScheduleTime, location: string): this;
|
|
2616
|
+
when(condition: ScheduleCondition, location: ScheduleLocation, options?: Partial<Omit<SpecialSchedule, 'condition' | 'location'>>): this;
|
|
2617
|
+
update(specialId: string | number, updates: Partial<Omit<SpecialSchedule, 'id'>>): this;
|
|
2618
|
+
remove(specialId: string | number): this;
|
|
2619
|
+
sortSpecials(): void;
|
|
2620
|
+
topologicalSort(items: SpecialSchedule[]): SpecialSchedule[];
|
|
2621
|
+
get location(): string;
|
|
2622
|
+
resolveLocation(loc: ScheduleLocation, date: EnhancedDate): string;
|
|
2623
|
+
createEnhancedDate(date: DateTime): EnhancedDate;
|
|
2624
|
+
buildEnhancedDateProto(): EnhancedDate;
|
|
2625
|
+
private dailyLocation;
|
|
2626
|
+
}
|
|
2627
|
+
declare const NPCSchedules: typeof Schedule & {
|
|
2628
|
+
readonly schedules: Map<string, Schedule>;
|
|
2629
|
+
init: (manager: NPCManager) => boolean;
|
|
2630
|
+
set: (npcName: string, config: ScheduleConfig | ScheduleBuilder) => Schedule;
|
|
2631
|
+
get: (npcName: string) => Schedule;
|
|
2632
|
+
update: (npcName: string, specialId: string | number, updates: Partial<Omit<SpecialSchedule, 'id'>>) => Schedule;
|
|
2633
|
+
remove: (npcName: string, specialId: string | number) => Schedule;
|
|
2634
|
+
clear: (npcName: string) => Schedule;
|
|
2635
|
+
clearAll: () => void;
|
|
2636
|
+
readonly npcList: string[];
|
|
2637
|
+
readonly location: Record<string, string>;
|
|
2638
|
+
};
|
|
2639
|
+
//#endregion
|
|
2640
|
+
//#region src/modules/NamedNPCAddon/NPCClothes/NPCOutfitSets.d.ts
|
|
2641
|
+
interface OutfitPartConfig {
|
|
2642
|
+
name: string;
|
|
2643
|
+
integrity_max?: number;
|
|
2644
|
+
word?: string;
|
|
2645
|
+
action?: string;
|
|
2646
|
+
readonly desc?: string;
|
|
2647
|
+
}
|
|
2648
|
+
interface OutfitSetConfig {
|
|
2649
|
+
name: string;
|
|
2650
|
+
type?: string;
|
|
2651
|
+
gender?: string;
|
|
2652
|
+
outfit?: number;
|
|
2653
|
+
upper: string | OutfitPartConfig;
|
|
2654
|
+
lower: string | OutfitPartConfig;
|
|
2655
|
+
desc?: string;
|
|
2656
|
+
}
|
|
2657
|
+
interface OutfitSet {
|
|
2658
|
+
name: string;
|
|
2659
|
+
type: string;
|
|
2660
|
+
gender: string;
|
|
2661
|
+
outfit: number;
|
|
2662
|
+
clothes: {
|
|
2663
|
+
upper: Required<OutfitPartConfig>;
|
|
2664
|
+
lower: Required<OutfitPartConfig>;
|
|
2665
|
+
};
|
|
2666
|
+
desc: string;
|
|
2667
|
+
}
|
|
2668
|
+
declare class NPCOutfitSets {
|
|
2669
|
+
private readonly manager;
|
|
2670
|
+
constructor(manager: NPCManager);
|
|
2671
|
+
init(): void;
|
|
2672
|
+
add(...configs: OutfitSetConfig[]): void;
|
|
2673
|
+
get data(): OutfitSet[];
|
|
2674
|
+
private create;
|
|
2675
|
+
private createPart;
|
|
2676
|
+
}
|
|
2677
|
+
//#endregion
|
|
2678
|
+
//#region src/modules/NamedNPCAddon/NPCClothes/NPCSidebarArt.d.ts
|
|
2679
|
+
interface ResolvedArtLayer {
|
|
2680
|
+
zIndex: number | string;
|
|
2681
|
+
img: string;
|
|
2682
|
+
}
|
|
2683
|
+
type ArtPart = 'head' | 'face' | 'neck' | 'upper' | 'lower' | 'legs' | 'feet' | 'hands';
|
|
2684
|
+
interface ResolvedArt {
|
|
2685
|
+
key: string;
|
|
2686
|
+
body: string;
|
|
2687
|
+
parts: Partial<Record<ArtPart, ResolvedArtLayer>>;
|
|
2688
|
+
}
|
|
2689
|
+
declare class NPCSidebarArt {
|
|
2690
|
+
private readonly manager;
|
|
2691
|
+
private readonly configs;
|
|
2692
|
+
constructor(manager: NPCManager);
|
|
2693
|
+
import(modName: string, modZip: ModZipReader, filePaths: string | string[]): Promise<string[]>;
|
|
2694
|
+
has(npcName: string, key: string): boolean;
|
|
2695
|
+
keys(npcName: string): string[];
|
|
2696
|
+
get(npcName: string, key: string): ResolvedArt | undefined;
|
|
2697
|
+
get layers(): Map<string, Map<string, ResolvedArt>>;
|
|
2698
|
+
private setConfig;
|
|
2699
|
+
private resolve;
|
|
2700
|
+
}
|
|
2701
|
+
//#endregion
|
|
2702
|
+
//#region src/modules/NamedNPCAddon/NPCClothes/Condition.d.ts
|
|
2703
|
+
type Condition = boolean | string | (() => boolean) | Condition[];
|
|
2704
|
+
//#endregion
|
|
2705
|
+
//#region src/modules/NamedNPCAddon/NPCClothes/NPCSidebarWardrobe.d.ts
|
|
2706
|
+
interface WardrobeItem {
|
|
2707
|
+
[part: string]: any;
|
|
2708
|
+
}
|
|
2709
|
+
interface WardrobeContext {
|
|
2710
|
+
npcName: string;
|
|
2711
|
+
location: string;
|
|
2712
|
+
key: string;
|
|
2713
|
+
}
|
|
2714
|
+
type WardrobeModifier = (clothes: WardrobeItem, context: WardrobeContext) => void;
|
|
2715
|
+
declare class NPCSidebarWardrobe {
|
|
2716
|
+
private readonly manager;
|
|
2717
|
+
private readonly templates;
|
|
2718
|
+
private readonly profiles;
|
|
2719
|
+
constructor(manager: NPCManager);
|
|
2720
|
+
init(): void;
|
|
2721
|
+
load(modName: string, filePath: string): Promise<void>;
|
|
2722
|
+
wear(npcName: string, location: string, key: string, cond?: Condition): void;
|
|
2723
|
+
modify(npcName: string, modifier: WardrobeModifier): void;
|
|
2724
|
+
worn(npcName: string): WardrobeItem;
|
|
2725
|
+
private add;
|
|
2726
|
+
private resolve;
|
|
2727
|
+
private select;
|
|
2728
|
+
private find;
|
|
2729
|
+
private profile;
|
|
2730
|
+
private location;
|
|
2731
|
+
}
|
|
2732
|
+
//#endregion
|
|
2733
|
+
//#region src/modules/NamedNPCAddon/NPCClothes.d.ts
|
|
2734
|
+
declare class NPCClothes {
|
|
2735
|
+
readonly outfitSets: NPCOutfitSets;
|
|
2736
|
+
readonly art: NPCSidebarArt;
|
|
2737
|
+
readonly wardrobe: NPCSidebarWardrobe;
|
|
2738
|
+
constructor(manager: NPCManager);
|
|
2739
|
+
init(): void;
|
|
2740
|
+
}
|
|
2741
|
+
//#endregion
|
|
2742
|
+
//#region src/modules/NamedNPCAddon/NPCSidebar.d.ts
|
|
2743
|
+
interface NPCSidebarBootConfig {
|
|
2744
|
+
clothes?: string[];
|
|
2745
|
+
image?: string[];
|
|
2746
|
+
config?: string[];
|
|
2747
|
+
}
|
|
2748
|
+
declare function config(manager: NPCManager, modName: string, modZip: ModZipReader, config: NPCSidebarBootConfig): Promise<void>;
|
|
2749
|
+
declare function loadFromMod(modZip: ModZipReader, npcNames: string[]): string[];
|
|
2750
|
+
declare const NPCSidebar: {
|
|
2751
|
+
new (): {};
|
|
2752
|
+
get display(): Map<string, Set<string>>;
|
|
2753
|
+
config: typeof config;
|
|
2754
|
+
loadFromMod: typeof loadFromMod;
|
|
2755
|
+
hair_type(type: 'sides' | 'fringe'): Record<string, string>;
|
|
2756
|
+
init(manager: NPCManager): void;
|
|
2757
|
+
};
|
|
2758
|
+
//#endregion
|
|
2759
|
+
//#region src/modules/NamedNPCAddon/NPCFluids.d.ts
|
|
2760
|
+
type NPCFluidPart = 'vagina' | 'anus' | 'mouth' | 'chest' | 'face' | 'feet' | 'leftarm' | 'rightarm' | 'neck' | 'thigh' | 'tummy';
|
|
2761
|
+
type NPCFluidData = Record<NPCFluidPart, number>;
|
|
2762
|
+
declare class NPCFluids {
|
|
2763
|
+
readonly parts: NPCFluidPart[];
|
|
2764
|
+
ensure(npcName: string): NPCFluidData;
|
|
2765
|
+
get(npcName: string): NPCFluidData;
|
|
2766
|
+
set(npcName: string, part: NPCFluidPart, value: number): NPCFluidData;
|
|
2767
|
+
add(npcName: string, part: NPCFluidPart, value?: number): NPCFluidData;
|
|
2768
|
+
reduce(npcName: string, part: NPCFluidPart, value?: number): NPCFluidData;
|
|
2769
|
+
clear(npcName: string, part?: NPCFluidPart): NPCFluidData;
|
|
2770
|
+
decay(value?: number): void;
|
|
2771
|
+
apply(nnpc: Record<string, any>, npcData: any): void;
|
|
2772
|
+
}
|
|
2773
|
+
//#endregion
|
|
2774
|
+
//#region src/modules/NamedNPCAddon/NPCTransformation.d.ts
|
|
2775
|
+
interface NPCTransformationState {
|
|
2776
|
+
build: number;
|
|
2777
|
+
level: number;
|
|
2778
|
+
}
|
|
2779
|
+
interface NPCTransformationConfig {
|
|
2780
|
+
levels?: number[];
|
|
2781
|
+
type?: string;
|
|
2782
|
+
pregnancy?: string;
|
|
2783
|
+
body?: (bodydata: Record<string, any>, state: NPCTransformationState, npcName: string) => void;
|
|
2784
|
+
sidebar?: (nnpc: Record<string, any>, state: NPCTransformationState, npcName: string) => void;
|
|
2785
|
+
layers?: CanvasLayerMap;
|
|
2786
|
+
}
|
|
2787
|
+
declare class NPCTransformation {
|
|
2788
|
+
private readonly manager;
|
|
2789
|
+
private readonly configs;
|
|
2790
|
+
constructor(manager: NPCManager);
|
|
2791
|
+
add(type: string, config?: NPCTransformationConfig): this;
|
|
2792
|
+
ensure(npcName: string, type?: string): Record<string, NPCTransformationState>;
|
|
2793
|
+
get(npcName: string, type: string): NPCTransformationState;
|
|
2794
|
+
build(npcName: string, type: string, value: number): NPCTransformationState;
|
|
2795
|
+
set(npcName: string, type: string, level: number): NPCTransformationState;
|
|
2796
|
+
clear(npcName: string, type?: string): void;
|
|
2797
|
+
level(npcName: string, type: string): number;
|
|
2798
|
+
type(npcName: string): string;
|
|
2799
|
+
pregnancyType(npcName: string): string;
|
|
2800
|
+
applyBody(nnpc: Record<string, any>, npcData: any): void;
|
|
2801
|
+
applySidebar(nnpc: Record<string, any>): void;
|
|
2802
|
+
private active;
|
|
2803
|
+
}
|
|
2804
|
+
//#endregion
|
|
2805
|
+
//#region src/modules/NamedNPC.d.ts
|
|
2806
|
+
type PronounCode = 'm' | 'f' | 'i' | 'n' | 't';
|
|
2807
|
+
type TranslationInput = Map<string, Translation> | Record<string, Translation>;
|
|
2808
|
+
interface NPCData {
|
|
2809
|
+
nam: string;
|
|
2810
|
+
gender?: 'm' | 'f' | 'h' | 'n' | 'none';
|
|
2811
|
+
pronoun?: PronounCode;
|
|
2812
|
+
title?: string;
|
|
2813
|
+
description?: string;
|
|
2814
|
+
type?: string;
|
|
2815
|
+
adult?: number;
|
|
2816
|
+
teen?: number;
|
|
2817
|
+
age?: number;
|
|
2818
|
+
insecurity?: string;
|
|
2819
|
+
chastity?: {
|
|
2820
|
+
penis: string;
|
|
2821
|
+
vagina: string;
|
|
2822
|
+
anus: string;
|
|
2823
|
+
};
|
|
2824
|
+
virginity?: Record<string, boolean>;
|
|
2825
|
+
hair_side_type?: string;
|
|
2826
|
+
hair_fringe_type?: string;
|
|
2827
|
+
hair_position?: string;
|
|
2828
|
+
hairlength?: number;
|
|
2829
|
+
eyeColour?: string;
|
|
2830
|
+
hairColour?: string;
|
|
2831
|
+
bottomsize?: number;
|
|
2832
|
+
skincolour?: number;
|
|
2833
|
+
init?: number;
|
|
2834
|
+
intro?: number;
|
|
2835
|
+
penis?: string;
|
|
2836
|
+
penissize?: number;
|
|
2837
|
+
penisdesc?: string;
|
|
2838
|
+
vagina?: string;
|
|
2839
|
+
breastsize?: number;
|
|
2840
|
+
breastdesc?: string;
|
|
2841
|
+
ballssize?: number;
|
|
2842
|
+
outfits?: string[];
|
|
2843
|
+
pregnancy?: any;
|
|
2844
|
+
pregnancyAvoidance?: number;
|
|
2845
|
+
[key: string]: any;
|
|
2846
|
+
}
|
|
2847
|
+
interface NPCConfig {
|
|
2848
|
+
love?: {
|
|
2849
|
+
maxValue: number;
|
|
2850
|
+
};
|
|
2851
|
+
loveAlias?: [string, string] | (() => string | [string, string]);
|
|
2852
|
+
important?: boolean | (() => boolean);
|
|
2853
|
+
special?: boolean | (() => boolean);
|
|
2854
|
+
loveInterest?: boolean | (() => boolean);
|
|
2855
|
+
romance?: (() => boolean)[];
|
|
2856
|
+
[key: string]: any;
|
|
2857
|
+
}
|
|
2858
|
+
declare const NamedNPC: {
|
|
2859
|
+
new (
|
|
2860
|
+
manager: NPCManager,
|
|
2861
|
+
data: NPCData
|
|
2862
|
+
): {
|
|
2863
|
+
nam: string;
|
|
2864
|
+
gender: 'm' | 'f' | 'h' | 'n' | 'none';
|
|
2865
|
+
title: string;
|
|
2866
|
+
description: string;
|
|
2867
|
+
type: string;
|
|
2868
|
+
adult: number;
|
|
2869
|
+
teen: number;
|
|
2870
|
+
age: number;
|
|
2871
|
+
insecurity: string;
|
|
2872
|
+
chastity: {
|
|
2873
|
+
penis: string;
|
|
2874
|
+
vagina: string;
|
|
2875
|
+
anus: string;
|
|
2876
|
+
};
|
|
2877
|
+
virginity: Record<string, boolean>;
|
|
2878
|
+
hair_side_type: string;
|
|
2879
|
+
hair_fringe_type: string;
|
|
2880
|
+
hair_position: string;
|
|
2881
|
+
hairlength: number;
|
|
2882
|
+
eyeColour: string;
|
|
2883
|
+
hairColour: string;
|
|
2884
|
+
pronoun: PronounCode;
|
|
2885
|
+
pronouns: Record<string, string>;
|
|
2886
|
+
bottomsize: number;
|
|
2887
|
+
skincolour: number;
|
|
2888
|
+
init: number;
|
|
2889
|
+
intro: number;
|
|
2890
|
+
penis: string;
|
|
2891
|
+
penissize: number;
|
|
2892
|
+
penisdesc: string;
|
|
2893
|
+
vagina: string;
|
|
2894
|
+
breastsize: number;
|
|
2895
|
+
breastdesc: string;
|
|
2896
|
+
breastsdesc: string;
|
|
2897
|
+
bottomdesc: string;
|
|
2898
|
+
ballsdesc: string;
|
|
2899
|
+
ballssize: number;
|
|
2900
|
+
outfits: string[];
|
|
2901
|
+
pregnancy: any;
|
|
2902
|
+
pregnancyAvoidance?: number;
|
|
2903
|
+
descCache: Record<string, any>;
|
|
2904
|
+
setPronouns(): void;
|
|
2905
|
+
setBodyTraits(data: NPCData): void;
|
|
2906
|
+
bodyPartdescription(): void;
|
|
2907
|
+
};
|
|
2908
|
+
} & {
|
|
2909
|
+
add: (manager: NPCManager, npcData: NPCData, config?: NPCConfig, translationsData?: TranslationInput) => boolean;
|
|
2910
|
+
get: (manager: NPCManager) => string[];
|
|
2911
|
+
clear: (manager: NPCManager) => boolean;
|
|
2912
|
+
update: (manager: NPCManager) => boolean;
|
|
2913
|
+
setup: (manager: NPCManager) => void;
|
|
2914
|
+
convert: (manager: NPCManager) => void;
|
|
2915
|
+
};
|
|
2916
|
+
declare class NPCManager {
|
|
2917
|
+
readonly core: MaplebirchCore;
|
|
2918
|
+
readonly log: ReturnType<typeof createlog>;
|
|
2919
|
+
readonly data: Map<string, any>;
|
|
2920
|
+
NPCNameList: string[];
|
|
2921
|
+
readonly Transformation: NPCTransformation;
|
|
2922
|
+
readonly type: {
|
|
2923
|
+
[x: string]: Array<string>;
|
|
2924
|
+
};
|
|
2925
|
+
readonly customStats: {
|
|
2926
|
+
[x: string]: any;
|
|
2927
|
+
};
|
|
2928
|
+
readonly romanceConditions: {
|
|
2929
|
+
[key: string]: (() => boolean)[];
|
|
2930
|
+
};
|
|
2931
|
+
readonly NamedNPC: typeof NamedNPC;
|
|
2932
|
+
readonly Schedule: typeof NPCSchedules;
|
|
2933
|
+
readonly Clothes: NPCClothes;
|
|
2934
|
+
readonly Sidebar: typeof NPCSidebar;
|
|
2935
|
+
readonly fluids: NPCFluids;
|
|
2936
|
+
constructor(core: MaplebirchCore);
|
|
2937
|
+
add(npcData: NPCData, config?: NPCConfig, translationsData?: TranslationInput): boolean;
|
|
2938
|
+
addSchedule(npcName: string, config: ScheduleConfig | ScheduleBuilder): Schedule;
|
|
2939
|
+
addStats(statsObject: { [x: string]: any }): void;
|
|
2940
|
+
addClothes(...configs: OutfitSetConfig[]): void;
|
|
2941
|
+
injectModNPCs(): void;
|
|
2942
|
+
vanillaNPCConfig(npcConfig: NPCConfig): any;
|
|
2943
|
+
applyStatDefaults(statDefaults: { [x: string]: any }): {
|
|
2944
|
+
[x: string]: any;
|
|
2945
|
+
};
|
|
2946
|
+
vanillaInit(npcName: string): void;
|
|
2947
|
+
vanillaInject(npcName: string, npcno: number): void;
|
|
2948
|
+
private config;
|
|
2949
|
+
preInit(): void;
|
|
2950
|
+
Init(): void;
|
|
2951
|
+
loadInit(): void;
|
|
2952
|
+
postInit(): void;
|
|
2953
|
+
}
|
|
2954
|
+
//#endregion
|
|
2955
|
+
//#region src/modules/CombatAddon/CombatAction.d.ts
|
|
2956
|
+
type ActionType = 'leftaction' | 'rightaction' | 'feetaction' | 'mouthaction' | 'penisaction' | 'vaginaaction' | 'anusaction' | 'chestaction' | 'thighaction';
|
|
2957
|
+
type CombatType = 'Default' | 'Self' | 'Struggle' | 'Swarm' | 'Vore' | 'Machine' | 'Tentacle';
|
|
2958
|
+
interface Context {
|
|
2959
|
+
actionType?: ActionType;
|
|
2960
|
+
combatType?: CombatType;
|
|
2961
|
+
encounterType?: CombatType;
|
|
2962
|
+
action?: any;
|
|
2963
|
+
originalCount?: number;
|
|
2964
|
+
[key: string]: any;
|
|
2965
|
+
}
|
|
2966
|
+
interface ActionEntry {
|
|
2967
|
+
id: string;
|
|
2968
|
+
actionType: ActionType;
|
|
2969
|
+
cond: (ctx: Context) => boolean;
|
|
2970
|
+
display: (ctx: Context) => string;
|
|
2971
|
+
value: (ctx: Context) => any;
|
|
2972
|
+
color: (ctx: Context) => string;
|
|
2973
|
+
difficulty: (ctx: Context) => string;
|
|
2974
|
+
effect: (ctx: Context) => string;
|
|
2975
|
+
combatType: (ctx: Context) => CombatType;
|
|
2976
|
+
order: (ctx: Context) => number;
|
|
2977
|
+
}
|
|
2978
|
+
interface ActionConfig {
|
|
2979
|
+
id: string;
|
|
2980
|
+
actionType: ActionType | ActionType[];
|
|
2981
|
+
cond: (ctx: Context) => boolean;
|
|
2982
|
+
display: (ctx: Context) => string;
|
|
2983
|
+
value: (ctx: Context) => any;
|
|
2984
|
+
color?: string | ((ctx: Context) => string);
|
|
2985
|
+
difficulty?: string | ((ctx: Context) => string);
|
|
2986
|
+
effect?: string | ((ctx: Context) => string);
|
|
2987
|
+
combatType?: CombatType | ((ctx: Context) => CombatType);
|
|
2988
|
+
order?: number | ((ctx: Context) => number);
|
|
2989
|
+
}
|
|
2990
|
+
interface OptionsTable {
|
|
2991
|
+
[key: string]: any;
|
|
2992
|
+
}
|
|
2993
|
+
declare class CombatActions {
|
|
2994
|
+
readonly actions: ActionEntry[];
|
|
2995
|
+
reg(...configs: ActionConfig[]): this;
|
|
2996
|
+
private eval;
|
|
2997
|
+
patchOptions(optionsTable: OptionsTable, actionType: ActionType, combatType?: CombatType): OptionsTable;
|
|
2998
|
+
color(action: any, encounterType?: CombatType): string | null;
|
|
2999
|
+
difficulty(action: any, combatType?: CombatType): string | null;
|
|
3000
|
+
effect(...actionTypes: ActionType[]): string;
|
|
3001
|
+
}
|
|
3002
|
+
//#endregion
|
|
3003
|
+
//#region src/modules/Combat.d.ts
|
|
3004
|
+
declare class CombatManager {
|
|
3005
|
+
readonly core: MaplebirchCore;
|
|
3006
|
+
readonly log: ReturnType<typeof createlog>;
|
|
3007
|
+
readonly CombatAction: CombatActions;
|
|
3008
|
+
constructor(core: MaplebirchCore);
|
|
3009
|
+
private _generateCombatAction;
|
|
3010
|
+
private _combatListColor;
|
|
3011
|
+
private _combatButtonAdjustments;
|
|
3012
|
+
Init(): void;
|
|
3013
|
+
}
|
|
3014
|
+
//#endregion
|
|
3015
|
+
//#region src/core.d.ts
|
|
3016
|
+
interface Extensions {}
|
|
3017
|
+
type Instance = MaplebirchCore & Extensions;
|
|
3018
|
+
declare class MaplebirchCore {
|
|
3019
|
+
static meta: {
|
|
3020
|
+
name: 'maplebirch Frameworks';
|
|
3021
|
+
author: string;
|
|
3022
|
+
version: string;
|
|
3023
|
+
modifiedby: string;
|
|
3024
|
+
updateDate: string;
|
|
3025
|
+
Languages: typeof Languages;
|
|
3026
|
+
early: readonly string[];
|
|
3027
|
+
core: readonly string[];
|
|
3028
|
+
protected: readonly string[];
|
|
3029
|
+
};
|
|
3030
|
+
readonly meta: typeof MaplebirchCore.meta;
|
|
3031
|
+
readonly utils: Readonly<{
|
|
3032
|
+
clone: typeof clone;
|
|
3033
|
+
equal: typeof equal;
|
|
3034
|
+
merge: typeof merge;
|
|
3035
|
+
append: typeof append;
|
|
3036
|
+
cover: typeof cover;
|
|
3037
|
+
mergefn: typeof mergeFn;
|
|
3038
|
+
appendfn: typeof appendFn;
|
|
3039
|
+
coverfn: typeof coverFn;
|
|
3040
|
+
contains: typeof contains;
|
|
3041
|
+
random: typeof randomNumber;
|
|
3042
|
+
either: typeof randomPick;
|
|
3043
|
+
SelectCase: typeof SelectCase;
|
|
3044
|
+
convert: typeof convert;
|
|
3045
|
+
clamp: typeof clamp;
|
|
3046
|
+
loadImage: typeof loadImage;
|
|
3047
|
+
}>;
|
|
3048
|
+
modList: string[];
|
|
3049
|
+
readonly manager: {
|
|
3050
|
+
modSC2DataManager: SC2DataManager;
|
|
3051
|
+
modLoaderGui: Gui;
|
|
3052
|
+
};
|
|
3053
|
+
passage: any;
|
|
3054
|
+
readonly yaml: typeof jsyaml;
|
|
3055
|
+
readonly howler: {
|
|
3056
|
+
Howl: typeof Howl;
|
|
3057
|
+
Howler: typeof Howler;
|
|
3058
|
+
};
|
|
3059
|
+
readonly logger: Logger;
|
|
3060
|
+
readonly tracer: EventEmitter;
|
|
3061
|
+
readonly idb: IndexedDBService;
|
|
3062
|
+
readonly credential: CredentialVault;
|
|
3063
|
+
readonly cloudSave: CloudSaveService;
|
|
3064
|
+
readonly lang: LanguageManager;
|
|
3065
|
+
readonly modules: ModuleSystem;
|
|
3066
|
+
readonly gui: GUIControl;
|
|
3067
|
+
readonly addon: AddonPlugin;
|
|
3068
|
+
readonly dynamic: DynamicManager;
|
|
3069
|
+
readonly tool: ToolCollection;
|
|
3070
|
+
readonly audio: AudioManager;
|
|
3071
|
+
readonly var: Variables;
|
|
3072
|
+
readonly char: Character;
|
|
3073
|
+
readonly npc: NPCManager;
|
|
3074
|
+
readonly combat: CombatManager;
|
|
3075
|
+
constructor(modSC2DataManager: SC2DataManager, modLoaderGui: Gui);
|
|
3076
|
+
log(msg: string, level?: string, ...objs: any[]): void;
|
|
3077
|
+
on(eventName: string, callback: (...args: any[]) => any, description?: string): boolean;
|
|
3078
|
+
off(eventName: string, identifier: string | ((...args: any[]) => any)): boolean;
|
|
3079
|
+
once(eventName: string, callback: (...args: any[]) => any, description?: string): boolean;
|
|
3080
|
+
after(eventName: string, callback: (...args: any[]) => any): void;
|
|
3081
|
+
trigger(evt: string, ...args: any[]): Promise<void>;
|
|
3082
|
+
register(name: string, module: any, dependencies?: string[]): boolean;
|
|
3083
|
+
t(key: string, space?: boolean): string;
|
|
3084
|
+
auto(text: string): string;
|
|
3085
|
+
disabled(modNames: string | string[], reload?: boolean): Promise<boolean>;
|
|
3086
|
+
get lodash(): ReturnType<ModUtils['getLodash']>;
|
|
3087
|
+
get marked(): typeof marked;
|
|
3088
|
+
set SugarCube(parts: TwineSugarCube);
|
|
3089
|
+
get SugarCube(): TwineSugarCube;
|
|
3090
|
+
set Language(lang: string);
|
|
3091
|
+
get Language(): string;
|
|
3092
|
+
set LogLevel(level: string);
|
|
3093
|
+
get LogLevel(): string;
|
|
3094
|
+
get(name: string): any;
|
|
3095
|
+
get dependencyGraph(): any;
|
|
3096
|
+
get modLoader(): ReturnType<SC2DataManager['getModLoader']>;
|
|
3097
|
+
get modUtils(): ModUtils;
|
|
3098
|
+
get gameVersion(): string;
|
|
3099
|
+
}
|
|
3100
|
+
declare var maplebirch: Instance;
|
|
3101
|
+
declare function createlog(prefix: string): (message: string, level?: string, ...objects: any[]) => void;
|
|
3102
|
+
//#endregion
|
|
3103
|
+
//#region src/services/CredentialVault.d.ts
|
|
3104
|
+
type CredentialPeriod = 'day' | 'month';
|
|
3105
|
+
interface AuthConfig {
|
|
3106
|
+
key: string;
|
|
3107
|
+
subject?: string;
|
|
3108
|
+
name?: string;
|
|
3109
|
+
publicKey: JsonWebKey | string;
|
|
3110
|
+
prompt?: {
|
|
3111
|
+
title?: string;
|
|
3112
|
+
label?: string;
|
|
3113
|
+
placeholder?: string;
|
|
3114
|
+
hint?: string;
|
|
3115
|
+
};
|
|
3116
|
+
date?: {
|
|
3117
|
+
period?: CredentialPeriod;
|
|
3118
|
+
timezone?: string;
|
|
3119
|
+
graceDays?: number;
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3122
|
+
interface AuthPayload {
|
|
3123
|
+
subject: string;
|
|
3124
|
+
key: string;
|
|
3125
|
+
date?: string;
|
|
3126
|
+
password: string;
|
|
3127
|
+
expiresAt?: number;
|
|
3128
|
+
}
|
|
3129
|
+
interface CryptContext {
|
|
3130
|
+
modName: string;
|
|
3131
|
+
credential?: string;
|
|
3132
|
+
payload?: AuthPayload;
|
|
3133
|
+
}
|
|
3134
|
+
interface CryptResult {
|
|
3135
|
+
data: any;
|
|
3136
|
+
auth?: AuthConfig | boolean | void;
|
|
3137
|
+
}
|
|
3138
|
+
interface CryptOptions {
|
|
3139
|
+
modName?: string;
|
|
3140
|
+
cache?: {
|
|
3141
|
+
subject: string;
|
|
3142
|
+
key: string;
|
|
3143
|
+
};
|
|
3144
|
+
password?: string;
|
|
3145
|
+
prompt?: AuthConfig['prompt'] & {
|
|
3146
|
+
name?: string;
|
|
3147
|
+
};
|
|
3148
|
+
lazyOptions?: any;
|
|
3149
|
+
decrypt(password: string, context: CryptContext): Promise<CryptResult | Uint8Array | ArrayBuffer | Blob | string>;
|
|
3150
|
+
}
|
|
3151
|
+
declare class CredentialVault {
|
|
3152
|
+
readonly core: MaplebirchCore;
|
|
3153
|
+
private static readonly STORE;
|
|
3154
|
+
private static readonly TOKEN_PREFIX;
|
|
3155
|
+
private dialogQueue;
|
|
3156
|
+
private storageKey;
|
|
3157
|
+
constructor(core: MaplebirchCore);
|
|
3158
|
+
loadCrypt(options: CryptOptions): Promise<boolean>;
|
|
3159
|
+
private loadCredential;
|
|
3160
|
+
private decryptAndLoad;
|
|
3161
|
+
private decodeCredential;
|
|
3162
|
+
private verify;
|
|
3163
|
+
private credentialDate;
|
|
3164
|
+
private readStored;
|
|
3165
|
+
private storeStored;
|
|
3166
|
+
private forget;
|
|
3167
|
+
private ensurePromptStyle;
|
|
3168
|
+
private promptCredential;
|
|
3169
|
+
private ensureStorageKey;
|
|
3170
|
+
private loadStorageKey;
|
|
3171
|
+
private encryptRecord;
|
|
3172
|
+
private decryptRecord;
|
|
3173
|
+
}
|
|
3174
|
+
//#endregion
|
|
3175
|
+
//#region src/utils/twine.d.ts
|
|
3176
|
+
type Replacement = [RegExp, string];
|
|
3177
|
+
declare function replace(content: string, replacements: Replacement[], label?: string): string;
|
|
3178
|
+
//#endregion
|
|
3179
|
+
//#region src/modules/AddonPlugin.d.ts
|
|
3180
|
+
interface FileItem {
|
|
3181
|
+
modName: string;
|
|
3182
|
+
filePath: string;
|
|
3183
|
+
content: string;
|
|
3184
|
+
}
|
|
3185
|
+
interface BootTask<T = unknown> {
|
|
3186
|
+
modName: string;
|
|
3187
|
+
modInfo: ModInfo;
|
|
3188
|
+
modZip: ModZipReader;
|
|
3189
|
+
config: T;
|
|
3190
|
+
}
|
|
3191
|
+
type BootHandler<T = unknown> = (task: BootTask<T>) => void | Promise<void>;
|
|
3192
|
+
declare class AddonPlugin {
|
|
3193
|
+
readonly core: MaplebirchCore;
|
|
3194
|
+
onStart: boolean;
|
|
3195
|
+
readonly replace: typeof replace;
|
|
3196
|
+
readonly SC2DataManager: SC2DataManager;
|
|
3197
|
+
readonly modUtils: ModUtils;
|
|
3198
|
+
readonly info: Map<
|
|
3199
|
+
string,
|
|
3200
|
+
{
|
|
3201
|
+
addonName: string;
|
|
3202
|
+
mod: ModInfo;
|
|
3203
|
+
modZip: ModZipReader;
|
|
3204
|
+
}
|
|
3205
|
+
>;
|
|
3206
|
+
readonly log: ReturnType<typeof createlog>;
|
|
3207
|
+
readonly jsFiles: FileItem[];
|
|
3208
|
+
readonly moduleFiles: FileItem[];
|
|
3209
|
+
private readonly disabledMods;
|
|
3210
|
+
private readonly blockedPassages;
|
|
3211
|
+
private readonly bootHooks;
|
|
3212
|
+
private readonly bootQueue;
|
|
3213
|
+
private onSaveLoadTracer;
|
|
3214
|
+
private moduleFilesExecuted;
|
|
3215
|
+
private scriptFilesExecuted;
|
|
3216
|
+
private bootReady;
|
|
3217
|
+
constructor(core: MaplebirchCore);
|
|
3218
|
+
hook<T>(name: string, handler: BootHandler<T>): boolean;
|
|
3219
|
+
canLoadThisMod(bootJson: ModBootJson, _zip: JSZipLikeReadOnlyInterface): Promise<boolean>;
|
|
3220
|
+
afterInjectEarlyLoad(): Promise<void>;
|
|
3221
|
+
ModLoaderLoadEnd(): Promise<void>;
|
|
3222
|
+
afterEarlyLoad(): Promise<void>;
|
|
3223
|
+
registerMod(addonName: string, modInfo: ModInfo, modZip: ModZipReader): Promise<void>;
|
|
3224
|
+
afterRegisterMod2Addon(): Promise<void>;
|
|
3225
|
+
beforePatchModToGame(): Promise<void>;
|
|
3226
|
+
PatchModToGame_start(): Promise<void>;
|
|
3227
|
+
afterPatchModToGame(): Promise<void>;
|
|
3228
|
+
afterPreload(): Promise<void>;
|
|
3229
|
+
whenSC2StoryReady(): Promise<void>;
|
|
3230
|
+
whenSC2PassageInit(passage: Passage): Promise<void>;
|
|
3231
|
+
whenSC2PassageStart(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
3232
|
+
whenSC2PassageRender(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
3233
|
+
whenSC2PassageDisplay(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
3234
|
+
whenSC2PassageEnd(passage: Passage, content: HTMLDivElement): Promise<void>;
|
|
3235
|
+
loadCrypt(options: CryptOptions): Promise<boolean>;
|
|
3236
|
+
private scriptFiles;
|
|
3237
|
+
private dataReplace;
|
|
3238
|
+
private loadFiles;
|
|
3239
|
+
private executeScripts;
|
|
3240
|
+
private process;
|
|
3241
|
+
private queue;
|
|
3242
|
+
private flush;
|
|
3243
|
+
private run;
|
|
3244
|
+
private config;
|
|
3245
|
+
private modifyOptionsDateFormat;
|
|
3246
|
+
private saveHandle;
|
|
3247
|
+
private error;
|
|
3248
|
+
}
|
|
3249
|
+
//#endregion
|
|
3250
|
+
export { type Extensions, type MaplebirchCore, maplebirch as default, index_d_exports as utils };
|