@tightknitai/block-kitchen 0.10.24 → 0.10.25
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 +78 -6
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +345 -190
- 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 +347 -192
- package/dist/index.js.map +1 -1
- package/dist/{palette-Bup6i-9c.d.cts → palette-DTE9U5si.d.cts} +69 -1
- package/dist/{palette-Bup6i-9c.d.ts → palette-DTE9U5si.d.ts} +69 -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.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -99,6 +99,30 @@ interface PaletteVariant {
|
|
|
99
99
|
* mode, and unnecessary for a variant whose label already stands alone.
|
|
100
100
|
*/
|
|
101
101
|
basicLabel?: string;
|
|
102
|
+
/**
|
|
103
|
+
* A short tag shown beside the label, e.g. the plan a block belongs to
|
|
104
|
+
* ("Enterprise"). Shown whether or not the variant is `locked`.
|
|
105
|
+
*/
|
|
106
|
+
badge?: PaletteVariantBadge;
|
|
107
|
+
/**
|
|
108
|
+
* Shows the variant without letting anyone add it: it can't be dragged,
|
|
109
|
+
* and it has no add button. Use it to show a block the user's plan doesn't
|
|
110
|
+
* include, alongside a `badge` saying which one does. Picking it calls
|
|
111
|
+
* `onLockedSelect`.
|
|
112
|
+
*/
|
|
113
|
+
locked?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Called when the user picks a `locked` variant, e.g. to open an upgrade
|
|
116
|
+
* prompt. Without it a locked variant is inert.
|
|
117
|
+
*/
|
|
118
|
+
onLockedSelect?: () => void;
|
|
119
|
+
}
|
|
120
|
+
/** A tag shown beside a palette variant's label. See {@link PaletteVariant.badge}. */
|
|
121
|
+
interface PaletteVariantBadge {
|
|
122
|
+
/** Visible text, e.g. `'Enterprise'`. */
|
|
123
|
+
label: string;
|
|
124
|
+
/** Optional icon shown before the text, e.g. a Lucide icon component. */
|
|
125
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
102
126
|
}
|
|
103
127
|
/**
|
|
104
128
|
* One section in the palette. Sections group related variants under a
|
|
@@ -757,6 +781,36 @@ interface BlockAction {
|
|
|
757
781
|
/** Called with the block's position when the button is clicked. */
|
|
758
782
|
onSelect: (position: BlockPosition) => void;
|
|
759
783
|
}
|
|
784
|
+
/** What a {@link CustomBlockEditor}'s component is rendered with. */
|
|
785
|
+
interface CustomBlockEditorProps {
|
|
786
|
+
/** The block being edited. */
|
|
787
|
+
block: SupportedBlock;
|
|
788
|
+
/**
|
|
789
|
+
* Replaces the block. The result must still be ordinary Block Kit: it is
|
|
790
|
+
* previewed, validated and sent like any other block.
|
|
791
|
+
*/
|
|
792
|
+
onChange: (next: SupportedBlock) => void;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* A host-owned form for blocks your app gives a meaning of its own, e.g. a
|
|
796
|
+
* "Share on LinkedIn" button whose URL is built from the post text. It
|
|
797
|
+
* replaces the built-in form in the block's edit popover. The block itself
|
|
798
|
+
* stays ordinary Block Kit, so preview, validation and sending don't change.
|
|
799
|
+
*/
|
|
800
|
+
interface CustomBlockEditor {
|
|
801
|
+
/** Stable identifier. */
|
|
802
|
+
id: string;
|
|
803
|
+
/** Names the block in the editor's heading, e.g. "Edit Share on LinkedIn". */
|
|
804
|
+
label: string;
|
|
805
|
+
/**
|
|
806
|
+
* Whether this editor handles a block; the first match wins. Match on what
|
|
807
|
+
* the block itself holds (a URL, an `action_id`): a message loaded back
|
|
808
|
+
* from Slack carries nothing else.
|
|
809
|
+
*/
|
|
810
|
+
match: (block: SupportedBlock) => boolean;
|
|
811
|
+
/** The form. Rendered as a component, so it can use hooks. */
|
|
812
|
+
component: ComponentType<CustomBlockEditorProps>;
|
|
813
|
+
}
|
|
760
814
|
/**
|
|
761
815
|
* A host-owned primary action for compose-only mode, rendered in the
|
|
762
816
|
* toolbar slot where the built-in "Review & send" button normally sits.
|
|
@@ -1168,6 +1222,12 @@ interface BlockKitchenBaseProps {
|
|
|
1168
1222
|
* {@link BlockPosition}); return `null` for a block with nothing to show.
|
|
1169
1223
|
*/
|
|
1170
1224
|
renderBlockAdornment?: (position: BlockPosition) => ReactNode;
|
|
1225
|
+
/**
|
|
1226
|
+
* Opt-in host forms that replace the built-in editor for the blocks they
|
|
1227
|
+
* match. See {@link CustomBlockEditor}. Expected to be referentially
|
|
1228
|
+
* stable across renders (define at module scope or wrap in `useMemo`).
|
|
1229
|
+
*/
|
|
1230
|
+
blockEditors?: readonly CustomBlockEditor[];
|
|
1171
1231
|
/**
|
|
1172
1232
|
* Workspace custom emoji (`emoji.list`) the preview should resolve. Entries
|
|
1173
1233
|
* with a non-null `url` render as the workspace image; alias entries fall
|
|
@@ -1318,6 +1378,14 @@ interface BlockKitchenBaseProps {
|
|
|
1318
1378
|
href?: string;
|
|
1319
1379
|
label?: string;
|
|
1320
1380
|
};
|
|
1381
|
+
/**
|
|
1382
|
+
* Whether Ctrl/Cmd+Z undoes and Ctrl/Cmd+Shift+Z (or Ctrl+Y) redoes, like
|
|
1383
|
+
* the toolbar's Undo / Redo buttons. Defaults to `true`. They act while
|
|
1384
|
+
* focus is in the builder, or while nothing on the page has focus and the
|
|
1385
|
+
* last click landed in the builder, and never in a text field. Pass `false`
|
|
1386
|
+
* to leave those keys entirely to the host.
|
|
1387
|
+
*/
|
|
1388
|
+
undoRedoShortcuts?: boolean;
|
|
1321
1389
|
/**
|
|
1322
1390
|
* Initial preview theme (uncontrolled). Defaults to `'light'`. Pass the
|
|
1323
1391
|
* host app's current theme (e.g. from `next-themes` or your own theme
|
|
@@ -1468,4 +1536,4 @@ interface BlockKitchenComposeOnlyProps {
|
|
|
1468
1536
|
*/
|
|
1469
1537
|
type BlockKitchenProps = BlockKitchenBaseProps & (BlockKitchenSendProps | BlockKitchenComposeOnlyProps);
|
|
1470
1538
|
|
|
1471
|
-
export { type
|
|
1539
|
+
export { type MentionUser as $, type AlertBlock as A, type BlockKitchenProps as B, type ChannelOption as C, type CustomBlockEditor as D, type CustomBlockEditorProps as E, type CustomEmoji as F, type DataTableActionCell as G, type DataTableBlock as H, type DataTableCell as I, type DataTableRawNumberCell as J, type DataVisualizationBlock as K, type EditableVia as L, type FeedbackButtonSubobject as M, type FeedbackButtonsElement as N, type HeaderLevel as O, type PreviewSurface as P, type IconButtonElement as Q, type IconButtonIcon as R, type SupportedBlock as S, type Template as T, type InputBlock as U, type LoadMessageInput as V, type LoadResult as W, type LoadedMessage as X, type LoadingConfig as Y, type MarkdownBlock as Z, type MentionChannel as _, type SendAsUserStatus as a, type MentionsConfig as a0, type PaletteMode as a1, type PaletteSection as a2, type PaletteVariant as a3, type PaletteVariantBadge as a4, type PieChart as a5, type PieChartSegment as a6, type PlanBlock as a7, type PreviewHooks as a8, type PrimaryActionConfig as a9, type PrimaryActionContext as aa, type RecentMessage as ab, type SendResult as ac, type SupportedBlockType as ad, type SupportedHeaderBlock as ae, type TableBlock as af, type TableCell as ag, type TableColumnSetting as ah, type TableRawTextCell as ai, type TaskCardBlock as aj, type TaskCardStatus as ak, type UpdatePayload as al, type UpdateResult as am, type UrlSourceElement as an, type ValidationSummary as ao, type VideoBlock as ap, defaultPalette as aq, extraAlertVariant as ar, legacyInputVariants as as, buildVariantById as at, type SendPayload as b, type SendExtrasContext as c, type PreviewTheme as d, type AlertLevel as e, type BlockAction as f, type BlockKitchenBaseProps as g, type BlockKitchenComposeOnlyProps as h, type BlockKitchenSendProps as i, type BlockPosition as j, type BrandPreset as k, type BrandTheme as l, type BrandTokens as m, type BuilderBlock as n, type CardBlock as o, type CarouselBlock as p, type CartesianChart as q, type Chart as r, type ChartAxisConfig as s, type ChartDataPoint as t, type ChartSeries as u, type ChartType as v, type ContainerBlock as w, type ContainerChildBlock as x, type ContextActionsBlock as y, type ContextActionsElement as z };
|
|
@@ -99,6 +99,30 @@ interface PaletteVariant {
|
|
|
99
99
|
* mode, and unnecessary for a variant whose label already stands alone.
|
|
100
100
|
*/
|
|
101
101
|
basicLabel?: string;
|
|
102
|
+
/**
|
|
103
|
+
* A short tag shown beside the label, e.g. the plan a block belongs to
|
|
104
|
+
* ("Enterprise"). Shown whether or not the variant is `locked`.
|
|
105
|
+
*/
|
|
106
|
+
badge?: PaletteVariantBadge;
|
|
107
|
+
/**
|
|
108
|
+
* Shows the variant without letting anyone add it: it can't be dragged,
|
|
109
|
+
* and it has no add button. Use it to show a block the user's plan doesn't
|
|
110
|
+
* include, alongside a `badge` saying which one does. Picking it calls
|
|
111
|
+
* `onLockedSelect`.
|
|
112
|
+
*/
|
|
113
|
+
locked?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Called when the user picks a `locked` variant, e.g. to open an upgrade
|
|
116
|
+
* prompt. Without it a locked variant is inert.
|
|
117
|
+
*/
|
|
118
|
+
onLockedSelect?: () => void;
|
|
119
|
+
}
|
|
120
|
+
/** A tag shown beside a palette variant's label. See {@link PaletteVariant.badge}. */
|
|
121
|
+
interface PaletteVariantBadge {
|
|
122
|
+
/** Visible text, e.g. `'Enterprise'`. */
|
|
123
|
+
label: string;
|
|
124
|
+
/** Optional icon shown before the text, e.g. a Lucide icon component. */
|
|
125
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
102
126
|
}
|
|
103
127
|
/**
|
|
104
128
|
* One section in the palette. Sections group related variants under a
|
|
@@ -757,6 +781,36 @@ interface BlockAction {
|
|
|
757
781
|
/** Called with the block's position when the button is clicked. */
|
|
758
782
|
onSelect: (position: BlockPosition) => void;
|
|
759
783
|
}
|
|
784
|
+
/** What a {@link CustomBlockEditor}'s component is rendered with. */
|
|
785
|
+
interface CustomBlockEditorProps {
|
|
786
|
+
/** The block being edited. */
|
|
787
|
+
block: SupportedBlock;
|
|
788
|
+
/**
|
|
789
|
+
* Replaces the block. The result must still be ordinary Block Kit: it is
|
|
790
|
+
* previewed, validated and sent like any other block.
|
|
791
|
+
*/
|
|
792
|
+
onChange: (next: SupportedBlock) => void;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* A host-owned form for blocks your app gives a meaning of its own, e.g. a
|
|
796
|
+
* "Share on LinkedIn" button whose URL is built from the post text. It
|
|
797
|
+
* replaces the built-in form in the block's edit popover. The block itself
|
|
798
|
+
* stays ordinary Block Kit, so preview, validation and sending don't change.
|
|
799
|
+
*/
|
|
800
|
+
interface CustomBlockEditor {
|
|
801
|
+
/** Stable identifier. */
|
|
802
|
+
id: string;
|
|
803
|
+
/** Names the block in the editor's heading, e.g. "Edit Share on LinkedIn". */
|
|
804
|
+
label: string;
|
|
805
|
+
/**
|
|
806
|
+
* Whether this editor handles a block; the first match wins. Match on what
|
|
807
|
+
* the block itself holds (a URL, an `action_id`): a message loaded back
|
|
808
|
+
* from Slack carries nothing else.
|
|
809
|
+
*/
|
|
810
|
+
match: (block: SupportedBlock) => boolean;
|
|
811
|
+
/** The form. Rendered as a component, so it can use hooks. */
|
|
812
|
+
component: ComponentType<CustomBlockEditorProps>;
|
|
813
|
+
}
|
|
760
814
|
/**
|
|
761
815
|
* A host-owned primary action for compose-only mode, rendered in the
|
|
762
816
|
* toolbar slot where the built-in "Review & send" button normally sits.
|
|
@@ -1168,6 +1222,12 @@ interface BlockKitchenBaseProps {
|
|
|
1168
1222
|
* {@link BlockPosition}); return `null` for a block with nothing to show.
|
|
1169
1223
|
*/
|
|
1170
1224
|
renderBlockAdornment?: (position: BlockPosition) => ReactNode;
|
|
1225
|
+
/**
|
|
1226
|
+
* Opt-in host forms that replace the built-in editor for the blocks they
|
|
1227
|
+
* match. See {@link CustomBlockEditor}. Expected to be referentially
|
|
1228
|
+
* stable across renders (define at module scope or wrap in `useMemo`).
|
|
1229
|
+
*/
|
|
1230
|
+
blockEditors?: readonly CustomBlockEditor[];
|
|
1171
1231
|
/**
|
|
1172
1232
|
* Workspace custom emoji (`emoji.list`) the preview should resolve. Entries
|
|
1173
1233
|
* with a non-null `url` render as the workspace image; alias entries fall
|
|
@@ -1318,6 +1378,14 @@ interface BlockKitchenBaseProps {
|
|
|
1318
1378
|
href?: string;
|
|
1319
1379
|
label?: string;
|
|
1320
1380
|
};
|
|
1381
|
+
/**
|
|
1382
|
+
* Whether Ctrl/Cmd+Z undoes and Ctrl/Cmd+Shift+Z (or Ctrl+Y) redoes, like
|
|
1383
|
+
* the toolbar's Undo / Redo buttons. Defaults to `true`. They act while
|
|
1384
|
+
* focus is in the builder, or while nothing on the page has focus and the
|
|
1385
|
+
* last click landed in the builder, and never in a text field. Pass `false`
|
|
1386
|
+
* to leave those keys entirely to the host.
|
|
1387
|
+
*/
|
|
1388
|
+
undoRedoShortcuts?: boolean;
|
|
1321
1389
|
/**
|
|
1322
1390
|
* Initial preview theme (uncontrolled). Defaults to `'light'`. Pass the
|
|
1323
1391
|
* host app's current theme (e.g. from `next-themes` or your own theme
|
|
@@ -1468,4 +1536,4 @@ interface BlockKitchenComposeOnlyProps {
|
|
|
1468
1536
|
*/
|
|
1469
1537
|
type BlockKitchenProps = BlockKitchenBaseProps & (BlockKitchenSendProps | BlockKitchenComposeOnlyProps);
|
|
1470
1538
|
|
|
1471
|
-
export { type
|
|
1539
|
+
export { type MentionUser as $, type AlertBlock as A, type BlockKitchenProps as B, type ChannelOption as C, type CustomBlockEditor as D, type CustomBlockEditorProps as E, type CustomEmoji as F, type DataTableActionCell as G, type DataTableBlock as H, type DataTableCell as I, type DataTableRawNumberCell as J, type DataVisualizationBlock as K, type EditableVia as L, type FeedbackButtonSubobject as M, type FeedbackButtonsElement as N, type HeaderLevel as O, type PreviewSurface as P, type IconButtonElement as Q, type IconButtonIcon as R, type SupportedBlock as S, type Template as T, type InputBlock as U, type LoadMessageInput as V, type LoadResult as W, type LoadedMessage as X, type LoadingConfig as Y, type MarkdownBlock as Z, type MentionChannel as _, type SendAsUserStatus as a, type MentionsConfig as a0, type PaletteMode as a1, type PaletteSection as a2, type PaletteVariant as a3, type PaletteVariantBadge as a4, type PieChart as a5, type PieChartSegment as a6, type PlanBlock as a7, type PreviewHooks as a8, type PrimaryActionConfig as a9, type PrimaryActionContext as aa, type RecentMessage as ab, type SendResult as ac, type SupportedBlockType as ad, type SupportedHeaderBlock as ae, type TableBlock as af, type TableCell as ag, type TableColumnSetting as ah, type TableRawTextCell as ai, type TaskCardBlock as aj, type TaskCardStatus as ak, type UpdatePayload as al, type UpdateResult as am, type UrlSourceElement as an, type ValidationSummary as ao, type VideoBlock as ap, defaultPalette as aq, extraAlertVariant as ar, legacyInputVariants as as, buildVariantById as at, type SendPayload as b, type SendExtrasContext as c, type PreviewTheme as d, type AlertLevel as e, type BlockAction as f, type BlockKitchenBaseProps as g, type BlockKitchenComposeOnlyProps as h, type BlockKitchenSendProps as i, type BlockPosition as j, type BrandPreset as k, type BrandTheme as l, type BrandTokens as m, type BuilderBlock as n, type CardBlock as o, type CarouselBlock as p, type CartesianChart as q, type Chart as r, type ChartAxisConfig as s, type ChartDataPoint as t, type ChartSeries as u, type ChartType as v, type ContainerBlock as w, type ContainerChildBlock as x, type ContextActionsBlock as y, type ContextActionsElement as z };
|