epos 1.40.1 → 1.42.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/epos.d.ts +39 -29
- package/dist/epos.js.map +1 -1
- package/package.json +2 -2
package/dist/epos.d.ts
CHANGED
|
@@ -15,13 +15,15 @@ export type Instance<T> = T extends object ? Exclude<T, Obj | Arr | Fn> : never;
|
|
|
15
15
|
export type FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr;
|
|
16
16
|
export type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T;
|
|
17
17
|
export type Attrs = Record<string, string | number>;
|
|
18
|
+
export type Asyncify<T> = T extends Fn ? (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>> : T extends object ? {
|
|
19
|
+
[K in keyof T]: Asyncify<T[K]>;
|
|
20
|
+
} : T;
|
|
18
21
|
export type Root<T> = Initial<T> & {
|
|
19
22
|
':version'?: number;
|
|
20
23
|
};
|
|
21
24
|
export type Initial<T> = T extends Obj ? T : Instance<T>;
|
|
22
25
|
export type Versioner<T> = Record<number, (this: Root<T>, state: Root<T>) => void>;
|
|
23
26
|
export type { Browser, Spec };
|
|
24
|
-
export type Mode = 'development' | 'production';
|
|
25
27
|
export type Manifest = chrome.runtime.ManifestV3;
|
|
26
28
|
export type Sources = {
|
|
27
29
|
[path: string]: string;
|
|
@@ -35,7 +37,7 @@ export type Bundle = {
|
|
|
35
37
|
assets: Assets;
|
|
36
38
|
};
|
|
37
39
|
export type ProjectSettings = {
|
|
38
|
-
|
|
40
|
+
debug: boolean;
|
|
39
41
|
enabled: boolean;
|
|
40
42
|
};
|
|
41
43
|
export type ProjectQuery = {
|
|
@@ -44,7 +46,7 @@ export type ProjectQuery = {
|
|
|
44
46
|
};
|
|
45
47
|
export type ProjectBase = {
|
|
46
48
|
id: string;
|
|
47
|
-
|
|
49
|
+
debug: boolean;
|
|
48
50
|
enabled: boolean;
|
|
49
51
|
spec: Spec;
|
|
50
52
|
manifest: Manifest;
|
|
@@ -101,16 +103,14 @@ export interface Epos {
|
|
|
101
103
|
component<T>(Component: react.FC<T>): react.FC<T>;
|
|
102
104
|
container: HTMLDivElement;
|
|
103
105
|
env: {
|
|
104
|
-
/** `tabId` is `-1` for iframes
|
|
106
|
+
/** `tabId` is `-1` for `<background>`, regular iframes and iframes created with `epos.frames.create`. */
|
|
105
107
|
tabId: -1 | number;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
mode: Mode;
|
|
109
|
-
spec: Spec;
|
|
110
|
-
};
|
|
108
|
+
/** `windowId` is `-1` for `<background>`, regular iframes and iframes created with `epos.frames.create`. */
|
|
109
|
+
windowId: -1 | number;
|
|
111
110
|
isPopup: boolean;
|
|
112
111
|
isSidePanel: boolean;
|
|
113
112
|
isBackground: boolean;
|
|
113
|
+
project: ProjectBase;
|
|
114
114
|
};
|
|
115
115
|
bus: {
|
|
116
116
|
/** Register event listener. */
|
|
@@ -123,6 +123,12 @@ export interface Epos {
|
|
|
123
123
|
send<T>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T> | null>;
|
|
124
124
|
/** Call local listeners (remote listeners ignored). */
|
|
125
125
|
emit<T>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T> | null>;
|
|
126
|
+
/** Register RPC API. */
|
|
127
|
+
register(id: string, api: unknown): void;
|
|
128
|
+
/** Unregister RPC API. */
|
|
129
|
+
unregister(id: string): void;
|
|
130
|
+
/** Get RPC API proxy. */
|
|
131
|
+
use<T>(id: string): Asyncify<T>;
|
|
126
132
|
/** Set signal with optional value. */
|
|
127
133
|
setSignal(name: string, value?: unknown): void;
|
|
128
134
|
/** Wait for signal to be set. */
|
|
@@ -145,6 +151,7 @@ export interface Epos {
|
|
|
145
151
|
connected?: boolean;
|
|
146
152
|
}): Promise<{
|
|
147
153
|
name: string | null;
|
|
154
|
+
connected: boolean;
|
|
148
155
|
}[]>;
|
|
149
156
|
/** Remove state and all its data. */
|
|
150
157
|
remove(name?: string): Promise<void>;
|
|
@@ -172,8 +179,6 @@ export interface Epos {
|
|
|
172
179
|
};
|
|
173
180
|
/** Get all storage keys. */
|
|
174
181
|
keys(name?: string): Promise<string[]>;
|
|
175
|
-
/** Remove storage. */
|
|
176
|
-
remove(name?: string): Promise<void>;
|
|
177
182
|
/** Get storage API for specific storage. */
|
|
178
183
|
use(name?: string): {
|
|
179
184
|
/** Get value from storage. */
|
|
@@ -184,11 +189,16 @@ export interface Epos {
|
|
|
184
189
|
delete(key: string): Promise<void>;
|
|
185
190
|
/** Get all keys from storage. */
|
|
186
191
|
keys(): Promise<string[]>;
|
|
187
|
-
/** Remove storage. */
|
|
192
|
+
/** Remove storage and all its data. */
|
|
188
193
|
remove(): Promise<void>;
|
|
189
194
|
};
|
|
190
|
-
/** Get list of all
|
|
191
|
-
list(): Promise<
|
|
195
|
+
/** Get list of all storages. */
|
|
196
|
+
list(): Promise<{
|
|
197
|
+
name: string | null;
|
|
198
|
+
keys: string[];
|
|
199
|
+
}[]>;
|
|
200
|
+
/** Remove storage and all its data. */
|
|
201
|
+
remove(name?: string): Promise<void>;
|
|
192
202
|
};
|
|
193
203
|
frames: {
|
|
194
204
|
/** Open background frame. */
|
|
@@ -204,6 +214,17 @@ export interface Epos {
|
|
|
204
214
|
}[]>;
|
|
205
215
|
};
|
|
206
216
|
assets: {
|
|
217
|
+
/** Get asset URL. Asset must be loaded first via `epos.assets.load`. */
|
|
218
|
+
url(path: string): string;
|
|
219
|
+
/** Get asset as Blob. */
|
|
220
|
+
get(path: string): Promise<Blob | null>;
|
|
221
|
+
/** Get list of all available assets. */
|
|
222
|
+
list(filter?: {
|
|
223
|
+
loaded?: boolean;
|
|
224
|
+
}): {
|
|
225
|
+
path: string;
|
|
226
|
+
loaded: boolean;
|
|
227
|
+
}[];
|
|
207
228
|
/** Load specified asset to memory. Load all assets if no path is provided. */
|
|
208
229
|
load: {
|
|
209
230
|
/** Load all assets. */
|
|
@@ -218,30 +239,19 @@ export interface Epos {
|
|
|
218
239
|
/** Unload asset by path. */
|
|
219
240
|
(path: string): void;
|
|
220
241
|
};
|
|
221
|
-
/** Get asset URL. Asset must be loaded first via `epos.assets.load`. */
|
|
222
|
-
url(path: string): string;
|
|
223
|
-
/** Get asset as Blob. */
|
|
224
|
-
get(path: string): Promise<Blob | null>;
|
|
225
|
-
/** Get list of all available assets. */
|
|
226
|
-
list(filter?: {
|
|
227
|
-
loaded?: boolean;
|
|
228
|
-
}): {
|
|
229
|
-
path: string;
|
|
230
|
-
loaded: boolean;
|
|
231
|
-
}[];
|
|
232
242
|
};
|
|
233
243
|
projects: {
|
|
234
|
-
get<T extends ProjectQuery>(id: string, query?: T): Promise<Project<T> | null>;
|
|
235
244
|
has(id: string): Promise<boolean>;
|
|
245
|
+
get<T extends ProjectQuery>(id: string, query?: T): Promise<Project<T> | null>;
|
|
236
246
|
list<T extends ProjectQuery>(query?: T): Promise<Project<T>[]>;
|
|
237
|
-
watch(listener: () => void): void;
|
|
238
|
-
fetch(url: string): Promise<Bundle>;
|
|
239
247
|
create<T extends string>(params: Bundle & Partial<{
|
|
240
248
|
id: T;
|
|
241
249
|
} & ProjectSettings>): Promise<T>;
|
|
242
250
|
update(id: string, updates: Partial<Bundle & ProjectSettings>): Promise<void>;
|
|
243
251
|
remove(id: string): Promise<void>;
|
|
244
|
-
export(id: string,
|
|
252
|
+
export(id: string, debug?: boolean): Promise<Record<string, Blob>>;
|
|
253
|
+
watch(listener: () => void): void;
|
|
254
|
+
fetch(url: string): Promise<Bundle>;
|
|
245
255
|
};
|
|
246
256
|
libs: {
|
|
247
257
|
mobx: typeof mobx;
|
package/dist/epos.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epos.js","sourceRoot":"","sources":["../src/epos.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"epos.js","sourceRoot":"","sources":["../src/epos.ts"],"names":[],"mappings":"AA8OA,MAAM,KAAK,GAAG,IAAI,CAAA;AAClB,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA;AAExB,eAAe,IAAI,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "imkost",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/chrome": "^0.1.36",
|
|
25
25
|
"@types/react": "^19.2.9",
|
|
26
26
|
"@types/react-dom": "^19.2.3",
|
|
27
|
-
"epos-spec": "^1.
|
|
27
|
+
"epos-spec": "^1.10.0",
|
|
28
28
|
"mobx": "^6.15.0",
|
|
29
29
|
"mobx-react-lite": "^4.1.1",
|
|
30
30
|
"portfinder": "^1.0.38",
|