dsh-tidy-display 0.4.7 → 0.4.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/lib/client.js CHANGED
@@ -52957,10 +52957,16 @@ html[${READER_ATTR}] [data-dsh-tidy-display] {
52957
52957
  return raw.subscribe(() => setPolled(raw.getSnapshot()));
52958
52958
  });
52959
52959
  const tabs = props.useTabs !== void 0 ? props.useTabs((value) => value) : polled;
52960
+ const ownId = props.ownId ?? "__own__";
52961
+ const rows = props.renderOwn ? [{
52962
+ id: ownId,
52963
+ order: Number.NEGATIVE_INFINITY,
52964
+ label: ownId
52965
+ }, ...tabs.filter((tab) => tab.id !== ownId)] : tabs;
52960
52966
  return (0, react.createElement)("div", { style: {
52961
52967
  display: "grid",
52962
52968
  gap: "12px"
52963
- } }, tabs.map((row) => (0, react.createElement)("div", { key: row.id }, props.renderSlot ? props.renderSlot(FAMILY_CHILD_KEY, {}, {
52969
+ } }, rows.map((row) => (0, react.createElement)("div", { key: row.id }, props.renderOwn && row.id === ownId ? props.renderOwn() : props.renderSlot ? props.renderSlot(FAMILY_CHILD_KEY, {}, {
52964
52970
  only: row.id,
52965
52971
  fallback: null
52966
52972
  }) : props.renderContributor?.(row.id) ?? null)));
@@ -53003,7 +53009,7 @@ html[${READER_ATTR}] [data-dsh-tidy-display] {
53003
53009
  * @param log - console 前缀(带插件名)。
53004
53010
  * @returns 取消定时器与撤销接管注册的 disposer。
53005
53011
  */
53006
- function claimFamilyHostIfOrphaned(slots, isHeld, label, log) {
53012
+ function claimFamilyHostIfOrphaned(slots, isHeld, label, log, ownTab) {
53007
53013
  let disposeClaim;
53008
53014
  let claimed = false;
53009
53015
  const timer = setTimeout(() => {
@@ -53034,7 +53040,9 @@ html[${READER_ATTR}] [data-dsh-tidy-display] {
53034
53040
  label,
53035
53041
  inject: () => ({
53036
53042
  hooks: { tabs: ledger },
53037
- renderContributor
53043
+ renderContributor,
53044
+ ownId: ownTab?.id,
53045
+ renderOwn: ownTab === void 0 ? void 0 : () => (0, react.createElement)(ownTab.component, ownTab.inject ? ownTab.inject() : {})
53038
53046
  }),
53039
53047
  children: { [FAMILY_CHILD_KEY]: {
53040
53048
  kind: "list",
@@ -53099,19 +53107,25 @@ html[${READER_ATTR}] [data-dsh-tidy-display] {
53099
53107
  languageTag: languageTag(ctx),
53100
53108
  checkSkill
53101
53109
  });
53102
- let familyTabHeld = false;
53103
- safeSeat("dsh-family.tab", () => ctx.slots.inject("dsh-family.tab", () => {
53104
- familyTabHeld = true;
53105
- return ctx.slots.register({
53106
- name: "dsh-family.tab",
53107
- id: "tidy-display",
53108
- order: 60,
53109
- label: () => locale?.bind?.("tidy-display")?.("nav") || settingsCopyFor(languageTag(ctx)).nav,
53110
- locale: locale?.bind ? "tidy-display" : void 0,
53111
- inject: injected
53112
- }, SettingsSection);
53113
- }));
53114
- ctx.effect(() => claimFamilyHostIfOrphaned(ctx.slots, () => familyTabHeld, () => "起子插件设置", "[dsh-tidy-display]"), "dsh-tidy-display: family host backstop");
53110
+ safeSeat("dsh-family.tab", () => ctx.slots.inject("dsh-family.tab", () => ctx.slots.register({
53111
+ name: "dsh-family.tab",
53112
+ id: "tidy-display",
53113
+ order: 60,
53114
+ label: () => locale?.bind?.("tidy-display")?.("nav") || settingsCopyFor(languageTag(ctx)).nav,
53115
+ locale: locale?.bind ? "tidy-display" : void 0,
53116
+ inject: injected
53117
+ }, SettingsSection)));
53118
+ ctx.effect(() => claimFamilyHostIfOrphaned(ctx.slots, () => {
53119
+ try {
53120
+ return ctx.slots.entries("settings.section").some((e) => String((e.options ?? {}).id ?? "") === "dsh-family");
53121
+ } catch {
53122
+ return false;
53123
+ }
53124
+ }, () => "起子插件设置", "[dsh-tidy-display]", {
53125
+ id: "tidy-display",
53126
+ component: SettingsSection,
53127
+ inject: injected
53128
+ }), "dsh-tidy-display: family host backstop");
53115
53129
  safeSeat("plugins.bundle.config/row.config", () => installPluginConfigCard(ctx, injected));
53116
53130
  }
53117
53131
  //#endregion