@atlaskit/editor-plugin-grid 3.1.0 → 4.0.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-grid
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0fda385059db0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0fda385059db0) -
8
+ PR to cleanup platform_editor_usesharedpluginstatewithselector for `collab-edit`,
9
+ `floating-toolbar`, `grid` and `guideline`
10
+ - Updated dependencies
11
+
12
+ ## 3.1.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
17
+ Sorted type and interface props to improve Atlaskit docs
18
+ - Updated dependencies
19
+
3
20
  ## 3.1.0
4
21
 
5
22
  ### Minor Changes
@@ -129,28 +129,15 @@ var selector = function selector(states) {
129
129
  highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
130
130
  };
131
131
  };
132
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
133
- return (0, _hooks.useSharedPluginStateWithSelector)(api, ['width', 'grid'], selector);
134
- }, function (api) {
135
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'grid']),
136
- widthState = _useSharedPluginState.widthState,
137
- gridState = _useSharedPluginState.gridState;
138
- return {
139
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
140
- visible: gridState === null || gridState === void 0 ? void 0 : gridState.visible,
141
- gridType: gridState === null || gridState === void 0 ? void 0 : gridState.gridType,
142
- highlight: gridState === null || gridState === void 0 ? void 0 : gridState.highlight
143
- };
144
- });
145
132
  var ContentComponent = function ContentComponent(_ref4) {
146
133
  var api = _ref4.api,
147
134
  editorView = _ref4.editorView,
148
135
  options = _ref4.options;
149
- var _useSharedState = useSharedState(api),
150
- width = _useSharedState.width,
151
- visible = _useSharedState.visible,
152
- gridType = _useSharedState.gridType,
153
- highlight = _useSharedState.highlight;
136
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['width', 'grid'], selector),
137
+ width = _useSharedPluginState.width,
138
+ visible = _useSharedPluginState.visible,
139
+ gridType = _useSharedPluginState.gridType,
140
+ highlight = _useSharedPluginState.highlight;
154
141
  if (visible === undefined || !highlight) {
155
142
  return null;
156
143
  }
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
4
4
  import { withTheme } from '@emotion/react';
5
5
  import classnames from 'classnames';
6
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
6
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
9
9
  import { akEditorBreakoutPadding, akEditorFullPageMaxWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
@@ -122,20 +122,6 @@ const selector = states => {
122
122
  highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
123
123
  };
124
124
  };
125
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
126
- return useSharedPluginStateWithSelector(api, ['width', 'grid'], selector);
127
- }, api => {
128
- const {
129
- widthState,
130
- gridState
131
- } = useSharedPluginState(api, ['width', 'grid']);
132
- return {
133
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
134
- visible: gridState === null || gridState === void 0 ? void 0 : gridState.visible,
135
- gridType: gridState === null || gridState === void 0 ? void 0 : gridState.gridType,
136
- highlight: gridState === null || gridState === void 0 ? void 0 : gridState.highlight
137
- };
138
- });
139
125
  const ContentComponent = ({
140
126
  api,
141
127
  editorView,
@@ -146,7 +132,7 @@ const ContentComponent = ({
146
132
  visible,
147
133
  gridType,
148
134
  highlight
149
- } = useSharedState(api);
135
+ } = useSharedPluginStateWithSelector(api, ['width', 'grid'], selector);
150
136
  if (visible === undefined || !highlight) {
151
137
  return null;
152
138
  }
@@ -5,7 +5,7 @@ import React from 'react';
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { withTheme } from '@emotion/react';
7
7
  import classnames from 'classnames';
8
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
9
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
10
10
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
11
11
  import { akEditorBreakoutPadding, akEditorFullPageMaxWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
@@ -122,28 +122,15 @@ var selector = function selector(states) {
122
122
  highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
123
123
  };
124
124
  };
125
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
126
- return useSharedPluginStateWithSelector(api, ['width', 'grid'], selector);
127
- }, function (api) {
128
- var _useSharedPluginState = useSharedPluginState(api, ['width', 'grid']),
129
- widthState = _useSharedPluginState.widthState,
130
- gridState = _useSharedPluginState.gridState;
131
- return {
132
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
133
- visible: gridState === null || gridState === void 0 ? void 0 : gridState.visible,
134
- gridType: gridState === null || gridState === void 0 ? void 0 : gridState.gridType,
135
- highlight: gridState === null || gridState === void 0 ? void 0 : gridState.highlight
136
- };
137
- });
138
125
  var ContentComponent = function ContentComponent(_ref4) {
139
126
  var api = _ref4.api,
140
127
  editorView = _ref4.editorView,
141
128
  options = _ref4.options;
142
- var _useSharedState = useSharedState(api),
143
- width = _useSharedState.width,
144
- visible = _useSharedState.visible,
145
- gridType = _useSharedState.gridType,
146
- highlight = _useSharedState.highlight;
129
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['width', 'grid'], selector),
130
+ width = _useSharedPluginState.width,
131
+ visible = _useSharedPluginState.visible,
132
+ gridType = _useSharedPluginState.gridType,
133
+ highlight = _useSharedPluginState.highlight;
147
134
  if (visible === undefined || !highlight) {
148
135
  return null;
149
136
  }
@@ -8,8 +8,8 @@ export type GridPluginActions = {
8
8
  displayGrid: CreateDisplayGrid;
9
9
  };
10
10
  export type GridPlugin = NextEditorPlugin<'grid', {
11
- pluginConfiguration: GridPluginConfiguration;
11
+ actions: GridPluginActions;
12
12
  dependencies: GridPluginDependencies;
13
+ pluginConfiguration: GridPluginConfiguration;
13
14
  sharedState: GridPluginSharedState;
14
- actions: GridPluginActions;
15
15
  }>;
@@ -2,9 +2,9 @@ import type { GridType } from '@atlaskit/editor-common/types';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  export type Highlights = Array<'wide' | 'full-width' | number>;
4
4
  export type GridPluginState = {
5
- visible: boolean;
6
5
  gridType?: GridType;
7
6
  highlight: Highlights;
7
+ visible: boolean;
8
8
  };
9
9
  type Required<T> = {
10
10
  [P in keyof T]-?: T[P];
@@ -10,8 +10,8 @@ export type GridPluginActions = {
10
10
  displayGrid: CreateDisplayGrid;
11
11
  };
12
12
  export type GridPlugin = NextEditorPlugin<'grid', {
13
- pluginConfiguration: GridPluginConfiguration;
13
+ actions: GridPluginActions;
14
14
  dependencies: GridPluginDependencies;
15
+ pluginConfiguration: GridPluginConfiguration;
15
16
  sharedState: GridPluginSharedState;
16
- actions: GridPluginActions;
17
17
  }>;
@@ -2,9 +2,9 @@ import type { GridType } from '@atlaskit/editor-common/types';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  export type Highlights = Array<'wide' | 'full-width' | number>;
4
4
  export type GridPluginState = {
5
- visible: boolean;
6
5
  gridType?: GridType;
7
6
  highlight: Highlights;
7
+ visible: boolean;
8
8
  };
9
9
  type Required<T> = {
10
10
  [P in keyof T]-?: T[P];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-grid",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "Grid plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -20,25 +20,21 @@
20
20
  "*.compiled.css"
21
21
  ],
22
22
  "atlaskit:src": "src/index.ts",
23
- "af:exports": {
24
- ".": "./src/index.ts"
25
- },
26
23
  "dependencies": {
27
- "@atlaskit/editor-plugin-width": "^4.0.0",
24
+ "@atlaskit/editor-plugin-width": "^5.0.0",
28
25
  "@atlaskit/editor-prosemirror": "7.0.0",
29
- "@atlaskit/editor-shared-styles": "^3.5.0",
26
+ "@atlaskit/editor-shared-styles": "^3.6.0",
30
27
  "@babel/runtime": "^7.0.0",
31
28
  "@emotion/react": "^11.7.1",
32
29
  "classnames": "^2.2.5"
33
30
  },
34
31
  "peerDependencies": {
35
- "@atlaskit/editor-common": "^107.9.0",
32
+ "@atlaskit/editor-common": "^108.0.0",
36
33
  "react": "^18.2.0",
37
34
  "react-dom": "^18.2.0"
38
35
  },
39
36
  "devDependencies": {
40
37
  "@testing-library/react": "^13.4.0",
41
- "typescript": "~5.4.2",
42
38
  "wait-for-expect": "^1.2.0"
43
39
  },
44
40
  "techstack": {