@absolutejs/absolute 0.19.0-beta.704 → 0.19.0-beta.706

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.
Files changed (103) hide show
  1. package/dist/angular/browser.js +6 -4
  2. package/dist/angular/browser.js.map +3 -3
  3. package/dist/angular/index.js +71 -82
  4. package/dist/angular/index.js.map +10 -10
  5. package/dist/angular/server.js +70 -81
  6. package/dist/angular/server.js.map +10 -10
  7. package/dist/build.js +152 -84
  8. package/dist/build.js.map +15 -15
  9. package/dist/cli/index.js +330 -296
  10. package/dist/client/index.js +7 -4
  11. package/dist/client/index.js.map +3 -3
  12. package/dist/index.js +253 -153
  13. package/dist/index.js.map +24 -24
  14. package/dist/islands/index.js +9 -6
  15. package/dist/islands/index.js.map +5 -5
  16. package/dist/react/browser.js +7 -7
  17. package/dist/react/browser.js.map +2 -2
  18. package/dist/react/components/browser/index.js +101 -101
  19. package/dist/react/components/index.js +104 -104
  20. package/dist/react/components/index.js.map +2 -2
  21. package/dist/react/index.js +77 -88
  22. package/dist/react/index.js.map +10 -10
  23. package/dist/react/jsxDevRuntimeCompat.js +1 -6
  24. package/dist/react/jsxDevRuntimeCompat.js.map +3 -3
  25. package/dist/react/server.js +57 -71
  26. package/dist/react/server.js.map +8 -8
  27. package/dist/src/angular/components/defer-slot-templates.directive.d.ts +0 -7
  28. package/dist/src/angular/components/defer-slot.component.d.ts +2 -5
  29. package/dist/src/angular/components/image.component.d.ts +2 -5
  30. package/dist/src/angular/components/index.d.ts +4 -4
  31. package/dist/src/angular/components/stream-slot.component.d.ts +0 -3
  32. package/dist/src/angular/pageHandler.d.ts +6 -1
  33. package/dist/src/angular/ssrRender.d.ts +1 -1
  34. package/dist/src/build/buildAngularVendor.d.ts +3 -4
  35. package/dist/src/constants.d.ts +21 -0
  36. package/dist/src/core/ssrCache.d.ts +1 -1
  37. package/dist/src/core/wrapPageHandlerWithStreamingSlots.d.ts +1 -1
  38. package/dist/src/react/jsxDevRuntimeCompat.d.ts +3 -6
  39. package/dist/src/react/pageHandler.d.ts +2 -1
  40. package/dist/src/svelte/pageHandler.d.ts +2 -2
  41. package/dist/src/utils/defineConfig.d.ts +2 -2
  42. package/dist/src/utils/imageProcessing.d.ts +1 -1
  43. package/dist/src/utils/loadConfig.d.ts +38 -2
  44. package/dist/src/vue/components/Image.d.ts +3 -3
  45. package/dist/src/vue/components/index.d.ts +1 -1
  46. package/dist/src/vue/index.d.ts +1 -1
  47. package/dist/src/vue/pageHandler.d.ts +2 -1
  48. package/dist/svelte/index.js +52 -58
  49. package/dist/svelte/index.js.map +10 -10
  50. package/dist/svelte/server.js +46 -55
  51. package/dist/svelte/server.js.map +9 -9
  52. package/dist/vue/components/Image.js +18 -18
  53. package/dist/vue/components/Image.js.map +3 -3
  54. package/dist/vue/components/index.js +77 -62
  55. package/dist/vue/components/index.js.map +5 -5
  56. package/dist/vue/index.js +137 -142
  57. package/dist/vue/index.js.map +13 -13
  58. package/dist/vue/server.js +54 -77
  59. package/dist/vue/server.js.map +8 -8
  60. package/package.json +42 -42
  61. package/dist/angular/components/constants.js +0 -56
  62. package/dist/angular/components/core/streamingSlotRegistrar.js +0 -58
  63. package/dist/angular/components/core/streamingSlotRegistry.js +0 -114
  64. package/dist/angular/components/defer-slot-payload.js +0 -6
  65. package/dist/angular/components/defer-slot-templates.directive.js +0 -44
  66. package/dist/angular/components/defer-slot.component.js +0 -149
  67. package/dist/angular/components/image.component.js +0 -202
  68. package/dist/angular/components/index.js +0 -4
  69. package/dist/angular/components/stream-slot.component.js +0 -103
  70. package/dist/dev/client/constants.ts +0 -26
  71. package/dist/dev/client/cssUtils.ts +0 -307
  72. package/dist/dev/client/domDiff.ts +0 -226
  73. package/dist/dev/client/domState.ts +0 -421
  74. package/dist/dev/client/domTracker.ts +0 -61
  75. package/dist/dev/client/errorOverlay.ts +0 -184
  76. package/dist/dev/client/frameworkDetect.ts +0 -63
  77. package/dist/dev/client/handlers/angular.ts +0 -551
  78. package/dist/dev/client/handlers/angularRuntime.ts +0 -206
  79. package/dist/dev/client/handlers/html.ts +0 -363
  80. package/dist/dev/client/handlers/htmx.ts +0 -272
  81. package/dist/dev/client/handlers/react.ts +0 -108
  82. package/dist/dev/client/handlers/rebuild.ts +0 -153
  83. package/dist/dev/client/handlers/svelte.ts +0 -332
  84. package/dist/dev/client/handlers/vue.ts +0 -292
  85. package/dist/dev/client/headPatch.ts +0 -233
  86. package/dist/dev/client/hmrClient.ts +0 -251
  87. package/dist/dev/client/hmrState.ts +0 -14
  88. package/dist/dev/client/moduleVersions.ts +0 -62
  89. package/dist/dev/client/reactRefreshSetup.ts +0 -33
  90. package/dist/src/angular/components/constants.d.ts +0 -53
  91. package/dist/svelte/components/AwaitSlot.svelte +0 -39
  92. package/dist/svelte/components/AwaitSlot.svelte.d.ts +0 -2
  93. package/dist/svelte/components/Head.svelte +0 -144
  94. package/dist/svelte/components/Head.svelte.d.ts +0 -2
  95. package/dist/svelte/components/Image.svelte +0 -164
  96. package/dist/svelte/components/Image.svelte.d.ts +0 -5
  97. package/dist/svelte/components/Island.svelte +0 -71
  98. package/dist/svelte/components/Island.svelte.d.ts +0 -5
  99. package/dist/svelte/components/JsonLd.svelte +0 -21
  100. package/dist/svelte/components/JsonLd.svelte.d.ts +0 -2
  101. package/dist/svelte/components/StreamSlot.svelte +0 -41
  102. package/dist/svelte/components/StreamSlot.svelte.d.ts +0 -2
  103. package/dist/types/globals.d.ts +0 -121
@@ -1,202 +0,0 @@
1
- import { Component, computed, input, signal } from '@angular/core';
2
- import { NgStyle } from '@angular/common';
3
- import { DEFAULT_QUALITY, buildOptimizedUrl, generateBlurSvg, generateSrcSet } from '@absolutejs/absolute/image';
4
- import * as i0 from "@angular/core";
5
- /** Resolve the blur background CSS value from placeholder config */
6
- const resolveBlurBg = (placeholderValue, blurDataUrl) => {
7
- if (typeof placeholderValue === 'string' &&
8
- placeholderValue !== 'blur' &&
9
- placeholderValue.startsWith('data:')) {
10
- return generateBlurSvg(placeholderValue);
11
- }
12
- if (blurDataUrl)
13
- return generateBlurSvg(blurDataUrl);
14
- return undefined;
15
- };
16
- export class ImageComponent {
17
- constructor() {
18
- // ── Inputs ──────────────────────────────────────────────────
19
- this.alt = input.required(...(ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []));
20
- this.blurDataURL = input(...(ngDevMode ? [undefined, { debugName: "blurDataURL" }] : /* istanbul ignore next */ []));
21
- this.className = input(...(ngDevMode ? [undefined, { debugName: "className" }] : /* istanbul ignore next */ []));
22
- this.crossOrigin = input(...(ngDevMode ? [undefined, { debugName: "crossOrigin" }] : /* istanbul ignore next */ []));
23
- this.fetchPriority = input(...(ngDevMode ? [undefined, { debugName: "fetchPriority" }] : /* istanbul ignore next */ []));
24
- this.fill = input(false, ...(ngDevMode ? [{ debugName: "fill" }] : /* istanbul ignore next */ []));
25
- this.height = input(...(ngDevMode ? [undefined, { debugName: "height" }] : /* istanbul ignore next */ []));
26
- this.loader = input(...(ngDevMode ? [undefined, { debugName: "loader" }] : /* istanbul ignore next */ []));
27
- this.loading = input('lazy', ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
28
- this.onError = input(...(ngDevMode ? [undefined, { debugName: "onError" }] : /* istanbul ignore next */ []));
29
- this.onLoad = input(...(ngDevMode ? [undefined, { debugName: "onLoad" }] : /* istanbul ignore next */ []));
30
- this.overrideSrc = input(...(ngDevMode ? [undefined, { debugName: "overrideSrc" }] : /* istanbul ignore next */ []));
31
- this.placeholder = input('empty', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
32
- this.priority = input(false, ...(ngDevMode ? [{ debugName: "priority" }] : /* istanbul ignore next */ []));
33
- this.quality = input(DEFAULT_QUALITY, ...(ngDevMode ? [{ debugName: "quality" }] : /* istanbul ignore next */ []));
34
- this.referrerPolicy = input(...(ngDevMode ? [undefined, { debugName: "referrerPolicy" }] : /* istanbul ignore next */ []));
35
- this.sizes = input(...(ngDevMode ? [undefined, { debugName: "sizes" }] : /* istanbul ignore next */ []));
36
- this.src = input.required(...(ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []));
37
- this.style = input(...(ngDevMode ? [undefined, { debugName: "style" }] : /* istanbul ignore next */ []));
38
- this.unoptimized = input(false, ...(ngDevMode ? [{ debugName: "unoptimized" }] : /* istanbul ignore next */ []));
39
- this.width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
40
- // ── Internal state ──────────────────────────────────────────
41
- this.blurRemoved = signal(false, ...(ngDevMode ? [{ debugName: "blurRemoved" }] : /* istanbul ignore next */ []));
42
- // ── Computed ────────────────────────────────────────────────
43
- this.resolvedSrc = computed(() => {
44
- const override = this.overrideSrc();
45
- if (override)
46
- return override;
47
- if (this.unoptimized())
48
- return this.src();
49
- const loaderFn = this.loader();
50
- if (loaderFn)
51
- return loaderFn({
52
- quality: this.quality(),
53
- src: this.src(),
54
- width: this.width() ?? 0
55
- });
56
- const currentWidth = this.width();
57
- if (!currentWidth)
58
- return buildOptimizedUrl(this.src(), 0, this.quality());
59
- return buildOptimizedUrl(this.src(), currentWidth, this.quality());
60
- }, ...(ngDevMode ? [{ debugName: "resolvedSrc" }] : /* istanbul ignore next */ []));
61
- this.srcSet = computed(() => this.unoptimized()
62
- ? null
63
- : (generateSrcSet(this.src(), this.width(), this.sizes(), undefined, this.loader() ?? undefined) ?? null), ...(ngDevMode ? [{ debugName: "srcSet" }] : /* istanbul ignore next */ []));
64
- this.resolvedSrcSet = computed(() => this.srcSet() ?? null, ...(ngDevMode ? [{ debugName: "resolvedSrcSet" }] : /* istanbul ignore next */ []));
65
- this.resolvedSizes = computed(() => this.sizes() ?? (this.fill() ? '100vw' : null), ...(ngDevMode ? [{ debugName: "resolvedSizes" }] : /* istanbul ignore next */ []));
66
- this.resolvedCrossOrigin = computed(() => this.crossOrigin() ?? null, ...(ngDevMode ? [{ debugName: "resolvedCrossOrigin" }] : /* istanbul ignore next */ []));
67
- this.resolvedReferrerPolicy = computed(() => this.referrerPolicy() ?? null, ...(ngDevMode ? [{ debugName: "resolvedReferrerPolicy" }] : /* istanbul ignore next */ []));
68
- this.resolvedLoading = computed(() => this.priority() ? 'eager' : this.loading(), ...(ngDevMode ? [{ debugName: "resolvedLoading" }] : /* istanbul ignore next */ []));
69
- this.resolvedFetchPriority = computed(() => this.priority() ? 'high' : (this.fetchPriority() ?? null), ...(ngDevMode ? [{ debugName: "resolvedFetchPriority" }] : /* istanbul ignore next */ []));
70
- this.imgStyle = computed(() => {
71
- const base = {
72
- ...(this.style() ?? {}),
73
- color: 'transparent'
74
- };
75
- const hasBlur = !this.blurRemoved() &&
76
- (this.placeholder() === 'blur' ||
77
- (typeof this.placeholder() === 'string' &&
78
- this.placeholder() !== 'empty' &&
79
- (this.placeholder() ?? '').startsWith('data:')));
80
- const blurValue = hasBlur
81
- ? resolveBlurBg(this.placeholder(), this.blurDataURL())
82
- : undefined;
83
- if (blurValue) {
84
- base['background-image'] = blurValue;
85
- base['background-position'] = 'center';
86
- base['background-repeat'] = 'no-repeat';
87
- base['background-size'] = 'cover';
88
- }
89
- if (this.fill()) {
90
- base.height = '100%';
91
- base.inset = '0';
92
- base['object-fit'] = 'cover';
93
- base.position = 'absolute';
94
- base.width = '100%';
95
- }
96
- return base;
97
- }, ...(ngDevMode ? [{ debugName: "imgStyle" }] : /* istanbul ignore next */ []));
98
- }
99
- // ── Event handlers ──────────────────────────────────────────
100
- handleLoad(event) {
101
- this.blurRemoved.set(true);
102
- const callback = this.onLoad();
103
- if (callback)
104
- callback(event);
105
- }
106
- handleError(event) {
107
- const callback = this.onError();
108
- if (callback)
109
- callback(event);
110
- }
111
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
112
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: ImageComponent, isStandalone: true, selector: "abs-image", inputs: { alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: true, transformFunction: null }, blurDataURL: { classPropertyName: "blurDataURL", publicName: "blurDataURL", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, crossOrigin: { classPropertyName: "crossOrigin", publicName: "crossOrigin", isSignal: true, isRequired: false, transformFunction: null }, fetchPriority: { classPropertyName: "fetchPriority", publicName: "fetchPriority", isSignal: true, isRequired: false, transformFunction: null }, fill: { classPropertyName: "fill", publicName: "fill", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, loader: { classPropertyName: "loader", publicName: "loader", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, onError: { classPropertyName: "onError", publicName: "onError", isSignal: true, isRequired: false, transformFunction: null }, onLoad: { classPropertyName: "onLoad", publicName: "onLoad", isSignal: true, isRequired: false, transformFunction: null }, overrideSrc: { classPropertyName: "overrideSrc", publicName: "overrideSrc", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, priority: { classPropertyName: "priority", publicName: "priority", isSignal: true, isRequired: false, transformFunction: null }, quality: { classPropertyName: "quality", publicName: "quality", isSignal: true, isRequired: false, transformFunction: null }, referrerPolicy: { classPropertyName: "referrerPolicy", publicName: "referrerPolicy", isSignal: true, isRequired: false, transformFunction: null }, sizes: { classPropertyName: "sizes", publicName: "sizes", isSignal: true, isRequired: false, transformFunction: null }, src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: true, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, unoptimized: { classPropertyName: "unoptimized", publicName: "unoptimized", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
113
- @if (fill()) {
114
- <span
115
- style="position:relative;overflow:hidden;display:block;width:100%;height:100%"
116
- >
117
- <img
118
- [alt]="alt()"
119
- [src]="resolvedSrc()"
120
- [attr.srcset]="resolvedSrcSet()"
121
- [attr.sizes]="resolvedSizes()"
122
- [loading]="resolvedLoading()"
123
- [class]="className()"
124
- [ngStyle]="imgStyle()"
125
- [attr.crossorigin]="resolvedCrossOrigin()"
126
- [attr.referrerpolicy]="resolvedReferrerPolicy()"
127
- [attr.fetchpriority]="resolvedFetchPriority()"
128
- decoding="async"
129
- (load)="handleLoad($event)"
130
- (error)="handleError($event)"
131
- />
132
- </span>
133
- } @else {
134
- <img
135
- [alt]="alt()"
136
- [src]="resolvedSrc()"
137
- [attr.srcset]="resolvedSrcSet()"
138
- [attr.sizes]="resolvedSizes()"
139
- [width]="width()"
140
- [height]="height()"
141
- [loading]="resolvedLoading()"
142
- [class]="className()"
143
- [ngStyle]="imgStyle()"
144
- [attr.crossorigin]="resolvedCrossOrigin()"
145
- [attr.referrerpolicy]="resolvedReferrerPolicy()"
146
- [attr.fetchpriority]="resolvedFetchPriority()"
147
- decoding="async"
148
- (load)="handleLoad($event)"
149
- (error)="handleError($event)"
150
- />
151
- }
152
- `, isInline: true, dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
153
- }
154
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: ImageComponent, decorators: [{
155
- type: Component,
156
- args: [{
157
- imports: [NgStyle],
158
- selector: 'abs-image',
159
- standalone: true,
160
- template: `
161
- @if (fill()) {
162
- <span
163
- style="position:relative;overflow:hidden;display:block;width:100%;height:100%"
164
- >
165
- <img
166
- [alt]="alt()"
167
- [src]="resolvedSrc()"
168
- [attr.srcset]="resolvedSrcSet()"
169
- [attr.sizes]="resolvedSizes()"
170
- [loading]="resolvedLoading()"
171
- [class]="className()"
172
- [ngStyle]="imgStyle()"
173
- [attr.crossorigin]="resolvedCrossOrigin()"
174
- [attr.referrerpolicy]="resolvedReferrerPolicy()"
175
- [attr.fetchpriority]="resolvedFetchPriority()"
176
- decoding="async"
177
- (load)="handleLoad($event)"
178
- (error)="handleError($event)"
179
- />
180
- </span>
181
- } @else {
182
- <img
183
- [alt]="alt()"
184
- [src]="resolvedSrc()"
185
- [attr.srcset]="resolvedSrcSet()"
186
- [attr.sizes]="resolvedSizes()"
187
- [width]="width()"
188
- [height]="height()"
189
- [loading]="resolvedLoading()"
190
- [class]="className()"
191
- [ngStyle]="imgStyle()"
192
- [attr.crossorigin]="resolvedCrossOrigin()"
193
- [attr.referrerpolicy]="resolvedReferrerPolicy()"
194
- [attr.fetchpriority]="resolvedFetchPriority()"
195
- decoding="async"
196
- (load)="handleLoad($event)"
197
- (error)="handleError($event)"
198
- />
199
- }
200
- `
201
- }]
202
- }], propDecorators: { alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: true }] }], blurDataURL: [{ type: i0.Input, args: [{ isSignal: true, alias: "blurDataURL", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], crossOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "crossOrigin", required: false }] }], fetchPriority: [{ type: i0.Input, args: [{ isSignal: true, alias: "fetchPriority", required: false }] }], fill: [{ type: i0.Input, args: [{ isSignal: true, alias: "fill", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], loader: [{ type: i0.Input, args: [{ isSignal: true, alias: "loader", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], onError: [{ type: i0.Input, args: [{ isSignal: true, alias: "onError", required: false }] }], onLoad: [{ type: i0.Input, args: [{ isSignal: true, alias: "onLoad", required: false }] }], overrideSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "overrideSrc", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], priority: [{ type: i0.Input, args: [{ isSignal: true, alias: "priority", required: false }] }], quality: [{ type: i0.Input, args: [{ isSignal: true, alias: "quality", required: false }] }], referrerPolicy: [{ type: i0.Input, args: [{ isSignal: true, alias: "referrerPolicy", required: false }] }], sizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "sizes", required: false }] }], src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: true }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }], unoptimized: [{ type: i0.Input, args: [{ isSignal: true, alias: "unoptimized", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
@@ -1,4 +0,0 @@
1
- export { DeferSlotComponent } from './defer-slot.component.js';
2
- export { DeferErrorTemplateDirective, DeferFallbackTemplateDirective, DeferResolvedTemplateDirective } from './defer-slot-templates.directive.js';
3
- export { ImageComponent } from './image.component.js';
4
- export { StreamSlotComponent } from './stream-slot.component.js';
@@ -1,103 +0,0 @@
1
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgZone, inject, signal } from '@angular/core';
2
- import { DomSanitizer } from '@angular/platform-browser';
3
- import { isStreamingSlotCollectionActive, registerStreamingSlot, warnMissingStreamingSlotCollector } from './core/streamingSlotRegistrar.js';
4
- import * as i0 from "@angular/core";
5
- const isObjectRecord = (value) => Boolean(value) && typeof value === 'object';
6
- const isHtmlPayload = (payload) => isObjectRecord(payload) && typeof payload.html === 'string';
7
- const resolvePayloadHtml = (payload) => {
8
- if (isHtmlPayload(payload)) {
9
- return payload.html;
10
- }
11
- return typeof payload === 'string' ? payload : '';
12
- };
13
- export class StreamSlotComponent {
14
- constructor() {
15
- this.cdr = inject(ChangeDetectorRef);
16
- this.sanitizer = inject(DomSanitizer);
17
- this.zone = inject(NgZone);
18
- this.slotConsumer = (payload) => {
19
- this.zone.run(() => {
20
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
21
- this.cdr.markForCheck();
22
- });
23
- return true;
24
- };
25
- this.fallbackHtml = '';
26
- this.currentHtml = signal('', ...(ngDevMode ? [{ debugName: "currentHtml" }] : /* istanbul ignore next */ []));
27
- }
28
- ngOnInit() {
29
- if (isStreamingSlotCollectionActive()) {
30
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
31
- registerStreamingSlot({
32
- errorHtml: this.errorHtml,
33
- fallbackHtml: this.fallbackHtml,
34
- id: this.id,
35
- resolve: this.resolve,
36
- timeoutMs: this.timeoutMs
37
- });
38
- return;
39
- }
40
- warnMissingStreamingSlotCollector('StreamSlot');
41
- if (typeof window === 'undefined') {
42
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
43
- return;
44
- }
45
- const consumers = (window.__ABS_SLOT_CONSUMERS__ =
46
- window.__ABS_SLOT_CONSUMERS__ ?? {});
47
- consumers[this.id] = this.slotConsumer;
48
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
49
- const pendingPayload = window.__ABS_SLOT_PENDING__?.[this.id];
50
- if (pendingPayload !== undefined) {
51
- this.slotConsumer(pendingPayload);
52
- delete window.__ABS_SLOT_PENDING__?.[this.id];
53
- }
54
- }
55
- ngOnDestroy() {
56
- if (typeof window === 'undefined')
57
- return;
58
- if (window.__ABS_SLOT_CONSUMERS__) {
59
- delete window.__ABS_SLOT_CONSUMERS__[this.id];
60
- }
61
- }
62
- 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" }, ngImport: i0, template: `
64
- <div
65
- [attr.id]="id"
66
- [attr.class]="className"
67
- data-absolute-raw-slot="true"
68
- data-absolute-slot="true"
69
- [innerHTML]="currentHtml()"
70
- ></div>
71
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
72
- }
73
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: StreamSlotComponent, decorators: [{
74
- type: Component,
75
- args: [{
76
- changeDetection: ChangeDetectionStrategy.OnPush,
77
- selector: 'abs-stream-slot',
78
- standalone: true,
79
- template: `
80
- <div
81
- [attr.id]="id"
82
- [attr.class]="className"
83
- data-absolute-raw-slot="true"
84
- data-absolute-slot="true"
85
- [innerHTML]="currentHtml()"
86
- ></div>
87
- `
88
- }]
89
- }], propDecorators: { className: [{
90
- type: Input
91
- }], errorHtml: [{
92
- type: Input
93
- }], fallbackHtml: [{
94
- type: Input
95
- }], id: [{
96
- type: Input,
97
- args: [{ required: true }]
98
- }], resolve: [{
99
- type: Input,
100
- args: [{ required: true }]
101
- }], timeoutMs: [{
102
- type: Input
103
- }] } });
@@ -1,26 +0,0 @@
1
- import type {} from '../../types/globals';
2
- /* Client-side constants — local copy for dist/dev/client/ portability.
3
- These values MUST stay in sync with the root constants.ts.
4
- This file exists because the client files are copied raw to dist/dev/client/
5
- and cannot import from ../../constants when installed from npm. */
6
-
7
- export const ANGULAR_INIT_TIMEOUT_MS = 500;
8
- export const CSS_ERROR_RESOLVE_DELAY_MS = 50;
9
- export const CSS_MAX_CHECK_ATTEMPTS = 10;
10
- export const CSS_MAX_PARSE_TIMEOUT_MS = 500;
11
- export const CSS_SHEET_READY_TIMEOUT_MS = 100;
12
- export const DOM_UPDATE_DELAY_MS = 50;
13
- export const FOCUS_ID_PREFIX_LENGTH = 3;
14
- export const FOCUS_IDX_PREFIX_LENGTH = 4;
15
- export const FOCUS_NAME_PREFIX_LENGTH = 5;
16
- export const HMR_UPDATE_TIMEOUT_MS = 2000;
17
- export const MAX_RECONNECT_ATTEMPTS = 60;
18
- export const OVERLAY_FADE_DURATION_MS = 150;
19
- export const PING_INTERVAL_MS = 30_000;
20
- export const RAF_BATCH_COUNT = 3;
21
- export const REBUILD_RELOAD_DELAY_MS = 200;
22
- export const RECONNECT_INITIAL_DELAY_MS = 500;
23
- export const RECONNECT_POLL_INTERVAL_MS = 300;
24
- export const SVELTE_CSS_LOAD_TIMEOUT_MS = 500;
25
- export const UNFOUND_INDEX = -1;
26
- export const WEBSOCKET_NORMAL_CLOSURE = 1000;
@@ -1,307 +0,0 @@
1
- import type {} from '../../types/globals';
2
- /* CSS reload/preload utilities for HMR */
3
-
4
- import type { CSSUpdateResult } from '../../types/client';
5
- import {
6
- CSS_ERROR_RESOLVE_DELAY_MS,
7
- CSS_MAX_CHECK_ATTEMPTS,
8
- CSS_MAX_PARSE_TIMEOUT_MS,
9
- CSS_SHEET_READY_TIMEOUT_MS,
10
- DOM_UPDATE_DELAY_MS,
11
- RAF_BATCH_COUNT
12
- } from './constants';
13
- import { hmrState } from './hmrState';
14
-
15
- export const getCSSBaseName = (href: string) => {
16
- const fileName = href.split('?')[0]?.split('/').pop() || '';
17
-
18
- return fileName.split('.')[0] ?? '';
19
- };
20
-
21
- const baseNamesMatch = (baseA: string, baseB: string) =>
22
- baseA === baseB || baseA.includes(baseB) || baseB.includes(baseA);
23
-
24
- const findMatchingLink = (baseNew: string) => {
25
- const links = document.head.querySelectorAll('link[rel="stylesheet"]');
26
- for (const existing of links) {
27
- if (!(existing instanceof HTMLLinkElement)) continue;
28
- const existingHref = existing.getAttribute('href') || '';
29
- const baseExisting = getCSSBaseName(existingHref);
30
- if (baseNamesMatch(baseExisting, baseNew)) {
31
- return existing;
32
- }
33
- }
34
-
35
- return null;
36
- };
37
-
38
- const createTimestampedLink = (href: string) => {
39
- const newLinkElement = document.createElement('link');
40
- newLinkElement.rel = 'stylesheet';
41
- newLinkElement.media = 'print';
42
- const newHref = `${href + (href.includes('?') ? '&' : '?')}t=${Date.now()}`;
43
- newLinkElement.href = newHref;
44
-
45
- return { newHref, newLinkElement };
46
- };
47
-
48
- const processNewLink = (
49
- newLink: Element,
50
- linksToRemove: HTMLLinkElement[],
51
- linksToActivate: HTMLLinkElement[],
52
- linksToWaitFor: Promise<void>[]
53
- ) => {
54
- const href = newLink.getAttribute('href');
55
- if (!href) return;
56
-
57
- const baseNew = getCSSBaseName(href);
58
- const existingLink = findMatchingLink(baseNew);
59
-
60
- if (!existingLink) {
61
- const { newHref, newLinkElement } = createTimestampedLink(href);
62
- linksToActivate.push(newLinkElement);
63
- const loadPromise = createCSSLoadPromise(newLinkElement, newHref);
64
- document.head.appendChild(newLinkElement);
65
- linksToWaitFor.push(loadPromise);
66
-
67
- return;
68
- }
69
-
70
- const existingHrefAttr = existingLink.getAttribute('href');
71
- const existingHref = existingHrefAttr ? existingHrefAttr.split('?')[0] : '';
72
- const [newHrefBase] = href.split('?');
73
- if (existingHref === newHrefBase) return;
74
-
75
- const { newHref, newLinkElement } = createTimestampedLink(href);
76
- linksToRemove.push(existingLink);
77
- linksToActivate.push(newLinkElement);
78
- const loadPromise = createCSSLoadPromise(newLinkElement, newHref);
79
- document.head.appendChild(newLinkElement);
80
- linksToWaitFor.push(loadPromise);
81
- };
82
-
83
- export const processCSSLinks = (headHTML: string) => {
84
- const tempDiv = document.createElement('div');
85
- tempDiv.innerHTML = headHTML;
86
- const newStylesheets = tempDiv.querySelectorAll('link[rel="stylesheet"]');
87
- const existingStylesheets = Array.from(
88
- document.head.querySelectorAll<HTMLLinkElement>(
89
- 'link[rel="stylesheet"]'
90
- )
91
- );
92
-
93
- const newHrefs = Array.from(newStylesheets).map((link) => {
94
- const href = link.getAttribute('href') || '';
95
-
96
- return getCSSBaseName(href);
97
- });
98
-
99
- const linksToRemove: HTMLLinkElement[] = [];
100
- const linksToWaitFor: Promise<void>[] = [];
101
- const linksToActivate: HTMLLinkElement[] = [];
102
-
103
- newStylesheets.forEach((newLink) => {
104
- processNewLink(newLink, linksToRemove, linksToActivate, linksToWaitFor);
105
- });
106
-
107
- existingStylesheets.forEach((existingLink) => {
108
- const existingHref = existingLink.getAttribute('href') || '';
109
- const baseExisting = getCSSBaseName(existingHref);
110
- const stillExists = newHrefs.some((newBase) =>
111
- baseNamesMatch(baseExisting, newBase)
112
- );
113
- if (stillExists) return;
114
-
115
- const wasHandled = Array.from(newStylesheets).some((newLink) => {
116
- const newHref = newLink.getAttribute('href') || '';
117
- const baseNewLocal = getCSSBaseName(newHref);
118
-
119
- return baseNamesMatch(baseExisting, baseNewLocal);
120
- });
121
-
122
- if (!wasHandled) {
123
- linksToRemove.push(existingLink);
124
- }
125
- });
126
-
127
- return { linksToActivate, linksToRemove, linksToWaitFor };
128
- };
129
-
130
- const findManifestHref = (
131
- manifest: Record<string, string>,
132
- baseName: string
133
- ) => {
134
- const manifestKey = `${baseName
135
- .split('-')
136
- .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
137
- .join('')}CSS`;
138
-
139
- if (manifest[manifestKey]) {
140
- return manifest[manifestKey];
141
- }
142
-
143
- for (const [key, value] of Object.entries(manifest)) {
144
- if (key.endsWith('CSS') && value.includes(baseName)) {
145
- return value;
146
- }
147
- }
148
-
149
- return null;
150
- };
151
-
152
- const updateStylesheetLink = (
153
- link: Element,
154
- manifest: Record<string, string>
155
- ) => {
156
- if (!(link instanceof HTMLLinkElement)) return;
157
- const href = link.getAttribute('href');
158
- if (!href || href.includes('htmx.min.js')) return;
159
-
160
- let newHref: string | null = null;
161
- if (manifest) {
162
- const baseName = getCSSBaseName(href);
163
- newHref = findManifestHref(manifest, baseName);
164
- }
165
-
166
- if (newHref && newHref !== href) {
167
- link.href = `${newHref}?t=${Date.now()}`;
168
- } else {
169
- const url = new URL(href, window.location.origin);
170
- url.searchParams.set('t', Date.now().toString());
171
- link.href = url.toString();
172
- }
173
- };
174
-
175
- export const reloadCSSStylesheets = (manifest: Record<string, string>) => {
176
- const stylesheets = document.querySelectorAll('link[rel="stylesheet"]');
177
- stylesheets.forEach((link) => {
178
- updateStylesheetLink(link, manifest);
179
- });
180
- };
181
-
182
- const createCSSLoadPromise = (linkElement: HTMLLinkElement, newHref: string) =>
183
- // eslint-disable-next-line promise/avoid-new
184
- new Promise<void>((resolve) => {
185
- let resolved = false;
186
- const doResolve = function () {
187
- if (resolved) return;
188
- resolved = true;
189
- resolve();
190
- };
191
-
192
- const verifyCSSOM = function () {
193
- try {
194
- const sheets = Array.from(document.styleSheets);
195
-
196
- return sheets.some(
197
- (sheet) =>
198
- sheet.href &&
199
- sheet.href.includes(newHref.split('?')[0] ?? '')
200
- );
201
- } catch {
202
- return false;
203
- }
204
- };
205
-
206
- linkElement.onload = function () {
207
- let checkCount = 0;
208
- const checkCSSOM = function () {
209
- checkCount++;
210
- if (verifyCSSOM() || checkCount > CSS_MAX_CHECK_ATTEMPTS) {
211
- doResolve();
212
- } else {
213
- requestAnimationFrame(checkCSSOM);
214
- }
215
- };
216
- requestAnimationFrame(checkCSSOM);
217
- };
218
-
219
- linkElement.onerror = function () {
220
- setTimeout(() => {
221
- doResolve();
222
- }, CSS_ERROR_RESOLVE_DELAY_MS);
223
- };
224
-
225
- setTimeout(() => {
226
- if (linkElement.sheet && !resolved) {
227
- doResolve();
228
- }
229
- }, CSS_SHEET_READY_TIMEOUT_MS);
230
-
231
- setTimeout(() => {
232
- if (!resolved) {
233
- doResolve();
234
- }
235
- }, CSS_MAX_PARSE_TIMEOUT_MS);
236
- });
237
-
238
- const removeLinks = (linksToRemove: HTMLLinkElement[]) => {
239
- linksToRemove.forEach((link) => {
240
- if (link.parentNode) {
241
- link.remove();
242
- }
243
- });
244
- };
245
-
246
- const activateLinks = (linksToActivate: HTMLLinkElement[]) => {
247
- linksToActivate.forEach((link) => {
248
- link.media = 'all';
249
- });
250
- };
251
-
252
- const chainRAF = (depth: number, callback: () => void) => {
253
- if (depth <= 0) {
254
- callback();
255
-
256
- return;
257
- }
258
- requestAnimationFrame(() => {
259
- chainRAF(depth - 1, callback);
260
- });
261
- };
262
-
263
- /* Coordinate CSS load with body update: waits for CSS, patches body,
264
- activates new CSS, removes old CSS. Handles first-update delay. */
265
- export const waitForCSSAndUpdate = (
266
- cssResult: CSSUpdateResult,
267
- updateBody: () => void
268
- ) => {
269
- const { linksToActivate, linksToRemove, linksToWaitFor } = cssResult;
270
-
271
- if (linksToWaitFor.length > 0) {
272
- void Promise.all(linksToWaitFor).then(() => {
273
- setTimeout(() => {
274
- chainRAF(RAF_BATCH_COUNT, () => {
275
- updateBody();
276
- activateLinks(linksToActivate);
277
- requestAnimationFrame(() => {
278
- removeLinks(linksToRemove);
279
- if (hmrState.isFirstHMRUpdate) {
280
- hmrState.isFirstHMRUpdate = false;
281
- }
282
- });
283
- });
284
- }, DOM_UPDATE_DELAY_MS);
285
-
286
- return undefined;
287
- });
288
-
289
- return;
290
- }
291
-
292
- const doUpdate = function () {
293
- chainRAF(RAF_BATCH_COUNT, () => {
294
- updateBody();
295
- requestAnimationFrame(() => {
296
- removeLinks(linksToRemove);
297
- });
298
- });
299
- };
300
-
301
- if (hmrState.isFirstHMRUpdate) {
302
- hmrState.isFirstHMRUpdate = false;
303
- setTimeout(doUpdate, DOM_UPDATE_DELAY_MS);
304
- } else {
305
- doUpdate();
306
- }
307
- };