@atlaskit/native-embeds-common 2.6.5 → 2.7.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 +14 -0
- package/dist/cjs/entry-points/initial-layout.js +17 -7
- package/dist/cjs/entry-points/initial-placeholder.js +10 -1
- package/dist/cjs/entry-points/native-embed-styles.js +24 -1
- package/dist/es2019/entry-points/initial-layout.js +13 -2
- package/dist/es2019/entry-points/initial-placeholder.js +10 -2
- package/dist/es2019/entry-points/native-embed-styles.js +23 -0
- package/dist/esm/entry-points/initial-layout.js +16 -6
- package/dist/esm/entry-points/initial-placeholder.js +11 -2
- package/dist/esm/entry-points/native-embed-styles.js +23 -0
- package/dist/types/entry-points/initial-layout.d.ts +5 -0
- package/dist/types/entry-points/initial-placeholder.d.ts +2 -1
- package/dist/types/entry-points/native-embed-styles.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/native-embeds-common
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`446290e38a4af`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/446290e38a4af) -
|
|
8
|
+
Fix unsized inline MAUI embeds shrinking to the iframe's intrinsic width in renderer and editor.
|
|
9
|
+
Add optional manifest identity to the shared initial-layout contract so MAUI loading placeholders
|
|
10
|
+
receive the same placement styles when their sizing manifest is available. Gate inline placement
|
|
11
|
+
behind `cc_maui_inline_embed_width_fix`, evaluating only unsized inline MAUI embeds and keeping
|
|
12
|
+
Control and Test styling isolated through per-embed metadata.
|
|
13
|
+
|
|
14
|
+
Export a shared effective-width resolver from the existing initial-layout entry point so loading
|
|
15
|
+
exposure eligibility and placeholder dimensions use the same stored/default width precedence.
|
|
16
|
+
|
|
3
17
|
## 2.6.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -3,26 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.resolveNativeEmbedInitialLayout = exports.NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = void 0;
|
|
6
|
+
exports.resolveNativeEmbedInitialLayout = exports.resolveNativeEmbedEffectiveWidth = exports.NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = void 0;
|
|
7
7
|
var _utils = require("../utils/utils");
|
|
8
8
|
var NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = exports.NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = '760 / 600';
|
|
9
|
+
var resolveNativeEmbedEffectiveWidth = exports.resolveNativeEmbedEffectiveWidth = function resolveNativeEmbedEffectiveWidth(_ref) {
|
|
10
|
+
var _manifest$parameterDe;
|
|
11
|
+
var manifest = _ref.manifest,
|
|
12
|
+
width = _ref.width;
|
|
13
|
+
return width !== null && width !== void 0 ? width : manifest === null || manifest === void 0 || (_manifest$parameterDe = manifest.parameterDefaults) === null || _manifest$parameterDe === void 0 ? void 0 : _manifest$parameterDe.width;
|
|
14
|
+
};
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
|
|
11
18
|
*
|
|
12
19
|
* This intentionally depends only on ADF parameters and optional manifest-like metadata so it can be
|
|
13
20
|
* reused by React, DOMOutputSpec, SSR, and renderer placeholders without importing iframe UI code.
|
|
14
21
|
*/
|
|
15
|
-
var resolveNativeEmbedInitialLayout = exports.resolveNativeEmbedInitialLayout = function resolveNativeEmbedInitialLayout(
|
|
16
|
-
var _manifest$
|
|
17
|
-
var manifest =
|
|
18
|
-
parameters =
|
|
19
|
-
placeholderId =
|
|
22
|
+
var resolveNativeEmbedInitialLayout = exports.resolveNativeEmbedInitialLayout = function resolveNativeEmbedInitialLayout(_ref2) {
|
|
23
|
+
var _manifest$parameterDe2, _manifest$parameterDe3, _manifest$lockResizeA, _manifest$uiConfig$sh, _manifest$uiConfig;
|
|
24
|
+
var manifest = _ref2.manifest,
|
|
25
|
+
parameters = _ref2.parameters,
|
|
26
|
+
placeholderId = _ref2.placeholderId;
|
|
20
27
|
var _getParameters = (0, _utils.getParameters)(parameters),
|
|
21
28
|
alignment = _getParameters.alignment,
|
|
22
29
|
aspectRatio = _getParameters.aspectRatio,
|
|
23
30
|
height = _getParameters.height,
|
|
24
31
|
width = _getParameters.width;
|
|
25
|
-
var effectiveWidth =
|
|
32
|
+
var effectiveWidth = resolveNativeEmbedEffectiveWidth({
|
|
33
|
+
manifest: manifest,
|
|
34
|
+
width: width
|
|
35
|
+
});
|
|
26
36
|
|
|
27
37
|
// `getParameters` always supplies default values, so inspect raw macroParams to distinguish
|
|
28
38
|
// stored dimensions from package defaults. This prevents the default aspectRatio from affecting
|
|
@@ -58,6 +58,8 @@ var NativeEmbedInitialPlaceholder = exports.NativeEmbedInitialPlaceholder = func
|
|
|
58
58
|
manifest = _ref2.manifest,
|
|
59
59
|
parameters = _ref2.parameters,
|
|
60
60
|
placeholderId = _ref2.placeholderId,
|
|
61
|
+
_ref2$shouldFillInlin = _ref2.shouldFillInlineWidth,
|
|
62
|
+
shouldFillInlineWidth = _ref2$shouldFillInlin === void 0 ? false : _ref2$shouldFillInlin,
|
|
61
63
|
testId = _ref2.testId;
|
|
62
64
|
var _resolveNativeEmbedIn = (0, _initialLayout.resolveNativeEmbedInitialLayout)({
|
|
63
65
|
manifest: manifest,
|
|
@@ -70,14 +72,21 @@ var NativeEmbedInitialPlaceholder = exports.NativeEmbedInitialPlaceholder = func
|
|
|
70
72
|
hasEmbedBorder = _resolveNativeEmbedIn.hasEmbedBorder,
|
|
71
73
|
lockAspectRatio = _resolveNativeEmbedIn.lockAspectRatio,
|
|
72
74
|
resolvedPlaceholderId = _resolveNativeEmbedIn.placeholderId;
|
|
75
|
+
var fillInlineWidth = shouldFillInlineWidth && (manifest === null || manifest === void 0 ? void 0 : manifest.id) === 'maui' && effectiveWidth === undefined;
|
|
73
76
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
74
|
-
"data-native-embed-alignment": alignment
|
|
77
|
+
"data-native-embed-alignment": alignment
|
|
78
|
+
// Only MAUI needs inline sizing; preserve other experiences' existing placeholder styles.
|
|
79
|
+
,
|
|
80
|
+
"data-native-embed-experience": (manifest === null || manifest === void 0 ? void 0 : manifest.id) === 'maui' ? 'maui' : undefined,
|
|
81
|
+
"data-native-embed-inline-width": fillInlineWidth ? 'true' : undefined,
|
|
75
82
|
"data-native-embed-first-paint-placeholder": firstPaint ? 'true' : undefined,
|
|
76
83
|
"data-native-embed-initial-placeholder": "true",
|
|
77
84
|
"data-native-embed-width": effectiveWidth,
|
|
78
85
|
"data-native-embed-show-border": hasEmbedBorder ? 'true' : 'false'
|
|
79
86
|
}, /*#__PURE__*/_react.default.createElement(_react2.Global, {
|
|
80
87
|
styles: _nativeEmbedStyles.nativeEmbedAlignmentStyles
|
|
88
|
+
}), fillInlineWidth && /*#__PURE__*/_react.default.createElement(_react2.Global, {
|
|
89
|
+
styles: _nativeEmbedStyles.nativeEmbedInlineMauiWidthStyles
|
|
81
90
|
}), /*#__PURE__*/_react.default.createElement(NativeEmbedInitialPlaceholderFrame, {
|
|
82
91
|
effectiveHeight: effectiveHeight,
|
|
83
92
|
effectiveWidth: effectiveWidth,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.nativeEmbedAlignmentStyles = void 0;
|
|
6
|
+
exports.nativeEmbedInlineMauiWidthStyles = exports.nativeEmbedAlignmentStyles = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
/**
|
|
9
9
|
* Injected by the extension UI via Global; also exported for consumers who inject styles elsewhere.
|
|
@@ -223,4 +223,27 @@ var nativeEmbedAlignmentStyles = exports.nativeEmbedAlignmentStyles = (0, _react
|
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
+
// Kept separate so baseline and unidentified placeholders never install treatment-only CSS.
|
|
227
|
+
var nativeEmbedInlineMauiWidthStyles = exports.nativeEmbedInlineMauiWidthStyles = (0, _react.css)({
|
|
228
|
+
// Inline MAUI embeds otherwise shrink-wrap the iframe's intrinsic 300px width. Match only the
|
|
229
|
+
// owning wrapper, and leave persisted or manifest-derived widths and other experiences alone.
|
|
230
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Target the immediate inline renderer wrapper through its own unsized MAUI child
|
|
231
|
+
'.inline-extension-renderer:has(> [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width]))': {
|
|
232
|
+
width: '100%',
|
|
233
|
+
marginLeft: 0,
|
|
234
|
+
marginRight: 0
|
|
235
|
+
},
|
|
236
|
+
// The editor has an extra inline-flex container. Both its outer span and native flex child
|
|
237
|
+
// must fill the paragraph; expanding only the span leaves the iframe at its intrinsic width.
|
|
238
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Target only the editor wrapper that directly owns an eligible unsized MAUI embed
|
|
239
|
+
'.inline-extension:has(> .extension-container.inline > [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width]))': {
|
|
240
|
+
width: '100%'
|
|
241
|
+
},
|
|
242
|
+
// SSR HTML parsing can separate the outer span from this container, so match its own child.
|
|
243
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Size only the inline editor container's eligible unsized MAUI flex child
|
|
244
|
+
'.extension-container.inline > [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width])': {
|
|
245
|
+
width: '100%'
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
226
249
|
/* eslint-enable @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-important-styles */
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { getParameters } from '../utils/utils';
|
|
2
2
|
export const NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = '760 / 600';
|
|
3
|
+
export const resolveNativeEmbedEffectiveWidth = ({
|
|
4
|
+
manifest,
|
|
5
|
+
width
|
|
6
|
+
}) => {
|
|
7
|
+
var _manifest$parameterDe;
|
|
8
|
+
return width !== null && width !== void 0 ? width : manifest === null || manifest === void 0 ? void 0 : (_manifest$parameterDe = manifest.parameterDefaults) === null || _manifest$parameterDe === void 0 ? void 0 : _manifest$parameterDe.width;
|
|
9
|
+
};
|
|
10
|
+
|
|
3
11
|
/**
|
|
4
12
|
* Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
|
|
5
13
|
*
|
|
@@ -11,14 +19,17 @@ export const resolveNativeEmbedInitialLayout = ({
|
|
|
11
19
|
parameters,
|
|
12
20
|
placeholderId
|
|
13
21
|
}) => {
|
|
14
|
-
var _manifest$
|
|
22
|
+
var _manifest$parameterDe2, _manifest$parameterDe3, _manifest$lockResizeA, _manifest$uiConfig$sh, _manifest$uiConfig;
|
|
15
23
|
const {
|
|
16
24
|
alignment,
|
|
17
25
|
aspectRatio,
|
|
18
26
|
height,
|
|
19
27
|
width
|
|
20
28
|
} = getParameters(parameters);
|
|
21
|
-
const effectiveWidth =
|
|
29
|
+
const effectiveWidth = resolveNativeEmbedEffectiveWidth({
|
|
30
|
+
manifest,
|
|
31
|
+
width
|
|
32
|
+
});
|
|
22
33
|
|
|
23
34
|
// `getParameters` always supplies default values, so inspect raw macroParams to distinguish
|
|
24
35
|
// stored dimensions from package defaults. This prevents the default aspectRatio from affecting
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Native embed placement must style renderer/editor ancestor wrappers that this component does not own.
|
|
7
7
|
import { Global } from '@emotion/react';
|
|
8
8
|
import { NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO, resolveNativeEmbedInitialLayout } from './initial-layout';
|
|
9
|
-
import { nativeEmbedAlignmentStyles } from './native-embed-styles';
|
|
9
|
+
import { nativeEmbedAlignmentStyles, nativeEmbedInlineMauiWidthStyles } from './native-embed-styles';
|
|
10
10
|
export { resolveNativeEmbedInitialLayout };
|
|
11
11
|
const placeholderFrameStyles = null;
|
|
12
12
|
const borderedPlaceholderFrameStyles = null;
|
|
@@ -44,6 +44,7 @@ export const NativeEmbedInitialPlaceholder = ({
|
|
|
44
44
|
manifest,
|
|
45
45
|
parameters,
|
|
46
46
|
placeholderId,
|
|
47
|
+
shouldFillInlineWidth = false,
|
|
47
48
|
testId
|
|
48
49
|
}) => {
|
|
49
50
|
const {
|
|
@@ -58,14 +59,21 @@ export const NativeEmbedInitialPlaceholder = ({
|
|
|
58
59
|
parameters,
|
|
59
60
|
placeholderId
|
|
60
61
|
});
|
|
62
|
+
const fillInlineWidth = shouldFillInlineWidth && (manifest === null || manifest === void 0 ? void 0 : manifest.id) === 'maui' && effectiveWidth === undefined;
|
|
61
63
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
"data-native-embed-alignment": alignment
|
|
64
|
+
"data-native-embed-alignment": alignment
|
|
65
|
+
// Only MAUI needs inline sizing; preserve other experiences' existing placeholder styles.
|
|
66
|
+
,
|
|
67
|
+
"data-native-embed-experience": (manifest === null || manifest === void 0 ? void 0 : manifest.id) === 'maui' ? 'maui' : undefined,
|
|
68
|
+
"data-native-embed-inline-width": fillInlineWidth ? 'true' : undefined,
|
|
63
69
|
"data-native-embed-first-paint-placeholder": firstPaint ? 'true' : undefined,
|
|
64
70
|
"data-native-embed-initial-placeholder": "true",
|
|
65
71
|
"data-native-embed-width": effectiveWidth,
|
|
66
72
|
"data-native-embed-show-border": hasEmbedBorder ? 'true' : 'false'
|
|
67
73
|
}, /*#__PURE__*/React.createElement(Global, {
|
|
68
74
|
styles: nativeEmbedAlignmentStyles
|
|
75
|
+
}), fillInlineWidth && /*#__PURE__*/React.createElement(Global, {
|
|
76
|
+
styles: nativeEmbedInlineMauiWidthStyles
|
|
69
77
|
}), /*#__PURE__*/React.createElement(NativeEmbedInitialPlaceholderFrame, {
|
|
70
78
|
effectiveHeight: effectiveHeight,
|
|
71
79
|
effectiveWidth: effectiveWidth,
|
|
@@ -216,4 +216,27 @@ export const nativeEmbedAlignmentStyles = css({
|
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
|
|
219
|
+
// Kept separate so baseline and unidentified placeholders never install treatment-only CSS.
|
|
220
|
+
export const nativeEmbedInlineMauiWidthStyles = css({
|
|
221
|
+
// Inline MAUI embeds otherwise shrink-wrap the iframe's intrinsic 300px width. Match only the
|
|
222
|
+
// owning wrapper, and leave persisted or manifest-derived widths and other experiences alone.
|
|
223
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Target the immediate inline renderer wrapper through its own unsized MAUI child
|
|
224
|
+
'.inline-extension-renderer:has(> [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width]))': {
|
|
225
|
+
width: '100%',
|
|
226
|
+
marginLeft: 0,
|
|
227
|
+
marginRight: 0
|
|
228
|
+
},
|
|
229
|
+
// The editor has an extra inline-flex container. Both its outer span and native flex child
|
|
230
|
+
// must fill the paragraph; expanding only the span leaves the iframe at its intrinsic width.
|
|
231
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Target only the editor wrapper that directly owns an eligible unsized MAUI embed
|
|
232
|
+
'.inline-extension:has(> .extension-container.inline > [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width]))': {
|
|
233
|
+
width: '100%'
|
|
234
|
+
},
|
|
235
|
+
// SSR HTML parsing can separate the outer span from this container, so match its own child.
|
|
236
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Size only the inline editor container's eligible unsized MAUI flex child
|
|
237
|
+
'.extension-container.inline > [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width])': {
|
|
238
|
+
width: '100%'
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
219
242
|
/* eslint-enable @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-important-styles */
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { getParameters } from '../utils/utils';
|
|
2
2
|
export var NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = '760 / 600';
|
|
3
|
+
export var resolveNativeEmbedEffectiveWidth = function resolveNativeEmbedEffectiveWidth(_ref) {
|
|
4
|
+
var _manifest$parameterDe;
|
|
5
|
+
var manifest = _ref.manifest,
|
|
6
|
+
width = _ref.width;
|
|
7
|
+
return width !== null && width !== void 0 ? width : manifest === null || manifest === void 0 || (_manifest$parameterDe = manifest.parameterDefaults) === null || _manifest$parameterDe === void 0 ? void 0 : _manifest$parameterDe.width;
|
|
8
|
+
};
|
|
9
|
+
|
|
3
10
|
/**
|
|
4
11
|
* Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
|
|
5
12
|
*
|
|
6
13
|
* This intentionally depends only on ADF parameters and optional manifest-like metadata so it can be
|
|
7
14
|
* reused by React, DOMOutputSpec, SSR, and renderer placeholders without importing iframe UI code.
|
|
8
15
|
*/
|
|
9
|
-
export var resolveNativeEmbedInitialLayout = function resolveNativeEmbedInitialLayout(
|
|
10
|
-
var _manifest$
|
|
11
|
-
var manifest =
|
|
12
|
-
parameters =
|
|
13
|
-
placeholderId =
|
|
16
|
+
export var resolveNativeEmbedInitialLayout = function resolveNativeEmbedInitialLayout(_ref2) {
|
|
17
|
+
var _manifest$parameterDe2, _manifest$parameterDe3, _manifest$lockResizeA, _manifest$uiConfig$sh, _manifest$uiConfig;
|
|
18
|
+
var manifest = _ref2.manifest,
|
|
19
|
+
parameters = _ref2.parameters,
|
|
20
|
+
placeholderId = _ref2.placeholderId;
|
|
14
21
|
var _getParameters = getParameters(parameters),
|
|
15
22
|
alignment = _getParameters.alignment,
|
|
16
23
|
aspectRatio = _getParameters.aspectRatio,
|
|
17
24
|
height = _getParameters.height,
|
|
18
25
|
width = _getParameters.width;
|
|
19
|
-
var effectiveWidth =
|
|
26
|
+
var effectiveWidth = resolveNativeEmbedEffectiveWidth({
|
|
27
|
+
manifest: manifest,
|
|
28
|
+
width: width
|
|
29
|
+
});
|
|
20
30
|
|
|
21
31
|
// `getParameters` always supplies default values, so inspect raw macroParams to distinguish
|
|
22
32
|
// stored dimensions from package defaults. This prevents the default aspectRatio from affecting
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Native embed placement must style renderer/editor ancestor wrappers that this component does not own.
|
|
7
7
|
import { Global } from '@emotion/react';
|
|
8
8
|
import { NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO, resolveNativeEmbedInitialLayout } from './initial-layout';
|
|
9
|
-
import { nativeEmbedAlignmentStyles } from './native-embed-styles';
|
|
9
|
+
import { nativeEmbedAlignmentStyles, nativeEmbedInlineMauiWidthStyles } from './native-embed-styles';
|
|
10
10
|
export { resolveNativeEmbedInitialLayout };
|
|
11
11
|
var placeholderFrameStyles = null;
|
|
12
12
|
var borderedPlaceholderFrameStyles = null;
|
|
@@ -46,6 +46,8 @@ export var NativeEmbedInitialPlaceholder = function NativeEmbedInitialPlaceholde
|
|
|
46
46
|
manifest = _ref2.manifest,
|
|
47
47
|
parameters = _ref2.parameters,
|
|
48
48
|
placeholderId = _ref2.placeholderId,
|
|
49
|
+
_ref2$shouldFillInlin = _ref2.shouldFillInlineWidth,
|
|
50
|
+
shouldFillInlineWidth = _ref2$shouldFillInlin === void 0 ? false : _ref2$shouldFillInlin,
|
|
49
51
|
testId = _ref2.testId;
|
|
50
52
|
var _resolveNativeEmbedIn = resolveNativeEmbedInitialLayout({
|
|
51
53
|
manifest: manifest,
|
|
@@ -58,14 +60,21 @@ export var NativeEmbedInitialPlaceholder = function NativeEmbedInitialPlaceholde
|
|
|
58
60
|
hasEmbedBorder = _resolveNativeEmbedIn.hasEmbedBorder,
|
|
59
61
|
lockAspectRatio = _resolveNativeEmbedIn.lockAspectRatio,
|
|
60
62
|
resolvedPlaceholderId = _resolveNativeEmbedIn.placeholderId;
|
|
63
|
+
var fillInlineWidth = shouldFillInlineWidth && (manifest === null || manifest === void 0 ? void 0 : manifest.id) === 'maui' && effectiveWidth === undefined;
|
|
61
64
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
"data-native-embed-alignment": alignment
|
|
65
|
+
"data-native-embed-alignment": alignment
|
|
66
|
+
// Only MAUI needs inline sizing; preserve other experiences' existing placeholder styles.
|
|
67
|
+
,
|
|
68
|
+
"data-native-embed-experience": (manifest === null || manifest === void 0 ? void 0 : manifest.id) === 'maui' ? 'maui' : undefined,
|
|
69
|
+
"data-native-embed-inline-width": fillInlineWidth ? 'true' : undefined,
|
|
63
70
|
"data-native-embed-first-paint-placeholder": firstPaint ? 'true' : undefined,
|
|
64
71
|
"data-native-embed-initial-placeholder": "true",
|
|
65
72
|
"data-native-embed-width": effectiveWidth,
|
|
66
73
|
"data-native-embed-show-border": hasEmbedBorder ? 'true' : 'false'
|
|
67
74
|
}, /*#__PURE__*/React.createElement(Global, {
|
|
68
75
|
styles: nativeEmbedAlignmentStyles
|
|
76
|
+
}), fillInlineWidth && /*#__PURE__*/React.createElement(Global, {
|
|
77
|
+
styles: nativeEmbedInlineMauiWidthStyles
|
|
69
78
|
}), /*#__PURE__*/React.createElement(NativeEmbedInitialPlaceholderFrame, {
|
|
70
79
|
effectiveHeight: effectiveHeight,
|
|
71
80
|
effectiveWidth: effectiveWidth,
|
|
@@ -216,4 +216,27 @@ export var nativeEmbedAlignmentStyles = css({
|
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
|
|
219
|
+
// Kept separate so baseline and unidentified placeholders never install treatment-only CSS.
|
|
220
|
+
export var nativeEmbedInlineMauiWidthStyles = css({
|
|
221
|
+
// Inline MAUI embeds otherwise shrink-wrap the iframe's intrinsic 300px width. Match only the
|
|
222
|
+
// owning wrapper, and leave persisted or manifest-derived widths and other experiences alone.
|
|
223
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Target the immediate inline renderer wrapper through its own unsized MAUI child
|
|
224
|
+
'.inline-extension-renderer:has(> [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width]))': {
|
|
225
|
+
width: '100%',
|
|
226
|
+
marginLeft: 0,
|
|
227
|
+
marginRight: 0
|
|
228
|
+
},
|
|
229
|
+
// The editor has an extra inline-flex container. Both its outer span and native flex child
|
|
230
|
+
// must fill the paragraph; expanding only the span leaves the iframe at its intrinsic width.
|
|
231
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Target only the editor wrapper that directly owns an eligible unsized MAUI embed
|
|
232
|
+
'.inline-extension:has(> .extension-container.inline > [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width]))': {
|
|
233
|
+
width: '100%'
|
|
234
|
+
},
|
|
235
|
+
// SSR HTML parsing can separate the outer span from this container, so match its own child.
|
|
236
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Size only the inline editor container's eligible unsized MAUI flex child
|
|
237
|
+
'.extension-container.inline > [data-native-embed-experience="maui"][data-native-embed-inline-width="true"]:not([data-native-embed-width])': {
|
|
238
|
+
width: '100%'
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
219
242
|
/* eslint-enable @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-important-styles */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AlignmentValue, NativeEmbedParameters } from '../utils/types';
|
|
2
2
|
export declare const NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = "760 / 600";
|
|
3
3
|
export type NativeEmbedInitialLayoutManifest = {
|
|
4
|
+
id?: string;
|
|
4
5
|
lockResizeAspectRatio?: boolean | (() => boolean);
|
|
5
6
|
parameterDefaults?: {
|
|
6
7
|
height?: number;
|
|
@@ -23,6 +24,10 @@ export type ResolveNativeEmbedInitialLayoutInput = {
|
|
|
23
24
|
parameters?: NativeEmbedParameters;
|
|
24
25
|
placeholderId?: string;
|
|
25
26
|
};
|
|
27
|
+
export declare const resolveNativeEmbedEffectiveWidth: ({ manifest, width, }: {
|
|
28
|
+
manifest?: NativeEmbedInitialLayoutManifest;
|
|
29
|
+
width?: number;
|
|
30
|
+
}) => number | undefined;
|
|
26
31
|
/**
|
|
27
32
|
* Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
|
|
28
33
|
*
|
|
@@ -13,6 +13,7 @@ export type NativeEmbedInitialPlaceholderFrameProps = Pick<NativeEmbedInitialLay
|
|
|
13
13
|
export declare const NativeEmbedInitialPlaceholderFrame: ({ effectiveHeight, effectiveWidth, hasEmbedBorder, lockAspectRatio, placeholderId, testId, }: NativeEmbedInitialPlaceholderFrameProps) => React.JSX.Element;
|
|
14
14
|
export type NativeEmbedInitialPlaceholderProps = ResolveNativeEmbedInitialLayoutInput & {
|
|
15
15
|
firstPaint?: boolean;
|
|
16
|
+
shouldFillInlineWidth?: boolean;
|
|
16
17
|
testId?: string;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
@@ -20,4 +21,4 @@ export type NativeEmbedInitialPlaceholderProps = ResolveNativeEmbedInitialLayout
|
|
|
20
21
|
* and Confluence SSR paths. The data attributes let the same ancestor placement styles apply before
|
|
21
22
|
* the full native embed UI is available.
|
|
22
23
|
*/
|
|
23
|
-
export declare const NativeEmbedInitialPlaceholder: ({ firstPaint, manifest, parameters, placeholderId, testId, }: NativeEmbedInitialPlaceholderProps) => React.JSX.Element;
|
|
24
|
+
export declare const NativeEmbedInitialPlaceholder: ({ firstPaint, manifest, parameters, placeholderId, shouldFillInlineWidth, testId, }: NativeEmbedInitialPlaceholderProps) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"atlaskit:src": "src/index.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@atlaskit/button": "^25.4.0",
|
|
20
|
-
"@atlaskit/editor-common": "^130.
|
|
20
|
+
"@atlaskit/editor-common": "^130.2.0",
|
|
21
21
|
"@atlaskit/editor-plugin-local-id": "^24.0.0",
|
|
22
22
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
23
23
|
"@atlaskit/heading": "^8.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-intl": "^7.0.0"
|
|
45
45
|
},
|
|
46
46
|
"name": "@atlaskit/native-embeds-common",
|
|
47
|
-
"version": "2.
|
|
47
|
+
"version": "2.7.0",
|
|
48
48
|
"description": "A shared package for native embeds to be used across experiences and plugin",
|
|
49
49
|
"author": "Atlassian Pty Ltd",
|
|
50
50
|
"license": "Apache-2.0",
|