@nkootstra/block-kit 0.0.1 → 0.1.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/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/index-FPjJcmn3.d.ts +911 -0
- package/dist/index-gBduJdQh.d.ts +127 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10861 -0
- package/dist/index.js.map +1 -0
- package/dist/mrkdwn.d.ts +3 -0
- package/dist/mrkdwn.js +3 -0
- package/dist/parser-GbXBz4_f.js +441 -0
- package/dist/parser-GbXBz4_f.js.map +1 -0
- package/dist/server.d.ts +60 -0
- package/dist/server.js +83 -0
- package/dist/server.js.map +1 -0
- package/dist/styles.css +4820 -0
- package/dist/transport.d.ts +50 -0
- package/dist/transport.js +84 -0
- package/dist/transport.js.map +1 -0
- package/dist/web-api.d.ts +45 -0
- package/dist/web-api.js +121 -0
- package/dist/web-api.js.map +1 -0
- package/package.json +64 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/parser/ast.d.ts
|
|
3
|
+
/** Nodes produced by {@link parse}. Plain objects so they can cross any serialization boundary. */
|
|
4
|
+
type MrkdwnNode = BlockNode | InlineNode;
|
|
5
|
+
interface Root {
|
|
6
|
+
type: "root";
|
|
7
|
+
children: MrkdwnNode[];
|
|
8
|
+
}
|
|
9
|
+
type BlockNode = Preformatted | Quote;
|
|
10
|
+
/** A ``` fenced block. Content is shown verbatim, only HTML entities are decoded. */
|
|
11
|
+
interface Preformatted {
|
|
12
|
+
type: "preformatted";
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
/** Lines starting with `>`, or everything after `>>>`. */
|
|
16
|
+
interface Quote {
|
|
17
|
+
type: "quote";
|
|
18
|
+
children: InlineNode[];
|
|
19
|
+
}
|
|
20
|
+
type InlineNode = Text | Bold | Italic | Strike | Code | Link | UserMention | ChannelMention | UsergroupMention | Broadcast | DateNode | Emoji;
|
|
21
|
+
/** Plain text. May contain `\n`, which renderers should turn into line breaks. */
|
|
22
|
+
interface Text {
|
|
23
|
+
type: "text";
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
interface Bold {
|
|
27
|
+
type: "bold";
|
|
28
|
+
children: InlineNode[];
|
|
29
|
+
}
|
|
30
|
+
interface Italic {
|
|
31
|
+
type: "italic";
|
|
32
|
+
children: InlineNode[];
|
|
33
|
+
}
|
|
34
|
+
interface Strike {
|
|
35
|
+
type: "strike";
|
|
36
|
+
children: InlineNode[];
|
|
37
|
+
}
|
|
38
|
+
interface Code {
|
|
39
|
+
type: "code";
|
|
40
|
+
value: string;
|
|
41
|
+
}
|
|
42
|
+
/** `<https://example.com|label>` or an auto-linked bare URL. */
|
|
43
|
+
interface Link {
|
|
44
|
+
type: "link";
|
|
45
|
+
url: string;
|
|
46
|
+
/** Parsed label. Absent when the link has no `|label` part, in which case the URL is shown. */
|
|
47
|
+
children?: InlineNode[];
|
|
48
|
+
}
|
|
49
|
+
/** `<@U123>` or the legacy `<@U123|name>`. */
|
|
50
|
+
interface UserMention {
|
|
51
|
+
type: "user";
|
|
52
|
+
id: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
}
|
|
55
|
+
/** `<#C123>` or `<#C123|name>`. */
|
|
56
|
+
interface ChannelMention {
|
|
57
|
+
type: "channel";
|
|
58
|
+
id: string;
|
|
59
|
+
label?: string;
|
|
60
|
+
}
|
|
61
|
+
/** `<!subteam^S123>` or `<!subteam^S123|@handle>`. */
|
|
62
|
+
interface UsergroupMention {
|
|
63
|
+
type: "usergroup";
|
|
64
|
+
id: string;
|
|
65
|
+
label?: string;
|
|
66
|
+
}
|
|
67
|
+
/** `<!here>`, `<!channel>`, `<!everyone>`. */
|
|
68
|
+
interface Broadcast {
|
|
69
|
+
type: "broadcast";
|
|
70
|
+
range: "here" | "channel" | "everyone";
|
|
71
|
+
label?: string;
|
|
72
|
+
}
|
|
73
|
+
/** `<!date^1392734382^{date_short} at {time}^https://link|fallback>`. */
|
|
74
|
+
interface DateNode {
|
|
75
|
+
type: "date";
|
|
76
|
+
/** Unix timestamp in seconds. */
|
|
77
|
+
timestamp: number;
|
|
78
|
+
/** Format string with `{token}` placeholders. */
|
|
79
|
+
format: string;
|
|
80
|
+
url?: string;
|
|
81
|
+
fallback: string;
|
|
82
|
+
}
|
|
83
|
+
/** `:smile:` or `:thumbsup::skin-tone-3:`. Renderers fall back to the raw text for unknown names. */
|
|
84
|
+
interface Emoji {
|
|
85
|
+
type: "emoji";
|
|
86
|
+
name: string;
|
|
87
|
+
/** 2–6, as in Slack's `skin-tone-N` modifiers. */
|
|
88
|
+
skinTone?: number;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/parser/date.d.ts
|
|
92
|
+
interface FormatDateOptions {
|
|
93
|
+
/** BCP 47 locale. Slack formats dates in the viewer's locale. Defaults to `en-US`. */
|
|
94
|
+
locale?: string;
|
|
95
|
+
/** IANA time zone. Defaults to the runtime's zone. */
|
|
96
|
+
timeZone?: string;
|
|
97
|
+
/** Reference time for `{ago}` and the `_pretty` variants. Defaults to `Date.now()`. */
|
|
98
|
+
now?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Formats a `<!date^...>` token string the way Slack does, e.g.
|
|
102
|
+
* `formatSlackDate(1392734382, "{date_short} at {time}")` → `Feb 18, 2014 at 6:39 AM`.
|
|
103
|
+
* Unknown `{tokens}` are left as they are.
|
|
104
|
+
*/
|
|
105
|
+
declare function formatSlackDate(timestamp: number, format: string, options?: FormatDateOptions): string;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/parser/parse.d.ts
|
|
108
|
+
interface ParseOptions {
|
|
109
|
+
/**
|
|
110
|
+
* Mirrors the `verbatim` flag on Slack text objects. When `false` (Slack's default),
|
|
111
|
+
* bare URLs are turned into links. When `true`, only explicit `<...>` markup is linked.
|
|
112
|
+
*/
|
|
113
|
+
verbatim?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** Parses Slack mrkdwn into an AST. Never throws: malformed markup is kept as text. */
|
|
116
|
+
declare function parse(input: string, options?: ParseOptions): Root;
|
|
117
|
+
declare function decodeEntities(text: string): string;
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/parser/plainText.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* Converts `:name:` shortcodes in a `plain_text` object's text into emoji nodes. Plain text has no
|
|
122
|
+
* other mrkdwn formatting (no bold/links/mentions), so this only ever produces `text` and `emoji`.
|
|
123
|
+
*/
|
|
124
|
+
declare function parsePlainTextEmoji(input: string): Array<Text | Emoji>;
|
|
125
|
+
//#endregion
|
|
126
|
+
export { UserMention as C, Text as S, MrkdwnNode as _, FormatDateOptions as a, Root as b, Bold as c, Code as d, DateNode as f, Link as g, Italic as h, parse as i, Broadcast as l, InlineNode as m, ParseOptions as n, formatSlackDate as o, Emoji as p, decodeEntities as r, BlockNode as s, parsePlainTextEmoji as t, ChannelMention as u, Preformatted as v, UsergroupMention as w, Strike as x, Quote as y };
|
|
127
|
+
//# sourceMappingURL=index-gBduJdQh.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
import { $ as BlockSuggestionPayload, A as BlockAction, B as StackedView, C as SlackAttachment, Ct as BlockProps, D as elementComponents, E as SlackReaction, F as EmojiOptions, G as SurfaceScopeProps, H as SubmitResult, I as MessageApi, J as ViewsApi, K as SurfaceScopeValue, L as MessageUpdate, M as BlockKitProvider, N as BlockKitProviderProps, O as Element, P as ElementState, Q as BlockActionsPayload, R as PayloadContext, S as MessageProps, St as Blocks, T as SlackMessageLike, Tt as Json, U as Surface, V as StateValues, W as SurfaceScope, X as useContainer, Y as useBlockKit, Z as useLiveView, _ as HomeTabView, _t as buildBlockSuggestionPayload, a as Tooltip, at as MessageBlockActionsPayload, b as Message, bt as blockComponents, c as TextObject, ct as PayloadIdentity, d as ViewProps, dt as SuggestionOption, et as BuildBlockActionsPayloadOptions, f as Modal, ft as ViewBlockActionsPayload, g as HomeTabProps, gt as buildBlockActionsPayload, h as HomeTab, ht as ViewResponseAction, i as UserMentionProps, it as Container, j as BlockKitContextValue, k as ActionContext, l as AnyView, lt as PayloadTeam, m as ModalView, mt as ViewLike, n as validateView, nt as BuildViewClosedPayloadOptions, o as TooltipProps, ot as MessageContainer, p as ModalProps, pt as ViewContainer, q as UserProfile, r as UserMention, rt as BuildViewSubmissionPayloadOptions, s as Text, st as OptionsResponse, t as VALIDATION_MESSAGES, tt as BuildBlockSuggestionPayloadOptions, u as View, ut as PayloadUser, v as Mrkdwn, vt as buildViewClosedPayload, w as SlackAttachmentField, wt as ElementProps, x as MessageApp, xt as Block, y as MrkdwnProps, yt as buildViewSubmissionPayload, z as Resolvers } from "./index-FPjJcmn3.js";
|
|
3
|
+
export { type ActionContext, type AnyView, Block, type BlockAction, type BlockActionsPayload, type BlockKitContextValue, BlockKitProvider, type BlockKitProviderProps, type BlockProps, type BlockSuggestionPayload, Blocks, type BuildBlockActionsPayloadOptions, type BuildBlockSuggestionPayloadOptions, type BuildViewClosedPayloadOptions, type BuildViewSubmissionPayloadOptions, type Container, Element, type ElementProps, type ElementState, type EmojiOptions, HomeTab, type HomeTabProps, type HomeTabView, type Json, Message, type MessageApi, type MessageApp, type MessageBlockActionsPayload, type MessageContainer, type MessageProps, type MessageUpdate, Modal, type ModalProps, type ModalView, Mrkdwn, type MrkdwnProps, type OptionsResponse, type PayloadContext, type PayloadIdentity, type PayloadTeam, type PayloadUser, type Resolvers, type SlackAttachment, type SlackAttachmentField, type SlackMessageLike, type SlackReaction, type StackedView, type StateValues, type SubmitResult, type SuggestionOption, type Surface, SurfaceScope, type SurfaceScopeProps, type SurfaceScopeValue, Text, type TextObject, Tooltip, type TooltipProps, UserMention, type UserMentionProps, type UserProfile, VALIDATION_MESSAGES, View, type ViewBlockActionsPayload, type ViewContainer, type ViewLike, type ViewProps, type ViewResponseAction, type ViewsApi, blockComponents, buildBlockActionsPayload, buildBlockSuggestionPayload, buildViewClosedPayload, buildViewSubmissionPayload, elementComponents, useBlockKit, useContainer, useLiveView, validateView };
|