@tightknitai/block-kitchen 0.10.19 → 0.10.21
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/README.md +13 -4
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +748 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +749 -232
- package/dist/index.js.map +1 -1
- package/dist/{palette-DNUiqoQK.d.cts → palette-CXXqlwIH.d.cts} +82 -15
- package/dist/{palette-DNUiqoQK.d.ts → palette-CXXqlwIH.d.ts} +82 -15
- package/dist/palette.cjs +52 -0
- package/dist/palette.cjs.map +1 -1
- package/dist/palette.d.cts +1 -1
- package/dist/palette.d.ts +1 -1
- package/dist/palette.js +52 -0
- package/dist/palette.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -139,7 +139,7 @@ Given no height to work with — a plain `<div>` in ordinary document flow — i
|
|
|
139
139
|
| `confirmUpdateLabel` | `string` | no | Label for the update dialog's final confirm button. Defaults to `'Update message'` (shows `'Updating…'` while in flight). |
|
|
140
140
|
| `previewHooks` | `PreviewHooks` | no | Hooks forwarded to `slack-blocks-to-jsx`'s `<Message>` for resolving user / channel / emoji directives. |
|
|
141
141
|
| `customEmojis` | `CustomEmoji[]` | no | Workspace custom emoji (`{ name, url, alias }`) the preview resolves. Entries with a `url` render `:name:` as the workspace image; alias entries (`url: null`) fall back to their target emoji. Render-only — never serialized into the emitted Block Kit JSON. A caller-supplied `previewHooks.emoji` takes precedence. |
|
|
142
|
-
| `mentions` | `{ searchUsers, getUserName? }` | no | Opt-in
|
|
142
|
+
| `mentions` | `{ searchUsers, getUserName?, searchChannels?, getChannelName? }` | no | Opt-in rich-text mentions. `@` and the Mention button search users; when `searchChannels` is provided, `#` and the Channel button search channels. Picks serialize as Slack `user` / `channel` elements. See [Mentions](#mentions-opt-in). |
|
|
143
143
|
| `palette` | `PaletteSection[]` | no | The left-hand palette of draggable variants. Defaults to `defaultPalette`. Spread it to filter, reorder, or add your own pre-configured variants — see [Customizing the palette](#customizing-the-palette). |
|
|
144
144
|
| `disabledBlockTypes` | `SupportedBlockType[]` | no | Block types to hide from the palette without rebuilding it. Filters at the variant level — a section keeps any variants whose block types aren't disabled; sections that end up empty are dropped. Convenient when you want the default palette minus a few types (e.g. `['image', 'table']` for a text-only builder). |
|
|
145
145
|
| `paletteMode` | `'advanced' \| 'simple'` | no | How much of the palette the user meets first. `'advanced'` (default) renders the full sectioned palette with its search input. `'simple'` opens on a flat list of the variants flagged `basic` — in the built-in palette: **Header**, **Divider**, **Rich Text Section** and **Image** — with no search and an "Advanced" link at the top that swaps in the full palette. Nothing is removed; it's a smaller first screen. See [Simple vs advanced palette](#simple-vs-advanced-palette). |
|
|
@@ -608,8 +608,9 @@ import type {
|
|
|
608
608
|
BlockKitchenSendProps, // the send trio + `onUpdate` + `renderSendExtras`
|
|
609
609
|
LoadingConfig, // load an existing message (works in both modes)
|
|
610
610
|
LoadedMessage, // the loaded target: channel + ts + verdict
|
|
611
|
-
MentionsConfig, // opt-in `@` mentions: host search + name lookup
|
|
611
|
+
MentionsConfig, // opt-in `@` / `#` mentions: host search + name lookup
|
|
612
612
|
MentionUser, // one person the `@` picker offers
|
|
613
|
+
MentionChannel, // one channel the `#` picker offers
|
|
613
614
|
BlockKitchenComposeOnlyProps, // the trio explicitly absent + `primaryAction`
|
|
614
615
|
PaletteSection,
|
|
615
616
|
PaletteVariant,
|
|
@@ -642,6 +643,8 @@ Pass [`customEmojis`](#props) to add your workspace's custom emoji: image entrie
|
|
|
642
643
|
|
|
643
644
|
Pass `mentions` to let people `@`-mention someone in the rich-text WYSIWYG editor. Typing `@` (after a space or at the start of a line, so `name@domain` is left alone) or clicking the toolbar's **Mention** button opens a picker backed by your search. Picking someone inserts a rich text `user` element, `{ type: "user", user_id }`. The picker's name and avatar are never serialized.
|
|
644
645
|
|
|
646
|
+
Add `searchChannels` to enable the matching `#` trigger and **Channel** toolbar button. Picking a channel inserts `{ type: "channel", channel_id }`; its display name is never serialized.
|
|
647
|
+
|
|
645
648
|
```tsx
|
|
646
649
|
<BlockKitchen
|
|
647
650
|
mentions={{
|
|
@@ -654,13 +657,19 @@ Pass `mentions` to let people `@`-mention someone in the rich-text WYSIWYG edito
|
|
|
654
657
|
},
|
|
655
658
|
// Optional: labels mentions in the editor by id, including ones that came
|
|
656
659
|
// with the draft or a loaded message. Return undefined when unknown.
|
|
657
|
-
getUserName: (userId) =>
|
|
660
|
+
getUserName: (userId) => userNames.get(userId),
|
|
661
|
+
searchChannels: async (query, { signal }) => {
|
|
662
|
+
const res = await fetch(`/api/channels?q=${encodeURIComponent(query)}`, { signal });
|
|
663
|
+
const channels = await res.json();
|
|
664
|
+
return channels.map((channel) => ({ id: channel.id, name: channel.name }));
|
|
665
|
+
},
|
|
666
|
+
getChannelName: (channelId) => channelNames.get(channelId)
|
|
658
667
|
}}
|
|
659
668
|
{...rest}
|
|
660
669
|
/>
|
|
661
670
|
```
|
|
662
671
|
|
|
663
|
-
|
|
672
|
+
User and channel mentions already in a draft round-trip through the WYSIWYG with or without picker configuration. Labels resolve through `getUserName` / `getChannelName`, then the name captured when picked, then the raw id. The builder never looks users or channels up itself. To show names in the Slack preview too, resolve the ids in [`previewHooks`](#props).
|
|
664
673
|
|
|
665
674
|
## Validation
|
|
666
675
|
|
package/dist/helpers.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SupportedBlock } from './palette-
|
|
2
|
-
export {
|
|
1
|
+
import { S as SupportedBlock } from './palette-CXXqlwIH.cjs';
|
|
2
|
+
export { a8 as SupportedBlockType } from './palette-CXXqlwIH.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'slack-web-api-client';
|
|
5
5
|
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SupportedBlock } from './palette-
|
|
2
|
-
export {
|
|
1
|
+
import { S as SupportedBlock } from './palette-CXXqlwIH.js';
|
|
2
|
+
export { a8 as SupportedBlockType } from './palette-CXXqlwIH.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'slack-web-api-client';
|
|
5
5
|
|