@player-ui/asset-provider-plugin-react 0.8.0--canary.307.9621 → 0.8.0-next.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/cjs/index.cjs +66 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/index.legacy-esm.js +31 -0
- package/dist/index.mjs +31 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +22 -57
- package/src/__tests__/index.test.tsx +23 -0
- package/src/index.tsx +14 -10
- package/{dist → types}/index.d.ts +5 -7
- package/dist/index.cjs.js +0 -31
- package/dist/index.esm.js +0 -23
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/asset-provider/react/src/index.tsx
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
AssetProviderPlugin: () => AssetProviderPlugin
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_react2 = require("@player-ui/react");
|
|
38
|
+
var AssetProviderPlugin = class {
|
|
39
|
+
/**
|
|
40
|
+
* Create a plugin that will register the given React components as assets to Player
|
|
41
|
+
*
|
|
42
|
+
* @param entries - A list of [match, Component] tuples.
|
|
43
|
+
* 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 })
|
|
44
|
+
*/
|
|
45
|
+
constructor(entries) {
|
|
46
|
+
this.name = "web-asset-provider-plugin";
|
|
47
|
+
this.entries = entries;
|
|
48
|
+
}
|
|
49
|
+
applyReact(rp) {
|
|
50
|
+
this.entries.forEach(([match, comp]) => {
|
|
51
|
+
const normalizedMatch = typeof match === "string" ? { type: match } : match;
|
|
52
|
+
rp.assetRegistry.set(normalizedMatch, comp);
|
|
53
|
+
});
|
|
54
|
+
rp.hooks.webComponent.tap(this.name, (Comp) => {
|
|
55
|
+
function AssetRegistryComponent() {
|
|
56
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react2.AssetContext.Provider, { value: { registry: rp.assetRegistry } }, /* @__PURE__ */ import_react.default.createElement(Comp, null));
|
|
57
|
+
}
|
|
58
|
+
return AssetRegistryComponent;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
AssetProviderPlugin
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/asset-provider/react/src/index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { ReactPlayer, ReactPlayerPlugin } from \"@player-ui/react\";\nimport { AssetContext } from \"@player-ui/react\";\n\nexport type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;\n\n/**\n * A streamlined way of registering custom assets with the web-player\n */\nexport class AssetProviderPlugin implements ReactPlayerPlugin {\n name = \"web-asset-provider-plugin\";\n\n private readonly entries: AssetRegistryEntries;\n\n /**\n * Create a plugin that will register the given React components as assets to Player\n *\n * @param entries - A list of [match, Component] tuples.\n * 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 })\n */\n constructor(entries: AssetRegistryEntries) {\n this.entries = entries;\n }\n\n applyReact(rp: ReactPlayer) {\n this.entries.forEach(([match, comp]) => {\n const normalizedMatch =\n typeof match === \"string\" ? { type: match } : match;\n\n rp.assetRegistry.set(normalizedMatch, comp);\n });\n\n // Because some instances may end up with a different copy of the `AssetContext` (depending on bundling and such)\n // We add an entry to use the local version of `@web-player/asset` -- but still utilize the same rp.assetRegistry\n rp.hooks.webComponent.tap(this.name, (Comp) => {\n function AssetRegistryComponent() {\n return (\n <AssetContext.Provider value={{ registry: rp.assetRegistry }}>\n <Comp />\n </AssetContext.Provider>\n );\n }\n\n return AssetRegistryComponent;\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,IAAAA,gBAA6B;AAOtB,IAAM,sBAAN,MAAuD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW5D,YAAY,SAA+B;AAV3C,gBAAO;AAWL,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,WAAW,IAAiB;AAC1B,SAAK,QAAQ,QAAQ,CAAC,CAAC,OAAO,IAAI,MAAM;AACtC,YAAM,kBACJ,OAAO,UAAU,WAAW,EAAE,MAAM,MAAM,IAAI;AAEhD,SAAG,cAAc,IAAI,iBAAiB,IAAI;AAAA,IAC5C,CAAC;AAID,OAAG,MAAM,aAAa,IAAI,KAAK,MAAM,CAAC,SAAS;AAC7C,eAAS,yBAAyB;AAChC,eACE,6BAAAC,QAAA,cAAC,2BAAa,UAAb,EAAsB,OAAO,EAAE,UAAU,GAAG,cAAc,KACzD,6BAAAA,QAAA,cAAC,UAAK,CACR;AAAA,MAEJ;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":["import_react","React"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/asset-provider/react/src/index.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AssetContext } from "@player-ui/react";
|
|
4
|
+
var AssetProviderPlugin = class {
|
|
5
|
+
/**
|
|
6
|
+
* Create a plugin that will register the given React components as assets to Player
|
|
7
|
+
*
|
|
8
|
+
* @param entries - A list of [match, Component] tuples.
|
|
9
|
+
* 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 })
|
|
10
|
+
*/
|
|
11
|
+
constructor(entries) {
|
|
12
|
+
this.name = "web-asset-provider-plugin";
|
|
13
|
+
this.entries = entries;
|
|
14
|
+
}
|
|
15
|
+
applyReact(rp) {
|
|
16
|
+
this.entries.forEach(([match, comp]) => {
|
|
17
|
+
const normalizedMatch = typeof match === "string" ? { type: match } : match;
|
|
18
|
+
rp.assetRegistry.set(normalizedMatch, comp);
|
|
19
|
+
});
|
|
20
|
+
rp.hooks.webComponent.tap(this.name, (Comp) => {
|
|
21
|
+
function AssetRegistryComponent() {
|
|
22
|
+
return /* @__PURE__ */ React.createElement(AssetContext.Provider, { value: { registry: rp.assetRegistry } }, /* @__PURE__ */ React.createElement(Comp, null));
|
|
23
|
+
}
|
|
24
|
+
return AssetRegistryComponent;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
AssetProviderPlugin
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/asset-provider/react/src/index.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AssetContext } from "@player-ui/react";
|
|
4
|
+
var AssetProviderPlugin = class {
|
|
5
|
+
/**
|
|
6
|
+
* Create a plugin that will register the given React components as assets to Player
|
|
7
|
+
*
|
|
8
|
+
* @param entries - A list of [match, Component] tuples.
|
|
9
|
+
* 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 })
|
|
10
|
+
*/
|
|
11
|
+
constructor(entries) {
|
|
12
|
+
this.name = "web-asset-provider-plugin";
|
|
13
|
+
this.entries = entries;
|
|
14
|
+
}
|
|
15
|
+
applyReact(rp) {
|
|
16
|
+
this.entries.forEach(([match, comp]) => {
|
|
17
|
+
const normalizedMatch = typeof match === "string" ? { type: match } : match;
|
|
18
|
+
rp.assetRegistry.set(normalizedMatch, comp);
|
|
19
|
+
});
|
|
20
|
+
rp.hooks.webComponent.tap(this.name, (Comp) => {
|
|
21
|
+
function AssetRegistryComponent() {
|
|
22
|
+
return /* @__PURE__ */ React.createElement(AssetContext.Provider, { value: { registry: rp.assetRegistry } }, /* @__PURE__ */ React.createElement(Comp, null));
|
|
23
|
+
}
|
|
24
|
+
return AssetRegistryComponent;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
AssetProviderPlugin
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/asset-provider/react/src/index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { ReactPlayer, ReactPlayerPlugin } from \"@player-ui/react\";\nimport { AssetContext } from \"@player-ui/react\";\n\nexport type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;\n\n/**\n * A streamlined way of registering custom assets with the web-player\n */\nexport class AssetProviderPlugin implements ReactPlayerPlugin {\n name = \"web-asset-provider-plugin\";\n\n private readonly entries: AssetRegistryEntries;\n\n /**\n * Create a plugin that will register the given React components as assets to Player\n *\n * @param entries - A list of [match, Component] tuples.\n * 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 })\n */\n constructor(entries: AssetRegistryEntries) {\n this.entries = entries;\n }\n\n applyReact(rp: ReactPlayer) {\n this.entries.forEach(([match, comp]) => {\n const normalizedMatch =\n typeof match === \"string\" ? { type: match } : match;\n\n rp.assetRegistry.set(normalizedMatch, comp);\n });\n\n // Because some instances may end up with a different copy of the `AssetContext` (depending on bundling and such)\n // We add an entry to use the local version of `@web-player/asset` -- but still utilize the same rp.assetRegistry\n rp.hooks.webComponent.tap(this.name, (Comp) => {\n function AssetRegistryComponent() {\n return (\n <AssetContext.Provider value={{ registry: rp.assetRegistry }}>\n <Comp />\n </AssetContext.Provider>\n );\n }\n\n return AssetRegistryComponent;\n });\n }\n}\n"],"mappings":";AAAA,OAAO,WAAW;AAElB,SAAS,oBAAoB;AAOtB,IAAM,sBAAN,MAAuD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW5D,YAAY,SAA+B;AAV3C,gBAAO;AAWL,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,WAAW,IAAiB;AAC1B,SAAK,QAAQ,QAAQ,CAAC,CAAC,OAAO,IAAI,MAAM;AACtC,YAAM,kBACJ,OAAO,UAAU,WAAW,EAAE,MAAM,MAAM,IAAI;AAEhD,SAAG,cAAc,IAAI,iBAAiB,IAAI;AAAA,IAC5C,CAAC;AAID,OAAG,MAAM,aAAa,IAAI,KAAK,MAAM,CAAC,SAAS;AAC7C,eAAS,yBAAyB;AAChC,eACE,oCAAC,aAAa,UAAb,EAAsB,OAAO,EAAE,UAAU,GAAG,cAAc,KACzD,oCAAC,UAAK,CACR;AAAA,MAEJ;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,66 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/asset-provider-plugin-react",
|
|
3
|
-
"version": "0.8.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "0.8.0-next.0",
|
|
4
|
+
"main": "dist/cjs/index.cjs",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@player-ui/react-subscribe": "0.8.0-next.0",
|
|
7
|
+
"tslib": "^2.6.2"
|
|
7
8
|
},
|
|
8
9
|
"peerDependencies": {
|
|
9
|
-
"@player-ui/react": "0.8.0
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"@player-ui/react-subscribe": "0.8.0--canary.307.9621",
|
|
13
|
-
"@babel/runtime": "7.15.4"
|
|
10
|
+
"@player-ui/react": "0.8.0-next.0",
|
|
11
|
+
"react": "^18.2.0",
|
|
12
|
+
"@types/react": "^18.2.39"
|
|
14
13
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"typings": "dist/index.d.ts",
|
|
14
|
+
"module": "dist/index.legacy-esm.js",
|
|
15
|
+
"types": "types/index.d.ts",
|
|
18
16
|
"sideEffects": false,
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
"homepage": "https://player-ui.github.io",
|
|
28
|
-
"contributors": [
|
|
29
|
-
{
|
|
30
|
-
"name": "Adam Dierkens",
|
|
31
|
-
"url": "https://github.com/adierkens"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "Spencer Hamm",
|
|
35
|
-
"url": "https://github.com/spentacular"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "Harris Borawski",
|
|
39
|
-
"url": "https://github.com/hborawski"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "Jeremiah Zucker",
|
|
43
|
-
"url": "https://github.com/sugarmanz"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"name": "Ketan Reddy",
|
|
47
|
-
"url": "https://github.com/KetanReddy"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "Brocollie08",
|
|
51
|
-
"url": "https://github.com/brocollie08"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"name": "Kelly Harrop",
|
|
55
|
-
"url": "https://github.com/kharrop"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "Alejandro Fimbres",
|
|
59
|
-
"url": "https://github.com/lexfm"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"name": "Rafael Campos",
|
|
63
|
-
"url": "https://github.com/rafbcampos"
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": "./package.json",
|
|
19
|
+
"./dist/index.css": "./dist/index.css",
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./types/index.d.ts",
|
|
22
|
+
"import": "./dist/index.mjs",
|
|
23
|
+
"default": "./dist/cjs/index.cjs"
|
|
64
24
|
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"src",
|
|
29
|
+
"types"
|
|
65
30
|
]
|
|
66
31
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ReactPlayer } from "@player-ui/react";
|
|
4
|
+
import { AssetProviderPlugin } from "..";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
const DummyComp = () => <div>Test</div>;
|
|
10
|
+
|
|
11
|
+
test("loads entries into the web-player registry", () => {
|
|
12
|
+
const rp = new ReactPlayer({
|
|
13
|
+
plugins: [
|
|
14
|
+
new AssetProviderPlugin([
|
|
15
|
+
["test-string", DummyComp],
|
|
16
|
+
[{ type: "full-match" }, DummyComp],
|
|
17
|
+
]),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
expect(rp.assetRegistry.get({ type: "test-string" })).toBe(DummyComp);
|
|
22
|
+
expect(rp.assetRegistry.get({ type: "full-match" })).toBe(DummyComp);
|
|
23
|
+
});
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { ReactPlayer, ReactPlayerPlugin } from
|
|
3
|
-
import { AssetContext } from
|
|
1
|
+
import React from "react";
|
|
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
|
|
|
@@ -8,7 +8,7 @@ export type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;
|
|
|
8
8
|
* A streamlined way of registering custom assets with the web-player
|
|
9
9
|
*/
|
|
10
10
|
export class AssetProviderPlugin implements ReactPlayerPlugin {
|
|
11
|
-
name =
|
|
11
|
+
name = "web-asset-provider-plugin";
|
|
12
12
|
|
|
13
13
|
private readonly entries: AssetRegistryEntries;
|
|
14
14
|
|
|
@@ -25,7 +25,7 @@ export class AssetProviderPlugin implements ReactPlayerPlugin {
|
|
|
25
25
|
applyReact(rp: ReactPlayer) {
|
|
26
26
|
this.entries.forEach(([match, comp]) => {
|
|
27
27
|
const normalizedMatch =
|
|
28
|
-
typeof match ===
|
|
28
|
+
typeof match === "string" ? { type: match } : match;
|
|
29
29
|
|
|
30
30
|
rp.assetRegistry.set(normalizedMatch, comp);
|
|
31
31
|
});
|
|
@@ -33,11 +33,15 @@ export class AssetProviderPlugin implements ReactPlayerPlugin {
|
|
|
33
33
|
// Because some instances may end up with a different copy of the `AssetContext` (depending on bundling and such)
|
|
34
34
|
// We add an entry to use the local version of `@web-player/asset` -- but still utilize the same rp.assetRegistry
|
|
35
35
|
rp.hooks.webComponent.tap(this.name, (Comp) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
function AssetRegistryComponent() {
|
|
37
|
+
return (
|
|
38
|
+
<AssetContext.Provider value={{ registry: rp.assetRegistry }}>
|
|
39
|
+
<Comp />
|
|
40
|
+
</AssetContext.Provider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return AssetRegistryComponent;
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
declare type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ReactPlayer, ReactPlayerPlugin } from "@player-ui/react";
|
|
3
|
+
export type AssetRegistryEntries = Array<[any, React.ComponentType<any>]>;
|
|
5
4
|
/**
|
|
6
5
|
* A streamlined way of registering custom assets with the web-player
|
|
7
6
|
*/
|
|
8
|
-
declare class AssetProviderPlugin implements ReactPlayerPlugin {
|
|
7
|
+
export declare class AssetProviderPlugin implements ReactPlayerPlugin {
|
|
9
8
|
name: string;
|
|
10
9
|
private readonly entries;
|
|
11
10
|
/**
|
|
@@ -17,5 +16,4 @@ declare class AssetProviderPlugin implements ReactPlayerPlugin {
|
|
|
17
16
|
constructor(entries: AssetRegistryEntries);
|
|
18
17
|
applyReact(rp: ReactPlayer): void;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
export { AssetProviderPlugin, AssetRegistryEntries };
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.cjs.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var react = require('@player-ui/react');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
|
-
|
|
12
|
-
class AssetProviderPlugin {
|
|
13
|
-
constructor(entries) {
|
|
14
|
-
this.name = "web-asset-provider-plugin";
|
|
15
|
-
this.entries = entries;
|
|
16
|
-
}
|
|
17
|
-
applyReact(rp) {
|
|
18
|
-
this.entries.forEach(([match, comp]) => {
|
|
19
|
-
const normalizedMatch = typeof match === "string" ? { type: match } : match;
|
|
20
|
-
rp.assetRegistry.set(normalizedMatch, comp);
|
|
21
|
-
});
|
|
22
|
-
rp.hooks.webComponent.tap(this.name, (Comp) => {
|
|
23
|
-
return () => /* @__PURE__ */ React__default["default"].createElement(react.AssetContext.Provider, {
|
|
24
|
-
value: { registry: rp.assetRegistry }
|
|
25
|
-
}, /* @__PURE__ */ React__default["default"].createElement(Comp, null));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
exports.AssetProviderPlugin = AssetProviderPlugin;
|
|
31
|
-
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.esm.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AssetContext } from '@player-ui/react';
|
|
3
|
-
|
|
4
|
-
class AssetProviderPlugin {
|
|
5
|
-
constructor(entries) {
|
|
6
|
-
this.name = "web-asset-provider-plugin";
|
|
7
|
-
this.entries = entries;
|
|
8
|
-
}
|
|
9
|
-
applyReact(rp) {
|
|
10
|
-
this.entries.forEach(([match, comp]) => {
|
|
11
|
-
const normalizedMatch = typeof match === "string" ? { type: match } : match;
|
|
12
|
-
rp.assetRegistry.set(normalizedMatch, comp);
|
|
13
|
-
});
|
|
14
|
-
rp.hooks.webComponent.tap(this.name, (Comp) => {
|
|
15
|
-
return () => /* @__PURE__ */ React.createElement(AssetContext.Provider, {
|
|
16
|
-
value: { registry: rp.assetRegistry }
|
|
17
|
-
}, /* @__PURE__ */ React.createElement(Comp, null));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { AssetProviderPlugin };
|
|
23
|
-
//# sourceMappingURL=index.esm.js.map
|