@atlaskit/editor-common 96.4.0 → 96.5.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.
Files changed (145) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/analytics/analytics-queue.js +4 -5
  3. package/dist/cjs/annotation/index.js +9 -10
  4. package/dist/cjs/element-browser/ElementBrowser.js +11 -14
  5. package/dist/cjs/event-dispatcher/index.js +1 -2
  6. package/dist/cjs/extensibility/Extension/Lozenge/index.js +7 -10
  7. package/dist/cjs/extensibility/Extension.js +6 -9
  8. package/dist/cjs/extensibility/ExtensionComponent.js +25 -30
  9. package/dist/cjs/extensibility/extensionNodeView.js +5 -7
  10. package/dist/cjs/extensions/default-extension-provider.js +1 -2
  11. package/dist/cjs/hooks/useSharedPluginState.js +3 -0
  12. package/dist/cjs/hooks/useSharedPluginStateSelector/index.js +12 -0
  13. package/dist/cjs/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +114 -0
  14. package/dist/cjs/lazy-node-view/lazy-scheduler.js +1 -1
  15. package/dist/cjs/lazy-node-view/node-view.js +1 -2
  16. package/dist/cjs/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +39 -45
  17. package/dist/cjs/link/LinkSearch/LinkSearchList.js +5 -7
  18. package/dist/cjs/link/LinkSearch/LinkSearchListItem.js +9 -12
  19. package/dist/cjs/link/LinkSearch/index.js +13 -16
  20. package/dist/cjs/link/LinkSearch/withActivityProvider.js +6 -9
  21. package/dist/cjs/media-inline/inline-image-wrapper.js +1 -2
  22. package/dist/cjs/monitoring/error.js +1 -1
  23. package/dist/cjs/portal/PortalManager.js +1 -2
  24. package/dist/cjs/preset/builder.js +2 -4
  25. package/dist/cjs/preset/editor-commands.js +4 -5
  26. package/dist/cjs/preset/plugin-injection-api.js +4 -8
  27. package/dist/cjs/provider-factory/provider-factory.js +1 -2
  28. package/dist/cjs/provider-factory/with-providers.js +8 -11
  29. package/dist/cjs/react-node-view/index.js +1 -2
  30. package/dist/cjs/safe-plugin/index.js +4 -5
  31. package/dist/cjs/selection/gap-cursor/selection.js +7 -11
  32. package/dist/cjs/selection-based-node-view/SelectionBasedNodeView.js +10 -13
  33. package/dist/cjs/styles/shared/media-single.js +21 -20
  34. package/dist/cjs/styles/shared/paragraph.js +1 -1
  35. package/dist/cjs/styles/shared/shadow.js +9 -8
  36. package/dist/cjs/styles/shared/table.js +1 -1
  37. package/dist/cjs/types/annotation/emitter.js +1 -2
  38. package/dist/cjs/ui/Caption/index.js +5 -7
  39. package/dist/cjs/ui/ContextPanel/context.js +8 -11
  40. package/dist/cjs/ui/DropList/index.js +22 -25
  41. package/dist/cjs/ui/ErrorBoundary/index.js +6 -9
  42. package/dist/cjs/ui/Expand/sharedStyles.js +1 -1
  43. package/dist/cjs/ui/IntlErrorBoundary/index.js +6 -9
  44. package/dist/cjs/ui/Layer/index.js +9 -12
  45. package/dist/cjs/ui/Mention/index.js +6 -9
  46. package/dist/cjs/ui/Mention/mention-with-providers.js +6 -9
  47. package/dist/cjs/ui/Messages/index.js +1 -1
  48. package/dist/cjs/ui/OverflowShadow/index.js +13 -16
  49. package/dist/cjs/ui/OverflowShadow/shadowObserver.js +3 -5
  50. package/dist/cjs/ui/PanelTextInput/index.js +10 -13
  51. package/dist/cjs/ui/Popup/index.js +14 -17
  52. package/dist/cjs/ui/ResizerLegacy/index.js +12 -16
  53. package/dist/cjs/ui/WithCreateAnalyticsEvent/index.js +5 -7
  54. package/dist/cjs/ui/with-outer-listeners.js +10 -13
  55. package/dist/cjs/ui-menu/Dropdown/index.js +9 -12
  56. package/dist/cjs/ui-menu/DropdownMenu/index.js +11 -14
  57. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +8 -11
  58. package/dist/cjs/utils/error-reporter.js +1 -2
  59. package/dist/cjs/utils/hyperlink.js +2 -4
  60. package/dist/cjs/utils/imageLoader.js +14 -19
  61. package/dist/cjs/utils/profiler/render-count.js +3 -2
  62. package/dist/cjs/utils/traversor.js +1 -2
  63. package/dist/cjs/with-plugin-state/index.js +28 -35
  64. package/dist/es2019/analytics/analytics-queue.js +3 -3
  65. package/dist/es2019/hooks/useSharedPluginState.js +3 -0
  66. package/dist/es2019/hooks/useSharedPluginStateSelector/index.js +2 -0
  67. package/dist/es2019/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +98 -0
  68. package/dist/es2019/lazy-node-view/lazy-scheduler.js +1 -1
  69. package/dist/es2019/monitoring/error.js +1 -1
  70. package/dist/es2019/styles/shared/paragraph.js +1 -1
  71. package/dist/es2019/styles/shared/table.js +1 -1
  72. package/dist/es2019/ui/DropList/index.js +1 -1
  73. package/dist/es2019/ui/Expand/sharedStyles.js +1 -1
  74. package/dist/es2019/ui/Messages/index.js +1 -1
  75. package/dist/es2019/utils/profiler/render-count.js +2 -0
  76. package/dist/esm/analytics/analytics-queue.js +4 -5
  77. package/dist/esm/annotation/index.js +9 -10
  78. package/dist/esm/element-browser/ElementBrowser.js +11 -14
  79. package/dist/esm/event-dispatcher/index.js +1 -2
  80. package/dist/esm/extensibility/Extension/Lozenge/index.js +7 -10
  81. package/dist/esm/extensibility/Extension.js +6 -9
  82. package/dist/esm/extensibility/ExtensionComponent.js +25 -30
  83. package/dist/esm/extensibility/extensionNodeView.js +5 -7
  84. package/dist/esm/extensions/default-extension-provider.js +1 -2
  85. package/dist/esm/hooks/useSharedPluginState.js +3 -0
  86. package/dist/esm/hooks/useSharedPluginStateSelector/index.js +2 -0
  87. package/dist/esm/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.js +108 -0
  88. package/dist/esm/lazy-node-view/lazy-scheduler.js +1 -1
  89. package/dist/esm/lazy-node-view/node-view.js +1 -2
  90. package/dist/esm/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.js +39 -45
  91. package/dist/esm/link/LinkSearch/LinkSearchList.js +5 -7
  92. package/dist/esm/link/LinkSearch/LinkSearchListItem.js +9 -12
  93. package/dist/esm/link/LinkSearch/index.js +13 -16
  94. package/dist/esm/link/LinkSearch/withActivityProvider.js +6 -9
  95. package/dist/esm/media-inline/inline-image-wrapper.js +1 -2
  96. package/dist/esm/monitoring/error.js +1 -1
  97. package/dist/esm/portal/PortalManager.js +1 -2
  98. package/dist/esm/preset/builder.js +2 -4
  99. package/dist/esm/preset/editor-commands.js +4 -5
  100. package/dist/esm/preset/plugin-injection-api.js +4 -8
  101. package/dist/esm/provider-factory/provider-factory.js +1 -2
  102. package/dist/esm/provider-factory/with-providers.js +8 -11
  103. package/dist/esm/react-node-view/index.js +1 -2
  104. package/dist/esm/safe-plugin/index.js +4 -5
  105. package/dist/esm/selection/gap-cursor/selection.js +7 -11
  106. package/dist/esm/selection-based-node-view/SelectionBasedNodeView.js +10 -13
  107. package/dist/esm/styles/shared/media-single.js +19 -20
  108. package/dist/esm/styles/shared/paragraph.js +1 -1
  109. package/dist/esm/styles/shared/shadow.js +7 -8
  110. package/dist/esm/styles/shared/table.js +1 -1
  111. package/dist/esm/types/annotation/emitter.js +1 -2
  112. package/dist/esm/ui/Caption/index.js +5 -7
  113. package/dist/esm/ui/ContextPanel/context.js +8 -11
  114. package/dist/esm/ui/DropList/index.js +22 -25
  115. package/dist/esm/ui/ErrorBoundary/index.js +6 -9
  116. package/dist/esm/ui/Expand/sharedStyles.js +1 -1
  117. package/dist/esm/ui/IntlErrorBoundary/index.js +6 -9
  118. package/dist/esm/ui/Layer/index.js +9 -12
  119. package/dist/esm/ui/Mention/index.js +6 -9
  120. package/dist/esm/ui/Mention/mention-with-providers.js +6 -9
  121. package/dist/esm/ui/Messages/index.js +1 -1
  122. package/dist/esm/ui/OverflowShadow/index.js +13 -16
  123. package/dist/esm/ui/OverflowShadow/shadowObserver.js +3 -5
  124. package/dist/esm/ui/PanelTextInput/index.js +10 -13
  125. package/dist/esm/ui/Popup/index.js +14 -17
  126. package/dist/esm/ui/ResizerLegacy/index.js +12 -16
  127. package/dist/esm/ui/WithCreateAnalyticsEvent/index.js +5 -7
  128. package/dist/esm/ui/with-outer-listeners.js +10 -13
  129. package/dist/esm/ui-menu/Dropdown/index.js +9 -12
  130. package/dist/esm/ui-menu/DropdownMenu/index.js +11 -14
  131. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +8 -11
  132. package/dist/esm/utils/error-reporter.js +1 -2
  133. package/dist/esm/utils/hyperlink.js +2 -4
  134. package/dist/esm/utils/imageLoader.js +14 -19
  135. package/dist/esm/utils/profiler/render-count.js +3 -2
  136. package/dist/esm/utils/traversor.js +1 -2
  137. package/dist/esm/with-plugin-state/index.js +28 -35
  138. package/dist/types/hooks/useSharedPluginState.d.ts +5 -3
  139. package/dist/types/hooks/useSharedPluginStateSelector/index.d.ts +1 -0
  140. package/dist/types/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.d.ts +74 -0
  141. package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +5 -3
  142. package/dist/types-ts4.5/hooks/useSharedPluginStateSelector/index.d.ts +1 -0
  143. package/dist/types-ts4.5/hooks/useSharedPluginStateSelector/useSharedPluginStateSelector.d.ts +74 -0
  144. package/package.json +4 -3
  145. package/use-shared-plugin-state-selector/package.json +15 -0
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- var _class;
2
+ var _AnalyticsQueue;
3
3
  import memoizeOne from 'memoize-one';
4
4
  export class AnalyticsQueue {
5
5
  constructor() {
@@ -51,5 +51,5 @@ export class AnalyticsQueue {
51
51
  this.process();
52
52
  }
53
53
  }
54
- _class = AnalyticsQueue;
55
- _defineProperty(AnalyticsQueue, "get", memoizeOne(() => new _class()));
54
+ _AnalyticsQueue = AnalyticsQueue;
55
+ _defineProperty(AnalyticsQueue, "get", memoizeOne(() => new _AnalyticsQueue()));
@@ -25,6 +25,9 @@ function useStaticPlugins(plugins) {
25
25
  }
26
26
 
27
27
  /**
28
+ *
29
+ * NOTE: Generally you may want to use `usePluginStateSelector` over this which behaves similarly
30
+ * but selects a slice of the state which is more performant.
28
31
  *
29
32
  * ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
30
33
  * If the plugins you are listening to generate multiple shared states while the user is typing,
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line @atlaskit/editor/no-re-export
2
+ export { useSharedPluginStateSelector } from './useSharedPluginStateSelector';
@@ -0,0 +1,98 @@
1
+ import { useState, useCallback, useMemo } from 'react';
2
+ import get from 'lodash/get';
3
+ import isEqual from 'lodash/isEqual';
4
+ import { usePluginStateEffect } from '../usePluginStateEffect';
5
+
6
+ /**
7
+ * This is designed to iterate through an object to get the path of its result
8
+ * based on separation via "."
9
+ *
10
+ * Example:
11
+ * ```typescript
12
+ * type Test = { deepObject: { value: number } };
13
+ * // Type should be `"deepObject" | "deepObject.value"`
14
+ * type Result = NestedKeys<Test>;
15
+ * ```
16
+ */
17
+
18
+ /**
19
+ * This is designed to iterate through a path of an object to get the type of its result
20
+ * based on separation via "."
21
+ *
22
+ * Example:
23
+ * ```typescript
24
+ * type Test = { deepObject: { value: number } }
25
+ * // Type should be `number`
26
+ * type Result = Path<Test, 'deepObject.value'>
27
+ * ```
28
+ */
29
+
30
+ /**
31
+ *
32
+ * ⚠️⚠️⚠️ This is a debounced hook ⚠️⚠️⚠️
33
+ * If the plugins you are listening to generate multiple shared states while the user is typing,
34
+ * your React Component will get only the last one.
35
+ *
36
+ * Used to return the current plugin state of input dependencies.
37
+ * It will recursively retrieve a slice of the state using a "." to separate
38
+ * parts of the state.
39
+ *
40
+ * Example:
41
+ *
42
+ * ```typescript
43
+ * const pluginA: NextEditorPlugin<
44
+ 'pluginA',
45
+ {
46
+ sharedState: { deepObj: { value: number | undefined } };
47
+ }
48
+ >
49
+ * ```
50
+ * You can use `const value = useSharedPluginStateSelector(api, 'pluginA.deepObj.value')` to retrieve the value
51
+ *
52
+ * Example in plugin:
53
+ *
54
+ * ```typescript
55
+ * function ExampleContent({ api }: Props) {
56
+ * const title = useSharedPluginStateSelector(api, 'dog.title')
57
+ * return <p>{ title } { exampleState.description }</p>
58
+ * }
59
+ *
60
+ * const examplePlugin: NextEditorPlugin<'example', { dependencies: [typeof pluginDog] }> = ({ api }) => {
61
+ * return {
62
+ * name: 'example',
63
+ * contentComponent: () => <ExampleContent api={api} />
64
+ * }
65
+ * }
66
+ * ```
67
+ *
68
+ * NOTE: If you pass an invalid path, `undefined` will be returned
69
+ *
70
+ * @param api
71
+ * @param plugin
72
+ * @returns
73
+ */
74
+ export function useSharedPluginStateSelector(api, plugin) {
75
+ const transformer = useCallback(pluginState => {
76
+ const [pluginName, ...properties] = plugin.split('.');
77
+ if (!pluginState || (properties === null || properties === void 0 ? void 0 : properties.length) === 0) {
78
+ return undefined;
79
+ }
80
+ return get(pluginState === null || pluginState === void 0 ? void 0 : pluginState[`${pluginName}State`], properties);
81
+ }, [plugin]);
82
+ const pluginNameArray = useMemo(() => {
83
+ const [pluginName] = plugin.split('.');
84
+ return [pluginName];
85
+ }, [plugin]);
86
+ return useSharedPluginStateSelectorInternal(api, pluginNameArray, transformer);
87
+ }
88
+ function useSharedPluginStateSelectorInternal(api, plugins, transformer) {
89
+ const [selectedPluginState, setSelectedPluginState] = useState();
90
+ usePluginStateEffect(api, plugins, pluginStates => {
91
+ // `pluginStates`: This is the same type through inference - but typescript doesn't recognise them as they are computed slightly differently
92
+ const transformedValue = transformer(pluginStates);
93
+ if (!isEqual(transformedValue, selectedPluginState)) {
94
+ setSelectedPluginState(transformedValue);
95
+ }
96
+ });
97
+ return selectedPluginState;
98
+ }
@@ -1,4 +1,4 @@
1
- const hasIdleCallback = 'requestIdleCallback' in window;
1
+ const hasIdleCallback = ('requestIdleCallback' in window);
2
2
  export const scheduleCallback = (cb, options) => {
3
3
  return hasIdleCallback ? requestIdleCallback(cb, {
4
4
  timeout: 5000,
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "96.4.0";
4
+ const packageVersion = "96.5.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -23,7 +23,7 @@ export const paragraphSharedStyles = typographyTheme => {
23
23
  fontSize: '1em',
24
24
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
25
25
  lineHeight: akEditorLineHeight,
26
- fontWeight: 'normal',
26
+ fontWeight: "var(--ds-font-weight-regular, 400)",
27
27
  marginTop: blockNodesVerticalMargin,
28
28
  marginBottom: 0,
29
29
  letterSpacing: '-0.005em'
@@ -136,7 +136,7 @@ const tableSharedStyle = () => css`
136
136
  th,
137
137
  td {
138
138
  min-width: ${tableCellMinWidth}px;
139
- font-weight: normal;
139
+ font-weight: ${"var(--ds-font-weight-regular, 400)"};
140
140
  vertical-align: top;
141
141
  border: 1px solid ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
142
142
  border-right-width: 0;
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "96.4.0";
16
+ const packageVersion = "96.5.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -76,7 +76,7 @@ const titleInputStyles = () => css({
76
76
  fontSize: relativeFontSizeToBase16(14),
77
77
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
78
78
  lineHeight: fg('platform-visual-refresh-icons') ? 1 : akEditorLineHeight,
79
- fontWeight: 'normal',
79
+ fontWeight: "var(--ds-font-weight-regular, 400)",
80
80
  color: "var(--ds-text-subtlest, #626F86)",
81
81
  background: 'transparent',
82
82
  display: 'flex',
@@ -22,7 +22,7 @@ css({
22
22
  fontSize: `${12 / 14}em`,
23
23
  fontStyle: 'inherit',
24
24
  lineHeight: 16 / 12,
25
- fontWeight: 'normal',
25
+ fontWeight: "var(--ds-font-weight-regular, 400)",
26
26
  color: "var(--ds-text-subtlest, #626F86)",
27
27
  marginTop: "var(--ds-space-050, 4px)",
28
28
  display: 'flex',
@@ -71,6 +71,7 @@ export class RenderCountProfiler {
71
71
  var _this$store$PROFILER_, _this$store3, _this$store3$PROFILER, _this$store3$PROFILER2;
72
72
  const component = (_this$store$PROFILER_ = (_this$store3 = this.store) === null || _this$store3 === void 0 ? void 0 : (_this$store3$PROFILER = _this$store3[PROFILER_KEY]) === null || _this$store3$PROFILER === void 0 ? void 0 : (_this$store3$PROFILER2 = _this$store3$PROFILER.components) === null || _this$store3$PROFILER2 === void 0 ? void 0 : _this$store3$PROFILER2[componentId]) !== null && _this$store$PROFILER_ !== void 0 ? _this$store$PROFILER_ : {};
73
73
  const counters = [];
74
+ // eslint-disable-next-line guard-for-in
74
75
  for (let instanceId in component) {
75
76
  const counter = {
76
77
  instanceId,
@@ -86,6 +87,7 @@ export class RenderCountProfiler {
86
87
  var _this$store$PROFILER_2, _this$store4, _this$store4$PROFILER, _this$store4$PROFILER2;
87
88
  const component = (_this$store$PROFILER_2 = (_this$store4 = this.store) === null || _this$store4 === void 0 ? void 0 : (_this$store4$PROFILER = _this$store4[PROFILER_KEY]) === null || _this$store4$PROFILER === void 0 ? void 0 : (_this$store4$PROFILER2 = _this$store4$PROFILER.components) === null || _this$store4$PROFILER2 === void 0 ? void 0 : _this$store4$PROFILER2[componentId]) !== null && _this$store$PROFILER_2 !== void 0 ? _this$store$PROFILER_2 : {};
88
89
  let total = 0;
90
+ // eslint-disable-next-line guard-for-in
89
91
  for (let instanceId in component) {
90
92
  total += component[instanceId].count;
91
93
  }
@@ -1,7 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _class;
4
+ var _AnalyticsQueue;
5
5
  import memoizeOne from 'memoize-one';
6
6
  export var AnalyticsQueue = /*#__PURE__*/function () {
7
7
  function AnalyticsQueue() {
@@ -9,7 +9,7 @@ export var AnalyticsQueue = /*#__PURE__*/function () {
9
9
  _defineProperty(this, "tasks", []);
10
10
  _defineProperty(this, "running", false);
11
11
  }
12
- _createClass(AnalyticsQueue, [{
12
+ return _createClass(AnalyticsQueue, [{
13
13
  key: "request",
14
14
  value: function request(fn) {
15
15
  if (window.requestIdleCallback) {
@@ -65,9 +65,8 @@ export var AnalyticsQueue = /*#__PURE__*/function () {
65
65
  this.process();
66
66
  }
67
67
  }]);
68
- return AnalyticsQueue;
69
68
  }();
70
- _class = AnalyticsQueue;
69
+ _AnalyticsQueue = AnalyticsQueue;
71
70
  _defineProperty(AnalyticsQueue, "get", memoizeOne(function () {
72
- return new _class();
71
+ return new _AnalyticsQueue();
73
72
  }));
@@ -1,29 +1,28 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _get from "@babel/runtime/helpers/get";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
5
+ import _get from "@babel/runtime/helpers/get";
6
+ import _inherits from "@babel/runtime/helpers/inherits";
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
9
10
  import { EventEmitter } from 'events';
10
11
  export var AnnotationUpdateEmitter = /*#__PURE__*/function (_EventEmitter) {
11
- _inherits(AnnotationUpdateEmitter, _EventEmitter);
12
- var _super = _createSuper(AnnotationUpdateEmitter);
13
12
  function AnnotationUpdateEmitter() {
14
13
  _classCallCheck(this, AnnotationUpdateEmitter);
15
- return _super.apply(this, arguments);
14
+ return _callSuper(this, AnnotationUpdateEmitter, arguments);
16
15
  }
17
- _createClass(AnnotationUpdateEmitter, [{
16
+ _inherits(AnnotationUpdateEmitter, _EventEmitter);
17
+ return _createClass(AnnotationUpdateEmitter, [{
18
18
  key: "on",
19
19
  value: function on(event, listener) {
20
- return _get(_getPrototypeOf(AnnotationUpdateEmitter.prototype), "on", this).call(this, event, listener);
20
+ return _superPropGet(AnnotationUpdateEmitter, "on", this, 3)([event, listener]);
21
21
  }
22
22
  }, {
23
23
  key: "off",
24
24
  value: function off(event, listener) {
25
- return _get(_getPrototypeOf(AnnotationUpdateEmitter.prototype), "removeListener", this).call(this, event, listener);
25
+ return _superPropGet(AnnotationUpdateEmitter, "removeListener", this, 3)([event, listener]);
26
26
  }
27
27
  }]);
28
- return AnnotationUpdateEmitter;
29
28
  }(EventEmitter);
@@ -1,38 +1,35 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
9
  import React, { PureComponent } from 'react';
11
10
  import StatelessElementBrowser from './components/StatelessElementBrowser';
12
11
  var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
13
- _inherits(ElementBrowser, _PureComponent);
14
- var _super = _createSuper(ElementBrowser);
15
12
  function ElementBrowser() {
16
13
  var _this;
17
14
  _classCallCheck(this, ElementBrowser);
18
15
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
16
  args[_key] = arguments[_key];
20
17
  }
21
- _this = _super.call.apply(_super, [this].concat(args));
22
- _defineProperty(_assertThisInitialized(_this), "state", {
18
+ _this = _callSuper(this, ElementBrowser, [].concat(args));
19
+ _defineProperty(_this, "state", {
23
20
  categories: [],
24
21
  items: [],
25
22
  searchTerm: '',
26
23
  selectedCategory: _this.props.defaultCategory
27
24
  });
28
- _defineProperty(_assertThisInitialized(_this), "getCategories", function () {
25
+ _defineProperty(_this, "getCategories", function () {
29
26
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.fetchItems();
30
27
  return (
31
28
  // NOTE: we fetch all items to determine available categories.
32
29
  _this.filterCategories(items, _this.props.categories)
33
30
  );
34
31
  });
35
- _defineProperty(_assertThisInitialized(_this), "filterCategories", function (items) {
32
+ _defineProperty(_this, "filterCategories", function (items) {
36
33
  var categories = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
37
34
  var showCategories = _this.props.showCategories;
38
35
  if (!showCategories) {
@@ -44,17 +41,17 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
44
41
  });
45
42
  });
46
43
  });
47
- _defineProperty(_assertThisInitialized(_this), "fetchItems", function (query, category) {
44
+ _defineProperty(_this, "fetchItems", function (query, category) {
48
45
  return _this.props.getItems(query, category);
49
46
  });
50
- _defineProperty(_assertThisInitialized(_this), "handleSearch", function (searchTerm) {
47
+ _defineProperty(_this, "handleSearch", function (searchTerm) {
51
48
  var defaultCategory = _this.props.defaultCategory;
52
49
  _this.setState({
53
50
  searchTerm: searchTerm,
54
51
  selectedCategory: defaultCategory
55
52
  });
56
53
  });
57
- _defineProperty(_assertThisInitialized(_this), "handleCategorySelection", function (clickedCategory) {
54
+ _defineProperty(_this, "handleCategorySelection", function (clickedCategory) {
58
55
  var stateCategoryValue = _this.state.selectedCategory;
59
56
 
60
57
  /**
@@ -72,7 +69,8 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
72
69
  });
73
70
  return _this;
74
71
  }
75
- _createClass(ElementBrowser, [{
72
+ _inherits(ElementBrowser, _PureComponent);
73
+ return _createClass(ElementBrowser, [{
76
74
  key: "componentDidMount",
77
75
  value: function componentDidMount() {
78
76
  var items = this.fetchItems();
@@ -135,7 +133,6 @@ var ElementBrowser = /*#__PURE__*/function (_PureComponent) {
135
133
  });
136
134
  }
137
135
  }]);
138
- return ElementBrowser;
139
136
  }(PureComponent);
140
137
  _defineProperty(ElementBrowser, "defaultProps", {
141
138
  defaultCategory: 'all',
@@ -6,7 +6,7 @@ export var EventDispatcher = /*#__PURE__*/function () {
6
6
  _classCallCheck(this, EventDispatcher);
7
7
  _defineProperty(this, "listeners", {});
8
8
  }
9
- _createClass(EventDispatcher, [{
9
+ return _createClass(EventDispatcher, [{
10
10
  key: "on",
11
11
  value: function on(event, cb) {
12
12
  if (!this.listeners[event]) {
@@ -48,7 +48,6 @@ export var EventDispatcher = /*#__PURE__*/function () {
48
48
  this.listeners = {};
49
49
  }
50
50
  }]);
51
- return EventDispatcher;
52
51
  }();
53
52
  function getEventFromEventName(eventName) {
54
53
  return typeof eventName === 'string' ? eventName : eventName.key;
@@ -2,13 +2,12 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _inherits from "@babel/runtime/helpers/inherits";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
9
  var _excluded = ["url"];
11
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
10
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
12
  /**
14
13
  * @jsxRuntime classic
@@ -21,16 +20,14 @@ import { getExtensionLozengeData } from '../../../utils';
21
20
  import { styledImage } from '../styles';
22
21
  import { LozengeComponent } from './LozengeComponent';
23
22
  var ExtensionLozenge = /*#__PURE__*/function (_Component) {
24
- _inherits(ExtensionLozenge, _Component);
25
- var _super = _createSuper(ExtensionLozenge);
26
23
  function ExtensionLozenge() {
27
24
  var _this;
28
25
  _classCallCheck(this, ExtensionLozenge);
29
26
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
27
  args[_key] = arguments[_key];
31
28
  }
32
- _this = _super.call.apply(_super, [this].concat(args));
33
- _defineProperty(_assertThisInitialized(_this), "renderImage", function (lozengeData) {
29
+ _this = _callSuper(this, ExtensionLozenge, [].concat(args));
30
+ _defineProperty(_this, "renderImage", function (lozengeData) {
34
31
  var extensionKey = _this.props.node.attrs.extensionKey;
35
32
  var url = lozengeData.url,
36
33
  rest = _objectWithoutProperties(lozengeData, _excluded);
@@ -42,7 +39,7 @@ var ExtensionLozenge = /*#__PURE__*/function (_Component) {
42
39
  alt: extensionKey
43
40
  }));
44
41
  });
45
- _defineProperty(_assertThisInitialized(_this), "renderFallback", function (lozengeData) {
42
+ _defineProperty(_this, "renderFallback", function (lozengeData) {
46
43
  var _this$props = _this.props,
47
44
  showMacroInteractionDesignUpdates = _this$props.showMacroInteractionDesignUpdates,
48
45
  showMacroButtonUpdates = _this$props.showMacroButtonUpdates,
@@ -82,7 +79,8 @@ var ExtensionLozenge = /*#__PURE__*/function (_Component) {
82
79
  });
83
80
  return _this;
84
81
  }
85
- _createClass(ExtensionLozenge, [{
82
+ _inherits(ExtensionLozenge, _Component);
83
+ return _createClass(ExtensionLozenge, [{
86
84
  key: "render",
87
85
  value: function render() {
88
86
  var _this$props2 = this.props,
@@ -102,6 +100,5 @@ var ExtensionLozenge = /*#__PURE__*/function (_Component) {
102
100
  return this.renderFallback(iconData);
103
101
  }
104
102
  }]);
105
- return ExtensionLozenge;
106
103
  }(Component);
107
104
  export { ExtensionLozenge as default };
@@ -1,23 +1,20 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
4
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
9
  import React, { Component } from 'react';
11
10
  import { ProviderFactory, WithProviders } from '../provider-factory';
12
11
  import { ExtensionComponent } from './ExtensionComponent';
13
12
  export var Extension = /*#__PURE__*/function (_Component) {
14
- _inherits(Extension, _Component);
15
- var _super = _createSuper(Extension);
16
13
  function Extension(props) {
17
14
  var _this;
18
15
  _classCallCheck(this, Extension);
19
- _this = _super.call(this, props);
20
- _defineProperty(_assertThisInitialized(_this), "renderWithProvider", function (_ref) {
16
+ _this = _callSuper(this, Extension, [props]);
17
+ _defineProperty(_this, "renderWithProvider", function (_ref) {
21
18
  var extensionProvider = _ref.extensionProvider;
22
19
  var _this$props = _this.props,
23
20
  node = _this$props.node,
@@ -51,7 +48,8 @@ export var Extension = /*#__PURE__*/function (_Component) {
51
48
  _this.providerFactory = props.providerFactory || new ProviderFactory();
52
49
  return _this;
53
50
  }
54
- _createClass(Extension, [{
51
+ _inherits(Extension, _Component);
52
+ return _createClass(Extension, [{
55
53
  key: "componentWillUnmount",
56
54
  value: function componentWillUnmount() {
57
55
  if (!this.props.providerFactory) {
@@ -70,6 +68,5 @@ export var Extension = /*#__PURE__*/function (_Component) {
70
68
  });
71
69
  }
72
70
  }]);
73
- return Extension;
74
71
  }(Component);
75
72
  _defineProperty(Extension, "displayName", 'Extension');