@jumoo/usync 17.6.1-prerelease.19 → 17.6.1-prerelease.20

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.
@@ -2,6 +2,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
2
  import { type PropertyValues, nothing } from '@umbraco-cms/backoffice/external/lit';
3
3
  import '@umbraco-cms/backoffice/components';
4
4
  import type { SyncItemPreviewResponse } from '../api';
5
+ import { type uSyncPreviewLabels } from '../preview/types.js';
5
6
  /**
6
7
  * Shows the current and incoming versions of a content or media item side by
7
8
  * side, laid out the way the backoffice editor shows them, with every value
@@ -10,6 +11,7 @@ import type { SyncItemPreviewResponse } from '../api';
10
11
  export declare class uSyncContentPreviewElement extends UmbLitElement {
11
12
  #private;
12
13
  preview?: SyncItemPreviewResponse;
14
+ labels?: uSyncPreviewLabels;
13
15
  /** the tab shown on both sides (by name) */
14
16
  private _activeTab?;
15
17
  /** the culture shown on both sides (undefined for invariant items) */
@@ -110,8 +110,10 @@ _uSyncContentPreviewElement_renderToolbar = function _uSyncContentPreviewElement
110
110
  };
111
111
  _uSyncContentPreviewElement_renderSide = function _uSyncContentPreviewElement_renderSide(side, data, tabs, active) {
112
112
  const headline = side === 'current'
113
- ? this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)')
114
- : this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)');
113
+ ? (this.labels?.current ??
114
+ this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)'))
115
+ : (this.labels?.incoming ??
116
+ this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)'));
115
117
  if (!data.item) {
116
118
  return html `<div class="side ${side}">
117
119
  <h4 class="side-headline">${headline}</h4>
@@ -506,6 +508,9 @@ uSyncContentPreviewElement.styles = css `
506
508
  __decorate([
507
509
  property({ type: Object })
508
510
  ], uSyncContentPreviewElement.prototype, "preview", void 0);
511
+ __decorate([
512
+ property({ type: Object })
513
+ ], uSyncContentPreviewElement.prototype, "labels", void 0);
509
514
  __decorate([
510
515
  state()
511
516
  ], uSyncContentPreviewElement.prototype, "_activeTab", void 0);
@@ -2,6 +2,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
2
  import { type PropertyValues, nothing } from '@umbraco-cms/backoffice/external/lit';
3
3
  import '@umbraco-cms/backoffice/components';
4
4
  import type { SyncItemPreviewResponse } from '../api';
5
+ import { type uSyncPreviewLabels } from '../preview/types.js';
5
6
  /**
6
7
  * Shows the current and incoming versions of a document, media or member
7
8
  * type side by side, laid out the way the backoffice editor shows them, with
@@ -11,6 +12,7 @@ import type { SyncItemPreviewResponse } from '../api';
11
12
  export declare class uSyncContentTypePreviewElement extends UmbLitElement {
12
13
  #private;
13
14
  preview?: SyncItemPreviewResponse;
15
+ labels?: uSyncPreviewLabels;
14
16
  /** the tab shown on both sides (by name, so it lines up when ids differ) */
15
17
  private _activeTab?;
16
18
  protected willUpdate(changed: PropertyValues<this>): void;
@@ -19,7 +19,7 @@ var _uSyncContentTypePreviewElement_instances, _uSyncContentTypePreviewElement_s
19
19
  import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
20
20
  import { classMap, css, customElement, html, nothing, property, repeat, state, } from '@umbraco-cms/backoffice/external/lit';
21
21
  import '@umbraco-cms/backoffice/components';
22
- import { getPreviewModel } from '../preview/types.js';
22
+ import { getPreviewModel, } from '../preview/types.js';
23
23
  import { buildContentTypeLayout, compositionIds, } from '../utils/preview/content-type-layout.js';
24
24
  import { diffContentTypes, } from '../utils/preview/content-type-diff.js';
25
25
  const KIND_LABELS = {
@@ -80,8 +80,10 @@ _uSyncContentTypePreviewElement_diff = new WeakMap();
80
80
  _uSyncContentTypePreviewElement_instances = new WeakSet();
81
81
  _uSyncContentTypePreviewElement_renderSide = function _uSyncContentTypePreviewElement_renderSide(side, type) {
82
82
  const headline = side === 'current'
83
- ? this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)')
84
- : this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)');
83
+ ? (this.labels?.current ??
84
+ this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)'))
85
+ : (this.labels?.incoming ??
86
+ this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)'));
85
87
  if (!type) {
86
88
  return html `<div class="side">
87
89
  <h4 class="side-headline">${headline}</h4>
@@ -520,6 +522,9 @@ uSyncContentTypePreviewElement.styles = css `
520
522
  __decorate([
521
523
  property({ type: Object })
522
524
  ], uSyncContentTypePreviewElement.prototype, "preview", void 0);
525
+ __decorate([
526
+ property({ type: Object })
527
+ ], uSyncContentTypePreviewElement.prototype, "labels", void 0);
523
528
  __decorate([
524
529
  state()
525
530
  ], uSyncContentTypePreviewElement.prototype, "_activeTab", void 0);
@@ -2,6 +2,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
2
  import { nothing } from '@umbraco-cms/backoffice/external/lit';
3
3
  import '@umbraco-cms/backoffice/components';
4
4
  import type { SyncItemPreviewResponse } from '../api';
5
+ import { type uSyncPreviewLabels } from '../preview/types.js';
5
6
  /**
6
7
  * Shows the current and incoming versions of a data type side by side,
7
8
  * rendered with the real property editor, so you can see what an import
@@ -10,6 +11,7 @@ import type { SyncItemPreviewResponse } from '../api';
10
11
  export declare class uSyncDataTypePreviewElement extends UmbLitElement {
11
12
  #private;
12
13
  preview?: SyncItemPreviewResponse;
14
+ labels?: uSyncPreviewLabels;
13
15
  render(): typeof nothing | import("lit-html").TemplateResult<1>;
14
16
  static styles: import("lit").CSSResult;
15
17
  }
@@ -13,7 +13,7 @@ var _uSyncDataTypePreviewElement_instances, _uSyncDataTypePreviewElement_renderS
13
13
  import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
14
14
  import { classMap, css, customElement, html, nothing, property, } from '@umbraco-cms/backoffice/external/lit';
15
15
  import '@umbraco-cms/backoffice/components';
16
- import { getPreviewModel } from '../preview/types.js';
16
+ import { getPreviewModel, } from '../preview/types.js';
17
17
  import { deepEqual, prettyJson } from '../utils/diff/index.js';
18
18
  /**
19
19
  * Shows the current and incoming versions of a data type side by side,
@@ -42,8 +42,10 @@ let uSyncDataTypePreviewElement = class uSyncDataTypePreviewElement extends UmbL
42
42
  _uSyncDataTypePreviewElement_instances = new WeakSet();
43
43
  _uSyncDataTypePreviewElement_renderSide = function _uSyncDataTypePreviewElement_renderSide(side, dataType, other) {
44
44
  const headline = side === 'current'
45
- ? this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)')
46
- : this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)');
45
+ ? (this.labels?.current ??
46
+ this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)'))
47
+ : (this.labels?.incoming ??
48
+ this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)'));
47
49
  return html `
48
50
  <div class="side">
49
51
  <h4 class="side-headline">${headline}</h4>
@@ -272,6 +274,9 @@ uSyncDataTypePreviewElement.styles = css `
272
274
  __decorate([
273
275
  property({ type: Object })
274
276
  ], uSyncDataTypePreviewElement.prototype, "preview", void 0);
277
+ __decorate([
278
+ property({ type: Object })
279
+ ], uSyncDataTypePreviewElement.prototype, "labels", void 0);
275
280
  uSyncDataTypePreviewElement = __decorate([
276
281
  customElement('usync-data-type-preview')
277
282
  ], uSyncDataTypePreviewElement);
@@ -1,6 +1,6 @@
1
1
  import { LitElement, nothing } from '@umbraco-cms/backoffice/external/lit';
2
2
  import { USyncActionView } from '@jumoo/uSync';
3
- import { uSyncPreviewSource } from '@jumoo/uSync';
3
+ import { uSyncPreviewLabels, uSyncPreviewSource } from '@jumoo/uSync';
4
4
  declare const uSyncResultsView_base: import("@umbraco-cms/backoffice/extension-api").HTMLElementConstructor<import("@umbraco-cms/backoffice/element-api").UmbElement> & typeof LitElement;
5
5
  export declare class uSyncResultsView extends uSyncResultsView_base {
6
6
  #private;
@@ -13,6 +13,10 @@ export declare class uSyncResultsView extends uSyncResultsView_base {
13
13
  * items from this site's uSync folders (see uSyncDetailsModalData).
14
14
  */
15
15
  previewSource?: uSyncPreviewSource;
16
+ /**
17
+ * the headlines over the two sides of the preview (see uSyncDetailsModalData).
18
+ */
19
+ previewLabels?: uSyncPreviewLabels;
16
20
  showAll: boolean;
17
21
  changeCount: number;
18
22
  groupBy<T>(arr: T[], fn: (item: T) => any): Record<string, T[]>;
@@ -100,6 +100,7 @@ _uSyncResultsView_showDetail = async function _uSyncResultsView_showDetail(e) {
100
100
  item: e.action,
101
101
  items: __classPrivateFieldGet(this, _uSyncResultsView_instances, "m", _uSyncResultsView_visibleItems).call(this),
102
102
  previewSource: this.previewSource,
103
+ previewLabels: this.previewLabels,
103
104
  showActions: (item) => !this.hideActions &&
104
105
  (item.change == ChangeType.CREATE ||
105
106
  item.change == ChangeType.UPDATE ||
@@ -175,6 +176,9 @@ __decorate([
175
176
  __decorate([
176
177
  property({ attribute: false })
177
178
  ], uSyncResultsView.prototype, "previewSource", void 0);
179
+ __decorate([
180
+ property({ attribute: false })
181
+ ], uSyncResultsView.prototype, "previewLabels", void 0);
178
182
  __decorate([
179
183
  state()
180
184
  ], uSyncResultsView.prototype, "showAll", void 0);
@@ -198,7 +198,7 @@ _uSyncDetailsModalElement_loadPreview = async function _uSyncDetailsModalElement
198
198
  if (data?.entityType) {
199
199
  const entityType = data.entityType;
200
200
  __classPrivateFieldSet(this, _uSyncDetailsModalElement_previewFilter, (manifest) => manifest.forEntityTypes.includes(entityType), "f");
201
- __classPrivateFieldSet(this, _uSyncDetailsModalElement_previewProps, { preview: data }, "f");
201
+ __classPrivateFieldSet(this, _uSyncDetailsModalElement_previewProps, { preview: data, labels: this.data?.previewLabels }, "f");
202
202
  this._preview = data;
203
203
  }
204
204
  };
@@ -1,5 +1,5 @@
1
1
  import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
2
- import { SyncItemPreviewResponse, USyncActionView } from '@jumoo/uSync';
2
+ import { SyncItemPreviewResponse, USyncActionView, uSyncPreviewLabels } from '@jumoo/uSync';
3
3
  /**
4
4
  * where the details dialog gets the preview of an item from.
5
5
  *
@@ -25,6 +25,11 @@ export interface uSyncDetailsModalData {
25
25
  * the item from this site's uSync folders.
26
26
  */
27
27
  previewSource?: uSyncPreviewSource;
28
+ /**
29
+ * the headlines over the two sides of the preview, for a previewSource whose
30
+ * items don't come from this site's uSync folders.
31
+ */
32
+ previewLabels?: uSyncPreviewLabels;
28
33
  }
29
34
  export interface uSyncDetailsModalValue {
30
35
  result: boolean;
@@ -1,11 +1,21 @@
1
1
  import type { ManifestElement } from '@umbraco-cms/backoffice/extension-api';
2
2
  import type { DataTypeResponseModel, DocumentResponseModel, DocumentTypeResponseModel, MediaResponseModel, MediaTypeResponseModel, MemberTypeResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
3
3
  import type { SyncItemPreviewResponse } from '../api';
4
+ /**
5
+ * the headlines over the two sides of a preview, for callers whose items don't
6
+ * come from this site's uSync folders (e.g. 'Target site' and 'This site').
7
+ */
8
+ export interface uSyncPreviewLabels {
9
+ current?: string;
10
+ incoming?: string;
11
+ }
4
12
  /**
5
13
  * An element that shows the preview of an import for one or more entity types.
6
14
  */
7
15
  export interface uSyncItemPreviewElement extends HTMLElement {
8
16
  preview?: SyncItemPreviewResponse;
17
+ /** headlines for the two sides, when not set the element uses its own. */
18
+ labels?: uSyncPreviewLabels;
9
19
  }
10
20
  /**
11
21
  * Shows the preview for items of the given entity types in the details dialog.
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://jumoo.co.uk/uSync",
9
9
  "license": "MPL-2.0",
10
10
  "type": "module",
11
- "version": "17.6.1-prerelease.19",
11
+ "version": "17.6.1-prerelease.20",
12
12
  "main": "./dist/usync.js",
13
13
  "types": "./dist/index.d.ts",
14
14
  "module": "./dist/usync.js",