@searpent/react-image-annotate 2.3.6 → 2.3.7

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.
@@ -750,7 +750,7 @@ var examplePhotos = [{
750
750
  "Y1": 0,
751
751
  "Y2": 1
752
752
  },
753
- "text": "[{\"key\":\"articleType\",\"value\":\"news\"}, {\"key\":\"previousArticleId\",\"value\":\"prev-article-1\"}, {\"key\":\"section\",\"value\":\"editorial\"}]",
753
+ "text": "[{\"key\":\"articleType\",\"value\":\"news\"}, {\"key\":\"section\",\"value\":\"editorial\"}]",
754
754
  "groupId": "42ba09e0-b2f5-439d-bdae-201e7c37787b",
755
755
  "id": "aba453dd-f870-4510-ae40-a19eb52eb7d6"
756
756
  }, {
@@ -762,7 +762,7 @@ var examplePhotos = [{
762
762
  "Y1": 0,
763
763
  "Y2": 1
764
764
  },
765
- "text": "[{\"key\":\"articleType\",\"value\":\"ads\"}, {\"key\":\"previousArticleId\",\"value\":\"prev-article-2\"}, {\"key\":\"section\",\"value\":\"last page\"}]",
765
+ "text": "[{\"key\":\"articleType\",\"value\":\"ads\"}, {\"key\":\"section\",\"value\":\"last page\"}]",
766
766
  "groupId": "1",
767
767
  "id": "2615bf87-7247-4bde-a0f9-45413034a6a6"
768
768
  }]
@@ -84,9 +84,7 @@ export var Annotator = function Annotator(_ref) {
84
84
  _ref$save = _ref.save,
85
85
  save = _ref$save === void 0 ? function () {} : _ref$save,
86
86
  _ref$fetchImage = _ref.fetchImage,
87
- fetchImage = _ref$fetchImage === void 0 ? function () {} : _ref$fetchImage,
88
- updatedBy = _ref.updatedBy,
89
- mediaPresenterLeaseUntil = _ref.mediaPresenterLeaseUntil;
87
+ fetchImage = _ref$fetchImage === void 0 ? function () {} : _ref$fetchImage;
90
88
 
91
89
  if (typeof selectedImage === "string") {
92
90
  selectedImage = (images || []).findIndex(function (img) {
@@ -216,14 +214,14 @@ export var Annotator = function Annotator(_ref) {
216
214
  }
217
215
  }
218
216
  }, [state.previouslySelectedImage, state.selectedImage, state.images, state, save]); // Automatically save image shortly after specific metadata fields change
219
- // (ArticleType, PreviousArticleId), but debounce so we don't save on every keystroke.
217
+ // (ArticleType, PreviousArticleId, Section), but debounce so we don't save on every keystroke.
220
218
 
221
219
  useEffect(function () {
222
220
  var _state$images;
223
221
 
224
222
  var lastAction = state.lastAction;
225
223
 
226
- if (!lastAction || lastAction.type !== "UPDATE_METADATA" || lastAction.name !== "articleType" && lastAction.name !== "previousArticleId" || isNaN(lastAction.imageIndex)) {
224
+ if (!lastAction || lastAction.type !== "UPDATE_METADATA" || lastAction.name !== "articleType" && lastAction.name !== "previousArticleId" && lastAction.name !== "section" || isNaN(lastAction.imageIndex)) {
227
225
  return;
228
226
  }
229
227
 
@@ -447,9 +445,7 @@ export var Annotator = function Annotator(_ref) {
447
445
  recalcActive: saveActive,
448
446
  onMetadataChange: handleMetadataChange,
449
447
  onAddGroup: handleAddGroup,
450
- onRecalcClick: handleRecalcClicked,
451
- updatedBy: updatedBy,
452
- mediaPresenterLeaseUntil: mediaPresenterLeaseUntil
448
+ onRecalcClick: handleRecalcClicked
453
449
  }))
454
450
  );
455
451
  };
@@ -133,9 +133,7 @@ export var MainLayout = function MainLayout(_ref5) {
133
133
  saveActive = _ref5$saveActive === void 0 ? false : _ref5$saveActive,
134
134
  onMetadataChange = _ref5.onMetadataChange,
135
135
  onAddGroup = _ref5.onAddGroup,
136
- onRecalcClick = _ref5.onRecalcClick,
137
- updatedBy = _ref5.updatedBy,
138
- mediaPresenterLeaseUntil = _ref5.mediaPresenterLeaseUntil;
136
+ onRecalcClick = _ref5.onRecalcClick;
139
137
  var classes = useStyles();
140
138
  var settings = useSettings();
141
139
  var fullScreenHandle = useFullScreenHandle();
@@ -377,9 +375,7 @@ export var MainLayout = function MainLayout(_ref5) {
377
375
  onPageClick: handlePageClick,
378
376
  onMetadataChange: onMetadataChange,
379
377
  metadataConfigs: state.metadataConfigs || [],
380
- onRecalcClick: onRecalcClick,
381
- updatedBy: updatedBy,
382
- mediaPresenterLeaseUntil: mediaPresenterLeaseUntil
378
+ onRecalcClick: onRecalcClick
383
379
  }),
384
380
  /*#__PURE__*/
385
381
  React.createElement(WorkspaceWrapper, null,
@@ -4,7 +4,6 @@ import classnames from "classnames";
4
4
  import './page-selector.css';
5
5
  import Locker from '../Locker';
6
6
  import Errorer from '../Errorer';
7
- import UpdatedBySemaphore, { normalizeMediaPresenterLeaseUntil } from './UpdatedBySemaphore';
8
7
 
9
8
  function PageThumbnail(_ref) {
10
9
  var _metadata$find, _metadata$find$call;
@@ -148,32 +147,18 @@ function isLocked(page) {
148
147
  return false;
149
148
  }
150
149
 
151
- function showUpdatedBySemaphore(updatedBy, mediaPresenterLeaseUntil) {
152
- if (updatedBy !== undefined && updatedBy !== null) return true;
153
- if (normalizeMediaPresenterLeaseUntil(mediaPresenterLeaseUntil) != null) return true;
154
- return false;
155
- }
156
-
157
150
  function PageSelector(_ref3) {
158
- var _ref4, _ref5;
159
-
160
151
  var pages = _ref3.pages,
161
152
  onPageClick = _ref3.onPageClick,
162
153
  onMetadataChange = _ref3.onMetadataChange,
163
154
  metadataConfigs = _ref3.metadataConfigs,
164
- onRecalcClick = _ref3.onRecalcClick,
165
- updatedBy = _ref3.updatedBy,
166
- mediaPresenterLeaseUntil = _ref3.mediaPresenterLeaseUntil;
155
+ onRecalcClick = _ref3.onRecalcClick;
167
156
 
168
157
  var _useState = useState(false),
169
158
  _useState2 = _slicedToArray(_useState, 2),
170
159
  showMetadata = _useState2[0],
171
160
  setShowMetadata = _useState2[1];
172
161
 
173
- var activePage = pages.find(function (p) {
174
- return p.isActive;
175
- });
176
- var selectionKey = (_ref4 = (_ref5 = activePage === null || activePage === void 0 ? void 0 : activePage.id) !== null && _ref5 !== void 0 ? _ref5 : activePage === null || activePage === void 0 ? void 0 : activePage.src) !== null && _ref4 !== void 0 ? _ref4 : String(pages.length);
177
162
  return (
178
163
  /*#__PURE__*/
179
164
  React.createElement("div", {
@@ -186,10 +171,6 @@ function PageSelector(_ref3) {
186
171
  className: "top-buttons"
187
172
  },
188
173
  /*#__PURE__*/
189
- React.createElement("div", {
190
- className: "page-selector-top-controls"
191
- },
192
- /*#__PURE__*/
193
174
  React.createElement("div", {
194
175
  className: "show-metadata-wrapper"
195
176
  },
@@ -213,19 +194,7 @@ function PageSelector(_ref3) {
213
194
  className: "slider round"
214
195
  })),
215
196
  /*#__PURE__*/
216
- React.createElement("label", {
217
- className: "ps-top-bar-label"
218
- }, "Metadata")), showUpdatedBySemaphore(updatedBy, mediaPresenterLeaseUntil) &&
219
- /*#__PURE__*/
220
- React.createElement("div", {
221
- className: "ps-semaphore-below-metadata"
222
- },
223
- /*#__PURE__*/
224
- React.createElement(UpdatedBySemaphore, {
225
- updatedBy: updatedBy,
226
- mediaPresenterLeaseUntil: mediaPresenterLeaseUntil,
227
- selectionKey: selectionKey
228
- })))),
197
+ React.createElement("label", null, "Metadata"))),
229
198
  /*#__PURE__*/
230
199
  React.createElement("div", {
231
200
  className: "pages"
@@ -4,6 +4,8 @@
4
4
  transition: width .5s;
5
5
  }
6
6
 
7
+ .page-selector--opened {}
8
+
7
9
  .pages {
8
10
  list-style: none;
9
11
  display: flex;
@@ -103,124 +105,6 @@
103
105
  z-index: 100;
104
106
  }
105
107
 
106
- .page-selector-top-controls {
107
- display: flex;
108
- flex-direction: column;
109
- align-items: stretch;
110
- width: 100%;
111
- gap: 0.5rem;
112
- }
113
-
114
- /* Same typography as “Metadata” label (plain label next to switch) */
115
- .ps-top-bar-label {
116
- font-family: inherit;
117
- font-size: 1rem;
118
- font-weight: 400;
119
- line-height: 1.5;
120
- color: inherit;
121
- cursor: default;
122
- }
123
-
124
- .ps-semaphore-below-metadata {
125
- display: flex;
126
- justify-content: flex-start;
127
- align-items: center;
128
- width: 100%;
129
- padding-top: 0.15rem;
130
- padding-left: 0;
131
- box-sizing: border-box;
132
- }
133
-
134
- /* Same slot as .switch (60px) + .mr-2 (1rem) — lines up with Metadata toggle row */
135
- .ps-semaphore-toggle-column {
136
- width: 60px;
137
- margin-right: 1rem;
138
- display: flex;
139
- justify-content: center;
140
- align-items: center;
141
- flex-shrink: 0;
142
- box-sizing: border-box;
143
- }
144
-
145
- /* Plain text + discs to the right — no box */
146
- .ps-updated-by-semaphore {
147
- display: flex;
148
- flex-direction: row;
149
- align-items: center;
150
- justify-content: flex-start;
151
- gap: 0.5rem;
152
- padding: 0;
153
- margin: 0;
154
- border: none;
155
- background: none;
156
- box-shadow: none;
157
- flex-shrink: 0;
158
- }
159
-
160
- .ps-updated-by-semaphore__label {
161
- text-align: left;
162
- margin: 0;
163
- white-space: nowrap;
164
- }
165
-
166
- .ps-semaphore-lamps {
167
- display: flex;
168
- flex-direction: row;
169
- align-items: center;
170
- justify-content: center;
171
- gap: 6px;
172
- }
173
-
174
- /* Same diameter as Metadata toggle knob (.slider:before: 26×26) */
175
- .ps-semaphore-lamp {
176
- box-sizing: border-box;
177
- display: inline-block;
178
- vertical-align: middle;
179
- width: 26px;
180
- height: 26px;
181
- border-radius: 50%;
182
- border: 2px solid rgba(0, 0, 0, 0.1);
183
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
184
- transition: opacity 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
185
- flex-shrink: 0;
186
- }
187
-
188
- /* Inactive lamps read as “off” (neutral); lit lamp pops. */
189
- .ps-semaphore-lamp:not(.ps-semaphore-lit) {
190
- opacity: 0.88;
191
- }
192
-
193
- .ps-semaphore-lamp.ps-semaphore-lit {
194
- opacity: 1;
195
- transform: scale(1.02);
196
- }
197
-
198
- /* Off state: neutral gray so only the lit lamp reads as red/green (traffic-light style). */
199
- .ps-semaphore-red:not(.ps-semaphore-lit),
200
- .ps-semaphore-green:not(.ps-semaphore-lit) {
201
- background: linear-gradient(165deg, #ececec 0%, #d4d4d4 45%, #bdbdbd 100%);
202
- border-color: rgba(0, 0, 0, 0.12);
203
- box-shadow:
204
- inset 0 2px 4px rgba(255, 255, 255, 0.55),
205
- inset 0 -2px 5px rgba(0, 0, 0, 0.1);
206
- }
207
-
208
- .ps-semaphore-red.ps-semaphore-lit {
209
- background: linear-gradient(180deg, #ff5252 0%, #d50000 55%, #b71c1c 100%);
210
- border-color: rgba(255, 200, 200, 0.85);
211
- box-shadow:
212
- 0 0 10px rgba(213, 0, 0, 0.88),
213
- inset 0 -2px 5px rgba(0, 0, 0, 0.18);
214
- }
215
-
216
- .ps-semaphore-green.ps-semaphore-lit {
217
- background: linear-gradient(180deg, #b9f6ca 0%, #00e676 40%, #00c853 100%);
218
- border-color: rgba(200, 255, 220, 0.9);
219
- box-shadow:
220
- 0 0 10px rgba(0, 200, 83, 0.88),
221
- inset 0 -2px 5px rgba(0, 0, 0, 0.14);
222
- }
223
-
224
108
  .top-buttons button {
225
109
  margin-bottom: 1rem;
226
110
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searpent/react-image-annotate",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "dependencies": {
5
5
  "@editorjs/editorjs": "^2.25.0",
6
6
  "@editorjs/paragraph": "^2.8.0",