epos 1.6.0 → 1.6.2
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/epos.d.ts +20 -6
- package/epos.schema.json +27 -17
- package/package.json +20 -17
package/dist/epos/epos.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type Cls<T = any> = new (...args: any[]) => T;
|
|
|
10
10
|
type State = Record<string, StateValue>;
|
|
11
11
|
type Versioner = Record<number, (state: State) => void>;
|
|
12
12
|
type ClassName = string | null | boolean | undefined | ClassName[];
|
|
13
|
-
type StateValue = undefined | null | boolean | number | string |
|
|
13
|
+
type StateValue = undefined | null | boolean | number | string | Unit | StateValue[] | {
|
|
14
14
|
[key: string]: StateValue;
|
|
15
15
|
};
|
|
16
16
|
type Storage = {
|
|
@@ -67,7 +67,11 @@ export interface Epos {
|
|
|
67
67
|
/** Create local state (no sync). */
|
|
68
68
|
local<T extends State = {}>(state?: T): T;
|
|
69
69
|
/** Get the list of all state names. */
|
|
70
|
-
states(
|
|
70
|
+
states(opts?: {
|
|
71
|
+
connected?: boolean;
|
|
72
|
+
}): Promise<Array<{
|
|
73
|
+
name: string | null;
|
|
74
|
+
}>>;
|
|
71
75
|
/** Destroy state. */
|
|
72
76
|
destroy(name?: string): Promise<void>;
|
|
73
77
|
/** Performs any state changes in a batch. */
|
|
@@ -90,6 +94,9 @@ export interface Epos {
|
|
|
90
94
|
Unit: typeof Unit;
|
|
91
95
|
/** Register unit class. */
|
|
92
96
|
register(Unit: Cls<Unit>): void;
|
|
97
|
+
units(): {
|
|
98
|
+
[name: string]: typeof Unit;
|
|
99
|
+
};
|
|
93
100
|
fetch: typeof window.fetch;
|
|
94
101
|
browser: typeof chrome;
|
|
95
102
|
/** Get value from the storage. */
|
|
@@ -105,7 +112,9 @@ export interface Epos {
|
|
|
105
112
|
/** Create storage API. */
|
|
106
113
|
storage(name: string): Promise<Storage>;
|
|
107
114
|
/** Get list of all storage names. */
|
|
108
|
-
storages(): Promise<
|
|
115
|
+
storages(): Promise<Array<{
|
|
116
|
+
name: string | null;
|
|
117
|
+
}>>;
|
|
109
118
|
/** Get asset URL. Asset must be loaded first. */
|
|
110
119
|
url(path: string): Promise<string>;
|
|
111
120
|
/** Load asset to memory. Pass '*' to load all assets. */
|
|
@@ -113,16 +122,21 @@ export interface Epos {
|
|
|
113
122
|
/** Unload asset from memory. Pass '*' to unload all assets.*/
|
|
114
123
|
unload(path: string): void;
|
|
115
124
|
/** Get list of all available asset paths. */
|
|
116
|
-
assets(
|
|
125
|
+
assets(opts?: {
|
|
126
|
+
loaded?: boolean;
|
|
127
|
+
}): Promise<Array<{
|
|
128
|
+
path: string;
|
|
129
|
+
loaded: boolean;
|
|
130
|
+
}>>;
|
|
117
131
|
/** Current tab ID. */
|
|
118
132
|
tabId: number;
|
|
119
133
|
is: {
|
|
120
134
|
/** True if running in a tab. */
|
|
121
135
|
tab: boolean;
|
|
122
|
-
/** True if running on
|
|
136
|
+
/** True if running on a hub page (<hub>). */
|
|
123
137
|
hub: boolean;
|
|
124
138
|
/** True if running on any page except hub. */
|
|
125
|
-
|
|
139
|
+
page: boolean;
|
|
126
140
|
/** True if running in a popup or in side panel (<popup> or <panel>). */
|
|
127
141
|
shell: boolean;
|
|
128
142
|
/** True if running in a popup (<popup>). */
|
package/epos.schema.json
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
"properties": {
|
|
6
6
|
"$schema": { "type": "string" },
|
|
7
7
|
"name": { "$ref": "#/definitions/Name" },
|
|
8
|
+
"icon": { "$ref": "#/definitions/Icon" },
|
|
9
|
+
"title": { "$ref": "#/definitions/Title" },
|
|
8
10
|
"action": { "$ref": "#/definitions/Action" },
|
|
9
11
|
"popup": { "$ref": "#/definitions/Popup" },
|
|
10
12
|
"assets": { "$ref": "#/definitions/Assets" },
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
13
|
+
"targets": { "$ref": "#/definitions/Targets" },
|
|
14
|
+
"matches": { "$ref": "#/definitions/Matches" },
|
|
15
|
+
"load": { "$ref": "#/definitions/Load" },
|
|
14
16
|
"mode": { "$ref": "#/definitions/Mode" }
|
|
15
17
|
},
|
|
16
18
|
"required": ["name"],
|
|
@@ -24,8 +26,16 @@
|
|
|
24
26
|
"pattern": "^[a-z0-9\\-]+$"
|
|
25
27
|
},
|
|
26
28
|
|
|
29
|
+
"Icon": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
"Title": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
|
|
27
37
|
"Action": {
|
|
28
|
-
"oneOf": [{ "type": "null" }, { "type": "string" }]
|
|
38
|
+
"oneOf": [{ "type": "null" }, { "type": "string" }, true]
|
|
29
39
|
},
|
|
30
40
|
|
|
31
41
|
"Popup": {
|
|
@@ -46,40 +56,40 @@
|
|
|
46
56
|
"type": "string"
|
|
47
57
|
},
|
|
48
58
|
|
|
49
|
-
"
|
|
59
|
+
"Targets": {
|
|
50
60
|
"type": "array",
|
|
51
|
-
"items": { "$ref": "#/definitions/
|
|
61
|
+
"items": { "$ref": "#/definitions/Target" }
|
|
52
62
|
},
|
|
53
63
|
|
|
54
|
-
"
|
|
64
|
+
"Target": {
|
|
55
65
|
"type": "object",
|
|
56
66
|
"properties": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
67
|
+
"matches": { "$ref": "#/definitions/Matches" },
|
|
68
|
+
"load": { "$ref": "#/definitions/Load" },
|
|
59
69
|
"mode": { "$ref": "#/definitions/Mode" }
|
|
60
70
|
},
|
|
61
71
|
"additionalProperties": false
|
|
62
72
|
},
|
|
63
73
|
|
|
64
|
-
"
|
|
74
|
+
"Matches": {
|
|
65
75
|
"oneOf": [
|
|
66
|
-
{ "$ref": "#/definitions/
|
|
67
|
-
{ "type": "array", "items": { "$ref": "#/definitions/
|
|
76
|
+
{ "$ref": "#/definitions/Pattern" },
|
|
77
|
+
{ "type": "array", "items": { "$ref": "#/definitions/Pattern" } }
|
|
68
78
|
]
|
|
69
79
|
},
|
|
70
80
|
|
|
71
|
-
"
|
|
81
|
+
"Pattern": {
|
|
72
82
|
"type": "string"
|
|
73
83
|
},
|
|
74
84
|
|
|
75
|
-
"
|
|
85
|
+
"Load": {
|
|
76
86
|
"oneOf": [
|
|
77
|
-
{ "$ref": "#/definitions/
|
|
78
|
-
{ "type": "array", "items": { "$ref": "#/definitions/
|
|
87
|
+
{ "$ref": "#/definitions/LoadItem" },
|
|
88
|
+
{ "type": "array", "items": { "$ref": "#/definitions/LoadItem" } }
|
|
79
89
|
]
|
|
80
90
|
},
|
|
81
91
|
|
|
82
|
-
"
|
|
92
|
+
"LoadItem": {
|
|
83
93
|
"type": "string",
|
|
84
94
|
"pattern": "^.*\\.(css|js|[^.]+)$"
|
|
85
95
|
},
|
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epos",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"author": "imkost",
|
|
6
7
|
"description": "",
|
|
7
8
|
"keywords": [],
|
|
8
|
-
"license": "MIT",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"dev": "
|
|
11
|
-
"build": "
|
|
12
|
-
"lint": "
|
|
13
|
-
"release": "npm run build && npm publish"
|
|
14
|
-
"release:patch": "npm version patch && npm run release"
|
|
10
|
+
"dev": "rm -rf dist && tsc -w",
|
|
11
|
+
"build": "rm -rf dist && tsc",
|
|
12
|
+
"lint": "tsc --noEmit",
|
|
13
|
+
"release": "sh -c 'npm version ${1:-patch} && npm run build && npm publish' --"
|
|
15
14
|
},
|
|
16
15
|
"exports": {
|
|
17
16
|
".": {
|
|
18
17
|
"import": "./dist/epos/epos.js"
|
|
19
18
|
},
|
|
20
|
-
"./
|
|
19
|
+
"./vite": {
|
|
21
20
|
"import": "./dist/plugin/plugin-vite.js"
|
|
22
21
|
},
|
|
23
|
-
"./
|
|
22
|
+
"./esbuild": {
|
|
24
23
|
"import": "./dist/plugin/plugin-esbuild.js"
|
|
25
24
|
}
|
|
26
25
|
},
|
|
@@ -28,17 +27,21 @@
|
|
|
28
27
|
"dist",
|
|
29
28
|
"epos.schema.json"
|
|
30
29
|
],
|
|
31
|
-
"
|
|
32
|
-
"@types/chrome": "^0.1.
|
|
33
|
-
"@types/react": "^19.1.
|
|
34
|
-
"@types/react-dom": "^19.1.
|
|
35
|
-
"dropcap": "^1.0.15",
|
|
36
|
-
"esbuild": "^0.25.8",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@types/chrome": "^0.1.4",
|
|
32
|
+
"@types/react": "^19.1.12",
|
|
33
|
+
"@types/react-dom": "^19.1.9",
|
|
37
34
|
"mobx": "^6.13.7",
|
|
38
35
|
"mobx-react-lite": "^4.1.0",
|
|
39
36
|
"react": "^19.1.1",
|
|
40
|
-
"rimraf": "^6.0.1",
|
|
41
|
-
"vite": "^7.1.2",
|
|
42
37
|
"yjs": "^13.6.27"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"esbuild": "^0.25.9",
|
|
41
|
+
"vite": "^7.1.4"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"esbuild": "^0.25.9",
|
|
45
|
+
"vite": "^7.1.4"
|
|
43
46
|
}
|
|
44
47
|
}
|