@absolutejs/absolute 0.19.0-beta.981 → 0.19.0-beta.982

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-JL9YDz/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-2Ztb8l/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-JL9YDz/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-2Ztb8l/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-JL9YDz/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-2Ztb8l/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";
@@ -14973,9 +14973,24 @@ var useResource = (fetcher, options = {}) => {
14973
14973
  // src/angular/composables/useSubscription.ts
14974
14974
  import { DestroyRef as DestroyRef2, inject as inject3 } from "@angular/core";
14975
14975
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
14976
- function useSubscription(observable, observerOrNext) {
14977
- const destroyRef = inject3(DestroyRef2);
14978
- return observable.pipe(takeUntilDestroyed(destroyRef)).subscribe(typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext);
14976
+ var warnedOnce = false;
14977
+ var tryCaptureDestroyRef = () => {
14978
+ try {
14979
+ return inject3(DestroyRef2);
14980
+ } catch {
14981
+ if (!warnedOnce) {
14982
+ warnedOnce = true;
14983
+ console.warn("[absolute/angular] useSubscription was called outside an Angular injection context (likely from a lifecycle hook). Auto-teardown via takeUntilDestroyed is disabled for that call; the subscription will leak unless the caller manually unsubscribes. Move the call to a field initializer or the constructor, or pass the captured DestroyRef as the third argument.");
14984
+ }
14985
+ return null;
14986
+ }
14987
+ };
14988
+ function useSubscription(observable, observerOrNext, destroyRef) {
14989
+ const captured = destroyRef ?? tryCaptureDestroyRef();
14990
+ const observer = typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext;
14991
+ if (!captured)
14992
+ return observable.subscribe(observer);
14993
+ return observable.pipe(takeUntilDestroyed(captured)).subscribe(observer);
14979
14994
  }
14980
14995
  // src/angular/composables/useTimers.ts
14981
14996
  import { DestroyRef as DestroyRef3, inject as inject4 } from "@angular/core";
@@ -15423,5 +15438,5 @@ export {
15423
15438
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
15424
15439
  };
15425
15440
 
15426
- //# debugId=DC31DE3FC1E8823E64756E2164756E21
15441
+ //# debugId=F34843F550663CE764756E2164756E21
15427
15442
  //# sourceMappingURL=index.js.map