@tightknitai/block-kitchen 0.10.21 → 0.10.23
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 +34 -0
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +60 -7
- 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 +60 -7
- package/dist/index.js.map +1 -1
- package/dist/{palette-CXXqlwIH.d.cts → palette-DFTL0Han.d.cts} +35 -1
- package/dist/{palette-CXXqlwIH.d.ts → palette-DFTL0Han.d.ts} +35 -1
- package/dist/palette.d.cts +1 -1
- package/dist/palette.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-
|
|
4
|
-
export { A as AlertBlock, e as AlertLevel, f as
|
|
3
|
+
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-DFTL0Han.cjs';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockAction, g as BlockKitchenBaseProps, h as BlockKitchenComposeOnlyProps, i as BlockKitchenSendProps, j as BlockPosition, k as BrandPreset, l as BrandTheme, m as BrandTokens, n as BuilderBlock, o as CardBlock, p as CarouselBlock, q as CartesianChart, r as Chart, s as ChartAxisConfig, t as ChartDataPoint, u as ChartSeries, v as ChartType, w as ContainerBlock, x as ContainerChildBlock, y as ContextActionsBlock, z as ContextActionsElement, D as CustomEmoji, E as DataTableActionCell, F as DataTableBlock, G as DataTableCell, H as DataTableRawNumberCell, I as DataVisualizationBlock, J as EditableVia, K as FeedbackButtonSubobject, L as FeedbackButtonsElement, M as HeaderLevel, N as IconButtonElement, O as IconButtonIcon, Q as InputBlock, R as LoadMessageInput, U as LoadResult, V as LoadedMessage, W as LoadingConfig, X as MarkdownBlock, Y as MentionChannel, Z as MentionUser, _ as MentionsConfig, $ as PaletteMode, a0 as PaletteSection, a1 as PaletteVariant, a2 as PieChart, a3 as PieChartSegment, a4 as PlanBlock, a5 as PreviewHooks, a6 as PrimaryActionConfig, a7 as PrimaryActionContext, a8 as RecentMessage, a9 as SendResult, aa as SupportedBlockType, ab as SupportedHeaderBlock, ac as TableBlock, ad as TableCell, ae as TableColumnSetting, af as TableRawTextCell, ag as TaskCardBlock, ah as TaskCardStatus, ai as UpdatePayload, aj as UpdateResult, ak as UrlSourceElement, al as ValidationSummary, am as VideoBlock, an as defaultPalette, ao as extraAlertVariant, ap as legacyInputVariants } from './palette-DFTL0Han.cjs';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.cjs';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-
|
|
4
|
-
export { A as AlertBlock, e as AlertLevel, f as
|
|
3
|
+
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-DFTL0Han.js';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockAction, g as BlockKitchenBaseProps, h as BlockKitchenComposeOnlyProps, i as BlockKitchenSendProps, j as BlockPosition, k as BrandPreset, l as BrandTheme, m as BrandTokens, n as BuilderBlock, o as CardBlock, p as CarouselBlock, q as CartesianChart, r as Chart, s as ChartAxisConfig, t as ChartDataPoint, u as ChartSeries, v as ChartType, w as ContainerBlock, x as ContainerChildBlock, y as ContextActionsBlock, z as ContextActionsElement, D as CustomEmoji, E as DataTableActionCell, F as DataTableBlock, G as DataTableCell, H as DataTableRawNumberCell, I as DataVisualizationBlock, J as EditableVia, K as FeedbackButtonSubobject, L as FeedbackButtonsElement, M as HeaderLevel, N as IconButtonElement, O as IconButtonIcon, Q as InputBlock, R as LoadMessageInput, U as LoadResult, V as LoadedMessage, W as LoadingConfig, X as MarkdownBlock, Y as MentionChannel, Z as MentionUser, _ as MentionsConfig, $ as PaletteMode, a0 as PaletteSection, a1 as PaletteVariant, a2 as PieChart, a3 as PieChartSegment, a4 as PlanBlock, a5 as PreviewHooks, a6 as PrimaryActionConfig, a7 as PrimaryActionContext, a8 as RecentMessage, a9 as SendResult, aa as SupportedBlockType, ab as SupportedHeaderBlock, ac as TableBlock, ad as TableCell, ae as TableColumnSetting, af as TableRawTextCell, ag as TaskCardBlock, ah as TaskCardStatus, ai as UpdatePayload, aj as UpdateResult, ak as UrlSourceElement, al as ValidationSummary, am as VideoBlock, an as defaultPalette, ao as extraAlertVariant, ap as legacyInputVariants } from './palette-DFTL0Han.js';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -4601,6 +4601,40 @@ function SendDialog({
|
|
|
4601
4601
|
] })
|
|
4602
4602
|
] }) });
|
|
4603
4603
|
}
|
|
4604
|
+
function BlockActionButtons({
|
|
4605
|
+
actions,
|
|
4606
|
+
position,
|
|
4607
|
+
variant
|
|
4608
|
+
}) {
|
|
4609
|
+
if (!actions?.length || !position) {
|
|
4610
|
+
return null;
|
|
4611
|
+
}
|
|
4612
|
+
return actions.map(
|
|
4613
|
+
(action) => variant === "toolbar" ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4614
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4615
|
+
"button",
|
|
4616
|
+
{
|
|
4617
|
+
type: "button",
|
|
4618
|
+
"aria-label": action.label,
|
|
4619
|
+
onClick: () => action.onSelect(position),
|
|
4620
|
+
className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:h-3.5 [&_svg]:w-3.5",
|
|
4621
|
+
children: action.icon
|
|
4622
|
+
}
|
|
4623
|
+
) }),
|
|
4624
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: action.label })
|
|
4625
|
+
] }, action.id) : /* @__PURE__ */ jsx(
|
|
4626
|
+
"button",
|
|
4627
|
+
{
|
|
4628
|
+
type: "button",
|
|
4629
|
+
"aria-label": action.label,
|
|
4630
|
+
onClick: () => action.onSelect(position),
|
|
4631
|
+
className: "flex h-9 w-9 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:h-4 [&_svg]:w-4",
|
|
4632
|
+
children: action.icon
|
|
4633
|
+
},
|
|
4634
|
+
action.id
|
|
4635
|
+
)
|
|
4636
|
+
);
|
|
4637
|
+
}
|
|
4604
4638
|
var RadioGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref }));
|
|
4605
4639
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
4606
4640
|
var RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
@@ -10435,7 +10469,9 @@ function BlockRow({
|
|
|
10435
10469
|
index,
|
|
10436
10470
|
total,
|
|
10437
10471
|
onReorder,
|
|
10438
|
-
isPaletteDrag = false
|
|
10472
|
+
isPaletteDrag = false,
|
|
10473
|
+
position,
|
|
10474
|
+
blockActions
|
|
10439
10475
|
}) {
|
|
10440
10476
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging, isOver } = useSortable({
|
|
10441
10477
|
id: builderBlock.id
|
|
@@ -10455,6 +10491,8 @@ function BlockRow({
|
|
|
10455
10491
|
{
|
|
10456
10492
|
ref: setNodeRef,
|
|
10457
10493
|
style,
|
|
10494
|
+
"data-bk-block-index": position?.index,
|
|
10495
|
+
"data-bk-child-index": position?.childIndex ?? void 0,
|
|
10458
10496
|
className: cn("group relative mb-2 last:mb-0 hover:z-10 md:mb-0", isDragging && "opacity-40"),
|
|
10459
10497
|
children: [
|
|
10460
10498
|
showDropIndicator ? /* @__PURE__ */ jsx(
|
|
@@ -10587,6 +10625,7 @@ function BlockRow({
|
|
|
10587
10625
|
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: "Move down" })
|
|
10588
10626
|
] })
|
|
10589
10627
|
] }) : null,
|
|
10628
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "toolbar" }),
|
|
10590
10629
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10591
10630
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10592
10631
|
"button",
|
|
@@ -10649,6 +10688,7 @@ function BlockRow({
|
|
|
10649
10688
|
children: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4" })
|
|
10650
10689
|
}
|
|
10651
10690
|
) : null,
|
|
10691
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "inline" }),
|
|
10652
10692
|
/* @__PURE__ */ jsx(
|
|
10653
10693
|
"button",
|
|
10654
10694
|
{
|
|
@@ -10730,7 +10770,8 @@ function ContainerRow({
|
|
|
10730
10770
|
onReorder,
|
|
10731
10771
|
index,
|
|
10732
10772
|
total,
|
|
10733
|
-
isPaletteDrag = false
|
|
10773
|
+
isPaletteDrag = false,
|
|
10774
|
+
blockActions
|
|
10734
10775
|
}) {
|
|
10735
10776
|
const { id } = builderBlock;
|
|
10736
10777
|
const block = builderBlock.block;
|
|
@@ -10743,11 +10784,13 @@ function ContainerRow({
|
|
|
10743
10784
|
const { setNodeRef: setBodyRef, isOver: isBodyOver } = useDroppable({ id: containerBodyId(id) });
|
|
10744
10785
|
const style = { transform: CSS.Transform.toString(transform), transition };
|
|
10745
10786
|
const icon = block.icon && "image_url" in block.icon ? block.icon.image_url : void 0;
|
|
10787
|
+
const position = typeof index === "number" ? { index, childIndex: null } : void 0;
|
|
10746
10788
|
return /* @__PURE__ */ jsxs(
|
|
10747
10789
|
"div",
|
|
10748
10790
|
{
|
|
10749
10791
|
ref: setNodeRef,
|
|
10750
10792
|
style,
|
|
10793
|
+
"data-bk-block-index": index,
|
|
10751
10794
|
className: cn("group/container relative mb-2 last:mb-0 hover:z-10", isDragging && "opacity-40"),
|
|
10752
10795
|
children: [
|
|
10753
10796
|
/* @__PURE__ */ jsxs(
|
|
@@ -10828,7 +10871,9 @@ function ContainerRow({
|
|
|
10828
10871
|
index: idx,
|
|
10829
10872
|
total: children.length,
|
|
10830
10873
|
onReorder,
|
|
10831
|
-
isPaletteDrag
|
|
10874
|
+
isPaletteDrag,
|
|
10875
|
+
position: typeof index === "number" ? { index, childIndex: idx } : void 0,
|
|
10876
|
+
blockActions
|
|
10832
10877
|
},
|
|
10833
10878
|
child.id
|
|
10834
10879
|
)),
|
|
@@ -10871,6 +10916,7 @@ function ContainerRow({
|
|
|
10871
10916
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Move up", disabled: index === 0, onClick: () => onReorder(id, index - 1), children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5" }) }),
|
|
10872
10917
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Move down", disabled: index >= total - 1, onClick: () => onReorder(id, index + 1), children: /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5" }) })
|
|
10873
10918
|
] }) : null,
|
|
10919
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "toolbar" }),
|
|
10874
10920
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Edit", onClick: () => onOpenBlockChange?.(id), children: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" }) }),
|
|
10875
10921
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Duplicate", onClick: () => onDuplicate(id), children: /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" }) }),
|
|
10876
10922
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Delete", destructive: true, onClick: () => onDelete(id), children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" }) })
|
|
@@ -10880,6 +10926,7 @@ function ContainerRow({
|
|
|
10880
10926
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center justify-between gap-2 rounded-md border border-dashed bg-muted/40 px-2 py-1 md:hidden", children: [
|
|
10881
10927
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[11px] font-medium text-muted-foreground", children: "Container" }),
|
|
10882
10928
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
10929
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "inline" }),
|
|
10883
10930
|
/* @__PURE__ */ jsx(
|
|
10884
10931
|
"button",
|
|
10885
10932
|
{
|
|
@@ -10961,7 +11008,8 @@ function Surface({
|
|
|
10961
11008
|
onDelete,
|
|
10962
11009
|
onReorder,
|
|
10963
11010
|
isPaletteDrag = false,
|
|
10964
|
-
onOpenPalette
|
|
11011
|
+
onOpenPalette,
|
|
11012
|
+
blockActions
|
|
10965
11013
|
}) {
|
|
10966
11014
|
const { setNodeRef, isOver } = useDroppable({ id: SURFACE_DROPPABLE_ID });
|
|
10967
11015
|
const isDark = previewTheme === "dark";
|
|
@@ -10993,7 +11041,8 @@ function Surface({
|
|
|
10993
11041
|
index: idx,
|
|
10994
11042
|
total: blocks.length,
|
|
10995
11043
|
onReorder,
|
|
10996
|
-
isPaletteDrag
|
|
11044
|
+
isPaletteDrag,
|
|
11045
|
+
blockActions
|
|
10997
11046
|
},
|
|
10998
11047
|
block.id
|
|
10999
11048
|
) : /* @__PURE__ */ jsx(
|
|
@@ -11011,7 +11060,9 @@ function Surface({
|
|
|
11011
11060
|
index: idx,
|
|
11012
11061
|
total: blocks.length,
|
|
11013
11062
|
onReorder,
|
|
11014
|
-
isPaletteDrag
|
|
11063
|
+
isPaletteDrag,
|
|
11064
|
+
position: { index: idx, childIndex: null },
|
|
11065
|
+
blockActions
|
|
11015
11066
|
},
|
|
11016
11067
|
block.id
|
|
11017
11068
|
)
|
|
@@ -11769,6 +11820,7 @@ function BlockKitchen(props) {
|
|
|
11769
11820
|
onChange,
|
|
11770
11821
|
onValidationChange,
|
|
11771
11822
|
previewHooks,
|
|
11823
|
+
blockActions,
|
|
11772
11824
|
customEmojis,
|
|
11773
11825
|
mentions,
|
|
11774
11826
|
loadChannels,
|
|
@@ -12149,7 +12201,8 @@ function BlockKitchen(props) {
|
|
|
12149
12201
|
onDelete: removeBlock,
|
|
12150
12202
|
onReorder: reorderBlock,
|
|
12151
12203
|
isPaletteDrag: activePaletteVariant !== null,
|
|
12152
|
-
onOpenPalette: () => setPaletteOpen(true)
|
|
12204
|
+
onOpenPalette: () => setPaletteOpen(true),
|
|
12205
|
+
blockActions
|
|
12153
12206
|
}
|
|
12154
12207
|
) })
|
|
12155
12208
|
] })
|