slack.ts 0.0.11 → 0.0.12
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/api/events/events.d.ts.map +1 -0
- package/dist/api/events/index.d.ts.map +1 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/interactive/block_actions.d.ts.map +1 -0
- package/dist/api/interactive/common.d.ts.map +1 -0
- package/dist/api/interactive/view_submission.d.ts.map +1 -0
- package/dist/api/slash/index.d.ts.map +1 -0
- package/dist/api/types/api.d.ts.map +1 -0
- package/dist/api/types/conversation.d.ts.map +1 -0
- package/dist/api/types/file.d.ts.map +1 -0
- package/dist/api/types/message.d.ts.map +1 -0
- package/dist/api/types/user.d.ts.map +1 -0
- package/dist/api/types/value.d.ts.map +1 -0
- package/dist/api/types/view.d.ts.map +1 -0
- package/dist/api/web/apps.d.ts.map +1 -0
- package/dist/api/web/auth.d.ts.map +1 -0
- package/dist/api/web/bots.d.ts.map +1 -0
- package/dist/api/web/chat.d.ts.map +1 -0
- package/dist/api/web/conversations.d.ts.map +1 -0
- package/dist/api/web/files.d.ts.map +1 -0
- package/dist/api/web/users.d.ts.map +1 -0
- package/dist/api/web/views.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/actions.d.ts +20 -0
- package/dist/blocks/actions.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/actions.js +20 -0
- package/dist/{src/blocks → blocks}/base.d.ts +24 -0
- package/dist/blocks/base.d.ts.map +1 -0
- package/dist/blocks/base.js +38 -0
- package/dist/blocks/elements/base.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/elements/button.d.ts +37 -0
- package/dist/blocks/elements/button.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/elements/button.js +37 -0
- package/dist/blocks/elements/index.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/elements/overflow.d.ts +20 -0
- package/dist/blocks/elements/overflow.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/elements/overflow.js +20 -0
- package/dist/blocks/elements/plain_text_input.d.ts +81 -0
- package/dist/blocks/elements/plain_text_input.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/elements/plain_text_input.js +54 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/input.d.ts +21 -0
- package/dist/blocks/input.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/input.js +21 -0
- package/dist/{src/blocks → blocks}/objects/confirm.d.ts +50 -0
- package/dist/blocks/objects/confirm.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/objects/confirm.js +50 -0
- package/dist/blocks/objects/index.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/objects/option.d.ts +26 -0
- package/dist/blocks/objects/option.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/objects/option.js +13 -0
- package/dist/blocks/objects/text.d.ts +116 -0
- package/dist/blocks/objects/text.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/objects/text.js +41 -0
- package/dist/{src/blocks → blocks}/section.d.ts +52 -0
- package/dist/blocks/section.d.ts.map +1 -0
- package/dist/{src/blocks → blocks}/section.js +28 -0
- package/dist/blocks/utils/extract.d.ts.map +1 -0
- package/dist/{src/client.d.ts → client.d.ts} +6 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/{src/client.js → client.js} +6 -0
- package/dist/{src/error.d.ts → error.d.ts} +12 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/{src/error.js → error.js} +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/receivers/base.d.ts.map +1 -0
- package/dist/receivers/dummy.d.ts.map +1 -0
- package/dist/receivers/fetch.d.ts.map +1 -0
- package/dist/receivers/http.d.ts.map +1 -0
- package/dist/receivers/socket.d.ts.map +1 -0
- package/dist/resources/action.d.ts.map +1 -0
- package/dist/resources/channel.d.ts.map +1 -0
- package/dist/resources/message.d.ts.map +1 -0
- package/dist/resources/modal.d.ts.map +1 -0
- package/dist/resources/slash.d.ts.map +1 -0
- package/dist/resources/submission.d.ts.map +1 -0
- package/dist/resources/user.d.ts.map +1 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/messaging.d.ts.map +1 -0
- package/dist/utils/paginate.d.ts.map +1 -0
- package/dist/utils/respond.d.ts.map +1 -0
- package/dist/utils/typing.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/scripts/add_api_methods.d.ts +0 -2
- package/dist/scripts/add_api_methods.d.ts.map +0 -1
- package/dist/scripts/add_api_methods.js +0 -30
- package/dist/src/api/events/events.d.ts.map +0 -1
- package/dist/src/api/events/index.d.ts.map +0 -1
- package/dist/src/api/index.d.ts.map +0 -1
- package/dist/src/api/interactive/block_actions.d.ts.map +0 -1
- package/dist/src/api/interactive/common.d.ts.map +0 -1
- package/dist/src/api/interactive/view_submission.d.ts.map +0 -1
- package/dist/src/api/slash/index.d.ts.map +0 -1
- package/dist/src/api/types/api.d.ts.map +0 -1
- package/dist/src/api/types/conversation.d.ts.map +0 -1
- package/dist/src/api/types/file.d.ts.map +0 -1
- package/dist/src/api/types/message.d.ts.map +0 -1
- package/dist/src/api/types/user.d.ts.map +0 -1
- package/dist/src/api/types/value.d.ts.map +0 -1
- package/dist/src/api/types/view.d.ts.map +0 -1
- package/dist/src/api/web/apps.d.ts.map +0 -1
- package/dist/src/api/web/auth.d.ts.map +0 -1
- package/dist/src/api/web/bots.d.ts.map +0 -1
- package/dist/src/api/web/chat.d.ts.map +0 -1
- package/dist/src/api/web/conversations.d.ts.map +0 -1
- package/dist/src/api/web/files.d.ts.map +0 -1
- package/dist/src/api/web/users.d.ts.map +0 -1
- package/dist/src/api/web/views.d.ts.map +0 -1
- package/dist/src/blocks/actions.d.ts.map +0 -1
- package/dist/src/blocks/base.d.ts.map +0 -1
- package/dist/src/blocks/base.js +0 -20
- package/dist/src/blocks/elements/base.d.ts.map +0 -1
- package/dist/src/blocks/elements/button.d.ts.map +0 -1
- package/dist/src/blocks/elements/index.d.ts.map +0 -1
- package/dist/src/blocks/elements/overflow.d.ts.map +0 -1
- package/dist/src/blocks/elements/plain_text_input.d.ts +0 -27
- package/dist/src/blocks/elements/plain_text_input.d.ts.map +0 -1
- package/dist/src/blocks/index.d.ts.map +0 -1
- package/dist/src/blocks/input.d.ts.map +0 -1
- package/dist/src/blocks/objects/confirm.d.ts.map +0 -1
- package/dist/src/blocks/objects/index.d.ts.map +0 -1
- package/dist/src/blocks/objects/option.d.ts.map +0 -1
- package/dist/src/blocks/objects/text.d.ts +0 -25
- package/dist/src/blocks/objects/text.d.ts.map +0 -1
- package/dist/src/blocks/section.d.ts.map +0 -1
- package/dist/src/blocks/utils/extract.d.ts.map +0 -1
- package/dist/src/client.d.ts.map +0 -1
- package/dist/src/error.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/receivers/base.d.ts.map +0 -1
- package/dist/src/receivers/dummy.d.ts.map +0 -1
- package/dist/src/receivers/fetch.d.ts.map +0 -1
- package/dist/src/receivers/http.d.ts.map +0 -1
- package/dist/src/receivers/socket.d.ts.map +0 -1
- package/dist/src/resources/action.d.ts.map +0 -1
- package/dist/src/resources/channel.d.ts.map +0 -1
- package/dist/src/resources/message.d.ts.map +0 -1
- package/dist/src/resources/modal.d.ts.map +0 -1
- package/dist/src/resources/slash.d.ts.map +0 -1
- package/dist/src/resources/submission.d.ts.map +0 -1
- package/dist/src/resources/user.d.ts.map +0 -1
- package/dist/src/utils/http.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/messaging.d.ts.map +0 -1
- package/dist/src/utils/paginate.d.ts.map +0 -1
- package/dist/src/utils/respond.d.ts.map +0 -1
- package/dist/src/utils/typing.d.ts.map +0 -1
- /package/dist/{src/api → api}/events/events.d.ts +0 -0
- /package/dist/{src/api → api}/events/events.js +0 -0
- /package/dist/{src/api → api}/events/index.d.ts +0 -0
- /package/dist/{src/api → api}/events/index.js +0 -0
- /package/dist/{src/api → api}/index.d.ts +0 -0
- /package/dist/{src/api → api}/index.js +0 -0
- /package/dist/{src/api → api}/interactive/block_actions.d.ts +0 -0
- /package/dist/{src/api → api}/interactive/block_actions.js +0 -0
- /package/dist/{src/api → api}/interactive/common.d.ts +0 -0
- /package/dist/{src/api → api}/interactive/common.js +0 -0
- /package/dist/{src/api → api}/interactive/view_submission.d.ts +0 -0
- /package/dist/{src/api → api}/interactive/view_submission.js +0 -0
- /package/dist/{src/api → api}/slash/index.d.ts +0 -0
- /package/dist/{src/api → api}/slash/index.js +0 -0
- /package/dist/{src/api → api}/types/api.d.ts +0 -0
- /package/dist/{src/api → api}/types/api.js +0 -0
- /package/dist/{src/api → api}/types/conversation.d.ts +0 -0
- /package/dist/{src/api → api}/types/conversation.js +0 -0
- /package/dist/{src/api → api}/types/file.d.ts +0 -0
- /package/dist/{src/api → api}/types/file.js +0 -0
- /package/dist/{src/api → api}/types/message.d.ts +0 -0
- /package/dist/{src/api → api}/types/message.js +0 -0
- /package/dist/{src/api → api}/types/user.d.ts +0 -0
- /package/dist/{src/api → api}/types/user.js +0 -0
- /package/dist/{src/api → api}/types/value.d.ts +0 -0
- /package/dist/{src/api → api}/types/value.js +0 -0
- /package/dist/{src/api → api}/types/view.d.ts +0 -0
- /package/dist/{src/api → api}/types/view.js +0 -0
- /package/dist/{src/api → api}/web/apps.d.ts +0 -0
- /package/dist/{src/api → api}/web/apps.js +0 -0
- /package/dist/{src/api → api}/web/auth.d.ts +0 -0
- /package/dist/{src/api → api}/web/auth.js +0 -0
- /package/dist/{src/api → api}/web/bots.d.ts +0 -0
- /package/dist/{src/api → api}/web/bots.js +0 -0
- /package/dist/{src/api → api}/web/chat.d.ts +0 -0
- /package/dist/{src/api → api}/web/chat.js +0 -0
- /package/dist/{src/api → api}/web/conversations.d.ts +0 -0
- /package/dist/{src/api → api}/web/conversations.js +0 -0
- /package/dist/{src/api → api}/web/files.d.ts +0 -0
- /package/dist/{src/api → api}/web/files.js +0 -0
- /package/dist/{src/api → api}/web/users.d.ts +0 -0
- /package/dist/{src/api → api}/web/users.js +0 -0
- /package/dist/{src/api → api}/web/views.d.ts +0 -0
- /package/dist/{src/api → api}/web/views.js +0 -0
- /package/dist/{src/blocks → blocks}/elements/base.d.ts +0 -0
- /package/dist/{src/blocks → blocks}/elements/base.js +0 -0
- /package/dist/{src/blocks → blocks}/elements/index.d.ts +0 -0
- /package/dist/{src/blocks → blocks}/elements/index.js +0 -0
- /package/dist/{src/blocks → blocks}/index.d.ts +0 -0
- /package/dist/{src/blocks → blocks}/index.js +0 -0
- /package/dist/{src/blocks → blocks}/objects/index.d.ts +0 -0
- /package/dist/{src/blocks → blocks}/objects/index.js +0 -0
- /package/dist/{src/blocks → blocks}/utils/extract.d.ts +0 -0
- /package/dist/{src/blocks → blocks}/utils/extract.js +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/receivers → receivers}/base.d.ts +0 -0
- /package/dist/{src/receivers → receivers}/base.js +0 -0
- /package/dist/{src/receivers → receivers}/dummy.d.ts +0 -0
- /package/dist/{src/receivers → receivers}/dummy.js +0 -0
- /package/dist/{src/receivers → receivers}/fetch.d.ts +0 -0
- /package/dist/{src/receivers → receivers}/fetch.js +0 -0
- /package/dist/{src/receivers → receivers}/http.d.ts +0 -0
- /package/dist/{src/receivers → receivers}/http.js +0 -0
- /package/dist/{src/receivers → receivers}/socket.d.ts +0 -0
- /package/dist/{src/receivers → receivers}/socket.js +0 -0
- /package/dist/{src/resources → resources}/action.d.ts +0 -0
- /package/dist/{src/resources → resources}/action.js +0 -0
- /package/dist/{src/resources → resources}/channel.d.ts +0 -0
- /package/dist/{src/resources → resources}/channel.js +0 -0
- /package/dist/{src/resources → resources}/message.d.ts +0 -0
- /package/dist/{src/resources → resources}/message.js +0 -0
- /package/dist/{src/resources → resources}/modal.d.ts +0 -0
- /package/dist/{src/resources → resources}/modal.js +0 -0
- /package/dist/{src/resources → resources}/slash.d.ts +0 -0
- /package/dist/{src/resources → resources}/slash.js +0 -0
- /package/dist/{src/resources → resources}/submission.d.ts +0 -0
- /package/dist/{src/resources → resources}/submission.js +0 -0
- /package/dist/{src/resources → resources}/user.d.ts +0 -0
- /package/dist/{src/resources → resources}/user.js +0 -0
- /package/dist/{src/utils → utils}/http.d.ts +0 -0
- /package/dist/{src/utils → utils}/http.js +0 -0
- /package/dist/{src/utils → utils}/index.d.ts +0 -0
- /package/dist/{src/utils → utils}/index.js +0 -0
- /package/dist/{src/utils → utils}/messaging.d.ts +0 -0
- /package/dist/{src/utils → utils}/messaging.js +0 -0
- /package/dist/{src/utils → utils}/paginate.d.ts +0 -0
- /package/dist/{src/utils → utils}/paginate.js +0 -0
- /package/dist/{src/utils → utils}/respond.d.ts +0 -0
- /package/dist/{src/utils → utils}/respond.js +0 -0
- /package/dist/{src/utils → utils}/typing.d.ts +0 -0
- /package/dist/{src/utils → utils}/typing.js +0 -0
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { ensureIsTextObjectBuilder } from "../objects/text.js";
|
|
2
2
|
import { BlockElementBuilder } from "./base.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builder for plain text input elements.
|
|
5
|
+
*
|
|
6
|
+
* Plain text input elements collect text input from users in modals and home tabs.
|
|
7
|
+
*
|
|
8
|
+
* @template ActionID The action ID type used to identify this input
|
|
9
|
+
*/
|
|
3
10
|
export class PlainTextInputBuilder extends BlockElementBuilder {
|
|
4
11
|
_multiline = false;
|
|
5
12
|
_default;
|
|
@@ -11,30 +18,72 @@ export class PlainTextInputBuilder extends BlockElementBuilder {
|
|
|
11
18
|
id(actionId) {
|
|
12
19
|
return this._id(actionId);
|
|
13
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Sets whether the input accepts multiple lines.
|
|
23
|
+
*
|
|
24
|
+
* @param multiline Whether to enable multiline input
|
|
25
|
+
* @returns This builder
|
|
26
|
+
*/
|
|
14
27
|
multiline(multiline = true) {
|
|
15
28
|
this._multiline = multiline;
|
|
16
29
|
return this;
|
|
17
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets the default value for this input.
|
|
33
|
+
*
|
|
34
|
+
* @param value The default value
|
|
35
|
+
* @returns This builder
|
|
36
|
+
*/
|
|
18
37
|
default(value) {
|
|
19
38
|
this._default = value;
|
|
20
39
|
return this;
|
|
21
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Sets whether this input should receive focus on load.
|
|
43
|
+
*
|
|
44
|
+
* @param autofocus Whether to autofocus
|
|
45
|
+
* @returns This builder
|
|
46
|
+
*/
|
|
22
47
|
autofocus(autofocus = true) {
|
|
23
48
|
this._autofocus = autofocus;
|
|
24
49
|
return this;
|
|
25
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Sets the placeholder text for this input.
|
|
53
|
+
*
|
|
54
|
+
* @param placeholder The placeholder text
|
|
55
|
+
* @returns This builder
|
|
56
|
+
*/
|
|
26
57
|
placeholder(placeholder) {
|
|
27
58
|
this._placeholder = ensureIsTextObjectBuilder(placeholder).plain();
|
|
28
59
|
return this;
|
|
29
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets the minimum length for input validation.
|
|
63
|
+
*
|
|
64
|
+
* @param minLength The minimum length
|
|
65
|
+
* @returns This builder
|
|
66
|
+
*/
|
|
30
67
|
min(minLength) {
|
|
31
68
|
this._minLength = minLength;
|
|
32
69
|
return this;
|
|
33
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets the maximum length for input validation.
|
|
73
|
+
*
|
|
74
|
+
* @param maxLength The maximum length
|
|
75
|
+
* @returns This builder
|
|
76
|
+
*/
|
|
34
77
|
max(maxLength) {
|
|
35
78
|
this._maxLength = maxLength;
|
|
36
79
|
return this;
|
|
37
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Sets dispatch actions to trigger on specific events.
|
|
83
|
+
*
|
|
84
|
+
* @param triggers The events that should trigger actions
|
|
85
|
+
* @returns This builder
|
|
86
|
+
*/
|
|
38
87
|
triggers(...triggers) {
|
|
39
88
|
this._triggers = triggers;
|
|
40
89
|
return this;
|
|
@@ -53,6 +102,11 @@ export class PlainTextInputBuilder extends BlockElementBuilder {
|
|
|
53
102
|
};
|
|
54
103
|
}
|
|
55
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates a plain text input element builder.
|
|
107
|
+
*
|
|
108
|
+
* @returns A plain text input element builder
|
|
109
|
+
*/
|
|
56
110
|
export function plainTextInput() {
|
|
57
111
|
return new PlainTextInputBuilder();
|
|
58
112
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA"}
|
|
@@ -8,14 +8,35 @@ type TypedInputBlock<Element extends InputElementBuilder, BlockID extends string
|
|
|
8
8
|
block_id: BlockID;
|
|
9
9
|
element: Element extends BlockElementBuilder<infer Output> ? Output : never;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Builder for input blocks.
|
|
13
|
+
*
|
|
14
|
+
* Input blocks contain interactive elements for collecting user input.
|
|
15
|
+
*
|
|
16
|
+
* @template Element The input element type
|
|
17
|
+
* @template HasLabel Whether a label has been set
|
|
18
|
+
* @template BlockID The block ID type
|
|
19
|
+
*/
|
|
11
20
|
export declare class InputBlockBuilder<Element extends InputElementBuilder, HasLabel extends boolean = false, BlockID extends string = string> extends BlockBuilder<TypedInputBlock<Element, BlockID>, BlockID, HasLabel> {
|
|
12
21
|
private _element;
|
|
13
22
|
private _label?;
|
|
14
23
|
constructor(_element: Element);
|
|
15
24
|
id<BlockID extends string>(blockId: BlockID): InputBlockBuilder<Element, HasLabel, BlockID>;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the label for this input block.
|
|
27
|
+
*
|
|
28
|
+
* @param text The label text
|
|
29
|
+
* @returns This builder with the label set
|
|
30
|
+
*/
|
|
16
31
|
label(text: string | TextObjectBuilder<false>): InputBlockBuilder<Element, true, BlockID>;
|
|
17
32
|
build(this: InputBlockBuilder<Element, true, BlockID>): TypedInputBlock<Element, BlockID>;
|
|
18
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates an input block builder.
|
|
36
|
+
*
|
|
37
|
+
* @param element The input element (typically a plain text input)
|
|
38
|
+
* @returns An input block builder
|
|
39
|
+
*/
|
|
19
40
|
export declare function input<Element extends InputElementBuilder>(element: Element): InputBlockBuilder<Element, false, string>;
|
|
20
41
|
export {};
|
|
21
42
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/blocks/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElF,KAAK,mBAAmB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;AAExD,KAAK,eAAe,CAAC,OAAO,SAAS,mBAAmB,EAAE,OAAO,SAAS,MAAM,IAAI,UAAU,GAAG;IAChG,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,SAAS,mBAAmB,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,KAAK,CAAA;CAC3E,CAAA;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAiB,CAC7B,OAAO,SAAS,mBAAmB,EACnC,QAAQ,SAAS,OAAO,GAAG,KAAK,EAChC,OAAO,SAAS,MAAM,GAAG,MAAM,CAC9B,SAAQ,YAAY,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC;IAG/D,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,MAAM,CAAC,CAA0B;gBAErB,QAAQ,EAAE,OAAO;IAI5B,EAAE,CAAC,OAAO,SAAS,MAAM,EACjC,OAAO,EAAE,OAAO,GACd,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;IAIhD;;;;;OAKG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;IAKhF,KAAK,CACb,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,GAC7C,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC;CAUpC;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,SAAS,mBAAmB,EAAE,OAAO,EAAE,OAAO,6CAE1E"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { SlackError } from "../error.js";
|
|
2
2
|
import { BlockBuilder } from "./base.js";
|
|
3
3
|
import { ensureIsTextObjectBuilder } from "./objects/text.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builder for input blocks.
|
|
6
|
+
*
|
|
7
|
+
* Input blocks contain interactive elements for collecting user input.
|
|
8
|
+
*
|
|
9
|
+
* @template Element The input element type
|
|
10
|
+
* @template HasLabel Whether a label has been set
|
|
11
|
+
* @template BlockID The block ID type
|
|
12
|
+
*/
|
|
4
13
|
export class InputBlockBuilder extends BlockBuilder {
|
|
5
14
|
_element;
|
|
6
15
|
_label;
|
|
@@ -11,6 +20,12 @@ export class InputBlockBuilder extends BlockBuilder {
|
|
|
11
20
|
id(blockId) {
|
|
12
21
|
return this._id(blockId);
|
|
13
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Sets the label for this input block.
|
|
25
|
+
*
|
|
26
|
+
* @param text The label text
|
|
27
|
+
* @returns This builder with the label set
|
|
28
|
+
*/
|
|
14
29
|
label(text) {
|
|
15
30
|
this._label = ensureIsTextObjectBuilder(text).plain();
|
|
16
31
|
return this;
|
|
@@ -26,6 +41,12 @@ export class InputBlockBuilder extends BlockBuilder {
|
|
|
26
41
|
};
|
|
27
42
|
}
|
|
28
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates an input block builder.
|
|
46
|
+
*
|
|
47
|
+
* @param element The input element (typically a plain text input)
|
|
48
|
+
* @returns An input block builder
|
|
49
|
+
*/
|
|
29
50
|
export function input(element) {
|
|
30
51
|
return new InputBlockBuilder(element);
|
|
31
52
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { ColorScheme, ConfirmationDialog } from "@slack/types";
|
|
2
2
|
import { Builder } from "../base.js";
|
|
3
3
|
import { type TextObjectBuilder } from "./text.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builder for confirmation dialogs.
|
|
6
|
+
*
|
|
7
|
+
* Confirmation dialogs are displayed when users interact with interactive elements and require
|
|
8
|
+
* confirmation before the action is executed.
|
|
9
|
+
*
|
|
10
|
+
* @template HasTitle Whether a title has been set
|
|
11
|
+
* @template HasText Whether text has been set
|
|
12
|
+
* @template HasConfirm Whether the confirm button text has been set
|
|
13
|
+
* @template HasDeny Whether the deny button text has been set
|
|
14
|
+
*/
|
|
4
15
|
export declare class ConfirmBuilder<HasTitle extends boolean = false, HasText extends boolean = false, HasConfirm extends boolean = false, HasDeny extends boolean = false> extends Builder<ConfirmationDialog> {
|
|
5
16
|
private _title?;
|
|
6
17
|
private _text?;
|
|
@@ -9,13 +20,52 @@ export declare class ConfirmBuilder<HasTitle extends boolean = false, HasText ex
|
|
|
9
20
|
private _style?;
|
|
10
21
|
private _brand?;
|
|
11
22
|
constructor(_title?: TextObjectBuilder<false> | undefined, _text?: TextObjectBuilder | undefined, _confirm?: TextObjectBuilder<false> | undefined, _deny?: TextObjectBuilder<false> | undefined, _style?: ColorScheme | undefined);
|
|
23
|
+
/**
|
|
24
|
+
* Sets the title for this confirmation dialog.
|
|
25
|
+
*
|
|
26
|
+
* @param title The dialog title
|
|
27
|
+
* @returns This builder with the title set
|
|
28
|
+
*/
|
|
12
29
|
title(title: string | TextObjectBuilder<false>): ConfirmBuilder<true, HasText, HasConfirm, HasDeny>;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the text for this confirmation dialog.
|
|
32
|
+
*
|
|
33
|
+
* @param text The dialog text
|
|
34
|
+
* @returns This builder with the text set
|
|
35
|
+
*/
|
|
13
36
|
text(text: string | TextObjectBuilder): ConfirmBuilder<HasTitle, true, HasConfirm, HasDeny>;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the text for the confirm button.
|
|
39
|
+
*
|
|
40
|
+
* @param confirm The confirm button text
|
|
41
|
+
* @returns This builder with the confirm button text set
|
|
42
|
+
*/
|
|
14
43
|
confirm(confirm: string | TextObjectBuilder<false>): ConfirmBuilder<HasTitle, HasText, true, HasDeny>;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the text for the deny button.
|
|
46
|
+
*
|
|
47
|
+
* @param deny The deny button text
|
|
48
|
+
* @returns This builder with the deny button text set
|
|
49
|
+
*/
|
|
15
50
|
deny(deny: string | TextObjectBuilder<false>): ConfirmBuilder<HasTitle, HasText, HasConfirm, true>;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the style for the confirm button.
|
|
53
|
+
*
|
|
54
|
+
* @param style The button style ('primary' or 'danger')
|
|
55
|
+
* @returns This builder
|
|
56
|
+
*/
|
|
16
57
|
style(style: ColorScheme): this;
|
|
17
58
|
build(this: ConfirmBuilder<true, true, true, true>): ConfirmationDialog;
|
|
18
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a confirmation dialog builder.
|
|
62
|
+
*
|
|
63
|
+
* Accepts partial field configuration. The `title`, `text`, `confirm`, and `deny` fields must be
|
|
64
|
+
* set before calling `build()`.
|
|
65
|
+
*
|
|
66
|
+
* @param fields Optional initial configuration fields
|
|
67
|
+
* @returns A confirmation dialog builder
|
|
68
|
+
*/
|
|
19
69
|
export declare function confirm<Fields extends {
|
|
20
70
|
title?: string | TextObjectBuilder<false>;
|
|
21
71
|
text?: string | TextObjectBuilder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/blocks/objects/confirm.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { Builder } from "../base.js";
|
|
2
2
|
import { ensureIsTextObjectBuilder } from "./text.js";
|
|
3
3
|
import { SlackError } from "../../error.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builder for confirmation dialogs.
|
|
6
|
+
*
|
|
7
|
+
* Confirmation dialogs are displayed when users interact with interactive elements and require
|
|
8
|
+
* confirmation before the action is executed.
|
|
9
|
+
*
|
|
10
|
+
* @template HasTitle Whether a title has been set
|
|
11
|
+
* @template HasText Whether text has been set
|
|
12
|
+
* @template HasConfirm Whether the confirm button text has been set
|
|
13
|
+
* @template HasDeny Whether the deny button text has been set
|
|
14
|
+
*/
|
|
4
15
|
export class ConfirmBuilder extends Builder {
|
|
5
16
|
_title;
|
|
6
17
|
_text;
|
|
@@ -16,22 +27,52 @@ export class ConfirmBuilder extends Builder {
|
|
|
16
27
|
this._deny = _deny;
|
|
17
28
|
this._style = _style;
|
|
18
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets the title for this confirmation dialog.
|
|
32
|
+
*
|
|
33
|
+
* @param title The dialog title
|
|
34
|
+
* @returns This builder with the title set
|
|
35
|
+
*/
|
|
19
36
|
title(title) {
|
|
20
37
|
this._title = ensureIsTextObjectBuilder(title).plain();
|
|
21
38
|
return this;
|
|
22
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets the text for this confirmation dialog.
|
|
42
|
+
*
|
|
43
|
+
* @param text The dialog text
|
|
44
|
+
* @returns This builder with the text set
|
|
45
|
+
*/
|
|
23
46
|
text(text) {
|
|
24
47
|
this._text = ensureIsTextObjectBuilder(text);
|
|
25
48
|
return this;
|
|
26
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Sets the text for the confirm button.
|
|
52
|
+
*
|
|
53
|
+
* @param confirm The confirm button text
|
|
54
|
+
* @returns This builder with the confirm button text set
|
|
55
|
+
*/
|
|
27
56
|
confirm(confirm) {
|
|
28
57
|
this._confirm = ensureIsTextObjectBuilder(confirm).plain();
|
|
29
58
|
return this;
|
|
30
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets the text for the deny button.
|
|
62
|
+
*
|
|
63
|
+
* @param deny The deny button text
|
|
64
|
+
* @returns This builder with the deny button text set
|
|
65
|
+
*/
|
|
31
66
|
deny(deny) {
|
|
32
67
|
this._deny = ensureIsTextObjectBuilder(deny).plain();
|
|
33
68
|
return this;
|
|
34
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Sets the style for the confirm button.
|
|
72
|
+
*
|
|
73
|
+
* @param style The button style ('primary' or 'danger')
|
|
74
|
+
* @returns This builder
|
|
75
|
+
*/
|
|
35
76
|
style(style) {
|
|
36
77
|
this._style = style;
|
|
37
78
|
return this;
|
|
@@ -49,6 +90,15 @@ export class ConfirmBuilder extends Builder {
|
|
|
49
90
|
};
|
|
50
91
|
}
|
|
51
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates a confirmation dialog builder.
|
|
95
|
+
*
|
|
96
|
+
* Accepts partial field configuration. The `title`, `text`, `confirm`, and `deny` fields must be
|
|
97
|
+
* set before calling `build()`.
|
|
98
|
+
*
|
|
99
|
+
* @param fields Optional initial configuration fields
|
|
100
|
+
* @returns A confirmation dialog builder
|
|
101
|
+
*/
|
|
52
102
|
export function confirm(fields) {
|
|
53
103
|
return new ConfirmBuilder(ensureIsTextObjectBuilder(fields?.title)?.plain(), ensureIsTextObjectBuilder(fields?.text), ensureIsTextObjectBuilder(fields?.confirm)?.plain(), ensureIsTextObjectBuilder(fields?.deny)?.plain(), fields?.style);
|
|
54
104
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/objects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -4,14 +4,40 @@ import { type TextObjectBuilder } from "./text.js";
|
|
|
4
4
|
type TypedPlainTextOption<Value extends string | undefined> = PlainTextOption & {
|
|
5
5
|
value: Value;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Builder for option objects.
|
|
9
|
+
*
|
|
10
|
+
* Option objects are used in select menus to define the available choices.
|
|
11
|
+
*
|
|
12
|
+
* @template Value The option value type
|
|
13
|
+
*/
|
|
7
14
|
export declare class OptionObjectBuilder<Value extends string | undefined = string | undefined> extends Builder<TypedPlainTextOption<Value>> {
|
|
8
15
|
private _text;
|
|
9
16
|
private _value;
|
|
10
17
|
constructor(_text: TextObjectBuilder<false>, _value: Value);
|
|
18
|
+
/**
|
|
19
|
+
* Sets the value for this option.
|
|
20
|
+
*
|
|
21
|
+
* @param value The option value
|
|
22
|
+
* @returns This builder with the value set
|
|
23
|
+
*/
|
|
11
24
|
value<Value extends string>(value: Value): OptionObjectBuilder<Value>;
|
|
12
25
|
build(): TypedPlainTextOption<Value>;
|
|
13
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates an option builder without an initial value.
|
|
29
|
+
*
|
|
30
|
+
* @param text The option text
|
|
31
|
+
* @returns An option builder without a value
|
|
32
|
+
*/
|
|
14
33
|
export declare function option(text: string | TextObjectBuilder<false>): OptionObjectBuilder<undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates an option builder with an initial value.
|
|
36
|
+
*
|
|
37
|
+
* @param text The option text
|
|
38
|
+
* @param value The option value
|
|
39
|
+
* @returns An option builder with the value set
|
|
40
|
+
*/
|
|
15
41
|
export declare function option<Value extends string>(text: string | TextObjectBuilder<false>, value: Value): OptionObjectBuilder<Value>;
|
|
16
42
|
export {};
|
|
17
43
|
//# sourceMappingURL=option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../../src/blocks/objects/option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAE1E,KAAK,oBAAoB,CAAC,KAAK,SAAS,MAAM,GAAG,SAAS,IAAI,eAAe,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAA;AAEhG;;;;;;GAMG;AACH,qBAAa,mBAAmB,CAC/B,KAAK,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CACpD,SAAQ,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;gBADN,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAC/B,MAAM,EAAE,KAAK;IAKtB;;;;;OAKG;IACH,KAAK,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC;IAK5D,KAAK,IAAI,oBAAoB,CAAC,KAAK,CAAC;CAG7C;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAA;AAC/F;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,MAAM,EAC1C,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,EACvC,KAAK,EAAE,KAAK,GACV,mBAAmB,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Builder } from "../base.js";
|
|
2
2
|
import { ensureIsTextObjectBuilder } from "./text.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builder for option objects.
|
|
5
|
+
*
|
|
6
|
+
* Option objects are used in select menus to define the available choices.
|
|
7
|
+
*
|
|
8
|
+
* @template Value The option value type
|
|
9
|
+
*/
|
|
3
10
|
export class OptionObjectBuilder extends Builder {
|
|
4
11
|
_text;
|
|
5
12
|
_value;
|
|
@@ -8,6 +15,12 @@ export class OptionObjectBuilder extends Builder {
|
|
|
8
15
|
this._text = _text;
|
|
9
16
|
this._value = _value;
|
|
10
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Sets the value for this option.
|
|
20
|
+
*
|
|
21
|
+
* @param value The option value
|
|
22
|
+
* @returns This builder with the value set
|
|
23
|
+
*/
|
|
11
24
|
value(value) {
|
|
12
25
|
this._value = value;
|
|
13
26
|
return this;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { MrkdwnElement, PlainTextElement } from "@slack/types";
|
|
2
|
+
import { Builder } from "../base.js";
|
|
3
|
+
/**
|
|
4
|
+
* Builder for text objects.
|
|
5
|
+
*
|
|
6
|
+
* Text objects support both plain text and markdown formatting.
|
|
7
|
+
*
|
|
8
|
+
* @template Mrkdwn Whether markdown formatting is enabled
|
|
9
|
+
*/
|
|
10
|
+
export declare class TextObjectBuilder<Mrkdwn extends boolean = boolean> extends Builder<Mrkdwn extends true ? MrkdwnElement : PlainTextElement> {
|
|
11
|
+
private _text;
|
|
12
|
+
private _mrkdwn;
|
|
13
|
+
private _emoji;
|
|
14
|
+
private _verbatim;
|
|
15
|
+
constructor(_text: string, _mrkdwn: Mrkdwn);
|
|
16
|
+
/**
|
|
17
|
+
* Enables emoji rendering for plain text (converts `:emoji_name:` to emoji).
|
|
18
|
+
*
|
|
19
|
+
* Only applicable to plain text objects.
|
|
20
|
+
*
|
|
21
|
+
* @param emoji Whether to enable emoji rendering
|
|
22
|
+
* @returns This builder
|
|
23
|
+
*/
|
|
24
|
+
emoji(this: TextObjectBuilder<false>, emoji?: boolean): TextObjectBuilder<false>;
|
|
25
|
+
/**
|
|
26
|
+
* Disables automatic parsing of markdown formatting.
|
|
27
|
+
*
|
|
28
|
+
* Only applicable to markdown text objects.
|
|
29
|
+
*
|
|
30
|
+
* @param verbatim Whether to disable formatting
|
|
31
|
+
* @returns This builder
|
|
32
|
+
*/
|
|
33
|
+
verbatim(this: TextObjectBuilder<true>, verbatim?: boolean): TextObjectBuilder<true>;
|
|
34
|
+
/**
|
|
35
|
+
* Switches to markdown formatting.
|
|
36
|
+
*
|
|
37
|
+
* @returns This builder with markdown enabled
|
|
38
|
+
*/
|
|
39
|
+
mrkdwn(): TextObjectBuilder<true>;
|
|
40
|
+
/**
|
|
41
|
+
* Switches between plain text and markdown formatting.
|
|
42
|
+
*
|
|
43
|
+
* @param mrkdwn Whether to enable markdown
|
|
44
|
+
* @returns This builder with the specified format
|
|
45
|
+
*/
|
|
46
|
+
mrkdwn<Mrkdwn extends boolean = true>(mrkdwn: Mrkdwn): TextObjectBuilder<Mrkdwn>;
|
|
47
|
+
/**
|
|
48
|
+
* Switches to plain text formatting.
|
|
49
|
+
*
|
|
50
|
+
* @returns This builder with plain text formatting
|
|
51
|
+
*/
|
|
52
|
+
plain(): TextObjectBuilder<false>;
|
|
53
|
+
build(): Mrkdwn extends true ? MrkdwnElement : PlainTextElement;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates a markdown text object builder.
|
|
57
|
+
*
|
|
58
|
+
* @param text The markdown text
|
|
59
|
+
* @returns A text object builder with markdown enabled
|
|
60
|
+
*/
|
|
61
|
+
export declare function mrkdwn(text: string): TextObjectBuilder<true>;
|
|
62
|
+
/** Alias for `mrkdwn()`. */
|
|
63
|
+
export { mrkdwn as text };
|
|
64
|
+
/**
|
|
65
|
+
* Creates a plain text object builder.
|
|
66
|
+
*
|
|
67
|
+
* @param text The plain text
|
|
68
|
+
* @returns A text object builder with plain text format
|
|
69
|
+
*/
|
|
70
|
+
export declare function plain(text: string): TextObjectBuilder<false>;
|
|
71
|
+
/**
|
|
72
|
+
* Converts a string to a text object builder if needed.
|
|
73
|
+
*
|
|
74
|
+
* If the input is already a text object builder, it is returned as-is. If the input is a string, it
|
|
75
|
+
* is converted to a markdown text object builder.
|
|
76
|
+
*
|
|
77
|
+
* @param text A string or text object builder
|
|
78
|
+
* @returns A markdown text object builder
|
|
79
|
+
*/
|
|
80
|
+
export declare function ensureIsTextObjectBuilder(text: string): TextObjectBuilder<true>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the text object builder as-is if it's already one.
|
|
83
|
+
*
|
|
84
|
+
* @param text A text object builder
|
|
85
|
+
* @returns The same text object builder
|
|
86
|
+
*/
|
|
87
|
+
export declare function ensureIsTextObjectBuilder<T extends TextObjectBuilder>(text: T): T;
|
|
88
|
+
/**
|
|
89
|
+
* Converts a string to a text object builder or returns the builder as-is.
|
|
90
|
+
*
|
|
91
|
+
* @param text A string or text object builder
|
|
92
|
+
* @returns A text object builder
|
|
93
|
+
*/
|
|
94
|
+
export declare function ensureIsTextObjectBuilder<T extends TextObjectBuilder>(text: string | T): TextObjectBuilder<true> | T;
|
|
95
|
+
/**
|
|
96
|
+
* Converts an optional string to a text object builder if present.
|
|
97
|
+
*
|
|
98
|
+
* @param text An optional string
|
|
99
|
+
* @returns A markdown text object builder or undefined
|
|
100
|
+
*/
|
|
101
|
+
export declare function ensureIsTextObjectBuilder(text?: string): TextObjectBuilder<true> | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Returns an optional text object builder as-is if present.
|
|
104
|
+
*
|
|
105
|
+
* @param text An optional text object builder
|
|
106
|
+
* @returns The text object builder or undefined
|
|
107
|
+
*/
|
|
108
|
+
export declare function ensureIsTextObjectBuilder<T extends TextObjectBuilder>(text?: T): T | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Converts an optional string to a text object builder or returns the builder as-is.
|
|
111
|
+
*
|
|
112
|
+
* @param text An optional string or text object builder
|
|
113
|
+
* @returns A text object builder or undefined
|
|
114
|
+
*/
|
|
115
|
+
export declare function ensureIsTextObjectBuilder<T extends TextObjectBuilder>(text?: string | T): TextObjectBuilder<true> | T | undefined;
|
|
116
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/blocks/objects/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC;;;;;;GAMG;AACH,qBAAa,iBAAiB,CAAC,MAAM,SAAS,OAAO,GAAG,OAAO,CAAE,SAAQ,OAAO,CAC/E,MAAM,SAAS,IAAI,GAAG,aAAa,GAAG,gBAAgB,CACtD;IAKC,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IALhB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAQ;gBAGhB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM;IAKxB;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAE,OAAc;IAK3D;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAE,OAAc;IAKhE;;;;OAIG;IACH,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC;IACjC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,SAAS,OAAO,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC;IAMhF;;;;OAIG;IACH,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC;IAIxB,KAAK,IAAI,MAAM,SAAS,IAAI,GAAG,aAAa,GAAG,gBAAgB;CAexE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAE5D;AAED,4BAA4B;AAC5B,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,CAAA;AAEzB;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAE5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAA;AAChF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA;AAClF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,EACpE,IAAI,EAAE,MAAM,GAAG,CAAC,GACd,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9B;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AAC7F;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;AAC/F;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,EACpE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,GACf,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Builder } from "../base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Builder for text objects.
|
|
4
|
+
*
|
|
5
|
+
* Text objects support both plain text and markdown formatting.
|
|
6
|
+
*
|
|
7
|
+
* @template Mrkdwn Whether markdown formatting is enabled
|
|
8
|
+
*/
|
|
2
9
|
export class TextObjectBuilder extends Builder {
|
|
3
10
|
_text;
|
|
4
11
|
_mrkdwn;
|
|
@@ -9,10 +16,26 @@ export class TextObjectBuilder extends Builder {
|
|
|
9
16
|
this._text = _text;
|
|
10
17
|
this._mrkdwn = _mrkdwn;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Enables emoji rendering for plain text (converts `:emoji_name:` to emoji).
|
|
21
|
+
*
|
|
22
|
+
* Only applicable to plain text objects.
|
|
23
|
+
*
|
|
24
|
+
* @param emoji Whether to enable emoji rendering
|
|
25
|
+
* @returns This builder
|
|
26
|
+
*/
|
|
12
27
|
emoji(emoji = true) {
|
|
13
28
|
this._emoji = emoji;
|
|
14
29
|
return this;
|
|
15
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Disables automatic parsing of markdown formatting.
|
|
33
|
+
*
|
|
34
|
+
* Only applicable to markdown text objects.
|
|
35
|
+
*
|
|
36
|
+
* @param verbatim Whether to disable formatting
|
|
37
|
+
* @returns This builder
|
|
38
|
+
*/
|
|
16
39
|
verbatim(verbatim = true) {
|
|
17
40
|
this._verbatim = verbatim;
|
|
18
41
|
return this;
|
|
@@ -21,6 +44,11 @@ export class TextObjectBuilder extends Builder {
|
|
|
21
44
|
this._mrkdwn = mrkdwn;
|
|
22
45
|
return this;
|
|
23
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Switches to plain text formatting.
|
|
49
|
+
*
|
|
50
|
+
* @returns This builder with plain text formatting
|
|
51
|
+
*/
|
|
24
52
|
plain() {
|
|
25
53
|
return this.mrkdwn(false);
|
|
26
54
|
}
|
|
@@ -41,10 +69,23 @@ export class TextObjectBuilder extends Builder {
|
|
|
41
69
|
}
|
|
42
70
|
}
|
|
43
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a markdown text object builder.
|
|
74
|
+
*
|
|
75
|
+
* @param text The markdown text
|
|
76
|
+
* @returns A text object builder with markdown enabled
|
|
77
|
+
*/
|
|
44
78
|
export function mrkdwn(text) {
|
|
45
79
|
return new TextObjectBuilder(text, true);
|
|
46
80
|
}
|
|
81
|
+
/** Alias for `mrkdwn()`. */
|
|
47
82
|
export { mrkdwn as text };
|
|
83
|
+
/**
|
|
84
|
+
* Creates a plain text object builder.
|
|
85
|
+
*
|
|
86
|
+
* @param text The plain text
|
|
87
|
+
* @returns A text object builder with plain text format
|
|
88
|
+
*/
|
|
48
89
|
export function plain(text) {
|
|
49
90
|
return new TextObjectBuilder(text, false);
|
|
50
91
|
}
|