slack-blocks-to-jsx 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +955 -259
- package/dist/index.mjs +953 -257
- package/dist/style.css +1 -1
- package/package.json +9 -7
- package/readme.md +13 -4
package/dist/index.mjs
CHANGED
|
@@ -53,48 +53,696 @@ var parseEmojis = (text) => {
|
|
|
53
53
|
return emojified;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
// src/utils/
|
|
57
|
-
import
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
// src/utils/markdown_parser/parser.tsx
|
|
57
|
+
import YozoraParser from "@yozora/parser";
|
|
58
|
+
|
|
59
|
+
// src/utils/markdown_parser/sub_elements/text.tsx
|
|
60
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
61
|
+
var Text = (props) => {
|
|
62
|
+
const { element } = props;
|
|
63
|
+
return /* @__PURE__ */ jsx("span", { children: element.value.split("[[DOUBLE_LINE_BREAK]]").map((line, index) => {
|
|
64
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
65
|
+
index > 0 && /* @__PURE__ */ jsx("span", { className: "slack_blocks_to_jsx__line_break_not_first" }),
|
|
66
|
+
line
|
|
67
|
+
] }, index);
|
|
68
|
+
}) });
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/utils/markdown_parser/sub_elements/delete.tsx
|
|
72
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
73
|
+
var Delete = (props) => {
|
|
74
|
+
const { element } = props;
|
|
75
|
+
return /* @__PURE__ */ jsx2("s", { children: element.children.map((child, i) => {
|
|
76
|
+
return /* @__PURE__ */ jsx2(Text, { element: child }, i);
|
|
77
|
+
}) });
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/store/useGlobalData.ts
|
|
81
|
+
import { create } from "zustand";
|
|
82
|
+
var useBearStore = create((set) => ({
|
|
83
|
+
users: [],
|
|
84
|
+
channels: [],
|
|
85
|
+
user_groups: [],
|
|
86
|
+
hooks: {},
|
|
87
|
+
setUsers: (users) => set({ users }),
|
|
88
|
+
setChannels: (channels) => set({ channels }),
|
|
89
|
+
setUserGroups: (user_groups) => set({ user_groups }),
|
|
90
|
+
setHooks: (hooks) => set({ hooks })
|
|
91
|
+
}));
|
|
92
|
+
var useGlobalData = () => {
|
|
93
|
+
const { users, channels, user_groups, hooks, setChannels, setUsers, setHooks, setUserGroups } = useBearStore();
|
|
94
|
+
return {
|
|
95
|
+
users,
|
|
96
|
+
channels,
|
|
97
|
+
user_groups,
|
|
98
|
+
hooks,
|
|
99
|
+
setChannels,
|
|
100
|
+
setUsers,
|
|
101
|
+
setHooks,
|
|
102
|
+
setUserGroups
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/utils/markdown_parser/sub_elements/slack_broadcast.tsx
|
|
107
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
108
|
+
var SlackBroadcast = (props) => {
|
|
109
|
+
const { element } = props;
|
|
110
|
+
const { hooks } = useGlobalData();
|
|
111
|
+
if (element.value === "here" && hooks.atHere)
|
|
112
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: hooks.atHere() });
|
|
113
|
+
if (element.value === "everyone" && hooks.atEveryone)
|
|
114
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: hooks.atEveryone() });
|
|
115
|
+
if (element.value === "channel" && hooks.atChannel)
|
|
116
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: hooks.atChannel() });
|
|
117
|
+
return /* @__PURE__ */ jsxs2("span", { className: "slack_broadcast", children: [
|
|
118
|
+
"@",
|
|
119
|
+
element.value
|
|
120
|
+
] });
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/utils/markdown_parser/sub_elements/slack_channel_mention.tsx
|
|
124
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
125
|
+
var SlackChannelMention = (props) => {
|
|
126
|
+
const { element } = props;
|
|
127
|
+
const { hooks, channels } = useGlobalData();
|
|
128
|
+
const channel_id = element.value;
|
|
129
|
+
const channel = channels.find((u) => u.id === channel_id || u.name === channel_id);
|
|
130
|
+
const label = (channel == null ? void 0 : channel.name) || channel_id;
|
|
131
|
+
if (hooks.channel)
|
|
132
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children: hooks.channel(channel || { id: channel_id, name: label }) });
|
|
133
|
+
return /* @__PURE__ */ jsxs3("span", { className: "slack_channel", "data-channel-id": (channel == null ? void 0 : channel.id) || channel_id, children: [
|
|
134
|
+
"#",
|
|
135
|
+
label
|
|
136
|
+
] });
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/utils/markdown_parser/sub_elements/slack_user_group_mention.tsx
|
|
140
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
141
|
+
var SlackUserGroupMention = (props) => {
|
|
142
|
+
const { element } = props;
|
|
143
|
+
const { hooks, user_groups } = useGlobalData();
|
|
144
|
+
const group_id = element.value;
|
|
145
|
+
const group = user_groups.find((u) => u.id === group_id || u.name === group_id);
|
|
146
|
+
const label = (group == null ? void 0 : group.name) || group_id;
|
|
147
|
+
if (hooks.usergroup)
|
|
148
|
+
return /* @__PURE__ */ jsx5(Fragment3, { children: hooks.usergroup(group || { id: group_id, name: label }) });
|
|
149
|
+
return /* @__PURE__ */ jsxs4("span", { "data-usergroup-id": (group == null ? void 0 : group.id) || group_id, className: "slack_user_group", children: [
|
|
150
|
+
"@",
|
|
151
|
+
label
|
|
152
|
+
] });
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// src/utils/markdown_parser/sub_elements/slack_user_mention.tsx
|
|
156
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
157
|
+
var SlackUserMention = (props) => {
|
|
158
|
+
const { element } = props;
|
|
159
|
+
const { hooks, users } = useGlobalData();
|
|
160
|
+
const user_id = element.value;
|
|
161
|
+
const user = users.find((u) => u.id === user_id || u.name === user_id);
|
|
162
|
+
if (hooks.user)
|
|
163
|
+
return /* @__PURE__ */ jsx6(Fragment4, { children: hooks.user(user || { id: user_id, name: user_id }) });
|
|
164
|
+
const label = (user == null ? void 0 : user.name) || user_id;
|
|
165
|
+
return /* @__PURE__ */ jsxs5("span", { className: "slack_user", "data-user-id": (user == null ? void 0 : user.id) || user_id, children: [
|
|
166
|
+
"@",
|
|
167
|
+
label
|
|
168
|
+
] });
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// src/utils/markdown_parser/sub_elements/emphasis.tsx
|
|
172
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
173
|
+
var Emphasis = (props) => {
|
|
174
|
+
const { element } = props;
|
|
175
|
+
return /* @__PURE__ */ jsx7("em", { children: element.children.map((child, i) => {
|
|
176
|
+
if (child.type === "delete")
|
|
177
|
+
return /* @__PURE__ */ jsx7(Delete, { element: child }, i);
|
|
178
|
+
if (child.type === "slack_user_mention")
|
|
179
|
+
return /* @__PURE__ */ jsx7(SlackUserMention, { element: child }, i);
|
|
180
|
+
if (child.type === "slack_channel_mention")
|
|
181
|
+
return /* @__PURE__ */ jsx7(SlackChannelMention, { element: child }, i);
|
|
182
|
+
if (child.type === "slack_user_group_mention")
|
|
183
|
+
return /* @__PURE__ */ jsx7(SlackUserGroupMention, { element: child }, i);
|
|
184
|
+
if (child.type === "slack_broadcast")
|
|
185
|
+
return /* @__PURE__ */ jsx7(SlackBroadcast, { element: child }, i);
|
|
186
|
+
return /* @__PURE__ */ jsx7(Text, { element: child }, i);
|
|
187
|
+
}) });
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// src/utils/markdown_parser/sub_elements/inline_code.tsx
|
|
191
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
192
|
+
var InlineCode = (props) => {
|
|
193
|
+
const { element } = props;
|
|
194
|
+
return /* @__PURE__ */ jsx8("code", { className: "slack_code_inline", children: element.value });
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/utils/markdown_parser/sub_elements/strong.tsx
|
|
198
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
199
|
+
var Strong = (props) => {
|
|
200
|
+
const { element } = props;
|
|
201
|
+
return /* @__PURE__ */ jsx9("strong", { children: element.children.map((child, i) => {
|
|
202
|
+
if (child.type === "delete")
|
|
203
|
+
return /* @__PURE__ */ jsx9(Delete, { element: child }, i);
|
|
204
|
+
if (child.type === "slack_user_mention")
|
|
205
|
+
return /* @__PURE__ */ jsx9(SlackUserMention, { element: child }, i);
|
|
206
|
+
if (child.type === "slack_channel_mention")
|
|
207
|
+
return /* @__PURE__ */ jsx9(SlackChannelMention, { element: child }, i);
|
|
208
|
+
if (child.type === "slack_user_group_mention")
|
|
209
|
+
return /* @__PURE__ */ jsx9(SlackUserGroupMention, { element: child }, i);
|
|
210
|
+
if (child.type === "slack_broadcast")
|
|
211
|
+
return /* @__PURE__ */ jsx9(SlackBroadcast, { element: child }, i);
|
|
212
|
+
return /* @__PURE__ */ jsx9(Text, { element: child }, i);
|
|
213
|
+
}) });
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// src/utils/markdown_parser/sub_elements/link.tsx
|
|
217
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
218
|
+
var Link = (props) => {
|
|
219
|
+
const { element } = props;
|
|
220
|
+
return /* @__PURE__ */ jsx10("a", { href: element.url, className: "slack_link", children: element.children.map((child, i) => {
|
|
221
|
+
if (child.type === "delete")
|
|
222
|
+
return /* @__PURE__ */ jsx10(Delete, { element: child }, i);
|
|
223
|
+
if (child.type === "emphasis")
|
|
224
|
+
return /* @__PURE__ */ jsx10(Emphasis, { element: child }, i);
|
|
225
|
+
if (child.type === "strong")
|
|
226
|
+
return /* @__PURE__ */ jsx10(Strong, { element: child }, i);
|
|
227
|
+
return /* @__PURE__ */ jsx10(Text, { element: child }, i);
|
|
228
|
+
}) });
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// src/utils/markdown_parser/elements/paragraph.tsx
|
|
232
|
+
import { Fragment as Fragment5, jsx as jsx11 } from "react/jsx-runtime";
|
|
233
|
+
var Paragraph = (props) => {
|
|
234
|
+
const { element } = props;
|
|
235
|
+
return /* @__PURE__ */ jsx11(Fragment5, { children: element.children.map((subelement, i) => {
|
|
236
|
+
if (subelement.type === "text")
|
|
237
|
+
return /* @__PURE__ */ jsx11(Text, { element: subelement }, i);
|
|
238
|
+
if (subelement.type === "emphasis")
|
|
239
|
+
return /* @__PURE__ */ jsx11(Emphasis, { element: subelement }, i);
|
|
240
|
+
if (subelement.type === "inlineCode")
|
|
241
|
+
return /* @__PURE__ */ jsx11(InlineCode, { element: subelement }, i);
|
|
242
|
+
if (subelement.type === "delete")
|
|
243
|
+
return /* @__PURE__ */ jsx11(Delete, { element: subelement }, i);
|
|
244
|
+
if (subelement.type === "strong")
|
|
245
|
+
return /* @__PURE__ */ jsx11(Strong, { element: subelement }, i);
|
|
246
|
+
if (subelement.type === "link")
|
|
247
|
+
return /* @__PURE__ */ jsx11(Link, { element: subelement }, i);
|
|
248
|
+
if (subelement.type === "slack_user_mention")
|
|
249
|
+
return /* @__PURE__ */ jsx11(SlackUserMention, { element: subelement }, i);
|
|
250
|
+
if (subelement.type === "slack_channel_mention")
|
|
251
|
+
return /* @__PURE__ */ jsx11(SlackChannelMention, { element: subelement }, i);
|
|
252
|
+
if (subelement.type === "slack_user_group_mention")
|
|
253
|
+
return /* @__PURE__ */ jsx11(SlackUserGroupMention, { element: subelement }, i);
|
|
254
|
+
if (subelement.type === "slack_broadcast")
|
|
255
|
+
return /* @__PURE__ */ jsx11(SlackBroadcast, { element: subelement }, i);
|
|
62
256
|
return null;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
257
|
+
}) });
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// src/utils/markdown_parser/elements/blockquote.tsx
|
|
261
|
+
import { Fragment as Fragment6, jsx as jsx12 } from "react/jsx-runtime";
|
|
262
|
+
var Blockquote = (props) => {
|
|
263
|
+
const { element } = props;
|
|
264
|
+
return /* @__PURE__ */ jsx12(Fragment6, { children: element.children.map((para) => {
|
|
265
|
+
return /* @__PURE__ */ jsx12(Paragraph, { element: para });
|
|
266
|
+
}) });
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// src/utils/markdown_parser/elements/code.tsx
|
|
270
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
271
|
+
var Code = (props) => {
|
|
272
|
+
const { element } = props;
|
|
273
|
+
return /* @__PURE__ */ jsx13("code", { className: "slack_code", children: element.value });
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// src/utils/markdown_parser/tokenizers/slack_user_mention/tokenizer.ts
|
|
277
|
+
import { BaseInlineTokenizer, TokenizerPriority } from "@yozora/core-tokenizer";
|
|
278
|
+
|
|
279
|
+
// src/utils/markdown_parser/tokenizers/slack_user_mention/match.ts
|
|
280
|
+
import { AsciiCodePoint } from "@yozora/character";
|
|
281
|
+
import { eatOptionalCharacters } from "@yozora/core-tokenizer";
|
|
282
|
+
|
|
283
|
+
// src/utils/markdown_parser/tokenizers/slack_user_mention/types.ts
|
|
284
|
+
var SlackUserMentionType = "slack_user_mention";
|
|
285
|
+
|
|
286
|
+
// src/utils/markdown_parser/tokenizers/slack_user_mention/match.ts
|
|
287
|
+
var match = function(api) {
|
|
288
|
+
return { findDelimiter, processSingleDelimiter };
|
|
289
|
+
function* findDelimiter() {
|
|
290
|
+
var _a, _b;
|
|
291
|
+
const nodePoints = api.getNodePoints();
|
|
292
|
+
const blockStartIndex = api.getBlockStartIndex();
|
|
293
|
+
const blockEndIndex = api.getBlockEndIndex();
|
|
294
|
+
const potentialDelimiters = [];
|
|
295
|
+
for (let i = blockStartIndex; i < blockEndIndex; ++i) {
|
|
296
|
+
const c = (_a = nodePoints[i]) == null ? void 0 : _a.codePoint;
|
|
297
|
+
if (c === AsciiCodePoint.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === AsciiCodePoint.AT_SIGN) {
|
|
298
|
+
const j = eatOptionalCharacters(nodePoints, i + 2, blockEndIndex, AsciiCodePoint.AT_SIGN);
|
|
299
|
+
if (j < blockEndIndex) {
|
|
300
|
+
potentialDelimiters.push({
|
|
301
|
+
type: "opener",
|
|
302
|
+
startIndex: i,
|
|
303
|
+
endIndex: j
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
} else if (c === AsciiCodePoint.CLOSE_ANGLE) {
|
|
307
|
+
potentialDelimiters.push({
|
|
308
|
+
type: "closer",
|
|
309
|
+
startIndex: i,
|
|
310
|
+
endIndex: i + 1
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
let pIndex = 0;
|
|
315
|
+
let lastEndIndex = -1;
|
|
316
|
+
let delimiter = null;
|
|
317
|
+
while (pIndex < potentialDelimiters.length) {
|
|
318
|
+
const [startIndex, endIndex] = yield delimiter;
|
|
319
|
+
if (lastEndIndex === endIndex) {
|
|
320
|
+
if (delimiter == null || delimiter.startIndex >= startIndex)
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
lastEndIndex = endIndex;
|
|
324
|
+
let openerDelimiter = null;
|
|
325
|
+
let closerDelimiter = null;
|
|
326
|
+
for (; pIndex < potentialDelimiters.length; ++pIndex) {
|
|
327
|
+
const delimiter2 = potentialDelimiters[pIndex];
|
|
328
|
+
if (delimiter2.startIndex >= startIndex && delimiter2.type !== "closer") {
|
|
329
|
+
openerDelimiter = delimiter2;
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
for (let i = pIndex + 1; i < potentialDelimiters.length; ++i) {
|
|
334
|
+
const delimiter2 = potentialDelimiters[i];
|
|
335
|
+
if (delimiter2.type === "closer") {
|
|
336
|
+
closerDelimiter = delimiter2;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (closerDelimiter == null)
|
|
341
|
+
return;
|
|
342
|
+
delimiter = {
|
|
343
|
+
type: "full",
|
|
344
|
+
startIndex: openerDelimiter.startIndex,
|
|
345
|
+
endIndex: closerDelimiter.endIndex,
|
|
346
|
+
thickness: closerDelimiter.endIndex - closerDelimiter.startIndex
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function processSingleDelimiter(delimiter) {
|
|
351
|
+
const token = {
|
|
352
|
+
nodeType: SlackUserMentionType,
|
|
353
|
+
startIndex: delimiter.startIndex,
|
|
354
|
+
endIndex: delimiter.endIndex,
|
|
355
|
+
thickness: delimiter.thickness
|
|
356
|
+
};
|
|
357
|
+
return [token];
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// src/utils/markdown_parser/tokenizers/slack_user_mention/parse.ts
|
|
362
|
+
import { calcStringFromNodePoints } from "@yozora/character";
|
|
363
|
+
var parse = function(api) {
|
|
364
|
+
return {
|
|
365
|
+
parse: (tokens) => tokens.map((token) => {
|
|
366
|
+
const nodePoints = api.getNodePoints();
|
|
367
|
+
let startIndex = token.startIndex + 2;
|
|
368
|
+
let endIndex = token.endIndex - 1;
|
|
369
|
+
const value = calcStringFromNodePoints(nodePoints, startIndex, endIndex);
|
|
370
|
+
const node = api.shouldReservePosition ? { type: SlackUserMentionType, position: api.calcPosition(token), value } : { type: SlackUserMentionType, value };
|
|
371
|
+
return node;
|
|
372
|
+
})
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
// src/utils/markdown_parser/tokenizers/slack_user_mention/tokenizer.ts
|
|
377
|
+
var SlackUserMentionTokenizer = class extends BaseInlineTokenizer {
|
|
378
|
+
constructor(props = {}) {
|
|
379
|
+
super({
|
|
380
|
+
name: SlackUserMentionType,
|
|
381
|
+
priority: props.priority || TokenizerPriority.ATOMIC
|
|
67
382
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
383
|
+
this.match = match;
|
|
384
|
+
this.parse = parse;
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/utils/markdown_parser/tokenizers/slack_channel_mention/tokenizer.ts
|
|
389
|
+
import { BaseInlineTokenizer as BaseInlineTokenizer2, TokenizerPriority as TokenizerPriority2 } from "@yozora/core-tokenizer";
|
|
390
|
+
|
|
391
|
+
// src/utils/markdown_parser/tokenizers/slack_channel_mention/match.ts
|
|
392
|
+
import { AsciiCodePoint as AsciiCodePoint2 } from "@yozora/character";
|
|
393
|
+
import { eatOptionalCharacters as eatOptionalCharacters2 } from "@yozora/core-tokenizer";
|
|
394
|
+
|
|
395
|
+
// src/utils/markdown_parser/tokenizers/slack_channel_mention/types.ts
|
|
396
|
+
var SlackChannelMentionType = "slack_channel_mention";
|
|
397
|
+
|
|
398
|
+
// src/utils/markdown_parser/tokenizers/slack_channel_mention/match.ts
|
|
399
|
+
var match2 = function(api) {
|
|
400
|
+
return { findDelimiter, processSingleDelimiter };
|
|
401
|
+
function* findDelimiter() {
|
|
402
|
+
var _a, _b;
|
|
403
|
+
const nodePoints = api.getNodePoints();
|
|
404
|
+
const blockStartIndex = api.getBlockStartIndex();
|
|
405
|
+
const blockEndIndex = api.getBlockEndIndex();
|
|
406
|
+
const potentialDelimiters = [];
|
|
407
|
+
for (let i = blockStartIndex; i < blockEndIndex; ++i) {
|
|
408
|
+
const c = (_a = nodePoints[i]) == null ? void 0 : _a.codePoint;
|
|
409
|
+
if (c === AsciiCodePoint2.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === AsciiCodePoint2.NUMBER_SIGN) {
|
|
410
|
+
const j = eatOptionalCharacters2(nodePoints, i + 2, blockEndIndex, AsciiCodePoint2.AT_SIGN);
|
|
411
|
+
if (j < blockEndIndex) {
|
|
412
|
+
potentialDelimiters.push({
|
|
413
|
+
type: "opener",
|
|
414
|
+
startIndex: i,
|
|
415
|
+
endIndex: j
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
} else if (c === AsciiCodePoint2.CLOSE_ANGLE) {
|
|
419
|
+
potentialDelimiters.push({
|
|
420
|
+
type: "closer",
|
|
421
|
+
startIndex: i,
|
|
422
|
+
endIndex: i + 1
|
|
423
|
+
});
|
|
92
424
|
}
|
|
93
|
-
// ...(hooks.date && { date: hooks.date }),
|
|
94
|
-
// ...(hooks.usergroup && { usergroup: hooks.usergroup }),
|
|
95
425
|
}
|
|
96
|
-
|
|
97
|
-
|
|
426
|
+
let pIndex = 0;
|
|
427
|
+
let lastEndIndex = -1;
|
|
428
|
+
let delimiter = null;
|
|
429
|
+
while (pIndex < potentialDelimiters.length) {
|
|
430
|
+
const [startIndex, endIndex] = yield delimiter;
|
|
431
|
+
if (lastEndIndex === endIndex) {
|
|
432
|
+
if (delimiter == null || delimiter.startIndex >= startIndex)
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
lastEndIndex = endIndex;
|
|
436
|
+
let openerDelimiter = null;
|
|
437
|
+
let closerDelimiter = null;
|
|
438
|
+
for (; pIndex < potentialDelimiters.length; ++pIndex) {
|
|
439
|
+
const delimiter2 = potentialDelimiters[pIndex];
|
|
440
|
+
if (delimiter2.startIndex >= startIndex && delimiter2.type !== "closer") {
|
|
441
|
+
openerDelimiter = delimiter2;
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
for (let i = pIndex + 1; i < potentialDelimiters.length; ++i) {
|
|
446
|
+
const delimiter2 = potentialDelimiters[i];
|
|
447
|
+
if (delimiter2.type === "closer") {
|
|
448
|
+
closerDelimiter = delimiter2;
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (closerDelimiter == null)
|
|
453
|
+
return;
|
|
454
|
+
delimiter = {
|
|
455
|
+
type: "full",
|
|
456
|
+
startIndex: openerDelimiter.startIndex,
|
|
457
|
+
endIndex: closerDelimiter.endIndex,
|
|
458
|
+
thickness: closerDelimiter.endIndex - closerDelimiter.startIndex
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function processSingleDelimiter(delimiter) {
|
|
463
|
+
const token = {
|
|
464
|
+
nodeType: SlackChannelMentionType,
|
|
465
|
+
startIndex: delimiter.startIndex,
|
|
466
|
+
endIndex: delimiter.endIndex,
|
|
467
|
+
thickness: delimiter.thickness
|
|
468
|
+
};
|
|
469
|
+
return [token];
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
// src/utils/markdown_parser/tokenizers/slack_channel_mention/parse.ts
|
|
474
|
+
import { calcStringFromNodePoints as calcStringFromNodePoints2 } from "@yozora/character";
|
|
475
|
+
var parse2 = function(api) {
|
|
476
|
+
return {
|
|
477
|
+
parse: (tokens) => tokens.map((token) => {
|
|
478
|
+
const nodePoints = api.getNodePoints();
|
|
479
|
+
let startIndex = token.startIndex + 2;
|
|
480
|
+
let endIndex = token.endIndex - 1;
|
|
481
|
+
const value = calcStringFromNodePoints2(nodePoints, startIndex, endIndex);
|
|
482
|
+
const node = api.shouldReservePosition ? { type: SlackChannelMentionType, position: api.calcPosition(token), value } : { type: SlackChannelMentionType, value };
|
|
483
|
+
return node;
|
|
484
|
+
})
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// src/utils/markdown_parser/tokenizers/slack_channel_mention/tokenizer.ts
|
|
489
|
+
var SlackChannelMentionTokenizer = class extends BaseInlineTokenizer2 {
|
|
490
|
+
constructor(props = {}) {
|
|
491
|
+
super({
|
|
492
|
+
name: SlackChannelMentionType,
|
|
493
|
+
priority: props.priority || TokenizerPriority2.ATOMIC
|
|
494
|
+
});
|
|
495
|
+
this.match = match2;
|
|
496
|
+
this.parse = parse2;
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
// src/utils/markdown_parser/tokenizers/slack_user_group_mention/tokenizer.ts
|
|
501
|
+
import { BaseInlineTokenizer as BaseInlineTokenizer3, TokenizerPriority as TokenizerPriority3 } from "@yozora/core-tokenizer";
|
|
502
|
+
|
|
503
|
+
// src/utils/markdown_parser/tokenizers/slack_user_group_mention/match.ts
|
|
504
|
+
import { AsciiCodePoint as AsciiCodePoint3 } from "@yozora/character";
|
|
505
|
+
import { eatOptionalCharacters as eatOptionalCharacters3 } from "@yozora/core-tokenizer";
|
|
506
|
+
|
|
507
|
+
// src/utils/markdown_parser/tokenizers/slack_user_group_mention/types.ts
|
|
508
|
+
var SlackUserGroupMentionType = "slack_user_group_mention";
|
|
509
|
+
|
|
510
|
+
// src/utils/markdown_parser/tokenizers/slack_user_group_mention/match.ts
|
|
511
|
+
var match3 = function(api) {
|
|
512
|
+
return { findDelimiter, processSingleDelimiter };
|
|
513
|
+
function* findDelimiter() {
|
|
514
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
515
|
+
const nodePoints = api.getNodePoints();
|
|
516
|
+
const blockStartIndex = api.getBlockStartIndex();
|
|
517
|
+
const blockEndIndex = api.getBlockEndIndex();
|
|
518
|
+
const potentialDelimiters = [];
|
|
519
|
+
for (let i = blockStartIndex; i < blockEndIndex; ++i) {
|
|
520
|
+
const c = (_a = nodePoints[i]) == null ? void 0 : _a.codePoint;
|
|
521
|
+
if (c === AsciiCodePoint3.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === AsciiCodePoint3.EXCLAMATION_MARK && ((_c = nodePoints[i + 2]) == null ? void 0 : _c.codePoint) === AsciiCodePoint3.LOWERCASE_S && ((_d = nodePoints[i + 3]) == null ? void 0 : _d.codePoint) === AsciiCodePoint3.LOWERCASE_U && ((_e = nodePoints[i + 4]) == null ? void 0 : _e.codePoint) === AsciiCodePoint3.LOWERCASE_B && ((_f = nodePoints[i + 5]) == null ? void 0 : _f.codePoint) === AsciiCodePoint3.LOWERCASE_T && ((_g = nodePoints[i + 6]) == null ? void 0 : _g.codePoint) === AsciiCodePoint3.LOWERCASE_E && ((_h = nodePoints[i + 7]) == null ? void 0 : _h.codePoint) === AsciiCodePoint3.LOWERCASE_A && ((_i = nodePoints[i + 8]) == null ? void 0 : _i.codePoint) === AsciiCodePoint3.LOWERCASE_M && ((_j = nodePoints[i + 9]) == null ? void 0 : _j.codePoint) === AsciiCodePoint3.CARET) {
|
|
522
|
+
const j = eatOptionalCharacters3(nodePoints, i + 10, blockEndIndex, AsciiCodePoint3.CARET);
|
|
523
|
+
if (j < blockEndIndex) {
|
|
524
|
+
potentialDelimiters.push({
|
|
525
|
+
type: "opener",
|
|
526
|
+
startIndex: i,
|
|
527
|
+
endIndex: j
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
} else if (c === AsciiCodePoint3.CLOSE_ANGLE) {
|
|
531
|
+
potentialDelimiters.push({
|
|
532
|
+
type: "closer",
|
|
533
|
+
startIndex: i,
|
|
534
|
+
endIndex: i + 1
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
let pIndex = 0;
|
|
539
|
+
let lastEndIndex = -1;
|
|
540
|
+
let delimiter = null;
|
|
541
|
+
while (pIndex < potentialDelimiters.length) {
|
|
542
|
+
const [startIndex, endIndex] = yield delimiter;
|
|
543
|
+
if (lastEndIndex === endIndex) {
|
|
544
|
+
if (delimiter == null || delimiter.startIndex >= startIndex)
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
lastEndIndex = endIndex;
|
|
548
|
+
let openerDelimiter = null;
|
|
549
|
+
let closerDelimiter = null;
|
|
550
|
+
for (; pIndex < potentialDelimiters.length; ++pIndex) {
|
|
551
|
+
const delimiter2 = potentialDelimiters[pIndex];
|
|
552
|
+
if (delimiter2.startIndex >= startIndex && delimiter2.type !== "closer") {
|
|
553
|
+
openerDelimiter = delimiter2;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
for (let i = pIndex + 1; i < potentialDelimiters.length; ++i) {
|
|
558
|
+
const delimiter2 = potentialDelimiters[i];
|
|
559
|
+
if (delimiter2.type === "closer") {
|
|
560
|
+
closerDelimiter = delimiter2;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (closerDelimiter == null)
|
|
565
|
+
return;
|
|
566
|
+
delimiter = {
|
|
567
|
+
type: "full",
|
|
568
|
+
startIndex: openerDelimiter.startIndex,
|
|
569
|
+
endIndex: closerDelimiter.endIndex,
|
|
570
|
+
thickness: closerDelimiter.endIndex - closerDelimiter.startIndex
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
function processSingleDelimiter(delimiter) {
|
|
575
|
+
const token = {
|
|
576
|
+
nodeType: SlackUserGroupMentionType,
|
|
577
|
+
startIndex: delimiter.startIndex,
|
|
578
|
+
endIndex: delimiter.endIndex,
|
|
579
|
+
thickness: delimiter.thickness
|
|
580
|
+
};
|
|
581
|
+
return [token];
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
// src/utils/markdown_parser/tokenizers/slack_user_group_mention/parse.ts
|
|
586
|
+
import { calcStringFromNodePoints as calcStringFromNodePoints3 } from "@yozora/character";
|
|
587
|
+
var parse3 = function(api) {
|
|
588
|
+
return {
|
|
589
|
+
parse: (tokens) => tokens.map((token) => {
|
|
590
|
+
const nodePoints = api.getNodePoints();
|
|
591
|
+
let startIndex = token.startIndex + 10;
|
|
592
|
+
let endIndex = token.endIndex - 1;
|
|
593
|
+
const value = calcStringFromNodePoints3(nodePoints, startIndex, endIndex);
|
|
594
|
+
const node = api.shouldReservePosition ? { type: SlackUserGroupMentionType, position: api.calcPosition(token), value } : { type: SlackUserGroupMentionType, value };
|
|
595
|
+
return node;
|
|
596
|
+
})
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
// src/utils/markdown_parser/tokenizers/slack_user_group_mention/tokenizer.ts
|
|
601
|
+
var SlackUserGroupMentionTokenizer = class extends BaseInlineTokenizer3 {
|
|
602
|
+
constructor(props = {}) {
|
|
603
|
+
super({
|
|
604
|
+
name: SlackUserGroupMentionType,
|
|
605
|
+
priority: props.priority || TokenizerPriority3.ATOMIC
|
|
606
|
+
});
|
|
607
|
+
this.match = match3;
|
|
608
|
+
this.parse = parse3;
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
// src/utils/markdown_parser/tokenizers/slack_broadcast/tokenizer.ts
|
|
613
|
+
import { BaseInlineTokenizer as BaseInlineTokenizer4, TokenizerPriority as TokenizerPriority4 } from "@yozora/core-tokenizer";
|
|
614
|
+
|
|
615
|
+
// src/utils/markdown_parser/tokenizers/slack_broadcast/match.ts
|
|
616
|
+
import { AsciiCodePoint as AsciiCodePoint4 } from "@yozora/character";
|
|
617
|
+
|
|
618
|
+
// src/utils/markdown_parser/tokenizers/slack_broadcast/types.ts
|
|
619
|
+
var SlackBroadcastType = "slack_broadcast";
|
|
620
|
+
|
|
621
|
+
// src/utils/markdown_parser/tokenizers/slack_broadcast/match.ts
|
|
622
|
+
var match4 = function(api) {
|
|
623
|
+
return { findDelimiter, processSingleDelimiter };
|
|
624
|
+
function* findDelimiter() {
|
|
625
|
+
var _a;
|
|
626
|
+
const nodePoints = api.getNodePoints();
|
|
627
|
+
const blockStartIndex = api.getBlockStartIndex();
|
|
628
|
+
const blockEndIndex = api.getBlockEndIndex();
|
|
629
|
+
const targets = ["@everyone", "@here", "@channel"];
|
|
630
|
+
const potentialDelimiters = [];
|
|
631
|
+
for (let i = blockStartIndex; i < blockEndIndex; ++i) {
|
|
632
|
+
if (((_a = nodePoints[i]) == null ? void 0 : _a.codePoint) === AsciiCodePoint4.AT_SIGN) {
|
|
633
|
+
for (const target of targets) {
|
|
634
|
+
if (matchTarget(nodePoints, i, target)) {
|
|
635
|
+
potentialDelimiters.push({
|
|
636
|
+
type: "full",
|
|
637
|
+
startIndex: i,
|
|
638
|
+
endIndex: i + target.length,
|
|
639
|
+
thickness: target.length
|
|
640
|
+
});
|
|
641
|
+
i += target.length - 1;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
let pIndex = 0;
|
|
648
|
+
let lastEndIndex = -1;
|
|
649
|
+
let currentDelimiter = null;
|
|
650
|
+
while (pIndex < potentialDelimiters.length) {
|
|
651
|
+
const [startIndex, endIndex] = yield currentDelimiter;
|
|
652
|
+
if (lastEndIndex === endIndex) {
|
|
653
|
+
if (currentDelimiter == null || currentDelimiter.startIndex >= startIndex)
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
lastEndIndex = endIndex;
|
|
657
|
+
for (; pIndex < potentialDelimiters.length; ++pIndex) {
|
|
658
|
+
const delimiter = potentialDelimiters[pIndex];
|
|
659
|
+
if (delimiter.startIndex >= startIndex) {
|
|
660
|
+
currentDelimiter = {
|
|
661
|
+
type: "full",
|
|
662
|
+
startIndex: delimiter.startIndex,
|
|
663
|
+
endIndex: delimiter.endIndex,
|
|
664
|
+
thickness: delimiter.thickness
|
|
665
|
+
};
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function matchTarget(nodePoints, startIndex, target) {
|
|
672
|
+
var _a;
|
|
673
|
+
for (let j = 0; j < target.length; ++j) {
|
|
674
|
+
if (((_a = nodePoints[startIndex + j]) == null ? void 0 : _a.codePoint) !== target.charCodeAt(j)) {
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
function processSingleDelimiter(delimiter) {
|
|
681
|
+
const token = {
|
|
682
|
+
nodeType: SlackBroadcastType,
|
|
683
|
+
startIndex: delimiter.startIndex,
|
|
684
|
+
endIndex: delimiter.endIndex,
|
|
685
|
+
thickness: delimiter.thickness
|
|
686
|
+
};
|
|
687
|
+
return [token];
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
// src/utils/markdown_parser/tokenizers/slack_broadcast/parse.ts
|
|
692
|
+
import { calcStringFromNodePoints as calcStringFromNodePoints4 } from "@yozora/character";
|
|
693
|
+
var parse4 = function(api) {
|
|
694
|
+
return {
|
|
695
|
+
parse: (tokens) => tokens.map((token) => {
|
|
696
|
+
const nodePoints = api.getNodePoints();
|
|
697
|
+
let startIndex = token.startIndex + 1;
|
|
698
|
+
let endIndex = token.endIndex;
|
|
699
|
+
const value = calcStringFromNodePoints4(nodePoints, startIndex, endIndex);
|
|
700
|
+
const node = api.shouldReservePosition ? { type: SlackBroadcastType, position: api.calcPosition(token), value } : { type: SlackBroadcastType, value };
|
|
701
|
+
return node;
|
|
702
|
+
})
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
// src/utils/markdown_parser/tokenizers/slack_broadcast/tokenizer.ts
|
|
707
|
+
var SlackBroadcastTokenizer = class extends BaseInlineTokenizer4 {
|
|
708
|
+
constructor(props = {}) {
|
|
709
|
+
super({
|
|
710
|
+
name: SlackBroadcastType,
|
|
711
|
+
priority: props.priority || TokenizerPriority4.ATOMIC
|
|
712
|
+
});
|
|
713
|
+
this.match = match4;
|
|
714
|
+
this.parse = parse4;
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
// src/utils/markdown_parser/parser.tsx
|
|
719
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
720
|
+
var parser = new YozoraParser().unmountTokenizer("@yozora/tokenizer-list").useTokenizer(new SlackUserMentionTokenizer()).useTokenizer(new SlackChannelMentionTokenizer()).useTokenizer(new SlackUserGroupMentionTokenizer()).useTokenizer(new SlackBroadcastTokenizer());
|
|
721
|
+
var markdown_parser = (markdown, options) => {
|
|
722
|
+
if (!markdown)
|
|
723
|
+
return null;
|
|
724
|
+
let text_string = markdown;
|
|
725
|
+
text_string = text_string.replace(/```/g, `
|
|
726
|
+
\`\`\`
|
|
727
|
+
`);
|
|
728
|
+
text_string = text_string.replace(new RegExp("(?<!\\*)\\*(?!\\*)([^*]+)\\*(?!\\*)", "g"), "**$1**");
|
|
729
|
+
text_string = text_string.replace(new RegExp("(?<!~)~(?!~)([^~]+)~(?!~)", "g"), "~~$1~~");
|
|
730
|
+
text_string = text_string.replace(/<([^|>]+)\|([^>]+)>/g, "[$2]($1)");
|
|
731
|
+
text_string = text_string.replace(/\n\n/g, "[[DOUBLE_LINE_BREAK]]");
|
|
732
|
+
text_string = text_string.replace(/<!here>/g, "@here");
|
|
733
|
+
text_string = text_string.replace(/<!everyone>/g, "@everyone");
|
|
734
|
+
text_string = text_string.replace(/<!channel>/g, "@channel");
|
|
735
|
+
const parsed_data = parser.parse(text_string);
|
|
736
|
+
const elements = parsed_data.children;
|
|
737
|
+
return /* @__PURE__ */ jsx14("div", { children: elements.map((element, i) => {
|
|
738
|
+
if (element.type === "paragraph")
|
|
739
|
+
return /* @__PURE__ */ jsx14(Paragraph, { element }, i);
|
|
740
|
+
if (element.type === "blockquote")
|
|
741
|
+
return /* @__PURE__ */ jsx14(Blockquote, { element }, i);
|
|
742
|
+
if (element.type === "code")
|
|
743
|
+
return /* @__PURE__ */ jsx14(Code, { element }, i);
|
|
744
|
+
return null;
|
|
745
|
+
}) });
|
|
98
746
|
};
|
|
99
747
|
|
|
100
748
|
// src/utils/is_accessory_stacked.ts
|
|
@@ -147,21 +795,21 @@ var is_accessory_stacked = (element) => {
|
|
|
147
795
|
};
|
|
148
796
|
|
|
149
797
|
// src/header.tsx
|
|
150
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
798
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
151
799
|
var Header = (props) => {
|
|
152
800
|
const { name, time } = props;
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex gap-[5px] items-center w-full slack_blocks_to_jsx--header", children: [
|
|
802
|
+
/* @__PURE__ */ jsx15("h3", { className: "font-black text-[15px]", children: name }),
|
|
803
|
+
/* @__PURE__ */ jsx15("div", { className: "h-[14px] w-[27px] leading-[12.5px] py-[1px] px-[3px] uppercase text-[10px] text-black-primary/[0.7] bg-black-primary/[0.13] font-semibold rounded-[2px] text-center", children: "APP" }),
|
|
804
|
+
/* @__PURE__ */ jsx15("div", { className: "text-xs text-black-secondary uppercase leading-[17.6px]", children: dateToTime(time) })
|
|
157
805
|
] });
|
|
158
806
|
};
|
|
159
807
|
|
|
160
808
|
// src/components/elements/image_element.tsx
|
|
161
|
-
import { jsx as
|
|
809
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
162
810
|
var ImageElement = (props) => {
|
|
163
811
|
const { alt_text, image_url } = props.data;
|
|
164
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsx16("div", { className: "relative", children: /* @__PURE__ */ jsx16(
|
|
165
813
|
"img",
|
|
166
814
|
{
|
|
167
815
|
src: image_url,
|
|
@@ -171,32 +819,8 @@ var ImageElement = (props) => {
|
|
|
171
819
|
) });
|
|
172
820
|
};
|
|
173
821
|
|
|
174
|
-
// src/store/useGlobalData.ts
|
|
175
|
-
import { create } from "zustand";
|
|
176
|
-
var useBearStore = create((set) => ({
|
|
177
|
-
users: [],
|
|
178
|
-
channels: [],
|
|
179
|
-
user_groups: [],
|
|
180
|
-
hooks: {},
|
|
181
|
-
setUsers: (users) => set({ users }),
|
|
182
|
-
setChannels: (channels) => set({ channels }),
|
|
183
|
-
setHooks: (hooks) => set({ hooks })
|
|
184
|
-
}));
|
|
185
|
-
var useGlobalData = () => {
|
|
186
|
-
const { users, channels, user_groups, hooks, setChannels, setUsers, setHooks } = useBearStore();
|
|
187
|
-
return {
|
|
188
|
-
users,
|
|
189
|
-
channels,
|
|
190
|
-
user_groups,
|
|
191
|
-
hooks,
|
|
192
|
-
setChannels,
|
|
193
|
-
setUsers,
|
|
194
|
-
setHooks
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
|
|
198
822
|
// src/components/composition_objects/text_object.tsx
|
|
199
|
-
import { jsx as
|
|
823
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
200
824
|
var TextObject = (props) => {
|
|
201
825
|
const { type, text, emoji, verbatim = false } = props.data;
|
|
202
826
|
const { className = "" } = props;
|
|
@@ -204,15 +828,15 @@ var TextObject = (props) => {
|
|
|
204
828
|
let emoji_parsed = type == "mrkdwn" ? parseEmojis(text) : emoji === false ? text : parseEmojis(text);
|
|
205
829
|
emoji_parsed = emoji_parsed.replace(/>/g, "> ").replace(/</g, "<");
|
|
206
830
|
if (type === "plain_text")
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
return /* @__PURE__ */
|
|
831
|
+
return /* @__PURE__ */ jsx17("div", { className, children: markdown_parser(emoji_parsed, { markdown: false, users, channels, hooks }) });
|
|
832
|
+
return /* @__PURE__ */ jsx17("div", { className, children: markdown_parser(emoji_parsed, { markdown: true, users, channels, hooks }) });
|
|
209
833
|
};
|
|
210
834
|
|
|
211
835
|
// src/components/elements/button_element.tsx
|
|
212
|
-
import { jsx as
|
|
836
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
213
837
|
var ButtonElement = (props) => {
|
|
214
838
|
const { text, action_id, url, style, accessibility_label } = props.data;
|
|
215
|
-
return /* @__PURE__ */
|
|
839
|
+
return /* @__PURE__ */ jsx18(
|
|
216
840
|
"button",
|
|
217
841
|
{
|
|
218
842
|
type: "button",
|
|
@@ -224,14 +848,14 @@ var ButtonElement = (props) => {
|
|
|
224
848
|
window.open(url, "_blank");
|
|
225
849
|
}
|
|
226
850
|
},
|
|
227
|
-
children: /* @__PURE__ */
|
|
851
|
+
children: /* @__PURE__ */ jsx18(TextObject, { data: text })
|
|
228
852
|
}
|
|
229
853
|
);
|
|
230
854
|
};
|
|
231
855
|
|
|
232
856
|
// src/components/elements/static_select_element.tsx
|
|
233
857
|
import { useEffect, useState } from "react";
|
|
234
|
-
import { jsx as
|
|
858
|
+
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
235
859
|
var StaticSelectElement = (props) => {
|
|
236
860
|
const {
|
|
237
861
|
action_id,
|
|
@@ -266,20 +890,20 @@ var StaticSelectElement = (props) => {
|
|
|
266
890
|
const results = option.text.text.toLowerCase().includes(search.toLowerCase());
|
|
267
891
|
return results;
|
|
268
892
|
}, []);
|
|
269
|
-
return /* @__PURE__ */
|
|
893
|
+
return /* @__PURE__ */ jsxs7(
|
|
270
894
|
"div",
|
|
271
895
|
{
|
|
272
896
|
id: action_id,
|
|
273
897
|
className: "py-1 px-2 h-7 min-h-[28px] relative flex items-center justify-between rounded text-small w-[190px] border border-black-primary.3",
|
|
274
898
|
tabIndex: 0,
|
|
275
899
|
children: [
|
|
276
|
-
visible && /* @__PURE__ */
|
|
900
|
+
visible && /* @__PURE__ */ jsx19(
|
|
277
901
|
"div",
|
|
278
902
|
{
|
|
279
903
|
className: "absolute top-[24px] -left-3 bg-white-secondary border border-gray-primary rounded-[6px] shadow-custom_shadow-1 w-[322px] max-w-[322px] max-h-[240px] overflow-auto py-3 z-20",
|
|
280
904
|
id: "static_select_popup",
|
|
281
|
-
children: /* @__PURE__ */
|
|
282
|
-
return /* @__PURE__ */
|
|
905
|
+
children: /* @__PURE__ */ jsx19("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
|
|
906
|
+
return /* @__PURE__ */ jsx19(
|
|
283
907
|
"div",
|
|
284
908
|
{
|
|
285
909
|
className: "h-7 px-6 flex items-center select-none cursor-pointer hover:bg-blue-primary hover:text-white-primary",
|
|
@@ -288,14 +912,14 @@ var StaticSelectElement = (props) => {
|
|
|
288
912
|
setVisible(false);
|
|
289
913
|
setSelected(option.value);
|
|
290
914
|
},
|
|
291
|
-
children: /* @__PURE__ */
|
|
915
|
+
children: /* @__PURE__ */ jsx19(TextObject, { data: option.text })
|
|
292
916
|
},
|
|
293
917
|
i
|
|
294
918
|
);
|
|
295
919
|
}) })
|
|
296
920
|
}
|
|
297
921
|
),
|
|
298
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ jsx19(
|
|
299
923
|
"input",
|
|
300
924
|
{
|
|
301
925
|
type: "text",
|
|
@@ -306,7 +930,7 @@ var StaticSelectElement = (props) => {
|
|
|
306
930
|
"aria-label": "Select an item"
|
|
307
931
|
}
|
|
308
932
|
),
|
|
309
|
-
!search && /* @__PURE__ */
|
|
933
|
+
!search && /* @__PURE__ */ jsx19("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ jsx19(
|
|
310
934
|
TextObject,
|
|
311
935
|
{
|
|
312
936
|
data: placeholder != null ? placeholder : {
|
|
@@ -315,7 +939,7 @@ var StaticSelectElement = (props) => {
|
|
|
315
939
|
}
|
|
316
940
|
}
|
|
317
941
|
) }),
|
|
318
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsx19(
|
|
319
943
|
"button",
|
|
320
944
|
{
|
|
321
945
|
type: "button",
|
|
@@ -324,7 +948,7 @@ var StaticSelectElement = (props) => {
|
|
|
324
948
|
onClick: () => {
|
|
325
949
|
setVisible((prev) => !prev);
|
|
326
950
|
},
|
|
327
|
-
children: /* @__PURE__ */
|
|
951
|
+
children: /* @__PURE__ */ jsx19(
|
|
328
952
|
"svg",
|
|
329
953
|
{
|
|
330
954
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -333,7 +957,7 @@ var StaticSelectElement = (props) => {
|
|
|
333
957
|
strokeWidth: "3",
|
|
334
958
|
stroke: "currentColor",
|
|
335
959
|
className: "w-3 h-3",
|
|
336
|
-
children: /* @__PURE__ */
|
|
960
|
+
children: /* @__PURE__ */ jsx19("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
|
|
337
961
|
}
|
|
338
962
|
)
|
|
339
963
|
}
|
|
@@ -345,7 +969,7 @@ var StaticSelectElement = (props) => {
|
|
|
345
969
|
|
|
346
970
|
// src/components/elements/checkboxes_element.tsx
|
|
347
971
|
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
348
|
-
import { jsx as
|
|
972
|
+
import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
349
973
|
var CheckboxesElement = (props) => {
|
|
350
974
|
const { action_id, options, focus_on_load, initial_options } = props.data;
|
|
351
975
|
const [selected, setSelected] = useState2(
|
|
@@ -359,15 +983,15 @@ var CheckboxesElement = (props) => {
|
|
|
359
983
|
input_ref.current.focus();
|
|
360
984
|
}
|
|
361
985
|
}, [focus_on_load]);
|
|
362
|
-
return /* @__PURE__ */
|
|
986
|
+
return /* @__PURE__ */ jsx20("div", { id: action_id, className: "my-1 flex w-full slack_blocks_to_jsx__checkboxes_element", children: /* @__PURE__ */ jsx20("fieldset", { className: "flex flex-col gap-2", children: options.map((option, i) => {
|
|
363
987
|
const { text, value, description } = option;
|
|
364
|
-
return /* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ jsxs8(
|
|
365
989
|
"label",
|
|
366
990
|
{
|
|
367
991
|
className: "flex cursor-pointer items-baseline gap-3 select-none",
|
|
368
992
|
htmlFor: `checkboxes-${action_id}-value-${value}-${i}`,
|
|
369
993
|
children: [
|
|
370
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20(
|
|
371
995
|
"input",
|
|
372
996
|
{
|
|
373
997
|
type: "checkbox",
|
|
@@ -383,9 +1007,9 @@ var CheckboxesElement = (props) => {
|
|
|
383
1007
|
}
|
|
384
1008
|
}
|
|
385
1009
|
) }),
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
description && /* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
1011
|
+
/* @__PURE__ */ jsx20(TextObject, { data: text }),
|
|
1012
|
+
description && /* @__PURE__ */ jsx20(TextObject, { className: "text-black-secondary", data: description })
|
|
389
1013
|
] })
|
|
390
1014
|
]
|
|
391
1015
|
}
|
|
@@ -395,7 +1019,7 @@ var CheckboxesElement = (props) => {
|
|
|
395
1019
|
|
|
396
1020
|
// src/components/elements/plain_text_input.tsx
|
|
397
1021
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
398
|
-
import { jsx as
|
|
1022
|
+
import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
399
1023
|
var PlaintTextInput = (props) => {
|
|
400
1024
|
const {
|
|
401
1025
|
action_id,
|
|
@@ -423,15 +1047,15 @@ var PlaintTextInput = (props) => {
|
|
|
423
1047
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
424
1048
|
};
|
|
425
1049
|
}, []);
|
|
426
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */ jsxs9(
|
|
427
1051
|
"div",
|
|
428
1052
|
{
|
|
429
1053
|
id: action_id,
|
|
430
1054
|
className: "relative text-small w-full slack_blocks_to_jsx__plain_text_input_element",
|
|
431
1055
|
tabIndex: 0,
|
|
432
1056
|
children: [
|
|
433
|
-
!value && placeholder && /* @__PURE__ */
|
|
434
|
-
!value && !placeholder && /* @__PURE__ */
|
|
1057
|
+
!value && placeholder && /* @__PURE__ */ jsx21("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ jsx21(TextObject, { data: placeholder }) }),
|
|
1058
|
+
!value && !placeholder && /* @__PURE__ */ jsx21("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ jsx21(
|
|
435
1059
|
TextObject,
|
|
436
1060
|
{
|
|
437
1061
|
data: {
|
|
@@ -440,7 +1064,7 @@ var PlaintTextInput = (props) => {
|
|
|
440
1064
|
}
|
|
441
1065
|
}
|
|
442
1066
|
) }),
|
|
443
|
-
/* @__PURE__ */
|
|
1067
|
+
/* @__PURE__ */ jsx21(
|
|
444
1068
|
"textarea",
|
|
445
1069
|
{
|
|
446
1070
|
value,
|
|
@@ -463,7 +1087,7 @@ var PlaintTextInput = (props) => {
|
|
|
463
1087
|
|
|
464
1088
|
// src/components/elements/users_select_element.tsx
|
|
465
1089
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
466
|
-
import { jsx as
|
|
1090
|
+
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
467
1091
|
var UsersSelectElement = (props) => {
|
|
468
1092
|
const { action_id, focus_on_load, placeholder, type, confirm, initial_user, people } = props.data;
|
|
469
1093
|
const [visible, setVisible] = useState4(focus_on_load || false);
|
|
@@ -488,20 +1112,20 @@ var UsersSelectElement = (props) => {
|
|
|
488
1112
|
const name = person.name.toLowerCase();
|
|
489
1113
|
return name.includes(search_query);
|
|
490
1114
|
}, []);
|
|
491
|
-
return /* @__PURE__ */
|
|
1115
|
+
return /* @__PURE__ */ jsxs10(
|
|
492
1116
|
"div",
|
|
493
1117
|
{
|
|
494
1118
|
id: action_id,
|
|
495
1119
|
className: "py-1 px-2 h-7 min-h-[28px] relative flex items-center justify-between rounded text-small w-[190px] border border-black-primary.3 slack_blocks_to_jsx__users_select_element",
|
|
496
1120
|
tabIndex: 0,
|
|
497
1121
|
children: [
|
|
498
|
-
visible && /* @__PURE__ */
|
|
1122
|
+
visible && /* @__PURE__ */ jsx22(
|
|
499
1123
|
"div",
|
|
500
1124
|
{
|
|
501
1125
|
className: "absolute top-[24px] -left-3 bg-white-secondary border border-gray-primary rounded-[6px] shadow-custom_shadow-1 w-[322px] max-w-[322px] max-h-[240px] overflow-auto py-3 z-20",
|
|
502
1126
|
id: "static_select_popup",
|
|
503
|
-
children: /* @__PURE__ */
|
|
504
|
-
return /* @__PURE__ */
|
|
1127
|
+
children: /* @__PURE__ */ jsx22("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
|
|
1128
|
+
return /* @__PURE__ */ jsxs10(
|
|
505
1129
|
"button",
|
|
506
1130
|
{
|
|
507
1131
|
className: "h-7 px-6 flex group items-center gap-2 select-none cursor-pointer hover:bg-blue-primary hover:text-white-primary",
|
|
@@ -512,7 +1136,7 @@ var UsersSelectElement = (props) => {
|
|
|
512
1136
|
setSelected(option.id);
|
|
513
1137
|
},
|
|
514
1138
|
children: [
|
|
515
|
-
option.image && /* @__PURE__ */
|
|
1139
|
+
option.image && /* @__PURE__ */ jsx22(
|
|
516
1140
|
"img",
|
|
517
1141
|
{
|
|
518
1142
|
src: option.image,
|
|
@@ -520,8 +1144,8 @@ var UsersSelectElement = (props) => {
|
|
|
520
1144
|
className: "w-5 h-5 rounded-md overflow-hidden"
|
|
521
1145
|
}
|
|
522
1146
|
),
|
|
523
|
-
!option.image && /* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
1147
|
+
!option.image && /* @__PURE__ */ jsx22("div", { className: "w-5 h-5 rounded-md overflow-hidden bg-gray-300 text-black-primary font-semibold flex items-center justify-center", children: /* @__PURE__ */ jsx22("span", { children: option.name[0] || "" }) }),
|
|
1148
|
+
/* @__PURE__ */ jsx22(
|
|
525
1149
|
TextObject,
|
|
526
1150
|
{
|
|
527
1151
|
data: {
|
|
@@ -530,17 +1154,17 @@ var UsersSelectElement = (props) => {
|
|
|
530
1154
|
}
|
|
531
1155
|
}
|
|
532
1156
|
),
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
option.online && /* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ jsxs10("div", { className: "relative", children: [
|
|
1158
|
+
option.online && /* @__PURE__ */ jsx22(
|
|
535
1159
|
"div",
|
|
536
1160
|
{
|
|
537
1161
|
className: `bg-green-secondary w-[9px] h-[9px] rounded-full shrink-0`
|
|
538
1162
|
}
|
|
539
1163
|
),
|
|
540
|
-
!option.online && /* @__PURE__ */
|
|
541
|
-
option.sleeping && /* @__PURE__ */
|
|
1164
|
+
!option.online && /* @__PURE__ */ jsx22("div", { className: "w-[9px] h-[9px] rounded-full border-[1.5px] shrink-0 border-black-secondary group-hover:border-white-primary" }),
|
|
1165
|
+
option.sleeping && /* @__PURE__ */ jsx22("div", { className: "absolute -top-[5px] -right-[5px] h-[10px] w-[10px] rounded-full bg-white-secondary flex justify-center z-[10] text-[8px] leading-[8px] font-semibold group-hover:bg-blue-primary", children: "z" })
|
|
542
1166
|
] }),
|
|
543
|
-
/* @__PURE__ */
|
|
1167
|
+
/* @__PURE__ */ jsx22("div", { className: "text-black-primary group-hover:text-white-primary", children: option.name })
|
|
544
1168
|
]
|
|
545
1169
|
},
|
|
546
1170
|
i
|
|
@@ -548,7 +1172,7 @@ var UsersSelectElement = (props) => {
|
|
|
548
1172
|
}) })
|
|
549
1173
|
}
|
|
550
1174
|
),
|
|
551
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ jsx22(
|
|
552
1176
|
"input",
|
|
553
1177
|
{
|
|
554
1178
|
type: "text",
|
|
@@ -560,7 +1184,7 @@ var UsersSelectElement = (props) => {
|
|
|
560
1184
|
"aria-label": "Select an item"
|
|
561
1185
|
}
|
|
562
1186
|
),
|
|
563
|
-
!search && /* @__PURE__ */
|
|
1187
|
+
!search && /* @__PURE__ */ jsx22("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ jsx22(
|
|
564
1188
|
TextObject,
|
|
565
1189
|
{
|
|
566
1190
|
data: placeholder != null ? placeholder : {
|
|
@@ -569,7 +1193,7 @@ var UsersSelectElement = (props) => {
|
|
|
569
1193
|
}
|
|
570
1194
|
}
|
|
571
1195
|
) }),
|
|
572
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ jsx22(
|
|
573
1197
|
"button",
|
|
574
1198
|
{
|
|
575
1199
|
type: "button",
|
|
@@ -578,7 +1202,7 @@ var UsersSelectElement = (props) => {
|
|
|
578
1202
|
onClick: () => {
|
|
579
1203
|
setVisible((prev) => !prev);
|
|
580
1204
|
},
|
|
581
|
-
children: /* @__PURE__ */
|
|
1205
|
+
children: /* @__PURE__ */ jsx22(
|
|
582
1206
|
"svg",
|
|
583
1207
|
{
|
|
584
1208
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -587,7 +1211,7 @@ var UsersSelectElement = (props) => {
|
|
|
587
1211
|
strokeWidth: "3",
|
|
588
1212
|
stroke: "currentColor",
|
|
589
1213
|
className: "w-3 h-3",
|
|
590
|
-
children: /* @__PURE__ */
|
|
1214
|
+
children: /* @__PURE__ */ jsx22("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
|
|
591
1215
|
}
|
|
592
1216
|
)
|
|
593
1217
|
}
|
|
@@ -598,52 +1222,52 @@ var UsersSelectElement = (props) => {
|
|
|
598
1222
|
};
|
|
599
1223
|
|
|
600
1224
|
// src/components/blocks/actions.tsx
|
|
601
|
-
import { jsx as
|
|
1225
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
602
1226
|
var Actions = (props) => {
|
|
603
1227
|
const { elements, block_id } = props.data;
|
|
604
|
-
return /* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ jsx23(
|
|
605
1229
|
"div",
|
|
606
1230
|
{
|
|
607
1231
|
id: block_id,
|
|
608
1232
|
className: "mb-2 text-primary flex w-full text-black-primary items-center slack_blocks_to_jsx__actions",
|
|
609
|
-
children: /* @__PURE__ */
|
|
1233
|
+
children: /* @__PURE__ */ jsx23("div", { className: "flex flex-wrap", children: elements.map((element, i) => {
|
|
610
1234
|
if (element.type === "button") {
|
|
611
|
-
return /* @__PURE__ */
|
|
1235
|
+
return /* @__PURE__ */ jsx23("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ jsx23(ButtonElement, { data: element }) }, i);
|
|
612
1236
|
}
|
|
613
1237
|
if (element.type === "static_select") {
|
|
614
|
-
return /* @__PURE__ */
|
|
1238
|
+
return /* @__PURE__ */ jsx23("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ jsx23(StaticSelectElement, { data: element }) }, i);
|
|
615
1239
|
}
|
|
616
|
-
return /* @__PURE__ */
|
|
1240
|
+
return /* @__PURE__ */ jsx23("div", { className: "mt-2 mr-2" }, i);
|
|
617
1241
|
}) })
|
|
618
1242
|
}
|
|
619
1243
|
);
|
|
620
1244
|
};
|
|
621
1245
|
|
|
622
1246
|
// src/components/blocks/context.tsx
|
|
623
|
-
import { jsx as
|
|
1247
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
624
1248
|
var Context = (props) => {
|
|
625
1249
|
const { elements, block_id } = props.data;
|
|
626
|
-
return /* @__PURE__ */
|
|
1250
|
+
return /* @__PURE__ */ jsx24(
|
|
627
1251
|
"div",
|
|
628
1252
|
{
|
|
629
1253
|
id: block_id,
|
|
630
1254
|
className: "my-1 text-primary flex w-full text-black-primary flex-wrap items-center overflow-hidden slack_blocks_to_jsx__context",
|
|
631
1255
|
children: elements.slice(0, 10).map((element, i) => {
|
|
632
1256
|
if (element.type !== "image") {
|
|
633
|
-
return /* @__PURE__ */
|
|
1257
|
+
return /* @__PURE__ */ jsx24("span", { className: "text-black-secondary text-small pr-3 flex items-center", children: /* @__PURE__ */ jsx24(TextObject, { data: element }) }, i);
|
|
634
1258
|
}
|
|
635
|
-
return /* @__PURE__ */
|
|
1259
|
+
return /* @__PURE__ */ jsx24("span", { children: /* @__PURE__ */ jsx24(ImageElement, { data: element }) }, i);
|
|
636
1260
|
})
|
|
637
1261
|
}
|
|
638
1262
|
);
|
|
639
1263
|
};
|
|
640
1264
|
|
|
641
1265
|
// src/components/blocks/divider.tsx
|
|
642
|
-
import { jsx as
|
|
1266
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
643
1267
|
var Divider = (props) => {
|
|
644
1268
|
const { data } = props;
|
|
645
1269
|
const { block_id } = data;
|
|
646
|
-
return /* @__PURE__ */
|
|
1270
|
+
return /* @__PURE__ */ jsx25(
|
|
647
1271
|
"div",
|
|
648
1272
|
{
|
|
649
1273
|
id: block_id,
|
|
@@ -666,23 +1290,23 @@ var Header2 = (props) => {
|
|
|
666
1290
|
|
|
667
1291
|
// src/components/blocks/image.tsx
|
|
668
1292
|
import { useState as useState5 } from "react";
|
|
669
|
-
import { jsx as
|
|
1293
|
+
import { jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
670
1294
|
var Image = (props) => {
|
|
671
1295
|
const { block_id, alt_text, image_url, image_bytes, image_height, image_width } = props.data;
|
|
672
1296
|
const [showImage, setShowImage] = useState5(true);
|
|
673
|
-
return /* @__PURE__ */
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
1297
|
+
return /* @__PURE__ */ jsxs11("div", { id: block_id, className: "my-2 flex flex-col gap-2 slack_blocks_to_jsx__image", children: [
|
|
1298
|
+
/* @__PURE__ */ jsxs11("div", { className: "text-black-secondary text-small flex gap-1 items-center", children: [
|
|
1299
|
+
/* @__PURE__ */ jsxs11("span", { children: [
|
|
676
1300
|
alt_text,
|
|
677
1301
|
image_bytes && ` (${Math.round(image_bytes / 1e3)} kB)`
|
|
678
1302
|
] }),
|
|
679
|
-
/* @__PURE__ */
|
|
1303
|
+
/* @__PURE__ */ jsx26(
|
|
680
1304
|
"button",
|
|
681
1305
|
{
|
|
682
1306
|
type: "button",
|
|
683
1307
|
className: "w-[15px] h-[15px]",
|
|
684
1308
|
onClick: () => setShowImage((prev) => !prev),
|
|
685
|
-
children: /* @__PURE__ */
|
|
1309
|
+
children: /* @__PURE__ */ jsx26(
|
|
686
1310
|
"svg",
|
|
687
1311
|
{
|
|
688
1312
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -698,7 +1322,7 @@ var Image = (props) => {
|
|
|
698
1322
|
style: {
|
|
699
1323
|
transform: showImage ? "rotate(0deg)" : "rotate(-90deg)"
|
|
700
1324
|
},
|
|
701
|
-
children: /* @__PURE__ */
|
|
1325
|
+
children: /* @__PURE__ */ jsx26(
|
|
702
1326
|
"path",
|
|
703
1327
|
{
|
|
704
1328
|
fill: "currentColor",
|
|
@@ -711,7 +1335,7 @@ var Image = (props) => {
|
|
|
711
1335
|
}
|
|
712
1336
|
)
|
|
713
1337
|
] }),
|
|
714
|
-
showImage && /* @__PURE__ */
|
|
1338
|
+
showImage && /* @__PURE__ */ jsx26("div", { className: "rounded-md overflow-hidden relative max-w-max", children: /* @__PURE__ */ jsx26(
|
|
715
1339
|
"img",
|
|
716
1340
|
{
|
|
717
1341
|
src: image_url,
|
|
@@ -726,17 +1350,17 @@ var Image = (props) => {
|
|
|
726
1350
|
};
|
|
727
1351
|
|
|
728
1352
|
// src/components/blocks/input.tsx
|
|
729
|
-
import { jsx as
|
|
1353
|
+
import { jsx as jsx27, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
730
1354
|
var Input = (props) => {
|
|
731
1355
|
const { element: given_element, label, block_id, hint, optional, type } = props.data;
|
|
732
1356
|
const element = given_element ? getElementComponent(given_element) : null;
|
|
733
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ jsx27(
|
|
734
1358
|
"div",
|
|
735
1359
|
{
|
|
736
1360
|
id: block_id,
|
|
737
1361
|
className: `mt-2 mb-1 text-primary slack_blocks_to_jsx__input flex w-full text-black-primary`,
|
|
738
|
-
children: /* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
1362
|
+
children: /* @__PURE__ */ jsx27("div", { className: "grow", children: /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2", children: [
|
|
1363
|
+
/* @__PURE__ */ jsx27(
|
|
740
1364
|
TextObject,
|
|
741
1365
|
{
|
|
742
1366
|
data: {
|
|
@@ -747,11 +1371,11 @@ var Input = (props) => {
|
|
|
747
1371
|
}
|
|
748
1372
|
}
|
|
749
1373
|
),
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
(hint || given_element.type === "plain_text_input") && /* @__PURE__ */
|
|
753
|
-
hint && /* @__PURE__ */
|
|
754
|
-
given_element.type === "plain_text_input" && /* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ jsxs12("div", { className: "mb-1 flex flex-col gap-1", children: [
|
|
1375
|
+
/* @__PURE__ */ jsx27("div", { className: "relative shrink-0", children: element }),
|
|
1376
|
+
(hint || given_element.type === "plain_text_input") && /* @__PURE__ */ jsxs12("div", { className: "text-black-secondary text-small flex gap-1", children: [
|
|
1377
|
+
hint && /* @__PURE__ */ jsx27("div", { className: "inline", children: /* @__PURE__ */ jsx27(TextObject, { data: hint }) }),
|
|
1378
|
+
given_element.type === "plain_text_input" && /* @__PURE__ */ jsx27("p", { children: "\u21B5 Please 'enter' to submit" })
|
|
755
1379
|
] })
|
|
756
1380
|
] })
|
|
757
1381
|
] }) })
|
|
@@ -760,25 +1384,30 @@ var Input = (props) => {
|
|
|
760
1384
|
};
|
|
761
1385
|
|
|
762
1386
|
// src/components/blocks/rich_text/rich_text_list_wrapper.tsx
|
|
763
|
-
import { jsx as
|
|
1387
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
764
1388
|
var RichTextListWrapper = (props) => {
|
|
765
1389
|
const _a = props, { element, children } = _a, rest = __objRest(_a, ["element", "children"]);
|
|
766
1390
|
if (element.style === "bullet") {
|
|
767
|
-
return /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ jsx28("ul", __spreadProps(__spreadValues({}, rest), { children }));
|
|
768
1392
|
}
|
|
769
|
-
return /* @__PURE__ */
|
|
1393
|
+
return /* @__PURE__ */ jsx28("ol", __spreadProps(__spreadValues({}, rest), { children }));
|
|
770
1394
|
};
|
|
771
1395
|
|
|
772
1396
|
// src/components/blocks/rich_text/rich_text_section_broadcast.tsx
|
|
773
|
-
import { jsxs as
|
|
1397
|
+
import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
774
1398
|
var RichTextSectionBroadcast = (props) => {
|
|
775
1399
|
const { range, style } = props;
|
|
776
1400
|
const { hooks } = useGlobalData();
|
|
777
|
-
|
|
778
|
-
|
|
1401
|
+
if (range === "channel" && hooks.atChannel)
|
|
1402
|
+
return /* @__PURE__ */ jsx29(Fragment7, { children: hooks.atChannel() });
|
|
1403
|
+
if (range === "everyone" && hooks.atEveryone)
|
|
1404
|
+
return /* @__PURE__ */ jsx29(Fragment7, { children: hooks.atEveryone() });
|
|
1405
|
+
if (range === "here" && hooks.atHere)
|
|
1406
|
+
return /* @__PURE__ */ jsx29(Fragment7, { children: hooks.atHere() });
|
|
1407
|
+
return /* @__PURE__ */ jsxs13(
|
|
1408
|
+
"span",
|
|
779
1409
|
{
|
|
780
1410
|
className: `
|
|
781
|
-
inline-block
|
|
782
1411
|
slack_broadcast
|
|
783
1412
|
slack_blocks_to_jsx__rich_text_section_element_broadcast
|
|
784
1413
|
${(style == null ? void 0 : style.italic) ? "italic" : ""}
|
|
@@ -786,121 +1415,122 @@ var RichTextSectionBroadcast = (props) => {
|
|
|
786
1415
|
${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
|
|
787
1416
|
`,
|
|
788
1417
|
children: [
|
|
789
|
-
|
|
790
|
-
range
|
|
791
|
-
range === "here" && (hooks.atHere ? hooks.atHere() : `@${range}`)
|
|
1418
|
+
"@",
|
|
1419
|
+
range
|
|
792
1420
|
]
|
|
793
1421
|
}
|
|
794
1422
|
);
|
|
795
1423
|
};
|
|
796
1424
|
|
|
797
1425
|
// src/components/blocks/rich_text/rich_text_section_channel.tsx
|
|
798
|
-
import { jsx as
|
|
1426
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
799
1427
|
var RichTextSectionChannel = (props) => {
|
|
800
1428
|
const { channel_id, style } = props;
|
|
801
1429
|
const { channels, hooks } = useGlobalData();
|
|
802
|
-
const channel = channels.find((u) => u.id === channel_id);
|
|
1430
|
+
const channel = channels.find((u) => u.id === channel_id || u.name === channel_id);
|
|
803
1431
|
const label = (channel == null ? void 0 : channel.name) || channel_id;
|
|
804
|
-
|
|
805
|
-
|
|
1432
|
+
if (hooks.channel)
|
|
1433
|
+
return /* @__PURE__ */ jsx30(Fragment8, { children: hooks.channel(channel || { id: channel_id, name: label }) });
|
|
1434
|
+
return /* @__PURE__ */ jsxs14(
|
|
1435
|
+
"span",
|
|
806
1436
|
{
|
|
807
|
-
"data-channel-id": channel_id,
|
|
1437
|
+
"data-channel-id": (channel == null ? void 0 : channel.id) || channel_id,
|
|
808
1438
|
className: `
|
|
809
|
-
inline-block
|
|
810
1439
|
slack_channel
|
|
811
1440
|
slack_blocks_to_jsx__rich_text_section_element_channel
|
|
812
1441
|
${(style == null ? void 0 : style.italic) ? "italic" : ""}
|
|
813
1442
|
${(style == null ? void 0 : style.strike) ? "line-through" : ""}
|
|
814
1443
|
${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
|
|
815
1444
|
`,
|
|
816
|
-
children:
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
}
|
|
821
|
-
) : `#${label}`
|
|
1445
|
+
children: [
|
|
1446
|
+
"#",
|
|
1447
|
+
label
|
|
1448
|
+
]
|
|
822
1449
|
}
|
|
823
1450
|
);
|
|
824
1451
|
};
|
|
825
1452
|
|
|
826
1453
|
// src/components/blocks/rich_text/rich_text_section_emoji.tsx
|
|
827
|
-
import { jsx as
|
|
1454
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
828
1455
|
var RichTextSectionEmoji = (props) => {
|
|
829
1456
|
const { name } = props;
|
|
830
1457
|
const { hooks } = useGlobalData();
|
|
831
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ jsx31("span", { className: "slack_blocks_to_jsx__rich_text_section_element_emoji", children: hooks.emoji ? hooks.emoji(name) : parseEmojis(`:${name}:`) });
|
|
832
1459
|
};
|
|
833
1460
|
|
|
834
1461
|
// src/components/blocks/rich_text/rich_text_section_user.tsx
|
|
835
|
-
import { jsx as
|
|
1462
|
+
import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
836
1463
|
var RichTextSectionUser = (props) => {
|
|
837
1464
|
const { user_id, style } = props;
|
|
838
1465
|
const { users, hooks } = useGlobalData();
|
|
839
|
-
const user = users.find((u) => u.id === user_id);
|
|
1466
|
+
const user = users.find((u) => u.id === user_id || u.name === user_id);
|
|
840
1467
|
const label = (user == null ? void 0 : user.name) || user_id;
|
|
841
|
-
|
|
842
|
-
|
|
1468
|
+
if (hooks.user)
|
|
1469
|
+
return /* @__PURE__ */ jsx32(Fragment9, { children: hooks.user(user || { id: user_id, name: label }) });
|
|
1470
|
+
return /* @__PURE__ */ jsxs15(
|
|
1471
|
+
"span",
|
|
843
1472
|
{
|
|
844
|
-
"data-user-id": user_id,
|
|
1473
|
+
"data-user-id": (user == null ? void 0 : user.id) || user_id,
|
|
845
1474
|
className: `
|
|
846
|
-
inline-block
|
|
847
1475
|
slack_user
|
|
848
1476
|
slack_blocks_to_jsx__rich_text_section_element_user
|
|
849
1477
|
${(style == null ? void 0 : style.italic) ? "italic" : ""}
|
|
850
1478
|
${(style == null ? void 0 : style.strike) ? "line-through" : ""}
|
|
851
1479
|
${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
|
|
852
1480
|
`,
|
|
853
|
-
children:
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
}
|
|
858
|
-
) : `@${label}`
|
|
1481
|
+
children: [
|
|
1482
|
+
"@",
|
|
1483
|
+
label
|
|
1484
|
+
]
|
|
859
1485
|
}
|
|
860
1486
|
);
|
|
861
1487
|
};
|
|
862
1488
|
|
|
863
1489
|
// src/components/blocks/rich_text/rich_text_section_user_group.tsx
|
|
864
|
-
import { jsx as
|
|
1490
|
+
import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
865
1491
|
var RichTextSectionUserGroup = (props) => {
|
|
866
1492
|
const { usergroup_id, style } = props;
|
|
867
1493
|
const { user_groups, hooks } = useGlobalData();
|
|
868
|
-
const group = user_groups.find((u) => u.id === usergroup_id);
|
|
1494
|
+
const group = user_groups.find((u) => u.id === usergroup_id || u.name === usergroup_id);
|
|
869
1495
|
const label = (group == null ? void 0 : group.name) || usergroup_id;
|
|
870
|
-
|
|
871
|
-
|
|
1496
|
+
if (hooks.usergroup)
|
|
1497
|
+
return /* @__PURE__ */ jsx33(Fragment10, { children: hooks.usergroup(group || { id: usergroup_id, name: label }) });
|
|
1498
|
+
return /* @__PURE__ */ jsxs16(
|
|
1499
|
+
"span",
|
|
872
1500
|
{
|
|
873
|
-
"data-usergroup-id": usergroup_id,
|
|
1501
|
+
"data-usergroup-id": (group == null ? void 0 : group.id) || usergroup_id,
|
|
874
1502
|
className: `
|
|
875
|
-
inline-block
|
|
876
1503
|
slack_user_group
|
|
877
1504
|
slack_blocks_to_jsx__rich_text_section_element_user_group
|
|
878
1505
|
${(style == null ? void 0 : style.italic) ? "italic" : ""}
|
|
879
1506
|
${(style == null ? void 0 : style.strike) ? "line-through" : ""}
|
|
880
1507
|
${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
|
|
881
1508
|
`,
|
|
882
|
-
children:
|
|
1509
|
+
children: [
|
|
1510
|
+
"@",
|
|
1511
|
+
label
|
|
1512
|
+
]
|
|
883
1513
|
}
|
|
884
1514
|
);
|
|
885
1515
|
};
|
|
886
1516
|
|
|
887
1517
|
// src/components/blocks/rich_text/rich_text_section.tsx
|
|
888
|
-
import { jsx as
|
|
1518
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
889
1519
|
var RichTextSectionElement = (props) => {
|
|
890
1520
|
const { element } = props;
|
|
891
1521
|
if (element.type === "user")
|
|
892
|
-
return /* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ jsx34(RichTextSectionUser, __spreadValues({}, element));
|
|
893
1523
|
if (element.type === "channel")
|
|
894
|
-
return /* @__PURE__ */
|
|
1524
|
+
return /* @__PURE__ */ jsx34(RichTextSectionChannel, __spreadValues({}, element));
|
|
895
1525
|
if (element.type === "broadcast")
|
|
896
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ jsx34(RichTextSectionBroadcast, __spreadValues({}, element));
|
|
897
1527
|
if (element.type === "emoji")
|
|
898
|
-
return /* @__PURE__ */
|
|
1528
|
+
return /* @__PURE__ */ jsx34(RichTextSectionEmoji, __spreadValues({}, element));
|
|
899
1529
|
if (element.type === "usergroup")
|
|
900
|
-
return /* @__PURE__ */
|
|
1530
|
+
return /* @__PURE__ */ jsx34(RichTextSectionUserGroup, __spreadValues({}, element));
|
|
901
1531
|
if (element.type === "text") {
|
|
902
1532
|
const { text, style } = element;
|
|
903
|
-
return /* @__PURE__ */
|
|
1533
|
+
return /* @__PURE__ */ jsx34(
|
|
904
1534
|
"span",
|
|
905
1535
|
{
|
|
906
1536
|
className: `
|
|
@@ -916,7 +1546,7 @@ var RichTextSectionElement = (props) => {
|
|
|
916
1546
|
}
|
|
917
1547
|
if (element.type === "link") {
|
|
918
1548
|
const { url, style, text } = element;
|
|
919
|
-
return /* @__PURE__ */
|
|
1549
|
+
return /* @__PURE__ */ jsx34(
|
|
920
1550
|
"a",
|
|
921
1551
|
{
|
|
922
1552
|
target: "_blank",
|
|
@@ -938,21 +1568,21 @@ var RichTextSectionElement = (props) => {
|
|
|
938
1568
|
};
|
|
939
1569
|
|
|
940
1570
|
// src/components/blocks/rich_text/rich_text.tsx
|
|
941
|
-
import { jsx as
|
|
1571
|
+
import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
942
1572
|
var RichText = (props) => {
|
|
943
1573
|
const { elements, block_id } = props.data;
|
|
944
|
-
return /* @__PURE__ */
|
|
945
|
-
return /* @__PURE__ */
|
|
1574
|
+
return /* @__PURE__ */ jsx35("div", { id: block_id, className: "slack_blocks_to_jsx__rich_text", children: elements.map((element, i) => {
|
|
1575
|
+
return /* @__PURE__ */ jsx35(Element, { element }, `${element.type}__${i}`);
|
|
946
1576
|
}) });
|
|
947
1577
|
};
|
|
948
1578
|
var Element = (props) => {
|
|
949
1579
|
const { element } = props;
|
|
950
1580
|
if (element.type === "rich_text_list") {
|
|
951
1581
|
const { elements, style, border = 0, indent, offset } = element;
|
|
952
|
-
return /* @__PURE__ */
|
|
953
|
-
border === 1 && /* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
return /* @__PURE__ */
|
|
1582
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_list_element", children: [
|
|
1583
|
+
border === 1 && /* @__PURE__ */ jsx35("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
|
|
1584
|
+
/* @__PURE__ */ jsx35(RichTextListWrapper, { element, className: `list-none`, children: elements.map((el, i) => {
|
|
1585
|
+
return /* @__PURE__ */ jsxs17(
|
|
956
1586
|
"li",
|
|
957
1587
|
{
|
|
958
1588
|
className: "flex",
|
|
@@ -960,22 +1590,22 @@ var Element = (props) => {
|
|
|
960
1590
|
marginLeft: indent ? indent > 5 ? 0 : indent * 28 + 6 + 28 : 0
|
|
961
1591
|
},
|
|
962
1592
|
children: [
|
|
963
|
-
style === "ordered" && /* @__PURE__ */
|
|
1593
|
+
style === "ordered" && /* @__PURE__ */ jsxs17("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
|
|
964
1594
|
i + 1,
|
|
965
1595
|
"."
|
|
966
1596
|
] }),
|
|
967
|
-
style === "bullet" && /* @__PURE__ */
|
|
968
|
-
(indent === void 0 || indent === 0 || indent === 3 || indent === 6) && /* @__PURE__ */
|
|
969
|
-
(indent === 1 || indent === 4 || indent === 7) && /* @__PURE__ */
|
|
970
|
-
(indent === 2 || indent === 5 || indent === 8) && /* @__PURE__ */
|
|
1597
|
+
style === "bullet" && /* @__PURE__ */ jsxs17("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
|
|
1598
|
+
(indent === void 0 || indent === 0 || indent === 3 || indent === 6) && /* @__PURE__ */ jsx35("span", { className: "w-1.5 h-1.5 rounded-full bg-current" }),
|
|
1599
|
+
(indent === 1 || indent === 4 || indent === 7) && /* @__PURE__ */ jsx35("span", { className: "w-1.5 h-1.5 rounded-full border border-current" }),
|
|
1600
|
+
(indent === 2 || indent === 5 || indent === 8) && /* @__PURE__ */ jsx35("span", { className: "w-1.5 h-1.5 rounded-[1.5px] bg-current" })
|
|
971
1601
|
] }),
|
|
972
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ jsx35(
|
|
973
1603
|
"div",
|
|
974
1604
|
{
|
|
975
1605
|
style: {
|
|
976
1606
|
marginLeft: 6
|
|
977
1607
|
},
|
|
978
|
-
children: /* @__PURE__ */
|
|
1608
|
+
children: /* @__PURE__ */ jsx35(Element, { element: el }, `${element.type}__${i}`)
|
|
979
1609
|
}
|
|
980
1610
|
)
|
|
981
1611
|
]
|
|
@@ -987,9 +1617,9 @@ var Element = (props) => {
|
|
|
987
1617
|
}
|
|
988
1618
|
if (element.type === "rich_text_preformatted") {
|
|
989
1619
|
const { elements, border } = element;
|
|
990
|
-
return /* @__PURE__ */
|
|
991
|
-
border === 1 && /* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
1620
|
+
return /* @__PURE__ */ jsxs17("code", { className: "flex gap-2 w-full slack_blocks_to_jsx__rich_text_preformatted_element", children: [
|
|
1621
|
+
border === 1 && /* @__PURE__ */ jsx35("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
|
|
1622
|
+
/* @__PURE__ */ jsx35(
|
|
993
1623
|
"pre",
|
|
994
1624
|
{
|
|
995
1625
|
className: "p-2 rounded my-1 whitespace-pre-wrap bg-gray-secondary text-xs leading-[1.50001] border grow",
|
|
@@ -998,7 +1628,7 @@ var Element = (props) => {
|
|
|
998
1628
|
wordBreak: "normal"
|
|
999
1629
|
},
|
|
1000
1630
|
children: elements.map((el, i) => {
|
|
1001
|
-
return /* @__PURE__ */
|
|
1631
|
+
return /* @__PURE__ */ jsx35(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
|
|
1002
1632
|
})
|
|
1003
1633
|
}
|
|
1004
1634
|
)
|
|
@@ -1006,88 +1636,152 @@ var Element = (props) => {
|
|
|
1006
1636
|
}
|
|
1007
1637
|
if (element.type === "rich_text_quote") {
|
|
1008
1638
|
const { elements, border } = element;
|
|
1009
|
-
return /* @__PURE__ */
|
|
1010
|
-
border === 1 && /* @__PURE__ */
|
|
1639
|
+
return /* @__PURE__ */ jsxs17("blockquote", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_quote_element", children: [
|
|
1640
|
+
border === 1 && /* @__PURE__ */ jsx35("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
|
|
1011
1641
|
elements.map((el, i) => {
|
|
1012
|
-
return /* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ jsx35(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
|
|
1013
1643
|
})
|
|
1014
1644
|
] });
|
|
1015
1645
|
}
|
|
1016
1646
|
if (element.type === "rich_text_section") {
|
|
1017
1647
|
const { elements } = element;
|
|
1018
|
-
return /* @__PURE__ */
|
|
1019
|
-
return /* @__PURE__ */
|
|
1648
|
+
return /* @__PURE__ */ jsx35("div", { className: "inline-block slack_blocks_to_jsx__rich_text_section_element", children: elements.map((el, i) => {
|
|
1649
|
+
return /* @__PURE__ */ jsx35(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
|
|
1020
1650
|
}) });
|
|
1021
1651
|
}
|
|
1022
1652
|
return null;
|
|
1023
1653
|
};
|
|
1024
1654
|
|
|
1025
1655
|
// src/components/blocks/section.tsx
|
|
1026
|
-
import { jsx as
|
|
1656
|
+
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1027
1657
|
var Section = (props) => {
|
|
1028
1658
|
const { accessory, fields, text, block_id } = props.data;
|
|
1029
1659
|
const element = accessory ? getElementComponent(accessory) : null;
|
|
1030
1660
|
const is_stacked = accessory ? is_accessory_stacked(accessory) : false;
|
|
1031
|
-
return /* @__PURE__ */
|
|
1661
|
+
return /* @__PURE__ */ jsxs18(
|
|
1032
1662
|
"div",
|
|
1033
1663
|
{
|
|
1034
1664
|
id: block_id,
|
|
1035
1665
|
className: `mt-2 mb-1 text-primary slack_blocks_to_jsx__section flex w-full text-black-primary ${is_stacked ? "flex-col" : ""}`,
|
|
1036
1666
|
children: [
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
text && /* @__PURE__ */
|
|
1039
|
-
fields && /* @__PURE__ */
|
|
1040
|
-
return /* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ jsx36("div", { className: "grow", children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-3", children: [
|
|
1668
|
+
text && /* @__PURE__ */ jsx36(TextObject, { data: text }),
|
|
1669
|
+
fields && /* @__PURE__ */ jsx36("div", { className: "grid grid-col-2 w-full", children: fields.map((field, i) => {
|
|
1670
|
+
return /* @__PURE__ */ jsx36(TextObject, { data: field }, i);
|
|
1041
1671
|
}) })
|
|
1042
1672
|
] }) }),
|
|
1043
|
-
element && is_stacked ? element : /* @__PURE__ */
|
|
1673
|
+
element && is_stacked ? element : /* @__PURE__ */ jsx36("div", { className: "ml-2 mb-1 relative shrink-0", children: element })
|
|
1044
1674
|
]
|
|
1045
1675
|
}
|
|
1046
1676
|
);
|
|
1047
1677
|
};
|
|
1048
1678
|
|
|
1049
1679
|
// src/components/blocks/video.tsx
|
|
1680
|
+
import { useState as useState6 } from "react";
|
|
1681
|
+
import { jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1050
1682
|
var Video = (props) => {
|
|
1051
|
-
const {
|
|
1052
|
-
|
|
1683
|
+
const {
|
|
1684
|
+
// thumbnail_url,
|
|
1685
|
+
// provider_icon_url,
|
|
1686
|
+
// provider_name,
|
|
1687
|
+
//
|
|
1688
|
+
alt_text,
|
|
1689
|
+
title,
|
|
1690
|
+
video_url,
|
|
1691
|
+
author_name,
|
|
1692
|
+
block_id,
|
|
1693
|
+
description,
|
|
1694
|
+
title_url,
|
|
1695
|
+
iframeProps = {}
|
|
1696
|
+
} = props.data;
|
|
1697
|
+
const [showVideo, setShowVideo] = useState6(true);
|
|
1698
|
+
return /* @__PURE__ */ jsxs19("div", { className: "py-2 slack_blocks_to_jsx__video", id: block_id, children: [
|
|
1699
|
+
author_name && /* @__PURE__ */ jsx37("div", { className: "slack_blocks_to_jsx__video_author", children: /* @__PURE__ */ jsx37("span", { className: "font-bold", children: "Manish Panwar" }) }),
|
|
1700
|
+
description && /* @__PURE__ */ jsx37("div", { className: "slack_blocks_to_jsx__video_description", children: /* @__PURE__ */ jsx37(TextObject, { data: description }) }),
|
|
1701
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-1 slack_blocks_to_jsx__video_title", children: [
|
|
1702
|
+
title_url ? /* @__PURE__ */ jsx37("a", { href: title_url, className: "text-blue-primary", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx37(TextObject, { data: title }) }) : /* @__PURE__ */ jsx37("p", { children: /* @__PURE__ */ jsx37(TextObject, { data: title }) }),
|
|
1703
|
+
/* @__PURE__ */ jsx37(
|
|
1704
|
+
"button",
|
|
1705
|
+
{
|
|
1706
|
+
type: "button",
|
|
1707
|
+
className: "w-[15px] h-[15px]",
|
|
1708
|
+
onClick: () => setShowVideo((prev) => !prev),
|
|
1709
|
+
children: /* @__PURE__ */ jsx37(
|
|
1710
|
+
"svg",
|
|
1711
|
+
{
|
|
1712
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1713
|
+
fillRule: "evenodd",
|
|
1714
|
+
clipRule: "evenodd",
|
|
1715
|
+
className: "text-blue-primary",
|
|
1716
|
+
imageRendering: "optimizeQuality",
|
|
1717
|
+
shapeRendering: "geometricPrecision",
|
|
1718
|
+
textRendering: "geometricPrecision",
|
|
1719
|
+
viewBox: "0 0 512 336.36",
|
|
1720
|
+
width: 6,
|
|
1721
|
+
height: 6,
|
|
1722
|
+
style: {
|
|
1723
|
+
transform: showVideo ? "rotate(0deg)" : "rotate(-90deg)"
|
|
1724
|
+
},
|
|
1725
|
+
children: /* @__PURE__ */ jsx37(
|
|
1726
|
+
"path",
|
|
1727
|
+
{
|
|
1728
|
+
fill: "currentColor",
|
|
1729
|
+
fillRule: "nonzero",
|
|
1730
|
+
d: "M42.47.01L469.5 0C492.96 0 512 19.04 512 42.5c0 11.07-4.23 21.15-11.17 28.72L294.18 320.97c-14.93 18.06-41.7 20.58-59.76 5.65-1.8-1.49-3.46-3.12-4.97-4.83L10.43 70.39C-4.97 52.71-3.1 25.86 14.58 10.47 22.63 3.46 32.57.02 42.47.01z"
|
|
1731
|
+
}
|
|
1732
|
+
)
|
|
1733
|
+
}
|
|
1734
|
+
)
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
] }),
|
|
1738
|
+
/* @__PURE__ */ jsx37("div", { className: "slack_blocks_to_jsx__video_container max-w-max", children: showVideo && /* @__PURE__ */ jsx37(
|
|
1739
|
+
"iframe",
|
|
1740
|
+
__spreadValues({
|
|
1741
|
+
title: alt_text,
|
|
1742
|
+
className: "max-w-[360px] bg-gray-100 w-full aspect-video",
|
|
1743
|
+
src: video_url
|
|
1744
|
+
}, iframeProps)
|
|
1745
|
+
) })
|
|
1746
|
+
] });
|
|
1053
1747
|
};
|
|
1054
1748
|
|
|
1055
1749
|
// src/components/index.tsx
|
|
1056
|
-
import { jsx as
|
|
1750
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
1057
1751
|
var getBlockComponent = (block) => {
|
|
1058
1752
|
if (block.type === "divider")
|
|
1059
|
-
return /* @__PURE__ */
|
|
1753
|
+
return /* @__PURE__ */ jsx38(Divider, { data: block });
|
|
1060
1754
|
if (block.type === "section")
|
|
1061
|
-
return /* @__PURE__ */
|
|
1755
|
+
return /* @__PURE__ */ jsx38(Section, { data: block });
|
|
1062
1756
|
if (block.type === "image")
|
|
1063
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ jsx38(Image, { data: block });
|
|
1064
1758
|
if (block.type === "context")
|
|
1065
|
-
return /* @__PURE__ */
|
|
1759
|
+
return /* @__PURE__ */ jsx38(Context, { data: block });
|
|
1066
1760
|
if (block.type === "actions")
|
|
1067
|
-
return /* @__PURE__ */
|
|
1761
|
+
return /* @__PURE__ */ jsx38(Actions, { data: block });
|
|
1068
1762
|
if (block.type === "file")
|
|
1069
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsx38(File, { data: block });
|
|
1070
1764
|
if (block.type === "header")
|
|
1071
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ jsx38(Header2, { data: block });
|
|
1072
1766
|
if (block.type === "input")
|
|
1073
|
-
return /* @__PURE__ */
|
|
1767
|
+
return /* @__PURE__ */ jsx38(Input, { data: block });
|
|
1074
1768
|
if (block.type === "video")
|
|
1075
|
-
return /* @__PURE__ */
|
|
1769
|
+
return /* @__PURE__ */ jsx38(Video, { data: block });
|
|
1076
1770
|
if (block.type === "rich_text")
|
|
1077
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ jsx38(RichText, { data: block });
|
|
1078
1772
|
return null;
|
|
1079
1773
|
};
|
|
1080
1774
|
var getElementComponent = (element) => {
|
|
1081
1775
|
if (element.type === "button")
|
|
1082
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ jsx38(ButtonElement, { data: element });
|
|
1083
1777
|
if (element.type === "checkboxes")
|
|
1084
|
-
return /* @__PURE__ */
|
|
1778
|
+
return /* @__PURE__ */ jsx38(CheckboxesElement, { data: element });
|
|
1085
1779
|
if (element.type === "image")
|
|
1086
|
-
return /* @__PURE__ */
|
|
1780
|
+
return /* @__PURE__ */ jsx38(ImageElement, { data: element });
|
|
1087
1781
|
if (element.type === "plain_text_input")
|
|
1088
|
-
return /* @__PURE__ */
|
|
1782
|
+
return /* @__PURE__ */ jsx38(PlaintTextInput, { data: element });
|
|
1089
1783
|
if (element.type === "users_select")
|
|
1090
|
-
return /* @__PURE__ */
|
|
1784
|
+
return /* @__PURE__ */ jsx38(UsersSelectElement, { data: element });
|
|
1091
1785
|
if (element.type === "datepicker")
|
|
1092
1786
|
return null;
|
|
1093
1787
|
if (element.type === "datetimepicker")
|
|
@@ -1126,15 +1820,15 @@ var getElementComponent = (element) => {
|
|
|
1126
1820
|
};
|
|
1127
1821
|
|
|
1128
1822
|
// src/block_wrapper.tsx
|
|
1129
|
-
import { jsx as
|
|
1823
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
1130
1824
|
var BlockWrapper = (props) => {
|
|
1131
1825
|
const { children } = props;
|
|
1132
|
-
return /* @__PURE__ */
|
|
1826
|
+
return /* @__PURE__ */ jsx39("div", { className: "text-base slack_blocks_to_jsx--block_wrapper break-words font-normal", children });
|
|
1133
1827
|
};
|
|
1134
1828
|
|
|
1135
1829
|
// src/message.tsx
|
|
1136
1830
|
import { useEffect as useEffect5 } from "react";
|
|
1137
|
-
import { jsx as
|
|
1831
|
+
import { jsx as jsx40, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1138
1832
|
var Message = (props) => {
|
|
1139
1833
|
const {
|
|
1140
1834
|
blocks,
|
|
@@ -1149,17 +1843,19 @@ var Message = (props) => {
|
|
|
1149
1843
|
hooks,
|
|
1150
1844
|
withoutWrapper = false
|
|
1151
1845
|
} = props;
|
|
1152
|
-
const { setChannels, setUsers, setHooks } = useGlobalData();
|
|
1846
|
+
const { setChannels, setUsers, setHooks, setUserGroups } = useGlobalData();
|
|
1153
1847
|
useEffect5(() => {
|
|
1154
1848
|
if (data == null ? void 0 : data.users)
|
|
1155
1849
|
setUsers(data.users);
|
|
1156
1850
|
if (data == null ? void 0 : data.channels)
|
|
1157
1851
|
setChannels(data.channels);
|
|
1852
|
+
if (data == null ? void 0 : data.user_groups)
|
|
1853
|
+
setUserGroups(data.user_groups);
|
|
1158
1854
|
if (hooks)
|
|
1159
1855
|
setHooks(hooks);
|
|
1160
1856
|
}, [data, hooks]);
|
|
1161
1857
|
if (withoutWrapper) {
|
|
1162
|
-
return /* @__PURE__ */
|
|
1858
|
+
return /* @__PURE__ */ jsx40(
|
|
1163
1859
|
"div",
|
|
1164
1860
|
{
|
|
1165
1861
|
id: "slack_blocks_to_jsx",
|
|
@@ -1169,18 +1865,18 @@ var Message = (props) => {
|
|
|
1169
1865
|
const element = getBlockComponent(block);
|
|
1170
1866
|
if (!element)
|
|
1171
1867
|
return null;
|
|
1172
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsx40(BlockWrapper, { children: element }, i);
|
|
1173
1869
|
})
|
|
1174
1870
|
}
|
|
1175
1871
|
);
|
|
1176
1872
|
}
|
|
1177
|
-
return /* @__PURE__ */
|
|
1873
|
+
return /* @__PURE__ */ jsx40("div", { id: "slack_blocks_to_jsx", children: /* @__PURE__ */ jsxs20(
|
|
1178
1874
|
"section",
|
|
1179
1875
|
{
|
|
1180
1876
|
className: `flex gap-2 w-full max-w-[600px] slack_blocks_to_jsx relative ${unstyled ? "styles_disabled" : "styles_enabled"} ${className}`,
|
|
1181
1877
|
style,
|
|
1182
1878
|
children: [
|
|
1183
|
-
showBlockKitDebug && /* @__PURE__ */
|
|
1879
|
+
showBlockKitDebug && /* @__PURE__ */ jsx40(
|
|
1184
1880
|
"a",
|
|
1185
1881
|
{
|
|
1186
1882
|
target: "_blank",
|
|
@@ -1192,14 +1888,14 @@ var Message = (props) => {
|
|
|
1192
1888
|
children: "Open in Slack Block Kit Builder"
|
|
1193
1889
|
}
|
|
1194
1890
|
),
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1891
|
+
/* @__PURE__ */ jsx40("div", { className: "shrink-0", children: /* @__PURE__ */ jsx40("img", { src: logo, className: "w-9 h-9", alt: name }) }),
|
|
1892
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col w-full", children: [
|
|
1893
|
+
/* @__PURE__ */ jsx40(Header, { name, time }),
|
|
1894
|
+
/* @__PURE__ */ jsx40("div", { className: "slack_blocks_to_jsx--blocks", children: blocks.map((block, i) => {
|
|
1199
1895
|
const element = getBlockComponent(block);
|
|
1200
1896
|
if (!element)
|
|
1201
1897
|
return null;
|
|
1202
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ jsx40(BlockWrapper, { children: element }, i);
|
|
1203
1899
|
}) })
|
|
1204
1900
|
] })
|
|
1205
1901
|
]
|