@wcstack/state 1.26.0 → 1.27.0

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/dist/index.d.ts CHANGED
@@ -140,6 +140,18 @@ interface IStateElement {
140
140
  * optional なのはテスト用モック互換のため(undefined は「宣言なし」扱い)。
141
141
  */
142
142
  readonly listKeys?: ListKeyMap | null;
143
+ /**
144
+ * `$watch` 宣言から生成した監視対象パスの集合。
145
+ * 宣言が無ければ null / undefined で、setByAddress の旧値キャプチャには一切入らない
146
+ * (docs/state-watch-hook-design.md §10 のゼロコスト契約)。
147
+ * optional なのはテスト用モック互換のため(undefined は「宣言なし」扱い)。
148
+ */
149
+ readonly watchPaths?: ReadonlySet<string> | null;
150
+ /**
151
+ * パスを依存グラフへ登録する。DOM バインディング登録(BindingSession)のほか、
152
+ * `$watch` 宣言(processWatchDeclaration)からも呼ばれる — 静的依存グラフに
153
+ * 載るのがバインド済みパスだけだと headless 購読が成立しないため(設計書 §8)。
154
+ */
143
155
  setPathInfo(path: string, bindingType: BindingType): void;
144
156
  addStaticDependency(parentPath: string, childPath: string): boolean;
145
157
  addDynamicDependency(fromPath: string, toPath: string): boolean;
@@ -740,6 +752,19 @@ type DevtoolsEvent = {
740
752
  readonly tokenName: string;
741
753
  readonly args: readonly unknown[];
742
754
  readonly subscriberCount: number;
755
+ } | {
756
+ readonly type: "state:watch-error";
757
+ /** throw 元。cur の評価(getter)とハンドラ本体では原因も直し方も違う */
758
+ readonly phase: "prime" | "evaluate" | "handler";
759
+ readonly stateName: string;
760
+ /** `$watch` の宣言キー(ワイルドカードを含む生のパス) */
761
+ readonly path: string;
762
+ readonly error: unknown;
763
+ } | {
764
+ readonly type: "state:watch-chain-limit";
765
+ readonly maxDepth: number;
766
+ /** 打ち切ったバッチに載っていたアドレスのパス(報告用) */
767
+ readonly paths: readonly string[];
743
768
  } | {
744
769
  readonly type: "propagation:suppressed";
745
770
  readonly reason: "confirmation" | "visited-edge";