@player-ui/asset-provider-plugin-react 0.3.0-next.3 → 0.3.0-next.4

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/index.cjs.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var reactAsset = require('@player-ui/react-asset');
6
+ var react = require('@player-ui/react');
7
7
 
8
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
9
 
@@ -14,14 +14,14 @@ class AssetProviderPlugin {
14
14
  this.name = "web-asset-provider-plugin";
15
15
  this.entries = entries;
16
16
  }
17
- applyWeb(wp) {
17
+ applyReact(rp) {
18
18
  this.entries.forEach(([match, comp]) => {
19
19
  const normalizedMatch = typeof match === "string" ? { type: match } : match;
20
- wp.assetRegistry.set(normalizedMatch, comp);
20
+ rp.assetRegistry.set(normalizedMatch, comp);
21
21
  });
22
- wp.hooks.webComponent.tap(this.name, (Comp) => {
23
- return () => /* @__PURE__ */ React__default["default"].createElement(reactAsset.AssetContext.Provider, {
24
- value: { registry: wp.assetRegistry }
22
+ rp.hooks.webComponent.tap(this.name, (Comp) => {
23
+ return () => /* @__PURE__ */ React__default["default"].createElement(react.AssetContext.Provider, {
24
+ value: { registry: rp.assetRegistry }
25
25
  }, /* @__PURE__ */ React__default["default"].createElement(Comp, null));
26
26
  });
27
27
  }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { WebPlayerPlugin, WebPlayer } from '@player-ui/react';
2
+ import { ReactPlayerPlugin, ReactPlayer } from '@player-ui/react';
3
3
 
4
4
  declare type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;
5
5
  /**
6
6
  * A streamlined way of registering custom assets with the web-player
7
7
  */
8
- declare class AssetProviderPlugin implements WebPlayerPlugin {
8
+ declare class AssetProviderPlugin implements ReactPlayerPlugin {
9
9
  name: string;
10
10
  private readonly entries;
11
11
  /**
@@ -15,7 +15,7 @@ declare class AssetProviderPlugin implements WebPlayerPlugin {
15
15
  * If the [match] is an object, it is used as-is. If it's a `string`, we assume the match represents the 'type' property ({ type: match })
16
16
  */
17
17
  constructor(entries: AssetRegistryEntries);
18
- applyWeb(wp: WebPlayer): void;
18
+ applyReact(rp: ReactPlayer): void;
19
19
  }
20
20
 
21
21
  export { AssetProviderPlugin, AssetRegistryEntries };
package/dist/index.esm.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import React from 'react';
2
- import { AssetContext } from '@player-ui/react-asset';
2
+ import { AssetContext } from '@player-ui/react';
3
3
 
4
4
  class AssetProviderPlugin {
5
5
  constructor(entries) {
6
6
  this.name = "web-asset-provider-plugin";
7
7
  this.entries = entries;
8
8
  }
9
- applyWeb(wp) {
9
+ applyReact(rp) {
10
10
  this.entries.forEach(([match, comp]) => {
11
11
  const normalizedMatch = typeof match === "string" ? { type: match } : match;
12
- wp.assetRegistry.set(normalizedMatch, comp);
12
+ rp.assetRegistry.set(normalizedMatch, comp);
13
13
  });
14
- wp.hooks.webComponent.tap(this.name, (Comp) => {
14
+ rp.hooks.webComponent.tap(this.name, (Comp) => {
15
15
  return () => /* @__PURE__ */ React.createElement(AssetContext.Provider, {
16
- value: { registry: wp.assetRegistry }
16
+ value: { registry: rp.assetRegistry }
17
17
  }, /* @__PURE__ */ React.createElement(Comp, null));
18
18
  });
19
19
  }
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@player-ui/asset-provider-plugin-react",
3
- "version": "0.3.0-next.3",
3
+ "version": "0.3.0-next.4",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
7
7
  },
8
8
  "peerDependencies": {
9
- "@player-ui/react": "0.3.0-next.3"
9
+ "@player-ui/react": "0.3.0-next.4"
10
10
  },
11
11
  "dependencies": {
12
- "@player-ui/react-asset": "0.3.0-next.3",
13
- "@player-ui/react-subscribe": "0.3.0-next.3",
12
+ "@player-ui/react-subscribe": "0.3.0-next.4",
14
13
  "@babel/runtime": "7.15.4"
15
14
  },
16
15
  "main": "dist/index.cjs.js",
package/src/index.tsx CHANGED
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- import type { WebPlayer, WebPlayerPlugin } from '@player-ui/react';
3
- import { AssetContext } from '@player-ui/react-asset';
2
+ import type { ReactPlayer, ReactPlayerPlugin } from '@player-ui/react';
3
+ import { AssetContext } from '@player-ui/react';
4
4
 
5
5
  export type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;
6
6
 
7
7
  /**
8
8
  * A streamlined way of registering custom assets with the web-player
9
9
  */
10
- export class AssetProviderPlugin implements WebPlayerPlugin {
10
+ export class AssetProviderPlugin implements ReactPlayerPlugin {
11
11
  name = 'web-asset-provider-plugin';
12
12
 
13
13
  private readonly entries: AssetRegistryEntries;
@@ -22,19 +22,19 @@ export class AssetProviderPlugin implements WebPlayerPlugin {
22
22
  this.entries = entries;
23
23
  }
24
24
 
25
- applyWeb(wp: WebPlayer) {
25
+ applyReact(rp: ReactPlayer) {
26
26
  this.entries.forEach(([match, comp]) => {
27
27
  const normalizedMatch =
28
28
  typeof match === 'string' ? { type: match } : match;
29
29
 
30
- wp.assetRegistry.set(normalizedMatch, comp);
30
+ rp.assetRegistry.set(normalizedMatch, comp);
31
31
  });
32
32
 
33
33
  // Because some instances may end up with a different copy of the `AssetContext` (depending on bundling and such)
34
- // We add an entry to use the local version of `@web-player/asset` -- but still utilize the same wp.assetRegistry
35
- wp.hooks.webComponent.tap(this.name, (Comp) => {
34
+ // We add an entry to use the local version of `@web-player/asset` -- but still utilize the same rp.assetRegistry
35
+ rp.hooks.webComponent.tap(this.name, (Comp) => {
36
36
  return () => (
37
- <AssetContext.Provider value={{ registry: wp.assetRegistry }}>
37
+ <AssetContext.Provider value={{ registry: rp.assetRegistry }}>
38
38
  <Comp />
39
39
  </AssetContext.Provider>
40
40
  );