@absolutejs/absolute 0.19.0-beta.961 → 0.19.0-beta.962

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,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-e5Ukal/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-ejVs4Q/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-e5Ukal/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-ejVs4Q/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-e5Ukal/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-ejVs4Q/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
@@ -1,4 +1,4 @@
1
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgZone, inject, signal } from '@angular/core';
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, inject, signal } from '@angular/core';
2
2
  import { DomSanitizer } from '@angular/platform-browser';
3
3
  import { isStreamingSlotCollectionActive, registerStreamingSlot, warnMissingStreamingSlotCollector } from './core/streamingSlotRegistrar.js';
4
4
  import * as i0 from "@angular/core";
@@ -14,12 +14,9 @@ export class StreamSlotComponent {
14
14
  constructor() {
15
15
  this.cdr = inject(ChangeDetectorRef);
16
16
  this.sanitizer = inject(DomSanitizer);
17
- this.zone = inject(NgZone);
18
17
  this.slotConsumer = (payload) => {
19
- this.zone.run(() => {
20
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
21
- this.cdr.markForCheck();
22
- });
18
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
19
+ this.cdr.markForCheck();
23
20
  return true;
24
21
  };
25
22
  this.fallbackHtml = '';
@@ -14866,8 +14866,107 @@ var handleAngularPageRequest = async (input) => {
14866
14866
  };
14867
14867
  // src/angular/page.ts
14868
14868
  var defineAngularPage = (definition) => definition;
14869
+ // src/angular/composables/useResource.ts
14870
+ import { DestroyRef, inject, signal } from "@angular/core";
14871
+ var useResource = (fetcher, options = {}) => {
14872
+ const destroyRef = inject(DestroyRef);
14873
+ const data = signal(null);
14874
+ const error = signal(null);
14875
+ const loading = signal(false);
14876
+ let controller = null;
14877
+ let destroyed = false;
14878
+ const cancel = () => {
14879
+ if (controller) {
14880
+ controller.abort();
14881
+ controller = null;
14882
+ }
14883
+ };
14884
+ const refresh = async () => {
14885
+ if (destroyed)
14886
+ return;
14887
+ cancel();
14888
+ const next = new AbortController;
14889
+ controller = next;
14890
+ loading.set(true);
14891
+ error.set(null);
14892
+ try {
14893
+ const result = await fetcher(next.signal);
14894
+ if (next.signal.aborted)
14895
+ return;
14896
+ data.set(result);
14897
+ } catch (cause) {
14898
+ if (next.signal.aborted)
14899
+ return;
14900
+ error.set(cause);
14901
+ } finally {
14902
+ if (controller === next) {
14903
+ controller = null;
14904
+ }
14905
+ if (!next.signal.aborted) {
14906
+ loading.set(false);
14907
+ }
14908
+ }
14909
+ };
14910
+ destroyRef.onDestroy(() => {
14911
+ destroyed = true;
14912
+ cancel();
14913
+ });
14914
+ if (options.immediate !== false) {
14915
+ refresh();
14916
+ }
14917
+ return { cancel, data, error, loading, refresh };
14918
+ };
14919
+ // src/angular/composables/useSubscription.ts
14920
+ import { DestroyRef as DestroyRef2, inject as inject2 } from "@angular/core";
14921
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
14922
+ function useSubscription(observable, observerOrNext) {
14923
+ const destroyRef = inject2(DestroyRef2);
14924
+ return observable.pipe(takeUntilDestroyed(destroyRef)).subscribe(typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext);
14925
+ }
14926
+ // src/angular/composables/useTimers.ts
14927
+ import { DestroyRef as DestroyRef3, inject as inject3 } from "@angular/core";
14928
+ var useTimers = () => {
14929
+ const destroyRef = inject3(DestroyRef3);
14930
+ const timeouts = new Set;
14931
+ const intervals = new Set;
14932
+ const clearAll = () => {
14933
+ timeouts.forEach((timer) => clearTimeout(timer));
14934
+ intervals.forEach((timer) => clearInterval(timer));
14935
+ timeouts.clear();
14936
+ intervals.clear();
14937
+ };
14938
+ destroyRef.onDestroy(clearAll);
14939
+ return {
14940
+ clearAll,
14941
+ clearInterval(timer) {
14942
+ if (!timer)
14943
+ return;
14944
+ clearInterval(timer);
14945
+ intervals.delete(timer);
14946
+ },
14947
+ clearTimeout(timer) {
14948
+ if (!timer)
14949
+ return;
14950
+ clearTimeout(timer);
14951
+ timeouts.delete(timer);
14952
+ },
14953
+ setInterval(callback, delayMs) {
14954
+ const timer = setInterval(callback, delayMs);
14955
+ intervals.add(timer);
14956
+ return timer;
14957
+ },
14958
+ setTimeout(callback, delayMs) {
14959
+ const timer = setTimeout(() => {
14960
+ timeouts.delete(timer);
14961
+ callback();
14962
+ }, delayMs);
14963
+ timeouts.add(timer);
14964
+ return timer;
14965
+ }
14966
+ };
14967
+ };
14869
14968
  // src/angular/preserveAcrossHmr.ts
14870
- import { ChangeDetectorRef, inject } from "@angular/core";
14969
+ import { ChangeDetectorRef, inject as inject4 } from "@angular/core";
14871
14970
 
14872
14971
  // src/angular/hmrPreserveCore.ts
14873
14972
  var isHmrPreserveDev = () => {
@@ -14938,15 +15037,15 @@ var preserveAcrossHmr = (instance, key) => {
14938
15037
  if (!restored)
14939
15038
  return;
14940
15039
  try {
14941
- const cdr = inject(ChangeDetectorRef, { optional: true });
15040
+ const cdr = inject4(ChangeDetectorRef, { optional: true });
14942
15041
  if (cdr)
14943
15042
  queueMicrotask(() => cdr.markForCheck());
14944
15043
  } catch {}
14945
15044
  };
14946
15045
  // src/angular/pendingTask.ts
14947
- import { inject as inject2, PendingTasks } from "@angular/core";
15046
+ import { inject as inject5, PendingTasks } from "@angular/core";
14948
15047
  var withPendingTask = async (work) => {
14949
- const removeTask = inject2(PendingTasks).add();
15048
+ const removeTask = inject5(PendingTasks).add();
14950
15049
  try {
14951
15050
  return await work();
14952
15051
  } finally {
@@ -15146,9 +15245,8 @@ import {
15146
15245
  ChangeDetectorRef as ChangeDetectorRef2,
15147
15246
  Component as Component2,
15148
15247
  Input as Input2,
15149
- NgZone,
15150
- inject as inject3,
15151
- signal
15248
+ inject as inject6,
15249
+ signal as signal2
15152
15250
  } from "@angular/core";
15153
15251
  import { DomSanitizer } from "@angular/platform-browser";
15154
15252
  var isObjectRecord5 = (value) => Boolean(value) && typeof value === "object";
@@ -15164,17 +15262,14 @@ class StreamSlotComponent {
15164
15262
  constructor() {
15165
15263
  this.fallbackHtml = "";
15166
15264
  }
15167
- cdr = inject3(ChangeDetectorRef2);
15168
- sanitizer = inject3(DomSanitizer);
15169
- zone = inject3(NgZone);
15265
+ cdr = inject6(ChangeDetectorRef2);
15266
+ sanitizer = inject6(DomSanitizer);
15170
15267
  slotConsumer = (payload) => {
15171
- this.zone.run(() => {
15172
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
15173
- this.cdr.markForCheck();
15174
- });
15268
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
15269
+ this.cdr.markForCheck();
15175
15270
  return true;
15176
15271
  };
15177
- currentHtml = signal("");
15272
+ currentHtml = signal2("");
15178
15273
  ngOnInit() {
15179
15274
  if (isStreamingSlotCollectionActive()) {
15180
15275
  this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
@@ -15253,6 +15348,9 @@ StreamSlotComponent = __legacyDecorateClassTS([
15253
15348
  ], StreamSlotComponent);
15254
15349
  export {
15255
15350
  withPendingTask,
15351
+ useTimers,
15352
+ useSubscription,
15353
+ useResource,
15256
15354
  renderIsland,
15257
15355
  provideDeterministicEnv,
15258
15356
  preserveAcrossHmr,
@@ -15271,5 +15369,5 @@ export {
15271
15369
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
15272
15370
  };
15273
15371
 
15274
- //# debugId=C34B09637A6FD85164756E2164756E21
15372
+ //# debugId=3A256F17E39BD18164756E2164756E21
15275
15373
  //# sourceMappingURL=index.js.map