@parallelworks/tandem-web 0.141.2 → 0.142.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/_virtual/_virtual_i18n/en/common.js +58 -0
- package/_virtual/_virtual_i18n/es/common.js +58 -0
- package/_virtual/_virtual_i18n/ja/common.js +58 -0
- package/_virtual/_virtual_i18n/ko/common.js +58 -0
- package/_virtual/_virtual_i18n/zh/common.js +58 -0
- package/components/DocProperties.js +314 -0
- package/components/DocTable.js +176 -0
- package/components/DocViewBlock.js +104 -0
- package/components/DocsTree.js +16 -6
- package/components/Editor.js +30 -28
- package/components/SlashMenu.js +2 -0
- package/lib/docProperties.js +135 -0
- package/package.json +1 -1
- package/routeTree.gen.js +176 -170
- package/routes/_workspace/docs/_doc2.js +147 -140
- package/routes/_workspace/docs/space._space.js +6 -0
- package/routes/_workspace/docs/space2._space.js +256 -0
- package/routes/_workspace/docs2.js +3 -3
- package/routes/_workspace2.js +2 -2
- package/styles.css +39 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { docsQuery as e } from "../api/queries.js";
|
|
2
|
+
import { docRef as t } from "../lib/docs.js";
|
|
3
|
+
import { usePeople as n } from "../lib/people.js";
|
|
4
|
+
import { useCan as r } from "../lib/roles.js";
|
|
5
|
+
import { DocIcon as i } from "./DocIcon.js";
|
|
6
|
+
import { docPropertiesQuery as a, spaceScope as o, useDocPropertyActions as s } from "../lib/docProperties.js";
|
|
7
|
+
import { usePropertyText as c } from "./DocProperties.js";
|
|
8
|
+
import { cx as l } from "@parallelworks/ui";
|
|
9
|
+
import { Link as u } from "@tanstack/react-router";
|
|
10
|
+
import { useState as d } from "react";
|
|
11
|
+
import { useFormatter as f, useTranslations as p } from "use-intl";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
|
+
import { keepPreviousData as g, useQuery as _ } from "@tanstack/react-query";
|
|
14
|
+
// src/components/DocTable.tsx
|
|
15
|
+
var v = (e) => e.kind === "select" || e.kind === "person";
|
|
16
|
+
function y(t, n, r) {
|
|
17
|
+
let i = Object.entries(r.filters ?? {}).map(([e, t]) => `${e}=${t}`), { data: o = [], isPending: s } = _({
|
|
18
|
+
...e(t, {
|
|
19
|
+
...n === "workspace" ? { workspace: !0 } : { team: n },
|
|
20
|
+
...i.length > 0 && { property: i }
|
|
21
|
+
}),
|
|
22
|
+
placeholderData: g
|
|
23
|
+
}), { data: l = [] } = _(a(t, n)), u = c(t), d = r.sort ?? "title", f = l.find((e) => e.id === d), p = (e) => {
|
|
24
|
+
if (d === "updated") return e.updatedAt;
|
|
25
|
+
if (!f) return e.title.toLowerCase();
|
|
26
|
+
let t = e.properties?.[f.id];
|
|
27
|
+
return f.kind === "number" ? typeof t == "number" ? t : -Infinity : u(f, t).toLowerCase();
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
docs: o.filter((e) => !e.template).sort((e, t) => {
|
|
31
|
+
let n = p(e), i = p(t), a = n < i ? -1 : +(n > i);
|
|
32
|
+
return r.desc ? -a : a;
|
|
33
|
+
}),
|
|
34
|
+
props: l,
|
|
35
|
+
isPending: s
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function b({ workspace: e, space: n, layout: r, config: a }) {
|
|
39
|
+
let o = p("docViews"), s = f(), { docs: l, props: d, isPending: g } = y(e, n, a), _ = c(e), b = (e, t) => e.properties?.[t.id];
|
|
40
|
+
if (g) return /* @__PURE__ */ m("p", {
|
|
41
|
+
className: "p-4 text-sm text-muted-foreground",
|
|
42
|
+
children: o("loading")
|
|
43
|
+
});
|
|
44
|
+
if (r === "board") {
|
|
45
|
+
let t = d.find((e) => e.id === a.groupBy && v(e));
|
|
46
|
+
return t ? /* @__PURE__ */ m(x, {
|
|
47
|
+
workspace: e,
|
|
48
|
+
space: n,
|
|
49
|
+
docs: l,
|
|
50
|
+
props: d,
|
|
51
|
+
by: t
|
|
52
|
+
}) : /* @__PURE__ */ m("p", {
|
|
53
|
+
className: "p-4 text-sm text-muted-foreground",
|
|
54
|
+
children: o("pickGroup")
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
let S = a.columns ? a.columns.flatMap((e) => d.filter((t) => t.id === e)) : d;
|
|
58
|
+
return l.length === 0 ? /* @__PURE__ */ m("p", {
|
|
59
|
+
className: "p-4 text-sm text-muted-foreground",
|
|
60
|
+
children: o("none")
|
|
61
|
+
}) : /* @__PURE__ */ m("div", {
|
|
62
|
+
className: "overflow-x-auto",
|
|
63
|
+
children: /* @__PURE__ */ h("table", {
|
|
64
|
+
className: "doc-table w-full min-w-max text-sm",
|
|
65
|
+
children: [/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
66
|
+
/* @__PURE__ */ m("th", {
|
|
67
|
+
scope: "col",
|
|
68
|
+
children: o("docTitle")
|
|
69
|
+
}),
|
|
70
|
+
S.map((e) => /* @__PURE__ */ m("th", {
|
|
71
|
+
scope: "col",
|
|
72
|
+
children: e.name
|
|
73
|
+
}, e.id)),
|
|
74
|
+
/* @__PURE__ */ m("th", {
|
|
75
|
+
scope: "col",
|
|
76
|
+
children: o("updated")
|
|
77
|
+
})
|
|
78
|
+
] }) }), /* @__PURE__ */ m("tbody", { children: l.map((n) => /* @__PURE__ */ h("tr", { children: [
|
|
79
|
+
/* @__PURE__ */ m("td", { children: /* @__PURE__ */ h(u, {
|
|
80
|
+
to: "/$workspace/docs/$doc",
|
|
81
|
+
params: {
|
|
82
|
+
workspace: e,
|
|
83
|
+
doc: t(n)
|
|
84
|
+
},
|
|
85
|
+
className: "flex items-center gap-2 font-medium hover:underline",
|
|
86
|
+
children: [/* @__PURE__ */ m(i, { icon: n.icon }), /* @__PURE__ */ m("span", {
|
|
87
|
+
className: "truncate",
|
|
88
|
+
children: n.title
|
|
89
|
+
})]
|
|
90
|
+
}) }),
|
|
91
|
+
S.map((e) => /* @__PURE__ */ m("td", { children: _(e, b(n, e)) }, e.id)),
|
|
92
|
+
/* @__PURE__ */ m("td", {
|
|
93
|
+
className: "text-muted-foreground",
|
|
94
|
+
children: s.dateTime(new Date(n.updatedAt), { dateStyle: "medium" })
|
|
95
|
+
})
|
|
96
|
+
] }, n.id)) })]
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function x({ workspace: e, space: a, docs: f, props: g, by: _ }) {
|
|
101
|
+
let v = p("docViews"), { members: y } = n(e), b = c(e), x = r(e, "edit_docs", o(a)), S = s(e), [C, w] = d(null), [T, E] = d(null), D = [..._.kind === "select" ? _.options.map((e) => ({
|
|
102
|
+
key: e.id ?? "",
|
|
103
|
+
label: e.name
|
|
104
|
+
})) : y.map((e) => ({
|
|
105
|
+
key: e.user.username,
|
|
106
|
+
label: e.user.name
|
|
107
|
+
})), {
|
|
108
|
+
key: "",
|
|
109
|
+
label: v("noValue", { property: _.name })
|
|
110
|
+
}], O = (e) => {
|
|
111
|
+
let t = e.properties?.[_.id];
|
|
112
|
+
return typeof t == "string" ? t : "";
|
|
113
|
+
}, k = D.filter((e) => _.kind === "select" || e.key === "" || f.some((t) => O(t) === e.key)), A = g.filter((e) => e.id !== _.id).slice(0, 2);
|
|
114
|
+
return /* @__PURE__ */ m("ul", {
|
|
115
|
+
className: "flex gap-3 overflow-x-auto p-3",
|
|
116
|
+
"aria-label": v("board"),
|
|
117
|
+
children: k.map((n) => {
|
|
118
|
+
let r = f.filter((e) => O(e) === n.key);
|
|
119
|
+
return /* @__PURE__ */ h("li", {
|
|
120
|
+
"aria-label": n.label,
|
|
121
|
+
onDragOver: (e) => {
|
|
122
|
+
C && (e.preventDefault(), E(n.key));
|
|
123
|
+
},
|
|
124
|
+
onDragLeave: () => E((e) => e === n.key ? null : e),
|
|
125
|
+
onDrop: (e) => {
|
|
126
|
+
e.preventDefault(), C && S.setValues.mutate({
|
|
127
|
+
doc: C,
|
|
128
|
+
values: { [_.id]: n.key || null }
|
|
129
|
+
}), w(null), E(null);
|
|
130
|
+
},
|
|
131
|
+
className: l("flex w-64 shrink-0 flex-col rounded-lg border bg-muted/30", T === n.key ? "border-primary" : "border-border"),
|
|
132
|
+
children: [/* @__PURE__ */ h("p", {
|
|
133
|
+
className: "flex items-center gap-2 px-3 py-2 text-xs font-medium",
|
|
134
|
+
children: [/* @__PURE__ */ m("span", {
|
|
135
|
+
className: "truncate",
|
|
136
|
+
children: n.label
|
|
137
|
+
}), /* @__PURE__ */ m("span", {
|
|
138
|
+
className: "text-muted-foreground tabular-nums",
|
|
139
|
+
children: r.length
|
|
140
|
+
})]
|
|
141
|
+
}), /* @__PURE__ */ m("ul", {
|
|
142
|
+
className: "flex flex-col gap-2 px-2 pb-2",
|
|
143
|
+
children: r.map((n) => /* @__PURE__ */ h("li", {
|
|
144
|
+
draggable: x,
|
|
145
|
+
onDragStart: () => w(n.key),
|
|
146
|
+
onDragEnd: () => w(null),
|
|
147
|
+
className: "rounded-md border border-border bg-card p-2.5 text-sm shadow-xs",
|
|
148
|
+
children: [/* @__PURE__ */ h(u, {
|
|
149
|
+
to: "/$workspace/docs/$doc",
|
|
150
|
+
params: {
|
|
151
|
+
workspace: e,
|
|
152
|
+
doc: t(n)
|
|
153
|
+
},
|
|
154
|
+
className: "flex items-center gap-2 font-medium hover:underline",
|
|
155
|
+
children: [/* @__PURE__ */ m(i, { icon: n.icon }), /* @__PURE__ */ m("span", {
|
|
156
|
+
className: "truncate",
|
|
157
|
+
children: n.title
|
|
158
|
+
})]
|
|
159
|
+
}), A.map((e) => {
|
|
160
|
+
let t = b(e, n.properties?.[e.id]);
|
|
161
|
+
return t ? /* @__PURE__ */ h("p", {
|
|
162
|
+
className: "mt-1 truncate text-xs text-muted-foreground",
|
|
163
|
+
children: [
|
|
164
|
+
e.name,
|
|
165
|
+
": ",
|
|
166
|
+
t
|
|
167
|
+
]
|
|
168
|
+
}, e.id) : null;
|
|
169
|
+
})]
|
|
170
|
+
}, n.id))
|
|
171
|
+
})]
|
|
172
|
+
}, n.key || "none");
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
export { b as DocTable, v as groupable, y as useSpaceDocs };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { docQuery as e, teamsQuery as t } from "../api/queries.js";
|
|
2
|
+
import { docViewQuery as n, docViewsQuery as r, readConfig as i } from "../lib/docProperties.js";
|
|
3
|
+
import { DocTable as a } from "./DocTable.js";
|
|
4
|
+
import { Select as o } from "@parallelworks/ui";
|
|
5
|
+
import { Link as s, useParams as c } from "@tanstack/react-router";
|
|
6
|
+
import { useTranslations as l } from "use-intl";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
import { useQuery as f } from "@tanstack/react-query";
|
|
9
|
+
import { Node as p, NodeViewWrapper as m, ReactNodeViewRenderer as h, mergeAttributes as g } from "@tiptap/react";
|
|
10
|
+
// src/components/DocViewBlock.tsx
|
|
11
|
+
var _ = p.create({
|
|
12
|
+
name: "docView",
|
|
13
|
+
group: "block",
|
|
14
|
+
atom: !0,
|
|
15
|
+
draggable: !0,
|
|
16
|
+
addAttributes: () => ({ view: { default: "" } }),
|
|
17
|
+
parseHTML: () => [{ tag: "div[data-doc-view]" }],
|
|
18
|
+
renderHTML: ({ HTMLAttributes: e }) => ["div", g(e, { "data-doc-view": "" })],
|
|
19
|
+
addNodeView: () => h(v, { stopEvent: ({ event: e }) => !e.type.startsWith("drag") && e.target instanceof Element && !!e.target.closest("[data-view-ui]") }),
|
|
20
|
+
markdownTokenName: "docView",
|
|
21
|
+
markdownTokenizer: {
|
|
22
|
+
name: "docView",
|
|
23
|
+
level: "block",
|
|
24
|
+
start: (e) => e.search(/^:::docview/m),
|
|
25
|
+
tokenize: (e) => {
|
|
26
|
+
let t = /^:::docview[ \t]*([0-9a-f-]{36})?[ \t]*\n[ \t]*:::[ \t]*(?:\n|$)/.exec(e);
|
|
27
|
+
return t ? {
|
|
28
|
+
type: "docView",
|
|
29
|
+
raw: t[0],
|
|
30
|
+
text: t[1] ?? ""
|
|
31
|
+
} : void 0;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
parseMarkdown: (e, t) => t.createNode("docView", { view: e.text ?? "" }),
|
|
35
|
+
renderMarkdown: (e) => `:::docview ${String(e.attrs?.view ?? "")}\n:::`
|
|
36
|
+
});
|
|
37
|
+
function v({ node: p, editor: h, updateAttributes: g }) {
|
|
38
|
+
let _ = l("docViews"), { workspace: v = "", doc: y = "" } = c({ strict: !1 }), b = String(p.attrs.view ?? ""), { data: x = [] } = f(t(v)), { data: S } = f({
|
|
39
|
+
...n(v, b),
|
|
40
|
+
enabled: !!v && !!b
|
|
41
|
+
}), { data: C } = f({
|
|
42
|
+
...e(v, y),
|
|
43
|
+
enabled: !b && !!y
|
|
44
|
+
}), w = x.find((e) => e.id === C?.teamId)?.key ?? "workspace", { data: T = [] } = f({
|
|
45
|
+
...r(v, w),
|
|
46
|
+
enabled: !b && !!v
|
|
47
|
+
});
|
|
48
|
+
if (!b || !S) return /* @__PURE__ */ u(m, {
|
|
49
|
+
className: "doc-view-block",
|
|
50
|
+
contentEditable: !1,
|
|
51
|
+
children: /* @__PURE__ */ u("div", {
|
|
52
|
+
"data-view-ui": !0,
|
|
53
|
+
className: "p-3",
|
|
54
|
+
children: h.isEditable ? /* @__PURE__ */ u(o, {
|
|
55
|
+
value: "",
|
|
56
|
+
items: [{
|
|
57
|
+
value: "",
|
|
58
|
+
label: _("embedPick")
|
|
59
|
+
}, ...T.map((e) => ({
|
|
60
|
+
value: e.id,
|
|
61
|
+
label: e.name
|
|
62
|
+
}))],
|
|
63
|
+
onValueChange: (e) => e && g({ view: e }),
|
|
64
|
+
"aria-label": _("embedPick"),
|
|
65
|
+
size: "sm",
|
|
66
|
+
width: "content"
|
|
67
|
+
}) : /* @__PURE__ */ u("p", {
|
|
68
|
+
className: "text-xs text-muted-foreground",
|
|
69
|
+
children: _("loading")
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
let E = x.find((e) => e.id === S.teamId)?.key ?? "workspace";
|
|
74
|
+
return /* @__PURE__ */ u(m, {
|
|
75
|
+
className: "doc-view-block not-prose",
|
|
76
|
+
contentEditable: !1,
|
|
77
|
+
"data-drag-handle": !0,
|
|
78
|
+
children: /* @__PURE__ */ d("div", {
|
|
79
|
+
"data-view-ui": !0,
|
|
80
|
+
children: [/* @__PURE__ */ d("div", {
|
|
81
|
+
className: "flex items-center gap-2 border-b border-border px-3 py-1.5 text-xs",
|
|
82
|
+
children: [/* @__PURE__ */ u("span", {
|
|
83
|
+
className: "min-w-0 flex-1 truncate font-medium",
|
|
84
|
+
children: S.name
|
|
85
|
+
}), /* @__PURE__ */ u(s, {
|
|
86
|
+
to: "/$workspace/docs/space/$space",
|
|
87
|
+
params: {
|
|
88
|
+
workspace: v,
|
|
89
|
+
space: E
|
|
90
|
+
},
|
|
91
|
+
search: { view: S.id },
|
|
92
|
+
className: "text-primary hover:underline",
|
|
93
|
+
children: _("open")
|
|
94
|
+
})]
|
|
95
|
+
}), /* @__PURE__ */ u(a, {
|
|
96
|
+
workspace: v,
|
|
97
|
+
space: E,
|
|
98
|
+
layout: S.layout,
|
|
99
|
+
config: i(S.config)
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export { _ as DocViewBlock };
|
package/components/DocsTree.js
CHANGED
|
@@ -9,7 +9,7 @@ import { EntityIcon as _ } from "./EntityIcon.js";
|
|
|
9
9
|
import { DocIcon as v } from "./DocIcon.js";
|
|
10
10
|
import { indentLevel as y, revealed as b, saveTree as ee, savedTree as te, spaceOf as x, toggled as S } from "../lib/docTree.js";
|
|
11
11
|
import { useMarkdownTransfer as C } from "./MarkdownTransfer.js";
|
|
12
|
-
import { Combobox as
|
|
12
|
+
import { Combobox as ne, IconButton as w, RelativeTime as T, SearchInput as re, Tooltip as E, buttonClasses as ie, menuDivider as D, useOpenMenu as O } from "@parallelworks/ui";
|
|
13
13
|
import { useEffect as k, useRef as ae, useState as A, useSyncExternalStore as oe } from "react";
|
|
14
14
|
import { useTranslations as j } from "use-intl";
|
|
15
15
|
import { Fragment as se, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
@@ -121,7 +121,7 @@ function G({ workspace: r, current: d, page: f = !1, onIndex: p = !1, menu: v, t
|
|
|
121
121
|
},
|
|
122
122
|
search: { rename: !0 }
|
|
123
123
|
}) })
|
|
124
|
-
}, Te = /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(
|
|
124
|
+
}, Te = /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(w, {
|
|
125
125
|
variant: "ghost",
|
|
126
126
|
size: "xs",
|
|
127
127
|
icon: /* @__PURE__ */ M(u, {}),
|
|
@@ -131,7 +131,7 @@ function G({ workspace: r, current: d, page: f = !1, onIndex: p = !1, menu: v, t
|
|
|
131
131
|
W((e) => !e), K("");
|
|
132
132
|
},
|
|
133
133
|
className: f ? "" : z
|
|
134
|
-
}), Z.length === 0 ? /* @__PURE__ */ M(
|
|
134
|
+
}), Z.length === 0 ? /* @__PURE__ */ M(w, {
|
|
135
135
|
variant: "ghost",
|
|
136
136
|
size: "xs",
|
|
137
137
|
icon: /* @__PURE__ */ M(s, {}),
|
|
@@ -139,7 +139,7 @@ function G({ workspace: r, current: d, page: f = !1, onIndex: p = !1, menu: v, t
|
|
|
139
139
|
onClick: () => B.create.mutate({}),
|
|
140
140
|
disabled: B.create.isPending,
|
|
141
141
|
className: f ? "" : z
|
|
142
|
-
}) : /* @__PURE__ */ M(
|
|
142
|
+
}) : /* @__PURE__ */ M(ne, {
|
|
143
143
|
items: [{
|
|
144
144
|
value: "",
|
|
145
145
|
label: D.name
|
|
@@ -204,7 +204,7 @@ function G({ workspace: r, current: d, page: f = !1, onIndex: p = !1, menu: v, t
|
|
|
204
204
|
})]
|
|
205
205
|
}),
|
|
206
206
|
Te,
|
|
207
|
-
/* @__PURE__ */ M(
|
|
207
|
+
/* @__PURE__ */ M(w, {
|
|
208
208
|
variant: "ghost",
|
|
209
209
|
size: "xs",
|
|
210
210
|
icon: /* @__PURE__ */ M(c, { className: R(!Q && "rotate-90") }),
|
|
@@ -284,11 +284,21 @@ function G({ workspace: r, current: d, page: f = !1, onIndex: p = !1, menu: v, t
|
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
function pe({ ctx: e, id: n, team: i, name: a, icon: o, docs: l, closed: u, onToggle: m, row: g = !1 }) {
|
|
287
|
-
let _ = j("docs"), v = j("common"), y = O(), b = h(e.workspace), ee = f(), te = t(), x = e.workspace, { data: S = [] } = F(r(x)), C = `docs-space-${n}`, w = () => [
|
|
287
|
+
let _ = j("docs"), v = j("common"), y = O(), b = h(e.workspace), ee = f(), te = t(), x = e.workspace, { data: S = [] } = F(r(x)), C = `docs-space-${n}`, ne = j("docViews"), w = () => [
|
|
288
288
|
{
|
|
289
289
|
label: _("newInSpace"),
|
|
290
290
|
onClick: () => b.create.mutate({ team: i?.key })
|
|
291
291
|
},
|
|
292
|
+
{
|
|
293
|
+
label: ne("openTable"),
|
|
294
|
+
onClick: () => te({
|
|
295
|
+
to: "/$workspace/docs/space/$space",
|
|
296
|
+
params: {
|
|
297
|
+
workspace: x,
|
|
298
|
+
space: i?.key ?? "workspace"
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
},
|
|
292
302
|
{
|
|
293
303
|
label: _("newFromTemplate"),
|
|
294
304
|
items: S.map((e) => ({
|
package/components/Editor.js
CHANGED
|
@@ -5,12 +5,13 @@ import { Columns as p } from "./columns.js";
|
|
|
5
5
|
import { DateChip as m } from "./DateChip.js";
|
|
6
6
|
import { DocButton as h } from "./DocButton.js";
|
|
7
7
|
import { DocLinkPicker as g } from "./DocLinkPicker.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { DocViewBlock as _ } from "./DocViewBlock.js";
|
|
9
|
+
import { IssueListBlock as ee } from "./IssueListBlock.js";
|
|
10
|
+
import { LinkCard as v } from "./LinkCard.js";
|
|
11
|
+
import { MentionPicker as y } from "./MentionPicker.js";
|
|
12
|
+
import { Diagrams as b, MathBlock as te, MathInline as ne } from "./mathDiagrams.js";
|
|
13
|
+
import { SlashMenu as x } from "./SlashMenu.js";
|
|
14
|
+
import { SubPages as S } from "./SubPages.js";
|
|
14
15
|
import { MarkdownTable as C } from "./table.js";
|
|
15
16
|
import { useEffect as w, useRef as T } from "react";
|
|
16
17
|
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
@@ -21,8 +22,8 @@ import { TableKit as P } from "@tiptap/extension-table";
|
|
|
21
22
|
import { Placeholder as F } from "@tiptap/extensions";
|
|
22
23
|
import { Markdown as I } from "@tiptap/markdown";
|
|
23
24
|
import L from "@tiptap/starter-kit";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
25
|
+
import re from "highlight.js/lib/languages/bash";
|
|
26
|
+
import R from "highlight.js/lib/languages/css";
|
|
26
27
|
import z from "highlight.js/lib/languages/diff";
|
|
27
28
|
import B from "highlight.js/lib/languages/dockerfile";
|
|
28
29
|
import V from "highlight.js/lib/languages/go";
|
|
@@ -36,12 +37,12 @@ import J from "highlight.js/lib/languages/shell";
|
|
|
36
37
|
import Y from "highlight.js/lib/languages/sql";
|
|
37
38
|
import X from "highlight.js/lib/languages/typescript";
|
|
38
39
|
import Z from "highlight.js/lib/languages/xml";
|
|
39
|
-
import
|
|
40
|
-
import { createLowlight as
|
|
40
|
+
import ie from "highlight.js/lib/languages/yaml";
|
|
41
|
+
import { createLowlight as ae } from "lowlight";
|
|
41
42
|
// src/components/Editor.tsx
|
|
42
|
-
var
|
|
43
|
-
bash:
|
|
44
|
-
css:
|
|
43
|
+
var oe = ae({
|
|
44
|
+
bash: re,
|
|
45
|
+
css: R,
|
|
45
46
|
diff: z,
|
|
46
47
|
dockerfile: B,
|
|
47
48
|
go: V,
|
|
@@ -55,9 +56,9 @@ var ae = ie({
|
|
|
55
56
|
sql: Y,
|
|
56
57
|
typescript: X,
|
|
57
58
|
xml: Z,
|
|
58
|
-
yaml:
|
|
59
|
+
yaml: ie
|
|
59
60
|
});
|
|
60
|
-
function Q({ editable: g = !0, placeholder:
|
|
61
|
+
function Q({ editable: g = !0, placeholder: y = "", collaborative: x = !1 } = {}) {
|
|
61
62
|
return [
|
|
62
63
|
L.configure({
|
|
63
64
|
link: {
|
|
@@ -66,15 +67,15 @@ function Q({ editable: g = !0, placeholder: v = "", collaborative: S = !1 } = {}
|
|
|
66
67
|
},
|
|
67
68
|
codeBlock: !1,
|
|
68
69
|
blockquote: !1,
|
|
69
|
-
...g && !
|
|
70
|
-
...
|
|
70
|
+
...g && !x ? {} : { trailingNode: !1 },
|
|
71
|
+
...x ? { undoRedo: !1 } : {}
|
|
71
72
|
}),
|
|
72
|
-
j.configure({ lowlight:
|
|
73
|
+
j.configure({ lowlight: oe }),
|
|
73
74
|
l,
|
|
74
75
|
N,
|
|
75
76
|
M.configure({ nested: !0 }),
|
|
76
77
|
f,
|
|
77
|
-
|
|
78
|
+
S,
|
|
78
79
|
d,
|
|
79
80
|
u,
|
|
80
81
|
p,
|
|
@@ -83,7 +84,7 @@ function Q({ editable: g = !0, placeholder: v = "", collaborative: S = !1 } = {}
|
|
|
83
84
|
resizable: !1,
|
|
84
85
|
allowTableNodeSelection: !1
|
|
85
86
|
}),
|
|
86
|
-
F.configure({ placeholder:
|
|
87
|
+
F.configure({ placeholder: y }),
|
|
87
88
|
I,
|
|
88
89
|
a,
|
|
89
90
|
r,
|
|
@@ -94,12 +95,13 @@ function Q({ editable: g = !0, placeholder: v = "", collaborative: S = !1 } = {}
|
|
|
94
95
|
s,
|
|
95
96
|
c,
|
|
96
97
|
i,
|
|
98
|
+
_,
|
|
97
99
|
h,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
v,
|
|
101
|
+
ne,
|
|
102
|
+
te,
|
|
100
103
|
b,
|
|
101
|
-
|
|
102
|
-
_,
|
|
104
|
+
ee,
|
|
103
105
|
m
|
|
104
106
|
];
|
|
105
107
|
}
|
|
@@ -118,7 +120,7 @@ function $(e) {
|
|
|
118
120
|
}
|
|
119
121
|
};
|
|
120
122
|
}
|
|
121
|
-
function
|
|
123
|
+
function se({ value: e, onChange: t, onSubmit: n, onBlur: r, onFocus: i, placeholder: a, editable: o = !0, autofocus: s = !1, className: c = "", label: l, onFiles: u, onEditor: d }) {
|
|
122
124
|
let f = T({
|
|
123
125
|
onChange: t,
|
|
124
126
|
onSubmit: n,
|
|
@@ -172,11 +174,11 @@ function oe({ value: e, onChange: t, onSubmit: n, onBlur: r, onFocus: i, placeho
|
|
|
172
174
|
return h.current = d, w(() => (h.current?.(m), () => h.current?.(null)), [m]), /* @__PURE__ */ O(E, { children: [
|
|
173
175
|
/* @__PURE__ */ D(k, { editor: m }),
|
|
174
176
|
o && /* @__PURE__ */ D(g, { editor: m }),
|
|
175
|
-
o && /* @__PURE__ */ D(
|
|
177
|
+
o && /* @__PURE__ */ D(x, {
|
|
176
178
|
editor: m,
|
|
177
179
|
onFiles: p
|
|
178
180
|
}),
|
|
179
|
-
o && /* @__PURE__ */ D(
|
|
181
|
+
o && /* @__PURE__ */ D(y, { editor: m })
|
|
180
182
|
] });
|
|
181
183
|
}
|
|
182
|
-
export {
|
|
184
|
+
export { se as Editor, Q as contentExtensions, $ as fileHandlers };
|
package/components/SlashMenu.js
CHANGED
|
@@ -58,6 +58,7 @@ var w = {
|
|
|
58
58
|
file: "↥",
|
|
59
59
|
table: "▦",
|
|
60
60
|
docLink: "[[",
|
|
61
|
+
docView: "▤",
|
|
61
62
|
button: "▭",
|
|
62
63
|
issueList: "☰",
|
|
63
64
|
date: "@",
|
|
@@ -104,6 +105,7 @@ var w = {
|
|
|
104
105
|
withHeaderRow: !0
|
|
105
106
|
}),
|
|
106
107
|
docLink: (e) => e.insertContent("[["),
|
|
108
|
+
docView: (e) => e.insertContent({ type: "docView" }),
|
|
107
109
|
button: (e) => e.insertContent({ type: "docButton" }),
|
|
108
110
|
issueList: (e) => e.insertContent({ type: "issueList" }),
|
|
109
111
|
date: (e) => e.insertContent([{
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
+
import { queryOptions as n, useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
3
|
+
// src/lib/docProperties.ts
|
|
4
|
+
var a = (e) => e === "workspace" ? void 0 : { team: e }, o = [
|
|
5
|
+
"text",
|
|
6
|
+
"number",
|
|
7
|
+
"select",
|
|
8
|
+
"multi_select",
|
|
9
|
+
"person",
|
|
10
|
+
"date",
|
|
11
|
+
"checkbox",
|
|
12
|
+
"issue"
|
|
13
|
+
], s = (r, i) => n({
|
|
14
|
+
queryKey: [
|
|
15
|
+
"workspace",
|
|
16
|
+
r,
|
|
17
|
+
"docs",
|
|
18
|
+
"properties",
|
|
19
|
+
i
|
|
20
|
+
],
|
|
21
|
+
queryFn: async ({ signal: n }) => t(await e.GET("/api/v1/workspaces/{workspace}/doc-properties", {
|
|
22
|
+
params: {
|
|
23
|
+
path: { workspace: r },
|
|
24
|
+
query: { space: i }
|
|
25
|
+
},
|
|
26
|
+
signal: n
|
|
27
|
+
})).properties
|
|
28
|
+
}), c = (r, i) => n({
|
|
29
|
+
queryKey: [
|
|
30
|
+
"workspace",
|
|
31
|
+
r,
|
|
32
|
+
"docs",
|
|
33
|
+
"views",
|
|
34
|
+
i
|
|
35
|
+
],
|
|
36
|
+
queryFn: async ({ signal: n }) => t(await e.GET("/api/v1/workspaces/{workspace}/doc-views", {
|
|
37
|
+
params: {
|
|
38
|
+
path: { workspace: r },
|
|
39
|
+
query: { space: i }
|
|
40
|
+
},
|
|
41
|
+
signal: n
|
|
42
|
+
})).views
|
|
43
|
+
}), l = (r, i) => n({
|
|
44
|
+
queryKey: [
|
|
45
|
+
"workspace",
|
|
46
|
+
r,
|
|
47
|
+
"docs",
|
|
48
|
+
"view",
|
|
49
|
+
i
|
|
50
|
+
],
|
|
51
|
+
queryFn: async ({ signal: n }) => t(await e.GET("/api/v1/workspaces/{workspace}/doc-views/{view}", {
|
|
52
|
+
params: { path: {
|
|
53
|
+
workspace: r,
|
|
54
|
+
view: i
|
|
55
|
+
} },
|
|
56
|
+
signal: n
|
|
57
|
+
}))
|
|
58
|
+
});
|
|
59
|
+
function u(e) {
|
|
60
|
+
let t = e ?? {}, n = {};
|
|
61
|
+
if (Array.isArray(t.columns) && (n.columns = t.columns.filter((e) => typeof e == "string")), typeof t.sort == "string" && (n.sort = t.sort), t.desc === !0 && (n.desc = !0), typeof t.groupBy == "string" && (n.groupBy = t.groupBy), t.filters && typeof t.filters == "object") {
|
|
62
|
+
let e = {};
|
|
63
|
+
for (let [n, r] of Object.entries(t.filters)) typeof r == "string" && (e[n] = r);
|
|
64
|
+
Object.keys(e).length > 0 && (n.filters = e);
|
|
65
|
+
}
|
|
66
|
+
return n;
|
|
67
|
+
}
|
|
68
|
+
function d(n) {
|
|
69
|
+
let a = i(), o = () => a.invalidateQueries({ queryKey: [
|
|
70
|
+
"workspace",
|
|
71
|
+
n,
|
|
72
|
+
"docs"
|
|
73
|
+
] });
|
|
74
|
+
return {
|
|
75
|
+
create: r({
|
|
76
|
+
mutationFn: async (r) => t(await e.POST("/api/v1/workspaces/{workspace}/doc-properties", {
|
|
77
|
+
params: { path: { workspace: n } },
|
|
78
|
+
body: r
|
|
79
|
+
})),
|
|
80
|
+
onSettled: o
|
|
81
|
+
}),
|
|
82
|
+
update: r({
|
|
83
|
+
mutationFn: async ({ id: r, ...i }) => t(await e.PATCH("/api/v1/workspaces/{workspace}/doc-properties/{property}", {
|
|
84
|
+
params: { path: {
|
|
85
|
+
workspace: n,
|
|
86
|
+
property: r
|
|
87
|
+
} },
|
|
88
|
+
body: i
|
|
89
|
+
})),
|
|
90
|
+
onSettled: o
|
|
91
|
+
}),
|
|
92
|
+
remove: r({
|
|
93
|
+
mutationFn: async (r) => t(await e.DELETE("/api/v1/workspaces/{workspace}/doc-properties/{property}", { params: { path: {
|
|
94
|
+
workspace: n,
|
|
95
|
+
property: r
|
|
96
|
+
} } })),
|
|
97
|
+
onSettled: o
|
|
98
|
+
}),
|
|
99
|
+
setValues: r({
|
|
100
|
+
mutationFn: async ({ doc: r, values: i }) => t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}/properties", {
|
|
101
|
+
params: { path: {
|
|
102
|
+
workspace: n,
|
|
103
|
+
doc: r
|
|
104
|
+
} },
|
|
105
|
+
body: { values: i }
|
|
106
|
+
})),
|
|
107
|
+
onSettled: o
|
|
108
|
+
}),
|
|
109
|
+
saveView: r({
|
|
110
|
+
mutationFn: async (r) => t(await e.POST("/api/v1/workspaces/{workspace}/doc-views", {
|
|
111
|
+
params: { path: { workspace: n } },
|
|
112
|
+
body: r
|
|
113
|
+
})),
|
|
114
|
+
onSettled: o
|
|
115
|
+
}),
|
|
116
|
+
updateView: r({
|
|
117
|
+
mutationFn: async ({ id: r, ...i }) => t(await e.PATCH("/api/v1/workspaces/{workspace}/doc-views/{view}", {
|
|
118
|
+
params: { path: {
|
|
119
|
+
workspace: n,
|
|
120
|
+
view: r
|
|
121
|
+
} },
|
|
122
|
+
body: i
|
|
123
|
+
})),
|
|
124
|
+
onSettled: o
|
|
125
|
+
}),
|
|
126
|
+
removeView: r({
|
|
127
|
+
mutationFn: async (r) => t(await e.DELETE("/api/v1/workspaces/{workspace}/doc-views/{view}", { params: { path: {
|
|
128
|
+
workspace: n,
|
|
129
|
+
view: r
|
|
130
|
+
} } })),
|
|
131
|
+
onSettled: o
|
|
132
|
+
})
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export { s as docPropertiesQuery, l as docViewQuery, c as docViewsQuery, o as propertyKinds, u as readConfig, a as spaceScope, d as useDocPropertyActions };
|