@ag2/weave 0.16.0 → 0.17.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.
@@ -6,4 +6,9 @@ export declare const Name: string;
6
6
  export declare const Time: string;
7
7
  export declare const Snippet: string;
8
8
  export declare const FileRow: string;
9
- export declare const Deleted: string;
9
+ export declare const Notice: string;
10
+ export declare const Retry: string;
11
+ export declare const Lines: string;
12
+ export declare const Line: string;
13
+ export declare const ShortLine: string;
14
+ export declare const NameLine: string;
@@ -1,7 +1,11 @@
1
1
  import React, { ReactNode } from "react";
2
- export declare type QuoteCardContext = "Reply" | "File" | "Forwarded" | "Deleted";
2
+ export declare type QuoteCardContext = "Reply" | "File" | "Forwarded" | "Deleted" | "Loading" | "Failed" | "Unavailable";
3
3
  export declare type QuoteCardProps = {
4
- /** Reply, a file-only parent, a forwarded message, or a parent that was deleted. */
4
+ /**
5
+ * Reply, a file-only parent, a forwarded message, or a parent that was deleted. A parent not
6
+ * here yet: Loading (grey lines), Failed (couldn't load, with Retry) or Unavailable (you can't
7
+ * see it).
8
+ */
5
9
  context?: QuoteCardContext;
6
10
  /** 20px: a photo, an initial, or an agent's mark. */
7
11
  avatar?: ReactNode;
@@ -12,10 +16,12 @@ export declare type QuoteCardProps = {
12
16
  source?: string;
13
17
  /** The parent's text, flattened, at most two lines. For a file: "Type · title". */
14
18
  snippet?: ReactNode;
19
+ /** Failed: try loading the parent again. */
20
+ onRetry?: () => void;
15
21
  };
16
22
  /**
17
23
  * The parent of a reply, or a forwarded message, as one card you can't mistake for the reply.
18
24
  * A button that jumps to the message (`as="div"` for a card that isn't a target); a deleted
19
- * parent is never a target.
25
+ * parent is never a target, nor is one that hasn't loaded.
20
26
  */
21
27
  export declare const QuoteCard: <T extends React.ElementType<any> = "button">(props: import("..").AsOutProps<T, QuoteCardProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
package/dist/index.js CHANGED
@@ -12585,12 +12585,12 @@ const SelectLabel = forwardRef(
12585
12585
  );
12586
12586
  SelectLabel.displayName = "SelectLabel";
12587
12587
  const Line_css_ts_vanilla = "";
12588
- var Line$1 = createRuntimeFn({ defaultClassName: "_3qlw3b1 _8nex5a1 _8nex5a0", variantClassNames: { variant: { Subtle: "_3qlw3b2", Inherit: "_3qlw3b3", Background: "_3qlw3b4", Surface: "_3qlw3b5", SurfaceVariant: "_3qlw3b6", Primary: "_3qlw3b7", Secondary: "_3qlw3b8", Success: "_3qlw3b9", Warning: "_3qlw3ba", Critical: "_3qlw3bb" }, direction: { Horizontal: "_3qlw3bc", Vertical: "_3qlw3bd" }, size: { "300": "_3qlw3be", "400": "_3qlw3bf", "500": "_3qlw3bg", "600": "_3qlw3bh", "700": "_3qlw3bi" } }, defaultVariants: { variant: "Subtle", direction: "Horizontal", size: "400" }, compoundVariants: [] });
12589
- const Line = as(
12588
+ var Line$2 = createRuntimeFn({ defaultClassName: "_3qlw3b1 _8nex5a1 _8nex5a0", variantClassNames: { variant: { Subtle: "_3qlw3b2", Inherit: "_3qlw3b3", Background: "_3qlw3b4", Surface: "_3qlw3b5", SurfaceVariant: "_3qlw3b6", Primary: "_3qlw3b7", Secondary: "_3qlw3b8", Success: "_3qlw3b9", Warning: "_3qlw3ba", Critical: "_3qlw3bb" }, direction: { Horizontal: "_3qlw3bc", Vertical: "_3qlw3bd" }, size: { "300": "_3qlw3be", "400": "_3qlw3bf", "500": "_3qlw3bg", "600": "_3qlw3bh", "700": "_3qlw3bi" } }, defaultVariants: { variant: "Subtle", direction: "Horizontal", size: "400" }, compoundVariants: [] });
12589
+ const Line$1 = as(
12590
12590
  ({ as: AsLine = "div", className, variant, direction, size: size2, ...props }, ref) => /* @__PURE__ */ jsx(
12591
12591
  AsLine,
12592
12592
  {
12593
- className: classNames(Line$1({ variant, direction, size: size2 }), className),
12593
+ className: classNames(Line$2({ variant, direction, size: size2 }), className),
12594
12594
  ...props,
12595
12595
  ref
12596
12596
  }
@@ -15328,7 +15328,7 @@ const SidebarStack = as(
15328
15328
  ({ as: AsSidebarStack = "div", className, ...props }, ref) => /* @__PURE__ */ jsx(AsSidebarStack, { className: classNames(SidebarStack$1, className), ...props, ref })
15329
15329
  );
15330
15330
  const SidebarStackSeparator = () => /* @__PURE__ */ jsx(
15331
- Line,
15331
+ Line$1,
15332
15332
  {
15333
15333
  role: "separator",
15334
15334
  style: { width: toRem(24), margin: "0 auto" },
@@ -18237,15 +18237,25 @@ const ActivityHeader = as(
18237
18237
  ] })
18238
18238
  );
18239
18239
  const QuoteCard_css_ts_vanilla = "";
18240
- var Deleted = "amkbq18";
18241
18240
  var Face = "amkbq13";
18242
18241
  var FileRow = "amkbq17";
18243
18242
  var Glyph$1 = "amkbq12";
18244
18243
  var Head = "amkbq11";
18244
+ var Line = "amkbq1b";
18245
+ var Lines = "amkbq1a";
18245
18246
  var Name$2 = "amkbq14";
18247
+ var NameLine$1 = "amkbq1d";
18248
+ var Notice = "amkbq18";
18246
18249
  var QuoteCard$1 = "amkbq10 _8nex5a1 _8nex5a0 x4g6300";
18250
+ var Retry = "amkbq19 _8nex5a1 _8nex5a0 x4g6300";
18251
+ var ShortLine = "amkbq1c";
18247
18252
  var Snippet = "amkbq16";
18248
18253
  var Time = "amkbq15";
18254
+ const NOTICE = {
18255
+ Deleted: "Original message was deleted",
18256
+ Failed: "Couldn't load the original message",
18257
+ Unavailable: "Original message isn't available to you"
18258
+ };
18249
18259
  const QuoteCard = as(
18250
18260
  ({
18251
18261
  as: Component = "button",
@@ -18255,6 +18265,7 @@ const QuoteCard = as(
18255
18265
  time,
18256
18266
  source: source2,
18257
18267
  snippet,
18268
+ onRetry,
18258
18269
  onClick,
18259
18270
  className,
18260
18271
  ...props
@@ -18268,17 +18279,30 @@ const QuoteCard = as(
18268
18279
  "aria-hidden": true
18269
18280
  }
18270
18281
  );
18271
- if (context === "Deleted") {
18282
+ const notice = NOTICE[context];
18283
+ if (notice || context === "Loading") {
18272
18284
  return /* @__PURE__ */ jsx(
18273
18285
  "div",
18274
18286
  {
18275
18287
  ...props,
18276
18288
  ref,
18277
18289
  "data-context": context,
18290
+ "aria-busy": context === "Loading" || void 0,
18278
18291
  className: classNames(QuoteCard$1, className),
18279
- children: /* @__PURE__ */ jsxs("span", { className: Head, children: [
18292
+ children: notice ? /* @__PURE__ */ jsxs("span", { className: Head, children: [
18280
18293
  glyph,
18281
- /* @__PURE__ */ jsx(Text, { as: "span", size: "T300", className: Deleted, children: "Original message was deleted" })
18294
+ /* @__PURE__ */ jsx(Text, { as: "span", size: "T300", className: Notice, children: notice }),
18295
+ context === "Failed" && onRetry && /* @__PURE__ */ jsx("button", { type: "button", className: Retry, onClick: onRetry, children: "Retry" })
18296
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
18297
+ /* @__PURE__ */ jsxs("span", { className: Head, children: [
18298
+ glyph,
18299
+ avatar && /* @__PURE__ */ jsx("span", { className: Face, "aria-hidden": true, children: avatar }),
18300
+ name ? /* @__PURE__ */ jsx(Text, { as: "span", size: "L400", className: Name$2, children: name }) : /* @__PURE__ */ jsx("span", { className: classNames(Line, NameLine$1), "aria-hidden": true })
18301
+ ] }),
18302
+ /* @__PURE__ */ jsxs("span", { className: Lines, role: "img", "aria-label": "Loading the original message", children: [
18303
+ /* @__PURE__ */ jsx("span", { className: Line }),
18304
+ /* @__PURE__ */ jsx("span", { className: classNames(Line, ShortLine) })
18305
+ ] })
18282
18306
  ] })
18283
18307
  }
18284
18308
  );
@@ -18809,7 +18833,7 @@ export {
18809
18833
  Input,
18810
18834
  InspectorHeader,
18811
18835
  InspectorTab,
18812
- Line,
18836
+ Line$1 as Line,
18813
18837
  LobbyAgentChoice,
18814
18838
  LobbyAgentTile,
18815
18839
  LobbyButton,