@atlaskit/editor-common 74.26.0 → 74.26.1

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,11 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.26.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e8885f55db6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e8885f55db6) - ED-18969 implement relative guides support
8
+
3
9
  ## 74.26.0
4
10
 
5
11
  ### Minor Changes
@@ -27,6 +27,13 @@ Object.defineProperty(exports, "getGuidelinesWithHighlights", {
27
27
  return _updateGuideline.getGuidelinesWithHighlights;
28
28
  }
29
29
  });
30
+ Object.defineProperty(exports, "isVerticalPosition", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _utils.isVerticalPosition;
34
+ }
35
+ });
30
36
  var _dynamicGuideline = require("./dynamicGuideline");
31
37
  var _fixedGuideline = require("./fixedGuideline");
32
- var _updateGuideline = require("./updateGuideline");
38
+ var _updateGuideline = require("./updateGuideline");
39
+ var _utils = require("./utils");
@@ -9,4 +9,16 @@ var WidthTypes = /*#__PURE__*/function (WidthTypes) {
9
9
  WidthTypes["PIXEL"] = "pixel";
10
10
  return WidthTypes;
11
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
+ */
12
24
  exports.WidthTypes = WidthTypes;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isVerticalPosition = exports.isNumber = void 0;
7
+ var isNumber = function isNumber(x) {
8
+ return typeof x === 'number' && !isNaN(x) && isFinite(x);
9
+ };
10
+ exports.isNumber = isNumber;
11
+ var isVerticalPosition = function isVerticalPosition(pos) {
12
+ return isNumber(pos.x);
13
+ };
14
+ exports.isVerticalPosition = isVerticalPosition;
@@ -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.26.0";
19
+ var packageVersion = "74.26.1";
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.26.0";
27
+ var packageVersion = "74.26.1";
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.26.0",
3
+ "version": "74.26.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,4 @@
1
1
  export { generateDynamicGuidelines } from './dynamicGuideline';
2
2
  export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fixedGuideline';
3
- export { getGuidelinesWithHighlights } from './updateGuideline';
3
+ export { getGuidelinesWithHighlights } from './updateGuideline';
4
+ export { isVerticalPosition } from './utils';
@@ -2,4 +2,17 @@ export let WidthTypes = /*#__PURE__*/function (WidthTypes) {
2
2
  WidthTypes["PERCENTAGE"] = "percentage";
3
3
  WidthTypes["PIXEL"] = "pixel";
4
4
  return WidthTypes;
5
- }({});
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
+ */
@@ -0,0 +1,4 @@
1
+ export const isNumber = x => typeof x === 'number' && !isNaN(x) && isFinite(x);
2
+ export const isVerticalPosition = pos => {
3
+ return isNumber(pos.x);
4
+ };
@@ -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.26.0";
3
+ const packageVersion = "74.26.1";
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.26.0";
11
+ const packageVersion = "74.26.1";
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.26.0",
3
+ "version": "74.26.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,4 @@
1
1
  export { generateDynamicGuidelines } from './dynamicGuideline';
2
2
  export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fixedGuideline';
3
- export { getGuidelinesWithHighlights } from './updateGuideline';
3
+ export { getGuidelinesWithHighlights } from './updateGuideline';
4
+ export { isVerticalPosition } from './utils';
@@ -2,4 +2,17 @@ export var WidthTypes = /*#__PURE__*/function (WidthTypes) {
2
2
  WidthTypes["PERCENTAGE"] = "percentage";
3
3
  WidthTypes["PIXEL"] = "pixel";
4
4
  return WidthTypes;
5
- }({});
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
+ */
@@ -0,0 +1,6 @@
1
+ export var isNumber = function isNumber(x) {
2
+ return typeof x === 'number' && !isNaN(x) && isFinite(x);
3
+ };
4
+ export var isVerticalPosition = function isVerticalPosition(pos) {
5
+ return isNumber(pos.x);
6
+ };
@@ -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.26.0";
9
+ var packageVersion = "74.26.1";
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.26.0";
21
+ var packageVersion = "74.26.1";
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.26.0",
3
+ "version": "74.26.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,5 @@
1
1
  export { generateDynamicGuidelines } from './dynamicGuideline';
2
2
  export { createFixedGuidelinesFromLengths, createGuidesFromLengths, } from './fixedGuideline';
3
3
  export { getGuidelinesWithHighlights } from './updateGuideline';
4
+ export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
5
+ export { isVerticalPosition } from './utils';
@@ -1,3 +1,5 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { CSSToken } from '@atlaskit/tokens';
1
3
  export declare enum WidthTypes {
2
4
  PERCENTAGE = "percentage",
3
5
  PIXEL = "pixel"
@@ -7,3 +9,34 @@ export type LengthGuide = {
7
9
  right: number;
8
10
  length: number;
9
11
  };
12
+ export type Range = {
13
+ start: number;
14
+ end: number;
15
+ };
16
+ export type VerticalPosition = {
17
+ x: number;
18
+ y?: Range;
19
+ };
20
+ export type HorizontalPosition = {
21
+ x?: Range;
22
+ y: number;
23
+ };
24
+ export type Position = VerticalPosition | HorizontalPosition;
25
+ export type GuidelineConfig = {
26
+ key: string;
27
+ position: Position;
28
+ active?: boolean;
29
+ show?: boolean;
30
+ style?: 'dashed' | 'solid';
31
+ color?: CSSToken;
32
+ styles?: {
33
+ capStyle?: 'line';
34
+ };
35
+ };
36
+ export type GuidelinePluginState = {
37
+ guidelines: GuidelineConfig[];
38
+ };
39
+ export interface GuidelinePluginOptions {
40
+ }
41
+ export type DisplayGrid = (props: Required<GuidelinePluginState>) => boolean;
42
+ export type DisplayGuideline = (view: EditorView) => DisplayGrid;
@@ -0,0 +1,3 @@
1
+ import { Position, VerticalPosition } from './types';
2
+ export declare const isNumber: (x: unknown) => x is number;
3
+ export declare const isVerticalPosition: (pos: Position) => pos is VerticalPosition;
@@ -1,3 +1,5 @@
1
1
  export { generateDynamicGuidelines } from './dynamicGuideline';
2
2
  export { createFixedGuidelinesFromLengths, createGuidesFromLengths, } from './fixedGuideline';
3
3
  export { getGuidelinesWithHighlights } from './updateGuideline';
4
+ export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
5
+ export { isVerticalPosition } from './utils';
@@ -1,3 +1,5 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { CSSToken } from '@atlaskit/tokens';
1
3
  export declare enum WidthTypes {
2
4
  PERCENTAGE = "percentage",
3
5
  PIXEL = "pixel"
@@ -7,3 +9,34 @@ export type LengthGuide = {
7
9
  right: number;
8
10
  length: number;
9
11
  };
12
+ export type Range = {
13
+ start: number;
14
+ end: number;
15
+ };
16
+ export type VerticalPosition = {
17
+ x: number;
18
+ y?: Range;
19
+ };
20
+ export type HorizontalPosition = {
21
+ x?: Range;
22
+ y: number;
23
+ };
24
+ export type Position = VerticalPosition | HorizontalPosition;
25
+ export type GuidelineConfig = {
26
+ key: string;
27
+ position: Position;
28
+ active?: boolean;
29
+ show?: boolean;
30
+ style?: 'dashed' | 'solid';
31
+ color?: CSSToken;
32
+ styles?: {
33
+ capStyle?: 'line';
34
+ };
35
+ };
36
+ export type GuidelinePluginState = {
37
+ guidelines: GuidelineConfig[];
38
+ };
39
+ export interface GuidelinePluginOptions {
40
+ }
41
+ export type DisplayGrid = (props: Required<GuidelinePluginState>) => boolean;
42
+ export type DisplayGuideline = (view: EditorView) => DisplayGrid;
@@ -0,0 +1,3 @@
1
+ import { Position, VerticalPosition } from './types';
2
+ export declare const isNumber: (x: unknown) => x is number;
3
+ export declare const isVerticalPosition: (pos: Position) => pos is VerticalPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.26.0",
3
+ "version": "74.26.1",
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/"