@atlaskit/editor-common 74.45.2 → 74.45.4

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/guideline/index.js +6 -0
  3. package/dist/cjs/guideline/types.js +1 -20
  4. package/dist/cjs/guideline/utils.js +44 -2
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/resizer/Resizer.js +1 -1
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/guideline/index.js +1 -1
  10. package/dist/es2019/guideline/types.js +1 -18
  11. package/dist/es2019/guideline/utils.js +28 -0
  12. package/dist/es2019/monitoring/error.js +1 -1
  13. package/dist/es2019/resizer/Resizer.js +1 -1
  14. package/dist/es2019/ui/DropList/index.js +1 -1
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/guideline/index.js +1 -1
  17. package/dist/esm/guideline/types.js +1 -18
  18. package/dist/esm/guideline/utils.js +39 -0
  19. package/dist/esm/monitoring/error.js +1 -1
  20. package/dist/esm/resizer/Resizer.js +1 -1
  21. package/dist/esm/ui/DropList/index.js +1 -1
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/analytics/types/media-events.d.ts +3 -3
  24. package/dist/types/guideline/index.d.ts +2 -2
  25. package/dist/types/guideline/types.d.ts +2 -4
  26. package/dist/types/guideline/utils.d.ts +6 -1
  27. package/dist/types/resizer/Resizer.d.ts +4 -3
  28. package/dist/types-ts4.5/analytics/types/media-events.d.ts +3 -3
  29. package/dist/types-ts4.5/guideline/index.d.ts +2 -2
  30. package/dist/types-ts4.5/guideline/types.d.ts +2 -4
  31. package/dist/types-ts4.5/guideline/utils.d.ts +6 -1
  32. package/dist/types-ts4.5/resizer/Resizer.d.ts +4 -3
  33. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.45.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`58fa188ef48`](https://bitbucket.org/atlassian/atlassian-frontend/commits/58fa188ef48) - [ux] [ED-19461] Reduce draggable zone of adjacent resize handle.
8
+
9
+ ## 74.45.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`cf71a66559b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf71a66559b) - Update analytics event for new resize experience
14
+
3
15
  ## 74.45.2
4
16
 
5
17
  ### Patch Changes
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "getGuidelineSnaps", {
57
57
  return _snapping.getGuidelineSnaps;
58
58
  }
59
59
  });
60
+ Object.defineProperty(exports, "getGuidelineTypeFromKey", {
61
+ enumerable: true,
62
+ get: function get() {
63
+ return _utils.getGuidelineTypeFromKey;
64
+ }
65
+ });
60
66
  Object.defineProperty(exports, "getGuidelinesWithHighlights", {
61
67
  enumerable: true,
62
68
  get: function get() {
@@ -2,23 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
6
- exports.WidthTypes = void 0;
7
- var WidthTypes = /*#__PURE__*/function (WidthTypes) {
8
- WidthTypes["PERCENTAGE"] = "percentage";
9
- WidthTypes["PIXEL"] = "pixel";
10
- return WidthTypes;
11
- }({});
12
- /*
13
- * When x is 0, a vertical line is displayed at the center of the editor
14
- * a negative value will move the line to the left,
15
- * a positive value will move the line to the right,
16
- * The range is from -width/2 to width/2, outside will be ignored.
17
- * Define as an object allows us add more options in the future.
18
- *
19
- * ────────────┬─────────── y=0
20
- * │
21
- * │
22
- * x=0
23
- */
24
- exports.WidthTypes = WidthTypes;
5
+ });
@@ -1,24 +1,66 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.isVerticalPosition = exports.isNumber = exports.getMediaSingleDimensions = exports.getContainerWidthOrFullEditorWidth = void 0;
7
+ exports.isVerticalPosition = exports.isRange = exports.isNumber = exports.getMediaSingleDimensions = exports.getGuidelineTypeFromKey = exports.getContainerWidthOrFullEditorWidth = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
7
9
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
8
10
  var _mediaSingle = require("../media-single");
9
11
  var isNumber = function isNumber(x) {
10
12
  return typeof x === 'number' && !isNaN(x) && isFinite(x);
11
13
  };
12
14
  exports.isNumber = isNumber;
15
+ var isRange = function isRange(range) {
16
+ return !!((0, _typeof2.default)(range) === 'object' && range && 'start' in range && 'end' in range);
17
+ };
18
+ exports.isRange = isRange;
13
19
  var isVerticalPosition = function isVerticalPosition(pos) {
14
20
  return isNumber(pos.x);
15
21
  };
16
22
 
23
+ /**
24
+ * Returns the type of guideline based on a guideline key and a collection of guidelines
25
+ */
26
+ exports.isVerticalPosition = isVerticalPosition;
27
+ var getGuidelineTypeFromKey = function getGuidelineTypeFromKey(keys, guidelines) {
28
+ if (guidelines.length === 0) {
29
+ return 'none';
30
+ }
31
+
32
+ // Check for default guidelines on key
33
+ if (keys.some(function (key) {
34
+ return ['grid_', 'wide_', 'full_width'].some(function (defaultGuideline) {
35
+ return key.indexOf(defaultGuideline) >= 0;
36
+ });
37
+ })) {
38
+ return 'default';
39
+ }
40
+
41
+ // Find the first matched guideline (ignoring duplicates or groups)
42
+ var matchedGuideline = guidelines.find(function (guideline) {
43
+ return keys.some(function (key) {
44
+ return guideline.key === key;
45
+ });
46
+ });
47
+ if (!matchedGuideline) {
48
+ return 'none';
49
+ }
50
+
51
+ // Check whether temporary or horizontal guides
52
+ if (isVerticalPosition(matchedGuideline.position)) {
53
+ return isRange(matchedGuideline.position.y) ? 'relative' : 'temporary';
54
+ } else {
55
+ return isRange(matchedGuideline.position.x) ? 'relative' : 'none'; // Can never have temporary horizontal guides
56
+ }
57
+ };
58
+
17
59
  /**
18
60
  * Calculates container or full editor width taking in account editor full width layout
19
61
  * width and editor gutter padding.
20
62
  */
21
- exports.isVerticalPosition = isVerticalPosition;
63
+ exports.getGuidelineTypeFromKey = getGuidelineTypeFromKey;
22
64
  var getContainerWidthOrFullEditorWidth = function getContainerWidthOrFullEditorWidth(containerWidth) {
23
65
  return Math.min(containerWidth - _editorSharedStyles.akEditorGutterPadding * 2, _editorSharedStyles.akEditorFullWidthLayoutWidth) / 2;
24
66
  };
@@ -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.45.2";
19
+ var packageVersion = "74.45.4";
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
@@ -87,7 +87,7 @@ function ResizerNext(props) {
87
87
  right: (0, _classnames3.default)(_resizer.resizerHandleClassName[handleHeightSize], (_classnames2 = {}, (0, _defineProperty2.default)(_classnames2, "".concat(handleClassName, "-right"), !!handleClassName), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandleRightClassName, !handleClassName), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames2))
88
88
  };
89
89
  var baseHandleStyles = {
90
- width: handlePositioning === 'adjacent' ? "var(--ds-space-250, 20px)" : "var(--ds-space-300, 24px)",
90
+ width: handlePositioning === 'adjacent' ? "var(--ds-space-100, 8px)" : "var(--ds-space-300, 24px)",
91
91
  // eslint-disable-next-line
92
92
  marginTop: Number.isFinite(handleMarginTop) ? "".concat(handleMarginTop, "px") : undefined,
93
93
  zIndex: _resizer.resizerHandleZIndex,
@@ -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.45.2";
27
+ var packageVersion = "74.45.4";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.45.2",
3
+ "version": "74.45.4",
4
4
  "sideEffects": false
5
5
  }
@@ -4,4 +4,4 @@ export { generateDefaultGuidelines } from './defaultGuideline';
4
4
  export { getGuidelinesWithHighlights } from './updateGuideline';
5
5
  export { MEDIA_DYNAMIC_GUIDELINE_PREFIX, INNER_GRID_GUIDELINE_PREFIX } from './constants';
6
6
  export { getGuidelineSnaps, findClosestSnap } from './snapping';
7
- export { isVerticalPosition, getContainerWidthOrFullEditorWidth } from './utils';
7
+ export { isVerticalPosition, getContainerWidthOrFullEditorWidth, getGuidelineTypeFromKey } from './utils';
@@ -1,18 +1 @@
1
- export let WidthTypes = /*#__PURE__*/function (WidthTypes) {
2
- WidthTypes["PERCENTAGE"] = "percentage";
3
- WidthTypes["PIXEL"] = "pixel";
4
- return WidthTypes;
5
- }({});
6
-
7
- /*
8
- * When x is 0, a vertical line is displayed at the center of the editor
9
- * a negative value will move the line to the left,
10
- * a positive value will move the line to the right,
11
- * The range is from -width/2 to width/2, outside will be ignored.
12
- * Define as an object allows us add more options in the future.
13
- *
14
- * ────────────┬─────────── y=0
15
- * │
16
- * │
17
- * x=0
18
- */
1
+ export {};
@@ -1,8 +1,36 @@
1
1
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
2
2
  import { getMediaSinglePixelWidth, roundToNearest } from '../media-single';
3
3
  export const isNumber = x => typeof x === 'number' && !isNaN(x) && isFinite(x);
4
+ export const isRange = range => !!(typeof range === 'object' && range && 'start' in range && 'end' in range);
4
5
  export const isVerticalPosition = pos => isNumber(pos.x);
5
6
 
7
+ /**
8
+ * Returns the type of guideline based on a guideline key and a collection of guidelines
9
+ */
10
+ export const getGuidelineTypeFromKey = (keys, guidelines) => {
11
+ if (guidelines.length === 0) {
12
+ return 'none';
13
+ }
14
+
15
+ // Check for default guidelines on key
16
+ if (keys.some(key => ['grid_', 'wide_', 'full_width'].some(defaultGuideline => key.indexOf(defaultGuideline) >= 0))) {
17
+ return 'default';
18
+ }
19
+
20
+ // Find the first matched guideline (ignoring duplicates or groups)
21
+ const matchedGuideline = guidelines.find(guideline => keys.some(key => guideline.key === key));
22
+ if (!matchedGuideline) {
23
+ return 'none';
24
+ }
25
+
26
+ // Check whether temporary or horizontal guides
27
+ if (isVerticalPosition(matchedGuideline.position)) {
28
+ return isRange(matchedGuideline.position.y) ? 'relative' : 'temporary';
29
+ } else {
30
+ return isRange(matchedGuideline.position.x) ? 'relative' : 'none'; // Can never have temporary horizontal guides
31
+ }
32
+ };
33
+
6
34
  /**
7
35
  * Calculates container or full editor width taking in account editor full width layout
8
36
  * width and editor gutter padding.
@@ -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.45.2";
3
+ const packageVersion = "74.45.4";
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
@@ -72,7 +72,7 @@ export default function ResizerNext(props) {
72
72
  })
73
73
  };
74
74
  const baseHandleStyles = {
75
- width: handlePositioning === 'adjacent' ? "var(--ds-space-250, 20px)" : "var(--ds-space-300, 24px)",
75
+ width: handlePositioning === 'adjacent' ? "var(--ds-space-100, 8px)" : "var(--ds-space-300, 24px)",
76
76
  // eslint-disable-next-line
77
77
  marginTop: Number.isFinite(handleMarginTop) ? `${handleMarginTop}px` : undefined,
78
78
  zIndex: resizerHandleZIndex,
@@ -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.45.2";
11
+ const packageVersion = "74.45.4";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.45.2",
3
+ "version": "74.45.4",
4
4
  "sideEffects": false
5
5
  }
@@ -4,4 +4,4 @@ export { generateDefaultGuidelines } from './defaultGuideline';
4
4
  export { getGuidelinesWithHighlights } from './updateGuideline';
5
5
  export { MEDIA_DYNAMIC_GUIDELINE_PREFIX, INNER_GRID_GUIDELINE_PREFIX } from './constants';
6
6
  export { getGuidelineSnaps, findClosestSnap } from './snapping';
7
- export { isVerticalPosition, getContainerWidthOrFullEditorWidth } from './utils';
7
+ export { isVerticalPosition, getContainerWidthOrFullEditorWidth, getGuidelineTypeFromKey } from './utils';
@@ -1,18 +1 @@
1
- export var WidthTypes = /*#__PURE__*/function (WidthTypes) {
2
- WidthTypes["PERCENTAGE"] = "percentage";
3
- WidthTypes["PIXEL"] = "pixel";
4
- return WidthTypes;
5
- }({});
6
-
7
- /*
8
- * When x is 0, a vertical line is displayed at the center of the editor
9
- * a negative value will move the line to the left,
10
- * a positive value will move the line to the right,
11
- * The range is from -width/2 to width/2, outside will be ignored.
12
- * Define as an object allows us add more options in the future.
13
- *
14
- * ────────────┬─────────── y=0
15
- * │
16
- * │
17
- * x=0
18
- */
1
+ export {};
@@ -1,12 +1,51 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
2
3
  import { getMediaSinglePixelWidth, roundToNearest } from '../media-single';
3
4
  export var isNumber = function isNumber(x) {
4
5
  return typeof x === 'number' && !isNaN(x) && isFinite(x);
5
6
  };
7
+ export var isRange = function isRange(range) {
8
+ return !!(_typeof(range) === 'object' && range && 'start' in range && 'end' in range);
9
+ };
6
10
  export var isVerticalPosition = function isVerticalPosition(pos) {
7
11
  return isNumber(pos.x);
8
12
  };
9
13
 
14
+ /**
15
+ * Returns the type of guideline based on a guideline key and a collection of guidelines
16
+ */
17
+ export var getGuidelineTypeFromKey = function getGuidelineTypeFromKey(keys, guidelines) {
18
+ if (guidelines.length === 0) {
19
+ return 'none';
20
+ }
21
+
22
+ // Check for default guidelines on key
23
+ if (keys.some(function (key) {
24
+ return ['grid_', 'wide_', 'full_width'].some(function (defaultGuideline) {
25
+ return key.indexOf(defaultGuideline) >= 0;
26
+ });
27
+ })) {
28
+ return 'default';
29
+ }
30
+
31
+ // Find the first matched guideline (ignoring duplicates or groups)
32
+ var matchedGuideline = guidelines.find(function (guideline) {
33
+ return keys.some(function (key) {
34
+ return guideline.key === key;
35
+ });
36
+ });
37
+ if (!matchedGuideline) {
38
+ return 'none';
39
+ }
40
+
41
+ // Check whether temporary or horizontal guides
42
+ if (isVerticalPosition(matchedGuideline.position)) {
43
+ return isRange(matchedGuideline.position.y) ? 'relative' : 'temporary';
44
+ } else {
45
+ return isRange(matchedGuideline.position.x) ? 'relative' : 'none'; // Can never have temporary horizontal guides
46
+ }
47
+ };
48
+
10
49
  /**
11
50
  * Calculates container or full editor width taking in account editor full width layout
12
51
  * width and editor gutter padding.
@@ -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.45.2";
9
+ var packageVersion = "74.45.4";
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
@@ -77,7 +77,7 @@ export default function ResizerNext(props) {
77
77
  right: classnames(resizerHandleClassName[handleHeightSize], (_classnames2 = {}, _defineProperty(_classnames2, "".concat(handleClassName, "-right"), !!handleClassName), _defineProperty(_classnames2, resizerHandleRightClassName, !handleClassName), _defineProperty(_classnames2, resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames2))
78
78
  };
79
79
  var baseHandleStyles = {
80
- width: handlePositioning === 'adjacent' ? "var(--ds-space-250, 20px)" : "var(--ds-space-300, 24px)",
80
+ width: handlePositioning === 'adjacent' ? "var(--ds-space-100, 8px)" : "var(--ds-space-300, 24px)",
81
81
  // eslint-disable-next-line
82
82
  marginTop: Number.isFinite(handleMarginTop) ? "".concat(handleMarginTop, "px") : undefined,
83
83
  zIndex: resizerHandleZIndex,
@@ -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.45.2";
21
+ var packageVersion = "74.45.4";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.45.2",
3
+ "version": "74.45.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import type { WidthTypes } from '../../guideline/types';
1
+ import type { GuidelineTypes, WidthTypes } from '../../guideline/types';
2
2
  import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from './enums';
3
3
  import type { TrackAEP, UIAEP } from './utils';
4
4
  type MediaBorderActionType = ACTION.UPDATED | ACTION.ADDED | ACTION.DELETED;
@@ -10,10 +10,10 @@ export type CaptionTrackAction = TrackAEP<MediaCaptionActionType, ACTION_SUBJECT
10
10
  type MediaAltTextAction = TrackAEP<ACTION.ADDED | ACTION.CLOSED | ACTION.EDITED | ACTION.CLEARED | ACTION.OPENED, ACTION_SUBJECT.MEDIA, ACTION_SUBJECT_ID.ALT_TEXT, undefined, undefined>;
11
11
  type MediaUIAction = UIAEP<ACTION.EDITED, ACTION_SUBJECT.MEDIA_SINGLE | ACTION_SUBJECT.EMBEDS, ACTION_SUBJECT_ID.RESIZED, any, undefined>;
12
12
  type MediaResizeAttributes = {
13
- size?: number;
13
+ width?: number;
14
14
  widthType: WidthTypes;
15
15
  layout: string;
16
- snapType: 'default' | 'temporary' | 'relative' | 'none';
16
+ snapType: GuidelineTypes;
17
17
  parentNode?: string;
18
18
  };
19
19
  export type MediaResizeTrackAction = UIAEP<ACTION.EDITED, ACTION_SUBJECT.MEDIA_SINGLE, ACTION_SUBJECT_ID.RESIZED, MediaResizeAttributes, undefined>;
@@ -3,6 +3,6 @@ export { createFixedGuidelinesFromLengths, createGuidesFromLengths, } from './fi
3
3
  export { generateDefaultGuidelines } from './defaultGuideline';
4
4
  export { getGuidelinesWithHighlights } from './updateGuideline';
5
5
  export { MEDIA_DYNAMIC_GUIDELINE_PREFIX, INNER_GRID_GUIDELINE_PREFIX, } from './constants';
6
- export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, GuidelineSnap, GuidelineSnapsReference, } from './types';
6
+ export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, GuidelineSnap, GuidelineSnapsReference, GuidelineTypes, } from './types';
7
7
  export { getGuidelineSnaps, findClosestSnap } from './snapping';
8
- export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
8
+ export { isVerticalPosition, getContainerWidthOrFullEditorWidth, getGuidelineTypeFromKey, } from './utils';
@@ -1,9 +1,6 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { CSSToken } from '@atlaskit/tokens';
3
- export declare enum WidthTypes {
4
- PERCENTAGE = "percentage",
5
- PIXEL = "pixel"
6
- }
3
+ export type WidthTypes = 'percentage' | 'pixel';
7
4
  export type LengthGuide = {
8
5
  left: number;
9
6
  right: number;
@@ -51,3 +48,4 @@ export type GuidelineSnapsReference = {
51
48
  };
52
49
  guidelineReference: GuidelineSnap[];
53
50
  };
51
+ export type GuidelineTypes = 'default' | 'temporary' | 'relative' | 'none';
@@ -1,7 +1,12 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import { Position, VerticalPosition } from './types';
2
+ import type { GuidelineConfig, GuidelineTypes, Position, Range, VerticalPosition } from './types';
3
3
  export declare const isNumber: (x: unknown) => x is number;
4
+ export declare const isRange: (range: unknown) => range is Range;
4
5
  export declare const isVerticalPosition: (pos: Position) => pos is VerticalPosition;
6
+ /**
7
+ * Returns the type of guideline based on a guideline key and a collection of guidelines
8
+ */
9
+ export declare const getGuidelineTypeFromKey: (keys: string[], guidelines: GuidelineConfig[]) => GuidelineTypes;
5
10
  /**
6
11
  * Calculates container or full editor width taking in account editor full width layout
7
12
  * width and editor gutter padding.
@@ -1,6 +1,7 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { HandleComponent } from 're-resizable';
3
- import { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, Snap } from './types';
1
+ import React from 'react';
2
+ import type { PropsWithChildren } from 'react';
3
+ import type { HandleComponent } from 're-resizable';
4
+ import type { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, Snap } from './types';
4
5
  export type ResizerProps = {
5
6
  enable: EnabledHandles;
6
7
  width: number;
@@ -1,4 +1,4 @@
1
- import type { WidthTypes } from '../../guideline/types';
1
+ import type { GuidelineTypes, WidthTypes } from '../../guideline/types';
2
2
  import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from './enums';
3
3
  import type { TrackAEP, UIAEP } from './utils';
4
4
  type MediaBorderActionType = ACTION.UPDATED | ACTION.ADDED | ACTION.DELETED;
@@ -10,10 +10,10 @@ export type CaptionTrackAction = TrackAEP<MediaCaptionActionType, ACTION_SUBJECT
10
10
  type MediaAltTextAction = TrackAEP<ACTION.ADDED | ACTION.CLOSED | ACTION.EDITED | ACTION.CLEARED | ACTION.OPENED, ACTION_SUBJECT.MEDIA, ACTION_SUBJECT_ID.ALT_TEXT, undefined, undefined>;
11
11
  type MediaUIAction = UIAEP<ACTION.EDITED, ACTION_SUBJECT.MEDIA_SINGLE | ACTION_SUBJECT.EMBEDS, ACTION_SUBJECT_ID.RESIZED, any, undefined>;
12
12
  type MediaResizeAttributes = {
13
- size?: number;
13
+ width?: number;
14
14
  widthType: WidthTypes;
15
15
  layout: string;
16
- snapType: 'default' | 'temporary' | 'relative' | 'none';
16
+ snapType: GuidelineTypes;
17
17
  parentNode?: string;
18
18
  };
19
19
  export type MediaResizeTrackAction = UIAEP<ACTION.EDITED, ACTION_SUBJECT.MEDIA_SINGLE, ACTION_SUBJECT_ID.RESIZED, MediaResizeAttributes, undefined>;
@@ -3,6 +3,6 @@ export { createFixedGuidelinesFromLengths, createGuidesFromLengths, } from './fi
3
3
  export { generateDefaultGuidelines } from './defaultGuideline';
4
4
  export { getGuidelinesWithHighlights } from './updateGuideline';
5
5
  export { MEDIA_DYNAMIC_GUIDELINE_PREFIX, INNER_GRID_GUIDELINE_PREFIX, } from './constants';
6
- export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, GuidelineSnap, GuidelineSnapsReference, } from './types';
6
+ export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, GuidelineSnap, GuidelineSnapsReference, GuidelineTypes, } from './types';
7
7
  export { getGuidelineSnaps, findClosestSnap } from './snapping';
8
- export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
8
+ export { isVerticalPosition, getContainerWidthOrFullEditorWidth, getGuidelineTypeFromKey, } from './utils';
@@ -1,9 +1,6 @@
1
1
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { CSSToken } from '@atlaskit/tokens';
3
- export declare enum WidthTypes {
4
- PERCENTAGE = "percentage",
5
- PIXEL = "pixel"
6
- }
3
+ export type WidthTypes = 'percentage' | 'pixel';
7
4
  export type LengthGuide = {
8
5
  left: number;
9
6
  right: number;
@@ -51,3 +48,4 @@ export type GuidelineSnapsReference = {
51
48
  };
52
49
  guidelineReference: GuidelineSnap[];
53
50
  };
51
+ export type GuidelineTypes = 'default' | 'temporary' | 'relative' | 'none';
@@ -1,7 +1,12 @@
1
1
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
- import { Position, VerticalPosition } from './types';
2
+ import type { GuidelineConfig, GuidelineTypes, Position, Range, VerticalPosition } from './types';
3
3
  export declare const isNumber: (x: unknown) => x is number;
4
+ export declare const isRange: (range: unknown) => range is Range;
4
5
  export declare const isVerticalPosition: (pos: Position) => pos is VerticalPosition;
6
+ /**
7
+ * Returns the type of guideline based on a guideline key and a collection of guidelines
8
+ */
9
+ export declare const getGuidelineTypeFromKey: (keys: string[], guidelines: GuidelineConfig[]) => GuidelineTypes;
5
10
  /**
6
11
  * Calculates container or full editor width taking in account editor full width layout
7
12
  * width and editor gutter padding.
@@ -1,6 +1,7 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { HandleComponent } from 're-resizable';
3
- import { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, Snap } from './types';
1
+ import React from 'react';
2
+ import type { PropsWithChildren } from 'react';
3
+ import type { HandleComponent } from 're-resizable';
4
+ import type { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandlePositioning, HandleResize, HandleResizeStart, HandleStyles, Snap } from './types';
4
5
  export type ResizerProps = {
5
6
  enable: EnabledHandles;
6
7
  width: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.45.2",
3
+ "version": "74.45.4",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"