@wcstack/router 3.5.0 → 3.5.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 +1 -1
- package/README.md +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
</wcs-route>
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
構造のテンプレート(`for:` / `if:`)は、上の `<ul>` のようにルート本文の要素の中に置きます。`<wcs-route>` の直下に置いたものが描かれるのは、state のページの最初の走査のときだけです(着地のルートで、router がスタンプした後に state が読み込みを終えたとき)。ナビゲーションで入ったルートは内容を state に渡し、@wcstack/state 3.x
|
|
132
|
+
構造のテンプレート(`for:` / `if:`)は、上の `<ul>` のようにルート本文の要素の中に置きます。`<wcs-route>` の直下に置いたものが描かれるのは、state のページの最初の走査のときだけです(着地のルートで、router がスタンプした後に state が読み込みを終えたとき)。ナビゲーションで入ったルートは内容を state に渡し、@wcstack/state 3.x は、渡された構造のテンプレートそのものは描かず、束縛の適用の失敗として報告します。上の `<article>` のように本文を 1 つの要素で包めば避けられます。`data-wcs` を自分に持つ直下の要素を、テンプレートを含む要素より前に置く形(`<wcs-route>` の直下の `<h2 data-wcs="…">` の後ろに `<ul>` が続く形)は、@wcstack/state 3.5.1 以降では動きます。渡された要素だけを束ねるためです。3.5.0 以前はそうした要素を親から走査して束ねるので、まだ準備のできていない後ろのテンプレートに届き、ナビゲーションのときに同じ失敗を報告します。これらの版では、その本文も包んでください。
|
|
133
133
|
|
|
134
134
|
router は、スタンプしたルート本文の終わりにコメントの印 `<!--@@wcs-route-end:<path>-->`(SSR と同じ印)を置き、退場のときにルートの placeholder からこの印までをまとめて持ち出し、次の入場で戻します。ルート自身のノードのほか、その間に後から描かれたもの(着地のルートで直下のテンプレートが描いた行など)も含みます。作者のコードがこの 2 つのコメントの間に差し込んだノードはルートと一緒に出入りします。ルート本文から外へ移したノード(`<body>` へ移したダイアログなど)は、これまでどおり退場のときにルート本文へ戻して持ちます。戻すのは持ち出したものなので、作者のコードがルート本文から取り除いた直下のノード(閉じたお知らせなど)は、次の入場でも戻りません。印はコメントなので、`wcs-outlet:empty` には影響しません。
|
|
135
135
|
|
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ Two shapes work since 1.32, and they are not interchangeable. Pick per page, not
|
|
|
129
129
|
</wcs-route>
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
Put a structural template (`for:` / `if:`) inside an element of the route body, as the `<ul>` above does. One directly under `<wcs-route>` is rendered only by state's first scan of the page — the landing route, when state finishes loading after the router stamped it. A route entered by navigation hands its content to state, and @wcstack/state 3.x does not render a structural template handed over itself: it reports that the binding failed to apply.
|
|
132
|
+
Put a structural template (`for:` / `if:`) inside an element of the route body, as the `<ul>` above does. One directly under `<wcs-route>` is rendered only by state's first scan of the page — the landing route, when state finishes loading after the router stamped it. A route entered by navigation hands its content to state, and @wcstack/state 3.x does not render a structural template handed over itself: it reports that the binding failed to apply. Wrapping the body in one element, as the `<article>` above does, avoids that. A top-level element that carries `data-wcs` itself may come before the element that holds the template (an `<h2 data-wcs="…">` directly under `<wcs-route>`, followed by the `<ul>`) with @wcstack/state 3.5.1 and later, which bind only the element handed over. 3.5.0 and earlier bind such an element by walking from its parent, which reaches the later template before it is set up and reports the same failure on navigation; with those versions, wrap that body too.
|
|
133
133
|
|
|
134
134
|
The router marks where a stamped route body ends with a comment, `<!--@@wcs-route-end:<path>-->` (the same marker SSR uses), and on exit takes everything from the route's placeholder up to it along — the route's own nodes and whatever was rendered among them since, such as the rows a top-level template rendered on the landing route — and puts it all back on the next entry. A node your own code inserts between those two comments goes and comes back with the route; one you moved out of the route body (a dialog moved to `<body>`) is taken back into it on exit, as before. What comes back is what was taken out: a top-level node your code removed from the route body (a dismissed notice) stays removed on the next entry. The marker is a comment, so `wcs-outlet:empty` is unaffected.
|
|
135
135
|
|
package/dist/index.esm.js
CHANGED
package/package.json
CHANGED