@player-ui/player 1.1.0-next.0 → 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/index.legacy-esm.js
CHANGED
|
@@ -2628,6 +2628,10 @@ var ValidationMiddleware = class {
|
|
|
2628
2628
|
);
|
|
2629
2629
|
return next?.delete(binding, options);
|
|
2630
2630
|
}
|
|
2631
|
+
/** Clears any invalid values staged in the shadow model */
|
|
2632
|
+
reset() {
|
|
2633
|
+
this.shadowModelPaths.clear();
|
|
2634
|
+
}
|
|
2631
2635
|
};
|
|
2632
2636
|
|
|
2633
2637
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/validator/registry.ts
|
|
@@ -3467,6 +3471,44 @@ var ValidationController = class {
|
|
|
3467
3471
|
}
|
|
3468
3472
|
/** Return the middleware for the data-model to stop propagation of invalid data */
|
|
3469
3473
|
getDataMiddleware() {
|
|
3474
|
+
const validationMiddleware = new ValidationMiddleware(
|
|
3475
|
+
(binding) => {
|
|
3476
|
+
if (!this.options) {
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3479
|
+
this.updateValidationsForBinding(binding, "change", this.options);
|
|
3480
|
+
const strongValidation = this.getValidationForBinding(binding);
|
|
3481
|
+
if (strongValidation?.get()?.severity === "error") {
|
|
3482
|
+
return strongValidation.get();
|
|
3483
|
+
}
|
|
3484
|
+
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
3485
|
+
this.validations.forEach((weakValidation, strongBinding) => {
|
|
3486
|
+
if (caresAboutDataChanges(
|
|
3487
|
+
/* @__PURE__ */ new Set([binding]),
|
|
3488
|
+
weakValidation.weakBindings
|
|
3489
|
+
) && weakValidation?.get()?.severity === "error") {
|
|
3490
|
+
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
3491
|
+
if (weakBinding === strongBinding) {
|
|
3492
|
+
newInvalidBindings.add({
|
|
3493
|
+
binding: weakBinding,
|
|
3494
|
+
isStrong: true
|
|
3495
|
+
});
|
|
3496
|
+
} else {
|
|
3497
|
+
newInvalidBindings.add({
|
|
3498
|
+
binding: weakBinding,
|
|
3499
|
+
isStrong: false
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
});
|
|
3505
|
+
if (newInvalidBindings.size > 0) {
|
|
3506
|
+
return newInvalidBindings;
|
|
3507
|
+
}
|
|
3508
|
+
},
|
|
3509
|
+
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
3510
|
+
);
|
|
3511
|
+
this.validationMiddleware = validationMiddleware;
|
|
3470
3512
|
return [
|
|
3471
3513
|
{
|
|
3472
3514
|
set: (transaction, options, next) => {
|
|
@@ -3483,43 +3525,7 @@ var ValidationController = class {
|
|
|
3483
3525
|
return next?.delete(binding, options);
|
|
3484
3526
|
}
|
|
3485
3527
|
},
|
|
3486
|
-
|
|
3487
|
-
(binding) => {
|
|
3488
|
-
if (!this.options) {
|
|
3489
|
-
return;
|
|
3490
|
-
}
|
|
3491
|
-
this.updateValidationsForBinding(binding, "change", this.options);
|
|
3492
|
-
const strongValidation = this.getValidationForBinding(binding);
|
|
3493
|
-
if (strongValidation?.get()?.severity === "error") {
|
|
3494
|
-
return strongValidation.get();
|
|
3495
|
-
}
|
|
3496
|
-
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
3497
|
-
this.validations.forEach((weakValidation, strongBinding) => {
|
|
3498
|
-
if (caresAboutDataChanges(
|
|
3499
|
-
/* @__PURE__ */ new Set([binding]),
|
|
3500
|
-
weakValidation.weakBindings
|
|
3501
|
-
) && weakValidation?.get()?.severity === "error") {
|
|
3502
|
-
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
3503
|
-
if (weakBinding === strongBinding) {
|
|
3504
|
-
newInvalidBindings.add({
|
|
3505
|
-
binding: weakBinding,
|
|
3506
|
-
isStrong: true
|
|
3507
|
-
});
|
|
3508
|
-
} else {
|
|
3509
|
-
newInvalidBindings.add({
|
|
3510
|
-
binding: weakBinding,
|
|
3511
|
-
isStrong: false
|
|
3512
|
-
});
|
|
3513
|
-
}
|
|
3514
|
-
});
|
|
3515
|
-
}
|
|
3516
|
-
});
|
|
3517
|
-
if (newInvalidBindings.size > 0) {
|
|
3518
|
-
return newInvalidBindings;
|
|
3519
|
-
}
|
|
3520
|
-
},
|
|
3521
|
-
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
3522
|
-
)
|
|
3528
|
+
validationMiddleware
|
|
3523
3529
|
];
|
|
3524
3530
|
}
|
|
3525
3531
|
getValidationProviders() {
|
|
@@ -3550,9 +3556,10 @@ var ValidationController = class {
|
|
|
3550
3556
|
reset() {
|
|
3551
3557
|
this.validations.clear();
|
|
3552
3558
|
this.tracker = void 0;
|
|
3559
|
+
this.validationMiddleware?.reset();
|
|
3553
3560
|
}
|
|
3554
3561
|
onView(view) {
|
|
3555
|
-
this.
|
|
3562
|
+
this.reset();
|
|
3556
3563
|
if (!this.options) {
|
|
3557
3564
|
return;
|
|
3558
3565
|
}
|
|
@@ -5714,8 +5721,8 @@ var NOT_STARTED_STATE = {
|
|
|
5714
5721
|
};
|
|
5715
5722
|
|
|
5716
5723
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
5717
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
5718
|
-
var COMMIT = true ? "
|
|
5724
|
+
var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
|
|
5725
|
+
var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
|
|
5719
5726
|
var _Player = class _Player {
|
|
5720
5727
|
constructor(config) {
|
|
5721
5728
|
this.logger = new TapableLogger();
|
package/dist/index.mjs
CHANGED
|
@@ -2628,6 +2628,10 @@ var ValidationMiddleware = class {
|
|
|
2628
2628
|
);
|
|
2629
2629
|
return next?.delete(binding, options);
|
|
2630
2630
|
}
|
|
2631
|
+
/** Clears any invalid values staged in the shadow model */
|
|
2632
|
+
reset() {
|
|
2633
|
+
this.shadowModelPaths.clear();
|
|
2634
|
+
}
|
|
2631
2635
|
};
|
|
2632
2636
|
|
|
2633
2637
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/validator/registry.ts
|
|
@@ -3467,6 +3471,44 @@ var ValidationController = class {
|
|
|
3467
3471
|
}
|
|
3468
3472
|
/** Return the middleware for the data-model to stop propagation of invalid data */
|
|
3469
3473
|
getDataMiddleware() {
|
|
3474
|
+
const validationMiddleware = new ValidationMiddleware(
|
|
3475
|
+
(binding) => {
|
|
3476
|
+
if (!this.options) {
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3479
|
+
this.updateValidationsForBinding(binding, "change", this.options);
|
|
3480
|
+
const strongValidation = this.getValidationForBinding(binding);
|
|
3481
|
+
if (strongValidation?.get()?.severity === "error") {
|
|
3482
|
+
return strongValidation.get();
|
|
3483
|
+
}
|
|
3484
|
+
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
3485
|
+
this.validations.forEach((weakValidation, strongBinding) => {
|
|
3486
|
+
if (caresAboutDataChanges(
|
|
3487
|
+
/* @__PURE__ */ new Set([binding]),
|
|
3488
|
+
weakValidation.weakBindings
|
|
3489
|
+
) && weakValidation?.get()?.severity === "error") {
|
|
3490
|
+
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
3491
|
+
if (weakBinding === strongBinding) {
|
|
3492
|
+
newInvalidBindings.add({
|
|
3493
|
+
binding: weakBinding,
|
|
3494
|
+
isStrong: true
|
|
3495
|
+
});
|
|
3496
|
+
} else {
|
|
3497
|
+
newInvalidBindings.add({
|
|
3498
|
+
binding: weakBinding,
|
|
3499
|
+
isStrong: false
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
});
|
|
3505
|
+
if (newInvalidBindings.size > 0) {
|
|
3506
|
+
return newInvalidBindings;
|
|
3507
|
+
}
|
|
3508
|
+
},
|
|
3509
|
+
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
3510
|
+
);
|
|
3511
|
+
this.validationMiddleware = validationMiddleware;
|
|
3470
3512
|
return [
|
|
3471
3513
|
{
|
|
3472
3514
|
set: (transaction, options, next) => {
|
|
@@ -3483,43 +3525,7 @@ var ValidationController = class {
|
|
|
3483
3525
|
return next?.delete(binding, options);
|
|
3484
3526
|
}
|
|
3485
3527
|
},
|
|
3486
|
-
|
|
3487
|
-
(binding) => {
|
|
3488
|
-
if (!this.options) {
|
|
3489
|
-
return;
|
|
3490
|
-
}
|
|
3491
|
-
this.updateValidationsForBinding(binding, "change", this.options);
|
|
3492
|
-
const strongValidation = this.getValidationForBinding(binding);
|
|
3493
|
-
if (strongValidation?.get()?.severity === "error") {
|
|
3494
|
-
return strongValidation.get();
|
|
3495
|
-
}
|
|
3496
|
-
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
3497
|
-
this.validations.forEach((weakValidation, strongBinding) => {
|
|
3498
|
-
if (caresAboutDataChanges(
|
|
3499
|
-
/* @__PURE__ */ new Set([binding]),
|
|
3500
|
-
weakValidation.weakBindings
|
|
3501
|
-
) && weakValidation?.get()?.severity === "error") {
|
|
3502
|
-
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
3503
|
-
if (weakBinding === strongBinding) {
|
|
3504
|
-
newInvalidBindings.add({
|
|
3505
|
-
binding: weakBinding,
|
|
3506
|
-
isStrong: true
|
|
3507
|
-
});
|
|
3508
|
-
} else {
|
|
3509
|
-
newInvalidBindings.add({
|
|
3510
|
-
binding: weakBinding,
|
|
3511
|
-
isStrong: false
|
|
3512
|
-
});
|
|
3513
|
-
}
|
|
3514
|
-
});
|
|
3515
|
-
}
|
|
3516
|
-
});
|
|
3517
|
-
if (newInvalidBindings.size > 0) {
|
|
3518
|
-
return newInvalidBindings;
|
|
3519
|
-
}
|
|
3520
|
-
},
|
|
3521
|
-
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
3522
|
-
)
|
|
3528
|
+
validationMiddleware
|
|
3523
3529
|
];
|
|
3524
3530
|
}
|
|
3525
3531
|
getValidationProviders() {
|
|
@@ -3550,9 +3556,10 @@ var ValidationController = class {
|
|
|
3550
3556
|
reset() {
|
|
3551
3557
|
this.validations.clear();
|
|
3552
3558
|
this.tracker = void 0;
|
|
3559
|
+
this.validationMiddleware?.reset();
|
|
3553
3560
|
}
|
|
3554
3561
|
onView(view) {
|
|
3555
|
-
this.
|
|
3562
|
+
this.reset();
|
|
3556
3563
|
if (!this.options) {
|
|
3557
3564
|
return;
|
|
3558
3565
|
}
|
|
@@ -5714,8 +5721,8 @@ var NOT_STARTED_STATE = {
|
|
|
5714
5721
|
};
|
|
5715
5722
|
|
|
5716
5723
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
5717
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
5718
|
-
var COMMIT = true ? "
|
|
5724
|
+
var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
|
|
5725
|
+
var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
|
|
5719
5726
|
var _Player = class _Player {
|
|
5720
5727
|
constructor(config) {
|
|
5721
5728
|
this.logger = new TapableLogger();
|