@atlaskit/editor-common 74.21.4 → 74.23.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/CHANGELOG.md +12 -0
- package/dist/cjs/guideline/fixedGuideline.js +65 -0
- package/dist/cjs/guideline/index.js +21 -1
- package/dist/cjs/guideline/updateGuideline.js +29 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/MediaSingle/index.js +11 -7
- package/dist/cjs/ui/MediaSingle/styled.js +2 -1
- package/dist/cjs/ui/MediaSingle/types.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/guideline/fixedGuideline.js +53 -0
- package/dist/es2019/guideline/index.js +3 -1
- package/dist/es2019/guideline/updateGuideline.js +17 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +11 -7
- package/dist/es2019/ui/MediaSingle/styled.js +2 -1
- package/dist/es2019/ui/MediaSingle/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/guideline/fixedGuideline.js +56 -0
- package/dist/esm/guideline/index.js +3 -1
- package/dist/esm/guideline/updateGuideline.js +21 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/MediaSingle/index.js +11 -7
- package/dist/esm/ui/MediaSingle/styled.js +2 -1
- package/dist/esm/ui/MediaSingle/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/guideline/fixedGuideline.d.ts +29 -0
- package/dist/types/guideline/index.d.ts +2 -0
- package/dist/types/guideline/types.d.ts +5 -0
- package/dist/types/guideline/updateGuideline.d.ts +5 -0
- package/dist/types/resizer/Resizer.d.ts +5 -0
- package/dist/types/ui/MediaSingle/index.d.ts +9 -1
- package/dist/types/ui/MediaSingle/styled.d.ts +7 -1
- package/dist/types/ui/MediaSingle/types.d.ts +12 -0
- package/dist/types/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/guideline/fixedGuideline.d.ts +29 -0
- package/dist/types-ts4.5/guideline/index.d.ts +2 -0
- package/dist/types-ts4.5/guideline/types.d.ts +5 -0
- package/dist/types-ts4.5/guideline/updateGuideline.d.ts +5 -0
- package/dist/types-ts4.5/resizer/Resizer.d.ts +5 -0
- package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +9 -1
- package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +7 -1
- package/dist/types-ts4.5/ui/MediaSingle/types.d.ts +12 -0
- package/dist/types-ts4.5/ui/index.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 74.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5f028fb62a1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f028fb62a1) - ED-19038 added mediaSingle.widthType support to renderer.
|
|
8
|
+
|
|
9
|
+
## 74.22.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`464745a92e6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/464745a92e6) - [ux] Updated the Editor Table plugin to use the new guidelines plugin when custom-table-widths FF is enabled
|
|
14
|
+
|
|
3
15
|
## 74.21.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createGuidesFromLengths = exports.createFixedGuidelinesFromLengths = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
/**
|
|
10
|
+
* This creates a collection of points relative to the center line of each supplied length. For example; a length of
|
|
11
|
+
* 100 centered to 0 would result in the left position of -50 and a right position of +50.
|
|
12
|
+
*
|
|
13
|
+
* Length values should be unique, as duplicates will be trimmed from the result.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* createGuidelinesFromLengths([100, 200, 200, -200, 201]) => [
|
|
17
|
+
* {left: -50, right: 50, length: 100},
|
|
18
|
+
* {left: -100, right: 100, length: 200},
|
|
19
|
+
* {left: 100, right: -100, length: -200},
|
|
20
|
+
* {left: -100.5, right: 100.5, length: 201},
|
|
21
|
+
* ]
|
|
22
|
+
*
|
|
23
|
+
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
24
|
+
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
25
|
+
*/
|
|
26
|
+
var createGuidesFromLengths = function createGuidesFromLengths(lengths) {
|
|
27
|
+
return Array.from(new Set(lengths)).reduce(function (acc, length) {
|
|
28
|
+
var h = length * 0.5;
|
|
29
|
+
if (!h || !Number.isFinite(length)) {
|
|
30
|
+
// Filter out nonsensical values, like 0
|
|
31
|
+
return acc;
|
|
32
|
+
}
|
|
33
|
+
return [].concat((0, _toConsumableArray2.default)(acc), [{
|
|
34
|
+
left: -h,
|
|
35
|
+
right: h,
|
|
36
|
+
length: length
|
|
37
|
+
}]);
|
|
38
|
+
}, []);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
43
|
+
* Each length value generates a guideline config for both the left and right side of the length.
|
|
44
|
+
*/
|
|
45
|
+
exports.createGuidesFromLengths = createGuidesFromLengths;
|
|
46
|
+
var createFixedGuidelinesFromLengths = function createFixedGuidelinesFromLengths(lengths) {
|
|
47
|
+
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'guide';
|
|
48
|
+
return createGuidesFromLengths(lengths).reduce(function (acc, _ref) {
|
|
49
|
+
var left = _ref.left,
|
|
50
|
+
right = _ref.right,
|
|
51
|
+
length = _ref.length;
|
|
52
|
+
return [].concat((0, _toConsumableArray2.default)(acc), [{
|
|
53
|
+
key: "".concat(key, "-").concat(length, "-left"),
|
|
54
|
+
position: {
|
|
55
|
+
x: left
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "".concat(key, "-").concat(length, "-right"),
|
|
59
|
+
position: {
|
|
60
|
+
x: right
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
}, []);
|
|
64
|
+
};
|
|
65
|
+
exports.createFixedGuidelinesFromLengths = createFixedGuidelinesFromLengths;
|
|
@@ -3,10 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "createFixedGuidelinesFromLengths", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _fixedGuideline.createFixedGuidelinesFromLengths;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createGuidesFromLengths", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _fixedGuideline.createGuidesFromLengths;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
6
18
|
Object.defineProperty(exports, "generateDynamicGuidelines", {
|
|
7
19
|
enumerable: true,
|
|
8
20
|
get: function get() {
|
|
9
21
|
return _dynamicGuideline.generateDynamicGuidelines;
|
|
10
22
|
}
|
|
11
23
|
});
|
|
12
|
-
|
|
24
|
+
Object.defineProperty(exports, "getGuidelinesWithHighlights", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _updateGuideline.getGuidelinesWithHighlights;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _dynamicGuideline = require("./dynamicGuideline");
|
|
31
|
+
var _fixedGuideline = require("./fixedGuideline");
|
|
32
|
+
var _updateGuideline = require("./updateGuideline");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getGuidelinesWithHighlights = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
var activeGuidelineStyle = function activeGuidelineStyle(guideline) {
|
|
12
|
+
return _objectSpread(_objectSpread({}, guideline), {}, {
|
|
13
|
+
active: true,
|
|
14
|
+
show: true
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var getGuidelinesWithHighlights = function getGuidelinesWithHighlights(gap, maxGap, activeGuidelineKeys, guidelines) {
|
|
18
|
+
if (activeGuidelineKeys.length) {
|
|
19
|
+
return guidelines.map(function (guideline) {
|
|
20
|
+
if (activeGuidelineKeys.includes(guideline.key) && gap < maxGap) {
|
|
21
|
+
return activeGuidelineStyle(guideline);
|
|
22
|
+
}
|
|
23
|
+
return guideline;
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
return guidelines;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.getGuidelinesWithHighlights = getGuidelinesWithHighlights;
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "74.
|
|
19
|
+
var packageVersion = "74.23.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "74.
|
|
27
|
+
var packageVersion = "74.23.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -40,6 +40,7 @@ function MediaSingle(_ref) {
|
|
|
40
40
|
_ref$isLoading = _ref.isLoading,
|
|
41
41
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
42
42
|
pctWidth = _ref.pctWidth,
|
|
43
|
+
size = _ref.size,
|
|
43
44
|
className = _ref.className,
|
|
44
45
|
propsChildren = _ref.children,
|
|
45
46
|
_ref$nodeType = _ref.nodeType,
|
|
@@ -49,16 +50,18 @@ function MediaSingle(_ref) {
|
|
|
49
50
|
_ref$hasFallbackConta = _ref.hasFallbackContainer,
|
|
50
51
|
hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
|
|
51
52
|
handleMediaSingleRef = _ref.handleMediaSingleRef;
|
|
53
|
+
var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
|
|
54
|
+
var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
|
|
52
55
|
var children = _react.default.Children.toArray(propsChildren);
|
|
53
|
-
if (!
|
|
54
|
-
|
|
56
|
+
if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
|
|
57
|
+
mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
|
|
55
58
|
}
|
|
56
59
|
// When width is not set we have an absolute height for a given embed.
|
|
57
60
|
// When both width and height are set we use them to determine ratio and use that to define
|
|
58
61
|
// embed height in relation to whatever width of an dom element is in runtime
|
|
59
62
|
var isHeightOnly = width === undefined;
|
|
60
|
-
if (
|
|
61
|
-
var pxWidth = Math.ceil((0, _grid.calcPxFromPct)(
|
|
63
|
+
if (mediaSingleWidth) {
|
|
64
|
+
var pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil((0, _grid.calcPxFromPct)(mediaSingleWidth / 100, lineLength || containerWidth || 0));
|
|
62
65
|
if (isHeightOnly) {
|
|
63
66
|
width = pxWidth - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide;
|
|
64
67
|
} else if (width !== undefined) {
|
|
@@ -66,7 +69,7 @@ function MediaSingle(_ref) {
|
|
|
66
69
|
width = pxWidth;
|
|
67
70
|
}
|
|
68
71
|
} else if (isHeightOnly) {
|
|
69
|
-
// No
|
|
72
|
+
// No mediaSingleWidth can be found on already existing pages with existing embeds
|
|
70
73
|
|
|
71
74
|
// It's ok to use Embed specific width, because width can be not set only in embed card.
|
|
72
75
|
// This value will be used only in the case of non `wide` and non `full-width` cases inside MediaSingleDimensionHelper.
|
|
@@ -102,11 +105,12 @@ function MediaSingle(_ref) {
|
|
|
102
105
|
width: width,
|
|
103
106
|
layout: layout,
|
|
104
107
|
containerWidth: containerWidth,
|
|
105
|
-
|
|
108
|
+
mediaSingleWidth: mediaSingleWidth,
|
|
106
109
|
fullWidthMode: fullWidthMode
|
|
107
110
|
}),
|
|
108
111
|
"data-layout": layout,
|
|
109
|
-
"data-width":
|
|
112
|
+
"data-width": mediaSingleWidth,
|
|
113
|
+
"data-width-type": (size === null || size === void 0 ? void 0 : size.widthType) || 'percentage',
|
|
110
114
|
"data-node-type": nodeType,
|
|
111
115
|
className: (0, _classnames.default)('rich-media-item mediaSingleView-content-wrap', "image-".concat(layout), className, {
|
|
112
116
|
'is-loading': isLoading,
|
|
@@ -118,8 +118,9 @@ var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref) {
|
|
|
118
118
|
isResized = _ref.isResized,
|
|
119
119
|
layout = _ref.layout,
|
|
120
120
|
pctWidth = _ref.pctWidth,
|
|
121
|
+
mediaSingleWidth = _ref.mediaSingleWidth,
|
|
121
122
|
width = _ref.width;
|
|
122
|
-
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
123
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
123
124
|
};
|
|
124
125
|
exports.MediaSingleDimensionHelper = MediaSingleDimensionHelper;
|
|
125
126
|
var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This creates a collection of points relative to the center line of each supplied length. For example; a length of
|
|
3
|
+
* 100 centered to 0 would result in the left position of -50 and a right position of +50.
|
|
4
|
+
*
|
|
5
|
+
* Length values should be unique, as duplicates will be trimmed from the result.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* createGuidelinesFromLengths([100, 200, 200, -200, 201]) => [
|
|
9
|
+
* {left: -50, right: 50, length: 100},
|
|
10
|
+
* {left: -100, right: 100, length: 200},
|
|
11
|
+
* {left: 100, right: -100, length: -200},
|
|
12
|
+
* {left: -100.5, right: 100.5, length: 201},
|
|
13
|
+
* ]
|
|
14
|
+
*
|
|
15
|
+
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
16
|
+
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
17
|
+
*/
|
|
18
|
+
export const createGuidesFromLengths = lengths => {
|
|
19
|
+
return Array.from(new Set(lengths)).reduce((acc, length) => {
|
|
20
|
+
const h = length * 0.5;
|
|
21
|
+
if (!h || !Number.isFinite(length)) {
|
|
22
|
+
// Filter out nonsensical values, like 0
|
|
23
|
+
return acc;
|
|
24
|
+
}
|
|
25
|
+
return [...acc, {
|
|
26
|
+
left: -h,
|
|
27
|
+
right: h,
|
|
28
|
+
length
|
|
29
|
+
}];
|
|
30
|
+
}, []);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
35
|
+
* Each length value generates a guideline config for both the left and right side of the length.
|
|
36
|
+
*/
|
|
37
|
+
export const createFixedGuidelinesFromLengths = (lengths, key = 'guide') => {
|
|
38
|
+
return createGuidesFromLengths(lengths).reduce((acc, {
|
|
39
|
+
left,
|
|
40
|
+
right,
|
|
41
|
+
length
|
|
42
|
+
}) => [...acc, {
|
|
43
|
+
key: `${key}-${length}-left`,
|
|
44
|
+
position: {
|
|
45
|
+
x: left
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: `${key}-${length}-right`,
|
|
49
|
+
position: {
|
|
50
|
+
x: right
|
|
51
|
+
}
|
|
52
|
+
}], []);
|
|
53
|
+
};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { generateDynamicGuidelines } from './dynamicGuideline';
|
|
1
|
+
export { generateDynamicGuidelines } from './dynamicGuideline';
|
|
2
|
+
export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fixedGuideline';
|
|
3
|
+
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const activeGuidelineStyle = guideline => ({
|
|
2
|
+
...guideline,
|
|
3
|
+
active: true,
|
|
4
|
+
show: true
|
|
5
|
+
});
|
|
6
|
+
export const getGuidelinesWithHighlights = (gap, maxGap, activeGuidelineKeys, guidelines) => {
|
|
7
|
+
if (activeGuidelineKeys.length) {
|
|
8
|
+
return guidelines.map(guideline => {
|
|
9
|
+
if (activeGuidelineKeys.includes(guideline.key) && gap < maxGap) {
|
|
10
|
+
return activeGuidelineStyle(guideline);
|
|
11
|
+
}
|
|
12
|
+
return guideline;
|
|
13
|
+
});
|
|
14
|
+
} else {
|
|
15
|
+
return guidelines;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "74.
|
|
3
|
+
const packageVersion = "74.23.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
8
8
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
9
9
|
import Layer from '../Layer';
|
|
10
10
|
const packageName = "@atlaskit/editor-common";
|
|
11
|
-
const packageVersion = "74.
|
|
11
|
+
const packageVersion = "74.23.0";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = '0, 8';
|
|
14
14
|
class DropList extends Component {
|
|
@@ -23,6 +23,7 @@ export default function MediaSingle({
|
|
|
23
23
|
containerWidth = width,
|
|
24
24
|
isLoading = false,
|
|
25
25
|
pctWidth,
|
|
26
|
+
size,
|
|
26
27
|
className,
|
|
27
28
|
children: propsChildren,
|
|
28
29
|
nodeType = 'mediaSingle',
|
|
@@ -31,16 +32,18 @@ export default function MediaSingle({
|
|
|
31
32
|
hasFallbackContainer = true,
|
|
32
33
|
handleMediaSingleRef
|
|
33
34
|
}) {
|
|
35
|
+
const isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
|
|
36
|
+
let mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
|
|
34
37
|
const children = React.Children.toArray(propsChildren);
|
|
35
|
-
if (!
|
|
36
|
-
|
|
38
|
+
if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
|
|
39
|
+
mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
|
|
37
40
|
}
|
|
38
41
|
// When width is not set we have an absolute height for a given embed.
|
|
39
42
|
// When both width and height are set we use them to determine ratio and use that to define
|
|
40
43
|
// embed height in relation to whatever width of an dom element is in runtime
|
|
41
44
|
const isHeightOnly = width === undefined;
|
|
42
|
-
if (
|
|
43
|
-
const pxWidth = Math.ceil(calcPxFromPct(
|
|
45
|
+
if (mediaSingleWidth) {
|
|
46
|
+
const pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil(calcPxFromPct(mediaSingleWidth / 100, lineLength || containerWidth || 0));
|
|
44
47
|
if (isHeightOnly) {
|
|
45
48
|
width = pxWidth - akEditorMediaResizeHandlerPaddingWide;
|
|
46
49
|
} else if (width !== undefined) {
|
|
@@ -48,7 +51,7 @@ export default function MediaSingle({
|
|
|
48
51
|
width = pxWidth;
|
|
49
52
|
}
|
|
50
53
|
} else if (isHeightOnly) {
|
|
51
|
-
// No
|
|
54
|
+
// No mediaSingleWidth can be found on already existing pages with existing embeds
|
|
52
55
|
|
|
53
56
|
// It's ok to use Embed specific width, because width can be not set only in embed card.
|
|
54
57
|
// This value will be used only in the case of non `wide` and non `full-width` cases inside MediaSingleDimensionHelper.
|
|
@@ -82,11 +85,12 @@ export default function MediaSingle({
|
|
|
82
85
|
width,
|
|
83
86
|
layout,
|
|
84
87
|
containerWidth,
|
|
85
|
-
|
|
88
|
+
mediaSingleWidth,
|
|
86
89
|
fullWidthMode
|
|
87
90
|
}),
|
|
88
91
|
"data-layout": layout,
|
|
89
|
-
"data-width":
|
|
92
|
+
"data-width": mediaSingleWidth,
|
|
93
|
+
"data-width-type": (size === null || size === void 0 ? void 0 : size.widthType) || 'percentage',
|
|
90
94
|
"data-node-type": nodeType,
|
|
91
95
|
className: classnames('rich-media-item mediaSingleView-content-wrap', `image-${layout}`, className, {
|
|
92
96
|
'is-loading': isLoading,
|
|
@@ -99,6 +99,7 @@ export const MediaSingleDimensionHelper = ({
|
|
|
99
99
|
isResized,
|
|
100
100
|
layout,
|
|
101
101
|
pctWidth,
|
|
102
|
+
mediaSingleWidth,
|
|
102
103
|
width
|
|
103
104
|
}) => css`
|
|
104
105
|
/* For nested rich media items, set max-width to 100% */
|
|
@@ -108,7 +109,7 @@ export const MediaSingleDimensionHelper = ({
|
|
|
108
109
|
max-width: 100%;
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
width: ${pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized)};
|
|
112
|
+
width: ${mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized)};
|
|
112
113
|
${layout === 'full-width' && css`
|
|
113
114
|
min-width: 100%;
|
|
114
115
|
`}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
/**
|
|
3
|
+
* This creates a collection of points relative to the center line of each supplied length. For example; a length of
|
|
4
|
+
* 100 centered to 0 would result in the left position of -50 and a right position of +50.
|
|
5
|
+
*
|
|
6
|
+
* Length values should be unique, as duplicates will be trimmed from the result.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* createGuidelinesFromLengths([100, 200, 200, -200, 201]) => [
|
|
10
|
+
* {left: -50, right: 50, length: 100},
|
|
11
|
+
* {left: -100, right: 100, length: 200},
|
|
12
|
+
* {left: 100, right: -100, length: -200},
|
|
13
|
+
* {left: -100.5, right: 100.5, length: 201},
|
|
14
|
+
* ]
|
|
15
|
+
*
|
|
16
|
+
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
17
|
+
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
18
|
+
*/
|
|
19
|
+
export var createGuidesFromLengths = function createGuidesFromLengths(lengths) {
|
|
20
|
+
return Array.from(new Set(lengths)).reduce(function (acc, length) {
|
|
21
|
+
var h = length * 0.5;
|
|
22
|
+
if (!h || !Number.isFinite(length)) {
|
|
23
|
+
// Filter out nonsensical values, like 0
|
|
24
|
+
return acc;
|
|
25
|
+
}
|
|
26
|
+
return [].concat(_toConsumableArray(acc), [{
|
|
27
|
+
left: -h,
|
|
28
|
+
right: h,
|
|
29
|
+
length: length
|
|
30
|
+
}]);
|
|
31
|
+
}, []);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
36
|
+
* Each length value generates a guideline config for both the left and right side of the length.
|
|
37
|
+
*/
|
|
38
|
+
export var createFixedGuidelinesFromLengths = function createFixedGuidelinesFromLengths(lengths) {
|
|
39
|
+
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'guide';
|
|
40
|
+
return createGuidesFromLengths(lengths).reduce(function (acc, _ref) {
|
|
41
|
+
var left = _ref.left,
|
|
42
|
+
right = _ref.right,
|
|
43
|
+
length = _ref.length;
|
|
44
|
+
return [].concat(_toConsumableArray(acc), [{
|
|
45
|
+
key: "".concat(key, "-").concat(length, "-left"),
|
|
46
|
+
position: {
|
|
47
|
+
x: left
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "".concat(key, "-").concat(length, "-right"),
|
|
51
|
+
position: {
|
|
52
|
+
x: right
|
|
53
|
+
}
|
|
54
|
+
}]);
|
|
55
|
+
}, []);
|
|
56
|
+
};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { generateDynamicGuidelines } from './dynamicGuideline';
|
|
1
|
+
export { generateDynamicGuidelines } from './dynamicGuideline';
|
|
2
|
+
export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fixedGuideline';
|
|
3
|
+
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
var activeGuidelineStyle = function activeGuidelineStyle(guideline) {
|
|
5
|
+
return _objectSpread(_objectSpread({}, guideline), {}, {
|
|
6
|
+
active: true,
|
|
7
|
+
show: true
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export var getGuidelinesWithHighlights = function getGuidelinesWithHighlights(gap, maxGap, activeGuidelineKeys, guidelines) {
|
|
11
|
+
if (activeGuidelineKeys.length) {
|
|
12
|
+
return guidelines.map(function (guideline) {
|
|
13
|
+
if (activeGuidelineKeys.includes(guideline.key) && gap < maxGap) {
|
|
14
|
+
return activeGuidelineStyle(guideline);
|
|
15
|
+
}
|
|
16
|
+
return guideline;
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
return guidelines;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.23.0";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
18
18
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
19
19
|
import Layer from '../Layer';
|
|
20
20
|
var packageName = "@atlaskit/editor-common";
|
|
21
|
-
var packageVersion = "74.
|
|
21
|
+
var packageVersion = "74.23.0";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = '0, 8';
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -26,6 +26,7 @@ export default function MediaSingle(_ref) {
|
|
|
26
26
|
_ref$isLoading = _ref.isLoading,
|
|
27
27
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
28
28
|
pctWidth = _ref.pctWidth,
|
|
29
|
+
size = _ref.size,
|
|
29
30
|
className = _ref.className,
|
|
30
31
|
propsChildren = _ref.children,
|
|
31
32
|
_ref$nodeType = _ref.nodeType,
|
|
@@ -35,16 +36,18 @@ export default function MediaSingle(_ref) {
|
|
|
35
36
|
_ref$hasFallbackConta = _ref.hasFallbackContainer,
|
|
36
37
|
hasFallbackContainer = _ref$hasFallbackConta === void 0 ? true : _ref$hasFallbackConta,
|
|
37
38
|
handleMediaSingleRef = _ref.handleMediaSingleRef;
|
|
39
|
+
var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
|
|
40
|
+
var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
|
|
38
41
|
var children = React.Children.toArray(propsChildren);
|
|
39
|
-
if (!
|
|
40
|
-
|
|
42
|
+
if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, lineLength)) {
|
|
43
|
+
mediaSingleWidth = isPixelWidth ? lineLength / 2 : 50;
|
|
41
44
|
}
|
|
42
45
|
// When width is not set we have an absolute height for a given embed.
|
|
43
46
|
// When both width and height are set we use them to determine ratio and use that to define
|
|
44
47
|
// embed height in relation to whatever width of an dom element is in runtime
|
|
45
48
|
var isHeightOnly = width === undefined;
|
|
46
|
-
if (
|
|
47
|
-
var pxWidth = Math.ceil(calcPxFromPct(
|
|
49
|
+
if (mediaSingleWidth) {
|
|
50
|
+
var pxWidth = isPixelWidth ? mediaSingleWidth : Math.ceil(calcPxFromPct(mediaSingleWidth / 100, lineLength || containerWidth || 0));
|
|
48
51
|
if (isHeightOnly) {
|
|
49
52
|
width = pxWidth - akEditorMediaResizeHandlerPaddingWide;
|
|
50
53
|
} else if (width !== undefined) {
|
|
@@ -52,7 +55,7 @@ export default function MediaSingle(_ref) {
|
|
|
52
55
|
width = pxWidth;
|
|
53
56
|
}
|
|
54
57
|
} else if (isHeightOnly) {
|
|
55
|
-
// No
|
|
58
|
+
// No mediaSingleWidth can be found on already existing pages with existing embeds
|
|
56
59
|
|
|
57
60
|
// It's ok to use Embed specific width, because width can be not set only in embed card.
|
|
58
61
|
// This value will be used only in the case of non `wide` and non `full-width` cases inside MediaSingleDimensionHelper.
|
|
@@ -88,11 +91,12 @@ export default function MediaSingle(_ref) {
|
|
|
88
91
|
width: width,
|
|
89
92
|
layout: layout,
|
|
90
93
|
containerWidth: containerWidth,
|
|
91
|
-
|
|
94
|
+
mediaSingleWidth: mediaSingleWidth,
|
|
92
95
|
fullWidthMode: fullWidthMode
|
|
93
96
|
}),
|
|
94
97
|
"data-layout": layout,
|
|
95
|
-
"data-width":
|
|
98
|
+
"data-width": mediaSingleWidth,
|
|
99
|
+
"data-width-type": (size === null || size === void 0 ? void 0 : size.widthType) || 'percentage',
|
|
96
100
|
"data-node-type": nodeType,
|
|
97
101
|
className: classnames('rich-media-item mediaSingleView-content-wrap', "image-".concat(layout), className, {
|
|
98
102
|
'is-loading': isLoading,
|
|
@@ -108,8 +108,9 @@ export var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref
|
|
|
108
108
|
isResized = _ref.isResized,
|
|
109
109
|
layout = _ref.layout,
|
|
110
110
|
pctWidth = _ref.pctWidth,
|
|
111
|
+
mediaSingleWidth = _ref.mediaSingleWidth,
|
|
111
112
|
width = _ref.width;
|
|
112
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
113
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
113
114
|
};
|
|
114
115
|
var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
|
|
115
116
|
var hasFallbackContainer = _ref2.hasFallbackContainer,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LengthGuide } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This creates a collection of points relative to the center line of each supplied length. For example; a length of
|
|
4
|
+
* 100 centered to 0 would result in the left position of -50 and a right position of +50.
|
|
5
|
+
*
|
|
6
|
+
* Length values should be unique, as duplicates will be trimmed from the result.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* createGuidelinesFromLengths([100, 200, 200, -200, 201]) => [
|
|
10
|
+
* {left: -50, right: 50, length: 100},
|
|
11
|
+
* {left: -100, right: 100, length: 200},
|
|
12
|
+
* {left: 100, right: -100, length: -200},
|
|
13
|
+
* {left: -100.5, right: 100.5, length: 201},
|
|
14
|
+
* ]
|
|
15
|
+
*
|
|
16
|
+
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
17
|
+
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
18
|
+
*/
|
|
19
|
+
export declare const createGuidesFromLengths: (lengths: number[]) => LengthGuide[];
|
|
20
|
+
/**
|
|
21
|
+
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
22
|
+
* Each length value generates a guideline config for both the left and right side of the length.
|
|
23
|
+
*/
|
|
24
|
+
export declare const createFixedGuidelinesFromLengths: (lengths: number[], key?: string) => {
|
|
25
|
+
key: string;
|
|
26
|
+
position: {
|
|
27
|
+
x: number;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
@@ -16,6 +16,11 @@ export type ResizerProps = {
|
|
|
16
16
|
handleComponent?: HandleComponent;
|
|
17
17
|
handleHeightSize?: HandleHeightSizeType;
|
|
18
18
|
handleMarginTop?: number;
|
|
19
|
+
snap?: {
|
|
20
|
+
x?: Array<number>;
|
|
21
|
+
y?: Array<number>;
|
|
22
|
+
};
|
|
23
|
+
snapGap?: number;
|
|
19
24
|
handleAlignmentMethod?: HandleAlignmentMethod;
|
|
20
25
|
resizeRatio?: number;
|
|
21
26
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { RichMediaLayout as MediaSingleLayout, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
5
|
+
import type { MediaSingleSize, MediaSingleWidthType } from './types';
|
|
5
6
|
export declare const DEFAULT_IMAGE_WIDTH = 250;
|
|
6
7
|
export declare const DEFAULT_IMAGE_HEIGHT = 200;
|
|
7
8
|
export declare const IMAGE_AND_BORDER_ADJUSTMENT = 2;
|
|
@@ -14,11 +15,18 @@ export interface Props {
|
|
|
14
15
|
containerWidth?: number;
|
|
15
16
|
isLoading?: boolean;
|
|
16
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @private
|
|
20
|
+
* @deprecated Use {@link Props.size.width} instead.
|
|
21
|
+
* Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
|
|
22
|
+
*/
|
|
17
23
|
pctWidth?: number;
|
|
24
|
+
size?: MediaSingleSize;
|
|
18
25
|
nodeType?: string;
|
|
19
26
|
fullWidthMode?: boolean;
|
|
20
27
|
hasFallbackContainer?: boolean;
|
|
21
28
|
handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
|
|
22
29
|
}
|
|
23
30
|
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
24
|
-
export
|
|
31
|
+
export type { MediaSingleWidthType, MediaSingleSize };
|
|
32
|
+
export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
|
|
@@ -22,7 +22,13 @@ export interface MediaSingleWrapperProps {
|
|
|
22
22
|
fullWidthMode?: boolean;
|
|
23
23
|
isResized?: boolean;
|
|
24
24
|
layout: MediaSingleLayout;
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @deprecated Use {@link MediaSingleWrapperProps.mediaSingleWidth} instead.
|
|
28
|
+
* Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
|
|
29
|
+
*/
|
|
25
30
|
pctWidth?: number;
|
|
31
|
+
mediaSingleWidth?: number;
|
|
26
32
|
width?: number;
|
|
27
33
|
innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
|
|
28
34
|
}
|
|
@@ -30,7 +36,7 @@ export interface MediaSingleWrapperProps {
|
|
|
30
36
|
* Can't use `.attrs` to handle highly dynamic styles because we are still
|
|
31
37
|
* supporting `styled-components` v1.
|
|
32
38
|
*/
|
|
33
|
-
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
39
|
+
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
34
40
|
export interface MediaWrapperProps {
|
|
35
41
|
paddingBottom?: string;
|
|
36
42
|
height?: number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type MediaSingleWidthType = 'pixel' | 'percentage';
|
|
2
|
+
export type MediaSingleSize = {
|
|
3
|
+
/**
|
|
4
|
+
* The width attribute from mediaSingle node
|
|
5
|
+
*/
|
|
6
|
+
width?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The widthType attribute from mediaSingle node
|
|
9
|
+
* @default percentage
|
|
10
|
+
*/
|
|
11
|
+
widthType?: MediaSingleWidthType;
|
|
12
|
+
};
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
2
|
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
|
|
3
|
-
export type { Props as MediaSingleProps } from './MediaSingle';
|
|
3
|
+
export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
|
|
4
4
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
5
5
|
export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
|
|
6
6
|
export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts, } from './MediaSingle/grid';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LengthGuide } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This creates a collection of points relative to the center line of each supplied length. For example; a length of
|
|
4
|
+
* 100 centered to 0 would result in the left position of -50 and a right position of +50.
|
|
5
|
+
*
|
|
6
|
+
* Length values should be unique, as duplicates will be trimmed from the result.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* createGuidelinesFromLengths([100, 200, 200, -200, 201]) => [
|
|
10
|
+
* {left: -50, right: 50, length: 100},
|
|
11
|
+
* {left: -100, right: 100, length: 200},
|
|
12
|
+
* {left: 100, right: -100, length: -200},
|
|
13
|
+
* {left: -100.5, right: 100.5, length: 201},
|
|
14
|
+
* ]
|
|
15
|
+
*
|
|
16
|
+
* @param lengths A colection of length values which will be split into a left & right guides.
|
|
17
|
+
* @returns A collection of LengthGuide objects which can be used to draw left & right guides
|
|
18
|
+
*/
|
|
19
|
+
export declare const createGuidesFromLengths: (lengths: number[]) => LengthGuide[];
|
|
20
|
+
/**
|
|
21
|
+
* This creates a Guideline configuration generating a collection of guideline pairs from each supplied length value.
|
|
22
|
+
* Each length value generates a guideline config for both the left and right side of the length.
|
|
23
|
+
*/
|
|
24
|
+
export declare const createFixedGuidelinesFromLengths: (lengths: number[], key?: string) => {
|
|
25
|
+
key: string;
|
|
26
|
+
position: {
|
|
27
|
+
x: number;
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
@@ -16,6 +16,11 @@ export type ResizerProps = {
|
|
|
16
16
|
handleComponent?: HandleComponent;
|
|
17
17
|
handleHeightSize?: HandleHeightSizeType;
|
|
18
18
|
handleMarginTop?: number;
|
|
19
|
+
snap?: {
|
|
20
|
+
x?: Array<number>;
|
|
21
|
+
y?: Array<number>;
|
|
22
|
+
};
|
|
23
|
+
snapGap?: number;
|
|
19
24
|
handleAlignmentMethod?: HandleAlignmentMethod;
|
|
20
25
|
resizeRatio?: number;
|
|
21
26
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { RichMediaLayout as MediaSingleLayout, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
5
|
+
import type { MediaSingleSize, MediaSingleWidthType } from './types';
|
|
5
6
|
export declare const DEFAULT_IMAGE_WIDTH = 250;
|
|
6
7
|
export declare const DEFAULT_IMAGE_HEIGHT = 200;
|
|
7
8
|
export declare const IMAGE_AND_BORDER_ADJUSTMENT = 2;
|
|
@@ -14,11 +15,18 @@ export interface Props {
|
|
|
14
15
|
containerWidth?: number;
|
|
15
16
|
isLoading?: boolean;
|
|
16
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @private
|
|
20
|
+
* @deprecated Use {@link Props.size.width} instead.
|
|
21
|
+
* Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
|
|
22
|
+
*/
|
|
17
23
|
pctWidth?: number;
|
|
24
|
+
size?: MediaSingleSize;
|
|
18
25
|
nodeType?: string;
|
|
19
26
|
fullWidthMode?: boolean;
|
|
20
27
|
hasFallbackContainer?: boolean;
|
|
21
28
|
handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
|
|
22
29
|
}
|
|
23
30
|
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
24
|
-
export
|
|
31
|
+
export type { MediaSingleWidthType, MediaSingleSize };
|
|
32
|
+
export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
|
|
@@ -22,7 +22,13 @@ export interface MediaSingleWrapperProps {
|
|
|
22
22
|
fullWidthMode?: boolean;
|
|
23
23
|
isResized?: boolean;
|
|
24
24
|
layout: MediaSingleLayout;
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @deprecated Use {@link MediaSingleWrapperProps.mediaSingleWidth} instead.
|
|
28
|
+
* Cleanup ticket: https://product-fabric.atlassian.net/browse/ED-19076
|
|
29
|
+
*/
|
|
25
30
|
pctWidth?: number;
|
|
31
|
+
mediaSingleWidth?: number;
|
|
26
32
|
width?: number;
|
|
27
33
|
innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
|
|
28
34
|
}
|
|
@@ -30,7 +36,7 @@ export interface MediaSingleWrapperProps {
|
|
|
30
36
|
* Can't use `.attrs` to handle highly dynamic styles because we are still
|
|
31
37
|
* supporting `styled-components` v1.
|
|
32
38
|
*/
|
|
33
|
-
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
39
|
+
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
34
40
|
export interface MediaWrapperProps {
|
|
35
41
|
paddingBottom?: string;
|
|
36
42
|
height?: number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type MediaSingleWidthType = 'pixel' | 'percentage';
|
|
2
|
+
export type MediaSingleSize = {
|
|
3
|
+
/**
|
|
4
|
+
* The width attribute from mediaSingle node
|
|
5
|
+
*/
|
|
6
|
+
width?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The widthType attribute from mediaSingle node
|
|
9
|
+
* @default percentage
|
|
10
|
+
*/
|
|
11
|
+
widthType?: MediaSingleWidthType;
|
|
12
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
2
|
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, shouldAddDefaultWrappedWidth, } from './MediaSingle';
|
|
3
|
-
export type { Props as MediaSingleProps } from './MediaSingle';
|
|
3
|
+
export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
|
|
4
4
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
5
5
|
export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
|
|
6
6
|
export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts, } from './MediaSingle/grid';
|
package/package.json
CHANGED