@wp-typia/project-tools 0.16.7 → 0.16.9

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.
Files changed (54) hide show
  1. package/README.md +26 -1
  2. package/dist/runtime/block-generator-service.d.ts +9 -1
  3. package/dist/runtime/block-generator-service.js +137 -16
  4. package/dist/runtime/block-generator-tool-contract.d.ts +93 -0
  5. package/dist/runtime/block-generator-tool-contract.js +157 -0
  6. package/dist/runtime/built-in-block-artifacts.js +171 -423
  7. package/dist/runtime/built-in-block-code-artifacts.js +96 -46
  8. package/dist/runtime/built-in-block-code-templates.d.ts +36 -0
  9. package/dist/runtime/built-in-block-code-templates.js +2233 -0
  10. package/dist/runtime/cli-add-block.d.ts +2 -1
  11. package/dist/runtime/cli-add-block.js +163 -25
  12. package/dist/runtime/cli-add-shared.d.ts +7 -0
  13. package/dist/runtime/cli-add-shared.js +4 -6
  14. package/dist/runtime/cli-add-workspace.js +56 -17
  15. package/dist/runtime/cli-core.d.ts +4 -0
  16. package/dist/runtime/cli-core.js +3 -0
  17. package/dist/runtime/cli-diagnostics.d.ts +58 -0
  18. package/dist/runtime/cli-diagnostics.js +101 -0
  19. package/dist/runtime/cli-doctor.d.ts +2 -1
  20. package/dist/runtime/cli-doctor.js +16 -5
  21. package/dist/runtime/cli-help.js +4 -4
  22. package/dist/runtime/cli-scaffold.d.ts +5 -1
  23. package/dist/runtime/cli-scaffold.js +138 -111
  24. package/dist/runtime/external-layer-selection.d.ts +14 -0
  25. package/dist/runtime/external-layer-selection.js +35 -0
  26. package/dist/runtime/index.d.ts +4 -2
  27. package/dist/runtime/index.js +2 -1
  28. package/dist/runtime/migration-render.d.ts +23 -1
  29. package/dist/runtime/migration-render.js +58 -10
  30. package/dist/runtime/migration-ui-capability.js +17 -8
  31. package/dist/runtime/migration-utils.d.ts +7 -6
  32. package/dist/runtime/migration-utils.js +76 -73
  33. package/dist/runtime/migrations.js +2 -2
  34. package/dist/runtime/object-utils.d.ts +8 -1
  35. package/dist/runtime/object-utils.js +21 -1
  36. package/dist/runtime/scaffold-apply-utils.d.ts +14 -2
  37. package/dist/runtime/scaffold-apply-utils.js +19 -6
  38. package/dist/runtime/scaffold-repository-reference.d.ts +22 -0
  39. package/dist/runtime/scaffold-repository-reference.js +119 -0
  40. package/dist/runtime/scaffold.d.ts +5 -1
  41. package/dist/runtime/scaffold.js +15 -37
  42. package/dist/runtime/template-builtins.d.ts +11 -1
  43. package/dist/runtime/template-builtins.js +118 -25
  44. package/dist/runtime/template-layers.d.ts +37 -0
  45. package/dist/runtime/template-layers.js +184 -0
  46. package/dist/runtime/template-render.d.ts +28 -2
  47. package/dist/runtime/template-render.js +122 -55
  48. package/dist/runtime/template-source.d.ts +23 -5
  49. package/dist/runtime/template-source.js +296 -217
  50. package/package.json +8 -3
  51. package/templates/_shared/base/src/validator-toolkit.ts.mustache +2 -2
  52. package/templates/_shared/compound/core/scripts/add-compound-child.ts.mustache +58 -12
  53. package/templates/_shared/migration-ui/common/src/migrations/helpers.ts +19 -47
  54. package/templates/_shared/migration-ui/common/src/migrations/index.ts +40 -11
@@ -63,16 +63,59 @@ function createBlockJsonAttribute({ defaultValue, enumValues = null, selector, s
63
63
  }
64
64
  return attribute;
65
65
  }
66
- function createAttributeDefinition({ blockJson, description, manifest, name, optional, typeExpression, }) {
66
+ function describe(...lines) {
67
67
  return {
68
- blockJson,
68
+ lines,
69
+ };
70
+ }
71
+ function defineAttribute({ blockJsonDefaultValue, constraints, defaultValue, description, enumValues = null, kind, manifestDefaultValue, name, optional, selector = null, source = null, sourceType, typeExpression, }) {
72
+ const resolvedBlockJsonDefaultValue = blockJsonDefaultValue !== undefined ? blockJsonDefaultValue : defaultValue;
73
+ const resolvedManifestDefaultValue = manifestDefaultValue !== undefined ? manifestDefaultValue : defaultValue;
74
+ return {
75
+ blockJson: {
76
+ defaultValue: resolvedBlockJsonDefaultValue,
77
+ enumValues,
78
+ ...(selector ? { selector } : {}),
79
+ ...(source ? { source } : {}),
80
+ type: sourceType,
81
+ },
69
82
  description,
70
- manifest,
83
+ manifest: {
84
+ constraints,
85
+ defaultValue: resolvedManifestDefaultValue,
86
+ enumValues,
87
+ kind,
88
+ required: !optional,
89
+ selector,
90
+ source,
91
+ sourceType,
92
+ },
71
93
  name,
72
94
  optional,
73
95
  typeExpression,
74
96
  };
75
97
  }
98
+ function defineStringAttribute(spec) {
99
+ return defineAttribute({
100
+ ...spec,
101
+ kind: "string",
102
+ sourceType: "string",
103
+ });
104
+ }
105
+ function defineBooleanAttribute(spec) {
106
+ return defineAttribute({
107
+ ...spec,
108
+ kind: "boolean",
109
+ sourceType: "boolean",
110
+ });
111
+ }
112
+ function defineNumberAttribute(spec) {
113
+ return defineAttribute({
114
+ ...spec,
115
+ kind: "number",
116
+ sourceType: "number",
117
+ });
118
+ }
76
119
  function buildManifestDocument(sourceType, attributes) {
77
120
  return {
78
121
  attributes: Object.fromEntries(attributes.map((attribute) => [
@@ -134,122 +177,56 @@ function stringifyBlockJsonDocument(document) {
134
177
  }
135
178
  function buildBasicAttributes() {
136
179
  return [
137
- createAttributeDefinition({
138
- blockJson: {
139
- defaultValue: "",
140
- type: "string",
141
- },
142
- description: {
143
- lines: ["Main block content"],
144
- },
145
- manifest: {
146
- constraints: {
147
- maxLength: 1000,
148
- },
149
- defaultValue: "",
150
- kind: "string",
151
- required: true,
152
- sourceType: "string",
180
+ defineStringAttribute({
181
+ constraints: {
182
+ maxLength: 1000,
153
183
  },
184
+ defaultValue: "",
185
+ description: describe("Main block content"),
154
186
  name: "content",
155
187
  optional: false,
156
188
  typeExpression: 'string & tags.MaxLength<1000> & tags.Default<"">',
157
189
  }),
158
- createAttributeDefinition({
159
- blockJson: {
160
- defaultValue: "left",
161
- enumValues: [...BASIC_ALIGNMENT_VALUES],
162
- type: "string",
163
- },
164
- description: {
165
- lines: ["Alignment"],
166
- },
167
- manifest: {
168
- defaultValue: "left",
169
- enumValues: [...BASIC_ALIGNMENT_VALUES],
170
- kind: "string",
171
- required: false,
172
- sourceType: "string",
173
- },
190
+ defineStringAttribute({
191
+ defaultValue: "left",
192
+ description: describe("Alignment"),
193
+ enumValues: [...BASIC_ALIGNMENT_VALUES],
174
194
  name: "alignment",
175
195
  optional: true,
176
196
  typeExpression: 'TextAlignment & tags.Default<"left">',
177
197
  }),
178
- createAttributeDefinition({
179
- blockJson: {
180
- defaultValue: true,
181
- type: "boolean",
182
- },
183
- description: {
184
- lines: ["Visibility toggle"],
185
- },
186
- manifest: {
187
- defaultValue: true,
188
- kind: "boolean",
189
- required: false,
190
- sourceType: "boolean",
191
- },
198
+ defineBooleanAttribute({
199
+ defaultValue: true,
200
+ description: describe("Visibility toggle"),
192
201
  name: "isVisible",
193
202
  optional: true,
194
203
  typeExpression: "boolean & tags.Default<true>",
195
204
  }),
196
- createAttributeDefinition({
197
- blockJson: {
198
- defaultValue: "",
199
- type: "string",
200
- },
201
- description: {
202
- lines: ["Custom CSS class"],
203
- },
204
- manifest: {
205
- constraints: {
206
- maxLength: 100,
207
- },
208
- defaultValue: "",
209
- kind: "string",
210
- required: false,
211
- sourceType: "string",
205
+ defineStringAttribute({
206
+ constraints: {
207
+ maxLength: 100,
212
208
  },
209
+ defaultValue: "",
210
+ description: describe("Custom CSS class"),
213
211
  name: "className",
214
212
  optional: true,
215
213
  typeExpression: 'string & tags.MaxLength<100> & tags.Default<"">',
216
214
  }),
217
- createAttributeDefinition({
218
- blockJson: {
219
- type: "string",
220
- },
221
- description: {
222
- lines: ["Generated runtime ID"],
223
- },
224
- manifest: {
225
- constraints: {
226
- format: "uuid",
227
- },
228
- kind: "string",
229
- required: false,
230
- sourceType: "string",
215
+ defineStringAttribute({
216
+ constraints: {
217
+ format: "uuid",
231
218
  },
219
+ description: describe("Generated runtime ID"),
232
220
  name: "id",
233
221
  optional: true,
234
222
  typeExpression: 'string & tags.Format<"uuid">',
235
223
  }),
236
- createAttributeDefinition({
237
- blockJson: {
238
- defaultValue: 1,
239
- type: "number",
240
- },
241
- description: {
242
- lines: ["Block version for migrations"],
243
- },
244
- manifest: {
245
- constraints: {
246
- typeTag: "uint32",
247
- },
248
- defaultValue: 1,
249
- kind: "number",
250
- required: false,
251
- sourceType: "number",
224
+ defineNumberAttribute({
225
+ constraints: {
226
+ typeTag: "uint32",
252
227
  },
228
+ defaultValue: 1,
229
+ description: describe("Block version for migrations"),
253
230
  name: "schemaVersion",
254
231
  optional: true,
255
232
  typeExpression: 'number & tags.Type<"uint32"> & tags.Default<1>',
@@ -258,158 +235,72 @@ function buildBasicAttributes() {
258
235
  }
259
236
  function buildInteractivityAttributes(variables) {
260
237
  return [
261
- createAttributeDefinition({
262
- blockJson: {
263
- defaultValue: "",
264
- selector: `.${variables.cssClassName}__content`,
265
- source: "html",
266
- type: "string",
267
- },
268
- manifest: {
269
- constraints: {
270
- maxLength: 1000,
271
- },
272
- defaultValue: "",
273
- kind: "string",
274
- required: true,
275
- selector: `.${variables.cssClassName}__content`,
276
- source: "html",
277
- sourceType: "string",
238
+ defineStringAttribute({
239
+ constraints: {
240
+ maxLength: 1000,
278
241
  },
242
+ defaultValue: "",
279
243
  name: "content",
280
244
  optional: false,
245
+ selector: `.${variables.cssClassName}__content`,
246
+ source: "html",
281
247
  typeExpression: 'string & tags.MaxLength<1000> & tags.Default<"">',
282
248
  }),
283
- createAttributeDefinition({
284
- blockJson: {
285
- defaultValue: "left",
286
- enumValues: [...ALIGNMENT_VALUES],
287
- type: "string",
288
- },
289
- manifest: {
290
- defaultValue: "left",
291
- enumValues: [...ALIGNMENT_VALUES],
292
- kind: "string",
293
- required: false,
294
- sourceType: "string",
295
- },
249
+ defineStringAttribute({
250
+ defaultValue: "left",
251
+ enumValues: [...ALIGNMENT_VALUES],
296
252
  name: "alignment",
297
253
  optional: true,
298
254
  typeExpression: 'TextAlignment & tags.Default<"left">',
299
255
  }),
300
- createAttributeDefinition({
301
- blockJson: {
302
- defaultValue: true,
303
- type: "boolean",
304
- },
305
- manifest: {
306
- defaultValue: true,
307
- kind: "boolean",
308
- required: false,
309
- sourceType: "boolean",
310
- },
256
+ defineBooleanAttribute({
257
+ defaultValue: true,
311
258
  name: "isVisible",
312
259
  optional: true,
313
260
  typeExpression: "boolean & tags.Default<true>",
314
261
  }),
315
- createAttributeDefinition({
316
- blockJson: {
317
- defaultValue: "click",
318
- enumValues: [...INTERACTIVE_MODE_VALUES],
319
- type: "string",
320
- },
321
- manifest: {
322
- defaultValue: "click",
323
- enumValues: [...INTERACTIVE_MODE_VALUES],
324
- kind: "string",
325
- required: false,
326
- sourceType: "string",
327
- },
262
+ defineStringAttribute({
263
+ defaultValue: "click",
264
+ enumValues: [...INTERACTIVE_MODE_VALUES],
328
265
  name: "interactiveMode",
329
266
  optional: true,
330
267
  typeExpression: '("click" | "hover") & tags.Default<"click">',
331
268
  }),
332
- createAttributeDefinition({
333
- blockJson: {
334
- defaultValue: "none",
335
- enumValues: [...ANIMATION_VALUES],
336
- type: "string",
337
- },
338
- manifest: {
339
- defaultValue: "none",
340
- enumValues: [...ANIMATION_VALUES],
341
- kind: "string",
342
- required: false,
343
- sourceType: "string",
344
- },
269
+ defineStringAttribute({
270
+ defaultValue: "none",
271
+ enumValues: [...ANIMATION_VALUES],
345
272
  name: "animation",
346
273
  optional: true,
347
274
  typeExpression: '("none" | "bounce" | "pulse" | "shake" | "flip") & tags.Default<"none">',
348
275
  }),
349
- createAttributeDefinition({
350
- blockJson: {
351
- defaultValue: 0,
352
- type: "number",
353
- },
354
- manifest: {
355
- constraints: {
356
- minimum: 0,
357
- typeTag: "uint32",
358
- },
359
- defaultValue: 0,
360
- kind: "number",
361
- required: false,
362
- sourceType: "number",
276
+ defineNumberAttribute({
277
+ constraints: {
278
+ minimum: 0,
279
+ typeTag: "uint32",
363
280
  },
281
+ defaultValue: 0,
364
282
  name: "clickCount",
365
283
  optional: true,
366
284
  typeExpression: 'number & tags.Minimum<0> & tags.Type<"uint32"> & tags.Default<0>',
367
285
  }),
368
- createAttributeDefinition({
369
- blockJson: {
370
- defaultValue: false,
371
- type: "boolean",
372
- },
373
- manifest: {
374
- defaultValue: false,
375
- kind: "boolean",
376
- required: false,
377
- sourceType: "boolean",
378
- },
286
+ defineBooleanAttribute({
287
+ defaultValue: false,
379
288
  name: "isAnimating",
380
289
  optional: true,
381
290
  typeExpression: "boolean & tags.Default<false>",
382
291
  }),
383
- createAttributeDefinition({
384
- blockJson: {
385
- defaultValue: true,
386
- type: "boolean",
387
- },
388
- manifest: {
389
- defaultValue: true,
390
- kind: "boolean",
391
- required: false,
392
- sourceType: "boolean",
393
- },
292
+ defineBooleanAttribute({
293
+ defaultValue: true,
394
294
  name: "showCounter",
395
295
  optional: true,
396
296
  typeExpression: "boolean & tags.Default<true>",
397
297
  }),
398
- createAttributeDefinition({
399
- blockJson: {
400
- defaultValue: 10,
401
- type: "number",
402
- },
403
- manifest: {
404
- constraints: {
405
- minimum: 0,
406
- typeTag: "uint32",
407
- },
408
- defaultValue: 10,
409
- kind: "number",
410
- required: false,
411
- sourceType: "number",
298
+ defineNumberAttribute({
299
+ constraints: {
300
+ minimum: 0,
301
+ typeTag: "uint32",
412
302
  },
303
+ defaultValue: 10,
413
304
  name: "maxClicks",
414
305
  optional: true,
415
306
  typeExpression: 'number & tags.Minimum<0> & tags.Type<"uint32"> & tags.Default<10>',
@@ -418,110 +309,54 @@ function buildInteractivityAttributes(variables) {
418
309
  }
419
310
  function buildPersistenceAttributes(variables) {
420
311
  return [
421
- createAttributeDefinition({
422
- blockJson: {
423
- defaultValue: `${variables.title} persistence block`,
424
- selector: `.${variables.cssClassName}__content`,
425
- source: "html",
426
- type: "string",
427
- },
428
- manifest: {
429
- constraints: {
430
- maxLength: 250,
431
- minLength: 1,
432
- },
433
- defaultValue: `${variables.title} persistence block`,
434
- kind: "string",
435
- required: true,
436
- selector: `.${variables.cssClassName}__content`,
437
- source: "html",
438
- sourceType: "string",
312
+ defineStringAttribute({
313
+ constraints: {
314
+ maxLength: 250,
315
+ minLength: 1,
439
316
  },
317
+ defaultValue: `${variables.title} persistence block`,
440
318
  name: "content",
441
319
  optional: false,
320
+ selector: `.${variables.cssClassName}__content`,
321
+ source: "html",
442
322
  typeExpression: `string & tags.MinLength<1> & tags.MaxLength<250> & tags.Default<${quote(`${variables.title} persistence block`)}>`,
443
323
  }),
444
- createAttributeDefinition({
445
- blockJson: {
446
- defaultValue: "left",
447
- enumValues: [...ALIGNMENT_VALUES],
448
- type: "string",
449
- },
450
- manifest: {
451
- defaultValue: "left",
452
- enumValues: [...ALIGNMENT_VALUES],
453
- kind: "string",
454
- required: false,
455
- sourceType: "string",
456
- },
324
+ defineStringAttribute({
325
+ defaultValue: "left",
326
+ enumValues: [...ALIGNMENT_VALUES],
457
327
  name: "alignment",
458
328
  optional: true,
459
329
  typeExpression: 'TextAlignment & tags.Default<"left">',
460
330
  }),
461
- createAttributeDefinition({
462
- blockJson: {
463
- defaultValue: true,
464
- type: "boolean",
465
- },
466
- manifest: {
467
- defaultValue: true,
468
- kind: "boolean",
469
- required: false,
470
- sourceType: "boolean",
471
- },
331
+ defineBooleanAttribute({
332
+ defaultValue: true,
472
333
  name: "isVisible",
473
334
  optional: true,
474
335
  typeExpression: "boolean & tags.Default<true>",
475
336
  }),
476
- createAttributeDefinition({
477
- blockJson: {
478
- defaultValue: true,
479
- type: "boolean",
480
- },
481
- manifest: {
482
- defaultValue: true,
483
- kind: "boolean",
484
- required: false,
485
- sourceType: "boolean",
486
- },
337
+ defineBooleanAttribute({
338
+ defaultValue: true,
487
339
  name: "showCount",
488
340
  optional: true,
489
341
  typeExpression: "boolean & tags.Default<true>",
490
342
  }),
491
- createAttributeDefinition({
492
- blockJson: {
493
- defaultValue: "Persist Count",
494
- type: "string",
495
- },
496
- manifest: {
497
- constraints: {
498
- maxLength: 40,
499
- minLength: 1,
500
- },
501
- defaultValue: "Persist Count",
502
- kind: "string",
503
- required: false,
504
- sourceType: "string",
343
+ defineStringAttribute({
344
+ constraints: {
345
+ maxLength: 40,
346
+ minLength: 1,
505
347
  },
348
+ defaultValue: "Persist Count",
506
349
  name: "buttonLabel",
507
350
  optional: true,
508
351
  typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<40> & tags.Default<"Persist Count">',
509
352
  }),
510
- createAttributeDefinition({
511
- blockJson: {
512
- defaultValue: "",
513
- type: "string",
514
- },
515
- manifest: {
516
- constraints: {
517
- maxLength: 100,
518
- minLength: 1,
519
- },
520
- defaultValue: "primary",
521
- kind: "string",
522
- required: false,
523
- sourceType: "string",
353
+ defineStringAttribute({
354
+ blockJsonDefaultValue: "",
355
+ constraints: {
356
+ maxLength: 100,
357
+ minLength: 1,
524
358
  },
359
+ manifestDefaultValue: "primary",
525
360
  name: "resourceKey",
526
361
  optional: true,
527
362
  typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<100> & tags.Default<"primary">',
@@ -530,116 +365,59 @@ function buildPersistenceAttributes(variables) {
530
365
  }
531
366
  function buildCompoundParentAttributes(variables) {
532
367
  const attributes = [
533
- createAttributeDefinition({
534
- blockJson: {
535
- defaultValue: variables.title,
536
- selector: `.${variables.cssClassName}__heading`,
537
- source: "html",
538
- type: "string",
539
- },
540
- manifest: {
541
- constraints: {
542
- maxLength: 80,
543
- minLength: 1,
544
- },
545
- defaultValue: variables.title,
546
- kind: "string",
547
- required: true,
548
- selector: `.${variables.cssClassName}__heading`,
549
- source: "html",
550
- sourceType: "string",
368
+ defineStringAttribute({
369
+ constraints: {
370
+ maxLength: 80,
371
+ minLength: 1,
551
372
  },
373
+ defaultValue: variables.title,
552
374
  name: "heading",
553
375
  optional: false,
376
+ selector: `.${variables.cssClassName}__heading`,
377
+ source: "html",
554
378
  typeExpression: `string & tags.MinLength<1> & tags.MaxLength<80> & tags.Default<${quote(variables.title)}>`,
555
379
  }),
556
- createAttributeDefinition({
557
- blockJson: {
558
- defaultValue: "Add and reorder internal items inside this compound block.",
559
- selector: `.${variables.cssClassName}__intro`,
560
- source: "html",
561
- type: "string",
562
- },
563
- manifest: {
564
- constraints: {
565
- maxLength: 180,
566
- minLength: 1,
567
- },
568
- defaultValue: "Add and reorder internal items inside this compound block.",
569
- kind: "string",
570
- required: false,
571
- selector: `.${variables.cssClassName}__intro`,
572
- source: "html",
573
- sourceType: "string",
380
+ defineStringAttribute({
381
+ constraints: {
382
+ maxLength: 180,
383
+ minLength: 1,
574
384
  },
385
+ defaultValue: "Add and reorder internal items inside this compound block.",
575
386
  name: "intro",
576
387
  optional: true,
388
+ selector: `.${variables.cssClassName}__intro`,
389
+ source: "html",
577
390
  typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<180> & tags.Default<"Add and reorder internal items inside this compound block.">',
578
391
  }),
579
- createAttributeDefinition({
580
- blockJson: {
581
- defaultValue: true,
582
- type: "boolean",
583
- },
584
- manifest: {
585
- defaultValue: true,
586
- kind: "boolean",
587
- required: false,
588
- sourceType: "boolean",
589
- },
392
+ defineBooleanAttribute({
393
+ defaultValue: true,
590
394
  name: "showDividers",
591
395
  optional: true,
592
396
  typeExpression: "boolean & tags.Default<true>",
593
397
  }),
594
398
  ];
595
399
  if (variables.compoundPersistenceEnabled === "true") {
596
- attributes.push(createAttributeDefinition({
597
- blockJson: {
598
- defaultValue: true,
599
- type: "boolean",
600
- },
601
- manifest: {
602
- defaultValue: true,
603
- kind: "boolean",
604
- required: false,
605
- sourceType: "boolean",
606
- },
400
+ attributes.push(defineBooleanAttribute({
401
+ defaultValue: true,
607
402
  name: "showCount",
608
403
  optional: true,
609
404
  typeExpression: "boolean & tags.Default<true>",
610
- }), createAttributeDefinition({
611
- blockJson: {
612
- defaultValue: "Persist Count",
613
- type: "string",
614
- },
615
- manifest: {
616
- constraints: {
617
- maxLength: 40,
618
- minLength: 1,
619
- },
620
- defaultValue: "Persist Count",
621
- kind: "string",
622
- required: false,
623
- sourceType: "string",
405
+ }), defineStringAttribute({
406
+ constraints: {
407
+ maxLength: 40,
408
+ minLength: 1,
624
409
  },
410
+ defaultValue: "Persist Count",
625
411
  name: "buttonLabel",
626
412
  optional: true,
627
413
  typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<40> & tags.Default<"Persist Count">',
628
- }), createAttributeDefinition({
629
- blockJson: {
630
- defaultValue: "",
631
- type: "string",
632
- },
633
- manifest: {
634
- constraints: {
635
- maxLength: 100,
636
- minLength: 1,
637
- },
638
- defaultValue: "primary",
639
- kind: "string",
640
- required: false,
641
- sourceType: "string",
414
+ }), defineStringAttribute({
415
+ blockJsonDefaultValue: "",
416
+ constraints: {
417
+ maxLength: 100,
418
+ minLength: 1,
642
419
  },
420
+ manifestDefaultValue: "primary",
643
421
  name: "resourceKey",
644
422
  optional: true,
645
423
  typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<100> & tags.Default<"primary">',
@@ -655,58 +433,28 @@ function buildCompoundChildAttributes(bodyPlaceholder = DEFAULT_COMPOUND_CHILD_B
655
433
  ? `.${childCssClassName}__body`
656
434
  : null;
657
435
  return [
658
- createAttributeDefinition({
659
- blockJson: {
660
- defaultValue: childTitle,
661
- ...(titleSelector
662
- ? {
663
- selector: titleSelector,
664
- source: "html",
665
- }
666
- : {}),
667
- type: "string",
668
- },
669
- manifest: {
670
- constraints: {
671
- maxLength: 80,
672
- minLength: 1,
673
- },
674
- defaultValue: childTitle,
675
- kind: "string",
676
- required: true,
677
- selector: titleSelector,
678
- source: titleSelector ? "html" : null,
679
- sourceType: "string",
436
+ defineStringAttribute({
437
+ constraints: {
438
+ maxLength: 80,
439
+ minLength: 1,
680
440
  },
441
+ defaultValue: childTitle,
681
442
  name: "title",
682
443
  optional: false,
444
+ selector: titleSelector,
445
+ source: titleSelector ? "html" : null,
683
446
  typeExpression: `string & tags.MinLength<1> & tags.MaxLength<80> & tags.Default<${quote(childTitle)}>`,
684
447
  }),
685
- createAttributeDefinition({
686
- blockJson: {
687
- defaultValue: bodyPlaceholder,
688
- ...(bodySelector
689
- ? {
690
- selector: bodySelector,
691
- source: "html",
692
- }
693
- : {}),
694
- type: "string",
695
- },
696
- manifest: {
697
- constraints: {
698
- maxLength: 280,
699
- minLength: 1,
700
- },
701
- defaultValue: bodyPlaceholder,
702
- kind: "string",
703
- required: true,
704
- selector: bodySelector,
705
- source: bodySelector ? "html" : null,
706
- sourceType: "string",
448
+ defineStringAttribute({
449
+ constraints: {
450
+ maxLength: 280,
451
+ minLength: 1,
707
452
  },
453
+ defaultValue: bodyPlaceholder,
708
454
  name: "body",
709
455
  optional: false,
456
+ selector: bodySelector,
457
+ source: bodySelector ? "html" : null,
710
458
  typeExpression: `string & tags.MinLength<1> & tags.MaxLength<280> & tags.Default<${quote(bodyPlaceholder)}>`,
711
459
  }),
712
460
  ];