@k11k/better-blocks-astro-renderer 0.4.0 → 0.4.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/Callout.astro +17 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k11k/better-blocks-astro-renderer",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Astro renderer for Strapi v5 Blocks content with full Better Blocks plugin support — colors, tables, to-do lists, media embeds, alignment, and more. Native Astro components, zero client-side JavaScript.",
5
5
  "type": "module",
6
6
  "types": "./index.ts",
package/src/Callout.astro CHANGED
@@ -16,7 +16,7 @@ interface Props {
16
16
  const { node, blocks, modifiers } = Astro.props;
17
17
 
18
18
  // GitHub-style alert metadata: default label and octicon path. Accent colors
19
- // live in the scoped <style> below so they can adapt to dark mode.
19
+ // live in the scoped <style> below (GitHub light palette, matching the React renderer).
20
20
  const VARIANTS: Record<CalloutVariant, { label: string; icon: string }> = {
21
21
  note: {
22
22
  label: 'Note',
@@ -73,6 +73,8 @@ const CalloutComp = blocks?.callout as any;
73
73
  <style>
74
74
  .bb-callout {
75
75
  border-left: 0.25rem solid var(--bb-callout-accent, #0969da);
76
+ /* Subtle accent-tinted background (~8% opacity) to match the editor preview. */
77
+ background-color: color-mix(in srgb, var(--bb-callout-accent, #0969da) 8%, transparent);
76
78
  padding: 0.5rem 1rem;
77
79
  margin: 1rem 0;
78
80
  }
@@ -80,9 +82,13 @@ const CalloutComp = blocks?.callout as any;
80
82
  display: flex;
81
83
  align-items: center;
82
84
  gap: 0.5rem;
83
- margin: 0 0 0.25rem;
85
+ /* GitHub spacing: tight title line with a 1rem gap before the body. */
86
+ line-height: 1;
87
+ margin: 0 0 1rem;
84
88
  font-weight: 600;
85
- color: var(--bb-callout-accent, #0969da);
89
+ /* GitHub's caution variant uses a slightly different title color than its
90
+ accent/border, so allow an optional per-variant title override. */
91
+ color: var(--bb-callout-title-color, var(--bb-callout-accent, #0969da));
86
92
  }
87
93
  .bb-callout-icon {
88
94
  width: 16px;
@@ -90,14 +96,18 @@ const CalloutComp = blocks?.callout as any;
90
96
  flex: none;
91
97
  fill: currentColor;
92
98
  }
93
- .bb-callout-body > :first-child {
99
+ /* Collapse the body's outer margins so the content sits flush within the
100
+ callout padding (top/bottom balanced). :global is required because the body
101
+ blocks are rendered by other components and don't carry this component's
102
+ scoped id, so a plain scoped selector would never match them. */
103
+ .bb-callout-body > :global(:first-child) {
94
104
  margin-top: 0;
95
105
  }
96
- .bb-callout-body > :last-child {
106
+ .bb-callout-body > :global(:last-child) {
97
107
  margin-bottom: 0;
98
108
  }
99
109
 
100
- /* Light-mode accents (GitHub palette) */
110
+ /* Accent colors (GitHub light palette) — matches the React renderer. */
101
111
  .bb-callout-note {
102
112
  --bb-callout-accent: #0969da;
103
113
  }
@@ -112,24 +122,6 @@ const CalloutComp = blocks?.callout as any;
112
122
  }
113
123
  .bb-callout-caution {
114
124
  --bb-callout-accent: #cf222e;
115
- }
116
-
117
- /* Dark-mode accents adapt automatically */
118
- @media (prefers-color-scheme: dark) {
119
- .bb-callout-note {
120
- --bb-callout-accent: #4493f8;
121
- }
122
- .bb-callout-tip {
123
- --bb-callout-accent: #3fb950;
124
- }
125
- .bb-callout-important {
126
- --bb-callout-accent: #ab7df8;
127
- }
128
- .bb-callout-warning {
129
- --bb-callout-accent: #d29922;
130
- }
131
- .bb-callout-caution {
132
- --bb-callout-accent: #f85149;
133
- }
125
+ --bb-callout-title-color: #d1242f;
134
126
  }
135
127
  </style>