@deepseek-ai/dsh-client-ui-slots 0.1.2-alpha.3 → 0.1.2-alpha.4

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/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/client/ui-slots/README.md
5
- README.md: 7b5b55c7f640d290b569354a1d2ce1771fcbf871
6
- README.zh.md: 3212304227048c5334695395160378c7dfb19fb3
5
+ README.md: 037b2de5f1ea23e103dfb9adf766fa309cccc36f
6
+ README.zh.md: 521b4be18b30cf27d7e89b33b02f2e4a2c9e144e
package/README.md CHANGED
@@ -101,3 +101,5 @@ These limits define the registry's scaling behavior and accepted type noise; the
101
101
  None.
102
102
 
103
103
  </details>
104
+
105
+ **Runtime invariant:** No companion is published. A zero-dependency pure registry core — it emits no cordis events itself (the `ui-renderer` SlotRegistry owns the event bridge and its invariants); define/register/dispose sequencing is asserted directly by this package's behavior specs.
package/README.zh.md CHANGED
@@ -101,3 +101,5 @@ register 调用可以用 `store: defineStore(...)` 声明 store 席位:`init`
101
101
  无。
102
102
 
103
103
  </details>
104
+
105
+ **运行时不变式:** 不发布伴生入口。这是零依赖纯 registry core,本身不发出 Cordis 事件;`ui-renderer` SlotRegistry 负责事件桥及其不变式。
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { ReactNode } from 'react';
12
12
  import type { BoundActions, HandleOf, PropsStore, SnapshotSelectorHook, StoreDecl } from '@deepseek-ai/dsh-client-store';
13
- import type { HostObservable } from './renderer.ts';
13
+ import type { HostObservable, KeyedStandardSource } from './renderer.ts';
14
14
  export * from './store.ts';
15
15
  export * from './renderer.ts';
16
16
  /** Slot contract table. Owners extend via declaration merging; entries are {@link SlotEntryDef}. */
@@ -312,6 +312,20 @@ export type SlotComponent<P> = (props: P) => ReactNode;
312
312
  * not participate in render-occurrence context.
313
313
  */
314
314
  export type HooksSources = Record<string, HostObservable<unknown>>;
315
+ /** Registrant keyed-hooks compartment: stable key-to-observable resolvers. */
316
+ export type KeyedHooksSources = Record<string, KeyedStandardSource>;
317
+ /** Selector Hook over an open family of keyed observable sources. */
318
+ export type KeyedSnapshotSelectorHook<Snapshot> = {
319
+ /** @param key - source key. @returns the current value, or absence when the source is unavailable. */
320
+ (key: string): Snapshot | undefined;
321
+ /**
322
+ * @param key - source key.
323
+ * @param selector - projection over the current keyed value.
324
+ * @param equal - optional selected-value equality.
325
+ * @returns the selected value.
326
+ */
327
+ <Selected>(key: string, selector: (value: Snapshot | undefined) => Selected, equal?: (left: Selected, right: Selected) => boolean): Selected;
328
+ };
315
329
  /** Framework-owned props visible while a slot-level contextual Hook is bound. */
316
330
  export type StandardPropsOf<K extends keyof SlotMap & string> = (ScopeOf<K> extends 'session' ? SessionStandardProps : ScopeOf<K> extends 'session-maybe' ? SessionMaybeStandardProps : object) & GlobalStandardProps;
317
331
  /**
@@ -336,6 +350,10 @@ export type SlotInjectFace<I extends object> = I extends {
336
350
  export type PropsHooks<HS extends HooksSources> = {
337
351
  [N in keyof HS & string as `use${Capitalize<N>}`]: SnapshotSelectorHook<HS[N] extends HostObservable<infer T> ? T : never>;
338
352
  };
353
+ /** Selector-hook share synthesized from an entry inject keyed-hooks compartment. */
354
+ export type PropsKeyedHooks<HS extends KeyedHooksSources> = {
355
+ [N in keyof HS & string as `use${Capitalize<N>}`]: KeyedSnapshotSelectorHook<HS[N] extends (key: string) => HostObservable<infer T> | undefined ? T : never>;
356
+ };
339
357
  /**
340
358
  * The component-side view of an inject face: the reserved `hooks`
341
359
  * compartment (when declared) arrives as bound `use<Name>` selector hooks;
@@ -343,7 +361,11 @@ export type PropsHooks<HS extends HooksSources> = {
343
361
  */
344
362
  export type InjectFace<I extends object> = I extends {
345
363
  hooks: infer HS extends HooksSources;
346
- } ? Omit<I, 'hooks'> & PropsHooks<HS> : I;
364
+ } ? I extends {
365
+ keyedHooks: infer KS extends KeyedHooksSources;
366
+ } ? Omit<I, 'hooks' | 'keyedHooks'> & PropsHooks<HS> & PropsKeyedHooks<KS> : Omit<I, 'hooks'> & PropsHooks<HS> : I extends {
367
+ keyedHooks: infer KS extends KeyedHooksSources;
368
+ } ? Omit<I, 'keyedHooks'> & PropsKeyedHooks<KS> : I;
347
369
  /**
348
370
  * The composed component props intersection: runtime share (SlotMap) +
349
371
  * child-render share (children declaration) + store share (declared handle) +
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-slots",
3
3
  "description": "Slot registry pure core: SlotMap declaration merging, single register composition API, four-share props types, store-seat types, renderer install seam",
4
- "version": "0.1.2-alpha.3",
4
+ "version": "0.1.2-alpha.4",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -18,23 +18,17 @@
18
18
  "types": "./lib/types/index.d.ts",
19
19
  "default": "./lib/index.js"
20
20
  },
21
- "./invariant": {
22
- "types": "./lib/types/invariant.d.ts",
23
- "default": "./lib/invariant.js"
24
- },
25
21
  "./src/*": "./src/*",
26
22
  "./package.json": "./package.json"
27
23
  },
28
24
  "license": "MIT",
29
25
  "devDependencies": {
30
26
  "@types/react": "~18.3.1",
31
- "@deepseek-ai/dsh-client-store": "^0.1.2-alpha.3",
32
- "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
27
+ "@deepseek-ai/dsh-client-store": "^0.1.2-alpha.4",
33
28
  "@deepseek-ai/cordis": "^4.0.2"
34
29
  },
35
30
  "files": [
36
31
  "lib/index.js",
37
- "lib/invariant.js",
38
32
  "lib/types/**/*.d.ts"
39
33
  ],
40
34
  "peerDependencies": {
package/lib/invariant.js DELETED
@@ -1,27 +0,0 @@
1
- //#region lib/types/invariant.js
2
- /**
3
- * Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-slots`.
4
- * @module @deepseek-ai/dsh-client-ui-slots/invariant
5
- */
6
- const PACKAGE_NAME = "@deepseek-ai/dsh-client-ui-slots";
7
- /** Cordis companion plugin name. */
8
- const name = "client-ui-slots-invariant";
9
- /** Service required before the companion can reserve package ownership. */
10
- const inject = ["invariants"];
11
- /**
12
- * No runtime invariant: a zero-dependency pure registry core — it emits no
13
- * cordis events itself (the `ui-renderer` SlotRegistry owns the event
14
- * bridge and its invariants); define/register/dispose sequencing is asserted
15
- * directly by this package's behavior specs.
16
- */
17
- const install = () => {};
18
- /**
19
- * Register this package's invariant companion.
20
- * @param ctx - Cordis context carrying the invariant service.
21
- * @returns the installed registration's disposer after setup succeeds.
22
- */
23
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
24
- //#endregion
25
- export { apply, inject, name };
26
-
27
- //# sourceMappingURL=invariant.js.map
@@ -1,16 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-slots`.
3
- * @module @deepseek-ai/dsh-client-ui-slots/invariant
4
- */
5
- import type { Context } from '@deepseek-ai/cordis';
6
- /** Cordis companion plugin name. */
7
- export declare const name = "client-ui-slots-invariant";
8
- /** Service required before the companion can reserve package ownership. */
9
- export declare const inject: string[];
10
- /**
11
- * Register this package's invariant companion.
12
- * @param ctx - Cordis context carrying the invariant service.
13
- * @returns the installed registration's disposer after setup succeeds.
14
- */
15
- export declare const apply: (ctx: Context) => Promise<() => void>;
16
- //# sourceMappingURL=invariant.d.ts.map