@atlaskit/native-embeds-common 2.4.3 → 2.5.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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/native-embeds-common
2
2
 
3
+ ## 2.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`dc4692834dd9f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc4692834dd9f) -
14
+ Apply local Remix revision snapshots during pre-mint undo and redo without echoing local edits
15
+ under cc_maui_editing_experience.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 2.4.3
4
22
 
5
23
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- /* initial-placeholder.tsx generated by @compiled/babel-plugin v3.0.1 */
1
+ /* initial-placeholder.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "getRemixSlotValues", {
9
9
  return _remixSlotStore.getRemixSlotValues;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "getRemixSlotValuesForRevision", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _remixSlotStore.getRemixSlotValuesForRevision;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "getRemixVersionForRevision", {
13
19
  enumerable: true,
14
20
  get: function get() {
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v3.0.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -4,15 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.seedRemixSlotValue = exports.resetRemixSlotStore = exports.recordRemixSlotValues = exports.recordRemixRevisionVersion = exports.recordRemixRevisionEdit = exports.getRemixVersionForRevision = exports.getRemixSlotValues = void 0;
7
+ exports.seedRemixSlotValue = exports.resetRemixSlotStore = exports.recordRemixSlotValues = exports.recordRemixRevisionVersion = exports.recordRemixRevisionEdit = exports.getRemixVersionForRevision = exports.getRemixSlotValuesForRevision = exports.getRemixSlotValues = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
12
  /**
13
13
  * Session-bound store for MAUI (remix) editable-text values, keyed by embed,
14
- * revision, and version. Part of the MAUI reload-free undo/redo (gate
15
- * `platform_editor_maui_remix_app_id`).
14
+ * revision, and version. Part of the MAUI reload-free undo/redo
15
+ * (`cc_maui_editing_experience` experiment).
16
16
  *
17
17
  * Why this lives in `native-embeds-common` rather than the editor plugin: the
18
18
  * store is managed by the native-embeds editor plugin from edit and version
@@ -168,8 +168,33 @@ var getRemixSlotValues = exports.getRemixSlotValues = function getRemixSlotValue
168
168
  };
169
169
  });
170
170
  };
171
- var recordRemixRevisionVersion = exports.recordRemixRevisionVersion = function recordRemixRevisionVersion(localId, revisionId, versionId) {
171
+
172
+ /**
173
+ * Return the full slot snapshot for a local edit revision. Unlike a version
174
+ * snapshot, this is available immediately, before the server has minted and
175
+ * linked a durable version for the revision.
176
+ */
177
+ var getRemixSlotValuesForRevision = exports.getRemixSlotValuesForRevision = function getRemixSlotValuesForRevision(localId, revisionId) {
172
178
  var _slotValuesByRevision;
179
+ if (!localId || !revisionId) {
180
+ return undefined;
181
+ }
182
+ var snapshot = (_slotValuesByRevision = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision === void 0 ? void 0 : _slotValuesByRevision.get(revisionId);
183
+ if (!snapshot) {
184
+ return undefined;
185
+ }
186
+ return Object.entries(snapshot).map(function (_ref6) {
187
+ var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
188
+ slot = _ref7[0],
189
+ value = _ref7[1];
190
+ return {
191
+ slot: slot,
192
+ value: value
193
+ };
194
+ });
195
+ };
196
+ var recordRemixRevisionVersion = exports.recordRemixRevisionVersion = function recordRemixRevisionVersion(localId, revisionId, versionId) {
197
+ var _slotValuesByRevision2;
173
198
  if (!localId || !revisionId || !versionId) {
174
199
  return;
175
200
  }
@@ -179,7 +204,7 @@ var recordRemixRevisionVersion = exports.recordRemixRevisionVersion = function r
179
204
  versionByRevisionByEmbed.set(localId, versions);
180
205
  }
181
206
  versions.set(revisionId, versionId);
182
- var snapshot = (_slotValuesByRevision = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision === void 0 ? void 0 : _slotValuesByRevision.get(revisionId);
207
+ var snapshot = (_slotValuesByRevision2 = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision2 === void 0 ? void 0 : _slotValuesByRevision2.get(revisionId);
183
208
  if (snapshot) {
184
209
  getEmbedMap(localId).set(versionId, _objectSpread({}, snapshot));
185
210
  }
@@ -1,4 +1,4 @@
1
- /* initial-placeholder.tsx generated by @compiled/babel-plugin v3.0.1 */
1
+ /* initial-placeholder.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./initial-placeholder.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1 +1 @@
1
- export { getRemixSlotValues, getRemixVersionForRevision, recordRemixRevisionEdit, recordRemixSlotValues, recordRemixRevisionVersion, seedRemixSlotValue, resetRemixSlotStore } from '../utils/remix-slot-store';
1
+ export { getRemixSlotValues, getRemixSlotValuesForRevision, getRemixVersionForRevision, recordRemixRevisionEdit, recordRemixSlotValues, recordRemixRevisionVersion, seedRemixSlotValue, resetRemixSlotStore } from '../utils/remix-slot-store';
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v3.0.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback } from 'react';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Session-bound store for MAUI (remix) editable-text values, keyed by embed,
3
- * revision, and version. Part of the MAUI reload-free undo/redo (gate
4
- * `platform_editor_maui_remix_app_id`).
3
+ * revision, and version. Part of the MAUI reload-free undo/redo
4
+ * (`cc_maui_editing_experience` experiment).
5
5
  *
6
6
  * Why this lives in `native-embeds-common` rather than the editor plugin: the
7
7
  * store is managed by the native-embeds editor plugin from edit and version
@@ -176,8 +176,28 @@ export const getRemixSlotValues = (localId, versionId) => {
176
176
  value
177
177
  }));
178
178
  };
179
- export const recordRemixRevisionVersion = (localId, revisionId, versionId) => {
179
+
180
+ /**
181
+ * Return the full slot snapshot for a local edit revision. Unlike a version
182
+ * snapshot, this is available immediately, before the server has minted and
183
+ * linked a durable version for the revision.
184
+ */
185
+ export const getRemixSlotValuesForRevision = (localId, revisionId) => {
180
186
  var _slotValuesByRevision;
187
+ if (!localId || !revisionId) {
188
+ return undefined;
189
+ }
190
+ const snapshot = (_slotValuesByRevision = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision === void 0 ? void 0 : _slotValuesByRevision.get(revisionId);
191
+ if (!snapshot) {
192
+ return undefined;
193
+ }
194
+ return Object.entries(snapshot).map(([slot, value]) => ({
195
+ slot,
196
+ value
197
+ }));
198
+ };
199
+ export const recordRemixRevisionVersion = (localId, revisionId, versionId) => {
200
+ var _slotValuesByRevision2;
181
201
  if (!localId || !revisionId || !versionId) {
182
202
  return;
183
203
  }
@@ -187,7 +207,7 @@ export const recordRemixRevisionVersion = (localId, revisionId, versionId) => {
187
207
  versionByRevisionByEmbed.set(localId, versions);
188
208
  }
189
209
  versions.set(revisionId, versionId);
190
- const snapshot = (_slotValuesByRevision = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision === void 0 ? void 0 : _slotValuesByRevision.get(revisionId);
210
+ const snapshot = (_slotValuesByRevision2 = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision2 === void 0 ? void 0 : _slotValuesByRevision2.get(revisionId);
191
211
  if (snapshot) {
192
212
  getEmbedMap(localId).set(versionId, {
193
213
  ...snapshot
@@ -1,4 +1,4 @@
1
- /* initial-placeholder.tsx generated by @compiled/babel-plugin v3.0.1 */
1
+ /* initial-placeholder.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./initial-placeholder.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1 +1 @@
1
- export { getRemixSlotValues, getRemixVersionForRevision, recordRemixRevisionEdit, recordRemixSlotValues, recordRemixRevisionVersion, seedRemixSlotValue, resetRemixSlotStore } from '../utils/remix-slot-store';
1
+ export { getRemixSlotValues, getRemixSlotValuesForRevision, getRemixVersionForRevision, recordRemixRevisionEdit, recordRemixSlotValues, recordRemixRevisionVersion, seedRemixSlotValue, resetRemixSlotStore } from '../utils/remix-slot-store';
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v3.0.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v3.0.2 */
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback } from 'react';
@@ -4,8 +4,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  /**
6
6
  * Session-bound store for MAUI (remix) editable-text values, keyed by embed,
7
- * revision, and version. Part of the MAUI reload-free undo/redo (gate
8
- * `platform_editor_maui_remix_app_id`).
7
+ * revision, and version. Part of the MAUI reload-free undo/redo
8
+ * (`cc_maui_editing_experience` experiment).
9
9
  *
10
10
  * Why this lives in `native-embeds-common` rather than the editor plugin: the
11
11
  * store is managed by the native-embeds editor plugin from edit and version
@@ -161,8 +161,33 @@ export var getRemixSlotValues = function getRemixSlotValues(localId, versionId)
161
161
  };
162
162
  });
163
163
  };
164
- export var recordRemixRevisionVersion = function recordRemixRevisionVersion(localId, revisionId, versionId) {
164
+
165
+ /**
166
+ * Return the full slot snapshot for a local edit revision. Unlike a version
167
+ * snapshot, this is available immediately, before the server has minted and
168
+ * linked a durable version for the revision.
169
+ */
170
+ export var getRemixSlotValuesForRevision = function getRemixSlotValuesForRevision(localId, revisionId) {
165
171
  var _slotValuesByRevision;
172
+ if (!localId || !revisionId) {
173
+ return undefined;
174
+ }
175
+ var snapshot = (_slotValuesByRevision = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision === void 0 ? void 0 : _slotValuesByRevision.get(revisionId);
176
+ if (!snapshot) {
177
+ return undefined;
178
+ }
179
+ return Object.entries(snapshot).map(function (_ref6) {
180
+ var _ref7 = _slicedToArray(_ref6, 2),
181
+ slot = _ref7[0],
182
+ value = _ref7[1];
183
+ return {
184
+ slot: slot,
185
+ value: value
186
+ };
187
+ });
188
+ };
189
+ export var recordRemixRevisionVersion = function recordRemixRevisionVersion(localId, revisionId, versionId) {
190
+ var _slotValuesByRevision2;
166
191
  if (!localId || !revisionId || !versionId) {
167
192
  return;
168
193
  }
@@ -172,7 +197,7 @@ export var recordRemixRevisionVersion = function recordRemixRevisionVersion(loca
172
197
  versionByRevisionByEmbed.set(localId, versions);
173
198
  }
174
199
  versions.set(revisionId, versionId);
175
- var snapshot = (_slotValuesByRevision = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision === void 0 ? void 0 : _slotValuesByRevision.get(revisionId);
200
+ var snapshot = (_slotValuesByRevision2 = slotValuesByRevisionByEmbed.get(localId)) === null || _slotValuesByRevision2 === void 0 ? void 0 : _slotValuesByRevision2.get(revisionId);
176
201
  if (snapshot) {
177
202
  getEmbedMap(localId).set(versionId, _objectSpread({}, snapshot));
178
203
  }
@@ -1 +1 @@
1
- export { getRemixSlotValues, getRemixVersionForRevision, recordRemixRevisionEdit, recordRemixSlotValues, recordRemixRevisionVersion, seedRemixSlotValue, resetRemixSlotStore, type RemixSlotValue, } from '../utils/remix-slot-store';
1
+ export { getRemixSlotValues, getRemixSlotValuesForRevision, getRemixVersionForRevision, recordRemixRevisionEdit, recordRemixSlotValues, recordRemixRevisionVersion, seedRemixSlotValue, resetRemixSlotStore, type RemixSlotValue, } from '../utils/remix-slot-store';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Session-bound store for MAUI (remix) editable-text values, keyed by embed,
3
- * revision, and version. Part of the MAUI reload-free undo/redo (gate
4
- * `platform_editor_maui_remix_app_id`).
3
+ * revision, and version. Part of the MAUI reload-free undo/redo
4
+ * (`cc_maui_editing_experience` experiment).
5
5
  *
6
6
  * Why this lives in `native-embeds-common` rather than the editor plugin: the
7
7
  * store is managed by the native-embeds editor plugin from edit and version
@@ -59,6 +59,12 @@ export declare const seedRemixSlotValue: (localId: string, versionId: string, sl
59
59
  * edit, or a version created in another session).
60
60
  */
61
61
  export declare const getRemixSlotValues: (localId: string | undefined, versionId: string | undefined) => RemixSlotValue[] | undefined;
62
+ /**
63
+ * Return the full slot snapshot for a local edit revision. Unlike a version
64
+ * snapshot, this is available immediately, before the server has minted and
65
+ * linked a durable version for the revision.
66
+ */
67
+ export declare const getRemixSlotValuesForRevision: (localId: string | undefined, revisionId: string | undefined) => RemixSlotValue[] | undefined;
62
68
  export declare const recordRemixRevisionVersion: (localId: string, revisionId: string, versionId: string) => void;
63
69
  export declare const getRemixVersionForRevision: (localId: string | undefined, revisionId: string | undefined) => string | undefined;
64
70
  /** Test-only: clear the whole store. */
package/package.json CHANGED
@@ -17,13 +17,13 @@
17
17
  "atlaskit:src": "src/index.ts",
18
18
  "dependencies": {
19
19
  "@atlaskit/button": "^25.3.0",
20
- "@atlaskit/editor-common": "^122.6.0",
20
+ "@atlaskit/editor-common": "^122.11.0",
21
21
  "@atlaskit/editor-plugin-local-id": "^16.0.0",
22
22
  "@atlaskit/editor-prosemirror": "^8.0.0",
23
23
  "@atlaskit/heading": "^7.2.0",
24
24
  "@atlaskit/icon": "^37.7.0",
25
25
  "@atlaskit/primitives": "^22.5.0",
26
- "@atlaskit/tokens": "^17.0.0",
26
+ "@atlaskit/tokens": "^18.0.0",
27
27
  "@atlassian/afm-i18n-platform-native-embeds-native-embeds-common": "1.7.0",
28
28
  "@babel/runtime": "^7.0.0",
29
29
  "@compiled/react": "^1.0.2",
@@ -44,7 +44,7 @@
44
44
  "react-intl": "^7.0.0"
45
45
  },
46
46
  "name": "@atlaskit/native-embeds-common",
47
- "version": "2.4.3",
47
+ "version": "2.5.1",
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",