@jumoo/usync 0.0.0-stage → 18.2.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 (197) 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 +3 -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 +2 -0
  30. package/dist/api/index.js +3 -0
  31. package/dist/api/sdk.gen.d.ts +32 -0
  32. package/dist/api/sdk.gen.js +95 -0
  33. package/dist/api/types.gen.d.ts +565 -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 +129 -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 +231 -0
  47. package/dist/components/usync-result-row.d.ts +15 -0
  48. package/dist/components/usync-result-row.js +137 -0
  49. package/dist/components/usync-results-group-view.d.ts +19 -0
  50. package/dist/components/usync-results-group-view.js +118 -0
  51. package/dist/components/usync-results-view.d.ts +17 -0
  52. package/dist/components/usync-results-view.js +177 -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 +106 -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 +55 -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 +106 -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/icons/icons.d.ts +5 -0
  90. package/dist/icons/icons.js +6 -0
  91. package/dist/icons/manifest.d.ts +1 -0
  92. package/dist/icons/manifest.js +7 -0
  93. package/dist/icons/svg/logo.d.ts +2 -0
  94. package/dist/icons/svg/logo.js +21 -0
  95. package/dist/index.d.ts +8 -0
  96. package/dist/index.js +19 -0
  97. package/dist/lang/files/da-dk.d.ts +130 -0
  98. package/dist/lang/files/da-dk.js +141 -0
  99. package/dist/lang/files/de-de.d.ts +130 -0
  100. package/dist/lang/files/de-de.js +141 -0
  101. package/dist/lang/files/en-us.d.ts +162 -0
  102. package/dist/lang/files/en-us.js +173 -0
  103. package/dist/lang/files/es-es.d.ts +130 -0
  104. package/dist/lang/files/es-es.js +141 -0
  105. package/dist/lang/files/fr-fr.d.ts +130 -0
  106. package/dist/lang/files/fr-fr.js +141 -0
  107. package/dist/lang/files/nl-nl.d.ts +130 -0
  108. package/dist/lang/files/nl-nl.js +141 -0
  109. package/dist/lang/manifest.d.ts +1 -0
  110. package/dist/lang/manifest.js +63 -0
  111. package/dist/manifests.d.ts +1 -0
  112. package/dist/manifests.js +14 -0
  113. package/dist/repository/SyncAction.respositoy.d.ts +121 -0
  114. package/dist/repository/SyncAction.respositoy.js +125 -0
  115. package/dist/repository/index.d.ts +4 -0
  116. package/dist/repository/index.js +4 -0
  117. package/dist/repository/sources/SyncAction.source.d.ts +57 -0
  118. package/dist/repository/sources/SyncAction.source.js +57 -0
  119. package/dist/repository/sources/SyncMigration.source.d.ts +13 -0
  120. package/dist/repository/sources/SyncMigration.source.js +30 -0
  121. package/dist/repository/sources/SyncSettings.source.d.ts +33 -0
  122. package/dist/repository/sources/SyncSettings.source.js +33 -0
  123. package/dist/signalr/index.d.ts +3 -0
  124. package/dist/signalr/index.js +3 -0
  125. package/dist/signalr/signalr-reconnect-policy.d.ts +11 -0
  126. package/dist/signalr/signalr-reconnect-policy.js +14 -0
  127. package/dist/signalr/signalr.context.d.ts +34 -0
  128. package/dist/signalr/signalr.context.js +110 -0
  129. package/dist/signalr/signalr.context.token.d.ts +3 -0
  130. package/dist/signalr/signalr.context.token.js +2 -0
  131. package/dist/signalr/types.d.ts +21 -0
  132. package/dist/signalr/types.js +1 -0
  133. package/dist/tree/constants.d.ts +1 -0
  134. package/dist/tree/constants.js +1 -0
  135. package/dist/tree/index.d.ts +2 -0
  136. package/dist/tree/index.js +2 -0
  137. package/dist/tree/manifest.d.ts +1 -0
  138. package/dist/tree/manifest.js +92 -0
  139. package/dist/tree/types.d.ts +14 -0
  140. package/dist/tree/types.js +1 -0
  141. package/dist/tree/usync.menu-element.d.ts +13 -0
  142. package/dist/tree/usync.menu-element.js +74 -0
  143. package/dist/utils/diff/change-name.d.ts +13 -0
  144. package/dist/utils/diff/change-name.js +30 -0
  145. package/dist/utils/diff/classify-change.d.ts +21 -0
  146. package/dist/utils/diff/classify-change.js +111 -0
  147. package/dist/utils/diff/deep-equal.d.ts +13 -0
  148. package/dist/utils/diff/deep-equal.js +57 -0
  149. package/dist/utils/diff/format-value.d.ts +36 -0
  150. package/dist/utils/diff/format-value.js +88 -0
  151. package/dist/utils/diff/index.d.ts +7 -0
  152. package/dist/utils/diff/index.js +7 -0
  153. package/dist/utils/diff/json-diff.d.ts +34 -0
  154. package/dist/utils/diff/json-diff.js +300 -0
  155. package/dist/utils/diff/line-diff.d.ts +16 -0
  156. package/dist/utils/diff/line-diff.js +199 -0
  157. package/dist/utils/diff/types.d.ts +62 -0
  158. package/dist/utils/diff/types.js +12 -0
  159. package/dist/workspace/components/events.d.ts +31 -0
  160. package/dist/workspace/components/events.js +54 -0
  161. package/dist/workspace/components/index.d.ts +3 -0
  162. package/dist/workspace/components/index.js +3 -0
  163. package/dist/workspace/components/usync-action-button.d.ts +20 -0
  164. package/dist/workspace/components/usync-action-button.js +121 -0
  165. package/dist/workspace/components/usync-file-picker.element.d.ts +23 -0
  166. package/dist/workspace/components/usync-file-picker.element.js +106 -0
  167. package/dist/workspace/components/usync-file-upload.element.d.ts +21 -0
  168. package/dist/workspace/components/usync-file-upload.element.js +121 -0
  169. package/dist/workspace/dialogs/import-modal.element.d.ts +11 -0
  170. package/dist/workspace/dialogs/import-modal.element.js +75 -0
  171. package/dist/workspace/dialogs/import-modal.token.d.ts +6 -0
  172. package/dist/workspace/dialogs/import-modal.token.js +6 -0
  173. package/dist/workspace/dialogs/index.d.ts +2 -0
  174. package/dist/workspace/dialogs/index.js +2 -0
  175. package/dist/workspace/dialogs/manifest.d.ts +1 -0
  176. package/dist/workspace/dialogs/manifest.js +7 -0
  177. package/dist/workspace/index.d.ts +3 -0
  178. package/dist/workspace/index.js +3 -0
  179. package/dist/workspace/manifest.d.ts +3 -0
  180. package/dist/workspace/manifest.js +112 -0
  181. package/dist/workspace/types.d.ts +12 -0
  182. package/dist/workspace/types.js +1 -0
  183. package/dist/workspace/views/addons/addons.element.d.ts +7 -0
  184. package/dist/workspace/views/addons/addons.element.js +117 -0
  185. package/dist/workspace/views/default/default.element.d.ts +31 -0
  186. package/dist/workspace/views/default/default.element.js +466 -0
  187. package/dist/workspace/views/legacy/legacy.element.d.ts +14 -0
  188. package/dist/workspace/views/legacy/legacy.element.js +187 -0
  189. package/dist/workspace/views/settings/components/usyncSettingItem.element.d.ts +15 -0
  190. package/dist/workspace/views/settings/components/usyncSettingItem.element.js +96 -0
  191. package/dist/workspace/views/settings/settings.element.d.ts +17 -0
  192. package/dist/workspace/views/settings/settings.element.js +174 -0
  193. package/dist/workspace/workspace.context.d.ts +79 -0
  194. package/dist/workspace/workspace.context.js +448 -0
  195. package/dist/workspace/workspace.element.d.ts +17 -0
  196. package/dist/workspace/workspace.element.js +69 -0
  197. package/package.json +77 -6
@@ -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;
@@ -0,0 +1,177 @@
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15
+ 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");
16
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
+ };
18
+ var _uSyncResultsView_instances, _uSyncResultsView_modalContext, _uSyncResultsView_toggleShowAll, _uSyncResultsView_showDetail;
19
+ import { LitElement, html, customElement, property, css, state, nothing, } from '@umbraco-cms/backoffice/external/lit';
20
+ import { ChangeType } from '@jumoo/uSync';
21
+ import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api';
22
+ import { UMB_MODAL_MANAGER_CONTEXT, } from '@umbraco-cms/backoffice/modal';
23
+ import { USYNC_DETAILS_MODAL } from '@jumoo/uSync';
24
+ let uSyncResultsView = class uSyncResultsView extends UmbElementMixin(LitElement) {
25
+ constructor() {
26
+ super();
27
+ _uSyncResultsView_instances.add(this);
28
+ _uSyncResultsView_modalContext.set(this, void 0);
29
+ this.results = [];
30
+ this.hideResultBar = false;
31
+ this.hideActions = false;
32
+ this.showAll = false;
33
+ this.changeCount = 0;
34
+ this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (_instance) => {
35
+ __classPrivateFieldSet(this, _uSyncResultsView_modalContext, _instance, "f");
36
+ });
37
+ }
38
+ groupBy(arr, fn) {
39
+ return arr.reduce((prev, curr) => {
40
+ const groupKey = fn(curr);
41
+ const group = prev[groupKey] || [];
42
+ group.push(curr);
43
+ return { ...prev, [groupKey]: group };
44
+ }, {});
45
+ }
46
+ render() {
47
+ this.changeCount =
48
+ this.results?.filter((r) => r.change !== ChangeType.NO_CHANGE).length ?? 0;
49
+ const groups = this.groupBy(this.results || [], (result) => result.itemType);
50
+ const groupsHtml = [];
51
+ for (const key in groups) {
52
+ const groupChanges = groups[key].filter((r) => r.change !== ChangeType.NO_CHANGE).length ?? 0;
53
+ if (groupChanges === 0 && !this.showAll)
54
+ continue;
55
+ const groupHtml = html `<usync-result-group
56
+ .groupName=${key}
57
+ .results=${groups[key]}
58
+ .showAll=${this.showAll}
59
+ @show-detail=${__classPrivateFieldGet(this, _uSyncResultsView_instances, "m", _uSyncResultsView_showDetail)}></usync-result-group> `;
60
+ groupsHtml.push(groupHtml);
61
+ }
62
+ return this.changeCount == 0 && !this.showAll
63
+ ? html `
64
+ ${this.renderResultBar(this.results?.length || 0, this.changeCount)}
65
+ <div class="empty">
66
+ <umb-localize key="uSync_noChange"></umb-localize>
67
+ </div>
68
+ `
69
+ : html `<div id="result-box">
70
+ ${this.renderResultBar(this.results?.length || 0, this.changeCount)}
71
+ ${groupsHtml}
72
+ </div>`;
73
+ }
74
+ renderResultBar(count, changes) {
75
+ if (this.hideResultBar)
76
+ return nothing;
77
+ const localKey = changes === 0 ? 'uSync_noChangeCount' : 'uSync_changeCount';
78
+ return html `<div class="result-header">
79
+ <uui-toggle
80
+ .label=${this.localize.termOrDefault('uSync_showAll', 'Show all items')}
81
+ ?checked=${this.showAll}
82
+ @change=${__classPrivateFieldGet(this, _uSyncResultsView_instances, "m", _uSyncResultsView_toggleShowAll)}></uui-toggle>
83
+ <umb-localize .key=${localKey} .args=${[count, changes]}
84
+ >${changes}/${count} items</umb-localize
85
+ >
86
+ </div>`;
87
+ }
88
+ };
89
+ _uSyncResultsView_modalContext = new WeakMap();
90
+ _uSyncResultsView_instances = new WeakSet();
91
+ _uSyncResultsView_toggleShowAll = function _uSyncResultsView_toggleShowAll() {
92
+ this.showAll = !this.showAll;
93
+ };
94
+ _uSyncResultsView_showDetail = async function _uSyncResultsView_showDetail(e) {
95
+ console.debug('Showing detail for action:', e.action);
96
+ if (e.action.change == ChangeType.EXPORT)
97
+ return;
98
+ const detailsModal = __classPrivateFieldGet(this, _uSyncResultsView_modalContext, "f")?.open(this, USYNC_DETAILS_MODAL, {
99
+ data: {
100
+ item: e.action,
101
+ showActions: !this.hideActions &&
102
+ (e.action.change == ChangeType.CREATE ||
103
+ e.action.change == ChangeType.UPDATE ||
104
+ e.action.change == ChangeType.IMPORT),
105
+ },
106
+ });
107
+ const data = await detailsModal?.onSubmit().catch(() => {
108
+ return;
109
+ });
110
+ if (!data)
111
+ return;
112
+ };
113
+ uSyncResultsView.styles = css `
114
+ :host {
115
+ display: block;
116
+ margin: var(--uui-size-space-4) 0;
117
+ display: flex;
118
+ flex-direction: column;
119
+ gap: var(--uui-size-space-4);
120
+ }
121
+
122
+ #result-box {
123
+ display: flex;
124
+ flex-direction: column;
125
+ gap: var(--uui-size-space-4);
126
+ }
127
+
128
+ uui-table {
129
+ position: relative;
130
+ z-index: 100;
131
+ }
132
+
133
+ .result-header {
134
+ display: flex;
135
+ justify-content: space-between;
136
+ padding: var(--uui-size-space-4);
137
+ border: 1px solid var(--uui-color-border);
138
+ border-radius: var(--uui-border-radius);
139
+ padding: var(--uui-size-space-4);
140
+ }
141
+
142
+ .result-header h3 {
143
+ margin: 0;
144
+ padding: 0;
145
+ }
146
+
147
+ .empty {
148
+ padding: var(--uui-size-20);
149
+ font-size: var(--uui-type-h5-size);
150
+ text-align: center;
151
+ font-weight: 900;
152
+ }
153
+
154
+ .error {
155
+ background-color: #fce4ec;
156
+ }
157
+ `;
158
+ __decorate([
159
+ property({ type: Array })
160
+ ], uSyncResultsView.prototype, "results", void 0);
161
+ __decorate([
162
+ property({ type: Boolean })
163
+ ], uSyncResultsView.prototype, "hideResultBar", void 0);
164
+ __decorate([
165
+ property({ type: Boolean })
166
+ ], uSyncResultsView.prototype, "hideActions", void 0);
167
+ __decorate([
168
+ state()
169
+ ], uSyncResultsView.prototype, "showAll", void 0);
170
+ __decorate([
171
+ state()
172
+ ], uSyncResultsView.prototype, "changeCount", void 0);
173
+ uSyncResultsView = __decorate([
174
+ customElement('usync-results')
175
+ ], uSyncResultsView);
176
+ export { uSyncResultsView };
177
+ export default uSyncResultsView;
@@ -0,0 +1,15 @@
1
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
+ import { SyncFileVersionCheckResult } from '../api';
3
+ import { nothing } from '@umbraco-cms/backoffice/external/lit';
4
+ export declare class uSyncSyncFileInfoView extends UmbLitElement {
5
+ #private;
6
+ _syncFileInfo?: SyncFileVersionCheckResult;
7
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
8
+ static styles?: import("lit").CSSResult[] | undefined;
9
+ }
10
+ export default uSyncSyncFileInfoView;
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'usync-sync-file-info': uSyncSyncFileInfoView;
14
+ }
15
+ }
@@ -0,0 +1,62 @@
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 _uSyncSyncFileInfoView_instances, _uSyncSyncFileInfoView_renderHmacMismatch, _uSyncSyncFileInfoView_renderFormatMismatch;
13
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
14
+ import { customElement, property } from 'lit/decorators.js';
15
+ import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit';
16
+ let uSyncSyncFileInfoView = class uSyncSyncFileInfoView extends UmbLitElement {
17
+ constructor() {
18
+ super(...arguments);
19
+ _uSyncSyncFileInfoView_instances.add(this);
20
+ }
21
+ render() {
22
+ if (!this._syncFileInfo)
23
+ return nothing;
24
+ return html `${__classPrivateFieldGet(this, _uSyncSyncFileInfoView_instances, "m", _uSyncSyncFileInfoView_renderHmacMismatch).call(this)} ${__classPrivateFieldGet(this, _uSyncSyncFileInfoView_instances, "m", _uSyncSyncFileInfoView_renderFormatMismatch).call(this)}`;
25
+ }
26
+ };
27
+ _uSyncSyncFileInfoView_instances = new WeakSet();
28
+ _uSyncSyncFileInfoView_renderHmacMismatch = function _uSyncSyncFileInfoView_renderHmacMismatch() {
29
+ if (!this._syncFileInfo)
30
+ return nothing;
31
+ if (this._syncFileInfo.hmacMatch)
32
+ return nothing;
33
+ return html `<div class="banner">
34
+ <umb-localize key="uSync_hmacMismatch"></umb-localize>
35
+ </div>`;
36
+ };
37
+ _uSyncSyncFileInfoView_renderFormatMismatch = function _uSyncSyncFileInfoView_renderFormatMismatch() {
38
+ if (!this._syncFileInfo)
39
+ return nothing;
40
+ if (this._syncFileInfo.isCurrent)
41
+ return nothing;
42
+ return html `<div class="banner">
43
+ <umb-localize key="uSync_formatMismatch"></umb-localize>
44
+ </div>`;
45
+ };
46
+ uSyncSyncFileInfoView.styles = [
47
+ css `
48
+ .banner {
49
+ padding: var(--uui-size-space-2) var(--uui-size-space-4);
50
+ margin: 0 0 var(--uui-size-space-4);
51
+ background-color: var(--uui-color-surface);
52
+ }
53
+ `,
54
+ ];
55
+ __decorate([
56
+ property({ type: Object })
57
+ ], uSyncSyncFileInfoView.prototype, "_syncFileInfo", void 0);
58
+ uSyncSyncFileInfoView = __decorate([
59
+ customElement('usync-sync-file-info')
60
+ ], uSyncSyncFileInfoView);
61
+ export { uSyncSyncFileInfoView };
62
+ export default uSyncSyncFileInfoView;
@@ -0,0 +1 @@
1
+ export declare const USYNC_CONDITION_NEW_SECTION = "usync.condition.new-section";
@@ -0,0 +1 @@
1
+ export const USYNC_CONDITION_NEW_SECTION = 'usync.condition.new-section';
@@ -0,0 +1,2 @@
1
+ export * from './legacy-files.condition.js';
2
+ export * from './new-section.condition.js';
@@ -0,0 +1,2 @@
1
+ export * from './legacy-files.condition.js';
2
+ export * from './new-section.condition.js';
@@ -0,0 +1,10 @@
1
+ import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
2
+ import { UmbConditionConfigBase, UmbConditionControllerArguments } from '@umbraco-cms/backoffice/extension-api';
3
+ import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
4
+ export type SyncLegacyFilesConditionConfig = UmbConditionConfigBase & {
5
+ hasLegacyFiles: boolean;
6
+ };
7
+ export declare class SyncLegacyFilesCondition extends UmbConditionBase<SyncLegacyFilesConditionConfig> {
8
+ config: SyncLegacyFilesConditionConfig;
9
+ constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<SyncLegacyFilesConditionConfig>);
10
+ }
@@ -0,0 +1,16 @@
1
+ import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
2
+ import { USYNC_CORE_CONTEXT_TOKEN } from '@jumoo/uSync';
3
+ export class SyncLegacyFilesCondition extends UmbConditionBase {
4
+ constructor(host, args) {
5
+ super(host, args);
6
+ this.config = args.config;
7
+ this.consumeContext(USYNC_CORE_CONTEXT_TOKEN, (_instance) => {
8
+ if (!_instance)
9
+ return;
10
+ // consuming the context means it only happens when the context exists.
11
+ _instance.checkLegacy().then((response) => {
12
+ this.permitted = response?.hasLegacy ?? false;
13
+ });
14
+ });
15
+ }
16
+ }
@@ -0,0 +1 @@
1
+ export declare const manifests: UmbExtensionManifest[];
@@ -0,0 +1,18 @@
1
+ import { SyncLegacyFilesCondition } from '@jumoo/uSync';
2
+ import { uSyncConstants } from '@jumoo/uSync';
3
+ import { USYNC_CONDITION_NEW_SECTION } from './constants';
4
+ import { SyncNewSectionCondition } from './new-section.condition';
5
+ export const manifests = [
6
+ {
7
+ type: 'condition',
8
+ alias: uSyncConstants.conditions.legacy,
9
+ name: 'uSync Legacy Files Condition',
10
+ api: SyncLegacyFilesCondition,
11
+ },
12
+ {
13
+ type: 'condition',
14
+ alias: USYNC_CONDITION_NEW_SECTION,
15
+ name: 'uSync New Section Condition',
16
+ api: SyncNewSectionCondition,
17
+ },
18
+ ];
@@ -0,0 +1,8 @@
1
+ import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
2
+ import { UmbConditionConfigBase, UmbConditionControllerArguments } from '@umbraco-cms/backoffice/extension-api';
3
+ import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
4
+ export type SyncNewSectionConditionConfig = UmbConditionConfigBase & {};
5
+ export declare class SyncNewSectionCondition extends UmbConditionBase<SyncNewSectionConditionConfig> {
6
+ #private;
7
+ constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<SyncNewSectionConditionConfig>);
8
+ }
@@ -0,0 +1,48 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
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 _SyncNewSectionCondition_instances, _SyncNewSectionCondition_currentSection, _SyncNewSectionCondition_allSections, _SyncNewSectionCondition_checkPermission;
13
+ import { UmbExtensionsManifestInitializer, } from '@umbraco-cms/backoffice/extension-api';
14
+ import { UmbConditionBase, umbExtensionsRegistry, } from '@umbraco-cms/backoffice/extension-registry';
15
+ import { UMB_SECTION_CONTEXT } from '@umbraco-cms/backoffice/section';
16
+ import { USYNC_SECTION_ALIAS } from '../tree/constants';
17
+ export class SyncNewSectionCondition extends UmbConditionBase {
18
+ constructor(host, args) {
19
+ super(host, args);
20
+ _SyncNewSectionCondition_instances.add(this);
21
+ _SyncNewSectionCondition_currentSection.set(this, void 0);
22
+ _SyncNewSectionCondition_allSections.set(this, void 0);
23
+ new UmbExtensionsManifestInitializer(this, umbExtensionsRegistry, 'section', () => true, async (sections) => {
24
+ __classPrivateFieldSet(this, _SyncNewSectionCondition_allSections, sections.map((section) => section.alias), "f");
25
+ this.permitted = __classPrivateFieldGet(this, _SyncNewSectionCondition_instances, "m", _SyncNewSectionCondition_checkPermission).call(this);
26
+ }, 'uSyncAllSectionsManifestFilter');
27
+ this.consumeContext(UMB_SECTION_CONTEXT, (_context) => {
28
+ if (!_context)
29
+ return;
30
+ this.observe(_context.alias, (_alias) => {
31
+ __classPrivateFieldSet(this, _SyncNewSectionCondition_currentSection, _alias, "f");
32
+ this.permitted = __classPrivateFieldGet(this, _SyncNewSectionCondition_instances, "m", _SyncNewSectionCondition_checkPermission).call(this);
33
+ });
34
+ });
35
+ }
36
+ }
37
+ _SyncNewSectionCondition_currentSection = new WeakMap(), _SyncNewSectionCondition_allSections = new WeakMap(), _SyncNewSectionCondition_instances = new WeakSet(), _SyncNewSectionCondition_checkPermission = function _SyncNewSectionCondition_checkPermission() {
38
+ if (!__classPrivateFieldGet(this, _SyncNewSectionCondition_currentSection, "f"))
39
+ return false;
40
+ if (!__classPrivateFieldGet(this, _SyncNewSectionCondition_allSections, "f"))
41
+ return false;
42
+ // if the new section isn't defined, this will still show in settings.
43
+ if (!__classPrivateFieldGet(this, _SyncNewSectionCondition_allSections, "f").includes(USYNC_SECTION_ALIAS))
44
+ return true;
45
+ if (__classPrivateFieldGet(this, _SyncNewSectionCondition_currentSection, "f") === USYNC_SECTION_ALIAS)
46
+ return true;
47
+ return false;
48
+ };
@@ -0,0 +1,30 @@
1
+ export declare const uSyncConstants: {
2
+ name: string;
3
+ path: string;
4
+ icon: string;
5
+ menuName: string;
6
+ menuAlias: string;
7
+ version: string;
8
+ conditions: {
9
+ legacy: string;
10
+ };
11
+ workspace: {
12
+ alias: string;
13
+ rootElement: string;
14
+ elementName: string;
15
+ contextAlias: string;
16
+ defaultView: {
17
+ alias: string;
18
+ };
19
+ settingView: {
20
+ alias: string;
21
+ };
22
+ addOnView: {
23
+ alias: string;
24
+ };
25
+ legacyView: {
26
+ alias: string;
27
+ };
28
+ };
29
+ };
30
+ export declare const uSyncTimeFormatOptions: Intl.DateTimeFormatOptions;
@@ -0,0 +1,38 @@
1
+ const _constants = {
2
+ name: 'uSync',
3
+ path: 'usync',
4
+ icon: 'icon-infinity',
5
+ menuName: 'Syncronisation',
6
+ menuAlias: 'usync.menu',
7
+ version: '17.x',
8
+ conditions: {
9
+ legacy: 'usync.legacy.condition',
10
+ },
11
+ workspace: {
12
+ alias: 'usync.workspace',
13
+ rootElement: 'usync-root',
14
+ elementName: 'usync-workspace-root',
15
+ contextAlias: 'usync.workspace.context',
16
+ defaultView: {
17
+ alias: 'usync.workspace.default',
18
+ },
19
+ settingView: {
20
+ alias: 'usync.workspace.settings',
21
+ },
22
+ addOnView: {
23
+ alias: 'usync.workspace.addons',
24
+ },
25
+ legacyView: {
26
+ alias: 'usync.workspace.legacy',
27
+ },
28
+ },
29
+ };
30
+ export const uSyncConstants = _constants;
31
+ export const uSyncTimeFormatOptions = {
32
+ year: 'numeric',
33
+ month: 'short',
34
+ day: 'numeric',
35
+ hour: 'numeric',
36
+ minute: 'numeric',
37
+ second: 'numeric',
38
+ };
@@ -0,0 +1,18 @@
1
+ import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
2
+ import { nothing } from '@umbraco-cms/backoffice/external/lit';
3
+ import { uSyncDetailsModalData, uSyncDetailsModalValue } from '@jumoo/uSync';
4
+ import { UUIButtonState } from '@umbraco-cms/backoffice/external/uui';
5
+ export declare class uSyncDetailsModalElement extends UmbModalBaseElement<uSyncDetailsModalData, uSyncDetailsModalValue> {
6
+ #private;
7
+ importState: UUIButtonState;
8
+ constructor();
9
+ render(): import("lit-html").TemplateResult<1>;
10
+ renderActions(): typeof nothing | import("lit-html").TemplateResult<1>;
11
+ static styles: import("lit").CSSResult;
12
+ }
13
+ export default uSyncDetailsModalElement;
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ 'usync-details-modal': uSyncDetailsModalElement;
17
+ }
18
+ }
@@ -0,0 +1,106 @@
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 _uSyncDetailsModalElement_instances, _uSyncDetailsModalElement_onImport, _uSyncDetailsModalElement_onClose;
13
+ import { UMB_MODAL_MANAGER_CONTEXT, UmbModalBaseElement, } from '@umbraco-cms/backoffice/modal';
14
+ import { css, customElement, html, nothing, state, } from '@umbraco-cms/backoffice/external/lit';
15
+ import { USYNC_IMPORT_SINGLE_MODAL, } from '@jumoo/uSync';
16
+ let uSyncDetailsModalElement = class uSyncDetailsModalElement extends UmbModalBaseElement {
17
+ constructor() {
18
+ super();
19
+ _uSyncDetailsModalElement_instances.add(this);
20
+ // this.consumeContext(USYNC_CORE_CONTEXT_TOKEN, (_instance) => {
21
+ // if (!_instance) return;
22
+ // this.#actionContext = _instance;
23
+ // });
24
+ }
25
+ render() {
26
+ return html `
27
+ <umb-body-layout headline="Changes : ${this.data?.item.name ?? ''}">
28
+ <div class="layout">
29
+ <uui-box style="--uui-box-default-padding: 0;">
30
+ <div class="headline">
31
+ <div>
32
+ <h3><umb-localize key="uSync_detailHeadline"></umb-localize></h3>
33
+ <umb-localize key="uSync_detailHeader"></umb-localize>
34
+ </div>
35
+ <div>${this.renderActions()}</div>
36
+ </div>
37
+ </uui-box>
38
+ <usync-change-view .item=${this.data?.item}></usync-change-view>
39
+ </div>
40
+ <div slot="actions">
41
+ <uui-button
42
+ id="cancel"
43
+ .label=${this.localize.term('general_close')}
44
+ look="outline"
45
+ @click="${__classPrivateFieldGet(this, _uSyncDetailsModalElement_instances, "m", _uSyncDetailsModalElement_onClose)}"></uui-button>
46
+ </div>
47
+ </umb-body-layout>
48
+ `;
49
+ }
50
+ renderActions() {
51
+ if (!this.data?.showActions)
52
+ return nothing;
53
+ return html ` <uui-button
54
+ id="import"
55
+ type="button"
56
+ look="outline"
57
+ .state=${this.importState}
58
+ .label=${this.localize.termOrDefault('uSync_importSingle', 'Import')}
59
+ @click="${__classPrivateFieldGet(this, _uSyncDetailsModalElement_instances, "m", _uSyncDetailsModalElement_onImport)}"></uui-button>`;
60
+ }
61
+ };
62
+ _uSyncDetailsModalElement_instances = new WeakSet();
63
+ _uSyncDetailsModalElement_onImport = async function _uSyncDetailsModalElement_onImport(e) {
64
+ e.stopPropagation();
65
+ if (!this.data?.item)
66
+ return;
67
+ const modalContext = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
68
+ if (!modalContext)
69
+ return;
70
+ const modal = modalContext.open(this, USYNC_IMPORT_SINGLE_MODAL, {
71
+ data: { action: this.data?.item },
72
+ });
73
+ const data = await modal?.onSubmit().catch(() => {
74
+ return;
75
+ });
76
+ return data;
77
+ };
78
+ _uSyncDetailsModalElement_onClose = function _uSyncDetailsModalElement_onClose() {
79
+ this.modalContext?.reject();
80
+ };
81
+ uSyncDetailsModalElement.styles = css `
82
+ .layout {
83
+ display: flex;
84
+ flex-direction: column;
85
+ gap: var(--uui-size-space-4);
86
+ }
87
+
88
+ .headline {
89
+ display: flex;
90
+ justify-content: space-between;
91
+ padding: var(--uui-size-space-4);
92
+ align-items: center;
93
+ }
94
+
95
+ .headline h3 {
96
+ margin: 0;
97
+ }
98
+ `;
99
+ __decorate([
100
+ state()
101
+ ], uSyncDetailsModalElement.prototype, "importState", void 0);
102
+ uSyncDetailsModalElement = __decorate([
103
+ customElement('usync-details-modal')
104
+ ], uSyncDetailsModalElement);
105
+ export { uSyncDetailsModalElement };
106
+ export default uSyncDetailsModalElement;
@@ -0,0 +1,10 @@
1
+ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
2
+ import { USyncActionView } from '@jumoo/uSync';
3
+ export interface uSyncDetailsModalData {
4
+ item: USyncActionView;
5
+ showActions?: boolean;
6
+ }
7
+ export interface uSyncDetailsModalValue {
8
+ result: boolean;
9
+ }
10
+ export declare const USYNC_DETAILS_MODAL: UmbModalToken<uSyncDetailsModalData, uSyncDetailsModalValue>;
@@ -0,0 +1,7 @@
1
+ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
2
+ export const USYNC_DETAILS_MODAL = new UmbModalToken('usync.details.modal', {
3
+ modal: {
4
+ type: 'sidebar',
5
+ size: 'large',
6
+ },
7
+ });
@@ -0,0 +1,7 @@
1
+ import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
2
+ import { uSyncErrorModalData, uSyncErrorModalValue } from './error-modal-token';
3
+ export default class uSyncErrorModalElement extends UmbModalBaseElement<uSyncErrorModalData, uSyncErrorModalValue> {
4
+ #private;
5
+ render(): import("lit-html").TemplateResult<1>;
6
+ static styles: import("lit").CSSResult;
7
+ }