@scml/sc2-verlnir 1.0.4
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/package.json +30 -0
- package/src/alert.d.ts +4 -0
- package/src/browser.d.ts +10 -0
- package/src/config.d.ts +74 -0
- package/src/debugbar.d.ts +25 -0
- package/src/dialog.d.ts +15 -0
- package/src/engine.d.ts +36 -0
- package/src/fullscreen.d.ts +13 -0
- package/src/global.d.ts +116 -0
- package/src/has.d.ts +10 -0
- package/src/idb.d.ts +34 -0
- package/src/index.d.ts +30 -0
- package/src/jquery-shim.d.ts +37 -0
- package/src/l10n.d.ts +4 -0
- package/src/links.d.ts +15 -0
- package/src/loadscreen.d.ts +8 -0
- package/src/macro.d.ts +31 -0
- package/src/passage.d.ts +25 -0
- package/src/save.d.ts +61 -0
- package/src/scripting.d.ts +5 -0
- package/src/setting.d.ts +29 -0
- package/src/simpleaudio.d.ts +38 -0
- package/src/simplestore.d.ts +20 -0
- package/src/state.d.ts +111 -0
- package/src/story.d.ts +24 -0
- package/src/template.d.ts +7 -0
- package/src/ui.d.ts +39 -0
- package/src/uibar.d.ts +18 -0
- package/src/util.d.ts +28 -0
- package/src/version.d.ts +16 -0
- package/src/visibility.d.ts +9 -0
- package/src/wikifier.d.ts +40 -0
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scml/sc2-verlnir",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "TypeScript type definitions for SugarCube 2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"private": false,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Rikka",
|
|
10
|
+
"email": "admin@rikka.cc",
|
|
11
|
+
"url": "https://github.com/Muromi-Rikka"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/Muromi-Rikka/scml-types.git",
|
|
16
|
+
"directory": "packages/sugarcube-2-verlnir"
|
|
17
|
+
},
|
|
18
|
+
"files": ["src", "README.md"],
|
|
19
|
+
"types": "./src/global.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./src/global.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"publint": "publint"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/jquery": "*"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/alert.d.ts
ADDED
package/src/browser.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface BrowserAPI {
|
|
2
|
+
readonly userAgent: string;
|
|
3
|
+
readonly isMobile: boolean;
|
|
4
|
+
readonly isGecko: boolean;
|
|
5
|
+
readonly isIE: boolean;
|
|
6
|
+
readonly ieVersion: number | null;
|
|
7
|
+
readonly isOpera: boolean;
|
|
8
|
+
readonly operaVersion: number | null;
|
|
9
|
+
readonly isVivaldi: boolean;
|
|
10
|
+
}
|
package/src/config.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Object Exports.
|
|
3
|
+
General settings.
|
|
4
|
+
Audio settings.
|
|
5
|
+
State history settings.
|
|
6
|
+
Macros settings.
|
|
7
|
+
Navigation settings.
|
|
8
|
+
Passages settings.
|
|
9
|
+
Saves settings.
|
|
10
|
+
UI settings.
|
|
11
|
+
*/
|
|
12
|
+
export interface ConfigHistoryAPI {
|
|
13
|
+
controls: boolean;
|
|
14
|
+
maxStates: number;
|
|
15
|
+
maxSessionStates: number;
|
|
16
|
+
maxExpired: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ConfigAudioAPI {
|
|
20
|
+
pauseOnFadeToZero: boolean;
|
|
21
|
+
preloadMetadata: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ConfigMacrosAPI {
|
|
25
|
+
ifAssignmentError: boolean;
|
|
26
|
+
maxLoopIterations: number;
|
|
27
|
+
typeSkipKey: string;
|
|
28
|
+
typeVisitedPassages: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ConfigNavigationAPI {
|
|
32
|
+
override: ((...args: unknown[]) => unknown) | null | undefined;
|
|
33
|
+
gotohell: unknown;
|
|
34
|
+
rememberYPos: unknown;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ConfigPassagesAPI {
|
|
38
|
+
descriptions: boolean | Record<string, string> | ((this: null) => string | undefined) | null | undefined;
|
|
39
|
+
displayTitles: boolean;
|
|
40
|
+
nobr: boolean;
|
|
41
|
+
onProcess: ((opts: { title: string; tags: string[]; text: string }) => string) | null | undefined;
|
|
42
|
+
start: string | null | undefined;
|
|
43
|
+
transitionOut: string | number | null | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ConfigSavesAPI {
|
|
47
|
+
autoload: boolean | string | ((...args: unknown[]) => unknown) | null | undefined;
|
|
48
|
+
autosave: boolean | string[] | ((...args: unknown[]) => unknown) | null | undefined;
|
|
49
|
+
id: string;
|
|
50
|
+
isAllowed: ((...args: unknown[]) => unknown) | null | undefined;
|
|
51
|
+
slots: number;
|
|
52
|
+
tryDiskOnMobile: boolean;
|
|
53
|
+
version: unknown;
|
|
54
|
+
useLZString: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ConfigUIAPI {
|
|
58
|
+
stowBarInitially: boolean | number;
|
|
59
|
+
updateStoryElements: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ConfigAPI {
|
|
63
|
+
debug: boolean;
|
|
64
|
+
addVisitedLinkClass: boolean;
|
|
65
|
+
cleanupWikifierOutput: boolean;
|
|
66
|
+
loadDelay: number;
|
|
67
|
+
audio: ConfigAudioAPI;
|
|
68
|
+
history: ConfigHistoryAPI;
|
|
69
|
+
macros: ConfigMacrosAPI;
|
|
70
|
+
navigation: ConfigNavigationAPI;
|
|
71
|
+
passages: ConfigPassagesAPI;
|
|
72
|
+
saves: ConfigSavesAPI;
|
|
73
|
+
ui: ConfigUIAPI;
|
|
74
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Module Exports.
|
|
3
|
+
Debug Bar Functions.
|
|
4
|
+
Watch Functions.
|
|
5
|
+
*/
|
|
6
|
+
export interface DebugBarWatchAPI {
|
|
7
|
+
add(name: string, getValue: () => unknown): void;
|
|
8
|
+
all(): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
delete(name: string): void;
|
|
11
|
+
disable(name: string): void;
|
|
12
|
+
enable(name: string): void;
|
|
13
|
+
isEnabled(name: string): boolean;
|
|
14
|
+
toggle(name: string): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DebugBarAPI {
|
|
18
|
+
init(): void;
|
|
19
|
+
isStowed(): boolean;
|
|
20
|
+
start(): void;
|
|
21
|
+
stow(): void;
|
|
22
|
+
toggle(): void;
|
|
23
|
+
unstow(): void;
|
|
24
|
+
watch: DebugBarWatchAPI;
|
|
25
|
+
}
|
package/src/dialog.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DialogAPI {
|
|
2
|
+
append(...args: unknown[]): DialogAPI;
|
|
3
|
+
body(): HTMLElement | undefined;
|
|
4
|
+
close(ev?: unknown): DialogAPI;
|
|
5
|
+
create(title?: string, classNames?: string): DialogAPI;
|
|
6
|
+
empty(): DialogAPI;
|
|
7
|
+
init(): void;
|
|
8
|
+
isOpen(classNames?: string): boolean;
|
|
9
|
+
open(options?: { top?: number }, onClose?: () => void): DialogAPI;
|
|
10
|
+
resize(options?: { top?: number }): void;
|
|
11
|
+
wiki(...args: unknown[]): DialogAPI;
|
|
12
|
+
wikiPassage(name: string): DialogAPI;
|
|
13
|
+
/** Deprecated Functions. */
|
|
14
|
+
setup(title?: string, classNames?: string): HTMLElement | undefined;
|
|
15
|
+
}
|
package/src/engine.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Module Exports.
|
|
3
|
+
Constants.
|
|
4
|
+
Core Functions.
|
|
5
|
+
Legacy Functions.
|
|
6
|
+
*/
|
|
7
|
+
/* Engine state types object (pseudo-enumeration). */
|
|
8
|
+
export interface EngineStatesAPI {
|
|
9
|
+
Idle: string;
|
|
10
|
+
Playing: string;
|
|
11
|
+
Rendering: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface EngineAPI {
|
|
15
|
+
/* Constants. */
|
|
16
|
+
readonly States: EngineStatesAPI;
|
|
17
|
+
/* Minimum delay for DOM actions (in milliseconds). */
|
|
18
|
+
readonly minDomActionDelay: number;
|
|
19
|
+
init(): void;
|
|
20
|
+
start(): void;
|
|
21
|
+
restart(): void;
|
|
22
|
+
readonly state: string;
|
|
23
|
+
isIdle(): boolean;
|
|
24
|
+
isPlaying(): boolean;
|
|
25
|
+
isRendering(): boolean;
|
|
26
|
+
readonly lastPlay: number | null;
|
|
27
|
+
goTo(index: number): void;
|
|
28
|
+
go(delta: number): void;
|
|
29
|
+
backward(): void;
|
|
30
|
+
forward(): void;
|
|
31
|
+
show(passage: string, ...args: unknown[]): void;
|
|
32
|
+
play(passage?: string, ...args: unknown[]): void;
|
|
33
|
+
/* Legacy Functions. */
|
|
34
|
+
display(passage?: string, ...args: unknown[]): void;
|
|
35
|
+
flags: Record<string, unknown>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface FullscreenAPI {
|
|
2
|
+
readonly vendor: unknown;
|
|
3
|
+
readonly element: Element | null;
|
|
4
|
+
isEnabled(): boolean;
|
|
5
|
+
isFullscreen(): boolean;
|
|
6
|
+
request(): Promise<void>;
|
|
7
|
+
exit(): Promise<void>;
|
|
8
|
+
toggle(): Promise<void>;
|
|
9
|
+
onChange(handler: () => void): void;
|
|
10
|
+
offChange(handler: () => void): void;
|
|
11
|
+
onError(handler: (err: unknown) => void): void;
|
|
12
|
+
offError(handler: (err: unknown) => void): void;
|
|
13
|
+
}
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Global `SugarCube` object. Allows scripts to detect if they're running in SugarCube by
|
|
3
|
+
testing for the object (e.g. `"SugarCube" in window`) and contains exported identifiers
|
|
4
|
+
for debugging purposes.
|
|
5
|
+
*/
|
|
6
|
+
import type { AlertAPI } from './alert.d.ts';
|
|
7
|
+
import type { BrowserAPI } from './browser.d.ts';
|
|
8
|
+
import type { ConfigAPI } from './config.d.ts';
|
|
9
|
+
import type { DebugBarAPI } from './debugbar.d.ts';
|
|
10
|
+
import type { DialogAPI } from './dialog.d.ts';
|
|
11
|
+
import type { EngineAPI } from './engine.d.ts';
|
|
12
|
+
import type { FullscreenAPI } from './fullscreen.d.ts';
|
|
13
|
+
import type { HasAPI } from './has.d.ts';
|
|
14
|
+
import type { IdbAPI } from './idb.d.ts';
|
|
15
|
+
import type { L10nAPI } from './l10n.d.ts';
|
|
16
|
+
import type { LinksAPI } from './links.d.ts';
|
|
17
|
+
import type { LoadScreenAPI } from './loadscreen.d.ts';
|
|
18
|
+
import type { MacroAPI } from './macro.d.ts';
|
|
19
|
+
import type { PassageAPI, PassageConstructor } from './passage.d.ts';
|
|
20
|
+
import type { SaveAPI } from './save.d.ts';
|
|
21
|
+
import type { ScriptingAPI } from './scripting.d.ts';
|
|
22
|
+
import type { SettingAPI } from './setting.d.ts';
|
|
23
|
+
import type { SimpleAudioAPI } from './simpleaudio.d.ts';
|
|
24
|
+
import type { SimpleStoreAPI, SimpleStoreInstanceAPI } from './simplestore.d.ts';
|
|
25
|
+
import type { StateAPI } from './state.d.ts';
|
|
26
|
+
import type { StoryAPI } from './story.d.ts';
|
|
27
|
+
import type { TemplateAPI } from './template.d.ts';
|
|
28
|
+
import type { UIBarAPI } from './uibar.d.ts';
|
|
29
|
+
import type { UIAPI } from './ui.d.ts';
|
|
30
|
+
import type { UtilAPI } from './util.d.ts';
|
|
31
|
+
import type { VersionInfo } from './version.d.ts';
|
|
32
|
+
import type { VisibilityAPI } from './visibility.d.ts';
|
|
33
|
+
import type { WikifierAPI } from './wikifier.d.ts';
|
|
34
|
+
|
|
35
|
+
declare global {
|
|
36
|
+
const Alert: AlertAPI;
|
|
37
|
+
const Browser: BrowserAPI;
|
|
38
|
+
const Config: ConfigAPI;
|
|
39
|
+
const DebugBar: DebugBarAPI;
|
|
40
|
+
const Dialog: DialogAPI;
|
|
41
|
+
const Engine: EngineAPI;
|
|
42
|
+
const Fullscreen: FullscreenAPI;
|
|
43
|
+
const Has: HasAPI;
|
|
44
|
+
const L10n: L10nAPI;
|
|
45
|
+
const Links: LinksAPI;
|
|
46
|
+
const LoadScreen: LoadScreenAPI;
|
|
47
|
+
const Macro: MacroAPI;
|
|
48
|
+
const Passage: PassageConstructor;
|
|
49
|
+
const Save: SaveAPI;
|
|
50
|
+
const Scripting: ScriptingAPI;
|
|
51
|
+
const Setting: SettingAPI;
|
|
52
|
+
const SimpleAudio: SimpleAudioAPI;
|
|
53
|
+
const SimpleStore: SimpleStoreAPI;
|
|
54
|
+
const State: StateAPI;
|
|
55
|
+
const Story: StoryAPI;
|
|
56
|
+
const Template: TemplateAPI;
|
|
57
|
+
const UIBar: UIBarAPI;
|
|
58
|
+
const UI: UIAPI;
|
|
59
|
+
const Util: UtilAPI;
|
|
60
|
+
const Visibility: VisibilityAPI;
|
|
61
|
+
const Wikifier: WikifierAPI;
|
|
62
|
+
|
|
63
|
+
/* Version object. */
|
|
64
|
+
const version: VersionInfo;
|
|
65
|
+
/* Session storage manager object. */
|
|
66
|
+
const session: SimpleStoreInstanceAPI | null;
|
|
67
|
+
/* Settings object. */
|
|
68
|
+
const settings: Record<string, unknown>;
|
|
69
|
+
/* Setup object. */
|
|
70
|
+
const setup: Record<string, unknown>;
|
|
71
|
+
/* Persistant storage manager object. */
|
|
72
|
+
const storage: SimpleStoreInstanceAPI | null;
|
|
73
|
+
const idb: IdbAPI;
|
|
74
|
+
|
|
75
|
+
/* Legacy aliases. */
|
|
76
|
+
const browser: BrowserAPI;
|
|
77
|
+
const config: ConfigAPI;
|
|
78
|
+
const has: HasAPI;
|
|
79
|
+
const History: StateAPI;
|
|
80
|
+
const state: StateAPI;
|
|
81
|
+
const tale: StoryAPI;
|
|
82
|
+
const TempVariables: StateAPI['temporary'];
|
|
83
|
+
|
|
84
|
+
interface Window {
|
|
85
|
+
SugarCube: {
|
|
86
|
+
Browser: BrowserAPI;
|
|
87
|
+
Config: ConfigAPI;
|
|
88
|
+
Dialog: DialogAPI;
|
|
89
|
+
Engine: EngineAPI;
|
|
90
|
+
Fullscreen: FullscreenAPI;
|
|
91
|
+
Has: HasAPI;
|
|
92
|
+
L10n: L10nAPI;
|
|
93
|
+
Macro: MacroAPI;
|
|
94
|
+
Passage: typeof Passage;
|
|
95
|
+
Save: SaveAPI;
|
|
96
|
+
Scripting: ScriptingAPI;
|
|
97
|
+
Setting: SettingAPI;
|
|
98
|
+
SimpleAudio: SimpleAudioAPI;
|
|
99
|
+
State: StateAPI;
|
|
100
|
+
Story: StoryAPI;
|
|
101
|
+
UI: UIAPI;
|
|
102
|
+
UIBar: UIBarAPI;
|
|
103
|
+
DebugBar: DebugBarAPI;
|
|
104
|
+
Util: UtilAPI;
|
|
105
|
+
Visibility: VisibilityAPI;
|
|
106
|
+
Wikifier: WikifierAPI;
|
|
107
|
+
session: SimpleStoreInstanceAPI | null;
|
|
108
|
+
settings: Record<string, unknown>;
|
|
109
|
+
setup: Record<string, unknown>;
|
|
110
|
+
storage: SimpleStoreInstanceAPI | null;
|
|
111
|
+
version: VersionInfo;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {};
|
package/src/has.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Module Exports. */
|
|
2
|
+
export interface HasAPI {
|
|
3
|
+
readonly audio: boolean;
|
|
4
|
+
readonly fileAPI: boolean;
|
|
5
|
+
readonly geolocation: boolean;
|
|
6
|
+
readonly mutationObserver: boolean;
|
|
7
|
+
readonly performance: boolean;
|
|
8
|
+
readonly touch: boolean;
|
|
9
|
+
readonly transitionEndEvent: string;
|
|
10
|
+
}
|
package/src/idb.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* "simple" indexedDB backend for storing save data, working similarly to existing webStorage system
|
|
3
|
+
* indexedDB works faster, has virtually unlimited storage, but does not work properly in private mode. then again, localStorage doesn't persist in private mode either
|
|
4
|
+
* indexedDB operates asynchronously, by making requests that may be fulfilled or rejected later, without blocking the rest of the code, but also without a guarantee that requested values will be available when that rest of the code runs. this requires some working around.
|
|
5
|
+
* unlike old synchronous operations, most functions do not return the value immediately, but a promise to return it when it's completed. these promises can then be used to retrieve that data by calling Promise.then() callback function
|
|
6
|
+
* for example, `idb.getItem(0).then((value) => console.log(value))` will first attempt to retrieve save data from slot 0, and then when that is done - the then() function triggers, in this case printing retrieved value to the console
|
|
7
|
+
*
|
|
8
|
+
* this implementation doesn't rely on caches, doesn't compress save data in any way, and separates save details store from save data store to speed up building the save list and allow extra features like timestamp highlighting at minimal processing cost
|
|
9
|
+
* as a consequence, it requires more disk space, and a completely separate namespace that might need extra setup for games that override the default save list appearance
|
|
10
|
+
* generally though, just adding a "saveList" id or class to the div element where the saves should appear and replacing the function/macro that populates that div with "if (idb.active) idb.saveList(); else old-custom-way-of-building-save-menu" should be enough to make it work.
|
|
11
|
+
*/
|
|
12
|
+
export interface IdbAPI {
|
|
13
|
+
dbName: string;
|
|
14
|
+
lock: boolean;
|
|
15
|
+
active: boolean;
|
|
16
|
+
listLength: number;
|
|
17
|
+
listPage: number;
|
|
18
|
+
footerHTML: string | false;
|
|
19
|
+
readonly baddies: unknown;
|
|
20
|
+
init(dbName?: string): Promise<unknown>;
|
|
21
|
+
getSaveDetails(): Promise<unknown>;
|
|
22
|
+
getAllSaves(): Promise<unknown>;
|
|
23
|
+
saveList(): void;
|
|
24
|
+
saveState(): Promise<unknown>;
|
|
25
|
+
loadState(): Promise<unknown>;
|
|
26
|
+
setItem(slot: number, value: unknown): Promise<void>;
|
|
27
|
+
getItem(slot: number): Promise<unknown>;
|
|
28
|
+
deleteItem(slot: number): Promise<void>;
|
|
29
|
+
clearAll(): Promise<void>;
|
|
30
|
+
updateSettings(): void;
|
|
31
|
+
funNuke(): void;
|
|
32
|
+
ekuNnuf(): void;
|
|
33
|
+
importFromLocalStorage(): Promise<void>;
|
|
34
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "./jquery-shim";
|
|
2
|
+
import "./version";
|
|
3
|
+
import "./config";
|
|
4
|
+
import "./util";
|
|
5
|
+
import "./has";
|
|
6
|
+
import "./browser";
|
|
7
|
+
import "./alert";
|
|
8
|
+
import "./visibility";
|
|
9
|
+
import "./fullscreen";
|
|
10
|
+
import "./l10n";
|
|
11
|
+
import "./scripting";
|
|
12
|
+
import "./template";
|
|
13
|
+
import "./simplestore";
|
|
14
|
+
import "./passage";
|
|
15
|
+
import "./state";
|
|
16
|
+
import "./engine";
|
|
17
|
+
import "./story";
|
|
18
|
+
import "./save";
|
|
19
|
+
import "./setting";
|
|
20
|
+
import "./macro";
|
|
21
|
+
import "./wikifier";
|
|
22
|
+
import "./loadscreen";
|
|
23
|
+
import "./dialog";
|
|
24
|
+
import "./uibar";
|
|
25
|
+
import "./ui";
|
|
26
|
+
import "./simpleaudio";
|
|
27
|
+
import "./debugbar";
|
|
28
|
+
import "./links";
|
|
29
|
+
import "./idb";
|
|
30
|
+
import "./global";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare interface JQuery {
|
|
2
|
+
append(...args: unknown[]): JQuery;
|
|
3
|
+
empty(): JQuery;
|
|
4
|
+
get(index: number): Element | undefined;
|
|
5
|
+
hasClass(className: string): boolean;
|
|
6
|
+
removeClass(): JQuery;
|
|
7
|
+
addClass(classNames: string): JQuery;
|
|
8
|
+
trigger(eventType: string): JQuery;
|
|
9
|
+
off(events?: string): JQuery;
|
|
10
|
+
on(events: string, handler: (ev: JQuery.TriggeredEvent) => void): JQuery;
|
|
11
|
+
one(events: string, selector: string, handler: (ev: JQuery.TriggeredEvent) => void): JQuery;
|
|
12
|
+
css(propertyName: string): string;
|
|
13
|
+
css(properties: Record<string, string | number>): JQuery;
|
|
14
|
+
attr(attributeName: string): string | undefined;
|
|
15
|
+
attr(attributeName: string, value: string | number | null): JQuery;
|
|
16
|
+
removeAttr(name: string): JQuery;
|
|
17
|
+
find(selector: string): JQuery;
|
|
18
|
+
hide(): JQuery;
|
|
19
|
+
show(): JQuery;
|
|
20
|
+
wiki(...args: unknown[]): JQuery;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare namespace JQuery {
|
|
25
|
+
interface TriggeredEvent {
|
|
26
|
+
target: EventTarget;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare interface JQueryStatic {
|
|
32
|
+
(selector: string | Element | DocumentFragment): JQuery;
|
|
33
|
+
(event: { type: string }): JQuery;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare var jQuery: JQueryStatic;
|
|
37
|
+
declare var $: JQueryStatic;
|
package/src/l10n.d.ts
ADDED
package/src/links.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LinksAPI {
|
|
2
|
+
init(): void;
|
|
3
|
+
generate(): void;
|
|
4
|
+
generateLinkNumbers(): void;
|
|
5
|
+
pushTheButton(): void;
|
|
6
|
+
numberPrepend: string;
|
|
7
|
+
numberAppend: string;
|
|
8
|
+
skipElements: unknown;
|
|
9
|
+
includeElements: unknown;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
disableRNGReload: boolean;
|
|
12
|
+
disableNumbers: boolean;
|
|
13
|
+
throttle: number;
|
|
14
|
+
readonly currentLinks: unknown;
|
|
15
|
+
}
|
package/src/macro.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Module Exports.
|
|
3
|
+
Macro Functions.
|
|
4
|
+
Hook API
|
|
5
|
+
Tags Functions.
|
|
6
|
+
Legacy Aliases.
|
|
7
|
+
*/
|
|
8
|
+
export interface MacroTagsAPI {
|
|
9
|
+
register(name: string, handler: (...args: unknown[]) => unknown): void;
|
|
10
|
+
unregister(name: string): void;
|
|
11
|
+
has(name: string): boolean;
|
|
12
|
+
get(name: string): (...args: unknown[]) => unknown;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MacroHooksAPI {
|
|
16
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
17
|
+
off(event: string, handler?: (...args: unknown[]) => void): void;
|
|
18
|
+
emit(event: string, ...args: unknown[]): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MacroAPI {
|
|
22
|
+
add(name: string, definition: unknown): void;
|
|
23
|
+
delete(name: string): void;
|
|
24
|
+
isEmpty(): boolean;
|
|
25
|
+
has(name: string): boolean;
|
|
26
|
+
get(name: string): unknown;
|
|
27
|
+
init(): void;
|
|
28
|
+
hooks: MacroHooksAPI;
|
|
29
|
+
tags: MacroTagsAPI;
|
|
30
|
+
evalStatements(...args: unknown[]): unknown;
|
|
31
|
+
}
|
package/src/passage.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Passage Class.
|
|
3
|
+
Passage title/ID.
|
|
4
|
+
Passage data element (within the story data element; i.e. T1: '[tiddler]', T2: 'tw-passagedata').
|
|
5
|
+
Passage tags array (unique).
|
|
6
|
+
*/
|
|
7
|
+
export interface PassageAPI {
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly element: Element | null;
|
|
10
|
+
readonly tags: readonly string[];
|
|
11
|
+
readonly domId: string;
|
|
12
|
+
readonly classes: readonly string[];
|
|
13
|
+
readonly className: string;
|
|
14
|
+
readonly text: string;
|
|
15
|
+
description(): string;
|
|
16
|
+
processText(): string;
|
|
17
|
+
render(options?: unknown): DocumentFragment;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Constructor type for Passage (static methods live here). */
|
|
21
|
+
export interface PassageConstructor {
|
|
22
|
+
new (title: string, el?: Element | null): PassageAPI;
|
|
23
|
+
getExcerptFromNode(node: Node, count?: number): string;
|
|
24
|
+
getExcerptFromText(text: string, count?: number): string;
|
|
25
|
+
}
|
package/src/save.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Module Exports.
|
|
3
|
+
Save Functions.
|
|
4
|
+
Autosave Functions.
|
|
5
|
+
Slots Functions.
|
|
6
|
+
Disk Import/Export Functions.
|
|
7
|
+
Serialization Functions.
|
|
8
|
+
Event Functions.
|
|
9
|
+
*/
|
|
10
|
+
export interface SaveOnLoadAPI {
|
|
11
|
+
add(handler: (...args: unknown[]) => unknown): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
delete(handler: (...args: unknown[]) => unknown): void;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly handlers: readonly ((...args: unknown[]) => unknown)[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SaveOnSaveAPI {
|
|
19
|
+
add(handler: (...args: unknown[]) => unknown): void;
|
|
20
|
+
clear(): void;
|
|
21
|
+
delete(handler: (...args: unknown[]) => unknown): void;
|
|
22
|
+
readonly size: number;
|
|
23
|
+
readonly handlers: readonly ((...args: unknown[]) => unknown)[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SaveAutosaveAPI {
|
|
27
|
+
ok(): boolean;
|
|
28
|
+
has(): boolean;
|
|
29
|
+
get(): unknown;
|
|
30
|
+
load(): void;
|
|
31
|
+
save(): void;
|
|
32
|
+
delete(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SaveSlotsAPI {
|
|
36
|
+
ok(): boolean;
|
|
37
|
+
readonly length: number;
|
|
38
|
+
isEmpty(): boolean;
|
|
39
|
+
count(): number;
|
|
40
|
+
has(slot: number): boolean;
|
|
41
|
+
get(slot: number): unknown;
|
|
42
|
+
load(slot: number): void;
|
|
43
|
+
save(slot: number, title?: string): void;
|
|
44
|
+
delete(slot: number): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface SaveAPI {
|
|
48
|
+
init(): void;
|
|
49
|
+
get(): { autosave: unknown; slots: unknown[] };
|
|
50
|
+
clear(): void;
|
|
51
|
+
ok(): boolean;
|
|
52
|
+
autosave: SaveAutosaveAPI;
|
|
53
|
+
slots: SaveSlotsAPI;
|
|
54
|
+
export(): void;
|
|
55
|
+
import(): void;
|
|
56
|
+
serialize(): string;
|
|
57
|
+
deserialize(data: string): unknown;
|
|
58
|
+
onLoad: SaveOnLoadAPI;
|
|
59
|
+
onSave: SaveOnSaveAPI;
|
|
60
|
+
readonly meta: unknown;
|
|
61
|
+
}
|
package/src/setting.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Module Exports.
|
|
3
|
+
Enumerations.
|
|
4
|
+
Settings Functions.
|
|
5
|
+
Definitions Functions.
|
|
6
|
+
*/
|
|
7
|
+
export interface SettingTypesAPI {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SettingAPI {
|
|
12
|
+
readonly Types: SettingTypesAPI;
|
|
13
|
+
init(): void;
|
|
14
|
+
create(): void;
|
|
15
|
+
save(): void;
|
|
16
|
+
load(): void;
|
|
17
|
+
clear(): void;
|
|
18
|
+
reset(): void;
|
|
19
|
+
forEach(callback: (...args: unknown[]) => void): void;
|
|
20
|
+
add(name: string, definition: unknown): void;
|
|
21
|
+
addHeader(name: string, definition: unknown): void;
|
|
22
|
+
addToggle(name: string, definition: unknown): void;
|
|
23
|
+
addList(name: string, definition: unknown): void;
|
|
24
|
+
addRange(name: string, definition: unknown): void;
|
|
25
|
+
isEmpty(): boolean;
|
|
26
|
+
has(name: string): boolean;
|
|
27
|
+
get(name: string): unknown;
|
|
28
|
+
delete(name: string): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface SimpleAudioTracksAPI {
|
|
2
|
+
add(name: string, definition: unknown): void;
|
|
3
|
+
delete(name: string): void;
|
|
4
|
+
clear(): void;
|
|
5
|
+
has(name: string): boolean;
|
|
6
|
+
get(name: string): unknown;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SimpleAudioGroupsAPI {
|
|
10
|
+
add(name: string, definition: unknown): void;
|
|
11
|
+
delete(name: string): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
has(name: string): boolean;
|
|
14
|
+
get(name: string): unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SimpleAudioListsAPI {
|
|
18
|
+
add(name: string, definition: unknown): void;
|
|
19
|
+
delete(name: string): void;
|
|
20
|
+
clear(): void;
|
|
21
|
+
has(name: string): boolean;
|
|
22
|
+
get(name: string): unknown;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SimpleAudioAPI {
|
|
26
|
+
tracks: SimpleAudioTracksAPI;
|
|
27
|
+
groups: SimpleAudioGroupsAPI;
|
|
28
|
+
lists: SimpleAudioListsAPI;
|
|
29
|
+
select: unknown;
|
|
30
|
+
load(...args: unknown[]): void;
|
|
31
|
+
loadWithScreen(...args: unknown[]): void;
|
|
32
|
+
mute(flag?: boolean): void;
|
|
33
|
+
muteOnHidden(flag?: boolean): void;
|
|
34
|
+
rate(value?: number): number;
|
|
35
|
+
stop(): void;
|
|
36
|
+
unload(): void;
|
|
37
|
+
volume(value?: number): number;
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Adapters List.
|
|
3
|
+
Core Functions.
|
|
4
|
+
*/
|
|
5
|
+
export interface SimpleStoreInstanceAPI {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly persistent: boolean;
|
|
9
|
+
size(): number;
|
|
10
|
+
keys(): string[];
|
|
11
|
+
has(key: string): boolean;
|
|
12
|
+
get(key: string): unknown;
|
|
13
|
+
set(key: string, value: unknown): void;
|
|
14
|
+
delete(key: string): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SimpleStoreAPI {
|
|
18
|
+
readonly adapters: unknown[];
|
|
19
|
+
create(storageId: string, persistent: boolean): SimpleStoreInstanceAPI;
|
|
20
|
+
}
|
package/src/state.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*
|
|
2
|
+
State Functions.
|
|
3
|
+
Moment Functions.
|
|
4
|
+
History Functions.
|
|
5
|
+
PRNG Functions.
|
|
6
|
+
Temporary Variables Functions.
|
|
7
|
+
Local variables.
|
|
8
|
+
Variable Chain Parsing Functions.
|
|
9
|
+
Story Metadata Functions.
|
|
10
|
+
qc stuff
|
|
11
|
+
Legacy Aliases.
|
|
12
|
+
*/
|
|
13
|
+
export interface StateMoment {
|
|
14
|
+
readonly title: string;
|
|
15
|
+
readonly variables: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface StateMetadataAPI {
|
|
19
|
+
clear(): void;
|
|
20
|
+
delete(key: string): boolean;
|
|
21
|
+
entries(): Iterable<[string, unknown]>;
|
|
22
|
+
get(key: string): unknown;
|
|
23
|
+
has(key: string): boolean;
|
|
24
|
+
keys(): Iterable<string>;
|
|
25
|
+
set(key: string, value: unknown): void;
|
|
26
|
+
readonly size: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface StatePRNGAPI {
|
|
30
|
+
init(seed: string | number): void;
|
|
31
|
+
isEnabled(): boolean;
|
|
32
|
+
pull: number;
|
|
33
|
+
readonly seed: string | number;
|
|
34
|
+
str2int(str: string): number;
|
|
35
|
+
test(seed: string | number): boolean;
|
|
36
|
+
peek(): number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface StateAPI {
|
|
40
|
+
/* State Functions. */
|
|
41
|
+
reset(): void;
|
|
42
|
+
restore(soft?: boolean): boolean;
|
|
43
|
+
marshalForSave(): unknown;
|
|
44
|
+
unmarshalForSave(stateObj: unknown): void;
|
|
45
|
+
readonly expired: string[];
|
|
46
|
+
readonly turns: number;
|
|
47
|
+
readonly passages: string[];
|
|
48
|
+
hasPlayed(passage: string): boolean;
|
|
49
|
+
getSessionState(): unknown;
|
|
50
|
+
setSessionState(state: unknown): void;
|
|
51
|
+
|
|
52
|
+
/* Moment Functions. */
|
|
53
|
+
readonly active: StateMoment;
|
|
54
|
+
readonly activeIndex: number;
|
|
55
|
+
/** shortcut for `State.active.title` */
|
|
56
|
+
readonly passage: string;
|
|
57
|
+
/** shortcut for `State.active.variables` */
|
|
58
|
+
readonly variables: Record<string, unknown>;
|
|
59
|
+
|
|
60
|
+
/* History Functions. */
|
|
61
|
+
readonly history: StateMoment[];
|
|
62
|
+
readonly length: number;
|
|
63
|
+
readonly size: number;
|
|
64
|
+
isEmpty(): boolean;
|
|
65
|
+
readonly current: StateMoment | undefined;
|
|
66
|
+
readonly top: StateMoment | undefined;
|
|
67
|
+
readonly bottom: StateMoment | undefined;
|
|
68
|
+
index(offset?: number): number;
|
|
69
|
+
peek(offset?: number): StateMoment | undefined;
|
|
70
|
+
has(offset: number): boolean;
|
|
71
|
+
create(): StateMoment;
|
|
72
|
+
goTo(index: number): void;
|
|
73
|
+
go(delta: number): void;
|
|
74
|
+
deltaEncode(moments: StateMoment[]): unknown;
|
|
75
|
+
deltaDecode(data: unknown): StateMoment[];
|
|
76
|
+
|
|
77
|
+
/* PRNG Functions. */
|
|
78
|
+
readonly prng: StatePRNGAPI;
|
|
79
|
+
random(): number;
|
|
80
|
+
|
|
81
|
+
/* Temporary Variables Functions. */
|
|
82
|
+
clearTemporary(): void;
|
|
83
|
+
readonly temporary: Record<string, unknown>;
|
|
84
|
+
|
|
85
|
+
/* Local variables. */
|
|
86
|
+
pushLocal(): void;
|
|
87
|
+
popLocal(): Record<string, unknown> | undefined;
|
|
88
|
+
peekLocal(): Record<string, unknown> | undefined;
|
|
89
|
+
readonly local: Record<string, unknown>;
|
|
90
|
+
clearLocal(): void;
|
|
91
|
+
|
|
92
|
+
/* Variable Chain Parsing Functions. */
|
|
93
|
+
getVar(path: string): unknown;
|
|
94
|
+
setVar(path: string, value: unknown): void;
|
|
95
|
+
|
|
96
|
+
/* Story Metadata Functions. */
|
|
97
|
+
readonly metadata: StateMetadataAPI;
|
|
98
|
+
|
|
99
|
+
/* qc stuff */
|
|
100
|
+
readonly qc: unknown;
|
|
101
|
+
qcadd(fn: (...args: unknown[]) => void): void;
|
|
102
|
+
|
|
103
|
+
/* Legacy Aliases. */
|
|
104
|
+
initPRNG(seed: string | number): void;
|
|
105
|
+
restart(): void;
|
|
106
|
+
backward(): void;
|
|
107
|
+
forward(): void;
|
|
108
|
+
display(...args: unknown[]): void;
|
|
109
|
+
show(...args: unknown[]): void;
|
|
110
|
+
play(...args: unknown[]): void;
|
|
111
|
+
}
|
package/src/story.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Module Exports.
|
|
3
|
+
Story Functions.
|
|
4
|
+
Passage Functions.
|
|
5
|
+
*/
|
|
6
|
+
import type { PassageAPI } from './passage.d.ts';
|
|
7
|
+
|
|
8
|
+
export interface StoryAPI {
|
|
9
|
+
load(): void;
|
|
10
|
+
init(): void;
|
|
11
|
+
readonly title: string;
|
|
12
|
+
readonly domId: string;
|
|
13
|
+
readonly ifId: string;
|
|
14
|
+
add(passage: PassageAPI): void;
|
|
15
|
+
has(title: string): boolean;
|
|
16
|
+
get(title: string): PassageAPI;
|
|
17
|
+
getAllInit(): readonly PassageAPI[];
|
|
18
|
+
getAllRegular(): readonly PassageAPI[];
|
|
19
|
+
getAllScript(): readonly string[];
|
|
20
|
+
getAllStylesheet(): readonly string[];
|
|
21
|
+
getAllWidget(): readonly string[];
|
|
22
|
+
lookup(tags: string | string[]): PassageAPI[];
|
|
23
|
+
lookupWith(predicate: (p: PassageAPI) => boolean): PassageAPI[];
|
|
24
|
+
}
|
package/src/ui.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
UI Functions, Core.
|
|
3
|
+
UI Functions, Built-ins.
|
|
4
|
+
Legacy Aliases.
|
|
5
|
+
*/
|
|
6
|
+
import type { DialogAPI } from './dialog.d.ts';
|
|
7
|
+
|
|
8
|
+
export interface UIAPI {
|
|
9
|
+
assembleLinkList(passage?: string): unknown;
|
|
10
|
+
alert(title: string, message: string): void;
|
|
11
|
+
jumpto(): void;
|
|
12
|
+
restart(): void;
|
|
13
|
+
saves(): void;
|
|
14
|
+
settings(): void;
|
|
15
|
+
share(): void;
|
|
16
|
+
buildAutoload(): unknown;
|
|
17
|
+
buildJumpto(): unknown;
|
|
18
|
+
buildRestart(): unknown;
|
|
19
|
+
buildSaves(): unknown;
|
|
20
|
+
buildSettings(): unknown;
|
|
21
|
+
buildShare(): unknown;
|
|
22
|
+
stow(): void;
|
|
23
|
+
unstow(): void;
|
|
24
|
+
setStoryElements(): void;
|
|
25
|
+
isOpen(...args: Parameters<DialogAPI['isOpen']>): boolean;
|
|
26
|
+
body(): ReturnType<DialogAPI['body']>;
|
|
27
|
+
setup(...args: Parameters<DialogAPI['setup']>): ReturnType<DialogAPI['setup']>;
|
|
28
|
+
addClickHandler(...args: unknown[]): unknown;
|
|
29
|
+
open(...args: Parameters<DialogAPI['open']>): DialogAPI;
|
|
30
|
+
close(...args: Parameters<DialogAPI['close']>): DialogAPI;
|
|
31
|
+
resize(): void;
|
|
32
|
+
buildDialogAutoload(): unknown;
|
|
33
|
+
buildDialogJumpto(): unknown;
|
|
34
|
+
buildDialogRestart(): unknown;
|
|
35
|
+
buildDialogSaves(): unknown;
|
|
36
|
+
buildDialogSettings(): unknown;
|
|
37
|
+
buildDialogShare(): unknown;
|
|
38
|
+
buildLinkListFromPassage(passage?: string): unknown;
|
|
39
|
+
}
|
package/src/uibar.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
UI Bar Functions.
|
|
3
|
+
Object Exports.
|
|
4
|
+
Legacy Functions.
|
|
5
|
+
*/
|
|
6
|
+
export interface UIBarAPI {
|
|
7
|
+
destroy(): void;
|
|
8
|
+
hide(): UIBarAPI;
|
|
9
|
+
init(): void;
|
|
10
|
+
isHidden(): boolean;
|
|
11
|
+
isStowed(): boolean;
|
|
12
|
+
show(): UIBarAPI;
|
|
13
|
+
start(): void;
|
|
14
|
+
stow(): void;
|
|
15
|
+
unstow(): void;
|
|
16
|
+
update(): void;
|
|
17
|
+
setStoryElements(): void;
|
|
18
|
+
}
|
package/src/util.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface UtilAPI {
|
|
2
|
+
getType(value: unknown): string;
|
|
3
|
+
isBoolean(value: unknown): boolean;
|
|
4
|
+
isIterable(value: unknown): boolean;
|
|
5
|
+
isNumeric(value: unknown): boolean;
|
|
6
|
+
sameValueZero(x: unknown, y: unknown): boolean;
|
|
7
|
+
toEnum<T extends Record<string, string>>(obj: T): T;
|
|
8
|
+
toStringTag(value: unknown): string;
|
|
9
|
+
slugify(str: string): string;
|
|
10
|
+
sanitizeFilename(str: string): string;
|
|
11
|
+
escapeMarkup(str: string): string;
|
|
12
|
+
escape(str: string): string;
|
|
13
|
+
unescape(str: string): string;
|
|
14
|
+
charAndPosAt(str: string, index: number): { char: string; start: number; end: number };
|
|
15
|
+
now(): number;
|
|
16
|
+
fromCssTime(value: string): number;
|
|
17
|
+
toCssTime(value: number): string;
|
|
18
|
+
fromCssProperty(value: string): unknown;
|
|
19
|
+
parseUrl(url: string): { href: string; [key: string]: unknown };
|
|
20
|
+
newExceptionFrom(ex: unknown): Error;
|
|
21
|
+
scrubEventKey(key: string): string;
|
|
22
|
+
hasMediaQuery(query: string): boolean;
|
|
23
|
+
random(): number;
|
|
24
|
+
entityEncode(str: string): string;
|
|
25
|
+
entityDecode(str: string): string;
|
|
26
|
+
evalExpression(script: string): unknown;
|
|
27
|
+
evalStatements(script: string): unknown;
|
|
28
|
+
}
|
package/src/version.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Version object.
|
|
3
|
+
*/
|
|
4
|
+
export interface VersionInfo {
|
|
5
|
+
readonly title: string;
|
|
6
|
+
readonly major: string;
|
|
7
|
+
readonly minor: string;
|
|
8
|
+
readonly patch: string;
|
|
9
|
+
readonly prerelease: string;
|
|
10
|
+
readonly build: string;
|
|
11
|
+
readonly date: Date;
|
|
12
|
+
readonly extensions: Record<string, unknown>;
|
|
13
|
+
toString(): string;
|
|
14
|
+
short(): string;
|
|
15
|
+
long(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface VisibilityAPI {
|
|
2
|
+
readonly vendor: unknown;
|
|
3
|
+
readonly state: string;
|
|
4
|
+
isEnabled(): boolean;
|
|
5
|
+
isHidden(): boolean;
|
|
6
|
+
readonly hiddenProperty: string | undefined;
|
|
7
|
+
readonly stateProperty: string | undefined;
|
|
8
|
+
readonly changeEvent: string | undefined;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface WikifierParserProfileAPI {
|
|
2
|
+
readonly profiles: unknown;
|
|
3
|
+
compile(name: string, compiler: (...args: unknown[]) => string): void;
|
|
4
|
+
isEmpty(): boolean;
|
|
5
|
+
has(name: string): boolean;
|
|
6
|
+
get(name: string): unknown;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface WikifierParserAPI {
|
|
10
|
+
readonly parsers: unknown[];
|
|
11
|
+
add(parser: { name: string; [key: string]: unknown }): void;
|
|
12
|
+
delete(name: string): void;
|
|
13
|
+
isEmpty(): boolean;
|
|
14
|
+
has(name: string): boolean;
|
|
15
|
+
get(name: string): unknown;
|
|
16
|
+
readonly Profile: WikifierParserProfileAPI;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface WikifierHelpersAPI {
|
|
20
|
+
inlineCss?: (w: { nextMatch: number; [key: string]: unknown }) => void;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WikifierStaticAPI {
|
|
25
|
+
Parser: WikifierParserAPI;
|
|
26
|
+
helpers: WikifierHelpersAPI;
|
|
27
|
+
stopWikify: boolean;
|
|
28
|
+
getValue: (path: string) => unknown;
|
|
29
|
+
setValue: (path: string, value: unknown) => void;
|
|
30
|
+
parse: (script: string) => unknown;
|
|
31
|
+
evalExpression: (script: string) => unknown;
|
|
32
|
+
evalStatements: (script: string) => unknown;
|
|
33
|
+
textPrimitives: unknown;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface WikifierConstructor {
|
|
37
|
+
new (context: DocumentFragment | Element, text: string, options?: unknown): unknown;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type WikifierAPI = WikifierConstructor & WikifierStaticAPI;
|