@raketa-builder/support 0.11.0 → 0.13.0

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @raketa-builder/support@0.11.0 build
2
+ > @raketa-builder/support@0.13.0 build
3
3
  > tsup src/index.js --format cjs --loader ".js=jsx"
4
4
 
5
5
  CLI Building entry: src/index.js
@@ -7,5 +7,5 @@ CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v6.5.0
8
8
  CLI Target: es6
9
9
  CJS Build start
10
- CJS dist/index.js 21.07 KB
11
- CJS ⚡️ Build success in 39ms
10
+ CJS dist/index.js 21.44 KB
11
+ CJS ⚡️ Build success in 48ms
package/dist/index.js CHANGED
@@ -75,15 +75,15 @@ var getWebp = (url) => {
75
75
  return segments.join(".");
76
76
  };
77
77
  var getDimensions = (src, variant) => {
78
- var _a, _b, _c;
78
+ var _a, _b, _c, _d, _e;
79
79
  if (typeof src === "object" && ((_a = src == null ? void 0 : src.name) == null ? void 0 : _a.includes(".svg"))) {
80
- const width = src.width;
81
- const height = src.height;
80
+ const width = ((_b = src.sizes[variant]) == null ? void 0 : _b.width) || src.width || null;
81
+ const height = ((_c = src.sizes[variant]) == null ? void 0 : _c.height) || src.height || null;
82
82
  return [width, height];
83
83
  }
84
84
  if (typeof src === "object") {
85
- const width = ((_b = src.sizes[variant]) == null ? void 0 : _b.width) || null;
86
- const height = ((_c = src.sizes[variant]) == null ? void 0 : _c.height) || null;
85
+ const width = ((_d = src.sizes[variant]) == null ? void 0 : _d.width) || null;
86
+ const height = ((_e = src.sizes[variant]) == null ? void 0 : _e.height) || null;
87
87
  return [width, height];
88
88
  }
89
89
  return [null, null];
@@ -437,8 +437,10 @@ var AdminWidgetMinimal = ({
437
437
  onSelectWidget,
438
438
  selectedWidgets
439
439
  }) => {
440
+ var _a;
440
441
  const currentWidget = library[widget.component];
441
442
  const currentAdminWidget = adminLibrary[widget.component];
443
+ const containerSettings = ((_a = widget == null ? void 0 : widget.settings) == null ? void 0 : _a.containerSettings) || {};
442
444
  const isSelected = selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
443
445
  if (!currentWidget || !currentAdminWidget) {
444
446
  console.error(`Unknown widget: ${widget.component}`);
@@ -467,7 +469,7 @@ var AdminWidgetMinimal = ({
467
469
  !isSelected && !deprecated(currentAdminWidget) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton_default, { onClick: handleCopyWidget })
468
470
  ] }),
469
471
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AdminWidgetLabel, { "data-widget-label": true, children: title(currentAdminWidget) }),
470
- import_react5.default.createElement(currentWidget, widget.settings)
472
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container_default, { settings: containerSettings, children: import_react5.default.createElement(currentWidget, widget.settings) })
471
473
  ] });
472
474
  };
473
475
  AdminWidgetMinimal.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/support",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-undef */
2
2
  import React from "react";
3
3
  import IconButton from "./IconButton";
4
+ import Container from "../Container";
4
5
 
5
6
  function cn() {
6
7
  return Array.from(arguments).filter(Boolean).map(String).join(" ");
@@ -42,6 +43,7 @@ const AdminWidgetMinimal = ({
42
43
  }) => {
43
44
  const currentWidget = library[widget.component];
44
45
  const currentAdminWidget = adminLibrary[widget.component];
46
+ const containerSettings = widget?.settings?.containerSettings || {};
45
47
 
46
48
  const isSelected =
47
49
  selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
@@ -82,7 +84,9 @@ const AdminWidgetMinimal = ({
82
84
  {title(currentAdminWidget)}
83
85
  </AdminWidgetLabel>
84
86
 
85
- {React.createElement(currentWidget, widget.settings)}
87
+ <Container settings={containerSettings}>
88
+ {React.createElement(currentWidget, widget.settings)}
89
+ </Container>
86
90
  </AdminWidgetWrapper>
87
91
  );
88
92
  };
package/src/Image.js CHANGED
@@ -11,8 +11,8 @@ const getWebp = (url) => {
11
11
 
12
12
  const getDimensions = (src, variant) => {
13
13
  if (typeof src === "object" && src?.name?.includes(".svg")) {
14
- const width = src.width;
15
- const height = src.height;
14
+ const width = src.sizes[variant]?.width || src.width || null;
15
+ const height = src.sizes[variant]?.height || src.height || null;
16
16
 
17
17
  return [width, height];
18
18
  }
@@ -38,7 +38,7 @@ const getAlt = (src) => {
38
38
  const imageObj = src.image || src;
39
39
 
40
40
  const altSetting = (imageObj?.settings || []).find(
41
- (setting) => setting.key === "alt",
41
+ (setting) => setting.key === "alt"
42
42
  );
43
43
 
44
44
  if (altSetting) {