@player-ui/player 0.0.1-next.1 → 0.0.1-next.10
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 +30 -38
- package/dist/index.d.ts +29 -29
- package/dist/index.esm.js +29 -37
- package/package.json +55 -8
- package/src/data.ts +11 -11
- package/src/player.ts +15 -19
- package/src/plugins/flow-exp-plugin.ts +6 -2
- package/src/validation/controller.ts +7 -8
- package/src/view/controller.ts +5 -7
package/dist/index.cjs.js
CHANGED
|
@@ -12,7 +12,7 @@ var schema = require('@player-ui/schema');
|
|
|
12
12
|
var stringResolver = require('@player-ui/string-resolver');
|
|
13
13
|
var validator = require('@player-ui/validator');
|
|
14
14
|
var view = require('@player-ui/view');
|
|
15
|
-
var
|
|
15
|
+
var tapableTs = require('tapable-ts');
|
|
16
16
|
var timm = require('timm');
|
|
17
17
|
var deferred = require('p-defer');
|
|
18
18
|
var constants = require('@player-ui/constants');
|
|
@@ -197,12 +197,8 @@ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
|
197
197
|
class ViewController {
|
|
198
198
|
constructor(initialViews, options) {
|
|
199
199
|
this.hooks = {
|
|
200
|
-
resolveView: new
|
|
201
|
-
|
|
202
|
-
"viewRef",
|
|
203
|
-
"viewState"
|
|
204
|
-
]),
|
|
205
|
-
view: new tapable.SyncHook(["view"])
|
|
200
|
+
resolveView: new tapableTs.SyncWaterfallHook(),
|
|
201
|
+
view: new tapableTs.SyncHook()
|
|
206
202
|
};
|
|
207
203
|
this.transformRegistry = new partialMatchRegistry.Registry();
|
|
208
204
|
this.optimizeUpdates = true;
|
|
@@ -275,16 +271,16 @@ class ViewController {
|
|
|
275
271
|
class DataController {
|
|
276
272
|
constructor(model, options) {
|
|
277
273
|
this.hooks = {
|
|
278
|
-
resolve: new
|
|
279
|
-
resolveDataStages: new
|
|
280
|
-
resolveDefaultValue: new
|
|
281
|
-
onDelete: new
|
|
282
|
-
onSet: new
|
|
283
|
-
onGet: new
|
|
284
|
-
onUpdate: new
|
|
285
|
-
format: new
|
|
286
|
-
deformat: new
|
|
287
|
-
serialize: new
|
|
274
|
+
resolve: new tapableTs.SyncWaterfallHook(),
|
|
275
|
+
resolveDataStages: new tapableTs.SyncWaterfallHook(),
|
|
276
|
+
resolveDefaultValue: new tapableTs.SyncBailHook(),
|
|
277
|
+
onDelete: new tapableTs.SyncHook(),
|
|
278
|
+
onSet: new tapableTs.SyncHook(),
|
|
279
|
+
onGet: new tapableTs.SyncHook(),
|
|
280
|
+
onUpdate: new tapableTs.SyncHook(),
|
|
281
|
+
format: new tapableTs.SyncWaterfallHook(),
|
|
282
|
+
deformat: new tapableTs.SyncWaterfallHook(),
|
|
283
|
+
serialize: new tapableTs.SyncWaterfallHook()
|
|
288
284
|
};
|
|
289
285
|
this.logger = options.logger;
|
|
290
286
|
const middleware = options.middleware || [];
|
|
@@ -715,9 +711,9 @@ class ValidatedBinding {
|
|
|
715
711
|
class ValidationController {
|
|
716
712
|
constructor(schema, options) {
|
|
717
713
|
this.hooks = {
|
|
718
|
-
createValidatorRegistry: new
|
|
719
|
-
onAddValidation: new
|
|
720
|
-
onRemoveValidation: new
|
|
714
|
+
createValidatorRegistry: new tapableTs.SyncHook(),
|
|
715
|
+
onAddValidation: new tapableTs.SyncWaterfallHook(),
|
|
716
|
+
onRemoveValidation: new tapableTs.SyncWaterfallHook()
|
|
721
717
|
};
|
|
722
718
|
this.validations = new Map();
|
|
723
719
|
this.weakBindingTracker = new Set();
|
|
@@ -1040,30 +1036,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1040
1036
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
1041
1037
|
});
|
|
1042
1038
|
};
|
|
1043
|
-
const PLAYER_VERSION = "
|
|
1044
|
-
const COMMIT = "
|
|
1039
|
+
const PLAYER_VERSION = "0.0.1-next.10";
|
|
1040
|
+
const COMMIT = "332b9071763fd2b0b926ef38aea4b87f9e5cb565";
|
|
1045
1041
|
const _Player = class {
|
|
1046
1042
|
constructor(config) {
|
|
1047
1043
|
this.logger = new logger.TapableLogger();
|
|
1048
1044
|
this.constantsController = new constants.ConstantsController();
|
|
1049
1045
|
this.state = NOT_STARTED_STATE;
|
|
1050
1046
|
this.hooks = {
|
|
1051
|
-
flowController: new
|
|
1052
|
-
viewController: new
|
|
1053
|
-
view: new
|
|
1054
|
-
expressionEvaluator: new
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
state: new tapable.SyncHook(["state"]),
|
|
1064
|
-
onStart: new tapable.SyncHook(["flow"]),
|
|
1065
|
-
onEnd: new tapable.SyncHook(),
|
|
1066
|
-
resolveFlowContent: new tapable.SyncWaterfallHook(["content"])
|
|
1047
|
+
flowController: new tapableTs.SyncHook(),
|
|
1048
|
+
viewController: new tapableTs.SyncHook(),
|
|
1049
|
+
view: new tapableTs.SyncHook(),
|
|
1050
|
+
expressionEvaluator: new tapableTs.SyncHook(),
|
|
1051
|
+
dataController: new tapableTs.SyncHook(),
|
|
1052
|
+
schema: new tapableTs.SyncHook(),
|
|
1053
|
+
validationController: new tapableTs.SyncHook(),
|
|
1054
|
+
bindingParser: new tapableTs.SyncHook(),
|
|
1055
|
+
state: new tapableTs.SyncHook(),
|
|
1056
|
+
onStart: new tapableTs.SyncHook(),
|
|
1057
|
+
onEnd: new tapableTs.SyncHook(),
|
|
1058
|
+
resolveFlowContent: new tapableTs.SyncWaterfallHook()
|
|
1067
1059
|
};
|
|
1068
1060
|
var _a;
|
|
1069
1061
|
const initialPlugins = [];
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { ValidatorRegistry, ValidationResponse, ValidatorContext, ValidationObje
|
|
|
18
18
|
export * from '@player-ui/validator';
|
|
19
19
|
import { Node, Resolve, ViewPlugin, Resolver, ViewInstance } from '@player-ui/view';
|
|
20
20
|
export * from '@player-ui/view';
|
|
21
|
-
import { SyncHook, SyncWaterfallHook, SyncBailHook } from 'tapable';
|
|
21
|
+
import { SyncHook, SyncWaterfallHook, SyncBailHook } from 'tapable-ts';
|
|
22
22
|
import { ConstantsController } from '@player-ui/constants';
|
|
23
23
|
import { Registry } from '@player-ui/partial-match-registry';
|
|
24
24
|
|
|
@@ -151,11 +151,11 @@ declare class ValidatedBinding {
|
|
|
151
151
|
declare class ValidationController implements BindingTracker {
|
|
152
152
|
readonly hooks: {
|
|
153
153
|
/** A hook called to tap into the validator registry for adding more validators */
|
|
154
|
-
createValidatorRegistry: SyncHook<ValidatorRegistry,
|
|
154
|
+
createValidatorRegistry: SyncHook<[ValidatorRegistry], Record<string, any>>;
|
|
155
155
|
/** A callback/event when a new validation is added to the view */
|
|
156
|
-
onAddValidation: SyncWaterfallHook<ValidationResponse, BindingInstance, any
|
|
156
|
+
onAddValidation: SyncWaterfallHook<[ValidationResponse, BindingInstance], Record<string, any>>;
|
|
157
157
|
/** The inverse of onAddValidation, this is called when a validation is removed from the list */
|
|
158
|
-
onRemoveValidation: SyncWaterfallHook<ValidationResponse, BindingInstance, any
|
|
158
|
+
onRemoveValidation: SyncWaterfallHook<[ValidationResponse, BindingInstance], Record<string, any>>;
|
|
159
159
|
};
|
|
160
160
|
private tracker;
|
|
161
161
|
private validations;
|
|
@@ -254,16 +254,16 @@ declare type RawSetTransaction = Record<string, any> | RawSetType[];
|
|
|
254
254
|
/** The orchestrator for player data */
|
|
255
255
|
declare class DataController implements DataModelWithParser<DataModelOptions> {
|
|
256
256
|
hooks: {
|
|
257
|
-
resolve: SyncWaterfallHook<any,
|
|
258
|
-
resolveDataStages: SyncWaterfallHook<DataPipeline,
|
|
259
|
-
resolveDefaultValue: SyncBailHook<BindingInstance, any,
|
|
260
|
-
onDelete: SyncHook<any,
|
|
261
|
-
onSet: SyncHook<BatchSetTransaction,
|
|
262
|
-
onGet: SyncHook<any, any,
|
|
263
|
-
onUpdate: SyncHook<Updates,
|
|
264
|
-
format: SyncWaterfallHook<any, BindingInstance, any
|
|
265
|
-
deformat: SyncWaterfallHook<any, BindingInstance, any
|
|
266
|
-
serialize: SyncWaterfallHook<any,
|
|
257
|
+
resolve: SyncWaterfallHook<any[], Record<string, any>>;
|
|
258
|
+
resolveDataStages: SyncWaterfallHook<[DataPipeline], Record<string, any>>;
|
|
259
|
+
resolveDefaultValue: SyncBailHook<[BindingInstance], any, Record<string, any>>;
|
|
260
|
+
onDelete: SyncHook<[any], Record<string, any>>;
|
|
261
|
+
onSet: SyncHook<[BatchSetTransaction], Record<string, any>>;
|
|
262
|
+
onGet: SyncHook<[any, any], Record<string, any>>;
|
|
263
|
+
onUpdate: SyncHook<[Updates], Record<string, any>>;
|
|
264
|
+
format: SyncWaterfallHook<[any, BindingInstance], Record<string, any>>;
|
|
265
|
+
deformat: SyncWaterfallHook<[any, BindingInstance], Record<string, any>>;
|
|
266
|
+
serialize: SyncWaterfallHook<[any], Record<string, any>>;
|
|
267
267
|
};
|
|
268
268
|
private model?;
|
|
269
269
|
private trash;
|
|
@@ -302,10 +302,10 @@ interface ViewControllerOptions {
|
|
|
302
302
|
declare class ViewController {
|
|
303
303
|
readonly hooks: {
|
|
304
304
|
/** Do any processing before the `View` instance is created */
|
|
305
|
-
resolveView: SyncWaterfallHook<_player_ui_types.Asset<string> & {
|
|
305
|
+
resolveView: SyncWaterfallHook<[(_player_ui_types.Asset<string> & {
|
|
306
306
|
validation?: _player_ui_types.Validation.CrossfieldReference[] | undefined;
|
|
307
|
-
}, string, NavigationFlowViewState
|
|
308
|
-
view: SyncHook<ViewInstance,
|
|
307
|
+
}) | undefined, string, NavigationFlowViewState], Record<string, any>>;
|
|
308
|
+
view: SyncHook<[ViewInstance], Record<string, any>>;
|
|
309
309
|
};
|
|
310
310
|
private readonly viewMap;
|
|
311
311
|
private readonly viewOptions;
|
|
@@ -370,29 +370,29 @@ declare class Player {
|
|
|
370
370
|
private state;
|
|
371
371
|
readonly hooks: {
|
|
372
372
|
/** The hook that fires every time we create a new flowController (a new Content blob is passed in) */
|
|
373
|
-
flowController: SyncHook<FlowController,
|
|
373
|
+
flowController: SyncHook<[FlowController], Record<string, any>>;
|
|
374
374
|
/** The hook that updates/handles views */
|
|
375
|
-
viewController: SyncHook<ViewController,
|
|
375
|
+
viewController: SyncHook<[ViewController], Record<string, any>>;
|
|
376
376
|
/** A hook called every-time there's a new view. This is equivalent to the view hook on the view-controller */
|
|
377
|
-
view: SyncHook<ViewInstance,
|
|
377
|
+
view: SyncHook<[ViewInstance], Record<string, any>>;
|
|
378
378
|
/** Called when an expression evaluator was created */
|
|
379
|
-
expressionEvaluator: SyncHook<ExpressionEvaluator,
|
|
379
|
+
expressionEvaluator: SyncHook<[ExpressionEvaluator], Record<string, any>>;
|
|
380
380
|
/** The hook that creates and manages data */
|
|
381
|
-
dataController: SyncHook<DataController,
|
|
381
|
+
dataController: SyncHook<[DataController], Record<string, any>>;
|
|
382
382
|
/** Called after the schema is created for a flow */
|
|
383
|
-
schema: SyncHook<SchemaController,
|
|
383
|
+
schema: SyncHook<[SchemaController], Record<string, any>>;
|
|
384
384
|
/** Manages validations (schema and x-field ) */
|
|
385
|
-
validationController: SyncHook<ValidationController,
|
|
385
|
+
validationController: SyncHook<[ValidationController], Record<string, any>>;
|
|
386
386
|
/** Manages parsing binding */
|
|
387
|
-
bindingParser: SyncHook<BindingParser,
|
|
387
|
+
bindingParser: SyncHook<[BindingParser], Record<string, any>>;
|
|
388
388
|
/** A that's called for state changes in the flow execution */
|
|
389
|
-
state: SyncHook<PlayerFlowState,
|
|
389
|
+
state: SyncHook<[PlayerFlowState], Record<string, any>>;
|
|
390
390
|
/** A hook to access the current flow */
|
|
391
|
-
onStart: SyncHook<Flow<_player_ui_types.Asset<string
|
|
391
|
+
onStart: SyncHook<[Flow<_player_ui_types.Asset<string>>], Record<string, any>>;
|
|
392
392
|
/** A hook for when the flow ends either in success or failure */
|
|
393
|
-
onEnd: SyncHook<
|
|
393
|
+
onEnd: SyncHook<[], Record<string, any>>;
|
|
394
394
|
/** Mutate the Content flow before starting */
|
|
395
|
-
resolveFlowContent: SyncWaterfallHook<Flow<_player_ui_types.Asset<string
|
|
395
|
+
resolveFlowContent: SyncWaterfallHook<[Flow<_player_ui_types.Asset<string>>], Record<string, any>>;
|
|
396
396
|
};
|
|
397
397
|
constructor(config?: PlayerConfigOptions);
|
|
398
398
|
/** Find instance of [Plugin] that has been registered to Player */
|
package/dist/index.esm.js
CHANGED
|
@@ -17,7 +17,7 @@ import { ValidationMiddleware, ValidatorRegistry } from '@player-ui/validator';
|
|
|
17
17
|
export * from '@player-ui/validator';
|
|
18
18
|
import { NodeType, ViewInstance, caresAboutDataChanges } from '@player-ui/view';
|
|
19
19
|
export * from '@player-ui/view';
|
|
20
|
-
import { SyncWaterfallHook, SyncHook, SyncBailHook } from 'tapable';
|
|
20
|
+
import { SyncWaterfallHook, SyncHook, SyncBailHook } from 'tapable-ts';
|
|
21
21
|
import { removeAt, omit, setIn } from 'timm';
|
|
22
22
|
import deferred from 'p-defer';
|
|
23
23
|
import { ConstantsController } from '@player-ui/constants';
|
|
@@ -197,12 +197,8 @@ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
|
197
197
|
class ViewController {
|
|
198
198
|
constructor(initialViews, options) {
|
|
199
199
|
this.hooks = {
|
|
200
|
-
resolveView: new SyncWaterfallHook(
|
|
201
|
-
|
|
202
|
-
"viewRef",
|
|
203
|
-
"viewState"
|
|
204
|
-
]),
|
|
205
|
-
view: new SyncHook(["view"])
|
|
200
|
+
resolveView: new SyncWaterfallHook(),
|
|
201
|
+
view: new SyncHook()
|
|
206
202
|
};
|
|
207
203
|
this.transformRegistry = new Registry();
|
|
208
204
|
this.optimizeUpdates = true;
|
|
@@ -275,16 +271,16 @@ class ViewController {
|
|
|
275
271
|
class DataController {
|
|
276
272
|
constructor(model, options) {
|
|
277
273
|
this.hooks = {
|
|
278
|
-
resolve: new SyncWaterfallHook(
|
|
279
|
-
resolveDataStages: new SyncWaterfallHook(
|
|
280
|
-
resolveDefaultValue: new SyncBailHook(
|
|
281
|
-
onDelete: new SyncHook(
|
|
282
|
-
onSet: new SyncHook(
|
|
283
|
-
onGet: new SyncHook(
|
|
284
|
-
onUpdate: new SyncHook(
|
|
285
|
-
format: new SyncWaterfallHook(
|
|
286
|
-
deformat: new SyncWaterfallHook(
|
|
287
|
-
serialize: new SyncWaterfallHook(
|
|
274
|
+
resolve: new SyncWaterfallHook(),
|
|
275
|
+
resolveDataStages: new SyncWaterfallHook(),
|
|
276
|
+
resolveDefaultValue: new SyncBailHook(),
|
|
277
|
+
onDelete: new SyncHook(),
|
|
278
|
+
onSet: new SyncHook(),
|
|
279
|
+
onGet: new SyncHook(),
|
|
280
|
+
onUpdate: new SyncHook(),
|
|
281
|
+
format: new SyncWaterfallHook(),
|
|
282
|
+
deformat: new SyncWaterfallHook(),
|
|
283
|
+
serialize: new SyncWaterfallHook()
|
|
288
284
|
};
|
|
289
285
|
this.logger = options.logger;
|
|
290
286
|
const middleware = options.middleware || [];
|
|
@@ -715,9 +711,9 @@ class ValidatedBinding {
|
|
|
715
711
|
class ValidationController {
|
|
716
712
|
constructor(schema, options) {
|
|
717
713
|
this.hooks = {
|
|
718
|
-
createValidatorRegistry: new SyncHook(
|
|
719
|
-
onAddValidation: new SyncWaterfallHook(
|
|
720
|
-
onRemoveValidation: new SyncWaterfallHook(
|
|
714
|
+
createValidatorRegistry: new SyncHook(),
|
|
715
|
+
onAddValidation: new SyncWaterfallHook(),
|
|
716
|
+
onRemoveValidation: new SyncWaterfallHook()
|
|
721
717
|
};
|
|
722
718
|
this.validations = new Map();
|
|
723
719
|
this.weakBindingTracker = new Set();
|
|
@@ -1040,30 +1036,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1040
1036
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
1041
1037
|
});
|
|
1042
1038
|
};
|
|
1043
|
-
const PLAYER_VERSION = "
|
|
1044
|
-
const COMMIT = "
|
|
1039
|
+
const PLAYER_VERSION = "0.0.1-next.10";
|
|
1040
|
+
const COMMIT = "332b9071763fd2b0b926ef38aea4b87f9e5cb565";
|
|
1045
1041
|
const _Player = class {
|
|
1046
1042
|
constructor(config) {
|
|
1047
1043
|
this.logger = new TapableLogger();
|
|
1048
1044
|
this.constantsController = new ConstantsController();
|
|
1049
1045
|
this.state = NOT_STARTED_STATE;
|
|
1050
1046
|
this.hooks = {
|
|
1051
|
-
flowController: new SyncHook(
|
|
1052
|
-
viewController: new SyncHook(
|
|
1053
|
-
view: new SyncHook(
|
|
1054
|
-
expressionEvaluator: new SyncHook(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
]),
|
|
1062
|
-
bindingParser: new SyncHook(["bindingParser"]),
|
|
1063
|
-
state: new SyncHook(["state"]),
|
|
1064
|
-
onStart: new SyncHook(["flow"]),
|
|
1047
|
+
flowController: new SyncHook(),
|
|
1048
|
+
viewController: new SyncHook(),
|
|
1049
|
+
view: new SyncHook(),
|
|
1050
|
+
expressionEvaluator: new SyncHook(),
|
|
1051
|
+
dataController: new SyncHook(),
|
|
1052
|
+
schema: new SyncHook(),
|
|
1053
|
+
validationController: new SyncHook(),
|
|
1054
|
+
bindingParser: new SyncHook(),
|
|
1055
|
+
state: new SyncHook(),
|
|
1056
|
+
onStart: new SyncHook(),
|
|
1065
1057
|
onEnd: new SyncHook(),
|
|
1066
|
-
resolveFlowContent: new SyncWaterfallHook(
|
|
1058
|
+
resolveFlowContent: new SyncWaterfallHook()
|
|
1067
1059
|
};
|
|
1068
1060
|
var _a;
|
|
1069
1061
|
const initialPlugins = [];
|
package/package.json
CHANGED
|
@@ -1,26 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/player",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.10",
|
|
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
|
|
11
|
-
"@player-ui/
|
|
12
|
-
"@player-ui/
|
|
13
|
-
"@player-ui/
|
|
14
|
-
"@player-ui/
|
|
10
|
+
"@player-ui/binding": "0.0.1-next.10",
|
|
11
|
+
"@player-ui/constants": "0.0.1-next.10",
|
|
12
|
+
"@player-ui/data": "0.0.1-next.10",
|
|
13
|
+
"@player-ui/expressions": "0.0.1-next.10",
|
|
14
|
+
"@player-ui/flow": "0.0.1-next.10",
|
|
15
|
+
"@player-ui/logger": "0.0.1-next.10",
|
|
16
|
+
"@player-ui/partial-match-registry": "0.0.1-next.10",
|
|
17
|
+
"@player-ui/schema": "0.0.1-next.10",
|
|
18
|
+
"@player-ui/string-resolver": "0.0.1-next.10",
|
|
19
|
+
"@player-ui/types": "0.0.1-next.10",
|
|
20
|
+
"@player-ui/utils": "0.0.1-next.10",
|
|
21
|
+
"@player-ui/validator": "0.0.1-next.10",
|
|
22
|
+
"@player-ui/view": "0.0.1-next.10",
|
|
15
23
|
"babel-plugin-preval": "^5.0.0",
|
|
16
24
|
"dequal": "^2.0.2",
|
|
17
25
|
"p-defer": "^3.0.0",
|
|
18
26
|
"queue-microtask": "^1.2.3",
|
|
19
|
-
"tapable": "
|
|
27
|
+
"tapable-ts": "^0.1.0",
|
|
20
28
|
"timm": "^1.6.2",
|
|
21
29
|
"@babel/runtime": "7.15.4"
|
|
22
30
|
},
|
|
23
31
|
"main": "dist/index.cjs.js",
|
|
24
32
|
"module": "dist/index.esm.js",
|
|
25
|
-
"typings": "dist/index.d.ts"
|
|
33
|
+
"typings": "dist/index.d.ts",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/player-ui/player-ui"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/player-ui/player-ui/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://player-ui.github.io",
|
|
43
|
+
"contributors": [
|
|
44
|
+
{
|
|
45
|
+
"name": "Adam Dierkens",
|
|
46
|
+
"url": "https://github.com/adierkens"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "Spencer Hamm",
|
|
50
|
+
"url": "https://github.com/spentacular"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Harris Borawski",
|
|
54
|
+
"url": "https://github.com/hborawski"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "Jeremiah Zucker",
|
|
58
|
+
"url": "https://github.com/sugarmanz"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "Ketan Reddy",
|
|
62
|
+
"url": "https://github.com/KetanReddy"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "Brocollie08",
|
|
66
|
+
"url": "https://github.com/brocollie08"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "Kelly Harrop",
|
|
70
|
+
"url": "https://github.com/kharrop"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
26
73
|
}
|
package/src/data.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncHook, SyncWaterfallHook, SyncBailHook } from 'tapable';
|
|
1
|
+
import { SyncHook, SyncWaterfallHook, SyncBailHook } from 'tapable-ts';
|
|
2
2
|
import type { Logger } from '@player-ui/logger';
|
|
3
3
|
import { omit, removeAt } from 'timm';
|
|
4
4
|
import { dequal } from 'dequal';
|
|
@@ -18,21 +18,21 @@ import type { RawSetTransaction } from './types';
|
|
|
18
18
|
/** The orchestrator for player data */
|
|
19
19
|
export class DataController implements DataModelWithParser<DataModelOptions> {
|
|
20
20
|
public hooks = {
|
|
21
|
-
resolve: new SyncWaterfallHook(
|
|
22
|
-
resolveDataStages: new SyncWaterfallHook<DataPipeline>(
|
|
21
|
+
resolve: new SyncWaterfallHook(),
|
|
22
|
+
resolveDataStages: new SyncWaterfallHook<[DataPipeline]>(),
|
|
23
23
|
|
|
24
24
|
// On any set or get of an undefined value, redirect the value to be the default
|
|
25
|
-
resolveDefaultValue: new SyncBailHook<BindingInstance, any>(
|
|
25
|
+
resolveDefaultValue: new SyncBailHook<[BindingInstance], any>(),
|
|
26
26
|
|
|
27
|
-
onDelete: new SyncHook<any
|
|
28
|
-
onSet: new SyncHook<BatchSetTransaction
|
|
29
|
-
onGet: new SyncHook<any, any
|
|
30
|
-
onUpdate: new SyncHook<Updates>(
|
|
27
|
+
onDelete: new SyncHook<[any]>(),
|
|
28
|
+
onSet: new SyncHook<[BatchSetTransaction]>(),
|
|
29
|
+
onGet: new SyncHook<[any, any]>(),
|
|
30
|
+
onUpdate: new SyncHook<[Updates]>(),
|
|
31
31
|
|
|
32
|
-
format: new SyncWaterfallHook<any, BindingInstance>(
|
|
33
|
-
deformat: new SyncWaterfallHook<any, BindingInstance>(
|
|
32
|
+
format: new SyncWaterfallHook<[any, BindingInstance]>(),
|
|
33
|
+
deformat: new SyncWaterfallHook<[any, BindingInstance]>(),
|
|
34
34
|
|
|
35
|
-
serialize: new SyncWaterfallHook<any>(
|
|
35
|
+
serialize: new SyncWaterfallHook<[any]>(),
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
private model?: PipelinedDataModel;
|
package/src/player.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncHook, SyncWaterfallHook } from 'tapable';
|
|
1
|
+
import { SyncHook, SyncWaterfallHook } from 'tapable-ts';
|
|
2
2
|
import type { FlowInstance } from '@player-ui/flow';
|
|
3
3
|
import { FlowController } from '@player-ui/flow';
|
|
4
4
|
import type { Logger } from '@player-ui/logger';
|
|
@@ -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 = '
|
|
31
|
-
const COMMIT = '
|
|
30
|
+
const PLAYER_VERSION = '0.0.1-next.10';
|
|
31
|
+
const COMMIT = '332b9071763fd2b0b926ef38aea4b87f9e5cb565';
|
|
32
32
|
|
|
33
33
|
export interface PlayerPlugin {
|
|
34
34
|
/**
|
|
@@ -78,43 +78,39 @@ export class Player {
|
|
|
78
78
|
|
|
79
79
|
public readonly hooks = {
|
|
80
80
|
/** The hook that fires every time we create a new flowController (a new Content blob is passed in) */
|
|
81
|
-
flowController: new SyncHook<FlowController>(
|
|
81
|
+
flowController: new SyncHook<[FlowController]>(),
|
|
82
82
|
|
|
83
83
|
/** The hook that updates/handles views */
|
|
84
|
-
viewController: new SyncHook<ViewController>(
|
|
84
|
+
viewController: new SyncHook<[ViewController]>(),
|
|
85
85
|
|
|
86
86
|
/** A hook called every-time there's a new view. This is equivalent to the view hook on the view-controller */
|
|
87
|
-
view: new SyncHook<ViewInstance>(
|
|
87
|
+
view: new SyncHook<[ViewInstance]>(),
|
|
88
88
|
|
|
89
89
|
/** Called when an expression evaluator was created */
|
|
90
|
-
expressionEvaluator: new SyncHook<ExpressionEvaluator>(
|
|
91
|
-
'expressionEvaluator',
|
|
92
|
-
]),
|
|
90
|
+
expressionEvaluator: new SyncHook<[ExpressionEvaluator]>(),
|
|
93
91
|
|
|
94
92
|
/** The hook that creates and manages data */
|
|
95
|
-
dataController: new SyncHook<DataController>(
|
|
93
|
+
dataController: new SyncHook<[DataController]>(),
|
|
96
94
|
|
|
97
95
|
/** Called after the schema is created for a flow */
|
|
98
|
-
schema: new SyncHook<SchemaController>(
|
|
96
|
+
schema: new SyncHook<[SchemaController]>(),
|
|
99
97
|
|
|
100
98
|
/** Manages validations (schema and x-field ) */
|
|
101
|
-
validationController: new SyncHook<ValidationController>(
|
|
102
|
-
'validationController',
|
|
103
|
-
]),
|
|
99
|
+
validationController: new SyncHook<[ValidationController]>(),
|
|
104
100
|
|
|
105
101
|
/** Manages parsing binding */
|
|
106
|
-
bindingParser: new SyncHook<BindingParser>(
|
|
102
|
+
bindingParser: new SyncHook<[BindingParser]>(),
|
|
107
103
|
|
|
108
104
|
/** A that's called for state changes in the flow execution */
|
|
109
|
-
state: new SyncHook<PlayerFlowState>(
|
|
105
|
+
state: new SyncHook<[PlayerFlowState]>(),
|
|
110
106
|
|
|
111
107
|
/** A hook to access the current flow */
|
|
112
|
-
onStart: new SyncHook<FlowType>(
|
|
108
|
+
onStart: new SyncHook<[FlowType]>(),
|
|
113
109
|
|
|
114
110
|
/** A hook for when the flow ends either in success or failure */
|
|
115
|
-
onEnd: new SyncHook(),
|
|
111
|
+
onEnd: new SyncHook<[]>(),
|
|
116
112
|
/** Mutate the Content flow before starting */
|
|
117
|
-
resolveFlowContent: new SyncWaterfallHook<FlowType>(
|
|
113
|
+
resolveFlowContent: new SyncWaterfallHook<[FlowType]>(),
|
|
118
114
|
};
|
|
119
115
|
|
|
120
116
|
constructor(config?: PlayerConfigOptions) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Expression,
|
|
3
|
+
ExpressionObject,
|
|
4
|
+
NavigationFlowState,
|
|
5
|
+
} from '@player-ui/types';
|
|
2
6
|
import type { ExpressionEvaluator } from '@player-ui/expressions';
|
|
3
7
|
import type { FlowInstance } from '@player-ui/flow';
|
|
4
8
|
import type { Player, PlayerPlugin } from '../player';
|
|
@@ -42,7 +46,7 @@ export class FlowExpPlugin implements PlayerPlugin {
|
|
|
42
46
|
flow.hooks.onEnd.tap(this.name, (exp) => handleEval(exp));
|
|
43
47
|
// Eval state nodes
|
|
44
48
|
flow.hooks.resolveTransitionNode.intercept({
|
|
45
|
-
call: (nextState) => {
|
|
49
|
+
call: (nextState: NavigationFlowState) => {
|
|
46
50
|
/** Get the current state of Player */
|
|
47
51
|
const currentState = () => player.getState() as InProgressState;
|
|
48
52
|
|
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
ExpressionEvaluatorOptions,
|
|
23
23
|
ExpressionType,
|
|
24
24
|
} from '@player-ui/expressions';
|
|
25
|
-
import { SyncHook, SyncWaterfallHook } from 'tapable';
|
|
25
|
+
import { SyncHook, SyncWaterfallHook } from 'tapable-ts';
|
|
26
26
|
import type { BindingTracker } from './binding-tracker';
|
|
27
27
|
import { ValidationBindingTrackerViewPlugin } from './binding-tracker';
|
|
28
28
|
|
|
@@ -279,18 +279,17 @@ class ValidatedBinding {
|
|
|
279
279
|
export class ValidationController implements BindingTracker {
|
|
280
280
|
public readonly hooks = {
|
|
281
281
|
/** A hook called to tap into the validator registry for adding more validators */
|
|
282
|
-
createValidatorRegistry: new SyncHook<ValidatorRegistry>(
|
|
282
|
+
createValidatorRegistry: new SyncHook<[ValidatorRegistry]>(),
|
|
283
283
|
|
|
284
284
|
/** A callback/event when a new validation is added to the view */
|
|
285
|
-
onAddValidation: new SyncWaterfallHook<
|
|
286
|
-
[
|
|
287
|
-
),
|
|
285
|
+
onAddValidation: new SyncWaterfallHook<
|
|
286
|
+
[ValidationResponse, BindingInstance]
|
|
287
|
+
>(),
|
|
288
288
|
|
|
289
289
|
/** The inverse of onAddValidation, this is called when a validation is removed from the list */
|
|
290
290
|
onRemoveValidation: new SyncWaterfallHook<
|
|
291
|
-
ValidationResponse,
|
|
292
|
-
|
|
293
|
-
>(['validation', 'binding']),
|
|
291
|
+
[ValidationResponse, BindingInstance]
|
|
292
|
+
>(),
|
|
294
293
|
};
|
|
295
294
|
|
|
296
295
|
private tracker: BindingTracker | undefined;
|
package/src/view/controller.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncHook, SyncWaterfallHook } from 'tapable';
|
|
1
|
+
import { SyncHook, SyncWaterfallHook } from 'tapable-ts';
|
|
2
2
|
import type { Resolve } from '@player-ui/view';
|
|
3
3
|
import { ViewInstance } from '@player-ui/view';
|
|
4
4
|
import type { Logger } from '@player-ui/logger';
|
|
@@ -27,14 +27,12 @@ export interface ViewControllerOptions {
|
|
|
27
27
|
export class ViewController {
|
|
28
28
|
public readonly hooks = {
|
|
29
29
|
/** Do any processing before the `View` instance is created */
|
|
30
|
-
resolveView: new SyncWaterfallHook<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'viewState',
|
|
34
|
-
]),
|
|
30
|
+
resolveView: new SyncWaterfallHook<
|
|
31
|
+
[View | undefined, string, NavigationFlowViewState]
|
|
32
|
+
>(),
|
|
35
33
|
|
|
36
34
|
// The hook right before the View starts resolving. Attach anything custom here
|
|
37
|
-
view: new SyncHook<ViewInstance>(
|
|
35
|
+
view: new SyncHook<[ViewInstance]>(),
|
|
38
36
|
};
|
|
39
37
|
|
|
40
38
|
private readonly viewMap: Record<string, View>;
|