@septkit/ui 0.0.45 → 0.0.47

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.
@@ -3,13 +3,13 @@ import { buildChangeIndex as c, buildStructuralTree as l } from "./build-view-mo
3
3
  import { reactive as u, shallowRef as d } from "vue";
4
4
  //#region lib/merge/use-merge-session.ts
5
5
  function f(f) {
6
- let p = d(), m = u(/* @__PURE__ */ new Map()), h = d(), g = d({
6
+ let p = d(), m = u(/* @__PURE__ */ new Map()), h = d("target"), g = d(), _ = d({
7
7
  items: [],
8
8
  meta: {},
9
9
  index: {},
10
10
  expanded: []
11
- }), _ = d(), v = d(), y = d(!1);
12
- function b() {
11
+ }), v = d(), y = d(), b = d(!1);
12
+ function x() {
13
13
  return {
14
14
  verb: f.verb,
15
15
  scenario: f.scenario,
@@ -18,42 +18,42 @@ function f(f) {
18
18
  anchor: f.anchor
19
19
  };
20
20
  }
21
- function x(e) {
21
+ function S(e) {
22
22
  return e === void 0 ? "accept" : typeof e == "string" ? e : e.action;
23
23
  }
24
- function S(e) {
24
+ function C(e) {
25
25
  return typeof e == "object" ? e.values : void 0;
26
26
  }
27
- async function C() {
28
- p.value = await a(f.targetDocument, b()), await F();
27
+ async function w() {
28
+ p.value = await a(f.targetDocument, x()), await I();
29
29
  }
30
- function w(e, t) {
31
- let n = S(m.get(e));
30
+ function T(e, t) {
31
+ let n = C(m.get(e));
32
32
  m.set(e, n ? {
33
33
  action: t,
34
34
  values: n
35
- } : t), P();
35
+ } : t), F();
36
36
  }
37
- function T(e, t, n) {
37
+ function E(e, t, n) {
38
38
  let r = m.get(e), i = {
39
- ...S(r),
39
+ ...C(r),
40
40
  [t]: n
41
41
  };
42
42
  m.set(e, {
43
- action: x(r),
43
+ action: S(r),
44
44
  values: i
45
- }), P();
45
+ }), F();
46
46
  }
47
- function E(e) {
48
- return x(m.get(e));
47
+ function D(e) {
48
+ return S(m.get(e));
49
49
  }
50
- function D(e, t) {
51
- return S(m.get(e))?.[t];
50
+ function O(e, t) {
51
+ return C(m.get(e))?.[t];
52
52
  }
53
- function O() {
53
+ function k() {
54
54
  let e = /* @__PURE__ */ new Map();
55
55
  for (let [t, n] of m) {
56
- let r = S(n);
56
+ let r = C(n);
57
57
  r && e.set(t, {
58
58
  action: "accept",
59
59
  values: r
@@ -61,43 +61,50 @@ function f(f) {
61
61
  }
62
62
  return e;
63
63
  }
64
- function k(e) {
65
- h.value = e, L();
64
+ function A(e) {
65
+ g.value = e, R();
66
66
  }
67
- let A, j = /* @__PURE__ */ new Map(), M, N = 0;
68
- function P() {
69
- M && clearTimeout(M), M = setTimeout(() => void F(), 150);
67
+ let j, M = /* @__PURE__ */ new Map(), N, P = 0;
68
+ function F() {
69
+ N && clearTimeout(N), N = setTimeout(() => void I(), 150);
70
70
  }
71
- async function F() {
71
+ async function I() {
72
72
  if (!p.value) return;
73
- let e = ++N;
74
- y.value = !0;
75
- let a = O(), s = await i(f.targetDocument, b(), p.value, a, f.afterApply);
76
- if (e !== N) {
73
+ let e = ++P;
74
+ b.value = !0;
75
+ let a = k(), s = await i({
76
+ doc: f.targetDocument,
77
+ target: x(),
78
+ report: p.value,
79
+ decisions: a,
80
+ keepNameTypesFrom: h.value,
81
+ afterApply: f.afterApply
82
+ });
83
+ if (e !== P) {
77
84
  s.discard();
78
85
  return;
79
86
  }
80
- A?.discard(), A = s, j = /* @__PURE__ */ new Map();
81
- for (let e of A.operations) {
87
+ j?.discard(), j = s, M = /* @__PURE__ */ new Map();
88
+ for (let e of j.operations) {
82
89
  if (e.status !== "created") continue;
83
90
  let t = {
84
91
  tagName: e.newRecord.tagName,
85
92
  id: e.newRecord.id
86
- }, { templateUuid: r } = await n(A.query, t);
87
- r && j.set(r, t);
93
+ }, { templateUuid: r } = await n(j.query, t);
94
+ r && M.set(r, t);
88
95
  }
89
- let u = r(f.verb), d = await t(A.query, f.anchor, u.rootTag), m = await o(A.query, d), _ = await c({
96
+ let u = r(f.verb), d = await t(j.query, f.anchor, u.rootTag), m = await o(j.query, d), v = await c({
90
97
  report: p.value,
91
- createdBySourceUuid: j,
98
+ createdBySourceUuid: M,
92
99
  sourceQuery: f.sourceQuery
93
100
  });
94
- g.value = await l({
101
+ _.value = await l({
95
102
  tree: m,
96
- changeByStagedId: _,
97
- query: A.query
98
- }), h.value &&= I(h.value, g.value), y.value = !1, await L();
103
+ changeByStagedId: v,
104
+ query: j.query
105
+ }), g.value &&= L(g.value, _.value), b.value = !1, await R();
99
106
  }
100
- function I(e, t) {
107
+ function L(e, t) {
101
108
  let n = Object.values(t.index);
102
109
  if (e.node) {
103
110
  let t = n.find((t) => t.node === e.node);
@@ -109,42 +116,54 @@ function f(f) {
109
116
  }
110
117
  return (e.previewRef.id ? t.index[e.previewRef.id] : void 0) ?? e;
111
118
  }
112
- async function L() {
113
- let e = h.value;
114
- if (!e || !A) {
115
- _.value = void 0, v.value = void 0;
119
+ async function R() {
120
+ let e = g.value;
121
+ if (!e || !j) {
122
+ v.value = void 0, y.value = void 0;
116
123
  return;
117
124
  }
118
- _.value = await s(A.query, e.previewRef), v.value = e.change === "added" ? "" : await z(e.previewRef);
119
- }
120
- async function R(e) {
121
- return A ? n(A.query, e) : {};
125
+ v.value = await s(j.query, e.previewRef), y.value = e.change === "added" ? "" : await B(e.previewRef);
122
126
  }
123
127
  async function z(e) {
128
+ return j ? n(j.query, e) : {};
129
+ }
130
+ async function B(e) {
124
131
  try {
125
132
  return await s(f.targetDocument.query, e);
126
133
  } catch {
127
134
  return;
128
135
  }
129
136
  }
130
- async function B() {
131
- p.value && (A?.discard(), A = void 0, await e(f.targetDocument, b(), p.value, new Map(m), f.afterApply));
137
+ async function V() {
138
+ p.value && (j?.discard(), j = void 0, await e({
139
+ doc: f.targetDocument,
140
+ target: x(),
141
+ report: p.value,
142
+ decisions: new Map(m),
143
+ keepNameTypesFrom: h.value,
144
+ afterApply: f.afterApply
145
+ }));
146
+ }
147
+ function H(e) {
148
+ h.value = e, F();
132
149
  }
133
150
  return {
134
151
  report: p,
135
152
  decisions: m,
136
- structuralTree: g,
137
- previewXml: _,
138
- previewBeforeXml: v,
139
- previewLoading: y,
140
- load: C,
141
- setDecision: w,
142
- setValue: T,
143
- decisionOf: E,
144
- editedValue: D,
145
- select: k,
146
- stagedAttributes: R,
147
- commit: B
153
+ keepNameTypesFrom: h,
154
+ structuralTree: _,
155
+ previewXml: v,
156
+ previewBeforeXml: y,
157
+ previewLoading: b,
158
+ load: w,
159
+ setDecision: T,
160
+ setValue: E,
161
+ decisionOf: D,
162
+ editedValue: O,
163
+ select: A,
164
+ stagedAttributes: z,
165
+ setKeepNameTypesFrom: H,
166
+ commit: V
148
167
  };
149
168
  }
150
169
  //#endregion