epos 1.21.0 → 1.23.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.
@@ -0,0 +1 @@
1
+ /// <reference types="chrome" />
File without changes
package/dist/epos.d.ts CHANGED
@@ -33,10 +33,7 @@ interface Epos {
33
33
  browser: typeof chrome;
34
34
  element: HTMLDivElement;
35
35
  render(node: react.ReactNode, container?: reactDomClient.Container): void;
36
- component: {
37
- <P>(Component: react.FC<P>): typeof Component;
38
- <P>(name: string, Component: react.FC<P>): typeof Component;
39
- };
36
+ component<T>(Component: react.FC<T>): typeof Component;
40
37
  bus: {
41
38
  /** Listen for an event. */
42
39
  on(eventName: string, callback: Fn, thisValue?: unknown): void;
@@ -114,18 +111,24 @@ interface Epos {
114
111
  url: string;
115
112
  }[]>;
116
113
  };
117
- static: {
118
- /** Get static file URL. The file must be loaded first via `epos.static.load`. */
114
+ assets: {
115
+ /** Get asset URL. The asset must be loaded first via `epos.assets.load`. */
119
116
  url(path: string): string;
120
- /** Load static file by path. */
121
- load(path: string): Promise<Blob>;
122
- /** Load all static files. */
123
- loadAll(): Promise<Blob[]>;
124
- /** Unload static file from memory. */
125
- unload(path: string): void;
126
- /** Unload all static files from memory. */
127
- unloadAll(): void;
128
- /** Get list of all available static files. */
117
+ /** Load either all assets or a specific asset by its path. */
118
+ load: {
119
+ /** Load all assets. */
120
+ (): Promise<void>;
121
+ /** Load asset by path. */
122
+ (path: string): Promise<Blob>;
123
+ };
124
+ /** Unload either all assets from memory or a specific asset by its path. */
125
+ unload: {
126
+ /** Unload all assets from memory. */
127
+ (): void;
128
+ /** Unload asset by path. */
129
+ (path: string): void;
130
+ };
131
+ /** Get list of all available asset files. */
129
132
  list(filter?: {
130
133
  loaded?: boolean;
131
134
  }): {
@@ -151,7 +154,7 @@ interface Epos {
151
154
  };
152
155
  }
153
156
  declare global {
154
- var epos: Epos;
157
+ const epos: Epos;
155
158
  namespace React {
156
159
  interface HTMLAttributes<T> {
157
160
  class?: ClassName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epos",
3
- "version": "1.21.0",
3
+ "version": "1.23.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",
@@ -0,0 +1,2 @@
1
+ /// <reference types="chrome" />
2
+ export {}
package/src/epos.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="chrome"/>
1
+ import './chrome-types.d.ts'
2
2
 
3
3
  import type * as mobx from 'mobx'
4
4
  import type * as mobxReactLite from 'mobx-react-lite'
@@ -39,10 +39,7 @@ export interface Epos {
39
39
  browser: typeof chrome
40
40
  element: HTMLDivElement
41
41
  render(node: react.ReactNode, container?: reactDomClient.Container): void
42
- component: {
43
- <P>(Component: react.FC<P>): typeof Component
44
- <P>(name: string, Component: react.FC<P>): typeof Component
45
- }
42
+ component<T>(Component: react.FC<T>): typeof Component
46
43
 
47
44
  // Bus
48
45
  bus: {
@@ -120,19 +117,25 @@ export interface Epos {
120
117
  list(): Promise<{ name: string | null; url: string }[]>
121
118
  }
122
119
 
123
- // Static
124
- static: {
125
- /** Get static file URL. The file must be loaded first via `epos.static.load`. */
120
+ // Assets
121
+ assets: {
122
+ /** Get asset URL. The asset must be loaded first via `epos.assets.load`. */
126
123
  url(path: string): string
127
- /** Load static file by path. */
128
- load(path: string): Promise<Blob>
129
- /** Load all static files. */
130
- loadAll(): Promise<Blob[]>
131
- /** Unload static file from memory. */
132
- unload(path: string): void
133
- /** Unload all static files from memory. */
134
- unloadAll(): void
135
- /** Get list of all available static files. */
124
+ /** Load either all assets or a specific asset by its path. */
125
+ load: {
126
+ /** Load all assets. */
127
+ (): Promise<void>
128
+ /** Load asset by path. */
129
+ (path: string): Promise<Blob>
130
+ }
131
+ /** Unload either all assets from memory or a specific asset by its path. */
132
+ unload: {
133
+ /** Unload all assets from memory. */
134
+ (): void
135
+ /** Unload asset by path. */
136
+ (path: string): void
137
+ }
138
+ /** Get list of all available asset files. */
136
139
  list(filter?: { loaded?: boolean }): { path: string; loaded: boolean }[]
137
140
  }
138
141
 
@@ -158,7 +161,7 @@ export interface Epos {
158
161
  }
159
162
 
160
163
  declare global {
161
- var epos: Epos
164
+ const epos: Epos
162
165
 
163
166
  namespace React {
164
167
  interface HTMLAttributes<T> {