@wcstack/state 3.5.4 → 4.0.0-rc.2
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 +669 -428
- package/README.md +667 -426
- package/dist/auto.min.js +1 -2
- package/dist/define.d.ts +4 -8
- package/dist/define.js +1 -1
- package/dist/index.d.ts +139 -1483
- package/dist/index.esm.js +1 -2
- package/dist/manifest.d.ts +18 -59
- package/dist/manifest.esm.js +542 -1202
- package/dist/parser.d.ts +49 -103
- package/dist/parser.esm.js +662 -831
- package/dist/split/auto.js +1 -0
- package/dist/split/chunks/chunk-732CB4QN.js +1 -0
- package/dist/split/chunks/chunk-7PN5YNZZ.js +1 -0
- package/dist/split/chunks/chunk-FF6KHTYS.js +1 -0
- package/dist/split/chunks/chunk-HFKGUDDJ.js +1 -0
- package/dist/split/chunks/chunk-PKDBVBAP.js +1 -0
- package/dist/split/chunks/chunk-QI7P7YPP.js +1 -0
- package/dist/split/chunks/chunk-QQH6N5CJ.js +1 -0
- package/dist/split/chunks/chunk-UM3O6QXD.js +1 -0
- package/dist/split/chunks/chunk-WEL3YSG7.js +1 -0
- package/dist/split/chunks/chunk-WWJNAZVP.js +1 -0
- package/dist/split/chunks/chunk-YOPPVWPQ.js +1 -0
- package/dist/split/core.d.ts +114 -1168
- package/dist/split/core.js +1 -2
- package/dist/split/features/devtools.d.ts +23 -3
- package/dist/split/features/devtools.js +1 -2
- package/dist/split/features/diagnostics.d.ts +27 -5
- package/dist/split/features/diagnostics.js +1 -2
- package/dist/split/features/formats.d.ts +21 -5
- package/dist/split/features/formats.js +1 -2
- package/dist/split/features/list-keys.d.ts +24 -0
- package/dist/split/features/list-keys.js +1 -0
- package/dist/split/features/recursion.d.ts +23 -3
- package/dist/split/features/recursion.js +1 -2
- package/dist/split/features/scopes.d.ts +25 -4
- package/dist/split/features/scopes.js +1 -2
- package/dist/split/features/ssr.d.ts +23 -3
- package/dist/split/features/ssr.js +1 -2
- package/dist/split/features/temporal.d.ts +19 -4
- package/dist/split/features/temporal.js +1 -2
- package/dist/wcs-manifest.json +43 -49
- package/package.json +15 -17
- package/dist/auto.min.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/split/chunks/binder.js +0 -2
- package/dist/split/chunks/binder.js.map +0 -1
- package/dist/split/chunks/checkDependency.js +0 -2
- package/dist/split/chunks/checkDependency.js.map +0 -1
- package/dist/split/chunks/declarationAliases.js +0 -2
- package/dist/split/chunks/declarationAliases.js.map +0 -1
- package/dist/split/chunks/declarationHooks.js +0 -2
- package/dist/split/chunks/declarationHooks.js.map +0 -1
- package/dist/split/chunks/diagnosticsHooks.js +0 -2
- package/dist/split/chunks/diagnosticsHooks.js.map +0 -1
- package/dist/split/chunks/errorGuidance.js +0 -2
- package/dist/split/chunks/errorGuidance.js.map +0 -1
- package/dist/split/chunks/featureBridge.js +0 -2
- package/dist/split/chunks/featureBridge.js.map +0 -1
- package/dist/split/chunks/features.d.ts +0 -29
- package/dist/split/chunks/filterRegistry.js +0 -2
- package/dist/split/chunks/filterRegistry.js.map +0 -1
- package/dist/split/chunks/getAllPropertyDescriptors.js +0 -2
- package/dist/split/chunks/getAllPropertyDescriptors.js.map +0 -1
- package/dist/split/chunks/lifecycleHooks.js +0 -2
- package/dist/split/chunks/lifecycleHooks.js.map +0 -1
- package/dist/split/chunks/pathDiagnostics.js +0 -2
- package/dist/split/chunks/pathDiagnostics.js.map +0 -1
- package/dist/split/chunks/registerComponents.js +0 -2
- package/dist/split/chunks/registerComponents.js.map +0 -1
- package/dist/split/chunks/setAll.js +0 -2
- package/dist/split/chunks/setAll.js.map +0 -1
- package/dist/split/chunks/version.js +0 -2
- package/dist/split/chunks/version.js.map +0 -1
- package/dist/split/core.js.map +0 -1
- package/dist/split/features/devtools.js.map +0 -1
- package/dist/split/features/diagnostics.js.map +0 -1
- package/dist/split/features/formats.js.map +0 -1
- package/dist/split/features/recursion.js.map +0 -1
- package/dist/split/features/scopes.js.map +0 -1
- package/dist/split/features/ssr.js.map +0 -1
- package/dist/split/features/temporal.js.map +0 -1
package/dist/parser.d.ts
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
|
+
type BindingType = 'text' | 'prop' | 'event' | 'for' | 'if' | 'elseif' | 'else' | 'radio' | 'checkbox' | 'spread';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Type definition file for filter functions.
|
|
5
|
-
*
|
|
6
|
-
* Main responsibilities:
|
|
7
|
-
* - Defines types for filter functions (FilterFn) and filter functions with options (FilterWithOptionsFn)
|
|
8
|
-
* - Type-safe management of filter name-to-function mappings (FilterWithOptions) and filter function arrays (Filters)
|
|
9
|
-
* - Defines types for retrieving filter functions from built-in filter collections
|
|
3
|
+
* A filter as the grammar reads it: name and arguments only. The filter function is resolved
|
|
4
|
+
* later by the engine (the parser never looks names up, so unknown names pass here).
|
|
10
5
|
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
6
|
+
* Field names are the ones of `@wcstack/state`'s `IParsedFilter`:
|
|
7
|
+
* - `filterName` — the name as written (no alias resolution).
|
|
8
|
+
* - `args` — the raw argument texts, quotes removed (format filters read these).
|
|
9
|
+
* - `literals` — the typed value of each argument (requirement B9): unquoted `true` / `false` /
|
|
10
|
+
* `null` / numbers are typed, everything else (and every quoted argument) is the string.
|
|
11
|
+
* Always the same length and order as `args`.
|
|
12
|
+
*/
|
|
13
|
+
interface ParsedFilter {
|
|
14
|
+
filterName: string;
|
|
15
|
+
args: string[];
|
|
16
|
+
literals: unknown[];
|
|
17
|
+
}
|
|
18
|
+
/** Parse result of one binding (DOM independent). */
|
|
19
|
+
interface ParsedBinding {
|
|
20
|
+
propName: string;
|
|
21
|
+
propSegments: string[];
|
|
22
|
+
propModifiers: string[];
|
|
23
|
+
statePathName: string;
|
|
24
|
+
inFilters: ParsedFilter[];
|
|
25
|
+
outFilters: ParsedFilter[];
|
|
26
|
+
bindingType: BindingType;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `data-wcs` の値をバインディングごとに区切る(前後の空白は残す — tooling が位置を数えられるように)。
|
|
31
|
+
* 引用符の中の `;` は区切りではない(要件 B1 — `join(';')`)。
|
|
14
32
|
*/
|
|
15
|
-
|
|
33
|
+
declare function splitBindTexts(bindText: string): string[];
|
|
16
34
|
|
|
17
35
|
interface IPathInfo {
|
|
18
36
|
readonly id: number;
|
|
@@ -39,106 +57,34 @@ interface IPathInfo {
|
|
|
39
57
|
readonly lastWildcardInfo: IPathInfo | null;
|
|
40
58
|
readonly wildcardCount: number;
|
|
41
59
|
}
|
|
60
|
+
declare function getPathInfo(path: string): IPathInfo;
|
|
42
61
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* 文法の段が読むフィルタ(名前と引数だけ。要件 D16)。実関数は束縛計画の段で
|
|
46
|
-
* 登録簿から解決される(`core/filterRegistry.ts`)ので、パース結果はここで止まる。
|
|
47
|
-
*/
|
|
48
|
-
interface IParsedFilter {
|
|
49
|
-
readonly filterName: string;
|
|
50
|
-
readonly args: string[];
|
|
51
|
-
/**
|
|
52
|
-
* 引数の型付きの値(要件 B9)。引用符の無い `true` / `false` / `null` / 数値は型付き、引用符付きは
|
|
53
|
-
* 文字列のまま。`args` は引用符を外した原文(書式フィルタはこちらを読む)。組み立てた側が省略したら
|
|
54
|
-
* `args` と同じ扱い。
|
|
55
|
-
*/
|
|
56
|
-
readonly literals?: readonly unknown[];
|
|
57
|
-
}
|
|
58
|
-
/** 束縛計画の段で実関数まで解決したフィルタ */
|
|
59
|
-
interface IFilterInfo extends IParsedFilter {
|
|
60
|
-
readonly filterFn: FilterFn;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* バインディング式のパース結果(DOM 非依存の部分)。`@wcstack/state/parser` の
|
|
64
|
-
* ParseBindTextResult がこれをそのまま公開するため、Node 等の DOM lib 型を
|
|
65
|
-
* ここに足してはならない(足すなら IBindingInfo 側へ)。
|
|
66
|
-
*/
|
|
67
|
-
interface IParsedBinding {
|
|
68
|
-
readonly propName: string;
|
|
69
|
-
readonly propSegments: string[];
|
|
70
|
-
readonly propModifiers: string[];
|
|
71
|
-
readonly statePathName: string;
|
|
72
|
-
readonly statePathInfo: IPathInfo;
|
|
73
|
-
readonly inFilters: IParsedFilter[];
|
|
74
|
-
readonly outFilters: IParsedFilter[];
|
|
75
|
-
readonly bindingType: BindingType;
|
|
76
|
-
readonly uuid?: string | null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
type ParseBindTextResult = IParsedBinding;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* `data-wcs` の値をバインディングごとに区切る(前後の空白は残す — tooling が位置を数えられるように)。
|
|
83
|
-
* 引用符の中の `;` は区切りではない(要件 B1 — `join(';')`)。ランタイムと tooling(`@wcstack/state/parser`)で共有する
|
|
84
|
-
*/
|
|
85
|
-
declare function splitBindTexts(bindText: string): string[];
|
|
86
|
-
declare function parseBindTextsForElement(bindText: string): ParseBindTextResult[];
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* `text` の中で、引用符(`'` / `"`)の外にある最初の `char` の位置。無ければ -1(要件 B1)。
|
|
90
|
-
* 閉じていない引用符はそのまま末尾まで続く扱い — 不正な引用符はフィルタ引数の段で名指しで落ちる。
|
|
91
|
-
*/
|
|
92
|
-
declare function indexOfOutsideQuotes(text: string, char: string): number;
|
|
62
|
+
/** `text` の中で、引用符(`'` / `"`)の外にある最初の `char` の位置。無ければ -1(要件 B1)。 */
|
|
63
|
+
declare const indexOfOutsideQuotes: (text: string, char: string) => number;
|
|
93
64
|
/**
|
|
94
65
|
* `separator` で区切る。ただし引用符の中は区切らない(要件 B1): `join(';')` や `join('|')` の
|
|
95
66
|
* 区切り文字は引数であって、バインディングやフィルタの区切りではない。
|
|
96
67
|
*/
|
|
97
68
|
declare function splitOutsideQuotes(text: string, separator: string): string[];
|
|
98
69
|
|
|
70
|
+
/** One parsed binding: the parser's fields and its path's info. */
|
|
71
|
+
interface ParseBindTextResult extends ParsedBinding {
|
|
72
|
+
readonly statePathInfo: IPathInfo;
|
|
73
|
+
/** 3.x gave structural bindings an id here; the new engine does not use one. */
|
|
74
|
+
readonly uuid?: string | null;
|
|
75
|
+
}
|
|
76
|
+
/** A filter resolved to its function (what the engine plans; the parser gives name and arguments). */
|
|
77
|
+
interface IFilterInfo extends ParsedFilter {
|
|
78
|
+
readonly filterFn: (value: unknown) => unknown;
|
|
79
|
+
}
|
|
80
|
+
/** A `data-wcs` attribute's text → its bindings. */
|
|
81
|
+
declare function parseBindTextsForElement(bindText: string): ParseBindTextResult[];
|
|
82
|
+
/** A `{{ … }}` expression → its (text) binding. */
|
|
99
83
|
declare function parseBindTextForEmbeddedNode(bindText: string): ParseBindTextResult;
|
|
100
|
-
|
|
101
|
-
declare function getPathInfo(path: string): IPathInfo;
|
|
102
|
-
|
|
103
84
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* `./manifest` と同じ「実装が唯一の正本」パターン(docs/static-wiring-dx-design.md D2)。
|
|
108
|
-
* vscode-wcs の正規表現パーサ・devtools の declaredScan 簡易パーサという複製実装を
|
|
109
|
-
* 段階的にこの正本へ寄せるための土台。
|
|
110
|
-
*
|
|
111
|
-
* 契約:
|
|
112
|
-
* - DOM 非依存・純関数(bindText 文字列 → ParseBindTextResult[])。Node でそのまま動く
|
|
113
|
-
* (__tests__/parser.test.ts が node 環境で検証する)。
|
|
114
|
-
* - **位置情報は持たず、不正構文は raiseError で throw する**。エラー耐性と診断 range の
|
|
115
|
-
* 生成は消費側(vscode-wcs の positional ラッパー)の責務(同 D3)— ランタイムの
|
|
116
|
-
* サイズと責務をここで増やさない。
|
|
117
|
-
* - `getPathInfo` はパス文字列の解析済みビュー(セグメント・ワイルドカード位置・親パス
|
|
118
|
-
* チェーン)を返す純関数。静的依存グラフの親チェーン展開はこの情報から機械的に再現できる。
|
|
119
|
-
* 同一パス → 同一インスタンスの保証は**このエントリのモジュールインスタンス内**でのみ
|
|
120
|
-
* 成立する(`.` エントリは別バンドル=別キャッシュ。ランタイムの PathInfo と identity
|
|
121
|
-
* 比較してはならない)。キャッシュは無制限(evict なし)— 言語サーバー等の長時間
|
|
122
|
-
* プロセスではメモリが増え続ける点に留意(断ち方は `clearPathInfoCacheForTooling`)。
|
|
123
|
-
* **増え方はパス種数への単調比例ではない**: `PathInfo` は自分の全ての接頭辞を intern
|
|
124
|
-
* するので、1 本のパスが持ち込む量はその深さの 2 乗に比例する。深さは
|
|
125
|
-
* `MAX_PATH_SEGMENTS` で頭打ちになる(超えたパスは `[wcs/binding-syntax]` で拒否)。
|
|
126
|
-
* - `ParseBindTextResult.uuid` はランタイム内部(構造テンプレートのハイドレーション台帳)
|
|
127
|
-
* 用のフィールドで、このパーサの戻り値では常に undefined。
|
|
128
|
-
*
|
|
129
|
-
* 公開面は意図的に最小(公開=恒久契約)。`expandSpread` は live Element と
|
|
130
|
-
* CustomElementRegistry を要するためここには含めない — ブラウザ内の消費者
|
|
131
|
-
* (devtools の declared 正本化)は state 自身が pull API で答える。
|
|
132
|
-
*/
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* このエントリの内部キャッシュ(PathInfo intern・propPart/statePart のパース結果・フィルタ関数クロージャ)を全て捨てる。
|
|
136
|
-
*
|
|
137
|
-
* 言語サーバー等の**長時間プロセス専用**。編集中の中間パス(`user.n` 等)が
|
|
138
|
-
* 無制限キャッシュに恒久 intern されてメモリが単調増加するため、ドキュメント
|
|
139
|
-
* クローズ等の区切りで呼ぶ。クリア後の getPathInfo は同一パスに**新しい**
|
|
140
|
-
* インスタンスを返す — 「同一パス → 同一参照」の保証はクリアを跨がない。
|
|
141
|
-
* ランタイム(`.` エントリ)にはこの API は無く、呼ばれることもない。
|
|
85
|
+
* Drops this entry's caches (interned path infos, parsed filters). For long-running processes
|
|
86
|
+
* (a language server): half-typed paths would otherwise stay interned. After a clear,
|
|
87
|
+
* getPathInfo returns a new instance for the same path.
|
|
142
88
|
*/
|
|
143
89
|
declare function clearParserCaches(): void;
|
|
144
90
|
|