@absolutejs/absolute 0.19.0-beta.414 → 0.19.0-beta.415
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 -27
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/stream-slot.component.js +16 -28
- package/dist/angular/index.js +24 -27
- 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 +1 -3
- 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,29 @@ export class StreamSlotComponent {
|
|
|
35
29
|
});
|
|
36
30
|
return;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
|
-
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(existingHtml && existingHtml.length > 0
|
|
40
|
-
? existingHtml
|
|
41
|
-
: this.fallbackHtml));
|
|
32
|
+
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
|
|
42
33
|
}
|
|
43
34
|
ngAfterViewInit() {
|
|
44
35
|
if (typeof window === 'undefined')
|
|
45
36
|
return;
|
|
46
|
-
window.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
const consumers = (window.__ABS_SLOT_CONSUMERS__ =
|
|
38
|
+
window.__ABS_SLOT_CONSUMERS__ ?? {});
|
|
39
|
+
consumers[this.id] = this.slotConsumer;
|
|
40
|
+
const pendingHtml = window.__ABS_SLOT_PENDING__?.[this.id];
|
|
41
|
+
if (typeof pendingHtml === 'string') {
|
|
42
|
+
this.slotConsumer(pendingHtml);
|
|
43
|
+
delete window.__ABS_SLOT_PENDING__?.[this.id];
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
ngOnDestroy() {
|
|
54
47
|
if (typeof window === 'undefined')
|
|
55
48
|
return;
|
|
56
|
-
window.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const slotElement = this.hostElement.nativeElement.querySelector(`#slot-${this.id}`);
|
|
60
|
-
return slotElement?.innerHTML ?? '';
|
|
49
|
+
if (window.__ABS_SLOT_CONSUMERS__) {
|
|
50
|
+
delete window.__ABS_SLOT_CONSUMERS__[this.id];
|
|
51
|
+
}
|
|
61
52
|
}
|
|
62
53
|
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" },
|
|
54
|
+
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
55
|
<div
|
|
65
56
|
[attr.id]="'slot-' + id"
|
|
66
57
|
[attr.class]="className"
|
|
@@ -72,9 +63,6 @@ export class StreamSlotComponent {
|
|
|
72
63
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: StreamSlotComponent, decorators: [{
|
|
73
64
|
type: Component,
|
|
74
65
|
args: [{
|
|
75
|
-
host: {
|
|
76
|
-
ngSkipHydration: 'true'
|
|
77
|
-
},
|
|
78
66
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
79
67
|
selector: 'abs-stream-slot',
|
|
80
68
|
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,25 @@ class StreamSlotComponent {
|
|
|
181416
181418
|
});
|
|
181417
181419
|
return;
|
|
181418
181420
|
}
|
|
181419
|
-
|
|
181420
|
-
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(existingHtml && existingHtml.length > 0 ? existingHtml : this.fallbackHtml));
|
|
181421
|
+
this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
|
|
181421
181422
|
}
|
|
181422
181423
|
ngAfterViewInit() {
|
|
181423
181424
|
if (typeof window === "undefined")
|
|
181424
181425
|
return;
|
|
181425
|
-
window.
|
|
181426
|
-
|
|
181427
|
-
|
|
181428
|
-
|
|
181429
|
-
this.
|
|
181426
|
+
const consumers = window.__ABS_SLOT_CONSUMERS__ = window.__ABS_SLOT_CONSUMERS__ ?? {};
|
|
181427
|
+
consumers[this.id] = this.slotConsumer;
|
|
181428
|
+
const pendingHtml = window.__ABS_SLOT_PENDING__?.[this.id];
|
|
181429
|
+
if (typeof pendingHtml === "string") {
|
|
181430
|
+
this.slotConsumer(pendingHtml);
|
|
181431
|
+
delete window.__ABS_SLOT_PENDING__?.[this.id];
|
|
181430
181432
|
}
|
|
181431
181433
|
}
|
|
181432
181434
|
ngOnDestroy() {
|
|
181433
181435
|
if (typeof window === "undefined")
|
|
181434
181436
|
return;
|
|
181435
|
-
window.
|
|
181436
|
-
|
|
181437
|
-
|
|
181438
|
-
const slotElement = this.hostElement.nativeElement.querySelector(`#slot-${this.id}`);
|
|
181439
|
-
return slotElement?.innerHTML ?? "";
|
|
181437
|
+
if (window.__ABS_SLOT_CONSUMERS__) {
|
|
181438
|
+
delete window.__ABS_SLOT_CONSUMERS__[this.id];
|
|
181439
|
+
}
|
|
181440
181440
|
}
|
|
181441
181441
|
}
|
|
181442
181442
|
__legacyDecorateClassTS([
|
|
@@ -181465,9 +181465,6 @@ __legacyDecorateClassTS([
|
|
|
181465
181465
|
], StreamSlotComponent.prototype, "timeoutMs", undefined);
|
|
181466
181466
|
StreamSlotComponent = __legacyDecorateClassTS([
|
|
181467
181467
|
Component2({
|
|
181468
|
-
host: {
|
|
181469
|
-
ngSkipHydration: "true"
|
|
181470
|
-
},
|
|
181471
181468
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
181472
181469
|
selector: "abs-stream-slot",
|
|
181473
181470
|
standalone: true,
|
|
@@ -181676,5 +181673,5 @@ export {
|
|
|
181676
181673
|
DeferSlotComponent
|
|
181677
181674
|
};
|
|
181678
181675
|
|
|
181679
|
-
//# debugId=
|
|
181676
|
+
//# debugId=401683B2E9D6DAD564756E2164756E21
|
|
181680
181677
|
//# sourceMappingURL=index.js.map
|