@morphika/andami 0.2.15 → 0.2.17

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.
@@ -25,6 +25,12 @@ import { DEVICE_HEIGHTS } from "../../lib/builder/types";
25
25
  import { getEffectiveColumnsV2, getSectionV2SettingValue } from "./settings-panel/responsive-helpers";
26
26
  import BlockLivePreview from "./BlockLivePreview";
27
27
  import { getColumnVerticalAlign, getRowLayoutStyles } from "../../lib/builder/layout-styles";
28
+ import type { ContentBlock } from "../../lib/sanity/types";
29
+
30
+ function isFillBlock(block: ContentBlock): boolean {
31
+ return (block._type === "imageBlock" || block._type === "videoBlock") &&
32
+ (block as unknown as { width?: string }).width === "fill";
33
+ }
28
34
 
29
35
  // Layout keys that support responsive overrides for V2 sections
30
36
  const OVERRIDABLE_KEYS = [
@@ -84,6 +90,7 @@ const ReadOnlySectionV2 = memo(function ReadOnlySectionV2({ section, viewport }:
84
90
  style={{
85
91
  gridColumn: `${gridColumn} / span ${span}`,
86
92
  gridRow,
93
+ position: "relative",
87
94
  display: "flex",
88
95
  flexDirection: "column",
89
96
  ...(colJustify ? { justifyContent: colJustify } : {}),
@@ -93,7 +100,11 @@ const ReadOnlySectionV2 = memo(function ReadOnlySectionV2({ section, viewport }:
93
100
  }}
94
101
  >
95
102
  {(col.blocks || []).map((block) => (
96
- <div key={block._key} style={{ width: "100%", minWidth: 0 }}>
103
+ <div key={block._key} style={
104
+ isFillBlock(block)
105
+ ? { flex: "999 1 0%", position: "relative" as const, minHeight: 0, zIndex: 0 }
106
+ : { width: "100%", minWidth: 0, position: "relative" as const, zIndex: 1 }
107
+ }>
97
108
  <BlockLivePreview block={block} viewport={viewport} />
98
109
  </div>
99
110
  ))}
@@ -194,6 +205,7 @@ const ReadOnlyParallaxSlide = memo(function ReadOnlyParallaxSlide({
194
205
  style={{
195
206
  gridColumn: `${col.grid_column} / span ${col.span}`,
196
207
  gridRow: col.grid_row,
208
+ position: "relative",
197
209
  display: "flex",
198
210
  flexDirection: "column",
199
211
  ...(colJustify ? { justifyContent: colJustify } : {}),
@@ -203,7 +215,11 @@ const ReadOnlyParallaxSlide = memo(function ReadOnlyParallaxSlide({
203
215
  }}
204
216
  >
205
217
  {(col.blocks || []).map((block) => (
206
- <div key={block._key} style={{ width: "100%", minWidth: 0 }}>
218
+ <div key={block._key} style={
219
+ isFillBlock(block)
220
+ ? { flex: "999 1 0%", position: "relative" as const, minHeight: 0, zIndex: 0 }
221
+ : { width: "100%", minWidth: 0 }
222
+ }>
207
223
  <BlockLivePreview block={block} viewport={viewport} />
208
224
  </div>
209
225
  ))}
@@ -419,24 +435,29 @@ const ReadOnlyCoverSection = memo(function ReadOnlyCoverSection({
419
435
  >
420
436
  {section.columns.map((col) => {
421
437
  const rowAlign = effectiveRows[col.grid_row - 1]?.vertical_align || "start";
422
- const alignSelf = rowAlign === "center" ? "center" : rowAlign === "end" ? "end" : "start";
423
438
  const colJustify = getColumnVerticalAlign(col.blocks || []);
439
+ const justify = rowAlign === "center" ? "center" : rowAlign === "end" ? "flex-end" : colJustify || "flex-start";
424
440
  return (
425
441
  <div
426
442
  key={col._key}
427
443
  style={{
428
444
  gridColumn: `${col.grid_column} / span ${col.span}`,
429
445
  gridRow: col.grid_row,
430
- alignSelf,
446
+ position: "relative",
431
447
  display: "flex",
432
448
  flexDirection: "column",
433
- ...(colJustify ? { justifyContent: colJustify } : {}),
449
+ justifyContent: justify,
450
+ height: "100%",
434
451
  minWidth: 0,
435
452
  overflow: "hidden",
436
453
  }}
437
454
  >
438
455
  {(col.blocks || []).map((block) => (
439
- <div key={block._key} style={{ width: "100%", minWidth: 0 }}>
456
+ <div key={block._key} style={
457
+ isFillBlock(block)
458
+ ? { flex: "999 1 0%", position: "relative" as const, minHeight: 0, zIndex: 0 }
459
+ : { width: "100%", minWidth: 0, position: "relative" as const, zIndex: 1 }
460
+ }>
440
461
  <BlockLivePreview block={block} viewport={viewport} />
441
462
  </div>
442
463
  ))}
@@ -39,7 +39,7 @@ export default function LiveImagePreview({ block }: { block: ImageBlock }) {
39
39
 
40
40
  if (isFill) {
41
41
  return (
42
- <div style={{ width: "100%", height: "100%", overflow: "hidden", borderRadius: block.border_radius ? `${String(block.border_radius).replace(/px$/i, "")}px` : undefined }}>
42
+ <div style={{ position: "absolute", inset: 0, overflow: "hidden", borderRadius: block.border_radius ? `${String(block.border_radius).replace(/px$/i, "")}px` : undefined }}>
43
43
  {/* eslint-disable-next-line @next/next/no-img-element */}
44
44
  <img
45
45
  src={src}
@@ -61,7 +61,7 @@ export default function LiveVideoPreview({ block }: { block: VideoBlock }) {
61
61
  const borderRadius = block.border_radius ? `${String(block.border_radius).replace(/px$/i, "")}px` : undefined;
62
62
 
63
63
  const outerStyle: React.CSSProperties = isFill
64
- ? { width: "100%", height: "100%", minWidth: 0, borderRadius, overflow: "hidden" }
64
+ ? { position: "absolute", inset: 0, minWidth: 0, borderRadius, overflow: "hidden" }
65
65
  : { width: widthStyle, margin: block.width === "contained" ? "0 auto" : undefined, minWidth: 0, borderRadius, overflow: borderRadius ? "hidden" : undefined };
66
66
 
67
67
  return (
package/lib/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  * Exposed as a plain constant so it can be imported without reading
7
7
  * package.json at runtime.
8
8
  */
9
- export const ANDAMI_VERSION = "0.2.15";
9
+ export const ANDAMI_VERSION = "0.2.17";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphika/andami",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "Visual Page Builder — core library. A reusable website builder with visual editing, CMS integration, and asset management.",
5
5
  "type": "module",
6
6
  "license": "MIT",