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

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.
@@ -19,7 +19,8 @@ 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 { previewSideStyles, renderPreviewHeadline, } from './preview-side.js';
23
+ import { getPreviewModel, } from '../preview/types.js';
23
24
  import { buildContentTypeLayout, compositionIds, } from '../utils/preview/content-type-layout.js';
24
25
  import { diffContentTypes, } from '../utils/preview/content-type-diff.js';
25
26
  const KIND_LABELS = {
@@ -65,8 +66,8 @@ let uSyncContentTypePreviewElement = class uSyncContentTypePreviewElement extend
65
66
  return nothing;
66
67
  return html `
67
68
  <div class="sides">
68
- ${__classPrivateFieldGet(this, _uSyncContentTypePreviewElement_instances, "m", _uSyncContentTypePreviewElement_renderSide).call(this, 'current', __classPrivateFieldGet(this, _uSyncContentTypePreviewElement_sides, "f").current)}
69
69
  ${__classPrivateFieldGet(this, _uSyncContentTypePreviewElement_instances, "m", _uSyncContentTypePreviewElement_renderSide).call(this, 'incoming', __classPrivateFieldGet(this, _uSyncContentTypePreviewElement_sides, "f").incoming)}
70
+ ${__classPrivateFieldGet(this, _uSyncContentTypePreviewElement_instances, "m", _uSyncContentTypePreviewElement_renderSide).call(this, 'current', __classPrivateFieldGet(this, _uSyncContentTypePreviewElement_sides, "f").current)}
70
71
  </div>
71
72
  `;
72
73
  }
@@ -79,20 +80,17 @@ _uSyncContentTypePreviewElement_newCompositions = new WeakMap();
79
80
  _uSyncContentTypePreviewElement_diff = new WeakMap();
80
81
  _uSyncContentTypePreviewElement_instances = new WeakSet();
81
82
  _uSyncContentTypePreviewElement_renderSide = function _uSyncContentTypePreviewElement_renderSide(side, type) {
82
- const headline = side === 'current'
83
- ? this.localize.termOrDefault('uSync_previewCurrent', 'Current (this site)')
84
- : this.localize.termOrDefault('uSync_previewIncoming', 'Incoming (uSync files)');
85
83
  if (!type) {
86
- return html `<div class="side">
87
- <h4 class="side-headline">${headline}</h4>
84
+ return html `<div class="side ${side}">
85
+ ${renderPreviewHeadline(this, side, this.labels)}
88
86
  <uui-box class="info"><p class="empty">${__classPrivateFieldGet(this, _uSyncContentTypePreviewElement_instances, "m", _uSyncContentTypePreviewElement_missingMessage).call(this, side)}</p></uui-box>
89
87
  </div>`;
90
88
  }
91
89
  const tabs = buildContentTypeLayout(type, __classPrivateFieldGet(this, _uSyncContentTypePreviewElement_compositions, "f"));
92
90
  const active = tabs.find((t) => t.name === this._activeTab) ?? tabs[0];
93
91
  return html `
94
- <div class="side">
95
- <h4 class="side-headline">${headline}</h4>
92
+ <div class="side ${side}">
93
+ ${renderPreviewHeadline(this, side, this.labels)}
96
94
  ${__classPrivateFieldGet(this, _uSyncContentTypePreviewElement_instances, "m", _uSyncContentTypePreviewElement_renderInfo).call(this, type)}
97
95
  ${tabs.length > 1 || (tabs.length === 1 && tabs[0].name)
98
96
  ? html `<uui-tab-group>
@@ -297,229 +295,227 @@ _uSyncContentTypePreviewElement_renderBadge = function _uSyncContentTypePreviewE
297
295
  >${change.status}</uui-tag
298
296
  >`;
299
297
  };
300
- uSyncContentTypePreviewElement.styles = css `
301
- :host {
302
- display: block;
303
- container-type: inline-size;
304
- }
305
-
306
- /* the two sides share rows (headline, info, tabs, content), so the
307
- tab bars and groups line up even when the info boxes differ. */
308
- .sides {
309
- display: grid;
310
- grid-template-columns: 1fr 1fr;
311
- grid-template-rows: auto auto auto 1fr;
312
- gap: var(--uui-size-space-4) var(--uui-size-space-5);
313
- }
314
-
315
- .side {
316
- display: grid;
317
- grid-row: span 4;
318
- grid-template-rows: subgrid;
319
- align-items: start;
320
- min-width: 0;
321
- }
322
-
323
- /* info boxes match heights across the sides (but a lone "not here" box doesn't stretch). */
324
- .side > .info:not(:last-child) {
325
- align-self: stretch;
326
- }
327
-
328
- @container (max-width: 760px) {
298
+ uSyncContentTypePreviewElement.styles = [
299
+ previewSideStyles,
300
+ css `
301
+ :host {
302
+ display: block;
303
+ container-type: inline-size;
304
+ }
305
+
306
+ /* the two sides share rows (headline, info, tabs, content), so the
307
+ tab bars and groups line up even when the info boxes differ. */
329
308
  .sides {
330
- grid-template-columns: 1fr;
331
- grid-template-rows: none;
332
- row-gap: var(--uui-size-layout-1);
309
+ display: grid;
310
+ grid-template-columns: 1fr 1fr;
311
+ grid-template-rows: auto auto auto 1fr;
312
+ gap: var(--uui-size-space-4) var(--uui-size-space-5);
333
313
  }
334
314
 
335
315
  .side {
316
+ display: grid;
317
+ grid-row: span 4;
318
+ grid-template-rows: subgrid;
319
+ align-items: start;
320
+ min-width: 0;
321
+ }
322
+
323
+ /* info boxes match heights across the sides (but a lone "not here" box doesn't stretch). */
324
+ .side > .info:not(:last-child) {
325
+ align-self: stretch;
326
+ }
327
+
328
+ @container (max-width: 760px) {
329
+ .sides {
330
+ grid-template-columns: 1fr;
331
+ grid-template-rows: none;
332
+ row-gap: var(--uui-size-layout-1);
333
+ }
334
+
335
+ .side {
336
+ display: flex;
337
+ flex-direction: column;
338
+ align-items: stretch;
339
+ gap: var(--uui-size-space-4);
340
+ grid-row: auto;
341
+ }
342
+ }
343
+
344
+ umb-property-dataset {
345
+ display: flex;
346
+ flex-direction: column;
347
+ gap: var(--uui-size-space-4);
348
+ min-width: 0;
349
+ }
350
+
351
+ .headline {
352
+ display: flex;
353
+ align-items: center;
354
+ flex-wrap: wrap;
355
+ gap: var(--uui-size-space-2) var(--uui-size-space-3);
356
+ }
357
+
358
+ .headline code {
359
+ font-size: var(--uui-type-small-size);
360
+ color: var(--uui-color-text-alt);
361
+ }
362
+
363
+ .info-body {
336
364
  display: flex;
337
365
  flex-direction: column;
338
- align-items: stretch;
339
366
  gap: var(--uui-size-space-4);
340
- grid-row: auto;
341
- }
342
- }
343
-
344
- umb-property-dataset {
345
- display: flex;
346
- flex-direction: column;
347
- gap: var(--uui-size-space-4);
348
- min-width: 0;
349
- }
350
-
351
- .side-headline {
352
- margin: 0;
353
- font-size: var(--uui-type-small-size);
354
- text-transform: uppercase;
355
- letter-spacing: 0.04em;
356
- color: var(--uui-color-text-alt);
357
- }
358
-
359
- .headline {
360
- display: flex;
361
- align-items: center;
362
- flex-wrap: wrap;
363
- gap: var(--uui-size-space-2) var(--uui-size-space-3);
364
- }
365
-
366
- .headline code {
367
- font-size: var(--uui-type-small-size);
368
- color: var(--uui-color-text-alt);
369
- }
370
-
371
- .info-body {
372
- display: flex;
373
- flex-direction: column;
374
- gap: var(--uui-size-space-4);
375
- }
376
-
377
- .tags {
378
- display: flex;
379
- flex-wrap: wrap;
380
- gap: var(--uui-size-space-2);
381
- }
382
-
383
- .description {
384
- margin: 0;
385
- }
386
-
387
- .meta {
388
- display: grid;
389
- grid-template-columns: max-content 1fr;
390
- align-items: center;
391
- gap: var(--uui-size-space-2) var(--uui-size-space-5);
392
- margin: 0;
393
- }
394
-
395
- .meta dt {
396
- font-weight: 700;
397
- }
398
-
399
- .meta dd {
400
- display: flex;
401
- flex-wrap: wrap;
402
- gap: var(--uui-size-space-2);
403
- margin: 0;
404
- }
405
-
406
- /* a changed field gets a soft highlight, spread with a shadow so the text doesn't move. */
407
- .changed:not(.property):not(uui-box) {
408
- background: color-mix(in srgb, var(--uui-color-warning) 35%, transparent);
409
- border-radius: var(--uui-border-radius);
410
- box-shadow: 0 0 0 var(--uui-size-space-1)
411
- color-mix(in srgb, var(--uui-color-warning) 35%, transparent);
412
- }
413
-
414
- uui-tab-group {
415
- --uui-tab-divider: var(--uui-color-border);
416
- border-bottom: 1px solid var(--uui-color-border);
417
- }
418
-
419
- .tab-label {
420
- display: inline-flex;
421
- align-items: center;
422
- gap: var(--uui-size-space-2);
423
- white-space: nowrap;
424
- }
425
-
426
- .dot {
427
- display: inline-block;
428
- width: 8px;
429
- height: 8px;
430
- border-radius: 50%;
431
- }
432
-
433
- .dot.added {
434
- background: var(--uui-color-positive);
435
- }
436
-
437
- .dot.removed {
438
- background: var(--uui-color-danger);
439
- }
440
-
441
- .dot.changed {
442
- background: var(--uui-color-warning);
443
- }
444
-
445
- uui-box.added {
446
- border-left: 3px solid var(--uui-color-positive);
447
- }
448
-
449
- uui-box.removed {
450
- border-left: 3px solid var(--uui-color-danger);
451
- }
452
-
453
- uui-box.changed {
454
- border-left: 3px solid var(--uui-color-warning);
455
- }
456
-
457
- /* marked with an inset bar rather than a border, so the content doesn't shift. */
458
- .property.added {
459
- box-shadow: inset 3px 0 0 var(--uui-color-positive);
460
- background: color-mix(in srgb, var(--uui-color-positive) 6%, transparent);
461
- }
462
-
463
- .property.removed {
464
- box-shadow: inset 3px 0 0 var(--uui-color-danger);
465
- background: color-mix(in srgb, var(--uui-color-danger) 6%, transparent);
466
- }
467
-
468
- .property.changed {
469
- box-shadow: inset 3px 0 0 var(--uui-color-warning);
470
- background: color-mix(in srgb, var(--uui-color-warning) 10%, transparent);
471
- }
472
-
473
- /* properties run edge to edge in their box, like the backoffice editor. */
474
- .property {
475
- padding: var(--uui-size-space-4) var(--uui-size-space-5) 0;
476
- margin: 0 calc(-1 * var(--uui-size-space-5));
477
- }
478
-
479
- .property:first-child,
480
- .headline + .property {
481
- margin-top: calc(-1 * var(--uui-size-space-5));
482
- }
483
-
484
- .property:last-child {
485
- margin-bottom: calc(-1 * var(--uui-size-space-5));
486
- }
487
-
488
- .property + .property {
489
- border-top: 1px solid var(--uui-color-divider);
490
- }
491
-
492
- /* umb-property pads itself for a full workspace, tighten it up here. */
493
- umb-property {
494
- --uui-size-layout-1: var(--uui-size-space-4);
495
- }
496
-
497
- .property-meta {
498
- display: flex;
499
- flex-wrap: wrap;
500
- align-items: center;
501
- gap: var(--uui-size-space-2) var(--uui-size-space-3);
502
- font-size: var(--uui-type-small-size);
503
- color: var(--uui-color-text-alt);
504
- }
505
-
506
- .property-meta code {
507
- color: var(--uui-color-text);
508
- }
509
-
510
- .inherited {
511
- font-style: italic;
512
- color: var(--uui-color-text-alt);
513
- }
514
-
515
- .empty {
516
- margin: 0;
517
- color: var(--uui-color-text-alt);
518
- }
519
- `;
367
+ }
368
+
369
+ .tags {
370
+ display: flex;
371
+ flex-wrap: wrap;
372
+ gap: var(--uui-size-space-2);
373
+ }
374
+
375
+ .description {
376
+ margin: 0;
377
+ }
378
+
379
+ .meta {
380
+ display: grid;
381
+ grid-template-columns: max-content 1fr;
382
+ align-items: center;
383
+ gap: var(--uui-size-space-2) var(--uui-size-space-5);
384
+ margin: 0;
385
+ }
386
+
387
+ .meta dt {
388
+ font-weight: 700;
389
+ }
390
+
391
+ .meta dd {
392
+ display: flex;
393
+ flex-wrap: wrap;
394
+ gap: var(--uui-size-space-2);
395
+ margin: 0;
396
+ }
397
+
398
+ /* a changed field gets a soft highlight, spread with a shadow so the text doesn't move. */
399
+ .changed:not(.property):not(uui-box) {
400
+ background: color-mix(in srgb, var(--usync-preview-change) 35%, transparent);
401
+ border-radius: var(--uui-border-radius);
402
+ box-shadow: 0 0 0 var(--uui-size-space-1)
403
+ color-mix(in srgb, var(--usync-preview-change) 35%, transparent);
404
+ }
405
+
406
+ uui-tab-group {
407
+ --uui-tab-divider: var(--uui-color-border);
408
+ border-bottom: 1px solid var(--uui-color-border);
409
+ }
410
+
411
+ .tab-label {
412
+ display: inline-flex;
413
+ align-items: center;
414
+ gap: var(--uui-size-space-2);
415
+ white-space: nowrap;
416
+ }
417
+
418
+ .dot {
419
+ display: inline-block;
420
+ width: 8px;
421
+ height: 8px;
422
+ border-radius: 50%;
423
+ }
424
+
425
+ .dot.added {
426
+ background: var(--uui-color-positive);
427
+ }
428
+
429
+ .dot.removed {
430
+ background: var(--uui-color-danger);
431
+ }
432
+
433
+ .dot.changed {
434
+ background: var(--uui-color-warning);
435
+ }
436
+
437
+ uui-box.added {
438
+ border-left: 3px solid var(--uui-color-positive);
439
+ }
440
+
441
+ uui-box.removed {
442
+ border-left: 3px solid var(--uui-color-danger);
443
+ }
444
+
445
+ uui-box.changed {
446
+ border-left: 3px solid var(--usync-preview-change);
447
+ }
448
+
449
+ /* marked with an inset bar rather than a border, so the content doesn't shift. */
450
+ .property.added {
451
+ box-shadow: inset 3px 0 0 var(--uui-color-positive);
452
+ background: color-mix(in srgb, var(--uui-color-positive) 6%, transparent);
453
+ }
454
+
455
+ .property.removed {
456
+ box-shadow: inset 3px 0 0 var(--uui-color-danger);
457
+ background: color-mix(in srgb, var(--uui-color-danger) 6%, transparent);
458
+ }
459
+
460
+ .property.changed {
461
+ box-shadow: inset 3px 0 0 var(--usync-preview-change);
462
+ background: color-mix(in srgb, var(--usync-preview-change) 10%, transparent);
463
+ }
464
+
465
+ /* properties run edge to edge in their box, like the backoffice editor. */
466
+ .property {
467
+ padding: var(--uui-size-space-4) var(--uui-size-space-5) 0;
468
+ margin: 0 calc(-1 * var(--uui-size-space-5));
469
+ }
470
+
471
+ .property:first-child,
472
+ .headline + .property {
473
+ margin-top: calc(-1 * var(--uui-size-space-5));
474
+ }
475
+
476
+ .property:last-child {
477
+ margin-bottom: calc(-1 * var(--uui-size-space-5));
478
+ }
479
+
480
+ .property + .property {
481
+ border-top: 1px solid var(--uui-color-divider);
482
+ }
483
+
484
+ /* umb-property pads itself for a full workspace, tighten it up here. */
485
+ umb-property {
486
+ --uui-size-layout-1: var(--uui-size-space-4);
487
+ }
488
+
489
+ .property-meta {
490
+ display: flex;
491
+ flex-wrap: wrap;
492
+ align-items: center;
493
+ gap: var(--uui-size-space-2) var(--uui-size-space-3);
494
+ font-size: var(--uui-type-small-size);
495
+ color: var(--uui-color-text-alt);
496
+ }
497
+
498
+ .property-meta code {
499
+ color: var(--uui-color-text);
500
+ }
501
+
502
+ .inherited {
503
+ font-style: italic;
504
+ color: var(--uui-color-text-alt);
505
+ }
506
+
507
+ .empty {
508
+ margin: 0;
509
+ color: var(--uui-color-text-alt);
510
+ }
511
+ `,
512
+ ];
520
513
  __decorate([
521
514
  property({ type: Object })
522
515
  ], uSyncContentTypePreviewElement.prototype, "preview", void 0);
516
+ __decorate([
517
+ property({ type: Object })
518
+ ], uSyncContentTypePreviewElement.prototype, "labels", void 0);
523
519
  __decorate([
524
520
  state()
525
521
  ], 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,8 +11,9 @@ 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
- static styles: import("lit").CSSResult;
16
+ static styles: import("lit").CSSResult[];
15
17
  }
16
18
  export default uSyncDataTypePreviewElement;
17
19
  declare global {