@absolutejs/absolute 0.19.0-beta.406 → 0.19.0-beta.408

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.
@@ -1,16 +1,24 @@
1
- import { Component, Input, inject } from '@angular/core';
1
+ import { Component, ElementRef, Input, 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';
5
6
  export class StreamSlotComponent {
6
7
  constructor() {
7
8
  this.sanitizer = inject(DomSanitizer);
9
+ this.hostElement = inject((ElementRef));
10
+ this.patchListener = (event) => {
11
+ const detail = event.detail;
12
+ if (!detail || detail.id !== this.id || typeof detail.html !== 'string') {
13
+ return;
14
+ }
15
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(detail.html));
16
+ };
8
17
  this.fallbackHtml = '';
9
- }
10
- get trustedFallbackHtml() {
11
- return this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml);
18
+ this.currentHtml = signal('', ...(ngDevMode ? [{ debugName: "currentHtml" }] : /* istanbul ignore next */ []));
12
19
  }
13
20
  ngOnInit() {
21
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
14
22
  if (typeof window !== 'undefined')
15
23
  return;
16
24
  registerStreamingSlot({
@@ -21,13 +29,28 @@ export class StreamSlotComponent {
21
29
  timeoutMs: this.timeoutMs
22
30
  });
23
31
  }
32
+ ngAfterViewInit() {
33
+ if (typeof window === 'undefined')
34
+ return;
35
+ window.addEventListener(SLOT_PATCH_EVENT, this.patchListener);
36
+ const slotElement = this.hostElement.nativeElement.querySelector(`#slot-${this.id}`);
37
+ const existingHtml = slotElement?.innerHTML;
38
+ if (existingHtml && existingHtml !== this.fallbackHtml) {
39
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(existingHtml));
40
+ }
41
+ }
42
+ ngOnDestroy() {
43
+ if (typeof window === 'undefined')
44
+ return;
45
+ window.removeEventListener(SLOT_PATCH_EVENT, this.patchListener);
46
+ }
24
47
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: StreamSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
25
48
  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: `
26
49
  <div
27
50
  [attr.id]="'slot-' + id"
28
51
  [attr.class]="className"
29
52
  data-absolute-slot="true"
30
- [innerHTML]="trustedFallbackHtml"
53
+ [innerHTML]="currentHtml()"
31
54
  ></div>
32
55
  `, isInline: true }); }
33
56
  }
@@ -41,7 +64,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
41
64
  [attr.id]="'slot-' + id"
42
65
  [attr.class]="className"
43
66
  data-absolute-slot="true"
44
- [innerHTML]="trustedFallbackHtml"
67
+ [innerHTML]="currentHtml()"
45
68
  ></div>
46
69
  `
47
70
  }]
@@ -180606,6 +180606,7 @@ var runWithStreamingSlotRegistry = async (task) => {
180606
180606
  import"@angular/compiler";
180607
180607
 
180608
180608
  // src/client/streamSwap.ts
180609
+ var SLOT_PATCH_EVENT = "absolutejs:slot-patch";
180609
180610
  var streamSwapRuntime = () => {
180610
180611
  if (window.__ABS_SLOT_RUNTIME__ === true)
180611
180612
  return;
@@ -180624,6 +180625,9 @@ var streamSwapRuntime = () => {
180624
180625
  return;
180625
180626
  }
180626
180627
  node.innerHTML = html;
180628
+ window.dispatchEvent(new CustomEvent(SLOT_PATCH_EVENT, {
180629
+ detail: { html, id }
180630
+ }));
180627
180631
  delete pending[id];
180628
180632
  };
180629
180633
  const flush = () => {
@@ -181367,17 +181371,32 @@ var renderIsland = (props) => renderIslandMarkup(requireCurrentIslandRegistry(),
181367
181371
  import { Component as Component3, computed, input } from "@angular/core";
181368
181372
 
181369
181373
  // src/angular/components/stream-slot.component.ts
181370
- import { Component as Component2, Input as Input2, inject } from "@angular/core";
181374
+ import {
181375
+ Component as Component2,
181376
+ ElementRef,
181377
+ Input as Input2,
181378
+ inject,
181379
+ signal
181380
+ } from "@angular/core";
181371
181381
  import { DomSanitizer } from "@angular/platform-browser";
181382
+ var SLOT_PATCH_EVENT2 = "absolutejs:slot-patch";
181383
+
181372
181384
  class StreamSlotComponent {
181373
181385
  constructor() {
181374
181386
  this.fallbackHtml = "";
181375
181387
  }
181376
181388
  sanitizer = inject(DomSanitizer);
181377
- get trustedFallbackHtml() {
181378
- return this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml);
181379
- }
181389
+ hostElement = inject(ElementRef);
181390
+ patchListener = (event) => {
181391
+ const detail = event.detail;
181392
+ if (!detail || detail.id !== this.id || typeof detail.html !== "string") {
181393
+ return;
181394
+ }
181395
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(detail.html));
181396
+ };
181397
+ currentHtml = signal("");
181380
181398
  ngOnInit() {
181399
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
181381
181400
  if (typeof window !== "undefined")
181382
181401
  return;
181383
181402
  registerStreamingSlot({
@@ -181388,6 +181407,21 @@ class StreamSlotComponent {
181388
181407
  timeoutMs: this.timeoutMs
181389
181408
  });
181390
181409
  }
181410
+ ngAfterViewInit() {
181411
+ if (typeof window === "undefined")
181412
+ return;
181413
+ window.addEventListener(SLOT_PATCH_EVENT2, this.patchListener);
181414
+ const slotElement = this.hostElement.nativeElement.querySelector(`#slot-${this.id}`);
181415
+ const existingHtml = slotElement?.innerHTML;
181416
+ if (existingHtml && existingHtml !== this.fallbackHtml) {
181417
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(existingHtml));
181418
+ }
181419
+ }
181420
+ ngOnDestroy() {
181421
+ if (typeof window === "undefined")
181422
+ return;
181423
+ window.removeEventListener(SLOT_PATCH_EVENT2, this.patchListener);
181424
+ }
181391
181425
  }
181392
181426
  __legacyDecorateClassTS([
181393
181427
  Input2(),
@@ -181422,7 +181456,7 @@ StreamSlotComponent = __legacyDecorateClassTS([
181422
181456
  [attr.id]="'slot-' + id"
181423
181457
  [attr.class]="className"
181424
181458
  data-absolute-slot="true"
181425
- [innerHTML]="trustedFallbackHtml"
181459
+ [innerHTML]="currentHtml()"
181426
181460
  ></div>
181427
181461
  `
181428
181462
  })
@@ -181466,7 +181500,7 @@ DeferSlotComponent = __legacyDecorateClassTS([
181466
181500
  ], DeferSlotComponent);
181467
181501
  // src/angular/components/image.component.ts
181468
181502
  init_imageProcessing();
181469
- import { Component as Component4, computed as computed2, input as input2, signal } from "@angular/core";
181503
+ import { Component as Component4, computed as computed2, input as input2, signal as signal2 } from "@angular/core";
181470
181504
  import { NgStyle } from "@angular/common";
181471
181505
  var resolveBlurBg = (placeholderValue, blurDataUrl) => {
181472
181506
  if (typeof placeholderValue === "string" && placeholderValue !== "blur" && placeholderValue.startsWith("data:")) {
@@ -181499,7 +181533,7 @@ class ImageComponent {
181499
181533
  style = input2();
181500
181534
  unoptimized = input2(false);
181501
181535
  width = input2();
181502
- blurRemoved = signal(false);
181536
+ blurRemoved = signal2(false);
181503
181537
  resolvedSrc = computed2(() => {
181504
181538
  const override = this.overrideSrc();
181505
181539
  if (override)
@@ -181622,5 +181656,5 @@ export {
181622
181656
  DeferSlotComponent
181623
181657
  };
181624
181658
 
181625
- //# debugId=EFA32F489E030B9264756E2164756E21
181659
+ //# debugId=8F89B49B48BFC7AB64756E2164756E21
181626
181660
  //# sourceMappingURL=index.js.map