@nkootstra/block-kit 0.3.5 → 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.
- package/dist/{index-DXUlQCUq.d.ts → index-xHrfGT5m.d.ts} +88 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3195 -928
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/transport.d.ts +1 -1
- package/dist/web-api.d.ts +1 -1
- package/package.json +1 -1
|
@@ -225,8 +225,6 @@ interface BuildViewSubmissionPayloadOptions {
|
|
|
225
225
|
}
|
|
226
226
|
/** Slack's `view_submission` payload, sent when the modal's Submit button is pressed. */
|
|
227
227
|
declare function buildViewSubmissionPayload({ view, state, identity, responseUrls }: BuildViewSubmissionPayloadOptions): {
|
|
228
|
-
type: "view_submission";
|
|
229
|
-
team: PayloadTeam | null;
|
|
230
228
|
user: {
|
|
231
229
|
id: string;
|
|
232
230
|
name: string;
|
|
@@ -276,6 +274,13 @@ declare function buildViewSubmissionPayload({ view, state, identity, responseUrl
|
|
|
276
274
|
channel_id: string;
|
|
277
275
|
response_url: string;
|
|
278
276
|
}[];
|
|
277
|
+
enterprise: {
|
|
278
|
+
id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
} | null;
|
|
281
|
+
is_enterprise_install: boolean;
|
|
282
|
+
type: "view_submission";
|
|
283
|
+
team: PayloadTeam | null;
|
|
279
284
|
};
|
|
280
285
|
interface BuildViewClosedPayloadOptions {
|
|
281
286
|
view: ViewLike;
|
|
@@ -286,8 +291,6 @@ interface BuildViewClosedPayloadOptions {
|
|
|
286
291
|
}
|
|
287
292
|
/** Slack's `view_closed` payload, sent when the modal's close (X) button is pressed. */
|
|
288
293
|
declare function buildViewClosedPayload({ view, state, identity, isCleared }: BuildViewClosedPayloadOptions): {
|
|
289
|
-
type: "view_closed";
|
|
290
|
-
team: PayloadTeam | null;
|
|
291
294
|
user: {
|
|
292
295
|
id: string;
|
|
293
296
|
name: string;
|
|
@@ -331,6 +334,13 @@ declare function buildViewClosedPayload({ view, state, identity, isCleared }: Bu
|
|
|
331
334
|
external_id: string;
|
|
332
335
|
};
|
|
333
336
|
is_cleared: boolean;
|
|
337
|
+
enterprise: {
|
|
338
|
+
id: string;
|
|
339
|
+
name: string;
|
|
340
|
+
} | null;
|
|
341
|
+
is_enterprise_install: boolean;
|
|
342
|
+
type: "view_closed";
|
|
343
|
+
team: PayloadTeam | null;
|
|
334
344
|
};
|
|
335
345
|
/** The subset of `ack()` response actions a modal reacts to: validation errors, or view navigation. */
|
|
336
346
|
type ViewResponseAction = {
|
|
@@ -396,6 +406,11 @@ declare function buildBlockSuggestionPayload({ actionId, blockId, value, contain
|
|
|
396
406
|
name: string;
|
|
397
407
|
} | undefined;
|
|
398
408
|
message: Record<string, unknown>;
|
|
409
|
+
enterprise: {
|
|
410
|
+
id: string;
|
|
411
|
+
name: string;
|
|
412
|
+
} | null;
|
|
413
|
+
is_enterprise_install: boolean;
|
|
399
414
|
type: "block_suggestion";
|
|
400
415
|
user: PayloadUser;
|
|
401
416
|
api_app_id: string;
|
|
@@ -447,6 +462,11 @@ declare function buildBlockSuggestionPayload({ actionId, blockId, value, contain
|
|
|
447
462
|
previous_view_id: string | null;
|
|
448
463
|
external_id: string;
|
|
449
464
|
};
|
|
465
|
+
enterprise: {
|
|
466
|
+
id: string;
|
|
467
|
+
name: string;
|
|
468
|
+
} | null;
|
|
469
|
+
is_enterprise_install: boolean;
|
|
450
470
|
type: "block_suggestion";
|
|
451
471
|
user: PayloadUser;
|
|
452
472
|
api_app_id: string;
|
|
@@ -513,6 +533,66 @@ interface Resolvers {
|
|
|
513
533
|
userProfile?: (id: string) => UserProfile | undefined;
|
|
514
534
|
channel?: (id: string) => string | undefined;
|
|
515
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;
|
|
516
596
|
}
|
|
517
597
|
interface EmojiOptions {
|
|
518
598
|
/**
|
|
@@ -631,6 +711,8 @@ interface BlockKitContextValue {
|
|
|
631
711
|
state: StateValues;
|
|
632
712
|
/** Records an element's current value. Elements call this on every change. */
|
|
633
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;
|
|
634
716
|
/**
|
|
635
717
|
* Reports an action, passing the current state along. `scope` is the surface it happened in;
|
|
636
718
|
* surfaces bind it for their elements, so elements never pass it themselves.
|
|
@@ -950,5 +1032,5 @@ declare const VALIDATION_MESSAGES: {
|
|
|
950
1032
|
*/
|
|
951
1033
|
declare function validateView(blocks: readonly Json[] | readonly unknown[], state: StateValues): Record<string, string>;
|
|
952
1034
|
//#endregion
|
|
953
|
-
export {
|
|
954
|
-
//# sourceMappingURL=index-
|
|
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
|
|
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 };
|