@player-ui/player 1.1.0-next.1 → 1.1.0-next.2
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
|
@@ -2739,6 +2739,10 @@ var ValidationMiddleware = class {
|
|
|
2739
2739
|
);
|
|
2740
2740
|
return next?.delete(binding, options);
|
|
2741
2741
|
}
|
|
2742
|
+
/** Clears any invalid values staged in the shadow model */
|
|
2743
|
+
reset() {
|
|
2744
|
+
this.shadowModelPaths.clear();
|
|
2745
|
+
}
|
|
2742
2746
|
};
|
|
2743
2747
|
|
|
2744
2748
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/validator/registry.ts
|
|
@@ -3578,6 +3582,44 @@ var ValidationController = class {
|
|
|
3578
3582
|
}
|
|
3579
3583
|
/** Return the middleware for the data-model to stop propagation of invalid data */
|
|
3580
3584
|
getDataMiddleware() {
|
|
3585
|
+
const validationMiddleware = new ValidationMiddleware(
|
|
3586
|
+
(binding) => {
|
|
3587
|
+
if (!this.options) {
|
|
3588
|
+
return;
|
|
3589
|
+
}
|
|
3590
|
+
this.updateValidationsForBinding(binding, "change", this.options);
|
|
3591
|
+
const strongValidation = this.getValidationForBinding(binding);
|
|
3592
|
+
if (strongValidation?.get()?.severity === "error") {
|
|
3593
|
+
return strongValidation.get();
|
|
3594
|
+
}
|
|
3595
|
+
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
3596
|
+
this.validations.forEach((weakValidation, strongBinding) => {
|
|
3597
|
+
if (caresAboutDataChanges(
|
|
3598
|
+
/* @__PURE__ */ new Set([binding]),
|
|
3599
|
+
weakValidation.weakBindings
|
|
3600
|
+
) && weakValidation?.get()?.severity === "error") {
|
|
3601
|
+
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
3602
|
+
if (weakBinding === strongBinding) {
|
|
3603
|
+
newInvalidBindings.add({
|
|
3604
|
+
binding: weakBinding,
|
|
3605
|
+
isStrong: true
|
|
3606
|
+
});
|
|
3607
|
+
} else {
|
|
3608
|
+
newInvalidBindings.add({
|
|
3609
|
+
binding: weakBinding,
|
|
3610
|
+
isStrong: false
|
|
3611
|
+
});
|
|
3612
|
+
}
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3615
|
+
});
|
|
3616
|
+
if (newInvalidBindings.size > 0) {
|
|
3617
|
+
return newInvalidBindings;
|
|
3618
|
+
}
|
|
3619
|
+
},
|
|
3620
|
+
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
3621
|
+
);
|
|
3622
|
+
this.validationMiddleware = validationMiddleware;
|
|
3581
3623
|
return [
|
|
3582
3624
|
{
|
|
3583
3625
|
set: (transaction, options, next) => {
|
|
@@ -3594,43 +3636,7 @@ var ValidationController = class {
|
|
|
3594
3636
|
return next?.delete(binding, options);
|
|
3595
3637
|
}
|
|
3596
3638
|
},
|
|
3597
|
-
|
|
3598
|
-
(binding) => {
|
|
3599
|
-
if (!this.options) {
|
|
3600
|
-
return;
|
|
3601
|
-
}
|
|
3602
|
-
this.updateValidationsForBinding(binding, "change", this.options);
|
|
3603
|
-
const strongValidation = this.getValidationForBinding(binding);
|
|
3604
|
-
if (strongValidation?.get()?.severity === "error") {
|
|
3605
|
-
return strongValidation.get();
|
|
3606
|
-
}
|
|
3607
|
-
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
3608
|
-
this.validations.forEach((weakValidation, strongBinding) => {
|
|
3609
|
-
if (caresAboutDataChanges(
|
|
3610
|
-
/* @__PURE__ */ new Set([binding]),
|
|
3611
|
-
weakValidation.weakBindings
|
|
3612
|
-
) && weakValidation?.get()?.severity === "error") {
|
|
3613
|
-
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
3614
|
-
if (weakBinding === strongBinding) {
|
|
3615
|
-
newInvalidBindings.add({
|
|
3616
|
-
binding: weakBinding,
|
|
3617
|
-
isStrong: true
|
|
3618
|
-
});
|
|
3619
|
-
} else {
|
|
3620
|
-
newInvalidBindings.add({
|
|
3621
|
-
binding: weakBinding,
|
|
3622
|
-
isStrong: false
|
|
3623
|
-
});
|
|
3624
|
-
}
|
|
3625
|
-
});
|
|
3626
|
-
}
|
|
3627
|
-
});
|
|
3628
|
-
if (newInvalidBindings.size > 0) {
|
|
3629
|
-
return newInvalidBindings;
|
|
3630
|
-
}
|
|
3631
|
-
},
|
|
3632
|
-
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
3633
|
-
)
|
|
3639
|
+
validationMiddleware
|
|
3634
3640
|
];
|
|
3635
3641
|
}
|
|
3636
3642
|
getValidationProviders() {
|
|
@@ -3661,9 +3667,10 @@ var ValidationController = class {
|
|
|
3661
3667
|
reset() {
|
|
3662
3668
|
this.validations.clear();
|
|
3663
3669
|
this.tracker = void 0;
|
|
3670
|
+
this.validationMiddleware?.reset();
|
|
3664
3671
|
}
|
|
3665
3672
|
onView(view) {
|
|
3666
|
-
this.
|
|
3673
|
+
this.reset();
|
|
3667
3674
|
if (!this.options) {
|
|
3668
3675
|
return;
|
|
3669
3676
|
}
|
|
@@ -5825,8 +5832,8 @@ var NOT_STARTED_STATE = {
|
|
|
5825
5832
|
};
|
|
5826
5833
|
|
|
5827
5834
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
5828
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
5829
|
-
var COMMIT = true ? "
|
|
5835
|
+
var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
|
|
5836
|
+
var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
|
|
5830
5837
|
var _Player = class _Player {
|
|
5831
5838
|
constructor(config) {
|
|
5832
5839
|
this.logger = new TapableLogger();
|