@tightknitai/block-kitchen 0.10.5 → 0.10.7
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 +127 -1
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +193 -42
- 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 +194 -43
- package/dist/index.js.map +1 -1
- package/dist/{palette-Sz27861i.d.cts → palette-QbOx7kAa.d.cts} +41 -2
- package/dist/{palette-Sz27861i.d.ts → palette-QbOx7kAa.d.ts} +41 -2
- package/dist/palette.cjs +4 -1
- 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 +4 -1
- package/dist/palette.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +1 -1
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 BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q 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-QbOx7kAa.cjs';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q as PaletteMode, R as PaletteSection, U as PaletteVariant, V as PieChart, W as PieChartSegment, X as PlanBlock, Y as PreviewHooks, Z as PrimaryActionConfig, _ as PrimaryActionContext, $ as RecentMessage, a0 as SendResult, a1 as SupportedBlockType, a2 as SupportedHeaderBlock, a3 as TableBlock, a4 as TableCell, a5 as TableColumnSetting, a6 as TaskCardBlock, a7 as TaskCardStatus, a8 as UpdatePayload, a9 as UpdateResult, aa as UrlSourceElement, ab as ValidationSummary, ac as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-QbOx7kAa.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 BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q 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-QbOx7kAa.js';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q as PaletteMode, R as PaletteSection, U as PaletteVariant, V as PieChart, W as PieChartSegment, X as PlanBlock, Y as PreviewHooks, Z as PrimaryActionConfig, _ as PrimaryActionContext, $ as RecentMessage, a0 as SendResult, a1 as SupportedBlockType, a2 as SupportedHeaderBlock, a3 as TableBlock, a4 as TableCell, a5 as TableColumnSetting, a6 as TaskCardBlock, a7 as TaskCardStatus, a8 as UpdatePayload, a9 as UpdateResult, aa as UrlSourceElement, ab as ValidationSummary, ac as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-QbOx7kAa.js';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSensors, useSensor, PointerSensor, TouchSensor, KeyboardSensor, pointerWithin, closestCenter, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
|
|
2
2
|
import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
|
|
3
|
-
import { X, Circle, Sparkles, FileText, AlignLeft, MousePointerClick, TextCursorInput, LayoutTemplate, Bell, Pilcrow, Image, Video, GalleryHorizontal, Table, ChartColumnBig, Container, Loader2, ExternalLink, AlertTriangle, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home,
|
|
3
|
+
import { X, Circle, Sparkles, FileText, AlignLeft, MousePointerClick, TextCursorInput, LayoutTemplate, Bell, Pilcrow, Image, Video, GalleryHorizontal, Table, ChartColumnBig, Container, Loader2, ExternalLink, AlertTriangle, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, Plus, ChevronDown, BookOpen, Undo2, Redo2, Trash2, Code2, Pencil, Send, Search, Check, Copy, Info, CheckCircle2, ChevronRight, LayoutGrid, ArrowUp, ArrowDown, Type, Bold, Italic, Strikethrough, Underline, Code, List, ListOrdered, Quote, Smile, Link as Link$1 } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { createContext, useState, useRef, useEffect, useCallback, useMemo, useId, useContext } from 'react';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -818,7 +818,10 @@ var defaultPalette = [
|
|
|
818
818
|
variants: [
|
|
819
819
|
{
|
|
820
820
|
id: "rich_text_section",
|
|
821
|
-
label: "Section",
|
|
821
|
+
label: "Rich Text Section",
|
|
822
|
+
// The one variant simple mode offers, where it's listed without its
|
|
823
|
+
// section heading — hence the self-describing label.
|
|
824
|
+
basic: true,
|
|
822
825
|
factory: () => ({
|
|
823
826
|
type: "rich_text",
|
|
824
827
|
elements: [
|
|
@@ -3470,7 +3473,8 @@ function LoadMessageDialog({
|
|
|
3470
3473
|
}, POLL_INTERVAL_MS2);
|
|
3471
3474
|
};
|
|
3472
3475
|
const preview = activeTab === "recent" ? selectedRecent ? { kind: "ready", target: { ...selectedRecent, editableVia: selectedRecent.editableVia ?? "bot" } } : { kind: "empty" } : linkStatus.kind === "idle" ? { kind: "empty" } : linkStatus.kind === "ready" ? { kind: "ready", target: linkStatus.result } : linkStatus;
|
|
3473
|
-
const
|
|
3476
|
+
const verdictOwnsAction = linkStatus.kind === "not-editable" && (isSafeHref(linkStatus.oauthUrl) || (linkStatus.blocks?.length ?? 0) > 0);
|
|
3477
|
+
const canLoad = activeTab === "recent" ? !!selectedRecent : !!link.trim() && !verdictOwnsAction;
|
|
3474
3478
|
const panelProps = (id) => hasRecent ? { role: "tabpanel", id: panelDomId(id), "aria-labelledby": tabDomId(id) } : {};
|
|
3475
3479
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
|
|
3476
3480
|
DialogContent,
|
|
@@ -3715,6 +3719,24 @@ function PreviewPane({
|
|
|
3715
3719
|
editableLabel(target.editableVia)
|
|
3716
3720
|
] }) : null
|
|
3717
3721
|
] }),
|
|
3722
|
+
state.kind === "not-editable" && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-col gap-2 rounded-md border border-amber-200! bg-amber-50 p-3 text-xs text-amber-800", children: [
|
|
3723
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
3724
|
+
/* @__PURE__ */ jsx(AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
|
|
3725
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: state.reason })
|
|
3726
|
+
] }),
|
|
3727
|
+
signInUrl && /* @__PURE__ */ jsx(SlackSignInButton, { onClick: () => onSignIn(signInUrl), polling: signInPolling }),
|
|
3728
|
+
verdictBlocks && verdictBlocks.length > 0 && /* @__PURE__ */ jsx(
|
|
3729
|
+
Button,
|
|
3730
|
+
{
|
|
3731
|
+
type: "button",
|
|
3732
|
+
variant: "outline",
|
|
3733
|
+
size: "sm",
|
|
3734
|
+
className: "self-start",
|
|
3735
|
+
onClick: () => onOpenAsNew(verdictBlocks),
|
|
3736
|
+
children: "Open as a new message instead"
|
|
3737
|
+
}
|
|
3738
|
+
)
|
|
3739
|
+
] }),
|
|
3718
3740
|
/* @__PURE__ */ jsxs(
|
|
3719
3741
|
"div",
|
|
3720
3742
|
{
|
|
@@ -3723,30 +3745,13 @@ function PreviewPane({
|
|
|
3723
3745
|
tabIndex: 0,
|
|
3724
3746
|
className: "flex flex-1 flex-col gap-3 overflow-y-auto rounded-md border bg-muted/40 p-3 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring max-lg:max-h-72 max-lg:min-h-32 lg:min-h-0",
|
|
3725
3747
|
children: [
|
|
3726
|
-
state.kind === "not-editable" && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-col gap-2 rounded-md border border-amber-200! bg-amber-50 p-3 text-xs text-amber-800", children: [
|
|
3727
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
3728
|
-
/* @__PURE__ */ jsx(AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
|
|
3729
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1", children: state.reason })
|
|
3730
|
-
] }),
|
|
3731
|
-
signInUrl && /* @__PURE__ */ jsx(SlackSignInButton, { onClick: () => onSignIn(signInUrl), polling: signInPolling }),
|
|
3732
|
-
verdictBlocks && verdictBlocks.length > 0 && /* @__PURE__ */ jsx(
|
|
3733
|
-
Button,
|
|
3734
|
-
{
|
|
3735
|
-
type: "button",
|
|
3736
|
-
variant: "outline",
|
|
3737
|
-
size: "sm",
|
|
3738
|
-
className: "self-start",
|
|
3739
|
-
onClick: () => onOpenAsNew(verdictBlocks),
|
|
3740
|
-
children: "Open as a new message instead"
|
|
3741
|
-
}
|
|
3742
|
-
)
|
|
3743
|
-
] }),
|
|
3744
3748
|
state.kind === "error" && /* @__PURE__ */ jsx("p", { className: "shrink-0 rounded-md border border-destructive/30 bg-destructive/5 p-2 text-xs text-destructive", children: state.error }),
|
|
3745
3749
|
state.kind === "loading" && /* @__PURE__ */ jsxs("p", { className: "m-auto flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3746
3750
|
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
3747
3751
|
"Looking up that message\u2026"
|
|
3748
3752
|
] }),
|
|
3749
3753
|
state.kind === "empty" && /* @__PURE__ */ jsx("p", { className: "m-auto px-4 text-center text-sm text-muted-foreground", children: emptyHint }),
|
|
3754
|
+
state.kind === "not-editable" && !(verdictBlocks && verdictBlocks.length > 0) && /* @__PURE__ */ jsx("p", { className: "m-auto px-4 text-center text-sm text-muted-foreground", children: "Nothing to preview." }),
|
|
3750
3755
|
target && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
3751
3756
|
SlackMessagePreview,
|
|
3752
3757
|
{
|
|
@@ -3776,6 +3781,20 @@ function isDefaultOpen(sectionName, config) {
|
|
|
3776
3781
|
if (typeof config === "boolean") return config;
|
|
3777
3782
|
return config.includes(sectionName);
|
|
3778
3783
|
}
|
|
3784
|
+
var PALETTE_TITLE = "Message Elements";
|
|
3785
|
+
var ADVANCED_HELP = "Browse every Slack block type \u2014 sections, images, buttons, inputs, tables and more \u2014 plus a search box.";
|
|
3786
|
+
var BASIC_HELP = "Go back to the short list: just the rich text block for writing a message.";
|
|
3787
|
+
function basicVariants(sections) {
|
|
3788
|
+
const out = [];
|
|
3789
|
+
for (const section of sections) {
|
|
3790
|
+
for (const variant of section.variants) {
|
|
3791
|
+
if (variant.basic) {
|
|
3792
|
+
out.push(variant);
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
}
|
|
3796
|
+
return out;
|
|
3797
|
+
}
|
|
3779
3798
|
function filterSections(sections, query) {
|
|
3780
3799
|
const q = query.trim().toLowerCase();
|
|
3781
3800
|
if (q.length === 0) return sections;
|
|
@@ -3798,14 +3817,26 @@ function Palette({
|
|
|
3798
3817
|
defaultOpenSections = true,
|
|
3799
3818
|
showSearch = true,
|
|
3800
3819
|
searchPlaceholder = "Search blocks\u2026",
|
|
3820
|
+
mode = "advanced",
|
|
3801
3821
|
variant = "aside"
|
|
3802
3822
|
}) {
|
|
3803
3823
|
const [query, setQuery] = useState("");
|
|
3824
|
+
const [advancedOpen, setAdvancedOpen] = useState(false);
|
|
3825
|
+
const [prevMode, setPrevMode] = useState(mode);
|
|
3826
|
+
if (prevMode !== mode) {
|
|
3827
|
+
setPrevMode(mode);
|
|
3828
|
+
setAdvancedOpen(false);
|
|
3829
|
+
setQuery("");
|
|
3830
|
+
}
|
|
3831
|
+
const basics = useMemo(() => mode === "simple" ? basicVariants(sections) : [], [mode, sections]);
|
|
3832
|
+
const offersSimple = mode === "simple" && basics.length > 0;
|
|
3833
|
+
const advanced = !offersSimple || advancedOpen;
|
|
3834
|
+
const searchVisible = showSearch && advanced;
|
|
3804
3835
|
const visibleSections = useMemo(
|
|
3805
|
-
() =>
|
|
3806
|
-
[sections, query,
|
|
3836
|
+
() => searchVisible ? filterSections(sections, query) : sections,
|
|
3837
|
+
[sections, query, searchVisible]
|
|
3807
3838
|
);
|
|
3808
|
-
const queryActive =
|
|
3839
|
+
const queryActive = searchVisible && query.trim().length > 0;
|
|
3809
3840
|
const isSheet = variant === "sheet";
|
|
3810
3841
|
return /* @__PURE__ */ jsxs(
|
|
3811
3842
|
"aside",
|
|
@@ -3815,14 +3846,43 @@ function Palette({
|
|
|
3815
3846
|
isSheet ? "w-full flex-1 bg-background" : "w-72 shrink-0 border-r bg-muted/20"
|
|
3816
3847
|
),
|
|
3817
3848
|
children: [
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3849
|
+
offersSimple || searchVisible ? (
|
|
3850
|
+
// Two elements so the header is opaque *and* the exact color of the
|
|
3851
|
+
// rail. Painted with the rail's own `bg-muted/20`, it composited over
|
|
3852
|
+
// the scrolled list instead and headings read through the search box
|
|
3853
|
+
// (a `backdrop-blur` softened them, it didn't hide them). Restoring
|
|
3854
|
+
// the `bg-background` base under the tint rebuilds the rail's own two
|
|
3855
|
+
// layers, so the match holds under any theme.
|
|
3856
|
+
/* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 shrink-0 bg-background", children: /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2 border-b px-3 pt-3 pb-2", isSheet ? "bg-background" : "bg-muted/20"), children: [
|
|
3857
|
+
offersSimple ? (
|
|
3858
|
+
// Titled row: with the sections gone, simple mode's header would
|
|
3859
|
+
// otherwise be a lone right-aligned link over empty space, and
|
|
3860
|
+
// nothing would name what the rail below it holds.
|
|
3861
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3862
|
+
/* @__PURE__ */ jsx(
|
|
3863
|
+
"span",
|
|
3864
|
+
{
|
|
3865
|
+
className: cn(
|
|
3866
|
+
"min-w-0 truncate font-medium uppercase tracking-wide text-muted-foreground",
|
|
3867
|
+
isSheet ? "text-xs" : "text-[11px]"
|
|
3868
|
+
),
|
|
3869
|
+
children: PALETTE_TITLE
|
|
3870
|
+
}
|
|
3871
|
+
),
|
|
3872
|
+
/* @__PURE__ */ jsx(
|
|
3873
|
+
ModeLink,
|
|
3874
|
+
{
|
|
3875
|
+
advanced,
|
|
3876
|
+
isSheet,
|
|
3877
|
+
onToggle: () => {
|
|
3878
|
+
setQuery("");
|
|
3879
|
+
setAdvancedOpen((v) => !v);
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
)
|
|
3883
|
+
] })
|
|
3884
|
+
) : null,
|
|
3885
|
+
searchVisible ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3826
3886
|
/* @__PURE__ */ jsx(
|
|
3827
3887
|
Search,
|
|
3828
3888
|
{
|
|
@@ -3843,10 +3903,14 @@ function Palette({
|
|
|
3843
3903
|
className: cn(isSheet ? "h-10 pl-8 text-base" : "h-8 pl-7 text-sm")
|
|
3844
3904
|
}
|
|
3845
3905
|
)
|
|
3846
|
-
] })
|
|
3847
|
-
}
|
|
3906
|
+
] }) : null
|
|
3907
|
+
] }) })
|
|
3848
3908
|
) : null,
|
|
3849
|
-
/* @__PURE__ */ jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children:
|
|
3909
|
+
/* @__PURE__ */ jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children: !advanced ? (
|
|
3910
|
+
// Simple mode: a flat list, no section headings — with this few
|
|
3911
|
+
// rows the headings would outnumber the blocks under them.
|
|
3912
|
+
basics.map((v) => /* @__PURE__ */ jsx(PaletteItem, { variant: v, onAdd: () => onAddBlock(v.factory()), mode: variant }, v.id))
|
|
3913
|
+
) : visibleSections.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-1 py-2 text-xs text-muted-foreground", children: "No blocks match." }) : visibleSections.map((section) => /* @__PURE__ */ jsx(
|
|
3850
3914
|
PaletteSection,
|
|
3851
3915
|
{
|
|
3852
3916
|
section,
|
|
@@ -3861,6 +3925,24 @@ function Palette({
|
|
|
3861
3925
|
}
|
|
3862
3926
|
);
|
|
3863
3927
|
}
|
|
3928
|
+
function ModeLink({ advanced, isSheet, onToggle }) {
|
|
3929
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
3930
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3931
|
+
"button",
|
|
3932
|
+
{
|
|
3933
|
+
type: "button",
|
|
3934
|
+
onClick: onToggle,
|
|
3935
|
+
"aria-label": advanced ? "Basic block palette" : "Advanced block palette",
|
|
3936
|
+
className: cn(
|
|
3937
|
+
"shrink-0 cursor-pointer appearance-none rounded border-0 bg-transparent p-0 font-medium text-primary underline underline-offset-2 transition-colors hover:text-primary/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
3938
|
+
isSheet ? "min-h-8 text-sm" : "text-xs"
|
|
3939
|
+
),
|
|
3940
|
+
children: advanced ? "Basic" : "Advanced"
|
|
3941
|
+
}
|
|
3942
|
+
) }),
|
|
3943
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", align: "end", children: advanced ? BASIC_HELP : ADVANCED_HELP })
|
|
3944
|
+
] }) });
|
|
3945
|
+
}
|
|
3864
3946
|
function PaletteSection({
|
|
3865
3947
|
section,
|
|
3866
3948
|
defaultOpen,
|
|
@@ -9802,6 +9884,48 @@ function EmptyState({
|
|
|
9802
9884
|
function DropIndicator2() {
|
|
9803
9885
|
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "pointer-events-none relative my-1 h-0.5 w-full rounded-full bg-primary", children: /* @__PURE__ */ jsx("span", { className: "-left-1 -top-[3px] absolute h-2 w-2 rounded-full bg-primary shadow-[0_0_0_2px_var(--color-background)]" }) });
|
|
9804
9886
|
}
|
|
9887
|
+
function SlackMark({ className }) {
|
|
9888
|
+
return /* @__PURE__ */ jsxs(
|
|
9889
|
+
"svg",
|
|
9890
|
+
{
|
|
9891
|
+
className,
|
|
9892
|
+
viewBox: "0 0 122.8 122.8",
|
|
9893
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9894
|
+
"aria-hidden": "true",
|
|
9895
|
+
focusable: "false",
|
|
9896
|
+
children: [
|
|
9897
|
+
/* @__PURE__ */ jsx(
|
|
9898
|
+
"path",
|
|
9899
|
+
{
|
|
9900
|
+
fill: "#e01e5a",
|
|
9901
|
+
d: "M25.8 77.6c0 7.1-5.8 12.9-12.9 12.9S0 84.7 0 77.6s5.8-12.9 12.9-12.9h12.9v12.9zm6.5 0c0-7.1 5.8-12.9 12.9-12.9s12.9 5.8 12.9 12.9v32.3c0 7.1-5.8 12.9-12.9 12.9s-12.9-5.8-12.9-12.9V77.6z"
|
|
9902
|
+
}
|
|
9903
|
+
),
|
|
9904
|
+
/* @__PURE__ */ jsx(
|
|
9905
|
+
"path",
|
|
9906
|
+
{
|
|
9907
|
+
fill: "#36c5f0",
|
|
9908
|
+
d: "M45.2 25.8c-7.1 0-12.9-5.8-12.9-12.9S38.1 0 45.2 0s12.9 5.8 12.9 12.9v12.9H45.2zm0 6.5c7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H12.9C5.8 58.1 0 52.3 0 45.2s5.8-12.9 12.9-12.9h32.3z"
|
|
9909
|
+
}
|
|
9910
|
+
),
|
|
9911
|
+
/* @__PURE__ */ jsx(
|
|
9912
|
+
"path",
|
|
9913
|
+
{
|
|
9914
|
+
fill: "#2eb67d",
|
|
9915
|
+
d: "M97 45.2c0-7.1 5.8-12.9 12.9-12.9s12.9 5.8 12.9 12.9-5.8 12.9-12.9 12.9H97V45.2zm-6.5 0c0 7.1-5.8 12.9-12.9 12.9s-12.9-5.8-12.9-12.9V12.9C64.7 5.8 70.5 0 77.6 0s12.9 5.8 12.9 12.9v32.3z"
|
|
9916
|
+
}
|
|
9917
|
+
),
|
|
9918
|
+
/* @__PURE__ */ jsx(
|
|
9919
|
+
"path",
|
|
9920
|
+
{
|
|
9921
|
+
fill: "#ecb22e",
|
|
9922
|
+
d: "M77.6 97c7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9-12.9-5.8-12.9-12.9V97h12.9zm0-6.5c-7.1 0-12.9-5.8-12.9-12.9s5.8-12.9 12.9-12.9h32.3c7.1 0 12.9 5.8 12.9 12.9s-5.8 12.9-12.9 12.9H77.6z"
|
|
9923
|
+
}
|
|
9924
|
+
)
|
|
9925
|
+
]
|
|
9926
|
+
}
|
|
9927
|
+
);
|
|
9928
|
+
}
|
|
9805
9929
|
var THEME_OPTIONS = [
|
|
9806
9930
|
{ value: "light", label: "Light", Icon: Sun },
|
|
9807
9931
|
{ value: "dark", label: "Dark", Icon: Moon }
|
|
@@ -9866,7 +9990,7 @@ function Toolbar2({
|
|
|
9866
9990
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-2 gap-y-1 border-b bg-background px-2 py-1.5 sm:px-3 sm:py-2", children: [
|
|
9867
9991
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1 sm:gap-2", children: [
|
|
9868
9992
|
loadEnabled ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
|
|
9869
|
-
/* @__PURE__ */ jsx(
|
|
9993
|
+
/* @__PURE__ */ jsx(SlackMark, { className: "h-3.5 w-3.5" }),
|
|
9870
9994
|
/* @__PURE__ */ jsx("span", { className: "hidden md:inline", children: loadButtonLabel })
|
|
9871
9995
|
] }) : null,
|
|
9872
9996
|
onOpenPalette ? /* @__PURE__ */ jsxs(
|
|
@@ -9996,18 +10120,29 @@ function Toolbar2({
|
|
|
9996
10120
|
size: "sm",
|
|
9997
10121
|
onClick: onClear,
|
|
9998
10122
|
disabled: !canClear,
|
|
9999
|
-
className: "hover:bg-destructive/10 hover:text-destructive",
|
|
10123
|
+
className: "group gap-0 hover:bg-destructive/10 hover:text-destructive",
|
|
10000
10124
|
"aria-label": "Clear all blocks",
|
|
10001
10125
|
children: [
|
|
10002
10126
|
/* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" }),
|
|
10003
|
-
/* @__PURE__ */ jsx(
|
|
10127
|
+
/* @__PURE__ */ jsx(ExpandingLabel, { children: "Clear" })
|
|
10128
|
+
]
|
|
10129
|
+
}
|
|
10130
|
+
),
|
|
10131
|
+
/* @__PURE__ */ jsxs(
|
|
10132
|
+
Button,
|
|
10133
|
+
{
|
|
10134
|
+
type: "button",
|
|
10135
|
+
variant: "ghost",
|
|
10136
|
+
size: "sm",
|
|
10137
|
+
onClick: onOpenJson,
|
|
10138
|
+
className: "group gap-0",
|
|
10139
|
+
"aria-label": "View JSON",
|
|
10140
|
+
children: [
|
|
10141
|
+
/* @__PURE__ */ jsx(Code2, { className: "h-3.5 w-3.5" }),
|
|
10142
|
+
/* @__PURE__ */ jsx(ExpandingLabel, { children: "View JSON" })
|
|
10004
10143
|
]
|
|
10005
10144
|
}
|
|
10006
10145
|
),
|
|
10007
|
-
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: onOpenJson, "aria-label": "View JSON", children: [
|
|
10008
|
-
/* @__PURE__ */ jsx(Code2, { className: "h-3.5 w-3.5" }),
|
|
10009
|
-
/* @__PURE__ */ jsx("span", { className: "hidden md:inline", children: "View JSON" })
|
|
10010
|
-
] }),
|
|
10011
10146
|
!showSend ? primaryAction ? (
|
|
10012
10147
|
// Compose-only mode with a host-owned primary action: same
|
|
10013
10148
|
// placement and styling as the built-in send button. No icon —
|
|
@@ -10117,6 +10252,19 @@ function Toolbar2({
|
|
|
10117
10252
|
] }) : null
|
|
10118
10253
|
] });
|
|
10119
10254
|
}
|
|
10255
|
+
function ExpandingLabel({ children }) {
|
|
10256
|
+
return /* @__PURE__ */ jsx(
|
|
10257
|
+
"span",
|
|
10258
|
+
{
|
|
10259
|
+
className: cn(
|
|
10260
|
+
"grid grid-cols-[0fr] transition-[grid-template-columns] duration-200 ease-out",
|
|
10261
|
+
"group-hover:grid-cols-[1fr] group-focus-visible:grid-cols-[1fr]",
|
|
10262
|
+
"motion-reduce:transition-none"
|
|
10263
|
+
),
|
|
10264
|
+
children: /* @__PURE__ */ jsx("span", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "block whitespace-nowrap pl-1.5", children }) })
|
|
10265
|
+
}
|
|
10266
|
+
);
|
|
10267
|
+
}
|
|
10120
10268
|
function Menu({
|
|
10121
10269
|
ariaLabel,
|
|
10122
10270
|
options,
|
|
@@ -10299,6 +10447,7 @@ function BlockKitchen(props) {
|
|
|
10299
10447
|
confirmUpdateLabel,
|
|
10300
10448
|
palette,
|
|
10301
10449
|
disabledBlockTypes,
|
|
10450
|
+
paletteMode,
|
|
10302
10451
|
showPaletteSearch,
|
|
10303
10452
|
paletteSearchPlaceholder,
|
|
10304
10453
|
defaultOpenSections,
|
|
@@ -10538,7 +10687,7 @@ function BlockKitchen(props) {
|
|
|
10538
10687
|
/* @__PURE__ */ jsxs(
|
|
10539
10688
|
"div",
|
|
10540
10689
|
{
|
|
10541
|
-
className: "bk-root flex h-full w-full flex-col overflow-hidden rounded-md border bg-background text-foreground",
|
|
10690
|
+
className: "bk-root flex h-full max-h-[var(--bk-max-height,100svh)] w-full flex-col overflow-hidden rounded-md border bg-background text-foreground",
|
|
10542
10691
|
onKeyDown: handleKeyDown,
|
|
10543
10692
|
children: [
|
|
10544
10693
|
/* @__PURE__ */ jsx(
|
|
@@ -10601,6 +10750,7 @@ function BlockKitchen(props) {
|
|
|
10601
10750
|
{
|
|
10602
10751
|
onAddBlock: (block) => addBlock(block),
|
|
10603
10752
|
sections: paletteSections,
|
|
10753
|
+
mode: paletteMode,
|
|
10604
10754
|
showSearch: showPaletteSearch,
|
|
10605
10755
|
searchPlaceholder: paletteSearchPlaceholder,
|
|
10606
10756
|
defaultOpenSections
|
|
@@ -10653,6 +10803,7 @@ function BlockKitchen(props) {
|
|
|
10653
10803
|
setPaletteOpen(false);
|
|
10654
10804
|
},
|
|
10655
10805
|
sections: paletteSections,
|
|
10806
|
+
mode: paletteMode,
|
|
10656
10807
|
showSearch: showPaletteSearch,
|
|
10657
10808
|
searchPlaceholder: paletteSearchPlaceholder,
|
|
10658
10809
|
defaultOpenSections,
|