@atlaskit/editor-plugin-grid 2.0.9 → 3.0.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,53 @@
1
1
  # @atlaskit/editor-plugin-grid
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#182839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182839)
8
+ [`81f1c3383bdab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81f1c3383bdab) -
9
+ refactor: use useSharedPluginStateWithSelector instead of useSharedPluginStateSelector
10
+
11
+ ## 3.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
16
+ [`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
17
+ Make `@atlaskit/editor-common` a peer dependency
18
+
19
+ **WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
20
+ all editor plugin packages.
21
+
22
+ **WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
23
+ consuming applications, preventing issues caused by multiple versions of singleton libraries (such
24
+ as context mismatches or duplicated state). This is especially important for packages that rely on
25
+ shared context or singletons.
26
+
27
+ **HOW TO ADJUST:**
28
+
29
+ - Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
30
+ any of these editor plugins.
31
+ - Ensure the version you install matches the version required by the plugins.
32
+ - You can use the
33
+ [`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
34
+ verify that all required peer dependencies are installed and compatible.
35
+ - Example install command:
36
+ ```
37
+ npm install @atlaskit/editor-common
38
+ ```
39
+ or
40
+ ```
41
+ yarn add @atlaskit/editor-common
42
+ ```
43
+
44
+ **Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
45
+ application level, you may see errors or unexpected behavior.
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies
50
+
3
51
  ## 2.0.9
4
52
 
5
53
  ### Patch Changes
@@ -12,7 +12,6 @@ var _react2 = require("@emotion/react");
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
  var _hooks = require("@atlaskit/editor-common/hooks");
14
14
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
15
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
16
15
  var _state = require("@atlaskit/editor-prosemirror/state");
17
16
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
18
17
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -121,17 +120,17 @@ var Grid = function Grid(_ref3) {
121
120
  );
122
121
  };
123
122
  var ThemedGrid = (0, _react2.withTheme)(Grid);
124
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
125
- var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width');
126
- var visible = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'grid.visible');
127
- var gridType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'grid.gridType');
128
- var highlight = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'grid.highlight');
123
+ var selector = function selector(states) {
124
+ var _states$widthState, _states$gridState, _states$gridState2, _states$gridState3;
129
125
  return {
130
- width: width,
131
- visible: visible,
132
- gridType: gridType,
133
- highlight: highlight
126
+ width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
127
+ visible: (_states$gridState = states.gridState) === null || _states$gridState === void 0 ? void 0 : _states$gridState.visible,
128
+ gridType: (_states$gridState2 = states.gridState) === null || _states$gridState2 === void 0 ? void 0 : _states$gridState2.gridType,
129
+ highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
134
130
  };
131
+ };
132
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
133
+ return (0, _hooks.useSharedPluginStateWithSelector)(api, ['width', 'grid'], selector);
135
134
  }, function (api) {
136
135
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'grid']),
137
136
  widthState = _useSharedPluginState.widthState,
@@ -3,9 +3,8 @@ 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 } from '@atlaskit/editor-common/hooks';
6
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
8
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
10
9
  import { akEditorBreakoutPadding, akEditorFullPageMaxWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
11
10
  export const GRID_SIZE = 12;
@@ -114,17 +113,17 @@ const Grid = ({
114
113
  );
115
114
  };
116
115
  const ThemedGrid = withTheme(Grid);
117
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
118
- const width = useSharedPluginStateSelector(api, 'width.width');
119
- const visible = useSharedPluginStateSelector(api, 'grid.visible');
120
- const gridType = useSharedPluginStateSelector(api, 'grid.gridType');
121
- const highlight = useSharedPluginStateSelector(api, 'grid.highlight');
116
+ const selector = states => {
117
+ var _states$widthState, _states$gridState, _states$gridState2, _states$gridState3;
122
118
  return {
123
- width,
124
- visible,
125
- gridType,
126
- highlight
119
+ width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
120
+ visible: (_states$gridState = states.gridState) === null || _states$gridState === void 0 ? void 0 : _states$gridState.visible,
121
+ gridType: (_states$gridState2 = states.gridState) === null || _states$gridState2 === void 0 ? void 0 : _states$gridState2.gridType,
122
+ highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
127
123
  };
124
+ };
125
+ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
126
+ return useSharedPluginStateWithSelector(api, ['width', 'grid'], selector);
128
127
  }, api => {
129
128
  const {
130
129
  widthState,
@@ -5,9 +5,8 @@ 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 } from '@atlaskit/editor-common/hooks';
8
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
9
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
10
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
11
10
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
12
11
  import { akEditorBreakoutPadding, akEditorFullPageMaxWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
13
12
  export var GRID_SIZE = 12;
@@ -114,17 +113,17 @@ var Grid = function Grid(_ref3) {
114
113
  );
115
114
  };
116
115
  var ThemedGrid = withTheme(Grid);
117
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
118
- var width = useSharedPluginStateSelector(api, 'width.width');
119
- var visible = useSharedPluginStateSelector(api, 'grid.visible');
120
- var gridType = useSharedPluginStateSelector(api, 'grid.gridType');
121
- var highlight = useSharedPluginStateSelector(api, 'grid.highlight');
116
+ var selector = function selector(states) {
117
+ var _states$widthState, _states$gridState, _states$gridState2, _states$gridState3;
122
118
  return {
123
- width: width,
124
- visible: visible,
125
- gridType: gridType,
126
- highlight: highlight
119
+ width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
120
+ visible: (_states$gridState = states.gridState) === null || _states$gridState === void 0 ? void 0 : _states$gridState.visible,
121
+ gridType: (_states$gridState2 = states.gridState) === null || _states$gridState2 === void 0 ? void 0 : _states$gridState2.gridType,
122
+ highlight: (_states$gridState3 = states.gridState) === null || _states$gridState3 === void 0 ? void 0 : _states$gridState3.highlight
127
123
  };
124
+ };
125
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
126
+ return useSharedPluginStateWithSelector(api, ['width', 'grid'], selector);
128
127
  }, function (api) {
129
128
  var _useSharedPluginState = useSharedPluginState(api, ['width', 'grid']),
130
129
  widthState = _useSharedPluginState.widthState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-grid",
3
- "version": "2.0.9",
3
+ "version": "3.0.1",
4
4
  "description": "Grid plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -9,8 +9,7 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor: Jenga",
12
- "singleton": true,
13
- "runReact18": true
12
+ "singleton": true
14
13
  },
15
14
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
16
15
  "main": "dist/cjs/index.js",
@@ -25,8 +24,7 @@
25
24
  ".": "./src/index.ts"
26
25
  },
27
26
  "dependencies": {
28
- "@atlaskit/editor-common": "^107.0.0",
29
- "@atlaskit/editor-plugin-width": "^3.0.0",
27
+ "@atlaskit/editor-plugin-width": "^4.0.0",
30
28
  "@atlaskit/editor-prosemirror": "7.0.0",
31
29
  "@atlaskit/editor-shared-styles": "^3.4.0",
32
30
  "@babel/runtime": "^7.0.0",
@@ -34,6 +32,7 @@
34
32
  "classnames": "^2.2.5"
35
33
  },
36
34
  "peerDependencies": {
35
+ "@atlaskit/editor-common": "^107.7.0",
37
36
  "react": "^18.2.0",
38
37
  "react-dom": "^18.2.0"
39
38
  },