slack-blocks-to-jsx 0.1.5 → 0.1.7
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 +148 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +278 -391
- package/dist/index.mjs +278 -391
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -697,6 +697,102 @@ type FilterObject = {
|
|
|
697
697
|
exclude_bot_users?: boolean;
|
|
698
698
|
};
|
|
699
699
|
|
|
700
|
+
type RichTextList = {
|
|
701
|
+
type: "rich_text_list";
|
|
702
|
+
style: "bullet" | "ordered";
|
|
703
|
+
/**
|
|
704
|
+
* The number of spaces to indent this block. It must be a number between 0 and 8.
|
|
705
|
+
*/
|
|
706
|
+
indent?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
707
|
+
offset?: number;
|
|
708
|
+
/**
|
|
709
|
+
* 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
|
|
710
|
+
*/
|
|
711
|
+
border?: 0 | 1;
|
|
712
|
+
elements: RichTextSection[];
|
|
713
|
+
};
|
|
714
|
+
type RichTextPreformatted = {
|
|
715
|
+
type: "rich_text_preformatted";
|
|
716
|
+
elements: AnyRichTextSectionElement[];
|
|
717
|
+
/**
|
|
718
|
+
* 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
|
|
719
|
+
*/
|
|
720
|
+
border?: 0 | 1;
|
|
721
|
+
};
|
|
722
|
+
type RichTextQuote = {
|
|
723
|
+
type: "rich_text_quote";
|
|
724
|
+
elements: AnyRichTextSectionElement[];
|
|
725
|
+
/**
|
|
726
|
+
* 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
|
|
727
|
+
*/
|
|
728
|
+
border?: 0 | 1;
|
|
729
|
+
};
|
|
730
|
+
type RichTextSection = {
|
|
731
|
+
type: "rich_text_section";
|
|
732
|
+
elements: AnyRichTextSectionElement[];
|
|
733
|
+
};
|
|
734
|
+
type AnyRichTextBlockElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
|
|
735
|
+
type AnyRichTextSectionElement = RichTextSectionText | RichTextSectionChannel | RichTextSectionUser | RichTextSectionEmoji | RichTextSectionLink | RichTextSectionTeam | RichTextSectionUsergroup | RichTextSectionDate | RichTextSectionBroadcast | RichTextSectionColor;
|
|
736
|
+
interface RichTextSectionElement {
|
|
737
|
+
type: "text" | "channel" | "user" | "emoji" | "link" | "team" | "usergroup" | "date" | "broadcast" | "color";
|
|
738
|
+
style?: RichTextSectionElementStyle;
|
|
739
|
+
}
|
|
740
|
+
interface RichTextSectionText extends RichTextSectionElement {
|
|
741
|
+
type: "text";
|
|
742
|
+
text: string;
|
|
743
|
+
style?: RichTextSectionElementStyleWithCode;
|
|
744
|
+
}
|
|
745
|
+
interface RichTextSectionChannel extends RichTextSectionElement {
|
|
746
|
+
type: "channel";
|
|
747
|
+
channel_id: string;
|
|
748
|
+
}
|
|
749
|
+
interface RichTextSectionUser extends RichTextSectionElement {
|
|
750
|
+
type: "user";
|
|
751
|
+
user_id: string;
|
|
752
|
+
}
|
|
753
|
+
interface RichTextSectionEmoji extends RichTextSectionElement {
|
|
754
|
+
type: "emoji";
|
|
755
|
+
name: string;
|
|
756
|
+
skin_tone?: number;
|
|
757
|
+
unicode?: string;
|
|
758
|
+
}
|
|
759
|
+
interface RichTextSectionLink extends RichTextSectionElement {
|
|
760
|
+
type: "link";
|
|
761
|
+
url: string;
|
|
762
|
+
text: string;
|
|
763
|
+
style?: RichTextSectionElementStyleWithCode;
|
|
764
|
+
}
|
|
765
|
+
interface RichTextSectionTeam extends RichTextSectionElement {
|
|
766
|
+
type: "team";
|
|
767
|
+
team_id: string;
|
|
768
|
+
}
|
|
769
|
+
interface RichTextSectionUsergroup extends RichTextSectionElement {
|
|
770
|
+
type: "usergroup";
|
|
771
|
+
usergroup_id: string;
|
|
772
|
+
}
|
|
773
|
+
interface RichTextSectionDate extends RichTextSectionElement {
|
|
774
|
+
type: "date";
|
|
775
|
+
timestamp: number;
|
|
776
|
+
format: string;
|
|
777
|
+
style?: RichTextSectionElementStyleWithCode;
|
|
778
|
+
}
|
|
779
|
+
interface RichTextSectionBroadcast extends RichTextSectionElement {
|
|
780
|
+
type: "broadcast";
|
|
781
|
+
range: "channel" | "here" | "everyone";
|
|
782
|
+
}
|
|
783
|
+
interface RichTextSectionColor extends RichTextSectionElement {
|
|
784
|
+
type: "color";
|
|
785
|
+
value: string;
|
|
786
|
+
}
|
|
787
|
+
interface RichTextSectionElementStyle {
|
|
788
|
+
bold?: boolean;
|
|
789
|
+
italic?: boolean;
|
|
790
|
+
strike?: boolean;
|
|
791
|
+
}
|
|
792
|
+
interface RichTextSectionElementStyleWithCode extends RichTextSectionElementStyle {
|
|
793
|
+
code?: boolean;
|
|
794
|
+
}
|
|
795
|
+
|
|
700
796
|
type Block = ActionsBlock | ContextBlock | DividerBlock | FileBlock | HeaderBlock | ImageBlock | InputBlock | SectionBlock | VideoBlock | RichTextBlock;
|
|
701
797
|
type ActionsBlock = {
|
|
702
798
|
/**
|
|
@@ -974,7 +1070,53 @@ type RichTextBlock = {
|
|
|
974
1070
|
* A ***rich_text*** block is a formatted, structured representation of text. It is the output of the Slack client's WYSIWYG composer, so all messages sent by end-users will have this format. You can use this block to create your own formatted text in Block Kit Builder or include user-defined formatted text in your Block Kit payload. You might encounter ***rich_text*** blocks in message payloads coming from our APIs, as a built-in type in the next-generation Slack platform, or as output of the ***rich_text_input*** block.
|
|
975
1071
|
*/
|
|
976
1072
|
type: "rich_text";
|
|
1073
|
+
/**
|
|
1074
|
+
* A string acting as a unique identifier for a block. If not specified, one will be generated. Maximum length for this field is 255 characters. ***block_id*** should be unique for each message and each iteration of a message. If a message is updated, use a new ***block_id***.
|
|
1075
|
+
*/
|
|
1076
|
+
block_id?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* An array of rich text objects - rich_text_section, rich_text_list, rich_text_preformatted, and rich_text_quote. See your specific desired element below for more details.
|
|
1079
|
+
*/
|
|
1080
|
+
elements: AnyRichTextBlockElement[];
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
type User = {
|
|
1084
|
+
id: string;
|
|
1085
|
+
name: string;
|
|
1086
|
+
};
|
|
1087
|
+
type Channel = {
|
|
1088
|
+
id: string;
|
|
1089
|
+
name: string;
|
|
1090
|
+
};
|
|
1091
|
+
type Hooks = {
|
|
1092
|
+
user?: (data: User) => string;
|
|
1093
|
+
channel?: (data: Channel) => string;
|
|
1094
|
+
atChannel?: (data: {
|
|
1095
|
+
name: string;
|
|
1096
|
+
}) => string;
|
|
1097
|
+
usergroup?: (data: Channel) => string;
|
|
1098
|
+
atEveryone?: (data: {
|
|
1099
|
+
name: string;
|
|
1100
|
+
}) => string;
|
|
1101
|
+
atHere?: (data: {
|
|
1102
|
+
name: string;
|
|
1103
|
+
}) => string;
|
|
1104
|
+
date?: (data: {
|
|
1105
|
+
timestamp: string;
|
|
1106
|
+
format: string;
|
|
1107
|
+
link?: string | undefined;
|
|
1108
|
+
fallback: string;
|
|
1109
|
+
}) => string;
|
|
1110
|
+
};
|
|
1111
|
+
type Data = {
|
|
1112
|
+
users: User[];
|
|
1113
|
+
channels: Channel[];
|
|
1114
|
+
hooks: Hooks;
|
|
1115
|
+
setUsers: (users: User[]) => void;
|
|
1116
|
+
setChannels: (channels: Channel[]) => void;
|
|
1117
|
+
setHooks: (hooks: Hooks) => void;
|
|
977
1118
|
};
|
|
1119
|
+
type GlobalStore = Data;
|
|
978
1120
|
|
|
979
1121
|
type Props = {
|
|
980
1122
|
/**
|
|
@@ -991,6 +1133,12 @@ type Props = {
|
|
|
991
1133
|
time?: Date;
|
|
992
1134
|
className?: string;
|
|
993
1135
|
style?: React.CSSProperties;
|
|
1136
|
+
unstyled?: boolean;
|
|
1137
|
+
data?: {
|
|
1138
|
+
users?: GlobalStore["users"];
|
|
1139
|
+
channels?: GlobalStore["channels"];
|
|
1140
|
+
};
|
|
1141
|
+
hooks?: GlobalStore["hooks"];
|
|
994
1142
|
};
|
|
995
1143
|
declare const Message: (props: Props) => JSX.Element;
|
|
996
1144
|
|
package/dist/index.d.ts
CHANGED
|
@@ -697,6 +697,102 @@ type FilterObject = {
|
|
|
697
697
|
exclude_bot_users?: boolean;
|
|
698
698
|
};
|
|
699
699
|
|
|
700
|
+
type RichTextList = {
|
|
701
|
+
type: "rich_text_list";
|
|
702
|
+
style: "bullet" | "ordered";
|
|
703
|
+
/**
|
|
704
|
+
* The number of spaces to indent this block. It must be a number between 0 and 8.
|
|
705
|
+
*/
|
|
706
|
+
indent?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
707
|
+
offset?: number;
|
|
708
|
+
/**
|
|
709
|
+
* 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
|
|
710
|
+
*/
|
|
711
|
+
border?: 0 | 1;
|
|
712
|
+
elements: RichTextSection[];
|
|
713
|
+
};
|
|
714
|
+
type RichTextPreformatted = {
|
|
715
|
+
type: "rich_text_preformatted";
|
|
716
|
+
elements: AnyRichTextSectionElement[];
|
|
717
|
+
/**
|
|
718
|
+
* 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
|
|
719
|
+
*/
|
|
720
|
+
border?: 0 | 1;
|
|
721
|
+
};
|
|
722
|
+
type RichTextQuote = {
|
|
723
|
+
type: "rich_text_quote";
|
|
724
|
+
elements: AnyRichTextSectionElement[];
|
|
725
|
+
/**
|
|
726
|
+
* 0 or 1 (default 0) - if 1, a border is drawn on the left side of the block.
|
|
727
|
+
*/
|
|
728
|
+
border?: 0 | 1;
|
|
729
|
+
};
|
|
730
|
+
type RichTextSection = {
|
|
731
|
+
type: "rich_text_section";
|
|
732
|
+
elements: AnyRichTextSectionElement[];
|
|
733
|
+
};
|
|
734
|
+
type AnyRichTextBlockElement = RichTextList | RichTextPreformatted | RichTextQuote | RichTextSection;
|
|
735
|
+
type AnyRichTextSectionElement = RichTextSectionText | RichTextSectionChannel | RichTextSectionUser | RichTextSectionEmoji | RichTextSectionLink | RichTextSectionTeam | RichTextSectionUsergroup | RichTextSectionDate | RichTextSectionBroadcast | RichTextSectionColor;
|
|
736
|
+
interface RichTextSectionElement {
|
|
737
|
+
type: "text" | "channel" | "user" | "emoji" | "link" | "team" | "usergroup" | "date" | "broadcast" | "color";
|
|
738
|
+
style?: RichTextSectionElementStyle;
|
|
739
|
+
}
|
|
740
|
+
interface RichTextSectionText extends RichTextSectionElement {
|
|
741
|
+
type: "text";
|
|
742
|
+
text: string;
|
|
743
|
+
style?: RichTextSectionElementStyleWithCode;
|
|
744
|
+
}
|
|
745
|
+
interface RichTextSectionChannel extends RichTextSectionElement {
|
|
746
|
+
type: "channel";
|
|
747
|
+
channel_id: string;
|
|
748
|
+
}
|
|
749
|
+
interface RichTextSectionUser extends RichTextSectionElement {
|
|
750
|
+
type: "user";
|
|
751
|
+
user_id: string;
|
|
752
|
+
}
|
|
753
|
+
interface RichTextSectionEmoji extends RichTextSectionElement {
|
|
754
|
+
type: "emoji";
|
|
755
|
+
name: string;
|
|
756
|
+
skin_tone?: number;
|
|
757
|
+
unicode?: string;
|
|
758
|
+
}
|
|
759
|
+
interface RichTextSectionLink extends RichTextSectionElement {
|
|
760
|
+
type: "link";
|
|
761
|
+
url: string;
|
|
762
|
+
text: string;
|
|
763
|
+
style?: RichTextSectionElementStyleWithCode;
|
|
764
|
+
}
|
|
765
|
+
interface RichTextSectionTeam extends RichTextSectionElement {
|
|
766
|
+
type: "team";
|
|
767
|
+
team_id: string;
|
|
768
|
+
}
|
|
769
|
+
interface RichTextSectionUsergroup extends RichTextSectionElement {
|
|
770
|
+
type: "usergroup";
|
|
771
|
+
usergroup_id: string;
|
|
772
|
+
}
|
|
773
|
+
interface RichTextSectionDate extends RichTextSectionElement {
|
|
774
|
+
type: "date";
|
|
775
|
+
timestamp: number;
|
|
776
|
+
format: string;
|
|
777
|
+
style?: RichTextSectionElementStyleWithCode;
|
|
778
|
+
}
|
|
779
|
+
interface RichTextSectionBroadcast extends RichTextSectionElement {
|
|
780
|
+
type: "broadcast";
|
|
781
|
+
range: "channel" | "here" | "everyone";
|
|
782
|
+
}
|
|
783
|
+
interface RichTextSectionColor extends RichTextSectionElement {
|
|
784
|
+
type: "color";
|
|
785
|
+
value: string;
|
|
786
|
+
}
|
|
787
|
+
interface RichTextSectionElementStyle {
|
|
788
|
+
bold?: boolean;
|
|
789
|
+
italic?: boolean;
|
|
790
|
+
strike?: boolean;
|
|
791
|
+
}
|
|
792
|
+
interface RichTextSectionElementStyleWithCode extends RichTextSectionElementStyle {
|
|
793
|
+
code?: boolean;
|
|
794
|
+
}
|
|
795
|
+
|
|
700
796
|
type Block = ActionsBlock | ContextBlock | DividerBlock | FileBlock | HeaderBlock | ImageBlock | InputBlock | SectionBlock | VideoBlock | RichTextBlock;
|
|
701
797
|
type ActionsBlock = {
|
|
702
798
|
/**
|
|
@@ -974,7 +1070,53 @@ type RichTextBlock = {
|
|
|
974
1070
|
* A ***rich_text*** block is a formatted, structured representation of text. It is the output of the Slack client's WYSIWYG composer, so all messages sent by end-users will have this format. You can use this block to create your own formatted text in Block Kit Builder or include user-defined formatted text in your Block Kit payload. You might encounter ***rich_text*** blocks in message payloads coming from our APIs, as a built-in type in the next-generation Slack platform, or as output of the ***rich_text_input*** block.
|
|
975
1071
|
*/
|
|
976
1072
|
type: "rich_text";
|
|
1073
|
+
/**
|
|
1074
|
+
* A string acting as a unique identifier for a block. If not specified, one will be generated. Maximum length for this field is 255 characters. ***block_id*** should be unique for each message and each iteration of a message. If a message is updated, use a new ***block_id***.
|
|
1075
|
+
*/
|
|
1076
|
+
block_id?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* An array of rich text objects - rich_text_section, rich_text_list, rich_text_preformatted, and rich_text_quote. See your specific desired element below for more details.
|
|
1079
|
+
*/
|
|
1080
|
+
elements: AnyRichTextBlockElement[];
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
type User = {
|
|
1084
|
+
id: string;
|
|
1085
|
+
name: string;
|
|
1086
|
+
};
|
|
1087
|
+
type Channel = {
|
|
1088
|
+
id: string;
|
|
1089
|
+
name: string;
|
|
1090
|
+
};
|
|
1091
|
+
type Hooks = {
|
|
1092
|
+
user?: (data: User) => string;
|
|
1093
|
+
channel?: (data: Channel) => string;
|
|
1094
|
+
atChannel?: (data: {
|
|
1095
|
+
name: string;
|
|
1096
|
+
}) => string;
|
|
1097
|
+
usergroup?: (data: Channel) => string;
|
|
1098
|
+
atEveryone?: (data: {
|
|
1099
|
+
name: string;
|
|
1100
|
+
}) => string;
|
|
1101
|
+
atHere?: (data: {
|
|
1102
|
+
name: string;
|
|
1103
|
+
}) => string;
|
|
1104
|
+
date?: (data: {
|
|
1105
|
+
timestamp: string;
|
|
1106
|
+
format: string;
|
|
1107
|
+
link?: string | undefined;
|
|
1108
|
+
fallback: string;
|
|
1109
|
+
}) => string;
|
|
1110
|
+
};
|
|
1111
|
+
type Data = {
|
|
1112
|
+
users: User[];
|
|
1113
|
+
channels: Channel[];
|
|
1114
|
+
hooks: Hooks;
|
|
1115
|
+
setUsers: (users: User[]) => void;
|
|
1116
|
+
setChannels: (channels: Channel[]) => void;
|
|
1117
|
+
setHooks: (hooks: Hooks) => void;
|
|
977
1118
|
};
|
|
1119
|
+
type GlobalStore = Data;
|
|
978
1120
|
|
|
979
1121
|
type Props = {
|
|
980
1122
|
/**
|
|
@@ -991,6 +1133,12 @@ type Props = {
|
|
|
991
1133
|
time?: Date;
|
|
992
1134
|
className?: string;
|
|
993
1135
|
style?: React.CSSProperties;
|
|
1136
|
+
unstyled?: boolean;
|
|
1137
|
+
data?: {
|
|
1138
|
+
users?: GlobalStore["users"];
|
|
1139
|
+
channels?: GlobalStore["channels"];
|
|
1140
|
+
};
|
|
1141
|
+
hooks?: GlobalStore["hooks"];
|
|
994
1142
|
};
|
|
995
1143
|
declare const Message: (props: Props) => JSX.Element;
|
|
996
1144
|
|