@wcstack/state 1.22.4 → 1.22.5
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/dist/index.esm.js +34 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5316,11 +5316,19 @@ class Content {
|
|
|
5316
5316
|
}
|
|
5317
5317
|
mountAfter(targetNode) {
|
|
5318
5318
|
const parentNode = targetNode.parentNode;
|
|
5319
|
-
const nextSibling = targetNode.nextSibling;
|
|
5320
5319
|
if (parentNode) {
|
|
5320
|
+
// マウント済み content にも再突入する(if の true→true 再適用・SSR
|
|
5321
|
+
// ハイドレーション産 content 等)。固定の nextSibling へ一括 insertBefore
|
|
5322
|
+
// すると、マウント済みでは nextSibling が自分の先頭ノードを指すため
|
|
5323
|
+
// 先頭ノードが末尾へ回転する。anchor を進めながら位置一致ノードを
|
|
5324
|
+
// スキップすることで冪等にする(mutation record も発生させない)。
|
|
5325
|
+
let anchor = targetNode;
|
|
5321
5326
|
for (const node of this._childNodeArray) {
|
|
5322
|
-
|
|
5323
|
-
|
|
5327
|
+
if (anchor.nextSibling !== node) {
|
|
5328
|
+
markObserverSkipOnAdd(node);
|
|
5329
|
+
parentNode.insertBefore(node, anchor.nextSibling);
|
|
5330
|
+
}
|
|
5331
|
+
anchor = node;
|
|
5324
5332
|
}
|
|
5325
5333
|
}
|
|
5326
5334
|
this._mounted = true;
|
|
@@ -5728,12 +5736,10 @@ function applyChangeToFor(bindingInfo, context, newValue) {
|
|
|
5728
5736
|
}
|
|
5729
5737
|
}
|
|
5730
5738
|
|
|
5731
|
-
const lastConnectedByNode = new WeakMap();
|
|
5732
5739
|
function bindingInfoText(bindingInfo) {
|
|
5733
5740
|
return `${bindingInfo.bindingType} ${bindingInfo.statePathName} ${bindingInfo.outFilters.map(f => f.filterName).join('|')} ${bindingInfo.node.isConnected ? '(connected)' : '(disconnected)'}`;
|
|
5734
5741
|
}
|
|
5735
5742
|
function applyChangeToIf(bindingInfo, context, rawNewValue) {
|
|
5736
|
-
const currentConnected = bindingInfo.node.isConnected;
|
|
5737
5743
|
const newValue = Boolean(rawNewValue);
|
|
5738
5744
|
let content;
|
|
5739
5745
|
const contents = getContentSetByNode(bindingInfo.node);
|
|
@@ -5746,35 +5752,30 @@ function applyChangeToIf(bindingInfo, context, rawNewValue) {
|
|
|
5746
5752
|
const ssrMode = inSsr();
|
|
5747
5753
|
const uuid = bindingInfo.uuid ?? '';
|
|
5748
5754
|
const keyword = bindingInfo.bindingType; // if, elseif, else
|
|
5749
|
-
|
|
5750
|
-
if (
|
|
5751
|
-
if (
|
|
5752
|
-
console.log(`unmount if content : ${bindingInfoText(bindingInfo)}`);
|
|
5753
|
-
}
|
|
5754
|
-
deactivateContent(content);
|
|
5755
|
-
content.unmount();
|
|
5756
|
-
}
|
|
5757
|
-
if (newValue) {
|
|
5758
|
-
if (config.debug) {
|
|
5759
|
-
console.log(`mount if content : ${bindingInfoText(bindingInfo)}`);
|
|
5760
|
-
}
|
|
5761
|
-
if (ssrMode) {
|
|
5762
|
-
const startComment = document.createComment(`@@wcs-${keyword}-start:${uuid}:${bindingInfo.statePathName}`);
|
|
5763
|
-
bindingInfo.node.parentNode.insertBefore(startComment, bindingInfo.node.nextSibling);
|
|
5764
|
-
content.mountAfter(startComment);
|
|
5765
|
-
const endComment = document.createComment(`@@wcs-${keyword}-end:${uuid}:${bindingInfo.statePathName}`);
|
|
5766
|
-
const afterNode = content.lastNode ?? startComment;
|
|
5767
|
-
afterNode.parentNode.insertBefore(endComment, afterNode.nextSibling);
|
|
5768
|
-
}
|
|
5769
|
-
else {
|
|
5770
|
-
content.mountAfter(bindingInfo.node);
|
|
5771
|
-
}
|
|
5772
|
-
const loopContext = getLoopContextByNode(bindingInfo.node);
|
|
5773
|
-
activateContent(content, loopContext, context);
|
|
5755
|
+
if (!newValue) {
|
|
5756
|
+
if (config.debug) {
|
|
5757
|
+
console.log(`unmount if content : ${bindingInfoText(bindingInfo)}`);
|
|
5774
5758
|
}
|
|
5759
|
+
deactivateContent(content);
|
|
5760
|
+
content.unmount();
|
|
5775
5761
|
}
|
|
5776
|
-
|
|
5777
|
-
|
|
5762
|
+
if (newValue) {
|
|
5763
|
+
if (config.debug) {
|
|
5764
|
+
console.log(`mount if content : ${bindingInfoText(bindingInfo)}`);
|
|
5765
|
+
}
|
|
5766
|
+
if (ssrMode) {
|
|
5767
|
+
const startComment = document.createComment(`@@wcs-${keyword}-start:${uuid}:${bindingInfo.statePathName}`);
|
|
5768
|
+
bindingInfo.node.parentNode.insertBefore(startComment, bindingInfo.node.nextSibling);
|
|
5769
|
+
content.mountAfter(startComment);
|
|
5770
|
+
const endComment = document.createComment(`@@wcs-${keyword}-end:${uuid}:${bindingInfo.statePathName}`);
|
|
5771
|
+
const afterNode = content.lastNode ?? startComment;
|
|
5772
|
+
afterNode.parentNode.insertBefore(endComment, afterNode.nextSibling);
|
|
5773
|
+
}
|
|
5774
|
+
else {
|
|
5775
|
+
content.mountAfter(bindingInfo.node);
|
|
5776
|
+
}
|
|
5777
|
+
const loopContext = getLoopContextByNode(bindingInfo.node);
|
|
5778
|
+
activateContent(content, loopContext, context);
|
|
5778
5779
|
}
|
|
5779
5780
|
}
|
|
5780
5781
|
|
|
@@ -6896,7 +6897,7 @@ async function buildBindings(root) {
|
|
|
6896
6897
|
}
|
|
6897
6898
|
}
|
|
6898
6899
|
|
|
6899
|
-
var version = "1.22.
|
|
6900
|
+
var version = "1.22.5";
|
|
6900
6901
|
var pkg = {
|
|
6901
6902
|
version: version};
|
|
6902
6903
|
|