@floegence/floe-webapp-core 0.105.4 → 0.106.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/dist/chat.css CHANGED
@@ -1883,6 +1883,7 @@ pre.chat-md-code-block *::selection,
1883
1883
  .chat-media-expanded[data-media-kind="html"] .chat-media-viewport { height: min(70vh, 48rem); }
1884
1884
  .chat-media[data-media-kind="video"] { width: min(100%, 36rem); }
1885
1885
  .chat-media[data-media-kind="audio"] { width: min(100%, 28rem); }
1886
+ .chat-media[data-media-layout="reading-column"]:not([data-media-kind="audio"]) { width: 100%; max-width: 100%; }
1886
1887
  .chat-media-header { display: flex; align-items: center; min-width: 0; padding: .4rem .15rem 0; }
1887
1888
  .chat-media-heading { min-width: 0; }
1888
1889
  .chat-media-kind { display: none; }
@@ -1907,6 +1908,8 @@ pre.chat-md-code-block *::selection,
1907
1908
  .chat-media-source-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
1908
1909
  .chat-media-image-button { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: .75rem; overflow: hidden; cursor: zoom-in; background: transparent; }
1909
1910
  .chat-media-image { display: block; width: 100%; height: 100%; object-fit: contain; margin: 0; border: 0; border-radius: .75rem; }
1911
+ [data-media-layout="reading-column"] .chat-media-image-button { display: flex; align-items: center; justify-content: center; }
1912
+ [data-media-layout="reading-column"] .chat-media-image { width: auto; height: auto; max-width: 100%; max-height: 100%; }
1910
1913
  .chat-media-video { display: block; width: 100%; height: 100%; object-fit: contain; border: 0; border-radius: .75rem; background: #111; }
1911
1914
  .chat-media-audio { display: block; width: min(28rem, 100%); }
1912
1915
  .chat-media-html { display: block; width: 100%; height: 22rem; border: 0; border-radius: .75rem; background: white; color-scheme: light; }
@@ -52,6 +52,8 @@ export interface ResolvedMarkdownMedia {
52
52
  }
53
53
  export interface MarkdownMediaProps {
54
54
  source: MarkdownMediaSource;
55
+ /** Fill the host reading column with visual previews; audio stays compact. */
56
+ layout?: 'compact' | 'reading-column';
55
57
  /** Partial HTML remains inspectable but never executes before a closed fence. */
56
58
  htmlState?: 'generating' | 'incomplete';
57
59
  labels: MarkdownMediaLabels;
@@ -1,70 +1,70 @@
1
1
  import { use as P, insert as v, createComponent as d, memo as O, effect as k, setAttribute as h, className as se, template as g, delegateEvents as de } from "solid-js/web";
2
- import { createSignal as y, onMount as ue, onCleanup as Y, createMemo as ve, createEffect as he, on as me, Show as L, Switch as Z, Match as E } from "solid-js";
2
+ import { createSignal as $, onMount as ue, onCleanup as Y, createMemo as ve, createEffect as he, on as me, Show as L, Switch as Z, Match as E } from "solid-js";
3
3
  import { HtmlPreviewCanvas as ge } from "./HtmlPreviewCanvas.js";
4
4
  import { FloatingWindow as q } from "../../ui/FloatingWindow.js";
5
5
  import { ExternalLink as p, Refresh as fe, FolderOpen as we, Eye as ee } from "../../icons/index.js";
6
6
  import { cn as be } from "../../../utils/cn.js";
7
7
  import { safeMarkdownMediaURL as ne, MarkdownPreviewUnavailable as ke } from "../markdown/media.js";
8
8
  import { SandboxedHtmlFrame as te } from "../../html-preview/SandboxedHtmlFrame.js";
9
- var $e = /* @__PURE__ */ g("<div class=chat-media-preview-content><img referrerpolicy=no-referrer class=chat-media-full-image>"), ye = /* @__PURE__ */ g("<div class=chat-media-preview-content>"), Le = /* @__PURE__ */ g("<span>"), Se = /* @__PURE__ */ g("<span class=chat-media-placeholder role=status>"), Me = /* @__PURE__ */ g("<span class=chat-media-placeholder role=status><span></span><button type=button class=chat-media-retry>"), _e = /* @__PURE__ */ g("<button type=button class=chat-media-image-button><img class=chat-media-image loading=lazy decoding=async referrerpolicy=no-referrer>", !0, !1, !1), Ee = /* @__PURE__ */ g("<video class=chat-media-video controls playsinline preload=metadata>"), Te = /* @__PURE__ */ g("<audio class=chat-media-audio controls preload=metadata>"), xe = /* @__PURE__ */ g("<span class=chat-media-viewport>"), re = /* @__PURE__ */ g("<button type=button class=chat-media-action>"), Ce = /* @__PURE__ */ g("<button type=button class=chat-media-action data-chat-media-action=preview>"), Re = /* @__PURE__ */ g("<span class=chat-media-header><span class=chat-media-heading><span class=chat-media-kind></span><span class=chat-media-title></span></span><span class=chat-media-actions>"), Oe = /* @__PURE__ */ g('<a class=chat-media-source-link target=_blank rel="noopener noreferrer">'), Ue = /* @__PURE__ */ g('<a class=chat-media-action target=_blank rel="noopener noreferrer">');
9
+ var ye = /* @__PURE__ */ g("<div class=chat-media-preview-content><img referrerpolicy=no-referrer class=chat-media-full-image>"), $e = /* @__PURE__ */ g("<div class=chat-media-preview-content>"), Le = /* @__PURE__ */ g("<span>"), Se = /* @__PURE__ */ g("<span class=chat-media-placeholder role=status>"), Me = /* @__PURE__ */ g("<span class=chat-media-placeholder role=status><span></span><button type=button class=chat-media-retry>"), _e = /* @__PURE__ */ g("<button type=button class=chat-media-image-button><img class=chat-media-image loading=lazy decoding=async referrerpolicy=no-referrer>", !0, !1, !1), Ee = /* @__PURE__ */ g("<video class=chat-media-video controls playsinline preload=metadata>"), Te = /* @__PURE__ */ g("<audio class=chat-media-audio controls preload=metadata>"), xe = /* @__PURE__ */ g("<span class=chat-media-viewport>"), re = /* @__PURE__ */ g("<button type=button class=chat-media-action>"), Ce = /* @__PURE__ */ g("<button type=button class=chat-media-action data-chat-media-action=preview>"), Re = /* @__PURE__ */ g("<span class=chat-media-header><span class=chat-media-heading><span class=chat-media-kind></span><span class=chat-media-title></span></span><span class=chat-media-actions>"), Oe = /* @__PURE__ */ g('<a class=chat-media-source-link target=_blank rel="noopener noreferrer">'), Ue = /* @__PURE__ */ g('<a class=chat-media-action target=_blank rel="noopener noreferrer">');
10
10
  async function He(e) {
11
- const $ = ne(e.src ?? "");
12
- if (!$ || e.kind === "html") throw new Error("A host resolver is required");
11
+ const y = ne(e.src ?? "");
12
+ if (!y || e.kind === "html") throw new Error("A host resolver is required");
13
13
  return {
14
- src: $,
15
- openURL: $
14
+ src: y,
15
+ openURL: y
16
16
  };
17
17
  }
18
18
  const We = (e) => {
19
- let $, T, I;
20
- const [le, B] = y(!1);
19
+ let y, T, I;
20
+ const [ae, B] = $(!1);
21
21
  ue(() => {
22
22
  if (typeof IntersectionObserver > "u") {
23
23
  B(!0);
24
24
  return;
25
25
  }
26
- const l = new IntersectionObserver((i) => {
27
- i.some((r) => r.isIntersecting) && (B(!0), l.disconnect());
26
+ const a = new IntersectionObserver((i) => {
27
+ i.some((r) => r.isIntersecting) && (B(!0), a.disconnect());
28
28
  }, {
29
29
  rootMargin: "400px"
30
30
  });
31
- l.observe($), Y(() => l.disconnect());
31
+ a.observe(y), Y(() => a.disconnect());
32
32
  });
33
- const [f, U] = y(), [ae, A] = y(), [ie, D] = y(), [H, x] = y(), [S, z] = y("loading"), [oe, N] = y(0), [F, M] = y(!1), [ce, C] = y(!1), w = () => e.source.title || e.labels[e.source.kind], W = ve(() => e.source, void 0, {
34
- equals: (l, i) => l.kind === i.kind && l.src === i.src && l.html === i.html && l.title === i.title
33
+ const [f, U] = $(), [le, A] = $(), [ie, D] = $(), [H, x] = $(), [S, z] = $("loading"), [oe, N] = $(0), [F, M] = $(!1), [ce, C] = $(!1), w = () => e.source.title || e.labels[e.source.kind], W = ve(() => e.source, void 0, {
34
+ equals: (a, i) => a.kind === i.kind && a.src === i.src && a.html === i.html && a.title === i.title
35
35
  });
36
36
  let R = () => {
37
37
  };
38
- const V = (l) => {
39
- const i = $.ownerDocument.activeElement, r = i instanceof Element && I?.closest("[role=dialog]")?.contains(i) && T?.isConnected;
40
- l(!1), r && T?.focus({
38
+ const V = (a) => {
39
+ const i = y.ownerDocument.activeElement, r = i instanceof Element && I?.closest("[role=dialog]")?.contains(i) && T?.isConnected;
40
+ a(!1), r && T?.focus({
41
41
  preventScroll: !0
42
42
  });
43
- }, j = (l) => {
44
- I = l, queueMicrotask(() => {
45
- l.isConnected && $.ownerDocument.activeElement === T && l.closest('[role="dialog"]')?.focus({
43
+ }, j = (a) => {
44
+ I = a, queueMicrotask(() => {
45
+ a.isConnected && y.ownerDocument.activeElement === T && a.closest('[role="dialog"]')?.focus({
46
46
  preventScroll: !0
47
47
  });
48
48
  });
49
- }, _ = () => f()?.preview?.label || (e.source.kind === "image" ? e.labels.previewImage : e.labels.previewHTMLWindow ?? "Open preview window") || e.labels.open, G = (l) => {
50
- T = l.currentTarget;
49
+ }, _ = () => f()?.preview?.label || (e.source.kind === "image" ? e.labels.previewImage : e.labels.previewHTMLWindow ?? "Open preview window") || e.labels.open, G = (a) => {
50
+ T = a.currentTarget;
51
51
  const i = f()?.preview;
52
52
  i ? i.onSelect() : M(!0);
53
- }, J = (l) => {
54
- T = l?.currentTarget ?? $.querySelector('[aria-haspopup="menu"]') ?? void 0;
53
+ }, J = (a) => {
54
+ T = a?.currentTarget ?? y.querySelector('[aria-haspopup="menu"]') ?? void 0;
55
55
  const i = f()?.preview;
56
56
  i ? i.onSelect() : C(!0);
57
57
  }, K = () => {
58
- const l = e.onOpenLink, i = W();
59
- return l ? (r, t) => l(i, r, t) : void 0;
58
+ const a = e.onOpenLink, i = W();
59
+ return a ? (r, t) => a(i, r, t) : void 0;
60
60
  }, Q = () => ({
61
61
  pointerLocked: e.labels.pointerLocked,
62
62
  linkUnavailable: e.labels.linkUnavailable ?? "Opening links is unavailable in this preview.",
63
63
  anchorUnavailable: e.labels.anchorUnavailable ?? "The linked section was not found."
64
64
  });
65
- return he(me([le, W, () => e.resolve, oe, () => e.htmlState, () => e.loadTimeoutMs], ([l, i, r, , , t]) => {
66
- if (!l) return;
67
- const a = r ?? He, n = new AbortController();
65
+ return he(me([ae, W, () => e.resolve, oe, () => e.htmlState, () => e.loadTimeoutMs], ([a, i, r, , , t]) => {
66
+ if (!a) return;
67
+ const l = r ?? He, n = new AbortController();
68
68
  let u;
69
69
  const c = () => {
70
70
  u !== void 0 && (clearTimeout(u), u = void 0);
@@ -88,7 +88,7 @@ const We = (e) => {
88
88
  if (i.html.length > 1e6) throw new Error("HTML preview is too large");
89
89
  n.signal.aborted || x(i.html);
90
90
  } else {
91
- const s = await a(i, n.signal);
91
+ const s = await l(i, n.signal);
92
92
  if (n.signal.aborted) return;
93
93
  if (i.kind === "html") {
94
94
  if (!s.loadHTML) throw new Error("HTML loader is required");
@@ -103,8 +103,8 @@ const We = (e) => {
103
103
  n.signal.aborted || z("ready");
104
104
  })().catch(o).finally(c);
105
105
  })), (() => {
106
- var l = Le(), i = $;
107
- return typeof i == "function" ? P(i, l) : $ = l, v(l, d(L, {
106
+ var a = Le(), i = y;
107
+ return typeof i == "function" ? P(i, a) : y = a, v(a, d(L, {
108
108
  get when() {
109
109
  return e.source.kind === "html";
110
110
  },
@@ -126,10 +126,10 @@ const We = (e) => {
126
126
  return S() === "error";
127
127
  },
128
128
  get children() {
129
- var t = Me(), a = t.firstChild, n = a.nextSibling;
130
- return v(a, () => e.labels.unavailable), v(t, d(L, {
129
+ var t = Me(), l = t.firstChild, n = l.nextSibling;
130
+ return v(l, () => e.labels.unavailable), v(t, d(L, {
131
131
  get when() {
132
- return ae();
132
+ return le();
133
133
  },
134
134
  children: (u) => (() => {
135
135
  var c = Oe();
@@ -149,10 +149,10 @@ const We = (e) => {
149
149
  return e.source.kind === "image";
150
150
  },
151
151
  get children() {
152
- var t = _e(), a = t.firstChild;
153
- return t.$$click = G, a.addEventListener("error", () => R()), k((n) => {
152
+ var t = _e(), l = t.firstChild;
153
+ return t.$$click = G, l.addEventListener("error", () => R()), k((n) => {
154
154
  var u = `${_()}: ${w()}`, c = f()?.src, o = w();
155
- return u !== n.e && h(t, "aria-label", n.e = u), c !== n.t && h(a, "src", n.t = c), o !== n.a && h(a, "alt", n.a = o), n;
155
+ return u !== n.e && h(t, "aria-label", n.e = u), c !== n.t && h(l, "src", n.t = c), o !== n.a && h(l, "alt", n.a = o), n;
156
156
  }, {
157
157
  e: void 0,
158
158
  t: void 0,
@@ -165,9 +165,9 @@ const We = (e) => {
165
165
  },
166
166
  get children() {
167
167
  var t = Ee();
168
- return t.addEventListener("error", () => R()), k((a) => {
168
+ return t.addEventListener("error", () => R()), k((l) => {
169
169
  var n = f()?.src, u = w();
170
- return n !== a.e && h(t, "src", a.e = n), u !== a.t && h(t, "aria-label", a.t = u), a;
170
+ return n !== l.e && h(t, "src", l.e = n), u !== l.t && h(t, "aria-label", l.t = u), l;
171
171
  }, {
172
172
  e: void 0,
173
173
  t: void 0
@@ -179,9 +179,9 @@ const We = (e) => {
179
179
  },
180
180
  get children() {
181
181
  var t = Te();
182
- return t.addEventListener("error", () => R()), k((a) => {
182
+ return t.addEventListener("error", () => R()), k((l) => {
183
183
  var n = f()?.src, u = w();
184
- return n !== a.e && h(t, "src", a.e = n), u !== a.t && h(t, "aria-label", a.t = u), a;
184
+ return n !== l.e && h(t, "src", l.e = n), u !== l.t && h(t, "aria-label", l.t = u), l;
185
185
  }, {
186
186
  e: void 0,
187
187
  t: void 0
@@ -195,8 +195,8 @@ const We = (e) => {
195
195
  }
196
196
  })), r;
197
197
  })(), (() => {
198
- var r = Re(), t = r.firstChild, a = t.firstChild, n = a.nextSibling, u = t.nextSibling;
199
- return v(a, () => e.labels[e.source.kind]), v(n, w), v(u, d(L, {
198
+ var r = Re(), t = r.firstChild, l = t.firstChild, n = l.nextSibling, u = t.nextSibling;
199
+ return v(l, () => e.labels[e.source.kind]), v(n, w), v(u, d(L, {
200
200
  get when() {
201
201
  return O(() => S() === "ready")() && f()?.reveal;
202
202
  },
@@ -308,7 +308,7 @@ const We = (e) => {
308
308
  }
309
309
  });
310
310
  }
311
- }), null), v(l, d(L, {
311
+ }), null), v(a, d(L, {
312
312
  get when() {
313
313
  return e.source.kind === "image";
314
314
  },
@@ -339,10 +339,10 @@ const We = (e) => {
339
339
  compactBelow: 640,
340
340
  class: "chat-media-preview-window",
341
341
  get children() {
342
- var r = $e(), t = r.firstChild;
343
- return P(j, r), k((a) => {
342
+ var r = ye(), t = r.firstChild;
343
+ return P(j, r), k((l) => {
344
344
  var n = f()?.src, u = w();
345
- return n !== a.e && h(t, "src", a.e = n), u !== a.t && h(t, "alt", a.t = u), a;
345
+ return n !== l.e && h(t, "src", l.e = n), u !== l.t && h(t, "alt", l.t = u), l;
346
346
  }, {
347
347
  e: void 0,
348
348
  t: void 0
@@ -350,7 +350,7 @@ const We = (e) => {
350
350
  }
351
351
  });
352
352
  }
353
- }), null), v(l, d(L, {
353
+ }), null), v(a, d(L, {
354
354
  get when() {
355
355
  return e.source.kind === "html";
356
356
  },
@@ -381,7 +381,7 @@ const We = (e) => {
381
381
  compactBelow: 640,
382
382
  class: "chat-media-preview-window",
383
383
  get children() {
384
- var r = ye();
384
+ var r = $e();
385
385
  return P(j, r), v(r, d(te, {
386
386
  class: "chat-media-html",
387
387
  get title() {
@@ -401,12 +401,13 @@ const We = (e) => {
401
401
  });
402
402
  }
403
403
  }), null), k((r) => {
404
- var t = be("chat-media", F() && e.source.kind === "html" && "chat-media-expanded", e.class), a = e.source.kind;
405
- return t !== r.e && se(l, r.e = t), a !== r.t && h(l, "data-media-kind", r.t = a), r;
404
+ var t = be("chat-media", F() && e.source.kind === "html" && "chat-media-expanded", e.class), l = e.source.kind, n = e.layout;
405
+ return t !== r.e && se(a, r.e = t), l !== r.t && h(a, "data-media-kind", r.t = l), n !== r.a && h(a, "data-media-layout", r.a = n), r;
406
406
  }, {
407
407
  e: void 0,
408
- t: void 0
409
- }), l;
408
+ t: void 0,
409
+ a: void 0
410
+ }), a;
410
411
  })();
411
412
  };
412
413
  de(["click"]);