@240xu/dsh-websearch 2.0.0 → 2.0.2

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.
Files changed (2) hide show
  1. package/lib/client.js +11 -15
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -85,10 +85,6 @@ window.__ModuleLoader__.load({
85
85
  };
86
86
  }
87
87
 
88
- function useStore(store, selector = (s) => s) {
89
- return react.useSyncExternalStore(store.subscribe, () => selector(store.getSnapshot()));
90
- }
91
-
92
88
  /**
93
89
  * Card state machine: reads the bound settings scope snapshot, stages edits,
94
90
  * writes section fields through scope.set/unset and secrets via credentials.
@@ -199,16 +195,16 @@ window.__ModuleLoader__.load({
199
195
  }
200
196
 
201
197
  inject() {
198
+ // Slot contract: hooks.{name} must be an observable store; the renderer
199
+ // converts it into props.use{Name} (observableHook). Actions go top-level.
202
200
  return {
203
- hooks: {
204
- useCard: () => useStore(this.store),
205
- edit: (f, t) => this.edit(f, t),
206
- setToggle: (id, checked) => this.setToggle(id, checked),
207
- reset: (f) => this.reset(f),
208
- editKey: (r, t) => this.editKey(r, t),
209
- save: () => this.save(),
210
- discard: () => { this.staged.clear(); this.stagedKeys.clear(); this.failed = false; this.republish(); },
211
- },
201
+ hooks: { unifiedSearchCard: this.store },
202
+ edit: (f, t) => this.edit(f, t),
203
+ setToggle: (id, checked) => this.setToggle(id, checked),
204
+ reset: (f) => this.reset(f),
205
+ editKey: (r, t) => this.editKey(r, t),
206
+ save: () => this.save(),
207
+ discard: () => { this.staged.clear(); this.stagedKeys.clear(); this.failed = false; this.republish(); },
212
208
  };
213
209
  }
214
210
  }
@@ -231,8 +227,8 @@ window.__ModuleLoader__.load({
231
227
 
232
228
  /** The card root. */
233
229
  function UnifiedSearchCard(props) {
234
- const card = props.card;
235
- const state = card.useCard();
230
+ const state = props.useUnifiedSearchCard((snapshot) => snapshot);
231
+ const card = { edit: props.edit, setToggle: props.setToggle, reset: props.reset, editKey: props.editKey, save: props.save, discard: props.discard };
236
232
  // Occupants of settings.plugin.item render inside the tab's <ul>; use <li>.
237
233
  if (!state.ready) {
238
234
  return react_jsx_runtime.jsx("li", { className: "wsc-card", style: { fontSize: 12, opacity: .6 }, children: "…" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@240xu/dsh-websearch",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Unified web search provider for DeepSeek Harness (ctx.web): 11 backends — Exa + Parallel + DDG + SearXNG (keyless), DeepSeek + Anthropic + OpenAI + Brave + Tavily + Serper + Mojeek (key-gated via Settings credentials). Registers provider id \"unified\" for zero-config web_search tool.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",