@atlaskit/editor-plugin-guideline 0.3.2 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-guideline
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5f5ba16de66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f5ba16de66) - [ED-13910] Fix prosemirror types
8
+
9
+ ## 0.3.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`e118dc7562b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e118dc7562b) - ED-18897 guideline interface to use css tokens.
14
+
3
15
  ## 0.3.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -86,7 +86,7 @@ type GuidelineConfig = {
86
86
  active?: boolean;
87
87
  show?: boolean;
88
88
  style?: 'dashed' | 'solid'; // default solid
89
- color?: string;
89
+ color?: CSSToken;
90
90
  };
91
91
  ```
92
92
 
@@ -1,19 +1,22 @@
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
7
  exports.Guideline = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
9
  var _react = require("@emotion/react");
8
10
  var _colors = require("@atlaskit/theme/colors");
9
- /** @jsx jsx */
10
-
11
+ 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; }
12
+ 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; } /** @jsx jsx */
11
13
  var BasicGuidelineStyles = (0, _react.css)({
12
14
  borderLeft: "1px solid ".concat("var(--ds-border, ".concat(_colors.N30A, ")")),
13
15
  position: 'absolute',
14
16
  width: '1px',
15
17
  height: '100%',
16
18
  zIndex: 0,
19
+ transform: 'translateX(-50%)',
17
20
  opacity: 1,
18
21
  transition: 'border-color 0.15s linear, opacity 0.15s linear'
19
22
  });
@@ -31,13 +34,16 @@ var Guideline = function Guideline(props) {
31
34
  active = props.active,
32
35
  _props$show = props.show,
33
36
  show = _props$show === void 0 ? true : _props$show,
34
- style = props.style;
37
+ style = props.style,
38
+ color = props.color;
35
39
  return (0, _react.jsx)("div", {
36
40
  css: [BasicGuidelineStyles, active && ActiveGuidelineStyles, !show && HiddenGuidelineStyles, style === 'dashed' && DashedGuidelineStyles],
37
41
  className: "guideline",
38
- style: {
42
+ style: _objectSpread({
39
43
  left: "".concat(position, "px")
40
- }
44
+ }, color && {
45
+ borderColor: "".concat(color)
46
+ })
41
47
  });
42
48
  };
43
49
  exports.Guideline = Guideline;
@@ -79,7 +79,7 @@ var guidelinePlugin = function guidelinePlugin(options, api) {
79
79
  if (!editorState) {
80
80
  return null;
81
81
  }
82
- return key.getState(editorState);
82
+ return key.getState(editorState) || null;
83
83
  },
84
84
  actions: {
85
85
  displayGuideline: displayGuideline
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -7,6 +7,7 @@ const BasicGuidelineStyles = css({
7
7
  width: '1px',
8
8
  height: '100%',
9
9
  zIndex: 0,
10
+ transform: 'translateX(-50%)',
10
11
  opacity: 1,
11
12
  transition: 'border-color 0.15s linear, opacity 0.15s linear'
12
13
  });
@@ -24,13 +25,17 @@ export const Guideline = props => {
24
25
  position,
25
26
  active,
26
27
  show = true,
27
- style
28
+ style,
29
+ color
28
30
  } = props;
29
31
  return jsx("div", {
30
32
  css: [BasicGuidelineStyles, active && ActiveGuidelineStyles, !show && HiddenGuidelineStyles, style === 'dashed' && DashedGuidelineStyles],
31
33
  className: "guideline",
32
34
  style: {
33
- left: `${position}px`
35
+ left: `${position}px`,
36
+ ...(color && {
37
+ borderColor: `${color}`
38
+ })
34
39
  }
35
40
  });
36
41
  };
@@ -72,7 +72,7 @@ export const guidelinePlugin = (options, api) => ({
72
72
  if (!editorState) {
73
73
  return null;
74
74
  }
75
- return key.getState(editorState);
75
+ return key.getState(editorState) || null;
76
76
  },
77
77
  actions: {
78
78
  displayGuideline: displayGuideline
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,3 +1,6 @@
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; }
1
4
  /** @jsx jsx */
2
5
  import { css, jsx } from '@emotion/react';
3
6
  import { B200, N30A } from '@atlaskit/theme/colors';
@@ -7,6 +10,7 @@ var BasicGuidelineStyles = css({
7
10
  width: '1px',
8
11
  height: '100%',
9
12
  zIndex: 0,
13
+ transform: 'translateX(-50%)',
10
14
  opacity: 1,
11
15
  transition: 'border-color 0.15s linear, opacity 0.15s linear'
12
16
  });
@@ -24,12 +28,15 @@ export var Guideline = function Guideline(props) {
24
28
  active = props.active,
25
29
  _props$show = props.show,
26
30
  show = _props$show === void 0 ? true : _props$show,
27
- style = props.style;
31
+ style = props.style,
32
+ color = props.color;
28
33
  return jsx("div", {
29
34
  css: [BasicGuidelineStyles, active && ActiveGuidelineStyles, !show && HiddenGuidelineStyles, style === 'dashed' && DashedGuidelineStyles],
30
35
  className: "guideline",
31
- style: {
36
+ style: _objectSpread({
32
37
  left: "".concat(position, "px")
33
- }
38
+ }, color && {
39
+ borderColor: "".concat(color)
40
+ })
34
41
  });
35
42
  };
@@ -71,7 +71,7 @@ export var guidelinePlugin = function guidelinePlugin(options, api) {
71
71
  if (!editorState) {
72
72
  return null;
73
73
  }
74
- return key.getState(editorState);
74
+ return key.getState(editorState) || null;
75
75
  },
76
76
  actions: {
77
77
  displayGuideline: displayGuideline
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,10 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
+ import { CSSToken } from '@atlaskit/tokens';
3
4
  type Props = {
4
5
  position: number;
5
6
  active?: boolean;
6
7
  show?: boolean;
7
8
  style?: 'dashed' | 'solid';
9
+ color?: CSSToken;
8
10
  };
9
11
  export declare const Guideline: (props: Props) => jsx.JSX.Element;
10
12
  export {};
@@ -1,4 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
+ import { CSSToken } from '@atlaskit/tokens';
2
3
  export type Position = {
3
4
  x: number;
4
5
  };
@@ -8,7 +9,7 @@ type GuidelineConfig = {
8
9
  active?: boolean;
9
10
  show?: boolean;
10
11
  style?: 'dashed' | 'solid';
11
- color?: string;
12
+ color?: CSSToken;
12
13
  };
13
14
  type GuidelinePluginState = {
14
15
  guidelines: GuidelineConfig[];
@@ -1,10 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
+ import { CSSToken } from '@atlaskit/tokens';
3
4
  type Props = {
4
5
  position: number;
5
6
  active?: boolean;
6
7
  show?: boolean;
7
8
  style?: 'dashed' | 'solid';
9
+ color?: CSSToken;
8
10
  };
9
11
  export declare const Guideline: (props: Props) => jsx.JSX.Element;
10
12
  export {};
@@ -1,4 +1,5 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
+ import { CSSToken } from '@atlaskit/tokens';
2
3
  export type Position = {
3
4
  x: number;
4
5
  };
@@ -8,7 +9,7 @@ type GuidelineConfig = {
8
9
  active?: boolean;
9
10
  show?: boolean;
10
11
  style?: 'dashed' | 'solid';
11
- color?: string;
12
+ color?: CSSToken;
12
13
  };
13
14
  type GuidelinePluginState = {
14
15
  guidelines: GuidelineConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-guideline",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "guideline plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,11 +23,11 @@
23
23
  ".": "./src/index.ts"
24
24
  },
25
25
  "dependencies": {
26
- "@atlaskit/editor-common": "^74.9.0",
26
+ "@atlaskit/editor-common": "^74.15.0",
27
27
  "@atlaskit/editor-plugin-width": "^0.1.0",
28
28
  "@atlaskit/editor-shared-styles": "^2.4.0",
29
29
  "@atlaskit/theme": "^12.5.0",
30
- "@atlaskit/tokens": "^1.9.0",
30
+ "@atlaskit/tokens": "^1.11.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "@emotion/react": "^11.7.1",
33
33
  "prosemirror-state": "1.3.4",
package/report.api.md CHANGED
@@ -15,6 +15,7 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ import { CSSToken } from '@atlaskit/tokens';
18
19
  import { EditorView } from 'prosemirror-view';
19
20
  import { NextEditorPlugin } from '@atlaskit/editor-common/types';
20
21
  import type { widthPlugin } from '@atlaskit/editor-plugin-width';
@@ -32,7 +33,7 @@ export type GuidelineConfig = {
32
33
  active?: boolean;
33
34
  show?: boolean;
34
35
  style?: 'dashed' | 'solid';
35
- color?: string;
36
+ color?: CSSToken;
36
37
  };
37
38
 
38
39
  // @public (undocumented)
@@ -4,6 +4,7 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ import { CSSToken } from '@atlaskit/tokens';
7
8
  import { EditorView } from 'prosemirror-view';
8
9
  import { NextEditorPlugin } from '@atlaskit/editor-common/types';
9
10
  import type { widthPlugin } from '@atlaskit/editor-plugin-width';
@@ -21,7 +22,7 @@ export type GuidelineConfig = {
21
22
  active?: boolean;
22
23
  show?: boolean;
23
24
  style?: 'dashed' | 'solid';
24
- color?: string;
25
+ color?: CSSToken;
25
26
  };
26
27
 
27
28
  // @public (undocumented)