@atlaskit/editor-common 74.45.1 → 74.45.3

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.45.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cf71a66559b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf71a66559b) - Update analytics event for new resize experience
8
+
9
+ ## 74.45.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 74.45.1
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.1";
19
+ var packageVersion = "74.45.3";
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.45.1";
27
+ var packageVersion = "74.45.3";
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.1",
3
+ "version": "74.45.3",
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.1";
3
+ const packageVersion = "74.45.3";
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.45.1";
11
+ const packageVersion = "74.45.3";
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.1",
3
+ "version": "74.45.3",
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.1";
9
+ var packageVersion = "74.45.3";
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.45.1";
21
+ var packageVersion = "74.45.3";
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.1",
3
+ "version": "74.45.3",
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,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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.45.1",
3
+ "version": "74.45.3",
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/"
@@ -99,7 +99,7 @@
99
99
  "@atlaskit/icon": "^21.12.0",
100
100
  "@atlaskit/icon-object": "^6.3.0",
101
101
  "@atlaskit/in-product-testing": "^0.2.0",
102
- "@atlaskit/link-datasource": "^0.33.0",
102
+ "@atlaskit/link-datasource": "^0.34.0",
103
103
  "@atlaskit/link-picker": "^1.28.0",
104
104
  "@atlaskit/media-card": "^76.1.0",
105
105
  "@atlaskit/media-client": "^23.1.0",
@@ -143,7 +143,7 @@
143
143
  "react-intl-next": "npm:react-intl@^5.18.1"
144
144
  },
145
145
  "devDependencies": {
146
- "@atlaskit/editor-test-helpers": "^18.10.0",
146
+ "@atlaskit/editor-test-helpers": "^18.11.0",
147
147
  "@atlaskit/media-core": "^34.1.0",
148
148
  "@atlaskit/media-test-helpers": "^33.0.0",
149
149
  "@atlaskit/smart-card": "^26.15.0",