@avocadostudio-ai/blocks 0.2.0 → 0.2.3

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.
Files changed (2) hide show
  1. package/README.md +73 -0
  2. package/package.json +12 -3
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @avocadostudio-ai/blocks
2
+
3
+ The built-in React renderers for Avocado Studio's block set, plus the dispatch
4
+ layer that lets you replace any of them with your own component.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @avocadostudio-ai/blocks
10
+ ```
11
+
12
+ ```tsx
13
+ import { SharedBlockRenderer } from "@avocadostudio-ai/blocks"
14
+ import "@avocadostudio-ai/blocks/styles.css"
15
+
16
+ export function Page({ page }) {
17
+ return page.blocks.map((block) => <SharedBlockRenderer key={block.id} block={block} />)
18
+ }
19
+ ```
20
+
21
+ The stylesheet is not optional — every renderer is styled by it.
22
+
23
+ ## The block set
24
+
25
+ Twenty types, all schema-declared in `@avocadostudio-ai/shared`:
26
+
27
+ `Hero`, `FeatureGrid`, `Testimonials`, `FAQAccordion`, `CTA`, `Card`,
28
+ `CardGrid`, `RichText`, `Banner`, `Carousel`, `Embed`, `Footer`, `Gallery`,
29
+ `Quote`, `SiteHeader`, `Stats`, `Table`, `Tabs`, `TwoColumn`, `Video`.
30
+
31
+ `SiteHeader` and `Footer` are **chrome**: structurally pinned, always present,
32
+ and not addable, movable or removable from the editor.
33
+
34
+ `rendererTypes` is the live list, so you never have to keep a copy of it.
35
+
36
+ ## Using your own component for a type
37
+
38
+ ```ts
39
+ import { registerCustomRenderer } from "@avocadostudio-ai/blocks"
40
+
41
+ registerCustomRenderer("Hero", MyHero)
42
+ ```
43
+
44
+ `SharedBlockRenderer` looks the type up and falls back to the built-in when
45
+ nothing is registered. `hasRenderer` and `getCustomRenderer` let you check.
46
+
47
+ Ordering matters and it bites: a `globalThis` registry override must be **last**
48
+ in source order, or a transitive import re-registers the default on top of
49
+ yours. If your host bundles across RSC / SSR / route-handler layers, do not rely
50
+ on module order at all — pass the registration through the `registerBlocks` hook
51
+ on `createEditorApiHandler` / `createOrchestrator`, which re-runs it after the
52
+ built-ins have registered.
53
+
54
+ ## Rendering with your own block set entirely
55
+
56
+ You do not need this package. A site with its own components renders them
57
+ itself and describes them to the editor with a block manifest. This package is
58
+ the starter kit, not the contract.
59
+
60
+ ## Exports
61
+
62
+ | Import | What it provides |
63
+ |---|---|
64
+ | `@avocadostudio-ai/blocks` | `SharedBlockRenderer`, `registerCustomRenderer`, `hasRenderer`, `getCustomRenderer`, `BlockCatalogue`, `BlocksHydrator`, `BlockErrorBoundary`, `rendererTypes` |
65
+ | `.../styles.css` | The stylesheet every renderer needs |
66
+
67
+ ## Peers
68
+
69
+ `next >= 15`, `react >= 19`, `react-dom >= 19`.
70
+
71
+ ## License
72
+
73
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avocadostudio-ai/blocks",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,8 +26,8 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@avocadostudio-ai/shared": "0.2.0",
30
- "@avocadostudio-ai/richtext": "0.2.0"
29
+ "@avocadostudio-ai/richtext": "0.2.3",
30
+ "@avocadostudio-ai/shared": "0.2.3"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "next": ">=15.0.0",
@@ -42,6 +42,15 @@
42
42
  "typescript": "^5.7.3"
43
43
  },
44
44
  "description": "Built-in React block renderers and block catalogue for Avocado Studio",
45
+ "keywords": [
46
+ "avocado",
47
+ "avocado-studio",
48
+ "react",
49
+ "blocks",
50
+ "page-builder",
51
+ "renderers",
52
+ "visual-editing"
53
+ ],
45
54
  "license": "Apache-2.0",
46
55
  "homepage": "https://github.com/avocadostudio-ai/avocado/tree/main/packages/blocks#readme",
47
56
  "bugs": {