@searpent/react-image-annotate 2.0.16 → 2.0.18
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.
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin styles
|
|
3
|
+
*/
|
|
4
|
+
.ce-header {
|
|
5
|
+
padding: 0.6em 0 3px;
|
|
6
|
+
margin: 0;
|
|
7
|
+
line-height: 1.25em;
|
|
8
|
+
outline: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ce-header p,
|
|
12
|
+
.ce-header div {
|
|
13
|
+
padding: 0 !important;
|
|
14
|
+
margin: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Styles for Plugin icon in Toolbar
|
|
19
|
+
*/
|
|
20
|
+
.ce-header__icon {}
|
|
21
|
+
|
|
22
|
+
.ce-header[contentEditable=true][data-placeholder]::before {
|
|
23
|
+
position: absolute;
|
|
24
|
+
content: attr(data-placeholder);
|
|
25
|
+
color: #707684;
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
display: none;
|
|
28
|
+
cursor: text;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ce-header[contentEditable=true][data-placeholder]:empty::before {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ce-header[contentEditable=true][data-placeholder]:empty:focus::before {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Custom overwrite */
|
|
40
|
+
.cdx-settings-button {
|
|
41
|
+
width: 100% !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ce-settings__plugin-zone {
|
|
45
|
+
padding: 0 .25rem;
|
|
46
|
+
}
|
package/MainLayout/index.js
CHANGED
|
@@ -66,7 +66,9 @@ var EditorWrapper = styled("div")(function (_ref3) {
|
|
|
66
66
|
return {
|
|
67
67
|
width: "45%",
|
|
68
68
|
padding: "1rem",
|
|
69
|
-
paddingLeft: "2rem"
|
|
69
|
+
paddingLeft: "2rem",
|
|
70
|
+
height: "100vh",
|
|
71
|
+
overflowY: "scroll"
|
|
70
72
|
};
|
|
71
73
|
});
|
|
72
74
|
export var MainLayout = function MainLayout(_ref4) {
|
package/PageSelector/index.js
CHANGED
|
@@ -44,66 +44,11 @@ function PageSelector(_ref2) {
|
|
|
44
44
|
'page-selector--opened': showMetadata
|
|
45
45
|
})
|
|
46
46
|
}, React.createElement("div", {
|
|
47
|
-
className: "top-buttons"
|
|
48
|
-
}, React.createElement("button", {
|
|
49
|
-
onClick: onRecalc,
|
|
50
|
-
disabled: !recalcActive,
|
|
51
|
-
className: "info"
|
|
52
|
-
}, "Recalc"), React.createElement("button", {
|
|
53
|
-
onClick: onSave,
|
|
54
|
-
disabled: !saveActive,
|
|
55
|
-
className: "success"
|
|
56
|
-
}, "Save"), React.createElement("div", {
|
|
57
|
-
className: "show-metadata-wrapper"
|
|
58
|
-
}, React.createElement("label", {
|
|
59
|
-
className: "switch mr-2"
|
|
60
|
-
}, React.createElement("input", {
|
|
61
|
-
id: "show-metadata",
|
|
62
|
-
type: "checkbox",
|
|
63
|
-
value: showMetadata,
|
|
64
|
-
onChange: function onChange() {
|
|
65
|
-
return setShowMetadata(function (prev) {
|
|
66
|
-
return !prev;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}), React.createElement("span", {
|
|
70
|
-
className: "slider round"
|
|
71
|
-
})), React.createElement("label", null, "Metadata"))), React.createElement("div", {
|
|
72
47
|
className: "pages"
|
|
73
48
|
}, pages.map(function (page, idx) {
|
|
74
|
-
var _page$metadata;
|
|
75
|
-
|
|
76
49
|
return React.createElement("div", {
|
|
77
50
|
className: "page-thumbnail__wrapper"
|
|
78
|
-
},
|
|
79
|
-
key: "".concat(page.id),
|
|
80
|
-
src: page.src,
|
|
81
|
-
isActive: page.isActive,
|
|
82
|
-
onClick: function onClick() {
|
|
83
|
-
return onPageClick(idx);
|
|
84
|
-
}
|
|
85
|
-
}), showMetadata && React.createElement("div", {
|
|
86
|
-
className: "page-thumbnail__metadata"
|
|
87
|
-
}, React.createElement("h5", null, "Metadata"), page === null || page === void 0 ? void 0 : (_page$metadata = page.metadata) === null || _page$metadata === void 0 ? void 0 : _page$metadata.map(function (_ref3) {
|
|
88
|
-
var key = _ref3.key,
|
|
89
|
-
value = _ref3.value;
|
|
90
|
-
return React.createElement("div", {
|
|
91
|
-
key: key
|
|
92
|
-
}, React.createElement("label", {
|
|
93
|
-
htmlFor: key
|
|
94
|
-
}, key), React.createElement("input", {
|
|
95
|
-
id: key,
|
|
96
|
-
type: "text",
|
|
97
|
-
value: value,
|
|
98
|
-
onChange: function onChange(e) {
|
|
99
|
-
return onMetadataChange({
|
|
100
|
-
name: key,
|
|
101
|
-
value: e.target.value,
|
|
102
|
-
imageIndex: idx
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}));
|
|
106
|
-
})));
|
|
51
|
+
}, "This is thumbnail ", page.id);
|
|
107
52
|
})));
|
|
108
53
|
}
|
|
109
54
|
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
.page-selector {
|
|
2
|
+
height: 100vh;
|
|
3
|
+
overflow-y: scroll;
|
|
4
|
+
/* max-width: 10%; */
|
|
5
|
+
transition: max-width .5s;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.page-selector--opened {
|
|
9
|
+
/* max-width: 20%; */
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pages {
|
|
13
|
+
list-style: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.page-thumbnail__wrapper {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
background-color: #2dce89;
|
|
21
|
+
/* width: 240px; */
|
|
22
|
+
width: 480px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.page-thumbnail {
|
|
26
|
+
/* width: 300px; */
|
|
27
|
+
margin-bottom: 1rem;
|
|
28
|
+
border-radius: .25rem !important;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
filter: grayscale(1);
|
|
31
|
+
transition: transform .2s;
|
|
32
|
+
opacity: .5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.page-thumbnail:hover {
|
|
36
|
+
box-shadow: 0 0 2rem 0 #8898aa !important;
|
|
37
|
+
filter: grayscale(0);
|
|
38
|
+
transform: scale(1.015);
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.page-thumbnail-is-active {
|
|
44
|
+
filter: grayscale(0);
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.page-thumbnail img {
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.page-thumbnail__metadata {
|
|
53
|
+
padding: 1rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.page-thumbnail__metadata * {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.top-buttons {
|
|
61
|
+
background: linear-gradient(#8898aa, rgba(255, 255, 255, 0));
|
|
62
|
+
position: sticky;
|
|
63
|
+
top: 0;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
padding: 1rem;
|
|
67
|
+
margin-bottom: 1rem;
|
|
68
|
+
z-index: 100;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.top-buttons button {
|
|
72
|
+
margin-bottom: 1rem;
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.top-buttons button:hover {
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.top-buttons button:disabled {
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
opacity: .5;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.top-buttons button.info {
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
border-radius: 0.5rem;
|
|
88
|
+
background-image: linear-gradient(310deg, #627594, #a8b8d8);
|
|
89
|
+
color: white;
|
|
90
|
+
border: none;
|
|
91
|
+
padding: 0.5rem 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.top-buttons button.success {
|
|
95
|
+
color: white;
|
|
96
|
+
background-image: linear-gradient(310deg, #2dce89, #2dcecc);
|
|
97
|
+
border-radius: 0.5rem;
|
|
98
|
+
border: none;
|
|
99
|
+
padding: 0.5rem 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.bottom-buttons {
|
|
103
|
+
background: linear-gradient(rgba(255, 255, 255, 0), #8898aa);
|
|
104
|
+
position: sticky;
|
|
105
|
+
bottom: 0;
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
padding: 1rem;
|
|
109
|
+
margin-bottom: 1rem;
|
|
110
|
+
z-index: 100;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
.page-number-wrapper {
|
|
115
|
+
position: absolute;
|
|
116
|
+
bottom: 0;
|
|
117
|
+
width: 100%;
|
|
118
|
+
height: 10%;
|
|
119
|
+
z-index: 100;
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
align-items: center;
|
|
123
|
+
background: linear-gradient(rgba(255, 255, 255, 0), #8898aa);
|
|
124
|
+
padding: .5rem 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.page-number {
|
|
128
|
+
font-size: 1.5rem;
|
|
129
|
+
font-weight: 800;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* toggle */
|
|
133
|
+
.switch {
|
|
134
|
+
position: relative;
|
|
135
|
+
display: inline-block;
|
|
136
|
+
width: 60px;
|
|
137
|
+
height: 34px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.switch input {
|
|
141
|
+
opacity: 0;
|
|
142
|
+
width: 0;
|
|
143
|
+
height: 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.slider {
|
|
147
|
+
position: absolute;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
top: 0;
|
|
150
|
+
left: 0;
|
|
151
|
+
right: 0;
|
|
152
|
+
bottom: 0;
|
|
153
|
+
background-color: #ccc;
|
|
154
|
+
-webkit-transition: .4s;
|
|
155
|
+
transition: .4s;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.slider:before {
|
|
159
|
+
position: absolute;
|
|
160
|
+
content: "";
|
|
161
|
+
height: 26px;
|
|
162
|
+
width: 26px;
|
|
163
|
+
left: 4px;
|
|
164
|
+
bottom: 4px;
|
|
165
|
+
background-color: white;
|
|
166
|
+
-webkit-transition: .4s;
|
|
167
|
+
transition: .4s;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
input:checked+.slider {
|
|
171
|
+
background-color: #2196F3;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
input:focus+.slider {
|
|
175
|
+
box-shadow: 0 0 1px #2196F3;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
input:checked+.slider:before {
|
|
179
|
+
-webkit-transform: translateX(26px);
|
|
180
|
+
-ms-transform: translateX(26px);
|
|
181
|
+
transform: translateX(26px);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Rounded sliders */
|
|
185
|
+
.slider.round {
|
|
186
|
+
border-radius: 34px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.slider.round:before {
|
|
190
|
+
border-radius: 50%;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.show-metadata-wrapper {
|
|
194
|
+
display: flex;
|
|
195
|
+
flex-direction: row;
|
|
196
|
+
align-items: center;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.mr-2 {
|
|
200
|
+
margin-right: 1rem;
|
|
201
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searpent/react-image-annotate",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@editorjs/editorjs": "^2.25.0",
|
|
6
6
|
"@editorjs/paragraph": "^2.8.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"storybook": "start-storybook -p 9090 -s public",
|
|
59
59
|
"build": "npm run build:babel && cp ./package.json ./dist/package.json && cp ./README.md ./dist/README.md",
|
|
60
60
|
"dist": "npm run build && cd dist && npm publish",
|
|
61
|
-
"build:babel": "NODE_ENV=production babel ./src --ignore \"src/**/*.story.js\" --out-dir=./dist && rm dist/index.js && cp dist/lib.js dist/index.js",
|
|
61
|
+
"build:babel": "NODE_ENV=production babel ./src --ignore \"src/**/*.story.js\" --out-dir=./dist && rm dist/index.js && cp dist/lib.js dist/index.js && cp src/PageSelector/page-selector.css dist/PageSelector/ && cp src/Editor/annotation-plugin/annotation.css dist/Editor/annotation-plugin",
|
|
62
62
|
"build-storybook": "build-storybook",
|
|
63
63
|
"build:gh-pages": "CI=false react-scripts build && mkdir build/demo && cp build/index.html build/demo/index.html",
|
|
64
64
|
"gh-pages": "npm run build:gh-pages && gh-pages -d build",
|