@decentnetwork/beagle-ui 0.2.33 → 0.2.34
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/beagle-ui.js +50 -2
- package/package.json +1 -1
package/dist/beagle-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const BEAGLE_UI_VERSION = "0.2.
|
|
1
|
+
export const BEAGLE_UI_VERSION = "0.2.34";
|
|
2
2
|
// src/icons.jsx
|
|
3
3
|
var ICON_PATHS = {
|
|
4
4
|
// ---- tab bar (the four must feel like one set) ----
|
|
@@ -1712,6 +1712,28 @@ ${lines}`, { assistant: { kind: "adopt", rows: fresh } }));
|
|
|
1712
1712
|
return { thread, handle, removeFriends, adoptServicePeers };
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
|
+
// src/request-avatar.js
|
|
1716
|
+
var MAX_URL = 2048;
|
|
1717
|
+
function requestAvatarUrl(r) {
|
|
1718
|
+
const u = r && r.avatarUrl;
|
|
1719
|
+
if (typeof u !== "string" || !u || u.length > MAX_URL)
|
|
1720
|
+
return null;
|
|
1721
|
+
return /^https:\/\/[^\s"'<>]+$/i.test(u) ? u : null;
|
|
1722
|
+
}
|
|
1723
|
+
function requestPunkId(r) {
|
|
1724
|
+
const p = r && r.punkId;
|
|
1725
|
+
return typeof p === "number" && Number.isInteger(p) && p >= 0 ? p : null;
|
|
1726
|
+
}
|
|
1727
|
+
function requestAvatarSource(r, skipUrl = false) {
|
|
1728
|
+
const url = skipUrl ? null : requestAvatarUrl(r);
|
|
1729
|
+
if (url)
|
|
1730
|
+
return { kind: "url", url };
|
|
1731
|
+
const id = requestPunkId(r);
|
|
1732
|
+
if (id != null)
|
|
1733
|
+
return { kind: "punk", id };
|
|
1734
|
+
return { kind: "ens" };
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1715
1737
|
// src/chat.jsx
|
|
1716
1738
|
var DK_CMD_HIST_KEY = "beagle.assistant.history";
|
|
1717
1739
|
var DK_CMD_HIST_MAX = 50;
|
|
@@ -1756,7 +1778,7 @@ function RequestsBlock({ T, requests, onAct }) {
|
|
|
1756
1778
|
display: "flex",
|
|
1757
1779
|
flexDirection: "column",
|
|
1758
1780
|
gap: 8
|
|
1759
|
-
} }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8 } }, /* @__PURE__ */ React.createElement(
|
|
1781
|
+
} }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8 } }, /* @__PURE__ */ React.createElement(DkRequestAvatar, { r, size: 30, radius: 7 }), /* @__PURE__ */ React.createElement("div", { style: { minWidth: 0, flex: 1 } }, r.name ? /* @__PURE__ */ React.createElement("div", { style: {
|
|
1760
1782
|
fontFamily: "var(--ui)",
|
|
1761
1783
|
fontSize: 13,
|
|
1762
1784
|
fontWeight: 600,
|
|
@@ -1773,6 +1795,32 @@ function RequestsBlock({ T, requests, onAct }) {
|
|
|
1773
1795
|
paddingLeft: 8
|
|
1774
1796
|
} }, r.descr), failed[r.id] && /* @__PURE__ */ React.createElement("div", { style: { fontFamily: "var(--ui)", fontSize: 11, color: "var(--danger)" } }, failed[r.id]), /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 6 } }, /* @__PURE__ */ React.createElement(Btn, { tone: "ok", icon: "check", size: "sm", onClick: () => act(r, "accept"), style: { flex: 1 } }, T.accept), /* @__PURE__ */ React.createElement(Btn, { tone: "danger", icon: "x", size: "sm", onClick: () => act(r, "reject"), style: { flex: 1 } }, T.reject))))));
|
|
1775
1797
|
}
|
|
1798
|
+
function DkRequestAvatar({ r, size, radius }) {
|
|
1799
|
+
const [urlBroken, setUrlBroken] = React.useState(false);
|
|
1800
|
+
const url = requestAvatarUrl(r);
|
|
1801
|
+
React.useEffect(() => {
|
|
1802
|
+
setUrlBroken(false);
|
|
1803
|
+
}, [url]);
|
|
1804
|
+
const src = requestAvatarSource(r, urlBroken);
|
|
1805
|
+
const seed = r.carrier || r.userid || r.id;
|
|
1806
|
+
if (src.kind === "url") {
|
|
1807
|
+
return /* @__PURE__ */ React.createElement(
|
|
1808
|
+
"img",
|
|
1809
|
+
{
|
|
1810
|
+
src: src.url,
|
|
1811
|
+
alt: "",
|
|
1812
|
+
width: size,
|
|
1813
|
+
height: size,
|
|
1814
|
+
referrerPolicy: "no-referrer",
|
|
1815
|
+
onError: () => setUrlBroken(true),
|
|
1816
|
+
style: { width: size, height: size, borderRadius: radius, objectFit: "cover", flexShrink: 0, background: "var(--panel-2)" }
|
|
1817
|
+
}
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1820
|
+
if (src.kind === "punk")
|
|
1821
|
+
return /* @__PURE__ */ React.createElement(DkPunkAvatar, { id: src.id, size, radius, fallbackSeed: seed });
|
|
1822
|
+
return /* @__PURE__ */ React.createElement(DkEnsAvatar, { userid: r.userid || r.id, name: r.name, fallbackSeed: r.carrier, size, radius });
|
|
1823
|
+
}
|
|
1776
1824
|
function PeerRow({ peer, T, active, onClick, muted, isProtocol, fix }) {
|
|
1777
1825
|
const name = peer.alias || peer.userId;
|
|
1778
1826
|
const row = rosterRow(peer, isProtocol || (() => false), fix);
|
package/package.json
CHANGED