@tightknitai/block-kitchen 0.10.23 → 0.10.24
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 +14 -0
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +170 -152
- 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 +170 -152
- package/dist/index.js.map +1 -1
- package/dist/{palette-DFTL0Han.d.cts → palette-Bup6i-9c.d.cts} +7 -0
- package/dist/{palette-DFTL0Han.d.ts → palette-Bup6i-9c.d.ts} +7 -0
- package/dist/palette.d.cts +1 -1
- package/dist/palette.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +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
|
| `blockActions` | `BlockAction[]` | no | Host buttons added to every block's action toolbar, before Edit / Duplicate / Delete. Each is `{ id, label, icon, onSelect }`, and `onSelect` receives the block's `{ index, childIndex }`. See [Adding your own block actions](#adding-your-own-block-actions-blockactions). |
|
|
142
|
+
| `renderBlockAdornment` | `(position: BlockPosition) => ReactNode` | no | Host content shown beside every block, at its right edge, all the time (unlike `blockActions`, which show on hover), e.g. a count of comments on the block. Return `null` for a block with nothing to show. See [Adding your own block actions](#adding-your-own-block-actions-blockactions). |
|
|
142
143
|
| `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. |
|
|
143
144
|
| `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). |
|
|
144
145
|
| `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). |
|
|
@@ -467,6 +468,19 @@ top-level block). Map it onto the blocks `onChange` last reported; builder
|
|
|
467
468
|
ids never leave the package. An `svg` icon is sized to match the built-in
|
|
468
469
|
ones.
|
|
469
470
|
|
|
471
|
+
For something that should show all the time, like a count of comments on
|
|
472
|
+
each block, pass `renderBlockAdornment`. It's called with the same position
|
|
473
|
+
and renders beside the block, at its right edge; return `null` for a block
|
|
474
|
+
with nothing to show:
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
<BlockKitchen
|
|
478
|
+
renderBlockAdornment={({ index, childIndex }) =>
|
|
479
|
+
childIndex === null && counts[index] ? <CommentCount count={counts[index]} /> : null
|
|
480
|
+
}
|
|
481
|
+
/>
|
|
482
|
+
```
|
|
483
|
+
|
|
470
484
|
Each block's row also carries `data-bk-block-index` (plus
|
|
471
485
|
`data-bk-child-index` inside a container), so the host can find a block on
|
|
472
486
|
the canvas, for example to scroll to it or highlight it:
|
package/dist/helpers.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SupportedBlock } from './palette-
|
|
2
|
-
export { aa as SupportedBlockType } from './palette-
|
|
1
|
+
import { S as SupportedBlock } from './palette-Bup6i-9c.cjs';
|
|
2
|
+
export { aa as SupportedBlockType } from './palette-Bup6i-9c.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 { aa as SupportedBlockType } from './palette-
|
|
1
|
+
import { S as SupportedBlock } from './palette-Bup6i-9c.js';
|
|
2
|
+
export { aa as SupportedBlockType } from './palette-Bup6i-9c.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'slack-web-api-client';
|
|
5
5
|
|
package/dist/index.cjs
CHANGED
|
@@ -10501,7 +10501,8 @@ function BlockRow({
|
|
|
10501
10501
|
onReorder,
|
|
10502
10502
|
isPaletteDrag = false,
|
|
10503
10503
|
position,
|
|
10504
|
-
blockActions
|
|
10504
|
+
blockActions,
|
|
10505
|
+
renderBlockAdornment
|
|
10505
10506
|
}) {
|
|
10506
10507
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging, isOver } = sortable.useSortable({
|
|
10507
10508
|
id: builderBlock.id
|
|
@@ -10516,6 +10517,63 @@ function BlockRow({
|
|
|
10516
10517
|
const [inlineEditing, setInlineEditing] = React.useState(false);
|
|
10517
10518
|
const showDropIndicator = isPaletteDrag && isOver;
|
|
10518
10519
|
const preview = /* @__PURE__ */ jsxRuntime.jsx(SlackBlockPreview, { block: builderBlock.block, hooks: previewHooks, theme: previewTheme });
|
|
10520
|
+
const body = isRichText && inlineEditing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10521
|
+
RichTextInlineEditor,
|
|
10522
|
+
{
|
|
10523
|
+
block: builderBlock.block,
|
|
10524
|
+
onSave: (next) => {
|
|
10525
|
+
onUpdate(builderBlock.id, next);
|
|
10526
|
+
setInlineEditing(false);
|
|
10527
|
+
},
|
|
10528
|
+
onCancel: () => setInlineEditing(false)
|
|
10529
|
+
}
|
|
10530
|
+
) : isRichText ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10531
|
+
"button",
|
|
10532
|
+
{
|
|
10533
|
+
type: "button",
|
|
10534
|
+
"aria-label": "Edit block",
|
|
10535
|
+
onClick: () => setInlineEditing(true),
|
|
10536
|
+
...attributes,
|
|
10537
|
+
...listeners,
|
|
10538
|
+
className: cn(
|
|
10539
|
+
"block w-full cursor-grab rounded-sm border-0 bg-transparent p-0 text-left transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10540
|
+
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10541
|
+
),
|
|
10542
|
+
children: preview
|
|
10543
|
+
}
|
|
10544
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange, children: [
|
|
10545
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10546
|
+
"div",
|
|
10547
|
+
{
|
|
10548
|
+
role: "button",
|
|
10549
|
+
tabIndex: 0,
|
|
10550
|
+
"aria-label": "Edit block",
|
|
10551
|
+
...sortableA11yAttrs,
|
|
10552
|
+
...listeners,
|
|
10553
|
+
onKeyDown: (e) => {
|
|
10554
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10555
|
+
e.preventDefault();
|
|
10556
|
+
onOpenChange?.(!isOpen);
|
|
10557
|
+
}
|
|
10558
|
+
},
|
|
10559
|
+
className: cn(
|
|
10560
|
+
"block w-full cursor-grab rounded-sm transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10561
|
+
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10562
|
+
),
|
|
10563
|
+
children: preview
|
|
10564
|
+
}
|
|
10565
|
+
) }),
|
|
10566
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10567
|
+
BlockEditor,
|
|
10568
|
+
{
|
|
10569
|
+
block: builderBlock.block,
|
|
10570
|
+
errors,
|
|
10571
|
+
onChange: (next) => onUpdate(builderBlock.id, next),
|
|
10572
|
+
onDone: () => onOpenChange?.(false)
|
|
10573
|
+
}
|
|
10574
|
+
) })
|
|
10575
|
+
] });
|
|
10576
|
+
const adornment = position && renderBlockAdornment?.(position);
|
|
10519
10577
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10520
10578
|
"div",
|
|
10521
10579
|
{
|
|
@@ -10534,62 +10592,10 @@ function BlockRow({
|
|
|
10534
10592
|
}
|
|
10535
10593
|
) : null,
|
|
10536
10594
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
{
|
|
10540
|
-
|
|
10541
|
-
onSave: (next) => {
|
|
10542
|
-
onUpdate(builderBlock.id, next);
|
|
10543
|
-
setInlineEditing(false);
|
|
10544
|
-
},
|
|
10545
|
-
onCancel: () => setInlineEditing(false)
|
|
10546
|
-
}
|
|
10547
|
-
) : isRichText ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10548
|
-
"button",
|
|
10549
|
-
{
|
|
10550
|
-
type: "button",
|
|
10551
|
-
"aria-label": "Edit block",
|
|
10552
|
-
onClick: () => setInlineEditing(true),
|
|
10553
|
-
...attributes,
|
|
10554
|
-
...listeners,
|
|
10555
|
-
className: cn(
|
|
10556
|
-
"block w-full cursor-grab rounded-sm border-0 bg-transparent p-0 text-left transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10557
|
-
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10558
|
-
),
|
|
10559
|
-
children: preview
|
|
10560
|
-
}
|
|
10561
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange, children: [
|
|
10562
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10563
|
-
"div",
|
|
10564
|
-
{
|
|
10565
|
-
role: "button",
|
|
10566
|
-
tabIndex: 0,
|
|
10567
|
-
"aria-label": "Edit block",
|
|
10568
|
-
...sortableA11yAttrs,
|
|
10569
|
-
...listeners,
|
|
10570
|
-
onKeyDown: (e) => {
|
|
10571
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
10572
|
-
e.preventDefault();
|
|
10573
|
-
onOpenChange?.(!isOpen);
|
|
10574
|
-
}
|
|
10575
|
-
},
|
|
10576
|
-
className: cn(
|
|
10577
|
-
"block w-full cursor-grab rounded-sm transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10578
|
-
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10579
|
-
),
|
|
10580
|
-
children: preview
|
|
10581
|
-
}
|
|
10582
|
-
) }),
|
|
10583
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10584
|
-
BlockEditor,
|
|
10585
|
-
{
|
|
10586
|
-
block: builderBlock.block,
|
|
10587
|
-
errors,
|
|
10588
|
-
onChange: (next) => onUpdate(builderBlock.id, next),
|
|
10589
|
-
onDone: () => onOpenChange?.(false)
|
|
10590
|
-
}
|
|
10591
|
-
) })
|
|
10592
|
-
] }),
|
|
10595
|
+
renderBlockAdornment ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
10596
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: body }),
|
|
10597
|
+
adornment != null && adornment !== false ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: adornment }) : null
|
|
10598
|
+
] }) : body,
|
|
10593
10599
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "-translate-x-1/2 pointer-events-none absolute bottom-full left-1/2 z-10 hidden bg-background px-1.5 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 md:block", children: BLOCK_TYPE_LABELS[builderBlock.block.type] }),
|
|
10594
10600
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10595
10601
|
"div",
|
|
@@ -10801,7 +10807,8 @@ function ContainerRow({
|
|
|
10801
10807
|
index,
|
|
10802
10808
|
total,
|
|
10803
10809
|
isPaletteDrag = false,
|
|
10804
|
-
blockActions
|
|
10810
|
+
blockActions,
|
|
10811
|
+
renderBlockAdornment
|
|
10805
10812
|
}) {
|
|
10806
10813
|
const { id } = builderBlock;
|
|
10807
10814
|
const block = builderBlock.block;
|
|
@@ -10815,105 +10822,111 @@ function ContainerRow({
|
|
|
10815
10822
|
const style = { transform: utilities.CSS.Transform.toString(transform), transition };
|
|
10816
10823
|
const icon = block.icon && "image_url" in block.icon ? block.icon.image_url : void 0;
|
|
10817
10824
|
const position = typeof index === "number" ? { index, childIndex: null } : void 0;
|
|
10818
|
-
|
|
10825
|
+
const adornment = position && renderBlockAdornment?.(position);
|
|
10826
|
+
const card = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10819
10827
|
"div",
|
|
10820
10828
|
{
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10829
|
+
className: cn(
|
|
10830
|
+
"overflow-hidden rounded-md border bg-card transition-shadow",
|
|
10831
|
+
hasErrors ? "border-destructive/60" : "border-border"
|
|
10832
|
+
),
|
|
10825
10833
|
children: [
|
|
10826
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10834
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isOpen, onOpenChange: (open) => onOpenBlockChange?.(open ? id : null), children: [
|
|
10835
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10836
|
+
"div",
|
|
10837
|
+
{
|
|
10838
|
+
role: "button",
|
|
10839
|
+
tabIndex: 0,
|
|
10840
|
+
"aria-label": "Edit container",
|
|
10841
|
+
...sortableA11yAttrs,
|
|
10842
|
+
...listeners,
|
|
10843
|
+
onKeyDown: (e) => {
|
|
10844
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10845
|
+
e.preventDefault();
|
|
10846
|
+
onOpenBlockChange?.(!isOpen ? id : null);
|
|
10847
|
+
}
|
|
10848
|
+
},
|
|
10849
|
+
className: "flex w-full cursor-grab items-center gap-2 border-b bg-muted/40 px-3 py-2 text-left transition-colors hover:bg-muted active:cursor-grabbing",
|
|
10850
|
+
children: [
|
|
10851
|
+
icon ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: icon, alt: "", "aria-hidden": "true", className: "h-5 w-5 shrink-0 rounded object-cover" }) : null,
|
|
10852
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col", children: [
|
|
10853
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-semibold text-foreground", children: containerTitleText(block) || "Container" }),
|
|
10854
|
+
block.subtitle?.text ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: block.subtitle.text }) : null
|
|
10855
|
+
] }),
|
|
10856
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Container" })
|
|
10857
|
+
]
|
|
10858
|
+
}
|
|
10859
|
+
) }),
|
|
10860
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10861
|
+
BlockEditor,
|
|
10862
|
+
{
|
|
10863
|
+
block,
|
|
10864
|
+
errors,
|
|
10865
|
+
onChange: (next) => onUpdate(id, next),
|
|
10866
|
+
onDone: () => onOpenBlockChange?.(null)
|
|
10867
|
+
}
|
|
10868
|
+
) })
|
|
10869
|
+
] }),
|
|
10870
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10827
10871
|
"div",
|
|
10828
10872
|
{
|
|
10873
|
+
ref: setBodyRef,
|
|
10829
10874
|
className: cn(
|
|
10830
|
-
"
|
|
10831
|
-
|
|
10875
|
+
"flex flex-col gap-2 p-3 transition-colors",
|
|
10876
|
+
isPaletteDrag && "outline-2 -outline-offset-2 outline-dashed outline-primary/40",
|
|
10877
|
+
isPaletteDrag && isBodyOver && "bg-primary/5"
|
|
10832
10878
|
),
|
|
10833
|
-
children:
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
e.preventDefault();
|
|
10846
|
-
onOpenBlockChange?.(!isOpen ? id : null);
|
|
10847
|
-
}
|
|
10848
|
-
},
|
|
10849
|
-
className: "flex w-full cursor-grab items-center gap-2 border-b bg-muted/40 px-3 py-2 text-left transition-colors hover:bg-muted active:cursor-grabbing",
|
|
10850
|
-
children: [
|
|
10851
|
-
icon ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: icon, alt: "", "aria-hidden": "true", className: "h-5 w-5 shrink-0 rounded object-cover" }) : null,
|
|
10852
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col", children: [
|
|
10853
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-semibold text-foreground", children: containerTitleText(block) || "Container" }),
|
|
10854
|
-
block.subtitle?.text ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: block.subtitle.text }) : null
|
|
10855
|
-
] }),
|
|
10856
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Container" })
|
|
10857
|
-
]
|
|
10858
|
-
}
|
|
10859
|
-
) }),
|
|
10860
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10861
|
-
BlockEditor,
|
|
10862
|
-
{
|
|
10863
|
-
block,
|
|
10864
|
-
errors,
|
|
10865
|
-
onChange: (next) => onUpdate(id, next),
|
|
10866
|
-
onDone: () => onOpenBlockChange?.(null)
|
|
10867
|
-
}
|
|
10868
|
-
) })
|
|
10869
|
-
] }),
|
|
10870
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10871
|
-
"div",
|
|
10879
|
+
children: children.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10880
|
+
"div",
|
|
10881
|
+
{
|
|
10882
|
+
className: cn(
|
|
10883
|
+
"flex items-center justify-center rounded-md border border-dashed px-3 py-6 text-center text-[11px] transition-colors",
|
|
10884
|
+
isBodyOver ? "border-primary/60 text-primary" : "border-border text-muted-foreground"
|
|
10885
|
+
),
|
|
10886
|
+
children: "Drag blocks here"
|
|
10887
|
+
}
|
|
10888
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(sortable.SortableContext, { items: children.map((c) => c.id), strategy: sortable.verticalListSortingStrategy, children: [
|
|
10889
|
+
children.map((child, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10890
|
+
BlockRow,
|
|
10872
10891
|
{
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
),
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
previewTheme,
|
|
10895
|
-
errors: errorsByBlockId?.get(child.id),
|
|
10896
|
-
isOpen: openBlockId === child.id,
|
|
10897
|
-
onOpenChange: (open) => onOpenBlockChange?.(open ? child.id : null),
|
|
10898
|
-
onUpdate,
|
|
10899
|
-
onDuplicate,
|
|
10900
|
-
onDelete,
|
|
10901
|
-
index: idx,
|
|
10902
|
-
total: children.length,
|
|
10903
|
-
onReorder,
|
|
10904
|
-
isPaletteDrag,
|
|
10905
|
-
position: typeof index === "number" ? { index, childIndex: idx } : void 0,
|
|
10906
|
-
blockActions
|
|
10907
|
-
},
|
|
10908
|
-
child.id
|
|
10909
|
-
)),
|
|
10910
|
-
isPaletteDrag && isBodyOver ? /* @__PURE__ */ jsxRuntime.jsx(DropIndicator, {}) : null
|
|
10911
|
-
] })
|
|
10912
|
-
}
|
|
10913
|
-
)
|
|
10914
|
-
]
|
|
10892
|
+
builderBlock: child,
|
|
10893
|
+
previewHooks,
|
|
10894
|
+
previewTheme,
|
|
10895
|
+
errors: errorsByBlockId?.get(child.id),
|
|
10896
|
+
isOpen: openBlockId === child.id,
|
|
10897
|
+
onOpenChange: (open) => onOpenBlockChange?.(open ? child.id : null),
|
|
10898
|
+
onUpdate,
|
|
10899
|
+
onDuplicate,
|
|
10900
|
+
onDelete,
|
|
10901
|
+
index: idx,
|
|
10902
|
+
total: children.length,
|
|
10903
|
+
onReorder,
|
|
10904
|
+
isPaletteDrag,
|
|
10905
|
+
position: typeof index === "number" ? { index, childIndex: idx } : void 0,
|
|
10906
|
+
blockActions,
|
|
10907
|
+
renderBlockAdornment
|
|
10908
|
+
},
|
|
10909
|
+
child.id
|
|
10910
|
+
)),
|
|
10911
|
+
isPaletteDrag && isBodyOver ? /* @__PURE__ */ jsxRuntime.jsx(DropIndicator, {}) : null
|
|
10912
|
+
] })
|
|
10915
10913
|
}
|
|
10916
|
-
)
|
|
10914
|
+
)
|
|
10915
|
+
]
|
|
10916
|
+
}
|
|
10917
|
+
);
|
|
10918
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10919
|
+
"div",
|
|
10920
|
+
{
|
|
10921
|
+
ref: setNodeRef,
|
|
10922
|
+
style,
|
|
10923
|
+
"data-bk-block-index": index,
|
|
10924
|
+
className: cn("group/container relative mb-2 last:mb-0 hover:z-10", isDragging && "opacity-40"),
|
|
10925
|
+
children: [
|
|
10926
|
+
renderBlockAdornment ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
10927
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: card }),
|
|
10928
|
+
adornment != null && adornment !== false ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: adornment }) : null
|
|
10929
|
+
] }) : card,
|
|
10917
10930
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10918
10931
|
"div",
|
|
10919
10932
|
{
|
|
@@ -11039,7 +11052,8 @@ function Surface({
|
|
|
11039
11052
|
onReorder,
|
|
11040
11053
|
isPaletteDrag = false,
|
|
11041
11054
|
onOpenPalette,
|
|
11042
|
-
blockActions
|
|
11055
|
+
blockActions,
|
|
11056
|
+
renderBlockAdornment
|
|
11043
11057
|
}) {
|
|
11044
11058
|
const { setNodeRef, isOver } = core.useDroppable({ id: SURFACE_DROPPABLE_ID });
|
|
11045
11059
|
const isDark = previewTheme === "dark";
|
|
@@ -11072,7 +11086,8 @@ function Surface({
|
|
|
11072
11086
|
total: blocks.length,
|
|
11073
11087
|
onReorder,
|
|
11074
11088
|
isPaletteDrag,
|
|
11075
|
-
blockActions
|
|
11089
|
+
blockActions,
|
|
11090
|
+
renderBlockAdornment
|
|
11076
11091
|
},
|
|
11077
11092
|
block.id
|
|
11078
11093
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11092,7 +11107,8 @@ function Surface({
|
|
|
11092
11107
|
onReorder,
|
|
11093
11108
|
isPaletteDrag,
|
|
11094
11109
|
position: { index: idx, childIndex: null },
|
|
11095
|
-
blockActions
|
|
11110
|
+
blockActions,
|
|
11111
|
+
renderBlockAdornment
|
|
11096
11112
|
},
|
|
11097
11113
|
block.id
|
|
11098
11114
|
)
|
|
@@ -11851,6 +11867,7 @@ function BlockKitchen(props) {
|
|
|
11851
11867
|
onValidationChange,
|
|
11852
11868
|
previewHooks,
|
|
11853
11869
|
blockActions,
|
|
11870
|
+
renderBlockAdornment,
|
|
11854
11871
|
customEmojis,
|
|
11855
11872
|
mentions,
|
|
11856
11873
|
loadChannels,
|
|
@@ -12232,7 +12249,8 @@ function BlockKitchen(props) {
|
|
|
12232
12249
|
onReorder: reorderBlock,
|
|
12233
12250
|
isPaletteDrag: activePaletteVariant !== null,
|
|
12234
12251
|
onOpenPalette: () => setPaletteOpen(true),
|
|
12235
|
-
blockActions
|
|
12252
|
+
blockActions,
|
|
12253
|
+
renderBlockAdornment
|
|
12236
12254
|
}
|
|
12237
12255
|
) })
|
|
12238
12256
|
] })
|