@wcstack/state 1.20.0 → 1.21.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 CHANGED
@@ -1193,7 +1193,7 @@ class MyFetcher extends HTMLElement {
1193
1193
 
1194
1194
  検証ルール(バインディング時に強制):
1195
1195
 
1196
- - 要素は `protocol: "wc-bindable"` かつ `version: 1` `static wcBindable` を公開するカスタム要素であること
1196
+ - 要素は `protocol: "wc-bindable"` かつ整数 `version` が `1` 以上(現行プロトコルは `1`。1 以上のすべてのバージョンが core 互換)の `static wcBindable` を公開するカスタム要素であること
1197
1197
  - `methodName` は `wcBindable.commands` に(`name` で)現れること
1198
1198
  - バインドされる値は `CommandToken` であること(token 以外の値の代入は throw する —— 例えば未宣言の名前 `$command.typo` は `undefined` に解決され、ここで拒否される)
1199
1199
 
@@ -1352,7 +1352,7 @@ class MyTarget extends HTMLElement {
1352
1352
 
1353
1353
  検証ルール:
1354
1354
 
1355
- - 要素は wc-bindable なカスタム要素であること(`static wcBindable`・`protocol: "wc-bindable"`・`version: 1`)。非 wc-bindable 要素は attach 時に拒否される。
1355
+ - 要素は wc-bindable なカスタム要素であること(`static wcBindable`・`protocol: "wc-bindable"`・整数 `version` 1 以上。1 以上のすべてのバージョンが core 互換)。非 wc-bindable 要素は attach 時に拒否される。
1356
1356
  - `<property>` は `wcBindable.properties` に現れること —— **attach 時** に検証(fail-fast。クラス参照のみで足り、DOM 接続に非依存)。
1357
1357
  - `<tokenName>` は `$eventTokens` で宣言されていること —— **発火時** に検証。state はイベント発火時に要素の live root から解決されるため、attach 時にノードが detached になりうる `for` / `if` ブロック内や SSR ハイドレーション後でも機能する。
1358
1358
  - 修飾子 `#prevent` / `#stop` は通常のイベントバインディングと同様に機能する: `eventToken.error#prevent: createFailed`。
@@ -1671,6 +1671,21 @@ bootstrapState({
1671
1671
  | `locale` | `'en'` | フィルタのデフォルトロケール |
1672
1672
  | `debug` | `false` | デバッグモード |
1673
1673
  | `enableMustache` | `true` | `{{ }}` 構文の有効化 |
1674
+ | `enableDirectionalInitialSync` | `true` | 方向認識の初期同期(`#init=` / `#sync=` バインド modifier。例 `value#init=state: form.name`)。既定 on。`false` で opt-out |
1675
+ | `enablePropagationContext` | `true` | バインド間の因果伝播トラッキング(echo/diamond のループ防止)。既定 on。`false` で opt-out |
1676
+ | `enableContractAnalyzer` | `false` | opt-in の開発時 contract analyzer(`analyzeContract` を公開) |
1677
+
1678
+ > この 3 つは **architecture-hardening** 機能で、規範は `docs/architecture-hardening/` に
1679
+ > あります。`enablePropagationContext` は**既定 on** — write-path コストは一方向バインドで
1680
+ > ほぼゼロ(echo しうる双方向 wire のみ因果 bookkeeping を行う)で、フラグは恒久的な
1681
+ > opt-out として残します。`enableDirectionalInitialSync` も**既定 on**: プロパティ単位で
1682
+ > 初期同期の authority を割り当てます(output-only な `wcBindable` メンバは初期値を
1683
+ > element→state で読み取り、双方向 / input メンバは state→element を維持)。setup-path
1684
+ > コストは初期 render の 5% 未満(producer-value observer は echo しうる双方向 wire にのみ
1685
+ > 登録)で、フラグは恒久的な opt-out として残します。`enableContractAnalyzer` は opt-in
1686
+ > (既定 `false`・無効時ランタイムコストゼロ)で、有効な場合、公開 API `analyzeContract()`
1687
+ > が稼働中の `static wcBindable` サーフェスと sidecar manifest の drift を開発時診断として
1688
+ > 報告します。
1674
1689
 
1675
1690
  ## TypeScript サポート
1676
1691
 
package/README.md CHANGED
@@ -1194,7 +1194,7 @@ class MyFetcher extends HTMLElement {
1194
1194
 
1195
1195
  Validation rules (enforced at binding time):
1196
1196
 
1197
- - The element must be a custom element exposing `static wcBindable` with `protocol: "wc-bindable"` and `version: 1`
1197
+ - The element must be a custom element exposing `static wcBindable` with `protocol: "wc-bindable"` and an integer `version` of `1` or later (the current protocol version is `1`; all versions ≥ 1 are core-compatible)
1198
1198
  - `methodName` must appear (by `name`) in `wcBindable.commands`
1199
1199
  - The bound value must be a `CommandToken` (assigning a non-token value throws — for example, an undeclared name like `$command.typo` resolves to `undefined` and is rejected here)
1200
1200
 
@@ -1353,7 +1353,7 @@ class MyTarget extends HTMLElement {
1353
1353
 
1354
1354
  Validation rules:
1355
1355
 
1356
- - The element must be a wc-bindable custom element (`static wcBindable`, `protocol: "wc-bindable"`, `version: 1`). A non-wc-bindable element is rejected at attach time.
1356
+ - The element must be a wc-bindable custom element (`static wcBindable`, `protocol: "wc-bindable"`, integer `version` 1 — all versions ≥ 1 are core-compatible). A non-wc-bindable element is rejected at attach time.
1357
1357
  - `<property>` must appear in `wcBindable.properties` — checked at **attach time** (fail-fast; needs only the class, not DOM connection).
1358
1358
  - `<tokenName>` must be declared in `$eventTokens` — checked at **fire time**. State is resolved from the element's live root node when the event fires, so the binding also works inside `for` / `if` blocks and after SSR hydration, where the node may still be detached at attach time.
1359
1359
  - Modifiers `#prevent` / `#stop` work as on any event binding: `eventToken.error#prevent: createFailed`.
@@ -1672,6 +1672,22 @@ All options with defaults:
1672
1672
  | `locale` | `'en'` | Default locale for filters |
1673
1673
  | `debug` | `false` | Debug mode |
1674
1674
  | `enableMustache` | `true` | Enable `{{ }}` syntax |
1675
+ | `enableDirectionalInitialSync` | `true` | Direction-aware initial sync (`#init=` / `#sync=` binding modifiers, e.g. `value#init=state: form.name`). Default on; set `false` to opt out |
1676
+ | `enablePropagationContext` | `true` | Causal propagation tracking across bindings (echo/diamond loop prevention). Default on; set `false` to opt out |
1677
+ | `enableContractAnalyzer` | `false` | Opt-in dev-time contract analyzer (exposes `analyzeContract`) |
1678
+
1679
+ > These three are **architecture-hardening** features; their normative reference is
1680
+ > `docs/architecture-hardening/`. `enablePropagationContext` defaults **on** — its
1681
+ > write-path cost is near-zero for one-way bindings (only echo-capable two-way
1682
+ > wires do the causal bookkeeping) — with the flag kept as a permanent opt-out.
1683
+ > `enableDirectionalInitialSync` also defaults **on**: it assigns per-property
1684
+ > initial-sync authority (an output-only `wcBindable` member reads its initial value
1685
+ > element→state; two-way / input members keep state→element). Its setup-path cost is
1686
+ > under 5% of initial render (the producer-value observer is only registered for
1687
+ > echo-capable two-way wires), and the flag is a permanent opt-out. `enableContractAnalyzer`
1688
+ > is opt-in (default `false`, zero runtime cost when off); when on, the exported
1689
+ > `analyzeContract()` API reports drift between a live `static wcBindable` surface and
1690
+ > a sidecar manifest for dev-time diagnostics.
1675
1691
 
1676
1692
  ## TypeScript Support
1677
1693
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,168 @@
1
+ /**
2
+ * Interface for hierarchical loop index management in nested loops.
3
+ * Tracks parent-child relationships, versions, and provides access to index hierarchy.
4
+ */
5
+ interface IListIndex {
6
+ readonly parentListIndex: IListIndex | null;
7
+ readonly uuid: string;
8
+ readonly position: number;
9
+ readonly length: number;
10
+ index: number;
11
+ readonly version: number;
12
+ readonly dirty: boolean;
13
+ readonly indexes: number[];
14
+ readonly listIndexes: WeakRef<IListIndex>[];
15
+ readonly varName: string;
16
+ at(position: number): IListIndex | null;
17
+ }
18
+ interface ILoopContext extends IStateAddress {
19
+ readonly pathInfo: IPathInfo;
20
+ readonly listIndex: IListIndex;
21
+ }
22
+ interface ILoopContextStack {
23
+ createLoopContext(elementStateAddress: IStateAddress, callback: (loopContext: ILoopContext) => void | Promise<void>): void | Promise<void>;
24
+ }
25
+
26
+ declare const setLoopContextAsyncSymbol: unique symbol;
27
+ declare const setLoopContextSymbol: unique symbol;
28
+ declare const getByAddressSymbol: unique symbol;
29
+ declare const hasByAddressSymbol: unique symbol;
30
+ declare const setByAddressSymbol: unique symbol;
31
+ declare const connectedCallbackSymbol: unique symbol;
32
+ declare const disconnectedCallbackSymbol: unique symbol;
33
+ declare const updatedCallbackSymbol: unique symbol;
34
+
35
+ interface IStateProxy extends IState {
36
+ [setLoopContextAsyncSymbol](loopContext: ILoopContext | null, callback: () => Promise<any>): Promise<any>;
37
+ [setLoopContextSymbol](loopContext: ILoopContext | null, callback: () => any): any;
38
+ [getByAddressSymbol](address: IStateAddress): any;
39
+ [hasByAddressSymbol](address: IStateAddress): boolean;
40
+ [setByAddressSymbol](address: IStateAddress, value: any): void;
41
+ [connectedCallbackSymbol](): Promise<void>;
42
+ [disconnectedCallbackSymbol](): void;
43
+ [updatedCallbackSymbol](updatedAbsAddressList: IAbsoluteStateAddress[]): void;
44
+ }
45
+ type Mutability = "readonly" | "writable";
46
+
47
+ interface IStateElement {
48
+ readonly name: string;
49
+ readonly initializePromise: Promise<void>;
50
+ readonly connectedCallbackPromise: Promise<void>;
51
+ readonly listPaths: Set<string>;
52
+ readonly elementPaths: Set<string>;
53
+ readonly getterPaths: Set<string>;
54
+ readonly setterPaths: Set<string>;
55
+ readonly loopContextStack: ILoopContextStack;
56
+ readonly dynamicDependency: Map<string, string[]>;
57
+ readonly staticDependency: Map<string, string[]>;
58
+ readonly version: number;
59
+ readonly rootNode: Node;
60
+ readonly boundComponentStateProp: string | null;
61
+ readonly bindableEventMap: Record<string, string>;
62
+ readonly commandTokenNames: ReadonlySet<string>;
63
+ readonly eventTokenNames: ReadonlySet<string>;
64
+ /**
65
+ * state が $updatedCallback を定義しているか。false のとき drain は更新
66
+ * アドレスの集計と最終の writable createState を丸ごとスキップできる。
67
+ * optional なのはテスト用モック互換のため(undefined は「不明=集計する」)。
68
+ */
69
+ readonly hasUpdatedCallback?: boolean;
70
+ /**
71
+ * 他行を読む getter(隣接項目参照など)が検出されたリストパスの集合。
72
+ * これらのリストは walkDependency の diff-filter 展開の対象外(全行展開)。
73
+ * optional なのはテスト用モック互換のため(undefined は「検出なし」扱い)。
74
+ */
75
+ readonly crossRowListPaths?: ReadonlySet<string>;
76
+ addCrossRowListPath?(path: string): void;
77
+ setPathInfo(path: string, bindingType: BindingType): void;
78
+ addStaticDependency(parentPath: string, childPath: string): boolean;
79
+ addDynamicDependency(fromPath: string, toPath: string): boolean;
80
+ createStateAsync(mutability: Mutability, callback: (state: IStateProxy) => Promise<void>): Promise<void>;
81
+ createState(mutability: Mutability, callback: (state: IStateProxy) => void): void;
82
+ nextVersion(): number;
83
+ bindProperty(prop: string, desc: PropertyDescriptor): void;
84
+ setInitialState(state: Record<string, any>): void;
85
+ }
86
+
87
+ interface IPathInfo {
88
+ readonly id: number;
89
+ readonly path: string;
90
+ readonly segments: string[];
91
+ readonly lastSegment: string;
92
+ readonly cumulativePaths: string[];
93
+ readonly cumulativePathSet: Set<string>;
94
+ readonly cumulativePathInfos: IPathInfo[];
95
+ readonly cumulativePathInfoSet: Set<IPathInfo>;
96
+ readonly parentPath: string | null;
97
+ readonly parentPathInfo: IPathInfo | null;
98
+ readonly wildcardPaths: string[];
99
+ readonly wildcardPathSet: Set<string>;
100
+ readonly indexByWildcardPath: Record<string, number>;
101
+ readonly wildcardPathInfos: IPathInfo[];
102
+ readonly wildcardPathInfoSet: Set<IPathInfo>;
103
+ readonly wildcardParentPaths: string[];
104
+ readonly wildcardParentPathSet: Set<string>;
105
+ readonly wildcardParentPathInfos: IPathInfo[];
106
+ readonly wildcardParentPathInfoSet: Set<IPathInfo>;
107
+ readonly wildcardPositions: number[];
108
+ readonly lastWildcardPath: string | null;
109
+ readonly lastWildcardInfo: IPathInfo | null;
110
+ readonly wildcardCount: number;
111
+ }
112
+ interface IStateAddress {
113
+ readonly pathInfo: IPathInfo;
114
+ readonly listIndex: IListIndex | null;
115
+ readonly parentAddress: IStateAddress | null;
116
+ }
117
+ interface IAbsolutePathInfo {
118
+ readonly stateName: string;
119
+ readonly stateElement: IStateElement;
120
+ readonly pathInfo: IPathInfo;
121
+ readonly parentAbsolutePathInfo: IAbsolutePathInfo | null;
122
+ }
123
+ interface IAbsoluteStateAddress {
124
+ readonly absolutePathInfo: IAbsolutePathInfo;
125
+ readonly listIndex: IListIndex | null;
126
+ readonly parentAbsoluteAddress: IAbsoluteStateAddress | null;
127
+ }
128
+
129
+ /**
130
+ * Filter/types.ts
131
+ *
132
+ * Type definition file for filter functions.
133
+ *
134
+ * Main responsibilities:
135
+ * - Defines types for filter functions (FilterFn) and filter functions with options (FilterWithOptionsFn)
136
+ * - Type-safe management of filter name-to-function mappings (FilterWithOptions) and filter function arrays (Filters)
137
+ * - Defines types for retrieving filter functions from built-in filter collections
138
+ *
139
+ * Design points:
140
+ * - Type design enabling flexible filter design and extension
141
+ * - Supports filters with options and combinations of multiple filters
142
+ */
143
+ type FilterFn<T = unknown> = (value: unknown) => T;
144
+
145
+ type BindingType = 'text' | 'prop' | 'event' | 'for' | 'if' | 'elseif' | 'else' | 'radio' | 'checkbox' | 'spread';
146
+ interface IFilterInfo {
147
+ readonly filterName: string;
148
+ readonly args: string[];
149
+ readonly filterFn: FilterFn;
150
+ }
151
+ interface IBindingInfo {
152
+ readonly propName: string;
153
+ readonly propSegments: string[];
154
+ readonly propModifiers: string[];
155
+ readonly statePathName: string;
156
+ readonly statePathInfo: IPathInfo;
157
+ readonly stateName: string;
158
+ readonly inFilters: IFilterInfo[];
159
+ readonly outFilters: IFilterInfo[];
160
+ readonly node: Node;
161
+ readonly replaceNode: Node;
162
+ readonly bindingType: BindingType;
163
+ readonly uuid?: string | null;
164
+ }
165
+
1
166
  interface IState {
2
167
  [key: string]: any;
3
168
  }
@@ -20,6 +185,25 @@ interface IConfig {
20
185
  readonly locale: string;
21
186
  readonly debug: boolean;
22
187
  readonly enableMustache: boolean;
188
+ /**
189
+ * Enables direction-aware initial synchronization (`init=` / `sync=`).
190
+ * Disabled by default while Phase 2 is evaluated against existing snapshots.
191
+ */
192
+ readonly enableDirectionalInitialSync: boolean;
193
+ /**
194
+ * Enables causal propagation tracking (transaction / edge provenance /
195
+ * write receipts). Disabled by default while Phase 3 runs as a shadow of
196
+ * the primitive same-value guard.
197
+ */
198
+ readonly enablePropagationContext: boolean;
199
+ /**
200
+ * Enables the opt-in dev-time contract analyzer (Phase 5b). When false
201
+ * (default), `analyzeContract()` is a no-op with zero cost — runtime
202
+ * behavior and allocation are unchanged. When true, it checks the actually
203
+ * loaded `static wcBindable` declarations against a supplied sidecar
204
+ * manifest and emits `contract:*` drift trace via the DevTools sink.
205
+ */
206
+ readonly enableContractAnalyzer: boolean;
23
207
  /**
24
208
  * 同値ガード(**既定 true**・標準的リアクティブ挙動・`setConfig({ sameValueGuard: false })` で opt-out 可)。
25
209
  * primitive 値の set で `Object.is` 同値なら更新を no-op にする
@@ -40,6 +224,9 @@ interface IWritableConfig {
40
224
  locale?: string;
41
225
  debug?: boolean;
42
226
  enableMustache?: boolean;
227
+ enableDirectionalInitialSync?: boolean;
228
+ enablePropagationContext?: boolean;
229
+ enableContractAnalyzer?: boolean;
43
230
  sameValueGuard?: boolean;
44
231
  }
45
232
 
@@ -52,6 +239,13 @@ declare function getConfig(): IConfig;
52
239
  */
53
240
  declare function getBindingsReady(rootNode: Node): Promise<void>;
54
241
 
242
+ /**
243
+ * Browser builds use the native HTMLElement. Headless runtimes receive an
244
+ * inert base so the public module can be imported without installing DOM
245
+ * globals; constructing components remains a browser-only operation.
246
+ */
247
+ declare const HTMLElementBase: typeof HTMLElement;
248
+
55
249
  interface ISsrElement {
56
250
  readonly name: string;
57
251
  readonly version: string;
@@ -61,7 +255,7 @@ interface ISsrElement {
61
255
  getTemplate(uuid: string): HTMLTemplateElement | null;
62
256
  verifyVersion(): boolean;
63
257
  }
64
- declare class Ssr extends HTMLElement implements ISsrElement {
258
+ declare class Ssr extends HTMLElementBase implements ISsrElement {
65
259
  private _stateData;
66
260
  private _templates;
67
261
  private _hydrateProps;
@@ -425,5 +619,141 @@ interface IWcsManifest {
425
619
  /** 機械可読な単一正本を返す。vscode-wcs はこれを消費する想定。 */
426
620
  declare function getWcsManifest(): IWcsManifest;
427
621
 
428
- export { Ssr, VERSION, WCS_MANIFEST_VERSION, bootstrapState, buildBindings, builtinFilterMeta, defineState, getBindingsReady, getConfig, getWcsManifest };
429
- export type { FilterArgType, FilterResultType, IFilterMeta, ISsrElement, IWcsManifest, IWritableConfig, IWritableTagNames, WcsPathValue, WcsPaths, WcsStateApi, WcsThis };
622
+ /**
623
+ * devtools/types.ts
624
+ *
625
+ * DevTools Hook Protocol (docs/devtools-hook-protocol.md) の型定義。
626
+ *
627
+ * イベント payload はランタイム内部オブジェクト(IAbsoluteStateAddress /
628
+ * IBindingInfo 等)への生参照を含む(同一 realm・オーバーレイ前提、protocol 原則 4)。
629
+ * 消費者はこれらを変異してはならない。
630
+ */
631
+
632
+ type DevtoolsEvent = {
633
+ readonly type: "state:element-registered";
634
+ readonly name: string;
635
+ readonly rootNode: Node;
636
+ readonly element: IStateElement;
637
+ } | {
638
+ readonly type: "state:element-unregistered";
639
+ readonly name: string;
640
+ readonly rootNode: Node;
641
+ readonly element: IStateElement;
642
+ } | {
643
+ readonly type: "state:write";
644
+ readonly absoluteAddress: IAbsoluteStateAddress;
645
+ readonly value: unknown;
646
+ /** same-value guard が既に取得していた場合のみ意味を持つ(protocol §4.2) */
647
+ readonly oldValue: unknown;
648
+ readonly hasOldValue: boolean;
649
+ } | {
650
+ readonly type: "state:update-batch";
651
+ readonly addresses: ReadonlySet<IAbsoluteStateAddress>;
652
+ } | {
653
+ readonly type: "state:binding-added";
654
+ readonly absoluteAddress: IAbsoluteStateAddress;
655
+ readonly binding: IBindingInfo;
656
+ } | {
657
+ readonly type: "state:binding-removed";
658
+ readonly absoluteAddress: IAbsoluteStateAddress;
659
+ readonly binding: IBindingInfo;
660
+ } | {
661
+ readonly type: "state:binding-cleared";
662
+ readonly absoluteAddress: IAbsoluteStateAddress;
663
+ } | {
664
+ readonly type: "state:token-emit";
665
+ readonly kind: "command" | "event";
666
+ readonly stateName: string | null;
667
+ readonly tokenName: string;
668
+ readonly args: readonly unknown[];
669
+ readonly subscriberCount: number;
670
+ } | {
671
+ readonly type: "propagation:suppressed";
672
+ readonly reason: "confirmation" | "visited-edge";
673
+ readonly transactionId: number;
674
+ readonly edgeId: number;
675
+ readonly node: Node;
676
+ readonly member: string;
677
+ } | {
678
+ readonly type: "propagation:coalesced";
679
+ readonly absoluteAddress: IAbsoluteStateAddress;
680
+ readonly droppedTransactionId: number;
681
+ readonly winnerTransactionId: number;
682
+ } | {
683
+ readonly type: "propagation:hop-limit";
684
+ readonly absoluteAddress: IAbsoluteStateAddress;
685
+ readonly transactionId: number;
686
+ readonly hop: number;
687
+ } | {
688
+ readonly type: "contract:manifest-read";
689
+ readonly tag: string;
690
+ /** 実行時に該当タグが登録済みか(未登録なら drift の起点)。 */
691
+ readonly loaded: boolean;
692
+ } | {
693
+ readonly type: "contract:unsupported-extension";
694
+ readonly namespace: string;
695
+ } | {
696
+ readonly type: "contract:drift";
697
+ readonly reason: "component-not-loaded" | "missing-member" | "event-mismatch";
698
+ readonly tag: string;
699
+ readonly member?: string;
700
+ /** event-mismatch のとき: sidecar 宣言 event / live event。 */
701
+ readonly sidecarEvent?: string;
702
+ readonly liveEvent?: string;
703
+ };
704
+ /** contract analyzer(Phase 5b)が生成しうる event だけの狭い union(公開 API の戻り型)。 */
705
+ type ContractEvent = Extract<DevtoolsEvent, {
706
+ readonly type: "contract:manifest-read" | "contract:unsupported-extension" | "contract:drift";
707
+ }>;
708
+
709
+ /**
710
+ * contract/types.ts
711
+ *
712
+ * Phase 5b(dev-time contract analyzer)が読む sidecar manifest の最小 subset。
713
+ * 完全な JSON-Schema subset 検証は CI 側(vscode-wcs の validator core)の責務であり、
714
+ * runtime analyzer は「実際に読み込まれた wcBindable 宣言との drift」照合に絞る。
715
+ *
716
+ * この型は vscode-wcs の `wcstack.types` を copy-distribution したもの(§14: ランタイム
717
+ * 依存を導入しない)。CI 側の全量型ではなく drift 照合に必要な形だけを持つ。
718
+ */
719
+ interface IContractObservable {
720
+ readonly event?: string;
721
+ }
722
+ interface IContractComponent {
723
+ readonly observables?: Readonly<Record<string, IContractObservable>>;
724
+ readonly inputs?: Readonly<Record<string, unknown>>;
725
+ readonly commands?: Readonly<Record<string, unknown>>;
726
+ }
727
+ interface IContractManifest {
728
+ readonly manifestExtensions?: {
729
+ readonly "wcstack.types"?: {
730
+ readonly components?: Readonly<Record<string, IContractComponent>>;
731
+ };
732
+ readonly [namespace: string]: unknown;
733
+ };
734
+ }
735
+
736
+ /**
737
+ * contract/contractAnalyzer.ts
738
+ *
739
+ * Phase 5b(09-remediation-design.md §5b / §7.1 dev runtime / §6 contract trace)の
740
+ * opt-in dev-time analyzer。実際に登録済みの custom element の `static wcBindable`
741
+ * 宣言(= 実行時の正本)を、利用者が渡した sidecar manifest と突き合わせ、drift を
742
+ * DevTools trace(`contract:*`)へ流す。
743
+ *
744
+ * 完了条件「無効時の runtime 挙動・cost が不変」: `analyzeContract` は
745
+ * `config.enableContractAnalyzer` が false のとき即 return し、manifest を一切走査
746
+ * しない(hot path には一切フックしない — 純粋な on-demand API)。
747
+ *
748
+ * pure な core(`analyzeManifestContract`)は宣言解決と emit を注入で受けるためテスト可能。
749
+ */
750
+
751
+ /**
752
+ * opt-in dev-time contract analysis。無効時はゼロコスト(即 return・manifest 非走査)。
753
+ * 有効時は live 宣言と manifest を突き合わせ、`contract:*` trace を返しつつ、DevTools
754
+ * sink が接続されていれば同時に流す。
755
+ */
756
+ declare function analyzeContract(manifest: IContractManifest): readonly ContractEvent[];
757
+
758
+ export { Ssr, VERSION, WCS_MANIFEST_VERSION, analyzeContract, bootstrapState, buildBindings, builtinFilterMeta, defineState, getBindingsReady, getConfig, getWcsManifest };
759
+ export type { ContractEvent, FilterArgType, FilterResultType, IContractManifest, IFilterMeta, ISsrElement, IWcsManifest, IWritableConfig, IWritableTagNames, WcsPathValue, WcsPaths, WcsStateApi, WcsThis };