@deepseek-ai/dsh-client-ui-slots 0.2.1-alpha.2 → 0.2.1-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
@@ -18,11 +18,11 @@
18
18
  en: 05691d44a0c6c48f
19
19
  zh: 434033d5761297f3
20
20
  /deepseek-ai-dsh-client-ui-slots/use-this-package/reusable-component-factories:
21
- en: 301de67bf2779ae6
22
- zh: 6e9d405ee1063d53
21
+ en: 71cbe7aa26f3ff80
22
+ zh: 0e35265d4d95cc36
23
23
  /deepseek-ai-dsh-client-ui-slots/use-this-package/the-five-framework-props-shares:
24
- en: 45e2933a5e084956
25
- zh: 938deedaf489f892
24
+ en: b69ffb6ca503e781
25
+ zh: fe5887cbfc7fb588
26
26
  /deepseek-ai-dsh-client-ui-slots/use-this-package/store-seats:
27
27
  en: 0d1c2948112841ec
28
28
  zh: fc5a998cea485024
package/README.md CHANGED
@@ -29,7 +29,7 @@ Compose UI through this package whenever you write a client plugin: register a c
29
29
 
30
30
  ### Reusable Component Factories
31
31
 
32
- Use a Component Factory when one package defines an assembly that unrelated parents render independently. Declare its complete type in `SlotFactoryMap`, install the definition with `ctx.slots.registerFactory()`, render occurrences through the injected `renderFactorySlot()`, and select each declared local Component through the call's `slots` option. The definition reads that choice through `useFactorySlot(name, fallback)`.
32
+ A designer may choose a Component Factory for a component or assembly they consider reusable, even with one current caller; unrelated parents, separate packages, and additional injection or local slots are not prerequisites. A one-off component need not use a Factory. Declare its complete type in `SlotFactoryMap`, install the definition with `ctx.slots.registerFactory()`, render occurrences through the injected `renderFactorySlot()`, and select each declared local Component through the call's `slots` option. The definition reads that choice through `useFactorySlot(name, fallback)`.
33
33
 
34
34
  Factory `children` remain ordinary global Slots and must match `SlotMap`, while local `slots` select one Component per occurrence. An occurrence inherits its render-position scope; `renderFactorySlot()` does not accept a Session identity. Shared Store handles use ordinary scope resolution. A Store factory stays lazy until an occurrence first materializes, then creates one handle for that render position and rejects a persistent Store spec whose key would collide across occurrences.
35
35
 
@@ -37,6 +37,8 @@ Factory `children` remain ordinary global Slots and must match `SlotMap`, while
37
37
 
38
38
  Every registered component receives props composed from five framework shares: the runtime share (`owner` from the parent's render call site, plus the session standard kit and global seat), the child-render share (`renderSlot` statically narrowed to declared children), the Factory-render share (`renderFactorySlot`), the store share (the declared handle's selector hook and draft-stripped actions), and the business share (inferred from `inject`). Components reference the derived props aliases; they never re-type a share locally.
39
39
 
40
+ An open-key standard Hook, called as `useName(key, selector?, equal?)`, also accepts `useName(key, member)`: a string second argument reads the `KeyedStandardSource` resolver's `(key, member)` source without a selector. The resolver returns the same source object for the same arguments while that source is live.
41
+
40
42
  ### Store seats
41
43
 
42
44
  A register call may declare a store seat with `store: defineStore(...)`: `init` infers the state schema and `actions` is the complete draft-transform write set. Components read through the selector hook and write through the baked callbacks; the engine implementation of `defineStore` lives in the runtime package and satisfies the `DefineStore` contract exported here.
package/README.zh.md CHANGED
@@ -29,7 +29,7 @@ kind: "package-library"
29
29
 
30
30
  ### 可复用 Component Factory
31
31
 
32
- 当一个包定义装配、而互不相关的 parents 需要独立渲染它时,使用 Component Factory。在 `SlotFactoryMap` 中声明完整类型,通过 `ctx.slots.registerFactory()` 安装 definition,通过注入的 `renderFactorySlot()` 渲染 occurrences,并通过调用的 `slots` 选项选择每个已声明的局部 Component。definition 通过 `useFactorySlot(name, fallback)` 读取该选择。
32
+ 设计者认为组件或装配可复用时,即使当前只有一个调用方,也可以选择 Component Factory;互不相关的父级、不同的包、额外注入或局部 slot 都不是前提。一次性组件不必使用 Factory。在 `SlotFactoryMap` 中声明完整类型,通过 `ctx.slots.registerFactory()` 安装 definition,通过注入的 `renderFactorySlot()` 渲染 occurrences,并通过调用的 `slots` 选项选择每个已声明的局部 Component。definition 通过 `useFactorySlot(name, fallback)` 读取该选择。
33
33
 
34
34
  Factory `children` 仍是普通全局 Slots 且必须与 `SlotMap` 匹配,而局部 `slots` 为每个 occurrence 选择一个 Component。occurrence 继承其渲染位置的 scope;`renderFactorySlot()` 不接受 Session identity。共享 Store handle 使用普通 scope 解析。Store factory 保持 lazy,直到 occurrence 首次物化时才为该渲染位置创建一个 handle;若持久化 Store spec 会让 persistence key 在 occurrences 之间冲突,renderer 会拒绝它。
35
35
 
@@ -37,6 +37,8 @@ Factory `children` 仍是普通全局 Slots 且必须与 `SlotMap` 匹配,而
37
37
 
38
38
  每个已注册组件都会收到由五个框架 share 组合而成的 props:运行时 share(父级 render 调用点的 `owner`,加上会话标准工具包与全局席位)、child render share(静态缩窄到已声明 children 的 `renderSlot`)、Factory render share(`renderFactorySlot`)、store share(已声明 handle 的 selector 钩子与移除 draft 的 actions),以及业务 share(从 `inject` 推导)。组件引用推导出的 props 别名;它们绝不在本地重新定义任何 share 的类型。
39
39
 
40
+ 以 `useName(key, selector?, equal?)` 调用的开放键标准钩子也接受 `useName(key, member)`:第二个参数为字符串时,钩子不经 selector,直接读取 `KeyedStandardSource` 解析器为 `(key, member)` 返回的 source。在该 source 存活期间,解析器对相同参数返回同一个 source 对象。
41
+
40
42
  ### Store 席位
41
43
 
42
44
  register 调用可以用 `store: defineStore(...)` 声明 store 席位:`init` 推断状态 schema,`actions` 是完整的 draft-transform 写入集合。组件经 selector 钩子读取、经烘焙回调写入;`defineStore` 的引擎实现位于运行时包,并满足这里导出的 `DefineStore` 约定。
@@ -96,6 +96,8 @@ export interface SlotScopeTargetMap {
96
96
  export interface SlotEntryDef {
97
97
  kind: SlotKind;
98
98
  scope: SlotScope;
99
+ /** Use span anchors and error placeholders for inline content; omitted uses div. */
100
+ inline?: true;
99
101
  owner?: object;
100
102
  /**
101
103
  * Optional keyed-entry prop table. A keyed registration contributes one
@@ -140,6 +142,8 @@ export interface SlotFactoryDef {
140
142
  export type SlotSpec<E extends SlotEntryDef> = {
141
143
  kind: E['kind'];
142
144
  scope: E['scope'];
145
+ /** Use span anchors and error placeholders for inline content; omitted uses div. */
146
+ inline?: true;
143
147
  } & ('inject' extends keyof E ? E extends {
144
148
  inject: infer Injected extends object;
145
149
  } ? {
@@ -54,8 +54,12 @@ export interface StoreInstanceLike {
54
54
  subscribe(fn: () => void): () => void;
55
55
  readonly actions: Record<string, (...params: never[]) => void>;
56
56
  }
57
- /** Resolve one member of an open-key standard hook family. */
58
- export type KeyedStandardSource = (key: string) => HostObservable<unknown> | undefined;
57
+ /**
58
+ * Resolve one member of an open-key standard hook family. `member` is present
59
+ * only when the Hook is called as `useName(key, member)`; the resolver returns
60
+ * the same source object for the same arguments while that source is live.
61
+ */
62
+ export type KeyedStandardSource = (key: string, member?: string) => HostObservable<unknown> | undefined;
59
63
  /**
60
64
  * Framework-neutral inputs from which the renderer materializes standard
61
65
  * props. A scope adapter keeps member names present while its binding is
@@ -66,7 +70,11 @@ export interface StandardSourceBinding {
66
70
  readonly key: string | undefined;
67
71
  /** Fixed-name sources; each `name` becomes a `useName` selector Hook. */
68
72
  readonly hooks: Readonly<Record<string, HostObservable<unknown> | undefined>>;
69
- /** Open-key source families; each `name` becomes a `useName(key, selector)` Hook. */
73
+ /**
74
+ * Open-key source families; each `name` becomes a `useName(key, selector?, equal?)`
75
+ * Hook, which also accepts `useName(key, member)` to read the resolver's
76
+ * `(key, member)` source without a selector.
77
+ */
70
78
  readonly keyedHooks: Readonly<Record<string, KeyedStandardSource | undefined>>;
71
79
  /** Stable plain values copied into standard props. */
72
80
  readonly props: Readonly<Record<string, unknown>>;
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: typed ordinary Slots and reusable Component Factories, derived props, Store seats, and renderer installation",
4
- "version": "0.2.1-alpha.2",
4
+ "version": "0.2.1-alpha.4",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -23,15 +23,15 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@deepseek-ai/dsh-client-store": "0.2.1-alpha.2",
27
- "@types/react": "~18.3.1",
28
- "@deepseek-ai/cordis": "~4.0.5-alpha.1"
26
+ "@deepseek-ai/dsh-client-store": "0.2.1-alpha.4",
27
+ "react": "^18.2.0",
28
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2"
29
29
  },
30
30
  "files": [
31
31
  "lib/index.js",
32
32
  "lib/types/**/*.d.ts"
33
33
  ],
34
34
  "peerDependencies": {
35
- "@deepseek-ai/cordis": "~4.0.5-alpha.1"
35
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2"
36
36
  }
37
37
  }