@tightknitai/block-kitchen 0.8.6 → 0.8.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.
@@ -151,7 +151,7 @@ declare function buildVariantById(sections: readonly PaletteSection[]): Readonly
151
151
  /**
152
152
  * The Slack Block Kit block types supported by the builder in v1.
153
153
  */
154
- type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card';
154
+ type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card' | 'data_visualization';
155
155
  /**
156
156
  * Slack `markdown` block payload. Renders standard markdown (GFM)
157
157
  * via `slack-blocks-to-jsx`'s react-markdown integration.
@@ -399,6 +399,80 @@ interface PlanBlock {
399
399
  tasks?: TaskCardBlock[];
400
400
  block_id?: string;
401
401
  }
402
+ /**
403
+ * One `{ label, value }` data point inside a {@link ChartSeries}. `label`
404
+ * is the x-axis category the point belongs to; `value` is the numeric
405
+ * measurement and may be negative.
406
+ */
407
+ interface ChartDataPoint {
408
+ label: string;
409
+ value: number;
410
+ }
411
+ /**
412
+ * A named series of {@link ChartDataPoint}s. Line / bar / area charts may
413
+ * carry one or more series; each renders as its own line, set of bars, or
414
+ * filled region with a matching legend entry.
415
+ */
416
+ interface ChartSeries {
417
+ name: string;
418
+ data: ChartDataPoint[];
419
+ }
420
+ /**
421
+ * Axis configuration shared by the cartesian chart types (line / bar /
422
+ * area). `categories` is the ordered set of x-axis tick labels; `x_label`
423
+ * and `y_label` title the axes.
424
+ */
425
+ interface ChartAxisConfig {
426
+ categories: string[];
427
+ x_label?: string;
428
+ y_label?: string;
429
+ }
430
+ /**
431
+ * One `{ label, value }` slice of a {@link PieChart}.
432
+ */
433
+ interface PieChartSegment {
434
+ label: string;
435
+ value: number;
436
+ }
437
+ /**
438
+ * Cartesian chart spec (line / bar / area) used by a
439
+ * {@link DataVisualizationBlock}: one or more named series plotted against
440
+ * a shared category axis.
441
+ */
442
+ interface CartesianChart {
443
+ type: 'line' | 'bar' | 'area';
444
+ series: ChartSeries[];
445
+ axis_config?: ChartAxisConfig;
446
+ }
447
+ /**
448
+ * Pie chart spec used by a {@link DataVisualizationBlock}. Unlike the
449
+ * cartesian charts it has no axes — just a flat list of labeled segments.
450
+ */
451
+ interface PieChart {
452
+ type: 'pie';
453
+ segments: PieChartSegment[];
454
+ }
455
+ /**
456
+ * The `chart` payload of a {@link DataVisualizationBlock}: either a
457
+ * cartesian chart (line / bar / area) or a pie chart.
458
+ */
459
+ type Chart = CartesianChart | PieChart;
460
+ /**
461
+ * The chart shape rendered by a {@link DataVisualizationBlock}.
462
+ */
463
+ type ChartType = Chart['type'];
464
+ /**
465
+ * Slack `data_visualization` block payload. Renders a line, bar, area, or
466
+ * pie chart from inline data. Valid on the message surface only.
467
+ * `slack-web-api-client` doesn't ship this type yet, so we declare it.
468
+ * @see https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block
469
+ */
470
+ interface DataVisualizationBlock {
471
+ type: 'data_visualization';
472
+ title: string;
473
+ chart: Chart;
474
+ block_id?: string;
475
+ }
402
476
  /**
403
477
  * Header heading level shown in the preview. Slack's API has no
404
478
  * `level` field on header blocks, so this is a builder-only extension
@@ -417,7 +491,7 @@ type SupportedHeaderBlock = HeaderBlock & {
417
491
  * Subset of {@link AnyMessageBlock} from `slack-web-api-client`,
418
492
  * plus a header `level` extension.
419
493
  */
420
- type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock;
494
+ type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock | DataVisualizationBlock;
421
495
  /**
422
496
  * A block as represented inside the builder's working state.
423
497
  * `id` is an ephemeral client-side identifier used by DnD and selection.
@@ -732,4 +806,4 @@ interface BlockKitchenProps {
732
806
  theme?: BrandTheme | BrandPreset;
733
807
  }
734
808
 
735
- export { type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type TaskCardStatus as D, type Template as E, type FeedbackButtonSubobject as F, buildVariantById as G, type HeaderLevel as H, type IconButtonElement as I, defaultPalette as J, extraAlertVariant as K, legacyInputVariants as L, type MarkdownBlock as M, type PaletteSection as P, type SendAsUserStatus as S, type TableBlock as T, type UrlSourceElement as U, type VideoBlock as V, type AlertLevel as a, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type ChannelOption as g, type ContextActionsBlock as h, type ContextActionsElement as i, type CustomEmoji as j, type FeedbackButtonsElement as k, type IconButtonIcon as l, type InputBlock as m, type PaletteVariant as n, type PlanBlock as o, type PreviewHooks as p, type PreviewSurface as q, type PreviewTheme as r, type SendPayload as s, type SendResult as t, type SupportedBlock as u, type SupportedBlockType as v, type SupportedHeaderBlock as w, type TableCell as x, type TableColumnSetting as y, type TaskCardBlock as z };
809
+ export { type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type DataVisualizationBlock as D, type SendPayload as E, type FeedbackButtonSubobject as F, type SendResult as G, type HeaderLevel as H, type IconButtonElement as I, type SupportedBlock as J, type SupportedBlockType as K, type SupportedHeaderBlock as L, type MarkdownBlock as M, type TableCell as N, type TableColumnSetting as O, type PaletteSection as P, type TaskCardBlock as Q, type TaskCardStatus as R, type SendAsUserStatus as S, type TableBlock as T, type Template as U, type UrlSourceElement as V, type VideoBlock as W, buildVariantById as X, defaultPalette as Y, extraAlertVariant as Z, legacyInputVariants as _, type AlertLevel as a, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type CartesianChart as g, type ChannelOption as h, type Chart as i, type ChartAxisConfig as j, type ChartDataPoint as k, type ChartSeries as l, type ChartType as m, type ContextActionsBlock as n, type ContextActionsElement as o, type CustomEmoji as p, type FeedbackButtonsElement as q, type IconButtonIcon as r, type InputBlock as s, type PaletteVariant as t, type PieChart as u, type PieChartSegment as v, type PlanBlock as w, type PreviewHooks as x, type PreviewSurface as y, type PreviewTheme as z };
@@ -151,7 +151,7 @@ declare function buildVariantById(sections: readonly PaletteSection[]): Readonly
151
151
  /**
152
152
  * The Slack Block Kit block types supported by the builder in v1.
153
153
  */
154
- type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card';
154
+ type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card' | 'data_visualization';
155
155
  /**
156
156
  * Slack `markdown` block payload. Renders standard markdown (GFM)
157
157
  * via `slack-blocks-to-jsx`'s react-markdown integration.
@@ -399,6 +399,80 @@ interface PlanBlock {
399
399
  tasks?: TaskCardBlock[];
400
400
  block_id?: string;
401
401
  }
402
+ /**
403
+ * One `{ label, value }` data point inside a {@link ChartSeries}. `label`
404
+ * is the x-axis category the point belongs to; `value` is the numeric
405
+ * measurement and may be negative.
406
+ */
407
+ interface ChartDataPoint {
408
+ label: string;
409
+ value: number;
410
+ }
411
+ /**
412
+ * A named series of {@link ChartDataPoint}s. Line / bar / area charts may
413
+ * carry one or more series; each renders as its own line, set of bars, or
414
+ * filled region with a matching legend entry.
415
+ */
416
+ interface ChartSeries {
417
+ name: string;
418
+ data: ChartDataPoint[];
419
+ }
420
+ /**
421
+ * Axis configuration shared by the cartesian chart types (line / bar /
422
+ * area). `categories` is the ordered set of x-axis tick labels; `x_label`
423
+ * and `y_label` title the axes.
424
+ */
425
+ interface ChartAxisConfig {
426
+ categories: string[];
427
+ x_label?: string;
428
+ y_label?: string;
429
+ }
430
+ /**
431
+ * One `{ label, value }` slice of a {@link PieChart}.
432
+ */
433
+ interface PieChartSegment {
434
+ label: string;
435
+ value: number;
436
+ }
437
+ /**
438
+ * Cartesian chart spec (line / bar / area) used by a
439
+ * {@link DataVisualizationBlock}: one or more named series plotted against
440
+ * a shared category axis.
441
+ */
442
+ interface CartesianChart {
443
+ type: 'line' | 'bar' | 'area';
444
+ series: ChartSeries[];
445
+ axis_config?: ChartAxisConfig;
446
+ }
447
+ /**
448
+ * Pie chart spec used by a {@link DataVisualizationBlock}. Unlike the
449
+ * cartesian charts it has no axes — just a flat list of labeled segments.
450
+ */
451
+ interface PieChart {
452
+ type: 'pie';
453
+ segments: PieChartSegment[];
454
+ }
455
+ /**
456
+ * The `chart` payload of a {@link DataVisualizationBlock}: either a
457
+ * cartesian chart (line / bar / area) or a pie chart.
458
+ */
459
+ type Chart = CartesianChart | PieChart;
460
+ /**
461
+ * The chart shape rendered by a {@link DataVisualizationBlock}.
462
+ */
463
+ type ChartType = Chart['type'];
464
+ /**
465
+ * Slack `data_visualization` block payload. Renders a line, bar, area, or
466
+ * pie chart from inline data. Valid on the message surface only.
467
+ * `slack-web-api-client` doesn't ship this type yet, so we declare it.
468
+ * @see https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block
469
+ */
470
+ interface DataVisualizationBlock {
471
+ type: 'data_visualization';
472
+ title: string;
473
+ chart: Chart;
474
+ block_id?: string;
475
+ }
402
476
  /**
403
477
  * Header heading level shown in the preview. Slack's API has no
404
478
  * `level` field on header blocks, so this is a builder-only extension
@@ -417,7 +491,7 @@ type SupportedHeaderBlock = HeaderBlock & {
417
491
  * Subset of {@link AnyMessageBlock} from `slack-web-api-client`,
418
492
  * plus a header `level` extension.
419
493
  */
420
- type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock;
494
+ type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock | DataVisualizationBlock;
421
495
  /**
422
496
  * A block as represented inside the builder's working state.
423
497
  * `id` is an ephemeral client-side identifier used by DnD and selection.
@@ -732,4 +806,4 @@ interface BlockKitchenProps {
732
806
  theme?: BrandTheme | BrandPreset;
733
807
  }
734
808
 
735
- export { type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type TaskCardStatus as D, type Template as E, type FeedbackButtonSubobject as F, buildVariantById as G, type HeaderLevel as H, type IconButtonElement as I, defaultPalette as J, extraAlertVariant as K, legacyInputVariants as L, type MarkdownBlock as M, type PaletteSection as P, type SendAsUserStatus as S, type TableBlock as T, type UrlSourceElement as U, type VideoBlock as V, type AlertLevel as a, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type ChannelOption as g, type ContextActionsBlock as h, type ContextActionsElement as i, type CustomEmoji as j, type FeedbackButtonsElement as k, type IconButtonIcon as l, type InputBlock as m, type PaletteVariant as n, type PlanBlock as o, type PreviewHooks as p, type PreviewSurface as q, type PreviewTheme as r, type SendPayload as s, type SendResult as t, type SupportedBlock as u, type SupportedBlockType as v, type SupportedHeaderBlock as w, type TableCell as x, type TableColumnSetting as y, type TaskCardBlock as z };
809
+ export { type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type DataVisualizationBlock as D, type SendPayload as E, type FeedbackButtonSubobject as F, type SendResult as G, type HeaderLevel as H, type IconButtonElement as I, type SupportedBlock as J, type SupportedBlockType as K, type SupportedHeaderBlock as L, type MarkdownBlock as M, type TableCell as N, type TableColumnSetting as O, type PaletteSection as P, type TaskCardBlock as Q, type TaskCardStatus as R, type SendAsUserStatus as S, type TableBlock as T, type Template as U, type UrlSourceElement as V, type VideoBlock as W, buildVariantById as X, defaultPalette as Y, extraAlertVariant as Z, legacyInputVariants as _, type AlertLevel as a, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type CartesianChart as g, type ChannelOption as h, type Chart as i, type ChartAxisConfig as j, type ChartDataPoint as k, type ChartSeries as l, type ChartType as m, type ContextActionsBlock as n, type ContextActionsElement as o, type CustomEmoji as p, type FeedbackButtonsElement as q, type IconButtonIcon as r, type InputBlock as s, type PaletteVariant as t, type PieChart as u, type PieChartSegment as v, type PlanBlock as w, type PreviewHooks as x, type PreviewSurface as y, type PreviewTheme as z };
package/dist/palette.cjs CHANGED
@@ -935,6 +935,143 @@ var defaultPalette = [
935
935
  })
936
936
  }
937
937
  ]
938
+ },
939
+ {
940
+ name: "Data Visualization",
941
+ icon: lucideReact.ChartColumnBig,
942
+ variants: [
943
+ {
944
+ id: "dataviz_line",
945
+ label: "Line chart",
946
+ factory: () => ({
947
+ type: "data_visualization",
948
+ title: "Weekly active users by platform",
949
+ chart: {
950
+ type: "line",
951
+ series: [
952
+ {
953
+ name: "Desktop",
954
+ data: [
955
+ { label: "Mon", value: 800 },
956
+ { label: "Tue", value: 920 },
957
+ { label: "Wed", value: 880 },
958
+ { label: "Thu", value: 1010 },
959
+ { label: "Fri", value: 1120 }
960
+ ]
961
+ },
962
+ {
963
+ name: "Mobile",
964
+ data: [
965
+ { label: "Mon", value: 400 },
966
+ { label: "Tue", value: 530 },
967
+ { label: "Wed", value: 500 },
968
+ { label: "Thu", value: 590 },
969
+ { label: "Fri", value: 600 }
970
+ ]
971
+ }
972
+ ],
973
+ axis_config: {
974
+ categories: ["Mon", "Tue", "Wed", "Thu", "Fri"],
975
+ x_label: "Day",
976
+ y_label: "Users"
977
+ }
978
+ }
979
+ })
980
+ },
981
+ {
982
+ id: "dataviz_bar",
983
+ label: "Bar chart",
984
+ factory: () => ({
985
+ type: "data_visualization",
986
+ title: "Messages sent by platform",
987
+ chart: {
988
+ type: "bar",
989
+ series: [
990
+ {
991
+ name: "Desktop",
992
+ data: [
993
+ { label: "Mon", value: 1500 },
994
+ { label: "Tue", value: 1400 },
995
+ { label: "Wed", value: 1700 },
996
+ { label: "Thu", value: 1600 },
997
+ { label: "Fri", value: 1280 }
998
+ ]
999
+ },
1000
+ {
1001
+ name: "Mobile",
1002
+ data: [
1003
+ { label: "Mon", value: 800 },
1004
+ { label: "Tue", value: 750 },
1005
+ { label: "Wed", value: 920 },
1006
+ { label: "Thu", value: 880 },
1007
+ { label: "Fri", value: 700 }
1008
+ ]
1009
+ }
1010
+ ],
1011
+ axis_config: {
1012
+ categories: ["Mon", "Tue", "Wed", "Thu", "Fri"],
1013
+ x_label: "Day",
1014
+ y_label: "Messages"
1015
+ }
1016
+ }
1017
+ })
1018
+ },
1019
+ {
1020
+ id: "dataviz_area",
1021
+ label: "Area chart",
1022
+ factory: () => ({
1023
+ type: "data_visualization",
1024
+ title: "Concurrent users by platform",
1025
+ chart: {
1026
+ type: "area",
1027
+ series: [
1028
+ {
1029
+ name: "Desktop",
1030
+ data: [
1031
+ { label: "Mon", value: 2800 },
1032
+ { label: "Tue", value: 3e3 },
1033
+ { label: "Wed", value: 3400 },
1034
+ { label: "Thu", value: 3200 },
1035
+ { label: "Fri", value: 3500 }
1036
+ ]
1037
+ },
1038
+ {
1039
+ name: "Mobile",
1040
+ data: [
1041
+ { label: "Mon", value: 1400 },
1042
+ { label: "Tue", value: 1500 },
1043
+ { label: "Wed", value: 1700 },
1044
+ { label: "Thu", value: 1600 },
1045
+ { label: "Fri", value: 1800 }
1046
+ ]
1047
+ }
1048
+ ],
1049
+ axis_config: {
1050
+ categories: ["Mon", "Tue", "Wed", "Thu", "Fri"],
1051
+ x_label: "Day",
1052
+ y_label: "Users"
1053
+ }
1054
+ }
1055
+ })
1056
+ },
1057
+ {
1058
+ id: "dataviz_pie",
1059
+ label: "Pie chart",
1060
+ factory: () => ({
1061
+ type: "data_visualization",
1062
+ title: "Plan distribution by tier",
1063
+ chart: {
1064
+ type: "pie",
1065
+ segments: [
1066
+ { label: "Free", value: 4200 },
1067
+ { label: "Pro", value: 2300 },
1068
+ { label: "Business+", value: 1100 },
1069
+ { label: "Enterprise", value: 480 }
1070
+ ]
1071
+ }
1072
+ })
1073
+ }
1074
+ ]
938
1075
  }
939
1076
  ];
940
1077
  var legacyInputVariants = [