docblocks-react-ui 0.22.0 → 0.23.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # docblocks-react-ui
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bb8b0fc: An image renders straight from the store's `downloadUrl` when the store
8
+ supplies both optional members: the `image` block's `<img>` src is
9
+ `downloadUrl(fileId)` — the browser's own cacheable subrequest — instead of
10
+ the bytes fetched over `get` into an object URL. A response fetched into a
11
+ blob URL never reuses the native response cache on WebKit, so a page reload
12
+ in Safari re-downloaded every image regardless of the backend's
13
+ `Cache-Control: immutable`.
14
+
15
+ The document attributes' cover stands the same contract: the banner, the
16
+ row's thumbnail and the preset cells render the store's URL, and the
17
+ intrinsic-dimension probe plus the frame's tint read that same URL instead
18
+ of decoding the blob (a cross-origin URL without CORS taints the tint's
19
+ canvas — the tint falls back to the fetched bytes' same-origin object URL).
20
+
21
+ `getMeta` still decides the MIME and reserves the placeholder's aspect
22
+ ratio; the consumer's URL must serve the payload inline (a
23
+ `Content-Disposition: attachment` response suits the download card only).
24
+ PDF payloads (the preview and the native iframe), a store without `getMeta`
25
+ (the MIME is unknown before the bytes) and an executable-scheme URL keep
26
+ the bytes' path; without `downloadUrl` nothing changes.
27
+
3
28
  ## 0.22.0
4
29
 
5
30
  ### Minor Changes
package/README.md CHANGED
@@ -470,14 +470,31 @@ interface BlobStore {
470
470
  - **The meta-only stand (opt-in):** with the optional `getMeta` member the
471
471
  blocks resolve the metadata first (a cheap head stand, no body transfer).
472
472
  A MIME the block renders — `application/pdf` for the `file` block, the
473
- `image/*` and `application/pdf` payloads for the `image` block — still
474
- resolves the bytes over `get` (the pdf preview / the `<img>` stand
475
- unchanged); any other MIME stands the download card WITHOUT fetching the
476
- bytes (no `get` call, no object URL), the download's href standing the
477
- consumer's `downloadUrl(fileId)`. Without `getMeta` — or without
478
- `downloadUrl` — the blocks keep the legacy stand (the bytes over `get`,
479
- the object URL's href). Both members are optional: existing consumers and
473
+ `image/*` and `application/pdf` payloads for the `image` block — resolves
474
+ the bytes over `get` (the pdf preview / the `<img>` stand), except for an
475
+ image the store's `downloadUrl` serves (the next bullet); any other MIME
476
+ stands the download card WITHOUT fetching the bytes (no `get` call, no
477
+ object URL), the download's href standing the consumer's
478
+ `downloadUrl(fileId)`. Without `getMeta` — or without `downloadUrl` — the
479
+ blocks keep the legacy stand (the bytes over `get`, the object URL's
480
+ href). Both members are optional: existing consumers and
480
481
  `createMemoryBlobStore` stand exactly the legacy behavior.
482
+ - **The direct image URL:** an `image/*` payload over a store that supplies
483
+ both `getMeta` and `downloadUrl` renders `<img src={downloadUrl(fileId)}>`
484
+ — the browser's own subrequest, cached natively. The library neither
485
+ fetches the bytes nor creates an object URL: a `fetch`-resolved blob URL
486
+ never reuses the native cache on WebKit, so every page reload
487
+ re-downloaded the images. `getMeta` still decides the MIME and reserves
488
+ the placeholder's aspect ratio, and `downloadUrl` serves the payload
489
+ inline (a `Content-Disposition: attachment` response suits the download
490
+ card only). PDF payloads stay on the bytes' path (the preview and the
491
+ iframe read the bytes); without `getMeta` — the MIME is unknown before
492
+ the bytes — or over an executable-scheme URL, an image keeps that path as
493
+ well. The document attributes' cover stands the same contract: the
494
+ banner, the row's thumbnail and the preset cells render the store's URL,
495
+ and the intrinsic-dimension probe plus the frame's tint read that same
496
+ URL (a cross-origin URL without CORS taints the tint's canvas — the tint
497
+ falls back to the fetched bytes' same-origin object URL).
481
498
  - **The lazy resolution (the default):** the metadata's head lookup runs at
482
499
  mount (the placeholder reserves the aspect ratio from `width`/`height`),
483
500
  and the bytes resolve only once the block enters the preload band — the
@@ -905,7 +922,9 @@ value actually changes (the store's reference-stability contract):
905
922
  - `useCoverAverageColor()` — the stored cover's alpha-weighted average
906
923
  color (the `rgb(...)` string or `null` over the absent / the
907
924
  undecodable's stand) — the frame's tint's data and the consumer's
908
- surroundings' glow's source.
925
+ surroundings' glow's source. The read stands over the cover's resolved
926
+ URL (the store's `downloadUrl` when supplied, the object URL otherwise);
927
+ a cross-origin URL without CORS falls back to the fetched bytes.
909
928
  - `useDatabaseTable(bridge, tableId, filter?)` — the external database
910
929
  block's grid controller (a consumer-owned grid over the bridge).
911
930
 
@@ -12343,25 +12343,29 @@ function useInView(options = {}) {
12343
12343
  * on (a document of images resolves its first screen only).
12344
12344
  *
12345
12345
  * With a `getMeta` member the non-renderable MIME (the predicate) stands
12346
- * the meta-only view when the store supplies a `downloadUrl`; the
12347
- * renderable MIME (and the absent `downloadUrl`) resolves the bytes over
12348
- * `get` as before. Without `getMeta` the resolution stands the legacy
12349
- * path's phases: no metadata before the bytes, the bytes over `get` once
12350
- * the block is in view. A store change re-resolves over the current band,
12351
- * and a view that already resolved never falls back to the placeholder
12352
- * outside it.
12346
+ * the meta-only view when the store supplies a `downloadUrl`; a renderable
12347
+ * MIME the `rendersFromUrl` predicate claims stands the direct-URL view (the
12348
+ * image's own `<img>` subrequest, no bytes in the JS heap) over the same
12349
+ * store member; the remaining renderable MIME (and the absent
12350
+ * `downloadUrl`) resolves the bytes over `get` as before. Without `getMeta`
12351
+ * the resolution stands the legacy path's phases: no metadata before the
12352
+ * bytes, the bytes over `get` once the block is in view. A store change
12353
+ * re-resolves over the current band, and a view that already resolved never
12354
+ * falls back to the placeholder outside it. An empty `fileId` stands the
12355
+ * missing stand without a store read (an absent cover's row).
12353
12356
  */
12354
12357
  function useBlobFile(fileId, rendersBytes, options = {}) {
12355
12358
  const { blobStore, scrollContainer } = useEditorContext();
12356
12359
  const getMeta = blobStore.getMeta;
12360
+ const rendersFromUrl = options.rendersFromUrl;
12357
12361
  const [ref, setRef] = useState(null);
12358
- const [metaView, setMetaView] = useState(null);
12362
+ const [urlView, setUrlView] = useState(null);
12359
12363
  /** The head's metadata (the loading stand's aspect-ratio input). */
12360
12364
  const [headMeta, setHeadMeta] = useState(null);
12361
12365
  /** The resolution's rejection (the missing stand) — a resolve clears it. */
12362
12366
  const [failed, setFailed] = useState(false);
12363
12367
  const [view, setView] = useState(null);
12364
- const headSettled = options.eager === true || blobStore.getMeta === void 0 || headMeta !== null || metaView !== null || failed;
12368
+ const headSettled = options.eager === true || blobStore.getMeta === void 0 || headMeta !== null || urlView !== null || failed;
12365
12369
  const { ref: observeRef, inView } = useInView({
12366
12370
  disabled: options.eager === true,
12367
12371
  ready: headSettled,
@@ -12377,19 +12381,24 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
12377
12381
  let alive = true;
12378
12382
  let sequence = 0;
12379
12383
  setRef(null);
12380
- setMetaView(null);
12384
+ setUrlView(null);
12381
12385
  setHeadMeta(null);
12382
12386
  setFailed(false);
12383
12387
  loadedRef.current = false;
12388
+ if (fileId === "") {
12389
+ setFailed(true);
12390
+ return;
12391
+ }
12384
12392
  /** The head's resolved stand over this resolution's lifetime: the
12385
12393
  * band's entry reuses it (the store's change re-reads it fresh). */
12386
12394
  let head = null;
12387
12395
  /** The head's in-flight request: a non-fresh load joins it instead of
12388
12396
  * issuing a second lookup while one is pending. */
12389
12397
  let headRequest = null;
12390
- /** The head decided the meta-only card (no bytes stand over any band). */
12391
- let metaOnly = false;
12398
+ /** The head decided a store-URL stand (no bytes stand over any band). */
12399
+ let urlOnly = false;
12392
12400
  const load = async (freshHead) => {
12401
+ if (fileId === "") return;
12393
12402
  const request = ++sequence;
12394
12403
  const current = () => alive && request === sequence;
12395
12404
  try {
@@ -12402,29 +12411,43 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
12402
12411
  head = meta;
12403
12412
  setHeadMeta(meta);
12404
12413
  const downloadUrl = blobStore.downloadUrl;
12405
- if (downloadUrl !== void 0 && rendersBytes !== void 0 && !rendersBytes(meta.mimeType)) {
12406
- metaOnly = true;
12414
+ const url = downloadUrl === void 0 ? null : downloadUrl(fileId);
12415
+ urlOnly = false;
12416
+ if (url !== null && rendersBytes !== void 0 && !rendersBytes(meta.mimeType)) {
12417
+ urlOnly = true;
12418
+ setRef(null);
12419
+ setUrlView({
12420
+ status: "ready-meta",
12421
+ meta,
12422
+ url
12423
+ });
12424
+ setFailed(false);
12425
+ return;
12426
+ }
12427
+ if (url !== null && rendersFromUrl !== void 0 && rendersFromUrl(meta.mimeType) && isSafeDownloadHref(url)) {
12428
+ urlOnly = true;
12407
12429
  setRef(null);
12408
- setMetaView({
12430
+ setUrlView({
12431
+ status: "ready-url",
12409
12432
  meta,
12410
- url: downloadUrl(fileId)
12433
+ url
12411
12434
  });
12412
12435
  setFailed(false);
12413
12436
  return;
12414
12437
  }
12415
- } else if (metaOnly) return;
12438
+ } else if (urlOnly) return;
12416
12439
  }
12417
12440
  if (!inViewRef.current) return;
12418
12441
  const next = await blobStore.get(fileId);
12419
12442
  if (!current()) return;
12420
12443
  loadedRef.current = true;
12421
12444
  setRef(next);
12422
- setMetaView(null);
12445
+ setUrlView(null);
12423
12446
  setFailed(false);
12424
12447
  } catch {
12425
12448
  if (!current()) return;
12426
12449
  setRef(null);
12427
- setMetaView(null);
12450
+ setUrlView(null);
12428
12451
  setFailed(true);
12429
12452
  }
12430
12453
  };
@@ -12442,7 +12465,8 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
12442
12465
  }, [
12443
12466
  blobStore,
12444
12467
  fileId,
12445
- rendersBytes
12468
+ rendersBytes,
12469
+ rendersFromUrl
12446
12470
  ]);
12447
12471
  useEffect(() => {
12448
12472
  inViewRef.current = inView;
@@ -12472,11 +12496,8 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
12472
12496
  },
12473
12497
  ref: observeRef
12474
12498
  };
12475
- if (metaView !== null) return {
12476
- state: {
12477
- status: "ready-meta",
12478
- ...metaView
12479
- },
12499
+ if (urlView !== null) return {
12500
+ state: urlView,
12480
12501
  ref: observeRef
12481
12502
  };
12482
12503
  if (failed) return {
@@ -29011,19 +29032,30 @@ function ImageFigure({ id, block, url, name, width, height }) {
29011
29032
  * `downloadUrl`). A module-level const keeps the predicate's identity
29012
29033
  * stable (the resolution's effect's dep). */
29013
29034
  const IMAGE_RENDERS_BYTES = (mimeType) => mimeType.startsWith("image/") || mimeType === "application/pdf";
29035
+ /** The MIME the `<img>` renders straight from the store's `downloadUrl`: the
29036
+ * browser's own cacheable subrequest over the consumer's URL. The PDF keeps
29037
+ * the bytes' path (the preview and the iframe read the payload). A
29038
+ * module-level const keeps the predicate's identity stable (the
29039
+ * resolution's effect's dep). */
29040
+ const IMAGE_RENDERS_URL = (mimeType) => mimeType.startsWith("image/");
29014
29041
  /**
29015
29042
  * An image: the <img> src comes from the consumer's blob store (the key is
29016
29043
  * opaque; resolution is a consumer-side concern). The store's MIME metadata
29017
29044
  * decides the rendering: images stand the <img>, PDF an iframe viewer, and
29018
- * legacy non-image payloads the download card. While the id is unknown or
29019
- * the get is in flight the block renders
29020
- * a structural placeholder card instead of a broken <img>.
29045
+ * legacy non-image payloads the download card. An image resolves from the
29046
+ * store's `downloadUrl` when it supplies one — the browser fetches and
29047
+ * caches it natively instead of the library's `get` + object URL. While the
29048
+ * id is unknown or the get is in flight the block renders a structural
29049
+ * placeholder card instead of a broken <img>.
29021
29050
  */
29022
29051
  function ImageBlock({ id, block }) {
29023
29052
  const { t } = useTranslation("blocks");
29024
29053
  const { pdfPreview, blobLoading } = useEditorContext();
29025
29054
  const src = block.attrs.src;
29026
- const { state: file, ref: placeholderRef } = useBlobFile(src, IMAGE_RENDERS_BYTES, blobLoading === "eager" ? { eager: true } : {});
29055
+ const { state: file, ref: placeholderRef } = useBlobFile(src, IMAGE_RENDERS_BYTES, {
29056
+ eager: blobLoading === "eager",
29057
+ rendersFromUrl: IMAGE_RENDERS_URL
29058
+ });
29027
29059
  if (file.status === "loading" || file.status === "missing") return /* @__PURE__ */ jsx(Card, {
29028
29060
  ref: placeholderRef,
29029
29061
  "data-slot": "docblocks/image-placeholder",
@@ -29038,6 +29070,14 @@ function ImageBlock({ id, block }) {
29038
29070
  children: [file.status === "loading" ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-6 animate-spin" }) : /* @__PURE__ */ jsx(Image$1, { className: "size-6" }), t("image.placeholder")]
29039
29071
  })
29040
29072
  });
29073
+ if (file.status === "ready-url") return /* @__PURE__ */ jsx(ImageFigure, {
29074
+ id,
29075
+ block,
29076
+ url: file.url,
29077
+ name: file.meta.name,
29078
+ width: file.meta.width,
29079
+ height: file.meta.height
29080
+ });
29041
29081
  if (file.status === "ready-meta") return /* @__PURE__ */ jsx(FileCard, {
29042
29082
  id,
29043
29083
  fileId: src,
@@ -36531,18 +36571,20 @@ const COVER_ACCEPTED_MIME_TYPES = [
36531
36571
  "image/jpeg",
36532
36572
  "image/webp"
36533
36573
  ];
36534
- /** The cover's renderable-MIME's predicate. A module-level const keeps the
36535
- * predicate's identity stable (the resolution's effect's dep — an inline
36536
- * arrow re-runs the effect on every render). The lenient's `image/*`'s
36537
- * stand: the legacy's covers may stand a format outside the upload's
36538
- * strict's gate. */
36539
- const COVER_RENDERS_BYTES = (mimeType) => mimeType.startsWith("image/");
36574
+ /** The cover's renderable-MIME's predicate (both the bytes' path and the
36575
+ * store's direct URL render an image the same way). A module-level const
36576
+ * keeps the predicate's identity stable (the resolution's effect's dep —
36577
+ * an inline arrow re-runs the effect on every render). The lenient's
36578
+ * `image/*`'s stand: the legacy's covers may stand a format outside the
36579
+ * upload's strict's gate. */
36580
+ const COVER_RENDERS_IMAGE = (mimeType) => mimeType.startsWith("image/");
36540
36581
  /** The cover mode's ordered options (the tile's stand stands first — the
36541
36582
  * selector's default's stand). */
36542
36583
  const COVER_MODE_ORDER = ["tile", "center"];
36543
36584
  /**
36544
36585
  * The intrinsic dimensions over a decodable image blob (the
36545
- * `createImageBitmap` decode probe — the bytes are never rendered).
36586
+ * `createImageBitmap` decode probe — the bytes are never rendered). The
36587
+ * picked file's upload validation reads them before a store exists.
36546
36588
  * `null` over an undecodable payload (the fail-open: the consumer's
36547
36589
  * renderer may accept a format the browser cannot probe).
36548
36590
  */
@@ -36561,82 +36603,82 @@ async function readImageDimensions(file) {
36561
36603
  return null;
36562
36604
  }
36563
36605
  }
36606
+ /**
36607
+ * The browser's decode over an image url: the store's direct URL or the
36608
+ * library's own object URL. The element carries the intrinsic dimensions,
36609
+ * and the tint draws it into the sample's canvas — a `blob:` url stays
36610
+ * same-origin, so that read never taints. `null` over an undecodable
36611
+ * payload.
36612
+ */
36613
+ async function decodeImageUrl(url) {
36614
+ const img = new Image();
36615
+ img.src = url;
36616
+ try {
36617
+ await img.decode();
36618
+ return img;
36619
+ } catch {
36620
+ return null;
36621
+ }
36622
+ }
36623
+ /**
36624
+ * The intrinsic dimensions over a resolved image url (the display path's
36625
+ * probe — the browser decodes the very image the cover renders, so its own
36626
+ * cache serves the payload). `null` over an undecodable payload or a
36627
+ * zero-sized element (the fail-open stands the caller's own rendering).
36628
+ */
36629
+ async function readUrlDimensions(url) {
36630
+ const img = await decodeImageUrl(url);
36631
+ if (img === null || img.naturalWidth === 0 || img.naturalHeight === 0) return null;
36632
+ return {
36633
+ width: img.naturalWidth,
36634
+ height: img.naturalHeight
36635
+ };
36636
+ }
36564
36637
  /** The frame's tint's CSS variable (the cover's average color's stand
36565
36638
  * over the card's element — the border's mix's input). */
36566
36639
  const COVER_TINT_VARIABLE = "--docblocks-cover-tint-color";
36567
36640
  /** The tint's average's sample's size (the pixel's count per side — the
36568
36641
  * grid's area's mean over the image's downscale). */
36569
36642
  const TINT_SAMPLE_PX = 8;
36570
- /** The image's decode over the `<img>`'s element (the SVG's stand — the
36571
- * `createImageBitmap`'s rejection's parity: the engine refuses the SVG's
36572
- * blob over the bitmap's API, while the image's decode accepts it over
36573
- * the raster's formats' parity). The object URL's lifecycle stands the
36574
- * decode's completion (the pixels' in-memory's stand over the revoke —
36575
- * the draw's source is the decoded's image, not the url). */
36576
- async function decodeToImage(file) {
36577
- const url = URL.createObjectURL(file);
36578
- const img = new Image();
36579
- img.src = url;
36643
+ /**
36644
+ * The alpha-weighted average color over a resolved image url (the frame's
36645
+ * tint's / the consumer's glow's data's source): the image stands
36646
+ * downscaled to the sample's grid over a canvas, and the mean stands the
36647
+ * premultiplied's accumulation (the alpha's share per pixel) — the
36648
+ * transparent's stand no gray's pull (the alpha fade's cover stands its
36649
+ * solid's hue, not the fade's average). The `rgb(...)`'s string over the
36650
+ * computed's stand; `null` over an undecodable payload, the canvas's
36651
+ * absence, or a tainted read (a cross-origin url without CORS — the caller
36652
+ * stands the bytes' same-origin object URL as the fallback).
36653
+ */
36654
+ async function averageColorOfUrl(url) {
36655
+ const img = await decodeImageUrl(url);
36656
+ if (img === null) return null;
36580
36657
  try {
36581
- await img.decode();
36582
- return img;
36658
+ const canvas = document.createElement("canvas");
36659
+ canvas.width = TINT_SAMPLE_PX;
36660
+ canvas.height = TINT_SAMPLE_PX;
36661
+ const ctx = canvas.getContext("2d");
36662
+ if (ctx === null) return null;
36663
+ ctx.drawImage(img, 0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX);
36664
+ const data = ctx.getImageData(0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX).data;
36665
+ let r = 0;
36666
+ let g = 0;
36667
+ let b = 0;
36668
+ let alphaSum = 0;
36669
+ for (let i = 0; i < data.length; i += 4) {
36670
+ const alpha = (data[i + 3] ?? 0) / 255;
36671
+ r += (data[i] ?? 0) * alpha;
36672
+ g += (data[i + 1] ?? 0) * alpha;
36673
+ b += (data[i + 2] ?? 0) * alpha;
36674
+ alphaSum += alpha;
36675
+ }
36676
+ if (alphaSum === 0) return null;
36677
+ const mean = (sum) => Math.round(sum / alphaSum);
36678
+ return `rgb(${mean(r)}, ${mean(g)}, ${mean(b)})`;
36583
36679
  } catch {
36584
36680
  return null;
36585
- } finally {
36586
- URL.revokeObjectURL(url);
36587
- }
36588
- }
36589
- /** The average's color's cache over the blob's identity (the re-resolution's
36590
- * no re-compute's stand; the store's change's new blob stands a fresh
36591
- * entry — the weak key's stand keeps the dead blobs' garbage's parity).
36592
- */
36593
- const tintColorCache = /* @__PURE__ */ new WeakMap();
36594
- /**
36595
- * The alpha-weighted average color over a decodable image blob (the
36596
- * frame's tint's / the consumer's glow's data's source): the image stands
36597
- * downscaled to the sample's grid over a canvas (the `img`'s decode — the
36598
- * SVG's parity), and the mean stands the premultiplied's accumulation
36599
- * (the alpha's share per pixel) — the transparent's stand no gray's pull
36600
- * (the alpha fade's cover stands its solid's hue, not the fade's
36601
- * average). The `rgb(...)`'s string over the computed's stand; `null`
36602
- * over an undecodable payload or the canvas's absence (the jsdom's
36603
- * fail-open's stand — the plain border's parity).
36604
- */
36605
- async function averageColorOfBlob(file) {
36606
- let cached = tintColorCache.get(file);
36607
- if (cached === void 0) {
36608
- cached = (async () => {
36609
- const img = await decodeToImage(file);
36610
- if (img === null) return null;
36611
- try {
36612
- const canvas = document.createElement("canvas");
36613
- canvas.width = TINT_SAMPLE_PX;
36614
- canvas.height = TINT_SAMPLE_PX;
36615
- const ctx = canvas.getContext("2d");
36616
- if (ctx === null) return null;
36617
- ctx.drawImage(img, 0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX);
36618
- const data = ctx.getImageData(0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX).data;
36619
- let r = 0;
36620
- let g = 0;
36621
- let b = 0;
36622
- let alphaSum = 0;
36623
- for (let i = 0; i < data.length; i += 4) {
36624
- const alpha = (data[i + 3] ?? 0) / 255;
36625
- r += (data[i] ?? 0) * alpha;
36626
- g += (data[i + 1] ?? 0) * alpha;
36627
- b += (data[i + 2] ?? 0) * alpha;
36628
- alphaSum += alpha;
36629
- }
36630
- if (alphaSum === 0) return null;
36631
- const mean = (sum) => Math.round(sum / alphaSum);
36632
- return `rgb(${mean(r)}, ${mean(g)}, ${mean(b)})`;
36633
- } catch {
36634
- return null;
36635
- }
36636
- })();
36637
- tintColorCache.set(file, cached);
36638
36681
  }
36639
- return cached;
36640
36682
  }
36641
36683
  /**
36642
36684
  * The banner's bottom fade-out's mask (the last pixels' smooth stand into
@@ -36732,6 +36774,72 @@ function centerBackgroundStyle(dimensions, containerWidthPx, url) {
36732
36774
  };
36733
36775
  }
36734
36776
  //#endregion
36777
+ //#region src/attributes/use-cover-image.ts
36778
+ /**
36779
+ * The cover's resolved image over the editor's blob store: the renderable
36780
+ * url, where it came from, and — on demand — the intrinsic dimensions. The
36781
+ * cover renders the store's own `downloadUrl` when it supplies one (the
36782
+ * browser's cacheable subrequest, as the image block does), the fetched
36783
+ * bytes' object URL otherwise.
36784
+ */
36785
+ /** The status over the blob file's resolution state. */
36786
+ function coverStatusOf(state) {
36787
+ switch (state.status) {
36788
+ case "loading":
36789
+ case "missing": return state.status;
36790
+ case "ready":
36791
+ case "ready-url": return "ready";
36792
+ case "ready-meta": return "unrenderable";
36793
+ }
36794
+ }
36795
+ /**
36796
+ * The intrinsic dimensions over the resolved stand: the bytes' own decode
36797
+ * probe over the blob, or the browser's decode of the rendered url (the
36798
+ * store's direct URL — its own cache serves the payload).
36799
+ */
36800
+ function useImageDimensions(blob, url, measure) {
36801
+ const [dimensions, setDimensions] = useState(null);
36802
+ useEffect(() => {
36803
+ if (!measure || url === null) {
36804
+ setDimensions(null);
36805
+ return;
36806
+ }
36807
+ let alive = true;
36808
+ (blob === null ? readUrlDimensions(url) : readImageDimensions(blob)).then((next) => {
36809
+ if (alive) setDimensions(next);
36810
+ });
36811
+ return () => {
36812
+ alive = false;
36813
+ };
36814
+ }, [
36815
+ blob,
36816
+ url,
36817
+ measure
36818
+ ]);
36819
+ return dimensions;
36820
+ }
36821
+ /**
36822
+ * The stored cover's image: the blob store's resolution (the metadata's head
36823
+ * lookup decides the renderable MIME and the store's direct URL's stand), and
36824
+ * the intrinsic dimensions over the requested measure.
36825
+ */
36826
+ function useCoverImage(fileId, options = {}) {
36827
+ const { state } = useBlobFile(fileId, COVER_RENDERS_IMAGE, {
36828
+ eager: options.eager,
36829
+ rendersFromUrl: COVER_RENDERS_IMAGE
36830
+ });
36831
+ const blob = state.status === "ready" ? state.blob : null;
36832
+ const url = state.status === "ready" || state.status === "ready-url" ? state.url : null;
36833
+ const source = state.status === "ready" ? "bytes" : state.status === "ready-url" ? "url" : null;
36834
+ const dimensions = useImageDimensions(blob, url, options.measure === true);
36835
+ return {
36836
+ status: coverStatusOf(state),
36837
+ url,
36838
+ source,
36839
+ dimensions
36840
+ };
36841
+ }
36842
+ //#endregion
36735
36843
  //#region src/attributes/CoverPresets.tsx
36736
36844
  /** The cover modal's preset's surface (the modal's subcomponent over the
36737
36845
  * `cover.ts`'s contract): the preset's cell (the consumer's store's
@@ -36754,7 +36862,7 @@ function editorWidthOf(anchor) {
36754
36862
  * caller's mode (the upload's no stand — the consumer's catalog's curation
36755
36863
  * is the gate's stand over the presets). */
36756
36864
  function CoverPresetCell({ fileId, label, busy, onPick }) {
36757
- const { state: file } = useBlobFile(fileId, COVER_RENDERS_BYTES, { eager: true });
36865
+ const { status, url } = useCoverImage(fileId, { eager: true });
36758
36866
  return /* @__PURE__ */ jsx("button", {
36759
36867
  type: "button",
36760
36868
  "data-slot": "docblocks/cover-preset",
@@ -36764,8 +36872,8 @@ function CoverPresetCell({ fileId, label, busy, onPick }) {
36764
36872
  disabled: busy,
36765
36873
  onClick: onPick,
36766
36874
  className: "\n flex h-18 w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted\n text-muted-foreground\n hover:border-primary\n disabled:opacity-60\n ",
36767
- children: file.status === "ready" ? /* @__PURE__ */ jsx("img", {
36768
- src: file.url,
36875
+ children: status === "ready" && url !== null ? /* @__PURE__ */ jsx("img", {
36876
+ src: url,
36769
36877
  alt: "",
36770
36878
  className: "size-full object-cover"
36771
36879
  }) : /* @__PURE__ */ jsx(Image$1, { className: "size-4" })
@@ -37007,22 +37115,25 @@ function CoverUploadModal({ anchorRef, initialMode, onCommit, onClose }) {
37007
37115
  /** The cover's row's control (the file id's thumbnail / the upload's
37008
37116
  * entry / the remove; the read-only stand stands the thumbnail
37009
37117
  * display-only). The upload's entry opens the modal (the mode's
37010
- * selector + the drop zone + the gate's stands live over it). */
37118
+ * selector + the drop zone + the gate's stands live over it). The
37119
+ * thumbnail stands the store's direct URL when it supplies one, the
37120
+ * bytes' object URL otherwise. */
37011
37121
  function CoverEditor({ fileId, mode, readOnly, onCommit, onClear }) {
37012
37122
  const { t } = useTranslation("editor");
37013
- const { state: file } = useBlobFile(fileId ?? "", COVER_RENDERS_BYTES, { eager: true });
37123
+ const { status, url } = useCoverImage(fileId ?? "", { eager: true });
37014
37124
  const [open, setOpen] = useState(false);
37015
37125
  const anchorRef = useRef(null);
37126
+ const thumbnail = status === "ready" && url !== null;
37016
37127
  return /* @__PURE__ */ jsxs("div", {
37017
37128
  ref: anchorRef,
37018
37129
  tabIndex: -1,
37019
37130
  className: "flex min-w-0 items-center gap-2 outline-none",
37020
37131
  children: [
37021
- fileId !== void 0 && (file.status === "ready" || file.status === "ready-meta") ? /* @__PURE__ */ jsx("span", {
37132
+ fileId !== void 0 && (thumbnail || status === "unrenderable") ? /* @__PURE__ */ jsx("span", {
37022
37133
  "data-slot": "docblocks/attributes-cover",
37023
37134
  className: "block size-10 shrink-0 overflow-hidden rounded-md border bg-muted",
37024
- children: file.status === "ready" ? /* @__PURE__ */ jsx("img", {
37025
- src: file.url,
37135
+ children: thumbnail ? /* @__PURE__ */ jsx("img", {
37136
+ src: url,
37026
37137
  alt: "",
37027
37138
  className: "size-full object-cover"
37028
37139
  }) : null
@@ -37073,24 +37184,10 @@ function CoverEditor({ fileId, mode, readOnly, onCommit, onClear }) {
37073
37184
  const EDITOR_SELECTOR = "[data-slot=\"docblocks/editor\"]";
37074
37185
  function CoverModeSelector({ coverId, mode, readOnly, onChange }) {
37075
37186
  const { t } = useTranslation("editor");
37076
- const { state: file } = useBlobFile(coverId, COVER_RENDERS_BYTES, { eager: true });
37077
- const blob = file.status === "ready" ? file.blob : null;
37078
- /** The intrinsic dimensions' probe (the gate's input — the undecodable's
37079
- * payload keeps the gate's fail-open stand). */
37080
- const [dimensions, setDimensions] = useState(null);
37081
- useLayoutEffect(() => {
37082
- if (blob === null) {
37083
- setDimensions(null);
37084
- return;
37085
- }
37086
- let alive = true;
37087
- readImageDimensions(blob).then((next) => {
37088
- if (alive) setDimensions(next);
37089
- });
37090
- return () => {
37091
- alive = false;
37092
- };
37093
- }, [blob]);
37187
+ const { dimensions } = useCoverImage(coverId, {
37188
+ eager: true,
37189
+ measure: true
37190
+ });
37094
37191
  /** The editor frame's live width (the centering's gate's input): the
37095
37192
  * anchor's nearest editor frame's box over the mount's measure + the
37096
37193
  * resize's watch (the jsdom's no-layout's stand keeps the zero's value
@@ -37553,7 +37650,9 @@ function AttributesPanel() {
37553
37650
  * over the scaled height). The banner is decoration only: the pointer's
37554
37651
  * transparent stand keeps the page's selection and the cross-drag's
37555
37652
  * stands untouched. The bottom's last pixels stand the fade-out's smooth
37556
- * stand into the page's content. */
37653
+ * stand into the page's content. The image stands the store's direct URL
37654
+ * when it supplies one (the browser's cacheable subrequest), the bytes'
37655
+ * object URL otherwise. */
37557
37656
  function CoverBanner() {
37558
37657
  const { store } = useEditorContext();
37559
37658
  const attributes = useStore(store, (state) => state.meta).attributes;
@@ -37565,28 +37664,15 @@ function CoverBanner() {
37565
37664
  });
37566
37665
  }
37567
37666
  /** The banner's body (the hooks' stand — the mount only over the cover's
37568
- * presence, so the resolution's hook never sees the empty's id). */
37667
+ * presence, so the resolution's hook never sees the empty's id). The
37668
+ * dimensions' probe runs over the centering only (the tile's fixed strip
37669
+ * needs no intrinsic size) — the store's direct URL serves the probe as it
37670
+ * serves the render. */
37569
37671
  function CoverBannerBody({ coverId, mode }) {
37570
- const { state: file } = useBlobFile(coverId, COVER_RENDERS_BYTES, { eager: true });
37571
- const blob = file.status === "ready" ? file.blob : null;
37572
- /** The intrinsic dimensions' probe (the centering's slice's input — the
37573
- * width's scale over the container; the undecodable's payload stands
37574
- * the fallback's plain image's stand). The tile's stand needs no probe
37575
- * (the fixed's strip's height is the layout's constant). */
37576
- const [dimensions, setDimensions] = useState(null);
37577
- useLayoutEffect(() => {
37578
- if (blob === null || mode === "tile") {
37579
- setDimensions(null);
37580
- return;
37581
- }
37582
- let alive = true;
37583
- readImageDimensions(blob).then((next) => {
37584
- if (alive) setDimensions(next);
37585
- });
37586
- return () => {
37587
- alive = false;
37588
- };
37589
- }, [blob, mode]);
37672
+ const { url, dimensions } = useCoverImage(coverId, {
37673
+ eager: true,
37674
+ measure: mode === "center"
37675
+ });
37590
37676
  /** The frame's live width (the centering's slice's height's input): the
37591
37677
  * wrapper's own box (the full frame's width's stand) over the mount's
37592
37678
  * measure + the resize's watch (the jsdom's no-layout's stand keeps the
@@ -37606,8 +37692,8 @@ function CoverBannerBody({ coverId, mode }) {
37606
37692
  const observer = new ResizeObserver(measure);
37607
37693
  observer.observe(el);
37608
37694
  return () => observer.disconnect();
37609
- }, [file.status === "ready"]);
37610
- if (file.status !== "ready") return null;
37695
+ }, [url !== null]);
37696
+ if (url === null) return null;
37611
37697
  return /* @__PURE__ */ jsx("div", {
37612
37698
  ref: wrapperRef,
37613
37699
  "data-slot": "docblocks/cover-banner",
@@ -37620,18 +37706,18 @@ function CoverBannerBody({ coverId, mode }) {
37620
37706
  },
37621
37707
  children: mode === "tile" ? /* @__PURE__ */ jsx("div", {
37622
37708
  className: "w-full",
37623
- style: tileBackgroundStyle(file.url)
37709
+ style: tileBackgroundStyle(url)
37624
37710
  }) : dimensions === null ? /* @__PURE__ */ jsx("div", {
37625
37711
  className: "flex w-full justify-center",
37626
37712
  children: /* @__PURE__ */ jsx("img", {
37627
- src: file.url,
37713
+ src: url,
37628
37714
  alt: "",
37629
37715
  className: "max-w-full",
37630
37716
  style: { maxHeight: 150 }
37631
37717
  })
37632
37718
  }) : /* @__PURE__ */ jsx("div", {
37633
37719
  className: "w-full",
37634
- style: centerBackgroundStyle(dimensions, width, file.url)
37720
+ style: centerBackgroundStyle(dimensions, width, url)
37635
37721
  })
37636
37722
  });
37637
37723
  }
@@ -37639,20 +37725,21 @@ function CoverBannerBody({ coverId, mode }) {
37639
37725
  //#region src/attributes/cover-tint.tsx
37640
37726
  /**
37641
37727
  * The stored cover's average color (the frame's tint's / the consumer's
37642
- * glow's data's source): the cover's blob resolved over the editor's blob
37643
- * store, and the alpha-weighted average read from it — the `rgb(...)`'s
37644
- * string or `null` over the absent's id / the unresolved's / the
37645
- * undecodable's stand. The blob's identity's cache stands the
37646
- * re-resolution's no re-compute (the store's change's new blob stands the
37647
- * fresh entry).
37728
+ * glow's data's source): the cover's resolved url drawn into the sample's
37729
+ * canvas — the `rgb(...)`'s string or `null` over the absent's id / the
37730
+ * unresolved's / the undecodable's stand. The resolved url is the store's
37731
+ * direct URL when it supplies one; a cross-origin URL without CORS taints
37732
+ * the canvas, so that read falls back to the fetched bytes' same-origin
37733
+ * object URL (the library's own read).
37648
37734
  */
37649
37735
  function useCoverAverageColor() {
37650
37736
  const { store, blobStore } = useEditorContext();
37651
37737
  const attributes = useStore(store, (state) => state.meta.attributes);
37652
37738
  const coverId = typeof attributes?.cover === "string" ? attributes.cover : void 0;
37739
+ const { url, source } = useCoverImage(coverId ?? "", { eager: true });
37653
37740
  const [color, setColor] = useState(null);
37654
37741
  useEffect(() => {
37655
- if (coverId === void 0) {
37742
+ if (url === null) {
37656
37743
  setColor(null);
37657
37744
  return;
37658
37745
  }
@@ -37660,15 +37747,36 @@ function useCoverAverageColor() {
37660
37747
  const settle = (next) => {
37661
37748
  if (alive) setColor(next);
37662
37749
  };
37663
- const load = async () => {
37750
+ /**
37751
+ * The bytes' read: the same-origin object URL (a `blob:` url never
37752
+ * taints the canvas) — the fallback over a store URL the canvas cannot
37753
+ * read, and the legacy resolution's own stand.
37754
+ */
37755
+ const readBytes = async () => {
37756
+ if (coverId === void 0) {
37757
+ settle(null);
37758
+ return;
37759
+ }
37760
+ let blobUrl = null;
37664
37761
  try {
37665
37762
  const ref = await blobStore.get(coverId);
37666
- settle(await averageColorOfBlob(ref.blob));
37763
+ blobUrl = URL.createObjectURL(ref.blob);
37764
+ settle(await averageColorOfUrl(blobUrl));
37667
37765
  } catch {
37668
37766
  settle(null);
37767
+ } finally {
37768
+ if (blobUrl !== null) URL.revokeObjectURL(blobUrl);
37769
+ }
37770
+ };
37771
+ const load = async () => {
37772
+ const direct = await averageColorOfUrl(url);
37773
+ if (direct !== null || source !== "url") {
37774
+ settle(direct);
37775
+ return;
37669
37776
  }
37777
+ await readBytes();
37670
37778
  };
37671
- const unsubscribe = blobStore.subscribe(coverId, () => {
37779
+ const unsubscribe = blobStore.subscribe(coverId ?? "", () => {
37672
37780
  load();
37673
37781
  });
37674
37782
  load();
@@ -37676,7 +37784,12 @@ function useCoverAverageColor() {
37676
37784
  alive = false;
37677
37785
  unsubscribe();
37678
37786
  };
37679
- }, [blobStore, coverId]);
37787
+ }, [
37788
+ blobStore,
37789
+ coverId,
37790
+ url,
37791
+ source
37792
+ ]);
37680
37793
  return color;
37681
37794
  }
37682
37795
  /**
@@ -61,14 +61,19 @@ interface BlobStore {
61
61
  /** Optional lightweight display resolution: file id → the metadata WITHOUT
62
62
  * the bytes (the cheap head stand, no body transfer). The built-in
63
63
  * file / image blocks resolve the bytes over `get` only when they render
64
- * the payload (the pdf preview, the `<img>`); any other MIME stands the
65
- * meta card with the `downloadUrl`'s href. Without the member the blocks
66
- * keep the legacy stand (the bytes over `get`). Rejects an unknown id
67
- * (the missing's stand). */
64
+ * the payload (the pdf preview, the `<img>`'s fallback); any other MIME
65
+ * stands the meta card with the `downloadUrl`'s href. Without the member
66
+ * the blocks keep the legacy stand (the bytes over `get`). Rejects an
67
+ * unknown id (the missing's stand). */
68
68
  getMeta?(fileId: string): Promise<BlobMeta>;
69
- /** Optional direct download URL for a file id (the meta card's href — no
70
- * object URL stands). Without the member the download's href stands the
71
- * object URL resolved over `get` (the legacy's path). */
69
+ /** Optional direct URL for a file id (no object URL stands). The image
70
+ * block renders an image MIME straight from it — the browser's own
71
+ * cacheable subrequest instead of the bytes over `get` — and the meta
72
+ * card stands it as the download's href; a store supplies it only when the
73
+ * URL serves the payload inline (a `Content-Disposition: attachment`
74
+ * response serves the download, not the `<img>`). Without the member the
75
+ * download's href stands the object URL resolved over `get` (the
76
+ * legacy's path). */
72
77
  downloadUrl?(fileId: string): string;
73
78
  }
74
79
  /** The default in-memory store: blobs live for the JS session only. */
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as PresenceCrypto, c as PresenceSharing, l as PresenceSharingMode, n as BlockRendererMap, o as PresenceIdentity, r as BlockRendererProps, s as PresencePeer, t as BlockRenderer } from "./index-DeOMnr7f.mjs";
2
- import { $ as TableEnvelopeBase, A as DatabaseTablePhase, At as RenderAttribute, B as BridgeTableDescription, C as DatabaseTable, Ct as toBridgeError, D as cellValueEqual, Dt as createMemoryBlobStore, E as UseTableList, Et as BlobStore, F as FilterBuilder, G as MutationReceipt, H as CellValueParse, I as BatchOp, J as ProtocolDescriptor, K as OperationStatus, L as DatabaseBridge, M as UseDatabaseTable, N as emptyFilter, O as newMutationContext, Ot as AttributeTypePicker, P as filterIsComplete, Q as SubscriptionStatus, R as BridgeColumn, S as useTableList, St as isBridgeErrorCode, T as DatabaseTableView, Tt as BlobRef, U as DomainEvent, V as BridgeValueInput, W as MutationContext, X as SubscriptionHandle, Y as ProtocolLimits, Z as SubscriptionObserver, _ as AccessLevel, _t as TableSnapshot, a as EditorContextValue, at as Id, b as MentionInteractions, bt as BridgeErrorCode, c as SelectionRef, ct as PageSnapshot, d as PdfPreview, dt as Revision, et as TableEvent, f as PdfPreviewProps, ft as RowPage, g as DocTags, gt as TableRef, h as DocTag, ht as TableDescription, i as EditorProviderProps, it as FilterInput, j as DatabaseTableRow, jt as RenderAttributeProps, k as useDatabaseTable, kt as AttributeTypePickerProps, l as BlobLoading, lt as QueryOperator, m as DocDescription, mt as SortInput, n as DEFAULT_EMBED_SANDBOX, nt as Column, o as EmbedSandboxPolicy, ot as IsoInstant, p as CoverPresetSets, pt as RowWire, q as ProtocolCapability, r as EditorProvider, rt as FilterConditionInput, s as SyncEmbedResolver, st as PageQuery, t as useEditorContext, tt as CellMap, u as PresenceConfig, ut as QuerySemantics, v as EditorMode, vt as BRIDGE_ERROR_CODES, w as DatabaseTableProps, wt as BlobMeta, x as MentionProvider, xt as isBridgeError, y as MentionEntry, yt as BridgeError, z as BridgeColumnAnnotation } from "./index-BV-kKwCB.mjs";
2
+ import { $ as TableEnvelopeBase, A as DatabaseTablePhase, At as RenderAttribute, B as BridgeTableDescription, C as DatabaseTable, Ct as toBridgeError, D as cellValueEqual, Dt as createMemoryBlobStore, E as UseTableList, Et as BlobStore, F as FilterBuilder, G as MutationReceipt, H as CellValueParse, I as BatchOp, J as ProtocolDescriptor, K as OperationStatus, L as DatabaseBridge, M as UseDatabaseTable, N as emptyFilter, O as newMutationContext, Ot as AttributeTypePicker, P as filterIsComplete, Q as SubscriptionStatus, R as BridgeColumn, S as useTableList, St as isBridgeErrorCode, T as DatabaseTableView, Tt as BlobRef, U as DomainEvent, V as BridgeValueInput, W as MutationContext, X as SubscriptionHandle, Y as ProtocolLimits, Z as SubscriptionObserver, _ as AccessLevel, _t as TableSnapshot, a as EditorContextValue, at as Id, b as MentionInteractions, bt as BridgeErrorCode, c as SelectionRef, ct as PageSnapshot, d as PdfPreview, dt as Revision, et as TableEvent, f as PdfPreviewProps, ft as RowPage, g as DocTags, gt as TableRef, h as DocTag, ht as TableDescription, i as EditorProviderProps, it as FilterInput, j as DatabaseTableRow, jt as RenderAttributeProps, k as useDatabaseTable, kt as AttributeTypePickerProps, l as BlobLoading, lt as QueryOperator, m as DocDescription, mt as SortInput, n as DEFAULT_EMBED_SANDBOX, nt as Column, o as EmbedSandboxPolicy, ot as IsoInstant, p as CoverPresetSets, pt as RowWire, q as ProtocolCapability, r as EditorProvider, rt as FilterConditionInput, s as SyncEmbedResolver, st as PageQuery, t as useEditorContext, tt as CellMap, u as PresenceConfig, ut as QuerySemantics, v as EditorMode, vt as BRIDGE_ERROR_CODES, w as DatabaseTableProps, wt as BlobMeta, x as MentionProvider, xt as isBridgeError, y as MentionEntry, yt as BridgeError, z as BridgeColumnAnnotation } from "./index-CE8wKsue.mjs";
3
3
  import * as React$1 from "react";
4
4
  import { Component, ComponentType, ErrorInfo, ReactNode } from "react";
5
5
  import { VariantProps } from "class-variance-authority";
@@ -333,12 +333,12 @@ declare const FORMAT_PALETTE: readonly string[];
333
333
  //#region src/attributes/cover-tint.d.ts
334
334
  /**
335
335
  * The stored cover's average color (the frame's tint's / the consumer's
336
- * glow's data's source): the cover's blob resolved over the editor's blob
337
- * store, and the alpha-weighted average read from it — the `rgb(...)`'s
338
- * string or `null` over the absent's id / the unresolved's / the
339
- * undecodable's stand. The blob's identity's cache stands the
340
- * re-resolution's no re-compute (the store's change's new blob stands the
341
- * fresh entry).
336
+ * glow's data's source): the cover's resolved url drawn into the sample's
337
+ * canvas — the `rgb(...)`'s string or `null` over the absent's id / the
338
+ * unresolved's / the undecodable's stand. The resolved url is the store's
339
+ * direct URL when it supplies one; a cross-origin URL without CORS taints
340
+ * the canvas, so that read falls back to the fetched bytes' same-origin
341
+ * object URL (the library's own read).
342
342
  */
343
343
  declare function useCoverAverageColor(): string | null;
344
344
  //#endregion
@@ -427,7 +427,7 @@ declare function AlertDescription({ className, ...props }: React$1.ComponentProp
427
427
  //#endregion
428
428
  //#region src/shared/ui/Badge.d.ts
429
429
  declare const badgeVariants: (props?: ({
430
- variant?: "default" | "custom" | "secondary" | "destructive" | "outline" | null | undefined;
430
+ variant?: "default" | "destructive" | "custom" | "secondary" | "outline" | null | undefined;
431
431
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
432
432
  declare function Badge({ className, variant, asChild, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
433
433
  asChild?: boolean;
@@ -438,7 +438,7 @@ declare function BareSelect({ className, children, ...props }: React$1.Component
438
438
  //#endregion
439
439
  //#region src/shared/ui/Button.d.ts
440
440
  declare const buttonVariants: (props?: ({
441
- variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
441
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
442
442
  size?: "default" | "icon" | "sm" | "lg" | "xl" | null | undefined;
443
443
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
444
444
  declare function Button({ className, variant, size, asChild, type, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as UnknownSlashCommandError, S as UnhandledValueError, _ as CanvasPasteError, b as HookMisuseError, g as BlobNotFoundError, s as preventDefault, v as DocBlocksUiError, w as cn, x as PdfFetchError, y as EditorProviderError } from "./constants-D_3p65rk.mjs";
2
- import { $ as DropdownMenuShortcut, $t as DocblocksI18nProvider, A as Select, B as Label, Bt as CardFooter, C as cellValueEqual, Ct as isBridgeError, D as filterIsComplete, Dt as parseCellValue, E as emptyFilter, Et as conditionMatches, F as SelectScrollDownButton, Ft as Skeleton, G as DropdownMenuContent, Gt as useBlock, H as Input, Ht as CardTitle, I as SelectScrollUpButton, It as Card, J as DropdownMenuLabel, Jt as usePresence, K as DropdownMenuGroup, Kt as useDoc, L as SelectSeparator, Lt as CardAction, M as SelectGroup, Mt as Eye, N as SelectItem, O as SegmentSelector, Ot as TEXT_TYPES, P as SelectLabel, Pt as BookOpen, Q as DropdownMenuSeparator, Qt as useText, R as SelectTrigger, Rt as CardContent, S as useDatabaseTable, St as BridgeError, T as FilterBuilder, Tt as toBridgeError, U as DropdownMenu, Ut as Badge, V as InlineEditInput, Vt as CardHeader, W as DropdownMenuCheckboxItem, Wt as badgeVariants, X as DropdownMenuRadioGroup, Xt as useSelection, Y as DropdownMenuPortal, Yt as usePresenceSharing, Z as DropdownMenuRadioItem, Zt as useSelectionView, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as createMemoryBlobStore, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as AlertTitle, h as mdToBlocks, ht as AlertDescription, i as useEditorContext, it as Separator, j as SelectContent, jt as Pen, k as ScrollArea, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as Alert, n as useCoverAverageColor, nn as Button, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as BareSelect, q as DropdownMenuItem, qt as useMeta, r as EditorProvider, rn as buttonVariants, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as EditorErrorBoundary, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as PROTOCOL_VERSION, w as newMutationContext, wt as isBridgeErrorCode, x as GridBody, xt as BRIDGE_ERROR_CODES, yt as isDatabaseBridge, z as SelectValue, zt as CardDescription } from "./Editor-WNvtSeS1.mjs";
2
+ import { $ as DropdownMenuShortcut, $t as DocblocksI18nProvider, A as Select, B as Label, Bt as CardFooter, C as cellValueEqual, Ct as isBridgeError, D as filterIsComplete, Dt as parseCellValue, E as emptyFilter, Et as conditionMatches, F as SelectScrollDownButton, Ft as Skeleton, G as DropdownMenuContent, Gt as useBlock, H as Input, Ht as CardTitle, I as SelectScrollUpButton, It as Card, J as DropdownMenuLabel, Jt as usePresence, K as DropdownMenuGroup, Kt as useDoc, L as SelectSeparator, Lt as CardAction, M as SelectGroup, Mt as Eye, N as SelectItem, O as SegmentSelector, Ot as TEXT_TYPES, P as SelectLabel, Pt as BookOpen, Q as DropdownMenuSeparator, Qt as useText, R as SelectTrigger, Rt as CardContent, S as useDatabaseTable, St as BridgeError, T as FilterBuilder, Tt as toBridgeError, U as DropdownMenu, Ut as Badge, V as InlineEditInput, Vt as CardHeader, W as DropdownMenuCheckboxItem, Wt as badgeVariants, X as DropdownMenuRadioGroup, Xt as useSelection, Y as DropdownMenuPortal, Yt as usePresenceSharing, Z as DropdownMenuRadioItem, Zt as useSelectionView, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as createMemoryBlobStore, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as AlertTitle, h as mdToBlocks, ht as AlertDescription, i as useEditorContext, it as Separator, j as SelectContent, jt as Pen, k as ScrollArea, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as Alert, n as useCoverAverageColor, nn as Button, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as BareSelect, q as DropdownMenuItem, qt as useMeta, r as EditorProvider, rn as buttonVariants, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as EditorErrorBoundary, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as PROTOCOL_VERSION, w as newMutationContext, wt as isBridgeErrorCode, x as GridBody, xt as BRIDGE_ERROR_CODES, yt as isDatabaseBridge, z as SelectValue, zt as CardDescription } from "./Editor-CfH9kgta.mjs";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { cva } from "class-variance-authority";
@@ -1,5 +1,5 @@
1
1
  import { a as clamp, d as Plus, f as Minus, p as LoaderCircle, s as preventDefault, u as TriangleAlert } from "../constants-D_3p65rk.mjs";
2
- import { At as RotateCcw, Ft as Skeleton, Mt as Eye, Nt as CodeXml, O as SegmentSelector, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, nn as Button, o as childrenSlot, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-WNvtSeS1.mjs";
2
+ import { At as RotateCcw, Ft as Skeleton, Mt as Eye, Nt as CodeXml, O as SegmentSelector, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, nn as Button, o as childrenSlot, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-CfH9kgta.mjs";
3
3
  import { t as Maximize } from "../Maximize-BBHnCDWL.mjs";
4
4
  import { useEffect, useRef, useState } from "react";
5
5
  import { useTranslation } from "react-i18next";
@@ -1,4 +1,4 @@
1
- import { f as PdfPreviewProps } from "../index-BV-kKwCB.mjs";
1
+ import { f as PdfPreviewProps } from "../index-CE8wKsue.mjs";
2
2
  //#region src/pdf/PdfFirstPage.d.ts
3
3
  declare function PdfFirstPage({ id, blockType, url, name }: PdfPreviewProps): import("react").JSX.Element;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "React rendering + editing layer for docblocks: hooks, block renderers, caret/selection, keyboard, clipboard.",
5
5
  "type": "module",
6
6
  "license": "MIT",