@wcstack/state 1.25.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/README.ja.md +223 -13
- package/README.md +227 -13
- package/dist/auto.min.js +2 -3
- package/dist/auto.min.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.esm.js +2828 -556
- package/dist/index.esm.js.map +1 -1
- package/dist/manifest.esm.js +163 -1
- package/dist/wcs-manifest.json +85 -0
- package/package.json +1 -1
- package/dist/auto.js +0 -3
- package/dist/index.esm.min.js +0 -2
- package/dist/index.esm.min.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list/listKeys.ts
|
|
3
|
+
*
|
|
4
|
+
* `$listKeys: { <listPath>: <fieldName | (row) => key> }` 宣言マップを解析し、
|
|
5
|
+
* 「リストパス → キー指定」表を構築する(docs/state-list-key-design.md §3)。
|
|
6
|
+
*
|
|
7
|
+
* この表が存在するリストパスへの配列代入は、setByAddress でキー突合され、
|
|
8
|
+
* 一致行は旧オブジェクトを据え置いたまま変化フィールドだけが per-path 書き込みで
|
|
9
|
+
* 流し込まれる(§2)。未宣言なら書き込み経路は従来と完全に同一。
|
|
10
|
+
*
|
|
11
|
+
* 「そのパスが実際にリストか」は宣言時には判定できない(listPaths は
|
|
12
|
+
* バインディング収集時に確定する)。実行時に配列でなければ経路に入らないだけで、
|
|
13
|
+
* 宣言自体はエラーにしない。
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** キー指定: フラットなフィールド名、または行から複合キーを作る関数 */
|
|
17
|
+
type ListKeySpec = string | ((row: any) => unknown);
|
|
18
|
+
type ListKeyMap = ReadonlyMap<string, ListKeySpec>;
|
|
19
|
+
|
|
1
20
|
/**
|
|
2
21
|
* Interface for hierarchical loop index management in nested loops.
|
|
3
22
|
* Tracks parent-child relationships, versions, and provides access to index hierarchy.
|
|
@@ -44,6 +63,20 @@ type Mutability = "readonly" | "writable";
|
|
|
44
63
|
|
|
45
64
|
interface IStateElement {
|
|
46
65
|
readonly name: string;
|
|
66
|
+
/**
|
|
67
|
+
* state のロードが完了しているか。`initializePromise` の同期版で、
|
|
68
|
+
* DCC のアクセサが「今すぐ読み書きしてよいか」を判断するのに使う。
|
|
69
|
+
* optional なのはテスト用モック互換のため(undefined は「不明=未初期化扱い」)。
|
|
70
|
+
*/
|
|
71
|
+
readonly initialized?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* この state element が今使えるか(= 接続済みで rootNode を保持しているか)。
|
|
74
|
+
* `createState` は rootNode を要求するので、false のときに呼ぶと raiseError する。
|
|
75
|
+
* 台帳に載っていること(登録済み)と使えることは別で、要素をキーにした台帳には
|
|
76
|
+
* 切断済みの state element が残る窓がある(§1.9)。
|
|
77
|
+
* optional なのはテスト用モック互換のため(undefined は「不明=使える扱い」)。
|
|
78
|
+
*/
|
|
79
|
+
readonly hasRootNode?: boolean;
|
|
47
80
|
readonly initializePromise: Promise<void>;
|
|
48
81
|
readonly connectedCallbackPromise: Promise<void>;
|
|
49
82
|
readonly listPaths: Set<string>;
|
|
@@ -56,7 +89,27 @@ interface IStateElement {
|
|
|
56
89
|
readonly version: number;
|
|
57
90
|
readonly rootNode: Node;
|
|
58
91
|
readonly boundComponentStateProp: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* `bind-component` で束ねられているコンポーネント要素(親スコープ側のノード)。
|
|
94
|
+
* マッピング規則の引き当てに使う。optional なのはテスト用モック互換のため。
|
|
95
|
+
*/
|
|
96
|
+
readonly boundComponent?: Element | null;
|
|
97
|
+
/**
|
|
98
|
+
* この state の実体が innerState proxy(= 値の正本が親スコープの state にある
|
|
99
|
+
* mapped な `bind-component`)か。真のときだけ越境アドレスの受け渡しと
|
|
100
|
+
* リストパスの外向き伝播が働く(§1.8)。
|
|
101
|
+
* optional なのはテスト用モック互換のため(undefined は plain 扱い)。
|
|
102
|
+
*/
|
|
103
|
+
readonly hasMappedComponentState?: boolean;
|
|
104
|
+
markComponentStateMapped?(): void;
|
|
105
|
+
/**
|
|
106
|
+
* DCC の `$bindables` から生成した「パス → 変更イベント名」表。
|
|
107
|
+
* 唯一の書き手は defineDCC で、読み手は setByAddress。
|
|
108
|
+
* getter だけを公開して setter をインターフェースから落としていたため
|
|
109
|
+
* defineDCC が具象 State に依存していた(§3.5)。
|
|
110
|
+
*/
|
|
59
111
|
readonly bindableEventMap: Record<string, string>;
|
|
112
|
+
setBindableEventMap(map: Record<string, string>): void;
|
|
60
113
|
readonly commandTokenNames: ReadonlySet<string>;
|
|
61
114
|
readonly eventTokenNames: ReadonlySet<string>;
|
|
62
115
|
/**
|
|
@@ -80,6 +133,25 @@ interface IStateElement {
|
|
|
80
133
|
*/
|
|
81
134
|
readonly indexDependentGetterPaths?: ReadonlySet<string>;
|
|
82
135
|
addIndexDependentGetterPath?(path: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* `$listKeys` 宣言から生成した「リストパス → キー指定」表。
|
|
138
|
+
* 宣言が無ければ null / undefined で、setByAddress のキー突合経路に一切入らない
|
|
139
|
+
* (docs/state-list-key-design.md §7-1 のゼロコスト契約)。
|
|
140
|
+
* optional なのはテスト用モック互換のため(undefined は「宣言なし」扱い)。
|
|
141
|
+
*/
|
|
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
|
+
*/
|
|
83
155
|
setPathInfo(path: string, bindingType: BindingType): void;
|
|
84
156
|
addStaticDependency(parentPath: string, childPath: string): boolean;
|
|
85
157
|
addDynamicDependency(fromPath: string, toPath: string): boolean;
|
|
@@ -680,6 +752,19 @@ type DevtoolsEvent = {
|
|
|
680
752
|
readonly tokenName: string;
|
|
681
753
|
readonly args: readonly unknown[];
|
|
682
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[];
|
|
683
768
|
} | {
|
|
684
769
|
readonly type: "propagation:suppressed";
|
|
685
770
|
readonly reason: "confirmation" | "visited-edge";
|