@nice2dev/social 1.2.0 → 1.2.2
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/CHANGELOG.md +142 -0
- package/README.md +11 -9
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +487 -476
- package/dist/style.css +1 -0
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1,178 +1,182 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as U } from "@nice2dev/ui-core";
|
|
3
|
+
import { forwardRef as O, useState as T, useCallback as W, useMemo as M } from "react";
|
|
4
|
+
const ie = /* @__PURE__ */ O(
|
|
5
|
+
function(_, L) {
|
|
6
|
+
const { t: c } = U(), {
|
|
7
|
+
comments: h,
|
|
7
8
|
currentUserId: s,
|
|
8
|
-
onSubmit:
|
|
9
|
-
onEdit:
|
|
10
|
-
onDelete:
|
|
11
|
-
onReact:
|
|
12
|
-
readOnly:
|
|
13
|
-
maxDepth:
|
|
14
|
-
reactions:
|
|
15
|
-
placeholder:
|
|
16
|
-
className:
|
|
17
|
-
style:
|
|
18
|
-
} =
|
|
19
|
-
for (const
|
|
20
|
-
const
|
|
21
|
-
|
|
9
|
+
onSubmit: d,
|
|
10
|
+
onEdit: p,
|
|
11
|
+
onDelete: y,
|
|
12
|
+
onReact: o,
|
|
13
|
+
readOnly: C = !1,
|
|
14
|
+
maxDepth: $ = 4,
|
|
15
|
+
reactions: E = ["👍", "❤️", "😂", "😮", "😢"],
|
|
16
|
+
placeholder: w = c("comments.writeAComment", "Write a comment…"),
|
|
17
|
+
className: x,
|
|
18
|
+
style: S
|
|
19
|
+
} = _, [g, i] = T(""), [u, N] = T(null), [n, t] = T(""), [l, a] = T(null), [k, F] = T(""), I = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const m of h) {
|
|
21
|
+
const D = m.parentId ?? "__root__";
|
|
22
|
+
I.has(D) || I.set(D, []), I.get(D).push(m);
|
|
22
23
|
}
|
|
23
|
-
const
|
|
24
|
-
!
|
|
25
|
-
}, [
|
|
26
|
-
!
|
|
27
|
-
}, [
|
|
28
|
-
!
|
|
29
|
-
}, [
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */ e("strong", { className: "nice-comments__author", children:
|
|
35
|
-
/* @__PURE__ */ e("time", { className: "nice-comments__time", children:
|
|
36
|
-
|
|
24
|
+
const z = W(() => {
|
|
25
|
+
!g.trim() || !d || (d(g.trim()), i(""));
|
|
26
|
+
}, [g, d]), B = W(() => {
|
|
27
|
+
!n.trim() || !d || !u || (d(n.trim(), u), t(""), N(null));
|
|
28
|
+
}, [n, u, d]), A = W(() => {
|
|
29
|
+
!l || !k.trim() || !p || (p(l, k.trim()), a(null), F(""));
|
|
30
|
+
}, [l, k, p]), R = (m, D) => {
|
|
31
|
+
const j = s && m.authorId === s, v = I.get(m.id) ?? [];
|
|
32
|
+
return /* @__PURE__ */ r("div", { className: "nice-comments__item", style: { marginLeft: D * 24 }, children: [
|
|
33
|
+
/* @__PURE__ */ r("div", { className: "nice-comments__header", children: [
|
|
34
|
+
m.authorAvatarUrl && /* @__PURE__ */ e("img", { src: m.authorAvatarUrl, alt: "", className: "nice-comments__avatar" }),
|
|
35
|
+
/* @__PURE__ */ e("strong", { className: "nice-comments__author", children: m.authorName }),
|
|
36
|
+
/* @__PURE__ */ e("time", { className: "nice-comments__time", children: m.createdAt }),
|
|
37
|
+
m.isEdited && /* @__PURE__ */ e("span", { className: "nice-comments__edited", children: c("comments.edited", "(edited)") })
|
|
37
38
|
] }),
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */ e("textarea", { value: k, onChange: (
|
|
40
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
41
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
42
|
-
] }) : /* @__PURE__ */ e("p", { className: "nice-comments__content", children:
|
|
43
|
-
!
|
|
39
|
+
l === m.id ? /* @__PURE__ */ r("div", { className: "nice-comments__edit-form", children: [
|
|
40
|
+
/* @__PURE__ */ e("textarea", { value: k, onChange: (b) => F(b.target.value) }),
|
|
41
|
+
/* @__PURE__ */ e("button", { onClick: A, children: c("comments.save", "Save") }),
|
|
42
|
+
/* @__PURE__ */ e("button", { onClick: () => a(null), children: c("comments.cancel", "Cancel") })
|
|
43
|
+
] }) : /* @__PURE__ */ e("p", { className: "nice-comments__content", children: m.isDeleted ? /* @__PURE__ */ e("em", { children: c("comments.commentDeleted", "Comment deleted") }) : m.content }),
|
|
44
|
+
!m.isDeleted && m.reactions && /* @__PURE__ */ e("div", { className: "nice-comments__reactions", children: Object.entries(m.reactions).map(([b, f]) => /* @__PURE__ */ r(
|
|
44
45
|
"button",
|
|
45
46
|
{
|
|
46
47
|
className: "nice-comments__reaction",
|
|
47
|
-
onClick: () =>
|
|
48
|
+
onClick: () => o == null ? void 0 : o(m.id, b),
|
|
48
49
|
children: [
|
|
49
|
-
|
|
50
|
+
b,
|
|
50
51
|
" ",
|
|
51
52
|
f
|
|
52
53
|
]
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
+
b
|
|
55
56
|
)) }),
|
|
56
|
-
!
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
!m.isDeleted && !C && /* @__PURE__ */ r("div", { className: "nice-comments__actions", children: [
|
|
58
|
+
o && E.map((b) => /* @__PURE__ */ e("button", { onClick: () => o(m.id, b), title: b, children: b }, b)),
|
|
59
|
+
D < $ && /* @__PURE__ */ e(
|
|
59
60
|
"button",
|
|
60
61
|
{
|
|
61
62
|
onClick: () => {
|
|
62
|
-
|
|
63
|
+
N(m.id), t("");
|
|
63
64
|
},
|
|
64
|
-
children: "Reply"
|
|
65
|
+
children: c("comments.reply", "Reply")
|
|
65
66
|
}
|
|
66
67
|
),
|
|
67
|
-
|
|
68
|
+
j && p && /* @__PURE__ */ e(
|
|
68
69
|
"button",
|
|
69
70
|
{
|
|
70
71
|
onClick: () => {
|
|
71
|
-
|
|
72
|
+
a(m.id), F(m.content);
|
|
72
73
|
},
|
|
73
|
-
children: "Edit"
|
|
74
|
+
children: c("comments.edit", "Edit")
|
|
74
75
|
}
|
|
75
76
|
),
|
|
76
|
-
|
|
77
|
+
j && y && /* @__PURE__ */ e("button", { onClick: () => y(m.id), children: c("comments.delete", "Delete") })
|
|
77
78
|
] }),
|
|
78
|
-
|
|
79
|
+
u === m.id && /* @__PURE__ */ r("div", { className: "nice-comments__reply-form", children: [
|
|
79
80
|
/* @__PURE__ */ e(
|
|
80
81
|
"textarea",
|
|
81
82
|
{
|
|
82
|
-
value:
|
|
83
|
-
onChange: (
|
|
84
|
-
placeholder: "Write a reply…"
|
|
83
|
+
value: n,
|
|
84
|
+
onChange: (b) => t(b.target.value),
|
|
85
|
+
placeholder: c("comments.writeAReply", "Write a reply…")
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
88
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
88
|
+
/* @__PURE__ */ e("button", { onClick: B, disabled: !n.trim(), children: c("comments.send", "Send") }),
|
|
89
|
+
/* @__PURE__ */ e("button", { onClick: () => N(null), children: c("comments.cancel", "Cancel") })
|
|
89
90
|
] }),
|
|
90
|
-
|
|
91
|
-
] },
|
|
92
|
-
},
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
!
|
|
91
|
+
v.map((b) => R(b, D + 1))
|
|
92
|
+
] }, m.id);
|
|
93
|
+
}, K = I.get("__root__") ?? [];
|
|
94
|
+
return /* @__PURE__ */ r("div", { ref: L, className: `nice-comments ${x ?? ""}`, style: S, children: [
|
|
95
|
+
!C && /* @__PURE__ */ r("div", { className: "nice-comments__new", children: [
|
|
95
96
|
/* @__PURE__ */ e(
|
|
96
97
|
"textarea",
|
|
97
98
|
{
|
|
98
|
-
value:
|
|
99
|
-
onChange: (
|
|
100
|
-
placeholder:
|
|
99
|
+
value: g,
|
|
100
|
+
onChange: (m) => i(m.target.value),
|
|
101
|
+
placeholder: w
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
104
|
+
/* @__PURE__ */ e("button", { onClick: z, disabled: !g.trim(), children: c("comments.post", "Post") })
|
|
104
105
|
] }),
|
|
105
|
-
|
|
106
|
+
K.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-comments__empty", children: c("comments.noCommentsYet", "No comments yet.") }) : K.map((m) => R(m, 0))
|
|
106
107
|
] });
|
|
107
108
|
}
|
|
108
|
-
),
|
|
109
|
+
), Y = {
|
|
109
110
|
star: "polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 79% 94%, 50% 73%, 21% 94%, 31% 59%, 2% 37%, 38% 36%)",
|
|
110
111
|
heart: "polygon(50% 92%, 12% 54%, 4% 40%, 4% 25%, 10% 13%, 22% 6%, 34% 6%, 44% 12%, 50% 21%, 56% 12%, 66% 6%, 78% 6%, 90% 13%, 96% 25%, 96% 40%, 88% 54%)",
|
|
111
|
-
share: "polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
share: "polygon(42% 8%, 92% 8%, 92% 58%, 75% 41%, 27% 89%, 11% 73%, 59% 25%)",
|
|
113
|
+
// a thumbs-up: cuff on the left, fist with the thumb raised; thumb-down is it mirrored vertically
|
|
114
|
+
thumb: "polygon(6% 46%, 24% 46%, 24% 40%, 40% 36%, 50% 8%, 58% 6%, 64% 12%, 62% 36%, 88% 38%, 94% 46%, 90% 56%, 94% 64%, 90% 74%, 92% 82%, 86% 92%, 24% 92%, 24% 90%, 6% 90%)",
|
|
115
|
+
"thumb-down": "polygon(6% 54%, 24% 54%, 24% 60%, 40% 64%, 50% 92%, 58% 94%, 64% 88%, 62% 64%, 88% 62%, 94% 54%, 90% 44%, 94% 36%, 90% 26%, 92% 18%, 86% 8%, 24% 8%, 24% 10%, 6% 10%)"
|
|
116
|
+
}, H = ({
|
|
117
|
+
shape: P,
|
|
118
|
+
filled: _ = !0
|
|
115
119
|
}) => /* @__PURE__ */ e(
|
|
116
120
|
"span",
|
|
117
121
|
{
|
|
118
122
|
"aria-hidden": "true",
|
|
119
|
-
className: `nice-social-shape nice-social-shape--${
|
|
123
|
+
className: `nice-social-shape nice-social-shape--${P}`,
|
|
120
124
|
style: {
|
|
121
125
|
display: "inline-block",
|
|
122
126
|
width: "1em",
|
|
123
127
|
height: "1em",
|
|
124
128
|
verticalAlign: "-0.125em",
|
|
125
129
|
background: "currentColor",
|
|
126
|
-
clipPath:
|
|
127
|
-
opacity:
|
|
130
|
+
clipPath: Y[P],
|
|
131
|
+
opacity: _ ? 1 : 0.35
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
|
-
),
|
|
131
|
-
function(
|
|
132
|
-
const {
|
|
133
|
-
value:
|
|
134
|
+
), te = /* @__PURE__ */ O(
|
|
135
|
+
function(_, L) {
|
|
136
|
+
const { t: c } = U(), {
|
|
137
|
+
value: h,
|
|
134
138
|
max: s = 5,
|
|
135
|
-
mode:
|
|
136
|
-
aggregation:
|
|
137
|
-
onChange:
|
|
138
|
-
readOnly:
|
|
139
|
-
size:
|
|
140
|
-
showValue:
|
|
141
|
-
label:
|
|
142
|
-
emojiSet:
|
|
143
|
-
className:
|
|
144
|
-
style:
|
|
145
|
-
} =
|
|
146
|
-
(
|
|
147
|
-
|
|
139
|
+
mode: d = "stars",
|
|
140
|
+
aggregation: p,
|
|
141
|
+
onChange: y,
|
|
142
|
+
readOnly: o = !1,
|
|
143
|
+
size: C = "md",
|
|
144
|
+
showValue: $ = !1,
|
|
145
|
+
label: E,
|
|
146
|
+
emojiSet: w = ["😢", "😕", "😐", "🙂", "😍"],
|
|
147
|
+
className: x,
|
|
148
|
+
style: S
|
|
149
|
+
} = _, [g, i] = T(null), u = g !== null ? g + 1 : h ?? 0, N = W(
|
|
150
|
+
(l) => {
|
|
151
|
+
o || !y || y(l + 1);
|
|
148
152
|
},
|
|
149
|
-
[
|
|
150
|
-
),
|
|
151
|
-
const
|
|
152
|
-
for (let
|
|
153
|
-
const k =
|
|
154
|
-
let
|
|
155
|
-
|
|
153
|
+
[o, y]
|
|
154
|
+
), n = () => {
|
|
155
|
+
const l = [];
|
|
156
|
+
for (let a = 0; a < s; a++) {
|
|
157
|
+
const k = a < u;
|
|
158
|
+
let F;
|
|
159
|
+
d === "emoji" ? F = w[a] ?? w[w.length - 1] : d === "hearts" ? F = /* @__PURE__ */ e(H, { shape: "heart", filled: k }) : d === "thumbs" ? F = /* @__PURE__ */ e(H, { shape: k ? "thumb" : "thumb-down", filled: k }) : F = /* @__PURE__ */ e(H, { shape: "star", filled: k }), l.push(
|
|
156
160
|
/* @__PURE__ */ e(
|
|
157
161
|
"span",
|
|
158
162
|
{
|
|
159
163
|
className: `nice-ratings__symbol ${k ? "nice-ratings__symbol--active" : ""}`,
|
|
160
|
-
onClick: () =>
|
|
161
|
-
onMouseEnter: () => !
|
|
162
|
-
onMouseLeave: () => !
|
|
163
|
-
role:
|
|
164
|
-
tabIndex:
|
|
165
|
-
onKeyDown: (
|
|
166
|
-
(
|
|
164
|
+
onClick: () => N(a),
|
|
165
|
+
onMouseEnter: () => !o && i(a),
|
|
166
|
+
onMouseLeave: () => !o && i(null),
|
|
167
|
+
role: o ? void 0 : "button",
|
|
168
|
+
tabIndex: o ? void 0 : 0,
|
|
169
|
+
onKeyDown: (I) => {
|
|
170
|
+
(I.key === "Enter" || I.key === " ") && N(a);
|
|
167
171
|
},
|
|
168
|
-
children:
|
|
172
|
+
children: F
|
|
169
173
|
},
|
|
170
|
-
|
|
174
|
+
a
|
|
171
175
|
)
|
|
172
176
|
);
|
|
173
177
|
}
|
|
174
|
-
return
|
|
175
|
-
}, t = () => /* @__PURE__ */
|
|
178
|
+
return l;
|
|
179
|
+
}, t = () => /* @__PURE__ */ r("div", { className: "nice-ratings__numeric", children: [
|
|
176
180
|
/* @__PURE__ */ e(
|
|
177
181
|
"input",
|
|
178
182
|
{
|
|
@@ -180,105 +184,104 @@ const X = W(
|
|
|
180
184
|
min: 0,
|
|
181
185
|
max: s,
|
|
182
186
|
step: 0.5,
|
|
183
|
-
value:
|
|
184
|
-
onChange: (
|
|
185
|
-
readOnly:
|
|
187
|
+
value: h ?? 0,
|
|
188
|
+
onChange: (l) => y == null ? void 0 : y(parseFloat(l.target.value) || 0),
|
|
189
|
+
readOnly: o,
|
|
186
190
|
className: "nice-ratings__numeric-input"
|
|
187
191
|
}
|
|
188
192
|
),
|
|
189
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ r("span", { className: "nice-ratings__numeric-max", children: [
|
|
190
194
|
"/ ",
|
|
191
195
|
s
|
|
192
196
|
] })
|
|
193
197
|
] });
|
|
194
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ r(
|
|
195
199
|
"div",
|
|
196
200
|
{
|
|
197
|
-
ref:
|
|
198
|
-
className: `nice-ratings nice-ratings--${
|
|
199
|
-
style:
|
|
201
|
+
ref: L,
|
|
202
|
+
className: `nice-ratings nice-ratings--${C} nice-ratings--${d} ${o ? "nice-ratings--readonly" : ""} ${x ?? ""}`,
|
|
203
|
+
style: S,
|
|
200
204
|
children: [
|
|
201
|
-
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
E && /* @__PURE__ */ e("span", { className: "nice-ratings__label", children: E }),
|
|
206
|
+
/* @__PURE__ */ r("div", { className: "nice-ratings__body", children: [
|
|
207
|
+
d === "numeric" ? t() : n(),
|
|
208
|
+
$ && d !== "numeric" && /* @__PURE__ */ r("span", { className: "nice-ratings__value", children: [
|
|
209
|
+
u,
|
|
206
210
|
" / ",
|
|
207
211
|
s
|
|
208
212
|
] })
|
|
209
213
|
] }),
|
|
210
|
-
|
|
211
|
-
/* @__PURE__ */ e("span", { className: "nice-ratings__avg", children:
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
"
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
]
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */ e("span", { children: c }),
|
|
214
|
+
p && /* @__PURE__ */ r("div", { className: "nice-ratings__aggregation", children: [
|
|
215
|
+
/* @__PURE__ */ e("span", { className: "nice-ratings__avg", children: p.average.toFixed(1) }),
|
|
216
|
+
/* @__PURE__ */ e("span", { className: "nice-ratings__count", children: c("ratings.ratings", "({count} ratings)").replace(
|
|
217
|
+
"{count}",
|
|
218
|
+
String(p.count)
|
|
219
|
+
) }),
|
|
220
|
+
p.distribution && /* @__PURE__ */ e("div", { className: "nice-ratings__distribution", children: Object.entries(p.distribution).sort(([l], [a]) => +a - +l).map(([l, a]) => /* @__PURE__ */ r("div", { className: "nice-ratings__distribution-row", children: [
|
|
221
|
+
/* @__PURE__ */ e("span", { children: l }),
|
|
219
222
|
/* @__PURE__ */ e("div", { className: "nice-ratings__bar", children: /* @__PURE__ */ e(
|
|
220
223
|
"div",
|
|
221
224
|
{
|
|
222
225
|
className: "nice-ratings__bar-fill",
|
|
223
226
|
style: {
|
|
224
|
-
width: `${
|
|
227
|
+
width: `${p.count ? a / p.count * 100 : 0}%`
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
) }),
|
|
228
|
-
/* @__PURE__ */ e("span", { children:
|
|
229
|
-
] },
|
|
231
|
+
/* @__PURE__ */ e("span", { children: a })
|
|
232
|
+
] }, l)) })
|
|
230
233
|
] })
|
|
231
234
|
]
|
|
232
235
|
}
|
|
233
236
|
);
|
|
234
237
|
}
|
|
235
|
-
),
|
|
236
|
-
function(
|
|
237
|
-
const {
|
|
238
|
-
stats:
|
|
238
|
+
), ne = /* @__PURE__ */ O(
|
|
239
|
+
function(_, L) {
|
|
240
|
+
const { t: c } = U(), {
|
|
241
|
+
stats: h,
|
|
239
242
|
userState: s,
|
|
240
|
-
onLike:
|
|
241
|
-
onShare:
|
|
242
|
-
onBookmark:
|
|
243
|
-
direction:
|
|
244
|
-
size:
|
|
245
|
-
showCounts:
|
|
246
|
-
showLabels:
|
|
247
|
-
className:
|
|
248
|
-
style:
|
|
249
|
-
} =
|
|
243
|
+
onLike: d,
|
|
244
|
+
onShare: p,
|
|
245
|
+
onBookmark: y,
|
|
246
|
+
direction: o = "horizontal",
|
|
247
|
+
size: C = "md",
|
|
248
|
+
showCounts: $ = !0,
|
|
249
|
+
showLabels: E = !1,
|
|
250
|
+
className: w,
|
|
251
|
+
style: x
|
|
252
|
+
} = _, S = W((i) => i >= 1e6 ? (i / 1e6).toFixed(1) + "M" : i >= 1e3 ? (i / 1e3).toFixed(1) + "K" : i.toString(), []), g = [
|
|
250
253
|
{
|
|
251
254
|
key: "like",
|
|
252
255
|
shape: "heart",
|
|
253
|
-
label: "Like",
|
|
254
|
-
count:
|
|
256
|
+
label: c("socialPanel.like", "Like"),
|
|
257
|
+
count: h.likes,
|
|
255
258
|
isActive: (s == null ? void 0 : s.liked) ?? !1,
|
|
256
|
-
onClick:
|
|
259
|
+
onClick: d
|
|
257
260
|
},
|
|
258
261
|
{
|
|
259
262
|
key: "share",
|
|
260
263
|
shape: "share",
|
|
261
|
-
label: "Share",
|
|
262
|
-
count:
|
|
264
|
+
label: c("socialPanel.share", "Share"),
|
|
265
|
+
count: h.shares,
|
|
263
266
|
isActive: (s == null ? void 0 : s.shared) ?? !1,
|
|
264
|
-
onClick:
|
|
267
|
+
onClick: p
|
|
265
268
|
},
|
|
266
269
|
{
|
|
267
270
|
key: "bookmark",
|
|
268
271
|
shape: "star",
|
|
269
|
-
label: "Bookmark",
|
|
270
|
-
count:
|
|
272
|
+
label: c("socialPanel.bookmark", "Bookmark"),
|
|
273
|
+
count: h.bookmarks,
|
|
271
274
|
isActive: (s == null ? void 0 : s.bookmarked) ?? !1,
|
|
272
|
-
onClick:
|
|
275
|
+
onClick: y
|
|
273
276
|
}
|
|
274
277
|
];
|
|
275
278
|
return /* @__PURE__ */ e(
|
|
276
279
|
"div",
|
|
277
280
|
{
|
|
278
|
-
ref:
|
|
279
|
-
className: `nice-social-panel nice-social-panel--${
|
|
280
|
-
style:
|
|
281
|
-
children:
|
|
281
|
+
ref: L,
|
|
282
|
+
className: `nice-social-panel nice-social-panel--${o} nice-social-panel--${C} ${w ?? ""}`,
|
|
283
|
+
style: x,
|
|
284
|
+
children: g.map((i) => /* @__PURE__ */ r(
|
|
282
285
|
"button",
|
|
283
286
|
{
|
|
284
287
|
className: `nice-social-panel__btn nice-social-panel__btn--${i.key} ${i.isActive ? "nice-social-panel__btn--active" : ""}`,
|
|
@@ -287,9 +290,9 @@ const X = W(
|
|
|
287
290
|
"aria-label": i.label,
|
|
288
291
|
"aria-pressed": i.isActive,
|
|
289
292
|
children: [
|
|
290
|
-
/* @__PURE__ */ e("span", { className: "nice-social-panel__icon", children: /* @__PURE__ */ e(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
+
/* @__PURE__ */ e("span", { className: "nice-social-panel__icon", children: /* @__PURE__ */ e(H, { shape: i.shape, filled: i.isActive || i.shape === "share" }) }),
|
|
294
|
+
E && /* @__PURE__ */ e("span", { className: "nice-social-panel__label", children: i.label }),
|
|
295
|
+
$ && /* @__PURE__ */ e("span", { className: "nice-social-panel__count", children: S(i.count) })
|
|
293
296
|
]
|
|
294
297
|
},
|
|
295
298
|
i.key
|
|
@@ -297,57 +300,53 @@ const X = W(
|
|
|
297
300
|
}
|
|
298
301
|
);
|
|
299
302
|
}
|
|
300
|
-
),
|
|
301
|
-
function(
|
|
302
|
-
const {
|
|
303
|
-
tags:
|
|
303
|
+
), ae = /* @__PURE__ */ O(
|
|
304
|
+
function(_, L) {
|
|
305
|
+
const { t: c } = U(), {
|
|
306
|
+
tags: h,
|
|
304
307
|
onTagClick: s,
|
|
305
|
-
minFontSize:
|
|
306
|
-
maxFontSize:
|
|
307
|
-
sortBy:
|
|
308
|
-
maxTags:
|
|
309
|
-
selectedIds:
|
|
310
|
-
className:
|
|
311
|
-
style:
|
|
312
|
-
} =
|
|
313
|
-
let i = [...
|
|
314
|
-
if (
|
|
315
|
-
i.sort((
|
|
316
|
-
else if (
|
|
317
|
-
i.sort((
|
|
308
|
+
minFontSize: d = 12,
|
|
309
|
+
maxFontSize: p = 36,
|
|
310
|
+
sortBy: y = "weight",
|
|
311
|
+
maxTags: o,
|
|
312
|
+
selectedIds: C,
|
|
313
|
+
className: $,
|
|
314
|
+
style: E
|
|
315
|
+
} = _, w = M(() => {
|
|
316
|
+
let i = [...h];
|
|
317
|
+
if (y === "weight")
|
|
318
|
+
i.sort((u, N) => N.weight - u.weight);
|
|
319
|
+
else if (y === "alphabetical")
|
|
320
|
+
i.sort((u, N) => u.label.localeCompare(N.label));
|
|
318
321
|
else
|
|
319
|
-
for (let
|
|
320
|
-
const
|
|
321
|
-
[i[
|
|
322
|
+
for (let u = i.length - 1; u > 0; u--) {
|
|
323
|
+
const N = Math.floor(Math.random() * (u + 1));
|
|
324
|
+
[i[u], i[N]] = [i[N], i[u]];
|
|
322
325
|
}
|
|
323
|
-
return
|
|
324
|
-
}, [
|
|
325
|
-
if (
|
|
326
|
+
return o && i.length > o && (i = i.slice(0, o)), i;
|
|
327
|
+
}, [h, y, o]), { minW: x, maxW: S } = M(() => {
|
|
328
|
+
if (w.length === 0)
|
|
326
329
|
return { minW: 0, maxW: 1 };
|
|
327
|
-
const i =
|
|
330
|
+
const i = w.map((u) => u.weight);
|
|
328
331
|
return { minW: Math.min(...i), maxW: Math.max(...i) };
|
|
329
|
-
}, [
|
|
330
|
-
if (
|
|
331
|
-
return (
|
|
332
|
-
const
|
|
333
|
-
return
|
|
332
|
+
}, [w]), g = (i) => {
|
|
333
|
+
if (S === x)
|
|
334
|
+
return (d + p) / 2;
|
|
335
|
+
const u = (i - x) / (S - x);
|
|
336
|
+
return d + u * (p - d);
|
|
334
337
|
};
|
|
335
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
336
|
-
const
|
|
338
|
+
return /* @__PURE__ */ e("div", { ref: L, className: `nice-tag-cloud ${$ ?? ""}`, style: E, children: w.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-tag-cloud__empty", children: c("tagCloud.noTags", "No tags.") }) : w.map((i) => {
|
|
339
|
+
const u = C == null ? void 0 : C.includes(i.id), N = g(i.weight);
|
|
337
340
|
return /* @__PURE__ */ e(
|
|
338
341
|
"span",
|
|
339
342
|
{
|
|
340
|
-
className: `nice-tag-cloud__tag ${
|
|
341
|
-
style: {
|
|
342
|
-
fontSize: g,
|
|
343
|
-
color: i.color,
|
|
344
|
-
cursor: s ? "pointer" : void 0
|
|
345
|
-
},
|
|
343
|
+
className: `nice-tag-cloud__tag ${u ? "nice-tag-cloud__tag--selected" : ""}`,
|
|
344
|
+
style: { fontSize: N, color: i.color },
|
|
346
345
|
onClick: () => s == null ? void 0 : s(i),
|
|
347
346
|
role: s ? "button" : void 0,
|
|
348
347
|
tabIndex: s ? 0 : void 0,
|
|
349
|
-
onKeyDown: (
|
|
350
|
-
(
|
|
348
|
+
onKeyDown: (n) => {
|
|
349
|
+
(n.key === "Enter" || n.key === " ") && s && s(i);
|
|
351
350
|
},
|
|
352
351
|
title: `${i.label} (${i.weight})`,
|
|
353
352
|
children: i.label
|
|
@@ -356,79 +355,79 @@ const X = W(
|
|
|
356
355
|
);
|
|
357
356
|
}) });
|
|
358
357
|
}
|
|
359
|
-
),
|
|
358
|
+
), G = {
|
|
360
359
|
online: "#22c55e",
|
|
361
360
|
away: "#eab308",
|
|
362
361
|
busy: "#ef4444",
|
|
363
362
|
offline: "#9ca3af"
|
|
364
|
-
},
|
|
365
|
-
function(
|
|
366
|
-
const {
|
|
367
|
-
users:
|
|
363
|
+
}, se = /* @__PURE__ */ O(
|
|
364
|
+
function(_, L) {
|
|
365
|
+
const { t: c } = U(), {
|
|
366
|
+
users: h,
|
|
368
367
|
onUserClick: s,
|
|
369
|
-
onAction:
|
|
370
|
-
actions:
|
|
371
|
-
searchable:
|
|
372
|
-
statusFilter:
|
|
373
|
-
showStatus:
|
|
374
|
-
layout:
|
|
375
|
-
groupByRole:
|
|
376
|
-
className:
|
|
377
|
-
style:
|
|
378
|
-
} =
|
|
379
|
-
let
|
|
380
|
-
if (
|
|
381
|
-
const t =
|
|
382
|
-
|
|
383
|
-
(
|
|
384
|
-
var
|
|
385
|
-
return
|
|
368
|
+
onAction: d,
|
|
369
|
+
actions: p = [],
|
|
370
|
+
searchable: y = !1,
|
|
371
|
+
statusFilter: o,
|
|
372
|
+
showStatus: C = !0,
|
|
373
|
+
layout: $ = "list",
|
|
374
|
+
groupByRole: E = !1,
|
|
375
|
+
className: w,
|
|
376
|
+
style: x
|
|
377
|
+
} = _, [S, g] = T(""), i = M(() => {
|
|
378
|
+
let n = h;
|
|
379
|
+
if (o && o.length > 0 && (n = n.filter((t) => t.status && o.includes(t.status))), S.trim()) {
|
|
380
|
+
const t = S.toLowerCase();
|
|
381
|
+
n = n.filter(
|
|
382
|
+
(l) => {
|
|
383
|
+
var a, k;
|
|
384
|
+
return l.name.toLowerCase().includes(t) || ((a = l.email) == null ? void 0 : a.toLowerCase().includes(t)) || ((k = l.role) == null ? void 0 : k.toLowerCase().includes(t));
|
|
386
385
|
}
|
|
387
386
|
);
|
|
388
387
|
}
|
|
389
|
-
return
|
|
390
|
-
}, [
|
|
391
|
-
if (
|
|
388
|
+
return n;
|
|
389
|
+
}, [h, o, S]), u = M(() => {
|
|
390
|
+
if (!E)
|
|
392
391
|
return { "": i };
|
|
393
|
-
const
|
|
392
|
+
const n = {};
|
|
394
393
|
for (const t of i) {
|
|
395
|
-
const
|
|
396
|
-
|
|
394
|
+
const l = t.role ?? "Other";
|
|
395
|
+
n[l] || (n[l] = []), n[l].push(t);
|
|
397
396
|
}
|
|
398
|
-
return
|
|
399
|
-
}, [i,
|
|
397
|
+
return n;
|
|
398
|
+
}, [i, E]), N = (n) => /* @__PURE__ */ r(
|
|
400
399
|
"div",
|
|
401
400
|
{
|
|
402
|
-
className: `nice-user-list__item nice-user-list__item--${
|
|
403
|
-
onClick: () => s == null ? void 0 : s(
|
|
401
|
+
className: `nice-user-list__item nice-user-list__item--${$}`,
|
|
402
|
+
onClick: () => s == null ? void 0 : s(n),
|
|
404
403
|
role: s ? "button" : void 0,
|
|
405
404
|
tabIndex: s ? 0 : void 0,
|
|
406
405
|
onKeyDown: (t) => {
|
|
407
|
-
t.key === "Enter" && s && s(
|
|
406
|
+
t.key === "Enter" && s && s(n);
|
|
408
407
|
},
|
|
409
408
|
children: [
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
/* @__PURE__ */ r("div", { className: "nice-user-list__avatar-wrap", children: [
|
|
410
|
+
n.avatarUrl ? /* @__PURE__ */ e("img", { src: n.avatarUrl, alt: n.name, className: "nice-user-list__avatar" }) : /* @__PURE__ */ e("span", { className: "nice-user-list__avatar-placeholder", children: n.name.charAt(0).toUpperCase() }),
|
|
411
|
+
C && n.status && /* @__PURE__ */ e(
|
|
413
412
|
"span",
|
|
414
413
|
{
|
|
415
414
|
className: "nice-user-list__status-dot",
|
|
416
|
-
style: { backgroundColor:
|
|
417
|
-
title:
|
|
415
|
+
style: { backgroundColor: G[n.status] },
|
|
416
|
+
title: n.status
|
|
418
417
|
}
|
|
419
418
|
)
|
|
420
419
|
] }),
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */ e("span", { className: "nice-user-list__name", children:
|
|
423
|
-
|
|
424
|
-
|
|
420
|
+
/* @__PURE__ */ r("div", { className: "nice-user-list__info", children: [
|
|
421
|
+
/* @__PURE__ */ e("span", { className: "nice-user-list__name", children: n.name }),
|
|
422
|
+
n.email && /* @__PURE__ */ e("span", { className: "nice-user-list__email", children: n.email }),
|
|
423
|
+
n.role && /* @__PURE__ */ e("span", { className: "nice-user-list__role", children: n.role })
|
|
425
424
|
] }),
|
|
426
|
-
|
|
425
|
+
p.length > 0 && /* @__PURE__ */ e("div", { className: "nice-user-list__actions", children: p.map((t) => /* @__PURE__ */ e(
|
|
427
426
|
"button",
|
|
428
427
|
{
|
|
429
428
|
className: "nice-user-list__action-btn",
|
|
430
|
-
onClick: (
|
|
431
|
-
|
|
429
|
+
onClick: (l) => {
|
|
430
|
+
l.stopPropagation(), d == null || d(n, t);
|
|
432
431
|
},
|
|
433
432
|
children: t
|
|
434
433
|
},
|
|
@@ -436,186 +435,206 @@ const X = W(
|
|
|
436
435
|
)) })
|
|
437
436
|
]
|
|
438
437
|
},
|
|
439
|
-
|
|
438
|
+
n.id
|
|
440
439
|
);
|
|
441
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ r(
|
|
442
441
|
"div",
|
|
443
442
|
{
|
|
444
|
-
ref:
|
|
445
|
-
className: `nice-user-list nice-user-list--${
|
|
446
|
-
style:
|
|
443
|
+
ref: L,
|
|
444
|
+
className: `nice-user-list nice-user-list--${$} ${w ?? ""}`,
|
|
445
|
+
style: x,
|
|
447
446
|
children: [
|
|
448
|
-
|
|
447
|
+
y && /* @__PURE__ */ e(
|
|
449
448
|
"input",
|
|
450
449
|
{
|
|
451
450
|
type: "text",
|
|
452
|
-
value:
|
|
453
|
-
onChange: (
|
|
454
|
-
placeholder: "Search users…",
|
|
451
|
+
value: S,
|
|
452
|
+
onChange: (n) => g(n.target.value),
|
|
453
|
+
placeholder: c("userList.searchUsers", "Search users…"),
|
|
455
454
|
className: "nice-user-list__search"
|
|
456
455
|
}
|
|
457
456
|
),
|
|
458
|
-
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-user-list__empty", children: "No users found." }) : Object.entries(
|
|
459
|
-
|
|
460
|
-
|
|
457
|
+
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-user-list__empty", children: c("userList.noUsersFound", "No users found.") }) : Object.entries(u).map(([n, t]) => /* @__PURE__ */ r("div", { className: "nice-user-list__group", children: [
|
|
458
|
+
E && n && /* @__PURE__ */ r("h4", { className: "nice-user-list__group-title", children: [
|
|
459
|
+
n,
|
|
461
460
|
" (",
|
|
462
461
|
t.length,
|
|
463
462
|
")"
|
|
464
463
|
] }),
|
|
465
|
-
t.map(
|
|
466
|
-
] },
|
|
464
|
+
t.map(N)
|
|
465
|
+
] }, n))
|
|
467
466
|
]
|
|
468
467
|
}
|
|
469
468
|
);
|
|
470
469
|
}
|
|
471
470
|
);
|
|
472
|
-
function
|
|
473
|
-
if (!
|
|
471
|
+
function J(P) {
|
|
472
|
+
if (!P)
|
|
474
473
|
return "";
|
|
475
|
-
let
|
|
476
|
-
return
|
|
474
|
+
let _ = P;
|
|
475
|
+
return _ = _.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ""), _ = _.replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, ""), _ = _.replace(/(href|src|action)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*')/gi, '$1=""'), _ = _.replace(/(href|src|action)\s*=\s*(?:"vbscript:[^"]*"|'vbscript:[^']*')/gi, '$1=""'), _ = _.replace(/<\/?(iframe|object|embed|form)\b[^>]*>/gi, ""), _;
|
|
477
476
|
}
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
"div",
|
|
523
|
-
{
|
|
524
|
-
className: `nice-wiki__page-item ${p.id === s ? "nice-wiki__page-item--active" : ""}`,
|
|
525
|
-
style: { paddingLeft: 12 + y * 16 },
|
|
526
|
-
onClick: () => o == null ? void 0 : o(p),
|
|
527
|
-
role: "button",
|
|
528
|
-
tabIndex: 0,
|
|
529
|
-
onKeyDown: (B) => {
|
|
530
|
-
B.key === "Enter" && (o == null || o(p));
|
|
531
|
-
},
|
|
532
|
-
children: p.title
|
|
533
|
-
}
|
|
534
|
-
),
|
|
535
|
-
(f = p.children) == null ? void 0 : f.map((B) => R(B, y + 1))
|
|
536
|
-
] }, p.id);
|
|
537
|
-
};
|
|
538
|
-
return /* @__PURE__ */ l("div", { ref: T, className: `nice-wiki ${C ?? ""}`, style: { display: "flex", ...x }, children: [
|
|
539
|
-
/* @__PURE__ */ l("div", { className: "nice-wiki__sidebar", style: { width: b, minWidth: b }, children: [
|
|
540
|
-
/* @__PURE__ */ l("div", { className: "nice-wiki__sidebar-header", children: [
|
|
541
|
-
/* @__PURE__ */ e("strong", { children: "Wiki" }),
|
|
542
|
-
w && r && /* @__PURE__ */ e("button", { onClick: () => j(!F), title: "New page", children: "+" })
|
|
543
|
-
] }),
|
|
544
|
-
F && /* @__PURE__ */ l("div", { className: "nice-wiki__new-page", children: [
|
|
477
|
+
const ce = /* @__PURE__ */ O(
|
|
478
|
+
function(_, L) {
|
|
479
|
+
const { t: c } = U(), {
|
|
480
|
+
pages: h,
|
|
481
|
+
selectedPageId: s,
|
|
482
|
+
onSelectPage: d,
|
|
483
|
+
onSavePage: p,
|
|
484
|
+
onDeletePage: y,
|
|
485
|
+
onCreatePage: o,
|
|
486
|
+
editable: C = !1,
|
|
487
|
+
searchable: $ = !0,
|
|
488
|
+
renderHtml: E = !1,
|
|
489
|
+
sidebarWidth: w = 260,
|
|
490
|
+
className: x,
|
|
491
|
+
style: S
|
|
492
|
+
} = _, [g, i] = T(""), [u, N] = T(!1), [n, t] = T(""), [l, a] = T(""), [k, F] = T(""), [I, z] = T(!1), B = M(() => {
|
|
493
|
+
if (h.some((f) => f.children && f.children.length > 0))
|
|
494
|
+
return h.filter((f) => !f.parentId);
|
|
495
|
+
const v = /* @__PURE__ */ new Map();
|
|
496
|
+
for (const f of h)
|
|
497
|
+
v.set(f.id, { ...f, children: [] });
|
|
498
|
+
const b = [];
|
|
499
|
+
for (const f of v.values())
|
|
500
|
+
f.parentId && v.has(f.parentId) ? v.get(f.parentId).children.push(f) : b.push(f);
|
|
501
|
+
return b;
|
|
502
|
+
}, [h]), A = M(
|
|
503
|
+
() => h.find((v) => v.id === s),
|
|
504
|
+
[h, s]
|
|
505
|
+
), R = M(() => {
|
|
506
|
+
if (!g.trim())
|
|
507
|
+
return B;
|
|
508
|
+
const v = g.toLowerCase(), b = new Set(
|
|
509
|
+
h.filter((f) => f.title.toLowerCase().includes(v)).map((f) => f.id)
|
|
510
|
+
);
|
|
511
|
+
return h.filter((f) => b.has(f.id));
|
|
512
|
+
}, [B, h, g]), K = W(() => {
|
|
513
|
+
A && (t(A.title), a(A.content ?? ""), N(!0));
|
|
514
|
+
}, [A]), m = W(() => {
|
|
515
|
+
!A || !p || (p(A.id, l, n), N(!1));
|
|
516
|
+
}, [A, l, n, p]), D = W(() => {
|
|
517
|
+
!k.trim() || !o || (o(s ?? null, k.trim()), F(""), z(!1));
|
|
518
|
+
}, [k, s, o]), j = (v, b = 0) => {
|
|
519
|
+
var f;
|
|
520
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
545
521
|
/* @__PURE__ */ e(
|
|
546
|
-
"
|
|
522
|
+
"div",
|
|
547
523
|
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
524
|
+
className: `nice-wiki__page-item ${v.id === s ? "nice-wiki__page-item--active" : ""}`,
|
|
525
|
+
style: { paddingLeft: 12 + b * 16 },
|
|
526
|
+
onClick: () => d == null ? void 0 : d(v),
|
|
527
|
+
role: "button",
|
|
528
|
+
tabIndex: 0,
|
|
529
|
+
onKeyDown: (V) => {
|
|
530
|
+
V.key === "Enter" && (d == null || d(v));
|
|
531
|
+
},
|
|
532
|
+
children: v.title
|
|
552
533
|
}
|
|
553
534
|
),
|
|
554
|
-
|
|
555
|
-
] })
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
535
|
+
(f = v.children) == null ? void 0 : f.map((V) => j(V, b + 1))
|
|
536
|
+
] }, v.id);
|
|
537
|
+
};
|
|
538
|
+
return /* @__PURE__ */ r(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
ref: L,
|
|
542
|
+
className: `nice-wiki ${x ?? ""}`,
|
|
543
|
+
style: { display: "flex", ...S },
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ r("div", { className: "nice-wiki__sidebar", style: { width: w, minWidth: w }, children: [
|
|
546
|
+
/* @__PURE__ */ r("div", { className: "nice-wiki__sidebar-header", children: [
|
|
547
|
+
/* @__PURE__ */ e("strong", { children: c("wiki.wiki", "Wiki") }),
|
|
548
|
+
C && o && /* @__PURE__ */ e(
|
|
549
|
+
"button",
|
|
550
|
+
{
|
|
551
|
+
onClick: () => z(!I),
|
|
552
|
+
title: c("wiki.newPage", "New page"),
|
|
553
|
+
children: "+"
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
] }),
|
|
557
|
+
I && /* @__PURE__ */ r("div", { className: "nice-wiki__new-page", children: [
|
|
558
|
+
/* @__PURE__ */ e(
|
|
559
|
+
"input",
|
|
560
|
+
{
|
|
561
|
+
type: "text",
|
|
562
|
+
value: k,
|
|
563
|
+
onChange: (v) => F(v.target.value),
|
|
564
|
+
placeholder: c("wiki.newPageTitle", "New page title")
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
/* @__PURE__ */ e("button", { onClick: D, disabled: !k.trim(), children: c("wiki.create", "Create") })
|
|
568
|
+
] }),
|
|
569
|
+
$ && /* @__PURE__ */ e(
|
|
570
|
+
"input",
|
|
571
|
+
{
|
|
572
|
+
type: "text",
|
|
573
|
+
className: "nice-wiki__search",
|
|
574
|
+
value: g,
|
|
575
|
+
onChange: (v) => i(v.target.value),
|
|
576
|
+
placeholder: c("wiki.searchPages", "Search pages…")
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ e("div", { className: "nice-wiki__tree", children: R.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-wiki__empty", children: c("wiki.noPages", "No pages.") }) : R.map((v) => j(v)) })
|
|
598
580
|
] }),
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
581
|
+
/* @__PURE__ */ e("div", { className: "nice-wiki__content", children: A ? u ? /* @__PURE__ */ r("div", { className: "nice-wiki__editor", children: [
|
|
582
|
+
/* @__PURE__ */ e(
|
|
583
|
+
"input",
|
|
584
|
+
{
|
|
585
|
+
type: "text",
|
|
586
|
+
className: "nice-wiki__edit-title",
|
|
587
|
+
value: n,
|
|
588
|
+
onChange: (v) => t(v.target.value)
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ e(
|
|
592
|
+
"textarea",
|
|
593
|
+
{
|
|
594
|
+
className: "nice-wiki__edit-body",
|
|
595
|
+
value: l,
|
|
596
|
+
onChange: (v) => a(v.target.value),
|
|
597
|
+
rows: 20
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
/* @__PURE__ */ r("div", { className: "nice-wiki__edit-actions", children: [
|
|
601
|
+
/* @__PURE__ */ e("button", { onClick: m, children: c("wiki.save", "Save") }),
|
|
602
|
+
/* @__PURE__ */ e("button", { onClick: () => N(!1), children: c("wiki.cancel", "Cancel") })
|
|
603
|
+
] })
|
|
604
|
+
] }) : /* @__PURE__ */ r("div", { className: "nice-wiki__viewer", children: [
|
|
605
|
+
/* @__PURE__ */ r("div", { className: "nice-wiki__viewer-header", children: [
|
|
606
|
+
/* @__PURE__ */ e("h2", { children: A.title }),
|
|
607
|
+
/* @__PURE__ */ r("div", { className: "nice-wiki__viewer-meta", children: [
|
|
608
|
+
A.lastEditedBy && /* @__PURE__ */ e("span", { children: c("wiki.editedBy", "Edited by {lastEditedBy}").replace(
|
|
609
|
+
"{lastEditedBy}",
|
|
610
|
+
String(A.lastEditedBy)
|
|
611
|
+
) }),
|
|
612
|
+
A.lastEditedAt && /* @__PURE__ */ r("span", { children: [
|
|
613
|
+
" ",
|
|
614
|
+
c("wiki.on", "on {lastEditedAt}").replace(
|
|
615
|
+
"{lastEditedAt}",
|
|
616
|
+
String(A.lastEditedAt)
|
|
617
|
+
)
|
|
618
|
+
] })
|
|
619
|
+
] }),
|
|
620
|
+
C && /* @__PURE__ */ r("div", { className: "nice-wiki__viewer-actions", children: [
|
|
621
|
+
/* @__PURE__ */ e("button", { onClick: K, children: c("wiki.edit", "Edit") }),
|
|
622
|
+
y && /* @__PURE__ */ e("button", { onClick: () => y(A.id), children: c("wiki.delete", "Delete") })
|
|
623
|
+
] })
|
|
624
|
+
] }),
|
|
625
|
+
E ? /* @__PURE__ */ e(
|
|
626
|
+
"div",
|
|
627
|
+
{
|
|
628
|
+
className: "nice-wiki__viewer-body",
|
|
629
|
+
dangerouslySetInnerHTML: { __html: J(A.content ?? "") }
|
|
630
|
+
}
|
|
631
|
+
) : /* @__PURE__ */ e("div", { className: "nice-wiki__viewer-body", children: A.content ?? /* @__PURE__ */ e("em", { children: c("wiki.noContent", "No content.") }) })
|
|
632
|
+
] }) : /* @__PURE__ */ e("div", { className: "nice-wiki__placeholder", children: c("wiki.selectAPageFromThe", "Select a page from the sidebar.") }) })
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
), Q = {
|
|
619
638
|
comment: "var(--nice-color-primary, #3b82f6)",
|
|
620
639
|
like: "var(--nice-color-error, #ef4444)",
|
|
621
640
|
share: "var(--nice-color-info, #0ea5e9)",
|
|
@@ -627,129 +646,121 @@ const ae = W(function(u, T) {
|
|
|
627
646
|
upload: "var(--nice-color-accent, #8b5cf6)",
|
|
628
647
|
mention: "var(--nice-color-primary, #3b82f6)",
|
|
629
648
|
custom: "var(--nice-text-muted, #6b7280)"
|
|
630
|
-
},
|
|
631
|
-
function(
|
|
632
|
-
const {
|
|
633
|
-
events:
|
|
649
|
+
}, le = /* @__PURE__ */ O(
|
|
650
|
+
function(_, L) {
|
|
651
|
+
const { t: c } = U(), {
|
|
652
|
+
events: h,
|
|
634
653
|
onEventClick: s,
|
|
635
|
-
groupByDate:
|
|
636
|
-
typeFilter:
|
|
637
|
-
showFilters:
|
|
638
|
-
maxEvents:
|
|
639
|
-
onLoadMore:
|
|
640
|
-
hasMore:
|
|
641
|
-
className:
|
|
642
|
-
style:
|
|
643
|
-
} =
|
|
644
|
-
let t =
|
|
645
|
-
if (
|
|
646
|
-
const
|
|
647
|
-
t = t.filter((
|
|
654
|
+
groupByDate: d = !0,
|
|
655
|
+
typeFilter: p,
|
|
656
|
+
showFilters: y = !1,
|
|
657
|
+
maxEvents: o,
|
|
658
|
+
onLoadMore: C,
|
|
659
|
+
hasMore: $ = !1,
|
|
660
|
+
className: E,
|
|
661
|
+
style: w
|
|
662
|
+
} = _, [x, S] = T(/* @__PURE__ */ new Set()), g = p ?? (x.size > 0 ? Array.from(x) : void 0), i = M(() => {
|
|
663
|
+
let t = h;
|
|
664
|
+
if (g && g.length > 0) {
|
|
665
|
+
const l = new Set(g);
|
|
666
|
+
t = t.filter((a) => l.has(a.type));
|
|
648
667
|
}
|
|
649
|
-
return
|
|
650
|
-
}, [
|
|
651
|
-
if (!
|
|
668
|
+
return o && (t = t.slice(0, o)), t;
|
|
669
|
+
}, [h, g, o]), u = M(() => {
|
|
670
|
+
if (!d)
|
|
652
671
|
return [{ label: "", events: i }];
|
|
653
672
|
const t = /* @__PURE__ */ new Map();
|
|
654
|
-
for (const
|
|
655
|
-
const
|
|
656
|
-
t.has(
|
|
673
|
+
for (const l of i) {
|
|
674
|
+
const a = l.timestamp.slice(0, 10);
|
|
675
|
+
t.has(a) || t.set(a, []), t.get(a).push(l);
|
|
657
676
|
}
|
|
658
|
-
return Array.from(t.entries()).map(([
|
|
659
|
-
}, [i,
|
|
660
|
-
const t = new Set(
|
|
677
|
+
return Array.from(t.entries()).map(([l, a]) => ({ label: l, events: a }));
|
|
678
|
+
}, [i, d]), N = M(() => {
|
|
679
|
+
const t = new Set(h.map((l) => l.type));
|
|
661
680
|
return Array.from(t).sort();
|
|
662
|
-
}, [
|
|
663
|
-
|
|
664
|
-
const
|
|
665
|
-
return
|
|
681
|
+
}, [h]), n = (t) => {
|
|
682
|
+
S((l) => {
|
|
683
|
+
const a = new Set(l);
|
|
684
|
+
return a.has(t) ? a.delete(t) : a.add(t), a;
|
|
666
685
|
});
|
|
667
686
|
};
|
|
668
|
-
return /* @__PURE__ */
|
|
669
|
-
|
|
670
|
-
|
|
687
|
+
return /* @__PURE__ */ r("div", { ref: L, className: `nice-activity-feed ${E ?? ""}`, style: w, children: [
|
|
688
|
+
y && !p && /* @__PURE__ */ r("div", { className: "nice-activity-feed__filters", children: [
|
|
689
|
+
N.map((t) => /* @__PURE__ */ e(
|
|
671
690
|
"button",
|
|
672
691
|
{
|
|
673
|
-
className: `nice-activity-feed__filter-chip ${
|
|
674
|
-
onClick: () =>
|
|
692
|
+
className: `nice-activity-feed__filter-chip ${x.has(t) ? "nice-activity-feed__filter-chip--active" : ""}`,
|
|
693
|
+
onClick: () => n(t),
|
|
675
694
|
children: t
|
|
676
695
|
},
|
|
677
696
|
t
|
|
678
697
|
)),
|
|
679
|
-
|
|
698
|
+
x.size > 0 && /* @__PURE__ */ e(
|
|
680
699
|
"button",
|
|
681
700
|
{
|
|
682
701
|
className: "nice-activity-feed__filter-clear",
|
|
683
|
-
onClick: () =>
|
|
684
|
-
children: "Clear"
|
|
702
|
+
onClick: () => S(/* @__PURE__ */ new Set()),
|
|
703
|
+
children: c("activityFeed.clear", "Clear")
|
|
685
704
|
}
|
|
686
705
|
)
|
|
687
706
|
] }),
|
|
688
|
-
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-activity-feed__empty", children: "No activity." }) :
|
|
689
|
-
|
|
690
|
-
|
|
707
|
+
i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-activity-feed__empty", children: c("activityFeed.noActivity", "No activity.") }) : u.map(({ label: t, events: l }) => /* @__PURE__ */ r("div", { className: "nice-activity-feed__group", children: [
|
|
708
|
+
d && t && /* @__PURE__ */ e("div", { className: "nice-activity-feed__date-label", children: t }),
|
|
709
|
+
l.map((a) => /* @__PURE__ */ r(
|
|
691
710
|
"div",
|
|
692
711
|
{
|
|
693
712
|
className: "nice-activity-feed__event",
|
|
694
|
-
onClick: () => s == null ? void 0 : s(
|
|
713
|
+
onClick: () => s == null ? void 0 : s(a),
|
|
695
714
|
role: s ? "button" : void 0,
|
|
696
715
|
tabIndex: s ? 0 : void 0,
|
|
697
716
|
onKeyDown: (k) => {
|
|
698
|
-
k.key === "Enter" && s && s(
|
|
717
|
+
k.key === "Enter" && s && s(a);
|
|
699
718
|
},
|
|
700
719
|
children: [
|
|
701
720
|
/* @__PURE__ */ e(
|
|
702
721
|
"span",
|
|
703
722
|
{
|
|
704
|
-
className: `nice-activity-feed__icon nice-activity-feed__icon--${
|
|
705
|
-
title:
|
|
723
|
+
className: `nice-activity-feed__icon nice-activity-feed__icon--${a.type}`,
|
|
724
|
+
title: a.type,
|
|
706
725
|
"aria-hidden": "true",
|
|
707
|
-
style: {
|
|
708
|
-
display: "inline-block",
|
|
709
|
-
width: 10,
|
|
710
|
-
height: 10,
|
|
711
|
-
marginTop: 4,
|
|
712
|
-
flexShrink: 0,
|
|
713
|
-
borderRadius: "50%",
|
|
714
|
-
background: G[n.type]
|
|
715
|
-
}
|
|
726
|
+
style: { background: Q[a.type] }
|
|
716
727
|
}
|
|
717
728
|
),
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
|
|
729
|
+
/* @__PURE__ */ r("div", { className: "nice-activity-feed__body", children: [
|
|
730
|
+
a.actorAvatarUrl && /* @__PURE__ */ e(
|
|
720
731
|
"img",
|
|
721
732
|
{
|
|
722
|
-
src:
|
|
733
|
+
src: a.actorAvatarUrl,
|
|
723
734
|
alt: "",
|
|
724
735
|
className: "nice-activity-feed__avatar"
|
|
725
736
|
}
|
|
726
737
|
),
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */ e("strong", { children:
|
|
738
|
+
/* @__PURE__ */ r("span", { className: "nice-activity-feed__message", children: [
|
|
739
|
+
/* @__PURE__ */ e("strong", { children: a.actorName }),
|
|
729
740
|
" ",
|
|
730
|
-
|
|
731
|
-
|
|
741
|
+
a.message,
|
|
742
|
+
a.targetLabel && /* @__PURE__ */ r(q, { children: [
|
|
732
743
|
" ",
|
|
733
|
-
/* @__PURE__ */ e("em", { children:
|
|
744
|
+
/* @__PURE__ */ e("em", { children: a.targetLabel })
|
|
734
745
|
] })
|
|
735
746
|
] }),
|
|
736
|
-
/* @__PURE__ */ e("time", { className: "nice-activity-feed__time", children:
|
|
747
|
+
/* @__PURE__ */ e("time", { className: "nice-activity-feed__time", children: a.timestamp })
|
|
737
748
|
] })
|
|
738
749
|
]
|
|
739
750
|
},
|
|
740
|
-
|
|
751
|
+
a.id
|
|
741
752
|
))
|
|
742
753
|
] }, t || "__all")),
|
|
743
|
-
|
|
754
|
+
$ && C && /* @__PURE__ */ e("button", { className: "nice-activity-feed__load-more", onClick: C, children: c("activityFeed.loadMore", "Load more") })
|
|
744
755
|
] });
|
|
745
756
|
}
|
|
746
757
|
);
|
|
747
758
|
export {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
759
|
+
le as NiceActivityFeed,
|
|
760
|
+
ie as NiceComments,
|
|
761
|
+
te as NiceRatings,
|
|
762
|
+
ne as NiceSocialPanel,
|
|
763
|
+
ae as NiceTagCloud,
|
|
764
|
+
se as NiceUserList,
|
|
765
|
+
ce as NiceWiki
|
|
755
766
|
};
|