@atlaskit/media-avatar-picker 27.1.3 → 28.0.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/AGENTS.md +27 -0
- package/CHANGELOG.md +26 -0
- package/avatar-list/package.json +1 -8
- package/avatar-picker-dialog-loader/package.json +1 -8
- package/dist/cjs/avatar-picker-dialog/index.js +11 -11
- package/dist/cjs/image-navigator/index.js +4 -4
- package/dist/cjs/image-placer/imageProcessor.js +13 -13
- package/dist/cjs/image-placer/index.js +35 -35
- package/dist/esm/avatar-picker-dialog/index.js +10 -10
- package/dist/esm/image-navigator/index.js +4 -4
- package/dist/esm/image-placer/imageProcessor.js +13 -13
- package/dist/esm/image-placer/index.js +35 -35
- package/exportCroppedImage/package.json +1 -8
- package/image-cropper/package.json +1 -8
- package/image-navigator/package.json +1 -8
- package/images/package.json +1 -8
- package/package.json +19 -28
- package/slider/package.json +1 -8
- package/viewport/package.json +1 -8
- package/dist/types-ts4.5/avatar-list/index.d.ts +0 -11
- package/dist/types-ts4.5/avatar-picker-dialog/SRLiveTitle.d.ts +0 -7
- package/dist/types-ts4.5/avatar-picker-dialog/SubmitErrorDialog.d.ts +0 -1
- package/dist/types-ts4.5/avatar-picker-dialog/avatar-picker-dialog-error-boundary.d.ts +0 -7
- package/dist/types-ts4.5/avatar-picker-dialog/avatar-picker-dialog-loader.d.ts +0 -4
- package/dist/types-ts4.5/avatar-picker-dialog/custom-spinner.d.ts +0 -2
- package/dist/types-ts4.5/avatar-picker-dialog/index.d.ts +0 -57
- package/dist/types-ts4.5/avatar-picker-dialog/layout-const.d.ts +0 -11
- package/dist/types-ts4.5/avatar-picker-dialog/types.d.ts +0 -76
- package/dist/types-ts4.5/image-cropper/crop-to-data-uri.d.ts +0 -7
- package/dist/types-ts4.5/image-cropper/index.d.ts +0 -36
- package/dist/types-ts4.5/image-cropper/isImageRemote.d.ts +0 -1
- package/dist/types-ts4.5/image-navigator/dragZone.d.ts +0 -1
- package/dist/types-ts4.5/image-navigator/exportCroppedImage.d.ts +0 -2
- package/dist/types-ts4.5/image-navigator/images.d.ts +0 -3
- package/dist/types-ts4.5/image-navigator/index.d.ts +0 -84
- package/dist/types-ts4.5/image-navigator/slider.d.ts +0 -19
- package/dist/types-ts4.5/image-placer/constraints.d.ts +0 -6
- package/dist/types-ts4.5/image-placer/container.d.ts +0 -29
- package/dist/types-ts4.5/image-placer/containerWrapper.d.ts +0 -6
- package/dist/types-ts4.5/image-placer/image.d.ts +0 -20
- package/dist/types-ts4.5/image-placer/imagePlacerErrorWrapper.d.ts +0 -1
- package/dist/types-ts4.5/image-placer/imageProcessor.d.ts +0 -16
- package/dist/types-ts4.5/image-placer/imageWrapper.d.ts +0 -1
- package/dist/types-ts4.5/image-placer/index.d.ts +0 -104
- package/dist/types-ts4.5/image-placer/margin.d.ts +0 -12
- package/dist/types-ts4.5/index.d.ts +0 -10
- package/dist/types-ts4.5/predefined-avatar-list/index.d.ts +0 -11
- package/dist/types-ts4.5/predefined-avatar-view/index.d.ts +0 -11
- package/dist/types-ts4.5/util.d.ts +0 -6
- package/dist/types-ts4.5/viewport/index.d.ts +0 -2
- package/dist/types-ts4.5/viewport/viewport-render.d.ts +0 -3
- package/dist/types-ts4.5/viewport/viewport.d.ts +0 -57
package/AGENTS.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
# media-avatar-picker — Agent Guide
|
|
2
|
+
|
|
3
|
+
> **Parent guide:** Always read [`../AGENTS.md`](../AGENTS.md) before working in this package — it
|
|
4
|
+
> contains workspace-wide rules covering platform guidelines, changeset workflow, accessibility
|
|
5
|
+
> standards, and the knowledge index protocol that applies to every Media package.
|
|
6
|
+
|
|
7
|
+
## Knowledge index
|
|
8
|
+
|
|
9
|
+
> Read, search, edit, investigate, and validate the repository knowledge index at
|
|
10
|
+
> `.agents/knowledge-index/`. ALWAYS use this skill before making ANY repo change, or when exploring
|
|
11
|
+
> the codebase. The knowledge index is the canonical starting point for every coding task in this
|
|
12
|
+
> repo, trigger this skill aggressively whenever the user mentions architecture, conventions,
|
|
13
|
+
> packages, modules, services, build, coding, writing code, APIs, feature flags, testing, or
|
|
14
|
+
> anything similar. Also trigger when "is the knowledge index up to date?" / "update the knowledge
|
|
15
|
+
> index" / "what does the knowledge index say about Y?" — even if they don't say the words
|
|
16
|
+
> "knowledge index". Also use it (via the `validate` subcommand) to detect drift between the
|
|
17
|
+
> codebase and the docs after any code change. Use the `generate` subcommand to bootstrap the index
|
|
18
|
+
> in a new repository.
|
|
19
|
+
|
|
20
|
+
**Entry point:** `.agents/knowledge-index/INDEX.md` **Unit doc:**
|
|
21
|
+
`.agents/knowledge-index/domains/media/units/atlaskit-media-avatar-picker.md` **CLI:**
|
|
22
|
+
`python3 .agents/skills/knowledge-index/scripts/kg.py {find,read,edit,investigate,validate,init,explore,generate} …`
|
|
23
|
+
**Refresh protocol:** never silently bump `Last verified` — always re-read the listed `Sources`
|
|
24
|
+
first, edit, then `kg.py edit <path> --message "<reason>"`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
1
28
|
# Media Avatar Picker - Agent Documentation
|
|
2
29
|
|
|
3
30
|
## Overview
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/media-avatar-picker
|
|
2
2
|
|
|
3
|
+
## 28.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
|
|
8
|
+
Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
|
|
9
|
+
|
|
10
|
+
Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
|
|
11
|
+
|
|
12
|
+
Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
|
|
13
|
+
|
|
14
|
+
```diff
|
|
15
|
+
- "typesVersions": {
|
|
16
|
+
- ">=4.5 <4.9": {
|
|
17
|
+
- "*": [
|
|
18
|
+
- "dist/types-ts4.5/*",
|
|
19
|
+
- "dist/types-ts4.5/index.d.ts"
|
|
20
|
+
- ]
|
|
21
|
+
- }
|
|
22
|
+
- },
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 27.1.3
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/avatar-list/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/avatar-list/index.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/avatar-list/index.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/avatar-list/index.d.ts"
|
|
17
10
|
}
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/avatar-picker-dialog/avatar-picker-dialog-loader.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/avatar-picker-dialog/avatar-picker-dialog-loader.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/avatar-picker-dialog/avatar-picker-dialog-loader.d.ts"
|
|
17
10
|
}
|
|
@@ -35,7 +35,7 @@ var _types = require("./types");
|
|
|
35
35
|
var _SRLiveTitle = require("./SRLiveTitle");
|
|
36
36
|
var _loadingButton = _interopRequireDefault(require("@atlaskit/button/loading-button"));
|
|
37
37
|
var _SubmitErrorDialog = require("./SubmitErrorDialog");
|
|
38
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
38
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
39
39
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
40
40
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
41
41
|
var MAX_SIZE_MB = exports.MAX_SIZE_MB = 10;
|
|
@@ -83,31 +83,31 @@ var AvatarPickerDialog = exports.AvatarPickerDialog = /*#__PURE__*/function (_Pu
|
|
|
83
83
|
});
|
|
84
84
|
(0, _defineProperty2.default)(_this, "setSelectedImageState", /*#__PURE__*/function () {
|
|
85
85
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(selectedImage) {
|
|
86
|
-
var dataURI;
|
|
87
|
-
return _regenerator.default.wrap(function
|
|
86
|
+
var dataURI, _t;
|
|
87
|
+
return _regenerator.default.wrap(function (_context) {
|
|
88
88
|
while (1) switch (_context.prev = _context.next) {
|
|
89
89
|
case 0:
|
|
90
90
|
_context.prev = 0;
|
|
91
91
|
_this.setState({
|
|
92
92
|
selectedImage: selectedImage
|
|
93
93
|
});
|
|
94
|
-
_context.next =
|
|
94
|
+
_context.next = 1;
|
|
95
95
|
return (0, _mediaUi.fileToDataURI)(selectedImage);
|
|
96
|
-
case
|
|
96
|
+
case 1:
|
|
97
97
|
dataURI = _context.sent;
|
|
98
98
|
_this.setState({
|
|
99
99
|
selectedImageSource: dataURI
|
|
100
100
|
});
|
|
101
|
-
_context.next =
|
|
101
|
+
_context.next = 3;
|
|
102
102
|
break;
|
|
103
|
-
case
|
|
104
|
-
_context.prev =
|
|
105
|
-
|
|
106
|
-
case
|
|
103
|
+
case 2:
|
|
104
|
+
_context.prev = 2;
|
|
105
|
+
_t = _context["catch"](0);
|
|
106
|
+
case 3:
|
|
107
107
|
case "end":
|
|
108
108
|
return _context.stop();
|
|
109
109
|
}
|
|
110
|
-
}, _callee, null, [[0,
|
|
110
|
+
}, _callee, null, [[0, 2]]);
|
|
111
111
|
}));
|
|
112
112
|
return function (_x) {
|
|
113
113
|
return _ref.apply(this, arguments);
|
|
@@ -307,13 +307,13 @@ var ImageNavigator = exports.ImageNavigator = /*#__PURE__*/function (_Component)
|
|
|
307
307
|
value: function () {
|
|
308
308
|
var _readFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(imageFile) {
|
|
309
309
|
var onImageUploaded, _yield$Promise$all, _yield$Promise$all2, fileImageSource, imageOrientation;
|
|
310
|
-
return _regenerator.default.wrap(function
|
|
310
|
+
return _regenerator.default.wrap(function (_context) {
|
|
311
311
|
while (1) switch (_context.prev = _context.next) {
|
|
312
312
|
case 0:
|
|
313
313
|
onImageUploaded = this.props.onImageUploaded;
|
|
314
|
-
_context.next =
|
|
314
|
+
_context.next = 1;
|
|
315
315
|
return Promise.all([(0, _mediaUi.fileToDataURI)(imageFile), (0, _mediaUi.getOrientation)(imageFile)]);
|
|
316
|
-
case
|
|
316
|
+
case 1:
|
|
317
317
|
_yield$Promise$all = _context.sent;
|
|
318
318
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
|
|
319
319
|
fileImageSource = _yield$Promise$all2[0];
|
|
@@ -327,7 +327,7 @@ var ImageNavigator = exports.ImageNavigator = /*#__PURE__*/function (_Component)
|
|
|
327
327
|
imageFile: imageFile,
|
|
328
328
|
imageOrientation: imageOrientation
|
|
329
329
|
});
|
|
330
|
-
case
|
|
330
|
+
case 2:
|
|
331
331
|
case "end":
|
|
332
332
|
return _context.stop();
|
|
333
333
|
}
|
|
@@ -70,29 +70,29 @@ function initialiseImagePreview(_x, _x2, _x3) {
|
|
|
70
70
|
}
|
|
71
71
|
function _initialiseImagePreview() {
|
|
72
72
|
_initialiseImagePreview = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(fileInfo, containerRect, maxZoom) {
|
|
73
|
-
var orientation, img, result, _img, naturalWidth, naturalHeight, srcRect, maxRect, scaleFactor, scaledRect, imageWidth, imageHeight, canvasRect, _canvasRect, canvasWidth, canvasHeight;
|
|
74
|
-
return _regenerator.default.wrap(function
|
|
73
|
+
var orientation, img, result, _img, naturalWidth, naturalHeight, srcRect, maxRect, scaleFactor, scaledRect, imageWidth, imageHeight, canvasRect, _canvasRect, canvasWidth, canvasHeight, _t;
|
|
74
|
+
return _regenerator.default.wrap(function (_context) {
|
|
75
75
|
while (1) switch (_context.prev = _context.next) {
|
|
76
76
|
case 0:
|
|
77
77
|
orientation = 1;
|
|
78
78
|
_context.prev = 1;
|
|
79
|
-
_context.next =
|
|
79
|
+
_context.next = 2;
|
|
80
80
|
return Promise.all([(0, _mediaUi.getOrientation)(fileInfo.file), (0, _mediaUi.loadImage)(fileInfo.src)]);
|
|
81
|
-
case
|
|
81
|
+
case 2:
|
|
82
82
|
result = _context.sent;
|
|
83
83
|
if (!CSS.supports('image-orientation', 'from-image')) {
|
|
84
84
|
orientation = result[0];
|
|
85
85
|
}
|
|
86
86
|
img = result[1];
|
|
87
|
-
_context.next =
|
|
87
|
+
_context.next = 4;
|
|
88
88
|
break;
|
|
89
|
-
case
|
|
90
|
-
_context.prev =
|
|
91
|
-
|
|
89
|
+
case 3:
|
|
90
|
+
_context.prev = 3;
|
|
91
|
+
_t = _context["catch"](1);
|
|
92
92
|
return _context.abrupt("return", null);
|
|
93
|
-
case
|
|
93
|
+
case 4:
|
|
94
94
|
if (!img) {
|
|
95
|
-
_context.next =
|
|
95
|
+
_context.next = 5;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
_img = img, naturalWidth = _img.naturalWidth, naturalHeight = _img.naturalHeight;
|
|
@@ -114,13 +114,13 @@ function _initialiseImagePreview() {
|
|
|
114
114
|
width: canvasWidth,
|
|
115
115
|
height: canvasHeight
|
|
116
116
|
});
|
|
117
|
-
case
|
|
117
|
+
case 5:
|
|
118
118
|
return _context.abrupt("return", null);
|
|
119
|
-
case
|
|
119
|
+
case 6:
|
|
120
120
|
case "end":
|
|
121
121
|
return _context.stop();
|
|
122
122
|
}
|
|
123
|
-
}, _callee, null, [[1,
|
|
123
|
+
}, _callee, null, [[1, 3]]);
|
|
124
124
|
}));
|
|
125
125
|
return _initialiseImagePreview.apply(this, arguments);
|
|
126
126
|
}
|
|
@@ -264,15 +264,15 @@ var ImagePlacer = exports.ImagePlacer = /*#__PURE__*/function (_React$Component)
|
|
|
264
264
|
value: (function () {
|
|
265
265
|
var _UNSAFE_componentWillReceiveProps = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(nextProps) {
|
|
266
266
|
var imageSourceRect, state, props, zoom, currentUseConstraints, currentContainerWidth, currentContainerHeight, currentMargin, currentSrc, nextZoom, nextUseConstraints, nextContainerWidth, nextContainerHeight, nextMargin, nextSrc, nextOnImageActions, isZoomChange, isUseConstraintsChange, isContainerWidthChange, isContainerHeightChange, isMarginChange, isImageAction, zoomReset, fileInfo;
|
|
267
|
-
return _regenerator.default.wrap(function
|
|
267
|
+
return _regenerator.default.wrap(function (_context) {
|
|
268
268
|
while (1) switch (_context.prev = _context.next) {
|
|
269
269
|
case 0:
|
|
270
270
|
if (!(0, _platformFeatureFlags.fg)('platform_media_package_react19_lifecycle_fix')) {
|
|
271
|
-
_context.next =
|
|
271
|
+
_context.next = 1;
|
|
272
272
|
break;
|
|
273
273
|
}
|
|
274
274
|
return _context.abrupt("return");
|
|
275
|
-
case
|
|
275
|
+
case 1:
|
|
276
276
|
imageSourceRect = this.imageSourceRect, state = this.state, props = this.props;
|
|
277
277
|
zoom = state.zoom;
|
|
278
278
|
currentUseConstraints = props.useConstraints, currentContainerWidth = props.containerWidth, currentContainerHeight = props.containerHeight, currentMargin = props.margin, currentSrc = props.src;
|
|
@@ -301,34 +301,34 @@ var ImagePlacer = exports.ImagePlacer = /*#__PURE__*/function (_React$Component)
|
|
|
301
301
|
this.updateZoomProp();
|
|
302
302
|
}
|
|
303
303
|
if (!(nextSrc instanceof File && nextSrc !== currentSrc)) {
|
|
304
|
-
_context.next =
|
|
304
|
+
_context.next = 3;
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
|
-
_context.next =
|
|
307
|
+
_context.next = 2;
|
|
308
308
|
return (0, _mediaUi.getFileInfo)(nextSrc);
|
|
309
|
-
case
|
|
309
|
+
case 2:
|
|
310
310
|
fileInfo = _context.sent;
|
|
311
|
-
case
|
|
311
|
+
case 3:
|
|
312
312
|
if (!(typeof nextSrc === 'string' && nextSrc !== currentSrc)) {
|
|
313
|
-
_context.next =
|
|
313
|
+
_context.next = 5;
|
|
314
314
|
break;
|
|
315
315
|
}
|
|
316
|
-
_context.next =
|
|
316
|
+
_context.next = 4;
|
|
317
317
|
return (0, _mediaUi.getFileInfoFromSrc)(nextSrc);
|
|
318
|
-
case
|
|
318
|
+
case 4:
|
|
319
319
|
fileInfo = _context.sent;
|
|
320
|
-
case
|
|
320
|
+
case 5:
|
|
321
321
|
if (!fileInfo) {
|
|
322
|
-
_context.next =
|
|
322
|
+
_context.next = 6;
|
|
323
323
|
break;
|
|
324
324
|
}
|
|
325
|
-
_context.next =
|
|
325
|
+
_context.next = 6;
|
|
326
326
|
return this.preprocessFile(fileInfo);
|
|
327
|
-
case
|
|
327
|
+
case 6:
|
|
328
328
|
if (isImageAction) {
|
|
329
329
|
this.provideImageActions();
|
|
330
330
|
}
|
|
331
|
-
case
|
|
331
|
+
case 7:
|
|
332
332
|
case "end":
|
|
333
333
|
return _context.stop();
|
|
334
334
|
}
|
|
@@ -344,15 +344,15 @@ var ImagePlacer = exports.ImagePlacer = /*#__PURE__*/function (_React$Component)
|
|
|
344
344
|
value: function () {
|
|
345
345
|
var _componentDidUpdate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(prevProps) {
|
|
346
346
|
var imageSourceRect, props, nextZoom, nextUseConstraints, nextContainerWidth, nextContainerHeight, nextMargin, nextSrc, nextOnImageActions, prevZoom, prevUseConstraints, prevContainerWidth, prevContainerHeight, prevMargin, prevSrc, prevOnImageActions, isZoomChange, isUseConstraintsChange, isContainerWidthChange, isContainerHeightChange, isMarginChange, isImageActionChange, zoomReset, fileInfo;
|
|
347
|
-
return _regenerator.default.wrap(function
|
|
347
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
348
348
|
while (1) switch (_context2.prev = _context2.next) {
|
|
349
349
|
case 0:
|
|
350
350
|
if ((0, _platformFeatureFlags.fg)('platform_media_package_react19_lifecycle_fix')) {
|
|
351
|
-
_context2.next =
|
|
351
|
+
_context2.next = 1;
|
|
352
352
|
break;
|
|
353
353
|
}
|
|
354
354
|
return _context2.abrupt("return");
|
|
355
|
-
case
|
|
355
|
+
case 1:
|
|
356
356
|
imageSourceRect = this.imageSourceRect, props = this.props;
|
|
357
357
|
nextZoom = props.zoom, nextUseConstraints = props.useConstraints, nextContainerWidth = props.containerWidth, nextContainerHeight = props.containerHeight, nextMargin = props.margin, nextSrc = props.src, nextOnImageActions = props.onImageActions;
|
|
358
358
|
prevZoom = prevProps.zoom, prevUseConstraints = prevProps.useConstraints, prevContainerWidth = prevProps.containerWidth, prevContainerHeight = prevProps.containerHeight, prevMargin = prevProps.margin, prevSrc = prevProps.src, prevOnImageActions = prevProps.onImageActions;
|
|
@@ -380,38 +380,38 @@ var ImagePlacer = exports.ImagePlacer = /*#__PURE__*/function (_React$Component)
|
|
|
380
380
|
this.updateZoomProp();
|
|
381
381
|
}
|
|
382
382
|
if (!(nextSrc !== prevSrc)) {
|
|
383
|
-
_context2.next =
|
|
383
|
+
_context2.next = 6;
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
if (!(nextSrc instanceof File)) {
|
|
387
|
-
_context2.next =
|
|
387
|
+
_context2.next = 3;
|
|
388
388
|
break;
|
|
389
389
|
}
|
|
390
|
-
_context2.next =
|
|
390
|
+
_context2.next = 2;
|
|
391
391
|
return (0, _mediaUi.getFileInfo)(nextSrc);
|
|
392
|
-
case
|
|
392
|
+
case 2:
|
|
393
393
|
fileInfo = _context2.sent;
|
|
394
|
-
case
|
|
394
|
+
case 3:
|
|
395
395
|
if (!(typeof nextSrc === 'string')) {
|
|
396
|
-
_context2.next =
|
|
396
|
+
_context2.next = 5;
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
|
-
_context2.next =
|
|
399
|
+
_context2.next = 4;
|
|
400
400
|
return (0, _mediaUi.getFileInfoFromSrc)(nextSrc);
|
|
401
|
-
case
|
|
401
|
+
case 4:
|
|
402
402
|
fileInfo = _context2.sent;
|
|
403
|
-
case
|
|
403
|
+
case 5:
|
|
404
404
|
if (!fileInfo) {
|
|
405
|
-
_context2.next =
|
|
405
|
+
_context2.next = 6;
|
|
406
406
|
break;
|
|
407
407
|
}
|
|
408
|
-
_context2.next =
|
|
408
|
+
_context2.next = 6;
|
|
409
409
|
return this.preprocessFile(fileInfo);
|
|
410
|
-
case
|
|
410
|
+
case 6:
|
|
411
411
|
if (isImageActionChange) {
|
|
412
412
|
this.provideImageActions();
|
|
413
413
|
}
|
|
414
|
-
case
|
|
414
|
+
case 7:
|
|
415
415
|
case "end":
|
|
416
416
|
return _context2.stop();
|
|
417
417
|
}
|
|
@@ -427,13 +427,13 @@ var ImagePlacer = exports.ImagePlacer = /*#__PURE__*/function (_React$Component)
|
|
|
427
427
|
value: function () {
|
|
428
428
|
var _preprocessFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(fileInfo) {
|
|
429
429
|
var maxZoom, previewInfo, width, height;
|
|
430
|
-
return _regenerator.default.wrap(function
|
|
430
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
431
431
|
while (1) switch (_context3.prev = _context3.next) {
|
|
432
432
|
case 0:
|
|
433
433
|
maxZoom = this.props.maxZoom;
|
|
434
|
-
_context3.next =
|
|
434
|
+
_context3.next = 1;
|
|
435
435
|
return (0, _imageProcessor.initialiseImagePreview)(fileInfo, this.containerRect, maxZoom);
|
|
436
|
-
case
|
|
436
|
+
case 1:
|
|
437
437
|
previewInfo = _context3.sent;
|
|
438
438
|
if (previewInfo) {
|
|
439
439
|
width = previewInfo.width, height = previewInfo.height;
|
|
@@ -445,7 +445,7 @@ var ImagePlacer = exports.ImagePlacer = /*#__PURE__*/function (_React$Component)
|
|
|
445
445
|
errorMessage: 'Cannot load image'
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
|
-
case
|
|
448
|
+
case 2:
|
|
449
449
|
case "end":
|
|
450
450
|
return _context3.stop();
|
|
451
451
|
}
|
|
@@ -76,31 +76,31 @@ export var AvatarPickerDialog = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
76
|
});
|
|
77
77
|
_defineProperty(_this, "setSelectedImageState", /*#__PURE__*/function () {
|
|
78
78
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(selectedImage) {
|
|
79
|
-
var dataURI;
|
|
80
|
-
return _regeneratorRuntime.wrap(function
|
|
79
|
+
var dataURI, _t;
|
|
80
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
81
81
|
while (1) switch (_context.prev = _context.next) {
|
|
82
82
|
case 0:
|
|
83
83
|
_context.prev = 0;
|
|
84
84
|
_this.setState({
|
|
85
85
|
selectedImage: selectedImage
|
|
86
86
|
});
|
|
87
|
-
_context.next =
|
|
87
|
+
_context.next = 1;
|
|
88
88
|
return fileToDataURI(selectedImage);
|
|
89
|
-
case
|
|
89
|
+
case 1:
|
|
90
90
|
dataURI = _context.sent;
|
|
91
91
|
_this.setState({
|
|
92
92
|
selectedImageSource: dataURI
|
|
93
93
|
});
|
|
94
|
-
_context.next =
|
|
94
|
+
_context.next = 3;
|
|
95
95
|
break;
|
|
96
|
-
case
|
|
97
|
-
_context.prev =
|
|
98
|
-
|
|
99
|
-
case
|
|
96
|
+
case 2:
|
|
97
|
+
_context.prev = 2;
|
|
98
|
+
_t = _context["catch"](0);
|
|
99
|
+
case 3:
|
|
100
100
|
case "end":
|
|
101
101
|
return _context.stop();
|
|
102
102
|
}
|
|
103
|
-
}, _callee, null, [[0,
|
|
103
|
+
}, _callee, null, [[0, 2]]);
|
|
104
104
|
}));
|
|
105
105
|
return function (_x) {
|
|
106
106
|
return _ref.apply(this, arguments);
|
|
@@ -299,13 +299,13 @@ export var ImageNavigator = /*#__PURE__*/function (_Component) {
|
|
|
299
299
|
value: function () {
|
|
300
300
|
var _readFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(imageFile) {
|
|
301
301
|
var onImageUploaded, _yield$Promise$all, _yield$Promise$all2, fileImageSource, imageOrientation;
|
|
302
|
-
return _regeneratorRuntime.wrap(function
|
|
302
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
303
303
|
while (1) switch (_context.prev = _context.next) {
|
|
304
304
|
case 0:
|
|
305
305
|
onImageUploaded = this.props.onImageUploaded;
|
|
306
|
-
_context.next =
|
|
306
|
+
_context.next = 1;
|
|
307
307
|
return Promise.all([fileToDataURI(imageFile), getOrientation(imageFile)]);
|
|
308
|
-
case
|
|
308
|
+
case 1:
|
|
309
309
|
_yield$Promise$all = _context.sent;
|
|
310
310
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
311
311
|
fileImageSource = _yield$Promise$all2[0];
|
|
@@ -319,7 +319,7 @@ export var ImageNavigator = /*#__PURE__*/function (_Component) {
|
|
|
319
319
|
imageFile: imageFile,
|
|
320
320
|
imageOrientation: imageOrientation
|
|
321
321
|
});
|
|
322
|
-
case
|
|
322
|
+
case 2:
|
|
323
323
|
case "end":
|
|
324
324
|
return _context.stop();
|
|
325
325
|
}
|
|
@@ -60,29 +60,29 @@ export function initialiseImagePreview(_x, _x2, _x3) {
|
|
|
60
60
|
}
|
|
61
61
|
function _initialiseImagePreview() {
|
|
62
62
|
_initialiseImagePreview = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileInfo, containerRect, maxZoom) {
|
|
63
|
-
var orientation, img, result, _img, naturalWidth, naturalHeight, srcRect, maxRect, scaleFactor, scaledRect, imageWidth, imageHeight, canvasRect, _canvasRect, canvasWidth, canvasHeight;
|
|
64
|
-
return _regeneratorRuntime.wrap(function
|
|
63
|
+
var orientation, img, result, _img, naturalWidth, naturalHeight, srcRect, maxRect, scaleFactor, scaledRect, imageWidth, imageHeight, canvasRect, _canvasRect, canvasWidth, canvasHeight, _t;
|
|
64
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
65
65
|
while (1) switch (_context.prev = _context.next) {
|
|
66
66
|
case 0:
|
|
67
67
|
orientation = 1;
|
|
68
68
|
_context.prev = 1;
|
|
69
|
-
_context.next =
|
|
69
|
+
_context.next = 2;
|
|
70
70
|
return Promise.all([getOrientation(fileInfo.file), loadImage(fileInfo.src)]);
|
|
71
|
-
case
|
|
71
|
+
case 2:
|
|
72
72
|
result = _context.sent;
|
|
73
73
|
if (!CSS.supports('image-orientation', 'from-image')) {
|
|
74
74
|
orientation = result[0];
|
|
75
75
|
}
|
|
76
76
|
img = result[1];
|
|
77
|
-
_context.next =
|
|
77
|
+
_context.next = 4;
|
|
78
78
|
break;
|
|
79
|
-
case
|
|
80
|
-
_context.prev =
|
|
81
|
-
|
|
79
|
+
case 3:
|
|
80
|
+
_context.prev = 3;
|
|
81
|
+
_t = _context["catch"](1);
|
|
82
82
|
return _context.abrupt("return", null);
|
|
83
|
-
case
|
|
83
|
+
case 4:
|
|
84
84
|
if (!img) {
|
|
85
|
-
_context.next =
|
|
85
|
+
_context.next = 5;
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
_img = img, naturalWidth = _img.naturalWidth, naturalHeight = _img.naturalHeight;
|
|
@@ -104,13 +104,13 @@ function _initialiseImagePreview() {
|
|
|
104
104
|
width: canvasWidth,
|
|
105
105
|
height: canvasHeight
|
|
106
106
|
});
|
|
107
|
-
case
|
|
107
|
+
case 5:
|
|
108
108
|
return _context.abrupt("return", null);
|
|
109
|
-
case
|
|
109
|
+
case 6:
|
|
110
110
|
case "end":
|
|
111
111
|
return _context.stop();
|
|
112
112
|
}
|
|
113
|
-
}, _callee, null, [[1,
|
|
113
|
+
}, _callee, null, [[1, 3]]);
|
|
114
114
|
}));
|
|
115
115
|
return _initialiseImagePreview.apply(this, arguments);
|
|
116
116
|
}
|