epos 1.32.0 → 1.34.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.js CHANGED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chrome.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/epos-vite.js CHANGED
@@ -29,3 +29,4 @@ export {
29
29
  epos_vite_default as default,
30
30
  epos
31
31
  };
32
+ //# sourceMappingURL=epos-vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/epos-vite.ts"],"sourcesContent":["import { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\n\nexport class EposVite {\n private libs: Record<string, string> = {\n 'react': resolve(import.meta.dirname, './libs/libs-react.js'),\n 'react/jsx-runtime': resolve(import.meta.dirname, './libs/libs-react-jsx-runtime.js'),\n 'react-dom': resolve(import.meta.dirname, './libs/libs-react-dom.js'),\n 'react-dom/client': resolve(import.meta.dirname, './libs/libs-react-dom-client.js'),\n 'mobx': resolve(import.meta.dirname, './libs/libs-mobx.js'),\n 'mobx-react-lite': resolve(import.meta.dirname, './libs/libs-mobx-react-lite.js'),\n }\n\n get plugin(): Plugin {\n return {\n name: 'epos',\n enforce: 'pre',\n resolveId: this.onResolveId,\n }\n }\n\n private onResolveId = (source: string) => {\n return this.libs[source] ?? null\n }\n}\n\nexport function epos() {\n return new EposVite().plugin\n}\n\nexport default epos\n"],"mappings":";AAAA,SAAS,eAAe;AAGjB,IAAM,WAAN,MAAe;AAAA,EACZ,OAA+B;AAAA,IACrC,SAAS,QAAQ,YAAY,SAAS,sBAAsB;AAAA,IAC5D,qBAAqB,QAAQ,YAAY,SAAS,kCAAkC;AAAA,IACpF,aAAa,QAAQ,YAAY,SAAS,0BAA0B;AAAA,IACpE,oBAAoB,QAAQ,YAAY,SAAS,iCAAiC;AAAA,IAClF,QAAQ,QAAQ,YAAY,SAAS,qBAAqB;AAAA,IAC1D,mBAAmB,QAAQ,YAAY,SAAS,gCAAgC;AAAA,EAClF;AAAA,EAEA,IAAI,SAAiB;AACnB,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,KAAK;AAAA,IAClB;AAAA,EACF;AAAA,EAEQ,cAAc,CAAC,WAAmB;AACxC,WAAO,KAAK,KAAK,MAAM,KAAK;AAAA,EAC9B;AACF;AAEO,SAAS,OAAO;AACrB,SAAO,IAAI,SAAS,EAAE;AACxB;AAEA,IAAO,oBAAQ;","names":[]}
package/dist/epos.d.ts CHANGED
@@ -25,6 +25,11 @@ type Assets = {
25
25
  };
26
26
  type FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr;
27
27
  type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T;
28
+ type Project = {
29
+ id: string;
30
+ mode: Mode;
31
+ spec: Spec;
32
+ };
28
33
  type ReqInit = {
29
34
  body: RequestInit['body'];
30
35
  cache: RequestInit['cache'];
@@ -52,7 +57,7 @@ type Res = {
52
57
  headers: {
53
58
  get: Response['headers']['get'];
54
59
  has: Response['headers']['has'];
55
- /** Get list of all header keys. */
60
+ /** Get all header keys. */
56
61
  keys: () => string[];
57
62
  };
58
63
  };
@@ -61,12 +66,12 @@ type Storage = {
61
66
  get<T = unknown>(key: string): Promise<T | null>;
62
67
  /** Set value in the storage. */
63
68
  set(key: string, value: unknown): Promise<void>;
64
- /** Delete value from the storage. */
69
+ /** Delete key from the storage. */
65
70
  delete(key: string): Promise<void>;
66
71
  /** Get all keys from the storage. */
67
72
  keys(): Promise<string[]>;
68
- /** Clear the storage. Deletes all keys and storage itself. */
69
- clear(): Promise<void>;
73
+ /** Remove the storage. Removes all keys and storage itself. */
74
+ remove(): Promise<void>;
70
75
  };
71
76
  type Bundle = {
72
77
  mode: Mode;
@@ -105,7 +110,9 @@ interface Epos {
105
110
  /** Run any state changes in a batch. */
106
111
  transaction: (fn: () => void) => void;
107
112
  /** Create local state (no sync). */
108
- local<T extends Obj = {}>(state?: T): T;
113
+ local<T extends Obj = {}>(value?: T, opts?: {
114
+ deep: boolean;
115
+ }): T;
109
116
  /** Get the list of all state names. */
110
117
  list(filter?: {
111
118
  connected?: boolean;
@@ -116,6 +123,9 @@ interface Epos {
116
123
  remove(name?: string): Promise<void>;
117
124
  /** Register models to be used by all states. */
118
125
  register(models: Record<string, ModelClass>): void;
126
+ PARENT: symbol;
127
+ ATTACH: symbol;
128
+ DETACH: symbol;
119
129
  };
120
130
  storage: {
121
131
  /** Get value from the storage. */
@@ -128,15 +138,15 @@ interface Epos {
128
138
  <T = unknown>(key: string, value: T): Promise<void>;
129
139
  <T = unknown>(name: string, key: string, value: T): Promise<void>;
130
140
  };
131
- /** Delete value from the storage. */
141
+ /** Delete key from the storage. */
132
142
  delete: {
133
143
  (key: string): Promise<void>;
134
144
  (name: string, key: string): Promise<void>;
135
145
  };
136
146
  /** Get all keys from the storage. */
137
147
  keys(name?: string): Promise<string[]>;
138
- /** Clear storage. Removes all keys and storage itself. */
139
- clear(name?: string): Promise<void>;
148
+ /** Remove storage. Removes all keys and storage itself. */
149
+ remove(name?: string): Promise<void>;
140
150
  /** Get storage API for a specific storage. */
141
151
  use(name?: string): Storage;
142
152
  /** Get this list of all storages. */
@@ -190,9 +200,12 @@ interface Epos {
190
200
  }[];
191
201
  };
192
202
  env: {
193
- mode: Mode;
194
203
  tabId: number;
195
- project: string;
204
+ project: {
205
+ id: string;
206
+ mode: Mode;
207
+ spec: Spec;
208
+ };
196
209
  isPopup: boolean;
197
210
  isSidePanel: boolean;
198
211
  isBackground: boolean;
@@ -206,19 +219,14 @@ interface Epos {
206
219
  reactJsxRuntime: typeof reactJsxRuntime;
207
220
  yjs: typeof yjs;
208
221
  };
209
- symbols: {
210
- readonly stateParent: symbol;
211
- readonly stateModelInit: symbol;
212
- readonly stateModelDispose: symbol;
213
- readonly stateModelStrict: symbol;
214
- readonly stateModelVersioner: symbol;
215
- };
216
222
  installer: {
217
223
  install: {
218
- (url: string, mode?: Mode): Promise<void>;
219
- (bundle: Bundle): Promise<void>;
224
+ (id: string, url: string, mode?: Mode): Promise<void>;
225
+ (id: string, bundle: Bundle): Promise<void>;
220
226
  };
221
227
  remove(name: string): Promise<void>;
228
+ watch(handler: (projects: Project[]) => void): void;
229
+ list(): Promise<Project[]>;
222
230
  };
223
231
  engine: any;
224
232
  }
@@ -227,4 +235,4 @@ declare global {
227
235
  }
228
236
  declare const _epos: Epos;
229
237
 
230
- export { type Arr, type Assets, type Attrs, type Bundle, type Epos, type Fn, type FnArgsOrArr, type FnResultOrValue, type Initial, type Mode, type Model, type ModelClass, type Obj, type ReqInit, type Res, type Sources, type Storage, type Versioner, _epos as default, _epos as epos };
238
+ export { type Arr, type Assets, type Attrs, type Bundle, type Epos, type Fn, type FnArgsOrArr, type FnResultOrValue, type Initial, type Mode, type Model, type ModelClass, type Obj, type Project, type ReqInit, type Res, type Sources, type Storage, type Versioner, _epos as default, _epos as epos };
package/dist/epos.js CHANGED
@@ -5,3 +5,4 @@ export {
5
5
  epos_default as default,
6
6
  _epos as epos
7
7
  };
8
+ //# sourceMappingURL=epos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/epos.ts"],"sourcesContent":["import { Spec } from 'epos-spec'\nimport type * as mobx from 'mobx'\nimport type * as mobxReactLite from 'mobx-react-lite'\nimport type * as react from 'react'\nimport type * as reactDom from 'react-dom'\nimport type * as reactDomClient from 'react-dom/client'\nimport type * as reactJsxRuntime from 'react/jsx-runtime'\nimport type * as yjs from 'yjs'\nimport type { Chrome } from './chrome.ts'\n\nexport type Fn<T = any> = (...args: any[]) => T\nexport type Obj = Record<string, unknown>\nexport type Arr = unknown[]\nexport type Versioner = Record<number, (this: any, state: any) => void>\nexport type ModelClass = new (...args: any[]) => any\nexport type Model = InstanceType<ModelClass>\nexport type Initial<T extends Obj | Model> = T | (() => T)\nexport type Attrs = Record<string, string | number>\nexport type Mode = 'development' | 'production'\nexport type Sources = { [path: string]: string }\nexport type Assets = { [path: string]: Blob }\nexport type FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr\nexport type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T\nexport type Project = { id: string; mode: Mode; spec: Spec }\n\nexport type ReqInit = {\n body: RequestInit['body']\n cache: RequestInit['cache']\n credentials: RequestInit['credentials']\n headers: RequestInit['headers']\n integrity: RequestInit['integrity']\n keepalive: RequestInit['keepalive']\n method: RequestInit['method']\n mode: RequestInit['mode']\n priority: RequestInit['priority']\n redirect: RequestInit['redirect']\n referrer: RequestInit['referrer']\n referrerPolicy: RequestInit['referrerPolicy']\n}\n\nexport type Res = {\n ok: Response['ok']\n url: Response['url']\n type: Response['type']\n status: Response['status']\n statusText: Response['statusText']\n redirected: Response['redirected']\n text: Response['text']\n json: Response['json']\n blob: Response['blob']\n headers: {\n get: Response['headers']['get']\n has: Response['headers']['has']\n /** Get all header keys. */\n keys: () => string[]\n }\n}\n\nexport type Storage = {\n /** Get value from the storage. */\n get<T = unknown>(key: string): Promise<T | null>\n /** Set value in the storage. */\n set(key: string, value: unknown): Promise<void>\n /** Delete key from the storage. */\n delete(key: string): Promise<void>\n /** Get all keys from the storage. */\n keys(): Promise<string[]>\n /** Remove the storage. Removes all keys and storage itself. */\n remove(): Promise<void>\n}\n\nexport type Bundle = {\n mode: Mode\n spec: Spec\n sources: Sources\n assets: Assets\n}\n\nexport interface Epos {\n // General\n fetch: (url: string | URL, init?: ReqInit) => Promise<Res>\n browser: Chrome\n render(node: react.ReactNode, container?: reactDomClient.Container): void\n component<T>(Component: react.FC<T>): typeof Component\n element: HTMLDivElement\n\n // Bus\n bus: {\n /** Listen for an event. */\n on<T extends Fn>(name: string, callback: T, thisArg?: unknown): void\n /** Remove event listener. */\n off<T extends Fn>(name: string, callback?: T): void\n /** Listen for an event once. */\n once<T extends Fn>(name: string, callback: T, thisArg?: unknown): void\n /** Send an event to all remote listeners (local listeners are ignored). */\n send<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T> | null>\n /** Emit event locally (calls local listeners only). */\n emit<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T> | null>\n setSignal(name: string, value?: unknown): void\n waitSignal<T = unknown>(name: string, timeout?: number): Promise<T | null>\n }\n\n // State\n state: {\n /** Connect state. */\n connect: {\n <T extends Obj | Model = Obj>(initial?: Initial<T>, versioner?: Versioner): Promise<T>\n <T extends Obj | Model = Obj>(name?: string, initial?: Initial<T>, versioner?: Versioner): Promise<T>\n }\n /** Disconnect state. */\n disconnect(name?: string): void\n /** Run any state changes in a batch. */\n transaction: (fn: () => void) => void\n /** Create local state (no sync). */\n local<T extends Obj = {}>(value?: T, opts?: { deep: boolean }): T\n /** Get the list of all state names. */\n list(filter?: { connected?: boolean }): Promise<{ name: string | null }[]>\n /** Remove state and all its data. */\n remove(name?: string): Promise<void>\n /** Register models to be used by all states. */\n register(models: Record<string, ModelClass>): void\n PARENT: symbol\n ATTACH: symbol\n DETACH: symbol\n }\n\n // Storage\n storage: {\n /** Get value from the storage. */\n get: {\n <T = unknown>(key: string): Promise<T | null>\n <T = unknown>(name: string, key: string): Promise<T | null>\n }\n /** Set value in the storage. */\n set: {\n <T = unknown>(key: string, value: T): Promise<void>\n <T = unknown>(name: string, key: string, value: T): Promise<void>\n }\n /** Delete key from the storage. */\n delete: {\n (key: string): Promise<void>\n (name: string, key: string): Promise<void>\n }\n /** Get all keys from the storage. */\n keys(name?: string): Promise<string[]>\n /** Remove storage. Removes all keys and storage itself. */\n remove(name?: string): Promise<void>\n /** Get storage API for a specific storage. */\n use(name?: string): Storage\n /** Get this list of all storages. */\n list(): Promise<{ name: string | null }[]>\n }\n\n // Frame\n frame: {\n /** Open background frame. */\n open: {\n (url: string): Promise<void>\n (url: string, attrs: Attrs): Promise<void>\n (name: string, url: string): Promise<void>\n (name: string, url: string, attrs: Attrs): Promise<void>\n }\n /** Close background frame. */\n close(name?: string): Promise<void>\n /** Check if background frame with the given name exists. */\n exists(name?: string): Promise<boolean>\n /** Get list of all open background frames. */\n list(): Promise<{ name: string | null; url: string }[]>\n }\n\n // Asset\n asset: {\n /** Load specified asset to memory. Load all assets if no path is provided. */\n load: {\n /** Load all assets. */\n (): Promise<void>\n /** Load asset by path. */\n (path: string): Promise<void>\n }\n /** Unload either all assets from the memory or a specific asset by its path. */\n unload: {\n /** Unload all assets. */\n (): void\n /** Unload asset by path. */\n (path: string): void\n }\n /** Get asset URL. The asset must be loaded first via `epos.asset.load`. */\n url(path: string): string\n /** Get asset as Blob. */\n get(path: string): Promise<Blob | null>\n /** Get list of all available assets. */\n list(filter?: { loaded?: boolean }): { path: string; loaded: boolean }[]\n }\n\n // Env\n env: {\n tabId: number\n project: { id: string; mode: Mode; spec: Spec }\n isPopup: boolean\n isSidePanel: boolean\n isBackground: boolean\n }\n\n // Libs\n libs: {\n mobx: typeof mobx\n mobxReactLite: typeof mobxReactLite\n react: typeof react\n reactDom: typeof reactDom\n reactDomClient: typeof reactDomClient\n reactJsxRuntime: typeof reactJsxRuntime\n yjs: typeof yjs\n }\n\n // Installer\n installer: {\n install: {\n (id: string, url: string, mode?: Mode): Promise<void>\n (id: string, bundle: Bundle): Promise<void>\n }\n remove(name: string): Promise<void>\n watch(handler: (projects: Project[]) => void): void\n list(): Promise<Project[]>\n }\n\n // Engine\n engine: any\n}\n\ndeclare global {\n var epos: Epos\n}\n\nconst _epos = epos\nexport { _epos as epos }\nexport default _epos\n"],"mappings":";AAyOA,IAAM,QAAQ;AAEd,IAAO,eAAQ;","names":[]}
@@ -23,3 +23,4 @@ export {
23
23
  useObserver,
24
24
  useStaticRendering
25
25
  };
26
+ //# sourceMappingURL=libs-mobx-react-lite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/libs/libs-mobx-react-lite.js"],"sourcesContent":["export const {\n enableStaticRendering,\n isUsingStaticRendering,\n observer,\n Observer,\n observerBatching,\n useAsObservableSource,\n useLocalObservable,\n useLocalStore,\n useObserver,\n useStaticRendering,\n} = epos.libs.mobxReactLite\n"],"mappings":";AAAO,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAAI,KAAK,KAAK;","names":[]}
@@ -137,3 +137,4 @@ export {
137
137
  values,
138
138
  when
139
139
  };
140
+ //# sourceMappingURL=libs-mobx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/libs/libs-mobx.js"],"sourcesContent":["export const {\n _allowStateChanges,\n _allowStateChangesInsideComputed,\n _allowStateReadsEnd,\n _allowStateReadsStart,\n _autoAction,\n _endAction,\n _getAdministration,\n _getGlobalState,\n _interceptReads,\n _isComputingDerivation,\n _resetGlobalState,\n _startAction,\n $mobx,\n action,\n autorun,\n comparer,\n computed,\n configure,\n createAtom,\n defineProperty,\n entries,\n extendObservable,\n FlowCancellationError,\n flowResult,\n get,\n getAtom,\n getDebugName,\n getDependencyTree,\n getObserverTree,\n has,\n intercept,\n isAction,\n isBoxedObservable,\n isComputed,\n isComputedProp,\n isFlow,\n isFlowCancellationError,\n isObservable,\n isObservableArray,\n isObservableMap,\n isObservableObject,\n isObservableProp,\n isObservableSet,\n keys,\n makeAutoObservable,\n makeObservable,\n observable,\n ObservableMap,\n ObservableSet,\n observe,\n onBecomeObserved,\n onBecomeUnobserved,\n onReactionError,\n override,\n ownKeys,\n reaction,\n Reaction,\n remove,\n runInAction,\n set,\n spy,\n toJS,\n trace,\n transaction,\n untracked,\n values,\n when,\n} = epos.libs.mobx\n"],"mappings":";AAAO,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAAI,KAAK,KAAK;","names":[]}
@@ -6,3 +6,4 @@ export {
6
6
  libs_react_dom_client_default as default,
7
7
  hydrateRoot
8
8
  };
9
+ //# sourceMappingURL=libs-react-dom-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/libs/libs-react-dom-client.js"],"sourcesContent":["export default epos.libs.reactDomClient\nexport const { createRoot, hydrateRoot } = epos.libs.reactDomClient\n"],"mappings":";AAAA,IAAO,gCAAQ,KAAK,KAAK;AAClB,IAAM,EAAE,YAAY,YAAY,IAAI,KAAK,KAAK;","names":[]}
@@ -31,3 +31,4 @@ export {
31
31
  useFormStatus,
32
32
  version
33
33
  };
34
+ //# sourceMappingURL=libs-react-dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/libs/libs-react-dom.js"],"sourcesContent":["export default epos.libs.reactDom\nexport const {\n createPortal,\n flushSync,\n preconnect,\n prefetchDNS,\n preinit,\n preinitModule,\n preload,\n preloadModule,\n requestFormReset,\n unstable_batchedUpdates,\n useFormState,\n useFormStatus,\n version,\n} = epos.libs.reactDom\n"],"mappings":";AAAA,IAAO,yBAAQ,KAAK,KAAK;AAClB,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAAI,KAAK,KAAK;","names":[]}
@@ -7,3 +7,4 @@ export {
7
7
  jsx,
8
8
  jsxs
9
9
  };
10
+ //# sourceMappingURL=libs-react-jsx-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/libs/libs-react-jsx-runtime.js"],"sourcesContent":["export default epos.libs.reactJsxRuntime\nexport const { Fragment, jsx, jsxs } = epos.libs.reactJsxRuntime\n"],"mappings":";AAAA,IAAO,iCAAQ,KAAK,KAAK;AAClB,IAAM,EAAE,UAAU,KAAK,KAAK,IAAI,KAAK,KAAK;","names":[]}
@@ -79,3 +79,4 @@ export {
79
79
  useTransition,
80
80
  version
81
81
  };
82
+ //# sourceMappingURL=libs-react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/libs/libs-react.js"],"sourcesContent":["export default epos.libs.react\nexport const {\n act,\n cache,\n Children,\n cloneElement,\n Component,\n createContext,\n createElement,\n createRef,\n forwardRef,\n Fragment,\n isValidElement,\n lazy,\n memo,\n Profiler,\n PureComponent,\n startTransition,\n StrictMode,\n Suspense,\n use,\n useActionState,\n useCallback,\n useContext,\n useDebugValue,\n useDeferredValue,\n useEffect,\n useId,\n useImperativeHandle,\n useInsertionEffect,\n useLayoutEffect,\n useMemo,\n useOptimistic,\n useReducer,\n useRef,\n useState,\n useSyncExternalStore,\n useTransition,\n version,\n} = epos.libs.react\n"],"mappings":";AAAA,IAAO,qBAAQ,KAAK,KAAK;AAClB,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAAI,KAAK,KAAK;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epos",
3
- "version": "1.32.0",
3
+ "version": "1.34.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",
@@ -14,25 +14,23 @@
14
14
  },
15
15
  "exports": {
16
16
  ".": "./dist/epos.js",
17
- "./vite": "./dist/epos-vite.js",
18
- "./vite/ts": "./src/epos-vite.ts"
17
+ "./vite": "./dist/epos-vite.js"
19
18
  },
20
19
  "files": [
21
- "dist",
22
- "src"
20
+ "dist"
23
21
  ],
24
22
  "dependencies": {
25
23
  "@parcel/watcher": "^2.5.1",
26
24
  "@types/chrome": "^0.1.32",
27
25
  "@types/react": "^19.2.7",
28
26
  "@types/react-dom": "^19.2.3",
29
- "epos-spec": "^1.0.0",
27
+ "epos-spec": "^1.4.0",
30
28
  "mobx": "^6.15.0",
31
29
  "mobx-react-lite": "^4.1.1",
32
30
  "portfinder": "^1.0.38",
33
31
  "react": "^19.2.3",
34
32
  "ws": "^8.18.3",
35
- "yjs": "^13.6.28"
33
+ "yjs": "^13.6.29"
36
34
  },
37
35
  "devDependencies": {
38
36
  "vite": "^7.3.0"
package/src/chrome.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference types="chrome"/>
2
-
3
- export type Chrome = typeof chrome
package/src/epos-vite.ts DELETED
@@ -1,31 +0,0 @@
1
- import { resolve } from 'node:path'
2
- import type { Plugin } from 'vite'
3
-
4
- export class EposVite {
5
- private libs: Record<string, string> = {
6
- 'react': resolve(import.meta.dirname, './libs/libs-react.js'),
7
- 'react/jsx-runtime': resolve(import.meta.dirname, './libs/libs-react-jsx-runtime.js'),
8
- 'react-dom': resolve(import.meta.dirname, './libs/libs-react-dom.js'),
9
- 'react-dom/client': resolve(import.meta.dirname, './libs/libs-react-dom-client.js'),
10
- 'mobx': resolve(import.meta.dirname, './libs/libs-mobx.js'),
11
- 'mobx-react-lite': resolve(import.meta.dirname, './libs/libs-mobx-react-lite.js'),
12
- }
13
-
14
- get plugin(): Plugin {
15
- return {
16
- name: 'epos',
17
- enforce: 'pre',
18
- resolveId: this.onResolveId,
19
- }
20
- }
21
-
22
- private onResolveId = (source: string) => {
23
- return this.libs[source] ?? null
24
- }
25
- }
26
-
27
- export function epos() {
28
- return new EposVite().plugin
29
- }
30
-
31
- export default epos
package/src/epos.ts DELETED
@@ -1,240 +0,0 @@
1
- import { Spec } from 'epos-spec'
2
- import type * as mobx from 'mobx'
3
- import type * as mobxReactLite from 'mobx-react-lite'
4
- import type * as react from 'react'
5
- import type * as reactDom from 'react-dom'
6
- import type * as reactDomClient from 'react-dom/client'
7
- import type * as reactJsxRuntime from 'react/jsx-runtime'
8
- import type * as yjs from 'yjs'
9
- import type { Chrome } from './chrome.ts'
10
-
11
- export type Fn<T = any> = (...args: any[]) => T
12
- export type Obj = Record<string, unknown>
13
- export type Arr = unknown[]
14
- export type Versioner = Record<number, (this: any, state: any) => void>
15
- export type ModelClass = new (...args: any[]) => any
16
- export type Model = InstanceType<ModelClass>
17
- export type Initial<T extends Obj | Model> = T | (() => T)
18
- export type Attrs = Record<string, string | number>
19
- export type Mode = 'development' | 'production'
20
- export type Sources = { [path: string]: string }
21
- export type Assets = { [path: string]: Blob }
22
- export type FnArgsOrArr<T> = T extends Fn ? Parameters<T> : Arr
23
- export type FnResultOrValue<T> = T extends Fn ? ReturnType<T> : T
24
-
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']
53
- /** Get list of all header keys. */
54
- keys: () => string[]
55
- }
56
- }
57
-
58
- export type Storage = {
59
- /** Get value from the storage. */
60
- get<T = unknown>(key: string): Promise<T | null>
61
- /** Set value in the storage. */
62
- set(key: string, value: unknown): Promise<void>
63
- /** Delete value from the storage. */
64
- delete(key: string): Promise<void>
65
- /** Get all keys from the storage. */
66
- keys(): Promise<string[]>
67
- /** Clear the storage. Deletes all keys and storage itself. */
68
- clear(): Promise<void>
69
- }
70
-
71
- export type Bundle = {
72
- mode: Mode
73
- spec: Spec
74
- sources: Sources
75
- assets: Assets
76
- }
77
-
78
- export interface Epos {
79
- // General
80
- fetch: (url: string | URL, init?: ReqInit) => Promise<Res>
81
- browser: Chrome
82
- render(node: react.ReactNode, container?: reactDomClient.Container): void
83
- component<T>(Component: react.FC<T>): typeof Component
84
- element: HTMLDivElement
85
-
86
- // Bus
87
- bus: {
88
- /** Listen for an event. */
89
- on<T extends Fn>(name: string, callback: T, thisArg?: unknown): void
90
- /** Remove event listener. */
91
- off<T extends Fn>(name: string, callback?: T): void
92
- /** Listen for an event once. */
93
- once<T extends Fn>(name: string, callback: T, thisArg?: unknown): void
94
- /** Send an event to all remote listeners (local listeners are ignored). */
95
- send<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T> | null>
96
- /** Emit event locally (calls local listeners only). */
97
- emit<T = unknown>(name: string, ...args: FnArgsOrArr<T>): Promise<FnResultOrValue<T> | null>
98
- setSignal(name: string, value?: unknown): void
99
- waitSignal<T = unknown>(name: string, timeout?: number): Promise<T | null>
100
- }
101
-
102
- // State
103
- state: {
104
- /** Connect state. */
105
- connect: {
106
- <T extends Obj | Model = Obj>(initial?: Initial<T>, versioner?: Versioner): Promise<T>
107
- <T extends Obj | Model = Obj>(name?: string, initial?: Initial<T>, versioner?: Versioner): Promise<T>
108
- }
109
- /** Disconnect state. */
110
- disconnect(name?: string): void
111
- /** Run any state changes in a batch. */
112
- transaction: (fn: () => void) => void
113
- /** Create local state (no sync). */
114
- local<T extends Obj = {}>(state?: T): T
115
- /** Get the list of all state names. */
116
- list(filter?: { connected?: boolean }): Promise<{ name: string | null }[]>
117
- /** Remove state and all its data. */
118
- remove(name?: string): Promise<void>
119
- /** Register models to be used by all states. */
120
- register(models: Record<string, ModelClass>): void
121
- }
122
-
123
- // Storage
124
- storage: {
125
- /** Get value from the storage. */
126
- get: {
127
- <T = unknown>(key: string): Promise<T | null>
128
- <T = unknown>(name: string, key: string): Promise<T | null>
129
- }
130
- /** Set value in the storage. */
131
- set: {
132
- <T = unknown>(key: string, value: T): Promise<void>
133
- <T = unknown>(name: string, key: string, value: T): Promise<void>
134
- }
135
- /** Delete value from the storage. */
136
- delete: {
137
- (key: string): Promise<void>
138
- (name: string, key: string): Promise<void>
139
- }
140
- /** Get all keys from the storage. */
141
- keys(name?: string): Promise<string[]>
142
- /** Clear storage. Removes all keys and storage itself. */
143
- clear(name?: string): Promise<void>
144
- /** Get storage API for a specific storage. */
145
- use(name?: string): Storage
146
- /** Get this list of all storages. */
147
- list(): Promise<{ name: string | null }[]>
148
- }
149
-
150
- // Frame
151
- frame: {
152
- /** Open background frame. */
153
- open: {
154
- (url: string): Promise<void>
155
- (url: string, attrs: Attrs): Promise<void>
156
- (name: string, url: string): Promise<void>
157
- (name: string, url: string, attrs: Attrs): Promise<void>
158
- }
159
- /** Close background frame. */
160
- close(name?: string): Promise<void>
161
- /** Check if background frame with the given name exists. */
162
- exists(name?: string): Promise<boolean>
163
- /** Get list of all open background frames. */
164
- list(): Promise<{ name: string | null; url: string }[]>
165
- }
166
-
167
- // Asset
168
- asset: {
169
- /** Load specified asset to memory. Load all assets if no path is provided. */
170
- load: {
171
- /** Load all assets. */
172
- (): Promise<void>
173
- /** Load asset by path. */
174
- (path: string): Promise<void>
175
- }
176
- /** Unload either all assets from the memory or a specific asset by its path. */
177
- unload: {
178
- /** Unload all assets. */
179
- (): void
180
- /** Unload asset by path. */
181
- (path: string): void
182
- }
183
- /** Get asset URL. The asset must be loaded first via `epos.asset.load`. */
184
- url(path: string): string
185
- /** Get asset as Blob. */
186
- get(path: string): Promise<Blob | null>
187
- /** Get list of all available assets. */
188
- list(filter?: { loaded?: boolean }): { path: string; loaded: boolean }[]
189
- }
190
-
191
- // Env
192
- env: {
193
- mode: Mode
194
- tabId: number
195
- project: string
196
- isPopup: boolean
197
- isSidePanel: boolean
198
- isBackground: boolean
199
- }
200
-
201
- // Libs
202
- libs: {
203
- mobx: typeof mobx
204
- mobxReactLite: typeof mobxReactLite
205
- react: typeof react
206
- reactDom: typeof reactDom
207
- reactDomClient: typeof reactDomClient
208
- reactJsxRuntime: typeof reactJsxRuntime
209
- yjs: typeof yjs
210
- }
211
-
212
- // Internal symbols
213
- symbols: {
214
- readonly stateParent: symbol
215
- readonly stateModelInit: symbol
216
- readonly stateModelDispose: symbol
217
- readonly stateModelStrict: symbol
218
- readonly stateModelVersioner: symbol
219
- }
220
-
221
- // Installer
222
- installer: {
223
- install: {
224
- (url: string, mode?: Mode): Promise<void>
225
- (bundle: Bundle): Promise<void>
226
- }
227
- remove(name: string): Promise<void>
228
- }
229
-
230
- // Engine
231
- engine: any
232
- }
233
-
234
- declare global {
235
- var epos: Epos
236
- }
237
-
238
- const _epos = epos
239
- export { _epos as epos }
240
- export default _epos
@@ -1,12 +0,0 @@
1
- export const {
2
- enableStaticRendering,
3
- isUsingStaticRendering,
4
- observer,
5
- Observer,
6
- observerBatching,
7
- useAsObservableSource,
8
- useLocalObservable,
9
- useLocalStore,
10
- useObserver,
11
- useStaticRendering,
12
- } = epos.libs.mobxReactLite
@@ -1,69 +0,0 @@
1
- export const {
2
- _allowStateChanges,
3
- _allowStateChangesInsideComputed,
4
- _allowStateReadsEnd,
5
- _allowStateReadsStart,
6
- _autoAction,
7
- _endAction,
8
- _getAdministration,
9
- _getGlobalState,
10
- _interceptReads,
11
- _isComputingDerivation,
12
- _resetGlobalState,
13
- _startAction,
14
- $mobx,
15
- action,
16
- autorun,
17
- comparer,
18
- computed,
19
- configure,
20
- createAtom,
21
- defineProperty,
22
- entries,
23
- extendObservable,
24
- FlowCancellationError,
25
- flowResult,
26
- get,
27
- getAtom,
28
- getDebugName,
29
- getDependencyTree,
30
- getObserverTree,
31
- has,
32
- intercept,
33
- isAction,
34
- isBoxedObservable,
35
- isComputed,
36
- isComputedProp,
37
- isFlow,
38
- isFlowCancellationError,
39
- isObservable,
40
- isObservableArray,
41
- isObservableMap,
42
- isObservableObject,
43
- isObservableProp,
44
- isObservableSet,
45
- keys,
46
- makeAutoObservable,
47
- makeObservable,
48
- observable,
49
- ObservableMap,
50
- ObservableSet,
51
- observe,
52
- onBecomeObserved,
53
- onBecomeUnobserved,
54
- onReactionError,
55
- override,
56
- ownKeys,
57
- reaction,
58
- Reaction,
59
- remove,
60
- runInAction,
61
- set,
62
- spy,
63
- toJS,
64
- trace,
65
- transaction,
66
- untracked,
67
- values,
68
- when,
69
- } = epos.libs.mobx
@@ -1,2 +0,0 @@
1
- export default epos.libs.reactDomClient
2
- export const { createRoot, hydrateRoot } = epos.libs.reactDomClient
@@ -1,16 +0,0 @@
1
- export default epos.libs.reactDom
2
- export const {
3
- createPortal,
4
- flushSync,
5
- preconnect,
6
- prefetchDNS,
7
- preinit,
8
- preinitModule,
9
- preload,
10
- preloadModule,
11
- requestFormReset,
12
- unstable_batchedUpdates,
13
- useFormState,
14
- useFormStatus,
15
- version,
16
- } = epos.libs.reactDom
@@ -1,2 +0,0 @@
1
- export default epos.libs.reactJsxRuntime
2
- export const { Fragment, jsx, jsxs } = epos.libs.reactJsxRuntime
@@ -1,40 +0,0 @@
1
- export default epos.libs.react
2
- export const {
3
- act,
4
- cache,
5
- Children,
6
- cloneElement,
7
- Component,
8
- createContext,
9
- createElement,
10
- createRef,
11
- forwardRef,
12
- Fragment,
13
- isValidElement,
14
- lazy,
15
- memo,
16
- Profiler,
17
- PureComponent,
18
- startTransition,
19
- StrictMode,
20
- Suspense,
21
- use,
22
- useActionState,
23
- useCallback,
24
- useContext,
25
- useDebugValue,
26
- useDeferredValue,
27
- useEffect,
28
- useId,
29
- useImperativeHandle,
30
- useInsertionEffect,
31
- useLayoutEffect,
32
- useMemo,
33
- useOptimistic,
34
- useReducer,
35
- useRef,
36
- useState,
37
- useSyncExternalStore,
38
- useTransition,
39
- version,
40
- } = epos.libs.react