@uniweb/core 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/block.js +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
package/src/block.js CHANGED
@@ -432,6 +432,11 @@ export default class Block {
432
432
  // Object with explicit mode — pass through
433
433
  if (raw.mode) return raw
434
434
 
435
+ // Normalize overlay shorthand: number → { enabled: true, type: 'dark', opacity }
436
+ if (typeof raw.overlay === 'number') {
437
+ raw = { ...raw, overlay: { enabled: true, type: 'dark', opacity: raw.overlay } }
438
+ }
439
+
435
440
  // Infer mode from fields
436
441
  if (raw.video || raw.sources) return { mode: 'video', ...raw }
437
442
  if (raw.image || raw.src) {
@@ -440,6 +445,11 @@ export default class Block {
440
445
  const { src, position, size, lazy, ...rest } = raw
441
446
  return { mode: 'image', image: { src, position, size, lazy }, ...rest }
442
447
  }
448
+ // Support string shorthand: { image: "url" } → { image: { src: "url" } }
449
+ if (typeof raw.image === 'string') {
450
+ const { image, ...rest } = raw
451
+ return { mode: 'image', image: { src: image }, ...rest }
452
+ }
443
453
  return { mode: 'image', ...raw }
444
454
  }
445
455
  if (raw.gradient) return { mode: 'gradient', ...raw }