@micro-lc/preview 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/package.json +4 -4
- package/website/assets/index-b0a6eac8.js +15 -0
- package/website/development/assets/{index-255e36a6.js → index-d5aaa491.js} +241 -155
- package/website/development/index.html +1 -1
- package/website/development/manifest.json +4 -4
- package/website/index.html +1 -1
- package/website/manifest.json +4 -4
- package/website/assets/index-c7368f38.js +0 -15
@@ -2911,7 +2911,7 @@ var Subscription = function() {
|
|
2911
2911
|
this._finalizers = null;
|
2912
2912
|
}
|
2913
2913
|
Subscription2.prototype.unsubscribe = function() {
|
2914
|
-
var e_1,
|
2914
|
+
var e_1, _a2, e_2, _b;
|
2915
2915
|
var errors;
|
2916
2916
|
if (!this.closed) {
|
2917
2917
|
this.closed = true;
|
@@ -2928,8 +2928,8 @@ var Subscription = function() {
|
|
2928
2928
|
e_1 = { error: e_1_1 };
|
2929
2929
|
} finally {
|
2930
2930
|
try {
|
2931
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (
|
2932
|
-
|
2931
|
+
if (_parentage_1_1 && !_parentage_1_1.done && (_a2 = _parentage_1.return))
|
2932
|
+
_a2.call(_parentage_1);
|
2933
2933
|
} finally {
|
2934
2934
|
if (e_1)
|
2935
2935
|
throw e_1.error;
|
@@ -2982,7 +2982,7 @@ var Subscription = function() {
|
|
2982
2982
|
}
|
2983
2983
|
};
|
2984
2984
|
Subscription2.prototype.add = function(teardown) {
|
2985
|
-
var
|
2985
|
+
var _a2;
|
2986
2986
|
if (teardown && teardown !== this) {
|
2987
2987
|
if (this.closed) {
|
2988
2988
|
execFinalizer(teardown);
|
@@ -2993,7 +2993,7 @@ var Subscription = function() {
|
|
2993
2993
|
}
|
2994
2994
|
teardown._addParent(this);
|
2995
2995
|
}
|
2996
|
-
(this._finalizers = (
|
2996
|
+
(this._finalizers = (_a2 = this._finalizers) !== null && _a2 !== void 0 ? _a2 : []).push(teardown);
|
2997
2997
|
}
|
2998
2998
|
}
|
2999
2999
|
};
|
@@ -3267,7 +3267,7 @@ var Observable = function() {
|
|
3267
3267
|
var _this = this;
|
3268
3268
|
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error2, complete);
|
3269
3269
|
errorContext(function() {
|
3270
|
-
var
|
3270
|
+
var _a2 = _this, operator = _a2.operator, source = _a2.source;
|
3271
3271
|
subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
|
3272
3272
|
});
|
3273
3273
|
return subscriber;
|
@@ -3299,8 +3299,8 @@ var Observable = function() {
|
|
3299
3299
|
});
|
3300
3300
|
};
|
3301
3301
|
Observable2.prototype._subscribe = function(subscriber) {
|
3302
|
-
var
|
3303
|
-
return (
|
3302
|
+
var _a2;
|
3303
|
+
return (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber);
|
3304
3304
|
};
|
3305
3305
|
Observable2.prototype[observable] = function() {
|
3306
3306
|
return this;
|
@@ -3332,8 +3332,8 @@ var Observable = function() {
|
|
3332
3332
|
return Observable2;
|
3333
3333
|
}();
|
3334
3334
|
function getPromiseCtor(promiseCtor) {
|
3335
|
-
var
|
3336
|
-
return (
|
3335
|
+
var _a2;
|
3336
|
+
return (_a2 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a2 !== void 0 ? _a2 : Promise;
|
3337
3337
|
}
|
3338
3338
|
function isObserver(value) {
|
3339
3339
|
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
@@ -3395,11 +3395,11 @@ var OperatorSubscriber = function(_super) {
|
|
3395
3395
|
return _this;
|
3396
3396
|
}
|
3397
3397
|
OperatorSubscriber2.prototype.unsubscribe = function() {
|
3398
|
-
var
|
3398
|
+
var _a2;
|
3399
3399
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
3400
3400
|
var closed_1 = this.closed;
|
3401
3401
|
_super.prototype.unsubscribe.call(this);
|
3402
|
-
!closed_1 && ((
|
3402
|
+
!closed_1 && ((_a2 = this.onFinalize) === null || _a2 === void 0 ? void 0 : _a2.call(this));
|
3403
3403
|
}
|
3404
3404
|
};
|
3405
3405
|
return OperatorSubscriber2;
|
@@ -3436,7 +3436,7 @@ var Subject = function(_super) {
|
|
3436
3436
|
Subject2.prototype.next = function(value) {
|
3437
3437
|
var _this = this;
|
3438
3438
|
errorContext(function() {
|
3439
|
-
var e_1,
|
3439
|
+
var e_1, _a2;
|
3440
3440
|
_this._throwIfClosed();
|
3441
3441
|
if (!_this.isStopped) {
|
3442
3442
|
if (!_this.currentObservers) {
|
@@ -3451,8 +3451,8 @@ var Subject = function(_super) {
|
|
3451
3451
|
e_1 = { error: e_1_1 };
|
3452
3452
|
} finally {
|
3453
3453
|
try {
|
3454
|
-
if (_c && !_c.done && (
|
3455
|
-
|
3454
|
+
if (_c && !_c.done && (_a2 = _b.return))
|
3455
|
+
_a2.call(_b);
|
3456
3456
|
} finally {
|
3457
3457
|
if (e_1)
|
3458
3458
|
throw e_1.error;
|
@@ -3494,8 +3494,8 @@ var Subject = function(_super) {
|
|
3494
3494
|
};
|
3495
3495
|
Object.defineProperty(Subject2.prototype, "observed", {
|
3496
3496
|
get: function() {
|
3497
|
-
var
|
3498
|
-
return ((
|
3497
|
+
var _a2;
|
3498
|
+
return ((_a2 = this.observers) === null || _a2 === void 0 ? void 0 : _a2.length) > 0;
|
3499
3499
|
},
|
3500
3500
|
enumerable: false,
|
3501
3501
|
configurable: true
|
@@ -3511,7 +3511,7 @@ var Subject = function(_super) {
|
|
3511
3511
|
};
|
3512
3512
|
Subject2.prototype._innerSubscribe = function(subscriber) {
|
3513
3513
|
var _this = this;
|
3514
|
-
var
|
3514
|
+
var _a2 = this, hasError = _a2.hasError, isStopped = _a2.isStopped, observers = _a2.observers;
|
3515
3515
|
if (hasError || isStopped) {
|
3516
3516
|
return EMPTY_SUBSCRIPTION;
|
3517
3517
|
}
|
@@ -3523,7 +3523,7 @@ var Subject = function(_super) {
|
|
3523
3523
|
});
|
3524
3524
|
};
|
3525
3525
|
Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
|
3526
|
-
var
|
3526
|
+
var _a2 = this, hasError = _a2.hasError, thrownError = _a2.thrownError, isStopped = _a2.isStopped;
|
3527
3527
|
if (hasError) {
|
3528
3528
|
subscriber.error(thrownError);
|
3529
3529
|
} else if (isStopped) {
|
@@ -3549,20 +3549,20 @@ var AnonymousSubject = function(_super) {
|
|
3549
3549
|
return _this;
|
3550
3550
|
}
|
3551
3551
|
AnonymousSubject2.prototype.next = function(value) {
|
3552
|
-
var
|
3553
|
-
(_b = (
|
3552
|
+
var _a2, _b;
|
3553
|
+
(_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.next) === null || _b === void 0 ? void 0 : _b.call(_a2, value);
|
3554
3554
|
};
|
3555
3555
|
AnonymousSubject2.prototype.error = function(err) {
|
3556
|
-
var
|
3557
|
-
(_b = (
|
3556
|
+
var _a2, _b;
|
3557
|
+
(_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.error) === null || _b === void 0 ? void 0 : _b.call(_a2, err);
|
3558
3558
|
};
|
3559
3559
|
AnonymousSubject2.prototype.complete = function() {
|
3560
|
-
var
|
3561
|
-
(_b = (
|
3560
|
+
var _a2, _b;
|
3561
|
+
(_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.complete) === null || _b === void 0 ? void 0 : _b.call(_a2);
|
3562
3562
|
};
|
3563
3563
|
AnonymousSubject2.prototype._subscribe = function(subscriber) {
|
3564
|
-
var
|
3565
|
-
return (_b = (
|
3564
|
+
var _a2, _b;
|
3565
|
+
return (_b = (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
3566
3566
|
};
|
3567
3567
|
return AnonymousSubject2;
|
3568
3568
|
}(Subject);
|
@@ -3586,7 +3586,7 @@ var BehaviorSubject = function(_super) {
|
|
3586
3586
|
return subscription;
|
3587
3587
|
};
|
3588
3588
|
BehaviorSubject2.prototype.getValue = function() {
|
3589
|
-
var
|
3589
|
+
var _a2 = this, hasError = _a2.hasError, thrownError = _a2.thrownError, _value = _a2._value;
|
3590
3590
|
if (hasError) {
|
3591
3591
|
throw thrownError;
|
3592
3592
|
}
|
@@ -3628,7 +3628,7 @@ var ReplaySubject = function(_super) {
|
|
3628
3628
|
return _this;
|
3629
3629
|
}
|
3630
3630
|
ReplaySubject2.prototype.next = function(value) {
|
3631
|
-
var
|
3631
|
+
var _a2 = this, isStopped = _a2.isStopped, _buffer = _a2._buffer, _infiniteTimeWindow = _a2._infiniteTimeWindow, _timestampProvider = _a2._timestampProvider, _windowTime = _a2._windowTime;
|
3632
3632
|
if (!isStopped) {
|
3633
3633
|
_buffer.push(value);
|
3634
3634
|
!_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
|
@@ -3640,7 +3640,7 @@ var ReplaySubject = function(_super) {
|
|
3640
3640
|
this._throwIfClosed();
|
3641
3641
|
this._trimBuffer();
|
3642
3642
|
var subscription = this._innerSubscribe(subscriber);
|
3643
|
-
var
|
3643
|
+
var _a2 = this, _infiniteTimeWindow = _a2._infiniteTimeWindow, _buffer = _a2._buffer;
|
3644
3644
|
var copy = _buffer.slice();
|
3645
3645
|
for (var i2 = 0; i2 < copy.length && !subscriber.closed; i2 += _infiniteTimeWindow ? 1 : 2) {
|
3646
3646
|
subscriber.next(copy[i2]);
|
@@ -3649,7 +3649,7 @@ var ReplaySubject = function(_super) {
|
|
3649
3649
|
return subscription;
|
3650
3650
|
};
|
3651
3651
|
ReplaySubject2.prototype._trimBuffer = function() {
|
3652
|
-
var
|
3652
|
+
var _a2 = this, _bufferSize = _a2._bufferSize, _timestampProvider = _a2._timestampProvider, _buffer = _a2._buffer, _infiniteTimeWindow = _a2._infiniteTimeWindow;
|
3653
3653
|
var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
|
3654
3654
|
_bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
|
3655
3655
|
if (!_infiniteTimeWindow) {
|
@@ -3701,7 +3701,7 @@ var AsyncAction = function(_super) {
|
|
3701
3701
|
return _this;
|
3702
3702
|
}
|
3703
3703
|
AsyncAction2.prototype.schedule = function(state, delay) {
|
3704
|
-
var
|
3704
|
+
var _a2;
|
3705
3705
|
if (delay === void 0) {
|
3706
3706
|
delay = 0;
|
3707
3707
|
}
|
@@ -3716,7 +3716,7 @@ var AsyncAction = function(_super) {
|
|
3716
3716
|
}
|
3717
3717
|
this.pending = true;
|
3718
3718
|
this.delay = delay;
|
3719
|
-
this.id = (
|
3719
|
+
this.id = (_a2 = this.id) !== null && _a2 !== void 0 ? _a2 : this.requestAsyncId(scheduler, this.id, delay);
|
3720
3720
|
return this;
|
3721
3721
|
};
|
3722
3722
|
AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay) {
|
@@ -3765,7 +3765,7 @@ var AsyncAction = function(_super) {
|
|
3765
3765
|
};
|
3766
3766
|
AsyncAction2.prototype.unsubscribe = function() {
|
3767
3767
|
if (!this.closed) {
|
3768
|
-
var
|
3768
|
+
var _a2 = this, id = _a2.id, scheduler = _a2.scheduler;
|
3769
3769
|
var actions = scheduler.actions;
|
3770
3770
|
this.work = this.state = this.scheduler = null;
|
3771
3771
|
this.pending = false;
|
@@ -3831,6 +3831,7 @@ var AsyncScheduler = function(_super) {
|
|
3831
3831
|
return AsyncScheduler2;
|
3832
3832
|
}(Scheduler);
|
3833
3833
|
var asyncScheduler = new AsyncScheduler(AsyncAction);
|
3834
|
+
var async = asyncScheduler;
|
3834
3835
|
var EMPTY = new Observable(function(subscriber) {
|
3835
3836
|
return subscriber.complete();
|
3836
3837
|
});
|
@@ -3870,7 +3871,7 @@ function isIterable(input) {
|
|
3870
3871
|
}
|
3871
3872
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
3872
3873
|
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
3873
|
-
var reader,
|
3874
|
+
var reader, _a2, value, done;
|
3874
3875
|
return __generator(this, function(_b) {
|
3875
3876
|
switch (_b.label) {
|
3876
3877
|
case 0:
|
@@ -3882,7 +3883,7 @@ function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
3882
3883
|
case 2:
|
3883
3884
|
return [4, __await(reader.read())];
|
3884
3885
|
case 3:
|
3885
|
-
|
3886
|
+
_a2 = _b.sent(), value = _a2.value, done = _a2.done;
|
3886
3887
|
if (!done)
|
3887
3888
|
return [3, 5];
|
3888
3889
|
return [4, __await(void 0)];
|
@@ -3966,7 +3967,7 @@ function fromPromise(promise) {
|
|
3966
3967
|
}
|
3967
3968
|
function fromIterable(iterable) {
|
3968
3969
|
return new Observable(function(subscriber) {
|
3969
|
-
var e_1,
|
3970
|
+
var e_1, _a2;
|
3970
3971
|
try {
|
3971
3972
|
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
3972
3973
|
var value = iterable_1_1.value;
|
@@ -3979,8 +3980,8 @@ function fromIterable(iterable) {
|
|
3979
3980
|
e_1 = { error: e_1_1 };
|
3980
3981
|
} finally {
|
3981
3982
|
try {
|
3982
|
-
if (iterable_1_1 && !iterable_1_1.done && (
|
3983
|
-
|
3983
|
+
if (iterable_1_1 && !iterable_1_1.done && (_a2 = iterable_1.return))
|
3984
|
+
_a2.call(iterable_1);
|
3984
3985
|
} finally {
|
3985
3986
|
if (e_1)
|
3986
3987
|
throw e_1.error;
|
@@ -4001,7 +4002,7 @@ function fromReadableStreamLike(readableStream) {
|
|
4001
4002
|
}
|
4002
4003
|
function process(asyncIterable, subscriber) {
|
4003
4004
|
var asyncIterable_1, asyncIterable_1_1;
|
4004
|
-
var e_2,
|
4005
|
+
var e_2, _a2;
|
4005
4006
|
return __awaiter(this, void 0, void 0, function() {
|
4006
4007
|
var value, e_2_1;
|
4007
4008
|
return __generator(this, function(_b) {
|
@@ -4031,9 +4032,9 @@ function process(asyncIterable, subscriber) {
|
|
4031
4032
|
return [3, 11];
|
4032
4033
|
case 6:
|
4033
4034
|
_b.trys.push([6, , 9, 10]);
|
4034
|
-
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (
|
4035
|
+
if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a2 = asyncIterable_1.return)))
|
4035
4036
|
return [3, 8];
|
4036
|
-
return [4,
|
4037
|
+
return [4, _a2.call(asyncIterable_1)];
|
4037
4038
|
case 7:
|
4038
4039
|
_b.sent();
|
4039
4040
|
_b.label = 8;
|
@@ -4129,11 +4130,11 @@ function scheduleIterable(input, scheduler) {
|
|
4129
4130
|
executeSchedule(subscriber, scheduler, function() {
|
4130
4131
|
iterator$1 = input[iterator]();
|
4131
4132
|
executeSchedule(subscriber, scheduler, function() {
|
4132
|
-
var
|
4133
|
+
var _a2;
|
4133
4134
|
var value;
|
4134
4135
|
var done;
|
4135
4136
|
try {
|
4136
|
-
|
4137
|
+
_a2 = iterator$1.next(), value = _a2.value, done = _a2.done;
|
4137
4138
|
} catch (err) {
|
4138
4139
|
subscriber.error(err);
|
4139
4140
|
return;
|
@@ -4236,6 +4237,9 @@ function lastValueFrom(source, config2) {
|
|
4236
4237
|
});
|
4237
4238
|
});
|
4238
4239
|
}
|
4240
|
+
function isValidDate(value) {
|
4241
|
+
return value instanceof Date && !isNaN(value);
|
4242
|
+
}
|
4239
4243
|
function map(project, thisArg) {
|
4240
4244
|
return operate(function(source, subscriber) {
|
4241
4245
|
var index = 0;
|
@@ -4319,6 +4323,39 @@ function mergeMap(project, resultSelector, concurrent) {
|
|
4319
4323
|
return mergeInternals(source, subscriber, project, concurrent);
|
4320
4324
|
});
|
4321
4325
|
}
|
4326
|
+
function timer(dueTime, intervalOrScheduler, scheduler) {
|
4327
|
+
if (dueTime === void 0) {
|
4328
|
+
dueTime = 0;
|
4329
|
+
}
|
4330
|
+
if (scheduler === void 0) {
|
4331
|
+
scheduler = async;
|
4332
|
+
}
|
4333
|
+
var intervalDuration = -1;
|
4334
|
+
if (intervalOrScheduler != null) {
|
4335
|
+
if (isScheduler(intervalOrScheduler)) {
|
4336
|
+
scheduler = intervalOrScheduler;
|
4337
|
+
} else {
|
4338
|
+
intervalDuration = intervalOrScheduler;
|
4339
|
+
}
|
4340
|
+
}
|
4341
|
+
return new Observable(function(subscriber) {
|
4342
|
+
var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
4343
|
+
if (due < 0) {
|
4344
|
+
due = 0;
|
4345
|
+
}
|
4346
|
+
var n2 = 0;
|
4347
|
+
return scheduler.schedule(function() {
|
4348
|
+
if (!subscriber.closed) {
|
4349
|
+
subscriber.next(n2++);
|
4350
|
+
if (0 <= intervalDuration) {
|
4351
|
+
this.schedule(void 0, intervalDuration);
|
4352
|
+
} else {
|
4353
|
+
subscriber.complete();
|
4354
|
+
}
|
4355
|
+
}
|
4356
|
+
}, due);
|
4357
|
+
});
|
4358
|
+
}
|
4322
4359
|
function filter(predicate, thisArg) {
|
4323
4360
|
return operate(function(source, subscriber) {
|
4324
4361
|
var index = 0;
|
@@ -4328,12 +4365,12 @@ function filter(predicate, thisArg) {
|
|
4328
4365
|
});
|
4329
4366
|
}
|
4330
4367
|
function bufferTime(bufferTimeSpan) {
|
4331
|
-
var
|
4368
|
+
var _a2, _b;
|
4332
4369
|
var otherArgs = [];
|
4333
4370
|
for (var _i = 1; _i < arguments.length; _i++) {
|
4334
4371
|
otherArgs[_i - 1] = arguments[_i];
|
4335
4372
|
}
|
4336
|
-
var scheduler = (
|
4373
|
+
var scheduler = (_a2 = popScheduler(otherArgs)) !== null && _a2 !== void 0 ? _a2 : asyncScheduler;
|
4337
4374
|
var bufferCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
|
4338
4375
|
var maxBufferSize = otherArgs[1] || Infinity;
|
4339
4376
|
return operate(function(source, subscriber) {
|
@@ -4368,7 +4405,7 @@ function bufferTime(bufferTimeSpan) {
|
|
4368
4405
|
}
|
4369
4406
|
startBuffer();
|
4370
4407
|
var bufferTimeSubscriber = createOperatorSubscriber(subscriber, function(value) {
|
4371
|
-
var e_1,
|
4408
|
+
var e_1, _a3;
|
4372
4409
|
var recordsCopy = bufferRecords.slice();
|
4373
4410
|
try {
|
4374
4411
|
for (var recordsCopy_1 = __values(recordsCopy), recordsCopy_1_1 = recordsCopy_1.next(); !recordsCopy_1_1.done; recordsCopy_1_1 = recordsCopy_1.next()) {
|
@@ -4381,8 +4418,8 @@ function bufferTime(bufferTimeSpan) {
|
|
4381
4418
|
e_1 = { error: e_1_1 };
|
4382
4419
|
} finally {
|
4383
4420
|
try {
|
4384
|
-
if (recordsCopy_1_1 && !recordsCopy_1_1.done && (
|
4385
|
-
|
4421
|
+
if (recordsCopy_1_1 && !recordsCopy_1_1.done && (_a3 = recordsCopy_1.return))
|
4422
|
+
_a3.call(recordsCopy_1);
|
4386
4423
|
} finally {
|
4387
4424
|
if (e_1)
|
4388
4425
|
throw e_1.error;
|
@@ -4428,6 +4465,37 @@ function pairwise() {
|
|
4428
4465
|
}));
|
4429
4466
|
});
|
4430
4467
|
}
|
4468
|
+
const DEFAULT_LANGUAGE = "en";
|
4469
|
+
const localizeText = (input, lang = DEFAULT_LANGUAGE) => {
|
4470
|
+
if (typeof input === "string") {
|
4471
|
+
return input;
|
4472
|
+
}
|
4473
|
+
return input == null ? void 0 : input[lang];
|
4474
|
+
};
|
4475
|
+
function translateObject(obj) {
|
4476
|
+
return Object.entries(obj).reduce((out, [key, value]) => {
|
4477
|
+
out[key] = localizeText(value);
|
4478
|
+
return out;
|
4479
|
+
}, {});
|
4480
|
+
}
|
4481
|
+
const noop = (..._args) => {
|
4482
|
+
};
|
4483
|
+
const toArray$1 = (input) => Array.isArray(input) ? input : [input];
|
4484
|
+
const urlMakerFactory = ({ document: { baseURI }, location: { href } }) => (input) => new URL(input, new URL(baseURI, href));
|
4485
|
+
const toURL = (urlMaker, info) => {
|
4486
|
+
let url = info;
|
4487
|
+
if (!(info instanceof URL)) {
|
4488
|
+
url = urlMaker(typeof info === "string" ? info : info.url);
|
4489
|
+
}
|
4490
|
+
return url;
|
4491
|
+
};
|
4492
|
+
const trimLocationOrigin = (origin, url) => {
|
4493
|
+
const { href, origin: linkOrigin } = url;
|
4494
|
+
if (origin === linkOrigin) {
|
4495
|
+
return href.substring(origin.length);
|
4496
|
+
}
|
4497
|
+
return href;
|
4498
|
+
};
|
4431
4499
|
const getElement = (document2, context, nth = 0) => {
|
4432
4500
|
const { selectors } = context;
|
4433
4501
|
return document2.querySelector(selectors[nth]);
|
@@ -4440,11 +4508,13 @@ const unfocus = (element, map2) => {
|
|
4440
4508
|
if (originalStyle) {
|
4441
4509
|
const { css, rest, subscription } = originalStyle;
|
4442
4510
|
rest.forEach((el) => {
|
4443
|
-
var
|
4444
|
-
return (
|
4511
|
+
var _a2;
|
4512
|
+
return (_a2 = el.__unfocus_handler) == null ? void 0 : _a2.call(el);
|
4445
4513
|
});
|
4446
4514
|
subscription.unsubscribe();
|
4447
|
-
|
4515
|
+
originalStyle.elementToFocus.forEach((el, idx) => {
|
4516
|
+
Object.assign(el.style, css[idx]);
|
4517
|
+
});
|
4448
4518
|
}
|
4449
4519
|
map2.delete(element);
|
4450
4520
|
};
|
@@ -4452,34 +4522,44 @@ function focus(document2, obs$, mode$) {
|
|
4452
4522
|
const stylesMap = /* @__PURE__ */ new Map();
|
4453
4523
|
const getBySelector = getElementBySelector.bind(document2);
|
4454
4524
|
const subscription = obs$.pipe(pairwise()).subscribe(([current, next]) => {
|
4455
|
-
var
|
4525
|
+
var _a2, _b, _c;
|
4456
4526
|
if (current !== void 0) {
|
4457
4527
|
const prev = getElement(document2, current);
|
4458
4528
|
if (prev !== null) {
|
4459
|
-
(
|
4529
|
+
(_a2 = prev.__unfocus_handler) == null ? void 0 : _a2.call(prev);
|
4460
4530
|
unfocus(prev, stylesMap);
|
4461
4531
|
}
|
4462
4532
|
}
|
4463
4533
|
if (next !== void 0) {
|
4464
4534
|
const [first, ...rest] = next.selectors;
|
4465
4535
|
const otherElements = rest.reduce((arr, selector) => {
|
4466
|
-
var
|
4536
|
+
var _a22;
|
4467
4537
|
const el = getBySelector(selector);
|
4468
|
-
|
4469
|
-
|
4538
|
+
if (el) {
|
4539
|
+
arr.push(el);
|
4540
|
+
(_a22 = el.__focus_handler) == null ? void 0 : _a22.call(el);
|
4541
|
+
}
|
4470
4542
|
return arr;
|
4471
4543
|
}, []);
|
4472
4544
|
const firstElement = getBySelector(first);
|
4473
|
-
|
4545
|
+
if (firstElement === null) {
|
4546
|
+
return;
|
4547
|
+
}
|
4548
|
+
const elementToFocus = toArray$1((_c = (_b = firstElement.__focus_handler) == null ? void 0 : _b.call(firstElement)) != null ? _c : firstElement);
|
4474
4549
|
const cssKeys = Object.keys(next.style);
|
4475
4550
|
const stylePendingChanges = new Subscription();
|
4476
|
-
const initialStyles = { css:
|
4551
|
+
const initialStyles = { css: [], elementToFocus, rest: otherElements, subscription: stylePendingChanges };
|
4477
4552
|
const styles = cssKeys.reduce((acc, key) => {
|
4478
|
-
|
4553
|
+
elementToFocus.forEach((el, idx) => {
|
4554
|
+
var _a22;
|
4555
|
+
acc.css[idx] = Object.assign((_a22 = acc.css[idx]) != null ? _a22 : {}, { [key]: el.style[key] });
|
4556
|
+
});
|
4479
4557
|
return acc;
|
4480
4558
|
}, initialStyles);
|
4481
4559
|
stylePendingChanges.add(mode$.pipe(filter((val) => val === "select"), take(1)).subscribe(() => {
|
4482
|
-
|
4560
|
+
elementToFocus.forEach((el) => {
|
4561
|
+
Object.assign(el.style, next.style);
|
4562
|
+
});
|
4483
4563
|
}));
|
4484
4564
|
stylesMap.set(firstElement, styles);
|
4485
4565
|
}
|
@@ -4704,9 +4784,9 @@ class PostChannel {
|
|
4704
4784
|
send(to, message, origin = "*") {
|
4705
4785
|
this.__window !== to && this.postMessage(to, message, origin);
|
4706
4786
|
}
|
4707
|
-
recv(window2) {
|
4708
|
-
const listener2 = ({ data }) => {
|
4709
|
-
if (isInstanceMessage(data, this.__instance)) {
|
4787
|
+
recv(window2, from2 = null) {
|
4788
|
+
const listener2 = ({ data, source }) => {
|
4789
|
+
if ((from2 === null || source === from2) && isInstanceMessage(data, this.__instance)) {
|
4710
4790
|
const message = unsign(this.__instance, data);
|
4711
4791
|
this.__handler(message);
|
4712
4792
|
}
|
@@ -5029,12 +5109,12 @@ function interpolate(variables, extra = {}) {
|
|
5029
5109
|
return acc;
|
5030
5110
|
}, []);
|
5031
5111
|
}
|
5032
|
-
function toArray
|
5112
|
+
function toArray(input) {
|
5033
5113
|
return Array.isArray(input) ? input : [input];
|
5034
5114
|
}
|
5035
5115
|
function parseSources(sources) {
|
5036
5116
|
const arrayOrObject = typeof sources === "string" ? [sources] : sources;
|
5037
|
-
return Array.isArray(arrayOrObject) ? arrayOrObject : toArray
|
5117
|
+
return Array.isArray(arrayOrObject) ? arrayOrObject : toArray(arrayOrObject.uris);
|
5038
5118
|
}
|
5039
5119
|
const voidTags = [
|
5040
5120
|
"area",
|
@@ -5084,14 +5164,14 @@ function parseContent(buffer, content, extraProperties) {
|
|
5084
5164
|
acc.push(`${name}="${value}"`);
|
5085
5165
|
return acc;
|
5086
5166
|
}, []);
|
5087
|
-
const initialTagBooleanAttributes = toArray
|
5167
|
+
const initialTagBooleanAttributes = toArray(booleanAttributes);
|
5088
5168
|
const { override, props } = Object.entries(properties).reduce((acc, [key, value]) => {
|
5089
5169
|
extraProperties.has(key) ? typeof value === "string" && (acc.override[key] = value) : acc.props[key] = value;
|
5090
5170
|
return acc;
|
5091
5171
|
}, { override: {}, props: {} });
|
5092
5172
|
const initialTagExtraProperties = Array.from(extraProperties.keys()).map((prop) => {
|
5093
|
-
var
|
5094
|
-
return `.${prop}=\${${(
|
5173
|
+
var _a2;
|
5174
|
+
return `.${prop}=\${${(_a2 = override[prop]) != null ? _a2 : prop}}`;
|
5095
5175
|
});
|
5096
5176
|
const initialTagProperties = Object.entries(props).reduce((acc, [name, value]) => {
|
5097
5177
|
switch (typeof value) {
|
@@ -5379,13 +5459,13 @@ async function createComposerContext(content, { extraProperties, context = {} }
|
|
5379
5459
|
return (container, options) => Z(htmlTemplate, container, options);
|
5380
5460
|
}
|
5381
5461
|
async function premount(config2, proxyWindow = window, reporter2 = console.error) {
|
5382
|
-
var
|
5462
|
+
var _a2;
|
5383
5463
|
let uris = [];
|
5384
5464
|
let importmap;
|
5385
5465
|
let done = Promise.resolve();
|
5386
5466
|
if (config2.sources) {
|
5387
5467
|
const { sources } = config2;
|
5388
|
-
importmap = !Array.isArray(sources) && typeof sources !== "string" ? (
|
5468
|
+
importmap = !Array.isArray(sources) && typeof sources !== "string" ? (_a2 = sources.importmap) != null ? _a2 : {} : {};
|
5389
5469
|
try {
|
5390
5470
|
proxyWindow.importShim.addImportMap(importmap);
|
5391
5471
|
} catch (err) {
|
@@ -5443,12 +5523,14 @@ const subjects = registerChannels();
|
|
5443
5523
|
function listener(message) {
|
5444
5524
|
switch (message.type) {
|
5445
5525
|
case "options": {
|
5446
|
-
const { content: { disableOverlay,
|
5526
|
+
const { content: { disableOverlay, redirectTo, timeout } } = message;
|
5447
5527
|
if (disableOverlay) {
|
5448
5528
|
Object.defineProperty(this.window, "__BACKOFFICE_CONFIGURATOR_DISABLE_OVERLAY__", { value: true });
|
5449
5529
|
subjects.mode.next("interact");
|
5450
5530
|
}
|
5451
|
-
|
5531
|
+
if (timeout !== void 0) {
|
5532
|
+
Object.defineProperty(this.window, "__BACKOFFICE_CONFIGURATOR_PREVIEW_TIMEOUT__", { value: timeout });
|
5533
|
+
}
|
5452
5534
|
const { window: { history } } = this;
|
5453
5535
|
redirectTo && history.pushState(history.state, "", redirectTo);
|
5454
5536
|
break;
|
@@ -5469,9 +5551,9 @@ function listener(message) {
|
|
5469
5551
|
}
|
5470
5552
|
const postChannel = new PostChannel(listener);
|
5471
5553
|
const fromErrorToNotification = (error2) => {
|
5472
|
-
var
|
5554
|
+
var _a2;
|
5473
5555
|
return {
|
5474
|
-
data: { message: error2.message, name: error2.name, stack: (
|
5556
|
+
data: { message: error2.message, name: error2.name, stack: (_a2 = error2.stack) != null ? _a2 : "" },
|
5475
5557
|
description: "preview.notifications.error.description",
|
5476
5558
|
message: "preview.notifications.error.message",
|
5477
5559
|
status: "error"
|
@@ -5531,37 +5613,6 @@ const ctrlSpaceFactory = (channels) => {
|
|
5531
5613
|
}
|
5532
5614
|
};
|
5533
5615
|
};
|
5534
|
-
const DEFAULT_LANGUAGE = "en";
|
5535
|
-
const localizeText = (input, lang = DEFAULT_LANGUAGE) => {
|
5536
|
-
if (typeof input === "string") {
|
5537
|
-
return input;
|
5538
|
-
}
|
5539
|
-
return input == null ? void 0 : input[lang];
|
5540
|
-
};
|
5541
|
-
function translateObject(obj) {
|
5542
|
-
return Object.entries(obj).reduce((out, [key, value]) => {
|
5543
|
-
out[key] = localizeText(value);
|
5544
|
-
return out;
|
5545
|
-
}, {});
|
5546
|
-
}
|
5547
|
-
const noop = (..._args) => {
|
5548
|
-
};
|
5549
|
-
const toArray = (input) => Array.isArray(input) ? input : [input];
|
5550
|
-
const urlMakerFactory = ({ document: { baseURI }, location: { href } }) => (input) => new URL(input, new URL(baseURI, href));
|
5551
|
-
const toURL = (urlMaker, info) => {
|
5552
|
-
let url = info;
|
5553
|
-
if (!(info instanceof URL)) {
|
5554
|
-
url = urlMaker(typeof info === "string" ? info : info.url);
|
5555
|
-
}
|
5556
|
-
return url;
|
5557
|
-
};
|
5558
|
-
const trimLocationOrigin = (origin, url) => {
|
5559
|
-
const { href, origin: linkOrigin } = url;
|
5560
|
-
if (origin === linkOrigin) {
|
5561
|
-
return href.substring(origin.length);
|
5562
|
-
}
|
5563
|
-
return href;
|
5564
|
-
};
|
5565
5616
|
const extractConstructor = ([tag, promise]) => from(promise.then((constructor) => [tag, constructor]));
|
5566
5617
|
const extractManifest = ([
|
5567
5618
|
tag,
|
@@ -5654,20 +5705,24 @@ var __publicField$1 = (obj, key, value) => {
|
|
5654
5705
|
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5655
5706
|
return value;
|
5656
5707
|
};
|
5657
|
-
|
5708
|
+
function fetchMockFactory(instance, fetchFactory, windowHref) {
|
5658
5709
|
const { properties, attributes, booleanAttributes = [] } = instance;
|
5659
5710
|
const context = Object.assign(
|
5660
|
-
Object.fromEntries(toArray(booleanAttributes).map((ba) => [ba, true])),
|
5711
|
+
Object.fromEntries(toArray$1(booleanAttributes).map((ba) => [ba, true])),
|
5661
5712
|
{ ...attributes, ...properties }
|
5662
5713
|
);
|
5663
5714
|
const routes = fetchFactory(context);
|
5664
|
-
return routes.map(({ url, method = "GET", handler: fetchHandler = () => Promise.resolve(new Response()) }) => {
|
5665
|
-
var
|
5715
|
+
return routes.map(({ url, method = "GET", notify = false, handler: fetchHandler = () => Promise.resolve(new Response()) }) => {
|
5716
|
+
var _a2;
|
5666
5717
|
const info = compileObject({ ...url, method }, context);
|
5667
|
-
const matcher = new URL(info.pathname, (
|
5668
|
-
return [matcher.href, method, (injectedInfo, init2) => fetchHandler(injectedInfo, init2)
|
5718
|
+
const matcher = new URL(info.pathname, (_a2 = info.origin) != null ? _a2 : windowHref);
|
5719
|
+
return [matcher.href, method, (injectedInfo, init2) => fetchHandler(injectedInfo, init2).finally(() => {
|
5720
|
+
if (notify) {
|
5721
|
+
this.notify(fetchNotification(method, matcher));
|
5722
|
+
}
|
5723
|
+
})];
|
5669
5724
|
});
|
5670
|
-
}
|
5725
|
+
}
|
5671
5726
|
const isExactUpToQuery = (url, next) => {
|
5672
5727
|
const { href, search } = url;
|
5673
5728
|
const requestUrlWithoutQuery = href.replace(/\?$/, "").substring(0, href.length - search.length);
|
@@ -5678,14 +5733,16 @@ const isExactUpToTrailingSlash = (url, next) => {
|
|
5678
5733
|
return href.match(new RegExp(`^${next.replace(/\/$/, "")}/`)) !== null;
|
5679
5734
|
};
|
5680
5735
|
class FetchMockStore extends Map {
|
5681
|
-
constructor() {
|
5682
|
-
super(
|
5736
|
+
constructor(notify) {
|
5737
|
+
super();
|
5738
|
+
__publicField$1(this, "notify");
|
5683
5739
|
__publicField$1(this, "__urlMap", /* @__PURE__ */ new Map());
|
5740
|
+
this.notify = notify;
|
5684
5741
|
}
|
5685
5742
|
add(obj, value) {
|
5686
|
-
var
|
5743
|
+
var _a2, _b;
|
5687
5744
|
const { method, url } = obj;
|
5688
|
-
const methodMap = (
|
5745
|
+
const methodMap = (_a2 = this.get(method)) != null ? _a2 : /* @__PURE__ */ new Map();
|
5689
5746
|
const urls = (_b = this.__urlMap.get(method)) != null ? _b : [];
|
5690
5747
|
methodMap.set(url, value);
|
5691
5748
|
urls.push(url);
|
@@ -5693,7 +5750,7 @@ class FetchMockStore extends Map {
|
|
5693
5750
|
this.__urlMap.set(method, urls);
|
5694
5751
|
}
|
5695
5752
|
match(obj) {
|
5696
|
-
var
|
5753
|
+
var _a2;
|
5697
5754
|
const { method, url } = obj;
|
5698
5755
|
const urls = this.__urlMap.get(method);
|
5699
5756
|
if (urls === void 0) {
|
@@ -5712,7 +5769,7 @@ class FetchMockStore extends Map {
|
|
5712
5769
|
if (id === void 0) {
|
5713
5770
|
return;
|
5714
5771
|
}
|
5715
|
-
return (
|
5772
|
+
return (_a2 = this.get(method)) == null ? void 0 : _a2.get(urls[id]);
|
5716
5773
|
}
|
5717
5774
|
}
|
5718
5775
|
const storeSaverMapFactory = (store) => ([url, method, fetchHandler]) => store.add({ method, url }, fetchHandler);
|
@@ -5720,13 +5777,15 @@ async function handler(store, instances, factory, href) {
|
|
5720
5777
|
const storeSaverMap = storeSaverMapFactory(store);
|
5721
5778
|
if (Array.isArray(instances)) {
|
5722
5779
|
return Promise.all(
|
5723
|
-
instances.map((instance) => fetchMockFactory(instance, factory, href)).flat().map(storeSaverMap)
|
5780
|
+
instances.map((instance) => fetchMockFactory.call(store, instance, factory, href)).flat().map(storeSaverMap)
|
5724
5781
|
).then(noop);
|
5725
5782
|
}
|
5726
5783
|
return Promise.all(
|
5727
|
-
fetchMockFactory(instances, factory, href).map(storeSaverMap)
|
5784
|
+
fetchMockFactory.call(store, instances, factory, href).map(storeSaverMap)
|
5728
5785
|
).then(noop);
|
5729
5786
|
}
|
5787
|
+
var _a;
|
5788
|
+
const MANIFEST_TIMEOUT = (_a = window.__BACKOFFICE_CONFIGURATOR_PREVIEW_TIMEOUT__) != null ? _a : 5e3;
|
5730
5789
|
const printHeaders = (headers) => {
|
5731
5790
|
const obj = {};
|
5732
5791
|
headers.forEach((val, key) => {
|
@@ -5735,36 +5794,52 @@ const printHeaders = (headers) => {
|
|
5735
5794
|
return JSON.stringify(obj);
|
5736
5795
|
};
|
5737
5796
|
const fetchPrint = (window2, url, init2, resHeaders = new Headers()) => {
|
5738
|
-
var
|
5797
|
+
var _a2;
|
5739
5798
|
const style = window2.origin === "null" ? { background: "antiquewhite", color: "brown" } : { background: "cyan", color: "blue" };
|
5740
5799
|
console.groupCollapsed(`%c Fetching from ${window2.origin} `, Object.entries(style).map(([key, val]) => `${key}: ${val}`).join("; "));
|
5741
5800
|
console.info(
|
5742
|
-
`a component fetched with method ${(
|
5801
|
+
`a component fetched with method ${(_a2 = init2 == null ? void 0 : init2.method) != null ? _a2 : "GET"} resource at %c ${url.href} got a response with headers ${printHeaders(resHeaders)}`,
|
5743
5802
|
"background: lightgreen; color: darkgreen"
|
5744
5803
|
);
|
5745
5804
|
console.groupEnd();
|
5746
5805
|
};
|
5747
5806
|
const isCustomTag = (tag) => tag.includes("-");
|
5807
|
+
const notFoundTagNotification = (tag) => ({
|
5808
|
+
data: { tag },
|
5809
|
+
description: "preview.notifications.no-webcomponent-definition.description",
|
5810
|
+
message: "preview.notifications.no-webcomponent-definition.message",
|
5811
|
+
status: "warning"
|
5812
|
+
});
|
5748
5813
|
async function mock(contexts, tags = []) {
|
5749
|
-
const { location: { href } } = this;
|
5814
|
+
const { location: { href }, fetch: originalFetch } = this;
|
5750
5815
|
const urlMaker = urlMakerFactory(this);
|
5751
|
-
const store = new FetchMockStore();
|
5816
|
+
const store = new FetchMockStore(this.notify.bind(this));
|
5752
5817
|
await Promise.all(tags.map(async (tag) => {
|
5753
|
-
var
|
5754
|
-
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5758
|
-
|
5759
|
-
|
5818
|
+
var _a2;
|
5819
|
+
let fetchFactory = () => [];
|
5820
|
+
const raced = await Promise.race([
|
5821
|
+
lastValueFrom(timer(MANIFEST_TIMEOUT)),
|
5822
|
+
lastValueFrom(
|
5823
|
+
subjects.mocks.pipe(filter(([incomingTag]) => incomingTag === tag), take(1))
|
5824
|
+
)
|
5825
|
+
]);
|
5826
|
+
if (raced === 0) {
|
5827
|
+
this.notify(notFoundTagNotification(tag));
|
5828
|
+
} else {
|
5829
|
+
const [, { fetch: fetch2 }] = raced;
|
5830
|
+
if (fetch2 !== void 0) {
|
5831
|
+
fetchFactory = fetch2;
|
5832
|
+
}
|
5833
|
+
}
|
5834
|
+
const instancesCarryingMocks = (_a2 = contexts.get(tag)) != null ? _a2 : [];
|
5760
5835
|
return handler(store, instancesCarryingMocks, fetchFactory, href);
|
5761
5836
|
})).catch(
|
5762
5837
|
(error2) => error2 instanceof Error && errorHandler(this, error2)
|
5763
5838
|
);
|
5764
5839
|
const mockedFetch = async (info, init2) => {
|
5765
|
-
var
|
5840
|
+
var _a2;
|
5766
5841
|
const url = toURL(urlMaker, info);
|
5767
|
-
const mockImplementation = store.match({ method: (
|
5842
|
+
const mockImplementation = store.match({ method: (_a2 = init2 == null ? void 0 : init2.method) != null ? _a2 : "GET", url });
|
5768
5843
|
if (mockImplementation !== void 0) {
|
5769
5844
|
return mockImplementation(url, init2).then((res) => {
|
5770
5845
|
{
|
@@ -5773,26 +5848,36 @@ async function mock(contexts, tags = []) {
|
|
5773
5848
|
return res;
|
5774
5849
|
});
|
5775
5850
|
}
|
5776
|
-
return
|
5851
|
+
return originalFetch(info, init2);
|
5777
5852
|
};
|
5778
5853
|
if (this.proxyWindow) {
|
5779
|
-
|
5854
|
+
const newFetch = Object.assign(
|
5780
5855
|
mockedFetch,
|
5781
5856
|
{
|
5782
5857
|
update: async (instance) => {
|
5783
5858
|
let fetchFactory = () => [];
|
5784
5859
|
if (isCustomTag(instance.tag)) {
|
5785
|
-
const
|
5786
|
-
|
5787
|
-
|
5788
|
-
|
5789
|
-
|
5860
|
+
const raced = await Promise.race([
|
5861
|
+
lastValueFrom(timer(MANIFEST_TIMEOUT)),
|
5862
|
+
lastValueFrom(
|
5863
|
+
subjects.mocks.pipe(filter(([incomingTag]) => incomingTag === instance.tag), take(1))
|
5864
|
+
)
|
5865
|
+
]);
|
5866
|
+
if (raced === 0) {
|
5867
|
+
this.notify(notFoundTagNotification(instance.tag));
|
5868
|
+
} else {
|
5869
|
+
const [, { fetch: fetch2 }] = raced;
|
5870
|
+
if (fetch2 !== void 0) {
|
5871
|
+
fetchFactory = fetch2;
|
5872
|
+
}
|
5790
5873
|
}
|
5791
5874
|
}
|
5792
5875
|
return handler(store, instance, fetchFactory, href);
|
5793
5876
|
}
|
5794
5877
|
}
|
5795
5878
|
);
|
5879
|
+
this.fetch = newFetch;
|
5880
|
+
this.proxyWindow.fetch = newFetch;
|
5796
5881
|
}
|
5797
5882
|
}
|
5798
5883
|
function open(url, target) {
|
@@ -5860,8 +5945,8 @@ class InMemoryStorage extends Map {
|
|
5860
5945
|
super.clear();
|
5861
5946
|
}
|
5862
5947
|
getItem(key) {
|
5863
|
-
var
|
5864
|
-
return (
|
5948
|
+
var _a2;
|
5949
|
+
return (_a2 = super.get(key)) != null ? _a2 : null;
|
5865
5950
|
}
|
5866
5951
|
key() {
|
5867
5952
|
return null;
|
@@ -5880,11 +5965,11 @@ function domPatch(frame) {
|
|
5880
5965
|
const element = originalCreateElement.call(this, tagName, options);
|
5881
5966
|
if (isAnchor(element)) {
|
5882
5967
|
const notifyAnchorClick = () => {
|
5883
|
-
var
|
5968
|
+
var _a2;
|
5884
5969
|
return frame.notify({
|
5885
5970
|
data: {
|
5886
5971
|
href: trimLocationOrigin(frame.location.origin, new URL(element.href, frame.location.href)),
|
5887
|
-
target: (
|
5972
|
+
target: (_a2 = element.getAttribute("target")) != null ? _a2 : "_self"
|
5888
5973
|
},
|
5889
5974
|
description: "preview.notifications.anchor.description",
|
5890
5975
|
message: "preview.notifications.anchor.message",
|
@@ -6067,8 +6152,8 @@ const run = (frame, renderRoot, channels) => {
|
|
6067
6152
|
const { context } = next;
|
6068
6153
|
done = queue.add([
|
6069
6154
|
() => {
|
6070
|
-
var
|
6071
|
-
return (_c = (
|
6155
|
+
var _a2, _b, _c;
|
6156
|
+
return (_c = (_a2 = frame.proxyWindow) == null ? void 0 : (_b = _a2.fetch).update) == null ? void 0 : _c.call(_b, context);
|
6072
6157
|
},
|
6073
6158
|
() => update.call(frame, content, renderRoot).finally(() => channels.updated.next(0))
|
6074
6159
|
]);
|
@@ -6096,6 +6181,12 @@ const isSameDocumentOriginRequest = (self2, url) => {
|
|
6096
6181
|
}
|
6097
6182
|
return true;
|
6098
6183
|
};
|
6184
|
+
const fetchNotification = (method, url) => ({
|
6185
|
+
data: { method, url: url.href.substring(url.origin.length) },
|
6186
|
+
description: "preview.notifications.fetch-event.description",
|
6187
|
+
message: "preview.notifications.fetch-event.message",
|
6188
|
+
status: "info"
|
6189
|
+
});
|
6099
6190
|
const interceptCORSFetch = (self2, notification) => {
|
6100
6191
|
const urlMaker = urlMakerFactory(self2);
|
6101
6192
|
const { document: document2, parent } = self2;
|
@@ -6104,15 +6195,10 @@ const interceptCORSFetch = (self2, notification) => {
|
|
6104
6195
|
}
|
6105
6196
|
const originalFetch = self2.fetch.bind(self2);
|
6106
6197
|
self2.fetch = (input, init2) => {
|
6107
|
-
var
|
6198
|
+
var _a2;
|
6108
6199
|
const url = toURL(urlMaker, input);
|
6109
6200
|
if (isSameDocumentOriginRequest(document2, url)) {
|
6110
|
-
notification.next(
|
6111
|
-
data: { method: (_a = init2 == null ? void 0 : init2.method) != null ? _a : "GET", url: url.href.substring(url.origin.length) },
|
6112
|
-
description: "preview.notifications.fetch-event.description",
|
6113
|
-
message: "preview.notifications.fetch-event.message",
|
6114
|
-
status: "info"
|
6115
|
-
});
|
6201
|
+
notification.next(fetchNotification((_a2 = init2 == null ? void 0 : init2.method) != null ? _a2 : "GET", url));
|
6116
6202
|
}
|
6117
6203
|
return originalFetch(input, init2);
|
6118
6204
|
};
|
@@ -6198,7 +6284,7 @@ function registerCleanups(window2, fns) {
|
|
6198
6284
|
}
|
6199
6285
|
((self2) => {
|
6200
6286
|
init(self2);
|
6201
|
-
const postChannelCleanup = postChannel.recv(self2);
|
6287
|
+
const postChannelCleanup = postChannel.recv(self2, self2.top);
|
6202
6288
|
const senderCleanup = registerSenders(subjects);
|
6203
6289
|
const listenerCleanup = registerEventListeners(
|
6204
6290
|
self2,
|