@jumoo/usync 0.0.0-stage → 17.5.0

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.
Files changed (199) hide show
  1. package/LICENCE +373 -0
  2. package/README.md +10 -3
  3. package/dist/api/client/client.gen.d.ts +2 -0
  4. package/dist/api/client/client.gen.js +216 -0
  5. package/dist/api/client/index.d.ts +10 -0
  6. package/dist/api/client/index.js +6 -0
  7. package/dist/api/client/types.gen.d.ts +120 -0
  8. package/dist/api/client/types.gen.js +2 -0
  9. package/dist/api/client/utils.gen.d.ts +37 -0
  10. package/dist/api/client/utils.gen.js +230 -0
  11. package/dist/api/client.gen.d.ts +12 -0
  12. package/dist/api/client.gen.js +4 -0
  13. package/dist/api/core/auth.gen.d.ts +25 -0
  14. package/dist/api/core/auth.gen.js +14 -0
  15. package/dist/api/core/bodySerializer.gen.d.ts +25 -0
  16. package/dist/api/core/bodySerializer.gen.js +57 -0
  17. package/dist/api/core/params.gen.d.ts +43 -0
  18. package/dist/api/core/params.gen.js +109 -0
  19. package/dist/api/core/pathSerializer.gen.d.ts +33 -0
  20. package/dist/api/core/pathSerializer.gen.js +106 -0
  21. package/dist/api/core/queryKeySerializer.gen.d.ts +18 -0
  22. package/dist/api/core/queryKeySerializer.gen.js +92 -0
  23. package/dist/api/core/serverSentEvents.gen.d.ts +71 -0
  24. package/dist/api/core/serverSentEvents.gen.js +132 -0
  25. package/dist/api/core/types.gen.d.ts +83 -0
  26. package/dist/api/core/types.gen.js +2 -0
  27. package/dist/api/core/utils.gen.d.ts +19 -0
  28. package/dist/api/core/utils.gen.js +87 -0
  29. package/dist/api/index.d.ts +3 -0
  30. package/dist/api/index.js +4 -0
  31. package/dist/api/sdk.gen.d.ts +44 -0
  32. package/dist/api/sdk.gen.js +147 -0
  33. package/dist/api/types.gen.d.ts +567 -0
  34. package/dist/api/types.gen.js +47 -0
  35. package/dist/components/events.d.ts +11 -0
  36. package/dist/components/events.js +11 -0
  37. package/dist/components/index.d.ts +8 -0
  38. package/dist/components/index.js +9 -0
  39. package/dist/components/usync-action-box.d.ts +22 -0
  40. package/dist/components/usync-action-box.js +119 -0
  41. package/dist/components/usync-change-detail.d.ts +31 -0
  42. package/dist/components/usync-change-detail.js +709 -0
  43. package/dist/components/usync-change-view.d.ts +22 -0
  44. package/dist/components/usync-change-view.js +125 -0
  45. package/dist/components/usync-progress-box.d.ts +20 -0
  46. package/dist/components/usync-progress-box.js +223 -0
  47. package/dist/components/usync-result-row.d.ts +15 -0
  48. package/dist/components/usync-result-row.js +133 -0
  49. package/dist/components/usync-results-group-view.d.ts +19 -0
  50. package/dist/components/usync-results-group-view.js +110 -0
  51. package/dist/components/usync-results-view.d.ts +17 -0
  52. package/dist/components/usync-results-view.js +176 -0
  53. package/dist/components/usync-sync-file-info-view.d.ts +15 -0
  54. package/dist/components/usync-sync-file-info-view.js +62 -0
  55. package/dist/conditions/constants.d.ts +1 -0
  56. package/dist/conditions/constants.js +1 -0
  57. package/dist/conditions/index.d.ts +2 -0
  58. package/dist/conditions/index.js +2 -0
  59. package/dist/conditions/legacy-files.condition.d.ts +10 -0
  60. package/dist/conditions/legacy-files.condition.js +16 -0
  61. package/dist/conditions/manifest.d.ts +1 -0
  62. package/dist/conditions/manifest.js +18 -0
  63. package/dist/conditions/new-section.condition.d.ts +8 -0
  64. package/dist/conditions/new-section.condition.js +48 -0
  65. package/dist/constants.d.ts +30 -0
  66. package/dist/constants.js +38 -0
  67. package/dist/dialogs/details-modal-element.d.ts +18 -0
  68. package/dist/dialogs/details-modal-element.js +98 -0
  69. package/dist/dialogs/details-modal-token.d.ts +10 -0
  70. package/dist/dialogs/details-modal-token.js +7 -0
  71. package/dist/dialogs/error-modal-element.d.ts +7 -0
  72. package/dist/dialogs/error-modal-element.js +54 -0
  73. package/dist/dialogs/error-modal-token.d.ts +9 -0
  74. package/dist/dialogs/error-modal-token.js +6 -0
  75. package/dist/dialogs/index.d.ts +6 -0
  76. package/dist/dialogs/index.js +6 -0
  77. package/dist/dialogs/legacy-modal-element.d.ts +13 -0
  78. package/dist/dialogs/legacy-modal-element.js +78 -0
  79. package/dist/dialogs/manifest.d.ts +1 -0
  80. package/dist/dialogs/manifest.js +25 -0
  81. package/dist/dialogs/single-import-modal.element.d.ts +13 -0
  82. package/dist/dialogs/single-import-modal.element.js +105 -0
  83. package/dist/dialogs/single-import-modal.token.d.ts +9 -0
  84. package/dist/dialogs/single-import-modal.token.js +6 -0
  85. package/dist/exports.d.ts +10 -0
  86. package/dist/exports.js +10 -0
  87. package/dist/external/signalr/index.d.ts +1 -0
  88. package/dist/external/signalr/index.js +1 -0
  89. package/dist/hey-api.d.ts +11 -0
  90. package/dist/hey-api.js +14 -0
  91. package/dist/icons/icons.d.ts +5 -0
  92. package/dist/icons/icons.js +6 -0
  93. package/dist/icons/manifest.d.ts +1 -0
  94. package/dist/icons/manifest.js +7 -0
  95. package/dist/icons/svg/logo.d.ts +2 -0
  96. package/dist/icons/svg/logo.js +21 -0
  97. package/dist/index.d.ts +8 -0
  98. package/dist/index.js +11 -0
  99. package/dist/lang/files/da-dk.d.ts +130 -0
  100. package/dist/lang/files/da-dk.js +141 -0
  101. package/dist/lang/files/de-de.d.ts +130 -0
  102. package/dist/lang/files/de-de.js +141 -0
  103. package/dist/lang/files/en-us.d.ts +161 -0
  104. package/dist/lang/files/en-us.js +172 -0
  105. package/dist/lang/files/es-es.d.ts +130 -0
  106. package/dist/lang/files/es-es.js +141 -0
  107. package/dist/lang/files/fr-fr.d.ts +130 -0
  108. package/dist/lang/files/fr-fr.js +141 -0
  109. package/dist/lang/files/nl-nl.d.ts +130 -0
  110. package/dist/lang/files/nl-nl.js +141 -0
  111. package/dist/lang/manifest.d.ts +1 -0
  112. package/dist/lang/manifest.js +63 -0
  113. package/dist/manifests.d.ts +1 -0
  114. package/dist/manifests.js +14 -0
  115. package/dist/repository/SyncAction.respositoy.d.ts +101 -0
  116. package/dist/repository/SyncAction.respositoy.js +125 -0
  117. package/dist/repository/index.d.ts +4 -0
  118. package/dist/repository/index.js +4 -0
  119. package/dist/repository/sources/SyncAction.source.d.ts +37 -0
  120. package/dist/repository/sources/SyncAction.source.js +57 -0
  121. package/dist/repository/sources/SyncMigration.source.d.ts +13 -0
  122. package/dist/repository/sources/SyncMigration.source.js +30 -0
  123. package/dist/repository/sources/SyncSettings.source.d.ts +23 -0
  124. package/dist/repository/sources/SyncSettings.source.js +33 -0
  125. package/dist/signalr/index.d.ts +3 -0
  126. package/dist/signalr/index.js +3 -0
  127. package/dist/signalr/signalr-reconnect-policy.d.ts +11 -0
  128. package/dist/signalr/signalr-reconnect-policy.js +14 -0
  129. package/dist/signalr/signalr.context.d.ts +34 -0
  130. package/dist/signalr/signalr.context.js +110 -0
  131. package/dist/signalr/signalr.context.token.d.ts +3 -0
  132. package/dist/signalr/signalr.context.token.js +2 -0
  133. package/dist/signalr/types.d.ts +21 -0
  134. package/dist/signalr/types.js +1 -0
  135. package/dist/tree/constants.d.ts +1 -0
  136. package/dist/tree/constants.js +1 -0
  137. package/dist/tree/index.d.ts +2 -0
  138. package/dist/tree/index.js +2 -0
  139. package/dist/tree/manifest.d.ts +1 -0
  140. package/dist/tree/manifest.js +92 -0
  141. package/dist/tree/types.d.ts +14 -0
  142. package/dist/tree/types.js +1 -0
  143. package/dist/tree/usync.menu-element.d.ts +13 -0
  144. package/dist/tree/usync.menu-element.js +74 -0
  145. package/dist/utils/diff/change-name.d.ts +13 -0
  146. package/dist/utils/diff/change-name.js +30 -0
  147. package/dist/utils/diff/classify-change.d.ts +21 -0
  148. package/dist/utils/diff/classify-change.js +111 -0
  149. package/dist/utils/diff/deep-equal.d.ts +13 -0
  150. package/dist/utils/diff/deep-equal.js +57 -0
  151. package/dist/utils/diff/format-value.d.ts +36 -0
  152. package/dist/utils/diff/format-value.js +88 -0
  153. package/dist/utils/diff/index.d.ts +7 -0
  154. package/dist/utils/diff/index.js +7 -0
  155. package/dist/utils/diff/json-diff.d.ts +34 -0
  156. package/dist/utils/diff/json-diff.js +300 -0
  157. package/dist/utils/diff/line-diff.d.ts +16 -0
  158. package/dist/utils/diff/line-diff.js +199 -0
  159. package/dist/utils/diff/types.d.ts +62 -0
  160. package/dist/utils/diff/types.js +12 -0
  161. package/dist/workspace/components/events.d.ts +31 -0
  162. package/dist/workspace/components/events.js +54 -0
  163. package/dist/workspace/components/index.d.ts +3 -0
  164. package/dist/workspace/components/index.js +3 -0
  165. package/dist/workspace/components/usync-action-button.d.ts +19 -0
  166. package/dist/workspace/components/usync-action-button.js +113 -0
  167. package/dist/workspace/components/usync-file-picker.element.d.ts +23 -0
  168. package/dist/workspace/components/usync-file-picker.element.js +106 -0
  169. package/dist/workspace/components/usync-file-upload.element.d.ts +21 -0
  170. package/dist/workspace/components/usync-file-upload.element.js +121 -0
  171. package/dist/workspace/dialogs/import-modal.element.d.ts +11 -0
  172. package/dist/workspace/dialogs/import-modal.element.js +75 -0
  173. package/dist/workspace/dialogs/import-modal.token.d.ts +6 -0
  174. package/dist/workspace/dialogs/import-modal.token.js +6 -0
  175. package/dist/workspace/dialogs/index.d.ts +2 -0
  176. package/dist/workspace/dialogs/index.js +2 -0
  177. package/dist/workspace/dialogs/manifest.d.ts +1 -0
  178. package/dist/workspace/dialogs/manifest.js +7 -0
  179. package/dist/workspace/index.d.ts +3 -0
  180. package/dist/workspace/index.js +3 -0
  181. package/dist/workspace/manifest.d.ts +3 -0
  182. package/dist/workspace/manifest.js +112 -0
  183. package/dist/workspace/types.d.ts +12 -0
  184. package/dist/workspace/types.js +1 -0
  185. package/dist/workspace/views/addons/addons.element.d.ts +7 -0
  186. package/dist/workspace/views/addons/addons.element.js +117 -0
  187. package/dist/workspace/views/default/default.element.d.ts +31 -0
  188. package/dist/workspace/views/default/default.element.js +466 -0
  189. package/dist/workspace/views/legacy/legacy.element.d.ts +14 -0
  190. package/dist/workspace/views/legacy/legacy.element.js +187 -0
  191. package/dist/workspace/views/settings/components/usyncSettingItem.element.d.ts +15 -0
  192. package/dist/workspace/views/settings/components/usyncSettingItem.element.js +96 -0
  193. package/dist/workspace/views/settings/settings.element.d.ts +17 -0
  194. package/dist/workspace/views/settings/settings.element.js +174 -0
  195. package/dist/workspace/workspace.context.d.ts +74 -0
  196. package/dist/workspace/workspace.context.js +448 -0
  197. package/dist/workspace/workspace.element.d.ts +17 -0
  198. package/dist/workspace/workspace.element.js +69 -0
  199. package/package.json +70 -6
@@ -0,0 +1,22 @@
1
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
+ import { type USyncActionView, type USyncChange } from '@jumoo/uSync';
3
+ import './usync-change-detail.js';
4
+ /**
5
+ * shows the change details for an item.
6
+ */
7
+ export declare class uSyncChangeView extends UmbLitElement {
8
+ #private;
9
+ item?: USyncActionView;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ renderDetails(details: Array<USyncChange>): import("lit-html").TemplateResult<1>;
12
+ renderNoChanges(): import("lit-html").TemplateResult<1>;
13
+ render_create(): import("lit-html").TemplateResult<1>;
14
+ renderMessage(): import("lit-html").TemplateResult<1>;
15
+ static styles: import("lit").CSSResult;
16
+ }
17
+ export default uSyncChangeView;
18
+ declare global {
19
+ interface HTMLElementTagNameMap {
20
+ 'usync-change-view': uSyncChangeView;
21
+ }
22
+ }
@@ -0,0 +1,125 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _uSyncChangeView_instances, _uSyncChangeView_renderable;
13
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
14
+ import { classMap, css, customElement, html, property, repeat, } from '@umbraco-cms/backoffice/external/lit';
15
+ import { ChangeDetailType, ChangeType, } from '@jumoo/uSync';
16
+ import './usync-change-detail.js';
17
+ /**
18
+ * shows the change details for an item.
19
+ */
20
+ let uSyncChangeView = class uSyncChangeView extends UmbLitElement {
21
+ constructor() {
22
+ super(...arguments);
23
+ _uSyncChangeView_instances.add(this);
24
+ }
25
+ render() {
26
+ if (this.item?.change === ChangeType.CREATE) {
27
+ return this.render_create();
28
+ }
29
+ // note: this has to test the *renderable* details, not the raw count -
30
+ // an unchanged item still arrives with a single `NoChange` detail, and
31
+ // branching on the raw length would render an empty list instead of
32
+ // the "no changes" message.
33
+ const details = __classPrivateFieldGet(this, _uSyncChangeView_instances, "m", _uSyncChangeView_renderable).call(this);
34
+ if (details.length > 0) {
35
+ return this.renderDetails(details);
36
+ }
37
+ else {
38
+ return this.renderNoChanges();
39
+ }
40
+ }
41
+ renderDetails(details) {
42
+ // with a single change there's nothing to scan past, so open it
43
+ // straight away; with more than one, start collapsed and let the user
44
+ // open the ones they care about.
45
+ const startOpen = details.length <= 1;
46
+ return html `
47
+ <div class="detail-list">
48
+ ${repeat(details, (detail, index) => `${index}:${detail.path}:${detail.name}`, (detail) => html `<usync-change-detail
49
+ .detail=${detail}
50
+ ?open=${startOpen}></usync-change-detail>`)}
51
+ </div>
52
+ `;
53
+ }
54
+ renderNoChanges() {
55
+ return html `
56
+ <div class="change-box">
57
+ <h3>
58
+ <umb-localize key="uSync_noChanges${this.item?.change}"
59
+ >No changes</umb-localize
60
+ >
61
+ </h3>
62
+ ${this.renderMessage()}
63
+ </div>
64
+ `;
65
+ }
66
+ render_create() {
67
+ return html `
68
+ <div class="change-box">
69
+ <h3>
70
+ <umb-localize key="uSync_changeCreate">This item is being created</umb-localize>
71
+ </h3>
72
+ </div>
73
+ `;
74
+ }
75
+ renderMessage() {
76
+ const message = (this.item?.message?.length ?? 0) > 0
77
+ ? this.item?.message
78
+ : this.item?.change == ChangeType.IMPORT
79
+ ? 'No changes were made but the item was imported'
80
+ : 'There are pending changes for this item';
81
+ const classes = { error: this.item?.success == false };
82
+ return html `<div class="${classMap(classes)}">${message}</div> `;
83
+ }
84
+ };
85
+ _uSyncChangeView_instances = new WeakSet();
86
+ _uSyncChangeView_renderable = function _uSyncChangeView_renderable() {
87
+ return (this.item?.details ?? []).filter((detail) => detail.change !== ChangeDetailType.NO_CHANGE);
88
+ };
89
+ uSyncChangeView.styles = css `
90
+ :host {
91
+ display: block;
92
+ margin: 0;
93
+ }
94
+
95
+ .change-box {
96
+ display: block;
97
+ padding: var(
98
+ --uui-box-header-padding,
99
+ var(--uui-size-space-4, 12px) var(--uui-size-space-5, 18px)
100
+ );
101
+ }
102
+
103
+ .change-box h3 {
104
+ margin: 0;
105
+ }
106
+
107
+ .error {
108
+ color: var(--uui-color-danger);
109
+ margin-top: var(--uui-size-space-2);
110
+ }
111
+
112
+ .detail-list {
113
+ display: flex;
114
+ flex-direction: column;
115
+ border-top: 1px solid var(--uui-color-border);
116
+ }
117
+ `;
118
+ __decorate([
119
+ property({ type: Object })
120
+ ], uSyncChangeView.prototype, "item", void 0);
121
+ uSyncChangeView = __decorate([
122
+ customElement('usync-change-view')
123
+ ], uSyncChangeView);
124
+ export { uSyncChangeView };
125
+ export default uSyncChangeView;
@@ -0,0 +1,20 @@
1
+ import { LitElement, nothing } from '@umbraco-cms/backoffice/external/lit';
2
+ import { SyncUpdateMessage, SyncHandlerSummary, SyncProgressSummary } from '@jumoo/uSync';
3
+ declare const uSyncProcessBox_base: import("@umbraco-cms/backoffice/extension-api").HTMLElementConstructor<import("@umbraco-cms/backoffice/element-api").UmbElement> & typeof LitElement;
4
+ /**
5
+ * Provides the progress box while things happen.
6
+ */
7
+ export declare class uSyncProcessBox extends uSyncProcessBox_base {
8
+ #private;
9
+ constructor();
10
+ updateMsg?: SyncUpdateMessage;
11
+ addMsg?: SyncProgressSummary;
12
+ title: string;
13
+ actions?: Array<SyncHandlerSummary>;
14
+ complete: boolean;
15
+ showProgress: boolean;
16
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
17
+ renderBadge(action: SyncHandlerSummary): import("lit-html").TemplateResult<1> | undefined;
18
+ static styles: import("lit").CSSResult;
19
+ }
20
+ export default uSyncProcessBox;
@@ -0,0 +1,223 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _uSyncProcessBox_instances, _uSyncProcessBox_hideProgress, _uSyncProcessBox_camelize;
13
+ import { customElement, LitElement, css, html, property, nothing, state, classMap, } from '@umbraco-cms/backoffice/external/lit';
14
+ import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api';
15
+ import { USYNC_SIGNALR_CONTEXT_TOKEN, HandlerStatus, } from '@jumoo/uSync';
16
+ /**
17
+ * Provides the progress box while things happen.
18
+ */
19
+ let uSyncProcessBox = class uSyncProcessBox extends UmbElementMixin(LitElement) {
20
+ constructor() {
21
+ super();
22
+ _uSyncProcessBox_instances.add(this);
23
+ this.title = '';
24
+ this.complete = false;
25
+ this.showProgress = true;
26
+ this.consumeContext(USYNC_SIGNALR_CONTEXT_TOKEN, (_signalR) => {
27
+ if (!_signalR)
28
+ return;
29
+ this.observe(_signalR.update, (_update) => {
30
+ this.updateMsg = _update;
31
+ });
32
+ this.observe(_signalR.add, (_add) => {
33
+ this.addMsg = _add;
34
+ });
35
+ });
36
+ }
37
+ render() {
38
+ let actions = this.actions;
39
+ if (!this.actions || this.actions.length === 0) {
40
+ actions = this.addMsg?.handlers;
41
+ }
42
+ if (!actions)
43
+ return nothing;
44
+ let progress = 0;
45
+ const actionCount = actions.length;
46
+ const boxSize = 100 / actionCount;
47
+ const actionProgress = (this.updateMsg?.count ?? 0) / (this.updateMsg?.total ?? 1);
48
+ let actionHtml = actions?.map((action) => {
49
+ if (action.status == HandlerStatus.COMPLETE)
50
+ progress++;
51
+ const actionName = __classPrivateFieldGet(this, _uSyncProcessBox_instances, "m", _uSyncProcessBox_camelize).call(this, action.name ?? 'unknown');
52
+ return html `
53
+ <div
54
+ class="action
55
+ ${action.status == HandlerStatus.COMPLETE ? 'complete' : ''}
56
+ ${action.status == HandlerStatus.PROCESSING ? 'working' : ''}">
57
+ <div class="icon-holder">
58
+ <uui-icon .name=${action.icon ?? 'icon-box'}></uui-icon>
59
+ ${this.renderBadge(action)}
60
+ </div>
61
+ <h4>${this.localize.termOrDefault(`treeHeaders_${actionName}`, actionName)}</h4>
62
+ </div>
63
+ `;
64
+ });
65
+ let overall = this.showProgress
66
+ ? progress * boxSize + actionProgress * boxSize - boxSize
67
+ : 0;
68
+ if (this.complete) {
69
+ __classPrivateFieldGet(this, _uSyncProcessBox_instances, "m", _uSyncProcessBox_hideProgress).call(this);
70
+ }
71
+ else {
72
+ this.showProgress = true;
73
+ }
74
+ const progressClass = { hidden: !this.showProgress };
75
+ return html `
76
+ <uui-box>
77
+ <h2>${this.localize.termOrDefault(`uSync_group${this.title}`, this.title)}</h2>
78
+ <div class="action-list">${actionHtml}</div>
79
+ <div class="update-box">${this.updateMsg?.message}</div>
80
+ <uui-progress-bar
81
+ progress=${overall}
82
+ class=${classMap(progressClass)}></uui-progress-bar>
83
+ </uui-box>
84
+ `;
85
+ }
86
+ renderBadge(action) {
87
+ if (action.status == HandlerStatus.PENDING)
88
+ return;
89
+ if (action.status == HandlerStatus.PROCESSING) {
90
+ return html `<uui-badge color="positive" look="default">
91
+ <uui-icon name="icon-circle-dotted" class="rotating"></uui-icon
92
+ ></uui-badge>`;
93
+ }
94
+ const color = action.inError ? 'warning' : 'positive';
95
+ const label = action.inError
96
+ ? 'Some errors occured duing import'
97
+ : 'Changes imported successfully';
98
+ if (!this.complete || action.changes == 0)
99
+ return html `<uui-badge .color=${color} look="default" title=${label}
100
+ ><uui-icon name="icon-check"></uui-icon
101
+ ></uui-badge>`;
102
+ return html `<uui-badge .color=${color} title=${label}>${action.changes}</uui-badge>`;
103
+ }
104
+ };
105
+ _uSyncProcessBox_instances = new WeakSet();
106
+ _uSyncProcessBox_hideProgress = function _uSyncProcessBox_hideProgress() {
107
+ window.setTimeout(() => {
108
+ this.showProgress = false;
109
+ }, 2000);
110
+ };
111
+ _uSyncProcessBox_camelize = function _uSyncProcessBox_camelize(str) {
112
+ return str
113
+ .replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
114
+ return index === 0 ? word.toLowerCase() : word.toUpperCase();
115
+ })
116
+ .replace(/\s+/g, '');
117
+ };
118
+ uSyncProcessBox.styles = css `
119
+ :host {
120
+ display: block;
121
+ }
122
+
123
+ h2 {
124
+ text-align: center;
125
+ margin: 0;
126
+ }
127
+
128
+ .action-list {
129
+ margin-top: var(--uui-size-space-4);
130
+ padding: var(--uui-size-space-4) 0;
131
+ display: flex;
132
+ flex-wrap: wrap;
133
+ justify-content: center;
134
+ }
135
+
136
+ .action {
137
+ display: flex;
138
+ flex-direction: column;
139
+ align-items: center;
140
+ min-width: var(--uui-size-layout-5);
141
+ color: var(--uui-color-text-alt);
142
+ opacity: 0.67;
143
+ margin: var(--uui-size-space-4) 0 var(--uui-size-space-6);
144
+ }
145
+
146
+ .action h4 {
147
+ margin: var(--uui-size-space-4) 0;
148
+ }
149
+
150
+ .icon-holder {
151
+ position: relative;
152
+ padding: 0 var(--uui-size-7);
153
+ }
154
+
155
+ .rotating {
156
+ animation: spin-animation 2s infinite;
157
+ animation-timing-function: linear;
158
+ display: inline-block;
159
+ }
160
+
161
+ @keyframes spin-animation {
162
+ 0% {
163
+ transform: rotate(360deg);
164
+ }
165
+ 100% {
166
+ transform: rotate(0deg);
167
+ }
168
+ }
169
+
170
+ .action uui-icon {
171
+ font-size: var(--uui-size-12);
172
+ }
173
+
174
+ .action uui-badge uui-icon {
175
+ font-size: var(--uui-type-h4-size);
176
+ }
177
+
178
+ .complete {
179
+ color: var(--uui-color-default-emphasis);
180
+ }
181
+
182
+ .working {
183
+ color: var(--uui-color-positive);
184
+ opacity: 1;
185
+ }
186
+
187
+ .update-box {
188
+ font-weight: bold;
189
+ text-align: center;
190
+ }
191
+
192
+ uui-progress-bar {
193
+ padding: 0;
194
+ margin: 0;
195
+ }
196
+
197
+ .hidden {
198
+ opacity: 0;
199
+ }
200
+ `;
201
+ __decorate([
202
+ state()
203
+ ], uSyncProcessBox.prototype, "updateMsg", void 0);
204
+ __decorate([
205
+ state()
206
+ ], uSyncProcessBox.prototype, "addMsg", void 0);
207
+ __decorate([
208
+ property({ type: String })
209
+ ], uSyncProcessBox.prototype, "title", void 0);
210
+ __decorate([
211
+ property({ type: Array })
212
+ ], uSyncProcessBox.prototype, "actions", void 0);
213
+ __decorate([
214
+ property({ type: Boolean })
215
+ ], uSyncProcessBox.prototype, "complete", void 0);
216
+ __decorate([
217
+ state()
218
+ ], uSyncProcessBox.prototype, "showProgress", void 0);
219
+ uSyncProcessBox = __decorate([
220
+ customElement('usync-progress-box')
221
+ ], uSyncProcessBox);
222
+ export { uSyncProcessBox };
223
+ export default uSyncProcessBox;
@@ -0,0 +1,15 @@
1
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
+ import { USyncActionView } from '../api';
3
+ export declare class uSyncResultRow extends UmbLitElement {
4
+ #private;
5
+ result?: USyncActionView;
6
+ render(): import("lit-html").TemplateResult<1> | null;
7
+ renderMessage(result: USyncActionView): import("lit-html").TemplateResult<1>;
8
+ static styles: import("lit").CSSResult;
9
+ }
10
+ export default uSyncResultRow;
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'usync-result-row': uSyncResultRow;
14
+ }
15
+ }
@@ -0,0 +1,133 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _uSyncResultRow_instances, _uSyncResultRow_showDetail, _uSyncResultRow_viewError;
13
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
14
+ import { ChangeType } from '../api';
15
+ import { customElement, property } from 'lit/decorators.js';
16
+ import { classMap, css, html } from '@umbraco-cms/backoffice/external/lit';
17
+ import { uSyncShowDetailEvent } from './events';
18
+ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
19
+ import { USYNC_ERROR_MODAL } from '../dialogs';
20
+ let uSyncResultRow = class uSyncResultRow extends UmbLitElement {
21
+ constructor() {
22
+ super(...arguments);
23
+ _uSyncResultRow_instances.add(this);
24
+ }
25
+ render() {
26
+ if (!this.result)
27
+ return null;
28
+ const result = this.result;
29
+ const icon = result.change == ChangeType.NO_CHANGE
30
+ ? 'icon-trafic'
31
+ : result.success
32
+ ? 'icon-check color-green'
33
+ : 'icon-wrong color-red';
34
+ const noChange = result.change == ChangeType.NO_CHANGE || result.change == ChangeType.EXPORT;
35
+ return html `<div
36
+ class="${classMap({ no_change: noChange })} row"
37
+ @click=${() => __classPrivateFieldGet(this, _uSyncResultRow_instances, "m", _uSyncResultRow_showDetail).call(this, result)}>
38
+ <div class="icon-cell" .noPadding=${true}>
39
+ <umb-icon .name=${icon}></umb-icon>
40
+ </div>
41
+ <div class="row-content" .clipText=${true}>
42
+ <div class="item-detail">
43
+ <div class="item-change">${result.change}</div>
44
+ </div>
45
+ <div class="item-name">
46
+ <div>${result.name}</div>
47
+ <div>${this.renderMessage(result)}</div>
48
+ </div>
49
+ </div>
50
+ </div>`;
51
+ }
52
+ renderMessage(result) {
53
+ return (result.change != ChangeType.FAIL &&
54
+ result.change != ChangeType.IMPORT_FAIL) ||
55
+ !result.message
56
+ ? html `<em>${result.message}</em>`
57
+ : html ` <uui-button
58
+ look="outline"
59
+ color="danger"
60
+ label="View error"
61
+ compact
62
+ @click=${(e) => __classPrivateFieldGet(this, _uSyncResultRow_instances, "m", _uSyncResultRow_viewError).call(this, e, result)}></uui-button>`;
63
+ }
64
+ };
65
+ _uSyncResultRow_instances = new WeakSet();
66
+ _uSyncResultRow_showDetail = async function _uSyncResultRow_showDetail(action) {
67
+ if (action.change == ChangeType.NO_CHANGE || action.change == ChangeType.EXPORT)
68
+ return;
69
+ this.dispatchEvent(new uSyncShowDetailEvent(action));
70
+ };
71
+ _uSyncResultRow_viewError = async function _uSyncResultRow_viewError(e, result) {
72
+ e.stopPropagation();
73
+ const modalContext = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
74
+ const modal = modalContext?.open(this, USYNC_ERROR_MODAL, {
75
+ data: {
76
+ action: result,
77
+ },
78
+ });
79
+ const data = await modal?.onSubmit().catch(() => {
80
+ return;
81
+ });
82
+ return data;
83
+ };
84
+ uSyncResultRow.styles = css `
85
+ .row {
86
+ display: flex;
87
+ align-items: center;
88
+ gap: var(--uui-size-space-5);
89
+ padding: var(--uui-size-space-5);
90
+ border-bottom: 1px solid var(--uui-color-border);
91
+ cursor: pointer;
92
+ }
93
+
94
+ .row:hover {
95
+ background-color: var(--uui-color-surface-alt);
96
+ }
97
+
98
+ .no_change {
99
+ color: var(--uui-color-disabled-contrast);
100
+ cursor: default;
101
+ }
102
+
103
+ .row-content {
104
+ gap: 10px;
105
+ flex-grow: 1;
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: space-between;
109
+ }
110
+
111
+ .item-name {
112
+ display: flex;
113
+ font-weight: bold;
114
+ align-items: center;
115
+ flex-grow: 2;
116
+ justify-content: space-between;
117
+ }
118
+
119
+ .item-detail {
120
+ display: flex;
121
+ flex-direction: column;
122
+ font-size: smaller;
123
+ min-width: 60px;
124
+ }
125
+ `;
126
+ __decorate([
127
+ property({ type: Object })
128
+ ], uSyncResultRow.prototype, "result", void 0);
129
+ uSyncResultRow = __decorate([
130
+ customElement('usync-result-row')
131
+ ], uSyncResultRow);
132
+ export { uSyncResultRow };
133
+ export default uSyncResultRow;
@@ -0,0 +1,19 @@
1
+ import { nothing } from '@umbraco-cms/backoffice/external/lit';
2
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
3
+ import { USyncActionView } from '../api';
4
+ export declare class uSyncResultGroupView extends UmbLitElement {
5
+ expanded: boolean;
6
+ showAll: boolean;
7
+ results: Array<USyncActionView>;
8
+ groupName: string;
9
+ getChangeCount(): number;
10
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
11
+ renderGroupedRows(results?: USyncActionView[]): (typeof nothing | import("lit-html").TemplateResult<1>)[] | undefined;
12
+ static styles: import("lit").CSSResult;
13
+ }
14
+ export default uSyncResultGroupView;
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'usync-result-group': uSyncResultGroupView;
18
+ }
19
+ }
@@ -0,0 +1,110 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { classMap, css, customElement, html, nothing, property, state, when, } from '@umbraco-cms/backoffice/external/lit';
8
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
9
+ import { ChangeType } from '../api';
10
+ let uSyncResultGroupView = class uSyncResultGroupView extends UmbLitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.expanded = false;
14
+ this.showAll = false;
15
+ this.results = [];
16
+ this.groupName = '';
17
+ }
18
+ getChangeCount() {
19
+ return this.results?.filter((r) => r.change !== ChangeType.NO_CHANGE).length;
20
+ }
21
+ render() {
22
+ const changeCount = this.getChangeCount() ?? 0;
23
+ if (changeCount === 0 && !this.showAll)
24
+ return nothing;
25
+ return html `
26
+ <uui-box
27
+ class=${classMap({
28
+ has_changes: changeCount > 0,
29
+ })}>
30
+ <div
31
+ class="summary ${when(this.expanded, () => 'expanded')}"
32
+ @click=${() => (this.expanded = !this.expanded)}>
33
+ <h4>${this.localize.termOrDefault('uSync_' + this.groupName, this.groupName)}</h4>
34
+ <div class="summary-right">
35
+ <h4 class="count">${changeCount}/${this.results?.length}</h4>
36
+ <uui-icon
37
+ name="icon-play"
38
+ class=${classMap({ expanded: this.expanded })}></uui-icon>
39
+ </div>
40
+ </div>
41
+ <uui-table>
42
+ ${when(this.expanded == true, () => html `${this.renderGroupedRows(this.results)}`)}
43
+ </uui-table>
44
+ </uui-box>
45
+ `;
46
+ }
47
+ renderGroupedRows(results) {
48
+ const rowsHtml = results?.map((result) => {
49
+ if (!this.showAll && result.change == ChangeType.NO_CHANGE)
50
+ return nothing;
51
+ return html `<usync-result-row .result=${result}></usync-result-row>`;
52
+ });
53
+ return rowsHtml;
54
+ }
55
+ };
56
+ uSyncResultGroupView.styles = css `
57
+ uui-box {
58
+ cursor: pointer;
59
+ --uui-box-default-padding: 0;
60
+ }
61
+
62
+ .expanded {
63
+ border-bottom: 1px solid var(--uui-color-border);
64
+ }
65
+
66
+ .summary {
67
+ display: flex;
68
+ margin: 0;
69
+ padding: 0 20px;
70
+ justify-content: space-between;
71
+ }
72
+
73
+ .summary-right {
74
+ display: flex;
75
+ align-items: center;
76
+ gap: var(--uui-size-space-2);
77
+ color: var(--uui-color-border-emphasis);
78
+ }
79
+
80
+ .summary-right uui-icon {
81
+ transform: rotate(90deg);
82
+ transition: transform 0.5s cubic-bezier(0.42, 0, 0.37, 1.62);
83
+ }
84
+
85
+ .summary-right uui-icon.expanded {
86
+ transform: rotate(-90deg);
87
+ border-bottom: none;
88
+ }
89
+
90
+ .count {
91
+ color: var(--uui-text);
92
+ }
93
+ `;
94
+ __decorate([
95
+ state()
96
+ ], uSyncResultGroupView.prototype, "expanded", void 0);
97
+ __decorate([
98
+ property({ type: Boolean })
99
+ ], uSyncResultGroupView.prototype, "showAll", void 0);
100
+ __decorate([
101
+ property({ type: Array })
102
+ ], uSyncResultGroupView.prototype, "results", void 0);
103
+ __decorate([
104
+ property({ type: String })
105
+ ], uSyncResultGroupView.prototype, "groupName", void 0);
106
+ uSyncResultGroupView = __decorate([
107
+ customElement('usync-result-group')
108
+ ], uSyncResultGroupView);
109
+ export { uSyncResultGroupView };
110
+ export default uSyncResultGroupView;
@@ -0,0 +1,17 @@
1
+ import { LitElement, nothing } from '@umbraco-cms/backoffice/external/lit';
2
+ import { USyncActionView } from '@jumoo/uSync';
3
+ declare const uSyncResultsView_base: import("@umbraco-cms/backoffice/extension-api").HTMLElementConstructor<import("@umbraco-cms/backoffice/element-api").UmbElement> & typeof LitElement;
4
+ export declare class uSyncResultsView extends uSyncResultsView_base {
5
+ #private;
6
+ constructor();
7
+ results: Array<USyncActionView> | undefined;
8
+ hideResultBar: boolean;
9
+ hideActions: boolean;
10
+ showAll: boolean;
11
+ changeCount: number;
12
+ groupBy<T>(arr: T[], fn: (item: T) => any): Record<string, T[]>;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ renderResultBar(count: number, changes: number): typeof nothing | import("lit-html").TemplateResult<1>;
15
+ static styles: import("lit").CSSResult;
16
+ }
17
+ export default uSyncResultsView;