@raketa-builder/builder 0.1.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 +8 -0
- package/.turbo/turbo-lint.log +13 -0
- package/CHANGELOG.md +7 -0
- package/dist/index.js +3247 -0
- package/package.json +31 -0
- package/src/Canvas.js +70 -0
- package/src/Container.js +15 -0
- package/src/EmbeddedVideo.js +143 -0
- package/src/ErrorBoundary/ErrorBoundary.js +28 -0
- package/src/ErrorBoundary/index.js +3 -0
- package/src/HostContext.js +5 -0
- package/src/LibraryContext.js +5 -0
- package/src/List.js +307 -0
- package/src/ListInput.js +13 -0
- package/src/MediaManager.js +15 -0
- package/src/PageBuilder.js +234 -0
- package/src/contexts/BuilderContext.js +8 -0
- package/src/dialogs/Dialog.js +49 -0
- package/src/dialogs/ReorderDialog.js +136 -0
- package/src/dialogs/SettingsDialog.js +180 -0
- package/src/forms/Button.js +33 -0
- package/src/forms/ButtonSettings.js +152 -0
- package/src/forms/LinkSettings.js +138 -0
- package/src/forms/RichText.js +22 -0
- package/src/forms/SelectMenu.js +68 -0
- package/src/forms/TextArea.js +11 -0
- package/src/forms/TextInput.js +31 -0
- package/src/helpers/humanize.js +9 -0
- package/src/helpers/imageSrc.js +17 -0
- package/src/helpers/widgetData.js +34 -0
- package/src/index.js +59 -0
- package/src/lib/AdminSidebar.js +178 -0
- package/src/lib/AdminWidget.js +132 -0
- package/src/lib/Image.js +78 -0
- package/src/lib/LanguageSwitcher.js +162 -0
- package/src/lib/Link.js +19 -0
- package/src/lib/SideNav.js +164 -0
- package/src/lib/SidebarItem.js +20 -0
- package/src/lists/index.js +41 -0
- package/src/pickers/ImagePicker/ImageInput.js +17 -0
- package/src/pickers/ImagePicker/ImagePicker.js +22 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { reset, buttonReset } from "@raketa-builder/ui";
|
|
4
|
+
|
|
5
|
+
export const SideNav = styled.div`
|
|
6
|
+
${reset}
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
width: 64px;
|
|
15
|
+
background-color: ${(props) => props.theme.colors.black};
|
|
16
|
+
border-right: 1px solid ${(props) => props.theme.colors.darkerGray};
|
|
17
|
+
z-index: 30;
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const NavGroup = styled.div`
|
|
21
|
+
${reset};
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const NavItem = styled.div`
|
|
28
|
+
z-index: 10;
|
|
29
|
+
|
|
30
|
+
&:hover > * {
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
const NavButtonStyle = styled.button`
|
|
36
|
+
${reset}
|
|
37
|
+
${buttonReset}
|
|
38
|
+
position: relative;
|
|
39
|
+
z-index: 1000;
|
|
40
|
+
display: block;
|
|
41
|
+
font-size: ${(props) => props.theme.font.medium};
|
|
42
|
+
color: ${(props) => props.theme.colors.white};
|
|
43
|
+
background-repeat: no-repeat;
|
|
44
|
+
background-position: center;
|
|
45
|
+
background-color: ${(props) =>
|
|
46
|
+
props.active
|
|
47
|
+
? props.theme.colors.darkerGray
|
|
48
|
+
: props.success
|
|
49
|
+
? props.theme.colors.success
|
|
50
|
+
: "transparent"};
|
|
51
|
+
${(props) => (props.icon ? `background-image: url("${props.icon}");` : "")}
|
|
52
|
+
width: 64px;
|
|
53
|
+
height: 64px;
|
|
54
|
+
border-bottom: 1px solid ${(props) => props.theme.colors.darkerGray};
|
|
55
|
+
z-index: 12;
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
background-color: ${(props) =>
|
|
59
|
+
props.success
|
|
60
|
+
? props.theme.colors.success
|
|
61
|
+
: props.theme.colors.darkerGray};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:active {
|
|
65
|
+
opacity: 0.9;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const TooltipWrapper = styled.div`
|
|
70
|
+
position: relative;
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
.cms-tooltip {
|
|
74
|
+
opacity: 1;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
const Tooltip = styled.div`
|
|
80
|
+
${reset};
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: calc(50% - 1em);
|
|
83
|
+
left: 72px;
|
|
84
|
+
z-index: 1001;
|
|
85
|
+
height: 2em;
|
|
86
|
+
padding: 0.5em 0.75em;
|
|
87
|
+
border-radius: 2px;
|
|
88
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
89
|
+
color: ${(props) => props.theme.colors.white};
|
|
90
|
+
line-height: 1;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transition: all 0.3s ease-in-out;
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
export const NavButton = ({ tooltip, ...props }) => (
|
|
98
|
+
<TooltipWrapper>
|
|
99
|
+
<NavButtonStyle {...props} />
|
|
100
|
+
{tooltip && <Tooltip className="cms-tooltip">{tooltip}</Tooltip>}
|
|
101
|
+
</TooltipWrapper>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
export const NavPanel = styled.div`
|
|
105
|
+
${reset}
|
|
106
|
+
display: none;
|
|
107
|
+
position: fixed;
|
|
108
|
+
top: 0;
|
|
109
|
+
bottom: 0;
|
|
110
|
+
left: 64px;
|
|
111
|
+
width: 300px;
|
|
112
|
+
padding: ${(props) => `calc(${props.theme.font.base} * 2)`};
|
|
113
|
+
background-color: rgba(0, 0, 0, 0.9);
|
|
114
|
+
color: ${(props) => props.theme.colors.white};
|
|
115
|
+
backdrop-filter: blur(8px);
|
|
116
|
+
overflow-y: auto;
|
|
117
|
+
z-index: 11;
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
export const NavSectionMenu = styled.div`
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: row;
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
export const NavSectionMenuItem = styled.button`
|
|
126
|
+
${reset}
|
|
127
|
+
${buttonReset}
|
|
128
|
+
display: block;
|
|
129
|
+
width: 100%;
|
|
130
|
+
padding-bottom: ${(props) => `calc(${props.theme.font.base} / 2)`};
|
|
131
|
+
margin-bottom: ${(props) => `calc(${props.theme.font.base} / 2)`};
|
|
132
|
+
font-size: ${(props) => props.theme.font.medium};
|
|
133
|
+
font-weight: 300;
|
|
134
|
+
text-align: left;
|
|
135
|
+
color: ${(props) => props.theme.colors.white};
|
|
136
|
+
border-bottom: 1px solid ${(props) => props.theme.colors.darkerGray};
|
|
137
|
+
transition: all 0.2s ease-in-out;
|
|
138
|
+
|
|
139
|
+
&:hover {
|
|
140
|
+
padding-left: ${(props) => `calc(${props.theme.font.base} / 2)`};
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
export const SideNavSearchWrapper = styled.div`
|
|
145
|
+
position: relative;
|
|
146
|
+
height: ${(props) => `calc(${props.theme.font.base} * 3.125)`};
|
|
147
|
+
margin-bottom: ${(props) => props.theme.font.base};
|
|
148
|
+
|
|
149
|
+
input:not([type]) {
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: 0;
|
|
152
|
+
right: ${(props) => `calc(${props.theme.font.base} * -2)`};
|
|
153
|
+
left: ${(props) => `calc(${props.theme.font.base} * -2)`};
|
|
154
|
+
bottom: 0;
|
|
155
|
+
width: 125%;
|
|
156
|
+
padding-left: ${(props) => `calc(${props.theme.font.base} * 2)`};
|
|
157
|
+
padding-right: ${(props) => `calc(${props.theme.font.base} * 2)`};
|
|
158
|
+
font-size: ${(props) => props.theme.font.medium};
|
|
159
|
+
border: 0 !important;
|
|
160
|
+
border-radius: 0;
|
|
161
|
+
background-color: ${(props) => props.theme.colors.black};
|
|
162
|
+
color: ${(props) => props.theme.colors.white};
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { reset, buttonReset } from "@raketa-builder/ui";
|
|
3
|
+
|
|
4
|
+
export const SidebarItem = styled.button`
|
|
5
|
+
${reset}
|
|
6
|
+
${buttonReset}
|
|
7
|
+
position: relative;
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
width: 100%;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin-bottom: ${(props) => props.theme.font.base};
|
|
12
|
+
font-size: ${(props) => props.theme.font.base};
|
|
13
|
+
color: #999;
|
|
14
|
+
text-align: left;
|
|
15
|
+
transition: all 0.2s ease-in-out;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
color: ${(props) => props.theme.colors.white};
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const add = (items, item) => [...items, item];
|
|
2
|
+
const addAtBeggining = (items, item) => [item, ...items];
|
|
3
|
+
const addAt = (items, item, idx) => console.log("TODO: Implement me");
|
|
4
|
+
const removeByIndex = (items, idx) => [
|
|
5
|
+
...items.slice(0, idx),
|
|
6
|
+
...items.slice(idx + 1),
|
|
7
|
+
];
|
|
8
|
+
const removeById = (items, id, idField = "id") =>
|
|
9
|
+
removeByIndex(
|
|
10
|
+
items,
|
|
11
|
+
items.findIndex((current) => current[idField] === id)
|
|
12
|
+
);
|
|
13
|
+
const updateFieldByIndex = (items, field, value, idx) => [
|
|
14
|
+
...items.slice(0, idx),
|
|
15
|
+
Object.assign({}, items[idx], { [field]: value }),
|
|
16
|
+
...items.slice(idx + 1),
|
|
17
|
+
];
|
|
18
|
+
const updateFieldById = (items, field, value, id, idField = "id") =>
|
|
19
|
+
updateFieldByIndex(
|
|
20
|
+
items,
|
|
21
|
+
field,
|
|
22
|
+
value,
|
|
23
|
+
items.findIndex((current) => current[idField] === id)
|
|
24
|
+
);
|
|
25
|
+
const reorder = (items, order) => order.map((idx) => items[idx]);
|
|
26
|
+
|
|
27
|
+
const randomId = () => Math.floor(Math.random() * (999 - 100 + 1)) + 100;
|
|
28
|
+
const randomString = (length) => Math.random().toString(36).substring(length);
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
add,
|
|
32
|
+
addAtBeggining,
|
|
33
|
+
addAt,
|
|
34
|
+
removeByIndex,
|
|
35
|
+
removeById,
|
|
36
|
+
updateFieldByIndex,
|
|
37
|
+
updateFieldById,
|
|
38
|
+
reorder,
|
|
39
|
+
randomId,
|
|
40
|
+
randomString,
|
|
41
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const ImageInput = () => (
|
|
4
|
+
<div>
|
|
5
|
+
<p>
|
|
6
|
+
ImageInput is no longer part of @raketa-builder/builder. Please use
|
|
7
|
+
@raketa-cms/raketa-image-input.{" "}
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<strong>Update imports</strong>
|
|
11
|
+
<p>
|
|
12
|
+
<code>{`import { ImageInput } from '@raketa-builder/image-input';`}</code>
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default ImageInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const ImagePicker = () => (
|
|
4
|
+
<div>
|
|
5
|
+
<p>
|
|
6
|
+
ImagePicker is no longer part of @raketa-builder/builder. Please use
|
|
7
|
+
@raketa-cms/raketa-image-input.{" "}
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<strong>Update imports</strong>
|
|
11
|
+
<p>
|
|
12
|
+
<code>{`import { ImagePicker } from '@raketa-builder/image-input';`}</code>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<strong>Update JSON adminFields</strong>
|
|
16
|
+
<p>
|
|
17
|
+
<code>{`image: { type: 'custom', component: ImagePicker },`}</code>
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default ImagePicker;
|