dsh-input-traffic 0.7.9 → 0.7.10
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/dsh.plugin.json +1 -1
- package/lib/client.js +30 -16
- package/lib/client.js.map +1 -1
- package/lib/types/client/family-host.d.ts +11 -2
- package/lib/types/client/family-host.d.ts.map +1 -1
- package/lib/types/client/family-host.js +21 -5
- package/lib/types/client/family-host.js.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +23 -15
- package/lib/types/client/index.js.map +1 -1
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -2000,10 +2000,16 @@ window.__ModuleLoader__.load({
|
|
|
2000
2000
|
return raw.subscribe(() => setPolled(raw.getSnapshot()));
|
|
2001
2001
|
});
|
|
2002
2002
|
const tabs = props.useTabs !== void 0 ? props.useTabs((value) => value) : polled;
|
|
2003
|
+
const ownId = props.ownId ?? "__own__";
|
|
2004
|
+
const rows = props.renderOwn ? [{
|
|
2005
|
+
id: ownId,
|
|
2006
|
+
order: Number.NEGATIVE_INFINITY,
|
|
2007
|
+
label: ownId
|
|
2008
|
+
}, ...tabs.filter((tab) => tab.id !== ownId)] : tabs;
|
|
2003
2009
|
return (0, react.createElement)("div", { style: {
|
|
2004
2010
|
display: "grid",
|
|
2005
2011
|
gap: "12px"
|
|
2006
|
-
} },
|
|
2012
|
+
} }, rows.map((row) => (0, react.createElement)("div", { key: row.id }, props.renderOwn && row.id === ownId ? props.renderOwn() : props.renderSlot ? props.renderSlot(FAMILY_CHILD_KEY, {}, {
|
|
2007
2013
|
only: row.id,
|
|
2008
2014
|
fallback: null
|
|
2009
2015
|
}) : props.renderContributor?.(row.id) ?? null)));
|
|
@@ -2046,7 +2052,7 @@ window.__ModuleLoader__.load({
|
|
|
2046
2052
|
* @param log - console 前缀(带插件名)。
|
|
2047
2053
|
* @returns 取消定时器与撤销接管注册的 disposer。
|
|
2048
2054
|
*/
|
|
2049
|
-
function claimFamilyHostIfOrphaned(slots, isHeld, label, log) {
|
|
2055
|
+
function claimFamilyHostIfOrphaned(slots, isHeld, label, log, ownTab) {
|
|
2050
2056
|
let disposeClaim;
|
|
2051
2057
|
let claimed = false;
|
|
2052
2058
|
const timer = setTimeout(() => {
|
|
@@ -2077,7 +2083,9 @@ window.__ModuleLoader__.load({
|
|
|
2077
2083
|
label,
|
|
2078
2084
|
inject: () => ({
|
|
2079
2085
|
hooks: { tabs: ledger },
|
|
2080
|
-
renderContributor
|
|
2086
|
+
renderContributor,
|
|
2087
|
+
ownId: ownTab?.id,
|
|
2088
|
+
renderOwn: ownTab === void 0 ? void 0 : () => (0, react.createElement)(ownTab.component, ownTab.inject ? ownTab.inject() : {})
|
|
2081
2089
|
}),
|
|
2082
2090
|
children: { [FAMILY_CHILD_KEY]: {
|
|
2083
2091
|
kind: "list",
|
|
@@ -2161,19 +2169,25 @@ window.__ModuleLoader__.load({
|
|
|
2161
2169
|
console.warn("[dsh-input-traffic] bridge busyEnter pin failed:", e);
|
|
2162
2170
|
});
|
|
2163
2171
|
});
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2172
|
+
ctx.slots.inject("dsh-family.tab", () => ctx.slots.register({
|
|
2173
|
+
name: "dsh-family.tab",
|
|
2174
|
+
id: "input-traffic",
|
|
2175
|
+
order: 50,
|
|
2176
|
+
label: () => tFamily("family.title"),
|
|
2177
|
+
locale: NS,
|
|
2178
|
+
inject: () => ({ scope: familyScopeRef.scope ?? bridgeScope })
|
|
2179
|
+
}, InputTrafficFamilyCard));
|
|
2180
|
+
ctx.effect(() => claimFamilyHostIfOrphaned(ctx.slots, () => {
|
|
2181
|
+
try {
|
|
2182
|
+
return ctx.slots.entries("settings.section").some((e) => String((e.options ?? {}).id ?? "") === "dsh-family");
|
|
2183
|
+
} catch {
|
|
2184
|
+
return false;
|
|
2185
|
+
}
|
|
2186
|
+
}, () => "起子插件设置", "[dsh-input-traffic]", {
|
|
2187
|
+
id: "input-traffic",
|
|
2188
|
+
component: InputTrafficFamilyCard,
|
|
2189
|
+
inject: () => ({ scope: familyScopeRef.scope ?? bridgeScope })
|
|
2190
|
+
}), "dsh-input-traffic: family host backstop");
|
|
2177
2191
|
registerSettingsFaces(ctx, {
|
|
2178
2192
|
namespace: CONVERSATION_SETTINGS_NAMESPACE,
|
|
2179
2193
|
field: BUSY_ENTER_FIELD,
|