@d-najd/universal-media-tracker-sdk 0.2.2 → 0.3.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/Plugin.d.ts CHANGED
@@ -4,6 +4,7 @@ import CreateResourceHandler from "./types/handler/media/CreateResourceHandler";
4
4
  import CreatePluginSourceHandler from "./types/handler/plugin/source/CreatePluginSourceHandler";
5
5
  import CreateHandler from "./types/handler/base/CreateHandler";
6
6
  import CreatePluginFactoryHandler from "./types/handler/plugin/factory/CreatePluginFactoryHandler";
7
+ import CreateScreenHandler from "./types/handler/ui/screen/CreateScreenHandler";
7
8
  export default class Plugin {
8
9
  readonly config: PluginConfig;
9
10
  /**
@@ -32,6 +33,7 @@ export default class Plugin {
32
33
  defineCatalogHandler(handler: CreateCatalogHandler): string;
33
34
  definePluginSourceHandler(handler: CreatePluginSourceHandler): string;
34
35
  definePluginFactoryHandler(handler: CreatePluginFactoryHandler): string;
36
+ defineScreenHandler(handler: CreateScreenHandler): string;
35
37
  private getSpec;
36
38
  private onLoadCallback;
37
39
  private onUnloadCallback;
package/dist/Plugin.js CHANGED
@@ -75,6 +75,14 @@ export default class Plugin {
75
75
  };
76
76
  return this.defineHandler(newHandler);
77
77
  }
78
+ defineScreenHandler(handler) {
79
+ const newHandler = {
80
+ id: `${this.config.id}-ui-screen-${this.counter++}`,
81
+ ...handler,
82
+ type: "ui-screen"
83
+ };
84
+ return this.defineHandler(newHandler);
85
+ }
78
86
  // Used internally
79
87
  async getSpec() {
80
88
  if (!this.loaded) {
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { default as Plugin } from './Plugin';
2
2
  export { default as TriState } from './types/TriState';
3
3
  export { default as PluginSpec } from './types/PluginSpec';
4
4
  export { default as PluginConfig } from './types/PluginConfig';
5
+ export { default as Navigator } from './types/handler/ui/Navigator';
5
6
  export { default as ResourceType } from './types/handler/media/ResourceType';
6
7
  export { default as ResourceHandlerResponse } from './types/handler/media/ResourceHandlerResponse';
7
8
  export { default as ResourceHandlerArgs } from './types/handler/media/ResourceHandlerArgs';
@@ -11,20 +12,20 @@ export { default as BaseResourceHandler } from './types/handler/media/BaseResour
11
12
  export { default as HandlerTypes } from './types/handler/base/HandlerTypes';
12
13
  export { default as Handler } from './types/handler/base/Handler';
13
14
  export { default as CreateHandler } from './types/handler/base/CreateHandler';
14
- export { default as BaseHandlerResponse } from './types/handler/base/BaseHandlerResponse';
15
- export { default as BaseHandlerArgs } from './types/handler/base/BaseHandlerArgs';
16
15
  export { default as BaseHandler } from './types/handler/base/BaseHandler';
16
+ export { default as ScreenHandlerResponse } from './types/handler/ui/screen/ScreenHandlerResponse';
17
+ export { default as ScreenHandlerArgs } from './types/handler/ui/screen/ScreenHandlerArgs';
18
+ export { default as CreateScreenHandler } from './types/handler/ui/screen/CreateScreenHandler';
19
+ export { default as PluginSourceHandlerResponse } from './types/handler/plugin/source/PluginSourceHandlerResponse';
20
+ export { default as PluginSourceHandlerArgs } from './types/handler/plugin/source/PluginSourceHandlerArgs';
21
+ export { default as CreatePluginSourceHandler } from './types/handler/plugin/source/CreatePluginSourceHandler';
22
+ export { default as PluginFactoryHandlerResponse } from './types/handler/plugin/factory/PluginFactoryHandlerResponse';
23
+ export { default as PluginFactoryHandlerArgs } from './types/handler/plugin/factory/PluginFactoryHandlerArgs';
24
+ export { default as CreatePluginFactoryHandler } from './types/handler/plugin/factory/CreatePluginFactoryHandler';
17
25
  export { default as MetaPreview } from './types/handler/media/catalog/MetaPreview';
18
26
  export { default as CreateCatalogHandler } from './types/handler/media/catalog/CreateCatalogHandler';
19
27
  export { default as CatalogHandlerResponse } from './types/handler/media/catalog/CatalogHandlerResponse';
20
28
  export { default as CatalogHandlerArgs } from './types/handler/media/catalog/CatalogHandlerArgs';
21
29
  export { default as ResourceBrowseOptionDefaults } from './types/handler/media/browse-option/ResourceBrowseOptionDefaults';
22
- export { default as ResourceBrowseOptionConverter } from './types/handler/media/browse-option/ResourceBrowseOptionConverter';
23
30
  export { default as ResourceBrowseOptionArgs } from './types/handler/media/browse-option/ResourceBrowseOptionArgs';
24
31
  export { default as ResourceBrowseOption } from './types/handler/media/browse-option/ResourceBrowseOption';
25
- export { default as PluginSourceHandlerResponse } from './types/handler/plugin/source/PluginSourceHandlerResponse';
26
- export { default as PluginSourceHandlerArgs } from './types/handler/plugin/source/PluginSourceHandlerArgs';
27
- export { default as CreatePluginSourceHandler } from './types/handler/plugin/source/CreatePluginSourceHandler';
28
- export { default as PluginFactoryHandlerResponse } from './types/handler/plugin/factory/PluginFactoryHandlerResponse';
29
- export { default as PluginFactoryHandlerArgs } from './types/handler/plugin/factory/PluginFactoryHandlerArgs';
30
- export { default as CreatePluginFactoryHandler } from './types/handler/plugin/factory/CreatePluginFactoryHandler';
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  // Auto‑generated barrel file – do not edit manually
2
2
  export { default as Plugin } from './Plugin';
3
- export { default as ResourceBrowseOptionConverter } from './types/handler/media/browse-option/ResourceBrowseOptionConverter';
@@ -1,2 +1,2 @@
1
- type ResourceHandlerType = 'catalog-request' | 'plugin-source' | 'plugin-factory';
1
+ type ResourceHandlerType = 'catalog-request' | 'plugin-source' | 'plugin-factory' | 'ui-screen';
2
2
  export default ResourceHandlerType;
@@ -1,6 +1,5 @@
1
- import BaseHandlerArgs from "../base/BaseHandlerArgs";
2
1
  import { ResourceBrowseOptionArgs } from "../../../index";
3
- type ResourceHandlerArgs = BaseHandlerArgs & {
2
+ type ResourceHandlerArgs = {
4
3
  readonly options?: ResourceBrowseOptionArgs[];
5
4
  };
6
5
  export default ResourceHandlerArgs;
@@ -1,3 +1,4 @@
1
- import BaseHandlerResponse from "../base/BaseHandlerResponse";
2
- type ResourceHandlerResponse<T = any> = BaseHandlerResponse<T> & {};
1
+ type ResourceHandlerResponse<T = any> = {
2
+ readonly data: T[];
3
+ };
3
4
  export default ResourceHandlerResponse;
@@ -1,6 +1,7 @@
1
1
  import TriState from "../../../TriState";
2
+ import ResourceBrowseOptionDefaults from "./ResourceBrowseOptionDefaults";
2
3
  type ResourceBrowseOptionArgs = {
3
- readonly name: string;
4
+ readonly name: ResourceBrowseOptionDefaults | string;
4
5
  /**
5
6
  * @see ResourceExtra
6
7
  */
@@ -0,0 +1,9 @@
1
+ export default interface Navigator {
2
+ screens: any[];
3
+ push(path: string): void;
4
+ /**
5
+ * @return path
6
+ */
7
+ pop(): string;
8
+ replace(path: string): void;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,15 @@
1
+ import BaseHandler from "../../base/BaseHandler";
2
+ import ScreenHandlerArgs from "./ScreenHandlerArgs";
3
+ import ScreenHandlerResponse from "./ScreenHandlerResponse";
4
+ import { StoreApi, UseBoundStore } from "zustand";
5
+ type CreateScreenHandler<S = any> = BaseHandler<ScreenHandlerArgs<S>, ScreenHandlerResponse> & {
6
+ /**
7
+ * /library/:id
8
+ */
9
+ readonly path: string;
10
+ /**
11
+ * If undefined screen state won't be stored
12
+ */
13
+ readonly initialState?: UseBoundStore<StoreApi<S>>;
14
+ };
15
+ export default CreateScreenHandler;
@@ -0,0 +1,18 @@
1
+ import Navigator from '../Navigator';
2
+ import { UseBoundStore, StoreApi } from "zustand";
3
+ type ScreenHandlerArgs<S = any> = {
4
+ /**
5
+ * If undefined in handler won't be passed here
6
+ */
7
+ readonly state?: UseBoundStore<StoreApi<S>>;
8
+ readonly navigator: Navigator;
9
+ /**
10
+ * /library/1
11
+ */
12
+ readonly resolvedPath: string;
13
+ /**
14
+ * /library/:id
15
+ */
16
+ readonly path: string;
17
+ };
18
+ export default ScreenHandlerArgs;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ type ScreenHandlerResponse = {
3
+ readonly framework: 'react';
4
+ readonly content: ReactNode;
5
+ };
6
+ export default ScreenHandlerResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-najd/universal-media-tracker-sdk",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -19,8 +19,12 @@
19
19
  "license": "MIT",
20
20
  "type": "module",
21
21
  "devDependencies": {
22
- "@types/node": "^25.5.0",
22
+ "@types/node": "^25.5.2",
23
+ "@types/react": "^19.2.14",
23
24
  "glob": "^13.0.6",
24
25
  "typescript": "^5.9.3"
26
+ },
27
+ "dependencies": {
28
+ "zustand": "^5.0.12"
25
29
  }
26
30
  }