feat(templates): ship richer default template gallery as library export#56
Merged
Conversation
Adds `defaultTemplates` — a curated set of 10 polished templates covering all three Slack surfaces (message / modal / app_home) and exercising every supported block type (section, header, divider, context, actions, image, markdown, rich_text, table, alert, card, carousel, context_actions, input) plus the full element catalog (every select type, all date/time pickers, all text-input variants, file input, rich text input, feedback / icon buttons, image accessories, overflow menus, button confirm dialogs). Previously the live demo and Storybook each maintained their own short, 3-block sample arrays (header + section + divider only) — useful for a hello-world but did not show what the platform can render. Both now import `defaultTemplates` from the package so the demo, Storybook, and downstream consumers share a single polished gallery. Template lineup (grouped by category): - Engineering: Pull request review, Incident report - Approvals: Expense approval, Confirm destructive action - Team: Daily standup - Announcements: Product release - Forms: Customer feedback intake - Scheduling: Schedule meeting - Home tabs: Welcome / onboarding, Team dashboard Also adds public-API tests for the new export: id uniqueness, non-empty blocks, valid surface enum, surface-compatibility (mirroring the validator's forbidden-blocks-per-surface rules), and `toSlackBlocks` roundtrip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
block-kitchen | dbeaf7e | Commit Preview URL Branch Preview URL |
May 16 2026, 05:16 PM |
Per review: templates are use-case examples (an "Expense approval" is for an approvals product, a "Daily standup" is for a team product) and don't belong in the library bundle. Unlike `defaultPalette`, which is core builder functionality auto-applied to `<BlockKitchen>` when no `palette` prop is passed, templates are something each consuming app configures for its own use case. - Move `src/lib/default-templates.ts` → `demo/src/templates.ts`, rename the export to `demoTemplates`, and reword the doc comment to make clear this is the demo's config (not a shipped default). - Drop the `defaultTemplates` + `TEMPLATE_CATEGORIES` exports from `src/index.ts`. The library no longer ships any templates. - `demo/src/App.tsx` now imports `demoTemplates` from `./templates`. - Revert `template-picker.stories.tsx` to inline lightweight fixtures — stories exist to exercise the picker UI (categories, surface filter, empty state, dark theme), not to be a marketing showcase. - Drop the `defaultTemplates` describe block from `public-api.test.ts` since templates are no longer part of the public API. The library ESM bundle drops from 266 KB → 228 KB and the typed dist from 26.75 KB → 25.19 KB as a result. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…avira-92f9f8 # Conflicts: # demo/src/App.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
defaultTemplateslibrary export — a curated set of 10 polished templates spanning all three Slack surfaces (message,modal,app_home) that collectively exercise every supported block type and a wide slice of the element catalog. The live demo and Storybook fixtures now consume this shared export instead of each carrying their own short hello-world arrays.Why
The demo at block-kitchen.tightknit.dev and the Storybook
TemplatePickerstories previously each maintained their own 3-block sample arrays (header + section + divider). They were useful as a hello-world but didn't show what the platform can render. Anyone evaluating the package landed on a template gallery that visually under-sold the library's capabilities. Shipping a curated gallery as a library export means: (1) the demo and Storybook stay in sync from a single source of truth, (2) downstream consumers get a polished starting point for free, and (3) the gallery itself becomes part of the visual story for new users.What's in the gallery
markdownblock with GFM table + 3-card carouselSurface compatibility is respected throughout —
alertonly in modals, notable/markdown/carousel/context_actionsin modals, notable/markdown/context_actionson home tabs,file_inputonly in modals.Files changed
src/lib/default-templates.ts— the 10 templates and aTEMPLATE_CATEGORIESconstant.src/index.ts— exportsdefaultTemplatesandTEMPLATE_CATEGORIES.demo/src/App.tsx— importsdefaultTemplates(replaces the inlineTEMPLATESarray).src/components/template-picker.stories.tsx— importsdefaultTemplates; newFilteredToAppHomeSurfacestory;ClickCardInvokesHandlerretargeted toexpense-approval.test/public-api.test.ts— newdescribe('default templates')block: id uniqueness, non-empty blocks, valid surface enum, surface-compatibility (mirroring the validator's forbidden-blocks-per-surface rules), andtoSlackBlocksroundtrip.Test plan
pnpm typecheckpnpm test— 214/214 pass (up from 193)pnpm build—defaultTemplatesandTEMPLATE_CATEGORIESappear indist/index.d.tsNotes for reviewer
biome-fixreformatted some long lines and re-ordered the newsrc/index.tsexport (defaultTemplatesalphabetized beforeTEMPLATE_CATEGORIES) — those tweaks are intentional, not stale code.mainis 4 commits ahead of this branch (most relevantlyfeat(theme): add eclectic preset themes(feat(theme): add eclectic preset themes (Slack, Ocean, Sunset, Mono, Cyberpunk) #50) which also editsdemo/src/App.tsx— adds aBrandPresetpicker in the header). The two edits don't overlap (preset picker is in the header<button>area; my change is only to the templates<aside>and the imports list), so the merge should be clean.🤖 Generated with Claude Code