@tightknitai/block-kitchen 0.8.11 → 0.9.1

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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-Bup05opK.cjs';
3
- export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-Bup05opK.cjs';
2
+ import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-DIbvAzRA.cjs';
3
+ export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-DIbvAzRA.cjs';
4
4
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.cjs';
5
5
  import 'slack-web-api-client';
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-Bup05opK.js';
3
- export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-Bup05opK.js';
2
+ import { B as BlockKitchenProps, $ as Template, K as PreviewSurface, N as PreviewTheme } from './palette-DIbvAzRA.js';
3
+ export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, s as EditingConfig, F as FeedbackButtonSubobject, t as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, u as IconButtonIcon, v as InputBlock, L as LoadMessageInput, w as LoadResult, M as MarkdownBlock, P as PaletteSection, x as PaletteVariant, y as PieChart, z as PieChartSegment, G as PlanBlock, J as PreviewHooks, R as RecentMessage, S as SendAsUserStatus, O as SendPayload, Q as SendResult, T as SupportedBlock, U as SupportedBlockType, V as SupportedHeaderBlock, W as TableBlock, X as TableCell, Y as TableColumnSetting, Z as TaskCardBlock, _ as TaskCardStatus, a0 as UpdatePayload, a1 as UpdateResult, a2 as UrlSourceElement, a3 as VideoBlock, a5 as defaultPalette, a6 as extraAlertVariant, a7 as legacyInputVariants } from './palette-DIbvAzRA.js';
4
4
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
5
5
  import 'slack-web-api-client';
6
6
 
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, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, Pencil, Plus, ChevronDown, BookOpen, ExternalLink, AlertTriangle, Trash2, Code2, Send, Search, Info, CheckCircle2, Check, ChevronRight, LayoutGrid, ArrowUp, ArrowDown, Copy, Type, Bold, Italic, Strikethrough, Underline, Code, List, ListOrdered, Quote, Undo2, Redo2, Smile, Link as Link$1 } from 'lucide-react';
3
+ import { X, Circle, Sparkles, FileText, AlignLeft, MousePointerClick, TextCursorInput, LayoutTemplate, Bell, Pilcrow, Image, Video, GalleryHorizontal, Table, ChartColumnBig, Container, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, MailSearch, Plus, ChevronDown, BookOpen, ExternalLink, AlertTriangle, Trash2, Code2, Pencil, Send, Search, Info, CheckCircle2, Check, ChevronRight, LayoutGrid, ArrowUp, ArrowDown, Copy, Type, Bold, Italic, Strikethrough, Underline, Code, List, ListOrdered, Quote, Undo2, Redo2, Smile, Link as Link$1 } from 'lucide-react';
4
4
  import * as React from 'react';
5
5
  import { createContext, useMemo, useState, useCallback, useRef, useEffect, useId, useContext } from 'react';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -2821,19 +2821,25 @@ function LoadMessageDialog({
2821
2821
  onOpenChange,
2822
2822
  onLoadMessage,
2823
2823
  loadRecentMessages,
2824
+ loadChannels,
2824
2825
  onLoaded,
2825
2826
  onOpenAsNew
2826
2827
  }) {
2827
2828
  const [link, setLink] = useState("");
2828
2829
  const [status, setStatus] = useState({ kind: "idle" });
2830
+ const [channels, setChannels] = useState(null);
2831
+ const [channelsError, setChannelsError] = useState(null);
2832
+ const [channelId, setChannelId] = useState("");
2829
2833
  const [recent, setRecent] = useState(null);
2830
2834
  const [recentError, setRecentError] = useState(null);
2831
2835
  const inputRef = useRef(null);
2832
2836
  const onLoadMessageRef = useRef(onLoadMessage);
2833
2837
  const loadRecentMessagesRef = useRef(loadRecentMessages);
2838
+ const loadChannelsRef = useRef(loadChannels);
2834
2839
  useEffect(() => {
2835
2840
  onLoadMessageRef.current = onLoadMessage;
2836
2841
  loadRecentMessagesRef.current = loadRecentMessages;
2842
+ loadChannelsRef.current = loadChannels;
2837
2843
  });
2838
2844
  const hasRecent = !!loadRecentMessages;
2839
2845
  useEffect(() => {
@@ -2842,15 +2848,38 @@ function LoadMessageDialog({
2842
2848
  }
2843
2849
  setLink("");
2844
2850
  setStatus({ kind: "idle" });
2851
+ setChannelId("");
2852
+ setRecent(null);
2853
+ setRecentError(null);
2845
2854
  if (!loadRecentMessagesRef.current) {
2846
- setRecent([]);
2847
- setRecentError(null);
2855
+ setChannels([]);
2856
+ setChannelsError(null);
2857
+ return;
2858
+ }
2859
+ setChannels(null);
2860
+ setChannelsError(null);
2861
+ let cancelled = false;
2862
+ loadChannelsRef.current().then((list) => {
2863
+ if (!cancelled) {
2864
+ setChannels(list);
2865
+ }
2866
+ }).catch((e) => {
2867
+ if (!cancelled) {
2868
+ setChannelsError(e instanceof Error ? e.message : "Failed to load channels");
2869
+ }
2870
+ });
2871
+ return () => {
2872
+ cancelled = true;
2873
+ };
2874
+ }, [open]);
2875
+ useEffect(() => {
2876
+ if (!open || !loadRecentMessagesRef.current || !channelId) {
2848
2877
  return;
2849
2878
  }
2850
2879
  setRecent(null);
2851
2880
  setRecentError(null);
2852
2881
  let cancelled = false;
2853
- loadRecentMessagesRef.current().then((list) => {
2882
+ loadRecentMessagesRef.current(channelId).then((list) => {
2854
2883
  if (!cancelled) {
2855
2884
  setRecent(list);
2856
2885
  }
@@ -2862,7 +2891,7 @@ function LoadMessageDialog({
2862
2891
  return () => {
2863
2892
  cancelled = true;
2864
2893
  };
2865
- }, [open]);
2894
+ }, [open, channelId]);
2866
2895
  const handleLoad = async () => {
2867
2896
  const trimmed = link.trim();
2868
2897
  if (!trimmed) {
@@ -2966,10 +2995,33 @@ function LoadMessageDialog({
2966
2995
  "or pick a recent message",
2967
2996
  /* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-border" })
2968
2997
  ] }),
2969
- recent === null && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading recent messages\u2026" }),
2970
- recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: recentError }),
2971
- recent && recent.length === 0 && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No recent messages from this app." }),
2972
- recent && recent.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: recent.map((m) => {
2998
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
2999
+ /* @__PURE__ */ jsx(Label, { htmlFor: "recent-channel-picker", children: "Channel" }),
3000
+ channels === null && !channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading channels\u2026" }),
3001
+ channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: channelsError }),
3002
+ channels && channels.length === 0 && !channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No public channels available." }),
3003
+ channels && channels.length > 0 && /* @__PURE__ */ jsxs(
3004
+ "select",
3005
+ {
3006
+ id: "recent-channel-picker",
3007
+ value: channelId,
3008
+ onChange: (e) => setChannelId(e.target.value),
3009
+ className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
3010
+ children: [
3011
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select a channel\u2026" }),
3012
+ channels.map((c) => /* @__PURE__ */ jsxs("option", { value: c.id, children: [
3013
+ "#",
3014
+ c.name
3015
+ ] }, c.id))
3016
+ ]
3017
+ }
3018
+ )
3019
+ ] }),
3020
+ !channelId && channels && channels.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Select a channel to see recent messages." }),
3021
+ channelId && recent === null && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading recent messages\u2026" }),
3022
+ channelId && recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: recentError }),
3023
+ channelId && recent && recent.length === 0 && !recentError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No recent messages from this app in this channel." }),
3024
+ channelId && recent && recent.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: recent.map((m) => {
2973
3025
  const asUser = (m.editableVia ?? "bot") === "user";
2974
3026
  return /* @__PURE__ */ jsxs(
2975
3027
  "button",
@@ -2983,7 +3035,15 @@ function LoadMessageDialog({
2983
3035
  /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: m.channelName ? `#${m.channelName}` : m.channelId }),
2984
3036
  /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded border px-1 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: asUser ? "You" : "Bot" })
2985
3037
  ] }),
2986
- /* @__PURE__ */ jsx("span", { className: "shrink-0 font-mono text-xs text-muted-foreground", children: m.ts })
3038
+ /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-xs text-muted-foreground", children: [
3039
+ new Date(Number(m.ts) * 1e3).toLocaleString(),
3040
+ " ",
3041
+ /* @__PURE__ */ jsxs("span", { className: "font-mono", children: [
3042
+ "(",
3043
+ m.ts,
3044
+ ")"
3045
+ ] })
3046
+ ] })
2987
3047
  ] }),
2988
3048
  m.label && /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: m.label })
2989
3049
  ]
@@ -3297,25 +3357,6 @@ function SendDialog({
3297
3357
  /* @__PURE__ */ jsx(DialogDescription, { children: "Pick a channel and choose who to post as." })
3298
3358
  ] }),
3299
3359
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
3300
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
3301
- /* @__PURE__ */ jsx(Label, { htmlFor: "channel-picker", children: "Channel" }),
3302
- channels === null && !channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading channels\u2026" }),
3303
- channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: channelsError }),
3304
- channels && channels.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No public channels available." }),
3305
- channels && channels.length > 0 && /* @__PURE__ */ jsx(
3306
- "select",
3307
- {
3308
- id: "channel-picker",
3309
- value: channelId,
3310
- onChange: (e) => setChannelId(e.target.value),
3311
- className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
3312
- children: channels.map((c) => /* @__PURE__ */ jsxs("option", { value: c.id, children: [
3313
- "#",
3314
- c.name
3315
- ] }, c.id))
3316
- }
3317
- )
3318
- ] }),
3319
3360
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
3320
3361
  /* @__PURE__ */ jsx(Label, { htmlFor: "send-as-picker", children: "Post as" }),
3321
3362
  /* @__PURE__ */ jsxs(
@@ -3352,6 +3393,25 @@ function SendDialog({
3352
3393
  "to post as yourself."
3353
3394
  ] })
3354
3395
  ] }),
3396
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
3397
+ /* @__PURE__ */ jsx(Label, { htmlFor: "channel-picker", children: "Channel" }),
3398
+ channels === null && !channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading channels\u2026" }),
3399
+ channelsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: channelsError }),
3400
+ channels && channels.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No public channels available." }),
3401
+ channels && channels.length > 0 && /* @__PURE__ */ jsx(
3402
+ "select",
3403
+ {
3404
+ id: "channel-picker",
3405
+ value: channelId,
3406
+ onChange: (e) => setChannelId(e.target.value),
3407
+ className: "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
3408
+ children: channels.map((c) => /* @__PURE__ */ jsxs("option", { value: c.id, children: [
3409
+ "#",
3410
+ c.name
3411
+ ] }, c.id))
3412
+ }
3413
+ )
3414
+ ] }),
3355
3415
  errorCount > 0 ? /* @__PURE__ */ jsxs(
3356
3416
  "button",
3357
3417
  {
@@ -9119,8 +9179,8 @@ function Toolbar2({
9119
9179
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9120
9180
  /* @__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: [
9121
9181
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1 sm:gap-2", children: [
9122
- editingEnabled && !editBadge ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
9123
- /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" }),
9182
+ editingEnabled ? /* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: onOpenLoad, "aria-label": loadButtonLabel, children: [
9183
+ /* @__PURE__ */ jsx(MailSearch, { className: "h-3.5 w-3.5" }),
9124
9184
  /* @__PURE__ */ jsx("span", { className: "hidden md:inline", children: loadButtonLabel })
9125
9185
  ] }) : null,
9126
9186
  onOpenPalette ? /* @__PURE__ */ jsxs(
@@ -9810,6 +9870,7 @@ function BlockKitchen(props) {
9810
9870
  onOpenChange: setLoadOpen,
9811
9871
  onLoadMessage: editing.onLoadMessage,
9812
9872
  loadRecentMessages: editing.loadRecentMessages,
9873
+ loadChannels,
9813
9874
  onLoaded: (result) => {
9814
9875
  replaceAll(result.blocks);
9815
9876
  setEditTarget({