epos 1.26.0 → 1.28.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 +77 -46
- package/package.json +9 -9
- package/src/chrome.d.ts +3 -0
- package/src/epos.ts +80 -66
- 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,56 @@ 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 FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr;
|
|
18
|
+
type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T;
|
|
16
19
|
type StateConfig = {
|
|
17
20
|
allowMissingModels?: boolean | string[];
|
|
18
21
|
};
|
|
19
|
-
type ReqInit =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
type ReqInit = {
|
|
23
|
+
body: RequestInit['body'];
|
|
24
|
+
cache: RequestInit['cache'];
|
|
25
|
+
credentials: RequestInit['credentials'];
|
|
26
|
+
headers: RequestInit['headers'];
|
|
27
|
+
integrity: RequestInit['integrity'];
|
|
28
|
+
keepalive: RequestInit['keepalive'];
|
|
29
|
+
method: RequestInit['method'];
|
|
30
|
+
mode: RequestInit['mode'];
|
|
31
|
+
priority: RequestInit['priority'];
|
|
32
|
+
redirect: RequestInit['redirect'];
|
|
33
|
+
referrer: RequestInit['referrer'];
|
|
34
|
+
referrerPolicy: RequestInit['referrerPolicy'];
|
|
35
|
+
};
|
|
36
|
+
type Res = {
|
|
37
|
+
ok: Response['ok'];
|
|
38
|
+
url: Response['url'];
|
|
39
|
+
type: Response['type'];
|
|
40
|
+
status: Response['status'];
|
|
41
|
+
statusText: Response['statusText'];
|
|
42
|
+
redirected: Response['redirected'];
|
|
43
|
+
text: Response['text'];
|
|
44
|
+
json: Response['json'];
|
|
45
|
+
blob: Response['blob'];
|
|
46
|
+
headers: {
|
|
47
|
+
get: Response['headers']['get'];
|
|
48
|
+
has: Response['headers']['has'];
|
|
22
49
|
/** Get list of all header keys. */
|
|
23
50
|
keys: () => string[];
|
|
24
51
|
};
|
|
25
52
|
};
|
|
26
53
|
type Storage = {
|
|
27
54
|
/** Get value from the storage. */
|
|
28
|
-
get<T = unknown>(key: string): Promise<T>;
|
|
55
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
29
56
|
/** Set value in the storage. */
|
|
30
|
-
set
|
|
57
|
+
set(key: string, value: unknown): Promise<void>;
|
|
31
58
|
/** Delete value from the storage. */
|
|
32
59
|
delete(key: string): Promise<void>;
|
|
33
60
|
/** Get all keys from the storage. */
|
|
@@ -37,23 +64,23 @@ type Storage = {
|
|
|
37
64
|
};
|
|
38
65
|
interface Epos {
|
|
39
66
|
fetch: (url: string | URL, init?: ReqInit) => Promise<Res>;
|
|
40
|
-
browser:
|
|
41
|
-
element: HTMLDivElement;
|
|
67
|
+
browser: Chrome;
|
|
42
68
|
render(node: react.ReactNode, container?: reactDomClient.Container): void;
|
|
43
69
|
component<T>(Component: react.FC<T>): typeof Component;
|
|
70
|
+
element: HTMLDivElement;
|
|
44
71
|
bus: {
|
|
45
72
|
/** Listen for an event. */
|
|
46
|
-
on(
|
|
73
|
+
on<T extends Fn>(name: string, callback: T, thisArg?: unknown): void;
|
|
47
74
|
/** Remove event listener. */
|
|
48
|
-
off(
|
|
75
|
+
off<T extends Fn>(name: string, callback?: T): void;
|
|
49
76
|
/** Listen for an event once. */
|
|
50
|
-
once(
|
|
77
|
+
once<T extends Fn>(name: string, callback: T, thisArg?: unknown): void;
|
|
51
78
|
/** Send an event to all remote listeners (local listeners are ignored). */
|
|
52
|
-
send<T = unknown>(
|
|
79
|
+
send<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>;
|
|
53
80
|
/** Emit event locally (calls local listeners only). */
|
|
54
|
-
emit<T = unknown>(
|
|
81
|
+
emit<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>;
|
|
55
82
|
setSignal(name: string, value?: unknown): void;
|
|
56
|
-
waitSignal<T>(name: string, timeout?: number): Promise<T>;
|
|
83
|
+
waitSignal<T = unknown>(name: string, timeout?: number): Promise<T>;
|
|
57
84
|
};
|
|
58
85
|
state: {
|
|
59
86
|
/** Connect state. */
|
|
@@ -67,8 +94,6 @@ interface Epos {
|
|
|
67
94
|
transaction: (fn: () => void) => void;
|
|
68
95
|
/** Create local state (no sync). */
|
|
69
96
|
local<T extends Obj = {}>(state?: T): T;
|
|
70
|
-
/** Configure state. */
|
|
71
|
-
configure: (config: StateConfig) => void;
|
|
72
97
|
/** Get the list of all state names. */
|
|
73
98
|
list(filter?: {
|
|
74
99
|
connected?: boolean;
|
|
@@ -76,30 +101,32 @@ interface Epos {
|
|
|
76
101
|
name: string | null;
|
|
77
102
|
}[]>;
|
|
78
103
|
/** 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
|
-
};
|
|
104
|
+
remove(name?: string): Promise<void>;
|
|
105
|
+
/** Register models to be used by all states. */
|
|
106
|
+
register(models: Record<string, ModelClass>): void;
|
|
89
107
|
};
|
|
90
108
|
storage: {
|
|
91
109
|
/** Get value from the storage. */
|
|
92
|
-
get
|
|
110
|
+
get: {
|
|
111
|
+
<T = unknown>(key: string): Promise<T | null>;
|
|
112
|
+
<T = unknown>(name: string, key: string): Promise<T | null>;
|
|
113
|
+
};
|
|
93
114
|
/** Set value in the storage. */
|
|
94
|
-
set
|
|
115
|
+
set: {
|
|
116
|
+
<T = unknown>(key: string, value: T): Promise<void>;
|
|
117
|
+
<T = unknown>(name: string, key: string, value: T): Promise<void>;
|
|
118
|
+
};
|
|
95
119
|
/** Delete value from the storage. */
|
|
96
|
-
delete
|
|
120
|
+
delete: {
|
|
121
|
+
(key: string): Promise<void>;
|
|
122
|
+
(name: string, key: string): Promise<void>;
|
|
123
|
+
};
|
|
97
124
|
/** Get all keys from the storage. */
|
|
98
|
-
keys(
|
|
125
|
+
keys(name?: string): Promise<string[]>;
|
|
99
126
|
/** Clear storage. Removes all keys and storage itself. */
|
|
100
|
-
clear(
|
|
127
|
+
clear(name?: string): Promise<void>;
|
|
101
128
|
/** Get storage API for a specific storage. */
|
|
102
|
-
use(
|
|
129
|
+
use(name?: string): Storage;
|
|
103
130
|
/** Get this list of all storages. */
|
|
104
131
|
list(): Promise<{
|
|
105
132
|
name: string | null;
|
|
@@ -118,23 +145,25 @@ interface Epos {
|
|
|
118
145
|
url: string;
|
|
119
146
|
}[]>;
|
|
120
147
|
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
url(path: string): string;
|
|
124
|
-
/** Load either all assets or a specific asset by its path. */
|
|
148
|
+
asset: {
|
|
149
|
+
/** Load either all assets to the memory or a specific asset by its path. */
|
|
125
150
|
load: {
|
|
126
151
|
/** Load all assets. */
|
|
127
152
|
(): Promise<void>;
|
|
128
153
|
/** Load asset by path. */
|
|
129
|
-
(path: string): Promise<
|
|
154
|
+
(path: string): Promise<void>;
|
|
130
155
|
};
|
|
131
|
-
/** Unload either all assets from memory or a specific asset by its path. */
|
|
156
|
+
/** Unload either all assets from the memory or a specific asset by its path. */
|
|
132
157
|
unload: {
|
|
133
|
-
/** Unload all assets
|
|
158
|
+
/** Unload all assets. */
|
|
134
159
|
(): void;
|
|
135
160
|
/** Unload asset by path. */
|
|
136
161
|
(path: string): void;
|
|
137
162
|
};
|
|
163
|
+
/** Get asset URL. The asset must be loaded first via `epos.asset.load`. */
|
|
164
|
+
url(path: string): string;
|
|
165
|
+
/** Get asset as Blob. */
|
|
166
|
+
get(path: string): Promise<Blob | null>;
|
|
138
167
|
/** Get list of all available asset files. */
|
|
139
168
|
list(filter?: {
|
|
140
169
|
loaded?: boolean;
|
|
@@ -145,7 +174,7 @@ interface Epos {
|
|
|
145
174
|
};
|
|
146
175
|
env: {
|
|
147
176
|
tabId: number;
|
|
148
|
-
|
|
177
|
+
project: string;
|
|
149
178
|
isPopup: boolean;
|
|
150
179
|
isSidePanel: boolean;
|
|
151
180
|
isBackground: boolean;
|
|
@@ -159,15 +188,17 @@ interface Epos {
|
|
|
159
188
|
reactJsxRuntime: typeof reactJsxRuntime;
|
|
160
189
|
yjs: typeof yjs;
|
|
161
190
|
};
|
|
191
|
+
symbols: {
|
|
192
|
+
readonly stateParent: symbol;
|
|
193
|
+
readonly stateModelInit: symbol;
|
|
194
|
+
readonly stateModelDispose: symbol;
|
|
195
|
+
readonly stateModelStrict: symbol;
|
|
196
|
+
readonly stateModelVersioner: symbol;
|
|
197
|
+
};
|
|
162
198
|
}
|
|
163
199
|
declare global {
|
|
164
200
|
var epos: Epos;
|
|
165
|
-
namespace React {
|
|
166
|
-
interface HTMLAttributes<T> {
|
|
167
|
-
class?: ClassName;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
201
|
}
|
|
171
202
|
declare const _epos: Epos;
|
|
172
203
|
|
|
173
|
-
export { type
|
|
204
|
+
export { type Arr, 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.28.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,50 @@ 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 FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr
|
|
18
|
+
export type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T
|
|
17
19
|
|
|
18
20
|
export type StateConfig = {
|
|
19
21
|
allowMissingModels?: boolean | string[]
|
|
20
22
|
}
|
|
21
23
|
|
|
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
|
-
|
|
24
|
+
export type ReqInit = {
|
|
25
|
+
body: RequestInit['body']
|
|
26
|
+
cache: RequestInit['cache']
|
|
27
|
+
credentials: RequestInit['credentials']
|
|
28
|
+
headers: RequestInit['headers']
|
|
29
|
+
integrity: RequestInit['integrity']
|
|
30
|
+
keepalive: RequestInit['keepalive']
|
|
31
|
+
method: RequestInit['method']
|
|
32
|
+
mode: RequestInit['mode']
|
|
33
|
+
priority: RequestInit['priority']
|
|
34
|
+
redirect: RequestInit['redirect']
|
|
35
|
+
referrer: RequestInit['referrer']
|
|
36
|
+
referrerPolicy: RequestInit['referrerPolicy']
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type Res = {
|
|
40
|
+
ok: Response['ok']
|
|
41
|
+
url: Response['url']
|
|
42
|
+
type: Response['type']
|
|
43
|
+
status: Response['status']
|
|
44
|
+
statusText: Response['statusText']
|
|
45
|
+
redirected: Response['redirected']
|
|
46
|
+
text: Response['text']
|
|
47
|
+
json: Response['json']
|
|
48
|
+
blob: Response['blob']
|
|
49
|
+
headers: {
|
|
50
|
+
get: Response['headers']['get']
|
|
51
|
+
has: Response['headers']['has']
|
|
43
52
|
/** Get list of all header keys. */
|
|
44
53
|
keys: () => string[]
|
|
45
54
|
}
|
|
@@ -47,9 +56,9 @@ export type Res = Pick<
|
|
|
47
56
|
|
|
48
57
|
export type Storage = {
|
|
49
58
|
/** Get value from the storage. */
|
|
50
|
-
get<T = unknown>(key: string): Promise<T>
|
|
59
|
+
get<T = unknown>(key: string): Promise<T | null>
|
|
51
60
|
/** Set value in the storage. */
|
|
52
|
-
set
|
|
61
|
+
set(key: string, value: unknown): Promise<void>
|
|
53
62
|
/** Delete value from the storage. */
|
|
54
63
|
delete(key: string): Promise<void>
|
|
55
64
|
/** Get all keys from the storage. */
|
|
@@ -61,25 +70,25 @@ export type Storage = {
|
|
|
61
70
|
export interface Epos {
|
|
62
71
|
// General
|
|
63
72
|
fetch: (url: string | URL, init?: ReqInit) => Promise<Res>
|
|
64
|
-
browser:
|
|
65
|
-
element: HTMLDivElement
|
|
73
|
+
browser: Chrome
|
|
66
74
|
render(node: react.ReactNode, container?: reactDomClient.Container): void
|
|
67
75
|
component<T>(Component: react.FC<T>): typeof Component
|
|
76
|
+
element: HTMLDivElement
|
|
68
77
|
|
|
69
78
|
// Bus
|
|
70
79
|
bus: {
|
|
71
80
|
/** Listen for an event. */
|
|
72
|
-
on(
|
|
81
|
+
on<T extends Fn>(name: string, callback: T, thisArg?: unknown): void
|
|
73
82
|
/** Remove event listener. */
|
|
74
|
-
off(
|
|
83
|
+
off<T extends Fn>(name: string, callback?: T): void
|
|
75
84
|
/** Listen for an event once. */
|
|
76
|
-
once(
|
|
85
|
+
once<T extends Fn>(name: string, callback: T, thisArg?: unknown): void
|
|
77
86
|
/** Send an event to all remote listeners (local listeners are ignored). */
|
|
78
|
-
send<T = unknown>(
|
|
87
|
+
send<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>
|
|
79
88
|
/** Emit event locally (calls local listeners only). */
|
|
80
|
-
emit<T = unknown>(
|
|
89
|
+
emit<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T>>
|
|
81
90
|
setSignal(name: string, value?: unknown): void
|
|
82
|
-
waitSignal<T>(name: string, timeout?: number): Promise<T>
|
|
91
|
+
waitSignal<T = unknown>(name: string, timeout?: number): Promise<T>
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
// State
|
|
@@ -95,37 +104,37 @@ export interface Epos {
|
|
|
95
104
|
transaction: (fn: () => void) => void
|
|
96
105
|
/** Create local state (no sync). */
|
|
97
106
|
local<T extends Obj = {}>(state?: T): T
|
|
98
|
-
/** Configure state. */
|
|
99
|
-
configure: (config: StateConfig) => void
|
|
100
107
|
/** Get the list of all state names. */
|
|
101
108
|
list(filter?: { connected?: boolean }): Promise<{ name: string | null }[]>
|
|
102
109
|
/** 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
|
-
}
|
|
110
|
+
remove(name?: string): Promise<void>
|
|
111
|
+
/** Register models to be used by all states. */
|
|
112
|
+
register(models: Record<string, ModelClass>): void
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// Storage
|
|
116
116
|
storage: {
|
|
117
117
|
/** Get value from the storage. */
|
|
118
|
-
get
|
|
118
|
+
get: {
|
|
119
|
+
<T = unknown>(key: string): Promise<T | null>
|
|
120
|
+
<T = unknown>(name: string, key: string): Promise<T | null>
|
|
121
|
+
}
|
|
119
122
|
/** Set value in the storage. */
|
|
120
|
-
set
|
|
123
|
+
set: {
|
|
124
|
+
<T = unknown>(key: string, value: T): Promise<void>
|
|
125
|
+
<T = unknown>(name: string, key: string, value: T): Promise<void>
|
|
126
|
+
}
|
|
121
127
|
/** Delete value from the storage. */
|
|
122
|
-
delete
|
|
128
|
+
delete: {
|
|
129
|
+
(key: string): Promise<void>
|
|
130
|
+
(name: string, key: string): Promise<void>
|
|
131
|
+
}
|
|
123
132
|
/** Get all keys from the storage. */
|
|
124
|
-
keys(
|
|
133
|
+
keys(name?: string): Promise<string[]>
|
|
125
134
|
/** Clear storage. Removes all keys and storage itself. */
|
|
126
|
-
clear(
|
|
135
|
+
clear(name?: string): Promise<void>
|
|
127
136
|
/** Get storage API for a specific storage. */
|
|
128
|
-
use(
|
|
137
|
+
use(name?: string): Storage
|
|
129
138
|
/** Get this list of all storages. */
|
|
130
139
|
list(): Promise<{ name: string | null }[]>
|
|
131
140
|
}
|
|
@@ -142,24 +151,26 @@ export interface Epos {
|
|
|
142
151
|
list(): Promise<{ name: string | null; url: string }[]>
|
|
143
152
|
}
|
|
144
153
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
url(path: string): string
|
|
149
|
-
/** Load either all assets or a specific asset by its path. */
|
|
154
|
+
// Asset
|
|
155
|
+
asset: {
|
|
156
|
+
/** Load either all assets to the memory or a specific asset by its path. */
|
|
150
157
|
load: {
|
|
151
158
|
/** Load all assets. */
|
|
152
159
|
(): Promise<void>
|
|
153
160
|
/** Load asset by path. */
|
|
154
|
-
(path: string): Promise<
|
|
161
|
+
(path: string): Promise<void>
|
|
155
162
|
}
|
|
156
|
-
/** Unload either all assets from memory or a specific asset by its path. */
|
|
163
|
+
/** Unload either all assets from the memory or a specific asset by its path. */
|
|
157
164
|
unload: {
|
|
158
|
-
/** Unload all assets
|
|
165
|
+
/** Unload all assets. */
|
|
159
166
|
(): void
|
|
160
167
|
/** Unload asset by path. */
|
|
161
168
|
(path: string): void
|
|
162
169
|
}
|
|
170
|
+
/** Get asset URL. The asset must be loaded first via `epos.asset.load`. */
|
|
171
|
+
url(path: string): string
|
|
172
|
+
/** Get asset as Blob. */
|
|
173
|
+
get(path: string): Promise<Blob | null>
|
|
163
174
|
/** Get list of all available asset files. */
|
|
164
175
|
list(filter?: { loaded?: boolean }): { path: string; loaded: boolean }[]
|
|
165
176
|
}
|
|
@@ -167,7 +178,7 @@ export interface Epos {
|
|
|
167
178
|
// Env
|
|
168
179
|
env: {
|
|
169
180
|
tabId: number
|
|
170
|
-
|
|
181
|
+
project: string
|
|
171
182
|
isPopup: boolean
|
|
172
183
|
isSidePanel: boolean
|
|
173
184
|
isBackground: boolean
|
|
@@ -183,16 +194,19 @@ export interface Epos {
|
|
|
183
194
|
reactJsxRuntime: typeof reactJsxRuntime
|
|
184
195
|
yjs: typeof yjs
|
|
185
196
|
}
|
|
197
|
+
|
|
198
|
+
// Internal symbols
|
|
199
|
+
symbols: {
|
|
200
|
+
readonly stateParent: symbol
|
|
201
|
+
readonly stateModelInit: symbol
|
|
202
|
+
readonly stateModelDispose: symbol
|
|
203
|
+
readonly stateModelStrict: symbol
|
|
204
|
+
readonly stateModelVersioner: symbol
|
|
205
|
+
}
|
|
186
206
|
}
|
|
187
207
|
|
|
188
208
|
declare global {
|
|
189
209
|
var epos: Epos
|
|
190
|
-
|
|
191
|
-
namespace React {
|
|
192
|
-
interface HTMLAttributes<T> {
|
|
193
|
-
class?: ClassName
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
210
|
}
|
|
197
211
|
|
|
198
212
|
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
|