@jumoo/usync 0.0.0-stage → 17.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/LICENCE +373 -0
  2. package/README.md +9 -2
  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 +69 -5
@@ -0,0 +1,709 @@
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 _uSyncChangeDetail_instances, _uSyncChangeDetail_toggleOpen, _uSyncChangeDetail_toggleRun, _uSyncChangeDetail_toggleLeaf, _uSyncChangeDetail_toggleRaw, _uSyncChangeDetail_copyPath, _uSyncChangeDetail_isExpandable, _uSyncChangeDetail_lineCounts, _uSyncChangeDetail_renderSummary, _uSyncChangeDetail_renderBody, _uSyncChangeDetail_renderJsonBody, _uSyncChangeDetail_renderLeaf, _uSyncChangeDetail_renderLeafValue, _uSyncChangeDetail_renderLinesBody, _uSyncChangeDetail_renderLineRow, _uSyncChangeDetail_renderCollapsed, _uSyncChangeDetail_renderWordsBody, _uSyncChangeDetail_renderSingleBody, _uSyncChangeDetail_renderMaskedBody, _uSyncChangeDetail_renderOversizedBody, _uSyncChangeDetail_renderNoticeBody;
13
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
14
+ import { classMap, css, customElement, html, nothing, property, state, styleMap, when, } from '@umbraco-cms/backoffice/external/lit';
15
+ import '@umbraco-cms/backoffice/components';
16
+ import { diffWords } from '@umbraco-cms/backoffice/utils';
17
+ import { ChangeDetailType } from '../api';
18
+ import { USYNC_DIFF_LIMITS, classifyChange, collapseUnchanged, diffJsonValues, diffTextLines, formatDiffPath, formatLeafValue, parseChangeName, prettyJson, } from '../utils/diff/index.js';
19
+ /**
20
+ * Renders a single `USyncChange` detail as an expandable row, using the
21
+ * strategy chosen by `classifyChange` to pick a compact, readable diff
22
+ * rather than a wall of pretty-printed JSON.
23
+ */
24
+ let uSyncChangeDetail = class uSyncChangeDetail extends UmbLitElement {
25
+ constructor() {
26
+ super(...arguments);
27
+ _uSyncChangeDetail_instances.add(this);
28
+ this.open = false;
29
+ this._lineDegraded = false;
30
+ this._showRaw = false;
31
+ this._expandedRuns = new Set();
32
+ this._expandedLeaves = new Set();
33
+ }
34
+ // Diffing happens here, and only here - `render()` runs on every property
35
+ // change (including a plain expand/collapse click), so computing the
36
+ // diff there would re-diff on every toggle instead of once per detail.
37
+ willUpdate(changed) {
38
+ if (!changed.has('detail') || !this.detail)
39
+ return;
40
+ const detail = this.detail;
41
+ this._label = parseChangeName(detail.name);
42
+ this._classified = classifyChange(detail);
43
+ this._json =
44
+ this._classified.strategy === 'json'
45
+ ? diffJsonValues(this._classified.oldJson, this._classified.newJson)
46
+ : undefined;
47
+ if (this._classified.strategy === 'lines') {
48
+ const lineDiff = diffTextLines(this._classified.oldText, this._classified.newText);
49
+ this._lines = collapseUnchanged(lineDiff.rows);
50
+ this._lineDegraded = lineDiff.degraded;
51
+ }
52
+ else {
53
+ this._lines = undefined;
54
+ this._lineDegraded = false;
55
+ }
56
+ this._expandedRuns.clear();
57
+ this._expandedLeaves.clear();
58
+ this._showRaw = false;
59
+ if (detail.success === false) {
60
+ this.open = true;
61
+ }
62
+ }
63
+ render() {
64
+ if (!this.detail || !this._classified)
65
+ return nothing;
66
+ const detail = this.detail;
67
+ const classified = this._classified;
68
+ const failed = detail.success === false;
69
+ const expandable = __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_isExpandable).call(this, classified.strategy);
70
+ const isOpen = this.open;
71
+ return html `
72
+ <div class=${classMap({ 'change-row': true, danger: failed })}>
73
+ <div
74
+ class=${classMap({ summary: true, expanded: isOpen, static: !expandable })}
75
+ @click=${expandable ? __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_toggleOpen) : undefined}>
76
+ <div class="summary-left">
77
+ ${when(failed, () => html `<umb-icon name="icon-alert" class="color-red"></umb-icon>`)}
78
+ ${when(this._label?.prefix, () => html `<span class="prefix"
79
+ >${this.localize.term('uSync_changeProperty')}</span
80
+ >`)}
81
+ <span class="label" title=${detail.path}
82
+ >${this._label?.label || detail.name}</span
83
+ >
84
+ ${when(this._label?.culture, () => html `<uui-tag size="s" look="secondary"
85
+ >${this._label.culture}</uui-tag
86
+ >`)}
87
+ </div>
88
+ <div class="summary-right">
89
+ <span class=${classMap({ danger: classified.strategy === 'notice' })}
90
+ >${__classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderSummary).call(this, classified)}</span
91
+ >
92
+ ${when(expandable, () => html `<uui-icon
93
+ name="icon-play"
94
+ class=${classMap({ expanded: isOpen })}></uui-icon>`)}
95
+ </div>
96
+ </div>
97
+ ${when(isOpen && expandable, () => html `
98
+ <div class="body">
99
+ ${__classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderBody).call(this, classified)}
100
+ <div class="path-line">
101
+ <span class="muted"
102
+ >${this.localize.term('uSync_diffPath', detail.path)}</span
103
+ >
104
+ <div class="path-line-actions">
105
+ ${when(classified.strategy === 'json', () => html `
106
+ <uui-button look="text" compact @click=${__classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_toggleRaw)}>
107
+ ${this._showRaw
108
+ ? this.localize.term('uSync_diffHideRaw')
109
+ : this.localize.term('uSync_diffShowRaw')}
110
+ </uui-button>
111
+ `)}
112
+ <uui-button
113
+ look="text"
114
+ compact
115
+ label=${this.localize.term('uSync_diffCopyPath')}
116
+ @click=${__classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_copyPath)}>
117
+ <uui-icon name="icon-documents"></uui-icon>
118
+ </uui-button>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ `)}
123
+ </div>
124
+ `;
125
+ }
126
+ };
127
+ _uSyncChangeDetail_instances = new WeakSet();
128
+ _uSyncChangeDetail_toggleOpen = function _uSyncChangeDetail_toggleOpen() {
129
+ this.open = !this.open;
130
+ };
131
+ _uSyncChangeDetail_toggleRun = function _uSyncChangeDetail_toggleRun(index) {
132
+ if (this._expandedRuns.has(index)) {
133
+ this._expandedRuns.delete(index);
134
+ }
135
+ else {
136
+ this._expandedRuns.add(index);
137
+ }
138
+ this.requestUpdate();
139
+ };
140
+ _uSyncChangeDetail_toggleLeaf = function _uSyncChangeDetail_toggleLeaf(index) {
141
+ if (this._expandedLeaves.has(index)) {
142
+ this._expandedLeaves.delete(index);
143
+ }
144
+ else {
145
+ this._expandedLeaves.add(index);
146
+ }
147
+ this.requestUpdate();
148
+ };
149
+ _uSyncChangeDetail_toggleRaw = function _uSyncChangeDetail_toggleRaw() {
150
+ this._showRaw = !this._showRaw;
151
+ };
152
+ _uSyncChangeDetail_copyPath = function _uSyncChangeDetail_copyPath() {
153
+ if (!this.detail)
154
+ return;
155
+ navigator.clipboard?.writeText(this.detail.path)?.catch(() => undefined);
156
+ };
157
+ _uSyncChangeDetail_isExpandable = function _uSyncChangeDetail_isExpandable(strategy) {
158
+ return strategy !== 'scalar' && strategy !== 'skip';
159
+ };
160
+ _uSyncChangeDetail_lineCounts = function _uSyncChangeDetail_lineCounts() {
161
+ let added = 0;
162
+ let removed = 0;
163
+ for (const block of this._lines ?? []) {
164
+ if (block.type !== 'row')
165
+ continue;
166
+ if (block.row.type === 'add')
167
+ added++;
168
+ else if (block.row.type === 'remove')
169
+ removed++;
170
+ }
171
+ return { added, removed };
172
+ };
173
+ _uSyncChangeDetail_renderSummary = function _uSyncChangeDetail_renderSummary(c) {
174
+ switch (c.strategy) {
175
+ case 'scalar':
176
+ return html `<span class="inline-change"
177
+ ><del>${c.oldText}</del> → <ins>${c.newText}</ins></span
178
+ >`;
179
+ case 'json': {
180
+ const diff = this._json;
181
+ if (!diff)
182
+ return nothing;
183
+ if (diff.truncated) {
184
+ return this.localize.term('uSync_diffChangeCapped', diff.changes.length, diff.totalCount);
185
+ }
186
+ if (diff.totalCount === 1)
187
+ return this.localize.term('uSync_diffOneChange');
188
+ return this.localize.term('uSync_diffChangeCount', diff.totalCount);
189
+ }
190
+ case 'lines': {
191
+ const { added, removed } = __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_lineCounts).call(this);
192
+ return this.localize.term('uSync_diffLineCount', added, removed);
193
+ }
194
+ case 'masked':
195
+ return this.localize.term('uSync_diffMaskedShort');
196
+ case 'single':
197
+ return c.oldText === ''
198
+ ? this.localize.term('uSync_diffValueAdded')
199
+ : this.localize.term('uSync_diffValueRemoved');
200
+ case 'oversized':
201
+ return this.localize.term('uSync_diffTooLargeShort');
202
+ case 'notice':
203
+ return c.oldText;
204
+ case 'words':
205
+ return this.localize.term('uSync_diffValueChanged');
206
+ case 'skip':
207
+ default:
208
+ return this.localize.term('uSync_noChange');
209
+ }
210
+ };
211
+ _uSyncChangeDetail_renderBody = function _uSyncChangeDetail_renderBody(c) {
212
+ switch (c.strategy) {
213
+ case 'json':
214
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderJsonBody).call(this, c);
215
+ case 'lines':
216
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderLinesBody).call(this);
217
+ case 'words':
218
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderWordsBody).call(this, c);
219
+ case 'single':
220
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderSingleBody).call(this, c);
221
+ case 'masked':
222
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderMaskedBody).call(this);
223
+ case 'oversized':
224
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderOversizedBody).call(this, c);
225
+ case 'notice':
226
+ return __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderNoticeBody).call(this, c);
227
+ default:
228
+ return nothing;
229
+ }
230
+ };
231
+ _uSyncChangeDetail_renderJsonBody = function _uSyncChangeDetail_renderJsonBody(c) {
232
+ const diff = this._json;
233
+ if (!diff)
234
+ return nothing;
235
+ return html `
236
+ <ul class="leaf-list">
237
+ ${diff.changes.map((leaf, index) => __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderLeaf).call(this, leaf, index))}
238
+ </ul>
239
+ ${when(diff.truncated, () => html `<p class="muted">
240
+ ${this.localize.term(diff.stopped ? 'uSync_diffMoreChangesAtLeast' : 'uSync_diffMoreChanges', diff.totalCount - diff.changes.length)}
241
+ </p>`)}
242
+ ${when(diff.reordered.length > 0, () => html `<p class="muted">
243
+ ${this.localize.term('uSync_diffReordered')}: ${diff.reordered.join(', ')}
244
+ </p>`)}
245
+ ${when(this._showRaw, () => html `
246
+ <div class="raw-values">
247
+ <div>
248
+ <div class="muted">${this.localize.term('uSync_diffOldValue')}</div>
249
+ <umb-code-block language="json" copy
250
+ >${prettyJson(c.oldJson)}</umb-code-block
251
+ >
252
+ </div>
253
+ <div>
254
+ <div class="muted">${this.localize.term('uSync_diffNewValue')}</div>
255
+ <umb-code-block language="json" copy
256
+ >${prettyJson(c.newJson)}</umb-code-block
257
+ >
258
+ </div>
259
+ </div>
260
+ `)}
261
+ `;
262
+ };
263
+ _uSyncChangeDetail_renderLeaf = function _uSyncChangeDetail_renderLeaf(leaf, index) {
264
+ const path = formatDiffPath(leaf.path);
265
+ const symbol = leaf.kind === 'added' ? '+' : leaf.kind === 'removed' ? '−' : '~';
266
+ return html `
267
+ <li class=${classMap({ leaf: true, [leaf.kind]: true })}>
268
+ <div class="leaf-path" title=${leaf.path}>
269
+ <span class="symbol">${symbol}</span>${path}
270
+ ${when(leaf.expanded, () => html `<uui-tag
271
+ size="s"
272
+ look="secondary"
273
+ title=${this.localize.term('uSync_diffExpandedNote')}
274
+ >»</uui-tag
275
+ >`)}
276
+ </div>
277
+ <div class="leaf-value">${__classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderLeafValue).call(this, leaf, index)}</div>
278
+ </li>
279
+ `;
280
+ };
281
+ _uSyncChangeDetail_renderLeafValue = function _uSyncChangeDetail_renderLeafValue(leaf, index) {
282
+ if (leaf.kind === 'added') {
283
+ return html `<span class="added-value">${formatLeafValue(leaf.newValue)}</span>`;
284
+ }
285
+ if (leaf.kind === 'removed') {
286
+ return html `<span class="removed-value">${formatLeafValue(leaf.oldValue)}</span>`;
287
+ }
288
+ const oldText = formatLeafValue(leaf.oldValue);
289
+ const newText = formatLeafValue(leaf.newValue);
290
+ const bothSingleLine = !oldText.includes('\n') && !newText.includes('\n');
291
+ const combinedLen = oldText.length + newText.length;
292
+ if (bothSingleLine && combinedLen <= USYNC_DIFF_LIMITS.inlineScalarChars) {
293
+ return html `<span class="inline-change"
294
+ ><del>${oldText}</del> → <ins>${newText}</ins></span
295
+ >`;
296
+ }
297
+ const bothStrings = typeof leaf.oldValue === 'string' && typeof leaf.newValue === 'string';
298
+ const hasWhitespace = /\s/.test(oldText) || /\s/.test(newText);
299
+ if (bothStrings &&
300
+ hasWhitespace &&
301
+ combinedLen <= USYNC_DIFF_LIMITS.maxScalarWordDiffBytes) {
302
+ const words = diffWords(oldText, newText);
303
+ return html `<span class="word-diff"
304
+ >${words.map((word) => word.added
305
+ ? html `<ins>${word.value}</ins>`
306
+ : word.removed
307
+ ? html `<del>${word.value}</del>`
308
+ : html `<span>${word.value}</span>`)}</span
309
+ >`;
310
+ }
311
+ const expanded = this._expandedLeaves.has(index);
312
+ return html `
313
+ <uui-button look="text" compact @click=${() => __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_toggleLeaf).call(this, index)}>
314
+ ${expanded
315
+ ? this.localize.term('uSync_diffHideRaw')
316
+ : this.localize.term('uSync_diffShowRaw')}
317
+ </uui-button>
318
+ ${when(expanded, () => html `
319
+ <pre class="stacked"><del>- ${oldText}</del>
320
+ <ins>+ ${newText}</ins></pre>
321
+ `)}
322
+ `;
323
+ };
324
+ _uSyncChangeDetail_renderLinesBody = function _uSyncChangeDetail_renderLinesBody() {
325
+ const blocks = this._lines ?? [];
326
+ return html `
327
+ ${when(this._lineDegraded, () => html `<p class="muted">${this.localize.term('uSync_diffDegraded')}</p>`)}
328
+ <uui-scroll-container class="line-diff">
329
+ ${blocks.map((block, index) => block.type === 'row'
330
+ ? __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderLineRow).call(this, block.row)
331
+ : __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderCollapsed).call(this, block, index))}
332
+ </uui-scroll-container>
333
+ `;
334
+ };
335
+ _uSyncChangeDetail_renderLineRow = function _uSyncChangeDetail_renderLineRow(row) {
336
+ const tint = row.type === 'add'
337
+ ? 'color-mix(in srgb, var(--uui-color-positive) 12%, transparent)'
338
+ : row.type === 'remove'
339
+ ? 'color-mix(in srgb, var(--uui-color-danger) 12%, transparent)'
340
+ : undefined;
341
+ const marker = row.type === 'add' ? '+' : row.type === 'remove' ? '-' : ' ';
342
+ return html `
343
+ <div
344
+ class="line-row ${row.type}"
345
+ style=${styleMap({ background: tint ?? 'transparent' })}>
346
+ <span class="gutter">${row.oldLine ?? ''}</span>
347
+ <span class="gutter">${row.newLine ?? ''}</span>
348
+ <span class="marker">${marker}</span>
349
+ <span class="text">${row.text}</span>
350
+ </div>
351
+ `;
352
+ };
353
+ _uSyncChangeDetail_renderCollapsed = function _uSyncChangeDetail_renderCollapsed(block, index) {
354
+ const expanded = this._expandedRuns.has(index);
355
+ return html `
356
+ <div class="collapsed-toggle" @click=${() => __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_toggleRun).call(this, index)}>
357
+ <uui-icon name="icon-navigation"></uui-icon>
358
+ ${expanded
359
+ ? this.localize.term('uSync_diffHideUnchanged')
360
+ : this.localize.term('uSync_diffShowUnchanged', block.count)}
361
+ </div>
362
+ ${when(expanded, () => html `${block.rows.map((row) => __classPrivateFieldGet(this, _uSyncChangeDetail_instances, "m", _uSyncChangeDetail_renderLineRow).call(this, row))}`)}
363
+ `;
364
+ };
365
+ _uSyncChangeDetail_renderWordsBody = function _uSyncChangeDetail_renderWordsBody(c) {
366
+ const changes = diffWords(c.oldText, c.newText);
367
+ return html `<pre class="word-diff">
368
+ ${changes.map((word) => word.added
369
+ ? html `<ins>${word.value}</ins>`
370
+ : word.removed
371
+ ? html `<del>${word.value}</del>`
372
+ : html `<span>${word.value}</span>`)}</pre
373
+ >`;
374
+ };
375
+ _uSyncChangeDetail_renderSingleBody = function _uSyncChangeDetail_renderSingleBody(c) {
376
+ const isAdded = c.oldText === '';
377
+ const value = isAdded ? c.newText : c.oldText;
378
+ const tint = isAdded
379
+ ? 'color-mix(in srgb, var(--uui-color-positive) 12%, transparent)'
380
+ : 'color-mix(in srgb, var(--uui-color-danger) 12%, transparent)';
381
+ return html `
382
+ <div class="muted">
383
+ ${isAdded
384
+ ? this.localize.term('uSync_diffValueAdded')
385
+ : this.localize.term('uSync_diffValueRemoved')}
386
+ </div>
387
+ <div class="tinted" style=${styleMap({ background: tint })}>
388
+ <umb-code-block language=${c.language} copy>${value}</umb-code-block>
389
+ </div>
390
+ `;
391
+ };
392
+ _uSyncChangeDetail_renderMaskedBody = function _uSyncChangeDetail_renderMaskedBody() {
393
+ return html `<p class="muted">${this.localize.term('uSync_diffMasked')}</p>`;
394
+ };
395
+ _uSyncChangeDetail_renderOversizedBody = function _uSyncChangeDetail_renderOversizedBody(c) {
396
+ return html `
397
+ <p class="muted">${this.localize.term('uSync_diffTooLarge')}</p>
398
+ <div class="raw-values">
399
+ <div>
400
+ <div class="muted">${this.localize.term('uSync_diffOldValue')}</div>
401
+ <umb-code-block language=${c.language} copy>${c.oldText}</umb-code-block>
402
+ </div>
403
+ <div>
404
+ <div class="muted">${this.localize.term('uSync_diffNewValue')}</div>
405
+ <umb-code-block language=${c.language} copy>${c.newText}</umb-code-block>
406
+ </div>
407
+ </div>
408
+ `;
409
+ };
410
+ _uSyncChangeDetail_renderNoticeBody = function _uSyncChangeDetail_renderNoticeBody(c) {
411
+ const label = this.detail?.change === ChangeDetailType.ERROR
412
+ ? this.localize.term('uSync_changeError')
413
+ : this.localize.term('uSync_changeWarning');
414
+ return html `
415
+ <div class="notice-callout danger">
416
+ <strong>${label}</strong>
417
+ <p>${c.oldText}</p>
418
+ </div>
419
+ `;
420
+ };
421
+ uSyncChangeDetail.styles = css `
422
+ :host {
423
+ display: block;
424
+ border-bottom: 1px solid var(--uui-color-border);
425
+ }
426
+
427
+ .change-row.danger {
428
+ border-left: 3px solid var(--uui-color-danger);
429
+ }
430
+
431
+ .summary {
432
+ display: flex;
433
+ align-items: center;
434
+ justify-content: space-between;
435
+ gap: var(--uui-size-space-4);
436
+ padding: var(--uui-size-space-3) var(--uui-size-space-5);
437
+ cursor: pointer;
438
+ }
439
+
440
+ .summary.static {
441
+ cursor: default;
442
+ }
443
+
444
+ .summary:hover:not(.static) {
445
+ background-color: var(--uui-color-surface-alt);
446
+ }
447
+
448
+ .summary-left {
449
+ display: flex;
450
+ align-items: center;
451
+ gap: var(--uui-size-space-3);
452
+ min-width: 0;
453
+ overflow: hidden;
454
+ }
455
+
456
+ .summary-left .label {
457
+ font-weight: bold;
458
+ overflow: hidden;
459
+ text-overflow: ellipsis;
460
+ white-space: nowrap;
461
+ }
462
+
463
+ .prefix {
464
+ color: var(--uui-color-disabled-contrast);
465
+ }
466
+
467
+ .summary-right {
468
+ display: flex;
469
+ align-items: center;
470
+ gap: var(--uui-size-space-4);
471
+ flex-shrink: 0;
472
+ }
473
+
474
+ .summary-right uui-icon {
475
+ transition: transform 90ms ease;
476
+ }
477
+
478
+ .summary-right uui-icon.expanded {
479
+ transform: rotate(90deg);
480
+ }
481
+
482
+ .danger {
483
+ color: var(--uui-color-danger);
484
+ }
485
+
486
+ .color-red {
487
+ color: var(--uui-color-danger);
488
+ }
489
+
490
+ .muted {
491
+ color: var(--uui-color-disabled-contrast);
492
+ font-size: smaller;
493
+ }
494
+
495
+ .body {
496
+ padding: 0 var(--uui-size-space-5) var(--uui-size-space-4);
497
+ }
498
+
499
+ .path-line {
500
+ display: flex;
501
+ align-items: center;
502
+ justify-content: space-between;
503
+ gap: var(--uui-size-space-3);
504
+ margin-top: var(--uui-size-space-3);
505
+ }
506
+
507
+ .path-line > .muted {
508
+ overflow: hidden;
509
+ text-overflow: ellipsis;
510
+ white-space: nowrap;
511
+ }
512
+
513
+ .path-line-actions {
514
+ display: flex;
515
+ align-items: center;
516
+ gap: var(--uui-size-space-1, 3px);
517
+ flex-shrink: 0;
518
+ }
519
+
520
+ .leaf-list {
521
+ list-style: none;
522
+ margin: 0;
523
+ padding: 0;
524
+ display: flex;
525
+ flex-direction: column;
526
+ gap: var(--uui-size-space-3);
527
+ }
528
+
529
+ .leaf {
530
+ display: flex;
531
+ flex-direction: column;
532
+ gap: var(--uui-size-space-1, 3px);
533
+ padding: var(--uui-size-space-2) var(--uui-size-space-3);
534
+ border-radius: var(--uui-border-radius);
535
+ border: 1px solid var(--uui-color-border);
536
+ background: var(--uui-color-surface-alt);
537
+ }
538
+
539
+ .leaf.added {
540
+ background: color-mix(in srgb, var(--uui-color-positive) 8%, transparent);
541
+ border-color: color-mix(in srgb, var(--uui-color-positive) 30%, transparent);
542
+ }
543
+
544
+ .leaf.removed {
545
+ background: color-mix(in srgb, var(--uui-color-danger) 8%, transparent);
546
+ border-color: color-mix(in srgb, var(--uui-color-danger) 30%, transparent);
547
+ }
548
+
549
+ .leaf-path {
550
+ font-family: monospace;
551
+ font-size: smaller;
552
+ font-weight: 600;
553
+ color: var(--uui-color-text);
554
+ overflow: hidden;
555
+ text-overflow: ellipsis;
556
+ white-space: nowrap;
557
+ }
558
+
559
+ .symbol {
560
+ display: inline-block;
561
+ width: 1em;
562
+ font-weight: bold;
563
+ }
564
+
565
+ .added-value {
566
+ color: var(--uui-color-positive);
567
+ }
568
+
569
+ .removed-value {
570
+ color: var(--uui-color-danger);
571
+ }
572
+
573
+ .inline-change del {
574
+ color: var(--uui-color-danger);
575
+ text-decoration: line-through;
576
+ }
577
+
578
+ .inline-change ins {
579
+ color: var(--uui-color-positive);
580
+ text-decoration: none;
581
+ }
582
+
583
+ .word-diff {
584
+ white-space: pre-wrap;
585
+ }
586
+
587
+ .word-diff ins {
588
+ color: var(--uui-color-positive);
589
+ text-decoration: none;
590
+ }
591
+
592
+ .word-diff del {
593
+ color: var(--uui-color-danger);
594
+ text-decoration: line-through;
595
+ }
596
+
597
+ .stacked {
598
+ margin: 0;
599
+ white-space: pre;
600
+ }
601
+
602
+ .stacked del {
603
+ display: block;
604
+ color: var(--uui-color-danger);
605
+ text-decoration: none;
606
+ }
607
+
608
+ .stacked ins {
609
+ display: block;
610
+ color: var(--uui-color-positive);
611
+ text-decoration: none;
612
+ }
613
+
614
+ .raw-values {
615
+ display: flex;
616
+ flex-direction: column;
617
+ gap: var(--uui-size-space-4);
618
+ margin-top: var(--uui-size-space-3);
619
+ }
620
+
621
+ .tinted {
622
+ border-radius: var(--uui-border-radius);
623
+ }
624
+
625
+ uui-scroll-container.line-diff {
626
+ max-height: 400px;
627
+ display: block;
628
+ border: 1px solid var(--uui-color-border);
629
+ border-radius: var(--uui-border-radius);
630
+ }
631
+
632
+ .line-row {
633
+ display: flex;
634
+ gap: var(--uui-size-space-2);
635
+ font-family: monospace;
636
+ white-space: pre;
637
+ padding: 0 var(--uui-size-space-2);
638
+ }
639
+
640
+ .line-row .gutter {
641
+ display: inline-block;
642
+ width: 3em;
643
+ text-align: right;
644
+ color: var(--uui-color-disabled-contrast);
645
+ flex-shrink: 0;
646
+ }
647
+
648
+ .line-row .marker {
649
+ flex-shrink: 0;
650
+ width: 1em;
651
+ }
652
+
653
+ .line-row .text {
654
+ white-space: pre;
655
+ }
656
+
657
+ .collapsed-toggle {
658
+ display: flex;
659
+ align-items: center;
660
+ gap: var(--uui-size-space-2);
661
+ padding: var(--uui-size-space-2);
662
+ color: var(--uui-color-disabled-contrast);
663
+ cursor: pointer;
664
+ font-size: smaller;
665
+ }
666
+
667
+ .collapsed-toggle:hover {
668
+ background-color: var(--uui-color-surface-alt);
669
+ }
670
+
671
+ .notice-callout {
672
+ padding: var(--uui-size-space-4);
673
+ border-radius: var(--uui-border-radius);
674
+ background: color-mix(in srgb, var(--uui-color-danger) 10%, transparent);
675
+ }
676
+
677
+ .notice-callout p {
678
+ margin: var(--uui-size-space-2) 0 0;
679
+ }
680
+ `;
681
+ __decorate([
682
+ property({ type: Object })
683
+ ], uSyncChangeDetail.prototype, "detail", void 0);
684
+ __decorate([
685
+ property({ type: Boolean, reflect: true })
686
+ ], uSyncChangeDetail.prototype, "open", void 0);
687
+ __decorate([
688
+ state()
689
+ ], uSyncChangeDetail.prototype, "_classified", void 0);
690
+ __decorate([
691
+ state()
692
+ ], uSyncChangeDetail.prototype, "_json", void 0);
693
+ __decorate([
694
+ state()
695
+ ], uSyncChangeDetail.prototype, "_lines", void 0);
696
+ __decorate([
697
+ state()
698
+ ], uSyncChangeDetail.prototype, "_lineDegraded", void 0);
699
+ __decorate([
700
+ state()
701
+ ], uSyncChangeDetail.prototype, "_label", void 0);
702
+ __decorate([
703
+ state()
704
+ ], uSyncChangeDetail.prototype, "_showRaw", void 0);
705
+ uSyncChangeDetail = __decorate([
706
+ customElement('usync-change-detail')
707
+ ], uSyncChangeDetail);
708
+ export { uSyncChangeDetail };
709
+ export default uSyncChangeDetail;