@morphika/andami 0.2.24 → 0.2.26

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.
@@ -151,7 +151,7 @@ export default function CoverSectionRenderer({ section, pageEnterAnimation }: Co
151
151
  style={{
152
152
  position: "absolute",
153
153
  inset: 0,
154
- backgroundImage: `url(${bgImageSrc})`,
154
+ backgroundImage: `url("${bgImageSrc}")`,
155
155
  backgroundSize: section.background_size || "cover",
156
156
  backgroundPosition: section.background_position || "center center",
157
157
  backgroundRepeat: "no-repeat",
@@ -130,7 +130,7 @@ export default function ParallaxSlideRenderer({
130
130
  left: 0,
131
131
  width: "100%",
132
132
  height: bgInnerHeight,
133
- backgroundImage: `url(${bgUrl})`,
133
+ backgroundImage: `url("${bgUrl}")`,
134
134
  backgroundSize: "cover",
135
135
  backgroundPosition: bgPosition,
136
136
  backgroundRepeat: "no-repeat",
@@ -7,7 +7,7 @@ import type { DeviceViewport } from "../../lib/builder/types";
7
7
  import SectionV2Canvas from "./SectionV2Canvas";
8
8
  import CoverRowResizeHandle from "./CoverRowResizeHandle";
9
9
  import { DEVICE_HEIGHTS } from "../../lib/builder/types";
10
- import { useAssetUrl } from "../../lib/contexts/AssetContext";
10
+ import { adminAssetUrl } from "../../lib/assets";
11
11
 
12
12
  /**
13
13
  * CoverSectionCanvas — renders a CoverSection in the builder canvas.
@@ -51,7 +51,6 @@ export default function CoverSectionCanvas({
51
51
  const store = useBuilderStore();
52
52
  const activeViewport = store.activeViewport || "desktop";
53
53
  const previewMode = store.previewMode;
54
- const assetUrl = useAssetUrl();
55
54
  const [isSectionHovered, setIsSectionHovered] = useState(false);
56
55
 
57
56
  const vhPixels = DEVICE_HEIGHTS[activeViewport];
@@ -59,7 +58,10 @@ export default function CoverSectionCanvas({
59
58
  const containerHeight = Math.round(vhPixels * heightMultiplier);
60
59
 
61
60
  const bgImageUrl = section.background_type === "image" && section.background_image
62
- ? assetUrl(section.background_image)
61
+ ? adminAssetUrl(section.background_image)
62
+ : null;
63
+ const bgVideoUrl = section.background_type === "video" && section.background_video
64
+ ? adminAssetUrl(section.background_video)
63
65
  : null;
64
66
 
65
67
  const effectiveRows = useMemo(
@@ -135,27 +137,37 @@ export default function CoverSectionCanvas({
135
137
  className="relative"
136
138
  style={{ height: containerHeight }}
137
139
  >
138
- {/* Background preview — clipped to container bounds */}
140
+ {/* Background preview — image */}
139
141
  {bgImageUrl && (
140
142
  <div
141
- className="absolute inset-0 pointer-events-none"
143
+ className="absolute inset-0 bg-cover bg-center pointer-events-none"
142
144
  style={{
143
- backgroundImage: `url(${bgImageUrl})`,
145
+ backgroundImage: `url("${bgImageUrl}")`,
144
146
  backgroundSize: section.background_size || "cover",
145
147
  backgroundPosition: section.background_position || "center center",
146
- opacity: 0.15,
147
- overflow: "hidden",
148
+ opacity: 0.12,
148
149
  }}
149
150
  />
150
151
  )}
152
+
153
+ {/* Background preview — video */}
154
+ {bgVideoUrl && (
155
+ <video
156
+ src={bgVideoUrl}
157
+ muted
158
+ playsInline
159
+ autoPlay
160
+ loop
161
+ className="absolute inset-0 w-full h-full object-cover pointer-events-none"
162
+ style={{ opacity: 0.12 }}
163
+ />
164
+ )}
165
+
166
+ {/* Background preview — solid color */}
151
167
  {section.background_type === "color" && section.background_color && (
152
168
  <div
153
169
  className="absolute inset-0 pointer-events-none"
154
- style={{
155
- backgroundColor: section.background_color,
156
- opacity: 0.25,
157
- overflow: "hidden",
158
- }}
170
+ style={{ backgroundColor: section.background_color, opacity: 0.25 }}
159
171
  />
160
172
  )}
161
173
 
@@ -135,7 +135,7 @@ export default function ParallaxGroupCanvas({
135
135
  <div
136
136
  className="absolute inset-0 bg-cover bg-center pointer-events-none"
137
137
  style={{
138
- backgroundImage: `url(${bgImagePath})`,
138
+ backgroundImage: `url("${bgImagePath}")`,
139
139
  backgroundPosition: slide.background_position || "center center",
140
140
  opacity: 0.12,
141
141
  }}
@@ -149,7 +149,7 @@ const ReadOnlyParallaxSlide = memo(function ReadOnlyParallaxSlide({
149
149
  <div
150
150
  className="absolute inset-0 bg-cover bg-center pointer-events-none"
151
151
  style={{
152
- backgroundImage: `url(/api/assets/${slide.background_image})`,
152
+ backgroundImage: `url("/api/assets/${slide.background_image}")`,
153
153
  backgroundPosition: slide.background_position || "center center",
154
154
  opacity: 0.15,
155
155
  }}
@@ -401,17 +401,31 @@ const ReadOnlyCoverSection = memo(function ReadOnlyCoverSection({
401
401
  </span>
402
402
  </div>
403
403
  <div style={{ position: "relative", height: containerHeight, overflow: "hidden" }}>
404
+ {/* Background preview — image */}
404
405
  {section.background_type === "image" && section.background_image && (
405
406
  <div
406
407
  className="absolute inset-0 pointer-events-none"
407
408
  style={{
408
- backgroundImage: `url(/api/assets/${section.background_image})`,
409
+ backgroundImage: `url("/api/assets/${section.background_image}")`,
409
410
  backgroundSize: section.background_size || "cover",
410
411
  backgroundPosition: section.background_position || "center center",
411
412
  opacity: 0.15,
412
413
  }}
413
414
  />
414
415
  )}
416
+ {/* Background preview — video */}
417
+ {section.background_type === "video" && section.background_video && (
418
+ <video
419
+ src={`/api/assets/${section.background_video}`}
420
+ muted
421
+ playsInline
422
+ autoPlay
423
+ loop
424
+ className="absolute inset-0 w-full h-full object-cover pointer-events-none"
425
+ style={{ opacity: 0.15 }}
426
+ />
427
+ )}
428
+ {/* Background preview — color */}
415
429
  {section.background_type === "color" && section.background_color && (
416
430
  <div
417
431
  className="absolute inset-0 pointer-events-none"
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.24";
9
+ export const ANDAMI_VERSION = "0.2.26";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphika/andami",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
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",