@commonpub/layer 0.7.24 → 0.7.25
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.
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Build step viewer — renders step header + nested children via BlockContentRenderer.
|
|
4
|
+
* Migrates old flat format (instructions + image) to children on render.
|
|
5
|
+
*/
|
|
6
|
+
import type { BlockTuple } from '@commonpub/editor';
|
|
7
|
+
|
|
2
8
|
const props = defineProps<{
|
|
3
9
|
content: Record<string, unknown>;
|
|
4
10
|
stepNumber?: number;
|
|
5
11
|
}>();
|
|
6
12
|
|
|
7
13
|
const title = computed(() => (props.content.title as string) || `Step ${props.stepNumber ?? 1}`);
|
|
8
|
-
const instructions = computed(() => (props.content.instructions as string) || '');
|
|
9
14
|
const time = computed(() => (props.content.time as string) || '');
|
|
10
|
-
const image = computed(() => (props.content.image as string) || '');
|
|
11
15
|
const num = computed(() => props.stepNumber ?? (props.content.stepNumber as number) ?? 1);
|
|
16
|
+
|
|
17
|
+
/** Resolve children — migrate from old flat format if needed */
|
|
18
|
+
const children = computed<BlockTuple[]>(() => {
|
|
19
|
+
if (props.content.children && Array.isArray(props.content.children) && props.content.children.length > 0) {
|
|
20
|
+
return props.content.children as BlockTuple[];
|
|
21
|
+
}
|
|
22
|
+
// Migrate old format
|
|
23
|
+
const result: BlockTuple[] = [];
|
|
24
|
+
const instructions = props.content.instructions as string | undefined;
|
|
25
|
+
if (instructions && instructions.trim()) {
|
|
26
|
+
const html = instructions.startsWith('<') ? instructions : `<p>${instructions}</p>`;
|
|
27
|
+
result.push(['paragraph', { html }]);
|
|
28
|
+
}
|
|
29
|
+
const image = props.content.image as string | undefined;
|
|
30
|
+
if (image && image.trim()) {
|
|
31
|
+
result.push(['image', { src: image, alt: `Step ${num.value}`, caption: '' }]);
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const hasChildren = computed(() => children.value.length > 0);
|
|
12
37
|
</script>
|
|
13
38
|
|
|
14
39
|
<template>
|
|
@@ -18,9 +43,8 @@ const num = computed(() => props.stepNumber ?? (props.content.stepNumber as numb
|
|
|
18
43
|
<h3 class="cpub-step-title">{{ title }}</h3>
|
|
19
44
|
<span v-if="time" class="cpub-step-time"><i class="fa-regular fa-clock"></i> {{ time }}</span>
|
|
20
45
|
</div>
|
|
21
|
-
<div class="cpub-step-body">
|
|
22
|
-
<
|
|
23
|
-
<img v-if="image" :src="image" :alt="`Step ${num}`" class="cpub-step-img" loading="lazy" />
|
|
46
|
+
<div v-if="hasChildren" class="cpub-step-body">
|
|
47
|
+
<BlockContentRenderer :blocks="children" />
|
|
24
48
|
</div>
|
|
25
49
|
</div>
|
|
26
50
|
</template>
|
|
@@ -78,15 +102,4 @@ const num = computed(() => props.stepNumber ?? (props.content.stepNumber as numb
|
|
|
78
102
|
line-height: 1.7;
|
|
79
103
|
color: var(--text-dim);
|
|
80
104
|
}
|
|
81
|
-
|
|
82
|
-
.cpub-step-body p { margin: 0 0 12px; }
|
|
83
|
-
.cpub-step-body p:last-child { margin-bottom: 0; }
|
|
84
|
-
|
|
85
|
-
.cpub-step-img {
|
|
86
|
-
width: 100%;
|
|
87
|
-
max-height: 400px;
|
|
88
|
-
object-fit: cover;
|
|
89
|
-
border: var(--border-width-default) solid var(--border);
|
|
90
|
-
margin-top: 12px;
|
|
91
|
-
}
|
|
92
105
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonpub/layer",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.25",
|
|
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/config": "0.9.0",
|
|
54
|
-
"@commonpub/
|
|
55
|
-
"@commonpub/
|
|
56
|
-
"@commonpub/explainer": "0.7.6",
|
|
57
|
-
"@commonpub/server": "2.27.7",
|
|
54
|
+
"@commonpub/docs": "0.6.2",
|
|
55
|
+
"@commonpub/editor": "0.7.8",
|
|
58
56
|
"@commonpub/auth": "0.5.0",
|
|
59
57
|
"@commonpub/learning": "0.5.0",
|
|
60
|
-
"@commonpub/
|
|
58
|
+
"@commonpub/explainer": "0.7.6",
|
|
61
59
|
"@commonpub/ui": "0.8.5",
|
|
62
|
-
"@commonpub/
|
|
60
|
+
"@commonpub/schema": "0.9.5",
|
|
61
|
+
"@commonpub/protocol": "0.9.7",
|
|
62
|
+
"@commonpub/server": "2.27.7"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -57,9 +57,9 @@ const projectTemplate: [string, Record<string, unknown>][] = [
|
|
|
57
57
|
['heading', { text: 'Prerequisites', level: 2 }],
|
|
58
58
|
['paragraph', { html: '<ul><li><p>Required tools, accounts, or hardware</p></li><li><p>Link each tool/service on first mention</p></li></ul>' }],
|
|
59
59
|
['partsList', { parts: [] }],
|
|
60
|
-
['buildStep', { stepNumber: 1,
|
|
61
|
-
['buildStep', { stepNumber: 2,
|
|
62
|
-
['buildStep', { stepNumber: 3,
|
|
60
|
+
['buildStep', { stepNumber: 1, title: 'Set Up', time: '', children: [['paragraph', { html: '<p>Brief context sentence — why this step matters. Use code blocks for commands, inline code for filenames and values.</p>' }]] }],
|
|
61
|
+
['buildStep', { stepNumber: 2, title: 'Build', time: '', children: [['paragraph', { html: '<p>Continue the pattern. Each build step = one phase of the build. Link to external repos for full code instead of pasting walls of code.</p>' }]] }],
|
|
62
|
+
['buildStep', { stepNumber: 3, title: 'Verify', time: '', children: [['paragraph', { html: '<p>Add as many steps as needed. Each step should be a clear, actionable phase.</p>' }]] }],
|
|
63
63
|
['heading', { text: 'Testing & Verification', level: 2 }],
|
|
64
64
|
['paragraph', { html: '<p>Tell the reader how to confirm it works. Describe expected output or show what success looks like. Mention common pitfalls briefly if relevant.</p>' }],
|
|
65
65
|
['heading', { text: "What\'s Next?!", level: 2 }],
|