@antcde/vue-utils 0.2.13 → 0.2.14-rc.8f1db38

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.
package/dist/index.js CHANGED
@@ -1,182 +1,350 @@
1
- import { useColorMode as P, objectPick as L, objectOmit as C, useMagicKeys as M, whenever as g, watchDebounced as O, useAsyncState as I } from "@vueuse/core";
2
- import { computed as u, watch as h, ref as d, onBeforeUnmount as E, onMounted as U, onUnmounted as D, readonly as H, inject as W } from "vue";
3
- import { useI18n as z } from "vue-i18n";
4
- import { newCommsClient as B, newCommsHost as K } from "@antcde/connect-ts";
5
- import { concat as R, Subject as T, concatMap as S, map as w, distinctUntilChanged as G, debounceTime as V, BehaviorSubject as j, filter as q } from "rxjs";
6
- function te(t, o) {
7
- const n = P(o), e = u(() => t.context.value.darkMode), s = u(() => {
8
- switch (e.value) {
9
- case null:
10
- return "auto";
11
- case !0:
12
- return "dark";
13
- case !1:
14
- return "light";
15
- default:
16
- return n.value;
17
- }
18
- }), r = u(() => {
19
- switch (s.value) {
20
- case "light":
21
- case "auto":
22
- return !1;
23
- case "dark":
24
- return !0;
25
- }
26
- });
27
- return Object.assign(
28
- s,
29
- { host: e, isDark: r },
30
- L(n, ["state", "system", "store"])
31
- );
1
+ import { objectOmit as e, objectPick as t, useAsyncState as n, useColorMode as r, useMagicKeys as i, watchDebounced as a, whenever as o } from "@vueuse/core";
2
+ import { computed as s, inject as c, onBeforeUnmount as l, onMounted as u, onUnmounted as d, readonly as f, ref as p, shallowRef as m, watch as h } from "vue";
3
+ import { useI18n as g } from "vue-i18n";
4
+ import { newCommsClient as _, newCommsHost as v } from "@antcde/connect-ts";
5
+ import { BehaviorSubject as y, Subject as b, concat as x, concatMap as S, debounceTime as C, distinctUntilChanged as w, filter as T, map as E } from "rxjs";
6
+ //#region src/useAntColorMode.ts
7
+ function D(e, n) {
8
+ let i = r(n), a = s(() => e.context.value.darkMode), o = s(() => {
9
+ switch (a.value) {
10
+ case null: return "auto";
11
+ case !0: return "dark";
12
+ case !1: return "light";
13
+ default: return i.value;
14
+ }
15
+ }), c = s(() => {
16
+ switch (o.value) {
17
+ case "light":
18
+ case "auto": return !1;
19
+ case "dark": return !0;
20
+ }
21
+ });
22
+ return Object.assign(o, {
23
+ host: a,
24
+ isDark: c
25
+ }, t(i, [
26
+ "state",
27
+ "system",
28
+ "store"
29
+ ]));
32
30
  }
33
- function se(t, o) {
34
- const n = z(o);
35
- return h(
36
- () => t.context.value.user?.language,
37
- (e) => n.locale.value = e ?? "en",
38
- { immediate: !0 }
39
- ), n;
31
+ //#endregion
32
+ //#region src/useAntI18n.ts
33
+ function O(e, t) {
34
+ let n = g(t);
35
+ return h(() => e.context.value.user?.language, (e) => n.locale.value = e ?? "en", { immediate: !0 }), n;
40
36
  }
41
- function F(t, o) {
42
- const n = d({}), e = B({ parent: window.parent, connect: t }), s = d(""), r = u({
43
- get: () => s.value,
44
- set: (i) => e.appState.set(i)
45
- });
46
- return e.context.subscribe((i) => n.value = i), R(e.appState.get(), e.appState).subscribe((i) => s.value = i), N(e.signal, e, o), E(() => e.unsubscribe()), Object.assign(
47
- C(e, ["context", "toolbar", "appState"]),
48
- {
49
- context: n,
50
- toolbar: J(e),
51
- appState: r
52
- }
53
- );
37
+ //#endregion
38
+ //#region src/useCommsClient.ts
39
+ function k(t, n, r) {
40
+ let i = p({}), a = _({
41
+ parent: window.parent,
42
+ connect: t,
43
+ manifest: r
44
+ }), o = p(""), c = s({
45
+ get: () => o.value,
46
+ set: (e) => a.appState.set(e)
47
+ });
48
+ return a.context.subscribe((e) => i.value = e), x(a.appState.get(), a.appState).subscribe((e) => o.value = e), j(a.signal, a, n), l(() => a.unsubscribe()), Object.assign(e(a, [
49
+ "context",
50
+ "toolbar",
51
+ "appState"
52
+ ]), {
53
+ context: i,
54
+ toolbar: A(a),
55
+ appState: c
56
+ });
54
57
  }
55
- function J(t) {
56
- const o = d(""), n = {
57
- title: u({
58
- get: () => t.toolbar.get().title,
59
- set: (e) => t.toolbar.set((s) => ({ ...s, title: e }))
60
- }),
61
- subtitle: u({
62
- get: () => t.toolbar.get().subtitle,
63
- set: (e) => t.toolbar.set((s) => ({ ...s, subtitle: e }))
64
- }),
65
- searchEnabled: u({
66
- get: () => t.toolbar.get().search.enabled,
67
- set: (e) => t.toolbar.set((s) => ({ ...s, search: { ...s.search, enabled: e } }))
68
- }),
69
- search: u({
70
- get: () => o.value,
71
- set: (e) => t.toolbar.set((s) => ({ ...s, search: { ...s.search, input: e } }))
72
- }),
73
- menu: u({
74
- get: () => t.toolbar.get().menu ?? [],
75
- set: (e) => t.toolbar.set((s) => ({ ...s, menu: e }))
76
- }),
77
- isLoading: u({
78
- get: () => t.toolbar.get().isLoading,
79
- set: (e) => t.toolbar.set((s) => ({ ...s, isLoading: e }))
80
- })
81
- };
82
- return t.toolbar.pipe(w((e) => e.search.input ?? ""), G(), V(300)).forEach((e) => o.value = e), n;
58
+ function A(e) {
59
+ let t = p(""), n = {
60
+ title: s({
61
+ get: () => e.toolbar.get().title,
62
+ set: (t) => e.toolbar.set((e) => ({
63
+ ...e,
64
+ title: t
65
+ }))
66
+ }),
67
+ subtitle: s({
68
+ get: () => e.toolbar.get().subtitle,
69
+ set: (t) => e.toolbar.set((e) => ({
70
+ ...e,
71
+ subtitle: t
72
+ }))
73
+ }),
74
+ searchEnabled: s({
75
+ get: () => e.toolbar.get().search.enabled,
76
+ set: (t) => e.toolbar.set((e) => ({
77
+ ...e,
78
+ search: {
79
+ ...e.search,
80
+ enabled: t
81
+ }
82
+ }))
83
+ }),
84
+ search: s({
85
+ get: () => t.value,
86
+ set: (t) => e.toolbar.set((e) => ({
87
+ ...e,
88
+ search: {
89
+ ...e.search,
90
+ input: t
91
+ }
92
+ }))
93
+ }),
94
+ menu: s({
95
+ get: () => e.toolbar.get().menu ?? [],
96
+ set: (t) => e.toolbar.set((e) => ({
97
+ ...e,
98
+ menu: t
99
+ }))
100
+ }),
101
+ isLoading: s({
102
+ get: () => e.toolbar.get().isLoading,
103
+ set: (t) => e.toolbar.set((e) => ({
104
+ ...e,
105
+ isLoading: t
106
+ }))
107
+ })
108
+ };
109
+ return e.toolbar.pipe(E((e) => e.search.input ?? ""), w(), C(300)).forEach((e) => t.value = e), n;
83
110
  }
84
- function N(t, o, n) {
85
- const e = M(), s = e.ctrl ?? u(() => !1), r = e.shift ?? u(() => !1), i = new T(), m = i.pipe(
86
- S(n ?? ((c) => Promise.resolve(c))),
87
- S((c) => t(c))
88
- ).subscribe();
89
- return o.add(m), m.add(g(s, () => i.next({ hotkeys: { ctrl: !0 } }))), m.add(g(r, () => i.next({ hotkeys: { shift: !0 } }))), m;
111
+ function j(e, t, n) {
112
+ let r = i(), a = r.ctrl ?? s(() => !1), c = r.shift ?? s(() => !1), l = new b(), u = l.pipe(S(n ?? ((e) => Promise.resolve(e))), S((t) => e(t))).subscribe();
113
+ return t.add(u), u.add(o(a, () => l.next({ hotkeys: { ctrl: !0 } }))), u.add(o(c, () => l.next({ hotkeys: { shift: !0 } }))), u;
90
114
  }
91
- function ne(t) {
92
- const { context: o } = t, n = new j({}), e = (a) => n.next(a(n.value)), s = d(), r = new j(void 0), i = h(s, (a) => r.next(a), { immediate: !0 }), m = r.asObservable().pipe(
93
- w((a) => a?.contentWindow),
94
- q((a) => !!a)
95
- ), c = K({ ...t, contextChanges: n, windowChanges: m });
96
- Object.entries(o).map(([a, b]) => h(
97
- b,
98
- (A) => e((k) => ({ ...k, [a]: A })),
99
- { immediate: !0 }
100
- )).forEach((a) => c.scope.add(a)), c.toolbar.subscribe((a) => {
101
- const b = t.toolbar;
102
- b.title.value = a.title, b.subtitle.value = a.subtitle, b.searchEnabled.value = a.search?.enabled ?? !1, b.search.value = a.search?.input, b.menu.value = a.menu, b.isLoading.value = a?.isLoading ?? !1;
103
- });
104
- const f = O(
105
- t.toolbar.search,
106
- (a) => c.toolbar.set.search(a),
107
- { immediate: !0, debounce: 100 }
108
- );
109
- c.scope.add(i), c.scope.add(f);
110
- const p = d(c.appState.get()), l = u({
111
- get: () => p.value,
112
- set: (a) => c.appState.set(a)
113
- });
114
- c.appState.changes.subscribe((a) => p.value = a);
115
- const v = d(!1);
116
- c.isConnectionInitialized.subscribe((a) => v.value = a);
117
- const { unsubscribe: x, signal: y, closed: _ } = c;
118
- return {
119
- ...t,
120
- client: s,
121
- appState: l,
122
- isConnectionInitialized: v,
123
- unsubscribe: x,
124
- signal: y,
125
- closed: _
126
- };
115
+ //#endregion
116
+ //#region src/useCommsHost.ts
117
+ function M(e) {
118
+ let { context: t } = e, n = new y({}), r = (e) => n.next(e(n.value)), i = p(), o = new y(void 0), c = h(i, (e) => o.next(e), { immediate: !0 }), l = o.asObservable().pipe(E((e) => e?.contentWindow), T((e) => !!e)), u = v({
119
+ ...e,
120
+ contextChanges: n,
121
+ windowChanges: l
122
+ });
123
+ Object.entries(t).map(([e, t]) => h(t, (t) => r((n) => ({
124
+ ...n,
125
+ [e]: t
126
+ })), { immediate: !0 })).forEach((e) => u.scope.add(e)), u.toolbar.subscribe((t) => {
127
+ let n = e.toolbar;
128
+ n.title.value = t.title, n.subtitle.value = t.subtitle, n.searchEnabled.value = t.search?.enabled ?? !1, n.search.value = t.search?.input, n.menu.value = t.menu, n.isLoading.value = t?.isLoading ?? !1;
129
+ });
130
+ let d = a(e.toolbar.search, (e) => u.toolbar.set.search(e), {
131
+ immediate: !0,
132
+ debounce: 100
133
+ });
134
+ u.scope.add(c), u.scope.add(d);
135
+ let f = p(u.appState.get()), m = s({
136
+ get: () => f.value,
137
+ set: (e) => u.appState.set(e)
138
+ });
139
+ u.appState.changes.subscribe((e) => f.value = e);
140
+ let g = p(!1);
141
+ u.isConnectionInitialized.subscribe((e) => g.value = e);
142
+ let _ = p(null);
143
+ u.manifest?.subscribe((e) => _.value = e);
144
+ let { unsubscribe: b, signal: x, closed: S } = u;
145
+ return {
146
+ ...e,
147
+ client: i,
148
+ appState: m,
149
+ isConnectionInitialized: g,
150
+ manifest: _,
151
+ unsubscribe: b,
152
+ signal: x,
153
+ closed: S
154
+ };
127
155
  }
128
- function oe(t) {
129
- const o = u(() => t.value?.user), n = u(() => t.value?.license), e = u(() => t.value?.project), s = u(() => !!o.value?.is_admin), r = u(() => !!n.value?.user_is_admin), i = u(() => !!e.value?.user_is_admin);
130
- function m(l) {
131
- return !o.value || !n.value ? !1 : s.value || r.value ? !0 : (n.value.user_roles ?? []).some((v) => v.name === l);
132
- }
133
- function c(l) {
134
- return !o.value || !n.value ? !1 : s.value || r.value ? !0 : !!n.value.user_permissions?.[String(l)];
135
- }
136
- function f(l) {
137
- return !o.value || !e.value ? !1 : s.value || r.value || i.value ? !0 : (e.value.user_roles ?? []).some((v) => v.name === l);
138
- }
139
- function p(l) {
140
- return !o.value || !e.value ? !1 : s.value || r.value ? !0 : !!e.value.user_permissions?.[String(l)];
141
- }
142
- return { isGlobalAdmin: s, isLicenseAdmin: r, isProjectAdmin: i, hasLicenseRole: m, hasLicensePermission: c, hasProjectRole: f, hasProjectPermission: p };
156
+ //#endregion
157
+ //#region src/usePermissions.ts
158
+ function N(e) {
159
+ let t = s(() => e.value?.user), n = s(() => e.value?.license), r = s(() => e.value?.project), i = s(() => !!t.value?.is_admin), a = s(() => !!n.value?.user_is_admin), o = s(() => !!r.value?.user_is_admin || a.value);
160
+ function c(e) {
161
+ return !t.value || !n.value ? !1 : i.value || a.value ? !0 : (n.value.user_roles ?? []).some((t) => t.name === e);
162
+ }
163
+ function l(e) {
164
+ return !t.value || !n.value ? !1 : i.value || a.value ? !0 : !!n.value.user_permissions?.[String(e)];
165
+ }
166
+ function u(e) {
167
+ return !t.value || !r.value ? !1 : i.value || a.value || o.value ? !0 : (r.value.user_roles ?? []).some((t) => t.name === e);
168
+ }
169
+ function d(e) {
170
+ return !t.value || !r.value ? !1 : i.value || a.value ? !0 : !!r.value.user_permissions?.[String(e)];
171
+ }
172
+ return {
173
+ isGlobalAdmin: i,
174
+ isLicenseAdmin: a,
175
+ isProjectAdmin: o,
176
+ hasLicenseRole: c,
177
+ hasLicensePermission: l,
178
+ hasProjectRole: u,
179
+ hasProjectPermission: d
180
+ };
143
181
  }
144
- function ae(t = "comms") {
145
- const [o, n] = Q(
146
- t,
147
- () => F(),
148
- (e) => e.unsubscribe()
149
- );
150
- return { provideComms: o, injectComms: n };
182
+ //#endregion
183
+ //#region src/useTemplateVersioning.ts
184
+ function P(e) {
185
+ let t = m(null), n = m(null), r = m(null), i = m(null), a = m([]), o = m(null), c = p(!1), l = p(!1), u = p(!1), d = p(!1), f = p(!1), h = p(!1), g = s(() => t.value?.has_update ?? !1), _ = s(() => t.value?.current_version ?? null), v = s(() => t.value?.latest_version ?? null), y = s(() => n.value ? n.value.added.length + n.value.removed.length + n.value.modified.length + n.value.relations_added.length + n.value.relations_removed.length : 0);
186
+ async function b(n) {
187
+ c.value = !0;
188
+ try {
189
+ return t.value = (await e.tasks.checkForUpdates(n))?.data ?? null, t.value;
190
+ } catch {
191
+ return t.value = null, null;
192
+ } finally {
193
+ c.value = !1;
194
+ }
195
+ }
196
+ async function x(t, r) {
197
+ l.value = !0;
198
+ try {
199
+ return n.value = (await e.tasks.versionDiff(t, r))?.data ?? null, n.value;
200
+ } catch {
201
+ return n.value = null, null;
202
+ } finally {
203
+ l.value = !1;
204
+ }
205
+ }
206
+ async function S(t, r, i) {
207
+ l.value = !0;
208
+ try {
209
+ return n.value = (await e.tasks.versionCompare(t, r, i))?.data ?? null, n.value;
210
+ } catch {
211
+ return n.value = null, null;
212
+ } finally {
213
+ l.value = !1;
214
+ }
215
+ }
216
+ async function C(t) {
217
+ u.value = !0;
218
+ try {
219
+ return r.value = (await e.tasks.versionDiffOriginal(t))?.data ?? null, r.value;
220
+ } catch {
221
+ return r.value = null, null;
222
+ } finally {
223
+ u.value = !1;
224
+ }
225
+ }
226
+ async function w(r, a) {
227
+ d.value = !0;
228
+ try {
229
+ return i.value = (await e.tasks.syncToLatestVersion(r, a))?.data ?? null, t.value = null, n.value = null, i.value;
230
+ } catch {
231
+ return i.value = null, null;
232
+ } finally {
233
+ d.value = !1;
234
+ }
235
+ }
236
+ async function T(t, n) {
237
+ f.value = !0;
238
+ try {
239
+ let r = (await e.tasks.publishVersion(t, { change_summary: n }))?.data ?? null;
240
+ return r && (a.value = [r, ...a.value], o.value = r), r;
241
+ } catch {
242
+ return null;
243
+ } finally {
244
+ f.value = !1;
245
+ }
246
+ }
247
+ async function E(t) {
248
+ h.value = !0;
249
+ try {
250
+ return a.value = (await e.tasks.listVersions(t))?.data ?? [], a.value;
251
+ } catch {
252
+ return a.value = [], [];
253
+ } finally {
254
+ h.value = !1;
255
+ }
256
+ }
257
+ async function D(t) {
258
+ try {
259
+ return o.value = (await e.tasks.latestVersion(t))?.data ?? null, o.value;
260
+ } catch {
261
+ return o.value = null, null;
262
+ }
263
+ }
264
+ let O = m([]), k = p(!1), A = p(!1), j = m([]);
265
+ async function M(t) {
266
+ k.value = !0;
267
+ try {
268
+ return O.value = (await e.tasks.getInstances(t))?.data ?? [], O.value;
269
+ } catch {
270
+ return O.value = [], [];
271
+ } finally {
272
+ k.value = !1;
273
+ }
274
+ }
275
+ async function N(t, n) {
276
+ A.value = !0, j.value = [];
277
+ try {
278
+ return j.value = (await e.tasks.pushSync(t, n))?.data ?? [], j.value;
279
+ } catch {
280
+ return j.value = [], [];
281
+ } finally {
282
+ A.value = !1;
283
+ }
284
+ }
285
+ function P() {
286
+ t.value = null, n.value = null, r.value = null, i.value = null, a.value = [], o.value = null, O.value = [], j.value = [];
287
+ }
288
+ return {
289
+ updateCheck: t,
290
+ diff: n,
291
+ userCustomizations: r,
292
+ syncResult: i,
293
+ versions: a,
294
+ latestVersion: o,
295
+ instances: O,
296
+ pushSyncResults: j,
297
+ isCheckingUpdate: c,
298
+ isFetchingDiff: l,
299
+ isFetchingCustomizations: u,
300
+ isSyncing: d,
301
+ isPublishing: f,
302
+ isFetchingVersions: h,
303
+ isFetchingInstances: k,
304
+ isPushSyncing: A,
305
+ hasUpdate: g,
306
+ currentVersion: _,
307
+ availableVersion: v,
308
+ totalChanges: y,
309
+ checkForUpdates: b,
310
+ fetchDiff: x,
311
+ fetchUserCustomizations: C,
312
+ compareVersions: S,
313
+ syncToVersion: w,
314
+ publishVersion: T,
315
+ fetchVersions: E,
316
+ fetchLatestVersion: D,
317
+ fetchInstances: M,
318
+ pushSync: N,
319
+ reset: P
320
+ };
151
321
  }
152
- function Q(t, o, n) {
153
- let e;
154
- const s = () => (!e && (e = o()), e);
155
- return [
156
- (r) => (r.onUnmount(() => n && e && n(e)), r.provide(t, s)),
157
- () => W(t)()
158
- ];
322
+ //#endregion
323
+ //#region src/utils.ts
324
+ function F(e = "comms") {
325
+ let [t, n] = I(e, () => k(), (e) => e.unsubscribe());
326
+ return {
327
+ provideComms: t,
328
+ injectComms: n
329
+ };
159
330
  }
160
- function re(t, o, n) {
161
- const s = I(t, o, { immediate: !1, ...n });
162
- return Object.assign(C(s, ["execute"]), {
163
- execute: (...r) => s.execute(void 0, ...r),
164
- executeDelayed: s.execute
165
- });
331
+ function I(e, t, n) {
332
+ let r, i = () => (!r && (r = t()), r);
333
+ return [(t) => (t.onUnmount(() => n && r && n(r)), t.provide(e, i)), () => c(e)()];
166
334
  }
167
- function ue(t) {
168
- let o;
169
- const n = d(void 0);
170
- return U(() => o = t.signal.receive((e) => n.value = e)), D(() => o?.()), [H(n), () => o?.()];
335
+ function L(t, r, i) {
336
+ let a = n(t, r, {
337
+ immediate: !1,
338
+ ...i
339
+ });
340
+ return Object.assign(e(a, ["execute"]), {
341
+ execute: (...e) => a.execute(void 0, ...e),
342
+ executeDelayed: a.execute
343
+ });
171
344
  }
172
- export {
173
- te as useAntColorMode,
174
- se as useAntI18n,
175
- re as useApi,
176
- F as useCommsClient,
177
- ne as useCommsHost,
178
- ae as useCommsInjection,
179
- oe as usePermissions,
180
- ue as useSignal,
181
- Q as useSingleton
182
- };
345
+ function R(e) {
346
+ let t, n = p(void 0);
347
+ return u(() => t = e.signal.receive((e) => n.value = e)), d(() => t?.()), [f(n), () => t?.()];
348
+ }
349
+ //#endregion
350
+ export { D as useAntColorMode, O as useAntI18n, L as useApi, k as useCommsClient, M as useCommsHost, F as useCommsInjection, N as usePermissions, R as useSignal, I as useSingleton, P as useTemplateVersioning };
@@ -3,4 +3,5 @@ export { useAntI18n, type UseAntI18nReturn } from './useAntI18n';
3
3
  export { type UseCommsClient, useCommsClient } from './useCommsClient';
4
4
  export { type CommsHostArgs, type UseCommsHost, useCommsHost } from './useCommsHost';
5
5
  export { type UsePermissions, usePermissions } from './usePermissions';
6
+ export { useTemplateVersioning, type UseTemplateVersioningReturn } from './useTemplateVersioning';
6
7
  export { type AnyUseApiReturn, type CommsToolbar, useApi, type UseApiReturn, useCommsInjection, useSignal, useSingleton, } from './utils';
@@ -1,4 +1,4 @@
1
- import { AntConnect, Client, Context, Signal } from '@antcde/connect-ts';
1
+ import { AntConnect, AppManifest, Client, Context, Signal } from '@antcde/connect-ts';
2
2
  import { ObservableInput } from 'rxjs';
3
3
  import { Ref } from 'vue';
4
4
  import { CommsToolbar } from './utils';
@@ -20,5 +20,5 @@ type KeyboardShortcutsHook = (signal: Signal) => ObservableInput<Signal>;
20
20
  * @param keyboardsShortcuts By default it will process keyboards from the client and send them to the host.
21
21
  *
22
22
  */
23
- export declare function useCommsClient(connect?: AntConnect, keyboardsShortcuts?: KeyboardShortcutsHook): UseCommsClient;
23
+ export declare function useCommsClient(connect?: AntConnect, keyboardsShortcuts?: KeyboardShortcutsHook, manifest?: AppManifest): UseCommsClient;
24
24
  export {};
@@ -1,4 +1,4 @@
1
- import { AntConnect, LabelFilterState, License, Notepad, Notification, ProjectShort, SignalObserverFactory, SignalReceiver, SignalSender, Task, User } from '@antcde/connect-ts';
1
+ import { AntConnect, AppManifest, LabelFilterState, License, Notepad, Notification, ProjectShort, SignalObserverFactory, SignalReceiver, SignalSender, Task, User } from '@antcde/connect-ts';
2
2
  import { SubscriptionLike } from 'rxjs';
3
3
  import { Ref } from 'vue';
4
4
  import { CommsToolbar } from './utils';
@@ -30,6 +30,7 @@ export interface UseCommsHost extends CommsHostArgs, SubscriptionLike {
30
30
  client: Ref<HTMLIFrameElement | null | undefined>;
31
31
  appState: Ref<string>;
32
32
  isConnectionInitialized: Ref<boolean>;
33
+ manifest: Ref<AppManifest | null>;
33
34
  signal: SignalReceiver & SignalSender;
34
35
  }
35
36
  export declare function useCommsHost(args: CommsHostArgs): UseCommsHost;
@@ -0,0 +1,36 @@
1
+ import { AntConnect, PushSyncResult, TaskTemplateVersion, TemplateInstance, VersionCheck, VersionDiff, VersionSyncResult } from '@antcde/connect-ts';
2
+ import { ComputedRef, ref, shallowRef } from 'vue';
3
+ export interface UseTemplateVersioningReturn {
4
+ updateCheck: Readonly<ReturnType<typeof shallowRef<VersionCheck | null>>>;
5
+ diff: Readonly<ReturnType<typeof shallowRef<VersionDiff | null>>>;
6
+ userCustomizations: Readonly<ReturnType<typeof shallowRef<VersionDiff | null>>>;
7
+ syncResult: Readonly<ReturnType<typeof shallowRef<VersionSyncResult | null>>>;
8
+ versions: Readonly<ReturnType<typeof shallowRef<TaskTemplateVersion[]>>>;
9
+ latestVersion: Readonly<ReturnType<typeof shallowRef<TaskTemplateVersion | null>>>;
10
+ instances: Readonly<ReturnType<typeof shallowRef<TemplateInstance[]>>>;
11
+ pushSyncResults: Readonly<ReturnType<typeof shallowRef<PushSyncResult[]>>>;
12
+ isCheckingUpdate: Readonly<ReturnType<typeof ref<boolean>>>;
13
+ isFetchingDiff: Readonly<ReturnType<typeof ref<boolean>>>;
14
+ isFetchingCustomizations: Readonly<ReturnType<typeof ref<boolean>>>;
15
+ isSyncing: Readonly<ReturnType<typeof ref<boolean>>>;
16
+ isPublishing: Readonly<ReturnType<typeof ref<boolean>>>;
17
+ isFetchingVersions: Readonly<ReturnType<typeof ref<boolean>>>;
18
+ isFetchingInstances: Readonly<ReturnType<typeof ref<boolean>>>;
19
+ isPushSyncing: Readonly<ReturnType<typeof ref<boolean>>>;
20
+ hasUpdate: ComputedRef<boolean>;
21
+ currentVersion: ComputedRef<number | null>;
22
+ availableVersion: ComputedRef<number | null>;
23
+ totalChanges: ComputedRef<number>;
24
+ checkForUpdates: (taskId: string) => Promise<VersionCheck | null>;
25
+ fetchDiff: (taskId: string, targetVersionId?: string) => Promise<VersionDiff | null>;
26
+ fetchUserCustomizations: (taskId: string) => Promise<VersionDiff | null>;
27
+ compareVersions: (templateId: string, fromVersionId: string, toVersionId: string) => Promise<VersionDiff | null>;
28
+ syncToVersion: (taskId: string, targetVersionId?: string) => Promise<VersionSyncResult | null>;
29
+ publishVersion: (templateId: string, changeSummary?: string) => Promise<TaskTemplateVersion | null>;
30
+ fetchVersions: (templateId: string) => Promise<TaskTemplateVersion[]>;
31
+ fetchLatestVersion: (templateId: string) => Promise<TaskTemplateVersion | null>;
32
+ fetchInstances: (templateId: string) => Promise<TemplateInstance[]>;
33
+ pushSync: (templateId: string, instanceIds: string[]) => Promise<PushSyncResult[]>;
34
+ reset: () => void;
35
+ }
36
+ export declare function useTemplateVersioning(connect: AntConnect): UseTemplateVersioningReturn;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antcde/vue-utils",
3
3
  "type": "module",
4
- "version": "0.2.13",
4
+ "version": "0.2.14-rc.8f1db38",
5
5
  "description": "Helper to use ANT Comms in Vue 3",
6
6
  "author": "CollaborAll",
7
7
  "exports": {
@@ -25,22 +25,22 @@
25
25
  "clean": "pnpm dlx rimraf dist"
26
26
  },
27
27
  "peerDependencies": {
28
- "@vueuse/core": "^13.9.0",
28
+ "@vueuse/core": "^14.0.0",
29
29
  "rxjs": "^7.0.0",
30
30
  "vue": "^3.5.10",
31
31
  "vue-i18n": "^11.1.12"
32
32
  },
33
33
  "dependencies": {
34
- "@antcde/connect-ts": "0.4.17"
34
+ "@antcde/connect-ts": "0.4.18-rc.8f1db38"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@tsconfig/node22": "^22.0.5",
38
- "@types/node": "^22.19.17",
39
- "@vitejs/plugin-vue": "^6.0.5",
40
- "@vue/tsconfig": "^0.8.1",
41
- "typescript": "~5.9.3",
42
- "vite": "^7.3.2",
38
+ "@types/node": "^22.19.19",
39
+ "@vitejs/plugin-vue": "^6.0.7",
40
+ "@vue/tsconfig": "^0.9.1",
41
+ "typescript": "~6.0.3",
42
+ "vite": "^8.0.14",
43
43
  "vite-plugin-dts": "^4.5.4",
44
- "vue-tsc": "^3.2.6"
44
+ "vue-tsc": "^3.3.2"
45
45
  }
46
46
  }