@absolutejs/absolute 0.19.0-beta.414 → 0.19.0-beta.416
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/angular/browser.js +14 -31
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/stream-slot.component.js +16 -32
- package/dist/angular/index.js +24 -31
- package/dist/angular/index.js.map +4 -4
- package/dist/client/index.js +11 -1
- package/dist/client/index.js.map +3 -3
- package/dist/index.js +11 -1
- package/dist/index.js.map +3 -3
- package/dist/react/index.js +11 -1
- package/dist/react/index.js.map +3 -3
- package/dist/src/angular/components/stream-slot.component.d.ts +3 -6
- package/dist/src/client/streamSwap.d.ts +1 -0
- package/dist/svelte/index.js +11 -1
- package/dist/svelte/index.js.map +3 -3
- package/dist/vue/index.js +11 -1
- package/dist/vue/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component,
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgZone, inject, signal } from '@angular/core';
|
|
2
2
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
3
|
import { registerStreamingSlot } from './core/streamingSlotRegistrar.js';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
-
const SLOT_PATCH_EVENT = 'absolutejs:slot-patch';
|
|
6
5
|
export class StreamSlotComponent {
|
|
7
6
|
constructor() {
|
|
8
7
|
this.cdr = inject(ChangeDetectorRef);
|
|
9
8
|
this.sanitizer = inject(DomSanitizer);
|
|
10
|
-
this.hostElement = inject((ElementRef));
|
|
11
9
|
this.zone = inject(NgZone);
|
|
12
|
-
this.
|
|
13
|
-
const detail = event.detail;
|
|
14
|
-
if (!detail || detail.id !== this.id || typeof detail.html !== 'string') {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const nextHtml = detail.html;
|
|
10
|
+
this.slotConsumer = (html) => {
|
|
18
11
|
this.zone.run(() => {
|
|
19
|
-
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(
|
|
12
|
+
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(html));
|
|
20
13
|
this.cdr.markForCheck();
|
|
21
14
|
});
|
|
15
|
+
return true;
|
|
22
16
|
};
|
|
23
17
|
this.fallbackHtml = '';
|
|
24
18
|
this.currentHtml = signal('', ...(ngDevMode ? [{ debugName: "currentHtml" }] : /* istanbul ignore next */ []));
|
|
@@ -35,32 +29,25 @@ export class StreamSlotComponent {
|
|
|
35
29
|
});
|
|
36
30
|
return;
|
|
37
31
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
window.addEventListener(SLOT_PATCH_EVENT, this.patchListener);
|
|
47
|
-
const existingHtml = this.readSlotHtml();
|
|
48
|
-
if (existingHtml && existingHtml !== this.fallbackHtml) {
|
|
49
|
-
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(existingHtml));
|
|
50
|
-
this.cdr.markForCheck();
|
|
32
|
+
const consumers = (window.__ABS_SLOT_CONSUMERS__ =
|
|
33
|
+
window.__ABS_SLOT_CONSUMERS__ ?? {});
|
|
34
|
+
consumers[this.id] = this.slotConsumer;
|
|
35
|
+
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
|
|
36
|
+
const pendingHtml = window.__ABS_SLOT_PENDING__?.[this.id];
|
|
37
|
+
if (typeof pendingHtml === 'string') {
|
|
38
|
+
this.slotConsumer(pendingHtml);
|
|
39
|
+
delete window.__ABS_SLOT_PENDING__?.[this.id];
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
42
|
ngOnDestroy() {
|
|
54
43
|
if (typeof window === 'undefined')
|
|
55
44
|
return;
|
|
56
|
-
window.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const slotElement = this.hostElement.nativeElement.querySelector(`#slot-${this.id}`);
|
|
60
|
-
return slotElement?.innerHTML ?? '';
|
|
45
|
+
if (window.__ABS_SLOT_CONSUMERS__) {
|
|
46
|
+
delete window.__ABS_SLOT_CONSUMERS__[this.id];
|
|
47
|
+
}
|
|
61
48
|
}
|
|
62
49
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: StreamSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
63
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: StreamSlotComponent, isStandalone: true, selector: "abs-stream-slot", inputs: { className: "className", errorHtml: "errorHtml", fallbackHtml: "fallbackHtml", id: "id", resolve: "resolve", timeoutMs: "timeoutMs" },
|
|
50
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: StreamSlotComponent, isStandalone: true, selector: "abs-stream-slot", inputs: { className: "className", errorHtml: "errorHtml", fallbackHtml: "fallbackHtml", id: "id", resolve: "resolve", timeoutMs: "timeoutMs" }, ngImport: i0, template: `
|
|
64
51
|
<div
|
|
65
52
|
[attr.id]="'slot-' + id"
|
|
66
53
|
[attr.class]="className"
|
|
@@ -72,9 +59,6 @@ export class StreamSlotComponent {
|
|
|
72
59
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: StreamSlotComponent, decorators: [{
|
|
73
60
|
type: Component,
|
|
74
61
|
args: [{
|
|
75
|
-
host: {
|
|
76
|
-
ngSkipHydration: 'true'
|
|
77
|
-
},
|
|
78
62
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
79
63
|
selector: 'abs-stream-slot',
|
|
80
64
|
standalone: true,
|
package/dist/angular/index.js
CHANGED
|
@@ -180611,7 +180611,9 @@ var streamSwapRuntime = () => {
|
|
|
180611
180611
|
if (window.__ABS_SLOT_RUNTIME__ === true)
|
|
180612
180612
|
return;
|
|
180613
180613
|
window.__ABS_SLOT_RUNTIME__ = true;
|
|
180614
|
+
window.__ABS_SLOT_CONSUMERS__ = window.__ABS_SLOT_CONSUMERS__ ?? {};
|
|
180614
180615
|
window.__ABS_SLOT_PENDING__ = window.__ABS_SLOT_PENDING__ ?? {};
|
|
180616
|
+
const consumers = window.__ABS_SLOT_CONSUMERS__;
|
|
180615
180617
|
const pending = window.__ABS_SLOT_PENDING__;
|
|
180616
180618
|
const canApplyImmediately = () => window.__ABS_SLOT_HYDRATION_PENDING__ !== true;
|
|
180617
180619
|
const apply = (id, html) => {
|
|
@@ -180619,6 +180621,14 @@ var streamSwapRuntime = () => {
|
|
|
180619
180621
|
pending[id] = html;
|
|
180620
180622
|
return;
|
|
180621
180623
|
}
|
|
180624
|
+
const consumer = consumers[id];
|
|
180625
|
+
if (typeof consumer === "function") {
|
|
180626
|
+
const handled = consumer(html);
|
|
180627
|
+
if (handled !== false) {
|
|
180628
|
+
delete pending[id];
|
|
180629
|
+
return;
|
|
180630
|
+
}
|
|
180631
|
+
}
|
|
180622
180632
|
const node = document.getElementById(`slot-${id}`);
|
|
180623
180633
|
if (!node) {
|
|
180624
180634
|
pending[id] = html;
|
|
@@ -181375,33 +181385,25 @@ import {
|
|
|
181375
181385
|
ChangeDetectionStrategy,
|
|
181376
181386
|
ChangeDetectorRef,
|
|
181377
181387
|
Component as Component2,
|
|
181378
|
-
ElementRef,
|
|
181379
181388
|
Input as Input2,
|
|
181380
181389
|
NgZone,
|
|
181381
181390
|
inject,
|
|
181382
181391
|
signal
|
|
181383
181392
|
} from "@angular/core";
|
|
181384
181393
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
181385
|
-
var SLOT_PATCH_EVENT = "absolutejs:slot-patch";
|
|
181386
|
-
|
|
181387
181394
|
class StreamSlotComponent {
|
|
181388
181395
|
constructor() {
|
|
181389
181396
|
this.fallbackHtml = "";
|
|
181390
181397
|
}
|
|
181391
181398
|
cdr = inject(ChangeDetectorRef);
|
|
181392
181399
|
sanitizer = inject(DomSanitizer);
|
|
181393
|
-
hostElement = inject(ElementRef);
|
|
181394
181400
|
zone = inject(NgZone);
|
|
181395
|
-
|
|
181396
|
-
const detail = event.detail;
|
|
181397
|
-
if (!detail || detail.id !== this.id || typeof detail.html !== "string") {
|
|
181398
|
-
return;
|
|
181399
|
-
}
|
|
181400
|
-
const nextHtml = detail.html;
|
|
181401
|
+
slotConsumer = (html) => {
|
|
181401
181402
|
this.zone.run(() => {
|
|
181402
|
-
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(
|
|
181403
|
+
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(html));
|
|
181403
181404
|
this.cdr.markForCheck();
|
|
181404
181405
|
});
|
|
181406
|
+
return true;
|
|
181405
181407
|
};
|
|
181406
181408
|
currentHtml = signal("");
|
|
181407
181409
|
ngOnInit() {
|
|
@@ -181416,27 +181418,21 @@ class StreamSlotComponent {
|
|
|
181416
181418
|
});
|
|
181417
181419
|
return;
|
|
181418
181420
|
}
|
|
181419
|
-
const
|
|
181420
|
-
this.
|
|
181421
|
-
|
|
181422
|
-
|
|
181423
|
-
if (typeof
|
|
181424
|
-
|
|
181425
|
-
|
|
181426
|
-
const existingHtml = this.readSlotHtml();
|
|
181427
|
-
if (existingHtml && existingHtml !== this.fallbackHtml) {
|
|
181428
|
-
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(existingHtml));
|
|
181429
|
-
this.cdr.markForCheck();
|
|
181421
|
+
const consumers = window.__ABS_SLOT_CONSUMERS__ = window.__ABS_SLOT_CONSUMERS__ ?? {};
|
|
181422
|
+
consumers[this.id] = this.slotConsumer;
|
|
181423
|
+
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
|
|
181424
|
+
const pendingHtml = window.__ABS_SLOT_PENDING__?.[this.id];
|
|
181425
|
+
if (typeof pendingHtml === "string") {
|
|
181426
|
+
this.slotConsumer(pendingHtml);
|
|
181427
|
+
delete window.__ABS_SLOT_PENDING__?.[this.id];
|
|
181430
181428
|
}
|
|
181431
181429
|
}
|
|
181432
181430
|
ngOnDestroy() {
|
|
181433
181431
|
if (typeof window === "undefined")
|
|
181434
181432
|
return;
|
|
181435
|
-
window.
|
|
181436
|
-
|
|
181437
|
-
|
|
181438
|
-
const slotElement = this.hostElement.nativeElement.querySelector(`#slot-${this.id}`);
|
|
181439
|
-
return slotElement?.innerHTML ?? "";
|
|
181433
|
+
if (window.__ABS_SLOT_CONSUMERS__) {
|
|
181434
|
+
delete window.__ABS_SLOT_CONSUMERS__[this.id];
|
|
181435
|
+
}
|
|
181440
181436
|
}
|
|
181441
181437
|
}
|
|
181442
181438
|
__legacyDecorateClassTS([
|
|
@@ -181465,9 +181461,6 @@ __legacyDecorateClassTS([
|
|
|
181465
181461
|
], StreamSlotComponent.prototype, "timeoutMs", undefined);
|
|
181466
181462
|
StreamSlotComponent = __legacyDecorateClassTS([
|
|
181467
181463
|
Component2({
|
|
181468
|
-
host: {
|
|
181469
|
-
ngSkipHydration: "true"
|
|
181470
|
-
},
|
|
181471
181464
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
181472
181465
|
selector: "abs-stream-slot",
|
|
181473
181466
|
standalone: true,
|
|
@@ -181676,5 +181669,5 @@ export {
|
|
|
181676
181669
|
DeferSlotComponent
|
|
181677
181670
|
};
|
|
181678
181671
|
|
|
181679
|
-
//# debugId=
|
|
181672
|
+
//# debugId=1CCD053B5B866BB364756E2164756E21
|
|
181680
181673
|
//# sourceMappingURL=index.js.map
|