@contentbit/blocks 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 contentbit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @contentbit/blocks
2
+
3
+ The generic block pack for [Content Blocks](https://contentbit.dev): `callout`, `steps`, `key-metrics`, `quick-ref`, `comparison`, `pros-cons`, `tabs`, and `faq`.
4
+
5
+ ```ts
6
+ import { createBlockRegistry } from '@contentbit/core'
7
+ import { genericBlocks } from '@contentbit/blocks'
8
+
9
+ const registry = createBlockRegistry().use(genericBlocks())
10
+ ```
11
+
12
+ Each block ships its schema, content model, authoring guidance, and a plain-Markdown fallback renderer.
13
+
14
+ Reference: [contentbit.dev/blocks](https://contentbit.dev/blocks)
@@ -0,0 +1,5 @@
1
+ import { type MarkdownBlockRenderer, type MarkdownBodyData } from '@contentbit/core';
2
+ export type CalloutData = MarkdownBodyData;
3
+ export declare const calloutBlock: import("@contentbit/core").BlockDefinition<MarkdownBodyData>;
4
+ export declare const calloutMarkdown: MarkdownBlockRenderer;
5
+ //# sourceMappingURL=callout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/blocks/callout.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAGzB,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAA;AAE1C,eAAO,MAAM,YAAY,8DAuBvB,CAAA;AAEF,eAAO,MAAM,eAAe,EAAE,qBAI7B,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { defineBlock, markdownBody, } from '@contentbit/core';
2
+ import { z } from 'zod';
3
+ export const calloutBlock = defineBlock({
4
+ name: 'callout',
5
+ description: 'Highlighted note, tip, warning, important, or TLDR box.',
6
+ props: z.object({
7
+ type: z.enum(['note', 'tip', 'warning', 'important', 'tldr']).default('note'),
8
+ title: z.string().min(1).optional(),
9
+ }),
10
+ content: markdownBody({ minLength: 10 }),
11
+ authoring: {
12
+ useWhen: [
13
+ 'Practical advice that prevents a common mistake (tip)',
14
+ 'Context the reader must not miss (note/important)',
15
+ 'Something that ruins the result if ignored (warning)',
16
+ 'A 1-3 sentence summary at the top of a section (tldr)',
17
+ ],
18
+ avoidWhen: [
19
+ 'Regular prose that is not a standout remark',
20
+ 'More than one callout in the same section',
21
+ 'Content longer than ~3 sentences',
22
+ ],
23
+ example: ':::callout{type="tip" title="Worth knowing"}\nAlways weigh flour — volume measures drift by 20%.\n:::',
24
+ },
25
+ });
26
+ export const calloutMarkdown = (node) => {
27
+ const data = node.data;
28
+ const title = node.props.title ?? String(node.props.type ?? 'note');
29
+ return `> **${title}:** ${data.markdown}`;
30
+ };
@@ -0,0 +1,5 @@
1
+ import { type MarkdownBlockRenderer, type PipeRowsData } from '@contentbit/core';
2
+ export type ComparisonData = PipeRowsData;
3
+ export declare const comparisonBlock: import("@contentbit/core").BlockDefinition<PipeRowsData>;
4
+ export declare const comparisonMarkdown: MarkdownBlockRenderer;
5
+ //# sourceMappingURL=comparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../src/blocks/comparison.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAA;AAGzB,MAAM,MAAM,cAAc,GAAG,YAAY,CAAA;AAEzC,eAAO,MAAM,eAAe,0DAiB1B,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,qBAShC,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { defineBlock, pipeRows, } from '@contentbit/core';
2
+ import { z } from 'zod';
3
+ export const comparisonBlock = defineBlock({
4
+ name: 'comparison',
5
+ description: 'Side-by-side comparison of exactly two options.',
6
+ props: z.object({
7
+ left: z.string().min(1),
8
+ right: z.string().min(1),
9
+ }),
10
+ content: pipeRows({ columns: ['label', 'left', 'right'], minRows: 2, maxRows: 12 }),
11
+ authoring: {
12
+ useWhen: [
13
+ 'Comparing exactly two things across attributes',
14
+ 'Replacing a two-column Markdown table',
15
+ ],
16
+ avoidWhen: ['Comparing more than two things', 'Only one row of comparison'],
17
+ example: ':::comparison{left="Option A" right="Option B"}\n- Speed | Fast | Slow\n- Setup | Simple | Advanced\n:::',
18
+ },
19
+ });
20
+ export const comparisonMarkdown = (node) => {
21
+ const data = node.data;
22
+ const esc = (s) => s.replace(/\|/g, '\\|');
23
+ const left = esc(String(node.props.left));
24
+ const right = esc(String(node.props.right));
25
+ const lines = [`| | ${left} | ${right} |`, '|---|---|---|'];
26
+ for (const row of data.rows)
27
+ lines.push(`| ${esc(row.label)} | ${esc(row.left)} | ${esc(row.right)} |`);
28
+ return lines.join('\n');
29
+ };
@@ -0,0 +1,7 @@
1
+ import { type ChildBlocksData, type MarkdownBlockRenderer, type MarkdownBodyData } from '@contentbit/core';
2
+ export type FaqData = ChildBlocksData;
3
+ export type FaqItemData = MarkdownBodyData;
4
+ export declare const faqItemBlock: import("@contentbit/core").BlockDefinition<MarkdownBodyData>;
5
+ export declare const faqBlock: import("@contentbit/core").BlockDefinition<ChildBlocksData>;
6
+ export declare const faqMarkdown: MarkdownBlockRenderer;
7
+ //# sourceMappingURL=faq.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faq.d.ts","sourceRoot":"","sources":["../../src/blocks/faq.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAGzB,MAAM,MAAM,OAAO,GAAG,eAAe,CAAA;AACrC,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAA;AAE1C,eAAO,MAAM,YAAY,8DAWvB,CAAA;AAEF,eAAO,MAAM,QAAQ,6DAUnB,CAAA;AAEF,eAAO,MAAM,WAAW,EAAE,qBAQzB,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { childBlocks, defineBlock, isValidatedBlock, markdownBody, } from '@contentbit/core';
2
+ import { z } from 'zod';
3
+ export const faqItemBlock = defineBlock({
4
+ name: 'faq-item',
5
+ description: 'One question/answer pair.',
6
+ props: z.object({ question: z.string().min(1) }),
7
+ content: markdownBody(),
8
+ childOnly: true,
9
+ authoring: {
10
+ useWhen: ['Only inside :::faq'],
11
+ avoidWhen: ['Anywhere outside :::faq'],
12
+ example: '::faq-item{question="Can I freeze it?"}\nYes, up to 3 months.',
13
+ },
14
+ });
15
+ export const faqBlock = defineBlock({
16
+ name: 'faq',
17
+ description: 'Frequently asked questions with expandable answers.',
18
+ content: childBlocks({ allowed: ['faq-item'], minChildren: 1, maxChildren: 20 }),
19
+ interactive: true,
20
+ authoring: {
21
+ useWhen: ['Real questions readers ask about the topic', 'End-of-article FAQ sections'],
22
+ avoidWhen: ['Content that is not literally question/answer', 'A single trivial question'],
23
+ example: ':::faq\n::faq-item{question="Can I freeze it?"}\nYes, up to 3 months.\n:::',
24
+ },
25
+ });
26
+ export const faqMarkdown = (node) => {
27
+ const data = node.data;
28
+ return data.blocks
29
+ .map((item) => {
30
+ const body = isValidatedBlock(item) ? item.data.markdown : item.body.trim();
31
+ return `**Q: ${String(item.props.question)}**\n\n${body}`;
32
+ })
33
+ .join('\n\n');
34
+ };
@@ -0,0 +1,5 @@
1
+ import { type MarkdownBlockRenderer, type PipeRowsData } from '@contentbit/core';
2
+ export type KeyMetricsData = PipeRowsData;
3
+ export declare const keyMetricsBlock: import("@contentbit/core").BlockDefinition<PipeRowsData>;
4
+ export declare const keyMetricsMarkdown: MarkdownBlockRenderer;
5
+ //# sourceMappingURL=key-metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-metrics.d.ts","sourceRoot":"","sources":["../../src/blocks/key-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,cAAc,GAAG,YAAY,CAAA;AAEzC,eAAO,MAAM,eAAe,0DAS1B,CAAA;AAEF,eAAO,MAAM,kBAAkB,EAAE,qBAGhC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { defineBlock, pipeRows, } from '@contentbit/core';
2
+ export const keyMetricsBlock = defineBlock({
3
+ name: 'key-metrics',
4
+ description: 'Scannable stat cards: a large value with a short label.',
5
+ content: pipeRows({ columns: ['value', 'label'], minRows: 2, maxRows: 8 }),
6
+ authoring: {
7
+ useWhen: ['Surfacing 2-8 numbers the reader should remember', 'Replacing a stats paragraph'],
8
+ avoidWhen: ['Values without a clear unit or context', 'Long textual descriptions'],
9
+ example: ':::key-metrics\n- 42% | Conversion lift\n- 18ms | Median parse time\n:::',
10
+ },
11
+ });
12
+ export const keyMetricsMarkdown = (node) => {
13
+ const data = node.data;
14
+ return data.rows.map((row) => `- **${row.value}** — ${row.label}`).join('\n');
15
+ };
@@ -0,0 +1,9 @@
1
+ import { type ListItemsData, type MarkdownBlockRenderer } from '@contentbit/core';
2
+ export type ProsConsData = ListItemsData;
3
+ export declare function splitProsCons(data: ProsConsData): {
4
+ pros: string[];
5
+ cons: string[];
6
+ };
7
+ export declare const prosConsBlock: import("@contentbit/core").BlockDefinition<ListItemsData>;
8
+ export declare const prosConsMarkdown: MarkdownBlockRenderer;
9
+ //# sourceMappingURL=pros-cons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pros-cons.d.ts","sourceRoot":"","sources":["../../src/blocks/pros-cons.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,YAAY,GAAG,aAAa,CAAA;AAExC,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAKpF;AAED,eAAO,MAAM,aAAa,2DASxB,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,qBAS9B,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { defineBlock, listItems, } from '@contentbit/core';
2
+ export function splitProsCons(data) {
3
+ return {
4
+ pros: data.items.filter((i) => i.sign === '+').map((i) => i.text),
5
+ cons: data.items.filter((i) => i.sign === '-').map((i) => i.text),
6
+ };
7
+ }
8
+ export const prosConsBlock = defineBlock({
9
+ name: 'pros-cons',
10
+ description: 'Paired advantages (+) and disadvantages (-) of one option.',
11
+ content: listItems({ marker: 'signed', minItems: 2, maxItems: 16 }),
12
+ authoring: {
13
+ useWhen: ["Evaluating a single option's trade-offs", 'Summarizing a review'],
14
+ avoidWhen: ['Comparing two options — use comparison', 'Only positives or only negatives'],
15
+ example: ':::pros-cons\n+ Cheap to run\n+ Fast setup\n- No offline mode\n:::',
16
+ },
17
+ });
18
+ export const prosConsMarkdown = (node) => {
19
+ const { pros, cons } = splitProsCons(node.data);
20
+ const parts = [];
21
+ if (pros.length > 0)
22
+ parts.push('**Pros**', '', ...pros.map((p) => `- ${p}`));
23
+ if (cons.length > 0) {
24
+ if (parts.length > 0)
25
+ parts.push('');
26
+ parts.push('**Cons**', '', ...cons.map((c) => `- ${c}`));
27
+ }
28
+ return parts.join('\n');
29
+ };
@@ -0,0 +1,5 @@
1
+ import { type MarkdownBlockRenderer, type PipeRowsData } from '@contentbit/core';
2
+ export type QuickRefData = PipeRowsData;
3
+ export declare const quickRefBlock: import("@contentbit/core").BlockDefinition<PipeRowsData>;
4
+ export declare const quickRefMarkdown: MarkdownBlockRenderer;
5
+ //# sourceMappingURL=quick-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quick-ref.d.ts","sourceRoot":"","sources":["../../src/blocks/quick-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,YAAY,GAAG,YAAY,CAAA;AAEvC,eAAO,MAAM,aAAa,0DAYxB,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,qBAG9B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { defineBlock, pipeRows, } from '@contentbit/core';
2
+ export const quickRefBlock = defineBlock({
3
+ name: 'quick-ref',
4
+ description: 'Compact key/value reference card.',
5
+ content: pipeRows({ columns: ['key', 'value'], minRows: 2, maxRows: 12 }),
6
+ authoring: {
7
+ useWhen: [
8
+ 'Facts a reader will return to (temperatures, ratios, durations)',
9
+ 'At-a-glance summaries near the top of a guide',
10
+ ],
11
+ avoidWhen: ['Narrative content', 'Comparing options — use comparison instead'],
12
+ example: ':::quick-ref\n- Hydration | 65%\n- Proof time | 2h at 24°C\n:::',
13
+ },
14
+ });
15
+ export const quickRefMarkdown = (node) => {
16
+ const data = node.data;
17
+ return data.rows.map((row) => `- **${row.key}:** ${row.value}`).join('\n');
18
+ };
@@ -0,0 +1,5 @@
1
+ import { type ListItemsData, type MarkdownBlockRenderer } from '@contentbit/core';
2
+ export type StepsData = ListItemsData;
3
+ export declare const stepsBlock: import("@contentbit/core").BlockDefinition<ListItemsData>;
4
+ export declare const stepsMarkdown: MarkdownBlockRenderer;
5
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/blocks/steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,SAAS,GAAG,aAAa,CAAA;AAErC,eAAO,MAAM,UAAU,2DASrB,CAAA;AAEF,eAAO,MAAM,aAAa,EAAE,qBAG3B,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { defineBlock, listItems, } from '@contentbit/core';
2
+ export const stepsBlock = defineBlock({
3
+ name: 'steps',
4
+ description: 'Ordered process steps with visual numbering.',
5
+ content: listItems({ marker: 'ordered', minItems: 2, maxItems: 15 }),
6
+ authoring: {
7
+ useWhen: ['Sequential processes where order matters', '3+ steps that benefit from numbering'],
8
+ avoidWhen: ['Unordered tips — use a bullet list', 'A single step — write it in prose'],
9
+ example: ':::steps\n1. Combine flour and water\n2. Rest 20 minutes\n3. Add salt and mix\n:::',
10
+ },
11
+ });
12
+ export const stepsMarkdown = (node) => {
13
+ const data = node.data;
14
+ return data.items.map((item, i) => `${i + 1}. ${item.text}`).join('\n');
15
+ };
@@ -0,0 +1,7 @@
1
+ import { type ChildBlocksData, type MarkdownBlockRenderer, type MarkdownBodyData } from '@contentbit/core';
2
+ export type TabsData = ChildBlocksData;
3
+ export type TabData = MarkdownBodyData;
4
+ export declare const tabBlock: import("@contentbit/core").BlockDefinition<MarkdownBodyData>;
5
+ export declare const tabsBlock: import("@contentbit/core").BlockDefinition<ChildBlocksData>;
6
+ export declare const tabsMarkdown: MarkdownBlockRenderer;
7
+ //# sourceMappingURL=tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/blocks/tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAA;AAGzB,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAA;AACtC,MAAM,MAAM,OAAO,GAAG,gBAAgB,CAAA;AAEtC,eAAO,MAAM,QAAQ,8DAWnB,CAAA;AAEF,eAAO,MAAM,SAAS,6DAcpB,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,qBAQ1B,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { childBlocks, defineBlock, isValidatedBlock, markdownBody, } from '@contentbit/core';
2
+ import { z } from 'zod';
3
+ export const tabBlock = defineBlock({
4
+ name: 'tab',
5
+ description: 'One tab panel with a title.',
6
+ props: z.object({ title: z.string().min(1) }),
7
+ content: markdownBody(),
8
+ childOnly: true,
9
+ authoring: {
10
+ useWhen: ['Only inside :::tabs'],
11
+ avoidWhen: ['Anywhere outside :::tabs'],
12
+ example: '::tab{title="Stand Mixer"}\nUse the dough hook on speed 2.',
13
+ },
14
+ });
15
+ export const tabsBlock = defineBlock({
16
+ name: 'tabs',
17
+ description: 'Tabbed switcher for alternative methods or variants — the reader picks one.',
18
+ content: childBlocks({ allowed: ['tab'], minChildren: 2, maxChildren: 6 }),
19
+ interactive: true,
20
+ authoring: {
21
+ useWhen: [
22
+ 'Two or more alternative methods for the same task',
23
+ 'Variants by equipment, audience, or budget',
24
+ ],
25
+ avoidWhen: ['Side-by-side comparison — use comparison', 'Sequential content — use steps'],
26
+ example: ':::tabs\n::tab{title="Fast"}\nUse this when time matters.\n::tab{title="Cheap"}\nUse this when budget matters.\n:::',
27
+ },
28
+ });
29
+ export const tabsMarkdown = (node) => {
30
+ const data = node.data;
31
+ return data.blocks
32
+ .map((tab) => {
33
+ const body = isValidatedBlock(tab) ? tab.data.markdown : tab.body.trim();
34
+ return `### ${String(tab.props.title)}\n\n${body}`;
35
+ })
36
+ .join('\n\n');
37
+ };
@@ -0,0 +1,14 @@
1
+ import type { BlockDefinition, MarkdownBlockRenderer } from '@contentbit/core';
2
+ export * from './blocks/callout.js';
3
+ export * from './blocks/comparison.js';
4
+ export * from './blocks/faq.js';
5
+ export * from './blocks/key-metrics.js';
6
+ export * from './blocks/pros-cons.js';
7
+ export * from './blocks/quick-ref.js';
8
+ export * from './blocks/steps.js';
9
+ export * from './blocks/tabs.js';
10
+ /** The default generic block pack: 8 blocks + 2 child blocks. */
11
+ export declare function genericBlocks(): BlockDefinition<unknown>[];
12
+ /** Markdown fallback renderers for the generic pack. */
13
+ export declare const genericMarkdownRenderers: Record<string, MarkdownBlockRenderer>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAW9E,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAEhC,iEAAiE;AACjE,wBAAgB,aAAa,IAAI,eAAe,CAAC,OAAO,CAAC,EAAE,CAa1D;AAED,wDAAwD;AACxD,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAS1E,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import { calloutBlock, calloutMarkdown } from './blocks/callout.js';
2
+ import { comparisonBlock, comparisonMarkdown } from './blocks/comparison.js';
3
+ import { faqBlock, faqItemBlock, faqMarkdown } from './blocks/faq.js';
4
+ import { keyMetricsBlock, keyMetricsMarkdown } from './blocks/key-metrics.js';
5
+ import { prosConsBlock, prosConsMarkdown } from './blocks/pros-cons.js';
6
+ import { quickRefBlock, quickRefMarkdown } from './blocks/quick-ref.js';
7
+ import { stepsBlock, stepsMarkdown } from './blocks/steps.js';
8
+ import { tabBlock, tabsBlock, tabsMarkdown } from './blocks/tabs.js';
9
+ export * from './blocks/callout.js';
10
+ export * from './blocks/comparison.js';
11
+ export * from './blocks/faq.js';
12
+ export * from './blocks/key-metrics.js';
13
+ export * from './blocks/pros-cons.js';
14
+ export * from './blocks/quick-ref.js';
15
+ export * from './blocks/steps.js';
16
+ export * from './blocks/tabs.js';
17
+ /** The default generic block pack: 8 blocks + 2 child blocks. */
18
+ export function genericBlocks() {
19
+ return [
20
+ calloutBlock,
21
+ stepsBlock,
22
+ keyMetricsBlock,
23
+ quickRefBlock,
24
+ comparisonBlock,
25
+ prosConsBlock,
26
+ tabsBlock,
27
+ tabBlock,
28
+ faqBlock,
29
+ faqItemBlock,
30
+ ];
31
+ }
32
+ /** Markdown fallback renderers for the generic pack. */
33
+ export const genericMarkdownRenderers = {
34
+ callout: calloutMarkdown,
35
+ steps: stepsMarkdown,
36
+ 'key-metrics': keyMetricsMarkdown,
37
+ 'quick-ref': quickRefMarkdown,
38
+ comparison: comparisonMarkdown,
39
+ 'pros-cons': prosConsMarkdown,
40
+ tabs: tabsMarkdown,
41
+ faq: faqMarkdown,
42
+ };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@contentbit/blocks",
3
+ "version": "0.1.0",
4
+ "description": "The generic block pack for Content Blocks: callout, steps, comparison, tabs, faq, and more.",
5
+ "keywords": [
6
+ "components",
7
+ "content-blocks",
8
+ "llm",
9
+ "markdown"
10
+ ],
11
+ "homepage": "https://contentbit.dev",
12
+ "bugs": "https://github.com/agonist/contentbit/issues",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/agonist/contentbit.git",
17
+ "directory": "packages/blocks"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "zod": "^4.0.0",
35
+ "@contentbit/core": "0.1.0"
36
+ },
37
+ "devDependencies": {
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^4.0.17"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -p tsconfig.build.json",
43
+ "test": "vitest run",
44
+ "test:watch": "vitest"
45
+ }
46
+ }