@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 CHANGED
@@ -120,8 +120,9 @@ export function MyBuilderPage() {
120
120
  | `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. |
121
121
  | `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). |
122
122
  | `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). |
123
+ | `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, just **Rich Text Section** — 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). |
123
124
  | `defaultOpenSections` | `boolean \| string[]` | no | Which palette section headers are expanded on first paint. `true` (default) opens all sections; `false` collapses all (Slack-style); an array opens only sections whose `name` is in the list (e.g. `['Section', 'Actions']`). The palette also has a built-in search input that expands matching sections on demand. |
124
- | `showPaletteSearch` | `boolean` | no | Whether the palette renders the quick-search input above the section list. Defaults to `true`. Set `false` for compact palettes (e.g. when you've passed a small custom `palette`) where scanning by eye is faster than typing. |
125
+ | `showPaletteSearch` | `boolean` | no | Whether the palette renders the quick-search input above the section list. Defaults to `true`. Set `false` for compact palettes (e.g. when you've passed a small custom `palette`) where scanning by eye is faster than typing. Simple mode has no search either way — it appears with the rest of the palette behind "Advanced". |
125
126
  | `paletteSearchPlaceholder` | `string` | no | Placeholder text for the palette search input. Defaults to `'Search blocks…'`. Useful for localization. |
126
127
  | `allowedSurfaces` | `PreviewSurface[]` | no | Allowlist of preview surfaces (`'message'`, `'modal'`, `'app_home'`). Defaults to `['message']` — surface dropdown is hidden when only one surface is allowed. The first entry is the initial selection. |
127
128
  | `showThemeControl` | `boolean` | no | Defaults to `true`. When `false`, the toolbar's light/dark toggle is hidden and the theme stays at `defaultPreviewTheme`. Ignored when `previewTheme` is set (a controlled theme always hides the toggle). |
@@ -452,6 +453,107 @@ const PALETTE: readonly PaletteSection[] = [
452
453
 
453
454
  Variant `id`s must be unique across the array — the drag-drop lookup keys by id.
454
455
 
456
+ ### Simple vs advanced palette
457
+
458
+ By default the palette opens on everything it has: every section, plus the search input. For consumers whose users are writing ordinary messages rather than building interactive apps, `paletteMode="simple"` opens on a one-block starter list instead — no sections, no search — behind an **Advanced** link that swaps in the full palette (and back).
459
+
460
+ ```tsx
461
+ <BlockKitchen paletteMode="simple" {...rest} />
462
+ ```
463
+
464
+ Which variants the simple list holds is a property of the palette, not the flag: a variant opts in with `basic: true`. The built-in palette flags exactly one — **Rich Text Section** — so a custom palette that wants its own starter block says so:
465
+
466
+ ```tsx
467
+ const PALETTE: readonly PaletteSection[] = [
468
+ {
469
+ name: "Company presets",
470
+ icon: AlignLeft,
471
+ variants: [
472
+ { id: "help_footer", label: "Help footer", basic: true, factory: () => ({ ... }) },
473
+ { id: "company_divider", label: "Company divider", factory: () => ({ ... }) },
474
+ ],
475
+ },
476
+ ];
477
+ ```
478
+
479
+ A palette that flags none of its variants `basic` has no simple list to show, so it renders as `'advanced'` regardless — the link is withheld rather than leading to an empty rail.
480
+
481
+ ## Templates (`TemplatePicker`)
482
+
483
+ `TemplatePicker` is a standalone, page-sized picker that renders `Template`s as a grid of cards with live block previews, grouped into category sections — modeled on Slack's own Block Kit Builder templates page. It's pure UI: it owns no dialog and no layout, so you decide whether it's a route, a modal, a slide-over, or a sidebar next to the builder.
484
+
485
+ ```tsx
486
+ import {
487
+ BlockKitchen,
488
+ TemplatePicker,
489
+ type SupportedBlock,
490
+ type Template,
491
+ } from "@tightknitai/block-kitchen";
492
+ import { useState } from "react";
493
+
494
+ const TEMPLATES: Template[] = [
495
+ {
496
+ id: "standup",
497
+ name: "Daily standup",
498
+ description: "Yesterday / today / blockers",
499
+ surface: "message",
500
+ category: "Team", // optional — groups cards into sections
501
+ blocks: [
502
+ /* SupportedBlock[] */
503
+ ],
504
+ },
505
+ ];
506
+
507
+ function Builder() {
508
+ const [blocks, setBlocks] = useState<SupportedBlock[]>([]);
509
+ // `initialBlocks` is read once at mount, so bump a key to re-seed.
510
+ const [seedKey, setSeedKey] = useState(0);
511
+
512
+ return (
513
+ <div style={{ display: "flex", minHeight: 0 }}>
514
+ <div style={{ flex: 1, minWidth: 0 }}>
515
+ <BlockKitchen key={seedKey} initialBlocks={blocks} onChange={setBlocks} {...rest} />
516
+ </div>
517
+ {/* `.bk-root` is required — see below */}
518
+ <aside className="bk-root" style={{ width: 380, overflowY: "auto" }}>
519
+ <TemplatePicker
520
+ templates={TEMPLATES}
521
+ heading="Templates"
522
+ onSelect={(t) => {
523
+ setBlocks(t.blocks);
524
+ setSeedKey((n) => n + 1);
525
+ }}
526
+ />
527
+ </aside>
528
+ </div>
529
+ );
530
+ }
531
+ ```
532
+
533
+ | Prop | Type | Required | Description |
534
+ | --- | --- | --- | --- |
535
+ | `templates` | `Template[]` | yes | Templates to show. Order is preserved within each category section. |
536
+ | `onSelect` | `(template: Template) => void` | yes | Called with the whole template when a card is clicked. Nothing is applied to the builder for you — see [Applying a selection](#applying-a-selection). |
537
+ | `surface` | `'message' \| 'modal' \| 'app_home'` | no | Filter to templates whose `surface` matches. Omit to show all. |
538
+ | `theme` | `'light' \| 'dark'` | no | Preview theme used inside the card thumbnails. Defaults to `'light'`; pass the builder's `previewTheme` to keep them in step. |
539
+ | `heading` | `string` | no | Heading rendered above the grid. Omitted means no heading. |
540
+ | `emptyLabel` | `string` | no | Shown when the `surface` filter matches nothing. Defaults to `'No templates available.'`. |
541
+ | `className` | `string` | no | Merged onto the root element. |
542
+
543
+ A `Template` is `{ id, name, surface, blocks }` plus optional `description` and `category`. Templates without a `category` fall into a trailing **Other** section when at least one other template has one; with no categories at all, the grid renders flat without section headers.
544
+
545
+ ### Bring your own templates
546
+
547
+ The package ships **no** templates on purpose — they're use-case examples ("Expense approval" belongs to an approvals product, "Daily standup" to a team product), so they belong in your app's config rather than the library bundle. The live demo defines its own set in [`demo/src/templates.ts`](demo/src/templates.ts) if you want a starting point to crib from.
548
+
549
+ ### Applying a selection
550
+
551
+ `onSelect` hands you the template and stops there — the picker never reaches into the builder. Because [`initialBlocks`](#props) is read once at mount, replacing the current draft means re-seeding with a changed `key`, as above. Selecting a template this way discards the draft and its undo history, so gate it behind a confirmation if that's a surprise in your app.
552
+
553
+ ### It needs a `.bk-root` ancestor
554
+
555
+ Unlike `BlockKitchen`, the picker does not add the `bk-root` class itself. The stylesheet ships its utilities inside `@scope (.bk-root, .bk-portal-content)`, so a picker mounted outside both roots renders unstyled. Wrap it (or any ancestor) in `className="bk-root"`.
556
+
455
557
  ## Boundary
456
558
 
457
559
  The package is deliberately decoupled from any Slack SDK or backend. It does not import HTTP clients, OAuth libraries, or workspace-state systems. Everything I/O-shaped is brokered through props — and the send flow itself is optional: see [compose-only mode](#compose-only-mode-bring-your-own-send-flow) when your app owns the moment of commitment.
@@ -465,6 +567,7 @@ import {
465
567
  decodeBlocksFromString,
466
568
  defaultPalette, // the built-in palette — spread to customize
467
569
  SendDialog, // the built-in send dialog, standalone (bespoke send flows)
570
+ TemplatePicker, // the standalone templates grid — see Templates above
468
571
  useSlackSignIn, // the OAuth sign-in state machine behind the identity picker
469
572
  SlackSignInButton, // the "Sign in with Slack" button + polling spinner
470
573
  } from "@tightknitai/block-kitchen";
@@ -480,6 +583,7 @@ import type {
480
583
  BlockKitchenComposeOnlyProps, // the trio explicitly absent + `primaryAction`
481
584
  PaletteSection,
482
585
  PaletteVariant,
586
+ PaletteMode, // 'advanced' (default) | 'simple'
483
587
  SendPayload,
484
588
  SendResult,
485
589
  SendDialogProps,
@@ -488,6 +592,7 @@ import type {
488
592
  PrimaryActionContext,
489
593
  ChannelOption,
490
594
  SendAsUserStatus,
595
+ Template, // one entry in a TemplatePicker gallery
491
596
  ValidationSummary,
492
597
  PreviewHooks,
493
598
  } from "@tightknitai/block-kitchen";
@@ -1,5 +1,5 @@
1
- import { S as SupportedBlock } from './palette-Sz27861i.cjs';
2
- export { a0 as SupportedBlockType } from './palette-Sz27861i.cjs';
1
+ import { S as SupportedBlock } from './palette-QbOx7kAa.cjs';
2
+ export { a1 as SupportedBlockType } from './palette-QbOx7kAa.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-Sz27861i.js';
2
- export { a0 as SupportedBlockType } from './palette-Sz27861i.js';
1
+ import { S as SupportedBlock } from './palette-QbOx7kAa.js';
2
+ export { a1 as SupportedBlockType } from './palette-QbOx7kAa.js';
3
3
  import 'react';
4
4
  import 'slack-web-api-client';
5
5
 
package/dist/index.cjs CHANGED
@@ -848,7 +848,10 @@ var defaultPalette = [
848
848
  variants: [
849
849
  {
850
850
  id: "rich_text_section",
851
- label: "Section",
851
+ label: "Rich Text Section",
852
+ // The one variant simple mode offers, where it's listed without its
853
+ // section heading — hence the self-describing label.
854
+ basic: true,
852
855
  factory: () => ({
853
856
  type: "rich_text",
854
857
  elements: [
@@ -3500,7 +3503,8 @@ function LoadMessageDialog({
3500
3503
  }, POLL_INTERVAL_MS2);
3501
3504
  };
3502
3505
  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;
3503
- const canLoad = activeTab === "recent" ? !!selectedRecent : !!link.trim();
3506
+ const verdictOwnsAction = linkStatus.kind === "not-editable" && (isSafeHref(linkStatus.oauthUrl) || (linkStatus.blocks?.length ?? 0) > 0);
3507
+ const canLoad = activeTab === "recent" ? !!selectedRecent : !!link.trim() && !verdictOwnsAction;
3504
3508
  const panelProps = (id) => hasRecent ? { role: "tabpanel", id: panelDomId(id), "aria-labelledby": tabDomId(id) } : {};
3505
3509
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(
3506
3510
  DialogContent,
@@ -3745,6 +3749,24 @@ function PreviewPane({
3745
3749
  editableLabel(target.editableVia)
3746
3750
  ] }) : null
3747
3751
  ] }),
3752
+ state.kind === "not-editable" && /* @__PURE__ */ jsxRuntime.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: [
3753
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
3754
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
3755
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: state.reason })
3756
+ ] }),
3757
+ signInUrl && /* @__PURE__ */ jsxRuntime.jsx(SlackSignInButton, { onClick: () => onSignIn(signInUrl), polling: signInPolling }),
3758
+ verdictBlocks && verdictBlocks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
3759
+ Button,
3760
+ {
3761
+ type: "button",
3762
+ variant: "outline",
3763
+ size: "sm",
3764
+ className: "self-start",
3765
+ onClick: () => onOpenAsNew(verdictBlocks),
3766
+ children: "Open as a new message instead"
3767
+ }
3768
+ )
3769
+ ] }),
3748
3770
  /* @__PURE__ */ jsxRuntime.jsxs(
3749
3771
  "div",
3750
3772
  {
@@ -3753,30 +3775,13 @@ function PreviewPane({
3753
3775
  tabIndex: 0,
3754
3776
  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",
3755
3777
  children: [
3756
- state.kind === "not-editable" && /* @__PURE__ */ jsxRuntime.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: [
3757
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
3758
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
3759
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: state.reason })
3760
- ] }),
3761
- signInUrl && /* @__PURE__ */ jsxRuntime.jsx(SlackSignInButton, { onClick: () => onSignIn(signInUrl), polling: signInPolling }),
3762
- verdictBlocks && verdictBlocks.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
3763
- Button,
3764
- {
3765
- type: "button",
3766
- variant: "outline",
3767
- size: "sm",
3768
- className: "self-start",
3769
- onClick: () => onOpenAsNew(verdictBlocks),
3770
- children: "Open as a new message instead"
3771
- }
3772
- )
3773
- ] }),
3774
3778
  state.kind === "error" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 rounded-md border border-destructive/30 bg-destructive/5 p-2 text-xs text-destructive", children: state.error }),
3775
3779
  state.kind === "loading" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "m-auto flex items-center gap-2 text-sm text-muted-foreground", children: [
3776
3780
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }),
3777
3781
  "Looking up that message\u2026"
3778
3782
  ] }),
3779
3783
  state.kind === "empty" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-auto px-4 text-center text-sm text-muted-foreground", children: emptyHint }),
3784
+ state.kind === "not-editable" && !(verdictBlocks && verdictBlocks.length > 0) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-auto px-4 text-center text-sm text-muted-foreground", children: "Nothing to preview." }),
3780
3785
  target && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
3781
3786
  SlackMessagePreview,
3782
3787
  {
@@ -3806,6 +3811,20 @@ function isDefaultOpen(sectionName, config) {
3806
3811
  if (typeof config === "boolean") return config;
3807
3812
  return config.includes(sectionName);
3808
3813
  }
3814
+ var PALETTE_TITLE = "Message Elements";
3815
+ var ADVANCED_HELP = "Browse every Slack block type \u2014 sections, images, buttons, inputs, tables and more \u2014 plus a search box.";
3816
+ var BASIC_HELP = "Go back to the short list: just the rich text block for writing a message.";
3817
+ function basicVariants(sections) {
3818
+ const out = [];
3819
+ for (const section of sections) {
3820
+ for (const variant of section.variants) {
3821
+ if (variant.basic) {
3822
+ out.push(variant);
3823
+ }
3824
+ }
3825
+ }
3826
+ return out;
3827
+ }
3809
3828
  function filterSections(sections, query) {
3810
3829
  const q = query.trim().toLowerCase();
3811
3830
  if (q.length === 0) return sections;
@@ -3828,14 +3847,26 @@ function Palette({
3828
3847
  defaultOpenSections = true,
3829
3848
  showSearch = true,
3830
3849
  searchPlaceholder = "Search blocks\u2026",
3850
+ mode = "advanced",
3831
3851
  variant = "aside"
3832
3852
  }) {
3833
3853
  const [query, setQuery] = React.useState("");
3854
+ const [advancedOpen, setAdvancedOpen] = React.useState(false);
3855
+ const [prevMode, setPrevMode] = React.useState(mode);
3856
+ if (prevMode !== mode) {
3857
+ setPrevMode(mode);
3858
+ setAdvancedOpen(false);
3859
+ setQuery("");
3860
+ }
3861
+ const basics = React.useMemo(() => mode === "simple" ? basicVariants(sections) : [], [mode, sections]);
3862
+ const offersSimple = mode === "simple" && basics.length > 0;
3863
+ const advanced = !offersSimple || advancedOpen;
3864
+ const searchVisible = showSearch && advanced;
3834
3865
  const visibleSections = React.useMemo(
3835
- () => showSearch ? filterSections(sections, query) : sections,
3836
- [sections, query, showSearch]
3866
+ () => searchVisible ? filterSections(sections, query) : sections,
3867
+ [sections, query, searchVisible]
3837
3868
  );
3838
- const queryActive = showSearch && query.trim().length > 0;
3869
+ const queryActive = searchVisible && query.trim().length > 0;
3839
3870
  const isSheet = variant === "sheet";
3840
3871
  return /* @__PURE__ */ jsxRuntime.jsxs(
3841
3872
  "aside",
@@ -3845,38 +3876,72 @@ function Palette({
3845
3876
  isSheet ? "w-full flex-1 bg-background" : "w-72 shrink-0 border-r bg-muted/20"
3846
3877
  ),
3847
3878
  children: [
3848
- showSearch ? /* @__PURE__ */ jsxRuntime.jsx(
3879
+ offersSimple || searchVisible ? /* @__PURE__ */ jsxRuntime.jsxs(
3849
3880
  "div",
3850
3881
  {
3851
3882
  className: cn(
3852
- "sticky top-0 z-10 border-b px-3 pt-3 pb-2 backdrop-blur",
3883
+ "sticky top-0 z-10 flex flex-col gap-2 border-b px-3 pt-3 pb-2 backdrop-blur",
3853
3884
  isSheet ? "bg-background" : "bg-muted/20"
3854
3885
  ),
3855
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3856
- /* @__PURE__ */ jsxRuntime.jsx(
3857
- lucideReact.Search,
3858
- {
3859
- className: cn(
3860
- "pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",
3861
- isSheet ? "h-4 w-4" : "h-3.5 w-3.5"
3886
+ children: [
3887
+ offersSimple ? (
3888
+ // Titled row: with the sections gone, simple mode's header would
3889
+ // otherwise be a lone right-aligned link over empty space, and
3890
+ // nothing would name what the rail below it holds.
3891
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
3892
+ /* @__PURE__ */ jsxRuntime.jsx(
3893
+ "span",
3894
+ {
3895
+ className: cn(
3896
+ "min-w-0 truncate font-medium uppercase tracking-wide text-muted-foreground",
3897
+ isSheet ? "text-xs" : "text-[11px]"
3898
+ ),
3899
+ children: PALETTE_TITLE
3900
+ }
3901
+ ),
3902
+ /* @__PURE__ */ jsxRuntime.jsx(
3903
+ ModeLink,
3904
+ {
3905
+ advanced,
3906
+ isSheet,
3907
+ onToggle: () => {
3908
+ setQuery("");
3909
+ setAdvancedOpen((v) => !v);
3910
+ }
3911
+ }
3862
3912
  )
3863
- }
3864
- ),
3865
- /* @__PURE__ */ jsxRuntime.jsx(
3866
- Input,
3867
- {
3868
- type: "search",
3869
- value: query,
3870
- onChange: (e) => setQuery(e.target.value),
3871
- placeholder: searchPlaceholder,
3872
- "aria-label": searchPlaceholder,
3873
- className: cn(isSheet ? "h-10 pl-8 text-base" : "h-8 pl-7 text-sm")
3874
- }
3875
- )
3876
- ] })
3913
+ ] })
3914
+ ) : null,
3915
+ searchVisible ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3916
+ /* @__PURE__ */ jsxRuntime.jsx(
3917
+ lucideReact.Search,
3918
+ {
3919
+ className: cn(
3920
+ "pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",
3921
+ isSheet ? "h-4 w-4" : "h-3.5 w-3.5"
3922
+ )
3923
+ }
3924
+ ),
3925
+ /* @__PURE__ */ jsxRuntime.jsx(
3926
+ Input,
3927
+ {
3928
+ type: "search",
3929
+ value: query,
3930
+ onChange: (e) => setQuery(e.target.value),
3931
+ placeholder: searchPlaceholder,
3932
+ "aria-label": searchPlaceholder,
3933
+ className: cn(isSheet ? "h-10 pl-8 text-base" : "h-8 pl-7 text-sm")
3934
+ }
3935
+ )
3936
+ ] }) : null
3937
+ ]
3877
3938
  }
3878
3939
  ) : null,
3879
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children: visibleSections.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-1 py-2 text-xs text-muted-foreground", children: "No blocks match." }) : visibleSections.map((section) => /* @__PURE__ */ jsxRuntime.jsx(
3940
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col", isSheet ? "px-2 pb-6" : "p-3"), children: !advanced ? (
3941
+ // Simple mode: a flat list, no section headings — with this few
3942
+ // rows the headings would outnumber the blocks under them.
3943
+ basics.map((v) => /* @__PURE__ */ jsxRuntime.jsx(PaletteItem, { variant: v, onAdd: () => onAddBlock(v.factory()), mode: variant }, v.id))
3944
+ ) : visibleSections.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-1 py-2 text-xs text-muted-foreground", children: "No blocks match." }) : visibleSections.map((section) => /* @__PURE__ */ jsxRuntime.jsx(
3880
3945
  PaletteSection,
3881
3946
  {
3882
3947
  section,
@@ -3891,6 +3956,24 @@ function Palette({
3891
3956
  }
3892
3957
  );
3893
3958
  }
3959
+ function ModeLink({ advanced, isSheet, onToggle }) {
3960
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
3961
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
3962
+ "button",
3963
+ {
3964
+ type: "button",
3965
+ onClick: onToggle,
3966
+ "aria-label": advanced ? "Basic block palette" : "Advanced block palette",
3967
+ className: cn(
3968
+ "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",
3969
+ isSheet ? "min-h-8 text-sm" : "text-xs"
3970
+ ),
3971
+ children: advanced ? "Basic" : "Advanced"
3972
+ }
3973
+ ) }),
3974
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "bottom", align: "end", children: advanced ? BASIC_HELP : ADVANCED_HELP })
3975
+ ] }) });
3976
+ }
3894
3977
  function PaletteSection({
3895
3978
  section,
3896
3979
  defaultOpen,
@@ -9832,6 +9915,48 @@ function EmptyState({
9832
9915
  function DropIndicator2() {
9833
9916
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "pointer-events-none relative my-1 h-0.5 w-full rounded-full bg-primary", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "-left-1 -top-[3px] absolute h-2 w-2 rounded-full bg-primary shadow-[0_0_0_2px_var(--color-background)]" }) });
9834
9917
  }
9918
+ function SlackMark({ className }) {
9919
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9920
+ "svg",
9921
+ {
9922
+ className,
9923
+ viewBox: "0 0 122.8 122.8",
9924
+ xmlns: "http://www.w3.org/2000/svg",
9925
+ "aria-hidden": "true",
9926
+ focusable: "false",
9927
+ children: [
9928
+ /* @__PURE__ */ jsxRuntime.jsx(
9929
+ "path",
9930
+ {
9931
+ fill: "#e01e5a",
9932
+ 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"
9933
+ }
9934
+ ),
9935
+ /* @__PURE__ */ jsxRuntime.jsx(
9936
+ "path",
9937
+ {
9938
+ fill: "#36c5f0",
9939
+ 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"
9940
+ }
9941
+ ),
9942
+ /* @__PURE__ */ jsxRuntime.jsx(
9943
+ "path",
9944
+ {
9945
+ fill: "#2eb67d",
9946
+ 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"
9947
+ }
9948
+ ),
9949
+ /* @__PURE__ */ jsxRuntime.jsx(
9950
+ "path",
9951
+ {
9952
+ fill: "#ecb22e",
9953
+ 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"
9954
+ }
9955
+ )
9956
+ ]
9957
+ }
9958
+ );
9959
+ }
9835
9960
  var THEME_OPTIONS = [
9836
9961
  { value: "light", label: "Light", Icon: lucideReact.Sun },
9837
9962
  { value: "dark", label: "Dark", Icon: lucideReact.Moon }
@@ -9896,7 +10021,7 @@ function Toolbar2({
9896
10021
  /* @__PURE__ */ jsxRuntime.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: [
9897
10022
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1 sm:gap-2", children: [
9898
10023
  loadEnabled ? /* @__PURE__ */ jsxRuntime.jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
9899
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MailSearch, { className: "h-3.5 w-3.5" }),
10024
+ /* @__PURE__ */ jsxRuntime.jsx(SlackMark, { className: "h-3.5 w-3.5" }),
9900
10025
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden md:inline", children: loadButtonLabel })
9901
10026
  ] }) : null,
9902
10027
  onOpenPalette ? /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10329,6 +10454,7 @@ function BlockKitchen(props) {
10329
10454
  confirmUpdateLabel,
10330
10455
  palette,
10331
10456
  disabledBlockTypes,
10457
+ paletteMode,
10332
10458
  showPaletteSearch,
10333
10459
  paletteSearchPlaceholder,
10334
10460
  defaultOpenSections,
@@ -10631,6 +10757,7 @@ function BlockKitchen(props) {
10631
10757
  {
10632
10758
  onAddBlock: (block) => addBlock(block),
10633
10759
  sections: paletteSections,
10760
+ mode: paletteMode,
10634
10761
  showSearch: showPaletteSearch,
10635
10762
  searchPlaceholder: paletteSearchPlaceholder,
10636
10763
  defaultOpenSections
@@ -10683,6 +10810,7 @@ function BlockKitchen(props) {
10683
10810
  setPaletteOpen(false);
10684
10811
  },
10685
10812
  sections: paletteSections,
10813
+ mode: paletteMode,
10686
10814
  showSearch: showPaletteSearch,
10687
10815
  searchPlaceholder: paletteSearchPlaceholder,
10688
10816
  defaultOpenSections,