@raketa-builder/image-input 0.7.0 → 0.8.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 +22 -0
- package/.turbo/turbo-lint.log +0 -13
- package/biome.json +3 -0
- package/dist/index.js +6073 -358
- package/package.json +6 -5
- package/src/MediaManager.js +8 -8
- package/src/lists/index.js +2 -2
- package/src/pickers/ImagePicker/BrowseTab.js +4 -3
- package/src/pickers/ImagePicker/ImagePicker.js +4 -2
- package/src/styles.css +5 -1
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/image-input",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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/MediaManager.js
CHANGED
|
@@ -15,8 +15,8 @@ const patch = (url, params = {}, opts = {}) =>
|
|
|
15
15
|
credentials: "same-origin",
|
|
16
16
|
body: JSON.stringify(params),
|
|
17
17
|
},
|
|
18
|
-
opts
|
|
19
|
-
)
|
|
18
|
+
opts,
|
|
19
|
+
),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const post = (url, params = {}, opts = {}) =>
|
|
@@ -28,8 +28,8 @@ const post = (url, params = {}, opts = {}) =>
|
|
|
28
28
|
credentials: "same-origin",
|
|
29
29
|
body: JSON.stringify(params),
|
|
30
30
|
},
|
|
31
|
-
opts
|
|
32
|
-
)
|
|
31
|
+
opts,
|
|
32
|
+
),
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
const del = (url, params = {}, opts = {}) =>
|
|
@@ -41,8 +41,8 @@ const del = (url, params = {}, opts = {}) =>
|
|
|
41
41
|
credentials: "same-origin",
|
|
42
42
|
body: JSON.stringify(params),
|
|
43
43
|
},
|
|
44
|
-
opts
|
|
45
|
-
)
|
|
44
|
+
opts,
|
|
45
|
+
),
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
export default class MediaManager {
|
|
@@ -69,7 +69,7 @@ export default class MediaManager {
|
|
|
69
69
|
patch(
|
|
70
70
|
`${this.baseUrl}images/${image.id}`,
|
|
71
71
|
{ image: params },
|
|
72
|
-
{ headers: { "content-type": "application/json" } }
|
|
72
|
+
{ headers: { "content-type": "application/json" } },
|
|
73
73
|
)
|
|
74
74
|
.then((r) => r.json())
|
|
75
75
|
.then((image) => callback(image));
|
|
@@ -79,7 +79,7 @@ export default class MediaManager {
|
|
|
79
79
|
del(
|
|
80
80
|
`${this.baseUrl}images/${image.id}`,
|
|
81
81
|
{},
|
|
82
|
-
{ headers: { "content-type": "application/json" } }
|
|
82
|
+
{ headers: { "content-type": "application/json" } },
|
|
83
83
|
)
|
|
84
84
|
.then((r) => r.json())
|
|
85
85
|
.then((image) => callback(image));
|
package/src/lists/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const removeByIndex = (items, idx) => [
|
|
|
7
7
|
const removeById = (items, id, idField = "id") =>
|
|
8
8
|
removeByIndex(
|
|
9
9
|
items,
|
|
10
|
-
items.findIndex((current) => current[idField] === id)
|
|
10
|
+
items.findIndex((current) => current[idField] === id),
|
|
11
11
|
);
|
|
12
12
|
const updateFieldByIndex = (items, field, value, idx) => [
|
|
13
13
|
...items.slice(0, idx),
|
|
@@ -19,7 +19,7 @@ const updateFieldById = (items, field, value, id, idField = "id") =>
|
|
|
19
19
|
items,
|
|
20
20
|
field,
|
|
21
21
|
value,
|
|
22
|
-
items.findIndex((current) => current[idField] === id)
|
|
22
|
+
items.findIndex((current) => current[idField] === id),
|
|
23
23
|
);
|
|
24
24
|
const reorder = (items, order) => order.map((idx) => items[idx]);
|
|
25
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Button, Stack, H, cn } from "@raketa-builder/ui";
|
|
3
|
-
import
|
|
3
|
+
import Image from "@raketa-builder/support";
|
|
4
4
|
import TextInput from "../../forms/TextInput";
|
|
5
5
|
|
|
6
6
|
const ImageList = ({ className, ...rest }) => (
|
|
@@ -45,10 +45,11 @@ const ImageItem = ({ image, selected, onSelect, onFastSelect }) => (
|
|
|
45
45
|
onDoubleClick={() => onFastSelect(image)}
|
|
46
46
|
>
|
|
47
47
|
<ImageWrapper title={image.name}>
|
|
48
|
-
<
|
|
48
|
+
<Image
|
|
49
49
|
src={getPreviewImage(image)}
|
|
50
50
|
variant="thumb"
|
|
51
51
|
title={image && image.name}
|
|
52
|
+
alt=""
|
|
52
53
|
/>
|
|
53
54
|
</ImageWrapper>
|
|
54
55
|
</Thumb>
|
|
@@ -82,7 +83,7 @@ const ImagePreview = ({ image, onDelete }) => {
|
|
|
82
83
|
return (
|
|
83
84
|
<ImageInspector>
|
|
84
85
|
<ImagePreviewWrapper>
|
|
85
|
-
<
|
|
86
|
+
<Image src={image} variant="original" alt="" />
|
|
86
87
|
|
|
87
88
|
{isImageEditable(image) && (
|
|
88
89
|
<React.Fragment>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { cn } from "@raketa-builder/ui";
|
|
3
|
-
import
|
|
3
|
+
import Image from "@raketa-builder/support";
|
|
4
4
|
import TextInput from "../../forms/TextInput";
|
|
5
5
|
import Dialog from "../../dialogs/Dialog";
|
|
6
6
|
import BrowseTab from "./BrowseTab";
|
|
@@ -181,7 +181,9 @@ const ImagePicker = ({
|
|
|
181
181
|
<div>
|
|
182
182
|
<ImageControl>
|
|
183
183
|
<ImageWrapper>
|
|
184
|
-
{image &&
|
|
184
|
+
{image && (
|
|
185
|
+
<Image src={image} variant="thumb" title={image.name} alt="" />
|
|
186
|
+
)}
|
|
185
187
|
|
|
186
188
|
{!image && <ImagePlaceholder />}
|
|
187
189
|
</ImageWrapper>
|
package/src/styles.css
CHANGED
|
@@ -98,7 +98,11 @@
|
|
|
98
98
|
linear-gradient(225deg, #eee 25%, transparent 25%),
|
|
99
99
|
linear-gradient(45deg, #eee 25%, transparent 25%),
|
|
100
100
|
linear-gradient(315deg, #eee 25%, #ffffff 25%);
|
|
101
|
-
background-position:
|
|
101
|
+
background-position:
|
|
102
|
+
10px 0,
|
|
103
|
+
10px 0,
|
|
104
|
+
0 0,
|
|
105
|
+
0 0;
|
|
102
106
|
background-size: 20px 20px;
|
|
103
107
|
background-repeat: repeat;
|
|
104
108
|
}
|
package/tsconfig.json
CHANGED