@10up/block-renderer-preferences 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.
package/dist/schema.js ADDED
@@ -0,0 +1,107 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Layout preferences schema
4
+ */
5
+ export const layoutPreferencesSchema = z.object({
6
+ /** Prefer CSS Grid over columns */
7
+ preferGrid: z.boolean().optional(),
8
+ /** Default container block */
9
+ defaultContainerBlock: z.string().optional(),
10
+ /** Default alignment */
11
+ defaultAlignment: z.enum(['none', 'wide', 'full']).optional(),
12
+ /** Prefer constrained layout */
13
+ preferConstrained: z.boolean().optional(),
14
+ });
15
+ /**
16
+ * Block preferences schema
17
+ */
18
+ export const blockPreferencesSchema = z.object({
19
+ /** Prefer columns over grid */
20
+ preferColumnsOverGrid: z.boolean().optional(),
21
+ /** Prefer buttons over links */
22
+ preferButtonsOverLinks: z.boolean().optional(),
23
+ /** Prefer patterns when available */
24
+ preferPatternWhenAvailable: z.boolean().optional(),
25
+ /** Blocks to avoid */
26
+ avoidBlocks: z.array(z.string()).optional(),
27
+ /** Block preferences mapping (e.g., "container": "core/group") */
28
+ preferBlocks: z.record(z.string()).optional(),
29
+ });
30
+ /**
31
+ * Typography preferences schema
32
+ */
33
+ export const typographyPreferencesSchema = z.object({
34
+ /** Default heading level */
35
+ defaultHeadingLevel: z.number().int().min(1).max(6).optional(),
36
+ /** Preferred font sizes */
37
+ preferredFontSizes: z.array(z.string()).optional(),
38
+ /** Use drop cap */
39
+ useDropCap: z.boolean().optional(),
40
+ });
41
+ /**
42
+ * Color preferences schema
43
+ */
44
+ export const colorPreferencesSchema = z.object({
45
+ /** Prefer preset colors */
46
+ preferPresetColors: z.boolean().optional(),
47
+ /** Default background color */
48
+ defaultBackgroundColor: z.string().optional(),
49
+ /** Default text color */
50
+ defaultTextColor: z.string().optional(),
51
+ });
52
+ /**
53
+ * Spacing preferences schema
54
+ */
55
+ export const spacingPreferencesSchema = z.object({
56
+ /** Default block gap */
57
+ defaultBlockGap: z.string().optional(),
58
+ /** Prefer margin over padding */
59
+ preferMarginOverPadding: z.boolean().optional(),
60
+ });
61
+ /**
62
+ * Image preferences schema
63
+ */
64
+ export const imagePreferencesSchema = z.object({
65
+ /** Default size slug */
66
+ defaultSizeSlug: z.string().optional(),
67
+ /** Prefer figure caption */
68
+ preferFigureCaption: z.boolean().optional(),
69
+ });
70
+ /**
71
+ * Combined preferences schema
72
+ */
73
+ export const preferencesSchema = z.object({
74
+ layout: layoutPreferencesSchema.optional(),
75
+ blocks: blockPreferencesSchema.optional(),
76
+ typography: typographyPreferencesSchema.optional(),
77
+ colors: colorPreferencesSchema.optional(),
78
+ spacing: spacingPreferencesSchema.optional(),
79
+ images: imagePreferencesSchema.optional(),
80
+ });
81
+ /**
82
+ * Style guide schema
83
+ */
84
+ export const styleGuideSchema = z.object({
85
+ /** Style rules */
86
+ rules: z.array(z.string()).optional(),
87
+ /** Design examples */
88
+ examples: z.record(z.string()).optional(),
89
+ });
90
+ /**
91
+ * Brand guideline schema
92
+ */
93
+ export const brandGuidelineSchema = z.object({
94
+ /** Block type */
95
+ block: z.string(),
96
+ /** Block props */
97
+ props: z.record(z.unknown()),
98
+ });
99
+ /**
100
+ * Complete block preferences schema
101
+ */
102
+ export const blockPreferencesConfigSchema = z.object({
103
+ preferences: preferencesSchema.optional(),
104
+ styleGuide: styleGuideSchema.optional(),
105
+ brandGuidelines: z.record(brandGuidelineSchema).optional(),
106
+ });
107
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,mCAAmC;IACnC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ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,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,kBAAkB;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,sBAAsB;IACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,iBAAiB;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,kBAAkB;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;CAC7B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACzC,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACvC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;CAC3D,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@10up/block-renderer-preferences",
3
+ "version": "0.1.4",
4
+ "description": "User preferences and style guide configuration for WordPress block generation",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "zod": "^3.24.0",
20
+ "@10up/block-renderer-core": "0.1.4"
21
+ },
22
+ "devDependencies": {
23
+ "typescript": "^5.7.0",
24
+ "vitest": "^2.1.0"
25
+ },
26
+ "keywords": [
27
+ "wordpress",
28
+ "blocks",
29
+ "preferences",
30
+ "style-guide",
31
+ "gutenberg"
32
+ ],
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/10up/json-block-renderer",
37
+ "directory": "packages/preferences"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc -p tsconfig.build.json",
44
+ "dev": "tsc -p tsconfig.build.json --watch",
45
+ "typecheck": "tsc --noEmit",
46
+ "clean": "rm -rf dist",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest"
49
+ }
50
+ }