@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
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "elysia": "1.4.18",
29
29
  "elysia-scoped-state": "0.1.1",
30
30
  "eslint": "10.0.3",
31
- "eslint-plugin-absolute": "0.2.6",
31
+ "eslint-plugin-absolute": "0.2.8",
32
32
  "eslint-plugin-promise": "7.2.1",
33
33
  "eslint-plugin-security": "4.0.0",
34
34
  "globals": "^17.4.0",
@@ -53,46 +53,6 @@
53
53
  "engines": {
54
54
  "bun": ">=1.3.6"
55
55
  },
56
- "typesVersions": {
57
- "*": {
58
- "angular": [
59
- "dist/src/angular/index.d.ts"
60
- ],
61
- "angular/*": [
62
- "dist/src/angular/*"
63
- ],
64
- "build": [
65
- "dist/src/build.d.ts"
66
- ],
67
- "client": [
68
- "dist/src/client/index.d.ts"
69
- ],
70
- "image": [
71
- "dist/src/utils/imageClient.d.ts"
72
- ],
73
- "islands": [
74
- "dist/src/islands/index.d.ts"
75
- ],
76
- "react": [
77
- "dist/src/react/index.d.ts"
78
- ],
79
- "react/*": [
80
- "dist/src/react/*"
81
- ],
82
- "svelte": [
83
- "dist/src/svelte/index.d.ts"
84
- ],
85
- "svelte/*": [
86
- "dist/src/svelte/*"
87
- ],
88
- "vue": [
89
- "dist/src/vue/index.d.ts"
90
- ],
91
- "vue/*": [
92
- "dist/src/vue/*"
93
- ]
94
- }
95
- },
96
56
  "exports": {
97
57
  ".": {
98
58
  "import": "./dist/index.js",
@@ -333,5 +293,45 @@
333
293
  "typecheck": "bun run src/cli/index.ts typecheck --config example/absolute.config.ts"
334
294
  },
335
295
  "types": "./dist/src/index.d.ts",
336
- "version": "0.19.0-beta.704"
296
+ "typesVersions": {
297
+ "*": {
298
+ "angular": [
299
+ "dist/src/angular/index.d.ts"
300
+ ],
301
+ "angular/*": [
302
+ "dist/src/angular/*"
303
+ ],
304
+ "build": [
305
+ "dist/src/build.d.ts"
306
+ ],
307
+ "client": [
308
+ "dist/src/client/index.d.ts"
309
+ ],
310
+ "image": [
311
+ "dist/src/utils/imageClient.d.ts"
312
+ ],
313
+ "islands": [
314
+ "dist/src/islands/index.d.ts"
315
+ ],
316
+ "react": [
317
+ "dist/src/react/index.d.ts"
318
+ ],
319
+ "react/*": [
320
+ "dist/src/react/*"
321
+ ],
322
+ "svelte": [
323
+ "dist/src/svelte/index.d.ts"
324
+ ],
325
+ "svelte/*": [
326
+ "dist/src/svelte/*"
327
+ ],
328
+ "vue": [
329
+ "dist/src/vue/index.d.ts"
330
+ ],
331
+ "vue/*": [
332
+ "dist/src/vue/*"
333
+ ]
334
+ }
335
+ },
336
+ "version": "0.19.0-beta.706"
337
337
  }
@@ -1,56 +0,0 @@
1
- export const ANGULAR_INIT_TIMEOUT_MS = 500;
2
- export const ANSI_ESCAPE_LENGTH = 3;
3
- export const ASCII_SPACE = 32;
4
- export const BASE_36_RADIX = 36;
5
- export const BUN_BUILD_WARNING_SUPPRESSION = 'wildcard sideEffects are not supported yet';
6
- export const BODY_SLICE_LENGTH = 2000;
7
- export const BYTES_PER_KILOBYTE = 1024;
8
- export const CLI_ARGS_OFFSET = 3;
9
- export const CSS_ERROR_RESOLVE_DELAY_MS = 50;
10
- export const CSS_MAX_CHECK_ATTEMPTS = 10;
11
- export const CSS_MAX_PARSE_TIMEOUT_MS = 500;
12
- export const CSS_SHEET_READY_TIMEOUT_MS = 100;
13
- export const DEFAULT_CHUNK_SIZE = 16_384;
14
- export const DEFAULT_DEBOUNCE_MS = 15;
15
- export const DEFAULT_PORT = 3000;
16
- export const DEV_SERVER_RESTART_DEBOUNCE_MS = 100;
17
- export const DOM_UPDATE_DELAY_MS = 50;
18
- export const FILE_PROTOCOL_PREFIX_LENGTH = 7;
19
- export const FOCUS_ID_PREFIX_LENGTH = 3;
20
- export const FOCUS_IDX_PREFIX_LENGTH = 4;
21
- export const FOCUS_NAME_PREFIX_LENGTH = 5;
22
- export const HMR_UPDATE_TIMEOUT_MS = 2000;
23
- export const HOOK_SIGNATURE_LENGTH = 12;
24
- export const EXCLUDE_LAST_OFFSET = -1;
25
- export const HTTP_STATUS_OK = 200;
26
- export const HTTP_STATUS_BAD_REQUEST = 400;
27
- export const HTTP_STATUS_NOT_FOUND = 404;
28
- export const HOURS_IN_DAY = 24;
29
- export const HOURS_IN_HALF_DAY = 12;
30
- export const MAX_ERROR_LENGTH = 200;
31
- export const MAX_RECONNECT_ATTEMPTS = 60;
32
- export const MILLISECONDS_IN_A_SECOND = 1000;
33
- export const MINUTES_IN_AN_HOUR = 60;
34
- export const SECONDS_IN_A_MINUTE = 60;
35
- export const MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
36
- export const MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND *
37
- SECONDS_IN_A_MINUTE *
38
- MINUTES_IN_AN_HOUR *
39
- HOURS_IN_DAY;
40
- export const OVERLAY_FADE_DURATION_MS = 150;
41
- export const PING_INTERVAL_MS = 30_000;
42
- export const RAF_BATCH_COUNT = 3;
43
- export const RANDOM_ID_END_INDEX = 11;
44
- export const REBUILD_BATCH_DELAY_MS = 10;
45
- export const REBUILD_RELOAD_DELAY_MS = 200;
46
- export const RECONNECT_INITIAL_DELAY_MS = 500;
47
- export const RECONNECT_POLL_INTERVAL_MS = 300;
48
- export const REACT_STREAM_SLOT_FAST_DELAY_MS = 5;
49
- export const REACT_STREAM_SLOT_SLOW_DELAY_MS = 20;
50
- export const SIGINT_EXIT_CODE = 130;
51
- export const SIGTERM_EXIT_CODE = 143;
52
- export const SVELTE_CSS_LOAD_TIMEOUT_MS = 500;
53
- export const TIME_PRECISION = 2;
54
- export const TWO_THIRDS = 2 / 3;
55
- export const UNFOUND_INDEX = -1;
56
- export const WEBSOCKET_NORMAL_CLOSURE = 1000;
@@ -1,58 +0,0 @@
1
- // @bun
2
- var __require = import.meta.require;
3
-
4
- // .angular-partial-tmp/src/core/streamingSlotRegistrar.ts
5
- var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
- var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
- var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
8
- var getRegisteredStreamingSlotRegistrar = () => {
9
- const value = Reflect.get(globalThis, STREAMING_SLOT_REGISTRAR_KEY);
10
- if (typeof value === "function" || value === null) {
11
- return value;
12
- }
13
- return;
14
- };
15
- var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
16
- var isStreamingSlotWarningController = (value) => isObjectRecord(value) && ("maybeWarn" in value) && typeof value.maybeWarn === "function";
17
- var isStreamingSlotCollectionController = (value) => isObjectRecord(value) && ("isCollecting" in value) && typeof value.isCollecting === "function";
18
- var getWarningController = () => {
19
- const value = Reflect.get(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY);
20
- if (value === null || typeof value === "undefined")
21
- return;
22
- return isStreamingSlotWarningController(value) ? value : undefined;
23
- };
24
- var getCollectionController = () => {
25
- const value = Reflect.get(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY);
26
- if (value === null || typeof value === "undefined")
27
- return;
28
- return isStreamingSlotCollectionController(value) ? value : undefined;
29
- };
30
- var hasRegisteredStreamingSlotRegistrar = () => typeof getRegisteredStreamingSlotRegistrar() === "function";
31
- var isStreamingSlotCollectionActive = () => getCollectionController()?.isCollecting() === true;
32
- var registerStreamingSlot = (slot) => {
33
- getRegisteredStreamingSlotRegistrar()?.(slot);
34
- };
35
- var setStreamingSlotCollectionController = (controller) => {
36
- Reflect.set(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY, controller);
37
- };
38
- var setStreamingSlotRegistrar = (nextRegistrar) => {
39
- Reflect.set(globalThis, STREAMING_SLOT_REGISTRAR_KEY, nextRegistrar);
40
- };
41
- var setStreamingSlotWarningController = (controller) => {
42
- Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY, controller);
43
- };
44
- var warnMissingStreamingSlotCollector = (primitiveName) => {
45
- if (isStreamingSlotCollectionActive()) {
46
- return;
47
- }
48
- getWarningController()?.maybeWarn(primitiveName);
49
- };
50
- export {
51
- warnMissingStreamingSlotCollector,
52
- setStreamingSlotWarningController,
53
- setStreamingSlotRegistrar,
54
- setStreamingSlotCollectionController,
55
- registerStreamingSlot,
56
- isStreamingSlotCollectionActive,
57
- hasRegisteredStreamingSlotRegistrar
58
- };
@@ -1,114 +0,0 @@
1
- // @bun
2
- var __require = import.meta.require;
3
-
4
- // .angular-partial-tmp/src/core/streamingSlotRegistrar.ts
5
- var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
- var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
- var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
8
- var getRegisteredStreamingSlotRegistrar = () => {
9
- const value = Reflect.get(globalThis, STREAMING_SLOT_REGISTRAR_KEY);
10
- if (typeof value === "function" || value === null) {
11
- return value;
12
- }
13
- return;
14
- };
15
- var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
16
- var isStreamingSlotWarningController = (value) => isObjectRecord(value) && ("maybeWarn" in value) && typeof value.maybeWarn === "function";
17
- var isStreamingSlotCollectionController = (value) => isObjectRecord(value) && ("isCollecting" in value) && typeof value.isCollecting === "function";
18
- var getWarningController = () => {
19
- const value = Reflect.get(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY);
20
- if (value === null || typeof value === "undefined")
21
- return;
22
- return isStreamingSlotWarningController(value) ? value : undefined;
23
- };
24
- var getCollectionController = () => {
25
- const value = Reflect.get(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY);
26
- if (value === null || typeof value === "undefined")
27
- return;
28
- return isStreamingSlotCollectionController(value) ? value : undefined;
29
- };
30
- var hasRegisteredStreamingSlotRegistrar = () => typeof getRegisteredStreamingSlotRegistrar() === "function";
31
- var isStreamingSlotCollectionActive = () => getCollectionController()?.isCollecting() === true;
32
- var registerStreamingSlot = (slot) => {
33
- getRegisteredStreamingSlotRegistrar()?.(slot);
34
- };
35
- var setStreamingSlotCollectionController = (controller) => {
36
- Reflect.set(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY, controller);
37
- };
38
- var setStreamingSlotRegistrar = (nextRegistrar) => {
39
- Reflect.set(globalThis, STREAMING_SLOT_REGISTRAR_KEY, nextRegistrar);
40
- };
41
- var setStreamingSlotWarningController = (controller) => {
42
- Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY, controller);
43
- };
44
- var warnMissingStreamingSlotCollector = (primitiveName) => {
45
- if (isStreamingSlotCollectionActive()) {
46
- return;
47
- }
48
- getWarningController()?.maybeWarn(primitiveName);
49
- };
50
-
51
- // .angular-partial-tmp/src/core/streamingSlotRegistry.ts
52
- var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
- var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
- var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
55
- var getStorageGlobal = () => {
56
- const value = Reflect.get(globalThis, STREAMING_SLOT_STORAGE_KEY);
57
- if (value === null || typeof value === "undefined") {
58
- return value;
59
- }
60
- return isAsyncLocalStorage(value) ? value : undefined;
61
- };
62
- var isServerRuntime = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
63
- var ensureAsyncLocalStorage = async () => {
64
- const storage = getStorageGlobal();
65
- if (typeof storage !== "undefined") {
66
- return storage;
67
- }
68
- if (!isServerRuntime()) {
69
- Reflect.set(globalThis, STREAMING_SLOT_STORAGE_KEY, null);
70
- return getStorageGlobal();
71
- }
72
- const mod = await import("async_hooks");
73
- Reflect.set(globalThis, STREAMING_SLOT_STORAGE_KEY, new mod.AsyncLocalStorage);
74
- return getStorageGlobal();
75
- };
76
- var getActiveSlotStore = () => {
77
- const storage = getStorageGlobal();
78
- if (!storage)
79
- return;
80
- return storage.getStore();
81
- };
82
- var registerStreamingSlot2 = (slot) => {
83
- const store = getActiveSlotStore();
84
- if (!store)
85
- return;
86
- store.set(slot.id, slot);
87
- };
88
- setStreamingSlotRegistrar(registerStreamingSlot2);
89
- setStreamingSlotCollectionController({
90
- isCollecting: () => getActiveSlotStore() !== undefined
91
- });
92
- var hasActiveStreamingSlotRegistry = () => getActiveSlotStore() !== undefined;
93
- var runWithStreamingSlotRegistry = async (task) => {
94
- const storage = await ensureAsyncLocalStorage();
95
- if (!storage) {
96
- const slots = [];
97
- return {
98
- result: await task(),
99
- slots
100
- };
101
- }
102
- return storage.run(new Map, async () => {
103
- const result = await task();
104
- const store = storage.getStore();
105
- return {
106
- result,
107
- slots: store ? [...store.values()] : []
108
- };
109
- });
110
- };
111
- export {
112
- runWithStreamingSlotRegistry,
113
- hasActiveStreamingSlotRegistry
114
- };
@@ -1,6 +0,0 @@
1
- const isObjectRecord = (value) => Boolean(value) && typeof value === 'object';
2
- export const isAngularDeferSlotPayload = (value) => {
3
- if (!isObjectRecord(value))
4
- return false;
5
- return value.kind === 'angular-defer' && typeof value.html === 'string';
6
- };
@@ -1,44 +0,0 @@
1
- import { Directive, TemplateRef, inject } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export class DeferErrorTemplateDirective {
4
- constructor() {
5
- this.templateRef = inject(TemplateRef);
6
- }
7
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferErrorTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
8
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: DeferErrorTemplateDirective, isStandalone: true, selector: "ng-template[absDeferError]", ngImport: i0 }); }
9
- }
10
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferErrorTemplateDirective, decorators: [{
11
- type: Directive,
12
- args: [{
13
- selector: 'ng-template[absDeferError]',
14
- standalone: true
15
- }]
16
- }] });
17
- export class DeferFallbackTemplateDirective {
18
- constructor() {
19
- this.templateRef = inject(TemplateRef);
20
- }
21
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferFallbackTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
22
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: DeferFallbackTemplateDirective, isStandalone: true, selector: "ng-template[absDeferFallback]", ngImport: i0 }); }
23
- }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferFallbackTemplateDirective, decorators: [{
25
- type: Directive,
26
- args: [{
27
- selector: 'ng-template[absDeferFallback]',
28
- standalone: true
29
- }]
30
- }] });
31
- export class DeferResolvedTemplateDirective {
32
- constructor() {
33
- this.templateRef = inject(TemplateRef);
34
- }
35
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferResolvedTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
36
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: DeferResolvedTemplateDirective, isStandalone: true, selector: "ng-template[absDeferResolved]", ngImport: i0 }); }
37
- }
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferResolvedTemplateDirective, decorators: [{
39
- type: Directive,
40
- args: [{
41
- selector: 'ng-template[absDeferResolved]',
42
- standalone: true
43
- }]
44
- }] });
@@ -1,149 +0,0 @@
1
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, Input, inject, signal } from '@angular/core';
2
- import { NgTemplateOutlet } from '@angular/common';
3
- import { isStreamingSlotCollectionActive, registerStreamingSlot, warnMissingStreamingSlotCollector } from './core/streamingSlotRegistrar.js';
4
- import { isAngularDeferSlotPayload } from './defer-slot-payload.js';
5
- import { DeferErrorTemplateDirective, DeferFallbackTemplateDirective, DeferResolvedTemplateDirective } from './defer-slot-templates.directive.js';
6
- import * as i0 from "@angular/core";
7
- export class DeferSlotComponent {
8
- constructor() {
9
- this.cdr = inject(ChangeDetectorRef);
10
- this.runtimeReady = signal(false, ...(ngDevMode ? [{ debugName: "runtimeReady" }] : /* istanbul ignore next */ []));
11
- this.serverSlotRegistered = false;
12
- this.id = '';
13
- this.slotData = signal({}, ...(ngDevMode ? [{ debugName: "slotData" }] : /* istanbul ignore next */ []));
14
- this.state = signal('fallback', ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
15
- this.activeTemplate = () => {
16
- if (this.state() === 'resolved') {
17
- return this.resolvedTemplate?.templateRef ?? null;
18
- }
19
- if (this.state() === 'error') {
20
- return (this.errorTemplate?.templateRef ??
21
- this.fallbackTemplate?.templateRef ??
22
- null);
23
- }
24
- return (this.fallbackTemplate?.templateRef ??
25
- this.resolvedTemplate?.templateRef ??
26
- null);
27
- };
28
- this.templateContext = () => {
29
- const slotData = this.slotData();
30
- return {
31
- $implicit: slotData,
32
- slotData
33
- };
34
- };
35
- }
36
- ngOnInit() {
37
- const { id } = this;
38
- if (!id)
39
- return;
40
- if (this.registerServerSlot()) {
41
- return;
42
- }
43
- const consumers = (window.__ABS_SLOT_CONSUMERS__ =
44
- window.__ABS_SLOT_CONSUMERS__ ?? {});
45
- consumers[id] = (payload) => {
46
- if (!this.runtimeReady())
47
- return false;
48
- this.applyPatchPayload(payload);
49
- return true;
50
- };
51
- }
52
- ngAfterViewInit() {
53
- if (this.registerServerSlot())
54
- return;
55
- if (typeof window === 'undefined')
56
- return;
57
- requestAnimationFrame(() => {
58
- this.runtimeReady.set(true);
59
- this.cdr.markForCheck();
60
- window.__ABS_SLOT_FLUSH__?.();
61
- });
62
- }
63
- ngOnDestroy() {
64
- if (typeof window === 'undefined')
65
- return;
66
- const { id } = this;
67
- if (!id)
68
- return;
69
- delete window.__ABS_SLOT_CONSUMERS__?.[id];
70
- }
71
- registerServerSlot() {
72
- const { id, resolve } = this;
73
- if (this.serverSlotRegistered || !id || !resolve) {
74
- return false;
75
- }
76
- if (!isStreamingSlotCollectionActive()) {
77
- warnMissingStreamingSlotCollector('DeferSlot');
78
- return false;
79
- }
80
- registerStreamingSlot({
81
- id,
82
- resolve
83
- });
84
- this.serverSlotRegistered = true;
85
- return true;
86
- }
87
- applyPatchPayload(payload) {
88
- if (payload === null || typeof payload === 'undefined')
89
- return;
90
- if (isAngularDeferSlotPayload(payload)) {
91
- const data = payload.data && typeof payload.data === 'object'
92
- ? payload.data
93
- : {};
94
- this.slotData.set(data);
95
- this.state.set(payload.state === 'error' ? 'error' : 'resolved');
96
- this.cdr.markForCheck();
97
- return;
98
- }
99
- this.slotData.set({});
100
- this.state.set(payload === '' ? 'fallback' : 'resolved');
101
- this.cdr.markForCheck();
102
- }
103
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
104
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: DeferSlotComponent, isStandalone: true, selector: "abs-defer-slot", inputs: { className: "className", id: "id", resolve: "resolve" }, queries: [{ propertyName: "resolvedTemplate", first: true, predicate: DeferResolvedTemplateDirective, descendants: true }, { propertyName: "fallbackTemplate", first: true, predicate: DeferFallbackTemplateDirective, descendants: true }, { propertyName: "errorTemplate", first: true, predicate: DeferErrorTemplateDirective, descendants: true }], ngImport: i0, template: `
105
- <div [attr.id]="id" [attr.class]="className" data-absolute-slot="true">
106
- <ng-container
107
- [ngTemplateOutlet]="activeTemplate()"
108
- [ngTemplateOutletContext]="templateContext()"
109
- ></ng-container>
110
- </div>
111
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
112
- }
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DeferSlotComponent, decorators: [{
114
- type: Component,
115
- args: [{
116
- changeDetection: ChangeDetectionStrategy.OnPush,
117
- imports: [
118
- NgTemplateOutlet,
119
- DeferResolvedTemplateDirective,
120
- DeferFallbackTemplateDirective,
121
- DeferErrorTemplateDirective
122
- ],
123
- selector: 'abs-defer-slot',
124
- standalone: true,
125
- template: `
126
- <div [attr.id]="id" [attr.class]="className" data-absolute-slot="true">
127
- <ng-container
128
- [ngTemplateOutlet]="activeTemplate()"
129
- [ngTemplateOutletContext]="templateContext()"
130
- ></ng-container>
131
- </div>
132
- `
133
- }]
134
- }], propDecorators: { className: [{
135
- type: Input
136
- }], id: [{
137
- type: Input
138
- }], resolve: [{
139
- type: Input
140
- }], resolvedTemplate: [{
141
- type: ContentChild,
142
- args: [DeferResolvedTemplateDirective]
143
- }], fallbackTemplate: [{
144
- type: ContentChild,
145
- args: [DeferFallbackTemplateDirective]
146
- }], errorTemplate: [{
147
- type: ContentChild,
148
- args: [DeferErrorTemplateDirective]
149
- }] } });