@commonpub/layer 0.7.26 → 0.7.27
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.
|
@@ -174,7 +174,16 @@ const wordCount = computed(() => {
|
|
|
174
174
|
const html = (block.content.html as string) || '';
|
|
175
175
|
const text = (block.content.text as string) || '';
|
|
176
176
|
const code = (block.content.code as string) || '';
|
|
177
|
-
|
|
177
|
+
let combined = html.replace(/<[^>]*>/g, ' ') + ' ' + text + ' ' + code;
|
|
178
|
+
const children = block.content.children;
|
|
179
|
+
if (Array.isArray(children)) {
|
|
180
|
+
for (const child of children) {
|
|
181
|
+
const [, childData] = child as [string, Record<string, unknown>];
|
|
182
|
+
const childHtml = (childData?.html as string) || '';
|
|
183
|
+
const childCode = (childData?.code as string) || '';
|
|
184
|
+
combined += ' ' + childHtml.replace(/<[^>]*>/g, ' ') + ' ' + childCode;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
178
187
|
count += combined.split(/\s+/).filter((w) => w.length > 0).length;
|
|
179
188
|
}
|
|
180
189
|
return count;
|
|
@@ -108,7 +108,16 @@ const wordCount = computed(() => {
|
|
|
108
108
|
const text = (block.content.text as string) || '';
|
|
109
109
|
const code = (block.content.code as string) || '';
|
|
110
110
|
const instructions = (block.content.instructions as string) || '';
|
|
111
|
-
|
|
111
|
+
let combined = html.replace(/<[^>]*>/g, ' ') + ' ' + text + ' ' + code + ' ' + instructions;
|
|
112
|
+
const children = block.content.children;
|
|
113
|
+
if (Array.isArray(children)) {
|
|
114
|
+
for (const child of children) {
|
|
115
|
+
const [, childData] = child as [string, Record<string, unknown>];
|
|
116
|
+
const childHtml = (childData?.html as string) || '';
|
|
117
|
+
const childCode = (childData?.code as string) || '';
|
|
118
|
+
combined += ' ' + childHtml.replace(/<[^>]*>/g, ' ') + ' ' + childCode;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
112
121
|
count += combined.split(/\s+/).filter((w) => w.length > 0).length;
|
|
113
122
|
}
|
|
114
123
|
return count;
|
|
@@ -158,7 +158,17 @@ const wordCount = computed(() => {
|
|
|
158
158
|
const text = (block.content.text as string) || '';
|
|
159
159
|
const code = (block.content.code as string) || '';
|
|
160
160
|
const instructions = (block.content.instructions as string) || '';
|
|
161
|
-
|
|
161
|
+
let combined = html.replace(/<[^>]*>/g, ' ') + ' ' + text + ' ' + code + ' ' + instructions;
|
|
162
|
+
// Count words in nested children (build steps)
|
|
163
|
+
const children = block.content.children;
|
|
164
|
+
if (Array.isArray(children)) {
|
|
165
|
+
for (const child of children) {
|
|
166
|
+
const [, childData] = child as [string, Record<string, unknown>];
|
|
167
|
+
const childHtml = (childData?.html as string) || '';
|
|
168
|
+
const childCode = (childData?.code as string) || '';
|
|
169
|
+
combined += ' ' + childHtml.replace(/<[^>]*>/g, ' ') + ' ' + childCode;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
162
172
|
count += combined.split(/\s+/).filter((w) => w.length > 0).length;
|
|
163
173
|
}
|
|
164
174
|
return count;
|
|
@@ -111,8 +111,7 @@ const partsFromBlocks = computed<PartItem[]>(() => {
|
|
|
111
111
|
interface BuildStep {
|
|
112
112
|
number: number;
|
|
113
113
|
title: string;
|
|
114
|
-
|
|
115
|
-
image?: string;
|
|
114
|
+
children: Array<[string, Record<string, unknown>]>;
|
|
116
115
|
time?: string;
|
|
117
116
|
}
|
|
118
117
|
|
|
@@ -125,11 +124,25 @@ const buildStepsFromBlocks = computed<BuildStep[]>(() => {
|
|
|
125
124
|
const [type, data] = block as [string, Record<string, unknown>];
|
|
126
125
|
if (type === 'buildStep') {
|
|
127
126
|
stepNum++;
|
|
127
|
+
// Migrate old format (instructions + image) to children
|
|
128
|
+
let children: Array<[string, Record<string, unknown>]> = [];
|
|
129
|
+
if (data.children && Array.isArray(data.children) && data.children.length > 0) {
|
|
130
|
+
children = data.children as Array<[string, Record<string, unknown>]>;
|
|
131
|
+
} else {
|
|
132
|
+
const instructions = data.instructions as string | undefined;
|
|
133
|
+
if (instructions && instructions.trim()) {
|
|
134
|
+
const html = instructions.startsWith('<') ? instructions : `<p>${instructions}</p>`;
|
|
135
|
+
children.push(['paragraph', { html }]);
|
|
136
|
+
}
|
|
137
|
+
const image = data.image as string | undefined;
|
|
138
|
+
if (image && image.trim()) {
|
|
139
|
+
children.push(['image', { src: image, alt: `Step ${stepNum}`, caption: '' }]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
128
142
|
steps.push({
|
|
129
143
|
number: (data.stepNumber as number) || stepNum,
|
|
130
144
|
title: (data.title as string) || `Step ${stepNum}`,
|
|
131
|
-
|
|
132
|
-
image: data.image as string | undefined,
|
|
145
|
+
children,
|
|
133
146
|
time: data.time as string | undefined,
|
|
134
147
|
});
|
|
135
148
|
}
|
|
@@ -495,9 +508,8 @@ async function handleBuild(): Promise<void> {
|
|
|
495
508
|
<h3 class="cpub-build-step-title">{{ step.title }}</h3>
|
|
496
509
|
<span v-if="step.time" class="cpub-build-step-time"><i class="fa-regular fa-clock"></i> {{ step.time }}</span>
|
|
497
510
|
</div>
|
|
498
|
-
<div class="cpub-build-step-body">
|
|
499
|
-
<
|
|
500
|
-
<img v-if="step.image" :src="step.image" :alt="`Step ${step.number}`" class="cpub-build-step-img" />
|
|
511
|
+
<div v-if="step.children.length > 0" class="cpub-build-step-body">
|
|
512
|
+
<BlockContentRenderer :blocks="step.children" />
|
|
501
513
|
</div>
|
|
502
514
|
</div>
|
|
503
515
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonpub/layer",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
"vue-router": "^4.3.0",
|
|
52
52
|
"zod": "^4.3.6",
|
|
53
53
|
"@commonpub/auth": "0.5.0",
|
|
54
|
+
"@commonpub/config": "0.9.0",
|
|
54
55
|
"@commonpub/docs": "0.6.2",
|
|
55
|
-
"@commonpub/editor": "0.7.9",
|
|
56
56
|
"@commonpub/explainer": "0.7.6",
|
|
57
|
-
"@commonpub/
|
|
57
|
+
"@commonpub/schema": "0.9.5",
|
|
58
58
|
"@commonpub/protocol": "0.9.7",
|
|
59
59
|
"@commonpub/learning": "0.5.0",
|
|
60
|
+
"@commonpub/editor": "0.7.9",
|
|
60
61
|
"@commonpub/ui": "0.8.5",
|
|
61
|
-
"@commonpub/server": "2.27.7"
|
|
62
|
-
"@commonpub/schema": "0.9.5"
|
|
62
|
+
"@commonpub/server": "2.27.7"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@testing-library/jest-dom": "^6.9.1",
|