@raketa-builder/builder 0.23.0 → 0.25.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.
- package/.turbo/turbo-build.log +6 -3
- package/.turbo/turbo-format.log +50 -0
- package/.turbo/turbo-lint.log +0 -13
- package/biome.json +3 -0
- package/dist/index.js +559 -451
- package/package.json +6 -5
- package/src/Canvas.js +1 -1
- package/src/List.js +1 -1
- package/src/MediaManager.js +1 -1
- package/src/PageBuilder.js +2 -2
- package/src/dialogs/ReorderDialog.js +1 -1
- package/src/dialogs/SettingsDialog.js +4 -4
- package/src/index.js +0 -6
- package/src/lib/AdminSidebar.js +1 -1
- package/src/lib/Image.js +1 -1
- package/src/lib/LanguageSwitcher.js +3 -3
- package/src/lib/SideNav.js +4 -4
- package/src/lib/SidebarItem.js +1 -1
- package/src/lists/index.js +2 -2
- package/src/styles.css +1 -1
- package/tsconfig.json +1 -1
- package/src/Container.js +0 -15
- package/src/EmbeddedVideo.js +0 -150
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"lint": "TIMING=1 eslint \"**/*.js\"",
|
|
9
8
|
"build": "tsup src/index.js --format cjs --loader \".js=jsx\"",
|
|
10
|
-
"dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch"
|
|
9
|
+
"dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch",
|
|
10
|
+
"format": "prettier --write .",
|
|
11
|
+
"lint": "biome lint --max-diagnostics=5000 ."
|
|
11
12
|
},
|
|
12
13
|
"peerDependencies": {
|
|
13
14
|
"react": "18.2.0",
|
|
@@ -18,10 +19,10 @@
|
|
|
18
19
|
"ui": "*"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
22
|
+
"@biomejs/biome": "1.5.2",
|
|
21
23
|
"@types/react": "17.0.37",
|
|
22
24
|
"@types/react-dom": "17.0.11",
|
|
23
|
-
"
|
|
24
|
-
"eslint-config-custom": "*",
|
|
25
|
+
"prettier": "3.2.4",
|
|
25
26
|
"react": "18.2.0",
|
|
26
27
|
"tsconfig": "*",
|
|
27
28
|
"tsup": "6.5.0",
|
package/src/Canvas.js
CHANGED
package/src/List.js
CHANGED
package/src/MediaManager.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default class MediaManager {
|
|
2
2
|
constructor() {
|
|
3
3
|
console.warn(
|
|
4
|
-
"MediaManager is no longer part of @raketa-builder/builder. Please use @raketa-builder/image-input. "
|
|
4
|
+
"MediaManager is no longer part of @raketa-builder/builder. Please use @raketa-builder/image-input. ",
|
|
5
5
|
);
|
|
6
6
|
}
|
|
7
7
|
|
package/src/PageBuilder.js
CHANGED
|
@@ -81,7 +81,7 @@ const PageBuilder = ({
|
|
|
81
81
|
"settings",
|
|
82
82
|
widget.settings,
|
|
83
83
|
widget.widgetId,
|
|
84
|
-
"widgetId"
|
|
84
|
+
"widgetId",
|
|
85
85
|
);
|
|
86
86
|
const newPage = {
|
|
87
87
|
...page,
|
|
@@ -132,7 +132,7 @@ const PageBuilder = ({
|
|
|
132
132
|
|
|
133
133
|
const handlePasteWidget = () => {
|
|
134
134
|
const clipboardWidget = JSON.parse(
|
|
135
|
-
window.localStorage.getItem(`clipboard–${identifier}`)
|
|
135
|
+
window.localStorage.getItem(`clipboard–${identifier}`),
|
|
136
136
|
);
|
|
137
137
|
|
|
138
138
|
if (!clipboardWidget) return alert("Nothing to paste, yet");
|
|
@@ -32,7 +32,7 @@ const getWidgetTitle = (library, widget) => {
|
|
|
32
32
|
|
|
33
33
|
if (primaryField && typeof primaryField !== "string") {
|
|
34
34
|
throw new Error(
|
|
35
|
-
`The primaryField value of '${widget.component}' must be either a string or not present
|
|
35
|
+
`The primaryField value of '${widget.component}' must be either a string or not present!`,
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -119,7 +119,7 @@ const renderAdmin = (schema = {}, settings = {}, onChange) =>
|
|
|
119
119
|
Object.keys(schema).map((field) => {
|
|
120
120
|
const opts = Object.assign(
|
|
121
121
|
{ label: capitalize(humanize(field)) },
|
|
122
|
-
schema[field]
|
|
122
|
+
schema[field],
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
return renderField(field, settings[field], onChange, opts);
|
|
@@ -147,8 +147,8 @@ const SettingsDialog = ({ widget, settings, onSave, onClose }) => {
|
|
|
147
147
|
if (typeof schema !== "object") {
|
|
148
148
|
console.warn(
|
|
149
149
|
`Legacy widget with React admin definition: ${widgetData.title(
|
|
150
|
-
widget
|
|
151
|
-
)}. Update to custom inputs.
|
|
150
|
+
widget,
|
|
151
|
+
)}. Update to custom inputs. `,
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -158,7 +158,7 @@ const SettingsDialog = ({ widget, settings, onSave, onClose }) => {
|
|
|
158
158
|
const containerAdminFields = renderAdmin(
|
|
159
159
|
containerAdmin,
|
|
160
160
|
containerSettings,
|
|
161
|
-
handleChangeContainer
|
|
161
|
+
handleChangeContainer,
|
|
162
162
|
);
|
|
163
163
|
|
|
164
164
|
return (
|
package/src/index.js
CHANGED
|
@@ -10,11 +10,8 @@ import ImageInput from "./pickers/ImagePicker/ImageInput";
|
|
|
10
10
|
import Dialog from "./dialogs/Dialog";
|
|
11
11
|
import Img from "./lib/Image";
|
|
12
12
|
import List from "./List";
|
|
13
|
-
import Container from "./Container";
|
|
14
|
-
import EmbeddedVideo from "./EmbeddedVideo";
|
|
15
13
|
import MediaManager from "./MediaManager";
|
|
16
14
|
import ListInput from "./ListInput";
|
|
17
|
-
import imageSrc from "./helpers/imageSrc";
|
|
18
15
|
import Button from "./forms/Button";
|
|
19
16
|
import ButtonSettings from "./forms/ButtonSettings";
|
|
20
17
|
import LinkSettings from "./forms/LinkSettings";
|
|
@@ -40,13 +37,10 @@ export {
|
|
|
40
37
|
Dialog,
|
|
41
38
|
Img,
|
|
42
39
|
List,
|
|
43
|
-
Container,
|
|
44
|
-
EmbeddedVideo,
|
|
45
40
|
MediaManager,
|
|
46
41
|
ImagePicker,
|
|
47
42
|
ImageInput,
|
|
48
43
|
ListInput,
|
|
49
|
-
imageSrc,
|
|
50
44
|
Button,
|
|
51
45
|
ButtonSettings,
|
|
52
46
|
LinkSettings,
|
package/src/lib/AdminSidebar.js
CHANGED
|
@@ -82,7 +82,7 @@ const WidgetsList = ({ library, onAddWidget }) => {
|
|
|
82
82
|
{widgets
|
|
83
83
|
.filter(
|
|
84
84
|
(widgetName) =>
|
|
85
|
-
widgetData.category(library[widgetName]) === categoryName
|
|
85
|
+
widgetData.category(library[widgetName]) === categoryName,
|
|
86
86
|
)
|
|
87
87
|
.map((widgetName) => ({
|
|
88
88
|
widgetName,
|
package/src/lib/Image.js
CHANGED
|
@@ -20,7 +20,7 @@ const LanguageSwitcherItem = ({ className, ...props }) => (
|
|
|
20
20
|
className={cn(
|
|
21
21
|
"r-reset",
|
|
22
22
|
"r-fs-medium r-admin-language-switcher-item",
|
|
23
|
-
className
|
|
23
|
+
className,
|
|
24
24
|
)}
|
|
25
25
|
{...props}
|
|
26
26
|
/>
|
|
@@ -31,7 +31,7 @@ const LanguageSwitcherNewItem = ({ className, ...props }) => (
|
|
|
31
31
|
className={cn(
|
|
32
32
|
"r-reset",
|
|
33
33
|
"r-fs-medium r-admin-language-switcher-new-item",
|
|
34
|
-
className
|
|
34
|
+
className,
|
|
35
35
|
)}
|
|
36
36
|
{...props}
|
|
37
37
|
/>
|
|
@@ -42,7 +42,7 @@ const LanguageSwitcherCurrent = ({ className, ...props }) => (
|
|
|
42
42
|
className={cn(
|
|
43
43
|
"r-reset",
|
|
44
44
|
"r-fs-medium r-admin-language-switcher-current",
|
|
45
|
-
className
|
|
45
|
+
className,
|
|
46
46
|
)}
|
|
47
47
|
{...props}
|
|
48
48
|
/>
|
package/src/lib/SideNav.js
CHANGED
|
@@ -23,8 +23,8 @@ const NavButtonStyle = ({ className, icon, active, success, ...props }) => {
|
|
|
23
23
|
const backgroundColor = active
|
|
24
24
|
? "var(--r-darker-gray)"
|
|
25
25
|
: success
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
? "var(--r-success)"
|
|
27
|
+
: "transparent";
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<div
|
|
@@ -33,7 +33,7 @@ const NavButtonStyle = ({ className, icon, active, success, ...props }) => {
|
|
|
33
33
|
"r-reset-button",
|
|
34
34
|
"r-fs-medium",
|
|
35
35
|
"r-admin-sidenav-button",
|
|
36
|
-
className
|
|
36
|
+
className,
|
|
37
37
|
)}
|
|
38
38
|
style={{
|
|
39
39
|
backgroundColor: backgroundColor,
|
|
@@ -78,7 +78,7 @@ export const SideNavSearchWrapper = ({ className, ...props }) => (
|
|
|
78
78
|
"r-reset",
|
|
79
79
|
"r-fs-medium",
|
|
80
80
|
"r-admin-sidenav-search-wrapper",
|
|
81
|
-
className
|
|
81
|
+
className,
|
|
82
82
|
)}
|
|
83
83
|
{...props}
|
|
84
84
|
/>
|
package/src/lib/SidebarItem.js
CHANGED
package/src/lists/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const removeByIndex = (items, idx) => [
|
|
|
8
8
|
const removeById = (items, id, idField = "id") =>
|
|
9
9
|
removeByIndex(
|
|
10
10
|
items,
|
|
11
|
-
items.findIndex((current) => current[idField] === id)
|
|
11
|
+
items.findIndex((current) => current[idField] === id),
|
|
12
12
|
);
|
|
13
13
|
const updateFieldByIndex = (items, field, value, idx) => [
|
|
14
14
|
...items.slice(0, idx),
|
|
@@ -20,7 +20,7 @@ const updateFieldById = (items, field, value, id, idField = "id") =>
|
|
|
20
20
|
items,
|
|
21
21
|
field,
|
|
22
22
|
value,
|
|
23
|
-
items.findIndex((current) => current[idField] === id)
|
|
23
|
+
items.findIndex((current) => current[idField] === id),
|
|
24
24
|
);
|
|
25
25
|
const reorder = (items, order) => order.map((idx) => items[idx]);
|
|
26
26
|
|
package/src/styles.css
CHANGED
package/tsconfig.json
CHANGED
package/src/Container.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const Container = ({ settings, className, children }) => {
|
|
4
|
-
const { containerID, ...restSettings } = settings || {};
|
|
5
|
-
|
|
6
|
-
const cssClasses = [...Object.values(restSettings), className].join(" ");
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<div id={containerID} className={cssClasses}>
|
|
10
|
-
{children}
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default Container;
|
package/src/EmbeddedVideo.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const VimeoEmbed = ({ videoId, autoplay }) => (
|
|
4
|
-
<iframe
|
|
5
|
-
frameBorder="0"
|
|
6
|
-
allowFullScreen="0"
|
|
7
|
-
src={`https://player.vimeo.com/video/${videoId}?color=ffffff&title=0&byline=0&portrait=0&autoplay=${
|
|
8
|
-
autoplay === true ? "1" : "0"
|
|
9
|
-
}`}
|
|
10
|
-
className="content"
|
|
11
|
-
allow="autoplay"
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const YoukuEmbed = ({ videoId, autoplay }) => (
|
|
16
|
-
<iframe
|
|
17
|
-
height="0"
|
|
18
|
-
width="0"
|
|
19
|
-
src={`https://player.youku.com/embed/${videoId}?autoplay=${
|
|
20
|
-
autoplay === true ? "1" : "0"
|
|
21
|
-
}`}
|
|
22
|
-
frameBorder="0"
|
|
23
|
-
allowFullScreen
|
|
24
|
-
className="content"
|
|
25
|
-
allow="autoplay"
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const YouTubeEmbed = ({ videoId, autoplay }) => (
|
|
30
|
-
<iframe
|
|
31
|
-
frameBorder="0"
|
|
32
|
-
allowFullScreen
|
|
33
|
-
src={`https://youtube.com/embed/${videoId}?autoplay=${
|
|
34
|
-
autoplay === true ? "1" : "0"
|
|
35
|
-
}`}
|
|
36
|
-
className="content"
|
|
37
|
-
allow="autoplay"
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const YouTubeNoCookieEmbed = ({ videoId, autoplay }) => (
|
|
42
|
-
<iframe
|
|
43
|
-
frameBorder="0"
|
|
44
|
-
allowFullScreen
|
|
45
|
-
src={`https://www.youtube-nocookie.com/embed/${videoId}?autoplay=${
|
|
46
|
-
autoplay === true ? "1" : "0"
|
|
47
|
-
}`}
|
|
48
|
-
className="content"
|
|
49
|
-
allow="autoplay"
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const WistiaEmbed = ({ videoId, autoplay }) => (
|
|
54
|
-
<iframe
|
|
55
|
-
frameBorder="0"
|
|
56
|
-
allowFullScreen
|
|
57
|
-
src={`https://fast.wistia.net/embed/iframe/${videoId}${
|
|
58
|
-
autoplay ? "?autoPlay=true" : ""
|
|
59
|
-
}`}
|
|
60
|
-
className="content"
|
|
61
|
-
allow="autoplay"
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const videoType = (url) => {
|
|
66
|
-
if (url.includes("youtu")) return "youtube";
|
|
67
|
-
if (url.includes("vimeo")) return "vimeo";
|
|
68
|
-
if (url.includes("youku")) return "youku";
|
|
69
|
-
if (url.includes("wistia")) return "wistia";
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const youtubeId = (url) => {
|
|
73
|
-
let matches = url.match(
|
|
74
|
-
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
if (matches && matches[5]) {
|
|
78
|
-
return matches[5]
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
matches = url.match(/youtu\.be\/|youtube\.com\/shorts\/(?<id>.*)(\?.*)?/)
|
|
82
|
-
|
|
83
|
-
return matches?.groups?.id || ''
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const vimeoId = (url) => {
|
|
87
|
-
const matches = url.match(/http(s?):\/\/(www\.)?vimeo\.com\/(\d+)($|\/)/);
|
|
88
|
-
return matches !== "" && matches !== null ? matches[3] : "";
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const youkuId = (url) => {
|
|
92
|
-
const matches = url.match(
|
|
93
|
-
/http(s?):\/\/v\.youku\.com\/v_show\/id_([A-Za-z0-9=]+)\.html/
|
|
94
|
-
);
|
|
95
|
-
return matches !== "" && matches !== null ? matches[2] : "";
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const wistiaId = (url) => {
|
|
99
|
-
const matches = url.match(
|
|
100
|
-
/http(s?):\/\/fast\.wistia\.net\/embed\/iframe\/(.*)($|\?)/
|
|
101
|
-
);
|
|
102
|
-
return matches !== "" && matches !== null ? matches[2] : "";
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const videoId = (url) => {
|
|
106
|
-
if (videoType(url) === "youtube") return youtubeId(url);
|
|
107
|
-
if (videoType(url) === "vimeo") return vimeoId(url);
|
|
108
|
-
if (videoType(url) === "youku") return youkuId(url);
|
|
109
|
-
if (videoType(url) === "wistia") return wistiaId(url);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const VideoComponentType = (vType, noCookieDomains) => {
|
|
113
|
-
const components = {
|
|
114
|
-
youtube: YouTubeEmbed,
|
|
115
|
-
vimeo: VimeoEmbed,
|
|
116
|
-
youku: YoukuEmbed,
|
|
117
|
-
wistia: WistiaEmbed,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const noCookiesComponents = {
|
|
121
|
-
youtube: YouTubeNoCookieEmbed,
|
|
122
|
-
vimeo: VimeoEmbed,
|
|
123
|
-
youku: YoukuEmbed,
|
|
124
|
-
wistia: WistiaEmbed,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
if (noCookieDomains) {
|
|
128
|
-
return noCookiesComponents[vType];
|
|
129
|
-
} else {
|
|
130
|
-
return components[vType];
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const EmbeddedVideo = ({
|
|
135
|
-
videoUrl,
|
|
136
|
-
autoplay = false,
|
|
137
|
-
noCookieDomains = false,
|
|
138
|
-
}) => {
|
|
139
|
-
const vType = videoType(videoUrl);
|
|
140
|
-
const vId = videoId(videoUrl);
|
|
141
|
-
const VideoComponent = VideoComponentType(vType, noCookieDomains);
|
|
142
|
-
|
|
143
|
-
if (VideoComponent) {
|
|
144
|
-
return <VideoComponent videoId={vId} autoplay={autoplay} />;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return null;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export default EmbeddedVideo;
|