@tightknitai/block-kitchen 0.10.5 → 0.10.6
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 +106 -1
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +176 -48
- 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 +177 -49
- 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 +1 -1
- 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,38 +3846,72 @@ 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
|
-
|
|
3849
|
+
offersSimple || searchVisible ? /* @__PURE__ */ jsxs(
|
|
3819
3850
|
"div",
|
|
3820
3851
|
{
|
|
3821
3852
|
className: cn(
|
|
3822
|
-
"sticky top-0 z-10 border-b px-3 pt-3 pb-2 backdrop-blur",
|
|
3853
|
+
"sticky top-0 z-10 flex flex-col gap-2 border-b px-3 pt-3 pb-2 backdrop-blur",
|
|
3823
3854
|
isSheet ? "bg-background" : "bg-muted/20"
|
|
3824
3855
|
),
|
|
3825
|
-
children:
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3856
|
+
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
|
+
}
|
|
3832
3882
|
)
|
|
3833
|
-
}
|
|
3834
|
-
),
|
|
3835
|
-
/* @__PURE__ */
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3883
|
+
] })
|
|
3884
|
+
) : null,
|
|
3885
|
+
searchVisible ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx(
|
|
3887
|
+
Search,
|
|
3888
|
+
{
|
|
3889
|
+
className: cn(
|
|
3890
|
+
"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
3891
|
+
isSheet ? "h-4 w-4" : "h-3.5 w-3.5"
|
|
3892
|
+
)
|
|
3893
|
+
}
|
|
3894
|
+
),
|
|
3895
|
+
/* @__PURE__ */ jsx(
|
|
3896
|
+
Input,
|
|
3897
|
+
{
|
|
3898
|
+
type: "search",
|
|
3899
|
+
value: query,
|
|
3900
|
+
onChange: (e) => setQuery(e.target.value),
|
|
3901
|
+
placeholder: searchPlaceholder,
|
|
3902
|
+
"aria-label": searchPlaceholder,
|
|
3903
|
+
className: cn(isSheet ? "h-10 pl-8 text-base" : "h-8 pl-7 text-sm")
|
|
3904
|
+
}
|
|
3905
|
+
)
|
|
3906
|
+
] }) : null
|
|
3907
|
+
]
|
|
3847
3908
|
}
|
|
3848
3909
|
) : null,
|
|
3849
|
-
/* @__PURE__ */ jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children:
|
|
3910
|
+
/* @__PURE__ */ jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children: !advanced ? (
|
|
3911
|
+
// Simple mode: a flat list, no section headings — with this few
|
|
3912
|
+
// rows the headings would outnumber the blocks under them.
|
|
3913
|
+
basics.map((v) => /* @__PURE__ */ jsx(PaletteItem, { variant: v, onAdd: () => onAddBlock(v.factory()), mode: variant }, v.id))
|
|
3914
|
+
) : 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
3915
|
PaletteSection,
|
|
3851
3916
|
{
|
|
3852
3917
|
section,
|
|
@@ -3861,6 +3926,24 @@ function Palette({
|
|
|
3861
3926
|
}
|
|
3862
3927
|
);
|
|
3863
3928
|
}
|
|
3929
|
+
function ModeLink({ advanced, isSheet, onToggle }) {
|
|
3930
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
3931
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3932
|
+
"button",
|
|
3933
|
+
{
|
|
3934
|
+
type: "button",
|
|
3935
|
+
onClick: onToggle,
|
|
3936
|
+
"aria-label": advanced ? "Basic block palette" : "Advanced block palette",
|
|
3937
|
+
className: cn(
|
|
3938
|
+
"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",
|
|
3939
|
+
isSheet ? "min-h-8 text-sm" : "text-xs"
|
|
3940
|
+
),
|
|
3941
|
+
children: advanced ? "Basic" : "Advanced"
|
|
3942
|
+
}
|
|
3943
|
+
) }),
|
|
3944
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", align: "end", children: advanced ? BASIC_HELP : ADVANCED_HELP })
|
|
3945
|
+
] }) });
|
|
3946
|
+
}
|
|
3864
3947
|
function PaletteSection({
|
|
3865
3948
|
section,
|
|
3866
3949
|
defaultOpen,
|
|
@@ -9802,6 +9885,48 @@ function EmptyState({
|
|
|
9802
9885
|
function DropIndicator2() {
|
|
9803
9886
|
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
9887
|
}
|
|
9888
|
+
function SlackMark({ className }) {
|
|
9889
|
+
return /* @__PURE__ */ jsxs(
|
|
9890
|
+
"svg",
|
|
9891
|
+
{
|
|
9892
|
+
className,
|
|
9893
|
+
viewBox: "0 0 122.8 122.8",
|
|
9894
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9895
|
+
"aria-hidden": "true",
|
|
9896
|
+
focusable: "false",
|
|
9897
|
+
children: [
|
|
9898
|
+
/* @__PURE__ */ jsx(
|
|
9899
|
+
"path",
|
|
9900
|
+
{
|
|
9901
|
+
fill: "#e01e5a",
|
|
9902
|
+
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"
|
|
9903
|
+
}
|
|
9904
|
+
),
|
|
9905
|
+
/* @__PURE__ */ jsx(
|
|
9906
|
+
"path",
|
|
9907
|
+
{
|
|
9908
|
+
fill: "#36c5f0",
|
|
9909
|
+
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"
|
|
9910
|
+
}
|
|
9911
|
+
),
|
|
9912
|
+
/* @__PURE__ */ jsx(
|
|
9913
|
+
"path",
|
|
9914
|
+
{
|
|
9915
|
+
fill: "#2eb67d",
|
|
9916
|
+
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"
|
|
9917
|
+
}
|
|
9918
|
+
),
|
|
9919
|
+
/* @__PURE__ */ jsx(
|
|
9920
|
+
"path",
|
|
9921
|
+
{
|
|
9922
|
+
fill: "#ecb22e",
|
|
9923
|
+
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"
|
|
9924
|
+
}
|
|
9925
|
+
)
|
|
9926
|
+
]
|
|
9927
|
+
}
|
|
9928
|
+
);
|
|
9929
|
+
}
|
|
9805
9930
|
var THEME_OPTIONS = [
|
|
9806
9931
|
{ value: "light", label: "Light", Icon: Sun },
|
|
9807
9932
|
{ value: "dark", label: "Dark", Icon: Moon }
|
|
@@ -9866,7 +9991,7 @@ function Toolbar2({
|
|
|
9866
9991
|
/* @__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
9992
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1 sm:gap-2", children: [
|
|
9868
9993
|
loadEnabled ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
|
|
9869
|
-
/* @__PURE__ */ jsx(
|
|
9994
|
+
/* @__PURE__ */ jsx(SlackMark, { className: "h-3.5 w-3.5" }),
|
|
9870
9995
|
/* @__PURE__ */ jsx("span", { className: "hidden md:inline", children: loadButtonLabel })
|
|
9871
9996
|
] }) : null,
|
|
9872
9997
|
onOpenPalette ? /* @__PURE__ */ jsxs(
|
|
@@ -10299,6 +10424,7 @@ function BlockKitchen(props) {
|
|
|
10299
10424
|
confirmUpdateLabel,
|
|
10300
10425
|
palette,
|
|
10301
10426
|
disabledBlockTypes,
|
|
10427
|
+
paletteMode,
|
|
10302
10428
|
showPaletteSearch,
|
|
10303
10429
|
paletteSearchPlaceholder,
|
|
10304
10430
|
defaultOpenSections,
|
|
@@ -10601,6 +10727,7 @@ function BlockKitchen(props) {
|
|
|
10601
10727
|
{
|
|
10602
10728
|
onAddBlock: (block) => addBlock(block),
|
|
10603
10729
|
sections: paletteSections,
|
|
10730
|
+
mode: paletteMode,
|
|
10604
10731
|
showSearch: showPaletteSearch,
|
|
10605
10732
|
searchPlaceholder: paletteSearchPlaceholder,
|
|
10606
10733
|
defaultOpenSections
|
|
@@ -10653,6 +10780,7 @@ function BlockKitchen(props) {
|
|
|
10653
10780
|
setPaletteOpen(false);
|
|
10654
10781
|
},
|
|
10655
10782
|
sections: paletteSections,
|
|
10783
|
+
mode: paletteMode,
|
|
10656
10784
|
showSearch: showPaletteSearch,
|
|
10657
10785
|
searchPlaceholder: paletteSearchPlaceholder,
|
|
10658
10786
|
defaultOpenSections,
|