@atlaskit/native-embeds-common 2.0.4 → 2.0.6

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/native-embeds-common
2
2
 
3
+ ## 2.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`07226ab3fad50`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/07226ab3fad50) -
8
+ [ux] Reserve native embed first-paint layout
9
+ - Updated dependencies
10
+
11
+ ## 2.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`56d5d8d23bed9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/56d5d8d23bed9) -
16
+ Bump native embeds i18n packages to include French and Portuguese (Brazil) translations.
17
+
3
18
  ## 2.0.4
4
19
 
5
20
  ### Patch Changes
package/compass.yml ADDED
@@ -0,0 +1,38 @@
1
+ configVersion: 1
2
+ id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/e056e542-a3ce-4443-88d3-ad37895abc0c
3
+ name: '@atlaskit/native-embeds-common'
4
+ ownerId: ari:cloud:identity::team/ebf6925a-b776-4f99-92b6-6f529449f814 # Eng - Create - Native Content Types - Team Silky (Stacey Douglas)
5
+ labels:
6
+ - platform-code
7
+ - platform-afm
8
+ typeId: OTHER
9
+ fields:
10
+ tier: 4
11
+ lifecycle: Active
12
+ isMonorepoProject: true
13
+ links:
14
+ - name: Root Repository
15
+ type: REPOSITORY
16
+ url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
17
+ - name: Slack Channel
18
+ type: CHAT_CHANNEL
19
+ url: https://atlassian.enterprise.slack.com/archives/C05BWLL499U # #native-content-types-eng
20
+ - name: Native Embeds Common
21
+ type: REPOSITORY
22
+ url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/native-embeds/native-embeds-common
23
+ customFields:
24
+ - name: Department
25
+ type: text
26
+ value: Eng - Confluence Content Experience
27
+ - name: Technical Owner
28
+ type: user
29
+ value: ari:cloud:identity::user/5c75da8392ac9063b7e86a09 # Corne Alant
30
+ - name: Required Reviewers Opt In
31
+ type: boolean
32
+ value: true
33
+ - name: Reviewer Selection Mechanism
34
+ type: text
35
+ value: random(2)
36
+ - name: Required Reviewer Approvals
37
+ type: number
38
+ value: 1
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveNativeEmbedInitialLayout = exports.NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = void 0;
7
+ var _utils = require("../utils/utils");
8
+ var NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = exports.NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = '760 / 600';
9
+ /**
10
+ * Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
11
+ *
12
+ * This intentionally depends only on ADF parameters and optional manifest-like metadata so it can be
13
+ * reused by React, DOMOutputSpec, SSR, and renderer placeholders without importing iframe UI code.
14
+ */
15
+ var resolveNativeEmbedInitialLayout = exports.resolveNativeEmbedInitialLayout = function resolveNativeEmbedInitialLayout(_ref) {
16
+ var _manifest$parameterDe, _manifest$parameterDe2, _manifest$parameterDe3, _manifest$lockResizeA, _manifest$uiConfig$sh, _manifest$uiConfig;
17
+ var manifest = _ref.manifest,
18
+ parameters = _ref.parameters,
19
+ placeholderId = _ref.placeholderId;
20
+ var _getParameters = (0, _utils.getParameters)(parameters),
21
+ alignment = _getParameters.alignment,
22
+ aspectRatio = _getParameters.aspectRatio,
23
+ height = _getParameters.height,
24
+ width = _getParameters.width;
25
+ var effectiveWidth = 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;
26
+
27
+ // `getParameters` always supplies default values, so inspect raw macroParams to distinguish
28
+ // stored dimensions from package defaults. This prevents the default aspectRatio from affecting
29
+ // older embeds that never persisted original dimensions.
30
+ var macroParams = parameters === null || parameters === void 0 ? void 0 : parameters.macroParams;
31
+ var heightExplicitlyStored = !!(macroParams !== null && macroParams !== void 0 && macroParams.height);
32
+ var aspectRatioExplicitlyStored = !!(macroParams !== null && macroParams !== void 0 && macroParams.aspectRatio);
33
+ var effectiveHeightRaw = heightExplicitlyStored ? height : (_manifest$parameterDe2 = manifest === null || manifest === void 0 || (_manifest$parameterDe3 = manifest.parameterDefaults) === null || _manifest$parameterDe3 === void 0 ? void 0 : _manifest$parameterDe3.height) !== null && _manifest$parameterDe2 !== void 0 ? _manifest$parameterDe2 : null;
34
+ var effectiveHeight = aspectRatioExplicitlyStored && aspectRatio != null && aspectRatio > 0 && effectiveWidth != null && !heightExplicitlyStored ? Math.round(effectiveWidth / aspectRatio) : effectiveHeightRaw !== null && effectiveHeightRaw !== void 0 ? effectiveHeightRaw : height;
35
+ var lockAspectRatio = typeof (manifest === null || manifest === void 0 ? void 0 : manifest.lockResizeAspectRatio) === 'function' ? manifest.lockResizeAspectRatio() : (_manifest$lockResizeA = manifest === null || manifest === void 0 ? void 0 : manifest.lockResizeAspectRatio) !== null && _manifest$lockResizeA !== void 0 ? _manifest$lockResizeA : true;
36
+ return {
37
+ alignment: alignment,
38
+ effectiveHeight: effectiveHeight,
39
+ effectiveWidth: effectiveWidth,
40
+ hasEmbedBorder: (_manifest$uiConfig$sh = manifest === null || manifest === void 0 || (_manifest$uiConfig = manifest.uiConfig) === null || _manifest$uiConfig === void 0 ? void 0 : _manifest$uiConfig.showBorder) !== null && _manifest$uiConfig$sh !== void 0 ? _manifest$uiConfig$sh : true,
41
+ lockAspectRatio: lockAspectRatio,
42
+ placeholderId: placeholderId
43
+ };
44
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _fr = _interopRequireDefault(require("@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/fr"));
9
+ /* prettier-ignore */
10
+ /**
11
+ * NOTE:
12
+ *
13
+ * This file is automatically generated by Traduki 2.0.
14
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
15
+ */
16
+ var _default = exports.default = _fr.default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _pt_BR = _interopRequireDefault(require("@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/pt_BR"));
9
+ /* prettier-ignore */
10
+ /**
11
+ * NOTE:
12
+ *
13
+ * This file is automatically generated by Traduki 2.0.
14
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
15
+ */
16
+ var _default = exports.default = _pt_BR.default;
@@ -0,0 +1,40 @@
1
+ import { getParameters } from '../utils/utils';
2
+ export const NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = '760 / 600';
3
+ /**
4
+ * Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
5
+ *
6
+ * This intentionally depends only on ADF parameters and optional manifest-like metadata so it can be
7
+ * reused by React, DOMOutputSpec, SSR, and renderer placeholders without importing iframe UI code.
8
+ */
9
+ export const resolveNativeEmbedInitialLayout = ({
10
+ manifest,
11
+ parameters,
12
+ placeholderId
13
+ }) => {
14
+ var _manifest$parameterDe, _manifest$parameterDe2, _manifest$parameterDe3, _manifest$lockResizeA, _manifest$uiConfig$sh, _manifest$uiConfig;
15
+ const {
16
+ alignment,
17
+ aspectRatio,
18
+ height,
19
+ width
20
+ } = getParameters(parameters);
21
+ const effectiveWidth = 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;
22
+
23
+ // `getParameters` always supplies default values, so inspect raw macroParams to distinguish
24
+ // stored dimensions from package defaults. This prevents the default aspectRatio from affecting
25
+ // older embeds that never persisted original dimensions.
26
+ const macroParams = parameters === null || parameters === void 0 ? void 0 : parameters.macroParams;
27
+ const heightExplicitlyStored = !!(macroParams !== null && macroParams !== void 0 && macroParams.height);
28
+ const aspectRatioExplicitlyStored = !!(macroParams !== null && macroParams !== void 0 && macroParams.aspectRatio);
29
+ const effectiveHeightRaw = heightExplicitlyStored ? height : (_manifest$parameterDe2 = manifest === null || manifest === void 0 ? void 0 : (_manifest$parameterDe3 = manifest.parameterDefaults) === null || _manifest$parameterDe3 === void 0 ? void 0 : _manifest$parameterDe3.height) !== null && _manifest$parameterDe2 !== void 0 ? _manifest$parameterDe2 : null;
30
+ const effectiveHeight = aspectRatioExplicitlyStored && aspectRatio != null && aspectRatio > 0 && effectiveWidth != null && !heightExplicitlyStored ? Math.round(effectiveWidth / aspectRatio) : effectiveHeightRaw !== null && effectiveHeightRaw !== void 0 ? effectiveHeightRaw : height;
31
+ const lockAspectRatio = typeof (manifest === null || manifest === void 0 ? void 0 : manifest.lockResizeAspectRatio) === 'function' ? manifest.lockResizeAspectRatio() : (_manifest$lockResizeA = manifest === null || manifest === void 0 ? void 0 : manifest.lockResizeAspectRatio) !== null && _manifest$lockResizeA !== void 0 ? _manifest$lockResizeA : true;
32
+ return {
33
+ alignment,
34
+ effectiveHeight,
35
+ effectiveWidth,
36
+ hasEmbedBorder: (_manifest$uiConfig$sh = manifest === null || manifest === void 0 ? void 0 : (_manifest$uiConfig = manifest.uiConfig) === null || _manifest$uiConfig === void 0 ? void 0 : _manifest$uiConfig.showBorder) !== null && _manifest$uiConfig$sh !== void 0 ? _manifest$uiConfig$sh : true,
37
+ lockAspectRatio,
38
+ placeholderId
39
+ };
40
+ };
@@ -0,0 +1,10 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+
9
+ import translations from '@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/fr';
10
+ export default translations;
@@ -0,0 +1,10 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+
9
+ import translations from '@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/pt_BR';
10
+ export default translations;
@@ -1,6 +1,5 @@
1
1
  // Re-export constants
2
2
  export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS, NATIVE_EMBED_PARAMETER_DEFAULTS } from './utils/constants';
3
-
4
3
  // Re-export types
5
4
 
6
5
  // Plugin actions types
@@ -0,0 +1,38 @@
1
+ import { getParameters } from '../utils/utils';
2
+ export var NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = '760 / 600';
3
+ /**
4
+ * Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
5
+ *
6
+ * This intentionally depends only on ADF parameters and optional manifest-like metadata so it can be
7
+ * reused by React, DOMOutputSpec, SSR, and renderer placeholders without importing iframe UI code.
8
+ */
9
+ export var resolveNativeEmbedInitialLayout = function resolveNativeEmbedInitialLayout(_ref) {
10
+ var _manifest$parameterDe, _manifest$parameterDe2, _manifest$parameterDe3, _manifest$lockResizeA, _manifest$uiConfig$sh, _manifest$uiConfig;
11
+ var manifest = _ref.manifest,
12
+ parameters = _ref.parameters,
13
+ placeholderId = _ref.placeholderId;
14
+ var _getParameters = getParameters(parameters),
15
+ alignment = _getParameters.alignment,
16
+ aspectRatio = _getParameters.aspectRatio,
17
+ height = _getParameters.height,
18
+ width = _getParameters.width;
19
+ var effectiveWidth = 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;
20
+
21
+ // `getParameters` always supplies default values, so inspect raw macroParams to distinguish
22
+ // stored dimensions from package defaults. This prevents the default aspectRatio from affecting
23
+ // older embeds that never persisted original dimensions.
24
+ var macroParams = parameters === null || parameters === void 0 ? void 0 : parameters.macroParams;
25
+ var heightExplicitlyStored = !!(macroParams !== null && macroParams !== void 0 && macroParams.height);
26
+ var aspectRatioExplicitlyStored = !!(macroParams !== null && macroParams !== void 0 && macroParams.aspectRatio);
27
+ var effectiveHeightRaw = heightExplicitlyStored ? height : (_manifest$parameterDe2 = manifest === null || manifest === void 0 || (_manifest$parameterDe3 = manifest.parameterDefaults) === null || _manifest$parameterDe3 === void 0 ? void 0 : _manifest$parameterDe3.height) !== null && _manifest$parameterDe2 !== void 0 ? _manifest$parameterDe2 : null;
28
+ var effectiveHeight = aspectRatioExplicitlyStored && aspectRatio != null && aspectRatio > 0 && effectiveWidth != null && !heightExplicitlyStored ? Math.round(effectiveWidth / aspectRatio) : effectiveHeightRaw !== null && effectiveHeightRaw !== void 0 ? effectiveHeightRaw : height;
29
+ var lockAspectRatio = typeof (manifest === null || manifest === void 0 ? void 0 : manifest.lockResizeAspectRatio) === 'function' ? manifest.lockResizeAspectRatio() : (_manifest$lockResizeA = manifest === null || manifest === void 0 ? void 0 : manifest.lockResizeAspectRatio) !== null && _manifest$lockResizeA !== void 0 ? _manifest$lockResizeA : true;
30
+ return {
31
+ alignment: alignment,
32
+ effectiveHeight: effectiveHeight,
33
+ effectiveWidth: effectiveWidth,
34
+ hasEmbedBorder: (_manifest$uiConfig$sh = manifest === null || manifest === void 0 || (_manifest$uiConfig = manifest.uiConfig) === null || _manifest$uiConfig === void 0 ? void 0 : _manifest$uiConfig.showBorder) !== null && _manifest$uiConfig$sh !== void 0 ? _manifest$uiConfig$sh : true,
35
+ lockAspectRatio: lockAspectRatio,
36
+ placeholderId: placeholderId
37
+ };
38
+ };
@@ -0,0 +1,10 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+
9
+ import translations from '@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/fr';
10
+ export default translations;
@@ -0,0 +1,10 @@
1
+ /* prettier-ignore */
2
+ /**
3
+ * NOTE:
4
+ *
5
+ * This file is automatically generated by Traduki 2.0.
6
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
7
+ */
8
+
9
+ import translations from '@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/pt_BR';
10
+ export default translations;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // Re-export constants
2
2
  export { ALIGNMENT_VALUES, DEFAULT_ALIGNMENT, BUILTIN_TOOLBAR_KEYS, EDITOR_TOOLBAR_HANDLER_KEYS, NATIVE_EMBED_PARAMETER_DEFAULTS } from './utils/constants';
3
-
4
3
  // Re-export types
5
4
 
6
5
  // Plugin actions types
@@ -0,0 +1,32 @@
1
+ import type { AlignmentValue, NativeEmbedParameters } from '../utils/types';
2
+ export declare const NATIVE_EMBED_INITIAL_LAYOUT_FALLBACK_ASPECT_RATIO = "760 / 600";
3
+ export type NativeEmbedInitialLayoutManifest = {
4
+ lockResizeAspectRatio?: boolean | (() => boolean);
5
+ parameterDefaults?: {
6
+ height?: number;
7
+ width?: number;
8
+ };
9
+ uiConfig?: {
10
+ showBorder?: boolean;
11
+ };
12
+ };
13
+ export type NativeEmbedInitialLayout = {
14
+ alignment: AlignmentValue;
15
+ effectiveHeight: number;
16
+ effectiveWidth: number | undefined;
17
+ hasEmbedBorder: boolean;
18
+ lockAspectRatio: boolean;
19
+ placeholderId?: string;
20
+ };
21
+ export type ResolveNativeEmbedInitialLayoutInput = {
22
+ manifest?: NativeEmbedInitialLayoutManifest;
23
+ parameters?: NativeEmbedParameters;
24
+ placeholderId?: string;
25
+ };
26
+ /**
27
+ * Resolve the dimensions needed to reserve native embed layout before the full iframe UI is ready.
28
+ *
29
+ * This intentionally depends only on ADF parameters and optional manifest-like metadata so it can be
30
+ * reused by React, DOMOutputSpec, SSR, and renderer placeholders without importing iframe UI code.
31
+ */
32
+ export declare const resolveNativeEmbedInitialLayout: ({ manifest, parameters, placeholderId, }: ResolveNativeEmbedInitialLayoutInput) => NativeEmbedInitialLayout;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * This file is automatically generated by Traduki 2.0.
5
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
+ */
7
+ import translations from '@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/fr';
8
+ export default translations;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * NOTE:
3
+ *
4
+ * This file is automatically generated by Traduki 2.0.
5
+ * DO NOT CHANGE IT BY HAND or your changes will be lost.
6
+ */
7
+ import translations from '@atlassian/afm-i18n-platform-native-embeds-native-embeds-common/i18n/pt_BR';
8
+ export default translations;
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/native-embeds-common/initial-layout",
3
+ "main": "../dist/cjs/entry-points/initial-layout.js",
4
+ "module": "../dist/esm/entry-points/initial-layout.js",
5
+ "module:es2019": "../dist/es2019/entry-points/initial-layout.js",
6
+ "sideEffects": [
7
+ "*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/entry-points/initial-layout.d.ts"
10
+ }
package/package.json CHANGED
@@ -17,14 +17,14 @@
17
17
  "atlaskit:src": "src/index.ts",
18
18
  "dependencies": {
19
19
  "@atlaskit/button": "^24.3.0",
20
- "@atlaskit/editor-common": "^116.17.0",
20
+ "@atlaskit/editor-common": "^116.24.0",
21
21
  "@atlaskit/editor-plugin-local-id": "^10.1.0",
22
22
  "@atlaskit/editor-prosemirror": "^8.0.0",
23
- "@atlaskit/heading": "^6.1.0",
24
- "@atlaskit/icon": "^36.1.0",
25
- "@atlaskit/primitives": "^20.2.0",
26
- "@atlaskit/tokens": "^15.2.0",
27
- "@atlassian/afm-i18n-platform-native-embeds-native-embeds-common": "1.5.0",
23
+ "@atlaskit/heading": "^6.2.0",
24
+ "@atlaskit/icon": "^36.2.0",
25
+ "@atlaskit/primitives": "^20.5.0",
26
+ "@atlaskit/tokens": "^15.5.0",
27
+ "@atlassian/afm-i18n-platform-native-embeds-native-embeds-common": "1.7.0",
28
28
  "@babel/runtime": "^7.0.0",
29
29
  "@compiled/react": "^0.20.0"
30
30
  },
@@ -80,7 +80,7 @@
80
80
  }
81
81
  },
82
82
  "name": "@atlaskit/native-embeds-common",
83
- "version": "2.0.4",
83
+ "version": "2.0.6",
84
84
  "description": "A shared package for native embeds to be used across experiences and plugin",
85
85
  "author": "Atlassian Pty Ltd",
86
86
  "license": "Apache-2.0",