@atlaskit/editor-common 65.0.0 → 66.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 +22 -0
- package/dist/cjs/normalize-feature-flags.js +40 -4
- package/dist/cjs/styles/shared/link.js +2 -2
- package/dist/cjs/styles/shared/lists.js +1 -1
- package/dist/cjs/styles/shared/panel.js +7 -4
- package/dist/cjs/styles/shared/rule.js +5 -2
- package/dist/cjs/styles/shared/table.js +1 -1
- package/dist/cjs/ui/Expand/index.js +84 -46
- package/dist/cjs/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +9 -9
- package/dist/cjs/ui/MediaSingle/index.js +13 -8
- package/dist/cjs/ui/MediaSingle/styled.js +23 -20
- package/dist/cjs/ui/Popup/index.js +15 -1
- package/dist/cjs/ui/UnsupportedBlock/index.js +1 -1
- package/dist/cjs/ui/index.js +12 -22
- package/dist/cjs/utils/compare-props.js +136 -0
- package/dist/cjs/utils/index.js +23 -1
- package/dist/cjs/utils/performance/hooks/use-component-render-tracking/index.js +47 -0
- package/dist/cjs/utils/validator.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/normalize-feature-flags.js +40 -4
- package/dist/es2019/styles/shared/link.js +1 -1
- package/dist/es2019/styles/shared/lists.js +2 -0
- package/dist/es2019/styles/shared/panel.js +15 -15
- package/dist/es2019/styles/shared/rule.js +3 -3
- package/dist/es2019/styles/shared/table.js +9 -1
- package/dist/es2019/ui/Expand/index.js +97 -67
- package/dist/es2019/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +13 -9
- package/dist/es2019/ui/MediaSingle/styled.js +13 -12
- package/dist/es2019/ui/Popup/index.js +16 -1
- package/dist/es2019/ui/UnsupportedBlock/index.js +0 -1
- package/dist/es2019/ui/index.js +2 -4
- package/dist/es2019/utils/compare-props.js +99 -0
- package/dist/es2019/utils/index.js +3 -1
- package/dist/es2019/utils/performance/hooks/use-component-render-tracking/index.js +36 -0
- package/dist/es2019/utils/validator.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/normalize-feature-flags.js +39 -4
- package/dist/esm/styles/shared/link.js +1 -1
- package/dist/esm/styles/shared/lists.js +1 -1
- package/dist/esm/styles/shared/panel.js +6 -4
- package/dist/esm/styles/shared/rule.js +4 -2
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/ui/Expand/index.js +79 -42
- package/dist/esm/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.js +7 -7
- package/dist/esm/ui/MediaSingle/index.js +14 -9
- package/dist/esm/ui/MediaSingle/styled.js +17 -10
- package/dist/esm/ui/Popup/index.js +16 -1
- package/dist/esm/ui/UnsupportedBlock/index.js +1 -1
- package/dist/esm/ui/index.js +2 -4
- package/dist/esm/utils/compare-props.js +115 -0
- package/dist/esm/utils/index.js +3 -1
- package/dist/esm/utils/performance/hooks/use-component-render-tracking/index.js +37 -0
- package/dist/esm/utils/validator.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/extensions/types/field-definitions.d.ts +1 -1
- package/dist/types/normalize-feature-flags.d.ts +6 -3
- package/dist/types/styles/shared/link.d.ts +1 -1
- package/dist/types/styles/shared/panel.d.ts +1 -1
- package/dist/types/styles/shared/rule.d.ts +2 -1
- package/dist/types/ui/Expand/index.d.ts +12 -10
- package/dist/types/ui/{IntlNextErrorBoundary → IntlErrorBoundary}/index.d.ts +1 -1
- package/dist/types/ui/MediaSingle/index.d.ts +4 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +10 -5
- package/dist/types/ui/Popup/index.d.ts +3 -0
- package/dist/types/ui/index.d.ts +2 -4
- package/dist/types/utils/compare-props.d.ts +32 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/performance/hooks/use-component-render-tracking/index.d.ts +19 -0
- package/package.json +13 -14
- package/dist/cjs/ui/IntlLegacyFallbackProvider/index.js +0 -60
- package/dist/cjs/ui/LegacyToNextIntlProvider/index.js +0 -67
- package/dist/es2019/ui/IntlLegacyFallbackProvider/index.js +0 -21
- package/dist/es2019/ui/LegacyToNextIntlProvider/index.js +0 -24
- package/dist/esm/ui/IntlLegacyFallbackProvider/index.js +0 -45
- package/dist/esm/ui/LegacyToNextIntlProvider/index.js +0 -51
- package/dist/types/ui/IntlLegacyFallbackProvider/index.d.ts +0 -8
- package/dist/types/ui/LegacyToNextIntlProvider/index.d.ts +0 -8
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
1
6
|
import { defineMessages } from 'react-intl-next';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
7
|
import { akEditorLineHeight, akEditorSwoopCubicBezier, akLayoutGutterOffset, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
4
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
5
9
|
import { themed } from '@atlaskit/theme/components';
|
|
@@ -38,13 +42,22 @@ const EXPAND_EXPANDED_BORDER_COLOR = themed({
|
|
|
38
42
|
light: colors.N40A,
|
|
39
43
|
dark: colors.DN50
|
|
40
44
|
});
|
|
41
|
-
export const ExpandIconWrapper =
|
|
45
|
+
export const ExpandIconWrapper = ({
|
|
46
|
+
children,
|
|
47
|
+
expanded
|
|
48
|
+
}) => {
|
|
49
|
+
return jsx("div", {
|
|
50
|
+
css: props => expanded ? [expandIconWrapperStyle(props), expandIconWrapperExpandedStyle] : expandIconWrapperStyle(props)
|
|
51
|
+
}, children);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const expandIconWrapperStyle = props => css`
|
|
42
55
|
cursor: pointer;
|
|
43
56
|
display: flex;
|
|
44
57
|
color: ${themed({
|
|
45
58
|
light: colors.N90,
|
|
46
59
|
dark: '#d9dde3'
|
|
47
|
-
})};
|
|
60
|
+
})(props)};
|
|
48
61
|
border-radius: ${gridSize() / 2}px;
|
|
49
62
|
width: 24px;
|
|
50
63
|
height: 24px;
|
|
@@ -54,69 +67,85 @@ export const ExpandIconWrapper = styled.div`
|
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
svg {
|
|
57
|
-
${props => props.expanded ? 'transform: rotate(90deg);' : ''}
|
|
58
70
|
transition: transform 0.2s ${akEditorSwoopCubicBezier};
|
|
59
71
|
}
|
|
60
72
|
`;
|
|
61
|
-
|
|
73
|
+
|
|
74
|
+
const expandIconWrapperExpandedStyle = css`
|
|
75
|
+
svg {
|
|
76
|
+
transform: rotate(90deg);
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
export const expandLayoutWrapperStyle = css`
|
|
62
80
|
width: ${gridSize() * 3}px;
|
|
63
81
|
height: ${gridSize() * 3}px;
|
|
64
82
|
`;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
min-height: 25px;
|
|
77
|
-
background: ${({
|
|
78
|
-
expanded
|
|
79
|
-
}) => !expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND};
|
|
80
|
-
margin: ${props => `${gridSize() / 2 / fontSize()}rem ${// Only only these margins if the expand isn't editable
|
|
81
|
-
// and is the root level expand.
|
|
82
|
-
props['data-node-type'] === 'expand' ? `-${akLayoutGutterOffset}px` : `0`} 0`};
|
|
83
|
+
export const ExpandLayoutWrapperWithRef = /*#__PURE__*/forwardRef((props, ref) => {
|
|
84
|
+
const {
|
|
85
|
+
children,
|
|
86
|
+
...rest
|
|
87
|
+
} = props;
|
|
88
|
+
return jsx("div", _extends({
|
|
89
|
+
css: expandLayoutWrapperStyle
|
|
90
|
+
}, rest, {
|
|
91
|
+
ref: ref
|
|
92
|
+
}), children);
|
|
93
|
+
});
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
const containerStyles = styleProps => {
|
|
96
|
+
const {
|
|
97
|
+
expanded,
|
|
98
|
+
focused
|
|
99
|
+
} = styleProps;
|
|
100
|
+
const marginTop = `${gridSize() / 2 / fontSize()}rem`;
|
|
101
|
+
const marginBottom = 0; // Only only these margins if the expand isn't editable
|
|
102
|
+
// and is the root level expand.
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
const marginHorizontal = styleProps['data-node-type'] === 'expand' ? `-${akLayoutGutterOffset}px` : 0;
|
|
105
|
+
const margin = `${marginTop} ${marginHorizontal} ${marginBottom}`;
|
|
106
|
+
return themeProps => css`
|
|
107
|
+
border-width: 1px;
|
|
108
|
+
border-style: solid;
|
|
109
|
+
border-color: ${focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR(themeProps) : EXPAND_COLLAPSED_BORDER_COLOR};
|
|
110
|
+
border-radius: ${BORDER_RADIUS}px;
|
|
111
|
+
min-height: 25px;
|
|
112
|
+
background: ${!expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND(themeProps)};
|
|
113
|
+
margin: ${margin};
|
|
114
|
+
|
|
115
|
+
transition: background 0.3s ${akEditorSwoopCubicBezier},
|
|
116
|
+
border-color 0.3s ${akEditorSwoopCubicBezier};
|
|
117
|
+
padding: ${gridSize()}px;
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
border: 1px solid
|
|
121
|
+
${themed({
|
|
122
|
+
light: colors.N50A,
|
|
123
|
+
dark: colors.DN50
|
|
124
|
+
})(themeProps)};
|
|
125
|
+
background: ${EXPAND_SELECTED_BACKGROUND(themeProps)};
|
|
126
|
+
}
|
|
95
127
|
|
|
96
|
-
|
|
97
|
-
|
|
128
|
+
td > &:first-child {
|
|
129
|
+
margin-top: 0;
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const contentStyles = styleProps => themeProps => css`
|
|
135
|
+
padding-top: ${styleProps.expanded ? gridSize() : 0}px;
|
|
136
|
+
padding-right: ${gridSize()}px;
|
|
137
|
+
padding-left: ${gridSize() * 4 - gridSize() / 2}px;
|
|
138
|
+
display: flow-root;
|
|
139
|
+
|
|
140
|
+
// The follow rules inside @supports block are added as a part of ED-8893
|
|
141
|
+
// The fix is targeting mobile bridge on iOS 12 or below,
|
|
142
|
+
// We should consider remove this fix when we no longer support iOS 12
|
|
143
|
+
@supports not (display: flow-root) {
|
|
144
|
+
width: 100%;
|
|
145
|
+
box-sizing: border-box;
|
|
98
146
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
${({
|
|
102
|
-
expanded
|
|
103
|
-
}) => {
|
|
104
|
-
return css`
|
|
105
|
-
padding-top: ${expanded ? gridSize() : 0}px;
|
|
106
|
-
padding-right: ${gridSize()}px;
|
|
107
|
-
padding-left: ${gridSize() * 4 - gridSize() / 2}px;
|
|
108
|
-
display: table;
|
|
109
|
-
display: flow-root;
|
|
110
|
-
|
|
111
|
-
// The follow rules inside @supports block are added as a part of ED-8893
|
|
112
|
-
// The fix is targeting mobile bridge on iOS 12 or below,
|
|
113
|
-
// We should consider remove this fix when we no longer support iOS 12
|
|
114
|
-
@supports not (display: flow-root) {
|
|
115
|
-
width: 100%;
|
|
116
|
-
box-sizing: border-box;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
${!expanded ? `
|
|
147
|
+
|
|
148
|
+
${!styleProps.expanded ? `
|
|
120
149
|
.expand-content-wrapper, .nestedExpand-content-wrapper {
|
|
121
150
|
/* We visually hide the content here to preserve the content during copy+paste */
|
|
122
151
|
width: 100%;
|
|
@@ -128,10 +157,9 @@ const ContentStyles = css`
|
|
|
128
157
|
user-select: none;
|
|
129
158
|
}
|
|
130
159
|
` : ''}
|
|
131
|
-
`;
|
|
132
|
-
}};
|
|
133
160
|
`;
|
|
134
|
-
|
|
161
|
+
|
|
162
|
+
const titleInputStyles = props => css`
|
|
135
163
|
outline: none;
|
|
136
164
|
border: none;
|
|
137
165
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
@@ -140,7 +168,7 @@ const TitleInputStyles = css`
|
|
|
140
168
|
color: ${themed({
|
|
141
169
|
light: colors.N200A,
|
|
142
170
|
dark: colors.DN600
|
|
143
|
-
})};
|
|
171
|
+
})(props)};
|
|
144
172
|
background: transparent;
|
|
145
173
|
display: flex;
|
|
146
174
|
flex: 1;
|
|
@@ -152,10 +180,11 @@ const TitleInputStyles = css`
|
|
|
152
180
|
color: ${themed({
|
|
153
181
|
light: colors.N200A,
|
|
154
182
|
dark: colors.DN600
|
|
155
|
-
})};
|
|
183
|
+
})(props)};
|
|
156
184
|
}
|
|
157
185
|
`;
|
|
158
|
-
|
|
186
|
+
|
|
187
|
+
const titleContainerStyles = props => css`
|
|
159
188
|
padding: 0;
|
|
160
189
|
display: flex;
|
|
161
190
|
align-items: flex-start;
|
|
@@ -166,7 +195,7 @@ const TitleContainerStyles = css`
|
|
|
166
195
|
color: ${themed({
|
|
167
196
|
light: colors.N300A,
|
|
168
197
|
dark: colors.DN600
|
|
169
|
-
})};
|
|
198
|
+
})(props)};
|
|
170
199
|
overflow: hidden;
|
|
171
200
|
cursor: pointer;
|
|
172
201
|
// Prevent browser selection being inside the title container
|
|
@@ -176,9 +205,10 @@ const TitleContainerStyles = css`
|
|
|
176
205
|
outline: 0;
|
|
177
206
|
}
|
|
178
207
|
`;
|
|
208
|
+
|
|
179
209
|
export const sharedExpandStyles = {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
210
|
+
titleInputStyles,
|
|
211
|
+
titleContainerStyles,
|
|
212
|
+
containerStyles,
|
|
213
|
+
contentStyles
|
|
184
214
|
};
|
|
@@ -9,7 +9,7 @@ const isMissingIntlProviderInAncestryError = err => {
|
|
|
9
9
|
return err === null || err === void 0 ? void 0 : (_err$toString = err.toString()) === null || _err$toString === void 0 ? void 0 : _err$toString.includes('<IntlProvider> needs to exist in the component ancestry');
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export class
|
|
12
|
+
export class IntlErrorBoundary extends React.Component {
|
|
13
13
|
constructor(...args) {
|
|
14
14
|
super(...args);
|
|
15
15
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
2
4
|
import classnames from 'classnames';
|
|
3
5
|
import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
4
6
|
import { calcPxFromPct } from './grid';
|
|
5
|
-
import {
|
|
7
|
+
import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
|
|
6
8
|
export const DEFAULT_IMAGE_WIDTH = 250;
|
|
7
9
|
export const DEFAULT_IMAGE_HEIGHT = 200;
|
|
8
10
|
export const wrappedLayouts = ['wrap-left', 'wrap-right', 'align-end', 'align-start'];
|
|
@@ -74,13 +76,15 @@ export default function MediaSingle({
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
const [media, caption] = children;
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
return jsx("div", {
|
|
80
|
+
ref: handleMediaSingleRef,
|
|
81
|
+
css: MediaSingleDimensionHelper({
|
|
82
|
+
width,
|
|
83
|
+
layout,
|
|
84
|
+
containerWidth,
|
|
85
|
+
pctWidth,
|
|
86
|
+
fullWidthMode
|
|
87
|
+
}),
|
|
84
88
|
"data-layout": layout,
|
|
85
89
|
"data-width": pctWidth,
|
|
86
90
|
"data-node-type": nodeType,
|
|
@@ -88,7 +92,7 @@ export default function MediaSingle({
|
|
|
88
92
|
'is-loading': isLoading,
|
|
89
93
|
'rich-media-wrapped': layout === 'wrap-left' || layout === 'wrap-right'
|
|
90
94
|
})
|
|
91
|
-
},
|
|
95
|
+
}, jsx(MediaWrapper, {
|
|
92
96
|
hasFallbackContainer: hasFallbackContainer,
|
|
93
97
|
height: mediaWrapperHeight,
|
|
94
98
|
paddingBottom: paddingBottom
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
2
4
|
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
3
5
|
import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
|
|
4
6
|
|
|
@@ -156,24 +158,20 @@ const RenderFallbackContainer = ({
|
|
|
156
158
|
` : ''}
|
|
157
159
|
`;
|
|
158
160
|
|
|
159
|
-
export const
|
|
161
|
+
export const mediaWrapperStyle = props => css`
|
|
160
162
|
position: relative;
|
|
161
163
|
|
|
162
|
-
${RenderFallbackContainer}
|
|
164
|
+
${RenderFallbackContainer(props)}
|
|
163
165
|
|
|
164
166
|
/* Editor */
|
|
165
167
|
& > figure {
|
|
166
|
-
position: ${
|
|
167
|
-
hasFallbackContainer
|
|
168
|
-
}) => hasFallbackContainer ? 'absolute' : 'relative'};
|
|
168
|
+
position: ${props.hasFallbackContainer ? 'absolute' : 'relative'};
|
|
169
169
|
height: 100%;
|
|
170
170
|
width: 100%;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
& > div {
|
|
174
|
-
position: ${
|
|
175
|
-
hasFallbackContainer
|
|
176
|
-
}) => hasFallbackContainer ? 'absolute' : 'relative'};
|
|
174
|
+
position: ${props.hasFallbackContainer ? 'absolute' : 'relative'};
|
|
177
175
|
height: 100%;
|
|
178
176
|
width: 100%;
|
|
179
177
|
}
|
|
@@ -192,7 +190,10 @@ export const MediaWrapper = styled.div`
|
|
|
192
190
|
}
|
|
193
191
|
}
|
|
194
192
|
`;
|
|
195
|
-
export const
|
|
196
|
-
|
|
197
|
-
|
|
193
|
+
export const MediaWrapper = ({
|
|
194
|
+
children,
|
|
195
|
+
...rest
|
|
196
|
+
}) => jsx("div", {
|
|
197
|
+
css: mediaWrapperStyle(rest)
|
|
198
|
+
}, children);
|
|
198
199
|
MediaWrapper.displayName = 'WrapperMediaSingle';
|
|
@@ -6,6 +6,8 @@ import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
6
6
|
import { calculatePlacement, calculatePosition, findOverflowScrollParent, validatePosition } from './utils';
|
|
7
7
|
export default class Popup extends React.Component {
|
|
8
8
|
constructor(...args) {
|
|
9
|
+
var _window;
|
|
10
|
+
|
|
9
11
|
super(...args);
|
|
10
12
|
|
|
11
13
|
_defineProperty(this, "state", {
|
|
@@ -25,6 +27,10 @@ export default class Popup extends React.Component {
|
|
|
25
27
|
_defineProperty(this, "scheduledUpdatePosition", rafSchedule(props => this.updatePosition(props)));
|
|
26
28
|
|
|
27
29
|
_defineProperty(this, "onResize", () => this.scheduledUpdatePosition(this.props));
|
|
30
|
+
|
|
31
|
+
_defineProperty(this, "resizeObserver", (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(() => {
|
|
32
|
+
this.scheduledUpdatePosition(this.props);
|
|
33
|
+
}) : undefined);
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
/**
|
|
@@ -147,9 +153,14 @@ export default class Popup extends React.Component {
|
|
|
147
153
|
const {
|
|
148
154
|
stick
|
|
149
155
|
} = this.props;
|
|
156
|
+
this.scrollParentElement = findOverflowScrollParent(this.props.target);
|
|
157
|
+
|
|
158
|
+
if (this.scrollParentElement && this.resizeObserver) {
|
|
159
|
+
this.resizeObserver.observe(this.scrollParentElement);
|
|
160
|
+
}
|
|
150
161
|
|
|
151
162
|
if (stick) {
|
|
152
|
-
this.scrollElement =
|
|
163
|
+
this.scrollElement = this.scrollParentElement;
|
|
153
164
|
} else {
|
|
154
165
|
this.scrollElement = this.props.scrollableElement;
|
|
155
166
|
}
|
|
@@ -166,6 +177,10 @@ export default class Popup extends React.Component {
|
|
|
166
177
|
this.scrollElement.removeEventListener('scroll', this.onResize);
|
|
167
178
|
}
|
|
168
179
|
|
|
180
|
+
if (this.scrollParentElement && this.resizeObserver) {
|
|
181
|
+
this.resizeObserver.unobserve(this.scrollParentElement);
|
|
182
|
+
}
|
|
183
|
+
|
|
169
184
|
this.scheduledUpdatePosition.cancel();
|
|
170
185
|
}
|
|
171
186
|
|
|
@@ -12,7 +12,6 @@ import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
|
12
12
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
13
13
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
14
14
|
const blockNodeStyle = css`
|
|
15
|
-
align-items: center;
|
|
16
15
|
background: ${N30};
|
|
17
16
|
border: 1px dashed ${N50};
|
|
18
17
|
border-radius: ${borderRadius()}px;
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -11,9 +11,7 @@ export { default as withOuterListeners } from './with-outer-listeners';
|
|
|
11
11
|
export { WidthConsumer, WidthProvider, getBreakpoint } from './WidthProvider';
|
|
12
12
|
export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
|
|
13
13
|
export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
|
|
14
|
-
export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper,
|
|
14
|
+
export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
|
|
15
15
|
export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
|
|
16
16
|
export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
17
|
-
export {
|
|
18
|
-
export { IntlLegacyFallbackProvider } from './IntlLegacyFallbackProvider';
|
|
19
|
-
export { LegacyToNextIntlProvider } from './LegacyToNextIntlProvider';
|
|
17
|
+
export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const getKeys = Object.keys;
|
|
3
|
+
export const getKeysAddedRemovedCommon = (object1, object2) => {
|
|
4
|
+
const oldKeys = object1 !== null ? getKeys(object1) : [];
|
|
5
|
+
const newKeys = object2 !== null ? getKeys(object2) : [];
|
|
6
|
+
const removed = oldKeys.filter(key => !newKeys.includes(key));
|
|
7
|
+
const added = newKeys.filter(key => !oldKeys.includes(key));
|
|
8
|
+
const common = oldKeys.filter(key => newKeys.includes(key));
|
|
9
|
+
return {
|
|
10
|
+
added,
|
|
11
|
+
common,
|
|
12
|
+
removed
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const serializeValue = value => {
|
|
16
|
+
const valueType = typeof value;
|
|
17
|
+
|
|
18
|
+
if (value === null) {
|
|
19
|
+
return 'null';
|
|
20
|
+
} else if (value === undefined) {
|
|
21
|
+
return 'undefined';
|
|
22
|
+
} else if (valueType === 'string' || valueType === 'number') {
|
|
23
|
+
return value;
|
|
24
|
+
} else if (valueType === 'symbol') {
|
|
25
|
+
return value.toString();
|
|
26
|
+
} // Calling toString of function returns whole function text with body.
|
|
27
|
+
// So, just return function with name.
|
|
28
|
+
else if (valueType === 'function') {
|
|
29
|
+
return `function:${value.name}`;
|
|
30
|
+
} else if (valueType === 'object') {
|
|
31
|
+
return {
|
|
32
|
+
type: 'object',
|
|
33
|
+
keys: Object.keys(value)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export const getPropsDifference = (object1, object2, curDepth = 0, maxDepth = 2, keysToIgnore = []) => {
|
|
38
|
+
const {
|
|
39
|
+
added,
|
|
40
|
+
common,
|
|
41
|
+
removed
|
|
42
|
+
} = getKeysAddedRemovedCommon(object1, object2);
|
|
43
|
+
const changed = [];
|
|
44
|
+
common.forEach(key => {
|
|
45
|
+
const value1 = object1[key];
|
|
46
|
+
const value2 = object2[key];
|
|
47
|
+
const value1Type = typeof value1;
|
|
48
|
+
const value2Type = typeof value2; // Do comparision only if values doesn't match (or reference to same object in memory).
|
|
49
|
+
// Or if key does not exist in keys to ignore.
|
|
50
|
+
|
|
51
|
+
if (value1 !== value2 && keysToIgnore.indexOf(key) === -1) {
|
|
52
|
+
// if both key value are objects and not referencing same object in memory.
|
|
53
|
+
// then get recursive difference.
|
|
54
|
+
if ( /*#__PURE__*/React.isValidElement(value1) || /*#__PURE__*/React.isValidElement(value2)) {
|
|
55
|
+
changed.push({
|
|
56
|
+
key,
|
|
57
|
+
reactElementChanged: true
|
|
58
|
+
});
|
|
59
|
+
} else if (value1Type === 'object' && value2Type === 'object') {
|
|
60
|
+
if (curDepth <= maxDepth) {
|
|
61
|
+
const difference = getPropsDifference(value1, value2, curDepth + 1, maxDepth);
|
|
62
|
+
changed.push({
|
|
63
|
+
key,
|
|
64
|
+
difference
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
changed.push({
|
|
68
|
+
key,
|
|
69
|
+
maxDepthReached: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
changed.push({
|
|
74
|
+
key,
|
|
75
|
+
oldValue: serializeValue(value1),
|
|
76
|
+
newValue: serializeValue(value2)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
added,
|
|
83
|
+
changed,
|
|
84
|
+
removed
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export const getShallowPropsDifference = (object1, object2) => {
|
|
88
|
+
const {
|
|
89
|
+
added,
|
|
90
|
+
common,
|
|
91
|
+
removed
|
|
92
|
+
} = getKeysAddedRemovedCommon(object1, object2);
|
|
93
|
+
const changed = common.filter(key => object1[key] !== object2[key]);
|
|
94
|
+
return {
|
|
95
|
+
added,
|
|
96
|
+
changed,
|
|
97
|
+
removed
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -23,4 +23,6 @@ export { shouldForceTracking } from './should-force-tracking';
|
|
|
23
23
|
export { getModeFromTheme } from './getModeFromTheme';
|
|
24
24
|
export { sniffUserBrowserExtensions } from './browser-extensions';
|
|
25
25
|
export { RenderCountProfiler } from './profiler/render-count';
|
|
26
|
-
export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
|
|
26
|
+
export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
|
|
27
|
+
export { getShallowPropsDifference, getPropsDifference } from './compare-props';
|
|
28
|
+
export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { uuid } from '@atlaskit/adf-schema';
|
|
3
|
+
import { getPropsDifference, getShallowPropsDifference } from '../../../compare-props';
|
|
4
|
+
export function useComponentRenderTracking({
|
|
5
|
+
onRender,
|
|
6
|
+
propsDiffingOptions,
|
|
7
|
+
zeroBasedCount = true
|
|
8
|
+
}) {
|
|
9
|
+
const propsRef = useRef();
|
|
10
|
+
const renderCountRef = useRef(zeroBasedCount ? 0 : 1);
|
|
11
|
+
const {
|
|
12
|
+
current: componentId
|
|
13
|
+
} = useRef(uuid.generate());
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const lastProps = propsRef.current;
|
|
16
|
+
const renderCount = renderCountRef.current;
|
|
17
|
+
let propsDifference;
|
|
18
|
+
|
|
19
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled && lastProps) {
|
|
20
|
+
propsDifference = propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.useShallow ? getShallowPropsDifference(lastProps, propsDiffingOptions.props) : getPropsDifference(lastProps, propsDiffingOptions.props, 0, 2, propsDiffingOptions === null || propsDiffingOptions === void 0 ? void 0 : propsDiffingOptions.propsToIgnore);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const result = {
|
|
24
|
+
renderCount,
|
|
25
|
+
propsDifference,
|
|
26
|
+
componentId
|
|
27
|
+
};
|
|
28
|
+
onRender(result);
|
|
29
|
+
|
|
30
|
+
if (propsDiffingOptions !== null && propsDiffingOptions !== void 0 && propsDiffingOptions.enabled) {
|
|
31
|
+
propsRef.current = propsDiffingOptions.props;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
renderCountRef.current = renderCountRef.current + 1;
|
|
35
|
+
}); // No dependencies run on each render
|
|
36
|
+
}
|
|
@@ -356,7 +356,7 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
|
|
|
356
356
|
mediaCollection = collection;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
if (mediaId && mediaCollection
|
|
359
|
+
if (mediaId && mediaCollection) {
|
|
360
360
|
return {
|
|
361
361
|
type,
|
|
362
362
|
attrs,
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
3
|
import camelCase from 'lodash/camelCase';
|
|
3
4
|
import kebabCase from 'lodash/kebabCase';
|
|
4
5
|
var EMPTY = {};
|
|
6
|
+
|
|
7
|
+
function isObjectFlagKey(key, value, objectFlagKeys) {
|
|
8
|
+
return Boolean(typeof value === 'string' && (objectFlagKeys === null || objectFlagKeys === void 0 ? void 0 : objectFlagKeys.includes(key)));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isValidJSONObject(value) {
|
|
12
|
+
try {
|
|
13
|
+
var result = JSON.parse(value);
|
|
14
|
+
|
|
15
|
+
if (_typeof(result) === 'object' && result !== null) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return false;
|
|
20
|
+
} catch (err) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
5
24
|
/**
|
|
6
25
|
* Normalise and filter a free Record<string, unknown> to match
|
|
7
26
|
* the rules for feature flags in editor and renderer
|
|
@@ -12,18 +31,27 @@ var EMPTY = {};
|
|
|
12
31
|
*
|
|
13
32
|
* Output matches
|
|
14
33
|
* 1. cased in camelCase (match [a-zA-Z])
|
|
15
|
-
* 2. has boolean value
|
|
34
|
+
* 2. has boolean value or object {} value
|
|
16
35
|
*
|
|
17
36
|
* @param rawFeatureFlags
|
|
18
37
|
*/
|
|
19
38
|
|
|
20
|
-
|
|
39
|
+
|
|
40
|
+
export function normalizeFeatureFlags(rawFeatureFlags, options) {
|
|
21
41
|
if (!rawFeatureFlags) {
|
|
22
42
|
return EMPTY;
|
|
23
43
|
}
|
|
24
44
|
|
|
25
45
|
return Object.entries(rawFeatureFlags).filter(function (e) {
|
|
26
|
-
|
|
46
|
+
if (typeof e[1] === 'boolean') {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (isObjectFlagKey(camelCase(e[0]), e[1], options === null || options === void 0 ? void 0 : options.objectFlagKeys) && isValidJSONObject(e[1])) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return false;
|
|
27
55
|
}).filter(function (_ref) {
|
|
28
56
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
29
57
|
key = _ref2[0];
|
|
@@ -40,7 +68,14 @@ export function normalizeFeatureFlags(rawFeatureFlags) {
|
|
|
40
68
|
key = _ref6[0],
|
|
41
69
|
value = _ref6[1];
|
|
42
70
|
|
|
43
|
-
|
|
71
|
+
if (isObjectFlagKey(key, value, options === null || options === void 0 ? void 0 : options.objectFlagKeys)) {
|
|
72
|
+
flags[key] = JSON.parse(value);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (typeof value === 'boolean') {
|
|
76
|
+
flags[key] = value;
|
|
77
|
+
}
|
|
78
|
+
|
|
44
79
|
return flags;
|
|
45
80
|
}, {});
|
|
46
81
|
}
|
|
@@ -2,6 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
|
-
import { css } from '
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
6
|
var linkSharedStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n a.blockLink {\n display: block;\n }\n"])));
|
|
7
7
|
export { linkSharedStyle };
|
|
@@ -5,4 +5,4 @@ var _templateObject;
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { bulletListSelector, orderedListSelector } from '@atlaskit/adf-schema';
|
|
7
7
|
import browser from '../../utils/browser';
|
|
8
|
-
export var listsSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* =============== INDENTATION SPACING ========= */\n\n ul,\n ol {\n box-sizing: border-box;\n padding-left: 24px;\n\n /*\n Firefox does not handle empty block element inside li tag.\n If there is not block element inside li tag,\n then firefox sets inherited height to li\n However, if there is any block element and if it's empty\n (or has empty inline element) then\n firefox sets li tag height to zero.\n More details at\n https://product-fabric.atlassian.net/wiki/spaces/~455502413/pages/3149365890/ED-14110+Investigation\n */\n li p:empty,\n li p > span:empty {\n ", "\n }\n }\n\n ", ", ", " {\n /*\n Ensures list item content adheres to the list's margin instead\n of filling the entire block row. This is important to allow\n clicking interactive elements which are floated next to a list.\n\n For some history and context on this block, see PRs related to tickets.:\n @see ED-6551 - original issue.\n @see ED-7015 - follow up issue.\n @see ED-7447 - flow-root change.\n\n We use 'display: table' (old clear fix / new block formatting context hack)\n for older browsers and 'flow-root' for modern browsers.\n\n @see https://css-tricks.com/display-flow-root/\n */\n // For older browsers the do not support flow-root.\n display: table;\n display: flow-root;\n }\n\n /* =============== INDENTATION AESTHETICS ========= */\n\n /**\n We support nested lists up to six levels deep.\n **/\n\n /* LEGACY LISTS */\n\n ul,\n ul ul ul ul {\n list-style-type: disc;\n }\n\n ul ul,\n ul ul ul ul ul {\n list-style-type: circle;\n }\n\n ul ul ul,\n ul ul ul ul ul ul {\n list-style-type: square;\n }\n\n ol,\n ol ol ol ol {\n list-style-type: decimal;\n }\n ol ol,\n ol ol ol ol ol {\n list-style-type: lower-alpha;\n }\n ol ol ol,\n ol ol ol ol ol ol {\n list-style-type: lower-roman;\n }\n\n /* PREDICTABLE LISTS */\n\n ol[data-indent-level='1'],\n ol[data-indent-level='4'] {\n list-style-type: decimal;\n }\n\n ol[data-indent-level='2'],\n ol[data-indent-level='5'] {\n list-style-type: lower-alpha;\n }\n\n ol[data-indent-level='3'],\n ol[data-indent-level='6'] {\n list-style-type: lower-roman;\n }\n\n ul[data-indent-level='1'],\n ul[data-indent-level='4'] {\n list-style-type: disc;\n }\n\n ul[data-indent-level='2'],\n ul[data-indent-level='5'] {\n list-style-type: circle;\n }\n\n ul[data-indent-level='3'],\n ul[data-indent-level='6'] {\n list-style-type: square;\n }\n"])), browser.gecko ? 'display: inline-block;' : '', orderedListSelector, bulletListSelector);
|
|
8
|
+
export var listsSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* =============== INDENTATION SPACING ========= */\n\n ul,\n ol {\n box-sizing: border-box;\n padding-left: 24px;\n\n /*\n Firefox does not handle empty block element inside li tag.\n If there is not block element inside li tag,\n then firefox sets inherited height to li\n However, if there is any block element and if it's empty\n (or has empty inline element) then\n firefox sets li tag height to zero.\n More details at\n https://product-fabric.atlassian.net/wiki/spaces/~455502413/pages/3149365890/ED-14110+Investigation\n */\n li p:empty,\n li p > span:empty {\n ", "\n }\n }\n\n ", ", ", " {\n /*\n Ensures list item content adheres to the list's margin instead\n of filling the entire block row. This is important to allow\n clicking interactive elements which are floated next to a list.\n\n For some history and context on this block, see PRs related to tickets.:\n @see ED-6551 - original issue.\n @see ED-7015 - follow up issue.\n @see ED-7447 - flow-root change.\n\n We use 'display: table' (old clear fix / new block formatting context hack)\n for older browsers and 'flow-root' for modern browsers.\n\n @see https://css-tricks.com/display-flow-root/\n */\n // For older browsers the do not support flow-root.\n /* stylelint-disable declaration-block-no-duplicate-properties */\n display: table;\n display: flow-root;\n /* stylelint-enable declaration-block-no-duplicate-properties */\n }\n\n /* =============== INDENTATION AESTHETICS ========= */\n\n /**\n We support nested lists up to six levels deep.\n **/\n\n /* LEGACY LISTS */\n\n ul,\n ul ul ul ul {\n list-style-type: disc;\n }\n\n ul ul,\n ul ul ul ul ul {\n list-style-type: circle;\n }\n\n ul ul ul,\n ul ul ul ul ul ul {\n list-style-type: square;\n }\n\n ol,\n ol ol ol ol {\n list-style-type: decimal;\n }\n ol ol,\n ol ol ol ol ol {\n list-style-type: lower-alpha;\n }\n ol ol ol,\n ol ol ol ol ol ol {\n list-style-type: lower-roman;\n }\n\n /* PREDICTABLE LISTS */\n\n ol[data-indent-level='1'],\n ol[data-indent-level='4'] {\n list-style-type: decimal;\n }\n\n ol[data-indent-level='2'],\n ol[data-indent-level='5'] {\n list-style-type: lower-alpha;\n }\n\n ol[data-indent-level='3'],\n ol[data-indent-level='6'] {\n list-style-type: lower-roman;\n }\n\n ul[data-indent-level='1'],\n ul[data-indent-level='4'] {\n list-style-type: disc;\n }\n\n ul[data-indent-level='2'],\n ul[data-indent-level='5'] {\n list-style-type: circle;\n }\n\n ul[data-indent-level='3'],\n ul[data-indent-level='6'] {\n list-style-type: square;\n }\n"])), browser.gecko ? 'display: inline-block;' : '', orderedListSelector, bulletListSelector);
|