@wcstack/state 1.26.0 → 1.28.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 +100 -8
- package/README.md +103 -7
- package/dist/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.d.ts +70 -3
- package/dist/index.esm.js +1407 -174
- package/dist/index.esm.js.map +1 -1
- package/dist/manifest.d.ts +35 -0
- package/dist/manifest.esm.js +213 -2
- package/dist/parser.d.ts +74 -0
- package/dist/parser.esm.js +1452 -0
- package/dist/wcs-manifest.json +112 -1
- package/package.json +5 -1
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;
|
|
@@ -214,7 +226,12 @@ interface IFilterInfo {
|
|
|
214
226
|
readonly args: string[];
|
|
215
227
|
readonly filterFn: FilterFn;
|
|
216
228
|
}
|
|
217
|
-
|
|
229
|
+
/**
|
|
230
|
+
* バインディング式のパース結果(DOM 非依存の部分)。`@wcstack/state/parser` の
|
|
231
|
+
* ParseBindTextResult がこれをそのまま公開するため、Node 等の DOM lib 型を
|
|
232
|
+
* ここに足してはならない(足すなら IBindingInfo 側へ)。
|
|
233
|
+
*/
|
|
234
|
+
interface IParsedBinding {
|
|
218
235
|
readonly propName: string;
|
|
219
236
|
readonly propSegments: string[];
|
|
220
237
|
readonly propModifiers: string[];
|
|
@@ -223,11 +240,13 @@ interface IBindingInfo {
|
|
|
223
240
|
readonly stateName: string;
|
|
224
241
|
readonly inFilters: IFilterInfo[];
|
|
225
242
|
readonly outFilters: IFilterInfo[];
|
|
226
|
-
readonly node: Node;
|
|
227
|
-
readonly replaceNode: Node;
|
|
228
243
|
readonly bindingType: BindingType;
|
|
229
244
|
readonly uuid?: string | null;
|
|
230
245
|
}
|
|
246
|
+
interface IBindingInfo extends IParsedBinding {
|
|
247
|
+
readonly node: Node;
|
|
248
|
+
readonly replaceNode: Node;
|
|
249
|
+
}
|
|
231
250
|
|
|
232
251
|
interface IState {
|
|
233
252
|
[key: string]: any;
|
|
@@ -679,6 +698,41 @@ interface IWcsManifest {
|
|
|
679
698
|
};
|
|
680
699
|
/** 構造ディレクティブ(`<template data-wcs="for: ...">` 等) */
|
|
681
700
|
structuralDirectives: readonly string[];
|
|
701
|
+
/**
|
|
702
|
+
* 修飾子(`#` 後)の語彙。flags は値を取らない形(`#prevent`)、keyValue は
|
|
703
|
+
* `=` で値を取る形(`#init=element`)、eventNamePrefix は `on` + イベント名の形
|
|
704
|
+
* (`#onchange` — two-way / radio / checkbox のイベント名上書き。README「Modifiers」)。
|
|
705
|
+
* define.ts の定数が単一正本で、ランタイムの消費箇所も同じ定数に分岐する。
|
|
706
|
+
*/
|
|
707
|
+
modifiers: {
|
|
708
|
+
flags: readonly string[];
|
|
709
|
+
keyValue: readonly string[];
|
|
710
|
+
eventNamePrefix: string;
|
|
711
|
+
};
|
|
712
|
+
/** リストインデックス参照名(`$1`..`$N`)。prefix + 1 始まり連番、maxDepth まで。 */
|
|
713
|
+
indexParam: {
|
|
714
|
+
prefix: string;
|
|
715
|
+
maxDepth: number;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* bindingType 判別の語彙(parseBindTextsForElement の分岐と同一の定数から導出)。
|
|
719
|
+
* 判別順: else → spread → 構造ディレクティブ/radio/checkbox → eventToken・`on*`
|
|
720
|
+
* (event)→ prop。propNamespaces は左辺先頭セグメントの特殊 namespace で、
|
|
721
|
+
* apply 層のディスパッチキー集合との一致はテストが強制する。
|
|
722
|
+
* 既知の未収載: `radio` / `checkbox`(BindingType union のみが正本)。
|
|
723
|
+
*/
|
|
724
|
+
bindingTypes: {
|
|
725
|
+
elseKeyword: string;
|
|
726
|
+
spread: string;
|
|
727
|
+
eventPropertyPrefix: string;
|
|
728
|
+
propNamespaces: {
|
|
729
|
+
eventToken: string;
|
|
730
|
+
command: string;
|
|
731
|
+
class: string;
|
|
732
|
+
attr: string;
|
|
733
|
+
style: string;
|
|
734
|
+
};
|
|
735
|
+
};
|
|
682
736
|
};
|
|
683
737
|
/** 組み込みフィルタ名(builtinFilters から自動導出=実装が正本) */
|
|
684
738
|
filters: string[];
|
|
@@ -740,6 +794,19 @@ type DevtoolsEvent = {
|
|
|
740
794
|
readonly tokenName: string;
|
|
741
795
|
readonly args: readonly unknown[];
|
|
742
796
|
readonly subscriberCount: number;
|
|
797
|
+
} | {
|
|
798
|
+
readonly type: "state:watch-error";
|
|
799
|
+
/** throw 元。cur の評価(getter)とハンドラ本体では原因も直し方も違う */
|
|
800
|
+
readonly phase: "prime" | "evaluate" | "handler";
|
|
801
|
+
readonly stateName: string;
|
|
802
|
+
/** `$watch` の宣言キー(ワイルドカードを含む生のパス) */
|
|
803
|
+
readonly path: string;
|
|
804
|
+
readonly error: unknown;
|
|
805
|
+
} | {
|
|
806
|
+
readonly type: "state:watch-chain-limit";
|
|
807
|
+
readonly maxDepth: number;
|
|
808
|
+
/** 打ち切ったバッチに載っていたアドレスのパス(報告用) */
|
|
809
|
+
readonly paths: readonly string[];
|
|
743
810
|
} | {
|
|
744
811
|
readonly type: "propagation:suppressed";
|
|
745
812
|
readonly reason: "confirmation" | "visited-edge";
|