{"_id":"@bnomei/emdash-blocks","_rev":"4-f7bd4bc4eb1cb7f8d3254680e24245c3","name":"@bnomei/emdash-blocks","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@bnomei/emdash-blocks","version":"0.1.0","keywords":["astro","block-builder","cms","emdash","emdash-plugin","field-widget","json","react","typescript"],"author":{"url":"https://bnomei.com","name":"Bruno Meilick","email":"b@bnomei.com"},"license":"MIT","_id":"@bnomei/emdash-blocks@0.1.0","maintainers":[{"name":"bnomei","email":"b@bnomei.com"}],"homepage":"https://github.com/bnomei/emdash-blocks#readme","bugs":{"url":"https://github.com/bnomei/emdash-blocks/issues"},"dist":{"shasum":"bf108cb05902a2fd61de44d145f684e8db5cd7a1","tarball":"https://registry.npmjs.org/@bnomei/emdash-blocks/-/emdash-blocks-0.1.0.tgz","fileCount":10,"integrity":"sha512-Vts8bcyfuzjVUZWkSM/cS6Ro4UgOYSjZ5SxA44K67AuMShO3EOS3g9L8B1PGUbj69C+FyZfvsF8WhuR5N6qmAg==","signatures":[{"sig":"MEQCID3KF93bPSAkUj3LThP+rGc19Yd/bzIlIVCpO7PyPQmuAiAq7BkMB5v5VVazxZgcI62TutADUTQNH0owx9TEravJoA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139129},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./admin":{"types":"./dist/admin.d.mts","import":"./dist/admin.mjs"}},"gitHead":"6b27077a158a9c847063ae94b7e76ff7c9ba5724","scripts":{"build":"vp pack src/index.ts src/admin.tsx --format esm --dts --clean --tsconfig tsconfig.json","check":"vp check .","prepack":"npm run build","typecheck":"tsc --noEmit","pack:check":"vp pack src/index.ts src/admin.tsx --format esm --dts --clean --tsconfig tsconfig.json --publint","types:check":"attw --pack . --profile esm-only --no-summary","prepublishOnly":"npm run check && npm run typecheck && npm run pack:check && npm run types:check"},"_npmUser":{"name":"bnomei","email":"b@bnomei.com"},"repository":{"url":"git+https://github.com/bnomei/emdash-blocks.git","type":"git"},"_npmVersion":"11.16.0","description":"JSON block-list field widget for EmDash entries, with normalized block props and visibility state.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.7","emdash":"^0.19.0","publint":"^0.3.21","react-dom":"^19.2.7","vite-plus":"^0.1.24","typescript":"^6.0.3","@types/react":"^19.2.17","@cloudflare/kumo":"^2.5.2","@types/react-dom":"^19.2.3","@arethetypeswrong/cli":"^0.18.3","@phosphor-icons/react":"^2.1.10"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","emdash":">=0.17.0","react-dom":"^18.0.0 || ^19.0.0","@cloudflare/kumo":"^2.5.0","@phosphor-icons/react":"^2.1.10"},"_npmOperationalInternal":{"tmp":"tmp/emdash-blocks_0.1.0_1781300469034_0.7435472068667479","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@bnomei/emdash-blocks","version":"0.1.1","keywords":["astro","block-builder","cms","emdash","emdash-plugin","field-widget","json","react","typescript"],"author":{"url":"https://bnomei.com","name":"Bruno Meilick","email":"b@bnomei.com"},"license":"MIT","_id":"@bnomei/emdash-blocks@0.1.1","maintainers":[{"name":"bnomei","email":"b@bnomei.com"}],"homepage":"https://github.com/bnomei/emdash-blocks#readme","bugs":{"url":"https://github.com/bnomei/emdash-blocks/issues"},"dist":{"shasum":"278043ef0998b7bb4c6994027d3008ca704013a3","tarball":"https://registry.npmjs.org/@bnomei/emdash-blocks/-/emdash-blocks-0.1.1.tgz","fileCount":12,"integrity":"sha512-ByhyjS4sMjzRc1LmMDV1Q30g8npqN6LKd6L+SIyGL3DlOc6CjqssN6HU9k1LqmRx4YWhPbBLaKyj/H46cJZB2A==","signatures":[{"sig":"MEUCIHt32G62agetPnSR2yy6ynzvngNEodmjLExfiBdfL/b7AiEAo5TG09AHLRoBldwzbbABZ5dCLp/cqCmK+dg2awRMjgk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":148993},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./admin":{"types":"./dist/admin.d.mts","import":"./dist/admin.mjs"}},"gitHead":"760bd9ca566079e3747d2484bead36b86c9c85d2","scripts":{"test":"npm run build && node --test test/*.mjs && vp test src/editorCommandAdapter.test.ts","build":"vp pack src/index.ts src/admin.tsx src/adminTransforms.ts --format esm --dts --clean --tsconfig tsconfig.json","check":"vp check .","prepack":"npm run build","typecheck":"tsc --noEmit","pack:check":"vp pack src/index.ts src/admin.tsx src/adminTransforms.ts --format esm --dts --clean --tsconfig tsconfig.json --publint","types:check":"attw --pack . --profile esm-only --no-summary","prepublishOnly":"npm run check && npm run typecheck && npm test && npm run pack:check && npm run types:check"},"_npmUser":{"name":"bnomei","email":"b@bnomei.com"},"repository":{"url":"git+https://github.com/bnomei/emdash-blocks.git","type":"git"},"_npmVersion":"11.16.0","description":"JSON block-list field widget for EmDash entries, with normalized block props and visibility state.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.7","emdash":"^0.19.0","publint":"^0.3.21","react-dom":"^19.2.7","vite-plus":"^0.1.24","typescript":"^6.0.3","@types/react":"^19.2.17","@cloudflare/kumo":"^2.5.2","@types/react-dom":"^19.2.3","@arethetypeswrong/cli":"^0.18.3","@phosphor-icons/react":"^2.1.10"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","emdash":">=0.17.0","react-dom":"^18.0.0 || ^19.0.0","@cloudflare/kumo":"^2.5.0","@phosphor-icons/react":"^2.1.10"},"_npmOperationalInternal":{"tmp":"tmp/emdash-blocks_0.1.1_1781804684448_0.44584871448298236","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@bnomei/emdash-blocks","version":"0.2.0","keywords":["astro","block-builder","cms","emdash","emdash-plugin","field-widget","json","react","typescript"],"author":{"url":"https://bnomei.com","name":"Bruno Meilick","email":"b@bnomei.com"},"license":"MIT","_id":"@bnomei/emdash-blocks@0.2.0","maintainers":[{"name":"bnomei","email":"b@bnomei.com"}],"homepage":"https://github.com/bnomei/emdash-blocks#readme","bugs":{"url":"https://github.com/bnomei/emdash-blocks/issues"},"dist":{"shasum":"d43e6e14adec0f64cef8ac71cae95233101c2c43","tarball":"https://registry.npmjs.org/@bnomei/emdash-blocks/-/emdash-blocks-0.2.0.tgz","fileCount":13,"integrity":"sha512-xVw7+lgoj5hLFs0/bp6E0cLeenmZ9dVdivnmHm/J0FWS3mF/NOJE8Yt2Mq/sey3wTkbH5adO9wI4LpI7lUUOEw==","signatures":[{"sig":"MEUCIQCdFH2bk8lfPi5uj4bAO0gUb3NHtry2ASFHAUEgD3XmPgIgNaHIzqIl1kxgVXcHQkniPp9/6HiHOcnH/T6/VgGcS2g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":157848},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./admin":{"types":"./dist/admin.d.mts","import":"./dist/admin.mjs"}},"gitHead":"1b71d2477eb299fcf5fb22f18628112541f6e8bd","scripts":{"test":"npm run build && node --test test/*.mjs && vp test src/editorCommandAdapter.test.ts","build":"vp pack src/index.ts src/admin.tsx src/adminTransforms.ts --format esm --dts --clean --tsconfig tsconfig.json","check":"vp check .","prepack":"npm run build","typecheck":"tsc --noEmit","pack:check":"vp pack src/index.ts src/admin.tsx src/adminTransforms.ts --format esm --dts --clean --tsconfig tsconfig.json --publint","types:check":"attw --pack . --profile esm-only --no-summary","prepublishOnly":"npm run check && npm run typecheck && npm test && npm run pack:check && npm run types:check"},"_npmUser":{"name":"bnomei","email":"b@bnomei.com"},"repository":{"url":"git+https://github.com/bnomei/emdash-blocks.git","type":"git"},"_npmVersion":"11.16.0","description":"JSON block-list field widget for EmDash entries, with normalized block props and visibility state.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.7","emdash":"^0.19.0","publint":"^0.3.21","react-dom":"^19.2.7","vite-plus":"^0.1.24","typescript":"^6.0.3","@types/react":"^19.2.17","@cloudflare/kumo":"^2.5.2","@types/react-dom":"^19.2.3","@arethetypeswrong/cli":"^0.18.3","@phosphor-icons/react":"^2.1.10"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","emdash":">=0.17.0","react-dom":"^18.0.0 || ^19.0.0","@cloudflare/kumo":"^2.5.0","@phosphor-icons/react":"^2.1.10"},"_npmOperationalInternal":{"tmp":"tmp/emdash-blocks_0.2.0_1781814934809_0.9367864589979571","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@bnomei/emdash-blocks","version":"0.2.1","description":"JSON block-list field widget for EmDash entries, with normalized block props and visibility state.","keywords":["astro","block-builder","cms","emdash","emdash-plugin","field-widget","json","react","typescript"],"homepage":"https://github.com/bnomei/emdash-blocks#readme","bugs":{"url":"https://github.com/bnomei/emdash-blocks/issues"},"license":"MIT","author":{"name":"Bruno Meilick","email":"b@bnomei.com","url":"https://bnomei.com"},"repository":{"type":"git","url":"git+https://github.com/bnomei/emdash-blocks.git"},"type":"module","sideEffects":false,"main":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./admin":{"types":"./dist/admin.d.mts","import":"./dist/admin.mjs"}},"publishConfig":{"access":"public"},"scripts":{"build":"vp pack src/index.ts src/admin.tsx src/adminTransforms.ts --format esm --dts --clean --tsconfig tsconfig.json","check":"vp check .","pack:check":"vp pack src/index.ts src/admin.tsx src/adminTransforms.ts --format esm --dts --clean --tsconfig tsconfig.json --publint","prepack":"npm run build","prepublishOnly":"npm run check && npm run typecheck && npm test && npm run pack:check && npm run types:check","types:check":"attw --pack . --profile esm-only --no-summary","typecheck":"tsc --noEmit","test":"npm run build && node --test test/*.mjs && vp test src/editorCommandAdapter.test.ts"},"devDependencies":{"@arethetypeswrong/cli":"^0.18.3","@cloudflare/kumo":"^2.5.2","@phosphor-icons/react":"^2.1.10","@types/react":"^19.2.17","@types/react-dom":"^19.2.3","emdash":"^0.19.0","publint":"^0.3.21","react":"^19.2.7","react-dom":"^19.2.7","typescript":"^6.0.3","vite-plus":"^0.1.24"},"peerDependencies":{"@cloudflare/kumo":"^2.5.0","@phosphor-icons/react":"^2.1.10","emdash":">=0.17.0","react":"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0"},"engines":{"node":">=22.12.0"},"gitHead":"719b5c02700babb71bf2f46b9e90fe1218c638d5","_id":"@bnomei/emdash-blocks@0.2.1","_nodeVersion":"26.4.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-jX7F/+fqRTwltluQl+FpNRvoifEdYl1F9eOHk817keuUN/nw+h6HMsKxm5pFXFCy3imG0eu4KzzGTOafowc2EA==","shasum":"61215cb6566693bae70d3a7e90bd510ca460890b","tarball":"https://registry.npmjs.org/@bnomei/emdash-blocks/-/emdash-blocks-0.2.1.tgz","fileCount":13,"unpackedSize":176173,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDcSZlOIAcJmsYBbYo5J3iLi6YHCYlgULNWK8UEnK6IgAIhAKrP3nuU83voWLl33HaagrctkPzK7+447NtCtWTy70wU"}]},"_npmUser":{"name":"bnomei","email":"b@bnomei.com"},"directories":{},"maintainers":[{"name":"bnomei","email":"b@bnomei.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-blocks_0.2.1_1782745790231_0.8242255838828125"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-12T21:41:08.852Z","modified":"2026-06-29T15:09:50.460Z","0.1.0":"2026-06-12T21:41:09.172Z","0.1.1":"2026-06-18T17:44:44.607Z","0.2.0":"2026-06-18T20:35:34.987Z","0.2.1":"2026-06-29T15:09:50.364Z"},"bugs":{"url":"https://github.com/bnomei/emdash-blocks/issues"},"author":{"name":"Bruno Meilick","email":"b@bnomei.com","url":"https://bnomei.com"},"license":"MIT","homepage":"https://github.com/bnomei/emdash-blocks#readme","keywords":["astro","block-builder","cms","emdash","emdash-plugin","field-widget","json","react","typescript"],"repository":{"type":"git","url":"git+https://github.com/bnomei/emdash-blocks.git"},"description":"JSON block-list field widget for EmDash entries, with normalized block props and visibility state.","maintainers":[{"name":"bnomei","email":"b@bnomei.com"}],"readme":"# @bnomei/emdash-blocks\n\n[![npm version](https://img.shields.io/npm/v/@bnomei/emdash-blocks.svg)](https://www.npmjs.com/package/@bnomei/emdash-blocks)\n[![npm downloads](https://img.shields.io/npm/dm/@bnomei/emdash-blocks.svg)](https://www.npmjs.com/package/@bnomei/emdash-blocks)\n[![license](https://img.shields.io/npm/l/@bnomei/emdash-blocks.svg)](https://www.npmjs.com/package/@bnomei/emdash-blocks)\n[![types](https://img.shields.io/badge/types-included-blue.svg)](./package.json)\n[![source](https://img.shields.io/badge/source-GitHub-181717.svg?logo=github)](https://github.com/bnomei/emdash-blocks)\n\nStructured block-list editor for EmDash JSON fields.\n\n`@bnomei/emdash-blocks` is a native EmDash plugin for ordered\ncontent blocks stored as plain JSON. It registers the `block-builder:blocks`\nadmin widget, lets schemas define project-specific block types and typed prop\ncontrols, and exports runtime helpers for Astro renderers. Use it when an\nEmDash site needs controlled page sections, marketing modules, email blocks, or\nimported block data without moving that content into Portable Text.\n\n## What It Provides\n\n- Native EmDash plugin factory: `blockBuilderPlugin()`.\n- JSON field widget: `block-builder:blocks`.\n- Stored value shape for ordered blocks with `id`, `type`, `hidden`, and\n  `props`.\n- Admin UI built with [Kumo UI](https://kumo-ui.com/) with full light and dark\n  mode support.\n- Frontend helpers: `visibleBlocks()`, `blockProps()`, and\n  `isBlockBuilderBlock()`.\n\n## Install\n\n```sh\nnpm install @bnomei/emdash-blocks\n```\n\nRegister the plugin in `astro.config.mjs`:\n\n```js\nimport emdash from \"emdash/astro\";\nimport { blockBuilderPlugin } from \"@bnomei/emdash-blocks\";\n\nexport default {\n  integrations: [\n    emdash({\n      plugins: [blockBuilderPlugin()],\n    }),\n  ],\n};\n```\n\n## Field Widget\n\nUse the widget on an EmDash `json` field:\n\n```json\n{\n  \"slug\": \"blocks\",\n  \"label\": \"Blocks\",\n  \"type\": \"json\",\n  \"widget\": \"block-builder:blocks\",\n  \"options\": {\n    \"blockTypes\": [\n      { \"type\": \"heading\", \"label\": \"Heading\" },\n      { \"type\": \"text\", \"label\": \"Text\" },\n      { \"type\": \"image\", \"label\": \"Image\" }\n    ]\n  }\n}\n```\n\nUse `blockDefinitions` when the editor should render typed prop controls instead\nof the raw JSON fallback. TypeScript schemas can import `BlockBuilderOptions`\nfrom the public package entry to type field options:\n\n```ts\nimport type { BlockBuilderOptions } from \"@bnomei/emdash-blocks\";\n\nconst blockOptions: BlockBuilderOptions = {\n  blockDefinitions: [\n    {\n      type: \"heading\",\n      label: \"Heading\",\n      props: [\n        { key: \"text\", label: \"Text\", type: \"text\" },\n        {\n          key: \"level\",\n          label: \"Level\",\n          type: \"select\",\n          defaultValue: \"h2\",\n          options: [\"h1\", \"h2\", \"h3\", \"h4\"],\n        },\n      ],\n    },\n  ],\n};\n```\n\nThe same options can be used directly in JSON schemas:\n\n```json\n{\n  \"slug\": \"blocks\",\n  \"label\": \"Blocks\",\n  \"type\": \"json\",\n  \"widget\": \"block-builder:blocks\",\n  \"options\": {\n    \"blockDefinitions\": [\n      {\n        \"type\": \"heading\",\n        \"label\": \"Heading\",\n        \"props\": [\n          { \"key\": \"text\", \"label\": \"Text\", \"type\": \"text\" },\n          {\n            \"key\": \"level\",\n            \"label\": \"Level\",\n            \"type\": \"select\",\n            \"defaultValue\": \"h2\",\n            \"options\": [\"h1\", \"h2\", \"h3\", \"h4\"]\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\nSupported prop field types include all 16 EmDash field types: `string`, `text`,\n`url`, `number`, `integer`, `boolean`, `datetime`, `select`, `multiSelect`,\n`portableText`, `image`, `file`, `reference`, `json`, `slug`, and `repeater`.\n\nThe block builder also supports generic block-editor field types: `writer`,\n`markdown`, `textarea`, `color`, `media`, and `media-list`. Text-like fields\nrender as text inputs or textareas, numeric fields normalize numeric values,\n`boolean` renders as a switch, `select` and `multiSelect` render choice controls,\nand `portableText`/`writer` render the built-in rich text editor with paragraph,\nheading, quote, bold, italic, list, and link controls. `media` and `media-list`\nrender media-library selectors backed by EmDash media values. `json` and\n`repeater` use focused JSON editors, with `repeater` stored as a JSON array until\na dedicated repeater UI is available. `image`, `file`, `reference`, and `slug`\nrender ID/text inputs that match EmDash's stored values for those field types.\n\nProject-specific block types should be supplied through field options, or from a\nsite-local helper/plugin that writes those options. Keep the publishable block\nbuilder package focused on generic block editing.\n\nThe package defaults include only generic starter blocks. Site-specific blocks\nbelong in `options.blockDefinitions` on each field schema.\n\n## Stored Value\n\n```ts\ntype BlockBuilderValue = Array<{\n  id: string;\n  type: string;\n  hidden?: boolean;\n  props: Record<string, unknown>;\n}>;\n```\n\n## Frontend Rendering\n\nThe package exports helpers for frontend renderers:\n\n```ts\nimport { blockProps, isBlockBuilderBlock, visibleBlocks } from \"@bnomei/emdash-blocks\";\n\nconst blocks = visibleBlocks(entry.blocks);\n```\n\nRenderers should use `block.type` to pick a component and `block.props` for that\ncomponent's data:\n\n```astro\n{\n  blocks.map((block) => (\n    <>\n      {block.type === \"heading\" && <HeadingBlock props={blockProps(block)} />}\n      {block.type === \"text\" && <TextBlock props={blockProps(block)} />}\n    </>\n  ))\n}\n```\n\n`visibleBlocks()` accepts native Block Builder values and filters hidden blocks.\nMigration from other systems should happen before values are saved into EmDash.\n\n## Package Surface\n\n- ESM entry: `@bnomei/emdash-blocks`.\n- Admin entry: `@bnomei/emdash-blocks/admin`.\n- Type declarations are included from `dist/`.\n- Peer dependencies: `emdash` `>=0.17.0`, `react` `^18.0.0 || ^19.0.0`,\n  `react-dom` `^18.0.0 || ^19.0.0`, `@cloudflare/kumo` `^2.5.0`, and `@phosphor-icons/react`\n  `^2.1.10`.\n\n## Status\n\nThis package ships as a native EmDash plugin because the editor is a trusted React admin field widget. Package exports point at `vp pack`-built `dist/` JavaScript and declarations.\n\n## Related Packages\n\n- `@bnomei/emdash-fields` provides smaller JSON-backed field widgets.\n- `@bnomei/emdash-bento` provides row and column layout editing and\n  reuses Block Builder for nested blocks.\n\n## License\n\nMIT.\n\n## Screenshot\n\n![Block Builder screenshot](./screenshot.png)\n","readmeFilename":"README.md"}