@deepseek-ai/dsh-client-ui-settings-general 0.1.0-rc.7 → 0.1.0-rc.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
@@ -5,7 +5,6 @@ window.__ModuleLoader__.load({
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let _deepseek_ai_dsh_client_ui_slots = require("@deepseek-ai/dsh-client-ui-slots");
8
- let _deepseek_ai_dsh_client_web_react = require("@deepseek-ai/dsh-client-web-react");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
10
9
  let react = require("react");
11
10
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
@@ -36,25 +35,25 @@ window.__ModuleLoader__.load({
36
35
  document.head.appendChild(tag);
37
36
  }
38
37
  var SettingsRoot_module_css_default = {
38
+ "actions": "VOzbGW_actions",
39
+ "active": "VOzbGW_active",
40
+ "close": "VOzbGW_close",
41
+ "content": "VOzbGW_content",
42
+ "header": "VOzbGW_header",
43
+ "hiddenLabel": "VOzbGW_hiddenLabel",
44
+ "mask": "VOzbGW_mask",
39
45
  "nav": "VOzbGW_nav",
40
- "overlay": "VOzbGW_overlay",
46
+ "navCell": "VOzbGW_navCell",
47
+ "navIcon": "VOzbGW_navIcon",
48
+ "navLabel": "VOzbGW_navLabel",
41
49
  "navList": "VOzbGW_navList",
42
- "content": "VOzbGW_content",
50
+ "navTitle": "VOzbGW_navTitle",
43
51
  "options": "VOzbGW_options",
44
- "trigger": "VOzbGW_trigger",
52
+ "overlay": "VOzbGW_overlay",
45
53
  "panel": "VOzbGW_panel",
46
- "mask": "VOzbGW_mask",
47
- "navIcon": "VOzbGW_navIcon",
48
- "hiddenLabel": "VOzbGW_hiddenLabel",
49
- "header": "VOzbGW_header",
50
- "actions": "VOzbGW_actions",
51
54
  "rail": "VOzbGW_rail",
52
- "active": "VOzbGW_active",
53
- "navTitle": "VOzbGW_navTitle",
54
- "close": "VOzbGW_close",
55
- "triggerLabel": "VOzbGW_triggerLabel",
56
- "navLabel": "VOzbGW_navLabel",
57
- "navCell": "VOzbGW_navCell"
55
+ "trigger": "VOzbGW_trigger",
56
+ "triggerLabel": "VOzbGW_triggerLabel"
58
57
  };
59
58
  //#endregion
60
59
  //#region lib/types/client/SettingsRoot.js
@@ -311,8 +310,8 @@ window.__ModuleLoader__.load({
311
310
  document.head.appendChild(tag);
312
311
  }
313
312
  var SettingsDocumentAction_module_css_default = {
314
- "error": "me01iq_error",
315
- "action": "me01iq_action"
313
+ "action": "me01iq_action",
314
+ "error": "me01iq_error"
316
315
  };
317
316
  //#endregion
318
317
  //#region lib/types/client/SettingsDocumentAction.js
@@ -351,53 +350,40 @@ window.__ModuleLoader__.load({
351
350
  function messageOf(error) {
352
351
  return error instanceof Error ? error.message : String(error);
353
352
  }
354
- /** Loads local-document availability and invokes the pathless Host-owned open operation. */
353
+ /** Derives local-document availability from the shared mirror and invokes the pathless Host-owned open operation. */
355
354
  var SettingsDocumentStore = class {
356
355
  api;
356
+ describeFace;
357
357
  /** uSES-safe state source shared by the registered header action. */
358
358
  store = (0, _deepseek_ai_dsh_client_runtime_client.createSnapshotStore)({
359
359
  status: "idle",
360
360
  opening: false,
361
361
  error: null
362
362
  });
363
- generation = 0;
363
+ following;
364
364
  /**
365
- * @param api - loopback settings wire face that reports and opens the provider document.
365
+ * @param api - loopback settings wire face that opens the provider document.
366
+ * @param describeFace - the shared mirror's describe face (`hasDocument` source).
366
367
  */
367
- constructor(api) {
368
+ constructor(api, describeFace) {
368
369
  this.api = api;
370
+ this.describeFace = describeFace;
369
371
  }
370
372
  /**
371
- * Load whether the current provider owns a local document.
372
- * @returns after the latest metadata response updates the store.
373
+ * Begin following the mirror (idempotent) and reflect whether the current
374
+ * provider owns a local document.
375
+ * @returns settlement once the snapshot reflects the mirror.
373
376
  */
374
377
  async load() {
375
- const generation = ++this.generation;
378
+ this.following ??= this.describeFace.subscribe(() => {
379
+ this.derive();
380
+ });
376
381
  this.store.update((state) => {
377
382
  state.status = "loading";
378
383
  state.error = null;
379
384
  });
380
- try {
381
- const { result } = await this.api.settings.describe({});
382
- if (generation !== this.generation) return;
383
- if (!result.ok) {
384
- this.store.update((state) => {
385
- state.status = "unavailable";
386
- state.error = result.error.message;
387
- });
388
- return;
389
- }
390
- this.store.update((state) => {
391
- state.status = result.value.hasDocument ? "ready" : "unavailable";
392
- state.error = null;
393
- });
394
- } catch (error) {
395
- if (generation !== this.generation) return;
396
- this.store.update((state) => {
397
- state.status = "unavailable";
398
- state.error = messageOf(error);
399
- });
400
- }
385
+ await this.describeFace.ensure();
386
+ this.derive();
401
387
  }
402
388
  /**
403
389
  * Open the loaded document once; concurrent gestures collapse behind the in-flight action.
@@ -423,15 +409,27 @@ window.__ModuleLoader__.load({
423
409
  });
424
410
  }
425
411
  }
412
+ /** Stop following the mirror. */
413
+ dispose() {
414
+ this.following?.();
415
+ this.following = void 0;
416
+ }
417
+ derive() {
418
+ const mirrored = this.describeFace.getSnapshot();
419
+ if (mirrored.view === void 0) {
420
+ if (mirrored.error !== null) this.store.update((state) => {
421
+ state.status = "unavailable";
422
+ state.error = mirrored.error;
423
+ });
424
+ return;
425
+ }
426
+ const { hasDocument } = mirrored.view;
427
+ this.store.update((state) => {
428
+ state.status = hasDocument ? "ready" : "unavailable";
429
+ state.error = null;
430
+ });
431
+ }
426
432
  };
427
- /**
428
- * Refresh document availability after reconnect only when a surface has already requested it.
429
- * @param controller - optional loopback document state owner.
430
- */
431
- function refreshDocumentIfLoaded(controller) {
432
- if (controller === void 0 || controller.store.getSnapshot().status === "idle") return;
433
- controller.load();
434
- }
435
433
  //#endregion
436
434
  //#region lib/types/client/locales.js
437
435
  /** Shell chrome and General-nav dictionaries; feature rows own their copy. */
@@ -465,7 +463,8 @@ window.__ModuleLoader__.load({
465
463
  const inject = [
466
464
  "slots",
467
465
  "locale",
468
- "connection"
466
+ "connection",
467
+ "settingsScope"
469
468
  ];
470
469
  /**
471
470
  * Register the `settings` dictionaries, the chrome content, and the General
@@ -479,17 +478,14 @@ window.__ModuleLoader__.load({
479
478
  }), "ui-settings-general: dictionaries");
480
479
  const t = ctx.locale.bind(NS);
481
480
  const connection = ctx.get("connection");
482
- const documentController = connection.isLoopback ? new SettingsDocumentStore(connection.api) : void 0;
483
- const documentInjected = documentController === void 0 ? void 0 : (() => {
484
- const useSnapshot = (0, _deepseek_ai_dsh_client_web_react.bindSnapshotSelector)(documentController.store);
485
- return () => ({
486
- controller: documentController,
487
- useSnapshot
488
- });
489
- })();
490
- ctx.effect(() => ctx.on("connection/reset", () => {
491
- refreshDocumentIfLoaded(documentController);
492
- }), "ui-settings-general: metadata invalidations");
481
+ const documentController = connection.isLoopback ? new SettingsDocumentStore(connection.api, ctx.settingsScope.describe()) : void 0;
482
+ const documentInjected = documentController === void 0 ? void 0 : () => ({
483
+ controller: documentController,
484
+ hooks: { snapshot: documentController.store }
485
+ });
486
+ ctx.effect(() => () => {
487
+ documentController?.dispose();
488
+ }, "ui-settings-general: document action directory");
493
489
  let rowsVersion = -1;
494
490
  let rowsRevision = -1;
495
491
  let rows = [];
@@ -1,17 +1,18 @@
1
1
  /** Optional settings-header action for opening a file-backed Host document. */
2
2
  import type { ReactNode } from 'react';
3
- import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
4
- import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-web-react';
5
- import type { SettingsDocumentState, SettingsDocumentStore } from './settings-document-store.ts';
3
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
4
+ import type { SettingsDocumentStore } from './settings-document-store.ts';
6
5
  /** Registrant-owned dependencies of {@link SettingsDocumentAction}. */
7
6
  export interface SettingsDocumentActionInjected {
8
7
  /** Provider metadata and action state owner. */
9
8
  controller: SettingsDocumentStore;
10
- /** Bound selector hook for the controller snapshot. */
11
- useSnapshot: SnapshotSelectorHook<SettingsDocumentState>;
9
+ hooks: {
10
+ /** Controller snapshot bound by the UI renderer as useSnapshot. */
11
+ snapshot: SettingsDocumentStore['store'];
12
+ };
12
13
  }
13
14
  /** Header-action owner share, localized copy, and the registrant's state face. */
14
- export type SettingsDocumentActionProps = PropsRuntime<'settings.action'> & PropsLocale<'settings'> & SettingsDocumentActionInjected;
15
+ export type SettingsDocumentActionProps = PropsRuntime<'settings.action'> & PropsLocale<'settings'> & InjectFace<SettingsDocumentActionInjected>;
15
16
  /**
16
17
  * Render the open-document action only after Host metadata confirms document availability.
17
18
  * @param props - header owner props, localized copy, and injected document state.
@@ -1,6 +1,7 @@
1
1
  /** State owner for the optional local settings-document action. */
2
2
  import type { IApiClient } from '@deepseek-ai/dsh-api-remotes/client';
3
3
  import { type SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client';
4
+ import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client';
4
5
  /** Browser state of the Host-owned settings document. */
5
6
  export interface SettingsDocumentState {
6
7
  /** Metadata-loading phase; unavailable means the provider has no local document or the read failed. */
@@ -10,19 +11,22 @@ export interface SettingsDocumentState {
10
11
  /** Last metadata/native-open diagnostic; UI exposes only localized copy. */
11
12
  error: string | null;
12
13
  }
13
- /** Loads local-document availability and invokes the pathless Host-owned open operation. */
14
+ /** Derives local-document availability from the shared mirror and invokes the pathless Host-owned open operation. */
14
15
  export declare class SettingsDocumentStore {
15
16
  private readonly api;
17
+ private readonly describeFace;
16
18
  /** uSES-safe state source shared by the registered header action. */
17
19
  readonly store: SnapshotStore<SettingsDocumentState>;
18
- private generation;
20
+ private following;
19
21
  /**
20
- * @param api - loopback settings wire face that reports and opens the provider document.
22
+ * @param api - loopback settings wire face that opens the provider document.
23
+ * @param describeFace - the shared mirror's describe face (`hasDocument` source).
21
24
  */
22
- constructor(api: Pick<IApiClient, 'settings'>);
25
+ constructor(api: Pick<IApiClient, 'settings'>, describeFace: SettingsDescribeFace);
23
26
  /**
24
- * Load whether the current provider owns a local document.
25
- * @returns after the latest metadata response updates the store.
27
+ * Begin following the mirror (idempotent) and reflect whether the current
28
+ * provider owns a local document.
29
+ * @returns settlement once the snapshot reflects the mirror.
26
30
  */
27
31
  load(): Promise<void>;
28
32
  /**
@@ -30,10 +34,8 @@ export declare class SettingsDocumentStore {
30
34
  * @returns after the native-open request settles, or immediately when unavailable/already opening.
31
35
  */
32
36
  open(): Promise<void>;
37
+ /** Stop following the mirror. */
38
+ dispose(): void;
39
+ private derive;
33
40
  }
34
- /**
35
- * Refresh document availability after reconnect only when a surface has already requested it.
36
- * @param controller - optional loopback document state owner.
37
- */
38
- export declare function refreshDocumentIfLoaded(controller: SettingsDocumentStore | undefined): void;
39
41
  //# sourceMappingURL=settings-document-store.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-settings-general",
3
3
  "description": "Settings ownerless-copy and product onboarding plugin: the General section, shell trigger/header chrome content, settings dictionaries, and the versioned welcome notice",
4
- "version": "0.1.0-rc.7",
4
+ "version": "0.1.0-rc.8",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -45,38 +45,34 @@
45
45
  "license": "MIT",
46
46
  "dependencies": {
47
47
  "clsx": "^2.0.0",
48
- "@deepseek-ai/schemastery": "^3.18.1",
49
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.7"
48
+ "@deepseek-ai/schemastery": "^3.18.1"
50
49
  },
51
50
  "peerDependencies": {
52
- "react": "^18.2.0",
53
- "@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.7",
54
- "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.7",
55
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.7",
56
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.7",
57
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.7",
58
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.0-rc.7",
59
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.7",
60
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.7",
61
- "@deepseek-ai/dsh-client-web-react": "^0.1.0-rc.7",
62
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
63
- "@deepseek-ai/cordis": "^4.0.1"
51
+ "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.8",
52
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
53
+ "@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.8",
54
+ "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
55
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.8",
56
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.0-rc.8",
57
+ "@deepseek-ai/cordis": "^4.0.1",
58
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
59
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.8"
64
60
  },
65
61
  "devDependencies": {
66
62
  "@types/react": "~18.3.1",
67
63
  "react": "^18.2.0",
68
- "@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.7",
69
- "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.7",
70
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.7",
71
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.7",
72
- "@deepseek-ai/dsh-client-test-runtime": "^0.1.0-rc.7",
73
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.7",
74
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.7",
75
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.0-rc.7",
76
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.7",
77
- "@deepseek-ai/dsh-client-web-react": "^0.1.0-rc.7",
78
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
79
- "@deepseek-ai/cordis": "^4.0.1"
64
+ "@deepseek-ai/dsh-api-remotes": "^0.1.0-rc.8",
65
+ "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.8",
66
+ "@deepseek-ai/dsh-client-test-runtime": "^0.1.0-rc.8",
67
+ "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
68
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
69
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.8",
70
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.8",
71
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.0-rc.8",
72
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.8",
73
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
74
+ "@deepseek-ai/cordis": "^4.0.1",
75
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.8"
80
76
  },
81
77
  "files": [
82
78
  "lib/index.js",