@player-ui/player 0.0.1-next.2 → 0.0.1-next.20

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
@@ -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 tapable = require('tapable');
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 tapable.SyncWaterfallHook([
201
- "view",
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 tapable.SyncWaterfallHook(["binding"]),
279
- resolveDataStages: new tapable.SyncWaterfallHook(["pipeline"]),
280
- resolveDefaultValue: new tapable.SyncBailHook(["binding"]),
281
- onDelete: new tapable.SyncHook(["binding"]),
282
- onSet: new tapable.SyncHook(["transaction"]),
283
- onGet: new tapable.SyncHook(["binding", "result"]),
284
- onUpdate: new tapable.SyncHook(["updates"]),
285
- format: new tapable.SyncWaterfallHook(["value", "binding"]),
286
- deformat: new tapable.SyncWaterfallHook(["value", "binding"]),
287
- serialize: new tapable.SyncWaterfallHook(["data"])
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 tapable.SyncHook(["registry"]),
719
- onAddValidation: new tapable.SyncWaterfallHook(["validation", "binding"]),
720
- onRemoveValidation: new tapable.SyncWaterfallHook(["validation", "binding"])
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 = "!!STABLE_VERSION!!";
1044
- const COMMIT = "!!STABLE_GIT_COMMIT!!";
1039
+ const PLAYER_VERSION = "0.0.1-next.20";
1040
+ const COMMIT = "9bf4d566e198543d6bfb77bcade800aafed65675";
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 tapable.SyncHook(["flowController"]),
1052
- viewController: new tapable.SyncHook(["viewController"]),
1053
- view: new tapable.SyncHook(["view"]),
1054
- expressionEvaluator: new tapable.SyncHook([
1055
- "expressionEvaluator"
1056
- ]),
1057
- dataController: new tapable.SyncHook(["dataController"]),
1058
- schema: new tapable.SyncHook(["schema"]),
1059
- validationController: new tapable.SyncHook([
1060
- "validationController"
1061
- ]),
1062
- bindingParser: new tapable.SyncHook(["bindingParser"]),
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, any, any>;
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, any, any>;
258
- resolveDataStages: SyncWaterfallHook<DataPipeline, any, any>;
259
- resolveDefaultValue: SyncBailHook<BindingInstance, any, any, any>;
260
- onDelete: SyncHook<any, void, any>;
261
- onSet: SyncHook<BatchSetTransaction, void, any>;
262
- onGet: SyncHook<any, any, void>;
263
- onUpdate: SyncHook<Updates, any, any>;
264
- format: SyncWaterfallHook<any, BindingInstance, any>;
265
- deformat: SyncWaterfallHook<any, BindingInstance, any>;
266
- serialize: SyncWaterfallHook<any, any, 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, any, any>;
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, any, any>;
373
+ flowController: SyncHook<[FlowController], Record<string, any>>;
374
374
  /** The hook that updates/handles views */
375
- viewController: SyncHook<ViewController, any, any>;
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, any, any>;
377
+ view: SyncHook<[ViewInstance], Record<string, any>>;
378
378
  /** Called when an expression evaluator was created */
379
- expressionEvaluator: SyncHook<ExpressionEvaluator, any, any>;
379
+ expressionEvaluator: SyncHook<[ExpressionEvaluator], Record<string, any>>;
380
380
  /** The hook that creates and manages data */
381
- dataController: SyncHook<DataController, any, any>;
381
+ dataController: SyncHook<[DataController], Record<string, any>>;
382
382
  /** Called after the schema is created for a flow */
383
- schema: SyncHook<SchemaController, any, any>;
383
+ schema: SyncHook<[SchemaController], Record<string, any>>;
384
384
  /** Manages validations (schema and x-field ) */
385
- validationController: SyncHook<ValidationController, any, any>;
385
+ validationController: SyncHook<[ValidationController], Record<string, any>>;
386
386
  /** Manages parsing binding */
387
- bindingParser: SyncHook<BindingParser, any, any>;
387
+ bindingParser: SyncHook<[BindingParser], Record<string, any>>;
388
388
  /** A that's called for state changes in the flow execution */
389
- state: SyncHook<PlayerFlowState, any, any>;
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>>, any, any>;
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<any, any, any>;
393
+ onEnd: SyncHook<[], Record<string, any>>;
394
394
  /** Mutate the Content flow before starting */
395
- resolveFlowContent: SyncWaterfallHook<Flow<_player_ui_types.Asset<string>>, any, any>;
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
- "view",
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(["binding"]),
279
- resolveDataStages: new SyncWaterfallHook(["pipeline"]),
280
- resolveDefaultValue: new SyncBailHook(["binding"]),
281
- onDelete: new SyncHook(["binding"]),
282
- onSet: new SyncHook(["transaction"]),
283
- onGet: new SyncHook(["binding", "result"]),
284
- onUpdate: new SyncHook(["updates"]),
285
- format: new SyncWaterfallHook(["value", "binding"]),
286
- deformat: new SyncWaterfallHook(["value", "binding"]),
287
- serialize: new SyncWaterfallHook(["data"])
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(["registry"]),
719
- onAddValidation: new SyncWaterfallHook(["validation", "binding"]),
720
- onRemoveValidation: new SyncWaterfallHook(["validation", "binding"])
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 = "!!STABLE_VERSION!!";
1044
- const COMMIT = "!!STABLE_GIT_COMMIT!!";
1039
+ const PLAYER_VERSION = "0.0.1-next.20";
1040
+ const COMMIT = "9bf4d566e198543d6bfb77bcade800aafed65675";
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(["flowController"]),
1052
- viewController: new SyncHook(["viewController"]),
1053
- view: new SyncHook(["view"]),
1054
- expressionEvaluator: new SyncHook([
1055
- "expressionEvaluator"
1056
- ]),
1057
- dataController: new SyncHook(["dataController"]),
1058
- schema: new SyncHook(["schema"]),
1059
- validationController: new SyncHook([
1060
- "validationController"
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(["content"])
1058
+ resolveFlowContent: new SyncWaterfallHook()
1067
1059
  };
1068
1060
  var _a;
1069
1061
  const initialPlugins = [];
package/package.json CHANGED
@@ -1,26 +1,74 @@
1
1
  {
2
2
  "name": "@player-ui/player",
3
- "version": "0.0.1-next.2",
3
+ "version": "0.0.1-next.20",
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-grammar": "0.0.1-next.2",
11
- "@player-ui/logger": "0.0.1-next.2",
12
- "@player-ui/partial-match-registry": "0.0.1-next.2",
13
- "@player-ui/types": "0.0.1-next.2",
14
- "@player-ui/utils": "0.0.1-next.2",
10
+ "@player-ui/binding": "0.0.1-next.20",
11
+ "@player-ui/constants": "0.0.1-next.20",
12
+ "@player-ui/data": "0.0.1-next.20",
13
+ "@player-ui/expressions": "0.0.1-next.20",
14
+ "@player-ui/flow": "0.0.1-next.20",
15
+ "@player-ui/logger": "0.0.1-next.20",
16
+ "@player-ui/partial-match-registry": "0.0.1-next.20",
17
+ "@player-ui/schema": "0.0.1-next.20",
18
+ "@player-ui/string-resolver": "0.0.1-next.20",
19
+ "@player-ui/types": "0.0.1-next.20",
20
+ "@player-ui/utils": "0.0.1-next.20",
21
+ "@player-ui/validator": "0.0.1-next.20",
22
+ "@player-ui/view": "0.0.1-next.20",
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": "1.1.3",
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
+ "sideEffects": false,
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/player-ui/player-ui"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/player-ui/player-ui/issues"
42
+ },
43
+ "homepage": "https://player-ui.github.io",
44
+ "contributors": [
45
+ {
46
+ "name": "Adam Dierkens",
47
+ "url": "https://github.com/adierkens"
48
+ },
49
+ {
50
+ "name": "Spencer Hamm",
51
+ "url": "https://github.com/spentacular"
52
+ },
53
+ {
54
+ "name": "Harris Borawski",
55
+ "url": "https://github.com/hborawski"
56
+ },
57
+ {
58
+ "name": "Jeremiah Zucker",
59
+ "url": "https://github.com/sugarmanz"
60
+ },
61
+ {
62
+ "name": "Ketan Reddy",
63
+ "url": "https://github.com/KetanReddy"
64
+ },
65
+ {
66
+ "name": "Brocollie08",
67
+ "url": "https://github.com/brocollie08"
68
+ },
69
+ {
70
+ "name": "Kelly Harrop",
71
+ "url": "https://github.com/kharrop"
72
+ }
73
+ ]
26
74
  }
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(['binding']),
22
- resolveDataStages: new SyncWaterfallHook<DataPipeline>(['pipeline']),
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>(['binding']),
25
+ resolveDefaultValue: new SyncBailHook<[BindingInstance], any>(),
26
26
 
27
- onDelete: new SyncHook<any, void>(['binding']),
28
- onSet: new SyncHook<BatchSetTransaction, void>(['transaction']),
29
- onGet: new SyncHook<any, any, void>(['binding', 'result']),
30
- onUpdate: new SyncHook<Updates>(['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>(['value', 'binding']),
33
- deformat: new SyncWaterfallHook<any, BindingInstance>(['value', 'binding']),
32
+ format: new SyncWaterfallHook<[any, BindingInstance]>(),
33
+ deformat: new SyncWaterfallHook<[any, BindingInstance]>(),
34
34
 
35
- serialize: new SyncWaterfallHook<any>(['data']),
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 = '!!STABLE_VERSION!!';
31
- const COMMIT = '!!STABLE_GIT_COMMIT!!';
30
+ const PLAYER_VERSION = '0.0.1-next.20';
31
+ const COMMIT = '9bf4d566e198543d6bfb77bcade800aafed65675';
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>(['flowController']),
81
+ flowController: new SyncHook<[FlowController]>(),
82
82
 
83
83
  /** The hook that updates/handles views */
84
- viewController: new SyncHook<ViewController>(['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>(['view']),
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>(['dataController']),
93
+ dataController: new SyncHook<[DataController]>(),
96
94
 
97
95
  /** Called after the schema is created for a flow */
98
- schema: new SyncHook<SchemaController>(['schema']),
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>(['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>(['state']),
105
+ state: new SyncHook<[PlayerFlowState]>(),
110
106
 
111
107
  /** A hook to access the current flow */
112
- onStart: new SyncHook<FlowType>(['flow']),
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>(['content']),
113
+ resolveFlowContent: new SyncWaterfallHook<[FlowType]>(),
118
114
  };
119
115
 
120
116
  constructor(config?: PlayerConfigOptions) {
@@ -1,4 +1,8 @@
1
- import type { Expression, ExpressionObject } from '@player-ui/types';
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>(['registry']),
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<ValidationResponse, BindingInstance>(
286
- ['validation', 'binding']
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
- BindingInstance
293
- >(['validation', 'binding']),
291
+ [ValidationResponse, BindingInstance]
292
+ >(),
294
293
  };
295
294
 
296
295
  private tracker: BindingTracker | undefined;
@@ -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<View, string, NavigationFlowViewState>([
31
- 'view',
32
- 'viewRef',
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>(['view']),
35
+ view: new SyncHook<[ViewInstance]>(),
38
36
  };
39
37
 
40
38
  private readonly viewMap: Record<string, View>;