epos 1.26.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chrome.d.d.ts +4 -0
- package/dist/epos.d.ts +87 -50
- package/package.json +9 -9
- package/src/chrome.d.ts +3 -0
- package/src/epos.ts +90 -70
- package/dist/chrome-types.d.d.ts +0 -1
- package/src/chrome-types.d.ts +0 -2
- /package/dist/{chrome-types.d.js → chrome.d.js} +0 -0
package/dist/epos.d.ts
CHANGED
|
@@ -5,29 +5,57 @@ import * as reactDom from 'react-dom';
|
|
|
5
5
|
import * as reactDomClient from 'react-dom/client';
|
|
6
6
|
import * as reactJsxRuntime from 'react/jsx-runtime';
|
|
7
7
|
import * as yjs from 'yjs';
|
|
8
|
+
import { Chrome } from './chrome.d.js';
|
|
8
9
|
|
|
9
10
|
type Fn<T = any> = (...args: any[]) => T;
|
|
10
11
|
type Obj = Record<string, unknown>;
|
|
12
|
+
type Arr = unknown[];
|
|
11
13
|
type Versioner = Record<number, (this: any, state: any) => void>;
|
|
12
|
-
type ClassName = string | null | boolean | undefined | ClassName[];
|
|
13
14
|
type ModelClass = new (...args: any[]) => any;
|
|
14
15
|
type Model = InstanceType<ModelClass>;
|
|
15
16
|
type Initial<T extends Obj | Model> = T | (() => T);
|
|
17
|
+
type Attrs = Record<string, string | number>;
|
|
18
|
+
type FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr;
|
|
19
|
+
type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T;
|
|
16
20
|
type StateConfig = {
|
|
17
21
|
allowMissingModels?: boolean | string[];
|
|
18
22
|
};
|
|
19
|
-
type ReqInit =
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
type ReqInit = {
|
|
24
|
+
body: RequestInit['body'];
|
|
25
|
+
cache: RequestInit['cache'];
|
|
26
|
+
credentials: RequestInit['credentials'];
|
|
27
|
+
headers: RequestInit['headers'];
|
|
28
|
+
integrity: RequestInit['integrity'];
|
|
29
|
+
keepalive: RequestInit['keepalive'];
|
|
30
|
+
method: RequestInit['method'];
|
|
31
|
+
mode: RequestInit['mode'];
|
|
32
|
+
priority: RequestInit['priority'];
|
|
33
|
+
redirect: RequestInit['redirect'];
|
|
34
|
+
referrer: RequestInit['referrer'];
|
|
35
|
+
referrerPolicy: RequestInit['referrerPolicy'];
|
|
36
|
+
};
|
|
37
|
+
type Res = {
|
|
38
|
+
ok: Response['ok'];
|
|
39
|
+
url: Response['url'];
|
|
40
|
+
type: Response['type'];
|
|
41
|
+
status: Response['status'];
|
|
42
|
+
statusText: Response['statusText'];
|
|
43
|
+
redirected: Response['redirected'];
|
|
44
|
+
text: Response['text'];
|
|
45
|
+
json: Response['json'];
|
|
46
|
+
blob: Response['blob'];
|
|
47
|
+
headers: {
|
|
48
|
+
get: Response['headers']['get'];
|
|
49
|
+
has: Response['headers']['has'];
|
|
22
50
|
/** Get list of all header keys. */
|
|
23
51
|
keys: () => string[];
|
|
24
52
|
};
|
|
25
53
|
};
|
|
26
54
|
type Storage = {
|
|
27
55
|
/** Get value from the storage. */
|
|
28
|
-
get<T = unknown>(key: string): Promise<T>;
|
|
56
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
29
57
|
/** Set value in the storage. */
|
|
30
|
-
set
|
|
58
|
+
set(key: string, value: unknown): Promise<void>;
|
|
31
59
|
/** Delete value from the storage. */
|
|
32
60
|
delete(key: string): Promise<void>;
|
|
33
61
|
/** Get all keys from the storage. */
|
|
@@ -37,23 +65,23 @@ type Storage = {
|
|
|
37
65
|
};
|
|
38
66
|
interface Epos {
|
|
39
67
|
fetch: (url: string | URL, init?: ReqInit) => Promise<Res>;
|
|
40
|
-
browser:
|
|
41
|
-
element: HTMLDivElement;
|
|
68
|
+
browser: Chrome;
|
|
42
69
|
render(node: react.ReactNode, container?: reactDomClient.Container): void;
|
|
43
70
|
component<T>(Component: react.FC<T>): typeof Component;
|
|
71
|
+
element: HTMLDivElement;
|
|
44
72
|
bus: {
|
|
45
73
|
/** Listen for an event. */
|
|
46
|
-
on(
|
|
74
|
+
on<T extends Fn>(name: string, callback: T, thisArg?: unknown): void;
|
|
47
75
|
/** Remove event listener. */
|
|
48
|
-
off(
|
|
76
|
+
off<T extends Fn>(name: string, callback?: T): void;
|
|
49
77
|
/** Listen for an event once. */
|
|
50
|
-
once(
|
|
78
|
+
once<T extends Fn>(name: string, callback: T, thisArg?: unknown): void;
|
|
51
79
|
/** Send an event to all remote listeners (local listeners are ignored). */
|
|
52
|
-
send<T = unknown>(
|
|
80
|
+
send<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>;
|
|
53
81
|
/** Emit event locally (calls local listeners only). */
|
|
54
|
-
emit<T = unknown>(
|
|
82
|
+
emit<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>;
|
|
55
83
|
setSignal(name: string, value?: unknown): void;
|
|
56
|
-
waitSignal<T>(name: string, timeout?: number): Promise<T>;
|
|
84
|
+
waitSignal<T = unknown>(name: string, timeout?: number): Promise<T>;
|
|
57
85
|
};
|
|
58
86
|
state: {
|
|
59
87
|
/** Connect state. */
|
|
@@ -67,8 +95,6 @@ interface Epos {
|
|
|
67
95
|
transaction: (fn: () => void) => void;
|
|
68
96
|
/** Create local state (no sync). */
|
|
69
97
|
local<T extends Obj = {}>(state?: T): T;
|
|
70
|
-
/** Configure state. */
|
|
71
|
-
configure: (config: StateConfig) => void;
|
|
72
98
|
/** Get the list of all state names. */
|
|
73
99
|
list(filter?: {
|
|
74
100
|
connected?: boolean;
|
|
@@ -76,30 +102,32 @@ interface Epos {
|
|
|
76
102
|
name: string | null;
|
|
77
103
|
}[]>;
|
|
78
104
|
/** Remove state and all its data. */
|
|
79
|
-
|
|
80
|
-
/** Register models
|
|
81
|
-
|
|
82
|
-
symbols: {
|
|
83
|
-
readonly parent: unique symbol;
|
|
84
|
-
readonly modelInit: unique symbol;
|
|
85
|
-
readonly modelCleanup: unique symbol;
|
|
86
|
-
readonly modelStrict: unique symbol;
|
|
87
|
-
readonly modelVersioner: unique symbol;
|
|
88
|
-
};
|
|
105
|
+
remove(name?: string): Promise<void>;
|
|
106
|
+
/** Register models to be used by all states. */
|
|
107
|
+
register(models: Record<string, ModelClass>): void;
|
|
89
108
|
};
|
|
90
109
|
storage: {
|
|
91
110
|
/** Get value from the storage. */
|
|
92
|
-
get
|
|
111
|
+
get: {
|
|
112
|
+
<T = unknown>(key: string): Promise<T | null>;
|
|
113
|
+
<T = unknown>(name: string, key: string): Promise<T | null>;
|
|
114
|
+
};
|
|
93
115
|
/** Set value in the storage. */
|
|
94
|
-
set
|
|
116
|
+
set: {
|
|
117
|
+
<T = unknown>(key: string, value: T): Promise<void>;
|
|
118
|
+
<T = unknown>(name: string, key: string, value: T): Promise<void>;
|
|
119
|
+
};
|
|
95
120
|
/** Delete value from the storage. */
|
|
96
|
-
delete
|
|
121
|
+
delete: {
|
|
122
|
+
(key: string): Promise<void>;
|
|
123
|
+
(name: string, key: string): Promise<void>;
|
|
124
|
+
};
|
|
97
125
|
/** Get all keys from the storage. */
|
|
98
|
-
keys(
|
|
126
|
+
keys(name?: string): Promise<string[]>;
|
|
99
127
|
/** Clear storage. Removes all keys and storage itself. */
|
|
100
|
-
clear(
|
|
128
|
+
clear(name?: string): Promise<void>;
|
|
101
129
|
/** Get storage API for a specific storage. */
|
|
102
|
-
use(
|
|
130
|
+
use(name?: string): Storage;
|
|
103
131
|
/** Get this list of all storages. */
|
|
104
132
|
list(): Promise<{
|
|
105
133
|
name: string | null;
|
|
@@ -107,34 +135,41 @@ interface Epos {
|
|
|
107
135
|
};
|
|
108
136
|
frame: {
|
|
109
137
|
/** Open background frame. */
|
|
110
|
-
open
|
|
111
|
-
|
|
112
|
-
|
|
138
|
+
open: {
|
|
139
|
+
open(url: string): Promise<void>;
|
|
140
|
+
open(url: string, attrs: Attrs): Promise<void>;
|
|
141
|
+
open(name: string, url: string): Promise<void>;
|
|
142
|
+
open(name: string, url: string, attrs: Attrs): Promise<void>;
|
|
143
|
+
};
|
|
144
|
+
/** Close background frame. */
|
|
145
|
+
close(name?: string): Promise<void>;
|
|
113
146
|
/** Check if background frame with the given name exists. */
|
|
114
|
-
exists(name
|
|
147
|
+
exists(name?: string): Promise<boolean>;
|
|
115
148
|
/** Get list of all open background frames. */
|
|
116
149
|
list(): Promise<{
|
|
117
150
|
name: string | null;
|
|
118
151
|
url: string;
|
|
119
152
|
}[]>;
|
|
120
153
|
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
url(path: string): string;
|
|
124
|
-
/** Load either all assets or a specific asset by its path. */
|
|
154
|
+
asset: {
|
|
155
|
+
/** Load either all assets to the memory or a specific asset by its path. */
|
|
125
156
|
load: {
|
|
126
157
|
/** Load all assets. */
|
|
127
158
|
(): Promise<void>;
|
|
128
159
|
/** Load asset by path. */
|
|
129
|
-
(path: string): Promise<
|
|
160
|
+
(path: string): Promise<void>;
|
|
130
161
|
};
|
|
131
|
-
/** Unload either all assets from memory or a specific asset by its path. */
|
|
162
|
+
/** Unload either all assets from the memory or a specific asset by its path. */
|
|
132
163
|
unload: {
|
|
133
|
-
/** Unload all assets
|
|
164
|
+
/** Unload all assets. */
|
|
134
165
|
(): void;
|
|
135
166
|
/** Unload asset by path. */
|
|
136
167
|
(path: string): void;
|
|
137
168
|
};
|
|
169
|
+
/** Get asset URL. The asset must be loaded first via `epos.asset.load`. */
|
|
170
|
+
url(path: string): string;
|
|
171
|
+
/** Get asset as Blob. */
|
|
172
|
+
get(path: string): Promise<Blob | null>;
|
|
138
173
|
/** Get list of all available asset files. */
|
|
139
174
|
list(filter?: {
|
|
140
175
|
loaded?: boolean;
|
|
@@ -145,7 +180,7 @@ interface Epos {
|
|
|
145
180
|
};
|
|
146
181
|
env: {
|
|
147
182
|
tabId: number;
|
|
148
|
-
|
|
183
|
+
project: string;
|
|
149
184
|
isPopup: boolean;
|
|
150
185
|
isSidePanel: boolean;
|
|
151
186
|
isBackground: boolean;
|
|
@@ -159,15 +194,17 @@ interface Epos {
|
|
|
159
194
|
reactJsxRuntime: typeof reactJsxRuntime;
|
|
160
195
|
yjs: typeof yjs;
|
|
161
196
|
};
|
|
197
|
+
symbols: {
|
|
198
|
+
readonly stateParent: symbol;
|
|
199
|
+
readonly stateModelInit: symbol;
|
|
200
|
+
readonly stateModelDispose: symbol;
|
|
201
|
+
readonly stateModelStrict: symbol;
|
|
202
|
+
readonly stateModelVersioner: symbol;
|
|
203
|
+
};
|
|
162
204
|
}
|
|
163
205
|
declare global {
|
|
164
206
|
var epos: Epos;
|
|
165
|
-
namespace React {
|
|
166
|
-
interface HTMLAttributes<T> {
|
|
167
|
-
class?: ClassName;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
207
|
}
|
|
171
208
|
declare const _epos: Epos;
|
|
172
209
|
|
|
173
|
-
export { type
|
|
210
|
+
export { type Arr, type Attrs, type Epos, type Fn, type FnArgsOrArr, type FnResultOrValue, type Initial, type Model, type ModelClass, type Obj, type ReqInit, type Res, type StateConfig, type Storage, type Versioner, _epos as default, _epos as epos };
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "imkost",
|
|
7
7
|
"description": "",
|
|
8
8
|
"keywords": [],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"dev": "tsup --config
|
|
11
|
-
"build": "tsup --config
|
|
10
|
+
"dev": "tsup --config ../../tsup.config.ts --watch --dts-resolve",
|
|
11
|
+
"build": "tsup --config ../../tsup.config.ts --dts-resolve",
|
|
12
12
|
"lint": "tsc --noEmit",
|
|
13
13
|
"release": "sh -c 'npm version ${1:-minor} && npm run build && npm publish' --"
|
|
14
14
|
},
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@parcel/watcher": "^2.5.1",
|
|
36
|
-
"@types/chrome": "^0.1.
|
|
37
|
-
"@types/react": "^19.2.
|
|
38
|
-
"@types/react-dom": "^19.2.
|
|
36
|
+
"@types/chrome": "^0.1.32",
|
|
37
|
+
"@types/react": "^19.2.7",
|
|
38
|
+
"@types/react-dom": "^19.2.3",
|
|
39
39
|
"mobx": "^6.15.0",
|
|
40
40
|
"mobx-react-lite": "^4.1.1",
|
|
41
41
|
"portfinder": "^1.0.38",
|
|
42
|
-
"react": "^19.2.
|
|
42
|
+
"react": "^19.2.3",
|
|
43
43
|
"ws": "^8.18.3",
|
|
44
44
|
"yjs": "^13.6.27"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"vite": "^7.
|
|
47
|
+
"vite": "^7.3.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"vite": "^7.
|
|
50
|
+
"vite": "^7.3.0"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/chrome.d.ts
ADDED
package/src/epos.ts
CHANGED
|
@@ -5,41 +5,51 @@ import type * as reactDom from 'react-dom'
|
|
|
5
5
|
import type * as reactDomClient from 'react-dom/client'
|
|
6
6
|
import type * as reactJsxRuntime from 'react/jsx-runtime'
|
|
7
7
|
import type * as yjs from 'yjs'
|
|
8
|
-
import './chrome
|
|
8
|
+
import type { Chrome } from './chrome.ts'
|
|
9
9
|
|
|
10
10
|
export type Fn<T = any> = (...args: any[]) => T
|
|
11
11
|
export type Obj = Record<string, unknown>
|
|
12
|
+
export type Arr = unknown[]
|
|
12
13
|
export type Versioner = Record<number, (this: any, state: any) => void>
|
|
13
|
-
export type ClassName = string | null | boolean | undefined | ClassName[]
|
|
14
14
|
export type ModelClass = new (...args: any[]) => any
|
|
15
15
|
export type Model = InstanceType<ModelClass>
|
|
16
16
|
export type Initial<T extends Obj | Model> = T | (() => T)
|
|
17
|
+
export type Attrs = Record<string, string | number>
|
|
18
|
+
export type FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr
|
|
19
|
+
export type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T
|
|
17
20
|
|
|
18
21
|
export type StateConfig = {
|
|
19
22
|
allowMissingModels?: boolean | string[]
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
export type ReqInit =
|
|
23
|
-
RequestInit
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Response
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
export type ReqInit = {
|
|
26
|
+
body: RequestInit['body']
|
|
27
|
+
cache: RequestInit['cache']
|
|
28
|
+
credentials: RequestInit['credentials']
|
|
29
|
+
headers: RequestInit['headers']
|
|
30
|
+
integrity: RequestInit['integrity']
|
|
31
|
+
keepalive: RequestInit['keepalive']
|
|
32
|
+
method: RequestInit['method']
|
|
33
|
+
mode: RequestInit['mode']
|
|
34
|
+
priority: RequestInit['priority']
|
|
35
|
+
redirect: RequestInit['redirect']
|
|
36
|
+
referrer: RequestInit['referrer']
|
|
37
|
+
referrerPolicy: RequestInit['referrerPolicy']
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type Res = {
|
|
41
|
+
ok: Response['ok']
|
|
42
|
+
url: Response['url']
|
|
43
|
+
type: Response['type']
|
|
44
|
+
status: Response['status']
|
|
45
|
+
statusText: Response['statusText']
|
|
46
|
+
redirected: Response['redirected']
|
|
47
|
+
text: Response['text']
|
|
48
|
+
json: Response['json']
|
|
49
|
+
blob: Response['blob']
|
|
50
|
+
headers: {
|
|
51
|
+
get: Response['headers']['get']
|
|
52
|
+
has: Response['headers']['has']
|
|
43
53
|
/** Get list of all header keys. */
|
|
44
54
|
keys: () => string[]
|
|
45
55
|
}
|
|
@@ -47,9 +57,9 @@ export type Res = Pick<
|
|
|
47
57
|
|
|
48
58
|
export type Storage = {
|
|
49
59
|
/** Get value from the storage. */
|
|
50
|
-
get<T = unknown>(key: string): Promise<T>
|
|
60
|
+
get<T = unknown>(key: string): Promise<T | null>
|
|
51
61
|
/** Set value in the storage. */
|
|
52
|
-
set
|
|
62
|
+
set(key: string, value: unknown): Promise<void>
|
|
53
63
|
/** Delete value from the storage. */
|
|
54
64
|
delete(key: string): Promise<void>
|
|
55
65
|
/** Get all keys from the storage. */
|
|
@@ -61,25 +71,25 @@ export type Storage = {
|
|
|
61
71
|
export interface Epos {
|
|
62
72
|
// General
|
|
63
73
|
fetch: (url: string | URL, init?: ReqInit) => Promise<Res>
|
|
64
|
-
browser:
|
|
65
|
-
element: HTMLDivElement
|
|
74
|
+
browser: Chrome
|
|
66
75
|
render(node: react.ReactNode, container?: reactDomClient.Container): void
|
|
67
76
|
component<T>(Component: react.FC<T>): typeof Component
|
|
77
|
+
element: HTMLDivElement
|
|
68
78
|
|
|
69
79
|
// Bus
|
|
70
80
|
bus: {
|
|
71
81
|
/** Listen for an event. */
|
|
72
|
-
on(
|
|
82
|
+
on<T extends Fn>(name: string, callback: T, thisArg?: unknown): void
|
|
73
83
|
/** Remove event listener. */
|
|
74
|
-
off(
|
|
84
|
+
off<T extends Fn>(name: string, callback?: T): void
|
|
75
85
|
/** Listen for an event once. */
|
|
76
|
-
once(
|
|
86
|
+
once<T extends Fn>(name: string, callback: T, thisArg?: unknown): void
|
|
77
87
|
/** Send an event to all remote listeners (local listeners are ignored). */
|
|
78
|
-
send<T = unknown>(
|
|
88
|
+
send<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>
|
|
79
89
|
/** Emit event locally (calls local listeners only). */
|
|
80
|
-
emit<T = unknown>(
|
|
90
|
+
emit<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>
|
|
81
91
|
setSignal(name: string, value?: unknown): void
|
|
82
|
-
waitSignal<T>(name: string, timeout?: number): Promise<T>
|
|
92
|
+
waitSignal<T = unknown>(name: string, timeout?: number): Promise<T>
|
|
83
93
|
}
|
|
84
94
|
|
|
85
95
|
// State
|
|
@@ -95,37 +105,37 @@ export interface Epos {
|
|
|
95
105
|
transaction: (fn: () => void) => void
|
|
96
106
|
/** Create local state (no sync). */
|
|
97
107
|
local<T extends Obj = {}>(state?: T): T
|
|
98
|
-
/** Configure state. */
|
|
99
|
-
configure: (config: StateConfig) => void
|
|
100
108
|
/** Get the list of all state names. */
|
|
101
109
|
list(filter?: { connected?: boolean }): Promise<{ name: string | null }[]>
|
|
102
110
|
/** Remove state and all its data. */
|
|
103
|
-
|
|
104
|
-
/** Register models
|
|
105
|
-
|
|
106
|
-
symbols: {
|
|
107
|
-
readonly parent: unique symbol
|
|
108
|
-
readonly modelInit: unique symbol
|
|
109
|
-
readonly modelCleanup: unique symbol
|
|
110
|
-
readonly modelStrict: unique symbol
|
|
111
|
-
readonly modelVersioner: unique symbol
|
|
112
|
-
}
|
|
111
|
+
remove(name?: string): Promise<void>
|
|
112
|
+
/** Register models to be used by all states. */
|
|
113
|
+
register(models: Record<string, ModelClass>): void
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
// Storage
|
|
116
117
|
storage: {
|
|
117
118
|
/** Get value from the storage. */
|
|
118
|
-
get
|
|
119
|
+
get: {
|
|
120
|
+
<T = unknown>(key: string): Promise<T | null>
|
|
121
|
+
<T = unknown>(name: string, key: string): Promise<T | null>
|
|
122
|
+
}
|
|
119
123
|
/** Set value in the storage. */
|
|
120
|
-
set
|
|
124
|
+
set: {
|
|
125
|
+
<T = unknown>(key: string, value: T): Promise<void>
|
|
126
|
+
<T = unknown>(name: string, key: string, value: T): Promise<void>
|
|
127
|
+
}
|
|
121
128
|
/** Delete value from the storage. */
|
|
122
|
-
delete
|
|
129
|
+
delete: {
|
|
130
|
+
(key: string): Promise<void>
|
|
131
|
+
(name: string, key: string): Promise<void>
|
|
132
|
+
}
|
|
123
133
|
/** Get all keys from the storage. */
|
|
124
|
-
keys(
|
|
134
|
+
keys(name?: string): Promise<string[]>
|
|
125
135
|
/** Clear storage. Removes all keys and storage itself. */
|
|
126
|
-
clear(
|
|
136
|
+
clear(name?: string): Promise<void>
|
|
127
137
|
/** Get storage API for a specific storage. */
|
|
128
|
-
use(
|
|
138
|
+
use(name?: string): Storage
|
|
129
139
|
/** Get this list of all storages. */
|
|
130
140
|
list(): Promise<{ name: string | null }[]>
|
|
131
141
|
}
|
|
@@ -133,33 +143,40 @@ export interface Epos {
|
|
|
133
143
|
// Frame
|
|
134
144
|
frame: {
|
|
135
145
|
/** Open background frame. */
|
|
136
|
-
open
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
open: {
|
|
147
|
+
open(url: string): Promise<void>
|
|
148
|
+
open(url: string, attrs: Attrs): Promise<void>
|
|
149
|
+
open(name: string, url: string): Promise<void>
|
|
150
|
+
open(name: string, url: string, attrs: Attrs): Promise<void>
|
|
151
|
+
}
|
|
152
|
+
/** Close background frame. */
|
|
153
|
+
close(name?: string): Promise<void>
|
|
139
154
|
/** Check if background frame with the given name exists. */
|
|
140
|
-
exists(name
|
|
155
|
+
exists(name?: string): Promise<boolean>
|
|
141
156
|
/** Get list of all open background frames. */
|
|
142
157
|
list(): Promise<{ name: string | null; url: string }[]>
|
|
143
158
|
}
|
|
144
159
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
url(path: string): string
|
|
149
|
-
/** Load either all assets or a specific asset by its path. */
|
|
160
|
+
// Asset
|
|
161
|
+
asset: {
|
|
162
|
+
/** Load either all assets to the memory or a specific asset by its path. */
|
|
150
163
|
load: {
|
|
151
164
|
/** Load all assets. */
|
|
152
165
|
(): Promise<void>
|
|
153
166
|
/** Load asset by path. */
|
|
154
|
-
(path: string): Promise<
|
|
167
|
+
(path: string): Promise<void>
|
|
155
168
|
}
|
|
156
|
-
/** Unload either all assets from memory or a specific asset by its path. */
|
|
169
|
+
/** Unload either all assets from the memory or a specific asset by its path. */
|
|
157
170
|
unload: {
|
|
158
|
-
/** Unload all assets
|
|
171
|
+
/** Unload all assets. */
|
|
159
172
|
(): void
|
|
160
173
|
/** Unload asset by path. */
|
|
161
174
|
(path: string): void
|
|
162
175
|
}
|
|
176
|
+
/** Get asset URL. The asset must be loaded first via `epos.asset.load`. */
|
|
177
|
+
url(path: string): string
|
|
178
|
+
/** Get asset as Blob. */
|
|
179
|
+
get(path: string): Promise<Blob | null>
|
|
163
180
|
/** Get list of all available asset files. */
|
|
164
181
|
list(filter?: { loaded?: boolean }): { path: string; loaded: boolean }[]
|
|
165
182
|
}
|
|
@@ -167,7 +184,7 @@ export interface Epos {
|
|
|
167
184
|
// Env
|
|
168
185
|
env: {
|
|
169
186
|
tabId: number
|
|
170
|
-
|
|
187
|
+
project: string
|
|
171
188
|
isPopup: boolean
|
|
172
189
|
isSidePanel: boolean
|
|
173
190
|
isBackground: boolean
|
|
@@ -183,16 +200,19 @@ export interface Epos {
|
|
|
183
200
|
reactJsxRuntime: typeof reactJsxRuntime
|
|
184
201
|
yjs: typeof yjs
|
|
185
202
|
}
|
|
203
|
+
|
|
204
|
+
// Internal symbols
|
|
205
|
+
symbols: {
|
|
206
|
+
readonly stateParent: symbol
|
|
207
|
+
readonly stateModelInit: symbol
|
|
208
|
+
readonly stateModelDispose: symbol
|
|
209
|
+
readonly stateModelStrict: symbol
|
|
210
|
+
readonly stateModelVersioner: symbol
|
|
211
|
+
}
|
|
186
212
|
}
|
|
187
213
|
|
|
188
214
|
declare global {
|
|
189
215
|
var epos: Epos
|
|
190
|
-
|
|
191
|
-
namespace React {
|
|
192
|
-
interface HTMLAttributes<T> {
|
|
193
|
-
class?: ClassName
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
216
|
}
|
|
197
217
|
|
|
198
218
|
const _epos = epos
|
package/dist/chrome-types.d.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="chrome" />
|
package/src/chrome-types.d.ts
DELETED
|
File without changes
|