@raketa-builder/support 1.3.5 → 1.3.8
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.
- package/dist/AdminPageRender/AdminWidgetMinimal.js +17 -52
- package/dist/AdminPageRender/IconButton.js +5 -22
- package/dist/AdminPageRender/index.js +15 -41
- package/dist/Container.js +5 -37
- package/dist/EmbeddedVideo.js +10 -11
- package/dist/Image.js +9 -38
- package/dist/WidgetRender/index.js +9 -34
- package/dist/extractImageValue.js +2 -2
- package/dist/imagePlaceholder.js +2 -2
- package/dist/imageSrc.js +2 -2
- package/dist/index.js +11 -68
- package/dist/isImagePresent.js +2 -2
- package/dist/lib/SelectedWidgetsToolbar.js +10 -11
- package/dist/toHTML.js +6 -12
- package/package.json +3 -17
- package/dist/AdminPageRender/AdminWidgetMinimal.mjs +0 -83
- package/dist/AdminPageRender/IconButton.mjs +0 -32
- package/dist/AdminPageRender/index.mjs +0 -92
- package/dist/Container.mjs +0 -13
- package/dist/EmbeddedVideo.mjs +0 -130
- package/dist/Image.mjs +0 -103
- package/dist/WidgetRender/index.mjs +0 -42
- package/dist/extractImageValue.mjs +0 -11
- package/dist/imagePlaceholder.mjs +0 -8
- package/dist/imageSrc.mjs +0 -14
- package/dist/index.mjs +0 -11
- package/dist/isImagePresent.mjs +0 -17
- package/dist/lib/SelectedWidgetsToolbar.mjs +0 -55
- package/dist/toHTML.mjs +0 -21
- /package/dist/{chunk-FWCSY2DS.mjs → chunk-ORMEWXMH.js} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import '../chunk-ORMEWXMH.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const IconCopy = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4
|
+
const IconCopy = () => /* @__PURE__ */ jsxs(
|
|
6
5
|
"svg",
|
|
7
6
|
{
|
|
8
7
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -11,8 +10,8 @@ const IconCopy = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
11
10
|
viewBox: "0 0 16 16",
|
|
12
11
|
fill: "none",
|
|
13
12
|
children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_2312_498)", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
16
15
|
"path",
|
|
17
16
|
{
|
|
18
17
|
d: "M13.3334 5.33331H6.66671C5.93033 5.33331 5.33337 5.93027 5.33337 6.66665V13.3333C5.33337 14.0697 5.93033 14.6666 6.66671 14.6666H13.3334C14.0698 14.6666 14.6667 14.0697 14.6667 13.3333V6.66665C14.6667 5.93027 14.0698 5.33331 13.3334 5.33331Z",
|
|
@@ -22,7 +21,7 @@ const IconCopy = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
22
21
|
strokeLinejoin: "round"
|
|
23
22
|
}
|
|
24
23
|
),
|
|
25
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
26
25
|
"path",
|
|
27
26
|
{
|
|
28
27
|
d: "M2.66671 10.6666C1.93337 10.6666 1.33337 10.0666 1.33337 9.33331V2.66665C1.33337 1.93331 1.93337 1.33331 2.66671 1.33331H9.33337C10.0667 1.33331 10.6667 1.93331 10.6667 2.66665",
|
|
@@ -33,18 +32,18 @@ const IconCopy = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
|
33
32
|
}
|
|
34
33
|
)
|
|
35
34
|
] }),
|
|
36
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_2312_498", children: /* @__PURE__ */ jsx("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
37
36
|
]
|
|
38
37
|
}
|
|
39
38
|
);
|
|
40
|
-
const SelectedWidgetsToolbar = ({ length, onCopy }) => /* @__PURE__ */
|
|
39
|
+
const SelectedWidgetsToolbar = ({ length, onCopy }) => /* @__PURE__ */ jsx("div", { className: "r-selected-widgets-toolbar", children: /* @__PURE__ */ jsx("div", { className: "r-toolbar-inner", children: /* @__PURE__ */ jsxs(
|
|
41
40
|
"button",
|
|
42
41
|
{
|
|
43
42
|
type: "button",
|
|
44
43
|
className: "r-button-reset r-toolbar-button",
|
|
45
44
|
onClick: onCopy,
|
|
46
45
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ jsx(IconCopy, {}),
|
|
48
47
|
"Copy selected (",
|
|
49
48
|
length,
|
|
50
49
|
")"
|
|
@@ -53,4 +52,4 @@ const SelectedWidgetsToolbar = ({ length, onCopy }) => /* @__PURE__ */ jsxRuntim
|
|
|
53
52
|
) }) });
|
|
54
53
|
var SelectedWidgetsToolbar_default = SelectedWidgetsToolbar;
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
export { SelectedWidgetsToolbar_default as default };
|
package/dist/toHTML.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import './chunk-ORMEWXMH.js';
|
|
2
|
+
import MarkdownIt from 'markdown-it';
|
|
3
|
+
import markdownItAttrs from 'markdown-it-attrs';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
var markdownItAttrs = require('markdown-it-attrs');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var MarkdownIt__default = /*#__PURE__*/_interopDefault(MarkdownIt);
|
|
9
|
-
var markdownItAttrs__default = /*#__PURE__*/_interopDefault(markdownItAttrs);
|
|
10
|
-
|
|
11
|
-
const parser = new MarkdownIt__default.default({
|
|
5
|
+
const parser = new MarkdownIt({
|
|
12
6
|
html: true,
|
|
13
7
|
breaks: true
|
|
14
|
-
}).use(
|
|
8
|
+
}).use(markdownItAttrs, {
|
|
15
9
|
// optional, these are default options
|
|
16
10
|
leftDelimiter: "{",
|
|
17
11
|
rightDelimiter: "}",
|
|
@@ -24,4 +18,4 @@ const toHTML = (string, inline = false) => {
|
|
|
24
18
|
};
|
|
25
19
|
var toHTML_default = toHTML;
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
export { toHTML_default as default };
|
package/package.json
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/support",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import":
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"default": "./dist/index.mjs"
|
|
13
|
-
},
|
|
14
|
-
"require": {
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"default": "./dist/index.js"
|
|
17
|
-
}
|
|
10
|
+
"import": "./dist/index.js"
|
|
18
11
|
},
|
|
19
12
|
"./*": {
|
|
20
|
-
"import":
|
|
21
|
-
"types": "./dist/*.d.ts",
|
|
22
|
-
"default": "./dist/*.mjs"
|
|
23
|
-
},
|
|
24
|
-
"require": {
|
|
25
|
-
"types": "./dist/*.d.ts",
|
|
26
|
-
"default": "./dist/*.js"
|
|
27
|
-
}
|
|
13
|
+
"import": "./dist/*.js"
|
|
28
14
|
}
|
|
29
15
|
},
|
|
30
16
|
"files": [
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { __objRest, __spreadValues } from '../chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import IconButton from './IconButton';
|
|
5
|
-
import Container from '../Container';
|
|
6
|
-
|
|
7
|
-
function cn() {
|
|
8
|
-
return Array.from(arguments).filter(Boolean).map(String).join(" ");
|
|
9
|
-
}
|
|
10
|
-
const AdminWidgetWrapper = (_a) => {
|
|
11
|
-
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
12
|
-
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("r-admin-widget-wrapper", className) }, rest));
|
|
13
|
-
};
|
|
14
|
-
const AdminWidgetToolbar = (_c) => {
|
|
15
|
-
var _d = _c, { className } = _d, rest = __objRest(_d, ["className"]);
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
"div",
|
|
18
|
-
__spreadValues({
|
|
19
|
-
className: cn("r-reset", "r-admin-widget-toolbar", className)
|
|
20
|
-
}, rest)
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
const AdminWidgetLabel = (_e) => {
|
|
24
|
-
var _f = _e, { className } = _f, rest = __objRest(_f, ["className"]);
|
|
25
|
-
return /* @__PURE__ */ jsx(
|
|
26
|
-
"div",
|
|
27
|
-
__spreadValues({
|
|
28
|
-
className: cn("r-reset", "r-fs-small", "r-admin-widget-label", className)
|
|
29
|
-
}, rest)
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
const title = (widget) => {
|
|
33
|
-
return widget.Config.title;
|
|
34
|
-
};
|
|
35
|
-
const deprecated = (widget) => {
|
|
36
|
-
return widget.Config.deprecated;
|
|
37
|
-
};
|
|
38
|
-
const AdminWidgetMinimal = ({
|
|
39
|
-
library,
|
|
40
|
-
adminLibrary,
|
|
41
|
-
widget,
|
|
42
|
-
onCopy,
|
|
43
|
-
onSelectWidget,
|
|
44
|
-
selectedWidgets
|
|
45
|
-
}) => {
|
|
46
|
-
var _a;
|
|
47
|
-
const currentWidget = library[widget.component];
|
|
48
|
-
const currentAdminWidget = adminLibrary[widget.component];
|
|
49
|
-
const containerSettings = ((_a = widget == null ? void 0 : widget.settings) == null ? void 0 : _a.containerSettings) || {};
|
|
50
|
-
const isSelected = selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
|
|
51
|
-
if (!currentWidget || !currentAdminWidget) {
|
|
52
|
-
console.error(`Unknown widget: ${widget.component}`);
|
|
53
|
-
return /* @__PURE__ */ jsx(AdminWidgetWrapper, { "data-widget": widget.component, children: /* @__PURE__ */ jsx("div", { className: cn("r-reset", "r-fs-large", "r-admin-missing-widget"), children: `Unknown widget: ${widget.component}` }) });
|
|
54
|
-
}
|
|
55
|
-
const handleCopyWidget = () => {
|
|
56
|
-
const widgetsToCopy = [widget];
|
|
57
|
-
onCopy(widgetsToCopy);
|
|
58
|
-
};
|
|
59
|
-
const handleSelectWidget = () => onSelectWidget(widget.widgetId);
|
|
60
|
-
return /* @__PURE__ */ jsxs(AdminWidgetWrapper, { "data-widget": widget.component, children: [
|
|
61
|
-
isSelected && /* @__PURE__ */ jsx("div", { className: "r-selected-widget" }),
|
|
62
|
-
/* @__PURE__ */ jsxs(AdminWidgetToolbar, { "data-toolbar": true, children: [
|
|
63
|
-
/* @__PURE__ */ jsx(
|
|
64
|
-
"input",
|
|
65
|
-
{
|
|
66
|
-
type: "checkbox",
|
|
67
|
-
style: {
|
|
68
|
-
width: "32px",
|
|
69
|
-
height: "32px"
|
|
70
|
-
},
|
|
71
|
-
onChange: handleSelectWidget,
|
|
72
|
-
checked: isSelected
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
!isSelected && !deprecated(currentAdminWidget) && /* @__PURE__ */ jsx(IconButton, { onClick: handleCopyWidget })
|
|
76
|
-
] }),
|
|
77
|
-
/* @__PURE__ */ jsx(AdminWidgetLabel, { "data-widget-label": true, children: title(currentAdminWidget) }),
|
|
78
|
-
/* @__PURE__ */ jsx(Container, { settings: containerSettings, children: React.createElement(currentWidget, widget.settings) })
|
|
79
|
-
] });
|
|
80
|
-
};
|
|
81
|
-
var AdminWidgetMinimal_default = AdminWidgetMinimal;
|
|
82
|
-
|
|
83
|
-
export { AdminWidgetMinimal_default as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { __spreadValues } from '../chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
const ICON_COPY = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItY29weSI+PHJlY3QgeD0iOSIgeT0iOSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEzIiByeD0iMiIgcnk9IjIiPjwvcmVjdD48cGF0aCBkPSJNNSAxNUg0YTIgMiAwIDAgMS0yLTJWNGEyIDIgMCAwIDEgMi0yaDlhMiAyIDAgMCAxIDIgMnYxIj48L3BhdGg+PC9zdmc+";
|
|
6
|
-
const IconButton = (props) => /* @__PURE__ */ jsx(
|
|
7
|
-
"button",
|
|
8
|
-
__spreadValues({
|
|
9
|
-
type: "button",
|
|
10
|
-
style: {
|
|
11
|
-
display: "inline-block",
|
|
12
|
-
width: "32px",
|
|
13
|
-
height: "32px",
|
|
14
|
-
marginRight: "4px",
|
|
15
|
-
marginLeft: "0px",
|
|
16
|
-
appearance: "none",
|
|
17
|
-
outline: "0",
|
|
18
|
-
border: "0",
|
|
19
|
-
borderRadius: "3px",
|
|
20
|
-
background: "transparent",
|
|
21
|
-
backgroundColor: "#fff",
|
|
22
|
-
backgroundRepeat: "no-repeat",
|
|
23
|
-
backgroundPosition: "center",
|
|
24
|
-
backgroundSize: "50%",
|
|
25
|
-
backgroundImage: `url(${ICON_COPY})`,
|
|
26
|
-
cursor: "pointer"
|
|
27
|
-
}
|
|
28
|
-
}, props)
|
|
29
|
-
);
|
|
30
|
-
var IconButton_default = IconButton;
|
|
31
|
-
|
|
32
|
-
export { IconButton_default as default };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { __spreadProps, __spreadValues } from '../chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import AdminWidgetMinimal from './AdminWidgetMinimal';
|
|
5
|
-
import SelectedWidgetsToolbar from '../lib/SelectedWidgetsToolbar';
|
|
6
|
-
|
|
7
|
-
const saveToLocalStorage = (identifier, widgets) => window.localStorage.setItem(
|
|
8
|
-
`clipboard\u2013${identifier}`,
|
|
9
|
-
JSON.stringify(widgets)
|
|
10
|
-
);
|
|
11
|
-
const AdminPageRender = ({
|
|
12
|
-
page,
|
|
13
|
-
context = {},
|
|
14
|
-
preloaded = {},
|
|
15
|
-
library,
|
|
16
|
-
adminLibrary,
|
|
17
|
-
identifier,
|
|
18
|
-
detailPath,
|
|
19
|
-
canvasClassName = "",
|
|
20
|
-
layoutMessage = ""
|
|
21
|
-
}) => {
|
|
22
|
-
const [selectedWidgets, setSelectedWidgets] = React.useState([]);
|
|
23
|
-
const entity = __spreadProps(__spreadValues({}, page), {
|
|
24
|
-
widgets: page.widgets.map((w) => __spreadProps(__spreadValues({}, w), {
|
|
25
|
-
settings: __spreadProps(__spreadValues({}, w.settings), {
|
|
26
|
-
__ctx: context,
|
|
27
|
-
__data: preloaded[w.widgetId]
|
|
28
|
-
})
|
|
29
|
-
}))
|
|
30
|
-
});
|
|
31
|
-
const areAllSelected = selectedWidgets.length === entity.widgets.length;
|
|
32
|
-
const handleSelectWidget = (newWidget) => {
|
|
33
|
-
setSelectedWidgets((oldList) => {
|
|
34
|
-
const isUnique = oldList.filter((w) => w === newWidget).length <= 0;
|
|
35
|
-
if (isUnique) {
|
|
36
|
-
return [...oldList, newWidget];
|
|
37
|
-
} else {
|
|
38
|
-
return oldList.filter((w) => w !== newWidget);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const handleCopyWidgets = (widgets, copyType) => {
|
|
43
|
-
if (copyType === "multiple") {
|
|
44
|
-
const filterSelected = entity.widgets.filter(
|
|
45
|
-
(w) => widgets.some((c) => w.widgetId === c)
|
|
46
|
-
);
|
|
47
|
-
saveToLocalStorage(identifier, filterSelected);
|
|
48
|
-
setSelectedWidgets([]);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
saveToLocalStorage(identifier, widgets);
|
|
52
|
-
};
|
|
53
|
-
const handleSelectAll = () => {
|
|
54
|
-
if (areAllSelected) return setSelectedWidgets([]);
|
|
55
|
-
setSelectedWidgets(entity.widgets.map((w) => w.widgetId));
|
|
56
|
-
};
|
|
57
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
58
|
-
layoutMessage && /* @__PURE__ */ jsx("div", { className: "r-reset r-fs-base r-layout-message", children: layoutMessage }),
|
|
59
|
-
selectedWidgets.length > 0 && /* @__PURE__ */ jsx(
|
|
60
|
-
SelectedWidgetsToolbar,
|
|
61
|
-
{
|
|
62
|
-
length: selectedWidgets.length,
|
|
63
|
-
onCopy: () => handleCopyWidgets(selectedWidgets, "multiple")
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
entity.widgets.length > 0 && /* @__PURE__ */ jsx(
|
|
67
|
-
"button",
|
|
68
|
-
{
|
|
69
|
-
className: `r-button-reset r-button-select-all ${areAllSelected ? "r-all-selected" : ""}`,
|
|
70
|
-
type: "button",
|
|
71
|
-
title: "Select all (or Deselect all)",
|
|
72
|
-
onClick: () => handleSelectAll()
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ jsx("a", { href: detailPath, className: "r-reset r-details-link", title: "Details" }),
|
|
76
|
-
/* @__PURE__ */ jsx("div", { className: canvasClassName, children: entity.widgets.map(({ widgetId, component, settings }) => /* @__PURE__ */ jsx(
|
|
77
|
-
AdminWidgetMinimal,
|
|
78
|
-
{
|
|
79
|
-
library,
|
|
80
|
-
adminLibrary,
|
|
81
|
-
widget: { widgetId, component, settings },
|
|
82
|
-
onCopy: handleCopyWidgets,
|
|
83
|
-
onSelectWidget: handleSelectWidget,
|
|
84
|
-
selectedWidgets
|
|
85
|
-
},
|
|
86
|
-
widgetId
|
|
87
|
-
)) })
|
|
88
|
-
] });
|
|
89
|
-
};
|
|
90
|
-
var AdminPageRender_default = AdminPageRender;
|
|
91
|
-
|
|
92
|
-
export { AdminPageRender_default as default };
|
package/dist/Container.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { __objRest, __spreadProps, __spreadValues } from './chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
const Container = (_a) => {
|
|
6
|
-
var _b = _a, { settings, className, children } = _b, rest = __objRest(_b, ["settings", "className", "children"]);
|
|
7
|
-
const _a2 = settings || {}, { containerID } = _a2, restSettings = __objRest(_a2, ["containerID"]);
|
|
8
|
-
const cssClasses = [...Object.values(restSettings), className].join(" ");
|
|
9
|
-
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ id: containerID, className: cssClasses }, rest), { children }));
|
|
10
|
-
};
|
|
11
|
-
var Container_default = Container;
|
|
12
|
-
|
|
13
|
-
export { Container_default as default };
|
package/dist/EmbeddedVideo.mjs
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import './chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
const VimeoEmbed = ({ videoId: videoId2, autoplay }) => /* @__PURE__ */ jsx(
|
|
6
|
-
"iframe",
|
|
7
|
-
{
|
|
8
|
-
frameBorder: "0",
|
|
9
|
-
allowFullScreen: "0",
|
|
10
|
-
src: `https://player.vimeo.com/video/${videoId2}?color=ffffff&title=0&byline=0&portrait=0&autoplay=${autoplay === true ? "1" : "0"}`,
|
|
11
|
-
className: "content",
|
|
12
|
-
allow: "autoplay"
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
const YoukuEmbed = ({ videoId: videoId2, autoplay }) => /* @__PURE__ */ jsx(
|
|
16
|
-
"iframe",
|
|
17
|
-
{
|
|
18
|
-
height: "0",
|
|
19
|
-
width: "0",
|
|
20
|
-
src: `https://player.youku.com/embed/${videoId2}?autoplay=${autoplay === true ? "1" : "0"}`,
|
|
21
|
-
frameBorder: "0",
|
|
22
|
-
allowFullScreen: true,
|
|
23
|
-
className: "content",
|
|
24
|
-
allow: "autoplay"
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
const YouTubeEmbed = ({ videoId: videoId2, autoplay }) => /* @__PURE__ */ jsx(
|
|
28
|
-
"iframe",
|
|
29
|
-
{
|
|
30
|
-
frameBorder: "0",
|
|
31
|
-
allowFullScreen: true,
|
|
32
|
-
src: `https://youtube.com/embed/${videoId2}?autoplay=${autoplay === true ? "1" : "0"}`,
|
|
33
|
-
className: "content",
|
|
34
|
-
allow: "autoplay"
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
const YouTubeNoCookieEmbed = ({ videoId: videoId2, autoplay }) => /* @__PURE__ */ jsx(
|
|
38
|
-
"iframe",
|
|
39
|
-
{
|
|
40
|
-
frameBorder: "0",
|
|
41
|
-
allowFullScreen: true,
|
|
42
|
-
src: `https://www.youtube-nocookie.com/embed/${videoId2}?autoplay=${autoplay === true ? "1" : "0"}`,
|
|
43
|
-
className: "content",
|
|
44
|
-
allow: "autoplay"
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
const WistiaEmbed = ({ videoId: videoId2, autoplay }) => /* @__PURE__ */ jsx(
|
|
48
|
-
"iframe",
|
|
49
|
-
{
|
|
50
|
-
frameBorder: "0",
|
|
51
|
-
allowFullScreen: true,
|
|
52
|
-
src: `https://fast.wistia.net/embed/iframe/${videoId2}${autoplay ? "?autoPlay=true" : ""}`,
|
|
53
|
-
className: "content",
|
|
54
|
-
allow: "autoplay"
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
const videoType = (url) => {
|
|
58
|
-
if (url.includes("youtu")) return "youtube";
|
|
59
|
-
if (url.includes("vimeo")) return "vimeo";
|
|
60
|
-
if (url.includes("youku")) return "youku";
|
|
61
|
-
if (url.includes("wistia")) return "wistia";
|
|
62
|
-
};
|
|
63
|
-
const youtubeId = (url) => {
|
|
64
|
-
var _a;
|
|
65
|
-
let matches = url.match(
|
|
66
|
-
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
|
|
67
|
-
);
|
|
68
|
-
if (matches && matches[5]) {
|
|
69
|
-
return matches[5];
|
|
70
|
-
}
|
|
71
|
-
matches = url.match(new RegExp("youtu\\.be\\/|youtube\\.com\\/shorts\\/(?<id>.*)(\\?.*)?"));
|
|
72
|
-
return ((_a = matches == null ? void 0 : matches.groups) == null ? void 0 : _a.id) || "";
|
|
73
|
-
};
|
|
74
|
-
const vimeoId = (url) => {
|
|
75
|
-
const matches = url.match(/http(s?):\/\/(www\.)?vimeo\.com\/(\d+)($|\/)/);
|
|
76
|
-
return matches !== "" && matches !== null ? matches[3] : "";
|
|
77
|
-
};
|
|
78
|
-
const youkuId = (url) => {
|
|
79
|
-
const matches = url.match(
|
|
80
|
-
/http(s?):\/\/v\.youku\.com\/v_show\/id_([A-Za-z0-9=]+)\.html/
|
|
81
|
-
);
|
|
82
|
-
return matches !== "" && matches !== null ? matches[2] : "";
|
|
83
|
-
};
|
|
84
|
-
const wistiaId = (url) => {
|
|
85
|
-
const matches = url.match(
|
|
86
|
-
/http(s?):\/\/fast\.wistia\.net\/embed\/iframe\/(.*)($|\?)/
|
|
87
|
-
);
|
|
88
|
-
return matches !== "" && matches !== null ? matches[2] : "";
|
|
89
|
-
};
|
|
90
|
-
const videoId = (url) => {
|
|
91
|
-
if (videoType(url) === "youtube") return youtubeId(url);
|
|
92
|
-
if (videoType(url) === "vimeo") return vimeoId(url);
|
|
93
|
-
if (videoType(url) === "youku") return youkuId(url);
|
|
94
|
-
if (videoType(url) === "wistia") return wistiaId(url);
|
|
95
|
-
};
|
|
96
|
-
const VideoComponentType = (vType, noCookieDomains) => {
|
|
97
|
-
const components = {
|
|
98
|
-
youtube: YouTubeEmbed,
|
|
99
|
-
vimeo: VimeoEmbed,
|
|
100
|
-
youku: YoukuEmbed,
|
|
101
|
-
wistia: WistiaEmbed
|
|
102
|
-
};
|
|
103
|
-
const noCookiesComponents = {
|
|
104
|
-
youtube: YouTubeNoCookieEmbed,
|
|
105
|
-
vimeo: VimeoEmbed,
|
|
106
|
-
youku: YoukuEmbed,
|
|
107
|
-
wistia: WistiaEmbed
|
|
108
|
-
};
|
|
109
|
-
if (noCookieDomains) {
|
|
110
|
-
return noCookiesComponents[vType];
|
|
111
|
-
} else {
|
|
112
|
-
return components[vType];
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
const EmbeddedVideo = ({
|
|
116
|
-
videoUrl,
|
|
117
|
-
autoplay = false,
|
|
118
|
-
noCookieDomains = false
|
|
119
|
-
}) => {
|
|
120
|
-
const vType = videoType(videoUrl);
|
|
121
|
-
const vId = videoId(videoUrl);
|
|
122
|
-
const VideoComponent = VideoComponentType(vType, noCookieDomains);
|
|
123
|
-
if (VideoComponent) {
|
|
124
|
-
return /* @__PURE__ */ jsx(VideoComponent, { videoId: vId, autoplay });
|
|
125
|
-
}
|
|
126
|
-
return null;
|
|
127
|
-
};
|
|
128
|
-
var EmbeddedVideo_default = EmbeddedVideo;
|
|
129
|
-
|
|
130
|
-
export { EmbeddedVideo_default as default };
|
package/dist/Image.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { __objRest, __spreadValues } from './chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
const getWebp = (url) => {
|
|
6
|
-
if (!url) return null;
|
|
7
|
-
const segments = url.split(".");
|
|
8
|
-
segments[segments.length - 1] = "webp";
|
|
9
|
-
return segments.join(".");
|
|
10
|
-
};
|
|
11
|
-
const getAvif = (url) => {
|
|
12
|
-
if (!url) return null;
|
|
13
|
-
const segments = url.split(".");
|
|
14
|
-
segments[segments.length - 1] = "avif";
|
|
15
|
-
return segments.join(".");
|
|
16
|
-
};
|
|
17
|
-
const getDimensions = (src, variant) => {
|
|
18
|
-
var _a, _b, _c;
|
|
19
|
-
if (typeof src === "object" && ((_a = src == null ? void 0 : src.name) == null ? void 0 : _a.includes(".svg"))) {
|
|
20
|
-
const width = src.width || null;
|
|
21
|
-
const height = src.height || null;
|
|
22
|
-
return [width, height];
|
|
23
|
-
}
|
|
24
|
-
if (typeof src === "object") {
|
|
25
|
-
const width = ((_b = src.sizes[variant]) == null ? void 0 : _b.width) || null;
|
|
26
|
-
const height = ((_c = src.sizes[variant]) == null ? void 0 : _c.height) || null;
|
|
27
|
-
return [width, height];
|
|
28
|
-
}
|
|
29
|
-
return [null, null];
|
|
30
|
-
};
|
|
31
|
-
const getAlt = (src) => {
|
|
32
|
-
const type = typeof src;
|
|
33
|
-
if (type === "object" && src.alt) {
|
|
34
|
-
return src.alt;
|
|
35
|
-
}
|
|
36
|
-
if (type === "object") {
|
|
37
|
-
const imageObj = src.image || src;
|
|
38
|
-
const altSetting = ((imageObj == null ? void 0 : imageObj.settings) || []).find(
|
|
39
|
-
(setting) => setting.key === "alt"
|
|
40
|
-
);
|
|
41
|
-
if (altSetting) {
|
|
42
|
-
return altSetting.value;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return "";
|
|
46
|
-
};
|
|
47
|
-
const getSrc = (src, variant) => {
|
|
48
|
-
var _a, _b, _c;
|
|
49
|
-
if (typeof src === "object") {
|
|
50
|
-
if (((_a = src == null ? void 0 : src.name) == null ? void 0 : _a.includes(".svg")) || ((_b = src == null ? void 0 : src.name) == null ? void 0 : _b.includes(".gif"))) {
|
|
51
|
-
return [null, null, (_c = src.urls) == null ? void 0 : _c.original];
|
|
52
|
-
}
|
|
53
|
-
const fallback = src.urls[variant];
|
|
54
|
-
const webp = getWebp(fallback);
|
|
55
|
-
const avif = getAvif(fallback);
|
|
56
|
-
return [webp, avif, fallback];
|
|
57
|
-
}
|
|
58
|
-
return [null, null, src];
|
|
59
|
-
};
|
|
60
|
-
const getImageObjOrSrc = (value) => {
|
|
61
|
-
const type = typeof value;
|
|
62
|
-
if (type === "object" && value.hasOwnProperty("image")) {
|
|
63
|
-
return value.image;
|
|
64
|
-
}
|
|
65
|
-
return value;
|
|
66
|
-
};
|
|
67
|
-
const Image = (_a) => {
|
|
68
|
-
var _b = _a, { variant, src, alt, loading = "lazy" } = _b, props = __objRest(_b, ["variant", "src", "alt", "loading"]);
|
|
69
|
-
if (!variant) {
|
|
70
|
-
console.error("Image with no variant", { variant, src, alt, props });
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
if (!src) {
|
|
74
|
-
console.error("Image with no src", { variant, src, alt, props });
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
const imageObjOrSrc = getImageObjOrSrc(src);
|
|
78
|
-
if (imageObjOrSrc && typeof imageObjOrSrc === "object" && !imageObjOrSrc.sizes) {
|
|
79
|
-
console.error("Image with no sizes", { variant, src, alt, props });
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const [width, height] = getDimensions(imageObjOrSrc, variant);
|
|
83
|
-
const altAttr = alt || getAlt(src);
|
|
84
|
-
const [webp, avif, fallback] = getSrc(imageObjOrSrc, variant);
|
|
85
|
-
return /* @__PURE__ */ jsxs("picture", { children: [
|
|
86
|
-
avif && /* @__PURE__ */ jsx("source", { srcSet: encodeURI(avif), type: "image/avif" }),
|
|
87
|
-
webp && /* @__PURE__ */ jsx("source", { srcSet: encodeURI(webp), type: "image/webp" }),
|
|
88
|
-
/* @__PURE__ */ jsx("source", { srcSet: encodeURI(fallback), type: src.mime_type }),
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
"img",
|
|
91
|
-
__spreadValues({
|
|
92
|
-
src: fallback,
|
|
93
|
-
alt: altAttr,
|
|
94
|
-
width,
|
|
95
|
-
height,
|
|
96
|
-
loading
|
|
97
|
-
}, props)
|
|
98
|
-
)
|
|
99
|
-
] });
|
|
100
|
-
};
|
|
101
|
-
var Image_default = Image;
|
|
102
|
-
|
|
103
|
-
export { Image_default as default };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { __spreadProps, __spreadValues } from '../chunk-FWCSY2DS.mjs';
|
|
2
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Container from '../Container';
|
|
5
|
-
|
|
6
|
-
const WidgetRender = ({
|
|
7
|
-
library,
|
|
8
|
-
entity,
|
|
9
|
-
page,
|
|
10
|
-
context = {},
|
|
11
|
-
preloaded = {},
|
|
12
|
-
locale = "es"
|
|
13
|
-
}) => {
|
|
14
|
-
var _a;
|
|
15
|
-
const pageData = page || entity;
|
|
16
|
-
context = __spreadProps(__spreadValues({}, context), {
|
|
17
|
-
locale: (_a = context.locale) != null ? _a : locale
|
|
18
|
-
});
|
|
19
|
-
return /* @__PURE__ */ jsx(Fragment, { children: pageData.widgets.map(({ widgetId, component, settings }) => {
|
|
20
|
-
if (!library[component]) {
|
|
21
|
-
console.error(
|
|
22
|
-
`Unknown widget: {widgetId: ${widgetId}, component: ${component}, settings: ${settings}}`
|
|
23
|
-
);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
Container,
|
|
28
|
-
{
|
|
29
|
-
settings: (settings == null ? void 0 : settings.containerSettings) || {},
|
|
30
|
-
"data-widget": component,
|
|
31
|
-
children: React.createElement(library[component], __spreadProps(__spreadValues({}, settings), {
|
|
32
|
-
__ctx: context,
|
|
33
|
-
__data: (preloaded == null ? void 0 : preloaded[widgetId]) || {}
|
|
34
|
-
}))
|
|
35
|
-
},
|
|
36
|
-
widgetId
|
|
37
|
-
);
|
|
38
|
-
}) });
|
|
39
|
-
};
|
|
40
|
-
var WidgetRender_default = WidgetRender;
|
|
41
|
-
|
|
42
|
-
export { WidgetRender_default as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import './chunk-FWCSY2DS.mjs';
|
|
2
|
-
|
|
3
|
-
function extractImageValue(value) {
|
|
4
|
-
if (!value) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
return value.hasOwnProperty("image") ? value.image : value;
|
|
8
|
-
}
|
|
9
|
-
var extractImageValue_default = extractImageValue;
|
|
10
|
-
|
|
11
|
-
export { extractImageValue_default as default };
|
package/dist/imageSrc.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import './chunk-FWCSY2DS.mjs';
|
|
2
|
-
|
|
3
|
-
const imageSrc = (src, variant) => {
|
|
4
|
-
if (typeof src === "object" && !("name" in src))
|
|
5
|
-
console.warn(`WARNING: Image with empty {}: ${variant}`);
|
|
6
|
-
if (typeof src === "object" && "name" in src && (src.name.includes(".svg") || src.name.includes(".gif")))
|
|
7
|
-
return src.urls.original;
|
|
8
|
-
if (typeof src === "object" && "name" in src) return src.urls[variant];
|
|
9
|
-
if (typeof src === "string") return src;
|
|
10
|
-
return null;
|
|
11
|
-
};
|
|
12
|
-
var imageSrc_default = imageSrc;
|
|
13
|
-
|
|
14
|
-
export { imageSrc_default as default };
|
package/dist/index.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import './chunk-FWCSY2DS.mjs';
|
|
2
|
-
export { default as Image } from './Image';
|
|
3
|
-
export { default as imageSrc } from './imageSrc';
|
|
4
|
-
export { default as imagePlaceholder } from './imagePlaceholder';
|
|
5
|
-
export { default as Container } from './Container';
|
|
6
|
-
export { default as EmbeddedVideo } from './EmbeddedVideo';
|
|
7
|
-
export { default as toHTML } from './toHTML';
|
|
8
|
-
export { default as isImagePresent } from './isImagePresent';
|
|
9
|
-
export { default as AdminPageRender } from './AdminPageRender';
|
|
10
|
-
export { default as WidgetRender } from './WidgetRender';
|
|
11
|
-
export { default as extractImageValue } from './extractImageValue';
|