@player-ui/player 0.1.1-next.7 → 0.1.1
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 +13 -8
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +13 -8
- package/package.json +14 -14
- package/src/player.ts +18 -2
- package/src/plugins/flow-exp-plugin.ts +0 -11
- package/src/validation/controller.ts +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -976,12 +976,6 @@ class FlowExpPlugin {
|
|
|
976
976
|
flow.hooks.onEnd.tap(this.name, (exp) => handleEval(exp));
|
|
977
977
|
flow.hooks.resolveTransitionNode.intercept({
|
|
978
978
|
call: (nextState) => {
|
|
979
|
-
var _a;
|
|
980
|
-
const currentState = () => player.getState();
|
|
981
|
-
const currentFlowState = (_a = currentState().controllers.flow.current) == null ? void 0 : _a.currentState;
|
|
982
|
-
if (currentFlowState == null ? void 0 : currentFlowState.value.onEnd) {
|
|
983
|
-
handleEval(currentFlowState.value.onEnd);
|
|
984
|
-
}
|
|
985
979
|
if (nextState == null ? void 0 : nextState.onStart) {
|
|
986
980
|
handleEval(nextState.onStart);
|
|
987
981
|
}
|
|
@@ -1036,8 +1030,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1036
1030
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
1037
1031
|
});
|
|
1038
1032
|
};
|
|
1039
|
-
const PLAYER_VERSION = "0.1.1
|
|
1040
|
-
const COMMIT = "
|
|
1033
|
+
const PLAYER_VERSION = "0.1.1";
|
|
1034
|
+
const COMMIT = "5a31204cba63bb919057a401ced51ad62946cc69";
|
|
1041
1035
|
const _Player = class {
|
|
1042
1036
|
constructor(config) {
|
|
1043
1037
|
this.logger = new logger.TapableLogger();
|
|
@@ -1070,6 +1064,10 @@ const _Player = class {
|
|
|
1070
1064
|
plugin.apply(this);
|
|
1071
1065
|
});
|
|
1072
1066
|
}
|
|
1067
|
+
getPlugins() {
|
|
1068
|
+
var _a;
|
|
1069
|
+
return (_a = this.config.plugins) != null ? _a : [];
|
|
1070
|
+
}
|
|
1073
1071
|
findPlugin(symbol) {
|
|
1074
1072
|
var _a;
|
|
1075
1073
|
return (_a = this.config.plugins) == null ? void 0 : _a.find((el) => el.symbol === symbol);
|
|
@@ -1160,6 +1158,13 @@ const _Player = class {
|
|
|
1160
1158
|
}
|
|
1161
1159
|
flowController.hooks.flow.tap("player", (flow) => {
|
|
1162
1160
|
flow.hooks.beforeTransition.tap("player", (state, transitionVal) => {
|
|
1161
|
+
if (state.onEnd && (state.transitions[transitionVal] || state.transitions["*"])) {
|
|
1162
|
+
if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
|
|
1163
|
+
expressionEvaluator == null ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
|
|
1164
|
+
} else {
|
|
1165
|
+
expressionEvaluator == null ? void 0 : expressionEvaluator.evaluate(state.onEnd);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1163
1168
|
if (!("transitions" in state) || !state.transitions[transitionVal]) {
|
|
1164
1169
|
return state;
|
|
1165
1170
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from '@player-ui/logger';
|
|
|
14
14
|
import { SchemaController } from '@player-ui/schema';
|
|
15
15
|
export * from '@player-ui/schema';
|
|
16
16
|
export * from '@player-ui/string-resolver';
|
|
17
|
+
import * as _player_ui_validator from '@player-ui/validator';
|
|
17
18
|
import { ValidatorRegistry, ValidationResponse, ValidatorContext, ValidationObject, WarningValidationResponse, ErrorValidationResponse } from '@player-ui/validator';
|
|
18
19
|
export * from '@player-ui/validator';
|
|
19
20
|
import { Node, Resolve, ViewPlugin, Resolver, ViewInstance } from '@player-ui/view';
|
|
@@ -175,7 +176,7 @@ declare class ValidationController implements BindingTracker {
|
|
|
175
176
|
private updateValidationsForView;
|
|
176
177
|
private setCompare;
|
|
177
178
|
private get activeBindings();
|
|
178
|
-
|
|
179
|
+
getValidator(type: string): _player_ui_validator.ValidatorFunction<unknown> | undefined;
|
|
179
180
|
getBindings(): Set<BindingInstance>;
|
|
180
181
|
/** Executes all known validations for the tracked bindings using the given model */
|
|
181
182
|
validateView(trigger?: Validation.Trigger): {
|
|
@@ -395,6 +396,8 @@ declare class Player {
|
|
|
395
396
|
resolveFlowContent: SyncWaterfallHook<[Flow<_player_ui_types.Asset<string>>], Record<string, any>>;
|
|
396
397
|
};
|
|
397
398
|
constructor(config?: PlayerConfigOptions);
|
|
399
|
+
/** Returns currently registered plugins */
|
|
400
|
+
getPlugins(): PlayerPlugin[];
|
|
398
401
|
/** Find instance of [Plugin] that has been registered to Player */
|
|
399
402
|
findPlugin<Plugin extends PlayerPlugin>(symbol: symbol): Plugin | undefined;
|
|
400
403
|
/** Retrieve an instance of [Plugin] and conditionally invoke [apply] if it exists */
|
package/dist/index.esm.js
CHANGED
|
@@ -976,12 +976,6 @@ class FlowExpPlugin {
|
|
|
976
976
|
flow.hooks.onEnd.tap(this.name, (exp) => handleEval(exp));
|
|
977
977
|
flow.hooks.resolveTransitionNode.intercept({
|
|
978
978
|
call: (nextState) => {
|
|
979
|
-
var _a;
|
|
980
|
-
const currentState = () => player.getState();
|
|
981
|
-
const currentFlowState = (_a = currentState().controllers.flow.current) == null ? void 0 : _a.currentState;
|
|
982
|
-
if (currentFlowState == null ? void 0 : currentFlowState.value.onEnd) {
|
|
983
|
-
handleEval(currentFlowState.value.onEnd);
|
|
984
|
-
}
|
|
985
979
|
if (nextState == null ? void 0 : nextState.onStart) {
|
|
986
980
|
handleEval(nextState.onStart);
|
|
987
981
|
}
|
|
@@ -1036,8 +1030,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1036
1030
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
1037
1031
|
});
|
|
1038
1032
|
};
|
|
1039
|
-
const PLAYER_VERSION = "0.1.1
|
|
1040
|
-
const COMMIT = "
|
|
1033
|
+
const PLAYER_VERSION = "0.1.1";
|
|
1034
|
+
const COMMIT = "5a31204cba63bb919057a401ced51ad62946cc69";
|
|
1041
1035
|
const _Player = class {
|
|
1042
1036
|
constructor(config) {
|
|
1043
1037
|
this.logger = new TapableLogger();
|
|
@@ -1070,6 +1064,10 @@ const _Player = class {
|
|
|
1070
1064
|
plugin.apply(this);
|
|
1071
1065
|
});
|
|
1072
1066
|
}
|
|
1067
|
+
getPlugins() {
|
|
1068
|
+
var _a;
|
|
1069
|
+
return (_a = this.config.plugins) != null ? _a : [];
|
|
1070
|
+
}
|
|
1073
1071
|
findPlugin(symbol) {
|
|
1074
1072
|
var _a;
|
|
1075
1073
|
return (_a = this.config.plugins) == null ? void 0 : _a.find((el) => el.symbol === symbol);
|
|
@@ -1160,6 +1158,13 @@ const _Player = class {
|
|
|
1160
1158
|
}
|
|
1161
1159
|
flowController.hooks.flow.tap("player", (flow) => {
|
|
1162
1160
|
flow.hooks.beforeTransition.tap("player", (state, transitionVal) => {
|
|
1161
|
+
if (state.onEnd && (state.transitions[transitionVal] || state.transitions["*"])) {
|
|
1162
|
+
if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
|
|
1163
|
+
expressionEvaluator == null ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
|
|
1164
|
+
} else {
|
|
1165
|
+
expressionEvaluator == null ? void 0 : expressionEvaluator.evaluate(state.onEnd);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1163
1168
|
if (!("transitions" in state) || !state.transitions[transitionVal]) {
|
|
1164
1169
|
return state;
|
|
1165
1170
|
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/player",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@player-ui/binding": "0.1.1
|
|
11
|
-
"@player-ui/constants": "0.1.1
|
|
12
|
-
"@player-ui/data": "0.1.1
|
|
13
|
-
"@player-ui/expressions": "0.1.1
|
|
14
|
-
"@player-ui/flow": "0.1.1
|
|
15
|
-
"@player-ui/logger": "0.1.1
|
|
16
|
-
"@player-ui/partial-match-registry": "0.1.1
|
|
17
|
-
"@player-ui/schema": "0.1.1
|
|
18
|
-
"@player-ui/string-resolver": "0.1.1
|
|
19
|
-
"@player-ui/types": "0.1.1
|
|
20
|
-
"@player-ui/utils": "0.1.1
|
|
21
|
-
"@player-ui/validator": "0.1.1
|
|
22
|
-
"@player-ui/view": "0.1.1
|
|
10
|
+
"@player-ui/binding": "0.1.1",
|
|
11
|
+
"@player-ui/constants": "0.1.1",
|
|
12
|
+
"@player-ui/data": "0.1.1",
|
|
13
|
+
"@player-ui/expressions": "0.1.1",
|
|
14
|
+
"@player-ui/flow": "0.1.1",
|
|
15
|
+
"@player-ui/logger": "0.1.1",
|
|
16
|
+
"@player-ui/partial-match-registry": "0.1.1",
|
|
17
|
+
"@player-ui/schema": "0.1.1",
|
|
18
|
+
"@player-ui/string-resolver": "0.1.1",
|
|
19
|
+
"@player-ui/types": "0.1.1",
|
|
20
|
+
"@player-ui/utils": "0.1.1",
|
|
21
|
+
"@player-ui/validator": "0.1.1",
|
|
22
|
+
"@player-ui/view": "0.1.1",
|
|
23
23
|
"babel-plugin-preval": "^5.0.0",
|
|
24
24
|
"dequal": "^2.0.2",
|
|
25
25
|
"p-defer": "^3.0.0",
|
package/src/player.ts
CHANGED
|
@@ -27,8 +27,8 @@ import type {
|
|
|
27
27
|
import { NOT_STARTED_STATE } from './types';
|
|
28
28
|
|
|
29
29
|
// Variables injected at build time
|
|
30
|
-
const PLAYER_VERSION = '0.1.1
|
|
31
|
-
const COMMIT = '
|
|
30
|
+
const PLAYER_VERSION = '0.1.1';
|
|
31
|
+
const COMMIT = '5a31204cba63bb919057a401ced51ad62946cc69';
|
|
32
32
|
|
|
33
33
|
export interface PlayerPlugin {
|
|
34
34
|
/**
|
|
@@ -130,6 +130,11 @@ export class Player {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/** Returns currently registered plugins */
|
|
134
|
+
public getPlugins(): PlayerPlugin[] {
|
|
135
|
+
return this.config.plugins ?? [];
|
|
136
|
+
}
|
|
137
|
+
|
|
133
138
|
/** Find instance of [Plugin] that has been registered to Player */
|
|
134
139
|
public findPlugin<Plugin extends PlayerPlugin>(
|
|
135
140
|
symbol: symbol
|
|
@@ -278,6 +283,17 @@ export class Player {
|
|
|
278
283
|
|
|
279
284
|
flowController.hooks.flow.tap('player', (flow: FlowInstance) => {
|
|
280
285
|
flow.hooks.beforeTransition.tap('player', (state, transitionVal) => {
|
|
286
|
+
if (
|
|
287
|
+
state.onEnd &&
|
|
288
|
+
(state.transitions[transitionVal] || state.transitions['*'])
|
|
289
|
+
) {
|
|
290
|
+
if (typeof state.onEnd === 'object' && 'exp' in state.onEnd) {
|
|
291
|
+
expressionEvaluator?.evaluate(state.onEnd.exp);
|
|
292
|
+
} else {
|
|
293
|
+
expressionEvaluator?.evaluate(state.onEnd);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
281
297
|
if (!('transitions' in state) || !state.transitions[transitionVal]) {
|
|
282
298
|
return state;
|
|
283
299
|
}
|
|
@@ -47,17 +47,6 @@ export class FlowExpPlugin implements PlayerPlugin {
|
|
|
47
47
|
// Eval state nodes
|
|
48
48
|
flow.hooks.resolveTransitionNode.intercept({
|
|
49
49
|
call: (nextState: NavigationFlowState) => {
|
|
50
|
-
/** Get the current state of Player */
|
|
51
|
-
const currentState = () => player.getState() as InProgressState;
|
|
52
|
-
|
|
53
|
-
/** Get the current flow state */
|
|
54
|
-
const currentFlowState =
|
|
55
|
-
currentState().controllers.flow.current?.currentState;
|
|
56
|
-
|
|
57
|
-
if (currentFlowState?.value.onEnd) {
|
|
58
|
-
handleEval(currentFlowState.value.onEnd);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
50
|
if (nextState?.onStart) {
|
|
62
51
|
handleEval(nextState.onStart);
|
|
63
52
|
}
|