@wcstack/state 3.2.0 → 3.4.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 (57) hide show
  1. package/README.ja.md +140 -83
  2. package/README.md +141 -84
  3. package/dist/auto.min.js +1 -1
  4. package/dist/auto.min.js.map +1 -1
  5. package/dist/index.d.ts +74 -8
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/manifest.d.ts +28 -5
  9. package/dist/manifest.esm.js +253 -246
  10. package/dist/parser.d.ts +16 -2
  11. package/dist/parser.esm.js +223 -50
  12. package/dist/split/chunks/binder.js +1 -1
  13. package/dist/split/chunks/binder.js.map +1 -1
  14. package/dist/split/chunks/checkDependency.js +1 -1
  15. package/dist/split/chunks/checkDependency.js.map +1 -1
  16. package/dist/split/chunks/declarationAliases.js +1 -1
  17. package/dist/split/chunks/declarationAliases.js.map +1 -1
  18. package/dist/split/chunks/declarationHooks.js +2 -0
  19. package/dist/split/chunks/declarationHooks.js.map +1 -0
  20. package/dist/split/chunks/diagnosticsHooks.js.map +1 -1
  21. package/dist/split/chunks/featureBridge.js +2 -0
  22. package/dist/split/chunks/featureBridge.js.map +1 -0
  23. package/dist/split/chunks/filterRegistry.js +1 -1
  24. package/dist/split/chunks/filterRegistry.js.map +1 -1
  25. package/dist/split/chunks/getAllPropertyDescriptors.js +1 -1
  26. package/dist/split/chunks/getAllPropertyDescriptors.js.map +1 -1
  27. package/dist/split/chunks/lifecycleHooks.js +1 -1
  28. package/dist/split/chunks/pathDiagnostics.js +1 -1
  29. package/dist/split/chunks/pathDiagnostics.js.map +1 -1
  30. package/dist/split/chunks/registerComponents.js +1 -1
  31. package/dist/split/chunks/registerComponents.js.map +1 -1
  32. package/dist/split/chunks/setAll.js +1 -1
  33. package/dist/split/chunks/setAll.js.map +1 -1
  34. package/dist/split/chunks/version.js +1 -1
  35. package/dist/split/core.d.ts +64 -2
  36. package/dist/split/core.js +1 -1
  37. package/dist/split/core.js.map +1 -1
  38. package/dist/split/features/devtools.js +1 -1
  39. package/dist/split/features/devtools.js.map +1 -1
  40. package/dist/split/features/diagnostics.js +1 -1
  41. package/dist/split/features/diagnostics.js.map +1 -1
  42. package/dist/split/features/formats.js +1 -1
  43. package/dist/split/features/formats.js.map +1 -1
  44. package/dist/split/features/recursion.js +1 -1
  45. package/dist/split/features/recursion.js.map +1 -1
  46. package/dist/split/features/scopes.js +1 -1
  47. package/dist/split/features/scopes.js.map +1 -1
  48. package/dist/split/features/ssr.js +1 -1
  49. package/dist/split/features/ssr.js.map +1 -1
  50. package/dist/split/features/temporal.js +1 -1
  51. package/dist/split/features/temporal.js.map +1 -1
  52. package/dist/wcs-manifest.json +36 -21
  53. package/package.json +1 -1
  54. package/dist/split/chunks/mount.js +0 -2
  55. package/dist/split/chunks/mount.js.map +0 -1
  56. package/dist/split/chunks/watchRuntime.js +0 -2
  57. package/dist/split/chunks/watchRuntime.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -45,7 +45,6 @@ interface ILoopContextStack {
45
45
  declare const setLoopContextSymbol: unique symbol;
46
46
  declare const getByAddressSymbol: unique symbol;
47
47
  declare const hasByAddressSymbol: unique symbol;
48
- declare const setByAddressSymbol: unique symbol;
49
48
  declare const connectedCallbackSymbol: unique symbol;
50
49
  declare const disconnectedCallbackSymbol: unique symbol;
51
50
  declare const updatedCallbackSymbol: unique symbol;
@@ -84,7 +83,6 @@ interface IStateProxy extends IState {
84
83
  [setLoopContextSymbol](loopContext: ILoopContext | null, callback: () => any): any;
85
84
  [getByAddressSymbol](address: IStateAddress): any;
86
85
  [hasByAddressSymbol](address: IStateAddress): boolean;
87
- [setByAddressSymbol](address: IStateAddress, value: any): void;
88
86
  [connectedCallbackSymbol](): Promise<void>;
89
87
  [disconnectedCallbackSymbol](): void;
90
88
  [updatedCallbackSymbol](updatedAbsAddressList: IAbsoluteStateAddress[]): void;
@@ -92,6 +90,8 @@ interface IStateProxy extends IState {
92
90
  }
93
91
  type Mutability = "readonly" | "writable";
94
92
 
93
+ type ParseBindTextResult = IParsedBinding;
94
+
95
95
  /**
96
96
  * Filter/types.ts
97
97
  *
@@ -108,6 +108,23 @@ type Mutability = "readonly" | "writable";
108
108
  */
109
109
  type FilterFn<T = unknown> = (value: unknown) => T;
110
110
 
111
+ /**
112
+ * パース結果の変換フック(Phase 2 のマウント — impl-plan §3-0 の 1)。
113
+ * マウントされたスコープの収集は、これで各パース結果を親ツリーの絶対パスへ書き換える。
114
+ * `uuid` を持つエントリ(構造フラグメントの参照)には掛けない — フラグメント側の
115
+ * パース結果は登録時(collectStructuralFragments)に変換済みで、二重に掛けると
116
+ * 接頭辞が二重になる。
117
+ */
118
+ type ParseResultTransform = (parsed: ParseBindTextResult, forPath?: string) => ParseBindTextResult;
119
+ interface IDeferredSpreadEntry {
120
+ readonly node: Node;
121
+ readonly tagName: string;
122
+ readonly parseResults: ParseBindTextResult[];
123
+ readonly transform?: ParseResultTransform;
124
+ /** 予約中の定義待ちの取り消し(`scheduleDeferredSpreads` が持つ。行の活性化し直しで待ちを重ねない) */
125
+ cancel?: () => void;
126
+ }
127
+
111
128
  interface IContent {
112
129
  readonly firstNode: Node | null;
113
130
  readonly lastNode: Node | null;
@@ -127,6 +144,11 @@ interface IContent {
127
144
  * 従来経路(deactivate + unmount)で解体する。
128
145
  */
129
146
  tryDestroy(): boolean;
147
+ /**
148
+ * まだ展開していない、未定義カスタム要素への spread(#330)。持つ行だけに付く(形を増やさない)。
149
+ * 活性化のたびに定義待ちへ予約し、展開したものは外れる
150
+ */
151
+ spreads?: IDeferredSpreadEntry[];
130
152
  }
131
153
 
132
154
  /**
@@ -165,6 +187,16 @@ type WrittenHook = (stateElement: IStateElement, pathInfo: IPathInfo, detail?: {
165
187
  type SwappedHook = (stateElement: IStateElement, elementAbsAddress: IAbsoluteStateAddress, displacedAbsAddress: IAbsoluteStateAddress) => void;
166
188
  type GetHook = (handler: IStateHandler, prop: string, receiver: any, target: object) => unknown;
167
189
  type IndexShiftHook = (handler: IStateHandler, lastAddress: IStateAddress) => number;
190
+ /**
191
+ * ハンドラが受け取る添字の段数を決める(`event/handler.ts`)。
192
+ *
193
+ * **合成は未定義** — この hook は畳み込み(前の hook の結果が次の `wildcardCount` になる)で
194
+ * 呼ばれるが、現行唯一の実装(`webComponent/addressHooks.ts` の scopes)は「記録が引けて
195
+ * shift が無ければ 0」を返す**吸収型**で、可換でも結合的でもない。2 つ目の実装が足されると
196
+ * `0 - shift` のような負値になりうる。**実装は 1 つに保つこと**。2 つ目が要るなら、先に
197
+ * 「答えを持たない hook は次へ渡す」規約(`NOT_HANDLED` を返す形。`read` / `write` と同じ)
198
+ * へ寄せてから足す。
199
+ */
168
200
  type HandlerScopeHook = (stateElement: IStateElement, node: Node, rootNode: Node, loopContext: ILoopContext, wildcardCount: number) => number;
169
201
  type UpdatedHook = (stateElement: IStateElement, refs: IAbsoluteStateAddress[], receiver: any) => void;
170
202
  type SuppressPathDiagnosticHook = (stateElement: IStateElement, path: string) => boolean;
@@ -874,7 +906,12 @@ declare class Ssr extends HTMLElementBase implements ISsrElement {
874
906
  * wcs-state 要素から $ プレフィックスや関数を除いたデータを抽出する。
875
907
  */
876
908
  static extractStateData(stateEl: Element): Record<string, any>;
877
- static buildContent(ssrEl: Element, stateData: Record<string, any>): void;
909
+ /**
910
+ * @param scanRoot このスナップショットが属するツリー(既定は `ssrEl` の document)。
911
+ * テンプレートと props はここから到達できるものだけを載せる — モジュール寿命の台帳に
912
+ * 残った**別のレンダリング**の分を混ぜないため(リクエスト間のデータ漏れ)。
913
+ */
914
+ static buildContent(ssrEl: Element, stateData: Record<string, any>, scanRoot?: Node): void;
878
915
  /**
879
916
  * SSR ブロック境界コメント (@@wcs-*-start/end) を除去する
880
917
  */
@@ -1235,8 +1272,23 @@ interface IFilterMeta {
1235
1272
  /** 組み込みフィルタ名 → 構造化メタデータ。キー集合は builtinFilters と一致しなければならない。 */
1236
1273
  declare const builtinFilterMeta: Record<string, IFilterMeta>;
1237
1274
 
1238
- /** マニフェストのバージョン(構造を変えたら上げる)。 */
1239
- declare const WCS_MANIFEST_VERSION = 1;
1275
+ /**
1276
+ * filters/filterAliases.ts — 組み込みフィルタの旧名 → 正式名(要件 B12・docs/state-3x-naming.ja.md V1〜V9)。
1277
+ *
1278
+ * 旧名は 3.x の間エイリアスとして残り、4.0 で外す(D4)。解決は登録簿(core/filterRegistry)が行い、
1279
+ * 実装・引数の個数・メタデータは正式名だけが持つ。formats の install と manifest(tooling)の両方が読むので、
1280
+ * 実装にもメタデータにも依存しない小さな表として独立させている。
1281
+ */
1282
+ declare const builtinFilterAliases: Readonly<Record<string, string>>;
1283
+
1284
+ /**
1285
+ * マニフェストのバージョン(構造を変えたら上げる)。
1286
+ *
1287
+ * 3.1 で `syntax.bindingTypes.explicitPropertyPrefix`、3.2 で `filterAliases`、
1288
+ * 3.x の次で `declarationAliases` / `apiAliases` を足したので 2。
1289
+ * 消費側(vscode-wcs)はまだこの定数を参照していないが、公開している以上ドリフトさせない。
1290
+ */
1291
+ declare const WCS_MANIFEST_VERSION = 2;
1240
1292
  interface IWcsManifest {
1241
1293
  version: number;
1242
1294
  syntax: {
@@ -1301,9 +1353,18 @@ interface IWcsManifest {
1301
1353
  filterMeta: Record<string, IFilterMeta>;
1302
1354
  /** 組み込みフィルタの旧名 → 正式名(要件 B12)。旧名も解決するが、ツールは正式名を提案する */
1303
1355
  filterAliases: Readonly<Record<string, string>>;
1304
- /** 予約ライフサイクルフック名 */
1356
+ /**
1357
+ * 宣言キーの旧名 → 正式名(要件 B12。`$updatedCallback` → `$renderedCallback`、
1358
+ * `$streams` → `$stream`)。ランタイムは旧名も受けるが、ツールは正式名を提案する。
1359
+ * `reservedLifecycle` / `reservedStateApi` は**正式名だけ**なので、旧名が予約かどうかは
1360
+ * この表と併せて判断する
1361
+ */
1362
+ declarationAliases: Readonly<Record<string, string>>;
1363
+ /** state API の旧名 → 正式名(`$trackDependency` → `$dependOn` 等、要件 B12) */
1364
+ apiAliases: Readonly<Record<string, string>>;
1365
+ /** 予約ライフサイクルフック名(正式名のみ。旧名は `declarationAliases` を見る) */
1305
1366
  reservedLifecycle: readonly string[];
1306
- /** 予約 state API(プロトコル系の `$` 名前空間) */
1367
+ /** 予約 state API(プロトコル系の `$` 名前空間。正式名のみ) */
1307
1368
  reservedStateApi: readonly string[];
1308
1369
  }
1309
1370
  /** 機械可読な単一正本を返す。vscode-wcs はこれを消費する想定。 */
@@ -1377,6 +1438,11 @@ type DevtoolsEvent = {
1377
1438
  readonly maxDepth: number;
1378
1439
  /** 打ち切ったバッチに載っていたアドレスのパス(報告用) */
1379
1440
  readonly paths: readonly string[];
1441
+ } | {
1442
+ readonly type: "state:render-chain-limit";
1443
+ readonly maxDepth: number;
1444
+ /** 打ち切ったバッチに載っていたアドレスのパス(= 直前の描画の中で書かれたパス) */
1445
+ readonly paths: readonly string[];
1380
1446
  } | {
1381
1447
  readonly type: "state:watch-fired";
1382
1448
  /** `$watch` の宣言キー(ワイルドカードを含む生のパス) */
@@ -1824,5 +1890,5 @@ declare global {
1824
1890
  }
1825
1891
  }
1826
1892
 
1827
- export { Ssr, TRUSTED_TYPES_POLICY_SLOT, VERSION, WCS_MANIFEST_VERSION, analyzeContract, bootstrapState, buildBindings, builtinFilterMeta, defineState, getBindingsReady, getConfig, getTrustedTypesPolicy, getWcsManifest, setTrustedTypesPolicy };
1893
+ export { Ssr, TRUSTED_TYPES_POLICY_SLOT, VERSION, WCS_MANIFEST_VERSION, analyzeContract, bootstrapState, buildBindings, builtinFilterAliases, builtinFilterMeta, defineState, getBindingsReady, getConfig, getTrustedTypesPolicy, getWcsManifest, setTrustedTypesPolicy };
1828
1894
  export type { ContractEvent, FilterArgType, FilterResultType, IBindingErrorInfo, IContractManifest, IFilterMeta, ISsrElement, IWcsManifest, IWcsTrustedTypesPolicy, IWritableConfig, IWritableTagNames, WcsPathValue, WcsPaths, WcsStateApi, WcsThis };