@atlaskit/editor-plugin-loom 4.1.7 → 5.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,54 @@
1
1
  # @atlaskit/editor-plugin-loom
2
2
 
3
+ ## 5.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
+ - Updated dependencies
11
+
12
+ ## 5.0.0
13
+
14
+ ### Major Changes
15
+
16
+ - [#181024](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181024)
17
+ [`8e80c487ca307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e80c487ca307) - ##
18
+ Make `@atlaskit/editor-common` a peer dependency
19
+
20
+ **WHAT:** `@atlaskit/editor-common` has been moved from `dependencies` to `peerDependencies` in
21
+ all editor plugin packages.
22
+
23
+ **WHY:** This change ensures that only a single version of `@atlaskit/editor-common` is used in
24
+ consuming applications, preventing issues caused by multiple versions of singleton libraries (such
25
+ as context mismatches or duplicated state). This is especially important for packages that rely on
26
+ shared context or singletons.
27
+
28
+ **HOW TO ADJUST:**
29
+
30
+ - Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
31
+ any of these editor plugins.
32
+ - Ensure the version you install matches the version required by the plugins.
33
+ - You can use the
34
+ [`check-peer-dependencies`](https://www.npmjs.com/package/check-peer-dependencies) package to
35
+ verify that all required peer dependencies are installed and compatible.
36
+ - Example install command:
37
+ ```
38
+ npm install @atlaskit/editor-common
39
+ ```
40
+ or
41
+ ```
42
+ yarn add @atlaskit/editor-common
43
+ ```
44
+
45
+ **Note:** This is a breaking change. If `@atlaskit/editor-common` is not installed at the
46
+ application level, you may see errors or unexpected behavior.
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies
51
+
3
52
  ## 4.1.7
4
53
 
5
54
  ### Patch Changes
@@ -11,7 +11,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _hooks = require("@atlaskit/editor-common/hooks");
14
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
15
14
  var _commands = require("../pm-plugins/commands");
16
15
  var _ToolbarButtonComponent = _interopRequireDefault(require("./ToolbarButtonComponent"));
17
16
  var _excluded = ["onClickBeforeInit", "isDisabled", "href"];
@@ -21,13 +20,15 @@ var _excluded = ["onClickBeforeInit", "isDisabled", "href"];
21
20
  */
22
21
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
25
- var loomEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'loom.isEnabled');
26
- var connectivityMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
23
+ var selector = function selector(states) {
24
+ var _states$loomState, _states$connectivityS;
27
25
  return {
28
- loomEnabled: loomEnabled,
29
- connectivityMode: connectivityMode
26
+ loomEnabled: (_states$loomState = states.loomState) === null || _states$loomState === void 0 ? void 0 : _states$loomState.isEnabled,
27
+ connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
30
28
  };
29
+ };
30
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
31
+ return (0, _hooks.useSharedPluginStateWithSelector)(api, ['loom', 'connectivity'], selector);
31
32
  }, function (api) {
32
33
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['loom', 'connectivity']),
33
34
  loomState = _useSharedPluginState.loomState,
@@ -11,7 +11,6 @@ var _reactIntlNext = require("react-intl-next");
11
11
  var _hooks = require("@atlaskit/editor-common/hooks");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
14
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
15
14
  var _video = _interopRequireDefault(require("@atlaskit/icon/core/video"));
16
15
  /**
17
16
  * @jsxRuntime classic
@@ -26,11 +25,14 @@ var LOOM_BUTTON_WIDTH_BREAKPOINT = 1076;
26
25
  var iconMinWidthStyle = (0, _react2.css)({
27
26
  minWidth: 24
28
27
  });
29
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
30
- var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width');
28
+ var selector = function selector(states) {
29
+ var _states$widthState;
31
30
  return {
32
- width: width
31
+ width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
33
32
  };
33
+ };
34
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
35
+ return (0, _hooks.useSharedPluginStateWithSelector)(api, ['width'], selector);
34
36
  }, function (api) {
35
37
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width']),
36
38
  widthState = _useSharedPluginState.widthState;
@@ -7,17 +7,18 @@ import React, { useCallback } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { jsx } from '@emotion/react';
10
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
11
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
10
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
11
  import { executeRecordVideo } from '../pm-plugins/commands';
13
12
  import ToolbarButtonComponent from './ToolbarButtonComponent';
14
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
15
- const loomEnabled = useSharedPluginStateSelector(api, 'loom.isEnabled');
16
- const connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
13
+ const selector = states => {
14
+ var _states$loomState, _states$connectivityS;
17
15
  return {
18
- loomEnabled,
19
- connectivityMode
16
+ loomEnabled: (_states$loomState = states.loomState) === null || _states$loomState === void 0 ? void 0 : _states$loomState.isEnabled,
17
+ connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
20
18
  };
19
+ };
20
+ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
21
+ return useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector);
21
22
  }, api => {
22
23
  const {
23
24
  loomState,
@@ -7,10 +7,9 @@ import React from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { jsx, css } from '@emotion/react';
9
9
  import { injectIntl } from 'react-intl-next';
10
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
12
12
  import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
13
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
14
13
  import VideoIcon from '@atlaskit/icon/core/video';
15
14
  // This const is derived from the breakpoint where the toolbar hides its icons. It is used to hide the text in the AI button.
16
15
  // Derived from values from platform/packages/editor/editor-core/src/ui/Appearance/FullPage/MainToolbar.tsx
@@ -18,11 +17,14 @@ const LOOM_BUTTON_WIDTH_BREAKPOINT = 1076;
18
17
  const iconMinWidthStyle = css({
19
18
  minWidth: 24
20
19
  });
21
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
22
- const width = useSharedPluginStateSelector(api, 'width.width');
20
+ const selector = states => {
21
+ var _states$widthState;
23
22
  return {
24
- width
23
+ width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
25
24
  };
25
+ };
26
+ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
27
+ return useSharedPluginStateWithSelector(api, ['width'], selector);
26
28
  }, api => {
27
29
  const {
28
30
  widthState
@@ -9,17 +9,18 @@ import React, { useCallback } from 'react';
9
9
 
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
11
  import { jsx } from '@emotion/react';
12
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
13
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
12
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
14
13
  import { executeRecordVideo } from '../pm-plugins/commands';
15
14
  import ToolbarButtonComponent from './ToolbarButtonComponent';
16
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
17
- var loomEnabled = useSharedPluginStateSelector(api, 'loom.isEnabled');
18
- var connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
15
+ var selector = function selector(states) {
16
+ var _states$loomState, _states$connectivityS;
19
17
  return {
20
- loomEnabled: loomEnabled,
21
- connectivityMode: connectivityMode
18
+ loomEnabled: (_states$loomState = states.loomState) === null || _states$loomState === void 0 ? void 0 : _states$loomState.isEnabled,
19
+ connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
22
20
  };
21
+ };
22
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
23
+ return useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector);
23
24
  }, function (api) {
24
25
  var _useSharedPluginState = useSharedPluginState(api, ['loom', 'connectivity']),
25
26
  loomState = _useSharedPluginState.loomState,
@@ -7,10 +7,9 @@ import React from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { jsx, css } from '@emotion/react';
9
9
  import { injectIntl } from 'react-intl-next';
10
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
12
12
  import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
13
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
14
13
  import VideoIcon from '@atlaskit/icon/core/video';
15
14
  // This const is derived from the breakpoint where the toolbar hides its icons. It is used to hide the text in the AI button.
16
15
  // Derived from values from platform/packages/editor/editor-core/src/ui/Appearance/FullPage/MainToolbar.tsx
@@ -18,11 +17,14 @@ var LOOM_BUTTON_WIDTH_BREAKPOINT = 1076;
18
17
  var iconMinWidthStyle = css({
19
18
  minWidth: 24
20
19
  });
21
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
22
- var width = useSharedPluginStateSelector(api, 'width.width');
20
+ var selector = function selector(states) {
21
+ var _states$widthState;
23
22
  return {
24
- width: width
23
+ width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
25
24
  };
25
+ };
26
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
27
+ return useSharedPluginStateWithSelector(api, ['width'], selector);
26
28
  }, function (api) {
27
29
  var _useSharedPluginState = useSharedPluginState(api, ['width']),
28
30
  widthState = _useSharedPluginState.widthState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-loom",
3
- "version": "4.1.7",
3
+ "version": "5.0.1",
4
4
  "description": "Loom plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -12,8 +12,7 @@
12
12
  "website": {
13
13
  "name": "EditorPluginLoom",
14
14
  "category": "Components"
15
- },
16
- "runReact18": true
15
+ }
17
16
  },
18
17
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
19
18
  "main": "dist/cjs/index.js",
@@ -37,34 +36,34 @@
37
36
  },
38
37
  "dependencies": {
39
38
  "@atlaskit/button": "^23.2.0",
40
- "@atlaskit/editor-common": "^107.0.0",
41
- "@atlaskit/editor-plugin-analytics": "^2.3.0",
42
- "@atlaskit/editor-plugin-hyperlink": "^4.5.0",
43
- "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
44
- "@atlaskit/editor-plugin-quick-insert": "^2.6.0",
45
- "@atlaskit/editor-plugin-width": "^3.0.0",
39
+ "@atlaskit/editor-plugin-analytics": "^3.0.0",
40
+ "@atlaskit/editor-plugin-hyperlink": "^5.0.0",
41
+ "@atlaskit/editor-plugin-primary-toolbar": "^4.0.0",
42
+ "@atlaskit/editor-plugin-quick-insert": "^3.0.0",
43
+ "@atlaskit/editor-plugin-width": "^4.0.0",
46
44
  "@atlaskit/editor-prosemirror": "7.0.0",
47
- "@atlaskit/icon": "^27.0.0",
45
+ "@atlaskit/icon": "^27.3.0",
48
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
- "@atlaskit/tokens": "^5.2.0",
47
+ "@atlaskit/tokens": "^5.4.0",
50
48
  "@babel/runtime": "^7.0.0",
51
49
  "@emotion/react": "^11.7.1",
52
50
  "@loomhq/record-sdk": "^2.36.18"
53
51
  },
54
52
  "peerDependencies": {
53
+ "@atlaskit/editor-common": "^107.7.0",
55
54
  "react": "^18.2.0",
56
55
  "react-dom": "^18.2.0",
57
56
  "react-intl-next": "npm:react-intl@^5.18.1"
58
57
  },
59
58
  "devDependencies": {
60
- "@atlaskit/editor-plugin-base": "^3.0.0",
61
- "@atlaskit/editor-plugin-card": "^6.6.0",
62
- "@atlaskit/editor-plugin-copy-button": "^2.0.0",
63
- "@atlaskit/editor-plugin-decorations": "^2.0.0",
64
- "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
65
- "@atlaskit/editor-plugin-feature-flags": "^1.4.0",
66
- "@atlaskit/editor-plugin-floating-toolbar": "^4.2.0",
67
- "@atlaskit/editor-plugin-grid": "^2.0.0",
59
+ "@atlaskit/editor-plugin-base": "^4.0.0",
60
+ "@atlaskit/editor-plugin-card": "^7.0.0",
61
+ "@atlaskit/editor-plugin-copy-button": "^3.0.0",
62
+ "@atlaskit/editor-plugin-decorations": "^3.0.0",
63
+ "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
64
+ "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
65
+ "@atlaskit/editor-plugin-floating-toolbar": "^5.0.0",
66
+ "@atlaskit/editor-plugin-grid": "^3.0.0",
68
67
  "@testing-library/react": "^13.4.0",
69
68
  "@testing-library/user-event": "^14.4.3",
70
69
  "raf-stub": "^2.0.1",