@player-ui/player 0.4.0-next.10 → 0.4.0-next.12
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 +39 -27
- package/dist/index.d.ts +4 -3
- package/dist/index.esm.js +36 -24
- package/dist/player.dev.js +142 -1049
- package/dist/player.prod.js +1 -1
- package/package.json +4 -3
- package/src/binding/index.ts +13 -3
- package/src/binding/resolver.ts +1 -1
- package/src/binding-grammar/custom/index.ts +17 -9
- package/src/controllers/validation/controller.ts +97 -63
- package/src/player.ts +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var types = require('@player-ui/types');
|
|
6
6
|
var tapableTs = require('tapable-ts');
|
|
7
|
-
var
|
|
7
|
+
var tsNestedError = require('ts-nested-error');
|
|
8
8
|
var flatten$1 = require('arr-flatten');
|
|
9
9
|
var P = require('parsimmon');
|
|
10
10
|
var ebnf = require('ebnf');
|
|
@@ -17,7 +17,6 @@ var partialMatchRegistry = require('@player-ui/partial-match-registry');
|
|
|
17
17
|
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
19
|
|
|
20
|
-
var NestedError__default = /*#__PURE__*/_interopDefaultLegacy(NestedError);
|
|
21
20
|
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten$1);
|
|
22
21
|
var P__default = /*#__PURE__*/_interopDefaultLegacy(P);
|
|
23
22
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
@@ -106,7 +105,8 @@ const isIdentifierChar = (char) => {
|
|
|
106
105
|
return false;
|
|
107
106
|
}
|
|
108
107
|
const charCode = char.charCodeAt(0);
|
|
109
|
-
|
|
108
|
+
const matches = charCode === 32 || charCode === 34 || charCode === 39 || charCode === 40 || charCode === 41 || charCode === 42 || charCode === 46 || charCode === 61 || charCode === 91 || charCode === 93 || charCode === 96 || charCode === 123 || charCode === 125;
|
|
109
|
+
return !matches;
|
|
110
110
|
};
|
|
111
111
|
const parse$1 = (path) => {
|
|
112
112
|
let index = 1;
|
|
@@ -392,7 +392,7 @@ function resolveBindingAST(bindingPathNode, options, hooks) {
|
|
|
392
392
|
try {
|
|
393
393
|
return options.convertToPath(options.getValue(nestedResolvedValue.path));
|
|
394
394
|
} catch (e) {
|
|
395
|
-
throw new
|
|
395
|
+
throw new tsNestedError.NestedError(`Unable to resolve path segment: ${nestedResolvedValue.path}`, e);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
if (node.name === "Expression") {
|
|
@@ -400,7 +400,7 @@ function resolveBindingAST(bindingPathNode, options, hooks) {
|
|
|
400
400
|
const actualValue = options.evaluate(node.value);
|
|
401
401
|
return options.convertToPath(actualValue);
|
|
402
402
|
} catch (e) {
|
|
403
|
-
throw new
|
|
403
|
+
throw new tsNestedError.NestedError(`Unable to resolve path: ${node.value}`, e);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
throw new Error(`Unable to resolve value for node: ${node.name}`);
|
|
@@ -470,6 +470,8 @@ var __spreadValues$d = (a, b) => {
|
|
|
470
470
|
return a;
|
|
471
471
|
};
|
|
472
472
|
const SIMPLE_BINDING_REGEX = /^[\w\-@]+(\.[\w\-@]+)*$/;
|
|
473
|
+
const BINDING_BRACKETS_REGEX = /[\s()*=`{}'"[\]]/;
|
|
474
|
+
const LAZY_BINDING_REGEX = /^[^.]+(\..+)*$/;
|
|
473
475
|
const DEFAULT_OPTIONS = {
|
|
474
476
|
get: () => {
|
|
475
477
|
throw new Error("Not Implemented");
|
|
@@ -494,7 +496,7 @@ class BindingParser {
|
|
|
494
496
|
}
|
|
495
497
|
normalizePath(path, resolveOptions) {
|
|
496
498
|
var _a, _b;
|
|
497
|
-
if (path.
|
|
499
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
498
500
|
return { path: path.split("."), updates: void 0 };
|
|
499
501
|
}
|
|
500
502
|
const ast = (_a = this.parseCache[path]) != null ? _a : parse$1(path);
|
|
@@ -505,7 +507,7 @@ class BindingParser {
|
|
|
505
507
|
try {
|
|
506
508
|
return resolveBindingAST(ast.path, resolveOptions, this.hooks);
|
|
507
509
|
} catch (e) {
|
|
508
|
-
throw new
|
|
510
|
+
throw new tsNestedError.NestedError(`Cannot resolve binding: ${path}`, e);
|
|
509
511
|
}
|
|
510
512
|
}
|
|
511
513
|
getBindingForNormalizedResult(normalized) {
|
|
@@ -3757,6 +3759,14 @@ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
|
3757
3759
|
const SCHEMA_VALIDATION_PROVIDER_NAME = "schema";
|
|
3758
3760
|
const VIEW_VALIDATION_PROVIDER_NAME = "view";
|
|
3759
3761
|
const VALIDATION_PROVIDER_NAME_SYMBOL = Symbol.for("validation-provider-name");
|
|
3762
|
+
function isSubset(subset, containingSet) {
|
|
3763
|
+
if (subset.size > containingSet.size)
|
|
3764
|
+
return false;
|
|
3765
|
+
for (const entry of subset)
|
|
3766
|
+
if (!containingSet.has(entry))
|
|
3767
|
+
return false;
|
|
3768
|
+
return true;
|
|
3769
|
+
}
|
|
3760
3770
|
function createStatefulValidationObject(obj) {
|
|
3761
3771
|
return {
|
|
3762
3772
|
value: obj,
|
|
@@ -3819,23 +3829,26 @@ class ValidatedBinding {
|
|
|
3819
3829
|
}
|
|
3820
3830
|
}
|
|
3821
3831
|
runApplicableValidations(runner, canDismiss) {
|
|
3822
|
-
this.applicableValidations = this.applicableValidations.map((
|
|
3832
|
+
this.applicableValidations = this.applicableValidations.map((originalValue) => {
|
|
3823
3833
|
var _a, _b, _c;
|
|
3824
|
-
if (
|
|
3825
|
-
return
|
|
3834
|
+
if (originalValue.state === "dismissed") {
|
|
3835
|
+
return originalValue;
|
|
3826
3836
|
}
|
|
3827
|
-
const blocking = (_a =
|
|
3837
|
+
const blocking = (_a = originalValue.value.blocking) != null ? _a : originalValue.value.severity === "warning" && "once" || true;
|
|
3838
|
+
const obj = timm.setIn(originalValue, ["value", "blocking"], blocking);
|
|
3828
3839
|
const isBlockingNavigation = blocking === true || blocking === "once" && !canDismiss;
|
|
3829
|
-
|
|
3830
|
-
if (this.currentPhase === "navigation" && obj.state === "active" && dismissable) {
|
|
3840
|
+
if (this.currentPhase === "navigation" && obj.state === "active" && obj.value.blocking !== true) {
|
|
3831
3841
|
if (obj.value.severity === "warning") {
|
|
3832
3842
|
const warn = obj;
|
|
3833
|
-
if (warn.dismissable && warn.response.dismiss) {
|
|
3843
|
+
if (warn.dismissable && warn.response.dismiss && (warn.response.blocking !== "once" || !warn.response.blocking)) {
|
|
3834
3844
|
warn.response.dismiss();
|
|
3835
3845
|
} else {
|
|
3846
|
+
if ((warn == null ? void 0 : warn.response.blocking) === "once") {
|
|
3847
|
+
warn.response.blocking = false;
|
|
3848
|
+
}
|
|
3836
3849
|
warn.dismissable = true;
|
|
3837
3850
|
}
|
|
3838
|
-
return
|
|
3851
|
+
return warn;
|
|
3839
3852
|
}
|
|
3840
3853
|
}
|
|
3841
3854
|
const response = runner(obj.value);
|
|
@@ -3862,6 +3875,7 @@ class ValidatedBinding {
|
|
|
3862
3875
|
});
|
|
3863
3876
|
}
|
|
3864
3877
|
update(phase, canDismiss, runner) {
|
|
3878
|
+
const newApplicableValidations = [];
|
|
3865
3879
|
if (phase === "load" && this.currentPhase !== void 0) {
|
|
3866
3880
|
return;
|
|
3867
3881
|
}
|
|
@@ -3879,8 +3893,13 @@ class ValidatedBinding {
|
|
|
3879
3893
|
...this.validationsByState.change
|
|
3880
3894
|
];
|
|
3881
3895
|
} else if (phase === "navigation" && (this.currentPhase === "load" || this.currentPhase === "change")) {
|
|
3896
|
+
this.applicableValidations.forEach((element) => {
|
|
3897
|
+
if (!(element.type === "error" && element.state === "active" && element.isBlockingNavigation === false)) {
|
|
3898
|
+
newApplicableValidations.push(element);
|
|
3899
|
+
}
|
|
3900
|
+
});
|
|
3882
3901
|
this.applicableValidations = [
|
|
3883
|
-
...
|
|
3902
|
+
...newApplicableValidations,
|
|
3884
3903
|
...this.currentPhase === "load" ? this.validationsByState.change : [],
|
|
3885
3904
|
...this.validationsByState.navigation
|
|
3886
3905
|
];
|
|
@@ -4120,19 +4139,11 @@ class ValidationController {
|
|
|
4120
4139
|
updateValidations(!isNavigationTrigger);
|
|
4121
4140
|
if (isNavigationTrigger) {
|
|
4122
4141
|
const { activeBindings } = this;
|
|
4123
|
-
if (
|
|
4142
|
+
if (isSubset(activeBindings, lastActiveBindings)) {
|
|
4124
4143
|
updateValidations(true);
|
|
4125
4144
|
}
|
|
4126
4145
|
}
|
|
4127
4146
|
}
|
|
4128
|
-
setCompare(set1, set2) {
|
|
4129
|
-
if (set1.size !== set2.size)
|
|
4130
|
-
return false;
|
|
4131
|
-
for (const entry of set1)
|
|
4132
|
-
if (!set2.has(entry))
|
|
4133
|
-
return false;
|
|
4134
|
-
return true;
|
|
4135
|
-
}
|
|
4136
4147
|
get activeBindings() {
|
|
4137
4148
|
return new Set(Array.from(this.getBindings()).filter((b) => {
|
|
4138
4149
|
var _a;
|
|
@@ -4783,8 +4794,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4783
4794
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
4784
4795
|
});
|
|
4785
4796
|
};
|
|
4786
|
-
const PLAYER_VERSION = "0.4.0-next.
|
|
4787
|
-
const COMMIT = "
|
|
4797
|
+
const PLAYER_VERSION = "0.4.0-next.12";
|
|
4798
|
+
const COMMIT = "cbc2cfa9cc04202b7919813d1493f9ea3b911621";
|
|
4788
4799
|
const _Player = class {
|
|
4789
4800
|
constructor(config) {
|
|
4790
4801
|
this.logger = new TapableLogger();
|
|
@@ -5082,6 +5093,7 @@ Player.info = {
|
|
|
5082
5093
|
|
|
5083
5094
|
exports.ApplicabilityPlugin = ApplicabilityPlugin;
|
|
5084
5095
|
exports.AssetTransformCorePlugin = AssetTransformCorePlugin;
|
|
5096
|
+
exports.BINDING_BRACKETS_REGEX = BINDING_BRACKETS_REGEX;
|
|
5085
5097
|
exports.BindingInstance = BindingInstance;
|
|
5086
5098
|
exports.BindingParser = BindingParser;
|
|
5087
5099
|
exports.Builder = Builder;
|
package/dist/index.d.ts
CHANGED
|
@@ -123,6 +123,8 @@ declare function getBindingSegments(binding: BindingLike): Array<string | number
|
|
|
123
123
|
declare function findInArray<T extends Record<string | number, object>>(array: Array<T>, key: string | number, value: T): number | undefined;
|
|
124
124
|
|
|
125
125
|
declare const SIMPLE_BINDING_REGEX: RegExp;
|
|
126
|
+
declare const BINDING_BRACKETS_REGEX: RegExp;
|
|
127
|
+
declare type BeforeResolveNodeContext = Required<NormalizedResult> & ResolveBindingASTOptions;
|
|
126
128
|
/** A parser for creating bindings from a string */
|
|
127
129
|
declare class BindingParser {
|
|
128
130
|
private cache;
|
|
@@ -130,7 +132,7 @@ declare class BindingParser {
|
|
|
130
132
|
private parserOptions;
|
|
131
133
|
hooks: {
|
|
132
134
|
skipOptimization: SyncBailHook<[string], boolean, Record<string, any>>;
|
|
133
|
-
beforeResolveNode: SyncWaterfallHook<[AnyNode,
|
|
135
|
+
beforeResolveNode: SyncWaterfallHook<[AnyNode, BeforeResolveNodeContext], Record<string, any>>;
|
|
134
136
|
};
|
|
135
137
|
constructor(options?: Partial<BindingParserOptions>);
|
|
136
138
|
/**
|
|
@@ -1330,7 +1332,6 @@ declare class ValidationController implements BindingTracker {
|
|
|
1330
1332
|
message: string;
|
|
1331
1333
|
} | undefined;
|
|
1332
1334
|
private updateValidationsForView;
|
|
1333
|
-
private setCompare;
|
|
1334
1335
|
private get activeBindings();
|
|
1335
1336
|
getValidator(type: string): ValidatorFunction<unknown> | undefined;
|
|
1336
1337
|
getBindings(): Set<BindingInstance>;
|
|
@@ -1775,4 +1776,4 @@ declare class FlowExpPlugin implements PlayerPlugin {
|
|
|
1775
1776
|
apply(player: Player): void;
|
|
1776
1777
|
}
|
|
1777
1778
|
|
|
1778
|
-
export { AnyAssetType, ApplicabilityPlugin, ArrayExpressionNode, AssetTransformCorePlugin, AssignmentNode, BaseFlowState, BaseNode, BasicExpressionTypes, BatchSetTransaction, BeforeTransformFunction, BinaryNode, BinaryOperator, BinaryOperatorAdvanced, BinaryOperatorBasic, BindingFactory, BindingInstance, BindingLike, BindingParser, BindingParserOptions, BindingTracker, Builder, CallExpressionNode, CompletedState, CompoundNode, ConditionalExpressionNode, ConsoleLogger, ConstantsController, ConstantsProvider, ControllerState, DataController, DataModelImpl, DataModelMiddleware, DataModelOptions, DataModelWithParser, DataPipeline, DependencyMiddleware, DependencyModel, DependencySets, DependencyTracker, DirectionalNode, EMPTY_NODE, ErrorState, ErrorValidationResponse, ExpNodeOpaqueIdentifier, ExpressionContext, ExpressionEvaluator, ExpressionEvaluatorFunction, ExpressionEvaluatorOptions, ExpressionHandler, ExpressionLiteralType, ExpressionNode, ExpressionNodeType, ExpressionObjectType, ExpressionType, ExtendedPlayerPlugin, FlowController, FlowExpPlugin, FlowInstance, FormatDefinition, FormatFunction, FormatHandler, FormatOptions, FormatType, Getter, HookOptions, IdentifierNode, InProgressState, LiteralNode, LocalModel, LocalStateStore, LogFn, Logger, LoggerProvider, LogicalNode, MemberExpressionNode, MiddlewareChecker, ModelRefNode, ModificationNode, NOOPDataModel, NOOP_MODEL, NOT_STARTED_STATE, NamedState, Node, NodeLocation, NodePosition, NodeType, NoopLogger, NotStartedState, ObjectNode, OperatorProcessingOptions, Options, ParseObjectOptions, Parser, PipelinedDataModel, Player, PlayerConfigOptions, PlayerFlowExecutionData, PlayerFlowState, PlayerFlowStatus, PlayerInfo, PlayerPlugin, PlayerUtils, ProxyLogger, ROOT_BINDING, RawBinding, RawBindingSegment, RawSetTransaction, RawSetType, Resolve, Resolver, SCHEMA_VALIDATION_PROVIDER_NAME, SIMPLE_BINDING_REGEX, SchemaController, Severity, StatefulValidationObject, Store, StringResolverPlugin, StrongOrWeakBinding, SwitchPlugin, TapableLogger, TemplatePlugin, ThisNode, TransformFunction, TransformFunctions, TransformRegistry, TransitionFunction, TransitionOptions, UnaryNode, UnaryOperator, Updates, VALIDATION_PROVIDER_NAME_SYMBOL, VIEW_VALIDATION_PROVIDER_NAME, ValidationBindingTrackerViewPlugin, ValidationController, ValidationGetResolveOptions, ValidationMiddleware, ValidationObject, ValidationObjectWithHandler, ValidationObjectWithSource, ValidationProvider, ValidationResponse, ValidatorContext, ValidatorFunction, ValidatorRegistry, ViewController, ViewControllerOptions, ViewInstance, ViewPlugin, WarningValidationResponse, caresAboutDataChanges, constructModelForPipeline, findClosestNodeAtPosition, findInArray, findNextExp, getBindingSegments, isBinding, isExpressionNode, isObjectExpression, maybeConvertToNum, parse, parseExpression, removeBindingAndChildrenFromMap, resolveDataRefs, resolveDataRefsInString, resolveExpressionsInString, severities, toModel, toNodeResolveOptions, withParser, withoutContext };
|
|
1779
|
+
export { AnyAssetType, ApplicabilityPlugin, ArrayExpressionNode, AssetTransformCorePlugin, AssignmentNode, BINDING_BRACKETS_REGEX, BaseFlowState, BaseNode, BasicExpressionTypes, BatchSetTransaction, BeforeTransformFunction, BinaryNode, BinaryOperator, BinaryOperatorAdvanced, BinaryOperatorBasic, BindingFactory, BindingInstance, BindingLike, BindingParser, BindingParserOptions, BindingTracker, Builder, CallExpressionNode, CompletedState, CompoundNode, ConditionalExpressionNode, ConsoleLogger, ConstantsController, ConstantsProvider, ControllerState, DataController, DataModelImpl, DataModelMiddleware, DataModelOptions, DataModelWithParser, DataPipeline, DependencyMiddleware, DependencyModel, DependencySets, DependencyTracker, DirectionalNode, EMPTY_NODE, ErrorState, ErrorValidationResponse, ExpNodeOpaqueIdentifier, ExpressionContext, ExpressionEvaluator, ExpressionEvaluatorFunction, ExpressionEvaluatorOptions, ExpressionHandler, ExpressionLiteralType, ExpressionNode, ExpressionNodeType, ExpressionObjectType, ExpressionType, ExtendedPlayerPlugin, FlowController, FlowExpPlugin, FlowInstance, FormatDefinition, FormatFunction, FormatHandler, FormatOptions, FormatType, Getter, HookOptions, IdentifierNode, InProgressState, LiteralNode, LocalModel, LocalStateStore, LogFn, Logger, LoggerProvider, LogicalNode, MemberExpressionNode, MiddlewareChecker, ModelRefNode, ModificationNode, NOOPDataModel, NOOP_MODEL, NOT_STARTED_STATE, NamedState, Node, NodeLocation, NodePosition, NodeType, NoopLogger, NotStartedState, ObjectNode, OperatorProcessingOptions, Options, ParseObjectOptions, Parser, PipelinedDataModel, Player, PlayerConfigOptions, PlayerFlowExecutionData, PlayerFlowState, PlayerFlowStatus, PlayerInfo, PlayerPlugin, PlayerUtils, ProxyLogger, ROOT_BINDING, RawBinding, RawBindingSegment, RawSetTransaction, RawSetType, Resolve, Resolver, SCHEMA_VALIDATION_PROVIDER_NAME, SIMPLE_BINDING_REGEX, SchemaController, Severity, StatefulValidationObject, Store, StringResolverPlugin, StrongOrWeakBinding, SwitchPlugin, TapableLogger, TemplatePlugin, ThisNode, TransformFunction, TransformFunctions, TransformRegistry, TransitionFunction, TransitionOptions, UnaryNode, UnaryOperator, Updates, VALIDATION_PROVIDER_NAME_SYMBOL, VIEW_VALIDATION_PROVIDER_NAME, ValidationBindingTrackerViewPlugin, ValidationController, ValidationGetResolveOptions, ValidationMiddleware, ValidationObject, ValidationObjectWithHandler, ValidationObjectWithSource, ValidationProvider, ValidationResponse, ValidatorContext, ValidatorFunction, ValidatorRegistry, ViewController, ViewControllerOptions, ViewInstance, ViewPlugin, WarningValidationResponse, caresAboutDataChanges, constructModelForPipeline, findClosestNodeAtPosition, findInArray, findNextExp, getBindingSegments, isBinding, isExpressionNode, isObjectExpression, maybeConvertToNum, parse, parseExpression, removeBindingAndChildrenFromMap, resolveDataRefs, resolveDataRefsInString, resolveExpressionsInString, severities, toModel, toNodeResolveOptions, withParser, withoutContext };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@player-ui/types';
|
|
2
2
|
import { SyncBailHook, SyncWaterfallHook, SyncHook } from 'tapable-ts';
|
|
3
|
-
import NestedError from 'nested-error
|
|
3
|
+
import { NestedError } from 'ts-nested-error';
|
|
4
4
|
import flatten$1 from 'arr-flatten';
|
|
5
5
|
import P from 'parsimmon';
|
|
6
6
|
import { Grammars } from 'ebnf';
|
|
@@ -93,7 +93,8 @@ const isIdentifierChar = (char) => {
|
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
95
95
|
const charCode = char.charCodeAt(0);
|
|
96
|
-
|
|
96
|
+
const matches = charCode === 32 || charCode === 34 || charCode === 39 || charCode === 40 || charCode === 41 || charCode === 42 || charCode === 46 || charCode === 61 || charCode === 91 || charCode === 93 || charCode === 96 || charCode === 123 || charCode === 125;
|
|
97
|
+
return !matches;
|
|
97
98
|
};
|
|
98
99
|
const parse$1 = (path) => {
|
|
99
100
|
let index = 1;
|
|
@@ -457,6 +458,8 @@ var __spreadValues$d = (a, b) => {
|
|
|
457
458
|
return a;
|
|
458
459
|
};
|
|
459
460
|
const SIMPLE_BINDING_REGEX = /^[\w\-@]+(\.[\w\-@]+)*$/;
|
|
461
|
+
const BINDING_BRACKETS_REGEX = /[\s()*=`{}'"[\]]/;
|
|
462
|
+
const LAZY_BINDING_REGEX = /^[^.]+(\..+)*$/;
|
|
460
463
|
const DEFAULT_OPTIONS = {
|
|
461
464
|
get: () => {
|
|
462
465
|
throw new Error("Not Implemented");
|
|
@@ -481,7 +484,7 @@ class BindingParser {
|
|
|
481
484
|
}
|
|
482
485
|
normalizePath(path, resolveOptions) {
|
|
483
486
|
var _a, _b;
|
|
484
|
-
if (path.
|
|
487
|
+
if (!BINDING_BRACKETS_REGEX.test(path) && LAZY_BINDING_REGEX.test(path) && this.hooks.skipOptimization.call(path) !== true) {
|
|
485
488
|
return { path: path.split("."), updates: void 0 };
|
|
486
489
|
}
|
|
487
490
|
const ast = (_a = this.parseCache[path]) != null ? _a : parse$1(path);
|
|
@@ -3744,6 +3747,14 @@ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
|
3744
3747
|
const SCHEMA_VALIDATION_PROVIDER_NAME = "schema";
|
|
3745
3748
|
const VIEW_VALIDATION_PROVIDER_NAME = "view";
|
|
3746
3749
|
const VALIDATION_PROVIDER_NAME_SYMBOL = Symbol.for("validation-provider-name");
|
|
3750
|
+
function isSubset(subset, containingSet) {
|
|
3751
|
+
if (subset.size > containingSet.size)
|
|
3752
|
+
return false;
|
|
3753
|
+
for (const entry of subset)
|
|
3754
|
+
if (!containingSet.has(entry))
|
|
3755
|
+
return false;
|
|
3756
|
+
return true;
|
|
3757
|
+
}
|
|
3747
3758
|
function createStatefulValidationObject(obj) {
|
|
3748
3759
|
return {
|
|
3749
3760
|
value: obj,
|
|
@@ -3806,23 +3817,26 @@ class ValidatedBinding {
|
|
|
3806
3817
|
}
|
|
3807
3818
|
}
|
|
3808
3819
|
runApplicableValidations(runner, canDismiss) {
|
|
3809
|
-
this.applicableValidations = this.applicableValidations.map((
|
|
3820
|
+
this.applicableValidations = this.applicableValidations.map((originalValue) => {
|
|
3810
3821
|
var _a, _b, _c;
|
|
3811
|
-
if (
|
|
3812
|
-
return
|
|
3822
|
+
if (originalValue.state === "dismissed") {
|
|
3823
|
+
return originalValue;
|
|
3813
3824
|
}
|
|
3814
|
-
const blocking = (_a =
|
|
3825
|
+
const blocking = (_a = originalValue.value.blocking) != null ? _a : originalValue.value.severity === "warning" && "once" || true;
|
|
3826
|
+
const obj = setIn(originalValue, ["value", "blocking"], blocking);
|
|
3815
3827
|
const isBlockingNavigation = blocking === true || blocking === "once" && !canDismiss;
|
|
3816
|
-
|
|
3817
|
-
if (this.currentPhase === "navigation" && obj.state === "active" && dismissable) {
|
|
3828
|
+
if (this.currentPhase === "navigation" && obj.state === "active" && obj.value.blocking !== true) {
|
|
3818
3829
|
if (obj.value.severity === "warning") {
|
|
3819
3830
|
const warn = obj;
|
|
3820
|
-
if (warn.dismissable && warn.response.dismiss) {
|
|
3831
|
+
if (warn.dismissable && warn.response.dismiss && (warn.response.blocking !== "once" || !warn.response.blocking)) {
|
|
3821
3832
|
warn.response.dismiss();
|
|
3822
3833
|
} else {
|
|
3834
|
+
if ((warn == null ? void 0 : warn.response.blocking) === "once") {
|
|
3835
|
+
warn.response.blocking = false;
|
|
3836
|
+
}
|
|
3823
3837
|
warn.dismissable = true;
|
|
3824
3838
|
}
|
|
3825
|
-
return
|
|
3839
|
+
return warn;
|
|
3826
3840
|
}
|
|
3827
3841
|
}
|
|
3828
3842
|
const response = runner(obj.value);
|
|
@@ -3849,6 +3863,7 @@ class ValidatedBinding {
|
|
|
3849
3863
|
});
|
|
3850
3864
|
}
|
|
3851
3865
|
update(phase, canDismiss, runner) {
|
|
3866
|
+
const newApplicableValidations = [];
|
|
3852
3867
|
if (phase === "load" && this.currentPhase !== void 0) {
|
|
3853
3868
|
return;
|
|
3854
3869
|
}
|
|
@@ -3866,8 +3881,13 @@ class ValidatedBinding {
|
|
|
3866
3881
|
...this.validationsByState.change
|
|
3867
3882
|
];
|
|
3868
3883
|
} else if (phase === "navigation" && (this.currentPhase === "load" || this.currentPhase === "change")) {
|
|
3884
|
+
this.applicableValidations.forEach((element) => {
|
|
3885
|
+
if (!(element.type === "error" && element.state === "active" && element.isBlockingNavigation === false)) {
|
|
3886
|
+
newApplicableValidations.push(element);
|
|
3887
|
+
}
|
|
3888
|
+
});
|
|
3869
3889
|
this.applicableValidations = [
|
|
3870
|
-
...
|
|
3890
|
+
...newApplicableValidations,
|
|
3871
3891
|
...this.currentPhase === "load" ? this.validationsByState.change : [],
|
|
3872
3892
|
...this.validationsByState.navigation
|
|
3873
3893
|
];
|
|
@@ -4107,19 +4127,11 @@ class ValidationController {
|
|
|
4107
4127
|
updateValidations(!isNavigationTrigger);
|
|
4108
4128
|
if (isNavigationTrigger) {
|
|
4109
4129
|
const { activeBindings } = this;
|
|
4110
|
-
if (
|
|
4130
|
+
if (isSubset(activeBindings, lastActiveBindings)) {
|
|
4111
4131
|
updateValidations(true);
|
|
4112
4132
|
}
|
|
4113
4133
|
}
|
|
4114
4134
|
}
|
|
4115
|
-
setCompare(set1, set2) {
|
|
4116
|
-
if (set1.size !== set2.size)
|
|
4117
|
-
return false;
|
|
4118
|
-
for (const entry of set1)
|
|
4119
|
-
if (!set2.has(entry))
|
|
4120
|
-
return false;
|
|
4121
|
-
return true;
|
|
4122
|
-
}
|
|
4123
4135
|
get activeBindings() {
|
|
4124
4136
|
return new Set(Array.from(this.getBindings()).filter((b) => {
|
|
4125
4137
|
var _a;
|
|
@@ -4770,8 +4782,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4770
4782
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
4771
4783
|
});
|
|
4772
4784
|
};
|
|
4773
|
-
const PLAYER_VERSION = "0.4.0-next.
|
|
4774
|
-
const COMMIT = "
|
|
4785
|
+
const PLAYER_VERSION = "0.4.0-next.12";
|
|
4786
|
+
const COMMIT = "cbc2cfa9cc04202b7919813d1493f9ea3b911621";
|
|
4775
4787
|
const _Player = class {
|
|
4776
4788
|
constructor(config) {
|
|
4777
4789
|
this.logger = new TapableLogger();
|
|
@@ -5067,5 +5079,5 @@ Player.info = {
|
|
|
5067
5079
|
commit: COMMIT
|
|
5068
5080
|
};
|
|
5069
5081
|
|
|
5070
|
-
export { ApplicabilityPlugin, AssetTransformCorePlugin, BindingInstance, BindingParser, Builder, ConsoleLogger, ConstantsController, DataController, DependencyMiddleware, DependencyModel, DependencyTracker, EMPTY_NODE, ExpNodeOpaqueIdentifier, ExpressionEvaluator, FlowController, FlowExpPlugin, FlowInstance, LocalModel, LocalStateStore, NOOPDataModel, NOOP_MODEL, NOT_STARTED_STATE, NodeType, NoopLogger, Parser, PipelinedDataModel, Player, ProxyLogger, ROOT_BINDING, Resolver, SCHEMA_VALIDATION_PROVIDER_NAME, SIMPLE_BINDING_REGEX, SchemaController, StringResolverPlugin, SwitchPlugin, TapableLogger, TemplatePlugin, VALIDATION_PROVIDER_NAME_SYMBOL, VIEW_VALIDATION_PROVIDER_NAME, ValidationBindingTrackerViewPlugin, ValidationController, ValidationMiddleware, ValidatorRegistry, ViewController, ViewInstance, caresAboutDataChanges, constructModelForPipeline, findClosestNodeAtPosition, findInArray, findNextExp, getBindingSegments, isBinding, isExpressionNode, isObjectExpression, maybeConvertToNum, parse, parseExpression, removeBindingAndChildrenFromMap, resolveDataRefs, resolveDataRefsInString, resolveExpressionsInString, severities, toModel, toNodeResolveOptions, withParser, withoutContext };
|
|
5082
|
+
export { ApplicabilityPlugin, AssetTransformCorePlugin, BINDING_BRACKETS_REGEX, BindingInstance, BindingParser, Builder, ConsoleLogger, ConstantsController, DataController, DependencyMiddleware, DependencyModel, DependencyTracker, EMPTY_NODE, ExpNodeOpaqueIdentifier, ExpressionEvaluator, FlowController, FlowExpPlugin, FlowInstance, LocalModel, LocalStateStore, NOOPDataModel, NOOP_MODEL, NOT_STARTED_STATE, NodeType, NoopLogger, Parser, PipelinedDataModel, Player, ProxyLogger, ROOT_BINDING, Resolver, SCHEMA_VALIDATION_PROVIDER_NAME, SIMPLE_BINDING_REGEX, SchemaController, StringResolverPlugin, SwitchPlugin, TapableLogger, TemplatePlugin, VALIDATION_PROVIDER_NAME_SYMBOL, VIEW_VALIDATION_PROVIDER_NAME, ValidationBindingTrackerViewPlugin, ValidationController, ValidationMiddleware, ValidatorRegistry, ViewController, ViewInstance, caresAboutDataChanges, constructModelForPipeline, findClosestNodeAtPosition, findInArray, findNextExp, getBindingSegments, isBinding, isExpressionNode, isObjectExpression, maybeConvertToNum, parse, parseExpression, removeBindingAndChildrenFromMap, resolveDataRefs, resolveDataRefsInString, resolveExpressionsInString, severities, toModel, toNodeResolveOptions, withParser, withoutContext };
|
|
5071
5083
|
//# sourceMappingURL=index.esm.js.map
|