@wcstack/state 3.3.0 → 3.5.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 (43) hide show
  1. package/README.ja.md +94 -27
  2. package/README.md +94 -27
  3. package/dist/auto.min.js +1 -1
  4. package/dist/auto.min.js.map +1 -1
  5. package/dist/index.d.ts +52 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/split/chunks/binder.js +1 -1
  9. package/dist/split/chunks/binder.js.map +1 -1
  10. package/dist/split/chunks/checkDependency.js +1 -1
  11. package/dist/split/chunks/checkDependency.js.map +1 -1
  12. package/dist/split/chunks/declarationAliases.js.map +1 -1
  13. package/dist/split/chunks/diagnosticsHooks.js.map +1 -1
  14. package/dist/split/chunks/featureBridge.js +1 -1
  15. package/dist/split/chunks/filterRegistry.js +1 -1
  16. package/dist/split/chunks/filterRegistry.js.map +1 -1
  17. package/dist/split/chunks/getAllPropertyDescriptors.js +1 -1
  18. package/dist/split/chunks/lifecycleHooks.js +1 -1
  19. package/dist/split/chunks/lifecycleHooks.js.map +1 -1
  20. package/dist/split/chunks/pathDiagnostics.js +1 -1
  21. package/dist/split/chunks/pathDiagnostics.js.map +1 -1
  22. package/dist/split/chunks/registerComponents.js +1 -1
  23. package/dist/split/chunks/registerComponents.js.map +1 -1
  24. package/dist/split/chunks/setAll.js +1 -1
  25. package/dist/split/chunks/setAll.js.map +1 -1
  26. package/dist/split/chunks/version.js +1 -1
  27. package/dist/split/core.d.ts +77 -1
  28. package/dist/split/core.js +1 -1
  29. package/dist/split/features/devtools.js +1 -1
  30. package/dist/split/features/devtools.js.map +1 -1
  31. package/dist/split/features/diagnostics.js +1 -1
  32. package/dist/split/features/diagnostics.js.map +1 -1
  33. package/dist/split/features/formats.js +1 -1
  34. package/dist/split/features/formats.js.map +1 -1
  35. package/dist/split/features/recursion.js +1 -1
  36. package/dist/split/features/recursion.js.map +1 -1
  37. package/dist/split/features/scopes.js +1 -1
  38. package/dist/split/features/scopes.js.map +1 -1
  39. package/dist/split/features/ssr.js +1 -1
  40. package/dist/split/features/ssr.js.map +1 -1
  41. package/dist/split/features/temporal.js +1 -1
  42. package/dist/split/features/temporal.js.map +1 -1
  43. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -90,6 +90,8 @@ interface IStateProxy extends IState {
90
90
  }
91
91
  type Mutability = "readonly" | "writable";
92
92
 
93
+ type ParseBindTextResult = IParsedBinding;
94
+
93
95
  /**
94
96
  * Filter/types.ts
95
97
  *
@@ -106,6 +108,23 @@ type Mutability = "readonly" | "writable";
106
108
  */
107
109
  type FilterFn<T = unknown> = (value: unknown) => T;
108
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
+
109
128
  interface IContent {
110
129
  readonly firstNode: Node | null;
111
130
  readonly lastNode: Node | null;
@@ -125,6 +144,11 @@ interface IContent {
125
144
  * 従来経路(deactivate + unmount)で解体する。
126
145
  */
127
146
  tryDestroy(): boolean;
147
+ /**
148
+ * まだ展開していない、未定義カスタム要素への spread(#330)。持つ行だけに付く(形を増やさない)。
149
+ * 活性化のたびに定義待ちへ予約し、展開したものは外れる
150
+ */
151
+ spreads?: IDeferredSpreadEntry[];
128
152
  }
129
153
 
130
154
  /**
@@ -775,6 +799,7 @@ interface IBindingErrorInfo {
775
799
  }
776
800
  interface IWritableConfig {
777
801
  bindAttributeName?: string;
802
+ /** @deprecated Removed in 4.0, whose `bootstrapState` throws on it (3.5 warns `wcs/v4-migration`). */
778
803
  commentTextPrefix?: string;
779
804
  commentForPrefix?: string;
780
805
  commentIfPrefix?: string;
@@ -782,11 +807,16 @@ interface IWritableConfig {
782
807
  commentElsePrefix?: string;
783
808
  tagNames?: IWritableTagNames;
784
809
  locale?: string;
810
+ /** @deprecated Removed in 4.0, whose `bootstrapState` throws on it (3.5 warns `wcs/v4-migration`). */
785
811
  debug?: boolean;
812
+ /** Moves to the state's `$behavior` in 4.0 (3.5 warns `wcs/v4-migration`); in 3.x, set it here. */
786
813
  enableMustache?: boolean;
814
+ /** Moves to the state's `$behavior` in 4.0 (3.5 warns `wcs/v4-migration`); in 3.x, set it here. */
787
815
  enableDirectionalInitialSync?: boolean;
816
+ /** @deprecated Removed in 4.0, whose `bootstrapState` throws on it (3.5 warns `wcs/v4-migration`). */
788
817
  enablePropagationContext?: boolean;
789
818
  enableContractAnalyzer?: boolean;
819
+ /** Moves to the state's `$behavior` in 4.0 (3.5 warns `wcs/v4-migration`); in 3.x, set it here. */
790
820
  sameValueGuard?: boolean;
791
821
  }
792
822
 
@@ -1414,6 +1444,11 @@ type DevtoolsEvent = {
1414
1444
  readonly maxDepth: number;
1415
1445
  /** 打ち切ったバッチに載っていたアドレスのパス(報告用) */
1416
1446
  readonly paths: readonly string[];
1447
+ } | {
1448
+ readonly type: "state:render-chain-limit";
1449
+ readonly maxDepth: number;
1450
+ /** 打ち切ったバッチに載っていたアドレスのパス(= 直前の描画の中で書かれたパス) */
1451
+ readonly paths: readonly string[];
1417
1452
  } | {
1418
1453
  readonly type: "state:watch-fired";
1419
1454
  /** `$watch` の宣言キー(ワイルドカードを含む生のパス) */
@@ -1641,7 +1676,23 @@ declare class State extends HTMLElementBase implements IStateElement {
1641
1676
  private set _state(value);
1642
1677
  attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
1643
1678
  private _loadFromSsrElement;
1644
- /** state / src / json / inner <script> / API set のソース解決(_initialize とボリュームで共用)。 */
1679
+ /**
1680
+ * state / src / json / inner <script> / API set のソース解決(_initialize とボリュームで共用)。
1681
+ *
1682
+ * A load failure is not wrapped, here or in the loaders: what was thrown propagates as is —
1683
+ * the SyntaxError of `JSON.parse` (`state=` / `json=`), the `import()` rejection or the
1684
+ * module's own throw (`src="*.js"`), the inline-script loader's Error (the import failure is
1685
+ * its `cause`), the unsupported-extension error, or a non-Error value. On a root,
1686
+ * `_failInitializeLoudly` logs it under the element's "failed to initialize" line and rejects
1687
+ * connectedCallbackPromise with that same value (the README contract); on a volume,
1688
+ * volumeLifecycle logs it under its "failed to load" line. The old wrappers
1689
+ * (`Failed to initialize state: ${e}` here, `Failed to load script file` /
1690
+ * `Failed to parse JSON from script element` in the loaders) were new Errors that kept the
1691
+ * original only as text, losing its type, stack and cause.
1692
+ *
1693
+ * Two sources do not fail at all in 3.x (README): `src="*.json"` that cannot be fetched or
1694
+ * parsed, and `state=` naming no JSON script. Both log and start with an empty state.
1695
+ */
1645
1696
  private _loadStateFromSource;
1646
1697
  /**
1647
1698
  * 初回マウントのロードと登録。戻り値は「この接続で初期化を**完了**したか」で、