@player-ui/expression-plugin 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/ExpressionPlugin.native.js +98 -0
- package/dist/ExpressionPlugin.native.js.map +1 -0
- package/dist/cjs/index.cjs +43 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/{index.esm.js → index.legacy-esm.js} +7 -5
- package/dist/{index.cjs.js → index.mjs} +7 -9
- package/dist/index.mjs.map +1 -0
- package/package.json +22 -59
- package/src/index.test.ts +53 -0
- package/src/index.ts +2 -2
- package/{dist → types}/index.d.ts +4 -6
- package/dist/expression-plugin.dev.js +0 -130
- package/dist/expression-plugin.prod.js +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _class_call_check(instance, Constructor) {
|
|
3
|
+
if (!(instance instanceof Constructor)) {
|
|
4
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function _defineProperties(target, props) {
|
|
8
|
+
for(var i = 0; i < props.length; i++){
|
|
9
|
+
var descriptor = props[i];
|
|
10
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
11
|
+
descriptor.configurable = true;
|
|
12
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
13
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
18
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
19
|
+
return Constructor;
|
|
20
|
+
}
|
|
21
|
+
var ExpressionPlugin = function() {
|
|
22
|
+
var __defProp = Object.defineProperty;
|
|
23
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
24
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
25
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
26
|
+
var __export = function(target, all) {
|
|
27
|
+
for(var name in all)__defProp(target, name, {
|
|
28
|
+
get: all[name],
|
|
29
|
+
enumerable: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var __copyProps = function(to, from, except, desc) {
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
35
|
+
try {
|
|
36
|
+
var _loop = function() {
|
|
37
|
+
var key = _step.value;
|
|
38
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
39
|
+
get: function() {
|
|
40
|
+
return from[key];
|
|
41
|
+
},
|
|
42
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
46
|
+
} catch (err) {
|
|
47
|
+
_didIteratorError = true;
|
|
48
|
+
_iteratorError = err;
|
|
49
|
+
} finally{
|
|
50
|
+
try {
|
|
51
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
52
|
+
_iterator.return();
|
|
53
|
+
}
|
|
54
|
+
} finally{
|
|
55
|
+
if (_didIteratorError) {
|
|
56
|
+
throw _iteratorError;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to;
|
|
62
|
+
};
|
|
63
|
+
var __toCommonJS = function(mod) {
|
|
64
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
65
|
+
value: true
|
|
66
|
+
}), mod);
|
|
67
|
+
};
|
|
68
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts
|
|
69
|
+
var src_exports = {};
|
|
70
|
+
__export(src_exports, {
|
|
71
|
+
ExpressionPlugin: function() {
|
|
72
|
+
return ExpressionPlugin;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var ExpressionPlugin = /*#__PURE__*/ function() {
|
|
76
|
+
function ExpressionPlugin(expressionMap) {
|
|
77
|
+
_class_call_check(this, ExpressionPlugin);
|
|
78
|
+
this.name = "ExpressionPlugin";
|
|
79
|
+
this.expressions = expressionMap;
|
|
80
|
+
}
|
|
81
|
+
_create_class(ExpressionPlugin, [
|
|
82
|
+
{
|
|
83
|
+
key: "apply",
|
|
84
|
+
value: function apply(player) {
|
|
85
|
+
var _this = this;
|
|
86
|
+
player.hooks.expressionEvaluator.tap(this.name, function(expEvaluator) {
|
|
87
|
+
_this.expressions.forEach(function(handler, name) {
|
|
88
|
+
expEvaluator.addExpressionFunction(name, handler);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]);
|
|
94
|
+
return ExpressionPlugin;
|
|
95
|
+
}();
|
|
96
|
+
return __toCommonJS(src_exports);
|
|
97
|
+
}();
|
|
98
|
+
//# sourceMappingURL=index.global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAcO,MAAM,mBAAN,MAA+C;AAAA,IAIpD,YAAY,eAA8B;AAH1C,kBAAO;AAIL,WAAK,cAAc;AAAA,IACrB;AAAA,IAEA,MAAM,QAAgB;AACpB,aAAO,MAAM,oBAAoB,IAAI,KAAK,MAAM,CAAC,iBAAiB;AAChE,aAAK,YAAY,QAAQ,CAAC,SAAS,SAAS;AAC1C,uBAAa,sBAAsB,MAAM,OAAO;AAAA,QAClD,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,EACF","sourcesContent":["import type {\n Player,\n PlayerPlugin,\n ExpressionHandler,\n} from \"@player-ui/player\";\n\nexport type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;\n\n/**\n * The ExpressionPlugin is an easy way to inject custom expression handlers into the running player instance.\n * Simply supply a map of function name to handler, and the expressions will be available inside of the Content.\n *\n * Any subsequent expressions registered with the same name will override previous handlers.\n */\nexport class ExpressionPlugin implements PlayerPlugin {\n name = \"ExpressionPlugin\";\n private expressions: ExpressionMap;\n\n constructor(expressionMap: ExpressionMap) {\n this.expressions = expressionMap;\n }\n\n apply(player: Player) {\n player.hooks.expressionEvaluator.tap(this.name, (expEvaluator) => {\n this.expressions.forEach((handler, name) => {\n expEvaluator.addExpressionFunction(name, handler);\n });\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
ExpressionPlugin: () => ExpressionPlugin
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
var ExpressionPlugin = class {
|
|
27
|
+
constructor(expressionMap) {
|
|
28
|
+
this.name = "ExpressionPlugin";
|
|
29
|
+
this.expressions = expressionMap;
|
|
30
|
+
}
|
|
31
|
+
apply(player) {
|
|
32
|
+
player.hooks.expressionEvaluator.tap(this.name, (expEvaluator) => {
|
|
33
|
+
this.expressions.forEach((handler, name) => {
|
|
34
|
+
expEvaluator.addExpressionFunction(name, handler);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
ExpressionPlugin
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts"],"sourcesContent":["import type {\n Player,\n PlayerPlugin,\n ExpressionHandler,\n} from \"@player-ui/player\";\n\nexport type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;\n\n/**\n * The ExpressionPlugin is an easy way to inject custom expression handlers into the running player instance.\n * Simply supply a map of function name to handler, and the expressions will be available inside of the Content.\n *\n * Any subsequent expressions registered with the same name will override previous handlers.\n */\nexport class ExpressionPlugin implements PlayerPlugin {\n name = \"ExpressionPlugin\";\n private expressions: ExpressionMap;\n\n constructor(expressionMap: ExpressionMap) {\n this.expressions = expressionMap;\n }\n\n apply(player: Player) {\n player.hooks.expressionEvaluator.tap(this.name, (expEvaluator) => {\n this.expressions.forEach((handler, name) => {\n expEvaluator.addExpressionFunction(name, handler);\n });\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,IAAM,mBAAN,MAA+C;AAAA,EAIpD,YAAY,eAA8B;AAH1C,gBAAO;AAIL,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,MAAM,QAAgB;AACpB,WAAO,MAAM,oBAAoB,IAAI,KAAK,MAAM,CAAC,iBAAiB;AAChE,WAAK,YAAY,QAAQ,CAAC,SAAS,SAAS;AAC1C,qBAAa,sBAAsB,MAAM,OAAO;AAAA,MAClD,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts
|
|
2
|
+
var ExpressionPlugin = class {
|
|
2
3
|
constructor(expressionMap) {
|
|
3
4
|
this.name = "ExpressionPlugin";
|
|
4
5
|
this.expressions = expressionMap;
|
|
@@ -10,7 +11,8 @@ class ExpressionPlugin {
|
|
|
10
11
|
});
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
ExpressionPlugin
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
class ExpressionPlugin {
|
|
1
|
+
// ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts
|
|
2
|
+
var ExpressionPlugin = class {
|
|
6
3
|
constructor(expressionMap) {
|
|
7
4
|
this.name = "ExpressionPlugin";
|
|
8
5
|
this.expressions = expressionMap;
|
|
@@ -14,7 +11,8 @@ class ExpressionPlugin {
|
|
|
14
11
|
});
|
|
15
12
|
});
|
|
16
13
|
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
ExpressionPlugin
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/expression/core/src/index.ts"],"sourcesContent":["import type {\n Player,\n PlayerPlugin,\n ExpressionHandler,\n} from \"@player-ui/player\";\n\nexport type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;\n\n/**\n * The ExpressionPlugin is an easy way to inject custom expression handlers into the running player instance.\n * Simply supply a map of function name to handler, and the expressions will be available inside of the Content.\n *\n * Any subsequent expressions registered with the same name will override previous handlers.\n */\nexport class ExpressionPlugin implements PlayerPlugin {\n name = \"ExpressionPlugin\";\n private expressions: ExpressionMap;\n\n constructor(expressionMap: ExpressionMap) {\n this.expressions = expressionMap;\n }\n\n apply(player: Player) {\n player.hooks.expressionEvaluator.tap(this.name, (expEvaluator) => {\n this.expressions.forEach((handler, name) => {\n expEvaluator.addExpressionFunction(name, handler);\n });\n });\n }\n}\n"],"mappings":";AAcO,IAAM,mBAAN,MAA+C;AAAA,EAIpD,YAAY,eAA8B;AAH1C,gBAAO;AAIL,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,MAAM,QAAgB;AACpB,WAAO,MAAM,oBAAoB,IAAI,KAAK,MAAM,CAAC,iBAAiB;AAChE,WAAK,YAAY,QAAQ,CAAC,SAAS,SAAS;AAC1C,qBAAa,sBAAsB,MAAM,OAAO;AAAA,MAClD,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,67 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/expression-plugin",
|
|
3
|
-
"version": "0.8.0
|
|
4
|
-
"
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"registry": "https://registry.npmjs.org"
|
|
7
|
-
},
|
|
3
|
+
"version": "0.8.0-next.0",
|
|
4
|
+
"main": "dist/cjs/index.cjs",
|
|
8
5
|
"peerDependencies": {
|
|
9
|
-
"@player-ui/player": "0.8.0
|
|
6
|
+
"@player-ui/player": "0.8.0-next.0"
|
|
10
7
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
"main": "dist/index.cjs.js",
|
|
16
|
-
"module": "dist/index.esm.js",
|
|
17
|
-
"typings": "dist/index.d.ts",
|
|
8
|
+
"module": "dist/index.legacy-esm.js",
|
|
9
|
+
"types": "types/index.d.ts",
|
|
10
|
+
"bundle": "dist/ExpressionPlugin.native.js",
|
|
18
11
|
"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"
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
"./dist/index.css": "./dist/index.css",
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./types/index.d.ts",
|
|
17
|
+
"import": "./dist/index.mjs",
|
|
18
|
+
"default": "./dist/cjs/index.cjs"
|
|
64
19
|
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src",
|
|
24
|
+
"types"
|
|
65
25
|
],
|
|
66
|
-
"
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tapable-ts": "^0.2.3",
|
|
28
|
+
"tslib": "^2.6.2"
|
|
29
|
+
}
|
|
67
30
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { test, expect } from "vitest";
|
|
2
|
+
import type { InProgressState } from "@player-ui/player";
|
|
3
|
+
import { Player } from "@player-ui/player";
|
|
4
|
+
import { ExpressionPlugin } from ".";
|
|
5
|
+
|
|
6
|
+
const minimal = {
|
|
7
|
+
id: "minimal",
|
|
8
|
+
views: [
|
|
9
|
+
{
|
|
10
|
+
id: "view-1",
|
|
11
|
+
type: "info",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
navigation: {
|
|
15
|
+
BEGIN: "FLOW_1",
|
|
16
|
+
FLOW_1: {
|
|
17
|
+
onStart: 'testExp("arguments")',
|
|
18
|
+
startState: "VIEW_1",
|
|
19
|
+
VIEW_1: {
|
|
20
|
+
ref: "view-1",
|
|
21
|
+
state_type: "VIEW",
|
|
22
|
+
transitions: {
|
|
23
|
+
Next: "VIEW_2",
|
|
24
|
+
"*": "END_Done",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
test("loads an expression", () => {
|
|
32
|
+
const player = new Player({
|
|
33
|
+
plugins: [
|
|
34
|
+
new ExpressionPlugin(
|
|
35
|
+
new Map([
|
|
36
|
+
[
|
|
37
|
+
"testExp",
|
|
38
|
+
(ctx, arg1) => {
|
|
39
|
+
ctx.model.set([["foo.bar", `it works! ${arg1}`]]);
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
]),
|
|
43
|
+
),
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
player.start(minimal as any);
|
|
48
|
+
const state = player.getState() as InProgressState;
|
|
49
|
+
|
|
50
|
+
expect(state.controllers.data.get("foo")).toStrictEqual({
|
|
51
|
+
bar: "it works! arguments",
|
|
52
|
+
});
|
|
53
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
Player,
|
|
3
3
|
PlayerPlugin,
|
|
4
4
|
ExpressionHandler,
|
|
5
|
-
} from
|
|
5
|
+
} from "@player-ui/player";
|
|
6
6
|
|
|
7
7
|
export type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;
|
|
|
13
13
|
* Any subsequent expressions registered with the same name will override previous handlers.
|
|
14
14
|
*/
|
|
15
15
|
export class ExpressionPlugin implements PlayerPlugin {
|
|
16
|
-
name =
|
|
16
|
+
name = "ExpressionPlugin";
|
|
17
17
|
private expressions: ExpressionMap;
|
|
18
18
|
|
|
19
19
|
constructor(expressionMap: ExpressionMap) {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;
|
|
1
|
+
import type { Player, PlayerPlugin, ExpressionHandler } from "@player-ui/player";
|
|
2
|
+
export type ExpressionMap = Map<string, ExpressionHandler<any[], any>>;
|
|
4
3
|
/**
|
|
5
4
|
* The ExpressionPlugin is an easy way to inject custom expression handlers into the running player instance.
|
|
6
5
|
* Simply supply a map of function name to handler, and the expressions will be available inside of the Content.
|
|
7
6
|
*
|
|
8
7
|
* Any subsequent expressions registered with the same name will override previous handlers.
|
|
9
8
|
*/
|
|
10
|
-
declare class ExpressionPlugin implements PlayerPlugin {
|
|
9
|
+
export declare class ExpressionPlugin implements PlayerPlugin {
|
|
11
10
|
name: string;
|
|
12
11
|
private expressions;
|
|
13
12
|
constructor(expressionMap: ExpressionMap);
|
|
14
13
|
apply(player: Player): void;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
export { ExpressionMap, ExpressionPlugin };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else if(typeof exports === 'object')
|
|
7
|
-
exports["ExpressionPlugin"] = factory();
|
|
8
|
-
else
|
|
9
|
-
root["ExpressionPlugin"] = factory();
|
|
10
|
-
})(this, function() {
|
|
11
|
-
return /******/ (function(modules) { // webpackBootstrap
|
|
12
|
-
/******/ // The module cache
|
|
13
|
-
/******/ var installedModules = {};
|
|
14
|
-
/******/
|
|
15
|
-
/******/ // The require function
|
|
16
|
-
/******/ function __webpack_require__(moduleId) {
|
|
17
|
-
/******/
|
|
18
|
-
/******/ // Check if module is in cache
|
|
19
|
-
/******/ if(installedModules[moduleId]) {
|
|
20
|
-
/******/ return installedModules[moduleId].exports;
|
|
21
|
-
/******/ }
|
|
22
|
-
/******/ // Create a new module (and put it into the cache)
|
|
23
|
-
/******/ var module = installedModules[moduleId] = {
|
|
24
|
-
/******/ i: moduleId,
|
|
25
|
-
/******/ l: false,
|
|
26
|
-
/******/ exports: {}
|
|
27
|
-
/******/ };
|
|
28
|
-
/******/
|
|
29
|
-
/******/ // Execute the module function
|
|
30
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
-
/******/
|
|
32
|
-
/******/ // Flag the module as loaded
|
|
33
|
-
/******/ module.l = true;
|
|
34
|
-
/******/
|
|
35
|
-
/******/ // Return the exports of the module
|
|
36
|
-
/******/ return module.exports;
|
|
37
|
-
/******/ }
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
-
/******/ __webpack_require__.m = modules;
|
|
42
|
-
/******/
|
|
43
|
-
/******/ // expose the module cache
|
|
44
|
-
/******/ __webpack_require__.c = installedModules;
|
|
45
|
-
/******/
|
|
46
|
-
/******/ // define getter function for harmony exports
|
|
47
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
-
/******/ }
|
|
51
|
-
/******/ };
|
|
52
|
-
/******/
|
|
53
|
-
/******/ // define __esModule on exports
|
|
54
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
-
/******/ }
|
|
58
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
-
/******/ };
|
|
60
|
-
/******/
|
|
61
|
-
/******/ // create a fake namespace object
|
|
62
|
-
/******/ // mode & 1: value is a module id, require it
|
|
63
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
-
/******/ // mode & 4: return value when already ns object
|
|
65
|
-
/******/ // mode & 8|1: behave like require
|
|
66
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
-
/******/ if(mode & 8) return value;
|
|
69
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
-
/******/ var ns = Object.create(null);
|
|
71
|
-
/******/ __webpack_require__.r(ns);
|
|
72
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
-
/******/ return ns;
|
|
75
|
-
/******/ };
|
|
76
|
-
/******/
|
|
77
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
-
/******/ __webpack_require__.n = function(module) {
|
|
79
|
-
/******/ var getter = module && module.__esModule ?
|
|
80
|
-
/******/ function getDefault() { return module['default']; } :
|
|
81
|
-
/******/ function getModuleExports() { return module; };
|
|
82
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
-
/******/ return getter;
|
|
84
|
-
/******/ };
|
|
85
|
-
/******/
|
|
86
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // __webpack_public_path__
|
|
90
|
-
/******/ __webpack_require__.p = "";
|
|
91
|
-
/******/
|
|
92
|
-
/******/
|
|
93
|
-
/******/ // Load entry module and return exports
|
|
94
|
-
/******/ return __webpack_require__(__webpack_require__.s = "./bazel-out/k8-fastbuild/bin/plugins/expression/core/dist/index.esm.js");
|
|
95
|
-
/******/ })
|
|
96
|
-
/************************************************************************/
|
|
97
|
-
/******/ ({
|
|
98
|
-
|
|
99
|
-
/***/ "./bazel-out/k8-fastbuild/bin/plugins/expression/core/dist/index.esm.js":
|
|
100
|
-
/*!******************************************************************************!*\
|
|
101
|
-
!*** ./bazel-out/k8-fastbuild/bin/plugins/expression/core/dist/index.esm.js ***!
|
|
102
|
-
\******************************************************************************/
|
|
103
|
-
/*! exports provided: ExpressionPlugin */
|
|
104
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
105
|
-
|
|
106
|
-
"use strict";
|
|
107
|
-
__webpack_require__.r(__webpack_exports__);
|
|
108
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionPlugin", function() { return ExpressionPlugin; });
|
|
109
|
-
class ExpressionPlugin {
|
|
110
|
-
constructor(expressionMap) {
|
|
111
|
-
this.name = "ExpressionPlugin";
|
|
112
|
-
this.expressions = expressionMap;
|
|
113
|
-
}
|
|
114
|
-
apply(player) {
|
|
115
|
-
player.hooks.expressionEvaluator.tap(this.name, (expEvaluator) => {
|
|
116
|
-
this.expressions.forEach((handler, name) => {
|
|
117
|
-
expEvaluator.addExpressionFunction(name, handler);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
//# sourceMappingURL=index.esm.js.map
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/***/ })
|
|
128
|
-
|
|
129
|
-
/******/ });
|
|
130
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports.ExpressionPlugin=t():e.ExpressionPlugin=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"ExpressionPlugin",(function(){return r}));class r{constructor(e){this.name="ExpressionPlugin",this.expressions=e}apply(e){e.hooks.expressionEvaluator.tap(this.name,(e=>{this.expressions.forEach(((t,n)=>{e.addExpressionFunction(n,t)}))}))}}}])}));
|