@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/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
|
|
@@ -4521,6 +4525,44 @@ var ValidationController = class {
|
|
|
4521
4525
|
}
|
|
4522
4526
|
/** Return the middleware for the data-model to stop propagation of invalid data */
|
|
4523
4527
|
getDataMiddleware() {
|
|
4528
|
+
const validationMiddleware = new ValidationMiddleware(
|
|
4529
|
+
(binding) => {
|
|
4530
|
+
if (!this.options) {
|
|
4531
|
+
return;
|
|
4532
|
+
}
|
|
4533
|
+
this.updateValidationsForBinding(binding, "change", this.options);
|
|
4534
|
+
const strongValidation = this.getValidationForBinding(binding);
|
|
4535
|
+
if (strongValidation?.get()?.severity === "error") {
|
|
4536
|
+
return strongValidation.get();
|
|
4537
|
+
}
|
|
4538
|
+
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
4539
|
+
this.validations.forEach((weakValidation, strongBinding) => {
|
|
4540
|
+
if (caresAboutDataChanges(
|
|
4541
|
+
/* @__PURE__ */ new Set([binding]),
|
|
4542
|
+
weakValidation.weakBindings
|
|
4543
|
+
) && weakValidation?.get()?.severity === "error") {
|
|
4544
|
+
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
4545
|
+
if (weakBinding === strongBinding) {
|
|
4546
|
+
newInvalidBindings.add({
|
|
4547
|
+
binding: weakBinding,
|
|
4548
|
+
isStrong: true
|
|
4549
|
+
});
|
|
4550
|
+
} else {
|
|
4551
|
+
newInvalidBindings.add({
|
|
4552
|
+
binding: weakBinding,
|
|
4553
|
+
isStrong: false
|
|
4554
|
+
});
|
|
4555
|
+
}
|
|
4556
|
+
});
|
|
4557
|
+
}
|
|
4558
|
+
});
|
|
4559
|
+
if (newInvalidBindings.size > 0) {
|
|
4560
|
+
return newInvalidBindings;
|
|
4561
|
+
}
|
|
4562
|
+
},
|
|
4563
|
+
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
4564
|
+
);
|
|
4565
|
+
this.validationMiddleware = validationMiddleware;
|
|
4524
4566
|
return [
|
|
4525
4567
|
{
|
|
4526
4568
|
set: (transaction, options, next) => {
|
|
@@ -4537,43 +4579,7 @@ var ValidationController = class {
|
|
|
4537
4579
|
return next?.delete(binding, options);
|
|
4538
4580
|
}
|
|
4539
4581
|
},
|
|
4540
|
-
|
|
4541
|
-
(binding) => {
|
|
4542
|
-
if (!this.options) {
|
|
4543
|
-
return;
|
|
4544
|
-
}
|
|
4545
|
-
this.updateValidationsForBinding(binding, "change", this.options);
|
|
4546
|
-
const strongValidation = this.getValidationForBinding(binding);
|
|
4547
|
-
if (strongValidation?.get()?.severity === "error") {
|
|
4548
|
-
return strongValidation.get();
|
|
4549
|
-
}
|
|
4550
|
-
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
4551
|
-
this.validations.forEach((weakValidation, strongBinding) => {
|
|
4552
|
-
if (caresAboutDataChanges(
|
|
4553
|
-
/* @__PURE__ */ new Set([binding]),
|
|
4554
|
-
weakValidation.weakBindings
|
|
4555
|
-
) && weakValidation?.get()?.severity === "error") {
|
|
4556
|
-
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
4557
|
-
if (weakBinding === strongBinding) {
|
|
4558
|
-
newInvalidBindings.add({
|
|
4559
|
-
binding: weakBinding,
|
|
4560
|
-
isStrong: true
|
|
4561
|
-
});
|
|
4562
|
-
} else {
|
|
4563
|
-
newInvalidBindings.add({
|
|
4564
|
-
binding: weakBinding,
|
|
4565
|
-
isStrong: false
|
|
4566
|
-
});
|
|
4567
|
-
}
|
|
4568
|
-
});
|
|
4569
|
-
}
|
|
4570
|
-
});
|
|
4571
|
-
if (newInvalidBindings.size > 0) {
|
|
4572
|
-
return newInvalidBindings;
|
|
4573
|
-
}
|
|
4574
|
-
},
|
|
4575
|
-
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
4576
|
-
)
|
|
4582
|
+
validationMiddleware
|
|
4577
4583
|
];
|
|
4578
4584
|
}
|
|
4579
4585
|
getValidationProviders() {
|
|
@@ -4604,9 +4610,10 @@ var ValidationController = class {
|
|
|
4604
4610
|
reset() {
|
|
4605
4611
|
this.validations.clear();
|
|
4606
4612
|
this.tracker = void 0;
|
|
4613
|
+
this.validationMiddleware?.reset();
|
|
4607
4614
|
}
|
|
4608
4615
|
onView(view) {
|
|
4609
|
-
this.
|
|
4616
|
+
this.reset();
|
|
4610
4617
|
if (!this.options) {
|
|
4611
4618
|
return;
|
|
4612
4619
|
}
|
|
@@ -5304,8 +5311,8 @@ var NOT_STARTED_STATE = {
|
|
|
5304
5311
|
};
|
|
5305
5312
|
|
|
5306
5313
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
5307
|
-
var PLAYER_VERSION = true ? "0.15.5
|
|
5308
|
-
var COMMIT = true ? "
|
|
5314
|
+
var PLAYER_VERSION = true ? "0.15.5" : "unknown";
|
|
5315
|
+
var COMMIT = true ? "69e4f473071f889133b4c9b8414c092d8587fa53" : "unknown";
|
|
5309
5316
|
var _Player = class _Player {
|
|
5310
5317
|
constructor(config) {
|
|
5311
5318
|
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
|
|
@@ -4521,6 +4525,44 @@ var ValidationController = class {
|
|
|
4521
4525
|
}
|
|
4522
4526
|
/** Return the middleware for the data-model to stop propagation of invalid data */
|
|
4523
4527
|
getDataMiddleware() {
|
|
4528
|
+
const validationMiddleware = new ValidationMiddleware(
|
|
4529
|
+
(binding) => {
|
|
4530
|
+
if (!this.options) {
|
|
4531
|
+
return;
|
|
4532
|
+
}
|
|
4533
|
+
this.updateValidationsForBinding(binding, "change", this.options);
|
|
4534
|
+
const strongValidation = this.getValidationForBinding(binding);
|
|
4535
|
+
if (strongValidation?.get()?.severity === "error") {
|
|
4536
|
+
return strongValidation.get();
|
|
4537
|
+
}
|
|
4538
|
+
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
4539
|
+
this.validations.forEach((weakValidation, strongBinding) => {
|
|
4540
|
+
if (caresAboutDataChanges(
|
|
4541
|
+
/* @__PURE__ */ new Set([binding]),
|
|
4542
|
+
weakValidation.weakBindings
|
|
4543
|
+
) && weakValidation?.get()?.severity === "error") {
|
|
4544
|
+
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
4545
|
+
if (weakBinding === strongBinding) {
|
|
4546
|
+
newInvalidBindings.add({
|
|
4547
|
+
binding: weakBinding,
|
|
4548
|
+
isStrong: true
|
|
4549
|
+
});
|
|
4550
|
+
} else {
|
|
4551
|
+
newInvalidBindings.add({
|
|
4552
|
+
binding: weakBinding,
|
|
4553
|
+
isStrong: false
|
|
4554
|
+
});
|
|
4555
|
+
}
|
|
4556
|
+
});
|
|
4557
|
+
}
|
|
4558
|
+
});
|
|
4559
|
+
if (newInvalidBindings.size > 0) {
|
|
4560
|
+
return newInvalidBindings;
|
|
4561
|
+
}
|
|
4562
|
+
},
|
|
4563
|
+
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
4564
|
+
);
|
|
4565
|
+
this.validationMiddleware = validationMiddleware;
|
|
4524
4566
|
return [
|
|
4525
4567
|
{
|
|
4526
4568
|
set: (transaction, options, next) => {
|
|
@@ -4537,43 +4579,7 @@ var ValidationController = class {
|
|
|
4537
4579
|
return next?.delete(binding, options);
|
|
4538
4580
|
}
|
|
4539
4581
|
},
|
|
4540
|
-
|
|
4541
|
-
(binding) => {
|
|
4542
|
-
if (!this.options) {
|
|
4543
|
-
return;
|
|
4544
|
-
}
|
|
4545
|
-
this.updateValidationsForBinding(binding, "change", this.options);
|
|
4546
|
-
const strongValidation = this.getValidationForBinding(binding);
|
|
4547
|
-
if (strongValidation?.get()?.severity === "error") {
|
|
4548
|
-
return strongValidation.get();
|
|
4549
|
-
}
|
|
4550
|
-
const newInvalidBindings = /* @__PURE__ */ new Set();
|
|
4551
|
-
this.validations.forEach((weakValidation, strongBinding) => {
|
|
4552
|
-
if (caresAboutDataChanges(
|
|
4553
|
-
/* @__PURE__ */ new Set([binding]),
|
|
4554
|
-
weakValidation.weakBindings
|
|
4555
|
-
) && weakValidation?.get()?.severity === "error") {
|
|
4556
|
-
weakValidation?.weakBindings.forEach((weakBinding) => {
|
|
4557
|
-
if (weakBinding === strongBinding) {
|
|
4558
|
-
newInvalidBindings.add({
|
|
4559
|
-
binding: weakBinding,
|
|
4560
|
-
isStrong: true
|
|
4561
|
-
});
|
|
4562
|
-
} else {
|
|
4563
|
-
newInvalidBindings.add({
|
|
4564
|
-
binding: weakBinding,
|
|
4565
|
-
isStrong: false
|
|
4566
|
-
});
|
|
4567
|
-
}
|
|
4568
|
-
});
|
|
4569
|
-
}
|
|
4570
|
-
});
|
|
4571
|
-
if (newInvalidBindings.size > 0) {
|
|
4572
|
-
return newInvalidBindings;
|
|
4573
|
-
}
|
|
4574
|
-
},
|
|
4575
|
-
{ logger: new ProxyLogger(() => this.options?.logger) }
|
|
4576
|
-
)
|
|
4582
|
+
validationMiddleware
|
|
4577
4583
|
];
|
|
4578
4584
|
}
|
|
4579
4585
|
getValidationProviders() {
|
|
@@ -4604,9 +4610,10 @@ var ValidationController = class {
|
|
|
4604
4610
|
reset() {
|
|
4605
4611
|
this.validations.clear();
|
|
4606
4612
|
this.tracker = void 0;
|
|
4613
|
+
this.validationMiddleware?.reset();
|
|
4607
4614
|
}
|
|
4608
4615
|
onView(view) {
|
|
4609
|
-
this.
|
|
4616
|
+
this.reset();
|
|
4610
4617
|
if (!this.options) {
|
|
4611
4618
|
return;
|
|
4612
4619
|
}
|
|
@@ -5304,8 +5311,8 @@ var NOT_STARTED_STATE = {
|
|
|
5304
5311
|
};
|
|
5305
5312
|
|
|
5306
5313
|
// ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
|
|
5307
|
-
var PLAYER_VERSION = true ? "0.15.5
|
|
5308
|
-
var COMMIT = true ? "
|
|
5314
|
+
var PLAYER_VERSION = true ? "0.15.5" : "unknown";
|
|
5315
|
+
var COMMIT = true ? "69e4f473071f889133b4c9b8414c092d8587fa53" : "unknown";
|
|
5309
5316
|
var _Player = class _Player {
|
|
5310
5317
|
constructor(config) {
|
|
5311
5318
|
this.logger = new TapableLogger();
|