@player-ui/player 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/Player.native.js +11630 -0
- package/dist/Player.native.js.map +1 -0
- package/dist/cjs/index.cjs +5626 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/{index.esm.js → index.legacy-esm.js} +2044 -1667
- package/dist/{index.cjs.js → index.mjs} +2052 -1761
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -63
- package/src/__tests__/data.test.ts +498 -0
- package/src/__tests__/flow.test.ts +312 -0
- package/src/__tests__/helpers/action-exp.plugin.ts +22 -0
- package/src/__tests__/helpers/actions.flow.ts +67 -0
- package/src/__tests__/helpers/binding.plugin.ts +125 -0
- package/src/__tests__/helpers/expression.plugin.ts +88 -0
- package/src/__tests__/helpers/transform-plugin.ts +19 -0
- package/src/__tests__/helpers/validation.flow.ts +56 -0
- package/src/__tests__/player.test.ts +597 -0
- package/src/__tests__/string-resolver.test.ts +186 -0
- package/src/__tests__/validation.test.ts +3555 -0
- package/src/__tests__/view.test.ts +715 -0
- package/src/binding/__tests__/binding.test.ts +113 -0
- package/src/binding/__tests__/index.test.ts +208 -0
- package/src/binding/__tests__/resolver.test.ts +83 -0
- package/src/binding/binding.ts +6 -6
- package/src/binding/index.ts +34 -34
- package/src/binding/resolver.ts +19 -19
- package/src/binding/utils.ts +7 -7
- package/src/binding-grammar/__tests__/parser.test.ts +64 -0
- package/src/binding-grammar/__tests__/test-utils/ast-cases.ts +198 -0
- package/src/binding-grammar/__tests__/test-utils/perf-test.ts +66 -0
- package/src/binding-grammar/ast.ts +11 -11
- package/src/binding-grammar/custom/index.ts +19 -22
- package/src/binding-grammar/ebnf/index.ts +20 -21
- package/src/binding-grammar/ebnf/types.ts +13 -13
- package/src/binding-grammar/index.ts +4 -4
- package/src/binding-grammar/parsimmon/index.ts +14 -14
- package/src/controllers/constants/__tests__/index.test.ts +106 -0
- package/src/controllers/constants/index.ts +3 -3
- package/src/controllers/constants/utils.ts +4 -4
- package/src/controllers/data/controller.ts +22 -22
- package/src/controllers/data/index.ts +1 -1
- package/src/controllers/data/utils.ts +7 -7
- package/src/controllers/flow/__tests__/controller.test.ts +195 -0
- package/src/controllers/flow/__tests__/flow.test.ts +381 -0
- package/src/controllers/flow/controller.ts +13 -13
- package/src/controllers/flow/flow.ts +23 -23
- package/src/controllers/flow/index.ts +2 -2
- package/src/controllers/index.ts +5 -5
- package/src/controllers/validation/binding-tracker.ts +71 -59
- package/src/controllers/validation/controller.ts +104 -104
- package/src/controllers/validation/index.ts +2 -2
- package/src/controllers/view/asset-transform.ts +20 -20
- package/src/controllers/view/controller.ts +27 -27
- package/src/controllers/view/index.ts +4 -4
- package/src/controllers/view/store.ts +3 -3
- package/src/controllers/view/types.ts +7 -7
- package/src/data/__tests__/__snapshots__/dependency-tracker.test.ts.snap +64 -0
- package/src/data/__tests__/dependency-tracker.test.ts +146 -0
- package/src/data/__tests__/local-model.test.ts +46 -0
- package/src/data/__tests__/model.test.ts +78 -0
- package/src/data/dependency-tracker.ts +16 -16
- package/src/data/index.ts +4 -4
- package/src/data/local-model.ts +6 -6
- package/src/data/model.ts +17 -17
- package/src/data/noop-model.ts +1 -1
- package/src/expressions/__tests__/__snapshots__/parser.test.ts.snap +854 -0
- package/src/expressions/__tests__/evaluator-functions.test.ts +47 -0
- package/src/expressions/__tests__/evaluator.test.ts +410 -0
- package/src/expressions/__tests__/parser.test.ts +115 -0
- package/src/expressions/__tests__/utils.test.ts +44 -0
- package/src/expressions/evaluator-functions.ts +6 -6
- package/src/expressions/evaluator.ts +71 -67
- package/src/expressions/index.ts +4 -4
- package/src/expressions/parser.ts +102 -105
- package/src/expressions/types.ts +29 -21
- package/src/expressions/utils.ts +32 -21
- package/src/index.ts +13 -13
- package/src/logger/__tests__/consoleLogger.test.ts +46 -0
- package/src/logger/__tests__/noopLogger.test.ts +13 -0
- package/src/logger/__tests__/proxyLogger.test.ts +31 -0
- package/src/logger/__tests__/tapableLogger.test.ts +41 -0
- package/src/logger/consoleLogger.ts +9 -9
- package/src/logger/index.ts +5 -5
- package/src/logger/noopLogger.ts +1 -1
- package/src/logger/proxyLogger.ts +6 -6
- package/src/logger/tapableLogger.ts +7 -7
- package/src/logger/types.ts +2 -2
- package/src/player.ts +60 -58
- package/src/plugins/default-exp-plugin.ts +10 -10
- package/src/plugins/default-view-plugin.ts +29 -0
- package/src/plugins/flow-exp-plugin.ts +6 -6
- package/src/schema/__tests__/schema.test.ts +243 -0
- package/src/schema/index.ts +2 -2
- package/src/schema/schema.ts +24 -24
- package/src/schema/types.ts +4 -4
- package/src/string-resolver/__tests__/index.test.ts +361 -0
- package/src/string-resolver/index.ts +17 -17
- package/src/types.ts +17 -17
- package/src/utils/__tests__/replaceParams.test.ts +33 -0
- package/src/utils/index.ts +1 -1
- package/src/utils/replaceParams.ts +1 -1
- package/src/validator/__tests__/binding-map-splice.test.ts +53 -0
- package/src/validator/__tests__/validation-middleware.test.ts +127 -0
- package/src/validator/binding-map-splice.ts +5 -5
- package/src/validator/index.ts +4 -4
- package/src/validator/registry.ts +1 -1
- package/src/validator/types.ts +13 -13
- package/src/validator/validation-middleware.ts +15 -15
- package/src/view/__tests__/view.immutable.test.ts +269 -0
- package/src/view/__tests__/view.test.ts +959 -0
- package/src/view/builder/index.test.ts +69 -0
- package/src/view/builder/index.ts +3 -3
- package/src/view/index.ts +5 -5
- package/src/view/parser/__tests__/__snapshots__/parser.test.ts.snap +394 -0
- package/src/view/parser/__tests__/parser.test.ts +264 -0
- package/src/view/parser/index.ts +43 -33
- package/src/view/parser/types.ts +11 -11
- package/src/view/parser/utils.ts +5 -5
- package/src/view/plugins/__tests__/__snapshots__/template.test.ts.snap +278 -0
- package/src/view/plugins/__tests__/applicability.test.ts +265 -0
- package/src/view/plugins/__tests__/string.test.ts +122 -0
- package/src/view/plugins/__tests__/template.test.ts +724 -0
- package/src/view/plugins/applicability.ts +19 -19
- package/src/view/plugins/index.ts +4 -5
- package/src/view/plugins/options.ts +1 -1
- package/src/view/plugins/string-resolver.ts +22 -22
- package/src/view/plugins/switch.ts +22 -23
- package/src/view/plugins/template-plugin.ts +26 -27
- package/src/view/resolver/__tests__/dependencies.test.ts +321 -0
- package/src/view/resolver/__tests__/edgecases.test.ts +626 -0
- package/src/view/resolver/index.ts +42 -42
- package/src/view/resolver/types.ts +21 -20
- package/src/view/resolver/utils.ts +9 -9
- package/src/view/view.ts +32 -22
- package/types/binding/binding.d.ts +50 -0
- package/types/binding/index.d.ts +29 -0
- package/types/binding/resolver.d.ts +26 -0
- package/types/binding/utils.d.ts +12 -0
- package/types/binding-grammar/ast.d.ts +67 -0
- package/types/binding-grammar/custom/index.d.ts +4 -0
- package/types/binding-grammar/ebnf/index.d.ts +4 -0
- package/types/binding-grammar/ebnf/types.d.ts +75 -0
- package/types/binding-grammar/index.d.ts +5 -0
- package/types/binding-grammar/parsimmon/index.d.ts +4 -0
- package/types/controllers/constants/index.d.ts +45 -0
- package/types/controllers/constants/utils.d.ts +6 -0
- package/types/controllers/data/controller.d.ts +45 -0
- package/types/controllers/data/index.d.ts +2 -0
- package/types/controllers/data/utils.d.ts +14 -0
- package/types/controllers/flow/controller.d.ts +25 -0
- package/types/controllers/flow/flow.d.ts +50 -0
- package/types/controllers/flow/index.d.ts +3 -0
- package/types/controllers/index.d.ts +6 -0
- package/types/controllers/validation/binding-tracker.d.ts +32 -0
- package/types/controllers/validation/controller.d.ts +151 -0
- package/types/controllers/validation/index.d.ts +3 -0
- package/types/controllers/view/asset-transform.d.ts +19 -0
- package/types/controllers/view/controller.d.ts +37 -0
- package/types/controllers/view/index.d.ts +5 -0
- package/types/controllers/view/store.d.ts +20 -0
- package/types/controllers/view/types.d.ts +16 -0
- package/types/data/dependency-tracker.d.ts +49 -0
- package/types/data/index.d.ts +5 -0
- package/types/data/local-model.d.ts +16 -0
- package/types/data/model.d.ts +86 -0
- package/types/data/noop-model.d.ts +13 -0
- package/types/expressions/evaluator-functions.d.ts +15 -0
- package/types/expressions/evaluator.d.ts +52 -0
- package/types/expressions/index.d.ts +5 -0
- package/types/expressions/parser.d.ts +10 -0
- package/types/expressions/types.d.ts +144 -0
- package/types/expressions/utils.d.ts +12 -0
- package/types/index.d.ts +14 -0
- package/types/logger/consoleLogger.d.ts +17 -0
- package/types/logger/index.d.ts +6 -0
- package/types/logger/noopLogger.d.ts +10 -0
- package/types/logger/proxyLogger.d.ts +15 -0
- package/types/logger/tapableLogger.d.ts +23 -0
- package/types/logger/types.d.ts +6 -0
- package/types/player.d.ts +101 -0
- package/types/plugins/default-exp-plugin.d.ts +9 -0
- package/types/plugins/default-view-plugin.d.ts +9 -0
- package/types/plugins/flow-exp-plugin.d.ts +11 -0
- package/types/schema/index.d.ts +3 -0
- package/types/schema/schema.d.ts +36 -0
- package/types/schema/types.d.ts +38 -0
- package/types/string-resolver/index.d.ts +30 -0
- package/types/types.d.ts +73 -0
- package/types/utils/index.d.ts +2 -0
- package/types/utils/replaceParams.d.ts +9 -0
- package/types/validator/binding-map-splice.d.ts +10 -0
- package/types/validator/index.d.ts +5 -0
- package/types/validator/registry.d.ts +11 -0
- package/types/validator/types.d.ts +53 -0
- package/types/validator/validation-middleware.d.ts +36 -0
- package/types/view/builder/index.d.ts +35 -0
- package/types/view/index.d.ts +6 -0
- package/types/view/parser/index.d.ts +52 -0
- package/types/view/parser/types.d.ts +109 -0
- package/types/view/parser/utils.d.ts +6 -0
- package/types/view/plugins/applicability.d.ts +10 -0
- package/types/view/plugins/index.d.ts +5 -0
- package/types/view/plugins/options.d.ts +4 -0
- package/types/view/plugins/string-resolver.d.ts +13 -0
- package/types/view/plugins/switch.d.ts +14 -0
- package/types/view/plugins/template-plugin.d.ts +33 -0
- package/types/view/resolver/index.d.ts +73 -0
- package/types/view/resolver/types.d.ts +129 -0
- package/types/view/resolver/utils.d.ts +11 -0
- package/types/view/view.d.ts +37 -0
- package/dist/index.d.ts +0 -1814
- package/dist/player.dev.js +0 -11472
- package/dist/player.prod.js +0 -2
- package/src/view/plugins/plugin.ts +0 -21
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { SyncWaterfallHook, SyncHook } from "tapable-ts";
|
|
2
|
+
import type { BindingInstance } from "../../binding";
|
|
3
|
+
import type { Node } from "../parser";
|
|
4
|
+
import type { Resolve } from "./types";
|
|
5
|
+
export * from "./types";
|
|
6
|
+
export * from "./utils";
|
|
7
|
+
interface NodeUpdate extends Resolve.ResolvedNode {
|
|
8
|
+
/** A flag to track if a node has changed since the last resolution */
|
|
9
|
+
updated: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The Resolver is the way to take a parsed AST graph of a view and resolve it to a concrete representation of the current user state
|
|
13
|
+
* It combines the ability to mutate ast nodes before resolving, as well as the mutating the resolved objects while parsing
|
|
14
|
+
*/
|
|
15
|
+
export declare class Resolver {
|
|
16
|
+
readonly hooks: {
|
|
17
|
+
/** A hook to allow skipping of the resolution tree for a specific node */
|
|
18
|
+
skipResolve: SyncWaterfallHook<[boolean, Node.Node, Resolve.NodeResolveOptions], Record<string, any>>;
|
|
19
|
+
/** An event emitted before calculating the next update */
|
|
20
|
+
beforeUpdate: SyncHook<[Set<BindingInstance> | undefined], Record<string, any>>;
|
|
21
|
+
/** An event emitted after calculating the next update */
|
|
22
|
+
afterUpdate: SyncHook<[any], Record<string, any>>;
|
|
23
|
+
/** The options passed to a node to resolve it to an object */
|
|
24
|
+
resolveOptions: SyncWaterfallHook<[Resolve.NodeResolveOptions, Node.Node], Record<string, any>>;
|
|
25
|
+
/** A hook to transform the AST node into a new AST node before resolving it */
|
|
26
|
+
beforeResolve: SyncWaterfallHook<[Node.Node | null, Resolve.NodeResolveOptions], Record<string, any>>;
|
|
27
|
+
/**
|
|
28
|
+
* A hook to transform an AST node into it's resolved value.
|
|
29
|
+
* This runs _before_ any children are resolved
|
|
30
|
+
*/
|
|
31
|
+
resolve: SyncWaterfallHook<[any, Node.Node, Resolve.NodeResolveOptions], Record<string, any>>;
|
|
32
|
+
/**
|
|
33
|
+
* A hook to transform the resolved value of an AST node.
|
|
34
|
+
* This runs _after_ all children nodes are resolved
|
|
35
|
+
*/
|
|
36
|
+
afterResolve: SyncWaterfallHook<[any, Node.Node, Resolve.NodeResolveOptions], Record<string, any>>;
|
|
37
|
+
/** Called at the very end of a node's tree being updated */
|
|
38
|
+
afterNodeUpdate: SyncHook<[Node.Node, Node.Node | undefined, NodeUpdate], Record<string, any>>;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The AST tree after beforeResolve is ran mapped to the AST before beforeResolve is ran
|
|
42
|
+
*/
|
|
43
|
+
private readonly ASTMap;
|
|
44
|
+
/**
|
|
45
|
+
* The root node in the AST tree we want to resolve
|
|
46
|
+
*/
|
|
47
|
+
readonly root: Node.Node;
|
|
48
|
+
/**
|
|
49
|
+
* The cache of the last resolved values when walking the tree.
|
|
50
|
+
* This gets recycled every update to avoid stale data if a node is unused in an update
|
|
51
|
+
*/
|
|
52
|
+
private resolveCache;
|
|
53
|
+
/**
|
|
54
|
+
* Cache of node IDs that have been processed to track if nodes have duplicate IDs
|
|
55
|
+
*/
|
|
56
|
+
private idCache;
|
|
57
|
+
/**
|
|
58
|
+
* The parameters required to resolve AST nodes
|
|
59
|
+
*/
|
|
60
|
+
private readonly options;
|
|
61
|
+
/**
|
|
62
|
+
* Tapable logger for logging errors encountered during view resolution
|
|
63
|
+
*/
|
|
64
|
+
private logger?;
|
|
65
|
+
constructor(root: Node.Node, options: Resolve.ResolverOptions);
|
|
66
|
+
getSourceNode(convertedAST: Node.Node): Node.Node | undefined;
|
|
67
|
+
update(changes?: Set<BindingInstance>): any;
|
|
68
|
+
getResolveCache(): Map<Node.Node, Resolve.ResolvedNode>;
|
|
69
|
+
private getPreviousResult;
|
|
70
|
+
private cloneNode;
|
|
71
|
+
private computeTree;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Schema, Formatting, Validation as ValidationTypes } from "@player-ui/types";
|
|
2
|
+
import type { BindingInstance, BindingLike, BindingFactory } from "../../binding";
|
|
3
|
+
import type { DataModelWithParser, DataModelImpl, DataModelOptions } from "../../data";
|
|
4
|
+
import type { ConstantsProvider } from "../../controllers/constants";
|
|
5
|
+
import type { TransitionFunction } from "../../controllers";
|
|
6
|
+
import type { ExpressionEvaluator, ExpressionType } from "../../expressions";
|
|
7
|
+
import type { ValidationResponse } from "../../validator";
|
|
8
|
+
import type { Logger } from "../../logger";
|
|
9
|
+
import type { SchemaController } from "../../schema";
|
|
10
|
+
import type { Node } from "../parser";
|
|
11
|
+
export interface ValidationGetResolveOptions {
|
|
12
|
+
/**
|
|
13
|
+
* If we should ignore any non-blocking validations in the return
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
ignoreNonBlocking?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface PlayerUtils {
|
|
19
|
+
findPlugin<Plugin = unknown>(symbol: symbol): Plugin | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace Resolve {
|
|
22
|
+
interface Validation {
|
|
23
|
+
/** Fetch the data-type for the given binding */
|
|
24
|
+
type(binding: BindingLike): Schema.DataType | undefined;
|
|
25
|
+
/** Get all currently applicable validation errors */
|
|
26
|
+
getAll(options?: ValidationGetResolveOptions): Map<BindingInstance, ValidationResponse> | undefined;
|
|
27
|
+
/** Internal Method to lookup if there is a validation for the given binding */
|
|
28
|
+
_getValidationForBinding(binding: BindingLike): {
|
|
29
|
+
/** Get the validation for the given binding */
|
|
30
|
+
get: (options?: ValidationGetResolveOptions) => ValidationResponse | undefined;
|
|
31
|
+
/** Get all validations for the given binding */
|
|
32
|
+
getAll: (options?: ValidationGetResolveOptions) => Array<ValidationResponse>;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/** Get field level error for the specific binding */
|
|
35
|
+
get(binding: BindingLike, options?: {
|
|
36
|
+
/** If this binding should also be tracked for validations */
|
|
37
|
+
track?: boolean;
|
|
38
|
+
} & ValidationGetResolveOptions): ValidationResponse | undefined;
|
|
39
|
+
getValidationsForBinding(binding: BindingLike, options?: {
|
|
40
|
+
/** If this binding should also be tracked for validations */
|
|
41
|
+
track?: boolean;
|
|
42
|
+
} & ValidationGetResolveOptions): Array<ValidationResponse>;
|
|
43
|
+
/** Get errors for all children regardless of section */
|
|
44
|
+
getChildren(type?: ValidationTypes.DisplayTarget): Array<ValidationResponse>;
|
|
45
|
+
/** Get errors for all children solely in this section */
|
|
46
|
+
getValidationsForSection(): Array<ValidationResponse>;
|
|
47
|
+
/** Track errors for this binding, and notify the node of changes */
|
|
48
|
+
track: (binding: BindingLike) => void;
|
|
49
|
+
/** Register node as a section */
|
|
50
|
+
register: (options?: {
|
|
51
|
+
/** While type of Display Target group it should register as */
|
|
52
|
+
type: Exclude<ValidationTypes.DisplayTarget, "field">;
|
|
53
|
+
}) => void;
|
|
54
|
+
}
|
|
55
|
+
interface BaseOptions {
|
|
56
|
+
/** A logger to use */
|
|
57
|
+
logger?: Logger;
|
|
58
|
+
/** Utils for various useful operations */
|
|
59
|
+
utils?: PlayerUtils;
|
|
60
|
+
/** An optional set of validation features */
|
|
61
|
+
validation?: Validation;
|
|
62
|
+
/** Parse a raw valy into an AST node */
|
|
63
|
+
parseNode?: (node: any) => Node.Node | null;
|
|
64
|
+
/** A function to move the state to a new place */
|
|
65
|
+
transition?: TransitionFunction;
|
|
66
|
+
/** The hub for data invariants and metaData associated with the data model */
|
|
67
|
+
schema: SchemaController;
|
|
68
|
+
/** The constants for messages */
|
|
69
|
+
constants?: ConstantsProvider;
|
|
70
|
+
}
|
|
71
|
+
interface NodeDataOptions {
|
|
72
|
+
/** The data to set or get data from */
|
|
73
|
+
model: DataModelWithParser<DataModelOptions>;
|
|
74
|
+
/**
|
|
75
|
+
* A function to format a given a value (given a binding) for display to the user
|
|
76
|
+
* Note: this doesn't persist any changes in the model.
|
|
77
|
+
*/
|
|
78
|
+
format: (binding: BindingLike, value: any) => any;
|
|
79
|
+
/**
|
|
80
|
+
* A function to format a given value using a formatting reference.
|
|
81
|
+
* The default behavior is the identity function.
|
|
82
|
+
*/
|
|
83
|
+
formatValue: (formatReference: Formatting.Reference, value: any) => any;
|
|
84
|
+
}
|
|
85
|
+
type NodeResolveOptions = BaseOptions & {
|
|
86
|
+
/** Execute the expression and return it's result */
|
|
87
|
+
evaluate: (exp: ExpressionType) => any;
|
|
88
|
+
/** All parameters for how to process data */
|
|
89
|
+
data: NodeDataOptions;
|
|
90
|
+
/** The data dependencies that were requested during the resolution */
|
|
91
|
+
getDependencies?(scope?: "core" | "children"): Set<BindingInstance>;
|
|
92
|
+
/** original node */
|
|
93
|
+
node?: Node.Node;
|
|
94
|
+
};
|
|
95
|
+
type ResolverOptions = BaseOptions & {
|
|
96
|
+
/** The data model to set or get data from */
|
|
97
|
+
model: DataModelImpl<DataModelOptions>;
|
|
98
|
+
/** A formatter function to call */
|
|
99
|
+
format?: (binding: BindingInstance, value: any) => any;
|
|
100
|
+
/**
|
|
101
|
+
* A function to format a given value using a formatting reference.
|
|
102
|
+
* The default behavior is the identity function.
|
|
103
|
+
*/
|
|
104
|
+
formatValue?: (formatReference: Formatting.Reference, value: any) => any;
|
|
105
|
+
/** An evaluator to execute an expression */
|
|
106
|
+
evaluator: ExpressionEvaluator;
|
|
107
|
+
/** A fn to parse a raw binding into a binding object */
|
|
108
|
+
parseBinding: BindingFactory;
|
|
109
|
+
};
|
|
110
|
+
interface ResolvedNode {
|
|
111
|
+
/** The original node */
|
|
112
|
+
node: Node.Node;
|
|
113
|
+
/** The data dependencies that were requested during the resolution */
|
|
114
|
+
dependencies: Set<BindingInstance>;
|
|
115
|
+
/** The final value */
|
|
116
|
+
value: any;
|
|
117
|
+
}
|
|
118
|
+
type NodeTransformFunction = (node: Node.Node, options: NodeResolveOptions) => Node.Node | null;
|
|
119
|
+
type NodeResolveFunction = (value: any, node: Node.Node, options: NodeResolveOptions) => any;
|
|
120
|
+
interface Plugin {
|
|
121
|
+
/** A transform function to migrate an AST to another AST */
|
|
122
|
+
beforeResolve?: NodeTransformFunction;
|
|
123
|
+
/** A function to transform an AST to a resolved value */
|
|
124
|
+
resolve?: NodeResolveFunction;
|
|
125
|
+
/** A function to process a resolved value before completing the node */
|
|
126
|
+
afterResolve?: NodeResolveFunction;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BindingInstance } from "../../binding";
|
|
2
|
+
import type { Resolve } from "./types";
|
|
3
|
+
/** Check to see if and of the data-changes affect the given dependencies */
|
|
4
|
+
export declare function caresAboutDataChanges(dataChanges?: Set<BindingInstance>, dependencies?: Set<BindingInstance>): boolean;
|
|
5
|
+
/** Convert the options object for a resolver to one for a node */
|
|
6
|
+
export declare function toNodeResolveOptions(resolverOptions: Resolve.ResolverOptions): Resolve.NodeResolveOptions;
|
|
7
|
+
/**
|
|
8
|
+
* helper function to flatten a potential nested array and combine with initial array
|
|
9
|
+
*/
|
|
10
|
+
export declare function unpackAndPush(item: any | any[], initial: any[]): void;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SyncHook } from "tapable-ts";
|
|
2
|
+
import type { View as ViewType } from "@player-ui/types";
|
|
3
|
+
import type { BindingInstance } from "../binding";
|
|
4
|
+
import type { ValidationProvider, ValidationObject } from "../validator";
|
|
5
|
+
import type { Resolve } from "./resolver";
|
|
6
|
+
import { Resolver } from "./resolver";
|
|
7
|
+
import { Parser } from "./parser";
|
|
8
|
+
import { TemplatePlugin } from "./plugins";
|
|
9
|
+
/** A stateful view instance from an content */
|
|
10
|
+
export declare class ViewInstance implements ValidationProvider {
|
|
11
|
+
hooks: {
|
|
12
|
+
onUpdate: SyncHook<[import("@player-ui/types").Asset<string> & {
|
|
13
|
+
validation?: import("@player-ui/types").Validation.CrossfieldReference[] | undefined;
|
|
14
|
+
}], Record<string, any>>;
|
|
15
|
+
parser: SyncHook<[Parser], Record<string, any>>;
|
|
16
|
+
resolver: SyncHook<[Resolver], Record<string, any>>;
|
|
17
|
+
onTemplatePluginCreated: SyncHook<[TemplatePlugin], Record<string, any>>;
|
|
18
|
+
templatePlugin: SyncHook<[TemplatePlugin], Record<string, any>>;
|
|
19
|
+
};
|
|
20
|
+
private resolver?;
|
|
21
|
+
readonly initialView: ViewType;
|
|
22
|
+
readonly resolverOptions: Resolve.ResolverOptions;
|
|
23
|
+
private rootNode?;
|
|
24
|
+
private validationProvider?;
|
|
25
|
+
private templatePlugin;
|
|
26
|
+
lastUpdate: Record<string, any> | undefined;
|
|
27
|
+
constructor(initialView: ViewType, resolverOptions: Resolve.ResolverOptions);
|
|
28
|
+
updateAsync(): void;
|
|
29
|
+
update(changes?: Set<BindingInstance>): any;
|
|
30
|
+
getValidationsForBinding(binding: BindingInstance): ValidationObject[] | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** A plugin for a view */
|
|
33
|
+
export interface ViewPlugin {
|
|
34
|
+
/** Called with a view instance */
|
|
35
|
+
apply(view: ViewInstance): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=view.d.ts.map
|