@wcstack/state 2.6.1 → 3.1.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.
Files changed (66) hide show
  1. package/README.ja.md +112 -45
  2. package/README.md +114 -45
  3. package/dist/auto.min.js +1 -1
  4. package/dist/auto.min.js.map +1 -1
  5. package/dist/define.d.ts +295 -0
  6. package/dist/define.js +1 -0
  7. package/dist/index.d.ts +254 -94
  8. package/dist/index.esm.js +1 -23477
  9. package/dist/index.esm.js.map +1 -1
  10. package/dist/manifest.d.ts +2 -0
  11. package/dist/manifest.esm.js +22 -37
  12. package/dist/parser.d.ts +37 -39
  13. package/dist/parser.esm.js +172 -1153
  14. package/dist/split/chunks/binder.js +2 -0
  15. package/dist/split/chunks/binder.js.map +1 -0
  16. package/dist/split/chunks/checkDependency.js +2 -0
  17. package/dist/split/chunks/checkDependency.js.map +1 -0
  18. package/dist/split/chunks/diagnosticsHooks.js +2 -0
  19. package/dist/split/chunks/diagnosticsHooks.js.map +1 -0
  20. package/dist/split/chunks/errorGuidance.js +2 -0
  21. package/dist/split/chunks/errorGuidance.js.map +1 -0
  22. package/dist/split/chunks/features.d.ts +29 -0
  23. package/dist/split/chunks/filterRegistry.js +2 -0
  24. package/dist/split/chunks/filterRegistry.js.map +1 -0
  25. package/dist/split/chunks/getAllPropertyDescriptors.js +2 -0
  26. package/dist/split/chunks/getAllPropertyDescriptors.js.map +1 -0
  27. package/dist/split/chunks/lifecycleHooks.js +2 -0
  28. package/dist/split/chunks/lifecycleHooks.js.map +1 -0
  29. package/dist/split/chunks/mount.js +2 -0
  30. package/dist/split/chunks/mount.js.map +1 -0
  31. package/dist/split/chunks/pathDiagnostics.js +2 -0
  32. package/dist/split/chunks/pathDiagnostics.js.map +1 -0
  33. package/dist/split/chunks/registerComponents.js +2 -0
  34. package/dist/split/chunks/registerComponents.js.map +1 -0
  35. package/dist/split/chunks/setAll.js +2 -0
  36. package/dist/split/chunks/setAll.js.map +1 -0
  37. package/dist/split/chunks/version.js +2 -0
  38. package/dist/split/chunks/version.js.map +1 -0
  39. package/dist/split/chunks/watchRuntime.js +2 -0
  40. package/dist/split/chunks/watchRuntime.js.map +1 -0
  41. package/dist/split/core.d.ts +1417 -0
  42. package/dist/split/core.js +2 -0
  43. package/dist/split/core.js.map +1 -0
  44. package/dist/split/features/devtools.d.ts +9 -0
  45. package/dist/split/features/devtools.js +2 -0
  46. package/dist/split/features/devtools.js.map +1 -0
  47. package/dist/split/features/diagnostics.d.ts +11 -0
  48. package/dist/split/features/diagnostics.js +2 -0
  49. package/dist/split/features/diagnostics.js.map +1 -0
  50. package/dist/split/features/formats.d.ts +10 -0
  51. package/dist/split/features/formats.js +2 -0
  52. package/dist/split/features/formats.js.map +1 -0
  53. package/dist/split/features/recursion.d.ts +9 -0
  54. package/dist/split/features/recursion.js +2 -0
  55. package/dist/split/features/recursion.js.map +1 -0
  56. package/dist/split/features/scopes.d.ts +10 -0
  57. package/dist/split/features/scopes.js +2 -0
  58. package/dist/split/features/scopes.js.map +1 -0
  59. package/dist/split/features/ssr.d.ts +9 -0
  60. package/dist/split/features/ssr.js +2 -0
  61. package/dist/split/features/ssr.js.map +1 -0
  62. package/dist/split/features/temporal.d.ts +9 -0
  63. package/dist/split/features/temporal.js +2 -0
  64. package/dist/split/features/temporal.js.map +1 -0
  65. package/dist/wcs-manifest.json +1 -0
  66. package/package.json +13 -1
package/dist/index.d.ts CHANGED
@@ -42,26 +42,163 @@ interface ILoopContextStack {
42
42
  createLoopContext(elementStateAddress: IStateAddress, callback: (loopContext: ILoopContext) => void | Promise<void>): void | Promise<void>;
43
43
  }
44
44
 
45
+ declare const setLoopContextSymbol: unique symbol;
46
+ declare const getByAddressSymbol: unique symbol;
47
+ declare const hasByAddressSymbol: unique symbol;
48
+ declare const setByAddressSymbol: unique symbol;
49
+ declare const connectedCallbackSymbol: unique symbol;
50
+ declare const disconnectedCallbackSymbol: unique symbol;
51
+ declare const updatedCallbackSymbol: unique symbol;
52
+ declare const errorCallbackSymbol: unique symbol;
53
+
54
+ interface IStateHandler extends ProxyHandler<IState> {
55
+ readonly stateElement: IStateElement;
56
+ readonly addressStackLength: number;
57
+ /**
58
+ * アドレススタックの先頭(いま評価しているアドレス)。ループ文脈の無いスコープでは null。
59
+ * 再帰の深さ解決(recursion/bind.ts)もここだけを見る — 添字の供給元
60
+ * (getContextListIndex / `$getAll` の省略形)が先頭しか見ないので、深さだけを外側の
61
+ * フレームから拾うと「深さはあるが行が無い」定義にない状態になる。
62
+ */
63
+ readonly lastAddressStack: IStateAddress | null;
64
+ readonly loopContext: ILoopContext | null | undefined;
65
+ /**
66
+ * 依存追跡の抑止中か。$untrackDependency のスコープ内、および setter 実行中
67
+ * (setter は命令的な代入であって派生ではないため、その中の読み取りで依存を
68
+ * 張らない)は true。checkDependency / $1 インデックス依存の登録が抑止される。
69
+ */
70
+ readonly untracking: boolean;
71
+ /**
72
+ * このプロキシの書き込み能力。書き込み API の入口(proxy/assertWritable.ts)が検査する — set
73
+ * トラップを通らない `$resolve` / `$setAll` も readonly では書けない(要件 B6)。省略は writable。
74
+ */
75
+ readonly mutability?: Mutability;
76
+ pushAddress(address: IStateAddress | null): void;
77
+ popAddress(): IStateAddress | null;
78
+ setLoopContext(loopContext: ILoopContext | null): void;
79
+ clearLoopContext(): void;
80
+ beginUntrack(): void;
81
+ endUntrack(): void;
82
+ }
83
+ interface IStateProxy extends IState {
84
+ [setLoopContextSymbol](loopContext: ILoopContext | null, callback: () => any): any;
85
+ [getByAddressSymbol](address: IStateAddress): any;
86
+ [hasByAddressSymbol](address: IStateAddress): boolean;
87
+ [setByAddressSymbol](address: IStateAddress, value: any): void;
88
+ [connectedCallbackSymbol](): Promise<void>;
89
+ [disconnectedCallbackSymbol](): void;
90
+ [updatedCallbackSymbol](updatedAbsAddressList: IAbsoluteStateAddress[]): void;
91
+ [errorCallbackSymbol](error: unknown, info: IBindingErrorInfo): void;
92
+ }
93
+ type Mutability = "readonly" | "writable";
94
+
95
+ /**
96
+ * Filter/types.ts
97
+ *
98
+ * Type definition file for filter functions.
99
+ *
100
+ * Main responsibilities:
101
+ * - Defines types for filter functions (FilterFn) and filter functions with options (FilterWithOptionsFn)
102
+ * - Type-safe management of filter name-to-function mappings (FilterWithOptions) and filter function arrays (Filters)
103
+ * - Defines types for retrieving filter functions from built-in filter collections
104
+ *
105
+ * Design points:
106
+ * - Type design enabling flexible filter design and extension
107
+ * - Supports filters with options and combinations of multiple filters
108
+ */
109
+ type FilterFn<T = unknown> = (value: unknown) => T;
110
+
111
+ interface IContent {
112
+ readonly firstNode: Node | null;
113
+ readonly lastNode: Node | null;
114
+ readonly mounted: boolean;
115
+ appendTo(targetNode: Node): void;
116
+ mountAfter(targetNode: Node): void;
117
+ unmount(): void;
118
+ /**
119
+ * 自分のノードを DOM に残したままの解体(#4)。行の置き換えで `for` が同じ位置の Content を
120
+ * 新しい行に使い回すとき、入力中の欄を DOM から外さずに unmount と同じ後始末をする。
121
+ */
122
+ unmountInPlace(): void;
123
+ /**
124
+ * wholesale 破棄: 全行クリアで再利用されない content の binding teardown
125
+ * (listener 解除・アドレス台帳・loopContext 掃除)を省略し、ノード・binding
126
+ * もろとも GC に任せる。定義待ち等の副作用がある場合は false を返し、呼び出し側が
127
+ * 従来経路(deactivate + unmount)で解体する。
128
+ */
129
+ tryDestroy(): boolean;
130
+ }
131
+
45
132
  /**
46
- * pathDiagnostics.ts — バインド / `$watch` 対象パスの存在検査(silent failure の可視化)。
133
+ * core/addressHooks.ts — 読み書き境界の受け口(設計案 H1、S3)。
47
134
  *
48
- * なぜ必要か:
49
- * `getByAddress` は「親が null / undefined のパスの読み」を undefined で返し、
50
- * undefined はプロパティ書き込みがスキップされる値なので、`user.nmae` のような
51
- * 打ち間違いは**エラーも警告も出さずに DOM が更新されない**だけになる。一方で
52
- * トップレベルの打ち間違い(`cout`)は parentAddress を辿れず raiseError で落ちる。
53
- * 同じ「パスを打ち間違えた」という 1 つの失敗が、パスの深さで silent / loud に
54
- * 割れており、書き手からは区別がつかない。ここはその silent 側を埋める。
135
+ * 機能は `install()` でレジストリに hook 実装を置く(hot path には触れない)。state 要素は
136
+ * 宣言が要求する機能の hook だけを `attachAddressHooks` で自分に付け、core の各受け口は
137
+ * `stateElement.addressHooks` が null なら判定 1 回で抜ける
138
+ * (調査 §10.8: 大域配列の走査は読み +40%、state ごとの門なら +0.1 ns)。
139
+ * 宣言が要求する機能が未 install なら `requireFeature` が宣言時に throw する(readiness barrier、D13)。
55
140
  *
56
- * 精度方針(過小近似):
57
- * 「確実に存在しない」と言い切れる場合にだけ報告する。getter の戻り値の先・
58
- * 空配列・null 親・mapped な `bind-component` など、静的に決められない形はすべて
59
- * `"unknown"` に倒して黙る(偽陽性ゼロ優先。docs/static-wiring-dx-design.md D7 /
60
- * [ADR-06](../../docs/architecture-hardening/06-path-type-safety.md) の精度哲学)。
141
+ * 受け口(core 側の呼び出し点):
142
+ * read getByAddress の先頭(キャッシュより前)。名前空間・マーカーなど raw state に無い値を答える
143
+ * readMissing getByAddress で「ツリーにそのキーが無い」と分かった点(親の値つき。親が無ければ null)
144
+ * write setByAddress の先頭。書き込みを奪うか、禁止して throw する
145
+ * writeMissing setByAddress の fast path で「親にそのキーが無い」と分かった点(公開 getter への書き込み)
146
+ * writeObserve 旧値が分かった点(同値ガードの直後)。旧値の台帳を持つ機能が読む
147
+ * written 書き込み・`$postUpdate` の後。観測面へ通知する機能が読む
148
+ * swapped 要素の入れ替えで行が動いた点(旧値の台帳を行に追従させる)
149
+ * get get トラップの文字列プロパティ先頭。API・名前空間・パスの翻訳を答える
150
+ * indexShift `$n` の解決点。スコープ相対の段ずれを足す
151
+ * handlerScope イベントハンドラの添字の段数を決める点
152
+ * updated `$updatedCallback` の後。相対配送する機能が読む
153
+ * suppressPathDiagnostic 束縛時の未宣言パス診断を黙らせるか(予約済みスロットの配下など)
154
+ * rowReused その場で使い回した行(DOM から外れない)の点。行の中のスコープを新しい listIndex へ張り直す
155
+ */
156
+
157
+ type ReadHook = (stateElement: IStateElement, address: IStateAddress, receiver: any, handler: IStateHandler) => unknown;
158
+ type ReadMissingHook = (stateElement: IStateElement, address: IStateAddress, parentValue: object | null, receiver: any, handler: IStateHandler) => unknown;
159
+ type WriteHook = (stateElement: IStateElement, address: IStateAddress, value: unknown, receiver: any, handler: IStateHandler) => unknown;
160
+ type WriteMissingHook = (stateElement: IStateElement, address: IStateAddress, parentValue: object, key: PropertyKey, value: unknown, receiver: any, handler: IStateHandler) => unknown;
161
+ type WriteObserveHook = (stateElement: IStateElement, path: string, absAddress: IAbsoluteStateAddress, oldValue: unknown, hasOldValue: boolean) => void;
162
+ type WrittenHook = (stateElement: IStateElement, pathInfo: IPathInfo, detail?: {
163
+ readonly value: unknown;
164
+ }) => void;
165
+ type SwappedHook = (stateElement: IStateElement, elementAbsAddress: IAbsoluteStateAddress, displacedAbsAddress: IAbsoluteStateAddress) => void;
166
+ type GetHook = (handler: IStateHandler, prop: string, receiver: any, target: object) => unknown;
167
+ type IndexShiftHook = (handler: IStateHandler, lastAddress: IStateAddress) => number;
168
+ type HandlerScopeHook = (stateElement: IStateElement, node: Node, rootNode: Node, loopContext: ILoopContext, wildcardCount: number) => number;
169
+ type UpdatedHook = (stateElement: IStateElement, refs: IAbsoluteStateAddress[], receiver: any) => void;
170
+ type SuppressPathDiagnosticHook = (stateElement: IStateElement, path: string) => boolean;
171
+ type RowReusedHook = (stateElement: IStateElement, content: IContent) => void;
172
+ interface IAddressHooks {
173
+ readonly read?: ReadHook;
174
+ readonly readMissing?: ReadMissingHook;
175
+ readonly write?: WriteHook;
176
+ readonly writeMissing?: WriteMissingHook;
177
+ readonly writeObserve?: WriteObserveHook;
178
+ readonly written?: WrittenHook;
179
+ readonly swapped?: SwappedHook;
180
+ readonly get?: GetHook;
181
+ readonly indexShift?: IndexShiftHook;
182
+ readonly handlerScope?: HandlerScopeHook;
183
+ readonly updated?: UpdatedHook;
184
+ readonly suppressPathDiagnostic?: SuppressPathDiagnosticHook;
185
+ readonly rowReused?: RowReusedHook;
186
+ }
187
+ /** state 要素に付いた hook 群(種類ごとに、機能の登録順) */
188
+ type IAttachedHooks = {
189
+ readonly [K in keyof Required<IAddressHooks>]: NonNullable<IAddressHooks[K]>[];
190
+ };
191
+
192
+ /**
193
+ * pathDiagnostics.ts — パスに関する**エラーの文言**(throw する側)と、診断の両面が共有する部品。
194
+ *
195
+ * 束縛時の存在検査(`user.nmae` のような打ち間違いを console.warn で知らせる開発時の診断)は
196
+ * `features/diagnostics` へ分けた(diagnostics/pathChecks.ts)。core に残るのは、実行を止める
197
+ * エラーの文言と、その did-you-mean が使う候補の集め方だけ。エラーは機能の有無に関わらず
198
+ * 読める文言で落ちなければならないので、ここは core から外せない。
61
199
  *
62
200
  * 診断 code はコンソール → lint → IDE の三面で共有する(errorGuidance.ts の規約)。
63
201
  */
64
-
65
202
  /** `setPathInfo` の呼び出し元の種別。診断 code と適用範囲がこれで変わる */
66
203
  type PathInfoSource =
67
204
  /** data-wcs / mustache / コメントバインディング */
@@ -272,27 +409,6 @@ declare class RecursionRegistry {
272
409
  get materializedPaths(): ReadonlySet<string>;
273
410
  }
274
411
 
275
- declare const setLoopContextSymbol: unique symbol;
276
- declare const getByAddressSymbol: unique symbol;
277
- declare const hasByAddressSymbol: unique symbol;
278
- declare const setByAddressSymbol: unique symbol;
279
- declare const connectedCallbackSymbol: unique symbol;
280
- declare const disconnectedCallbackSymbol: unique symbol;
281
- declare const updatedCallbackSymbol: unique symbol;
282
- declare const errorCallbackSymbol: unique symbol;
283
-
284
- interface IStateProxy extends IState {
285
- [setLoopContextSymbol](loopContext: ILoopContext | null, callback: () => any): any;
286
- [getByAddressSymbol](address: IStateAddress): any;
287
- [hasByAddressSymbol](address: IStateAddress): boolean;
288
- [setByAddressSymbol](address: IStateAddress, value: any): void;
289
- [connectedCallbackSymbol](): Promise<void>;
290
- [disconnectedCallbackSymbol](): void;
291
- [updatedCallbackSymbol](updatedAbsAddressList: IAbsoluteStateAddress[]): void;
292
- [errorCallbackSymbol](error: unknown, info: IBindingErrorInfo): void;
293
- }
294
- type Mutability = "readonly" | "writable";
295
-
296
412
  interface IStateElement {
297
413
  /** DOM connection state; optional for non-DOM state implementations. */
298
414
  readonly isConnected?: boolean;
@@ -348,6 +464,45 @@ interface IStateElement {
348
464
  */
349
465
  readonly hasGraftedVolumes?: boolean;
350
466
  markHasGraftedVolumes?(): void;
467
+ /** ボリュームがこのルートに予約・接ぎ木された: スコープ機能の hook を付ける(webComponent/addressHooks.ts) */
468
+ markHasVolume?(): void;
469
+ /**
470
+ * ライフサイクル機能(core/lifecycleHooks.ts、設計案 H3)へ開く内部面。接続を引き取った機能が
471
+ * 要素の初期化を所有するために要る最小限で、optional はテスト用モック互換のため。
472
+ */
473
+ /** いま接続している rootNode(未接続は null)。公開の `rootNode` と違い throw しない */
474
+ readonly connectedRootNode?: Node | null;
475
+ clearConnectedRootNode?(): void;
476
+ /** 初期化完了の印(引き取った機能が自分の着地で立てる) */
477
+ markInitialized?(): void;
478
+ /** 初期化待ちの 3 つの promise を解決する(未解決のまま投げるとページが無言でウェッジする) */
479
+ settleInitialization?(): void;
480
+ /** `state` / `src` / 内包スクリプトからこの要素のソースを読む */
481
+ loadStateFromSource?(): Promise<Record<string, any>>;
482
+ /** 自分のツリーを持たずに初期化を終えた印(DCC 定義要素。再接続でこの rootNode のツリーとして登録し直さない) */
483
+ markTreeless?(): void;
484
+ /** 初期化失敗の着地(診断 1 件・connectedCallbackPromise の reject — #257)。常に throw する */
485
+ failInitializeLoudly?(error: unknown): never;
486
+ /** 接続の世代(接続の末尾の起動が、陳腐化した connect の再開を弾くために照合する) */
487
+ readonly connectGeneration?: number;
488
+ /** `$watch` / ボリュームの合流が決めた監視パス(setByAddress の旧値キャプチャのゲート) */
489
+ setWatchPaths?(paths: ReadonlySet<string> | null): void;
490
+ /** `$scan` の `from` パス(`watchPaths` と並ぶ旧値キャプチャのゲート) */
491
+ setScanPaths?(paths: ReadonlySet<string> | null): void;
492
+ /** 設定エラーの着地(初期化待ちの promise を解決し、二重着地の印を立てる) */
493
+ landInitialization?(): void;
494
+ /** `bind-component` が束ねた相手(`boundComponentStateProp` の答えになる) */
495
+ setBoundComponent?(component: Element | null, stateProp: string | null): void;
496
+ /** `$recursion` のレジストリ(宣言が無ければ null。`hasRecursion` の裏づけ) */
497
+ setRecursionRegistry?(registry: RecursionRegistry | null): void;
498
+ /** 前世代の再帰レジストリが生やした具体パス(経路情報の作り直しから除く) */
499
+ addGeneratedPath?(path: string): void;
500
+ /**
501
+ * 読み書き境界の hook(core/addressHooks.ts、設計案 H1)。宣言が要求する機能の分だけ
502
+ * `attachAddressHooks` で付く。無い state は null 判定 1 個で抜ける。optional はモック互換
503
+ */
504
+ readonly addressHooks?: IAttachedHooks | null;
505
+ attachAddressHooks?(feature: string, declaration: string): void;
351
506
  /**
352
507
  * この state 要素に束ねられた(`setPathInfo` を通った)パスの集合。丸ごとマウント
353
508
  * (ルート規則)の親→子通知が「登録済みパス全部を読み直せ」を組み立てるのに使う
@@ -501,26 +656,23 @@ interface IAbsoluteStateAddress {
501
656
  readonly listIndex: IListIndex | null;
502
657
  }
503
658
 
659
+ type BindingType = 'text' | 'prop' | 'event' | 'for' | 'if' | 'elseif' | 'else' | 'radio' | 'checkbox' | 'spread';
504
660
  /**
505
- * Filter/types.ts
506
- *
507
- * Type definition file for filter functions.
508
- *
509
- * Main responsibilities:
510
- * - Defines types for filter functions (FilterFn) and filter functions with options (FilterWithOptionsFn)
511
- * - Type-safe management of filter name-to-function mappings (FilterWithOptions) and filter function arrays (Filters)
512
- * - Defines types for retrieving filter functions from built-in filter collections
513
- *
514
- * Design points:
515
- * - Type design enabling flexible filter design and extension
516
- * - Supports filters with options and combinations of multiple filters
661
+ * 文法の段が読むフィルタ(名前と引数だけ。要件 D16)。実関数は束縛計画の段で
662
+ * 登録簿から解決される(`core/filterRegistry.ts`)ので、パース結果はここで止まる。
517
663
  */
518
- type FilterFn<T = unknown> = (value: unknown) => T;
519
-
520
- type BindingType = 'text' | 'prop' | 'event' | 'for' | 'if' | 'elseif' | 'else' | 'radio' | 'checkbox' | 'spread';
521
- interface IFilterInfo {
664
+ interface IParsedFilter {
522
665
  readonly filterName: string;
523
666
  readonly args: string[];
667
+ /**
668
+ * 引数の型付きの値(要件 B9)。引用符の無い `true` / `false` / `null` / 数値は型付き、引用符付きは
669
+ * 文字列のまま。`args` は引用符を外した原文(書式フィルタはこちらを読む)。組み立てた側が省略したら
670
+ * `args` と同じ扱い。
671
+ */
672
+ readonly literals?: readonly unknown[];
673
+ }
674
+ /** 束縛計画の段で実関数まで解決したフィルタ */
675
+ interface IFilterInfo extends IParsedFilter {
524
676
  readonly filterFn: FilterFn;
525
677
  }
526
678
  /**
@@ -534,12 +686,18 @@ interface IParsedBinding {
534
686
  readonly propModifiers: string[];
535
687
  readonly statePathName: string;
536
688
  readonly statePathInfo: IPathInfo;
537
- readonly inFilters: IFilterInfo[];
538
- readonly outFilters: IFilterInfo[];
689
+ readonly inFilters: IParsedFilter[];
690
+ readonly outFilters: IParsedFilter[];
539
691
  readonly bindingType: BindingType;
540
692
  readonly uuid?: string | null;
541
693
  }
694
+ /**
695
+ * 束縛計画の段のバインディング。パース結果に DOM のノードと、**解決済みのフィルタ**が付く
696
+ * (`bindings/getBindingInfos.ts` が登録簿から引く — 要件 D16)。
697
+ */
542
698
  interface IBindingInfo extends IParsedBinding {
699
+ readonly inFilters: IFilterInfo[];
700
+ readonly outFilters: IFilterInfo[];
543
701
  readonly node: Node;
544
702
  readonly replaceNode: Node;
545
703
  }
@@ -624,6 +782,10 @@ interface IWritableConfig {
624
782
  sameValueGuard?: boolean;
625
783
  }
626
784
 
785
+ /**
786
+ * 全機能を入れてから core を立ち上げる(従来の `bootstrapState()` と同じ挙動)。
787
+ * install は要素の定義(connectedCallback が走り得る)より前に行う。いずれも冪等。
788
+ */
627
789
  declare function bootstrapState(config?: IWritableConfig, registry?: CustomElementRegistry): void;
628
790
 
629
791
  declare function getConfig(): IConfig;
@@ -1118,6 +1280,8 @@ interface IWcsManifest {
1118
1280
  elseKeyword: string;
1119
1281
  spread: string;
1120
1282
  eventPropertyPrefix: string;
1283
+ /** 左辺の先頭に付けると、名前が `on` で始まってもイベントにしない明示のプロパティ形(`.online:`、要件 B5) */
1284
+ explicitPropertyPrefix: string;
1121
1285
  propNamespaces: {
1122
1286
  eventToken: string;
1123
1287
  command: string;
@@ -1422,34 +1586,13 @@ declare class State extends HTMLElementBase implements IStateElement {
1422
1586
  private _boundComponentStateProp;
1423
1587
  private _hasMounts;
1424
1588
  private _hasGraftedVolumes;
1425
- /** ボリューム(mount=): 接ぎ木済みの控え($disconnectedCallback 用) */
1426
- private _volumeGraftInfo;
1427
- /** ボリューム: スロット予約済み・接ぎ木進行中(ロード完了前の再接続の再入ガード) */
1428
- private _volumeInitializing;
1429
- /**
1430
- * ボリューム: 予約したマウントパス(#265)。枠を返した後に取り直すときもこれを使う —
1431
- * `mount` 属性は書き換えられるので読み直さない。
1432
- */
1433
- private _volumeMountPath;
1434
- /**
1435
- * ボリューム: いま枠を握っている rootNode(#265)。null は「握っていない」。解放はこの控えと
1436
- * `_volumeMountPath` の組でだけ行う。切断時の `_rootNode`(先に null になる)から読み直すと、
1437
- * 予約した組と一致する保証が無く、別の要素の枠を消しうる。
1438
- */
1439
- private _volumeSlotRootNode;
1440
- /**
1441
- * ボリューム: ロード中に外れたときに枠を返した rootNode(#265)。同じ rootNode へ付け直した(並べ替えた)
1442
- * ときだけ connectedCallback がその場で枠を取り直すための控え。付け直すたびに null へ戻す。
1443
- */
1444
- private _volumeDetachedFrom;
1445
- /** v2 マウント(Phase 2): この bind-component 要素が構築したマウント記録 */
1446
- private _mountRecord;
1589
+ /** 読み書き境界の hook(設計案 H1)。宣言が要求する機能の分だけ付く */
1590
+ private _addressHooks;
1447
1591
  private _bindableEventMap;
1448
1592
  private _commandTokenNames;
1449
1593
  private _eventTokenNames;
1450
- private _dcc;
1594
+ private _treeless;
1451
1595
  private _connectGeneration;
1452
- private _streamsStartedGeneration;
1453
1596
  constructor();
1454
1597
  private get _state();
1455
1598
  private set _state(value);
@@ -1457,12 +1600,6 @@ declare class State extends HTMLElementBase implements IStateElement {
1457
1600
  private _loadFromSsrElement;
1458
1601
  /** state / src / json / inner <script> / API set のソース解決(_initialize とボリュームで共用)。 */
1459
1602
  private _loadStateFromSource;
1460
- /**
1461
- * ボリューム(`<wcs-state mount="path">`): 独立ツリーを持たず、ロード完了で
1462
- * ルートに接ぎ木する(webComponent/volume.ts)。接続時にスロットを予約(D22)。
1463
- * ルートより先に接続されてもよい — ルート登録が保留分を引き取る(V5)。
1464
- */
1465
- private _initializeVolume;
1466
1603
  /**
1467
1604
  * 初回マウントのロードと登録。戻り値は「この接続で初期化を**完了**したか」で、
1468
1605
  * `false` は失敗ではなく**中断**(ロード中に要素が剥がされた — 下の注記)。
@@ -1502,7 +1639,8 @@ declare class State extends HTMLElementBase implements IStateElement {
1502
1639
  * PR では変えない(枠の寿命は別 Issue)。
1503
1640
  *
1504
1641
  * `connectedCallback` が `_initialize` より前に await する 2 つ
1505
- * (`_initializeDCC` / `_initializeBindWebComponent`)の raise も同じ着地に載る。
1642
+ * (DCC の接続 — dcc/dccLifecycle.ts が内部面の `failInitializeLoudly` で載せる — と、
1643
+ * `bind-component` の preparing)の raise も同じ着地に載る。
1506
1644
  * 特に「初期化に失敗した要素の再接続」は `bindWebComponent` → `setInitialState` の
1507
1645
  * 復旧不能 raise でそこへ来るので、包まないと診断ゼロで素通りする。
1508
1646
  *
@@ -1522,23 +1660,38 @@ declare class State extends HTMLElementBase implements IStateElement {
1522
1660
  * ガードで抜ける。`$listKeys` / `$watch` のようにセッタの後半で落ちた形では
1523
1661
  * `$on` の購読と stream registry が残るが、この要素は復旧不能(setInitialState が
1524
1662
  * throw する)なので、残骸は要素ごと捨てる前提で放置する。
1663
+ *
1664
+ * `ownsTree` が false の着地は、この要素だけを失敗させてルートに触らない。`mount=` の
1665
+ * readiness barrier(要件 D23)が使う: ボリュームはツリーの持ち主ではなく、ルートより先に
1666
+ * 接続したボリュームでは rootNode にまだ誰も居ないので、既定の着地だとまだ来ていないルートの
1667
+ * ノードを利用不能と印付けし、保留中の他のボリュームまで落としてしまう。
1525
1668
  */
1526
1669
  private _failInitializeLoudly;
1527
- private _initializeBindWebComponent;
1528
1670
  private _callStateConnectedCallback;
1529
- private _initializeDCC;
1530
1671
  private _callStateDisconnectedCallback;
1531
1672
  connectedCallback(): Promise<void>;
1532
- /** 控えている枠を返す(#265)。所有者の確認は `releaseVolumeSlot` が行う。 */
1533
- private _releaseVolumeSlot;
1534
- /**
1535
- * 接ぎ木の直前に、`rootNode` のマウントの枠を取る(#265)。握っていれば真。ロード中・保留中に外れて
1536
- * 返していれば取り直して真。外れている間に別の要素が同じマウントパスを取っていれば、横取りせずに
1537
- * 報告して偽 — 黙らせると、作者に見えるのは「データが現れない」だけになる。
1538
- */
1539
- private _acquireVolumeSlot;
1540
1673
  disconnectedCallback(): void;
1541
1674
  get initialized(): boolean;
1675
+ /**
1676
+ * ライフサイクル機能(core/lifecycleHooks.ts、設計案 H3)へ開く内部面。接続を引き取った機能が
1677
+ * 要素の初期化を所有するために要る最小限。
1678
+ */
1679
+ get connectedRootNode(): Node | null;
1680
+ clearConnectedRootNode(): void;
1681
+ markInitialized(): void;
1682
+ settleInitialization(): void;
1683
+ loadStateFromSource(): Promise<Record<string, any>>;
1684
+ markTreeless(): void;
1685
+ /** 初期化失敗の着地(`_failInitializeLoudly`)。接続を引き取った機能が自分の失敗を載せる */
1686
+ failInitializeLoudly(error: unknown): never;
1687
+ get connectGeneration(): number;
1688
+ setWatchPaths(paths: ReadonlySet<string> | null): void;
1689
+ setScanPaths(paths: ReadonlySet<string> | null): void;
1690
+ /** 設定エラーの着地(`_failInitialization` の raise を除いた部分)。引き取った機能が使う */
1691
+ landInitialization(): void;
1692
+ setRecursionRegistry(registry: RecursionRegistry | null): void;
1693
+ addGeneratedPath(path: string): void;
1694
+ setBoundComponent(component: Element | null, stateProp: string | null): void;
1542
1695
  get initializePromise(): Promise<void>;
1543
1696
  get connectedCallbackPromise(): Promise<void>;
1544
1697
  get listPaths(): Set<string>;
@@ -1579,8 +1732,15 @@ declare class State extends HTMLElementBase implements IStateElement {
1579
1732
  /** 唯一の呼び手は webComponent/mount.ts の registerMountRecord(Phase 2)。 */
1580
1733
  markHasMounts(): void;
1581
1734
  get hasGraftedVolumes(): boolean;
1735
+ get addressHooks(): IAttachedHooks | null;
1736
+ /** 宣言 `declaration` が要求する機能 `feature` の hook をこの state に付ける(未 install なら throw、D13) */
1737
+ attachAddressHooks(feature: string, declaration: string): void;
1582
1738
  /** 唯一の呼び手は webComponent/volume.ts の graftVolume(D22 後段のガードが読む)。 */
1583
1739
  markHasGraftedVolumes(): void;
1740
+ /** ボリュームがこのルートに予約された(接ぎ木前でも、予約下の読みは undefined が正 — D22) */
1741
+ markHasVolume(): void;
1742
+ /** スコープ機能(マウント・ボリューム)の hook をこの state に付ける(冪等) */
1743
+ private _attachScopeHooks;
1584
1744
  get bindableEventMap(): Record<string, string>;
1585
1745
  get commandTokenNames(): ReadonlySet<string>;
1586
1746
  get eventTokenNames(): ReadonlySet<string>;