@tightknitai/block-kitchen 0.10.17 → 0.10.19

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.
@@ -915,6 +915,44 @@ interface CustomEmoji {
915
915
  url: string | null;
916
916
  alias: string | null;
917
917
  }
918
+ /**
919
+ * A person the rich text editor's `@` picker offers, returned by
920
+ * {@link MentionsConfig.searchUsers}.
921
+ */
922
+ interface MentionUser {
923
+ /** Slack user id (`U…` / `W…`), written to the rich text `user` element's `user_id`. */
924
+ id: string;
925
+ /** Name shown in the picker row and on the inserted mention. */
926
+ name: string;
927
+ /** Avatar shown in the picker row. Ignored unless a safe image URL; rows without one show an initial. */
928
+ avatarUrl?: string | null;
929
+ }
930
+ /**
931
+ * Opt-in `@` mentions for the rich text editor, passed as
932
+ * {@link BlockKitchenBaseProps.mentions}. Typing `@` (or the toolbar's
933
+ * mention button) opens a picker backed by the host's search; picking someone
934
+ * inserts a rich text `user` element (`{ type: 'user', user_id }`).
935
+ *
936
+ * Like every other I/O concern, the search is brokered by the host: the
937
+ * builder never looks people up itself.
938
+ */
939
+ interface MentionsConfig {
940
+ /**
941
+ * Searches the people the picker offers. Called with the text typed after
942
+ * `@` (empty right after it). Calls are debounced, and `signal` aborts once
943
+ * a newer query supersedes this one. A rejection shows an empty list.
944
+ */
945
+ searchUsers: (query: string, options: {
946
+ signal: AbortSignal;
947
+ }) => Promise<MentionUser[]>;
948
+ /**
949
+ * Optional. Labels a mention in the editor by user id, including mentions
950
+ * that came with the draft or a loaded message. Called while rendering, so
951
+ * keep it synchronous. Return `undefined` to fall back to the name picked
952
+ * from the search, then the raw id.
953
+ */
954
+ getUserName?: (userId: string) => string | undefined;
955
+ }
918
956
  /**
919
957
  * Hooks forwarded to `slack-blocks-to-jsx`'s `<Message>` so the consumer can
920
958
  * resolve user mentions, channel mentions, custom emojis, and links to
@@ -1032,6 +1070,13 @@ interface BlockKitchenBaseProps {
1032
1070
  * is never serialized into the emitted Block Kit JSON.
1033
1071
  */
1034
1072
  customEmojis?: CustomEmoji[];
1073
+ /**
1074
+ * Opt-in `@` mentions in the rich text editor: an `@` trigger and a toolbar
1075
+ * button that search people through the host. See {@link MentionsConfig}.
1076
+ * Without it, mentions already in the draft still round-trip and display by
1077
+ * raw id, but there is no picker.
1078
+ */
1079
+ mentions?: MentionsConfig;
1035
1080
  /**
1036
1081
  * Opt-in: load an existing Slack message into the editor. Adds a
1037
1082
  * "Find message" toolbar entry — the user pastes a permalink (or picks a
@@ -1315,4 +1360,4 @@ interface BlockKitchenComposeOnlyProps {
1315
1360
  */
1316
1361
  type BlockKitchenProps = BlockKitchenBaseProps & (BlockKitchenSendProps | BlockKitchenComposeOnlyProps);
1317
1362
 
1318
- export { type RecentMessage as $, type AlertBlock as A, type BlockKitchenProps as B, type ChannelOption as C, type DataVisualizationBlock as D, type EditableVia as E, type FeedbackButtonSubobject as F, type IconButtonIcon as G, type HeaderLevel as H, type IconButtonElement as I, type InputBlock as J, type LoadResult as K, type LoadMessageInput as L, type LoadedMessage as M, type LoadingConfig as N, type MarkdownBlock as O, type PreviewSurface as P, type PaletteMode as Q, type PaletteSection as R, type SupportedBlock as S, type Template as T, type PaletteVariant as U, type PieChart as V, type PieChartSegment as W, type PlanBlock as X, type PreviewHooks as Y, type PrimaryActionConfig as Z, type PrimaryActionContext as _, type SendAsUserStatus as a, type SendResult as a0, type SupportedBlockType as a1, type SupportedHeaderBlock as a2, type TableBlock as a3, type TableCell as a4, type TableColumnSetting as a5, type TaskCardBlock as a6, type TaskCardStatus as a7, type UpdatePayload as a8, type UpdateResult as a9, type UrlSourceElement as aa, type ValidationSummary as ab, type VideoBlock as ac, defaultPalette as ad, extraAlertVariant as ae, legacyInputVariants as af, buildVariantById as ag, type SendPayload as b, type SendExtrasContext as c, type PreviewTheme as d, type AlertLevel as e, type BlockKitchenBaseProps as f, type BlockKitchenComposeOnlyProps as g, type BlockKitchenSendProps as h, type BrandPreset as i, type BrandTheme as j, type BrandTokens as k, type BuilderBlock as l, type CardBlock as m, type CarouselBlock as n, type CartesianChart as o, type Chart as p, type ChartAxisConfig as q, type ChartDataPoint as r, type ChartSeries as s, type ChartType as t, type ContainerBlock as u, type ContainerChildBlock as v, type ContextActionsBlock as w, type ContextActionsElement as x, type CustomEmoji as y, type FeedbackButtonsElement as z };
1363
+ export { type PrimaryActionConfig as $, type AlertBlock as A, type BlockKitchenProps as B, type ChannelOption as C, type DataVisualizationBlock as D, type EditableVia as E, type FeedbackButtonSubobject as F, type IconButtonIcon as G, type HeaderLevel as H, type IconButtonElement as I, type InputBlock as J, type LoadResult as K, type LoadMessageInput as L, type LoadedMessage as M, type LoadingConfig as N, type MarkdownBlock as O, type PreviewSurface as P, type MentionUser as Q, type MentionsConfig as R, type SupportedBlock as S, type Template as T, type PaletteMode as U, type PaletteSection as V, type PaletteVariant as W, type PieChart as X, type PieChartSegment as Y, type PlanBlock as Z, type PreviewHooks as _, type SendAsUserStatus as a, type PrimaryActionContext as a0, type RecentMessage as a1, type SendResult as a2, type SupportedBlockType as a3, type SupportedHeaderBlock as a4, type TableBlock as a5, type TableCell as a6, type TableColumnSetting as a7, type TaskCardBlock as a8, type TaskCardStatus as a9, type UpdatePayload as aa, type UpdateResult as ab, type UrlSourceElement as ac, type ValidationSummary as ad, type VideoBlock as ae, defaultPalette as af, extraAlertVariant as ag, legacyInputVariants as ah, buildVariantById as ai, type SendPayload as b, type SendExtrasContext as c, type PreviewTheme as d, type AlertLevel as e, type BlockKitchenBaseProps as f, type BlockKitchenComposeOnlyProps as g, type BlockKitchenSendProps as h, type BrandPreset as i, type BrandTheme as j, type BrandTokens as k, type BuilderBlock as l, type CardBlock as m, type CarouselBlock as n, type CartesianChart as o, type Chart as p, type ChartAxisConfig as q, type ChartDataPoint as r, type ChartSeries as s, type ChartType as t, type ContainerBlock as u, type ContainerChildBlock as v, type ContextActionsBlock as w, type ContextActionsElement as x, type CustomEmoji as y, type FeedbackButtonsElement as z };
@@ -915,6 +915,44 @@ interface CustomEmoji {
915
915
  url: string | null;
916
916
  alias: string | null;
917
917
  }
918
+ /**
919
+ * A person the rich text editor's `@` picker offers, returned by
920
+ * {@link MentionsConfig.searchUsers}.
921
+ */
922
+ interface MentionUser {
923
+ /** Slack user id (`U…` / `W…`), written to the rich text `user` element's `user_id`. */
924
+ id: string;
925
+ /** Name shown in the picker row and on the inserted mention. */
926
+ name: string;
927
+ /** Avatar shown in the picker row. Ignored unless a safe image URL; rows without one show an initial. */
928
+ avatarUrl?: string | null;
929
+ }
930
+ /**
931
+ * Opt-in `@` mentions for the rich text editor, passed as
932
+ * {@link BlockKitchenBaseProps.mentions}. Typing `@` (or the toolbar's
933
+ * mention button) opens a picker backed by the host's search; picking someone
934
+ * inserts a rich text `user` element (`{ type: 'user', user_id }`).
935
+ *
936
+ * Like every other I/O concern, the search is brokered by the host: the
937
+ * builder never looks people up itself.
938
+ */
939
+ interface MentionsConfig {
940
+ /**
941
+ * Searches the people the picker offers. Called with the text typed after
942
+ * `@` (empty right after it). Calls are debounced, and `signal` aborts once
943
+ * a newer query supersedes this one. A rejection shows an empty list.
944
+ */
945
+ searchUsers: (query: string, options: {
946
+ signal: AbortSignal;
947
+ }) => Promise<MentionUser[]>;
948
+ /**
949
+ * Optional. Labels a mention in the editor by user id, including mentions
950
+ * that came with the draft or a loaded message. Called while rendering, so
951
+ * keep it synchronous. Return `undefined` to fall back to the name picked
952
+ * from the search, then the raw id.
953
+ */
954
+ getUserName?: (userId: string) => string | undefined;
955
+ }
918
956
  /**
919
957
  * Hooks forwarded to `slack-blocks-to-jsx`'s `<Message>` so the consumer can
920
958
  * resolve user mentions, channel mentions, custom emojis, and links to
@@ -1032,6 +1070,13 @@ interface BlockKitchenBaseProps {
1032
1070
  * is never serialized into the emitted Block Kit JSON.
1033
1071
  */
1034
1072
  customEmojis?: CustomEmoji[];
1073
+ /**
1074
+ * Opt-in `@` mentions in the rich text editor: an `@` trigger and a toolbar
1075
+ * button that search people through the host. See {@link MentionsConfig}.
1076
+ * Without it, mentions already in the draft still round-trip and display by
1077
+ * raw id, but there is no picker.
1078
+ */
1079
+ mentions?: MentionsConfig;
1035
1080
  /**
1036
1081
  * Opt-in: load an existing Slack message into the editor. Adds a
1037
1082
  * "Find message" toolbar entry — the user pastes a permalink (or picks a
@@ -1315,4 +1360,4 @@ interface BlockKitchenComposeOnlyProps {
1315
1360
  */
1316
1361
  type BlockKitchenProps = BlockKitchenBaseProps & (BlockKitchenSendProps | BlockKitchenComposeOnlyProps);
1317
1362
 
1318
- export { type RecentMessage as $, type AlertBlock as A, type BlockKitchenProps as B, type ChannelOption as C, type DataVisualizationBlock as D, type EditableVia as E, type FeedbackButtonSubobject as F, type IconButtonIcon as G, type HeaderLevel as H, type IconButtonElement as I, type InputBlock as J, type LoadResult as K, type LoadMessageInput as L, type LoadedMessage as M, type LoadingConfig as N, type MarkdownBlock as O, type PreviewSurface as P, type PaletteMode as Q, type PaletteSection as R, type SupportedBlock as S, type Template as T, type PaletteVariant as U, type PieChart as V, type PieChartSegment as W, type PlanBlock as X, type PreviewHooks as Y, type PrimaryActionConfig as Z, type PrimaryActionContext as _, type SendAsUserStatus as a, type SendResult as a0, type SupportedBlockType as a1, type SupportedHeaderBlock as a2, type TableBlock as a3, type TableCell as a4, type TableColumnSetting as a5, type TaskCardBlock as a6, type TaskCardStatus as a7, type UpdatePayload as a8, type UpdateResult as a9, type UrlSourceElement as aa, type ValidationSummary as ab, type VideoBlock as ac, defaultPalette as ad, extraAlertVariant as ae, legacyInputVariants as af, buildVariantById as ag, type SendPayload as b, type SendExtrasContext as c, type PreviewTheme as d, type AlertLevel as e, type BlockKitchenBaseProps as f, type BlockKitchenComposeOnlyProps as g, type BlockKitchenSendProps as h, type BrandPreset as i, type BrandTheme as j, type BrandTokens as k, type BuilderBlock as l, type CardBlock as m, type CarouselBlock as n, type CartesianChart as o, type Chart as p, type ChartAxisConfig as q, type ChartDataPoint as r, type ChartSeries as s, type ChartType as t, type ContainerBlock as u, type ContainerChildBlock as v, type ContextActionsBlock as w, type ContextActionsElement as x, type CustomEmoji as y, type FeedbackButtonsElement as z };
1363
+ export { type PrimaryActionConfig as $, type AlertBlock as A, type BlockKitchenProps as B, type ChannelOption as C, type DataVisualizationBlock as D, type EditableVia as E, type FeedbackButtonSubobject as F, type IconButtonIcon as G, type HeaderLevel as H, type IconButtonElement as I, type InputBlock as J, type LoadResult as K, type LoadMessageInput as L, type LoadedMessage as M, type LoadingConfig as N, type MarkdownBlock as O, type PreviewSurface as P, type MentionUser as Q, type MentionsConfig as R, type SupportedBlock as S, type Template as T, type PaletteMode as U, type PaletteSection as V, type PaletteVariant as W, type PieChart as X, type PieChartSegment as Y, type PlanBlock as Z, type PreviewHooks as _, type SendAsUserStatus as a, type PrimaryActionContext as a0, type RecentMessage as a1, type SendResult as a2, type SupportedBlockType as a3, type SupportedHeaderBlock as a4, type TableBlock as a5, type TableCell as a6, type TableColumnSetting as a7, type TaskCardBlock as a8, type TaskCardStatus as a9, type UpdatePayload as aa, type UpdateResult as ab, type UrlSourceElement as ac, type ValidationSummary as ad, type VideoBlock as ae, defaultPalette as af, extraAlertVariant as ag, legacyInputVariants as ah, buildVariantById as ai, type SendPayload as b, type SendExtrasContext as c, type PreviewTheme as d, type AlertLevel as e, type BlockKitchenBaseProps as f, type BlockKitchenComposeOnlyProps as g, type BlockKitchenSendProps as h, type BrandPreset as i, type BrandTheme as j, type BrandTokens as k, type BuilderBlock as l, type CardBlock as m, type CarouselBlock as n, type CartesianChart as o, type Chart as p, type ChartAxisConfig as q, type ChartDataPoint as r, type ChartSeries as s, type ChartType as t, type ContainerBlock as u, type ContainerChildBlock as v, type ContextActionsBlock as w, type ContextActionsElement as x, type CustomEmoji as y, type FeedbackButtonsElement as z };
@@ -1,3 +1,3 @@
1
- export { Q as PaletteMode, R as PaletteSection, U as PaletteVariant, S as SupportedBlock, a1 as SupportedBlockType, ag as buildVariantById, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-Cxh1yNzW.cjs';
1
+ export { U as PaletteMode, V as PaletteSection, W as PaletteVariant, S as SupportedBlock, a3 as SupportedBlockType, ai as buildVariantById, af as defaultPalette, ag as extraAlertVariant, ah as legacyInputVariants } from './palette-DNUiqoQK.cjs';
2
2
  import 'react';
3
3
  import 'slack-web-api-client';
package/dist/palette.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { Q as PaletteMode, R as PaletteSection, U as PaletteVariant, S as SupportedBlock, a1 as SupportedBlockType, ag as buildVariantById, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-Cxh1yNzW.js';
1
+ export { U as PaletteMode, V as PaletteSection, W as PaletteVariant, S as SupportedBlock, a3 as SupportedBlockType, ai as buildVariantById, af as defaultPalette, ag as extraAlertVariant, ah as legacyInputVariants } from './palette-DNUiqoQK.js';
2
2
  import 'react';
3
3
  import 'slack-web-api-client';