@wcstack/state 4.0.0-rc.3 → 4.0.0-rc.4
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 +16 -16
- package/README.md +16 -16
- package/dist/auto.min.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/manifest.d.ts +2 -2
- package/dist/manifest.esm.js +69 -78
- package/dist/parser.esm.js +40 -26
- package/dist/split/auto.js +1 -1
- package/dist/split/chunks/chunk-372Y2FIC.js +1 -0
- package/dist/split/chunks/{chunk-I2V4DGEI.js → chunk-5D34CGCF.js} +1 -1
- package/dist/split/chunks/{chunk-YZ4LWPXN.js → chunk-5LIOXC7W.js} +1 -1
- package/dist/split/chunks/chunk-6GES2BK3.js +1 -0
- package/dist/split/chunks/chunk-7644KQ3T.js +1 -0
- package/dist/split/chunks/{chunk-Z3EEGBYA.js → chunk-G2ZO6SXV.js} +1 -1
- package/dist/split/chunks/chunk-HSOCDTWX.js +1 -0
- package/dist/split/chunks/chunk-ROX5KEJX.js +1 -0
- package/dist/split/chunks/chunk-SEPY6OHJ.js +1 -0
- package/dist/split/chunks/chunk-Z7B3ZZE4.js +1 -0
- package/dist/split/chunks/chunk-ZOINIOIM.js +1 -0
- package/dist/split/core.js +1 -1
- package/dist/split/features/devtools.js +1 -1
- package/dist/split/features/diagnostics.d.ts +3 -3
- package/dist/split/features/diagnostics.js +1 -1
- package/dist/split/features/formats.d.ts +4 -1
- package/dist/split/features/formats.js +1 -1
- package/dist/split/features/list-keys.js +1 -1
- package/dist/split/features/recursion.js +1 -1
- package/dist/split/features/scopes.js +1 -1
- package/dist/split/features/ssr.js +1 -1
- package/dist/split/features/temporal.js +1 -1
- package/dist/wcs-manifest.json +15 -15
- package/package.json +1 -1
- package/dist/split/chunks/chunk-2PWEFKRB.js +0 -1
- package/dist/split/chunks/chunk-5PWMZ75N.js +0 -1
- package/dist/split/chunks/chunk-FED2DM4X.js +0 -1
- package/dist/split/chunks/chunk-HYEQWIFX.js +0 -1
- package/dist/split/chunks/chunk-NPPWJBGJ.js +0 -1
- package/dist/split/chunks/chunk-WPSUT5QQ.js +0 -1
- package/dist/split/chunks/chunk-YPD4YBJO.js +0 -1
- package/dist/split/chunks/chunk-YZUTVCIH.js +0 -1
package/README.ja.md
CHANGED
|
@@ -191,9 +191,9 @@
|
|
|
191
191
|
<script type="importmap">
|
|
192
192
|
{
|
|
193
193
|
"imports": {
|
|
194
|
-
"@wcstack/state/core": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
195
|
-
"@wcstack/state/features/temporal": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
196
|
-
"@wcstack/state/features/scopes": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
194
|
+
"@wcstack/state/core": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/core.js",
|
|
195
|
+
"@wcstack/state/features/temporal": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/features/temporal.js",
|
|
196
|
+
"@wcstack/state/features/scopes": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/features/scopes.js"
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
</script>
|
|
@@ -226,21 +226,21 @@
|
|
|
226
226
|
|
|
227
227
|
| エントリ | 足されるもの |
|
|
228
228
|
|---|---|
|
|
229
|
-
| `@wcstack/state/core` | バインディングの本体: `data-wcs`・`{{ }}` とコメントバインディング・`for` / `if`・パス getter・イベント・`$command` / `$on
|
|
229
|
+
| `@wcstack/state/core` | バインディングの本体: `data-wcs`・`{{ }}` とコメントバインディング・`for` / `if`・パス getter・イベント・`$command` / `$on`・条件の 10 個のフィルタ(`eq` `ne` `not` `lt` `le` `gt` `ge` `truthy` `falsy` `boolean`)・`bootstrapState`・`installFeatures` |
|
|
230
230
|
| `@wcstack/state/features/temporal` | `$watch`・`$stream` |
|
|
231
231
|
| `@wcstack/state/features/list-keys` | `$listKeys` |
|
|
232
232
|
| `@wcstack/state/features/scopes` | `bind-component`・`mount=` のボリューム・オーバーレイの公開 getter・DCC(`data-wc-definition`) |
|
|
233
233
|
| `@wcstack/state/features/recursion` | `$recursion` と `**` パス |
|
|
234
234
|
| `@wcstack/state/features/ssr` | `enable-ssr`: サーバー描画とハイドレーション |
|
|
235
|
-
| `@wcstack/state/features/formats` |
|
|
235
|
+
| `@wcstack/state/features/formats` | 残りの 37 個のフィルタ: 算術・型変換・デフォルト(`add`・`int`・`coalesce` …)と書式(`upper`・`date`・`round`・`truncate` …) |
|
|
236
236
|
| `@wcstack/state/features/devtools` | DevTools Hook Protocol への source 登録 |
|
|
237
|
-
| `@wcstack/state/features/diagnostics` | エラーメッセージの文章(did-you-mean と lint への案内を含む)と、開発時の警告(束縛や `$watch` のパスが解決しない、`wcs/default-getter-mismatch
|
|
237
|
+
| `@wcstack/state/features/diagnostics` | エラーメッセージの文章(did-you-mean と lint への案内を含む)と、開発時の警告(束縛や `$watch` のパスが解決しない、`wcs/default-getter-mismatch`)。入れなければ、メッセージは番号と値だけになり([エラーメッセージ](#エラーメッセージと番号))、これらの警告は出ず、4.0 で外した 3.x の名前(`$scan`・`$streams`・`$updatedCallback`・`$trackDependency`・`$untrackDependency`)も見つけない |
|
|
238
238
|
| `@wcstack/state/define` | `defineState` と型だけ — ランタイムは 0 |
|
|
239
239
|
|
|
240
240
|
アドオンが入っていない宣言は黙って無視されません。state の読み込み時に
|
|
241
241
|
`[wcs/feature-not-installed] $watch needs the add-on @wcstack/state/features/temporal` を throw し
|
|
242
242
|
(`mount=`・`bind-component`・`data-wc-definition` は同じ形で `scopes` を、`enable-ssr` は `ssr` を
|
|
243
|
-
名指します)、`formats`
|
|
243
|
+
名指します)、`formats` なしの `formats` のフィルタは束縛計画の段で、アドオン名を挙げた `[wcs/filter-unknown]`
|
|
244
244
|
を throw します。install は冪等で — 2 回目の install は読み飛ばされます — どのエントリも core の
|
|
245
245
|
チャンクを 1 つだけ共有します。アドオンがエンジンの 2 つ目のコピーを抱えることも、**別のアドオン**の
|
|
246
246
|
コピーを抱えることもありません(アドオンをまたぐ呼び出しは、持ち主のアドオンが install 時に埋める
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
ページが名指したアドオンを、同じビルドから読み込みます。
|
|
253
253
|
|
|
254
254
|
```html
|
|
255
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
255
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/auto.js"></script>
|
|
256
256
|
<wcs-state features="scopes diagnostics">
|
|
257
257
|
<script type="module">
|
|
258
258
|
export default {
|
|
@@ -1671,7 +1671,7 @@ export default {
|
|
|
1671
1671
|
|
|
1672
1672
|
## フィルタ
|
|
1673
1673
|
|
|
1674
|
-
47 種類の組み込みフィルタが入力(DOM → 状態)と出力(状態 → DOM)の両方向で利用できます: core
|
|
1674
|
+
47 種類の組み込みフィルタが入力(DOM → 状態)と出力(状態 → DOM)の両方向で利用できます: core に条件の 10 個のフィルタ(`eq`・`ne`・`not`・`lt`・`le`・`gt`・`ge`・`truthy`・`falsy`・`boolean`)、`formats` アドオンに残りの 37 個(算術・数値フォーマット・文字列・型変換・日付 / 時刻・デフォルト)があり、全部入りのエントリには両方が含まれます。`formats` なしの `/core` で `formats` のフィルタを使うと、束縛計画の段でアドオン名を挙げて失敗します。
|
|
1675
1675
|
|
|
1676
1676
|
3.x が 3.2 の改名の別名として残していた名前(`inc`・`dec`・`fix`・`uc`・`lc`・`cap`・`rep`・`rev`・`pad`・`null`)と `substr` フィルタは存在しません: 未知の名前と同じく失敗し、メッセージが代わりに書くものを示します(`"uc" was renamed "upper" in 3.2 and removed in 4.0 — write "upper".`。`substr(start, length)` は `slice(start, start + length)`)。
|
|
1677
1677
|
|
|
@@ -2353,7 +2353,7 @@ event token は command token と同じ `Token` pub/sub プリミティブを共
|
|
|
2353
2353
|
|
|
2354
2354
|
## Stream(`$stream`)
|
|
2355
2355
|
|
|
2356
|
-
command token / event token が運ぶのは離散的なやり取りです。**`$stream`** は残る形 —— 連続的なフローをカバーします。非同期 producer(async iterable / async generator / `ReadableStream`)を宣言すると、フレームワークがそれを **fold して単一の reactive プロパティに畳み込みます** —— 各チャンクは通常のパス代入を通るため、バインディング・パス getter・`$renderedCallback` は自分で値を代入した場合とまったく同じように反応します。`args` 関数が読んだ state パスが変化すると、実行中の producer は abort され、新しい引数で source が張り直されます(switchMap 型の依存駆動 restart)。stream は `$connectedCallback` 完了後に eager に起動し、要素の disconnect で abort されます。`$stream` は `temporal` アドオンです(全部入りのエントリに含まれる)。3.x の名前 `$streams`
|
|
2356
|
+
command token / event token が運ぶのは離散的なやり取りです。**`$stream`** は残る形 —— 連続的なフローをカバーします。非同期 producer(async iterable / async generator / `ReadableStream`)を宣言すると、フレームワークがそれを **fold して単一の reactive プロパティに畳み込みます** —— 各チャンクは通常のパス代入を通るため、バインディング・パス getter・`$renderedCallback` は自分で値を代入した場合とまったく同じように反応します。`args` 関数が読んだ state パスが変化すると、実行中の producer は abort され、新しい引数で source が張り直されます(switchMap 型の依存駆動 restart)。stream は `$connectedCallback` 完了後に eager に起動し、要素の disconnect で abort されます。`$stream` は `temporal` アドオンです(全部入りのエントリに含まれる)。3.x の名前 `$streams` は、`diagnostics` アドオンが入っていれば(`@wcstack/state`・`/auto`)`[wcs/declaration-alias] $streams was removed: write $stream.`(`#1601`)を throw します。入っていなければ、その宣言は無視されます。
|
|
2357
2357
|
|
|
2358
2358
|
`$renderedCallback` は引き続き binding 駆動です。stream 宣言だけでは headless な購読にならず、その value/status/error の live DOM binding が実際に適用されたときだけ callback の path に現れます。描画せずに stream の値へ反応したい場合は、そのパスに [`$watch`](#watchwatch) を宣言してください。観測契約は [stream リファレンス](docs/streams.md) を参照してください。
|
|
2359
2359
|
|
|
@@ -2754,7 +2754,7 @@ export default {
|
|
|
2754
2754
|
|
|
2755
2755
|
状態オブジェクトに `$connectedCallback` / `$disconnectedCallback` / `$renderedCallback` / `$errorCallback` を定義すると、初期化・クリーンアップ・更新時・バインディング失敗時のフックとして利用できます。
|
|
2756
2756
|
|
|
2757
|
-
> `$renderedCallback` が受けるのは**適用されたバインディング**の更新で、state の更新全体ではありません(それには `$watch`)。3.x の名前 `$updatedCallback`
|
|
2757
|
+
> `$renderedCallback` が受けるのは**適用されたバインディング**の更新で、state の更新全体ではありません(それには `$watch`)。3.x の名前 `$updatedCallback` は、`diagnostics` アドオンが入っていれば(`@wcstack/state`・`/auto`)`[wcs/declaration-alias] $updatedCallback was removed: write $renderedCallback.`(`#1601`)を throw します。入っていなければ、その宣言は無視されます。
|
|
2758
2758
|
|
|
2759
2759
|
```html
|
|
2760
2760
|
<wcs-state>
|
|
@@ -2836,16 +2836,16 @@ li {
|
|
|
2836
2836
|
|
|
2837
2837
|
### エラーメッセージと番号
|
|
2838
2838
|
|
|
2839
|
-
メッセージはすべて `[@wcstack/state]`
|
|
2839
|
+
メッセージはすべて `[@wcstack/state]` で始まります。ほとんどのメッセージは番号(`#501`)を持ち、`@wcstack/lint` と VS Code 拡張も検査する事柄についてのメッセージは同じ診断 code(`[wcs/filter-unknown]`)を持ちます。番号の百の位がその code を表します —— 1xx `binding-syntax`、2xx `template-syntax`、3xx `binding-path-missing`、4xx `binding-type-expectation`、5xx `filter-unknown`、6xx `filter-arity`、7xx `getter-cycle`、8xx `getter-depth-exceeded`、9xx `index-arity`、10xx `index-param-range`、11xx `recursion-unsupported`、12xx `token-misconfigured`、13xx `token-undeclared`、14xx `wildcard-rank`、15xx `spread-no-bindable`、16xx `declaration-alias`、17xx `name-alias`。1〜99 は code を持ちません。番号は追加されるだけなので、番号の意味はバージョンをまたいで変わりません。
|
|
2840
2840
|
|
|
2841
|
-
|
|
2841
|
+
番号付きメッセージの code と文章 —— いちばん近い名前(lint と同じ規則による did-you-mean)、直し方、そして lint が検出できる場合は lint への案内 —— は、`@wcstack/state` と `/auto` に含まれる `diagnostics` アドオンが出します。それを入れていない `/core` のページでは、メッセージは番号と表示するはずだった値だけになります:
|
|
2842
2842
|
|
|
2843
2843
|
```
|
|
2844
2844
|
[@wcstack/state] [wcs/filter-unknown] filter not found: uc. "uc" was renamed "upper" in 3.2 and removed in 4.0 — write "upper". Validate statically: npx @wcstack/lint <file>.
|
|
2845
|
-
[@wcstack/state]
|
|
2845
|
+
[@wcstack/state] #501 "uc"
|
|
2846
2846
|
```
|
|
2847
2847
|
|
|
2848
|
-
1 行目が `@wcstack/state` と `/auto` の出力、2 行目が `features/diagnostics` なしの `/core` の出力です。`/core` で開発するときは `diagnostics`
|
|
2848
|
+
1 行目が `@wcstack/state` と `/auto` の出力、2 行目が `features/diagnostics` なしの `/core` の出力です。`/core` で開発するときは `diagnostics` を入れてください: 4.0 で外した 3.x の名前(#1・#1601・#1701)を見つけるのもこのアドオンで、入れていないページはそれらを無視します(その名前の宣言は何もせず、読むと `undefined`)。アドオンなしのページが意図して突き当たる障壁(`[wcs/feature-not-installed]`、`formats` なしの `formats` のフィルタ)は、core の中でも完全な文章です。
|
|
2849
2849
|
|
|
2850
2850
|
<details>
|
|
2851
2851
|
<summary>番号付きメッセージ</summary>
|
|
@@ -3029,7 +3029,7 @@ this.$getAll("matrix.*.*", [row]);
|
|
|
3029
3029
|
初期化を失敗させるもの:
|
|
3030
3030
|
|
|
3031
3031
|
- 読めないソース([状態の初期化](#状態の初期化))。
|
|
3032
|
-
- 不正な宣言: 削除された名前(`$scan`・`$streams`・`$updatedCallback
|
|
3032
|
+
- 不正な宣言: 削除された名前(`$scan`・`$streams`・`$updatedCallback`。`diagnostics` アドオンがあるとき)、形の誤った `$behavior` / `$features` / `$commandTokens` / `$eventTokens` / `$on`、アドオンが入っていない宣言(`[wcs/feature-not-installed]`)。
|
|
3033
3033
|
- ページのバインド中に見つかったマークアップの誤り: 構文エラー、未知のフィルタや誤った引数の個数、wildcard-rank のエラー、フィルタ付きの `for:`、テンプレートの中の `outerHTML:`、クラスが定義済みの要素での wc-bindable の設定ミス。走査はそのエラーで止まります: 文書順でそれより前はバインドされ、後はバインドされません。デプロイの前に `npx @wcstack/lint` を実行してください。
|
|
3034
3034
|
- 別の `<wcs-state>` がすでにバインドしているルートの上の、2 つ目のルート `<wcs-state>`(`#47`)。state ツリーはルートごとに 1 本です。部分木は `mount=` で接ぎ木してください。
|
|
3035
3035
|
|
package/README.md
CHANGED
|
@@ -192,9 +192,9 @@ leaves features out, it can compose them instead:
|
|
|
192
192
|
<script type="importmap">
|
|
193
193
|
{
|
|
194
194
|
"imports": {
|
|
195
|
-
"@wcstack/state/core": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
196
|
-
"@wcstack/state/features/temporal": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
197
|
-
"@wcstack/state/features/scopes": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
195
|
+
"@wcstack/state/core": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/core.js",
|
|
196
|
+
"@wcstack/state/features/temporal": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/features/temporal.js",
|
|
197
|
+
"@wcstack/state/features/scopes": "https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/features/scopes.js"
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
</script>
|
|
@@ -227,21 +227,21 @@ The file names under `dist/split/chunks/` carry a content hash: if you list chun
|
|
|
227
227
|
|
|
228
228
|
| Entry | What it adds |
|
|
229
229
|
|---|---|
|
|
230
|
-
| `@wcstack/state/core` | The binding engine: `data-wcs`, `{{ }}` and comment bindings, `for` / `if`, path getters, events, `$command` / `$on`, the
|
|
230
|
+
| `@wcstack/state/core` | The binding engine: `data-wcs`, `{{ }}` and comment bindings, `for` / `if`, path getters, events, `$command` / `$on`, the 10 condition filters (`eq` `ne` `not` `lt` `le` `gt` `ge` `truthy` `falsy` `boolean`), `bootstrapState`, `installFeatures` |
|
|
231
231
|
| `@wcstack/state/features/temporal` | `$watch`, `$stream` |
|
|
232
232
|
| `@wcstack/state/features/list-keys` | `$listKeys` |
|
|
233
233
|
| `@wcstack/state/features/scopes` | `bind-component`, `mount=` volumes, overlay exports, DCC (`data-wc-definition`) |
|
|
234
234
|
| `@wcstack/state/features/recursion` | `$recursion` and `**` paths |
|
|
235
235
|
| `@wcstack/state/features/ssr` | `enable-ssr`: server rendering and hydration |
|
|
236
|
-
| `@wcstack/state/features/formats` | The
|
|
236
|
+
| `@wcstack/state/features/formats` | The other 37 filters: arithmetic, conversion and defaults (`add`, `int`, `coalesce`, …) and formatting (`upper`, `date`, `round`, `truncate`, …) |
|
|
237
237
|
| `@wcstack/state/features/devtools` | The DevTools hook protocol source |
|
|
238
|
-
| `@wcstack/state/features/diagnostics` | The sentences of error messages, with the did-you-mean and the pointer to lint, and the development-time warnings (a bound or `$watch` path that does not resolve, `wcs/default-getter-mismatch`). Without it a message is its
|
|
238
|
+
| `@wcstack/state/features/diagnostics` | The sentences of error messages, with the did-you-mean and the pointer to lint, and the development-time warnings (a bound or `$watch` path that does not resolve, `wcs/default-getter-mismatch`). Without it a message is its number and its values ([Error messages](#error-messages-and-numbers)), those warnings are not printed, and the 3.x names 4.0 removed (`$scan`, `$streams`, `$updatedCallback`, `$trackDependency`, `$untrackDependency`) are not detected |
|
|
239
239
|
| `@wcstack/state/define` | `defineState` and the types only — no runtime at all |
|
|
240
240
|
|
|
241
241
|
A declaration whose add-on is missing does not fail quietly: it throws
|
|
242
242
|
`[wcs/feature-not-installed] $watch needs the add-on @wcstack/state/features/temporal` when the state
|
|
243
243
|
is loaded (`mount=`, `bind-component` and `data-wc-definition` name `scopes` the same way, and
|
|
244
|
-
`enable-ssr` names `ssr`), and a
|
|
244
|
+
`enable-ssr` names `ssr`), and a filter of `formats` without it throws `[wcs/filter-unknown]`
|
|
245
245
|
naming the add-on when the bindings are planned. Installing is idempotent — an add-on installed
|
|
246
246
|
again is skipped — and every entry shares one core chunk: an add-on never carries a second copy of
|
|
247
247
|
the engine, and never a copy of another add-on either (a call across that seam goes through a
|
|
@@ -253,7 +253,7 @@ receptacle the owning add-on fills on install).
|
|
|
253
253
|
core, and the add-ons the page names from the same build.
|
|
254
254
|
|
|
255
255
|
```html
|
|
256
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.
|
|
256
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@wcstack/state@4.0.0-rc.4/dist/split/auto.js"></script>
|
|
257
257
|
<wcs-state features="scopes diagnostics">
|
|
258
258
|
<script type="module">
|
|
259
259
|
export default {
|
|
@@ -1677,7 +1677,7 @@ Handlers run where the DOM puts them. An outer `#direct` handler runs **before**
|
|
|
1677
1677
|
|
|
1678
1678
|
## Filters
|
|
1679
1679
|
|
|
1680
|
-
47 built-in filters are available for both input (DOM → state) and output (state → DOM) directions:
|
|
1680
|
+
47 built-in filters are available for both input (DOM → state) and output (state → DOM) directions: the 10 condition filters in the core (`eq`, `ne`, `not`, `lt`, `le`, `gt`, `ge`, `truthy`, `falsy`, `boolean`) and the other 37 in the `formats` add-on (arithmetic, number formatting, string, type conversion, date / time, defaults), which the full entries include. On `/core` without `formats`, a filter of `formats` fails when the bindings are planned, naming the add-on.
|
|
1681
1681
|
|
|
1682
1682
|
The names 3.x kept as aliases of the 3.2 renames (`inc`, `dec`, `fix`, `uc`, `lc`, `cap`, `rep`, `rev`, `pad`, `null`) and the `substr` filter do not exist: they fail like any unknown name, and the message names what to write instead (`"uc" was renamed "upper" in 3.2 and removed in 4.0 — write "upper".`; `substr(start, length)` is `slice(start, start + length)`).
|
|
1683
1683
|
|
|
@@ -2363,7 +2363,7 @@ Two rules cut most of the confusion:
|
|
|
2363
2363
|
|
|
2364
2364
|
## Streams (`$stream`)
|
|
2365
2365
|
|
|
2366
|
-
Command tokens and event tokens carry discrete interactions. **`$stream`** covers the remaining shape: a continuous flow. Declare an async producer (async iterable / async generator / `ReadableStream`) and the framework **folds it into a single reactive property** — each chunk goes through normal path assignment, so bindings, path getters, and `$renderedCallback` react exactly as if you had assigned the value yourself. When a state path read by the `args` function changes, the running producer is aborted and the source is restarted with the new arguments (switchMap-style dependency-driven restart). Streams start eagerly after `$connectedCallback` completes and are aborted when the element disconnects. `$stream` is the `temporal` add-on (in the full entries). The 3.x name `$streams` throws `[wcs/declaration-alias] $streams was removed: write $stream.` (`#1601`).
|
|
2366
|
+
Command tokens and event tokens carry discrete interactions. **`$stream`** covers the remaining shape: a continuous flow. Declare an async producer (async iterable / async generator / `ReadableStream`) and the framework **folds it into a single reactive property** — each chunk goes through normal path assignment, so bindings, path getters, and `$renderedCallback` react exactly as if you had assigned the value yourself. When a state path read by the `args` function changes, the running producer is aborted and the source is restarted with the new arguments (switchMap-style dependency-driven restart). Streams start eagerly after `$connectedCallback` completes and are aborted when the element disconnects. `$stream` is the `temporal` add-on (in the full entries). The 3.x name `$streams` throws `[wcs/declaration-alias] $streams was removed: write $stream.` (`#1601`) where the `diagnostics` add-on is installed (`@wcstack/state`, `/auto`); without it the declaration is ignored.
|
|
2367
2367
|
|
|
2368
2368
|
`$renderedCallback` remains binding-driven: a stream declaration alone is not a headless subscription. Its path appears in the callback only when a live DOM binding for that value/status/error is actually applied. To react to a stream's value without rendering it, declare [`$watch`](#watch-watch) on that path; see the [stream reference](docs/streams.md) for the observation contract.
|
|
2369
2369
|
|
|
@@ -2764,7 +2764,7 @@ All bindings work inside `<svg>` elements. Use `attr.*` for SVG attributes:
|
|
|
2764
2764
|
|
|
2765
2765
|
State objects can define `$connectedCallback`, `$disconnectedCallback`, `$renderedCallback`, and `$errorCallback` for initialization, cleanup, update, and binding-failure handling.
|
|
2766
2766
|
|
|
2767
|
-
> `$renderedCallback` receives updates of **applied bindings**, not every state update (use `$watch` for those). The 3.x name `$updatedCallback` throws `[wcs/declaration-alias] $updatedCallback was removed: write $renderedCallback.` (`#1601`).
|
|
2767
|
+
> `$renderedCallback` receives updates of **applied bindings**, not every state update (use `$watch` for those). The 3.x name `$updatedCallback` throws `[wcs/declaration-alias] $updatedCallback was removed: write $renderedCallback.` (`#1601`) where the `diagnostics` add-on is installed (`@wcstack/state`, `/auto`); without it the declaration is ignored.
|
|
2768
2768
|
|
|
2769
2769
|
```html
|
|
2770
2770
|
<wcs-state>
|
|
@@ -2846,16 +2846,16 @@ Only a batch that actually has bindings to apply is handed to the tag, so a writ
|
|
|
2846
2846
|
|
|
2847
2847
|
### Error messages and numbers
|
|
2848
2848
|
|
|
2849
|
-
Every message starts with `[@wcstack/state]`.
|
|
2849
|
+
Every message starts with `[@wcstack/state]`. Most messages have a number (`#501`), and a message about something `@wcstack/lint` and the VS Code extension also check has the same code (`[wcs/filter-unknown]`). The hundreds of a number name its code — 1xx `binding-syntax`, 2xx `template-syntax`, 3xx `binding-path-missing`, 4xx `binding-type-expectation`, 5xx `filter-unknown`, 6xx `filter-arity`, 7xx `getter-cycle`, 8xx `getter-depth-exceeded`, 9xx `index-arity`, 10xx `index-param-range`, 11xx `recursion-unsupported`, 12xx `token-misconfigured`, 13xx `token-undeclared`, 14xx `wildcard-rank`, 15xx `spread-no-bindable`, 16xx `declaration-alias`, 17xx `name-alias`; 1–99 carry no code. Numbers are only ever added, so a number keeps its meaning across versions.
|
|
2850
2850
|
|
|
2851
|
-
The sentence of a numbered message — with the nearest name (did-you-mean, by the same rule as the lint), how to fix it, and a pointer to the lint where the lint detects the case —
|
|
2851
|
+
The code and the sentence of a numbered message — with the nearest name (did-you-mean, by the same rule as the lint), how to fix it, and a pointer to the lint where the lint detects the case — come from the `diagnostics` add-on, which `@wcstack/state` and `/auto` include. On a `/core` page without it, a message is its number and the values it would show:
|
|
2852
2852
|
|
|
2853
2853
|
```
|
|
2854
2854
|
[@wcstack/state] [wcs/filter-unknown] filter not found: uc. "uc" was renamed "upper" in 3.2 and removed in 4.0 — write "upper". Validate statically: npx @wcstack/lint <file>.
|
|
2855
|
-
[@wcstack/state]
|
|
2855
|
+
[@wcstack/state] #501 "uc"
|
|
2856
2856
|
```
|
|
2857
2857
|
|
|
2858
|
-
The first line is what `@wcstack/state` and `/auto` print, the second what `/core` without `features/diagnostics` prints. Install `diagnostics` while developing on `/core
|
|
2858
|
+
The first line is what `@wcstack/state` and `/auto` print, the second what `/core` without `features/diagnostics` prints. Install `diagnostics` while developing on `/core`: it also detects the 3.x names 4.0 removed (#1, #1601, #1701), which a page without it ignores (a declaration under one does nothing, reading one gives `undefined`). The barriers a page without add-ons meets on purpose (`[wcs/feature-not-installed]`, a filter of `formats` without it) are full sentences in the core.
|
|
2859
2859
|
|
|
2860
2860
|
<details>
|
|
2861
2861
|
<summary>The numbered messages</summary>
|
|
@@ -3039,7 +3039,7 @@ The header (`#49`) names `mount=`, `bind-component=`, `state=` and `src=` when t
|
|
|
3039
3039
|
What fails initialization:
|
|
3040
3040
|
|
|
3041
3041
|
- A source that cannot be read ([State Initialization](#state-initialization)).
|
|
3042
|
-
- An invalid declaration: a removed name (`$scan`, `$streams`, `$updatedCallback`), a `$behavior` / `$features` / `$commandTokens` / `$eventTokens` / `$on` of the wrong shape, a declaration whose add-on is not installed (`[wcs/feature-not-installed]`).
|
|
3042
|
+
- An invalid declaration: a removed name (`$scan`, `$streams`, `$updatedCallback`; with the `diagnostics` add-on), a `$behavior` / `$features` / `$commandTokens` / `$eventTokens` / `$on` of the wrong shape, a declaration whose add-on is not installed (`[wcs/feature-not-installed]`).
|
|
3043
3043
|
- A markup error found while the page is bound: a syntax error, an unknown filter or a wrong argument count, a wildcard-rank error, `for:` with filters, `outerHTML:` in a template, a wc-bindable misconfiguration on an element whose class is already defined. The walk stops at the error: what comes before it in document order is bound, what comes after it is not. Run `npx @wcstack/lint` before you deploy.
|
|
3044
3044
|
- A second root `<wcs-state>` on a root that another one already binds (`#47`). There is one state tree per root; graft a subtree with `mount=`.
|
|
3045
3045
|
|