@voltro/ui 0.84.0 → 0.86.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.
@@ -1,70 +1,14 @@
1
1
  # Third-Party Notices — @voltro/ui
2
2
 
3
- This package depends on the open-source software listed below. Each is the
3
+ This package uses the open-source software listed below. Each is the
4
4
  property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/ui itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (13 packages).
8
+ Generated from the resolved runtime dependency closure (10 packages).
9
9
 
10
10
  ---
11
11
 
12
- ## @effect/experimental@0.61.1
13
-
14
- License: MIT
15
-
16
- ```
17
- MIT License
18
-
19
- Copyright (c) 2023-present The Contributors
20
-
21
- Permission is hereby granted, free of charge, to any person obtaining a copy
22
- of this software and associated documentation files (the "Software"), to deal
23
- in the Software without restriction, including without limitation the rights
24
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- copies of the Software, and to permit persons to whom the Software is
26
- furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice and this permission notice shall be included in all
29
- copies or substantial portions of the Software.
30
-
31
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- SOFTWARE.
38
- ```
39
-
40
- ## @effect/sql@0.52.1
41
-
42
- License: MIT
43
-
44
- ```
45
- MIT License
46
-
47
- Copyright (c) 2023-present The Contributors
48
-
49
- Permission is hereby granted, free of charge, to any person obtaining a copy
50
- of this software and associated documentation files (the "Software"), to deal
51
- in the Software without restriction, including without limitation the rights
52
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
- copies of the Software, and to permit persons to whom the Software is
54
- furnished to do so, subject to the following conditions:
55
-
56
- The above copyright notice and this permission notice shall be included in all
57
- copies or substantial portions of the Software.
58
-
59
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
- SOFTWARE.
66
- ```
67
-
68
12
  ## @tanstack/devtools-event-client@0.4.4
69
13
 
70
14
  License: MIT
@@ -233,34 +177,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
233
177
  SOFTWARE.
234
178
  ```
235
179
 
236
- ## layerr@3.0.0
237
-
238
- License: MIT
239
-
240
- ```
241
- MIT License
242
-
243
- Copyright (c) 2020 Perry Mitchell
244
-
245
- Permission is hereby granted, free of charge, to any person obtaining a copy
246
- of this software and associated documentation files (the "Software"), to deal
247
- in the Software without restriction, including without limitation the rights
248
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
- copies of the Software, and to permit persons to whom the Software is
250
- furnished to do so, subject to the following conditions:
251
-
252
- The above copyright notice and this permission notice shall be included in all
253
- copies or substantial portions of the Software.
254
-
255
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
261
- SOFTWARE.
262
- ```
263
-
264
180
  ## typeid-js@1.2.0
265
181
 
266
182
  License: Apache-2.0
@@ -469,14 +385,14 @@ Apache License
469
385
  limitations under the License.
470
386
  ```
471
387
 
472
- ## ulidx@2.4.1
388
+ ## ulid@3.0.2
473
389
 
474
390
  License: MIT
475
391
 
476
392
  ```
477
- MIT License
393
+ The MIT License (MIT)
478
394
 
479
- Copyright (c) 2021 Perry Mitchell
395
+ Copyright (c) 2017 Alizain Feerasta
480
396
 
481
397
  Permission is hereby granted, free of charge, to any person obtaining a copy
482
398
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,117 @@
1
+ import { useUiStrings as e } from "./strings.js";
2
+ import { useState as t } from "react";
3
+ import { useAgentChat as n } from "@voltro/client";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/agentChat.tsx
6
+ var a = (e) => typeof e.text == "string" ? e.text : "";
7
+ function o({ text: t }) {
8
+ let n = e().agentChat;
9
+ return /* @__PURE__ */ i("details", {
10
+ "data-part": "reasoning",
11
+ children: [/* @__PURE__ */ r("summary", { children: n.reasoning }), /* @__PURE__ */ r("span", { children: t })]
12
+ });
13
+ }
14
+ function s({ part: e }) {
15
+ switch (e.type) {
16
+ case "text": return /* @__PURE__ */ r("span", {
17
+ "data-part": "text",
18
+ children: a(e)
19
+ });
20
+ case "reasoning": return /* @__PURE__ */ r(o, { text: a(e) });
21
+ case "tool": {
22
+ let t = e;
23
+ return /* @__PURE__ */ i("span", {
24
+ "data-part": "tool",
25
+ "data-tool": t.toolName,
26
+ "data-state": t.state,
27
+ children: ["🔧 ", t.toolName]
28
+ });
29
+ }
30
+ case "source": {
31
+ let t = e;
32
+ return t.url ? /* @__PURE__ */ r("a", {
33
+ "data-part": "source",
34
+ href: t.url,
35
+ rel: "noreferrer",
36
+ children: t.title ?? t.url
37
+ }) : /* @__PURE__ */ r("span", {
38
+ "data-part": "source",
39
+ children: t.title ?? t.id ?? "source"
40
+ });
41
+ }
42
+ case "file": {
43
+ let t = e;
44
+ return t.mediaType.startsWith("image/") ? /* @__PURE__ */ r("img", {
45
+ "data-part": "file",
46
+ alt: "",
47
+ src: `data:${t.mediaType};base64,${t.data}`
48
+ }) : /* @__PURE__ */ i("span", {
49
+ "data-part": "file",
50
+ "data-media": t.mediaType,
51
+ children: ["📎 ", t.mediaType]
52
+ });
53
+ }
54
+ default: return /* @__PURE__ */ r("span", {
55
+ "data-part": e.type,
56
+ children: JSON.stringify(e)
57
+ });
58
+ }
59
+ }
60
+ function c({ message: e }) {
61
+ let t = e.parts ?? [];
62
+ return /* @__PURE__ */ i("div", {
63
+ "data-voltro-agent-message": !0,
64
+ "data-role": e.role,
65
+ "data-streaming": e.streaming ? "true" : void 0,
66
+ "aria-busy": e.streaming ? "true" : void 0,
67
+ children: [t.length > 0 ? t.map((e, t) => /* @__PURE__ */ r(s, { part: e }, t)) : /* @__PURE__ */ r("span", {
68
+ "data-part": "text",
69
+ children: e.content
70
+ }), e.streaming ? /* @__PURE__ */ r("span", {
71
+ "data-cursor": !0,
72
+ "aria-hidden": "true",
73
+ children: "▍"
74
+ }) : null]
75
+ });
76
+ }
77
+ function l(a) {
78
+ let { api: o, agent: s, threadId: l, placeholder: u, sendLabel: d, emptyText: f } = a, p = e().agentChat, m = n(o, s, { threadId: l }), [h, g] = t(""), _ = () => {
79
+ let e = h.trim();
80
+ e.length === 0 || m.sending || (g(""), m.send(e));
81
+ };
82
+ return /* @__PURE__ */ i("div", {
83
+ "data-voltro-agent-chat": s,
84
+ children: [/* @__PURE__ */ r("div", {
85
+ "data-messages": !0,
86
+ role: "log",
87
+ "aria-live": "polite",
88
+ "aria-busy": m.streaming ? "true" : void 0,
89
+ children: m.messages.length === 0 && !m.loading ? /* @__PURE__ */ r("p", {
90
+ "data-empty": !0,
91
+ children: f ?? "No messages yet."
92
+ }) : m.messages.map((e) => /* @__PURE__ */ r(c, { message: e }, e.id))
93
+ }), /* @__PURE__ */ i("form", {
94
+ "data-composer": !0,
95
+ onSubmit: (e) => {
96
+ e.preventDefault(), _();
97
+ },
98
+ children: [/* @__PURE__ */ r("input", {
99
+ value: h,
100
+ onChange: (e) => g(e.target.value),
101
+ placeholder: u ?? p.messagePlaceholder,
102
+ "aria-label": p.messageLabel,
103
+ disabled: m.sending
104
+ }), /* @__PURE__ */ r("button", {
105
+ type: "submit",
106
+ disabled: m.sending || h.trim().length === 0,
107
+ children: d ?? p.send
108
+ })]
109
+ })]
110
+ });
111
+ }
112
+ function u(e) {
113
+ let t = n(e.api, e.agent, { threadId: e.threadId });
114
+ return e.children(t);
115
+ }
116
+ //#endregion
117
+ export { l as AgentChat, c as AgentMessageView, s as AgentPartView, u as AgentStream };
@@ -0,0 +1,30 @@
1
+ import { useUiStrings as e } from "./strings.js";
2
+ import { AgentChat as t } from "./agentChat.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region src/appAgent.tsx
5
+ function i(i) {
6
+ let { tools: a, showTools: o, ...s } = i, c = e().appAgent, l = (o ?? (a !== void 0 && a.length > 0)) && a && a.length > 0;
7
+ return /* @__PURE__ */ r("div", {
8
+ "data-voltro-app-agent": s.agent,
9
+ children: [l ? /* @__PURE__ */ r("details", {
10
+ "data-agent-tools": !0,
11
+ children: [/* @__PURE__ */ n("summary", { children: c.toolsSummary(a.length) }), /* @__PURE__ */ n("ul", { children: a.map((e) => /* @__PURE__ */ r("li", {
12
+ "data-tool": e.name,
13
+ "data-write": e.write ? "true" : void 0,
14
+ children: [
15
+ /* @__PURE__ */ n("code", { children: e.name }),
16
+ e.confirm ? /* @__PURE__ */ r("span", {
17
+ "data-confirm": !0,
18
+ children: [" · ", c.needsConfirm]
19
+ }) : null,
20
+ e.description ? /* @__PURE__ */ r("span", {
21
+ "data-desc": !0,
22
+ children: [" — ", e.description]
23
+ }) : null
24
+ ]
25
+ }, e.name)) })]
26
+ }) : null, /* @__PURE__ */ n(t, { ...s })]
27
+ });
28
+ }
29
+ //#endregion
30
+ export { i as AppAgent };
@@ -0,0 +1,63 @@
1
+ import { useUiStrings as e } from "./strings.js";
2
+ import { useId as t } from "react";
3
+ import { useQueryField as n } from "@voltro/client";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/asyncSelect.tsx
6
+ var a = (a) => {
7
+ let o = n(a.api, a.source, {
8
+ skipUntilTerm: !0,
9
+ ...a.labelField === void 0 ? {} : { labelField: a.labelField },
10
+ ...a.valueField === void 0 ? {} : { valueField: a.valueField },
11
+ ...a.input === void 0 ? {} : { input: a.input },
12
+ ...a.debounceMs === void 0 ? {} : { debounceMs: a.debounceMs }
13
+ }), s = e().asyncSelect, c = t(), l = a.value === void 0 || a.value === null ? "" : String(a.value), u = l !== "" && o.options.some((e) => e.value === l), d = `${c}-error`;
14
+ return /* @__PURE__ */ i("div", {
15
+ "data-voltro-field": !0,
16
+ "data-voltro-async-select": !0,
17
+ children: [
18
+ /* @__PURE__ */ i("label", {
19
+ htmlFor: c,
20
+ children: [a.label, a.required ? " *" : ""]
21
+ }),
22
+ /* @__PURE__ */ r("input", {
23
+ type: "search",
24
+ "aria-label": s.searchLabel(a.label),
25
+ placeholder: s.searchPlaceholder,
26
+ onChange: (e) => o.search(e.target.value),
27
+ disabled: a.disabled
28
+ }),
29
+ /* @__PURE__ */ i("select", {
30
+ id: c,
31
+ name: a.name,
32
+ value: l,
33
+ onChange: (e) => a.onChange(e.target.value),
34
+ disabled: a.disabled,
35
+ required: a.required,
36
+ "aria-invalid": a.error !== void 0,
37
+ "aria-describedby": a.error === void 0 ? void 0 : d,
38
+ "aria-busy": o.loading,
39
+ children: [
40
+ /* @__PURE__ */ r("option", {
41
+ value: "",
42
+ children: o.loading ? s.loading : s.empty
43
+ }),
44
+ l !== "" && !u ? /* @__PURE__ */ r("option", {
45
+ value: l,
46
+ children: l
47
+ }) : null,
48
+ o.options.map((e) => /* @__PURE__ */ r("option", {
49
+ value: e.value,
50
+ children: e.label
51
+ }, e.value))
52
+ ]
53
+ }),
54
+ a.error === void 0 ? null : /* @__PURE__ */ r("p", {
55
+ id: d,
56
+ role: "alert",
57
+ children: a.error
58
+ })
59
+ ]
60
+ });
61
+ };
62
+ //#endregion
63
+ export { a as AsyncSelect };
@@ -0,0 +1,91 @@
1
+ import { useWidget as e } from "./widgets.js";
2
+ import { createContext as t, useContext as n, useMemo as r } from "react";
3
+ import { FORM_KEY_FIELD as i, FORM_REDIRECT_FIELD as a, FormBindingProvider as o, formActionPath as s, formSections as c, useFormBinding as l, useFormFlash as u } from "@voltro/client";
4
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ //#region src/autoForm.tsx
6
+ var p = t(null), m = () => {
7
+ let e = n(p);
8
+ if (e === null) throw Error("<Field> must be rendered inside <AutoForm>");
9
+ return e;
10
+ }, h = (e, t) => {
11
+ let n = e.field(t.name);
12
+ return {
13
+ name: t.name,
14
+ label: t.label,
15
+ value: n.value,
16
+ onChange: n.setValue,
17
+ onBlur: n.onBlur,
18
+ required: t.required,
19
+ disabled: e.pending,
20
+ ...n.error === void 0 ? {} : { error: n.error },
21
+ ...t.options ? { options: t.options } : {},
22
+ ...n.description === void 0 ? {} : { description: n.description },
23
+ ...t.reference === void 0 ? {} : { reference: t.reference }
24
+ };
25
+ }, g = ({ name: t, children: n }) => {
26
+ let { binding: r, fields: i } = m(), a = i.get(t), o = e(a?.widget ?? "custom");
27
+ if (a === void 0) return null;
28
+ let s = h(r, a);
29
+ return n ? n(s) : /* @__PURE__ */ d(o, { ...s });
30
+ };
31
+ function _(e) {
32
+ let t = e.formKey ?? e.mutation, n = u(t), m = l(e.api, e.mutation, {
33
+ ...e.schema ? { schema: e.schema } : {},
34
+ ...e.defaults ? { defaults: e.defaults } : {},
35
+ ...n === void 0 ? {} : { flash: n }
36
+ }), h = r(() => {
37
+ let e = /* @__PURE__ */ new Map();
38
+ for (let t of m.fields) e.has(t.name) || e.set(t.name, t);
39
+ return e;
40
+ }, [m.fields]), _ = r(() => ({
41
+ binding: m,
42
+ fields: h
43
+ }), [m, h]), v = (t) => {
44
+ t.preventDefault(), m.submit().then((t) => {
45
+ t !== void 0 && e.onSuccess && e.onSuccess(t);
46
+ });
47
+ };
48
+ return /* @__PURE__ */ d(o, {
49
+ binding: m,
50
+ children: /* @__PURE__ */ d(p.Provider, {
51
+ value: _,
52
+ children: /* @__PURE__ */ f("form", {
53
+ ...e.action === !1 ? {} : {
54
+ action: s(e.mutation),
55
+ method: "post"
56
+ },
57
+ onSubmit: v,
58
+ noValidate: !0,
59
+ "data-voltro-autoform": e.mutation,
60
+ children: [
61
+ e.action === !1 ? null : /* @__PURE__ */ d("input", {
62
+ type: "hidden",
63
+ name: i,
64
+ value: t
65
+ }),
66
+ e.action === !1 || e.redirectTo === void 0 ? null : /* @__PURE__ */ d("input", {
67
+ type: "hidden",
68
+ name: a,
69
+ value: e.redirectTo
70
+ }),
71
+ e.children ? e.children(m) : c(m.fields).map((e, t) => e.name === void 0 ? e.fields.map((e) => /* @__PURE__ */ d(g, { name: e.name }, e.name)) : /* @__PURE__ */ f("fieldset", {
72
+ "data-voltro-section": e.name,
73
+ children: [/* @__PURE__ */ d("legend", { children: e.label ?? e.name }), e.fields.map((e) => /* @__PURE__ */ d(g, { name: e.name }, e.name))]
74
+ }, e.name)),
75
+ m.formError === void 0 ? null : /* @__PURE__ */ d("p", {
76
+ role: "alert",
77
+ "data-voltro-form-error": "",
78
+ children: m.formError
79
+ }),
80
+ /* @__PURE__ */ d("button", {
81
+ type: "submit",
82
+ disabled: m.pending,
83
+ children: e.submitLabel ?? "Submit"
84
+ })
85
+ ]
86
+ })
87
+ })
88
+ });
89
+ }
90
+ //#endregion
91
+ export { _ as AutoForm, g as Field };
@@ -0,0 +1,163 @@
1
+ import { useUiStrings as e } from "./strings.js";
2
+ import { useState as t } from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { useComments as i } from "@voltro/plugin-comments/web";
5
+ //#region src/commentsThread.tsx
6
+ var a = (e) => [...e.matchAll(/@([\w.-]+)/g)].map((e) => e[1]);
7
+ function o({ comment: i, onReact: a, onRemove: o, onEdit: s }) {
8
+ let c = e().comments, [l, u] = t(!1), [d, f] = t(i.body);
9
+ return /* @__PURE__ */ r("li", {
10
+ "data-comment": i.id,
11
+ "data-author": i.authorSubjectId,
12
+ children: [
13
+ /* @__PURE__ */ n("span", {
14
+ "data-comment-author": !0,
15
+ children: i.authorSubjectId
16
+ }),
17
+ l ? /* @__PURE__ */ r("form", {
18
+ "data-comment-edit": !0,
19
+ onSubmit: (e) => {
20
+ e.preventDefault(), s(d), u(!1);
21
+ },
22
+ children: [/* @__PURE__ */ n("input", {
23
+ value: d,
24
+ onChange: (e) => f(e.target.value),
25
+ "aria-label": c.editLabel
26
+ }), /* @__PURE__ */ n("button", {
27
+ type: "submit",
28
+ children: c.save
29
+ })]
30
+ }) : /* @__PURE__ */ r("p", {
31
+ "data-comment-body": !0,
32
+ children: [i.body, i.editedAt ? /* @__PURE__ */ r("em", {
33
+ "data-comment-edited": !0,
34
+ children: [
35
+ " (",
36
+ c.edited,
37
+ ")"
38
+ ]
39
+ }) : null]
40
+ }),
41
+ /* @__PURE__ */ r("span", {
42
+ "data-comment-reactions": !0,
43
+ children: [i.reactions.map((e) => /* @__PURE__ */ r("button", {
44
+ type: "button",
45
+ "data-reaction": e.emoji,
46
+ "data-mine": e.mine || void 0,
47
+ onClick: () => a(e.emoji),
48
+ children: [
49
+ e.emoji,
50
+ " ",
51
+ e.count
52
+ ]
53
+ }, e.emoji)), /* @__PURE__ */ n("button", {
54
+ type: "button",
55
+ "data-reaction-add": !0,
56
+ onClick: () => a("👍"),
57
+ "aria-label": c.react,
58
+ children: "+👍"
59
+ })]
60
+ }),
61
+ /* @__PURE__ */ r("span", {
62
+ "data-comment-actions": !0,
63
+ children: [/* @__PURE__ */ n("button", {
64
+ type: "button",
65
+ onClick: () => u((e) => !e),
66
+ children: c.edit
67
+ }), /* @__PURE__ */ n("button", {
68
+ type: "button",
69
+ onClick: o,
70
+ children: c.remove
71
+ })]
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ function s({ thread: i, api: s }) {
77
+ let c = e().comments, [l, u] = t("");
78
+ return /* @__PURE__ */ r("section", {
79
+ "data-thread": i.id,
80
+ "data-status": i.status,
81
+ children: [
82
+ /* @__PURE__ */ r("header", {
83
+ "data-thread-header": !0,
84
+ children: [
85
+ i.unreadCount > 0 ? /* @__PURE__ */ n("span", {
86
+ "data-thread-unread": !0,
87
+ children: i.unreadCount
88
+ }) : null,
89
+ /* @__PURE__ */ n("button", {
90
+ type: "button",
91
+ "data-thread-resolve": !0,
92
+ onClick: () => void s.resolve(i.id, i.status !== "resolved"),
93
+ children: i.status === "resolved" ? c.reopen : c.resolve
94
+ }),
95
+ /* @__PURE__ */ n("button", {
96
+ type: "button",
97
+ "data-thread-markread": !0,
98
+ onClick: () => void s.markRead(i.id),
99
+ children: c.markRead
100
+ })
101
+ ]
102
+ }),
103
+ i.quote === null ? null : /* @__PURE__ */ n("blockquote", {
104
+ "data-thread-quote": !0,
105
+ children: i.quote.exact
106
+ }),
107
+ /* @__PURE__ */ n("ul", {
108
+ "data-thread-comments": !0,
109
+ children: i.comments.map((e) => /* @__PURE__ */ n(o, {
110
+ comment: e,
111
+ onReact: (t) => void s.react(e.id, t),
112
+ onRemove: () => void s.remove(e.id),
113
+ onEdit: (t) => void s.edit(e.id, t)
114
+ }, e.id))
115
+ }),
116
+ /* @__PURE__ */ r("form", {
117
+ "data-thread-reply": !0,
118
+ onSubmit: (e) => {
119
+ e.preventDefault(), l.trim() !== "" && (s.create(l, {
120
+ threadId: i.id,
121
+ mentions: a(l)
122
+ }), u(""));
123
+ },
124
+ children: [/* @__PURE__ */ n("input", {
125
+ value: l,
126
+ onChange: (e) => u(e.target.value),
127
+ placeholder: c.replyPlaceholder,
128
+ "aria-label": c.replyLabel
129
+ }), /* @__PURE__ */ n("button", {
130
+ type: "submit",
131
+ children: c.reply
132
+ })]
133
+ })
134
+ ]
135
+ });
136
+ }
137
+ function c({ anchor: o, api: c = "app" }) {
138
+ let l = e().comments, u = i(o, c), [d, f] = t("");
139
+ return /* @__PURE__ */ r("div", {
140
+ "data-comments": !0,
141
+ "data-anchor": o,
142
+ children: [u.threads.map((e) => /* @__PURE__ */ n(s, {
143
+ thread: e,
144
+ api: u
145
+ }, e.id)), /* @__PURE__ */ r("form", {
146
+ "data-comments-new": !0,
147
+ onSubmit: (e) => {
148
+ e.preventDefault(), d.trim() !== "" && (u.create(d, { mentions: a(d) }), f(""));
149
+ },
150
+ children: [/* @__PURE__ */ n("input", {
151
+ value: d,
152
+ onChange: (e) => f(e.target.value),
153
+ placeholder: l.newPlaceholder,
154
+ "aria-label": l.newLabel
155
+ }), /* @__PURE__ */ n("button", {
156
+ type: "submit",
157
+ children: l.comment
158
+ })]
159
+ })]
160
+ });
161
+ }
162
+ //#endregion
163
+ export { c as CommentsThread };
@@ -0,0 +1,99 @@
1
+ import { useUiStrings as e } from "./strings.js";
2
+ import { useState as t } from "react";
3
+ import { useConnection as n } from "@voltro/client";
4
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ //#region src/connectAccount.tsx
6
+ var o = (e, t) => {
7
+ switch (e.status) {
8
+ case "connected": return e.accountLabel === null ? t.connected : t.connectedAs(e.accountLabel);
9
+ case "expired": return t.expired;
10
+ case "revoked": return t.revoked;
11
+ case "error": return t.errored;
12
+ default: return t.notConnected;
13
+ }
14
+ }, s = ({ api: e, connectionId: t, ...r }) => {
15
+ let a = n(e, t);
16
+ return /* @__PURE__ */ i(c, {
17
+ connection: a,
18
+ loading: a.loading,
19
+ ...r
20
+ });
21
+ }, c = ({ connection: n, instructionsUrl: s, loading: c = !1, children: l, className: u }) => {
22
+ let d = e().connectAccount, [f, p] = t("");
23
+ if (l !== void 0) return l(n);
24
+ if (c) return /* @__PURE__ */ i("div", {
25
+ className: u,
26
+ "data-voltro-connect": n.connectionId,
27
+ children: d.loading
28
+ });
29
+ let m = async (e) => {
30
+ e.preventDefault(), f.trim() !== "" && (await n.submitToken(f), p(""));
31
+ };
32
+ return /* @__PURE__ */ a("div", {
33
+ className: u,
34
+ "data-voltro-connect": n.connectionId,
35
+ "data-status": n.status,
36
+ children: [/* @__PURE__ */ a("div", { children: [
37
+ /* @__PURE__ */ i("strong", { children: n.label }),
38
+ " — ",
39
+ /* @__PURE__ */ i("span", {
40
+ role: n.needsAttention ? "alert" : void 0,
41
+ children: o(n, d)
42
+ })
43
+ ] }), n.connected || n.needsAttention ? /* @__PURE__ */ a(r, { children: [n.needsAttention && n.kind === "oauth2" && /* @__PURE__ */ i("button", {
44
+ type: "button",
45
+ disabled: n.pending,
46
+ onClick: () => {
47
+ n.connect();
48
+ },
49
+ children: d.reconnect
50
+ }), /* @__PURE__ */ i("button", {
51
+ type: "button",
52
+ disabled: n.pending,
53
+ onClick: () => {
54
+ n.disconnect();
55
+ },
56
+ children: d.disconnect
57
+ })] }) : n.kind === "oauth2" ? /* @__PURE__ */ i("button", {
58
+ type: "button",
59
+ disabled: n.pending,
60
+ onClick: () => {
61
+ n.connect();
62
+ },
63
+ children: d.connect(n.label)
64
+ }) : /* @__PURE__ */ a("form", {
65
+ onSubmit: (e) => {
66
+ m(e);
67
+ },
68
+ children: [
69
+ /* @__PURE__ */ i("label", {
70
+ htmlFor: `voltro-connect-${n.connectionId}`,
71
+ children: d.tokenLabel(n.label)
72
+ }),
73
+ /* @__PURE__ */ i("input", {
74
+ id: `voltro-connect-${n.connectionId}`,
75
+ type: "password",
76
+ autoComplete: "off",
77
+ value: f,
78
+ placeholder: d.tokenPlaceholder,
79
+ onChange: (e) => {
80
+ p(e.target.value);
81
+ }
82
+ }),
83
+ /* @__PURE__ */ i("button", {
84
+ type: "submit",
85
+ disabled: n.pending || f.trim() === "",
86
+ children: d.save
87
+ }),
88
+ s !== void 0 && /* @__PURE__ */ i("a", {
89
+ href: s,
90
+ target: "_blank",
91
+ rel: "noreferrer noopener",
92
+ children: d.howToGetToken
93
+ })
94
+ ]
95
+ })]
96
+ });
97
+ };
98
+ //#endregion
99
+ export { c as ConnectAccount, s as ConnectAccountFor };