@atlaskit/renderer 92.0.1 → 93.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 +27 -0
- package/dist/cjs/analytics/enums.js +1 -0
- package/dist/cjs/react/marks/alignment.js +11 -12
- package/dist/cjs/react/marks/breakout.js +7 -9
- package/dist/cjs/react/marks/link.js +13 -6
- package/dist/cjs/react/nodes/codeBlock.js +1 -1
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +13 -11
- package/dist/cjs/react/nodes/embedCard.js +25 -33
- package/dist/cjs/react/nodes/heading-anchor.js +7 -6
- package/dist/cjs/react/nodes/mediaSingle/index.js +15 -4
- package/dist/cjs/react/nodes/mediaSingle/styles.js +7 -10
- package/dist/cjs/react/nodes/panel.js +26 -16
- package/dist/cjs/react/nodes/table/sticky.js +51 -54
- package/dist/cjs/react/nodes/table.js +2 -10
- package/dist/cjs/react/utils/performance/RenderTracking.js +52 -0
- package/dist/cjs/ui/Expand.js +40 -20
- package/dist/cjs/ui/MediaCard.js +4 -14
- package/dist/cjs/ui/Renderer/index.js +37 -48
- package/dist/cjs/ui/Renderer/style.js +58 -63
- package/dist/cjs/ui/Renderer/truncated-wrapper.js +19 -21
- package/dist/cjs/ui/SortingIcon.js +8 -9
- package/dist/cjs/ui/renderer-props.js +1 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/enums.js +1 -0
- package/dist/es2019/react/marks/alignment.js +15 -7
- package/dist/es2019/react/marks/breakout.js +6 -5
- package/dist/es2019/react/marks/link.js +8 -5
- package/dist/es2019/react/nodes/codeBlock.js +1 -1
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +12 -9
- package/dist/es2019/react/nodes/embedCard.js +16 -16
- package/dist/es2019/react/nodes/heading-anchor.js +9 -6
- package/dist/es2019/react/nodes/mediaSingle/index.js +10 -6
- package/dist/es2019/react/nodes/mediaSingle/styles.js +6 -7
- package/dist/es2019/react/nodes/panel.js +23 -16
- package/dist/es2019/react/nodes/table/sticky.js +48 -41
- package/dist/es2019/react/nodes/table.js +2 -5
- package/dist/es2019/react/utils/performance/RenderTracking.js +37 -0
- package/dist/es2019/ui/Expand.js +52 -28
- package/dist/es2019/ui/MediaCard.js +3 -6
- package/dist/es2019/ui/Renderer/index.js +37 -42
- package/dist/es2019/ui/Renderer/style.js +363 -336
- package/dist/es2019/ui/Renderer/truncated-wrapper.js +26 -15
- package/dist/es2019/ui/SortingIcon.js +9 -7
- package/dist/es2019/ui/renderer-props.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/enums.js +1 -0
- package/dist/esm/react/marks/alignment.js +13 -6
- package/dist/esm/react/marks/breakout.js +6 -5
- package/dist/esm/react/marks/link.js +7 -5
- package/dist/esm/react/nodes/codeBlock.js +1 -1
- package/dist/esm/react/nodes/codeBlockCopyButton.js +10 -7
- package/dist/esm/react/nodes/embedCard.js +19 -19
- package/dist/esm/react/nodes/heading-anchor.js +8 -6
- package/dist/esm/react/nodes/mediaSingle/index.js +11 -6
- package/dist/esm/react/nodes/mediaSingle/styles.js +5 -7
- package/dist/esm/react/nodes/panel.js +27 -15
- package/dist/esm/react/nodes/table/sticky.js +53 -52
- package/dist/esm/react/nodes/table.js +2 -8
- package/dist/esm/react/utils/performance/RenderTracking.js +39 -0
- package/dist/esm/ui/Expand.js +45 -21
- package/dist/esm/ui/MediaCard.js +3 -9
- package/dist/esm/ui/Renderer/index.js +38 -46
- package/dist/esm/ui/Renderer/style.js +55 -56
- package/dist/esm/ui/Renderer/truncated-wrapper.js +20 -14
- package/dist/esm/ui/SortingIcon.js +9 -7
- package/dist/esm/ui/renderer-props.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/enums.d.ts +1 -0
- package/dist/types/analytics/events.d.ts +7 -2
- package/dist/types/react/marks/alignment.d.ts +2 -2
- package/dist/types/react/marks/breakout.d.ts +4 -3
- package/dist/types/react/marks/link.d.ts +2 -2
- package/dist/types/react/nodes/embedCard.d.ts +3 -2
- package/dist/types/react/nodes/heading-anchor.d.ts +1 -0
- package/dist/types/react/nodes/mediaSingle/index.d.ts +1 -0
- package/dist/types/react/nodes/mediaSingle/styles.d.ts +2 -3
- package/dist/types/react/nodes/panel.d.ts +3 -1
- package/dist/types/react/nodes/table/sticky.d.ts +4 -2
- package/dist/types/react/utils/performance/RenderTracking.d.ts +15 -0
- package/dist/types/ui/Expand.d.ts +2 -2
- package/dist/types/ui/MediaCard.d.ts +1 -3
- package/dist/types/ui/Renderer/index.d.ts +0 -25
- package/dist/types/ui/Renderer/style.d.ts +1 -4
- package/dist/types/ui/Renderer/truncated-wrapper.d.ts +3 -1
- package/dist/types/ui/SortingIcon.d.ts +3 -3
- package/dist/types/ui/renderer-props.d.ts +14 -2
- package/package.json +17 -19
|
@@ -4,8 +4,9 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
4
4
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3;
|
|
6
6
|
|
|
7
|
+
/** @jsx jsx */
|
|
7
8
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
9
10
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
10
11
|
import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
11
12
|
import * as colors from '@atlaskit/theme/colors';
|
|
@@ -14,70 +15,70 @@ import { findHorizontalOverflowScrollParent } from '../../../utils';
|
|
|
14
15
|
import { Table } from './table';
|
|
15
16
|
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
16
17
|
export var tableStickyPadding = 8;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
29
|
-
export var FixedTableDiv = styled.div.attrs({
|
|
30
|
-
style: function style(_ref2) {
|
|
31
|
-
var top = _ref2.top,
|
|
32
|
-
wrapperWidth = _ref2.wrapperWidth;
|
|
33
|
-
return {
|
|
34
|
-
top: top,
|
|
35
|
-
width: wrapperWidth
|
|
36
|
-
};
|
|
18
|
+
var fixedTableDivModeToPosition = {
|
|
19
|
+
stick: 'fixed',
|
|
20
|
+
'pin-bottom': 'absolute'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var getModeSpecificStyles = function getModeSpecificStyles(mode) {
|
|
24
|
+
if (mode === 'none') {
|
|
25
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n "])));
|
|
26
|
+
} else {
|
|
27
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: ", ";\n "])), fixedTableDivModeToPosition[mode]);
|
|
37
28
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var fixedTableDivStaticStyles = function fixedTableDivStaticStyles(top, width) {
|
|
32
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n top: ", "px;\n width: ", "px;\n z-index: ", ";\n &\n .", ",\n &\n .", "\n > table {\n margin-top: 0;\n margin-bottom: 0;\n }\n\n border-top: ", "px solid white;\n background: white;\n box-shadow: 0 6px 4px -4px ", ";\n\n div[data-expanded='false'] & {\n display: none;\n }\n\n &\n .", ".right-shadow::after,\n &\n .", ".left-shadow::before {\n top: 0px;\n height: 100%;\n }\n"])), top, width, akEditorStickyHeaderZIndex, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableStickyPadding, N40A, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_CONTAINER);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export var FixedTableDiv = function FixedTableDiv(props) {
|
|
36
|
+
var top = props.top,
|
|
37
|
+
wrapperWidth = props.wrapperWidth,
|
|
38
|
+
mode = props.mode;
|
|
39
|
+
var fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth), getModeSpecificStyles(mode)];
|
|
40
|
+
return jsx("div", {
|
|
41
|
+
css: fixedTableCss
|
|
42
|
+
}, props.children);
|
|
43
|
+
};
|
|
44
|
+
export var StickyTable = function StickyTable(_ref) {
|
|
45
|
+
var top = _ref.top,
|
|
46
|
+
left = _ref.left,
|
|
47
|
+
mode = _ref.mode,
|
|
48
|
+
shadowClassNames = _ref.shadowClassNames,
|
|
49
|
+
innerRef = _ref.innerRef,
|
|
50
|
+
wrapperWidth = _ref.wrapperWidth,
|
|
51
|
+
tableWidth = _ref.tableWidth,
|
|
52
|
+
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
53
|
+
layout = _ref.layout,
|
|
54
|
+
children = _ref.children,
|
|
55
|
+
columnWidths = _ref.columnWidths,
|
|
56
|
+
renderWidth = _ref.renderWidth,
|
|
57
|
+
allowDynamicTextSizing = _ref.allowDynamicTextSizing,
|
|
58
|
+
rowHeight = _ref.rowHeight;
|
|
59
|
+
return jsx("div", {
|
|
60
|
+
css: {
|
|
61
|
+
left: left && left < 0 ? left : undefined,
|
|
62
|
+
top: mode === 'pin-bottom' ? top : undefined,
|
|
63
|
+
position: 'relative'
|
|
64
|
+
}
|
|
65
|
+
}, jsx(FixedTableDiv, {
|
|
65
66
|
top: mode === 'stick' ? top : undefined,
|
|
66
67
|
mode: rowHeight > 300 ? 'none' : mode,
|
|
67
68
|
wrapperWidth: wrapperWidth
|
|
68
|
-
},
|
|
69
|
+
}, jsx("div", {
|
|
69
70
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(shadowClassNames),
|
|
70
71
|
"data-layout": layout,
|
|
71
72
|
style: {
|
|
72
73
|
width: tableWidth
|
|
73
74
|
}
|
|
74
|
-
},
|
|
75
|
-
|
|
75
|
+
}, jsx("div", {
|
|
76
|
+
ref: innerRef,
|
|
76
77
|
className: "".concat(TableSharedCssClassName.TABLE_STICKY_WRAPPER),
|
|
77
78
|
style: {
|
|
78
79
|
overflow: 'hidden'
|
|
79
80
|
}
|
|
80
|
-
},
|
|
81
|
+
}, jsx(Table, {
|
|
81
82
|
columnWidths: columnWidths,
|
|
82
83
|
layout: layout,
|
|
83
84
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
@@ -6,16 +6,12 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
10
|
-
|
|
11
|
-
var _templateObject;
|
|
12
9
|
|
|
13
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
11
|
|
|
15
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
13
|
|
|
17
14
|
import React from 'react';
|
|
18
|
-
import styled from 'styled-components';
|
|
19
15
|
import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
20
16
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
21
17
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
@@ -124,8 +120,6 @@ var tableCanBeSticky = function tableCanBeSticky(node, children) {
|
|
|
124
120
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
125
121
|
};
|
|
126
122
|
|
|
127
|
-
var MainTableContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|
|
128
|
-
|
|
129
123
|
var canUseLinelength = function canUseLinelength(appearance) {
|
|
130
124
|
return appearance === 'full-page' || appearance === 'mobile';
|
|
131
125
|
};
|
|
@@ -330,10 +324,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
330
324
|
columnWidths: columnWidths,
|
|
331
325
|
rowHeight: this.headerRowHeight,
|
|
332
326
|
allowDynamicTextSizing: allowDynamicTextSizing
|
|
333
|
-
}, [children && children[0]]), /*#__PURE__*/React.createElement(
|
|
327
|
+
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
334
328
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames),
|
|
335
329
|
"data-layout": layout,
|
|
336
|
-
|
|
330
|
+
ref: this.props.handleRef,
|
|
337
331
|
style: {
|
|
338
332
|
width: tableWidth,
|
|
339
333
|
left: left && left < 0 ? left : undefined
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import debounce from 'lodash/debounce';
|
|
3
|
+
import { useComponentRenderTracking } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import { EVENT_TYPE } from '../../../analytics/enums';
|
|
5
|
+
export function RenderTracking(props) {
|
|
6
|
+
var debouncedHandleAnalyticsEvent = useMemo(function () {
|
|
7
|
+
return debounce(props.handleAnalyticsEvent, 500);
|
|
8
|
+
}, [props.handleAnalyticsEvent]);
|
|
9
|
+
useComponentRenderTracking({
|
|
10
|
+
onRender: function onRender(_ref) {
|
|
11
|
+
var renderCount = _ref.renderCount,
|
|
12
|
+
propsDifference = _ref.propsDifference,
|
|
13
|
+
componentId = _ref.componentId;
|
|
14
|
+
|
|
15
|
+
if (!renderCount) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
debouncedHandleAnalyticsEvent({
|
|
20
|
+
action: props.action,
|
|
21
|
+
actionSubject: props.actionSubject,
|
|
22
|
+
attributes: {
|
|
23
|
+
count: renderCount,
|
|
24
|
+
propsDifference: propsDifference,
|
|
25
|
+
componentId: componentId
|
|
26
|
+
},
|
|
27
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
propsDiffingOptions: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
props: props.componentProps,
|
|
33
|
+
propsToIgnore: props.propsToIgnore,
|
|
34
|
+
useShallow: props.useShallow
|
|
35
|
+
},
|
|
36
|
+
zeroBasedCount: true
|
|
37
|
+
});
|
|
38
|
+
return null;
|
|
39
|
+
}
|
package/dist/esm/ui/Expand.js
CHANGED
|
@@ -5,36 +5,59 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
6
6
|
|
|
7
7
|
/** @jsx jsx */
|
|
8
|
-
import React, {
|
|
9
|
-
import { jsx } from '@emotion/react';
|
|
10
|
-
import styled from 'styled-components';
|
|
8
|
+
import React, { useRef, useCallback } from 'react';
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
11
10
|
import { gridSize, fontSize } from '@atlaskit/theme/constants';
|
|
12
11
|
import ChevronRightIcon from '@atlaskit/icon/glyph/chevron-right';
|
|
13
12
|
import Tooltip from '@atlaskit/tooltip';
|
|
14
|
-
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper,
|
|
13
|
+
import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, clearNextSiblingMarginTopStyle, ExpandLayoutWrapperWithRef } from '@atlaskit/editor-common/ui';
|
|
15
14
|
import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
16
15
|
import { PLATFORM, MODE } from '../analytics/events';
|
|
17
16
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
|
|
18
17
|
import { injectIntl } from 'react-intl-next';
|
|
19
18
|
import { ActiveHeaderIdConsumer } from './active-header-id-provider';
|
|
20
19
|
import _uniqueId from 'lodash/uniqueId';
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
var titleStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n display: flex;\n flex: 1;\n margin: 0;\n padding: 0 0 0 ", "px;\n text-align: left;\n"])), relativeFontSizeToBase16(fontSize()), akEditorLineHeight, gridSize() / 2);
|
|
21
|
+
|
|
22
|
+
var Container = function Container(props) {
|
|
23
|
+
var paddingBottom = "".concat(props.expanded ? gridSize() : 0, "px");
|
|
24
|
+
var sharedContainerStyles = sharedExpandStyles.containerStyles(props);
|
|
25
|
+
|
|
26
|
+
var styles = function styles(themeProps) {
|
|
27
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n padding: 0;\n padding-bottom: ", ";\n "])), sharedContainerStyles(themeProps), paddingBottom);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return jsx("div", _extends({
|
|
31
|
+
css: styles
|
|
32
|
+
}, props), props.children);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var TitleContainer = function TitleContainer(props) {
|
|
36
|
+
var paddingBottom = "".concat(!props.expanded ? gridSize() : 0, "px");
|
|
37
|
+
|
|
38
|
+
var styles = function styles(themeProps) {
|
|
39
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n padding: ", "px;\n padding-bottom: ", ";\n "])), sharedExpandStyles.titleContainerStyles(themeProps), gridSize(), paddingBottom);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return jsx("button", _extends({
|
|
43
|
+
css: styles
|
|
44
|
+
}, props), props.children);
|
|
45
|
+
};
|
|
46
|
+
|
|
28
47
|
TitleContainer.displayName = 'TitleContainerButton';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
48
|
+
|
|
49
|
+
var ContentContainer = function ContentContainer(props) {
|
|
50
|
+
var sharedContentStyles = sharedExpandStyles.contentStyles(props);
|
|
51
|
+
var visibility = props.expanded ? 'visible' : 'hidden';
|
|
52
|
+
|
|
53
|
+
var styles = function styles(themeProps) {
|
|
54
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n padding-right: ", "px;\n padding-left: ", "px;\n visibility: ", ";\n "])), sharedContentStyles(themeProps), gridSize() * 2, gridSize() * 5 - gridSize() / 2, visibility);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return jsx("div", _extends({
|
|
58
|
+
css: styles
|
|
59
|
+
}, props), props.children);
|
|
60
|
+
};
|
|
38
61
|
|
|
39
62
|
function fireExpandToggleAnalytics(nodeType, expanded, fireAnalyticsEvent) {
|
|
40
63
|
if (!fireAnalyticsEvent) {
|
|
@@ -116,7 +139,8 @@ function Expand(_ref) {
|
|
|
116
139
|
expanded: expanded
|
|
117
140
|
}, jsx(ChevronRightIcon, {
|
|
118
141
|
label: label
|
|
119
|
-
}))), jsx(
|
|
142
|
+
}))), jsx("span", {
|
|
143
|
+
css: titleStyles,
|
|
120
144
|
id: id
|
|
121
145
|
}, title || intl.formatMessage(expandMessages.expandDefaultTitle))), jsx(ContentContainer, {
|
|
122
146
|
expanded: expanded
|
package/dist/esm/ui/MediaCard.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
@@ -9,8 +8,6 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
9
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
10
|
|
|
12
|
-
var _templateObject;
|
|
13
|
-
|
|
14
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; }
|
|
15
12
|
|
|
16
13
|
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; }
|
|
@@ -19,13 +16,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
19
16
|
|
|
20
17
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
18
|
|
|
22
|
-
import React from 'react';
|
|
23
|
-
import { Component } from 'react';
|
|
19
|
+
import React, { Component } from 'react';
|
|
24
20
|
import { filter } from '@atlaskit/adf-utils';
|
|
25
21
|
import { Card, CardLoading, CardError } from '@atlaskit/media-card';
|
|
26
22
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
27
23
|
import { withImageLoader } from '@atlaskit/editor-common/utils';
|
|
28
|
-
import styled from 'styled-components';
|
|
29
24
|
var mediaIdentifierMap = new Map();
|
|
30
25
|
export var getListOfIdentifiersFromDoc = function getListOfIdentifiersFromDoc(doc) {
|
|
31
26
|
if (!doc) {
|
|
@@ -355,7 +350,7 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
355
350
|
collectionName: collection,
|
|
356
351
|
occurrenceKey: occurrenceKey
|
|
357
352
|
};
|
|
358
|
-
return /*#__PURE__*/React.createElement(
|
|
353
|
+
return /*#__PURE__*/React.createElement("div", getClipboardAttrs({
|
|
359
354
|
id: id,
|
|
360
355
|
alt: alt,
|
|
361
356
|
collection: collection,
|
|
@@ -386,8 +381,7 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
386
381
|
}]);
|
|
387
382
|
|
|
388
383
|
return MediaCardInternal;
|
|
389
|
-
}(Component);
|
|
390
|
-
export var CardWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""]))); // Needed for copy & paste
|
|
384
|
+
}(Component); // Needed for copy & paste
|
|
391
385
|
|
|
392
386
|
export var getClipboardAttrs = function getClipboardAttrs(_ref2) {
|
|
393
387
|
var id = _ref2.id,
|
|
@@ -16,22 +16,21 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
16
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
17
|
|
|
18
18
|
/** @jsx jsx */
|
|
19
|
-
import React, { useContext, useLayoutEffect, useRef } from 'react';
|
|
19
|
+
import React, { Fragment, useContext, useLayoutEffect, useRef } from 'react';
|
|
20
20
|
import { jsx } from '@emotion/react';
|
|
21
21
|
import { PureComponent } from 'react';
|
|
22
22
|
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema';
|
|
23
23
|
import { reduce } from '@atlaskit/adf-utils';
|
|
24
24
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
25
|
-
import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent,
|
|
25
|
+
import { UnsupportedBlock, BaseTheme, WidthProvider, WithCreateAnalyticsEvent, IntlErrorBoundary } from '@atlaskit/editor-common/ui';
|
|
26
26
|
import { getAnalyticsAppearance, getAnalyticsEventSeverity, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, measureTTI } from '@atlaskit/editor-common/utils';
|
|
27
27
|
import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
28
28
|
import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
|
|
29
|
-
import { IframeWidthObserverFallbackWrapper, IframeWrapperConsumer } from '@atlaskit/width-detector';
|
|
30
29
|
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
31
30
|
import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
|
|
32
31
|
import uuid from 'uuid/v4';
|
|
33
32
|
import { ReactSerializer, renderDocument } from '../../';
|
|
34
|
-
import {
|
|
33
|
+
import { rendererStyles } from './style';
|
|
35
34
|
import { TruncatedWrapper } from './truncated-wrapper';
|
|
36
35
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../../analytics/enums';
|
|
37
36
|
import { PLATFORM, MODE } from '../../analytics/events';
|
|
@@ -49,6 +48,7 @@ import { isInteractiveElement } from './click-to-edit';
|
|
|
49
48
|
import { RendererContextProvider } from '../../renderer-context';
|
|
50
49
|
import memoizeOne from 'memoize-one';
|
|
51
50
|
import { ErrorBoundary } from './ErrorBoundary';
|
|
51
|
+
import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
52
52
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
53
53
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
54
54
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -64,8 +64,11 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
64
64
|
_this = _super.call(this, props);
|
|
65
65
|
|
|
66
66
|
_defineProperty(_assertThisInitialized(_this), "featureFlags", memoizeOne(function (featureFlags) {
|
|
67
|
+
var normalizedFeatureFlags = normalizeFeatureFlags(featureFlags, {
|
|
68
|
+
objectFlagKeys: ['rendererRenderTracking']
|
|
69
|
+
});
|
|
67
70
|
return {
|
|
68
|
-
featureFlags:
|
|
71
|
+
featureFlags: normalizedFeatureFlags
|
|
69
72
|
};
|
|
70
73
|
}));
|
|
71
74
|
|
|
@@ -304,6 +307,8 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
304
307
|
};
|
|
305
308
|
|
|
306
309
|
try {
|
|
310
|
+
var _this$featureFlags, _this$featureFlags$fe, _this$featureFlags$fe2;
|
|
311
|
+
|
|
307
312
|
var schema = this.getSchema();
|
|
308
313
|
|
|
309
314
|
var _renderDocument = renderDocument(document, this.serializer, schema, adfStage, this.props.useSpecBasedValidator, this.id, this.fireAnalyticsEvent, this.props.unsupportedContentLevelsTracking, this.props.appearance),
|
|
@@ -319,7 +324,7 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
319
324
|
value: this.featureFlags(this.props.featureFlags)
|
|
320
325
|
}, jsx(CopyTextProvider, null, jsx(ActiveHeaderIdProvider, {
|
|
321
326
|
value: getActiveHeadingId(allowHeadingAnchorLinks)
|
|
322
|
-
}, jsx(
|
|
327
|
+
}, jsx(AnalyticsContext.Provider, {
|
|
323
328
|
value: {
|
|
324
329
|
fireAnalyticsEvent: function fireAnalyticsEvent(event) {
|
|
325
330
|
return _this3.fireAnalyticsEvent(event);
|
|
@@ -342,11 +347,20 @@ export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
342
347
|
doc: pmDoc,
|
|
343
348
|
schema: schema,
|
|
344
349
|
onAnalyticsEvent: this.fireAnalyticsEvent
|
|
345
|
-
}, result)))))))
|
|
346
|
-
|
|
350
|
+
}, result)))))));
|
|
351
|
+
var rendererResult = truncated ? jsx(TruncatedWrapper, {
|
|
347
352
|
height: maxHeight,
|
|
348
353
|
fadeHeight: fadeOutHeight
|
|
349
354
|
}, rendererOutput) : rendererOutput;
|
|
355
|
+
var rendererRenderTracking = (_this$featureFlags = this.featureFlags(this.props.featureFlags)) === null || _this$featureFlags === void 0 ? void 0 : (_this$featureFlags$fe = _this$featureFlags.featureFlags) === null || _this$featureFlags$fe === void 0 ? void 0 : (_this$featureFlags$fe2 = _this$featureFlags$fe.rendererRenderTracking) === null || _this$featureFlags$fe2 === void 0 ? void 0 : _this$featureFlags$fe2[ACTION_SUBJECT.RENDERER];
|
|
356
|
+
var reRenderTracking = (rendererRenderTracking === null || rendererRenderTracking === void 0 ? void 0 : rendererRenderTracking.enabled) && jsx(RenderTracking, {
|
|
357
|
+
componentProps: this.props,
|
|
358
|
+
action: ACTION.RE_RENDERED,
|
|
359
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
360
|
+
handleAnalyticsEvent: this.fireAnalyticsEvent,
|
|
361
|
+
useShallow: rendererRenderTracking.useShallow
|
|
362
|
+
});
|
|
363
|
+
return jsx(Fragment, null, reRenderTracking, rendererResult);
|
|
350
364
|
} catch (e) {
|
|
351
365
|
if (onError) {
|
|
352
366
|
onError(e);
|
|
@@ -393,71 +407,49 @@ var RendererWithAnalytics = /*#__PURE__*/React.memo(function (props) {
|
|
|
393
407
|
}
|
|
394
408
|
}, jsx(WithCreateAnalyticsEvent, {
|
|
395
409
|
render: function render(createAnalyticsEvent) {
|
|
396
|
-
// `
|
|
410
|
+
// `IntlErrorBoundary` only captures Internationalisation errors, leaving others for `ErrorBoundary`.
|
|
397
411
|
return jsx(ErrorBoundary, {
|
|
398
412
|
component: ACTION_SUBJECT.RENDERER,
|
|
399
413
|
rethrowError: true,
|
|
400
414
|
fallbackComponent: null,
|
|
401
415
|
createAnalyticsEvent: createAnalyticsEvent
|
|
402
|
-
}, jsx(
|
|
416
|
+
}, jsx(IntlErrorBoundary, null, jsx(Renderer, _extends({}, props, {
|
|
403
417
|
createAnalyticsEvent: createAnalyticsEvent
|
|
404
418
|
}))));
|
|
405
419
|
}
|
|
406
420
|
}));
|
|
407
421
|
});
|
|
408
|
-
var
|
|
422
|
+
var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
409
423
|
var allowColumnSorting = props.allowColumnSorting,
|
|
410
424
|
dynamicTextSizing = props.dynamicTextSizing,
|
|
411
425
|
allowNestedHeaderLinks = props.allowNestedHeaderLinks,
|
|
412
426
|
innerRef = props.innerRef,
|
|
413
427
|
appearance = props.appearance,
|
|
414
428
|
children = props.children,
|
|
415
|
-
subscribe = props.subscribe,
|
|
416
429
|
onClick = props.onClick,
|
|
417
430
|
onMouseDown = props.onMouseDown;
|
|
418
|
-
|
|
431
|
+
return jsx(WidthProvider, {
|
|
419
432
|
className: "ak-renderer-wrapper"
|
|
420
433
|
}, jsx(BaseTheme, {
|
|
421
434
|
dynamicTextSizing: dynamicTextSizing,
|
|
422
435
|
baseFontSize: !dynamicTextSizing && appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
|
|
423
|
-
}, jsx(
|
|
424
|
-
|
|
425
|
-
appearance: appearance,
|
|
426
|
-
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
427
|
-
allowColumnSorting: !!allowColumnSorting,
|
|
436
|
+
}, jsx("div", {
|
|
437
|
+
ref: innerRef,
|
|
428
438
|
onClick: onClick,
|
|
429
439
|
onMouseDown: onMouseDown,
|
|
430
|
-
css: rendererStyles
|
|
440
|
+
css: rendererStyles({
|
|
441
|
+
appearance: appearance,
|
|
442
|
+
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
443
|
+
allowColumnSorting: !!allowColumnSorting
|
|
444
|
+
})
|
|
431
445
|
}, children)));
|
|
432
|
-
|
|
433
|
-
if (!subscribe) {
|
|
434
|
-
return jsx(IframeWidthObserverFallbackWrapper, null, renderer);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
return renderer;
|
|
438
446
|
});
|
|
439
|
-
/**
|
|
440
|
-
* When the product doesn't provide a IframeWidthObserverFallbackWrapper,
|
|
441
|
-
* we will give one to the renderer,
|
|
442
|
-
*
|
|
443
|
-
* so if we have more than one `WidthProvider` on the content,
|
|
444
|
-
* only one iframe will be created on the older browsers.
|
|
445
|
-
*/
|
|
446
|
-
|
|
447
|
-
export function RendererWrapper(props) {
|
|
448
|
-
return jsx(IframeWrapperConsumer, null, function (_ref) {
|
|
449
|
-
var subscribe = _ref.subscribe;
|
|
450
|
-
return jsx(RendererWithIframeFallbackWrapper, _extends({}, props, {
|
|
451
|
-
subscribe: subscribe
|
|
452
|
-
}));
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
447
|
|
|
456
|
-
function RendererActionsInternalUpdater(
|
|
457
|
-
var children =
|
|
458
|
-
doc =
|
|
459
|
-
schema =
|
|
460
|
-
onAnalyticsEvent =
|
|
448
|
+
function RendererActionsInternalUpdater(_ref) {
|
|
449
|
+
var children = _ref.children,
|
|
450
|
+
doc = _ref.doc,
|
|
451
|
+
schema = _ref.schema,
|
|
452
|
+
onAnalyticsEvent = _ref.onAnalyticsEvent;
|
|
461
453
|
var actions = useContext(ActionsContext);
|
|
462
454
|
var rendererRef = useRef(null);
|
|
463
455
|
useLayoutEffect(function () {
|