@commonpub/layer 0.21.18 → 0.21.20

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.
@@ -201,6 +201,13 @@ pre.hljs .hljs-title.class_ { color: var(--hljs-variable); }
201
201
  font-size: 13px;
202
202
  line-height: 1.6;
203
203
  overflow-x: auto;
204
+ /* Reset the global `.cpub-prose pre` rule from prose.css that adds
205
+ border + 16px top/bottom margin to every <pre> inside prose. Inside
206
+ a BlockCodeView the container already owns the border + the header
207
+ sits directly above the body — the global rule's margin and extra
208
+ border created a visible "floating bar with gap then code block"
209
+ effect (heatsynclabs.io report, 2026-05-21). */
210
+ border: 0 !important;
204
211
  }
205
212
 
206
213
  .cpub-code-body code {
@@ -4,22 +4,53 @@ const props = defineProps<{ content: Record<string, unknown> }>();
4
4
  const src = computed(() => (props.content.src as string) || (props.content.url as string) || '');
5
5
  const alt = computed(() => (props.content.alt as string) || '');
6
6
  const caption = computed(() => (props.content.caption as string) || '');
7
+
8
+ /**
9
+ * Rendered-width preset. New uploads (editor ≥ 0.7.11) carry `size` on
10
+ * the BlockTuple content; pre-picker content (no `size` field) falls
11
+ * back to `l` to preserve its pre-0.21.19 visual width — that's the
12
+ * 760px cap from layer 0.21.18.
13
+ */
14
+ type ImageSize = 's' | 'm' | 'l' | 'full';
15
+ const size = computed<ImageSize>(() => {
16
+ const v = props.content.size;
17
+ return v === 's' || v === 'm' || v === 'l' || v === 'full' ? v : 'l';
18
+ });
7
19
  </script>
8
20
 
9
21
  <template>
10
- <figure v-if="src" class="cpub-block-image">
22
+ <figure v-if="src" class="cpub-block-image" :class="`cpub-image-size-${size}`">
11
23
  <img :src="src" :alt="alt" class="cpub-image-img" loading="lazy" />
12
24
  <figcaption v-if="caption" class="cpub-image-caption">{{ caption }}</figcaption>
13
25
  </figure>
14
26
  </template>
15
27
 
16
28
  <style scoped>
29
+ /**
30
+ * Width preset is applied via a class on the <figure> wrapper. The image
31
+ * itself is `width: 100%` of the wrapper, so capping the wrapper's
32
+ * max-width caps the image. `margin-inline: auto` centers when narrower
33
+ * than the available column. The caption sits underneath at the wrapper's
34
+ * width so it never extends past the image.
35
+ *
36
+ * Aspect ratio is preserved via the image's intrinsic ratio + `height:
37
+ * auto`. The .cpub-prose :deep(img) cap in ProjectView.vue still applies
38
+ * but at 760px — these per-block presets stay within that envelope (the
39
+ * 760-cap in ProjectView is the fallback when no per-block size is set).
40
+ */
17
41
  .cpub-block-image {
18
- margin: 24px 0;
42
+ margin: 24px auto;
43
+ display: block;
19
44
  }
20
45
 
46
+ .cpub-image-size-s { max-width: 320px; }
47
+ .cpub-image-size-m { max-width: 540px; }
48
+ .cpub-image-size-l { max-width: 760px; }
49
+ .cpub-image-size-full { max-width: 100%; }
50
+
21
51
  .cpub-image-img {
22
52
  width: 100%;
53
+ height: auto;
23
54
  display: block;
24
55
  border: var(--border-width-default) solid var(--border);
25
56
  }
@@ -77,6 +77,15 @@ const totalPrice = computed(() => {
77
77
 
78
78
  .cpub-parts-table { width: 100%; border-collapse: collapse; }
79
79
 
80
+ /* Reset the global `.cpub-prose th` rule from prose.css that puts a
81
+ 1px border on every <th>. With `border-collapse: collapse`, those
82
+ borders merge into thin lines that visually split the dark header
83
+ row into separate "rounded gap" boxes against the var(--text)
84
+ background. The container's outer border already frames the row;
85
+ internal cell borders are not wanted (heatsynclabs.io report,
86
+ 2026-05-21). Use !important to beat the global rule (specificity
87
+ 0,2,0 vs 0,1,1 would normally win, but the global rule sets
88
+ `border` which the scoped rule doesn't, so it leaks through). */
80
89
  .cpub-parts-table th {
81
90
  font-family: var(--font-mono);
82
91
  font-size: 9px;
@@ -87,10 +96,12 @@ const totalPrice = computed(() => {
87
96
  padding: 8px 12px;
88
97
  background: var(--text);
89
98
  color: var(--surface);
99
+ border: 0 !important;
90
100
  }
91
101
 
92
102
  .cpub-parts-table td {
93
103
  padding: 10px 12px;
104
+ border: 0;
94
105
  border-bottom: var(--border-width-default) solid var(--border2);
95
106
  font-size: 13px;
96
107
  color: var(--text-dim);
@@ -713,7 +713,10 @@ async function handleBuild(): Promise<void> {
713
713
  .cpub-page-outer {
714
714
  max-width: 1160px;
715
715
  margin: 0 auto;
716
- padding: 0 clamp(12px, 3vw, 32px);
716
+ /* A smidge more breathing room at all widths: min 20 (was 12),
717
+ max 40 (was 32). Keeps content from hugging the viewport edge
718
+ on mid-size screens. */
719
+ padding: 0 clamp(20px, 3.5vw, 40px);
717
720
  }
718
721
 
719
722
  /* ── BREADCRUMB ── */
@@ -989,9 +992,16 @@ async function handleBuild(): Promise<void> {
989
992
  overflow-wrap: break-word;
990
993
  }
991
994
 
992
- /* ── COVER PHOTO (in-body) ── */
995
+ /* ── COVER PHOTO (in-body) ──
996
+ * The in-body featured image. Lives OUTSIDE .cpub-prose, so the
997
+ * `.cpub-prose img` cap doesn't reach it. Cap here at 880px (a touch
998
+ * wider than the 'l' preset for body images, since this is the hero
999
+ * featured image) and center. Pre-0.21.19 this was unbounded `width:
1000
+ * 100%` and grew to whatever the content column was — too big on wide
1001
+ * layouts. */
993
1002
  .cpub-cover-photo {
994
- margin-bottom: 24px;
1003
+ margin: 0 auto 24px;
1004
+ max-width: 880px;
995
1005
  }
996
1006
 
997
1007
  .cpub-cover-photo-img {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonpub/layer",
3
- "version": "0.21.18",
3
+ "version": "0.21.20",
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.6.0",
54
+ "@commonpub/docs": "0.6.3",
54
55
  "@commonpub/config": "0.13.0",
55
56
  "@commonpub/explainer": "0.7.15",
56
- "@commonpub/server": "2.55.0",
57
+ "@commonpub/learning": "0.5.2",
57
58
  "@commonpub/protocol": "0.12.0",
58
59
  "@commonpub/schema": "0.16.0",
59
- "@commonpub/learning": "0.5.2",
60
- "@commonpub/editor": "0.7.10",
61
- "@commonpub/docs": "0.6.3",
62
- "@commonpub/ui": "0.8.5"
60
+ "@commonpub/editor": "0.7.11",
61
+ "@commonpub/ui": "0.8.5",
62
+ "@commonpub/server": "2.55.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@testing-library/jest-dom": "^6.9.1",