{"_id":"@10up/block-renderer-block-schemas","_rev":"5-3db496e297be2c7644a2785120efebe1","name":"@10up/block-renderer-block-schemas","dist-tags":{"latest":"0.1.7"},"versions":{"0.1.4":{"name":"@10up/block-renderer-block-schemas","version":"0.1.4","keywords":["wordpress","blocks","gutenberg","schema","zod"],"license":"MIT","_id":"@10up/block-renderer-block-schemas@0.1.4","maintainers":[{"name":"fabiankaegy","email":"mail@fabian-kaegy.de"},{"name":"eugene-manuilov","email":"eugene.manuilov@gmail.com"},{"name":"christianc1","email":"christian.m.chung@gmail.com"},{"name":"nicholasio","email":"nicholasio.oliveira@gmail.com"},{"name":"joesnellpdx","email":"joesnellpdx@gmail.com"},{"name":"devinle","email":"devin.leggett@gmail.com"},{"name":"darylldoyle","email":"daryll.doyle@10up.com"}],"homepage":"https://github.com/10up/json-block-renderer#readme","bugs":{"url":"https://github.com/10up/json-block-renderer/issues"},"dist":{"shasum":"6d14bf443e3003a9112ce8599513f3412f95d6cd","tarball":"https://registry.npmjs.org/@10up/block-renderer-block-schemas/-/block-renderer-block-schemas-0.1.4.tgz","fileCount":30,"integrity":"sha512-b5N/bt3Uv74Ts/RQW9VLAMoBOZWMvd61WVLOMQK54+2zkHFDayuSvTbDFgquZxhZkKqikSlkEQbaYRTL2FhrBQ==","signatures":[{"sig":"MEQCIASEag27gNn4O5zFtRJkE4ACoxm9J+qyCVtgmK1odDTuAiBpBk6tScqY3fdNIibYSFqTpA0AYGRAJEDb+Zf0yNNdww==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90789},"main":"./dist/index.js","type":"module","_from":"file:10up-block-renderer-block-schemas-0.1.4.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run","bench":"vitest bench --run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"fabiankaegy","email":"mail@fabian-kaegy.de"},"_resolved":"/private/var/folders/j3/yjw_92c17dxg7b0pcdntvnqh0000gn/T/05eea49010879ed3572bebbc758dc0c9/10up-block-renderer-block-schemas-0.1.4.tgz","_integrity":"sha512-b5N/bt3Uv74Ts/RQW9VLAMoBOZWMvd61WVLOMQK54+2zkHFDayuSvTbDFgquZxhZkKqikSlkEQbaYRTL2FhrBQ==","repository":{"url":"git+https://github.com/10up/json-block-renderer.git","type":"git","directory":"packages/block-schemas"},"_npmVersion":"11.7.0","description":"Block.json parser and Zod schema generator for WordPress blocks","directories":{},"_nodeVersion":"25.3.0","dependencies":{"zod":"^3.24.0","@10up/block-renderer-core":"0.1.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","typescript":"^5.7.0"},"_npmOperationalInternal":{"tmp":"tmp/block-renderer-block-schemas_0.1.4_1768823466879_0.40074232991628844","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@10up/block-renderer-block-schemas","version":"0.1.5","keywords":["wordpress","blocks","gutenberg","schema","zod"],"license":"MIT","_id":"@10up/block-renderer-block-schemas@0.1.5","maintainers":[{"name":"fabiankaegy","email":"mail@fabian-kaegy.de"},{"name":"eugene-manuilov","email":"eugene.manuilov@gmail.com"},{"name":"christianc1","email":"christian.m.chung@gmail.com"},{"name":"nicholasio","email":"nicholasio.oliveira@gmail.com"},{"name":"joesnellpdx","email":"joesnellpdx@gmail.com"},{"name":"devinle","email":"devin.leggett@gmail.com"},{"name":"darylldoyle","email":"daryll.doyle@10up.com"}],"homepage":"https://github.com/10up/json-block-renderer#readme","bugs":{"url":"https://github.com/10up/json-block-renderer/issues"},"dist":{"shasum":"33c8fcb78318b2cb001a5fa6f4578cf713fa0795","tarball":"https://registry.npmjs.org/@10up/block-renderer-block-schemas/-/block-renderer-block-schemas-0.1.5.tgz","fileCount":30,"integrity":"sha512-dev8Bs5u8X1+R0vnBPJsEMKURHqqhuAMS6F6cSiD565lCnP4VNmFSssEi4QlvbKrpyQnEJqiwky8MID1phGVxA==","signatures":[{"sig":"MEQCIDDMTx6qDcQDjoknN3ZM+BfTaEJdWOBkjSAOD8pcdvrRAiAwf8Wjs6Z9nzEwpd9OCRmE6HL/5mEu3XK1hMUaLCUR8Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90789},"main":"./dist/index.js","type":"module","_from":"file:10up-block-renderer-block-schemas-0.1.5.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run","bench":"vitest bench --run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ba547de3-261f-4fe7-be77-ed4cd96835ed"}},"_resolved":"/tmp/c69a1aeb2bfaf81a9541574e46088379/10up-block-renderer-block-schemas-0.1.5.tgz","_integrity":"sha512-dev8Bs5u8X1+R0vnBPJsEMKURHqqhuAMS6F6cSiD565lCnP4VNmFSssEi4QlvbKrpyQnEJqiwky8MID1phGVxA==","repository":{"url":"git+https://github.com/10up/json-block-renderer.git","type":"git","directory":"packages/block-schemas"},"_npmVersion":"11.7.0","description":"Block.json parser and Zod schema generator for WordPress blocks","directories":{},"_nodeVersion":"22.21.1","dependencies":{"zod":"^3.24.0","@10up/block-renderer-core":"0.1.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","typescript":"^5.7.0"},"_npmOperationalInternal":{"tmp":"tmp/block-renderer-block-schemas_0.1.5_1768824021841_0.021190201746819293","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@10up/block-renderer-block-schemas","version":"0.1.6","keywords":["wordpress","blocks","gutenberg","schema","zod"],"license":"MIT","_id":"@10up/block-renderer-block-schemas@0.1.6","maintainers":[{"name":"fabiankaegy","email":"mail@fabian-kaegy.de"},{"name":"eugene-manuilov","email":"eugene.manuilov@gmail.com"},{"name":"christianc1","email":"christian.m.chung@gmail.com"},{"name":"nicholasio","email":"nicholasio.oliveira@gmail.com"},{"name":"joesnellpdx","email":"joesnellpdx@gmail.com"},{"name":"devinle","email":"devin.leggett@gmail.com"},{"name":"darylldoyle","email":"daryll.doyle@10up.com"}],"homepage":"https://github.com/10up/json-block-renderer#readme","bugs":{"url":"https://github.com/10up/json-block-renderer/issues"},"dist":{"shasum":"89fef9845120d1dbe7a5809310c15d55224ee12b","tarball":"https://registry.npmjs.org/@10up/block-renderer-block-schemas/-/block-renderer-block-schemas-0.1.6.tgz","fileCount":30,"integrity":"sha512-sbb8Ztic4i0+32uQXXgWnkvWMpI32HdcmB5POiCf/b9e4FrY1FOgmkD7AKLGIR0sZEa6gRvv8xI6Yes1C7QG3A==","signatures":[{"sig":"MEUCIBGvHMoruzw9vbWX3am6gElxhhn46hYB1rLxUUNYEKsBAiEArVipZnghn1aHi4oORffyzwHOOUWGJxryyvPPo6XSYBI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90789},"main":"./dist/index.js","type":"module","_from":"file:10up-block-renderer-block-schemas-0.1.6.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run","bench":"vitest bench --run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ba547de3-261f-4fe7-be77-ed4cd96835ed"}},"_resolved":"/tmp/266a92960f083f9f416a045cacf08e81/10up-block-renderer-block-schemas-0.1.6.tgz","_integrity":"sha512-sbb8Ztic4i0+32uQXXgWnkvWMpI32HdcmB5POiCf/b9e4FrY1FOgmkD7AKLGIR0sZEa6gRvv8xI6Yes1C7QG3A==","repository":{"url":"git+https://github.com/10up/json-block-renderer.git","type":"git","directory":"packages/block-schemas"},"_npmVersion":"11.7.0","description":"Block.json parser and Zod schema generator for WordPress blocks","directories":{},"_nodeVersion":"22.21.1","dependencies":{"zod":"^3.24.0","@10up/block-renderer-core":"0.1.6"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","typescript":"^5.7.0"},"_npmOperationalInternal":{"tmp":"tmp/block-renderer-block-schemas_0.1.6_1768824510029_0.1843563223302087","host":"s3://npm-registry-packages-npm-production"}},"0.1.7":{"name":"@10up/block-renderer-block-schemas","version":"0.1.7","keywords":["wordpress","blocks","gutenberg","schema","zod"],"license":"MIT","_id":"@10up/block-renderer-block-schemas@0.1.7","maintainers":[{"name":"fabiankaegy","email":"mail@fabian-kaegy.de"},{"name":"eugene-manuilov","email":"eugene.manuilov@gmail.com"},{"name":"christianc1","email":"christian.m.chung@gmail.com"},{"name":"nicholasio","email":"nicholasio.oliveira@gmail.com"},{"name":"joesnellpdx","email":"joesnellpdx@gmail.com"},{"name":"devinle","email":"devin.leggett@gmail.com"},{"name":"darylldoyle","email":"daryll.doyle@10up.com"}],"homepage":"https://github.com/10up/json-block-renderer#readme","bugs":{"url":"https://github.com/10up/json-block-renderer/issues"},"dist":{"shasum":"13e08669ab5be6099ee580359ae49f78a3ef49b8","tarball":"https://registry.npmjs.org/@10up/block-renderer-block-schemas/-/block-renderer-block-schemas-0.1.7.tgz","fileCount":30,"integrity":"sha512-nuigaqxmIunZD9x7iSR0Ox7IPopalQN/P/pq/JWtODZeYc/SvsBEnnpMMBWKNkRcpQoxVYGq74EvGTNSzpYT6A==","signatures":[{"sig":"MEQCIGgTYIjZjSI2jIAI4EkRH/jLgsBjnrleIuj+bRnyua07AiBVqYzt+EAtX+bVc4cY4VsUVnflmfLzmE88qkXZWkbusQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90789},"main":"./dist/index.js","type":"module","_from":"file:10up-block-renderer-block-schemas-0.1.7.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc -p tsconfig.build.json --watch","test":"vitest run","bench":"vitest bench --run","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ba547de3-261f-4fe7-be77-ed4cd96835ed"}},"_resolved":"/tmp/14b494710229aaae2fe77f631cb5b349/10up-block-renderer-block-schemas-0.1.7.tgz","_integrity":"sha512-nuigaqxmIunZD9x7iSR0Ox7IPopalQN/P/pq/JWtODZeYc/SvsBEnnpMMBWKNkRcpQoxVYGq74EvGTNSzpYT6A==","repository":{"url":"git+https://github.com/10up/json-block-renderer.git","type":"git","directory":"packages/block-schemas"},"_npmVersion":"11.8.0","description":"Block.json parser and Zod schema generator for WordPress blocks","directories":{},"_nodeVersion":"22.21.1","dependencies":{"zod":"^3.24.0","@10up/block-renderer-core":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.0","typescript":"^5.7.0"},"_npmOperationalInternal":{"tmp":"tmp/block-renderer-block-schemas_0.1.7_1769077368862_0.01715058571509842","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-01-19T11:51:06.759Z","modified":"2026-08-21T19:38:46.506Z","0.1.4":"2026-01-19T11:51:07.025Z","0.1.5":"2026-01-19T12:00:21.986Z","0.1.6":"2026-01-19T12:08:30.172Z","0.1.7":"2026-01-22T10:22:48.999Z"},"bugs":{"url":"https://github.com/10up/json-block-renderer/issues"},"license":"MIT","homepage":"https://github.com/10up/json-block-renderer#readme","keywords":["wordpress","blocks","gutenberg","schema","zod"],"repository":{"url":"git+https://github.com/10up/json-block-renderer.git","type":"git","directory":"packages/block-schemas"},"description":"Block.json parser and Zod schema generator for WordPress blocks","maintainers":[{"email":"mail@fabian-kaegy.de","name":"fabiankaegy"},{"email":"eugene.manuilov@gmail.com","name":"eugene-manuilov"},{"email":"christian.m.chung@gmail.com","name":"christianc1"},{"email":"nicholasio.oliveira@gmail.com","name":"nicholasio"},{"email":"joesnellpdx@gmail.com","name":"joesnellpdx"},{"email":"devin.leggett@gmail.com","name":"devinle"},{"email":"daryll.doyle@10up.com","name":"darylldoyle"},{"email":"jeffpaul@hotmail.com","name":"jeffpaul"}],"readme":"# @10up/block-renderer-block-schemas\n\nParse WordPress `block.json` files and generate Zod validation schemas. This package handles the complex mapping between WordPress block attribute definitions and runtime-validated Zod schemas.\n\n## Installation\n\n```bash\nnpm install @10up/block-renderer-block-schemas\n# or\npnpm add @10up/block-renderer-block-schemas\n```\n\n## Overview\n\nWordPress blocks define their attributes in `block.json` files using a specific schema. This package:\n\n1. **Type Mapping** - Converts WordPress attribute types (`string`, `rich-text`, `object`, etc.) to Zod schemas\n2. **Supports Resolution** - Determines which attributes are auto-generated by the `supports` configuration\n3. **Style Schema Generation** - Creates properly typed schemas for the complex `style` attribute\n4. **Global Attributes** - Handles always-present attributes like `lock`, `metadata`, and `className`\n5. **Definition Generation** - Combines all of the above into complete `BlockDefinition` objects\n\n## Usage\n\n### Generate Block Definition\n\nThe main entry point - creates a complete `BlockDefinition` from a `block.json` object:\n\n```typescript\nimport { generateBlockDefinition } from '@10up/block-renderer-block-schemas';\n\nconst blockJson = {\n  name: 'core/paragraph',\n  title: 'Paragraph',\n  attributes: {\n    content: { type: 'rich-text', source: 'rich-text' },\n    dropCap: { type: 'boolean', default: false }\n  },\n  supports: {\n    color: { background: true, text: true },\n    typography: { fontSize: true }\n  }\n};\n\nconst definition = generateBlockDefinition(blockJson);\n// definition.schema validates: content, dropCap, backgroundColor, textColor,\n// fontSize, style, lock, metadata, className\n```\n\n### Generator Options\n\n```typescript\ninterface GeneratorOptions {\n  /** Include supports-generated attributes (default: true) */\n  includeSupportsAttributes?: boolean;\n  /** Include global attributes - lock, metadata (default: true) */\n  includeGlobalAttributes?: boolean;\n  /** Include className attribute (default: true) */\n  includeClassName?: boolean;\n}\n\nconst definition = generateBlockDefinition(blockJson, {\n  includeSupportsAttributes: true,\n  includeGlobalAttributes: false,  // Skip lock/metadata\n  includeClassName: true,\n});\n```\n\n### Generate Multiple Definitions\n\n```typescript\nimport { generateBlockDefinitions } from '@10up/block-renderer-block-schemas';\n\nconst blockJsons = [paragraphBlock, headingBlock, groupBlock];\nconst catalog = generateBlockDefinitions(blockJsons);\n// Returns Map<string, BlockDefinition>\n\nconst paragraphDef = catalog.get('core/paragraph');\n```\n\n## Type Mapping\n\nMaps WordPress attribute types to Zod schemas:\n\n```typescript\nimport { mapTypeToZod } from '@10up/block-renderer-block-schemas';\n\nmapTypeToZod('string');     // z.string()\nmapTypeToZod('number');     // z.number()\nmapTypeToZod('integer');    // z.number().int()\nmapTypeToZod('boolean');    // z.boolean()\nmapTypeToZod('rich-text');  // z.string()\nmapTypeToZod('object');     // z.record(z.unknown())\nmapTypeToZod('array');      // z.array(z.unknown())\nmapTypeToZod('null');       // z.null()\n```\n\n### Union Types\n\nWordPress attributes can have multiple types:\n\n```typescript\nimport { createUnionSchema } from '@10up/block-renderer-block-schemas';\n\n// { type: ['string', 'number'] }\ncreateUnionSchema(['string', 'number']); // z.union([z.string(), z.number()])\n```\n\n### Attribute to Schema\n\nFull attribute definition to Zod schema:\n\n```typescript\nimport { attributeToZodSchema, attributesToZodSchema } from '@10up/block-renderer-block-schemas';\n\n// Single attribute with enum\nattributeToZodSchema({\n  type: 'string',\n  enum: ['left', 'center', 'right'],\n  default: 'left'\n});\n// z.union([z.literal('left'), z.literal('center'), z.literal('right')]).default('left').optional()\n\n// Multiple attributes\nconst schema = attributesToZodSchema({\n  content: { type: 'string' },\n  level: { type: 'number', default: 2 }\n});\n// z.object({ content: z.string().optional(), level: z.number().default(2).optional() })\n```\n\n## Supports Resolution\n\nWordPress `supports` configuration auto-generates certain attributes. This package resolves them:\n\n```typescript\nimport { resolveSupportsToAttributes } from '@10up/block-renderer-block-schemas';\n\nconst supports = {\n  anchor: true,\n  align: ['wide', 'full'],\n  color: { background: true, text: true, gradients: true },\n  typography: { fontSize: true, fontFamily: true },\n  border: { color: true, radius: true },\n  shadow: true\n};\n\nconst attributes = resolveSupportsToAttributes(supports);\n// Returns attribute definitions for:\n// - anchor: string\n// - align: enum ['wide', 'full']\n// - backgroundColor: string\n// - textColor: string\n// - gradient: string\n// - fontSize: string\n// - fontFamily: string\n// - borderColor: string\n// - shadow: string\n```\n\n### Style Schema\n\nThe `style` attribute has a complex nested structure. This package generates properly typed schemas:\n\n```typescript\nimport { createStyleSchema } from '@10up/block-renderer-block-schemas';\n\nconst styleSchema = createStyleSchema({\n  color: { background: true, text: true },\n  typography: { fontSize: true, lineHeight: true },\n  spacing: { padding: true, margin: true },\n  border: { color: true, radius: true }\n});\n\n// Validates:\n// {\n//   color: { background?: string, text?: string },\n//   typography: { fontSize?: string, lineHeight?: string },\n//   spacing: {\n//     padding?: { top?: string, right?: string, bottom?: string, left?: string },\n//     margin?: { top?: string, right?: string, bottom?: string, left?: string }\n//   },\n//   border: { color?: string, radius?: string | { topLeft?, topRight?, bottomLeft?, bottomRight? } }\n// }\n```\n\n### Layout Schema\n\nFor blocks with layout support:\n\n```typescript\nimport { createLayoutSchema } from '@10up/block-renderer-block-schemas';\n\nconst layoutSchema = createLayoutSchema({ layout: true });\n// Validates:\n// {\n//   type?: 'constrained' | 'flex' | 'flow' | 'grid',\n//   justifyContent?: string,\n//   orientation?: 'horizontal' | 'vertical',\n//   flexWrap?: 'wrap' | 'nowrap',\n//   contentSize?: string,\n//   wideSize?: string,\n//   columnCount?: number,\n//   minimumColumnWidth?: string\n// }\n```\n\n## Global Attributes\n\nAttributes that exist on every block:\n\n```typescript\nimport {\n  lockSchema,\n  metadataSchema,\n  getGlobalAttributeDefinitions,\n  getGlobalAttributeSchemas,\n  getClassNameAttribute,\n  getClassNameSchema,\n} from '@10up/block-renderer-block-schemas';\n\n// Lock attribute - controls block locking\nlockSchema.parse({ move: false, remove: true });\n\n// Metadata attribute - block bindings, name, overrides\nmetadataSchema.parse({\n  name: 'my-block-instance',\n  bindings: {\n    content: { source: 'core/post-meta', args: { key: 'my_meta' } }\n  }\n});\n\n// Get all global attribute definitions\nconst globals = getGlobalAttributeDefinitions();\n// { lock: {...}, metadata: {...} }\n\n// className depends on supports.customClassName\nconst classNameAttr = getClassNameAttribute({ customClassName: true });\n// { className: { type: 'string' } }\n```\n\n## Block Detection Utilities\n\n### Dynamic Block Detection\n\n```typescript\nimport { isDynamicBlock } from '@10up/block-renderer-block-schemas';\n\nisDynamicBlock({ name: 'core/paragraph' });     // false\nisDynamicBlock({ name: 'core/latest-posts' });  // true\nisDynamicBlock({ name: 'my/block', render: 'file:./render.php' }); // true\n```\n\nDynamic blocks are server-rendered and include:\n- Blocks with a `render` property in block.json\n- Known dynamic core blocks (archives, latest-posts, query, search, etc.)\n\n### Inner Blocks Detection\n\n```typescript\nimport { hasInnerBlocksSupport } from '@10up/block-renderer-block-schemas';\n\nhasInnerBlocksSupport({ name: 'core/paragraph' });  // false\nhasInnerBlocksSupport({ name: 'core/group' });      // true\nhasInnerBlocksSupport({ name: 'my/block', allowedBlocks: ['core/paragraph'] }); // true\n```\n\n## Required Attributes\n\nSome core blocks require specific attributes to render meaningful output. For example, `core/image` needs a `url` attribute - without it, the block renders nothing.\n\nThis information cannot be determined from `block.json` alone, so we maintain a static list of required attributes for core blocks:\n\n```typescript\nimport {\n  CORE_REQUIRED_ATTRIBUTES,\n  getRequiredAttributes,\n  hasRequiredAttributes,\n} from '@10up/block-renderer-block-schemas';\n\n// Get required attributes for a specific block\ngetRequiredAttributes('core/image');  // ['url']\ngetRequiredAttributes('core/video');  // ['src']\ngetRequiredAttributes('core/embed');  // ['url']\ngetRequiredAttributes('core/pattern'); // ['slug']\n\n// Check if a block has required attributes\nhasRequiredAttributes('core/image');     // true\nhasRequiredAttributes('core/paragraph'); // false\n\n// Full list of blocks with required attributes\nconsole.log(CORE_REQUIRED_ATTRIBUTES);\n// {\n//   'core/image': ['url'],\n//   'core/video': ['src'],\n//   'core/audio': ['src'],\n//   'core/file': ['href'],\n//   'core/embed': ['url'],\n//   'core/pattern': ['slug'],\n//   'core/template-part': ['slug'],\n//   'core/shortcode': ['text'],\n//   'core/html': ['content'],\n//   'core/block': ['ref'],\n//   'core/navigation-link': ['label', 'url'],\n//   'core/social-link': ['service'],\n// }\n```\n\nWhen generating schemas, required attributes are automatically marked as non-optional in the Zod schema, ensuring validation fails if they're missing.\n\n## Complete Exports\n\n### Functions\n\n| Function | Description |\n|----------|-------------|\n| `generateBlockDefinition(blockJson, options?)` | Generate complete BlockDefinition from block.json |\n| `generateBlockDefinitions(blockJsons, options?)` | Generate definitions for multiple blocks |\n| `mapTypeToZod(type)` | Map single WordPress type to Zod schema |\n| `createUnionSchema(types)` | Create Zod union from multiple types |\n| `attributeToZodSchema(attr, options?)` | Convert attribute definition to Zod schema |\n| `attributesToZodSchema(attrs, options?)` | Convert all attributes to Zod object schema |\n| `resolveSupportsToAttributes(supports)` | Get generated attributes from supports |\n| `createStyleSchema(supports)` | Create Zod schema for style attribute |\n| `createLayoutSchema(supports)` | Create Zod schema for layout attribute |\n| `getGlobalAttributeDefinitions()` | Get lock/metadata attribute definitions |\n| `getGlobalAttributeSchemas()` | Get lock/metadata Zod schemas |\n| `getClassNameAttribute(supports)` | Get className attribute if enabled |\n| `getClassNameSchema(supports)` | Get className Zod schema if enabled |\n| `isDynamicBlock(blockJson)` | Check if block is server-rendered |\n| `hasInnerBlocksSupport(blockJson)` | Check if block supports InnerBlocks |\n| `getRequiredAttributes(blockName)` | Get required attributes for a core block |\n| `hasRequiredAttributes(blockName)` | Check if a block has required attributes |\n\n### Types\n\n| Type | Description |\n|------|-------------|\n| `GeneratorOptions` | Options for generateBlockDefinition |\n| `StyleAttributeShape` | TypeScript interface for style attribute |\n| `AttributeSchemaOptions` | Options for attributeToZodSchema |\n| `AttributesSchemaOptions` | Options for attributesToZodSchema |\n\n### Constants\n\n| Constant | Description |\n|----------|-------------|\n| `CORE_REQUIRED_ATTRIBUTES` | Map of block names to required attribute names |\n\n### Schemas\n\n| Schema | Description |\n|--------|-------------|\n| `lockSchema` | Zod schema for lock attribute |\n| `metadataSchema` | Zod schema for metadata attribute |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}