@10up/block-renderer-block-schemas 0.1.4

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.
@@ -0,0 +1,35 @@
1
+ import type { BlockJson, BlockDefinition } from '@10up/block-renderer-core';
2
+ /**
3
+ * Options for generating a block definition.
4
+ */
5
+ export interface GeneratorOptions {
6
+ /** Whether to include supports-generated attributes */
7
+ includeSupportsAttributes?: boolean;
8
+ /** Whether to include global attributes (lock, metadata) */
9
+ includeGlobalAttributes?: boolean;
10
+ /** Whether to include className attribute */
11
+ includeClassName?: boolean;
12
+ }
13
+ /**
14
+ * Determines if a block is dynamic (server-rendered).
15
+ * Dynamic blocks have no static save content - they use a PHP render callback.
16
+ *
17
+ * We can't definitively know this from block.json alone, but we can infer:
18
+ * - If `render` property is set, it's likely dynamic
19
+ * - Some core blocks are known to be dynamic
20
+ */
21
+ export declare function isDynamicBlock(blockJson: BlockJson): boolean;
22
+ /**
23
+ * Determines if a block supports InnerBlocks.
24
+ * Inferred from allowedBlocks property or known blocks.
25
+ */
26
+ export declare function hasInnerBlocksSupport(blockJson: BlockJson): boolean;
27
+ /**
28
+ * Generates a complete BlockDefinition from a block.json object.
29
+ */
30
+ export declare function generateBlockDefinition(blockJson: BlockJson, options?: GeneratorOptions): BlockDefinition;
31
+ /**
32
+ * Generates BlockDefinitions for multiple blocks.
33
+ */
34
+ export declare function generateBlockDefinitions(blockJsons: BlockJson[], options?: GeneratorOptions): Map<string, BlockDefinition>;
35
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAe5E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,4DAA4D;IAC5D,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAQD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAyE5D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CA8BnE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,gBAAqB,GAC7B,eAAe,CAoEjB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,GAAE,gBAAqB,GAC7B,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAS9B"}
@@ -0,0 +1,195 @@
1
+ import { attributesToZodSchema } from './type-mapper.js';
2
+ import { resolveSupportsToAttributes, createStyleSchema, createLayoutSchema } from './supports-resolver.js';
3
+ import { getGlobalAttributeDefinitions, getGlobalAttributeSchemas, getClassNameAttribute, getClassNameSchema } from './globals.js';
4
+ import { getRequiredAttributes } from './required-attributes.js';
5
+ const defaultOptions = {
6
+ includeSupportsAttributes: true,
7
+ includeGlobalAttributes: true,
8
+ includeClassName: true,
9
+ };
10
+ /**
11
+ * Determines if a block is dynamic (server-rendered).
12
+ * Dynamic blocks have no static save content - they use a PHP render callback.
13
+ *
14
+ * We can't definitively know this from block.json alone, but we can infer:
15
+ * - If `render` property is set, it's likely dynamic
16
+ * - Some core blocks are known to be dynamic
17
+ */
18
+ export function isDynamicBlock(blockJson) {
19
+ // If render callback is specified, it's dynamic
20
+ if (blockJson.render) {
21
+ return true;
22
+ }
23
+ // Known dynamic core blocks (this list is not exhaustive)
24
+ const knownDynamicBlocks = [
25
+ 'core/archives',
26
+ 'core/avatar',
27
+ 'core/block',
28
+ 'core/calendar',
29
+ 'core/categories',
30
+ 'core/comment-author-name',
31
+ 'core/comment-content',
32
+ 'core/comment-date',
33
+ 'core/comment-edit-link',
34
+ 'core/comment-reply-link',
35
+ 'core/comment-template',
36
+ 'core/comments',
37
+ 'core/comments-pagination',
38
+ 'core/comments-pagination-next',
39
+ 'core/comments-pagination-numbers',
40
+ 'core/comments-pagination-previous',
41
+ 'core/comments-title',
42
+ 'core/cover', // partially dynamic
43
+ 'core/file',
44
+ 'core/footnotes',
45
+ 'core/home-link',
46
+ 'core/image', // can be dynamic with lightbox
47
+ 'core/latest-comments',
48
+ 'core/latest-posts',
49
+ 'core/loginout',
50
+ 'core/navigation',
51
+ 'core/navigation-link',
52
+ 'core/navigation-submenu',
53
+ 'core/page-list',
54
+ 'core/page-list-item',
55
+ 'core/pattern',
56
+ 'core/post-author',
57
+ 'core/post-author-biography',
58
+ 'core/post-author-name',
59
+ 'core/post-comments-form',
60
+ 'core/post-content',
61
+ 'core/post-date',
62
+ 'core/post-excerpt',
63
+ 'core/post-featured-image',
64
+ 'core/post-navigation-link',
65
+ 'core/post-template',
66
+ 'core/post-terms',
67
+ 'core/post-time-to-read',
68
+ 'core/post-title',
69
+ 'core/query',
70
+ 'core/query-no-results',
71
+ 'core/query-pagination',
72
+ 'core/query-pagination-next',
73
+ 'core/query-pagination-numbers',
74
+ 'core/query-pagination-previous',
75
+ 'core/query-title',
76
+ 'core/read-more',
77
+ 'core/rss',
78
+ 'core/search',
79
+ 'core/shortcode',
80
+ 'core/site-logo',
81
+ 'core/site-tagline',
82
+ 'core/site-title',
83
+ 'core/social-link',
84
+ 'core/tag-cloud',
85
+ 'core/template-part',
86
+ 'core/term-description',
87
+ ];
88
+ return knownDynamicBlocks.includes(blockJson.name);
89
+ }
90
+ /**
91
+ * Determines if a block supports InnerBlocks.
92
+ * Inferred from allowedBlocks property or known blocks.
93
+ */
94
+ export function hasInnerBlocksSupport(blockJson) {
95
+ // If allowedBlocks is specified, it supports inner blocks
96
+ if (blockJson.allowedBlocks !== undefined) {
97
+ return true;
98
+ }
99
+ // Known blocks that support InnerBlocks
100
+ const knownInnerBlocksBlocks = [
101
+ 'core/group',
102
+ 'core/columns',
103
+ 'core/column',
104
+ 'core/cover',
105
+ 'core/buttons',
106
+ 'core/list',
107
+ 'core/list-item',
108
+ 'core/quote',
109
+ 'core/pullquote',
110
+ 'core/media-text',
111
+ 'core/details',
112
+ 'core/navigation',
113
+ 'core/navigation-link',
114
+ 'core/navigation-submenu',
115
+ 'core/template-part',
116
+ 'core/block', // reusable block
117
+ 'core/post-template',
118
+ 'core/comment-template',
119
+ 'core/query',
120
+ ];
121
+ return knownInnerBlocksBlocks.includes(blockJson.name);
122
+ }
123
+ /**
124
+ * Generates a complete BlockDefinition from a block.json object.
125
+ */
126
+ export function generateBlockDefinition(blockJson, options = {}) {
127
+ const opts = { ...defaultOptions, ...options };
128
+ // Start with explicit attributes from block.json
129
+ let allAttributes = { ...(blockJson.attributes || {}) };
130
+ // Add supports-generated attributes
131
+ if (opts.includeSupportsAttributes) {
132
+ const supportsAttrs = resolveSupportsToAttributes(blockJson.supports);
133
+ allAttributes = { ...allAttributes, ...supportsAttrs };
134
+ }
135
+ // Add global attributes
136
+ if (opts.includeGlobalAttributes) {
137
+ const globalAttrs = getGlobalAttributeDefinitions();
138
+ allAttributes = { ...allAttributes, ...globalAttrs };
139
+ }
140
+ // Add className attribute
141
+ if (opts.includeClassName) {
142
+ const classNameAttr = getClassNameAttribute(blockJson.supports);
143
+ allAttributes = { ...allAttributes, ...classNameAttr };
144
+ }
145
+ // Get required attributes for this block (from static list)
146
+ const requiredAttributes = getRequiredAttributes(blockJson.name);
147
+ // Build the base Zod schema from attributes, marking required ones
148
+ const baseSchema = attributesToZodSchema(allAttributes, { requiredAttributes });
149
+ // Get additional schemas
150
+ const globalSchemas = opts.includeGlobalAttributes ? getGlobalAttributeSchemas() : {};
151
+ const classNameSchema = opts.includeClassName ? getClassNameSchema(blockJson.supports) : {};
152
+ const styleSchema = opts.includeSupportsAttributes ? createStyleSchema(blockJson.supports) : undefined;
153
+ const layoutSchema = opts.includeSupportsAttributes ? createLayoutSchema(blockJson.supports) : undefined;
154
+ // Extend base schema with additional fields
155
+ let schema = baseSchema.extend({
156
+ ...globalSchemas,
157
+ ...classNameSchema,
158
+ });
159
+ // Add style attribute if supports warrant it
160
+ if (styleSchema) {
161
+ schema = schema.extend({ style: styleSchema });
162
+ }
163
+ // Add layout attribute if supported
164
+ if (layoutSchema) {
165
+ schema = schema.extend({ layout: layoutSchema });
166
+ }
167
+ return {
168
+ name: blockJson.name,
169
+ title: blockJson.title,
170
+ description: blockJson.description,
171
+ schema,
172
+ parent: blockJson.parent,
173
+ ancestor: blockJson.ancestor,
174
+ allowedBlocks: blockJson.allowedBlocks,
175
+ multiple: blockJson.supports?.multiple,
176
+ reusable: blockJson.supports?.reusable,
177
+ hasInnerBlocks: hasInnerBlocksSupport(blockJson),
178
+ isDynamic: isDynamicBlock(blockJson),
179
+ category: blockJson.category,
180
+ icon: blockJson.icon,
181
+ keywords: blockJson.keywords,
182
+ };
183
+ }
184
+ /**
185
+ * Generates BlockDefinitions for multiple blocks.
186
+ */
187
+ export function generateBlockDefinitions(blockJsons, options = {}) {
188
+ const catalog = new Map();
189
+ for (const blockJson of blockJsons) {
190
+ const definition = generateBlockDefinition(blockJson, options);
191
+ catalog.set(definition.name, definition);
192
+ }
193
+ return catalog;
194
+ }
195
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAcjE,MAAM,cAAc,GAAqB;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M,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,MAAM;QACN,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,aAAa,EAAE,SAAS,CAAC,aAAqC;QAC9D,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,QAAQ;QACtC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,QAAQ;QACtC,cAAc,EAAE,qBAAqB,CAAC,SAAS,CAAC;QAChD,SAAS,EAAE,cAAc,CAAC,SAAS,CAAC;QACpC,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,SAAS,CAAC,QAAQ;KAC7B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,UAAuB,EACvB,UAA4B,EAAE;IAE9B,MAAM,OAAO,GAAG,IAAI,GAAG,EAA2B,CAAC;IAEnD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,uBAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ import type { BlockAttributeDefinition, BlockSupports } from '@10up/block-renderer-core';
3
+ /**
4
+ * Global/reserved attributes that are always present on every block
5
+ * regardless of the `supports` configuration.
6
+ */
7
+ /**
8
+ * Lock attribute schema - controls block locking state.
9
+ */
10
+ export declare const lockSchema: z.ZodOptional<z.ZodObject<{
11
+ move: z.ZodOptional<z.ZodBoolean>;
12
+ remove: z.ZodOptional<z.ZodBoolean>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ move?: boolean | undefined;
15
+ remove?: boolean | undefined;
16
+ }, {
17
+ move?: boolean | undefined;
18
+ remove?: boolean | undefined;
19
+ }>>;
20
+ /**
21
+ * Metadata attribute schema - block bindings, name, and overrides.
22
+ */
23
+ export declare const metadataSchema: z.ZodOptional<z.ZodObject<{
24
+ /** Unique name for the block instance */
25
+ name: z.ZodOptional<z.ZodString>;
26
+ /** Block bindings configuration */
27
+ bindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
28
+ source: z.ZodString;
29
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ source: string;
32
+ args?: Record<string, unknown> | undefined;
33
+ }, {
34
+ source: string;
35
+ args?: Record<string, unknown> | undefined;
36
+ }>>>;
37
+ /** Pattern overrides */
38
+ patternOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ name?: string | undefined;
41
+ bindings?: Record<string, {
42
+ source: string;
43
+ args?: Record<string, unknown> | undefined;
44
+ }> | undefined;
45
+ patternOverrides?: Record<string, unknown> | undefined;
46
+ }, {
47
+ name?: string | undefined;
48
+ bindings?: Record<string, {
49
+ source: string;
50
+ args?: Record<string, unknown> | undefined;
51
+ }> | undefined;
52
+ patternOverrides?: Record<string, unknown> | undefined;
53
+ }>>;
54
+ /**
55
+ * Returns the global attribute definitions that are always present.
56
+ * These don't depend on supports configuration.
57
+ */
58
+ export declare function getGlobalAttributeDefinitions(): Record<string, BlockAttributeDefinition>;
59
+ /**
60
+ * Returns the global attribute Zod schemas.
61
+ */
62
+ export declare function getGlobalAttributeSchemas(): z.ZodRawShape;
63
+ /**
64
+ * Returns className attribute definition if enabled.
65
+ * By default, className is enabled unless `supports.customClassName` is false.
66
+ */
67
+ export declare function getClassNameAttribute(supports: BlockSupports | undefined): Record<string, BlockAttributeDefinition>;
68
+ /**
69
+ * Returns className Zod schema if enabled.
70
+ */
71
+ export declare function getClassNameSchema(supports: BlockSupports | undefined): z.ZodRawShape;
72
+ //# sourceMappingURL=globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEzF;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;GAGV,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB,yCAAyC;;IAEzC,mCAAmC;;;;;;;;;;;IAOnC,wBAAwB;;;;;;;;;;;;;;;;GAEb,CAAC;AAEd;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CASxF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,CAAC,CAAC,WAAW,CAKzD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,GAAG,SAAS,GAClC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAQ1C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,GAAG,SAAS,GAClC,CAAC,CAAC,WAAW,CAOf"}
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Global/reserved attributes that are always present on every block
4
+ * regardless of the `supports` configuration.
5
+ */
6
+ /**
7
+ * Lock attribute schema - controls block locking state.
8
+ */
9
+ export const lockSchema = z.object({
10
+ move: z.boolean().optional(),
11
+ remove: z.boolean().optional(),
12
+ }).optional();
13
+ /**
14
+ * Metadata attribute schema - block bindings, name, and overrides.
15
+ */
16
+ export const metadataSchema = z.object({
17
+ /** Unique name for the block instance */
18
+ name: z.string().optional(),
19
+ /** Block bindings configuration */
20
+ bindings: z.record(z.object({
21
+ source: z.string(),
22
+ args: z.record(z.unknown()).optional(),
23
+ })).optional(),
24
+ /** Pattern overrides */
25
+ patternOverrides: z.record(z.unknown()).optional(),
26
+ }).optional();
27
+ /**
28
+ * Returns the global attribute definitions that are always present.
29
+ * These don't depend on supports configuration.
30
+ */
31
+ export function getGlobalAttributeDefinitions() {
32
+ return {
33
+ lock: {
34
+ type: 'object',
35
+ },
36
+ metadata: {
37
+ type: 'object',
38
+ },
39
+ };
40
+ }
41
+ /**
42
+ * Returns the global attribute Zod schemas.
43
+ */
44
+ export function getGlobalAttributeSchemas() {
45
+ return {
46
+ lock: lockSchema,
47
+ metadata: metadataSchema,
48
+ };
49
+ }
50
+ /**
51
+ * Returns className attribute definition if enabled.
52
+ * By default, className is enabled unless `supports.customClassName` is false.
53
+ */
54
+ export function getClassNameAttribute(supports) {
55
+ // className is enabled by default
56
+ if (supports?.customClassName === false || supports?.className === false) {
57
+ return {};
58
+ }
59
+ return {
60
+ className: { type: 'string' },
61
+ };
62
+ }
63
+ /**
64
+ * Returns className Zod schema if enabled.
65
+ */
66
+ export function getClassNameSchema(supports) {
67
+ if (supports?.customClassName === false || supports?.className === false) {
68
+ return {};
69
+ }
70
+ return {
71
+ className: z.string().optional(),
72
+ };
73
+ }
74
+ //# sourceMappingURL=globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.js","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,OAA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;IAEnC,IAAI,QAAQ,EAAE,eAAe,KAAK,KAAK,IAAI,QAAQ,EAAE,SAAS,KAAK,KAAK,EAAE,CAAC;QACzE,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO;QACL,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { mapTypeToZod, createUnionSchema, attributeToZodSchema, attributesToZodSchema, } from './type-mapper.js';
2
+ export type { AttributeSchemaOptions, AttributesSchemaOptions } from './type-mapper.js';
3
+ export { resolveSupportsToAttributes, createStyleSchema, createLayoutSchema, } from './supports-resolver.js';
4
+ export type { StyleAttributeShape } from './supports-resolver.js';
5
+ export { lockSchema, metadataSchema, getGlobalAttributeDefinitions, getGlobalAttributeSchemas, getClassNameAttribute, getClassNameSchema, } from './globals.js';
6
+ export { generateBlockDefinition, generateBlockDefinitions, isDynamicBlock, hasInnerBlocksSupport, } from './generator.js';
7
+ export type { GeneratorOptions } from './generator.js';
8
+ export { CORE_REQUIRED_ATTRIBUTES, getRequiredAttributes, hasRequiredAttributes, } from './required-attributes.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EACL,UAAU,EACV,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // Type mapper - WordPress types to Zod schemas
2
+ export { mapTypeToZod, createUnionSchema, attributeToZodSchema, attributesToZodSchema, } from './type-mapper.js';
3
+ // Supports resolver - supports config to generated attributes
4
+ export { resolveSupportsToAttributes, createStyleSchema, createLayoutSchema, } from './supports-resolver.js';
5
+ // Global attributes - lock, metadata, className
6
+ export { lockSchema, metadataSchema, getGlobalAttributeDefinitions, getGlobalAttributeSchemas, getClassNameAttribute, getClassNameSchema, } from './globals.js';
7
+ // Block definition generator
8
+ export { generateBlockDefinition, generateBlockDefinitions, isDynamicBlock, hasInnerBlocksSupport, } from './generator.js';
9
+ // Required attributes for core blocks
10
+ export { CORE_REQUIRED_ATTRIBUTES, getRequiredAttributes, hasRequiredAttributes, } from './required-attributes.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAG1B,8DAA8D;AAC9D,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAGhC,gDAAgD;AAChD,OAAO,EACL,UAAU,EACV,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,6BAA6B;AAC7B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,sCAAsC;AACtC,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Static list of required attributes for core blocks.
3
+ *
4
+ * These attributes are not marked as required in block.json but are
5
+ * necessary for the block to render meaningful output. Without these
6
+ * attributes, the block either renders nothing or renders incorrectly.
7
+ *
8
+ * This list was compiled by auditing core block save functions and
9
+ * cannot be determined dynamically from block.json metadata.
10
+ */
11
+ /**
12
+ * Map of block names to their required attributes.
13
+ * These attributes must be provided for the block to render properly.
14
+ */
15
+ export declare const CORE_REQUIRED_ATTRIBUTES: Record<string, string[]>;
16
+ /**
17
+ * Gets the required attributes for a block.
18
+ *
19
+ * @param blockName - The block name (e.g., "core/image")
20
+ * @returns Array of required attribute names, or empty array if none
21
+ */
22
+ export declare function getRequiredAttributes(blockName: string): string[];
23
+ /**
24
+ * Checks if a block has required attributes defined.
25
+ *
26
+ * @param blockName - The block name to check
27
+ * @returns True if the block has required attributes
28
+ */
29
+ export declare function hasRequiredAttributes(blockName: string): boolean;
30
+ //# sourceMappingURL=required-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-attributes.d.ts","sourceRoot":"","sources":["../src/required-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA0B7D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEhE"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Static list of required attributes for core blocks.
3
+ *
4
+ * These attributes are not marked as required in block.json but are
5
+ * necessary for the block to render meaningful output. Without these
6
+ * attributes, the block either renders nothing or renders incorrectly.
7
+ *
8
+ * This list was compiled by auditing core block save functions and
9
+ * cannot be determined dynamically from block.json metadata.
10
+ */
11
+ /**
12
+ * Map of block names to their required attributes.
13
+ * These attributes must be provided for the block to render properly.
14
+ */
15
+ export const CORE_REQUIRED_ATTRIBUTES = {
16
+ // Media blocks - require source URL to render
17
+ 'core/image': ['url'],
18
+ 'core/video': ['src'],
19
+ 'core/audio': ['src'],
20
+ 'core/file': ['href'],
21
+ // Embed block - requires URL to embed
22
+ 'core/embed': ['url'],
23
+ // Pattern/template blocks - require slug to identify content
24
+ 'core/pattern': ['slug'],
25
+ 'core/template-part': ['slug'],
26
+ // Raw content blocks - require content to render
27
+ 'core/shortcode': ['text'],
28
+ 'core/html': ['content'],
29
+ // Reusable block - requires ref to the reusable block
30
+ 'core/block': ['ref'],
31
+ // Navigation link - needs both label and url for meaningful output
32
+ 'core/navigation-link': ['label', 'url'],
33
+ // Social link - requires service to render the correct icon/link
34
+ 'core/social-link': ['service'],
35
+ };
36
+ /**
37
+ * Gets the required attributes for a block.
38
+ *
39
+ * @param blockName - The block name (e.g., "core/image")
40
+ * @returns Array of required attribute names, or empty array if none
41
+ */
42
+ export function getRequiredAttributes(blockName) {
43
+ return CORE_REQUIRED_ATTRIBUTES[blockName] || [];
44
+ }
45
+ /**
46
+ * Checks if a block has required attributes defined.
47
+ *
48
+ * @param blockName - The block name to check
49
+ * @returns True if the block has required attributes
50
+ */
51
+ export function hasRequiredAttributes(blockName) {
52
+ return blockName in CORE_REQUIRED_ATTRIBUTES;
53
+ }
54
+ //# sourceMappingURL=required-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-attributes.js","sourceRoot":"","sources":["../src/required-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA6B;IAChE,8CAA8C;IAC9C,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,WAAW,EAAE,CAAC,MAAM,CAAC;IAErB,sCAAsC;IACtC,YAAY,EAAE,CAAC,KAAK,CAAC;IAErB,6DAA6D;IAC7D,cAAc,EAAE,CAAC,MAAM,CAAC;IACxB,oBAAoB,EAAE,CAAC,MAAM,CAAC;IAE9B,iDAAiD;IACjD,gBAAgB,EAAE,CAAC,MAAM,CAAC;IAC1B,WAAW,EAAE,CAAC,SAAS,CAAC;IAExB,sDAAsD;IACtD,YAAY,EAAE,CAAC,KAAK,CAAC;IAErB,mEAAmE;IACnE,sBAAsB,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;IAExC,iEAAiE;IACjE,kBAAkB,EAAE,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,wBAAwB,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,SAAS,IAAI,wBAAwB,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ import type { BlockSupports, BlockAttributeDefinition } from '@10up/block-renderer-core';
3
+ /**
4
+ * The style attribute schema that collects all style-related values.
5
+ * Built dynamically based on which supports are enabled.
6
+ */
7
+ export interface StyleAttributeShape {
8
+ color?: {
9
+ background?: string;
10
+ text?: string;
11
+ gradient?: string;
12
+ link?: string;
13
+ };
14
+ typography?: {
15
+ fontSize?: string;
16
+ fontFamily?: string;
17
+ fontStyle?: string;
18
+ fontWeight?: string;
19
+ lineHeight?: string;
20
+ textDecoration?: string;
21
+ textTransform?: string;
22
+ letterSpacing?: string;
23
+ writingMode?: string;
24
+ textAlign?: string;
25
+ };
26
+ spacing?: {
27
+ margin?: {
28
+ top?: string;
29
+ right?: string;
30
+ bottom?: string;
31
+ left?: string;
32
+ };
33
+ padding?: {
34
+ top?: string;
35
+ right?: string;
36
+ bottom?: string;
37
+ left?: string;
38
+ };
39
+ blockGap?: string | {
40
+ horizontal?: string;
41
+ vertical?: string;
42
+ };
43
+ };
44
+ border?: {
45
+ color?: string;
46
+ radius?: string | {
47
+ topLeft?: string;
48
+ topRight?: string;
49
+ bottomLeft?: string;
50
+ bottomRight?: string;
51
+ };
52
+ style?: string;
53
+ width?: string;
54
+ top?: {
55
+ color?: string;
56
+ style?: string;
57
+ width?: string;
58
+ };
59
+ right?: {
60
+ color?: string;
61
+ style?: string;
62
+ width?: string;
63
+ };
64
+ bottom?: {
65
+ color?: string;
66
+ style?: string;
67
+ width?: string;
68
+ };
69
+ left?: {
70
+ color?: string;
71
+ style?: string;
72
+ width?: string;
73
+ };
74
+ };
75
+ dimensions?: {
76
+ minHeight?: string;
77
+ aspectRatio?: string;
78
+ };
79
+ position?: {
80
+ type?: 'sticky' | 'fixed';
81
+ top?: string;
82
+ };
83
+ shadow?: string;
84
+ background?: {
85
+ backgroundImage?: {
86
+ url?: string;
87
+ id?: number;
88
+ source?: string;
89
+ title?: string;
90
+ };
91
+ backgroundPosition?: string;
92
+ backgroundSize?: string;
93
+ backgroundRepeat?: string;
94
+ };
95
+ }
96
+ /**
97
+ * Resolves block supports configuration to generated attribute definitions.
98
+ * This maps the `supports` object in block.json to actual attributes.
99
+ */
100
+ export declare function resolveSupportsToAttributes(supports: BlockSupports | undefined): Record<string, BlockAttributeDefinition>;
101
+ /**
102
+ * Creates a Zod schema for the `style` attribute based on supports.
103
+ */
104
+ export declare function createStyleSchema(supports: BlockSupports | undefined): z.ZodTypeAny;
105
+ /**
106
+ * Creates a Zod schema for the `layout` attribute based on supports.
107
+ */
108
+ export declare function createLayoutSchema(supports: BlockSupports | undefined): z.ZodTypeAny | undefined;
109
+ //# sourceMappingURL=supports-resolver.d.ts.map
@@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