@duke-dsh-plugins/dsh-remote-control 1.1.7 → 1.1.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 CHANGED
@@ -9,6 +9,10 @@
9
9
  * - the actions: save the relay address, rotate the pairing key and
10
10
  * hide / show the pairing.
11
11
  *
12
+ * The nav glyph of that section comes from the `settings.section.icon` slot
13
+ * (DSH 0.2.2-rc.1+): we register our whale under the same id as the section,
14
+ * so the shell draws it instead of the generic gear.
15
+ *
12
16
  * The phone pairing flow is unchanged: the QR still encodes the same
13
17
  * `dshrc://pair?…` URI as before (contract §3.5) — only the entry point moved
14
18
  * from the `/remote-pairing` command into this settings page (v1.1.x).
@@ -80,52 +84,45 @@ const CLIENT_ICON_MASK_URI =
80
84
  .rc-spinner{width:16px;height:16px;border-radius:50%;border:2px solid var(--dsw-alias-border-l1);border-top-color:var(--dsw-alias-brand-primary);animation:rc-spin .8s linear infinite;flex:none}
81
85
  @keyframes rc-spin{to{transform:rotate(360deg)}}
82
86
 
83
- /* Settings nav icon: DSH 0.1.x settings.section only projects id/order/label,
84
- and the settings shell paints a generic gear for every external section
85
- (client-ui-settings-general's navIcon()). registerSettingsNavIcon marks our
86
- own nav row; hide the shell's gear and draw this package's whale glyph as a
87
- currentColor mask so it follows the native nav hover/active colors.
88
- 20px (2026-10-24 user feedback): the mask viewBox is cropped tight to the
89
- whale+wave, so at 16px the glyph itself rendered only ~9px — too small next
90
- to the section labels; 20px restores legibility. */
91
- [data-dsh-remote-control-settings-nav]>svg:first-child{display:none}
92
- [data-dsh-remote-control-settings-nav]::before{content:'';flex:none;width:20px;height:20px;background:currentColor;-webkit-mask:url("__ICON_MASK__") center/contain no-repeat;mask:url("__ICON_MASK__") center/contain no-repeat}
87
+ /* Settings nav icon (DSH 0.2.2-rc.1+): the shell wraps every nav row's glyph in
88
+ <span.navIcon> and takes the glyph from the "settings.section.icon" slot, so we
89
+ contribute our whale there (see NavIcon) instead of patching the shell's DOM.
90
+ This rule only draws the mask — the shell owns the box, the button and the
91
+ label. The mask viewBox is cropped tight to the whale+wave, so the ink covers
92
+ ~84% of the box and lands on the same optical size as the shell's own 16px
93
+ glyphs (the old hack hardcoded a 20px box and read as too wide next to the
94
+ other sections). */
95
+ .rc-nav-icon{display:block;flex:none;background:currentColor;-webkit-mask:url("__ICON_MASK__") center/contain no-repeat;mask:url("__ICON_MASK__") center/contain no-repeat}
93
96
  `;
94
97
 
95
- // ---- Settings nav icon --------------------------------------------------
96
- // DSH 0.1.x does not yet carry an icon through the settings.section
97
- // registration contract: its shell projects only id/order/label and paints
98
- // a generic gear for every external section. Mark only this plugin's
99
- // localized nav row so the CSS above can replace the fallback gear; the
100
- // disposer clears the marker for HMR / plugin disable.
98
+ // ---- Settings section identity + nav icon --------------------------------
99
+ // DSH 0.2.2-rc.1 gave the settings shell a `settings.section.icon` slot:
100
+ // register an icon component under the **same id** as the section and the
101
+ // shell draws it instead of the generic gear (the component receives
102
+ // { size in pixels, active }; the shell owns button, label and the
103
+ // decorative wrapper). Before 0.2.2 that slot did not exist, so this
104
+ // package patched the shell's DOM instead (mark our nav row, hide the gear
105
+ // with `button > svg:first-child`, paint the whale with ::before). 0.2.2
106
+ // wrapped the glyph in <span.navIcon>, so that selector stopped matching:
107
+ // the gear was no longer hidden and BOTH the gear and the whale showed up
108
+ // (2026-11-04). The DOM hack is gone now — we use the native slot, and on
109
+ // pre-0.2.2 hosts the row simply falls back to the default gear.
101
110
  const SETTINGS_LABEL = "DSH Pocket";
102
- const SETTINGS_NAV_MARKER = "data-dsh-remote-control-settings-nav";
111
+ const SETTINGS_SECTION_ID = "remote-control";
103
112
 
104
- function registerSettingsNavIcon(label) {
105
- let disposed = false;
106
- const sync = function () {
107
- if (disposed) return;
108
- const currentLabel = String(label).trim();
109
- const buttons = document.querySelectorAll('[role="dialog"] nav button');
110
- for (let i = 0; i < buttons.length; i++) {
111
- const button = buttons[i];
112
- const text = button.textContent ? button.textContent.trim() : "";
113
- if (currentLabel.length > 0 && text === currentLabel) {
114
- button.setAttribute(SETTINGS_NAV_MARKER, "");
115
- } else {
116
- button.removeAttribute(SETTINGS_NAV_MARKER);
117
- }
118
- }
119
- };
120
- sync();
121
- const observer = new MutationObserver(sync);
122
- observer.observe(document.body, { childList: true, subtree: true, characterData: true });
123
- return function () {
124
- disposed = true;
125
- observer.disconnect();
126
- const marked = document.querySelectorAll("[" + SETTINGS_NAV_MARKER + "]");
127
- for (let i = 0; i < marked.length; i++) marked[i].removeAttribute(SETTINGS_NAV_MARKER);
128
- };
113
+ // Nav glyph for our settings section: this package's whale, drawn as a
114
+ // currentColor mask (see the .rc-nav-icon rule above) so it follows the
115
+ // shell's nav colors. `size` comes from the shell (16px, the same size it
116
+ // asks of its own glyphs) — honour it instead of hardcoding a width, so the
117
+ // row stays aligned with the other sections.
118
+ function NavIcon(props) {
119
+ const requested = props ? Number(props.size) : NaN;
120
+ const size = Number.isFinite(requested) && requested > 0 ? requested : 16;
121
+ return React.createElement("span", {
122
+ className: "rc-nav-icon",
123
+ style: { width: size + "px", height: size + "px" },
124
+ "aria-hidden": "true",
125
+ });
129
126
  }
130
127
 
131
128
  // ---- Client Remote contribution ----------------------------------------
@@ -348,13 +345,9 @@ const CLIENT_ICON_MASK_URI =
348
345
  /* cosmetic only */
349
346
  }
350
347
 
351
- // Mark our settings-nav row so the CSS above replaces the shell's
352
- // fallback gear (no icon field exists in settings.section yet).
353
- try {
354
- ctx.effect(() => registerSettingsNavIcon(SETTINGS_LABEL));
355
- } catch (e) {
356
- /* cosmetic only */
357
- }
348
+ // The nav glyph is contributed through the `settings.section.icon` slot
349
+ // (registered next to the section itself, further down) — no DOM
350
+ // patching of the shell's nav rows any more.
358
351
 
359
352
  function PairingPage() {
360
353
  const [state, setState] = React.useState({ loading: true, value: null, error: "", hint: "", hintKind: "" });
@@ -726,7 +719,7 @@ const CLIENT_ICON_MASK_URI =
726
719
  try {
727
720
  ctx.slots.inject("settings.section", () =>
728
721
  ctx.slots.register(
729
- { name: "settings.section", id: "remote-control", order: 40, label: () => SETTINGS_LABEL },
722
+ { name: "settings.section", id: SETTINGS_SECTION_ID, order: 40, label: () => SETTINGS_LABEL },
730
723
  PairingPage,
731
724
  ),
732
725
  );
@@ -737,6 +730,24 @@ const CLIENT_ICON_MASK_URI =
737
730
  e,
738
731
  );
739
732
  }
733
+
734
+ // Nav glyph for our section (DSH 0.2.2-rc.1+). The registration id must
735
+ // equal the section id — the shell renders the matching contribution and
736
+ // keeps its default gear for every id without one.
737
+ try {
738
+ ctx.slots.inject("settings.section.icon", () =>
739
+ ctx.slots.register(
740
+ { name: "settings.section.icon", id: SETTINGS_SECTION_ID, order: 40 },
741
+ NavIcon,
742
+ ),
743
+ );
744
+ } catch (e) {
745
+ // eslint-disable-next-line no-console
746
+ (typeof console !== "undefined" && console.warn ? console.warn : () => {})(
747
+ "[dsh-remote-control] settings.section.icon registration failed:",
748
+ e,
749
+ );
750
+ }
740
751
  }
741
752
 
742
753
  exports.apply = apply;
package/market/index.json CHANGED
@@ -69,6 +69,16 @@
69
69
  "sortKeys": {}
70
70
  },
71
71
  "versions": [
72
+ {
73
+ "version": "1.1.8",
74
+ "publishTimestamp": 1793807705,
75
+ "source": {
76
+ "type": "npm"
77
+ },
78
+ "engines": {
79
+ "dsh": "^0.1.5-rc.3 || ^0.2.0-rc.1 || ^0.2.1-rc.0"
80
+ }
81
+ },
72
82
  {
73
83
  "version": "1.1.7",
74
84
  "publishTimestamp": 1793320998,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duke-dsh-plugins/dsh-remote-control",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Remote-control bridge for DeepSeek Harness: pairs a HarmonyOS phone app with the desktop Host over an end-to-end-encrypted public relay (WebSocket). Lets the phone list/create/switch sessions, send prompts, watch streamed replies, cancel turns, and answer approval and ask-user-question requests from anywhere; pushes Huawei Push Kit notifications (gracefully disabled when AGC is unconfigured) for approvals, questions, and turn completion. The pairing QR lives in the DSH settings panel (\"DSH Pocket\"). Fail-open by design: any relay timeout or fault hands the request back to the desktop answerer.",
5
5
  "type": "module",
6
6
  "main": "index.js",