@parallelworks/tandem-web 0.162.0 → 0.164.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.
@@ -19,7 +19,30 @@ function o(e) {
19
19
  function s(t) {
20
20
  return t.startsWith("/api/v1/attachments/") ? e + t : t;
21
21
  }
22
- async function c(e, r, i) {
22
+ var c = /\.(mp4|m4v|mov|webm)$/i;
23
+ function l(e) {
24
+ if (!e) return !1;
25
+ try {
26
+ let t = new URL(e);
27
+ return t.protocol === "https:" && t.hostname.toLowerCase() === "github.com" && /^\/user-attachments\/assets\/[0-9a-f-]{36}$/.test(t.pathname) && !t.search && !t.hash;
28
+ } catch {
29
+ return !1;
30
+ }
31
+ }
32
+ function u(t) {
33
+ return l(t) ? `${e}/api/v1/github/media?url=${encodeURIComponent(t)}` : s(t);
34
+ }
35
+ function d(e) {
36
+ if (!e) return !1;
37
+ if (o(e)) return !0;
38
+ try {
39
+ let t = new URL(e, window.location.origin);
40
+ return t.origin === window.location.origin && c.test(t.pathname);
41
+ } catch {
42
+ return !1;
43
+ }
44
+ }
45
+ async function f(e, r, i) {
23
46
  return n(await t.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/attachments", {
24
47
  params: {
25
48
  path: {
@@ -33,7 +56,7 @@ async function c(e, r, i) {
33
56
  headers: { "Content-Type": "application/octet-stream" }
34
57
  }));
35
58
  }
36
- async function l(e, r, i) {
59
+ async function p(e, r, i) {
37
60
  return n(await t.POST("/api/v1/workspaces/{workspace}/knowledge/{entry}/attachments", {
38
61
  params: {
39
62
  path: {
@@ -47,7 +70,7 @@ async function l(e, r, i) {
47
70
  headers: { "Content-Type": "application/octet-stream" }
48
71
  }));
49
72
  }
50
- function u(e, t, n) {
73
+ function m(e, t, n) {
51
74
  let i = t.flatMap((e) => {
52
75
  let t = r + e.id;
53
76
  return e.inline ? [{
@@ -70,7 +93,7 @@ function u(e, t, n) {
70
93
  }), a = e.chain().focus();
71
94
  (n === void 0 ? a : a.setTextSelection(n)).insertContent(i).run();
72
95
  }
73
- var d = (() => {
96
+ var h = (() => {
74
97
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
75
98
  return {
76
99
  get: (t) => e.get(t),
@@ -86,13 +109,13 @@ var d = (() => {
86
109
  }
87
110
  };
88
111
  })();
89
- function f(e) {
112
+ function g(e) {
90
113
  return new Promise((t, n) => {
91
114
  let r = new FileReader();
92
115
  r.onload = () => t(String(r.result)), r.onerror = () => n(r.error), r.readAsDataURL(e);
93
116
  });
94
117
  }
95
- function p(e, t, n) {
118
+ function _(e, t, n) {
96
119
  let r = t.flatMap(({ file: e, src: t }) => e.type.startsWith("image/") ? [{
97
120
  type: "image",
98
121
  attrs: {
@@ -112,4 +135,4 @@ function p(e, t, n) {
112
135
  }]);
113
136
  n === void 0 ? e.chain().focus().insertContent(r).run() : e.chain().focus().insertContentAt(n, r).run();
114
137
  }
115
- export { a as attachmentIdOf, r as attachmentPrefix, d as attachmentSizes, s as attachmentURL, o as githubMedia, u as insertAttachments, p as insertPreviews, f as readDataURL, c as uploadAttachment, l as uploadKnowledgeAttachment };
138
+ export { a as attachmentIdOf, r as attachmentPrefix, h as attachmentSizes, s as attachmentURL, o as githubMedia, l as githubUpload, m as insertAttachments, _ as insertPreviews, u as mediaURL, d as playableLink, g as readDataURL, f as uploadAttachment, p as uploadKnowledgeAttachment, c as videoName };
@@ -0,0 +1,13 @@
1
+ import { basePath as e } from "./base.js";
2
+ import { api as t } from "../api/client.js";
3
+ // src/lib/githubLink.ts
4
+ var n;
5
+ function r() {
6
+ return n ??= t.GET("/api/v1/me/github").then(({ data: t }) => {
7
+ if (!t?.enabled || !t.keepsTokens || t.actsAsYou) return null;
8
+ if (t.linkedByHost) return t.linkURL ?? null;
9
+ let n = window.location.pathname.slice(e.length).split("/")[1];
10
+ return n ? `${e}/${n}/settings/connections` : null;
11
+ }).catch(() => null), n;
12
+ }
13
+ export { r as githubLinkPage };
@@ -0,0 +1,15 @@
1
+ // src/lib/videoMarkdown.ts
2
+ var e = /^<video\b([^>]*)>(?:([\s\S]*?)<\/video>)?[ \t]*(?:\n|$)/i, t = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i, n = (e) => e.replace(/&quot;/g, "\"").replace(/&#39;/g, "'").replace(/&amp;/g, "&");
3
+ function r(r) {
4
+ let i = e.exec(r);
5
+ if (!i) return;
6
+ let a = t.exec(i[1] ?? ""), o = /<source\b[^>]*>/i.exec(i[2] ?? ""), s = a ?? (o ? t.exec(o[0]) : null), c = s ? s[1] ?? s[2] ?? "" : "";
7
+ return c ? {
8
+ raw: i[0],
9
+ url: n(c)
10
+ } : void 0;
11
+ }
12
+ function i(e) {
13
+ return `<video src="${e.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}"></video>`;
14
+ }
15
+ export { i as videoMarkdown, r as videoTag };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.162.0",
3
+ "version": "0.164.0",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/styles.css CHANGED
@@ -653,6 +653,18 @@ body[data-tandem] > :not(:has(.tandem)) {
653
653
  border-radius: 0.375rem;
654
654
  background: var(--color-muted);
655
655
  }
656
+ /* Where a recording that won't play was: its link, and where to link
657
+ GitHub when that would let it play (unplayable). */
658
+ .prose-issue .recording-box,
659
+ .prose-issue .recording-unplayable {
660
+ display: block;
661
+ }
662
+ .prose-issue .recording-unplayable a.recording-hint {
663
+ display: block;
664
+ margin: 0.2em 0 0.4em;
665
+ font-size: 0.8125rem;
666
+ color: var(--color-muted-foreground);
667
+ }
656
668
  /* An attached file reads as a chip with its size, and downloads. */
657
669
  .prose-issue a[href*="/api/v1/attachments/"] {
658
670
  display: inline-flex;