@atlaskit/renderer 124.15.1 → 124.16.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 +11 -0
- package/dist/cjs/react/nodes/extension.js +21 -0
- package/dist/cjs/react/nodes/multiBodiedExtension.js +43 -5
- package/dist/cjs/react/utils/breakout.js +15 -0
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +2 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/extension.js +21 -0
- package/dist/es2019/react/nodes/multiBodiedExtension.js +42 -3
- package/dist/es2019/react/utils/breakout.js +9 -0
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +1 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/extension.js +21 -0
- package/dist/esm/react/nodes/multiBodiedExtension.js +43 -5
- package/dist/esm/react/utils/breakout.js +9 -0
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +2 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/utils/breakout.d.ts +1 -0
- package/dist/types-ts4.5/react/utils/breakout.d.ts +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 124.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d2da08dd6c682`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2da08dd6c682) -
|
|
8
|
+
use css driven width for extension styles in renderer
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 124.15.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -11,6 +11,8 @@ var _ExtensionRenderer = _interopRequireDefault(require("../../ui/ExtensionRende
|
|
|
11
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _consts = require("../../consts");
|
|
14
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
+
var _breakout = require("../utils/breakout");
|
|
14
16
|
var viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
|
|
15
17
|
// Mirrors sizes from https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/forge/xen-editor-provider/src/render/renderers/ForgeUIExtension.tsx
|
|
16
18
|
var macroHeights = {
|
|
@@ -54,6 +56,25 @@ var renderExtension = exports.renderExtension = function renderExtension(content
|
|
|
54
56
|
*/
|
|
55
57
|
var viewportSize = getViewportSize(extensionId, extensionViewportSizes);
|
|
56
58
|
var extensionHeight = nodeHeight || viewportSize;
|
|
59
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_renderer_extension_width_fix', 'isEnabled', true)) {
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
+
ref: options.handleRef
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
63
|
+
,
|
|
64
|
+
className: "".concat(_consts.RendererCssClassName.EXTENSION, " ").concat(options.shadowClassNames, " ").concat(centerAlignClass),
|
|
65
|
+
style: {
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
67
|
+
width: isTopLevel ? (0, _breakout.calcBreakoutWidthCss)(layout) : '100%',
|
|
68
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
69
|
+
minHeight: extensionHeight && "".concat(extensionHeight, "px")
|
|
70
|
+
},
|
|
71
|
+
"data-layout": layout,
|
|
72
|
+
"data-local-id": localId,
|
|
73
|
+
"data-testid": "extension--wrapper"
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: overflowContainerClass
|
|
76
|
+
}, content));
|
|
77
|
+
}
|
|
57
78
|
return /*#__PURE__*/_react.default.createElement(_ui.WidthConsumer, null, function (_ref2) {
|
|
58
79
|
var width = _ref2.width;
|
|
59
80
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -15,6 +15,8 @@ var _consts = require("../../consts");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _actions = require("./multiBodiedExtension/actions");
|
|
17
17
|
var _context = require("./multiBodiedExtension/context");
|
|
18
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
19
|
+
var _breakout = require("../utils/breakout");
|
|
18
20
|
var _templateObject;
|
|
19
21
|
/* eslint-disable @atlaskit/design-system/prefer-primitives, @atlaskit/design-system/consistent-css-prop-usage */
|
|
20
22
|
/**
|
|
@@ -43,7 +45,7 @@ var MultiBodiedExtensionNavigation = function MultiBodiedExtensionNavigation(_re
|
|
|
43
45
|
"data-testid": "multiBodiedExtension-navigation"
|
|
44
46
|
}, children);
|
|
45
47
|
};
|
|
46
|
-
var
|
|
48
|
+
var MultiBodiedExtensionWrapperLegacy = function MultiBodiedExtensionWrapperLegacy(_ref3) {
|
|
47
49
|
var width = _ref3.width,
|
|
48
50
|
path = _ref3.path,
|
|
49
51
|
layout = _ref3.layout,
|
|
@@ -56,7 +58,7 @@ var MultiBodiedExtensionWrapper = function MultiBodiedExtensionWrapper(_ref3) {
|
|
|
56
58
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
57
59
|
className: "".concat(_consts.RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
58
60
|
style: {
|
|
59
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
61
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
60
62
|
width: isTopLevel ? (0, _utils.calcBreakoutWidth)(layout, width) : '100%'
|
|
61
63
|
},
|
|
62
64
|
"data-layout": layout,
|
|
@@ -66,6 +68,29 @@ var MultiBodiedExtensionWrapper = function MultiBodiedExtensionWrapper(_ref3) {
|
|
|
66
68
|
className: "".concat(_consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER)
|
|
67
69
|
}, children));
|
|
68
70
|
};
|
|
71
|
+
var MultiBodiedExtensionWrapperNext = function MultiBodiedExtensionWrapperNext(_ref4) {
|
|
72
|
+
var path = _ref4.path,
|
|
73
|
+
layout = _ref4.layout,
|
|
74
|
+
children = _ref4.children;
|
|
75
|
+
var isTopLevel = path.length < 1;
|
|
76
|
+
var centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? _consts.RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
77
|
+
|
|
78
|
+
// This hierarchy is copied from regular extension (see extension.tsx)
|
|
79
|
+
return (0, _react.jsx)("div", {
|
|
80
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
81
|
+
className: "".concat(_consts.RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
82
|
+
style: {
|
|
83
|
+
width: isTopLevel ?
|
|
84
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
85
|
+
(0, _breakout.calcBreakoutWidthCss)(layout) : '100%'
|
|
86
|
+
},
|
|
87
|
+
"data-layout": layout,
|
|
88
|
+
"data-testid": "multiBodiedExtension--wrapper"
|
|
89
|
+
}, (0, _react.jsx)("div", {
|
|
90
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
91
|
+
className: "".concat(_consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER)
|
|
92
|
+
}, children));
|
|
93
|
+
};
|
|
69
94
|
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
70
95
|
var _extensionContext$pri;
|
|
71
96
|
var children = props.children,
|
|
@@ -130,6 +155,19 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
130
155
|
// make the frame visible
|
|
131
156
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
132
157
|
var containerActiveFrameStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t\t& [data-extension-frame='true']:nth-of-type(", ") {\n\t\t\tdisplay: block;\n\t\t}\n\t"])), activeChildIndex + 1);
|
|
158
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_renderer_extension_width_fix', 'isEnabled', true)) {
|
|
159
|
+
return (0, _react.jsx)("section", {
|
|
160
|
+
css: [containerStyles, containerActiveFrameStyles],
|
|
161
|
+
"data-testid": "multiBodiedExtension--container",
|
|
162
|
+
"data-multiBodiedExtension-container": true,
|
|
163
|
+
"data-active-child-index": activeChildIndex,
|
|
164
|
+
"data-layout": layout,
|
|
165
|
+
"data-local-id": localId
|
|
166
|
+
}, (0, _react.jsx)(MultiBodiedExtensionWrapperNext, {
|
|
167
|
+
layout: layout,
|
|
168
|
+
path: path
|
|
169
|
+
}, renderContent()));
|
|
170
|
+
}
|
|
133
171
|
return (0, _react.jsx)("section", {
|
|
134
172
|
css: [containerStyles, containerActiveFrameStyles],
|
|
135
173
|
"data-testid": "multiBodiedExtension--container",
|
|
@@ -137,9 +175,9 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
137
175
|
"data-active-child-index": activeChildIndex,
|
|
138
176
|
"data-layout": layout,
|
|
139
177
|
"data-local-id": localId
|
|
140
|
-
}, (0, _react.jsx)(_ui.WidthConsumer, null, function (
|
|
141
|
-
var width =
|
|
142
|
-
return (0, _react.jsx)(
|
|
178
|
+
}, (0, _react.jsx)(_ui.WidthConsumer, null, function (_ref5) {
|
|
179
|
+
var width = _ref5.width;
|
|
180
|
+
return (0, _react.jsx)(MultiBodiedExtensionWrapperLegacy, {
|
|
143
181
|
layout: layout,
|
|
144
182
|
width: width,
|
|
145
183
|
path: path
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.calcBreakoutWidthCss = void 0;
|
|
7
|
+
var calcBreakoutWidthCss = exports.calcBreakoutWidthCss = function calcBreakoutWidthCss(layout) {
|
|
8
|
+
if (layout === 'full-width') {
|
|
9
|
+
return 'min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--full-width-layout-width))';
|
|
10
|
+
}
|
|
11
|
+
if (layout === 'wide') {
|
|
12
|
+
return 'min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--breakout-wide-layout-width))';
|
|
13
|
+
}
|
|
14
|
+
return '100%';
|
|
15
|
+
};
|
|
@@ -58,7 +58,8 @@ var baseStyles = (0, _react.css)((_css = {
|
|
|
58
58
|
fontSize: 'var(--ak-renderer-base-font-size)',
|
|
59
59
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
60
60
|
lineHeight: '1.5rem',
|
|
61
|
-
color: "var(--ds-text, ".concat(_colors.N800, ")")
|
|
61
|
+
color: "var(--ds-text, ".concat(_colors.N800, ")"),
|
|
62
|
+
'--ak-editor--full-width-layout-width': "".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px")
|
|
62
63
|
}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_css, ".".concat(_consts.RendererCssClassName.DOCUMENT, "::after"), {
|
|
63
64
|
// we add a clearfix after ak-renderer-document in order to
|
|
64
65
|
// contain internal floats (such as media images that are "wrap-left")
|
|
@@ -69,7 +69,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
69
69
|
// we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
|
|
70
70
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
71
71
|
var packageName = "@atlaskit/renderer";
|
|
72
|
-
var packageVersion = "
|
|
72
|
+
var packageVersion = "0.0.0-development";
|
|
73
73
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
74
74
|
containerName: 'ak-renderer-wrapper',
|
|
75
75
|
containerType: 'inline-size'
|
|
@@ -4,6 +4,8 @@ import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
|
4
4
|
import { overflowShadow, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { RendererCssClassName } from '../../consts';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
+
import { calcBreakoutWidthCss } from '../utils/breakout';
|
|
7
9
|
const viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
|
|
8
10
|
// Mirrors sizes from https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/forge/xen-editor-provider/src/render/renderers/ForgeUIExtension.tsx
|
|
9
11
|
const macroHeights = {
|
|
@@ -39,6 +41,25 @@ export const renderExtension = (content, layout, options = {}, removeOverflow, e
|
|
|
39
41
|
*/
|
|
40
42
|
const viewportSize = getViewportSize(extensionId, extensionViewportSizes);
|
|
41
43
|
const extensionHeight = nodeHeight || viewportSize;
|
|
44
|
+
if (expValEquals('platform_editor_renderer_extension_width_fix', 'isEnabled', true)) {
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
ref: options.handleRef
|
|
47
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
48
|
+
,
|
|
49
|
+
className: `${RendererCssClassName.EXTENSION} ${options.shadowClassNames} ${centerAlignClass}`,
|
|
50
|
+
style: {
|
|
51
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
52
|
+
width: isTopLevel ? calcBreakoutWidthCss(layout) : '100%',
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
54
|
+
minHeight: extensionHeight && `${extensionHeight}px`
|
|
55
|
+
},
|
|
56
|
+
"data-layout": layout,
|
|
57
|
+
"data-local-id": localId,
|
|
58
|
+
"data-testid": "extension--wrapper"
|
|
59
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: overflowContainerClass
|
|
61
|
+
}, content));
|
|
62
|
+
}
|
|
42
63
|
return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
43
64
|
width
|
|
44
65
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
@@ -13,6 +13,8 @@ import { RendererCssClassName } from '../../consts';
|
|
|
13
13
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
14
14
|
import { useMultiBodiedExtensionActions } from './multiBodiedExtension/actions';
|
|
15
15
|
import { useMultiBodiedExtensionContext } from './multiBodiedExtension/context';
|
|
16
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
|
+
import { calcBreakoutWidthCss } from '../utils/breakout';
|
|
16
18
|
const containerStyles = css({
|
|
17
19
|
// Remove top margin if MBE is the first on the doc/page (MBE can only be on the first level)
|
|
18
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors, @atlaskit/ui-styling-standard/no-nested-selectors
|
|
@@ -34,7 +36,7 @@ const MultiBodiedExtensionNavigation = ({
|
|
|
34
36
|
"data-testid": "multiBodiedExtension-navigation"
|
|
35
37
|
}, children);
|
|
36
38
|
};
|
|
37
|
-
const
|
|
39
|
+
const MultiBodiedExtensionWrapperLegacy = ({
|
|
38
40
|
width,
|
|
39
41
|
path,
|
|
40
42
|
layout,
|
|
@@ -48,7 +50,7 @@ const MultiBodiedExtensionWrapper = ({
|
|
|
48
50
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
49
51
|
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass}`,
|
|
50
52
|
style: {
|
|
51
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
52
54
|
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
53
55
|
},
|
|
54
56
|
"data-layout": layout,
|
|
@@ -58,6 +60,30 @@ const MultiBodiedExtensionWrapper = ({
|
|
|
58
60
|
className: `${RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER}`
|
|
59
61
|
}, children));
|
|
60
62
|
};
|
|
63
|
+
const MultiBodiedExtensionWrapperNext = ({
|
|
64
|
+
path,
|
|
65
|
+
layout,
|
|
66
|
+
children
|
|
67
|
+
}) => {
|
|
68
|
+
const isTopLevel = path.length < 1;
|
|
69
|
+
const centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
70
|
+
|
|
71
|
+
// This hierarchy is copied from regular extension (see extension.tsx)
|
|
72
|
+
return jsx("div", {
|
|
73
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
74
|
+
className: `${RendererCssClassName.EXTENSION} ${centerAlignClass}`,
|
|
75
|
+
style: {
|
|
76
|
+
width: isTopLevel ?
|
|
77
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
78
|
+
calcBreakoutWidthCss(layout) : '100%'
|
|
79
|
+
},
|
|
80
|
+
"data-layout": layout,
|
|
81
|
+
"data-testid": "multiBodiedExtension--wrapper"
|
|
82
|
+
}, jsx("div", {
|
|
83
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
84
|
+
className: `${RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER}`
|
|
85
|
+
}, children));
|
|
86
|
+
};
|
|
61
87
|
const MultiBodiedExtension = props => {
|
|
62
88
|
var _extensionContext$pri;
|
|
63
89
|
const {
|
|
@@ -124,6 +150,19 @@ const MultiBodiedExtension = props => {
|
|
|
124
150
|
display: block;
|
|
125
151
|
}
|
|
126
152
|
`;
|
|
153
|
+
if (expValEquals('platform_editor_renderer_extension_width_fix', 'isEnabled', true)) {
|
|
154
|
+
return jsx("section", {
|
|
155
|
+
css: [containerStyles, containerActiveFrameStyles],
|
|
156
|
+
"data-testid": "multiBodiedExtension--container",
|
|
157
|
+
"data-multiBodiedExtension-container": true,
|
|
158
|
+
"data-active-child-index": activeChildIndex,
|
|
159
|
+
"data-layout": layout,
|
|
160
|
+
"data-local-id": localId
|
|
161
|
+
}, jsx(MultiBodiedExtensionWrapperNext, {
|
|
162
|
+
layout: layout,
|
|
163
|
+
path: path
|
|
164
|
+
}, renderContent()));
|
|
165
|
+
}
|
|
127
166
|
return jsx("section", {
|
|
128
167
|
css: [containerStyles, containerActiveFrameStyles],
|
|
129
168
|
"data-testid": "multiBodiedExtension--container",
|
|
@@ -133,7 +172,7 @@ const MultiBodiedExtension = props => {
|
|
|
133
172
|
"data-local-id": localId
|
|
134
173
|
}, jsx(WidthConsumer, null, ({
|
|
135
174
|
width
|
|
136
|
-
}) => jsx(
|
|
175
|
+
}) => jsx(MultiBodiedExtensionWrapperLegacy, {
|
|
137
176
|
layout: layout,
|
|
138
177
|
width: width,
|
|
139
178
|
path: path
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const calcBreakoutWidthCss = layout => {
|
|
2
|
+
if (layout === 'full-width') {
|
|
3
|
+
return 'min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--full-width-layout-width))';
|
|
4
|
+
}
|
|
5
|
+
if (layout === 'wide') {
|
|
6
|
+
return 'min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--breakout-wide-layout-width))';
|
|
7
|
+
}
|
|
8
|
+
return '100%';
|
|
9
|
+
};
|
|
@@ -50,6 +50,7 @@ const baseStyles = css({
|
|
|
50
50
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
51
51
|
lineHeight: '1.5rem',
|
|
52
52
|
color: `var(--ds-text, ${N800})`,
|
|
53
|
+
'--ak-editor--full-width-layout-width': `${akEditorFullWidthLayoutWidth}px`,
|
|
53
54
|
[`.${RendererCssClassName.DOCUMENT}::after`]: {
|
|
54
55
|
// we add a clearfix after ak-renderer-document in order to
|
|
55
56
|
// contain internal floats (such as media images that are "wrap-left")
|
|
@@ -55,7 +55,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
55
55
|
// we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
|
|
56
56
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
57
57
|
const packageName = "@atlaskit/renderer";
|
|
58
|
-
const packageVersion = "
|
|
58
|
+
const packageVersion = "0.0.0-development";
|
|
59
59
|
const setAsQueryContainerStyles = css({
|
|
60
60
|
containerName: 'ak-renderer-wrapper',
|
|
61
61
|
containerType: 'inline-size'
|
|
@@ -4,6 +4,8 @@ import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
|
4
4
|
import { overflowShadow, WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { RendererCssClassName } from '../../consts';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
+
import { calcBreakoutWidthCss } from '../utils/breakout';
|
|
7
9
|
var viewportSizes = ['small', 'medium', 'default', 'large', 'xlarge'];
|
|
8
10
|
// Mirrors sizes from https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/forge/xen-editor-provider/src/render/renderers/ForgeUIExtension.tsx
|
|
9
11
|
var macroHeights = {
|
|
@@ -47,6 +49,25 @@ export var renderExtension = function renderExtension(content, layout) {
|
|
|
47
49
|
*/
|
|
48
50
|
var viewportSize = getViewportSize(extensionId, extensionViewportSizes);
|
|
49
51
|
var extensionHeight = nodeHeight || viewportSize;
|
|
52
|
+
if (expValEquals('platform_editor_renderer_extension_width_fix', 'isEnabled', true)) {
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
ref: options.handleRef
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
56
|
+
,
|
|
57
|
+
className: "".concat(RendererCssClassName.EXTENSION, " ").concat(options.shadowClassNames, " ").concat(centerAlignClass),
|
|
58
|
+
style: {
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
60
|
+
width: isTopLevel ? calcBreakoutWidthCss(layout) : '100%',
|
|
61
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
62
|
+
minHeight: extensionHeight && "".concat(extensionHeight, "px")
|
|
63
|
+
},
|
|
64
|
+
"data-layout": layout,
|
|
65
|
+
"data-local-id": localId,
|
|
66
|
+
"data-testid": "extension--wrapper"
|
|
67
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: overflowContainerClass
|
|
69
|
+
}, content));
|
|
70
|
+
}
|
|
50
71
|
return /*#__PURE__*/React.createElement(WidthConsumer, null, function (_ref2) {
|
|
51
72
|
var width = _ref2.width;
|
|
52
73
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -16,6 +16,8 @@ import { RendererCssClassName } from '../../consts';
|
|
|
16
16
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
17
17
|
import { useMultiBodiedExtensionActions } from './multiBodiedExtension/actions';
|
|
18
18
|
import { useMultiBodiedExtensionContext } from './multiBodiedExtension/context';
|
|
19
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
|
+
import { calcBreakoutWidthCss } from '../utils/breakout';
|
|
19
21
|
var containerStyles = css({
|
|
20
22
|
// Remove top margin if MBE is the first on the doc/page (MBE can only be on the first level)
|
|
21
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors, @atlaskit/ui-styling-standard/no-nested-selectors
|
|
@@ -35,7 +37,7 @@ var MultiBodiedExtensionNavigation = function MultiBodiedExtensionNavigation(_re
|
|
|
35
37
|
"data-testid": "multiBodiedExtension-navigation"
|
|
36
38
|
}, children);
|
|
37
39
|
};
|
|
38
|
-
var
|
|
40
|
+
var MultiBodiedExtensionWrapperLegacy = function MultiBodiedExtensionWrapperLegacy(_ref3) {
|
|
39
41
|
var width = _ref3.width,
|
|
40
42
|
path = _ref3.path,
|
|
41
43
|
layout = _ref3.layout,
|
|
@@ -48,7 +50,7 @@ var MultiBodiedExtensionWrapper = function MultiBodiedExtensionWrapper(_ref3) {
|
|
|
48
50
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
49
51
|
className: "".concat(RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
50
52
|
style: {
|
|
51
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
52
54
|
width: isTopLevel ? calcBreakoutWidth(layout, width) : '100%'
|
|
53
55
|
},
|
|
54
56
|
"data-layout": layout,
|
|
@@ -58,6 +60,29 @@ var MultiBodiedExtensionWrapper = function MultiBodiedExtensionWrapper(_ref3) {
|
|
|
58
60
|
className: "".concat(RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER)
|
|
59
61
|
}, children));
|
|
60
62
|
};
|
|
63
|
+
var MultiBodiedExtensionWrapperNext = function MultiBodiedExtensionWrapperNext(_ref4) {
|
|
64
|
+
var path = _ref4.path,
|
|
65
|
+
layout = _ref4.layout,
|
|
66
|
+
children = _ref4.children;
|
|
67
|
+
var isTopLevel = path.length < 1;
|
|
68
|
+
var centerAlignClass = isTopLevel && ['wide', 'full-width'].includes(layout) ? RendererCssClassName.EXTENSION_CENTER_ALIGN : '';
|
|
69
|
+
|
|
70
|
+
// This hierarchy is copied from regular extension (see extension.tsx)
|
|
71
|
+
return jsx("div", {
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
73
|
+
className: "".concat(RendererCssClassName.EXTENSION, " ").concat(centerAlignClass),
|
|
74
|
+
style: {
|
|
75
|
+
width: isTopLevel ?
|
|
76
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
77
|
+
calcBreakoutWidthCss(layout) : '100%'
|
|
78
|
+
},
|
|
79
|
+
"data-layout": layout,
|
|
80
|
+
"data-testid": "multiBodiedExtension--wrapper"
|
|
81
|
+
}, jsx("div", {
|
|
82
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
83
|
+
className: "".concat(RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER)
|
|
84
|
+
}, children));
|
|
85
|
+
};
|
|
61
86
|
var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
62
87
|
var _extensionContext$pri;
|
|
63
88
|
var children = props.children,
|
|
@@ -122,6 +147,19 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
122
147
|
// make the frame visible
|
|
123
148
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression
|
|
124
149
|
var containerActiveFrameStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t& [data-extension-frame='true']:nth-of-type(", ") {\n\t\t\tdisplay: block;\n\t\t}\n\t"])), activeChildIndex + 1);
|
|
150
|
+
if (expValEquals('platform_editor_renderer_extension_width_fix', 'isEnabled', true)) {
|
|
151
|
+
return jsx("section", {
|
|
152
|
+
css: [containerStyles, containerActiveFrameStyles],
|
|
153
|
+
"data-testid": "multiBodiedExtension--container",
|
|
154
|
+
"data-multiBodiedExtension-container": true,
|
|
155
|
+
"data-active-child-index": activeChildIndex,
|
|
156
|
+
"data-layout": layout,
|
|
157
|
+
"data-local-id": localId
|
|
158
|
+
}, jsx(MultiBodiedExtensionWrapperNext, {
|
|
159
|
+
layout: layout,
|
|
160
|
+
path: path
|
|
161
|
+
}, renderContent()));
|
|
162
|
+
}
|
|
125
163
|
return jsx("section", {
|
|
126
164
|
css: [containerStyles, containerActiveFrameStyles],
|
|
127
165
|
"data-testid": "multiBodiedExtension--container",
|
|
@@ -129,9 +167,9 @@ var MultiBodiedExtension = function MultiBodiedExtension(props) {
|
|
|
129
167
|
"data-active-child-index": activeChildIndex,
|
|
130
168
|
"data-layout": layout,
|
|
131
169
|
"data-local-id": localId
|
|
132
|
-
}, jsx(WidthConsumer, null, function (
|
|
133
|
-
var width =
|
|
134
|
-
return jsx(
|
|
170
|
+
}, jsx(WidthConsumer, null, function (_ref5) {
|
|
171
|
+
var width = _ref5.width;
|
|
172
|
+
return jsx(MultiBodiedExtensionWrapperLegacy, {
|
|
135
173
|
layout: layout,
|
|
136
174
|
width: width,
|
|
137
175
|
path: path
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var calcBreakoutWidthCss = function calcBreakoutWidthCss(layout) {
|
|
2
|
+
if (layout === 'full-width') {
|
|
3
|
+
return 'min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--full-width-layout-width))';
|
|
4
|
+
}
|
|
5
|
+
if (layout === 'wide') {
|
|
6
|
+
return 'min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--breakout-wide-layout-width))';
|
|
7
|
+
}
|
|
8
|
+
return '100%';
|
|
9
|
+
};
|
|
@@ -51,7 +51,8 @@ var baseStyles = css((_css = {
|
|
|
51
51
|
fontSize: 'var(--ak-renderer-base-font-size)',
|
|
52
52
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
53
53
|
lineHeight: '1.5rem',
|
|
54
|
-
color: "var(--ds-text, ".concat(N800, ")")
|
|
54
|
+
color: "var(--ds-text, ".concat(N800, ")"),
|
|
55
|
+
'--ak-editor--full-width-layout-width': "".concat(akEditorFullWidthLayoutWidth, "px")
|
|
55
56
|
}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_css, ".".concat(RendererCssClassName.DOCUMENT, "::after"), {
|
|
56
57
|
// we add a clearfix after ak-renderer-document in order to
|
|
57
58
|
// contain internal floats (such as media images that are "wrap-left")
|
|
@@ -60,7 +60,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
60
60
|
// we want to calculate all the table widths (which causes reflows) after the renderer has finished loading to mitigate performance impact
|
|
61
61
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
62
62
|
var packageName = "@atlaskit/renderer";
|
|
63
|
-
var packageVersion = "
|
|
63
|
+
var packageVersion = "0.0.0-development";
|
|
64
64
|
var setAsQueryContainerStyles = css({
|
|
65
65
|
containerName: 'ak-renderer-wrapper',
|
|
66
66
|
containerType: 'inline-size'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const calcBreakoutWidthCss: (layout: "full-width" | "wide" | "default") => "100%" | "min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--full-width-layout-width))" | "min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--breakout-wide-layout-width))";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const calcBreakoutWidthCss: (layout: "full-width" | "wide" | "default") => "100%" | "min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--full-width-layout-width))" | "min(var(--ak-editor--breakout-container-without-gutter-width), var(--ak-editor--breakout-wide-layout-width))";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "124.
|
|
3
|
+
"version": "124.16.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
55
55
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
56
56
|
"@atlaskit/react-ufo": "^4.15.0",
|
|
57
|
-
"@atlaskit/smart-card": "^43.
|
|
57
|
+
"@atlaskit/smart-card": "^43.8.0",
|
|
58
58
|
"@atlaskit/status": "^3.0.0",
|
|
59
59
|
"@atlaskit/task-decision": "^19.2.0",
|
|
60
60
|
"@atlaskit/theme": "^21.0.0",
|
|
61
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
61
|
+
"@atlaskit/tmp-editor-statsig": "^13.39.0",
|
|
62
62
|
"@atlaskit/tokens": "^8.0.0",
|
|
63
|
-
"@atlaskit/tooltip": "^20.
|
|
63
|
+
"@atlaskit/tooltip": "^20.10.0",
|
|
64
64
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
65
65
|
"@babel/runtime": "^7.0.0",
|
|
66
66
|
"@emotion/react": "^11.7.1",
|