@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.
@@ -9136,17 +9136,12 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9136
9136
  return actual.startsWith(prefix);
9137
9137
  }
9138
9138
  return actual === pattern;
9139
- }, MIME_MAP, isSharpFactory = (value) => typeof value === "function", callSharp = (sharpRef, input) => {
9140
- if (!isSharpFactory(sharpRef)) {
9141
- throw new Error("Loaded sharp module is not callable.");
9142
- }
9143
- return sharpRef(input);
9144
- }, toBuffer = (input) => {
9139
+ }, MIME_MAP, isSharpFactory = (value) => typeof value === "function", toBuffer = (input) => {
9145
9140
  if (Buffer.isBuffer(input))
9146
9141
  return input;
9147
9142
  return Buffer.from(input);
9148
- }, buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`, formatToMime = (format) => MIME_MAP[format], generateBlurSvg = (base64Thumbnail) => {
9149
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
9143
+ }, isUnsupportedFormatError = (err) => typeof err === "object" && err !== null && ("code" in err) && err.code === "ERR_IMAGE_FORMAT_UNSUPPORTED", buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`, formatToMime = (format) => MIME_MAP[format], generateBlurSvg = (base64Thumbnail) => {
9144
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
9150
9145
  const encoded = encodeURIComponent(svg);
9151
9146
  return `url("data:image/svg+xml,${encoded}")`;
9152
9147
  }, generateSrcSet = (src, width, sizes, config, loader) => {
@@ -9206,11 +9201,24 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9206
9201
  return "webp";
9207
9202
  }
9208
9203
  return "jpeg";
9209
- }, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, optimizeImage = async (buffer, width, quality, format) => {
9210
- const sharp = await tryLoadSharp();
9211
- if (!sharp)
9212
- return toBuffer(buffer);
9213
- const pipeline = callSharp(sharp, toBuffer(buffer)).rotate().resize(width, undefined, { withoutEnlargement: true });
9204
+ }, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, PNG_COMPRESSION_LEVEL = 9, optimizeWithBunImage = async (buffer, width, quality, format) => {
9205
+ const pipeline = new Bun.Image(buffer).resize(width, undefined, {
9206
+ withoutEnlargement: true
9207
+ });
9208
+ switch (format) {
9209
+ case "avif":
9210
+ return pipeline.avif({
9211
+ quality: Math.max(1, quality - AVIF_QUALITY_OFFSET)
9212
+ }).toBuffer();
9213
+ case "jpeg":
9214
+ return pipeline.jpeg({ quality }).toBuffer();
9215
+ case "png":
9216
+ return pipeline.png({ compressionLevel: PNG_COMPRESSION_LEVEL }).toBuffer();
9217
+ case "webp":
9218
+ return pipeline.webp({ quality }).toBuffer();
9219
+ }
9220
+ }, optimizeWithSharp = async (sharpRef, buffer, width, quality, format) => {
9221
+ const pipeline = sharpRef(buffer).rotate().resize(width, undefined, { withoutEnlargement: true });
9214
9222
  switch (format) {
9215
9223
  case "avif":
9216
9224
  return pipeline.avif({
@@ -9223,8 +9231,19 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9223
9231
  return pipeline.png({ quality }).toBuffer();
9224
9232
  case "webp":
9225
9233
  return pipeline.webp({ quality }).toBuffer();
9226
- default:
9227
- return toBuffer(buffer);
9234
+ }
9235
+ }, optimizeImage = async (buffer, width, quality, format) => {
9236
+ const input = toBuffer(buffer);
9237
+ try {
9238
+ return await optimizeWithBunImage(input, width, quality, format);
9239
+ } catch (err) {
9240
+ if (format === "avif" && isUnsupportedFormatError(err)) {
9241
+ const sharp = await tryLoadSharp();
9242
+ if (sharp && isSharpFactory(sharp)) {
9243
+ return optimizeWithSharp(sharp, input, width, quality, format);
9244
+ }
9245
+ }
9246
+ throw err;
9228
9247
  }
9229
9248
  }, readFromCache = (cacheDir, cacheKey) => {
9230
9249
  const metaPath = join(cacheDir, `${cacheKey}.meta`);
@@ -9251,7 +9270,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9251
9270
  if (sharpWarned)
9252
9271
  return null;
9253
9272
  sharpWarned = true;
9254
- console.warn("[image] sharp not installed \u2014 serving unoptimized images. Install with: bun add sharp");
9273
+ console.warn('[image] AVIF requested but sharp not installed and Bun.Image cannot encode AVIF on this platform. Install sharp (`bun add sharp`) to enable AVIF, or remove "avif" from your image formats config. See docs/SHARP_REMOVAL.md for context.');
9255
9274
  return null;
9256
9275
  }
9257
9276
  }, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
@@ -9374,8 +9393,107 @@ var provideDeterministicEnv = (options = {}) => {
9374
9393
  };
9375
9394
  // src/angular/page.ts
9376
9395
  var defineAngularPage = (definition) => definition;
9396
+ // src/angular/composables/useResource.ts
9397
+ import { DestroyRef, inject, signal } from "@angular/core";
9398
+ var useResource = (fetcher, options = {}) => {
9399
+ const destroyRef = inject(DestroyRef);
9400
+ const data = signal(null);
9401
+ const error = signal(null);
9402
+ const loading = signal(false);
9403
+ let controller = null;
9404
+ let destroyed = false;
9405
+ const cancel = () => {
9406
+ if (controller) {
9407
+ controller.abort();
9408
+ controller = null;
9409
+ }
9410
+ };
9411
+ const refresh = async () => {
9412
+ if (destroyed)
9413
+ return;
9414
+ cancel();
9415
+ const next = new AbortController;
9416
+ controller = next;
9417
+ loading.set(true);
9418
+ error.set(null);
9419
+ try {
9420
+ const result = await fetcher(next.signal);
9421
+ if (next.signal.aborted)
9422
+ return;
9423
+ data.set(result);
9424
+ } catch (cause) {
9425
+ if (next.signal.aborted)
9426
+ return;
9427
+ error.set(cause);
9428
+ } finally {
9429
+ if (controller === next) {
9430
+ controller = null;
9431
+ }
9432
+ if (!next.signal.aborted) {
9433
+ loading.set(false);
9434
+ }
9435
+ }
9436
+ };
9437
+ destroyRef.onDestroy(() => {
9438
+ destroyed = true;
9439
+ cancel();
9440
+ });
9441
+ if (options.immediate !== false) {
9442
+ refresh();
9443
+ }
9444
+ return { cancel, data, error, loading, refresh };
9445
+ };
9446
+ // src/angular/composables/useSubscription.ts
9447
+ import { DestroyRef as DestroyRef2, inject as inject2 } from "@angular/core";
9448
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
9449
+ function useSubscription(observable, observerOrNext) {
9450
+ const destroyRef = inject2(DestroyRef2);
9451
+ return observable.pipe(takeUntilDestroyed(destroyRef)).subscribe(typeof observerOrNext === "function" ? { next: observerOrNext } : observerOrNext);
9452
+ }
9453
+ // src/angular/composables/useTimers.ts
9454
+ import { DestroyRef as DestroyRef3, inject as inject3 } from "@angular/core";
9455
+ var useTimers = () => {
9456
+ const destroyRef = inject3(DestroyRef3);
9457
+ const timeouts = new Set;
9458
+ const intervals = new Set;
9459
+ const clearAll = () => {
9460
+ timeouts.forEach((timer) => clearTimeout(timer));
9461
+ intervals.forEach((timer) => clearInterval(timer));
9462
+ timeouts.clear();
9463
+ intervals.clear();
9464
+ };
9465
+ destroyRef.onDestroy(clearAll);
9466
+ return {
9467
+ clearAll,
9468
+ clearInterval(timer) {
9469
+ if (!timer)
9470
+ return;
9471
+ clearInterval(timer);
9472
+ intervals.delete(timer);
9473
+ },
9474
+ clearTimeout(timer) {
9475
+ if (!timer)
9476
+ return;
9477
+ clearTimeout(timer);
9478
+ timeouts.delete(timer);
9479
+ },
9480
+ setInterval(callback, delayMs) {
9481
+ const timer = setInterval(callback, delayMs);
9482
+ intervals.add(timer);
9483
+ return timer;
9484
+ },
9485
+ setTimeout(callback, delayMs) {
9486
+ const timer = setTimeout(() => {
9487
+ timeouts.delete(timer);
9488
+ callback();
9489
+ }, delayMs);
9490
+ timeouts.add(timer);
9491
+ return timer;
9492
+ }
9493
+ };
9494
+ };
9377
9495
  // src/angular/preserveAcrossHmr.ts
9378
- import { ChangeDetectorRef, inject } from "@angular/core";
9496
+ import { ChangeDetectorRef, inject as inject4 } from "@angular/core";
9379
9497
 
9380
9498
  // src/angular/hmrPreserveCore.ts
9381
9499
  var isHmrPreserveDev = () => {
@@ -9446,7 +9564,7 @@ var preserveAcrossHmr = (instance, key) => {
9446
9564
  if (!restored)
9447
9565
  return;
9448
9566
  try {
9449
- const cdr = inject(ChangeDetectorRef, { optional: true });
9567
+ const cdr = inject4(ChangeDetectorRef, { optional: true });
9450
9568
  if (cdr)
9451
9569
  queueMicrotask(() => cdr.markForCheck());
9452
9570
  } catch {}
@@ -9604,9 +9722,9 @@ Island = __legacyDecorateClassTS([
9604
9722
  })
9605
9723
  ], Island);
9606
9724
  // src/angular/pendingTask.ts
9607
- import { inject as inject2, PendingTasks } from "@angular/core";
9725
+ import { inject as inject5, PendingTasks } from "@angular/core";
9608
9726
  var withPendingTask = async (work) => {
9609
- const removeTask = inject2(PendingTasks).add();
9727
+ const removeTask = inject5(PendingTasks).add();
9610
9728
  try {
9611
9729
  return await work();
9612
9730
  } finally {
@@ -9761,8 +9879,8 @@ import {
9761
9879
  Component as Component2,
9762
9880
  ContentChild,
9763
9881
  Input as Input2,
9764
- inject as inject4,
9765
- signal
9882
+ inject as inject7,
9883
+ signal as signal2
9766
9884
  } from "@angular/core";
9767
9885
  import { NgTemplateOutlet } from "@angular/common";
9768
9886
 
@@ -9775,9 +9893,9 @@ var isAngularDeferSlotPayload = (value) => {
9775
9893
  };
9776
9894
 
9777
9895
  // src/angular/components/defer-slot-templates.directive.ts
9778
- import { Directive, TemplateRef, inject as inject3 } from "@angular/core";
9896
+ import { Directive, TemplateRef, inject as inject6 } from "@angular/core";
9779
9897
  class DeferErrorTemplateDirective {
9780
- templateRef = inject3(TemplateRef);
9898
+ templateRef = inject6(TemplateRef);
9781
9899
  }
9782
9900
  DeferErrorTemplateDirective = __legacyDecorateClassTS([
9783
9901
  Directive({
@@ -9787,7 +9905,7 @@ DeferErrorTemplateDirective = __legacyDecorateClassTS([
9787
9905
  ], DeferErrorTemplateDirective);
9788
9906
 
9789
9907
  class DeferFallbackTemplateDirective {
9790
- templateRef = inject3(TemplateRef);
9908
+ templateRef = inject6(TemplateRef);
9791
9909
  }
9792
9910
  DeferFallbackTemplateDirective = __legacyDecorateClassTS([
9793
9911
  Directive({
@@ -9797,7 +9915,7 @@ DeferFallbackTemplateDirective = __legacyDecorateClassTS([
9797
9915
  ], DeferFallbackTemplateDirective);
9798
9916
 
9799
9917
  class DeferResolvedTemplateDirective {
9800
- templateRef = inject3(TemplateRef);
9918
+ templateRef = inject6(TemplateRef);
9801
9919
  }
9802
9920
  DeferResolvedTemplateDirective = __legacyDecorateClassTS([
9803
9921
  Directive({
@@ -9811,11 +9929,11 @@ class DeferSlotComponent {
9811
9929
  constructor() {
9812
9930
  this.id = "";
9813
9931
  }
9814
- cdr = inject4(ChangeDetectorRef2);
9815
- runtimeReady = signal(false);
9932
+ cdr = inject7(ChangeDetectorRef2);
9933
+ runtimeReady = signal2(false);
9816
9934
  serverSlotRegistered = false;
9817
- slotData = signal({});
9818
- state = signal("fallback");
9935
+ slotData = signal2({});
9936
+ state = signal2("fallback");
9819
9937
  activeTemplate = () => {
9820
9938
  if (this.state() === "resolved") {
9821
9939
  return this.resolvedTemplate?.templateRef ?? null;
@@ -9947,7 +10065,7 @@ DeferSlotComponent = __legacyDecorateClassTS([
9947
10065
  ], DeferSlotComponent);
9948
10066
  // src/angular/components/image.component.ts
9949
10067
  init_imageProcessing();
9950
- import { Component as Component3, computed, input, signal as signal2 } from "@angular/core";
10068
+ import { Component as Component3, computed, input, signal as signal3 } from "@angular/core";
9951
10069
  import { NgStyle } from "@angular/common";
9952
10070
  var resolveBlurBg = (placeholderValue, blurDataUrl) => {
9953
10071
  if (typeof placeholderValue === "string" && placeholderValue !== "blur" && placeholderValue.startsWith("data:")) {
@@ -9980,7 +10098,7 @@ class ImageComponent {
9980
10098
  style = input();
9981
10099
  unoptimized = input(false);
9982
10100
  width = input();
9983
- blurRemoved = signal2(false);
10101
+ blurRemoved = signal3(false);
9984
10102
  resolvedSrc = computed(() => {
9985
10103
  const override = this.overrideSrc();
9986
10104
  if (override)
@@ -10094,9 +10212,8 @@ import {
10094
10212
  ChangeDetectorRef as ChangeDetectorRef3,
10095
10213
  Component as Component4,
10096
10214
  Input as Input3,
10097
- NgZone,
10098
- inject as inject5,
10099
- signal as signal3
10215
+ inject as inject8,
10216
+ signal as signal4
10100
10217
  } from "@angular/core";
10101
10218
  import { DomSanitizer } from "@angular/platform-browser";
10102
10219
  var isObjectRecord3 = (value) => Boolean(value) && typeof value === "object";
@@ -10112,17 +10229,14 @@ class StreamSlotComponent {
10112
10229
  constructor() {
10113
10230
  this.fallbackHtml = "";
10114
10231
  }
10115
- cdr = inject5(ChangeDetectorRef3);
10116
- sanitizer = inject5(DomSanitizer);
10117
- zone = inject5(NgZone);
10232
+ cdr = inject8(ChangeDetectorRef3);
10233
+ sanitizer = inject8(DomSanitizer);
10118
10234
  slotConsumer = (payload) => {
10119
- this.zone.run(() => {
10120
- this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
10121
- this.cdr.markForCheck();
10122
- });
10235
+ this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(resolvePayloadHtml(payload)));
10236
+ this.cdr.markForCheck();
10123
10237
  return true;
10124
10238
  };
10125
- currentHtml = signal3("");
10239
+ currentHtml = signal4("");
10126
10240
  ngOnInit() {
10127
10241
  if (isStreamingSlotCollectionActive()) {
10128
10242
  this.currentHtml.set(this.sanitizer.bypassSecurityTrustHtml(this.fallbackHtml));
@@ -10206,6 +10320,9 @@ var renderIsland = async () => {
10206
10320
  };
10207
10321
  export {
10208
10322
  withPendingTask,
10323
+ useTimers,
10324
+ useSubscription,
10325
+ useResource,
10209
10326
  renderIsland,
10210
10327
  provideDeterministicEnv,
10211
10328
  preserveAcrossHmr,
@@ -10227,5 +10344,5 @@ export {
10227
10344
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
10228
10345
  };
10229
10346
 
10230
- //# debugId=9D6243A1FB854B4064756E2164756E21
10347
+ //# debugId=FD9C5AD1A03DDE0F64756E2164756E21
10231
10348
  //# sourceMappingURL=browser.js.map