@nkootstra/block-kit 0.4.0 → 0.5.0

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.
@@ -533,6 +533,66 @@ interface Resolvers {
533
533
  userProfile?: (id: string) => UserProfile | undefined;
534
534
  channel?: (id: string) => string | undefined;
535
535
  usergroup?: (id: string) => string | undefined;
536
+ /**
537
+ * A `slack_file` image's URL, and its size in bytes for Slack's "(N kB)" caption, e.g. from
538
+ * `files.info`. Slack files aren't public, so without this an image block shows a placeholder.
539
+ */
540
+ slackFile?: (file: {
541
+ id?: string;
542
+ url?: string;
543
+ }) => ResolvedSlackFile | undefined;
544
+ /**
545
+ * An `image_url` image block's size in bytes, for Slack's "(N kB)" caption. Slack shows the size
546
+ * of the image it downloaded (not the payload's `image_bytes`); the library doesn't download it,
547
+ * so without this the caption is left out.
548
+ */
549
+ imageSize?: (url: string) => number | undefined;
550
+ /**
551
+ * The people and channels a users, conversations or channels select lists when it opens, the way
552
+ * Slack lists the workspace's members and channels, in the order to show them. The select filters
553
+ * them by what's typed. Without it the list stays empty, and typing an ID and pressing Enter picks
554
+ * it.
555
+ */
556
+ directory?: (source: "users" | "conversations" | "channels") => DirectoryEntry[] | undefined;
557
+ }
558
+ /** A row in a users, conversations or channels select: a person or a channel. */
559
+ type DirectoryEntry = DirectoryUser | DirectoryChannel;
560
+ /** A person in a users or conversations select, laid out like Slack's member rows. */
561
+ interface DirectoryUser {
562
+ type: "user";
563
+ /** The user ID the select sends, e.g. `U0123456789`. */
564
+ id: string;
565
+ /** The display name, shown in bold. */
566
+ name: string;
567
+ /** The full name, shown after the presence icon when it's given. */
568
+ realName?: string;
569
+ /** A 20px avatar image. Without it the avatar is a grey square. */
570
+ avatarUrl?: string;
571
+ /** The signed-in user, marked "(you)". */
572
+ self?: boolean;
573
+ /** A small label after the name, e.g. `"APP"` or `"AGENT"` for an app's bot user. */
574
+ badge?: string;
575
+ /** A bot user, left out of a conversations select whose `filter` sets `exclude_bot_users`. */
576
+ bot?: boolean;
577
+ /** Slack's presence icon after the name. */
578
+ presence?: "active" | "snoozed" | "slackbot";
579
+ }
580
+ /** A channel in a channels or conversations select. */
581
+ interface DirectoryChannel {
582
+ type: "channel";
583
+ /** The channel ID the select sends, e.g. `C0123456789`. */
584
+ id: string;
585
+ /** The name, without `#`. */
586
+ name: string;
587
+ /** Shows the lock icon instead of `#`. */
588
+ private?: boolean;
589
+ }
590
+ /** What {@link Resolvers.slackFile} returns for a file it knows. */
591
+ interface ResolvedSlackFile {
592
+ /** A URL the browser can load, e.g. the file's `url_private` behind your own proxy. */
593
+ url: string;
594
+ /** The file's size in bytes. */
595
+ size?: number;
536
596
  }
537
597
  interface EmojiOptions {
538
598
  /**
@@ -651,6 +711,8 @@ interface BlockKitContextValue {
651
711
  state: StateValues;
652
712
  /** Records an element's current value. Elements call this on every change. */
653
713
  setValue: (blockId: string, actionId: string, value: ElementState | undefined) => void;
714
+ /** Records `value` only when the element has none yet: an input block's empty state in a view. */
715
+ seedValue: (blockId: string, actionId: string, value: ElementState) => void;
654
716
  /**
655
717
  * Reports an action, passing the current state along. `scope` is the surface it happened in;
656
718
  * surfaces bind it for their elements, so elements never pass it themselves.
@@ -970,5 +1032,5 @@ declare const VALIDATION_MESSAGES: {
970
1032
  */
971
1033
  declare function validateView(blocks: readonly Json[] | readonly unknown[], state: StateValues): Record<string, string>;
972
1034
  //#endregion
973
- export { useLiveView as $, BlockAction as A, PayloadContext as B, SlackAttachment as C, Block as Ct, elementComponents as D, Json as Dt, SlackReaction as E, ElementProps as Et, EmojiOptions as F, Surface as G, StackedView as H, LinkProps as I, SurfaceScopeValue as J, SurfaceScope as K, MentionRef as L, BlockKitProvider as M, BlockKitProviderProps as N, Element as O, ElementState as P, useContainer as Q, MessageApi as R, MessageProps as S, blockComponents as St, SlackMessageLike as T, BlockProps as Tt, StateValues as U, Resolvers as V, SubmitResult as W, ViewsApi as X, UserProfile as Y, useBlockKit as Z, HomeTabView as _, ViewResponseAction as _t, Tooltip as a, BuildViewSubmissionPayloadOptions as at, Message as b, buildViewClosedPayload as bt, TextObject as c, MessageContainer as ct, ViewProps as d, PayloadTeam as dt, BlockActionsPayload as et, Modal as f, PayloadUser as ft, HomeTabProps as g, ViewLike as gt, HomeTab as h, ViewContainer as ht, UserMentionProps as i, BuildViewClosedPayloadOptions as it, BlockKitContextValue as j, ActionContext as k, AnyView as l, OptionsResponse as lt, ModalView as m, ViewBlockActionsPayload as mt, validateView as n, BuildBlockActionsPayloadOptions as nt, TooltipProps as o, Container as ot, ModalProps as p, SuggestionOption as pt, SurfaceScopeProps as q, UserMention as r, BuildBlockSuggestionPayloadOptions as rt, Text as s, MessageBlockActionsPayload as st, VALIDATION_MESSAGES as t, BlockSuggestionPayload as tt, View as u, PayloadIdentity as ut, Mrkdwn as v, buildBlockActionsPayload as vt, SlackAttachmentField as w, Blocks as wt, MessageApp as x, buildViewSubmissionPayload as xt, MrkdwnProps as y, buildBlockSuggestionPayload as yt, MessageUpdate as z };
974
- //# sourceMappingURL=index--GXgMjw3.d.ts.map
1035
+ export { UserProfile as $, BlockAction as A, ElementProps as At, MentionRef as B, SlackAttachment as C, buildBlockSuggestionPayload as Ct, elementComponents as D, Block as Dt, SlackReaction as E, blockComponents as Et, DirectoryEntry as F, Resolvers as G, MessageUpdate as H, DirectoryUser as I, SubmitResult as J, StackedView as K, ElementState as L, BlockKitProvider as M, BlockKitProviderProps as N, Element as O, Blocks as Ot, DirectoryChannel as P, SurfaceScopeValue as Q, EmojiOptions as R, MessageProps as S, buildBlockActionsPayload as St, SlackMessageLike as T, buildViewSubmissionPayload as Tt, PayloadContext as U, MessageApi as V, ResolvedSlackFile as W, SurfaceScope as X, Surface as Y, SurfaceScopeProps as Z, HomeTabView as _, SuggestionOption as _t, Tooltip as a, BlockSuggestionPayload as at, Message as b, ViewLike as bt, TextObject as c, BuildViewClosedPayloadOptions as ct, ViewProps as d, MessageBlockActionsPayload as dt, ViewsApi as et, Modal as f, MessageContainer as ft, HomeTabProps as g, PayloadUser as gt, HomeTab as h, PayloadTeam as ht, UserMentionProps as i, BlockActionsPayload as it, BlockKitContextValue as j, Json as jt, ActionContext as k, BlockProps as kt, AnyView as l, BuildViewSubmissionPayloadOptions as lt, ModalView as m, PayloadIdentity as mt, validateView as n, useContainer as nt, TooltipProps as o, BuildBlockActionsPayloadOptions as ot, ModalProps as p, OptionsResponse as pt, StateValues as q, UserMention as r, useLiveView as rt, Text as s, BuildBlockSuggestionPayloadOptions as st, VALIDATION_MESSAGES as t, useBlockKit as tt, View as u, Container as ut, Mrkdwn as v, ViewBlockActionsPayload as vt, SlackAttachmentField as w, buildViewClosedPayload as wt, MessageApp as x, ViewResponseAction as xt, MrkdwnProps as y, ViewContainer as yt, LinkProps as z };
1036
+ //# sourceMappingURL=index-xHrfGT5m.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
- import { $ as useLiveView, A as BlockAction, B as PayloadContext, C as SlackAttachment, Ct as Block, D as elementComponents, Dt as Json, E as SlackReaction, Et as ElementProps, F as EmojiOptions, G as Surface, H as StackedView, I as LinkProps, J as SurfaceScopeValue, K as SurfaceScope, L as MentionRef, M as BlockKitProvider, N as BlockKitProviderProps, O as Element, P as ElementState, Q as useContainer, R as MessageApi, S as MessageProps, St as blockComponents, T as SlackMessageLike, Tt as BlockProps, U as StateValues, V as Resolvers, W as SubmitResult, X as ViewsApi, Y as UserProfile, Z as useBlockKit, _ as HomeTabView, _t as ViewResponseAction, a as Tooltip, at as BuildViewSubmissionPayloadOptions, b as Message, bt as buildViewClosedPayload, c as TextObject, ct as MessageContainer, d as ViewProps, dt as PayloadTeam, et as BlockActionsPayload, f as Modal, ft as PayloadUser, g as HomeTabProps, gt as ViewLike, h as HomeTab, ht as ViewContainer, i as UserMentionProps, it as BuildViewClosedPayloadOptions, j as BlockKitContextValue, k as ActionContext, l as AnyView, lt as OptionsResponse, m as ModalView, mt as ViewBlockActionsPayload, n as validateView, nt as BuildBlockActionsPayloadOptions, o as TooltipProps, ot as Container, p as ModalProps, pt as SuggestionOption, q as SurfaceScopeProps, r as UserMention, rt as BuildBlockSuggestionPayloadOptions, s as Text, st as MessageBlockActionsPayload, t as VALIDATION_MESSAGES, tt as BlockSuggestionPayload, u as View, ut as PayloadIdentity, v as Mrkdwn, vt as buildBlockActionsPayload, w as SlackAttachmentField, wt as Blocks, x as MessageApp, xt as buildViewSubmissionPayload, y as MrkdwnProps, yt as buildBlockSuggestionPayload, z as MessageUpdate } from "./index--GXgMjw3.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, type LinkProps, type MentionRef, 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 };
2
+ import { $ as UserProfile, A as BlockAction, At as ElementProps, B as MentionRef, C as SlackAttachment, Ct as buildBlockSuggestionPayload, D as elementComponents, Dt as Block, E as SlackReaction, Et as blockComponents, F as DirectoryEntry, G as Resolvers, H as MessageUpdate, I as DirectoryUser, J as SubmitResult, K as StackedView, L as ElementState, M as BlockKitProvider, N as BlockKitProviderProps, O as Element, Ot as Blocks, P as DirectoryChannel, Q as SurfaceScopeValue, R as EmojiOptions, S as MessageProps, St as buildBlockActionsPayload, T as SlackMessageLike, Tt as buildViewSubmissionPayload, U as PayloadContext, V as MessageApi, W as ResolvedSlackFile, X as SurfaceScope, Y as Surface, Z as SurfaceScopeProps, _ as HomeTabView, _t as SuggestionOption, a as Tooltip, at as BlockSuggestionPayload, b as Message, bt as ViewLike, c as TextObject, ct as BuildViewClosedPayloadOptions, d as ViewProps, dt as MessageBlockActionsPayload, et as ViewsApi, f as Modal, ft as MessageContainer, g as HomeTabProps, gt as PayloadUser, h as HomeTab, ht as PayloadTeam, i as UserMentionProps, it as BlockActionsPayload, j as BlockKitContextValue, jt as Json, k as ActionContext, kt as BlockProps, l as AnyView, lt as BuildViewSubmissionPayloadOptions, m as ModalView, mt as PayloadIdentity, n as validateView, nt as useContainer, o as TooltipProps, ot as BuildBlockActionsPayloadOptions, p as ModalProps, pt as OptionsResponse, q as StateValues, r as UserMention, rt as useLiveView, s as Text, st as BuildBlockSuggestionPayloadOptions, t as VALIDATION_MESSAGES, tt as useBlockKit, u as View, ut as Container, v as Mrkdwn, vt as ViewBlockActionsPayload, w as SlackAttachmentField, wt as buildViewClosedPayload, x as MessageApp, xt as ViewResponseAction, y as MrkdwnProps, yt as ViewContainer, z as LinkProps } from "./index-xHrfGT5m.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, type DirectoryChannel, type DirectoryEntry, type DirectoryUser, Element, type ElementProps, type ElementState, type EmojiOptions, HomeTab, type HomeTabProps, type HomeTabView, type Json, type LinkProps, type MentionRef, 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 ResolvedSlackFile, 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 };