@player-ui/player 0.15.5-next.0 → 0.15.5
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 +53 -43
- package/dist/Player.native.js.map +1 -1
- package/dist/cjs/index.cjs +47 -40
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +47 -40
- package/dist/index.mjs +47 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/player.test.ts +173 -0
- package/src/controllers/validation/controller.ts +53 -47
- package/src/validator/validation-middleware.ts +5 -0
- package/types/controllers/validation/controller.d.ts +1 -0
- package/types/validator/validation-middleware.d.ts +2 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -2732,6 +2732,10 @@ var ValidationMiddleware = class {
|
|
|
2732
2732
|
);
|
|
2733
2733
|
return next?.delete(binding, options);
|
|
2734
2734
|
}
|
|
2735
|
+
/** Clears any invalid values staged in the shadow model */
|
|
2736
|
+
reset() {
|
|
2737
|
+
this.shadowModelPaths.clear();
|
|
2738
|
+
}
|
|
2735
2739
|
};
|
|
2736
2740
|
|
|
2737
2741
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/validator/registry.ts
|
|
@@ -4625,6 +4629,44 @@ var ValidationController = class {
|
|
|
4625
4629
|
}
|
|
4626
4630
|
/** Return the middleware for the data-model to stop propagation of invalid data */
|
|
4627
4631
|
getDataMiddleware() {
|
|
4632
|
+
const validationMiddleware = new ValidationMiddleware(
|
|
4633
|
+
(binding) => {
|
|
4634
|
+
if (!this.options) {
|
|
4635
|
+
return;
|
|
4636
|
+
}
|
|
4637
|
+
this.updateValidationsForBinding(binding, "change", this.options);
|
|
4638
|
+
const strongValidation = this.getValidationForBinding(binding);
|
|
4639
|
+
if (strongValidation?.get()?.severity === "error") {
|
|
4640
|
+
return strongValidation.get();
|
|
4641
|
+
}
|
|
4642
|
+
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
4643
|
+
this.validations.forEach((weakValidation, strongBinding) => {
|
|
4644
|
+
if (caresAboutDataChanges(
|
|
4645
|
+
/* @__PURE__ */ new Set([binding]),
|
|
4646
|
+
weakValidation.weakBindings
|
|
4647
|
+
) && weakValidation?.get()?.severity === "error") {
|
|
4648
|
+
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
4649
|
+
if (weakBinding === strongBinding) {
|
|
4650
|
+
newInvalidBindings.add({
|
|
4651
|
+
binding: weakBinding,
|
|
4652
|
+
isStrong: true
|
|
4653
|
+
});
|
|
4654
|
+
} else {
|
|
4655
|
+
newInvalidBindings.add({
|
|
4656
|
+
binding: weakBinding,
|
|
4657
|
+
isStrong: false
|
|
4658
|
+
});
|
|
4659
|
+
}
|
|
4660
|
+
});
|
|
4661
|
+
}
|
|
4662
|
+
});
|
|
4663
|
+
if (newInvalidBindings.size > 0) {
|
|
4664
|
+
return newInvalidBindings;
|
|
4665
|
+
}
|
|
4666
|
+
},
|
|
4667
|
+
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
4668
|
+
);
|
|
4669
|
+
this.validationMiddleware = validationMiddleware;
|
|
4628
4670
|
return [
|
|
4629
4671
|
{
|
|
4630
4672
|
set: (transaction, options, next) => {
|
|
@@ -4641,43 +4683,7 @@ var ValidationController = class {
|
|
|
4641
4683
|
return next?.delete(binding, options);
|
|
4642
4684
|
}
|
|
4643
4685
|
},
|
|
4644
|
-
|
|
4645
|
-
(binding) => {
|
|
4646
|
-
if (!this.options) {
|
|
4647
|
-
return;
|
|
4648
|
-
}
|
|
4649
|
-
this.updateValidationsForBinding(binding, "change", this.options);
|
|
4650
|
-
const strongValidation = this.getValidationForBinding(binding);
|
|
4651
|
-
if (strongValidation?.get()?.severity === "error") {
|
|
4652
|
-
return strongValidation.get();
|
|
4653
|
-
}
|
|
4654
|
-
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
4655
|
-
this.validations.forEach((weakValidation, strongBinding) => {
|
|
4656
|
-
if (caresAboutDataChanges(
|
|
4657
|
-
/* @__PURE__ */ new Set([binding]),
|
|
4658
|
-
weakValidation.weakBindings
|
|
4659
|
-
) && weakValidation?.get()?.severity === "error") {
|
|
4660
|
-
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
4661
|
-
if (weakBinding === strongBinding) {
|
|
4662
|
-
newInvalidBindings.add({
|
|
4663
|
-
binding: weakBinding,
|
|
4664
|
-
isStrong: true
|
|
4665
|
-
});
|
|
4666
|
-
} else {
|
|
4667
|
-
newInvalidBindings.add({
|
|
4668
|
-
binding: weakBinding,
|
|
4669
|
-
isStrong: false
|
|
4670
|
-
});
|
|
4671
|
-
}
|
|
4672
|
-
});
|
|
4673
|
-
}
|
|
4674
|
-
});
|
|
4675
|
-
if (newInvalidBindings.size > 0) {
|
|
4676
|
-
return newInvalidBindings;
|
|
4677
|
-
}
|
|
4678
|
-
},
|
|
4679
|
-
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
4680
|
-
)
|
|
4686
|
+
validationMiddleware
|
|
4681
4687
|
];
|
|
4682
4688
|
}
|
|
4683
4689
|
getValidationProviders() {
|
|
@@ -4708,9 +4714,10 @@ var ValidationController = class {
|
|
|
4708
4714
|
reset() {
|
|
4709
4715
|
this.validations.clear();
|
|
4710
4716
|
this.tracker = void 0;
|
|
4717
|
+
this.validationMiddleware?.reset();
|
|
4711
4718
|
}
|
|
4712
4719
|
onView(view) {
|
|
4713
|
-
this.
|
|
4720
|
+
this.reset();
|
|
4714
4721
|
if (!this.options) {
|
|
4715
4722
|
return;
|
|
4716
4723
|
}
|
|
@@ -5408,8 +5415,8 @@ var NOT_STARTED_STATE = {
|
|
|
5408
5415
|
};
|
|
5409
5416
|
|
|
5410
5417
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
5411
|
-
var PLAYER_VERSION = true ? "0.15.5
|
|
5412
|
-
var COMMIT = true ? "
|
|
5418
|
+
var PLAYER_VERSION = true ? "0.15.5" : "unknown";
|
|
5419
|
+
var COMMIT = true ? "69e4f473071f889133b4c9b8414c092d8587fa53" : "unknown";
|
|
5413
5420
|
var _Player = class _Player {
|
|
5414
5421
|
constructor(config) {
|
|
5415
5422
|
this.logger = new TapableLogger();
|