@wp-typia/project-tools 0.16.11 → 0.16.13
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/README.md +9 -3
- package/dist/runtime/block-generator-service-core.d.ts +8 -0
- package/dist/runtime/block-generator-service-core.js +274 -0
- package/dist/runtime/block-generator-service-spec.d.ts +104 -0
- package/dist/runtime/block-generator-service-spec.js +139 -0
- package/dist/runtime/block-generator-service.d.ts +2 -110
- package/dist/runtime/block-generator-service.js +2 -389
- package/dist/runtime/built-in-block-artifact-documents.d.ts +3 -0
- package/dist/runtime/built-in-block-artifact-documents.js +2 -0
- package/dist/runtime/built-in-block-artifact-types.d.ts +51 -0
- package/dist/runtime/built-in-block-artifact-types.js +304 -0
- package/dist/runtime/built-in-block-artifacts.js +4 -803
- package/dist/runtime/built-in-block-attribute-emitters.d.ts +71 -0
- package/dist/runtime/built-in-block-attribute-emitters.js +176 -0
- package/dist/runtime/built-in-block-attribute-specs.d.ts +38 -0
- package/dist/runtime/built-in-block-attribute-specs.js +358 -0
- package/dist/runtime/built-in-block-code-templates/basic.d.ts +4 -0
- package/dist/runtime/built-in-block-code-templates/basic.js +249 -0
- package/dist/runtime/built-in-block-code-templates/compound-child.d.ts +4 -0
- package/dist/runtime/built-in-block-code-templates/compound-child.js +138 -0
- package/dist/runtime/built-in-block-code-templates/compound-parent.d.ts +6 -0
- package/dist/runtime/built-in-block-code-templates/compound-parent.js +227 -0
- package/dist/runtime/built-in-block-code-templates/compound-persistence.d.ts +4 -0
- package/dist/runtime/built-in-block-code-templates/compound-persistence.js +478 -0
- package/dist/runtime/built-in-block-code-templates/compound.d.ts +3 -0
- package/dist/runtime/built-in-block-code-templates/compound.js +3 -0
- package/dist/runtime/built-in-block-code-templates/interactivity.d.ts +5 -0
- package/dist/runtime/built-in-block-code-templates/interactivity.js +547 -0
- package/dist/runtime/built-in-block-code-templates/persistence.d.ts +5 -0
- package/dist/runtime/built-in-block-code-templates/persistence.js +550 -0
- package/dist/runtime/built-in-block-code-templates/shared.d.ts +16 -0
- package/dist/runtime/built-in-block-code-templates/shared.js +53 -0
- package/dist/runtime/built-in-block-code-templates.d.ts +5 -32
- package/dist/runtime/built-in-block-code-templates.js +5 -2230
- package/dist/runtime/cli-add-block-config.d.ts +6 -0
- package/dist/runtime/cli-add-block-config.js +143 -0
- package/dist/runtime/cli-add-block-legacy-validator.d.ts +4 -0
- package/dist/runtime/cli-add-block-legacy-validator.js +168 -0
- package/dist/runtime/cli-add-block.js +3 -301
- package/dist/runtime/cli-add-workspace-assets.d.ts +38 -0
- package/dist/runtime/cli-add-workspace-assets.js +399 -0
- package/dist/runtime/cli-add-workspace.d.ts +2 -38
- package/dist/runtime/cli-add-workspace.js +5 -396
- package/dist/runtime/cli-diagnostics.js +76 -4
- package/dist/runtime/cli-doctor-environment.d.ts +12 -0
- package/dist/runtime/cli-doctor-environment.js +123 -0
- package/dist/runtime/cli-doctor-workspace.d.ts +18 -0
- package/dist/runtime/cli-doctor-workspace.js +308 -0
- package/dist/runtime/cli-doctor.d.ts +4 -2
- package/dist/runtime/cli-doctor.js +10 -405
- package/dist/runtime/cli-help.js +1 -1
- package/dist/runtime/cli-scaffold.d.ts +8 -1
- package/dist/runtime/cli-scaffold.js +47 -4
- package/dist/runtime/migration-command-surface.d.ts +67 -0
- package/dist/runtime/migration-command-surface.js +189 -0
- package/dist/runtime/migration-diff-rename.d.ts +13 -0
- package/dist/runtime/migration-diff-rename.js +192 -0
- package/dist/runtime/migration-diff-transform.d.ts +14 -0
- package/dist/runtime/migration-diff-transform.js +105 -0
- package/dist/runtime/migration-diff.js +12 -297
- package/dist/runtime/migration-generated-artifacts.d.ts +3 -0
- package/dist/runtime/migration-generated-artifacts.js +41 -0
- package/dist/runtime/migration-maintenance-fixtures.d.ts +23 -0
- package/dist/runtime/migration-maintenance-fixtures.js +126 -0
- package/dist/runtime/migration-maintenance-verify.d.ts +26 -0
- package/dist/runtime/migration-maintenance-verify.js +262 -0
- package/dist/runtime/migration-maintenance.d.ts +2 -0
- package/dist/runtime/migration-maintenance.js +2 -0
- package/dist/runtime/migration-planning.d.ts +23 -0
- package/dist/runtime/migration-planning.js +131 -0
- package/dist/runtime/migration-project-config-source.d.ts +6 -0
- package/dist/runtime/migration-project-config-source.js +424 -0
- package/dist/runtime/migration-project-layout-discovery.d.ts +61 -0
- package/dist/runtime/migration-project-layout-discovery.js +337 -0
- package/dist/runtime/migration-project-layout-paths.d.ts +135 -0
- package/dist/runtime/migration-project-layout-paths.js +288 -0
- package/dist/runtime/migration-project-layout.d.ts +3 -0
- package/dist/runtime/migration-project-layout.js +2 -0
- package/dist/runtime/migration-project-workspace.d.ts +47 -0
- package/dist/runtime/migration-project-workspace.js +212 -0
- package/dist/runtime/migration-project.d.ts +4 -94
- package/dist/runtime/migration-project.js +3 -1101
- package/dist/runtime/migration-render-diff-rule.d.ts +5 -0
- package/dist/runtime/migration-render-diff-rule.js +120 -0
- package/dist/runtime/migration-render-execution.d.ts +3 -0
- package/dist/runtime/migration-render-execution.js +428 -0
- package/dist/runtime/migration-render-generated.d.ts +27 -0
- package/dist/runtime/migration-render-generated.js +230 -0
- package/dist/runtime/migration-render-support.d.ts +3 -0
- package/dist/runtime/migration-render-support.js +16 -0
- package/dist/runtime/migration-render.d.ts +3 -33
- package/dist/runtime/migration-render.js +3 -789
- package/dist/runtime/migrations.d.ts +24 -121
- package/dist/runtime/migrations.js +12 -700
- package/dist/runtime/scaffold-apply-utils.d.ts +9 -0
- package/dist/runtime/scaffold-apply-utils.js +27 -4
- package/dist/runtime/scaffold-bootstrap.d.ts +45 -0
- package/dist/runtime/scaffold-bootstrap.js +185 -0
- package/dist/runtime/scaffold-onboarding.d.ts +12 -0
- package/dist/runtime/scaffold-onboarding.js +42 -5
- package/dist/runtime/scaffold-package-manager-files.d.ts +35 -0
- package/dist/runtime/scaffold-package-manager-files.js +79 -0
- package/dist/runtime/scaffold.d.ts +1 -12
- package/dist/runtime/scaffold.js +11 -394
- package/dist/runtime/template-source-contracts.d.ts +81 -0
- package/dist/runtime/template-source-contracts.js +1 -0
- package/dist/runtime/template-source-external.d.ts +21 -0
- package/dist/runtime/template-source-external.js +184 -0
- package/dist/runtime/template-source-locators.d.ts +4 -0
- package/dist/runtime/template-source-locators.js +72 -0
- package/dist/runtime/template-source-normalization.d.ts +7 -0
- package/dist/runtime/template-source-normalization.js +53 -0
- package/dist/runtime/template-source-remote.d.ts +23 -0
- package/dist/runtime/template-source-remote.js +336 -0
- package/dist/runtime/template-source-seeds.d.ts +12 -0
- package/dist/runtime/template-source-seeds.js +243 -0
- package/dist/runtime/template-source.d.ts +4 -86
- package/dist/runtime/template-source.js +9 -828
- package/package.json +4 -4
|
@@ -1,807 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const INTERACTIVE_MODE_VALUES = ["click", "hover"];
|
|
4
|
-
const ANIMATION_VALUES = ["none", "bounce", "pulse", "shake", "flip"];
|
|
5
|
-
const DEFAULT_COMPOUND_CHILD_BODY_PLACEHOLDER = "Add supporting details for this internal item.";
|
|
6
|
-
function createConstraints(overrides = {}) {
|
|
7
|
-
return {
|
|
8
|
-
exclusiveMaximum: null,
|
|
9
|
-
exclusiveMinimum: null,
|
|
10
|
-
format: null,
|
|
11
|
-
maxLength: null,
|
|
12
|
-
maxItems: null,
|
|
13
|
-
maximum: null,
|
|
14
|
-
minLength: null,
|
|
15
|
-
minItems: null,
|
|
16
|
-
minimum: null,
|
|
17
|
-
multipleOf: null,
|
|
18
|
-
pattern: null,
|
|
19
|
-
typeTag: null,
|
|
20
|
-
...overrides,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function createManifestAttribute({ constraints, defaultValue, enumValues = null, kind, required, selector = null, source = null, sourceType, }) {
|
|
24
|
-
const hasDefault = defaultValue !== undefined;
|
|
25
|
-
return {
|
|
26
|
-
ts: {
|
|
27
|
-
items: null,
|
|
28
|
-
kind,
|
|
29
|
-
properties: null,
|
|
30
|
-
required,
|
|
31
|
-
union: null,
|
|
32
|
-
},
|
|
33
|
-
typia: {
|
|
34
|
-
constraints: createConstraints(constraints),
|
|
35
|
-
defaultValue: hasDefault ? defaultValue : null,
|
|
36
|
-
hasDefault,
|
|
37
|
-
},
|
|
38
|
-
wp: {
|
|
39
|
-
defaultValue: hasDefault ? defaultValue : null,
|
|
40
|
-
enum: enumValues,
|
|
41
|
-
hasDefault,
|
|
42
|
-
...(selector ? { selector } : {}),
|
|
43
|
-
...(source ? { source } : {}),
|
|
44
|
-
type: sourceType,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function createBlockJsonAttribute({ defaultValue, enumValues = null, selector, source, type, }) {
|
|
49
|
-
const attribute = {
|
|
50
|
-
type,
|
|
51
|
-
};
|
|
52
|
-
if (defaultValue !== undefined) {
|
|
53
|
-
attribute.default = defaultValue;
|
|
54
|
-
}
|
|
55
|
-
if (enumValues !== null && enumValues.length > 0) {
|
|
56
|
-
attribute.enum = enumValues;
|
|
57
|
-
}
|
|
58
|
-
if (source) {
|
|
59
|
-
attribute.source = source;
|
|
60
|
-
}
|
|
61
|
-
if (selector) {
|
|
62
|
-
attribute.selector = selector;
|
|
63
|
-
}
|
|
64
|
-
return attribute;
|
|
65
|
-
}
|
|
66
|
-
function describe(...lines) {
|
|
67
|
-
return {
|
|
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
|
-
},
|
|
82
|
-
description,
|
|
83
|
-
manifest: {
|
|
84
|
-
constraints,
|
|
85
|
-
defaultValue: resolvedManifestDefaultValue,
|
|
86
|
-
enumValues,
|
|
87
|
-
kind,
|
|
88
|
-
required: !optional,
|
|
89
|
-
selector,
|
|
90
|
-
source,
|
|
91
|
-
sourceType,
|
|
92
|
-
},
|
|
93
|
-
name,
|
|
94
|
-
optional,
|
|
95
|
-
typeExpression,
|
|
96
|
-
};
|
|
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
|
-
}
|
|
119
|
-
function resolveBuiltInAttributeValue(value, context) {
|
|
120
|
-
if (typeof value === "function") {
|
|
121
|
-
return value(context);
|
|
122
|
-
}
|
|
123
|
-
return value;
|
|
124
|
-
}
|
|
125
|
-
function buildAttributesFromSpecs(specs, context) {
|
|
126
|
-
return specs.map((spec) => {
|
|
127
|
-
const resolvedSpec = {
|
|
128
|
-
blockJsonDefaultValue: resolveBuiltInAttributeValue(spec.blockJsonDefaultValue, context),
|
|
129
|
-
constraints: resolveBuiltInAttributeValue(spec.constraints, context),
|
|
130
|
-
defaultValue: resolveBuiltInAttributeValue(spec.defaultValue, context),
|
|
131
|
-
description: resolveBuiltInAttributeValue(spec.description, context),
|
|
132
|
-
enumValues: resolveBuiltInAttributeValue(spec.enumValues, context),
|
|
133
|
-
manifestDefaultValue: resolveBuiltInAttributeValue(spec.manifestDefaultValue, context),
|
|
134
|
-
name: spec.name,
|
|
135
|
-
optional: spec.optional,
|
|
136
|
-
selector: resolveBuiltInAttributeValue(spec.selector, context),
|
|
137
|
-
source: resolveBuiltInAttributeValue(spec.source, context),
|
|
138
|
-
typeExpression: resolveBuiltInAttributeValue(spec.typeExpression, context) ?? "unknown",
|
|
139
|
-
};
|
|
140
|
-
if (spec.attributeType === "boolean") {
|
|
141
|
-
return defineBooleanAttribute(resolvedSpec);
|
|
142
|
-
}
|
|
143
|
-
if (spec.attributeType === "number") {
|
|
144
|
-
return defineNumberAttribute(resolvedSpec);
|
|
145
|
-
}
|
|
146
|
-
return defineStringAttribute(resolvedSpec);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function buildManifestDocument(sourceType, attributes) {
|
|
150
|
-
return {
|
|
151
|
-
attributes: Object.fromEntries(attributes.map((attribute) => [
|
|
152
|
-
attribute.name,
|
|
153
|
-
createManifestAttribute(attribute.manifest),
|
|
154
|
-
])),
|
|
155
|
-
manifestVersion: 2,
|
|
156
|
-
sourceType,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function buildBlockJsonAttributes(attributes) {
|
|
160
|
-
return Object.fromEntries(attributes.map((attribute) => [
|
|
161
|
-
attribute.name,
|
|
162
|
-
createBlockJsonAttribute(attribute.blockJson),
|
|
163
|
-
]));
|
|
164
|
-
}
|
|
165
|
-
function quote(value) {
|
|
166
|
-
return JSON.stringify(value);
|
|
167
|
-
}
|
|
168
|
-
function emitDocComment(description, indent = "") {
|
|
169
|
-
if (!description) {
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
return [
|
|
173
|
-
`${indent}/**`,
|
|
174
|
-
...description.lines.map((line) => line.length === 0 ? `${indent} *` : `${indent} * ${line}`),
|
|
175
|
-
`${indent} */`,
|
|
176
|
-
];
|
|
177
|
-
}
|
|
178
|
-
function emitInterface(definition) {
|
|
179
|
-
const lines = [
|
|
180
|
-
...emitDocComment(definition.description),
|
|
181
|
-
`export interface ${definition.name} {`,
|
|
182
|
-
];
|
|
183
|
-
for (const member of definition.members) {
|
|
184
|
-
lines.push(...emitDocComment(member.description, "\t"));
|
|
185
|
-
lines.push(`\t${member.name}${member.optional ? "?" : ""}: ${member.typeExpression};`);
|
|
186
|
-
}
|
|
187
|
-
lines.push("}");
|
|
188
|
-
return lines;
|
|
189
|
-
}
|
|
190
|
-
function emitTypesModule({ preambleLines, interfaces, typeAliases, }) {
|
|
191
|
-
const sections = [];
|
|
192
|
-
if (preambleLines.length > 0) {
|
|
193
|
-
sections.push(preambleLines.join("\n"));
|
|
194
|
-
}
|
|
195
|
-
for (const definition of interfaces) {
|
|
196
|
-
sections.push(emitInterface(definition).join("\n"));
|
|
197
|
-
}
|
|
198
|
-
if (typeAliases.length > 0) {
|
|
199
|
-
sections.push(typeAliases
|
|
200
|
-
.map((alias) => `export type ${alias.name} = ${alias.value};`)
|
|
201
|
-
.join("\n"));
|
|
202
|
-
}
|
|
203
|
-
return `${sections.join("\n\n")}\n`;
|
|
204
|
-
}
|
|
1
|
+
import { buildBasicAttributes, buildBlockJsonAttributes, buildCompoundChildAttributes, buildCompoundParentAttributes, buildInteractivityAttributes, buildManifestDocument, buildPersistenceAttributes, DEFAULT_COMPOUND_CHILD_BODY_PLACEHOLDER, } from "./built-in-block-artifact-documents.js";
|
|
2
|
+
import { buildBasicTypesSource, buildCompoundChildTypesSource, buildCompoundTypesSource, buildInteractivityTypesSource, buildPersistenceTypesSource, } from "./built-in-block-artifact-types.js";
|
|
205
3
|
function stringifyBlockJsonDocument(document) {
|
|
206
4
|
return `${JSON.stringify(document, null, "\t")}\n`;
|
|
207
5
|
}
|
|
208
|
-
const BASIC_ATTRIBUTE_SPECS = [
|
|
209
|
-
{
|
|
210
|
-
attributeType: "string",
|
|
211
|
-
constraints: {
|
|
212
|
-
maxLength: 1000,
|
|
213
|
-
},
|
|
214
|
-
defaultValue: "",
|
|
215
|
-
description: describe("Main block content"),
|
|
216
|
-
name: "content",
|
|
217
|
-
optional: false,
|
|
218
|
-
typeExpression: 'string & tags.MaxLength<1000> & tags.Default<"">',
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
attributeType: "string",
|
|
222
|
-
defaultValue: "left",
|
|
223
|
-
description: describe("Alignment"),
|
|
224
|
-
enumValues: [...BASIC_ALIGNMENT_VALUES],
|
|
225
|
-
name: "alignment",
|
|
226
|
-
optional: true,
|
|
227
|
-
typeExpression: 'TextAlignment & tags.Default<"left">',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
attributeType: "boolean",
|
|
231
|
-
defaultValue: true,
|
|
232
|
-
description: describe("Visibility toggle"),
|
|
233
|
-
name: "isVisible",
|
|
234
|
-
optional: true,
|
|
235
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
attributeType: "string",
|
|
239
|
-
constraints: {
|
|
240
|
-
maxLength: 100,
|
|
241
|
-
},
|
|
242
|
-
defaultValue: "",
|
|
243
|
-
description: describe("Custom CSS class"),
|
|
244
|
-
name: "className",
|
|
245
|
-
optional: true,
|
|
246
|
-
typeExpression: 'string & tags.MaxLength<100> & tags.Default<"">',
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
attributeType: "string",
|
|
250
|
-
constraints: {
|
|
251
|
-
format: "uuid",
|
|
252
|
-
},
|
|
253
|
-
description: describe("Generated runtime ID"),
|
|
254
|
-
name: "id",
|
|
255
|
-
optional: true,
|
|
256
|
-
typeExpression: 'string & tags.Format<"uuid">',
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
attributeType: "number",
|
|
260
|
-
constraints: {
|
|
261
|
-
typeTag: "uint32",
|
|
262
|
-
},
|
|
263
|
-
defaultValue: 1,
|
|
264
|
-
description: describe("Block version for migrations"),
|
|
265
|
-
name: "schemaVersion",
|
|
266
|
-
optional: true,
|
|
267
|
-
typeExpression: 'number & tags.Type<"uint32"> & tags.Default<1>',
|
|
268
|
-
},
|
|
269
|
-
];
|
|
270
|
-
const INTERACTIVITY_ATTRIBUTE_SPECS = [
|
|
271
|
-
{
|
|
272
|
-
attributeType: "string",
|
|
273
|
-
constraints: {
|
|
274
|
-
maxLength: 1000,
|
|
275
|
-
},
|
|
276
|
-
defaultValue: "",
|
|
277
|
-
name: "content",
|
|
278
|
-
optional: false,
|
|
279
|
-
selector: (variables) => `.${variables.cssClassName}__content`,
|
|
280
|
-
source: "html",
|
|
281
|
-
typeExpression: 'string & tags.MaxLength<1000> & tags.Default<"">',
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
attributeType: "string",
|
|
285
|
-
defaultValue: "left",
|
|
286
|
-
enumValues: [...ALIGNMENT_VALUES],
|
|
287
|
-
name: "alignment",
|
|
288
|
-
optional: true,
|
|
289
|
-
typeExpression: 'TextAlignment & tags.Default<"left">',
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
attributeType: "boolean",
|
|
293
|
-
defaultValue: true,
|
|
294
|
-
name: "isVisible",
|
|
295
|
-
optional: true,
|
|
296
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
attributeType: "string",
|
|
300
|
-
defaultValue: "click",
|
|
301
|
-
enumValues: [...INTERACTIVE_MODE_VALUES],
|
|
302
|
-
name: "interactiveMode",
|
|
303
|
-
optional: true,
|
|
304
|
-
typeExpression: '("click" | "hover") & tags.Default<"click">',
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
attributeType: "string",
|
|
308
|
-
defaultValue: "none",
|
|
309
|
-
enumValues: [...ANIMATION_VALUES],
|
|
310
|
-
name: "animation",
|
|
311
|
-
optional: true,
|
|
312
|
-
typeExpression: '("none" | "bounce" | "pulse" | "shake" | "flip") & tags.Default<"none">',
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
attributeType: "number",
|
|
316
|
-
constraints: {
|
|
317
|
-
minimum: 0,
|
|
318
|
-
typeTag: "uint32",
|
|
319
|
-
},
|
|
320
|
-
defaultValue: 0,
|
|
321
|
-
name: "clickCount",
|
|
322
|
-
optional: true,
|
|
323
|
-
typeExpression: 'number & tags.Minimum<0> & tags.Type<"uint32"> & tags.Default<0>',
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
attributeType: "boolean",
|
|
327
|
-
defaultValue: false,
|
|
328
|
-
name: "isAnimating",
|
|
329
|
-
optional: true,
|
|
330
|
-
typeExpression: "boolean & tags.Default<false>",
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
attributeType: "boolean",
|
|
334
|
-
defaultValue: true,
|
|
335
|
-
name: "showCounter",
|
|
336
|
-
optional: true,
|
|
337
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
attributeType: "number",
|
|
341
|
-
constraints: {
|
|
342
|
-
minimum: 0,
|
|
343
|
-
typeTag: "uint32",
|
|
344
|
-
},
|
|
345
|
-
defaultValue: 10,
|
|
346
|
-
name: "maxClicks",
|
|
347
|
-
optional: true,
|
|
348
|
-
typeExpression: 'number & tags.Minimum<0> & tags.Type<"uint32"> & tags.Default<10>',
|
|
349
|
-
},
|
|
350
|
-
];
|
|
351
|
-
const PERSISTENCE_ATTRIBUTE_SPECS = [
|
|
352
|
-
{
|
|
353
|
-
attributeType: "string",
|
|
354
|
-
constraints: {
|
|
355
|
-
maxLength: 250,
|
|
356
|
-
minLength: 1,
|
|
357
|
-
},
|
|
358
|
-
defaultValue: (variables) => `${variables.title} persistence block`,
|
|
359
|
-
name: "content",
|
|
360
|
-
optional: false,
|
|
361
|
-
selector: (variables) => `.${variables.cssClassName}__content`,
|
|
362
|
-
source: "html",
|
|
363
|
-
typeExpression: (variables) => `string & tags.MinLength<1> & tags.MaxLength<250> & tags.Default<${quote(`${variables.title} persistence block`)}>`,
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
attributeType: "string",
|
|
367
|
-
defaultValue: "left",
|
|
368
|
-
enumValues: [...ALIGNMENT_VALUES],
|
|
369
|
-
name: "alignment",
|
|
370
|
-
optional: true,
|
|
371
|
-
typeExpression: 'TextAlignment & tags.Default<"left">',
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
attributeType: "boolean",
|
|
375
|
-
defaultValue: true,
|
|
376
|
-
name: "isVisible",
|
|
377
|
-
optional: true,
|
|
378
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
attributeType: "boolean",
|
|
382
|
-
defaultValue: true,
|
|
383
|
-
name: "showCount",
|
|
384
|
-
optional: true,
|
|
385
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
attributeType: "string",
|
|
389
|
-
constraints: {
|
|
390
|
-
maxLength: 40,
|
|
391
|
-
minLength: 1,
|
|
392
|
-
},
|
|
393
|
-
defaultValue: "Persist Count",
|
|
394
|
-
name: "buttonLabel",
|
|
395
|
-
optional: true,
|
|
396
|
-
typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<40> & tags.Default<"Persist Count">',
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
attributeType: "string",
|
|
400
|
-
blockJsonDefaultValue: "",
|
|
401
|
-
constraints: {
|
|
402
|
-
maxLength: 100,
|
|
403
|
-
minLength: 1,
|
|
404
|
-
},
|
|
405
|
-
manifestDefaultValue: "primary",
|
|
406
|
-
name: "resourceKey",
|
|
407
|
-
optional: true,
|
|
408
|
-
typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<100> & tags.Default<"primary">',
|
|
409
|
-
},
|
|
410
|
-
];
|
|
411
|
-
const COMPOUND_PARENT_BASE_ATTRIBUTE_SPECS = [
|
|
412
|
-
{
|
|
413
|
-
attributeType: "string",
|
|
414
|
-
constraints: {
|
|
415
|
-
maxLength: 80,
|
|
416
|
-
minLength: 1,
|
|
417
|
-
},
|
|
418
|
-
defaultValue: (variables) => variables.title,
|
|
419
|
-
name: "heading",
|
|
420
|
-
optional: false,
|
|
421
|
-
selector: (variables) => `.${variables.cssClassName}__heading`,
|
|
422
|
-
source: "html",
|
|
423
|
-
typeExpression: (variables) => `string & tags.MinLength<1> & tags.MaxLength<80> & tags.Default<${quote(variables.title)}>`,
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
attributeType: "string",
|
|
427
|
-
constraints: {
|
|
428
|
-
maxLength: 180,
|
|
429
|
-
minLength: 1,
|
|
430
|
-
},
|
|
431
|
-
defaultValue: "Add and reorder internal items inside this compound block.",
|
|
432
|
-
name: "intro",
|
|
433
|
-
optional: true,
|
|
434
|
-
selector: (variables) => `.${variables.cssClassName}__intro`,
|
|
435
|
-
source: "html",
|
|
436
|
-
typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<180> & tags.Default<"Add and reorder internal items inside this compound block.">',
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
attributeType: "boolean",
|
|
440
|
-
defaultValue: true,
|
|
441
|
-
name: "showDividers",
|
|
442
|
-
optional: true,
|
|
443
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
444
|
-
},
|
|
445
|
-
];
|
|
446
|
-
const COMPOUND_PARENT_PERSISTENCE_ATTRIBUTE_SPECS = [
|
|
447
|
-
{
|
|
448
|
-
attributeType: "boolean",
|
|
449
|
-
defaultValue: true,
|
|
450
|
-
name: "showCount",
|
|
451
|
-
optional: true,
|
|
452
|
-
typeExpression: "boolean & tags.Default<true>",
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
attributeType: "string",
|
|
456
|
-
constraints: {
|
|
457
|
-
maxLength: 40,
|
|
458
|
-
minLength: 1,
|
|
459
|
-
},
|
|
460
|
-
defaultValue: "Persist Count",
|
|
461
|
-
name: "buttonLabel",
|
|
462
|
-
optional: true,
|
|
463
|
-
typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<40> & tags.Default<"Persist Count">',
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
attributeType: "string",
|
|
467
|
-
blockJsonDefaultValue: "",
|
|
468
|
-
constraints: {
|
|
469
|
-
maxLength: 100,
|
|
470
|
-
minLength: 1,
|
|
471
|
-
},
|
|
472
|
-
manifestDefaultValue: "primary",
|
|
473
|
-
name: "resourceKey",
|
|
474
|
-
optional: true,
|
|
475
|
-
typeExpression: 'string & tags.MinLength<1> & tags.MaxLength<100> & tags.Default<"primary">',
|
|
476
|
-
},
|
|
477
|
-
];
|
|
478
|
-
const COMPOUND_CHILD_ATTRIBUTE_SPECS = [
|
|
479
|
-
{
|
|
480
|
-
attributeType: "string",
|
|
481
|
-
constraints: {
|
|
482
|
-
maxLength: 80,
|
|
483
|
-
minLength: 1,
|
|
484
|
-
},
|
|
485
|
-
defaultValue: ({ childTitle }) => childTitle,
|
|
486
|
-
name: "title",
|
|
487
|
-
optional: false,
|
|
488
|
-
selector: ({ childCssClassName }) => childCssClassName ? `.${childCssClassName}__title` : null,
|
|
489
|
-
source: ({ childCssClassName }) => childCssClassName ? "html" : null,
|
|
490
|
-
typeExpression: ({ childTitle }) => `string & tags.MinLength<1> & tags.MaxLength<80> & tags.Default<${quote(childTitle)}>`,
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
attributeType: "string",
|
|
494
|
-
constraints: {
|
|
495
|
-
maxLength: 280,
|
|
496
|
-
minLength: 1,
|
|
497
|
-
},
|
|
498
|
-
defaultValue: ({ bodyPlaceholder }) => bodyPlaceholder,
|
|
499
|
-
name: "body",
|
|
500
|
-
optional: false,
|
|
501
|
-
selector: ({ childCssClassName }) => childCssClassName ? `.${childCssClassName}__body` : null,
|
|
502
|
-
source: ({ childCssClassName }) => childCssClassName ? "html" : null,
|
|
503
|
-
typeExpression: ({ bodyPlaceholder }) => `string & tags.MinLength<1> & tags.MaxLength<280> & tags.Default<${quote(bodyPlaceholder)}>`,
|
|
504
|
-
},
|
|
505
|
-
];
|
|
506
|
-
function buildBasicAttributes() {
|
|
507
|
-
return buildAttributesFromSpecs(BASIC_ATTRIBUTE_SPECS, undefined);
|
|
508
|
-
}
|
|
509
|
-
function buildInteractivityAttributes(variables) {
|
|
510
|
-
return buildAttributesFromSpecs(INTERACTIVITY_ATTRIBUTE_SPECS, variables);
|
|
511
|
-
}
|
|
512
|
-
function buildPersistenceAttributes(variables) {
|
|
513
|
-
return buildAttributesFromSpecs(PERSISTENCE_ATTRIBUTE_SPECS, variables);
|
|
514
|
-
}
|
|
515
|
-
function buildCompoundParentAttributes(variables) {
|
|
516
|
-
return buildAttributesFromSpecs(variables.compoundPersistenceEnabled === "true"
|
|
517
|
-
? [
|
|
518
|
-
...COMPOUND_PARENT_BASE_ATTRIBUTE_SPECS,
|
|
519
|
-
...COMPOUND_PARENT_PERSISTENCE_ATTRIBUTE_SPECS,
|
|
520
|
-
]
|
|
521
|
-
: COMPOUND_PARENT_BASE_ATTRIBUTE_SPECS, variables);
|
|
522
|
-
}
|
|
523
|
-
function buildCompoundChildAttributes(bodyPlaceholder = DEFAULT_COMPOUND_CHILD_BODY_PLACEHOLDER, childTitle, childCssClassName) {
|
|
524
|
-
return buildAttributesFromSpecs(COMPOUND_CHILD_ATTRIBUTE_SPECS, {
|
|
525
|
-
bodyPlaceholder,
|
|
526
|
-
childCssClassName,
|
|
527
|
-
childTitle,
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
function buildBasicTypesSource(variables, attributes) {
|
|
531
|
-
return emitTypesModule({
|
|
532
|
-
preambleLines: [
|
|
533
|
-
'import type { TextAlignment } from "@wp-typia/block-types/block-editor/alignment";',
|
|
534
|
-
"import type {",
|
|
535
|
-
"\tTypiaValidationError,",
|
|
536
|
-
"\tValidationResult,",
|
|
537
|
-
'} from "@wp-typia/block-runtime/validation";',
|
|
538
|
-
'import { tags } from "typia";',
|
|
539
|
-
"",
|
|
540
|
-
'export type { TypiaValidationError, ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
541
|
-
],
|
|
542
|
-
interfaces: [
|
|
543
|
-
{
|
|
544
|
-
description: {
|
|
545
|
-
lines: [
|
|
546
|
-
"Block attributes interface",
|
|
547
|
-
"Typia tags define runtime validation rules",
|
|
548
|
-
],
|
|
549
|
-
},
|
|
550
|
-
members: attributes.map((attribute) => ({
|
|
551
|
-
description: attribute.description,
|
|
552
|
-
name: attribute.name,
|
|
553
|
-
optional: attribute.optional,
|
|
554
|
-
typeExpression: attribute.typeExpression,
|
|
555
|
-
})),
|
|
556
|
-
name: `${variables.pascalCase}Attributes`,
|
|
557
|
-
},
|
|
558
|
-
],
|
|
559
|
-
typeAliases: [
|
|
560
|
-
{
|
|
561
|
-
name: `${variables.pascalCase}ValidationResult`,
|
|
562
|
-
value: `ValidationResult<${variables.pascalCase}Attributes>`,
|
|
563
|
-
},
|
|
564
|
-
],
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
function buildInteractivityTypesSource(variables, attributes) {
|
|
568
|
-
return emitTypesModule({
|
|
569
|
-
preambleLines: [
|
|
570
|
-
'import type { TextAlignment } from "@wp-typia/block-types/block-editor/alignment";',
|
|
571
|
-
"import type {",
|
|
572
|
-
"\tTypiaValidationError,",
|
|
573
|
-
"\tValidationResult,",
|
|
574
|
-
'} from "@wp-typia/block-runtime/validation";',
|
|
575
|
-
'import { tags } from "typia";',
|
|
576
|
-
"",
|
|
577
|
-
'export type { TypiaValidationError, ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
578
|
-
],
|
|
579
|
-
interfaces: [
|
|
580
|
-
{
|
|
581
|
-
members: attributes.map((attribute) => ({
|
|
582
|
-
name: attribute.name,
|
|
583
|
-
optional: attribute.optional,
|
|
584
|
-
typeExpression: attribute.typeExpression,
|
|
585
|
-
})),
|
|
586
|
-
name: `${variables.pascalCase}Attributes`,
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
members: [
|
|
590
|
-
{
|
|
591
|
-
name: "clicks",
|
|
592
|
-
typeExpression: "number",
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
name: "isAnimating",
|
|
596
|
-
typeExpression: "boolean",
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
name: "isVisible",
|
|
600
|
-
typeExpression: "boolean",
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
name: "animation",
|
|
604
|
-
typeExpression: '"none" | "bounce" | "pulse" | "shake" | "flip"',
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
name: "maxClicks",
|
|
608
|
-
typeExpression: "number",
|
|
609
|
-
},
|
|
610
|
-
],
|
|
611
|
-
name: `${variables.pascalCase}Context`,
|
|
612
|
-
},
|
|
613
|
-
],
|
|
614
|
-
typeAliases: [
|
|
615
|
-
{
|
|
616
|
-
name: `${variables.pascalCase}ValidationResult`,
|
|
617
|
-
value: `ValidationResult<${variables.pascalCase}Attributes>`,
|
|
618
|
-
},
|
|
619
|
-
],
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
function buildPersistenceTypesSource(variables, attributes) {
|
|
623
|
-
return emitTypesModule({
|
|
624
|
-
preambleLines: [
|
|
625
|
-
'import type { TextAlignment } from "@wp-typia/block-types/block-editor/alignment";',
|
|
626
|
-
"import type {",
|
|
627
|
-
"\tTypiaValidationError,",
|
|
628
|
-
"\tValidationResult,",
|
|
629
|
-
'} from "@wp-typia/block-runtime/validation";',
|
|
630
|
-
'import { tags } from "typia";',
|
|
631
|
-
"",
|
|
632
|
-
'export type { TypiaValidationError, ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
633
|
-
],
|
|
634
|
-
interfaces: [
|
|
635
|
-
{
|
|
636
|
-
members: attributes.map((attribute) => ({
|
|
637
|
-
name: attribute.name,
|
|
638
|
-
optional: attribute.optional,
|
|
639
|
-
typeExpression: attribute.typeExpression,
|
|
640
|
-
})),
|
|
641
|
-
name: `${variables.pascalCase}Attributes`,
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
members: [
|
|
645
|
-
{ name: "buttonLabel", typeExpression: "string" },
|
|
646
|
-
{ name: "bootstrapReady", typeExpression: "boolean" },
|
|
647
|
-
{ name: "canWrite", typeExpression: "boolean" },
|
|
648
|
-
{ name: "count", typeExpression: "number" },
|
|
649
|
-
{ name: "error", typeExpression: "string" },
|
|
650
|
-
{ name: "isBootstrapping", typeExpression: "boolean" },
|
|
651
|
-
{ name: "isLoading", typeExpression: "boolean" },
|
|
652
|
-
{ name: "isSaving", typeExpression: "boolean" },
|
|
653
|
-
{
|
|
654
|
-
name: "persistencePolicy",
|
|
655
|
-
typeExpression: '"authenticated" | "public"',
|
|
656
|
-
},
|
|
657
|
-
{ name: "postId", typeExpression: "number" },
|
|
658
|
-
{ name: "resourceKey", typeExpression: "string" },
|
|
659
|
-
{
|
|
660
|
-
name: "storage",
|
|
661
|
-
typeExpression: '"post-meta" | "custom-table"',
|
|
662
|
-
},
|
|
663
|
-
{ name: "isVisible", typeExpression: "boolean" },
|
|
664
|
-
{
|
|
665
|
-
name: "client",
|
|
666
|
-
optional: true,
|
|
667
|
-
typeExpression: `${variables.pascalCase}ClientState`,
|
|
668
|
-
},
|
|
669
|
-
],
|
|
670
|
-
name: `${variables.pascalCase}Context`,
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
members: [
|
|
674
|
-
{ name: "isHydrated", typeExpression: "boolean" },
|
|
675
|
-
],
|
|
676
|
-
name: `${variables.pascalCase}State`,
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
members: [
|
|
680
|
-
{ name: "bootstrapError", typeExpression: "string" },
|
|
681
|
-
{ name: "writeExpiry", typeExpression: "number" },
|
|
682
|
-
{ name: "writeNonce", typeExpression: "string" },
|
|
683
|
-
{ name: "writeToken", typeExpression: "string" },
|
|
684
|
-
],
|
|
685
|
-
name: `${variables.pascalCase}ClientState`,
|
|
686
|
-
},
|
|
687
|
-
],
|
|
688
|
-
typeAliases: [
|
|
689
|
-
{
|
|
690
|
-
name: `${variables.pascalCase}ValidationResult`,
|
|
691
|
-
value: `ValidationResult<${variables.pascalCase}Attributes>`,
|
|
692
|
-
},
|
|
693
|
-
],
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
function buildCompoundTypesSource(variables, attributes) {
|
|
697
|
-
const persistenceEnabled = variables.compoundPersistenceEnabled === "true";
|
|
698
|
-
return emitTypesModule({
|
|
699
|
-
preambleLines: persistenceEnabled
|
|
700
|
-
? [
|
|
701
|
-
"import type {",
|
|
702
|
-
"\tTypiaValidationError,",
|
|
703
|
-
"\tValidationResult,",
|
|
704
|
-
'} from "@wp-typia/block-runtime/validation";',
|
|
705
|
-
'import { tags } from "typia";',
|
|
706
|
-
"",
|
|
707
|
-
'export type { TypiaValidationError, ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
708
|
-
]
|
|
709
|
-
: [
|
|
710
|
-
'import type { ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
711
|
-
'import { tags } from "typia";',
|
|
712
|
-
"",
|
|
713
|
-
'export type { ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
714
|
-
],
|
|
715
|
-
interfaces: [
|
|
716
|
-
{
|
|
717
|
-
members: attributes.map((attribute) => ({
|
|
718
|
-
name: attribute.name,
|
|
719
|
-
optional: attribute.optional,
|
|
720
|
-
typeExpression: attribute.typeExpression,
|
|
721
|
-
})),
|
|
722
|
-
name: `${variables.pascalCase}Attributes`,
|
|
723
|
-
},
|
|
724
|
-
...(persistenceEnabled
|
|
725
|
-
? [
|
|
726
|
-
{
|
|
727
|
-
members: [
|
|
728
|
-
{ name: "buttonLabel", typeExpression: "string" },
|
|
729
|
-
{ name: "bootstrapReady", typeExpression: "boolean" },
|
|
730
|
-
{ name: "canWrite", typeExpression: "boolean" },
|
|
731
|
-
{ name: "count", typeExpression: "number" },
|
|
732
|
-
{ name: "error", typeExpression: "string" },
|
|
733
|
-
{ name: "isBootstrapping", typeExpression: "boolean" },
|
|
734
|
-
{ name: "isLoading", typeExpression: "boolean" },
|
|
735
|
-
{ name: "isSaving", typeExpression: "boolean" },
|
|
736
|
-
{
|
|
737
|
-
name: "persistencePolicy",
|
|
738
|
-
typeExpression: '"authenticated" | "public"',
|
|
739
|
-
},
|
|
740
|
-
{ name: "postId", typeExpression: "number" },
|
|
741
|
-
{ name: "resourceKey", typeExpression: "string" },
|
|
742
|
-
{ name: "showCount", typeExpression: "boolean" },
|
|
743
|
-
{
|
|
744
|
-
name: "storage",
|
|
745
|
-
typeExpression: '"post-meta" | "custom-table"',
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
name: "client",
|
|
749
|
-
optional: true,
|
|
750
|
-
typeExpression: `${variables.pascalCase}ClientState`,
|
|
751
|
-
},
|
|
752
|
-
],
|
|
753
|
-
name: `${variables.pascalCase}Context`,
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
members: [{ name: "isHydrated", typeExpression: "boolean" }],
|
|
757
|
-
name: `${variables.pascalCase}State`,
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
members: [
|
|
761
|
-
{ name: "bootstrapError", typeExpression: "string" },
|
|
762
|
-
{ name: "writeExpiry", typeExpression: "number" },
|
|
763
|
-
{ name: "writeNonce", typeExpression: "string" },
|
|
764
|
-
{ name: "writeToken", typeExpression: "string" },
|
|
765
|
-
],
|
|
766
|
-
name: `${variables.pascalCase}ClientState`,
|
|
767
|
-
},
|
|
768
|
-
]
|
|
769
|
-
: []),
|
|
770
|
-
],
|
|
771
|
-
typeAliases: [
|
|
772
|
-
{
|
|
773
|
-
name: `${variables.pascalCase}ValidationResult`,
|
|
774
|
-
value: `ValidationResult<${variables.pascalCase}Attributes>`,
|
|
775
|
-
},
|
|
776
|
-
],
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
function buildCompoundChildTypesSource(variables, attributes) {
|
|
780
|
-
return emitTypesModule({
|
|
781
|
-
preambleLines: [
|
|
782
|
-
'import type { ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
783
|
-
'import { tags } from "typia";',
|
|
784
|
-
"",
|
|
785
|
-
'export type { ValidationResult } from "@wp-typia/block-runtime/validation";',
|
|
786
|
-
],
|
|
787
|
-
interfaces: [
|
|
788
|
-
{
|
|
789
|
-
members: attributes.map((attribute) => ({
|
|
790
|
-
name: attribute.name,
|
|
791
|
-
optional: attribute.optional,
|
|
792
|
-
typeExpression: attribute.typeExpression,
|
|
793
|
-
})),
|
|
794
|
-
name: `${variables.pascalCase}ItemAttributes`,
|
|
795
|
-
},
|
|
796
|
-
],
|
|
797
|
-
typeAliases: [
|
|
798
|
-
{
|
|
799
|
-
name: `${variables.pascalCase}ItemValidationResult`,
|
|
800
|
-
value: `ValidationResult<${variables.pascalCase}ItemAttributes>`,
|
|
801
|
-
},
|
|
802
|
-
],
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
6
|
function buildBasicArtifact(variables) {
|
|
806
7
|
const attributes = buildBasicAttributes();
|
|
807
8
|
return {
|
|
@@ -943,7 +144,7 @@ function buildCompoundParentArtifact(variables) {
|
|
|
943
144
|
};
|
|
944
145
|
}
|
|
945
146
|
function buildCompoundChildArtifact(variables, bodyPlaceholder = DEFAULT_COMPOUND_CHILD_BODY_PLACEHOLDER) {
|
|
946
|
-
const attributes = buildCompoundChildAttributes(
|
|
147
|
+
const attributes = buildCompoundChildAttributes(variables.compoundChildTitle, variables.compoundChildCssClassName, bodyPlaceholder);
|
|
947
148
|
return {
|
|
948
149
|
blockJsonDocument: {
|
|
949
150
|
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
@@ -979,7 +180,7 @@ function buildCompoundChildArtifact(variables, bodyPlaceholder = DEFAULT_COMPOUN
|
|
|
979
180
|
* @returns Starter manifest metadata for the compound child block.
|
|
980
181
|
*/
|
|
981
182
|
export function buildCompoundChildStarterManifestDocument(childTypeName, childTitle, bodyPlaceholder = DEFAULT_COMPOUND_CHILD_BODY_PLACEHOLDER) {
|
|
982
|
-
const attributes = buildCompoundChildAttributes(
|
|
183
|
+
const attributes = buildCompoundChildAttributes(childTitle, null, bodyPlaceholder);
|
|
983
184
|
return buildManifestDocument(childTypeName, attributes);
|
|
984
185
|
}
|
|
985
186
|
/**
|