@atlaskit/native-embeds-common 1.1.0 → 1.1.1
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 +23 -0
- package/dist/cjs/embed-depth.js +24 -0
- package/dist/cjs/utils/constants.js +35 -1
- package/dist/cjs/utils/utils.js +21 -5
- package/dist/es2019/embed-depth.js +1 -0
- package/dist/es2019/utils/constants.js +34 -0
- package/dist/es2019/utils/utils.js +21 -5
- package/dist/esm/embed-depth.js +1 -0
- package/dist/esm/utils/constants.js +34 -0
- package/dist/esm/utils/utils.js +21 -5
- package/dist/types/embed-depth.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +18 -0
- package/dist/types/utils/types.d.ts +2 -0
- package/dist/types-ts4.5/embed-depth.d.ts +1 -0
- package/dist/types-ts4.5/utils/constants.d.ts +18 -0
- package/dist/types-ts4.5/utils/types.d.ts +2 -0
- package/embed-depth/package.json +17 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/native-embeds-common
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9e964a88958bd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9e964a88958bd) -
|
|
8
|
+
Fix resize overlay placeholder height and aspect ratio calculation to use the stored `aspectRatio`
|
|
9
|
+
node parameter (set from originalWidth/originalHeight during card-to-native-embed conversion)
|
|
10
|
+
rather than relying solely on live DOM measurements. This ensures resize handles and the overlay
|
|
11
|
+
placeholder reflect the correct proportions from the very first selection, before a resize has
|
|
12
|
+
occurred. Applies to both `EmbedResizeOverlay` and `ResizableNativeEmbedLegacy`.
|
|
13
|
+
|
|
14
|
+
Add `aspectRatio` to `NativeEmbedParameters` macroParams type so that `getParameters` and
|
|
15
|
+
`setParameters` correctly serialize and deserialize the stored width-to-height ratio. This enables
|
|
16
|
+
native embed containers to derive their height from the original embed dimensions without
|
|
17
|
+
requiring a resize interaction.
|
|
18
|
+
|
|
19
|
+
Fix native embed containers incorrectly defaulting to a 1:1 or 1200/600 aspect ratio on initial
|
|
20
|
+
render when `aspectRatio` (originalWidth/originalHeight) is stored in the node parameters. The
|
|
21
|
+
container now derives the correct height from the stored `aspectRatio` on the very first render,
|
|
22
|
+
before any resize interaction occurs.
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 1.1.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EMBED_DEPTH_QUERY_PARAM", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _constants.EMBED_DEPTH_QUERY_PARAM;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "MAX_EMBED_DEPTH", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _constants.MAX_EMBED_DEPTH;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getCurrentEmbedDepth", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _constants.getCurrentEmbedDepth;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _constants = require("./utils/constants");
|
|
@@ -3,7 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.NATIVE_EMBED_PARAMETER_DEFAULTS = exports.EDITOR_TOOLBAR_HANDLER_KEYS = exports.DEFAULT_ALIGNMENT = exports.BUILTIN_TOOLBAR_KEYS = exports.ALIGNMENT_VALUES = void 0;
|
|
6
|
+
exports.getCurrentEmbedDepth = exports.NATIVE_EMBED_PARAMETER_DEFAULTS = exports.MAX_EMBED_DEPTH = exports.EMBED_DEPTH_QUERY_PARAM = exports.EDITOR_TOOLBAR_HANDLER_KEYS = exports.DEFAULT_ALIGNMENT = exports.BUILTIN_TOOLBAR_KEYS = exports.ALIGNMENT_VALUES = void 0;
|
|
7
|
+
// ─── Embed depth constants ──────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* URL query-parameter key used to track the current embedding depth.
|
|
11
|
+
* Each nested native-embed iframe increments this value by 1.
|
|
12
|
+
*/
|
|
13
|
+
var EMBED_DEPTH_QUERY_PARAM = exports.EMBED_DEPTH_QUERY_PARAM = 'nativeEmbedDepth';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Maximum allowed embedding depth. When `getCurrentEmbedDepth()` returns a
|
|
17
|
+
* value **≥** this limit the extension renderer should display a fallback
|
|
18
|
+
* instead of another iframe to prevent infinite recursion.
|
|
19
|
+
*/
|
|
20
|
+
var MAX_EMBED_DEPTH = exports.MAX_EMBED_DEPTH = 2;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Read the current embedding depth from `window.location.search`.
|
|
24
|
+
*
|
|
25
|
+
* Returns `0` when the parameter is absent or cannot be parsed as a
|
|
26
|
+
* non-negative integer, which is the expected case for top-level pages.
|
|
27
|
+
*/
|
|
28
|
+
var getCurrentEmbedDepth = exports.getCurrentEmbedDepth = function getCurrentEmbedDepth() {
|
|
29
|
+
if (typeof window === 'undefined') {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
var raw = new URLSearchParams(window.location.search).get(EMBED_DEPTH_QUERY_PARAM);
|
|
33
|
+
if (raw === null) {
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
var parsed = Number(raw);
|
|
37
|
+
return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : 0;
|
|
38
|
+
};
|
|
39
|
+
|
|
7
40
|
// Alignment constants
|
|
8
41
|
var ALIGNMENT_VALUES = exports.ALIGNMENT_VALUES = ['left', 'center', 'right', 'wrap-left', 'wrap-right'];
|
|
9
42
|
var DEFAULT_ALIGNMENT = exports.DEFAULT_ALIGNMENT = 'center';
|
|
@@ -13,6 +46,7 @@ var NATIVE_EMBED_PARAMETER_DEFAULTS = exports.NATIVE_EMBED_PARAMETER_DEFAULTS =
|
|
|
13
46
|
alignment: DEFAULT_ALIGNMENT,
|
|
14
47
|
displayText: undefined,
|
|
15
48
|
height: 600,
|
|
49
|
+
aspectRatio: 1,
|
|
16
50
|
width: undefined
|
|
17
51
|
};
|
|
18
52
|
|
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -30,8 +30,24 @@ var PARAMETER_VALIDATORS = {
|
|
|
30
30
|
return _constants.ALIGNMENT_VALUES.includes(value);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Explicitly declares the intended primitive type for each parameter key.
|
|
36
|
+
* This is necessary for keys whose default value is `undefined` (e.g. `url`, `width`),
|
|
37
|
+
* because `typeof undefined === 'undefined'` gives no type information for deserialization.
|
|
38
|
+
*/
|
|
39
|
+
var PARAMETER_TYPES = {
|
|
40
|
+
alignment: 'string',
|
|
41
|
+
alwaysShowTitle: 'boolean',
|
|
42
|
+
aspectRatio: 'number',
|
|
43
|
+
displayText: 'string',
|
|
44
|
+
height: 'number',
|
|
45
|
+
url: 'string',
|
|
46
|
+
width: 'number'
|
|
47
|
+
};
|
|
48
|
+
var parseFromDefault = function parseFromDefault(defaultValue, value, explicitType) {
|
|
49
|
+
var resolvedType = explicitType !== null && explicitType !== void 0 ? explicitType : (0, _typeof2.default)(defaultValue);
|
|
50
|
+
if (resolvedType === 'boolean') {
|
|
35
51
|
if (typeof value === 'boolean') {
|
|
36
52
|
return value;
|
|
37
53
|
}
|
|
@@ -43,12 +59,12 @@ var parseFromDefault = function parseFromDefault(defaultValue, value) {
|
|
|
43
59
|
}
|
|
44
60
|
return undefined;
|
|
45
61
|
}
|
|
46
|
-
if (
|
|
62
|
+
if (resolvedType === 'number') {
|
|
47
63
|
var parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : NaN;
|
|
48
64
|
return Number.isFinite(parsed) ? parsed : undefined;
|
|
49
65
|
}
|
|
50
66
|
|
|
51
|
-
// String-like values
|
|
67
|
+
// String-like values
|
|
52
68
|
return typeof value === 'string' ? value : undefined;
|
|
53
69
|
};
|
|
54
70
|
var serializeParameterValue = function serializeParameterValue(key, value) {
|
|
@@ -59,7 +75,7 @@ var serializeParameterValue = function serializeParameterValue(key, value) {
|
|
|
59
75
|
return value === undefined ? undefined : String(value);
|
|
60
76
|
};
|
|
61
77
|
var deserializeParameterValue = function deserializeParameterValue(key, value) {
|
|
62
|
-
var parsedValue = parseFromDefault(_constants.NATIVE_EMBED_PARAMETER_DEFAULTS[key], value);
|
|
78
|
+
var parsedValue = parseFromDefault(_constants.NATIVE_EMBED_PARAMETER_DEFAULTS[key], value, PARAMETER_TYPES[key]);
|
|
63
79
|
var validator = PARAMETER_VALIDATORS[key];
|
|
64
80
|
if (parsedValue === undefined) {
|
|
65
81
|
return undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EMBED_DEPTH_QUERY_PARAM, getCurrentEmbedDepth, MAX_EMBED_DEPTH } from './utils/constants';
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
// ─── Embed depth constants ──────────────────────────────────────────────────
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* URL query-parameter key used to track the current embedding depth.
|
|
5
|
+
* Each nested native-embed iframe increments this value by 1.
|
|
6
|
+
*/
|
|
7
|
+
export const EMBED_DEPTH_QUERY_PARAM = 'nativeEmbedDepth';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Maximum allowed embedding depth. When `getCurrentEmbedDepth()` returns a
|
|
11
|
+
* value **≥** this limit the extension renderer should display a fallback
|
|
12
|
+
* instead of another iframe to prevent infinite recursion.
|
|
13
|
+
*/
|
|
14
|
+
export const MAX_EMBED_DEPTH = 2;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Read the current embedding depth from `window.location.search`.
|
|
18
|
+
*
|
|
19
|
+
* Returns `0` when the parameter is absent or cannot be parsed as a
|
|
20
|
+
* non-negative integer, which is the expected case for top-level pages.
|
|
21
|
+
*/
|
|
22
|
+
export const getCurrentEmbedDepth = () => {
|
|
23
|
+
if (typeof window === 'undefined') {
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
const raw = new URLSearchParams(window.location.search).get(EMBED_DEPTH_QUERY_PARAM);
|
|
27
|
+
if (raw === null) {
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
const parsed = Number(raw);
|
|
31
|
+
return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : 0;
|
|
32
|
+
};
|
|
33
|
+
|
|
1
34
|
// Alignment constants
|
|
2
35
|
export const ALIGNMENT_VALUES = ['left', 'center', 'right', 'wrap-left', 'wrap-right'];
|
|
3
36
|
export const DEFAULT_ALIGNMENT = 'center';
|
|
@@ -7,6 +40,7 @@ export const NATIVE_EMBED_PARAMETER_DEFAULTS = {
|
|
|
7
40
|
alignment: DEFAULT_ALIGNMENT,
|
|
8
41
|
displayText: undefined,
|
|
9
42
|
height: 600,
|
|
43
|
+
aspectRatio: 1,
|
|
10
44
|
width: undefined
|
|
11
45
|
};
|
|
12
46
|
|
|
@@ -14,8 +14,24 @@ const unwrapMacroParamValue = macroParamValue => {
|
|
|
14
14
|
const PARAMETER_VALIDATORS = {
|
|
15
15
|
alignment: value => ALIGNMENT_VALUES.includes(value)
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Explicitly declares the intended primitive type for each parameter key.
|
|
20
|
+
* This is necessary for keys whose default value is `undefined` (e.g. `url`, `width`),
|
|
21
|
+
* because `typeof undefined === 'undefined'` gives no type information for deserialization.
|
|
22
|
+
*/
|
|
23
|
+
const PARAMETER_TYPES = {
|
|
24
|
+
alignment: 'string',
|
|
25
|
+
alwaysShowTitle: 'boolean',
|
|
26
|
+
aspectRatio: 'number',
|
|
27
|
+
displayText: 'string',
|
|
28
|
+
height: 'number',
|
|
29
|
+
url: 'string',
|
|
30
|
+
width: 'number'
|
|
31
|
+
};
|
|
32
|
+
const parseFromDefault = (defaultValue, value, explicitType) => {
|
|
33
|
+
const resolvedType = explicitType !== null && explicitType !== void 0 ? explicitType : typeof defaultValue;
|
|
34
|
+
if (resolvedType === 'boolean') {
|
|
19
35
|
if (typeof value === 'boolean') {
|
|
20
36
|
return value;
|
|
21
37
|
}
|
|
@@ -27,12 +43,12 @@ const parseFromDefault = (defaultValue, value) => {
|
|
|
27
43
|
}
|
|
28
44
|
return undefined;
|
|
29
45
|
}
|
|
30
|
-
if (
|
|
46
|
+
if (resolvedType === 'number') {
|
|
31
47
|
const parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : NaN;
|
|
32
48
|
return Number.isFinite(parsed) ? parsed : undefined;
|
|
33
49
|
}
|
|
34
50
|
|
|
35
|
-
// String-like values
|
|
51
|
+
// String-like values
|
|
36
52
|
return typeof value === 'string' ? value : undefined;
|
|
37
53
|
};
|
|
38
54
|
const serializeParameterValue = (key, value) => {
|
|
@@ -43,7 +59,7 @@ const serializeParameterValue = (key, value) => {
|
|
|
43
59
|
return value === undefined ? undefined : String(value);
|
|
44
60
|
};
|
|
45
61
|
const deserializeParameterValue = (key, value) => {
|
|
46
|
-
const parsedValue = parseFromDefault(NATIVE_EMBED_PARAMETER_DEFAULTS[key], value);
|
|
62
|
+
const parsedValue = parseFromDefault(NATIVE_EMBED_PARAMETER_DEFAULTS[key], value, PARAMETER_TYPES[key]);
|
|
47
63
|
const validator = PARAMETER_VALIDATORS[key];
|
|
48
64
|
if (parsedValue === undefined) {
|
|
49
65
|
return undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EMBED_DEPTH_QUERY_PARAM, getCurrentEmbedDepth, MAX_EMBED_DEPTH } from './utils/constants';
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
// ─── Embed depth constants ──────────────────────────────────────────────────
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* URL query-parameter key used to track the current embedding depth.
|
|
5
|
+
* Each nested native-embed iframe increments this value by 1.
|
|
6
|
+
*/
|
|
7
|
+
export var EMBED_DEPTH_QUERY_PARAM = 'nativeEmbedDepth';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Maximum allowed embedding depth. When `getCurrentEmbedDepth()` returns a
|
|
11
|
+
* value **≥** this limit the extension renderer should display a fallback
|
|
12
|
+
* instead of another iframe to prevent infinite recursion.
|
|
13
|
+
*/
|
|
14
|
+
export var MAX_EMBED_DEPTH = 2;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Read the current embedding depth from `window.location.search`.
|
|
18
|
+
*
|
|
19
|
+
* Returns `0` when the parameter is absent or cannot be parsed as a
|
|
20
|
+
* non-negative integer, which is the expected case for top-level pages.
|
|
21
|
+
*/
|
|
22
|
+
export var getCurrentEmbedDepth = function getCurrentEmbedDepth() {
|
|
23
|
+
if (typeof window === 'undefined') {
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
var raw = new URLSearchParams(window.location.search).get(EMBED_DEPTH_QUERY_PARAM);
|
|
27
|
+
if (raw === null) {
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
var parsed = Number(raw);
|
|
31
|
+
return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : 0;
|
|
32
|
+
};
|
|
33
|
+
|
|
1
34
|
// Alignment constants
|
|
2
35
|
export var ALIGNMENT_VALUES = ['left', 'center', 'right', 'wrap-left', 'wrap-right'];
|
|
3
36
|
export var DEFAULT_ALIGNMENT = 'center';
|
|
@@ -7,6 +40,7 @@ export var NATIVE_EMBED_PARAMETER_DEFAULTS = {
|
|
|
7
40
|
alignment: DEFAULT_ALIGNMENT,
|
|
8
41
|
displayText: undefined,
|
|
9
42
|
height: 600,
|
|
43
|
+
aspectRatio: 1,
|
|
10
44
|
width: undefined
|
|
11
45
|
};
|
|
12
46
|
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -21,8 +21,24 @@ var PARAMETER_VALIDATORS = {
|
|
|
21
21
|
return ALIGNMENT_VALUES.includes(value);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Explicitly declares the intended primitive type for each parameter key.
|
|
27
|
+
* This is necessary for keys whose default value is `undefined` (e.g. `url`, `width`),
|
|
28
|
+
* because `typeof undefined === 'undefined'` gives no type information for deserialization.
|
|
29
|
+
*/
|
|
30
|
+
var PARAMETER_TYPES = {
|
|
31
|
+
alignment: 'string',
|
|
32
|
+
alwaysShowTitle: 'boolean',
|
|
33
|
+
aspectRatio: 'number',
|
|
34
|
+
displayText: 'string',
|
|
35
|
+
height: 'number',
|
|
36
|
+
url: 'string',
|
|
37
|
+
width: 'number'
|
|
38
|
+
};
|
|
39
|
+
var parseFromDefault = function parseFromDefault(defaultValue, value, explicitType) {
|
|
40
|
+
var resolvedType = explicitType !== null && explicitType !== void 0 ? explicitType : _typeof(defaultValue);
|
|
41
|
+
if (resolvedType === 'boolean') {
|
|
26
42
|
if (typeof value === 'boolean') {
|
|
27
43
|
return value;
|
|
28
44
|
}
|
|
@@ -34,12 +50,12 @@ var parseFromDefault = function parseFromDefault(defaultValue, value) {
|
|
|
34
50
|
}
|
|
35
51
|
return undefined;
|
|
36
52
|
}
|
|
37
|
-
if (
|
|
53
|
+
if (resolvedType === 'number') {
|
|
38
54
|
var parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : NaN;
|
|
39
55
|
return Number.isFinite(parsed) ? parsed : undefined;
|
|
40
56
|
}
|
|
41
57
|
|
|
42
|
-
// String-like values
|
|
58
|
+
// String-like values
|
|
43
59
|
return typeof value === 'string' ? value : undefined;
|
|
44
60
|
};
|
|
45
61
|
var serializeParameterValue = function serializeParameterValue(key, value) {
|
|
@@ -50,7 +66,7 @@ var serializeParameterValue = function serializeParameterValue(key, value) {
|
|
|
50
66
|
return value === undefined ? undefined : String(value);
|
|
51
67
|
};
|
|
52
68
|
var deserializeParameterValue = function deserializeParameterValue(key, value) {
|
|
53
|
-
var parsedValue = parseFromDefault(NATIVE_EMBED_PARAMETER_DEFAULTS[key], value);
|
|
69
|
+
var parsedValue = parseFromDefault(NATIVE_EMBED_PARAMETER_DEFAULTS[key], value, PARAMETER_TYPES[key]);
|
|
54
70
|
var validator = PARAMETER_VALIDATORS[key];
|
|
55
71
|
if (parsedValue === undefined) {
|
|
56
72
|
return undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EMBED_DEPTH_QUERY_PARAM, getCurrentEmbedDepth, MAX_EMBED_DEPTH } from './utils/constants';
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import type { NativeEmbedParameterValues } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* URL query-parameter key used to track the current embedding depth.
|
|
4
|
+
* Each nested native-embed iframe increments this value by 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EMBED_DEPTH_QUERY_PARAM: "nativeEmbedDepth";
|
|
7
|
+
/**
|
|
8
|
+
* Maximum allowed embedding depth. When `getCurrentEmbedDepth()` returns a
|
|
9
|
+
* value **≥** this limit the extension renderer should display a fallback
|
|
10
|
+
* instead of another iframe to prevent infinite recursion.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MAX_EMBED_DEPTH = 2;
|
|
13
|
+
/**
|
|
14
|
+
* Read the current embedding depth from `window.location.search`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `0` when the parameter is absent or cannot be parsed as a
|
|
17
|
+
* non-negative integer, which is the expected case for top-level pages.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getCurrentEmbedDepth: () => number;
|
|
2
20
|
export declare const ALIGNMENT_VALUES: readonly ["left", "center", "right", "wrap-left", "wrap-right"];
|
|
3
21
|
export declare const DEFAULT_ALIGNMENT: "center";
|
|
4
22
|
export declare const NATIVE_EMBED_PARAMETER_DEFAULTS: NativeEmbedParameterValues;
|
|
@@ -7,6 +7,7 @@ export type NativeEmbedAppearance = 'url' | 'inline' | 'block' | 'embed';
|
|
|
7
7
|
export type NativeEmbedParameterValues = {
|
|
8
8
|
alignment: AlignmentValue;
|
|
9
9
|
alwaysShowTitle: boolean;
|
|
10
|
+
aspectRatio: number;
|
|
10
11
|
displayText?: string;
|
|
11
12
|
height: number;
|
|
12
13
|
url?: string;
|
|
@@ -19,6 +20,7 @@ export type NativeEmbedParameters = {
|
|
|
19
20
|
macroParams?: {
|
|
20
21
|
alignment?: NativeEmbedParameterValue;
|
|
21
22
|
alwaysShowTitle?: NativeEmbedParameterValue;
|
|
23
|
+
aspectRatio?: NativeEmbedParameterValue;
|
|
22
24
|
displayText?: NativeEmbedParameterValue;
|
|
23
25
|
height?: NativeEmbedParameterValue;
|
|
24
26
|
url?: NativeEmbedParameterValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EMBED_DEPTH_QUERY_PARAM, getCurrentEmbedDepth, MAX_EMBED_DEPTH } from './utils/constants';
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import type { NativeEmbedParameterValues } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* URL query-parameter key used to track the current embedding depth.
|
|
4
|
+
* Each nested native-embed iframe increments this value by 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EMBED_DEPTH_QUERY_PARAM: "nativeEmbedDepth";
|
|
7
|
+
/**
|
|
8
|
+
* Maximum allowed embedding depth. When `getCurrentEmbedDepth()` returns a
|
|
9
|
+
* value **≥** this limit the extension renderer should display a fallback
|
|
10
|
+
* instead of another iframe to prevent infinite recursion.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MAX_EMBED_DEPTH = 2;
|
|
13
|
+
/**
|
|
14
|
+
* Read the current embedding depth from `window.location.search`.
|
|
15
|
+
*
|
|
16
|
+
* Returns `0` when the parameter is absent or cannot be parsed as a
|
|
17
|
+
* non-negative integer, which is the expected case for top-level pages.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getCurrentEmbedDepth: () => number;
|
|
2
20
|
export declare const ALIGNMENT_VALUES: readonly [
|
|
3
21
|
"left",
|
|
4
22
|
"center",
|
|
@@ -7,6 +7,7 @@ export type NativeEmbedAppearance = 'url' | 'inline' | 'block' | 'embed';
|
|
|
7
7
|
export type NativeEmbedParameterValues = {
|
|
8
8
|
alignment: AlignmentValue;
|
|
9
9
|
alwaysShowTitle: boolean;
|
|
10
|
+
aspectRatio: number;
|
|
10
11
|
displayText?: string;
|
|
11
12
|
height: number;
|
|
12
13
|
url?: string;
|
|
@@ -19,6 +20,7 @@ export type NativeEmbedParameters = {
|
|
|
19
20
|
macroParams?: {
|
|
20
21
|
alignment?: NativeEmbedParameterValue;
|
|
21
22
|
alwaysShowTitle?: NativeEmbedParameterValue;
|
|
23
|
+
aspectRatio?: NativeEmbedParameterValue;
|
|
22
24
|
displayText?: NativeEmbedParameterValue;
|
|
23
25
|
height?: NativeEmbedParameterValue;
|
|
24
26
|
url?: NativeEmbedParameterValue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/native-embeds-common/embed-depth",
|
|
3
|
+
"main": "../dist/cjs/embed-depth.js",
|
|
4
|
+
"module": "../dist/esm/embed-depth.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/embed-depth.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/embed-depth.d.ts",
|
|
10
|
+
"typesVersions": {
|
|
11
|
+
">=4.5 <5.9": {
|
|
12
|
+
"*": [
|
|
13
|
+
"../dist/types-ts4.5/embed-depth.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"atlaskit:src": "src/index.ts",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/button": "^23.11.0",
|
|
28
|
-
"@atlaskit/editor-common": "^114.
|
|
28
|
+
"@atlaskit/editor-common": "^114.13.0",
|
|
29
29
|
"@atlaskit/editor-plugin-local-id": "^8.0.0",
|
|
30
30
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
31
31
|
"@atlaskit/heading": "^5.4.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
"name": "@atlaskit/native-embeds-common",
|
|
89
|
-
"version": "1.1.
|
|
89
|
+
"version": "1.1.1",
|
|
90
90
|
"description": "A shared package for native embeds to be used across experiences and plugin",
|
|
91
91
|
"author": "Atlassian Pty Ltd",
|
|
92
92
|
"license": "Apache-2.0",
|