@lmzhen/dsh-evolution-merge-ui 0.39.2 → 0.40.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.
- package/lib/client.js +25 -14
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -36,7 +36,7 @@ window.__ModuleLoader__.load({
|
|
|
36
36
|
}
|
|
37
37
|
}, spec.namespace + ": locale");
|
|
38
38
|
ctx.effect(() => injectStyles(typeof document === "undefined" ? void 0 : document, spec.styles.css, spec.styles.tagId), spec.namespace + ": styles");
|
|
39
|
-
const fallback = spec.dictionaries
|
|
39
|
+
const fallback = spec.dictionaries["en"];
|
|
40
40
|
const lookup = (key) => {
|
|
41
41
|
const own = fallback[key] ?? key;
|
|
42
42
|
if (!registered) return own;
|
|
@@ -205,6 +205,7 @@ window.__ModuleLoader__.load({
|
|
|
205
205
|
notify();
|
|
206
206
|
};
|
|
207
207
|
const refresh = async () => {
|
|
208
|
+
startRemote();
|
|
208
209
|
const ticket = ++generation;
|
|
209
210
|
const next = await describe(namespace);
|
|
210
211
|
if (ticket !== generation) return;
|
|
@@ -265,13 +266,16 @@ window.__ModuleLoader__.load({
|
|
|
265
266
|
return form;
|
|
266
267
|
}
|
|
267
268
|
/**
|
|
268
|
-
* Build
|
|
269
|
-
*
|
|
270
|
-
* a dead seat with the previous one.
|
|
269
|
+
* Build/return the ONE seat for one ClientContext. All panels share the same form,
|
|
270
|
+
* snapshot and revision; dispose removes the seat so a replacement context starts clean.
|
|
271
271
|
*/
|
|
272
|
+
const seats = /* @__PURE__ */ new WeakMap();
|
|
272
273
|
function createSettingsSeat(ctx) {
|
|
274
|
+
const key = ctx;
|
|
275
|
+
const existing = seats.get(key);
|
|
276
|
+
if (existing !== void 0) return existing;
|
|
273
277
|
const forms = /* @__PURE__ */ new Map();
|
|
274
|
-
|
|
278
|
+
const seat = {
|
|
275
279
|
get(namespace) {
|
|
276
280
|
let form = forms.get(namespace);
|
|
277
281
|
if (form === void 0) {
|
|
@@ -283,8 +287,14 @@ window.__ModuleLoader__.load({
|
|
|
283
287
|
dispose: () => {
|
|
284
288
|
for (const form of forms.values()) form.dispose?.();
|
|
285
289
|
forms.clear();
|
|
290
|
+
seats.delete(key);
|
|
286
291
|
}
|
|
287
292
|
};
|
|
293
|
+
seats.set(key, seat);
|
|
294
|
+
ctx.inject?.(["remote"], () => {
|
|
295
|
+
for (const form of forms.values()) form.refresh?.();
|
|
296
|
+
});
|
|
297
|
+
return seat;
|
|
288
298
|
}
|
|
289
299
|
//#endregion
|
|
290
300
|
//#region ../evolution-client-kit/src/workspace.ts
|
|
@@ -2850,7 +2860,7 @@ window.__ModuleLoader__.load({
|
|
|
2850
2860
|
];
|
|
2851
2861
|
/** The view component receives the workbench's activeView marker alongside its face. */
|
|
2852
2862
|
function MergeView(props) {
|
|
2853
|
-
return props.activeView
|
|
2863
|
+
return (0, react.createElement)("div", { hidden: props.activeView !== "merge" }, MergePanel(props));
|
|
2854
2864
|
}
|
|
2855
2865
|
/**
|
|
2856
2866
|
* Register the merge view on the workbench page.
|
|
@@ -2858,9 +2868,16 @@ window.__ModuleLoader__.load({
|
|
|
2858
2868
|
*/
|
|
2859
2869
|
function apply(ctx) {
|
|
2860
2870
|
const seat = createSettingsSeat(ctx);
|
|
2871
|
+
const store = new MergeStore({
|
|
2872
|
+
view,
|
|
2873
|
+
rows,
|
|
2874
|
+
body,
|
|
2875
|
+
history
|
|
2876
|
+
});
|
|
2861
2877
|
ctx.effect(() => () => {
|
|
2878
|
+
store.dispose();
|
|
2862
2879
|
seat.dispose?.();
|
|
2863
|
-
}, "evolution-merge-ui: settings seat");
|
|
2880
|
+
}, "evolution-merge-ui: settings seat + store");
|
|
2864
2881
|
registerWorkbenchView(ctx, {
|
|
2865
2882
|
id: PANEL_ID,
|
|
2866
2883
|
order: 45,
|
|
@@ -2875,15 +2892,9 @@ window.__ModuleLoader__.load({
|
|
|
2875
2892
|
},
|
|
2876
2893
|
component: MergeView,
|
|
2877
2894
|
face: (t) => {
|
|
2878
|
-
const source = {
|
|
2879
|
-
view,
|
|
2880
|
-
rows,
|
|
2881
|
-
body,
|
|
2882
|
-
history
|
|
2883
|
-
};
|
|
2884
2895
|
const workspaceId = panelWorkspaceId(ctx);
|
|
2885
2896
|
return {
|
|
2886
|
-
store
|
|
2897
|
+
store,
|
|
2887
2898
|
t,
|
|
2888
2899
|
doctorCommand: "/evolution doctor",
|
|
2889
2900
|
settings: {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
]
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.40.1",
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-dom": "^18.2.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@lmzhen/dsh-evolution-client-kit": "^0.
|
|
54
|
+
"@lmzhen/dsh-evolution-client-kit": "^0.40.1"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"dsh": ">=0.2.2-rc.0 <0.2.3-0"
|