@danxbot/ui 7.7.2 → 7.8.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.
@@ -35,6 +35,19 @@ export interface DecorationSpec {
35
35
  * - `local` — there is no uploader, so it cannot be stored at all.
36
36
  */
37
37
  export type LocalImageState = "uploading" | "failed" | "local";
38
+ /**
39
+ * What the resolver reports for one src this editor minted.
40
+ *
41
+ * `message` (DX-3146) is the rejection's own text, present only when
42
+ * `state === "failed"` and the uploader threw an `Error` — see
43
+ * `errorMessage` in `./image-pipeline.ts`. It travels from the pipeline's
44
+ * entry through to the decoration so the failed overlay can say WHY, not
45
+ * just THAT, an upload failed.
46
+ */
47
+ export interface LocalImageInfo {
48
+ state: LocalImageState;
49
+ message?: string;
50
+ }
38
51
  /**
39
52
  * Answers "did this editor mint this src, and what is its state".
40
53
  *
@@ -43,7 +56,7 @@ export type LocalImageState = "uploading" | "failed" | "local";
43
56
  * refused. That is what makes "only the object URLs this editor minted
44
57
  * render" true by construction rather than by a second allow-list (DX-3134).
45
58
  */
46
- export type ImageResolver = (src: string) => LocalImageState | null;
59
+ export type ImageResolver = (src: string) => LocalImageInfo | null;
47
60
  /** Every state a decoration can draw, including the two that are not local. */
48
61
  export type ImageDecorationState = LocalImageState | "stored" | "broken";
49
62
  /** The attribute the pipeline's click listener looks for. */
@@ -57,4 +70,4 @@ export type ImageAction = "retry" | "remove";
57
70
  */
58
71
  export declare function imageDecoration(frame: Extract<Frame, {
59
72
  kind: "image";
60
- }>, local: LocalImageState | null): DecorationSpec;
73
+ }>, local: LocalImageInfo | null): DecorationSpec;
@@ -1,4 +1,4 @@
1
- import { type LocalImageState } from "./image-decoration";
1
+ import { type LocalImageInfo } from "./image-decoration";
2
2
  import { type SourceSelection } from "./position";
3
3
  import type { MarkdownSurface } from "./surface";
4
4
  /**
@@ -36,6 +36,15 @@ export interface ImagePipelineSnapshot extends ImageUploadState {
36
36
  local: number;
37
37
  /** Failed images this editor still holds the File for, so Retry can work. */
38
38
  retryable: number;
39
+ /**
40
+ * The rejection messages behind `failed`, deduplicated and in the order
41
+ * they first appear in the document (DX-3146) — the warning strip's
42
+ * source of truth for "why", so it never keeps a second count that could
43
+ * disagree with this one. A `blob:` this editor did not mint has no
44
+ * message and contributes nothing here even though it counts toward
45
+ * `failed` above.
46
+ */
47
+ failureMessages: readonly string[];
39
48
  }
40
49
  /**
41
50
  * The browser facilities the pipeline touches, injectable so a test never
@@ -77,7 +86,7 @@ export declare class ImagePipeline {
77
86
  * minted, or null for anything else. An arrow property so it can be handed
78
87
  * to the surface before the surface exists.
79
88
  */
80
- readonly resolve: (src: string) => LocalImageState | null;
89
+ readonly resolve: (src: string) => LocalImageInfo | null;
81
90
  /** Connects the surface this pipeline edits, and reports the first snapshot. */
82
91
  attach(surface: MarkdownSurface): void;
83
92
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "7.7.2",
3
+ "version": "7.8.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",