@sunshaobei/dsh-session-manager 3.0.6 → 3.0.8
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/client.js +17 -6
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -2139,17 +2139,28 @@ window.__ModuleLoader__.load({
|
|
|
2139
2139
|
// 约等于视口 < 800px)就整项消失,这正是「设置里没有会话回收站」的真正原因。
|
|
2140
2140
|
// 25 落在 20(mnemon「Memory System」)与 30(cost-meter「Cost」)之间,
|
|
2141
2141
|
// 属于最上面几项,任何能看见设置导航的窗口都能看见它。
|
|
2142
|
-
// 插件管理二级页(plugins.bundle.config
|
|
2143
|
-
//
|
|
2142
|
+
// 插件管理二级页(plugins.bundle.config,同 dsh-context):
|
|
2143
|
+
// key 必须等于插件包名(页面用 configured = bundles.has(pkg.name) 决定是否渲染配置区)。
|
|
2144
|
+
const CFG_KEY = '@sunshaobei/dsh-session-manager';
|
|
2145
|
+
const settingsStore = (() => {
|
|
2146
|
+
let form; let state = {}; const listeners = new Set();
|
|
2147
|
+
const notify = () => listeners.forEach((fn) => fn());
|
|
2148
|
+
return {
|
|
2149
|
+
get state() { return state; },
|
|
2150
|
+
subscribe(fn) { listeners.add(fn); return () => listeners.delete(fn); },
|
|
2151
|
+
attach(f) { form = f; try { state = { ...state, ...(f && f.get ? f.get() : {}) }; } catch {} notify(); let un; try { un = f.subscribe(() => { try { state = { ...state, ...(f.get ? f.get() : {}) }; } catch {} notify(); }); } catch {} return () => { if (un) un(); if (form === f) form = undefined; }; },
|
|
2152
|
+
set(k, v) { state = { ...state, [k]: v }; notify(); if (form && typeof form.set === 'function') form.set(k, v).catch(() => {}); },
|
|
2153
|
+
};
|
|
2154
|
+
})();
|
|
2144
2155
|
const registerPluginsPageCard = (env) => {
|
|
2145
2156
|
const cf = env && env.configForms;
|
|
2146
|
-
|
|
2147
|
-
|
|
2157
|
+
if (cf && typeof cf.get === 'function') { try { settingsStore.attach(cf.get(CFG_KEY)); } catch {} }
|
|
2158
|
+
ctx.slots.inject('plugins.bundle.config', () =>
|
|
2148
2159
|
ctx.slots.register(
|
|
2149
|
-
{ name: 'plugins.bundle.config', key:
|
|
2160
|
+
{ name: 'plugins.bundle.config', key: CFG_KEY, inject: () => ({ hooks: { sessionTrash: settingsStore }, set: (k, v) => settingsStore.set(k, v) }) },
|
|
2150
2161
|
(props) => TrashTab({ ...props, ctx })
|
|
2151
2162
|
)
|
|
2152
|
-
)
|
|
2163
|
+
);
|
|
2153
2164
|
};
|
|
2154
2165
|
if (typeof ctx.inject === 'function') ctx.inject(['configForms'], registerPluginsPageCard);
|
|
2155
2166
|
else registerPluginsPageCard(ctx);
|
package/package.json
CHANGED