@@ -49,6 +49,138 @@ function mergeDeep(target, source) {
49
49
return target ;
50
50
}
51
51
52
+ function expandWildcardBlocks ( blocksConfig ) {
53
+ if ( ! blocksConfig || typeof blocksConfig !== "object" ) {
54
+ return blocksConfig ;
55
+ }
56
+
57
+ const expanded = { } ;
58
+ const wildcardConfig = blocksConfig [ "*" ] ;
59
+
60
+ // Common block patterns that should receive wildcard settings
61
+ const commonBlocks = [
62
+ // Core blocks
63
+ "core/paragraph" ,
64
+ "core/heading" ,
65
+ "core/list" ,
66
+ "core/list-item" ,
67
+ "core/quote" ,
68
+ "core/audio" ,
69
+ "core/button" ,
70
+ "core/buttons" ,
71
+ "core/columns" ,
72
+ "core/column" ,
73
+ "core/cover" ,
74
+ "core/file" ,
75
+ "core/gallery" ,
76
+ "core/group" ,
77
+ "core/image" ,
78
+ "core/media-text" ,
79
+ "core/more" ,
80
+ "core/nextpage" ,
81
+ "core/preformatted" ,
82
+ "core/pullquote" ,
83
+ "core/separator" ,
84
+ "core/shortcode" ,
85
+ "core/spacer" ,
86
+ "core/table" ,
87
+ "core/verse" ,
88
+ "core/video" ,
89
+ "core/code" ,
90
+ "core/details" ,
91
+ "core/freeform" ,
92
+ "core/html" ,
93
+ "core/search" ,
94
+ "core/social-links" ,
95
+ "core/site-logo" ,
96
+ "core/navigation" ,
97
+ "core/post-template" ,
98
+ "core/post-title" ,
99
+ "core/post-excerpt" ,
100
+ "core/post-content" ,
101
+ "core/post-featured-image" ,
102
+ "core/post-comments" ,
103
+ "core/post-comments-form" ,
104
+ "core/post-comments-count" ,
105
+ "core/post-comments-link" ,
106
+ "core/post-date" ,
107
+ "core/post-author" ,
108
+ "core/post-terms" ,
109
+ "core/post-navigation-link" ,
110
+ "core/query" ,
111
+ "core/query-title" ,
112
+ "core/query-pagination" ,
113
+ "core/query-pagination-next" ,
114
+ "core/query-pagination-previous" ,
115
+ "core/query-pagination-numbers" ,
116
+ "core/query-no-results" ,
117
+ "core/read-more" ,
118
+ "core/site-tagline" ,
119
+ "core/site-title" ,
120
+ "core/archives" ,
121
+ "core/calendar" ,
122
+ "core/categories" ,
123
+ "core/latest-comments" ,
124
+ "core/latest-posts" ,
125
+ "core/page-list" ,
126
+ "core/rss" ,
127
+ "core/social-link" ,
128
+ "core/tag-cloud" ,
129
+ "core/home-link" ,
130
+ "core/loginout" ,
131
+ "core/term-description" ,
132
+ "core/query-loop" ,
133
+ "core/template-part" ,
134
+ "core/avatar" ,
135
+ "core/post-author-biography" ,
136
+ "core/comment-author-avatar" ,
137
+ "core/comment-author-name" ,
138
+ "core/comment-content" ,
139
+ "core/comment-date" ,
140
+ "core/comment-edit-link" ,
141
+ "core/comment-reply-link" ,
142
+ "core/comment-template" ,
143
+ "core/comments" ,
144
+ "core/comments-pagination" ,
145
+ "core/comments-pagination-next" ,
146
+ "core/comments-pagination-numbers" ,
147
+ "core/comments-pagination-previous" ,
148
+ "core/comments-title" ,
149
+ "core/embed" ,
150
+ "core/block" ,
151
+ "core/text" ,
152
+ "core/row" ,
153
+ "core/grid" ,
154
+ // Polaris blocks
155
+ "polaris/accordion" ,
156
+ "polaris/business-card" ,
157
+ "polaris/section" ,
158
+ "polaris/container" ,
159
+ // Compass blocks
160
+ "compass/single-details" ,
161
+ "compass/single-features" ,
162
+ "compass/single-pricing" ,
163
+ ] ;
164
+
165
+ // Apply wildcard config to common blocks if it exists
166
+ if ( wildcardConfig ) {
167
+ for ( const blockName of commonBlocks ) {
168
+ if ( ! blocksConfig [ blockName ] ) {
169
+ expanded [ blockName ] = wildcardConfig ;
170
+ }
171
+ }
172
+ }
173
+
174
+ // Add all explicit block configurations (these override wildcard settings)
175
+ for ( const [ blockName , config ] of Object . entries ( blocksConfig ) ) {
176
+ if ( blockName !== "*" ) {
177
+ expanded [ blockName ] = config ;
178
+ }
179
+ }
180
+
181
+ return expanded ;
182
+ }
183
+
52
184
function compileDirectory ( dirPath , excludeDirs = [ ] ) {
53
185
if ( ! fs . existsSync ( dirPath ) ) return { } ;
54
186
const files = fs . readdirSync ( dirPath ) . filter ( ( f ) => f . endsWith ( ".js" ) ) ;
@@ -307,6 +439,10 @@ function compileThemeJson({ skipBackup = false } = {}) {
307
439
path . join ( THEME_CONFIG_DIR , "settings" ) ,
308
440
) ;
309
441
if ( Object . keys ( settingsData ) . length ) {
442
+ // Expand wildcard blocks if they exist
443
+ if ( settingsData . blocks ) {
444
+ settingsData . blocks = expandWildcardBlocks ( settingsData . blocks ) ;
445
+ }
310
446
compiled . settings = settingsData ;
311
447
}
312
448
0 commit comments